svnno****@sourc*****
svnno****@sourc*****
2009年 2月 11日 (水) 21:55:59 JST
Revision: 114 http://svn.sourceforge.jp/view?root=swfed&view=rev&rev=114 Author: yoya Date: 2009-02-11 21:55:59 +0900 (Wed, 11 Feb 2009) Log Message: ----------- - input のエラーチェックを追加 - replace 系でエラーチェックの抜けがあったので修正 - 4 tab に揃えた(つもり) Modified Paths: -------------- trunk/sample/swfcompress.phps trunk/sample/swfdump.phps trunk/sample/swfgeteditstring.phps trunk/sample/swfgetjpegalphadata.phps trunk/sample/swfgetjpegdata.phps trunk/sample/swfgetpngdata.phps trunk/sample/swfgetsounddata.phps trunk/sample/swfreplaceeditstring.phps trunk/sample/swfreplacegifdata.phps trunk/sample/swfreplacejpegdata.phps trunk/sample/swfreplacemlddata.phps trunk/sample/swfreplacepngdata.phps -------------- next part -------------- Modified: trunk/sample/swfcompress.phps =================================================================== --- trunk/sample/swfcompress.phps 2009-02-11 12:32:46 UTC (rev 113) +++ trunk/sample/swfcompress.phps 2009-02-11 12:55:59 UTC (rev 114) @@ -3,24 +3,28 @@ $compress = true; switch($argc) { - case 2: - $swf_filename = $argv[1]; - break; - case 3: - if ($argv[1] == '-u') { - $compress = false; - $swf_filename = $argv[2]; - break; - } - default: - fprintf(STDERR, "Usage: php swfcompress.phps [-u] <swf_file>\n"); - exit(1); + case 2: + $swf_filename = $argv[1]; + break; + case 3: + if ($argv[1] == '-u') { + $compress = false; + $swf_filename = $argv[2]; + break; + } + default: + fprintf(STDERR, "Usage: php swfcompress.phps [-u] <swf_file>\n"); + exit(1); } $swf_data = file_get_contents($swf_filename); $swf = new SWFEditor(); -$swf->input($swf_data); +if ($swf->input($swf_data) == false) { + fprintf(STDERR, "input failed\n"); + exit(1); +} + $info = array('compress' => $compress); $swf->setHeaderInfo($info); Modified: trunk/sample/swfdump.phps =================================================================== --- trunk/sample/swfdump.phps 2009-02-11 12:32:46 UTC (rev 113) +++ trunk/sample/swfdump.phps 2009-02-11 12:55:59 UTC (rev 114) @@ -9,5 +9,9 @@ $swfdata = file_get_contents($swf_filename); $obj = new SWFEditor(); -$obj->input($swfdata); +if ($obj->input($swfdata) == false) { + fprintf(STDERR, "input failed\n"); + exit(1); +} + $obj->swfInfo(); Modified: trunk/sample/swfgeteditstring.phps =================================================================== --- trunk/sample/swfgeteditstring.phps 2009-02-11 12:32:46 UTC (rev 113) +++ trunk/sample/swfgeteditstring.phps 2009-02-11 12:55:59 UTC (rev 114) @@ -10,6 +10,9 @@ $swfdata = file_get_contents($swf_filename); $obj = new SWFEditor(); -$obj->input($swfdata); +if ($obj->input($swfdata) == false) { + fprintf(STDERR, "input failed\n"); + exit(1); +} echo $obj->getEditString($var_name) . "\n"; Modified: trunk/sample/swfgetjpegalphadata.phps =================================================================== --- trunk/sample/swfgetjpegalphadata.phps 2009-02-11 12:32:46 UTC (rev 113) +++ trunk/sample/swfgetjpegalphadata.phps 2009-02-11 12:55:59 UTC (rev 114) @@ -7,6 +7,10 @@ $swf_filename = $argv[1]; $image_id = $argv[2]; $swfdata = file_get_contents($swf_filename); + $obj = new SWFEditor(); -$obj->input($swfdata); +if ($obj->input($swfdata) == false) { + fprintf(STDERR, "input failed\n"); + exit(1); +} echo $obj->getJpegAlpha($image_id); Modified: trunk/sample/swfgetjpegdata.phps =================================================================== --- trunk/sample/swfgetjpegdata.phps 2009-02-11 12:32:46 UTC (rev 113) +++ trunk/sample/swfgetjpegdata.phps 2009-02-11 12:55:59 UTC (rev 114) @@ -10,6 +10,9 @@ $swfdata = file_get_contents($swf_filename); $obj = new SWFEditor(); -$obj->input($swfdata); +if ($obj->input($swfdata) == false) { + fprintf(STDERR, "input failed\n"); + exit(1); +} echo $obj->getJpegData($image_id); Modified: trunk/sample/swfgetpngdata.phps =================================================================== --- trunk/sample/swfgetpngdata.phps 2009-02-11 12:32:46 UTC (rev 113) +++ trunk/sample/swfgetpngdata.phps 2009-02-11 12:55:59 UTC (rev 114) @@ -10,6 +10,9 @@ $swfdata = file_get_contents($swf_filename); $obj = new SWFEditor(); -$obj->input($swfdata); +if ($obj->input($swfdata) == false) { + fprintf(STDERR, "input failed\n"); + exit(1); +} echo $obj->getPNGData($image_id); Modified: trunk/sample/swfgetsounddata.phps =================================================================== --- trunk/sample/swfgetsounddata.phps 2009-02-11 12:32:46 UTC (rev 113) +++ trunk/sample/swfgetsounddata.phps 2009-02-11 12:55:59 UTC (rev 114) @@ -10,6 +10,9 @@ $swfdata = file_get_contents($swf_filename); $obj = new SWFEditor(); -$obj->input($swfdata); +if ($obj->input($swfdata) == false) { + fprintf(STDERR, "input failed\n"); + exit(1); +} echo $obj->getSoundData($sound_id); Modified: trunk/sample/swfreplaceeditstring.phps =================================================================== --- trunk/sample/swfreplaceeditstring.phps 2009-02-11 12:32:46 UTC (rev 113) +++ trunk/sample/swfreplaceeditstring.phps 2009-02-11 12:55:59 UTC (rev 114) @@ -1,8 +1,8 @@ <?php if ($argc < 4) { - fprintf(STDERR, "Usage: swfreplaceeditstring <swf_file> <variable_name> <initial_text>\n"); - exit(1); + fprintf(STDERR, "Usage: swfreplaceeditstring <swf_file> <variable_name> <initial_text>\n"); + exit(1); } $swf_filename = $argv[1]; @@ -12,13 +12,12 @@ $obj = new SWFEditor(); if ($obj->input($swfdata) == false) { - fprintf(STDERR, "input failed\n"); - exit (1); + fprintf(STDERR, "input failed\n"); + exit(1); } if ($obj->replaceEditString($variable_name, $initial_text) == false) { - fprintf(STDERR, "replaceEditString($variable_name, ...) failed\n"); - exit (1); - + fprintf(STDERR, "replaceEditString($variable_name, ...) failed\n"); + exit(1); } echo $obj->output(); Modified: trunk/sample/swfreplacegifdata.phps =================================================================== --- trunk/sample/swfreplacegifdata.phps 2009-02-11 12:32:46 UTC (rev 113) +++ trunk/sample/swfreplacegifdata.phps 2009-02-11 12:55:59 UTC (rev 114) @@ -1,8 +1,8 @@ <?php if (($argc < 4) || ($argc%2 != 0)) { - fprintf(STDERR, "Usage: swfreplacegifdata <swf_file> <image_id> <gif_file> [<image_id2> <gif_file2> [...]]\n"); - exit(1); + fprintf(STDERR, "Usage: swfreplacegifdata <swf_file> <image_id> <gif_file> [<image_id2> <gif_file2> [...]]\n"); + exit(1); } $swf_filename = $argv[1]; @@ -10,18 +10,18 @@ $swfdata = file_get_contents($swf_filename); $obj = new SWFEditor(); if ($obj->input($swfdata) == false) { - fprintf(STDERR, "input failed\n"); - exit (1); + fprintf(STDERR, "input failed\n"); + exit(1); } for ($i=2 ; $i < $argc ; $i+=2) { - $image_id = $argv[$i]; - $gif_filename = $argv[$i+1]; - $gifdata = file_get_contents($gif_filename); - if ($obj->replaceGIFData($image_id, $gifdata) == false) { - fprintf(STDERR, "replaceGIFdata($image_id, ...) failed\n"); - exit (1); - } + $image_id = $argv[$i]; + $gif_filename = $argv[$i+1]; + $gifdata = file_get_contents($gif_filename); + if ($obj->replaceGIFData($image_id, $gifdata) == false) { + fprintf(STDERR, "replaceGIFdata($image_id, ...) failed\n"); + exit(1); + } } echo $obj->output(); Modified: trunk/sample/swfreplacejpegdata.phps =================================================================== --- trunk/sample/swfreplacejpegdata.phps 2009-02-11 12:32:46 UTC (rev 113) +++ trunk/sample/swfreplacejpegdata.phps 2009-02-11 12:55:59 UTC (rev 114) @@ -23,8 +23,8 @@ $obj = new SWFEditor(); if ($obj->input($swfdata) == false) { - fprintf(STDERR, "input failed\n"); - exit (1); + fprintf(STDERR, "input failed\n"); + exit(1); } if (empty($alphadata)) { @@ -34,8 +34,8 @@ } if ($result == false) { - fprintf(STDERR, "replaceJpegdata($image_id, ...) failed\n"); - exit (1); + fprintf(STDERR, "replaceJpegdata($image_id, ...) failed\n"); + exit(1); } echo $obj->output(); Modified: trunk/sample/swfreplacemlddata.phps =================================================================== --- trunk/sample/swfreplacemlddata.phps 2009-02-11 12:32:46 UTC (rev 113) +++ trunk/sample/swfreplacemlddata.phps 2009-02-11 12:55:59 UTC (rev 114) @@ -9,13 +9,19 @@ $swfdata = file_get_contents($swf_filename); $obj = new SWFEditor(); -$obj->input($swfdata); +if ($obj->input($swfdata) == false) { + fprintf(STDERR, "input failed\n"); + exit(1); +} for ($i=2 ; $i < $argc ; $i+=2) { - $sound_id = $argv[$i]; - $mld_filename = $argv[$i+1]; - $mlddata = file_get_contents($mld_filename); - $obj->replaceMLDData($sound_id, $mlddata); + $sound_id = $argv[$i]; + $mld_filename = $argv[$i+1]; + $mlddata = file_get_contents($mld_filename); + if ($obj->replaceMLDData($sound_id, $mlddata) == false) { + fprintf(STDERR, "replaceMLDdata($sound_id, ...) failed\n"); + exit(1); + } } echo $obj->output(); Modified: trunk/sample/swfreplacepngdata.phps =================================================================== --- trunk/sample/swfreplacepngdata.phps 2009-02-11 12:32:46 UTC (rev 113) +++ trunk/sample/swfreplacepngdata.phps 2009-02-11 12:55:59 UTC (rev 114) @@ -11,7 +11,7 @@ $obj = new SWFEditor(); if ($obj->input($swfdata) == false) { fprintf(STDERR, "input failed\n"); - exit (1); + exit(1); } for ($i=2 ; $i < $argc ; $i+=2) { @@ -20,7 +20,7 @@ $pngdata = file_get_contents($png_filename); if ($obj->replacePNGData($image_id, $pngdata) == false) { fprintf(STDERR, "replacePNGdata($image_id, ...) failed\n"); - exit (1); + exit(1); } }