Permalink
Browse files

Avoiding overzealous warnings by performing explicit casts to const

  • Loading branch information...
1 parent a9b97a3 commit e2355f236e264df54961066f290f11c4e19c2f47 @TacoSteemers committed Mar 21, 2013
Showing with 4 additions and 13 deletions.
  1. +0 −9 README.md
  2. +2 −2 code/backup.c
  3. +1 −1 code/daemon.c
  4. +1 −1 code/daemonWindows.c
View
@@ -59,14 +59,5 @@ Low priotity:
- Determining the difference between a 'thumb drive' and external storage hard disks
- Configuration options for ignoring external storage hard disks or 'thumb drives'
-## Note on building
-When building the project with the attached Makefile, a warning should show, like the following:
-
- ../code/daemon.c: In function ‘main’:
- ../code/daemon.c:21:2: warning: passing argument 1 of ‘processArguments’ from incompatible pointer type [enabled by default]
- ../code/processArguments.h:1:6: note: expected ‘const char * const*’ but argument is of type ‘char **’
-
-This is not a problem in this case. If you want to know why, you can read about it [here, on StackOverflow](http://stackoverflow.com/questions/12992407/warning-when-passing-non-const-parameter-to-a-function-that-expects-const-parame).
-
## License
This program is distributed under the terms of the GNU General Public License. A version of this license should have been provided with the program. It can also be found on: [http://www.gnu.org/licenses/gpl-3.0.txt](http://www.gnu.org/licenses/gpl-3.0.txt)
View
@@ -33,12 +33,12 @@ void backDeviceUp(char* mountPoint, char* deviceId)
int needsWhitelisting = 0;
if(gBlacklist[0] != NULL)
{
- blacklisted = contains(gBlacklist, deviceId);
+ blacklisted = contains((const char * const *)gBlacklist, deviceId);
}
if(gWhitelist[0] != NULL)
{
needsWhitelisting = 1;
- whitelisted = contains(gWhitelist, deviceId);
+ whitelisted = contains((const char * const *)gWhitelist, deviceId);
}
if((blacklisted == 1) && (whitelisted == 1))
{
View
@@ -70,7 +70,7 @@ int main(int argc, char *argv[]) {
/* Initialization of the daemon functionality */
initializeDeviceBookKeeping();
- processArguments(argv, argc);
+ processArguments((const char * const *)argv, argc);
if(gTargetDirectory == NULL)
{
syslog(LOG_ERR, "Exiting with failure: No target directory has been specified. Specifying a target directory is mandatory.");
@@ -64,7 +64,7 @@ int main(int argc, char *argv[]) {
/* Initialization of the daemon functionality */
initializeDeviceBookKeeping();
- processArguments(argv, argc);
+ processArguments((const char * const *)argv, argc);
if(gTargetDirectory == NULL)
{
syslog(LOG_ERR, "Exiting with failure: No target directory has been specified. Specifying a target directory is mandatory.");

0 comments on commit e2355f2

Please sign in to comment.