kalle Tue May 19 17:38:09 2009 UTC
Modified files:
/php-src/ext/com_dotnet com_handlers.c com_iterator.c com_persist.c
com_saproxy.c com_variant.c com_wrapper.c
Log:
Fix compiler warnings and refcount not being in sync with 5.3
http://cvs.php.net/viewvc.cgi/php-src/ext/com_dotnet/com_handlers.c?r1=1.49&r2=1.50&diff_format=u
Index: php-src/ext/com_dotnet/com_handlers.c
diff -u php-src/ext/com_dotnet/com_handlers.c:1.49
php-src/ext/com_dotnet/com_handlers.c:1.50
--- php-src/ext/com_dotnet/com_handlers.c:1.49 Tue Mar 10 23:39:11 2009
+++ php-src/ext/com_dotnet/com_handlers.c Tue May 19 17:38:08 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_handlers.c,v 1.49 2009/03/10 23:39:11 helly Exp $ */
+/* $Id: com_handlers.c,v 1.50 2009/05/19 17:38:08 kalle Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -259,7 +259,7 @@
INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
-static union _zend_function *com_method_get(zval **object_ptr, char *name, int
len TSRMLS_DC)
+static union _zend_function *com_method_get(zval **object_ptr, zstr name, int
len TSRMLS_DC)
{
zend_internal_function f, *fptr = NULL;
php_com_dotnet_object *obj;
@@ -273,18 +273,18 @@
return NULL;
}
- if (FAILED(php_com_get_id_of_name(obj, name, len, &dummy TSRMLS_CC))) {
+ if (FAILED(php_com_get_id_of_name(obj, name.s, len, &dummy TSRMLS_CC)))
{
return NULL;
}
/* check cache */
- if (obj->method_cache == NULL || FAILURE ==
zend_hash_find(obj->method_cache, name, len, (void**)&fptr)) {
+ if (obj->method_cache == NULL || FAILURE ==
zend_hash_find(obj->method_cache, name.s, len, (void**)&fptr)) {
f.type = ZEND_OVERLOADED_FUNCTION;
f.num_args = 0;
f.arg_info = NULL;
f.scope = obj->ce;
f.fn_flags = 0;
- f.function_name.s = estrndup(name, len);
+ f.function_name.s = estrndup(name.s, len);
f.handler = PHP_FN(com_method_handler);
fptr = &f;
@@ -300,7 +300,7 @@
int i;
if (SUCCEEDED(ITypeInfo_GetTypeComp(obj->typeinfo,
&comp))) {
- olename = php_com_string_to_olestring(name,
len, obj->code_page TSRMLS_CC);
+ olename = php_com_string_to_olestring(name.s,
len, obj->code_page TSRMLS_CC);
lhash = LHashValOfNameSys(SYS_WIN32,
LOCALE_SYSTEM_DEFAULT, olename);
if (SUCCEEDED(ITypeComp_Bind(comp, olename,
lhash, INVOKE_FUNC, &TI, &kind, &bindptr))) {
@@ -348,7 +348,7 @@
zend_hash_init(obj->method_cache, 2, NULL,
function_dtor, 0);
}
- zend_hash_update(obj->method_cache, name, len, &f,
sizeof(f), (void**)&fptr);
+ zend_hash_update(obj->method_cache, name.s, len, &f,
sizeof(f), (void**)&fptr);
}
}
@@ -364,7 +364,7 @@
return NULL;
}
-static int com_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
+static int com_call_method(zstr method, INTERNAL_FUNCTION_PARAMETERS)
{
zval ***args = NULL;
php_com_dotnet_object *obj;
@@ -387,7 +387,7 @@
VariantInit(&v);
- if (SUCCESS == php_com_do_invoke_byref(obj, method, -1,
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, nargs, args TSRMLS_CC)) {
+ if (SUCCESS == php_com_do_invoke_byref(obj, method.s, -1,
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, nargs, args TSRMLS_CC)) {
php_com_zval_from_variant(return_value, &v, obj->code_page
TSRMLS_CC);
ret = SUCCESS;
VariantClear(&v);
@@ -434,7 +434,7 @@
}
}
-static zend_class_entry *com_class_entry_get(zval *object TSRMLS_DC)
+static zend_class_entry *com_class_entry_get(const zval *object TSRMLS_DC)
{
php_com_dotnet_object *obj;
obj = CDNO_FETCH(object);
@@ -442,12 +442,12 @@
return obj->ce;
}
-static int com_class_name_get(zval *object, char **class_name, zend_uint
*class_name_len, int parent TSRMLS_DC)
+static int com_class_name_get(const zval *object, zstr *class_name, zend_uint
*class_name_len, int parent TSRMLS_DC)
{
php_com_dotnet_object *obj;
obj = CDNO_FETCH(object);
- *class_name = estrndup(obj->ce->name.s, obj->ce->name_length);
+ (*class_name).s = estrndup(obj->ce->name.s, obj->ce->name_length);
*class_name_len = obj->ce->name_length;
return 0;
@@ -491,7 +491,6 @@
php_com_dotnet_object *obj;
VARIANT v;
VARTYPE vt = VT_EMPTY;
- zval free_obj;
HRESULT res = S_OK;
obj = CDNO_FETCH(readobj);
http://cvs.php.net/viewvc.cgi/php-src/ext/com_dotnet/com_iterator.c?r1=1.15&r2=1.16&diff_format=u
Index: php-src/ext/com_dotnet/com_iterator.c
diff -u php-src/ext/com_dotnet/com_iterator.c:1.15
php-src/ext/com_dotnet/com_iterator.c:1.16
--- php-src/ext/com_dotnet/com_iterator.c:1.15 Tue Mar 10 23:39:11 2009
+++ php-src/ext/com_dotnet/com_iterator.c Tue May 19 17:38:08 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_iterator.c,v 1.15 2009/03/10 23:39:11 helly Exp $ */
+/* $Id: com_iterator.c,v 1.16 2009/05/19 17:38:08 kalle Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -74,8 +74,7 @@
*data = &I->zdata;
}
-static int com_iter_get_key(zend_object_iterator *iter, char **str_key, uint
*str_key_len,
- ulong *int_key TSRMLS_DC)
+static int com_iter_get_key(zend_object_iterator *iter, zstr *str_key, uint
*str_key_len, ulong *int_key TSRMLS_DC)
{
struct php_com_iterator *I = (struct php_com_iterator*)iter->data;
@@ -111,7 +110,7 @@
}
} else {
/* safe array */
- if (I->key >= I->sa_max) {
+ if (I->key >= (unsigned long) I->sa_max) {
I->key = (ulong)-1;
return FAILURE;
}
http://cvs.php.net/viewvc.cgi/php-src/ext/com_dotnet/com_persist.c?r1=1.16&r2=1.17&diff_format=u
Index: php-src/ext/com_dotnet/com_persist.c
diff -u php-src/ext/com_dotnet/com_persist.c:1.16
php-src/ext/com_dotnet/com_persist.c:1.17
--- php-src/ext/com_dotnet/com_persist.c:1.16 Tue Mar 10 23:39:11 2009
+++ php-src/ext/com_dotnet/com_persist.c Tue May 19 17:38:08 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_persist.c,v 1.16 2009/03/10 23:39:11 helly Exp $ */
+/* $Id: com_persist.c,v 1.17 2009/05/19 17:38:08 kalle Exp $ */
/* Infrastructure for working with persistent COM objects.
* Implements: IStream* wrapper for PHP streams.
@@ -157,7 +157,7 @@
return STG_E_INVALIDFUNCTION;
}
- offset = dlibMove.QuadPart;
+ offset = (off_t) dlibMove.QuadPart;
ret = php_stream_seek(stm->stream, offset, whence);
@@ -261,7 +261,7 @@
return;
}
- if (Z_REFCOUNT_P(stm) > 0) {
+ if (stm->refcount > 0) {
CoDisconnectObject((IUnknown*)stm, 0);
}
@@ -275,13 +275,14 @@
{
php_istream *stm = (php_istream*)CoTaskMemAlloc(sizeof(*stm));
- if (stm == NULL)
+ if (stm == NULL) {
return NULL;
+ }
memset(stm, 0, sizeof(*stm));
stm->engine_thread = GetCurrentThreadId();
stm->lpVtbl = &php_istream_vtbl;
- Z_SET_REFCOUNT_P(stm, 1);
+ stm->refcount = 1;
stm->stream = stream;
zend_list_addref(stream->rsrc_id);
http://cvs.php.net/viewvc.cgi/php-src/ext/com_dotnet/com_saproxy.c?r1=1.27&r2=1.28&diff_format=u
Index: php-src/ext/com_dotnet/com_saproxy.c
diff -u php-src/ext/com_dotnet/com_saproxy.c:1.27
php-src/ext/com_dotnet/com_saproxy.c:1.28
--- php-src/ext/com_dotnet/com_saproxy.c:1.27 Tue Mar 10 23:39:11 2009
+++ php-src/ext/com_dotnet/com_saproxy.c Tue May 19 17:38:08 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_saproxy.c,v 1.27 2009/03/10 23:39:11 helly Exp $ */
+/* $Id: com_saproxy.c,v 1.28 2009/05/19 17:38:08 kalle Exp $ */
/* This module implements a SafeArray proxy which is used internally
* by the engine when resolving multi-dimensional array accesses on
@@ -92,10 +92,9 @@
{
php_com_saproxy *proxy = SA_FETCH(object);
zval *return_value;
- UINT dims;
+ UINT dims, i;
SAFEARRAY *sa;
LONG ubound, lbound;
- int i;
HRESULT res;
MAKE_STD_ZVAL(return_value);
@@ -110,7 +109,7 @@
args = safe_emalloc(proxy->dimensions + 1, sizeof(zval *), 0);
- for (i = 1; i < proxy->dimensions; i++) {
+ for (i = 1; i < (UINT) proxy->dimensions; i++) {
args[i-1] = proxy->indices[i];
}
args[i-1] = offset;
@@ -145,7 +144,7 @@
sa = V_ARRAY(&proxy->obj->v);
dims = SafeArrayGetDim(sa);
- if (proxy->dimensions >= dims) {
+ if ((UINT) proxy->dimensions >= dims) {
/* too many dimensions */
php_com_throw_exception(E_INVALIDARG, "too many dimensions!"
TSRMLS_CC);
return return_value;
@@ -212,8 +211,7 @@
static void saproxy_write_dimension(zval *object, zval *offset, zval *value
TSRMLS_DC)
{
php_com_saproxy *proxy = SA_FETCH(object);
- UINT dims;
- int i;
+ UINT dims, i;
HRESULT res;
VARIANT v;
@@ -223,7 +221,7 @@
* the final value */
zval **args = safe_emalloc(proxy->dimensions + 2, sizeof(zval
*), 0);
- for (i = 1; i < proxy->dimensions; i++) {
+ for (i = 1; i < (UINT) proxy->dimensions; i++) {
args[i-1] = proxy->indices[i];
}
args[i-1] = offset;
@@ -323,13 +321,13 @@
return NULL;
}
-static union _zend_function *saproxy_method_get(zval **object, char *name, int
len TSRMLS_DC)
+static union _zend_function *saproxy_method_get(const zval **object, zstr
name, int len TSRMLS_DC)
{
/* no methods */
return NULL;
}
-static int saproxy_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
+static int saproxy_call_method(zstr method, INTERNAL_FUNCTION_PARAMETERS)
{
return FAILURE;
}
@@ -340,14 +338,14 @@
return NULL;
}
-static zend_class_entry *saproxy_class_entry_get(zval *object TSRMLS_DC)
+static zend_class_entry *saproxy_class_entry_get(const zval *object TSRMLS_DC)
{
return php_com_saproxy_class_entry;
}
-static int saproxy_class_name_get(zval *object, char **class_name, zend_uint
*class_name_len, int parent TSRMLS_DC)
+static int saproxy_class_name_get(const zval *object, zstr *class_name,
zend_uint *class_name_len, int parent TSRMLS_DC)
{
- *class_name = estrndup(php_com_saproxy_class_entry->name.s,
php_com_saproxy_class_entry->name_length);
+ (*class_name).s = estrndup(php_com_saproxy_class_entry->name.s,
php_com_saproxy_class_entry->name_length);
*class_name_len = php_com_saproxy_class_entry->name_length;
return 0;
}
@@ -521,8 +519,7 @@
*data = ptr_ptr;
}
-static int saproxy_iter_get_key(zend_object_iterator *iter, char **str_key,
uint *str_key_len,
- ulong *int_key TSRMLS_DC)
+static int saproxy_iter_get_key(zend_object_iterator *iter, zstr *str_key,
uint *str_key_len, ulong *int_key TSRMLS_DC)
{
php_com_saproxy_iter *I = (php_com_saproxy_iter*)iter->data;
http://cvs.php.net/viewvc.cgi/php-src/ext/com_dotnet/com_variant.c?r1=1.25&r2=1.26&diff_format=u
Index: php-src/ext/com_dotnet/com_variant.c
diff -u php-src/ext/com_dotnet/com_variant.c:1.25
php-src/ext/com_dotnet/com_variant.c:1.26
--- php-src/ext/com_dotnet/com_variant.c:1.25 Thu Mar 26 20:01:38 2009
+++ php-src/ext/com_dotnet/com_variant.c Tue May 19 17:38:08 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_variant.c,v 1.25 2009/03/26 20:01:38 felipe Exp $ */
+/* $Id: com_variant.c,v 1.26 2009/05/19 17:38:08 kalle Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -38,7 +38,7 @@
SAFEARRAYBOUND bound;
HashPosition pos;
int keytype;
- char *strindex;
+ zstr strindex;
int strindexlen;
long intindex = -1;
long max_index = 0;
http://cvs.php.net/viewvc.cgi/php-src/ext/com_dotnet/com_wrapper.c?r1=1.19&r2=1.20&diff_format=u
Index: php-src/ext/com_dotnet/com_wrapper.c
diff -u php-src/ext/com_dotnet/com_wrapper.c:1.19
php-src/ext/com_dotnet/com_wrapper.c:1.20
--- php-src/ext/com_dotnet/com_wrapper.c:1.19 Tue Mar 10 23:39:11 2009
+++ php-src/ext/com_dotnet/com_wrapper.c Tue May 19 17:38:08 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: com_wrapper.c,v 1.19 2009/03/10 23:39:11 helly Exp $ */
+/* $Id: com_wrapper.c,v 1.20 2009/05/19 17:38:08 kalle Exp $ */
/* This module exports a PHP object as a COM object by wrapping it
* using IDispatchEx */
@@ -457,7 +457,7 @@
static void generate_dispids(php_dispatchex *disp TSRMLS_DC)
{
HashPosition pos;
- char *name = NULL;
+ zstr name;
zval *tmp;
int namelen;
int keytype;
@@ -479,25 +479,25 @@
char namebuf[32];
if (keytype == HASH_KEY_IS_LONG) {
snprintf(namebuf, sizeof(namebuf), "%d", pid);
- name = namebuf;
+ name.s = namebuf;
namelen = strlen(namebuf)+1;
}
zend_hash_move_forward_ex(Z_OBJPROP_P(disp->object),
&pos);
/* Find the existing id */
- if (zend_hash_find(disp->name_to_dispid, name, namelen,
(void**)&tmp) == SUCCESS)
+ if (zend_hash_find(disp->name_to_dispid, name.s,
namelen, (void**)&tmp) == SUCCESS)
continue;
/* add the mappings */
MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, name, namelen-1, 1);
+ ZVAL_STRINGL(tmp, name.s, namelen-1, 1);
pid = zend_hash_next_free_element(disp->dispid_to_name);
zend_hash_index_update(disp->dispid_to_name, pid,
(void*)&tmp, sizeof(zval *), NULL);
MAKE_STD_ZVAL(tmp);
ZVAL_LONG(tmp, pid);
- zend_hash_update(disp->name_to_dispid, name, namelen,
(void*)&tmp, sizeof(zval *), NULL);
+ zend_hash_update(disp->name_to_dispid, name.s, namelen,
(void*)&tmp, sizeof(zval *), NULL);
}
}
@@ -511,25 +511,25 @@
char namebuf[32];
if (keytype == HASH_KEY_IS_LONG) {
snprintf(namebuf, sizeof(namebuf), "%d", pid);
- name = namebuf;
+ name.s = namebuf;
namelen = strlen(namebuf) + 1;
}
zend_hash_move_forward_ex(Z_OBJPROP_P(disp->object),
&pos);
/* Find the existing id */
- if (zend_hash_find(disp->name_to_dispid, name, namelen,
(void**)&tmp) == SUCCESS)
+ if (zend_hash_find(disp->name_to_dispid, name.s,
namelen, (void**)&tmp) == SUCCESS)
continue;
/* add the mappings */
MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, name, namelen-1, 1);
+ ZVAL_STRINGL(tmp, name.s, namelen-1, 1);
pid = zend_hash_next_free_element(disp->dispid_to_name);
zend_hash_index_update(disp->dispid_to_name, pid,
(void*)&tmp, sizeof(zval *), NULL);
MAKE_STD_ZVAL(tmp);
ZVAL_LONG(tmp, pid);
- zend_hash_update(disp->name_to_dispid, name, namelen,
(void*)&tmp, sizeof(zval *), NULL);
+ zend_hash_update(disp->name_to_dispid, name.s, namelen,
(void*)&tmp, sizeof(zval *), NULL);
}
}
}
@@ -547,7 +547,7 @@
disp->engine_thread = GetCurrentThreadId();
disp->lpVtbl = &php_dispatch_vtbl;
- Z_SET_REFCOUNT_P(disp, 1);
+ disp->refcount = 1;
if (object)
@@ -572,8 +572,9 @@
disp->id = 0;
- if (Z_REFCOUNT_P(disp) > 0)
+ if (disp->refcount > 0) {
CoDisconnectObject((IUnknown*)disp, 0);
+ }
zend_hash_destroy(disp->dispid_to_name);
zend_hash_destroy(disp->name_to_dispid);
@@ -591,7 +592,7 @@
{
php_dispatchex *disp = disp_constructor(val TSRMLS_CC);
HashPosition pos;
- char *name = NULL;
+ zstr name;
zval *tmp, **ntmp;
int namelen;
int keytype;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php