diff --git a/stb_c_lexer.h b/stb_c_lexer.h index e91c6c3..bcb82e1 100644 --- a/stb_c_lexer.h +++ b/stb_c_lexer.h @@ -30,6 +30,9 @@ // - haven't implemented support for unicode CLEX_char // - need to expand error reporting so you don't just get "CLEX_parse_error" // +// Contributors: +// Arpad Goretity (bugfix) +// // LICENSE // // This software is dual-licensed to the public domain and under the following @@ -84,7 +87,7 @@ #define STB_C_LEX_DISCARD_PREPROCESSOR Y // discard C-preprocessor directives (e.g. after prepocess // still have #line, #pragma, etc) -//#define STB_C_LEX_ISWHITE(str) ... // return length in bytes of first character if it is whitespace +//#define STB_C_LEX_ISWHITE(str) ... // return length in bytes of whitespace characters if first char is whitespace #define STB_C_LEXER_DEFINITIONS // This line prevents the header file from replacing your definitions // --END-- @@ -459,7 +462,7 @@ int stb_c_lexer_get_token(stb_lexer *lexer) int n; n = STB_C_LEX_ISWHITE(p); if (n == 0) break; - if (lexer->eof && lexer+n > lexer->eof) + if (lexer->eof && lexer->eof - lexer->parse_point < n) return stb__clex_token(tok, CLEX_parse_error, p,lexer->eof-1); p += n; } diff --git a/stb_sprintf.h b/stb_sprintf.h index a017ecc..472f805 100644 --- a/stb_sprintf.h +++ b/stb_sprintf.h @@ -769,9 +769,12 @@ STBSP__PUBLICDEF int STB_SPRINTF_DECORATE( vsprintfcb )( STBSP_SPRINTFCB * callb STBSP__PUBLICDEF int STB_SPRINTF_DECORATE( sprintf )( char * buf, char const * fmt, ... ) { + int result; va_list va; va_start( va, fmt ); - return STB_SPRINTF_DECORATE( vsprintfcb )( 0, 0, buf, fmt, va ); + result = STB_SPRINTF_DECORATE( vsprintfcb )( 0, 0, buf, fmt, va ); + va_end(va); + return result; } typedef struct stbsp__context @@ -827,10 +830,14 @@ STBSP__PUBLICDEF int STB_SPRINTF_DECORATE( vsnprintf )( char * buf, int count, c STBSP__PUBLICDEF int STB_SPRINTF_DECORATE( snprintf )( char * buf, int count, char const * fmt, ... ) { + int result; va_list va; va_start( va, fmt ); - return STB_SPRINTF_DECORATE( vsnprintf )( buf, count, fmt, va ); + result = STB_SPRINTF_DECORATE( vsnprintf )( buf, count, fmt, va ); + va_end(va); + + return result; } STBSP__PUBLICDEF int STB_SPRINTF_DECORATE( vsprintf )( char * buf, char const * fmt, va_list va ) diff --git a/stb_truetype.h b/stb_truetype.h index e1b6d4c..aa4dd22 100644 --- a/stb_truetype.h +++ b/stb_truetype.h @@ -534,7 +534,7 @@ typedef struct stbrp_rect stbrp_rect; STBTT_DEF int stbtt_PackBegin(stbtt_pack_context *spc, unsigned char *pixels, int width, int height, int stride_in_bytes, int padding, void *alloc_context); // Initializes a packing context stored in the passed-in stbtt_pack_context. // Future calls using this context will pack characters into the bitmap passed -// in here: a 1-channel bitmap that is weight x height. stride_in_bytes is +// in here: a 1-channel bitmap that is width * height. stride_in_bytes is // the distance from one row to the next (or 0 to mean they are packed tightly // together). "padding" is the amount of padding to leave between each // character (normally you want '1' for bitmaps you'll use as textures with