mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 03:32:35 +01:00
- fixed windows build from coverity updates
This commit is contained in:
parent
c318fff3ad
commit
0b73d3922a
@ -1758,7 +1758,11 @@ void MenuStateCustomGame::PlayNow(bool saveGame) {
|
||||
char szMsg[8096]="";
|
||||
if(lang.hasString("NetworkSlotUnassignedError",languageList[j]) == true) {
|
||||
string msg_string = lang.getString("NetworkSlotUnassignedError");
|
||||
#ifdef WIN32
|
||||
strncpy(szMsg,msg_string.c_str(),min((int)msg_string.length(),8095));
|
||||
#else
|
||||
strncpy(szMsg,msg_string.c_str(),std::min((int)msg_string.length(),8095));
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
strcpy(szMsg,"Cannot start game, some player(s) are not in a network game slot!");
|
||||
|
@ -425,6 +425,7 @@ socket_t ftpCreateServerSocket(int portNumber)
|
||||
struct sockaddr_in serverinfo;
|
||||
unsigned len;
|
||||
int val = 1;
|
||||
int opt_result = 0;
|
||||
|
||||
theServer = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if(theServer == INVALID_SOCKET)
|
||||
@ -436,7 +437,7 @@ socket_t ftpCreateServerSocket(int portNumber)
|
||||
serverinfo.sin_zero[0] = 0;
|
||||
len = sizeof(serverinfo);
|
||||
|
||||
int opt_result = setsockopt(theServer, SOL_SOCKET, SO_REUSEADDR, (char *)&val, sizeof(val));
|
||||
opt_result = setsockopt(theServer, SOL_SOCKET, SO_REUSEADDR, (char *)&val, sizeof(val));
|
||||
|
||||
if(bind(theServer, (struct sockaddr *)&serverinfo, len)) {
|
||||
if(VERBOSE_MODE_ENABLED) printf("\nERROR In ftpCreateServerSocket bind FAILED about to close listener socket = %d opt_result = %d\n",theServer,opt_result);
|
||||
|
@ -2444,7 +2444,11 @@ string safeCharPtrCopy(const char *ptr,int maxLength) {
|
||||
|
||||
char *pBuffer = new char[maxLength+1];
|
||||
memset(pBuffer,0,maxLength+1);
|
||||
#ifdef WIN32
|
||||
memcpy(pBuffer,ptr,min((int)strlen(ptr),maxLength));
|
||||
#else
|
||||
memcpy(pBuffer,ptr,std::min((int)strlen(ptr),maxLength));
|
||||
#endif
|
||||
return pBuffer;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,11 @@ void dump_event (irc_session_t * session, const char * event, const char * origi
|
||||
if ( cnt ) {
|
||||
strcat (buf, "|");
|
||||
}
|
||||
#ifdef WIN32
|
||||
strncat (buf, params[cnt],min((int)strlen(params[cnt]),511));
|
||||
#else
|
||||
strncat (buf, params[cnt],std::min((int)strlen(params[cnt]),511));
|
||||
#endif
|
||||
}
|
||||
|
||||
addlog ("Event \"%s\", origin: \"%s\", params: %d [%s]", event, origin ? origin : "NULL", cnt, buf);
|
||||
|
@ -2430,8 +2430,13 @@ Socket *ServerSocket::accept(bool errorOnFail) {
|
||||
throwException(szBuf);
|
||||
}
|
||||
else {
|
||||
::close(newSock);
|
||||
newSock = INVALID_SOCKET;
|
||||
#ifndef WIN32
|
||||
::close(newSock);
|
||||
newSock = INVALID_SOCKET;
|
||||
#else
|
||||
::closesocket(newSock);
|
||||
newSock = INVALID_SOCKET;
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -2925,7 +2930,11 @@ void BroadCastSocketThread::execute() {
|
||||
strcat(buff,ipList[idx1].c_str());
|
||||
strcat(buff,":");
|
||||
string port_string = intToStr(this->boundPort);
|
||||
#ifdef WIN32
|
||||
strncat(buff,port_string.c_str(),min((int)port_string.length(),100));
|
||||
#else
|
||||
strncat(buff,port_string.c_str(),std::min((int)port_string.length(),100));
|
||||
#endif
|
||||
}
|
||||
|
||||
if(difftime((long int)time(NULL),elapsed) >= 1 && getQuitStatus() == false) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user