Converted many sprintf calls to snprintf.

Converted most of the easy calls of sprintf to snprintf. This is good, because most compilers including MSVC have sprintf deprecated. We have the warnings disabled with the pragmas:
#pragma warning(disable : 4996)

I was concerned that it would slow things down. But I tested it on Windows 8 and Ubuntu, with no difference in CPU or ram utilization.
Fix it properly, a few files at a time.  That way, you get small patches which are correct and easy to review.  Downside is that it's a lot of small patches... but our infrastructure can deal with that.