summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorUri Lublin <uril@redhat.com>2014-11-25 18:12:32 +0200
committerUri Lublin <uril@redhat.com>2014-12-30 17:17:25 +0200
commitc76e541bbad9243043733004c95ee5955a9560dd (patch)
treeb17ea954c1f642dfe694543517d73c82505d7c61 /common
parent88b9b74d95fdb1fb680742e586c1a29ed127da52 (diff)
Fix building with Visual Studio (snprintf)
This commit is an addition to 4b9e9b1d28ea7eaec44ff73e2f91c4064986b12a Building with Visual Studio breaks as snprintf is not implemented: vdagent\file_xfer.cpp(198) : error C3861: 'snprintf': identifier not found Replace it with sprintf_s for Visual Studio. Trying to use sprintf_s for both Visual Studio and mingw failed for mingw64 (build succeeds but runtime error appears).
Diffstat (limited to 'common')
-rw-r--r--common/vdcommon.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/vdcommon.h b/common/vdcommon.h
index 74496f1..568e3ba 100644
--- a/common/vdcommon.h
+++ b/common/vdcommon.h
@@ -68,6 +68,10 @@ typedef CRITICAL_SECTION mutex_t;
#endif
#endif /* OLDMSVCRT */
+#ifdef _MSC_VER // compiling with Visual Studio
+#define snprintf sprintf_s
+#endif
+
enum SystemVersion {
SYS_VER_UNSUPPORTED,
SYS_VER_WIN_XP_CLASS, // also Server 2003/R2