svnno****@sourc*****
svnno****@sourc*****
2008年 10月 1日 (水) 19:05:18 JST
Revision: 51 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=swfed&view=rev&rev=51 Author: yoya Date: 2008-10-01 19:05:17 +0900 (Wed, 01 Oct 2008) Log Message: ----------- bitstream_getbits で取得できる bit が無い時を考慮していなかったので修正。 Modified Paths: -------------- src/bitstream.c -------------- next part -------------- Modified: src/bitstream.c =================================================================== --- src/bitstream.c 2008-10-01 10:03:36 UTC (rev 50) +++ src/bitstream.c 2008-10-01 10:05:17 UTC (rev 51) @@ -288,12 +288,17 @@ } return 0; } + unsigned long bitstream_getbits(bitstream_t *bs, int bit_width) { int i; - unsigned long bit, bits = 0; + int bit; + unsigned long bits = 0; for (i=0; i < bit_width; i++) { bit = bitstream_getbit(bs); + if (bit == -1) { + return -1; + } bits |= bit << (bit_width - 1 - i); } return bits;