[trunk] fixed imagetoraw unsigned 16bits conversion (fixes issue 460)
authorMatthieu Darbois <mayeut@users.noreply.github.com>
Tue, 23 Dec 2014 15:06:23 +0000 (15:06 +0000)
committerMatthieu Darbois <mayeut@users.noreply.github.com>
Tue, 23 Dec 2014 15:06:23 +0000 (15:06 +0000)
src/bin/jp2/convert.c

index 3de635be69d9452089a099d575c70b067cdc3de7..4273141f009099f0791524ad401d5798b836a8d0 100644 (file)
@@ -2586,7 +2586,7 @@ static int imagetoraw_common(opj_image_t * image, const char *outfile, OPJ_BOOL
                 for (line = 0; line < h; line++) {
                     for(row = 0; row < w; row++)       {
                         curr = *ptr;
-                        if(curr > 65536 ) curr = 65536; else if( curr < 0) curr = 0;
+                        if(curr > 65535 ) curr = 65535; else if( curr < 0) curr = 0;
                         uc16.val = (unsigned short)(curr & mask);
                         res = fwrite(uc16.vals, 1, 2, rawFile);
                         if( res < 2 ) {