|
|
|
@ -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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|