OpenBSD & sparc64 fixes

This makes the tests pass on OpenBSD running on sparc64 (except for the time one, but that's the OS' fault).

OpenBSD doesn't have `qsort_r` so use the internal. The other fix is a typo from an earlier "fix" (oops).

The refdb tests went between `size_t` and `int` through a void*, which doesn't work on a big-endian machine, so make them use the same size.