diff options
| author | Gerd Moellmann | 2000-01-04 21:22:24 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-01-04 21:22:24 +0000 |
| commit | f036834aebdaefe79c7fb916a84eda2743a02135 (patch) | |
| tree | 9d1bdabac9b819ef9248ceec52d70cf60bf9fea9 | |
| parent | f45dd0f41199ef2998ab611df82c709f71a06002 (diff) | |
| download | emacs-f036834aebdaefe79c7fb916a84eda2743a02135.tar.gz emacs-f036834aebdaefe79c7fb916a84eda2743a02135.zip | |
(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.
| -rw-r--r-- | src/xfns.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/xfns.c b/src/xfns.c index 12503851005..c10e08e1eb8 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -9155,7 +9155,6 @@ static struct image_type gif_type = | |||
| 9155 | NULL | 9155 | NULL |
| 9156 | }; | 9156 | }; |
| 9157 | 9157 | ||
| 9158 | |||
| 9159 | /* Return non-zero if OBJECT is a valid GIF image specification. */ | 9158 | /* Return non-zero if OBJECT is a valid GIF image specification. */ |
| 9160 | 9159 | ||
| 9161 | static int | 9160 | static int |
| @@ -9185,13 +9184,18 @@ typedef struct | |||
| 9185 | } | 9184 | } |
| 9186 | gif_memory_source; | 9185 | gif_memory_source; |
| 9187 | 9186 | ||
| 9187 | /* Make the current memory source available to gif_read_from_memory. | ||
| 9188 | It's done this way because not all versions of libungif support | ||
| 9189 | a UserData field in the GifFileType structure. */ | ||
| 9190 | static gif_memory_source *current_gif_memory_src; | ||
| 9191 | |||
| 9188 | static int | 9192 | static int |
| 9189 | gif_read_from_memory (file, buf, len) | 9193 | gif_read_from_memory (file, buf, len) |
| 9190 | GifFileType *file; | 9194 | GifFileType *file; |
| 9191 | GifByteType *buf; | 9195 | GifByteType *buf; |
| 9192 | int len; | 9196 | int len; |
| 9193 | { | 9197 | { |
| 9194 | gif_memory_source *src = (gif_memory_source *) file->UserData; | 9198 | gif_memory_source *src = current_gif_memory_src; |
| 9195 | 9199 | ||
| 9196 | if (len > src->len - src->index) | 9200 | if (len > src->len - src->index) |
| 9197 | return -1; | 9201 | return -1; |
| @@ -9250,6 +9254,7 @@ gif_load (f, img) | |||
| 9250 | else | 9254 | else |
| 9251 | { | 9255 | { |
| 9252 | /* Read from memory! */ | 9256 | /* Read from memory! */ |
| 9257 | current_gif_memory_src = &memsrc; | ||
| 9253 | memsrc.bytes = XSTRING (specified_data)->data; | 9258 | memsrc.bytes = XSTRING (specified_data)->data; |
| 9254 | memsrc.len = STRING_BYTES (XSTRING (specified_data)); | 9259 | memsrc.len = STRING_BYTES (XSTRING (specified_data)); |
| 9255 | memsrc.index = 0; | 9260 | memsrc.index = 0; |