Tighten up type declarations

Mostly this was replacing int with something more specific like uint32_t or
uint16_t.