fix missing STBI_MALLOC
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Sean Barrett · committed by Sean Barrett · parent 6e0ae49 · Browse files · 1 file·+144 added−142 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+144 added−142 removed
- other:+144 added−142 removed
Provenance
- Commit
a7c8694- Tree
d140b92- Author
Sean Barrett <sean2@nothings.org>- Committer
Sean Barrett <sean2@nothings.org>- Parent
6e0ae49
1 file changed+144 added−142 removed
modified:stb_image.h+144 added-142 removed
1-/* stb_image - v2.00 - public domain image loader - http://nothings.org/stb_image.h1+/* stb_image - v2.00b - public domain image loader - http://nothings.org/stb_image.h2 no warranty implied; use at your own risk3 4 Do this:5 #define STB_IMAGE_IMPLEMENTATION136 unmodified lines142 near-term back-compatibility use.143 144 145 Latest revision history:146+ 2.00b (2014-12-25) fix STBI_MALLOC in progressive JPEG146- 2.00 (2014-12-25) optimize JPEG, including x86 SSE2 & ARM NEON SIMD147- progressive JPEG148- PGM/PPM support149- STBI_MALLOC,STBI_REALLOC,STBI_FREE150- STBI_NO_*, STBI_ONLY_*151- GIF bugfix152- 1.48 (2014-12-14) fix incorrectly-named assert()153- 1.47 (2014-12-14) 1/2/4-bit PNG support (both grayscale and paletted)154- optimize PNG155- fix bug in interlaced PNG with user-specified channel count156- 1.46 (2014-08-26) fix broken tRNS chunk in non-paletted PNG157- 1.45 (2014-08-16) workaround MSVC-ARM internal compiler error by wrapping malloc147+ 2.00 (2014-12-25) optimize JPEG, including x86 SSE2 & ARM NEON SIMD148+ progressive JPEG149+ PGM/PPM support150+ STBI_MALLOC,STBI_REALLOC,STBI_FREE151+ STBI_NO_*, STBI_ONLY_*152+ GIF bugfix153+ 1.48 (2014-12-14) fix incorrectly-named assert()154+ 1.47 (2014-12-14) 1/2/4-bit PNG support (both grayscale and paletted)155+ optimize PNG156+ fix bug in interlaced PNG with user-specified channel count157+ 1.46 (2014-08-26) fix broken tRNS chunk in non-paletted PNG158+ 1.45 (2014-08-16) workaround MSVC-ARM internal compiler error by wrapping malloc159 160 See end of file for full revision history.161 162 2476 unmodified lines2639 z->img_comp[i].linebuf = NULL;2640 if (z->progressive) {2641 z->img_comp[i].coeff_w = (z->img_comp[i].w2 + 7) >> 3;2642 z->img_comp[i].coeff_h = (z->img_comp[i].h2 + 7) >> 3;2642- z->img_comp[i].raw_coeff = malloc(z->img_comp[i].coeff_w * z->img_comp[i].coeff_h * 64 * sizeof(short) + 15);2643+ z->img_comp[i].raw_coeff = STBI_MALLOC(z->img_comp[i].coeff_w * z->img_comp[i].coeff_h * 64 * sizeof(short) + 15);2644 z->img_comp[i].coeff = (short*) (((size_t) z->img_comp[i].raw_coeff + 15) & ~15);2645 } else {2646 z->img_comp[i].coeff = 0;2647 z->img_comp[i].raw_coeff = 0;3528 unmodified lines6176 #endif // STB_IMAGE_IMPLEMENTATION6177 6178 /*6179 revision history:6180+ 2.00b (2014-12-25) fix STBI_MALLOC in progressive JPEG6179- 2.00 (2014-12-25) optimize JPG, including x86 SSE2 & NEON SIMD (ryg)6180- progressive JPEG (stb)6181- PGM/PPM support (Ken Miller)6182- STBI_MALLOC,STBI_REALLOC,STBI_FREE6183- GIF bugfix -- seemingly never worked6184- STBI_NO_*, STBI_ONLY_*6185- 1.48 (2014-12-14) fix incorrectly-named assert()6186- 1.47 (2014-12-14) 1/2/4-bit PNG support, both direct and paletted (Omar Cornut & stb)6187- optimize PNG (ryg)6188- fix bug in interlaced PNG with user-specified channel count (stb)6189- 1.46 (2014-08-26)6190- fix broken tRNS chunk (colorkey-style transparency) in non-paletted PNG6191- 1.45 (2014-08-16)6192- fix MSVC-ARM internal compiler error by wrapping malloc6193- 1.44 (2014-08-07)6194- various warning fixes from Ronny Chevalier6195- 1.43 (2014-07-15)6196- fix MSVC-only compiler problem in code changed in 1.426197- 1.42 (2014-07-09)6198- don't define _CRT_SECURE_NO_WARNINGS (affects user code)6199- fixes to stbi__cleanup_jpeg path6200- added STBI_ASSERT to avoid requiring assert.h6201- 1.41 (2014-06-25)6202- fix search&replace from 1.36 that messed up comments/error messages6203- 1.40 (2014-06-22)6204- fix gcc struct-initialization warning6205- 1.39 (2014-06-15)6206- fix to TGA optimization when req_comp != number of components in TGA;6207- fix to GIF loading because BMP wasn't rewinding (whoops, no GIFs in my test suite)6208- add support for BMP version 5 (more ignored fields)6209- 1.38 (2014-06-06)6210- suppress MSVC warnings on integer casts truncating values6211- fix accidental rename of 'skip' field of I/O6212- 1.37 (2014-06-04)6213- remove duplicate typedef6214- 1.36 (2014-06-03)6215- convert to header file single-file library6216- if de-iphone isn't set, load iphone images color-swapped instead of returning NULL6217- 1.35 (2014-05-27)6218- various warnings6219- fix broken STBI_SIMD path6220- fix bug where stbi_load_from_file no longer left file pointer in correct place6221- fix broken non-easy path for 32-bit BMP (possibly never used)6222- TGA optimization by Arseny Kapoulkine6223- 1.34 (unknown)6224- use STBI_NOTUSED in stbi__resample_row_generic(), fix one more leak in tga failure case6225- 1.33 (2011-07-14)6226- make stbi_is_hdr work in STBI_NO_HDR (as specified), minor compiler-friendly improvements6227- 1.32 (2011-07-13)6228- support for "info" function for all supported filetypes (SpartanJ)6229- 1.31 (2011-06-20)6230- a few more leak fixes, bug in PNG handling (SpartanJ)6231- 1.30 (2011-06-11)6232- added ability to load files via callbacks to accomidate custom input streams (Ben Wenger)6233- removed deprecated format-specific test/load functions6234- removed support for installable file formats (stbi_loader) -- would have been broken for IO callbacks anyway6235- error cases in bmp and tga give messages and don't leak (Raymond Barbiero, grisha)6236- fix inefficiency in decoding 32-bit BMP (David Woo)6237- 1.29 (2010-08-16)6238- various warning fixes from Aurelien Pocheville6239- 1.28 (2010-08-01)6240- fix bug in GIF palette transparency (SpartanJ)6241- 1.27 (2010-08-01)6242- cast-to-stbi_uc to fix warnings6243- 1.26 (2010-07-24)6244- fix bug in file buffering for PNG reported by SpartanJ6245- 1.25 (2010-07-17)6246- refix trans_data warning (Won Chun)6247- 1.24 (2010-07-12)6248- perf improvements reading from files on platforms with lock-heavy fgetc()6249- minor perf improvements for jpeg6250- deprecated type-specific functions so we'll get feedback if they're needed6251- attempt to fix trans_data warning (Won Chun)6252- 1.23 fixed bug in iPhone support6253- 1.22 (2010-07-10)6254- removed image *writing* support6255- stbi_info support from Jetro Lauha6256- GIF support from Jean-Marc Lienher6257- iPhone PNG-extensions from James Brown6258- warning-fixes from Nicolas Schulz and Janez Zemva (i.stbi__err. Janez (U+017D)emva)6259- 1.21 fix use of 'stbi_uc' in header (reported by jon blow)6260- 1.20 added support for Softimage PIC, by Tom Seddon6261- 1.19 bug in interlaced PNG corruption check (found by ryg)6181+ 2.00 (2014-12-25) optimize JPG, including x86 SSE2 & NEON SIMD (ryg)6182+ progressive JPEG (stb)6183+ PGM/PPM support (Ken Miller)6184+ STBI_MALLOC,STBI_REALLOC,STBI_FREE6185+ GIF bugfix -- seemingly never worked6186+ STBI_NO_*, STBI_ONLY_*6187+ 1.48 (2014-12-14) fix incorrectly-named assert()6188+ 1.47 (2014-12-14) 1/2/4-bit PNG support, both direct and paletted (Omar Cornut & stb)6189+ optimize PNG (ryg)6190+ fix bug in interlaced PNG with user-specified channel count (stb)6191+ 1.46 (2014-08-26)6192+ fix broken tRNS chunk (colorkey-style transparency) in non-paletted PNG6193+ 1.45 (2014-08-16)6194+ fix MSVC-ARM internal compiler error by wrapping malloc6195+ 1.44 (2014-08-07)6196+ various warning fixes from Ronny Chevalier6197+ 1.43 (2014-07-15)6198+ fix MSVC-only compiler problem in code changed in 1.426199+ 1.42 (2014-07-09)6200+ don't define _CRT_SECURE_NO_WARNINGS (affects user code)6201+ fixes to stbi__cleanup_jpeg path6202+ added STBI_ASSERT to avoid requiring assert.h6203+ 1.41 (2014-06-25)6204+ fix search&replace from 1.36 that messed up comments/error messages6205+ 1.40 (2014-06-22)6206+ fix gcc struct-initialization warning6207+ 1.39 (2014-06-15)6208+ fix to TGA optimization when req_comp != number of components in TGA;6209+ fix to GIF loading because BMP wasn't rewinding (whoops, no GIFs in my test suite)6210+ add support for BMP version 5 (more ignored fields)6211+ 1.38 (2014-06-06)6212+ suppress MSVC warnings on integer casts truncating values6213+ fix accidental rename of 'skip' field of I/O6214+ 1.37 (2014-06-04)6215+ remove duplicate typedef6216+ 1.36 (2014-06-03)6217+ convert to header file single-file library6218+ if de-iphone isn't set, load iphone images color-swapped instead of returning NULL6219+ 1.35 (2014-05-27)6220+ various warnings6221+ fix broken STBI_SIMD path6222+ fix bug where stbi_load_from_file no longer left file pointer in correct place6223+ fix broken non-easy path for 32-bit BMP (possibly never used)6224+ TGA optimization by Arseny Kapoulkine6225+ 1.34 (unknown)6226+ use STBI_NOTUSED in stbi__resample_row_generic(), fix one more leak in tga failure case6227+ 1.33 (2011-07-14)6228+ make stbi_is_hdr work in STBI_NO_HDR (as specified), minor compiler-friendly improvements6229+ 1.32 (2011-07-13)6230+ support for "info" function for all supported filetypes (SpartanJ)6231+ 1.31 (2011-06-20)6232+ a few more leak fixes, bug in PNG handling (SpartanJ)6233+ 1.30 (2011-06-11)6234+ added ability to load files via callbacks to accomidate custom input streams (Ben Wenger)6235+ removed deprecated format-specific test/load functions6236+ removed support for installable file formats (stbi_loader) -- would have been broken for IO callbacks anyway6237+ error cases in bmp and tga give messages and don't leak (Raymond Barbiero, grisha)6238+ fix inefficiency in decoding 32-bit BMP (David Woo)6239+ 1.29 (2010-08-16)6240+ various warning fixes from Aurelien Pocheville6241+ 1.28 (2010-08-01)6242+ fix bug in GIF palette transparency (SpartanJ)6243+ 1.27 (2010-08-01)6244+ cast-to-stbi_uc to fix warnings6245+ 1.26 (2010-07-24)6246+ fix bug in file buffering for PNG reported by SpartanJ6247+ 1.25 (2010-07-17)6248+ refix trans_data warning (Won Chun)6249+ 1.24 (2010-07-12)6250+ perf improvements reading from files on platforms with lock-heavy fgetc()6251+ minor perf improvements for jpeg6252+ deprecated type-specific functions so we'll get feedback if they're needed6253+ attempt to fix trans_data warning (Won Chun)6254+ 1.23 fixed bug in iPhone support6255+ 1.22 (2010-07-10)6256+ removed image *writing* support6257+ stbi_info support from Jetro Lauha6258+ GIF support from Jean-Marc Lienher6259+ iPhone PNG-extensions from James Brown6260+ warning-fixes from Nicolas Schulz and Janez Zemva (i.stbi__err. Janez (U+017D)emva)6261+ 1.21 fix use of 'stbi_uc' in header (reported by jon blow)6262+ 1.20 added support for Softimage PIC, by Tom Seddon6263+ 1.19 bug in interlaced PNG corruption check (found by ryg)6264 1.18 2008-08-026263- fix a threading bug (local mutable static)6264- 1.17 support interlaced PNG6265- 1.16 major bugfix - stbi__convert_format converted one too many pixels6266- 1.15 initialize some fields for thread safety6267- 1.14 fix threadsafe conversion bug6268- header-file-only version (#define STBI_HEADER_FILE_ONLY before including)6269- 1.13 threadsafe6270- 1.12 const qualifiers in the API6271- 1.11 Support installable IDCT, colorspace conversion routines6272- 1.10 Fixes for 64-bit (don't use "unsigned long")6273- optimized upsampling by Fabian "ryg" Giesen6274- 1.09 Fix format-conversion for PSD code (bad global variables!)6275- 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz6276- 1.07 attempt to fix C++ warning/errors again6277- 1.06 attempt to fix C++ warning/errors again6278- 1.05 fix TGA loading to return correct *comp and use good luminance calc6279- 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free6280- 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR6281- 1.02 support for (subset of) HDR files, float interface for preferred access to them6282- 1.01 fix bug: possible bug in handling right-side up bmps... not sure6283- fix bug: the stbi__bmp_load() and stbi__tga_load() functions didn't work at all6284- 1.00 interface to zlib that skips zlib header6285- 0.99 correct handling of alpha in palette6286- 0.98 TGA loader by lonesock; dynamically add loaders (untested)6287- 0.97 jpeg errors on too large a file; also catch another malloc failure6288- 0.96 fix detection of invalid v value - particleman@mollyrocket forum6289- 0.95 during header scan, seek to markers in case of padding6290- 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same6291- 0.93 handle jpegtran output; verbose errors6292- 0.92 read 4,8,16,24,32-bit BMP files of several formats6293- 0.91 output 24-bit Windows 3.0 BMP files6294- 0.90 fix a few more warnings; bump version number to approach 1.06295- 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd6296- 0.60 fix compiling as c++6297- 0.59 fix warnings: merge Dave Moore's -Wall fixes6298- 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian6299- 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less than 16 available6300- 0.56 fix bug: zlib uncompressed mode len vs. nlen6301- 0.55 fix bug: restart_interval not initialized to 06302- 0.54 allow NULL for 'int *comp'6303- 0.53 fix bug in png 3->4; speedup png decoding6304- 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments6305- 0.51 obey req_comp requests, 1-component jpegs return as 1-component,6306- on 'test' only check type, not whether we support this variant6307- 0.50 first released version6265+ fix a threading bug (local mutable static)6266+ 1.17 support interlaced PNG6267+ 1.16 major bugfix - stbi__convert_format converted one too many pixels6268+ 1.15 initialize some fields for thread safety6269+ 1.14 fix threadsafe conversion bug6270+ header-file-only version (#define STBI_HEADER_FILE_ONLY before including)6271+ 1.13 threadsafe6272+ 1.12 const qualifiers in the API6273+ 1.11 Support installable IDCT, colorspace conversion routines6274+ 1.10 Fixes for 64-bit (don't use "unsigned long")6275+ optimized upsampling by Fabian "ryg" Giesen6276+ 1.09 Fix format-conversion for PSD code (bad global variables!)6277+ 1.08 Thatcher Ulrich's PSD code integrated by Nicolas Schulz6278+ 1.07 attempt to fix C++ warning/errors again6279+ 1.06 attempt to fix C++ warning/errors again6280+ 1.05 fix TGA loading to return correct *comp and use good luminance calc6281+ 1.04 default float alpha is 1, not 255; use 'void *' for stbi_image_free6282+ 1.03 bugfixes to STBI_NO_STDIO, STBI_NO_HDR6283+ 1.02 support for (subset of) HDR files, float interface for preferred access to them6284+ 1.01 fix bug: possible bug in handling right-side up bmps... not sure6285+ fix bug: the stbi__bmp_load() and stbi__tga_load() functions didn't work at all6286+ 1.00 interface to zlib that skips zlib header6287+ 0.99 correct handling of alpha in palette6288+ 0.98 TGA loader by lonesock; dynamically add loaders (untested)6289+ 0.97 jpeg errors on too large a file; also catch another malloc failure6290+ 0.96 fix detection of invalid v value - particleman@mollyrocket forum6291+ 0.95 during header scan, seek to markers in case of padding6292+ 0.94 STBI_NO_STDIO to disable stdio usage; rename all #defines the same6293+ 0.93 handle jpegtran output; verbose errors6294+ 0.92 read 4,8,16,24,32-bit BMP files of several formats6295+ 0.91 output 24-bit Windows 3.0 BMP files6296+ 0.90 fix a few more warnings; bump version number to approach 1.06297+ 0.61 bugfixes due to Marc LeBlanc, Christopher Lloyd6298+ 0.60 fix compiling as c++6299+ 0.59 fix warnings: merge Dave Moore's -Wall fixes6300+ 0.58 fix bug: zlib uncompressed mode len/nlen was wrong endian6301+ 0.57 fix bug: jpg last huffman symbol before marker was >9 bits but less than 16 available6302+ 0.56 fix bug: zlib uncompressed mode len vs. nlen6303+ 0.55 fix bug: restart_interval not initialized to 06304+ 0.54 allow NULL for 'int *comp'6305+ 0.53 fix bug in png 3->4; speedup png decoding6306+ 0.52 png handles req_comp=3,4 directly; minor cleanup; jpeg comments6307+ 0.51 obey req_comp requests, 1-component jpegs return as 1-component,6308+ on 'test' only check type, not whether we support this variant6309+ 0.50 first released version6310 */