From cb9d4e9547a59fc0ef89e2a9a9a688dddc6e735a Mon Sep 17 00:00:00 2001 From: Sean Barrett Date: Wed, 5 Feb 2020 03:15:41 -0800 Subject: [PATCH] sprintf: warning fixes --- stb_sprintf.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stb_sprintf.h b/stb_sprintf.h index 7003c32..a762846 100644 --- a/stb_sprintf.h +++ b/stb_sprintf.h @@ -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,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 } -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; + (void) sizeof(buf); c->length += len; return c->tmp; // go direct into buffer if you can