Fix variable naming

This commit is contained in:
Learath2 2015-08-29 23:39:44 +03:00
parent f20a6a4934
commit d08bd06610
2 changed files with 12 additions and 12 deletions

View file

@ -35,8 +35,8 @@ CFetcher::~CFetcher()
void CFetcher::QueueAdd(CFetchTask *pTask, const char *pUrl, const char *pDest, int StorageType, void *pUser, COMPFUNC pfnCompCb, PROGFUNC pfnProgCb) void CFetcher::QueueAdd(CFetchTask *pTask, const char *pUrl, const char *pDest, int StorageType, void *pUser, COMPFUNC pfnCompCb, PROGFUNC pfnProgCb)
{ {
str_copy(pTask->m_pUrl, pUrl, sizeof(pTask->m_pUrl)); str_copy(pTask->m_aUrl, pUrl, sizeof(pTask->m_aUrl));
str_copy(pTask->m_pDest, pDest, sizeof(pTask->m_pDest)); str_copy(pTask->m_aDest, pDest, sizeof(pTask->m_aDest));
pTask->m_StorageType = StorageType; pTask->m_StorageType = StorageType;
pTask->m_pfnProgressCallback = pfnProgCb; pTask->m_pfnProgressCallback = pfnProgCb;
pTask->m_pfnCompCallback = pfnCompCb; pTask->m_pfnCompCallback = pfnCompCb;
@ -85,7 +85,7 @@ void CFetcher::FetcherThread(void *pUser)
lock_unlock(pFetcher->m_Lock); lock_unlock(pFetcher->m_Lock);
if(pTask) if(pTask)
{ {
dbg_msg("fetcher", "Task got %s:%s", pTask->m_pUrl, pTask->m_pDest); dbg_msg("fetcher", "Task got %s:%s", pTask->m_aUrl, pTask->m_aDest);
pFetcher->FetchFile(pTask); pFetcher->FetchFile(pTask);
if(pTask->m_pfnCompCallback) if(pTask->m_pfnCompCallback)
pTask->m_pfnCompCallback(pTask, pTask->m_pUser); pTask->m_pfnCompCallback(pTask, pTask->m_pUser);
@ -99,13 +99,13 @@ void CFetcher::FetchFile(CFetchTask *pTask)
{ {
char aPath[512]; char aPath[512];
if(pTask->m_StorageType == -2) if(pTask->m_StorageType == -2)
m_pStorage->GetBinaryPath(pTask->m_pDest, aPath, sizeof(aPath)); m_pStorage->GetBinaryPath(pTask->m_aDest, aPath, sizeof(aPath));
else else
m_pStorage->GetCompletePath(pTask->m_StorageType, pTask->m_pDest, aPath, sizeof(aPath)); m_pStorage->GetCompletePath(pTask->m_StorageType, pTask->m_aDest, aPath, sizeof(aPath));
IOHANDLE File = io_open(aPath, IOFLAG_WRITE); IOHANDLE File = io_open(aPath, IOFLAG_WRITE);
if(!File){ if(!File){
dbg_msg("fetcher", "I/O Error cannot open file: %s", pTask->m_pDest); dbg_msg("fetcher", "I/O Error cannot open file: %s", pTask->m_aDest);
pTask->m_State = CFetchTask::STATE_ERROR; pTask->m_State = CFetchTask::STATE_ERROR;
return; return;
} }
@ -133,14 +133,14 @@ void CFetcher::FetchFile(CFetchTask *pTask)
curl_easy_setopt(m_pHandle, CURLOPT_MAXREDIRS, 4L); curl_easy_setopt(m_pHandle, CURLOPT_MAXREDIRS, 4L);
curl_easy_setopt(m_pHandle, CURLOPT_FAILONERROR, 1L); curl_easy_setopt(m_pHandle, CURLOPT_FAILONERROR, 1L);
curl_easy_setopt(m_pHandle, CURLOPT_CAINFO, aCAFile); curl_easy_setopt(m_pHandle, CURLOPT_CAINFO, aCAFile);
curl_easy_setopt(m_pHandle, CURLOPT_URL, pTask->m_pUrl); curl_easy_setopt(m_pHandle, CURLOPT_URL, pTask->m_aUrl);
curl_easy_setopt(m_pHandle, CURLOPT_WRITEDATA, File); curl_easy_setopt(m_pHandle, CURLOPT_WRITEDATA, File);
curl_easy_setopt(m_pHandle, CURLOPT_WRITEFUNCTION, &CFetcher::WriteToFile); curl_easy_setopt(m_pHandle, CURLOPT_WRITEFUNCTION, &CFetcher::WriteToFile);
curl_easy_setopt(m_pHandle, CURLOPT_NOPROGRESS, 0); curl_easy_setopt(m_pHandle, CURLOPT_NOPROGRESS, 0);
curl_easy_setopt(m_pHandle, CURLOPT_PROGRESSDATA, pTask); curl_easy_setopt(m_pHandle, CURLOPT_PROGRESSDATA, pTask);
curl_easy_setopt(m_pHandle, CURLOPT_PROGRESSFUNCTION, &CFetcher::ProgressCallback); curl_easy_setopt(m_pHandle, CURLOPT_PROGRESSFUNCTION, &CFetcher::ProgressCallback);
dbg_msg("fetcher", "Downloading %s", pTask->m_pDest); dbg_msg("fetcher", "Downloading %s", pTask->m_aDest);
pTask->m_State = CFetchTask::STATE_RUNNING; pTask->m_State = CFetchTask::STATE_RUNNING;
int ret = curl_easy_perform(m_pHandle); int ret = curl_easy_perform(m_pHandle);
io_close(File); io_close(File);
@ -151,7 +151,7 @@ void CFetcher::FetchFile(CFetchTask *pTask)
} }
else else
{ {
dbg_msg("fetcher", "Task done %s", pTask->m_pDest); dbg_msg("fetcher", "Task done %s", pTask->m_aDest);
pTask->m_State = CFetchTask::STATE_DONE; pTask->m_State = CFetchTask::STATE_DONE;
} }
} }

View file

@ -15,8 +15,8 @@ class CFetchTask
CFetchTask *m_pNext; CFetchTask *m_pNext;
char m_pUrl[256]; char m_aUrl[256];
char m_pDest[128]; char m_aDest[128];
PROGFUNC m_pfnProgressCallback; PROGFUNC m_pfnProgressCallback;
COMPFUNC m_pfnCompCallback; COMPFUNC m_pfnCompCallback;
void *m_pUser; void *m_pUser;
@ -44,7 +44,7 @@ public:
const double Size() const { return m_Size; }; const double Size() const { return m_Size; };
const int Progress() const { return m_Progress; }; const int Progress() const { return m_Progress; };
const int State() const { return m_State; }; const int State() const { return m_State; };
const char *Dest() const { return m_pDest; }; const char *Dest() const { return m_aDest; };
void Abort() { m_Abort = true; }; void Abort() { m_Abort = true; };
}; };