[glom/maemo5] Tests: Import: Fixed the no-exceptions build.



commit 8c090f6fcda56d01e2e1e53d876580e1c27c8c40
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Oct 7 21:23:54 2009 +0200

    Tests: Import: Fixed the no-exceptions build.
    
    * tests/import/utils.cc: Fixed the no-exceptions build.

 ChangeLog             |    6 ++++++
 tests/import/utils.cc |   26 ++++++++++++++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 363cfa0..0fde5ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-10-07  Murray Cumming  <murrayc murrayc com>
+
+  Tests: Import: Fixed the no-exceptions build.
+  
+	* tests/import/utils.cc: Fixed the no-exceptions build.
+
 2009-10-06  Murray Cumming  <murrayc murrayc com>
 
 	Maemo: List: Click to view details.
diff --git a/tests/import/utils.cc b/tests/import/utils.cc
index a343983..f6f2361 100644
--- a/tests/import/utils.cc
+++ b/tests/import/utils.cc
@@ -23,9 +23,24 @@ static std::string create_file_from_buffer(const char* input, guint input_size)
   if(-1 < tmp_file_handle)
     close(tmp_file_handle);
 
-  const std::string file_uri = Glib::filename_to_uri(tmp_filename);
+  std::string file_uri;
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  //TODO: Catch exception.
+  file_uri = Glib::filename_to_uri(tmp_filename);
+  #else
+  std::auto_ptr<Glib::Error> ex;
+  file_uri = Glib::filename_to_uri(tmp_filename, ex);
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
+  
   Glib::RefPtr<Gio::File> file = Gio::File::create_for_uri(file_uri);
-  gssize result = file->append_to()->write(input, input_size);
+  
+  gssize result = 0;
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  //TODO: Catch exception.
+  result = file->append_to()->write(input, input_size);
+  #else
+  result = file->append_to(Gio::FILE_CREATE_NONE, ex)->write(input, input_size, ex);
+  #endif
   g_return_val_if_fail(-1 < result, "");
 
   return file_uri;
@@ -83,7 +98,14 @@ bool run_parser_from_buffer(const FuncConnectParserSignals& connect_parser_signa
   mainloop->run();
 
   Glib::RefPtr<Gio::File> file = Gio::File::create_for_uri(file_uri);
+  
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  //TODO: Catch exception.
   const bool removed = file->remove();
+  #else
+  std::auto_ptr<Glib::Error> ex;
+  const bool removed = file->remove(ex);
+  #endif 
   g_assert(removed);
 
   return finished_parsing;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]