[glib] Bug 612502 - build fails on glib/tests/gvariant.c



commit 751feb916ab2f0cd74839233101fc0b9d2fb994c
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Mar 15 17:45:02 2010 -0400

    Bug 612502 - build fails on glib/tests/gvariant.c
    
    Fix two problems caught by Tim Rice.
    
      - non-constant expression used as array size
      - arithmetic on void *

 glib/tests/gvariant.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
index 616ec25..610fb65 100644
--- a/glib/tests/gvariant.c
+++ b/glib/tests/gvariant.c
@@ -1251,7 +1251,7 @@ flavoured_malloc (gsize size, gsize flavour)
   if (size == 0)
     return NULL;
 
-  return g_malloc (size + flavour) + flavour;
+  return ((gchar *) g_malloc (size + flavour)) + flavour;
 }
 
 static void
@@ -3341,8 +3341,7 @@ test_builder_memory (void)
 static void
 test_hashing (void)
 {
-  const gint n_items = 4096;
-  GVariant *items[n_items];
+  GVariant *items[4096];
   GHashTable *table;
   gint i;
 
@@ -3350,7 +3349,7 @@ test_hashing (void)
                                  (GDestroyNotify ) g_variant_unref,
                                  NULL);
 
-  for (i = 0; i < n_items; i++)
+  for (i = 0; i < G_N_ELEMENTS (items); i++)
     {
       TreeInstance *tree;
       gint j;
@@ -3372,7 +3371,7 @@ test_hashing (void)
                            GINT_TO_POINTER (i));
     }
 
-  for (i = 0; i < n_items; i++)
+  for (i = 0; i < G_N_ELEMENTS (items); i++)
     {
       gpointer result;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]