- a few bugfixes related to coverity scan

This commit is contained in:
SoftCoder 2014-12-15 19:44:26 -08:00
parent 9392aa0fca
commit 8210485a42
9 changed files with 17 additions and 9 deletions

@ -1 +1 @@
Subproject commit b1c0f0cc18cdd2311b581b44e7ae161317438c93
Subproject commit 19119ebb9c7c91d364c8d413194e476aa815000b

View File

@ -1224,7 +1224,7 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
if(ai->outputAIBehaviourToConsole()) printf("produceSpecific aiInterface->reqsOk(ct) = [%d] Testing AI RULE Name[%s]\n",aiInterface->reqsOk(ct), this->getName().c_str());
if(aiInterface->reqsOk(ct)){
defCt= ct;
//defCt= ct;
producers.push_back(i);
producersDefaultCommandType[i].push_back(ct);
}
@ -1779,7 +1779,7 @@ void AiRuleBuild::buildSpecific(const BuildTask *bt) {
if(aiInterface->reqsOk(bct)) {
builders.push_back(i);
buildersDefaultCommandType[i].push_back(bct);
defBct= bct;
//defBct= bct;
}
}
}

View File

@ -876,7 +876,10 @@ void GraphicScrollBar::setVisibleStart(int vs){
if(visibleStart<0) {
visibleStart=0;
}
float partSize=(float)getLength()/(float)elementCount;
float partSize = 0.f;
if(elementCount > 0) {
partSize = (float)getLength()/(float)elementCount;
}
visibleCompPosStart=visibleStart*partSize;
visibleCompPosEnd=visibleStart*partSize+visibleSize*partSize;
if(visibleCompPosEnd>getLength()) {

View File

@ -316,6 +316,11 @@ Game::Game(Program *program, const GameSettings *gameSettings,bool masterserverM
this->masterserverMode = masterserverMode;
videoPlayer = NULL;
playingStaticVideo = false;
highlightCellTexture = NULL;
playerIndexDisconnect=0;
updateFpsAvgTest=0;
renderFpsAvgTest=0;
cameraDragAllowed=false;
if(this->masterserverMode == true) {
printf("Starting a new game...\n");

View File

@ -49,7 +49,7 @@ void Display::calculateUpDimensions(int index) {
maxUpIndex=index;
if(maxUpIndex+1>upCellSideCount*upCellSideCount){
upCellSideCount=upCellSideCount+1;
upImageSize=imageSize*cellSideCount/upCellSideCount+0.9f;
upImageSize = static_cast<float>(imageSize) * static_cast<float>(cellSideCount) / static_cast<float>(upCellSideCount) + 0.9f;
}
}
}

View File

@ -1595,7 +1595,7 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
}
if(canGrabSlot == true) {
if(i < mapInfo.players && grabSlotButton[i].mouseClick(x, y)) {
if(clientInterface != NULL && i < mapInfo.players && grabSlotButton[i].mouseClick(x, y)) {
//printf("Send slot switch request for slot = %d, myCurrentIndex = %d\n",i,myCurrentIndex);
soundRenderer.playFx(coreData.getClickSoundB());

View File

@ -681,7 +681,7 @@ Model *SkillType::getAnimation(float animProgress, const Unit *unit,
for(unsigned int i = 0; i < animationAttributes.size(); ++i) {
const AnimationAttributes &attributes = animationAttributes[i];
if(attributes.fromHp == 0 && attributes.toHp == 0) {
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

@ -477,7 +477,7 @@ Checksum Map::load(const string &path, TechTree *techTree, Tileset *tileset) {
objNumber = ::Shared::PlatformByteOrder::fromCommonEndian(objNumber);
SurfaceCell *sc= getSurfaceCell(toSurfCoords(Vec2i(i, j)));
if(objNumber == 0) {
if(objNumber <= 0) {
sc->setObject(NULL);
}
else if(objNumber <= Tileset::objCount) {

View File

@ -164,7 +164,7 @@ int ftpStat(const char* path, ftpPathInfo_S *info)
pw = getpwuid(fileInfo.st_uid);
if(pw)
strncpy(info->user, pw->pw_name, sizeof(info->user));
strncpy(info->user, pw->pw_name, sizeof(info->user)-1);
else
snprintf(info->user, 20,"%04d", fileInfo.st_uid);