Commit 9b3ca35e2 for imagemagick.org
commit 9b3ca35e268a9355fe30a5c0bb7865a1e83f732c
Author: Cristy <urban-warrior@imagemagick.org>
Date: Sun May 17 19:30:37 2026 -0400
revert
diff --git a/MagickCore/draw.c b/MagickCore/draw.c
index a2162f6b3..12de6fba9 100644
--- a/MagickCore/draw.c
+++ b/MagickCore/draw.c
@@ -2453,28 +2453,7 @@ static SplayTreeInfo *GetMVGMacros(const char *primitive)
return(macros);
}
-static inline MagickBooleanType IsValidListChar(int c)
-{
- if ((c >= '0') && (c <= '9'))
- return(MagickTrue);
- switch (c)
- {
- case '.':
- case '+':
- case '-':
- case ',':
- case ' ':
- case '\t':
- case '\r':
- case '\n':
- break;
- default:
- return(MagickFalse);
- }
- return(MagickTrue);
-}
-
-static inline MagickBooleanType IsValidPoint(const char *point)
+static inline MagickBooleanType IsPoint(const char *point)
{
char
*p;
@@ -2687,45 +2666,30 @@ static MagickBooleanType RenderMVGContent(Image *image,
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
affine.ry=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
affine.rx=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
affine.sy=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
affine.tx=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
affine.ty=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
@@ -3202,7 +3166,7 @@ static MagickBooleanType RenderMVGContent(Image *image,
if (LocaleCompare("letter-spacing",keyword) == 0)
{
(void) GetNextToken(q,&q,extent,token);
- if (IsValidPoint(token) == MagickFalse)
+ if (IsPoint(token) == MagickFalse)
break;
clone_info=CloneDrawInfo((ImageInfo *) NULL,graphic_context[n]);
clone_info->text=AcquireString(" ");
@@ -3286,8 +3250,7 @@ static MagickBooleanType RenderMVGContent(Image *image,
if (graphic_context[n]->fill.alpha != (double) TransparentAlpha)
{
graphic_context[n]->fill.alpha=graphic_context[n]->fill_alpha;
- graphic_context[n]->stroke.alpha=
- graphic_context[n]->stroke_alpha;
+ graphic_context[n]->stroke.alpha=graphic_context[n]->stroke_alpha;
}
else
{
@@ -3450,27 +3413,18 @@ static MagickBooleanType RenderMVGContent(Image *image,
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
segment.y1=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
segment.x2=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
segment.y2=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
@@ -3479,9 +3433,6 @@ static MagickBooleanType RenderMVGContent(Image *image,
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
}
for (p=q; *q != '\0'; )
{
@@ -3582,9 +3533,6 @@ static MagickBooleanType RenderMVGContent(Image *image,
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
region.y=CastDoubleToSsizeT(ceil(GetDrawValue(token,
&next_token)-0.5));
if (token == next_token)
@@ -3592,9 +3540,6 @@ static MagickBooleanType RenderMVGContent(Image *image,
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
region.width=CastDoubleToSizeT(floor(GetDrawValue(token,
&next_token)+0.5));
if (token == next_token)
@@ -3602,9 +3547,6 @@ static MagickBooleanType RenderMVGContent(Image *image,
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
region.height=CastDoubleToSizeT(GetDrawValue(token,
&next_token)+0.5);
if (token == next_token)
@@ -3691,9 +3633,6 @@ static MagickBooleanType RenderMVGContent(Image *image,
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
affine.sy=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
@@ -3790,7 +3729,7 @@ static MagickBooleanType RenderMVGContent(Image *image,
if (graphic_context[n]->dash_pattern != (double *) NULL)
graphic_context[n]->dash_pattern=(double *)
RelinquishMagickMemory(graphic_context[n]->dash_pattern);
- if (IsValidPoint(q) != MagickFalse)
+ if (IsPoint(q) != MagickFalse)
{
const char
*r;
@@ -3799,17 +3738,11 @@ static MagickBooleanType RenderMVGContent(Image *image,
(void) GetNextToken(r,&r,extent,token);
if (*token == ',')
(void) GetNextToken(r,&r,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
- for (x=0; IsValidPoint(token) != MagickFalse; x++)
+ for (x=0; IsPoint(token) != MagickFalse; x++)
{
(void) GetNextToken(r,&r,extent,token);
if (*token == ',')
(void) GetNextToken(r,&r,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
}
graphic_context[n]->dash_pattern=(double *)
AcquireQuantumMemory((size_t) (2*x+2),
@@ -3829,9 +3762,6 @@ static MagickBooleanType RenderMVGContent(Image *image,
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
graphic_context[n]->dash_pattern[j]=GetDrawValue(token,
&next_token);
if (token == next_token)
@@ -3995,9 +3925,6 @@ static MagickBooleanType RenderMVGContent(Image *image,
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
affine.ty=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
@@ -4045,9 +3972,6 @@ static MagickBooleanType RenderMVGContent(Image *image,
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
graphic_context[n]->viewbox.y=CastDoubleToSsizeT(
ceil(GetDrawValue(token,&next_token)-0.5));
if (token == next_token)
@@ -4055,9 +3979,6 @@ static MagickBooleanType RenderMVGContent(Image *image,
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
graphic_context[n]->viewbox.width=CastDoubleToSizeT(floor(
GetDrawValue(token,&next_token)+0.5));
if (token == next_token)
@@ -4065,9 +3986,6 @@ static MagickBooleanType RenderMVGContent(Image *image,
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
graphic_context[n]->viewbox.height=CastDoubleToSizeT(floor(
GetDrawValue(token,&next_token)+0.5));
if (token == next_token)
@@ -4157,7 +4075,7 @@ static MagickBooleanType RenderMVGContent(Image *image,
/*
Define points.
*/
- if (IsValidPoint(q) == MagickFalse)
+ if (IsPoint(q) == MagickFalse)
break;
(void) GetNextToken(q,&q,extent,token);
point.x=GetDrawValue(token,&next_token);
@@ -4166,9 +4084,6 @@ static MagickBooleanType RenderMVGContent(Image *image,
(void) GetNextToken(q,&q,extent,token);
if (*token == ',')
(void) GetNextToken(q,&q,extent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
point.y=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
@@ -6780,64 +6695,40 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
arc.x=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
arc.y=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
angle=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
large_arc=StringToLong(token) != 0 ? MagickTrue : MagickFalse;
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
sweep=StringToLong(token) != 0 ? MagickTrue : MagickFalse;
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
x=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
y=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
@@ -6853,7 +6744,7 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
p++;
if (*p == ',')
p++;
- } while (IsValidPoint(p) != MagickFalse);
+ } while (IsPoint(p) != MagickFalse);
break;
}
case 'c':
@@ -6870,18 +6761,12 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
x=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
y=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
@@ -6901,7 +6786,7 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
p++;
if (*p == ',')
p++;
- } while (IsValidPoint(p) != MagickFalse);
+ } while (IsPoint(p) != MagickFalse);
break;
}
case 'H':
@@ -6912,9 +6797,6 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
x=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
@@ -6930,7 +6812,7 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
p++;
if (*p == ',')
p++;
- } while (IsValidPoint(p) != MagickFalse);
+ } while (IsPoint(p) != MagickFalse);
break;
}
case 'l':
@@ -6944,18 +6826,12 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
x=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
y=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
@@ -6972,7 +6848,7 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
p++;
if (*p == ',')
p++;
- } while (IsValidPoint(p) != MagickFalse);
+ } while (IsPoint(p) != MagickFalse);
break;
}
case 'M':
@@ -6995,18 +6871,12 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
x=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
y=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
@@ -7026,7 +6896,7 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
p++;
if (*p == ',')
p++;
- } while (IsValidPoint(p) != MagickFalse);
+ } while (IsPoint(p) != MagickFalse);
break;
}
case 'q':
@@ -7043,18 +6913,12 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
x=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
y=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
@@ -7076,7 +6940,7 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
p++;
if (*p == ',')
p++;
- } while (IsValidPoint(p) != MagickFalse);
+ } while (IsPoint(p) != MagickFalse);
break;
}
case 's':
@@ -7095,18 +6959,12 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
x=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
y=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
@@ -7134,7 +6992,7 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
p++;
if (*p == ',')
p++;
- } while (IsValidPoint(p) != MagickFalse);
+ } while (IsPoint(p) != MagickFalse);
break;
}
case 't':
@@ -7153,18 +7011,12 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
x=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
y=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
@@ -7192,7 +7044,7 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
p++;
if (*p == ',')
p++;
- } while (IsValidPoint(p) != MagickFalse);
+ } while (IsPoint(p) != MagickFalse);
break;
}
case 'v':
@@ -7206,9 +7058,6 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
(void) GetNextToken(p,&p,MagickPathExtent,token);
if (*token == ',')
(void) GetNextToken(p,&p,MagickPathExtent,token);
- else
- if (IsValidListChar((int) ((unsigned char) *token)) == MagickFalse)
- ThrowPointExpectedException(token,exception);
y=GetDrawValue(token,&next_token);
if (token == next_token)
ThrowPointExpectedException(token,exception);
@@ -7224,7 +7073,7 @@ static ssize_t TracePath(MVGInfo *mvg_info,const char *path,
p++;
if (*p == ',')
p++;
- } while (IsValidPoint(p) != MagickFalse);
+ } while (IsPoint(p) != MagickFalse);
break;
}
case 'z':