mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-21 03:45:39 -04:00
SmallString: fmt -> format, format -> sprintf
This commit is contained in:
@ -18,7 +18,7 @@ void ProgressCallback::SetFormattedStatusText(const char* Format, ...)
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, Format);
|
||||
str.format_va(Format, ap);
|
||||
str.vsprintf(Format, ap);
|
||||
va_end(ap);
|
||||
|
||||
SetStatusText(str);
|
||||
@ -30,7 +30,7 @@ void ProgressCallback::DisplayFormattedError(const char* format, ...)
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
str.format_va(format, ap);
|
||||
str.vsprintf(format, ap);
|
||||
va_end(ap);
|
||||
|
||||
DisplayError(str);
|
||||
@ -42,7 +42,7 @@ void ProgressCallback::DisplayFormattedWarning(const char* format, ...)
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
str.format_va(format, ap);
|
||||
str.vsprintf(format, ap);
|
||||
va_end(ap);
|
||||
|
||||
DisplayWarning(str);
|
||||
@ -54,7 +54,7 @@ void ProgressCallback::DisplayFormattedInformation(const char* format, ...)
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
str.format_va(format, ap);
|
||||
str.vsprintf(format, ap);
|
||||
va_end(ap);
|
||||
|
||||
DisplayInformation(str);
|
||||
@ -66,7 +66,7 @@ void ProgressCallback::DisplayFormattedDebugMessage(const char* format, ...)
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
str.format_va(format, ap);
|
||||
str.vsprintf(format, ap);
|
||||
va_end(ap);
|
||||
|
||||
DisplayDebugMessage(str);
|
||||
@ -78,7 +78,7 @@ void ProgressCallback::DisplayFormattedModalError(const char* format, ...)
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
str.format_va(format, ap);
|
||||
str.vsprintf(format, ap);
|
||||
va_end(ap);
|
||||
|
||||
ModalError(str);
|
||||
@ -90,7 +90,7 @@ bool ProgressCallback::DisplayFormattedModalConfirmation(const char* format, ...
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
str.format_va(format, ap);
|
||||
str.vsprintf(format, ap);
|
||||
va_end(ap);
|
||||
|
||||
return ModalConfirmation(str);
|
||||
@ -102,7 +102,7 @@ void ProgressCallback::DisplayFormattedModalInformation(const char* format, ...)
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
str.format_va(format, ap);
|
||||
str.vsprintf(format, ap);
|
||||
va_end(ap);
|
||||
|
||||
ModalInformation(str);
|
||||
@ -341,7 +341,7 @@ void ConsoleProgressCallback::Redraw(bool update_value_only)
|
||||
|
||||
SmallString message;
|
||||
message.append(m_status_text);
|
||||
message.append_fmt(" [{:.2f}%]", percent_complete);
|
||||
message.append_format(" [{:.2f}%]", percent_complete);
|
||||
|
||||
if (max_bar_length > 0)
|
||||
{
|
||||
|
@ -179,9 +179,9 @@ void SmallStringBase::append_hex(const void* data, size_t len)
|
||||
|
||||
make_room_for(static_cast<u32>(len) * 4);
|
||||
const u8* bytes = static_cast<const u8*>(data);
|
||||
append_fmt("{:02X}", bytes[0]);
|
||||
append_format("{:02X}", bytes[0]);
|
||||
for (size_t i = 1; i < len; i++)
|
||||
append_fmt(", {:02X}", bytes[i]);
|
||||
append_format(", {:02X}", bytes[i]);
|
||||
}
|
||||
|
||||
void SmallStringBase::prepend(const char* str, u32 length)
|
||||
@ -224,15 +224,15 @@ void SmallStringBase::append(const std::string_view& str)
|
||||
append(str.data(), static_cast<u32>(str.length()));
|
||||
}
|
||||
|
||||
void SmallStringBase::append_format(const char* format, ...)
|
||||
void SmallStringBase::append_sprintf(const char* format, ...)
|
||||
{
|
||||
std::va_list ap;
|
||||
va_start(ap, format);
|
||||
append_format_va(format, ap);
|
||||
append_vsprintf(format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void SmallStringBase::append_format_va(const char* format, va_list ap)
|
||||
void SmallStringBase::append_vsprintf(const char* format, va_list ap)
|
||||
{
|
||||
// We have a 1KB byte buffer on the stack here. If this is too little, we'll grow it via the heap,
|
||||
// but 1KB should be enough for most strings.
|
||||
@ -290,15 +290,15 @@ void SmallStringBase::prepend(const std::string_view& str)
|
||||
prepend(str.data(), static_cast<u32>(str.length()));
|
||||
}
|
||||
|
||||
void SmallStringBase::prepend_format(const char* format, ...)
|
||||
void SmallStringBase::prepend_sprintf(const char* format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
prepend_format_va(format, ap);
|
||||
prepend_vsprintf(format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void SmallStringBase::prepend_format_va(const char* format, va_list ArgPtr)
|
||||
void SmallStringBase::prepend_vsprintf(const char* format, va_list ArgPtr)
|
||||
{
|
||||
// We have a 1KB byte buffer on the stack here. If this is too little, we'll grow it via the heap,
|
||||
// but 1KB should be enough for most strings.
|
||||
@ -376,18 +376,18 @@ void SmallStringBase::insert(s32 offset, const std::string_view& str)
|
||||
insert(offset, str.data(), static_cast<u32>(str.size()));
|
||||
}
|
||||
|
||||
void SmallStringBase::format(const char* format, ...)
|
||||
void SmallStringBase::sprintf(const char* format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
format_va(format, ap);
|
||||
vsprintf(format, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void SmallStringBase::format_va(const char* format, va_list ap)
|
||||
void SmallStringBase::vsprintf(const char* format, va_list ap)
|
||||
{
|
||||
clear();
|
||||
append_format_va(format, ap);
|
||||
append_vsprintf(format, ap);
|
||||
}
|
||||
|
||||
void SmallStringBase::assign(const SmallStringBase& copy)
|
||||
|
@ -58,11 +58,11 @@ public:
|
||||
void append(const SmallStringBase& str);
|
||||
|
||||
// append formatted string to this string
|
||||
void append_format(const char* format, ...) printflike(2, 3);
|
||||
void append_format_va(const char* format, va_list ap);
|
||||
void append_sprintf(const char* format, ...) printflike(2, 3);
|
||||
void append_vsprintf(const char* format, va_list ap);
|
||||
|
||||
template<typename... T>
|
||||
void append_fmt(fmt::format_string<T...> fmt, T&&... args);
|
||||
void append_format(fmt::format_string<T...> fmt, T&&... args);
|
||||
|
||||
// append hex string
|
||||
void append_hex(const void* data, size_t len);
|
||||
@ -78,11 +78,11 @@ public:
|
||||
void prepend(const SmallStringBase& str);
|
||||
|
||||
// append formatted string to this string
|
||||
void prepend_format(const char* format, ...) printflike(2, 3);
|
||||
void prepend_format_va(const char* format, va_list ap);
|
||||
void prepend_sprintf(const char* format, ...) printflike(2, 3);
|
||||
void prepend_vsprintf(const char* format, va_list ap);
|
||||
|
||||
template<typename... T>
|
||||
void prepend_fmt(fmt::format_string<T...> fmt, T&&... args);
|
||||
void prepend_format(fmt::format_string<T...> fmt, T&&... args);
|
||||
|
||||
// insert a string at the specified offset
|
||||
void insert(s32 offset, const char* str);
|
||||
@ -92,11 +92,11 @@ public:
|
||||
void insert(s32 offset, const SmallStringBase& str);
|
||||
|
||||
// set to formatted string
|
||||
void format(const char* format, ...) printflike(2, 3);
|
||||
void format_va(const char* format, va_list ap);
|
||||
void sprintf(const char* format, ...) printflike(2, 3);
|
||||
void vsprintf(const char* format, va_list ap);
|
||||
|
||||
template<typename... T>
|
||||
void fmt(fmt::format_string<T...> fmt, T&&... args);
|
||||
void format(fmt::format_string<T...> fmt, T&&... args);
|
||||
|
||||
// compare one string to another
|
||||
bool equals(const char* str) const;
|
||||
@ -298,10 +298,10 @@ public:
|
||||
}
|
||||
|
||||
// Override the fromstring method
|
||||
static SmallStackString from_format(const char* format, ...) printflike(1, 2);
|
||||
static SmallStackString from_sprintf(const char* format, ...) printflike(1, 2);
|
||||
|
||||
template<typename... T>
|
||||
static SmallStackString from_fmt(fmt::format_string<T...> fmt, T&&... args);
|
||||
static SmallStackString from_format(fmt::format_string<T...> fmt, T&&... args);
|
||||
|
||||
private:
|
||||
char m_stack_buffer[L + 1];
|
||||
@ -325,13 +325,13 @@ private:
|
||||
#endif
|
||||
|
||||
template<u32 L>
|
||||
ALWAYS_INLINE SmallStackString<L> SmallStackString<L>::from_format(const char* format, ...)
|
||||
ALWAYS_INLINE SmallStackString<L> SmallStackString<L>::from_sprintf(const char* format, ...)
|
||||
{
|
||||
std::va_list ap;
|
||||
va_start(ap, format);
|
||||
|
||||
SmallStackString ret;
|
||||
ret.format_va(format, ap);
|
||||
ret.vsprintf(format, ap);
|
||||
|
||||
va_end(ap);
|
||||
|
||||
@ -340,7 +340,7 @@ ALWAYS_INLINE SmallStackString<L> SmallStackString<L>::from_format(const char* f
|
||||
|
||||
template<u32 L>
|
||||
template<typename... T>
|
||||
ALWAYS_INLINE SmallStackString<L> SmallStackString<L>::from_fmt(fmt::format_string<T...> fmt, T&&... args)
|
||||
ALWAYS_INLINE SmallStackString<L> SmallStackString<L>::from_format(fmt::format_string<T...> fmt, T&&... args)
|
||||
{
|
||||
SmallStackString<L> ret;
|
||||
fmt::vformat_to(std::back_inserter(ret), fmt, fmt::make_format_args(args...));
|
||||
@ -353,13 +353,13 @@ using SmallString = SmallStackString<256>;
|
||||
using LargeString = SmallStackString<512>;
|
||||
|
||||
template<typename... T>
|
||||
ALWAYS_INLINE void SmallStringBase::append_fmt(fmt::format_string<T...> fmt, T&&... args)
|
||||
ALWAYS_INLINE void SmallStringBase::append_format(fmt::format_string<T...> fmt, T&&... args)
|
||||
{
|
||||
fmt::vformat_to(std::back_inserter(*this), fmt, fmt::make_format_args(args...));
|
||||
}
|
||||
|
||||
template<typename... T>
|
||||
ALWAYS_INLINE void SmallStringBase::prepend_fmt(fmt::format_string<T...> fmt, T&&... args)
|
||||
ALWAYS_INLINE void SmallStringBase::prepend_format(fmt::format_string<T...> fmt, T&&... args)
|
||||
{
|
||||
TinyString str;
|
||||
fmt::vformat_to(std::back_inserter(str), fmt, fmt::make_format_args(args...));
|
||||
@ -367,7 +367,7 @@ ALWAYS_INLINE void SmallStringBase::prepend_fmt(fmt::format_string<T...> fmt, T&
|
||||
}
|
||||
|
||||
template<typename... T>
|
||||
ALWAYS_INLINE void SmallStringBase::fmt(fmt::format_string<T...> fmt, T&&... args)
|
||||
ALWAYS_INLINE void SmallStringBase::format(fmt::format_string<T...> fmt, T&&... args)
|
||||
{
|
||||
clear();
|
||||
fmt::vformat_to(std::back_inserter(*this), fmt, fmt::make_format_args(args...));
|
||||
|
Reference in New Issue
Block a user