OSDN Git Service

tag のメンバ名変更 tag => code
authoryoya <yoya@7c90b180-03d5-4157-b861-58a559ae9d1e>
Wed, 6 Apr 2011 07:15:45 +0000 (07:15 +0000)
committeryoya <yoya@7c90b180-03d5-4157-b861-58a559ae9d1e>
Wed, 6 Apr 2011 07:15:45 +0000 (07:15 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/swfed/trunk@525 7c90b180-03d5-4157-b861-58a559ae9d1e

20 files changed:
src/php_swfed.c
src/swf_fill_style_array.c
src/swf_fill_style_bitmap.c
src/swf_fill_style_gradient.c
src/swf_fill_style_solid.c
src/swf_gradient.c
src/swf_gradient_record.c
src/swf_line_style.c
src/swf_line_style_array.c
src/swf_object.c
src/swf_tag.c
src/swf_tag.h
src/swf_tag_action.c
src/swf_tag_jpeg.c
src/swf_tag_lossless.c
src/swf_tag_place.c
src/swf_tag_shape.c
src/swf_tag_sprite.c
src/tests/isbitmaptag001.phpt
src/tests/isshapetag001.phpt

index 902a7e3..b255524 100644 (file)
@@ -419,8 +419,8 @@ PHP_METHOD(swfed, getTagList) {
     for (tag=swf->tag_head ; tag ; tag=tag->next) {
         ALLOC_INIT_ZVAL(data);
         array_init(data);
-        add_assoc_long(data, "tag", tag->tag);
-        tag_info = get_swf_tag_info(tag->tag);
+        add_assoc_long(data, "code", tag->code);
+        tag_info = get_swf_tag_info(tag->code);
         if (tag_info && tag_info->name) {
             add_assoc_string_ex(data,
                                 "tagName", sizeof("tagName"),
@@ -456,14 +456,14 @@ PHP_METHOD(swfed, getTagDetail) {
     if (tag == NULL) {
         RETURN_FALSE;
     }
-    tag_info = get_swf_tag_info(tag->tag);
+    tag_info = get_swf_tag_info(tag->code);
     if ((tag_info == NULL) || (tag_info->detail_handler == NULL)) {
         RETURN_FALSE;
     }
     if (swf_tag_create_input_detail(tag, swf) == NULL) {
         RETURN_FALSE; // can't create detail
     }
-    switch (tag->tag) {
+    switch (tag->code) {
         swf_tag_jpeg_detail_t     *tag_jpeg;
         swf_tag_lossless_detail_t *tag_lossless;
         swf_tag_edit_detail_t     *tag_edit;
@@ -512,7 +512,7 @@ PHP_METHOD(swfed, getTagDetail) {
     case 59: // DoInitAction
         tag_action = tag->detail;
         array_init(return_value);
-        if (tag->tag == 59) { // DoInitAction
+        if (tag->code == 59) { // DoInitAction
             add_assoc_long(return_value, "action_sprite", tag_action->action_sprite);
         }
         if (tag_action->action_record && tag_action->action_record_len) {
@@ -567,7 +567,7 @@ PHP_METHOD(swfed, getTagDetail) {
       case 26: // PlaceObject2
         tag_place = tag->detail;
         array_init(return_value);
-        if ((tag->tag == 4) || tag_place->flag_has_character) {
+        if ((tag->code == 4) || tag_place->flag_has_character) {
             add_assoc_long(return_value, "character_id", tag_place->character_id);
         }
         add_assoc_long(return_value, "depth", tag_place->depth);
@@ -807,7 +807,7 @@ PHP_METHOD(swfed, getShapeIdListByBitmapRef) {
     array_init(return_value);
     i = 0;
     for (tag = swf->tag_head ; tag ; tag=tag->next) {
-        register int tag_code = tag->tag;
+        register int tag_code = tag->code;
         if (isShapeTag(tag_code)) {
            bitmap_id_list = swf_tag_shape_bitmap_get_refcid_list(tag, &bitmap_id_list_num);
            if (bitmap_id_list) {
index 14a75b4..71e6489 100644 (file)
@@ -20,7 +20,7 @@ swf_fill_style_array_parse(bitstream_t *bs,
         }
     }
     
-    if ((tag->tag != 2) && // ! DefineShape
+    if ((tag->code != 2) && // ! DefineShape
         (fill_style_array->count == 255)) {
         fill_style_array->count = bitstream_getbytesLE(bs, 2);
     }
@@ -42,9 +42,9 @@ swf_fill_style_array_build(bitstream_t *bs,
                            swf_tag_t *tag) {
     int i;
     int ret;
-    if ((tag->tag == 2) || // DefineShape
-        ((tag->tag > 2) && (fill_style_array->count < 255))) {
-        // tag->tag == 2 の時は count == 255 でもここに来るように
+    if ((tag->code == 2) || // DefineShape
+        ((tag->code > 2) && (fill_style_array->count < 255))) {
+        // tag->code == 2 の時は count == 255 でもここに来るように
         bitstream_putbyte(bs, fill_style_array->count);
     } else {
         bitstream_putbyte(bs, 255);
index 82e0752..61a1f2d 100644 (file)
@@ -8,7 +8,7 @@ swf_fill_style_bitmap_parse(bitstream_t *bs,
                             swf_tag_t *tag) {
     fill_style_bitmap->bitmap_ref = bitstream_getbytesLE(bs, 2);
     swf_matrix_parse(bs, &(fill_style_bitmap->bitmap_matrix));
-    if (tag->tag == 46 || tag->tag == 84) { // DefineMorphShape, DefineMorphShape2
+    if (tag->code == 46 || tag->code == 84) { // DefineMorphShape, DefineMorphShape2
         swf_matrix_parse(bs, &(fill_style_bitmap->bitmap_matrix_morph));
     }
     return 0;
@@ -20,7 +20,7 @@ swf_fill_style_bitmap_build(bitstream_t *bs,
                             swf_tag_t *tag) {
     bitstream_putbytesLE(bs, fill_style_bitmap->bitmap_ref, 2);
     swf_matrix_build(bs, &(fill_style_bitmap->bitmap_matrix));
-    if (tag->tag == 46 || tag->tag == 84) { // DefineMorphShape, DefineMorphShape2
+    if (tag->code == 46 || tag->code == 84) { // DefineMorphShape, DefineMorphShape2
         swf_matrix_build(bs, &(fill_style_bitmap->bitmap_matrix_morph));
     }
     return 0;
@@ -34,7 +34,7 @@ swf_fill_style_bitmap_print(swf_fill_style_bitmap_t *fill_style_bitmap,
     print_indent(indent_depth);
     printf("bitmap_ref=%u\n", fill_style_bitmap->bitmap_ref);
     swf_matrix_print(&(fill_style_bitmap->bitmap_matrix), indent_depth);
-    if (tag->tag == 46 || tag->tag == 84) { // DefineMorphShape, DefineMorphShape2
+    if (tag->code == 46 || tag->code == 84) { // DefineMorphShape, DefineMorphShape2
         swf_matrix_print(&(fill_style_bitmap->bitmap_matrix_morph), indent_depth);
     }
     return 0;
index 8ae78a8..b491bd9 100644 (file)
@@ -8,7 +8,7 @@ swf_fill_style_gradient_parse(bitstream_t *bs,
                               swf_tag_t* tag) {
     swf_matrix_parse(bs, &(fill_style_gradient->gradient_matrix));
     // DefineMorphShape, DefineMorphShape2
-    if (tag->tag == 46 || tag->tag == 84) {
+    if (tag->code == 46 || tag->code == 84) {
         swf_matrix_parse(bs, &(fill_style_gradient->gradient_matrix_morph));
     }
     swf_gradient_parse(bs, &(fill_style_gradient->gradient), tag, fill_style_gradient->type);
@@ -21,7 +21,7 @@ swf_fill_style_gradient_build(bitstream_t *bs,
                               swf_tag_t *tag) {
     swf_matrix_build(bs, &(fill_style_gradient->gradient_matrix));
     // DefineMorphShape, DefineMorphShape2
-    if (tag->tag == 46 || tag->tag == 84) {
+    if (tag->code == 46 || tag->code == 84) {
         swf_matrix_build(bs, &(fill_style_gradient->gradient_matrix_morph));
     }
     swf_gradient_build(bs, &(fill_style_gradient->gradient), tag, fill_style_gradient->type);
@@ -36,7 +36,7 @@ swf_fill_style_gradient_print(swf_fill_style_gradient_t *fill_style_gradient,
     swf_matrix_print(&(fill_style_gradient->gradient_matrix),
                      indent_depth + 1);
     // DefineMorphShape, DefineMorphShape2
-    if (tag->tag == 46 || tag->tag == 84) {
+    if (tag->code == 46 || tag->code == 84) {
         swf_matrix_print(&(fill_style_gradient->gradient_matrix_morph),
                          indent_depth + 1);
     }
index e720cf0..e44ee9d 100644 (file)
@@ -6,10 +6,10 @@ int
 swf_fill_style_solid_parse(bitstream_t *bs,
                            swf_fill_style_solid_t *fill_style_solid,
                            swf_tag_t *tag) {
-    if (tag->tag == 46 || tag->tag == 84) { // DefineMorphShape, DefineMorphShape2
+    if (tag->code == 46 || tag->code == 84) { // DefineMorphShape, DefineMorphShape2
         swf_rgba_parse(bs, &(fill_style_solid->rgba));
         swf_rgba_parse(bs, &(fill_style_solid->rgba_morph));
-    } else if (tag->tag == 32) { // DefineShape3
+    } else if (tag->code == 32) { // DefineShape3
         swf_rgba_parse(bs, &(fill_style_solid->rgba));
     } else {
         swf_rgb_parse(bs, &(fill_style_solid->rgb));
@@ -21,10 +21,10 @@ int
 swf_fill_style_solid_build(bitstream_t *bs,
                            swf_fill_style_solid_t *fill_style_solid,
                            swf_tag_t *tag) {
-    if (tag->tag == 46 || tag->tag == 84) { // DefineMorphShape, DefineMorphShape2
+    if (tag->code == 46 || tag->code == 84) { // DefineMorphShape, DefineMorphShape2
         swf_rgba_build(bs, &(fill_style_solid->rgba));
         swf_rgba_build(bs, &(fill_style_solid->rgba_morph));
-    } else if (tag->tag == 32) { // DefineShape3
+    } else if (tag->code == 32) { // DefineShape3
         swf_rgba_build(bs, &(fill_style_solid->rgba));
     } else {
         swf_rgb_build(bs, &(fill_style_solid->rgb));
@@ -38,7 +38,7 @@ swf_fill_style_solid_print(swf_fill_style_solid_t *fill_style_solid,
 ) {
     print_indent(indent_depth);
     printf("fill_style_solid");
-    if (tag->tag == 46 || tag->tag == 84) { // DefineMorphShape, DefineMorphShape2
+    if (tag->code == 46 || tag->code == 84) { // DefineMorphShape, DefineMorphShape2
         printf("  #%02x%02x%02x(%02x)  morph:#%02x%02x%02x(%02x)",
                fill_style_solid->rgba.red,
                fill_style_solid->rgba.green,
@@ -48,7 +48,7 @@ swf_fill_style_solid_print(swf_fill_style_solid_t *fill_style_solid,
                fill_style_solid->rgba_morph.green,
                fill_style_solid->rgba_morph.blue,
                fill_style_solid->rgba_morph.alpha);
-    } else if (tag->tag == 32) { // DefineShape3
+    } else if (tag->code == 32) { // DefineShape3
         printf("  #%02x%02x%02x(%02x)",
                fill_style_solid->rgba.red,
                fill_style_solid->rgba.green,
index 476ca60..f295be5 100644 (file)
@@ -7,7 +7,7 @@ swf_gradient_parse(bitstream_t *bs, swf_gradient_t *gradient,
                    swf_tag_t *tag, int type) {
     int i;
     bitstream_align(bs);
-    if (tag->tag == 83) { // DefineShape4
+    if (tag->code == 83) { // DefineShape4
         gradient->spread_mode = bitstream_getbits(bs, 2);
         gradient->interpolation_mode = bitstream_getbits(bs, 2);
         gradient->count = bitstream_getbits(bs, 4);
@@ -35,7 +35,7 @@ swf_gradient_build(bitstream_t *bs, swf_gradient_t *gradient,
                    swf_tag_t *tag, int type) {
     int i;
     bitstream_align(bs);
-    if (tag->tag == 83) { // DefineShape4
+    if (tag->code == 83) { // DefineShape4
         bitstream_putbits(bs, gradient->spread_mode, 2);
         bitstream_putbits(bs, gradient->interpolation_mode, 2);
         bitstream_putbits(bs, gradient->count, 4);
@@ -56,7 +56,7 @@ int
 swf_gradient_print(swf_gradient_t *gradient, int indent_depth,
                    swf_tag_t *tag, int type) {
     int i;
-    if (tag->tag == 83) { // DefineShape4
+    if (tag->code == 83) { // DefineShape4
         print_indent(indent_depth);
         printf("spread_mode=%d  interpolation_mode=%d  count=%d\n",
                gradient->spread_mode, gradient->interpolation_mode,
index 2a38dd4..6735498 100644 (file)
@@ -7,12 +7,12 @@ swf_gradient_record_parse(bitstream_t
                           *bs, swf_gradient_record_t *gradient_record,
                           swf_tag_t *tag) {
     int ret = 0;
-    if (tag->tag == 46 || tag->tag == 84) { // DefineMorph || DefineMorphShape2
+    if (tag->code == 46 || tag->code == 84) { // DefineMorph || DefineMorphShape2
         gradient_record->position = bitstream_getbyte(bs);
         swf_rgba_parse(bs, &(gradient_record->rgba));
         gradient_record->position_morph = bitstream_getbyte(bs);
         ret = swf_rgba_parse(bs, &(gradient_record->rgba_morph));
-    } else if (tag->tag == 32 || tag->tag == 83) {
+    } else if (tag->code == 32 || tag->code == 83) {
         // DefineShape3 || DefineShape4
         gradient_record->position = bitstream_getbyte(bs);
         ret = swf_rgba_parse(bs, &(gradient_record->rgba));
@@ -27,12 +27,12 @@ int
 swf_gradient_record_build(bitstream_t *bs,
                           swf_gradient_record_t *gradient_record,
                           swf_tag_t *tag) {
-    if (tag->tag == 46 || tag->tag == 84) { // DefineMorph || DefineMorphShape2
+    if (tag->code == 46 || tag->code == 84) { // DefineMorph || DefineMorphShape2
         bitstream_putbyte(bs, gradient_record->position);
         swf_rgba_build(bs, &(gradient_record->rgba));
         bitstream_putbyte(bs, gradient_record->position_morph);
         swf_rgba_build(bs, &(gradient_record->rgba_morph));
-    } else if (tag->tag == 32 || tag->tag == 83) {
+    } else if (tag->code == 32 || tag->code == 83) {
         // DefineShape3 || DefineShape4
         bitstream_putbyte(bs, gradient_record->position);
         swf_rgba_build(bs, &(gradient_record->rgba));
@@ -50,14 +50,14 @@ swf_gradient_record_print(swf_gradient_record_t *gradient_record,
         fprintf(stderr, "swf_gradient_record_print: gradient_record == NULL\n");
         return 1;
     }
-    if (tag->tag == 46 || tag->tag == 84) { // DefineMorph || DefineMorphShape2
+    if (tag->code == 46 || tag->code == 84) { // DefineMorph || DefineMorphShape2
         print_indent(indent_depth);
         printf("position=%d\n", gradient_record->position);
         swf_rgba_print(&(gradient_record->rgba), indent_depth);
         print_indent(indent_depth);
         printf("position_morph=%d\n", gradient_record->position_morph);
         swf_rgba_print(&(gradient_record->rgba_morph), indent_depth);
-    } else if (tag->tag == 32 || tag->tag == 83) {
+    } else if (tag->code == 32 || tag->code == 83) {
         // DefineShape3 || DefineShape4
         print_indent(indent_depth);
         printf("position=%d\n", gradient_record->position);
index ac360a3..8643b9d 100644 (file)
@@ -6,7 +6,7 @@ int
 swf_line_style_parse(bitstream_t *bs, swf_line_style_t *line_style,
                      swf_tag_t *tag) {
     int result;
-    if (tag->tag == 46) { // DefineMorphShape
+    if (tag->code == 46) { // DefineMorphShape
         result = bitstream_getbytesLE(bs, 2);
         if (result == -1) {
             return 1;
@@ -15,9 +15,9 @@ swf_line_style_parse(bitstream_t *bs, swf_line_style_t *line_style,
         line_style->width_morph = bitstream_getbytesLE(bs, 2);
         swf_rgba_parse(bs, &(line_style->rgba));
         swf_rgba_parse(bs, &(line_style->rgba_morph));
-    } else if (tag->tag == 83 || tag->tag == 84) {
+    } else if (tag->code == 83 || tag->code == 84) {
         // DefineShape4 || DefineMorphShape2
-        if (tag->tag == 84) { // DefineMorphShape2
+        if (tag->code == 84) { // DefineMorphShape2
             line_style->width_morph = bitstream_getbytesLE(bs, 2);
         }
         result = bitstream_getbits(bs, 2);
@@ -40,11 +40,11 @@ swf_line_style_parse(bitstream_t *bs, swf_line_style_t *line_style,
             swf_fill_style_parse(bs, &(line_style->fill_style), tag);
         } else {
             swf_rgba_parse(bs, &(line_style->rgba));
-            if (tag->tag == 84) { // DefineMorphShape2
+            if (tag->code == 84) { // DefineMorphShape2
                 swf_rgba_parse(bs, &(line_style->rgba_morph));
             }
         }
-    } else if (tag->tag == 32) { // DefineShape3
+    } else if (tag->code == 32) { // DefineShape3
         result = bitstream_getbytesLE(bs, 2);
         if (result == -1) {
             return 1;
@@ -65,14 +65,14 @@ swf_line_style_parse(bitstream_t *bs, swf_line_style_t *line_style,
 int
 swf_line_style_build(bitstream_t *bs, swf_line_style_t *line_style,
                      swf_tag_t *tag) {
-    if (tag->tag == 46) { // DefineMorphShape
+    if (tag->code == 46) { // DefineMorphShape
         bitstream_putbytesLE(bs, line_style->width, 2);
         bitstream_putbytesLE(bs, line_style->width_morph, 2);
         swf_rgba_build(bs, &(line_style->rgba));
         swf_rgba_build(bs, &(line_style->rgba_morph));
-    } else if (tag->tag == 83 || tag->tag == 84) {
+    } else if (tag->code == 83 || tag->code == 84) {
         // DefineShape4 || DefineMorphShape2
-        if (tag->tag == 84) { // DefineMorphShape2
+        if (tag->code == 84) { // DefineMorphShape2
             bitstream_putbytesLE(bs, line_style->width_morph, 2);
         }
         bitstream_putbits(bs, line_style->start_cap_style, 2);
@@ -91,11 +91,11 @@ swf_line_style_build(bitstream_t *bs, swf_line_style_t *line_style,
             swf_fill_style_build(bs, &(line_style->fill_style), tag);
         } else {
             swf_rgba_build(bs, &(line_style->rgba));
-            if (tag->tag == 84) { // DefineMorphShape2
+            if (tag->code == 84) { // DefineMorphShape2
                 swf_rgba_build(bs, &(line_style->rgba_morph));
             }
         }
-    } else if (tag->tag == 32) { // DefineShape3
+    } else if (tag->code == 32) { // DefineShape3
         bitstream_putbytesLE(bs, line_style->width, 2);
         swf_rgba_build(bs, &(line_style->rgba));
     } else {
@@ -112,16 +112,16 @@ swf_line_style_print(swf_line_style_t *line_style, int indent_depth,
         fprintf(stderr, "swf_line_style_print: line_style == NULL\n");
         return 1;
     }
-    if (tag->tag == 46) { // DefineMorphShape
+    if (tag->code == 46) { // DefineMorphShape
         print_indent(indent_depth);
         printf("width=%.2f  width_morph=%.2f\n",
                (float) line_style->width / SWF_TWIPS,
               (float) line_style->width_morph / SWF_TWIPS);
         swf_rgba_print(&(line_style->rgba), indent_depth);
         swf_rgba_print(&(line_style->rgba_morph), indent_depth);
-    } else if (tag->tag == 83 || tag->tag == 84) {
+    } else if (tag->code == 83 || tag->code == 84) {
         // DefineShape4 || DefineMorphShape2
-        if (tag->tag == 84) { // DefineMorphShape2
+        if (tag->code == 84) { // DefineMorphShape2
             print_indent(indent_depth);
             printf("width_morph=%d\n", line_style->width_morph);
         }
@@ -146,11 +146,11 @@ swf_line_style_print(swf_line_style_t *line_style, int indent_depth,
                 tag);
         } else {
             swf_rgba_print(&(line_style->rgba), indent_depth);
-            if (tag->tag == 84) { // DefineMorphShape2
+            if (tag->code == 84) { // DefineMorphShape2
                 swf_rgba_print(&(line_style->rgba_morph), indent_depth);
             }
         }
-    } else if (tag->tag == 32) { // DefineShape3
+    } else if (tag->code == 32) { // DefineShape3
         print_indent(indent_depth);
         printf("width=%.2f ", (float) line_style->width / SWF_TWIPS);
         swf_rgba_print(&(line_style->rgba), 0);
index 8ebc7f2..da45eb2 100644 (file)
@@ -15,7 +15,7 @@ swf_line_style_array_parse(bitstream_t *bs,
         return 1;
     }
     line_style_array->count = result;
-    if ((tag->tag != 2) && // ! DefineShape
+    if ((tag->code != 2) && // ! DefineShape
          (line_style_array->count == 255)) {
         result = bitstream_getbytesLE(bs, 2);
         if (result == -1) {
@@ -46,9 +46,9 @@ swf_line_style_array_parse(bitstream_t *bs,
 int
 swf_line_style_array_build(bitstream_t *bs, swf_line_style_array_t *line_style_array, swf_tag_t *tag) {
     int i;
-    if ((tag->tag == 2) || // DefineShape
-        ((tag->tag > 2) && (line_style_array->count < 255))) {
-        // tag->tag == 2 の時は count == 255 でもここに来るように
+    if ((tag->code == 2) || // DefineShape
+        ((tag->code > 2) && (line_style_array->count < 255))) {
+        // tag->code == 2 の時は count == 255 でもここに来るように
         bitstream_putbyte(bs, line_style_array->count);
     } else {
         bitstream_putbyte(bs, 255);
index 9ac4f54..1fa1095 100644 (file)
@@ -129,7 +129,7 @@ swf_object_input(swf_object_t *swf, unsigned char *data,
             tag->next = NULL;
         }
         swf->tag_tail = tag;
-       if (tag->tag == 0) { // END Tag
+       if (tag->code == 0) { // END Tag
             break; // SUCCESS
        }
         prev_tag = tag;
@@ -217,7 +217,7 @@ swf_object_print(swf_object_t *swf) {
     for (tag = swf->tag_head; tag ; tag = tag->next) {
         printf("[%d] ", i);
         swf_tag_print(tag, swf, 0);
-        if (tag->tag == 0) { // END Tag
+        if (tag->code == 0) { // END Tag
             break;
         }
         i++;
@@ -267,7 +267,7 @@ swf_object_purge_contents(swf_object_t *swf) {
         // 以下コンテンツ系のタグ
         if (trans_table_get(refcid_trans_table, cid) == TRANS_TABLE_RESERVE_ID) {
             // no purge
-            if (isShapeTag(tag->tag)) {
+            if (isShapeTag(tag->code)) {
                int *bitmap_id_list, bitmap_id_list_num;
                bitmap_id_list = swf_tag_shape_bitmap_get_refcid_list(tag, &bitmap_id_list_num);
                if (bitmap_id_list) {
@@ -277,7 +277,7 @@ swf_object_purge_contents(swf_object_t *swf) {
                    }
                    free(bitmap_id_list);
                }
-            } else if (isSpriteTag(tag->tag)) {
+            } else if (isSpriteTag(tag->code)) {
                 swf_tag_t *t;
                 swf_tag_sprite_detail_t *tag_sprite;
                 tag_sprite = swf_tag_create_input_detail(tag, swf);
@@ -293,7 +293,7 @@ swf_object_purge_contents(swf_object_t *swf) {
                 }
             }
         } else { // Purge!
-            if (isShapeTag(tag->tag) || isBitmapTag(tag->tag)) {
+            if (isShapeTag(tag->code) || isBitmapTag(tag->code)) {
                 // TODO:  tag == head ? tag == tail ? OK?
                 swf_tag_t *next_tag = tag->next;
                 tag->prev->next = tag->next;
@@ -435,7 +435,7 @@ swf_object_remove_tag(swf_object_t *swf, int tag_seqno,
     tag = swf_object_search_tag_byseqno(swf, tag_seqno);
     if (tag) {
         if (tag_seqno_in_sprite >= 0) {
-            if (isSpriteTag(tag->tag)) {
+            if (isSpriteTag(tag->code)) {
                 swf_tag_sprite_detail_t   *tag_sprite;
                 swf_tag_t *tag_in_sprite;
                 tag_sprite = swf_tag_create_input_detail(tag, swf);
@@ -519,8 +519,8 @@ swf_object_get_shapedata(swf_object_t *swf, int cid, unsigned long *length) {
         }
     }
     if (tag) {
-        if (! isShapeTag(tag->tag)) {
-            fprintf(stderr, "swf_object_get_shapedata: not isShapeTag(%d)\n", tag->tag);
+        if (! isShapeTag(tag->code)) {
+            fprintf(stderr, "swf_object_get_shapedata: not isShapeTag(%d)\n", tag->code);
             return NULL;
         }
         if ((tag->data == NULL ) && tag->detail) {
@@ -554,7 +554,7 @@ swf_object_replace_shapedata(swf_object_t *swf, int cid,
         }
     }
     if (tag) {
-        if (! isShapeTag(tag->tag)) {
+        if (! isShapeTag(tag->code)) {
             return 1; // failure
         }
         if (tag->detail) {
@@ -565,8 +565,8 @@ swf_object_replace_shapedata(swf_object_t *swf, int cid,
             free(tag->data);
             tag->data = NULL;
         }
-       //    if (tag->tag == 2) { // DefineShape
-       //        tag->tag = 22;   // => DefineShape2
+       //    if (tag->code == 2) { // DefineShape
+       //        tag->code = 22;   // => DefineShape2
        //    }
         tag->length = length + 2;
         tag->data = malloc(length + 2);
@@ -638,7 +638,7 @@ swf_object_search_bitmap_tag(swf_object_t *swf, int bitmap_id) {
         return NULL;
     }
     for (tag = swf->tag_head ; tag ; tag = tag->next) {
-        register int tag_code = tag->tag;
+        register int tag_code = tag->code;
         if (isBitmapTag(tag_code)) {
             if (swf_tag_get_cid(tag) == bitmap_id) {
                 return tag; // match
@@ -670,7 +670,7 @@ swf_object_adjust_shapebitmap(swf_object_t *swf, int bitmap_id,
         width_scale  = (double) old_width  / new_width;
         height_scale = (double) old_height / new_height;
         for (tag = swf->tag_head ; tag ; tag=tag->next) {
-            register int tag_code = tag->tag;
+            register int tag_code = tag->code;
             if (isShapeTag(tag_code)) {
                bitmap_id_list = swf_tag_shape_bitmap_get_refcid_list(tag, &bitmap_id_list_num);
                if (bitmap_id_list) {
@@ -694,7 +694,7 @@ swf_object_adjust_shapebitmap(swf_object_t *swf, int bitmap_id,
         width_scale  = (double) new_width  / old_width;
         height_scale = (double) new_height / old_height;
         for (tag = swf->tag_head ; tag ; tag=tag->next) {
-           register int tag_code = tag->tag;
+           register int tag_code = tag->code;
             if (isShapeTag(tag_code)) {
                bitmap_id_list = swf_tag_shape_bitmap_get_refcid_list(tag, &bitmap_id_list_num);
                if (bitmap_id_list) {
@@ -715,7 +715,7 @@ swf_object_adjust_shapebitmap(swf_object_t *swf, int bitmap_id,
     }
     if (swf->shape_adjust_mode & SWFED_SHAPE_BITMAP_TYPE_TILLED) {
         for (tag = swf->tag_head ; tag ; tag=tag->next) {
-            register int tag_code = tag->tag;
+            register int tag_code = tag->code;
             if (isShapeTag(tag_code)) {
                bitmap_id_list = swf_tag_shape_bitmap_get_refcid_list(tag, &bitmap_id_list_num);
                if (bitmap_id_list) {
@@ -759,12 +759,12 @@ swf_object_get_jpegdata(swf_object_t *swf, unsigned long *length, int image_id)
         return NULL;
     }
     for (tag=swf->tag_head ; tag ; tag=tag->next) {
-        if (tag->tag == 8) { // JPEGTables
+        if (tag->code == 8) { // JPEGTables
             tag_jpegtables = tag;
             continue;
         }
         // ! DefineBitsJPEG(1),2,3
-        if ((tag->tag != 6) && (tag->tag != 21) && (tag->tag != 35)) {
+        if ((tag->code != 6) && (tag->code != 21) && (tag->code != 35)) {
             continue;
         }
         data = swf_tag_get_jpeg_data(tag, length, image_id, tag_jpegtables);
@@ -785,7 +785,7 @@ swf_object_get_alphadata(swf_object_t *swf, unsigned long *length, int image_id)
         return NULL;
     }
     for (tag=swf->tag_head ; tag ; tag=tag->next) {
-        if (tag->tag != 35) { // ! DefineBitsJPEG3
+        if (tag->code != 35) { // ! DefineBitsJPEG3
             continue;
         }
         data = swf_tag_get_alpha_data(tag, length, image_id);
@@ -850,7 +850,7 @@ swf_object_get_pngdata(swf_object_t *swf, unsigned long *length, int image_id) {
     *length = 0;
     for (tag=swf->tag_head ; tag ; tag=tag->next) {
         // DefineBitsLossless(1),2
-        if ((tag->tag != 20) && (tag->tag != 36)) {
+        if ((tag->code != 20) && (tag->code != 36)) {
             continue;
         }
         data = swf_tag_get_png_data(tag, length, image_id);
@@ -958,7 +958,7 @@ swf_object_get_sounddata(swf_object_t *swf, unsigned long *length, int sound_id)
     }
     for (tag=swf->tag_head ; tag ; tag=tag->next) {
         // DefineSound
-        if (tag->tag != 14) {
+        if (tag->code != 14) {
             continue;
         }
         data = swf_tag_get_sound_data(tag, length, sound_id);
@@ -1060,7 +1060,7 @@ swf_object_get_actiondata(swf_object_t *swf, unsigned long *length, int tag_seqn
     if (tag == NULL) {
         return NULL;
     }
-    if ((tag->tag != 12) &&  (tag->tag != 59)) { //  DoAction, DoInitAction
+    if ((tag->code != 12) &&  (tag->code != 59)) { //  DoAction, DoInitAction
         return NULL;
     }
     swf_tag_action = (swf_tag_action_detail_t *) swf_tag_create_input_detail(tag, swf);
@@ -1083,7 +1083,7 @@ swf_object_insert_action_setvariables(swf_object_t *swf,
         return 1; // NG
     }
     for (tag=swf->tag_head ; tag ; tag=tag->next) {
-        switch (tag->tag) {
+        switch (tag->code) {
         case 1: // ShowFrame
             if (prev_tag == NULL) {
                 // ShowFrame までに候補が見つからなければ、ShowFrame の直前
@@ -1148,7 +1148,7 @@ swf_object_insert_action_setvariables(swf_object_t *swf,
 static void
 trans_table_replace_refcid_recursive(swf_tag_t *tag, trans_table_t *cid_trans_table) {
     for ( ; tag ; tag=tag->next) {
-        int tag_no = tag->tag;
+        int tag_no = tag->code;
         if (isSpriteTag(tag_no)) {
             swf_tag_sprite_detail_t *tag_sprite;
             tag_sprite = swf_tag_create_input_detail(tag, NULL);
@@ -1192,7 +1192,7 @@ swf_object_saerch_sprite_by_target_path(swf_tag_t *tag_head,
     // インスタンス名から PlaceObject を探し、参照している CID を取得する
     for (tag = tag_head ; tag ; tag=tag->next) {
         cid = 0;
-        if (tag->tag == 26) { // PlaceObject2
+        if (tag->code == 26) { // PlaceObject2
             cid = swf_tag_place_get_cid_by_instance_name(tag, instance_name, instance_name_len, swf);
         }
         if (cid > 0) {
@@ -1208,7 +1208,7 @@ swf_object_saerch_sprite_by_target_path(swf_tag_t *tag_head,
 
     // CID で DefineSprite を探す
     for (tag=swf->tag_head ; tag ; tag=tag->next) {
-        if (isSpriteTag(tag->tag)) {
+        if (isSpriteTag(tag->code)) {
             if (swf_tag_get_cid(tag) ==  cid) {
                 sprite_tag = tag;
                 break;
@@ -1281,7 +1281,7 @@ swf_object_replace_movieclip(swf_object_t *swf,
 //    trans_table_print(cid_trans_table);
     
     // Sprite タグの中を綺麗にする
-    tag_info = get_swf_tag_info(sprite_tag->tag);
+    tag_info = get_swf_tag_info(sprite_tag->code);
     detail_handler = tag_info->detail_handler();
     free(sprite_tag->data);
     sprite_tag->data = NULL;
@@ -1295,7 +1295,7 @@ swf_object_replace_movieclip(swf_object_t *swf,
 
     // SWF 中のタグを種類に応じて展開する
     for (tag = swf4sprite->tag_head ; tag ; tag = tag->next) {
-        int tag_no = tag->tag;
+        int tag_no = tag->code;
         switch (tag_no) {
             // tag skip
           default: // misc
@@ -1504,7 +1504,7 @@ swf_object_is_shape_tagdata(unsigned char *data, int data_len) {
   bitstream_input(bs, data, data_len);
   tag = swf_tag_create(bs);
   if (tag) {
-      if (isShapeTag(tag->tag)) {
+      if (isShapeTag(tag->code)) {
           ret = 1; // TRUE
       }
   }
@@ -1522,7 +1522,7 @@ swf_object_is_bitmap_tagdata(unsigned char *data, int data_len) {
   bitstream_input(bs, data, data_len);
   tag = swf_tag_create(bs);
   if (tag) {
-      if (isBitmapTag(tag->tag)) {
+      if (isBitmapTag(tag->code)) {
           ret = 1; // TRUE
       }
   }
index e925463..a29b216 100644 (file)
@@ -91,7 +91,7 @@ swf_tag_t *swf_tag_create(bitstream_t *bs) {
         return NULL;
     }
     tag = calloc(sizeof(*tag), 1);
-    tag->tag = tag_and_length >> 6;
+    tag->code = tag_and_length >> 6;
     tag->length = tag_and_length & 0x3f;
     tag->length_longformat = 0;
     if (tag->length == 0x3f) {
@@ -138,7 +138,7 @@ static int swf_tag_and_length_build(bitstream_t *bs, swf_tag_t *tag) {
     if (tag->length >= 0x3f) {
         tag->length_longformat = 1;
     } else {
-        switch (tag->tag) {
+        switch (tag->code) {
           case 6:  // DefineBitsJPEG
           case 21: // DefineBitsJPEG2
           case 35: // DefineBitsJPEG3
@@ -153,11 +153,11 @@ static int swf_tag_and_length_build(bitstream_t *bs, swf_tag_t *tag) {
         }
     }
     if (tag->length_longformat) {
-        tag_and_length = (tag->tag << 6) | 0x3f;
+        tag_and_length = (tag->code << 6) | 0x3f;
         bitstream_putbytesLE(bs, tag_and_length, 2);
         bitstream_putbytesLE(bs, tag->length, 4);
     } else {
-        tag_and_length = (tag->tag << 6) | tag->length;
+        tag_and_length = (tag->code << 6) | tag->length;
         bitstream_putbytesLE(bs, tag_and_length, 2);
     }
     return 0;
@@ -176,21 +176,21 @@ int swf_tag_build(bitstream_t *bs, swf_tag_t *tag, struct swf_object_ *swf) {
         fprintf(stderr, "swf_tag_build: tag == NULL\n");
         return 1;
     }
-//    fprintf(stderr, "XXX: swf_tag_build: tag->tag=%d\n",tag->tag);
+//    fprintf(stderr, "XXX: swf_tag_build: tag->code=%d\n",tag->code);
     if (tag->data) {
         swf_tag_and_length_build(bs, tag);
         bitstream_putstring(bs, tag->data, tag->length);
     } else if (tag->detail) {
-        tag_info = get_swf_tag_info(tag->tag);
+        tag_info = get_swf_tag_info(tag->code);
         if ((tag_info == NULL) || (tag_info->detail_handler == NULL)) {
-            fprintf(stderr, "swf_tag_build: not implemented yet. detail build tag->tag=%d\n",
-                tag->tag);
+            fprintf(stderr, "swf_tag_build: not implemented yet. detail build tag->code=%d\n",
+                tag->code);
             return 1;
         }
         detail_handler = tag_info->detail_handler();
         if (detail_handler->output == NULL) {
-            fprintf(stderr, "swf_tag_build: detail_handler->output == NULL: tag->tag=%d\n",
-                    tag->tag);
+            fprintf(stderr, "swf_tag_build: detail_handler->output == NULL: tag->code=%d\n",
+                    tag->code);
             return 1;
         }
         data = detail_handler->output(tag, &data_len, swf);
@@ -214,7 +214,7 @@ swf_tag_rebuild(swf_tag_t *tag, struct swf_object_ *swf) {
     swf_tag_info_t *tag_info = NULL;
     swf_tag_detail_handler_t * detail_handler = NULL;
     int ret;
-    tag_info = get_swf_tag_info(tag->tag);
+    tag_info = get_swf_tag_info(tag->code);
     if ((tag_info == NULL) || (tag_info->detail_handler == NULL)) {
         return 1; // no info
     }
@@ -227,7 +227,7 @@ swf_tag_rebuild(swf_tag_t *tag, struct swf_object_ *swf) {
     }
     ret = detail_handler->input(tag, swf);
     if (ret) {
-        fprintf(stderr, "swf_tag_rebuild: detail_hander->input failed tag_no=%d\n", tag->tag);
+        fprintf(stderr, "swf_tag_rebuild: detail_hander->input failed tag_no=%d\n", tag->code);
         return 1;
     }
     free(tag->data);
@@ -244,10 +244,10 @@ swf_tag_print(swf_tag_t *tag, struct swf_object_ *swf, int indent_depth) {
         fprintf(stderr, "swf_tag_print: tag == NULL\n");
         return ;
     }
-    tag_info = get_swf_tag_info(tag->tag);
+    tag_info = get_swf_tag_info(tag->code);
     tag_name = (tag_info)?tag_info->name:"Unknown";
 //  print_indent(indent_depth);
-    printf("tag=%s(%d)", tag_name, tag->tag);
+    printf("tag=%s(%d)", tag_name, tag->code);
     if (tag->length > 0) {
         printf("  length=%lu",  tag->length);
     }
@@ -273,18 +273,18 @@ void *swf_tag_create_input_detail(swf_tag_t *tag, struct swf_object_ *swf) {
     if (tag->detail) {
         return tag->detail;
     }
-    tag_info = get_swf_tag_info(tag->tag);
+    tag_info = get_swf_tag_info(tag->code);
     if (tag_info && tag_info->detail_handler) {
         int result;
         swf_tag_detail_handler_t * detail_handler = tag_info->detail_handler();
         if (detail_handler->create == NULL) {
             fprintf(stderr, "detail_handler->create == NULL (tag=%d)\n",
-                    tag->tag);
+                    tag->code);
             return NULL;
         }
         tag->detail = detail_handler->create();
         if (tag->detail == NULL) {
-            fprintf(stderr, "can't create tag detail (tag=%d)\n", tag->tag);
+            fprintf(stderr, "can't create tag detail (tag=%d)\n", tag->code);
             return NULL;
         }
         result = detail_handler->input(tag, swf);
@@ -301,14 +301,14 @@ void swf_tag_destroy_detail(swf_tag_t *tag) {
         return;
     }
     if (tag->detail) {
-        swf_tag_info_t *tag_info = get_swf_tag_info(tag->tag);
+        swf_tag_info_t *tag_info = get_swf_tag_info(tag->code);
         if (tag_info && tag_info->detail_handler) {
             swf_tag_detail_handler_t * detail_handler = tag_info->detail_handler();
             if (detail_handler->destroy) {
                 detail_handler->destroy(tag);
             } else {
                fprintf(stderr, "detail_handler->destroy == NULL (tag=%d)\n",
-                        tag->tag);
+                        tag->code);
             }
         } else {
            fprintf(stderr, "not impremented yet. destroy tag detail\n");
@@ -326,7 +326,7 @@ swf_tag_get_cid(swf_tag_t *tag) {
         fprintf(stderr, "swf_tag_get_cid: tag == NULL\n");
         return 1;
     }
-    tag_no = tag->tag;
+    tag_no = tag->code;
     tag_info = get_swf_tag_info(tag_no);
     if (tag_info && tag_info->detail_handler) {
         swf_tag_detail_handler_t * detail_handler = tag_info->detail_handler();
@@ -366,7 +366,7 @@ swf_tag_replace_cid(swf_tag_t *tag, int cid) {
         fprintf(stderr, "swf_tag_replace_cid: tag == NULL\n");
         return 1; // failure
     }
-    tag_no = tag->tag;
+    tag_no = tag->code;
     tag_info = get_swf_tag_info(tag_no);
     if (tag_info && tag_info->detail_handler) {
         swf_tag_detail_handler_t * detail_handler = tag_info->detail_handler();
@@ -405,7 +405,7 @@ swf_tag_get_refcid(swf_tag_t *tag) {
         fprintf(stderr, "swf_tag_get_refcid: tag == NULL\n");
         return -1;
     }
-    if (isPlaceTag(tag->tag)) { // PlaceObject, PlaceObject2
+    if (isPlaceTag(tag->code)) { // PlaceObject, PlaceObject2
         swf_tag_place_detail_t *swf_tag_place;
         swf_tag_place = swf_tag_create_input_detail(tag, NULL);
         if (swf_tag_place == NULL) {
@@ -423,7 +423,7 @@ swf_tag_replace_refcid(swf_tag_t *tag, int cid) {
         fprintf(stderr, "swf_tag_replace_refcid: tag == NULL\n");
         return 1; // failure
     }
-    if (isPlaceTag(tag->tag)) { // PlaceObject, PlaceObject2
+    if (isPlaceTag(tag->code)) { // PlaceObject, PlaceObject2
         swf_tag_place_detail_t *swf_tag_place;
         swf_tag_place = swf_tag_create_input_detail(tag, NULL);
         if (swf_tag_place == NULL) {
@@ -457,11 +457,11 @@ swf_tag_get_bitmap_size(swf_tag_t *tag,
         fprintf(stderr, "swf_tag_get_bitmap_size: swf_tag_create_input_detail failed\n");
         return 1;
     }
-    if (isBitsJPEGTag(tag->tag)) {
+    if (isBitsJPEGTag(tag->code)) {
         swf_tag_jpeg_detail_t *swf_tag_jpeg = (swf_tag_jpeg_detail_t *) tag->detail;
         ret = jpeg_size(swf_tag_jpeg->jpeg_data, swf_tag_jpeg->jpeg_data_len,
                   width, height);
-    } else if (isBitsLosslessTag(tag->tag)) {
+    } else if (isBitsLosslessTag(tag->code)) {
         swf_tag_lossless_detail_t *swf_tag_lossless = (swf_tag_lossless_detail_t *) tag->detail;
         *width  = swf_tag_lossless->width;
         *height = swf_tag_lossless->height;
@@ -483,8 +483,8 @@ swf_tag_get_jpeg_data(swf_tag_t *tag, unsigned long *length, int image_id, swf_t
         fprintf(stderr, "swf_tag_get_jpeg_data: length == NULL\n");
         return NULL;
     }
-    tag_info = get_swf_tag_info(tag->tag);
-    if ((tag->tag != 6) && (tag->tag != 21) && (tag->tag != 35)) {
+    tag_info = get_swf_tag_info(tag->code);
+    if ((tag->code != 6) && (tag->code != 21) && (tag->code != 35)) {
         return NULL;
     }
     if (swf_tag_create_input_detail(tag, NULL) == NULL) {
@@ -512,7 +512,7 @@ swf_tag_get_alpha_data(swf_tag_t *tag, unsigned long *length, int image_id) {
         fprintf(stderr, "swf_tag_get_alpha_data: length == NULL\n");
         return NULL;
     }
-    if (tag->tag != 35) { // ! DefineBitsJPEG3
+    if (tag->code != 35) { // ! DefineBitsJPEG3
         return NULL;
     }
     if (swf_tag_get_cid(tag) != image_id) {
@@ -542,26 +542,26 @@ swf_tag_replace_jpeg_data(swf_tag_t *tag, int image_id,
         fprintf(stderr, "swf_tag_replace_jpeg_data: jpeg_data == NULL\n");
         return 1;
     }
-    if (! isBitmapTag(tag->tag)) {
+    if (! isBitmapTag(tag->code)) {
         return 1;
     }
-    tag_info = get_swf_tag_info(tag->tag); // Bitmap Tag
+    tag_info = get_swf_tag_info(tag->code); // Bitmap Tag
     detail_handler = tag_info->detail_handler();
     if (detail_handler->get_cid(tag) !=  image_id) {
         return 1;
     }
 
-    if (tag->detail && (! isBitsJPEGTag(tag->tag))) {
+    if (tag->detail && (! isBitsJPEGTag(tag->code))) {
         detail_handler->destroy(tag);
         tag->detail = NULL;
     }
     if (alpha_data && (alpha_data_len > 0)) {
-        tag->tag = 35; // DefineBitsJPEG3
+        tag->code = 35; // DefineBitsJPEG3
     } else {
-        tag->tag = 21; // DefineBitsJPEG2
+        tag->code = 21; // DefineBitsJPEG2
     }
     
-    tag_info = get_swf_tag_info(tag->tag); // JPEG Tag
+    tag_info = get_swf_tag_info(tag->code); // JPEG Tag
     detail_handler = tag_info->detail_handler();
     if (tag->detail == NULL) {
         tag->detail = detail_handler->create();
@@ -596,8 +596,8 @@ swf_tag_get_png_data(swf_tag_t *tag, unsigned long *length, int image_id) {
         fprintf(stderr, "swf_tag_get_png_data: length == NULL\n");
         return NULL;
     }
-    tag_info = get_swf_tag_info(tag->tag);
-    if ((tag->tag != 20) && (tag->tag != 36)) {
+    tag_info = get_swf_tag_info(tag->code);
+    if ((tag->code != 20) && (tag->code != 36)) {
         return NULL;
     }
     if (swf_tag_create_input_detail(tag, NULL) == NULL) {
@@ -622,26 +622,26 @@ swf_tag_replace_png_data(swf_tag_t *tag, int image_id,
         fprintf(stderr, "swf_tag_replace_png_data: png_data == NULL\n");
         return 1;
     }
-    if (! isBitmapTag(tag->tag)) {
+    if (! isBitmapTag(tag->code)) {
         return 1;
     }
-    tag_info = get_swf_tag_info(tag->tag); // Bitmap Tag
+    tag_info = get_swf_tag_info(tag->code); // Bitmap Tag
     detail_handler = tag_info->detail_handler();
     if (detail_handler->get_cid(tag) != image_id) {
         return 1;
     }
     
-    if (tag->detail && (! isBitsLosslessTag(tag->tag))) {
+    if (tag->detail && (! isBitsLosslessTag(tag->code))) {
         detail_handler->destroy(tag);
         tag->detail = NULL;
     }
-    if (tag->tag == 20) {
-        tag->tag = 20; // DefineBitsLossless
+    if (tag->code == 20) {
+        tag->code = 20; // DefineBitsLossless
     } else {
-        tag->tag = 36; // DefineBitsLossless2
+        tag->code = 36; // DefineBitsLossless2
     }
     
-    tag_info = get_swf_tag_info(tag->tag); // Lossless Tag
+    tag_info = get_swf_tag_info(tag->code); // Lossless Tag
     detail_handler = tag_info->detail_handler();
     if (tag->detail == NULL) {
         tag->detail = detail_handler->create();
@@ -679,26 +679,26 @@ swf_tag_replace_gif_data(swf_tag_t *tag, int image_id,
         fprintf(stderr, "swf_tag_replace_gif_data: gif_data == NULL\n");
         return 1;
     }
-    if (! isBitmapTag(tag->tag)) {
+    if (! isBitmapTag(tag->code)) {
         return 1;
     }
-    tag_info = get_swf_tag_info(tag->tag); // Bitmap Tag
+    tag_info = get_swf_tag_info(tag->code); // Bitmap Tag
     detail_handler = tag_info->detail_handler();
     if (detail_handler->get_cid(tag) != image_id) {
         return 1;
     }
     
-    if (tag->detail && (! isBitsLosslessTag(tag->tag))) {
+    if (tag->detail && (! isBitsLosslessTag(tag->code))) {
         detail_handler->destroy(tag);
         tag->detail = NULL;
     }
-    if (tag->tag == 20) {
-        tag->tag = 20; // DefineBitsLossless
+    if (tag->code == 20) {
+        tag->code = 20; // DefineBitsLossless
     } else {
-        tag->tag = 36; // DefineBitsLossless2
+        tag->code = 36; // DefineBitsLossless2
     }
     
-    tag_info = get_swf_tag_info(tag->tag); // Lossless Tag
+    tag_info = get_swf_tag_info(tag->code); // Lossless Tag
     detail_handler = tag_info->detail_handler();
     if (tag->detail == NULL) {
         tag->detail = detail_handler->create();
@@ -735,8 +735,8 @@ swf_tag_get_sound_data(swf_tag_t *tag, unsigned long *length, int sound_id) {
         fprintf(stderr, "swf_tag_get_sound_data: length == NULL\n");
         return NULL;
     }
-    tag_info = get_swf_tag_info(tag->tag);
-    if (tag->tag != 14) { // DefineSound
+    tag_info = get_swf_tag_info(tag->code);
+    if (tag->code != 14) { // DefineSound
         return NULL;
     }
     if (! tag->detail) {
@@ -762,7 +762,7 @@ swf_tag_replace_melo_data(swf_tag_t *tag, int sound_id,
         fprintf(stderr, "swf_tag_replace_melo_data: melo_data == NULL\n");
         return 1;
     }
-    if (tag->tag != 14) { // DefineSound
+    if (tag->code != 14) { // DefineSound
         return 1;
     }
     if (swf_tag_get_cid(tag) != sound_id) {
@@ -794,7 +794,7 @@ swf_tag_get_edit_string(swf_tag_t *tag,
         fprintf(stderr, "swf_tag_get_edit_string: variable_name == NULL\n");
         return NULL;
     }
-    if (tag->tag != 37) { // DefineEditText
+    if (tag->code != 37) { // DefineEditText
         return NULL;
     }
     if (swf_tag_create_input_detail(tag, swf) == NULL) {
@@ -819,7 +819,7 @@ swf_tag_replace_edit_string(swf_tag_t *tag,
         fprintf(stderr, "swf_tag_replace_edit_string: variable_name == NULL\n");
         return 1;
     }
-    if (tag->tag != 37) { // DefineEditText
+    if (tag->code != 37) { // DefineEditText
         return 1;
     }
     if (swf_tag_create_input_detail(tag, swf) == NULL) {
@@ -848,8 +848,8 @@ swf_tag_apply_shape_matrix_factor(swf_tag_t *tag, int shape_id,
         fprintf(stderr, "swf_tag_apply_shape_matrix_factor: tag == NULL\n");
         return 1;
     }
-    if ((tag->tag != 2) && (tag->tag != 22) && (tag->tag !=32 )
-        && (tag->tag != 46)) {
+    if ((tag->code != 2) && (tag->code != 22) && (tag->code !=32 )
+        && (tag->code != 46)) {
         // ! DefineShape1,2,3, DefineMorphShape
         return 1;
     }
@@ -882,8 +882,8 @@ swf_tag_apply_shape_rect_factor(swf_tag_t *tag, int shape_id,
         fprintf(stderr, "swf_tag_apply_shape_rect_factor: tag == NULL\n");
         return 1;
     }
-    if ((tag->tag != 2) && (tag->tag != 22) && (tag->tag !=32 )
-        && (tag->tag != 46)) {
+    if ((tag->code != 2) && (tag->code != 22) && (tag->code !=32 )
+        && (tag->code != 46)) {
         // ! DefineShape1,2,3, DefineMorphShape
         return 1;
     }
@@ -913,8 +913,8 @@ swf_tag_apply_shape_type_tilled(swf_tag_t *tag, int shape_id,
         fprintf(stderr, "swf_tag_apply_shape_type_tylled: tag == NULL\n");
         return 1;
     }
-    if ((tag->tag != 2) && (tag->tag != 22) && (tag->tag !=32 )
-        && (tag->tag != 46)) {
+    if ((tag->code != 2) && (tag->code != 22) && (tag->code !=32 )
+        && (tag->code != 46)) {
         // ! DefineShape1,2,3, DefineMorphShape
         return 1;
     }
@@ -943,8 +943,8 @@ swf_tag_create_action_setvariables(y_keyvalue_t *kv) {
         return NULL;
     }
     tag = calloc(sizeof(*tag), 1);
-    tag->tag = 12; // DoAction
-    swf_tag_info_t *tag_info = get_swf_tag_info(tag->tag);
+    tag->code = 12; // DoAction
+    swf_tag_info_t *tag_info = get_swf_tag_info(tag->code);
     swf_tag_detail_handler_t *detail_handler = tag_info->detail_handler();
     tag->detail = detail_handler->create();
     ret = swf_tag_action_create_setvaribles(tag, kv);
@@ -992,7 +992,7 @@ swf_tag_move(swf_tag_t *from_tag) {
         return NULL;
     }
     to_tag = calloc(sizeof(*to_tag), 1);
-    to_tag->tag = from_tag->tag;
+    to_tag->code = from_tag->code;
     to_tag->length = from_tag->length;
     to_tag->length_longformat = from_tag->length_longformat;
     to_tag->data = from_tag->data;
index 42cc8b8..941e9f7 100644 (file)
@@ -13,7 +13,7 @@
 struct swf_object_; // swf_object.h
 
 typedef struct swf_tag_ {
-    int tag;
+    int code;
     unsigned long length;
     int length_longformat;
     //
index 5c1e2f8..6ba2d4f 100644 (file)
@@ -54,7 +54,7 @@ swf_tag_action_input_detail(swf_tag_t *tag, struct swf_object_ *swf) {
     bs = bitstream_open();
     bitstream_input(bs, data, length);
 
-    if (tag->tag == 59) { // DoInitAction
+    if (tag->code == 59) { // DoInitAction
         swf_tag_action->action_sprite = bitstream_getbytesLE(bs, 2);
     } else {              // DoAction
         swf_tag_action->action_sprite = 0; // fail safe
@@ -77,7 +77,7 @@ swf_tag_action_output_detail(swf_tag_t *tag, unsigned long *length,
 
     (void) swf;
     bs = bitstream_open();
-    if (tag->tag == 59) { // DoInitAction
+    if (tag->code == 59) { // DoInitAction
         bitstream_putbytesLE(bs, swf_tag_action->action_sprite, 2);
     } else {              // DoAction
         ; // nothing
@@ -97,7 +97,7 @@ swf_tag_action_print_detail(swf_tag_t *tag,
     swf_tag_action_detail_t *swf_tag_action = (swf_tag_action_detail_t *) tag->detail;
     (void) swf;
     print_indent(indent_depth);
-    if (tag->tag == 59) { // DoInitAction
+    if (tag->code == 59) { // DoInitAction
         printf("action_sprite=%d  ", swf_tag_action->action_sprite);
     }
     printf("action_record =\n");
index 86564e2..533336c 100644 (file)
@@ -472,7 +472,7 @@ swf_tag_jpeg_replace_jpeg_data(void *detail, int image_id,
         return 1;
     }
     swf_tag_jpeg->image_id = image_id;
-    if (tag->tag == 6) { // DefineBitsJPEG
+    if (tag->code == 6) { // DefineBitsJPEG
         if (jpeg_data && jpeg_data_len) { // fail safe
             free(swf_tag_jpeg->jpeg_data);
             swf_tag_jpeg->jpeg_data = malloc(jpeg_data_len);
index 5406a3b..fe9dc40 100644 (file)
@@ -84,7 +84,7 @@ swf_tag_lossless_input_detail(swf_tag_t *tag,
         int bytes_per_color;
         swf_tag_lossless->colormap_count = bitstream_getbyte(bs) + 1;
         indices_len = ((swf_tag_lossless->width + 3) & -4) * swf_tag_lossless->height;
-        if (tag->tag == 20) { // Lossless => rgb (3 bytes)
+        if (tag->code == 20) { // Lossless => rgb (3 bytes)
             bytes_per_color = 3;
         } else { // Lossless2 => rgba (4 bytes)
             bytes_per_color = 4;
@@ -119,7 +119,7 @@ swf_tag_lossless_input_detail(swf_tag_t *tag,
         }
         bs2 = bitstream_open();
         bitstream_input(bs2, tmp_buff, origsize);
-        if (tag->tag == 20) { // Lossless
+        if (tag->code == 20) { // Lossless
             swf_tag_lossless->colormap = malloc(sizeof(swf_rgb_t) * swf_tag_lossless->colormap_count);
             for (i=0 ; i < swf_tag_lossless->colormap_count ; i++) {
                 swf_rgb_t *rgb = swf_tag_lossless->colormap + i;
@@ -163,7 +163,7 @@ swf_tag_lossless_input_detail(swf_tag_t *tag,
         }
         bs2 = bitstream_open();
         bitstream_input(bs2, tmp_buff, origsize);
-        if (tag->tag == 20) { // Lossless
+        if (tag->code == 20) { // Lossless
             swf_tag_lossless->bitmap = malloc(bitmap_count * sizeof(swf_xrgb_t));
             for (i=0 ; i < bitmap_count ; i++) {
                 swf_xrgb_t *xrgb = swf_tag_lossless->bitmap + i;
@@ -254,7 +254,7 @@ swf_tag_lossless_output_detail(swf_tag_t *tag, unsigned long *length,
         unsigned long indices_len;
         bitstream_putbyte(bs, swf_tag_lossless->colormap_count - 1); /* XXX */
         bs2 = bitstream_open();
-        if (tag->tag == 20) { // Lossless
+        if (tag->code == 20) { // Lossless
             for (i=0 ; i < swf_tag_lossless->colormap_count ; i++) {
                 swf_rgb_t *rgb = swf_tag_lossless->colormap + i;
                 swf_rgb_build(bs2, rgb);
@@ -292,7 +292,7 @@ swf_tag_lossless_output_detail(swf_tag_t *tag, unsigned long *length,
     } else {
         unsigned long bitmap_size;
         bs2 = bitstream_open();
-        if (tag->tag == 20) { // Lossless
+        if (tag->code == 20) { // Lossless
             bitmap_size = swf_tag_lossless->width * swf_tag_lossless->height;
             for (i=0 ; i < bitmap_size ; i++) {
                 swf_xrgb_t *xrgb = swf_tag_lossless->bitmap + i;
@@ -427,7 +427,7 @@ unsigned char *swf_tag_lossless_get_png_data(void *detail,
                 swf_tag_lossless->format);
         return NULL;
     }
-    if (tag->tag == 20) {
+    if (tag->code == 20) {
         if (swf_tag_lossless->format == 3) {
             index_data = (void *) swf_tag_lossless->colormap;
             image_data = (void *) swf_tag_lossless->indices;
@@ -451,7 +451,7 @@ unsigned char *swf_tag_lossless_get_png_data(void *detail,
                                 swf_tag_lossless->height,
                                 index_data,
                                 swf_tag_lossless->colormap_count,
-                                tag->tag, swf_tag_lossless->format,
+                                tag->code, swf_tag_lossless->format,
                                 length);
     return data;
 }
@@ -484,7 +484,7 @@ swf_tag_lossless_replace_png_data(void *detail, int image_id,
         fprintf(stderr, "swf_tag_lossess_replace_png_data: pngconv_png2lossless failed at line(%d)\n", __LINE__);
         return 1;
     }
-    tag->tag = tag_no;
+    tag->code = tag_no;
     swf_tag_lossless->format = format;
     swf_tag_lossless->width  = width;
     swf_tag_lossless->height = height;
@@ -567,7 +567,7 @@ swf_tag_lossless_replace_gif_data(void *detail, int image_id,
         fprintf(stderr, "swf_tag_lossless_replace_gif_data: gifconv_gif2lossless failed at line(%d)\n", __LINE__);
         return 1;
     }
-    tag->tag = tag_no;
+    tag->code = tag_no;
     swf_tag_lossless->format = format;
     swf_tag_lossless->width  = width;
     swf_tag_lossless->height = height;
index 35007f1..03da8d5 100644 (file)
@@ -51,7 +51,7 @@ swf_tag_place_input_detail(swf_tag_t *tag, struct swf_object_ *swf) {
     bs = bitstream_open();
     bitstream_input(bs, data, length);
 
-    if (tag->tag == 4) { // PlaceObject
+    if (tag->code == 4) { // PlaceObject
         swf_tag_place->character_id = bitstream_getbytesLE(bs, 2);
         swf_tag_place->depth = bitstream_getbytesLE(bs, 2);
         ret = swf_matrix_parse(bs, &(swf_tag_place->matrix));
@@ -66,7 +66,7 @@ swf_tag_place_input_detail(swf_tag_t *tag, struct swf_object_ *swf) {
             bitstream_close(bs);
             return ret;
         }
-    } else if (tag->tag == 26) { // PlaceObject2
+    } else if (tag->code == 26) { // PlaceObject2
         swf_tag_place->flag_has_clip_action = bitstream_getbit(bs);
         swf_tag_place->flag_has_clip_depth = bitstream_getbit(bs);
         swf_tag_place->flag_has_name = bitstream_getbit(bs);
@@ -128,7 +128,7 @@ swf_tag_place_output_detail(swf_tag_t *tag, unsigned long *length,
 
     bs = bitstream_open();
 
-    if (tag->tag == 4) { // PlaceObject
+    if (tag->code == 4) { // PlaceObject
         bitstream_putbytesLE(bs, swf_tag_place->character_id, 2);
         bitstream_putbytesLE(bs, swf_tag_place->depth, 2);
         ret = swf_matrix_build(bs, &(swf_tag_place->matrix));
@@ -143,7 +143,7 @@ swf_tag_place_output_detail(swf_tag_t *tag, unsigned long *length,
             bitstream_close(bs);
             return NULL;
         }
-    } else if (tag->tag == 26) { // PlaceObject2
+    } else if (tag->code == 26) { // PlaceObject2
         bitstream_putbit(bs, swf_tag_place->flag_has_clip_action);
         bitstream_putbit(bs, swf_tag_place->flag_has_clip_depth);
         bitstream_putbit(bs, swf_tag_place->flag_has_name);
@@ -199,12 +199,12 @@ swf_tag_place_print_detail(swf_tag_t *tag,
     swf_tag_place_detail_t *swf_tag_place = (swf_tag_place_detail_t *) tag->detail;
     (void) swf;
     print_indent(indent_depth);
-    if (tag->tag == 4) { // PlaceObject
+    if (tag->code == 4) { // PlaceObject
         printf("character_id=%d  depth=%d\n",
                swf_tag_place->character_id, swf_tag_place->depth);
         swf_matrix_print(&(swf_tag_place->matrix), indent_depth);
         swf_cxform_print(&(swf_tag_place->color_transform), indent_depth);
-    } else if (tag->tag == 26) { // PlaceObject2
+    } else if (tag->code == 26) { // PlaceObject2
         printf("(clipact,clipdepth,name,ratio,coltrans,mat,cid,move)=(%d,%d,%d,%d,%d,%d,%d,%d)\n",
                swf_tag_place->flag_has_clip_action,
                swf_tag_place->flag_has_clip_depth,
@@ -237,7 +237,7 @@ swf_tag_place_print_detail(swf_tag_t *tag,
             printf("ratio=%d\n", swf_tag_place->clip_depth);
         }
     } else {
-        fprintf(stderr, "Illegal tag no(%d)\n", tag->tag);
+        fprintf(stderr, "Illegal tag no(%d)\n", tag->code);
     }
     return ;
 }
@@ -258,8 +258,8 @@ swf_tag_place_destroy_detail(swf_tag_t *tag) {
 int
 swf_tag_place_get_cid_by_instance_name(swf_tag_t *tag, unsigned char *instance_name, int instance_name_len, struct swf_object_ *swf) {
     swf_tag_place_detail_t *swf_tag_place;
-    if (! isPlaceTag(tag->tag)) {
-        fprintf(stderr, "swf_tag_place_get_cid_by_instance_name: ! isPlaceTag(%d)\n", tag->tag);
+    if (! isPlaceTag(tag->code)) {
+        fprintf(stderr, "swf_tag_place_get_cid_by_instance_name: ! isPlaceTag(%d)\n", tag->code);
         return -1; // wrong tag
     }
     swf_tag_place = (swf_tag_place_detail_t *) swf_tag_create_input_detail(tag, swf);
index 723d6ac..2f6fb70 100644 (file)
@@ -77,9 +77,9 @@ swf_tag_shape_input_detail(swf_tag_t *tag, struct swf_object_ *swf) {
     }
 
     // DefineMorphShape, DefineMorphShape2
-    swf_tag_shape->is_morph = (tag->tag == 46) || (tag->tag == 84);
+    swf_tag_shape->is_morph = (tag->code == 46) || (tag->code == 84);
     // DefineShape4, DefineMorphShape2
-    swf_tag_shape->has_strokes = (tag->tag == 83) || (tag->tag == 84);
+    swf_tag_shape->has_strokes = (tag->code == 83) || (tag->code == 84);
 
     if (swf_tag_shape->is_morph) {
         ret = swf_rect_parse(bs, &(swf_tag_shape->rect_morph));
@@ -161,9 +161,9 @@ swf_tag_shape_bitmap_get_refcid_list(swf_tag_t *tag, int *cid_list_num) {
         fprintf(stderr, "swf_tag_shape_bitmap_get_refcid: tag == NULL\n");
         return NULL;
     }
-    if (! isShapeTag(tag->tag)) {
+    if (! isShapeTag(tag->code)) {
         fprintf(stderr, "swf_tag_shape_bitmap_get_refcid: ! isShapeTag(%d)\n",
-                tag->tag);
+                tag->code);
         return NULL;
     }
     if (tag->detail == NULL) {
@@ -246,9 +246,9 @@ int swf_tag_shape_bitmap_replace_refcid_list(swf_tag_t *tag, int from_cid, int t
         fprintf(stderr, "swf_tag_shape_bitmap_replace_refcid: tag == NULL\n");
         return 1;
     }
-    if (! isShapeTag(tag->tag)) {
+    if (! isShapeTag(tag->code)) {
         fprintf(stderr, "swf_tag_shape_bitmap_replace_refcid: ! isShapeTag(%d)\n",
-                tag->tag);
+                tag->code);
         return 1;
     }
     if (tag->detail == NULL) {
@@ -334,9 +334,9 @@ swf_tag_shape_output_detail(swf_tag_t *tag, unsigned long *length,
     swf_rect_build(bs, &(swf_tag_shape->rect));
 
     // DefineMorphShape, DefineMorphShape2
-    swf_tag_shape->is_morph = (tag->tag == 46) || (tag->tag == 84);
+    swf_tag_shape->is_morph = (tag->code == 46) || (tag->code == 84);
     // DefineShape4, DefineMorphShape2
-    swf_tag_shape->has_strokes = (tag->tag == 83) || (tag->tag == 84);
+    swf_tag_shape->has_strokes = (tag->code == 83) || (tag->code == 84);
 
     if (swf_tag_shape->is_morph) {
         ret = swf_rect_build(bs, &(swf_tag_shape->rect_morph));
index 9a4b64d..2cbd62d 100644 (file)
@@ -139,7 +139,7 @@ swf_tag_sprite_print_detail(swf_tag_t *tag,
         print_indent(indent_depth);
         printf("  [%d] ", i);
         swf_tag_print(_tag, swf, indent_depth + 1);
-        if (_tag->tag == 0) { // END Tag
+        if (_tag->code == 0) { // END Tag
             break;
         }
         _tag = _tag->next;
index 6416aff..88f9362 100644 (file)
@@ -19,7 +19,7 @@ foreach ($obj->getTagList() as $seqno => $tagInfo) {
 --EXPECTF--
 seqno=3
 array (
-  'tag' => 6,
+  'code' => 6,
   'tagName' => 'DefineBitsJPEG',
   'length' => 2133,
   'detail' => true,
index a9ada1a..fb56f46 100644 (file)
@@ -19,7 +19,7 @@ foreach ($obj->getTagList() as $seqno => $tagInfo) {
 --EXPECTF--
 seqno=4
 array (
-  'tag' => 2,
+  'code' => 2,
   'tagName' => 'DefineShape',
   'length' => 51,
   'detail' => true,