[GRASS-SVN] r64040 - grass/trunk/vector/v.what
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jan 9 13:00:52 PST 2015
Author: annakrat
Date: 2015-01-09 13:00:52 -0800 (Fri, 09 Jan 2015)
New Revision: 64040
Modified:
grass/trunk/vector/v.what/what.c
Log:
v.what: escape backslash in database path on Windows to create valid JSON
Modified: grass/trunk/vector/v.what/what.c
===================================================================
--- grass/trunk/vector/v.what/what.c 2015-01-09 20:42:11 UTC (rev 64039)
+++ grass/trunk/vector/v.what/what.c 2015-01-09 21:00:52 UTC (rev 64040)
@@ -537,6 +537,7 @@
if (Cats->n_cats > 0) {
int j;
char *formbuf1;
+ char *formbuf2;
if (json) {
fprintf(stdout, ",\n\"Categories\": [");
}
@@ -563,9 +564,12 @@
Fi->driver, Fi->database, Fi->table, Fi->key);
}
else if (json) {
+ /* escape backslash to create valid JSON */
+ formbuf2 = G_str_replace(Fi->database, "\\", "\\\\");
fprintf(stdout,
",\n\"Driver\": \"%s\",\n\"Database\": \"%s\",\n\"Table\": \"%s\",\n\"Key_column\": \"%s\"",
- Fi->driver, Fi->database, Fi->table, Fi->key);
+ Fi->driver, formbuf2, Fi->table, Fi->key);
+ G_free(formbuf2);
}
else {
fprintf(stdout,
More information about the grass-commit
mailing list