OSDN Git Service

shape tag の時だけ apply_shape を呼ぶよう修正 (tag 種不一致で segfault してた)
authoryoya <yoya@7c90b180-03d5-4157-b861-58a559ae9d1e>
Wed, 27 Oct 2010 14:52:33 +0000 (14:52 +0000)
committeryoya <yoya@7c90b180-03d5-4157-b861-58a559ae9d1e>
Wed, 27 Oct 2010 14:52:33 +0000 (14:52 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/swfed/trunk@306 7c90b180-03d5-4157-b861-58a559ae9d1e

src/swf_object.c

index c0c6bd5..70e148d 100644 (file)
@@ -344,28 +344,22 @@ swf_object_replace_jpegdata(swf_object_t *swf, int image_id,
         width_scale  = (double) old_width  / new_width;
         height_scale = (double) old_height / new_height;
         for (; tag ; tag=tag->next) {
-            swf_tag_shape_detail_t *swf_tag_shape;
-            if (swf_tag_shape_bitmap_identity(tag, image_id) == 0) {
-                fprintf(stderr, "swf_object_replace_jpegdata: tag->detail == NULL\n");
-                return 1;
+            if (isShapeTag(tag->tag) && (swf_tag_shape_bitmap_identity(tag, image_id) == 0)) {
+                swf_tag_shape_detail_t *swf_tag_shape;
+                swf_tag_shape = tag->detail;
+                swf_object_apply_shapematrix_factor(swf,
+                                                    swf_tag_shape->shape_id,
+                                                    width_scale, height_scale,
+                                                    0, 0, 0);
             }
-            swf_tag_shape = tag->detail;
-            swf_object_apply_shapematrix_factor(swf,
-                                                swf_tag_shape->shape_id,
-                                                width_scale, height_scale,
-                                                0, 0, 0);
         }
         break;
       case SWFED_SHAPE_BITMAP_RECT_RESIZE:
         width_scale  = (double) new_width  / old_width;
         height_scale = (double) new_height / old_height;
         for (; tag ; tag=tag->next) {
-            if (swf_tag_shape_bitmap_identity(tag, image_id) == 0) {
+            if (isShapeTag(tag->tag) && (swf_tag_shape_bitmap_identity(tag, image_id) == 0)) {
                 swf_tag_shape_detail_t *swf_tag_shape;                
-                if (tag->detail == NULL) {
-                    fprintf(stderr, "swf_object_replace_jpegdata: tag->detail == NULL\n");
-                    return 1;
-                }
                 swf_tag_shape = tag->detail;
                 swf_object_apply_shaperect_factor(swf, swf_tag_shape->shape_id,
                                                   width_scale, height_scale,