]> granicus.if.org Git - imagemagick/commitdiff
Clone rather than copy window title
authorCristy <urban-warrior@imagemagick.org>
Mon, 24 Jun 2019 14:58:25 +0000 (10:58 -0400)
committerCristy <urban-warrior@imagemagick.org>
Mon, 24 Jun 2019 14:58:25 +0000 (10:58 -0400)
MagickCore/animate.c
MagickCore/display.c

index 48cf8fd3d546a2c30dc78db2ecc2baa4a00c4496..a32fcdfa4a3b99e2e0e3c263bdc9219e2f29d6c9 100644 (file)
@@ -480,7 +480,8 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
     case PlayCommand:
     {
       char
-        basename[MagickPathExtent];
+        basename[MagickPathExtent],
+        name[MagickPathExtent];
 
       int
         status;
@@ -491,8 +492,9 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
       *state|=PlayAnimationState;
       *state&=(~AutoReverseAnimationState);
       GetPathComponent((*image)->magick_filename,BasePath,basename);
-      (void) FormatLocaleString(windows->image.name,MagickPathExtent,
-        "%s: %s",MagickPackageName,basename);
+      (void) FormatLocaleString(name,MagickPathExtent,"%s: %s",
+        MagickPackageName,basename);
+      (void) CloneString(&windows->image.name,name);
       if (resource_info->title != (char *) NULL)
         {
           char
@@ -500,7 +502,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info,
 
           title=InterpretImageProperties(resource_info->image_info,*image,
             resource_info->title,exception);
-          (void) CopyMagickString(windows->image.name,title,MagickPathExtent);
+          (void) CloneString(&windows->image.name,title);
           title=DestroyString(title);
         }
       status=XStringListToTextProperty(&windows->image.name,1,&window_name);
@@ -1664,23 +1666,25 @@ MagickExport Image *XAnimateImages(Display *display,
 
       title=InterpretImageProperties(resource_info->image_info,display_image,
         resource_info->title,exception);
-      (void) CopyMagickString(windows->image.name,title,MagickPathExtent);
-      (void) CopyMagickString(windows->image.icon_name,title,MagickPathExtent);
+      (void) CloneString(&windows->image.name,title);
+      (void) CloneString(&windows->image.icon_name,title);
       title=DestroyString(title);
     }
   else
     {
       char
-        filename[MagickPathExtent];
+        filename[MagickPathExtent],
+        window_name[MagickPathExtent];
 
       /*
         Window name is the base of the filename.
       */
       GetPathComponent(display_image->magick_filename,TailPath,filename);
-      (void) FormatLocaleString(windows->image.name,MagickPathExtent,
+      (void) FormatLocaleString(window_name,MagickPathExtent,
         "%s: %s[scene: %.20g frames: %.20g]",MagickPackageName,filename,(double)
         display_image->scene,(double) number_scenes);
-      (void) CopyMagickString(windows->image.icon_name,filename,MagickPathExtent);
+      (void) CloneString(&windows->image.name,window_name);
+      (void) CloneString(&windows->image.icon_name,filename);
     }
   if (resource_info->immutable != MagickFalse)
     windows->image.immutable=MagickTrue;
@@ -1974,18 +1978,22 @@ MagickExport Image *XAnimateImages(Display *display,
 
         title=InterpretImageProperties(resource_info->image_info,
           image_list[scene],resource_info->title,exception);
-        (void) CopyMagickString(windows->image.name,title,MagickPathExtent);
+        (void) CloneString(&windows->image.name,title);
         title=DestroyString(title);
       }
     else
       {
+        char
+          window_name[MaxTextExtent];
+
         p=image_list[scene]->magick_filename+
           strlen(image_list[scene]->magick_filename)-1;
         while ((p > image_list[scene]->magick_filename) && (*(p-1) != '/'))
           p--;
-        (void) FormatLocaleString(windows->image.name,MagickPathExtent,
+        (void) FormatLocaleString(window_name,MagickPathExtent,
           "%s: %s[%.20g of %.20g]",MagickPackageName,p,(double) scene+1,
           (double) number_scenes);
+        (void) CloneString(&windows->image.name,window_name);
       }
     status=XStringListToTextProperty(&windows->image.name,1,&window_name);
     if (status != Success)
@@ -2095,6 +2103,9 @@ MagickExport Image *XAnimateImages(Display *display,
           if ((state & StepAnimationState) ||
               (resource_info->title != (char *) NULL))
             {
+              char
+                name[MaxTextExtent];
+
               /*
                 Update window title.
               */
@@ -2102,9 +2113,10 @@ MagickExport Image *XAnimateImages(Display *display,
                 strlen(image_list[scene]->filename)-1;
               while ((p > image_list[scene]->filename) && (*(p-1) != '/'))
                 p--;
-              (void) FormatLocaleString(windows->image.name,MagickPathExtent,
+              (void) FormatLocaleString(name,MagickPathExtent,
                 "%s: %s[%.20g of %.20g]",MagickPackageName,p,(double)
                 scene+1,(double) number_scenes);
+              (void) CloneString(&windows->image.name,name);
               if (resource_info->title != (char *) NULL)
                 {
                   char
@@ -2112,8 +2124,7 @@ MagickExport Image *XAnimateImages(Display *display,
 
                   title=InterpretImageProperties(resource_info->image_info,
                     image,resource_info->title,exception);
-                  (void) CopyMagickString(windows->image.name,title,
-                    MagickPathExtent);
+                  (void) CloneString(&windows->image.name,title);
                   title=DestroyString(title);
                 }
               status=XStringListToTextProperty(&windows->image.name,1,
index 932309745c791ce2219272c139146b1c56b2d8b6..d60fa943c6d2adc97814724a6b25cfc48e13cc81 100644 (file)
@@ -14724,29 +14724,30 @@ MagickExport Image *XDisplayImage(Display *display,XResourceInfo *resource_info,
 
       title=InterpretImageProperties(resource_info->image_info,display_image,
         resource_info->title,exception);
-      (void) CopyMagickString(windows->image.name,title,MagickPathExtent);
-      (void) CopyMagickString(windows->image.icon_name,title,MagickPathExtent);
+      (void) CloneString(&windows->image.name,title);
+      (void) CloneString(&windows->image.icon_name,title);
       title=DestroyString(title);
     }
   else
     {
       char
-        filename[MagickPathExtent];
+        filename[MagickPathExtent],
+        window_name[MagickPathExtent];
 
       /*
         Window name is the base of the filename.
       */
       GetPathComponent(display_image->magick_filename,TailPath,filename);
       if (display_image->scene == 0)
-        (void) FormatLocaleString(windows->image.name,MagickPathExtent,
-          "%s: %s",MagickPackageName,filename);
+        (void) FormatLocaleString(window_name,MagickPathExtent,"%s: %s",
+          MagickPackageName,filename);
       else
-        (void) FormatLocaleString(windows->image.name,MagickPathExtent,
+        (void) FormatLocaleString(window_name,MagickPathExtent,
           "%s: %s[scene: %.20g frames: %.20g]",MagickPackageName,filename,
           (double) display_image->scene,(double) GetImageListLength(
           display_image));
-      (void) CopyMagickString(windows->image.icon_name,filename,
-        MagickPathExtent);
+      (void) CloneString(&windows->image.name,window_name);
+      (void) CloneString(&windows->image.icon_name,filename);
     }
   if (resource_info->immutable)
     windows->image.immutable=MagickTrue;