[[ cleanup ]] Define INT16_MAX as signed.

Removes a large number of signed/unsigned comparison warnings.
[[ cleanup ]] Don't define PATH_MAX on platforms which provide it.

Most platforms other than Windows (including Linux, Android, etc.)
provide usable values of PATH_MAX in their header files.
[[ cleanup ]] Explicitly upcast uint16 to int32
[[ cleanup ]] Don't try to store cdata pointers in 32-bit values.
Merge pull request #1261 from peter-b/refactor

[[ cleanup ]] Remove some common build warnings.