From 7bb5f4a8af64cc7fc4bc756cd8d075da7e0e874d Mon Sep 17 00:00:00 2001 From: Cristy Date: Sat, 26 Dec 2020 14:58:25 -0500 Subject: [PATCH] ... --- MagickCore/fx.c | 10 ++++----- MagickCore/geometry.c | 2 +- MagickCore/locale.c | 4 ++-- MagickCore/segment.c | 49 +++++++++++++++++++------------------------ coders/hdr.c | 10 ++++----- coders/meta.c | 8 +++---- coders/miff.c | 6 +++--- coders/mpc.c | 12 +++++------ coders/pdf.c | 2 +- coders/pnm.c | 12 +++++------ coders/ps.c | 2 +- coders/vicar.c | 12 +++++------ config/config.h.in | 2 +- configure | 2 +- 14 files changed, 64 insertions(+), 69 deletions(-) diff --git a/MagickCore/fx.c b/MagickCore/fx.c index 3d83953fc3..5208ae9c74 100644 --- a/MagickCore/fx.c +++ b/MagickCore/fx.c @@ -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; } diff --git a/MagickCore/geometry.c b/MagickCore/geometry.c index adcac54038..33881ad4d5 100644 --- a/MagickCore/geometry.c +++ b/MagickCore/geometry.c @@ -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; diff --git a/MagickCore/locale.c b/MagickCore/locale.c index 70ed2ca8a5..31d74b4fd7 100644 --- a/MagickCore/locale.c +++ b/MagickCore/locale.c @@ -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))); } /* diff --git a/MagickCore/segment.c b/MagickCore/segment.c index 4850053487..0a3f8896c9 100644 --- a/MagickCore/segment.c +++ b/MagickCore/segment.c @@ -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. */ diff --git a/coders/hdr.c b/coders/hdr.c index a40744c206..a33d6e28d5 100644 --- a/coders/hdr.c +++ b/coders/hdr.c @@ -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) && diff --git a/coders/meta.c b/coders/meta.c index 8045895aed..253717c819 100644 --- a/coders/meta.c +++ b/coders/meta.c @@ -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 { diff --git a/coders/miff.c b/coders/miff.c index cbcc50f959..1581eb622f 100644 --- a/coders/miff.c +++ b/coders/miff.c @@ -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) { /* diff --git a/coders/mpc.c b/coders/mpc.c index 92374172a3..178cfe256c 100644 --- a/coders/mpc.c +++ b/coders/mpc.c @@ -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) { /* diff --git a/coders/pdf.c b/coders/pdf.c index 714b3e4724..640b11ecca 100644 --- a/coders/pdf.c +++ b/coders/pdf.c @@ -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; } diff --git a/coders/pnm.c b/coders/pnm.c index 8261e65437..023413d00d 100644 --- a/coders/pnm.c +++ b/coders/pnm.c @@ -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; diff --git a/coders/ps.c b/coders/ps.c index 272e121a81..fdb4c26b40 100644 --- a/coders/ps.c +++ b/coders/ps.c @@ -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; } diff --git a/coders/vicar.c b/coders/vicar.c index 7c99e33272..313f4a8b79 100644 --- a/coders/vicar.c +++ b/coders/vicar.c @@ -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++; diff --git a/config/config.h.in b/config/config.h.in index c7b10b69e7..ec635b1f59 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -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 */ diff --git a/configure b/configure index e7a3349139..8d11f8bdc5 100755 --- a/configure +++ b/configure @@ -4576,7 +4576,7 @@ MAGICK_PATCHLEVEL_VERSION=54 MAGICK_VERSION=7.0.10-54 -MAGICK_GIT_REVISION=18090:69d041215:20201226 +MAGICK_GIT_REVISION=18091:b0314b270:20201226 # Substitute library versioning