Merge pull request #2288 from ergo720/clang
Fixed some code errors detected by clang
This commit is contained in:
commit
ac5289d83a
|
@ -328,11 +328,11 @@ PopupReturn PopupCustomEx(const void* hwnd, const CXBXR_MODULE cxbxr_module, con
|
|||
va_list argp;
|
||||
va_start(argp, message);
|
||||
// allocate predicted buffer size then write to buffer afterward.
|
||||
std::vector<char> Buffer(1+std::vsnprintf(nullptr, 0, message, argp));
|
||||
std::string Buffer(1+std::vsnprintf(nullptr, 0, message, argp), '\0');
|
||||
vsnprintf(Buffer.data(), Buffer.size(), message, argp);
|
||||
va_end(argp);
|
||||
|
||||
EmuLogOutputEx(cxbxr_module, level, "Popup : %s", Buffer);
|
||||
EmuLogOutputEx(cxbxr_module, level, "Popup : %s", Buffer.c_str());
|
||||
|
||||
// If user is using exclusive fullscreen, we need to refrain all popups.
|
||||
if (g_disablePopupMessages) {
|
||||
|
|
|
@ -293,8 +293,8 @@ constexpr const char* remove_prefix(const char* str, const char *prefix) {
|
|||
return (str_skip_prefix(str, prefix) == str + str_length(prefix)) ? str_skip_prefix(str, prefix) : str;
|
||||
}
|
||||
|
||||
static const char* xbox_prefix = "xbox::";
|
||||
static const char* emupatch_prefix = "EmuPatch_"; // See #define EMUPATCH
|
||||
static constexpr const char* xbox_prefix = "xbox::";
|
||||
static constexpr const char* emupatch_prefix = "EmuPatch_"; // See #define EMUPATCH
|
||||
|
||||
constexpr const char* remove_emupatch_prefix(const char* str) {
|
||||
// return an empty string when str isn't given
|
||||
|
|
|
@ -496,7 +496,7 @@ bool Settings::LoadConfig()
|
|||
continue;
|
||||
}
|
||||
|
||||
auto &lambda = [&control_names, &device](int num_buttons, const char *const ctrl_names[]) {
|
||||
const auto &lambda = [&control_names, &device](int num_buttons, const char *const ctrl_names[]) {
|
||||
for (int i = 0; i < num_buttons; i++) {
|
||||
char control_name[XBOX_BUTTON_NAME_LENGTH];
|
||||
std::sprintf(control_name, sect_input_profiles.control, ctrl_names[i]);
|
||||
|
@ -668,7 +668,7 @@ bool Settings::Save(std::string file_path)
|
|||
continue;
|
||||
}
|
||||
|
||||
auto &lambda = [&control_names, &device](int num_buttons, const char *const ctrl_names[]) {
|
||||
const auto &lambda = [&control_names, &device](int num_buttons, const char *const ctrl_names[]) {
|
||||
for (int i = 0; i < num_buttons; i++) {
|
||||
char control_name[XBOX_BUTTON_NAME_LENGTH];
|
||||
std::sprintf(control_name, sect_input_profiles.control, ctrl_names[i]);
|
||||
|
|
|
@ -120,3 +120,5 @@ void EmuDevice::CreateTooltipWindow()
|
|||
SendMessage(m_tooltip_hwnd, TTM_SETMAXTIPWIDTH, 0, 500);
|
||||
SendMessage(m_tooltip_hwnd, TTM_SETDELAYTIME, TTDT_AUTOPOP, 15000);
|
||||
}
|
||||
|
||||
template void EmuDevice::BindDefault(const std::array<const char*, XBOX_CTRL_NUM_BUTTONS>& arr);
|
||||
|
|
|
@ -53,4 +53,4 @@ private:
|
|||
HWND m_tooltip_hwnd;
|
||||
};
|
||||
|
||||
template void EmuDevice::BindDefault(const std::array<const char *, XBOX_CTRL_NUM_BUTTONS> &arr);
|
||||
extern template void EmuDevice::BindDefault(const std::array<const char *, XBOX_CTRL_NUM_BUTTONS> &arr);
|
||||
|
|
|
@ -109,7 +109,7 @@ std::string PortUserFormat(std::string_view port)
|
|||
void PortStr2Int(std::string_view port, int *port_num, int *slot)
|
||||
{
|
||||
*slot = PORT_INVALID;
|
||||
auto &ret = std::from_chars(port.data(), port.data() + port.size(), *port_num);
|
||||
auto ret = std::from_chars(port.data(), port.data() + port.size(), *port_num);
|
||||
assert(ret.ec != std::errc::invalid_argument);
|
||||
if (ret.ptr != port.data() + port.size()) {
|
||||
++ret.ptr;
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "common\Error.h"
|
||||
#include "common/xbox/Types.hpp"
|
||||
#include "core/kernel/common/types.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
|
|
Loading…
Reference in New Issue