[GRASS-SVN] r70421 - grass-addons/grass7/vector/v.profile
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jan 24 03:15:32 PST 2017
Author: marisn
Date: 2017-01-24 03:15:32 -0800 (Tue, 24 Jan 2017)
New Revision: 70421
Modified:
grass-addons/grass7/vector/v.profile/main.c
Log:
Fix signed/unsigned comparison + GCC uninitalized warning.
Modified: grass-addons/grass7/vector/v.profile/main.c
===================================================================
--- grass-addons/grass7/vector/v.profile/main.c 2017-01-24 07:40:32 UTC (rev 70420)
+++ grass-addons/grass7/vector/v.profile/main.c 2017-01-24 11:15:32 UTC (rev 70421)
@@ -49,9 +49,11 @@
struct ilist *Catlist;
FILE *ascii;
- int i, dp, type, otype, id, ncols, nrows, ncats, col, more, open3d,
+ int i, dp, type, otype, id, nrows, ncats, col, more, open3d,
layer, pro_layer, *cats, c, field_index, cat;
- size_t rescount;
+ size_t j, rescount;
+ /* GCC */
+ int ncols = 0;
double xval, yval, bufsize;
const char *mapset, *pro_mapset;
char sql[200], *fs;
@@ -544,20 +546,20 @@
}
/* Print out result */
- for (i = 0; i < rescount; i++) {
- fprintf(ascii, "%d%s%.*f", i + 1, fs, dp, resultset[i].distance);
+ for (j = 0; j < rescount; j++) {
+ fprintf(ascii, "%zu%s%.*f", j + 1, fs, dp, resultset[j].distance);
if (open3d == WITH_Z)
- fprintf(ascii, "%s%.*f", fs, dp, resultset[i].z);
+ fprintf(ascii, "%s%.*f", fs, dp, resultset[j].z);
if (Fi != NULL) {
sprintf(sql, "select * from %s where %s=%d", Fi->table, Fi->key,
- resultset[i].cat);
+ resultset[j].cat);
G_debug(2, "SQL: \"%s\"", sql);
db_set_string(&dbsql, sql);
/* driver IS initialized here in case if Fi != NULL */
if (db_open_select_cursor(driver, &dbsql, &cursor, DB_SEQUENTIAL)
!= DB_OK)
G_warning(_("Unabale to get attribute data for cat %d"),
- resultset[i].cat);
+ resultset[j].cat);
else {
nrows = db_get_num_rows(&cursor);
G_debug(1, "Result count: %d", nrows);
@@ -566,7 +568,7 @@
if (nrows > 0) {
if (db_fetch(&cursor, DB_NEXT, &more) != DB_OK) {
G_warning(_("Error while retreiving database record for cat %d"),
- resultset[i].cat);
+ resultset[j].cat);
}
else {
for (col = 0; col < ncols; col++) {
More information about the grass-commit
mailing list