VirtualBox

Ignore:
Timestamp:
Jul 15, 2010 4:20:17 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
63688
Message:

iprt/string.h: added RTStrPurgeEncoding.

File:
1 edited

Legend:

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

    r28903 r30859  
    326326}
    327327RT_EXPORT_SYMBOL(RTStrIsValidEncoding);
     328
     329
     330RTDECL(size_t) RTStrPurgeEncoding(char *psz)
     331{
     332    size_t cErrors = 0;
     333    for (;;)
     334    {
     335        RTUNICP Cp;
     336        int rc = RTStrGetCpEx((const char **)&psz, &Cp);
     337        if (RT_SUCCESS(rc))
     338        {
     339            if (!Cp)
     340                break;
     341        }
     342        else
     343        {
     344            psz[-1] = '?';
     345            cErrors++;
     346        }
     347    }
     348    return cErrors;
     349}
     350RT_EXPORT_SYMBOL(RTStrPurgeEncoding);
    328351
    329352
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