Fix some Clang warnings.

This commit is contained in:
Michael R Sweet 2024-01-24 10:58:11 -05:00
parent 476013706e
commit 59deee020a
No known key found for this signature in database
GPG Key ID: BE67C75EC81F3244
3 changed files with 16 additions and 12 deletions

View File

@ -1131,20 +1131,20 @@ pdfioContentTextMeasure(
if (ch < 128) if (ch < 128)
{ {
// ASCII // ASCII
*tempptr++ = ch; *tempptr++ = (char)ch;
} }
else if (ch < 2048) else if (ch < 2048)
{ {
// 2-byte UTF-8 // 2-byte UTF-8
*tempptr++ = 0xc0 | ((ch >> 6) & 0x1f); *tempptr++ = (char)(0xc0 | ((ch >> 6) & 0x1f));
*tempptr++ = 0x80 | (ch & 0x3f); *tempptr++ = (char)(0x80 | (ch & 0x3f));
} }
else else
{ {
// 3-byte UTF-8 // 3-byte UTF-8
*tempptr++ = 0xe0 | ((ch >> 12) & 0x0f); *tempptr++ = (char)(0xe0 | ((ch >> 12) & 0x0f));
*tempptr++ = 0x80 | ((ch >> 6) & 0x3f); *tempptr++ = (char)(0x80 | ((ch >> 6) & 0x3f));
*tempptr++ = 0x80 | (ch & 0x3f); *tempptr++ = (char)(0x80 | (ch & 0x3f));
} }
} }
@ -1152,7 +1152,7 @@ pdfioContentTextMeasure(
s = temp; s = temp;
} }
ttfGetExtents(ttf, size, s, &extents); ttfGetExtents(ttf, (float)size, s, &extents);
return (extents.right - extents.left); return (extents.right - extents.left);
} }
@ -1642,7 +1642,7 @@ pdfioFileCreateFontObjFromFile(
*bufptr++ = (unsigned char)(cmap[i] >> 8); *bufptr++ = (unsigned char)(cmap[i] >> 8);
*bufptr++ = (unsigned char)(cmap[i] & 255); *bufptr++ = (unsigned char)(cmap[i] & 255);
glyphs[cmap[i]] = i; glyphs[cmap[i]] = (unsigned short)i;
if (cmap[i] < min_glyph) if (cmap[i] < min_glyph)
min_glyph = cmap[i]; min_glyph = cmap[i];
if (cmap[i] > max_glyph) if (cmap[i] > max_glyph)
@ -1727,9 +1727,9 @@ pdfioFileCreateFontObjFromFile(
if ((w_array = pdfioArrayCreate(pdf)) == NULL) if ((w_array = pdfioArrayCreate(pdf)) == NULL)
goto done; goto done;
for (start = 0, w0 = ttfGetWidth(font, 0), i = 1; i < 65536; start = i, w0 = w1, i ++) for (start = 0, w0 = ttfGetWidth(font, 0), w1 = 0, i = 1; i < 65536; start = i, w0 = w1, i ++)
{ {
while (i < 65536 && (w1 = ttfGetWidth(font, i)) == w0) while (i < 65536 && (w1 = ttfGetWidth(font, (int)i)) == w0)
i ++; i ++;
if ((i - start) > 1) if ((i - start) > 1)
@ -1750,7 +1750,7 @@ pdfioFileCreateFontObjFromFile(
pdfioArrayAppendNumber(temp_array, w0); pdfioArrayAppendNumber(temp_array, w0);
for (w0 = w1, i ++; i < 65536; w0 = w1, i ++) for (w0 = w1, i ++; i < 65536; w0 = w1, i ++)
{ {
if ((w1 = ttfGetWidth(font, i)) == w0 && i < 65535) if ((w1 = ttfGetWidth(font, (int)i)) == w0 && i < 65535)
break; break;
pdfioArrayAppendNumber(temp_array, w0); pdfioArrayAppendNumber(temp_array, w0);

View File

@ -138,6 +138,10 @@ _pdfioValueDecrypt(pdfio_file_t *pdf, // I - PDF file
switch (v->type) switch (v->type)
{ {
default :
// Do nothing
break;
case PDFIO_VALTYPE_ARRAY : case PDFIO_VALTYPE_ARRAY :
return (_pdfioArrayDecrypt(pdf, obj, v->value.array, depth + 1)); return (_pdfioArrayDecrypt(pdf, obj, v->value.array, depth + 1));
break; break;

2
ttf.c
View File

@ -1307,7 +1307,7 @@ read_cmap(ttf_t *font) // I - Font
{ {
// Use an "obscure indexing trick" (words from the spec, not // Use an "obscure indexing trick" (words from the spec, not
// mine) to look up the glyph index... // mine) to look up the glyph index...
temp = segment->idRangeOffset / 2 - segCount + (ch - segment->startCode) + (segment - segments); temp = (int)(segment->idRangeOffset / 2 - segCount + (ch - segment->startCode) + (segment - segments));
TTF_DEBUG("read_cmap: ch=%d, temp=%d\n", ch, temp); TTF_DEBUG("read_cmap: ch=%d, temp=%d\n", ch, temp);
if (temp < 0 || temp >= numGlyphIdArray) if (temp < 0 || temp >= numGlyphIdArray)