[Vm-dev] [commit] r2152 - Add Eliot's clipboard handling fix.

Eliot Miranda eliot.miranda at gmail.com
Thu Mar 11 04:08:40 UTC 2010


On Wed, Mar 10, 2010 at 7:39 PM, Chris Muller <asqueaker at gmail.com> wrote:

>
> OMG, is the clipboard going to work in Linux now?
>

:)  No :)  This is strictly windows.


>
> On Wed, Mar 10, 2010 at 1:22 PM,  <commits at squeakvm.org> wrote:
> >
> > Author: andreas
> > Date: 2010-03-10 11:22:45 -0800 (Wed, 10 Mar 2010)
> > New Revision: 2152
> >
> > Modified:
> >   trunk/platforms/win32/vm/sqWin32Window.c
> > Log:
> > Add Eliot's clipboard handling fix.
> >
> > Modified: trunk/platforms/win32/vm/sqWin32Window.c
> > ===================================================================
> > --- trunk/platforms/win32/vm/sqWin32Window.c    2010-02-24 13:25:07 UTC
> (rev 2151)
> > +++ trunk/platforms/win32/vm/sqWin32Window.c    2010-03-10 19:22:45 UTC
> (rev 2152)
> > @@ -2353,7 +2353,6 @@
> >  int clipboardSize(void) {
> >   HANDLE h;
> >   WCHAR *src;
> > -  unsigned char *tmp;
> >   int i, count, bytesNeeded;
> >
> >   /* Do we have text in the clipboard? */
> > @@ -2370,18 +2369,20 @@
> >   /* How many bytes do we need to store those unicode chars in UTF8
> format? */
> >   bytesNeeded = WideCharToMultiByte(CP_UTF8, 0, src, -1,
> >                                    NULL, 0, NULL, NULL );
> > -  tmp = malloc(bytesNeeded+1);
> > +  if (bytesNeeded > 0) {
> > +    unsigned char *tmp = malloc(bytesNeeded+1);
> >
> > -  /* Convert Unicode text to UTF8. */
> > -  WideCharToMultiByte(CP_UTF8, 0, src, -1, tmp, bytesNeeded , NULL,
> NULL);
> > +    /* Convert Unicode text to UTF8. */
> > +    WideCharToMultiByte(CP_UTF8, 0, src, -1, tmp, bytesNeeded , NULL,
> NULL);
> >
> > -  /* Count CrLfs for which we remove the extra Lf */
> > -  count = bytesNeeded; /* ex. terminating zero */
> > -  for(i=0; i<count; i++) {
> > -    if((tmp[i] == 13) && (tmp[i+1] == 10)) bytesNeeded--;
> > +    /* Count CrLfs for which we remove the extra Lf */
> > +    count = bytesNeeded; /* ex. terminating zero */
> > +    for(i=0; i<count; i++) {
> > +      if((tmp[i] == 13) && (tmp[i+1] == 10)) bytesNeeded--;
> > +    }
> > +    bytesNeeded--; /* discount terminating zero */
> > +    free(tmp); /* no longer needed */
> >   }
> > -  bytesNeeded--; /* discount terminating zero */
> > -  free(tmp); /* no longer needed */
> >
> >   GlobalUnlock(h);
> >   CloseClipboard();
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20100310/5bf10548/attachment.htm


More information about the Vm-dev mailing list