emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 1321071: Don't abort when using GDI+ for images


From: Eli Zaretskii
Subject: master 1321071: Don't abort when using GDI+ for images
Date: Sat, 18 Apr 2020 05:59:06 -0400 (EDT)

branch: master
commit 13210712a06a53031cfb82ec5dc0ab5f8e720668
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Don't abort when using GDI+ for images
    
    * src/w32image.c (decode_delay): Instead of aborting when the
    type of delay value is unrecognized, return an invalid negative
    value.
---
 src/w32image.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/w32image.c b/src/w32image.c
index 95d8ddf..31c9b85 100644
--- a/src/w32image.c
+++ b/src/w32image.c
@@ -214,30 +214,37 @@ enum PropertyItem_type {
   PI_LONG_PAIR = 10
 };
 
-static unsigned long
+static double
 decode_delay (PropertyItem *propertyItem, int frame)
 {
   enum PropertyItem_type type = propertyItem[0].type;
-  unsigned long delay;
+  unsigned long udelay;
+  double retval;
 
   switch (type)
     {
     case PI_BYTE:
     case PI_BYTE_ANY:
-      delay = ((unsigned char *)propertyItem[0].value)[frame];
+      udelay = ((unsigned char *)propertyItem[0].value)[frame];
+      retval = udelay;
       break;
     case PI_USHORT:
-      delay = ((unsigned short *)propertyItem[0].value)[frame];
+      udelay = ((unsigned short *)propertyItem[0].value)[frame];
+      retval = udelay;
       break;
     case PI_ULONG:
     case PI_LONG:      /* delay should always be positive */
-      delay = ((unsigned long *)propertyItem[0].value)[frame];
+      udelay = ((unsigned long *)propertyItem[0].value)[frame];
+      retval = udelay;
       break;
     default:
-      emacs_abort ();
+      /* This negative value will cause the caller to disregard the
+        delay if we cannot determine it reliably.  */
+      add_to_log ("Invalid or unknown propertyItem type in w32image.c");
+      retval = -1.0;
     }
 
-  return delay;
+  return retval;
 }
 
 static double



reply via email to

[Prev in Thread] Current Thread [Next in Thread]