Fix 64-bit compilation issues

Substitute raw integer to/from pointer casts with glib macros
GPOINTER_TO_INT and GINT_TO_POINTER.

Modify sort_comparator() to be fully qualified GCompareFunc
that returns negative/zero/positive instead of just 0/1.

Fix possible numeric overflow in msg_comparator().

Fix printf-style format string in dummy_bme test utility.