[Lazarus] Setting clipboard on Linux adds ending #0

cobines cobines at gmail.com
Fri Mar 9 15:36:09 CET 2012


2012/3/8 zeljko <zeljko at holobit.net>:
> We cannot remove it just because you think so. If it's removed we need to
> test consequences on gtk, gtk2 and qt.
I know, I was counting on someone saying that it is needed and why.


With copying to clipboard, I found this in LCLQT in TQtClipboard.GetOwnerShip:

      if (QByteArray_length(Data) > 1) and QByteArray_endsWith(Data, #0) then
        QByteArray_chop(Data, 1);


With pasting from clipboard, there is this in LCL:

TClipboard.GetAsText:

      if (ASize>0) and (pchar(MemStream.Memory)[ASize-1]=#0) then
        Dec(ASize);

If the #0 is specifically removed then maybe it doesn't need to be
added as well. As I see it, the stream (or array) size determines the
length, not the #0.

I can only test by installing lots of applications and testing if
copying/pasting still works after removing the #0.

--
cobines




More information about the Lazarus mailing list