- fixed some bugs discovered by coverity scan

This commit is contained in:
SoftCoder 2016-01-20 21:34:23 -08:00
parent 0c12b5fb8c
commit d6dbb187cc
8 changed files with 150 additions and 128 deletions

View File

@ -622,7 +622,7 @@ const Resource *AiInterface::getResource(const ResourceType *rt){
}
Unit *AiInterface::getMyUnitPtr(int unitIndex) {
if(unitIndex >= world->getFaction(factionIndex)->getUnitCount()) {
if(unitIndex < 0 || unitIndex >= world->getFaction(factionIndex)->getUnitCount()) {
char szBuf[8096]="";
snprintf(szBuf,8096,"In [%s::%s Line: %d] unitIndex >= world->getFaction(factionIndex)->getUnitCount(), unitIndex = %d, world->getFaction(factionIndex)->getUnitCount() = %d",__FILE__,__FUNCTION__,__LINE__,unitIndex,world->getFaction(factionIndex)->getUnitCount());
throw megaglest_runtime_error(szBuf);

View File

@ -1305,125 +1305,146 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
//besti=i%(producers.size());
}
}
if( aiInterface->getMyUnit(bestIndex)->getCommandSize() > 2) {
// maybe we need another producer of this kind if possible!
if(aiInterface->reqsOk(aiInterface->getMyUnit(bestIndex)->getType())) {
if(ai->getCountOfClass(ucBuilding) > 5) {
ai->addTask(new BuildTask(aiInterface->getMyUnit(bestIndex)->getType()));
}
}
// need to calculate another producer, maybe its better to produce another warrior with another producer
vector<int> backupProducers;
// find another producer unit which is free and produce any kind of warrior.
//for each unit
for(int i=0; i<aiInterface->getMyUnitCount(); ++i){
const UnitType *ut= aiInterface->getMyUnit(i)->getType();
//for each command
for(int j=0; j<ut->getCommandTypeCount(); ++j){
const CommandType *ct= ut->getCommandType(j);
//if the command is produce
if(ct->getClass() == ccProduce) {
const UnitType *unitType= static_cast<const UnitType*>(ct->getProduced());
if(unitType->hasSkillClass(scAttack) && !unitType->hasCommandClass(ccHarvest) && aiInterface->reqsOk(ct))
{//this can produce a warrior
backupProducers.push_back(i);
}
if(bestIndex >= 0) {
if( aiInterface->getMyUnit(bestIndex)->getCommandSize() > 2) {
// maybe we need another producer of this kind if possible!
if(aiInterface->reqsOk(aiInterface->getMyUnit(bestIndex)->getType())) {
if(ai->getCountOfClass(ucBuilding) > 5) {
ai->addTask(new BuildTask(aiInterface->getMyUnit(bestIndex)->getType()));
}
}
}
if(!backupProducers.empty()) {
int randomstart=ai->getRandom()->randRange(0, (int)backupProducers.size()-1);
int lowestCommandCount=1000000;
int currentProducerIndex=backupProducers[randomstart];
int bestIndex=-1;
for(unsigned int i=randomstart; i<backupProducers.size()+randomstart; i++) {
int prIndex = i;
if(i >= backupProducers.size()) {
prIndex = (i - (int)backupProducers.size());
}
currentProducerIndex=backupProducers[prIndex];
if(currentProducerIndex >= aiInterface->getMyUnitCount()) {
char szBuf[8096]="";
printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER "\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,backupProducers.size());
snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,backupProducers.size());
throw megaglest_runtime_error(szBuf);
}
if(prIndex >= (int)backupProducers.size()) {
char szBuf[8096]="";
printf("In [%s::%s Line: %d] prIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER " \n",__FILE__,__FUNCTION__,__LINE__,prIndex,i,backupProducers.size());
snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,backupProducers.size());
throw megaglest_runtime_error(szBuf);
}
int currentCommandCount=aiInterface->getMyUnit(currentProducerIndex)->getCommandSize();
if( currentCommandCount==1 &&
aiInterface->getMyUnit(currentProducerIndex)->getCurrCommand()->getCommandType()->getClass()==ccStop)
{// special for non buildings
currentCommandCount=0;
}
if(lowestCommandCount>currentCommandCount) {
lowestCommandCount=currentCommandCount;
bestIndex=currentProducerIndex;
if(lowestCommandCount==0) break;
}
}
// a good producer is found, lets choose a warrior production
vector<int> productionCommandIndexes;
if(bestIndex >= 0) {
const UnitType *ut=aiInterface->getMyUnit(bestIndex)->getType();
// need to calculate another producer, maybe its better to produce another warrior with another producer
vector<int> backupProducers;
// find another producer unit which is free and produce any kind of warrior.
//for each unit
for(int i=0; i<aiInterface->getMyUnitCount(); ++i){
const UnitType *ut= aiInterface->getMyUnit(i)->getType();
//for each command
for(int j=0; j<ut->getCommandTypeCount(); ++j){
const CommandType *ct= ut->getCommandType(j);
//if the command is produce
if(ct->getClass()==ccProduce) {
if(ct->getClass() == ccProduce) {
const UnitType *unitType= static_cast<const UnitType*>(ct->getProduced());
if(unitType->hasSkillClass(scAttack) && !unitType->hasCommandClass(ccHarvest) && aiInterface->reqsOk(ct))
{//this can produce a warrior
productionCommandIndexes.push_back(j);
backupProducers.push_back(i);
}
}
}
}
if(!backupProducers.empty()) {
int randomstart=ai->getRandom()->randRange(0, (int)backupProducers.size()-1);
int lowestCommandCount=1000000;
int currentProducerIndex=backupProducers[randomstart];
int bestIndex=-1;
for(unsigned int i=randomstart; i<backupProducers.size()+randomstart; i++) {
int prIndex = i;
if(i >= backupProducers.size()) {
prIndex = (i - (int)backupProducers.size());
}
int commandIndex=productionCommandIndexes[ai->getRandom()->randRange(0, (int)productionCommandIndexes.size()-1)];
currentProducerIndex=backupProducers[prIndex];
if(currentProducerIndex >= aiInterface->getMyUnitCount()) {
char szBuf[8096]="";
printf("In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER "\n",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,backupProducers.size());
snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= aiInterface->getMyUnitCount(), currentProducerIndex = %d, aiInterface->getMyUnitCount() = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,aiInterface->getMyUnitCount(),i,backupProducers.size());
throw megaglest_runtime_error(szBuf);
}
if(prIndex >= (int)backupProducers.size()) {
char szBuf[8096]="";
printf("In [%s::%s Line: %d] prIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER " \n",__FILE__,__FUNCTION__,__LINE__,prIndex,i,backupProducers.size());
snprintf(szBuf,8096,"In [%s::%s Line: %d] currentProducerIndex >= backupProducers.size(), currentProducerIndex = %d, i = %u,backupProducers.size() = " MG_SIZE_T_SPECIFIER "",__FILE__,__FUNCTION__,__LINE__,currentProducerIndex,i,backupProducers.size());
throw megaglest_runtime_error(szBuf);
}
int currentCommandCount=aiInterface->getMyUnit(currentProducerIndex)->getCommandSize();
if( currentCommandCount==1 &&
aiInterface->getMyUnit(currentProducerIndex)->getCurrCommand()->getCommandType()->getClass()==ccStop)
{// special for non buildings
currentCommandCount=0;
}
if(lowestCommandCount>currentCommandCount) {
lowestCommandCount=currentCommandCount;
bestIndex=currentProducerIndex;
if(lowestCommandCount==0) break;
}
}
// a good producer is found, lets choose a warrior production
vector<int> productionCommandIndexes;
if(bestIndex >= 0) {
const UnitType *ut=aiInterface->getMyUnit(bestIndex)->getType();
for(int j=0; j<ut->getCommandTypeCount(); ++j){
const CommandType *ct= ut->getCommandType(j);
//if the command is produce
if(ct->getClass()==ccProduce) {
const UnitType *unitType= static_cast<const UnitType*>(ct->getProduced());
if(unitType->hasSkillClass(scAttack) && !unitType->hasCommandClass(ccHarvest) && aiInterface->reqsOk(ct))
{//this can produce a warrior
productionCommandIndexes.push_back(j);
}
}
}
int commandIndex=productionCommandIndexes[ai->getRandom()->randRange(0, (int)productionCommandIndexes.size()-1)];
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(ai->outputAIBehaviourToConsole()) printf("mega #1 produceSpecific giveCommand to unit [%s] commandType [%s]\n",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),ut->getCommandType(commandIndex)->getName().c_str());
if(aiInterface->isLogLevelEnabled(4) == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"mega #1 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),ut->getCommandType(commandIndex)->getName().c_str());
aiInterface->printLog(4, szBuf);
}
aiInterface->giveCommand(bestIndex, ut->getCommandType(commandIndex));
}
}
else
{// do it like normal CPU
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
defCt = NULL;
if(producersDefaultCommandType.find(bestIndex) != producersDefaultCommandType.end()) {
int bestCommandTypeCount = (int)producersDefaultCommandType[bestIndex].size();
int bestCommandTypeIndex = ai->getRandom()->randRange(0, bestCommandTypeCount-1);
if(ai->outputAIBehaviourToConsole()) printf("mega #1 produceSpecific giveCommand to unit [%s] commandType [%s]\n",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),ut->getCommandType(commandIndex)->getName().c_str());
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] bestCommandTypeIndex = %d, bestCommandTypeCount = %d\n",__FILE__,__FUNCTION__,__LINE__,bestCommandTypeIndex,bestCommandTypeCount);
defCt = producersDefaultCommandType[bestIndex][bestCommandTypeIndex];
}
if(ai->outputAIBehaviourToConsole()) printf("mega #2 produceSpecific giveCommand to unit [%s] commandType [%s]\n",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),(defCt != NULL ? defCt->getName().c_str() : "n/a"));
if(aiInterface->isLogLevelEnabled(4) == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"mega #1 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),ut->getCommandType(commandIndex)->getName().c_str());
snprintf(szBuf,8096,"mega #2 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),(defCt != NULL ? defCt->getName().c_str() : "n/a"));
aiInterface->printLog(4, szBuf);
}
aiInterface->giveCommand(bestIndex, defCt);
}
}
else {
if(currentCommandCount == 0) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
defCt = NULL;
if(producersDefaultCommandType.find(bestIndex) != producersDefaultCommandType.end()) {
//defCt = producersDefaultCommandType[bestIndex];
int bestCommandTypeCount = (int)producersDefaultCommandType[bestIndex].size();
int bestCommandTypeIndex = ai->getRandom()->randRange(0, bestCommandTypeCount-1);
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] bestCommandTypeIndex = %d, bestCommandTypeCount = %d\n",__FILE__,__FUNCTION__,__LINE__,bestCommandTypeIndex,bestCommandTypeCount);
defCt = producersDefaultCommandType[bestIndex][bestCommandTypeIndex];
}
if(ai->outputAIBehaviourToConsole()) printf("mega #3 produceSpecific giveCommand to unit [%s] commandType [%s]\n",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),(defCt != NULL ? defCt->getName().c_str() : "n/a"));
if(aiInterface->isLogLevelEnabled(4) == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"mega #3 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),(defCt != NULL ? defCt->getName().c_str() : "n/a"));
aiInterface->printLog(4, szBuf);
}
aiInterface->giveCommand(bestIndex, ut->getCommandType(commandIndex));
aiInterface->giveCommand(bestIndex, defCt);
}
}
else
{// do it like normal CPU
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
defCt = NULL;
if(producersDefaultCommandType.find(bestIndex) != producersDefaultCommandType.end()) {
int bestCommandTypeCount = (int)producersDefaultCommandType[bestIndex].size();
int bestCommandTypeIndex = ai->getRandom()->randRange(0, bestCommandTypeCount-1);
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] bestCommandTypeIndex = %d, bestCommandTypeCount = %d\n",__FILE__,__FUNCTION__,__LINE__,bestCommandTypeIndex,bestCommandTypeCount);
defCt = producersDefaultCommandType[bestIndex][bestCommandTypeIndex];
}
if(ai->outputAIBehaviourToConsole()) printf("mega #2 produceSpecific giveCommand to unit [%s] commandType [%s]\n",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),(defCt != NULL ? defCt->getName().c_str() : "n/a"));
if(aiInterface->isLogLevelEnabled(4) == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"mega #2 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),(defCt != NULL ? defCt->getName().c_str() : "n/a"));
aiInterface->printLog(4, szBuf);
}
aiInterface->giveCommand(bestIndex, defCt);
}
}
else
{
if(currentCommandCount==0) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
defCt = NULL;
if(producersDefaultCommandType.find(bestIndex) != producersDefaultCommandType.end()) {
@ -1435,35 +1456,15 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
defCt = producersDefaultCommandType[bestIndex][bestCommandTypeIndex];
}
if(ai->outputAIBehaviourToConsole()) printf("mega #3 produceSpecific giveCommand to unit [%s] commandType [%s]\n",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),(defCt != NULL ? defCt->getName().c_str() : "n/a"));
if(ai->outputAIBehaviourToConsole()) printf("mega #4 produceSpecific giveCommand to unit [%s] commandType [%s]\n",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),(defCt != NULL ? defCt->getName().c_str() : "n/a"));
if(aiInterface->isLogLevelEnabled(4) == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"mega #3 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),(defCt != NULL ? defCt->getName().c_str() : "n/a"));
snprintf(szBuf,8096,"mega #4 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),(defCt != NULL ? defCt->getName().c_str() : "n/a"));
aiInterface->printLog(4, szBuf);
}
aiInterface->giveCommand(bestIndex, defCt);
}
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
defCt = NULL;
if(producersDefaultCommandType.find(bestIndex) != producersDefaultCommandType.end()) {
//defCt = producersDefaultCommandType[bestIndex];
int bestCommandTypeCount = (int)producersDefaultCommandType[bestIndex].size();
int bestCommandTypeIndex = ai->getRandom()->randRange(0, bestCommandTypeCount-1);
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] bestCommandTypeIndex = %d, bestCommandTypeCount = %d\n",__FILE__,__FUNCTION__,__LINE__,bestCommandTypeIndex,bestCommandTypeCount);
defCt = producersDefaultCommandType[bestIndex][bestCommandTypeIndex];
}
if(ai->outputAIBehaviourToConsole()) printf("mega #4 produceSpecific giveCommand to unit [%s] commandType [%s]\n",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),(defCt != NULL ? defCt->getName().c_str() : "n/a"));
if(aiInterface->isLogLevelEnabled(4) == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"mega #4 produceSpecific giveCommand to unit [%s] commandType [%s]",aiInterface->getMyUnit(bestIndex)->getType()->getName().c_str(),(defCt != NULL ? defCt->getName().c_str() : "n/a"));
aiInterface->printLog(4, szBuf);
}
aiInterface->giveCommand(bestIndex, defCt);
}
}
else {

View File

@ -2012,6 +2012,9 @@ void NetworkMessageCommandList::fromEndianDetail() {
// class NetworkMessageText
// =====================================================
NetworkMessageText::NetworkMessageText() {
messageType = nmtText;
}
NetworkMessageText::NetworkMessageText(const string &text, int teamIndex, int playerIndex,
const string targetLanguage) {
if((int)text.length() >= maxTextStringSize) {
@ -2759,6 +2762,10 @@ void NetworkMessageSynchNetworkGameDataStatus::fromEndianDetail() {
// class NetworkMessageSynchNetworkGameDataFileCRCCheck
// =====================================================
NetworkMessageSynchNetworkGameDataFileCRCCheck::NetworkMessageSynchNetworkGameDataFileCRCCheck() {
messageType= nmtSynchNetworkGameDataFileCRCCheck;
}
NetworkMessageSynchNetworkGameDataFileCRCCheck::NetworkMessageSynchNetworkGameDataFileCRCCheck(
uint32 totalFileCount, uint32 fileIndex, uint32 fileCRC, const string fileName)
{
@ -2872,7 +2879,9 @@ void NetworkMessageSynchNetworkGameDataFileCRCCheck::fromEndian() {
// =====================================================
// class NetworkMessageSynchNetworkGameDataFileGet
// =====================================================
NetworkMessageSynchNetworkGameDataFileGet::NetworkMessageSynchNetworkGameDataFileGet() {
messageType= nmtSynchNetworkGameDataFileGet;
}
NetworkMessageSynchNetworkGameDataFileGet::NetworkMessageSynchNetworkGameDataFileGet(const string fileName) {
messageType= nmtSynchNetworkGameDataFileGet;
data.fileName = fileName;
@ -3307,6 +3316,9 @@ void NetworkMessageLoadingStatus::fromEndian() {
// =====================================================
// class NetworkMessageMarkCell
// =====================================================
NetworkMessageMarkCell::NetworkMessageMarkCell() {
messageType = nmtMarkCell;
}
NetworkMessageMarkCell::NetworkMessageMarkCell(Vec2i target, int factionIndex, const string &text, int playerIndex) {
if((int)text.length() >= maxTextStringSize) {

View File

@ -520,7 +520,7 @@ protected:
virtual unsigned char * packMessage();
public:
NetworkMessageText(){}
NetworkMessageText();
NetworkMessageText(const string &text, int teamIndex, int playerIndex,
const string targetLanguage);
@ -793,7 +793,7 @@ protected:
virtual unsigned char * packMessage();
public:
NetworkMessageSynchNetworkGameDataFileCRCCheck() {};
NetworkMessageSynchNetworkGameDataFileCRCCheck();
NetworkMessageSynchNetworkGameDataFileCRCCheck(uint32 totalFileCount, uint32 fileIndex, uint32 fileCRC, const string fileName);
virtual size_t getDataSize() const { return sizeof(Data); }
@ -845,7 +845,7 @@ protected:
virtual unsigned char * packMessage();
public:
NetworkMessageSynchNetworkGameDataFileGet() {};
NetworkMessageSynchNetworkGameDataFileGet();
NetworkMessageSynchNetworkGameDataFileGet(const string fileName);
virtual size_t getDataSize() const { return sizeof(Data); }
@ -1089,7 +1089,7 @@ protected:
virtual unsigned char * packMessage();
public:
NetworkMessageMarkCell(){}
NetworkMessageMarkCell();
NetworkMessageMarkCell(Vec2i target, int factionIndex, const string &text, int playerIndex);
virtual size_t getDataSize() const { return sizeof(Data); }

View File

@ -85,6 +85,7 @@ private:
string fileName;
public:
OggSoundFileLoader();
virtual void open(const string &path, SoundInfo *soundInfo);
virtual uint32 read(int8 *samples, uint32 size);
virtual void close();

View File

@ -254,6 +254,9 @@ int zipfile_tool(int argc, const char *argv[]) {
uint n = BUF_SIZE - stream.avail_out;
if (fwrite(s_outbuf, 1, n, pOutfile) != n) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Failed writing to output file!\n");
if(pInfile) fclose(pInfile);
if(pOutfile) fclose(pOutfile);
return EXIT_FAILURE;
}
stream.next_out = s_outbuf;

View File

@ -107,7 +107,7 @@ public:
base_thread->signalQuit();
sleep(10);
if(Thread::getEnableVerboseMode()) printf("!!!! cleanupPendingThread Line: %d thread = %p [%s]\n",__LINE__,thread,(base_thread != NULL ? base_thread->getUniqueID().c_str() : "n/a"));
if(Thread::getEnableVerboseMode()) printf("!!!! cleanupPendingThread Line: %d thread = %p [%s]\n",__LINE__,thread,base_thread->getUniqueID().c_str());
if(base_thread->getRunningStatus() == true || base_thread->getExecutingTask() == true) {

View File

@ -201,6 +201,11 @@ void WavSoundFileLoader::restart(){
// Ogg Sound File Loader
// =======================================
OggSoundFileLoader::OggSoundFileLoader() {
vf = NULL;
f = NULL;
}
void OggSoundFileLoader::open(const string &path, SoundInfo *soundInfo){
fileName = path;