Page 1 of 1

bmp decoder typo?

Posted: 2010-08-13T04:42:45-07:00
by pva
Hi guys. The following code in coders/bmp.c looks like a typo:

Code: Select all

 sum=bmp_info.red_primary.x+bmp_info.red_primary.x+bmp_info.red_primary.z;
I guess sum should be
sum=bmp_info.red_primary.x+bmp_info.red_primary.y+bmp_info.red_primary.z;

Am I correct?

Re: bmp decoder typo?

Posted: 2010-08-13T10:37:44-07:00
by pva
And while I'm here the following code is redundant:

Code: Select all

    if (bmp_info.compression > 3)
      ThrowReaderException(CorruptImageError,"UnrecognizedImageCompression");
As below same thing is done but with more fine-grained error message:

Code: Select all

    switch (bmp_info.compression)
    {
      case BI_RGB:
      case BI_RLE8:
      case BI_RLE4:
      case BI_BITFIELDS:
        break;
      case BI_JPEG:
        ThrowReaderException(CoderError,"JPEGCompressNotSupported");
      case BI_PNG:
        ThrowReaderException(CoderError,"PNGCompressNotSupported");
      default:
        ThrowReaderException(CorruptImageError,"UnrecognizedImageCompression");
    }

Re: bmp decoder typo?

Posted: 2010-08-13T10:58:35-07:00
by magick
Thanks for the problem report and patch. We'll get them into the next point release of ImageMagick.