VirtualBox

Changeset 18544 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Mar 30, 2009 1:18:50 PM (16 years ago)
Author:
vboxsync
Message:

RTStrToUpper/Lower: Document assumtions & todos properly, added missing spaces.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/string/utf-8.cpp

    r18528 r18544  
    13701370}
    13711371
     1372
    13721373RTDECL(char *) RTStrToLower(char *psz)
    13731374{
    1374     char *pszTmp = psz;
    1375     while(*pszTmp)
    1376     {
    1377         /* Get the codepoints */
    1378         RTUNICP cp = RTStrGetCp(pszTmp);
    1379         /* To lower */
     1375    /*
     1376     * Loop the code points in the string, converting them one by one.
     1377     * ASSUMES that the code points for upper and lower case are encoded
     1378     *         with the exact same length.
     1379     */
     1380    /** @todo Handled bad encodings correctly+quietly, remove assumption,
     1381     *        optimize. */
     1382    char *pszCur = psz;
     1383    while (*pszCur)
     1384    {
     1385        RTUNICP cp = RTStrGetCp(pszCur);
    13801386        cp = RTUniCpToLower(cp);
    1381         /* Put the converted codepoint back */
    1382         pszTmp = RTStrPutCp(pszTmp, cp);
     1387        pszCur = RTStrPutCp(pszCur, cp);
    13831388    }
    13841389    return psz;
    13851390}
    13861391
     1392
    13871393RTDECL(char *) RTStrToUpper(char *psz)
    13881394{
    1389     char *pszTmp = psz;
    1390     while(*pszTmp)
    1391     {
    1392         /* Get the codepoints */
    1393         RTUNICP cp = RTStrGetCp(pszTmp);
    1394         /* To lower */
     1395    /*
     1396     * Loop the code points in the string, converting them one by one.
     1397     * ASSUMES that the code points for upper and lower case are encoded
     1398     *         with the exact same length.
     1399     */
     1400    /** @todo Handled bad encodings correctly+quietly, remove assumption,
     1401     *        optimize. */
     1402    char *pszCur = psz;
     1403    while(*pszCur)
     1404    {
     1405        RTUNICP cp = RTStrGetCp(pszCur);
    13951406        cp = RTUniCpToUpper(cp);
    1396         /* Put the converted codepoint back */
    1397         pszTmp = RTStrPutCp(pszTmp, cp);
     1407        pszCur = RTStrPutCp(pszCur, cp);
    13981408    }
    13991409    return psz;
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