--- a/trunk/php-java-bridge/java.c +++ b/trunk/php-java-bridge/java.c @@ -6,6 +6,41 @@ * It contains the global structures and the callbacks required for * zend engine 1 and 2. * + Copyright (C) 2006 Jost Boekemeier + + This file is part of the PHP/Java Bridge. + + The PHP/Java Bridge ("the library") is free software; you can + redistribute it and/or modify it under the terms of the GNU General + Public License as published by the Free Software Foundation; either + version 2, or (at your option) any later version. + + The library is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the PHP/Java Bridge; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. + + Linking this file statically or dynamically with other modules is + making a combined work based on this library. Thus, the terms and + conditions of the GNU General Public License cover the whole + combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent + modules, and to copy and distribute the resulting executable under + terms of your choice, provided that you also meet, for each linked + independent module, the terms and conditions of the license of that + module. An independent module is a module which is not derived from + or based on this library. If you modify this library, you may extend + this exception to your version of the library, but you are not + obligated to do so. If you do not wish to do so, delete this + exception statement from your version. */ #include "php_java.h" @@ -296,6 +331,7 @@ API_CALL(reset); } +static int do_cast(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC); /** * Proto: object java_cast(object, string). * @@ -328,13 +364,12 @@ */ EXT_FUNCTION(EXT_GLOBAL(cast)) { - static int do_cast(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_DC); proxyenv *jenv; zval **object=0, **type=0; - int argc=ZEND_NUM_ARGS(); + int tval, argc=ZEND_NUM_ARGS(); char *s; if (argc!=2 || zend_get_parameters_ex(argc, &object, &type) == FAILURE) - WRONG_PARAM_COUNT_WITH_RETVAL(0); + WRONG_PARAM_COUNT; convert_to_string_ex(type); s = Z_STRVAL_PP(type); switch(*s) { @@ -346,7 +381,7 @@ case 'N': case 'n': tval = IS_NULL; break; case 'O': case 'o': tval = IS_OBJECT; break; } - do_cast(*object, *return_value, tval, 0 TSRMLS_CC); + do_cast(*object, return_value, tval, 0 TSRMLS_CC); } /** @@ -1325,7 +1360,7 @@ case IS_OBJECT: *writeobj = *readobj; zval_copy_ctor(writeobj); - convert_to_object_ex(writeobj); + convert_to_object(writeobj); break; case IS_ARRAY: #ifdef ZEND_ENGINE_2