lvandeve / lodepng

PNG encoder and decoder in C and C++.
zlib License
2.07k stars 422 forks source link

Compiler warnings when compiling for 64-bit #24

Open rggjan opened 8 years ago

rggjan commented 8 years ago

I get the following warnings when compiling on Windows for 64-bit:

lodepng.cpp(773) : warning C4334: '<<' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
lodepng.cpp(1437) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
lodepng.cpp(1441) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
lodepng.cpp(1513) : warning C4267: '=' : conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(3458) : warning C4267: 'argument' : conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(4261) : warning C4267: '=' : conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(4309) : warning C4267: '=' : conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(4389) : warning C4267: '=' : conversion from 'size_t' to 'unsigned int', possible loss of data
lodepng.cpp(5329) : warning C4267: 'initializing' : conversion from 'size_t' to 'unsigned int', possible loss of data

Everything seems to work fine, though...

Sonicious commented 8 years ago

Yeah. I have the same problem. I just started with lodePNG, but I already love it (finally no libPNG anymore)

Is it actually possible to have some static casts to reduce the size_t warnings as well? I guess it's intended to link lodepng directly into the source and so the warnings from the libs get mixed up with my own ones which can confuse.

rggjan commented 8 years ago

This could maybe be solved with https://github.com/lvandeve/lodepng/pull/34

jobtalle commented 7 years ago

34 doesn't solve all 64bit related warnings though. I have solved them all in pull request #51.