diff options
Diffstat (limited to 'ext/com_dotnet')
| -rw-r--r-- | ext/com_dotnet/com_com.c | 42 | ||||
| -rw-r--r-- | ext/com_dotnet/com_dotnet.c | 20 | ||||
| -rw-r--r-- | ext/com_dotnet/com_extension.c | 4 | ||||
| -rw-r--r-- | ext/com_dotnet/com_handlers.c | 30 | ||||
| -rw-r--r-- | ext/com_dotnet/com_iterator.c | 12 | ||||
| -rw-r--r-- | ext/com_dotnet/com_misc.c | 14 | ||||
| -rw-r--r-- | ext/com_dotnet/com_persist.c | 56 | ||||
| -rw-r--r-- | ext/com_dotnet/com_saproxy.c | 36 | ||||
| -rw-r--r-- | ext/com_dotnet/com_typeinfo.c | 20 | ||||
| -rw-r--r-- | ext/com_dotnet/com_variant.c | 36 | ||||
| -rw-r--r-- | ext/com_dotnet/com_wrapper.c | 100 |
11 files changed, 185 insertions, 185 deletions
diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c index 9dc6f23801..604fbfbc19 100644 --- a/ext/com_dotnet/com_com.c +++ b/ext/com_dotnet/com_com.c @@ -178,11 +178,11 @@ PHP_FUNCTION(com_create_instance) bopt.cbStruct = sizeof(bopt); IBindCtx_SetBindOptions(pBindCtx, (BIND_OPTS*)&bopt); } - + if (SUCCEEDED(res = MkParseDisplayName(pBindCtx, moniker, &ulEaten, &pMoniker))) { res = IMoniker_BindToObject(pMoniker, pBindCtx, NULL, &IID_IDispatch, (LPVOID*)&V_DISPATCH(&obj->v)); - + if (SUCCEEDED(res)) { V_VT(&obj->v) = VT_DISPATCH; } @@ -397,7 +397,7 @@ HRESULT php_com_invoke_helper(php_com_dotnet_object *obj, DISPID id_member, break; } /* else fall through */ - + default: desc = php_win32_error_to_msg(hr); spprintf(&msg, 0, "Error [0x%08x] %s", hr, desc); @@ -430,7 +430,7 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name, *dispid = (DISPID)Z_LVAL_P(tmp); return S_OK; } - + olename = php_com_string_to_olestring(name, namelen, obj->code_page); if (obj->typeinfo) { @@ -459,7 +459,7 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name, ZVAL_LONG(&tmp, *dispid); zend_hash_str_update(obj->id_of_name_cache, name, namelen, &tmp); } - + return hr; } @@ -477,7 +477,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function * if (!f) { return FAILURE; } - + hr = php_com_get_id_of_name(obj, f->function_name->val, f->function_name->len, &dispid); if (FAILED(hr)) { @@ -527,7 +527,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function * php_com_variant_from_zval(&vargs[i], &args[nargs - i - 1], obj->code_page); } } - + } else { /* Invoke'd args are in reverse order */ for (i = 0; i < nargs; i++) { @@ -547,7 +547,7 @@ int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function * } /* this will create an exception if needed */ - hr = php_com_invoke_helper(obj, dispid, flags, &disp_params, v, 0, 0); + hr = php_com_invoke_helper(obj, dispid, flags, &disp_params, v, 0, 0); /* release variants */ if (vargs) { @@ -620,7 +620,7 @@ int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid, } /* this will create an exception if needed */ - hr = php_com_invoke_helper(obj, dispid, flags, &disp_params, v, silent, allow_noarg); + hr = php_com_invoke_helper(obj, dispid, flags, &disp_params, v, silent, allow_noarg); /* release variants */ if (vargs) { @@ -633,7 +633,7 @@ int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid, /* a bit of a hack this, but it's needed for COM array access. */ if (hr == DISP_E_BADPARAMCOUNT) return hr; - + return SUCCEEDED(hr) ? SUCCESS : FAILURE; } @@ -697,7 +697,7 @@ PHP_FUNCTION(com_event_sink) ITypeInfo *typeinfo = NULL; RETVAL_FALSE; - + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "Oo|z/", &object, php_com_variant_class_entry, &sinkobject, &sink)) { RETURN_FALSE; @@ -705,7 +705,7 @@ PHP_FUNCTION(com_event_sink) php_com_initialize(); obj = CDNO_FETCH(object); - + if (sink && Z_TYPE_P(sink) == IS_ARRAY) { /* 0 => typelibname, 1 => dispname */ zval *tmp; @@ -718,14 +718,14 @@ PHP_FUNCTION(com_event_sink) convert_to_string(sink); dispname = Z_STRVAL_P(sink); } - + typeinfo = php_com_locate_typeinfo(typelibname, obj, dispname, 1); if (typeinfo) { HashTable *id_to_name; - + ALLOC_HASHTABLE(id_to_name); - + if (php_com_process_typeinfo(typeinfo, id_to_name, 0, &obj->sink_id, obj->code_page)) { /* Create the COM wrapper for this sink */ @@ -739,7 +739,7 @@ PHP_FUNCTION(com_event_sink) FREE_HASHTABLE(id_to_name); } } - + if (typeinfo) { ITypeInfo_Release(typeinfo); } @@ -758,7 +758,7 @@ PHP_FUNCTION(com_print_typeinfo) zend_bool wantsink = 0; php_com_dotnet_object *obj = NULL; ITypeInfo *typeinfo; - + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "z/|s!b", &arg1, &ifacename, &ifacelen, &wantsink)) { RETURN_FALSE; @@ -791,10 +791,10 @@ PHP_FUNCTION(com_message_pump) zend_long timeoutms = 0; MSG msg; DWORD result; - + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &timeoutms) == FAILURE) RETURN_FALSE; - + php_com_initialize(); result = MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD)timeoutms, QS_ALLINPUT); @@ -812,7 +812,7 @@ PHP_FUNCTION(com_message_pump) } /* }}} */ -/* {{{ proto bool com_load_typelib(string typelib_name [, int case_insensitive]) +/* {{{ proto bool com_load_typelib(string typelib_name [, int case_insensitive]) Loads a Typelibrary and registers its constants */ PHP_FUNCTION(com_load_typelib) { @@ -828,7 +828,7 @@ PHP_FUNCTION(com_load_typelib) } RETVAL_FALSE; - + php_com_initialize(); pTL = php_com_load_typelib_via_cache(name, codepage, &cached); if (pTL) { diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c index 35f795187a..bfc57d7630 100644 --- a/ext/com_dotnet/com_dotnet.c +++ b/ext/com_dotnet/com_dotnet.c @@ -53,17 +53,17 @@ typedef struct _Imscorlib_System_AppDomain IAppDomain; struct _Imscorlib_System_AppDomainVtbl { BEGIN_INTERFACE - HRESULT ( STDMETHODCALLTYPE *QueryInterface )( + HRESULT ( STDMETHODCALLTYPE *QueryInterface )( IAppDomain * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void **ppvObject); - - ULONG ( STDMETHODCALLTYPE *AddRef )( + + ULONG ( STDMETHODCALLTYPE *AddRef )( IAppDomain * This); - - ULONG ( STDMETHODCALLTYPE *Release )( + + ULONG ( STDMETHODCALLTYPE *Release )( IAppDomain * This); - + /* this is padding to get CreateInstance into the correct position */ #define DUMMY_METHOD(x) HRESULT ( STDMETHODCALLTYPE *dummy_##x )(IAppDomain *This) @@ -146,7 +146,7 @@ static HRESULT dotnet_init(char **p_where) hr = ICorRuntimeHost_Start(stuff->dotnet_host); if (FAILED(hr)) goto out; - + where = "ICorRuntimeHost_GetDefaultDomain"; hr = ICorRuntimeHost_GetDefaultDomain(stuff->dotnet_host, &unk); if (FAILED(hr)) @@ -156,7 +156,7 @@ static HRESULT dotnet_init(char **p_where) hr = IUnknown_QueryInterface(unk, &IID_mscorlib_System_AppDomain, (LPVOID*)&stuff->dotnet_domain); if (FAILED(hr)) goto out; - + COMG(dotnet_runtime_stuff) = stuff; out: @@ -323,7 +323,7 @@ PHP_FUNCTION(com_dotnet_create_instance) void php_com_dotnet_mshutdown(void) { struct dotnet_runtime_stuff *stuff = COMG(dotnet_runtime_stuff); - + if (stuff->dotnet_domain) { IDispatch_Release(stuff->dotnet_domain); } @@ -339,7 +339,7 @@ void php_com_dotnet_mshutdown(void) void php_com_dotnet_rshutdown(void) { struct dotnet_runtime_stuff *stuff = COMG(dotnet_runtime_stuff); - + if (stuff->dotnet_domain) { IDispatch_Release(stuff->dotnet_domain); stuff->dotnet_domain = NULL; diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c index 4498a84e42..027789c483 100644 --- a/ext/com_dotnet/com_extension.c +++ b/ext/com_dotnet/com_extension.c @@ -367,7 +367,7 @@ PHP_MINIT_FUNCTION(com_dotnet) php_com_saproxy_class_entry->ce_flags |= ZEND_ACC_FINAL; /* php_com_saproxy_class_entry->constructor->common.fn_flags |= ZEND_ACC_PROTECTED; */ php_com_saproxy_class_entry->get_iterator = php_com_saproxy_iter_get; - + INIT_CLASS_ENTRY(ce, "variant", NULL); ce.create_object = php_com_object_new; php_com_variant_class_entry = zend_register_internal_class(&ce); @@ -396,7 +396,7 @@ PHP_MINIT_FUNCTION(com_dotnet) ULongToIntPtr(x, &__tmp); \ REGISTER_LONG_CONSTANT(#x, __tmp, CONST_CS|CONST_PERSISTENT); \ } - + COM_CONST(CLSCTX_INPROC_SERVER); COM_CONST(CLSCTX_INPROC_HANDLER); COM_CONST(CLSCTX_LOCAL_SERVER); diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c index 60830dc599..95a1c9a7ed 100644 --- a/ext/com_dotnet/com_handlers.c +++ b/ext/com_dotnet/com_handlers.c @@ -100,7 +100,7 @@ static zval *com_read_dimension(zval *object, zval *offset, int type, zval *rv) } else if (V_ISARRAY(&obj->v)) { convert_to_long(offset); - if (SafeArrayGetDim(V_ARRAY(&obj->v)) == 1) { + if (SafeArrayGetDim(V_ARRAY(&obj->v)) == 1) { if (php_com_safearray_get_elem(&obj->v, &v, (LONG)Z_LVAL_P(offset))) { php_com_wrap_variant(rv, &v, obj->code_page); VariantClear(&v); @@ -138,8 +138,8 @@ static void com_write_dimension(zval *object, zval *offset, zval *value) } else if (V_ISARRAY(&obj->v)) { LONG indices = 0; VARTYPE vt; - - if (SafeArrayGetDim(V_ARRAY(&obj->v)) == 1) { + + if (SafeArrayGetDim(V_ARRAY(&obj->v)) == 1) { if (FAILED(SafeArrayGetVartype(V_ARRAY(&obj->v), &vt)) || vt == VT_EMPTY) { vt = V_VT(&obj->v) & ~VT_ARRAY; } @@ -281,7 +281,7 @@ static union _zend_function *com_method_get(zend_object **object_ptr, zend_strin f.handler = PHP_FN(com_method_handler); fptr = &f; - + if (obj->typeinfo) { /* look for byref params */ ITypeComp *comp; @@ -368,7 +368,7 @@ static int com_call_method(zend_string *method, zend_object *object, INTERNAL_FU if (V_VT(&obj->v) != VT_DISPATCH) { return FAILURE; } - + nargs = ZEND_NUM_ARGS(); if (nargs) { @@ -405,19 +405,19 @@ static union _zend_function *com_constructor_get(zend_object *object) f.fn_flags = 0; \ f.handler = ZEND_FN(fn); \ return (union _zend_function*)&f; - + switch (obj->ce->name->val[0]) { #if HAVE_MSCOREE_H case 'd': POPULATE_CTOR(d, com_dotnet_create_instance); #endif - + case 'c': POPULATE_CTOR(c, com_create_instance); - + case 'v': POPULATE_CTOR(v, com_variant_create_instance); - + default: return NULL; } @@ -522,9 +522,9 @@ static int com_object_count(zval *object, zend_long *count) { php_com_dotnet_object *obj; LONG ubound = 0, lbound = 0; - + obj = CDNO_FETCH(object); - + if (!V_ISARRAY(&obj->v)) { return FAILURE; } @@ -571,10 +571,10 @@ void php_com_object_enable_event_sink(php_com_dotnet_object *obj, int enable) if (obj->sink_dispatch) { IConnectionPointContainer *cont; IConnectionPoint *point; - + if (SUCCEEDED(IDispatch_QueryInterface(V_DISPATCH(&obj->v), &IID_IConnectionPointContainer, (void**)&cont))) { - + if (SUCCEEDED(IConnectionPointContainer_FindConnectionPoint(cont, &obj->sink_id, &point))) { @@ -623,7 +623,7 @@ zend_object* php_com_object_clone(zval *object) origobject = (php_com_dotnet_object*)Z_OBJ_P(object); cloneobj = (php_com_dotnet_object*)emalloc(sizeof(php_com_dotnet_object)); - + memcpy(cloneobj, origobject, sizeof(*cloneobj)); /* VariantCopy will perform VariantClear; we don't want to clobber @@ -632,7 +632,7 @@ zend_object* php_com_object_clone(zval *object) VariantInit(&cloneobj->v); /* We use the Indirection-following version of the API since we * want to clone as much as possible */ - VariantCopyInd(&cloneobj->v, &origobject->v); + VariantCopyInd(&cloneobj->v, &origobject->v); if (cloneobj->typeinfo) { ITypeInfo_AddRef(cloneobj->typeinfo); diff --git a/ext/com_dotnet/com_iterator.c b/ext/com_dotnet/com_iterator.c index 20cf6bfc19..21486897b9 100644 --- a/ext/com_dotnet/com_iterator.c +++ b/ext/com_dotnet/com_iterator.c @@ -44,7 +44,7 @@ struct php_com_iterator { static void com_iter_dtor(zend_object_iterator *iter) { struct php_com_iterator *I = (struct php_com_iterator*)Z_PTR(iter->data); - + if (I->ev) { IEnumVARIANT_Release(I->ev); } @@ -157,7 +157,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int b } memset(&dp, 0, sizeof(dp)); - VariantInit(&v); + VariantInit(&v); I = (struct php_com_iterator*)ecalloc(1, sizeof(*I)); zend_iterator_init(&I->iter); @@ -171,7 +171,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int b if (V_ISARRAY(&obj->v)) { LONG bound; UINT dims; - + dims = SafeArrayGetDim(V_ARRAY(&obj->v)); if (dims != 1) { @@ -179,7 +179,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int b "Can only handle single dimension variant arrays (this array has %d)", dims); goto fail; } - + /* same semantics as foreach on a PHP array; * make a copy and enumerate that copy */ VariantCopy(&I->safe_array, &obj->v); @@ -197,7 +197,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int b } else { I->key = (ulong)-1; } - + } else { /* can we enumerate it? */ if (FAILED(IDispatch_Invoke(V_DISPATCH(&obj->v), DISPID_NEWENUM, @@ -218,7 +218,7 @@ zend_object_iterator *php_com_iter_get(zend_class_entry *ce, zval *object, int b if (iev == NULL) { goto fail; } - + I->ev = iev; /* Get the first element now */ diff --git a/ext/com_dotnet/com_misc.c b/ext/com_dotnet/com_misc.c index f776cb4d32..f7e6b0b11e 100644 --- a/ext/com_dotnet/com_misc.c +++ b/ext/com_dotnet/com_misc.c @@ -101,11 +101,11 @@ PHP_COM_DOTNET_API int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, LONG lbound, ubound; LONG indices[1]; VARTYPE vt; - + if (!V_ISARRAY(array)) { return 0; } - + dims = SafeArrayGetDim(V_ARRAY(array)); if (dims != 1) { @@ -113,7 +113,7 @@ PHP_COM_DOTNET_API int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, "Can only handle single dimension variant arrays (this array has %d)", dims); return 0; } - + if (FAILED(SafeArrayGetVartype(V_ARRAY(array), &vt)) || vt == VT_EMPTY) { vt = V_VT(array) & ~VT_ARRAY; } @@ -121,16 +121,16 @@ PHP_COM_DOTNET_API int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, /* determine the bounds */ SafeArrayGetLBound(V_ARRAY(array), 1, &lbound); SafeArrayGetUBound(V_ARRAY(array), 1, &ubound); - + /* check bounds */ if (dim1 < lbound || dim1 > ubound) { php_com_throw_exception(DISP_E_BADINDEX, "index out of bounds"); return 0; } - + /* now fetch that element */ VariantInit(dest); - + indices[0] = dim1; if (vt == VT_VARIANT) { @@ -143,5 +143,5 @@ PHP_COM_DOTNET_API int php_com_safearray_get_elem(VARIANT *array, VARIANT *dest, SafeArrayGetElement(V_ARRAY(array), indices, &dest->lVal); } - return 1; + return 1; } diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c index 187b50b120..7f21d0d276 100644 --- a/ext/com_dotnet/com_persist.c +++ b/ext/com_dotnet/com_persist.c @@ -20,7 +20,7 @@ /* Infrastructure for working with persistent COM objects. * Implements: IStream* wrapper for PHP streams. - * TODO: Magic __wakeup and __sleep handlers for serialization + * TODO: Magic __wakeup and __sleep handlers for serialization * (can wait till 5.1) */ #ifdef HAVE_CONFIG_H @@ -57,7 +57,7 @@ static void istream_dtor(zend_resource *rsrc) php_istream *stm = (php_istream*)This; \ if (GetCurrentThreadId() != stm->engine_thread) \ return RPC_E_WRONG_THREAD; - + #define FETCH_STM_EX() \ php_istream *stm = (php_istream*)This; \ if (GetCurrentThreadId() != stm->engine_thread) \ @@ -87,7 +87,7 @@ static ULONG STDMETHODCALLTYPE stm_addref(IStream *This) return InterlockedIncrement(&stm->refcount); } - + static ULONG STDMETHODCALLTYPE stm_release(IStream *This) { ULONG ret; @@ -149,12 +149,12 @@ static HRESULT STDMETHODCALLTYPE stm_seek(IStream *This, LARGE_INTEGER dlibMove, default: return STG_E_INVALIDFUNCTION; } - + if (dlibMove.HighPart) { /* we don't support 64-bit offsets */ return STG_E_INVALIDFUNCTION; } - + offset = (off_t) dlibMove.QuadPart; ret = php_stream_seek(stm->stream, offset, whence); @@ -173,7 +173,7 @@ static HRESULT STDMETHODCALLTYPE stm_set_size(IStream *This, ULARGE_INTEGER libN if (libNewSize.HighPart) { return STG_E_INVALIDFUNCTION; } - + if (php_stream_truncate_supported(stm->stream)) { int ret = php_stream_truncate_set_size(stm->stream, (size_t)libNewSize.QuadPart); @@ -291,7 +291,7 @@ PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream) #define CPH_ME(fname, arginfo) PHP_ME(com_persist, fname, arginfo, ZEND_ACC_PUBLIC) #define CPH_SME(fname, arginfo) PHP_ME(com_persist, fname, arginfo, ZEND_ACC_ALLOW_STATIC|ZEND_ACC_PUBLIC) #define CPH_METHOD(fname) static PHP_METHOD(com_persist, fname) - + #define CPH_FETCH() php_com_persist_helper *helper = (php_com_persist_helper*)Z_OBJ_P(getThis()); #define CPH_NO_OBJ() if (helper->unk == NULL) { php_com_throw_exception(E_INVALIDARG, "No COM object is associated with this helper instance"); return; } @@ -342,7 +342,7 @@ CPH_METHOD(GetCurFileName) CPH_FETCH(); CPH_NO_OBJ(); - + res = get_persist_file(helper); if (helper->ipf) { res = IPersistFile_GetCurFile(helper->ipf, &olename); @@ -378,7 +378,7 @@ CPH_METHOD(SaveToFile) zend_bool remember = TRUE; OLECHAR *olefilename = NULL; CPH_FETCH(); - + CPH_NO_OBJ(); res = get_persist_file(helper); @@ -394,7 +394,7 @@ CPH_METHOD(SaveToFile) if (!fullpath) { RETURN_FALSE; } - + if (php_check_open_basedir(fullpath)) { efree(fullpath); RETURN_FALSE; @@ -416,7 +416,7 @@ CPH_METHOD(SaveToFile) IPersistFile_SaveCompleted(helper->ipf, olefilename); } } - + if (olefilename) { efree(olefilename); } @@ -441,7 +441,7 @@ CPH_METHOD(LoadFromFile) zend_long flags = 0; OLECHAR *olefilename; CPH_FETCH(); - + CPH_NO_OBJ(); res = get_persist_file(helper); @@ -464,14 +464,14 @@ CPH_METHOD(LoadFromFile) olefilename = php_com_string_to_olestring(fullpath, strlen(fullpath), helper->codepage); efree(fullpath); - + res = IPersistFile_Load(helper->ipf, olefilename, (DWORD)flags); efree(olefilename); if (FAILED(res)) { php_com_throw_exception(res, NULL); } - + } else { php_com_throw_exception(res, NULL); } @@ -485,9 +485,9 @@ CPH_METHOD(GetMaxStreamSize) HRESULT res; ULARGE_INTEGER size; CPH_FETCH(); - + CPH_NO_OBJ(); - + res = get_persist_stream_init(helper); if (helper->ipsi) { res = IPersistStreamInit_GetSizeMax(helper->ipsi, &size); @@ -516,7 +516,7 @@ CPH_METHOD(InitNew) { HRESULT res; CPH_FETCH(); - + CPH_NO_OBJ(); res = get_persist_stream_init(helper); @@ -543,14 +543,14 @@ CPH_METHOD(LoadFromStream) IStream *stm = NULL; HRESULT res; CPH_FETCH(); - + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zstm)) { php_com_throw_exception(E_INVALIDARG, "invalid arguments"); return; } php_stream_from_zval_no_verify(stream, zstm); - + if (stream == NULL) { php_com_throw_exception(E_INVALIDARG, "expected a stream"); return; @@ -561,7 +561,7 @@ CPH_METHOD(LoadFromStream) php_com_throw_exception(E_UNEXPECTED, "failed to wrap stream"); return; } - + res = S_OK; RETVAL_TRUE; @@ -572,7 +572,7 @@ CPH_METHOD(LoadFromStream) res = OleLoadFromStream(stm, &IID_IDispatch, &disp); if (SUCCEEDED(res)) { - php_com_wrap_dispatch(return_value, disp, COMG(code_page)); + php_com_wrap_dispatch(return_value, disp, COMG(code_page)); } } else { res = get_persist_stream_init(helper); @@ -603,16 +603,16 @@ CPH_METHOD(SaveToStream) IStream *stm = NULL; HRESULT res; CPH_FETCH(); - + CPH_NO_OBJ(); - + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zstm)) { php_com_throw_exception(E_INVALIDARG, "invalid arguments"); return; } php_stream_from_zval_no_verify(stream, zstm); - + if (stream == NULL) { php_com_throw_exception(E_INVALIDARG, "expected a stream"); return; @@ -623,7 +623,7 @@ CPH_METHOD(SaveToStream) php_com_throw_exception(E_UNEXPECTED, "failed to wrap stream"); return; } - + res = get_persist_stream_init(helper); if (helper->ipsi) { res = IPersistStreamInit_Save(helper->ipsi, stm, TRUE); @@ -633,7 +633,7 @@ CPH_METHOD(SaveToStream) res = IPersistStream_Save(helper->ips, stm, TRUE); } } - + IStream_Release(stm); if (FAILED(res)) { @@ -662,7 +662,7 @@ CPH_METHOD(__construct) if (!zobj) { return; } - + obj = CDNO_FETCH(zobj); if (V_VT(&obj->v) != VT_DISPATCH || V_DISPATCH(&obj->v) == NULL) { @@ -764,7 +764,7 @@ int php_com_persist_minit(INIT_FUNC_ARGS) le_istream = zend_register_list_destructors_ex(istream_dtor, NULL, "com_dotnet_istream_wrapper", module_number); - + return SUCCESS; } diff --git a/ext/com_dotnet/com_saproxy.c b/ext/com_dotnet/com_saproxy.c index 481e95a2bd..b041e6a999 100644 --- a/ext/com_dotnet/com_saproxy.c +++ b/ext/com_dotnet/com_saproxy.c @@ -44,7 +44,7 @@ typedef struct { /* how many dimensions we are indirecting to get into this element */ LONG dimensions; - + /* this is an array whose size_is(dimensions) */ zval *indices; @@ -92,9 +92,9 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * SAFEARRAY *sa; LONG ubound, lbound; HRESULT res; - + ZVAL_NULL(rv); - + if (V_VT(&proxy->obj->v) == VT_DISPATCH) { VARIANT v; zval *args; @@ -132,10 +132,10 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * } /* the SafeArray case */ - + /* offset/index must be an integer */ convert_to_long(offset); - + sa = V_ARRAY(&proxy->obj->v); dims = SafeArrayGetDim(sa); @@ -153,14 +153,14 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * php_com_throw_exception(DISP_E_BADINDEX, "index out of bounds"); return rv; } - + if (dims - 1 == proxy->dimensions) { LONG *indices; VARTYPE vt; VARIANT v; - + VariantInit(&v); - + /* we can return a real value */ indices = safe_emalloc(dims, sizeof(LONG), 0); @@ -194,7 +194,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * } VariantClear(&v); - + } else { /* return another proxy */ php_com_saproxy_create(object, rv, offset); @@ -209,7 +209,7 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value) UINT dims, i; HRESULT res; VARIANT v; - + if (V_VT(&proxy->obj->v) == VT_DISPATCH) { /* We do a prop-set using the first dimension as the property name, * all subsequent dimensions and offset as parameters, with value as @@ -231,7 +231,7 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value) } efree(args); - + } else if (V_ISARRAY(&proxy->obj->v)) { LONG *indices; VARTYPE vt; @@ -264,7 +264,7 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value) } else { res = SafeArrayPutElement(V_ARRAY(&proxy->obj->v), indices, &v.lVal); } - + efree(indices); VariantClear(&v); @@ -352,7 +352,7 @@ static int saproxy_count_elements(zval *object, zend_long *count) { php_com_saproxy *proxy = SA_FETCH(object); LONG ubound, lbound; - + if (!V_ISARRAY(&proxy->obj->v)) { return FAILURE; } @@ -450,7 +450,7 @@ int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index) zend_object_std_init(&proxy->std, php_com_saproxy_class_entry); proxy->std.handlers = &php_com_saproxy_handlers; ZVAL_OBJ(proxy_out, &proxy->std); - + return 1; } @@ -481,9 +481,9 @@ static zval* saproxy_iter_get_data(zend_object_iterator *iter) SAFEARRAY *sa; I->indices[I->proxy->dimensions-1] = I->key; - + sa = V_ARRAY(&I->proxy->obj->v); - + if (FAILED(SafeArrayGetVartype(sa, &vt)) || vt == VT_EMPTY) { vt = V_VT(&I->proxy->obj->v) & ~VT_ARRAY; } @@ -561,8 +561,8 @@ zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *objec SafeArrayGetLBound(V_ARRAY(&proxy->obj->v), proxy->dimensions, &I->imin); SafeArrayGetUBound(V_ARRAY(&proxy->obj->v), proxy->dimensions, &I->imax); - I->key = I->imin; - + I->key = I->imin; + return &I->iter; } diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c index 2e2732afcd..c16685f4c9 100644 --- a/ext/com_dotnet/com_typeinfo.c +++ b/ext/com_dotnet/com_typeinfo.c @@ -146,7 +146,7 @@ PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codep } } } - + efree(p); return TL; @@ -267,7 +267,7 @@ ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj ITypeLib *typelib = NULL; int gotguid = 0; GUID iid; - + if (obj) { if (dispname == NULL && sink) { IProvideClassInfo2 *pci2; @@ -313,18 +313,18 @@ ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj } else if (typelibname) { /* Fetch the typelibrary and use that to look things up */ typelib = php_com_load_typelib(typelibname, CP_THREAD_ACP); - } + } if (!gotguid && dispname && typelib) { unsigned short cfound; MEMBERID memid; OLECHAR *olename = php_com_string_to_olestring(dispname, strlen(dispname), CP_ACP); - + cfound = 1; if (FAILED(ITypeLib_FindName(typelib, olename, 0, &typeinfo, &memid, &cfound)) || cfound == 0) { CLSID coclass; ITypeInfo *coinfo; - + /* assume that it might be a progid instead */ if (SUCCEEDED(CLSIDFromProgID(olename, &coclass)) && SUCCEEDED(ITypeLib_GetTypeInfoOfGuid(typelib, &coclass, &coinfo))) { @@ -351,16 +351,16 @@ ITypeInfo *php_com_locate_typeinfo(char *typelibname, php_com_dotnet_object *obj if (SUCCEEDED(ITypeInfo_GetRefTypeOfImplType(coinfo, i, &rt))) if (SUCCEEDED(ITypeInfo_GetRefTypeInfo(coinfo, rt, &typeinfo))) break; - + } } - + ITypeInfo_ReleaseTypeAttr(coinfo, attr); ITypeInfo_Release(coinfo); } } - + efree(olename); } else if (gotguid) { ITypeLib_GetTypeInfoOfGuid(typelib, &iid, &typeinfo); @@ -450,7 +450,7 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri if (guid) { memcpy(guid, &attr->guid, sizeof(GUID)); } - + if (printdef) { char *guidstring; @@ -483,7 +483,7 @@ int php_com_process_typeinfo(ITypeInfo *typeinfo, HashTable *id_to_name, int pri if (!isprop || lastid != func->memid) { lastid = func->memid; - + ITypeInfo_GetDocumentation(typeinfo, func->memid, &olename, NULL, NULL, NULL); ansiname = php_com_olestring_to_string(olename, &ansinamelen, codepage); SysFreeString(olename); diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c index e7db3bb3d3..b9b6daa932 100644 --- a/ext/com_dotnet/com_variant.c +++ b/ext/com_dotnet/com_variant.c @@ -42,7 +42,7 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage) zend_ulong intindex = 0; VARIANT *va; zval *item; - + /* find the largest array index, and assert that all keys are integers */ zend_hash_internal_pointer_reset_ex(HASH_OF(z), &pos); for (;; zend_hash_move_forward_ex(HASH_OF(z), &pos)) { @@ -59,7 +59,7 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage) } } - /* allocate the structure */ + /* allocate the structure */ bound.lLbound = 0; bound.cElements = zend_hash_num_elements(HASH_OF(z)); sa = SafeArrayCreate(VT_VARIANT, 1, &bound); @@ -67,7 +67,7 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage) /* get a lock on the array itself */ SafeArrayAccessData(sa, &va); va = (VARIANT*)sa->pvData; - + /* now fill it in */ zend_hash_internal_pointer_reset_ex(HASH_OF(z), &pos); for (;; zend_hash_move_forward_ex(HASH_OF(z), &pos)) { @@ -75,7 +75,7 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage) break; } zend_hash_get_current_key_ex(HASH_OF(z), &strindex, &intindex, &pos); - php_com_variant_from_zval(&va[intindex], item, codepage); + php_com_variant_from_zval(&va[intindex], item, codepage); } /* Unlock it and stuff it into our variant */ @@ -101,7 +101,7 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep OLECHAR *olestring; php_com_dotnet_object *obj; zend_uchar ztype = (z == NULL ? IS_NULL : Z_TYPE_P(z)); - + switch (ztype) { case IS_NULL: V_VT(v) = VT_NULL; @@ -138,7 +138,7 @@ PHP_COM_DOTNET_API void php_com_variant_from_zval(VARIANT *v, zval *z, int codep V_DISPATCH(v) = php_com_wrapper_export(z); } break; - + case IS_ARRAY: /* map as safe array */ safe_array_from_zval(v, z, codepage); @@ -265,7 +265,7 @@ PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepa case VT_VARIANT: /* points to another variant */ return php_com_zval_from_variant(z, V_VARIANTREF(v), codepage); - + default: php_com_wrap_variant(z, v, codepage); } @@ -285,7 +285,7 @@ PHP_COM_DOTNET_API int php_com_zval_from_variant(zval *z, VARIANT *v, int codepa PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar) { int ret = SUCCESS; - + switch (V_VT(dstvar) & ~VT_BYREF) { case VT_EMPTY: case VT_NULL: @@ -313,7 +313,7 @@ PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar) if (V_VT(dstvar) & VT_BYREF) { *V_UI2REF(dstvar) = V_UI2(srcvar); } else { - V_UI2(dstvar) = V_UI2(srcvar); + V_UI2(dstvar) = V_UI2(srcvar); } break; @@ -325,7 +325,7 @@ PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar) } break; - case VT_UI4: + case VT_UI4: if (V_VT(dstvar) & VT_BYREF) { *V_UI4REF(dstvar) = V_UI4(srcvar); } else { @@ -340,8 +340,8 @@ PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar) V_I4(dstvar) = V_I4(srcvar); } break; -#if SIZEOF_ZEND_LONG == 8 - case VT_UI8: +#if SIZEOF_ZEND_LONG == 8 + case VT_UI8: if (V_VT(dstvar) & VT_BYREF) { *V_UI8REF(dstvar) = V_UI8(srcvar); } else { @@ -369,7 +369,7 @@ PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar) if (V_VT(dstvar) & VT_BYREF) { *V_UINTREF(dstvar) = V_UINT(srcvar); } else { - V_UINT(dstvar) = V_UINT(srcvar); + V_UINT(dstvar) = V_UINT(srcvar); } break; @@ -423,7 +423,7 @@ PHP_COM_DOTNET_API int php_com_copy_variant(VARIANT *dstvar, VARIANT *srcvar) case VT_VARIANT: return php_com_copy_variant(V_VARIANTREF(dstvar), srcvar); - + default: php_error_docref(NULL, E_WARNING, "variant->variant: failed to copy from 0x%x to 0x%x", V_VT(dstvar), V_VT(srcvar)); ret = FAILURE; @@ -445,9 +445,9 @@ PHP_FUNCTION(com_variant_create_instance) /* just leave things as-is - an empty variant */ return; } - + obj = CDNO_FETCH(object); - + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "z!|ll", &zvalue, &vt, &codepage)) { php_com_throw_exception(E_INVALIDARG, "Invalid arguments"); @@ -468,7 +468,7 @@ PHP_FUNCTION(com_variant_create_instance) /* If already an array and VT_ARRAY is passed then: - if only VT_ARRAY passed then do not perform a conversion - - if VT_ARRAY plus other type passed then perform conversion + - if VT_ARRAY plus other type passed then perform conversion but will probably fail (original behavior) */ if ((vt & VT_ARRAY) && (V_VT(&obj->v) & VT_ARRAY)) { @@ -1037,7 +1037,7 @@ PHP_FUNCTION(variant_get_type) return; } obj = CDNO_FETCH(zobj); - + RETURN_LONG(V_VT(&obj->v)); } /* }}} */ diff --git a/ext/com_dotnet/com_wrapper.c b/ext/com_dotnet/com_wrapper.c index 0df36bd465..77fb401b51 100644 --- a/ext/com_dotnet/com_wrapper.c +++ b/ext/com_dotnet/com_wrapper.c @@ -37,7 +37,7 @@ typedef struct { CONST_VTBL struct IDispatchExVtbl *lpVtbl; /* now the PHP stuff */ - + DWORD engine_thread; /* for sanity checking */ zval object; /* the object exported */ LONG refcount; /* COM reference count */ @@ -46,7 +46,7 @@ typedef struct { HashTable *name_to_dispid; /* keep track of name -> dispid mappings */ GUID sinkid; /* iid that we "implement" for event sinking */ - + zend_resource *res; } php_dispatchex; @@ -76,12 +76,12 @@ static inline void trace(char *fmt, ...) snprintf(buf, sizeof(buf), "T=%08x ", GetCurrentThreadId()); OutputDebugString(buf); - + va_start(ap, fmt); vsnprintf(buf, sizeof(buf), fmt, ap); OutputDebugString(buf); - + va_end(ap); } /* }}} */ @@ -97,7 +97,7 @@ static inline void trace(char *fmt, ...) return RPC_E_WRONG_THREAD; \ } -static HRESULT STDMETHODCALLTYPE disp_queryinterface( +static HRESULT STDMETHODCALLTYPE disp_queryinterface( IDispatchEx *This, /* [in] */ REFIID riid, /* [iid_is][out] */ void **ppvObject) @@ -116,14 +116,14 @@ static HRESULT STDMETHODCALLTYPE disp_queryinterface( *ppvObject = NULL; return E_NOINTERFACE; } - + static ULONG STDMETHODCALLTYPE disp_addref(IDispatchEx *This) { FETCH_DISP("AddRef"); return InterlockedIncrement(&disp->refcount); } - + static ULONG STDMETHODCALLTYPE disp_release(IDispatchEx *This) { ULONG ret; @@ -139,7 +139,7 @@ static ULONG STDMETHODCALLTYPE disp_release(IDispatchEx *This) return ret; } -static HRESULT STDMETHODCALLTYPE disp_gettypeinfocount( +static HRESULT STDMETHODCALLTYPE disp_gettypeinfocount( IDispatchEx *This, /* [out] */ UINT *pctinfo) { @@ -148,20 +148,20 @@ static HRESULT STDMETHODCALLTYPE disp_gettypeinfocount( *pctinfo = 0; return S_OK; } - -static HRESULT STDMETHODCALLTYPE disp_gettypeinfo( + +static HRESULT STDMETHODCALLTYPE disp_gettypeinfo( IDispatchEx *This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo **ppTInfo) { FETCH_DISP("GetTypeInfo"); - + *ppTInfo = NULL; return DISP_E_BADINDEX; } -static HRESULT STDMETHODCALLTYPE disp_getidsofnames( +static HRESULT STDMETHODCALLTYPE disp_getidsofnames( IDispatchEx *This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR *rgszNames, @@ -177,9 +177,9 @@ static HRESULT STDMETHODCALLTYPE disp_getidsofnames( char *name; size_t namelen; zval *tmp; - + name = php_com_olestring_to_string(rgszNames[i], &namelen, COMG(code_page)); - + /* Lookup the name in the hash */ if ((tmp = zend_hash_str_find(disp->name_to_dispid, name, namelen)) == NULL) { ret = DISP_E_UNKNOWNNAME; @@ -191,11 +191,11 @@ static HRESULT STDMETHODCALLTYPE disp_getidsofnames( efree(name); } - + return ret; } -static HRESULT STDMETHODCALLTYPE disp_invoke( +static HRESULT STDMETHODCALLTYPE disp_invoke( IDispatchEx *This, /* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, @@ -211,7 +211,7 @@ static HRESULT STDMETHODCALLTYPE disp_invoke( pVarResult, pExcepInfo, NULL); } -static HRESULT STDMETHODCALLTYPE disp_getdispid( +static HRESULT STDMETHODCALLTYPE disp_getdispid( IDispatchEx *This, /* [in] */ BSTR bstrName, /* [in] */ DWORD grfdex, @@ -226,7 +226,7 @@ static HRESULT STDMETHODCALLTYPE disp_getdispid( name = php_com_olestring_to_string(bstrName, &namelen, COMG(code_page)); trace("Looking for %s, namelen=%d in %p\n", name, namelen, disp->name_to_dispid); - + /* Lookup the name in the hash */ if ((tmp = zend_hash_str_find(disp->name_to_dispid, name, namelen)) != NULL) { trace("found it\n"); @@ -235,11 +235,11 @@ static HRESULT STDMETHODCALLTYPE disp_getdispid( } efree(name); - + return ret; } -static HRESULT STDMETHODCALLTYPE disp_invokeex( +static HRESULT STDMETHODCALLTYPE disp_invokeex( IDispatchEx *This, /* [in] */ DISPID id, /* [in] */ LCID lcid, @@ -260,7 +260,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex( /* TODO: add support for overloaded objects */ trace("-- Invoke: %d %20s [%d] flags=%08x args=%d\n", id, Z_STRVAL_P(name), Z_STRLEN_P(name), wFlags, pdp->cArgs); - + /* convert args into zvals. * Args are in reverse order */ if (pdp->cArgs) { @@ -276,11 +276,11 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex( } } - trace("arguments processed, prepare to do some work\n"); - + trace("arguments processed, prepare to do some work\n"); + /* TODO: if PHP raises an exception here, we should catch it * and expose it as a COM exception */ - + if (wFlags & DISPATCH_PROPERTYGET) { retval = zend_read_property(Z_OBJCE(disp->object), &disp->object, Z_STRVAL_P(name), Z_STRLEN_P(name)+1, 1); } else if (wFlags & DISPATCH_PROPERTYPUT) { @@ -300,7 +300,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex( VARIANT *dstvar = &pdp->rgvarg[ pdp->cArgs - 1 - i]; if ((V_VT(dstvar) & VT_BYREF) && obj->modified ) { trace("percolate modified value for arg %d VT=%08x\n", i, V_VT(dstvar)); - php_com_copy_variant(dstvar, srcvar); + php_com_copy_variant(dstvar, srcvar); } } } else { @@ -314,7 +314,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex( } else { trace("Don't know how to handle this invocation %08x\n", wFlags); } - + /* release arguments */ if (params) { for (i = 0; i < pdp->cArgs; i++) { @@ -322,7 +322,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex( } efree(params); } - + /* return value */ if (retval) { if (pvarRes) { @@ -333,7 +333,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex( } else if (pvarRes) { VariantInit(pvarRes); } - + } else { trace("InvokeEx: I don't support DISPID=%d\n", id); } @@ -341,7 +341,7 @@ static HRESULT STDMETHODCALLTYPE disp_invokeex( return ret; } -static HRESULT STDMETHODCALLTYPE disp_deletememberbyname( +static HRESULT STDMETHODCALLTYPE disp_deletememberbyname( IDispatchEx *This, /* [in] */ BSTR bstrName, /* [in] */ DWORD grfdex) @@ -353,18 +353,18 @@ static HRESULT STDMETHODCALLTYPE disp_deletememberbyname( return S_FALSE; } -static HRESULT STDMETHODCALLTYPE disp_deletememberbydispid( +static HRESULT STDMETHODCALLTYPE disp_deletememberbydispid( IDispatchEx *This, /* [in] */ DISPID id) { FETCH_DISP("DeleteMemberByDispID"); - + /* TODO: unset */ - + return S_FALSE; } -static HRESULT STDMETHODCALLTYPE disp_getmemberproperties( +static HRESULT STDMETHODCALLTYPE disp_getmemberproperties( IDispatchEx *This, /* [in] */ DISPID id, /* [in] */ DWORD grfdexFetch, @@ -375,7 +375,7 @@ static HRESULT STDMETHODCALLTYPE disp_getmemberproperties( return DISP_E_UNKNOWNNAME; } -static HRESULT STDMETHODCALLTYPE disp_getmembername( +static HRESULT STDMETHODCALLTYPE disp_getmembername( IDispatchEx *This, /* [in] */ DISPID id, /* [out] */ BSTR *pbstrName) @@ -393,7 +393,7 @@ static HRESULT STDMETHODCALLTYPE disp_getmembername( } } -static HRESULT STDMETHODCALLTYPE disp_getnextdispid( +static HRESULT STDMETHODCALLTYPE disp_getnextdispid( IDispatchEx *This, /* [in] */ DWORD grfdex, /* [in] */ DISPID id, @@ -412,7 +412,7 @@ static HRESULT STDMETHODCALLTYPE disp_getnextdispid( return S_FALSE; } -static HRESULT STDMETHODCALLTYPE disp_getnamespaceparent( +static HRESULT STDMETHODCALLTYPE disp_getnamespaceparent( IDispatchEx *This, /* [out] */ IUnknown **ppunk) { @@ -421,7 +421,7 @@ static HRESULT STDMETHODCALLTYPE disp_getnamespaceparent( *ppunk = NULL; return E_NOTIMPL; } - + static struct IDispatchExVtbl php_dispatch_vtbl = { disp_queryinterface, disp_addref, @@ -484,14 +484,14 @@ static void generate_dispids(php_dispatchex *disp) ZVAL_STR_COPY(&tmp2, name); pid = zend_hash_next_free_element(disp->dispid_to_name); zend_hash_index_update(disp->dispid_to_name, pid, &tmp2); - + ZVAL_LONG(&tmp2, pid); zend_hash_update(disp->name_to_dispid, name, &tmp2); zend_string_release(name); } } - + /* functions */ if (Z_OBJCE(disp->object)) { zend_hash_internal_pointer_reset_ex(&Z_OBJCE(disp->object)->function_table, &pos); @@ -534,7 +534,7 @@ static php_dispatchex *disp_constructor(zval *object) zval *tmp; trace("constructing a COM wrapper for PHP object %p (%s)\n", object, Z_OBJCE_P(object)->name); - + if (disp == NULL) return NULL; @@ -553,21 +553,21 @@ static php_dispatchex *disp_constructor(zval *object) tmp = zend_list_insert(disp, le_dispatch); disp->res = Z_RES_P(tmp); - + return disp; } static void disp_destructor(php_dispatchex *disp) -{ +{ /* Object store not available during request shutdown */ if (COMG(rshutdown_started)) { trace("destroying COM wrapper for PHP object %p (name:unknown)\n", Z_OBJ(disp->object)); } else { trace("destroying COM wrapper for PHP object %p (name:%s)\n", Z_OBJ(disp->object), Z_OBJCE(disp->object)->name->val); } - + disp->res = NULL; - + if (disp->refcount > 0) CoDisconnectObject((IUnknown*)disp, 0); @@ -575,7 +575,7 @@ static void disp_destructor(php_dispatchex *disp) zend_hash_destroy(disp->name_to_dispid); FREE_HASHTABLE(disp->dispid_to_name); FREE_HASHTABLE(disp->name_to_dispid); - + zval_ptr_dtor(&disp->object); CoTaskMemFree(disp); @@ -594,11 +594,11 @@ PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *si disp->dispid_to_name = id_to_name; memcpy(&disp->sinkid, sinkid, sizeof(disp->sinkid)); - + /* build up the reverse mapping */ ALLOC_HASHTABLE(disp->name_to_dispid); zend_hash_init(disp->name_to_dispid, 0, NULL, ZVAL_PTR_DTOR, 0); - + zend_hash_internal_pointer_reset_ex(id_to_name, &pos); while (HASH_KEY_NON_EXISTENT != (keytype = zend_hash_get_current_key_ex(id_to_name, &name, &pid, &pos))) { @@ -606,7 +606,7 @@ PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export_as_sink(zval *val, GUID *si if (keytype == HASH_KEY_IS_LONG) { ntmp = zend_hash_get_current_data_ex(id_to_name, &pos); - + ZVAL_LONG(&tmp, pid); zend_hash_update(disp->name_to_dispid, Z_STR_P(ntmp), &tmp); } @@ -628,7 +628,7 @@ PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export(zval *val) if (php_com_is_valid_object(val)) { /* pass back its IDispatch directly */ php_com_dotnet_object *obj = CDNO_FETCH(val); - + if (obj == NULL) return NULL; @@ -636,7 +636,7 @@ PHP_COM_DOTNET_API IDispatch *php_com_wrapper_export(zval *val) IDispatch_AddRef(V_DISPATCH(&obj->v)); return V_DISPATCH(&obj->v); } - + return NULL; } |
