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

@@ -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);