fix warnings, bad error handling

This commit is contained in:
Sean Barrett 2018-01-29 08:18:19 -08:00
parent b2c2419b1b
commit 037926ab74

View File

@ -3139,8 +3139,8 @@ static int stbi__decode_jpeg_image(stbi__jpeg *j)
} else if (stbi__DNL(m)) { } else if (stbi__DNL(m)) {
int Ld = stbi__get16be(j->s); int Ld = stbi__get16be(j->s);
stbi__uint32 NL = stbi__get16be(j->s); stbi__uint32 NL = stbi__get16be(j->s);
if (Ld != 4) stbi__err("bad DNL len", "Corrupt JPEG"); if (Ld != 4) return stbi__err("bad DNL len", "Corrupt JPEG");
if (NL != j->s->img_y) stbi__err("bad DNL height", "Corrupt JPEG"); if (NL != j->s->img_y) return stbi__err("bad DNL height", "Corrupt JPEG");
} else { } else {
if (!stbi__process_marker(j, m)) return 0; if (!stbi__process_marker(j, m)) return 0;
} }
@ -5324,10 +5324,10 @@ static int stbi__tga_get_comp(int bits_per_pixel, int is_grey, int* is_rgb16)
switch(bits_per_pixel) { switch(bits_per_pixel) {
case 8: return STBI_grey; case 8: return STBI_grey;
case 16: if(is_grey) return STBI_grey_alpha; case 16: if(is_grey) return STBI_grey_alpha;
// fall-through // fallthrough
case 15: if(is_rgb16) *is_rgb16 = 1; case 15: if(is_rgb16) *is_rgb16 = 1;
return STBI_rgb; return STBI_rgb;
case 24: // fall-through case 24: // fallthrough
case 32: return bits_per_pixel/8; case 32: return bits_per_pixel/8;
default: return 0; default: return 0;
} }