These pages are written by only Japanese.
|
Namazu for hns による簡易全文検索です。 詳細は 詳細指定/ヘルプをご参照下さい。 |
|||||||||||||||||||||||||||||||||||||||||||||||
PHP Warning: gzuncompress(): buffer error in /home/yoya/prog/flash/FlashSWF.php on line 42google で探しても解決した例が見つからないので、php のソースを読んでみた。
% pwd /home/yoya/src/php-5.2.5 % grep "buffer error" * */* */*/* %
% grep "buffer error" *.c zutil.c:"buffer error", /* Z_BUF_ERROR (-5) */
const char * const z_errmsg[10] = { "need dictionary", /* Z_NEED_DICT 2 */ "stream end", /* Z_STREAM_END 1 */ "", /* Z_OK 0 */ "file error", /* Z_ERRNO (-1) */ "stream error", /* Z_STREAM_ERROR (-2) */ "data error", /* Z_DATA_ERROR (-3) */ "insufficient memory", /* Z_MEM_ERROR (-4) */ "buffer error", /* Z_BUF_ERROR (-5) */ "incompatible version",/* Z_VERSION_ERROR (-6) */ ""}; #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. <略> if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; err = deflate(&stream, Z_FINISH); if (err != Z_STREAM_END) { deflateEnd(&stream); return err == Z_OK ? Z_BUF_ERROR : err;
* chara.swf addr : 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF 0x00000: 4357 5306 0048 2c00 789c 9cb9 6b5c 5259 CWS H, x k\RY ~~~~~~~~確かに駄目だ
* output.swf addr : 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF 0x00000: 4357 5306 a86f 2800 789c 9cb9 6b5c 5259 CWS o( x k\RY ~~~~~~~~
if ($magic == 'CWS') { movie_and_body = gzcompress($movie_and_body, 6); } <略> $this->_header['filelength'] = strlen($header_without_length) + 4 + strlen($movie_and_body);えーっと… ファイル長フィールドには 伸張した時のファイルサイズを入れないと駄目なのに、 圧縮後のファイルサイズを入れてました…
$this->_header['filelength'] = strlen($header_without_length) + 4 + strlen($movie_and_body); <略> if ($magic == 'CWS') { movie_and_body = gzcompress($movie_and_body, 6); }こうしないと。
cvs -z3 -d:pserver:anonymous@ming.cvs.sourceforge.net:/cvsroot/ming co -P ming↑こちらを参考にインストール。
$ wget http://auicon.freeownhost.com/pc/dev/ming/jpeg.c.diff $ patch -b jpeg.c jpeg.c.diff patching file jpeg.c Hunk #1 succeeded at 129 (offset 6 lines). Hunk #3 succeeded at 310 (offset 11 lines).ちなみに -b は backup オプション。
% ./autogen.sh Running aclocal -I macros Running libtoolize --automake ./autogen.sh: line 15: libtoolize: command not found Something went wrong, bailing out!むー。libtool 入ってなかったか…
yum install libtool
./configure <略> Config summary: C++ enabled Perl extension disabled PHP extension disabled Python extension disabled Tcl extension disabled ZLIB enabled (-lz) Freetype library enabled (/usr/bin/freetype-config) GIF library disabled PNG library enabled (-lpng)色々負けてる…
# yum install giflib-devel # exit % ./configure --enable-perl --enable-php <略> Config summary: C++ enabled Perl extension enabled PHP extension enabled Python extension disabled Tcl extension disabled ZLIB enabled (-lz) Freetype library enabled (/usr/bin/freetype-config) GIF library enabled (-lungif) PNG library enabled (-lpng)よし…
% make <略> % su Password: # make install <略>
mkdir <phpdir>/ext/ming cp php_ext/* <phpdir>/ext/ming cd <phpdir> ./buildconf ./configure --with-ming <other config options>なんだけど、php を yum で入れてるのでどうしよう…
php -i | grep Configure Configure Command => './configure' '--build=i686-redhat-linux-gnu' <以下略> php -i | grep Configure > ../php-config-option.txt vi ../php-config-option.txt sh ../php-config-option.txt <略>
checking for PCRE support... yes configure: error: Could not find pcre.h in /usr checking for BZip2 in default path... not found configure: error: Please reinstall the BZip2 distribution checking for db4 major version... configure: error: Header contains different version checking for GNU MP support... yes configure: error: Unable to locate gmp.h configure: error: Cannot find rfc822.h. Please check your c-client installation. configure: error: Cannot find ldap.h configure: error: Cannot find MySQL header files under /usr. Note that the MySQL client library is not bundled anymore! checking for ncurses support... yes, shared checking for unixODBC support... configure: error: ODBC header file '/usr/include/sqlext.h' not found! not found configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path checking for sqlite3 files in default path... not found configure: error: Please reinstall the sqlite3 distribution checking for PSPELL support... yes configure: error: Cannot find pspell configure: error: SNMP sanity check failed. Please check config.log for more information.必要に応じて -devel パッケージをインストール
# yum install pcre-devel # yum install bzip2-devel # yum install db4-devel # yum install gmp-devel # yum install libc-client-devel # yum install openldap-devel # yum install mysql-devel # yum install ncurses-devel # yum install unixODBC-devel # yum install postgresql-devel # yum install sqlite-devel # yum install aspell-devel # yum install net-snmp-devel
% sh ../php-config-option.txt makeming は php に入ってるのでそのまま。
/home/yoya/src/php-5.1.6/ext/ming/ming.c:2104: error: too many arguments to function 'newSWFMovie' /home/yoya/src/php-5.1.6/ext/ming/ming.c:2106: error: too many arguments to function 'newSWFMovie'/usr/local/ に current の ming が入っているので微妙か…
% cd ext/ming/ ext/ming.orig % cp -r ~/src/flash/ming/php_ext/* ext/ming/. % sh ../php-config-option.txt % make <略> ext/ming/.libs/ming.o: In function `zif_ming_useSWFVersion': /home/yoya/src/php-5.1.6/ext/ming/ming.c:121: multiple definition of `zif_ming_useSWFVersion' ext/ming/.libs/ming.o:/home/yoya/src/php-5.1.6/ext/ming/ming.c:121: first defined here ext/ming/.libs/ming.o:(.data.rel+0x0): multiple definition of `ming_module_entry' ext/ming/.libs/ming.o:(.data.rel+0x0): first defined here collect2: ld returned 1 exit status駄目か…
sh ../php-config-option.txt (--with-ming を --enable-ming に変更) make <略> Build complete. (It is safe to ignore warnings about tempnam and tmpnam).やはり…
% cd ext/ming; % sh make_module.sh % mv ext/ming/tmp/modules/ming.so /usr/lib/php/modules/.
<?php dl('ming.so'); ming_useswfversion(4); $swf = new SWFMovie(); $swf->setDimension(640, 480); $swf->add(new SWFBitmap(fopen('/home/yoya/prog/flash/image1.jpg', 'rb'))); $swf->save('sample.swf'); ?>成功。
% cat > /etc/php.d/ming.ini ; Enable ming extension module extension=ming.so ^d