diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2012-04-22 16:31:34 +0000 |
|---|---|---|
| committer | Kris <Kris.De.Gussem@hotmail.com> | 2012-04-22 16:31:34 +0000 |
| commit | d23955d30e93b41c621047250480d75a55752419 (patch) | |
| tree | 1bb0a93b9984502ef05443f00cc100f2ec5a4e65 /src/main.cpp | |
| parent | Improve pen & pencil anchor visibility. Fixes bug #986748. (diff) | |
| download | inkscape-d23955d30e93b41c621047250480d75a55752419.tar.gz inkscape-d23955d30e93b41c621047250480d75a55752419.zip | |
some more string class usage
(bzr r11279)
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/main.cpp b/src/main.cpp index 7a5d15cb7..a22295424 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1253,10 +1253,9 @@ do_query_all_recurse (SPObject *o) } -static void -sp_do_export_png(SPDocument *doc) +static void sp_do_export_png(SPDocument *doc) { - const gchar *filename = NULL; + Glib::ustring filename; bool filename_from_hint = false; gdouble dpi = 0.0; @@ -1356,7 +1355,7 @@ sp_do_export_png(SPDocument *doc) } // set filename and dpi from options, if not yet set from the hints - if (!filename) { + if (filename.empty()) { if (!sp_export_png) { g_warning ("No export filename given and no filename hint. Nothing exported."); return; @@ -1447,36 +1446,34 @@ sp_do_export_png(SPDocument *doc) } } - gchar *path = 0; + Glib::ustring path; if (filename_from_hint) { //Make relative paths go from the document location, if possible: - if (!g_path_is_absolute(filename) && doc->getURI()) { - gchar *dirname = g_path_get_dirname(doc->getURI()); - if (dirname) { - path = g_build_filename(dirname, filename, NULL); - g_free(dirname); + if (!Glib::path_is_absolute(filename) && doc->getURI()) { + Glib::ustring dirname = Glib::path_get_dirname(doc->getURI()); + if (!dirname.empty()) { + path = Glib::build_filename(dirname, filename); } } - if (!path) { - path = g_strdup(filename); + if (path.empty()) { + path = filename; } } else { - path = g_strdup(filename); + path = filename; } g_print("Background RRGGBBAA: %08x\n", bgcolor); g_print("Area %g:%g:%g:%g exported to %lu x %lu pixels (%g dpi)\n", area[Geom::X][0], area[Geom::Y][0], area[Geom::X][1], area[Geom::Y][1], width, height, dpi); - g_print("Bitmap saved as: %s\n", filename); + g_print("Bitmap saved as: %s\n", filename.c_str()); if ((width >= 1) && (height >= 1) && (width <= PNG_UINT_31_MAX) && (height <= PNG_UINT_31_MAX)) { - sp_export_png_file(doc, path, area, width, height, dpi, dpi, bgcolor, NULL, NULL, true, sp_export_id_only ? items : NULL); + sp_export_png_file(doc, path.c_str(), area, width, height, dpi, dpi, bgcolor, NULL, NULL, true, sp_export_id_only ? items : NULL); } else { g_warning("Calculated bitmap dimensions %lu %lu are out of range (1 - %lu). Nothing exported.", width, height, (unsigned long int)PNG_UINT_31_MAX); } - g_free (path); g_slist_free (items); } |
