From 605884aab0bd7e6bb5c5501d4149d4aee61429d2 Mon Sep 17 00:00:00 2001 From: Hubert Figuiere Date: Wed, 31 Oct 2007 21:28:32 -0400 Subject: [PATCH] * ABI breakage: soversion is now 3 * exempi/{exempi.cpp,xmp.h}: xmp_get_property_and_bits() renamed xmp_get_property(). xmp_set_property2() renamed xmp_set_property(). More exception handling and refactor set_error() use. * exempi/tests/*: update for new API. --- AUTHORS | 4 +-- ChangeLog | 11 ++++++++ NEWS | 4 +++ README | 10 ++++--- configure.ac | 8 ++++-- debian/control | 8 +++--- exempi/exempi.cpp | 63 +++++++++++++++++------------------------- exempi/tests/test1.cpp | 22 ++++++--------- exempi/tests/test2.cpp | 6 ++-- exempi/xmp.h | 27 ++++++------------ rpm/SLED10.spec | 2 +- 11 files changed, 79 insertions(+), 86 deletions(-) diff --git a/AUTHORS b/AUTHORS index 547c8b8..018b451 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,8 +1,8 @@ The package is based on Adobe XMP SDK 4.1.1. - -Other authors are: +Authors are: Hubert Figuiere +Adobe Systems Incorporated (XMP SDK) Ian Jacobi Jason Kivlighn diff --git a/ChangeLog b/ChangeLog index 7800a86..050d3e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-10-30 Hubert Figuiere + + * ABI breakage: soversion is now 3 + + * exempi/{exempi.cpp,xmp.h}: xmp_get_property_and_bits() renamed + xmp_get_property(). xmp_set_property2() renamed + xmp_set_property(). More exception handling and refactor + set_error() use. + + * exempi/tests/*: update for new API. + 2007-10-02 Hubert Figuiere * exempi/exempi.cpp (xmp_files_new): Catch diff --git a/NEWS b/NEWS index 93af47a..51ba966 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ 1.99.5 +- ABI breakage: soversion is now 3 +- Change: API xmp_get_property_and_bits() renamed xmp_get_property(). +- Change: API xmp_set_property2() renamed xmp_set_property(). +- Bug: more exception handling and refactor set_error() use. - Bug: add AC_CONFIG_MACRO_DIR to configure. 1.99.4 diff --git a/README b/README index c865e7b..2612e65 100644 --- a/README +++ b/README @@ -1,5 +1,7 @@ -exempi is a port of Adobe XMP SDK to work on UNIX -and to be build with GNU automake. -It includes XMPCore and XMPFiles. +exempi is a port of Adobe XMP SDK to work on UNIX and to be build with +GNU automake. +It includes XMPCore and XMPFiles, and exempi, a C-based API. -It is maintained by Hubert Figuiere \ No newline at end of file +It is maintained by Hubert Figuiere + +Homepage: http://libopenraw.freedesktop.org/wiki/Exempi diff --git a/configure.ac b/configure.ac index bba14cc..20aee41 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.50) AC_INIT(exempi/xmp.h) -AM_INIT_AUTOMAKE(exempi, 1.99.4) +AM_INIT_AUTOMAKE(exempi, 1.99.5) AM_MAINTAINER_MODE @@ -31,9 +31,11 @@ dnl 1.99.1 is the revision 3 1 0 dnl 1.99.2 is the revision 4 2 0 dnl 1.99.3 is the revision 5 3 0 dnl 1.99.4 is the revision 6 4 0 +dnl ABI breakage reset major to 3 +dnl 1.99.5 is the revision 3.0.0 AC_SUBST([EXEMPI_REVISION], [0]) -AC_SUBST([EXEMPI_AGE], [4]) -AC_SUBST([EXEMPI_CURRENT], [6]) +AC_SUBST([EXEMPI_AGE], [0]) +AC_SUBST([EXEMPI_CURRENT], [3]) AC_SUBST([EXEMPI_CURRENT_MIN], [`expr $EXEMPI_CURRENT - $EXEMPI_AGE`]) AC_SUBST([EXEMPI_VERSION_INFO], diff --git a/debian/control b/debian/control index 9683104..d0bf923 100644 --- a/debian/control +++ b/debian/control @@ -8,22 +8,22 @@ Standards-Version: 3.7.2 Package: libexempi-dev Section: libdevel -Depends: libexempi2 (= ${Source-Version}) +Depends: libexempi3 (= ${Source-Version}) Architecture: any Description: A library to parse XMP metadata (Development files) Exempi is a library to parse XMP metadata as defined by the specification. -Package: libexempi2-dbg +Package: libexempi3-dbg Architecture: any -Depends: libexempi2 (= ${Source-Version}) +Depends: libexempi3 (= ${Source-Version}) Description: A library to parse XMP metadata (Debug files) Exempi is a library to parse XMP metadata as defined by the specification. -Package: libexempi2 +Package: libexempi3 Section: libs Architecture: any Depends: ${shlibs:Depends} diff --git a/exempi/exempi.cpp b/exempi/exempi.cpp index 7f14583..edc7909 100644 --- a/exempi/exempi.cpp +++ b/exempi/exempi.cpp @@ -113,9 +113,15 @@ bool xmp_register_namespace(const char *namespaceURI, const char *suggestedPrefix, XmpStringPtr registeredPrefix) { - return SXMPMeta::RegisterNamespace(namespaceURI, - suggestedPrefix, - STRING(registeredPrefix)); + try { + return SXMPMeta::RegisterNamespace(namespaceURI, + suggestedPrefix, + STRING(registeredPrefix)); + } + catch(const XMP_Error & e) { + set_error(e); + } + return false; } @@ -160,8 +166,13 @@ bool xmp_files_open(XmpFilePtr xf, const char *path, XmpOpenFileOptions options) void xmp_files_close(XmpFilePtr xf, XmpCloseFileOptions options) { - SXMPFiles *txf = (SXMPFiles*)xf; - txf->CloseFile(options); + try { + SXMPFiles *txf = (SXMPFiles*)xf; + txf->CloseFile(options); + } + catch(const XMP_Error & e) { + set_error(e); + } } @@ -314,15 +325,8 @@ void xmp_free(XmpPtr xmp) bool xmp_get_property(XmpPtr xmp, const char *schema, - const char *name, XmpStringPtr property) -{ - return xmp_get_property_and_bits(xmp, schema, name, property, NULL); -} - - -bool xmp_get_property_and_bits(XmpPtr xmp, const char *schema, - const char *name, XmpStringPtr property, - uint32_t *propsBits) + const char *name, XmpStringPtr property, + uint32_t *propsBits) { bool ret = false; try { @@ -363,15 +367,7 @@ bool xmp_get_array_item(XmpPtr xmp, const char *schema, return ret; } -void xmp_set_property(XmpPtr xmp, const char *schema, - const char *name, const char *value) -{ - xmp_set_property2(xmp, schema, name, value, 0); -} - - - -bool xmp_set_property2(XmpPtr xmp, const char *schema, +bool xmp_set_property(XmpPtr xmp, const char *schema, const char *name, const char *value, uint32_t optionBits) { @@ -381,9 +377,8 @@ bool xmp_set_property2(XmpPtr xmp, const char *schema, txmp->SetProperty(schema, name, value, optionBits); } catch(const XMP_Error & e) { - set_error(-e.GetID()); + set_error(e); ret = false; - std::cerr << e.GetErrMsg() << std::endl; } catch(...) { ret = false; @@ -402,9 +397,8 @@ bool xmp_set_array_item(XmpPtr xmp, const char *schema, txmp->SetArrayItem(schema, name, index, value, optionBits); } catch(const XMP_Error & e) { - set_error(-e.GetID()); + set_error(e); ret = false; - std::cerr << e.GetErrMsg() << std::endl; } catch(...) { ret = false; @@ -423,9 +417,8 @@ bool xmp_append_array_item(XmpPtr xmp, const char *schema, const char *name, optionBits); } catch(const XMP_Error & e) { - set_error(-e.GetID()); + set_error(e); ret = false; - std::cerr << e.GetErrMsg() << std::endl; } catch(...) { ret = false; @@ -441,9 +434,8 @@ bool xmp_delete_property(XmpPtr xmp, const char *schema, const char *name) txmp->DeleteProperty(schema, name); } catch(const XMP_Error & e) { - set_error(-e.GetID()); + set_error(e); ret = false; - std::cerr << e.GetErrMsg() << std::endl; } catch(...) { ret = false; @@ -459,9 +451,8 @@ bool xmp_has_property(XmpPtr xmp, const char *schema, const char *name) ret = txmp->DoesPropertyExist(schema, name); } catch(const XMP_Error & e) { - set_error(-e.GetID()); + set_error(e); ret = false; - std::cerr << e.GetErrMsg() << std::endl; } catch(...) { ret = false; @@ -503,9 +494,8 @@ bool xmp_set_localized_text(XmpPtr xmp, const char *schema, const char *name, value, optionBits); } catch(const XMP_Error & e) { - set_error(-e.GetID()); + set_error(e); ret = false; - std::cerr << e.GetErrMsg() << std::endl; } catch(...) { ret = false; @@ -525,9 +515,8 @@ bool xmp_delete_localized_text(XmpPtr xmp, const char *schema, specificLang); } catch(const XMP_Error & e) { - set_error(-e.GetID()); + set_error(e); ret = false; - std::cerr << e.GetErrMsg() << std::endl; } catch(...) { ret = false; diff --git a/exempi/tests/test1.cpp b/exempi/tests/test1.cpp index 8b0a41c..3f5fb31 100644 --- a/exempi/tests/test1.cpp +++ b/exempi/tests/test1.cpp @@ -84,10 +84,10 @@ void test_write_new_property() xmp_string_free(reg_prefix); - xmp_set_property(xmp, NS_CC, "License", "Foo"); + xmp_set_property(xmp, NS_CC, "License", "Foo", 0); XmpStringPtr the_prop = xmp_string_new(); - BOOST_CHECK(xmp_get_property(xmp, NS_CC, "License", the_prop)); + BOOST_CHECK(xmp_get_property(xmp, NS_CC, "License", the_prop, NULL)); BOOST_CHECK_EQUAL(strcmp("Foo", xmp_string_cstr(the_prop)), 0); xmp_string_free(the_prop); @@ -177,25 +177,21 @@ void test_exempi() BOOST_CHECK(xmp_has_property(xmp, NS_TIFF, "Make")); BOOST_CHECK_EQUAL(xmp_has_property(xmp, NS_TIFF, "Foo"), false); - BOOST_CHECK(xmp_get_property(xmp, NS_TIFF, "Make", the_prop)); + BOOST_CHECK(xmp_get_property(xmp, NS_TIFF, "Make", the_prop, NULL)); BOOST_CHECK_EQUAL(strcmp("Canon", xmp_string_cstr(the_prop)), 0); - xmp_set_property(xmp, NS_TIFF, "Make", "Nikon"); - BOOST_CHECK(xmp_get_property(xmp, NS_TIFF, "Make", the_prop)); - BOOST_CHECK_EQUAL(strcmp("Nikon", xmp_string_cstr(the_prop)), 0); - - BOOST_CHECK(xmp_set_property2(xmp, NS_TIFF, "Make", "Leica", 0)); - BOOST_CHECK(xmp_get_property(xmp, NS_TIFF, "Make", the_prop)); + BOOST_CHECK(xmp_set_property(xmp, NS_TIFF, "Make", "Leica", 0)); + BOOST_CHECK(xmp_get_property(xmp, NS_TIFF, "Make", the_prop, NULL)); BOOST_CHECK_EQUAL(strcmp("Leica", xmp_string_cstr(the_prop)), 0); uint32_t bits; - BOOST_CHECK(xmp_get_property_and_bits(xmp, NS_DC, "rights[1]/?xml:lang", - the_prop, &bits)); + BOOST_CHECK(xmp_get_property(xmp, NS_DC, "rights[1]/?xml:lang", + the_prop, &bits)); BOOST_CHECK_EQUAL(bits, 0x20); BOOST_CHECK(XMP_IS_PROP_QUALIFIER(bits)); - BOOST_CHECK(xmp_get_property_and_bits(xmp, NS_DC, "rights[1]", - the_prop, &bits)); + BOOST_CHECK(xmp_get_property(xmp, NS_DC, "rights[1]", + the_prop, &bits)); BOOST_CHECK_EQUAL(bits, 0x50); BOOST_CHECK(XMP_HAS_PROP_QUALIFIERS(bits)); diff --git a/exempi/tests/test2.cpp b/exempi/tests/test2.cpp index f98359c..bffc3b0 100644 --- a/exempi/tests/test2.cpp +++ b/exempi/tests/test2.cpp @@ -77,7 +77,7 @@ void test_xmpfiles_write() return; } - xmp_set_property(xmp, NS_PHOTOSHOP, "ICCProfile", "foo"); + xmp_set_property(xmp, NS_PHOTOSHOP, "ICCProfile", "foo", 0); BOOST_CHECK(xmp_files_can_put_xmp(f, xmp)); xmp_files_put_xmp(f, xmp); @@ -96,7 +96,7 @@ void test_xmpfiles_write() BOOST_CHECK(xmp != NULL); XmpStringPtr the_prop = xmp_string_new(); - BOOST_CHECK(xmp_get_property(xmp, NS_PHOTOSHOP, "ICCProfile", the_prop)); + BOOST_CHECK(xmp_get_property(xmp, NS_PHOTOSHOP, "ICCProfile", the_prop, NULL)); BOOST_CHECK_EQUAL(strcmp("foo", xmp_string_cstr(the_prop)), 0); xmp_string_free(the_prop); @@ -130,7 +130,7 @@ void test_xmpfiles() XmpStringPtr the_prop = xmp_string_new(); - BOOST_CHECK(xmp_get_property(xmp, NS_PHOTOSHOP, "ICCProfile", the_prop)); + BOOST_CHECK(xmp_get_property(xmp, NS_PHOTOSHOP, "ICCProfile", the_prop, NULL)); BOOST_CHECK_EQUAL(strcmp("sRGB IEC61966-2.1", xmp_string_cstr(the_prop)), 0); xmp_string_free(the_prop); diff --git a/exempi/xmp.h b/exempi/xmp.h index f3e07d5..884d8f4 100644 --- a/exempi/xmp.h +++ b/exempi/xmp.h @@ -378,16 +378,6 @@ bool xmp_serialize_and_format(XmpPtr xmp, XmpStringPtr buffer, uint32_t padding, const char *newline, const char *tab, int32_t indent); -/** Get an XMP property from the XMP packet - * @param xmp the XMP packet - * @param schema - * @param name - * @param property the allocated XmpStrinPtr - * @return true if found - * @todo deprecate in favor of %xmp_get_property_and_bits() - */ -bool xmp_get_property(XmpPtr xmp, const char *schema, - const char *name, XmpStringPtr property); /** Get an XMP property and it option bits from the XMP packet * @param xmp the XMP packet @@ -397,9 +387,9 @@ bool xmp_get_property(XmpPtr xmp, const char *schema, * @param propsBits pointer to the option bits. Pass NULL if not needed * @return true if found */ -bool xmp_get_property_and_bits(XmpPtr xmp, const char *schema, - const char *name, XmpStringPtr property, - uint32_t *propsBits); +bool xmp_get_property(XmpPtr xmp, const char *schema, + const char *name, XmpStringPtr property, + uint32_t *propsBits); /** Get an item frpm an array property * @param xmp the xmp meta @@ -419,13 +409,12 @@ bool xmp_get_array_item(XmpPtr xmp, const char *schema, * @param schema * @param name * @param value 0 terminated string + * @param optionBits + * @return false if failure */ -void xmp_set_property(XmpPtr xmp, const char *schema, - const char *name, const char *value); - -bool xmp_set_property2(XmpPtr xmp, const char *schema, - const char *name, const char *value, - uint32_t optionBits); +bool xmp_set_property(XmpPtr xmp, const char *schema, + const char *name, const char *value, + uint32_t optionBits); bool xmp_set_array_item(XmpPtr xmp, const char *schema, diff --git a/rpm/SLED10.spec b/rpm/SLED10.spec index 4a744b3..1dbae86 100644 --- a/rpm/SLED10.spec +++ b/rpm/SLED10.spec @@ -11,7 +11,7 @@ Summary: XMP support library Name: exempi -Version: 1.99.2 +Version: 1.99.5 Release: 1 License: BSD Group: System/Libraries