diff options
Diffstat (limited to 'ext/com_dotnet/com_saproxy.c')
-rw-r--r-- | ext/com_dotnet/com_saproxy.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/ext/com_dotnet/com_saproxy.c b/ext/com_dotnet/com_saproxy.c index 886bd808f9..ddee9bc179 100644 --- a/ext/com_dotnet/com_saproxy.c +++ b/ext/com_dotnet/com_saproxy.c @@ -1,6 +1,6 @@ /* +----------------------------------------------------------------------+ - | PHP Version 5 | + | PHP Version 7 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2014 The PHP Group | +----------------------------------------------------------------------+ @@ -113,7 +113,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * VariantInit(&v); res = php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]), - Z_STRSIZE(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, + Z_STRLEN(proxy->indices[0]), DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, proxy->dimensions, args, 0 TSRMLS_CC); if (res == SUCCESS) { @@ -134,7 +134,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * /* the SafeArray case */ /* offset/index must be an integer */ - convert_to_int(offset); + convert_to_long(offset); sa = V_ARRAY(&proxy->obj->v); dims = SafeArrayGetDim(sa); @@ -149,7 +149,7 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * SafeArrayGetLBound(sa, proxy->dimensions, &lbound); SafeArrayGetUBound(sa, proxy->dimensions, &ubound); - if (Z_IVAL_P(offset) < lbound || Z_IVAL_P(offset) > ubound) { + if (Z_LVAL_P(offset) < lbound || Z_LVAL_P(offset) > ubound) { php_com_throw_exception(DISP_E_BADINDEX, "index out of bounds" TSRMLS_CC); return rv; } @@ -166,12 +166,12 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * /* copy indices from proxy */ for (i = 0; i < dims; i++) { - convert_to_int(&proxy->indices[i]); - indices[i] = Z_IVAL(proxy->indices[i]); + convert_to_long(&proxy->indices[i]); + indices[i] = Z_LVAL(proxy->indices[i]); } /* add user-supplied index */ - indices[dims-1] = Z_IVAL_P(offset); + indices[dims-1] = Z_LVAL_P(offset); /* now fetch the value */ if (FAILED(SafeArrayGetVartype(sa, &vt)) || vt == VT_EMPTY) { @@ -225,7 +225,7 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value TSRM convert_to_string(&proxy->indices[0]); VariantInit(&v); if (SUCCESS == php_com_do_invoke(proxy->obj, Z_STRVAL(proxy->indices[0]), - Z_STRSIZE(proxy->indices[0]), DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1, + Z_STRLEN(proxy->indices[0]), DISPATCH_PROPERTYPUT, &v, proxy->dimensions + 1, args, 0 TSRMLS_CC)) { VariantClear(&v); } @@ -240,13 +240,13 @@ static void saproxy_write_dimension(zval *object, zval *offset, zval *value TSRM indices = safe_emalloc(dims, sizeof(LONG), 0); /* copy indices from proxy */ for (i = 0; i < dims; i++) { - convert_to_int(&proxy->indices[i]); - indices[i] = Z_IVAL(proxy->indices[i]); + convert_to_long(&proxy->indices[i]); + indices[i] = Z_LVAL(proxy->indices[i]); } /* add user-supplied index */ - convert_to_int(offset); - indices[dims-1] = Z_IVAL_P(offset); + convert_to_long(offset); + indices[dims-1] = Z_LVAL_P(offset); if (FAILED(SafeArrayGetVartype(V_ARRAY(&proxy->obj->v), &vt)) || vt == VT_EMPTY) { vt = V_VT(&proxy->obj->v) & ~VT_ARRAY; @@ -333,14 +333,9 @@ static union _zend_function *saproxy_constructor_get(zend_object *object TSRMLS_ return NULL; } -static zend_class_entry *saproxy_class_entry_get(const zend_object *object TSRMLS_DC) +static zend_string* saproxy_class_name_get(const zend_object *object TSRMLS_DC) { - return php_com_saproxy_class_entry; -} - -static zend_string* saproxy_class_name_get(const zend_object *object, int parent TSRMLS_DC) -{ - return STR_COPY(php_com_saproxy_class_entry->name); + return zend_string_copy(php_com_saproxy_class_entry->name); } static int saproxy_objects_compare(zval *object1, zval *object2 TSRMLS_DC) @@ -353,7 +348,7 @@ static int saproxy_object_cast(zval *readobj, zval *writeobj, int type TSRMLS_DC return FAILURE; } -static int saproxy_count_elements(zval *object, php_int_t *count TSRMLS_DC) +static int saproxy_count_elements(zval *object, zend_long *count TSRMLS_DC) { php_com_saproxy *proxy = SA_FETCH(object); LONG ubound, lbound; @@ -420,7 +415,6 @@ zend_object_handlers php_com_saproxy_handlers = { saproxy_method_get, saproxy_call_method, saproxy_constructor_get, - saproxy_class_entry_get, saproxy_class_name_get, saproxy_objects_compare, saproxy_object_cast, @@ -516,7 +510,7 @@ static void saproxy_iter_get_key(zend_object_iterator *iter, zval *key TSRMLS_DC if (I->key == -1) { ZVAL_NULL(key); } else { - ZVAL_INT(key, I->key); + ZVAL_LONG(key, I->key); } } @@ -560,8 +554,8 @@ zend_object_iterator *php_com_saproxy_iter_get(zend_class_entry *ce, zval *objec I->indices = safe_emalloc(proxy->dimensions + 1, sizeof(LONG), 0); for (i = 0; i < proxy->dimensions; i++) { - convert_to_int(&proxy->indices[i]); - I->indices[i] = Z_IVAL(proxy->indices[i]); + convert_to_long(&proxy->indices[i]); + I->indices[i] = Z_LVAL(proxy->indices[i]); } SafeArrayGetLBound(V_ARRAY(&proxy->obj->v), proxy->dimensions, &I->imin); |