From 549b20461e3c77c35ac692c56a9c439d25ec149e Mon Sep 17 00:00:00 2001 From: BlackMATov Date: Mon, 20 Apr 2020 15:46:12 +0700 Subject: [PATCH] update stb to latest master --- modules/stb | 2 +- sources/3rdparty/stb/stb_image.h | 14 +++++------ sources/3rdparty/stb/stb_sprintf.h | 14 ++++++----- sources/3rdparty/stb/stb_truetype.h | 36 ++++++++++++++++++----------- 4 files changed, 38 insertions(+), 28 deletions(-) diff --git a/modules/stb b/modules/stb index 0cbdb25d..f54acd4e 160000 --- a/modules/stb +++ b/modules/stb @@ -1 +1 @@ -Subproject commit 0cbdb25d2ba3b89367fdf280096cab7bccec38f8 +Subproject commit f54acd4e13430c5122cab4ca657705c84aa61b08 diff --git a/sources/3rdparty/stb/stb_image.h b/sources/3rdparty/stb/stb_image.h index d529acc4..2857f05d 100644 --- a/sources/3rdparty/stb/stb_image.h +++ b/sources/3rdparty/stb/stb_image.h @@ -1,4 +1,4 @@ -/* stb_image - v2.23 - public domain image loader - http://nothings.org/stb +/* stb_image - v2.25 - public domain image loader - http://nothings.org/stb no warranty implied; use at your own risk Do this: @@ -48,6 +48,7 @@ LICENSE RECENT REVISION HISTORY: + 2.25 (2020-02-02) fix warnings 2.24 (2020-02-02) fix warnings; thread-local failure_reason and flip_vertically 2.23 (2019-08-11) fix clang static analysis warning 2.22 (2019-03-04) gif fixes, fix warnings @@ -92,7 +93,7 @@ RECENT REVISION HISTORY: Carmelo J Fdez-Aguera Bug & warning fixes - Marc LeBlanc David Woo Guillaume George Martins Mozeiko Alexander Veselov + Marc LeBlanc David Woo Guillaume George Martins Mozeiko Christpher Lloyd Jerry Jansson Joseph Thomson Phil Jordan Dave Moore Roy Eltham Hayaki Saito Nathan Reed Won Chun Luke Graham Johan Duparc Nick Verigakis @@ -107,8 +108,7 @@ RECENT REVISION HISTORY: Julian Raschke Gregory Mullen Baldur Karlsson github:poppolopoppo Christian Floisand Kevin Schmidt JR Smith github:darealshinji Brad Weinberger Matvey Cherevko github:Michaelangel007 - Blazej Dariusz Roszkowski - + Blazej Dariusz Roszkowski Alexander Veselov */ #ifndef STBI_INCLUDE_STB_IMAGE_H @@ -473,9 +473,7 @@ STBIDEF void stbi_set_flip_vertically_on_load(int flag_true_if_should_flip); // as above, but only applies to images loaded on the thread that calls the function // this function is only available if your compiler supports thread-local variables; // calling it will fail to link if your compiler doesn't -#if __cplusplus >= 201103L || __STDC_VERSION_ >= 201112L || defined(__GNUC__) || defined(_MSC_VER) STBIDEF void stbi_set_flip_vertically_on_load_thread(int flag_true_if_should_flip); -#endif // ZLIB client - used by PNG, available for other purposes @@ -574,9 +572,9 @@ STBIDEF int stbi_zlib_decode_noheader_buffer(char *obuffer, int olen, const ch #endif #ifndef STBI_NO_THREAD_LOCALS - #if __cplusplus >= 201103L + #if defined(__cplusplus) && __cplusplus >= 201103L #define STBI_THREAD_LOCAL thread_local - #elif __STDC_VERSION_ >= 201112L + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L #define STBI_THREAD_LOCAL _Thread_local #elif defined(__GNUC__) #define STBI_THREAD_LOCAL __thread diff --git a/sources/3rdparty/stb/stb_sprintf.h b/sources/3rdparty/stb/stb_sprintf.h index 630d851a..ae61bdcd 100644 --- a/sources/3rdparty/stb/stb_sprintf.h +++ b/sources/3rdparty/stb/stb_sprintf.h @@ -1,4 +1,4 @@ -// stb_sprintf - v1.07 - public domain snprintf() implementation +// stb_sprintf - v1.08 - public domain snprintf() implementation // originally by Jeff Roberts / RAD Game Tools, 2015/10/20 // http://github.com/nothings/stb // @@ -182,7 +182,7 @@ PERFORMANCE vs MSVC 2008 32-/64-bit (GCC is even slower than MSVC): #ifndef STB_SPRINTF_MIN #define STB_SPRINTF_MIN 512 // how many characters per callback #endif -typedef char *STBSP_SPRINTFCB(char *buf, void *user, int len); +typedef char *STBSP_SPRINTFCB(const char *buf, void *user, int len); #ifndef STB_SPRINTF_DECORATE #define STB_SPRINTF_DECORATE(name) stbsp_##name // define this before including if you want to change the names @@ -1363,7 +1363,7 @@ typedef struct stbsp__context { char tmp[STB_SPRINTF_MIN]; } stbsp__context; -static char *stbsp__clamp_callback(char *buf, void *user, int len) +static char *stbsp__clamp_callback(const char *buf, void *user, int len) { stbsp__context *c = (stbsp__context *)user; c->length += len; @@ -1373,7 +1373,8 @@ static char *stbsp__clamp_callback(char *buf, void *user, int len) if (len) { if (buf != c->buf) { - char *s, *d, *se; + const char *s, *se; + char *d; d = c->buf; s = buf; se = buf + len; @@ -1390,9 +1391,10 @@ static char *stbsp__clamp_callback(char *buf, void *user, int len) return (c->count >= STB_SPRINTF_MIN) ? c->buf : c->tmp; // go direct into buffer if you can } -static char * stbsp__count_clamp_callback( char * buf, void * user, int len ) +static char * stbsp__count_clamp_callback( const char * buf, void * user, int len ) { stbsp__context * c = (stbsp__context*)user; + (void) sizeof(buf); c->length += len; return c->tmp; // go direct into buffer if you can @@ -1696,7 +1698,7 @@ static stbsp__int32 stbsp__real_to_str(char const **start, stbsp__uint32 *len, c if (expo == 0) // is zero or denormal { - if ((bits << 1) == 0) // do zero + if (((stbsp__uint64) bits << 1) == 0) // do zero { *decimal_pos = 1; *start = out; diff --git a/sources/3rdparty/stb/stb_truetype.h b/sources/3rdparty/stb/stb_truetype.h index 25d19685..935a6de2 100644 --- a/sources/3rdparty/stb/stb_truetype.h +++ b/sources/3rdparty/stb/stb_truetype.h @@ -1,5 +1,14 @@ -// stb_truetype.h - v1.23 - public domain -// authored from 2009-2019 by Sean Barrett / RAD Game Tools +// stb_truetype.h - v1.24 - public domain +// authored from 2009-2020 by Sean Barrett / RAD Game Tools +// +// ======================================================================= +// +// NO SECURITY GUARANTEE -- DO NOT USE THIS ON UNTRUSTED FONT FILES +// +// This library does no range checking of the offsets found in the file, +// meaning an attacker can use it to read arbitrary memory. +// +// ======================================================================= // // This library processes TrueType files: // parse files @@ -32,11 +41,11 @@ // Daniel Ribeiro Maciel // // Bug/warning reports/fixes: -// "Zer" on mollyrocket Fabian "ryg" Giesen -// Cass Everitt Martins Mozeiko -// stoiko (Haemimont Games) Cap Petschulat -// Brian Hook Omar Cornut -// Walter van Niftrik github:aloucks +// "Zer" on mollyrocket Fabian "ryg" Giesen github:NiLuJe +// Cass Everitt Martins Mozeiko github:aloucks +// stoiko (Haemimont Games) Cap Petschulat github:oyvindjam +// Brian Hook Omar Cornut github:vassvik +// Walter van Niftrik Ryan Griege // David Gow Peter LaValle // David Given Sergey Popov // Ivan-Assen Ivanov Giumo X. Clanjor @@ -44,12 +53,12 @@ // Johan Duparc Thomas Fields // Hou Qiming Derek Vinyard // Rob Loach Cort Stratton -// Kenney Phillis Jr. github:oyvindjam -// Brian Costabile github:vassvik -// Ken Voskuil (kaesve) Ryan Griege +// Kenney Phillis Jr. Brian Costabile +// Ken Voskuil (kaesve) // // VERSION HISTORY // +// 1.24 (2020-02-05) fix warning // 1.23 (2020-02-02) query SVG data for glyphs; query whole kerning table (but only kern not GPOS) // 1.22 (2019-08-11) minimize missing-glyph duplication; fix kerning if both 'GPOS' and 'kern' are defined // 1.21 (2019-02-25) fix warning @@ -2700,11 +2709,12 @@ STBTT_DEF int stbtt_GetGlyphSVG(const stbtt_fontinfo *info, int gl, const char * stbtt_uint8 *data = info->data; stbtt_uint8 *svg_doc; - if(info->svg == 0) + if (info->svg == 0) return 0; - if(svg_doc = stbtt_FindSVGDoc(info, gl)) { - *svg = (char *)data + info->svg + ttULONG(svg_doc + 4); + svg_doc = stbtt_FindSVGDoc(info, gl); + if (svg_doc != NULL) { + *svg = (char *) data + info->svg + ttULONG(svg_doc + 4); return ttULONG(svg_doc + 8); } else { return 0;