🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.sources.patches
1 messages
1 total messages Started by Cristy Tue, 17 Nov 1992 18:45
ImageMagick 2.1 - patch 02 (REPOST)
#21
Author: Cristy
Date: Tue, 17 Nov 1992 18:45
941 lines
28826 bytes
To apply this patch:
 
cd to the top of the source tree (to the directory containing the
"ImageMagick" directory) and do:
 
      patch -p -s < ThisFile
 
Patch will work silently unless an error occurs.  If you want to watch
patch do its thing, leave out the "-s" argument to patch.
 
Finally, to rebuild after applying this patch, cd to the "ImageMagick"
directory and type:
 
      make

The entire distribution is available as contrib/ImageMagick.tar.Z on
export.lcs.mit.edu.
 
Brief notes on what this patch fixes:
 
o Added unistd.h to display.h for strict ANSI compilers.
o Changed long to time_t for calls to C time routine.
o Multi-part GIF's can now be displayed or animated.
o Fixed segmentation fault when reading multi-part images with
  animate, montage, or mogrify.
o Multi-part MIFF images have the correct file name now.

diff -c -r ImageMagick/XtoPS.c ImageMagick2.1.2/XtoPS.c
*** ImageMagick/XtoPS.c	Wed Nov 11 14:12:11 1992
--- ImageMagick2.1.2/XtoPS.c	Sat Nov 14 01:52:58 1992
***************
*** 219,225 ****
      i,
      x;
  
!   long
      start_time;
  
    unsigned int
--- 219,225 ----
      i,
      x;
  
!   time_t
      start_time;
  
    unsigned int
***************
*** 442,448 ****
    */
    if (delay > 0)
      (void) sleep(delay);
!   start_time=time((long *) 0);
    image=ReadXImage(target_window,server_name,frame,screen,borders);
    if (image == (Image *) NULL)
      exit(1);
--- 442,448 ----
    */
    if (delay > 0)
      (void) sleep(delay);
!   start_time=time((time_t *) 0);
    image=ReadXImage(target_window,server_name,frame,screen,borders);
    if (image == (Image *) NULL)
      exit(1);
***************
*** 481,487 ****
        else
          (void) fprintf(stderr," PseudoClass ");
        (void) fprintf(stderr,"%uc %s %ds\n",image->colors,image->magick,
!         time((long *) 0)-start_time+1);
      }
    DestroyImage(image);
    XCloseDisplay(display);
--- 481,487 ----
        else
          (void) fprintf(stderr," PseudoClass ");
        (void) fprintf(stderr,"%uc %s %ds\n",image->colors,image->magick,
!         time((time_t *) 0)-start_time+1);
      }
    DestroyImage(image);
    XCloseDisplay(display);
diff -c -r ImageMagick/alien.c ImageMagick2.1.2/alien.c
*** ImageMagick/alien.c	Thu Nov 12 16:19:56 1992
--- ImageMagick2.1.2/alien.c	Sat Nov 14 01:51:40 1992
***************
*** 541,547 ****
  
    unsigned int
      image_count,
-     image_number,
      interlace,
      local_colormap;
  
--- 541,546 ----
***************
*** 583,589 ****
        DestroyImage(image);
        return((Image *) NULL);
      }
