--- a/src/preferences.c
+++ b/src/preferences.c
@@ -79,7 +79,7 @@
   pref_t *parent = page->parent ? page->parent->data : NULL;
   GNode *child;
 
-  if (parent && parent->notebook == (void *) 1)
+  if (parent && parent->notebook == GINT_TO_POINTER (1))
     return 0; /* called too early */
 
   child = g_node_first_child (page);
@@ -135,7 +135,7 @@
   static const int experience_values[] = { 0, 10, 20, 30 };
   int exp = *(int *)data;
 
-  if (exp >= 0 && exp < G_N_ELEMENTS (experience_values))
+  if (exp >= 0 && exp < (int) G_N_ELEMENTS (experience_values))
     exp = experience_values[exp];
   else
     exp = 0;
@@ -402,7 +402,7 @@
 static GNode *create_page (const char *key, size_t length)
 {
   pref_page_t *page = malloc (sizeof (pref_page_t));
-  page->notebook = (void *) 1; /* dummy value - filled in later */
+  page->notebook = GINT_TO_POINTER (1); /* dummy value - filled in later */
   page->page = page->table = NULL;
   page->prefix = malloc (length + 1);
   sprintf (page->prefix, "%.*s", length, key);