[libvirt] [libvirt-php PATCH 24/35] fix parse_array + build warnings

Neal Gompa ngompa13 at gmail.com
Fri Apr 8 22:08:33 UTC 2016


From: Remi Collet <fedora at famillecollet.com>

---
 src/libvirt-php.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index af80f06..511dcaa 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -1128,11 +1128,11 @@ static void catch_error(void *userData,
  *                          @mem [uint]: memory location of the resource to be freed
  * Returns:                 None
  */
-void free_resource(int type, arch_uint mem TSRMLS_DC)
+void free_resource(int type, void *mem TSRMLS_DC)
 {
     int rv;
 
-    DPRINTF("%s: Freeing libvirt %s resource at 0x%"UINTx"\n", __FUNCTION__, translate_counter_type(type), mem);
+    DPRINTF("%s: Freeing libvirt %s resource at 0x%lx\n", __FUNCTION__, translate_counter_type(type), (unsigned long)mem);
 
     if (type == INT_RESOURCE_DOMAIN) {
         rv = virDomainFree( (virDomainPtr)mem );
@@ -1269,8 +1269,8 @@ int check_resource_allocation(virConnectPtr conn, int type, void *mem TSRMLS_DC)
             allocated = 1;
     }
 
-    DPRINTF("%s: libvirt %s resource 0x%"UINTx" (conn %p) is%s allocated\n", __FUNCTION__, translate_counter_type(type),
-            mem, conn, !allocated ? " not" : "");
+    DPRINTF("%s: libvirt %s resource 0x%lx (conn %p) is%s allocated\n", __FUNCTION__, translate_counter_type(type),
+            (unsigned long)mem, conn, !allocated ? " not" : "");
     return allocated;
 }
 
@@ -5365,12 +5365,13 @@ void parse_array(zval *arr, tVMDisk *disk, tVMNetwork *network)
                     else if ((Z_TYPE_P(data) == IS_STRING) && strcmp(ZSTR_VAL(key), "dev") == 0)
                         disk->dev = strdup( Z_STRVAL_P(data) );
                     else if (strcmp(ZSTR_VAL(key), "size") == 0) {
-                        if (Z_TYPE_P(data) == IS_LONG)
+                        if (Z_TYPE_P(data) == IS_LONG) {
                             disk->size = Z_LVAL_P(data);
-                        else
+                        } else {
                             disk->size = size_def_to_mbytes(Z_STRVAL_P(data));
+                        }
                     }
-                    else if ((Z_TYPE_P(data) == IS_LONG) && strcmp(ZSTR_VAL(key), "dev") == 0)
+                    else if ((Z_TYPE_P(data) == IS_LONG) && strcmp(ZSTR_VAL(key), "flags") == 0)
                         disk->flags = Z_LVAL_P(data);
                 } else {
                     if (network != NULL) {
-- 
2.5.5




More information about the libvir-list mailing list