-   image->class=PseudoClass;
    image->colors=1 << ((header[4] & 0x07)+1);
    if (BitSet(header[4],0x80))
      {
--- 582,587 ----
***************
*** 593,598 ****
--- 591,597 ----
        /*
          Read global colormap.
        */
+       image->class=PseudoClass;
        colormap=(unsigned char *) malloc(3*image->colors*sizeof(unsigned char));
        image->colormap=(ColorPacket *) malloc(image->colors*sizeof(ColorPacket));
        if ((colormap == (unsigned char *) NULL) ||
***************
*** 613,619 ****
        (void) free((void *) colormap);
      }
    image_count=0;
-   image_number=0;
    while (1)
    {
      status=ReadData((char *) &c,1,1,image->file);
--- 612,617 ----
***************
*** 620,637 ****
      if (status == False)
        break;
      if (c == ';')
!       {
!         /*
!           GIF terminator.
!         */
!         if (image_count < image_number)
!           {
!             Warning("unable to read image data",(char *) NULL);
!             DestroyImage(image);
!             return((Image *) NULL);
!           }
!         break;
!       }
      if (c == '!')
        {
          /*
--- 618,624 ----
      if (status == False)
        break;
      if (c == ';')
!       break;  /* terminator */
      if (c == '!')
        {
          /*
***************
*** 676,681 ****
--- 663,687 ----
      /*
        Read image attributes.
      */
+     if (image_count > 0)
+       {
+         /*
+           Allocate image structure.
+         */
+         CompressColormap(image);
+         image->next=AllocateImage("GIF");
+         if (image->next == (Image *) NULL)
+           {
+             DestroyImages(image);
+             return((Image *) NULL);
+           }
+         image->next->file=image->file;
+         (void) sprintf(image->next->filename,"%s.%u\0",alien_info->filename,
+           image->scene+1);
+         image->next->scene=image->scene+1;
+         image->next->last=image;
+         image=image->next;
+       }
      image_count++;
      status=ReadData((char *) header,1,9,image->file);
      if (status == False)
***************
*** 710,715 ****
--- 716,722 ----
          /*
            Read local colormap.
          */
+         image->class=PseudoClass;
          image->colors=1 << ((header[8] & 0x07)+1);
          colormap=(unsigned char *)
            malloc(3*image->colors*sizeof(unsigned char));
***************
*** 784,793 ****
          }
          DestroyImage(interlaced_image);
        }
-     if (image_count == image_number)
-       break;
    }
    CompressColormap(image);
    CloseImage(image);
    return(image);
  }
--- 791,800 ----
          }
          DestroyImage(interlaced_image);
        }
    }
    CompressColormap(image);
+   while (image->last != (Image *) NULL)
+     image=image->last;
    CloseImage(image);
    return(image);
  }
diff -c -r ImageMagick/animate.c ImageMagick2.1.2/animate.c
*** ImageMagick/animate.c	Thu Nov 12 13:35:10 1992
--- ImageMagick2.1.2/animate.c	Sat Nov 14 01:51:40 1992
***************
*** 1475,1480 ****
--- 1475,1481 ----
  
    unsigned int
      image_number,
+     maximum_images,
      reflect,
      verbose;
  
***************
*** 1503,1509 ****
    scale_geometry=(char *) NULL;
    server_name=(char *) NULL;
    verbose=False;
!   images=(Image **) malloc(argc*sizeof(Image *));
    if (images == (Image **) NULL)
      Error("unable to animate images","memory allocation failed");
    /*
--- 1504,1511 ----
    scale_geometry=(char *) NULL;
    server_name=(char *) NULL;
    verbose=False;
!   maximum_images=2048;
!   images=(Image **) malloc(maximum_images*sizeof(Image *));
    if (images == (Image **) NULL)
      Error("unable to animate images","memory allocation failed");
    /*
***************
*** 1973,1981 ****
        {
          Image
            *image,
!           info_image;
  
!         long
            start_time;
  
          unsigned long
--- 1975,1984 ----
        {
          Image
            *image,
!           info_image,
!           *next_image;
  
!         time_t
            start_time;
  
          unsigned long
***************
*** 1984,1998 ****
          /*
            Option is a file name: begin by reading image from specified file.
          */
!         start_time=time((long *) 0);
          (void) strcpy(alien_info.filename,option);
          image=ReadAlienImage(&alien_info);
          if (image == (Image *) NULL)
