mirror of
https://github.com/ImageMagick/ImageMagick.git
synced 2026-05-31 11:18:42 +02:00
...
This commit is contained in:
+5
-5
@@ -515,7 +515,7 @@ static inline MagickBooleanType IsFxFunction(const char *expression,
|
||||
return(MagickFalse);
|
||||
c=expression[length];
|
||||
if ((LocaleNCompare(expression,name,length) == 0) &&
|
||||
((isspace(c) == 0) || (c == '(')))
|
||||
((isspace((int) ((unsigned char) c)) == 0) || (c == '(')))
|
||||
return(MagickTrue);
|
||||
return(MagickFalse);
|
||||
}
|
||||
@@ -1257,7 +1257,7 @@ static const char *FxOperatorPrecedence(const char *expression,
|
||||
case 'E':
|
||||
case 'e':
|
||||
{
|
||||
if ((isdigit(c) != 0) &&
|
||||
if ((isdigit((int) ((unsigned char) c)) != 0) &&
|
||||
((LocaleNCompare(expression,"E+",2) == 0) ||
|
||||
(LocaleNCompare(expression,"E-",2) == 0)))
|
||||
{
|
||||
@@ -1307,11 +1307,11 @@ static const char *FxOperatorPrecedence(const char *expression,
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (((c != 0) && ((isdigit(c) != 0) ||
|
||||
if (((c != 0) && ((isdigit((int) ((unsigned char) c)) != 0) ||
|
||||
(strchr(")",c) != (char *) NULL))) &&
|
||||
(((islower((int) ((unsigned char) *expression)) != 0) ||
|
||||
(strchr("(",(int) ((unsigned char) *expression)) != (char *) NULL)) ||
|
||||
((isdigit(c) == 0) &&
|
||||
((isdigit((int) ((unsigned char) c)) == 0) &&
|
||||
(isdigit((int) ((unsigned char) *expression)) != 0))) &&
|
||||
(strchr("xy",(int) ((unsigned char) *expression)) == (char *) NULL))
|
||||
precedence=MultiplyPrecedence;
|
||||
@@ -1328,7 +1328,7 @@ static const char *FxOperatorPrecedence(const char *expression,
|
||||
case '-':
|
||||
{
|
||||
if ((strchr("(+-/*%:&^|<>~,",c) == (char *) NULL) ||
|
||||
(isalpha(c) != 0))
|
||||
(isalpha((int) ((unsigned char) c)) != 0))
|
||||
precedence=AdditionPrecedence;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -900,7 +900,7 @@ MagickExport MagickStatusType ParseGeometry(const char *geometry,
|
||||
for (p=pedantic_geometry; *p != '\0'; )
|
||||
{
|
||||
c=(int) ((unsigned char) *p);
|
||||
if (isspace(c) != 0)
|
||||
if (isspace((int) ((unsigned char) c)) != 0)
|
||||
{
|
||||
(void) CopyMagickString(p,p+1,MagickPathExtent);
|
||||
continue;
|
||||
|
||||
+2
-2
@@ -1482,9 +1482,9 @@ MagickExport int LocaleLowercase(const int c)
|
||||
return(c);
|
||||
#if defined(MAGICKCORE_LOCALE_SUPPORT)
|
||||
if (c_locale != (locale_t) NULL)
|
||||
return(tolower_l(c,c_locale));
|
||||
return(tolower_l((int) ((unsigned char) c),c_locale));
|
||||
#endif
|
||||
return(tolower(c));
|
||||
return(tolower((int) ((unsigned char) c)));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+22
-27
@@ -221,8 +221,7 @@ static void
|
||||
% The format of the Classify method is:
|
||||
%
|
||||
% MagickBooleanType Classify(Image *image,short **extrema,
|
||||
% const double cluster_threshold,
|
||||
% const double weighting_exponent,
|
||||
% const double cluster_threshold,const double weighting_exponent,
|
||||
% const MagickBooleanType verbose,ExceptionInfo *exception)
|
||||
%
|
||||
% A description of each parameter follows.
|
||||
@@ -246,9 +245,8 @@ static void
|
||||
%
|
||||
*/
|
||||
static MagickBooleanType Classify(Image *image,short **extrema,
|
||||
const double cluster_threshold,
|
||||
const double weighting_exponent,const MagickBooleanType verbose,
|
||||
ExceptionInfo *exception)
|
||||
const double cluster_threshold,const double weighting_exponent,
|
||||
const MagickBooleanType verbose,ExceptionInfo *exception)
|
||||
{
|
||||
#define SegmentImageTag "Segment/Image"
|
||||
#define ThrowClassifyException(severity,tag,label) \
|
||||
@@ -276,6 +274,9 @@ static MagickBooleanType Classify(Image *image,short **extrema,
|
||||
*last_cluster,
|
||||
*next_cluster;
|
||||
|
||||
double
|
||||
*free_squares;
|
||||
|
||||
ExtentPacket
|
||||
blue,
|
||||
green,
|
||||
@@ -284,9 +285,6 @@ static MagickBooleanType Classify(Image *image,short **extrema,
|
||||
MagickOffsetType
|
||||
progress;
|
||||
|
||||
double
|
||||
*free_squares;
|
||||
|
||||
MagickStatusType
|
||||
status;
|
||||
|
||||
@@ -340,11 +338,10 @@ static MagickBooleanType Classify(Image *image,short **extrema,
|
||||
/*
|
||||
Initialize a new class.
|
||||
*/
|
||||
cluster->count=0;
|
||||
(void) memset(cluster,0,sizeof(*cluster));
|
||||
cluster->red=red;
|
||||
cluster->green=green;
|
||||
cluster->blue=blue;
|
||||
cluster->next=(Cluster *) NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -360,11 +357,10 @@ static MagickBooleanType Classify(Image *image,short **extrema,
|
||||
/*
|
||||
Initialize a new class.
|
||||
*/
|
||||
cluster->count=0;
|
||||
(void) memset(cluster,0,sizeof(*cluster));
|
||||
cluster->red=red;
|
||||
cluster->green=green;
|
||||
cluster->blue=blue;
|
||||
cluster->next=(Cluster *) NULL;
|
||||
head=cluster;
|
||||
}
|
||||
/*
|
||||
@@ -1512,6 +1508,13 @@ static double OptimalTau(const ssize_t *histogram,const double max_tau,
|
||||
const double min_tau,const double delta_tau,const double smooth_threshold,
|
||||
short *extrema)
|
||||
{
|
||||
double
|
||||
average_tau,
|
||||
*derivative,
|
||||
*second_derivative,
|
||||
tau,
|
||||
value;
|
||||
|
||||
IntervalTree
|
||||
**list,
|
||||
*node,
|
||||
@@ -1520,13 +1523,6 @@ static double OptimalTau(const ssize_t *histogram,const double max_tau,
|
||||
MagickBooleanType
|
||||
peak;
|
||||
|
||||
double
|
||||
average_tau,
|
||||
*derivative,
|
||||
*second_derivative,
|
||||
tau,
|
||||
value;
|
||||
|
||||
register ssize_t
|
||||
i,
|
||||
x;
|
||||
@@ -1732,8 +1728,7 @@ static void ScaleSpace(const ssize_t *histogram,const double tau,
|
||||
|
||||
gamma=(double *) AcquireQuantumMemory(256,sizeof(*gamma));
|
||||
if (gamma == (double *) NULL)
|
||||
ThrowFatalException(ResourceLimitFatalError,
|
||||
"UnableToAllocateGammaMap");
|
||||
ThrowFatalException(ResourceLimitFatalError,"UnableToAllocateGammaMap");
|
||||
alpha=PerceptibleReciprocal(tau*sqrt(2.0*MagickPI));
|
||||
beta=(-1.0*PerceptibleReciprocal(2.0*tau*tau));
|
||||
for (x=0; x <= 255; x++)
|
||||
@@ -1844,12 +1839,12 @@ MagickExport MagickBooleanType SegmentImage(Image *image,
|
||||
previous_colorspace=image->colorspace;
|
||||
(void) TransformImageColorspace(image,colorspace,exception);
|
||||
InitializeHistogram(image,histogram,exception);
|
||||
(void) OptimalTau(histogram[Red],Tau,0.2,DeltaTau,
|
||||
smooth_threshold == 0.0 ? 1.0 : smooth_threshold,extrema[Red]);
|
||||
(void) OptimalTau(histogram[Green],Tau,0.2,DeltaTau,
|
||||
smooth_threshold == 0.0 ? 1.0 : smooth_threshold,extrema[Green]);
|
||||
(void) OptimalTau(histogram[Blue],Tau,0.2,DeltaTau,
|
||||
smooth_threshold == 0.0 ? 1.0 : smooth_threshold,extrema[Blue]);
|
||||
(void) OptimalTau(histogram[Red],Tau,0.2,DeltaTau,smooth_threshold == 0.0 ?
|
||||
1.0 : smooth_threshold,extrema[Red]);
|
||||
(void) OptimalTau(histogram[Green],Tau,0.2,DeltaTau,smooth_threshold == 0.0 ?
|
||||
1.0 : smooth_threshold,extrema[Green]);
|
||||
(void) OptimalTau(histogram[Blue],Tau,0.2,DeltaTau,smooth_threshold == 0.0 ?
|
||||
1.0 : smooth_threshold,extrema[Blue]);
|
||||
/*
|
||||
Classify using the fuzzy c-Means technique.
|
||||
*/
|
||||
|
||||
+5
-5
@@ -197,7 +197,7 @@ static Image *ReadHDRImage(const ImageInfo *image_info,ExceptionInfo *exception)
|
||||
image=DestroyImage(image);
|
||||
return((Image *) NULL);
|
||||
}
|
||||
while (isgraph(c) && (image->columns == 0) && (image->rows == 0))
|
||||
while (isgraph((int) ((unsigned char) c)) && (image->columns == 0) && (image->rows == 0))
|
||||
{
|
||||
if (c == (int) '#')
|
||||
{
|
||||
@@ -240,7 +240,7 @@ static Image *ReadHDRImage(const ImageInfo *image_info,ExceptionInfo *exception)
|
||||
c=ReadBlobByte(image);
|
||||
}
|
||||
else
|
||||
if (isalnum(c) == MagickFalse)
|
||||
if (isalnum((int) ((unsigned char) c)) == 0)
|
||||
c=ReadBlobByte(image);
|
||||
else
|
||||
{
|
||||
@@ -256,10 +256,10 @@ static Image *ReadHDRImage(const ImageInfo *image_info,ExceptionInfo *exception)
|
||||
if ((size_t) (p-keyword) < (MagickPathExtent-1))
|
||||
*p++=c;
|
||||
c=ReadBlobByte(image);
|
||||
} while (isalnum(c) || (c == '_'));
|
||||
} while (isalnum((int) ((unsigned char) c)) || (c == '_'));
|
||||
*p='\0';
|
||||
value_expected=MagickFalse;
|
||||
while ((isspace(c) != 0) || (c == '='))
|
||||
while ((isspace((int) ((unsigned char) c)) != 0) || (c == '='))
|
||||
{
|
||||
if (c == '=')
|
||||
value_expected=MagickTrue;
|
||||
@@ -371,7 +371,7 @@ static Image *ReadHDRImage(const ImageInfo *image_info,ExceptionInfo *exception)
|
||||
}
|
||||
}
|
||||
if ((image->columns == 0) && (image->rows == 0))
|
||||
while (isspace(c) != 0)
|
||||
while (isspace((int) ((unsigned char) c)) != 0)
|
||||
c=ReadBlobByte(image);
|
||||
}
|
||||
if ((LocaleCompare(format,"32-bit_rle_rgbe") != 0) &&
|
||||
|
||||
+4
-4
@@ -161,7 +161,7 @@ static const struct
|
||||
|
||||
static int stringnicmp(const char *p,const char *q,size_t n)
|
||||
{
|
||||
register ssize_t
|
||||
int
|
||||
i,
|
||||
j;
|
||||
|
||||
@@ -176,10 +176,10 @@ static int stringnicmp(const char *p,const char *q,size_t n)
|
||||
if ((*p == '\0') || (*q == '\0'))
|
||||
break;
|
||||
i=(*p);
|
||||
if (islower(i))
|
||||
if (islower((int) ((unsigned char) i)) != 0)
|
||||
i=LocaleUppercase(i);
|
||||
j=(*q);
|
||||
if (islower(j))
|
||||
if (islower((int) ((unsigned char) j)) != 0)
|
||||
j=LocaleUppercase(j);
|
||||
if (i != j)
|
||||
break;
|
||||
@@ -1800,7 +1800,7 @@ static void formatString(Image *ofile, const char *s, int len)
|
||||
(void) WriteBlobString(ofile,""");
|
||||
break;
|
||||
default:
|
||||
if (isprint(c))
|
||||
if (isprint((int) ((unsigned char) c)) != 0)
|
||||
(void) WriteBlobByte(ofile,(unsigned char) *s);
|
||||
else
|
||||
{
|
||||
|
||||
+3
-3
@@ -550,7 +550,7 @@ static Image *ReadMIFFImage(const ImageInfo *image_info,
|
||||
colors=0;
|
||||
image->depth=8UL;
|
||||
image->compression=NoCompression;
|
||||
while ((isgraph(c) != MagickFalse) && (c != (int) ':'))
|
||||
while ((isgraph((int) ((unsigned char) c)) != 0) && (c != (int) ':'))
|
||||
{
|
||||
register char
|
||||
*p;
|
||||
@@ -596,7 +596,7 @@ static Image *ReadMIFFImage(const ImageInfo *image_info,
|
||||
c=ReadBlobByte(image);
|
||||
}
|
||||
else
|
||||
if (isalnum(c) != MagickFalse)
|
||||
if (isalnum((int) ((unsigned char) c)) != MagickFalse)
|
||||
{
|
||||
/*
|
||||
Get the keyword.
|
||||
@@ -1700,7 +1700,7 @@ static Image *ReadMIFFImage(const ImageInfo *image_info,
|
||||
do
|
||||
{
|
||||
c=ReadBlobByte(image);
|
||||
} while ((isgraph(c) == MagickFalse) && (c != EOF));
|
||||
} while ((isgraph((int) ((unsigned char) c)) == 0) && (c != EOF));
|
||||
if (c != EOF)
|
||||
{
|
||||
/*
|
||||
|
||||
+6
-6
@@ -228,7 +228,7 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception)
|
||||
signature=GetMagickSignature((const StringInfo *) NULL);
|
||||
image->depth=8;
|
||||
image->compression=NoCompression;
|
||||
while ((isgraph(c) != MagickFalse) && (c != (int) ':'))
|
||||
while ((isgraph((int) ((unsigned char) c)) != 0) && (c != (int) ':'))
|
||||
{
|
||||
register char
|
||||
*p;
|
||||
@@ -275,7 +275,7 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception)
|
||||
c=ReadBlobByte(image);
|
||||
}
|
||||
else
|
||||
if (isalnum(c) != MagickFalse)
|
||||
if (isalnum((int) ((unsigned char) c)) != MagickFalse)
|
||||
{
|
||||
/*
|
||||
Get the keyword.
|
||||
@@ -292,7 +292,7 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception)
|
||||
} while (c != EOF);
|
||||
*p='\0';
|
||||
p=options;
|
||||
while (isspace(c) != 0)
|
||||
while (isspace((int) ((unsigned char) c)) != 0)
|
||||
c=ReadBlobByte(image);
|
||||
if (c == (int) '=')
|
||||
{
|
||||
@@ -324,7 +324,7 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception)
|
||||
}
|
||||
}
|
||||
if (*options != '{')
|
||||
if (isspace(c) != 0)
|
||||
if (isspace((int) ((unsigned char) c)) != 0)
|
||||
break;
|
||||
}
|
||||
if (options == (char *) NULL)
|
||||
@@ -775,7 +775,7 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception)
|
||||
}
|
||||
else
|
||||
c=ReadBlobByte(image);
|
||||
while (isspace(c) != 0)
|
||||
while (isspace((int) ((unsigned char) c)) != 0)
|
||||
c=ReadBlobByte(image);
|
||||
}
|
||||
options=DestroyString(options);
|
||||
@@ -1006,7 +1006,7 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception)
|
||||
do
|
||||
{
|
||||
c=ReadBlobByte(image);
|
||||
} while ((isgraph(c) == MagickFalse) && (c != EOF));
|
||||
} while ((isgraph((int) ((unsigned char) c)) == 0) && (c != EOF));
|
||||
if (c != EOF)
|
||||
{
|
||||
/*
|
||||
|
||||
+1
-1
@@ -292,7 +292,7 @@ static void ReadPDFInfo(const ImageInfo *image_info,Image *image,
|
||||
SkipMagickByteBuffer(&buffer,strlen(SpotColor)+1);
|
||||
for (c=ReadMagickByteBuffer(&buffer); c != EOF; c=ReadMagickByteBuffer(&buffer))
|
||||
{
|
||||
if ((isspace(c) != 0) || (c == '/') || ((i+1) == MagickPathExtent))
|
||||
if ((isspace((int) ((unsigned char) c)) != 0) || (c == '/') || ((i+1) == MagickPathExtent))
|
||||
break;
|
||||
name[i++]=(char) c;
|
||||
}
|
||||
|
||||
+6
-6
@@ -211,7 +211,7 @@ static unsigned int PNMInteger(Image *image,CommentInfo *comment_info,
|
||||
Evaluate number.
|
||||
*/
|
||||
value=0;
|
||||
while (isdigit(c) != 0)
|
||||
while (isdigit((int) ((unsigned char) c)) != 0)
|
||||
{
|
||||
if (value <= (unsigned int) (INT_MAX/10))
|
||||
{
|
||||
@@ -380,7 +380,7 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
|
||||
*/
|
||||
for (c=ReadBlobByte(image); c != EOF; c=ReadBlobByte(image))
|
||||
{
|
||||
while (isspace(c) != 0)
|
||||
while (isspace((int) ((unsigned char) c)) != 0)
|
||||
c=ReadBlobByte(image);
|
||||
if (c == '#')
|
||||
{
|
||||
@@ -389,7 +389,7 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
|
||||
*/
|
||||
c=PNMComment(image,&comment_info,exception);
|
||||
c=ReadBlobByte(image);
|
||||
while (isspace(c) != 0)
|
||||
while (isspace((int) ((unsigned char) c)) != 0)
|
||||
c=ReadBlobByte(image);
|
||||
}
|
||||
p=keyword;
|
||||
@@ -398,14 +398,14 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
|
||||
if ((size_t) (p-keyword) < (MagickPathExtent-1))
|
||||
*p++=c;
|
||||
c=ReadBlobByte(image);
|
||||
} while (isalnum(c));
|
||||
} while (isalnum((int) ((unsigned char) c)));
|
||||
*p='\0';
|
||||
if (LocaleCompare(keyword,"endhdr") == 0)
|
||||
break;
|
||||
while (isspace(c) != 0)
|
||||
while (isspace((int) ((unsigned char) c)) != 0)
|
||||
c=ReadBlobByte(image);
|
||||
p=value;
|
||||
while (isalnum(c) || (c == '_'))
|
||||
while (isalnum((int) ((unsigned char) c)) || (c == '_'))
|
||||
{
|
||||
if ((size_t) (p-value) < (MagickPathExtent-1))
|
||||
*p++=c;
|
||||
|
||||
+1
-1
@@ -385,7 +385,7 @@ static void ReadPSInfo(const ImageInfo *image_info,Image *image,
|
||||
i=0;
|
||||
for (c=ReadMagickByteBuffer(&buffer); c != EOF; c=ReadMagickByteBuffer(&buffer))
|
||||
{
|
||||
if ((isspace(c) != 0) || ((i+1) == sizeof(name)))
|
||||
if ((isspace((int) ((unsigned char) c)) != 0) || ((i+1) == sizeof(name)))
|
||||
break;
|
||||
name[i++]=(char) c;
|
||||
}
|
||||
|
||||
+6
-6
@@ -208,9 +208,9 @@ static Image *ReadVICARImage(const ImageInfo *image_info,
|
||||
length=0;
|
||||
image->columns=0;
|
||||
image->rows=0;
|
||||
while (isgraph(c) && ((image->columns == 0) || (image->rows == 0)))
|
||||
while (isgraph((int) ((unsigned char) c)) && ((image->columns == 0) || (image->rows == 0)))
|
||||
{
|
||||
if (isalnum(c) == MagickFalse)
|
||||
if (isalnum((int) ((unsigned char) c)) == MagickFalse)
|
||||
{
|
||||
c=ReadBlobByte(image);
|
||||
count++;
|
||||
@@ -230,10 +230,10 @@ static Image *ReadVICARImage(const ImageInfo *image_info,
|
||||
*p++=c;
|
||||
c=ReadBlobByte(image);
|
||||
count++;
|
||||
} while (isalnum(c) || (c == '_'));
|
||||
} while (isalnum((int) ((unsigned char) c)) || (c == '_'));
|
||||
*p='\0';
|
||||
value_expected=MagickFalse;
|
||||
while ((isspace(c) != 0) || (c == '='))
|
||||
while ((isspace((int) ((unsigned char) c)) != 0) || (c == '='))
|
||||
{
|
||||
if (c == '=')
|
||||
value_expected=MagickTrue;
|
||||
@@ -243,7 +243,7 @@ static Image *ReadVICARImage(const ImageInfo *image_info,
|
||||
if (value_expected == MagickFalse)
|
||||
continue;
|
||||
p=value;
|
||||
while (isalnum(c))
|
||||
while (isalnum((int) ((unsigned char) c)))
|
||||
{
|
||||
if ((size_t) (p-value) < (MagickPathExtent-1))
|
||||
*p++=c;
|
||||
@@ -270,7 +270,7 @@ static Image *ReadVICARImage(const ImageInfo *image_info,
|
||||
if (LocaleCompare(keyword,"NL") == 0)
|
||||
image->rows=StringToUnsignedLong(value);
|
||||
}
|
||||
while (isspace(c) != 0)
|
||||
while (isspace((int) ((unsigned char) c)) != 0)
|
||||
{
|
||||
c=ReadBlobByte(image);
|
||||
count++;
|
||||
|
||||
+1
-1
@@ -741,7 +741,7 @@
|
||||
/* Define if you have JPEG library */
|
||||
#undef JPEG_DELEGATE
|
||||
|
||||
/* Define if you have brunsli library */
|
||||
/* Define if you have jpeg-xl library */
|
||||
#undef JXL_DELEGATE
|
||||
|
||||
/* Define if you have LCMS library */
|
||||
|
||||
Reference in New Issue
Block a user