From d47aeee605ec255b23c054eaa49a3d39b85e6aa3 Mon Sep 17 00:00:00 2001 From: Andreas Huggel Date: Fri, 25 Dec 2009 16:15:09 +0000 Subject: [PATCH] Removed --disable-printucs2 configure option. --- README | 4 ++-- config/config.h.in | 3 --- config/configure.ac | 29 ----------------------------- src/tags.cpp | 42 +++++++++++++++++++++--------------------- 4 files changed, 23 insertions(+), 55 deletions(-) diff --git a/README b/README index db93c7b3..65c20315 100644 --- a/README +++ b/README @@ -58,7 +58,7 @@ Feature Package Configure options PNG image support zlib --without-zlib --with-zlib=DIR Native language support gettext --disable-nls -Converting Windows XP tags libiconv --disable-printucs2 +Converting Windows XP tags libiconv --without-libiconv-prefix --with-libiconv-prefix[=DIR] XMP support expat --disable-xmp --with-expat=DIR @@ -168,4 +168,4 @@ version of the Exiv2 library. To do this on Windows, compile the library with the preprocessor symbol EXV_COMMERCIAL_VERSION defined in the file src\exv_msvc.h. On UNIX-like systems, run the configure script with the options ---enable-commercial --disable-nls --disable-printucs2 --disable-lensdata +--enable-commercial --disable-nls --disable-lensdata diff --git a/config/config.h.in b/config/config.h.in index 635f4b31..8eaa1944 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -28,9 +28,6 @@ /* Define to 1 if you have the `iconv' function. */ #undef HAVE_ICONV -/* Define to 1 to enable conversion of UCS2 encoded Windows tags to UTF-8. */ -#undef HAVE_PRINTUCS2 - #endif /* !EXV_COMMERCIAL_VERSION */ /* Define to `const' or to empty, depending on the second argument of `iconv'. */ diff --git a/config/configure.ac b/config/configure.ac index 82495969..11675c01 100644 --- a/config/configure.ac +++ b/config/configure.ac @@ -130,22 +130,6 @@ if test "$USE_LENSDATA" = "yes"; then AC_DEFINE(HAVE_LENSDATA,1) fi -AC_MSG_CHECKING([whether to convert UCS2 encoded Windows tags with iconv ]) -AC_ARG_ENABLE(printucs2, - [ --disable-printucs2 do not convert UCS2 encoded Windows tag to UTF-8 ], - USE_PRINTUCS2=$enableval, USE_PRINTUCS2=yes) -AC_MSG_RESULT($USE_PRINTUCS2) -if test "$USE_PRINTUCS2" = "yes"; then - AC_DEFINE(HAVE_PRINTUCS2,1) -else -# if NLS is also disabled, don't link with iconv -# (since in some cases, AM_GNU_GETTEXT and/or AM_ICONV configure for this anyway) - if test "$USE_NLS" = "no"; then - unset LIBICONV - unset LTLIBICONV - fi -fi - AC_MSG_CHECKING([whether to compile a commercial version of the Exiv2 library]) AC_ARG_ENABLE(commercial, [ --enable-commercial compile with the EXV_COMMERCIAL_VERSION symbol set ], @@ -260,19 +244,6 @@ yes) echo "-- Native language support........ YES" ;; echo "" ;; esac -case "$USE_PRINTUCS2" in -yes) echo "-- Conversion of Windows XP tags.. YES" ;; -*) echo "-- Conversion of Windows XP tags.. NO" - echo "" - echo "On Windows, NO here means that the Windows system function is used" - echo "to convert some UCS-2 encoded Windows XP tags. On other platforms," - echo "libiconv is required for the conversion of Windows XP tags." - echo "Make sure that the libiconv header files are installed and use" - echo "--with-libiconv-prefix=DIR if it is in a non-standard location." - echo "You can get libiconv from http://www.gnu.org/software/libiconv/" - echo "" ;; -esac - case "$USE_LENSDATA" in yes) echo "-- Nikon lens database............ YES" ;; *) echo "-- Nikon lens database............ NO" ;; diff --git a/src/tags.cpp b/src/tags.cpp index a6dc1020..c0557974 100644 --- a/src/tags.cpp +++ b/src/tags.cpp @@ -2149,7 +2149,26 @@ namespace Exiv2 { std::ostream& printUcs2(std::ostream& os, const Value& value, const ExifData*) { -#if defined EXV_HAVE_ICONV && defined EXV_HAVE_PRINTUCS2 +#if defined WIN32 && !defined __CYGWIN__ + // in Windows the WideCharToMultiByte function can be used + if (value.typeId() == unsignedByte) { + DataBuf ib(value.size()); + value.copy(ib.pData_, invalidByteOrder); + int out_size = WideCharToMultiByte(CP_UTF8, 0, reinterpret_cast(ib.pData_), + ib.size_ / sizeof(WCHAR), NULL, 0, NULL, NULL); + if (out_size >= 0) { + DataBuf ob(out_size + 1); + WideCharToMultiByte(CP_UTF8, 0, reinterpret_cast(ib.pData_), + ib.size_ / sizeof(WCHAR), reinterpret_cast(ob.pData_), + ob.size_, NULL, NULL); + os << std::string(reinterpret_cast(ob.pData_)); + } + else { + os << value; + } + } + return os; +#elif defined EXV_HAVE_ICONV // !(defined WIN32 && !defined __CYGWIN__) bool go = true; iconv_t cd = (iconv_t)(-1); if (value.typeId() != unsignedByte) { @@ -2199,29 +2218,10 @@ namespace Exiv2 { os << value; } return os; -#elif defined WIN32 && !defined __CYGWIN__ // !(EXV_HAVE_ICONV && EXV_HAVE_PRINTUCS2) - // in Windows the WideCharToMultiByte function can be used - if (value.typeId() == unsignedByte) { - DataBuf ib(value.size()); - value.copy(ib.pData_, invalidByteOrder); - int out_size = WideCharToMultiByte(CP_UTF8, 0, reinterpret_cast(ib.pData_), - ib.size_ / sizeof(WCHAR), NULL, 0, NULL, NULL); - if (out_size >= 0) { - DataBuf ob(out_size + 1); - WideCharToMultiByte(CP_UTF8, 0, reinterpret_cast(ib.pData_), - ib.size_ / sizeof(WCHAR), reinterpret_cast(ob.pData_), - ob.size_, NULL, NULL); - os << std::string(reinterpret_cast(ob.pData_)); - } - else { - os << value; - } - } - return os; #else os << value; return os; -#endif // EXV_HAVE_ICONV && EXV_HAVE_PRINTUCS2 +#endif // EXV_HAVE_ICONV } // printUcs2 std::ostream& printExifUnit(std::ostream& os, const Value& value, const ExifData* metadata)