From f5038fdd02707cd770e2f54c5686bcf4c510b6bb Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Sun, 11 Apr 2021 10:08:05 +0200 Subject: [PATCH] Introduced MagickTimeExtent. --- MagickCore/constitute.c | 6 +++--- MagickCore/log.c | 4 ++-- MagickCore/method-attribute.h | 1 + coders/dng.c | 4 ++-- coders/pdf.c | 12 ++++++------ coders/ps.c | 4 ++-- coders/ps2.c | 4 ++-- coders/ps3.c | 4 ++-- 8 files changed, 20 insertions(+), 19 deletions(-) diff --git a/MagickCore/constitute.c b/MagickCore/constitute.c index 5ae318e7e7..d3e4516c24 100644 --- a/MagickCore/constitute.c +++ b/MagickCore/constitute.c @@ -661,7 +661,7 @@ MagickExport Image *ReadImage(const ImageInfo *image_info, char magick_path[MagickPathExtent], *property, - timestamp[MagickPathExtent]; + timestamp[MagickTimeExtent]; const char *option; @@ -815,10 +815,10 @@ MagickExport Image *ReadImage(const ImageInfo *image_info, if (source_date_epoch == (const char *) NULL) { (void) FormatMagickTime((time_t) GetBlobProperties(next)->st_mtime, - MagickPathExtent,timestamp); + sizeof(timestamp),timestamp); (void) SetImageProperty(next,"date:modify",timestamp,exception); (void) FormatMagickTime((time_t) GetBlobProperties(next)->st_ctime, - MagickPathExtent,timestamp); + sizeof(timestamp),timestamp); (void) SetImageProperty(next,"date:create",timestamp,exception); } option=GetImageOption(image_info,"delay"); diff --git a/MagickCore/log.c b/MagickCore/log.c index 2c34e8b0e7..1e35b4ddba 100644 --- a/MagickCore/log.c +++ b/MagickCore/log.c @@ -1231,12 +1231,12 @@ static char *TranslateEvent(const char *module,const char *function, if (LocaleCompare(log_info->format,"xml") == 0) { char - timestamp[MagickPathExtent]; + timestamp[MagickTimeExtent]; /* Translate event in "XML" format. */ - (void) FormatMagickTime(seconds,extent,timestamp); + (void) FormatMagickTime(seconds,sizeof(timestamp),timestamp); (void) FormatLocaleString(text,extent, "\n" " %s\n" diff --git a/MagickCore/method-attribute.h b/MagickCore/method-attribute.h index f8304d53d1..c03617ba67 100644 --- a/MagickCore/method-attribute.h +++ b/MagickCore/method-attribute.h @@ -88,6 +88,7 @@ extern "C" { # define MagickPathExtent 4096 /* always >= 4096 */ #endif #define MaxTextExtent MagickPathExtent +#define MagickTimeExtent 26 #if defined(MAGICKCORE_HAVE___ATTRIBUTE__) # define magick_aligned(x,y) x __attribute__((aligned(y))) diff --git a/coders/dng.c b/coders/dng.c index af0f8a29eb..ba09bcacc0 100644 --- a/coders/dng.c +++ b/coders/dng.c @@ -163,12 +163,12 @@ static void SetDNGProperties(Image *image,const libraw_data_t *raw_info, ExceptionInfo *exception) { char - timestamp[MagickPathExtent]; + timestamp[MagickTimeExtent]; (void) SetImageProperty(image,"dng:make",raw_info->idata.make,exception); (void) SetImageProperty(image,"dng:camera.model.name",raw_info->idata.model, exception); - (void) FormatMagickTime(raw_info->other.timestamp,MagickPathExtent,timestamp); + (void) FormatMagickTime(raw_info->other.timestamp,sizeof(timestamp),timestamp); (void) SetImageProperty(image,"dng:create.date",timestamp,exception); (void) FormatImageProperty(image,"dng:iso.setting","%0.1f", raw_info->other.iso_speed); diff --git a/coders/pdf.c b/coders/pdf.c index 7792d417ab..aa28c14ddd 100644 --- a/coders/pdf.c +++ b/coders/pdf.c @@ -1402,9 +1402,9 @@ static MagickBooleanType WritePDFImage(const ImageInfo *image_info,Image *image, if (LocaleCompare(image_info->magick,"PDFA") == 0) { char - create_date[MagickPathExtent], - modify_date[MagickPathExtent], - timestamp[MagickPathExtent], + create_date[MagickTimeExtent], + modify_date[MagickTimeExtent], + timestamp[MagickTimeExtent], xmp_profile[MagickPathExtent]; /* @@ -1419,12 +1419,12 @@ static MagickBooleanType WritePDFImage(const ImageInfo *image_info,Image *image, *modify_date='\0'; value=GetImageProperty(image,"date:modify",exception); if (value != (const char *) NULL) - (void) CopyMagickString(modify_date,value,MagickPathExtent); + (void) CopyMagickString(modify_date,value,sizeof(modify_date)); *create_date='\0'; value=GetImageProperty(image,"date:create",exception); if (value != (const char *) NULL) - (void) CopyMagickString(create_date,value,MagickPathExtent); - (void) FormatMagickTime(GetMagickTime(),MagickPathExtent,timestamp); + (void) CopyMagickString(create_date,value,sizeof(create_date)); + (void) FormatMagickTime(GetMagickTime(),sizeof(timestamp),timestamp); url=(char *) MagickAuthoritativeURL; escape=EscapeParenthesis(basename); i=FormatLocaleString(xmp_profile,MagickPathExtent,XMPProfile, diff --git a/coders/ps.c b/coders/ps.c index 3c18e5a923..5fa8f8caf9 100644 --- a/coders/ps.c +++ b/coders/ps.c @@ -1337,7 +1337,7 @@ static MagickBooleanType WritePSImage(const ImageInfo *image_info,Image *image, char buffer[MagickPathExtent], - date[MagickPathExtent], + date[MagickTimeExtent], **labels, page_geometry[MagickPathExtent]; @@ -1516,7 +1516,7 @@ static MagickBooleanType WritePSImage(const ImageInfo *image_info,Image *image, image->filename); (void) WriteBlobString(image,buffer); timer=GetMagickTime(); - (void) FormatMagickTime(timer,MagickPathExtent,date); + (void) FormatMagickTime(timer,sizeof(date),date); (void) FormatLocaleString(buffer,MagickPathExtent, "%%%%CreationDate: (%s)\n",date); (void) WriteBlobString(image,buffer); diff --git a/coders/ps2.c b/coders/ps2.c index 31e7f75c73..de66ca739f 100644 --- a/coders/ps2.c +++ b/coders/ps2.c @@ -375,7 +375,7 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image, char buffer[MagickPathExtent], - date[MagickPathExtent], + date[MagickTimeExtent], page_geometry[MagickPathExtent], **labels; @@ -566,7 +566,7 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image, image->filename); (void) WriteBlobString(image,buffer); timer=GetMagickTime(); - (void) FormatMagickTime(timer,MagickPathExtent,date); + (void) FormatMagickTime(timer,sizeof(date),date); (void) FormatLocaleString(buffer,MagickPathExtent, "%%%%CreationDate: (%s)\n",date); (void) WriteBlobString(image,buffer); diff --git a/coders/ps3.c b/coders/ps3.c index 62f47c439d..983862413d 100644 --- a/coders/ps3.c +++ b/coders/ps3.c @@ -813,7 +813,7 @@ static MagickBooleanType WritePS3Image(const ImageInfo *image_info,Image *image, char buffer[MagickPathExtent], - date[MagickPathExtent], + date[MagickTimeExtent], **labels, page_geometry[MagickPathExtent]; @@ -1016,7 +1016,7 @@ static MagickBooleanType WritePS3Image(const ImageInfo *image_info,Image *image, image->filename); (void) WriteBlobString(image,buffer); timer=GetMagickTime(); - (void) FormatMagickTime(timer,MagickPathExtent,date); + (void) FormatMagickTime(timer,sizeof(date),date); (void) FormatLocaleString(buffer,MagickPathExtent, "%%%%CreationDate: %s\n",date); (void) WriteBlobString(image,buffer);