From 0cb55489715ea5b22ac59da4520fd84787c2c44e Mon Sep 17 00:00:00 2001 From: yoya Date: Sat, 9 Oct 2010 17:01:02 +0000 Subject: [PATCH] =?utf8?q?swf=5Fobject=5Finput=20=E3=81=A7=20tag=20?= =?utf8?q?=E3=82=92=E7=94=9F=E6=88=90=E3=81=99=E3=82=8B=E5=87=A6=E7=90=86?= =?utf8?q?=E3=82=92=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/swfed/trunk@234 7c90b180-03d5-4157-b861-58a559ae9d1e --- src/swf_object.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/swf_object.c b/src/swf_object.c index c841095..c9a817a 100644 --- a/src/swf_object.c +++ b/src/swf_object.c @@ -42,8 +42,9 @@ int swf_object_input(swf_object_t *swf, unsigned char *data, unsigned long data_len) { int result; - bitstream_t *bs = bitstream_open(); - swf_tag_t **tag; + bitstream_t *bs; + swf_tag_t *tag, *prev_tag, *head_tag; + bs = bitstream_open(); bitstream_input(bs, data, data_len); result = swf_header_parse(bs, &swf->header); if (result) { @@ -85,19 +86,28 @@ swf_object_input(swf_object_t *swf, unsigned char *data, bitstream_close(bs); return result; } - tag = &swf->tag; + head_tag = prev_tag = NULL; while(1) { long pos; pos = bitstream_getbytepos(bs); if ((pos == -1) || ((long) swf->header.file_length <= pos)) { break; } - *tag = swf_tag_create(bs); + tag = swf_tag_create(bs); if (tag == NULL) { fprintf(stderr, "swf_object_input: swf_tag_create failed\n"); + bitstream_close(bs); + return 1; + } + if (head_tag == NULL) { + head_tag = tag; + } else { + prev_tag->next = tag; + tag->next = NULL; } - tag = &((*tag)->next); + prev_tag = tag; } + swf->tag = head_tag; bitstream_close(bs); return 0; } -- 2.11.0