[Swfed-svn] swfed-svn [177] - first_6bits を union から外した

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 8月 28日 (金) 01:44:01 JST


Revision: 177
          http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=177
Author:   yoya
Date:     2009-08-28 01:44:01 +0900 (Fri, 28 Aug 2009)

Log Message:
-----------
- first_6bits を union から外した
- current を current_record に改名
- for 中の first_6bits のポインタが head を指していた。current に修正

Modified Paths:
--------------
    trunk/src/swf_shape_record.c


-------------- next part --------------
Modified: trunk/src/swf_shape_record.c
===================================================================
--- trunk/src/swf_shape_record.c	2009-08-27 16:25:51 UTC (rev 176)
+++ trunk/src/swf_shape_record.c	2009-08-27 16:44:01 UTC (rev 177)
@@ -6,37 +6,36 @@
 swf_shape_record_parse(bitstream_t *bs, swf_shape_record_t *shape_record,
                        swf_tag_t *tag, swf_styles_count_t *count) {
     int first_bit, next_5bits;
-    swf_shape_record_t *current = shape_record;
+    swf_shape_record_t *current_record = shape_record;
     int limit;
-    for (limit = 1; current ; limit ++) {
-        current->next = NULL; // fail safe
-        bitstream_align(bs); // XXX
+//    bitstream_align(bs); // XXX
+    for (limit = 1; current_record ; limit ++) {
+        current_record->next = NULL; // stopper
         int result = bitstream_getbits(bs, 6);
         if (result == -1) {
             fprintf(stderr, "swf_shape_record_parse: bitstream_getbits failed at L%d\n", __LINE__);
             return 1;
         }
-        shape_record->shape.first_6bits = result;
-        first_bit = (shape_record->shape.first_6bits >> 5) & 1;
-        next_5bits = shape_record->shape.first_6bits & 0x1f;
+        current_record->first_6bits = result;
+        first_bit = (current_record->first_6bits >> 5) & 1;
+        next_5bits = current_record->first_6bits & 0x1f;
         bitstream_incrpos(bs, 0, -6); // 6 bit back
         if ((first_bit == 0) && (next_5bits == 0)) {
-            swf_shape_record_end_parse(bs, &(current->shape.shape_end));
-            current->next = NULL;
+            swf_shape_record_end_parse(bs, &(current_record->shape.shape_end));
             break;
         } if (first_bit == 0) {
-            swf_shape_record_setup_parse(bs, &(current->shape.shape_setup),
+            swf_shape_record_setup_parse(bs, &(current_record->shape.shape_setup),
                                          tag, count);
-        } else {
-            swf_shape_record_edge_parse(bs, &(current->shape.shape_edge));
+} else {
+            swf_shape_record_edge_parse(bs, &(current_record->shape.shape_edge));
         }
         if (10000 <= limit) { // XXX 10000???
-            current->next = NULL;
+            current_record->next = NULL;
             fprintf(stderr, "swf_shape_record_parse: limit(%d) over\n", limit);
             return 1;
         }
-        current->next = calloc(1, sizeof(swf_shape_record_t));
-        current = current->next;
+        current_record->next = calloc(1, sizeof(swf_shape_record_t));
+        current_record = current_record->next;
     }
     return 0;
 }
@@ -45,21 +44,21 @@
 swf_shape_record_build(bitstream_t *bs, swf_shape_record_t *shape_record,
                        swf_tag_t *tag, swf_styles_count_t *count) {
     int first_bit, next_5bits;
-    swf_shape_record_t *current = shape_record;
-    while (current) {
-        bitstream_align(bs); // XXX
-        first_bit = (shape_record->shape.first_6bits >> 5) & 1;
-        next_5bits = shape_record->shape.first_6bits & 0x1f;
+    swf_shape_record_t *current_record = shape_record;
+    while (current_record) {
+//        bitstream_align(bs); // XXX
+        first_bit = (shape_record->first_6bits >> 5) & 1;
+        next_5bits = shape_record->first_6bits & 0x1f;
         if ((first_bit == 0) && (next_5bits == 0)) {
-            swf_shape_record_end_build(bs, &(current->shape.shape_end));
+            swf_shape_record_end_build(bs, &(current_record->shape.shape_end));
             break;
         } if (first_bit == 0) {
-            swf_shape_record_setup_build(bs, &(current->shape.shape_setup),
+            swf_shape_record_setup_build(bs, &(current_record->shape.shape_setup),
                                          tag, count);
         } else {
-            swf_shape_record_edge_build(bs, &(current->shape.shape_edge));
+            swf_shape_record_edge_build(bs, &(current_record->shape.shape_edge));
         }
-        current = current->next;
+        current_record = current_record->next;
     }
     return 0;
 }
@@ -68,25 +67,25 @@
 swf_shape_record_print(swf_shape_record_t *shape_record, int indent_depth,
                        swf_tag_t *tag, swf_styles_count_t *count) {
     int first_bit, next_5bits;
-    swf_shape_record_t *current = shape_record;
+    swf_shape_record_t *current_record = shape_record;
     int i;
-    for (i = 0 ; current ; i++) {
-        first_bit = (shape_record->shape.first_6bits >> 5) & 1;
-        next_5bits = shape_record->shape.first_6bits & 0x1f;
+    for (i = 0 ; current_record ; i++) {
+        first_bit = (current_record->first_6bits >> 5) & 1;
+        next_5bits = current_record->first_6bits & 0x1f;
         print_indent(indent_depth);
         printf("shape_record [%d]\n", i);
         if ((first_bit == 0) && (next_5bits == 0)) {
-            swf_shape_record_end_print(&(current->shape.shape_end),
+            swf_shape_record_end_print(&(current_record->shape.shape_end),
                                        indent_depth);
             break;
         } if (first_bit == 0) {
-            swf_shape_record_setup_print(&(current->shape.shape_setup),
+            swf_shape_record_setup_print(&(current_record->shape.shape_setup),
                                          indent_depth, tag, count);
         } else {
-            swf_shape_record_edge_print(&(current->shape.shape_edge),
+            swf_shape_record_edge_print(&(current_record->shape.shape_edge),
                                         indent_depth);
         }
-        current = current->next;
+        current_record = current_record->next;
     }
     return 0;
 }



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