From 7e134421d58ec0b64d2411ac48d9c43e555aba6c Mon Sep 17 00:00:00 2001 From: SachinVin Date: Fri, 9 Jun 2023 22:50:37 +0530 Subject: [PATCH] common, input_common, network: fix warnings --- src/common/string_util.cpp | 2 +- src/input_common/sdl/sdl_impl.cpp | 2 +- src/network/packet.cpp | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index c8257a343..2d4241484 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -170,7 +170,7 @@ static std::wstring CPToUTF16(u32 code_page, const std::string& input) { MultiByteToWideChar(code_page, 0, input.data(), static_cast(input.size()), nullptr, 0); if (size == 0) { - return L""; + return {}; } std::wstring output(size, L'\0'); diff --git a/src/input_common/sdl/sdl_impl.cpp b/src/input_common/sdl/sdl_impl.cpp index d88bdd896..29fe97117 100644 --- a/src/input_common/sdl/sdl_impl.cpp +++ b/src/input_common/sdl/sdl_impl.cpp @@ -1018,7 +1018,7 @@ public: } Common::ParamPackage GetNextInput() override { - SDL_Event event; + SDL_Event event{}; while (state.event_queue.Pop(event)) { if (event.type != SDL_JOYAXISMOTION || std::abs(event.jaxis.value / 32767.0) < 0.5) { continue; diff --git a/src/network/packet.cpp b/src/network/packet.cpp index 8fc5feabd..1b62fdf60 100644 --- a/src/network/packet.cpp +++ b/src/network/packet.cpp @@ -85,42 +85,42 @@ Packet& Packet::operator>>(u8& out_data) { } Packet& Packet::operator>>(s16& out_data) { - s16 value; + s16 value = 0; Read(&value, sizeof(value)); out_data = ntohs(value); return *this; } Packet& Packet::operator>>(u16& out_data) { - u16 value; + u16 value = 0; Read(&value, sizeof(value)); out_data = ntohs(value); return *this; } Packet& Packet::operator>>(s32& out_data) { - s32 value; + s32 value = 0; Read(&value, sizeof(value)); out_data = ntohl(value); return *this; } Packet& Packet::operator>>(u32& out_data) { - u32 value; + u32 value = 0; Read(&value, sizeof(value)); out_data = ntohl(value); return *this; } Packet& Packet::operator>>(s64& out_data) { - s64 value; + s64 value = 0; Read(&value, sizeof(value)); out_data = ntohll(value); return *this; } Packet& Packet::operator>>(u64& out_data) { - u64 value; + u64 value = 0; Read(&value, sizeof(value)); out_data = ntohll(value); return *this;