Quellcode durchsuchen

Fix assert() that should be STBI_ASSERT()

Sean Barrett vor 10 Jahren
Ursprung
Commit
f547761c15
3 geänderte Dateien mit 6 neuen und 4 gelöschten Zeilen
  1. 1 1
      README.md
  2. 4 2
      stb_image.h
  3. 1 1
      tests/test_cpp_compilation.cpp

+ 1 - 1
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

+ 4 - 2
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)

+ 1 - 1
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)