if (user_name) {
authid.User = php_com_string_to_olestring(user_name, -1, obj->code_page TSRMLS_CC);
- authid.UserLength = user_name_len;
+ authid.UserLength = (ULONG)user_name_len;
if (password) {
authid.Password = (OLECHAR*)password;
- authid.PasswordLength = password_len;
+ authid.PasswordLength = (ULONG)password_len;
} else {
authid.Password = (OLECHAR*)"";
authid.PasswordLength = 0;
if (domain_name) {
authid.Domain = (OLECHAR*)domain_name;
- authid.DomainLength = domain_name_len;
+ authid.DomainLength = (ULONG)domain_name_len;
} else {
authid.Domain = (OLECHAR*)"";
authid.DomainLength = 0;
{
CLSID clsid;
char *module_name;
- int module_name_len;
+ size_t module_name_len;
zend_long code_page = COMG(code_page);
IUnknown *unk = NULL;
IDispatch *obj = NULL;
return;
}
- module = php_com_string_to_olestring(module_name, module_name_len, code_page TSRMLS_CC);
+ module = php_com_string_to_olestring(module_name, module_name_len, (int)code_page TSRMLS_CC);
res = CLSIDFromString(module, &clsid);
php_com_throw_exception(res, NULL TSRMLS_CC);
} else if (obj) {
/* we got our dispatchable object */
- php_com_wrap_dispatch(return_value, obj, code_page TSRMLS_CC);
+ php_com_wrap_dispatch(return_value, obj, (int)code_page TSRMLS_CC);
}
}
}
}
if (obj->id_of_name_cache && NULL != (tmp = zend_hash_str_find(obj->id_of_name_cache, name, namelen))) {
- *dispid = Z_LVAL_P(tmp);
+ *dispid = (DISPID)Z_LVAL_P(tmp);
return S_OK;
}
return SUCCEEDED(hr) ? SUCCESS : FAILURE;
}
-int php_com_do_invoke(php_com_dotnet_object *obj, char *name, int namelen,
+int php_com_do_invoke(php_com_dotnet_object *obj, char *name, size_t namelen,
WORD flags, VARIANT *v, int nargs, zval *args, int allow_noarg TSRMLS_DC)
{
DISPID dispid;
RETURN_FALSE;
php_com_initialize(TSRMLS_C);
- result = MsgWaitForMultipleObjects(0, NULL, FALSE, timeoutms, QS_ALLINPUT);
+ result = MsgWaitForMultipleObjects(0, NULL, FALSE, (DWORD)timeoutms, QS_ALLINPUT);
if (result == WAIT_OBJECT_0) {
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
convert_to_long(offset);
if (SafeArrayGetDim(V_ARRAY(&obj->v)) == 1) {
- if (php_com_safearray_get_elem(&obj->v, &v, Z_LVAL_P(offset) TSRMLS_CC)) {
+ if (php_com_safearray_get_elem(&obj->v, &v, (LONG)Z_LVAL_P(offset) TSRMLS_CC)) {
php_com_wrap_variant(rv, &v, obj->code_page TSRMLS_CC);
VariantClear(&v);
}
}
convert_to_long(offset);
- indices = Z_LVAL_P(offset);
+ indices = (LONG)Z_LVAL_P(offset);
VariantInit(&v);
php_com_variant_from_zval(&v, value, obj->code_page TSRMLS_CC);
/* XXX if that's a real multibyte string, olestring is obviously allocated excessively.
This should be fixed by reallocating the olestring, but as emalloc is used, that doesn't
matter much. */
- ok = MultiByteToWideChar(codepage, flags, string, string_len, olestring, string_len);
+ ok = MultiByteToWideChar(codepage, flags, string, (int)string_len, olestring, (int)string_len);
if (ok > 0 && ok < string_len) {
olestring[ok] = '\0';
}
static HRESULT STDMETHODCALLTYPE stm_read(IStream *This, void *pv, ULONG cb, ULONG *pcbRead)
{
- int nread;
+ ULONG nread;
FETCH_STM();
- nread = php_stream_read(stm->stream, pv, cb);
+ nread = (ULONG)php_stream_read(stm->stream, pv, cb);
if (pcbRead) {
*pcbRead = nread > 0 ? nread : 0;
static HRESULT STDMETHODCALLTYPE stm_write(IStream *This, void const *pv, ULONG cb, ULONG *pcbWritten)
{
- int nwrote;
+ ULONG nwrote;
FETCH_STM();
- nwrote = php_stream_write(stm->stream, pv, cb);
+ nwrote = (ULONG)php_stream_write(stm->stream, pv, cb);
if (pcbWritten) {
*pcbWritten = nwrote > 0 ? nwrote : 0;
olefilename = php_com_string_to_olestring(fullpath, strlen(fullpath), helper->codepage TSRMLS_CC);
efree(fullpath);
- res = IPersistFile_Load(helper->ipf, olefilename, flags);
+ res = IPersistFile_Load(helper->ipf, olefilename, (DWORD)flags);
efree(olefilename);
if (FAILED(res)) {
/* copy indices from proxy */
for (i = 0; i < dims; i++) {
convert_to_long(&proxy->indices[i]);
- indices[i] = Z_LVAL(proxy->indices[i]);
+ indices[i] = (LONG)Z_LVAL(proxy->indices[i]);
}
/* add user-supplied index */
- indices[dims-1] = Z_LVAL_P(offset);
+ indices[dims-1] = (LONG)Z_LVAL_P(offset);
/* now fetch the value */
if (FAILED(SafeArrayGetVartype(sa, &vt)) || vt == VT_EMPTY) {
/* copy indices from proxy */
for (i = 0; i < dims; i++) {
convert_to_long(&proxy->indices[i]);
- indices[i] = Z_LVAL(proxy->indices[i]);
+ indices[i] = (LONG)Z_LVAL(proxy->indices[i]);
}
/* add user-supplied index */
convert_to_long(offset);
- indices[dims-1] = Z_LVAL_P(offset);
+ indices[dims-1] = (LONG)Z_LVAL_P(offset);
if (FAILED(SafeArrayGetVartype(V_ARRAY(&proxy->obj->v), &vt)) || vt == VT_EMPTY) {
vt = V_VT(&proxy->obj->v) & ~VT_ARRAY;
I->indices = safe_emalloc(proxy->dimensions + 1, sizeof(LONG), 0);
for (i = 0; i < proxy->dimensions; i++) {
convert_to_long(&proxy->indices[i]);
- I->indices[i] = Z_LVAL(proxy->indices[i]);
+ I->indices[i] = (LONG)Z_LVAL(proxy->indices[i]);
}
SafeArrayGetLBound(V_ARRAY(&proxy->obj->v), proxy->dimensions, &I->imin);
continue;
}
/* get the default value for this key and compare */
- libnamelen = strlen(search_string)+1;
+ libnamelen = (DWORD)strlen(search_string)+1;
if (ERROR_SUCCESS == RegQueryValue(hsubkey, version, libname, &libnamelen)) {
if (0 == stricmp(libname, search_string)) {
char *str = NULL;
{
ITypeLib *TL;
char *name_dup;
- int l;
+ size_t l;
l = strlen(search_string);
/* allocate the structure */
bound.lLbound = 0;
- bound.cElements = intindex + 1;
+ bound.cElements = (ULONG)(intindex + 1);
sa = SafeArrayCreate(VT_VARIANT, 1, &bound);
/* get a lock on the array itself */
break;
case IS_LONG:
+#if SIZEOF_ZEND_LONG == 4
V_VT(v) = VT_I4;
V_I4(v) = Z_LVAL_P(z);
+#else
+ V_VT(v) = VT_I8;
+ V_I8(v) = Z_LVAL_P(z);
+#endif
break;
case IS_DOUBLE:
V_VT(v) = VT_BSTR;
olestring = php_com_string_to_olestring(Z_STRVAL_P(z), Z_STRLEN_P(z), codepage TSRMLS_CC);
if (CP_UTF8 == codepage) {
- V_BSTR(v) = SysAllocStringByteLen((char*)olestring, wcslen(olestring) * sizeof(OLECHAR));
+ V_BSTR(v) = SysAllocStringByteLen((char*)olestring, (UINT)(wcslen(olestring) * sizeof(OLECHAR)));
} else {
- V_BSTR(v) = SysAllocStringByteLen((char*)olestring, Z_STRLEN_P(z) * sizeof(OLECHAR));
+ V_BSTR(v) = SysAllocStringByteLen((char*)olestring, (UINT)(Z_STRLEN_P(z) * sizeof(OLECHAR)));
}
efree(olestring);
break;
php_com_initialize(TSRMLS_C);
if (ZEND_NUM_ARGS() == 3) {
- obj->code_page = codepage;
+ obj->code_page = (int)codepage;
}
if (zvalue) {
return;
}
- if (SUCCEEDED(VarRound(vleft, decimals, &vres))) {
+ if (SUCCEEDED(VarRound(vleft, (int)decimals, &vres))) {
php_com_wrap_variant(return_value, &vres, codepage TSRMLS_CC);
}
return;
}
- ZVAL_LONG(return_value, VarCmp(vleft, vright, lcid, flags));
+ ZVAL_LONG(return_value, VarCmp(vleft, vright, (LCID)lcid, (ULONG)flags));
VariantClear(&left_val);
VariantClear(&right_val);
ret = DISP_E_UNKNOWNNAME;
rgDispId[i] = 0;
} else {
- rgDispId[i] = Z_LVAL_P(tmp);
+ rgDispId[i] = (DISPID)Z_LVAL_P(tmp);
}
efree(name);
/* Lookup the name in the hash */
if ((tmp = zend_hash_str_find(disp->name_to_dispid, name, namelen)) != NULL) {
trace("found it\n");
- *pid = Z_LVAL_P(tmp);
+ *pid = (DISPID)Z_LVAL_P(tmp);
ret = S_OK;
}
VARIANT v;
int modified;
+ int code_page;
+
ITypeInfo *typeinfo;
- zend_long code_page;
zend_class_entry *ce;
size_t namelen, DISPID *dispid TSRMLS_DC);
int php_com_do_invoke_by_id(php_com_dotnet_object *obj, DISPID dispid,
WORD flags, VARIANT *v, int nargs, zval *args, int silent, int allow_noarg TSRMLS_DC);
-int php_com_do_invoke(php_com_dotnet_object *obj, char *name, int namelen,
+int php_com_do_invoke(php_com_dotnet_object *obj, char *name, size_t namelen,
WORD flags, VARIANT *v, int nargs, zval *args, int allow_noarg TSRMLS_DC);
int php_com_do_invoke_byref(php_com_dotnet_object *obj, zend_internal_function *f,
WORD flags, VARIANT *v, int nargs, zval *args TSRMLS_DC);