Avoid warnings by using sprintf_s on MSVC.

Also use std::snprintf on other platforms.
This commit is contained in:
Peter Johnson
2015-08-28 14:16:49 -07:00
parent 2b9e7c6af1
commit b00b4cb185
2 changed files with 10 additions and 2 deletions

View File

@@ -65,7 +65,11 @@ std::size_t TCPStream::send(const char* buffer, std::size_t len, Error* err) {
}
if (!result) {
char Buffer[128];
sprintf(Buffer, "Send() failed: WSA error=%d\n", WSAGetLastError());
#ifdef _MSC_VER
sprintf_s(Buffer, "Send() failed: WSA error=%d\n", WSAGetLastError());
#else
std::snprintf(Buffer, 128, "Send() failed: WSA error=%d\n", WSAGetLastError());
#endif
OutputDebugStringA(Buffer);
*err = kConnectionReset;
return 0;