From e981c84492bd299c641a8076ffad78ac0ef81513 Mon Sep 17 00:00:00 2001 From: johncliff Date: Wed, 20 Aug 2008 21:01:27 +0000 Subject: [PATCH] Fix to bug with export-width and export-height due to errno not being reset during strtoul. See jabber logs at 4pm 8/20/08 --- src/main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index f19dac81c..f9904c71c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -434,7 +434,7 @@ static Glib::ustring _win32_getExePath() /** * Set up the PATH and PYTHONPATH environment variables on * win32 - */ + */ static int _win32_set_inkscape_env(const Glib::ustring &exePath) { @@ -477,7 +477,7 @@ static int _win32_set_inkscape_env(const Glib::ustring &exePath) /** * This is the classic main() entry point of the program, though on some * architectures it might be called by something else. - */ + */ int main(int argc, char **argv) { @@ -505,7 +505,7 @@ main(int argc, char **argv) /** * Call bindtextdomain() for various machines's paths - */ + */ #ifdef ENABLE_NLS #ifdef WIN32 Glib::ustring localePath = homedir; @@ -1104,6 +1104,7 @@ sp_do_export_png(SPDocument *doc) unsigned long int height = 0; if (sp_export_width) { + errno=0; width = strtoul(sp_export_width, NULL, 0); if ((width < 1) || (width > PNG_UINT_31_MAX) || (errno == ERANGE) ) { g_warning("Export width %lu out of range (1 - %lu). Nothing exported.", width, (unsigned long int)PNG_UINT_31_MAX); @@ -1113,6 +1114,7 @@ sp_do_export_png(SPDocument *doc) } if (sp_export_height) { + errno=0; height = strtoul(sp_export_height, NULL, 0); if ((height < 1) || (height > PNG_UINT_31_MAX)) { g_warning("Export height %lu out of range (1 - %lu). Nothing exported.", height, (unsigned long int)PNG_UINT_31_MAX); -- 2.30.2