diff options
author | Dmitry Stogov <dmitry@zend.com> | 2019-02-04 12:07:11 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2019-02-04 13:20:25 +0300 |
commit | db0079023421b8048f090ee04adb992e09132553 (patch) | |
tree | 900837d4841f2932cd7fcfabb0683c62a4f8e457 /ext/com_dotnet/com_saproxy.c | |
parent | 1a304d357ce8f72e031e627e8e5a1a7d2b0a5dca (diff) | |
download | php-git-db0079023421b8048f090ee04adb992e09132553.tar.gz |
ext/com_dotnet support for new object handlers API
Diffstat (limited to 'ext/com_dotnet/com_saproxy.c')
-rw-r--r-- | ext/com_dotnet/com_saproxy.c | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/ext/com_dotnet/com_saproxy.c b/ext/com_dotnet/com_saproxy.c index 170f2018e2..24b6fa2752 100644 --- a/ext/com_dotnet/com_saproxy.c +++ b/ext/com_dotnet/com_saproxy.c @@ -37,7 +37,6 @@ typedef struct { zend_object std; /* the object we a proxying for; we hold a refcount to it */ - zval *zobj; php_com_dotnet_object *obj; /* how many dimensions we are indirecting to get into this element */ @@ -69,7 +68,7 @@ static inline void clone_indices(php_com_saproxy *dest, php_com_saproxy *src, in } } -static zval *saproxy_property_read(zval *object, zval *member, int type, void **cache_slot, zval *rv) +static zval *saproxy_property_read(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv) { ZVAL_NULL(rv); @@ -78,14 +77,14 @@ static zval *saproxy_property_read(zval *object, zval *member, int type, void ** return rv; } -static void saproxy_property_write(zval *object, zval *member, zval *value, void **cache_slot) +static void saproxy_property_write(zend_object *object, zend_string *member, zval *value, void **cache_slot) { php_com_throw_exception(E_INVALIDARG, "safearray has no properties"); } -static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval *rv) +static zval *saproxy_read_dimension(zend_object *object, zval *offset, int type, zval *rv) { - php_com_saproxy *proxy = SA_FETCH(object); + php_com_saproxy *proxy = (php_com_saproxy*) object; UINT dims, i; SAFEARRAY *sa; LONG ubound, lbound; @@ -201,9 +200,9 @@ static zval *saproxy_read_dimension(zval *object, zval *offset, int type, zval * return rv; } -static void saproxy_write_dimension(zval *object, zval *offset, zval *value) +static void saproxy_write_dimension(zend_object *object, zval *offset, zval *value) { - php_com_saproxy *proxy = SA_FETCH(object); + php_com_saproxy *proxy = (php_com_saproxy*) object; UINT dims, i; HRESULT res; VARIANT v; @@ -286,29 +285,29 @@ static zval *saproxy_object_get(zval *property) } #endif -static int saproxy_property_exists(zval *object, zval *member, int check_empty, void **cache_slot) +static int saproxy_property_exists(zend_object *object, zend_string *member, int check_empty, void **cache_slot) { /* no properties */ return 0; } -static int saproxy_dimension_exists(zval *object, zval *member, int check_empty) +static int saproxy_dimension_exists(zend_object *object, zval *member, int check_empty) { php_error_docref(NULL, E_WARNING, "Operation not yet supported on a COM object"); return 0; } -static void saproxy_property_delete(zval *object, zval *member, void **cache_slot) +static void saproxy_property_delete(zend_object *object, zend_string *member, void **cache_slot) { php_error_docref(NULL, E_WARNING, "Cannot delete properties from a COM object"); } -static void saproxy_dimension_delete(zval *object, zval *offset) +static void saproxy_dimension_delete(zend_object *object, zval *offset) { php_error_docref(NULL, E_WARNING, "Cannot delete properties from a COM object"); } -static HashTable *saproxy_properties_get(zval *object) +static HashTable *saproxy_properties_get(zend_object *object) { /* no properties */ return NULL; @@ -341,14 +340,14 @@ static int saproxy_objects_compare(zval *object1, zval *object2) return -1; } -static int saproxy_object_cast(zval *readobj, zval *writeobj, int type) +static int saproxy_object_cast(zend_object *readobj, zval *writeobj, int type) { return FAILURE; } -static int saproxy_count_elements(zval *object, zend_long *count) +static int saproxy_count_elements(zend_object *object, zend_long *count) { - php_com_saproxy *proxy = SA_FETCH(object); + php_com_saproxy *proxy = (php_com_saproxy*) object; LONG ubound, lbound; if (!V_ISARRAY(&proxy->obj->v)) { @@ -374,19 +373,19 @@ static void saproxy_free_storage(zend_object *object) //??? } //??? } - zval_ptr_dtor(proxy->zobj); + OBJ_RELEASE(&proxy->obj->zo); efree(proxy->indices); } -static zend_object* saproxy_clone(zval *object) +static zend_object* saproxy_clone(zend_object *object) { - php_com_saproxy *proxy = (php_com_saproxy *)Z_OBJ_P(object); + php_com_saproxy *proxy = (php_com_saproxy *) object; php_com_saproxy *cloneproxy; cloneproxy = emalloc(sizeof(*cloneproxy)); memcpy(cloneproxy, proxy, sizeof(*cloneproxy)); - Z_ADDREF_P(cloneproxy->zobj); + GC_ADDREF(&cloneproxy->obj->zo); cloneproxy->indices = safe_emalloc(cloneproxy->dimensions, sizeof(zval *), 0); clone_indices(cloneproxy, proxy, proxy->dimensions); @@ -419,24 +418,22 @@ zend_object_handlers php_com_saproxy_handlers = { saproxy_count_elements }; -int php_com_saproxy_create(zval *com_object, zval *proxy_out, zval *index) +int php_com_saproxy_create(zend_object *com_object, zval *proxy_out, zval *index) { php_com_saproxy *proxy, *rel = NULL; proxy = ecalloc(1, sizeof(*proxy)); proxy->dimensions = 1; - if (Z_OBJCE_P(com_object) == php_com_saproxy_class_entry) { - rel = SA_FETCH(com_object); + if (com_object->ce == php_com_saproxy_class_entry) { + rel = (php_com_saproxy*) com_object; proxy->obj = rel->obj; - proxy->zobj = rel->zobj; proxy->dimensions += rel->dimensions; } else { - proxy->obj = CDNO_FETCH(com_object); - proxy->zobj = com_object; + proxy->obj = (php_com_dotnet_object*) com_object; } - Z_ADDREF_P(proxy->zobj); + Z_ADDREF_P(&proxy->obj->zo); proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval *), 0); if (rel) { |