cross platform fixes

Distilling fixes from

https://github.com/dropbox/json11/pull/14
https://github.com/dropbox/json11/pull/10
https://github.com/dropbox/json11/issues/19

into one PR.