From f547761c1581d757b5151319c6b718de6d4f30e1 Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Sun, 14 Dec 2014 18:14:14 -0800 Subject: [PATCH] Fix assert() that should be STBI_ASSERT() --- README.md | 2 +- stb_image.h | 6 ++++-- tests/test_cpp_compilation.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 486a2f7..ddcdb9b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ single-file public domain libraries for C/C++ library | lastest version | category | description --------------------- | ---- | -------- | -------------------------------- **stb_vorbis.c** | 1.04 | audio | decode ogg vorbis files from file/memory to float/16-bit signed output -**stb_image.h** | 1.47 | graphics | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC +**stb_image.h** | 1.48 | graphics | image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC **stb_truetype.h** | 1.02 | graphics | parse, decode, and rasterize characters from truetype fonts **stb_image_write.h** | 0.95 | graphics | image writing to disk: PNG, TGA, BMP **stb_image_resize.h** | 0.90 | graphics | resize images larger/smaller with good quality diff --git a/stb_image.h b/stb_image.h index d0c8f86..a930bea 100644 --- a/stb_image.h +++ b/stb_image.h @@ -1,4 +1,4 @@ -/* stb_image - v1.47 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c +/* stb_image - v1.48 - public domain JPEG/PNG reader - http://nothings.org/stb_image.c when you control the images you're loading no warranty implied; use at your own risk @@ -28,6 +28,7 @@ - overridable dequantizing-IDCT, YCbCr-to-RGB conversion (define STBI_SIMD) Latest revisions: + 1.48 (2014-12-14) fix incorrectly-named assert() 1.47 (2014-12-14) 1/2/4-bit PNG support (both grayscale and paletted) optimize PNG fix bug in interlaced PNG with user-specified channel count @@ -2545,7 +2546,7 @@ static int stbi__create_png_image_raw(stbi__png *a, stbi_uc *raw, stbi__uint32 r return stbi__err("invalid filter","Corrupt PNG"); if (depth < 8) { - assert(img_width_bytes <= x); + STBI_ASSERT(img_width_bytes <= x); cur += x*out_n - img_width_bytes; // store output to the rightmost img_len bytes, so we can decode in place filter_bytes = 1; width = img_width_bytes; @@ -4706,6 +4707,7 @@ STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *user, int /* revision history: + 1.48 (2014-12-14) fix incorrectly-named assert() 1.47 (2014-12-14) 1/2/4-bit PNG support, both direct and paletted (Omar Cornut & stb) optimize PNG (ryg) fix bug in interlaced PNG with user-specified channel count (stb) diff --git a/tests/test_cpp_compilation.cpp b/tests/test_cpp_compilation.cpp index bc31a76..44262fb 100644 --- a/tests/test_cpp_compilation.cpp +++ b/tests/test_cpp_compilation.cpp @@ -8,6 +8,7 @@ #define STB_HERRINGBONE_WANG_TILE_IMPLEMENTATION #define STB_RECT_PACK_IMPLEMENTATION +#include "stb_image.h" #include "stb_rect_pack.h" #include "stb_truetype.h" #include "stb_image_write.h" @@ -15,7 +16,6 @@ #include "stb_dxt.h" #include "stb_c_lexer.h" #include "stb_divide.h" -#include "stb_image.h" #include "stb_herringbone_wang_tile.h" #define STBTE_DRAW_RECT(x0,y0,x1,y1,color) do ; while(0)