summaryrefslogtreecommitdiff
path: root/ext/com_dotnet
diff options
context:
space:
mode:
authorMáté Kocsis <kocsismate@woohoolabs.com>2020-01-03 20:44:29 +0100
committerMáté Kocsis <kocsismate@woohoolabs.com>2020-01-03 21:10:24 +0100
commitaadd3aaed902a8f21c11984687a4e3d414a2caed (patch)
tree0bfab8aacc7044d2ed66ce86d8c92c22721ec97d /ext/com_dotnet
parentbbcfa66e06110d8256595e644378a5358dda3558 (diff)
downloadphp-git-aadd3aaed902a8f21c11984687a4e3d414a2caed.tar.gz
Use RETURN_THROWS() in various places
Diffstat (limited to 'ext/com_dotnet')
-rw-r--r--ext/com_dotnet/com_com.c8
-rw-r--r--ext/com_dotnet/com_dotnet.c10
-rw-r--r--ext/com_dotnet/com_persist.c18
-rw-r--r--ext/com_dotnet/com_variant.c8
4 files changed, 22 insertions, 22 deletions
diff --git a/ext/com_dotnet/com_com.c b/ext/com_dotnet/com_com.c
index 0ae3df5641..58c7f7b963 100644
--- a/ext/com_dotnet/com_com.c
+++ b/ext/com_dotnet/com_com.c
@@ -62,13 +62,13 @@ PHP_FUNCTION(com_create_instance)
ZEND_NUM_ARGS(), "sa|ls",
&module_name, &module_name_len, &server_params, &cp,
&typelib_name, &typelib_name_len)) {
- return;
+ RETURN_THROWS();
}
cp_it = php_win32_cp_get_by_id((DWORD)cp);
if (!cp_it) {
php_com_throw_exception(E_INVALIDARG, "Could not create COM object - invalid codepage!");
- return;
+ RETURN_THROWS();
}
obj->code_page = (int)cp;
@@ -116,7 +116,7 @@ PHP_FUNCTION(com_create_instance)
if (server_name && !COMG(allow_dcom)) {
php_com_throw_exception(E_ERROR, "DCOM has been disabled by your administrator [com.allow_dcom=0]");
- return;
+ RETURN_THROWS();
}
moniker = php_com_string_to_olestring(module_name, module_name_len, obj->code_page);
@@ -231,7 +231,7 @@ PHP_FUNCTION(com_create_instance)
php_com_throw_exception(res, msg);
efree(msg);
- return;
+ RETURN_THROWS();
}
/* we got the object and it lives ! */
diff --git a/ext/com_dotnet/com_dotnet.c b/ext/com_dotnet/com_dotnet.c
index ad35d91636..bee7116fc3 100644
--- a/ext/com_dotnet/com_dotnet.c
+++ b/ext/com_dotnet/com_dotnet.c
@@ -205,7 +205,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
snprintf(buf, sizeof(buf), "Failed to init .Net runtime [%s] %s", where, err);
php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf);
- return;
+ RETURN_THROWS();
}
stuff = (struct dotnet_runtime_stuff*)COMG(dotnet_runtime_stuff);
@@ -219,7 +219,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf);
ZVAL_NULL(object);
- return;
+ RETURN_THROWS();
}
where = "QI: System._AppDomain";
@@ -231,7 +231,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf);
ZVAL_NULL(object);
- return;
+ RETURN_THROWS();
}
}
@@ -247,7 +247,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
cp_it = php_win32_cp_get_by_id((DWORD)cp);
if (!cp_it) {
php_com_throw_exception(E_INVALIDARG, "Could not create .Net object - invalid codepage!");
- return;
+ RETURN_THROWS();
}
obj->code_page = (int)cp_it->id;
@@ -311,7 +311,7 @@ PHP_FUNCTION(com_dotnet_create_instance)
snprintf(buf, sizeof(buf), "Failed to instantiate .Net object [%s] [0x%08x] %s", where, hr, err);
php_win32_error_msg_free(err);
php_com_throw_exception(hr, buf);
- return;
+ RETURN_THROWS();
}
}
/* }}} */
diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c
index 9710972a86..521f67f121 100644
--- a/ext/com_dotnet/com_persist.c
+++ b/ext/com_dotnet/com_persist.c
@@ -289,7 +289,7 @@ PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream)
#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; }
+#define CPH_NO_OBJ() if (helper->unk == NULL) { php_com_throw_exception(E_INVALIDARG, "No COM object is associated with this helper instance"); RETURN_THROWS(); }
typedef struct {
zend_object std;
@@ -490,7 +490,7 @@ CPH_METHOD(GetMaxStreamSize)
res = IPersistStream_GetSizeMax(helper->ips, &size);
} else {
php_com_throw_exception(res, NULL);
- return;
+ RETURN_THROWS();
}
}
@@ -545,13 +545,13 @@ CPH_METHOD(LoadFromStream)
if (stream == NULL) {
php_com_throw_exception(E_INVALIDARG, "expected a stream");
- return;
+ RETURN_THROWS();
}
stm = php_com_wrapper_export_stream(stream);
if (stm == NULL) {
php_com_throw_exception(E_UNEXPECTED, "failed to wrap stream");
- return;
+ RETURN_THROWS();
}
res = S_OK;
@@ -581,7 +581,7 @@ CPH_METHOD(LoadFromStream)
if (FAILED(res)) {
php_com_throw_exception(res, NULL);
- RETURN_NULL();
+ RETURN_THROWS();
}
}
/* }}} */
@@ -606,13 +606,13 @@ CPH_METHOD(SaveToStream)
if (stream == NULL) {
php_com_throw_exception(E_INVALIDARG, "expected a stream");
- return;
+ RETURN_THROWS();
}
stm = php_com_wrapper_export_stream(stream);
if (stm == NULL) {
php_com_throw_exception(E_UNEXPECTED, "failed to wrap stream");
- return;
+ RETURN_THROWS();
}
res = get_persist_stream_init(helper);
@@ -629,7 +629,7 @@ CPH_METHOD(SaveToStream)
if (FAILED(res)) {
php_com_throw_exception(res, NULL);
- return;
+ RETURN_THROWS();
}
RETURN_TRUE;
@@ -657,7 +657,7 @@ CPH_METHOD(__construct)
if (V_VT(&obj->v) != VT_DISPATCH || V_DISPATCH(&obj->v) == NULL) {
php_com_throw_exception(E_INVALIDARG, "parameter must represent an IDispatch COM object");
- return;
+ RETURN_THROWS();
}
/* it is always safe to cast an interface to IUnknown */
diff --git a/ext/com_dotnet/com_variant.c b/ext/com_dotnet/com_variant.c
index 2a545e1221..bc4c7950e0 100644
--- a/ext/com_dotnet/com_variant.c
+++ b/ext/com_dotnet/com_variant.c
@@ -589,7 +589,7 @@ static void variant_binary_operation(enum variant_binary_opcode op, INTERNAL_FUN
php_com_variant_from_zval(vright, zright, codepage);
} else {
- return;
+ RETURN_THROWS();
}
switch (op) {
@@ -775,7 +775,7 @@ static void variant_unary_operation(enum variant_unary_opcode op, INTERNAL_FUNCT
vleft = &left_val;
php_com_variant_from_zval(vleft, zleft, codepage);
} else {
- return;
+ RETURN_THROWS();
}
switch (op) {
@@ -873,7 +873,7 @@ PHP_FUNCTION(variant_round)
vleft = &left_val;
php_com_variant_from_zval(vleft, zleft, codepage);
} else {
- return;
+ RETURN_THROWS();
}
if (SUCCEEDED(VarRound(vleft, (int)decimals, &vres))) {
@@ -933,7 +933,7 @@ PHP_FUNCTION(variant_cmp)
php_com_variant_from_zval(vright, zright, codepage);
} else {
- return;
+ RETURN_THROWS();
}
ZVAL_LONG(return_value, VarCmp(vleft, vright, (LCID)lcid, (ULONG)flags));