]> granicus.if.org Git - php/commitdiff
fix datatype mismatches, remove dead part of code
authorAnatol Belski <ab@php.net>
Thu, 13 Nov 2014 13:17:41 +0000 (14:17 +0100)
committerAnatol Belski <ab@php.net>
Thu, 13 Nov 2014 18:57:29 +0000 (19:57 +0100)
ext/com_dotnet/com_typeinfo.c
ext/com_dotnet/com_variant.c

index 17b69d2460ec71019481804dce9c5b96c0c554e4..ac5777cef193f9aeb5d3a877baf949d2cb609bcb 100644 (file)
@@ -71,7 +71,7 @@ PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codep
                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))) {
@@ -96,7 +96,7 @@ PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codep
                        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,
@@ -116,7 +116,7 @@ PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib(char *search_string, int codep
                                                                        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;
index 6a81eed102acafb3369b684a3fe7e35f60cb2a84..7317b8d0e4663f1461f6d82db7f9e58ee977732e 100644 (file)
@@ -39,8 +39,7 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC)
        HashPosition pos;
        int keytype;
        zend_string *strindex;
-       zend_long intindex = -1;
-       zend_long max_index = 0;
+       zend_ulong intindex = 0;
        VARIANT *va;
        zval *item;
                
@@ -54,15 +53,15 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC)
                        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 */