lvandeve / lodepng

PNG encoder and decoder in C and C++.
zlib License
2.06k stars 421 forks source link

Fix unused error variable #60

Open lunixoid opened 6 years ago

lunixoid commented 6 years ago

I'm a member of the Pinguem.ru competition on finding errors in open source projects. A bug, found using PVS-Studio: lodepng/lodepng.cpp 5265 warn V547 Expression '!error' is always true.

The variable unsigned error = 0; was initialised but never used. In this function errors was realised as a return code, f.e.: if(bpp == 0) return 31; So variable error is not deeded here.

jslee02 commented 6 years ago

FYI, cleaner diff: https://github.com/lvandeve/lodepng/pull/60/files?w=1