bmp decoder typo?

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
pva

bmp decoder typo?

Post 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?
pva

Re: bmp decoder typo?

Post 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");
    }
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: bmp decoder typo?

Post by magick »

Thanks for the problem report and patch. We'll get them into the next point release of ImageMagick.
Post Reply