changeset 27153:31b7a2a8ea20

(current_gif_memory_src): New variable. (gif_load): Record the address of the current memory source in current_gif_memory_src. (gif_read_from_memory): Use current_gif_memory_src.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 04 Jan 2000 21:22:24 +0000
parents 56ea89168dba
children b32c5e16dbe9
files src/xfns.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/xfns.c	Tue Jan 04 18:45:48 2000 +0000
+++ b/src/xfns.c	Tue Jan 04 21:22:24 2000 +0000
@@ -9155,7 +9155,6 @@
   NULL
 };
 
-
 /* Return non-zero if OBJECT is a valid GIF image specification.  */
 
 static int
@@ -9185,13 +9184,18 @@
 }
 gif_memory_source;
 
+/* Make the current memory source available to gif_read_from_memory.
+   It's done this way because not all versions of libungif support
+   a UserData field in the GifFileType structure.  */
+static gif_memory_source *current_gif_memory_src;
+
 static int
 gif_read_from_memory (file, buf, len)
      GifFileType *file;
      GifByteType *buf;
      int len;
 {
-  gif_memory_source *src = (gif_memory_source *) file->UserData;
+  gif_memory_source *src = current_gif_memory_src;
 
   if (len > src->len - src->index)
     return -1;
@@ -9250,6 +9254,7 @@
   else
     {
       /* Read from memory! */
+      current_gif_memory_src = &memsrc;
       memsrc.bytes = XSTRING (specified_data)->data;
       memsrc.len = STRING_BYTES (XSTRING (specified_data));
       memsrc.index = 0;