]> git.imager.perl.org - imager.git/blobdiff - map.c
avoid a possible sign-extension for offsets/sizes in SGI
[imager.git] / map.c
diff --git a/map.c b/map.c
index aedd0dffd230307ff240635a39d90bfe70ff074e..9ddc62f855ebce456f7dc1588320b340cd1681f1 100644 (file)
--- a/map.c
+++ b/map.c
@@ -63,7 +63,8 @@ i_map(i_img *im, unsigned char (*maps)[256], unsigned int mask) {
     i_glin(im, 0, im->xsize, y, vals);
     for (x = 0; x < im->xsize; ++x) {
       for(ch = minset; ch<=maxset; ch++) {
     i_glin(im, 0, im->xsize, y, vals);
     for (x = 0; x < im->xsize; ++x) {
       for(ch = minset; ch<=maxset; ch++) {
-       if (!maps[ch]) continue;
+       if (!(mask & (1 << ch)))
+         continue;
        vals[x].channel[ch] = maps[ch][vals[x].channel[ch]];
       }
     }
        vals[x].channel[ch] = maps[ch][vals[x].channel[ch]];
       }
     }