From: simon Date: Wed, 9 Jul 2008 17:06:29 +0000 (+0000) Subject: Turn the numeric parameter to err_sfntbadglyph from wchar_t to X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/halibut/commitdiff_plain/9e0fd4a7ae4ab89d8b38eeec4f02c2f9f4524a98 Turn the numeric parameter to err_sfntbadglyph from wchar_t to unsigned int, after a correspondent mentioned that DJGPP produces a very scary warning about integer promotion making use of the former in va_arg non-portable. Whether or not that's standards-justifiable, it's certainly the case that we were casting _to_ wchar_t from unsigned int in all cases of this error actually being used, so the simplest thing is just to transfer the number through va_arg as unsigned. git-svn-id: svn://svn.tartarus.org/sgt/halibut@8112 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/error.c b/error.c index 2a2c6cd..7897d7a 100644 --- a/error.c +++ b/error.c @@ -18,7 +18,8 @@ static void do_error(int code, va_list ap) { char c; int i, j; char *sp, *sp2; - wchar_t *wsp, *wsp2, wc; + wchar_t *wsp, *wsp2; + unsigned wc; filepos fpos, fpos2, *fposp; int flags = 0; @@ -376,7 +377,7 @@ static void do_error(int code, va_list ap) { break; case err_sfntbadglyph: fpos = *va_arg(ap, filepos *); - wc = va_arg(ap, wchar_t); + wc = va_arg(ap, unsigned); sprintf(error, "warning: character U+%04X references an non-existent glyph", wc); diff --git a/in_sfnt.c b/in_sfnt.c index fc37dc0..0d2c7d5 100644 --- a/in_sfnt.c +++ b/in_sfnt.c @@ -886,8 +886,7 @@ void sfnt_getmap(font_info *fi) { idx = (k + idDelta[j]) & 0xffff; if (idx != 0) { if (idx > sf->nglyphs) { - error(err_sfntbadglyph, &sf->pos, - (wchar_t)k); + error(err_sfntbadglyph, &sf->pos, k); continue; } fi->bmp[k] = sfnt_indextoglyph(sf, idx); @@ -898,16 +897,14 @@ void sfnt_getmap(font_info *fi) { for (k = startCode[j]; k <= endCode[j]; k++) { if (startidx + k - startCode[j] >= nglyphindex) { - error(err_sfntbadglyph, &sf->pos, - (wchar_t)k); + error(err_sfntbadglyph, &sf->pos, k); continue; } idx = glyphIndexArray[startidx + k - startCode[j]]; if (idx != 0) { idx = (idx + idDelta[j]) & 0xffff; if (idx > sf->nglyphs) { - error(err_sfntbadglyph, &sf->pos, - (wchar_t)k); + error(err_sfntbadglyph, &sf->pos, k); continue; } fi->bmp[k] = sfnt_indextoglyph(sf, idx);