GraphicsMagick: coders/wpg.c Several warning fix.
GraphicsMagick Commits <[email protected]> Fri, 20 Oct 2023 18:07:49 -0500
| Newsgroups | gmane.comp.video.graphicsmagick.cvs |
|---|---|
| Message-ID | <mailman.10497.1697843279.1961.graphicsmagick-commit@lists.sourceforge.net> |
changeset 7bce17dcefba in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=7bce17dcefba
summary: coders/wpg.c Several warning fix.
diffstat:
coders/wpg.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diffs (31 lines):
diff -r 58b0460d650a -r 7bce17dcefba coders/wpg.c
--- a/coders/wpg.c Fri Oct 20 18:51:24 2023 +0200
+++ b/coders/wpg.c Sat Oct 21 01:07:24 2023 +0200
@@ -1475,13 +1475,14 @@
if(pPalette!=NULL && PaletteItems>0)
{
- image->colors = 1 << bpp;
- if(PaletteItems < image->colors)
- image->colors = PaletteItems; /*WPG_Palette.NumOfEntries;*/
+ if(bpp>=16 || PaletteItems<(1<<bpp))
+ image->colors = PaletteItems; /*WPG_Palette.NumOfEntries;*/
+ else
+ image->colors = 1 << bpp;
if (!AllocateImageColormap(image,image->colors))
goto NoMemory;
image->storage_class = PseudoClass;
- for (i=0; i<image->colors; i++)
+ for (i=0; i<(int)image->colors; i++)
{
image->colormap[i].red = ScaleCharToQuantum(pPalette[3*i]);
image->colormap[i].green=ScaleCharToQuantum(pPalette[3*i+1]);
@@ -1653,7 +1654,7 @@
ThrowReaderException(CorruptImageError,ColormapExceedsColorsLimit,image);
if ( (WPG_Palette.StartIndex > WPG_Palette.NumOfEntries) ||
- (((WPG_Palette.NumOfEntries-WPG_Palette.StartIndex) >
+ ((((unsigned long)WPG_Palette.NumOfEntries-(unsigned long)WPG_Palette.StartIndex) >
((Rec2.RecordLength-2-2) / 3))) )
ThrowReaderException(CorruptImageError,InvalidColormapIndex,image);
///////Temporary fix, should be removed//////////////////////////