VirtualBox

Changeset 31418 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Aug 5, 2010 5:37:13 PM (14 years ago)
Author:
vboxsync
Message:

iprt/string.h,utf-8.cpp: avoid including uni.h; misc nits.

File:
1 edited

Legend:

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

    r31246 r31418  
    6464        {
    6565            /* figure sequence length and validate the first byte */
     66/** @todo RT_USE_RTC_3629 */
    6667            unsigned cb;
    6768            if ((uch & (RT_BIT(7) | RT_BIT(6) | RT_BIT(5))) == (RT_BIT(7) | RT_BIT(6)))
     
    805806{
    806807    size_t  cch = 0;
    807     while (true)
     808    for (;;)
    808809    {
    809810        RTUNICP Cp;
     
    814815        if (RT_FAILURE(rc))
    815816            return rc;
    816         cchCp = RTStrCpSize(Cp);
    817         if (cchCp == 0)
    818             return VERR_NO_TRANSLATION;
    819         cch += cchCp;
     817        cch += RTStrCpSize(Cp); /* cannot fail */
    820818    }
    821819
     
    838836static int rtLatin1RecodeAsUtf8(const char *pszIn, size_t cchIn, char *psz, size_t cch)
    839837{
    840     int   rc  = VINF_SUCCESS;
    841 
    842     while (true)
     838    int     rc = VINF_SUCCESS;
     839    for (;;)
    843840    {
    844841        RTUNICP Cp;
     
    854851            break;
    855852        }
     853        cch -= cchCp;
    856854        psz = RTStrPutCp(psz, Cp);
    857         cch -= cchCp;
    858855    }
    859856
     
    985982
    986983/**
    987  * Calculates the Latin-1 length of a string, validating the encoding while doing so.
     984 * Calculates the Latin-1 length of a string, validating the encoding while
     985 * doing so.
    988986 *
    989987 * @returns IPRT status code.
     
    996994{
    997995    size_t  cch = 0;
    998     while (true)
     996    for (;;)
    999997    {
    1000998        RTUNICP Cp;
     
    10331031    int   rc  = VINF_SUCCESS;
    10341032
    1035     while (true)
     1033    for (;;)
    10361034    {
    10371035        RTUNICP Cp;
     
    10471045            break;
    10481046        }
     1047        cch -= cchCp;
    10491048        psz = RTLatin1PutCp(psz, Cp);
    1050         cch -= cchCp;
    10511049    }
    10521050
     
    12241222    {
    12251223        /* figure the length and validate the first octet. */
     1224/** @todo RT_USE_RTC_3629 */
    12261225        unsigned cb;
    12271226        if (!(uch & RT_BIT(5)))
     
    13751374    {
    13761375        /* figure the length and validate the first octet. */
     1376/** @todo RT_USE_RTC_3629 */
    13771377        unsigned cb;
    13781378        if (!(uch & RT_BIT(5)))
     
    15001500    else if (uc < 0x00010000)
    15011501    {
     1502/** @todo RT_USE_RTC_3629 */
    15021503        if (   uc < 0x0000d8000
    15031504             || (   uc > 0x0000dfff
     
    15141515        }
    15151516    }
     1517/** @todo RT_USE_RTC_3629 */
    15161518    else if (uc < 0x00200000)
    15171519    {
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