Skip to content

Commit

Permalink
Fix some Clang warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Jan 24, 2024
1 parent 4760137 commit 59deee0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
22 changes: 11 additions & 11 deletions pdfio-content.c
Original file line number Diff line number Diff line change
Expand Up @@ -1131,28 +1131,28 @@ pdfioContentTextMeasure(
if (ch < 128)
{
// ASCII
*tempptr++ = ch;
*tempptr++ = (char)ch;
}
else if (ch < 2048)
{
// 2-byte UTF-8
*tempptr++ = 0xc0 | ((ch >> 6) & 0x1f);
*tempptr++ = 0x80 | (ch & 0x3f);
*tempptr++ = (char)(0xc0 | ((ch >> 6) & 0x1f));
*tempptr++ = (char)(0x80 | (ch & 0x3f));
}
else
{
// 3-byte UTF-8
*tempptr++ = 0xe0 | ((ch >> 12) & 0x0f);
*tempptr++ = 0x80 | ((ch >> 6) & 0x3f);
*tempptr++ = 0x80 | (ch & 0x3f);
*tempptr++ = (char)(0xe0 | ((ch >> 12) & 0x0f));
*tempptr++ = (char)(0x80 | ((ch >> 6) & 0x3f));
*tempptr++ = (char)(0x80 | (ch & 0x3f));
}
}

*tempptr = '\0';
s = temp;
}

ttfGetExtents(ttf, size, s, &extents);
ttfGetExtents(ttf, (float)size, s, &extents);

return (extents.right - extents.left);
}
Expand Down Expand Up @@ -1642,7 +1642,7 @@ pdfioFileCreateFontObjFromFile(
*bufptr++ = (unsigned char)(cmap[i] >> 8);
*bufptr++ = (unsigned char)(cmap[i] & 255);

glyphs[cmap[i]] = i;
glyphs[cmap[i]] = (unsigned short)i;
if (cmap[i] < min_glyph)
min_glyph = cmap[i];
if (cmap[i] > max_glyph)
Expand Down Expand Up @@ -1727,9 +1727,9 @@ pdfioFileCreateFontObjFromFile(
if ((w_array = pdfioArrayCreate(pdf)) == NULL)
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 ++;

if ((i - start) > 1)
Expand All @@ -1750,7 +1750,7 @@ pdfioFileCreateFontObjFromFile(
pdfioArrayAppendNumber(temp_array, w0);
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;

pdfioArrayAppendNumber(temp_array, w0);
Expand Down
4 changes: 4 additions & 0 deletions pdfio-value.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ _pdfioValueDecrypt(pdfio_file_t *pdf, // I - PDF file

switch (v->type)
{
default :
// Do nothing
break;

case PDFIO_VALTYPE_ARRAY :
return (_pdfioArrayDecrypt(pdf, obj, v->value.array, depth + 1));
break;
Expand Down
2 changes: 1 addition & 1 deletion ttf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,7 @@ read_cmap(ttf_t *font) // I - Font
{
// Use an "obscure indexing trick" (words from the spec, not
// 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);
if (temp < 0 || temp >= numGlyphIdArray)
Expand Down

0 comments on commit 59deee0

Please sign in to comment.