Prevent const qualifier being discarded in vfnprintg()

This commit is contained in:
Joel Bodenmann 2021-08-26 17:46:55 +02:00
parent cbf9c22adf
commit 2f82247223
2 changed files with 5 additions and 3 deletions

View File

@ -20,6 +20,7 @@ FIX: STM32LTDC driver: Fix bug in gdisp_lld_blit_area() which affected bl
FIX: Improve /demos/benchmarks/rectangles. FIX: Improve /demos/benchmarks/rectangles.
FIX: Win32 driver: Fix buffer position calculation in gdisp_lld_blit_area(). 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: 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 *** *** Release 2.9 ***

View File

@ -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 vfnprintg(GFILE *f, int maxlen, const char *fmt, va_list arg) {
int ret; int ret;
char *p, *s, c, filler; char *p, c, filler;
const char *s;
int i, precision, width; int i, precision, width;
gBool is_long, left_align; gBool is_long, left_align;
long l; long l;
@ -80,7 +81,7 @@ int vfnprintg(GFILE *f, int maxlen, const char *fmt, va_list arg) {
} }
fmt++; fmt++;
p = s = tmpbuf; s = p = tmpbuf;
left_align = gFalse; left_align = gFalse;
filler = ' '; filler = ' ';
width = 0; width = 0;
@ -140,7 +141,7 @@ int vfnprintg(GFILE *f, int maxlen, const char *fmt, va_list arg) {
s = "(null)"; s = "(null)";
if (precision == 0) if (precision == 0)
precision = 32767; precision = 32767;
for (p = s; *p && (--precision >= 0); p++); for (p = (char*)s; *p && (--precision >= 0); p++);
break; break;
case 'D': case 'D':
case 'd': case 'd':