GraphicsMagick: 3 new changesets

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.1996.1678648889.1409.graphicsmagick-commit@lists.sourceforge.net>
changeset df10dccc431b in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=df10dccc431b
summary: magick/error.h: Add parameter names to prototypes.

changeset fb59543bd796 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=fb59543bd796
summary: DefaultFatalErrorHandler(): Perform printf substitutions similar to DefaultErrorHandler

changeset ff543ff189de in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=ff543ff189de
summary: ConjureImageCommand(): Properly check argument list when handling options

diffstat:

 ChangeLog          |   9 +++++++++
 magick/command.c   |   8 +++++---
 magick/error.c     |  35 +++++++++++++++++++++++++++++------
 magick/error.h     |  53 +++++++++++++++++++++++++++--------------------------
 www/Changelog.html |   6 ++++++
 5 files changed, 76 insertions(+), 35 deletions(-)

diffs (221 lines):

diff -r 9938c1222ed7 -r ff543ff189de ChangeLog
--- a/ChangeLog	Sun Mar 12 09:59:46 2023 -0500
+++ b/ChangeLog	Sun Mar 12 14:21:17 2023 -0500
@@ -1,5 +1,14 @@
 2023-03-12  Bob Friesenhahn  <[email protected]>
 
+	* magick/command.c (ConjureImageCommand): Properly check argument
+	list when handling options.  Addresses SourceForge issue #693
+	"Segmentation Violation in gm - SetImageAttribute function".
+
+	* magick/error.c (DefaultFatalErrorHandler): Perform printf
+	substitutions similar to DefaultErrorHandler.
+
+	* magick/error.h: Add parameter names to prototypes.
+
 	* magick/command.c (CompositeImageCommand): Properly deal with
 	-noop when the user has not provided any images.  Addresses
 	SourceForge issue #691 "Segmentation Violation in gm
diff -r 9938c1222ed7 -r ff543ff189de magick/command.c
--- a/magick/command.c	Sun Mar 12 09:59:46 2023 -0500
+++ b/magick/command.c	Sun Mar 12 14:21:17 2023 -0500
@@ -6496,7 +6496,7 @@
   (void) puts("  -verbose             print detailed information about the image");
   (void) puts("  -version             print version information");
   (void) puts("");
-  (void) puts("In additiion, define any key value pairs required by your script.  For");
+  (void) puts("In addition, define any key value pairs required by your script.  For");
   (void) puts("example,");
   (void) puts("");
   (void) puts("    conjure -size 100x100 -color blue -foo bar script.msl");
@@ -6597,10 +6597,12 @@
           Persist key/value pair.
         */
         (void) SetImageAttribute(image_info->attributes,option+1,(char *) NULL);
-        status&=SetImageAttribute(image_info->attributes,option+1,argv[i+1]);
+        i++;
+        if (i == argc)
+          MagickFatalError(OptionFatalError,MissingArgument,option);
+        status&=SetImageAttribute(image_info->attributes,option+1,argv[i]);
         if (status == MagickFail)
           MagickFatalError(ImageFatalError,UnableToPersistKey,option);
-        i++;
         continue;
       }
     /*
diff -r 9938c1222ed7 -r ff543ff189de magick/error.c
--- a/magick/error.c	Sun Mar 12 09:59:46 2023 -0500
+++ b/magick/error.c	Sun Mar 12 14:21:17 2023 -0500
@@ -1,5 +1,5 @@
 /*
-% Copyright (C) 2003-2022 GraphicsMagick Group
+% Copyright (C) 2003-2023 GraphicsMagick Group
 % Copyright (C) 2002 ImageMagick Studio
 % Copyright 1991-1999 E. I. du Pont de Nemours and Company
 %
@@ -307,8 +307,12 @@
     FIXME: The following captures a random errno value rather than the
     errno associated with the actual error.
   */
+#if 0
   if ((severity != OptionError) && errno)
     (void) fprintf(stderr," [%.1024s]",GetErrorMessageString(errno));
+#else
+  (void) severity;
+#endif
   (void) fprintf(stderr,".\n");
 }
 
