From e2a3c01fda9df43b73801dc5ef26ad12bf6357f4 Mon Sep 17 00:00:00 2001 From: AE1020 <68134252+AE1020@users.noreply.github.com> Date: Thu, 20 Aug 2020 03:21:32 -0400 Subject: [PATCH] Drop >= LFS_ZERO (always true, generates warning) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On the line that says: if(strategy >= LFS_ZERO && strategy <= LFS_FOUR) { If compiler warnings are turned up, they will give: lodepng.cpp: In function ‘filter’: lodepng.cpp:5437:3: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits] It's not a terribly useful warning here. But it is in some cases informative and can catch misunderstandings, so nice to not have to disable it in a build that treats warnings as errors. --- lodepng.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lodepng.cpp b/lodepng.cpp index ee8cf33d..96007cfb 100644 --- a/lodepng.cpp +++ b/lodepng.cpp @@ -5434,7 +5434,7 @@ static unsigned filter(unsigned char* out, const unsigned char* in, unsigned w, if(bpp == 0) return 31; /*error: invalid color type*/ - if(strategy >= LFS_ZERO && strategy <= LFS_FOUR) { + if(strategy <= LFS_FOUR) { unsigned char type = (unsigned char)strategy; for(y = 0; y != h; ++y) { size_t outindex = (1 + linebytes) * y; /*the extra filterbyte added to each row*/