From f432c635c526259b858c9aad3d409c5c44545686 Mon Sep 17 00:00:00 2001 From: cristy Date: Sun, 7 Dec 2014 15:11:28 +0000 Subject: [PATCH] --- MagickCore/accelerate.c | 14 +++++----- MagickCore/layer.c | 6 ++--- MagickCore/matrix.c | 2 +- MagickCore/morphology.c | 10 ++++---- MagickCore/nt-base.c | 4 +-- MagickCore/opencl.c | 4 +-- MagickCore/property.c | 28 ++++++++++---------- MagickCore/threshold.c | 6 ++--- MagickWand/magick-cli.c | 48 +++++++++++++++++------------------ MagickWand/mogrify.c | 12 ++++----- MagickWand/operation.c | 48 +++++++++++++++++------------------ MagickWand/script-token.c | 8 +++--- MagickWand/wandcli.c | 16 ++++++------ api_examples/cli_operators.c | 2 +- api_examples/cli_process.c | 4 +-- api_examples/magick_command.c | 2 +- coders/mat.c | 4 +-- coders/meta.c | 8 +++--- coders/msl.c | 4 +-- coders/pcx.c | 2 +- coders/pict.c | 3 ++- coders/psd.c | 10 +++++--- coders/wmf.c | 2 +- coders/wpg.c | 2 +- coders/xpm.c | 4 ++- tests/drawtest.c | 24 +++++++++--------- 26 files changed, 141 insertions(+), 136 deletions(-) diff --git a/MagickCore/accelerate.c b/MagickCore/accelerate.c index ac39ab9bc..ac37294e8 100644 --- a/MagickCore/accelerate.c +++ b/MagickCore/accelerate.c @@ -1060,7 +1060,7 @@ static Image *ComputeBlurImage(const Image* image,const ChannelType channel, clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(unsigned int),(void *)&kernelWidth); clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(unsigned int),(void *)&imageColumns); clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(unsigned int),(void *)&imageRows); - clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(CLPixelPacket)*(chunkSize+kernel->width),(void *)NULL); + clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(CLPixelPacket)*(chunkSize+kernel->width),(void *) NULL); if (clStatus != CL_SUCCESS) { (void) OpenCLThrowMagickException(exception, GetMagickModule(), ResourceLimitWarning, "clEnv->library->clSetKernelArg failed.", "'%s'", "."); @@ -1106,7 +1106,7 @@ static Image *ComputeBlurImage(const Image* image,const ChannelType channel, clStatus|=clEnv->library->clSetKernelArg(blurColumnKernel,i++,sizeof(unsigned int),(void *)&kernelWidth); clStatus|=clEnv->library->clSetKernelArg(blurColumnKernel,i++,sizeof(unsigned int),(void *)&imageColumns); clStatus|=clEnv->library->clSetKernelArg(blurColumnKernel,i++,sizeof(unsigned int),(void *)&imageRows); - clStatus|=clEnv->library->clSetKernelArg(blurColumnKernel,i++,sizeof(cl_float4)*(chunkSize+kernel->width),(void *)NULL); + clStatus|=clEnv->library->clSetKernelArg(blurColumnKernel,i++,sizeof(cl_float4)*(chunkSize+kernel->width),(void *) NULL); if (clStatus != CL_SUCCESS) { (void) OpenCLThrowMagickException(exception, GetMagickModule(), ResourceLimitWarning, "clEnv->library->clSetKernelArg failed.", "'%s'", "."); @@ -1418,7 +1418,7 @@ static Image* ComputeBlurImageSection(const Image* image, clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(unsigned int),(void *)&kernelWidth); clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(unsigned int),(void *)&imageColumns); clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(unsigned int),(void *)&imageRows); - clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(CLPixelPacket)*(chunkSize+kernel->width),(void *)NULL); + clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(CLPixelPacket)*(chunkSize+kernel->width),(void *) NULL); clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(unsigned int),(void *)&offsetRows); clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(unsigned int),(void *)&sec); if (clStatus != CL_SUCCESS) @@ -1472,7 +1472,7 @@ static Image* ComputeBlurImageSection(const Image* image, clStatus|=clEnv->library->clSetKernelArg(blurColumnKernel,i++,sizeof(unsigned int),(void *)&kernelWidth); clStatus|=clEnv->library->clSetKernelArg(blurColumnKernel,i++,sizeof(unsigned int),(void *)&imageColumns); clStatus|=clEnv->library->clSetKernelArg(blurColumnKernel,i++,sizeof(unsigned int),(void *)&imageRows); - clStatus|=clEnv->library->clSetKernelArg(blurColumnKernel,i++,sizeof(cl_float4)*(chunkSize+kernel->width),(void *)NULL); + clStatus|=clEnv->library->clSetKernelArg(blurColumnKernel,i++,sizeof(cl_float4)*(chunkSize+kernel->width),(void *) NULL); clStatus|=clEnv->library->clSetKernelArg(blurColumnKernel,i++,sizeof(unsigned int),(void *)&offsetRows); clStatus|=clEnv->library->clSetKernelArg(blurColumnKernel,i++,sizeof(unsigned int),(void *)&sec); if (clStatus != CL_SUCCESS) @@ -2211,7 +2211,7 @@ static Image *ComputeUnsharpMaskImage(const Image *image, clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(unsigned int),(void *)&kernelWidth); clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(unsigned int),(void *)&imageColumns); clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(unsigned int),(void *)&imageRows); - clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(CLPixelPacket)*(chunkSize+kernel->width),(void *)NULL); + clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(CLPixelPacket)*(chunkSize+kernel->width),(void *) NULL); if (clStatus != CL_SUCCESS) { (void) OpenCLThrowMagickException(exception, GetMagickModule(), ResourceLimitWarning, "clEnv->library->clSetKernelArg failed.", "'%s'", "."); @@ -2582,7 +2582,7 @@ static Image *ComputeUnsharpMaskImageSection(const Image *image, clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(unsigned int),(void *)&kernelWidth); clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(unsigned int),(void *)&imageColumns); clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(unsigned int),(void *)&imageRows); - clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(CLPixelPacket)*(chunkSize+kernel->width),(void *)NULL); + clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(CLPixelPacket)*(chunkSize+kernel->width),(void *) NULL); clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(unsigned int),(void *)&offsetRows); clStatus|=clEnv->library->clSetKernelArg(blurRowKernel,i++,sizeof(unsigned int),(void *)&sec); if (clStatus != CL_SUCCESS) @@ -2929,7 +2929,7 @@ static Image *ComputeUnsharpMaskImageSingle(const Image *image, clStatus|=clEnv->library->clSetKernelArg(unsharpMaskKernel,i++,sizeof(unsigned int),(void *)&kernelWidth); clStatus|=clEnv->library->clSetKernelArg(unsharpMaskKernel,i++,sizeof(unsigned int),(void *)&imageColumns); clStatus|=clEnv->library->clSetKernelArg(unsharpMaskKernel,i++,sizeof(unsigned int),(void *)&imageRows); - clStatus|=clEnv->library->clSetKernelArg(unsharpMaskKernel,i++,sizeof(cl_float4)*(8 * (32 + kernel->width)),(void *)NULL); + clStatus|=clEnv->library->clSetKernelArg(unsharpMaskKernel,i++,sizeof(cl_float4)*(8 * (32 + kernel->width)),(void *) NULL); clStatus|=clEnv->library->clSetKernelArg(unsharpMaskKernel,i++,sizeof(float),(void *)&fGain); clStatus|=clEnv->library->clSetKernelArg(unsharpMaskKernel,i++,sizeof(float),(void *)&fThreshold); clStatus|=clEnv->library->clSetKernelArg(unsharpMaskKernel,i++,sizeof(cl_uint),(void *)&justBlur); diff --git a/MagickCore/layer.c b/MagickCore/layer.c index 4a1236765..d15a03118 100644 --- a/MagickCore/layer.c +++ b/MagickCore/layer.c @@ -1014,8 +1014,8 @@ static Image *OptimizeLayerFrames(const Image *image, Compute the bounding box of changes for each pair of images. */ i=1; - bgnd_image=(Image *)NULL; - dup_image=(Image *)NULL; + bgnd_image=(Image *) NULL; + dup_image=(Image *) NULL; dup_bounds.width=0; dup_bounds.height=0; dup_bounds.x=0; @@ -1268,7 +1268,7 @@ static Image *OptimizeLayerFrames(const Image *image, if ( disposals[i-1] != PreviousDispose ) prev_image=DestroyImage(prev_image); if ( disposals[i-1] == BackgroundDispose ) - prev_image=bgnd_image, bgnd_image=(Image *)NULL; + prev_image=bgnd_image, bgnd_image=(Image *) NULL; if (bgnd_image != (Image *) NULL) bgnd_image=DestroyImage(bgnd_image); if ( disposals[i-1] == NoneDispose ) diff --git a/MagickCore/matrix.c b/MagickCore/matrix.c index defcd2beb..7d1a2a7a5 100644 --- a/MagickCore/matrix.c +++ b/MagickCore/matrix.c @@ -335,7 +335,7 @@ MagickExport double **AcquireMagickMatrix(const size_t number_rows, matrix=(double **) AcquireQuantumMemory(number_rows,sizeof(*matrix)); if (matrix == (double **) NULL) - return((double **)NULL); + return((double **) NULL); for (i=0; i < (ssize_t) number_rows; i++) { matrix[i]=(double *) AcquireQuantumMemory(size,sizeof(*matrix[i])); diff --git a/MagickCore/morphology.c b/MagickCore/morphology.c index b266d8852..acf863ad6 100644 --- a/MagickCore/morphology.c +++ b/MagickCore/morphology.c @@ -244,7 +244,7 @@ static KernelInfo *ParseKernelArray(const char *kernel_string) args; kernel=(KernelInfo *) AcquireQuantumMemory(1,sizeof(*kernel)); - if (kernel == (KernelInfo *)NULL) + if (kernel == (KernelInfo *) NULL) return(kernel); (void) ResetMagickMemory(kernel,0,sizeof(*kernel)); kernel->minimum = kernel->maximum = kernel->angle = 0.0; @@ -404,7 +404,7 @@ static KernelInfo *ParseKernelName(const char *kernel_string, GetMagickToken(kernel_string,&p,token); type=ParseCommandOption(MagickKernelOptions,MagickFalse,token); if ( type < 0 || type == UserDefinedKernel ) - return((KernelInfo *)NULL); /* not a valid named kernel */ + return((KernelInfo *) NULL); /* not a valid named kernel */ while (((isspace((int) ((unsigned char) *p)) != 0) || (*p == ',') || (*p == ':' )) && (*p != '\0') && (*p != ';')) @@ -977,7 +977,7 @@ MagickExport KernelInfo *AcquireKernelBuiltIn(const KernelInfoType type, switch(type) { case UndefinedKernel: /* These should not call this function */ case UserDefinedKernel: - assert("Should not call this function" != (char *)NULL); + assert("Should not call this function" != (char *) NULL); break; case LaplacianKernel: /* Named Descrete Convolution Kernels */ case SobelKernel: /* these are defined using other kernels */ @@ -3683,7 +3683,7 @@ MagickPrivate Image *MorphologyApply(const Image *image, count = 0; /* number of low-level morphology primitives performed */ if ( iterations == 0 ) - return((Image *)NULL); /* null operation - nothing to do! */ + return((Image *) NULL); /* null operation - nothing to do! */ kernel_limit = (size_t) iterations; if ( iterations < 0 ) /* negative interations = infinite (well alomst) */ @@ -4162,7 +4162,7 @@ MagickExport Image *MorphologyImage(const Image *image, /* Scale kernel according to user wishes */ artifact = GetImageArtifact(image,"convolve:scale"); - if ( artifact != (const char *)NULL ) { + if ( artifact != (const char *) NULL ) { if (IfMagickFalse(IsGeometry(artifact))) (void) ThrowMagickException(exception,GetMagickModule(), OptionWarning,"InvalidSetting","'%s' '%s'", diff --git a/MagickCore/nt-base.c b/MagickCore/nt-base.c index 448d15331..fadd42fd2 100644 --- a/MagickCore/nt-base.c +++ b/MagickCore/nt-base.c @@ -1588,7 +1588,7 @@ MagickPrivate DIR *NTOpenDirectory(const char *path) if (length == 0) return((DIR *) NULL); if(wcsncat(file_specification,(const wchar_t*) DirectorySeparator, - MaxTextExtent-wcslen(file_specification)-1) == (wchar_t*)NULL) + MaxTextExtent-wcslen(file_specification)-1) == (wchar_t*) NULL) return((DIR *) NULL); entry=(DIR *) AcquireMagickMemory(sizeof(DIR)); if (entry != (DIR *) NULL) @@ -1599,7 +1599,7 @@ MagickPrivate DIR *NTOpenDirectory(const char *path) if (entry->hSearch == INVALID_HANDLE_VALUE) { if(wcsncat(file_specification,L"*.*", - MaxTextExtent-wcslen(file_specification)-1) == (wchar_t*)NULL) + MaxTextExtent-wcslen(file_specification)-1) == (wchar_t*) NULL) { entry=(DIR *) RelinquishMagickMemory(entry); return((DIR *) NULL); diff --git a/MagickCore/opencl.c b/MagickCore/opencl.c index ecfefb768..e7a1e1c0a 100644 --- a/MagickCore/opencl.c +++ b/MagickCore/opencl.c @@ -198,7 +198,7 @@ MagickExport MagickCLEnv AcquireMagickOpenCLEnv() MagickExport MagickBooleanType RelinquishMagickOpenCLEnv(MagickCLEnv clEnv) { - if (clEnv != (MagickCLEnv)NULL) + if (clEnv != (MagickCLEnv) NULL) { RelinquishSemaphoreInfo(&clEnv->lock); RelinquishMagickMemory(clEnv); @@ -2725,7 +2725,7 @@ MagickPrivate cl_kernel AcquireOpenCLKernel( magick_unreferenced(program); magick_unreferenced(kernelName); - return (cl_kernel)NULL; + return (cl_kernel) NULL; } MagickPrivate MagickBooleanType RelinquishOpenCLKernel( diff --git a/MagickCore/property.c b/MagickCore/property.c index 03ebf2980..1b9755105 100644 --- a/MagickCore/property.c +++ b/MagickCore/property.c @@ -2214,13 +2214,13 @@ MagickExport const char *GetImageProperty(const Image *image, if (image == (Image *) NULL ) { \ (void) ThrowMagickException(exception,GetMagickModule(),OptionWarning, \ "NoImageForProperty",format,arg); \ - return((const char *)NULL); \ + return((const char *) NULL); \ } #define WarnNoImageInfoReturn(format,arg) \ if (image_info == (ImageInfo *) NULL ) { \ (void) ThrowMagickException(exception,GetMagickModule(),OptionWarning, \ "NoImageInfoForProperty",format,arg); \ - return((const char *)NULL); \ + return((const char *) NULL); \ } static const char *GetMagickPropertyLetter(ImageInfo *image_info, @@ -2375,7 +2375,7 @@ static const char *GetMagickPropertyLetter(ImageInfo *image_info, if (image_info->number_scenes != 0) (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double) image_info->scene); - else if (image != (Image *)NULL) + else if (image != (Image *) NULL) (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double) image->scene); else @@ -2578,7 +2578,7 @@ static const char *GetMagickPropertyLetter(ImageInfo *image_info, /* Create a cloned copy of result. */ - if (image != (Image *)NULL) + if (image != (Image *) NULL) { (void) SetImageArtifact(image,"get-property",value); return(GetImageArtifact(image,"get-property")); @@ -2589,7 +2589,7 @@ static const char *GetMagickPropertyLetter(ImageInfo *image_info, return(GetImageOption(image_info,"get-property")); } } - return((char *)NULL); + return((char *) NULL); } MagickExport const char *GetMagickProperty(ImageInfo *image_info, @@ -2602,7 +2602,7 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info, *string; assert(property[0] != '\0'); - assert(image != (Image *)NULL || image_info != (ImageInfo *)NULL ); + assert(image != (Image *) NULL || image_info != (ImageInfo *) NULL ); if (property[1] == '\0') /* single letter property request */ return(GetMagickPropertyLetter(image_info,image,*property,exception)); @@ -3051,7 +3051,7 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info, if (*value != '\0') { /* create a cloned copy of result, that will get cleaned up, eventually */ - if (image != (Image *)NULL) + if (image != (Image *) NULL) { (void) SetImageArtifact(image,"get-property",value); return(GetImageArtifact(image,"get-property")); @@ -3062,7 +3062,7 @@ MagickExport const char *GetMagickProperty(ImageInfo *image_info, return(GetImageOption(image_info,"get-property")); } } - return((char *)NULL); + return((char *) NULL); } #undef WarnNoImageReturn @@ -3164,7 +3164,7 @@ DisableMSCWarning(4127) \ interpret_text=(char *) ResizeQuantumMemory(interpret_text, \ extent+MaxTextExtent,sizeof(*interpret_text)); \ if (interpret_text == (char *) NULL) \ - return((char *)NULL); \ + return((char *) NULL); \ q=interpret_text+strlen(interpret_text); \ } } while (0) /* no trailing ; */ \ RestoreMSCWarning @@ -3178,7 +3178,7 @@ DisableMSCWarning(4127) \ interpret_text=(char *) ResizeQuantumMemory(interpret_text, \ extent+MaxTextExtent,sizeof(*interpret_text)); \ if (interpret_text == (char *) NULL) \ - return((char *)NULL); \ + return((char *) NULL); \ q=interpret_text+strlen(interpret_text); \ } \ (void) CopyMagickString(q,(string),extent); \ @@ -3195,7 +3195,7 @@ DisableMSCWarning(4127) \ interpret_text=(char *) ResizeQuantumMemory(interpret_text, \ extent+MaxTextExtent,sizeof(*interpret_text)); \ if (interpret_text == (char *) NULL) \ - return((char *)NULL); \ + return((char *) NULL); \ q=interpret_text+strlen(interpret_text); \ } \ q+=FormatLocaleString(q,extent,"%s=%s\n",(key),(string)); \ @@ -3394,7 +3394,7 @@ MagickExport char *InterpretImageProperties(ImageInfo *image_info, (void) ThrowMagickException(exception,GetMagickModule(), OptionError,"UnbalancedBraces","\"%%[%s\"",pattern); interpret_text=DestroyString(interpret_text); - return((char *)NULL); + return((char *) NULL); } /* @@ -3569,7 +3569,7 @@ MagickExport char *InterpretImageProperties(ImageInfo *image_info, 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) @@ -3616,7 +3616,7 @@ MagickExport char *InterpretImageProperties(ImageInfo *image_info, Look for a per-image Artifact This includes option lookup (FUTURE: interpreted according to image) */ - if (image != (Image *)NULL) + if (image != (Image *) NULL) { string=GetImageArtifact(image,pattern); if (string != (char *) NULL) diff --git a/MagickCore/threshold.c b/MagickCore/threshold.c index c13e476ca..e41135362 100644 --- a/MagickCore/threshold.c +++ b/MagickCore/threshold.c @@ -1143,12 +1143,12 @@ MagickBooleanType ListThresholdMapFile(FILE *file,const char *xml, *threshold, *thresholds; - assert( xml != (char *)NULL ); - assert( file != (FILE *)NULL ); + assert( xml != (char *) NULL ); + assert( file != (FILE *) NULL ); (void) LogMagickEvent(ConfigureEvent,GetMagickModule(), "Loading threshold map file \"%s\" ...",filename); thresholds=NewXMLTree(xml,exception); - if ( thresholds == (XMLTreeInfo *)NULL ) + if ( thresholds == (XMLTreeInfo *) NULL ) return(MagickFalse); (void) FormatLocaleFile(file,"%-16s %-12s %s\n","Map","Alias","Description"); (void) FormatLocaleFile(file, diff --git a/MagickWand/magick-cli.c b/MagickWand/magick-cli.c index fe188727e..9f2eebaee 100644 --- a/MagickWand/magick-cli.c +++ b/MagickWand/magick-cli.c @@ -125,7 +125,7 @@ WandExport void ProcessScriptOptions(MagickCLI *cli_wand,const char *filename, *arg1, *arg2; - assert(filename != (char *)NULL ); /* at least one argument - script name */ + assert(filename != (char *) NULL ); /* at least one argument - script name */ assert(cli_wand != (MagickCLI *) NULL); assert(cli_wand->signature == WandSignature); if (IfMagickTrue(cli_wand->wand.debug)) @@ -148,7 +148,7 @@ WandExport void ProcessScriptOptions(MagickCLI *cli_wand,const char *filename, cli_wand->filename=filename; /* Process Options from Script */ - option = arg1 = arg2 = (char*)NULL; + option = arg1 = arg2 = (char*) NULL; DisableMSCWarning(4127) while (1) { RestoreMSCWarning @@ -183,7 +183,7 @@ RestoreMSCWarning #endif if ( IfMagickFalse(IsCommandOption(option))) { /* non-option -- treat as a image read */ - cli_wand->command=(const OptionInfo *)NULL; + cli_wand->command=(const OptionInfo *) NULL; CLIOption(cli_wand,"-read",option); break; /* next option */ } @@ -197,7 +197,7 @@ RestoreMSCWarning CloneString(&arg1,token_info->token); } else - CloneString(&arg1,(char *)NULL); + CloneString(&arg1,(char *) NULL); if ( count >= 2 ) { if( IfMagickFalse(GetScriptToken(token_info)) ) @@ -205,7 +205,7 @@ RestoreMSCWarning CloneString(&arg2,token_info->token); } else - CloneString(&arg2,(char *)NULL); + CloneString(&arg2,(char *) NULL); /* Process Options @@ -270,9 +270,9 @@ loop_exit: switch( token_info->status ) { case TokenStatusOK: case TokenStatusEOF: - if (cli_wand->image_list_stack != (Stack *)NULL) + if (cli_wand->image_list_stack != (Stack *) NULL) CLIWandException(OptionError,"UnbalancedParenthesis", "(eof)"); - else if (cli_wand->image_info_stack != (Stack *)NULL) + else if (cli_wand->image_info_stack != (Stack *) NULL) CLIWandException(OptionError,"UnbalancedBraces", "(eof)"); break; case TokenStatusBadQuotes: @@ -302,9 +302,9 @@ loop_exit: /* Clean up */ token_info = DestroyScriptTokenInfo(token_info); - CloneString(&option,(char *)NULL); - CloneString(&arg1,(char *)NULL); - CloneString(&arg2,(char *)NULL); + CloneString(&option,(char *) NULL); + CloneString(&arg1,(char *) NULL); + CloneString(&arg2,(char *) NULL); return; } @@ -369,9 +369,9 @@ WandExport int ProcessCommandOptions(MagickCLI *cli_wand,int argc,char **argv, option_type; assert(argc>=index); /* you may have no arguments left! */ - assert(argv != (char **)NULL); - assert(argv[index] != (char *)NULL); - assert(argv[argc-1] != (char *)NULL); + assert(argv != (char **) NULL); + assert(argv[index] != (char *) NULL); + assert(argv[argc-1] != (char *) NULL); assert(cli_wand != (MagickCLI *) NULL); assert(cli_wand->signature == WandSignature); @@ -417,7 +417,7 @@ WandExport int ProcessCommandOptions(MagickCLI *cli_wand,int argc,char **argv, if ( IfMagickFalse(IsCommandOption(option)) ) { if ( (cli_wand->process_flags & ProcessImplictRead) != 0 ) { /* non-option -- treat as a image read */ - cli_wand->command=(const OptionInfo *)NULL; + cli_wand->command=(const OptionInfo *) NULL; CLIOption(cli_wand,"-read",option); break; /* next option */ } @@ -447,8 +447,8 @@ WandExport int ProcessCommandOptions(MagickCLI *cli_wand,int argc,char **argv, break; /* next option - not that their is any! */ } - arg1 = ( count >= 1 ) ? argv[i+1] : (char *)NULL; - arg2 = ( count >= 2 ) ? argv[i+2] : (char *)NULL; + arg1 = ( count >= 1 ) ? argv[i+1] : (char *) NULL; + arg2 = ( count >= 2 ) ? argv[i+2] : (char *) NULL; /* Process Known Options @@ -498,9 +498,9 @@ RestoreMSCWarning cli_wand->line=i; /* check that stacks are empty - or cause exception */ - if (cli_wand->image_list_stack != (Stack *)NULL) + if (cli_wand->image_list_stack != (Stack *) NULL) CLIWandException(OptionError,"UnbalancedParenthesis", "(end of cli)"); - else if (cli_wand->image_info_stack != (Stack *)NULL) + else if (cli_wand->image_info_stack != (Stack *) NULL) CLIWandException(OptionError,"UnbalancedBraces", "(end of cli)"); if ( CLICatchException(cli_wand, MagickFalse) != MagickFalse ) return(argc); @@ -522,7 +522,7 @@ RestoreMSCWarning return(argc); } - cli_wand->command=(const OptionInfo *)NULL; + cli_wand->command=(const OptionInfo *) NULL; CLIOption(cli_wand,"-write",option); return(argc); } @@ -684,7 +684,7 @@ WandExport MagickBooleanType MagickImageCommand(ImageInfo *image_info,int argc, size_t len; - assert(image_info != (ImageInfo *)NULL); + assert(image_info != (ImageInfo *) NULL); /* For specific OS command line requirements */ ReadCommandlLine(argc,&argv); @@ -796,9 +796,9 @@ Magick_Command_Cleanup: /* recover original image_info and clean up stacks FUTURE: "-reset stacks" option */ - while (cli_wand->image_list_stack != (Stack *)NULL) + while (cli_wand->image_list_stack != (Stack *) NULL) CLIOption(cli_wand,")"); - while (cli_wand->image_info_stack != (Stack *)NULL) + while (cli_wand->image_info_stack != (Stack *) NULL) CLIOption(cli_wand,"}"); /* assert we have recovered the original structures */ @@ -834,8 +834,8 @@ Magick_Command_Exit: "\"%s\"",argv[0]); /* Destroy the special CLI Wand */ - cli_wand->wand.image_info = (ImageInfo *)NULL; /* not these */ - cli_wand->wand.exception = (ExceptionInfo *)NULL; + cli_wand->wand.image_info = (ImageInfo *) NULL; /* not these */ + cli_wand->wand.exception = (ExceptionInfo *) NULL; cli_wand=DestroyMagickCLI(cli_wand); return(IsMagickTrue(exception->severity < ErrorException)); diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c index d8a5d46aa..b110bfb39 100644 --- a/MagickWand/mogrify.c +++ b/MagickWand/mogrify.c @@ -499,7 +499,7 @@ static Image *SparseColorOption(const Image *image, (void) ThrowMagickException(exception,GetMagickModule(), OptionError, "InvalidArgument", "'%s': %s", "sparse-color", "Color arg given, when colors are coming from image"); - return( (Image *)NULL); + return( (Image *) NULL); } x += number_colors; /* color argument */ } @@ -522,7 +522,7 @@ static Image *SparseColorOption(const Image *image, (void) ThrowMagickException(exception,GetMagickModule(), OptionError, "InvalidArgument", "'%s': %s", "sparse-color", "Invalid number of Arguments"); - return( (Image *)NULL); + return( (Image *) NULL); } /* Allocate and fill in the floating point arguments */ @@ -531,7 +531,7 @@ static Image *SparseColorOption(const Image *image, if (sparse_arguments == (double *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(),ResourceLimitError, "MemoryAllocationFailed","%s","SparseColorOption"); - return( (Image *)NULL); + return( (Image *) NULL); } (void) ResetMagickMemory(sparse_arguments,0,number_arguments* sizeof(*sparse_arguments)); @@ -640,10 +640,10 @@ static Image *SparseColorOption(const Image *image, (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "InvalidArgument","'%s': %s","sparse-color","Argument Parsing Error"); sparse_arguments=(double *) RelinquishMagickMemory(sparse_arguments); - return( (Image *)NULL); + return( (Image *) NULL); } if ( error ) - return( (Image *)NULL); + return( (Image *) NULL); /* Call the Interpolation function with the parsed arguments */ sparse_image=SparseColorImage(image,method,number_arguments,sparse_arguments, @@ -741,7 +741,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, if ((i+count) >= (ssize_t) argc) break; status=MogrifyImageInfo(mogrify_info,(int) count+1,argv+i,exception); - mogrify_image=(Image *)NULL; + mogrify_image=(Image *) NULL; switch (*(option+1)) { case 'a': diff --git a/MagickWand/operation.c b/MagickWand/operation.c index d9e0c10bb..e2701d551 100644 --- a/MagickWand/operation.c +++ b/MagickWand/operation.c @@ -243,7 +243,7 @@ static Image *SparseColorOption(const Image *image, (void) ThrowMagickException(exception,GetMagickModule(), OptionError, "InvalidArgument", "'%s': %s", "sparse-color", "Invalid number of Arguments"); - return( (Image *)NULL); + return( (Image *) NULL); } /* Allocate and fill in the floating point arguments */ @@ -252,7 +252,7 @@ static Image *SparseColorOption(const Image *image, if (sparse_arguments == (double *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(),ResourceLimitError, "MemoryAllocationFailed","%s","SparseColorOption"); - return( (Image *)NULL); + return( (Image *) NULL); } (void) ResetMagickMemory(sparse_arguments,0,number_arguments* sizeof(*sparse_arguments)); @@ -352,10 +352,10 @@ static Image *SparseColorOption(const Image *image, (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "InvalidArgument","'%s': %s","sparse-color","Argument Parsing Error"); sparse_arguments=(double *) RelinquishMagickMemory(sparse_arguments); - return( (Image *)NULL); + return( (Image *) NULL); } if ( error ) - return( (Image *)NULL); + return( (Image *) NULL); /* Call the Sparse Color Interpolation function with the parsed arguments */ sparse_image=SparseColorImage(image,method,number_arguments,sparse_arguments, @@ -1735,7 +1735,7 @@ static MagickBooleanType CLISimpleOperatorImage(MagickCLI *cli_wand, "CLISimpleOperatorImage: \"%s\" \"%s\" \"%s\"\n",option,arg1,arg2); #endif - new_image = (Image *)NULL; /* the replacement image, if not null at end */ + new_image = (Image *) NULL; /* the replacement image, if not null at end */ SetGeometryInfo(&geometry_info); switch (*(option+1)) @@ -2252,7 +2252,7 @@ static MagickBooleanType CLISimpleOperatorImage(MagickCLI *cli_wand, } /* convert argument string into an array of doubles */ args = StringToArrayOfDoubles(arg2,&count,_exception); - if (args == (double *)NULL ) + if (args == (double *) NULL ) CLIWandExceptArgBreak(OptionError,"InvalidNumberList",option,arg2); new_image=DistortImage(_image,(DistortImageMethod) parse,(size_t) @@ -2264,7 +2264,7 @@ static MagickBooleanType CLISimpleOperatorImage(MagickCLI *cli_wand, { (void) CloneString(&_draw_info->primitive,arg1); (void) DrawImage(_image,_draw_info,_exception); - (void) CloneString(&_draw_info->primitive,(char *)NULL); + (void) CloneString(&_draw_info->primitive,(char *) NULL); break; } CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option); @@ -2413,7 +2413,7 @@ static MagickBooleanType CLISimpleOperatorImage(MagickCLI *cli_wand, option,arg1); /* convert argument string into an array of doubles */ args = StringToArrayOfDoubles(arg2,&count,_exception); - if (args == (double *)NULL ) + if (args == (double *) NULL ) CLIWandExceptArgBreak(OptionError,"InvalidNumberList",option,arg2); (void) FunctionImage(_image,(MagickFunction)parse,(size_t) count,args, @@ -3882,7 +3882,7 @@ WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand, else new_images=DuplicateImages(_images,1,"-1",_exception); AppendImageToList(&_images, new_images); - new_images=(Image *)NULL; + new_images=(Image *) NULL; break; } CLIWandExceptionBreak(OptionError,"UnrecognizedOption",option); @@ -4184,7 +4184,7 @@ WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand, /* convert argument string into an array of doubles */ args = StringToArrayOfDoubles(arg2,&count,_exception); - if (args == (double *)NULL ) + if (args == (double *) NULL ) CLIWandExceptArgBreak(OptionError,"InvalidNumberList",option,arg2); new_images=PolynomialImage(_images,(size_t) (count >> 1),args,_exception); args=(double *) RelinquishMagickMemory(args); @@ -4321,7 +4321,7 @@ WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand, new_images=SimilarityImage(base_image,compare_image,metric,0.0, &offset,&similarity,_exception); - if ( new_images != (Image *)NULL ) { + if ( new_images != (Image *) NULL ) { char result[MaxTextExtent]; @@ -4612,7 +4612,7 @@ WandPrivate void CLINoImageOperator(MagickCLI *cli_wand, size=0; node=cli_wand->image_list_stack; - for ( ; node != (Stack *)NULL; node=node->next) + for ( ; node != (Stack *) NULL; node=node->next) size++; if ( size >= MAX_STACK_DEPTH ) CLIWandExceptionBreak(OptionError,"ParenthesisNestedTooDeeply",option); @@ -4643,7 +4643,7 @@ WandPrivate void CLINoImageOperator(MagickCLI *cli_wand, size=0; node=cli_wand->image_info_stack; - for ( ; node != (Stack *)NULL; node=node->next) + for ( ; node != (Stack *) NULL; node=node->next) size++; if ( size >= MAX_STACK_DEPTH ) CLIWandExceptionBreak(OptionError,"CurlyBracesNestedTooDeeply",option); @@ -4657,7 +4657,7 @@ WandPrivate void CLINoImageOperator(MagickCLI *cli_wand, cli_wand->image_info_stack = node; cli_wand->wand.image_info = CloneImageInfo(cli_wand->wand.image_info); - if (cli_wand->wand.image_info == (ImageInfo *)NULL) { + if (cli_wand->wand.image_info == (ImageInfo *) NULL) { CLIWandException(ResourceLimitFatalError,"MemoryAllocationFailed", option); cli_wand->wand.image_info = (ImageInfo *)node->data; @@ -4673,7 +4673,7 @@ WandPrivate void CLINoImageOperator(MagickCLI *cli_wand, *node; node = (Stack *)cli_wand->image_list_stack; - if ( node == (Stack *)NULL) + if ( node == (Stack *) NULL) CLIWandExceptionBreak(OptionError,"UnbalancedParenthesis",option); cli_wand->image_list_stack = node->next; @@ -4683,7 +4683,7 @@ WandPrivate void CLINoImageOperator(MagickCLI *cli_wand, /* handle respect-parenthesis - of the previous 'pushed' settings */ node = cli_wand->image_info_stack; - if ( node != (Stack *)NULL) + if ( node != (Stack *) NULL) { if (IfMagickTrue(IsStringTrue(GetImageOption( cli_wand->wand.image_info,"respect-parenthesis")))) @@ -4701,7 +4701,7 @@ WandPrivate void CLINoImageOperator(MagickCLI *cli_wand, *node; node = (Stack *)cli_wand->image_info_stack; - if ( node == (Stack *)NULL) + if ( node == (Stack *) NULL) CLIWandExceptionBreak(OptionError,"UnbalancedCurlyBraces",option); cli_wand->image_info_stack = node->next; @@ -4756,7 +4756,7 @@ WandPrivate void CLINoImageOperator(MagickCLI *cli_wand, if (LocaleNCompare(arg1,"option:",7) == 0) { /* delete equivelent artifact from all images (if any) */ - if (_images != (Image *)NULL) + if (_images != (Image *) NULL) { MagickResetIterator(&cli_wand->wand); while ( IfMagickTrue(MagickNextImage(&cli_wand->wand)) ) @@ -4765,7 +4765,7 @@ WandPrivate void CLINoImageOperator(MagickCLI *cli_wand, } /* now set/delete the global option as needed */ /* FUTURE: make escapes in a global 'option:' delayed */ - arg2=(char *)NULL; + arg2=(char *) NULL; if (IfNormalOp) { arg2=InterpretImageProperties(_image_info,_images,arg2n,_exception); @@ -4785,7 +4785,7 @@ WandPrivate void CLINoImageOperator(MagickCLI *cli_wand, MagickResetIterator(&cli_wand->wand); while ( IfMagickTrue(MagickNextImage(&cli_wand->wand)) ) { - arg2=(char *)NULL; + arg2=(char *) NULL; if (IfNormalOp) { arg2=InterpretImageProperties(_image_info,_images,arg2n,_exception); @@ -4813,7 +4813,7 @@ WandPrivate void CLINoImageOperator(MagickCLI *cli_wand, arg1=AcquireString("-1"); if (IfMagickFalse(IsSceneGeometry(arg1,MagickFalse))) CLIWandExceptionBreak(OptionError,"InvalidArgument",option); - if ( cli_wand->image_list_stack == (Stack *)NULL) + if ( cli_wand->image_list_stack == (Stack *) NULL) CLIWandExceptionBreak(OptionError,"UnableToCloneImage",option); new_images = (Image *)cli_wand->image_list_stack->data; if (new_images == (Image *) NULL) @@ -5042,7 +5042,7 @@ WandExport void CLIOption(MagickCLI *cli_wand,const char *option,...) /* FUTURE: this is temporary - get 'settings' to handle distribution of settings to images attributes,proprieties,artifacts */ - if ( cli_wand->wand.images != (Image *)NULL ) + if ( cli_wand->wand.images != (Image *) NULL ) (void) SyncImagesSettings(cli_wand->wand.image_info,cli_wand->wand.images, cli_wand->wand.exception); @@ -5058,14 +5058,14 @@ WandExport void CLIOption(MagickCLI *cli_wand,const char *option,...) /* FUTURE: The not a setting part below is a temporary hack due to * some options being both a Setting and a Simple operator. * Specifically -monitor, -depth, and -colorspace */ - if ( cli_wand->wand.images == (Image *)NULL ) + if ( cli_wand->wand.images == (Image *) NULL ) if ( ((option_type & (SimpleOperatorFlag|ListOperatorFlag)) != 0 ) && ((option_type & SettingOptionFlags) == 0 )) /* temp hack */ CLIWandExceptionBreak(OptionError,"NoImagesFound",option); /* Operators which loop of individual images, simply */ if ( (option_type & SimpleOperatorFlag) != 0 && - cli_wand->wand.images != (Image *)NULL) /* temp hack */ + cli_wand->wand.images != (Image *) NULL) /* temp hack */ { ExceptionInfo *exception=AcquireExceptionInfo(); (void) CLISimpleOperatorImages(cli_wand, option, arg1, arg2,exception); diff --git a/MagickWand/script-token.c b/MagickWand/script-token.c index 38d8251cc..c841bc475 100644 --- a/MagickWand/script-token.c +++ b/MagickWand/script-token.c @@ -224,7 +224,7 @@ WandExport ScriptTokenInfo *AcquireScriptTokenInfo(const char *filename) else { token_info->stream=fopen_utf8(filename, "r"); } - if ( token_info->stream == (FILE *)NULL ) { + if ( token_info->stream == (FILE *) NULL ) { token_info=(ScriptTokenInfo *) RelinquishMagickMemory(token_info); return(token_info); } @@ -233,7 +233,7 @@ WandExport ScriptTokenInfo *AcquireScriptTokenInfo(const char *filename) token_info->length=INITAL_TOKEN_LENGTH; token_info->token=(char *) AcquireMagickMemory(token_info->length); - token_info->status=(token_info->token != (char *)NULL) + token_info->status=(token_info->token != (char *) NULL) ? TokenStatusOK : TokenStatusMemoryFailed; token_info->signature=WandSignature; @@ -343,7 +343,7 @@ WandExport ScriptTokenInfo * DestroyScriptTokenInfo(ScriptTokenInfo *token_info) token_info->length *= 4; \ token_info->token = (char *) \ ResizeMagickMemory(token_info->token, token_info->length); \ - if ( token_info->token == (char *)NULL ) { \ + if ( token_info->token == (char *) NULL ) { \ token_info->status=TokenStatusMemoryFailed; \ break; \ } \ @@ -393,7 +393,7 @@ RestoreMSCWarning ( token_info->curr_column==1 && (c == ':' || c == '@' ) ) ) state=IN_COMMENT; /* whitespace token separator character */ - if (strchr(" \n\r\t",c) != (char *)NULL) { + if (strchr(" \n\r\t",c) != (char *) NULL) { switch (state) { case IN_TOKEN: token_info->token[offset]='\0'; diff --git a/MagickWand/wandcli.c b/MagickWand/wandcli.c index 23f3bdeb6..b312e110f 100644 --- a/MagickWand/wandcli.c +++ b/MagickWand/wandcli.c @@ -100,11 +100,11 @@ WandExport MagickCLI *AcquireMagickCLI(ImageInfo *image_info, (void) FormatLocaleString(cli_wand->wand.name,MaxTextExtent, "%s-%.20g","MagickWandCLI", (double) cli_wand->wand.id); cli_wand->wand.images=NewImageList(); - if ( image_info == (ImageInfo *)NULL) + if ( image_info == (ImageInfo *) NULL) cli_wand->wand.image_info=AcquireImageInfo(); else cli_wand->wand.image_info=image_info; - if ( exception == (ExceptionInfo *)NULL) + if ( exception == (ExceptionInfo *) NULL) cli_wand->wand.exception=AcquireExceptionInfo(); else cli_wand->wand.exception=exception; @@ -115,9 +115,9 @@ WandExport MagickCLI *AcquireMagickCLI(ImageInfo *image_info, cli_wand->draw_info=CloneDrawInfo(cli_wand->wand.image_info,(DrawInfo *) NULL); cli_wand->quantize_info=AcquireQuantizeInfo(cli_wand->wand.image_info); cli_wand->process_flags=MagickCommandOptionFlags; /* assume "magick" CLI */ - cli_wand->command=(const OptionInfo *)NULL; /* no option at this time */ - cli_wand->image_list_stack=(Stack *)NULL; - cli_wand->image_info_stack=(Stack *)NULL; + cli_wand->command=(const OptionInfo *) NULL; /* no option at this time */ + cli_wand->image_list_stack=(Stack *) NULL; + cli_wand->image_info_stack=(Stack *) NULL; /* default exception location... EG: sprintf(locaiton, filename, line, column); @@ -170,14 +170,14 @@ WandExport MagickCLI *DestroyMagickCLI(MagickCLI *cli_wand) cli_wand->draw_info=DestroyDrawInfo(cli_wand->draw_info); if (cli_wand->quantize_info != (QuantizeInfo *) NULL ) cli_wand->quantize_info=DestroyQuantizeInfo(cli_wand->quantize_info); - while(cli_wand->image_list_stack != (Stack *)NULL) + while(cli_wand->image_list_stack != (Stack *) NULL) { node=cli_wand->image_list_stack; cli_wand->image_list_stack=node->next; (void) DestroyImageList((Image *)node->data); (void) RelinquishMagickMemory(node); } - while(cli_wand->image_info_stack != (Stack *)NULL) + while(cli_wand->image_info_stack != (Stack *) NULL) { node=cli_wand->image_info_stack; cli_wand->image_info_stack=node->next; @@ -195,7 +195,7 @@ WandExport MagickCLI *DestroyMagickCLI(MagickCLI *cli_wand) RelinquishWandId(cli_wand->wand.id); cli_wand->wand.signature=(~WandSignature); - return((MagickCLI *)NULL); + return((MagickCLI *) NULL); } /* diff --git a/api_examples/cli_operators.c b/api_examples/cli_operators.c index 7cff593a6..f16be9486 100644 --- a/api_examples/cli_operators.c +++ b/api_examples/cli_operators.c @@ -32,7 +32,7 @@ int main(int argc, char **argv) MagickCoreGenesis(argv[0],MagickFalse); - cli_wand = AcquireMagickCLI((ImageInfo *)NULL,(ExceptionInfo *)NULL); + cli_wand = AcquireMagickCLI((ImageInfo *) NULL,(ExceptionInfo *) NULL); CLISettingOptionInfo (cli_wand, "-size", "100x100"); CLISpecialOperator (cli_wand, "-read", "xc:red"); diff --git a/api_examples/cli_process.c b/api_examples/cli_process.c index e7be3b2eb..1eb662df8 100644 --- a/api_examples/cli_process.c +++ b/api_examples/cli_process.c @@ -32,11 +32,11 @@ int main(int argc, char **argv) "(", "rose:", "-rotate", "-90", ")", "+append", "show:", NULL }; - for(arg_count = 0; args[arg_count] != (char *)NULL; arg_count++); + for(arg_count = 0; args[arg_count] != (char *) NULL; arg_count++); MagickCoreGenesis(argv[0],MagickFalse); - cli_wand = AcquireMagickCLI((ImageInfo *)NULL,(ExceptionInfo *)NULL); + cli_wand = AcquireMagickCLI((ImageInfo *) NULL,(ExceptionInfo *) NULL); ProcessCommandOptions(cli_wand, arg_count, args, 0, MagickCommandOptionFlags); diff --git a/api_examples/magick_command.c b/api_examples/magick_command.c index c732cbe6a..1b9734585 100644 --- a/api_examples/magick_command.c +++ b/api_examples/magick_command.c @@ -39,7 +39,7 @@ int main(int argc, char **argv) "(", "rose:", "-rotate", "-90", ")", "+append", "show:", NULL }; - for(arg_count = 0; args[arg_count] != (char *)NULL; arg_count++); + for(arg_count = 0; args[arg_count] != (char *) NULL; arg_count++); (void) MagickImageCommand(image_info, arg_count, args, NULL, exception); diff --git a/coders/mat.c b/coders/mat.c index 001c4b09d..d5b9e8929 100644 --- a/coders/mat.c +++ b/coders/mat.c @@ -887,7 +887,7 @@ RestoreMSCWarning for (i = 0; i < (ssize_t) MATLAB_HDR.SizeY; i++) { q=GetAuthenticPixels(image,0,MATLAB_HDR.SizeY-i-1,image->columns,1,exception); - if (q == (Quantum *)NULL) + if (q == (Quantum *) NULL) { if (logging) (void)LogMagickEvent(CoderEvent,GetMagickModule(), " MAT set image pixels returns unexpected NULL on a row %u.", (unsigned)(MATLAB_HDR.SizeY-i-1)); @@ -1050,7 +1050,7 @@ done_reading: */ p=image; image=NULL; - while (p != (Image *)NULL) + while (p != (Image *) NULL) { Image *tmp=p; if ((p->rows == 0) || (p->columns == 0)) { diff --git a/coders/meta.c b/coders/meta.c index 17b38b1ba..5f9c5f7d6 100644 --- a/coders/meta.c +++ b/coders/meta.c @@ -196,7 +196,7 @@ static int stringnicmp(const char *p,const char *q,size_t n) static int convertHTMLcodes(char *s, int len) { - if (len <=0 || s==(char*)NULL || *s=='\0') + if (len <=0 || s==(char*) NULL || *s=='\0') return 0; if (s[1] == '#') @@ -326,7 +326,7 @@ static ssize_t parse8BIM(Image *ifile, Image *ofile) dataset = 0; recnum = 0; line = (char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*line)); - name = token = (char *)NULL; + name = token = (char *) NULL; savedpos = 0; token_info=AcquireTokenInfo(); while (super_fgets(&line,&inputlen,ifile)!=NULL) @@ -602,7 +602,7 @@ static ssize_t parse8BIMW(Image *ifile, Image *ofile) dataset = 0; recnum = 0; line=(char *) AcquireQuantumMemory((size_t) inputlen,sizeof(*line)); - name = token = (char *)NULL; + name = token = (char *) NULL; savedpos = 0; token_info=AcquireTokenInfo(); while (super_fgets_w(&line,&inputlen,ifile) != NULL) @@ -991,7 +991,7 @@ static int jpeg_embed(Image *ifile, Image *ofile, Image *iptc) /* APP0 is in each and every JPEG, so when we hit APP0 we insert our new APP13! */ jpeg_skip_variable(ifile, ofile); - if (iptc != (Image *)NULL) + if (iptc != (Image *) NULL) { char psheader[] = "\xFF\xED\0\0Photoshop 3.0\0" "8BIM\x04\x04\0\0\0\0"; diff --git a/coders/msl.c b/coders/msl.c index 03e081da7..d5de506c0 100644 --- a/coders/msl.c +++ b/coders/msl.c @@ -6763,7 +6763,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, else if (LocaleCompare((const char *) tag,"stegano") == 0) { Image * - watermark = (Image*)NULL; + watermark = (Image*) NULL; if (msl_info->image[n] == (Image *) NULL) { @@ -6829,7 +6829,7 @@ static void MSLStartElement(void *context,const xmlChar *tag, else if (LocaleCompare((const char *) tag,"stereo") == 0) { Image * - stereoImage = (Image*)NULL; + stereoImage = (Image*) NULL; if (msl_info->image[n] == (Image *) NULL) { diff --git a/coders/pcx.c b/coders/pcx.c index c7b261ef9..af394bc4d 100644 --- a/coders/pcx.c +++ b/coders/pcx.c @@ -401,7 +401,7 @@ static Image *ReadPCXImage(const ImageInfo *image_info,ExceptionInfo *exception) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); scanline=(unsigned char *) AcquireQuantumMemory(MagickMax(image->columns, pcx_info.bytes_per_line),MagickMax(8,pcx_info.planes)*sizeof(*scanline)); - pixel_info=AcquireVirtualMemory(pcx_packets,sizeof(*pixels)); + pixel_info=AcquireVirtualMemory(pcx_packets,2*sizeof(*pixels)); if ((scanline == (unsigned char *) NULL) || (pixel_info == (MemoryInfo *) NULL)) { diff --git a/coders/pict.c b/coders/pict.c index 437eb9ecc..83de8276f 100644 --- a/coders/pict.c +++ b/coders/pict.c @@ -474,7 +474,8 @@ static unsigned char *DecodeImage(Image *blob,Image *image, return((unsigned char *) NULL); *extent=row_bytes*image->rows*sizeof(*pixels); (void) ResetMagickMemory(pixels,0,*extent); - scanline=(unsigned char *) AcquireQuantumMemory(row_bytes,sizeof(*scanline)); + scanline=(unsigned char *) AcquireQuantumMemory(row_bytes,2* + sizeof(*scanline)); if (scanline == (unsigned char *) NULL) return((unsigned char *) NULL); if (bytes_per_line < 8) diff --git a/coders/psd.c b/coders/psd.c index 2efab1806..f97e44943 100644 --- a/coders/psd.c +++ b/coders/psd.c @@ -50,6 +50,7 @@ #include "MagickCore/cache.h" #include "MagickCore/channel.h" #include "MagickCore/colormap.h" +#include "MagickCore/colormap-private.h" #include "MagickCore/colorspace.h" #include "MagickCore/colorspace-private.h" #include "MagickCore/constitute.h" @@ -715,7 +716,7 @@ static MagickStatusType ReadPSDChannelPixels(Image *image, else SetPixelIndex(image,ScaleQuantumToShort(pixel),q); SetPixelInfoPixel(image,image->colormap+(ssize_t) - GetPixelIndex(image,q),q); + ConstrainColormapIndex(image,GetPixelIndex(image,q),exception),q); if (image->depth == 1) { ssize_t @@ -803,7 +804,7 @@ static MagickStatusType ReadPSDChannelRaw(Image *image,const size_t channels, " layer data is RAW"); row_size=GetPSDRowSize(image); - pixels=(unsigned char *) AcquireQuantumMemory(8*row_size,sizeof(*pixels)); + pixels=(unsigned char *) AcquireQuantumMemory(row_size,8*sizeof(*pixels)); if (pixels == (unsigned char *) NULL) ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename); @@ -872,7 +873,7 @@ static MagickStatusType ReadPSDChannelRLE(Image *image,const PSDInfo *psd_info, " layer data is RLE compressed"); row_size=GetPSDRowSize(image); - pixels=(unsigned char *) AcquireQuantumMemory(8*row_size,sizeof(*pixels)); + pixels=(unsigned char *) AcquireQuantumMemory(row_size,8*sizeof(*pixels)); if (pixels == (unsigned char *) NULL) ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename); @@ -889,7 +890,8 @@ static MagickStatusType ReadPSDChannelRLE(Image *image,const PSDInfo *psd_info, image->filename); } - compact_pixels=(unsigned char *) AcquireQuantumMemory(length,sizeof(*pixels)); + compact_pixels=(unsigned char *) AcquireQuantumMemory(length, + 8*sizeof(*pixels)); if (compact_pixels == (unsigned char *) NULL) { pixels=(unsigned char *) RelinquishMagickMemory(pixels); diff --git a/coders/wmf.c b/coders/wmf.c index 611ec58fd..3b5a7bba1 100644 --- a/coders/wmf.c +++ b/coders/wmf.c @@ -2126,7 +2126,7 @@ static void util_set_pen(wmfAPI * API, wmfDC * dc) case PS_SOLID: default: { - (void) DrawSetStrokeDashArray(WmfDrawingWand,0,(double *)NULL); + (void) DrawSetStrokeDashArray(WmfDrawingWand,0,(double *) NULL); break; } } diff --git a/coders/wpg.c b/coders/wpg.c index a584c9f10..0577a2c42 100644 --- a/coders/wpg.c +++ b/coders/wpg.c @@ -465,7 +465,7 @@ static int UnpackWPGRaster(Image *image,int bpp,ExceptionInfo *exception) ldblk=(ssize_t) ((bpp*image->columns+7)/8); BImgBuff=(unsigned char *) AcquireQuantumMemory((size_t) ldblk, - 4*sizeof(*BImgBuff)); + 8*sizeof(*BImgBuff)); if(BImgBuff==NULL) return(-2); while(y<(ssize_t) image->rows) diff --git a/coders/xpm.c b/coders/xpm.c index e7e7f1225..b78b0f91a 100644 --- a/coders/xpm.c +++ b/coders/xpm.c @@ -165,7 +165,7 @@ static size_t CopyXPMColor(char *destination,const char *source,size_t length) static char *NextXPMLine(char *p) { - assert(p != (char *)NULL); + assert(p != (char *) NULL); p=strchr(p,'\n'); if (p != (char *) NULL) p++; @@ -389,6 +389,8 @@ static Image *ReadXPMImage(const ImageInfo *image_info,ExceptionInfo *exception) { while ((isspace((int) ((unsigned char) *q)) == 0) && (*q != '\0')) q++; + if ((next-q) < 0) + break; if (next != (char *) NULL) (void) CopyXPMColor(target,q,MagickMin((size_t) (next-q), MaxTextExtent)); diff --git a/tests/drawtest.c b/tests/drawtest.c index 961f431f9..3cebfa91e 100644 --- a/tests/drawtest.c +++ b/tests/drawtest.c @@ -113,7 +113,7 @@ static MagickBooleanType ScribbleImage(MagickWand *canvas) DrawSetStrokeWidth(picasso,4.032); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); - (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); + (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); (void) PixelSetColor(color,"#ff0000"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); @@ -128,7 +128,7 @@ static MagickBooleanType ScribbleImage(MagickWand *canvas) DrawSetStrokeWidth(picasso,9); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); - (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); + (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); (void) PixelSetColor(color,"#00ff00"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); @@ -157,7 +157,7 @@ static MagickBooleanType ScribbleImage(MagickWand *canvas) DrawSetStrokeWidth(picasso,2.016); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); - (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); + (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); (void) PixelSetColor(color,"#000080"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); @@ -172,7 +172,7 @@ static MagickBooleanType ScribbleImage(MagickWand *canvas) DrawSetStrokeWidth(picasso,3.024); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); - (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); + (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); (void) PixelSetColor(color,"#000080"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); @@ -203,7 +203,7 @@ static MagickBooleanType ScribbleImage(MagickWand *canvas) DrawSetStrokeWidth(picasso,3.024); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); - (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); + (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); (void) PixelSetColor(color,"#ff8000"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); @@ -218,7 +218,7 @@ static MagickBooleanType ScribbleImage(MagickWand *canvas) DrawSetStrokeWidth(picasso,12.02); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); - (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); + (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); (void) PixelSetColor(color,"#4000c2"); DrawSetStrokeColor(picasso,color); (void) PixelSetColor(color,"none"); @@ -232,7 +232,7 @@ static MagickBooleanType ScribbleImage(MagickWand *canvas) DrawSetStrokeWidth(picasso,9); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); - (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); + (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); (void) PixelSetColor(color,"#4000c2"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); @@ -253,7 +253,7 @@ static MagickBooleanType ScribbleImage(MagickWand *canvas) DrawSetStrokeWidth(picasso,9); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); - (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); + (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); (void) PixelSetColor(color,"#4000c2"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); @@ -275,7 +275,7 @@ static MagickBooleanType ScribbleImage(MagickWand *canvas) DrawSetStrokeWidth(picasso,9); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); - (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); + (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); (void) PixelSetColor(color,"#4000c2"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); @@ -298,7 +298,7 @@ static MagickBooleanType ScribbleImage(MagickWand *canvas) DrawSetStrokeWidth(picasso,5.976); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); - (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); + (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); (void) PixelSetColor(color,"#4000c2"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); @@ -319,7 +319,7 @@ static MagickBooleanType ScribbleImage(MagickWand *canvas) DrawSetStrokeWidth(picasso,5.976); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); - (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); + (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); (void) PixelSetColor(color,"#4000c2"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); @@ -387,7 +387,7 @@ static MagickBooleanType ScribbleImage(MagickWand *canvas) DrawSetStrokeWidth(picasso,5.904); DrawSetStrokeLineCap(picasso,RoundCap); DrawSetStrokeLineJoin(picasso,RoundJoin); - (void) DrawSetStrokeDashArray(picasso,0,(const double *)NULL); + (void) DrawSetStrokeDashArray(picasso,0,(const double *) NULL); (void) PixelSetColor(color,"#4000c2"); DrawSetStrokeColor(picasso,color); DrawSetFillRule(picasso,EvenOddRule); -- 2.40.0