VirtualBox

Changeset 7418 in vbox


Ignore:
Timestamp:
Mar 10, 2008 4:01:58 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
28852
Message:

UCS-2 -> UTF-16.

Location:
trunk
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/dir.h

    r5999 r7418  
    177177    /** The length of the short field (number of RTUCS2 chars).
    178178     * It is 16-bit for reasons of alignment. */
    179     uint16_t        cucShortName;
     179    uint16_t        cwcShortName;
    180180    /** The short name for 8.3 compatability.
    181181     * Empty string if not available.
    182182     * Since the length is a bit tricky for a UTF-8 encoded name, and since this
    183183     * is practically speaking only a windows thing, it is encoded as UCS-2. */
    184     RTUCS2          uszShortName[14];
     184    RTUTF16         wszShortName[14];
    185185    /** The length of the filename. */
    186186    uint16_t        cbName;
  • trunk/include/iprt/string.h

    r7183 r7418  
    252252RTDECL(int)  RTStrToUtf16Ex(const char *pszString, size_t cchString, PRTUTF16 *ppwsz, size_t cwc, size_t *pcwc);
    253253
    254 /**
    255  * Allocates tmp buffer, translates pszString from UTF8 to UCS-2.
    256  *
    257  * @returns iprt status code.
    258  * @param   ppwszString     Receives pointer of allocated UCS-2 string.
    259  *                          The returned pointer must be freed using RTStrUcs2Free().
    260  * @param   pszString       UTF-8 string to convert.
    261  * @deprecated Use RTStrToUtf16().
    262  */
    263 DECLINLINE(int) RTStrUtf8ToUcs2(PRTUCS2 *ppwszString, const char *pszString)
    264 {
    265     return RTStrToUtf16(pszString, ppwszString);
    266 }
    267 
    268 /**
    269  * Translates pszString from UTF8 to backwater UCS-2, can allocate a temp buffer.
    270  *
    271  * @returns iprt status code.
    272  * @param   ppwszString     Receives pointer of allocated UCS-2 string.
    273  *                          The returned pointer must be freed using RTStrUcs2Free().
    274  * @param   cwc             Length of target buffer in RTUCS2s including the trailing '\\0'.
    275  *                          If 0 a temporary buffer is allocated.
    276  * @param   pszString       UTF-8 string to convert.
    277  * @deprecated Use RTStrToUtf16Ex().
    278  */
    279 DECLINLINE(int)  RTStrUtf8ToUcs2Ex(PRTUCS2 *ppwszString, unsigned cwc, const char *pszString)
    280 {
    281     return RTStrToUtf16Ex(pszString, RTSTR_MAX, ppwszString, cwc, NULL);
    282 }
    283 
    284254
    285255/**
     
    12931263 * @returns 0 if the first string identical to the second string.
    12941264 * @returns > 0 if the first string greater than the second string.
    1295  * @param   pwsz1       First UTF-16 string.
    1296  * @param   pwsz2       Second UTF-16 string.
     1265 * @param   pwsz1       First UTF-16 string. Null is allowed.
     1266 * @param   pwsz2       Second UTF-16 string. Null is allowed.
    12971267 * @remark  This function will not make any attempt to validate the encoding.
    12981268 */
     
    13091279 * @returns 0 if the first string identical to the second string.
    13101280 * @returns > 0 if the first string greater than the second string.
    1311  * @param   pwsz1       First UTF-16 string.
    1312  * @param   pwsz2       Second UTF-16 string.
     1281 * @param   pwsz1       First UTF-16 string. Null is allowed.
     1282 * @param   pwsz2       Second UTF-16 string. Null is allowed.
    13131283 */
    13141284RTDECL(int) RTUtf16ICmp(PCRTUTF16 pwsz1, PCRTUTF16 pwsz2);
     
    13251295 * @returns 0 if the first string identical to the second string.
    13261296 * @returns > 0 if the first string greater than the second string.
    1327  * @param   pwsz1       First UTF-16 string.
    1328  * @param   pwsz2       Second UTF-16 string.
     1297 * @param   pwsz1       First UTF-16 string. Null is allowed.
     1298 * @param   pwsz2       Second UTF-16 string. Null is allowed.
    13291299 */
    13301300RTDECL(int) RTUtf16LocaleICmp(PCRTUTF16 pwsz1, PCRTUTF16 pwsz2);
     
    14171387
    14181388/**
    1419  * Allocates tmp buffer, translates pwszString from UCS-2 to UTF8.
    1420  *
    1421  * @returns iprt status code.
    1422  * @param   ppszString      Receives pointer of allocated UTF8 string.
    1423  *                          The returned pointer must be freed using RTStrFree().
    1424  * @param   pwszString      UCS-2 string to convert.
    1425  * @deprecated Use RTUtf16ToUtf8().
    1426  */
    1427 DECLINLINE(int)  RTStrUcs2ToUtf8(char **ppszString, PCRTUCS2 pwszString)
    1428 {
    1429     return RTUtf16ToUtf8(pwszString, ppszString);
    1430 }
    1431 
    1432 /**
    1433  * Translates UCS-2 to UTF-8 using buffer provided by the caller or
    1434  * a fittingly sized buffer allocated by the function.
    1435  *
    1436  * @returns iprt status code.
    1437  * @param   ppszString      If cch is not zero, this points to the pointer to the
    1438  *                          buffer where the converted string shall be resulted.
    1439  *                          If cch is zero, this is where the pointer to the allocated
    1440  *                          buffer with the converted string is stored. The allocated
    1441  *                          buffer must be freed by using RTStrFree().
    1442  * @param   cch             Size of the passed in buffer (*ppszString).
    1443  *                          If 0 a fittingly sized buffer is allocated.
    1444  * @param   pwszString      UCS-2 string to convert.
    1445  * @deprecated
    1446  */
    1447 DECLINLINE(int)  RTStrUcs2ToUtf8Ex(char **ppszString, size_t cch, PCRTUCS2 pwszString)
    1448 {
    1449     return RTUtf16ToUtf8Ex(pwszString, RTSTR_MAX, ppszString, cch, NULL);
    1450 }
    1451 
    1452 /**
    1453  * Free a UCS-2 string allocated by RTStrUtf8ToUcs2().
    1454  *
    1455  * @returns iprt status code.
    1456  * @param   pwszString     Pointer to buffer with unicode string to free.
    1457  *                         NULL is accepted.
    1458  * @deprecated
    1459  */
    1460 DECLINLINE(void)  RTStrUcs2Free(PRTUCS2 pwszString)
    1461 {
    1462     RTUtf16Free(pwszString);
    1463 }
    1464 
    1465 /**
    1466  * Allocates a new copy of the given UCS-2 string.
    1467  *
    1468  * @returns Pointer to the allocated string copy. Use RTStrUcs2Free() to free it.
    1469  * @returns NULL when out of memory.
    1470  * @param   pwszString      UCS-2 string to duplicate.
    1471  * @deprecated
    1472  */
    1473 DECLINLINE(PRTUCS2) RTStrUcs2Dup(PCRTUCS2 pwszString)
    1474 {
    1475     return RTUtf16Dup(pwszString);
    1476 }
    1477 
    1478 /**
    1479  * Allocates a new copy of the given UCS-2 string.
    1480  *
    1481  * @returns iprt status code.
    1482  * @param   ppwszString     Receives pointer of the allocated UCS-2 string.
    1483  *                          The returned pointer must be freed using RTStrUcs2Free().
    1484  * @param   pwszString      UCS-2 string to duplicate.
    1485  * @deprecated
    1486  */
    1487 DECLINLINE(int) RTStrUcs2DupEx(PRTUCS2 *ppwszString, PCRTUCS2 pwszString)
    1488 {
    1489     return RTUtf16DupEx(ppwszString, pwszString, 0);
    1490 }
    1491 
    1492 /**
    1493  * Returns the length of a UCS-2 string in UCS-2 characters
    1494  * without trailing '\\0'.
    1495  *
    1496  * @returns Length of input string in UCS-2 characters.
    1497  * @param   pwszString  Pointer the UCS-2 string.
    1498  * @deprecated
    1499  */
    1500 DECLINLINE(size_t) RTStrUcs2Len(PCRTUCS2 pwszString)
    1501 {
    1502     return RTUtf16Len(pwszString);
    1503 }
    1504 
    1505 /**
    1506  * Performs a case sensitive string compare between two UCS-2 strings.
    1507  *
    1508  * @returns < 0 if the first string less than the second string.
    1509  * @returns 0 if the first string identical to the second string.
    1510  * @returns > 0 if the first string greater than the second string.
    1511  * @param   pwsz1       First UCS-2 string.
    1512  * @param   pwsz2       Second UCS-2 string.
    1513  * @deprecated
    1514  */
    1515 DECLINLINE(int) RTStrUcs2Cmp(register PCRTUCS2 pwsz1, register PCRTUCS2 pwsz2)
    1516 {
    1517     return RTUtf16Cmp(pwsz1, pwsz2);
    1518 }
    1519 
    1520 
    1521 /**
    15221389 * Get the unicode code point at the given string position.
    15231390 *
  • trunk/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp

    r6716 r7418  
    11821182            SHFLSTRING      *pFolderName, *pMapName;
    11831183            int              cbString;
    1184             PRTUCS2          aHostPath, aMapName;
     1184            PRTUTF16         aHostPath, aMapName;
    11851185            int              rc;
    11861186
    1187             rc = RTStrUtf8ToUcs2(&aHostPath, g_pszShareDir[i]);
     1187            rc = RTStrToUtf16(g_pszShareDir[i], &aHostPath);
    11881188            AssertRC(rc);
    1189             rc = RTStrUtf8ToUcs2(&aMapName, g_pszShareName[i]);
     1189            rc = RTStrToUtf16(g_pszShareName[i], &aMapName);
    11901190            AssertRC(rc);
    11911191
    1192             cbString = (RTStrUcs2Len (aHostPath) + 1) * sizeof (RTUCS2);
     1192            cbString = (RTUtf16Len (aHostPath) + 1) * sizeof (RTUTF16);
    11931193            pFolderName = (SHFLSTRING *) RTMemAllocZ (sizeof (SHFLSTRING) + cbString);
    11941194            Assert (pFolderName);
     
    11961196
    11971197            pFolderName->u16Size   = cbString;
    1198             pFolderName->u16Length = cbString - sizeof(RTUCS2);
     1198            pFolderName->u16Length = cbString - sizeof(RTUTF16);
    11991199
    12001200            parms[0].type = VBOX_HGCM_SVC_PARM_PTR;
     
    12021202            parms[0].u.pointer.size = sizeof (SHFLSTRING) + cbString;
    12031203
    1204             cbString = (RTStrUcs2Len (aMapName) + 1) * sizeof (RTUCS2);
     1204            cbString = (RTUtf16Len (aMapName) + 1) * sizeof (RTUTF16);
    12051205            pMapName = (SHFLSTRING *) RTMemAllocZ (sizeof(SHFLSTRING) + cbString);
    12061206            Assert (pMapName);
     
    12081208
    12091209            pMapName->u16Size   = cbString;
    1210             pMapName->u16Length = cbString - sizeof (RTUCS2);
     1210            pMapName->u16Length = cbString - sizeof (RTUTF16);
    12111211
    12121212            parms[1].type = VBOX_HGCM_SVC_PARM_PTR;
     
    12231223            RTMemFree (pFolderName);
    12241224            RTMemFree (pMapName);
    1225             RTStrUcs2Free (aHostPath);
    1226             RTStrUcs2Free (aMapName);
     1225            RTUtf16Free (aHostPath);
     1226            RTUtf16Free (aMapName);
    12271227        }
    12281228    }
  • trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp

    r5999 r7418  
    206206
    207207    char *pszKeys;
    208     int rc = RTStrUcs2ToUtf8(&pszKeys, Keys.raw());
    209     if (VBOX_SUCCESS(rc))
     208    int rc = RTUtf16ToUtf8(Keys.raw(), &pszKeys);
     209    if (RT_SUCCESS(rc))
    210210    {
    211211        /* locate it */
     
    420420
    421421    rc = SUPInstall();
    422     if (VBOX_SUCCESS(rc))
     422    if (RT_SUCCESS(rc))
    423423        return 0;
    424     else if (rc == VERR_NOT_IMPLEMENTED)
     424    if (rc == VERR_NOT_IMPLEMENTED)
    425425        return 0;
    426     else
    427         return E_FAIL;
     426    return E_FAIL;
    428427}
    429428
     
    435434int CmdModInstall(void)
    436435{
    437     int rc = SUPInstall();
     436    int rc = SUPInstall(); /** @todo r=bird: this cannot be right. */
    438437
    439438    rc = SUPInstall();
    440     if (VBOX_SUCCESS(rc))
     439    if (RT_SUCCESS(rc))
    441440        return 0;
    442     else if (rc == VERR_NOT_IMPLEMENTED)
     441    if (rc == VERR_NOT_IMPLEMENTED)
    443442        return 0;
    444     else
    445         return E_FAIL;
     443    return E_FAIL;
    446444}
    447445
  • trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp

    r6901 r7418  
    173173    char *pszFullPath = NULL;
    174174
    175     /* Query UCS2 root prefix for the path, cbRoot is the length in bytes including trailing (RTUCS2)0. */
     175    /* Query UCS2 root prefix for the path, cbRoot is the length in bytes including trailing (RTUTF16)0. */
    176176    uint32_t cbRoot = 0;
    177     const RTUCS2 *pszRoot = vbsfMappingsQueryHostRoot (root, &cbRoot);
    178 
    179     if (!pszRoot || cbRoot == 0)
     177    PCRTUTF16 pwszRoot = vbsfMappingsQueryHostRoot (root, &cbRoot);
     178
     179    if (!pwszRoot || cbRoot == 0)
    180180    {
    181181        Log(("vbsfBuildFullPath: invalid root!\n"));
     
    188188        char *utf8Root;
    189189
    190         rc = RTUtf16ToUtf8 (pszRoot, &utf8Root);
     190        rc = RTUtf16ToUtf8 (pwszRoot, &utf8Root);
    191191        if (VBOX_SUCCESS (rc))
    192192        {
     
    229229    {
    230230        /* Client sends us UCS2, so convert it to UTF8. */
    231         Log(("Root %ls path %.*ls\n", pszRoot, pPath->u16Length/sizeof(pPath->String.ucs2[0]), pPath->String.ucs2));
     231        Log(("Root %ls path %.*ls\n", pwszRoot, pPath->u16Length/sizeof(pPath->String.ucs2[0]), pPath->String.ucs2));
    232232
    233233        /* Allocate buffer that will be able to contain
     
    236236         * in worst case.
    237237         */
    238         uint32_t cbFullPath = (cbRoot/sizeof (RTUCS2) + ShflStringLength (pPath)) * 4;
     238        uint32_t cbFullPath = (cbRoot/sizeof (RTUTF16) + ShflStringLength (pPath)) * 4;
    239239
    240240        pszFullPath = (char *)RTMemAllocZ (cbFullPath);
     
    248248            uint32_t cb = cbFullPath;
    249249
    250             rc = RTStrUcs2ToUtf8Ex (&pszFullPath, cb, pszRoot);
     250            rc = RTUtf16ToUtf8Ex (pwszRoot, RTSTR_MAX, &pszFullPath, cb, NULL);
    251251            if (VBOX_FAILURE(rc))
    252252            {
     
    273273            {
    274274                /* Convert and copy components. */
    275                 RTUCS2 *src = &pPath->String.ucs2[0];
     275                PRTUTF16 src = &pPath->String.ucs2[0];
    276276
    277277                /* Correct path delimiters */
     
    291291                    src++;  /* we already appended a delimiter to the first part */
    292292
    293                 rc = RTStrUcs2ToUtf8Ex (&dst, cb, src);
     293                rc = RTUtf16ToUtf8Ex (src, RTSTR_MAX, &dst, cb, NULL);
    294294                if (VBOX_FAILURE(rc))
    295295                {
     
    387387                }
    388388                Assert(*src == RTPATH_DELIMITER && VBOX_SUCCESS(rc));
    389                 if (    *src == RTPATH_DELIMITER 
     389                if (    *src == RTPATH_DELIMITER
    390390                    &&  VBOX_SUCCESS(rc))
    391391                {
     
    654654            pParms->Result = SHFL_FILE_NOT_FOUND;
    655655
    656             /* This actually isn't an error, so correct the rc before return later, 
     656            /* This actually isn't an error, so correct the rc before return later,
    657657               because the driver (VBoxSF.sys) expects rc = VINF_SUCCESS and checks the result code. */
    658658            fNoError = true;
     
    661661            pParms->Result = SHFL_PATH_NOT_FOUND;
    662662
    663             /* This actually isn't an error, so correct the rc before return later, 
     663            /* This actually isn't an error, so correct the rc before return later,
    664664               because the driver (VBoxSF.sys) expects rc = VINF_SUCCESS and checks the result code. */
    665665            fNoError = true;
     
    675675            pParms->Result = SHFL_FILE_EXISTS;
    676676
    677             /* This actually isn't an error, so correct the rc before return later, 
     677            /* This actually isn't an error, so correct the rc before return later,
    678678               because the driver (VBoxSF.sys) expects rc = VINF_SUCCESS and checks the result code. */
    679             fNoError = true;   
     679            fNoError = true;
    680680            break;
    681681        default:
     
    696696        {
    697697            /* For now, we do not treat a failure here as fatal. */
    698             /* @todo Also set the size for SHFL_CF_ACT_CREATE_IF_NEW if 
     698            /* @todo Also set the size for SHFL_CF_ACT_CREATE_IF_NEW if
    699699                     SHFL_CF_ACT_FAIL_IF_EXISTS is set. */
    700700            RTFileSetSize(pHandle->file.Handle, pParms->Info.cbObject);
     
    755755
    756756    /* Report the driver that all is okay, we're done here */
    757     if (fNoError) 
     757    if (fNoError)
    758758        rc = VINF_SUCCESS;
    759759
     
    12051205    int            rc = VINF_SUCCESS;
    12061206    PSHFLDIRINFO   pSFDEntry;
    1207     PRTUCS2        puszString;
     1207    PRTUTF16       pwszString;
    12081208    PRTDIR         DirHandle;
    12091209    bool           fUtf8;
     
    13331333        {
    13341334            pSFDEntry->name.String.ucs2[0] = 0;
    1335             puszString = pSFDEntry->name.String.ucs2;
    1336             int rc2 = RTStrUtf8ToUcs2Ex(&puszString, pDirEntry->cbName+1, pDirEntry->szName);
     1335            pwszString = pSFDEntry->name.String.ucs2;
     1336            int rc2 = RTStrToUtf16Ex(pDirEntry->szName, RTSTR_MAX, &pwszString, pDirEntry->cbName+1, NULL);
    13371337            AssertRC(rc2);
    13381338
    1339             pSFDEntry->name.u16Length = RTStrUcs2Len (pSFDEntry->name.String.ucs2) * 2;
     1339            pSFDEntry->name.u16Length = RTUtf16Len (pSFDEntry->name.String.ucs2) * 2;
    13401340            pSFDEntry->name.u16Size = pSFDEntry->name.u16Length + 2;
    13411341
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r7327 r7418  
    44804480    Log (("Adding shared folder '%ls' -> '%ls'\n", aName, aData.mHostPath.raw()));
    44814481
    4482     cbString = (RTStrUcs2Len (aData.mHostPath) + 1) * sizeof (RTUCS2);
     4482    cbString = (RTUtf16Len (aData.mHostPath) + 1) * sizeof (RTUTF16);
    44834483    if (cbString >= UINT16_MAX)
    44844484        return setError (E_INVALIDARG, tr ("The name is too long"));
     
    44884488
    44894489    pFolderName->u16Size   = (uint16_t)cbString;
    4490     pFolderName->u16Length = (uint16_t)cbString - sizeof(RTUCS2);
     4490    pFolderName->u16Length = (uint16_t)cbString - sizeof(RTUTF16);
    44914491
    44924492    parms[0].type = VBOX_HGCM_SVC_PARM_PTR;
     
    44944494    parms[0].u.pointer.size = sizeof (SHFLSTRING) + (uint16_t)cbString;
    44954495
    4496     cbString = (RTStrUcs2Len (aName) + 1) * sizeof (RTUCS2);
     4496    cbString = (RTUtf16Len (aName) + 1) * sizeof (RTUTF16);
    44974497    if (cbString >= UINT16_MAX)
    44984498    {
     
    45054505
    45064506    pMapName->u16Size   = (uint16_t)cbString;
    4507     pMapName->u16Length = (uint16_t)cbString - sizeof (RTUCS2);
     4507    pMapName->u16Length = (uint16_t)cbString - sizeof (RTUTF16);
    45084508
    45094509    parms[1].type = VBOX_HGCM_SVC_PARM_PTR;
     
    45514551    Log (("Removing shared folder '%ls'\n", aName));
    45524552
    4553     cbString = (RTStrUcs2Len (aName) + 1) * sizeof (RTUCS2);
     4553    cbString = (RTUtf16Len (aName) + 1) * sizeof (RTUTF16);
    45544554    if (cbString >= UINT16_MAX)
    45554555        return setError (E_INVALIDARG, tr ("The name is too long"));
     
    45594559
    45604560    pMapName->u16Size   = (uint16_t)cbString;
    4561     pMapName->u16Length = (uint16_t)cbString - sizeof (RTUCS2);
     4561    pMapName->u16Length = (uint16_t)cbString - sizeof (RTUTF16);
    45624562
    45634563    parms.type = VBOX_HGCM_SVC_PARM_PTR;
     
    61216121    BSTR            str = NULL;
    61226122    *phrc = S_OK;
    6123 #define STR_CONV()  do { rc = RTStrUcs2ToUtf8(&psz, str); RC_CHECK(); } while (0)
     6123#define STR_CONV()  do { rc = RTUtf16ToUtf8(str, &psz); RC_CHECK(); } while (0)
    61246124#define STR_FREE()  do { if (str) { SysFreeString(str); str = NULL; } if (psz) { RTStrFree(psz); psz = NULL; } } while (0)
    61256125#define RC_CHECK()  do { if (VBOX_FAILURE(rc)) { AssertMsgFailed(("rc=%Vrc\n", rc)); STR_FREE(); return rc; } } while (0)
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r7359 r7418  
    9898    unsigned        i;
    9999
    100 #define STR_CONV()  do { rc = RTStrUcs2ToUtf8(&psz, str); RC_CHECK(); } while (0)
     100#define STR_CONV()  do { rc = RTUtf16ToUtf8(str, &psz); RC_CHECK(); } while (0)
    101101#define STR_FREE()  do { if (str) { SysFreeString(str); str = NULL; } if (psz) { RTStrFree(psz); psz = NULL; } } while (0)
    102102#define RC_CHECK()  do { if (VBOX_FAILURE(rc)) { AssertMsgFailed(("rc=%Vrc\n", rc)); STR_FREE(); return rc; } } while (0)
  • trunk/src/VBox/Main/glue/com.cpp

    r6076 r7418  
    5151#else
    5252#define VBOX_USER_HOME_SUFFIX   ".VirtualBox"
    53 #endif 
     53#endif
    5454
    5555
     
    117117            iinfo->GetNameShared (&iname);
    118118            char *utf8IName = NULL;
    119             if (VBOX_SUCCESS (RTStrCurrentCPToUtf8 (&utf8IName, iname)))
     119            if (RT_SUCCESS (RTStrCurrentCPToUtf8 (&utf8IName, iname)))
    120120            {
    121121                PRTUCS2 ucs2IName = NULL;
    122                 if (VBOX_SUCCESS (RTStrUtf8ToUcs2 (&ucs2IName, utf8IName)))
     122                if (RT_SUCCESS (RTStrToUtf16 (utf8IName, &ucs2IName)))
    123123                {
    124124                    *aName = SysAllocString ((OLECHAR *) ucs2IName);
    125                     RTStrUcs2Free (ucs2IName);
     125                    RTUtf16Free (ucs2IName);
    126126                }
    127127                RTStrFree (utf8IName);
     
    170170        if (RT_SUCCESS (vrc))
    171171        {
    172             size_t len = 
     172            size_t len =
    173173                RTStrPrintf (aDir, aDirLen, "%s%c%s",
    174174                             path, RTPATH_DELIMITER, VBOX_USER_HOME_SUFFIX);
     
    187187
    188188/* static */
    189 const Guid Guid::Empty; /* default ctor is OK */ 
     189const Guid Guid::Empty; /* default ctor is OK */
    190190
    191191} /* namespace com */
  • trunk/src/VBox/Main/linux/helpers.cpp

    r5999 r7418  
    176176unsigned int SysStringByteLen(BSTR bstr)
    177177{
    178     return RTStrUcs2Len(bstr) * sizeof(OLECHAR);
     178    return RTUtf16Len(bstr) * sizeof(OLECHAR);
    179179}
    180180
     
    186186unsigned int SysStringLen(BSTR bstr)
    187187{
    188     return RTStrUcs2Len(bstr);
     188    return RTUtf16Len(bstr);
    189189}
  • trunk/src/VBox/Main/testcase/tstAPI.cpp

    r7207 r7418  
    379379                char *driveNameUtf8;
    380380                dvdDrive->GetDriveName(&driveName);
    381                 RTStrUcs2ToUtf8(&driveNameUtf8, (PCRTUCS2)driveName);
     381                RTUtf16ToUtf8((PCRTUTF16)driveName, &driveNameUtf8);
    382382                printf("Host DVD drive name: %s\n", driveNameUtf8);
    383383                RTStrFree(driveNameUtf8);
     
    404404                char *driveNameUtf8;
    405405                floppyDrive->GetDriveName(&driveName);
    406                 RTStrUcs2ToUtf8(&driveNameUtf8, (PCRTUCS2)driveName);
     406                RTUtf16ToUtf8((PCRTUTF16)driveName, &driveNameUtf8);
    407407                printf("Host floppy drive name: %s\n", driveNameUtf8);
    408408                RTStrFree(driveNameUtf8);
  • trunk/src/VBox/Runtime/r3/posix/dir-posix.cpp

    r5999 r7418  
    419419             * Setup the returned data.
    420420             */
    421             pDirEntry->cucShortName = 0;
    422             pDirEntry->uszShortName[0] = 0;
     421            pDirEntry->cwcShortName = 0;
     422            pDirEntry->wszShortName[0] = 0;
    423423            pDirEntry->cbName  = (uint16_t)cchName;
    424424            Assert(pDirEntry->cbName == cchName);
  • trunk/src/VBox/Runtime/r3/win/dir-win.cpp

    r6971 r7418  
    5252
    5353    /*
    54      * Convert to UCS2.
    55      */
    56     PRTUCS2 pucszString;
    57     int rc = RTStrUtf8ToUcs2(&pucszString, pszPath);
     54     * Convert to UTF-16.
     55     */
     56    PRTUTF16 pwszString;
     57    int rc = RTStrToUtf16(pszPath, &pwszString);
    5858    AssertRC(rc);
    5959    if (RT_SUCCESS(rc))
     
    6262         * Query and check attributes.
    6363         */
    64         DWORD dwAttr = GetFileAttributesW((LPCWSTR)pucszString);
     64        DWORD dwAttr = GetFileAttributesW((LPCWSTR)pwszString);
    6565        fRc = dwAttr != INVALID_FILE_ATTRIBUTES
    6666            && (dwAttr & FILE_ATTRIBUTE_DIRECTORY);
    6767
    68         RTStrUcs2Free(pucszString);
     68        RTUtf16Free(pwszString);
    6969    }
    7070
     
    8484    {
    8585        /*
    86          * Convert to UCS2.
     86         * Convert to UTF-16.
    8787         */
    88         PRTUCS2 pucszString;
    89         rc = RTStrUtf8ToUcs2(&pucszString, pszPath);
     88        PRTUTF16 pwszString;
     89        rc = RTStrToUtf16(pszPath, &pwszString);
    9090        AssertRC(rc);
    9191        if (RT_SUCCESS(rc))
     
    9494             * Create the directory.
    9595             */
    96             if (CreateDirectoryW((LPCWSTR)pucszString, NULL))
     96            if (CreateDirectoryW((LPCWSTR)pwszString, NULL))
    9797                rc = VINF_SUCCESS;
    9898            else
     
    104104            if (RT_SUCCESS(rc))
    105105            {
    106                 if (SetFileAttributesW((LPCWSTR)pucszString, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED))
     106                if (SetFileAttributesW((LPCWSTR)pwszString, FILE_ATTRIBUTE_NOT_CONTENT_INDEXED))
    107107                    rc = VINF_SUCCESS;
    108108                else
     
    110110            }
    111111
    112             RTStrUcs2Free(pucszString);
     112            RTUtf16Free(pwszString);
    113113        }
    114114    }
     
    127127{
    128128    /*
    129      * Convert to UCS2.
    130      */
    131     PRTUCS2 pucszString;
    132     int rc = RTStrUtf8ToUcs2(&pucszString, pszPath);
     129     * Convert to UTF-16.
     130     */
     131    PRTUTF16 pwszString;
     132    int rc = RTStrToUtf16(pszPath, &pwszString);
    133133    AssertRC(rc);
    134134    if (RT_SUCCESS(rc))
     
    137137         * Remove the directory.
    138138         */
    139         if (RemoveDirectoryW((LPCWSTR)pucszString))
     139        if (RemoveDirectoryW((LPCWSTR)pwszString))
    140140            rc = VINF_SUCCESS;
    141141        else
    142142            rc = RTErrConvertFromWin32(GetLastError());
    143143
    144         RTStrUcs2Free(pucszString);
     144        RTUtf16Free(pwszString);
    145145    }
    146146
     
    181181    int rc = VINF_SUCCESS;
    182182#ifndef RT_DONT_CONVERT_FILENAMES
    183     PRTUCS2 puszName;
    184     rc = RTStrUtf8ToUcs2(&puszName, pszPathBuf);
     183    PRTUTF16 pwszName;
     184    rc = RTStrToUtf16(pszPathBuf, &pwszName);
    185185    if (RT_SUCCESS(rc))
    186186    {
    187         pDir->hDir    = FindFirstFileW((LPCWSTR)puszName, &pDir->Data);
     187        pDir->hDir    = FindFirstFileW((LPCWSTR)pwszName, &pDir->Data);
    188188#else
    189189        pDir->hDir    = FindFirstFileA(pszPathBuf, &pDir->Data);
     
    197197            rc = RTErrConvertFromWin32(GetLastError());
    198198#ifndef RT_DONT_CONVERT_FILENAMES
    199         RTStrUcs2Free(puszName);
     199        RTUtf16Free(pwszName);
    200200    }
    201201#endif
     
    430430    {
    431431        /* copy and calc length */
    432         PCRTUCS2 pucSrc = (PCRTUCS2)pDir->Data.cAlternateFileName;
    433         PRTUCS2  pucDst = pDirEntry->uszShortName;
    434         while (*pucSrc)
    435             *pucDst++ = *pucSrc++;
    436         pDirEntry->cucShortName = pucDst - &pDirEntry->uszShortName[0];
     432        PCRTUTF16 pwszSrc = (PCRTUTF16)pDir->Data.cAlternateFileName;
     433        PRTUTF16  pwszDst = pDirEntry->wszShortName;
     434        while (*pwszSrc)
     435            *pwszDst++ = *pwszSrc++;
     436        pDirEntry->cwcShortName = pwszDst - &pDirEntry->wszShortName[0];
    437437        /* zero the rest */
    438         const PRTUCS2 pucEnd = &pDirEntry->uszShortName[ELEMENTS(pDirEntry->uszShortName)];
    439         while (pucDst < pucEnd)
    440             *pucDst++ = '\0';
     438        const PRTUTF16 pwszEnd = &pDirEntry->wszShortName[RT_ELEMENTS(pDirEntry->wszShortName)];
     439        while (pwszDst < pwszEnd)
     440            *pwszDst++ = '\0';
    441441    }
    442442    else
    443443#endif
    444444    {
    445         memset(pDirEntry->uszShortName, 0, sizeof(pDirEntry->uszShortName));
    446         pDirEntry->cucShortName = 0;
     445        memset(pDirEntry->wszShortName, 0, sizeof(pDirEntry->wszShortName));
     446        pDirEntry->cwcShortName = 0;
    447447    }
    448448
  • trunk/src/VBox/Runtime/r3/win/fs-win.cpp

    r5999 r7418  
    8787
    8888#ifndef RT_DONT_CONVERT_FILENAMES
     89
    8990/**
    9091 * Finds the root of the specified volume.
     
    9293 * @returns iprt status code.
    9394 * @param   pszFsPath       Path within the filesystem. Verified as one byte or more.
    94  * @param   ppuszFsRoot     Where to store the returned string. Free with rtFsFreeRoot(),
    95  */
    96 static int rtFsGetRoot(const char *pszFsPath, PRTUCS2 *ppuszFsRoot)
     95 * @param   ppwszFsRoot     Where to store the returned string. Free with rtFsFreeRoot(),
     96 */
     97static int rtFsGetRoot(const char *pszFsPath, PRTUTF16 *ppwszFsRoot)
    9798{
    9899    /*
     
    100101     */
    101102    if (rtFsIsRoot(pszFsPath))
    102         return RTStrUtf8ToUcs2(ppuszFsRoot, pszFsPath);
     103        return RTStrToUtf16(pszFsPath, ppwszFsRoot);
    103104
    104105    /*
     
    120121     * Convert the path.
    121122     */
    122     rc = RTStrUtf8ToUcs2(ppuszFsRoot, szFullPath);
     123    rc = RTStrToUtf16(szFullPath, ppwszFsRoot);
    123124    if (RT_FAILURE(rc))
    124125        return rc == VERR_BUFFER_OVERFLOW ? VERR_FILENAME_TOO_LONG : rc;
     
    127128     * Walk the path until our proper API is happy or there is no more path left.
    128129     */
    129     PRTUCS2 puszStart = *ppuszFsRoot;
    130     if (!GetVolumeInformationW(puszStart, NULL, 0, NULL, NULL, 0, NULL, 0))
    131     {
    132         PRTUCS2 puszEnd = puszStart + RTStrUcs2Len(puszStart);
    133         PRTUCS2 puszMin = puszStart + 2;
     130    PRTUTF16 pwszStart = *ppwszFsRoot;
     131    if (!GetVolumeInformationW(pwszStart, NULL, 0, NULL, NULL, 0, NULL, 0))
     132    {
     133        PRTUTF16 pwszEnd = pwszStart + RTUtf16Len(pwszStart);
     134        PRTUTF16 pwszMin = pwszStart + 2;
    134135        do
    135136        {
    136137            /* Strip off the last path component. */
    137             while (puszEnd-- > puszMin)
    138                 if (RTPATH_IS_SLASH(*puszEnd))
     138            while (pwszEnd-- > pwszMin)
     139                if (RTPATH_IS_SLASH(*pwszEnd))
    139140                    break;
    140             AssertReturn(puszEnd >= puszMin, VERR_INTERNAL_ERROR); /* leaks, but that's irrelevant for an internal error. */
    141             puszEnd[1] = '\0';
    142         } while (!GetVolumeInformationW(puszStart, NULL, 0, NULL, NULL, 0, NULL, 0));
     141            AssertReturn(pwszEnd >= pwszMin, VERR_INTERNAL_ERROR); /* leaks, but that's irrelevant for an internal error. */
     142            pwszEnd[1] = '\0';
     143        } while (!GetVolumeInformationW(pwszStart, NULL, 0, NULL, NULL, 0, NULL, 0));
    143144    }
    144145
     
    149150 * Frees string returned by rtFsGetRoot().
    150151 */
    151 static void rtFsFreeRoot(PRTUCS2 puszFsRoot)
    152 {
    153     RTStrUcs2Free(puszFsRoot);
    154 }
    155 
    156 #else
     152static void rtFsFreeRoot(PRTUTF16 pwszFsRoot)
     153{
     154    RTUtf16Free(pwszFsRoot);
     155}
     156
     157#else /* RT_DONT_CONVERT_FILENAMES */
    157158
    158159/**
     
    214215    RTStrFree(pszFsRoot);
    215216}
    216 #endif
     217
     218#endif /* RT_DONT_CONVERT_FILENAMES*/
    217219
    218220
     
    225227    AssertMsgReturn(VALID_PTR(pszFsPath) && *pszFsPath, ("%p", pszFsPath), VERR_INVALID_PARAMETER);
    226228#ifndef RT_DONT_CONVERT_FILENAMES
    227     PRTUCS2 puszFsRoot;
    228     int rc = rtFsGetRoot(pszFsPath, &puszFsRoot);
     229    PRTUTF16 pwszFsRoot;
     230    int rc = rtFsGetRoot(pszFsPath, &pwszFsRoot);
    229231#else
    230232    char pszFsRoot;
     
    242244        ULARGE_INTEGER cbFree;
    243245#ifndef RT_DONT_CONVERT_FILENAMES
    244         if (GetDiskFreeSpaceExW(puszFsRoot, &cbFree, &cbTotal, NULL))
     246        if (GetDiskFreeSpaceExW(pwszFsRoot, &cbFree, &cbTotal, NULL))
    245247#else
    246248        if (GetDiskFreeSpaceExA(pszFsRoot, &cbFree, &cbTotal, NULL))
     
    271273        DWORD cSectorsPerCluster;
    272274#ifndef RT_DONT_CONVERT_FILENAMES
    273         if (GetDiskFreeSpaceW(puszFsRoot, &cSectorsPerCluster, &cbSector, &dwDummy1, &dwDummy2))
     275        if (GetDiskFreeSpaceW(pwszFsRoot, &cSectorsPerCluster, &cbSector, &dwDummy1, &dwDummy2))
    274276#else
    275277        if (GetDiskFreeSpaceA(pszFsRoot, &cSectorsPerCluster, &cbSector, &dwDummy1, &dwDummy2))
     
    291293
    292294#ifndef RT_DONT_CONVERT_FILENAMES
    293     rtFsFreeRoot(puszFsRoot);
     295    rtFsFreeRoot(pwszFsRoot);
    294296#else
    295297    rtFsFreeRoot(pszFsRoot);
     
    314316    AssertMsgReturn(VALID_PTR(pu32Serial), ("%p", pu32Serial), VERR_INVALID_PARAMETER);
    315317#ifndef RT_DONT_CONVERT_FILENAMES
    316     PRTUCS2 puszFsRoot;
    317     int rc = rtFsGetRoot(pszFsPath, &puszFsRoot);
     318    PRTUTF16 pwszFsRoot;
     319    int rc = rtFsGetRoot(pszFsPath, &pwszFsRoot);
    318320#else
    319321    char pszFsRoot;
     
    330332    DWORD   dwSerial;
    331333#ifndef RT_DONT_CONVERT_FILENAMES
    332     if (GetVolumeInformationW(puszFsRoot, NULL, 0, &dwSerial, &dwMaxName, &dwFlags, NULL, 0))
     334    if (GetVolumeInformationW(pwszFsRoot, NULL, 0, &dwSerial, &dwMaxName, &dwFlags, NULL, 0))
    333335#else
    334336    if (GetVolumeInformationA(pszFsRoot, NULL, 0, &dwSerial, &dwMaxName, &dwFlags, NULL, 0))
     
    344346
    345347#ifndef RT_DONT_CONVERT_FILENAMES
    346     RTStrUcs2Free(puszFsRoot);
    347 #else
    348     RTStrUcs2Free(pszFsRoot);
     348    RTUtf16Free(pwszFsRoot);
     349#else
     350    RTStrFree(pszFsRoot);
    349351#endif
    350352    return rc;
     
    367369    AssertMsgReturn(VALID_PTR(pProperties), ("%p", pProperties), VERR_INVALID_PARAMETER);
    368370#ifndef RT_DONT_CONVERT_FILENAMES
    369     PRTUCS2 puszFsRoot;
    370     int rc = rtFsGetRoot(pszFsPath, &puszFsRoot);
     371    PRTUTF16 pwszFsRoot;
     372    int rc = rtFsGetRoot(pszFsPath, &pwszFsRoot);
    371373#else
    372374    char pszFsRoot;
     
    383385    DWORD   dwSerial;
    384386#ifndef RT_DONT_CONVERT_FILENAMES
    385     if (GetVolumeInformationW(puszFsRoot, NULL, 0, &dwSerial, &dwMaxName, &dwFlags, NULL, 0))
     387    if (GetVolumeInformationW(pwszFsRoot, NULL, 0, &dwSerial, &dwMaxName, &dwFlags, NULL, 0))
    386388#else
    387389    if (GetVolumeInformationA(pszFsRoot, NULL, 0, &dwSerial, &dwMaxName, &dwFlags, NULL, 0))
     
    406408
    407409#ifndef RT_DONT_CONVERT_FILENAMES
    408     RTStrUcs2Free(puszFsRoot);
    409 #else
    410     RTStrUcs2Free(pszFsRoot);
     410    RTUtf16Free(pwszFsRoot);
     411#else
     412    RTStrFree(pszFsRoot);
    411413#endif
    412414    return rc;
  • trunk/src/VBox/Runtime/r3/win/path-win.cpp

    r7403 r7418  
    193193     * Convert and return.
    194194     */
    195     return RTStrUcs2ToUtf8Ex(&pszPath, cchPath, &wszPath[0]);
     195    return RTUtf16ToUtf8Ex(&wszPath[0], RTSTR_MAX, &pszPath, cchPath, NULL);
    196196}
    197197
     
    225225#ifndef RT_DONT_CONVERT_FILENAMES
    226226    PRTUTF16 pwszPath;
    227     int rc = RTStrUtf8ToUcs2(&pwszPath, pszPath);
     227    int rc = RTStrToUtf16(pszPath, &pwszPath);
    228228    if (RT_FAILURE(rc))
    229229        return rc;
     
    477477#ifndef RT_DONT_CONVERT_FILENAMES
    478478    PRTUTF16 pwszPath;
    479     int rc = RTStrUtf8ToUcs2(&pwszPath, pszPath);
     479    int rc = RTStrToUtf16(pszPath, &pwszPath);
    480480    if (RT_SUCCESS(rc))
    481481    {
  • trunk/src/VBox/Runtime/r3/win/utf8-win.cpp

    r5999 r7418  
    6767     * Convert to wide char first.
    6868     */
    69     PRTUCS2 pucszString = NULL;
    70     int rc = RTStrUtf8ToUcs2(&pucszString, pszString);
     69    PRTUTF16 pwszString = NULL;
     70    int rc = RTStrToUtf16(pszString, &pwszString);
    7171    if (RT_FAILURE(rc))
    7272        return rc;
     
    7575     * First calc result string length.
    7676     */
    77     int cbResult = WideCharToMultiByte(CP_ACP, 0, pucszString, -1, NULL, 0, NULL, NULL);
     77    int cbResult = WideCharToMultiByte(CP_ACP, 0, pwszString, -1, NULL, 0, NULL, NULL);
    7878    if (cbResult > 0)
    7979    {
     
    8787             * Do the translation.
    8888             */
    89             if (WideCharToMultiByte(CP_ACP, 0, pucszString, -1, lpString, cbResult, NULL, NULL) > 0)
     89            if (WideCharToMultiByte(CP_ACP, 0, pwszString, -1, lpString, cbResult, NULL, NULL) > 0)
    9090            {
    9191                /* ok */
    9292                *ppszString = lpString;
    93                 RTMemTmpFree(pucszString);
     93                RTMemTmpFree(pwszString);
    9494                return VINF_SUCCESS;
    9595            }
     
    111111        rc = RTErrConvertFromWin32(iLastErr);
    112112    }
    113     RTMemTmpFree(pucszString);
     113    RTMemTmpFree(pwszString);
    114114    return rc;
    115115}
     
    129129    *ppszString = NULL;
    130130
    131     /** @todo is there a quicker way? Currently: ACP -> UCS-2 -> UTF-8 */
     131    /** @todo is there a quicker way? Currently: ACP -> UTF-16 -> UTF-8 */
    132132
    133133    size_t cch = strlen(pszString);
     
    145145     */
    146146    int rc;
    147     int cuc = MultiByteToWideChar(CP_ACP, 0, pszString, -1, NULL, 0);
    148     if (cuc > 0)
     147    int cwc = MultiByteToWideChar(CP_ACP, 0, pszString, -1, NULL, 0);
     148    if (cwc > 0)
    149149    {
    150150        /*
    151151         * Alloc space for result buffer.
    152152         */
    153         PRTUCS2 pucszString = (PRTUCS2)RTMemTmpAlloc(cuc * sizeof(RTUCS2));
    154         if (pucszString)
     153        PRTUTF16 pwszString = (PRTUTF16)RTMemTmpAlloc(cwc * sizeof(RTUTF16));
     154        if (pwszString)
    155155        {
    156156            /*
    157157             * Do the translation.
    158158             */
    159             if (MultiByteToWideChar(CP_ACP, 0, pszString, -1, pucszString, cuc) > 0)
     159            if (MultiByteToWideChar(CP_ACP, 0, pszString, -1, pwszString, cwc) > 0)
    160160            {
    161161                /*
    162                  * Now we got UCS-2. Convert to UTF-8
     162                 * Now we got UTF-16, convert it to UTF-8
    163163                 */
    164                 rc = RTStrUcs2ToUtf8(ppszString, pucszString);
    165                 RTMemTmpFree(pucszString);
     164                rc = RTUtf16ToUtf8(pwszString, ppszString);
     165                RTMemTmpFree(pwszString);
    166166                return rc;
    167167            }
    168             RTMemTmpFree(pucszString);
     168            RTMemTmpFree(pwszString);
    169169            /* translation error */
    170170            int iLastErr = GetLastError();
  • trunk/src/VBox/Runtime/testcase/tstDir.cpp

    r5999 r7418  
    160160                                 DirEntry.Info.ModificationTime,
    161161                                 DirEntry.Info.AccessTime);
    162                         if (fShortName && DirEntry.cucShortName)
    163                             RTPrintf(" %2d %lS\n", DirEntry.cucShortName, DirEntry.uszShortName);
     162                        if (fShortName && DirEntry.cwcShortName)
     163                            RTPrintf(" %2d %lS\n", DirEntry.cwcShortName, DirEntry.wszShortName);
    164164                        else
    165165                            RTPrintf(" %2d %s\n", DirEntry.cbName, DirEntry.szName);
  • trunk/src/VBox/Runtime/testcase/tstPath.cpp

    r5999 r7418  
    6666    if (RT_SUCCESS(rc))
    6767        RTPrintf("UserHome={%s}\n", szPath);
    68    
     68
    6969    /*
    7070     * RTPathAbsEx
     
    7373    static const char *aInput[] =
    7474    {
    75         // NULL, NULL, -- assertion in RTStrUtf8ToUcs2
     75        // NULL, NULL, -- assertion in RTStrToUtf16
    7676        NULL,                           "/absolute/..",
    7777        NULL,                           "/absolute\\\\../..",
  • trunk/src/VBox/Runtime/testcase/tstUtf8.cpp

    r5999 r7418  
    5050 * Generate a random codepoint for simple UTF-16 encoding.
    5151 */
    52 static RTUTF16 GetRandUcs2(void)
     52static RTUTF16 GetRandUtf16(void)
    5353{
    5454    RTUTF16 wc;
     
    100100    srand((unsigned)RTTimeNanoTS());
    101101    for (int i = 0; i < 30; i++)
    102         pwszRand[i] = GetRandUcs2();
     102        pwszRand[i] = GetRandUtf16();
    103103    pwszRand[30] = 0;
    104104
     
    141141    srand((unsigned)RTTimeNanoTS());
    142142    for (int i = 0; i < 30; i++)
    143         pwszRand[i] = GetRandUcs2();
     143        pwszRand[i] = GetRandUtf16();
    144144    pwszRand[30] = 0;
    145145    rc = RTUtf16ToUtf8(pwszRand, &pszUtf8);
     
    181181    srand((unsigned)RTTimeNanoTS());
    182182    for (int i = 0; i < 30; i++)
    183         pwszRand[i] = GetRandUcs2();
     183        pwszRand[i] = GetRandUtf16();
    184184    pwszRand[30] = 0;
    185185
     
    223223    srand((unsigned)RTTimeNanoTS());
    224224    for (int i = 0; i < 30; i++)
    225         pwszRand[i] = GetRandUcs2();
     225        pwszRand[i] = GetRandUtf16();
    226226    pwszRand[30] = 0;
    227227
     
    261261    srand((unsigned)RTTimeNanoTS());
    262262    for (int i = 0; i < 30; i++)
    263         pwszRand[i] = GetRandUcs2();
     263        pwszRand[i] = GetRandUtf16();
    264264    pwszRand[30] = 0;
    265265
     
    280280    srand((unsigned)RTTimeNanoTS());
    281281    for (int i = 0; i < 30; i++)
    282         pwszRand[i] = GetRandUcs2();
     282        pwszRand[i] = GetRandUtf16();
    283283    pwszRand[30] = 0;
    284284
     
    488488        }
    489489
    490         PRTUTF16 puszUcs2;
    491         rc = RTStrToUtf16(pszUtf8, &puszUcs2);
     490        PRTUTF16 pwszUtf16;
     491        rc = RTStrToUtf16(pszUtf8, &pwszUtf16);
    492492        if (rc == VINF_SUCCESS)
    493493        {
    494             if (mymemcmp(puszUcs2, g_wszAll, sizeof(g_wszAll), 16))
     494            if (mymemcmp(pwszUtf16, g_wszAll, sizeof(g_wszAll), 16))
    495495            {
    496496                RTPrintf("tstUtf8: FAILURE - the full #1: UTF-8 -> UTF-16 failed compare!\n");
    497497                g_cErrors++;
    498498            }
    499             RTUtf16Free(puszUcs2);
     499            RTUtf16Free(pwszUtf16);
    500500        }
    501501        else
     
    517517     */
    518518    RTPrintf("tstUtf8: #2: UTF-8 -> UTF-16 -> UTF-8...\n");
    519     PRTUTF16 puszUcs2;
    520     rc = RTStrToUtf16(&g_szAll[0], &puszUcs2);
     519    PRTUTF16 pwszUtf16;
     520    rc = RTStrToUtf16(&g_szAll[0], &pwszUtf16);
    521521    if (rc == VINF_SUCCESS)
    522522    {
    523         if (mymemcmp(puszUcs2, g_wszAll, sizeof(g_wszAll), 16))
     523        if (mymemcmp(pwszUtf16, g_wszAll, sizeof(g_wszAll), 16))
    524524        {
    525525            RTPrintf("tstUtf8: FAILURE - the full #2: UTF-8 -> UTF-16 failed compare!\n");
     
    528528
    529529        char *pszUtf8;
    530         rc = RTUtf16ToUtf8(puszUcs2, &pszUtf8);
     530        rc = RTUtf16ToUtf8(pwszUtf16, &pszUtf8);
    531531        if (rc == VINF_SUCCESS)
    532532        {
     
    543543            g_cErrors++;
    544544        }
    545         RTStrUcs2Free(puszUcs2);
     545        RTUtf16Free(pwszUtf16);
    546546    }
    547547    else
Note: See TracChangeset for help on using the changeset viewer.

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