code cleanup based on cppcheck results

This commit is contained in:
Mark Vejvoda 2013-05-17 03:59:34 +00:00
parent 0c9679b8b2
commit 8408526b12
31 changed files with 85 additions and 117 deletions

View File

@ -763,7 +763,7 @@ void PathFinder::astarJPS(std::map<Vec2i,Vec2i> cameFrom, Node *& node,
if(addToOpenSet(unit, node, finalPos, newPath, nodeLimitReached, maxNodeCount,&newNode, false) == true) {
//cameFrom = node->pos;
cameFrom[newPath]=node->pos;
foundQuickRoute = true;
//foundQuickRoute = true;
//printf("#2 add node - current node [%s] next possible node [%s] canUnitMoveToCell [%d] posOpen [%d] isFreeCell [%d]\n",node->pos.getString().c_str(),newPath.getString().c_str(),canUnitMoveToCell,posOpen,isFreeCell);
}

View File

@ -52,6 +52,16 @@ ParticleSystemType::ParticleSystemType() {
minHp=0;
maxHp=0;
minmaxIsPercent=false;
modelCycle=0;
size=0;
sizeNoEnergy=0;
speed=0;
gravity=0;
emissionRate=0;
energyMax=0;
energyVar=0;
}
ParticleSystemType::ParticleSystemType(const ParticleSystemType &src) {

View File

@ -1021,7 +1021,7 @@ void Renderer::setupLighting() {
if(timeFlow->isTotalNight()) {
VisibleQuadContainerCache &qCache = getQuadCache();
if(qCache.visibleQuadUnitList.empty() == false) {
bool modelRenderStarted = false;
//bool modelRenderStarted = false;
for(int visibleUnitIndex = 0;
visibleUnitIndex < qCache.visibleQuadUnitList.size() && lightCount < maxLights;
++visibleUnitIndex) {
@ -9324,46 +9324,10 @@ void Renderer::renderMapPreview( const MapPreview *map, bool renderAll,
assertGl();
std::auto_ptr<Vec2f> vertices(new Vec2f[map->getMaxFactions() * 4]);
std::auto_ptr<Vec3f> colors(new Vec3f[map->getMaxFactions() * 4]);
Vec2f *vertices = new Vec2f[map->getMaxFactions() * 4];
Vec3f *colors = new Vec3f[map->getMaxFactions() * 4];
for (int i = 0; i < map->getMaxFactions(); i++) {
/*
switch (i) {
case 0:
glColor3f(1.f, 0.f, 0.f);
break;
case 1:
glColor3f(0.f, 0.f, 1.f);
break;
case 2:
glColor3f(0.f, 1.f, 0.f);
break;
case 3:
glColor3f(1.f, 1.f, 0.f);
break;
case 4:
glColor3f(1.f, 1.f, 1.f);
break;
case 5:
glColor3f(0.f, 1.f, 0.8f);
break;
case 6:
glColor3f(1.f, 0.5f, 0.f);
break;
case 7:
glColor3f(1.f, 0.5f, 1.f);
break;
}
glBegin(GL_LINES);
glVertex2f((map->getStartLocationX(i) - 1) * cellSize, clientH - (map->getStartLocationY(i) - 1) * cellSize);
glVertex2f((map->getStartLocationX(i) + 1) * cellSize + playerCrossSize, clientH - (map->getStartLocationY(i) + 1) * cellSize - playerCrossSize);
glVertex2f((map->getStartLocationX(i) - 1) * cellSize, clientH - (map->getStartLocationY(i) + 1) * cellSize - playerCrossSize);
glVertex2f((map->getStartLocationX(i) + 1) * cellSize + playerCrossSize, clientH - (map->getStartLocationY(i) - 1) * cellSize);
glEnd();
*/
Vec3f color;
switch (i) {
case 0:
@ -9392,21 +9356,21 @@ void Renderer::renderMapPreview( const MapPreview *map, bool renderAll,
break;
}
colors.get()[i*4] = color;
colors.get()[(i*4)+1] = color;
colors.get()[(i*4)+2] = color;
colors.get()[(i*4)+3] = color;
colors[i*4] = color;
colors[(i*4)+1] = color;
colors[(i*4)+2] = color;
colors[(i*4)+3] = color;
vertices.get()[i*4] = Vec2f((map->getStartLocationX(i) - 1) * cellSize, clientH - (map->getStartLocationY(i) - 1) * cellSize);
vertices.get()[(i*4)+1] = Vec2f((map->getStartLocationX(i) + 1) * cellSize + playerCrossSize, clientH - (map->getStartLocationY(i) + 1) * cellSize - playerCrossSize);
vertices.get()[(i*4)+2] = Vec2f((map->getStartLocationX(i) - 1) * cellSize, clientH - (map->getStartLocationY(i) + 1) * cellSize - playerCrossSize);
vertices.get()[(i*4)+3] = Vec2f((map->getStartLocationX(i) + 1) * cellSize + playerCrossSize, clientH - (map->getStartLocationY(i) - 1) * cellSize);
vertices[i*4] = Vec2f((map->getStartLocationX(i) - 1) * cellSize, clientH - (map->getStartLocationY(i) - 1) * cellSize);
vertices[(i*4)+1] = Vec2f((map->getStartLocationX(i) + 1) * cellSize + playerCrossSize, clientH - (map->getStartLocationY(i) + 1) * cellSize - playerCrossSize);
vertices[(i*4)+2] = Vec2f((map->getStartLocationX(i) - 1) * cellSize, clientH - (map->getStartLocationY(i) + 1) * cellSize - playerCrossSize);
vertices[(i*4)+3] = Vec2f((map->getStartLocationX(i) + 1) * cellSize + playerCrossSize, clientH - (map->getStartLocationY(i) - 1) * cellSize);
}
glEnableClientState(GL_COLOR_ARRAY);
glColorPointer(3, GL_FLOAT, 0, &colors.get()[0]);
glColorPointer(3, GL_FLOAT, 0, &colors[0]);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, &vertices.get()[0]);
glVertexPointer(2, GL_FLOAT, 0, &vertices[0]);
glDrawArrays(GL_LINES, 0, 4 * map->getMaxFactions());
glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
@ -9431,6 +9395,9 @@ void Renderer::renderMapPreview( const MapPreview *map, bool renderAll,
assertGl();
}
delete [] vertices;
delete [] colors;
assertGl();
}

View File

@ -625,7 +625,7 @@ void Gui::mouseDownDisplayUnitSkills(int posDisplay) {
k=0;
}
const CommandType *ctype=display.getCommandType(k);
if(ctype->getClass() == ccAttack)
if(ctype != NULL && ctype->getClass() == ccAttack)
{
if(ctype != NULL && unit->getFaction()->reqsOk(ctype)) {
posDisplay=k;

View File

@ -260,7 +260,7 @@ void Selection::unitEvent(UnitObserver::Event event, const Unit *unit) {
//notify gui only if no more units to execute the command
//of course the selection changed, but this doesn't matter in this case.
if( selectedUnits.size()<1 ){
if( selectedUnits.empty() == true ){
gui->onSelectionChanged();
}

View File

@ -265,24 +265,9 @@ static void cleanupProcessObjects() {
printf("Waiting for the following threads to exit [" MG_SIZE_T_SPECIFIER "]:\n",Thread::getThreadList().size());
//std::auto_ptr<Thread> baseThreadTest(new FileCRCPreCacheThread());
for(int i = 0; i < Thread::getThreadList().size(); ++i) {
//Thread *thr = Thread::getThreadList()[i];
//printf("#1 Lagging thread typeid: %d [%s]\n,",typeid(thr),typeid(thr).name());
//BaseThread *baseThread = dynamic_cast<BaseThread *>(Thread::getThreadList()[i]);
BaseThread *baseThread = dynamic_cast<BaseThread *>(Thread::getThreadList()[i]);
printf("Thread index: %d ptr [%p] isBaseThread: %d, Name: [%s]\n",i,baseThread,(baseThread != NULL),(baseThread != NULL ? baseThread->getUniqueID().c_str() : "<na>"));
//printf("#2 Lagging thread typeid: %d [%s]\n,",typeid(baseThread),typeid(baseThread).name());
//if(baseThread != NULL && baseThread->getRunningStatus() == false) {
// baseThread->kill();
//}
//BaseThread *baseThread2 = dynamic_cast<BaseThread *>(baseThreadTest.get());
//printf("#3 Thread index: %d isBaseThread: %d, Name: [%s]\n",i,(baseThread2 != NULL),(baseThread2 != NULL ? baseThread2->getUniqueID().c_str() : "<na>"));
//printf("#3 Lagging thread typeid: %d [%s]\n,",typeid(baseThread2),typeid(baseThread2).name());
}
}
}
@ -3985,7 +3970,7 @@ int glestMain(int argc, char** argv) {
if(paramPartTokens.size() >= 2 && paramPartTokens[1].length() > 0) {
vector<string> paramPartTokens2;
Tokenize(paramPartTokens[1],paramPartTokens2,",");
if(paramPartTokens2.size() >= 1 && paramPartTokens2[0].length() > 0) {
if(paramPartTokens2.empty() == false && paramPartTokens2[0].length() > 0) {
string newMaxSeconds = paramPartTokens2[0];
time_t newTimeMaxSeconds = strToInt(newMaxSeconds);
AutoTest::setMaxGameTime(newTimeMaxSeconds);

View File

@ -1454,7 +1454,7 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
}
// Only allow changes after we get game settings from the server
if(clientInterface->isConnected() == true) {
if(clientInterface != NULL && clientInterface->isConnected() == true) {
int myCurrentIndex= -1;
for(int i= 0; i < GameConstants::maxPlayers; ++i) {// find my current index by looking at editable listBoxes
if(//listBoxFactions[i].getEditable() &&
@ -1589,7 +1589,7 @@ void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
}
ClientInterface* clientInterface= NetworkManager::getInstance().getClientInterface();
if(clientInterface->isConnected()) {
if(clientInterface != NULL && clientInterface->isConnected()) {
clientInterface->setGameSettingsReceived(false);
clientInterface->sendSwitchSetupRequest(
listBoxFactions[clientInterface->getPlayerIndex()].getSelectedItem(),

View File

@ -612,7 +612,7 @@ void MenuStateMasterserver::mouseClick(int x, int y, MouseButton mouseButton){
if(!clicked && userScrollBar.getElementCount()!=0){
for(int i = userScrollBar.getVisibleStart(); i <= userScrollBar.getVisibleEnd(); ++i) {
if(userButtons[i]->getEnabled() == true && userButtons[i]->mouseClick(x, y)) {
clicked=true;
//clicked=true;
if(!chatManager.getEditEnabled())
{
chatManager.switchOnEdit();

View File

@ -51,10 +51,10 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
int leftLabelStart=50;
int leftColumnStart=leftLabelStart+180;
int rightLabelStart=450;
int rightColumnStart=rightLabelStart+280;
//int rightColumnStart=rightLabelStart+280;
int buttonRowPos=50;
int buttonStartPos=170;
int captionOffset=75;
//int captionOffset=75;
int currentLabelStart=leftLabelStart;
int currentColumnStart=leftColumnStart;
int currentLine=700;
@ -305,7 +305,7 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
// end
// external server port
currentLine-=lineOffset;
//currentLine-=lineOffset;
// buttons
buttonOk.registerGraphicComponent(containerName,"buttonOk");

View File

@ -48,10 +48,10 @@ MenuStateOptionsNetwork::MenuStateOptionsNetwork(Program *program, MainMenu *mai
int leftLabelStart=50;
int leftColumnStart=leftLabelStart+280;
int rightLabelStart=450;
int rightColumnStart=rightLabelStart+280;
//int rightColumnStart=rightLabelStart+280;
int buttonRowPos=50;
int buttonStartPos=170;
int captionOffset=75;
//int captionOffset=75;
int currentLabelStart=leftLabelStart;
int currentColumnStart=leftColumnStart;
int currentLine=700;
@ -319,7 +319,7 @@ void MenuStateOptionsNetwork::showMessageBox(const string &text, const string &h
void MenuStateOptionsNetwork::mouseClick(int x, int y, MouseButton mouseButton){
Config &config= Config::getInstance();
//Config &config= Config::getInstance();
CoreData &coreData= CoreData::getInstance();
SoundRenderer &soundRenderer= SoundRenderer::getInstance();

View File

@ -51,7 +51,7 @@ MenuStateOptionsSound::MenuStateOptionsSound(Program *program, MainMenu *mainMen
int rightColumnStart=rightLabelStart+280;
int buttonRowPos=50;
int buttonStartPos=170;
int captionOffset=75;
//int captionOffset=75;
int currentLabelStart=leftLabelStart;
int currentColumnStart=leftColumnStart;
int currentLine=700;
@ -158,9 +158,9 @@ MenuStateOptionsSound::MenuStateOptionsSound(Program *program, MainMenu *mainMen
///////// RIGHT SIDE
//////////////////////////////////////////////////////////////////
currentLine=700; // reset line pos
currentLabelStart=rightLabelStart; // set to right side
currentColumnStart=rightColumnStart; // set to right side
//currentLine=700; // reset line pos
//currentLabelStart=rightLabelStart; // set to right side
//currentColumnStart=rightColumnStart; // set to right side
// buttons
@ -248,7 +248,7 @@ void MenuStateOptionsSound::showMessageBox(const string &text, const string &hea
void MenuStateOptionsSound::mouseClick(int x, int y, MouseButton mouseButton){
Config &config= Config::getInstance();
//Config &config= Config::getInstance();
CoreData &coreData= CoreData::getInstance();
SoundRenderer &soundRenderer= SoundRenderer::getInstance();

View File

@ -257,7 +257,7 @@ ClientInterface::~ClientInterface() {
//printf("C === Client destructor\n");
Mutex *tempMutexPtr = networkCommandListThreadAccessor;
//Mutex *tempMutexPtr = networkCommandListThreadAccessor;
networkCommandListThreadAccessor = NULL;
safeMutex.ReleaseLock(false,true);
@ -393,7 +393,7 @@ void ClientInterface::update() {
lastSentFrameCount = currentFrameCount;
sendMessage(&networkMessageCommandList);
lastNetworkCommandListSendTime = time(NULL);
lastSendElapsed = difftime((long int)time(NULL),lastNetworkCommandListSendTime);
//lastSendElapsed = difftime((long int)time(NULL),lastNetworkCommandListSendTime);
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took %lld msecs\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis());
}
@ -1426,7 +1426,7 @@ void ClientInterface::waitUntilReady(Checksum* checksum) {
}
}
else if(networkMessageType == nmtCommandList) {
int waitCount = 0;
//int waitCount = 0;
//make sure we read the message
time_t receiveTimeElapsed = time(NULL);
NetworkMessageCommandList networkMessageCommandList;

View File

@ -1257,7 +1257,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
MutexSafeWrapper safeMutex(getServerSynchAccessor(),CODE_AT_LINE);
int slotIdx = switchSetupRequest.getCurrentSlotIndex();
int newSlotIdx = switchSetupRequest.getToSlotIndex();
//int newSlotIdx = switchSetupRequest.getToSlotIndex();
//printf("slotIdx = %d newSlotIdx = %d\n",slotIdx,newSlotIdx);

View File

@ -42,6 +42,12 @@ Vec3f MarkedCell::static_system_marker_color(MAGENTA.x,MAGENTA.y,MAGENTA.z);
NetworkInterface::NetworkInterface() {
networkAccessMutex = new Mutex();
networkGameDataSynchCheckOkMap=false;
networkGameDataSynchCheckOkTile=false;
networkGameDataSynchCheckOkTech=false;
receivedDataSynchCheck=false;
}
NetworkInterface::~NetworkInterface() {

View File

@ -2160,7 +2160,7 @@ bool ServerInterface::launchGame(const GameSettings *gameSettings) {
if(useInGameBlockingClientSockets == true) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
for(int i= 0; i < GameConstants::maxPlayers; ++i) {
int factionIndex = gameSettings->getFactionIndexForStartLocation(i);
//int factionIndex = gameSettings->getFactionIndexForStartLocation(i);
MutexSafeWrapper safeMutexSlot(slotAccessorMutexes[i],CODE_AT_LINE_X(i));
ConnectionSlot *connectionSlot= slots[i];
if(connectionSlot != NULL && connectionSlot->isConnected()) {

View File

@ -1816,17 +1816,7 @@ const CommandType *Unit::computeCommandType(const Vec2i &pos, const Unit *target
targetUnit->getType() != NULL &&
targetUnit->getType()->getStore(this->getLoadType()) > 0) {
//const HarvestCommandType *previousHarvestCmd = this->getType()->getFirstHarvestCommand(this->getLoadType(),this->getFaction());
//if(previousHarvestCmd != NULL) {
//printf("\n#1 return harvested resources\n\n");
//this->setCurrSkill(previousHarvestCmd->getStopLoadedSkillType()); // make sure we use the right harvest animation
commandType = type->getFirstHarvestEmergencyReturnCommand();
//}
//else {
//printf("\n#2 return harvested resources\n\n");
//this->setCurrSkill(hct->getStopLoadedSkillType());
// commandType = type->getFirstHarvestEmergencyReturnCommand();
//}
}
}
}

View File

@ -588,7 +588,7 @@ void HarvestEmergencyReturnCommandType::load(int id, const XmlNode *n, const str
string HarvestEmergencyReturnCommandType::getDesc(const TotalUpgrade *totalUpgrade) const{
Lang &lang= Lang::getInstance();
//Lang &lang= Lang::getInstance();
string str;
str=getName(true)+"\n";

View File

@ -30,7 +30,7 @@ namespace Glest{ namespace Game{
int SkillType::nextAttackBoostId = 0;
AttackBoost::AttackBoost() {
AttackBoost::AttackBoost() : boostUpgrade() {
enabled = false;
allowMultipleBoosts = false;
radius = 0;

View File

@ -22,6 +22,7 @@ TilesetModelType::TilesetModelType() {
model = NULL;
height = 0;
rotationAllowed = false;
smoothTwoFrameAnim = false;
animSpeed = 0;
}

View File

@ -159,6 +159,10 @@ public:
fogMode = 0;
fogDensity = 0.0f;
weather= wSunny;
for(int index = 0; index < surfCount; ++index) {
partsArray[index] = 0;
}
}
~Tileset();
Checksum loadTileset(const vector<string> pathList, const string &tilesetName,

View File

@ -119,7 +119,9 @@ int zipfile_tool(int argc, const char *argv[]) {
if ((file_loc < 0) || (file_loc > INT_MAX)) {
// This is not a limitation of miniz or tinfl, but this example.
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("File is too large to be processed by this example.\n");
printf("File is too large to be processed by this example.\n");
fclose(pInfile);
return EXIT_FAILURE;
}
@ -128,7 +130,9 @@ int zipfile_tool(int argc, const char *argv[]) {
// Open output file.
pOutfile = fopen(pDst_filename, "wb");
if (!pOutfile) {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Failed opening output file!\n");
printf("Failed opening output file!\n");
fclose(pInfile);
return EXIT_FAILURE;
}

View File

@ -73,7 +73,7 @@ bool ShaderProgramGl::link(string &messages){
//bind attributes
for(unsigned int i=0; i<attributes.size(); ++i){
//int a= attributes[i].second;
string s= attributes[i].first;
//string s= attributes[i].first;
glBindAttribLocationARB(handle, attributes[i].second, attributes[i].first.c_str());
}

View File

@ -73,7 +73,7 @@ bool ShaderProgramGl::link(string &messages){
//bind attributes
for(int i=0; i<attributes.size(); ++i){
//int a= attributes[i].second;
string s= attributes[i].first;
//string s= attributes[i].first;
glBindAttribLocationARB(handle, attributes[i].second, attributes[i].first.c_str());
}

View File

@ -1404,7 +1404,7 @@ Pixmap2D *PixelBufferWrapper::getPixelBufferFor(int x,int y,int w,int h, int col
index = (index + 1) % 2;
// pbo index used for next frame
int nextIndex = (index + 1) % 2;
//int nextIndex = (index + 1) % 2;
// read framebuffer ///////////////////////////////
// copy pixels from framebuffer to PBO

View File

@ -1872,7 +1872,7 @@ bool ParticleManager::hasActiveParticleSystem(ParticleSystem::ParticleSystemType
//size_t particleSystemCount= particleSystems.size();
//int currentParticleCount= 0;
vector<ParticleSystem *> cleanupParticleSystemsList;
//vector<ParticleSystem *> cleanupParticleSystemsList;
for(unsigned int i= 0; i < particleSystems.size(); i++){
ParticleSystem *ps= particleSystems[i];
if(ps != NULL){

View File

@ -1318,10 +1318,11 @@ bool VideoPlayer::playFrame(bool swapBuffers) {
return false;
}
int action = 0, pause = 0, n = 0;
if(successLoadingLib == true &&
ctxPtr != NULL && ctxPtr->isPlaying == true &&
finished == false && stop == false) {
int action = 0, pause = 0, n = 0;
action = 0;
SDL_Event event;

View File

@ -813,7 +813,7 @@ time_t getFolderTreeContentsCheckSumRecursivelyLastGenerated(vector<string> path
std::pair<string,string> cacheKeys = getFolderTreeContentsCheckSumCacheKey(paths, pathSearchString, filterFileExt);
string cacheLookupId = cacheKeys.first;
std::map<string,uint32> &crcTreeCache = CacheManager::getCachedItem< std::map<string,uint32> >(cacheLookupId);
//std::map<string,uint32> &crcTreeCache = CacheManager::getCachedItem< std::map<string,uint32> >(cacheLookupId);
string cacheKey = cacheKeys.second;
string crcCacheFile = getFormattedCRCCacheFileName(cacheKeys);

View File

@ -91,7 +91,7 @@ void FileCRCPreCacheThread::execute() {
techsPerWorker++;
}
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] techsPerWorker = %d, MAX_FileCRCPreCacheThread_WORKER_THREADS = %d, techPaths.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,techsPerWorker,MAX_FileCRCPreCacheThread_WORKER_THREADS,(int)techPaths.size());
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] techsPerWorker = %u, MAX_FileCRCPreCacheThread_WORKER_THREADS = %d, techPaths.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,techsPerWorker,MAX_FileCRCPreCacheThread_WORKER_THREADS,(int)techPaths.size());
unsigned int consumedWorkers = 0;
@ -116,7 +116,7 @@ void FileCRCPreCacheThread::execute() {
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] Spawning CRC thread for Tech [%s] [%d of %d]\n",__FILE__,__FUNCTION__,__LINE__,techName.c_str(),idx+1,(int)techPaths.size());
}
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] workerIdx = %d, currentWorkerMax = %d, endConsumerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,workerIdx,currentWorkerMax,endConsumerIndex);
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] workerIdx = %u, currentWorkerMax = %u, endConsumerIndex = %u\n",__FILE__,__FUNCTION__,__LINE__,workerIdx,currentWorkerMax,endConsumerIndex);
// Pause before launching this worker thread
time_t pauseTime = time(NULL);
@ -225,8 +225,8 @@ void FileCRCPreCacheThread::execute() {
time_t elapsedTime = time(NULL);
// Clear existing CRC to force a CRC refresh
string pathSearchString = string("/") + techName + string("/*");
const string filterFileExt = ".xml";
//string pathSearchString = string("/") + techName + string("/*");
//const string filterFileExt = ".xml";
//clearFolderTreeContentsCheckSum(techDataPaths, pathSearchString, filterFileExt);
//clearFolderTreeContentsCheckSumList(techDataPaths, pathSearchString, filterFileExt);

View File

@ -282,13 +282,13 @@ void dcc_file_recv_callback (irc_session_t * session, irc_dcc_t id, int status,
if ( ctx ) {
fwrite (data, 1, length, (FILE*) ctx);
}
if(SystemFlags::VERBOSE_MODE_ENABLED || IRCThread::debugEnabled) printf ("File sent progress: %d\n", length);
if(SystemFlags::VERBOSE_MODE_ENABLED || IRCThread::debugEnabled) printf ("File sent progress: %u\n", length);
}
}
void event_channel(irc_session_t * session, const char * event, const char * origin, const char ** params, unsigned int count) {
//IRC: Event "433", origin: "leguin.freenode.net", params: 3 [*|softcoder|Nickname is already in use.]
if(SystemFlags::VERBOSE_MODE_ENABLED || IRCThread::debugEnabled) printf("In [%s::%s] Line: %d count = %d origin = %s\n",__FILE__,__FUNCTION__,__LINE__,count,(origin ? origin : "null"));
if(SystemFlags::VERBOSE_MODE_ENABLED || IRCThread::debugEnabled) printf("In [%s::%s] Line: %d count = %u origin = %s\n",__FILE__,__FUNCTION__,__LINE__,count,(origin ? origin : "null"));
if ( count != 2 )
return;
@ -403,7 +403,7 @@ void event_leave(irc_session_t *session, const char *event, const char *origin,
}
void event_numeric(irc_session_t * session, unsigned int event, const char * origin, const char ** params, unsigned int count) {
char buf[24]="";
sprintf (buf, "%d", event);
sprintf (buf, "%u", event);
if(SystemFlags::VERBOSE_MODE_ENABLED || IRCThread::debugEnabled) printf ("===> IRC: Line: %d event = %u\n", __LINE__, event);
@ -453,7 +453,7 @@ void event_numeric(irc_session_t * session, unsigned int event, const char * ori
{
if(event == LIBIRC_RFC_RPL_NAMREPLY) {
if(SystemFlags::VERBOSE_MODE_ENABLED || IRCThread::debugEnabled) printf ("===> IRC: LIBIRC_RFC_RPL_NAMREPLY count = %d\n", count);
if(SystemFlags::VERBOSE_MODE_ENABLED || IRCThread::debugEnabled) printf ("===> IRC: LIBIRC_RFC_RPL_NAMREPLY count = %u\n", count);
std::vector<string> nickList;
if(count >= 4) {

View File

@ -609,7 +609,7 @@ pair<FTP_Client_ResultType,string> FTPClientThread::getTilesetFromServer(
for(unsigned int i = 0; i < wantDirListOnly.size(); ++i) {
string fileFromList = wantDirListOnly[i];
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("fileFromList [%s] i [%d]\n",fileFromList.c_str(),i);
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("fileFromList [%s] i [%u]\n",fileFromList.c_str(),i);
if( fileFromList != "models" && fileFromList != "textures" &&
fileFromList != "sounds") {

View File

@ -668,7 +668,6 @@ std::vector<std::string> Socket::getLocalIPAddressList() {
/* get my host name */
char myhostname[101]="";
gethostname(myhostname,100);
char myhostaddr[101] = "";
struct hostent* myhostent = gethostbyname(myhostname);
if(myhostent) {
@ -733,6 +732,7 @@ std::vector<std::string> Socket::getLocalIPAddressList() {
struct sockaddr_in *pSockAddr = (struct sockaddr_in *)&ifr.ifr_addr;
if(pSockAddr != NULL) {
char myhostaddr[101] = "";
Ip::Inet_NtoA(SockAddrToUint32(&pSockAddr->sin_addr), myhostaddr);
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] szBuf [%s], myhostaddr = [%s], ifr.ifr_flags = %d, ifrA.ifr_flags = %d, ifr.ifr_name [%s]\n",__FILE__,__FUNCTION__,__LINE__,szBuf,myhostaddr,ifr.ifr_flags,ifrA.ifr_flags,ifr.ifr_name);