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

@@ -35,7 +35,11 @@ void NetworkTable::SetServerMode() { s_client = false; }
void NetworkTable::SetTeam(int team) {
char tmp[30];
sprintf(tmp, "%d.%d.%d.%d\n", 10, team / 100, team % 100, 2);
#ifdef _MSC_VER
sprintf_s(tmp, "%d.%d.%d.%d\n", 10, team / 100, team % 100, 2);
#else
std::snprintf(tmp, 30, "%d.%d.%d.%d\n", 10, team / 100, team % 100, 2);
#endif
SetIPAddress(tmp);
}