diff options
author | Stanislav Malyshev <stas@php.net> | 2015-01-03 01:22:58 -0800 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2015-01-10 15:07:38 -0800 |
commit | b7a7b1a624c97945c0aaa49d46ae996fc0bdb6bc (patch) | |
tree | 0e09490075ee4f9a75a77ef4168d8ee254c52e5b /ext/com_dotnet/com_wrapper.c | |
parent | 773c8b0c092a0e9ad5c5548815bcb9991d54d5c1 (diff) | |
download | php-git-b7a7b1a624c97945c0aaa49d46ae996fc0bdb6bc.tar.gz |
trailing whitespace removal
Diffstat (limited to 'ext/com_dotnet/com_wrapper.c')
-rw-r--r-- | ext/com_dotnet/com_wrapper.c | 100 |
1 files changed, 50 insertions, 50 deletions
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; } |