[vdagent-win PATCH V3 08/11] Fix building with Visual Studio (snprintf)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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).
---
 common/vdcommon.h |    4 ++++
 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
-- 
1.7.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]