summaryrefslogtreecommitdiff
path: root/plugins/FTPFileYM/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/FTPFileYM/src')
-rw-r--r--plugins/FTPFileYM/src/dbentry.cpp4
-rw-r--r--plugins/FTPFileYM/src/deletetimer.cpp2
-rw-r--r--plugins/FTPFileYM/src/job_delete.cpp6
-rw-r--r--plugins/FTPFileYM/src/job_delete.h2
-rw-r--r--plugins/FTPFileYM/src/job_packer.cpp12
-rw-r--r--plugins/FTPFileYM/src/job_packer.h2
-rw-r--r--plugins/FTPFileYM/src/job_upload.cpp16
-rw-r--r--plugins/FTPFileYM/src/job_upload.h2
8 files changed, 20 insertions, 26 deletions
diff --git a/plugins/FTPFileYM/src/dbentry.cpp b/plugins/FTPFileYM/src/dbentry.cpp
index f5c5684327..79f74005f4 100644
--- a/plugins/FTPFileYM/src/dbentry.cpp
+++ b/plugins/FTPFileYM/src/dbentry.cpp
@@ -137,7 +137,7 @@ void DBEntry::add(GenericJob *job)
DB::setAStringF(0, MODULE_FILES, "Filename%d", id, job->m_szSafeFileName);
if (job->m_tab->m_iOptAutoDelete != -1) {
- time_t deleteTS = time(nullptr);
+ time_t deleteTS = time(0);
deleteTS += (job->m_tab->m_iOptAutoDelete * 60);
DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", id, deleteTS);
}
@@ -149,7 +149,7 @@ void DBEntry::add(GenericJob *job)
void DBEntry::setDeleteTS(GenericJob *job)
{
if (job->m_tab->m_iOptAutoDelete != -1) {
- time_t deleteTS = time(nullptr);
+ time_t deleteTS = time(0);
deleteTS += (job->m_tab->m_iOptAutoDelete * 60);
DB::setDwordF(0, MODULE_FILES, "DeleteTS%d", job->m_fileID, deleteTS);
}
diff --git a/plugins/FTPFileYM/src/deletetimer.cpp b/plugins/FTPFileYM/src/deletetimer.cpp
index fe642e8a83..cb7b0063d7 100644
--- a/plugins/FTPFileYM/src/deletetimer.cpp
+++ b/plugins/FTPFileYM/src/deletetimer.cpp
@@ -56,7 +56,7 @@ void CALLBACK DeleteTimer::AutoDeleteTimerProc(HWND, UINT, UINT_PTR, DWORD)
DBEntry *entry = DBEntry::getFirst();
while (entry != nullptr) {
- if (entry->m_deleteTS > 0 && entry->m_deleteTS < time(nullptr)) {
+ if (entry->m_deleteTS > 0 && entry->m_deleteTS < time(0)) {
DeleteJob *job = new DeleteJob(new DBEntry(entry), nullptr);
job->start();
}
diff --git a/plugins/FTPFileYM/src/job_delete.cpp b/plugins/FTPFileYM/src/job_delete.cpp
index 6bb44b32dd..d9efb9ae97 100644
--- a/plugins/FTPFileYM/src/job_delete.cpp
+++ b/plugins/FTPFileYM/src/job_delete.cpp
@@ -38,10 +38,8 @@ DeleteJob::~DeleteJob()
delete m_entry;
}
-void DeleteJob::waitingThread(void *arg)
+void DeleteJob::waitingThread(DeleteJob *job)
{
- DeleteJob *job = (DeleteJob *)arg;
-
while (!Miranda_IsTerminated()) {
mir_cslockfull lock(mutexJobCount);
if (iRunningJobCount < MAX_RUNNING_JOBS) {
@@ -67,7 +65,7 @@ void DeleteJob::waitingThread(void *arg)
void DeleteJob::start()
{
- mir_forkthread(&DeleteJob::waitingThread, this);
+ mir_forkThread<DeleteJob>(&DeleteJob::waitingThread, this);
}
void DeleteJob::run()
diff --git a/plugins/FTPFileYM/src/job_delete.h b/plugins/FTPFileYM/src/job_delete.h
index 73e6b79822..a3d719fa92 100644
--- a/plugins/FTPFileYM/src/job_delete.h
+++ b/plugins/FTPFileYM/src/job_delete.h
@@ -37,7 +37,7 @@ private:
char *getDelFileString();
char *getDelUrlString();
- static void waitingThread(void *arg);
+ static void __cdecl waitingThread(DeleteJob *job);
void run();
public:
diff --git a/plugins/FTPFileYM/src/job_packer.cpp b/plugins/FTPFileYM/src/job_packer.cpp
index 79c4c9454e..e85e28910b 100644
--- a/plugins/FTPFileYM/src/job_packer.cpp
+++ b/plugins/FTPFileYM/src/job_packer.cpp
@@ -75,10 +75,8 @@ void PackerJob::addToUploadDlg()
start();
}
-void PackerJob::waitingThread(void *arg)
+void PackerJob::waitingThread(PackerJob *job)
{
- PackerJob *job = (PackerJob *)arg;
-
while (!Miranda_IsTerminated()) {
mir_cslockfull lock(mutexJobCount);
if (iRunningJobCount < MAX_RUNNING_JOBS) {
@@ -103,7 +101,7 @@ void PackerJob::waitingThread(void *arg)
void PackerJob::start()
{
- mir_forkthread(&PackerJob::waitingThread, this);
+ mir_forkThread<PackerJob>(&PackerJob::waitingThread, this);
}
void PackerJob::pack()
@@ -115,7 +113,7 @@ void PackerJob::pack()
}
setStatus(STATUS_PACKING);
- m_startTS = time(nullptr);
+ m_startTS = time(0);
int res = createZipFile();
if (res == ZIP_OK) {
@@ -230,10 +228,10 @@ uLong PackerJob::getFileTime(wchar_t *file, tm_zip*, uLong *dt)
void PackerJob::updateStats()
{
DWORD dwNewTick = GetTickCount();
- if (m_uiReaded && (time(nullptr) > m_startTS) && (dwNewTick > m_lastUpdateTick + 100)) {
+ if (m_uiReaded && (time(0) > m_startTS) && (dwNewTick > m_lastUpdateTick + 100)) {
m_lastUpdateTick = dwNewTick;
- double speed = ((double)m_uiReaded / 1024) / (time(nullptr) - m_startTS);
+ double speed = ((double)m_uiReaded / 1024) / (time(0) - m_startTS);
mir_snwprintf(m_tab->m_stzSpeed, TranslateT("%0.1f kB/s"), speed);
double perc = m_uiFileSize ? ((double)m_uiReaded / m_uiFileSize) * 100 : 0;
diff --git a/plugins/FTPFileYM/src/job_packer.h b/plugins/FTPFileYM/src/job_packer.h
index 14edcbeda1..36c5a0ddb8 100644
--- a/plugins/FTPFileYM/src/job_packer.h
+++ b/plugins/FTPFileYM/src/job_packer.h
@@ -36,7 +36,7 @@ private:
static mir_cs mutexJobCount;
static int iRunningJobCount;
- static void waitingThread(void *arg);
+ static void __cdecl waitingThread(PackerJob *job);
static uLong getFileTime(wchar_t *file, tm_zip *tmzip, uLong *dt);
void pack();
diff --git a/plugins/FTPFileYM/src/job_upload.cpp b/plugins/FTPFileYM/src/job_upload.cpp
index f7edbebf25..0fd6aae79c 100644
--- a/plugins/FTPFileYM/src/job_upload.cpp
+++ b/plugins/FTPFileYM/src/job_upload.cpp
@@ -95,7 +95,7 @@ void UploadJob::autoSend()
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT;
dbei.szModule = szProto;
- dbei.timestamp = (DWORD)time(nullptr);
+ dbei.timestamp = (DWORD)time(0);
dbei.cbBlob = (DWORD)mir_strlen(m_szFileLink) + 1;
dbei.pBlob = (PBYTE)m_szFileLink;
db_event_add(m_hContact, &dbei);
@@ -137,7 +137,7 @@ void UploadJob::pauseHandler()
void UploadJob::resume()
{
m_uiSent = 0;
- m_startTS = time(nullptr);
+ m_startTS = time(0);
if (!isCompleted()) {
curl_easy_pause(m_hCurl, CURLPAUSE_CONT);
setStatus(STATUS_UPLOADING);
@@ -150,10 +150,8 @@ void UploadJob::cancel()
curl_easy_pause(m_hCurl, CURLPAUSE_CONT);
}
-void UploadJob::waitingThread(void *arg)
+void UploadJob::waitingThread(UploadJob *job)
{
- UploadJob *job = (UploadJob *)arg;
-
while (!Miranda_IsTerminated()) {
mir_cslockfull lock(mutexJobCount);
if (iRunningJobCount < MAX_RUNNING_JOBS) {
@@ -182,7 +180,7 @@ void UploadJob::waitingThread(void *arg)
void UploadJob::start()
{
- mir_forkthread(&UploadJob::waitingThread, this);
+ mir_forkThread<UploadJob>(&UploadJob::waitingThread, this);
}
char *UploadJob::getChmodString()
@@ -312,7 +310,7 @@ void UploadJob::upload()
if (uploadFile) {
curl_easy_setopt(m_hCurl, CURLOPT_UPLOAD, 1L);
setStatus(STATUS_CONNECTING);
- m_startTS = time(nullptr);
+ m_startTS = time(0);
int result = curl_easy_perform(hCurl);
curl_slist_free_all(headerList);
@@ -385,8 +383,8 @@ size_t UploadJob::ReadCallback(void *ptr, size_t size, size_t nmemb, void *arg)
void UploadJob::updateStats()
{
- if (m_uiSent && (time(nullptr) > m_startTS)) {
- double speed = ((double)m_uiSent / 1024) / (time(nullptr) - m_startTS);
+ if (m_uiSent && (time(0) > m_startTS)) {
+ double speed = ((double)m_uiSent / 1024) / (time(0) - m_startTS);
m_avgSpeed = speed;
for (int i = 0; i < _countof(m_lastSpeed); i++) {
m_avgSpeed += (m_lastSpeed[i] == 0 ? speed : m_lastSpeed[i]);
diff --git a/plugins/FTPFileYM/src/job_upload.h b/plugins/FTPFileYM/src/job_upload.h
index 211eee3756..cf46c48a06 100644
--- a/plugins/FTPFileYM/src/job_upload.h
+++ b/plugins/FTPFileYM/src/job_upload.h
@@ -53,7 +53,7 @@ private:
CURL* curlInit(char *szUrl, struct curl_slist *headerList);
- static void waitingThread(void *arg);
+ static void __cdecl waitingThread(UploadJob *job);
static size_t ReadCallback(void *ptr, size_t size, size_t nmemb, void *arg);
static INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);