From: Cristy Date: Wed, 26 Aug 2015 15:23:17 +0000 (-0400) Subject: Allow NULL tags when throwing an exception X-Git-Tag: 7.0.1-0~668 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ec628494678148de3428d71140eb56f5630b9ced;p=imagemagick Allow NULL tags when throwing an exception --- diff --git a/MagickCore/exception-private.h b/MagickCore/exception-private.h index ba4437fbf..c81bdbf98 100644 --- a/MagickCore/exception-private.h +++ b/MagickCore/exception-private.h @@ -28,10 +28,9 @@ extern "C" { #define ThrowBinaryException(severity,tag,context) \ { \ - assert(tag != (const char *) NULL); \ if (image != (Image *) NULL) \ - (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \ - "`%s'",context); \ + (void) ThrowMagickException(exception,GetMagickModule(),severity, \ + tag == (const char *) NULL ? "unknown" : tag,"`%s'",context); \ return(MagickFalse); \ } #define ThrowFatalException(severity,tag) \ @@ -42,11 +41,10 @@ extern "C" { ExceptionInfo \ *exception; \ \ - assert(tag != (const char *) NULL); \ exception=AcquireExceptionInfo(); \ message=GetExceptionMessage(errno); \ - (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \ - "`%s'",message); \ + (void) ThrowMagickException(exception,GetMagickModule(),severity, \ + tag == (const char *) NULL ? "unknown" : tag,"`%s'",message); \ message=DestroyString(message); \ CatchException(exception); \ (void) DestroyExceptionInfo(exception); \ @@ -58,24 +56,21 @@ extern "C" { char \ *message; \ \ - assert(tag != (const char *) NULL); \ message=GetExceptionMessage(errno); \ - (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \ - "'%s': %s",context,message); \ + (void) ThrowMagickException(exception,GetMagickModule(),severity, \ + tag == (const char *) NULL ? "unknown" : tag,"'%s': %s",context,message); \ message=DestroyString(message); \ } #define ThrowImageException(severity,tag) \ { \ - assert(tag != (const char *) NULL); \ - (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \ - "`%s'",image->filename); \ + (void) ThrowMagickException(exception,GetMagickModule(),severity, \ + tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \ return((Image *) NULL); \ } #define ThrowReaderException(severity,tag) \ { \ - assert(tag != (const char *) NULL); \ - (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \ - "`%s'",image_info->filename); \ + (void) ThrowMagickException(exception,GetMagickModule(),severity, \ + tag == (const char *) NULL ? "unknown" : tag,"`%s'",image_info->filename); \ if ((image) != (Image *) NULL) \ { \ (void) CloseBlob(image); \ @@ -85,9 +80,8 @@ extern "C" { } #define ThrowWriterException(severity,tag) \ { \ - assert(tag != (const char *) NULL); \ - (void) ThrowMagickException(exception,GetMagickModule(),severity,tag, \ - "`%s'",image->filename); \ + (void) ThrowMagickException(exception,GetMagickModule(),severity, \ + tag == (const char *) NULL ? "unknown" : tag,"`%s'",image->filename); \ if (image_info->adjoin != MagickFalse) \ while (image->previous != (Image *) NULL) \ image=image->previous; \