class CDirView;
class CListCtrl;
-struct DIFFITEM;
+class DIFFITEM;
extern __declspec(thread) Merge7z::Proxy Merge7z;
*/
#pragma once
-struct DIFFITEM;
+class DIFFITEM;
class PathContext;
namespace CompareEngines
*/
#pragma once
-struct DIFFITEM;
+class DIFFITEM;
namespace CompareEngines
{
#include <vector>
#include <array>
-struct DIFFITEM;
+class DIFFITEM;
/**
* @brief Class holding directory compare stats.
* @brief Implementation of CDiffContext
*/
+#include "StdAfx.h"
#include "DiffContext.h"
#include <Poco/ScopedLock.h>
#include "CompareOptions.h"
#include "IAbortable.h"
#include "DiffWrapper.h"
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
using Poco::FastMutex;
//////////////////////////////////////////////////////////////////////
* @param [in] diffpos DIFFITEM to update.
* @param [in] nIndex index to update
*/
-void CDiffContext::UpdateStatusFromDisk(uintptr_t diffpos, int nIndex)
+void CDiffContext::UpdateStatusFromDisk(DIFFITEM *diffpos, int nIndex)
{
DIFFITEM &di = GetDiffRefAt(diffpos);
di.diffFileInfo[nIndex].ClearPartial();
* @param [in] nIndex index to update
* @return true if file exists
*/
-bool CDiffContext::UpdateInfoFromDiskHalf(DIFFITEM & di, int nIndex)
+bool CDiffContext::UpdateInfoFromDiskHalf(DIFFITEM &di, int nIndex)
{
String filepath = paths::ConcatPath(paths::ConcatPath(m_paths[nIndex], di.diffFileInfo[nIndex].path), di.diffFileInfo[nIndex].filename);
DiffFileInfo & dfi = di.diffFileInfo[nIndex];
* @param [in,out] di DIFFITEM to update.
* @param [in] bLeft If true left-side file is updated, right-side otherwise.
*/
-void CDiffContext::UpdateVersion(DIFFITEM & di, int nIndex) const
+void CDiffContext::UpdateVersion(DIFFITEM &di, int nIndex) const
{
DiffFileInfo & dfi = di.diffFileInfo[nIndex];
// Check only binary files
class PackingInfo;
class PrediffingInfo;
class IDiffFilter;
-struct DIFFITEM;
class CompareStats;
class IAbortable;
class CDiffWrapper;
CDiffContext(const PathContext & paths, int compareMethod);
~CDiffContext();
- void UpdateVersion(DIFFITEM & di, int nIndex) const;
+ void UpdateVersion(DIFFITEM &di, int nIndex) const;
/**
* Get the main compare method used in this compare.
//@}
// change an existing difference
- bool UpdateInfoFromDiskHalf(DIFFITEM & di, int nIndex);
- void UpdateStatusFromDisk(uintptr_t diffpos, int nIndex);
+ bool UpdateInfoFromDiskHalf(DIFFITEM &di, int nIndex);
+ void UpdateStatusFromDisk(DIFFITEM *diffpos, int nIndex);
bool CreateCompareOptions(int compareMethod, const DIFFOPTIONS & options);
CompareOptions * GetCompareOptions(int compareMethod);
* @date Created: 2003-08-22
*/
+#include "stdafx.h"
#include "DiffFileData.h"
#include <io.h>
#include <memory>
#include "FileTransform.h"
#include "unicoder.h"
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
/**
* @brief Simple initialization of DiffFileData
* @note Diffcounts are initialized to invalid values, not zeros.
* @brief Implementation for DiffFileInfo routines
*/
+#include "stdafx.h"
#include "DiffFileInfo.h"
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
/**
* @brief Clears FileInfo data.
*/
* @brief Implementation of DIFFITEM
*/
+#include "stdafx.h"
#include "DiffItem.h"
#include "paths.h"
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
DIFFITEM DIFFITEM::emptyitem;
/** @brief DIFFITEM's destructor */
DIFFITEM::~DIFFITEM()
{
RemoveChildren();
+ RemoveSiblings();
+ assert(children == nullptr);
+ assert(Flink == nullptr);
+ assert(Blink == nullptr);
}
/** @brief Return path to left/right file, including all but file name */
{
const DIFFITEM *cur;
int depth;
- for (depth = 0, cur = parent; cur != nullptr; depth++, cur = cur->parent)
+ for (depth = 0, cur = parent; cur->parent != nullptr; depth++, cur = cur->parent)
;
return depth;
}
bool DIFFITEM::IsAncestor(const DIFFITEM *pdi) const
{
const DIFFITEM *cur;
- for (cur = this; cur != nullptr; cur = cur->parent)
+ for (cur = this; cur->parent != nullptr; cur = cur->parent)
{
if (cur->parent == pdi)
return true;
return false;
}
-/** @brief Return whether the current item has children */
-bool DIFFITEM::HasChildren() const
+/** @brief Remove and delete all sibling DIFFITEM entries, via Flink */
+void DIFFITEM::RemoveSiblings()
{
- DIFFITEM *p = static_cast<DIFFITEM *>(children.IsSibling(children.Flink));
- return (p != nullptr) ? true : false;
+ DIFFITEM *pRem = Flink;
+ while (pRem != nullptr)
+ {
+ assert(pRem->parent == parent);
+ assert(pRem->Blink == this);
+ DIFFITEM *pNext = pRem->Flink;
+ pRem->RemoveSelf(); // destroys Flink (so we use pRem instead)
+ delete pRem;
+ pRem = pNext;
+ }
+ RemoveSelf();
}
+/** @brief Remove and delete all children DIFFITEM entries */
void DIFFITEM::RemoveChildren()
{
- while (HasChildren())
- {
- DIFFITEM *p = static_cast<DIFFITEM *>(children.Flink);
- p->RemoveSelf();
- delete p;
- }
+ delete children;
+ children = nullptr;
}
void DIFFITEM::Swap(int idx1, int idx2)
diffcode.swap(idx1, idx2);
if (HasChildren())
{
- for (ListEntry *p = children.IsSibling(children.Flink); p != nullptr; p = children.IsSibling(p->Flink))
- static_cast<DIFFITEM *>(p)->Swap(idx1, idx2);
+ for (DIFFITEM *p = children; p != nullptr; p = p->Flink)
+ p->Swap(idx1, idx2);
}
}
+
+
+/* static */
+DIFFITEM *DIFFITEM::GetEmptyItem()
+{
+ // TODO: It would be better if there were individual items
+ // (for whatever these special items are?) because here we
+ // have to *hope* client does not modify this static (shared) item
+
+ assert(emptyitem.parent == nullptr);
+ assert(emptyitem.Flink == nullptr);
+ assert(emptyitem.Blink == nullptr);
+ assert(emptyitem.children == nullptr);
+
+ return &emptyitem;
+}
+
+
+/**
+* @brief Add Sibling item
+* @param [in] p The item to be added
+*/
+void DIFFITEM::Append(DIFFITEM *p)
+{
+ assert(parent->children == this);
+
+ // Two situations
+
+ if (Blink == nullptr)
+ {
+ // Insert first sibling (besides ourself)
+ assert(Flink == nullptr);
+ p->Flink = nullptr;
+ p->Blink = this;
+ Flink = p;
+ }
+ else
+ {
+ // Insert additional siblings
+ assert(Flink != nullptr);
+ p->Flink = nullptr;
+ p->Blink = Blink;
+ Blink->Flink = p;
+ }
+ Blink = p;
+}
+
+void DIFFITEM::RemoveSelf()
+{
+ if (parent != nullptr && parent->children != nullptr)
+ {
+ // If `this` is at end of Sibling linkage, fix First Child's end link
+ if (parent->children->Blink == this)
+ {
+ assert(Flink == nullptr);
+ parent->children->Blink = Blink;
+ if (Blink == this)
+ Blink = nullptr;
+ }
+ // If `this` is the First Child, link parent to next Sibling
+ if (parent->children == this)
+ {
+ parent->children = Flink;
+ }
+ }
+ if (Blink != nullptr)
+ Blink->Flink = Flink;
+ if (Flink != nullptr)
+ Flink->Blink = Blink;
+ Flink = Blink = nullptr;
+}
+
*/
#pragma once
-#include "ListEntry.h"
#include "DiffFileInfo.h"
/**
* both compare sides (file/folder exists in both sides) or just from one
* side (file/folder exists only in other side).
*
- * This class is for backend differences processing, presenting physical
+ * This class is for backend differences processing, representing physical
* files and folders. This class is not for GUI data like selection or
* visibility statuses. So do not include any GUI-dependent data here.
*/
-struct DIFFITEM : ListEntry
+
+class DIFFITEM
{
- DIFFITEM *parent; /**< Parent of current item */
- ListEntry children; /**< Head of doubly linked list for chldren */
+public:
+ DIFFITEM *parent; /**< Parent of current item */
+ DIFFITEM *children; /**< Link to first child of `this` */
- DiffFileInfo diffFileInfo[3]; /**< Fileinfo for left/middle/right file */
- int nsdiffs; /**< Amount of non-ignored differences */
- int nidiffs; /**< Amount of ignored differences */
- unsigned customFlags1; /**< Custom flags set 1 */
- DIFFCODE diffcode; /**< Compare result */
+ DiffFileInfo diffFileInfo[3]; /**< Fileinfo for left/middle/right file */
+ int nsdiffs; /**< Amount of non-ignored differences */
+ int nidiffs; /**< Amount of ignored differences */
+ unsigned customFlags1; /**< Custom flags set 1 */
+ DIFFCODE diffcode; /**< Compare result */
- static DIFFITEM emptyitem; /**< singleton to represent a diffitem that doesn't have any data */
- DIFFITEM() : parent(nullptr), nidiffs(-1), nsdiffs(-1), customFlags1(0) { }
+ DIFFITEM() : parent(nullptr), children(nullptr), nidiffs(-1), nsdiffs(-1), customFlags1(0),
+ Flink(nullptr), Blink(nullptr) {}
~DIFFITEM();
- bool isEmpty() const { return this == &emptyitem; }
String getFilepath(int nIndex, const String &sRoot) const;
int GetDepth() const;
bool IsAncestor(const DIFFITEM *pdi) const;
- bool HasChildren() const;
void RemoveChildren();
void Swap(int idx1, int idx2);
+
+ void Append(DIFFITEM *p);
+ void RemoveSelf();
+
+ inline DIFFITEM *GetFwdSiblingLink() const { return Flink; }
+
+ /** @brief Return whether the current DIFFITEM has children */
+ inline bool DIFFITEM::HasChildren() const
+ {
+ return (children != nullptr);
+ }
+
+ static DIFFITEM *GetEmptyItem();
+ bool isEmpty() const { return this == GetEmptyItem(); /* to invoke "emptiness" checking */ }
+
+
+protected:
+ void RemoveSiblings();
+
+ DIFFITEM *Flink; /**< Forward "sibling" link. The forward linkage ends with
+ a `nullptr` in the final (newest) item. */
+ DIFFITEM *Blink; /**< Backward "sibling" link. The backward linkage is circular,
+ with the first (oldest) item (pointed to by `this->parent->children`)
+ pointing to the last (newest) item. */
+
+ static DIFFITEM emptyitem; /**< singleton to represent a DIFFITEM that doesn't have any data */
};
+
\ No newline at end of file
* @brief Implementation of DiffItemList
*/
+#include "stdafx.h"
#include "DiffItemList.h"
#include <cassert>
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
/**
* @brief Constructor
*/
-DiffItemList::DiffItemList()
+DiffItemList::DiffItemList() : m_pRoot(nullptr)
{
}
/**
* @brief Add new diffitem to structured DIFFITEM tree.
- * @param [in] parent Parent item, or `nullptr` if no parent.
+ * @param [in] par Parent item, or `nullptr` if no parent.
* @return Pointer to the added item.
*/
-DIFFITEM* DiffItemList::AddDiff(DIFFITEM *parent)
+DIFFITEM *DiffItemList::AddNewDiff(DIFFITEM *par)
{
+ if (par == nullptr)
+ {
+ // if there is no `parent`, this item becomes a child of m_pRoot
+ assert(m_pRoot != nullptr);
+ par = m_pRoot;
+ }
+
DIFFITEM *p = new DIFFITEM;
- if (parent != nullptr)
- parent->children.Append(p);
+ // if there is a `parent`, this item becomes a child of that parent
+ p->parent = par;
+ if (par->children == nullptr)
+ par->children = p;
else
- m_root.Append(p);
- p->parent = parent;
+ par->children->Append(p);
+
return p;
}
/**
- * @brief Remove diffitem from structured DIFFITEM tree
- * @param diffpos position of item to remove
+ * @brief Empty structured DIFFITEM tree
*/
-void DiffItemList::RemoveDiff(uintptr_t diffpos)
+void DiffItemList::RemoveAll()
{
- DIFFITEM *p = reinterpret_cast<DIFFITEM *>(diffpos);
- p->RemoveSelf();
- delete p;
+ delete m_pRoot;
+ m_pRoot = nullptr;
}
-/**
- * @brief Empty structured DIFFITEM tree
- */
-void DiffItemList::RemoveAll()
+void DiffItemList::InitDiffItemList()
{
- while (m_root.IsSibling(m_root.Flink))
- RemoveDiff((uintptr_t)m_root.Flink);
+ assert(m_pRoot == nullptr);
+ m_pRoot = new DIFFITEM;
}
/**
* @brief Get position of first item in structured DIFFITEM tree
*/
-uintptr_t DiffItemList::GetFirstDiffPosition() const
+DIFFITEM *DiffItemList::GetFirstDiffPosition() const
{
- return (uintptr_t)m_root.IsSibling(m_root.Flink);
+ return m_pRoot->children;
}
/**
* @brief Get position of first child item in structured DIFFITEM tree
- * @param parentdiffpos [in] Position of parent diff item
- * @return Position of first child item
+ * @param [in] par Position of parent diff item (maybe `nullptr`)
+ * @return Position of first child item (or `nullptr` if no children)
*/
-uintptr_t DiffItemList::GetFirstChildDiffPosition(uintptr_t parentdiffpos) const
+DIFFITEM *DiffItemList::GetFirstChildDiffPosition(const DIFFITEM *par) const
{
- DIFFITEM *parent = reinterpret_cast<DIFFITEM *>(parentdiffpos);
- if (parent != nullptr)
- return (uintptr_t)parent->children.IsSibling(parent->children.Flink);
+ if (par != nullptr)
+ return par->children;
else
- return (uintptr_t)m_root.IsSibling(m_root.Flink);
+ return m_pRoot->children;
}
/**
* @brief Get position of next item in structured DIFFITEM tree
- * @param diffpos position of current item, updated to next item position
- * @return Diff Item in current position
+ * @param [in,out] diffpos Position of current item, updated to next item position
+ * @return Diff Item (by reference) in current position
*/
-const DIFFITEM &DiffItemList::GetNextDiffPosition(uintptr_t & diffpos) const
+const DIFFITEM &DiffItemList::GetNextDiffPosition(DIFFITEM *&diffpos) const
{
- DIFFITEM *p = reinterpret_cast<DIFFITEM *>(diffpos);
- if (p->HasChildren())
+ DIFFITEM *p = diffpos;
+ if (diffpos->HasChildren())
{
diffpos = GetFirstChildDiffPosition(diffpos);
}
else
{
- DIFFITEM *cur = p;
+ DIFFITEM *cur = diffpos;
do
{
- if (cur->parent != nullptr)
- diffpos = (uintptr_t)cur->parent->children.IsSibling(cur->Flink);
- else
- diffpos = (uintptr_t)m_root.IsSibling(cur->Flink);
+ diffpos = cur->GetFwdSiblingLink();
cur = cur->parent;
- } while (!diffpos && cur != nullptr);
+ assert(cur != nullptr);
+ } while (diffpos == nullptr && cur->parent != nullptr);
}
return *p;
}
/**
* @brief Get position of next item in structured DIFFITEM tree
- * @param diffpos position of current item, updated to next item position
+ * @param [in,out] diffpos Position of current item, updated to next item position
* @return Diff Item (by reference) in current position
*/
-DIFFITEM &DiffItemList::GetNextDiffRefPosition(uintptr_t & diffpos)
+DIFFITEM &DiffItemList::GetNextDiffRefPosition(DIFFITEM *&diffpos)
{
return (DIFFITEM &)GetNextDiffPosition(diffpos);
}
/**
* @brief Get position of next sibling item in structured DIFFITEM tree
- * @param diffpos position of current item, updated to next sibling item position
- * @return Diff Item in current position
+ * @param [in,out] diffpos Position of current item, updated to next sibling item position
+ * @return Diff Item (by reference) in current position
*/
-const DIFFITEM &DiffItemList::GetNextSiblingDiffPosition(uintptr_t & diffpos) const
+const DIFFITEM &DiffItemList::GetNextSiblingDiffPosition(DIFFITEM *&diffpos) const
{
- DIFFITEM *p = reinterpret_cast<DIFFITEM *>(diffpos);
- if (p->parent != nullptr)
- diffpos = (uintptr_t)p->parent->children.IsSibling(p->Flink);
- else
- diffpos = (uintptr_t)m_root.IsSibling(p->Flink);
+ DIFFITEM *p = diffpos;
+ diffpos = p->GetFwdSiblingLink();
+ assert(p==nullptr || diffpos==nullptr || p->parent == diffpos->parent);
+ assert(p->parent != nullptr);
return *p;
}
/**
* @brief Get position of next sibling item in structured DIFFITEM tree
- * @param diffpos position of current item, updated to next sibling item position
+ * @param [in,out] diffpos Position of current item, updated to next sibling item position
* @return Diff Item (by reference) in current position
*/
-DIFFITEM &DiffItemList::GetNextSiblingDiffRefPosition(uintptr_t & diffpos)
+DIFFITEM &DiffItemList::GetNextSiblingDiffRefPosition(DIFFITEM *&diffpos)
{
return (DIFFITEM &)GetNextSiblingDiffPosition(diffpos);
}
* SetDiffStatusCode(pos, DIFFCODE::SAME+DIFFCODE::BOTH, DIFFCODE::COMPAREFLAGS+DIFFCODE::SIDEFLAG);
* changes the comparison result to be the same and the side status to be both
*/
-void DiffItemList::SetDiffStatusCode(uintptr_t diffpos, unsigned diffcode, unsigned mask)
+void DiffItemList::SetDiffStatusCode(DIFFITEM *diffpos, unsigned diffcode, unsigned mask)
{
- assert(diffpos != NULL);
- DIFFITEM & di = GetDiffRefAt(diffpos);
+ assert(diffpos != nullptr);
+ DIFFITEM &di = GetDiffRefAt(diffpos);
assert( ((~mask) & diffcode) == 0 ); // make sure they only set flags in their mask
di.diffcode.diffcode &= (~mask); // remove current data
di.diffcode.diffcode |= diffcode; // add new data
/**
* @brief Update difference counts.
*/
-void DiffItemList::SetDiffCounts(uintptr_t diffpos, unsigned diffs, unsigned ignored)
+void DiffItemList::SetDiffCounts(DIFFITEM *diffpos, unsigned diffs, unsigned ignored)
{
- assert(diffpos != NULL);
- DIFFITEM & di = GetDiffRefAt(diffpos);
+ assert(diffpos != nullptr);
+ DIFFITEM &di = GetDiffRefAt(diffpos);
di.nidiffs = ignored; // see StoreDiffResult() in DirScan.cpp
di.nsdiffs = diffs;
}
* @param [in] diffpos Position of item.
* @return Custom flags from item.
*/
-unsigned DiffItemList::GetCustomFlags1(uintptr_t diffpos) const
+unsigned DiffItemList::GetCustomFlags1(DIFFITEM *diffpos) const
{
- assert(diffpos != NULL);
- const DIFFITEM & di = GetDiffAt(diffpos);
+ assert(diffpos != nullptr);
+ const DIFFITEM &di = GetDiffAt(diffpos);
return di.customFlags1;
}
* @param [in] diffpos Position of item.
* @param [in] flag Value of flag to set.
*/
-void DiffItemList::SetCustomFlags1(uintptr_t diffpos, unsigned flag)
+void DiffItemList::SetCustomFlags1(DIFFITEM *diffpos, unsigned flag)
{
- assert(diffpos != NULL);
- DIFFITEM & di = GetDiffRefAt(diffpos);
+ assert(diffpos != nullptr);
+ DIFFITEM &di = GetDiffRefAt(diffpos);
di.customFlags1 = flag;
}
void DiffItemList::Swap(int idx1, int idx2)
{
- for (ListEntry *p = m_root.IsSibling(m_root.Flink); p != nullptr; p = m_root.IsSibling(p->Flink))
- static_cast<DIFFITEM *>(p)->Swap(idx1, idx2);
+ assert(m_pRoot != nullptr);
+ for (DIFFITEM *p = m_pRoot->children; p != nullptr; p = p->GetFwdSiblingLink())
+ p->Swap(idx1, idx2);
}
DiffItemList();
~DiffItemList();
// add & remove differences
- DIFFITEM *AddDiff(DIFFITEM *parent);
- void RemoveDiff(uintptr_t diffpos);
+ DIFFITEM *AddNewDiff(DIFFITEM *parent);
void RemoveAll();
+ void InitDiffItemList();
// to iterate over all differences on list
- uintptr_t GetFirstDiffPosition() const;
- uintptr_t GetFirstChildDiffPosition(uintptr_t parentdiffpos) const;
- const DIFFITEM & GetNextDiffPosition(uintptr_t & diffpos) const;
- DIFFITEM & GetNextDiffRefPosition(uintptr_t & diffpos);
- const DIFFITEM & GetNextSiblingDiffPosition(uintptr_t & diffpos) const;
- DIFFITEM &GetNextSiblingDiffRefPosition(uintptr_t & diffpos);
- const DIFFITEM & GetDiffAt(uintptr_t diffpos) const;
- DIFFITEM & GetDiffRefAt(uintptr_t diffpos);
+ DIFFITEM *GetFirstDiffPosition() const;
+ DIFFITEM *GetFirstChildDiffPosition(const DIFFITEM *par) const;
+ const DIFFITEM &GetNextDiffPosition(DIFFITEM *&diffpos) const;
+ DIFFITEM &GetNextDiffRefPosition(DIFFITEM *&diffpos);
+ const DIFFITEM &GetNextSiblingDiffPosition(DIFFITEM *&diffpos) const;
+ DIFFITEM &GetNextSiblingDiffRefPosition(DIFFITEM *&diffpos);
+ const DIFFITEM &GetDiffAt(DIFFITEM *diffpos) const;
+ DIFFITEM &GetDiffRefAt(DIFFITEM *diffpos);
- void SetDiffStatusCode(uintptr_t diffpos, unsigned diffcode, unsigned mask);
- void SetDiffCounts(uintptr_t diffpos, unsigned diffs, unsigned ignored);
- unsigned GetCustomFlags1(uintptr_t diffpos) const;
- void SetCustomFlags1(uintptr_t diffpos, unsigned flag);
+ void SetDiffStatusCode(DIFFITEM *diffpos, unsigned diffcode, unsigned mask);
+ void SetDiffCounts(DIFFITEM *diffpos, unsigned diffs, unsigned ignored);
+ unsigned GetCustomFlags1(DIFFITEM *diffpos) const;
+ void SetCustomFlags1(DIFFITEM *diffpos, unsigned flag);
void Swap(int idx1, int idx2);
protected:
- ListEntry m_root; /**< Root of list of diffitems */
+ DIFFITEM* m_pRoot; /**< Root of list of diffitems; initially `nullptr`. */
};
/**
* @brief Get copy of Diff Item at given position in difflist.
* @param diffpos position of item to return
*/
-inline const DIFFITEM & DiffItemList::GetDiffAt(uintptr_t diffpos) const
+inline const DIFFITEM &DiffItemList::GetDiffAt(DIFFITEM *diffpos) const
{
- return *reinterpret_cast<DIFFITEM *>(diffpos);
+ return *diffpos;
}
/**
* @brief Get Diff Item (by reference) at given position in difflist.
* @param diffpos position of item to return
*/
-inline DIFFITEM & DiffItemList::GetDiffRefAt(uintptr_t diffpos)
+inline DIFFITEM &DiffItemList::GetDiffRefAt(DIFFITEM *diffpos)
{
- return *reinterpret_cast<DIFFITEM *>(diffpos);
+ return *diffpos;
}
* @brief Code for DiffThread class
*/
+#include "stdafx.h"
#include "DiffThread.h"
#include <cassert>
#include <climits>
#include "CompareStats.h"
#include "IAbortable.h"
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
using Poco::Thread;
using Poco::Semaphore;
m_threads[0].start(DiffThreadCollect, m_pDiffParm.get());
else
{
- int nItems = DirScan_UpdateMarkedItems(m_pDiffParm.get(), 0);
+ int nItems = DirScan_UpdateMarkedItems(m_pDiffParm.get(), nullptr);
// Send message to UI to update
int event = CDiffThread::EVENT_COLLECT_COMPLETED;
m_pDiffParm->m_listeners.notify(m_pDiffParm.get(), event);
DirScan_GetItems(paths, subdir, myStruct,
casesensitive, depth, nullptr, myStruct->context->m_bWalkUniques);
- // ReleaseSemaphore() once again to signal that collect phase is ready
+ // Release Semaphore() once again to signal that collect phase is ready
myStruct->pSemaphore->set();
// Send message to UI to update
// Now do all pending file comparisons
if (myStruct->bOnlyRequested)
- DirScan_CompareRequestedItems(myStruct, 0);
+ DirScan_CompareRequestedItems(myStruct, nullptr);
else
- DirScan_CompareItems(myStruct, 0);
+ DirScan_CompareItems(myStruct, nullptr);
myStruct->context->m_pCompareStats->SetCompareState(CompareStats::STATE_IDLE);
// One idea would be to provide an iterator over them.
//
+#include "stdafx.h"
#include "DirActions.h"
#include "MergeApp.h"
#include "UnicodeString.h"
#include "locality.h"
#include "FileFilterHelper.h"
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
static void ThrowConfirmCopy(const CDiffContext& ctxt, int origin, int destination, int count,
const String& src, const String& dest, bool destIsSide);
static void ThrowConfirmMove(const CDiffContext& ctxt, int origin, int destination, int count,
}
if (bUpdateSrc)
- ctxt.UpdateStatusFromDisk(reinterpret_cast<uintptr_t>(&di), act.UIOrigin);
+ ctxt.UpdateStatusFromDisk(&di, act.UIOrigin);
if (bUpdateDest)
- ctxt.UpdateStatusFromDisk(reinterpret_cast<uintptr_t>(&di), act.UIDestination);
+ ctxt.UpdateStatusFromDisk(&di, act.UIDestination);
if (bRemoveItem)
return UPDATEITEM_REMOVE;
* @return POSITION to item, `nullptr` if not found.
* @note Filenames must be same, if they differ `nullptr` is returned.
*/
-uintptr_t FindItemFromPaths(const CDiffContext& ctxt, const PathContext& paths)
+DIFFITEM *FindItemFromPaths(const CDiffContext& ctxt, const PathContext& paths)
{
int nBuffer;
String file[3], path[3], base;
if (static_cast<size_t>(std::count(file, file + paths.size(), file[0])) < paths.size())
return 0;
- uintptr_t pos = ctxt.GetFirstDiffPosition();
+ DIFFITEM *pos = ctxt.GetFirstDiffPosition();
if (paths.size() == 2)
{
- while (uintptr_t currentPos = pos) // Save our current pos before getting next
+ while (DIFFITEM *currentPos = pos) // Save our current pos before getting next
{
const DIFFITEM &di = ctxt.GetNextDiffPosition(pos);
if (di.diffFileInfo[0].path == path[0] &&
}
else
{
- while (uintptr_t currentPos = pos) // Save our current pos before getting next
+ while (DIFFITEM *currentPos = pos) // Save our current pos before getting next
{
const DIFFITEM &di = ctxt.GetNextDiffPosition(pos);
if (di.diffFileInfo[0].path == path[0] &&
}
/// is it possible to copy item to left ?
-bool IsItemCopyable(const DIFFITEM & di, int index)
+bool IsItemCopyable(const DIFFITEM &di, int index)
{
// don't let them mess with error items
if (di.diffcode.isResultError()) return false;
}
/// is it possible to delete item ?
-bool IsItemDeletable(const DIFFITEM & di, int index)
+bool IsItemDeletable(const DIFFITEM &di, int index)
{
// don't let them mess with error items
if (di.diffcode.isResultError()) return false;
}
/// is it possible to delete both items ?
-bool IsItemDeletableOnBoth(const CDiffContext& ctxt, const DIFFITEM & di)
+bool IsItemDeletableOnBoth(const CDiffContext& ctxt, const DIFFITEM &di)
{
// don't let them mess with error items
if (di.diffcode.isResultError()) return false;
}
/// is it possible to compare these two items?
-bool AreItemsOpenable(const CDiffContext& ctxt, SELECTIONTYPE selectionType, const DIFFITEM & di1, const DIFFITEM & di2)
+bool AreItemsOpenable(const CDiffContext& ctxt, SELECTIONTYPE selectionType, const DIFFITEM &di1, const DIFFITEM &di2)
{
String sLeftBasePath = ctxt.GetPath(0);
String sRightBasePath = ctxt.GetPath(1);
return false;
}
/// is it possible to compare these three items?
-bool AreItemsOpenable(const CDiffContext& ctxt, const DIFFITEM & di1, const DIFFITEM & di2, const DIFFITEM & di3)
+bool AreItemsOpenable(const CDiffContext& ctxt, const DIFFITEM &di1, const DIFFITEM &di2, const DIFFITEM &di3)
{
String sLeftBasePath = ctxt.GetPath(0);
String sMiddleBasePath = ctxt.GetPath(1);
return false;
}
/// is it possible to open item ?
-bool IsItemOpenableOn(const DIFFITEM & di, int index)
+bool IsItemOpenableOn(const DIFFITEM &di, int index)
{
// impossible if not existing
if (!di.diffcode.exists(index)) return false;
}
/// is it possible to open left ... item ?
-bool IsItemOpenableOnWith(const DIFFITEM & di, int index)
+bool IsItemOpenableOnWith(const DIFFITEM &di, int index)
{
return (!di.diffcode.isDirectory() && IsItemOpenableOn(di, index));
}
/// is it possible to copy to... left item?
-bool IsItemCopyableToOn(const DIFFITEM & di, int index)
+bool IsItemCopyableToOn(const DIFFITEM &di, int index)
{
// impossible if only on right
if (!di.diffcode.exists(index)) return false;
}
// When navigating differences, do we stop at this one ?
-bool IsItemNavigableDiff(const CDiffContext& ctxt, const DIFFITEM & di)
+bool IsItemNavigableDiff(const CDiffContext& ctxt, const DIFFITEM &di)
{
// Not a valid diffitem, one of special items (e.g "..")
if (di.diffcode.diffcode == 0)
return true;
}
-bool IsItemExistAll(const CDiffContext& ctxt, const DIFFITEM & di)
+bool IsItemExistAll(const CDiffContext& ctxt, const DIFFITEM &di)
{
// Not a valid diffitem, one of special items (e.g "..")
if (di.diffcode.diffcode == 0)
* @return true if item should be shown, false if not.
* @sa CDirDoc::Redisplay()
*/
-bool IsShowable(const CDiffContext& ctxt, const DIFFITEM & di, const DirViewFilterSettings& filter)
+bool IsShowable(const CDiffContext& ctxt, const DIFFITEM &di, const DirViewFilterSettings& filter)
{
if (di.customFlags1 & ViewCustomFlags::HIDDEN)
return false;
return false;
if (di.diffcode.isResultDiff() && !filter.show_different)
{
- uintptr_t diffpos = ctxt.GetFirstChildDiffPosition(reinterpret_cast<uintptr_t>(&di));
- while (diffpos)
+ DIFFITEM *diffpos = ctxt.GetFirstChildDiffPosition(&di);
+ while (diffpos != nullptr)
{
const DIFFITEM &dic = ctxt.GetNextSiblingDiffPosition(diffpos);
if (IsShowable(ctxt, dic, filter))
* @param [in,out] isDir Is item folder?
* return false if there was error or item was completely processed.
*/
-bool GetOpenOneItem(const CDiffContext& ctxt, uintptr_t pos1, const DIFFITEM *pdi[3],
+bool GetOpenOneItem(const CDiffContext& ctxt, DIFFITEM *pos1, const DIFFITEM *pdi[3],
PathContext & paths, int & sel1, bool & isdir, int nPane[3], String& errmsg)
{
pdi[0] = &ctxt.GetDiffAt(pos1);
* @param [in,out] isDir Is item folder?
* return false if there was error or item was completely processed.
*/
-bool GetOpenTwoItems(const CDiffContext& ctxt, SELECTIONTYPE selectionType, uintptr_t pos1, uintptr_t pos2, const DIFFITEM *pdi[3],
+bool GetOpenTwoItems(const CDiffContext& ctxt, SELECTIONTYPE selectionType, DIFFITEM *pos1, DIFFITEM *pos2, const DIFFITEM *pdi[3],
PathContext & paths, int & sel1, int & sel2, bool & isDir, int nPane[3], String& errmsg)
{
// Two items selected, get their info
* @param [in,out] isDir Is item folder?
* return false if there was error or item was completely processed.
*/
-bool GetOpenThreeItems(const CDiffContext& ctxt, uintptr_t pos1, uintptr_t pos2, uintptr_t pos3, const DIFFITEM *pdi[3],
+bool GetOpenThreeItems(const CDiffContext& ctxt, DIFFITEM *pos1, DIFFITEM *pos2, DIFFITEM *pos3, const DIFFITEM *pdi[3],
PathContext & paths, int & sel1, int & sel2, int & sel3, bool & isDir, int nPane[3], String& errmsg)
{
String pathLeft, pathMiddle, pathRight;
* @brief Get the file names on both sides for specified item.
* @note Return empty strings if item is special item.
*/
-void GetItemFileNames(const CDiffContext& ctxt, const DIFFITEM & di, String& strLeft, String& strRight)
+void GetItemFileNames(const CDiffContext& ctxt, const DIFFITEM &di, String& strLeft, String& strRight)
{
const String leftrelpath = paths::ConcatPath(di.diffFileInfo[0].path, di.diffFileInfo[0].filename);
const String rightrelpath = paths::ConcatPath(di.diffFileInfo[1].path, di.diffFileInfo[1].filename);
strRight = paths::ConcatPath(rightpath, rightrelpath);
}
-String GetItemFileName(const CDiffContext& ctxt, const DIFFITEM & di, int index)
+String GetItemFileName(const CDiffContext& ctxt, const DIFFITEM &di, int index)
{
return paths::ConcatPath(ctxt.GetPath(index), paths::ConcatPath(di.diffFileInfo[index].path, di.diffFileInfo[index].filename));
}
-PathContext GetItemFileNames(const CDiffContext& ctxt, const DIFFITEM & di)
+PathContext GetItemFileNames(const CDiffContext& ctxt, const DIFFITEM &di)
{
PathContext paths;
for (int nIndex = 0; nIndex < ctxt.GetCompareDirs(); nIndex++)
/**
* @brief Return image index appropriate for this row
*/
-int GetColImage(const DIFFITEM & di)
+int GetColImage(const DIFFITEM &di)
{
// Must return an image index into image list created above in OnInitDialog
if (di.diffcode.isResultError())
*/
void SetItemViewFlag(CDiffContext& ctxt, unsigned flag, unsigned mask)
{
- uintptr_t pos = ctxt.GetFirstDiffPosition();
+ DIFFITEM *pos = ctxt.GetFirstDiffPosition();
- while (pos != NULL)
+ while (pos != nullptr)
{
unsigned curFlags = ctxt.GetCustomFlags1(pos);
curFlags &= ~mask; // Zero bits masked
void ExpandSubdirs(CDiffContext& ctxt, DIFFITEM& dip)
{
dip.customFlags1 |= ViewCustomFlags::EXPANDED;
- uintptr_t diffpos = ctxt.GetFirstChildDiffPosition(reinterpret_cast<uintptr_t>(&dip));
- while (diffpos)
+ DIFFITEM *diffpos = ctxt.GetFirstChildDiffPosition(&dip);
+ while (diffpos != nullptr)
{
DIFFITEM &di = ctxt.GetNextDiffRefPosition(diffpos);
if (!di.IsAncestor(&dip))
void ExpandAllSubdirs(CDiffContext& ctxt)
{
- uintptr_t diffpos = ctxt.GetFirstDiffPosition();
- while (diffpos)
+ DIFFITEM *diffpos = ctxt.GetFirstDiffPosition();
+ while (diffpos != nullptr)
{
DIFFITEM &di = ctxt.GetNextDiffRefPosition(diffpos);
di.customFlags1 |= ViewCustomFlags::EXPANDED;
void CollapseAllSubdirs(CDiffContext& ctxt)
{
- uintptr_t diffpos = ctxt.GetFirstDiffPosition();
- while (diffpos)
+ DIFFITEM *diffpos = ctxt.GetFirstDiffPosition();
+ while (diffpos != nullptr)
{
DIFFITEM &di = ctxt.GetNextDiffRefPosition(diffpos);
di.customFlags1 &= ~ViewCustomFlags::EXPANDED;
DirViewTreeState *SaveTreeState(const CDiffContext& ctxt)
{
DirViewTreeState *pTreeState = new DirViewTreeState();
- uintptr_t diffpos = ctxt.GetFirstDiffPosition();
- while (diffpos)
+ DIFFITEM *diffpos = ctxt.GetFirstDiffPosition();
+ while (diffpos != nullptr)
{
const DIFFITEM &di = ctxt.GetNextDiffPosition(diffpos);
if (di.HasChildren())
void RestoreTreeState(CDiffContext& ctxt, DirViewTreeState *pTreeState)
{
- uintptr_t diffpos = ctxt.GetFirstDiffPosition();
- while (diffpos)
+ DIFFITEM *diffpos = ctxt.GetFirstDiffPosition();
+ while (diffpos != nullptr)
{
DIFFITEM &di = ctxt.GetNextDiffRefPosition(diffpos);
if (di.HasChildren())
#include <algorithm>
#include "FileTransform.h"
-struct DIFFITEM;
class CDiffContext;
class PathContext;
class PluginManager;
void ConfirmActionList(const CDiffContext& ctxt, const FileActionScript & actionList);
UPDATEITEM_TYPE UpdateDiffAfterOperation(const FileActionItem & act, CDiffContext& ctxt, DIFFITEM &di);
-uintptr_t FindItemFromPaths(const CDiffContext& ctxt, const PathContext& paths);
-
-bool IsItemCopyable(const DIFFITEM & di, int index);
-bool IsItemDeletable(const DIFFITEM & di, int index);
-bool IsItemDeletableOnBoth(const CDiffContext& ctxt, const DIFFITEM & di);
-bool AreItemsOpenable(const CDiffContext& ctxt, SELECTIONTYPE selectionType, const DIFFITEM & di1, const DIFFITEM & di2);
-bool AreItemsOpenable(const CDiffContext& ctxt, const DIFFITEM & di1, const DIFFITEM & di2, const DIFFITEM & di3);
-bool IsItemOpenableOn(const DIFFITEM & di, int index);
-bool IsItemOpenableOnWith(const DIFFITEM & di, int index);
-bool IsItemCopyableToOn(const DIFFITEM & di, int index);
-bool IsItemNavigableDiff(const CDiffContext& ctxt, const DIFFITEM & di);
-bool IsItemExistAll(const CDiffContext& ctxt, const DIFFITEM & di);
-bool IsShowable(const CDiffContext& ctxt, const DIFFITEM & di, const DirViewFilterSettings& filter);
-
-bool GetOpenOneItem(const CDiffContext& ctxt, uintptr_t pos1, const DIFFITEM *pdi[3],
+DIFFITEM *FindItemFromPaths(const CDiffContext& ctxt, const PathContext& paths);
+
+bool IsItemCopyable(const DIFFITEM &di, int index);
+bool IsItemDeletable(const DIFFITEM &di, int index);
+bool IsItemDeletableOnBoth(const CDiffContext& ctxt, const DIFFITEM &di);
+bool AreItemsOpenable(const CDiffContext& ctxt, SELECTIONTYPE selectionType, const DIFFITEM &di1, const DIFFITEM &di2);
+bool AreItemsOpenable(const CDiffContext& ctxt, const DIFFITEM &di1, const DIFFITEM &di2, const DIFFITEM &di3);
+bool IsItemOpenableOn(const DIFFITEM &di, int index);
+bool IsItemOpenableOnWith(const DIFFITEM &di, int index);
+bool IsItemCopyableToOn(const DIFFITEM &di, int index);
+bool IsItemNavigableDiff(const CDiffContext& ctxt, const DIFFITEM &di);
+bool IsItemExistAll(const CDiffContext& ctxt, const DIFFITEM &di);
+bool IsShowable(const CDiffContext& ctxt, const DIFFITEM &di, const DirViewFilterSettings& filter);
+
+bool GetOpenOneItem(const CDiffContext& ctxt, DIFFITEM *pos1, const DIFFITEM *pdi[3],
PathContext &paths, int & sel1, bool & isDir, int nPane[3], String& errmsg);
-bool GetOpenTwoItems(const CDiffContext& ctxt, SELECTIONTYPE selectionType, uintptr_t pos1, uintptr_t pos2, const DIFFITEM *pdi[3],
+bool GetOpenTwoItems(const CDiffContext& ctxt, SELECTIONTYPE selectionType, DIFFITEM *pos1, DIFFITEM *pos2, const DIFFITEM *pdi[3],
PathContext &paths, int & sel1, int & sel2, bool & isDir, int nPane[3], String& errmsg);
-bool GetOpenThreeItems(const CDiffContext& ctxt, uintptr_t pos1, uintptr_t pos2, uintptr_t pos3, const DIFFITEM *pdi[3],
+bool GetOpenThreeItems(const CDiffContext& ctxt, DIFFITEM *pos1, DIFFITEM *pos2, DIFFITEM *pos3, const DIFFITEM *pdi[3],
PathContext &paths, int & sel1, int & sel2, int & sel3, bool & isDir, int nPane[3], String& errmsg);
void GetItemFileNames(const CDiffContext& ctxt, const DIFFITEM& di, String& strLeft, String& strRight);
PathContext GetItemFileNames(const CDiffContext& ctxt, const DIFFITEM& di);
-String GetItemFileName(const CDiffContext& ctx, const DIFFITEM & di, int index);
-int GetColImage(const DIFFITEM & di);
+String GetItemFileName(const CDiffContext& ctx, const DIFFITEM &di, int index);
+int GetColImage(const DIFFITEM &di);
void SetDiffStatus(DIFFITEM& di, unsigned diffcode, unsigned mask);
void SetDiffCompare(DIFFITEM& di, unsigned diffcode);
return ((*this).*m_cur_method)(pscript, it);
}
- bool operator()(const DIFFITEM & di) const
+ bool operator()(const DIFFITEM &di) const
{
return ((*this).*m_cur_method2)(di);
}
m_pDirView->DeleteAllDisplayItems();
// Don't clear if only scanning selected items
if (!m_bMarkedRescan)
+ {
m_pCtxt->RemoveAll();
+ m_pCtxt->InitDiffItemList();
+ }
LoadLineFilterList();
* calls slow DirView functions to get item position and to update GUI.
* Use UpdateStatusFromDisk() function instead.
*/
-void CDirDoc::ReloadItemStatus(uintptr_t diffPos, int idx)
+void CDirDoc::ReloadItemStatus(DIFFITEM *diffPos, int idx)
{
// in case just copied (into existence) or modified
m_pCtxt->UpdateStatusFromDisk(diffPos, idx);
void CDirDoc::UpdateChangedItem(PathContext &paths,
UINT nDiffs, UINT nTrivialDiffs, bool bIdentical)
{
- uintptr_t pos = FindItemFromPaths(*m_pCtxt, paths);
+ DIFFITEM *pos = FindItemFromPaths(*m_pCtxt, paths);
// If we failed files could have been swapped so lets try again
if (!pos)
{
UINT nDiffs, UINT nTrivialDiffs, bool bIdentical);
void UpdateResources();
void InitStatusStrings();
- void ReloadItemStatus(uintptr_t diffPos, int idx);
+ void ReloadItemStatus(DIFFITEM *diffPos, int idx);
void Redisplay();
virtual ~CDirDoc();
void SetDirView( CDirView *newView ); // TODO Perry
* @brief Implementation for DirItem routines
*/
+#include "stdafx.h"
#include "DirItem.h"
#include <windows.h>
#include "UnicodeString.h"
#include "paths.h"
#include "TFile.h"
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
/**
* @brief Convert file flags to string presentation.
* This function converts file flags to a string presentation that can be
#include <utility>
#include "IListCtrl.h"
-struct DIFFITEM;
+class DIFFITEM;
class DirItemWithIndexIterator : public std::iterator<std::forward_iterator_tag, std::pair<int, DIFFITEM *> >
{
* @brief Implementation of DirScan (q.v.) and helper functions
*/
+#include "stdafx.h"
#include "DirScan.h"
#include <cassert>
#include <memory>
#include "OptionsDef.h"
#include "OptionsMgr.h"
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
using Poco::NotificationQueue;
using Poco::Notification;
using Poco::AutoPtr;
using Poco::Stopwatch;
// Static functions (ie, functions only used locally)
-void CompareDiffItem(DIFFITEM &di, CDiffContext * pCtxt);
-static void StoreDiffData(DIFFITEM &di, CDiffContext * pCtxt,
- const FolderCmp * pCmpData);
-static DIFFITEM *AddToList(const String& sLeftDir, const String& sRightDir, const DirItem * lent, const DirItem * rent,
+void CompareDiffItem(DIFFITEM &di, CDiffContext *pCtxt);
+static void StoreDiffData(DIFFITEM &di, CDiffContext *pCtxt,
+ const FolderCmp *pCmpData);
+static DIFFITEM *AddToList(const String &sLeftDir, const String &sRightDir, const DirItem *lent, const DirItem *rent,
unsigned code, DiffFuncStruct *myStruct, DIFFITEM *parent);
-static DIFFITEM *AddToList(const String& sDir1, const String& sDir2, const String& sDir3, const DirItem * ent1, const DirItem * ent2, const DirItem * ent3,
+static DIFFITEM *AddToList(const String &sDir1, const String &sDir2, const String &sDir3, const DirItem *ent1, const DirItem *ent2, const DirItem *ent3,
unsigned code, DiffFuncStruct *myStruct, DIFFITEM *parent, int nItems = 3);
-static void UpdateDiffItem(DIFFITEM & di, bool & bExists, CDiffContext *pCtxt);
-static int CompareItems(NotificationQueue& queue, DiffFuncStruct *myStruct, uintptr_t parentdiffpos);
+static void UpdateDiffItem(DIFFITEM &di, bool &bExists, CDiffContext *pCtxt);
+static int CompareItems(NotificationQueue &queue, DiffFuncStruct *myStruct, DIFFITEM *parentdiffpos);
class WorkNotification: public Poco::Notification
{
* @brief Collect file- and folder-names to list.
* This function walks given folders and adds found subfolders and files into
* lists. There are two modes, determined by the @p depth:
- * - in non-recursive mode we walk only given folders, and add files.
+ * - in non-recursive mode we walk only given folders, and add files
* contained. Subfolders are added as folder items, not walked into.
* - in recursive mode we walk all subfolders and add the files they
* contain into list.
* @param [in] rightsubdir Right side subdirectory under root path
* @param [in] bRightUniq Is right-side folder unique folder?
* @param [in] myStruct Compare-related data, like context etc.
- * @param [in] casesensitive Is filename compare casesensitive?
+ * @param [in] casesensitive Is filename compare case sensitive?
* @param [in] depth Levels of subdirectories to scan, -1 scans all
* @param [in] parent Folder diff item to be scanned
* @param [in] bUniques If true, walk into unique folders.
* @param parentdiffpos [in] Position of parent diff item
* @return >= 0 number of diff items, -1 if compare was aborted
*/
-int DirScan_CompareItems(DiffFuncStruct *myStruct, uintptr_t parentdiffpos)
+int DirScan_CompareItems(DiffFuncStruct *myStruct, DIFFITEM *parentdiffpos)
{
const int compareMethod = myStruct->context->GetCompareMethod();
int nworkers = 1;
return res;
}
-static int CompareItems(NotificationQueue& queue, DiffFuncStruct *myStruct, uintptr_t parentdiffpos)
+static int CompareItems(NotificationQueue& queue, DiffFuncStruct *myStruct, DIFFITEM *parentdiffpos)
{
NotificationQueue queueResult;
Stopwatch stopwatch;
int res = 0;
int count = 0;
bool bCompareFailure = false;
- if (parentdiffpos == 0)
+ if (parentdiffpos == nullptr)
myStruct->pSemaphore->wait();
stopwatch.start();
- uintptr_t pos = pCtxt->GetFirstChildDiffPosition(parentdiffpos);
- while (pos != 0)
+ DIFFITEM *pos = pCtxt->GetFirstChildDiffPosition(parentdiffpos);
+ while (pos != nullptr)
{
if (pCtxt->ShouldAbort())
break;
stopwatch.restart();
}
myStruct->pSemaphore->wait();
- uintptr_t curpos = pos;
+ DIFFITEM *curpos = pos;
DIFFITEM &di = pCtxt->GetNextSiblingDiffRefPosition(pos);
bool existsalldirs = di.diffcode.existAll();
if (di.diffcode.isDirectory() && pCtxt->m_bRecursive)
DIFFITEM &di = pWorkCompletedNf->data();
if (di.diffcode.isResultError()) {
DIFFITEM *diParent = di.parent;
+ assert(di.parent != nullptr);
if (diParent != nullptr)
{
diParent->diffcode.diffcode |= DIFFCODE::CMPERR;
* @param parentdiffpos [in] Position of parent diff item
* @return >= 0 number of diff items, -1 if compare was aborted
*/
-static int CompareRequestedItems(DiffFuncStruct *myStruct, uintptr_t parentdiffpos)
+static int CompareRequestedItems(DiffFuncStruct *myStruct, DIFFITEM *parentdiffpos)
{
CDiffContext *pCtxt = myStruct->context;
int res = 0;
bool bCompareFailure = false;
- uintptr_t pos = pCtxt->GetFirstChildDiffPosition(parentdiffpos);
+ DIFFITEM *pos = pCtxt->GetFirstChildDiffPosition(parentdiffpos);
- while (pos != NULL)
+ while (pos != nullptr)
{
if (pCtxt->ShouldAbort())
{
break;
}
- uintptr_t curpos = pos;
+ DIFFITEM *curpos = pos;
DIFFITEM &di = pCtxt->GetNextSiblingDiffRefPosition(pos);
bool existsalldirs = di.diffcode.existAll();
if (di.diffcode.isDirectory())
CompareDiffItem(di, pCtxt);
if (di.diffcode.isResultError()) {
DIFFITEM *diParent = di.parent;
+ assert(di.parent != nullptr);
if (diParent != nullptr)
{
diParent->diffcode.diffcode |= DIFFCODE::CMPERR;
return bCompareFailure ? -1 : res;;
}
-int DirScan_CompareRequestedItems(DiffFuncStruct *myStruct, uintptr_t parentdiffpos)
+int DirScan_CompareRequestedItems(DiffFuncStruct *myStruct, DIFFITEM *parentdiffpos)
{
CAssureScriptsForThread scriptsForRescan;
return CompareRequestedItems(myStruct, parentdiffpos);
}
-static int markChildrenForRescan(CDiffContext *pCtxt, uintptr_t parentdiffpos)
+static int markChildrenForRescan(CDiffContext *pCtxt, DIFFITEM *parentdiffpos)
{
int ncount = 0;
- uintptr_t pos = pCtxt->GetFirstChildDiffPosition(parentdiffpos);
- while (pos != NULL)
+ DIFFITEM *pos = pCtxt->GetFirstChildDiffPosition(parentdiffpos);
+ while (pos != nullptr)
{
- uintptr_t curpos = pos;
+ DIFFITEM *curpos = pos;
DIFFITEM &di = pCtxt->GetNextSiblingDiffRefPosition(pos);
if (di.diffcode.isDirectory())
ncount += markChildrenForRescan(pCtxt, curpos);
return ncount;
}
-int DirScan_UpdateMarkedItems(DiffFuncStruct *myStruct, uintptr_t parentdiffpos)
+int DirScan_UpdateMarkedItems(DiffFuncStruct *myStruct, DIFFITEM *parentdiffpos)
{
CDiffContext *pCtxt = myStruct->context;
- uintptr_t pos = pCtxt->GetFirstChildDiffPosition(parentdiffpos);
+ DIFFITEM *pos = pCtxt->GetFirstChildDiffPosition(parentdiffpos);
int ncount = 0;
- while (pos != NULL)
+ while (pos != nullptr)
{
if (pCtxt->ShouldAbort())
break;
- uintptr_t curpos = pos;
+ DIFFITEM *curpos = pos;
DIFFITEM &di = pCtxt->GetNextSiblingDiffRefPosition(pos);
if (di.diffcode.isScanNeeded())
{
* - false if items were deleted, so diffitem is not valid
* @param [in] pCtxt Compare context
*/
-static void UpdateDiffItem(DIFFITEM & di, bool & bExists, CDiffContext *pCtxt)
+static void UpdateDiffItem(DIFFITEM &di, bool & bExists, CDiffContext *pCtxt)
{
bExists = false;
di.diffcode.setSideNone();
*
* This function does the actual compare for previously gathered list of
* items. Basically we:
- * - ignore items matching filefilters
+ * - ignore items matching file filters
* - add non-ignored directories (no compare for directory items)
- * - add unique files
+ * - add unique files
* - compare files
*
* @param [in] di DiffItem to compare
* @brief Add one compare item to list.
*/
static DIFFITEM *AddToList(const String& sDir1, const String& sDir2, const String& sDir3,
- const DirItem * ent1, const DirItem * ent2, const DirItem * ent3,
- unsigned code, DiffFuncStruct *myStruct, DIFFITEM *parent, int nItems)
+ const DirItem *ent1, const DirItem *ent2, const DirItem *ent3,
+ unsigned code, DiffFuncStruct *myStruct, DIFFITEM *parent, int nItems /*= 3*/)
{
// We must store both paths - we cannot get paths later
// and we need unique item paths for example when items
// change to identical
- DIFFITEM *di = myStruct->context->AddDiff(parent);
+ DIFFITEM *di = myStruct->context->AddNewDiff(parent);
- di->parent = parent;
di->diffFileInfo[0].path = sDir1;
di->diffFileInfo[1].path = sDir2;
di->diffFileInfo[2].path = sDir3;
class DiffItemList;
class PathContext;
class IAbortable;
-struct DIFFITEM;
+class DIFFITEM;
struct DiffFuncStruct;
int DirScan_GetItems(const PathContext &paths, const String subdir[], DiffFuncStruct *myStruct,
bool casesensitive, int depth, DIFFITEM *parent, bool bUniques);
-int DirScan_UpdateMarkedItems(DiffFuncStruct *myStruct, uintptr_t parentdiffpos);
+int DirScan_UpdateMarkedItems(DiffFuncStruct *myStruct, DIFFITEM *parentdiffpos);
-int DirScan_CompareItems(DiffFuncStruct *, uintptr_t parentdiffpos);
-int DirScan_CompareRequestedItems(DiffFuncStruct *, uintptr_t parentdiffpos);
+int DirScan_CompareItems(DiffFuncStruct *, DIFFITEM *parentdiffpos);
+int DirScan_CompareRequestedItems(DiffFuncStruct *, DIFFITEM *parentdiffpos);
*
*/
+#include "stdafx.h"
#include "DirTravel.h"
#include <algorithm>
#include <Poco/DirectoryIterator.h>
#include "paths.h"
#include "Win_VersionHelper.h"
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
using Poco::DirectoryIterator;
using Poco::Timestamp;
}
/**
- * @brief Find files and subfolders from given folder.
- * This function saves all files and subfolders in given folder to arrays.
+ * @brief Find file and sub-folder names from given folder.
+ * This function saves all file and sub-folder names in given folder to arrays.
* We use 64-bit version of stat() to get times since find doesn't return
* valid times for very old files (around year 1970). Even stat() seems to
* give negative time values but we can live with that. Those around 1970
- * times can happen when file is created so that it doesn't get valid
- * creation or modificatio dates.
+ * times can happen when file is created so that it doesn't get valid
+ * creation or modification dates.
* @param [in] sDir Base folder for files and subfolders.
- * @param [in, out] dirs Array where subfolders are stored.
- * @param [in, out] files Array where files are stored.
+ * @param [in, out] dirs Array where subfolder names are stored.
+ * @param [in, out] files Array where file names are stored.
*/
static void LoadFiles(const String& sDir, DirItemArray * dirs, DirItemArray * files)
{
* @param [in,out] index Index of the item to be inserted.
* @param [in,out] alldiffs Number of different items
*/
-void CDirView::RedisplayChildren(uintptr_t diffpos, int level, UINT &index, int &alldiffs)
+void CDirView::RedisplayChildren(DIFFITEM *diffpos, int level, UINT &index, int &alldiffs)
{
CDirDoc *pDoc = GetDocument();
const CDiffContext &ctxt = GetDiffContext();
- while (diffpos)
+ while (diffpos != nullptr)
{
- uintptr_t curdiffpos = diffpos;
+ DIFFITEM *curdiffpos = diffpos;
const DIFFITEM &di = ctxt.GetNextSiblingDiffPosition(diffpos);
if (di.diffcode.isResultDiff() || (!di.diffcode.existAll() && !di.diffcode.isResultFiltered()))
}
int alldiffs = 0;
- uintptr_t diffpos = ctxt.GetFirstDiffPosition();
+ DIFFITEM *diffpos = ctxt.GetFirstDiffPosition();
RedisplayChildren(diffpos, 0, cnt, alldiffs);
if (pDoc->m_diffThread.GetThreadState() == CDiffThread::THREAD_COMPLETED)
GetParentFrame()->SetLastCompareResult(alldiffs);
if (bRecursive)
ExpandSubdirs(ctxt, dip);
- uintptr_t diffpos = ctxt.GetFirstChildDiffPosition(GetItemKey(sel));
+ DIFFITEM *diffpos = ctxt.GetFirstChildDiffPosition(GetItemKey(sel));
UINT indext = sel + 1;
int alldiffs;
RedisplayChildren(diffpos, dip.GetDepth() + 1, indext, alldiffs);
* @param [in] pos1 First item position.
* @param [in] pos2 Second item position.
*/
-void CDirView::OpenSpecialItems(uintptr_t pos1, uintptr_t pos2, uintptr_t pos3)
+void CDirView::OpenSpecialItems(DIFFITEM *pos1, DIFFITEM *pos2, DIFFITEM *pos3)
{
- if (!pos2 && !pos3)
+ if (pos2==nullptr && pos3==nullptr)
{
// Browse to parent folder(s) selected
// SPECIAL_ITEM_POS is position for
const CDiffContext& ctxt = GetDiffContext();
// First, figure out what was selected (store into pos1 & pos2)
- uintptr_t pos1 = NULL, pos2 = NULL, pos3 = NULL;
+ DIFFITEM *pos1 = nullptr, *pos2 = nullptr, *pos3 = nullptr;
int sel1 = -1, sel2 = -1, sel3 = -1;
if (!GetSelectedItems(&sel1, &sel2, &sel3))
{
}
pos1 = GetItemKey(sel1);
- ASSERT(pos1);
+ ASSERT(pos1 != nullptr);
if (sel2 != -1)
{
pos2 = GetItemKey(sel2);
- ASSERT(pos2);
+ ASSERT(pos2 != nullptr);
if (sel3 != -1)
pos3 = GetItemKey(sel3);
}
// Now handle the various cases of what was selected
- if (pos1 == SPECIAL_ITEM_POS)
+ if (pos1 == (DIFFITEM *)SPECIAL_ITEM_POS)
{
OpenSpecialItems(pos1, pos2, pos3);
return;
const CDiffContext& ctxt = GetDiffContext();
// First, figure out what was selected (store into pos1 & pos2)
- uintptr_t pos1 = NULL, pos2 = NULL;
+ DIFFITEM *pos1 = nullptr, *pos2 = nullptr;
int sel1 = -1, sel2 = -1, sel3 = -1;
if (!GetSelectedItems(&sel1, &sel2, &sel3))
{
// Now handle the various cases of what was selected
- if (pos1 == SPECIAL_ITEM_POS)
+ if (pos1 == (DIFFITEM *)SPECIAL_ITEM_POS)
{
ASSERT(false);
return;
* @param [in] idx Item's index to list in UI.
* @return Key for item in given index.
*/
-uintptr_t CDirView::GetItemKey(int idx) const
+DIFFITEM *CDirView::GetItemKey(int idx) const
{
- return (uintptr_t) m_pList->GetItemData(idx);
+ return (DIFFITEM *) m_pList->GetItemData(idx);
}
// SetItemKey & GetItemKey encapsulate how the display list items
/**
* Given index in list control, get modifiable reference to its DIFFITEM data
*/
-DIFFITEM & CDirView::GetDiffItem(int sel)
+DIFFITEM &CDirView::GetDiffItem(int sel)
{
- uintptr_t diffpos = GetItemKey(sel);
+ DIFFITEM *diffpos = GetItemKey(sel);
// If it is special item, return empty DIFFITEM
- if (diffpos == SPECIAL_ITEM_POS)
+ if (diffpos == (DIFFITEM *)SPECIAL_ITEM_POS)
{
- // TODO: It would be better if there were individual items
- // for whatever these special items are
- // because here we have to hope client does not modify this
- // static (shared) item
- return DIFFITEM::emptyitem;
+ return *DIFFITEM::GetEmptyItem();
}
return GetDiffContext().GetDiffRefAt(diffpos);
}
* @brief Given key, get index of item which has it stored.
* This function searches from list in UI.
*/
-int CDirView::GetItemIndex(uintptr_t key)
+int CDirView::GetItemIndex(DIFFITEM *key)
{
LVFINDINFO findInfo;
*/
void CDirView::GetItemFileNames(int sel, String& strLeft, String& strRight) const
{
- UINT_PTR diffpos = GetItemKey(sel);
- if (diffpos == (UINT_PTR)SPECIAL_ITEM_POS)
+ DIFFITEM *diffpos = GetItemKey(sel);
+ if (diffpos == (DIFFITEM *)SPECIAL_ITEM_POS)
{
strLeft.erase();
strRight.erase();
*/
void CDirView::GetItemFileNames(int sel, PathContext * paths) const
{
- UINT_PTR diffpos = GetItemKey(sel);
- if (diffpos == SPECIAL_ITEM_POS)
+ DIFFITEM *diffpos = GetItemKey(sel);
+ if (diffpos == (DIFFITEM *)SPECIAL_ITEM_POS)
{
for (int nIndex = 0; nIndex < GetDocument()->m_nDirs; nIndex++)
paths->SetPath(nIndex, _T(""));
else if (m_bTreeMode && sel >= 0)
{
const DIFFITEM& di = GetDiffItem(sel);
+ assert(di.parent != nullptr);
if (di.parent != nullptr)
{
- int i = GetItemIndex((uintptr_t)di.parent);
+ int i = GetItemIndex(di.parent);
if (i >= 0)
MoveFocus(sel, i, GetSelectedCount());
}
*/
void CDirView::AddParentFolderItem(bool bEnable)
{
- AddNewItem(0, SPECIAL_ITEM_POS, bEnable ? DIFFIMG_DIRUP : DIFFIMG_DIRUP_DISABLE, 0);
+ AddNewItem(0, (DIFFITEM *)SPECIAL_ITEM_POS, bEnable ? DIFFIMG_DIRUP : DIFFIMG_DIRUP_DISABLE, 0);
}
template <int flag>
for (int i = 0; i < selCount; i++)
{
// Don't select special items (SPECIAL_ITEM_POS)
- uintptr_t diffpos = GetItemKey(i);
- if (diffpos != SPECIAL_ITEM_POS)
+ DIFFITEM *diffpos = GetItemKey(i);
+ if (diffpos != (DIFFITEM *)SPECIAL_ITEM_POS)
m_pList->SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
}
}
else
{
// Don't show number to special items
- uintptr_t pos = GetItemKey(focusItem);
- if (pos != SPECIAL_ITEM_POS)
+ DIFFITEM *pos = GetItemKey(focusItem);
+ if (pos != (DIFFITEM *)SPECIAL_ITEM_POS)
{
// If compare is non-recursive reduce special items count
bool bRecursive = GetDiffContext().m_bRecursive;
int nRows = m_pList->GetItemCount();
for (int currRow = nRows - 1; currRow >= 0; currRow--)
{
- uintptr_t pos = GetItemKey(currRow);
- if (pos == SPECIAL_ITEM_POS)
+ DIFFITEM *pos = GetItemKey(currRow);
+ if (pos == (DIFFITEM *)SPECIAL_ITEM_POS)
continue;
bool bFound = false;
- DIFFITEM & di = GetDiffItem(currRow);
+ DIFFITEM &di = GetDiffItem(currRow);
PathContext paths;
for (int i = 0; i < pDoc->m_nDirs; i++)
{
if (lParam2 == -1)
return 1;
- uintptr_t diffposl = (uintptr_t)lParam1;
- uintptr_t diffposr = (uintptr_t)lParam2;
+ DIFFITEM *diffposl = (DIFFITEM *)lParam1;
+ DIFFITEM *diffposr = (DIFFITEM *)lParam2;
const DIFFITEM &ldi = pThis->pCtxt->GetDiffAt(diffposl);
const DIFFITEM &rdi = pThis->pCtxt->GetDiffAt(diffposr);
// compare 'left' and 'right' parameters as appropriate
}
/// Add new item to list view
-int CDirView::AddNewItem(int i, uintptr_t diffpos, int iImage, int iIndent)
+int CDirView::AddNewItem(int i, DIFFITEM *diffpos, int iImage, int iIndent)
{
LV_ITEM lvItem;
lvItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE | LVIF_INDENT;
{
int nIdx = pParam->item.iItem;
int i = m_pColItems->ColPhysToLog(pParam->item.iSubItem);
- uintptr_t key = GetItemKey(nIdx);
- if (key == SPECIAL_ITEM_POS)
+ DIFFITEM *key = GetItemKey(nIdx);
+ if (key == (DIFFITEM *)SPECIAL_ITEM_POS)
{
if (m_pColItems->IsColName(i))
{
class FileActionScript;
-struct DIFFITEM;
-
typedef enum { eMain, eContext } eMenuType;
class CDirDoc;
/**
* @brief Position value for special items (..) in directory compare view.
*/
-const uintptr_t SPECIAL_ITEM_POS = (uintptr_t) - 1L;
+const uintptr_t SPECIAL_ITEM_POS = (uintptr_t)(reinterpret_cast<DIFFITEM *>( - 1L));
/** Default column width in directory compare */
const UINT DefColumnWidth = 150;
void StartCompare(CompareStats *pCompareStats);
void Redisplay();
- void RedisplayChildren(uintptr_t diffpos, int level, UINT &index, int &alldiffs);
+ void RedisplayChildren(DIFFITEM *diffpos, int level, UINT &index, int &alldiffs);
void UpdateResources();
void LoadColumnHeaderItems();
- uintptr_t GetItemKey(int idx) const;
- int GetItemIndex(uintptr_t key);
+ DIFFITEM *GetItemKey(int idx) const;
+ int GetItemIndex(DIFFITEM *key);
// for populating list
void DeleteItem(int sel);
void DeleteAllDisplayItems();
private:
void InitiateSort();
void NameColumn(const char* idname, int subitem);
- int AddNewItem(int i, uintptr_t diffpos, int iImage, int iIndent);
+ int AddNewItem(int i, DIFFITEM *diffpos, int iImage, int iIndent);
// End DirViewCols.cpp
private:
int GetLastDifferentItem();
int AddSpecialItems();
void GetCurrentColRegKeys(std::vector<String>& colKeys);
- void OpenSpecialItems(uintptr_t pos1, uintptr_t pos2, uintptr_t pos3);
+ void OpenSpecialItems(DIFFITEM *pos1, DIFFITEM *pos2, DIFFITEM *pos3);
// Implementation data
protected:
void OpenParentDirectory();
template<SIDE_TYPE srctype, SIDE_TYPE dsttype>
void DoUpdateDirCopy(CCmdUI* pCmdUI, eMenuType menuType);
- const DIFFITEM & GetDiffItem(int sel) const;
- DIFFITEM & GetDiffItem(int sel);
+ const DIFFITEM &GetDiffItem(int sel) const;
+ DIFFITEM &GetDiffItem(int sel);
int GetSingleSelectedItem() const;
void MoveFocus(int currentInd, int i, int selCount);
*
* @date Created: 2003-08-19
*/
+
+#include "stdafx.h"
#include "DirViewColItems.h"
#include <Poco/Timestamp.h>
#include <Shlwapi.h>
#include "paths.h"
#include "MergeApp.h"
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
using Poco::Timestamp;
#ifndef countof
* @param [in] bLeft Is the item left-size item?
* @return String proper to show in the GUI.
*/
-static String GetVersion(const CDiffContext * pCtxt, const DIFFITEM * pdi, int nIndex)
+static String GetVersion(const CDiffContext * pCtxt, const DIFFITEM *pdi, int nIndex)
{
- DIFFITEM & di = const_cast<DIFFITEM &>(*pdi);
+ DIFFITEM &di = const_cast<DIFFITEM &>(*pdi);
DiffFileInfo & dfi = di.diffFileInfo[nIndex];
if (dfi.version.IsCleared())
{
return dfi.version.GetFileVersionString();
}
-static uint64_t GetVersionQWORD(const CDiffContext * pCtxt, const DIFFITEM * pdi, int nIndex)
+static uint64_t GetVersionQWORD(const CDiffContext * pCtxt, const DIFFITEM *pdi, int nIndex)
{
- DIFFITEM & di = const_cast<DIFFITEM &>(*pdi);
+ DIFFITEM &di = const_cast<DIFFITEM &>(*pdi);
DiffFileInfo & dfi = di.diffFileInfo[nIndex];
if (dfi.version.IsCleared())
{
*/
String
DirViewColItems::ColGetTextToDisplay(const CDiffContext *pCtxt, int col,
- const DIFFITEM & di) const
+ const DIFFITEM &di) const
{
// Custom properties have custom get functions
const DirColInfo * pColInfo = GetDirColInfo(col);
* @return Order of items.
*/
int
-DirViewColItems::ColSort(const CDiffContext *pCtxt, int col, const DIFFITEM & ldi,
- const DIFFITEM & rdi, bool bTreeMode) const
+DirViewColItems::ColSort(const CDiffContext *pCtxt, int col, const DIFFITEM &ldi,
+ const DIFFITEM &rdi, bool bTreeMode) const
{
// Custom properties have custom sort functions
const DirColInfo * pColInfo = GetDirColInfo(col);
#include <vector>
#include <sstream>
-struct DIFFITEM;
+class DIFFITEM;
class CDiffContext;
// DirViewColItems typedefs
String GetColDescription(int col) const;
int GetColCount() const;
int GetDispColCount() const { return m_dispcols; }
- String ColGetTextToDisplay(const CDiffContext *pCtxt, int col, const DIFFITEM & di) const;
- int ColSort(const CDiffContext *pCtxt, int col, const DIFFITEM & ldi, const DIFFITEM &rdi, bool bTreeMode) const;
+ String ColGetTextToDisplay(const CDiffContext *pCtxt, int col, const DIFFITEM &di) const;
+ int ColSort(const CDiffContext *pCtxt, int col, const DIFFITEM &ldi, const DIFFITEM &rdi, bool bTreeMode) const;
int ColPhysToLog(int i) const { return m_invcolorder[i]; }
int ColLogToPhys(int i) const { return m_colorder[i]; } /**< -1 if not displayed */
* @brief Implementation file for FolderCmp
*/
+#include "stdafx.h"
#include "diff.h"
#include "FolderCmp.h"
#include <cassert>
#include "TimeSizeCompare.h"
#include "TFile.h"
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
using CompareEngines::ByteCompare;
using CompareEngines::BinaryCompare;
using CompareEngines::TimeSizeCompare;
if (pDirDoc != nullptr && pDirDoc->HasDiffs())
{
CDiffContext &ctxt = pDirDoc->GetDiffContext();
- if (UINT_PTR pos = FindItemFromPaths(ctxt, m_filePaths))
+ if (DIFFITEM *pos = FindItemFromPaths(ctxt, m_filePaths))
{
DIFFITEM &di = ctxt.GetDiffRefAt(pos);
::UpdateDiffItem(m_nBuffers, di, &ctxt);
+++ /dev/null
-/**
- * @file ListEntry.h
- *
- * @brief Declaration of ListEntry
- */
-#pragma once
-
-/**
- * @brief Simple LIST_ENTRY wrapper
- */
-class ListEntry
-{
-public:
- ListEntry()
- {
- Flink = Blink = this;
- }
- void Append(ListEntry *p)
- {
- p->Flink = Blink->Flink;
- p->Blink = Blink;
- Blink->Flink = p;
- Blink = p;
- }
- void RemoveSelf()
- {
- Blink->Flink = Flink;
- Flink->Blink = Blink;
- Flink = Blink = this;
- }
- ListEntry *IsSibling(ListEntry *p) const
- {
- return p != this ? p : 0;
- }
- ListEntry *Flink;
- ListEntry *Blink;
-private:
- ListEntry(const ListEntry &); // disallow copy construction
- void operator=(const ListEntry &); // disallow assignment
-};
do { Sleep(100); } while (!pStats->IsCompareDone());\r
EXPECT_EQ(10, pStats->GetTotalItems());\r
EXPECT_EQ(10, pStats->GetCount(CompareStats::RESULT::RESULT_SAME));\r
- uintptr_t pos = ctxt.GetFirstDiffPosition();\r
- while (pos)\r
+ DIFFITEM *pos = ctxt.GetFirstDiffPosition();\r
+ while (pos != nullptr)\r
{\r
const DIFFITEM& di = ctxt.GetNextDiffPosition(pos);\r
for (int i = 0; i < 2; ++i)\r