COMMON: add a better workaround for {,v}snprintf

Since Microsoft's functions are not C99 compliant, we use a
workaround by Valentin Milea found here:
http://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010