!           continue;
          do
          {
-           if (image->scene == 0)
-             image->scene=image_number;
            info_image=(*image);
            /*
              Transform image as defined by the clip, image and scale geometries.
--- 1987,2002 ----
          /*
            Option is a file name: begin by reading image from specified file.
          */
!         start_time=time((time_t *) 0);
          (void) strcpy(alien_info.filename,option);
          image=ReadAlienImage(&alien_info);
          if (image == (Image *) NULL)
!           if (*option == '-')
!             break;
!           else
!             continue;
          do
          {
            info_image=(*image);
            /*
              Transform image as defined by the clip, image and scale geometries.
***************
*** 2057,2063 ****
                */
                (void) fprintf(stderr,"[%u] %s",
                  image->scene == 0 ? image_number : image->scene,
!                 image->filename);
                (void) fprintf(stderr," %ux%u",info_image.columns,
                  info_image.rows);
                if ((info_image.columns != image->columns) ||
--- 2061,2067 ----
                */
                (void) fprintf(stderr,"[%u] %s",
                  image->scene == 0 ? image_number : image->scene,
!                 info_image.filename);
                (void) fprintf(stderr," %ux%u",info_image.columns,
                  info_image.rows);
                if ((info_image.columns != image->columns) ||
***************
*** 2088,2095 ****
                      normalized_mean_error,normalized_maximum_error);
                  }
                (void) fprintf(stderr," %s %lds\n",image->magick,
!                 time((long *) 0)-start_time+1);
!               (void) fprintf(stderr,"                                      \r");
              }
            /*
              Pack image data to conserve memory (memory <=> speed).
--- 2092,2098 ----
                      normalized_mean_error,normalized_maximum_error);
                  }
                (void) fprintf(stderr," %s %lds\n",image->magick,
!                 time((time_t *) 0)-start_time+1);
              }
            /*
              Pack image data to conserve memory (memory <=> speed).
***************
*** 2098,2110 ****
            (void) PackImage(image);
            (void) free((void *) image->pixels);
            image->pixels=(RunlengthPacket *) NULL;
            images[image_number++]=image;
!           image=image->next;
!         } while (image != (Image *) NULL);
        }
!     }
!   if (verbose)
!     (void) fprintf(stderr,"\n");
    if (image_number == 0)
      Error("missing an image file name",(char *) NULL);
    XAnimateImage(display,&resource_info,argv,argc,images,image_number);
--- 2101,2124 ----
            (void) PackImage(image);
            (void) free((void *) image->pixels);
            image->pixels=(RunlengthPacket *) NULL;
+           if (image_number == maximum_images)
+             {
+               /*
+                 Increase size of images array.
+               */
+               maximum_images<<=1;
+               images=(Image **)
+                 realloc((void *) images,maximum_images*sizeof(Image *));
+               if (images == (Image **) NULL)
+                 Error("unable to animate images","memory allocation failed");
+             }
            images[image_number++]=image;
!           next_image=image->next;
!           if (next_image != (Image *) NULL)
!             image=next_image;
!         } while (next_image != (Image *) NULL);
        }
!   }
    if (image_number == 0)
      Error("missing an image file name",(char *) NULL);
    XAnimateImage(display,&resource_info,argv,argc,images,image_number);
diff -c -r ImageMagick/display.c ImageMagick2.1.2/display.c
*** ImageMagick/display.c	Thu Nov 12 13:35:03 1992
--- ImageMagick2.1.2/display.c	Sat Nov 14 01:53:34 1992
***************
*** 2636,2642 ****
    if (resource_info->delay == 0)
      timeout=(~0);
    else
