From: cristy Date: Fri, 13 Sep 2013 22:35:48 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~3318 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ebd71f4a4d535b9bd4465e44331c1825e32ee1ee;p=imagemagick --- diff --git a/MagickWand/compare.c b/MagickWand/compare.c index 5464810a9..599c88ae7 100644 --- a/MagickWand/compare.c +++ b/MagickWand/compare.c @@ -1224,10 +1224,10 @@ WandExport MagickBooleanType CompareImagesCommand(ImageInfo *image_info, (metric == UndefinedErrorMetric)) { if (fabs(distortion-1.0) > CompareEpsilon) - return(MagickTrue); + (void) SetImageOption(image_info,"compare:dissimilar","true"); } else if (fabs(distortion) > CompareEpsilon) - return(MagickTrue); + (void) SetImageOption(image_info,"compare:dissimilar","true"); return(status != 0 ? MagickTrue : MagickFalse); } diff --git a/MagickWand/drawing-wand.c b/MagickWand/drawing-wand.c index d78a46d5c..4e54909e5 100644 --- a/MagickWand/drawing-wand.c +++ b/MagickWand/drawing-wand.c @@ -4302,7 +4302,7 @@ WandExport MagickBooleanType DrawRender(DrawingWand *wand) ThrowDrawException(WandError,"ContainsNoImages",wand->name); status=DrawImage(wand->image,CurrentContext,wand->exception); CurrentContext->primitive=(char *) NULL; - return(status); + return(status == MagickFalse ? 0 : 1); } /* diff --git a/MagickWand/magick-image.c b/MagickWand/magick-image.c index 990ff7246..845e6b3ba 100644 --- a/MagickWand/magick-image.c +++ b/MagickWand/magick-image.c @@ -626,7 +626,7 @@ WandExport MagickBooleanType MagickAnnotateImage(MagickWand *wand, (void) CloneString(&draw_info->geometry,geometry); status=AnnotateImage(wand->images,draw_info,wand->exception); draw_info=DestroyDrawInfo(draw_info); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -666,7 +666,7 @@ WandExport MagickBooleanType MagickAnimateImages(MagickWand *wand, (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); (void) CloneString(&wand->image_info->server_name,server_name); status=AnimateImages(wand->image_info,wand->images,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -754,7 +754,7 @@ WandExport MagickBooleanType MagickAutoGammaImage(MagickWand *wand) if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=AutoGammaImage(wand->images,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -792,7 +792,7 @@ WandExport MagickBooleanType MagickAutoLevelImage(MagickWand *wand) if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=AutoLevelImage(wand->images,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -842,7 +842,7 @@ WandExport MagickBooleanType MagickBlackThresholdImage(MagickWand *wand, PixelGetRedQuantum(threshold),PixelGetGreenQuantum(threshold), PixelGetBlueQuantum(threshold),PixelGetAlphaQuantum(threshold)); status=BlackThresholdImage(wand->images,thresholds,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -1045,7 +1045,7 @@ WandExport MagickBooleanType MagickBrightnessContrastImage( ThrowWandException(WandError,"ContainsNoImages",wand->name); status=BrightnessContrastImage(wand->images,brightness,contrast, wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -1281,7 +1281,7 @@ WandExport MagickBooleanType MagickClipImage(MagickWand *wand) if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=ClipImage(wand->images,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -1329,7 +1329,7 @@ WandExport MagickBooleanType MagickClipImagePath(MagickWand *wand, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=ClipImagePath(wand->images,pathname,inside,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -1372,7 +1372,7 @@ WandExport MagickBooleanType MagickClutImage(MagickWand *wand, if ((wand->images == (Image *) NULL) || (clut_wand->images == (Image *) NULL)) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=ClutImage(wand->images,clut_wand->images,method,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -1476,7 +1476,7 @@ WandExport MagickBooleanType MagickColorDecisionListImage(MagickWand *wand, ThrowWandException(WandError,"ContainsNoImages",wand->name); status=ColorDecisionListImage(wand->images,color_correction_collection, wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -1685,7 +1685,7 @@ WandExport MagickBooleanType MagickCommentImage(MagickWand *wand, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=SetImageProperty(wand->images,"comment",comment,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -1847,7 +1847,7 @@ WandExport MagickBooleanType MagickCompositeImage(MagickWand *wand, ThrowWandException(WandError,"ContainsNoImages",wand->name); status=CompositeImage(wand->images,source_wand->images,compose,clip_to_self, x,y,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -1919,7 +1919,7 @@ WandExport MagickBooleanType MagickCompositeLayers(MagickWand *wand, ThrowWandException(WandError,"ContainsNoImages",wand->name); CompositeLayers(wand->images,compose,source_wand->images,x,y,wand->exception); status=MagickTrue; /* FUTURE: determine status from exceptions */ - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -1963,7 +1963,7 @@ WandExport MagickBooleanType MagickContrastImage(MagickWand *wand, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=ContrastImage(wand->images,sharpen,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -2010,7 +2010,7 @@ WandExport MagickBooleanType MagickContrastStretchImage(MagickWand *wand, ThrowWandException(WandError,"ContainsNoImages",wand->name); status=ContrastStretchImage(wand->images,black_point,white_point, wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -2156,7 +2156,7 @@ WandExport MagickBooleanType MagickCycleColormapImage(MagickWand *wand, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=CycleColormapImage(wand->images,displace,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -2469,7 +2469,7 @@ WandExport MagickBooleanType MagickDisplayImage(MagickWand *wand, (void) CloneString(&wand->image_info->server_name,server_name); status=DisplayImages(wand->image_info,image,wand->exception); image=DestroyImage(image); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -2509,7 +2509,7 @@ WandExport MagickBooleanType MagickDisplayImages(MagickWand *wand, (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); (void) CloneString(&wand->image_info->server_name,server_name); status=DisplayImages(wand->image_info,wand->images,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -2646,7 +2646,7 @@ WandExport MagickBooleanType MagickDrawImage(MagickWand *wand, draw_info->primitive=primitive; status=DrawImage(wand->images,draw_info,wand->exception); draw_info=DestroyDrawInfo(draw_info); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -2859,7 +2859,7 @@ WandExport MagickBooleanType MagickEqualizeImage(MagickWand *wand) if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=EqualizeImage(wand->images,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -2926,7 +2926,7 @@ WandExport MagickBooleanType MagickEvaluateImage(MagickWand *wand, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=EvaluateImage(wand->images,op,value,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -2996,7 +2996,7 @@ WandExport MagickBooleanType MagickExportImagePixels(MagickWand *wand, ThrowWandException(WandError,"ContainsNoImages",wand->name); status=ExportImagePixels(wand->images,x,y,columns,rows,map, storage,pixels,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -3170,7 +3170,7 @@ WandExport MagickBooleanType MagickFloodfillPaintImage(MagickWand *wand, status=FloodfillPaintImage(wand->images,draw_info,&target,x,y,invert, wand->exception); draw_info=DestroyDrawInfo(draw_info); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -3382,7 +3382,7 @@ WandExport MagickBooleanType MagickFunctionImage(MagickWand *wand, ThrowWandException(WandError,"ContainsNoImages",wand->name); status=FunctionImage(wand->images,function,number_arguments,arguments, wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -3470,7 +3470,7 @@ WandExport MagickBooleanType MagickGammaImage(MagickWand *wand, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=GammaImage(wand->images,gamma,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -3955,7 +3955,7 @@ WandExport MagickBooleanType MagickGetImageKurtosis(MagickWand *wand, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=GetImageKurtosis(wand->images,kurtosis,skewness,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -4001,7 +4001,7 @@ WandExport MagickBooleanType MagickGetImageMean(MagickWand *wand,double *mean, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=GetImageMean(wand->images,mean,standard_deviation,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -4044,7 +4044,7 @@ WandExport MagickBooleanType MagickGetImageRange(MagickWand *wand, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=GetImageRange(wand->images,minima,maxima,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -4474,7 +4474,7 @@ WandExport MagickBooleanType MagickGetImageDistortion(MagickWand *wand, ThrowWandException(WandError,"ContainsNoImages",wand->name); status=GetImageDistortion(wand->images,reference->images,metric,distortion, wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -5813,7 +5813,7 @@ WandExport MagickBooleanType MagickHaldClutImage(MagickWand *wand, if ((wand->images == (Image *) NULL) || (hald_wand->images == (Image *) NULL)) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=HaldClutImage(wand->images,hald_wand->images,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -6066,7 +6066,7 @@ WandExport MagickBooleanType MagickImportImagePixels(MagickWand *wand, ThrowWandException(WandError,"ContainsNoImages",wand->name); status=ImportImagePixels(wand->images,x,y,columns,rows,map,storage,pixels, wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -6215,7 +6215,7 @@ WandExport MagickBooleanType MagickLabelImage(MagickWand *wand, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=SetImageProperty(wand->images,"label",label,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -6274,7 +6274,7 @@ WandExport MagickBooleanType MagickLevelImage(MagickWand *wand, ThrowWandException(WandError,"ContainsNoImages",wand->name); status=LevelImage(wand->images,black_point,white_point,gamma, wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -6321,7 +6321,7 @@ WandExport MagickBooleanType MagickLinearStretchImage(MagickWand *wand, ThrowWandException(WandError,"ContainsNoImages",wand->name); status=LinearStretchImage(wand->images,black_point,white_point, wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -6572,7 +6572,7 @@ WandExport MagickBooleanType MagickModulateImage(MagickWand *wand, (void) FormatLocaleString(modulate,MaxTextExtent,"%g,%g,%g", brightness,saturation,hue); status=ModulateImage(wand->images,modulate,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -6883,7 +6883,7 @@ WandExport MagickBooleanType MagickNegateImage(MagickWand *wand, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=NegateImage(wand->images,gray,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -7033,7 +7033,7 @@ WandExport MagickBooleanType MagickNormalizeImage(MagickWand *wand) if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=NormalizeImage(wand->images,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -7144,7 +7144,7 @@ WandExport MagickBooleanType MagickOpaquePaintImage(MagickWand *wand, wand->images->fuzz=fuzz; status=OpaquePaintImage(wand->images,&target_pixel,&fill_pixel,invert, wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -7287,7 +7287,7 @@ WandExport MagickBooleanType MagickOrderedPosterizeImage(MagickWand *wand, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=OrderedPosterizeImage(wand->images,threshold_map,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -7537,7 +7537,7 @@ WandExport MagickBooleanType MagickPosterizeImage(MagickWand *wand, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=PosterizeImage(wand->images,levels,dither,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -7720,7 +7720,7 @@ WandExport MagickBooleanType MagickQuantizeImage(MagickWand *wand, quantize_info->measure_error=measure_error; status=QuantizeImage(quantize_info,wand->images,wand->exception); quantize_info=DestroyQuantizeInfo(quantize_info); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -7798,7 +7798,7 @@ WandExport MagickBooleanType MagickQuantizeImages(MagickWand *wand, quantize_info->measure_error=measure_error; status=QuantizeImages(quantize_info,wand->images,wand->exception); quantize_info=DestroyQuantizeInfo(quantize_info); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -7898,7 +7898,7 @@ WandExport MagickBooleanType MagickRaiseImage(MagickWand *wand, raise_info.x=x; raise_info.y=y; status=RaiseImage(wand->images,&raise_info,raise,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -8138,7 +8138,7 @@ WandExport MagickBooleanType MagickRemapImage(MagickWand *wand, status=RemapImage(quantize_info,wand->images,remap_wand->images, wand->exception); quantize_info=DestroyQuantizeInfo(quantize_info); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -8585,7 +8585,7 @@ MagickExport MagickBooleanType MagickSegmentImage(MagickWand *wand, ThrowWandException(WandError,"ContainsNoImages",wand->name); status=SegmentImage(wand->images,colorspace,verbose,cluster_threshold, smooth_threshold,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -9898,7 +9898,7 @@ WandExport MagickBooleanType MagickSetImageAlpha(MagickWand *wand, ThrowWandException(WandError,"ContainsNoImages",wand->name); status=SetImageAlpha(wand->images,ClampToQuantum(QuantumRange*alpha), wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -10713,7 +10713,7 @@ WandExport MagickBooleanType MagickSigmoidalContrastImage( ThrowWandException(WandError,"ContainsNoImages",wand->name); status=SigmoidalContrastImage(wand->images,sharpen,alpha,beta, wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -10920,7 +10920,7 @@ WandExport MagickBooleanType MagickSolarizeImage(MagickWand *wand, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=SolarizeImage(wand->images,threshold,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -11432,7 +11432,7 @@ WandExport MagickBooleanType MagickThresholdImage(MagickWand *wand, status; status=MagickThresholdImageChannel(wand,DefaultChannels,threshold); - return(status); + return(status == MagickFalse ? 0 : 1); } WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand, @@ -11448,7 +11448,7 @@ WandExport MagickBooleanType MagickThresholdImageChannel(MagickWand *wand, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=BilevelImage(wand->images,threshold,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -11733,7 +11733,7 @@ WandExport MagickBooleanType MagickTransparentPaintImage(MagickWand *wand, wand->images->fuzz=fuzz; status=TransparentPaintImage(wand->images,&target_pixel,ClampToQuantum( QuantumRange*alpha),invert,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -12167,7 +12167,7 @@ WandExport MagickBooleanType MagickWriteImage(MagickWand *wand, status=WriteImage(write_info,image,wand->exception); image=DestroyImage(image); write_info=DestroyImageInfo(write_info); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -12221,7 +12221,7 @@ WandExport MagickBooleanType MagickWriteImageFile(MagickWand *wand,FILE *file) status=WriteImage(write_info,image,wand->exception); write_info=DestroyImageInfo(write_info); image=DestroyImage(image); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -12270,7 +12270,7 @@ WandExport MagickBooleanType MagickWriteImages(MagickWand *wand, write_info->adjoin=adjoin; status=WriteImages(write_info,wand->images,filename,wand->exception); write_info=DestroyImageInfo(write_info); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -12317,5 +12317,5 @@ WandExport MagickBooleanType MagickWriteImagesFile(MagickWand *wand,FILE *file) status=WriteImages(write_info,wand->images,(const char *) NULL, wand->exception); write_info=DestroyImageInfo(write_info); - return(status); + return(status == MagickFalse ? 0 : 1); } diff --git a/MagickWand/magick-property.c b/MagickWand/magick-property.c index d0ec8c630..6135ac02f 100644 --- a/MagickWand/magick-property.c +++ b/MagickWand/magick-property.c @@ -2251,7 +2251,7 @@ WandExport MagickBooleanType MagickSetGravity(MagickWand *wand, status=SetImageOption(wand->image_info,"gravity",CommandOptionToMnemonic( MagickGravityOptions,(ssize_t) type)); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -2346,7 +2346,7 @@ WandExport MagickBooleanType MagickSetImageProfile(MagickWand *wand, SetStringInfoDatum(profile_info,(unsigned char *) profile); status=SetImageProfile(wand->images,name,profile_info,wand->exception); profile_info=DestroyStringInfo(profile_info); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -2390,7 +2390,7 @@ WandExport MagickBooleanType MagickSetImageProperty(MagickWand *wand, if (wand->images == (Image *) NULL) ThrowWandException(WandError,"ContainsNoImages",wand->name); status=SetImageProperty(wand->images,property,value,wand->exception); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -2469,7 +2469,7 @@ WandExport MagickBooleanType MagickSetInterpolateMethod(MagickWand *wand, status=SetImageOption(wand->image_info,"interpolate", CommandOptionToMnemonic(MagickInterpolateOptions,(ssize_t) method)); - return(status); + return(status == MagickFalse ? 0 : 1); } /* diff --git a/MagickWand/mogrify-private.h b/MagickWand/mogrify-private.h index ee27fb02f..459c9ffd5 100644 --- a/MagickWand/mogrify-private.h +++ b/MagickWand/mogrify-private.h @@ -35,6 +35,7 @@ extern "C" { PopImageStack(); \ image_stack[k].image=DestroyImageList(image_stack[k].image); \ image_stack[k].image_info=DestroyImageInfo(image_stack[k].image_info); \ + image_info=image_stack[MaxImageStackDepth].image_info; \ } #define FinalizeImageSettings(image_info,image,advance) \ { \ @@ -63,6 +64,7 @@ extern "C" { #define MaxImageStackDepth 128 #define NewImageStack() \ { \ + image_stack[MaxImageStackDepth].image_info=image_info; \ image_stack[0].image_info=CloneImageInfo(image_info); \ image_stack[0].image=NewImageList(); \ image_info=image_stack[0].image_info; \ diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c index 45c4303de..99096c4fe 100644 --- a/MagickWand/mogrify.c +++ b/MagickWand/mogrify.c @@ -183,7 +183,7 @@ WandExport MagickBooleanType MagickCommandGenesis(ImageInfo *image_info, (void) fputs(*metadata,stdout); *metadata=DestroyString(*metadata); } - return(status); + return(status == MagickFalse ? 0 : 1); } number_threads=GetOpenMPMaximumThreads(); serial=0.0; @@ -272,13 +272,12 @@ WandExport MagickBooleanType MagickCommandGenesis(ImageInfo *image_info, (double) n)))-(1.0/(double) n))/(1.0-1.0/(double) n); (void) FormatLocaleFile(stderr, "Performance[%.20g]: %.20gi %0.3fips %0.3fe %0.3fu %lu:%02lu.%03lu\n", - (double) n,(double) iterations,(double) iterations/parallel,e, - user_time,(unsigned long) (parallel/60.0),(unsigned long) - floor(fmod(parallel,60.0)),(unsigned long) - (1000.0*(parallel-floor(parallel))+0.5)); + (double) n,(double) iterations,(double) iterations/parallel,e,user_time, + (unsigned long) (parallel/60.0),(unsigned long) floor(fmod(parallel, + 60.0)),(unsigned long) (1000.0*(parallel-floor(parallel))+0.5)); timer=DestroyTimerInfo(timer); } - return(status); + return(status == MagickFalse ? 0 : 1); } /* diff --git a/MagickWand/operation.c b/MagickWand/operation.c index e9ab8c6c8..c1377e39b 100644 --- a/MagickWand/operation.c +++ b/MagickWand/operation.c @@ -4313,10 +4313,10 @@ WandPrivate MagickBooleanType CLIListOperatorImages(MagickCLI *cli_wand, /* if new image list generated, replace existing image list */ if (new_images == (Image *) NULL) - return(status); + return(status == MagickFalse ? 0 : 1); _images=DestroyImageList(_images); _images=GetFirstImageInList(new_images); - return(status); + return(status == MagickFalse ? 0 : 1); #undef _image_info #undef _images diff --git a/MagickWand/pixel-wand.c b/MagickWand/pixel-wand.c index ff209a1d4..29eb699a3 100644 --- a/MagickWand/pixel-wand.c +++ b/MagickWand/pixel-wand.c @@ -1699,7 +1699,7 @@ WandExport MagickBooleanType PixelSetColor(PixelWand *wand,const char *color) status=QueryColorCompliance(color,AllCompliance,&pixel,wand->exception); if (status != MagickFalse) wand->pixel=pixel; - return(status); + return(status == MagickFalse ? 0 : 1); } /* diff --git a/MagickWand/wand-view.c b/MagickWand/wand-view.c index 5f71c10a7..55d73867a 100644 --- a/MagickWand/wand-view.c +++ b/MagickWand/wand-view.c @@ -381,7 +381,7 @@ WandExport MagickBooleanType DuplexTransferWandViewIterator(WandView *source, status=MagickFalse; } } - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -588,7 +588,7 @@ WandExport MagickBooleanType GetWandViewIterator(WandView *source, status=MagickFalse; } } - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -998,7 +998,7 @@ WandExport MagickBooleanType SetWandViewIterator(WandView *destination, status=MagickFalse; } } - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -1160,7 +1160,7 @@ WandExport MagickBooleanType TransferWandViewIterator(WandView *source, status=MagickFalse; } } - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -1293,5 +1293,5 @@ WandExport MagickBooleanType UpdateWandViewIterator(WandView *source, status=MagickFalse; } } - return(status); + return(status == MagickFalse ? 0 : 1); } diff --git a/MagickWand/wandcli.c b/MagickWand/wandcli.c index fa5fc8d6f..60786e918 100644 --- a/MagickWand/wandcli.c +++ b/MagickWand/wandcli.c @@ -253,7 +253,7 @@ WandExport MagickBooleanType CLICatchException(MagickCLI *cli_wand, if ( IfMagickFalse(status) || IfMagickTrue(all_exceptions) ) CatchException(cli_wand->wand.exception); /* output and clear exceptions */ - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -299,7 +299,7 @@ WandExport MagickBooleanType CLILogEvent(MagickCLI *cli_wand, va_end(operands); - return(status); + return(status == MagickFalse ? 0 : 1); } /* @@ -349,5 +349,5 @@ WandExport MagickBooleanType CLIThrowException(MagickCLI *cli_wand, module,function,line, severity,tag,new_format,operands); va_end(operands); - return(status); + return(status == MagickFalse ? 0 : 1); } diff --git a/utilities/animate.c b/utilities/animate.c index 8ff708397..509b32147 100644 --- a/utilities/animate.c +++ b/utilities/animate.c @@ -86,7 +86,7 @@ static int AnimateMain(int argc,char **argv) image_info=DestroyImageInfo(image_info); exception=DestroyExceptionInfo(exception); MagickCoreTerminus(); - return(status); + return(status == MagickFalse ? 0 : 1); } #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) @@ -111,6 +111,6 @@ int wmain(int argc,wchar_t *argv[]) for (i=0; i < argc; i++) utf8[i]=DestroyString(utf8[i]); utf8=(char **) RelinquishMagickMemory(utf8); - return(status); + return(status == MagickFalse ? 0 : 1); } #endif diff --git a/utilities/compare.1.in b/utilities/compare.1.in index 5fba1dda8..b967d54fe 100644 --- a/utilities/compare.1.in +++ b/utilities/compare.1.in @@ -68,6 +68,9 @@ Miscellaneous Options: \-version print version information By default, the image format of `file' is determined by its magic number. To specify a particular image format, precede the filename with an image format name and a colon (i.e. ps:image) or specify the image type as the filename suffix (i.e. image.ps). Specify 'file' as '-' for standard input or output. + +The compare program returns 2 on error otherwise 0 if the images are similar or +1 if they are dissimilar. .SH SEE ALSO ImageMagick(1) diff --git a/utilities/compare.c b/utilities/compare.c index e6adbd54e..92134d36b 100644 --- a/utilities/compare.c +++ b/utilities/compare.c @@ -63,6 +63,9 @@ static int CompareMain(int argc,char **argv) char *metadata; + const char + *option; + ExceptionInfo *exception; @@ -70,6 +73,7 @@ static int CompareMain(int argc,char **argv) *image_info; MagickBooleanType + dissimilar, status; MagickCoreGenesis(*argv,MagickTrue); @@ -80,10 +84,14 @@ static int CompareMain(int argc,char **argv) &metadata,exception); if (metadata != (char *) NULL) metadata=DestroyString(metadata); + option=GetImageOption(image_info,"compare:dissimilar"); + dissimilar=IsStringTrue(option); image_info=DestroyImageInfo(image_info); exception=DestroyExceptionInfo(exception); MagickCoreTerminus(); - return(status); + if (dissimilar != MagickFalse) + return(1); + return(status == MagickFalse ? 0 : 2); } #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) @@ -108,6 +116,6 @@ int wmain(int argc,wchar_t *argv[]) for (i=0; i < argc; i++) utf8[i]=DestroyString(utf8[i]); utf8=(char **) RelinquishMagickMemory(utf8); - return(status); + return(status == MagickFalse ? 0 : 1); } #endif diff --git a/utilities/composite.c b/utilities/composite.c index f37c17f48..d3523571f 100644 --- a/utilities/composite.c +++ b/utilities/composite.c @@ -77,7 +77,7 @@ static int CompositeMain(int argc,char **argv) image_info=DestroyImageInfo(image_info); exception=DestroyExceptionInfo(exception); MagickCoreTerminus(); - return(status); + return(status == MagickFalse ? 0 : 1); } #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) @@ -102,6 +102,6 @@ int wmain(int argc,wchar_t *argv[]) for (i=0; i < argc; i++) utf8[i]=DestroyString(utf8[i]); utf8=(char **) RelinquishMagickMemory(utf8); - return(status); + return(status == MagickFalse ? 0 : 1); } #endif diff --git a/utilities/conjure.c b/utilities/conjure.c index 9f6c1c479..e9fb0d994 100644 --- a/utilities/conjure.c +++ b/utilities/conjure.c @@ -96,7 +96,7 @@ static int ConjureMain(int argc,char **argv) image_info=DestroyImageInfo(image_info); exception=DestroyExceptionInfo(exception); MagickCoreTerminus(); - return(status); + return(status == MagickFalse ? 0 : 1); } #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) @@ -121,6 +121,6 @@ int wmain(int argc,wchar_t *argv[]) for (i=0; i < argc; i++) utf8[i]=DestroyString(utf8[i]); utf8=(char **) RelinquishMagickMemory(utf8); - return(status); + return(status == MagickFalse ? 0 : 1); } #endif diff --git a/utilities/convert.c b/utilities/convert.c index 513324c5c..946d08e83 100644 --- a/utilities/convert.c +++ b/utilities/convert.c @@ -83,7 +83,7 @@ static int ConvertMain(int argc,char **argv) image_info=DestroyImageInfo(image_info); exception=DestroyExceptionInfo(exception); MagickCoreTerminus(); - return(status); + return(status == MagickFalse ? 0 : 1); } #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) @@ -108,6 +108,6 @@ int wmain(int argc,wchar_t *argv[]) for (i=0; i < argc; i++) utf8[i]=DestroyString(utf8[i]); utf8=(char **) RelinquishMagickMemory(utf8); - return(status); + return(status == MagickFalse ? 0 : 1); } #endif diff --git a/utilities/display.c b/utilities/display.c index 95b69eeb3..1afdf5c19 100644 --- a/utilities/display.c +++ b/utilities/display.c @@ -91,7 +91,7 @@ static int DisplayMain(int argc,char **argv) image_info=DestroyImageInfo(image_info); exception=DestroyExceptionInfo(exception); MagickCoreTerminus(); - return(status); + return(status == MagickFalse ? 0 : 1); } #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) @@ -116,6 +116,6 @@ int wmain(int argc,wchar_t *argv[]) for (i=0; i < argc; i++) utf8[i]=DestroyString(utf8[i]); utf8=(char **) RelinquishMagickMemory(utf8); - return(status); + return(status == MagickFalse ? 0 : 1); } #endif diff --git a/utilities/identify.c b/utilities/identify.c index b70e1c796..588885cde 100644 --- a/utilities/identify.c +++ b/utilities/identify.c @@ -84,7 +84,7 @@ static int IdentifyMain(int argc,char **argv) image_info=DestroyImageInfo(image_info); exception=DestroyExceptionInfo(exception); MagickCoreTerminus(); - return(status); + return(status == MagickFalse ? 0 : 1); } #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) @@ -109,6 +109,6 @@ int wmain(int argc,wchar_t *argv[]) for (i=0; i < argc; i++) utf8[i]=DestroyString(utf8[i]); utf8=(char **) RelinquishMagickMemory(utf8); - return(status); + return(status == MagickFalse ? 0 : 1); } #endif diff --git a/utilities/import.c b/utilities/import.c index 4dac73374..6c2fb6920 100644 --- a/utilities/import.c +++ b/utilities/import.c @@ -83,7 +83,7 @@ static int ImportMain(int argc,char **argv) image_info=DestroyImageInfo(image_info); exception=DestroyExceptionInfo(exception); MagickCoreTerminus(); - return(status); + return(status == MagickFalse ? 0 : 1); } #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) @@ -108,6 +108,6 @@ int wmain(int argc,wchar_t *argv[]) for (i=0; i < argc; i++) utf8[i]=DestroyString(utf8[i]); utf8=(char **) RelinquishMagickMemory(utf8); - return(status); + return(status == MagickFalse ? 0 : 1); } #endif diff --git a/utilities/magick.c b/utilities/magick.c index 9ae354a22..151857cf3 100644 --- a/utilities/magick.c +++ b/utilities/magick.c @@ -76,7 +76,7 @@ static int MagickMain(int argc,char **argv) image_info=DestroyImageInfo(image_info); exception=DestroyExceptionInfo(exception); MagickCoreTerminus(); - return(status); + return(status == MagickFalse ? 0 : 1); } #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) @@ -101,6 +101,6 @@ int wmain(int argc,wchar_t *argv[]) for (i=0; i < argc; i++) utf8[i]=DestroyString(utf8[i]); utf8=(char **) RelinquishMagickMemory(utf8); - return(status); + return(status == MagickFalse ? 0 : 1); } #endif diff --git a/utilities/mogrify.c b/utilities/mogrify.c index 2f49ac183..51731d361 100644 --- a/utilities/mogrify.c +++ b/utilities/mogrify.c @@ -79,7 +79,7 @@ static int MogrifyMain(int argc,char **argv) image_info=DestroyImageInfo(image_info); exception=DestroyExceptionInfo(exception); MagickCoreTerminus(); - return(status); + return(status == MagickFalse ? 0 : 1); } #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) @@ -104,6 +104,6 @@ int wmain(int argc,wchar_t *argv[]) for (i=0; i < argc; i++) utf8[i]=DestroyString(utf8[i]); utf8=(char **) RelinquishMagickMemory(utf8); - return(status); + return(status == MagickFalse ? 0 : 1); } #endif diff --git a/utilities/montage.c b/utilities/montage.c index 13ad8e39e..1dc5ab02b 100644 --- a/utilities/montage.c +++ b/utilities/montage.c @@ -79,7 +79,7 @@ static int MontageMain(int argc,char **argv) image_info=DestroyImageInfo(image_info); exception=DestroyExceptionInfo(exception); MagickCoreTerminus(); - return(status); + return(status == MagickFalse ? 0 : 1); } #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) @@ -104,6 +104,6 @@ int wmain(int argc,wchar_t *argv[]) for (i=0; i < argc; i++) utf8[i]=DestroyString(utf8[i]); utf8=(char **) RelinquishMagickMemory(utf8); - return(status); + return(status == MagickFalse ? 0 : 1); } #endif diff --git a/utilities/stream.c b/utilities/stream.c index 324c5cf69..c0a0c109d 100644 --- a/utilities/stream.c +++ b/utilities/stream.c @@ -79,7 +79,7 @@ static int StreamMain(int argc,char **argv) image_info=DestroyImageInfo(image_info); exception=DestroyExceptionInfo(exception); MagickCoreTerminus(); - return(status); + return(status == MagickFalse ? 0 : 1); } #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) @@ -104,6 +104,6 @@ int wmain(int argc,wchar_t *argv[]) for (i=0; i < argc; i++) utf8[i]=DestroyString(utf8[i]); utf8=(char **) RelinquishMagickMemory(utf8); - return(status); + return(status == MagickFalse ? 0 : 1); } #endif