else
{
m_nLastLineIndexCalculatedSubLineIndex = 0;
- if (m_panSubLineIndexCache->size () >= 0)
- m_panSubLineIndexCache->resize (1);
+ m_panSubLineIndexCache->resize (1);
(*m_panSubLineIndexCache)[0] = 0;
}
{
struct Item
{
- time_t timestamp;
+ time_t timestamp = 0;
std::shared_ptr<TempFile> pTextTempFile;
std::shared_ptr<TempFile> pBitmapTempFile;
};
m_rgThreadState.clear();
m_rgThreadState.resize(nCompareThreads);
}
- int GetIdleCompareThreadCount() const
+ unsigned GetIdleCompareThreadCount() const
{
return m_nIdleCompareThreadCount;
}
- void SetIdleCompareThreadCount(int nIdleCompareThreadCount)
+ void SetIdleCompareThreadCount(unsigned nIdleCompareThreadCount)
{
+ assert(nIdleCompareThreadCount < m_rgThreadState.size());
m_nIdleCompareThreadCount = nIdleCompareThreadCount;
}
- bool IsIdleCompareThread(int iCompareThread) const
+ bool IsIdleCompareThread(unsigned iCompareThread) const
{
return iCompareThread >= (m_rgThreadState.size() - m_nIdleCompareThreadCount);
}
- void BeginCompare(const DIFFITEM *di, int iCompareThread)
+ void BeginCompare(const DIFFITEM *di, unsigned iCompareThread)
{
ThreadState &rThreadState = m_rgThreadState[iCompareThread];
rThreadState.m_nHitCount = 0;
const DIFFITEM *m_pDiffItem;
};
std::vector<ThreadState> m_rgThreadState;
- int m_nIdleCompareThreadCount;
+ unsigned m_nIdleCompareThreadCount;
};
/**
#include "FileFilterHelper.h"
#include "DebugNew.h"
-static void ThrowConfirmCopy(const CDiffContext& ctxt, int origin, int destination, int count,
+static void ThrowConfirmCopy(const CDiffContext& ctxt, int origin, int destination, size_t count,
const String& src, const String& dest, bool destIsSide);
-static void ThrowConfirmMove(const CDiffContext& ctxt, int origin, int destination, int count,
+static void ThrowConfirmMove(const CDiffContext& ctxt, int origin, int destination, size_t count,
const String& src, const String& dest, bool destIsSide);
static void ThrowConfirmationNeededException(const CDiffContext& ctxt, const String &caption, const String &question,
int origin, int destination, size_t count,
if (bRemoveItem)
return UPDATEITEM_REMOVE;
- if (bUpdateSrc | bUpdateDest)
+ if (bUpdateSrc || bUpdateDest)
return UPDATEITEM_UPDATE;
return UPDATEITEM_NONE;
}
return FALSE;
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
- CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_ALL, IID_ITaskbarList3, (void**)&m_pTaskbarList);
- if (m_pTaskbarList != nullptr)
+ if (SUCCEEDED(CoCreateInstance(CLSID_TaskbarList, nullptr, CLSCTX_ALL, IID_ITaskbarList3, (void**)&m_pTaskbarList)))
m_pTaskbarList->SetProgressState(AfxGetMainWnd()->m_hWnd, TBPF_INDETERMINATE);
#endif
PARSEDURL parsedURL{sizeof(PARSEDURL)};
ParseURL(fileSrc.c_str(), &parsedURL);
strutils::replace(command, _T("${SRC_URL_PROTOCOL}"), String{ parsedURL.pszProtocol, parsedURL.cchProtocol });
- strutils::replace(command, _T("${SRC_URL_SUFFIX}"), parsedURL.pszSuffix);
+ strutils::replace(command, _T("${SRC_URL_SUFFIX}"),
+ parsedURL.pszSuffix ? parsedURL.pszSuffix : _T(""));
}
if (paths::IsURL(fileDst))
{
PARSEDURL parsedURL{sizeof(PARSEDURL)};
ParseURL(fileDst.c_str(), &parsedURL);
strutils::replace(command, _T("${DST_URL_PROTOCOL}"), String{ parsedURL.pszProtocol, parsedURL.cchProtocol });
- strutils::replace(command, _T("${DST_URL_SUFFIX}"), parsedURL.pszSuffix);
+ strutils::replace(command, _T("${DST_URL_SUFFIX}"),
+ parsedURL.pszSuffix ? parsedURL.pszSuffix : _T(""));
}
strutils::replace(command, _T("${SRC_FILE}"), fileSrc);
strutils::replace(command, _T("${DST_FILE}"), fileDst);
}
Concurrent::CreateTask([params, title](){
- CoInitialize(nullptr);
- JumpList::AddToRecentDocs(_T(""), params, title, params, _T(""), 0);
- CoUninitialize();
+ if (SUCCEEDED(CoInitialize(nullptr)))
+ {
+ JumpList::AddToRecentDocs(_T(""), params, title, params, _T(""), 0);
+ CoUninitialize();
+ }
return 0;
});
return true;
static UINT UpdateButtonStatesThread(LPVOID lpParam)
{
- MSG msg;
- BOOL bRet;
+ if (FAILED(CoInitialize(nullptr)))
+ return 0;
- CoInitialize(nullptr);
CAssureScriptsForThread scriptsForRescan(new MergeAppCOMClass());
-
+ MSG msg;
+ BOOL bRet;
while( (bRet = GetMessage( &msg, nullptr, 0, 0 )) != 0)
{
if (bRet == -1)
if (hr == DISP_E_EXCEPTION && pExcepInfo)
{
IErrorInfo* pErrorInfo = nullptr;
- GetErrorInfo(0, &pErrorInfo);
- pErrorInfo->GetDescription(&pExcepInfo->bstrDescription);
- pErrorInfo->GetSource(&pExcepInfo->bstrSource);
+ if (SUCCEEDED(GetErrorInfo(0, &pErrorInfo)))
+ {
+ pErrorInfo->GetDescription(&pExcepInfo->bstrDescription);
+ pErrorInfo->GetSource(&pExcepInfo->bstrSource);
+ }
}
return hr;
}
if (tim == nullptr) return _T("---");
SYSTEMTIME sysTimeGlobal, sysTime;
- FILETIME ft;
+ FILETIME ft{};
Timestamp t(*tim * Timestamp::resolution());
if (t == 0)