aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2020-04-18 12:57:08 +0300
committerEli Zaretskii2020-04-18 12:57:08 +0300
commit13210712a06a53031cfb82ec5dc0ab5f8e720668 (patch)
tree5ef1e5c4253e8df8e0f1156620209863d8b50191 /src
parenta0c8c274d354f3901f076d163d3828ae55d13a2d (diff)
downloademacs-13210712a06a53031cfb82ec5dc0ab5f8e720668.tar.gz
emacs-13210712a06a53031cfb82ec5dc0ab5f8e720668.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/w32image.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/w32image.c b/src/w32image.c
index 95d8ddfe117..31c9b852ace 100644
--- a/src/w32image.c
+++ b/src/w32image.c
@@ -214,30 +214,37 @@ enum PropertyItem_type {
214 PI_LONG_PAIR = 10 214 PI_LONG_PAIR = 10
215}; 215};
216 216
217static unsigned long 217static double
218decode_delay (PropertyItem *propertyItem, int frame) 218decode_delay (PropertyItem *propertyItem, int frame)
219{ 219{
220 enum PropertyItem_type type = propertyItem[0].type; 220 enum PropertyItem_type type = propertyItem[0].type;
221 unsigned long delay; 221 unsigned long udelay;
222 double retval;
222 223
223 switch (type) 224 switch (type)
224 { 225 {
225 case PI_BYTE: 226 case PI_BYTE:
226 case PI_BYTE_ANY: 227 case PI_BYTE_ANY:
227 delay = ((unsigned char *)propertyItem[0].value)[frame]; 228 udelay = ((unsigned char *)propertyItem[0].value)[frame];
229 retval = udelay;
228 break; 230 break;
229 case PI_USHORT: 231 case PI_USHORT:
230 delay = ((unsigned short *)propertyItem[0].value)[frame]; 232 udelay = ((unsigned short *)propertyItem[0].value)[frame];
233 retval = udelay;
231 break; 234 break;
232 case PI_ULONG: 235 case PI_ULONG:
233 case PI_LONG: /* delay should always be positive */ 236 case PI_LONG: /* delay should always be positive */
234 delay = ((unsigned long *)propertyItem[0].value)[frame]; 237 udelay = ((unsigned long *)propertyItem[0].value)[frame];
238 retval = udelay;
235 break; 239 break;
236 default: 240 default:
237 emacs_abort (); 241 /* This negative value will cause the caller to disregard the
242 delay if we cannot determine it reliably. */
243 add_to_log ("Invalid or unknown propertyItem type in w32image.c");
244 retval = -1.0;
238 } 245 }
239 246
240 return delay; 247 return retval;
241} 248}
242 249
243static double 250static double