minor clean-ups:
- get rid of stdbool.h and use of c99 bool type.
- change several int32_t to plain old int wherever possible.
- fix a few sign mismatches here and there.
- change a few int returning functions' semantics to error-return
  instead of success-return.
- fix a few C++ism leftovers.