Thanks for the nice little library - works great so far. I'm going to use it in Mineways.
I use Visual Studio 2019 and tend to put warnings at 4, "show me everything." For stdio.cpp there are two warning, casting mismatches, which I fix as follows:
void StdioFileInterface::seek(size_t absPos)
{
fseek(m_file, (long)absPos, SEEK_SET); // <-- cast added
}
uint8_t StdioFileInterface::read8()
{
int value = fgetc(m_file);
if (value != EOF)
return (uint8_t)value; // <-- cast added
m_ok = false;
return 0;
}
For decoder.cpp there were enough that I didn't bother. Here's the list, if you want to fix these yourself:
1>decoder.cpp(25,26): warning C4244: '=': conversion from 'uint32_t' to 'uint8_t', possible loss of data 1>decoder.cpp(26,30): warning C4244: '=': conversion from 'uint32_t' to 'uint8_t', possible loss of data 1>decoder.cpp(27,27): warning C4244: '=': conversion from 'uint32_t' to 'uint8_t', possible loss of data 1>decoder.cpp(28,33): warning C4244: '=': conversion from 'uint32_t' to 'uint16_t', possible loss of data 1>decoder.cpp(29,34): warning C4244: '=': conversion from 'uint32_t' to 'uint16_t', possible loss of data 1>decoder.cpp(30,31): warning C4244: '=': conversion from 'uint32_t' to 'uint8_t', possible loss of data 1>decoder.cpp(31,26): warning C4244: '=': conversion from 'uint32_t' to 'uint16_t', possible loss of data 1>decoder.cpp(32,26): warning C4244: '=': conversion from 'uint32_t' to 'uint16_t', possible loss of data 1>decoder.cpp(33,24): warning C4244: '=': conversion from 'uint32_t' to 'uint16_t', possible loss of data 1>decoder.cpp(34,25): warning C4244: '=': conversion from 'uint32_t' to 'uint16_t', possible loss of data 1>decoder.cpp(35,30): warning C4244: '=': conversion from 'uint32_t' to 'uint8_t', possible loss of data 1>decoder.cpp(36,33): warning C4244: '=': conversion from 'uint32_t' to 'uint8_t', possible loss of data 1>decoder.cpp(98,36): warning C4244: 'argument': conversion from 'int' to 'uint8_t', possible loss of data 1>decoder.cpp(97,36): warning C4244: 'argument': conversion from 'int' to 'uint8_t', possible loss of data 1>decoder.cpp(96,36): warning C4244: 'argument': conversion from 'int' to 'uint8_t', possible loss of data 1>decoder.cpp(112,44): warning C4244: 'argument': conversion from 'int' to 'uint8_t', possible loss of data 1>decoder.cpp(112,41): warning C4244: 'argument': conversion from 'const int' to 'uint8_t', possible loss of data 1>decoder.cpp(112,38): warning C4244: 'argument': conversion from 'const int' to 'uint8_t', possible loss of data 1>decoder.cpp(112,35): warning C4244: 'argument': conversion from 'const int' to 'uint8_t', possible loss of data 1>decoder.cpp(326,26): warning C4244: 'initializing': conversion from 'uint32_t' to 'uint8_t', possible loss of data 1>decoder.cpp(326,19): warning C4244: 'initializing': conversion from 'uint32_t' to 'const uint8_t', possible loss of data 1>decoder.cpp(327,26): warning C4244: 'initializing': conversion from 'uint32_t' to 'uint8_t', possible loss of data 1>decoder.cpp(327,19): warning C4244: 'initializing': conversion from 'uint32_t' to 'const uint8_t', possible loss of data 1>decoder.cpp(328,26): warning C4244: 'initializing': conversion from 'uint32_t' to 'uint8_t', possible loss of data 1>decoder.cpp(328,19): warning C4244: 'initializing': conversion from 'uint32_t' to 'const uint8_t', possible loss of data 1>decoder.cpp(329,13): warning C4244: 'initializing': conversion from 'uint32_t' to 'uint8_t', possible loss of data 1>decoder.cpp(337,26): warning C4244: 'initializing': conversion from 'uint32_t' to 'uint8_t', possible loss of data 1>decoder.cpp(337,19): warning C4244: 'initializing': conversion from 'uint32_t' to 'const uint8_t', possible loss of data 1>decoder.cpp(338,26): warning C4244: 'initializing': conversion from 'uint32_t' to 'uint8_t', possible loss of data 1>decoder.cpp(338,19): warning C4244: 'initializing': conversion from 'uint32_t' to 'const uint8_t', possible loss of data 1>decoder.cpp(339,26): warning C4244: 'initializing': conversion from 'uint32_t' to 'uint8_t', possible loss of data 1>decoder.cpp(339,19): warning C4244: 'initializing': conversion from 'uint32_t' to 'const uint8_t', possible loss of data 1>decoder.cpp(345,28): warning C4244: 'initializing': conversion from 'uint32_t' to 'uint16_t', possible loss of data 1>decoder.cpp(345,20): warning C4244: 'initializing': conversion from 'uint32_t' to 'const uint16_t', possible loss of data 1>decoder.cpp(353,35): warning C4244: 'argument': conversion from 'int' to 'uint8_t', possible loss of data 1>decoder.cpp(352,35): warning C4244: 'argument': conversion from 'int' to 'uint8_t', possible loss of data 1>decoder.cpp(351,35): warning C4244: 'argument': conversion from 'int' to 'uint8_t', possible loss of data 1>decoder.cpp(254,50): warning C4244: 'argument': conversion from 'tga::color_t' to 'const T', possible loss of data 1> with 1> [ 1> T=uint8_t 1> ] 1>decoder.cpp(132): message : see reference to function template instantiation 'bool tga::Decoder::readUncompressedData<uint8_t>(const int,uint32_t (__cdecl tga::Decoder::* )(void))' being compiled 1>decoder.cpp(273,41): warning C4244: 'initializing': conversion from 'tga::color_t' to 'T', possible loss of data 1> with 1> [ 1> T=uint8_t 1> ] 1>decoder.cpp(165): message : see reference to function template instantiation 'bool tga::Decoder::readRleData<uint8_t>(const int,uint32_t (__cdecl tga::Decoder::* )(void))' being compiled 1>decoder.cpp(273,21): warning C4244: 'initializing': conversion from 'tga::color_t' to 'const T', possible loss of data 1> with 1> [ 1> T=uint8_t 1> ] 1>decoder.cpp(282,54): warning C4244: 'argument': conversion from 'tga::color_t' to 'const T', possible loss of data 1> with 1> [ 1> T=uint8_t 1> ]
I hope this is a help - I just want to make your code look perfect. Feel free to ignore.