diff --git a/src/futils.cpp b/src/futils.cpp index 380c5386..af969ed4 100644 --- a/src/futils.cpp +++ b/src/futils.cpp @@ -71,7 +71,7 @@ std::string getEnv(int env_var) { /// @brief Convert an integer value to its hex character. char to_hex(char code) { - static char hex[] = "0123456789abcdef"; + static const char hex[] = "0123456789abcdef"; return hex[code & 15]; } diff --git a/src/pngchunk_int.cpp b/src/pngchunk_int.cpp index 29875907..342cc7bf 100644 --- a/src/pngchunk_int.cpp +++ b/src/pngchunk_int.cpp @@ -476,10 +476,11 @@ DataBuf PngChunk::readRawProfile(const DataBuf& text, bool iTXt) { } DataBuf info; - unsigned char unhex[103] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, - 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15}; + const unsigned char unhex[103] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15, + }; if (iTXt) { info.alloc(text.size()); @@ -581,7 +582,7 @@ DataBuf PngChunk::readRawProfile(const DataBuf& text, bool iTXt) { } // PngChunk::readRawProfile std::string PngChunk::writeRawProfile(const std::string& profileData, const char* profileType) { - static byte hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + static const byte hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; std::ostringstream oss; oss << '\n' << profileType << '\n' << std::setw(8) << profileData.size();