aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2011-06-01 17:28:59 +0200
committerJohannes Schickel2011-06-01 17:28:59 +0200
commit2f8e9b954ef94fbdf48ec5c2a1a0801d651da7e6 (patch)
treec56017f11070808fc7bc3c37b94ea8251b244aa7
parent29ed72115ef842247a8a0f4df571b216264312c8 (diff)
downloadscummvm-rg350-2f8e9b954ef94fbdf48ec5c2a1a0801d651da7e6.tar.gz
scummvm-rg350-2f8e9b954ef94fbdf48ec5c2a1a0801d651da7e6.tar.bz2
scummvm-rg350-2f8e9b954ef94fbdf48ec5c2a1a0801d651da7e6.zip
COMMON: Add comment about MSVC's _snprintf.
This includes a FIXME, since _snprintf behaves differently to snprintf. Not only in the return value (which is a minor difference, since we usually do not use it), but also since it does not always include a terminating null.
-rw-r--r--common/scummsys.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/common/scummsys.h b/common/scummsys.h
index b691250419..8ed61c2c53 100644
--- a/common/scummsys.h
+++ b/common/scummsys.h
@@ -44,8 +44,18 @@
#if (_MSC_VER < 1500)
#define vsnprintf _vsnprintf
#endif
- // FIXME: Is this actually necessary for WinCE or Windows?
- // If yes, please add corresponding comments. Otherwise, let's get rid of it!
+ // Visual Studio does not include snprintf in its standard C library.
+ // Instead it includes a function called _snprintf with somewhat
+ // similar semantics. The minor difference is that the return value in
+ // case the formatted string exceeds the buffer size is different.
+ // A much more dangerous one is that _snprintf does not always include
+ // a terminating null (Whoops!).
+ //
+ // FIXME: Provide a proper snprintf function for MSVC. It should at
+ // least always include a terminating null!
+ //
+ // See here for more details:
+ // http://msdn.microsoft.com/en-us/library/2ts7cx93%28v=VS.100%29.aspx
#define snprintf _snprintf
#endif