lvandeve/lodepng

Fix warnings: `conversion from 'size_t' to 'unsigned short', possible loss of data`

AntTheAlchemist opened this issue · 2 comments

Had these warnings come up for the past couple of years on Visual Studio 2022 when building for x86.

lodepng.cpp(704,35): warning C4267: '=': conversion from 'size_t' to 'unsigned short', possible loss of data
lodepng.cpp(729,37): warning C4267: '=': conversion from 'size_t' to 'unsigned short', possible loss of data
lodepng.cpp(746,38): warning C4267: '=': conversion from 'size_t' to 'unsigned short', possible loss of data

Compiling in x64 mode on VS 2019 I get even more warnings:

lodepng.cpp(704,35): warning C4267: '=': conversion from 'size_t' to 'unsigned short', possible loss of data
lodepng.cpp(705,39): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
lodepng.cpp(729,37): warning C4267: '=': conversion from 'size_t' to 'unsigned short', possible loss of data
lodepng.cpp(746,38): warning C4267: '=': conversion from 'size_t' to 'unsigned short', possible loss of data
lodepng.cpp(3999,78): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5062,33): warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5331,60): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5336,83): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5337,94): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5338,83): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5339,94): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5340,83): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5341,94): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5342,78): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5537,3): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5561,7): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5595,62): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5612,3): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5634,57): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5665,57): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5778,57): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5892,33): warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
kajott commented

This is a duplicate of #67, and should be fixed by #142.