[build] Fix int/gpointer type conversion

This patch uses the glib conversion macros to covert between int and gpointer.
This now builds on all Mer arches including x86_64.