INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
-static union _zend_function *com_method_get(zval **object_ptr, char *name, int len TSRMLS_DC)
+static union _zend_function *com_method_get(zval **object_ptr, zstr name, int len TSRMLS_DC)
{
zend_internal_function f, *fptr = NULL;
php_com_dotnet_object *obj;
return NULL;
}
- if (FAILED(php_com_get_id_of_name(obj, name, len, &dummy TSRMLS_CC))) {
+ if (FAILED(php_com_get_id_of_name(obj, name.s, len, &dummy TSRMLS_CC))) {
return NULL;
}
/* check cache */
- if (obj->method_cache == NULL || FAILURE == zend_hash_find(obj->method_cache, name, len, (void**)&fptr)) {
+ if (obj->method_cache == NULL || FAILURE == zend_hash_find(obj->method_cache, name.s, len, (void**)&fptr)) {
f.type = ZEND_OVERLOADED_FUNCTION;
f.num_args = 0;
f.arg_info = NULL;
f.scope = obj->ce;
f.fn_flags = 0;
- f.function_name.s = estrndup(name, len);
+ f.function_name.s = estrndup(name.s, len);
f.handler = PHP_FN(com_method_handler);
fptr = &f;
int i;
if (SUCCEEDED(ITypeInfo_GetTypeComp(obj->typeinfo, &comp))) {
- olename = php_com_string_to_olestring(name, len, obj->code_page TSRMLS_CC);
+ olename = php_com_string_to_olestring(name.s, len, obj->code_page TSRMLS_CC);
lhash = LHashValOfNameSys(SYS_WIN32, LOCALE_SYSTEM_DEFAULT, olename);
if (SUCCEEDED(ITypeComp_Bind(comp, olename, lhash, INVOKE_FUNC, &TI, &kind, &bindptr))) {
zend_hash_init(obj->method_cache, 2, NULL, function_dtor, 0);
}
- zend_hash_update(obj->method_cache, name, len, &f, sizeof(f), (void**)&fptr);
+ zend_hash_update(obj->method_cache, name.s, len, &f, sizeof(f), (void**)&fptr);
}
}
return NULL;
}
-static int com_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
+static int com_call_method(zstr method, INTERNAL_FUNCTION_PARAMETERS)
{
zval ***args = NULL;
php_com_dotnet_object *obj;
VariantInit(&v);
- if (SUCCESS == php_com_do_invoke_byref(obj, method, -1, DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, nargs, args TSRMLS_CC)) {
+ if (SUCCESS == php_com_do_invoke_byref(obj, method.s, -1, DISPATCH_METHOD|DISPATCH_PROPERTYGET, &v, nargs, args TSRMLS_CC)) {
php_com_zval_from_variant(return_value, &v, obj->code_page TSRMLS_CC);
ret = SUCCESS;
VariantClear(&v);
}
}
-static zend_class_entry *com_class_entry_get(zval *object TSRMLS_DC)
+static zend_class_entry *com_class_entry_get(const zval *object TSRMLS_DC)
{
php_com_dotnet_object *obj;
obj = CDNO_FETCH(object);
return obj->ce;
}
-static int com_class_name_get(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
+static int com_class_name_get(const zval *object, zstr *class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
{
php_com_dotnet_object *obj;
obj = CDNO_FETCH(object);
- *class_name = estrndup(obj->ce->name.s, obj->ce->name_length);
+ (*class_name).s = estrndup(obj->ce->name.s, obj->ce->name_length);
*class_name_len = obj->ce->name_length;
return 0;
php_com_dotnet_object *obj;
VARIANT v;
VARTYPE vt = VT_EMPTY;
- zval free_obj;
HRESULT res = S_OK;
obj = CDNO_FETCH(readobj);
*data = &I->zdata;
}
-static int com_iter_get_key(zend_object_iterator *iter, char **str_key, uint *str_key_len,
- ulong *int_key TSRMLS_DC)
+static int com_iter_get_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
{
struct php_com_iterator *I = (struct php_com_iterator*)iter->data;
}
} else {
/* safe array */
- if (I->key >= I->sa_max) {
+ if (I->key >= (unsigned long) I->sa_max) {
I->key = (ulong)-1;
return FAILURE;
}
return STG_E_INVALIDFUNCTION;
}
- offset = dlibMove.QuadPart;
+ offset = (off_t) dlibMove.QuadPart;
ret = php_stream_seek(stm->stream, offset, whence);
return;
}
- if (Z_REFCOUNT_P(stm) > 0) {
+ if (stm->refcount > 0) {
CoDisconnectObject((IUnknown*)stm, 0);
}
{
php_istream *stm = (php_istream*)CoTaskMemAlloc(sizeof(*stm));
- if (stm == NULL)
+ if (stm == NULL) {
return NULL;
+ }
memset(stm, 0, sizeof(*stm));
stm->engine_thread = GetCurrentThreadId();
stm->lpVtbl = &php_istream_vtbl;
- Z_SET_REFCOUNT_P(stm, 1);
+ stm->refcount = 1;
stm->stream = stream;
zend_list_addref(stream->rsrc_id);
{
php_com_saproxy *proxy = SA_FETCH(object);
zval *return_value;
- UINT dims;
+ UINT dims, i;
SAFEARRAY *sa;
LONG ubound, lbound;
- int i;
HRESULT res;
MAKE_STD_ZVAL(return_value);
args = safe_emalloc(proxy->dimensions + 1, sizeof(zval *), 0);
- for (i = 1; i < proxy->dimensions; i++) {
+ for (i = 1; i < (UINT) proxy->dimensions; i++) {
args[i-1] = proxy->indices[i];
}
args[i-1] = offset;
sa = V_ARRAY(&proxy->obj->v);
dims = SafeArrayGetDim(sa);
- if (proxy->dimensions >= dims) {
+ if ((UINT) proxy->dimensions >= dims) {
/* too many dimensions */
php_com_throw_exception(E_INVALIDARG, "too many dimensions!" TSRMLS_CC);
return return_value;
static void saproxy_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC)
{
php_com_saproxy *proxy = SA_FETCH(object);
- UINT dims;
- int i;
+ UINT dims, i;
HRESULT res;
VARIANT v;
* the final value */
zval **args = safe_emalloc(proxy->dimensions + 2, sizeof(zval *), 0);
- for (i = 1; i < proxy->dimensions; i++) {
+ for (i = 1; i < (UINT) proxy->dimensions; i++) {
args[i-1] = proxy->indices[i];
}
args[i-1] = offset;
return NULL;
}
-static union _zend_function *saproxy_method_get(zval **object, char *name, int len TSRMLS_DC)
+static union _zend_function *saproxy_method_get(const zval **object, zstr name, int len TSRMLS_DC)
{
/* no methods */
return NULL;
}
-static int saproxy_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
+static int saproxy_call_method(zstr method, INTERNAL_FUNCTION_PARAMETERS)
{
return FAILURE;
}
return NULL;
}
-static zend_class_entry *saproxy_class_entry_get(zval *object TSRMLS_DC)
+static zend_class_entry *saproxy_class_entry_get(const zval *object TSRMLS_DC)
{
return php_com_saproxy_class_entry;
}
-static int saproxy_class_name_get(zval *object, char **class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
+static int saproxy_class_name_get(const zval *object, zstr *class_name, zend_uint *class_name_len, int parent TSRMLS_DC)
{
- *class_name = estrndup(php_com_saproxy_class_entry->name.s, php_com_saproxy_class_entry->name_length);
+ (*class_name).s = estrndup(php_com_saproxy_class_entry->name.s, php_com_saproxy_class_entry->name_length);
*class_name_len = php_com_saproxy_class_entry->name_length;
return 0;
}
*data = ptr_ptr;
}
-static int saproxy_iter_get_key(zend_object_iterator *iter, char **str_key, uint *str_key_len,
- ulong *int_key TSRMLS_DC)
+static int saproxy_iter_get_key(zend_object_iterator *iter, zstr *str_key, uint *str_key_len, ulong *int_key TSRMLS_DC)
{
php_com_saproxy_iter *I = (php_com_saproxy_iter*)iter->data;
SAFEARRAYBOUND bound;
HashPosition pos;
int keytype;
- char *strindex;
+ zstr strindex;
int strindexlen;
long intindex = -1;
long max_index = 0;
static void generate_dispids(php_dispatchex *disp TSRMLS_DC)
{
HashPosition pos;
- char *name = NULL;
+ zstr name;
zval *tmp;
int namelen;
int keytype;
char namebuf[32];
if (keytype == HASH_KEY_IS_LONG) {
snprintf(namebuf, sizeof(namebuf), "%d", pid);
- name = namebuf;
+ name.s = namebuf;
namelen = strlen(namebuf)+1;
}
zend_hash_move_forward_ex(Z_OBJPROP_P(disp->object), &pos);
/* Find the existing id */
- if (zend_hash_find(disp->name_to_dispid, name, namelen, (void**)&tmp) == SUCCESS)
+ if (zend_hash_find(disp->name_to_dispid, name.s, namelen, (void**)&tmp) == SUCCESS)
continue;
/* add the mappings */
MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, name, namelen-1, 1);
+ ZVAL_STRINGL(tmp, name.s, namelen-1, 1);
pid = zend_hash_next_free_element(disp->dispid_to_name);
zend_hash_index_update(disp->dispid_to_name, pid, (void*)&tmp, sizeof(zval *), NULL);
MAKE_STD_ZVAL(tmp);
ZVAL_LONG(tmp, pid);
- zend_hash_update(disp->name_to_dispid, name, namelen, (void*)&tmp, sizeof(zval *), NULL);
+ zend_hash_update(disp->name_to_dispid, name.s, namelen, (void*)&tmp, sizeof(zval *), NULL);
}
}
char namebuf[32];
if (keytype == HASH_KEY_IS_LONG) {
snprintf(namebuf, sizeof(namebuf), "%d", pid);
- name = namebuf;
+ name.s = namebuf;
namelen = strlen(namebuf) + 1;
}
zend_hash_move_forward_ex(Z_OBJPROP_P(disp->object), &pos);
/* Find the existing id */
- if (zend_hash_find(disp->name_to_dispid, name, namelen, (void**)&tmp) == SUCCESS)
+ if (zend_hash_find(disp->name_to_dispid, name.s, namelen, (void**)&tmp) == SUCCESS)
continue;
/* add the mappings */
MAKE_STD_ZVAL(tmp);
- ZVAL_STRINGL(tmp, name, namelen-1, 1);
+ ZVAL_STRINGL(tmp, name.s, namelen-1, 1);
pid = zend_hash_next_free_element(disp->dispid_to_name);
zend_hash_index_update(disp->dispid_to_name, pid, (void*)&tmp, sizeof(zval *), NULL);
MAKE_STD_ZVAL(tmp);
ZVAL_LONG(tmp, pid);
- zend_hash_update(disp->name_to_dispid, name, namelen, (void*)&tmp, sizeof(zval *), NULL);
+ zend_hash_update(disp->name_to_dispid, name.s, namelen, (void*)&tmp, sizeof(zval *), NULL);
}
}
}
disp->engine_thread = GetCurrentThreadId();
disp->lpVtbl = &php_dispatch_vtbl;
- Z_SET_REFCOUNT_P(disp, 1);
+ disp->refcount = 1;
if (object)
disp->id = 0;
- if (Z_REFCOUNT_P(disp) > 0)
+ if (disp->refcount > 0) {
CoDisconnectObject((IUnknown*)disp, 0);
+ }
zend_hash_destroy(disp->dispid_to_name);
zend_hash_destroy(disp->name_to_dispid);
{
php_dispatchex *disp = disp_constructor(val TSRMLS_CC);
HashPosition pos;
- char *name = NULL;
+ zstr name;
zval *tmp, **ntmp;
int namelen;
int keytype;