Changeset 96045 in vbox
- Timestamp:
- Aug 5, 2022 12:26:04 AM (2 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 4 added
- 2 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r96043 r96045 1714 1714 # 1715 1715 UNIT_VBoxNoCrtAliases = CRT symbol alias for the rtnocr_xxx implementations 1716 1717 # Only adding the VBOX_NOCRT_ALIASES property to library targets for now: 1718 PROPS_ACCUMULATE_L += VBOX_NOCRT_ALIASES 1719 PROPS_ACCUMULATE_L_LNK += VBOX_NOCRT_ALIASES 1720 PROPS_LIBRARIES_ACCUMULATE_L += VBOX_NOCRT_ALIASES 1721 PROPS_ALL += VBOX_NOCRT_ALIASES 1722 1716 1723 define def_unit_VBoxNoCrtAliases_double_expansion 1717 1724 $$($(target)_2_VBOX_NOCRT_ALIAS_KMK_FILE): \ … … 1737 1744 $$(QUIET)$$(MKDIR) -p -- "$$($(target)_0_OUTDIR)/genalias/" 1738 1745 $$(QUIET)$$(VBOX_GENALIAS) -f $$(if-expr "$(bld_trg)" == "win",coff,$$(if-expr "$(bld_trg)" == "darwin",macho,omf)) \ 1739 -D "$$($(target)_0_OUTDIR)/genalias/" $$($(target)_2_VBOX_NOCRT_ALIASES) 1746 -D "$$($(target)_0_OUTDIR)/genalias/" $$($(target)_2_VBOX_NOCRT_ALIASES) \ 1747 $$($(target)_VBOX_NOCRT_ALIASES) \ 1748 $$($(target)_VBOX_NOCRT_ALIASES.$(bld_trg)) \ 1749 $$($(target)_VBOX_NOCRT_ALIASES.$(bld_trg).$(bld_type)) \ 1750 $$($(target)_VBOX_NOCRT_ALIASES.$(bld_trg).$(bld_trg_arch)) \ 1751 $$($(target)_VBOX_NOCRT_ALIASES.$(bld_trg).$(bld_trg_arch).$(bld_type)) \ 1752 $$($(target)_VBOX_NOCRT_ALIASES.$(bld_trg_arch)) \ 1753 $$($(target)_VBOX_NOCRT_ALIASES.$(bld_trg_cpu)) \ 1754 $$($(target)_VBOX_NOCRT_ALIASES.$(bld_type)) 1740 1755 $$(QUIET)$$(APPEND) -tn "$$($(target)_0_OUTDIR)/genalias/genalias.ts" "$$($(target)_2_VBOX_NOCRT_ALIASES))" 1741 1756 … … 1748 1763 $(target)_2_VBOX_NOCRT_ALIAS_KMK_FILE := $(PATH_OUT)/nocrt-aliases-$(target).kmk 1749 1764 include $($(target)_2_VBOX_NOCRT_ALIAS_KMK_FILE) 1750 $(target)_2_VBOX_NOCRT_ALIAS_FILES := \ 1751 $(foreach alias,$($(target)_2_VBOX_NOCRT_ALIASES), $($(target)_0_OUTDIR)/genalias/$(firstword $(subst =, $(SPACE),$(alias))).o) 1765 $(target)_2_VBOX_NOCRT_ALIAS_FILES := $(foreach alias,$($(target)_2_VBOX_NOCRT_ALIASES) \ 1766 $($(target)_VBOX_NOCRT_ALIASES) \ 1767 $($(target)_VBOX_NOCRT_ALIASES.$(bld_trg)) \ 1768 $($(target)_VBOX_NOCRT_ALIASES.$(bld_trg).$(bld_type)) \ 1769 $($(target)_VBOX_NOCRT_ALIASES.$(bld_trg).$(bld_trg_arch)) \ 1770 $($(target)_VBOX_NOCRT_ALIASES.$(bld_trg).$(bld_trg_arch).$(bld_type)) \ 1771 $($(target)_VBOX_NOCRT_ALIASES.$(bld_trg_arch)) \ 1772 $($(target)_VBOX_NOCRT_ALIASES.$(bld_trg_cpu)) \ 1773 $($(target)_VBOX_NOCRT_ALIASES.$(bld_type)) \ 1774 , $($(target)_0_OUTDIR)/genalias/$(firstword $(subst =, $(SPACE),$(alias))).o) 1752 1775 $(eval $(def_unit_VBoxNoCrtAliases_double_expansion)) 1753 1776 endif … … 1775 1798 generic/RTLogWriteStdErr-generic.cpp \ 1776 1799 generic/RTLogWriteStdOut-generic.cpp \ 1777 ,$(RuntimeBaseR3_SOURCES)) 1800 ,$(RuntimeBaseR3_SOURCES)) \ 1801 \ 1802 common/string/nocrt-strdup.cpp \ 1803 common/string/nocrt-stricmp.cpp \ 1804 common/string/strtok_r.cpp 1778 1805 RuntimeR3_SOURCES.x86 = $(RuntimeBaseR3_SOURCES.x86) \ 1779 1806 common/misc/setjmp.asm \ … … 1784 1811 common/string/memset.asm \ 1785 1812 common/string/strlen.asm \ 1813 common/string/strnlen.cpp \ 1786 1814 common/string/strchr.asm \ 1787 1815 common/string/strcmp.asm \ 1788 1816 common/string/strncmp.asm \ 1789 1817 common/string/strcpy.asm \ 1818 common/string/strncpy.asm \ 1819 common/string/strcat.cpp \ 1820 common/string/strncat.cpp \ 1790 1821 common/string/strrchr.cpp \ 1791 1822 common/string/strstr.cpp \ … … 1800 1831 common/string/memset.asm \ 1801 1832 common/string/strlen.asm \ 1833 common/string/strnlen.cpp \ 1802 1834 common/string/strchr.asm \ 1803 1835 common/string/strcmp.asm \ 1804 1836 common/string/strncmp.asm \ 1805 1837 common/string/strcpy.asm \ 1838 common/string/strncpy.asm \ 1839 common/string/strcat.cpp \ 1840 common/string/strncat.cpp \ 1806 1841 common/string/strrchr.cpp \ 1807 1842 common/string/strstr.cpp \ … … 1838 1873 common/compiler/vcc/guard-vcc.asm \ 1839 1874 common/compiler/vcc/stack-vcc.asm 1875 RuntimeR3_VBOX_NOCRT_ALIASES.win = strtok_s=nocrt_strtok_r _strtok_s=nocrt_strtok_r nocrt_strtok_s=nocrt_strtok_r 1840 1876 endif 1841 1877 endif -
trunk/src/VBox/Runtime/common/string/strcat.cpp
r96044 r96045 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - CRT Strings, strc py().3 * IPRT - CRT Strings, strcat(). 4 4 */ 5 5 … … 34 34 35 35 /** 36 * Copy a string36 * Append one string to another. 37 37 * 38 38 * @returns Pointer to destination string 39 * @param pszDst Will contain a copy of pszSrc.39 * @param pszDst String to append @a pszSrc to. 40 40 * @param pszSrc Zero terminated string. 41 41 */ 42 #ifdef IPRT_NO_CRT 43 # undef strcpy 44 char *RT_NOCRT(strcpy)(char *pszDst, const char *pszSrc) 45 #else 46 char *strcpy(char *pszDst, const char *pszSrc) 47 #endif 42 #undef strcat 43 char *RT_NOCRT(strcat)(char *pszDst, const char *pszSrc) 48 44 { 49 45 char * const pszRet = pszDst; 46 pszDst = RTStrEnd(pszDst, RTSTR_MAX); 50 47 while ((*pszDst = *pszSrc++) != '\0') 51 48 pszDst++; … … 53 50 return pszRet; 54 51 } 55 RT_ALIAS_AND_EXPORT_NOCRT_SYMBOL(strc py);52 RT_ALIAS_AND_EXPORT_NOCRT_SYMBOL(strcat); 56 53 -
trunk/src/VBox/Runtime/common/string/strlen.cpp
r96043 r96045 41 41 #ifdef IPRT_NO_CRT 42 42 # undef strlen 43 size_t strlen(const char *pszString)43 size_t RT_NOCRT(strlen)(const char *pszString) 44 44 #elif RT_MSC_PREREQ(RT_MSC_VER_VS2005) 45 45 __checkReturn size_t __cdecl strlen(__in_z const char *pszString) -
trunk/src/VBox/Runtime/common/string/strncat.cpp
r96044 r96045 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - CRT Strings, strcpy().3 * IPRT - No-CRT Strings, strncat(). 4 4 */ 5 5 … … 34 34 35 35 /** 36 * Copy a string36 * Append a substring to an existing string. 37 37 * 38 38 * @returns Pointer to destination string 39 * @param pszDst Will contain a copy of pszSrc. 39 * @param pszDst String to append @a cchMaxSrc chars from @a pszSrc to, 40 * plus a zero terminator. 40 41 * @param pszSrc Zero terminated string. 42 * @param cchMaxSrc Maximum number of chars to copy from @a pszSrc. 41 43 */ 42 #ifdef IPRT_NO_CRT 43 # undef strcpy 44 char *RT_NOCRT(strcpy)(char *pszDst, const char *pszSrc) 45 #else 46 char *strcpy(char *pszDst, const char *pszSrc) 47 #endif 44 #undef strncat 45 char *RT_NOCRT(strncat)(char *pszDst, const char *pszSrc, size_t cchMaxSrc) 48 46 { 49 47 char * const pszRet = pszDst; 50 while ((*pszDst = *pszSrc++) != '\0') 51 pszDst++; 48 49 pszDst = RTStrEnd(pszDst, RTSTR_MAX); 50 51 char ch; 52 while (cchMaxSrc-- > 0 && (ch = *pszSrc++) != '\0') 53 *pszDst++ = ch; 54 *pszDst = '\0'; 52 55 53 56 return pszRet; 54 57 } 55 RT_ALIAS_AND_EXPORT_NOCRT_SYMBOL(str cpy);58 RT_ALIAS_AND_EXPORT_NOCRT_SYMBOL(strncat); 56 59 -
trunk/src/VBox/Runtime/common/string/strnlen.cpp
r96043 r96045 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - CRT Strings, str len().3 * IPRT - CRT Strings, strnlen(). 4 4 */ 5 5 … … 34 34 35 35 /** 36 * Find the length of a zeroterminated byte string. 36 * Find the length of a zeroterminated byte string, but only up to a given 37 * limit. 37 38 * 38 * @returns String length in bytes .39 * @returns String length in bytes, or cchMax if too long. 39 40 * @param pszString Zero terminated string. 41 * @param cchMax Max number of chars to search for the end. 40 42 */ 41 #ifdef IPRT_NO_CRT 42 # undef strlen 43 size_t strlen(const char *pszString) 44 #elif RT_MSC_PREREQ(RT_MSC_VER_VS2005) 45 __checkReturn size_t __cdecl strlen(__in_z const char *pszString) 46 #else 47 size_t strlen(const char *pszString) 48 #endif 43 #undef strnlen 44 size_t RT_NOCRT(strnlen)(const char *pszString, size_t cchMax) 49 45 { 50 const char * psz= pszString;51 while ( *psz)52 psz ++;53 return psz - pszString;46 const char * const pszStart = pszString; 47 while (cchMax-- > 0 && *pszString) 48 pszString++; 49 return pszString - pszStart; 54 50 } 55 RT_ALIAS_AND_EXPORT_NOCRT_SYMBOL(str len);51 RT_ALIAS_AND_EXPORT_NOCRT_SYMBOL(strnlen); 56 52
Note:
See TracChangeset
for help on using the changeset viewer.