diff options
Diffstat (limited to 'src/lib/util/corestr.cpp')
-rw-r--r-- | src/lib/util/corestr.cpp | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/src/lib/util/corestr.cpp b/src/lib/util/corestr.cpp index ce5976869d4..7daad5cc0cb 100644 --- a/src/lib/util/corestr.cpp +++ b/src/lib/util/corestr.cpp @@ -126,107 +126,11 @@ char *core_strdup(const char *str) /*------------------------------------------------- - core_i64_hex_format - i64 format printf helper --------------------------------------------------*/ - -char *core_i64_hex_format(UINT64 value, UINT8 mindigits) -{ - static char buffer[16][64]; - // TODO: this can overflow - e.g. when a lot of unmapped writes are logged - static int index; - char *bufbase = &buffer[index++ % 16][0]; - char *bufptr = bufbase; - INT8 curdigit; - - for (curdigit = 15; curdigit >= 0; curdigit--) - { - int nibble = (value >> (curdigit * 4)) & 0xf; - if (nibble != 0 || curdigit < mindigits) - { - mindigits = curdigit; - *bufptr++ = "0123456789ABCDEF"[nibble]; - } - } - if (bufptr == bufbase) - *bufptr++ = '0'; - *bufptr = 0; - - return bufbase; -} - -/*------------------------------------------------- - core_i64_oct_format - i64 format printf helper --------------------------------------------------*/ - -char *core_i64_oct_format(UINT64 value, UINT8 mindigits) -{ - static char buffer[22][64]; - // TODO: this can overflow - static int index; - char *bufbase = &buffer[index++ % 22][0]; - char *bufptr = bufbase; - INT8 curdigit; - - for (curdigit = 21; curdigit >= 0; curdigit--) - { - int octdigit = (value >> (curdigit * 3)) & 0x7; - if (octdigit != 0 || curdigit < mindigits) - { - mindigits = curdigit; - *bufptr++ = "01234567"[octdigit]; - } - } - if (bufptr == bufbase) - *bufptr++ = '0'; - *bufptr = 0; - - return bufbase; -} - -/*------------------------------------------------- - core_i64_format - i64 format printf helper --------------------------------------------------*/ - -char *core_i64_format(UINT64 value, UINT8 mindigits, bool is_octal) -{ - return is_octal ? core_i64_oct_format(value,mindigits) : core_i64_hex_format(value,mindigits); -} - -/*------------------------------------------------- std::string helpers -------------------------------------------------*/ #include <algorithm> -int strvprintf(std::string &str, const char *format, va_list args) -{ - char tempbuf[4096]; - int result = vsprintf(tempbuf, format, args); - - // set the result - str.assign(tempbuf); - return result; -} - -int strprintf(std::string &str, const char *format, ...) -{ - va_list ap; - va_start(ap, format); - int retVal = strvprintf(str, format, ap); - va_end(ap); - return retVal; -} - -std::string strformat(const char *format, ...) -{ - std::string retVal; - va_list ap; - va_start(ap, format); - strvprintf(retVal, format, ap); - va_end(ap); - return retVal; -} - int strcatvprintf(std::string &str, const char *format, va_list args) { char tempbuf[4096]; @@ -237,15 +141,6 @@ int strcatvprintf(std::string &str, const char *format, va_list args) return result; } -int strcatprintf(std::string &str, const char *format, ...) -{ - va_list ap; - va_start(ap, format); - int retVal = strcatvprintf(str, format, ap); - va_end(ap); - return retVal; -} - void strdelchr(std::string& str, char chr) { for (size_t i = 0; i < str.length(); i++) |