summaryrefslogtreecommitdiff
path: root/ext/com_dotnet/com_dotnet.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/com_dotnet/com_dotnet.c')
-rw-r--r--ext/com_dotnet/com_dotnet.c53
1 files changed, 25 insertions, 28 deletions
diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c
index 9db238b089..c8e2bc105b 100644
--- a/ext/com_dotnet/com_dotnet.c
+++ b/ext/com_dotnet/com_dotnet.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
@@ -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)
@@ -121,7 +121,7 @@ struct dotnet_runtime_stuff {
DISPID create_instance;
};
-static HRESULT dotnet_init(char **p_where TSRMLS_DC)
+static HRESULT dotnet_init(char **p_where)
{
HRESULT hr;
struct dotnet_runtime_stuff *stuff;
@@ -146,7 +146,7 @@ static HRESULT dotnet_init(char **p_where TSRMLS_DC)
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 TSRMLS_DC)
hr = IUnknown_QueryInterface(unk, &IID_mscorlib_System_AppDomain, (LPVOID*)&stuff->dotnet_domain);
if (FAILED(hr))
goto out;
-
+
COMG(dotnet_runtime_stuff) = stuff;
out:
@@ -188,7 +188,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
zval *object = getThis();
php_com_dotnet_object *obj;
char *assembly_name, *datatype_name;
- int assembly_name_len, datatype_name_len;
+ size_t assembly_name_len, datatype_name_len;
struct dotnet_runtime_stuff *stuff;
OLECHAR *oleassembly, *oletype;
BSTR oleassembly_sys, oletype_sys;
@@ -197,18 +197,17 @@ PHP_FUNCTION(com_dotnet_create_instance)
char *where = "";
IUnknown *unk = NULL;
- php_com_initialize(TSRMLS_C);
+ php_com_initialize();
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
if (stuff == NULL) {
- hr = dotnet_init(&where TSRMLS_CC);
+ hr = dotnet_init(&where);
if (FAILED(hr)) {
char buf[1024];
char *err = php_win32_error_to_msg(hr);
snprintf(buf, sizeof(buf), "Failed to init .Net runtime [%s] %s", where, err);
if (err)
LocalFree(err);
- php_com_throw_exception(hr, buf TSRMLS_CC);
- ZVAL_NULL(object);
+ php_com_throw_exception(hr, buf);
return;
}
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
@@ -222,7 +221,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] %s", where, err);
if (err)
LocalFree(err);
- php_com_throw_exception(hr, buf TSRMLS_CC);
+ php_com_throw_exception(hr, buf);
ZVAL_NULL(object);
return;
}
@@ -235,7 +234,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
snprintf(buf, sizeof(buf), "Failed to re-init .Net domain [%s] %s", where, err);
if (err)
LocalFree(err);
- php_com_throw_exception(hr, buf TSRMLS_CC);
+ php_com_throw_exception(hr, buf);
ZVAL_NULL(object);
return;
}
@@ -243,17 +242,16 @@ PHP_FUNCTION(com_dotnet_create_instance)
obj = CDNO_FETCH(object);
- if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|l",
+ if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l",
&assembly_name, &assembly_name_len,
&datatype_name, &datatype_name_len,
&obj->code_page)) {
- php_com_throw_exception(E_INVALIDARG, "Could not create .Net object - invalid arguments!" TSRMLS_CC);
- ZVAL_NULL(object);
+ php_com_throw_exception(E_INVALIDARG, "Could not create .Net object - invalid arguments!");
return;
}
- oletype = php_com_string_to_olestring(datatype_name, datatype_name_len, obj->code_page TSRMLS_CC);
- oleassembly = php_com_string_to_olestring(assembly_name, assembly_name_len, obj->code_page TSRMLS_CC);
+ oletype = php_com_string_to_olestring(datatype_name, datatype_name_len, obj->code_page);
+ oleassembly = php_com_string_to_olestring(assembly_name, assembly_name_len, obj->code_page);
oletype_sys = SysAllocString(oletype);
oleassembly_sys = SysAllocString(oleassembly);
where = "CreateInstance";
@@ -313,17 +311,16 @@ PHP_FUNCTION(com_dotnet_create_instance)
if (err && err[0]) {
LocalFree(err);
}
- php_com_throw_exception(hr, buf TSRMLS_CC);
- ZVAL_NULL(object);
+ php_com_throw_exception(hr, buf);
return;
}
}
/* }}} */
-void php_com_dotnet_mshutdown(TSRMLS_D)
+void php_com_dotnet_mshutdown(void)
{
struct dotnet_runtime_stuff *stuff = COMG(dotnet_runtime_stuff);
-
+
if (stuff->dotnet_domain) {
IDispatch_Release(stuff->dotnet_domain);
}
@@ -336,10 +333,10 @@ void php_com_dotnet_mshutdown(TSRMLS_D)
COMG(dotnet_runtime_stuff) = NULL;
}
-void php_com_dotnet_rshutdown(TSRMLS_D)
+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;