diff --git a/SQCSim-common/define.h b/SQCSim-common/define.h index bbeaaff..0d71942 100644 --- a/SQCSim-common/define.h +++ b/SQCSim-common/define.h @@ -46,6 +46,7 @@ typedef uint64_t Timestamp; #include #include +#define strcpy strcpy_s #define addrlen_t int #define popen _popen #define pclose _pclose diff --git a/SQCSim-common/netprotocol.h b/SQCSim-common/netprotocol.h index 3aa8ad9..787e0f1 100644 --- a/SQCSim-common/netprotocol.h +++ b/SQCSim-common/netprotocol.h @@ -82,7 +82,7 @@ namespace netprot { char name[32]; uint64_t id = 0; TeamInfo() {} - TeamInfo(TeamInfo* tem) : id(tem->id) { strcpy_s(tem->name, name); } + TeamInfo(TeamInfo* tem) : id(tem->id) { strcpy(tem->name, name); } }; struct LoginInfo { // cli <-> srv TCP once @@ -90,7 +90,7 @@ namespace netprot { uint64_t sid = 0, tid = 0; LoginInfo() {} - LoginInfo(LoginInfo* ply): sid(ply->sid), tid(ply->tid) { strcpy_s(ply->name, name); } + LoginInfo(LoginInfo* ply): sid(ply->sid), tid(ply->tid) { strcpy(ply->name, name); } }; struct PlayerInfo { // cli <-> srv TCP once @@ -98,7 +98,7 @@ namespace netprot { uint64_t id = 0, tid = 0; PlayerInfo() {} - PlayerInfo(PlayerInfo* log) : id(log->id), tid(log->tid) { strcpy_s(log->name, name); } + PlayerInfo(PlayerInfo* log) : id(log->id), tid(log->tid) { strcpy(log->name, name); } }; struct GameInfo { // cli <-> srv TCP event (before game start)/ once @@ -115,14 +115,14 @@ namespace netprot { dest_team_id = 0; char mess[140]; // Good 'nough for twitr, good 'nough for me. Chat() {} - Chat(Chat* cha) : src_id(cha->src_id), dest_id(cha->dest_id), dest_team_id(cha->dest_team_id) { strcpy_s(cha->mess, mess); } + Chat(Chat* cha) : src_id(cha->src_id), dest_id(cha->dest_id), dest_team_id(cha->dest_team_id) { strcpy(cha->mess, mess); } }; struct ErrorLog { // srv -> cli TCP event char mess[140]; bool is_fatal; ErrorLog() {}; - ErrorLog(ErrorLog* err) : is_fatal(err->is_fatal) { strcpy_s(err->mess, mess); } + ErrorLog(ErrorLog* err) : is_fatal(err->is_fatal) { strcpy(err->mess, mess); } }; void Serialize(Input* in, char* buf[], uint32_t* buflen); // cli diff --git a/SQCSim-srv/define.h b/SQCSim-srv/define.h index 3951791..e30bd49 100644 --- a/SQCSim-srv/define.h +++ b/SQCSim-srv/define.h @@ -11,8 +11,4 @@ #define ID_LIST_SIZE 127 #define SRV_MANUAL_SETUP true -#ifdef _WIN32 -#define strcpy strcpy_s -#endif - #endif diff --git a/SQCSim2021/connector.cpp b/SQCSim2021/connector.cpp index 58d4f29..dd83166 100644 --- a/SQCSim2021/connector.cpp +++ b/SQCSim2021/connector.cpp @@ -57,14 +57,14 @@ int Connector::Connect(const char* srv_addr, std::string name) { return 2; } - if (ioctlsocket(m_sock_tcp, FIONBIO, NULL) < 0) { + if (ioctlsocket(m_sock_tcp, FIONBIO, nullptr) < 0) { std::cout << "Impossible de mettre le socket en mode non-bloquant." << std::endl; return 3; } netprot::Buffer bf; netprot::LoginInfo log; - strcpy_s(log.name, name.c_str()); + strcpy(log.name, name.c_str()); netprot::sendPack(m_sock_tcp, &log, &bf);