From: Cristy Date: Wed, 31 Jul 2019 19:55:08 +0000 (-0400) Subject: https://github.com/ImageMagick/ImageMagick/issues/1650 X-Git-Tag: 7.0.8-59~22 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3175621ed5442e8f353e0f9db1da5a7bfb07b928;p=imagemagick https://github.com/ImageMagick/ImageMagick/issues/1650 --- diff --git a/Magick++/fuzz/encoder_list.cc b/Magick++/fuzz/encoder_list.cc index f9fc257a1..ca54e814d 100644 --- a/Magick++/fuzz/encoder_list.cc +++ b/Magick++/fuzz/encoder_list.cc @@ -5,11 +5,11 @@ #include #include -static std::string getInitializer(const std::string module) +static std::string getInitializer(const std::string magick_module) { - if ((module == "BGR") || (module == "CMYK") || (module =="RGB") || (module =="YUV")) + if ((magick_module == "BGR") || (magick_module == "CMYK") || (magick_module =="RGB") || (magick_module =="YUV")) return "interlace"; - if (module == "PNG") + if (magick_module == "PNG") return "png"; return ""; } @@ -53,13 +53,13 @@ int main() { for (std::list::iterator it = coderList.begin(); it != coderList.end(); it++) { - std::string module=(*it).module(); - if (std::find(excludeList.begin(), excludeList.end(), module) != excludeList.end()) + std::string magick_module=(*it).magick_module(); + if (std::find(excludeList.begin(), excludeList.end(), magick_module) != excludeList.end()) continue; - if ((*it).name() == module) - std::cout << ((*it).isWritable() ? "+" : "-") << module << ":" << getInitializer(module) << std::endl; - else if (std::find(allowedNames.begin(), allowedNames.end(), module) != allowedNames.end()) - std::cout << ((*it).isWritable() ? "+" : "-") << (*it).name() << ":" << getInitializer(module) << std::endl; + if ((*it).name() == magick_module) + std::cout << ((*it).isWritable() ? "+" : "-") << magick_module << ":" << getInitializer(magick_module) << std::endl; + else if (std::find(allowedNames.begin(), allowedNames.end(), magick_module) != allowedNames.end()) + std::cout << ((*it).isWritable() ? "+" : "-") << (*it).name() << ":" << getInitializer(magick_module) << std::endl; } } diff --git a/Magick++/lib/CoderInfo.cpp b/Magick++/lib/CoderInfo.cpp index 1154e794a..425eb2907 100644 --- a/Magick++/lib/CoderInfo.cpp +++ b/Magick++/lib/CoderInfo.cpp @@ -75,7 +75,7 @@ Magick::CoderInfo::CoderInfo(const std::string &name_) NULL) ? false : true); _mimeType=std::string(magickInfo->mime_type != (char *) NULL ? magickInfo->mime_type : ""); - _module=std::string(magickInfo->module); + _module=std::string(magickInfo->magick_module); _name=std::string(magickInfo->name); } } @@ -150,4 +150,4 @@ std::string Magick::CoderInfo::name(void) const bool Magick::CoderInfo::unregister(void) const { return(UnregisterMagickInfo(_name.c_str()) != MagickFalse); -} \ No newline at end of file +} diff --git a/MagickCore/annotate.c b/MagickCore/annotate.c index 28d864b79..61af882d6 100644 --- a/MagickCore/annotate.c +++ b/MagickCore/annotate.c @@ -276,7 +276,7 @@ MagickExport MagickBooleanType AnnotateImage(Image *image, for (p=text; *p != '\0'; p++) if (*p == '\n') number_lines++; - textlist=AcquireQuantumMemory(number_lines+1,sizeof(*textlist)); + textlist=(char **) AcquireQuantumMemory(number_lines+1,sizeof(*textlist)); if (textlist == (char **) NULL) { annotate_info=DestroyDrawInfo(annotate_info); @@ -285,7 +285,7 @@ MagickExport MagickBooleanType AnnotateImage(Image *image, return(MagickFalse); } p=text; - for (i=0; i < number_lines; i++) + for (i=0; i < (ssize_t) number_lines; i++) { char *q; diff --git a/MagickCore/image.c b/MagickCore/image.c index 169a4b1c8..b793d7909 100644 --- a/MagickCore/image.c +++ b/MagickCore/image.c @@ -3018,7 +3018,7 @@ MagickExport MagickBooleanType SetImageInfo(ImageInfo *image_info, */ if ((magick_info != (const MagickInfo *) NULL) && (GetMagickUseExtension(magick_info) != MagickFalse) && - (LocaleCompare(magick_info->module,GetMagicName( + (LocaleCompare(magick_info->magick_module,GetMagicName( magic_info)) == 0)) (void) CopyMagickString(image_info->magick,magick_info->name, MagickPathExtent); diff --git a/MagickCore/magick.c b/MagickCore/magick.c index ce7bb9b9f..376825807 100644 --- a/MagickCore/magick.c +++ b/MagickCore/magick.c @@ -164,11 +164,12 @@ static MagickBooleanType % % The format of the AcquireMagickInfo method is: % -% MagickInfo *AcquireMagickInfo(const char *module, const char *name,) +% MagickInfo *AcquireMagickInfo(const char *magick_module, +% const char *name,const char *description) % % A description of each parameter follows: % -% o module: a character string that represents the module associated +% o magick_module: a character string that represents the module associated % with the MagickInfo structure. % % o name: a character string that represents the image format associated @@ -178,19 +179,19 @@ static MagickBooleanType % associated with the MagickInfo structure. % */ -MagickExport MagickInfo *AcquireMagickInfo(const char *module,const char *name, - const char *description) +MagickExport MagickInfo *AcquireMagickInfo(const char *magick_module, + const char *name,const char *description) { MagickInfo *magick_info; - assert(module != (const char *) NULL); + assert(magick_module != (const char *) NULL); assert(name != (const char *) NULL); assert(description != (const char *) NULL); (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",name); magick_info=(MagickInfo *) AcquireCriticalMemory(sizeof(*magick_info)); (void) memset(magick_info,0,sizeof(*magick_info)); - magick_info->module=ConstantString(module); + magick_info->magick_module=ConstantString(magick_module); magick_info->name=ConstantString(name); magick_info->description=ConstantString(description); magick_info->flags=CoderAdjoinFlag | CoderBlobSupportFlag | @@ -1015,8 +1016,8 @@ static void *DestroyMagickNode(void *magick_info) *p; p=(MagickInfo *) magick_info; - if (p->module != (char *) NULL) - p->module=DestroyString(p->module); + if (p->magick_module != (char *) NULL) + p->magick_module=DestroyString(p->magick_module); if (p->note != (char *) NULL) p->note=DestroyString(p->note); if (p->mime_type != (char *) NULL) @@ -1153,14 +1154,16 @@ MagickExport MagickBooleanType ListMagickInfo(FILE *file, #if defined(MAGICKCORE_MODULES_SUPPORT) { char - module[MagickPathExtent]; + magick_module[MagickPathExtent]; - *module='\0'; - if (magick_info[i]->module != (char *) NULL) - (void) CopyMagickString(module,magick_info[i]->module,MagickPathExtent); - (void) ConcatenateMagickString(module," ",MagickPathExtent); - module[9]='\0'; - (void) FormatLocaleFile(file,"%9s ",module); + *magick_module='\0'; + if (magick_info[i]->magick_module != (char *) NULL) + (void) CopyMagickString(magick_module,magick_info[i]->magick_module, + MagickPathExtent); + (void) ConcatenateMagickString(magick_module," ", + MagickPathExtent); + magick_module[9]='\0'; + (void) FormatLocaleFile(file,"%9s ",magick_module); } #endif (void) FormatLocaleFile(file,"%c%c%c ",magick_info[i]->decoder ? 'r' : '-', diff --git a/MagickCore/magick.h b/MagickCore/magick.h index 2e8a59bcd..4bfb15fde 100644 --- a/MagickCore/magick.h +++ b/MagickCore/magick.h @@ -66,7 +66,7 @@ typedef struct _MagickInfo *version, *mime_type, *note, - *module; + *magick_module; DecodeImageHandler *decoder; diff --git a/MagickCore/studio.h b/MagickCore/studio.h index 06c772f0e..35d87f82c 100644 --- a/MagickCore/studio.h +++ b/MagickCore/studio.h @@ -55,6 +55,12 @@ extern "C" { # define STDC #endif +#if defined(__cplusplus) || defined(c_plusplus) +# define magick_module _module /* reserved word in C++(20) */ +#else +# define magick_module module +#endif + #include #include #if defined(MAGICKCORE_HAVE_SYS_STAT_H) diff --git a/MagickCore/type.c b/MagickCore/type.c index 0d9a1e5ed..3843449d5 100644 --- a/MagickCore/type.c +++ b/MagickCore/type.c @@ -474,7 +474,7 @@ MagickExport const TypeInfo *GetTypeInfoByFamily(const char *family, /* Check for table-based substitution match. */ - for (i=0; i < (sizeof(fontmap)/sizeof(fontmap[0])); i++) + for (i=0; i < (ssize_t) (sizeof(fontmap)/sizeof(fontmap[0])); i++) { if (family == (const char *) NULL) { diff --git a/MagickWand/studio.h b/MagickWand/studio.h index 4df26bb08..3879e4ff7 100644 --- a/MagickWand/studio.h +++ b/MagickWand/studio.h @@ -51,12 +51,6 @@ extern "C" { # define STDC #endif -#if defined(__cplusplus) || defined(c_plusplus) -# define storage_class c_class -#else -# define storage_class class -#endif - #include #include #if defined(MAGICKCORE_HAVE_SYS_STAT_H) diff --git a/MagickWand/wandcli.c b/MagickWand/wandcli.c index 042a9396e..cf3be4970 100644 --- a/MagickWand/wandcli.c +++ b/MagickWand/wandcli.c @@ -271,7 +271,7 @@ WandExport MagickBooleanType CLICatchException(MagickCLI *cli_wand, % */ WandExport MagickBooleanType CLILogEvent(MagickCLI *cli_wand, - const LogEventType type,const char *module,const char *function, + const LogEventType type,const char *magick_module,const char *function, const size_t line,const char *format,...) { char @@ -297,7 +297,8 @@ WandExport MagickBooleanType CLILogEvent(MagickCLI *cli_wand, (void) ConcatenateMagickString(new_format,format,MagickPathExtent); va_start(operands,format); - status=LogMagickEventList(type,module,function,line,new_format,operands); + status=LogMagickEventList(type,magick_module,function,line,new_format, + operands); va_end(operands); return(status); @@ -318,7 +319,7 @@ WandExport MagickBooleanType CLILogEvent(MagickCLI *cli_wand, % it the location of the option that caused the exception to occur. */ WandExport MagickBooleanType CLIThrowException(MagickCLI *cli_wand, - const char *module,const char *function,const size_t line, + const char *magick_module,const char *function,const size_t line, const ExceptionType severity,const char *tag,const char *format,...) { char @@ -346,8 +347,8 @@ WandExport MagickBooleanType CLIThrowException(MagickCLI *cli_wand, cli_wand->location,cli_wand->filename,cli_wand->line,cli_wand->column); va_start(operands,format); - status=ThrowMagickExceptionList(cli_wand->wand.exception,module,function, - line,severity,tag,new_format,operands); + status=ThrowMagickExceptionList(cli_wand->wand.exception,magick_module, + function,line,severity,tag,new_format,operands); va_end(operands); return(status); } diff --git a/PerlMagick/Magick.xs b/PerlMagick/Magick.xs index f63c7ecb5..3d066bebc 100644 --- a/PerlMagick/Magick.xs +++ b/PerlMagick/Magick.xs @@ -13610,10 +13610,10 @@ QueryFormat(ref,...) PUSHs(&sv_undef); else PUSHs(sv_2mortal(newSVpv(magick_info->description,0))); - if (magick_info->module == (char *) NULL) + if (magick_info->magick_module == (char *) NULL) PUSHs(&sv_undef); else - PUSHs(sv_2mortal(newSVpv(magick_info->module,0))); + PUSHs(sv_2mortal(newSVpv(magick_info->magick_module,0))); } PerlException: diff --git a/PerlMagick/quantum/quantum.xs.in b/PerlMagick/quantum/quantum.xs.in index c70f208fb..5ff0df066 100644 --- a/PerlMagick/quantum/quantum.xs.in +++ b/PerlMagick/quantum/quantum.xs.in @@ -13727,10 +13727,10 @@ QueryFormat(ref,...) PUSHs(&sv_undef); else PUSHs(sv_2mortal(newSVpv(magick_info->description,0))); - if (magick_info->module == (char *) NULL) + if (magick_info->magick_module == (char *) NULL) PUSHs(&sv_undef); else - PUSHs(sv_2mortal(newSVpv(magick_info->module,0))); + PUSHs(sv_2mortal(newSVpv(magick_info->magick_module,0))); } PerlException: diff --git a/coders/bytebuffer-private.h b/coders/bytebuffer-private.h index cc2bde863..f53b5ee1f 100644 --- a/coders/bytebuffer-private.h +++ b/coders/bytebuffer-private.h @@ -94,7 +94,7 @@ static inline void SkipMagickByteBuffer(MagickByteBuffer *buffer, const size_t length) { CheckMagickByteBuffer(buffer,length); - if ((buffer->offset+length) < buffer->count) + if ((ssize_t) (buffer->offset+length) < buffer->count) buffer->offset+=length; } diff --git a/coders/tim2.c b/coders/tim2.c index adc16be99..4a61654c3 100644 --- a/coders/tim2.c +++ b/coders/tim2.c @@ -222,7 +222,7 @@ static inline void deshufflePalette(Image *image,PixelInfo* oldColormap) /* * Swap the 2nd and 3rd block in each page */ - for (page=0; page < pages; page++) + for (page=0; page < (ssize_t) pages; page++) { memcpy(&(image->colormap[i+1*colors]),&(oldColormap[i+2*colors]),colors* sizeof(PixelInfo)); @@ -547,7 +547,7 @@ static MagickBooleanType ReadTIM2ImageData(const ImageInfo *image_info, image->colormap[i].red=GetChannelValue(word,0,RGBA16); image->colormap[i].green=GetChannelValue(word,1,RGBA16); image->colormap[i].blue=GetChannelValue(word,2,RGBA16); - image->colormap[i].alpha=GetAlpha(word,16); + image->colormap[i].alpha=GetAlpha(word,RGBA16); p+=2; } break;