summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/testEncoding.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-12-19 15:44:29 (GMT)
committerBrad King <brad.king@kitware.com>2013-12-19 15:44:29 (GMT)
commit2a943d9264c995f3d2c55b3da202b88f67329750 (patch)
tree16a35312f8ad76d32c33492ce3ca53a353477400 /Source/kwsys/testEncoding.cxx
parentb375c18b9ea256e2e9a05fd8465c6d90b86b6f5b (diff)
parentf788d9a1b27efc9b463b1174a93e780bef00a5d9 (diff)
downloadCMake-2a943d9264c995f3d2c55b3da202b88f67329750.zip
CMake-2a943d9264c995f3d2c55b3da202b88f67329750.tar.gz
CMake-2a943d9264c995f3d2c55b3da202b88f67329750.tar.bz2
Merge branch 'upstream-kwsys' into update-kwsys
Diffstat (limited to 'Source/kwsys/testEncoding.cxx')
-rw-r--r--Source/kwsys/testEncoding.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/Source/kwsys/testEncoding.cxx b/Source/kwsys/testEncoding.cxx
index 8e74a50..a65c430 100644
--- a/Source/kwsys/testEncoding.cxx
+++ b/Source/kwsys/testEncoding.cxx
@@ -16,14 +16,18 @@
#endif
#include KWSYS_HEADER(Encoding.hxx)
+#include KWSYS_HEADER(Encoding.h)
#include KWSYS_HEADER(ios/iostream)
#include <locale.h>
+#include <string.h>
+#include <stdlib.h>
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
# include "Encoding.hxx.in"
+# include "Encoding.h.in"
# include "kwsys_ios_iostream.h.in"
#endif
@@ -68,11 +72,16 @@ static int testHelloWorldEncoding()
std::cout << str << std::endl;
std::wstring wstr = kwsys::Encoding::ToWide(str);
std::string str2 = kwsys::Encoding::ToNarrow(wstr);
- if(!wstr.empty() && str != str2)
+ wchar_t* c_wstr = kwsysEncoding_DupToWide(str.c_str());
+ char* c_str2 = kwsysEncoding_DupToNarrow(c_wstr);
+ if(!wstr.empty() && (str != str2 || strcmp(c_str2, str.c_str())))
{
std::cout << "converted string was different: " << str2 << std::endl;
+ std::cout << "converted string was different: " << c_str2 << std::endl;
ret++;
}
+ free(c_wstr);
+ free(c_str2);
}
return ret;
}