dep/fmt: Bump to v11.0.2

This commit is contained in:
Stenzek
2024-09-03 17:54:43 +10:00
parent 56dac5f52a
commit 6d0f92d4fb
62 changed files with 9585 additions and 11805 deletions
+21
View File
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
#include "error.h"
#include "small_string.h"
#include "string_util.h"
#include <cstdlib>
@@ -255,6 +256,26 @@ void Error::AddSuffix(std::string_view suffix)
m_description.append(suffix);
}
void Error::SetStringFmtArgs(fmt::string_view fmt, fmt::format_args args)
{
m_type = Type::User;
m_description = fmt::vformat(fmt, std::move(args));
}
void Error::AddPrefixFmtArgs(fmt::string_view fmt, fmt::format_args args)
{
SmallString str;
str.vformat(fmt, std::move(args));
AddPrefix(str.view());
}
void Error::AddSuffixFmtArgs(fmt::string_view fmt, fmt::format_args args)
{
SmallString str;
str.vformat(fmt, std::move(args));
AddSuffix(str.view());
}
void Error::AddPrefix(Error* errptr, std::string_view prefix)
{
if (errptr)
+33 -32
View File
@@ -3,10 +3,9 @@
#pragma once
#include "small_string.h"
#include "types.h"
#include "fmt/core.h"
#include "fmt/base.h"
#include <string>
#include <string_view>
@@ -84,54 +83,52 @@ public:
static void SetHResult(Error* errptr, std::string_view prefix, long err);
#endif
template<typename... T>
void SetStringFmt(fmt::format_string<T...> fmt, T&&... args)
{
SetStringFmtArgs(fmt, fmt::make_format_args(args...));
}
void AddPrefix(std::string_view prefix);
template<typename... T>
void AddPrefixFmt(fmt::format_string<T...> fmt, T&&... args)
{
AddPrefixFmtArgs(fmt, fmt::make_format_args(args...));
}
void AddSuffix(std::string_view suffix);
template<typename... T>
void AddSuffixFmt(fmt::format_string<T...> fmt, T&&... args)
{
AddSuffixFmtArgs(fmt, fmt::make_format_args(args...));
}
/// Sets a formatted message.
template<typename... T>
static void SetStringFmt(Error* errptr, fmt::format_string<T...> fmt, T&&... args)
{
if (errptr)
Error::SetString(errptr, fmt::vformat(fmt, fmt::make_format_args(args...)));
errptr->SetStringFmtArgs(fmt, fmt::make_format_args(args...));
}
void AddPrefix(std::string_view prefix);
void AddSuffix(std::string_view suffix);
static void AddPrefix(Error* errptr, std::string_view prefix);
static void AddSuffix(Error* errptr, std::string_view prefix);
template<typename... T>
void AddPrefixFmt(fmt::format_string<T...> fmt, T&&... args)
{
TinyString str;
fmt::vformat_to(std::back_inserter(str), fmt, fmt::make_format_args(args...));
AddPrefix(str.view());
}
template<typename... T>
void AddSuffixFmt(fmt::format_string<T...> fmt, T&&... args)
{
TinyString str;
fmt::vformat_to(std::back_inserter(str), fmt, fmt::make_format_args(args...));
AddSuffix(str.view());
}
template<typename... T>
static void AddPrefixFmt(Error* errptr, fmt::format_string<T...> fmt, T&&... args)
{
if (errptr)
{
TinyString str;
fmt::vformat_to(std::back_inserter(str), fmt, fmt::make_format_args(args...));
errptr->AddPrefix(str.view());
}
errptr->AddPrefixFmtArgs(fmt, fmt::make_format_args(args...));
}
static void AddSuffix(Error* errptr, std::string_view prefix);
template<typename... T>
static void AddSuffixFmt(Error* errptr, fmt::format_string<T...> fmt, T&&... args)
{
if (errptr)
{
TinyString str;
fmt::vformat_to(std::back_inserter(str), fmt, fmt::make_format_args(args...));
errptr->AddSuffix(str.view());
}
errptr->AddSuffixFmtArgs(fmt, fmt::make_format_args(args...));
}
Error& operator=(const Error& e);
@@ -140,6 +137,10 @@ public:
bool operator!=(const Error& e) const;
private:
void SetStringFmtArgs(fmt::string_view fmt, fmt::format_args args);
void AddPrefixFmtArgs(fmt::string_view fmt, fmt::format_args args);
void AddSuffixFmtArgs(fmt::string_view fmt, fmt::format_args args);
Type m_type = Type::None;
std::string m_description;
};
+2
View File
@@ -9,6 +9,8 @@
#include "string_util.h"
#include "timer.h"
#include "fmt/format.h"
#include <algorithm>
#include <cstdlib>
#include <cstring>
+1 -1
View File
@@ -5,7 +5,7 @@
#include "types.h"
#include "fmt/core.h"
#include "fmt/base.h"
#include <cinttypes>
#include <cstdarg>
+2 -1
View File
@@ -6,8 +6,9 @@
#include "small_string.h"
#include "types.h"
#include "fmt/core.h"
#include "fmt/base.h"
#include <memory>
#include <string>
class ProgressCallback
+5 -4
View File
@@ -5,11 +5,12 @@
#include "types.h"
#include "fmt/core.h"
#include "fmt/base.h"
#include <algorithm>
#include <cstdarg>
#include <cstring>
#include <iterator>
#include <limits>
#include <string>
#include <string_view>
@@ -184,7 +185,7 @@ public:
ALWAYS_INLINE const char& front() const { return m_buffer[0]; }
ALWAYS_INLINE char& back() { return m_buffer[m_length - 1]; }
ALWAYS_INLINE const char& back() const { return m_buffer[m_length - 1]; }
ALWAYS_INLINE void push_back(value_type&& val) { append(val); }
ALWAYS_INLINE void push_back(value_type val) { append(val); }
ALWAYS_INLINE void pop_back() { erase(-1); }
// returns a string view for this string
@@ -422,13 +423,13 @@ ALWAYS_INLINE void SmallStringBase::format(fmt::format_string<T...> fmt, T&&...
struct fmt::formatter<type> \
{ \
template<typename ParseContext> \
constexpr auto parse(ParseContext& ctx) \
constexpr auto parse(ParseContext& ctx) const \
{ \
return ctx.begin(); \
} \
\
template<typename FormatContext> \
auto format(const type& str, FormatContext& ctx) \
auto format(const type& str, FormatContext& ctx) const \
{ \
return fmt::format_to(ctx.out(), "{}", str.view()); \
} \
+1
View File
@@ -16,6 +16,7 @@
#include "IconsFontAwesome5.h"
#include "IconsPromptFont.h"
#include "fmt/format.h"
#include <cmath>
+1
View File
@@ -14,6 +14,7 @@
#include "IconsFontAwesome5.h"
#include "IconsPromptFont.h"
#include "fmt/format.h"
Log_SetChannel(AnalogJoystick);
+1
View File
@@ -25,6 +25,7 @@
#include "common/heap_array.h"
#include "common/log.h"
#include "fmt/format.h"
#include "imgui.h"
#include <cmath>
+2
View File
@@ -22,6 +22,8 @@
#include "common/file_system.h"
#include "common/log.h"
#include "fmt/format.h"
#include <cstdio>
Log_SetChannel(CPU::Core);
+1
View File
@@ -29,6 +29,7 @@
#include "IconsEmoji.h"
#include "IconsFontAwesome5.h"
#include "fmt/format.h"
Log_SetChannel(GameDatabase);
+2
View File
@@ -25,6 +25,8 @@
#include "common/string_util.h"
#include "common/timer.h"
#include "fmt/format.h"
#include <algorithm>
#include <array>
#include <ctime>
+1 -1
View File
@@ -22,7 +22,7 @@
#include "common/path.h"
#include "common/string_util.h"
#include "imgui.h"
#include "fmt/format.h"
#include <cstdarg>
#include <limits>
+1
View File
@@ -24,6 +24,7 @@
#include "IconsFontAwesome5.h"
#include "IconsEmoji.h"
#include "fmt/format.h"
#include <cmath>
+1
View File
@@ -16,6 +16,7 @@
#include "common/string_util.h"
#include "IconsFontAwesome5.h"
#include "fmt/format.h"
Log_SetChannel(MemoryCard);
+1
View File
@@ -19,6 +19,7 @@
#include "IconsFontAwesome5.h"
#include "IconsPromptFont.h"
#include "fmt/format.h"
#include <cmath>
+1
View File
@@ -20,6 +20,7 @@
#include "common/log.h"
#include "IconsFontAwesome5.h"
#include "fmt/format.h"
#include <array>
#include <memory>
+2
View File
@@ -18,6 +18,8 @@
#include "common/path.h"
#include "common/string_util.h"
#include "fmt/format.h"
#include <algorithm>
#include <array>
#include <cctype>
+2
View File
@@ -23,6 +23,8 @@
#include "common/log.h"
#include "common/path.h"
#include "fmt/format.h"
#include <memory>
Log_SetChannel(SPU);
+2
View File
@@ -19,6 +19,8 @@
#include "common/path.h"
#include "common/string_util.h"
#include "fmt/format.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QFile>
#include <QtCore/QJsonArray>
@@ -26,6 +26,8 @@
#include "common/log.h"
#include "common/string_util.h"
#include "fmt/format.h"
#include <QtWidgets/QCheckBox>
#include <QtWidgets/QDoubleSpinBox>
#include <QtWidgets/QInputDialog>
@@ -7,6 +7,8 @@
#include "qtutils.h"
#include "settingwidgetbinder.h"
#include "fmt/format.h"
#include "util/sdl_input_source.h"
ControllerGlobalSettingsWidget::ControllerGlobalSettingsWidget(QWidget* parent, ControllerSettingsWindow* dialog)
@@ -148,7 +150,7 @@ ControllerLEDSettingsDialog::~ControllerLEDSettingsDialog() = default;
void ControllerLEDSettingsDialog::linkButton(ColorPickerButton* button, u32 player_id)
{
std::string key(fmt::format("Player{}LED", player_id));
std::string key = fmt::format("Player{}LED", player_id);
const u32 current_value =
SDLInputSource::ParseRGBForPlayerId(m_dialog->getStringValue("SDLExtra", key.c_str(), ""), player_id);
button->setColor(current_value);
@@ -9,6 +9,8 @@
#include "common/bitutils.h"
#include "fmt/format.h"
#include <QtCore/QTimer>
#include <QtGui/QKeyEvent>
#include <QtGui/QMouseEvent>
@@ -15,6 +15,8 @@
#include "common/small_string.h"
#include "common/string_util.h"
#include "fmt/format.h"
#include <QtCore/QUrl>
#include <QtWidgets/QFileDialog>
#include <QtWidgets/QLabel>
@@ -14,6 +14,8 @@
#include "common/assert.h"
#include "common/string_util.h"
#include "fmt/format.h"
#include <QtCore/QFileInfo>
#include <QtGui/QColor>
#include <QtWidgets/QFileDialog>
+4 -4
View File
@@ -11,6 +11,7 @@
#include "setupwizarddialog.h"
#include "core/achievements.h"
#include "core/bus.h"
#include "core/cheats.h"
#include "core/controller.h"
#include "core/fullscreen_ui.h"
@@ -45,8 +46,7 @@
#include "scmversion/scmversion.h"
#include "core/bus.h"
#include "imgui.h"
#include "fmt/format.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QDateTime>
@@ -1495,7 +1495,7 @@ void EmuThread::startDumpingAudio()
return;
}
//System::StartDumpingAudio();
// System::StartDumpingAudio();
}
void EmuThread::stopDumpingAudio()
@@ -1506,7 +1506,7 @@ void EmuThread::stopDumpingAudio()
return;
}
//System::StopDumpingAudio();
// System::StopDumpingAudio();
}
void EmuThread::singleStepCPU()
+2
View File
@@ -15,6 +15,8 @@
#include "common/file_system.h"
#include "fmt/format.h"
#include <QtWidgets/QMessageBox>
SetupWizardDialog::SetupWizardDialog()
+2
View File
@@ -28,6 +28,8 @@
#include "common/string_util.h"
#include "common/timer.h"
#include "fmt/format.h"
#include <csignal>
#include <cstdio>
+1 -1
View File
@@ -130,7 +130,7 @@ std::unique_ptr<CDImage> CDImage::Open(const char* filename, bool allow_patches,
{
image = CDImage::OverlayPPFPatch(ppf_filename.c_str(), std::move(image));
if (!image)
Error::SetString(error, fmt::format("Failed to apply ppf patch from '{}'.", ppf_filename));
Error::SetStringFmt(error, "Failed to apply ppf patch from '{}'.", ppf_filename);
}
}
+3 -1
View File
@@ -14,6 +14,8 @@
#include "common/small_string.h"
#include "common/string_util.h"
#include "fmt/format.h"
#include <algorithm>
#include <cerrno>
#include <cinttypes>
@@ -383,7 +385,7 @@ bool CDImageDeviceWin32::Open(const char* filename, Error* error)
if (m_tracks.empty())
{
ERROR_LOG("File '{}' contains no tracks", filename);
Error::SetString(error, fmt::format("File '{}' contains no tracks", filename));
Error::SetStringFmt(error, "File '{}' contains no tracks", filename);
return false;
}
+3 -2
View File
@@ -3,12 +3,13 @@
#include "cd_image_hasher.h"
#include "cd_image.h"
#include "util/host.h"
#include "host.h"
#include "common/md5_digest.h"
#include "common/string_util.h"
#include "fmt/format.h"
namespace CDImageHasher {
static bool ReadIndex(CDImage* image, u8 track, u8 index, MD5Digest* digest, ProgressCallback* progress_callback);
+2 -1
View File
@@ -11,6 +11,7 @@
#include "common/path.h"
#include "common/string_util.h"
#include "fmt/format.h"
#include "zlib.h"
#include <array>
@@ -509,7 +510,7 @@ bool CDImagePBP::OpenDisc(u32 index, Error* error)
if (index >= m_disc_offsets.size())
{
ERROR_LOG("File does not contain disc {}", index + 1);
Error::SetString(error, fmt::format("File does not contain disc {}", index + 1));
Error::SetStringFmt(error, "File does not contain disc {}", index + 1);
return false;
}
+1 -1
View File
@@ -80,7 +80,7 @@ void CueParser::File::SetError(u32 line_number, Error* error, const char* format
va_end(ap);
ERROR_LOG("Cue parse error at line {}: {}", line_number, str.c_str());
Error::SetString(error, fmt::format("Cue parse error at line {}: {}", line_number, str));
Error::SetStringFmt(error, "Cue parse error at line {}: {}", line_number, str);
}
std::string_view CueParser::File::GetToken(const char*& line)
+3
View File
@@ -2,8 +2,11 @@
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
#include "input_source.h"
#include "common/string_util.h"
#include "fmt/format.h"
InputSource::InputSource() = default;
InputSource::~InputSource() = default;
+1 -2
View File
@@ -5,8 +5,7 @@
#include "common/types.h"
#include "fmt/core.h"
#include "fmt/format.h"
#include "fmt/base.h"
#include <array>
#include <atomic>
+1
View File
@@ -15,6 +15,7 @@
#include "common/string_util.h"
#include "IconsPromptFont.h"
#include "fmt/format.h"
#include <cmath>
+4 -3
View File
@@ -2,12 +2,13 @@
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
#include "win32_raw_input_source.h"
#include "input_manager.h"
#include "common/assert.h"
#include "common/log.h"
#include "common/string_util.h"
#include "core/host.h"
#include "core/system.h"
#include "input_manager.h"
#include "fmt/format.h"
#include <cmath>
#include <hidsdi.h>
+1
View File
@@ -9,6 +9,7 @@
#include "common/string_util.h"
#include "IconsPromptFont.h"
#include "fmt/format.h"
#include <cmath>