!     timeout=time((long *) 0)+resource_info->delay;
    do
    {
      /*
--- 2636,2642 ----
    if (resource_info->delay == 0)
      timeout=(~0);
    else
!     timeout=(unsigned long) time((time_t *) 0)+resource_info->delay;
    do
    {
      /*
***************
*** 2884,2890 ****
              if (resource_info->delay == 0)
                timeout=(~0);
              else
!               timeout=time((long *) 0)+resource_info->delay;
              break;
            }
          if (event.xexpose.window == magnify_window.id)
--- 2884,2890 ----
              if (resource_info->delay == 0)
                timeout=(~0);
              else
!               timeout=(unsigned long) time((time_t *) 0)+resource_info->delay;
              break;
            }
          if (event.xexpose.window == magnify_window.id)
***************
*** 3171,3177 ****
        *state&=(~UpdateConfigurationState);
      }
    }
!   while ((timeout > time((long *) 0)) && !(*state & ExitState));
    if (*state & PanIconMappedState)
      XWithdrawWindow(display,pan_window.id,pan_window.screen);
    if (*state & MagnifyMappedState)
--- 3171,3177 ----
        *state&=(~UpdateConfigurationState);
      }
    }
!   while ((timeout > time((time_t *) 0)) && !(*state & ExitState));
    if (*state & PanIconMappedState)
      XWithdrawWindow(display,pan_window.id,pan_window.screen);
    if (*state & MagnifyMappedState)
***************
*** 5455,5461 ****
            info_image,
            *next_image;
  
!         long
            start_time;
  
          unsigned long
--- 5455,5461 ----
            info_image,
            *next_image;
  
!         time_t
            start_time;
  
          unsigned long
***************
*** 5464,5470 ****
          /*
            Option is a file name: begin by reading image from specified file.
          */
!         start_time=time((long *) 0);
          (void) strcpy(alien_info.filename,option);
          image=ReadAlienImage(&alien_info);
          if (image == (Image *) NULL)
--- 5464,5470 ----
          /*
            Option is a file name: begin by reading image from specified file.
          */
!         start_time=time((time_t *) 0);
          (void) strcpy(alien_info.filename,option);
          image=ReadAlienImage(&alien_info);
          if (image == (Image *) NULL)
***************
*** 5640,5646 ****
                      normalized_mean_error,normalized_maximum_error);
                  }
                (void) fprintf(stderr," %s %lds\n",image->magick,
!                 time((long *) 0)-start_time+1);
              }
            /*
              Proceed to next/previous image.
--- 5640,5646 ----
                      normalized_mean_error,normalized_maximum_error);
                  }
                (void) fprintf(stderr," %s %lds\n",image->magick,
!                 time((time_t *) 0)-start_time+1);
              }
            /*
              Proceed to next/previous image.
diff -c -r ImageMagick/display.h ImageMagick2.1.2/display.h
*** ImageMagick/display.h	Mon Nov  9 14:48:50 1992
--- ImageMagick2.1.2/display.h	Sat Nov 14 01:51:50 1992
***************
*** 6,11 ****
--- 6,12 ----
  #include <math.h>
  #if __STDC__ || defined(sgi) || defined(AIXV3)
  #include <stdlib.h>
+ #include <unistd.h>
  #else
  #ifndef vms
  #include <malloc.h>
diff -c -r ImageMagick/image.c ImageMagick2.1.2/image.c
*** ImageMagick/image.c	Wed Nov 11 14:12:17 1992
--- ImageMagick2.1.2/image.c	Sat Nov 14 01:51:39 1992
***************
*** 3356,3362 ****
              return((Image *) NULL);
            }
          image->next->file=image->file;
!         (void) strcpy(image->next->filename,image->filename);
          image->next->last=image;
          image=image->next;
        }
--- 3356,3363 ----
              return((Image *) NULL);
            }
          image->next->file=image->file;
!         (void) sprintf(image->next->filename,"%s.%u\0",filename,image->scene+1);
!         image->next->scene=image->scene+1;
          image->next->last=image;
          image=image->next;
        }
Common subdirectories: ImageMagick/images and ImageMagick2.1.2/images
diff -c -r ImageMagick/import.c ImageMagick2.1.2/import.c
*** ImageMagick/import.c	Wed Nov 11 14:12:12 1992
--- ImageMagick2.1.2/import.c	Sat Nov 14 01:53:04 1992
***************
*** 226,232 ****
      i,
      x;
  
!   long
      start_time;
  
    unsigned int
--- 226,232 ----
      i,
      x;
  
!   time_t
      start_time;
  
    unsigned int
***************
*** 447,453 ****
    */
    if (delay > 0)
      (void) sleep(delay);
!   start_time=time((long *) 0);
    image=ReadXImage(target_window,server_name,frame,screen,borders);
    if (image == (Image *) NULL)
      exit(1);
