Replace all long with (u)int32_t for systems with sizeof(long) > 4