diff options
author | Sean Fox <dyntryx@gmail.com> | 2008-06-27 03:23:02 +0000 |
---|---|---|
committer | Sean Fox <dyntryx@gmail.com> | 2008-06-27 03:23:02 +0000 |
commit | f93d20f3f5dbb40e706a951d628140baeb4880db (patch) | |
tree | 04cbeeccfda21b56c74d05ba042a6c867bbf7c33 | |
parent | 5d7db2d67b65963955beb05d30184ac28d898ddb (diff) | |
download | libnsgif-f93d20f3f5dbb40e706a951d628140baeb4880db.tar.gz |
Type correction; clear gif_animation's memory in gif_create()
svn path=/branches/dynis/libnsgif/; revision=4460
-rw-r--r-- | examples/decode_gif.c | 4 | ||||
-rw-r--r-- | libnsgif.c | 13 |
2 files changed, 6 insertions, 11 deletions
diff --git a/examples/decode_gif.c b/examples/decode_gif.c index 5e136c7..fc508fd 100644 --- a/examples/decode_gif.c +++ b/examples/decode_gif.c @@ -83,14 +83,14 @@ int main(int argc, char *argv[]) /* decode the frames */ for (i = 0; i != gif.frame_count; i++) { unsigned int row, col; - char *image; + unsigned char *image; code = gif_decode_frame(&gif, i); if (code != GIF_OK) warning("gif_decode_frame", code); printf("# frame %u:\n", i); - image = (char *) gif.frame_image; + image = (unsigned char *) gif.frame_image; for (row = 0; row != gif.height; row++) { for (col = 0; col != gif.width; col++) { size_t z = (row * gif.width + col) * 4; @@ -149,21 +149,17 @@ static bool get_done; */ static bool clear_image = false; + + /** Initialises necessary gif_animation members. */ void gif_create(gif_animation *gif, gif_bitmap_callback_vt *bitmap_callbacks) { + memset(gif, 0, sizeof(gif_animation)); gif->bitmap_callbacks = *bitmap_callbacks; - gif->gif_data = NULL; - gif->frame_image = NULL; - gif->frames = NULL; - gif->local_colour_table = NULL; - gif->global_colour_table = NULL; - gif->buffer_position = 0; - gif->frame_count = 0; - gif->frame_count_partial = 0; gif->decoded_frame = GIF_INVALID_FRAME; } + /** Initialises any workspace held by the animation and attempts to decode any information that hasn't already been decoded. If an error occurs, all previously decoded frames are retained. @@ -363,7 +359,6 @@ gif_result gif_initialise(gif_animation *gif, size_t size, unsigned char *data) } - /** Updates the sprite memory size @return GIF_INSUFFICIENT_MEMORY for a memory error |