aboutsummaryrefslogtreecommitdiffstats
path: root/src/libpyexiv2.cpp
diff options
context:
space:
mode:
authorOlivier Tilloy <olivier@tilloy.net>2007-09-16 19:46:07 +0200
committerOlivier Tilloy <olivier@tilloy.net>2007-09-16 19:46:07 +0200
commit7b7f5662bc7bff7d3e36247d9df9a5e3dd5d0182 (patch)
treee65bbcba7506e1362bf2f542001c40428388722a /src/libpyexiv2.cpp
parentd79143ade7fab1ce8a07c9a8a09cf9a58a4f8b08 (diff)
downloadpyexiv2-7b7f5662bc7bff7d3e36247d9df9a5e3dd5d0182.tar.gz
Fixed a bug reported by Damon Lynch: due to interface changes for exceptions management in libexiv2 0.13, libpyexiv2 would not compile against versions >= 0.13.
Diffstat (limited to 'src/libpyexiv2.cpp')
-rw-r--r--src/libpyexiv2.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libpyexiv2.cpp b/src/libpyexiv2.cpp
index 4bd515e..5c3ecde 100644
--- a/src/libpyexiv2.cpp
+++ b/src/libpyexiv2.cpp
@@ -362,7 +362,13 @@ namespace LibPyExiv2
void translateExiv2Error(Exiv2::Error const& e)
{
// Use the Python 'C' API to set up an exception object
- const char* message = e.what().c_str();
+
+ // Building a C++ string first allows this code to compile with all
+ // versions of libexiv2 (< 0.13 and >= 0.13), because the way exceptions
+ // are handled in libexiv2 was changed in 0.13.
+ const std::string sMessage(e.what());
+ const char* message = sMessage.c_str();
+
// The type of the Python exception depends on the error code
// Warning: this piece of code should be updated in case the error codes
// defined by Exiv2 (file 'src/error.cpp') are changed