--- 447,453 ----
    */
    if (delay > 0)
      (void) sleep(delay);
!   start_time=time((time_t *) 0);
    image=ReadXImage(target_window,server_name,frame,screen,borders);
    if (image == (Image *) NULL)
      exit(1);
***************
*** 472,478 ****
        else
          (void) fprintf(stderr," PseudoClass ");
        (void) fprintf(stderr,"%dc %s %ds\n",image->colors,image->magick,
!         time((long *) 0)-start_time+1);
      }
    DestroyImage(image);
    XCloseDisplay(display);
--- 472,478 ----
        else
          (void) fprintf(stderr," PseudoClass ");
        (void) fprintf(stderr,"%dc %s %ds\n",image->colors,image->magick,
!         time((time_t *) 0)-start_time+1);
      }
    DestroyImage(image);
    XCloseDisplay(display);
diff -c -r ImageMagick/montage.c ImageMagick2.1.2/montage.c
*** ImageMagick/montage.c	Thu Nov 12 13:35:11 1992
--- ImageMagick2.1.2/montage.c	Sat Nov 14 01:51:40 1992
***************
*** 649,655 ****
      i,
      x;
  
!   long
      start_time;
  
    unsigned int
--- 649,655 ----
      i,
      x;
  
!   time_t
      start_time;
  
    unsigned int
***************
*** 657,662 ****
--- 657,663 ----
      compression,
      display_image,
      image_number,
+     maximum_images,
      tiles_per_row,
      verbose;
  
***************
*** 694,700 ****
    server_name=(char *) NULL;
    tiles_per_row=0;
    verbose=False;
!   images=(Image **) malloc(argc*sizeof(Image *));
    if (images == (Image **) NULL)
      Error("unable to montage images","memory allocation failed");
    /*
--- 695,702 ----
    server_name=(char *) NULL;
    tiles_per_row=0;
    verbose=False;
!   maximum_images=2048;
!   images=(Image **) malloc(maximum_images*sizeof(Image *));
    if (images == (Image **) NULL)
      Error("unable to montage images","memory allocation failed");
    /*
***************
*** 1112,1118 ****
          /*
            Option is a file name: begin by reading image from specified file.
          */
!         start_time=time((long *) 0);
          (void) strcpy(alien_info.filename,option);
          image=ReadAlienImage(&alien_info);
          if (image == (Image *) NULL)
--- 1114,1120 ----
          /*
            Option is a file name: begin by reading image from specified file.
          */
!         start_time=time((time_t *) 0);
          (void) strcpy(alien_info.filename,option);
          image=ReadAlienImage(&alien_info);
          if (image == (Image *) NULL)
***************
*** 1196,1201 ****
--- 1198,1214 ----
            (void) PackImage(image);
            (void) free((void *) image->pixels);
            image->pixels=(RunlengthPacket *) NULL;
+           if (image_number == maximum_images)
+             {
+               /*
+                 Increase size of images array.
+               */
+               maximum_images<<=1;
+               images=(Image **)
+                 realloc((void *) images,maximum_images*sizeof(Image *));
+               if (images == (Image **) NULL)
+                 Error("unable to montage images","memory allocation failed");
+             }
            images[image_number++]=image;
            image=image->next;
          } while (image != (Image *) NULL);
***************
*** 1234,1240 ****
        else
          (void) fprintf(stderr," PseudoClass ");
        (void) fprintf(stderr,"%uc %s %lds\n",montage_image->colors,
!         montage_image->magick,time((long *) 0)-start_time+1);
      }
    DestroyImage(montage_image);
    (void) free((void *) images);
--- 1247,1253 ----
        else
          (void) fprintf(stderr," PseudoClass ");
        (void) fprintf(stderr,"%uc %s %lds\n",montage_image->colors,
!         montage_image->magick,time((time_t *) 0)-start_time+1);
      }
    DestroyImage(montage_image);
    (void) free((void *) images);
