Index: src/ch/task.cpp =================================================================== diff -u -rb13e3052f13b2f0a8c53c37a7b9246418b88bebd -r074c36e6d7abda459bfbca0a8bf98ae531fbc1aa --- src/ch/task.cpp (.../task.cpp) (revision b13e3052f13b2f0a8c53c37a7b9246418b88bebd) +++ src/ch/task.cpp (.../task.cpp) (revision 074c36e6d7abda459bfbca0a8bf98ae531fbc1aa) @@ -41,7 +41,7 @@ m_dwError=dwError; // format some text - CString strFormat=GetResManager().LoadString(uiFmtID); + CString strFormat = GetResManager().LoadString(uiFmtID); ExpandFormatString(&strFormat, dwError); // get param list @@ -336,7 +336,6 @@ m_piFeedbackHandler(piFeedbackHandler), m_files(m_clipboard), m_stCurrentIndex(0), - m_stLastProcessedIndex(0), m_nStatus(ST_NULL_STATUS), m_pThread(NULL), m_nPriority(THREAD_PRIORITY_NORMAL), @@ -352,7 +351,7 @@ m_bSaved(false), m_lOsError(0), m_stSessionUniqueID(stSessionUniqueID), - m_localStats(), + m_localStats(), m_bRegisteredAsRunning(false) { BOOST_ASSERT(piFeedbackHandler); @@ -868,7 +867,6 @@ { KillThread(); SetStatus(ST_PAUSED, ST_WORKING_MASK); - SetLastProcessedIndex(GetCurrentIndex()); m_bSaved=false; } } @@ -1137,18 +1135,6 @@ return m_ucCurrentCopy; } -void CTask::SetLastProcessedIndex(size_t stIndex) -{ - boost::unique_lock lock(m_lock); - m_stLastProcessedIndex = stIndex; -} - -size_t CTask::GetLastProcessedIndex() -{ - boost::shared_lock lock(m_lock); - return m_stLastProcessedIndex; -} - bool CTask::GetRequiredFreeSpace(ull_t *pullNeeded, ull_t *pullAvailable) { *pullNeeded = m_localStats.GetUnProcessedSize(); // it'd be nice to round up to take cluster size into consideration, @@ -1660,8 +1646,6 @@ chcore::IFeedbackHandler* piFeedbackHandler = GetFeedbackHandler(); BOOST_ASSERT(piFeedbackHandler); - SetLastProcessedIndex(std::numeric_limits::max()); - // if dest file size >0 - we can do something more than usual if(bExist) { Index: src/ch/task.h =================================================================== diff -u -rb13e3052f13b2f0a8c53c37a7b9246418b88bebd -r074c36e6d7abda459bfbca0a8bf98ae531fbc1aa --- src/ch/task.h (.../task.h) (revision b13e3052f13b2f0a8c53c37a7b9246418b88bebd) +++ src/ch/task.h (.../task.h) (revision 074c36e6d7abda459bfbca0a8bf98ae531fbc1aa) @@ -69,7 +69,7 @@ #define E_CANCEL 0x02 #define E_PAUSE 0x03 -// structure for gettings status of a task +// structure for getting status of a task struct TASK_DISPLAY_DATA { CFileInfoPtr m_spFileInfo; // fi at CurrIndex @@ -216,70 +216,70 @@ class TTasksGlobalStats { public: - TTasksGlobalStats(); - ~TTasksGlobalStats(); + TTasksGlobalStats(); + ~TTasksGlobalStats(); - void IncreaseGlobalTasksSize(unsigned long long ullModify); - void DecreaseGlobalTasksSize(unsigned long long ullModify); - unsigned long long GetGlobalTasksSize() const; + void IncreaseGlobalTasksSize(unsigned long long ullModify); + void DecreaseGlobalTasksSize(unsigned long long ullModify); + unsigned long long GetGlobalTasksSize() const; - void IncreaseGlobalTasksPosition(unsigned long long ullModify); - void DecreaseGlobalTasksPosition(unsigned long long ullModify); - unsigned long long GetGlobalTasksPosition() const; + void IncreaseGlobalTasksPosition(unsigned long long ullModify); + void DecreaseGlobalTasksPosition(unsigned long long ullModify); + unsigned long long GetGlobalTasksPosition() const; - void IncreaseGlobalProgressData(unsigned long long ullTasksPosition, unsigned long long ullTasksSize); - void DecreaseGlobalProgressData(unsigned long long ullTasksPosition, unsigned long long ullTasksSize); + void IncreaseGlobalProgressData(unsigned long long ullTasksPosition, unsigned long long ullTasksSize); + void DecreaseGlobalProgressData(unsigned long long ullTasksPosition, unsigned long long ullTasksSize); - int GetProgressPercents() const; + int GetProgressPercents() const; - void IncreaseRunningTasks(); - void DecreaseRunningTasks(); - size_t GetRunningTasksCount() const; + void IncreaseRunningTasks(); + void DecreaseRunningTasks(); + size_t GetRunningTasksCount() const; private: - volatile unsigned long long m_ullGlobalTasksSize; - volatile unsigned long long m_ullGlobalTasksPosition; + volatile unsigned long long m_ullGlobalTasksSize; + volatile unsigned long long m_ullGlobalTasksPosition; - volatile size_t m_stRunningTasks; // count of current operations - mutable boost::shared_mutex m_lock; + volatile size_t m_stRunningTasks; // count of current operations + mutable boost::shared_mutex m_lock; }; /////////////////////////////////////////////////////////////////////////// // TTaskLocalStats class TTaskLocalStats { public: - TTaskLocalStats(); - ~TTaskLocalStats(); + TTaskLocalStats(); + ~TTaskLocalStats(); - void ConnectGlobalStats(TTasksGlobalStats& rtGlobalStats); - void DisconnectGlobalStats(); + void ConnectGlobalStats(TTasksGlobalStats& rtGlobalStats); + void DisconnectGlobalStats(); - void IncreaseProcessedSize(unsigned long long ullAdd); - void DecreaseProcessedSize(unsigned long long ullSub); - void SetProcessedSize(unsigned long long ullSet); - unsigned long long GetProcessedSize() const; - unsigned long long GetUnProcessedSize() const; + void IncreaseProcessedSize(unsigned long long ullAdd); + void DecreaseProcessedSize(unsigned long long ullSub); + void SetProcessedSize(unsigned long long ullSet); + unsigned long long GetProcessedSize() const; + unsigned long long GetUnProcessedSize() const; - void IncreaseTotalSize(unsigned long long ullAdd); - void DecreaseTotalSize(unsigned long long ullSub); - void SetTotalSize(unsigned long long ullSet); - unsigned long long GetTotalSize() const; + void IncreaseTotalSize(unsigned long long ullAdd); + void DecreaseTotalSize(unsigned long long ullSub); + void SetTotalSize(unsigned long long ullSet); + unsigned long long GetTotalSize() const; - int GetProgressInPercent() const; + int GetProgressInPercent() const; - void MarkTaskAsRunning(); - void MarkTaskAsNotRunning(); - bool IsRunning() const; + void MarkTaskAsRunning(); + void MarkTaskAsNotRunning(); + bool IsRunning() const; private: - volatile unsigned long long m_ullProcessedSize; - volatile unsigned long long m_ullTotalSize; + volatile unsigned long long m_ullProcessedSize; + volatile unsigned long long m_ullTotalSize; - volatile bool m_bTaskIsRunning; + volatile bool m_bTaskIsRunning; - mutable boost::shared_mutex m_lock; - TTasksGlobalStats* m_prtGlobalStats; + mutable boost::shared_mutex m_lock; + TTasksGlobalStats* m_prtGlobalStats; }; /////////////////////////////////////////////////////////////////////////// @@ -291,8 +291,8 @@ ~CTask(); // methods are called when task is being added or removed from the global task array - void OnRegisterTask(TTasksGlobalStats& rtGlobalStats); - void OnUnregisterTask(); + void OnRegisterTask(TTasksGlobalStats& rtGlobalStats); + void OnUnregisterTask(); // m_clipboard void AddClipboardData(const CClipboardEntryPtr& spEntry); @@ -380,9 +380,6 @@ CClipboardArray* GetClipboard() { return &m_clipboard; }; - void SetLastProcessedIndex(size_t stIndex); - size_t GetLastProcessedIndex(); - bool GetRequiredFreeSpace(ull_t *pi64Needed, ull_t *pi64Available); void SetTaskPath(const tchar_t* pszDir); @@ -467,10 +464,8 @@ CClipboardArray m_clipboard; CFileInfoArray m_files; - volatile size_t m_stCurrentIndex; + volatile size_t m_stCurrentIndex; - size_t m_stLastProcessedIndex; - CDestPath m_dpDestPath; volatile UINT m_nStatus; @@ -504,7 +499,7 @@ size_t m_stSessionUniqueID; bool m_bRegisteredAsRunning; - TTaskLocalStats m_localStats; + TTaskLocalStats m_localStats; friend class CTaskArray; };