VirtualBox

Changeset 26659 in vbox for trunk


Ignore:
Timestamp:
Feb 19, 2010 2:42:37 PM (15 years ago)
Author:
vboxsync
Message:

IPRT: Added RTStrCopy and RTStrCopyEx for strcpy with overflow handling.

Location:
trunk
Files:
2 added
2 edited

Legend:

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

    r26482 r26659  
    10121012
    10131013/**
     1014 * String copy with overflow handling.
     1015 *
     1016 * @retval  VINF_SUCCESS on success.
     1017 * @retval  VERR_BUFFER_OVERFLOW if the destination buffer is too small.  The
     1018 *          buffer will contain as much of the string as it can hold, fully
     1019 *          terminated.
     1020 *
     1021 * @param   pszDst              The destination buffer.
     1022 * @param   cbDst               The size of the destination buffer (in bytes).
     1023 * @param   pszSrc              The source string.  NULL is not OK.
     1024 */
     1025RTDECL(int) RTStrCopy(char *pszDst, size_t cbDst, const char *pszSrc);
     1026
     1027/**
     1028 * String copy with overflow handling.
     1029 *
     1030 * @retval  VINF_SUCCESS on success.
     1031 * @retval  VERR_BUFFER_OVERFLOW if the destination buffer is too small.  The
     1032 *          buffer will contain as much of the string as it can hold, fully
     1033 *          terminated.
     1034 *
     1035 * @param   pszDst              The destination buffer.
     1036 * @param   cbDst               The size of the destination buffer (in bytes).
     1037 * @param   pszSrc              The source string.  NULL is not OK.
     1038 * @param   cchSrcMax           The maximum number of chars (not code points) to
     1039 *                              copy from the source string, not counting the
     1040 *                              terminator as usual.
     1041 */
     1042RTDECL(int) RTStrCopyEx(char *pszDst, size_t cbDst, const char *pszSrc, size_t cchSrcMax);
     1043
     1044/**
    10141045 * Performs a case sensitive string compare between two UTF-8 strings.
    10151046 *
  • trunk/src/VBox/Runtime/Makefile.kmk

    r26645 r26659  
    296296        common/string/RTStrCmp.cpp \
    297297        common/string/RTStrConvertHexBytes.cpp \
     298        common/string/RTStrCopy.cpp \
     299        common/string/RTStrCopyEx.cpp \
    298300        common/string/RTStrNCmp.cpp \
    299301        common/string/RTStrNLen.cpp \
     
    860862        common/path/RTPathStripTrailingSlash.cpp \
    861863        common/string/RTStrCmp.cpp \
     864        common/string/RTStrCopy.cpp \
     865        common/string/RTStrCopyEx.cpp \
    862866        common/string/RTStrNCmp.cpp \
    863867        common/string/RTStrNLen.cpp \
     
    12871291        common/rand/randparkmiller.cpp \
    12881292        common/string/RTStrCmp.cpp \
     1293        common/string/RTStrCopy.cpp \
     1294        common/string/RTStrCopyEx.cpp \
    12891295        common/string/RTStrNCmp.cpp \
    12901296        common/string/RTStrNLen.cpp \
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