[Spice-devel,vdagent-win,V2,2/6] Fix building with Visual Studio (snprintf)

Submitted by Uri Lublin on March 24, 2014, 5:02 p.m.


Message ID 1395680563-15526-3-git-send-email-uril@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Uri Lublin March 24, 2014, 5:02 p.m.
This commit partially reverts 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, which apparently is implemented in mingw too.
 vdagent/file_xfer.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/vdagent/file_xfer.cpp b/vdagent/file_xfer.cpp
index d1459c1..01072ba 100644
--- a/vdagent/file_xfer.cpp
+++ b/vdagent/file_xfer.cpp
@@ -195,10 +195,10 @@  bool FileXfer::g_key_get_string(char* data, const char* group, const char* key,
     char *group_pos, *key_pos, *next_group_pos, *start, *end;
     unsigned len;

-    snprintf(group_pfx, sizeof(group_pfx), "[%s]", group);
+    sprintf_s(group_pfx, sizeof(group_pfx), "[%s]", group);
     if (!(group_pos = strstr((char*)data, group_pfx))) return false;

-    snprintf(key_pfx, sizeof(key_pfx), "\n%s=", key);
+    sprintf_s(key_pfx, sizeof(key_pfx), "\n%s=", key);
     if (!(key_pos = strstr(group_pos, key_pfx))) return false;

     next_group_pos = strstr(group_pos + strlen(group_pfx), "[");