mirror of
https://github.com/bkaradzic/bx.git
synced 2026-10-30 04:25:47 +00:00
Removed use of size_t in string functions.
This commit is contained in:
+33
-33
@@ -27,10 +27,10 @@ namespace bx
|
||||
StringView& operator=(const StringView& _rhs);
|
||||
|
||||
///
|
||||
StringView(const char* _ptr, uint32_t _len = UINT16_MAX);
|
||||
StringView(const char* _ptr, int32_t _len = INT32_MAX);
|
||||
|
||||
///
|
||||
void set(const char* _ptr, uint32_t _len = UINT16_MAX);
|
||||
void set(const char* _ptr, int32_t _len = INT32_MAX);
|
||||
|
||||
///
|
||||
void clear();
|
||||
@@ -45,11 +45,11 @@ namespace bx
|
||||
bool isEmpty() const;
|
||||
|
||||
///
|
||||
uint32_t getLength() const;
|
||||
int32_t getLength() const;
|
||||
|
||||
protected:
|
||||
const char* m_ptr;
|
||||
uint32_t m_len;
|
||||
int32_t m_len;
|
||||
};
|
||||
|
||||
/// ASCII string
|
||||
@@ -67,7 +67,7 @@ namespace bx
|
||||
StringT<AllocatorT>& operator=(const StringT<AllocatorT>& _rhs);
|
||||
|
||||
///
|
||||
StringT(const char* _ptr, uint32_t _len = UINT32_MAX);
|
||||
StringT(const char* _ptr, int32_t _len = INT32_MAX);
|
||||
|
||||
///
|
||||
StringT(const StringView& _rhs);
|
||||
@@ -76,10 +76,10 @@ namespace bx
|
||||
~StringT();
|
||||
|
||||
///
|
||||
void set(const char* _ptr, uint32_t _len = UINT32_MAX);
|
||||
void set(const char* _ptr, int32_t _len = INT32_MAX);
|
||||
|
||||
///
|
||||
void append(const char* _ptr, uint32_t _len = UINT32_MAX);
|
||||
void append(const char* _ptr, int32_t _len = INT32_MAX);
|
||||
|
||||
///
|
||||
void clear();
|
||||
@@ -110,50 +110,50 @@ namespace bx
|
||||
char toLower(char _ch);
|
||||
|
||||
///
|
||||
void toLowerUnsafe(char* _inOutStr, size_t _len);
|
||||
void toLowerUnsafe(char* _inOutStr, int32_t _len);
|
||||
|
||||
///
|
||||
void toLower(char* _inOutStr, size_t _max = INT32_MAX);
|
||||
void toLower(char* _inOutStr, int32_t _max = INT32_MAX);
|
||||
|
||||
///
|
||||
char toUpper(char _ch);
|
||||
|
||||
///
|
||||
void toUpperUnsafe(char* _inOutStr, size_t _len);
|
||||
void toUpperUnsafe(char* _inOutStr, int32_t _len);
|
||||
|
||||
///
|
||||
void toUpper(char* _inOutStr, size_t _max = INT32_MAX);
|
||||
void toUpper(char* _inOutStr, int32_t _max = INT32_MAX);
|
||||
|
||||
///
|
||||
bool toBool(const char* _str);
|
||||
|
||||
/// String compare.
|
||||
int32_t strncmp(const char* _lhs, const char* _rhs, size_t _max = INT32_MAX);
|
||||
int32_t strncmp(const char* _lhs, const char* _rhs, int32_t _max = INT32_MAX);
|
||||
|
||||
/// Case insensitive string compare.
|
||||
int32_t strincmp(const char* _lhs, const char* _rhs, size_t _max = INT32_MAX);
|
||||
int32_t strincmp(const char* _lhs, const char* _rhs, int32_t _max = INT32_MAX);
|
||||
|
||||
///
|
||||
size_t strnlen(const char* _str, size_t _max = -1);
|
||||
int32_t strnlen(const char* _str, int32_t _max = INT32_MAX);
|
||||
|
||||
/// Copy _num characters from string _src to _dst buffer of maximum _dstSize capacity
|
||||
/// including zero terminator. Copy will be terminated with '\0'.
|
||||
size_t strlncpy(char* _dst, size_t _dstSize, const char* _src, size_t _num = INT32_MAX);
|
||||
int32_t strlncpy(char* _dst, int32_t _dstSize, const char* _src, int32_t _num = INT32_MAX);
|
||||
|
||||
///
|
||||
size_t strlncat(char* _dst, size_t _dstSize, const char* _src, size_t _num = INT32_MAX);
|
||||
int32_t strlncat(char* _dst, int32_t _dstSize, const char* _src, int32_t _num = INT32_MAX);
|
||||
|
||||
///
|
||||
const char* strnchr(const char* _str, char _ch, size_t _max = INT32_MAX);
|
||||
const char* strnchr(const char* _str, char _ch, int32_t _max = INT32_MAX);
|
||||
|
||||
///
|
||||
const char* strnrchr(const char* _str, char _ch, size_t _max = INT32_MAX);
|
||||
const char* strnrchr(const char* _str, char _ch, int32_t _max = INT32_MAX);
|
||||
|
||||
/// Find substring in string. Limit search to _size.
|
||||
const char* strnstr(const char* _str, const char* _find, size_t _max = INT32_MAX);
|
||||
const char* strnstr(const char* _str, const char* _find, int32_t _max = INT32_MAX);
|
||||
|
||||
/// Find substring in string. Case insensitive. Limit search to _max.
|
||||
const char* stristr(const char* _str, const char* _find, size_t _max = INT32_MAX);
|
||||
const char* stristr(const char* _str, const char* _find, int32_t _max = INT32_MAX);
|
||||
|
||||
/// Find new line. Returns pointer after new line terminator.
|
||||
const char* strnl(const char* _str);
|
||||
@@ -174,7 +174,7 @@ namespace bx
|
||||
const char* strmb(const char* _str, char _open, char _close);
|
||||
|
||||
// Normalize string to sane line endings.
|
||||
void eolLF(char* _out, size_t _size, const char* _str);
|
||||
void eolLF(char* _out, int32_t _size, const char* _str);
|
||||
|
||||
// Finds identifier.
|
||||
const char* findIdentifierMatch(const char* _str, const char* _word);
|
||||
@@ -185,18 +185,18 @@ namespace bx
|
||||
/// Cross platform implementation of vsnprintf that returns number of
|
||||
/// characters which would have been written to the final string if
|
||||
/// enough space had been available.
|
||||
int32_t vsnprintf(char* _out, size_t _max, const char* _format, va_list _argList);
|
||||
int32_t vsnprintf(char* _out, int32_t _max, const char* _format, va_list _argList);
|
||||
|
||||
/// Cross platform implementation of vsnwprintf that returns number of
|
||||
/// characters which would have been written to the final string if
|
||||
/// enough space had been available.
|
||||
int32_t vsnwprintf(wchar_t* _out, size_t _max, const wchar_t* _format, va_list _argList);
|
||||
int32_t vsnwprintf(wchar_t* _out, int32_t _max, const wchar_t* _format, va_list _argList);
|
||||
|
||||
///
|
||||
int32_t snprintf(char* _out, size_t _max, const char* _format, ...);
|
||||
int32_t snprintf(char* _out, int32_t _max, const char* _format, ...);
|
||||
|
||||
///
|
||||
int32_t swnprintf(wchar_t* _out, size_t _max, const wchar_t* _format, ...);
|
||||
int32_t swnprintf(wchar_t* _out, int32_t _max, const wchar_t* _format, ...);
|
||||
|
||||
///
|
||||
template <typename Ty>
|
||||
@@ -214,34 +214,34 @@ namespace bx
|
||||
const char* baseName(const char* _filePath);
|
||||
|
||||
/// Convert size in bytes to human readable string.
|
||||
void prettify(char* _out, size_t _count, uint64_t _size);
|
||||
void prettify(char* _out, int32_t _count, uint64_t _size);
|
||||
|
||||
/// Copy src to string dst of size siz. At most siz-1 characters
|
||||
/// will be copied. Always NUL terminates (unless siz == 0).
|
||||
/// Returns strlen(src); if retval >= siz, truncation occurred.
|
||||
size_t strlcpy(char* _dst, const char* _src, size_t _max);
|
||||
int32_t strlcpy(char* _dst, const char* _src, int32_t _max);
|
||||
|
||||
/// Appends src to string dst of size siz (unlike strncat, siz is the
|
||||
/// full size of dst, not space left). At most siz-1 characters
|
||||
/// will be copied. Always NUL terminates (unless siz <= strlen(dst)).
|
||||
/// Returns strlen(src) + MIN(siz, strlen(initial dst)).
|
||||
/// If retval >= siz, truncation occurred.
|
||||
size_t strlcat(char* _dst, const char* _src, size_t _max);
|
||||
int32_t strlcat(char* _dst, const char* _src, int32_t _max);
|
||||
|
||||
///
|
||||
int32_t toString(char* _out, size_t _max, double _value);
|
||||
int32_t toString(char* _out, int32_t _max, double _value);
|
||||
|
||||
///
|
||||
int32_t toString(char* _out, size_t _max, int32_t _value, uint32_t _base = 10);
|
||||
int32_t toString(char* _out, int32_t _max, int32_t _value, uint32_t _base = 10);
|
||||
|
||||
///
|
||||
int32_t toString(char* _out, size_t _max, int64_t _value, uint32_t _base = 10);
|
||||
int32_t toString(char* _out, int32_t _max, int64_t _value, uint32_t _base = 10);
|
||||
|
||||
///
|
||||
int32_t toString(char* _out, size_t _max, uint32_t _value, uint32_t _base = 10);
|
||||
int32_t toString(char* _out, int32_t _max, uint32_t _value, uint32_t _base = 10);
|
||||
|
||||
///
|
||||
int32_t toString(char* _out, size_t _max, uint64_t _value, uint32_t _base = 10);
|
||||
int32_t toString(char* _out, int32_t _max, uint64_t _value, uint32_t _base = 10);
|
||||
|
||||
} // namespace bx
|
||||
|
||||
|
||||
Reference in New Issue
Block a user