summaryrefslogtreecommitdiffstats
path: root/ConsoleBuf.hxx.in
diff options
context:
space:
mode:
authorKWSys Upstream <kwrobot@kitware.com>2016-12-02 14:36:32 (GMT)
committerBrad King <brad.king@kitware.com>2016-12-05 14:55:32 (GMT)
commit1b50bd3f5c1f608a84df89c2f5e187a53f0be31d (patch)
treee7e50180cf0126ec7b7a83baf2a4ce2a23352fac /ConsoleBuf.hxx.in
parentcd5cff13370f6953497484f6e4b04f957fe9c9a7 (diff)
downloadCMake-1b50bd3f5c1f608a84df89c2f5e187a53f0be31d.zip
CMake-1b50bd3f5c1f608a84df89c2f5e187a53f0be31d.tar.gz
CMake-1b50bd3f5c1f608a84df89c2f5e187a53f0be31d.tar.bz2
KWSys 2016-12-02 (4967ccc0)
Code extracted from: http://public.kitware.com/KWSys.git at commit 4967ccc054d268c430e73445f3a103e737c5f5f7 (master). Upstream Shortlog ----------------- Chuck Atkins (2): f1afce25 DynamicLoader: Re-organize preprocessor checks to use if, elif, else d94f92f7 DynamicLoader: Expand noop implementation to more platforms Dāvis Mosāns (2): f069db91 Encoding: Fix conversion of strings that contain null bytes 4967ccc0 ConsoleBuf: Fix output for strings that contain null byte
Diffstat (limited to 'ConsoleBuf.hxx.in')
-rw-r--r--ConsoleBuf.hxx.in5
1 files changed, 2 insertions, 3 deletions
diff --git a/ConsoleBuf.hxx.in b/ConsoleBuf.hxx.in
index c45a351..cb58865 100644
--- a/ConsoleBuf.hxx.in
+++ b/ConsoleBuf.hxx.in
@@ -327,14 +327,13 @@ private:
const int length =
WideCharToMultiByte(m_activeOutputCodepage, 0, wbuffer.c_str(),
(int)wbuffer.size(), NULL, 0, NULL, NULL);
- char* buf = new char[length + 1];
+ char* buf = new char[length];
const bool success =
WideCharToMultiByte(m_activeOutputCodepage, 0, wbuffer.c_str(),
(int)wbuffer.size(), buf, length, NULL, NULL) > 0
? true
: false;
- buf[length] = '\0';
- buffer = buf;
+ buffer = std::string(buf, length);
delete[] buf;
return success;
}