]> git.street.me.uk Git - andy/viking.git/blobdiff - src/geojson.c
Add settings to override bfilter simplify and compress default values.
[andy/viking.git] / src / geojson.c
index 2967e50fd35372c20b90f0447886a839711430a3..b6be4786ea79ecc5188e613303d779701efaf2b0 100644 (file)
@@ -55,7 +55,7 @@ gboolean a_geojson_write_file ( VikTrwLayer *vtl, FILE *ff )
                return result;
 
        GPid pid;
                return result;
 
        GPid pid;
-       gint stdout;
+       gint mystdout;
 
        // geojson program should be on the $PATH
        gchar **argv;
 
        // geojson program should be on the $PATH
        gchar **argv;
@@ -68,7 +68,7 @@ gboolean a_geojson_write_file ( VikTrwLayer *vtl, FILE *ff )
 
        GError *error = NULL;
        // TODO: monitor stderr?
 
        GError *error = NULL;
        // TODO: monitor stderr?
-       if (!g_spawn_async_with_pipes (NULL, argv, NULL, (GSpawnFlags) G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, NULL, &stdout, NULL, &error)) {
+       if (!g_spawn_async_with_pipes (NULL, argv, NULL, (GSpawnFlags) G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, NULL, &mystdout, NULL, &error)) {
 
                if ( IS_VIK_WINDOW ((VikWindow *)VIK_GTK_WINDOW_FROM_LAYER(vtl)) ) {
                        gchar* msg = g_strdup_printf ( _("%s command failed: %s"), argv[0], error->message );
 
                if ( IS_VIK_WINDOW ((VikWindow *)VIK_GTK_WINDOW_FROM_LAYER(vtl)) ) {
                        gchar* msg = g_strdup_printf ( _("%s command failed: %s"), argv[0], error->message );
@@ -83,11 +83,11 @@ gboolean a_geojson_write_file ( VikTrwLayer *vtl, FILE *ff )
        else {
                // Probably should use GIOChannels...
                gchar line[512];
        else {
                // Probably should use GIOChannels...
                gchar line[512];
-               FILE *fout = fdopen(stdout, "r");
+               FILE *fout = fdopen(mystdout, "r");
                setvbuf(fout, NULL, _IONBF, 0);
 
                while (fgets(line, sizeof(line), fout)) {
                setvbuf(fout, NULL, _IONBF, 0);
 
                while (fgets(line, sizeof(line), fout)) {
-                       fprintf ( ff, line );
+                       fprintf ( ff, "%s", line );
                }
 
                fclose(fout);
                }
 
                fclose(fout);
@@ -99,7 +99,7 @@ gboolean a_geojson_write_file ( VikTrwLayer *vtl, FILE *ff )
        g_strfreev (argv);
 
        // Delete the temporary file
        g_strfreev (argv);
 
        // Delete the temporary file
-       g_remove (tmp_filename);
+       (void)g_remove (tmp_filename);
        g_free (tmp_filename);
 
        return result;
        g_free (tmp_filename);
 
        return result;
@@ -150,7 +150,7 @@ gchar* a_geojson_import_to_gpx ( const gchar *filename )
        g_debug ( "%s: temporary file = %s", __FUNCTION__, gpx_filename );
 
        GPid pid;
        g_debug ( "%s: temporary file = %s", __FUNCTION__, gpx_filename );
 
        GPid pid;
-       gint stdout;
+       gint mystdout;
 
        // geojson program should be on the $PATH
        gchar **argv;
 
        // geojson program should be on the $PATH
        gchar **argv;
@@ -162,18 +162,18 @@ gchar* a_geojson_import_to_gpx ( const gchar *filename )
        FILE *gpxfile = fdopen (fd, "w");
 
        // TODO: monitor stderr?
        FILE *gpxfile = fdopen (fd, "w");
 
        // TODO: monitor stderr?
-       if (!g_spawn_async_with_pipes (NULL, argv, NULL, (GSpawnFlags) G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, NULL, &stdout, NULL, &error)) {
+       if (!g_spawn_async_with_pipes (NULL, argv, NULL, (GSpawnFlags) G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, NULL, &mystdout, NULL, &error)) {
                g_warning ("Async command failed: %s", error->message);
                g_error_free(error);
        }
        else {
                // Probably should use GIOChannels...
                gchar line[512];
                g_warning ("Async command failed: %s", error->message);
                g_error_free(error);
        }
        else {
                // Probably should use GIOChannels...
                gchar line[512];
-               FILE *fout = fdopen(stdout, "r");
+               FILE *fout = fdopen(mystdout, "r");
                setvbuf(fout, NULL, _IONBF, 0);
 
                while (fgets(line, sizeof(line), fout)) {
                setvbuf(fout, NULL, _IONBF, 0);
 
                while (fgets(line, sizeof(line), fout)) {
-                       fprintf ( gpxfile, line );
+                       fprintf ( gpxfile, "%s", line );
                }
 
                fclose(fout);
                }
 
                fclose(fout);