mirror of
https://github.com/nothings/stb
synced 2024-12-14 20:12:34 +03:00
stb_truetype: comment typo
stb_c_lexer: end-of-array wrapped overflow bug
This commit is contained in:
parent
dead3815e2
commit
0bd0a9abc4
@ -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;
|
||||
}
|
||||
|
@ -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 )
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user