This commit is contained in:
Kovid Goyal 2023-01-26 09:38:37 +05:30
parent ad4aeaa1a0
commit 0ec5ae02e9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 4 deletions

View File

@ -8,7 +8,7 @@
#define PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN
#define UNICODE #define UNICODE
#define _UNICODE #define _UNICODE
#include <Windows.h> #include <windows.h>
#include <Python.h> #include <Python.h>
#include <comdef.h> #include <comdef.h>
#include "../cpp_binding.h" #include "../cpp_binding.h"

View File

@ -945,7 +945,6 @@ parse_cued_text(std::string_view src, Marks &marks, std::wstring_view dest) {
} }
} }
} }
*((wchar_t*)dest.data() + dest_pos) = 0; // ensure NULL termination
return dest.substr(0, dest_pos); return dest.substr(0, dest_pos);
} }
@ -985,7 +984,6 @@ handle_speak(id_type cmd_id, std::vector<std::wstring_view> &parts) {
text = parse_cued_text(src, marks, dest); text = parse_cued_text(src, marks, dest);
} else { } else {
size_t n = decode_into(src, dest); size_t n = decode_into(src, dest);
buf[n] = 0; // ensure null termination
text = std::wstring_view(buf.data(), n); text = std::wstring_view(buf.data(), n);
} }
} else { } else {
@ -994,8 +992,8 @@ handle_speak(id_type cmd_id, std::vector<std::wstring_view> &parts) {
buf.reserve(address.size() + 1); buf.reserve(address.size() + 1);
text = std::wstring_view(buf.data(), address.size()); text = std::wstring_view(buf.data(), address.size());
address.copy(buf.data(), address.size()); address.copy(buf.data(), address.size());
buf[address.size()] = 0; // null terminate
} }
*((wchar_t*)text.data() + text.size()) = 0; // ensure NULL termination
sx.speak(cmd_id, text, is_ssml, is_cued, std::move(buf), std::move(marks)); sx.speak(cmd_id, text, is_ssml, is_cued, std::move(buf), std::move(marks));
} }