reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit 6dd1d05813936751d052d9db73322a2517c3db54
parent 0c79395d8fa39cc5a7d53a1f4f53dd3aac3a3a2c
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Fri,  1 Jan 2016 20:01:54 -0800

don't include null byte at the end of converted strings

Diffstat:
Msrc/encoding.cpp | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/encoding.cpp b/src/encoding.cpp @@ -22,7 +22,8 @@ auto_string make_autostring(const std::string &input) { - const int size = MultiByteToWideChar(CP_UTF8, 0, &input[0], -1, nullptr, 0); + const int size = MultiByteToWideChar(CP_UTF8, 0, + &input[0], -1, nullptr, 0) -1; auto_string output(size, 0); MultiByteToWideChar(CP_UTF8, 0, &input[0], -1, &output[0], size); @@ -33,7 +34,7 @@ auto_string make_autostring(const std::string &input) std::string from_autostring(const auto_string &input) { const int size = WideCharToMultiByte(CP_UTF8, 0, - &input[0], -1, nullptr, 0, nullptr, nullptr); + &input[0], -1, nullptr, 0, nullptr, nullptr) - 1; std::string output(size, 0); WideCharToMultiByte(CP_UTF8, 0,