Bladeren bron

Fix comparing a pointer to a null character constant (#1265)

Addresses -Wpointer-compare compiler warnings.
nilason 4 jaren geleden
bovenliggende
commit
f0261d556c
3 gewijzigde bestanden met toevoegingen van 4 en 4 verwijderingen
  1. 1 1
      lib/db/dbmi_client/c_list_drivers.c
  2. 1 1
      lib/db/dbmi_client/start.c
  3. 2 2
      lib/gis/parser.c

+ 1 - 1
lib/db/dbmi_client/c_list_drivers.c

@@ -32,7 +32,7 @@ const char *db_list_drivers(void)
     else {
 	/* build the comma separated string of existing drivers */
 	for (cur = list; cur; cur = cur->next) {
-	    if (cur->driverName == '\0')
+	    if (cur->driverName[0] == '\0')
 		break;
 	    else {
 		if (cur != list)

+ 1 - 1
lib/db/dbmi_client/start.c

@@ -94,7 +94,7 @@ dbDriver *db_start_driver(const char *name)
 	return (dbDriver *) NULL;
 
     /* if name is empty use connection.driverName, added by RB 4/2000 */
-    if (name == '\0') {
+    if (name[0] == '\0') {
 	db_get_connection(&connection);
 	if (NULL == (name = connection.driverName))
 	    return (dbDriver *) NULL;

+ 2 - 2
lib/gis/parser.c

@@ -1207,7 +1207,7 @@ void check_opts(void)
 		check_an_opt(opt->key, opt->type,
 			     opt->options, opt->opts, &opt->answer);
 	    else {
-		for (ans = 0; opt->answers[ans] != '\0'; ans++)
+		for (ans = 0; opt->answers[ans] != NULL; ans++)
 		    check_an_opt(opt->key, opt->type,
 				 opt->options, opt->opts, &opt->answers[ans]);
 	    }
@@ -1529,7 +1529,7 @@ void check_multiple_opts(void)
 		if (*ptr == ',')
 		    n_commas++;
 	    /* count items */
-	    for (n = 0; opt->answers[n] != '\0'; n++) ;
+	    for (n = 0; opt->answers[n] != NULL; n++) ;
 	    /* if not correct multiple of items */
 	    if (n % n_commas) {
 		G_asprintf(&err,