[TCPSVCS]

* Use swprintf instead of _swprintf which shouldn't be exported.
CORE-8174

svn path=/trunk/; revision=63464
This commit is contained in:
Amine Khaldi 2014-05-26 14:03:24 +00:00
parent 61651b63ee
commit 9cee13244a
5 changed files with 21 additions and 27 deletions

View file

@ -24,7 +24,7 @@ ReceiveIncomingPackets(SOCKET sock)
{
TCHAR logBuf[256];
_swprintf(logBuf, L"Discard: Received %d bytes from client", readBytes);
swprintf(logBuf, L"Discard: Received %d bytes from client", readBytes);
LogEvent(logBuf, 0, 0, LOG_FILE);
}
else if (readBytes == SOCKET_ERROR)

View file

@ -25,7 +25,7 @@ EchoIncomingPackets(SOCKET sock)
readBytes = recv(sock, readBuffer, RECV_BUF, 0);
if (readBytes > 0)
{
_swprintf(logBuf, L"Received %d bytes from client", readBytes);
swprintf(logBuf, L"Received %d bytes from client", readBytes);
LogEvent(logBuf, 0, 0, LOG_FILE);
totalSentBytes = 0;
@ -34,7 +34,7 @@ EchoIncomingPackets(SOCKET sock)
retVal = send(sock, readBuffer + totalSentBytes, readBytes - totalSentBytes, 0);
if (retVal > 0)
{
_swprintf(logBuf, L"Sent %d bytes back to client", retVal);
swprintf(logBuf, L"Sent %d bytes back to client", retVal);
LogEvent(logBuf, 0, 0, LOG_FILE);
totalSentBytes += retVal;
}

View file

@ -84,14 +84,14 @@ AcceptConnections(SOCKET listeningSocket,
sock = accept(listeningSocket, (SOCKADDR*)&client, &addrSize);
if (sock != INVALID_SOCKET)
{
_swprintf(logBuf,
L"Accepted connection to %s server from %S:%d",
lpName,
inet_ntoa(client.sin_addr),
ntohs(client.sin_port));
swprintf(logBuf,
L"Accepted connection to %s server from %S:%d",
lpName,
inet_ntoa(client.sin_addr),
ntohs(client.sin_port));
LogEvent(logBuf, 0, 0, LOG_FILE);
_swprintf(logBuf, L"Creating worker thread for %s", lpName);
swprintf(logBuf, L"Creating worker thread for %s", lpName);
LogEvent(logBuf, 0, 0, LOG_FILE);
if (!bShutdown)
@ -103,8 +103,8 @@ AcceptConnections(SOCKET listeningSocket,
}
else
{
_swprintf(logBuf, L"Failed to start worker thread for the %s server",
lpName);
swprintf(logBuf, L"Failed to start worker thread for the %s server",
lpName);
LogEvent(logBuf, 0, 0, LOG_FILE);
}
}
@ -149,7 +149,7 @@ ShutdownConnection(SOCKET sock,
ret = recv(sock, readBuffer, BUF, 0);
if (ret >= 0)
{
_swprintf(logBuf, L"FYI, received %d unexpected bytes during shutdown", ret);
swprintf(logBuf, L"FYI, received %d unexpected bytes during shutdown", ret);
LogEvent(logBuf, 0, 0, LOG_FILE);
}
} while (ret > 0);
@ -170,7 +170,7 @@ StartServer(LPVOID lpParam)
pServices = (PSERVICES)lpParam;
_swprintf(logBuf, L"Starting %s server", pServices->lpName);
swprintf(logBuf, L"Starting %s server", pServices->lpName);
LogEvent(logBuf, 0, 0, LOG_FILE);
if (!bShutdown)
@ -178,10 +178,10 @@ StartServer(LPVOID lpParam)
listeningSocket = SetUpListener(htons(pServices->Port));
if (!bShutdown && listeningSocket != INVALID_SOCKET)
{
_swprintf(logBuf,
L"%s is waiting for connections on port %d",
pServices->lpName,
pServices->Port);
swprintf(logBuf,
L"%s is waiting for connections on port %d",
pServices->lpName,
pServices->Port);
LogEvent(logBuf, 0, 0, LOG_FILE);
AcceptConnections(listeningSocket, pServices->lpService, pServices->lpName);
@ -192,9 +192,7 @@ StartServer(LPVOID lpParam)
}
}
_swprintf(logBuf,
L"Exiting %s thread",
pServices->lpName);
swprintf(logBuf, L"Exiting %s thread", pServices->lpName);
LogEvent(logBuf, 0, 0, LOG_FILE);
ExitThread(0);
}

View file

@ -72,7 +72,7 @@ CreateServers(PSERVICEINFO pServInfo)
if ((RetVal = WSAStartup(MAKEWORD(2, 2), &wsaData)) != 0)
{
_swprintf(buf, L"WSAStartup() failed : %lu\n", RetVal);
swprintf(buf, L"WSAStartup() failed : %lu\n", RetVal);
LogEvent(buf, 0, 100, LOG_ALL);
return FALSE;
}
@ -84,7 +84,7 @@ CreateServers(PSERVICEINFO pServInfo)
/* Create worker threads. */
for (i = 0; i < NUM_SERVICES; i++)
{
_swprintf(buf, L"Creating thread for %s server", Services[i].lpName);
swprintf(buf, L"Creating thread for %s server", Services[i].lpName);
LogEvent(buf, 0, 0, LOG_FILE);
hThread[i] = CreateThread(NULL,
@ -96,7 +96,7 @@ CreateServers(PSERVICEINFO pServInfo)
if (hThread[i] == NULL)
{
_swprintf(buf, L"\nError creating %s server thread\n", Services[i].lpName);
swprintf(buf, L"\nError creating %s server thread\n", Services[i].lpName);
LogEvent(buf, GetLastError(), 0, LOG_ALL);
return FALSE;
}

View file

@ -10,10 +10,6 @@
#include <winsock2.h>
#include <tchar.h>
#ifndef _MSC_VER
#define _swprintf swprintf
#endif
#define LOG_FILE 1
#define LOG_EVENTLOG 2
#define LOG_ERROR 4