diff --git a/changelog.txt b/changelog.txt index 98e9a280..445c482e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -20,6 +20,7 @@ FIX: STM32LTDC driver: Fix bug in gdisp_lld_blit_area() which affected bl FIX: Improve /demos/benchmarks/rectangles. FIX: Win32 driver: Fix buffer position calculation in gdisp_lld_blit_area(). FIX: Win32 driver: Fix memory leak / invalid pointer to free() when re-calculating buffer position in a specific situation. +FIX: Prevent const qualifier being discarded in vfnprintg() *** Release 2.9 *** diff --git a/src/gfile/gfile_printg.c b/src/gfile/gfile_printg.c index 94a16142..ec93d41f 100644 --- a/src/gfile/gfile_printg.c +++ b/src/gfile/gfile_printg.c @@ -54,7 +54,8 @@ static char *ltoa_wd(char *p, long num, unsigned radix, long divisor) { int vfnprintg(GFILE *f, int maxlen, const char *fmt, va_list arg) { int ret; - char *p, *s, c, filler; + char *p, c, filler; + const char *s; int i, precision, width; gBool is_long, left_align; long l; @@ -80,7 +81,7 @@ int vfnprintg(GFILE *f, int maxlen, const char *fmt, va_list arg) { } fmt++; - p = s = tmpbuf; + s = p = tmpbuf; left_align = gFalse; filler = ' '; width = 0; @@ -140,7 +141,7 @@ int vfnprintg(GFILE *f, int maxlen, const char *fmt, va_list arg) { s = "(null)"; if (precision == 0) precision = 32767; - for (p = s; *p && (--precision >= 0); p++); + for (p = (char*)s; *p && (--precision >= 0); p++); break; case 'D': case 'd':