]> granicus.if.org Git - imagemagick/commitdiff
Allow NULL tags when throwing an exception
authorCristy <urban-warrior@imagemagick.org>
Wed, 26 Aug 2015 15:23:17 +0000 (11:23 -0400)
committerCristy <urban-warrior@imagemagick.org>
Wed, 26 Aug 2015 15:23:17 +0000 (11:23 -0400)
MagickCore/exception-private.h

index ba4437fbf6c67ccd60076c8e0c9a77c422ba1d4e..c81bdbf983f9227b595906af577a60f06ff6cdef 100644 (file)
@@ -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; \