mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix various Cppcheck warnings (#15081)
This commit is contained in:
parent
cd98ca0d8e
commit
c887a049d2
|
@ -232,7 +232,7 @@ namespace OpenRCT2::Ui
|
|||
return result;
|
||||
}
|
||||
|
||||
static std::wstring GetFilterString(const std::vector<FileDialogDesc::Filter> filters)
|
||||
static std::wstring GetFilterString(const std::vector<FileDialogDesc::Filter>& filters)
|
||||
{
|
||||
std::wstringstream filtersb;
|
||||
for (const auto& filter : filters)
|
||||
|
|
|
@ -123,7 +123,7 @@ public:
|
|||
|
||||
~UiContext() override
|
||||
{
|
||||
CloseWindow();
|
||||
UiContext::CloseWindow();
|
||||
delete _windowManager;
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
delete _platformUiContext;
|
||||
|
@ -179,11 +179,8 @@ public:
|
|||
if (mode == FULLSCREEN_MODE::FULLSCREEN)
|
||||
{
|
||||
SDL_SetWindowFullscreen(_window, 0);
|
||||
}
|
||||
|
||||
// Set window size
|
||||
if (mode == FULLSCREEN_MODE::FULLSCREEN)
|
||||
{
|
||||
// Set window size
|
||||
UpdateFullscreenResolutions();
|
||||
Resolution resolution = GetClosestResolution(gConfigGeneral.fullscreen_width, gConfigGeneral.fullscreen_height);
|
||||
SDL_SetWindowSize(_window, resolution.Width, resolution.Height);
|
||||
|
@ -598,7 +595,7 @@ public:
|
|||
{
|
||||
scaleQuality = ScaleQuality::Linear;
|
||||
}
|
||||
snprintf(scaleQualityBuffer, sizeof(scaleQualityBuffer), "%u", static_cast<int32_t>(scaleQuality));
|
||||
snprintf(scaleQualityBuffer, sizeof(scaleQualityBuffer), "%d", static_cast<int32_t>(scaleQuality));
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, scaleQualityBuffer);
|
||||
|
||||
int32_t width, height;
|
||||
|
|
|
@ -47,9 +47,9 @@ namespace OpenRCT2::Audio
|
|||
public:
|
||||
AudioChannelImpl()
|
||||
{
|
||||
SetRate(1);
|
||||
SetVolume(MIXER_VOLUME_MAX);
|
||||
SetPan(0.5f);
|
||||
AudioChannelImpl::SetRate(1);
|
||||
AudioChannelImpl::SetVolume(MIXER_VOLUME_MAX);
|
||||
AudioChannelImpl::SetPan(0.5f);
|
||||
}
|
||||
|
||||
~AudioChannelImpl() override
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace OpenRCT2::Audio
|
|||
|
||||
~AudioMixerImpl() override
|
||||
{
|
||||
Close();
|
||||
AudioMixerImpl::Close();
|
||||
delete _nullSource;
|
||||
}
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ public:
|
|||
}
|
||||
|
||||
char scaleQualityBuffer[4];
|
||||
snprintf(scaleQualityBuffer, sizeof(scaleQualityBuffer), "%u", static_cast<int32_t>(scaleQuality));
|
||||
snprintf(scaleQualityBuffer, sizeof(scaleQualityBuffer), "%d", static_cast<int32_t>(scaleQuality));
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");
|
||||
_screenTexture = SDL_CreateTexture(_sdlRenderer, pixelFormat, SDL_TEXTUREACCESS_STREAMING, width, height);
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, scaleQualityBuffer);
|
||||
|
|
|
@ -21,9 +21,8 @@
|
|||
using namespace OpenRCT2;
|
||||
|
||||
OpenGLShader::OpenGLShader(const char* name, GLenum type)
|
||||
: _type(type)
|
||||
{
|
||||
_type = type;
|
||||
|
||||
auto path = GetPath(name);
|
||||
auto sourceCode = ReadSourceCode(path);
|
||||
auto sourceCodeStr = sourceCode.c_str();
|
||||
|
|
|
@ -91,9 +91,9 @@ private:
|
|||
|
||||
public:
|
||||
Atlas(GLuint index, int32_t imageSize)
|
||||
: _index(index)
|
||||
, _imageSize(imageSize)
|
||||
{
|
||||
_index = index;
|
||||
_imageSize = imageSize;
|
||||
}
|
||||
|
||||
void Initialise(int32_t atlasWidth, int32_t atlasHeight)
|
||||
|
|
|
@ -117,13 +117,13 @@ enum
|
|||
|
||||
struct LoadSaveListItem
|
||||
{
|
||||
std::string name;
|
||||
std::string path;
|
||||
time_t date_modified;
|
||||
std::string date_formatted;
|
||||
std::string time_formatted;
|
||||
uint8_t type;
|
||||
bool loaded;
|
||||
std::string name{};
|
||||
std::string path{};
|
||||
time_t date_modified{ 0 };
|
||||
std::string date_formatted{};
|
||||
std::string time_formatted{};
|
||||
uint8_t type{ 0 };
|
||||
bool loaded{ false };
|
||||
};
|
||||
|
||||
static std::function<void(int32_t result, std::string_view)> _loadSaveCallback;
|
||||
|
|
|
@ -150,7 +150,7 @@ private:
|
|||
_nextDownloadQueued = true;
|
||||
}
|
||||
|
||||
void DownloadObject(const rct_object_entry& entry, const std::string name, const std::string url)
|
||||
void DownloadObject(const rct_object_entry& entry, const std::string& name, const std::string& url)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -631,11 +631,11 @@ public:
|
|||
|
||||
private:
|
||||
explicit TcpSocket(SOCKET socket, const std::string& hostName, const std::string& ipAddress)
|
||||
: _status(SocketStatus::Connected)
|
||||
, _socket(socket)
|
||||
, _ipAddress(ipAddress)
|
||||
, _hostName(hostName)
|
||||
{
|
||||
_socket = socket;
|
||||
_hostName = hostName;
|
||||
_ipAddress = ipAddress;
|
||||
_status = SocketStatus::Connected;
|
||||
}
|
||||
|
||||
void CloseSocket()
|
||||
|
@ -833,10 +833,10 @@ public:
|
|||
|
||||
private:
|
||||
explicit UdpSocket(SOCKET socket, const std::string& hostName)
|
||||
: _status(SocketStatus::Connected)
|
||||
, _socket(socket)
|
||||
, _hostName(hostName)
|
||||
{
|
||||
_socket = socket;
|
||||
_hostName = hostName;
|
||||
_status = SocketStatus::Connected;
|
||||
}
|
||||
|
||||
SOCKET CreateSocket()
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <initializer_list>
|
||||
#include <vector>
|
||||
|
||||
template<typename T, typename TExpected> static void AssertVector(std::vector<T> actual, TExpected expected)
|
||||
template<typename T, typename TExpected> static void AssertVector(const std::vector<T>& actual, TExpected expected)
|
||||
{
|
||||
ASSERT_EQ(actual.size(), expected.size()) << "Expected vector of size " << expected.size() << ", but was " << actual.size();
|
||||
size_t i = 0;
|
||||
|
@ -24,7 +24,7 @@ template<typename T, typename TExpected> static void AssertVector(std::vector<T>
|
|||
}
|
||||
}
|
||||
|
||||
template<typename T> static void AssertVector(std::vector<T> actual, std::initializer_list<T> expected)
|
||||
template<typename T> static void AssertVector(const std::vector<T>& actual, std::initializer_list<T> expected)
|
||||
{
|
||||
AssertVector<T, std::initializer_list<T>>(actual, expected);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue