assume time_t is signed

This commit is contained in:
Cristy
2023-10-15 19:15:27 -04:00
parent 207fceebae
commit df6244652a
2 changed files with 14 additions and 2 deletions
+12
View File
@@ -114,6 +114,18 @@ static inline long StringToLong(const char *magick_restrict value)
return(strtol(value,(char **) NULL,10));
}
static inline MagickOffsetType StringToMagickOffsetType(const char *string,
const double interval)
{
double
value;
value=SiPrefixToDoubleInterval(string,interval);
if (value >= (double) MagickULLConstant(~0))
return((MagickOffsetType) MagickULLConstant(~0));
return((MagickOffsetType) value);
}
static inline MagickSizeType StringToMagickSizeType(const char *string,
const double interval)
{
+2 -2
View File
@@ -360,17 +360,17 @@ MagickExport time_t GetMagickTime(void)
const char
*source_date_epoch;
epoch_initialized=MagickTrue;
source_date_epoch=getenv("SOURCE_DATE_EPOCH");
if (source_date_epoch != (const char *) NULL)
{
time_t
epoch;
epoch=(time_t) StringToUnsignedLong(source_date_epoch);
epoch=(time_t) StringToMagickOffsetType(source_date_epoch,100.0);
if ((epoch > 0) && (epoch <= time((time_t *) NULL)))
magick_epoch=epoch;
}
epoch_initialized=MagickTrue;
}
if (magick_epoch != 0)
return(magick_epoch);