GraphicsMagick: coders/tga.c: Emit warning to logs when requeste...

GraphicsMagick Commits <[email protected]> Sun, 25 Feb 2024 02:35:46 -0600
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.9400.1708850163.1736.graphicsmagick-commit@lists.sourceforge.net>
changeset b3bedefac39e in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=b3bedefac39e
summary: coders/tga.c: Emit warning to logs when requested orientation is not supported.

diffstat:

 ChangeLog    |   3 +++
 coders/tga.c |  13 ++++++++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diffs (54 lines):

diff -r ac549d853255 -r b3bedefac39e ChangeLog
--- a/ChangeLog	Sat Feb 24 18:54:00 2024 -0600
+++ b/ChangeLog	Sun Feb 25 09:35:22 2024 +0100
@@ -3,6 +3,9 @@
 	* coders/tiff.c: Do not copy TIFFTAG_ORIENTATION from EXIF.
 	It is already handled by image->orientation variable.
 
+	* coders/tga.c: Emit warning to logs when orientation is 
+	not supported.
+
 2024-02-24  Bob Friesenhahn  <[email protected]>
 
 	* coders/tga.c (WriteTGAImage): Eliminate compiler warnings.
diff -r ac549d853255 -r b3bedefac39e coders/tga.c
--- a/coders/tga.c	Sat Feb 24 18:54:00 2024 -0600
+++ b/coders/tga.c	Sun Feb 25 09:35:22 2024 +0100
@@ -376,6 +376,7 @@
   assert(image_info->signature == MagickSignature);
   assert(exception != (ExceptionInfo *) NULL);
   assert(exception->signature == MagickSignature);
+  LogMagickEvent(CoderEvent,GetMagickModule(),"enter");
   image = AllocateImage(image_info);
   status = OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
   if (status == MagickFalse)
@@ -1075,6 +1076,12 @@
   assert(image != (Image *) NULL);
   assert(image->signature == MagickSignature);
   image_list_length=GetImageListLength(image);
+  LogMagickEvent(CoderEvent,GetMagickModule(),"enter");
+  if(image->logging)
+    (void)LogMagickEvent(CoderEvent,GetMagickModule(),
+                          "%" MAGICK_SIZE_T_F "u image frames in list",
+                          (MAGICK_SIZE_T) image_list_length);
+
   status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
   if (status == MagickFalse)
     ThrowWriterException(FileOpenError,UnableToOpenFile,image);
@@ -1196,11 +1203,15 @@
 
       switch(image->orientation)
       {
+        case UndefinedOrientation:
         case BottomLeftOrientation:  break;				/* 01 Bottom left */
         case BottomRightOrientation: tga_info.attributes|=0x10; break;	/* 01 Bottom right */
         case TopLeftOrientation:     tga_info.attributes|=0x20; break;	/* 10 Top left */
         case TopRightOrientation:    tga_info.attributes|=0x30; break;	/* 11 TopRight */
-        default: break;
+        default: if(image->logging)
+                     (void)LogMagickEvent(CoderEvent,GetMagickModule(),
+                                "Warning: Orientation %d is not supported, use -auto-orient switch.\n", (int)image->orientation);
+                 break;
       }
 
       if (image->logging)