VirtualBox

Ignore:
Timestamp:
Jul 2, 2008 1:40:07 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
32610
Message:

Added RTStrValidateEncoding, RTStrValidateEncodingEx and RTStrIsValidEncoding for explicit UTF-8 validation.

File:
1 edited

Legend:

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

    r8245 r10106  
    287287        *pcCps = RT_SUCCESS(rc) ? cCodePoints : 0;
    288288    return rc;
     289}
     290
     291
     292RTDECL(int) RTStrValidateEncoding(const char *psz)
     293{
     294    return RTStrValidateEncodingEx(psz, RTSTR_MAX, 0);
     295}
     296
     297
     298RTDECL(int) RTStrValidateEncodingEx(const char *psz, size_t cch, unsigned fFlags)
     299{
     300    NOREF(fFlags);
     301    size_t cCpsIgnored;
     302    return RTStrUniLenEx(psz, cch, &cCpsIgnored);
     303}
     304
     305
     306RTDECL(bool) RTStrIsValidEncoding(const char *psz)
     307{
     308    int rc = RTStrValidateEncodingEx(psz, RTSTR_MAX, 0);
     309    return RT_SUCCESS(rc);
    289310}
    290311
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