- more coverity based fixes

This commit is contained in:
SoftCoder
2014-12-15 21:07:13 -08:00
parent 8210485a42
commit c945a5721d
5 changed files with 11 additions and 10 deletions

View File

@@ -1632,7 +1632,7 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
}
if(labelPlayerNames[i].mouseClick(x, y) && (activeInputLabel != &labelPlayerNames[i])){
if(i == clientInterface->getPlayerIndex()){
if(clientInterface != NULL && i == clientInterface->getPlayerIndex()){
setActiveInputLabel(&labelPlayerNames[i]);
}
}

View File

@@ -667,7 +667,7 @@ Model *SkillType::getAnimation(float animProgress, const Unit *unit,
const AnimationAttributes &attributes = animationAttributes[i];
if(attributes.fromHp != 0 || attributes.toHp != 0) {
if(unit->getHp() >= attributes.fromHp && unit->getHp() <= attributes.toHp) {
modelIndex = i;
//modelIndex = i;
foundSpecificAnimation = true;
filteredAnimations.push_back(i);
//printf("SELECTING Model index = %d [%s] model attributes [%d to %d] for unit [%s - %d] with HP = %d\n",i,animations[modelIndex]->getFileName().c_str(),attributes.fromHp,attributes.toHp,unit->getType()->getName().c_str(),unit->getId(),unit->getHp());

View File

@@ -170,7 +170,7 @@ int ftpStat(const char* path, ftpPathInfo_S *info)
gr = getgrgid(fileInfo.st_gid);
if(gr)
strncpy(info->group, gr->gr_name, sizeof(info->group));
strncpy(info->group, gr->gr_name, sizeof(info->group)-1);
else
snprintf(info->group, 20,"%04d", fileInfo.st_gid);

View File

@@ -327,7 +327,8 @@ bool BaseThread::shutdownAndWait(BaseThread *pThread) {
bool BaseThread::shutdownAndWait() {
bool ret = true;
BaseThread *pThread = this;
string uniqueID = (pThread != NULL ? pThread->getUniqueID() : "?");
//string uniqueID = (pThread != NULL ? pThread->getUniqueID() : "?");
string uniqueID = pThread->getUniqueID();
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] uniqueID [%s]\n",__FILE__,__FUNCTION__,__LINE__,uniqueID.c_str());
if(pThread != NULL) {

View File

@@ -1818,9 +1818,9 @@ bool Socket::isConnected() {
int err = peek(&tmp, peekDataBytes, false, &lastSocketError);
//if(err <= 0 && err != PLATFORM_SOCKET_TRY_AGAIN) {
//if(err <= 0 && lastSocketError != 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) {
if((err < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) || (err == 0 && peekDataBytes != 0) ||
((err == 0 || err == -1) && peekDataBytes == 0 && lastSocketError != 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN)) {
//if((err < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) || (err == 0 && peekDataBytes != 0) ||
// ((err == 0 || err == -1) && peekDataBytes == 0 && lastSocketError != 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN)) {
if((err < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) || (err == 0 && peekDataBytes != 0)) {
//printf("IsConnected socket has disconnected sock = %d err = %d lastSocketError = %d\n",sock,err,lastSocketError);
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s Line: %d] ERROR Peek failed, err = %d for socket: %d, error = %s, lastSocketError = %d\n",__FILE__,__FUNCTION__,__LINE__,err,sock,getLastSocketErrorFormattedText().c_str(),lastSocketError);
if(SystemFlags::VERBOSE_MODE_ENABLED) SystemFlags::OutputDebug(SystemFlags::debugError,"SOCKET DISCONNECTED In [%s::%s Line: %d] ERROR Peek failed, err = %d for socket: %d, error = %s, lastSocketError = %d\n",__FILE__,__FUNCTION__,__LINE__,err,sock,getLastSocketErrorFormattedText().c_str(),lastSocketError);
@@ -2634,9 +2634,9 @@ int UPNP_Tools::upnp_init(void *param) {
}
if(ServerSocket::cancelUpnpdiscoverThread == true) {
if(devlist != NULL) {
freeUPNPDevlist(devlist);
}
//if(devlist != NULL) {
// freeUPNPDevlist(devlist);
//}
devlist = NULL;
return result;
}