From 1a9be15c1eead2349a332b9d4e371710366dda13 Mon Sep 17 00:00:00 2001 From: engin manap Date: Mon, 12 Jan 2015 11:34:48 +0200 Subject: [PATCH 1/2] Fix dangling else warnings --- stb_image.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/stb_image.h b/stb_image.h index fcef0c1..2905f9b 100644 --- a/stb_image.h +++ b/stb_image.h @@ -1723,11 +1723,12 @@ static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__ short *p = &data[stbi__jpeg_dezigzag[k]]; if (*p != 0) if (stbi__jpeg_get_bit(j)) - if ((*p & bit)==0) + if ((*p & bit)==0) { if (*p > 0) *p += bit; else *p -= bit; + } } } else { k = j->spec_start; @@ -1759,11 +1760,12 @@ static int stbi__jpeg_decode_block_prog_ac(stbi__jpeg *j, short data[64], stbi__ short *p = &data[stbi__jpeg_dezigzag[k]]; if (*p != 0) { if (stbi__jpeg_get_bit(j)) - if ((*p & bit)==0) + if ((*p & bit)==0) { if (*p > 0) *p += bit; else *p -= bit; + } ++k; } else { if (r == 0) { From 50c5c8e8ca0fa947bd5d4ecb4ab7e0636286848b Mon Sep 17 00:00:00 2001 From: engin manap Date: Mon, 12 Jan 2015 11:41:00 +0200 Subject: [PATCH 2/2] remove unused variable "ha" this variable was causing a warning while compiling with gcc. --- stb_image.h | 1 - 1 file changed, 1 deletion(-) diff --git a/stb_image.h b/stb_image.h index 2905f9b..7d79aa3 100644 --- a/stb_image.h +++ b/stb_image.h @@ -2421,7 +2421,6 @@ static int stbi__parse_entropy_coded_data(stbi__jpeg *z) for (x=0; x < z->img_comp[n].h; ++x) { int x2 = (i*z->img_comp[n].h + x); int y2 = (j*z->img_comp[n].v + y); - int ha = z->img_comp[n].ha; short *data = z->img_comp[n].coeff + 64 * (x2 + y2 * z->img_comp[n].coeff_w); if (!stbi__jpeg_decode_block_prog_dc(z, data, &z->huff_dc[z->img_comp[n].hd], n)) return 0;