diff --git a/include/siadrive_api/autothread.h b/include/siadrive_api/autothread.h index 8a2deba..5f01d36 100644 --- a/include/siadrive_api/autothread.h +++ b/include/siadrive_api/autothread.h @@ -31,6 +31,7 @@ protected: virtual void AutoThreadCallback(const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig); public: + bool IsRunning() const; SiaHostConfig GetHostConfig() const; void StartAutoThread(); void StopAutoThread(); diff --git a/include/siadrive_api/uploadmanager.h b/include/siadrive_api/uploadmanager.h index 1419d6e..45d5f36 100644 --- a/include/siadrive_api/uploadmanager.h +++ b/include/siadrive_api/uploadmanager.h @@ -66,8 +66,8 @@ public: static SString UploadStatusToString(const _UploadStatus& uploadStatus); public: - _UploadStatus GetUploadStatus(const SString& siaPath); CSiaError<_UploadErrorCode> AddOrUpdate(const SString& siaPath, SString filePath); + _UploadStatus GetUploadStatus(const SString& siaPath); CSiaError<_UploadErrorCode> Remove(const SString& siaPath); }; diff --git a/src/siadrive_api/autothread.cpp b/src/siadrive_api/autothread.cpp index e7439a1..0ac8028 100644 --- a/src/siadrive_api/autothread.cpp +++ b/src/siadrive_api/autothread.cpp @@ -66,4 +66,10 @@ void CAutoThread::StopAutoThread() _thread->join(); _thread.reset(nullptr); } +} + + +bool CAutoThread::IsRunning() const +{ + return (_thread != nullptr); } \ No newline at end of file diff --git a/src/siadrive_dokan_api/siadokandrive.cpp b/src/siadrive_dokan_api/siadokandrive.cpp index 8490e58..bf2ca38 100644 --- a/src/siadrive_dokan_api/siadokandrive.cpp +++ b/src/siadrive_dokan_api/siadokandrive.cpp @@ -860,7 +860,7 @@ private: // Paging IO cannot write after allocate file size. if (dokanFileInfo->PagingIo) { - if (static_cast(offset) >= li.QuadPart) + if (offset >= li.QuadPart) { *bytesWritten = 0; if (opened) @@ -868,7 +868,7 @@ private: return STATUS_SUCCESS; } - if (static_cast(offset + bytesToWrite) > li.QuadPart) + if ((offset + bytesToWrite) > li.QuadPart) { UINT64 bytes = li.QuadPart - offset; if (bytes >> 32) @@ -882,7 +882,7 @@ private: } } - if (static_cast(offset) > li.QuadPart) + if (offset > li.QuadPart) { // In the mirror sample helperZeroFileData is not necessary. NTFS will // zero a hole. @@ -979,30 +979,30 @@ private: dokanFileInfo->Context = 0; } - if (dokanFileInfo->DeleteOnClose) - { - // Should already be deleted by CloseHandle - // if open with FILE_FLAG_DELETE_ON_CLOSE - if (dokanFileInfo->IsDirectory) - { - if (RetryableAction(filePath.RemoveDirectory(), DEFAULT_RETRY_COUNT, DEFAULT_RETRY_DELAY_MS)) - { - } - else - { - } - } - else - { + if (dokanFileInfo->DeleteOnClose) + { + // Should already be deleted by CloseHandle + // if open with FILE_FLAG_DELETE_ON_CLOSE + if (dokanFileInfo->IsDirectory) + { if (RetryableAction(filePath.RemoveDirectory(), DEFAULT_RETRY_COUNT, DEFAULT_RETRY_DELAY_MS)) - { - } - else - { - } - } + { + } + else + { + } + } + else + { + if (RetryableAction(filePath.RemoveDirectory(), DEFAULT_RETRY_COUNT, DEFAULT_RETRY_DELAY_MS)) + { + } + else + { + } + } RefreshActiveFileTree(true); - } + } } static NTSTATUS DOKAN_CALLBACK Sia_FlushFileBuffers(LPCWSTR fileName, PDOKAN_FILE_INFO dokanFileInfo)