Fixed memory leak in operation.c.
p=(const ColorInfo *) GetNextValueInLinkedList(color_cache);
for (i=0; p != (const ColorInfo *) NULL; )
{
- if (IsMagickFalse(p->stealth) &&
- IsMagickTrue(GlobExpression(p->name,pattern,MagickFalse)))
+ if ((p->stealth == MagickFalse) &&
+ (GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
colors[i++]=p;
p=(const ColorInfo *) GetNextValueInLinkedList(color_cache);
}
p=(const ColorInfo *) GetNextValueInLinkedList(color_cache);
for (i=0; p != (const ColorInfo *) NULL; )
{
- if (IsMagickFalse(p->stealth) &&
- IsMagickTrue(GlobExpression(p->name,pattern,MagickFalse)))
+ if ((p->stealth == MagickFalse) &&
+ (GlobExpression(p->name,pattern,MagickFalse) != MagickFalse))
colors[i++]=ConstantString(p->name);
p=(const ColorInfo *) GetNextValueInLinkedList(color_cache);
}
%
*/
+static inline MagickBooleanType IsSVGCompliant(const PixelInfo *pixel)
+{
+#define SVGCompliant(component) ((double) \
+ ScaleCharToQuantum(ScaleQuantumToChar(ClampToQuantum(component))))
+
+ /*
+ SVG requires color depths > 8 expressed as percentages.
+ */
+ if (fabs(SVGCompliant(pixel->red)-pixel->red) >= MagickEpsilon)
+ return(MagickFalse);
+ if (fabs(SVGCompliant(pixel->green)-pixel->green) >= MagickEpsilon)
+ return(MagickFalse);
+ if (fabs(SVGCompliant(pixel->blue)-pixel->blue) >= MagickEpsilon)
+ return(MagickFalse);
+ if ((pixel->colorspace == CMYKColorspace) &&
+ (fabs(SVGCompliant(pixel->black)-pixel->black) >= MagickEpsilon))
+ return(MagickFalse);
+ if ((pixel->alpha_trait != UndefinedPixelTrait) &&
+ (fabs(SVGCompliant(pixel->alpha)-pixel->alpha) >= MagickEpsilon))
+ return(MagickFalse);
+ return(MagickTrue);
+}
+
static void ConcatentateHexColorComponent(const PixelInfo *pixel,
const PixelChannel channel,char *tuple)
{
Convert pixel to rgb() or cmyk() color.
*/
color=(*pixel);
- if (color.depth > 8)
- {
-#define SVGCompliant(component) ((double) \
- ScaleCharToQuantum(ScaleQuantumToChar(ClampToQuantum(component))))
-
- MagickStatusType
- status;
-
- /*
- SVG requires color depths > 8 expressed as percentages.
- */
- status=IsMagickTrue(fabs((double) (color.red-
- SVGCompliant(color.red))) < MagickEpsilon);
- status&=IsMagickTrue(fabs((double) (color.green-
- SVGCompliant(color.green))) < MagickEpsilon);
- status&=IsMagickTrue(fabs((double) (color.blue-
- SVGCompliant(color.blue))) < MagickEpsilon);
- if (color.colorspace == CMYKColorspace)
- status&=IsMagickTrue(fabs((double) (color.black-
- SVGCompliant(color.black))) < MagickEpsilon);
- if (color.alpha_trait != UndefinedPixelTrait)
- status&=IsMagickTrue(fabs((double) (color.alpha-
- SVGCompliant(color.alpha))) < MagickEpsilon);
- if (IfMagickTrue(status))
- color.depth=8;
- }
+ if (color.depth > 8 && IsSVGCompliant(pixel) != MagickFalse)
+ color.depth=8;
(void) ConcatenateMagickString(tuple,CommandOptionToMnemonic(
MagickColorspaceOptions,(ssize_t) color.colorspace),MagickPathExtent);
if (color.alpha_trait != UndefinedPixelTrait)
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
- if (IfMagickTrue(image->debug))
+ if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(target_image != (Image *) NULL);
assert(target_image->signature == MagickCoreSignature);
if (q == (const Quantum *) NULL)
break;
GetPixelInfoPixel(image,q,&target);
- if (IfMagickFalse(IsFuzzyEquivalencePixelInfo(&pixel,&target)))
+ if (IsFuzzyEquivalencePixelInfo(&pixel,&target) == MagickFalse)
break;
}
if (i < (ssize_t) target_image->columns)
proceed=SetImageProgress(image,SearchImageText,(MagickOffsetType) y,
image->rows);
- if( IfMagickFalse(proceed) )
+ if (proceed == MagickFalse)
status=MagickFalse;
}
}
image_view=DestroyCacheView(image_view);
*x_offset=x;
*y_offset=y;
- if (IfMagickFalse(status))
+ if (status == MagickFalse)
return(status);
- return(IsMagickTrue(y < (ssize_t) image->rows));
+ return(y < (ssize_t) image->rows ? MagickTrue : MagickFalse);
}
\f
/*
if ( pixel.depth > 16 )
pixel.depth=16;
}
- GetColorTuple(&pixel,IsMagickTrue(compliance != SVGCompliance),name);
- if (IfMagickFalse(IssRGBColorspace(pixel.colorspace)))
+ GetColorTuple(&pixel,compliance != SVGCompliance ? MagickTrue : MagickFalse,
+ name);
+ if (IssRGBColorspace(pixel.colorspace) == MagickFalse)
return(MagickFalse);
alpha=color->alpha_trait != UndefinedPixelTrait ? color->alpha : OpaqueAlpha;
(void) GetColorInfo("*",exception);
(void) close(destination_file);
(void) close(source_file);
buffer=(unsigned char *) RelinquishMagickMemory(buffer);
- return(IsMagickTrue(i!=0));
+ return(i != 0 ? MagickTrue : MagickFalse);
}
MagickExport MagickBooleanType InvokeDelegate(ImageInfo *image_info,
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
rights=ExecutePolicyRights;
- if( IfMagickFalse(IsRightsAuthorized(DelegatePolicyDomain,rights,decode)) )
+ if (IsRightsAuthorized(DelegatePolicyDomain,rights,decode) == MagickFalse)
{
errno=EPERM;
(void) ThrowMagickException(exception,GetMagickModule(),PolicyError,
"NotAuthorized","`%s'",decode);
return(MagickFalse);
}
- if( IfMagickFalse(IsRightsAuthorized(DelegatePolicyDomain,rights,encode)) )
+ if (IsRightsAuthorized(DelegatePolicyDomain,rights,encode) == MagickFalse)
{
errno=EPERM;
(void) ThrowMagickException(exception,GetMagickModule(),PolicyError,
"NotAuthorized","`%s'",encode);
return(MagickFalse);
}
- temporary=IsMagickTrue(*image->filename == '\0');
- if( IfMagickTrue(temporary) )
- if( IfMagickFalse(AcquireUniqueFilename(image->filename)) )
- {
- ThrowFileException(exception,FileOpenError,
- "UnableToCreateTemporaryFile",image->filename);
- return(MagickFalse);
- }
+ temporary=*image->filename == '\0' ? MagickTrue : MagickFalse;
+ if ((temporary != MagickFalse) && (AcquireUniqueFilename(image->filename) ==
+ MagickFalse))
+ {
+ ThrowFileException(exception,FileOpenError,"UnableToCreateTemporaryFile",
+ image->filename);
+ return(MagickFalse);
+ }
delegate_info=GetDelegateInfo(decode,encode,exception);
if (delegate_info == (DelegateInfo *) NULL)
{
- if( IfMagickTrue(temporary) )
+ if (temporary != MagickFalse)
(void) RelinquishUniqueFileResource(image->filename);
(void) ThrowMagickException(exception,GetMagickModule(),DelegateError,
"NoTagFound","`%s'",decode ? decode : encode);
}
if (*image_info->filename == '\0')
{
- if( IfMagickFalse(AcquireUniqueFilename(image_info->filename)) )
+ if (AcquireUniqueFilename(image_info->filename) == MagickFalse)
{
- if( IfMagickTrue(temporary) )
+ if (temporary != MagickFalse)
(void) RelinquishUniqueFileResource(image->filename);
ThrowFileException(exception,FileOpenError,
"UnableToCreateTemporaryFile",image_info->filename);
/*
Delegate requires a particular image format.
*/
- if( IfMagickFalse(AcquireUniqueFilename(image_info->unique)) )
+ if (AcquireUniqueFilename(image_info->unique) == MagickFalse)
{
ThrowFileException(exception,FileOpenError,
"UnableToCreateTemporaryFile",image_info->unique);
return(MagickFalse);
}
- if( IfMagickFalse(AcquireUniqueFilename(image_info->zero)) )
+ if (AcquireUniqueFilename(image_info->zero) == MagickFalse)
{
(void) RelinquishUniqueFileResource(image_info->unique);
ThrowFileException(exception,FileOpenError,
{
(void) RelinquishUniqueFileResource(image_info->unique);
(void) RelinquishUniqueFileResource(image_info->zero);
- if( IfMagickTrue(temporary) )
+ if (temporary != MagickFalse)
(void) RelinquishUniqueFileResource(image->filename);
(void) ThrowMagickException(exception,GetMagickModule(),
DelegateError,"DelegateFailed","`%s'",decode ? decode : encode);
(void) FormatLocaleString(p->filename,MagickPathExtent,"%s:%s",
delegate_info->decode,clone_info->filename);
status=WriteImage(clone_info,p,exception);
- if( IfMagickFalse(status) )
+ if (status == MagickFalse)
{
(void) RelinquishUniqueFileResource(image_info->unique);
(void) RelinquishUniqueFileResource(image_info->zero);
- if( IfMagickTrue(temporary) )
+ if (temporary != MagickFalse)
(void) RelinquishUniqueFileResource(image->filename);
clone_info=DestroyImageInfo(clone_info);
(void) ThrowMagickException(exception,GetMagickModule(),
DelegateError,"DelegateFailed","`%s'",decode ? decode : encode);
return(MagickFalse);
}
- if( IfMagickTrue(clone_info->adjoin) )
+ if (clone_info->adjoin != MagickFalse)
break;
}
(void) RelinquishUniqueFileResource(image_info->unique);
return(MagickFalse);
}
command=(char *) NULL;
- status=MagickFalse;
- (void) CopyMagickString(output_filename,image_info->filename,MagickPathExtent);
+ status=MagickTrue;
+ (void) CopyMagickString(output_filename,image_info->filename,
+ MagickPathExtent);
(void) CopyMagickString(input_filename,image->filename,MagickPathExtent);
for (i=0; commands[i] != (char *) NULL; i++)
{
- status=AcquireUniqueSymbolicLink(output_filename,image_info->filename);
- if( IfMagickFalse(AcquireUniqueFilename(image_info->unique)) )
+ (void) AcquireUniqueSymbolicLink(output_filename,image_info->filename);
+ if (AcquireUniqueFilename(image_info->unique) == MagickFalse)
{
ThrowFileException(exception,FileOpenError,
"UnableToCreateTemporaryFile",image_info->unique);
break;
}
- if( IfMagickFalse(AcquireUniqueFilename(image_info->zero)) )
+ if (AcquireUniqueFilename(image_info->zero) == MagickFalse)
{
(void) RelinquishUniqueFileResource(image_info->unique);
ThrowFileException(exception,FileOpenError,
if (LocaleCompare(decode,"SCAN") != 0)
{
status=AcquireUniqueSymbolicLink(input_filename,image->filename);
- if( IfMagickFalse(status) )
+ if (status == MagickFalse)
{
ThrowFileException(exception,FileOpenError,
"UnableToCreateTemporaryFile",input_filename);
break;
}
}
- status=MagickFalse;
+ status=MagickTrue;
command=InterpretImageProperties(image_info,image,commands[i],exception);
if (command != (char *) NULL)
{
/*
Execute delegate.
*/
- status=IsMagickTrue(ExternalDelegateCommand(delegate_info->spawn,
- image_info->verbose,command,(char *) NULL,exception) != 0);
- if (IfMagickTrue(delegate_info->spawn))
+ if (ExternalDelegateCommand(delegate_info->spawn,image_info->verbose,
+ command,(char *) NULL,exception) != 0)
+ status=MagickFalse;
+ if (delegate_info->spawn != MagickFalse)
{
ssize_t
count;
}
if (CopyDelegateFile(image_info->filename,output_filename,MagickTrue) == MagickFalse)
(void) RelinquishUniqueFileResource(output_filename);
- if( IfMagickTrue(image_info->temporary) )
+ if (image_info->temporary != MagickFalse)
(void) RelinquishUniqueFileResource(image_info->filename);
(void) RelinquishUniqueFileResource(image_info->unique);
(void) RelinquishUniqueFileResource(image_info->zero);
(void) RelinquishUniqueFileResource(image_info->filename);
(void) RelinquishUniqueFileResource(image->filename);
- if( IfMagickTrue(status) )
+ if (status == MagickFalse)
{
(void) ThrowMagickException(exception,GetMagickModule(),DelegateError,
"DelegateFailed","`%s'",commands[i]);
for ( ; commands[i] != (char *) NULL; i++)
commands[i]=DestroyString(commands[i]);
commands=(char **) RelinquishMagickMemory(commands);
- if( IfMagickTrue(temporary) )
+ if (temporary != MagickFalse)
(void) RelinquishUniqueFileResource(image->filename);
- return(IsMagickFalse(status));
+ return(status);
}
\f
/*
(void) XSetErrorHandler(XError);
status=XRemoteCommand(display,window,filename);
(void) XCloseDisplay(display);
- return(IsMagickTrue(status));
+ return(status != 0 ? MagickTrue : MagickFalse);
}
\f
/*
XCheckRefreshWindows(display,windows);
background_resources=(*resource_info);
background_resources.window_id=window_id;
- background_resources.backdrop=IsMagickTrue(status);
+ background_resources.backdrop=status != 0 ? MagickTrue : MagickFalse;
status=XDisplayBackgroundImage(display,&background_resources,*image,
exception);
if (IfMagickTrue(status))
AllCompliance,&draw_info->fill,exception);
(void) FloodfillPaintImage(*image,draw_info,&target,
(ssize_t)x_offset,(ssize_t)y_offset,
- IsMagickFalse(method == FloodfillMethod),exception);
+ method != FloodfillMethod ? MagickTrue : MagickFalse,exception);
draw_info=DestroyDrawInfo(draw_info);
break;
}
(void) XReconfigureWMWindow(display,windows->icon.id,windows->icon.screen,
(unsigned int) (CWWidth | CWHeight),&window_changes);
XSetCursorState(display,windows,MagickFalse);
- return(IsMagickTrue(status));
+ return(status != 0 ? MagickTrue : MagickFalse);
}
\f
/*
}
XSetCursorState(display,windows,MagickFalse);
coordinate_info=(XPoint *) RelinquishMagickMemory(coordinate_info);
- return(IsMagickTrue(status));
+ return(status != 0 ? MagickTrue : MagickFalse);
}
\f
/*
flags=ParseGeometry(geometry,&geometry_info);
if ((flags & SigmaValue) == 0)
geometry_info.sigma=1.0;
- shade_image=ShadeImage(*image,IsMagickTrue(status),
+ shade_image=ShadeImage(*image,status != 0 ? MagickTrue : MagickFalse,
geometry_info.rho,geometry_info.sigma,exception);
if (shade_image != (Image *) NULL)
{
channel_mask=SetImageChannelMask(*image,AlphaChannel);
(void) FloodfillPaintImage(*image,draw_info,&target,(ssize_t)
x_offset,(ssize_t) y_offset,
- IsMagickFalse(method == FloodfillMethod),exception);
+ method != FloodfillMethod ? MagickTrue : MagickFalse,exception);
(void) SetPixelChannelMask(*image,channel_mask);
draw_info=DestroyDrawInfo(draw_info);
break;
print_image=DestroyImage(print_image);
image_info=DestroyImageInfo(image_info);
XSetCursorState(display,windows,MagickFalse);
- return(IsMagickTrue(status));
+ return(status != 0 ? MagickTrue : MagickFalse);
}
\f
/*
save_image=DestroyImage(save_image);
image_info=DestroyImageInfo(image_info);
XSetCursorState(display,windows,MagickFalse);
- return(IsMagickTrue(status));
+ return(status != 0 ? MagickTrue : MagickFalse);
}
\f
/*
/*
Read each image and convert them to a tile.
*/
- backdrop=IsMagickTrue( (windows->visual_info->klass == TrueColor) ||
- (windows->visual_info->klass == DirectColor) );
+ backdrop=((windows->visual_info->klass == TrueColor) ||
+ (windows->visual_info->klass == DirectColor)) ? MagickTrue : MagickFalse;
read_info=CloneImageInfo(resource_info->image_info);
(void) SetImageOption(read_info,"jpeg:size","120x120");
(void) CloneString(&read_info->size,DefaultTileGeometry);
delay=1000*image->delay/MagickMax(image->ticks_per_second,1L);
XDelay(display,delay == 0UL ? 10UL : delay);
(void) XSync(display,MagickFalse);
- return(IsMagickTrue(window_info.id == root_window));
+ return(window_info.id == root_window ? MagickTrue : MagickFalse);
}
\f
/*
}
timestamp=time((time_t *) NULL);
(void) XNextEvent(display,&event);
- if (IfMagickFalse(windows->image.stasis) )
- windows->image.stasis=IsMagickTrue((time((time_t *) NULL)-timestamp) > 0);
- if (IfMagickFalse(windows->magnify.stasis) )
- windows->magnify.stasis=IsMagickTrue((time((time_t *) NULL)-timestamp) > 0);
+ if ((windows->image.stasis == MagickFalse) ||
+ (windows->magnify.stasis == MagickFalse))
+ {
+ if ((time((time_t *) NULL)-timestamp) > 0)
+ {
+ windows->image.stasis=MagickTrue;
+ windows->magnify.stasis=MagickTrue;
+ }
+ }
if (event.xany.window == windows->command.id)
{
/*
p=(const char *) target;
q=(const char *) source;
- return(IsMagickTrue(LocaleCompare(p,q)));
+ return(LocaleCompare(p,q) == 0 ? MagickTrue : MagickFalse);
}
\f
/*
*/
MagickExport MagickBooleanType CompareHashmapStringInfo(const void *target,
const void *source)
-{
- return(IsMagickTrue(LocaleCompare((const char *)target,
- (const char *)source)));
+{\r
+ const StringInfo\r
+ *p,\r
+ *q;\r
+\r
+ p=(const StringInfo *) target;\r
+ q=(const StringInfo *) source;\r
+ return(CompareStringInfo(p,q) == 0 ? MagickTrue : MagickFalse);
}
\f
/*
{
assert(hashmap_info != (HashmapInfo *) NULL);
assert(hashmap_info->signature == MagickCoreSignature);
- return(IsMagickTrue(hashmap_info->entries == 0));
+ return(hashmap_info->entries == 0 ? MagickTrue : MagickFalse);
}
\f
/*
{
assert(list_info != (LinkedListInfo *) NULL);
assert(list_info->signature == MagickCoreSignature);
- return(IsMagickTrue(list_info->elements == 0));
+ return(list_info->elements == 0 ? MagickTrue : MagickFalse);
}
\f
/*
IfMagickTrue() converts MagickBooleanType to C integer Boolean
IfMagickFalse() Not the MagickBooleanType to C integer Boolean
-
- IsMagickTrue() converts a C integer boolean to a MagickBooleanType
- IsMagickFalse() converts and is also a MagickBooleanType 'not' operation
-
*/
#if 1
/* Fast C typing method assumes MagickBooleanType match 0,1 values */
# define IfMagickTrue(v) ((int)(v))
# define IfMagickFalse(v) (!(int)(v))
-# define IsMagickTrue(v) ((MagickBooleanType)((int)(v)!=0))
-# define IsMagickFalse(v) ((MagickBooleanType)(!(int)(v)))
-# define IsMagickNot(v) ((MagickBooleanType)(!(int)(v)))
#else
/* Do not depend MagickBooleanType's values */
# define IfMagickTrue(v) ((v) != MagickFalse)
# define IfMagickFalse(v) ((v) == MagickFalse)
-# define IsMagickTrue(v) ((v)?MagickTrue:MagickFalse)
-# define IsMagickFalse(v) ((v)?MagickFalse:MagickTrue)
-# define IsMagickNot(v) (IfMagickTrue(v)?MagickFalse:MagickTrue)
#endif
/*
#define IsMagickConflict PrependMagickMethod(IsMagickConflict)
#define IsMagickInstantiated PrependMagickMethod(IsMagickInstantiated)
#define IsCommandOption PrependMagickMethod(IsCommandOption)
-#define IsMagickTrue PrependMagickMethod(IsMagickTrue)
#define IsImageMonochrome PrependMagickMethod(IsImageMonochrome)
#define IsEquivalentAlpha PrependMagickMethod(IsEquivalentAlpha)
#define IsImageOpaque PrependMagickMethod(IsImageOpaque)
if ((*option != '-') && (*option != '+'))
return(MagickFalse);
if (strlen(option) == 1)
- return(IsMagickTrue((*option == '{') || (*option == '}') ||
- (*option == '[') || (*option == ']') ));
+ return(((*option == '{') || (*option == '}') || (*option == '[') ||
+ (*option == ']')) ? MagickTrue : MagickFalse);
option++;
if (*option == '-')
return(MagickTrue);
interpret_text=AcquireString(embed_text); /* new string with extra space */
extent=MagickPathExtent; /* allocated space in string */
number=MagickFalse; /* is last char a number? */
- for (q=interpret_text; *p!='\0'; number=IsMagickTrue(isdigit(*p)),p++)
+ for (q=interpret_text; *p!='\0'; number=isdigit(*p) ? MagickTrue : MagickFalse,p++)
{
*q='\0';
ExtendInterpretText(MagickPathExtent);
*string;
/* But only if not preceeded by a number! */
- if ( IfMagickTrue(number) ) {
+ if (number != MagickFalse) {
*q++='%'; /* do NOT substitute the percent */
p--; /* back up one */
continue;
status=FxEvaluateChannelExpression(fx_info,IntensityPixelChannel,0,0,
&value,exception);
fx_info=DestroyFxInfo(fx_info);
- if( IfMagickTrue(status) )
+ if (status != MagickFalse)
{
char
result[MagickPathExtent];
&value,exception);
pixel.alpha=(double) QuantumRange*value;
fx_info=DestroyFxInfo(fx_info);
- if( IfMagickTrue(status) )
+ if (status != MagickFalse)
{
char
name[MagickPathExtent];
OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
continue; /* else no image to retrieve artifact */
}
- if( IfMagickTrue(IsGlob(pattern+7)) )
+ if (IsGlob(pattern+7) != MagickFalse)
{
ResetImageOptionIterator(image_info);
while ((key=GetNextImageOption(image_info)) != (const char *) NULL)
- if( IfMagickTrue(GlobExpression(key,pattern+7,MagickTrue)) )
+ if (GlobExpression(key,pattern+7,MagickTrue) != MagickFalse)
{
string=GetImageOption(image_info,key);
if (string != (const char *) NULL)
OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
continue; /* else no image to retrieve artifact */
}
- if( IfMagickTrue(IsGlob(pattern+9)) )
+ if (IsGlob(pattern+9) != MagickFalse)
{
ResetImageArtifactIterator(image);
while ((key=GetNextImageArtifact(image)) != (const char *) NULL)
- if( IfMagickTrue(GlobExpression(key,pattern+9,MagickTrue)) )
+ if (GlobExpression(key,pattern+9,MagickTrue) != MagickFalse)
{
string=GetImageArtifact(image,key);
if (string != (const char *) NULL)
OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
continue; /* else no image to retrieve artifact */
}
- if( IfMagickTrue(IsGlob(pattern+9)) )
+ if (IsGlob(pattern+9) != MagickFalse)
{
ResetImagePropertyIterator(image);
while ((key=GetNextImageProperty(image)) != (const char *) NULL)
- if( IfMagickTrue(GlobExpression(key,pattern,MagickTrue)) )
+ if (GlobExpression(key,pattern,MagickTrue) != MagickFalse)
{
string=GetImageProperty(image,key,exception);
if (string != (const char *) NULL)
This handles attributes, properties, and profiles such as %[exif:...]
Note the profile properties may also include a glob expansion pattern.
*/
- if ( image != (Image *) NULL )
+ if (image != (Image *) NULL)
{
string=GetImageProperty(image,pattern,exception);
if (string != (const char *) NULL)
Handle property 'glob' patterns
Such as: %[*] %[user:array_??] %[filename:e*]
*/
- if( IfMagickTrue(IsGlob(pattern)) )
+ if (IsGlob(pattern) != MagickFalse)
{
if (image == (Image *) NULL)
continue; /* else no image to retrieve proprty - no list */
ResetImagePropertyIterator(image);
while ((key=GetNextImageProperty(image)) != (const char *) NULL)
- if( IfMagickTrue(GlobExpression(key,pattern,MagickTrue)) )
+ if (GlobExpression(key,pattern,MagickTrue) != MagickFalse)
{
string=GetImageProperty(image,key,exception);
if (string != (const char *) NULL)
extern MagickExport MagickBooleanType
GlobExpression(const char *,const char *,const MagickBooleanType);
-/* Deprecated Function equivelent */
-/* #define IsMagickTrue(v) IsStringTrue(v) */
-
extern MagickExport TokenInfo
*AcquireTokenInfo(void),
*DestroyTokenInfo(TokenInfo *);
cli_wand->wand.exception = (ExceptionInfo *) NULL;
cli_wand=DestroyMagickCLI(cli_wand);
- return(IsMagickTrue(exception->severity < ErrorException));
+ return(exception->severity < ErrorException ? MagickTrue : MagickFalse);
}
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
if (wand->images == (Image *) NULL)
ThrowWandException(WandError,"ContainsNoImages",wand->name);
- if ((wand->images->alpha_trait == UndefinedPixelTrait) && IsMagickTrue(matte))
- (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
- wand->images->alpha_trait=matte != MagickFalse ? BlendPixelTrait :
- UndefinedPixelTrait;
+ if (matte == MagickFalse)
+ wand->images->alpha_trait=UndefinedPixelTrait;
+ else
+ {
+ if (wand->images->alpha_trait == UndefinedPixelTrait)
+ (void) SetImageAlpha(wand->images,OpaqueAlpha,wand->exception);
+ wand->images->alpha_trait=BlendPixelTrait;
+ }
return(MagickTrue);
}
\f
x++; /* floating point argument */
}
/* control points and color values */
- error = IsMagickTrue( x % (2+number_colors) );
+ if ((x % (2+number_colors)) != 0)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "InvalidArgument","'%s': %s", "sparse-color",
+ "Invalid number of Arguments");
+ return( (Image *) NULL);
+ }
+ error=MagickFalse;
number_arguments=x;
- if ( IfMagickTrue(error) ) {
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionError, "InvalidArgument", "'%s': %s", "sparse-color",
- "Invalid number of Arguments");
- return( (Image *) NULL);
- }
/* Allocate and fill in the floating point arguments */
sparse_arguments=(double *) AcquireQuantumMemory(number_arguments,
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError, "InvalidArgument", "'%s': %s", "sparse-color",
"Color found, instead of X-coord");
- error = MagickTrue;
+ error=MagickTrue;
break;
}
sparse_arguments[x++]=StringToDouble(token,(char **) NULL);
(void) ThrowMagickException(exception,GetMagickModule(),
OptionError, "InvalidArgument", "'%s': %s", "sparse-color",
"Color found, instead of Y-coord");
- error = MagickTrue;
+ error=MagickTrue;
break;
}
sparse_arguments[x++]=StringToDouble(token,(char **) NULL);
}
}
}
- if ( number_arguments != x && !error ) {
- (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
- "InvalidArgument","'%s': %s","sparse-color","Argument Parsing Error");
- sparse_arguments=(double *) RelinquishMagickMemory(sparse_arguments);
- return( (Image *) NULL);
- }
- if ( error )
- return( (Image *) NULL);
-
+ if (error != MagickFalse)
+ {
+ sparse_arguments=(double *) RelinquishMagickMemory(sparse_arguments);
+ return((Image *) NULL);
+ }
+ if (number_arguments != x)
+ {
+ sparse_arguments=(double *) RelinquishMagickMemory(sparse_arguments);
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "InvalidArgument","'%s': %s","sparse-color","Argument Parsing Error");
+ return((Image *) NULL);
+ }
/* Call the Sparse Color Interpolation function with the parsed arguments */
sparse_image=SparseColorImage(image,method,number_arguments,sparse_arguments,
exception);
#define _draw_info (cli_wand->draw_info)
#define _quantize_info (cli_wand->quantize_info)
#define IfSetOption (*option=='-')
-#define ArgBoolean IsMagickTrue(IfSetOption)
-#define ArgBooleanNot IsMagickFalse(IfSetOption)
+#define ArgBoolean IfSetOption ? MagickTrue : MagickFalse
+#define ArgBooleanNot IfSetOption ? MagickFalse : MagickTrue
#define ArgBooleanString (IfSetOption?"true":"false")
#define ArgOption(def) (IfSetOption?arg1:(const char *)(def))
/* DefineImageOption() equals SetImageOption() but with '=' */
if (IfSetOption)
(void) DefineImageOption(_image_info,arg1);
- else if (IsMagickFalse(DeleteImageOption(_image_info,arg1)))
+ else if (DeleteImageOption(_image_info,arg1) == MagickFalse)
CLIWandExceptArgBreak(OptionError,"NoSuchOption",option,arg1);
break;
}
#define _option_type ((CommandOptionFlags) cli_wand->command->flags)
#define IfNormalOp (*option=='-')
#define IfPlusOp (*option!='-')
-#define IsNormalOp IsMagickTrue(IfNormalOp)
-#define IsPlusOp IsMagickFalse(IfNormalOp)
+#define IsNormalOp IfNormalOp ? MagickTrue : MagickFalse
+#define IsPlusOp IfNormalOp ? MagickFalse : MagickTrue
assert(cli_wand != (MagickCLI *) NULL);
assert(cli_wand->signature == MagickWandSignature);
#define _option_type ((CommandOptionFlags) cli_wand->command->flags)
#define IfNormalOp (*option=='-')
#define IfPlusOp (*option!='-')
-#define IsNormalOp IsMagickTrue(IfNormalOp)
+#define IsNormalOp IfNormalOp ? MagickTrue : MagickFalse
assert(cli_wand != (MagickCLI *) NULL);
assert(cli_wand->signature == MagickWandSignature);
%
*/
WandExport MagickBooleanType CLICatchException(MagickCLI *cli_wand,
- const MagickBooleanType all_exceptions )
+ const MagickBooleanType all_exceptions)
{
MagickBooleanType
status;
+
assert(cli_wand != (MagickCLI *) NULL);
assert(cli_wand->signature == MagickWandSignature);
assert(cli_wand->wand.signature == MagickWandSignature);
- if (IfMagickTrue(cli_wand->wand.debug))
+ if (cli_wand->wand.debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",cli_wand->wand.name);
// FUTURE: '-regard_warning' should make this more sensitive.
// Note pipelined options may like more control over this level
- status = IsMagickTrue(cli_wand->wand.exception->severity > ErrorException);
+ status=cli_wand->wand.exception->severity > ErrorException ? MagickTrue :
+ MagickFalse;
- if ( IfMagickFalse(status) || IfMagickTrue(all_exceptions) )
+ if ((status == MagickFalse) || (all_exceptions != MagickFalse))
CatchException(cli_wand->wand.exception); /* output and clear exceptions */
return(status);