From e27293e706ca05b6b121e9512a83b16f7ad887f2 Mon Sep 17 00:00:00 2001 From: cristy Date: Fri, 18 Dec 2009 02:53:20 +0000 Subject: [PATCH] --- coders/cin.c | 6 +++--- coders/dcm.c | 4 ++-- coders/dpx.c | 14 +++++++------- coders/hald.c | 2 +- coders/meta.c | 4 ++-- coders/miff.c | 16 ++++++++-------- coders/mpc.c | 18 +++++++++--------- coders/msl.c | 6 +++--- coders/pnm.c | 8 ++++---- configure.ac | 2 +- magick/animate.c | 2 +- magick/display.c | 10 +++++----- magick/draw.c | 4 ++-- magick/image.c | 12 ++++++------ magick/log.c | 4 ++-- magick/property.c | 4 ++-- magick/resource.c | 2 +- magick/string-private.h | 11 ++++++++--- magick/threshold.c | 4 ++-- magick/type.c | 4 ++-- magick/xwindow.c | 10 +++++----- tests/validate.c | 2 +- wand/animate.c | 9 +++++---- wand/display.c | 14 +++++++------- wand/drawing-wand.c | 4 ++-- wand/import.c | 12 ++++++------ wand/mogrify.c | 24 ++++++++++++------------ wand/montage.c | 4 ++-- 28 files changed, 111 insertions(+), 105 deletions(-) diff --git a/coders/cin.c b/coders/cin.c index 559439349..26442fc3a 100644 --- a/coders/cin.c +++ b/coders/cin.c @@ -1103,12 +1103,12 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image) cin.film.prefix=0UL; value=GetCINProperty(image_info,image,"cin:film.prefix"); if (value != (const char *) NULL) - cin.film.prefix=(unsigned long) StringToLong(value); + cin.film.prefix=StringToUnsignedLong(value); offset+=WriteBlobLong(image,cin.film.prefix); cin.film.count=0UL; value=GetCINProperty(image_info,image,"cin:film.count"); if (value != (const char *) NULL) - cin.film.count=(unsigned long) StringToLong(value); + cin.film.count=StringToUnsignedLong(value); offset+=WriteBlobLong(image,cin.film.count); value=GetCINProperty(image_info,image,"cin:film.format"); if (value != (const char *) NULL) @@ -1118,7 +1118,7 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image) cin.film.frame_position=0UL; value=GetCINProperty(image_info,image,"cin:film.frame_position"); if (value != (const char *) NULL) - cin.film.frame_position=(unsigned long) StringToLong(value); + cin.film.frame_position=StringToUnsignedLong(value); offset+=WriteBlobLong(image,cin.film.frame_position); cin.film.frame_rate=0.0f; value=GetCINProperty(image_info,image,"cin:film.frame_rate"); diff --git a/coders/dcm.c b/coders/dcm.c index 392666c4c..95a608fdb 100644 --- a/coders/dcm.c +++ b/coders/dcm.c @@ -3174,7 +3174,7 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Number of frames. */ - number_scenes=(unsigned long) StringToLong((char *) data); + number_scenes=StringToUnsignedLong((char *) data); break; } case 0x0010: @@ -3252,7 +3252,7 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Visible pixel range: width. */ - window_width=(unsigned long) StringToLong((char *) data); + window_width=StringToUnsignedLong((char *) data); break; } case 0x1200: diff --git a/coders/dpx.c b/coders/dpx.c index 43b283a03..39a70145c 100644 --- a/coders/dpx.c +++ b/coders/dpx.c @@ -1612,12 +1612,12 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image) dpx.orientation.x_offset=0U; value=GetDPXProperty(image_info,image,"dpx:orientation.x_offset"); if (value != (const char *) NULL) - dpx.orientation.x_offset=(unsigned int) StringToLong(value); + dpx.orientation.x_offset=(unsigned int) StringToUnsignedLong(value); offset+=WriteBlobLong(image,dpx.orientation.x_offset); dpx.orientation.y_offset=0U; value=GetDPXProperty(image_info,image,"dpx:orientation.y_offset"); if (value != (const char *) NULL) - dpx.orientation.y_offset=(unsigned int) StringToLong(value); + dpx.orientation.y_offset=(unsigned int) StringToUnsignedLong(value); offset+=WriteBlobLong(image,dpx.orientation.y_offset); dpx.orientation.x_center=0.0f; value=GetDPXProperty(image_info,image,"dpx:orientation.x_center"); @@ -1632,12 +1632,12 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image) dpx.orientation.x_size=0U; value=GetDPXProperty(image_info,image,"dpx:orientation.x_size"); if (value != (const char *) NULL) - dpx.orientation.x_size=(unsigned int) StringToLong(value); + dpx.orientation.x_size=(unsigned int) StringToUnsignedLong(value); offset+=WriteBlobLong(image,dpx.orientation.x_size); dpx.orientation.y_size=0U; value=GetDPXProperty(image_info,image,"dpx:orientation.y_size"); if (value != (const char *) NULL) - dpx.orientation.y_size=(unsigned int) StringToLong(value); + dpx.orientation.y_size=(unsigned int) StringToUnsignedLong(value); offset+=WriteBlobLong(image,dpx.orientation.y_size); value=GetDPXProperty(image_info,image,"dpx:orientation.filename"); if (value != (const char *) NULL) @@ -1726,17 +1726,17 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image) dpx.film.frame_position=0U; value=GetDPXProperty(image_info,image,"dpx:film.frame_position"); if (value != (const char *) NULL) - dpx.film.frame_position=(unsigned int) StringToLong(value); + dpx.film.frame_position=(unsigned int) StringToUnsignedLong(value); offset+=WriteBlobLong(image,dpx.film.frame_position); dpx.film.sequence_extent=0U; value=GetDPXProperty(image_info,image,"dpx:film.sequence_extent"); if (value != (const char *) NULL) - dpx.film.sequence_extent=(unsigned int) StringToLong(value); + dpx.film.sequence_extent=(unsigned int) StringToUnsignedLong(value); offset+=WriteBlobLong(image,dpx.film.sequence_extent); dpx.film.held_count=0U; value=GetDPXProperty(image_info,image,"dpx:film.held_count"); if (value != (const char *) NULL) - dpx.film.held_count=(unsigned int) StringToLong(value); + dpx.film.held_count=(unsigned int) StringToUnsignedLong(value); offset+=WriteBlobLong(image,dpx.film.held_count); dpx.film.frame_rate=0.0f; value=GetDPXProperty(image_info,image,"dpx:film.frame_rate"); diff --git a/coders/hald.c b/coders/hald.c index 921f48f8d..edecbb48c 100644 --- a/coders/hald.c +++ b/coders/hald.c @@ -118,7 +118,7 @@ static Image *ReadHALDImage(const ImageInfo *image_info, image=AcquireImage(image_info); level=0; if (*image_info->filename != '\0') - level=(unsigned long) StringToLong(image_info->filename); + level=StringToUnsignedLong(image_info->filename); if (level < 2) level=8; status=MagickTrue; diff --git a/coders/meta.c b/coders/meta.c index 5837442fe..70496364b 100644 --- a/coders/meta.c +++ b/coders/meta.c @@ -362,7 +362,7 @@ static long parse8BIM(Image *ifile, Image *ofile) dataset = (unsigned char) StringToLong(newstr); break; case 1: - recnum = (unsigned int) StringToLong(newstr); + recnum = (unsigned int) StringToUnsignedLong(newstr); break; case 2: name=(char *) AcquireQuantumMemory(strlen(newstr)+MaxTextExtent, @@ -638,7 +638,7 @@ static long parse8BIMW(Image *ifile, Image *ofile) dataset = (unsigned char) StringToLong(newstr); break; case 1: - recnum=(unsigned int) StringToLong(newstr); + recnum=(unsigned int) StringToUnsignedLong(newstr); break; case 2: name=(char *) AcquireQuantumMemory(strlen(newstr)+MaxTextExtent, diff --git a/coders/miff.c b/coders/miff.c index c6ac0c917..10f6dd4b4 100644 --- a/coders/miff.c +++ b/coders/miff.c @@ -624,7 +624,7 @@ static Image *ReadMIFFImage(const ImageInfo *image_info, } if (LocaleCompare(keyword,"colors") == 0) { - colors=(unsigned long) StringToLong(options); + colors=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,"colorspace") == 0) @@ -653,7 +653,7 @@ static Image *ReadMIFFImage(const ImageInfo *image_info, } if (LocaleCompare(keyword,"columns") == 0) { - image->columns=(unsigned long) StringToLong(options); + image->columns=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); @@ -664,12 +664,12 @@ static Image *ReadMIFFImage(const ImageInfo *image_info, { if (LocaleCompare(keyword,"delay") == 0) { - image->delay=(unsigned long) StringToLong(options); + image->delay=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,"depth") == 0) { - image->depth=(unsigned long) StringToLong(options); + image->depth=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,"dispose") == 0) @@ -748,7 +748,7 @@ static Image *ReadMIFFImage(const ImageInfo *image_info, } if (LocaleCompare(keyword,"iterations") == 0) { - image->iterations=(unsigned long) StringToLong(options); + image->iterations=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); @@ -849,7 +849,7 @@ static Image *ReadMIFFImage(const ImageInfo *image_info, { if (LocaleCompare(keyword,"quality") == 0) { - image->quality=(unsigned long) StringToLong(options); + image->quality=StringToUnsignedLong(options); break; } if ((LocaleCompare(keyword,"quantum-format") == 0) || @@ -904,7 +904,7 @@ static Image *ReadMIFFImage(const ImageInfo *image_info, } if (LocaleCompare(keyword,"rows") == 0) { - image->rows=(unsigned long) StringToLong(options); + image->rows=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); @@ -915,7 +915,7 @@ static Image *ReadMIFFImage(const ImageInfo *image_info, { if (LocaleCompare(keyword,"scene") == 0) { - image->scene=(unsigned long) StringToLong(options); + image->scene=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); diff --git a/coders/mpc.c b/coders/mpc.c index ece2d72d4..2d78caeab 100644 --- a/coders/mpc.c +++ b/coders/mpc.c @@ -367,7 +367,7 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) } if (LocaleCompare(keyword,"colors") == 0) { - image->colors=(unsigned long) StringToLong(options); + image->colors=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,"colorspace") == 0) @@ -396,7 +396,7 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) } if (LocaleCompare(keyword,"columns") == 0) { - image->columns=(unsigned long) StringToLong(options); + image->columns=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); @@ -407,12 +407,12 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) { if (LocaleCompare(keyword,"delay") == 0) { - image->delay=(unsigned long) StringToLong(options); + image->delay=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,"depth") == 0) { - image->depth=(unsigned long) StringToLong(options); + image->depth=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,"dispose") == 0) @@ -484,7 +484,7 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) } if (LocaleCompare(keyword,"iterations") == 0) { - image->iterations=(unsigned long) StringToLong(options); + image->iterations=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); @@ -592,12 +592,12 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) { if (LocaleCompare(keyword,"quality") == 0) { - image->quality=(unsigned long) StringToLong(options); + image->quality=StringToUnsignedLong(options); break; } if (LocaleCompare(keyword,"quantum-depth") == 0) { - quantum_depth=(unsigned long) StringToLong(options); + quantum_depth=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); @@ -637,7 +637,7 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) } if (LocaleCompare(keyword,"rows") == 0) { - image->rows=(unsigned long) StringToLong(options); + image->rows=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); @@ -648,7 +648,7 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) { if (LocaleCompare(keyword,"scene") == 0) { - image->scene=(unsigned long) StringToLong(options); + image->scene=StringToUnsignedLong(options); break; } (void) SetImageProperty(image,keyword,options); diff --git a/coders/msl.c b/coders/msl.c index 038867e87..58bf57593 100644 --- a/coders/msl.c +++ b/coders/msl.c @@ -5343,7 +5343,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"height") == 0) { - geometry.height=(unsigned long) StringToLong(value); + geometry.height=StringToUnsignedLong(value); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute", @@ -5714,7 +5714,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"height") == 0) { - geometry.height=(unsigned long) StringToLong(value); + geometry.height=StringToUnsignedLong(value); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute", @@ -5790,7 +5790,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"height") == 0) { - geometry.height=(unsigned long) StringToLong(value); + geometry.height=StringToUnsignedLong(value); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute", diff --git a/coders/pnm.c b/coders/pnm.c index ca4dd4229..44881fb3b 100644 --- a/coders/pnm.c +++ b/coders/pnm.c @@ -366,11 +366,11 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception) Assign a value to the specified keyword. */ if (LocaleCompare(keyword,"depth") == 0) - packet_size=(unsigned long) StringToLong(value); + packet_size=StringToUnsignedLong(value); if (LocaleCompare(keyword,"height") == 0) - image->rows=(unsigned long) StringToLong(value); + image->rows=StringToUnsignedLong(value); if (LocaleCompare(keyword,"maxval") == 0) - max_value=(unsigned long) StringToLong(value); + max_value=StringToUnsignedLong(value); if (LocaleCompare(keyword,"TUPLTYPE") == 0) { if (LocaleCompare(value,"BLACKANDWHITE") == 0) @@ -405,7 +405,7 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception) } } if (LocaleCompare(keyword,"width") == 0) - image->columns=(unsigned long) StringToLong(value); + image->columns=StringToUnsignedLong(value); } } if ((image->columns == 0) || (image->rows == 0)) diff --git a/configure.ac b/configure.ac index 74e69589b..631db07be 100755 --- a/configure.ac +++ b/configure.ac @@ -988,7 +988,7 @@ AC_TYPE_SIGNAL AC_FUNC_STRTOD AC_FUNC_VPRINTF -AC_CHECK_FUNCS([_exit atexit clock directio execvp floor fork ftime ftruncate getcwd getpid getexecname getdtablesize getpagesize getrlimit getrusage gettimeofday gmtime_r localtime_r lstat memmove memset mkstemp munmap _NSGetExecutablePath pclose _pclose poll popen _popen posix_fadvise posix_fallocate posix_madvise posix_memalign pow pread pwrite raise rand_r readlink readdir_r realpath select seekdir setlocale sqrt setvbuf stat strchr strerror_r strrchr strcspn strdup strpbrk strspn strstr strtol symlink sysconf sigemptyset sigaction strerror strlcat strlcpy strcasecmp strncasecmp telldir tempnam times usleep vsprintf vsnprintf waitpid _wfopen _wstat]) +AC_CHECK_FUNCS([_exit atexit clock directio execvp floor fork ftime ftruncate getcwd getpid getexecname getdtablesize getpagesize getrlimit getrusage gettimeofday gmtime_r localtime_r lstat memmove memset mkstemp munmap _NSGetExecutablePath pclose _pclose poll popen _popen posix_fadvise posix_fallocate posix_madvise posix_memalign pow pread pwrite raise rand_r readlink readdir_r realpath select seekdir setlocale sqrt setvbuf stat strchr strerror_r strrchr strcspn strdup strpbrk strspn strstr strtol strtoul symlink sysconf sigemptyset sigaction strerror strlcat strlcpy strcasecmp strncasecmp telldir tempnam times usleep vsprintf vsnprintf waitpid _wfopen _wstat]) # # Check for clock_gettime(). diff --git a/magick/animate.c b/magick/animate.c index 1b12255b7..becb5d3e9 100644 --- a/magick/animate.c +++ b/magick/animate.c @@ -2950,7 +2950,7 @@ static MagickBooleanType XSaveImage(Display *display, quality); if (*quality == '\0') return(MagickTrue); - image->quality=(unsigned long) StringToLong(quality); + image->quality=StringToUnsignedLong(quality); image_info->interlace=status != MagickFalse ? NoInterlace : PlaneInterlace; } diff --git a/magick/display.c b/magick/display.c index 5e1239e45..9a48019bb 100644 --- a/magick/display.c +++ b/magick/display.c @@ -5712,14 +5712,14 @@ static MagickBooleanType XDrawEditImage(Display *display, break; if (entry != 5) { - line_width=(unsigned int) StringToLong(WidthsMenu[entry]); + line_width=(unsigned int) StringToUnsignedLong(WidthsMenu[entry]); break; } (void) XDialogWidget(display,windows,"Ok","Enter line width:", width); if (*width == '\0') break; - line_width=(unsigned int) StringToLong(width); + line_width=(unsigned int) StringToUnsignedLong(width); break; } case DrawUndoCommand: @@ -7935,7 +7935,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info, */ XSetCursorState(display,windows,MagickTrue); XCheckRefreshWindows(display,windows); - quantize_info.number_colors=(unsigned long) StringToLong(colors); + quantize_info.number_colors=StringToUnsignedLong(colors); quantize_info.dither=status != 0 ? MagickTrue : MagickFalse; (void) QuantizeImage(&quantize_info,*image); XSetCursorState(display,windows,MagickFalse); @@ -9077,7 +9077,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info, "Pause how many 1/100ths of a second between images:",delay); if (*delay == '\0') break; - resource_info->delay=(unsigned long) StringToLong(delay); + resource_info->delay=StringToUnsignedLong(delay); XClientMessage(display,windows->image.id,windows->im_protocols, windows->im_next_image,CurrentTime); break; @@ -12397,7 +12397,7 @@ static MagickBooleanType XSaveImage(Display *display, quality); if (*quality == '\0') return(MagickTrue); - image->quality=(unsigned long) StringToLong(quality); + image->quality=StringToUnsignedLong(quality); image_info->interlace=status != 0 ? NoInterlace : PlaneInterlace; } if ((LocaleCompare(image_info->magick,"EPS") == 0) || diff --git a/magick/draw.c b/magick/draw.c index fb92e9780..e86f166a4 100644 --- a/magick/draw.c +++ b/magick/draw.c @@ -2091,7 +2091,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info) if (LocaleCompare("font-weight",keyword) == 0) { GetMagickToken(q,&q,token); - graphic_context[n]->weight=(unsigned long) StringToLong(token); + graphic_context[n]->weight=StringToUnsignedLong(token); if (LocaleCompare(token,"all") == 0) graphic_context[n]->weight=0; if (LocaleCompare(token,"bold") == 0) @@ -2633,7 +2633,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info) if (LocaleCompare("stroke-miterlimit",keyword) == 0) { GetMagickToken(q,&q,token); - graphic_context[n]->miterlimit=(unsigned long) StringToLong(token); + graphic_context[n]->miterlimit=StringToUnsignedLong(token); break; } if (LocaleCompare("stroke-opacity",keyword) == 0) diff --git a/magick/image.c b/magick/image.c index 015863624..1ec481036 100644 --- a/magick/image.c +++ b/magick/image.c @@ -3096,7 +3096,7 @@ MagickExport MagickBooleanType SetImageInfo(ImageInfo *image_info, last; (void) CloneString(&image_info->scenes,subimage); - image_info->scene=(unsigned long) StringToLong(image_info->scenes); + image_info->scene=StringToUnsignedLong(image_info->scenes); image_info->number_scenes=image_info->scene; p=image_info->scenes; for (q=(char *) image_info->scenes; *q != '\0'; p++) @@ -3976,7 +3976,7 @@ MagickExport MagickBooleanType SyncImageSettings(const ImageInfo *image_info, (void) QueryColorDatabase(option,&image->border_color,&image->exception); option=GetImageOption(image_info,"colors"); if (option != (const char *) NULL) - image->colors=(unsigned long) StringToLong(option); + image->colors=StringToUnsignedLong(option); option=GetImageOption(image_info,"compose"); if (option != (const char *) NULL) image->compose=(CompositeOperator) ParseMagickOption(MagickComposeOptions, @@ -4029,7 +4029,7 @@ MagickExport MagickBooleanType SyncImageSettings(const ImageInfo *image_info, } option=GetImageOption(image_info,"depth"); if (option != (const char *) NULL) - image->depth=(unsigned long) StringToLong(option); + image->depth=StringToUnsignedLong(option); option=GetImageOption(image_info,"dispose"); if (option != (const char *) NULL) image->dispose=(DisposeType) ParseMagickOption(MagickDisposeOptions, @@ -4074,7 +4074,7 @@ MagickExport MagickBooleanType SyncImageSettings(const ImageInfo *image_info, MagickInterpolateOptions,MagickFalse,option); option=GetImageOption(image_info,"loop"); if (option != (const char *) NULL) - image->iterations=(unsigned long) StringToLong(option); + image->iterations=StringToUnsignedLong(option); option=GetImageOption(image_info,"mattecolor"); if (option != (const char *) NULL) (void) QueryColorDatabase(option,&image->matte_color,&image->exception); @@ -4084,7 +4084,7 @@ MagickExport MagickBooleanType SyncImageSettings(const ImageInfo *image_info, MagickOrientationOptions,MagickFalse,option); option=GetImageOption(image_info,"quality"); if (option != (const char *) NULL) - image->quality=(unsigned long) StringToLong(option); + image->quality=StringToUnsignedLong(option); option=GetImageOption(image_info,"page"); if (option != (const char *) NULL) { @@ -4108,7 +4108,7 @@ MagickExport MagickBooleanType SyncImageSettings(const ImageInfo *image_info, image->quality=image_info->quality; option=GetImageOption(image_info,"scene"); if (option != (const char *) NULL) - image->scene=(unsigned long) StringToLong(option); + image->scene=StringToUnsignedLong(option); option=GetImageOption(image_info,"taint"); if (option != (const char *) NULL) image->taint=(MagickBooleanType) ParseMagickOption(MagickBooleanOptions, diff --git a/magick/log.c b/magick/log.c index 347bb87e9..2555551b4 100644 --- a/magick/log.c +++ b/magick/log.c @@ -1448,7 +1448,7 @@ static MagickBooleanType LoadLogList(const char *xml,const char *filename, log_info->generations=(~0UL); break; } - log_info->generations=(unsigned long) StringToLong(token); + log_info->generations=StringToUnsignedLong(token); break; } break; @@ -1463,7 +1463,7 @@ static MagickBooleanType LoadLogList(const char *xml,const char *filename, log_info->limit=(~0UL); break; } - log_info->limit=(unsigned long) StringToLong(token); + log_info->limit=StringToUnsignedLong(token); break; } break; diff --git a/magick/property.c b/magick/property.c index 3929e9cb0..3fa802b55 100644 --- a/magick/property.c +++ b/magick/property.c @@ -3343,7 +3343,7 @@ MagickExport MagickBooleanType SetImageProperty(Image *image, } if (LocaleCompare(property,"depth") == 0) { - image->depth=(unsigned long) StringToLong(value); + image->depth=StringToUnsignedLong(value); break; } if (LocaleCompare(property,"dispose") == 0) @@ -3415,7 +3415,7 @@ MagickExport MagickBooleanType SetImageProperty(Image *image, { if (LocaleCompare(property,"loop") == 0) { - image->iterations=(unsigned long) StringToLong(value); + image->iterations=StringToUnsignedLong(value); break; } status=AddValueToSplayTree((SplayTreeInfo *) image->properties, diff --git a/magick/resource.c b/magick/resource.c index ca4f73155..42ed462ca 100644 --- a/magick/resource.c +++ b/magick/resource.c @@ -993,7 +993,7 @@ MagickExport MagickBooleanType ResourceComponentGenesis(void) limit=GetPolicyValue("thread"); if (limit != (char *) NULL) { - SetOpenMPMaximumThreads((unsigned long) StringToLong(limit)); + SetOpenMPMaximumThreads(StringToUnsignedLong(limit)); (void) SetMagickResourceLimit(ThreadResource,StringToSizeType(limit, 100.0)); limit=DestroyString(limit); diff --git a/magick/string-private.h b/magick/string-private.h index c7a3f022c..07ce8ad4d 100644 --- a/magick/string-private.h +++ b/magick/string-private.h @@ -1,12 +1,12 @@ /* Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization dedicated to making software imaging solutions freely available. - + You may not use this file except in compliance with the License. obtain a copy of the License at - + http://www.imagemagick.org/script/license.php - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -61,6 +61,11 @@ static inline long StringToLong(const char *value) return(strtol(value,(char **) NULL,10)); } +static inline unsigned long StringToUnsignedLong(const char *value) +{ + return(strtoul(value,(char **) NULL,10)); +} + #if defined(__cplusplus) || defined(c_plusplus) } #endif diff --git a/magick/threshold.c b/magick/threshold.c index 98d89be2e..cae65f190 100644 --- a/magick/threshold.c +++ b/magick/threshold.c @@ -948,7 +948,7 @@ MagickExport ThresholdMap *GetThresholdMapFile(const char *xml, map = DestroyThresholdMap(map); return(map); } - map->width = (unsigned long) StringToLong(attr); + map->width = StringToUnsignedLong(attr); if ( map->width == 0 ) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "XmlInvalidAttribute", ", map \"%s\"", map_id); @@ -965,7 +965,7 @@ MagickExport ThresholdMap *GetThresholdMapFile(const char *xml, map = DestroyThresholdMap(map); return(map); } - map->height = (unsigned long) StringToLong(attr); + map->height = StringToUnsignedLong(attr); if ( map->height == 0 ) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "XmlInvalidAttribute", ", map \"%s\"", map_id); diff --git a/magick/type.c b/magick/type.c index 8940a5f1f..6786f755f 100644 --- a/magick/type.c +++ b/magick/type.c @@ -1103,7 +1103,7 @@ static MagickBooleanType LoadTypeList(const char *xml,const char *filename, { if (LocaleCompare((char *) keyword,"face") == 0) { - type_info->face=(unsigned long) StringToLong(token); + type_info->face=StringToUnsignedLong(token); break; } if (LocaleCompare((char *) keyword,"family") == 0) @@ -1225,7 +1225,7 @@ static MagickBooleanType LoadTypeList(const char *xml,const char *filename, { if (LocaleCompare((char *) keyword,"weight") == 0) { - type_info->weight=(unsigned long) StringToLong(token); + type_info->weight=StringToUnsignedLong(token); if (LocaleCompare(token,"bold") == 0) type_info->weight=700; if (LocaleCompare(token,"normal") == 0) diff --git a/magick/xwindow.c b/magick/xwindow.c index 9d56d79bc..c795d7250 100644 --- a/magick/xwindow.c +++ b/magick/xwindow.c @@ -3465,7 +3465,7 @@ MagickExport void XGetResourceInfo(const ImageInfo *image_info, "borderColor",BorderColor); resource_value=XGetResourceClass(database,client_name,"borderWidth", (char *) "2"); - resource_info->border_width=(unsigned int) StringToLong(resource_value); + resource_info->border_width=(unsigned int) StringToUnsignedLong(resource_value); resource_value=XGetResourceClass(database,client_name,"colormap", (char *) "shared"); resource_info->colormap=UndefinedColormap; @@ -3486,7 +3486,7 @@ MagickExport void XGetResourceInfo(const ImageInfo *image_info, (char *) "False"); resource_info->confirm_edit=IsMagickTrue(resource_value); resource_value=XGetResourceClass(database,client_name,"delay",(char *) "1"); - resource_info->delay=(unsigned int) StringToLong(resource_value); + resource_info->delay=(unsigned int) StringToUnsignedLong(resource_value); resource_info->display_gamma=XGetResourceClass(database,client_name, "displayGamma",(char *) "2.2"); resource_value=XGetResourceClass(database,client_name,"displayWarnings", @@ -3541,7 +3541,7 @@ MagickExport void XGetResourceInfo(const ImageInfo *image_info, resource_info->immutable=IsMagickTrue(resource_value); resource_value=XGetResourceClass(database,client_name,"magnify", (char *) "3"); - resource_info->magnify=(unsigned int) StringToLong(resource_value); + resource_info->magnify=(unsigned int) StringToUnsignedLong(resource_value); resource_info->map_type=XGetResourceClass(database,client_name,"map", (char *) NULL); resource_info->matte_color=XGetResourceInstance(database,client_name, @@ -3571,7 +3571,7 @@ MagickExport void XGetResourceInfo(const ImageInfo *image_info, resource_info->pen_colors[10]=XGetResourceClass(database,client_name,"pen0", (char *) "gray"); resource_value=XGetResourceClass(database,client_name,"pause",(char *) "0"); - resource_info->pause=(unsigned int) StringToLong(resource_value); + resource_info->pause=(unsigned int) StringToUnsignedLong(resource_value); resource_value=XGetResourceClass(database,client_name,"quantum",(char *) "1"); resource_info->quantum=StringToLong(resource_value); resource_info->text_font=XGetResourceClass(database,client_name,(char *) @@ -3582,7 +3582,7 @@ MagickExport void XGetResourceInfo(const ImageInfo *image_info, (char *) NULL); resource_value=XGetResourceClass(database,client_name,"undoCache", (char *) "16"); - resource_info->undo_cache=(unsigned int) StringToLong(resource_value); + resource_info->undo_cache=(unsigned int) StringToUnsignedLong(resource_value); resource_value=XGetResourceClass(database,client_name,"update", (char *) "False"); resource_info->update=IsMagickTrue(resource_value); diff --git a/tests/validate.c b/tests/validate.c index 985f48cae..c165506e1 100644 --- a/tests/validate.c +++ b/tests/validate.c @@ -1293,7 +1293,7 @@ int main(int argc,char **argv) { if (LocaleCompare("bench",option+1) == 0) { - iterations=(unsigned long) StringToLong(argv[++i]); + iterations=StringToUnsignedLong(argv[++i]); break; } ThrowValidateException(OptionError,"UnrecognizedOption",option) diff --git a/wand/animate.c b/wand/animate.c index 24b284d28..d42bca614 100644 --- a/wand/animate.c +++ b/wand/animate.c @@ -524,7 +524,8 @@ WandExport MagickBooleanType AnimateImageCommand(ImageInfo *image_info, i++; if ((i == (long) argc) || (IsGeometry(argv[i]) == MagickFalse)) ThrowAnimateException(OptionError,"MissingArgument",option); - resource_info.border_width=(unsigned int) StringToLong(argv[i]); + resource_info.border_width=(unsigned int) + StringToUnsignedLong(argv[i]); break; } ThrowAnimateException(OptionError,"UnrecognizedOption",option); @@ -615,7 +616,7 @@ WandExport MagickBooleanType AnimateImageCommand(ImageInfo *image_info, ThrowAnimateException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowAnimateInvalidArgumentException(option,argv[i]); - quantize_info->number_colors=(unsigned long) StringToLong(argv[i]); + quantize_info->number_colors=StringToUnsignedLong(argv[i]); break; } if (LocaleCompare("colorspace",option+1) == 0) @@ -1113,7 +1114,7 @@ WandExport MagickBooleanType AnimateImageCommand(ImageInfo *image_info, ThrowAnimateException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowAnimateInvalidArgumentException(option,argv[i]); - resource_info.pause=(unsigned int) StringToLong(argv[i]); + resource_info.pause=(unsigned int) StringToUnsignedLong(argv[i]); break; } if (LocaleCompare("page",option+1) == 0) @@ -1348,7 +1349,7 @@ WandExport MagickBooleanType AnimateImageCommand(ImageInfo *image_info, ThrowAnimateException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowAnimateInvalidArgumentException(option,argv[i]); - quantize_info->tree_depth=(unsigned long) StringToLong(argv[i]); + quantize_info->tree_depth=StringToUnsignedLong(argv[i]); break; } if (LocaleCompare("trim",option+1) == 0) diff --git a/wand/display.c b/wand/display.c index eb90d2fb3..2b7008fa9 100644 --- a/wand/display.c +++ b/wand/display.c @@ -438,7 +438,7 @@ WandExport MagickBooleanType DisplayImageCommand(ImageInfo *image_info, "pageGeometry",(char *) NULL); resource_value=XGetResourceInstance(resource_database,GetClientName(), "quality","75"); - image_info->quality=(unsigned long) StringToLong(resource_value); + image_info->quality=StringToUnsignedLong(resource_value); resource_value=XGetResourceInstance(resource_database,GetClientName(), "verbose","False"); image_info->verbose=IsMagickTrue(resource_value); @@ -743,7 +743,7 @@ WandExport MagickBooleanType DisplayImageCommand(ImageInfo *image_info, ThrowDisplayException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowDisplayInvalidArgumentException(option,argv[i]); - resource_info.border_width=(unsigned int) StringToLong(argv[i]); + resource_info.border_width=(unsigned int) StringToUnsignedLong(argv[i]); break; } ThrowDisplayException(OptionError,"UnrecognizedOption",option); @@ -816,7 +816,7 @@ WandExport MagickBooleanType DisplayImageCommand(ImageInfo *image_info, ThrowDisplayException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowDisplayInvalidArgumentException(option,argv[i]); - quantize_info->number_colors=(unsigned long) StringToLong(argv[i]); + quantize_info->number_colors=StringToUnsignedLong(argv[i]); break; } if (LocaleCompare("colorspace",option+1) == 0) @@ -1343,7 +1343,7 @@ WandExport MagickBooleanType DisplayImageCommand(ImageInfo *image_info, ThrowDisplayException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowDisplayInvalidArgumentException(option,argv[i]); - iterations=(unsigned long) StringToLong(argv[i]); + iterations=StringToUnsignedLong(argv[i]); break; } ThrowDisplayException(OptionError,"UnrecognizedOption",option); @@ -1360,7 +1360,7 @@ WandExport MagickBooleanType DisplayImageCommand(ImageInfo *image_info, ThrowDisplayException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowDisplayInvalidArgumentException(option,argv[i]); - resource_info.magnify=(unsigned int) StringToLong(argv[i]); + resource_info.magnify=(unsigned int) StringToUnsignedLong(argv[i]); break; } if (LocaleCompare("map",option+1) == 0) @@ -1740,7 +1740,7 @@ WandExport MagickBooleanType DisplayImageCommand(ImageInfo *image_info, ThrowDisplayException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowDisplayInvalidArgumentException(option,argv[i]); - quantize_info->tree_depth=(unsigned long) StringToLong(argv[i]); + quantize_info->tree_depth=StringToUnsignedLong(argv[i]); break; } if (LocaleCompare("trim",option+1) == 0) @@ -1759,7 +1759,7 @@ WandExport MagickBooleanType DisplayImageCommand(ImageInfo *image_info, ThrowDisplayException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowDisplayInvalidArgumentException(option,argv[i]); - resource_info.update=(unsigned int) StringToLong(argv[i]); + resource_info.update=(unsigned int) StringToUnsignedLong(argv[i]); break; } if (LocaleCompare("use-pixmap",option+1) == 0) diff --git a/wand/drawing-wand.c b/wand/drawing-wand.c index e827432d1..d025f4590 100644 --- a/wand/drawing-wand.c +++ b/wand/drawing-wand.c @@ -6173,7 +6173,7 @@ WandExport MagickBooleanType DrawSetVectorGraphics(DrawingWand *wand, { value=GetXMLTreeContent(child); if (value != (const char *) NULL) - CurrentContext->weight=(unsigned long) StringToLong(value); + CurrentContext->weight=StringToUnsignedLong(value); } child=GetXMLTreeChild(xml_info,"gravity"); if (child != (XMLTreeInfo *) NULL) @@ -6284,7 +6284,7 @@ WandExport MagickBooleanType DrawSetVectorGraphics(DrawingWand *wand, { value=GetXMLTreeContent(child); if (value != (const char *) NULL) - CurrentContext->miterlimit=(unsigned long) StringToLong(value); + CurrentContext->miterlimit=StringToUnsignedLong(value); } child=GetXMLTreeChild(xml_info,"stroke-opacity"); if (child != (XMLTreeInfo *) NULL) diff --git a/wand/import.c b/wand/import.c index bbf223fa3..c4434e118 100644 --- a/wand/import.c +++ b/wand/import.c @@ -371,7 +371,7 @@ WandExport MagickBooleanType ImportImageCommand(ImageInfo *image_info, ximage_info.borders=IsMagickTrue(resource_value); resource_value=XGetResourceInstance(resource_database,GetClientName(), "delay","0"); - resource_info.delay=(unsigned int) StringToLong(resource_value); + resource_info.delay=(unsigned int) StringToUnsignedLong(resource_value); image_info->density=XGetResourceInstance(resource_database,GetClientName(), "density",(char *) NULL); resource_value=XGetResourceInstance(resource_database,GetClientName(), @@ -398,10 +398,10 @@ WandExport MagickBooleanType ImportImageCommand(ImageInfo *image_info, "pageGeometry",(char *) NULL); resource_value=XGetResourceInstance(resource_database,GetClientName(), "pause","0"); - resource_info.pause=(unsigned int) StringToLong(resource_value); + resource_info.pause=(unsigned int) StringToUnsignedLong(resource_value); resource_value=XGetResourceInstance(resource_database,GetClientName(), "quality","85"); - image_info->quality=(unsigned long) StringToLong(resource_value); + image_info->quality=StringToUnsignedLong(resource_value); resource_value=XGetResourceInstance(resource_database,GetClientName(), "screen","False"); ximage_info.screen=IsMagickTrue(resource_value); @@ -552,7 +552,7 @@ WandExport MagickBooleanType ImportImageCommand(ImageInfo *image_info, ThrowImportException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowImportInvalidArgumentException(option,argv[i]); - quantize_info->number_colors=(unsigned long) StringToLong(argv[i]); + quantize_info->number_colors=StringToUnsignedLong(argv[i]); break; } if (LocaleCompare("colorspace",option+1) == 0) @@ -1016,7 +1016,7 @@ WandExport MagickBooleanType ImportImageCommand(ImageInfo *image_info, ThrowImportException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowImportInvalidArgumentException(option,argv[i]); - resource_info.pause=(unsigned int) StringToLong(argv[i]); + resource_info.pause=(unsigned int) StringToUnsignedLong(argv[i]); break; } if (LocaleCompare("ping",option+1) == 0) @@ -1226,7 +1226,7 @@ WandExport MagickBooleanType ImportImageCommand(ImageInfo *image_info, ThrowImportException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowImportInvalidArgumentException(option,argv[i]); - quantize_info->tree_depth=(unsigned long) StringToLong(argv[i]); + quantize_info->tree_depth=StringToUnsignedLong(argv[i]); break; } if (LocaleCompare("trim",option+1) == 0) diff --git a/wand/mogrify.c b/wand/mogrify.c index 2b4420c80..02c997893 100644 --- a/wand/mogrify.c +++ b/wand/mogrify.c @@ -136,7 +136,7 @@ WandExport MagickBooleanType MagickCommandGenesis(ImageInfo *image_info, if ((strlen(option) == 1) || ((*option != '-') && (*option != '+'))) continue; if (LocaleCompare("bench",option+1) == 0) - iterations=(unsigned long) StringToLong(argv[++i]); + iterations=StringToUnsignedLong(argv[++i]); if (LocaleCompare("concurrent",option+1) == 0) concurrent=MagickTrue; if (LocaleCompare("debug",option+1) == 0) @@ -1127,7 +1127,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, Reduce the number of colors in the image. */ (void) SyncImageSettings(image_info,*image); - quantize_info->number_colors=(unsigned long) StringToLong(argv[i+1]); + quantize_info->number_colors=StringToUnsignedLong(argv[i+1]); if (quantize_info->number_colors == 0) break; if (((*image)->storage_class == DirectClass) || @@ -1309,7 +1309,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, (void) SetImageDepth(*image,MAGICKCORE_QUANTUM_DEPTH); break; } - (void) SetImageDepth(*image,(unsigned long) StringToLong(argv[i+1])); + (void) SetImageDepth(*image,StringToUnsignedLong(argv[i+1])); break; } if (LocaleCompare("deskew",option+1) == 0) @@ -2359,7 +2359,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, Posterize image. */ (void) SyncImageSettings(image_info,*image); - (void) PosterizeImage(*image,(unsigned long) StringToLong(argv[i+1]), + (void) PosterizeImage(*image,StringToUnsignedLong(argv[i+1]), quantize_info->dither); InheritException(exception,&(*image)->exception); break; @@ -3319,7 +3319,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, } if (LocaleCompare("treedepth",option+1) == 0) { - quantize_info->tree_depth=(unsigned long) StringToLong(argv[i+1]); + quantize_info->tree_depth=StringToUnsignedLong(argv[i+1]); break; } if (LocaleCompare("trim",option+1) == 0) @@ -3479,7 +3479,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, } if (LocaleCompare("weight",option+1) == 0) { - draw_info->weight=(unsigned long) StringToLong(argv[i+1]); + draw_info->weight=StringToUnsignedLong(argv[i+1]); if (LocaleCompare(argv[i+1],"all") == 0) draw_info->weight=0; if (LocaleCompare(argv[i+1],"bold") == 0) @@ -6389,7 +6389,7 @@ WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info, } if (LocaleCompare("colors",option+1) == 0) { - image_info->colors=(unsigned long) StringToLong(argv[i+1]); + image_info->colors=StringToUnsignedLong(argv[i+1]); break; } if (LocaleCompare("colorspace",option+1) == 0) @@ -6516,7 +6516,7 @@ WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info, image_info->depth=MAGICKCORE_QUANTUM_DEPTH; break; } - image_info->depth=(unsigned long) StringToLong(argv[i+1]); + image_info->depth=StringToUnsignedLong(argv[i+1]); break; } if (LocaleCompare("display",option+1) == 0) @@ -7035,7 +7035,7 @@ WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info, (void) SetImageOption(image_info,option+1,"0"); break; } - image_info->quality=(unsigned long) StringToLong(argv[i+1]); + image_info->quality=StringToUnsignedLong(argv[i+1]); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } @@ -7102,7 +7102,7 @@ WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info, (void) SetImageOption(image_info,option+1,"0"); break; } - image_info->scene=(unsigned long) StringToLong(argv[i+1]); + image_info->scene=StringToUnsignedLong(argv[i+1]); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } @@ -7117,7 +7117,7 @@ WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info, SeedPseudoRandomGenerator(seed); break; } - seed=(unsigned long) StringToLong(argv[i+1]); + seed=StringToUnsignedLong(argv[i+1]); SeedPseudoRandomGenerator(seed); break; } @@ -7955,7 +7955,7 @@ WandExport MagickBooleanType MogrifyImageList(ImageInfo *image_info, *morph_image; (void) SyncImagesSettings(image_info,*images); - morph_image=MorphImages(*images,(unsigned long) StringToLong(argv[i+1]), + morph_image=MorphImages(*images,StringToUnsignedLong(argv[i+1]), exception); if (morph_image == (Image *) NULL) { diff --git a/wand/montage.c b/wand/montage.c index fa2c4a72d..e20a03c3e 100644 --- a/wand/montage.c +++ b/wand/montage.c @@ -539,7 +539,7 @@ WandExport MagickBooleanType MontageImageCommand(ImageInfo *image_info, ThrowMontageException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowMontageInvalidArgumentException(option,argv[i]); - montage_info->border_width=(unsigned long) StringToLong(argv[i]); + montage_info->border_width=StringToUnsignedLong(argv[i]); break; } if (LocaleCompare("bordercolor",option+1) == 0) @@ -563,7 +563,7 @@ WandExport MagickBooleanType MontageImageCommand(ImageInfo *image_info, ThrowMontageException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowMontageInvalidArgumentException(option,argv[i]); - montage_info->border_width=(unsigned long) StringToLong(argv[i]); + montage_info->border_width=StringToUnsignedLong(argv[i]); break; } ThrowMontageException(OptionError,"UnrecognizedOption",option) -- 2.40.0