Changeset 91788 in vbox for trunk/src/VBox/Runtime/common/string
- Timestamp:
- Oct 17, 2021 5:55:43 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/string/strprintf2.cpp
r82968 r91788 106 106 } 107 107 108 109 RTDECL(ssize_t) RTStrPrintf2(char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...) 108 RTDECL(ssize_t) RTStrPrintf2V(char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args) 110 109 { 111 /* Explicitly inline RTStrPrintf2V + RTStrPrintf2ExV here because this is a frequently use API. */112 110 STRPRINTF2OUTPUTARGS Args; 113 111 size_t cchRet; 114 va_list args;115 112 AssertMsg(cchBuffer > 0, ("Excellent idea! Format a string with no space for the output!\n")); 116 113 … … 119 116 Args.fOverflowed = false; 120 117 121 va_start(args, pszFormat);122 118 cchRet = RTStrFormatV(rtStrPrintf2Output, &Args, NULL, NULL, pszFormat, args); 123 va_end(args);124 119 125 120 return !Args.fOverflowed ? (ssize_t)cchRet : -(ssize_t)cchRet - 1; 121 } 122 RT_EXPORT_SYMBOL(RTStrPrintf2V); 123 124 125 126 RTDECL(ssize_t) RTStrPrintf2(char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...) 127 { 128 va_list va; 129 ssize_t cbRet; 130 va_start(va, pszFormat); 131 cbRet = RTStrPrintf2V(pszBuffer, cchBuffer, pszFormat, va); 132 va_end(va); 133 return cbRet; 126 134 } 127 135 RT_EXPORT_SYMBOL(RTStrPrintf2); … … 144 152 145 153 146 RTDECL(ssize_t) RTStrPrintf2V(char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args)147 {148 return RTStrPrintf2ExV(NULL, NULL, pszBuffer, cchBuffer, pszFormat, args);149 }150 RT_EXPORT_SYMBOL(RTStrPrintf2V);151 152 153 154 RTDECL(ssize_t) RTStrPrintf2Ex(PFNSTRFORMAT pfnFormat, void *pvArg, char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...) 154 155 {
Note:
See TracChangeset
for help on using the changeset viewer.