svnno****@sourc*****
svnno****@sourc*****
2011年 3月 4日 (金) 18:41:26 JST
Revision: 378 http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=378 Author: yoya Date: 2011-03-04 18:41:26 +0900 (Fri, 04 Mar 2011) Log Message: ----------- - bit入力中のエラー検知を入れた - build 処理を修正。(parse が混ざってた) Modified Paths: -------------- trunk/src/swf_cxform.c -------------- next part -------------- Modified: trunk/src/swf_cxform.c =================================================================== --- trunk/src/swf_cxform.c 2011-03-03 17:24:23 UTC (rev 377) +++ trunk/src/swf_cxform.c 2011-03-04 09:41:26 UTC (rev 378) @@ -13,12 +13,20 @@ if (cx->has_mult_terms) { cx->red_mult_term = bitstream_getbits(bs, nbits); cx->green_mult_term = bitstream_getbits(bs, nbits); - cx->blue_mult_term = bitstream_getbits(bs, nbits); + ret = bitstream_getbits(bs, nbits); + if (ret == -1) { + return 1; + } + cx->blue_mult_term = ret; } if (cx->has_add_terms) { cx->red_add_term = bitstream_getbits(bs, nbits); cx->green_add_term = bitstream_getbits(bs, nbits); - cx->blue_add_term = bitstream_getbits(bs, nbits); + ret = bitstream_getbits(bs, nbits); + if (ret == -1) { + return 1; + } + cx->blue_add_term = ret; } return 0; } @@ -29,17 +37,17 @@ bitstream_align(bs); bitstream_putbit(bs, cx->has_add_terms); bitstream_putbit(bs, cx->has_mult_terms); - nbits = cx->has_mult_terms; - cx->nbits = nbits; + nbits = cx->nbits; + bitstream_putbits(bs, nbits, 4); if (cx->has_mult_terms) { - cx->red_mult_term = bitstream_getbits(bs, nbits); - cx->green_mult_term = bitstream_getbits(bs, nbits); - cx->blue_mult_term = bitstream_getbits(bs, nbits); + bitstream_putbits(bs, cx->red_mult_term, nbits); + bitstream_putbits(bs, cx->green_mult_term, nbits); + bitstream_putbits(bs, cx->blue_mult_term, nbits); } if (cx->has_add_terms) { - cx->red_add_term = bitstream_getbits(bs, nbits); - cx->green_add_term = bitstream_getbits(bs, nbits); - cx->blue_add_term = bitstream_getbits(bs, nbits); + bitstream_putbits(bs, cx->red_add_term, nbits); + bitstream_putbits(bs, cx->green_add_term, nbits); + bitstream_putbits(bs, cx->blue_add_term, nbits); } return 0; }