sprintf: warning fixes

This commit is contained in:
Sean Barrett 2020-02-05 03:15:41 -08:00
parent 6b38abed1f
commit cb9d4e9547

View File

@ -1363,7 +1363,7 @@ typedef struct stbsp__context {
char tmp[STB_SPRINTF_MIN]; char tmp[STB_SPRINTF_MIN];
} stbsp__context; } 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; stbsp__context *c = (stbsp__context *)user;
c->length += len; c->length += len;
@ -1373,7 +1373,8 @@ static char *stbsp__clamp_callback(char *buf, void *user, int len)
if (len) { if (len) {
if (buf != c->buf) { if (buf != c->buf) {
char *s, *d, *se; const char *s, *se;
char *d;
d = c->buf; d = c->buf;
s = buf; s = buf;
se = buf + len; se = buf + len;
@ -1390,10 +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 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 )
{ {
(void) buf;
stbsp__context * c = (stbsp__context*)user; stbsp__context * c = (stbsp__context*)user;
(void) sizeof(buf);
c->length += len; c->length += len;
return c->tmp; // go direct into buffer if you can return c->tmp; // go direct into buffer if you can