From 33ec4d9430cf5ad091d969b1f6ba3a94cfd7e213 Mon Sep 17 00:00:00 2001 From: Gauvain 'GovanifY' Roussel-Tarbouriech Date: Mon, 31 May 2021 15:53:18 +0200 Subject: [PATCH] msvc: fix issues with size() not being correctly evaluated as const --- pcsx2/PINE.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pcsx2/PINE.cpp b/pcsx2/PINE.cpp index 68e4296d73..49433b0647 100644 --- a/pcsx2/PINE.cpp +++ b/pcsx2/PINE.cpp @@ -427,7 +427,7 @@ PINEServer::IPCBuffer PINEServer::ParseCommand(char* buf, char* ret_buffer, u32 { if (!m_vm->HasActiveMachine()) goto error; - char title[GameInfo::gameName.size() + 1] = {}; + char* title = new char[GameInfo::gameName.size() + 1]; sprintf(title, "%s", GameInfo::gameName.ToUTF8().data()); const u32 size = strlen(title) + 1; title[size] = 0x00; @@ -437,13 +437,14 @@ PINEServer::IPCBuffer PINEServer::ParseCommand(char* buf, char* ret_buffer, u32 ret_cnt += 4; memcpy(&ret_buffer[ret_cnt], title, size); ret_cnt += size; + delete[] title; break; } case MsgID: { if (!m_vm->HasActiveMachine()) goto error; - char title[GameInfo::gameName.size() + 1] = {}; + char* title = new char[GameInfo::gameSerial.size() + 1]; sprintf(title, "%s", GameInfo::gameSerial.ToUTF8().data()); const u32 size = strlen(title) + 1; title[size] = 0x00; @@ -453,13 +454,14 @@ PINEServer::IPCBuffer PINEServer::ParseCommand(char* buf, char* ret_buffer, u32 ret_cnt += 4; memcpy(&ret_buffer[ret_cnt], title, size); ret_cnt += size; + delete[] title; break; } case MsgUUID: { if (!m_vm->HasActiveMachine()) goto error; - char title[GameInfo::gameName.size() + 1] = {}; + char* title = new char[GameInfo::gameCRC.size() + 1]; sprintf(title, "%s", GameInfo::gameCRC.ToUTF8().data()); const u32 size = strlen(title) + 1; title[size] = 0x00; @@ -469,13 +471,14 @@ PINEServer::IPCBuffer PINEServer::ParseCommand(char* buf, char* ret_buffer, u32 ret_cnt += 4; memcpy(&ret_buffer[ret_cnt], title, size); ret_cnt += size; + delete[] title; break; } case MsgGameVersion: { if (!m_vm->HasActiveMachine()) goto error; - char title[GameInfo::gameName.size() + 1] = {}; + char* title = new char[GameInfo::gameVersion.size() + 1]; sprintf(title, "%s", GameInfo::gameVersion.ToUTF8().data()); const u32 size = strlen(title) + 1; title[size] = 0x00; @@ -485,6 +488,7 @@ PINEServer::IPCBuffer PINEServer::ParseCommand(char* buf, char* ret_buffer, u32 ret_cnt += 4; memcpy(&ret_buffer[ret_cnt], title, size); ret_cnt += size; + delete[] title; break; } case MsgStatus: