aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Peach <mrpeach@users.sourceforge.net>2006-12-01 16:50:16 +0000
committerMartin Peach <mrpeach@users.sourceforge.net>2006-12-01 16:50:16 +0000
commita05693a1d5dff368449166ec07a0e1cd0f38fa86 (patch)
treed72687e8d9a0543acbd606d6530ed54e458bca0a
parent16435b2e602e96d6e9183b58693e24604e1e4d1b (diff)
Use sprintf_s instead of snprintf if _MSC_VER defined
svn path=/trunk/externals/mrpeach/; revision=6563
-rwxr-xr-xnet/tcpclient.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/net/tcpclient.c b/net/tcpclient.c
index 06debfa..4adc298 100755
--- a/net/tcpclient.c
+++ b/net/tcpclient.c
@@ -46,6 +46,10 @@
#include <winsock2.h>
#endif
+#ifdef _MSC_VER
+#define snprintf sprintf_s
+#endif
+
#define DEFPOLLTIME 20 /* check for input every 20 ms */
static t_class *tcpclient_class;
@@ -107,23 +111,13 @@ static void tcp_client_hexdump(unsigned char *buf, long len)
{
if (k < len)
{
-#ifdef MSW
- sprintf_s(&hexStr[j], 4, "%02X ", buf[k]);
- sprintf_s(&ascStr[i], 2, "%c", ((buf[k] >= 32) && (buf[k] <= 126))? buf[k]: '.');
-#else
snprintf(&hexStr[j], 4, "%02X ", buf[k]);
snprintf(&ascStr[i], 2, "%c", ((buf[k] >= 32) && (buf[k] <= 126))? buf[k]: '.');
-#endif
}
else
{ // the last line
-#ifdef MSW
- sprintf_s(&hexStr[j], 4, " ");
- sprintf_s(&ascStr[i], 2, " ");
-#else
snprintf(&hexStr[j], 4, " ");
snprintf(&ascStr[i], 2, " ");
-#endif
}
}
post ("%s%s", hexStr, ascStr);