Commit f036834a authored by Gerd Moellmann's avatar Gerd Moellmann
Browse files

(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.
parent f45dd0f4
...@@ -9155,7 +9155,6 @@ static struct image_type gif_type = ...@@ -9155,7 +9155,6 @@ static struct image_type gif_type =
NULL NULL
}; };
/* Return non-zero if OBJECT is a valid GIF image specification. */ /* Return non-zero if OBJECT is a valid GIF image specification. */
static int static int
...@@ -9185,13 +9184,18 @@ typedef struct ...@@ -9185,13 +9184,18 @@ typedef struct
} }
gif_memory_source; 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 static int
gif_read_from_memory (file, buf, len) gif_read_from_memory (file, buf, len)
GifFileType *file; GifFileType *file;
GifByteType *buf; GifByteType *buf;
int len; 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) if (len > src->len - src->index)
return -1; return -1;
...@@ -9250,6 +9254,7 @@ gif_load (f, img) ...@@ -9250,6 +9254,7 @@ gif_load (f, img)
else else
{ {
/* Read from memory! */ /* Read from memory! */
current_gif_memory_src = &memsrc;
memsrc.bytes = XSTRING (specified_data)->data; memsrc.bytes = XSTRING (specified_data)->data;
memsrc.len = STRING_BYTES (XSTRING (specified_data)); memsrc.len = STRING_BYTES (XSTRING (specified_data));
memsrc.index = 0; memsrc.index = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment