Misc: More format string fixes

This commit is contained in:
Stenzek
2024-05-25 15:45:17 +10:00
parent a75e61e1d6
commit 1565a2667d
17 changed files with 33 additions and 32 deletions

View File

@ -561,7 +561,7 @@ ALWAYS_INLINE_RELEASE bool CDImageCHD::UpdateHunkBuffer(const Index& index, LBA
const chd_error err = chd_read(m_chd, hunk_index, m_hunk_buffer.data());
if (err != CHDERR_NONE)
{
ERROR_LOG("chd_read({}) failed: %s", hunk_index, chd_error_string(err));
ERROR_LOG("chd_read({}) failed: {}", hunk_index, chd_error_string(err));
// data might have been partially written
m_current_hunk_index = static_cast<u32>(-1);

View File

@ -475,7 +475,7 @@ bool CDImagePBP::Open(const char* filename, Error* error)
// Ignore encrypted files
if (disc_table[0] == 0x44475000) // "\0PGD"
{
ERROR_LOG("Encrypted PBP images are not supported, skipping %s", m_filename);
ERROR_LOG("Encrypted PBP images are not supported, skipping {}", m_filename);
Error::SetString(error, "Encrypted PBP images are not supported");
return false;
}

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2019-2023 Connor McLaughlin <stenzek@gmail.com>
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
#include "cd_image.h"
@ -7,6 +7,7 @@
#include "common/assert.h"
#include "common/file_system.h"
#include "common/log.h"
#include "common/path.h"
#include <algorithm>
#include <cerrno>
@ -69,7 +70,7 @@ bool CDImagePPF::Open(const char* filename, std::unique_ptr<CDImage> parent_imag
auto fp = FileSystem::OpenManagedSharedCFile(filename, "rb", FileSystem::FileShareMode::DenyWrite);
if (!fp)
{
ERROR_LOG("Failed to open '%s'", filename);
ERROR_LOG("Failed to open '{}'", Path::GetFileName(filename));
return false;
}
@ -78,7 +79,7 @@ bool CDImagePPF::Open(const char* filename, std::unique_ptr<CDImage> parent_imag
u32 magic;
if (std::fread(&magic, sizeof(magic), 1, fp.get()) != 1)
{
ERROR_LOG("Failed to read magic from '%s'", filename);
ERROR_LOG("Failed to read magic from '{}'", Path::GetFileName(filename));
return false;
}
@ -140,7 +141,7 @@ u32 CDImagePPF::ReadFileIDDiz(std::FILE* fp, u32 version)
return 0;
}
INFO_LOG("File_Id.diz: %s", fdiz);
INFO_LOG("File_Id.diz: {}", fdiz);
return dlen;
}
@ -206,7 +207,7 @@ bool CDImagePPF::ReadV2Patch(std::FILE* fp)
return false;
}
INFO_LOG("Patch description: %s", desc);
INFO_LOG("Patch description: {}", desc);
const u32 idlen = ReadFileIDDiz(fp, 2);

View File

@ -126,7 +126,7 @@ bool D3D11Device::CreateDevice(std::string_view adapter, bool threaded_presentat
ComPtr<IDXGIDevice> dxgi_device;
if (SUCCEEDED(m_device.As(&dxgi_device)) &&
SUCCEEDED(dxgi_device->GetParent(IID_PPV_ARGS(dxgi_adapter.GetAddressOf()))))
INFO_LOG("D3D Adapter: %s", D3DCommon::GetAdapterName(dxgi_adapter.Get()));
INFO_LOG("D3D Adapter: {}", D3DCommon::GetAdapterName(dxgi_adapter.Get()));
else
ERROR_LOG("Failed to obtain D3D adapter name.");
INFO_LOG("Max device feature level: {}", D3DCommon::GetFeatureLevelString(m_max_feature_level));

View File

@ -104,7 +104,7 @@ bool JitCodeBuffer::TryAllocateAt(const void* addr)
if (!m_code_ptr)
{
if (!addr)
ERROR_LOG("VirtualAlloc(RWX, %u) for internal buffer failed: {}", m_total_size, GetLastError());
ERROR_LOG("VirtualAlloc(RWX, {}) for internal buffer failed: {}", m_total_size, GetLastError());
return false;
}
@ -134,7 +134,7 @@ bool JitCodeBuffer::TryAllocateAt(const void* addr)
if (!m_code_ptr)
{
if (!addr)
ERROR_LOG("mmap(RWX, %u) for internal buffer failed: {}", m_total_size, errno);
ERROR_LOG("mmap(RWX, {}) for internal buffer failed: {}", m_total_size, errno);
return false;
}
@ -229,10 +229,10 @@ void JitCodeBuffer::Destroy()
{
#if defined(_WIN32)
if (!VirtualFree(m_code_ptr, 0, MEM_RELEASE))
ERROR_LOG("Failed to free code pointer %p", static_cast<void*>(m_code_ptr));
ERROR_LOG("Failed to free code pointer {}", static_cast<void*>(m_code_ptr));
#elif defined(__linux__) || defined(__ANDROID__) || defined(__APPLE__) || defined(__HAIKU__) || defined(__FreeBSD__)
if (munmap(m_code_ptr, m_total_size) != 0)
ERROR_LOG("Failed to free code pointer %p", static_cast<void*>(m_code_ptr));
ERROR_LOG("Failed to free code pointer {}", static_cast<void*>(m_code_ptr));
#endif
}
else if (m_code_ptr)
@ -240,10 +240,10 @@ void JitCodeBuffer::Destroy()
#if defined(_WIN32)
DWORD old_protect = 0;
if (!VirtualProtect(m_code_ptr, m_total_size, m_old_protection, &old_protect))
ERROR_LOG("Failed to restore protection on %p", static_cast<void*>(m_code_ptr));
ERROR_LOG("Failed to restore protection on {}", static_cast<void*>(m_code_ptr));
#else
if (mprotect(m_code_ptr, m_total_size, m_old_protection) != 0)
ERROR_LOG("Failed to restore protection on %p", static_cast<void*>(m_code_ptr));
ERROR_LOG("Failed to restore protection on {}", static_cast<void*>(m_code_ptr));
#endif
}

View File

@ -91,7 +91,7 @@ void PostProcessing::Shader::LoadOptions(const SettingsInterface& si, const char
ShaderOption::ParseFloatVector(config_value, &value);
if (value_vector_size != option.vector_size)
{
WARNING_LOG("Only got {} of {} elements for '{}' in config section %s.", value_vector_size,
WARNING_LOG("Only got {} of {} elements for '{}' in config section {}.", value_vector_size,
option.vector_size, option.name, section);
}
}

View File

@ -104,7 +104,7 @@ bool Vulkan::LoadVulkanInstanceFunctions(VkInstance instance)
*func_ptr = vkGetInstanceProcAddr(instance, name);
if (!(*func_ptr) && is_required)
{
std::fprintf(stderr, "Vulkan: Failed to load required instance function %s\n", name);
ERROR_LOG("Vulkan: Failed to load required instance function {}", name);
required_functions_missing = true;
}
};
@ -124,7 +124,7 @@ bool Vulkan::LoadVulkanDeviceFunctions(VkDevice device)
*func_ptr = vkGetDeviceProcAddr(device, name);
if (!(*func_ptr) && is_required)
{
std::fprintf(stderr, "Vulkan: Failed to load required device function %s\n", name);
ERROR_LOG("Vulkan: Failed to load required device function {}", name);
required_functions_missing = true;
}
};