diff --git a/src/convert.cpp b/src/convert.cpp index ac8d32af..f4b8d8e4 100644 --- a/src/convert.cpp +++ b/src/convert.cpp @@ -73,12 +73,6 @@ namespace { The return code indicates if the operation was successful. */ bool getTextValue(std::string& value, const Exiv2::XmpData::iterator& pos); - - /*! - @brief Convert string charset with iconv. - */ - bool convertStringCharset(std::string &str, const char* from, const char* to); - } // ***************************************************************************** @@ -1315,39 +1309,6 @@ namespace Exiv2 { converter.cnvFromXmp(); } -} // namespace Exiv2 - -// ***************************************************************************** -// local definitions -namespace { - - bool getTextValue(std::string& value, const Exiv2::XmpData::iterator& pos) - { - if (pos->typeId() == Exiv2::langAlt) { - // get the default language entry without x-default qualifier - value = pos->toString(0); - if (!pos->value().ok() && pos->count() == 1) { - // If there is no default but exactly one entry, take that - // without the qualifier - value = pos->toString(); - if ( pos->value().ok() - && value.length() > 5 && value.substr(0, 5) == "lang=") { - std::string::size_type pos = value.find_first_of(' '); - if (pos != std::string::npos) { - value = value.substr(pos + 1); - } - else { - value.clear(); - } - } - } - } - else { - value = pos->toString(); - } - return pos->value().ok(); - } - bool convertStringCharset(std::string &str, const char* from, const char* to) { if (0 == strcmp(from, to)) return true; // nothing to do @@ -1357,7 +1318,7 @@ namespace { cd = iconv_open(to, from); if (cd == (iconv_t)(-1)) { #ifndef SUPPRESS_WARNINGS - std::cerr << "Warning: iconv_open: " << Exiv2::strError() << "\n"; + std::cerr << "Warning: iconv_open: " << strError() << "\n"; #endif return false; } @@ -1377,7 +1338,7 @@ namespace { if (rc == size_t(-1) && errno != E2BIG) { #ifndef SUPPRESS_WARNINGS std::cerr << "Warning: iconv: " - << Exiv2::strError() + << strError() << " inbytesleft = " << inbytesleft << "\n"; #endif ret = false; @@ -1397,4 +1358,37 @@ namespace { #endif // EXV_HAVE_ICONV } +} // namespace Exiv2 + +// ***************************************************************************** +// local definitions +namespace { + + bool getTextValue(std::string& value, const Exiv2::XmpData::iterator& pos) + { + if (pos->typeId() == Exiv2::langAlt) { + // get the default language entry without x-default qualifier + value = pos->toString(0); + if (!pos->value().ok() && pos->count() == 1) { + // If there is no default but exactly one entry, take that + // without the qualifier + value = pos->toString(); + if ( pos->value().ok() + && value.length() > 5 && value.substr(0, 5) == "lang=") { + std::string::size_type pos = value.find_first_of(' '); + if (pos != std::string::npos) { + value = value.substr(pos + 1); + } + else { + value.clear(); + } + } + } + } + else { + value = pos->toString(); + } + return pos->value().ok(); + } + } diff --git a/src/convert.hpp b/src/convert.hpp index 49f5a263..f72bee78 100644 --- a/src/convert.hpp +++ b/src/convert.hpp @@ -41,6 +41,7 @@ #endif // + standard includes +#include // ***************************************************************************** // namespace extensions @@ -78,6 +79,9 @@ namespace Exiv2 { //! Convert (move) XMP properties to IPTC tags, remove converted XMP properties. EXIV2API void moveXmpToIptc(XmpData& xmpData, IptcData& iptcData); + //! Convert string charset with iconv. + EXIV2API bool convertStringCharset(std::string& str, const char* from, const char* to); + } // namespace Exiv2 #endif // #ifndef CONVERT_HPP_