add const

Signed-off-by: Rosen Penev <rosenp@gmail.com>
main
Rosen Penev 3 years ago
parent 3e97850e97
commit dd3b3d4ff4

@ -71,7 +71,7 @@ std::string getEnv(int env_var) {
/// @brief Convert an integer value to its hex character. /// @brief Convert an integer value to its hex character.
char to_hex(char code) { char to_hex(char code) {
static char hex[] = "0123456789abcdef"; static const char hex[] = "0123456789abcdef";
return hex[code & 15]; return hex[code & 15];
} }

@ -476,10 +476,11 @@ DataBuf PngChunk::readRawProfile(const DataBuf& text, bool iTXt) {
} }
DataBuf info; 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, 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, 1, 2, 3, 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,
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, 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, 10, 11, 12, 13, 14, 15}; 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) { if (iTXt) {
info.alloc(text.size()); info.alloc(text.size());
@ -581,7 +582,7 @@ DataBuf PngChunk::readRawProfile(const DataBuf& text, bool iTXt) {
} // PngChunk::readRawProfile } // PngChunk::readRawProfile
std::string PngChunk::writeRawProfile(const std::string& profileData, const char* profileType) { 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; std::ostringstream oss;
oss << '\n' << profileType << '\n' << std::setw(8) << profileData.size(); oss << '\n' << profileType << '\n' << std::setw(8) << profileData.size();

Loading…
Cancel
Save