Warning fixes & type standardization

* I've switched all the "context" variables/parameters to use NSInteger
* "line" uses NSUInteger
* I've also added a couple casts for enum types to stop clang complaining about bitmask values not being in the  enum

I've not changed any of the project files to actually use compiler warnings that would surface these, but when integrating to other projects with stricter warnings, it's nice to have these go away.