Get rid of all warnings and errors on Windows.

This increases msvc compatibility.
Maybe add some asserts that sanity-check that.  It's not performance-critical code so a few more strlen() calls won't hurt.