From cb8ea601cf4acd6bc42de27bf798efea486391d8 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Sun, 7 Jul 2024 18:40:43 -0500 Subject: [PATCH] Fix warning related to sizeof() on const char array, the null terminator is not used here so reworked the array to explicitly be 4 elements --- NetworkProtocol.cpp | 2 +- NetworkProtocol.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NetworkProtocol.cpp b/NetworkProtocol.cpp index b296347c..53e98a46 100644 --- a/NetworkProtocol.cpp +++ b/NetworkProtocol.cpp @@ -15,7 +15,7 @@ /*-----------------------------------------------------*\ | OpenRGB SDK Magic Value "ORGB" | \*-----------------------------------------------------*/ -const char * openrgb_sdk_magic = "ORGB"; +const char openrgb_sdk_magic[OPENRGB_SDK_MAGIC_SIZE] = { 'O', 'R', 'G', 'B' }; void InitNetPacketHeader ( diff --git a/NetworkProtocol.h b/NetworkProtocol.h index 528b538e..b9d0e43d 100644 --- a/NetworkProtocol.h +++ b/NetworkProtocol.h @@ -36,7 +36,8 @@ /*-----------------------------------------------------*\ | OpenRGB SDK Magic Value "ORGB" | \*-----------------------------------------------------*/ -extern const char * openrgb_sdk_magic; +#define OPENRGB_SDK_MAGIC_SIZE 4 +extern const char openrgb_sdk_magic[OPENRGB_SDK_MAGIC_SIZE]; typedef struct NetPacketHeader {