Fix some potential overflow issues (#1161)
authorStefan Weil <sw@weilnetz.de>
Wed, 31 Oct 2018 19:44:30 +0000 (20:44 +0100)
committerEven Rouault <even.rouault@mines-paris.org>
Wed, 31 Oct 2018 19:44:30 +0000 (20:44 +0100)
commit948332e6ed17565100d1df5f6fdbf66865218e36
tree8e38306366e69eef4da8827372d00cf2280ee55c
parente52909f4c7896c5efff3340d707c12d0df55d3f9
Fix some potential overflow issues (#1161)

* Fix some potential overflow issues

Put sizeof to the beginning of the multiplication to enforce that
size_t instead of smaller integer types is used for the calculation.

This fixes warnings from LGTM:

    Multiplication result may overflow 'unsigned int'
    before it is converted to 'unsigned long'.

It also allows removing some type casts.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
* Fix code indentation

Signed-off-by: Stefan Weil <sw@weilnetz.de>
src/bin/jp2/convertbmp.c
src/bin/jp2/converttif.c
src/bin/jp2/opj_compress.c
src/bin/jp2/opj_decompress.c
src/lib/openjp2/jp2.c
src/lib/openjp2/t1.c
src/lib/openmj2/j2k.c
src/lib/openmj2/jp2.c