diff options
author | Hubert Figuière <hub@figuiere.net> | 2017-01-22 15:44:00 -0500 |
---|---|---|
committer | Hubert Figuière <hub@figuiere.net> | 2017-01-22 15:44:00 -0500 |
commit | db6b6a0897f8d640212daf147899e9ad49f47274 (patch) | |
tree | 30510f5df980edf04f471e582eb07903f98ae53a | |
parent | d5c9c9cab19a57dc1288802f48b197822def7ad8 (diff) |
Bug 99494 - Restore error propagation
Register a global Error callback that will make error being thrown
-rw-r--r-- | exempi/exempi.cpp | 11 | ||||
-rw-r--r-- | exempi/tests/testparse.cpp | 3 |
2 files changed, 11 insertions, 3 deletions
diff --git a/exempi/exempi.cpp b/exempi/exempi.cpp index 5392047..6857df9 100644 --- a/exempi/exempi.cpp +++ b/exempi/exempi.cpp @@ -183,6 +183,13 @@ int xmp_get_error() #endif } +// the error callback - force throwing exceptions +static bool _xmp_error_callback(void* context, XMP_ErrorSeverity severity, + XMP_Int32 cause, XMP_StringPtr message) +{ + return false; +} + bool xmp_init() { RESET_ERROR; @@ -192,7 +199,9 @@ bool xmp_init() // text // conversion // the one that was done in Exempi with libiconv. - return SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText); + bool result = SXMPFiles::Initialize(kXMPFiles_IgnoreLocalText); + SXMPMeta::SetDefaultErrorCallback(&_xmp_error_callback, nullptr, 1); + return result; } catch (const XMP_Error &e) { set_error(e); diff --git a/exempi/tests/testparse.cpp b/exempi/tests/testparse.cpp index c979a89..f3a42df 100644 --- a/exempi/tests/testparse.cpp +++ b/exempi/tests/testparse.cpp @@ -62,8 +62,7 @@ int test_main(int argc, char *argv[]) XmpPtr xmp = xmp_new_empty(); - // TODO current xmp_parse will succeed with invalid XML - BOOST_CHECK(xmp_parse(xmp, buffer, len)); + BOOST_CHECK(!xmp_parse(xmp, buffer, len)); BOOST_CHECK(xmp != NULL); |