From 5006fb6b27dd662bfe29c7ab35017beda9712694 Mon Sep 17 00:00:00 2001 From: Adam Reichold Date: Mon, 28 Dec 2015 21:01:09 +0100 Subject: [PATCH] Remove all conditional compilation w.r.t. disabling exceptions in Glib since that is no longer supported anyway. --- rtengine/imagedata.cc | 4 -- rtengine/safegtk.cc | 88 +++---------------------------------------- rtgui/editwindow.cc | 8 ---- rtgui/rtwindow.cc | 9 ----- 4 files changed, 5 insertions(+), 104 deletions(-) diff --git a/rtengine/imagedata.cc b/rtengine/imagedata.cc index 11ca6f2ea..93c6b6604 100644 --- a/rtengine/imagedata.cc +++ b/rtengine/imagedata.cc @@ -21,10 +21,6 @@ #include #include "safegtk.h" -#ifndef GLIBMM_EXCEPTIONS_ENABLED -#include -#endif - using namespace rtengine; extern "C" IptcData *iptc_data_new_from_jpeg_file (FILE* infile); diff --git a/rtengine/safegtk.cc b/rtengine/safegtk.cc index e072a5356..a84b73536 100644 --- a/rtengine/safegtk.cc +++ b/rtengine/safegtk.cc @@ -76,23 +76,18 @@ Cairo::RefPtr safe_create_from_png(const Glib::ustring& fil Glib::RefPtr safe_query_file_info (Glib::RefPtr &file) { Glib::RefPtr info; -#ifdef GLIBMM_EXCEPTIONS_ENABLED try { info = file->query_info(); } catch (...) { } -#else - std::auto_ptr error; - info = file->query_info("*", Gio::FILE_QUERY_INFO_NONE, error); -#endif return info; } Glib::RefPtr safe_next_file (Glib::RefPtr &dirList) { Glib::RefPtr info; -#ifdef GLIBMM_EXCEPTIONS_ENABLED + bool retry; Glib::ustring last_error = ""; @@ -113,42 +108,15 @@ Glib::RefPtr safe_next_file (Glib::RefPtr &d } } while (retry); -#else - bool retry; - Glib::ustring last_error = ""; - - do { - retry = false; - std::auto_ptr error; - Glib::RefPtr cancellable; - info = dirList->next_file(cancellable, error); - - if (!info && error.get()) { - printf ("%s\n", error.what().c_str()); - retry = (error.what() != last_error); - last_error = error.what(); - } - } while (retry); - -#endif return info; } -#ifdef GLIBMM_EXCEPTIONS_ENABLED # define SAFE_ENUMERATOR_CODE_START \ do{try { if ((dirList = dir->enumerate_children ())) \ for (Glib::RefPtr info = safe_next_file(dirList); info; info = safe_next_file(dirList)) { # define SAFE_ENUMERATOR_CODE_END \ }} catch (Glib::Exception& ex) { printf ("%s\n", ex.what().c_str()); }}while(0) -#else -# define SAFE_ENUMERATOR_CODE_START \ - do{std::auto_ptr error; Glib::RefPtr cancellable; \ - if ((dirList = dir->enumerate_children (cancellable, "*", Gio::FILE_QUERY_INFO_NONE, error))) \ - for (Glib::RefPtr info = safe_next_file(dirList); info; info = safe_next_file(dirList)) { - -# define SAFE_ENUMERATOR_CODE_END } if (error.get()) printf ("%s\n", error->what().c_str());}while (0) -#endif /* * safe_build_file_list can now filter out at the source all files that doesn't have the extensions specified (if provided) @@ -223,8 +191,8 @@ void safe_build_subdir_list (Glib::RefPtr &dir, std::vector error; - utf8_str = locale_to_utf8(src, error); - if (error.get()) { - utf8_str = Glib::convert_with_fallback(src, "UTF-8", "ISO-8859-1", "?", error); - } - } -#endif //GLIBMM_EXCEPTIONS_ENABLED -#else utf8_str = Glib::filename_to_utf8(src); + #endif + return utf8_str; } Glib::ustring safe_locale_to_utf8 (const std::string& src) { Glib::ustring utf8_str; -#ifdef GLIBMM_EXCEPTIONS_ENABLED try { utf8_str = Glib::locale_to_utf8(src); @@ -259,38 +219,17 @@ Glib::ustring safe_locale_to_utf8 (const std::string& src) utf8_str = Glib::convert_with_fallback(src, "UTF-8", "ISO-8859-1", "?"); } -#else - { - std::auto_ptr error; - utf8_str = locale_to_utf8(src, error); - - if (error.get()) { - utf8_str = Glib::convert_with_fallback(src, "UTF-8", "ISO-8859-1", "?", error); - } - } -#endif //GLIBMM_EXCEPTIONS_ENABLED return utf8_str; } std::string safe_locale_from_utf8 (const Glib::ustring& utf8_str) { std::string str; -#ifdef GLIBMM_EXCEPTIONS_ENABLED try { str = Glib::locale_from_utf8(utf8_str); - } catch (const Glib::Error& e) { - //str = Glib::convert_with_fallback(utf8_str, "ISO-8859-1", "UTF-8", "?"); - } + } catch (Glib::Error&) {} -#else - { - std::auto_ptr error; - str = Glib::locale_from_utf8(utf8_str, error); - /*if (error.get()) - {str = Glib::convert_with_fallback(utf8_str, "ISO-8859-1", "UTF-8", "?", error);}*/ - } -#endif //GLIBMM_EXCEPTIONS_ENABLED return str; } @@ -298,7 +237,6 @@ bool safe_spawn_command_line_async (const Glib::ustring& cmd_utf8) { std::string cmd; bool success = false; -#ifdef GLIBMM_EXCEPTIONS_ENABLED try { cmd = Glib::filename_from_utf8(cmd_utf8); @@ -309,22 +247,6 @@ bool safe_spawn_command_line_async (const Glib::ustring& cmd_utf8) printf ("%s\n", ex.what().c_str()); } -#else - std::auto_ptr error; - cmd = Glib::filename_from_utf8(cmd_utf8, error); - - if (!error.get()) { - printf ("command line: %s\n", cmd.c_str()); - Glib::spawn_command_line_async (cmd, error); - } - - if (error.get()) { - printf ("%s\n", error->what().c_str()); - } else { - success = true; - } - -#endif return success; } diff --git a/rtgui/editwindow.cc b/rtgui/editwindow.cc index 88bd2aee4..76e351569 100644 --- a/rtgui/editwindow.cc +++ b/rtgui/editwindow.cc @@ -61,20 +61,12 @@ EditWindow::EditWindow (RTWindow* p) : parent(p) , isFullscreen(false) Glib::ustring fName = "rt-logo.png"; Glib::ustring fullPath = RTImage::findIconAbsolutePath(fName); -#ifdef GLIBMM_EXCEPTIONS_ENABLED - try { set_default_icon_from_file (fullPath); } catch(Glib::Exception& ex) { printf ("%s\n", ex.what().c_str()); } -#else - { - std::auto_ptr error; - set_default_icon_from_file (fullPath, error); - } -#endif //GLIBMM_EXCEPTIONS_ENABLED set_title_decorated(""); property_allow_shrink() = true; set_modal(false); diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index e3428dea7..338c5b36e 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -94,21 +94,12 @@ RTWindow::RTWindow () Glib::ustring fName = "rt-logo.png"; Glib::ustring fullPath = RTImage::findIconAbsolutePath(fName); -#ifdef GLIBMM_EXCEPTIONS_ENABLED - try { set_default_icon_from_file (fullPath); } catch(Glib::Exception& ex) { printf ("%s\n", ex.what().c_str()); } -#else - { - std::auto_ptr error; - set_default_icon_from_file (fullPath, error); - } -#endif //GLIBMM_EXCEPTIONS_ENABLED - #if defined(__APPLE__) { osxApp = (GtkosxApplication *)g_object_new (GTKOSX_TYPE_APPLICATION, NULL);