]> granicus.if.org Git - openjpeg/commitdiff
Fix warning in rle4 decoding
authormayeut <mayeut@users.noreply.github.com>
Wed, 23 Sep 2015 19:09:19 +0000 (21:09 +0200)
committermayeut <mayeut@users.noreply.github.com>
Wed, 23 Sep 2015 19:09:19 +0000 (21:09 +0200)
src/bin/jp2/convertbmp.c

index 1131a599a5103af8fd4790c6ce128f5980c73989..0678d9d39f51dc185cc9de2460342aa8a2c7d0ff 100644 (file)
@@ -572,7 +572,7 @@ static OPJ_BOOL bmp_read_rle4_data(FILE* IN, OPJ_UINT8* pData, OPJ_UINT32 stride
                        OPJ_UINT8 c1 = (OPJ_UINT8)getc(IN);
                
                        for (j = 0; (j < c) && (x < width) && ((OPJ_SIZE_T)pix < (OPJ_SIZE_T)beyond); j++, x++, pix++) {
-                               *pix = (j&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f);
+                               *pix = (OPJ_UINT8)((j&1) ? (c1 & 0x0fU) : ((c1>>4)&0x0fU));
                        }
                }
                else { /* absolute mode */
@@ -598,7 +598,7 @@ static OPJ_BOOL bmp_read_rle4_data(FILE* IN, OPJ_UINT8* pData, OPJ_UINT32 stride
                                        if((j&1) == 0) {
                                                        c1 = (OPJ_UINT8)getc(IN);
                                        }
-                                       *pix = (j&1) ? (c1 & 0x0f) : ((c1>>4)&0x0f);
+                                       *pix =  (OPJ_UINT8)((j&1) ? (c1 & 0x0fU) : ((c1>>4)&0x0fU));
                                }
                                if(((c&3) == 1) || ((c&3) == 2)) { /* skip padding byte */
                                                getc(IN);