@@ -347,11 +351,31 @@
 {
   if (reason != (char *) NULL)
     {
-      (void) fprintf(stderr,"%.1024s: %.1024s",GetClientName(),reason);
-      if (description != (char *) NULL)
-        (void) fprintf(stderr," (%.1024s)",description);
+      (void) fprintf(stderr,"%.1024s: ",GetClientName());
+      if (strstr(reason,"%s") && description)
+        {
+          /*
+            Reason contains printf specification. %s in reason string
+            is substituted with description.
+          */
+          (void) fprintf(stderr,reason,description);
+        }
+      else
+        {
+          (void) fprintf(stderr,"%.1024s",reason);
+          if (description != (char *) NULL)
+            (void) fprintf(stderr," (%.1024s)",description);
+        }
+      /*
+        FIXME: The following captures a random errno value rather than the
+        errno associated with the actual error.
+      */
+#if 0
       if ((severity != OptionError) && errno)
         (void) fprintf(stderr," [%.1024s]",GetErrorMessageString(errno));
+#else
+  (void) severity;
+#endif
       (void) fprintf(stderr,".\n");
     }
   /*
@@ -386,8 +410,7 @@
 %
 %    o warning: Specifies the numeric warning category.
 %
-%    o reason: Specifies the reason to display before terminating the
-%      program.
+%    o reason: Specifies the reason to display.
 %
 %    o description: Specifies any description to the reason.
 %
diff -r 9938c1222ed7 -r ff543ff189de magick/error.h
--- a/magick/error.h	Sun Mar 12 09:59:46 2023 -0500
+++ b/magick/error.h	Sun Mar 12 14:21:17 2023 -0500
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2003-2020 GraphicsMagick Group
+  Copyright (C) 2003-2023 GraphicsMagick Group
   Copyright (C) 2002 ImageMagick Studio
   Copyright 1991-1999 E. I. du Pont de Nemours and Company
 
@@ -186,8 +186,9 @@
 */
 
 /*
-  ExceptionInfo is used to report exceptions to higher level routines,
-  and to the user.
+  The ExceptionInfo structure is used to report exceptions to higher level
+  routines, and to the user.  The ExceptionInfo structure must be initialized
+  using the GetExceptionInfo() function prior to use.
 */
 typedef struct _ExceptionInfo
 {
@@ -229,46 +230,46 @@
   Exception typedef declarations.
 */
 typedef void
-  (*ErrorHandler)(const ExceptionType,const char *,const char *);
+  (*ErrorHandler)(const ExceptionType severity,const char *reason,const char *description);
 
 typedef void
-  (*FatalErrorHandler)(const ExceptionType,const char *,const char *) MAGICK_FUNC_NORETURN;
+  (*FatalErrorHandler)(const ExceptionType severity,const char *reason,const char *description) MAGICK_FUNC_NORETURN;
 
 typedef void
-  (*WarningHandler)(const ExceptionType,const char *,const char *);
+  (*WarningHandler)(const ExceptionType severity,const char *reason,const char *description);
 
 /*
   Exception declarations.
 */
 extern MagickExport const char
-  *GetLocaleExceptionMessage(const ExceptionType,const char *),
-  *GetLocaleMessage(const char *);
+  *GetLocaleExceptionMessage(const ExceptionType severity,const char *tag),
+  *GetLocaleMessage(const char *tag);
 
 extern MagickExport ErrorHandler
-  SetErrorHandler(ErrorHandler);
+  SetErrorHandler(ErrorHandler handler);
 
 extern MagickExport FatalErrorHandler
-  SetFatalErrorHandler(FatalErrorHandler);
+  SetFatalErrorHandler(FatalErrorHandler handler);
 
 extern MagickExport void
-  CatchException(const ExceptionInfo *),
-  CopyException(ExceptionInfo *copy, const ExceptionInfo *original),
-  DestroyExceptionInfo(ExceptionInfo *),
-  GetExceptionInfo(ExceptionInfo *),
-  MagickError(const ExceptionType,const char *,const char *),
-  MagickFatalError(const ExceptionType,const char *,const char *) MAGICK_FUNC_NORETURN,
-  MagickWarning(const ExceptionType,const char *,const char *),
-  _MagickError(const ExceptionType,const char *,const char *),
-  _MagickFatalError(const ExceptionType,const char *,const char *) MAGICK_FUNC_NORETURN,
-  _MagickWarning(const ExceptionType,const char *,const char *),
-  SetExceptionInfo(ExceptionInfo *,ExceptionType),
-  ThrowException(ExceptionInfo *,const ExceptionType,const char *,const char *),
-  ThrowLoggedException(ExceptionInfo *exception, const ExceptionType severity,
-    const char *reason,const char *description,const char *module,
-    const char *function,const unsigned long line);
+  CatchException(const ExceptionInfo *exception),
+  CopyException(ExceptionInfo *copy,const ExceptionInfo *original),
+  DestroyExceptionInfo(ExceptionInfo *exception),
+  GetExceptionInfo(ExceptionInfo *exception),
+  MagickError(const ExceptionType error,const char *reason,const char *description),
+  MagickFatalError(const ExceptionType error,const char *reason,const char *description) MAGICK_FUNC_NORETURN,
+  MagickWarning(const ExceptionType severity,const char *reason,const char *description),
+  _MagickError(const ExceptionType severity,const char *reason, const char *description),
+  _MagickFatalError(const ExceptionType severity,const char *reason,const char *description) MAGICK_FUNC_NORETURN,
+  _MagickWarning(const ExceptionType warning,const char *reason,const char *description),
+  SetExceptionInfo(ExceptionInfo *exception,ExceptionType severity),
+  ThrowException(ExceptionInfo *exception,const ExceptionType severity,const char *reason,const char *description),
+  ThrowLoggedException(ExceptionInfo *exception,const ExceptionType severity,const char *reason,
+                       const char *description,const char *module,const char *function,
+                       const unsigned long line);
 
 extern MagickExport WarningHandler
-  SetWarningHandler(WarningHandler);
+  SetWarningHandler(WarningHandler handler);
 
 /*
   Exception define definitions.
diff -r 9938c1222ed7 -r ff543ff189de www/Changelog.html
--- a/www/Changelog.html	Sun Mar 12 09:59:46 2023 -0500
+++ b/www/Changelog.html	Sun Mar 12 14:21:17 2023 -0500
@@ -40,6 +40,12 @@
 <p>2023-03-12  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
 <blockquote>
 <ul class="simple">
+<li><p>magick/command.c (ConjureImageCommand): Properly check argument
+list when handling options.  Addresses SourceForge issue #693
+&quot;Segmentation Violation in gm - SetImageAttribute function&quot;.</p></li>
+<li><p>magick/error.c (DefaultFatalErrorHandler): Perform printf
+substitutions similar to DefaultErrorHandler.</p></li>
+<li><p>magick/error.h: Add parameter names to prototypes.</p></li>
 <li><p>magick/command.c (CompositeImageCommand): Properly deal with
 -noop when the user has not provided any images.  Addresses
 SourceForge issue #691 &quot;Segmentation Violation in gm
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.