From: cristy Date: Fri, 4 Nov 2011 23:29:40 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~6687 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dbdd0e35efc03c9bccda644f5407db38b7c17eec;p=imagemagick --- diff --git a/MagickCore/colorspace.c b/MagickCore/colorspace.c index 1748073de..84e5cd64e 100644 --- a/MagickCore/colorspace.c +++ b/MagickCore/colorspace.c @@ -619,20 +619,20 @@ MagickExport MagickBooleanType RGBTransformImage(Image *image, gamma=DisplayGamma; value=GetImageProperty(image,"gamma",exception); if (value != (const char *) NULL) - gamma=1.0/fabs(InterpretLocaleValue(value,(char **) NULL)) >= - MagickEpsilon ? InterpretLocaleValue(value,(char **) NULL) : 1.0; + gamma=1.0/fabs(StringToDouble(value,(char **) NULL)) >= + MagickEpsilon ? StringToDouble(value,(char **) NULL) : 1.0; film_gamma=FilmGamma; value=GetImageProperty(image,"film-gamma",exception); if (value != (const char *) NULL) - film_gamma=InterpretLocaleValue(value,(char **) NULL); + film_gamma=StringToDouble(value,(char **) NULL); reference_black=ReferenceBlack; value=GetImageProperty(image,"reference-black",exception); if (value != (const char *) NULL) - reference_black=InterpretLocaleValue(value,(char **) NULL); + reference_black=StringToDouble(value,(char **) NULL); reference_white=ReferenceWhite; value=GetImageProperty(image,"reference-white",exception); if (value != (const char *) NULL) - reference_white=InterpretLocaleValue(value,(char **) NULL); + reference_white=StringToDouble(value,(char **) NULL); logmap=(Quantum *) AcquireQuantumMemory((size_t) MaxMap+1UL, sizeof(*logmap)); if (logmap == (Quantum *) NULL) @@ -2067,20 +2067,20 @@ MagickExport MagickBooleanType TransformRGBImage(Image *image, gamma=DisplayGamma; value=GetImageProperty(image,"gamma",exception); if (value != (const char *) NULL) - gamma=1.0/fabs(InterpretLocaleValue(value,(char **) NULL)) >= - MagickEpsilon ? InterpretLocaleValue(value,(char **) NULL) : 1.0; + gamma=1.0/fabs(StringToDouble(value,(char **) NULL)) >= + MagickEpsilon ? StringToDouble(value,(char **) NULL) : 1.0; film_gamma=FilmGamma; value=GetImageProperty(image,"film-gamma",exception); if (value != (const char *) NULL) - film_gamma=InterpretLocaleValue(value,(char **) NULL); + film_gamma=StringToDouble(value,(char **) NULL); reference_black=ReferenceBlack; value=GetImageProperty(image,"reference-black",exception); if (value != (const char *) NULL) - reference_black=InterpretLocaleValue(value,(char **) NULL); + reference_black=StringToDouble(value,(char **) NULL); reference_white=ReferenceWhite; value=GetImageProperty(image,"reference-white",exception); if (value != (const char *) NULL) - reference_white=InterpretLocaleValue(value,(char **) NULL); + reference_white=StringToDouble(value,(char **) NULL); logmap=(Quantum *) AcquireQuantumMemory((size_t) MaxMap+1UL, sizeof(*logmap)); if (logmap == (Quantum *) NULL) diff --git a/MagickCore/display.c b/MagickCore/display.c index ecd5ee7f7..408251c57 100644 --- a/MagickCore/display.c +++ b/MagickCore/display.c @@ -2127,14 +2127,14 @@ static MagickBooleanType XAnnotateEditImage(Display *display, break; if (entry != 8) { - degrees=InterpretLocaleValue(RotateMenu[entry],(char **) NULL); + degrees=StringToDouble(RotateMenu[entry],(char **) NULL); break; } (void) XDialogWidget(display,windows,"OK","Enter rotation angle:", angle); if (*angle == '\0') break; - degrees=InterpretLocaleValue(angle,(char **) NULL); + degrees=StringToDouble(angle,(char **) NULL); break; } case AnnotateHelpCommand: @@ -3543,7 +3543,7 @@ static MagickBooleanType XColorEditImage(Display *display, break; if (entry != 5) { - (*image)->fuzz=InterpretLocaleInterval(FuzzMenu[entry],(double) + (*image)->fuzz=StringToDoubleInterval(FuzzMenu[entry],(double) QuantumRange+1.0); break; } @@ -3553,7 +3553,7 @@ static MagickBooleanType XColorEditImage(Display *display, if (*fuzz == '\0') break; (void) ConcatenateMagickString(fuzz,"%",MaxTextExtent); - (*image)->fuzz=InterpretLocaleInterval(fuzz,(double) QuantumRange+1.0); + (*image)->fuzz=StringToDoubleInterval(fuzz,(double) QuantumRange+1.0); break; } case ColorEditUndoCommand: @@ -4091,7 +4091,7 @@ static MagickBooleanType XCompositeImage(Display *display, GXinvert); if (*factor == '\0') break; - blend=InterpretLocaleValue(factor,(char **) NULL); + blend=StringToDouble(factor,(char **) NULL); compose=DissolveCompositeOp; break; } @@ -7728,7 +7728,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info, (void) XDialogWidget(display,windows,"Trim","Enter fuzz factor:",fuzz); if (*fuzz == '\0') break; - (*image)->fuzz=InterpretLocaleInterval(fuzz,(double) QuantumRange+1.0); + (*image)->fuzz=StringToDoubleInterval(fuzz,(double) QuantumRange+1.0); /* Trim image. */ @@ -8310,7 +8310,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info, */ XSetCursorState(display,windows,MagickTrue); XCheckRefreshWindows(display,windows); - threshold=InterpretLocaleInterval(factor,QuantumRange); + threshold=StringToDoubleInterval(factor,QuantumRange); (void) BilevelImage(*image,threshold,exception); XSetCursorState(display,windows,MagickFalse); if (windows->image.orphan != MagickFalse) @@ -8512,7 +8512,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info, */ XSetCursorState(display,windows,MagickTrue); XCheckRefreshWindows(display,windows); - threshold=InterpretLocaleInterval(factor,QuantumRange); + threshold=StringToDoubleInterval(factor,QuantumRange); sepia_image=SepiaToneImage(*image,threshold,exception); if (sepia_image != (Image *) NULL) { @@ -8547,7 +8547,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info, */ XSetCursorState(display,windows,MagickTrue); XCheckRefreshWindows(display,windows); - threshold=InterpretLocaleInterval(factor,QuantumRange); + threshold=StringToDoubleInterval(factor,QuantumRange); (void) SolarizeImage(*image,threshold,exception); XSetCursorState(display,windows,MagickFalse); if (windows->image.orphan != MagickFalse) @@ -9864,7 +9864,7 @@ static MagickBooleanType XMatteEditImage(Display *display, break; if (entry != 5) { - (*image)->fuzz=InterpretLocaleInterval(FuzzMenu[entry],(double) + (*image)->fuzz=StringToDoubleInterval(FuzzMenu[entry],(double) QuantumRange+1.0); break; } @@ -9874,7 +9874,7 @@ static MagickBooleanType XMatteEditImage(Display *display, if (*fuzz == '\0') break; (void) ConcatenateMagickString(fuzz,"%",MaxTextExtent); - (*image)->fuzz=InterpretLocaleInterval(fuzz,(double) QuantumRange+1.0); + (*image)->fuzz=StringToDoubleInterval(fuzz,(double) QuantumRange+1.0); break; } case MatteEditValueCommand: @@ -10178,7 +10178,7 @@ static MagickBooleanType XMatteEditImage(Display *display, } draw_info=CloneDrawInfo(resource_info->image_info, (DrawInfo *) NULL); - draw_info->fill.alpha=ClampToQuantum(InterpretLocaleValue(matte, + draw_info->fill.alpha=ClampToQuantum(StringToDouble(matte, (char **) NULL)); channel_mask=SetPixelChannelMask(*image,AlphaChannel); (void) FloodfillPaintImage(*image,draw_info,&target,(ssize_t) diff --git a/MagickCore/distort.c b/MagickCore/distort.c index daade12ff..2c24a8beb 100644 --- a/MagickCore/distort.c +++ b/MagickCore/distort.c @@ -2189,7 +2189,7 @@ MagickExport Image *DistortImage(const Image *image,DistortImageMethod method, artifact=GetImageArtifact(image,"distort:scale"); output_scaling = 1.0; if (artifact != (const char *) NULL) { - output_scaling = fabs(InterpretLocaleValue(artifact,(char **) NULL)); + output_scaling = fabs(StringToDouble(artifact,(char **) NULL)); geometry.width *= (size_t) output_scaling; geometry.height *= (size_t) output_scaling; geometry.x *= (ssize_t) output_scaling; diff --git a/MagickCore/draw.c b/MagickCore/draw.c index f3f141f6f..7ba5d516b 100644 --- a/MagickCore/draw.c +++ b/MagickCore/draw.c @@ -1652,7 +1652,7 @@ static inline MagickBooleanType IsPoint(const char *point) double value; - value=InterpretLocaleValue(point,&p); + value=StringToDouble(point,&p); return((value == 0.0) && (p == point) ? MagickFalse : MagickTrue); } @@ -1819,27 +1819,27 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, if (LocaleCompare("affine",keyword) == 0) { GetMagickToken(q,&q,token); - affine.sx=InterpretLocaleValue(token,(char **) NULL); + affine.sx=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - affine.rx=InterpretLocaleValue(token,(char **) NULL); + affine.rx=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - affine.ry=InterpretLocaleValue(token,(char **) NULL); + affine.ry=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - affine.sy=InterpretLocaleValue(token,(char **) NULL); + affine.sy=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - affine.tx=InterpretLocaleValue(token,(char **) NULL); + affine.tx=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - affine.ty=InterpretLocaleValue(token,(char **) NULL); + affine.ty=StringToDouble(token,(char **) NULL); break; } if (LocaleCompare("arc",keyword) == 0) @@ -2006,7 +2006,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, GetMagickToken(q,&q,token); factor=strchr(token,'%') != (char *) NULL ? 0.01 : 1.0; graphic_context[n]->fill.alpha=(MagickRealType) QuantumRange* - factor*InterpretLocaleValue(token,(char **) NULL); + factor*StringToDouble(token,(char **) NULL); break; } if (LocaleCompare("fill-rule",keyword) == 0) @@ -2041,7 +2041,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, if (LocaleCompare("font-size",keyword) == 0) { GetMagickToken(q,&q,token); - graphic_context[n]->pointsize=InterpretLocaleValue(token, + graphic_context[n]->pointsize=StringToDouble(token, (char **) NULL); break; } @@ -2136,14 +2136,14 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, if (LocaleCompare("interline-spacing",keyword) == 0) { GetMagickToken(q,&q,token); - graphic_context[n]->interline_spacing=InterpretLocaleValue(token, + graphic_context[n]->interline_spacing=StringToDouble(token, (char **) NULL); break; } if (LocaleCompare("interword-spacing",keyword) == 0) { GetMagickToken(q,&q,token); - graphic_context[n]->interword_spacing=InterpretLocaleValue(token, + graphic_context[n]->interword_spacing=StringToDouble(token, (char **) NULL); break; } @@ -2156,7 +2156,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, if (LocaleCompare("kerning",keyword) == 0) { GetMagickToken(q,&q,token); - graphic_context[n]->kerning=InterpretLocaleValue(token, + graphic_context[n]->kerning=StringToDouble(token, (char **) NULL); break; } @@ -2195,7 +2195,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, factor=strchr(token,'%') != (char *) NULL ? 0.01 : 1.0; graphic_context[n]->alpha=ClampToQuantum((MagickRealType) QuantumRange*(1.0-((1.0-QuantumScale*graphic_context[n]->alpha)* - factor*InterpretLocaleValue(token,(char **) NULL)))); + factor*StringToDouble(token,(char **) NULL)))); graphic_context[n]->fill.alpha=(double) graphic_context[n]->alpha; graphic_context[n]->stroke.alpha=(double) graphic_context[n]->alpha; break; @@ -2297,19 +2297,19 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, GetMagickToken(q,&q,token); (void) CopyMagickString(type,token,MaxTextExtent); GetMagickToken(q,&q,token); - segment.x1=InterpretLocaleValue(token,(char **) NULL); + segment.x1=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - segment.y1=InterpretLocaleValue(token,(char **) NULL); + segment.y1=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - segment.x2=InterpretLocaleValue(token,(char **) NULL); + segment.x2=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - segment.y2=InterpretLocaleValue(token,(char **) NULL); + segment.y2=StringToDouble(token,(char **) NULL); if (LocaleCompare(type,"radial") == 0) { GetMagickToken(q,&q,token); @@ -2359,22 +2359,22 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, GetMagickToken(q,&q,token); (void) CopyMagickString(name,token,MaxTextExtent); GetMagickToken(q,&q,token); - bounds.x=(ssize_t) ceil(InterpretLocaleValue(token, + bounds.x=(ssize_t) ceil(StringToDouble(token, (char **) NULL)-0.5); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - bounds.y=(ssize_t) ceil(InterpretLocaleValue(token, + bounds.y=(ssize_t) ceil(StringToDouble(token, (char **) NULL)-0.5); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - bounds.width=(size_t) floor(InterpretLocaleValue(token, + bounds.width=(size_t) floor(StringToDouble(token, (char **) NULL)+0.5); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - bounds.height=(size_t) floor(InterpretLocaleValue(token, + bounds.height=(size_t) floor(StringToDouble(token, (char **) NULL)+0.5); for (p=q; *q != '\0'; ) { @@ -2432,7 +2432,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, if (LocaleCompare("rotate",keyword) == 0) { GetMagickToken(q,&q,token); - angle=InterpretLocaleValue(token,(char **) NULL); + angle=StringToDouble(token,(char **) NULL); affine.sx=cos(DegreesToRadians(fmod((double) angle,360.0))); affine.rx=sin(DegreesToRadians(fmod((double) angle,360.0))); affine.ry=(-sin(DegreesToRadians(fmod((double) angle,360.0)))); @@ -2453,24 +2453,24 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, if (LocaleCompare("scale",keyword) == 0) { GetMagickToken(q,&q,token); - affine.sx=InterpretLocaleValue(token,(char **) NULL); + affine.sx=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - affine.sy=InterpretLocaleValue(token,(char **) NULL); + affine.sy=StringToDouble(token,(char **) NULL); break; } if (LocaleCompare("skewX",keyword) == 0) { GetMagickToken(q,&q,token); - angle=InterpretLocaleValue(token,(char **) NULL); + angle=StringToDouble(token,(char **) NULL); affine.ry=sin(DegreesToRadians(angle)); break; } if (LocaleCompare("skewY",keyword) == 0) { GetMagickToken(q,&q,token); - angle=InterpretLocaleValue(token,(char **) NULL); + angle=StringToDouble(token,(char **) NULL); affine.rx=(-tan(DegreesToRadians(angle)/2.0)); break; } @@ -2557,7 +2557,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - graphic_context[n]->dash_pattern[j]=InterpretLocaleValue( + graphic_context[n]->dash_pattern[j]=StringToDouble( token,(char **) NULL); } if ((x & 0x01) != 0) @@ -2573,7 +2573,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, if (LocaleCompare("stroke-dashoffset",keyword) == 0) { GetMagickToken(q,&q,token); - graphic_context[n]->dash_offset=InterpretLocaleValue(token, + graphic_context[n]->dash_offset=StringToDouble(token, (char **) NULL); break; } @@ -2615,13 +2615,13 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, GetMagickToken(q,&q,token); factor=strchr(token,'%') != (char *) NULL ? 0.01 : 1.0; graphic_context[n]->stroke.alpha=(MagickRealType) QuantumRange* - factor*InterpretLocaleValue(token,(char **) NULL); + factor*StringToDouble(token,(char **) NULL); break; } if (LocaleCompare("stroke-width",keyword) == 0) { GetMagickToken(q,&q,token); - graphic_context[n]->stroke_width=InterpretLocaleValue(token, + graphic_context[n]->stroke_width=StringToDouble(token, (char **) NULL); break; } @@ -2679,11 +2679,11 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, if (LocaleCompare("translate",keyword) == 0) { GetMagickToken(q,&q,token); - affine.tx=InterpretLocaleValue(token,(char **) NULL); + affine.tx=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - affine.ty=InterpretLocaleValue(token,(char **) NULL); + affine.ty=StringToDouble(token,(char **) NULL); break; } status=MagickFalse; @@ -2695,23 +2695,23 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, if (LocaleCompare("viewbox",keyword) == 0) { GetMagickToken(q,&q,token); - graphic_context[n]->viewbox.x=(ssize_t) ceil(InterpretLocaleValue( + graphic_context[n]->viewbox.x=(ssize_t) ceil(StringToDouble( token,(char **) NULL)-0.5); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - graphic_context[n]->viewbox.y=(ssize_t) ceil(InterpretLocaleValue( + graphic_context[n]->viewbox.y=(ssize_t) ceil(StringToDouble( token,(char **) NULL)-0.5); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); graphic_context[n]->viewbox.width=(size_t) floor( - InterpretLocaleValue(token,(char **) NULL)+0.5); + StringToDouble(token,(char **) NULL)+0.5); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); graphic_context[n]->viewbox.height=(size_t) floor( - InterpretLocaleValue(token,(char **) NULL)+0.5); + StringToDouble(token,(char **) NULL)+0.5); break; } status=MagickFalse; @@ -2759,11 +2759,11 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, if (IsPoint(q) == MagickFalse) break; GetMagickToken(q,&q,token); - point.x=InterpretLocaleValue(token,(char **) NULL); + point.x=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - point.y=InterpretLocaleValue(token,(char **) NULL); + point.y=StringToDouble(token,(char **) NULL); GetMagickToken(q,(const char **) NULL,token); if (*token == ',') GetMagickToken(q,&q,token); @@ -2845,7 +2845,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, double value; - value=InterpretLocaleValue(s,&t); + value=StringToDouble(s,&t); (void) value; if (s == t) { @@ -4783,14 +4783,14 @@ MagickExport void GetDrawInfo(const ImageInfo *image_info,DrawInfo *draw_info) (void) CloneString(&draw_info->encoding,option); option=GetImageOption(image_info,"kerning"); if (option != (const char *) NULL) - draw_info->kerning=InterpretLocaleValue(option,(char **) NULL); + draw_info->kerning=StringToDouble(option,(char **) NULL); option=GetImageOption(image_info,"interline-spacing"); if (option != (const char *) NULL) - draw_info->interline_spacing=InterpretLocaleValue(option, + draw_info->interline_spacing=StringToDouble(option, (char **) NULL); option=GetImageOption(image_info,"interword-spacing"); if (option != (const char *) NULL) - draw_info->interword_spacing=InterpretLocaleValue(option, + draw_info->interword_spacing=StringToDouble(option, (char **) NULL); option=GetImageOption(image_info,"direction"); if (option != (const char *) NULL) @@ -4808,7 +4808,7 @@ MagickExport void GetDrawInfo(const ImageInfo *image_info,DrawInfo *draw_info) exception); option=GetImageOption(image_info,"strokewidth"); if (option != (const char *) NULL) - draw_info->stroke_width=InterpretLocaleValue(option,(char **) NULL); + draw_info->stroke_width=StringToDouble(option,(char **) NULL); option=GetImageOption(image_info,"undercolor"); if (option != (const char *) NULL) (void) QueryColorCompliance(option,AllCompliance,&draw_info->undercolor, @@ -5286,15 +5286,15 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path) GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - arc.x=InterpretLocaleValue(token,(char **) NULL); + arc.x=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - arc.y=InterpretLocaleValue(token,(char **) NULL); + arc.y=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - angle=InterpretLocaleValue(token,(char **) NULL); + angle=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); @@ -5306,11 +5306,11 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path) GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - x=InterpretLocaleValue(token,(char **) NULL); + x=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - y=InterpretLocaleValue(token,(char **) NULL); + y=StringToDouble(token,(char **) NULL); end.x=(double) (attribute == (int) 'A' ? x : point.x+x); end.y=(double) (attribute == (int) 'A' ? y : point.y+y); TraceArcPath(q,point,end,arc,angle,large_arc,sweep); @@ -5333,11 +5333,11 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path) GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - x=InterpretLocaleValue(token,(char **) NULL); + x=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - y=InterpretLocaleValue(token,(char **) NULL); + y=StringToDouble(token,(char **) NULL); end.x=(double) (attribute == (int) 'C' ? x : point.x+x); end.y=(double) (attribute == (int) 'C' ? y : point.y+y); points[i]=end; @@ -5358,7 +5358,7 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path) GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - x=InterpretLocaleValue(token,(char **) NULL); + x=StringToDouble(token,(char **) NULL); point.x=(double) (attribute == (int) 'H' ? x: point.x+x); TracePoint(q,point); q+=q->coordinates; @@ -5373,11 +5373,11 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path) GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - x=InterpretLocaleValue(token,(char **) NULL); + x=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - y=InterpretLocaleValue(token,(char **) NULL); + y=StringToDouble(token,(char **) NULL); point.x=(double) (attribute == (int) 'L' ? x : point.x+x); point.y=(double) (attribute == (int) 'L' ? y : point.y+y); TracePoint(q,point); @@ -5400,11 +5400,11 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path) GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - x=InterpretLocaleValue(token,(char **) NULL); + x=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - y=InterpretLocaleValue(token,(char **) NULL); + y=StringToDouble(token,(char **) NULL); point.x=(double) (attribute == (int) 'M' ? x : point.x+x); point.y=(double) (attribute == (int) 'M' ? y : point.y+y); if (i == 0) @@ -5434,11 +5434,11 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path) GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - x=InterpretLocaleValue(token,(char **) NULL); + x=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - y=InterpretLocaleValue(token,(char **) NULL); + y=StringToDouble(token,(char **) NULL); if (*p == ',') p++; end.x=(double) (attribute == (int) 'Q' ? x : point.x+x); @@ -5469,11 +5469,11 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path) GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - x=InterpretLocaleValue(token,(char **) NULL); + x=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - y=InterpretLocaleValue(token,(char **) NULL); + y=StringToDouble(token,(char **) NULL); if (*p == ',') p++; end.x=(double) (attribute == (int) 'S' ? x : point.x+x); @@ -5509,11 +5509,11 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path) GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - x=InterpretLocaleValue(token,(char **) NULL); + x=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - y=InterpretLocaleValue(token,(char **) NULL); + y=StringToDouble(token,(char **) NULL); end.x=(double) (attribute == (int) 'T' ? x : point.x+x); end.y=(double) (attribute == (int) 'T' ? y : point.y+y); points[i]=end; @@ -5539,7 +5539,7 @@ static size_t TracePath(PrimitiveInfo *primitive_info,const char *path) GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - y=InterpretLocaleValue(token,(char **) NULL); + y=StringToDouble(token,(char **) NULL); point.y=(double) (attribute == (int) 'V' ? y : point.y+y); TracePoint(q,point); q+=q->coordinates; diff --git a/MagickCore/enhance.c b/MagickCore/enhance.c index 1877b24cf..5514776bb 100644 --- a/MagickCore/enhance.c +++ b/MagickCore/enhance.c @@ -573,19 +573,19 @@ MagickExport MagickBooleanType ColorDecisionListImage(Image *image, { case 0: { - color_correction.red.slope=InterpretLocaleValue(token, + color_correction.red.slope=StringToDouble(token, (char **) NULL); break; } case 1: { - color_correction.green.slope=InterpretLocaleValue(token, + color_correction.green.slope=StringToDouble(token, (char **) NULL); break; } case 2: { - color_correction.blue.slope=InterpretLocaleValue(token, + color_correction.blue.slope=StringToDouble(token, (char **) NULL); break; } @@ -606,19 +606,19 @@ MagickExport MagickBooleanType ColorDecisionListImage(Image *image, { case 0: { - color_correction.red.offset=InterpretLocaleValue(token, + color_correction.red.offset=StringToDouble(token, (char **) NULL); break; } case 1: { - color_correction.green.offset=InterpretLocaleValue(token, + color_correction.green.offset=StringToDouble(token, (char **) NULL); break; } case 2: { - color_correction.blue.offset=InterpretLocaleValue(token, + color_correction.blue.offset=StringToDouble(token, (char **) NULL); break; } @@ -639,19 +639,19 @@ MagickExport MagickBooleanType ColorDecisionListImage(Image *image, { case 0: { - color_correction.red.power=InterpretLocaleValue(token, + color_correction.red.power=StringToDouble(token, (char **) NULL); break; } case 1: { - color_correction.green.power=InterpretLocaleValue(token, + color_correction.green.power=StringToDouble(token, (char **) NULL); break; } case 2: { - color_correction.blue.power=InterpretLocaleValue(token, + color_correction.blue.power=StringToDouble(token, (char **) NULL); break; } @@ -671,7 +671,7 @@ MagickExport MagickBooleanType ColorDecisionListImage(Image *image, content=GetXMLTreeContent(saturation); p=(const char *) content; GetMagickToken(p,&p,token); - color_correction.saturation=InterpretLocaleValue(token, + color_correction.saturation=StringToDouble(token, (char **) NULL); } } diff --git a/MagickCore/fx.c b/MagickCore/fx.c index 981373fad..afd373897 100644 --- a/MagickCore/fx.c +++ b/MagickCore/fx.c @@ -1175,7 +1175,7 @@ static MagickRealType FxChannelStatistics(FxInfo *fx_info,const Image *image, (double) channel,symbol); value=(const char *) GetValueFromSplayTree(fx_info->symbols,key); if (value != (const char *) NULL) - return(QuantumScale*InterpretLocaleValue(value,(char **) NULL)); + return(QuantumScale*StringToDouble(value,(char **) NULL)); (void) DeleteNodeFromSplayTree(fx_info->symbols,key); if (LocaleNCompare(symbol,"depth",5) == 0) { @@ -1242,7 +1242,7 @@ static MagickRealType FxChannelStatistics(FxInfo *fx_info,const Image *image, } (void) AddValueToSplayTree(fx_info->symbols,ConstantString(key), ConstantString(statistic)); - return(QuantumScale*InterpretLocaleValue(statistic,(char **) NULL)); + return(QuantumScale*StringToDouble(statistic,(char **) NULL)); } static MagickRealType @@ -1835,7 +1835,7 @@ static MagickRealType FxGetSymbol(FxInfo *fx_info,const PixelChannel channel, } value=(const char *) GetValueFromSplayTree(fx_info->symbols,symbol); if (value != (const char *) NULL) - return((MagickRealType) InterpretLocaleValue(value,(char **) NULL)); + return((MagickRealType) StringToDouble(value,(char **) NULL)); (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "UnableToParseExpression","`%s'",symbol); return(0.0); @@ -2876,7 +2876,7 @@ static MagickRealType FxEvaluateSubexpression(FxInfo *fx_info, break; } q=(char *) expression; - alpha=InterpretLocaleValue(expression,&q); + alpha=InterpretSiPrefixValue(expression,&q); if (q == expression) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); return(alpha); diff --git a/MagickCore/geometry.c b/MagickCore/geometry.c index d5ab4144b..fea3a2695 100644 --- a/MagickCore/geometry.c +++ b/MagickCore/geometry.c @@ -192,7 +192,7 @@ MagickExport MagickStatusType GetGeometry(const char *geometry,ssize_t *x, if (*p == '\0') return(flags); q=p; - value=InterpretLocaleValue(p,&q); + value=StringToDouble(p,&q); (void) value; if (LocaleNCompare(p,"0x",2) == 0) value=(double) strtol(p,&q,10); @@ -206,7 +206,7 @@ MagickExport MagickStatusType GetGeometry(const char *geometry,ssize_t *x, if (LocaleNCompare(p,"0x",2) == 0) *width=(size_t) strtol(p,&p,10); else - *width=(size_t) floor(InterpretLocaleValue(p,&p)+0.5); + *width=(size_t) floor(StringToDouble(p,&p)+0.5); if (p != q) flags|=WidthValue; } @@ -221,7 +221,7 @@ MagickExport MagickStatusType GetGeometry(const char *geometry,ssize_t *x, Parse height. */ q=p; - *height=(size_t) floor(InterpretLocaleValue(p,&p)+0.5); + *height=(size_t) floor(StringToDouble(p,&p)+0.5); if (p != q) flags|=HeightValue; } @@ -234,7 +234,7 @@ MagickExport MagickStatusType GetGeometry(const char *geometry,ssize_t *x, if (*p == '-') flags|=XNegative; q=p; - *x=(ssize_t) ceil(InterpretLocaleValue(p,&p)-0.5); + *x=(ssize_t) ceil(StringToDouble(p,&p)-0.5); if (p != q) flags|=XValue; if ((*p == '+') || (*p == '-')) @@ -245,7 +245,7 @@ MagickExport MagickStatusType GetGeometry(const char *geometry,ssize_t *x, if (*p == '-') flags|=YNegative; q=p; - *y=(ssize_t) ceil(InterpretLocaleValue(p,&p)-0.5); + *y=(ssize_t) ceil(StringToDouble(p,&p)-0.5); if (p != q) flags|=YValue; } @@ -560,7 +560,7 @@ MagickExport MagickBooleanType IsSceneGeometry(const char *geometry, if (geometry == (const char *) NULL) return(MagickFalse); p=(char *) geometry; - value=InterpretLocaleValue(geometry,&p); + value=StringToDouble(geometry,&p); (void) value; if (p == geometry) return(MagickFalse); @@ -671,33 +671,33 @@ MagickExport MagickStatusType ParseAffineGeometry(const char *geometry, { case 0: { - affine_matrix->sx=InterpretLocaleValue(token,(char **) NULL); + affine_matrix->sx=StringToDouble(token,(char **) NULL); break; } case 1: { - affine_matrix->rx=InterpretLocaleValue(token,(char **) NULL); + affine_matrix->rx=StringToDouble(token,(char **) NULL); break; } case 2: { - affine_matrix->ry=InterpretLocaleValue(token,(char **) NULL); + affine_matrix->ry=StringToDouble(token,(char **) NULL); break; } case 3: { - affine_matrix->sy=InterpretLocaleValue(token,(char **) NULL); + affine_matrix->sy=StringToDouble(token,(char **) NULL); break; } case 4: { - affine_matrix->tx=InterpretLocaleValue(token,(char **) NULL); + affine_matrix->tx=StringToDouble(token,(char **) NULL); flags|=XValue; break; } case 5: { - affine_matrix->ty=InterpretLocaleValue(token,(char **) NULL); + affine_matrix->ty=StringToDouble(token,(char **) NULL); flags|=YValue; break; } @@ -861,7 +861,7 @@ MagickExport MagickStatusType ParseGeometry(const char *geometry, if (*p == '\0') return(flags); q=p; - value=InterpretLocaleValue(p,&q); + value=StringToDouble(p,&q); if (LocaleNCompare(p,"0x",2) == 0) value=(double) strtol(p,&q,10); c=(int) ((unsigned char) *q); @@ -875,7 +875,7 @@ MagickExport MagickStatusType ParseGeometry(const char *geometry, if (LocaleNCompare(p,"0x",2) == 0) value=(double) strtol(p,&p,10); else - value=InterpretLocaleValue(p,&p); + value=StringToDouble(p,&p); if (p != q) { flags|=RhoValue; @@ -898,7 +898,7 @@ MagickExport MagickStatusType ParseGeometry(const char *geometry, (*p != '-'))) { q=p; - value=InterpretLocaleValue(p,&p); + value=StringToDouble(p,&p); if (p != q) { flags|=SigmaValue; @@ -916,7 +916,7 @@ MagickExport MagickStatusType ParseGeometry(const char *geometry, if ((*p == ',') || (*p == '/') || (*p == ':')) p++; q=p; - value=InterpretLocaleValue(p,&p); + value=StringToDouble(p,&p); if (p != q) { flags|=XiValue; @@ -935,7 +935,7 @@ MagickExport MagickStatusType ParseGeometry(const char *geometry, if ((*p == ',') || (*p == '/') || (*p == ':')) p++; q=p; - value=InterpretLocaleValue(p,&p); + value=StringToDouble(p,&p); if (p != q) { flags|=PsiValue; @@ -955,7 +955,7 @@ MagickExport MagickStatusType ParseGeometry(const char *geometry, if ((*p == ',') || (*p == '/') || (*p == ':')) p++; q=p; - value=InterpretLocaleValue(p,&p); + value=StringToDouble(p,&p); if (p != q) { flags|=ChiValue; diff --git a/MagickCore/image.c b/MagickCore/image.c index 2d54db2a7..e6c30558a 100644 --- a/MagickCore/image.c +++ b/MagickCore/image.c @@ -4130,7 +4130,7 @@ MagickExport MagickBooleanType SyncImageSettings(const ImageInfo *image_info, exception); option=GetImageOption(image_info,"bias"); if (option != (const char *) NULL) - image->bias=InterpretLocaleInterval(option,QuantumRange); + image->bias=StringToDoubleInterval(option,QuantumRange); option=GetImageOption(image_info,"black-point-compensation"); if (option != (const char *) NULL) image->black_point_compensation=(MagickBooleanType) ParseCommandOption( @@ -4185,7 +4185,7 @@ MagickExport MagickBooleanType SyncImageSettings(const ImageInfo *image_info, MagickFalse,option); option=GetImageOption(image_info,"fuzz"); if (option != (const char *) NULL) - image->fuzz=InterpretLocaleInterval(option,(double) QuantumRange+1.0); + image->fuzz=StringToDoubleInterval(option,(double) QuantumRange+1.0); option=GetImageOption(image_info,"gravity"); if (option != (const char *) NULL) image->gravity=(GravityType) ParseCommandOption(MagickGravityOptions, diff --git a/MagickCore/locale.c b/MagickCore/locale.c index 64a15d604..9668321d1 100644 --- a/MagickCore/locale.c +++ b/MagickCore/locale.c @@ -885,31 +885,6 @@ MagickExport double InterpretLocaleValue(const char *restrict string, double value; - static const double - SIPrefixes['z'-'E'+1] = - { - ['y'-'E'] = (-24.0), - ['z'-'E'] = (-21.0), - ['a'-'E'] = (-18.0), - ['f'-'E'] = (-15.0), - ['p'-'E'] = (-12.0), - ['n'-'E'] = (-9.0), - ['u'-'E'] = (-6.0), - ['m'-'E'] = (-3.0), - ['c'-'E'] = (-2.0), - ['d'-'E'] = (-1.0), - ['h'-'E'] = 2.0, - ['k'-'E'] = 3.0, - ['K'-'E'] = 3.0, - ['M'-'E'] = 6.0, - ['G'-'E'] = 9.0, - ['T'-'E'] = 12.0, - ['P'-'E'] = 15.0, - ['E'-'E'] = 18.0, - ['Z'-'E'] = 21.0, - ['Y'-'E'] = 24.0 - }; - if ((*string == '0') && ((string[1] | 0x20)=='x')) value=(double) strtoul(string,&q,16); else @@ -927,34 +902,6 @@ MagickExport double InterpretLocaleValue(const char *restrict string, value=strtod(string,&q); #endif } - if (q != string) - { - if ((*q >= 'E') && (*q <= 'z')) - { - double - e; - - e=SIPrefixes[*q-'E']; - if (e >= MagickEpsilon) - { - if (q[1] == 'i') - { - value*=pow(2.0,e/0.3); - q+=2; - } - else - { - value*=pow(10.0,e); - q++; - } - } - } - if (*q == 'B') - { - value*=8.0; - q++; - } - } if (sentinal != (char **) NULL) *sentinal=q; return(value); diff --git a/MagickCore/morphology.c b/MagickCore/morphology.c index 139e3bfd2..743ce7040 100644 --- a/MagickCore/morphology.c +++ b/MagickCore/morphology.c @@ -331,7 +331,7 @@ static KernelInfo *ParseKernelArray(const char *kernel_string) kernel->values[i] = nan; /* do not include this value in kernel */ } else { - kernel->values[i] = InterpretLocaleValue(token,(char **) NULL); + kernel->values[i] = StringToDouble(token,(char **) NULL); ( kernel->values[i] < 0) ? ( kernel->negative_range += kernel->values[i] ) : ( kernel->positive_range += kernel->values[i] ); diff --git a/MagickCore/property.c b/MagickCore/property.c index da7e19cbb..ce4a5f11b 100644 --- a/MagickCore/property.c +++ b/MagickCore/property.c @@ -3200,7 +3200,7 @@ MagickExport MagickBooleanType SetImageProperty(Image *image, } if (LocaleCompare(property,"bias") == 0) { - image->bias=InterpretLocaleInterval(value,QuantumRange); + image->bias=StringToDoubleInterval(value,QuantumRange); break; } status=AddValueToSplayTree((SplayTreeInfo *) image->properties, diff --git a/MagickCore/quantum.c b/MagickCore/quantum.c index 28ca73c5a..2b117d8f7 100644 --- a/MagickCore/quantum.c +++ b/MagickCore/quantum.c @@ -373,10 +373,10 @@ MagickExport void GetQuantumInfo(const ImageInfo *image_info, MagickQuantumFormatOptions,MagickFalse,option); option=GetImageOption(image_info,"quantum:minimum"); if (option != (char *) NULL) - quantum_info->minimum=InterpretLocaleValue(option,(char **) NULL); + quantum_info->minimum=StringToDouble(option,(char **) NULL); option=GetImageOption(image_info,"quantum:maximum"); if (option != (char *) NULL) - quantum_info->maximum=InterpretLocaleValue(option,(char **) NULL); + quantum_info->maximum=StringToDouble(option,(char **) NULL); if ((quantum_info->minimum == 0.0) && (quantum_info->maximum == 0.0)) quantum_info->scale=0.0; else @@ -390,7 +390,7 @@ MagickExport void GetQuantumInfo(const ImageInfo *image_info, quantum_info->minimum); option=GetImageOption(image_info,"quantum:scale"); if (option != (char *) NULL) - quantum_info->scale=InterpretLocaleValue(option,(char **) NULL); + quantum_info->scale=StringToDouble(option,(char **) NULL); option=GetImageOption(image_info,"quantum:polarity"); if (option != (char *) NULL) quantum_info->min_is_white=LocaleCompare(option,"min-is-white") == 0 ? diff --git a/MagickCore/resize.c b/MagickCore/resize.c index d243ed964..f9c59be9f 100644 --- a/MagickCore/resize.c +++ b/MagickCore/resize.c @@ -932,7 +932,7 @@ MagickPrivate ResizeFilter *AcquireResizeFilter(const Image *image, } artifact=GetImageArtifact(image,"filter:sigma"); if (artifact != (const char *) NULL) - sigma=InterpretLocaleValue(artifact,(char **) NULL); /* override sigma */ + sigma=StringToDouble(artifact,(char **) NULL); /* override sigma */ if (GaussianFilter) { /* @@ -944,17 +944,19 @@ MagickPrivate ResizeFilter *AcquireResizeFilter(const Image *image, } artifact=GetImageArtifact(image,"filter:blur"); if (artifact != (const char *) NULL) - resize_filter->blur*=InterpretLocaleValue(artifact, - (char **) NULL); /* override blur */ + resize_filter->blur*=StringToDouble(artifact,(char **) NULL); /* override blur */ if (resize_filter->blur < MagickEpsilon) resize_filter->blur=(MagickRealType) MagickEpsilon; artifact=GetImageArtifact(image,"filter:lobes"); if (artifact != (const char *) NULL) { + ssize_t + lobes; + /* Override lobes. */ - ssize_t lobes=(ssize_t) StringToLong(artifact); + lobes=(ssize_t) StringToLong(artifact); if (lobes < 1) lobes=1; resize_filter->support=(MagickRealType) lobes; @@ -971,7 +973,7 @@ MagickPrivate ResizeFilter *AcquireResizeFilter(const Image *image, } artifact=GetImageArtifact(image,"filter:support"); if (artifact != (const char *) NULL) - resize_filter->support=fabs(InterpretLocaleValue(artifact, + resize_filter->support=fabs(StringToDouble(artifact, (char **) NULL)); /* override support */ /* Scale windowing function separately to the support 'clipping' window that @@ -980,7 +982,7 @@ MagickPrivate ResizeFilter *AcquireResizeFilter(const Image *image, resize_filter->window_support=resize_filter->support; /* default */ artifact=GetImageArtifact(image,"filter:win-support"); if (artifact != (const char *) NULL) - resize_filter->window_support=fabs(InterpretLocaleValue(artifact, + resize_filter->window_support=fabs(StringToDouble(artifact, (char **) NULL)); /* Adjust window function scaling to match windowing support for weighting @@ -1005,18 +1007,18 @@ MagickPrivate ResizeFilter *AcquireResizeFilter(const Image *image, artifact=GetImageArtifact(image,"filter:b"); if (artifact != (const char *) NULL) { - B=InterpretLocaleValue(artifact,(char **) NULL); + B=StringToDouble(artifact,(char **) NULL); C=(1.0-B)/2.0; /* Calculate C to get a Keys cubic filter. */ artifact=GetImageArtifact(image,"filter:c"); /* user C override */ if (artifact != (const char *) NULL) - C=InterpretLocaleValue(artifact,(char **) NULL); + C=StringToDouble(artifact,(char **) NULL); } else { artifact=GetImageArtifact(image,"filter:c"); if (artifact != (const char *) NULL) { - C=InterpretLocaleValue(artifact,(char **) NULL); + C=StringToDouble(artifact,(char **) NULL); B=1.0-2.0*C; /* Calculate B to get a Keys cubic filter. */ } } diff --git a/MagickCore/resource.c b/MagickCore/resource.c index 1c417d056..b92e205c0 100644 --- a/MagickCore/resource.c +++ b/MagickCore/resource.c @@ -899,7 +899,7 @@ static inline MagickSizeType StringToSizeType(const char *string, double value; - value=InterpretLocaleInterval(string,interval); + value=StringToDoubleInterval(string,interval); if (value >= (double) MagickULLConstant(~0)) return(MagickULLConstant(~0)); return((MagickSizeType) value); diff --git a/MagickCore/string-private.h b/MagickCore/string-private.h index 47d431726..8c99324e2 100644 --- a/MagickCore/string-private.h +++ b/MagickCore/string-private.h @@ -22,7 +22,15 @@ extern "C" { #endif -static inline double InterpretLocaleInterval(const char *string, +#include + +static inline double StringToDouble(const char *restrict string, + char **restrict sentinal) +{ + return(InterpretLocaleValue(string,sentinal)); +} + +static inline double StringToDoubleInterval(const char *string, const double interval) { char @@ -31,26 +39,23 @@ static inline double InterpretLocaleInterval(const char *string, double value; - /* - Interpret string with International System of Units (SI) unit prefix. - */ - value=InterpretLocaleValue(string,&q); + value=InterpretSiPrefixValue(string,&q); if (*q == '%') value*=interval/100.0; return(value); } -static inline int StringToInteger(const char *value) +static inline int StringToInteger(const char *restrict value) { return((int) strtol(value,(char **) NULL,10)); } -static inline long StringToLong(const char *value) +static inline long StringToLong(const char *restrict value) { return(strtol(value,(char **) NULL,10)); } -static inline unsigned long StringToUnsignedLong(const char *value) +static inline unsigned long StringToUnsignedLong(const char *restrict value) { return(strtoul(value,(char **) NULL,10)); } diff --git a/MagickCore/string.c b/MagickCore/string.c index dd6ded769..7fe1fac04 100644 --- a/MagickCore/string.c +++ b/MagickCore/string.c @@ -1311,6 +1311,101 @@ MagickExport const char *GetStringInfoPath(const StringInfo *string_info) % % % % % % ++ I n t e r p r e t S i P r e f i x V a l u e % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% InterpretSiPrefixValue() converts the initial portion of the string to a +% double representation. It also recognizes SI prefixes (e.g. B, KB, MiB, +% etc.). +% +% The format of the InterpretSiPrefixValue method is: +% +% double InterpretSiPrefixValue(const char *value,char **sentinal) +% +% A description of each parameter follows: +% +% o value: the string value. +% +% o sentinal: if sentinal is not NULL, return a pointer to the character +% after the last character used in the conversion. +% +*/ +MagickExport double InterpretSiPrefixValue(const char *restrict string, + char **restrict sentinal) +{ + char + *q; + + double + value; + + static const double + SIPrefixes['z'-'E'+1] = + { + ['y'-'E'] = (-24.0), + ['z'-'E'] = (-21.0), + ['a'-'E'] = (-18.0), + ['f'-'E'] = (-15.0), + ['p'-'E'] = (-12.0), + ['n'-'E'] = (-9.0), + ['u'-'E'] = (-6.0), + ['m'-'E'] = (-3.0), + ['c'-'E'] = (-2.0), + ['d'-'E'] = (-1.0), + ['h'-'E'] = 2.0, + ['k'-'E'] = 3.0, + ['K'-'E'] = 3.0, + ['M'-'E'] = 6.0, + ['G'-'E'] = 9.0, + ['T'-'E'] = 12.0, + ['P'-'E'] = 15.0, + ['E'-'E'] = 18.0, + ['Z'-'E'] = 21.0, + ['Y'-'E'] = 24.0 + }; + + value=InterpretLocaleValue(string,&q); + if (q != string) + { + if ((*q >= 'E') && (*q <= 'z')) + { + double + e; + + e=SIPrefixes[*q-'E']; + if (e >= MagickEpsilon) + { + if (q[1] == 'i') + { + value*=pow(2.0,e/0.3); + q+=2; + } + else + { + value*=pow(10.0,e); + q++; + } + } + } + if (*q == 'B') + { + value*=8.0; + q++; + } + } + if (sentinal != (char **) NULL) + *sentinal=q; + return(value); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % % L o c a l e C o m p a r e % % % % % diff --git a/MagickCore/string_.h b/MagickCore/string_.h index fd91415d8..712e863a2 100644 --- a/MagickCore/string_.h +++ b/MagickCore/string_.h @@ -57,6 +57,9 @@ extern MagickExport char extern MagickExport const char *GetStringInfoPath(const StringInfo *); +extern MagickExport double + InterpretSiPrefixValue(const char *restrict,char **restrict); + extern MagickExport int CompareStringInfo(const StringInfo *,const StringInfo *), LocaleCompare(const char *,const char *), diff --git a/MagickCore/threshold.c b/MagickCore/threshold.c index e42e3abad..cb200c665 100644 --- a/MagickCore/threshold.c +++ b/MagickCore/threshold.c @@ -1273,7 +1273,7 @@ MagickExport MagickBooleanType OrderedPosterizeImage(Image *image, GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - levels[i]=InterpretLocaleValue(token,(char **) NULL); + levels[i]=StringToDouble(token,(char **) NULL); } for (i=0; i < MaxPixelChannels; i++) if (fabs(levels[i]) >= 1) diff --git a/MagickCore/token.c b/MagickCore/token.c index fbc732d31..73deea4b4 100644 --- a/MagickCore/token.c +++ b/MagickCore/token.c @@ -230,7 +230,7 @@ MagickExport void GetMagickToken(const char *start,const char **end,char *token) char *q; - value=InterpretLocaleValue(p,&q); + value=StringToDouble(p,&q); (void) value; if ((p != q) && (*p != ',')) { diff --git a/MagickWand/animate.c b/MagickWand/animate.c index 0b09f453a..46acd4ce1 100644 --- a/MagickWand/animate.c +++ b/MagickWand/animate.c @@ -1008,7 +1008,7 @@ WandExport MagickBooleanType AnimateImageCommand(ImageInfo *image_info, i++; if (i == (ssize_t) argc) ThrowAnimateException(OptionError,"MissingArgument",option); - value=InterpretLocaleValue(argv[i],&p); + value=StringToDouble(argv[i],&p); (void) value; if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0)) ThrowAnimateInvalidArgumentException(option,argv[i]); diff --git a/MagickWand/compare.c b/MagickWand/compare.c index 93e9a8b33..481b38ede 100644 --- a/MagickWand/compare.c +++ b/MagickWand/compare.c @@ -529,7 +529,7 @@ WandExport MagickBooleanType CompareImagesCommand(ImageInfo *image_info, if (*option == '+') dissimilarity_threshold=DefaultDissimilarityThreshold; else - dissimilarity_threshold=InterpretLocaleValue(argv[i], + dissimilarity_threshold=StringToDouble(argv[i], (char **) NULL); break; } @@ -660,7 +660,7 @@ WandExport MagickBooleanType CompareImagesCommand(ImageInfo *image_info, i++; if (i == (ssize_t) argc) ThrowCompareException(OptionError,"MissingArgument",option); - value=InterpretLocaleValue(argv[i],&p); + value=StringToDouble(argv[i],&p); (void) value; if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0)) ThrowCompareInvalidArgumentException(option,argv[i]); diff --git a/MagickWand/composite.c b/MagickWand/composite.c index 00dcf0b82..fbc640755 100644 --- a/MagickWand/composite.c +++ b/MagickWand/composite.c @@ -1134,7 +1134,7 @@ WandExport MagickBooleanType CompositeImageCommand(ImageInfo *image_info, i++; if (i == (ssize_t) argc) ThrowCompositeException(OptionError,"MissingArgument",option); - value=InterpretLocaleValue(argv[i],&p); + value=StringToDouble(argv[i],&p); (void) value; if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0)) ThrowCompositeInvalidArgumentException(option,argv[i]); diff --git a/MagickWand/convert.c b/MagickWand/convert.c index 44655487b..e990ca420 100644 --- a/MagickWand/convert.c +++ b/MagickWand/convert.c @@ -1853,7 +1853,7 @@ WandExport MagickBooleanType ConvertImageCommand(ImageInfo *image_info, i++; if (i == (ssize_t) argc) ThrowConvertException(OptionError,"MissingArgument",option); - value=InterpretLocaleValue(argv[i],&p); + value=StringToDouble(argv[i],&p); (void) value; if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0)) ThrowConvertInvalidArgumentException(option,argv[i]); diff --git a/MagickWand/display.c b/MagickWand/display.c index 49d3868d9..4fe2bfb7d 100644 --- a/MagickWand/display.c +++ b/MagickWand/display.c @@ -1314,7 +1314,7 @@ WandExport MagickBooleanType DisplayImageCommand(ImageInfo *image_info, i++; if (i == (ssize_t) argc) ThrowDisplayException(OptionError,"MissingArgument",option); - value=InterpretLocaleValue(argv[i],&p); + value=StringToDouble(argv[i],&p); (void) value; if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0)) ThrowDisplayInvalidArgumentException(option,argv[i]); @@ -1850,7 +1850,7 @@ WandExport MagickBooleanType DisplayImageCommand(ImageInfo *image_info, i++; if (i == (ssize_t) argc) ThrowDisplayException(OptionError,"MissingArgument",option); - if (InterpretLocaleValue(argv[i],(char **) NULL) != 0) + if (StringToDouble(argv[i],(char **) NULL) != 0) resource_info.window_group=argv[i]; break; } diff --git a/MagickWand/drawing-wand.c b/MagickWand/drawing-wand.c index 89102c5b5..525387976 100644 --- a/MagickWand/drawing-wand.c +++ b/MagickWand/drawing-wand.c @@ -6190,7 +6190,7 @@ WandExport MagickBooleanType DrawSetVectorGraphics(DrawingWand *wand, value=GetXMLTreeContent(child); if (value != (const char *) NULL) CurrentContext->fill.alpha=ClampToQuantum((MagickRealType) - QuantumRange*(1.0-InterpretLocaleValue(value,(char **) NULL))); + QuantumRange*(1.0-StringToDouble(value,(char **) NULL))); } child=GetXMLTreeChild(xml_info,"fill-rule"); if (child != (XMLTreeInfo *) NULL) @@ -6211,7 +6211,7 @@ WandExport MagickBooleanType DrawSetVectorGraphics(DrawingWand *wand, { value=GetXMLTreeContent(child); if (value != (const char *) NULL) - CurrentContext->pointsize=InterpretLocaleValue(value,(char **) NULL); + CurrentContext->pointsize=StringToDouble(value,(char **) NULL); } child=GetXMLTreeChild(xml_info,"font-stretch"); if (child != (XMLTreeInfo *) NULL) @@ -6307,7 +6307,7 @@ WandExport MagickBooleanType DrawSetVectorGraphics(DrawingWand *wand, GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - CurrentContext->dash_pattern[j]=InterpretLocaleValue(token, + CurrentContext->dash_pattern[j]=StringToDouble(token, (char **) NULL); } if ((x & 0x01) != 0) @@ -6323,7 +6323,7 @@ WandExport MagickBooleanType DrawSetVectorGraphics(DrawingWand *wand, { value=GetXMLTreeContent(child); if (value != (const char *) NULL) - CurrentContext->dash_offset=InterpretLocaleValue(value,(char **) NULL); + CurrentContext->dash_offset=StringToDouble(value,(char **) NULL); } child=GetXMLTreeChild(xml_info,"stroke-linecap"); if (child != (XMLTreeInfo *) NULL) @@ -6354,14 +6354,14 @@ WandExport MagickBooleanType DrawSetVectorGraphics(DrawingWand *wand, value=GetXMLTreeContent(child); if (value != (const char *) NULL) CurrentContext->stroke.alpha=ClampToQuantum((MagickRealType) - QuantumRange*(1.0-InterpretLocaleValue(value,(char **) NULL))); + QuantumRange*(1.0-StringToDouble(value,(char **) NULL))); } child=GetXMLTreeChild(xml_info,"stroke-width"); if (child != (XMLTreeInfo *) NULL) { value=GetXMLTreeContent(child); if (value != (const char *) NULL) - CurrentContext->stroke_width=InterpretLocaleValue(value,(char **) NULL); + CurrentContext->stroke_width=StringToDouble(value,(char **) NULL); } child=GetXMLTreeChild(xml_info,"text-align"); if (child != (XMLTreeInfo *) NULL) diff --git a/MagickWand/identify.c b/MagickWand/identify.c index df1c07172..7d0c96904 100644 --- a/MagickWand/identify.c +++ b/MagickWand/identify.c @@ -639,7 +639,7 @@ WandExport MagickBooleanType IdentifyImageCommand(ImageInfo *image_info, i++; if (i == (ssize_t) argc) ThrowIdentifyException(OptionError,"MissingArgument",option); - value=InterpretLocaleValue(argv[i],&p); + value=StringToDouble(argv[i],&p); (void) value; if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0)) ThrowIdentifyInvalidArgumentException(option,argv[i]); diff --git a/MagickWand/import.c b/MagickWand/import.c index a23f05783..0f3772758 100644 --- a/MagickWand/import.c +++ b/MagickWand/import.c @@ -944,7 +944,7 @@ WandExport MagickBooleanType ImportImageCommand(ImageInfo *image_info, i++; if (i == (ssize_t) argc) ThrowImportException(OptionError,"MissingArgument",option); - value=InterpretLocaleValue(argv[i],&p); + value=StringToDouble(argv[i],&p); (void) value; if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0)) ThrowImportInvalidArgumentException(option,argv[i]); diff --git a/MagickWand/magick-property.c b/MagickWand/magick-property.c index b431aaffd..972f9fbf3 100644 --- a/MagickWand/magick-property.c +++ b/MagickWand/magick-property.c @@ -1538,7 +1538,7 @@ WandExport double *MagickGetSamplingFactors(MagickWand *wand, while (((int) *p != 0) && ((isspace((int) ((unsigned char) *p)) != 0) || (*p == ','))) p++; - sampling_factors[i]=InterpretLocaleValue(p,(char **) NULL); + sampling_factors[i]=StringToDouble(p,(char **) NULL); i++; } *number_factors=(size_t) i; diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c index f961d3ec9..d002e861b 100644 --- a/MagickWand/mogrify.c +++ b/MagickWand/mogrify.c @@ -153,7 +153,7 @@ WandExport MagickBooleanType MagickCommandGenesis(ImageInfo *image_info, if (LocaleCompare("debug",option+1) == 0) (void) SetLogEventMask(argv[++i]); if (LocaleCompare("duration",option+1) == 0) - duration=InterpretLocaleValue(argv[++i],(char **) NULL); + duration=StringToDouble(argv[++i],(char **) NULL); if (LocaleCompare("regard-warnings",option+1) == 0) regard_warnings=MagickTrue; } @@ -508,7 +508,7 @@ static Image *SparseColorOption(const Image *image, error = MagickTrue; break; } - sparse_arguments[x++]=InterpretLocaleValue(token,(char **) NULL); + sparse_arguments[x++]=StringToDouble(token,(char **) NULL); /* Y coordinate */ token[0]=','; while ( token[0] == ',' ) GetMagickToken(p,&p,token); if ( token[0] == '\0' ) break; @@ -519,7 +519,7 @@ static Image *SparseColorOption(const Image *image, error = MagickTrue; break; } - sparse_arguments[x++]=InterpretLocaleValue(token,(char **) NULL); + sparse_arguments[x++]=StringToDouble(token,(char **) NULL); /* color values for this control point */ #if 0 if ( (color_from_image ) { @@ -556,7 +556,7 @@ static Image *SparseColorOption(const Image *image, while ( token[0] == ',' ) GetMagickToken(p,&p,token); if ( token[0] == '\0' || isalpha((int)token[0]) || token[0] == '#' ) break; - sparse_arguments[x++]=InterpretLocaleValue(token,(char **) NULL); + sparse_arguments[x++]=StringToDouble(token,(char **) NULL); token[0] = ','; /* used this token - get another */ } if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) @@ -564,7 +564,7 @@ static Image *SparseColorOption(const Image *image, while ( token[0] == ',' ) GetMagickToken(p,&p,token); if ( token[0] == '\0' || isalpha((int)token[0]) || token[0] == '#' ) break; - sparse_arguments[x++]=InterpretLocaleValue(token,(char **) NULL); + sparse_arguments[x++]=StringToDouble(token,(char **) NULL); token[0] = ','; /* used this token - get another */ } if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) @@ -572,7 +572,7 @@ static Image *SparseColorOption(const Image *image, while ( token[0] == ',' ) GetMagickToken(p,&p,token); if ( token[0] == '\0' || isalpha((int)token[0]) || token[0] == '#' ) break; - sparse_arguments[x++]=InterpretLocaleValue(token,(char **) NULL); + sparse_arguments[x++]=StringToDouble(token,(char **) NULL); token[0] = ','; /* used this token - get another */ } if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) && @@ -581,7 +581,7 @@ static Image *SparseColorOption(const Image *image, while ( token[0] == ',' ) GetMagickToken(p,&p,token); if ( token[0] == '\0' || isalpha((int)token[0]) || token[0] == '#' ) break; - sparse_arguments[x++]=InterpretLocaleValue(token,(char **) NULL); + sparse_arguments[x++]=StringToDouble(token,(char **) NULL); token[0] = ','; /* used this token - get another */ } if (((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) && @@ -590,7 +590,7 @@ static Image *SparseColorOption(const Image *image, while ( token[0] == ',' ) GetMagickToken(p,&p,token); if ( token[0] == '\0' || isalpha((int)token[0]) || token[0] == '#' ) break; - sparse_arguments[x++]=InterpretLocaleValue(token,(char **) NULL); + sparse_arguments[x++]=StringToDouble(token,(char **) NULL); token[0] = ','; /* used this token - get another */ } } @@ -824,7 +824,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, attenuate=1.0; break; } - attenuate=InterpretLocaleValue(argv[i+1],(char **) NULL); + attenuate=StringToDouble(argv[i+1],(char **) NULL); break; } if (LocaleCompare("auto-gamma",option+1) == 0) @@ -1309,7 +1309,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, if (*option == '+') threshold=40.0*QuantumRange/100.0; else - threshold=InterpretLocaleInterval(argv[i+1],QuantumRange); + threshold=StringToDoubleInterval(argv[i+1],QuantumRange); mogrify_image=DeskewImage(*image,threshold,exception); break; } @@ -1394,7 +1394,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - arguments[x]=InterpretLocaleValue(token,(char **) NULL); + arguments[x]=StringToDouble(token,(char **) NULL); } args=DestroyString(args); mogrify_image=DistortImage(*image,method,number_arguments,arguments, @@ -1507,7 +1507,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, (void) SyncImageSettings(mogrify_info,*image,exception); op=(MagickEvaluateOperator) ParseCommandOption( MagickEvaluateOptions,MagickFalse,argv[i+1]); - constant=InterpretLocaleInterval(argv[i+2],QuantumRange); + constant=StringToDoubleInterval(argv[i+2],QuantumRange); (void) EvaluateImage(*image,op,constant,exception); break; } @@ -1702,7 +1702,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - parameters[x]=InterpretLocaleValue(token,(char **) NULL); + parameters[x]=StringToDouble(token,(char **) NULL); } arguments=DestroyString(arguments); (void) FunctionImage(*image,function,number_parameters,parameters, @@ -1721,9 +1721,9 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, */ (void) SyncImageSettings(mogrify_info,*image,exception); if (*option == '+') - (*image)->gamma=InterpretLocaleValue(argv[i+1],(char **) NULL); + (*image)->gamma=StringToDouble(argv[i+1],(char **) NULL); else - (void) GammaImage(*image,InterpretLocaleValue(argv[i+1], + (void) GammaImage(*image,StringToDouble(argv[i+1], (char **) NULL),exception); break; } @@ -1978,7 +1978,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, } if (LocaleCompare("linewidth",option+1) == 0) { - draw_info->stroke_width=InterpretLocaleValue(argv[i+1], + draw_info->stroke_width=StringToDouble(argv[i+1], (char **) NULL); break; } @@ -2618,7 +2618,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, Sepia-tone image. */ (void) SyncImageSettings(mogrify_info,*image,exception); - threshold=InterpretLocaleInterval(argv[i+1],QuantumRange); + threshold=StringToDoubleInterval(argv[i+1],QuantumRange); mogrify_image=SepiaToneImage(*image,threshold,exception); break; } @@ -2782,7 +2782,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, threshold; (void) SyncImageSettings(mogrify_info,*image,exception); - threshold=InterpretLocaleInterval(argv[i+1],QuantumRange); + threshold=StringToDoubleInterval(argv[i+1],QuantumRange); (void) SolarizeImage(*image,threshold,exception); break; } @@ -2888,7 +2888,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, } if (LocaleCompare("strokewidth",option+1) == 0) { - draw_info->stroke_width=InterpretLocaleValue(argv[i+1], + draw_info->stroke_width=StringToDouble(argv[i+1], (char **) NULL); break; } @@ -2930,7 +2930,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, if (*option == '+') threshold=(double) QuantumRange/2; else - threshold=InterpretLocaleInterval(argv[i+1],QuantumRange); + threshold=StringToDoubleInterval(argv[i+1],QuantumRange); (void) BilevelImage(*image,threshold,exception); break; } @@ -4929,7 +4929,7 @@ WandExport MagickBooleanType MogrifyImageCommand(ImageInfo *image_info, i++; if (i == (ssize_t) argc) ThrowMogrifyException(OptionError,"MissingArgument",option); - value=InterpretLocaleValue(argv[i],&p); + value=StringToDouble(argv[i],&p); (void) value; if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0)) ThrowMogrifyInvalidArgumentException(option,argv[i]); @@ -6247,7 +6247,7 @@ WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info, limit=MagickResourceInfinity; if (LocaleCompare("unlimited",argv[i+1]) != 0) - limit=(MagickSizeType) InterpretLocaleInterval(argv[i+1],100.0); + limit=(MagickSizeType) StringToDoubleInterval(argv[i+1],100.0); (void) SetMagickResourceLimit(MemoryResource,limit); (void) SetMagickResourceLimit(MapResource,2*limit); break; @@ -6525,8 +6525,8 @@ WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info, (void) SetImageOption(image_info,option+1,"0"); break; } - image_info->fuzz=InterpretLocaleInterval(argv[i+1],(double) QuantumRange+ - 1.0); + image_info->fuzz=StringToDoubleInterval(argv[i+1],(double) + QuantumRange+1.0); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } @@ -6653,7 +6653,7 @@ WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info, MagickFalse,argv[i+1]); limit=MagickResourceInfinity; if (LocaleCompare("unlimited",argv[i+2]) != 0) - limit=(MagickSizeType) InterpretLocaleInterval(argv[i+2],100.0); + limit=(MagickSizeType) StringToDoubleInterval(argv[i+2],100.0); (void) SetMagickResourceLimit(type,limit); break; } diff --git a/MagickWand/montage.c b/MagickWand/montage.c index bb0919d6e..1995b1d54 100644 --- a/MagickWand/montage.c +++ b/MagickWand/montage.c @@ -1137,7 +1137,7 @@ WandExport MagickBooleanType MontageImageCommand(ImageInfo *image_info, i++; if (i == (ssize_t) argc) ThrowMontageException(OptionError,"MissingArgument",option); - value=InterpretLocaleValue(argv[i],&p); + value=StringToDouble(argv[i],&p); (void) value; if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0)) ThrowMontageInvalidArgumentException(option,argv[i]); @@ -1282,7 +1282,7 @@ WandExport MagickBooleanType MontageImageCommand(ImageInfo *image_info, ThrowMontageException(OptionError,"MissingArgument",option); if (IsGeometry(argv[i]) == MagickFalse) ThrowMontageInvalidArgumentException(option,argv[i]); - montage_info->pointsize=InterpretLocaleValue(argv[i], + montage_info->pointsize=StringToDouble(argv[i], (char **) NULL); break; } diff --git a/MagickWand/operation.c b/MagickWand/operation.c index 1b9e72988..8881e165d 100644 --- a/MagickWand/operation.c +++ b/MagickWand/operation.c @@ -265,7 +265,7 @@ static Image *SparseColorOption(const Image *image, error = MagickTrue; break; } - sparse_arguments[x++]=InterpretLocaleValue(token,(char **) NULL); + sparse_arguments[x++]=StringToDouble(token,(char **) NULL); /* Y coordinate */ token[0]=','; while ( token[0] == ',' ) GetMagickToken(p,&p,token); if ( token[0] == '\0' ) break; @@ -276,7 +276,7 @@ static Image *SparseColorOption(const Image *image, error = MagickTrue; break; } - sparse_arguments[x++]=InterpretLocaleValue(token,(char **) NULL); + sparse_arguments[x++]=StringToDouble(token,(char **) NULL); /* color values for this control point */ #if 0 if ( (color_from_image ) { @@ -314,7 +314,7 @@ static Image *SparseColorOption(const Image *image, while ( token[0] == ',' ) GetMagickToken(p,&p,token); if ( token[0] == '\0' || isalpha((int)token[0]) || token[0] == '#' ) break; - sparse_arguments[x++]=InterpretLocaleValue(token,(char **) NULL); + sparse_arguments[x++]=StringToDouble(token,(char **) NULL); token[0] = ','; /* used this token - get another */ } if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) @@ -322,7 +322,7 @@ static Image *SparseColorOption(const Image *image, while ( token[0] == ',' ) GetMagickToken(p,&p,token); if ( token[0] == '\0' || isalpha((int)token[0]) || token[0] == '#' ) break; - sparse_arguments[x++]=InterpretLocaleValue(token,(char **) NULL); + sparse_arguments[x++]=StringToDouble(token,(char **) NULL); token[0] = ','; /* used this token - get another */ } if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) @@ -330,7 +330,7 @@ static Image *SparseColorOption(const Image *image, while ( token[0] == ',' ) GetMagickToken(p,&p,token); if ( token[0] == '\0' || isalpha((int)token[0]) || token[0] == '#' ) break; - sparse_arguments[x++]=InterpretLocaleValue(token,(char **) NULL); + sparse_arguments[x++]=StringToDouble(token,(char **) NULL); token[0] = ','; /* used this token - get another */ } if (((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) && @@ -339,7 +339,7 @@ static Image *SparseColorOption(const Image *image, while ( token[0] == ',' ) GetMagickToken(p,&p,token); if ( token[0] == '\0' || isalpha((int)token[0]) || token[0] == '#' ) break; - sparse_arguments[x++]=InterpretLocaleValue(token,(char **) NULL); + sparse_arguments[x++]=StringToDouble(token,(char **) NULL); token[0] = ','; /* used this token - get another */ } if (((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) && @@ -348,7 +348,7 @@ static Image *SparseColorOption(const Image *image, while ( token[0] == ',' ) GetMagickToken(p,&p,token); if ( token[0] == '\0' || isalpha((int)token[0]) || token[0] == '#' ) break; - sparse_arguments[x++]=InterpretLocaleValue(token,(char **) NULL); + sparse_arguments[x++]=StringToDouble(token,(char **) NULL); token[0] = ','; /* used this token - get another */ } } @@ -557,7 +557,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, limit=MagickResourceInfinity; if (LocaleCompare("unlimited",arg) != 0) - limit=(MagickSizeType) InterpretLocaleInterval(arg,100.0); + limit=(MagickSizeType) StringToDoubleInterval(arg,100.0); (void) SetMagickResourceLimit(MemoryResource,limit); (void) SetMagickResourceLimit(MapResource,2*limit); break; @@ -832,7 +832,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, */ if (IfSetOption) { - image_info->fuzz=InterpretLocaleInterval(arg,(double) QuantumRange+1.0); + image_info->fuzz=StringToDoubleInterval(arg,(double) QuantumRange+1.0); (void) SetImageOption(image_info,option,arg); break; } @@ -901,7 +901,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, value = IfSetOption ? arg : "0"; /* undefined? */ (void) SetImageOption(image_info,option, value); - draw_info->interline_spacing=InterpretLocaleValue(value, + draw_info->interline_spacing=StringToDouble(value, (char **) NULL); break; } @@ -922,7 +922,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, value = IfSetOption ? arg : "0"; /* undefined? */ (void) SetImageOption(image_info,option, value); - draw_info->interword_spacing=InterpretLocaleValue(value, + draw_info->interword_spacing=StringToDouble(value, (char **) NULL); break; } @@ -937,7 +937,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, value = IfSetOption ? arg : "0"; /* undefined? */ (void) SetImageOption(image_info,option, value); - draw_info->kerning=InterpretLocaleValue(value,(char **) NULL); + draw_info->kerning=StringToDouble(value,(char **) NULL); break; } break; @@ -965,7 +965,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, MagickFalse,arg); limit=MagickResourceInfinity; if (LocaleCompare("unlimited",argv[2]) != 0) - limit=(MagickSizeType) InterpretLocaleInterval(argv[2],100.0); + limit=(MagickSizeType) StringToDoubleInterval(argv[2],100.0); (void) SetMagickResourceLimit(type,limit); break; } @@ -1181,7 +1181,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, value=12.0; if (IfSetOption) - InterpretLocaleValue(arg,(char **) NULL); + StringToDouble(arg,(char **) NULL); image_info->pointsize=draw_info->pointsize=value; break; } @@ -1334,7 +1334,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, const char *value = IfSetOption ? arg : "1.0"; (void) SetImageOption(image_info,option,value); - draw_info->stroke_width=InterpretLocaleValue(value,(char **) NULL); + draw_info->stroke_width=StringToDouble(value,(char **) NULL); break; } if (LocaleCompare("style",option) == 0) @@ -2115,7 +2115,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, if (*argv[0] == '+') threshold=40.0*QuantumRange/100.0; else - threshold=InterpretLocaleInterval(args[0],QuantumRange); + threshold=StringToDoubleInterval(args[0],QuantumRange); new_image=DeskewImage(*image,threshold,exception); break; } @@ -2200,7 +2200,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - arguments[x]=InterpretLocaleValue(token,(char **) NULL); + arguments[x]=StringToDouble(token,(char **) NULL); } args=DestroyString(args); new_image=DistortImage(*image,method,number_arguments,arguments, @@ -2276,7 +2276,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, (void) SyncImageSettings(image_info,*image,exception); op=(MagickEvaluateOperator) ParseCommandOption( MagickEvaluateOptions,MagickFalse,args[0]); - constant=InterpretLocaleInterval(argv[2],QuantumRange); + constant=StringToDoubleInterval(argv[2],QuantumRange); (void) EvaluateImage(*image,op,constant,exception); break; } @@ -2418,7 +2418,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - parameters[x]=InterpretLocaleValue(token,(char **) NULL); + parameters[x]=StringToDouble(token,(char **) NULL); } arguments=DestroyString(arguments); (void) FunctionImage(*image,function,number_parameters,parameters, @@ -2434,9 +2434,9 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, { (void) SyncImageSettings(image_info,*image,exception); if (*argv[0] == '+') - (*image)->gamma=InterpretLocaleValue(args[0],(char **) NULL); + (*image)->gamma=StringToDouble(args[0],(char **) NULL); else - (void) GammaImage(*image,InterpretLocaleValue(args[0], + (void) GammaImage(*image,StringToDouble(args[0], (char **) NULL),exception); break; } @@ -2678,7 +2678,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, } if (LocaleCompare("linewidth",option) == 0) { - draw_info->stroke_width=InterpretLocaleValue(args[0], + draw_info->stroke_width=StringToDouble(args[0], (char **) NULL); break; } @@ -3218,7 +3218,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, threshold; (void) SyncImageSettings(image_info,*image,exception); - threshold=InterpretLocaleInterval(args[0],QuantumRange); + threshold=StringToDoubleInterval(args[0],QuantumRange); new_image=SepiaToneImage(*image,threshold,exception); break; } @@ -3354,7 +3354,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, threshold; (void) SyncImageSettings(image_info,*image,exception); - threshold=InterpretLocaleInterval(args[0],QuantumRange); + threshold=StringToDoubleInterval(args[0],QuantumRange); (void) SolarizeImage(*image,threshold,exception); break; } @@ -3433,7 +3433,7 @@ WandExport MagickBooleanType ApplySettingsOption(MagickWand *wand, if (*argv[0] == '+') threshold=(double) QuantumRange/2; else - threshold=InterpretLocaleInterval(args[0],QuantumRange); + threshold=StringToDoubleInterval(args[0],QuantumRange); (void) BilevelImage(*image,threshold,exception); break; } diff --git a/MagickWand/stream.c b/MagickWand/stream.c index ac14535e3..151e7e522 100644 --- a/MagickWand/stream.c +++ b/MagickWand/stream.c @@ -547,7 +547,7 @@ WandExport MagickBooleanType StreamImageCommand(ImageInfo *image_info, i++; if (i == (ssize_t) argc) ThrowStreamException(OptionError,"MissingArgument",option); - value=InterpretLocaleValue(argv[i],&p); + value=StringToDouble(argv[i],&p); (void) value; if ((p == argv[i]) && (LocaleCompare("unlimited",argv[i]) != 0)) ThrowStreamInvalidArgumentException(option,argv[i]); diff --git a/PerlMagick/Magick.xs b/PerlMagick/Magick.xs index 8bc91dd27..068fb1d97 100644 --- a/PerlMagick/Magick.xs +++ b/PerlMagick/Magick.xs @@ -1026,7 +1026,7 @@ static struct PackageInfo *GetPackageInfo(pTHX_ void *reference, % */ -static double InterpretLocaleInterval(const char *string,const double interval) +static double StringToDoubleInterval(const char *string,const double interval) { char *q; @@ -1035,7 +1035,7 @@ static double InterpretLocaleInterval(const char *string,const double interval) scale, value; - value=InterpretLocaleValue(string,&q); + value=StringToDouble(string,&q); scale=1000.0; if ((*q != '\0') && (tolower((int) ((unsigned char) *(q+1))) == 'i')) scale=1024.0; @@ -1137,7 +1137,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image, limit=MagickResourceInfinity; if (LocaleCompare(SvPV(sval,na),"unlimited") != 0) - limit=(MagickSizeType) InterpretLocaleInterval(SvPV(sval,na),100.0); + limit=(MagickSizeType) StringToDoubleInterval(SvPV(sval,na),100.0); (void) SetMagickResourceLimit(AreaResource,limit); break; } @@ -1175,7 +1175,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image, if (LocaleCompare(attribute,"bias") == 0) { for ( ; image; image=image->next) - image->bias=InterpretLocaleInterval(SvPV(sval,na),QuantumRange); + image->bias=StringToDoubleInterval(SvPV(sval,na),QuantumRange); break; } if (LocaleCompare(attribute,"blue-primary") == 0) @@ -1213,9 +1213,9 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image, if (LocaleCompare(attribute,"cache-threshold") == 0) { (void) SetMagickResourceLimit(MemoryResource,(MagickSizeType) - InterpretLocaleInterval(SvPV(sval,na),100.0)); + StringToDoubleInterval(SvPV(sval,na),100.0)); (void) SetMagickResourceLimit(MapResource,(MagickSizeType) - (2*InterpretLocaleInterval(SvPV(sval,na),100.0))); + (2*StringToDoubleInterval(SvPV(sval,na),100.0))); break; } if (LocaleCompare(attribute,"clip-mask") == 0) @@ -1340,7 +1340,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image, limit=MagickResourceInfinity; if (LocaleCompare(SvPV(sval,na),"unlimited") != 0) - limit=(MagickSizeType) InterpretLocaleInterval(SvPV(sval,na),100.0); + limit=(MagickSizeType) StringToDoubleInterval(SvPV(sval,na),100.0); (void) SetMagickResourceLimit(DiskResource,limit); break; } @@ -1505,9 +1505,9 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image, if (LocaleCompare(attribute,"fuzz") == 0) { if (info) - info->image_info->fuzz=InterpretLocaleInterval(SvPV(sval,na),QuantumRange); + info->image_info->fuzz=StringToDoubleInterval(SvPV(sval,na),QuantumRange); for ( ; image; image=image->next) - image->fuzz=InterpretLocaleInterval(SvPV(sval,na),QuantumRange); + image->fuzz=StringToDoubleInterval(SvPV(sval,na),QuantumRange); break; } if (info) @@ -1665,7 +1665,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image, limit=MagickResourceInfinity; if (LocaleCompare(SvPV(sval,na),"unlimited") != 0) - limit=(MagickSizeType) InterpretLocaleInterval(SvPV(sval,na),100.0); + limit=(MagickSizeType) StringToDoubleInterval(SvPV(sval,na),100.0); (void) SetMagickResourceLimit(MapResource,limit); break; } @@ -1712,7 +1712,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image, limit=MagickResourceInfinity; if (LocaleCompare(SvPV(sval,na),"unlimited") != 0) - limit=(MagickSizeType) InterpretLocaleInterval(SvPV(sval,na),100.0); + limit=(MagickSizeType) StringToDoubleInterval(SvPV(sval,na),100.0); (void) SetMagickResourceLimit(MemoryResource,limit); break; } @@ -2035,7 +2035,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image, limit=MagickResourceInfinity; if (LocaleCompare(SvPV(sval,na),"unlimited") != 0) - limit=(MagickSizeType) InterpretLocaleInterval(SvPV(sval,na),100.0); + limit=(MagickSizeType) StringToDoubleInterval(SvPV(sval,na),100.0); (void) SetMagickResourceLimit(ThreadResource,limit); break; } @@ -2060,7 +2060,7 @@ static void SetAttribute(pTHX_ struct PackageInfo *info,Image *image, limit=MagickResourceInfinity; if (LocaleCompare(SvPV(sval,na),"unlimited") != 0) - limit=(MagickSizeType) InterpretLocaleInterval(SvPV(sval,na),100.0); + limit=(MagickSizeType) StringToDoubleInterval(SvPV(sval,na),100.0); (void) SetMagickResourceLimit(TimeResource,limit); break; } @@ -3180,7 +3180,7 @@ Compare(ref,...) { if (LocaleCompare(attribute,"fuzz") == 0) { - image->fuzz=InterpretLocaleInterval(SvPV(ST(i),na),100.0); + image->fuzz=StringToDoubleInterval(SvPV(ST(i),na),100.0); break; } ThrowPerlException(exception,OptionError,"UnrecognizedAttribute", @@ -7623,7 +7623,7 @@ Mogrify(ref,...) geometry.y=argument_list[4].integer_reference; if (attribute_flag[5] != 0) image->fuzz= - InterpretLocaleInterval(argument_list[5].string_reference,QuantumRange); + StringToDoubleInterval(argument_list[5].string_reference,QuantumRange); image=CropImage(image,&geometry,exception); break; } @@ -8222,7 +8222,7 @@ Mogrify(ref,...) invert=MagickTrue; } if (attribute_flag[5] != 0) - image->fuzz=InterpretLocaleInterval(argument_list[5].string_reference, + image->fuzz=StringToDoubleInterval(argument_list[5].string_reference, QuantumRange); if (attribute_flag[6] != 0) invert=(MagickBooleanType) argument_list[6].integer_reference; @@ -8258,7 +8258,7 @@ Mogrify(ref,...) { if (compose != DissolveCompositeOp) (void) SetImageAlpha(composite_image,(Quantum) - InterpretLocaleInterval(argument_list[6].string_reference, + StringToDoubleInterval(argument_list[6].string_reference, QuantumRange),exception); else { @@ -8286,7 +8286,7 @@ Mogrify(ref,...) */ (void) CloneString(&image->geometry, argument_list[6].string_reference); - opacity=(Quantum) InterpretLocaleInterval( + opacity=(Quantum) StringToDoubleInterval( argument_list[6].string_reference,QuantumRange); if (composite_image->matte != MagickTrue) (void) SetImageAlpha(composite_image,OpaqueAlpha,exception); @@ -8727,7 +8727,7 @@ Mogrify(ref,...) (double) argument_list[4].real_reference); argument_list[0].string_reference=message; } - (void) GammaImage(image,InterpretLocaleValue( + (void) GammaImage(image,StringToDouble( argument_list[0].string_reference,(char **) NULL),exception); break; } @@ -8789,10 +8789,10 @@ Mogrify(ref,...) QueryColorCompliance(argument_list[4].string_reference, AllCompliance,&target,exception); if (attribute_flag[3] != 0) - target.alpha=InterpretLocaleInterval(argument_list[3].string_reference, + target.alpha=StringToDoubleInterval(argument_list[3].string_reference, QuantumRange); if (attribute_flag[5] != 0) - image->fuzz=InterpretLocaleInterval(argument_list[5].string_reference, + image->fuzz=StringToDoubleInterval(argument_list[5].string_reference, QuantumRange); invert=MagickFalse; if (attribute_flag[6] != 0) @@ -8887,7 +8887,7 @@ Mogrify(ref,...) (void) QueryColorCompliance(argument_list[1].string_reference, AllCompliance,&fill_color,exception); if (attribute_flag[2] != 0) - image->fuzz=InterpretLocaleInterval(argument_list[2].string_reference, + image->fuzz=StringToDoubleInterval(argument_list[2].string_reference, QuantumRange); if (attribute_flag[3] != 0) channel=(ChannelType) argument_list[3].integer_reference; @@ -9006,7 +9006,7 @@ Mogrify(ref,...) flags=ParseGeometry(argument_list[0].string_reference, &geometry_info); if (attribute_flag[1] != 0) - geometry_info.rho=InterpretLocaleInterval( + geometry_info.rho=StringToDoubleInterval( argument_list[1].string_reference,QuantumRange); (void) SolarizeImage(image,geometry_info.rho,exception); break; @@ -9059,10 +9059,10 @@ Mogrify(ref,...) AllCompliance,&target,exception); opacity=TransparentAlpha; if (attribute_flag[1] != 0) - opacity=InterpretLocaleInterval(argument_list[1].string_reference, + opacity=StringToDoubleInterval(argument_list[1].string_reference, QuantumRange); if (attribute_flag[2] != 0) - image->fuzz=InterpretLocaleInterval(argument_list[2].string_reference, + image->fuzz=StringToDoubleInterval(argument_list[2].string_reference, QuantumRange); if (attribute_flag[3] == 0) argument_list[3].integer_reference=0; @@ -9082,7 +9082,7 @@ Mogrify(ref,...) argument_list[0].string_reference="50%"; if (attribute_flag[1] != 0) channel=(ChannelType) argument_list[1].integer_reference; - threshold=InterpretLocaleInterval(argument_list[0].string_reference, + threshold=StringToDoubleInterval(argument_list[0].string_reference, QuantumRange); channel_mask=SetPixelChannelMask(image,channel); (void) BilevelImage(image,threshold,exception); @@ -9111,7 +9111,7 @@ Mogrify(ref,...) case 59: /* Trim */ { if (attribute_flag[0] != 0) - image->fuzz=InterpretLocaleInterval(argument_list[0].string_reference, + image->fuzz=StringToDoubleInterval(argument_list[0].string_reference, QuantumRange); image=TrimImage(image,exception); break; @@ -9247,7 +9247,7 @@ Mogrify(ref,...) if (attribute_flag[1] != 0) channel=(ChannelType) argument_list[1].integer_reference; if (attribute_flag[2] != 0) - image->bias=InterpretLocaleInterval(argument_list[2].string_reference, + image->bias=StringToDoubleInterval(argument_list[2].string_reference, QuantumRange); if (attribute_flag[3] != 0) { @@ -9600,7 +9600,7 @@ Mogrify(ref,...) goto PerlException; } if (attribute_flag[1] != 0) - image->fuzz=InterpretLocaleInterval(argument_list[1].string_reference, + image->fuzz=StringToDoubleInterval(argument_list[1].string_reference, QuantumRange); (void) IsImagesEqual(image,argument_list[0].image_reference, exception); @@ -9773,7 +9773,7 @@ Mogrify(ref,...) if (attribute_flag[4] != 0) geometry.y=argument_list[4].integer_reference; if (attribute_flag[5] != 0) - image->fuzz=InterpretLocaleInterval(argument_list[5].string_reference, + image->fuzz=StringToDoubleInterval(argument_list[5].string_reference, QuantumRange); if (attribute_flag[6] != 0) (void) QueryColorCompliance(argument_list[6].string_reference, @@ -9898,7 +9898,7 @@ Mogrify(ref,...) if (attribute_flag[4] != 0) geometry.y=argument_list[4].integer_reference; if (attribute_flag[5] != 0) - image->fuzz=InterpretLocaleInterval(argument_list[5].string_reference, + image->fuzz=StringToDoubleInterval(argument_list[5].string_reference, QuantumRange); if (attribute_flag[6] != 0) (void) QueryColorCompliance(argument_list[6].string_reference, @@ -10273,7 +10273,7 @@ Mogrify(ref,...) QueryColorCompliance(argument_list[4].string_reference, AllCompliance,&target,exception); if (attribute_flag[5] != 0) - image->fuzz=InterpretLocaleInterval(argument_list[5].string_reference, + image->fuzz=StringToDoubleInterval(argument_list[5].string_reference, QuantumRange); if (attribute_flag[6] != 0) channel=(ChannelType) argument_list[6].integer_reference; @@ -10392,7 +10392,7 @@ Mogrify(ref,...) flags=ParseGeometry(argument_list[0].string_reference, &geometry_info); if (attribute_flag[1] != 0) - geometry_info.rho=InterpretLocaleInterval( + geometry_info.rho=StringToDoubleInterval( argument_list[1].string_reference,QuantumRange); image=DeskewImage(image,geometry_info.rho,exception); break; diff --git a/coders/cin.c b/coders/cin.c index f7363df21..a0508e5bd 100644 --- a/coders/cin.c +++ b/coders/cin.c @@ -1078,12 +1078,12 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image, cin.origination.x_pitch=0.0f; value=GetCINProperty(image_info,image,"dpx:origination.x_pitch",exception); if (value != (const char *) NULL) - cin.origination.x_pitch=InterpretLocaleValue(value,(char **) NULL); + cin.origination.x_pitch=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,cin.origination.x_pitch); cin.origination.y_pitch=0.0f; value=GetCINProperty(image_info,image,"dpx:origination.y_pitch",exception); if (value != (const char *) NULL) - cin.origination.y_pitch=InterpretLocaleValue(value,(char **) NULL); + cin.origination.y_pitch=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,cin.origination.y_pitch); cin.origination.gamma=image->gamma; offset+=WriteBlobFloat(image,cin.origination.gamma); @@ -1131,7 +1131,7 @@ static MagickBooleanType WriteCINImage(const ImageInfo *image_info,Image *image, cin.film.frame_rate=0.0f; value=GetCINProperty(image_info,image,"dpx:film.frame_rate",exception); if (value != (const char *) NULL) - cin.film.frame_rate=InterpretLocaleValue(value,(char **) NULL); + cin.film.frame_rate=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,cin.film.frame_rate); value=GetCINProperty(image_info,image,"dpx:film.frame_id",exception); if (value != (const char *) NULL) diff --git a/coders/dpx.c b/coders/dpx.c index 2b72a197b..ad672c488 100644 --- a/coders/dpx.c +++ b/coders/dpx.c @@ -1541,12 +1541,12 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image, dpx.orientation.x_center=0.0f; value=GetDPXProperty(image_info,image,"dpx:orientation.x_center",exception); if (value != (const char *) NULL) - dpx.orientation.x_center=InterpretLocaleValue(value,(char **) NULL); + dpx.orientation.x_center=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,dpx.orientation.x_center); dpx.orientation.y_center=0.0f; value=GetDPXProperty(image_info,image,"dpx:orientation.y_center",exception); if (value != (const char *) NULL) - dpx.orientation.y_center=InterpretLocaleValue(value,(char **) NULL); + dpx.orientation.y_center=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,dpx.orientation.y_center); dpx.orientation.x_size=0U; value=GetDPXProperty(image_info,image,"dpx:orientation.x_size",exception); @@ -1663,12 +1663,12 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image, dpx.film.frame_rate=0.0f; value=GetDPXProperty(image_info,image,"dpx:film.frame_rate",exception); if (value != (const char *) NULL) - dpx.film.frame_rate=InterpretLocaleValue(value,(char **) NULL); + dpx.film.frame_rate=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,dpx.film.frame_rate); dpx.film.shutter_angle=0.0f; value=GetDPXProperty(image_info,image,"dpx:film.shutter_angle",exception); if (value != (const char *) NULL) - dpx.film.shutter_angle=InterpretLocaleValue(value,(char **) NULL); + dpx.film.shutter_angle=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,dpx.film.shutter_angle); *dpx.film.frame_id='\0'; value=GetDPXProperty(image_info,image,"dpx:film.frame_id",exception); @@ -1717,56 +1717,56 @@ static MagickBooleanType WriteDPXImage(const ImageInfo *image_info,Image *image, value=GetDPXProperty(image_info,image, "dpx:television.horizontal_sample_rate",exception); if (value != (const char *) NULL) - dpx.television.horizontal_sample_rate=InterpretLocaleValue(value, + dpx.television.horizontal_sample_rate=StringToDouble(value, (char **) NULL); offset+=WriteBlobFloat(image,dpx.television.horizontal_sample_rate); dpx.television.vertical_sample_rate=0.0f; value=GetDPXProperty(image_info,image,"dpx:television.vertical_sample_rate", exception); if (value != (const char *) NULL) - dpx.television.vertical_sample_rate=InterpretLocaleValue(value, + dpx.television.vertical_sample_rate=StringToDouble(value, (char **) NULL); offset+=WriteBlobFloat(image,dpx.television.vertical_sample_rate); dpx.television.frame_rate=0.0f; value=GetDPXProperty(image_info,image,"dpx:television.frame_rate",exception); if (value != (const char *) NULL) - dpx.television.frame_rate=InterpretLocaleValue(value,(char **) NULL); + dpx.television.frame_rate=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,dpx.television.frame_rate); dpx.television.time_offset=0.0f; value=GetDPXProperty(image_info,image,"dpx:television.time_offset",exception); if (value != (const char *) NULL) - dpx.television.time_offset=InterpretLocaleValue(value,(char **) NULL); + dpx.television.time_offset=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,dpx.television.time_offset); dpx.television.gamma=0.0f; value=GetDPXProperty(image_info,image,"dpx:television.gamma",exception); if (value != (const char *) NULL) - dpx.television.gamma=InterpretLocaleValue(value,(char **) NULL); + dpx.television.gamma=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,dpx.television.gamma); dpx.television.black_level=0.0f; value=GetDPXProperty(image_info,image,"dpx:television.black_level",exception); if (value != (const char *) NULL) - dpx.television.black_level=InterpretLocaleValue(value,(char **) NULL); + dpx.television.black_level=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,dpx.television.black_level); dpx.television.black_gain=0.0f; value=GetDPXProperty(image_info,image,"dpx:television.black_gain",exception); if (value != (const char *) NULL) - dpx.television.black_gain=InterpretLocaleValue(value,(char **) NULL); + dpx.television.black_gain=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,dpx.television.black_gain); dpx.television.break_point=0.0f; value=GetDPXProperty(image_info,image,"dpx:television.break_point",exception); if (value != (const char *) NULL) - dpx.television.break_point=InterpretLocaleValue(value,(char **) NULL); + dpx.television.break_point=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,dpx.television.break_point); dpx.television.white_level=0.0f; value=GetDPXProperty(image_info,image,"dpx:television.white_level",exception); if (value != (const char *) NULL) - dpx.television.white_level=InterpretLocaleValue(value,(char **) NULL); + dpx.television.white_level=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,dpx.television.white_level); dpx.television.integration_times=0.0f; value=GetDPXProperty(image_info,image,"dpx:television.integration_times", exception); if (value != (const char *) NULL) - dpx.television.integration_times=InterpretLocaleValue(value,(char **) NULL); + dpx.television.integration_times=StringToDouble(value,(char **) NULL); offset+=WriteBlobFloat(image,dpx.television.integration_times); offset+=WriteBlob(image,sizeof(dpx.television.reserve),(unsigned char *) dpx.television.reserve); diff --git a/coders/fits.c b/coders/fits.c index dcea2e380..b631f7575 100644 --- a/coders/fits.c +++ b/coders/fits.c @@ -359,13 +359,13 @@ static Image *ReadFITSImage(const ImageInfo *image_info, if (LocaleCompare(keyword,"naxis3") == 0) fits_info.number_planes=StringToLong(p); if (LocaleCompare(keyword,"datamax") == 0) - fits_info.max_data=InterpretLocaleValue(p,(char **) NULL); + fits_info.max_data=StringToDouble(p,(char **) NULL); if (LocaleCompare(keyword,"datamin") == 0) - fits_info.min_data=InterpretLocaleValue(p,(char **) NULL); + fits_info.min_data=StringToDouble(p,(char **) NULL); if (LocaleCompare(keyword,"bzero") == 0) - fits_info.zero=InterpretLocaleValue(p,(char **) NULL); + fits_info.zero=StringToDouble(p,(char **) NULL); if (LocaleCompare(keyword,"bscale") == 0) - fits_info.scale=InterpretLocaleValue(p,(char **) NULL); + fits_info.scale=StringToDouble(p,(char **) NULL); if (LocaleCompare(keyword,"comment") == 0) { if (comment == (char *) NULL) diff --git a/coders/hdr.c b/coders/hdr.c index 3bed84af4..50b78f944 100644 --- a/coders/hdr.c +++ b/coders/hdr.c @@ -303,7 +303,7 @@ static Image *ReadHDRImage(const ImageInfo *image_info,ExceptionInfo *exception) { if (LocaleCompare(keyword,"gamma") == 0) { - image->gamma=InterpretLocaleValue(value,(char **) NULL); + image->gamma=StringToDouble(value,(char **) NULL); break; } (void) FormatLocaleString(tag,MaxTextExtent,"hdr:%s",keyword); diff --git a/coders/jbig.c b/coders/jbig.c index 751a6f1ec..84ba43dd5 100644 --- a/coders/jbig.c +++ b/coders/jbig.c @@ -438,7 +438,7 @@ static MagickBooleanType WriteJBIGImage(const ImageInfo *image_info, status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); if (status == MagickFalse) return(status); - version=InterpretLocaleValue(JBG_VERSION,(char **) NULL); + version=StringToDouble(JBG_VERSION,(char **) NULL); scene=0; do { diff --git a/coders/jpeg.c b/coders/jpeg.c index 65549e51f..18d630e55 100644 --- a/coders/jpeg.c +++ b/coders/jpeg.c @@ -1991,7 +1991,7 @@ static MagickBooleanType WriteJPEGImage(const ImageInfo *image_info, Search for compression quality that does not exceed image extent. */ jpeg_info->quality=0; - extent=(MagickSizeType) InterpretLocaleInterval(option,100.0); + extent=(MagickSizeType) StringToDoubleInterval(option,100.0); (void) DeleteImageOption(jpeg_info,"jpeg:extent"); (void) AcquireUniqueFilename(jpeg_image->filename); maximum=101; diff --git a/coders/miff.c b/coders/miff.c index d0f4ed2a0..f3b28773c 100644 --- a/coders/miff.c +++ b/coders/miff.c @@ -735,7 +735,7 @@ static Image *ReadMIFFImage(const ImageInfo *image_info, { if (LocaleCompare(keyword,"gamma") == 0) { - image->gamma=InterpretLocaleValue(options,(char **) NULL); + image->gamma=StringToDouble(options,(char **) NULL); break; } if (LocaleCompare(keyword,"gravity") == 0) @@ -1006,7 +1006,7 @@ static Image *ReadMIFFImage(const ImageInfo *image_info, { if (LocaleCompare(keyword,"version") == 0) { - version=InterpretLocaleValue(options,(char **) NULL); + version=StringToDouble(options,(char **) NULL); break; } (void) SetImageProperty(image,keyword,options,exception); diff --git a/coders/mpc.c b/coders/mpc.c index 628eb5fcc..c10861bda 100644 --- a/coders/mpc.c +++ b/coders/mpc.c @@ -444,7 +444,7 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) } if (LocaleCompare(keyword,"error") == 0) { - image->error.mean_error_per_pixel=InterpretLocaleValue( + image->error.mean_error_per_pixel=StringToDouble( options,(char **) NULL); break; } @@ -456,7 +456,7 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) { if (LocaleCompare(keyword,"gamma") == 0) { - image->gamma=InterpretLocaleValue(options,(char **) NULL); + image->gamma=StringToDouble(options,(char **) NULL); break; } if (LocaleCompare(keyword,"green-primary") == 0) @@ -512,12 +512,12 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception) if (LocaleCompare(keyword,"maximum-error") == 0) { image->error.normalized_maximum_error= - InterpretLocaleValue(options,(char **) NULL); + StringToDouble(options,(char **) NULL); break; } if (LocaleCompare(keyword,"mean-error") == 0) { - image->error.normalized_mean_error=InterpretLocaleValue( + image->error.normalized_mean_error=StringToDouble( options,(char **) NULL); break; } diff --git a/coders/msl.c b/coders/msl.c index b9de76ee8..1002fe973 100644 --- a/coders/msl.c +++ b/coders/msl.c @@ -790,22 +790,22 @@ static void MSLStartElement(void *context,const xmlChar *tag, *p; p=value; - draw_info->affine.sx=InterpretLocaleValue(p,&p); + draw_info->affine.sx=StringToDouble(p,&p); if (*p ==',') p++; - draw_info->affine.rx=InterpretLocaleValue(p,&p); + draw_info->affine.rx=StringToDouble(p,&p); if (*p ==',') p++; - draw_info->affine.ry=InterpretLocaleValue(p,&p); + draw_info->affine.ry=StringToDouble(p,&p); if (*p ==',') p++; - draw_info->affine.sy=InterpretLocaleValue(p,&p); + draw_info->affine.sy=StringToDouble(p,&p); if (*p ==',') p++; - draw_info->affine.tx=InterpretLocaleValue(p,&p); + draw_info->affine.tx=StringToDouble(p,&p); if (*p ==',') p++; - draw_info->affine.ty=InterpretLocaleValue(p,&p); + draw_info->affine.ty=StringToDouble(p,&p); break; } if (LocaleCompare(keyword,"align") == 0) @@ -908,7 +908,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"pointsize") == 0) { - draw_info->pointsize=InterpretLocaleValue(value, + draw_info->pointsize=StringToDouble(value, (char **) NULL); break; } @@ -921,7 +921,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"rotate") == 0) { - angle=InterpretLocaleValue(value,(char **) NULL); + angle=StringToDouble(value,(char **) NULL); affine.sx=cos(DegreesToRadians(fmod(angle,360.0))); affine.rx=sin(DegreesToRadians(fmod(angle,360.0))); affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0)))); @@ -946,14 +946,14 @@ static void MSLStartElement(void *context,const xmlChar *tag, } if (LocaleCompare(keyword,"skewX") == 0) { - angle=InterpretLocaleValue(value,(char **) NULL); + angle=StringToDouble(value,(char **) NULL); affine.ry=tan(DegreesToRadians(fmod((double) angle, 360.0))); break; } if (LocaleCompare(keyword,"skewY") == 0) { - angle=InterpretLocaleValue(value,(char **) NULL); + angle=StringToDouble(value,(char **) NULL); affine.rx=tan(DegreesToRadians(fmod((double) angle, 360.0))); break; @@ -1211,7 +1211,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"radius") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } @@ -1467,7 +1467,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword, "bias") == 0) { - bias = InterpretLocaleValue(value,(char **) NULL); + bias = StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword); @@ -1478,7 +1478,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword, "radius") == 0) { - radius = InterpretLocaleValue(value,(char **) NULL); + radius = StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword); @@ -1680,7 +1680,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, } if (LocaleCompare(keyword,"fuzz") == 0) { - msl_info->image[n]->fuzz=InterpretLocaleValue(value, + msl_info->image[n]->fuzz=StringToDouble(value, (char **) NULL); break; } @@ -1994,7 +1994,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, if (LocaleCompare(keyword,"rotate") == 0) { rotate_image=RotateImage(composite_image, - InterpretLocaleValue(value,(char **) NULL),&exception); + StringToDouble(value,(char **) NULL),&exception); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute", @@ -2412,22 +2412,22 @@ static void MSLStartElement(void *context,const xmlChar *tag, *p; p=value; - draw_info->affine.sx=InterpretLocaleValue(p,&p); + draw_info->affine.sx=StringToDouble(p,&p); if (*p ==',') p++; - draw_info->affine.rx=InterpretLocaleValue(p,&p); + draw_info->affine.rx=StringToDouble(p,&p); if (*p ==',') p++; - draw_info->affine.ry=InterpretLocaleValue(p,&p); + draw_info->affine.ry=StringToDouble(p,&p); if (*p ==',') p++; - draw_info->affine.sy=InterpretLocaleValue(p,&p); + draw_info->affine.sy=StringToDouble(p,&p); if (*p ==',') p++; - draw_info->affine.tx=InterpretLocaleValue(p,&p); + draw_info->affine.tx=StringToDouble(p,&p); if (*p ==',') p++; - draw_info->affine.ty=InterpretLocaleValue(p,&p); + draw_info->affine.ty=StringToDouble(p,&p); break; } if (LocaleCompare(keyword,"align") == 0) @@ -2537,7 +2537,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, } if (LocaleCompare(keyword,"pointsize") == 0) { - draw_info->pointsize=InterpretLocaleValue(value, + draw_info->pointsize=StringToDouble(value, (char **) NULL); break; } @@ -2550,7 +2550,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"rotate") == 0) { - angle=InterpretLocaleValue(value,(char **) NULL); + angle=StringToDouble(value,(char **) NULL); affine.sx=cos(DegreesToRadians(fmod(angle,360.0))); affine.rx=sin(DegreesToRadians(fmod(angle,360.0))); affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0)))); @@ -2575,13 +2575,13 @@ static void MSLStartElement(void *context,const xmlChar *tag, } if (LocaleCompare(keyword,"skewX") == 0) { - angle=InterpretLocaleValue(value,(char **) NULL); + angle=StringToDouble(value,(char **) NULL); affine.ry=cos(DegreesToRadians(fmod(angle,360.0))); break; } if (LocaleCompare(keyword,"skewY") == 0) { - angle=InterpretLocaleValue(value,(char **) NULL); + angle=StringToDouble(value,(char **) NULL); affine.rx=cos(DegreesToRadians(fmod(angle,360.0))); break; } @@ -2762,7 +2762,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"radius") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } @@ -2829,7 +2829,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"radius") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } @@ -3211,7 +3211,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"blue") == 0) { - pixel.blue=InterpretLocaleValue(value,(char **) NULL); + pixel.blue=StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute", @@ -3244,7 +3244,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, } if (LocaleCompare(keyword,"green") == 0) { - pixel.green=InterpretLocaleValue(value,(char **) NULL); + pixel.green=StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute", @@ -3256,7 +3256,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"red") == 0) { - pixel.red=InterpretLocaleValue(value,(char **) NULL); + pixel.red=StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute", @@ -3430,7 +3430,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"amount") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } @@ -3500,7 +3500,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"black") == 0) { - levelBlack = InterpretLocaleValue(value,(char **) NULL); + levelBlack = StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword); @@ -3511,7 +3511,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"gamma") == 0) { - levelGamma = InterpretLocaleValue(value,(char **) NULL); + levelGamma = StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword); @@ -3522,7 +3522,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"white") == 0) { - levelWhite = InterpretLocaleValue(value,(char **) NULL); + levelWhite = StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword); @@ -3715,7 +3715,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"fuzz") == 0) { - msl_info->image[n]->fuzz=InterpretLocaleValue(value, + msl_info->image[n]->fuzz=StringToDouble(value, (char **) NULL); break; } @@ -3746,7 +3746,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"opacity") == 0) { - opacity=InterpretLocaleValue(value,(char **) NULL); + opacity=StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute", @@ -3845,7 +3845,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"radius") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } @@ -3936,13 +3936,13 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"blackness") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } if (LocaleCompare(keyword,"brightness") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } @@ -3967,7 +3967,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"hue") == 0) { - geometry_info.xi=InterpretLocaleValue(value, + geometry_info.xi=StringToDouble(value, (char **) NULL); break; } @@ -3980,7 +3980,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"lightness") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } @@ -3993,7 +3993,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"saturation") == 0) { - geometry_info.sigma=InterpretLocaleValue(value, + geometry_info.sigma=StringToDouble(value, (char **) NULL); break; } @@ -4006,7 +4006,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"whiteness") == 0) { - geometry_info.sigma=InterpretLocaleValue(value, + geometry_info.sigma=StringToDouble(value, (char **) NULL); break; } @@ -4202,7 +4202,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"radius") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } @@ -4282,7 +4282,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, } if (LocaleCompare(keyword,"fuzz") == 0) { - msl_info->image[n]->fuzz=InterpretLocaleValue(value, + msl_info->image[n]->fuzz=StringToDouble(value, (char **) NULL); break; } @@ -4591,22 +4591,22 @@ static void MSLStartElement(void *context,const xmlChar *tag, *p; p=value; - draw_info->affine.sx=InterpretLocaleValue(p,&p); + draw_info->affine.sx=StringToDouble(p,&p); if (*p ==',') p++; - draw_info->affine.rx=InterpretLocaleValue(p,&p); + draw_info->affine.rx=StringToDouble(p,&p); if (*p ==',') p++; - draw_info->affine.ry=InterpretLocaleValue(p,&p); + draw_info->affine.ry=StringToDouble(p,&p); if (*p ==',') p++; - draw_info->affine.sy=InterpretLocaleValue(p,&p); + draw_info->affine.sy=StringToDouble(p,&p); if (*p ==',') p++; - draw_info->affine.tx=InterpretLocaleValue(p,&p); + draw_info->affine.tx=StringToDouble(p,&p); if (*p ==',') p++; - draw_info->affine.ty=InterpretLocaleValue(p,&p); + draw_info->affine.ty=StringToDouble(p,&p); break; } if (LocaleCompare(keyword,"align") == 0) @@ -4711,7 +4711,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"pointsize") == 0) { - draw_info->pointsize=InterpretLocaleValue(value, + draw_info->pointsize=StringToDouble(value, (char **) NULL); break; } @@ -4724,7 +4724,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"rotate") == 0) { - angle=InterpretLocaleValue(value,(char **) NULL); + angle=StringToDouble(value,(char **) NULL); affine.sx=cos(DegreesToRadians(fmod(angle,360.0))); affine.rx=sin(DegreesToRadians(fmod(angle,360.0))); affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0)))); @@ -4749,13 +4749,13 @@ static void MSLStartElement(void *context,const xmlChar *tag, } if (LocaleCompare(keyword,"skewX") == 0) { - angle=InterpretLocaleValue(value,(char **) NULL); + angle=StringToDouble(value,(char **) NULL); affine.ry=cos(DegreesToRadians(fmod(angle,360.0))); break; } if (LocaleCompare(keyword,"skewY") == 0) { - angle=InterpretLocaleValue(value,(char **) NULL); + angle=StringToDouble(value,(char **) NULL); affine.rx=cos(DegreesToRadians(fmod(angle,360.0))); break; } @@ -5104,7 +5104,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"radius") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } @@ -5283,7 +5283,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"blur") == 0) { - msl_info->image[n]->blur=InterpretLocaleValue(value, + msl_info->image[n]->blur=StringToDouble(value, (char **) NULL); break; } @@ -5313,7 +5313,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"x-resolution") == 0) { - x_resolution=InterpretLocaleValue(value,(char **) NULL); + x_resolution=StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword); @@ -5324,7 +5324,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"y-resolution") == 0) { - y_resolution=InterpretLocaleValue(value,(char **) NULL); + y_resolution=StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword); @@ -5445,7 +5445,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"support") == 0) { - blur=InterpretLocaleValue(value,(char **) NULL); + blur=StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute", @@ -5668,7 +5668,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"degrees") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } @@ -5731,7 +5731,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"degrees") == 0) { - degrees = InterpretLocaleValue(value,(char **) NULL); + degrees = StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword); @@ -5956,7 +5956,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"cluster-threshold") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } @@ -5993,7 +5993,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"smoothing-threshold") == 0) { - geometry_info.sigma=InterpretLocaleValue(value, + geometry_info.sigma=StringToDouble(value, (char **) NULL); break; } @@ -6212,7 +6212,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"azimuth") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } @@ -6225,7 +6225,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"elevation") == 0) { - geometry_info.sigma=InterpretLocaleValue(value, + geometry_info.sigma=StringToDouble(value, (char **) NULL); break; } @@ -6338,7 +6338,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"x") == 0) { - geometry_info.xi=InterpretLocaleValue(value, + geometry_info.xi=StringToDouble(value, (char **) NULL); break; } @@ -6404,7 +6404,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword, "bias") == 0) { - bias = InterpretLocaleValue(value,(char **) NULL); + bias = StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword); @@ -6415,7 +6415,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword, "radius") == 0) { - radius = InterpretLocaleValue(value,(char **) NULL); + radius = StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword); @@ -6600,7 +6600,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"x") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } @@ -6707,7 +6707,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"threshold") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } @@ -6770,7 +6770,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"radius") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } @@ -7023,7 +7023,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"degrees") == 0) { - geometry_info.rho=InterpretLocaleValue(value, + geometry_info.rho=StringToDouble(value, (char **) NULL); break; } @@ -7180,7 +7180,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, { if (LocaleCompare(keyword,"threshold") == 0) { - threshold = InterpretLocaleValue(value,(char **) NULL); + threshold = StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword); @@ -8000,7 +8000,7 @@ static MagickBooleanType SetMSLAttributes(MSLInfo *msl_info,const char *keyword, limit=MagickResourceInfinity; if (LocaleCompare(value,"unlimited") != 0) - limit=(MagickSizeType) InterpretLocaleInterval(value,100.0); + limit=(MagickSizeType) StringToDoubleInterval(value,100.0); (void) SetMagickResourceLimit(AreaResource,limit); break; } @@ -8030,7 +8030,7 @@ static MagickBooleanType SetMSLAttributes(MSLInfo *msl_info,const char *keyword, { if (image == (Image *) NULL) break; - image->bias=InterpretLocaleInterval(value,QuantumRange); + image->bias=StringToDoubleInterval(value,QuantumRange); break; } if (LocaleCompare(keyword,"blue-primary") == 0) @@ -8134,8 +8134,8 @@ static MagickBooleanType SetMSLAttributes(MSLInfo *msl_info,const char *keyword, { if (LocaleCompare(keyword,"pointsize") == 0) { - image_info->pointsize=InterpretLocaleValue(value,(char **) NULL); - draw_info->pointsize=InterpretLocaleValue(value,(char **) NULL); + image_info->pointsize=StringToDouble(value,(char **) NULL); + draw_info->pointsize=StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,"UnrecognizedAttribute",keyword); diff --git a/coders/pnm.c b/coders/pnm.c index 5b715547e..769c12203 100644 --- a/coders/pnm.c +++ b/coders/pnm.c @@ -307,7 +307,7 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception) scale[MaxTextExtent]; (void) ReadBlobString(image,scale); - quantum_scale=InterpretLocaleValue(scale,(char **) NULL); + quantum_scale=StringToDouble(scale,(char **) NULL); } else { diff --git a/coders/sct.c b/coders/sct.c index 2bba14535..bf85500f7 100644 --- a/coders/sct.c +++ b/coders/sct.c @@ -202,9 +202,9 @@ static Image *ReadSCTImage(const ImageInfo *image_info,ExceptionInfo *exception) separations_mask=ReadBlobMSBShort(image); count=ReadBlob(image,14,buffer); buffer[14]='\0'; - height=InterpretLocaleValue((char *) buffer,(char **) NULL); + height=StringToDouble((char *) buffer,(char **) NULL); count=ReadBlob(image,14,buffer); - width=InterpretLocaleValue((char *) buffer,(char **) NULL); + width=StringToDouble((char *) buffer,(char **) NULL); count=ReadBlob(image,12,buffer); buffer[12]='\0'; image->rows=StringToUnsignedLong((char *) buffer); diff --git a/coders/svg.c b/coders/svg.c index 4378ec243..89d018132 100644 --- a/coders/svg.c +++ b/coders/svg.c @@ -297,7 +297,7 @@ static double GetUserSpaceCoordinateValue(const SVGInfo *svg_info,int type, assert(string != (const char *) NULL); p=(const char *) string; GetMagickToken(p,&p,token); - value=InterpretLocaleValue(token,(char **) NULL); + value=StringToDouble(token,(char **) NULL); if (strchr(token,'%') != (char *) NULL) { double @@ -1302,27 +1302,27 @@ static void SVGStartElement(void *context,const xmlChar *name, { p=(const char *) value; GetMagickToken(p,&p,token); - affine.sx=InterpretLocaleValue(value,(char **) NULL); + affine.sx=StringToDouble(value,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - affine.rx=InterpretLocaleValue(token,(char **) NULL); + affine.rx=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - affine.ry=InterpretLocaleValue(token,(char **) NULL); + affine.ry=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - affine.sy=InterpretLocaleValue(token,(char **) NULL); + affine.sy=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - affine.tx=InterpretLocaleValue(token,(char **) NULL); + affine.tx=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - affine.ty=InterpretLocaleValue(token,(char **) NULL); + affine.ty=StringToDouble(token,(char **) NULL); break; } break; @@ -1919,27 +1919,27 @@ static void SVGStartElement(void *context,const xmlChar *name, { p=(const char *) value; GetMagickToken(p,&p,token); - affine.sx=InterpretLocaleValue(value,(char **) NULL); + affine.sx=StringToDouble(value,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - affine.rx=InterpretLocaleValue(token,(char **) NULL); + affine.rx=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - affine.ry=InterpretLocaleValue(token,(char **) NULL); + affine.ry=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - affine.sy=InterpretLocaleValue(token,(char **) NULL); + affine.sy=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - affine.tx=InterpretLocaleValue(token,(char **) NULL); + affine.tx=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - affine.ty=InterpretLocaleValue(token,(char **) NULL); + affine.ty=StringToDouble(token,(char **) NULL); break; } break; @@ -1956,15 +1956,15 @@ static void SVGStartElement(void *context,const xmlChar *name, p=(const char *) value; GetMagickToken(p,&p,token); - angle=InterpretLocaleValue(value,(char **) NULL); + angle=StringToDouble(value,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - x=InterpretLocaleValue(token,(char **) NULL); + x=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - y=InterpretLocaleValue(token,(char **) NULL); + y=StringToDouble(token,(char **) NULL); affine.sx=cos(DegreesToRadians(fmod(angle,360.0))); affine.rx=sin(DegreesToRadians(fmod(angle,360.0))); affine.ry=(-sin(DegreesToRadians(fmod(angle,360.0)))); @@ -2066,22 +2066,22 @@ static void SVGStartElement(void *context,const xmlChar *name, { p=(const char *) value; GetMagickToken(p,&p,token); - svg_info->view_box.x=InterpretLocaleValue(token,(char **) NULL); + svg_info->view_box.x=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - svg_info->view_box.y=InterpretLocaleValue(token,(char **) NULL); + svg_info->view_box.y=StringToDouble(token,(char **) NULL); GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - svg_info->view_box.width=InterpretLocaleValue(token, + svg_info->view_box.width=StringToDouble(token, (char **) NULL); if (svg_info->bounds.width == 0) svg_info->bounds.width=svg_info->view_box.width; GetMagickToken(p,&p,token); if (*token == ',') GetMagickToken(p,&p,token); - svg_info->view_box.height=InterpretLocaleValue(token, + svg_info->view_box.height=StringToDouble(token, (char **) NULL); if (svg_info->bounds.height == 0) svg_info->bounds.height=svg_info->view_box.height; @@ -3561,34 +3561,34 @@ static MagickBooleanType WriteSVGImage(const ImageInfo *image_info,Image *image, if (LocaleCompare("affine",keyword) == 0) { GetMagickToken(q,&q,token); - affine.sx=InterpretLocaleValue(token,(char **) NULL); + affine.sx=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - affine.rx=InterpretLocaleValue(token,(char **) NULL); + affine.rx=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - affine.ry=InterpretLocaleValue(token,(char **) NULL); + affine.ry=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - affine.sy=InterpretLocaleValue(token,(char **) NULL); + affine.sy=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - affine.tx=InterpretLocaleValue(token,(char **) NULL); + affine.tx=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - affine.ty=InterpretLocaleValue(token,(char **) NULL); + affine.ty=StringToDouble(token,(char **) NULL); break; } if (LocaleCompare("angle",keyword) == 0) { GetMagickToken(q,&q,token); - affine.rx=InterpretLocaleValue(token,(char **) NULL); - affine.ry=InterpretLocaleValue(token,(char **) NULL); + affine.rx=StringToDouble(token,(char **) NULL); + affine.ry=StringToDouble(token,(char **) NULL); break; } if (LocaleCompare("arc",keyword) == 0) @@ -3903,24 +3903,24 @@ static MagickBooleanType WriteSVGImage(const ImageInfo *image_info,Image *image, GetMagickToken(q,&q,token); (void) CopyMagickString(type,token,MaxTextExtent); GetMagickToken(q,&q,token); - svg_info.segment.x1=InterpretLocaleValue(token,(char **) NULL); - svg_info.element.cx=InterpretLocaleValue(token,(char **) NULL); + svg_info.segment.x1=StringToDouble(token,(char **) NULL); + svg_info.element.cx=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - svg_info.segment.y1=InterpretLocaleValue(token,(char **) NULL); - svg_info.element.cy=InterpretLocaleValue(token,(char **) NULL); + svg_info.segment.y1=StringToDouble(token,(char **) NULL); + svg_info.element.cy=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - svg_info.segment.x2=InterpretLocaleValue(token,(char **) NULL); - svg_info.element.major=InterpretLocaleValue(token, + svg_info.segment.x2=StringToDouble(token,(char **) NULL); + svg_info.element.major=StringToDouble(token, (char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - svg_info.segment.y2=InterpretLocaleValue(token,(char **) NULL); - svg_info.element.minor=InterpretLocaleValue(token, + svg_info.segment.y2=StringToDouble(token,(char **) NULL); + svg_info.element.minor=StringToDouble(token, (char **) NULL); (void) FormatLocaleString(message,MaxTextExtent, "<%sGradient id=\"%s\" x1=\"%g\" y1=\"%g\" x2=\"%g\" " @@ -3931,7 +3931,7 @@ static MagickBooleanType WriteSVGImage(const ImageInfo *image_info,Image *image, GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - svg_info.element.angle=InterpretLocaleValue(token, + svg_info.element.angle=StringToDouble(token, (char **) NULL); (void) FormatLocaleString(message,MaxTextExtent, "<%sGradient id=\"%s\" cx=\"%g\" cy=\"%g\" r=\"%g\" " @@ -3959,20 +3959,20 @@ static MagickBooleanType WriteSVGImage(const ImageInfo *image_info,Image *image, GetMagickToken(q,&q,token); (void) CopyMagickString(name,token,MaxTextExtent); GetMagickToken(q,&q,token); - svg_info.bounds.x=InterpretLocaleValue(token,(char **) NULL); + svg_info.bounds.x=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - svg_info.bounds.y=InterpretLocaleValue(token,(char **) NULL); + svg_info.bounds.y=StringToDouble(token,(char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - svg_info.bounds.width=InterpretLocaleValue(token, + svg_info.bounds.width=StringToDouble(token, (char **) NULL); GetMagickToken(q,&q,token); if (*token == ',') GetMagickToken(q,&q,token); - svg_info.bounds.height=InterpretLocaleValue(token, + svg_info.bounds.height=StringToDouble(token, (char **) NULL); (void) FormatLocaleString(message,MaxTextExtent, "