% ImageMagick Validation Suite %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% March 2001 %
% %
% %
-% Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2018 ImageMagick Studio LLC, a non-profit organization %
% dedicated to making software imaging solutions freely available. %
% %
% You may not use this file except in compliance with the License. You may %
% obtain a copy of the License at %
% %
-% http://www.imagemagick.org/script/license.php %
+% https://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
#include <locale.h>
#include "MagickWand/MagickWand.h"
#include "MagickCore/colorspace-private.h"
+#include "MagickCore/gem.h"
#include "MagickCore/resource_.h"
#include "MagickCore/string-private.h"
#include "validate.h"
#define D65X 0.950456
#define D65Y 1.0
#define D65Z 1.088754
-#define ReferenceEpsilon (1.0e-0)
+#define ReferenceEpsilon (QuantumRange*1.0e-2)
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*blue*=QuantumRange;
}
-static inline double MagickMin(const double x,const double y)
-{
- if (x < y)
- return(x);
- return(y);
-}
-
static void ConvertRGBToHSI(const double red,const double green,
const double blue,double *hue,double *saturation,double *intensity)
{
*hue+=1.0;
}
-MagickExport void ConvertHSLToRGB(const double hue,const double saturation,
- const double lightness,double *red,double *green,double *blue)
-{
- double
- c,
- h,
- min,
- x;
-
- h=hue*360.0;
- if (lightness <= 0.5)
- c=2.0*lightness*saturation;
- else
- c=(2.0-2.0*lightness)*saturation;
- min=lightness-0.5*c;
- h-=360.0*floor(h/360.0);
- h/=60.0;
- x=c*(1.0-fabs(h-2.0*floor(h/2.0)-1.0));
- switch ((int) floor(h))
- {
- case 0:
- {
- *red=QuantumRange*(min+c);
- *green=QuantumRange*(min+x);
- *blue=QuantumRange*min;
- break;
- }
- case 1:
- {
- *red=QuantumRange*(min+x);
- *green=QuantumRange*(min+c);
- *blue=QuantumRange*min;
- break;
- }
- case 2:
- {
- *red=QuantumRange*min;
- *green=QuantumRange*(min+c);
- *blue=QuantumRange*(min+x);
- break;
- }
- case 3:
- {
- *red=QuantumRange*min;
- *green=QuantumRange*(min+x);
- *blue=QuantumRange*(min+c);
- break;
- }
- case 4:
- {
- *red=QuantumRange*(min+x);
- *green=QuantumRange*min;
- *blue=QuantumRange*(min+c);
- break;
- }
- case 5:
- {
- *red=QuantumRange*(min+c);
- *green=QuantumRange*min;
- *blue=QuantumRange*(min+x);
- break;
- }
- default:
- {
- *red=0.0;
- *green=0.0;
- *blue=0.0;
- }
- }
-}
-
-static inline double MagickMax(const double x,const double y)
-{
- if (x > y)
- return(x);
- return(y);
-}
-
-MagickExport void ConvertRGBToHSL(const double red,const double green,
- const double blue,double *hue,double *saturation,double *lightness)
-{
- double
- c,
- max,
- min;
-
- max=MagickMax(QuantumScale*red,MagickMax(QuantumScale*green,
- QuantumScale*blue));
- min=MagickMin(QuantumScale*red,MagickMin(QuantumScale*green,
- QuantumScale*blue));
- c=max-min;
- *lightness=(max+min)/2.0;
- if (c <= 0.0)
- {
- *hue=0.0;
- *saturation=0.0;
- return;
- }
- if (max == (QuantumScale*red))
- {
- *hue=(QuantumScale*green-QuantumScale*blue)/c;
- if ((QuantumScale*green) < (QuantumScale*blue))
- *hue+=6.0;
- }
- else
- if (max == (QuantumScale*green))
- *hue=2.0+(QuantumScale*blue-QuantumScale*red)/c;
- else
- *hue=4.0+(QuantumScale*red-QuantumScale*green)/c;
- *hue*=60.0/360.0;
- if (*lightness <= 0.5)
- *saturation=c/(2.0*(*lightness));
- else
- *saturation=c/(2.0-2.0*(*lightness));
-}
-
static void ConvertHSVToRGB(const double hue,const double saturation,
const double value,double *red,double *green,double *blue)
{
Y,
Z;
- ConvertLCHabToXYZ(luma*100.0,255.0*(chroma-0.5),255.0*(hue-0.5),&X,&Y,&Z);
+ ConvertLCHabToXYZ(luma*100.0,255.0*(chroma-0.5),360.0*hue,&X,&Y,&Z);
ConvertXYZToRGB(X,Y,Z,red,green,blue);
}
b;
ConvertXYZToLab(X,Y,Z,luma,&a,&b);
- *chroma=hypot(255.0*(a-0.5),255.0*(b-0.5));
- *hue=180.0*atan2(255.0*(b-0.5),255.0*(a-0.5))/MagickPI;
- *chroma=(*chroma)/255.0+0.5;
- *hue=(*hue)/255.0+0.5;
+ *chroma=hypot(255.0*(a-0.5),255.0*(b-0.5))/255.0+0.5;
+ *hue=180.0*atan2(255.0*(b-0.5),255.0*(a-0.5))/MagickPI/360.0;
if (*hue < 0.0)
*hue+=1.0;
}
ConvertXYZToLMS(X,Y,Z,L,M,S);
}
-static inline double PerceptibleReciprocal(const double x)
-{
- double
- sign;
-
- /*
- Return 1/x where x is perceptible (not unlimited or infinitesimal).
- */
- sign=x < 0.0 ? -1.0 : 1.0;
- if ((sign*x) >= MagickEpsilon)
- return(1.0/x);
- return(sign/MagickEpsilon);
-}
-
static inline void ConvertXYZToLuv(const double X,const double Y,const double Z,
double *L,double *u,double *v)
{
r;
(void) FormatLocaleFile(stdout," LchToRGB");
- ConvertLCHabToRGB(88.456154/100.0,75.219797/255.0+0.5,136.620717/255.0+0.5,
+ ConvertLCHabToRGB(88.456154/100.0,75.219797/255.0+0.5,136.620717/360.0,
&r,&g,&b);
if ((fabs(r-0.545877*QuantumRange) >= ReferenceEpsilon) ||
(fabs(g-0.966567*QuantumRange) >= ReferenceEpsilon) ||
{
char
**arguments,
- command[MaxTextExtent];
+ command[MagickPathExtent];
int
number_arguments;
CatchException(exception);
(void) FormatLocaleFile(stdout," test %.20g: %s",(double) (test++),
compare_options[i]);
- (void) FormatLocaleString(command,MaxTextExtent,"%s %s %s %s",
+ (void) FormatLocaleString(command,MagickPathExtent,"%s %s %s %s",
compare_options[i],reference_filename,reference_filename,output_filename);
arguments=StringToArgv(command,&number_arguments);
if (arguments == (char **) NULL)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ (void) LogMagickEvent(ExceptionEvent,GetMagickModule(),"%s",
+ exception->reason);
(*fail)++;
continue;
}
for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
- if (status != MagickFalse)
+ if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ (void) LogMagickEvent(ExceptionEvent,GetMagickModule(),"%s",
+ exception->reason);
(*fail)++;
continue;
}
{
char
**arguments,
- command[MaxTextExtent];
+ command[MagickPathExtent];
int
number_arguments;
CatchException(exception);
(void) FormatLocaleFile(stdout," test %.20g: %s",(double) (test++),
composite_options[i]);
- (void) FormatLocaleString(command,MaxTextExtent,"%s %s %s %s",
+ (void) FormatLocaleString(command,MagickPathExtent,"%s %s %s %s",
reference_filename,composite_options[i],reference_filename,
output_filename);
arguments=StringToArgv(command,&number_arguments);
for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
- if (status != MagickFalse)
+ if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
{
char
**arguments,
- command[MaxTextExtent];
+ command[MagickPathExtent];
int
number_arguments;
CatchException(exception);
(void) FormatLocaleFile(stdout," test %.20g: %s",(double) test++,
convert_options[i]);
- (void) FormatLocaleString(command,MaxTextExtent,"%s %s %s %s",
+ (void) FormatLocaleString(command,MagickPathExtent,"%s %s %s %s",
reference_filename,convert_options[i],reference_filename,output_filename);
arguments=StringToArgv(command,&number_arguments);
if (arguments == (char **) NULL)
for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
- if (status != MagickFalse)
+ if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
{
char
**arguments,
- command[MaxTextExtent];
+ command[MagickPathExtent];
int
number_arguments;
CatchException(exception);
(void) FormatLocaleFile(stdout," test %.20g: %s",(double) test++,
identify_options[i]);
- (void) FormatLocaleString(command,MaxTextExtent,"%s %s",
+ (void) FormatLocaleString(command,MagickPathExtent,"%s %s",
identify_options[i],reference_filename);
arguments=StringToArgv(command,&number_arguments);
if (arguments == (char **) NULL)
for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
- if (status != MagickFalse)
+ if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
{
char
#ifdef MagickCountTempFiles
- path[MaxTextExtent],
- SystemCommand[MaxTextExtent],
+ path[MagickPathExtent],
+ SystemCommand[MagickPathExtent],
#endif
- size[MaxTextExtent];
+ size[MagickPathExtent];
const MagickInfo
*magick_info;
CommandOptionToMnemonic(MagickTypeOptions,reference_types[j].type),
(double) reference_types[j].depth);
(void) CopyMagickString(image_info->filename,reference_filename,
- MaxTextExtent);
+ MagickPathExtent);
reference_image=ReadImage(image_info,exception);
- if (reference_image == (Image *) NULL)
+ if ((reference_image == (Image *) NULL) ||
+ (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ if (exception->reason != (char *) NULL)
+ (void) FormatLocaleFile(stdout," reason:%s\n",exception->reason);
+ CatchException(exception);
(*fail)++;
continue;
}
/*
Write reference image.
*/
- (void) FormatLocaleString(size,MaxTextExtent,"%.20gx%.20g",
+ (void) FormatLocaleString(size,MagickPathExtent,"%.20gx%.20g",
(double) reference_image->columns,(double) reference_image->rows);
(void) CloneString(&image_info->size,size);
image_info->depth=reference_types[j].depth;
- (void) FormatLocaleString(reference_image->filename,MaxTextExtent,"%s:%s",
- reference_formats[i].magick,output_filename);
+ (void) FormatLocaleString(reference_image->filename,MagickPathExtent,
+ "%s:%s",reference_formats[i].magick,output_filename);
status=SetImageType(reference_image,reference_types[j].type,exception);
- if (status == MagickFalse)
+ if (status == MagickFalse || (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ if (exception->reason != (char *) NULL)
+ (void) FormatLocaleFile(stdout," reason:%s\n",exception->reason);
+ CatchException(exception);
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
status=SetImageDepth(reference_image,reference_types[j].depth,exception);
- if (status == MagickFalse)
+ if (status == MagickFalse || (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ CatchException(exception);
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
reference_image->compression=reference_formats[i].compression;
status=WriteImage(image_info,reference_image,exception);
reference_image=DestroyImage(reference_image);
- if (status == MagickFalse)
+ if (status == MagickFalse || (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ if (exception->reason != (char *) NULL)
+ (void) FormatLocaleFile(stdout," reason:%s\n",exception->reason);
+ CatchException(exception);
(*fail)++;
continue;
}
/*
Ping reference image.
*/
- (void) FormatLocaleString(image_info->filename,MaxTextExtent,"%s:%s",
+ (void) FormatLocaleString(image_info->filename,MagickPathExtent,"%s:%s",
reference_formats[i].magick,output_filename);
ping_image=PingImage(image_info,exception);
- if (ping_image == (Image *) NULL)
+ if (ping_image == (Image *) NULL ||
+ (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ if (exception->reason != (char *) NULL)
+ (void) FormatLocaleFile(stdout," reason:%s\n",exception->reason);
+ CatchException(exception);
(*fail)++;
continue;
}
Read reference image.
*/
reference_image=ReadImage(image_info,exception);
- if (reference_image == (Image *) NULL)
+ if ((reference_image == (Image *) NULL) ||
+ (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ if (exception->reason != (char *) NULL)
+ (void) FormatLocaleFile(stdout," reason:%s\n",exception->reason);
+ CatchException(exception);
(*fail)++;
continue;
}
/*
Write reference image.
*/
- (void) FormatLocaleString(reference_image->filename,MaxTextExtent,"%s:%s",
- reference_formats[i].magick,output_filename);
+ (void) FormatLocaleString(reference_image->filename,MagickPathExtent,
+ "%s:%s",reference_formats[i].magick,output_filename);
(void) CopyMagickString(image_info->magick,reference_formats[i].magick,
- MaxTextExtent);
+ MagickPathExtent);
reference_image->depth=reference_types[j].depth;
reference_image->compression=reference_formats[i].compression;
length=8192;
blob=ImageToBlob(image_info,reference_image,&length,exception);
- if (blob == (unsigned char *) NULL)
+ if ((blob == (unsigned char *) NULL) ||
+ (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ if (exception->reason != (char *) NULL)
+ (void) FormatLocaleFile(stdout," reason:%s\n",exception->reason);
+ CatchException(exception);
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
Ping reference blob.
*/
ping_image=PingBlob(image_info,blob,length,exception);
- if (ping_image == (Image *) NULL)
+ if (ping_image == (Image *) NULL ||
+ (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ if (exception->reason != (char *) NULL)
+ (void) FormatLocaleFile(stdout," reason:%s\n",exception->reason);
+ CatchException(exception);
(*fail)++;
blob=(unsigned char *) RelinquishMagickMemory(blob);
continue;
/*
Read reconstruct image.
*/
- (void) FormatLocaleString(image_info->filename,MaxTextExtent,"%s:%s",
+ (void) FormatLocaleString(image_info->filename,MagickPathExtent,"%s:%s",
reference_formats[i].magick,output_filename);
reconstruct_image=BlobToImage(image_info,blob,length,exception);
blob=(unsigned char *) RelinquishMagickMemory(blob);
- if (reconstruct_image == (Image *) NULL)
+ if (reconstruct_image == (Image *) NULL ||
+ (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ if (exception->reason != (char *) NULL)
+ (void) FormatLocaleFile(stdout," reason:%s\n",exception->reason);
+ CatchException(exception);
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
RootMeanSquaredErrorMetric,&distortion,exception);
reconstruct_image=DestroyImage(reconstruct_image);
reference_image=DestroyImage(reference_image);
- if (difference_image == (Image *) NULL)
+ if (difference_image == (Image *) NULL ||
+ (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ if (exception->reason != (char *) NULL)
+ (void) FormatLocaleFile(stdout," reason:%s\n",exception->reason);
+ CatchException(exception);
(*fail)++;
continue;
}
(void) fflush(stdout);
SystemCommand[0]='\0';
(void) strncat(SystemCommand,"echo `ls ",9);
- (void) strncat(SystemCommand,path,MaxTextExtent-31);
+ (void) strncat(SystemCommand,path,MagickPathExtent-31);
(void) strncat(SystemCommand,"* | wc -w` tmp files.",20);
(void) system(SystemCommand);
(void) fflush(stdout);
ExceptionInfo *exception)
{
char
- size[MaxTextExtent];
+ size[MagickPathExtent];
const MagickInfo
*magick_info;
CommandOptionToMnemonic(MagickTypeOptions,reference_types[j].type),
(double) reference_types[j].depth);
(void) CopyMagickString(image_info->filename,reference_filename,
- MaxTextExtent);
+ MagickPathExtent);
reference_image=ReadImage(image_info,exception);
- if (reference_image == (Image *) NULL)
+ if ((reference_image == (Image *) NULL) ||
+ (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ if (exception->reason != (char *) NULL)
+ (void) FormatLocaleFile(stdout," reason:%s\n",exception->reason);
+ CatchException(exception);
(*fail)++;
continue;
}
/*
Write reference image.
*/
- (void) FormatLocaleString(size,MaxTextExtent,"%.20gx%.20g",
+ (void) FormatLocaleString(size,MagickPathExtent,"%.20gx%.20g",
(double) reference_image->columns,(double) reference_image->rows);
(void) CloneString(&image_info->size,size);
image_info->depth=reference_types[j].depth;
- (void) FormatLocaleString(reference_image->filename,MaxTextExtent,"%s:%s",
- reference_formats[i].magick,output_filename);
+ (void) FormatLocaleString(reference_image->filename,MagickPathExtent,
+ "%s:%s",reference_formats[i].magick,output_filename);
status=SetImageType(reference_image,reference_types[j].type,exception);
- if (status == MagickFalse)
+ if (status == MagickFalse || (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ if (exception->reason != (char *) NULL)
+ (void) FormatLocaleFile(stdout," reason:%s\n",exception->reason);
+ CatchException(exception);
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
status=SetImageDepth(reference_image,reference_types[j].depth,exception);
- if (status == MagickFalse)
+ if (status == MagickFalse || (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ CatchException(exception);
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
reference_image->compression=reference_formats[i].compression;
status=WriteImage(image_info,reference_image,exception);
reference_image=DestroyImage(reference_image);
- if (status == MagickFalse)
+ if (status == MagickFalse || (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ if (exception->reason != (char *) NULL)
+ (void) FormatLocaleFile(stdout," reason:%s\n",exception->reason);
+ CatchException(exception);
(*fail)++;
continue;
}
/*
Read reference image.
*/
- (void) FormatLocaleString(image_info->filename,MaxTextExtent,"%s:%s",
+ (void) FormatLocaleString(image_info->filename,MagickPathExtent,"%s:%s",
reference_formats[i].magick,output_filename);
reference_image=ReadImage(image_info,exception);
- if (reference_image == (Image *) NULL)
+ if ((reference_image == (Image *) NULL) ||
+ (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ CatchException(exception);
(*fail)++;
continue;
}
/*
Write reference image.
*/
- (void) FormatLocaleString(reference_image->filename,MaxTextExtent,"%s:%s",
- reference_formats[i].magick,output_filename);
+ (void) FormatLocaleString(reference_image->filename,MagickPathExtent,
+ "%s:%s",reference_formats[i].magick,output_filename);
reference_image->depth=reference_types[j].depth;
reference_image->compression=reference_formats[i].compression;
status=WriteImage(image_info,reference_image,exception);
- if (status == MagickFalse)
+ if (status == MagickFalse ||exception->severity >= ErrorException)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ CatchException(exception);
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
/*
Read reconstruct image.
*/
- (void) FormatLocaleString(image_info->filename,MaxTextExtent,"%s:%s",
+ (void) FormatLocaleString(image_info->filename,MagickPathExtent,"%s:%s",
reference_formats[i].magick,output_filename);
reconstruct_image=ReadImage(image_info,exception);
- if (reconstruct_image == (Image *) NULL)
+ if (reconstruct_image == (Image *) NULL ||
+ (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ CatchException(exception);
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
RootMeanSquaredErrorMetric,&distortion,exception);
reconstruct_image=DestroyImage(reconstruct_image);
reference_image=DestroyImage(reference_image);
- if (difference_image == (Image *) NULL)
+ if (difference_image == (Image *) NULL ||
+ (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ CatchException(exception);
(*fail)++;
continue;
}
reference_map[i],CommandOptionToMnemonic(MagickStorageOptions,
reference_storage[j].type));
(void) CopyMagickString(image_info->filename,reference_filename,
- MaxTextExtent);
+ MagickPathExtent);
reference_image=ReadImage(image_info,exception);
- if (reference_image == (Image *) NULL)
+ if ((reference_image == (Image *) NULL) ||
+ (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ CatchException(exception);
(*fail)++;
continue;
}
length=strlen(reference_map[i])*reference_image->columns*
reference_image->rows*reference_storage[j].quantum;
pixels=(unsigned char *) AcquireQuantumMemory(length,sizeof(*pixels));
- if (pixels == (unsigned char *) NULL)
+ if (pixels == (unsigned char *) NULL ||
+ (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ CatchException(exception);
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
}
- (void) ResetMagickMemory(pixels,0,length*sizeof(*pixels));
+ (void) memset(pixels,0,length*sizeof(*pixels));
status=ExportImagePixels(reference_image,0,0,reference_image->columns,
reference_image->rows,reference_map[i],reference_storage[j].type,pixels,
exception);
- if (status == MagickFalse)
+ if (status == MagickFalse || (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ CatchException(exception);
(*fail)++;
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
reference_image=DestroyImage(reference_image);
status=ImportImagePixels(reference_image,0,0,reference_image->columns,
reference_image->rows,reference_map[i],reference_storage[j].type,
pixels,exception);
- if (status == MagickFalse)
+ if (status == MagickFalse || (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ CatchException(exception);
(*fail)++;
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
reference_image=DestroyImage(reference_image);
reconstruct_image->rows,reference_map[i],reference_storage[j].type,
pixels,exception);
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
- if (status == MagickFalse)
+ if (status == MagickFalse || (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ CatchException(exception);
(*fail)++;
reference_image=DestroyImage(reference_image);
continue;
RootMeanSquaredErrorMetric,&distortion,exception);
reconstruct_image=DestroyImage(reconstruct_image);
reference_image=DestroyImage(reference_image);
- if (difference_image == (Image *) NULL)
+ if (difference_image == (Image *) NULL ||
+ (exception->severity >= ErrorException))
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
+ CatchException(exception);
(*fail)++;
continue;
}
{
char
**arguments,
- command[MaxTextExtent];
+ command[MagickPathExtent];
int
number_arguments;
CatchException(exception);
(void) FormatLocaleFile(stdout," test %.20g: %s",(double) (test++),
montage_options[i]);
- (void) FormatLocaleString(command,MaxTextExtent,"%s %s %s %s",
+ (void) FormatLocaleString(command,MagickPathExtent,"%s %s %s %s",
reference_filename,montage_options[i],reference_filename,
output_filename);
arguments=StringToArgv(command,&number_arguments);
for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
- if (status != MagickFalse)
+ if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
{
char
**arguments,
- command[MaxTextExtent];
+ command[MagickPathExtent];
int
number_arguments;
CatchException(exception);
(void) FormatLocaleFile(stdout," test %.20g: %s",(double) (test++),
stream_options[i]);
- (void) FormatLocaleString(command,MaxTextExtent,"%s %s %s",
+ (void) FormatLocaleString(command,MagickPathExtent,"%s %s %s",
stream_options[i],reference_filename,output_filename);
arguments=StringToArgv(command,&number_arguments);
if (arguments == (char **) NULL)
for (j=0; j < (ssize_t) number_arguments; j++)
arguments[j]=DestroyString(arguments[j]);
arguments=(char **) RelinquishMagickMemory(arguments);
- if (status != MagickFalse)
+ if (status == MagickFalse)
{
(void) FormatLocaleFile(stdout,"... fail @ %s/%s/%lu.\n",
GetMagickModule());
}
char
- output_filename[MaxTextExtent],
- reference_filename[MaxTextExtent],
+ output_filename[MagickPathExtent],
+ reference_filename[MagickPathExtent],
*option;
double
(void) regard_warnings;
exception=AcquireExceptionInfo();
image_info=AcquireImageInfo();
- (void) CopyMagickString(image_info->filename,ReferenceFilename,MaxTextExtent);
+ (void) CopyMagickString(image_info->filename,ReferenceFilename,
+ MagickPathExtent);
for (i=1; i < (ssize_t) argc; i++)
{
option=argv[i];
if (IsCommandOption(option) == MagickFalse)
{
- (void) CopyMagickString(image_info->filename,option,MaxTextExtent);
+ (void) CopyMagickString(image_info->filename,option,MagickPathExtent);
continue;
}
switch (*(option+1))
if (*option == '+')
break;
i++;
- if (i == (ssize_t) argc)
+ if (i >= (ssize_t) argc)
ThrowValidateException(OptionError,"MissingArgument",option);
validate=ParseCommandOption(MagickValidateOptions,MagickFalse,
argv[i]);
{
if (LocaleCompare(image_info->filename,ReferenceFilename) == 0)
(void) CopyMagickString(reference_image->magick,ReferenceImageFormat,
- MaxTextExtent);
+ MagickPathExtent);
(void) AcquireUniqueFilename(reference_filename);
(void) AcquireUniqueFilename(output_filename);
(void) CopyMagickString(reference_image->filename,reference_filename,
- MaxTextExtent);
+ MagickPathExtent);
status=WriteImage(image_info,reference_image,exception);
reference_image=DestroyImage(reference_image);
if (status == MagickFalse)