[Swfed-svn] swfed-svn [143] bitstream_incrpos の bit_incr に負の値を指定できるように改造

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 6月 5日 (金) 17:08:28 JST


Revision: 143
          http://svn.sourceforge.jp/view?root=swfed&view=rev&rev=143
Author:   yoya
Date:     2009-06-05 17:08:28 +0900 (Fri, 05 Jun 2009)

Log Message:
-----------
bitstream_incrpos の bit_incr に負の値を指定できるように改造

Modified Paths:
--------------
    trunk/src/bitstream.c
    trunk/src/bitstream.h


-------------- next part --------------
Modified: trunk/src/bitstream.c
===================================================================
--- trunk/src/bitstream.c	2009-06-04 17:04:14 UTC (rev 142)
+++ trunk/src/bitstream.c	2009-06-05 08:08:28 UTC (rev 143)
@@ -318,9 +318,13 @@
 
 int
 bitstream_incrpos(bitstream_t *bs, signed long byte_incr,
-                             unsigned long bit_incr) {
+                  signed long bit_incr) {
     bs->byte_offset += byte_incr;
     bs->bit_offset += bit_incr;
+    while (bs->bit_offset < 0) {
+        bs->bit_offset += 8;
+        bs->byte_offset --;
+    }
     while (bs->bit_offset >= 8) {
         bs->bit_offset -= 8;
         bs->byte_offset ++;

Modified: trunk/src/bitstream.h
===================================================================
--- trunk/src/bitstream.h	2009-06-04 17:04:14 UTC (rev 142)
+++ trunk/src/bitstream.h	2009-06-05 08:08:28 UTC (rev 143)
@@ -50,7 +50,7 @@
 
 /* seeking */
 extern int bitstream_incrpos(bitstream_t *bs, signed long byte_incr,
-                             unsigned long bit_incr);
+                             signed long bit_incr);
 extern int bitstream_setpos(bitstream_t *bs, unsigned long byte_offset,
 			    unsigned long bit_offset);
 extern unsigned long bitstream_getbytepos(bitstream_t *bs);



Swfed-svn メーリングリストの案内
Back to archive index