if (FAILED(hr) && (major == NULL || minor == NULL)) {
IDispatch *disp = NULL;
ITypeInfo *info = NULL;
- int idx;
+ UINT idx;
if (SUCCEEDED(hr = CoCreateInstance(&clsid, NULL, CLSCTX_SERVER, &IID_IDispatch, (LPVOID*)&disp)) &&
SUCCEEDED(hr = IDispatch_GetTypeInfo(disp, 0, LANG_NEUTRAL, &info))) {
DWORD VersionCount;
char version[20];
char *libname;
- DWORD libnamelen;
+ long libnamelen;
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CLASSES_ROOT, "TypeLib", 0, KEY_READ, &hkey) &&
ERROR_SUCCESS == RegQueryInfoKey(hkey, NULL, NULL, NULL, &SubKeys,
continue;
}
/* get the default value for this key and compare */
- libnamelen = (DWORD)strlen(search_string)+1;
+ libnamelen = (long)strlen(search_string)+1;
if (ERROR_SUCCESS == RegQueryValue(hsubkey, version, libname, &libnamelen)) {
if (0 == stricmp(libname, search_string)) {
char *str = NULL;
HashPosition pos;
int keytype;
zend_string *strindex;
- zend_long intindex = -1;
- zend_long max_index = 0;
+ zend_ulong intindex = 0;
VARIANT *va;
zval *item;
goto bogus;
} else if (HASH_KEY_NON_EXISTENT == keytype) {
break;
- }
- if (intindex > max_index) {
- max_index = intindex;
+ } else if (intindex > UINT_MAX) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "COM: max number %u of elements in safe array exceeded", UINT_MAX);
+ break;
}
}
/* allocate the structure */
bound.lLbound = 0;
- bound.cElements = (ULONG)(intindex + 1);
+ bound.cElements = zend_hash_num_elements(HASH_OF(z));
sa = SafeArrayCreate(VT_VARIANT, 1, &bound);
/* get a lock on the array itself */