Common subdirectories: ImageMagick/scenes and ImageMagick2.1.2/scenes
Common subdirectories: ImageMagick/utilities and ImageMagick2.1.2/utilities
Common subdirectories: ImageMagick/xtp and ImageMagick2.1.2/xtp
diff -c -r ImageMagick/utilities/MIFFtoSTEREO.c ImageMagick2.1.2/utilities/MIFFtoSTEREO.c
*** ImageMagick/utilities/MIFFtoSTEREO.c	Thu Nov 12 13:35:12 1992
--- ImageMagick2.1.2/utilities/MIFFtoSTEREO.c	Sat Nov 14 01:52:04 1992
***************
*** 174,186 ****
    int
      status;
  
!   long
      start_time;
  
    application_name=argv[0];
    if (argc < 4)
      Usage((char *) NULL);
!   start_time=time((long *) 0);
    left_image=ReadImage(argv[1]);
    if (left_image == (Image *) NULL)
      exit(1);
--- 174,186 ----
    int
      status;
  
!   time_t
      start_time;
  
    application_name=argv[0];
    if (argc < 4)
      Usage((char *) NULL);
!   start_time=time((time_t *) 0);
    left_image=ReadImage(argv[1]);
    if (left_image == (Image *) NULL)
      exit(1);
***************
*** 201,206 ****
    else
      (void) fprintf(stderr," PseudoClass ");
    (void) fprintf(stderr,"%dc %s %ds\n",stereo_image->colors,
!     stereo_image->magick,time((long *) 0)-start_time+1);
    return(!status);
  }
--- 201,206 ----
    else
      (void) fprintf(stderr," PseudoClass ");
    (void) fprintf(stderr,"%dc %s %ds\n",stereo_image->colors,
!     stereo_image->magick,time((time_t *) 0)-start_time+1);
    return(!status);
  }
diff -c -r ImageMagick/utilities/convert.c ImageMagick2.1.2/utilities/convert.c
*** ImageMagick/utilities/convert.c	Thu Nov 12 13:35:13 1992
--- ImageMagick2.1.2/utilities/convert.c	Sat Nov 14 01:52:04 1992
***************
*** 75,80 ****
--- 75,81 ----
  #include "display.h"
  #include "image.h"
  #include "alien.h"
+ #include "X.h"
  
  /*
    Global declarations.
***************
*** 220,226 ****
      status,
      x;
  
!   long
      start_time;
  
    unsigned int
--- 221,227 ----
      status,
      x;
  
!   time_t
      start_time;
  
    unsigned int
***************
*** 446,452 ****
    }
    if (filename == (char *) NULL)
      Error("missing an image file name",(char *) NULL);
!   start_time=time((long *) 0);
    (void) strcpy(alien_info.filename,filename);
    image=ReadAlienImage(&alien_info);
    if (image == (Image *) NULL)
--- 447,453 ----
    }
    if (filename == (char *) NULL)
      Error("missing an image file name",(char *) NULL);
!   start_time=time((time_t *) 0);
    (void) strcpy(alien_info.filename,filename);
    image=ReadAlienImage(&alien_info);
    if (image == (Image *) NULL)
***************
*** 512,518 ****
                normalized_mean_error,normalized_maximum_error);
            }
          (void) fprintf(stderr," %s %lds\n",image->magick,
!           time((long *) 0)-start_time+1);
        }
      next_image=image->next;
      DestroyImage(image);
--- 513,519 ----
                normalized_mean_error,normalized_maximum_error);
            }
          (void) fprintf(stderr," %s %lds\n",image->magick,
!           time((time_t *) 0)-start_time+1);
        }
      next_image=image->next;
      DestroyImage(image);
diff -c -r ImageMagick/utilities/mogrify.c ImageMagick2.1.2/utilities/mogrify.c
*** ImageMagick/utilities/mogrify.c	Thu Nov 12 13:35:14 1992
--- ImageMagick2.1.2/utilities/mogrify.c	Sat Nov 14 01:52:04 1992
***************
*** 88,93 ****
--- 88,94 ----
  #include "display.h"
  #include "image.h"
  #include "alien.h"
+ #include "X.h"
  
  /*
    Global declarations.
***************
*** 250,255 ****
--- 251,257 ----
      enhance,
      image_number,
      inverse,
+     maximum_images,
      monochrome,
      noise,
      normalize,
***************
*** 287,295 ****
    scene=0;
    tree_depth=0;
    verbose=False;
!   images=(Image **) malloc(argc*sizeof(Image *));
    if (images == (Image **) NULL)
!     Error("unable to animate images","memory allocation failed");
    /*
      Parse command line.
    */
