svnno****@sourc*****
svnno****@sourc*****
2011年 3月 17日 (木) 14:53:31 JST
Revision: 432 http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=432 Author: yoya Date: 2011-03-17 14:53:31 +0900 (Thu, 17 Mar 2011) Log Message: ----------- 稀に compress で元サイズより増える事があるので、その対応 Modified Paths: -------------- trunk/src/swf_object.c trunk/src/swf_tag_jpeg.c trunk/src/swf_tag_lossless.c -------------- next part -------------- Modified: trunk/src/swf_object.c =================================================================== --- trunk/src/swf_object.c 2011-03-17 03:28:16 UTC (rev 431) +++ trunk/src/swf_object.c 2011-03-17 05:53:31 UTC (rev 432) @@ -163,7 +163,7 @@ bitstream_setpos(bs, SWF_HEADER_SIZE, 0); old_buff_ref = bitstream_buffer(bs, SWF_HEADER_SIZE); old_size = bs->data_len - SWF_HEADER_SIZE; - compsize = old_size; + compsize = old_size * 1.001 + 12; // 稀に増える事もあるので new_buff = malloc(compsize); result = compress(new_buff, &compsize, old_buff_ref, old_size); if (result != Z_OK) { Modified: trunk/src/swf_tag_jpeg.c =================================================================== --- trunk/src/swf_tag_jpeg.c 2011-03-17 03:28:16 UTC (rev 431) +++ trunk/src/swf_tag_jpeg.c 2011-03-17 05:53:31 UTC (rev 432) @@ -304,8 +304,8 @@ bitstream_putstring(bs, swf_tag_jpeg->jpeg_data, swf_tag_jpeg->jpeg_data_len); offset_to_alpha = swf_tag_jpeg->jpeg_data_len; old_size = swf_tag_jpeg->alpha_data_len; - compsize = old_size; - new_buff = malloc(compsize); // too enough memory + compsize = old_size * 1.001 + 12; // 稀に増える事もあるので + new_buff = malloc(compsize); result = compress(new_buff, &compsize, swf_tag_jpeg->alpha_data, old_size); if (result != Z_OK) { if (result == Z_MEM_ERROR) { Modified: trunk/src/swf_tag_lossless.c =================================================================== --- trunk/src/swf_tag_lossless.c 2011-03-17 03:28:16 UTC (rev 431) +++ trunk/src/swf_tag_lossless.c 2011-03-17 05:53:31 UTC (rev 432) @@ -266,7 +266,7 @@ indices_len); old_buff_ref = bitstream_buffer(bs2, 0); old_size = bitstream_length(bs2); - compsize = old_size; + compsize = old_size * 1.001 + 12; // 稀に増える事もあるので tmp_buff = malloc(compsize); result = compress(tmp_buff, &compsize, old_buff_ref, old_size); if (result != Z_OK) { @@ -303,7 +303,7 @@ } old_buff_ref = bitstream_buffer(bs2, 0); old_size = bitstream_length(bs2); - compsize = old_size; + compsize = old_size * 1.001 + 12; // 稀に増える事もあるので tmp_buff = malloc(compsize); result = compress(tmp_buff, &compsize, old_buff_ref, old_size); if (result != Z_OK) {