diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2017-08-17 17:02:40 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2017-08-17 17:02:40 +0200 |
| commit | da046b73a89806eae2f7f461c2a46bda7e07aaa8 (patch) | |
| tree | a464431f9c20c0029538df22617c78d31223c298 /src | |
| parent | 9f7d79fd30df3712e6bfc6d475bfa143c069c4df (diff) | |
convert.c: fix recently introduced -Wsign-conversion warnings
Diffstat (limited to 'src')
| -rw-r--r-- | src/bin/jp2/convert.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bin/jp2/convert.c b/src/bin/jp2/convert.c index 73dfc8d5..deb4641e 100644 --- a/src/bin/jp2/convert.c +++ b/src/bin/jp2/convert.c @@ -583,7 +583,7 @@ struct tga_header { /* Returns a ushort from a little-endian serialized value */ static unsigned short get_tga_ushort(const unsigned char *data) { - return data[0] | (data[1] << 8); + return (unsigned short)data[0] | (unsigned short)(data[1] << 8); } #define TGA_HEADER_SIZE 18 @@ -816,10 +816,11 @@ opj_image_t* tgatoimage(const char *filename, opj_cparameters_t *parameters) /* If the declared file size is > 10 MB, check that the file is big */ /* enough to avoid excessive memory allocations */ - if (image_height != 0 && image_width > 10000000 / image_height / numcomps) { + if (image_height != 0 && + image_width > 10000000U / image_height / (OPJ_UINT32)numcomps) { char ch; OPJ_UINT64 expected_file_size = - (OPJ_UINT64)image_width * image_height * numcomps; + (OPJ_UINT64)image_width * image_height * (OPJ_UINT32)numcomps; long curpos = ftell(f); if (expected_file_size > (OPJ_UINT64)INT_MAX) { expected_file_size = (OPJ_UINT64)INT_MAX; |
