cvs: pear /PECL/bcompiler bcompiler.c

From: Date: Tue, 04 Feb 2003 12:52:11 +0000
Subject: cvs: pear /PECL/bcompiler bcompiler.c
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-8714@lists.php.net to get a copy of this message
xnoguer Tue Feb 4 07:52:11 2003 EDT Modified files: /pear/PECL/bcompiler bcompiler.c Log: patch for requiring/including non-bziped files and fix for reading non-bcompiler files Index: pear/PECL/bcompiler/bcompiler.c diff -u pear/PECL/bcompiler/bcompiler.c:1.26 pear/PECL/bcompiler/bcompiler.c:1.27 --- pear/PECL/bcompiler/bcompiler.c:1.26 Wed Jan 29 12:36:58 2003 +++ pear/PECL/bcompiler/bcompiler.c Tue Feb 4 07:52:11 2003 @@ -19,7 +19,7 @@ | Mike Bretz <mike@metropolis-ag.de> | +----------------------------------------------------------------------+ */ -/* $Id: bcompiler.c,v 1.26 2003/01/29 17:36:58 alan_k Exp $ */ +/* $Id: bcompiler.c,v 1.27 2003/02/04 12:52:11 xnoguer Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -245,6 +245,9 @@ if(is_bz2_file_handle(fp)) { stream = bz2_stream_open(filename); } + else { + stream = php_stream_open_wrapper(filename, "r", REPORT_ERRORS, NULL); + } fclose(fp); } break; @@ -263,6 +266,9 @@ if(is_bz2_file_handle(fp)) { stream = bz2_stream_open(filename); } + else { + stream = php_stream_open_wrapper(filename, "r", REPORT_ERRORS, NULL); + } fclose(fp); } break; @@ -281,7 +287,7 @@ if(stream) { BCOMPILERG(stream) = stream; - test = apc_deserialize_magic(TSRMLS_C); + test = deserialize_magic(TSRMLS_C); } if (test == 0) { @@ -974,7 +980,7 @@ BCOMPILERG(stream) = stream; - test = apc_deserialize_magic(TSRMLS_C); + test = deserialize_magic(TSRMLS_C); if (test != 0) { php_error(E_WARNING, "Could not find Magic header in stream"); @@ -1047,7 +1053,7 @@ BCOMPILERG(stream) = stream; - test = apc_deserialize_magic(TSRMLS_C); + test = deserialize_magic(TSRMLS_C); if (test != 0) { php_error(E_WARNING, "Could not find Magic header in stream"); @@ -1135,7 +1141,7 @@ #endif - test = apc_deserialize_magic(TSRMLS_C); + test = deserialize_magic(TSRMLS_C); if (test != 0) { php_error(E_WARNING, "Could not find Magic header in stream"); @@ -1189,7 +1195,7 @@ BCOMPILERG(stream) = stream; - test = apc_deserialize_magic(TSRMLS_C); + test = deserialize_magic(TSRMLS_C); if (test != 0) { php_error(E_WARNING, "Could not find Magic header in stream"); @@ -1695,7 +1701,7 @@ apc_serialize_string(BCOMPILER_MAGIC_HEADER TSRMLS_CC); } -int apc_deserialize_magic(TSRMLS_D) +/*int apc_deserialize_magic(TSRMLS_D) { char *tmp; int retval; @@ -1705,6 +1711,33 @@ retval = strcmp(tmp,BCOMPILER_MAGIC_HEADER); apclib_free_string(&tmp); // MPB return retval; +}*/ + +/* A replacement for apc_deserialize_magic() */ +int deserialize_magic(TSRMLS_D) +{ + char *tmp; + int retval; + int len = 0; + + DESERIALIZE_SCALAR(&len, int); + if (len <= 0) + { + return -1; + } + /* If it doesn't have the length of the string we expect, it's not the string we expect */ + if (len != strlen(BCOMPILER_MAGIC_HEADER)) + { + return -1; + } + + tmp = (char *) emalloc(len + 1); + LOAD_BYTES(tmp, len); + tmp[len] = '\0'; + BCOMPILER_DEBUG(("got %s\n", tmp)); + retval = strcmp(tmp,BCOMPILER_MAGIC_HEADER); + + return retval; } /* type: zend_llist */

« previous php.pear.cvs (#8714) next »