GraphicsMagick: WPG: Replace use of ReallocColormap() with previ...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.20041.1668964756.1350.graphicsmagick-commit@lists.sourceforge.net>
changeset 7b5914f1e022 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=7b5914f1e022
summary: WPG: Replace use of ReallocColormap() with previously existing ReallocateImageColormap(), which does the same thing.

diffstat:

 ChangeLog          |   3 +++
 coders/wpg.c       |  26 ++------------------------
 www/Changelog.html |   7 +++++--
 3 files changed, 10 insertions(+), 26 deletions(-)

diffs (81 lines):

diff -r 7b393efb50fa -r 7b5914f1e022 ChangeLog
--- a/ChangeLog	Sun Nov 20 11:00:36 2022 -0600
+++ b/ChangeLog	Sun Nov 20 11:19:06 2022 -0600
@@ -2,6 +2,9 @@
 
 	* coders/wpg.c: Fix definition and use of LogHeaderWPG(),
 	LogWPGBitmapType1(), and LogWPGBitmapType2() macros.
+	
+	Replace use of ReallocColormap() with previously existing
+	ReallocateImageColormap(), which does the same thing.
 
 	* coders/heif.c (ReadColorProfile): Support reading ICC color
 	profile.
diff -r 7b393efb50fa -r 7b5914f1e022 coders/wpg.c
--- a/coders/wpg.c	Sun Nov 20 11:00:36 2022 -0600
+++ b/coders/wpg.c	Sun Nov 20 11:19:06 2022 -0600
@@ -235,28 +235,6 @@
   return(False);
 }
 
-static MagickPassFail ReallocColormap(Image *image,unsigned int colors)
-{
-  PixelPacket *colormap;
-
-  /* FIXME: This implementation would be better using a true realloc */
-  colormap=MagickAllocateClearedArray(PixelPacket *,colors,sizeof(PixelPacket));
-  if (colormap != (PixelPacket *) NULL)
-    {
-      if (image->colormap != (PixelPacket *) NULL)
-        {
-          (void) memcpy(colormap,image->colormap,
-                        (size_t) Min(image->colors,colors)*sizeof(PixelPacket));
-          MagickFreeMemory(image->colormap);
-        }
-      image->colormap = colormap;
-      image->colors = colors;
-      return MagickPass;
-    }
-
-  return MagickFail;
-}
-
 static int Rd_WP_DWORD(Image *image, unsigned long *d)
 {
   unsigned char b;
@@ -1447,7 +1425,7 @@
                 {
                   if (bpp < 24)
                     if ( (image->colors != (1UL<<bpp)) && (bpp != 24) )
-                      if (!ReallocColormap(image,1U<<bpp))
+                      if (!ReallocateImageColormap(image,1U<<bpp))
                         goto NoMemory;
                 }
 
@@ -1649,7 +1627,7 @@
                 {
                   if(bpp < 24)
                     if(image->colors!=(1UL<<bpp) && bpp!=24)
-                      if (!ReallocColormap(image,1U<<bpp))
+                      if (!ReallocateImageColormap(image,1U<<bpp))
                         goto NoMemory;
                 }
 
diff -r 7b393efb50fa -r 7b5914f1e022 www/Changelog.html
--- a/www/Changelog.html	Sun Nov 20 11:00:36 2022 -0600
+++ b/www/Changelog.html	Sun Nov 20 11:19:06 2022 -0600
@@ -39,9 +39,12 @@
 <div class="document">
 <p>2022-11-20  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
 <blockquote>
-<ul class="simple">
+<ul>
 <li><p>coders/wpg.c: Fix definition and use of LogHeaderWPG(),
-LogWPGBitmapType1(), and LogWPGBitmapType2() macros.</p></li>
+LogWPGBitmapType1(), and LogWPGBitmapType2() macros.</p>
+<p>Replace use of ReallocColormap() with previously existing
+ReallocateImageColormap(), which does the same thing.</p>
+</li>
 <li><p>coders/heif.c (ReadColorProfile): Support reading ICC color
 profile.</p></li>
 </ul>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.