Skip to content

Commit

Permalink
Fix -Wtype-limits warning
Browse files Browse the repository at this point in the history
actual has type Uint8, so there's no need to compare against 0.
  • Loading branch information
madebr committed Sep 9, 2024
1 parent 6e885d9 commit c797ae1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/testautomation_surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1339,15 +1339,15 @@ static int SDLCALL surface_testPalettization(void *arg)
int idx = i;
Uint8 actual = pixels[idx];
Uint8 expected = colors[i].e;
SDLTest_AssertCheck(0 <= actual && actual < SDL_arraysize(palette_colors), "0 <= output->pixels[%d] < %d", idx, (int)SDL_arraysize(palette_colors));
SDLTest_AssertCheck(actual < SDL_arraysize(palette_colors), "output->pixels[%d] < %d", idx, (int)SDL_arraysize(palette_colors));
SDLTest_AssertCheck(actual == expected, "Expected output->pixels[%d] == %u, got %u", idx, expected, actual);
}
SDLTest_AssertPass("Check palette 1:1 mapping");
for (i = 0; i < SDL_arraysize(palette_colors); i++) {
int idx = SDL_arraysize(colors) + i;
Uint8 actual = pixels[idx];
Uint8 expected = i;
SDLTest_AssertCheck(0 <= actual && actual < SDL_arraysize(palette_colors), "0 <= output->pixels[%d] < %d", idx, (int)SDL_arraysize(palette_colors));
SDLTest_AssertCheck(actual < SDL_arraysize(palette_colors), "output->pixels[%d] < %d", idx, (int)SDL_arraysize(palette_colors));
SDLTest_AssertCheck(actual == expected, "Expected output->pixels[%d] == %u, got %u", idx, expected, actual);
}
SDL_DestroyPalette(palette);
Expand Down

0 comments on commit c797ae1

Please sign in to comment.