--- 289,298 ----
    scene=0;
    tree_depth=0;
    verbose=False;
!   maximum_images=2048;
!   images=(Image **) malloc(maximum_images*sizeof(Image *));
    if (images == (Image **) NULL)
!     Error("unable to mogrify images","memory allocation failed");
    /*
      Parse command line.
    */
***************
*** 555,564 ****
        {
          Image
            *image,
!           *next_image,
!           info_image;
  
!         long
            start_time;
  
          unsigned long
--- 558,567 ----
        {
          Image
            *image,
!           info_image,
!           *next_image;
  
!         time_t
            start_time;
  
          unsigned long
***************
*** 567,573 ****
          /*
            Option is a file name: begin by reading image from specified file.
          */
!         start_time=time((long *) 0);
          (void) strcpy(alien_info.filename,option);
          image=ReadAlienImage(&alien_info);
          if (image == (Image *) NULL)
--- 570,576 ----
          /*
            Option is a file name: begin by reading image from specified file.
          */
!         start_time=time((time_t *) 0);
          (void) strcpy(alien_info.filename,option);
          image=ReadAlienImage(&alien_info);
          if (image == (Image *) NULL)
***************
*** 706,712 ****
                      normalized_mean_error,normalized_maximum_error);
                  }
                (void) fprintf(stderr," %s %lds\n",image->magick,
!                 time((long *) 0)-start_time+1);
              }
            if (compression != UnknownCompression)
              image->compression=compression;
--- 709,715 ----
                      normalized_mean_error,normalized_maximum_error);
                  }
                (void) fprintf(stderr," %s %lds\n",image->magick,
!                 time((time_t *) 0)-start_time+1);
              }
            if (compression != UnknownCompression)
              image->compression=compression;
***************
*** 714,719 ****
--- 717,733 ----
              image->compression=info_image.compression;
            if (number_colors == 0)
              (void) WriteAlienImage(image);
+           if (image_number == maximum_images)
+             {
+               /*
+                 Increase size of images array.
+               */
+               maximum_images<<=1;
+               images=(Image **)
+                 realloc((void *) images,maximum_images*sizeof(Image *));
+               if (images == (Image **) NULL)
+                 Error("unable to mogrify images","memory allocation failed");
+             }
            images[image_number++]=image;
            next_image=image->next;
            if (next_image != (Image *) NULL)
***************
*** 727,742 ****
      Error("missing an image file name",(char *) NULL);
    if (number_colors > 0)
      {
-       unsigned int
-         number_images;
- 
        /*
          Global colormap option;  reduce colors then write image.
        */
!       number_images=image_number;
!       QuantizeImages(images,number_images,number_colors,tree_depth,dither,
          colorspace,True);
!       for (image_number=0; image_number < number_images; image_number++)
        {
          (void) WriteAlienImage(images[image_number]);
          DestroyImage(images[image_number]);
--- 741,753 ----
      Error("missing an image file name",(char *) NULL);
    if (number_colors > 0)
      {
        /*
          Global colormap option;  reduce colors then write image.
        */
!       maximum_images=image_number;
!       QuantizeImages(images,maximum_images,number_colors,tree_depth,dither,
          colorspace,True);
!       for (image_number=0; image_number < maximum_images; image_number++)
        {
          (void) WriteAlienImage(images[image_number]);
          DestroyImage(images[image_number]);
-- 
cristy@dupont.com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads