mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-29 03:16:18 +03:00
fix compiler warnings
This commit is contained in:
parent
1ba6ff8a33
commit
c55b3aa402
|
@ -151,6 +151,11 @@ def _save(im, fp, filename):
|
||||||
dim = 2
|
dim = 2
|
||||||
# Z Dimension: Number of channels
|
# Z Dimension: Number of channels
|
||||||
z = len(im.mode)
|
z = len(im.mode)
|
||||||
|
|
||||||
|
# assert we've got the right number of bands.
|
||||||
|
if len(im.getbands()) != z:
|
||||||
|
raise ValueError("incorrect number of bands in SGI write: %s vs %s" %
|
||||||
|
(z, len(im.getbands())))
|
||||||
if dim == 1 or dim == 2:
|
if dim == 1 or dim == 2:
|
||||||
z = 1
|
z = 1
|
||||||
# assert we've got the right number of bands.
|
# assert we've got the right number of bands.
|
||||||
|
@ -177,12 +182,10 @@ def _save(im, fp, filename):
|
||||||
fp.write(struct.pack('>H', z))
|
fp.write(struct.pack('>H', z))
|
||||||
fp.write(struct.pack('>l', pinmin))
|
fp.write(struct.pack('>l', pinmin))
|
||||||
fp.write(struct.pack('>l', pinmax))
|
fp.write(struct.pack('>l', pinmax))
|
||||||
|
|
||||||
fp.write(struct.pack('4s', b'')) # dummy
|
fp.write(struct.pack('4s', b'')) # dummy
|
||||||
fp.write(struct.pack('79s', imgName)) # truncates to 79 chars
|
fp.write(struct.pack('79s', imgName)) # truncates to 79 chars
|
||||||
fp.write(struct.pack('s', b'')) # force null byte after imgname
|
fp.write(struct.pack('s', b'')) # force null byte after imgname
|
||||||
fp.write(struct.pack('>l', colormap))
|
fp.write(struct.pack('>l', colormap))
|
||||||
|
|
||||||
fp.write(struct.pack('404s', b'')) # dummy
|
fp.write(struct.pack('404s', b'')) # dummy
|
||||||
|
|
||||||
for channel in im.split():
|
for channel in im.split():
|
||||||
|
|
|
@ -93,7 +93,7 @@ ImagingSgiRleDecode(Imaging im, ImagingCodecState state,
|
||||||
UINT8* buf, int bytes)
|
UINT8* buf, int bytes)
|
||||||
{
|
{
|
||||||
uint32_t *starttab, *lengthtab, rleoffset, rlelength;
|
uint32_t *starttab, *lengthtab, rleoffset, rlelength;
|
||||||
int tablen, i, j, rowno, channo, bpc;
|
int tablen, i, j, rowno, channo;
|
||||||
long bufsize;
|
long bufsize;
|
||||||
UINT8 *ptr;
|
UINT8 *ptr;
|
||||||
SGISTATE *context;
|
SGISTATE *context;
|
||||||
|
@ -104,7 +104,7 @@ ImagingSgiRleDecode(Imaging im, ImagingCodecState state,
|
||||||
bufsize -= SGI_HEADER_SIZE;
|
bufsize -= SGI_HEADER_SIZE;
|
||||||
ptr = malloc(sizeof(UINT8) * bufsize);
|
ptr = malloc(sizeof(UINT8) * bufsize);
|
||||||
_imaging_seek_pyFd(state->fd, SGI_HEADER_SIZE, SEEK_SET);
|
_imaging_seek_pyFd(state->fd, SGI_HEADER_SIZE, SEEK_SET);
|
||||||
_imaging_read_pyFd(state->fd, ptr, bufsize);
|
_imaging_read_pyFd(state->fd, (char*)ptr, bufsize);
|
||||||
|
|
||||||
|
|
||||||
/* decoder initialization */
|
/* decoder initialization */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user