Changed MS clipboard text converters to truncate the clipboard
data at the first NUL. This fixes a bug when interoperating with some win32 programs.
This commit is contained in:
parent
53c05e0163
commit
c2bd4ebd4c
|
@ -45,10 +45,11 @@ CMSWindowsClipboardTextConverter::doFromIClipboard(const CString& data) const
|
||||||
CString
|
CString
|
||||||
CMSWindowsClipboardTextConverter::doToIClipboard(const CString& data) const
|
CMSWindowsClipboardTextConverter::doToIClipboard(const CString& data) const
|
||||||
{
|
{
|
||||||
// convert and strip nul terminator
|
// convert and truncate at first nul terminator
|
||||||
CString dst = CUnicode::textToUTF8(data);
|
CString dst = CUnicode::textToUTF8(data);
|
||||||
if (dst.size() > 0 && dst[dst.size() - 1] == '\0') {
|
CString::size_type n = dst.find('\0');
|
||||||
dst.erase(dst.size() - 1);
|
if (n != CString::npos) {
|
||||||
|
dst.erase(n);
|
||||||
}
|
}
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,10 @@ CString
|
||||||
CMSWindowsClipboardUTF16Converter::doToIClipboard(const CString& data) const
|
CMSWindowsClipboardUTF16Converter::doToIClipboard(const CString& data) const
|
||||||
{
|
{
|
||||||
// convert and strip nul terminator
|
// convert and strip nul terminator
|
||||||
CString dst = CUnicode::UTF16ToUTF8(data);
|
CString dst = CUnicode::UTF16ToUTF8(data);
|
||||||
if (dst.size() > 0 && dst[dst.size() - 1] == '\0') {
|
CString::size_type n = dst.find('\0');
|
||||||
dst.erase(dst.size() - 1);
|
if (n != CString::npos) {
|
||||||
|
dst.erase(n);
|
||||||
}
|
}
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue