Selaa lähdekoodia

v.surf.idw: fix uninitialized ret value for 2D without column specified (#1548)

Backport from #1547.
Anna Petrasova 4 vuotta sitten
vanhempi
commit
a08d02b0b5
1 muutettua tiedostoa jossa 17 lisäystä ja 17 poistoa
  1. 17 17
      vector/v.surf.idw/read_sites.c

+ 17 - 17
vector/v.surf.idw/read_sites.c

@@ -83,29 +83,29 @@ void read_sites(const char *name, const char *field_name, const char *col, int n
 	    continue;
 
 	if (!with_z) {
-	    int cat, ival, ret;
+	    int cat;
 
 	    /* TODO: what to do with multiple cats */
 	    Vect_cat_get(Cats, field, &cat);
 	    if (cat < 0) /* skip features without category */
 		continue;
 
-            if (col) {
-                if (ctype == DB_C_TYPE_INT) {
-                    ret = db_CatValArray_get_value_int(&cvarr, cat, &ival);
-                    dval = ival;
-                }
-                else {		/* DB_C_TYPE_DOUBLE */
-                    ret = db_CatValArray_get_value_double(&cvarr, cat, &dval);
-                }
-            }
-            else {
-                dval = cat;
-            }
-
-	    if (ret != DB_OK) {
-		G_warning(_("No record for point (cat = %d)"), cat);
-		continue;
+	    if (col) {
+		int ival, ret;
+		if (ctype == DB_C_TYPE_INT) {
+		    ret = db_CatValArray_get_value_int(&cvarr, cat, &ival);
+		    dval = ival;
+		}
+		else {		/* DB_C_TYPE_DOUBLE */
+		    ret = db_CatValArray_get_value_double(&cvarr, cat, &dval);
+		}
+		if (ret != DB_OK) {
+		    G_warning(_("No record for point (cat = %d)"), cat);
+		    continue;
+		}
+	    }
+	    else {
+		dval = cat;
 	    }
 	}
 	else