Skip to content

Commit f3ca081

Browse files
committed
Refactor php_com_do_invoke()
Use zend_string* Return zend_result
1 parent 4a8ca72 commit f3ca081

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

ext/com_dotnet/com_com.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -633,14 +633,14 @@ int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
633633
return SUCCEEDED(hr) ? SUCCESS : FAILURE;
634634
}
635635

636-
int php_com_do_invoke(php_com_dotnet_object *obj, char *name, size_t namelen,
637-
WORD flags, VARIANT *v, int nargs, zval *args, int allow_noarg)
636+
zend_result php_com_do_invoke(php_com_dotnet_object *obj, zend_string *name,
637+
WORD flags, VARIANT *v, int nargs, zval *args, bool allow_noarg)
638638
{
639639
DISPID dispid;
640640
HRESULT hr;
641641
char *msg = NULL;
642642

643-
hr = php_com_get_id_of_name(obj, name, namelen, &dispid);
643+
hr = php_com_get_id_of_name(obj, ZSTR_VAL(name), ZSTR_LEN(name), &dispid);
644644

645645
if (FAILED(hr)) {
646646
char *winerr = php_win32_error_to_msg(hr);

ext/com_dotnet/com_handlers.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ static zval *com_property_read(zend_object *object, zend_string *member, int typ
3838
if (V_VT(&obj->v) == VT_DISPATCH) {
3939
VariantInit(&v);
4040

41-
res = php_com_do_invoke(obj, ZSTR_VAL(member), ZSTR_LEN(member),
42-
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, 0, NULL, 1);
41+
res = php_com_do_invoke(obj, member, DISPATCH_METHOD|DISPATCH_PROPERTYGET,
42+
&v, 0, NULL, 1);
4343

4444
if (res == SUCCESS) {
4545
php_com_zval_from_variant(rv, &v, obj->code_page);
@@ -67,7 +67,7 @@ static zval *com_property_write(zend_object *object, zend_string *member, zval *
6767
if (V_VT(&obj->v) == VT_DISPATCH) {
6868
VariantInit(&v);
6969

70-
if (SUCCESS == php_com_do_invoke(obj, ZSTR_VAL(member), ZSTR_LEN(member),
70+
if (SUCCESS == php_com_do_invoke(obj, member,
7171
DISPATCH_PROPERTYPUT|DISPATCH_PROPERTYPUTREF, &v, 1, value, 0)) {
7272
VariantClear(&v);
7373
}

ext/com_dotnet/com_saproxy.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ static zval *saproxy_read_dimension(zend_object *object, zval *offset, int type,
111111
}
112112
VariantInit(&v);
113113

114-
res = php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]),
115-
Z_STRLEN(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v,
114+
res = php_com_do_invoke(proxy->obj, Z_STR(proxy->indices[0]),
115+
DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v,
116116
proxy->dimensions, args, 0);
117117

118118
efree(args);
@@ -228,8 +228,8 @@ static void saproxy_write_dimension(zend_object *object, zval *offset, zval *val
228228
return;
229229
}
230230
VariantInit(&v);
231-
if (SUCCESS == php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]),
232-
Z_STRLEN(proxy->indices[0]), DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1,
231+
if (SUCCESS == php_com_do_invoke(proxy->obj, Z_STR(proxy->indices[0]),
232+
DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1,
233233
args, 0)) {
234234
VariantClear(&v);
235235
}

ext/com_dotnet/php_com_dotnet_internal.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ HRESULT php_com_get_id_of_name(php_com_dotnet_object *obj, char *name,
9797
size_t namelen, DISPID *dispid);
9898
int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
9999
WORD flags, VARIANT *v, int nargs, zval *args, int silent, int allow_noarg);
100-
int php_com_do_invoke(php_com_dotnet_object *obj, char *name, size_t namelen,
101-
WORD flags, VARIANT *v, int nargs, zval *args, int allow_noarg);
100+
zend_result php_com_do_invoke(php_com_dotnet_object *obj, zend_string *name,
101+
WORD flags, VARIANT *v, int nargs, zval *args, bool allow_noarg);
102102
int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *f,
103103
WORD flags, VARIANT *v, int nargs, zval *args);
104104

0 commit comments

Comments
 (0)