diff options
author | Brad King <brad.king@kitware.com> | 2019-09-18 13:26:40 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-09-18 13:26:40 (GMT) |
commit | 56879273dc87a69e1d1491a73e0f74cd4424494c (patch) | |
tree | cd9c73956f1a4d1d1603267864b6beff34fdf938 /Source/kwsys/EncodingCXX.cxx | |
parent | 45b7d5284e11cb34885b756bee8dedeb94fc16cb (diff) | |
parent | 3327c0402a1ce31615c7ad22c5ff5d5330fb75da (diff) | |
download | CMake-56879273dc87a69e1d1491a73e0f74cd4424494c.zip CMake-56879273dc87a69e1d1491a73e0f74cd4424494c.tar.gz CMake-56879273dc87a69e1d1491a73e0f74cd4424494c.tar.bz2 |
Merge branch 'upstream-KWSys' into update-kwsys
# By KWSys Upstream
* upstream-KWSys:
KWSys 2019-09-18 (c6bc38c1)
Diffstat (limited to 'Source/kwsys/EncodingCXX.cxx')
-rw-r--r-- | Source/kwsys/EncodingCXX.cxx | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/Source/kwsys/EncodingCXX.cxx b/Source/kwsys/EncodingCXX.cxx index 251deef..4593c92 100644 --- a/Source/kwsys/EncodingCXX.cxx +++ b/Source/kwsys/EncodingCXX.cxx @@ -65,7 +65,7 @@ Encoding::CommandLineArguments::CommandLineArguments(int ac, for (int i = 0; i < ac; i++) { this->argv_[i] = strdup(av[i]); } - this->argv_[ac] = KWSYS_NULLPTR; + this->argv_[ac] = nullptr; } Encoding::CommandLineArguments::CommandLineArguments(int ac, @@ -75,7 +75,7 @@ Encoding::CommandLineArguments::CommandLineArguments(int ac, for (int i = 0; i < ac; i++) { this->argv_[i] = kwsysEncoding_DupToNarrow(av[i]); } - this->argv_[ac] = KWSYS_NULLPTR; + this->argv_[ac] = nullptr; } Encoding::CommandLineArguments::~CommandLineArguments() @@ -90,7 +90,7 @@ Encoding::CommandLineArguments::CommandLineArguments( { this->argv_.resize(other.argv_.size()); for (size_t i = 0; i < this->argv_.size(); i++) { - this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : KWSYS_NULLPTR; + this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : nullptr; } } @@ -105,7 +105,7 @@ Encoding::CommandLineArguments& Encoding::CommandLineArguments::operator=( this->argv_.resize(other.argv_.size()); for (i = 0; i < this->argv_.size(); i++) { - this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : KWSYS_NULLPTR; + this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : nullptr; } } @@ -128,8 +128,9 @@ std::wstring Encoding::ToWide(const std::string& str) { std::wstring wstr; # if defined(_WIN32) - const int wlength = MultiByteToWideChar( - KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(), int(str.size()), NULL, 0); + const int wlength = + MultiByteToWideChar(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(), + int(str.size()), nullptr, 0); if (wlength > 0) { wchar_t* wdata = new wchar_t[wlength]; int r = MultiByteToWideChar(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.data(), @@ -162,12 +163,12 @@ std::string Encoding::ToNarrow(const std::wstring& str) # if defined(_WIN32) int length = WideCharToMultiByte(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.c_str(), - int(str.size()), NULL, 0, NULL, NULL); + int(str.size()), nullptr, 0, nullptr, nullptr); if (length > 0) { char* data = new char[length]; int r = WideCharToMultiByte(KWSYS_ENCODING_DEFAULT_CODEPAGE, 0, str.c_str(), - int(str.size()), data, length, NULL, NULL); + int(str.size()), data, length, nullptr, nullptr); if (r > 0) { nstr = std::string(data, length); } @@ -193,7 +194,7 @@ std::string Encoding::ToNarrow(const std::wstring& str) std::wstring Encoding::ToWide(const char* cstr) { std::wstring wstr; - size_t length = kwsysEncoding_mbstowcs(KWSYS_NULLPTR, cstr, 0) + 1; + size_t length = kwsysEncoding_mbstowcs(nullptr, cstr, 0) + 1; if (length > 0) { std::vector<wchar_t> wchars(length); if (kwsysEncoding_mbstowcs(&wchars[0], cstr, length) > 0) { @@ -206,7 +207,7 @@ std::wstring Encoding::ToWide(const char* cstr) std::string Encoding::ToNarrow(const wchar_t* wcstr) { std::string str; - size_t length = kwsysEncoding_wcstombs(KWSYS_NULLPTR, wcstr, 0) + 1; + size_t length = kwsysEncoding_wcstombs(nullptr, wcstr, 0) + 1; if (length > 0) { std::vector<char> chars(length); if (kwsysEncoding_wcstombs(&chars[0], wcstr, length) > 0) { @@ -227,9 +228,9 @@ std::wstring Encoding::ToWindowsExtendedPath(std::string const& source) /* The +3 is a workaround for a bug in some versions of GetFullPathNameW that * won't return a large enough buffer size if the input is too small */ - wfull_len = GetFullPathNameW(wsource.c_str(), 0, NULL, NULL) + 3; + wfull_len = GetFullPathNameW(wsource.c_str(), 0, nullptr, nullptr) + 3; std::vector<wchar_t> wfull(wfull_len); - GetFullPathNameW(wsource.c_str(), wfull_len, &wfull[0], NULL); + GetFullPathNameW(wsource.c_str(), wfull_len, &wfull[0], nullptr); /* This should get the correct size without any extra padding from the * previous size workaround. */ |