fix macOS CMake build warnings
Following the discussion on !1620 (merged), this fixes some buffer overflows and cleans up build warnings. I had a change of heart and agreed with Magnus that PRIu64
was the cleanest solution here. After these changes, we could feasibly enable -Werror
in CI for macOS CMake builds.