VirtualBox

Ignore:
Timestamp:
Aug 11, 2009 9:18:42 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
50977
Message:

GuestHost/SharedClipboard: the X11 clipboard code should not add nul terminators which weren't there before

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/SharedClipboard/x11-clipboard.cpp

    r22190 r22191  
    10481048                                     XtPointer *pValReturn,
    10491049                                     unsigned long *pcLenReturn,
    1050                                          int *piFormatReturn)
     1050                                     int *piFormatReturn)
    10511051{
    10521052    char *pszTmp = NULL, *pszTmp2 = NULL;
     
    11331133                                           atomTypeReturn, pValReturn,
    11341134                                           pcLenReturn, piFormatReturn);
     1135        /* Our conversion functions add nul terminators if they are missing.
     1136         * Remove them again. */
     1137        if (RT_SUCCESS(rc) && ((PRTUTF16)pv)[cb / 2 - 1] != 0)
     1138            --(*pcLenReturn);
    11351139        RTMemFree(pv);
    11361140    }
     
    15591563                rc = VERR_INVALID_PARAMETER;
    15601564        }
     1565        /* Our conversion functions add nul terminators if they are missing.
     1566         * Remove them again. */
     1567        if (RT_SUCCESS(rc) && ((const char *)pvSrc)[cbSrc - 1] != '\0')
     1568            cbDest -= 2;
    15611569    }
    15621570    else
     
    23372345    clipSetSelectionValues("TEXT", XA_STRING,
    23382346                           "hello world", sizeof("hello world") - 1, 8);
    2339     // testStringFromX11(hTest, pCtx, "hello world", VINF_SUCCESS,
    2340     //                   sizeof("hello world") * 2 - 2);
     2347    testStringFromX11(hTest, pCtx, "hello world", VINF_SUCCESS,
     2348                      sizeof("hello world") * 2 - 2);
    23412349
    23422350    /*** COMPOUND TEXT from X11 ***/
     
    23652373    clipSetSelectionValues("COMPOUND_TEXT", XA_STRING,
    23662374                           "hello world", sizeof("hello world") - 1, 8);
    2367     // testStringFromX11(hTest, pCtx, "hello world", VINF_SUCCESS,
    2368     //                   sizeof("hello world") * 2 - 2);
     2375    testStringFromX11(hTest, pCtx, "hello world", VINF_SUCCESS,
     2376                      sizeof("hello world") * 2 - 2);
    23692377
    23702378    /*** Latin1 from X11 ***/
     
    23902398                           "Georges Dupr\xEA!",
    23912399                           sizeof("Georges Dupr\xEA!") - 1, 8);
    2392     // testLatin1FromX11(hTest, pCtx, "Georges Dupr\xEA!", VINF_SUCCESS,
    2393     //                   sizeof("Georges Dupr\xEA!") * 2 - 2);
     2400    testLatin1FromX11(hTest, pCtx, "Georges Dupr\xEA!", VINF_SUCCESS,
     2401                      sizeof("Georges Dupr\xEA!") * 2 - 2);
    23942402
    23952403    /*** Unknown X11 format ***/
     
    24972505    clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world",
    24982506                     sizeof("hello world") * 2 - 2);
    2499     // testStringFromVBox(hTest, pCtx, "TEXT",
    2500     //                         clipGetAtom(NULL, "TEXT"),
    2501     //                         "hello world", sizeof("hello world") - 1);
     2507    testStringFromVBox(hTest, pCtx, "TEXT", clipGetAtom(NULL, "TEXT"),
     2508                       "hello world", sizeof("hello world") - 1);
    25022509
    25032510    /*** COMPOUND TEXT from VBox ***/
     
    25352542    clipSetVBoxUtf16(pCtx, VINF_SUCCESS, "hello world",
    25362543                     sizeof("hello world") * 2 - 2);
    2537     // testStringFromVBox(hTest, pCtx, "COMPOUND_TEXT",
    2538     //                         clipGetAtom(NULL, "COMPOUND_TEXT"),
    2539     //                         "hello world", sizeof("hello world") - 1);
     2544    testStringFromVBox(hTest, pCtx, "COMPOUND_TEXT",
     2545                       clipGetAtom(NULL, "COMPOUND_TEXT"),
     2546                       "hello world", sizeof("hello world") - 1);
    25402547
    25412548    /*** Timeout from VBox ***/
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette