Add asserts for snprintf return value and use _snprintf on Windows.

Note that the Windows _snprintf has slightly different semantics than the C99
snprintf (The return value can be different). It doesn't matter in the cases
here, though. I have also added asserts to check the return value everywhere
and moved the snprintf in opl_output_format into its own function.