Clone rather than copy window title
diff --git a/MagickCore/animate.c b/MagickCore/animate.c
index 48cf8fd..a32fcdf 100644
--- a/MagickCore/animate.c
+++ b/MagickCore/animate.c
@@ -480,7 +480,8 @@
case PlayCommand:
{
char
- basename[MagickPathExtent];
+ basename[MagickPathExtent],
+ name[MagickPathExtent];
int
status;
@@ -491,8 +492,9 @@
*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 @@
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 @@
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 @@
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 @@
if ((state & StepAnimationState) ||
(resource_info->title != (char *) NULL))
{
+ char
+ name[MaxTextExtent];
+
/*
Update window title.
*/
@@ -2102,9 +2113,10 @@
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 @@
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,
diff --git a/MagickCore/display.c b/MagickCore/display.c
index 9323097..d60fa94 100644
--- a/MagickCore/display.c
+++ b/MagickCore/display.c
@@ -14724,29 +14724,30 @@
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;