diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index c329994b7c..6bcd558afa 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -351,12 +351,6 @@ endif() # capabilities and parent project's request. Enforce 0/1 as only # possible values for configuration into Configure.hxx. -if(KWSYS_USE_Encoding) - # Look for type size helper macros. - KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_WSTRING - "Checking whether wstring is available" DIRECT) -endif() - if(KWSYS_NAMESPACE MATCHES "^kwsys$") set(KWSYS_NAME_IS_KWSYS 1) else() @@ -953,12 +947,8 @@ if(KWSYS_STANDALONE OR CMake_SOURCE_DIR) testCommandLineArguments.cxx testCommandLineArguments1.cxx testDirectory.cxx + testEncoding.cxx ) - if(KWSYS_STL_HAS_WSTRING) - set(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} - testEncoding.cxx - ) - endif() if(KWSYS_USE_FStream) set(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} testFStream.cxx diff --git a/Source/kwsys/Configure.hxx.in b/Source/kwsys/Configure.hxx.in index b4b0efaa94..c71d6feb6a 100644 --- a/Source/kwsys/Configure.hxx.in +++ b/Source/kwsys/Configure.hxx.in @@ -6,8 +6,6 @@ /* Include C configuration. */ #include <@KWSYS_NAMESPACE@/Configure.h> -/* Whether wstring is available. */ -#define @KWSYS_NAMESPACE@_STL_HAS_WSTRING @KWSYS_STL_HAS_WSTRING@ /* Whether is available. */ #define @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H \ @KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@ @@ -51,7 +49,6 @@ # define kwsys @KWSYS_NAMESPACE@ # endif # define KWSYS_NAME_IS_KWSYS @KWSYS_NAMESPACE@_NAME_IS_KWSYS -# define KWSYS_STL_HAS_WSTRING @KWSYS_NAMESPACE@_STL_HAS_WSTRING # define KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H \ @KWSYS_NAMESPACE@_CXX_HAS_EXT_STDIO_FILEBUF_H # define KWSYS_FALLTHROUGH @KWSYS_NAMESPACE@_FALLTHROUGH diff --git a/Source/kwsys/Encoding.hxx.in b/Source/kwsys/Encoding.hxx.in index 0353db3ed4..36fdee9932 100644 --- a/Source/kwsys/Encoding.hxx.in +++ b/Source/kwsys/Encoding.hxx.in @@ -45,8 +45,6 @@ public: * Convert between char and wchar_t */ -#if @KWSYS_NAMESPACE@_STL_HAS_WSTRING - // Convert a narrow string to a wide string. // On Windows, UTF-8 is assumed, and on other platforms, // the current locale is assumed. @@ -59,7 +57,7 @@ public: static std::string ToNarrow(std::wstring const& str); static std::string ToNarrow(wchar_t const* str); -# if defined(_WIN32) +#if defined(_WIN32) /** * Convert the path to an extended length path to avoid MAX_PATH length * limitations on Windows. If the input is a local path the result will be @@ -70,9 +68,7 @@ public: static std::wstring ToWindowsExtendedPath(std::string const&); static std::wstring ToWindowsExtendedPath(char const* source); static std::wstring ToWindowsExtendedPath(std::wstring const& wsource); -# endif - -#endif // @KWSYS_NAMESPACE@_STL_HAS_WSTRING +#endif }; // class Encoding } // namespace @KWSYS_NAMESPACE@ diff --git a/Source/kwsys/EncodingCXX.cxx b/Source/kwsys/EncodingCXX.cxx index 922dffd684..7bf46817ea 100644 --- a/Source/kwsys/EncodingCXX.cxx +++ b/Source/kwsys/EncodingCXX.cxx @@ -122,12 +122,10 @@ char const* const* Encoding::CommandLineArguments::argv() const return &this->argv_[0]; } -#if KWSYS_STL_HAS_WSTRING - std::wstring Encoding::ToWide(std::string const& str) { std::wstring wstr; -# if defined(_WIN32) +#if defined(_WIN32) int const wlength = MultiByteToWideChar(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(), int(str.size()), nullptr, 0); @@ -140,7 +138,7 @@ std::wstring Encoding::ToWide(std::string const& str) } delete[] wdata; } -# else +#else size_t pos = 0; size_t nullPos = 0; do { @@ -153,14 +151,14 @@ std::wstring Encoding::ToWide(std::string const& str) wstr += wchar_t('\0'); } } while (nullPos != std::string::npos); -# endif +#endif return wstr; } std::string Encoding::ToNarrow(std::wstring const& str) { std::string nstr; -# if defined(_WIN32) +#if defined(_WIN32) int length = WideCharToMultiByte(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.c_str(), int(str.size()), nullptr, 0, nullptr, nullptr); @@ -174,7 +172,7 @@ std::string Encoding::ToNarrow(std::wstring const& str) } delete[] data; } -# else +#else size_t pos = 0; size_t nullPos = 0; do { @@ -187,7 +185,7 @@ std::string Encoding::ToNarrow(std::wstring const& str) nstr += '\0'; } } while (nullPos != std::string::npos); -# endif +#endif return nstr; } @@ -221,7 +219,7 @@ std::string Encoding::ToNarrow(wchar_t const* wcstr) return str; } -# if defined(_WIN32) +#if defined(_WIN32) // Convert local paths to UNC style paths std::wstring Encoding::ToWindowsExtendedPath(std::string const& source) { @@ -285,8 +283,6 @@ std::wstring Encoding::ToWindowsExtendedPath(std::wstring const& wsource) // unchanged return wsource; } -# endif - -#endif // KWSYS_STL_HAS_WSTRING +#endif } // namespace KWSYS_NAMESPACE diff --git a/Source/kwsys/kwsysPlatformTestsCXX.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx index 07e6f6df68..05e7f0081e 100644 --- a/Source/kwsys/kwsysPlatformTestsCXX.cxx +++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx @@ -154,17 +154,6 @@ int main() } #endif -#ifdef TEST_KWSYS_STL_HAS_WSTRING -# include -void f(std::wstring*) -{ -} -int main() -{ - return 0; -} -#endif - #ifdef TEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H # include int main()