fix missing STBI_MALLOC

This commit is contained in:
Sean Barrett 2014-12-25 11:11:59 -08:00
parent 6e0ae49f87
commit a7c8694d69

View File

@ -1,4 +1,4 @@
/* stb_image - v2.00 - public domain image loader - http://nothings.org/stb_image.h /* stb_image - v2.00b - public domain image loader - http://nothings.org/stb_image.h
no warranty implied; use at your own risk no warranty implied; use at your own risk
Do this: Do this:
@ -143,18 +143,19 @@
Latest revision history: Latest revision history:
2.00 (2014-12-25) optimize JPEG, including x86 SSE2 & ARM NEON SIMD 2.00b (2014-12-25) fix STBI_MALLOC in progressive JPEG
progressive JPEG 2.00 (2014-12-25) optimize JPEG, including x86 SSE2 & ARM NEON SIMD
PGM/PPM support progressive JPEG
STBI_MALLOC,STBI_REALLOC,STBI_FREE PGM/PPM support
STBI_NO_*, STBI_ONLY_* STBI_MALLOC,STBI_REALLOC,STBI_FREE
GIF bugfix STBI_NO_*, STBI_ONLY_*
1.48 (2014-12-14) fix incorrectly-named assert() GIF bugfix
1.47 (2014-12-14) 1/2/4-bit PNG support (both grayscale and paletted) 1.48 (2014-12-14) fix incorrectly-named assert()
optimize PNG 1.47 (2014-12-14) 1/2/4-bit PNG support (both grayscale and paletted)
fix bug in interlaced PNG with user-specified channel count optimize PNG
1.46 (2014-08-26) fix broken tRNS chunk in non-paletted PNG fix bug in interlaced PNG with user-specified channel count
1.45 (2014-08-16) workaround MSVC-ARM internal compiler error by wrapping malloc 1.46 (2014-08-26) fix broken tRNS chunk in non-paletted PNG
1.45 (2014-08-16) workaround MSVC-ARM internal compiler error by wrapping malloc
See end of file for full revision history. See end of file for full revision history.
@ -2639,7 +2640,7 @@ static int stbi__process_frame_header(stbi__jpeg *z, int scan)
if (z->progressive) { if (z->progressive) {
z->img_comp[i].coeff_w = (z->img_comp[i].w2 + 7) >> 3; z->img_comp[i].coeff_w = (z->img_comp[i].w2 + 7) >> 3;
z->img_comp[i].coeff_h = (z->img_comp[i].h2 + 7) >> 3; z->img_comp[i].coeff_h = (z->img_comp[i].h2 + 7) >> 3;
z->img_comp[i].raw_coeff = malloc(z->img_comp[i].coeff_w * z->img_comp[i].coeff_h * 64 * sizeof(short) + 15); z->img_comp[i].raw_coeff = STBI_MALLOC(z->img_comp[i].coeff_w * z->img_comp[i].coeff_h * 64 * sizeof(short) + 15);
z->img_comp[i].coeff = (short*) (((size_t) z->img_comp[i].raw_coeff + 15) & ~15); z->img_comp[i].coeff = (short*) (((size_t) z->img_comp[i].raw_coeff + 15) & ~15);
} else { } else {
z->img_comp[i].coeff = 0; z->img_comp[i].coeff = 0;
@ -6176,133 +6177,134 @@ STBIDEF int stbi_info_from_callbacks(stbi_io_callbacks const *c, void *user, int
/* /*
revision history: revision history:
2.00 (2014-12-25) optimize JPG, including x86 SSE2 & NEON SIMD (ryg) 2.00b (2014-12-25) fix STBI_MALLOC in progressive JPEG
progressive JPEG (stb) 2.00 (2014-12-25) optimize JPG, including x86 SSE2 & NEON SIMD (ryg)
PGM/PPM support (Ken Miller) progressive JPEG (stb)
STBI_MALLOC,STBI_REALLOC,STBI_FREE PGM/PPM support (Ken Miller)
GIF bugfix -- seemingly never worked STBI_MALLOC,STBI_REALLOC,STBI_FREE
STBI_NO_*, STBI_ONLY_* GIF bugfix -- seemingly never worked
1.48 (2014-12-14) fix incorrectly-named assert() STBI_NO_*, STBI_ONLY_*
1.47 (2014-12-14) 1/2/4-bit PNG support, both direct and paletted (Omar Cornut & stb) 1.48 (2014-12-14) fix incorrectly-named assert()
optimize PNG (ryg) 1.47 (2014-12-14) 1/2/4-bit PNG support, both direct and paletted (Omar Cornut & stb)
fix bug in interlaced PNG with user-specified channel count (stb) optimize PNG (ryg)
1.46 (2014-08-26) fix bug in interlaced PNG with user-specified channel count (stb)
fix broken tRNS chunk (colorkey-style transparency) in non-paletted PNG 1.46 (2014-08-26)
1.45 (2014-08-16) fix broken tRNS chunk (colorkey-style transparency) in non-paletted PNG
fix MSVC-ARM internal compiler error by wrapping malloc 1.45 (2014-08-16)
1.44 (2014-08-07) fix MSVC-ARM internal compiler error by wrapping malloc
various warning fixes from Ronny Chevalier 1.44 (2014-08-07)
1.43 (2014-07-15) various warning fixes from Ronny Chevalier
fix MSVC-only compiler problem in code changed in 1.42 1.43 (2014-07-15)
1.42 (2014-07-09) fix MSVC-only compiler problem in code changed in 1.42
don't define _CRT_SECURE_NO_WARNINGS (affects user code) 1.42 (2014-07-09)
fixes to stbi__cleanup_jpeg path don't define _CRT_SECURE_NO_WARNINGS (affects user code)
added STBI_ASSERT to avoid requiring assert.h fixes to stbi__cleanup_jpeg path
1.41 (2014-06-25) added STBI_ASSERT to avoid requiring assert.h
fix search&replace from 1.36 that messed up comments/error messages 1.41 (2014-06-25)
1.40 (2014-06-22) fix search&replace from 1.36 that messed up comments/error messages
fix gcc struct-initialization warning 1.40 (2014-06-22)
1.39 (2014-06-15) fix gcc struct-initialization warning
fix to TGA optimization when req_comp != number of components in TGA; 1.39 (2014-06-15)
fix to GIF loading because BMP wasn't rewinding (whoops, no GIFs in my test suite) fix to TGA optimization when req_comp != number of components in TGA;
add support for BMP version 5 (more ignored fields) fix to GIF loading because BMP wasn't rewinding (whoops, no GIFs in my test suite)
1.38 (2014-06-06) add support for BMP version 5 (more ignored fields)
suppress MSVC warnings on integer casts truncating values 1.38 (2014-06-06)
fix accidental rename of 'skip' field of I/O suppress MSVC warnings on integer casts truncating values
1.37 (2014-06-04) fix accidental rename of 'skip' field of I/O
remove duplicate typedef 1.37 (2014-06-04)
1.36 (2014-06-03) remove duplicate typedef
convert to header file single-file library 1.36 (2014-06-03)
if de-iphone isn't set, load iphone images color-swapped instead of returning NULL convert to header file single-file library
1.35 (2014-05-27) if de-iphone isn't set, load iphone images color-swapped instead of returning NULL
various warnings 1.35 (2014-05-27)
fix broken STBI_SIMD path various warnings
fix bug where stbi_load_from_file no longer left file pointer in correct place fix broken STBI_SIMD path
fix broken non-easy path for 32-bit BMP (possibly never used) fix bug where stbi_load_from_file no longer left file pointer in correct place
TGA optimization by Arseny Kapoulkine fix broken non-easy path for 32-bit BMP (possibly never used)
1.34 (unknown) TGA optimization by Arseny Kapoulkine
use STBI_NOTUSED in stbi__resample_row_generic(), fix one more leak in tga failure case 1.34 (unknown)
1.33 (2011-07-14) use STBI_NOTUSED in stbi__resample_row_generic(), fix one more leak in tga failure case
make stbi_is_hdr work in STBI_NO_HDR (as specified), minor compiler-friendly improvements 1.33 (2011-07-14)
1.32 (2011-07-13) make stbi_is_hdr work in STBI_NO_HDR (as specified), minor compiler-friendly improvements
support for "info" function for all supported filetypes (SpartanJ) 1.32 (2011-07-13)
1.31 (2011-06-20) support for "info" function for all supported filetypes (SpartanJ)
a few more leak fixes, bug in PNG handling (SpartanJ) 1.31 (2011-06-20)
1.30 (2011-06-11) a few more leak fixes, bug in PNG handling (SpartanJ)
added ability to load files via callbacks to accomidate custom input streams (Ben Wenger) 1.30 (2011-06-11)
removed deprecated format-specific test/load functions added ability to load files via callbacks to accomidate custom input streams (Ben Wenger)
removed support for installable file formats (stbi_loader) -- would have been broken for IO callbacks anyway removed deprecated format-specific test/load functions
error cases in bmp and tga give messages and don't leak (Raymond Barbiero, grisha) removed support for installable file formats (stbi_loader) -- would have been broken for IO callbacks anyway
fix inefficiency in decoding 32-bit BMP (David Woo) error cases in bmp and tga give messages and don't leak (Raymond Barbiero, grisha)
1.29 (2010-08-16) fix inefficiency in decoding 32-bit BMP (David Woo)
various warning fixes from Aurelien Pocheville 1.29 (2010-08-16)
1.28 (2010-08-01) various warning fixes from Aurelien Pocheville
fix bug in GIF palette transparency (SpartanJ) 1.28 (2010-08-01)
1.27 (2010-08-01) fix bug in GIF palette transparency (SpartanJ)
cast-to-stbi_uc to fix warnings 1.27 (2010-08-01)
1.26 (2010-07-24) cast-to-stbi_uc to fix warnings
fix bug in file buffering for PNG reported by SpartanJ 1.26 (2010-07-24)
1.25 (2010-07-17) fix bug in file buffering for PNG reported by SpartanJ
refix trans_data warning (Won Chun) 1.25 (2010-07-17)
1.24 (2010-07-12) refix trans_data warning (Won Chun)
perf improvements reading from files on platforms with lock-heavy fgetc() 1.24 (2010-07-12)
minor perf improvements for jpeg perf improvements reading from files on platforms with lock-heavy fgetc()
deprecated type-specific functions so we'll get feedback if they're needed minor perf improvements for jpeg
attempt to fix trans_data warning (Won Chun) deprecated type-specific functions so we'll get feedback if they're needed
1.23 fixed bug in iPhone support attempt to fix trans_data warning (Won Chun)
1.22 (2010-07-10) 1.23 fixed bug in iPhone support
removed image *writing* support 1.22 (2010-07-10)
stbi_info support from Jetro Lauha removed image *writing* support
GIF support from Jean-Marc Lienher stbi_info support from Jetro Lauha
iPhone PNG-extensions from James Brown GIF support from Jean-Marc Lienher
warning-fixes from Nicolas Schulz and Janez Zemva (i.stbi__err. Janez (U+017D)emva) iPhone PNG-extensions from James Brown
1.21 fix use of 'stbi_uc' in header (reported by jon blow) warning-fixes from Nicolas Schulz and Janez Zemva (i.stbi__err. Janez (U+017D)emva)
1.20 added support for Softimage PIC, by Tom Seddon 1.21 fix use of 'stbi_uc' in header (reported by jon blow)
1.19 bug in interlaced PNG corruption check (found by ryg) 1.20 added support for Softimage PIC, by Tom Seddon
1.19 bug in interlaced PNG corruption check (found by ryg)
1.18 2008-08-02 1.18 2008-08-02
fix a threading bug (local mutable static) fix a threading bug (local mutable static)
1.17 support interlaced PNG 1.17 support interlaced PNG
1.16 major bugfix - stbi__convert_format converted one too many pixels 1.16 major bugfix - stbi__convert_format converted one too many pixels
1.15 initialize some fields for thread safety 1.15 initialize some fields for thread safety
1.14 fix threadsafe conversion bug 1.14 fix threadsafe conversion bug
header-file-only version (#define STBI_HEADER_FILE_ONLY before including) header-file-only version (#define STBI_HEADER_FILE_ONLY before including)
1.13 threadsafe 1.13 threadsafe
1.12 const qualifiers in the API 1.12 const qualifiers in the API
1.11 Support installable IDCT, colorspace conversion routines 1.11 Support installable IDCT, colorspace conversion routines
1.10 Fixes for 64-bit (don't use "unsigned long") 1.10 Fixes for 64-bit (don't use "unsigned long")
optimized upsampling by Fabian "ryg" Giesen optimized upsampling by Fabian "ryg" Giesen
1.09 Fix format-conversion for PSD code (bad global variables!) 1.09 Fix format-conversion for PSD code (bad global variables!)
1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz
1.07 attempt to fix C++ warning/errors again 1.07 attempt to fix C++ warning/errors again
1.06 attempt to fix C++ warning/errors again 1.06 attempt to fix C++ warning/errors again
1.05 fix TGA loading to return correct *comp and use good luminance calc 1.05 fix TGA loading to return correct *comp and use good luminance calc
1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free
1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR
1.02 support for (subset of) HDR files, float interface for preferred access to them 1.02 support for (subset of) HDR files, float interface for preferred access to them
1.01 fix bug: possible bug in handling right-side up bmps... not sure 1.01 fix bug: possible bug in handling right-side up bmps... not sure
fix bug: the stbi__bmp_load() and stbi__tga_load() functions didn't work at all fix bug: the stbi__bmp_load() and stbi__tga_load() functions didn't work at all
1.00 interface to zlib that skips zlib header 1.00 interface to zlib that skips zlib header
0.99 correct handling of alpha in palette 0.99 correct handling of alpha in palette
0.98 TGA loader by lonesock; dynamically add loaders (untested) 0.98 TGA loader by lonesock; dynamically add loaders (untested)
0.97 jpeg errors on too large a file; also catch another malloc failure 0.97 jpeg errors on too large a file; also catch another malloc failure
0.96 fix detection of invalid v value - particleman@mollyrocket forum 0.96 fix detection of invalid v value - particleman@mollyrocket forum
0.95 during header scan, seek to markers in case of padding 0.95 during header scan, seek to markers in case of padding
0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same
0.93 handle jpegtran output; verbose errors 0.93 handle jpegtran output; verbose errors
0.92 read 4,8,16,24,32-bit BMP files of several formats 0.92 read 4,8,16,24,32-bit BMP files of several formats
0.91 output 24-bit Windows 3.0 BMP files 0.91 output 24-bit Windows 3.0 BMP files
0.90 fix a few more warnings; bump version number to approach 1.0 0.90 fix a few more warnings; bump version number to approach 1.0
0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd
0.60 fix compiling as c++ 0.60 fix compiling as c++
0.59 fix warnings: merge Dave Moore's -Wall fixes 0.59 fix warnings: merge Dave Moore's -Wall fixes
0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian
0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less than 16 available 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less than 16 available
0.56 fix bug: zlib uncompressed mode len vs. nlen 0.56 fix bug: zlib uncompressed mode len vs. nlen
0.55 fix bug: restart_interval not initialized to 0 0.55 fix bug: restart_interval not initialized to 0
0.54 allow NULL for 'int *comp' 0.54 allow NULL for 'int *comp'
0.53 fix bug in png 3->4; speedup png decoding 0.53 fix bug in png 3->4; speedup png decoding
0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments
0.51 obey req_comp requests, 1-component jpegs return as 1-component, 0.51 obey req_comp requests, 1-component jpegs return as 1-component,
on 'test' only check type, not whether we support this variant on 'test' only check type, not whether we support this variant
0.50 first released version 0.50 first released version
*/ */