cleaned up code based on feedback from cppcheck

This commit is contained in:
Mark Vejvoda
2013-10-25 05:45:54 +00:00
parent 24cfc243eb
commit ad0fb1d6f7
26 changed files with 87 additions and 114 deletions

View File

@@ -438,14 +438,14 @@ bool fileExists(const string &path) {
fclose(file);
return true;
}
else {
// else {
//int fileErrno = errno;
#ifdef WIN32
int fileErrno = errno;
DWORD error = GetLastError();
string strError = "[#6] Could not open file, result: " + intToStr(error) + " - " + intToStr(fileErrno) + " " + strerror(fileErrno) + " [" + path + "]";
#endif
}
//#ifdef WIN32
//int fileErrno = errno;
//DWORD error = GetLastError();
//string strError = "[#6] Could not open file, result: " + intToStr(error) + " - " + intToStr(fileErrno) + " " + strerror(fileErrno) + " [" + path + "]";
//#endif
// }
return false;
}
@@ -699,7 +699,7 @@ pair<bool,time_t> hasCachedFileCRCValue(string crcCacheFile, uint32 &value) {
char gameVer[500]="";
char svnVer[500]="";
char actualFilePath[8096]="";
int readbytes = fscanf(fp,"%20ld,%20u,%20ld\n%s\n%s\n%s",
int readbytes = fscanf(fp,"%20ld,%20u,%20ld\n%499s\n%499s\n%8095s",
&refreshDate,
&crcValue,
&lastUpdateDate,

View File

@@ -96,9 +96,8 @@ void FileCRCPreCacheThread::execute() {
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;
try {
unsigned int consumedWorkers = 0;
for(unsigned int workerIdx = 0; workerIdx < MAX_FileCRCPreCacheThread_WORKER_THREADS; ++workerIdx) {
if(getQuitStatus() == true) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
@@ -162,9 +161,9 @@ void FileCRCPreCacheThread::execute() {
sleep(0);
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] Waiting for Spawned CRC threads to complete, preCacheWorkerThreadList.size() = %d\n",__FILE__,__FUNCTION__,__LINE__,(int)preCacheWorkerThreadList.size());
bool hasRunningWorkerThread = true;
try {
bool hasRunningWorkerThread = true;
for(;hasRunningWorkerThread == true;) {
hasRunningWorkerThread = false;
for(unsigned int idx = 0; idx < preCacheWorkerThreadList.size(); idx++) {

View File

@@ -236,8 +236,6 @@ void event_privmsg (irc_session_t * session, const char * event, const char * or
}
void dcc_recv_callback (irc_session_t * session, irc_dcc_t id, int status, void * ctx, const char * data, unsigned int length) {
static int count = 1;
char buf[12]="";
switch (status)
{
@@ -252,6 +250,9 @@ void dcc_recv_callback (irc_session_t * session, irc_dcc_t id, int status, void
}
else {
if(SystemFlags::VERBOSE_MODE_ENABLED || IRCThread::debugEnabled) printf ("DCC %d: %s\n", id, data);
static int count = 1;
char buf[12]="";
sprintf (buf, "DCC [%d]: %d", id, count++);
irc_dcc_msg (session, id, buf);
}

View File

@@ -272,7 +272,7 @@ void Thread::queueAutoCleanThread() {
if(Thread::getEnableVerboseMode()) printf("In Thread::shutdownThreads Line: %d\n",__LINE__);
BaseThread *base_thread = dynamic_cast<BaseThread *>(this);
ThreadGarbageCollector *garbage_collector = dynamic_cast<ThreadGarbageCollector *>(this);
//ThreadGarbageCollector *garbage_collector = dynamic_cast<ThreadGarbageCollector *>(this);
if(Thread::getEnableVerboseMode()) printf("In Thread::shutdownThreads Line: %d thread = %p base_thread = %p [%s]\n",__LINE__,this,base_thread,(base_thread != NULL ? base_thread->getUniqueID().c_str() : "n/a"));
MutexSafeWrapper safeMutex(cleanupThreadMutex.get());