VirtualBox

Changeset 40071 in vbox for trunk/include


Ignore:
Timestamp:
Feb 10, 2012 9:35:27 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
76205
Message:

Runtime/strings: add Utf-8 and Utf-16 sanitising to a white list of characters.

Location:
trunk/include/iprt
Files:
2 edited

Legend:

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

    r40053 r40071  
    13061306# define RTStrPrintHexBytes                             RT_MANGLER(RTStrPrintHexBytes)
    13071307# define RTStrPurgeEncoding                             RT_MANGLER(RTStrPurgeEncoding)
     1308# define RTStrPurgeComplementSet                        RT_MANGLER(RTStrPurgeComplimentSet)
    13081309# define RTStrPutCpInternal                             RT_MANGLER(RTStrPutCpInternal)
    13091310# define RTStrReallocTag                                RT_MANGLER(RTStrReallocTag)
     
    16301631# define RTUtf16ToLower                                 RT_MANGLER(RTUtf16ToLower)
    16311632# define RTUtf16ToUpper                                 RT_MANGLER(RTUtf16ToUpper)
     1633# define RTUtf16PurgeComplementSet                      RT_MANGLER(RTUtf16PurgeComplementSet)
    16321634# define RTUtf16ToUtf8ExTag                             RT_MANGLER(RTUtf16ToUtf8ExTag)
    16331635# define RTUtf16ToUtf8Tag                               RT_MANGLER(RTUtf16ToUtf8Tag)
  • trunk/include/iprt/string.h

    r40052 r40071  
    704704 */
    705705RTDECL(size_t) RTStrPurgeEncoding(char *psz);
     706
     707/**
     708 * Sanitise a (valid) UTF-8 string by replacing all characters outside a white
     709 * list in-place by an ASCII replacement character.  Multi-byte characters will
     710 * be replaced byte by byte.
     711 *
     712 * @returns The number of code points replaced, or a negative value if the
     713 *          string is not correctly encoded.  In this case the string will not
     714 *          be changed.
     715 * @param   psz            The string to sanitise.
     716 * @param   puszValidSet   A zero-terminated array of the Unicode code points
     717 *                         in the white list.
     718 * @param   chReplacement  The ASCII replacement character.
     719 */
     720RTDECL(ssize_t) RTStrPurgeComplementSet(char *psz, PCRTUNICP puszValidSet, char chReplacement);
    706721
    707722/**
     
    33053320
    33063321/**
     3322 * Sanitise a (valid) UTF-16 string by replacing all characters outside a white
     3323 * list in-place by an ASCII replacement character.  Multi-byte characters will
     3324 * be replaced byte by byte.
     3325 *
     3326 * @returns The number of code points replaced, or a negative value if the
     3327 *          string is not correctly encoded.  In this case the string will not
     3328 *          be changed.
     3329 * @param   pwsz           The string to sanitise.
     3330 * @param   puszValidSet   A zero-terminated array of the Unicode code points
     3331 *                         in the white list.
     3332 * @param   chReplacement  The ASCII replacement character.
     3333 */
     3334RTDECL(ssize_t) RTUtf16PurgeComplementSet(PRTUTF16 pwsz, PCRTUNICP puszValidSet, char chReplacement);
     3335
     3336/**
    33073337 * Translate a UTF-16 string into a UTF-8 allocating the result buffer (default
    33083338 * tag).
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