util/StringBuffer: use std::size_t instead of size_t

This commit is contained in:
Max Kellermann 2019-12-16 22:51:23 +01:00
parent 2b301ffd2c
commit 2e8f42c6ad
2 changed files with 6 additions and 6 deletions

View File

@ -35,14 +35,14 @@
/** /**
* A statically allocated string buffer. * A statically allocated string buffer.
*/ */
template<typename T, size_t CAPACITY> template<typename T, std::size_t CAPACITY>
class BasicStringBuffer { class BasicStringBuffer {
public: public:
typedef T value_type; typedef T value_type;
typedef T &reference; typedef T &reference;
typedef T *pointer; typedef T *pointer;
typedef const T *const_pointer; typedef const T *const_pointer;
typedef size_t size_type; typedef std::size_t size_type;
static constexpr value_type SENTINEL = '\0'; static constexpr value_type SENTINEL = '\0';
@ -104,7 +104,7 @@ public:
} }
}; };
template<size_t CAPACITY> template<std::size_t CAPACITY>
class StringBuffer : public BasicStringBuffer<char, CAPACITY> {}; class StringBuffer : public BasicStringBuffer<char, CAPACITY> {};
#endif #endif

View File

@ -36,13 +36,13 @@
template<typename... Args> template<typename... Args>
static inline void static inline void
StringFormat(char *buffer, size_t size, StringFormat(char *buffer, std::size_t size,
const char *fmt, Args&&... args) noexcept const char *fmt, Args&&... args) noexcept
{ {
snprintf(buffer, size, fmt, args...); snprintf(buffer, size, fmt, args...);
} }
template<size_t CAPACITY, typename... Args> template<std::size_t CAPACITY, typename... Args>
static inline void static inline void
StringFormat(StringBuffer<CAPACITY> &buffer, StringFormat(StringBuffer<CAPACITY> &buffer,
const char *fmt, Args&&... args) noexcept const char *fmt, Args&&... args) noexcept
@ -50,7 +50,7 @@ StringFormat(StringBuffer<CAPACITY> &buffer,
StringFormat(buffer.data(), buffer.capacity(), fmt, args...); StringFormat(buffer.data(), buffer.capacity(), fmt, args...);
} }
template<size_t CAPACITY, typename... Args> template<std::size_t CAPACITY, typename... Args>
static inline StringBuffer<CAPACITY> static inline StringBuffer<CAPACITY>
StringFormat(const char *fmt, Args&&... args) noexcept StringFormat(const char *fmt, Args&&... args) noexcept
{ {