[squeak-dev] Some Win32 ClipboardInterpreter still use squeakToMac, why???

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Tue Jun 11 16:22:09 UTC 2019


It seems to me that Clipboard primitives explicitely use UTF8 encoding on
Win32 platforms.

See for example
https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/aed5e3391301011cc6b9ee6a353ee563f4ab6dbd/platforms/win32/vm/sqWin32Window.c

/* Convert data to Unicode UTF16. */
MultiByteToWideChar( CP_UTF8, 0, cvt, -1, out, wcharsNeeded );

/* Send the Unicode text to the clipboard. */
EmptyClipboard();
SetClipboardData(CF_UNICODETEXT, h);

and:

/* Get clipboard data in Unicode format */
h = GetClipboardData(CF_UNICODETEXT);
src = GlobalLock(h);

/* How many bytes do we need to store the UTF8 representation? */
bytesNeeded = WideCharToMultiByte(CP_UTF8, 0, src, -1,
NULL, 0, NULL, NULL );

/* Convert Unicode text to UTF8. */
cvt = tmp = malloc(bytesNeeded);
WideCharToMultiByte(CP_UTF8, 0, src, -1, tmp, bytesNeeded, NULL, NULL);

So it seems to me that:
1) all the squeakToMac sends found in various ClipboardInterpreter
subclasses (the Win32 ones at least) are completely obsolete
2) all the exotic ClipboardInterpreter subclasse, but
UTF8ClipboardInterpreter, are themselves obsolete and could be simply
withdrawn from service

Did I miss something, or can I use the high pressure cleaner in this area?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190611/f9b4777d/attachment.html>


More information about the Squeak-dev mailing list