mirror of
https://github.com/michaelrsweet/pdfio.git
synced 2026-01-31 15:37:55 +01:00
Clean up some compiler warnings.
Add missing file to Xcode project.
This commit is contained in:
@@ -2516,7 +2516,7 @@ copy_gif(pdfio_dict_t *dict, // I - Image dictionary
|
||||
|
||||
|
||||
// Read the header; we already know it is a GIF file...
|
||||
if (read(fd, header, sizeof(header)) < sizeof(header))
|
||||
if (read(fd, header, sizeof(header)) < (ssize_t)sizeof(header))
|
||||
{
|
||||
_pdfioFileError(dict->pdf, "Unable to read GIF header: %s", strerror(errno));
|
||||
return (NULL);
|
||||
@@ -2524,8 +2524,8 @@ copy_gif(pdfio_dict_t *dict, // I - Image dictionary
|
||||
|
||||
PDFIO_DEBUG("copy_gif: header=<%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X>\n", header[0], header[1], header[2], header[3], header[4], header[5], header[6], header[7], header[8], header[9], header[10], header[11], header[12]);
|
||||
|
||||
width = (header[7] << 8) | header[6];
|
||||
height = (header[9] << 8) | header[8];
|
||||
width = (size_t)((header[7] << 8) | header[6]);
|
||||
height = (size_t)((header[9] << 8) | header[8]);
|
||||
ncolors = 2 << (header[10] & _PDFIO_GIF_COLORBITS);
|
||||
|
||||
PDFIO_DEBUG("copy_gif: width=%u, height=%u, ncolors=%d\n", (unsigned)width, (unsigned)height, ncolors);
|
||||
@@ -2540,7 +2540,7 @@ copy_gif(pdfio_dict_t *dict, // I - Image dictionary
|
||||
{
|
||||
// Read colormap after the file header...
|
||||
PDFIO_DEBUG("copy_gif: Have colormap.\n");
|
||||
if (read(fd, cmap, ncolors * 3) < (ncolors * 3))
|
||||
if (read(fd, cmap, (size_t)(ncolors * 3)) < (ssize_t)(ncolors * 3))
|
||||
{
|
||||
_pdfioFileError(dict->pdf, "Unable to read GIF colormap: %s", strerror(errno));
|
||||
return (NULL);
|
||||
@@ -2551,7 +2551,7 @@ copy_gif(pdfio_dict_t *dict, // I - Image dictionary
|
||||
// Make a grayscale colormap for the number of colors...
|
||||
PDFIO_DEBUG("copy_gif: Using default grayscale colormap.\n");
|
||||
for (int i = 0; i < ncolors; i ++)
|
||||
cmap[i][0] = cmap[i][1] = cmap[i][2] = 255 * i / (ncolors - 1);
|
||||
cmap[i][0] = cmap[i][1] = cmap[i][2] = (uint8_t)(255 * i / (ncolors - 1));
|
||||
}
|
||||
|
||||
#if DEBUG > 1
|
||||
@@ -2583,7 +2583,7 @@ copy_gif(pdfio_dict_t *dict, // I - Image dictionary
|
||||
pdfioDictSetNumber(dict, "Width", width);
|
||||
pdfioDictSetNumber(dict, "Height", height);
|
||||
pdfioDictSetNumber(dict, "BitsPerComponent", 8);
|
||||
pdfioDictSetArray(dict, "ColorSpace", pdfioArrayCreateColorFromPalette(dict->pdf, ncolors, cmap[0]));
|
||||
pdfioDictSetArray(dict, "ColorSpace", pdfioArrayCreateColorFromPalette(dict->pdf, (size_t)ncolors, cmap[0]));
|
||||
|
||||
if (transparent >= 0)
|
||||
{
|
||||
@@ -2619,7 +2619,7 @@ copy_gif(pdfio_dict_t *dict, // I - Image dictionary
|
||||
|
||||
if (extdesc == 0xf9) // Graphic Control Extension
|
||||
{
|
||||
if ((blocklen = gif_get_block(dict->pdf, fd, block, sizeof(block))) < 4)
|
||||
if (gif_get_block(dict->pdf, fd, block, sizeof(block)) < 4)
|
||||
goto done;
|
||||
|
||||
if (block[0] & 1) // Get transparent color index
|
||||
@@ -4187,7 +4187,7 @@ gif_read_image(
|
||||
ypasses[5] = { 0, 4, 2, 1, 0 };
|
||||
|
||||
|
||||
if (read(fd, iheader, sizeof(iheader)) < sizeof(iheader))
|
||||
if (read(fd, iheader, sizeof(iheader)) < (ssize_t)sizeof(iheader))
|
||||
{
|
||||
_pdfioFileError(pdf, "Unable to read GIF image header.");
|
||||
return (false);
|
||||
@@ -4195,10 +4195,10 @@ gif_read_image(
|
||||
|
||||
PDFIO_DEBUG("gif_read_image: iheader=<%02X%02X%02X%02X%02X%02X%02X%02X%02X>\n", iheader[0], iheader[1], iheader[2], iheader[3], iheader[4], iheader[5], iheader[6], iheader[7], iheader[8]);
|
||||
|
||||
ileft = iheader[0] | (iheader[1] << 8);
|
||||
itop = iheader[2] | (iheader[3] << 8);
|
||||
iwidth = iheader[4] | (iheader[5] << 8);
|
||||
iheight = iheader[6] | (iheader[7] << 8);
|
||||
ileft = (size_t)(iheader[0] | (iheader[1] << 8));
|
||||
itop = (size_t)(iheader[2] | (iheader[3] << 8));
|
||||
iwidth = (size_t)(iheader[4] | (iheader[5] << 8));
|
||||
iheight = (size_t)(iheader[6] | (iheader[7] << 8));
|
||||
interlace = (iheader[8] & _PDFIO_GIF_INTERLACE) != 0;
|
||||
|
||||
PDFIO_DEBUG("gif_read_image: ileft=%u, itop=%u, iwidth=%u, iheight=%u, interlace=%s\n", (unsigned)ileft, (unsigned)itop, (unsigned)iwidth, (unsigned)iheight, interlace ? "true" : "false");
|
||||
@@ -4220,7 +4220,7 @@ gif_read_image(
|
||||
|
||||
PDFIO_DEBUG("gif_read_image: Colormap with %d colors.\n", ncolors2);
|
||||
|
||||
if (read(fd, cmap, 3 * ncolors2) < (3 * ncolors2))
|
||||
if (read(fd, cmap, (size_t)(3 * ncolors2)) < (ssize_t)(3 * ncolors2))
|
||||
{
|
||||
_pdfioFileError(pdf, "Unable to read GIF image colormap.");
|
||||
return (false);
|
||||
|
||||
26
pdfio-lzw.c
26
pdfio-lzw.c
@@ -37,10 +37,10 @@ _pdfioLZWCreate(int code_size, // I - Data code size in bits (typically 8 for
|
||||
|
||||
if ((lzw = (_pdfio_lzw_t *)calloc(1, sizeof(_pdfio_lzw_t))) != NULL)
|
||||
{
|
||||
lzw->def_code_size = code_size + 1;
|
||||
lzw->clear_code = (short)(1 << code_size);
|
||||
lzw->def_code_size = (uint8_t)(code_size + 1);
|
||||
lzw->clear_code = (uint16_t)(1 << code_size);
|
||||
lzw->eod_code = lzw->clear_code + 1;
|
||||
lzw->early = early;
|
||||
lzw->early = (uint8_t)early;
|
||||
lzw->reversed = reversed;
|
||||
|
||||
lzw_clear(lzw);
|
||||
@@ -83,7 +83,7 @@ _pdfioLZWInflate(_pdfio_lzw_t *lzw) // I - LZW state
|
||||
// Copy pending compressed data to the output buffer...
|
||||
while (lzw->stptr > lzw->stack && lzw->avail_out > 0)
|
||||
{
|
||||
*(lzw->next_out++) = *(--lzw->stptr);
|
||||
*(lzw->next_out++) = (uint8_t)*(--lzw->stptr);
|
||||
lzw->avail_out --;
|
||||
PDFIO_DEBUG("_pdfioLZWInflate: Unrolled value %d, stptr=%p(%ld), avail_out=%u\n", *(lzw->stptr), (void *)lzw->stptr, lzw->stptr - lzw->stack, (unsigned)lzw->avail_out);
|
||||
}
|
||||
@@ -118,8 +118,8 @@ _pdfioLZWInflate(_pdfio_lzw_t *lzw) // I - LZW state
|
||||
if (lzw->first_code == 0xffff)
|
||||
{
|
||||
// First code...
|
||||
lzw->first_code = lzw->old_code = in_code;
|
||||
*(lzw->next_out++) = in_code;
|
||||
lzw->first_code = lzw->old_code = (uint16_t)in_code;
|
||||
*(lzw->next_out++) = (uint8_t)in_code;
|
||||
lzw->avail_out --;
|
||||
|
||||
PDFIO_DEBUG("_pdfioLZWInflate: first_code=%d.\n", in_code);
|
||||
@@ -183,7 +183,7 @@ _pdfioLZWInflate(_pdfio_lzw_t *lzw) // I - LZW state
|
||||
if (lzw->next_code >= lzw->next_size_code && lzw->cur_code_size < 12)
|
||||
{
|
||||
lzw->cur_code_size ++;
|
||||
lzw->next_size_code = (1 << lzw->cur_code_size) - lzw->early;
|
||||
lzw->next_size_code = (uint16_t)((1 << lzw->cur_code_size) - lzw->early);
|
||||
PDFIO_DEBUG("_pdfioLZWInflate: Increased code size to %u, next_size_code=%u\n", lzw->cur_code_size, lzw->next_size_code);
|
||||
}
|
||||
}
|
||||
@@ -192,7 +192,7 @@ _pdfioLZWInflate(_pdfio_lzw_t *lzw) // I - LZW state
|
||||
|
||||
while (lzw->stptr > lzw->stack && lzw->avail_out > 0)
|
||||
{
|
||||
*(lzw->next_out++) = *(--lzw->stptr);
|
||||
*(lzw->next_out++) = (uint8_t)*(--lzw->stptr);
|
||||
lzw->avail_out --;
|
||||
PDFIO_DEBUG("_pdfioLZWInflate: Unrolled value %d, stptr=%p(%ld), avail_out=%u\n", *(lzw->stptr), (void *)lzw->stptr, lzw->stptr - lzw->stack, (unsigned)lzw->avail_out);
|
||||
}
|
||||
@@ -216,7 +216,7 @@ lzw_clear(_pdfio_lzw_t *lzw) // I - LZW state
|
||||
|
||||
lzw->cur_code_size = lzw->def_code_size;
|
||||
lzw->next_code = lzw->clear_code + 2;
|
||||
lzw->next_size_code = (1 << lzw->cur_code_size) - lzw->early;
|
||||
lzw->next_size_code = (uint16_t)((1 << lzw->cur_code_size) - lzw->early);
|
||||
lzw->first_code = 0xffff;
|
||||
lzw->old_code = 0xffff;
|
||||
|
||||
@@ -278,7 +278,7 @@ lzw_get_code(_pdfio_lzw_t *lzw) // I - LZW state
|
||||
}
|
||||
|
||||
if ((in_add = sizeof(lzw->in_bytes) - in_used) > lzw->avail_in)
|
||||
in_add = lzw->avail_in;
|
||||
in_add = (uint16_t)lzw->avail_in;
|
||||
|
||||
memcpy(lzw->in_bytes + in_used, lzw->next_in, in_add);
|
||||
lzw->next_in += in_add;
|
||||
@@ -301,7 +301,7 @@ lzw_get_code(_pdfio_lzw_t *lzw) // I - LZW state
|
||||
// Insane GIF-style right-to-left bit encoding...
|
||||
for (code = 0, in_bit = lzw->in_bit + lzw->cur_code_size - 1, remaining = lzw->cur_code_size; remaining > 0; in_bit --, remaining --)
|
||||
{
|
||||
code = (code << 1) | ((lzw->in_bytes[in_bit / 8] & rbits[in_bit & 7]) != 0);
|
||||
code = (uint16_t)((code << 1) | ((lzw->in_bytes[in_bit / 8] & rbits[in_bit & 7]) != 0));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -318,9 +318,9 @@ lzw_get_code(_pdfio_lzw_t *lzw) // I - LZW state
|
||||
|
||||
// Get those bits
|
||||
if (bits == 8) // Full byte from buffer
|
||||
code = (code << 8) | byte;
|
||||
code = (uint16_t)((code << 8) | byte);
|
||||
else // Partial byte from buffer
|
||||
code = (code << bits) | ((byte >> (8 - bits - boff)) & mask[bits]);
|
||||
code = (uint16_t)((code << bits) | ((byte >> (8 - bits - boff)) & mask[bits]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1153,7 +1153,7 @@ stream_get_bytes(
|
||||
if (a85ch >= '!' && a85ch <= 'u')
|
||||
{
|
||||
// Valid ASCII85Decode character...
|
||||
a85val = a85val * 85 + a85ch - '!';
|
||||
a85val = a85val * 85 + (unsigned)a85ch - '!';
|
||||
count ++;
|
||||
}
|
||||
else if (a85ch == 'z' && count == 0)
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
273440CD263D727800FBFD63 /* pdfio-page.c in Sources */ = {isa = PBXBuildFile; fileRef = 273440C2263D727800FBFD63 /* pdfio-page.c */; };
|
||||
273440D8263D72E100FBFD63 /* testpdfio.c in Sources */ = {isa = PBXBuildFile; fileRef = 273440D7263D72E100FBFD63 /* testpdfio.c */; };
|
||||
273440E4263DD7EA00FBFD63 /* pdfio-token.c in Sources */ = {isa = PBXBuildFile; fileRef = 273440E3263DD7EA00FBFD63 /* pdfio-token.c */; };
|
||||
273707A52F299C3100953C95 /* pdfio-lzw.c in Sources */ = {isa = PBXBuildFile; fileRef = 273707A42F299C3100953C95 /* pdfio-lzw.c */; };
|
||||
2741C9A22F05872C002D93F2 /* ttf-cache.c in Sources */ = {isa = PBXBuildFile; fileRef = 2741C99F2F05872C002D93F2 /* ttf-cache.c */; };
|
||||
2741C9A32F05872C002D93F2 /* ttf-file.c in Sources */ = {isa = PBXBuildFile; fileRef = 2741C9A02F05872C002D93F2 /* ttf-file.c */; };
|
||||
2741C9A42F05872C002D93F2 /* ttf-private.h in Headers */ = {isa = PBXBuildFile; fileRef = 2741C9A12F05872C002D93F2 /* ttf-private.h */; };
|
||||
@@ -84,6 +85,7 @@
|
||||
273440E1263D73A300FBFD63 /* pdfio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = pdfio.html; path = doc/pdfio.html; sourceTree = "<group>"; };
|
||||
273440E2263D73A300FBFD63 /* pdfio.3 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = pdfio.3; path = doc/pdfio.3; sourceTree = "<group>"; };
|
||||
273440E3263DD7EA00FBFD63 /* pdfio-token.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "pdfio-token.c"; sourceTree = "<group>"; };
|
||||
273707A42F299C3100953C95 /* pdfio-lzw.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "pdfio-lzw.c"; sourceTree = "<group>"; };
|
||||
2741C99E2F05872C002D93F2 /* ttf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ttf.h; path = ttf/ttf.h; sourceTree = "<group>"; };
|
||||
2741C99F2F05872C002D93F2 /* ttf-cache.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = "ttf-cache.c"; path = "ttf/ttf-cache.c"; sourceTree = "<group>"; };
|
||||
2741C9A02F05872C002D93F2 /* ttf-file.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = "ttf-file.c"; path = "ttf/ttf-file.c"; sourceTree = "<group>"; };
|
||||
@@ -174,6 +176,7 @@
|
||||
27F2F05F2710BE92008ECD36 /* pdfio-crypto.c */,
|
||||
273440BE263D727800FBFD63 /* pdfio-dict.c */,
|
||||
273440BD263D727800FBFD63 /* pdfio-file.c */,
|
||||
273707A42F299C3100953C95 /* pdfio-lzw.c */,
|
||||
27F2F05D2710BE92008ECD36 /* pdfio-md5.c */,
|
||||
273440BC263D727800FBFD63 /* pdfio-object.c */,
|
||||
273440C2263D727800FBFD63 /* pdfio-page.c */,
|
||||
@@ -305,6 +308,7 @@
|
||||
273440C9263D727800FBFD63 /* pdfio-dict.c in Sources */,
|
||||
273440C8263D727800FBFD63 /* pdfio-file.c in Sources */,
|
||||
273440CB263D727800FBFD63 /* pdfio-value.c in Sources */,
|
||||
273707A52F299C3100953C95 /* pdfio-lzw.c in Sources */,
|
||||
273440CA263D727800FBFD63 /* pdfio-stream.c in Sources */,
|
||||
273440CD263D727800FBFD63 /* pdfio-page.c in Sources */,
|
||||
27F2F0622710BE92008ECD36 /* pdfio-crypto.c in Sources */,
|
||||
|
||||
Reference in New Issue
Block a user