From 79a7719c37387a4f8e775bb9471966c4dd89319e Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Thu, 7 Feb 2019 07:20:58 -0800 Subject: [PATCH] stb_image: fix d1252e1bb9fe6bdfad9f75ae626f9abdef5b4be1 for building in C --- stb_image.h | 4 ++-- stb_image_write.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/stb_image.h b/stb_image.h index 9a31ee2..daea4fe 100644 --- a/stb_image.h +++ b/stb_image.h @@ -6394,11 +6394,11 @@ static stbi_uc *stbi__process_gif_raster(stbi__context *s, stbi__gif *g) // two back is the image from two frames ago, used for a very specific disposal format static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, int req_comp, stbi_uc *two_back) { - STBI_NOTUSED(req_comp); int dispose; int first_frame; int pi; int pcount; + STBI_NOTUSED(req_comp); // on first frame, any non-written pixels get the background colour (non-transparent) first_frame = 0; @@ -6619,10 +6619,10 @@ static void *stbi__load_gif_main(stbi__context *s, int **delays, int *x, int *y, static void *stbi__gif_load(stbi__context *s, int *x, int *y, int *comp, int req_comp, stbi__result_info *ri) { - STBI_NOTUSED(ri); stbi_uc *u = 0; stbi__gif g; memset(&g, 0, sizeof(g)); + STBI_NOTUSED(ri); u = stbi__gif_load_next(s, &g, comp, req_comp, 0); if (u == (stbi_uc *) s) u = 0; // end of animated gif marker diff --git a/stb_image_write.h b/stb_image_write.h index 89bfb2b..975f77d 100644 --- a/stb_image_write.h +++ b/stb_image_write.h @@ -1090,11 +1090,11 @@ unsigned char *stbi_write_png_to_mem(const unsigned char *pixels, int stride_byt int filter_type; if (force_filter > -1) { filter_type = force_filter; - stbiw__encode_png_line(const_cast(pixels), stride_bytes, x, y, j, n, force_filter, line_buffer); + stbiw__encode_png_line((unsigned char*)(pixels), stride_bytes, x, y, j, n, force_filter, line_buffer); } else { // Estimate the best filter by running through all of them: int best_filter = 0, best_filter_val = 0x7fffffff, est, i; for (filter_type = 0; filter_type < 5; filter_type++) { - stbiw__encode_png_line(const_cast(pixels), stride_bytes, x, y, j, n, filter_type, line_buffer); + stbiw__encode_png_line((unsigned char*)(pixels), stride_bytes, x, y, j, n, filter_type, line_buffer); // Estimate the entropy of the line using this filter; the less, the better. est = 0; @@ -1107,7 +1107,7 @@ unsigned char *stbi_write_png_to_mem(const unsigned char *pixels, int stride_byt } } if (filter_type != best_filter) { // If the last iteration already got us the best filter, don't redo it - stbiw__encode_png_line(const_cast(pixels), stride_bytes, x, y, j, n, best_filter, line_buffer); + stbiw__encode_png_line((unsigned char*)(pixels), stride_bytes, x, y, j, n, best_filter, line_buffer); filter_type = best_filter; } }