Move all the size_t code to the same place.

When running in Tomcat on Windows, it seems to forget what size_t is. By
having it all in one place, it should be easier to fix.