#include "UniFile.h"
#include <cstdio>
#include <cassert>
+#include <memory>
+#include <cstdint>
#include <Poco/SharedMemory.h>
#include <Poco/Exception.h>
-#include <memory>
#include "UnicodeString.h"
#include "unicoder.h"
#include "paths.h" // paths_GetLongbPath()
#include <windows.h>
#endif
-using Poco::Int64;
using Poco::SharedMemory;
using Poco::Exception;
DWORD dwFileSizeLow, dwFileSizeHigh;
dwFileSizeLow = GetCompressedFileSize(m_filepath.c_str(), &dwFileSizeHigh);
if (GetLastError() == 0)
- m_filesize = ((Int64)dwFileSizeHigh << 32) + dwFileSizeLow;
+ m_filesize = ((int64_t)dwFileSizeHigh << 32) + dwFileSizeLow;
}
#endif
m_statusFetched = 1;
/**
* @brief Record occurrence of binary zero to stats
*/
-static void RecordZero(UniFile::txtstats & txstats, Int64 offset)
+static void RecordZero(UniFile::txtstats & txstats, int64_t offset)
{
++txstats.nzeros;
}
while (m_current - m_base + 1 < m_filesize)
{
wchar_t wch = *(wchar_t *)m_current;
- Int64 wch_offset = (m_current - m_base);
+ int64_t wch_offset = (m_current - m_base);
m_current += 2;
if (wch == '\n' || wch == '\r')
{
}
if (*eolptr == 0)
{
- Int64 offset = (eolptr - m_base);
+ int64_t offset = (eolptr - m_base);
RecordZero(m_txtstats, offset);
}
}
}
else if (!ch)
{
- Int64 offset = (m_current - m_base);
+ int64_t offset = (m_current - m_base);
RecordZero(m_txtstats, offset);
}
// always advance to next character
return true;
}
-Int64 UniStdioFile::GetPosition() const
+int64_t UniStdioFile::GetPosition() const
{
if (!IsOpen()) return 0;
return ftell(m_fp);
#define UniFile_h_included
#include "unicoder.h"
-#define POCO_NO_UNWINDOWS 1
-#include <Poco/Types.h>
+#include <cstdint>
namespace Poco { class SharedMemory; }
virtual bool ReadString(String & line, bool * lossy) = 0;
virtual bool ReadString(String & line, String & eol, bool * lossy) = 0;
virtual int GetLineNumber() const = 0;
- virtual Poco::Int64 GetPosition() const = 0;
+ virtual int64_t GetPosition() const = 0;
virtual bool WriteString(const String & line) = 0;
struct txtstats
protected:
int m_statusFetched; // 0 not fetched, -1 error, +1 success
- Poco::Int64 m_filesize;
+ int64_t m_filesize;
String m_filepath;
String m_filename;
int m_lineno; // current 0-based line of m_current
public:
virtual bool ReadString(String & line, bool * lossy);
virtual bool ReadString(String & line, String & eol, bool * lossy);
- virtual Poco::Int64 GetPosition() const { return m_current - m_base; }
+ virtual int64_t GetPosition() const { return m_current - m_base; }
virtual bool WriteString(const String & line);
// Implementation methods
virtual bool ReadString(String & line, String & eol, bool * lossy);
public:
- virtual Poco::Int64 GetPosition() const;
+ virtual int64_t GetPosition() const;
virtual int WriteBom();
virtual bool WriteString(const String & line);
// Implementation data
private:
FILE * m_fp;
- Poco::Int64 m_data; // offset after any initial BOM
+ int64_t m_data; // offset after any initial BOM
ucr::buffer m_ucrbuff;
};
#include <cstring>
#include <cassert>
#include <memory>
+#include <cstdint>
#include <Poco/SharedMemory.h>
#include <Poco/FileStream.h>
#include <Poco/ByteOrder.h>
using Poco::ByteOrder;
using Poco::Exception;
using Poco::Buffer;
-using Poco::Int64;
////////////////////////////////////////////////////////////////////////////////
// create the destination file
FileOutputStream fout(ucr::toUTF8(filepathDst), std::ios::out|std::ios::binary|std::ios::trunc);
Buffer<char> obuf(minbufsize);
- Int64 pos = nSizeOldBOM;
+ int64_t pos = nSizeOldBOM;
// write BOM
if (bWriteBOM)
#include <tchar.h>
#include <cassert>
#include <memory>
+#include <cstdint>
#include <Poco/UnicodeConverter.h>
#include "UnicodeString.h"
#include "ExConverter.h"
#endif
using Poco::UnicodeConverter;
-using Poco::UInt64;
namespace ucr
{
* FF FE 00 00 UTF-32, little endian
* 00 00 FE FF UTF-32, big-endian
*/
-UNICODESET DetermineEncoding(const unsigned char *pBuffer, UInt64 size, bool * pBom)
+UNICODESET DetermineEncoding(const unsigned char *pBuffer, uint64_t size, bool * pBom)
{
UNICODESET unicoding = NONE;
*pBom = false;
#include "UnicodeString.h"
#include "codepage.h"
-#define POCO_NO_UNWINDOWS 1
-#include <Poco/Types.h>
+#include <cstdint>
namespace ucr
{
bool CheckForInvalidUtf8(const char *pBuffer, size_t size);
-UNICODESET DetermineEncoding(const unsigned char *pBuffer, Poco::UInt64 size, bool * pBom);
+UNICODESET DetermineEncoding(const unsigned char *pBuffer, uint64_t size, bool * pBom);
int getDefaultCodepage();
void setDefaultCodepage(int cp);
#include "ByteComparator.h"
#include <cassert>
-#include <Poco/Types.h>
+#include <cstdint>
#include "UnicodeString.h"
#include "FileTextStats.h"
#include "CompareOptions.h"
-using Poco::Int64;
-
/**
* @brief Returns if given char is EOL byte.
* @param [in] ch Char to test.
* @param [in] offset Byte offset in whole file (among several buffers).
*/
static void TextScan(FileTextStats & stats, const char *ptr, const char *end, bool eof,
- bool crflag, Int64 offset)
+ bool crflag, int64_t offset)
{
const char *start = ptr; // remember for recording zero-byte offsets
*/
ByteComparator::COMP_RESULT ByteComparator::CompareBuffers(
FileTextStats & stats0, FileTextStats & stats1, const char* &ptr0, const char* &ptr1,
- const char* end0, const char* end1, bool eof0, bool eof1, Int64 offset0, Int64 offset1)
+ const char* end0, const char* end1, bool eof0, bool eof1, int64_t offset0, int64_t offset1)
{
ByteComparator::COMP_RESULT result = RESULT_SAME;
#ifndef ByteComparator_h_included
#define ByteComparator_h_included
-#include <Poco/Types.h>
+#include <cstdint>
class QuickCompareOptions;
struct FileTextStats;
COMP_RESULT CompareBuffers(FileTextStats & stats0, FileTextStats & stats1,
const char* &ptr0, const char* &ptr1, const char* end0, const char* end1,
- bool eof0, bool eof1, Poco::Int64 offset0, Poco::Int64 offset1);
+ bool eof0, bool eof1, int64_t offset0, int64_t offset1);
protected:
void HandleSide0Eol(char **ptr, const char *end, bool eof);
#include "ByteCompare.h"
#include <cassert>
-#include <Poco/Types.h>
+#include <cstdint>
#ifdef _WIN32
#include <io.h>
#else
#include "diff.h"
#include "ByteComparator.h"
-using Poco::Int64;
-
namespace CompareEngines
{
unsigned diffcode = 0;
// area of buffer currently holding data
- Int64 bfstart[2]; // offset into buff[i] where current data resides
- Int64 bfend[2]; // past-the-end pointer into buff[i], giving end of current data
+ int64_t bfstart[2]; // offset into buff[i] where current data resides
+ int64_t bfend[2]; // past-the-end pointer into buff[i], giving end of current data
// buff[0] has bytes to process from buff[0][bfstart[0]] to buff[0][bfend[0]-1]
bool eof[2]; // if we've finished file
const char* end0 = &buff[0][bfend[0]];
const char* end1 = &buff[1][bfend[1]];
- Int64 offset0 = (ptr0 - &buff[0][0]);
- Int64 offset1 = (ptr1 - &buff[1][0]);
+ int64_t offset0 = (ptr0 - &buff[0][0]);
+ int64_t offset1 = (ptr1 - &buff[1][0]);
// are these two buffers the same?
result = comparator.CompareBuffers(m_textStats[0], m_textStats[1],
#include "TimeSizeCompare.h"
#include <cstdlib>
#include <vector>
-#include <Poco/Types.h>
+#include <cstdint>
+#
#include <Poco/Timestamp.h>
#include "DiffItem.h"
#include "DiffWrapper.h"
-using Poco::Int64;
using Poco::Timestamp;
namespace CompareEngines
// Check that we have both filetimes
if (di.diffFileInfo[0].mtime != 0 && di.diffFileInfo[1].mtime != 0)
{
- Int64 nTimeDiff = di.diffFileInfo[0].mtime - di.diffFileInfo[1].mtime;
+ int64_t nTimeDiff = di.diffFileInfo[0].mtime - di.diffFileInfo[1].mtime;
if (nTimeDiff < 0) nTimeDiff *= -1;
if (m_ignoreSmallDiff)
{
#include <vector>\r
#include <algorithm>\r
#ifdef _DEBUG\r
+# define POCO_NO_UNWINDOWS 1
# include <Poco/Debugger.h>\r
# include <Poco/Format.h>\r
#endif\r
#include "IAbortable.h"
#include "DiffWrapper.h"
-using Poco::UIntPtr;
using Poco::FastMutex;
//////////////////////////////////////////////////////////////////////
* @param [in] bLeft Update left-side info.
* @param [in] bRight Update right-side info.
*/
-void CDiffContext::UpdateStatusFromDisk(UIntPtr diffpos, bool bLeft, bool bRight)
+void CDiffContext::UpdateStatusFromDisk(uintptr_t diffpos, bool bLeft, bool bRight)
{
DIFFITEM &di = GetDiffRefAt(diffpos);
if (bLeft)
#include <Poco/Mutex.h>
#include <Poco/ThreadLocal.h>
#include <memory>
+#include <cstdint>
#include "PathContext.h"
#include "DiffFileInfo.h"
#include "DiffItemList.h"
// change an existing difference
bool UpdateInfoFromDiskHalf(DIFFITEM & di, int nIndex);
- void UpdateStatusFromDisk(Poco::UIntPtr diffpos, bool bLeft, bool bRight);
- void UpdateStatusFromDisk(Poco::UIntPtr diffpos, bool bLeft, bool bMiddle, bool bRight);
+ void UpdateStatusFromDisk(uintptr_t diffpos, bool bLeft, bool bRight);
+ void UpdateStatusFromDisk(uintptr_t diffpos, bool bLeft, bool bMiddle, bool bRight);
bool CreateCompareOptions(int compareMethod, const DIFFOPTIONS & options);
CompareOptions * GetCompareOptions(int compareMethod);
#include "DiffItemList.h"
#include <cassert>
-using Poco::UIntPtr;
-
/**
* @brief Constructor
*/
* @brief Remove diffitem from structured DIFFITEM tree
* @param diffpos position of item to remove
*/
-void DiffItemList::RemoveDiff(UIntPtr diffpos)
+void DiffItemList::RemoveDiff(uintptr_t diffpos)
{
DIFFITEM *p = (DIFFITEM *)diffpos;
p->RemoveSelf();
void DiffItemList::RemoveAll()
{
while (m_root.IsSibling(m_root.Flink))
- RemoveDiff((UIntPtr)m_root.Flink);
+ RemoveDiff((uintptr_t)m_root.Flink);
}
/**
* @brief Get position of first item in structured DIFFITEM tree
*/
-UIntPtr DiffItemList::GetFirstDiffPosition() const
+uintptr_t DiffItemList::GetFirstDiffPosition() const
{
- return (UIntPtr)m_root.IsSibling(m_root.Flink);
+ return (uintptr_t)m_root.IsSibling(m_root.Flink);
}
/**
* @param parentdiffpos [in] Position of parent diff item
* @return Position of first child item
*/
-UIntPtr DiffItemList::GetFirstChildDiffPosition(UIntPtr parentdiffpos) const
+uintptr_t DiffItemList::GetFirstChildDiffPosition(uintptr_t parentdiffpos) const
{
DIFFITEM *parent = (DIFFITEM *)parentdiffpos;
if (parent)
- return (UIntPtr)parent->children.IsSibling(parent->children.Flink);
+ return (uintptr_t)parent->children.IsSibling(parent->children.Flink);
else
- return (UIntPtr)m_root.IsSibling(m_root.Flink);
+ return (uintptr_t)m_root.IsSibling(m_root.Flink);
}
/**
* @param diffpos position of current item, updated to next item position
* @return Diff Item in current position
*/
-const DIFFITEM &DiffItemList::GetNextDiffPosition(UIntPtr & diffpos) const
+const DIFFITEM &DiffItemList::GetNextDiffPosition(uintptr_t & diffpos) const
{
DIFFITEM *p = (DIFFITEM *)diffpos;
if (p->HasChildren())
do
{
if (cur->parent)
- diffpos = (UIntPtr)cur->parent->children.IsSibling(cur->Flink);
+ diffpos = (uintptr_t)cur->parent->children.IsSibling(cur->Flink);
else
- diffpos = (UIntPtr)m_root.IsSibling(cur->Flink);
+ diffpos = (uintptr_t)m_root.IsSibling(cur->Flink);
cur = cur->parent;
} while (!diffpos && cur);
}
* @param diffpos position of current item, updated to next item position
* @return Diff Item (by reference) in current position
*/
-DIFFITEM &DiffItemList::GetNextDiffRefPosition(UIntPtr & diffpos)
+DIFFITEM &DiffItemList::GetNextDiffRefPosition(uintptr_t & diffpos)
{
return (DIFFITEM &)GetNextDiffPosition(diffpos);
}
* @param diffpos position of current item, updated to next sibling item position
* @return Diff Item in current position
*/
-const DIFFITEM &DiffItemList::GetNextSiblingDiffPosition(UIntPtr & diffpos) const
+const DIFFITEM &DiffItemList::GetNextSiblingDiffPosition(uintptr_t & diffpos) const
{
DIFFITEM *p = (DIFFITEM *)diffpos;
if (p->parent)
- diffpos = (UIntPtr)p->parent->children.IsSibling(p->Flink);
+ diffpos = (uintptr_t)p->parent->children.IsSibling(p->Flink);
else
- diffpos = (UIntPtr)m_root.IsSibling(p->Flink);
+ diffpos = (uintptr_t)m_root.IsSibling(p->Flink);
return *p;
}
* @param diffpos position of current item, updated to next sibling item position
* @return Diff Item (by reference) in current position
*/
-DIFFITEM &DiffItemList::GetNextSiblingDiffRefPosition(UIntPtr & diffpos)
+DIFFITEM &DiffItemList::GetNextSiblingDiffRefPosition(uintptr_t & 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 diffpos, unsigned diffcode, unsigned mask)
+void DiffItemList::SetDiffStatusCode(uintptr_t diffpos, unsigned diffcode, unsigned mask)
{
assert(diffpos);
DIFFITEM & di = GetDiffRefAt(diffpos);
/**
* @brief Update difference counts.
*/
-void DiffItemList::SetDiffCounts(UIntPtr diffpos, unsigned diffs, unsigned ignored)
+void DiffItemList::SetDiffCounts(uintptr_t diffpos, unsigned diffs, unsigned ignored)
{
assert(diffpos);
DIFFITEM & di = GetDiffRefAt(diffpos);
* @param [in] diffpos Position of item.
* @return Custom flags from item.
*/
-unsigned DiffItemList::GetCustomFlags1(UIntPtr diffpos) const
+unsigned DiffItemList::GetCustomFlags1(uintptr_t diffpos) const
{
assert(diffpos);
const DIFFITEM & di = GetDiffAt(diffpos);
* @param [in] diffpos Position of item.
* @param [in] flag Value of flag to set.
*/
-void DiffItemList::SetCustomFlags1(UIntPtr diffpos, unsigned flag)
+void DiffItemList::SetCustomFlags1(uintptr_t diffpos, unsigned flag)
{
assert(diffpos);
DIFFITEM & di = GetDiffRefAt(diffpos);
#define _DIFF_ITEM_LIST_H_
#include "DiffItem.h"
-#define POCO_NO_UNWINDOWS 1
-#include <Poco/Types.h>
+#include <cstdint>
/**
* @brief List of DIFFITEMs in folder compare.
~DiffItemList();
// add & remove differences
DIFFITEM *AddDiff(DIFFITEM *parent);
- void RemoveDiff(Poco::UIntPtr diffpos);
+ void RemoveDiff(uintptr_t diffpos);
void RemoveAll();
// to iterate over all differences on list
- Poco::UIntPtr GetFirstDiffPosition() const;
- Poco::UIntPtr GetFirstChildDiffPosition(Poco::UIntPtr parentdiffpos) const;
- const DIFFITEM & GetNextDiffPosition(Poco::UIntPtr & diffpos) const;
- DIFFITEM & GetNextDiffRefPosition(Poco::UIntPtr & diffpos);
- const DIFFITEM & GetNextSiblingDiffPosition(Poco::UIntPtr & diffpos) const;
- DIFFITEM &GetNextSiblingDiffRefPosition(Poco::UIntPtr & diffpos);
- const DIFFITEM & GetDiffAt(Poco::UIntPtr diffpos) const;
- DIFFITEM & GetDiffRefAt(Poco::UIntPtr diffpos);
+ 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);
- void SetDiffStatusCode(Poco::UIntPtr diffpos, unsigned diffcode, unsigned mask);
- void SetDiffCounts(Poco::UIntPtr diffpos, unsigned diffs, unsigned ignored);
- unsigned GetCustomFlags1(Poco::UIntPtr diffpos) const;
- void SetCustomFlags1(Poco::UIntPtr diffpos, unsigned flag);
+ 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);
protected:
ListEntry m_root; /**< Root of list of diffitems */
* @brief Get copy of Diff Item at given position in difflist.
* @param diffpos position of item to return
*/
-inline const DIFFITEM & DiffItemList::GetDiffAt(Poco::UIntPtr diffpos) const
+inline const DIFFITEM & DiffItemList::GetDiffAt(uintptr_t diffpos) const
{
return *reinterpret_cast<DIFFITEM *>(diffpos);
}
* @brief Get Diff Item (by reference) at given position in difflist.
* @param diffpos position of item to return
*/
-inline DIFFITEM & DiffItemList::GetDiffRefAt(Poco::UIntPtr diffpos)
+inline DIFFITEM & DiffItemList::GetDiffRefAt(uintptr_t diffpos)
{
return *reinterpret_cast<DIFFITEM *>(diffpos);
}
#include "StdAfx.h"
#include "DiffTextBuffer.h"
+#include <cstdint>
#include <Poco/Exception.h>
#include "UniFile.h"
#include "files.h"
#endif
static bool IsTextFileStylePure(const UniMemFile::txtstats & stats);
-static CString GetLineByteTimeReport(UINT lines, __int64 bytes,
+static CString GetLineByteTimeReport(UINT lines, int64_t bytes,
const COleDateTime & start);
static void EscapeControlChars(String &s);
static CRLFSTYLE GetTextFileStyle(const UniMemFile::txtstats & stats);
* @param [in] start Time used.
* @return Formatted string.
*/
-static CString GetLineByteTimeReport(UINT lines, __int64 bytes,
+static CString GetLineByteTimeReport(UINT lines, int64_t bytes,
const COleDateTime & start)
{
String sLines = locality::NumToLocaleStr((int)lines);
// (at 100, 500, 1000, 5000, etc)
if (lineno == next_line_report)
{
- __int64 dwBytesRead = pufile->GetPosition();
+ int64_t dwBytesRead = pufile->GetPosition();
COleDateTimeSpan duration = COleDateTime::GetCurrentTime() - start;
if (duration.GetTotalMinutes() > 0)
{
COleDateTimeSpan duration = end - start;
if (duration.GetTotalMinutes() > 0)
{
- __int64 dwBytesRead = pufile->GetPosition();
+ int64_t dwBytesRead = pufile->GetPosition();
CString strace = GetLineByteTimeReport(lineno, dwBytesRead, start);
TRACE(_T("%s\n"), (LPCTSTR)strace);
}
#define _DIFFTHREAD_H
#include <memory>
+#define POCO_NO_UNWINDOWS 1
#include <Poco/Thread.h>
#include <Poco/BasicEvent.h>
#include <Poco/Delegate.h>
#endif
using Poco::StringTokenizer;
-using Poco::UIntPtr;
int CDirDoc::m_nDirsTemp = 2;
* @param [in] bLeft If TRUE left-side item is updated.
* @param [in] bRight If TRUE right-side item is updated.
*/
-void CDirDoc::UpdateStatusFromDisk(UIntPtr diffPos, bool bLeft, bool bRight)
+void CDirDoc::UpdateStatusFromDisk(uintptr_t diffPos, bool bLeft, bool bRight)
{
m_pCtxt->UpdateStatusFromDisk(diffPos, bLeft, bRight);
}
* calls slow DirView functions to get item position and to update GUI.
* Use UpdateStatusFromDisk() function instead.
*/
-void CDirDoc::ReloadItemStatus(UIntPtr diffPos, bool bLeft, bool bRight)
+void CDirDoc::ReloadItemStatus(uintptr_t diffPos, bool bLeft, bool bRight)
{
// in case just copied (into existence) or modified
UpdateStatusFromDisk(diffPos, bLeft, bRight);
* @return POSITION to item, NULL if not found.
* @note Filenames must be same, if they differ NULL is returned.
*/
-UIntPtr CDirDoc::FindItemFromPaths(const String& pathLeft, const String& pathRight)
+uintptr_t CDirDoc::FindItemFromPaths(const String& pathLeft, const String& pathRight)
{
String file1 = paths_FindFileName(pathLeft);
String file2 = paths_FindFileName(pathRight);
if (String::size_type length = path2.length())
path2.resize(length - 1); // remove trailing backslash
- UIntPtr pos = m_pCtxt->GetFirstDiffPosition();
- while (UIntPtr currentPos = pos) // Save our current pos before getting next
+ uintptr_t pos = m_pCtxt->GetFirstDiffPosition();
+ while (uintptr_t currentPos = pos) // Save our current pos before getting next
{
const DIFFITEM &di = m_pCtxt->GetNextDiffPosition(pos);
if (di.diffFileInfo[0].path == path1 &&
void CDirDoc::UpdateChangedItem(PathContext &paths,
UINT nDiffs, UINT nTrivialDiffs, BOOL bIdentical)
{
- UIntPtr pos = FindItemFromPaths(paths.GetLeft(), paths.GetRight());
+ uintptr_t pos = FindItemFromPaths(paths.GetLeft(), paths.GetRight());
// If we failed files could have been swapped so lets try again
if (!pos)
pos = FindItemFromPaths(paths.GetRight(), paths.GetLeft());
void CDirDoc::SetDiffStatus(UINT diffcode, UINT mask, int idx)
{
// Get position of item in DiffContext
- UIntPtr diffpos = m_pDirView->GetItemKey(idx);
+ uintptr_t diffpos = m_pDirView->GetItemKey(idx);
// TODO: Why is the update broken into these pieces ?
// Someone could figure out these pieces and probably simplify this.
void CDirDoc::SetDiffCounts(UINT diffs, UINT ignored, int idx)
{
// Get position of item in DiffContext
- UIntPtr diffpos = m_pDirView->GetItemKey(idx);
+ uintptr_t diffpos = m_pDirView->GetItemKey(idx);
// Update diff counts
m_pCtxt->SetDiffCounts(diffpos, diffs, ignored);
* @param [in] act Action that was done.
* @param [in] pos List position for DIFFITEM affected.
*/
-void CDirDoc::UpdateDiffAfterOperation(const FileActionItem & act, UIntPtr pos)
+void CDirDoc::UpdateDiffAfterOperation(const FileActionItem & act, uintptr_t pos)
{
ASSERT(pos != NULL);
const DIFFITEM &di = GetDiffByKey(pos);
* @param [in] flag Flag value to set.
* @param [in] mask Mask for possible flag values.
*/
-void CDirDoc::SetItemViewFlag(UIntPtr key, UINT flag, UINT mask)
+void CDirDoc::SetItemViewFlag(uintptr_t key, UINT flag, UINT mask)
{
UINT curFlags = m_pCtxt->GetCustomFlags1(key);
curFlags &= ~mask; // Zero bits masked
*/
void CDirDoc::SetItemViewFlag(UINT flag, UINT mask)
{
- UIntPtr pos = m_pCtxt->GetFirstDiffPosition();
+ uintptr_t pos = m_pCtxt->GetFirstDiffPosition();
while (pos != NULL)
{
#pragma once
#include <memory>
+#include <cstdint>
#include "DiffThread.h"
#include "PluginManager.h"
void CompareReady();
void UpdateChangedItem(PathContext & paths,
UINT nDiffs, UINT nTrivialDiffs, BOOL bIdentical);
- Poco::UIntPtr FindItemFromPaths(const String& pathLeft, const String& pathRight);
+ uintptr_t FindItemFromPaths(const String& pathLeft, const String& pathRight);
void SetDiffSide(UINT diffcode, int idx);
void SetDiffCompare(UINT diffcode, int idx);
void UpdateResources();
void InitStatusStrings();
- void UpdateStatusFromDisk(Poco::UIntPtr diffPos, bool bLeft, bool bRight);
- void ReloadItemStatus(Poco::UIntPtr diffPos, bool bLeft, bool bRight);
+ void UpdateStatusFromDisk(uintptr_t diffPos, bool bLeft, bool bRight);
+ void ReloadItemStatus(uintptr_t diffPos, bool bLeft, bool bRight);
void Redisplay();
virtual ~CDirDoc();
void SetDirView( CDirView *newView ); // TODO Perry
CDiffThread m_diffThread;
void SetDiffStatus(UINT diffcode, UINT mask, int idx);
void SetDiffCounts(UINT diffs, UINT ignored, int idx);
- void UpdateDiffAfterOperation(const FileActionItem & act, Poco::UIntPtr pos);
+ void UpdateDiffAfterOperation(const FileActionItem & act, uintptr_t pos);
void UpdateHeaderPath(BOOL bLeft);
void AbortCurrentScan();
bool IsCurrentScanAbortable() const;
bool HasDiffs() const { return m_pCtxt != NULL; }
const CDiffContext & GetDiffContext() const { return *m_pCtxt; }
- const DIFFITEM & GetDiffByKey(Poco::UIntPtr key) const { return m_pCtxt->GetDiffAt(key); }
- DIFFITEM & GetDiffRefByKey(Poco::UIntPtr key) { return m_pCtxt->GetDiffRefAt(key); }
+ const DIFFITEM & GetDiffByKey(uintptr_t key) const { return m_pCtxt->GetDiffAt(key); }
+ DIFFITEM & GetDiffRefByKey(uintptr_t key) { return m_pCtxt->GetDiffRefAt(key); }
String GetLeftBasePath() const { return m_pCtxt->GetNormalizedLeft(); }
String GetRightBasePath() const { return m_pCtxt->GetNormalizedRight(); }
String GetBasePath(int nIndex) const { return m_pCtxt->GetNormalizedPath(nIndex); }
- void RemoveDiffByKey(Poco::UIntPtr key) { m_pCtxt->RemoveDiff(key); }
+ void RemoveDiffByKey(uintptr_t key) { m_pCtxt->RemoveDiff(key); }
void SetMarkedRescan() {m_bMarkedRescan = TRUE; }
struct AllowUpwardDirectory
{
};
};
AllowUpwardDirectory::ReturnCode AllowUpwardDirectory(PathContext &paths);
- void SetItemViewFlag(Poco::UIntPtr key, UINT flag, UINT mask);
+ void SetItemViewFlag(uintptr_t key, UINT flag, UINT mask);
void SetItemViewFlag(UINT flag, UINT mask);
const CompareStats * GetCompareStats() const { return m_pCompareStats.get(); };
bool IsArchiveFolders() const;
#define _DIR_ITEM_H_INCLUDED
#define POCO_NO_UNWINDOWS 1
-#include <Poco/Types.h>
#include <Poco/File.h>
#include <Poco/Timestamp.h>
#include <boost/flyweight.hpp>
#include "DirScan.h"
#include <cassert>
#include <memory>
+#include <cstdint>
#define POCO_NO_UNWINDOWS 1
#include <Poco/Semaphore.h>
#include <Poco/Notification.h>
#include "Plugins.h"
#include "MergeApp.h"
-using Poco::UIntPtr;
using Poco::NotificationQueue;
using Poco::Notification;
using Poco::AutoPtr;
static DIFFITEM *AddToList(const String& sLeftDir, const String& sMiddleDir, const String& sRightDir, const DirItem * lent, const DirItem * ment, const DirItem * rent,
unsigned code, DiffFuncStruct *myStruct, DIFFITEM *parent);
static void UpdateDiffItem(DIFFITEM & di, bool & bExists, CDiffContext *pCtxt);
-static int CompareItems(NotificationQueue& queue, DiffFuncStruct *myStruct, UIntPtr parentdiffpos);
+static int CompareItems(NotificationQueue& queue, DiffFuncStruct *myStruct, uintptr_t parentdiffpos);
class WorkNotification: public Poco::Notification
{
* @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 parentdiffpos)
+int DirScan_CompareItems(DiffFuncStruct *myStruct, uintptr_t parentdiffpos)
{
ThreadPool threadPool;
std::vector<DiffWorkerPtr> workers;
return res;
}
-static int CompareItems(NotificationQueue& queue, DiffFuncStruct *myStruct, UIntPtr parentdiffpos)
+static int CompareItems(NotificationQueue& queue, DiffFuncStruct *myStruct, uintptr_t parentdiffpos)
{
NotificationQueue queueResult;
Stopwatch stopwatch;
if (!parentdiffpos)
myStruct->pSemaphore->wait();
stopwatch.start();
- UIntPtr pos = pCtxt->GetFirstChildDiffPosition(parentdiffpos);
+ uintptr_t pos = pCtxt->GetFirstChildDiffPosition(parentdiffpos);
while (pos)
{
if (pCtxt->ShouldAbort())
stopwatch.restart();
}
myStruct->pSemaphore->wait();
- UIntPtr curpos = pos;
+ uintptr_t curpos = pos;
DIFFITEM &di = pCtxt->GetNextSiblingDiffRefPosition(pos);
bool existsalldirs = ((pCtxt->GetCompareDirs() == 2 && di.diffcode.isSideBoth()) || (pCtxt->GetCompareDirs() == 3 && di.diffcode.isSideAll()));
if (di.diffcode.isDirectory() && pCtxt->m_bRecursive)
* @param parentdiffpos [in] Position of parent diff item
* @return >= 0 number of diff items, -1 if compare was aborted
*/
-int DirScan_CompareRequestedItems(DiffFuncStruct *myStruct, UIntPtr parentdiffpos)
+int DirScan_CompareRequestedItems(DiffFuncStruct *myStruct, uintptr_t parentdiffpos)
{
CDiffContext *pCtxt = myStruct->context;
int res = 0;
- UIntPtr pos = pCtxt->GetFirstChildDiffPosition(parentdiffpos);
+ uintptr_t pos = pCtxt->GetFirstChildDiffPosition(parentdiffpos);
while (pos != NULL)
{
break;
}
- UIntPtr curpos = pos;
+ uintptr_t curpos = pos;
DIFFITEM &di = pCtxt->GetNextSiblingDiffRefPosition(pos);
bool existsalldirs = ((pCtxt->GetCompareDirs() == 2 && di.diffcode.isSideBoth()) || (pCtxt->GetCompareDirs() == 3 && di.diffcode.isSideAll()));
if (di.diffcode.isDirectory() && pCtxt->m_bRecursive)
#define DirScan_h_included
#include "UnicodeString.h"
-#define POCO_NO_UNWINDOWS 1
-#include <Poco/Types.h>
+#include <cstdint>
class CDiffContext;
class DiffItemList;
int DirScan_GetItems(const PathContext &paths, const String subdir[], DiffFuncStruct *myStruct,
bool casesensitive, int depth, DIFFITEM *parent, bool bUniques);
-int DirScan_CompareItems(DiffFuncStruct *, Poco::UIntPtr parentdiffpos);
-int DirScan_CompareRequestedItems(DiffFuncStruct *, Poco::UIntPtr parentdiffpos);
+int DirScan_CompareItems(DiffFuncStruct *, uintptr_t parentdiffpos);
+int DirScan_CompareRequestedItems(DiffFuncStruct *, uintptr_t parentdiffpos);
#endif // DirScan_h_included
#include "DirTravel.h"
#include <algorithm>
+#include <cstdint>
#include <Poco/DirectoryIterator.h>
#include <Poco/Timestamp.h>
#include <windows.h>
using Poco::DirectoryIterator;
using Poco::Timestamp;
-using Poco::Int64;
static void LoadFiles(const String& sDir, DirItemArray * dirs, DirItemArray * files);
static void Sort(DirItemArray * dirs, bool casesensitive);
ent.size = -1; // No size for directories
else
{
- ent.size = ((Int64)ff.nFileSizeHigh << 32) + ff.nFileSizeLow;
+ ent.size = ((int64_t)ff.nFileSizeHigh << 32) + ff.nFileSizeLow;
}
ent.path = dir;
#endif
using std::swap;
-using Poco::UIntPtr;
/**
* @brief Location for folder compare specific help to open.
* @param [in,out] index Index of the item to be inserted.
* @param [in,out] alldiffs Number of different items
*/
-void CDirView::RedisplayChildren(UIntPtr diffpos, int level, UINT &index, int &alldiffs)
+void CDirView::RedisplayChildren(uintptr_t diffpos, int level, UINT &index, int &alldiffs)
{
CDirDoc *pDoc = GetDocument();
const CDiffContext &ctxt = pDoc->GetDiffContext();
while (diffpos)
{
- UIntPtr curdiffpos = diffpos;
+ uintptr_t curdiffpos = diffpos;
const DIFFITEM &di = ctxt.GetNextSiblingDiffPosition(diffpos);
if (di.diffcode.isResultDiff() || (!di.diffcode.existAll(pDoc->m_nDirs) && !di.diffcode.isResultFiltered()))
}
int alldiffs = 0;
- UIntPtr diffpos = ctxt.GetFirstDiffPosition();
+ uintptr_t diffpos = ctxt.GetFirstDiffPosition();
RedisplayChildren(diffpos, 0, cnt, alldiffs);
if (pDoc->m_diffThread.GetThreadState() == CDiffThread::THREAD_COMPLETED)
GetParentFrame()->SetLastCompareResult(alldiffs);
CDiffContext &ctxt = const_cast<CDiffContext &>(pDoc->GetDiffContext());
if (bRecursive)
{
- UIntPtr diffpos = ctxt.GetFirstChildDiffPosition(GetItemKey(sel));
+ uintptr_t diffpos = ctxt.GetFirstChildDiffPosition(GetItemKey(sel));
while (diffpos)
{
DIFFITEM &di = ctxt.GetNextDiffRefPosition(diffpos);
}
}
- UIntPtr diffpos = ctxt.GetFirstChildDiffPosition(GetItemKey(sel));
+ uintptr_t 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 pos1, UIntPtr pos2, UIntPtr pos3)
+void CDirView::OpenSpecialItems(uintptr_t pos1, uintptr_t pos2, uintptr_t pos3)
{
if (!pos2 && !pos3)
{
* @param [in,out] isDir Is item folder?
* return false if there was error or item was completely processed.
*/
-bool CDirView::OpenOneItem(UIntPtr pos1, DIFFITEM **di1, DIFFITEM **di2, DIFFITEM **di3,
+bool CDirView::OpenOneItem(uintptr_t pos1, DIFFITEM **di1, DIFFITEM **di2, DIFFITEM **di3,
PathContext & paths, int & sel1, bool & isdir)
{
CDirDoc * pDoc = GetDocument();
* @param [in,out] isDir Is item folder?
* return false if there was error or item was completely processed.
*/
-bool CDirView::OpenTwoItems(SELECTIONTYPE selectionType, UIntPtr pos1, UIntPtr pos2, DIFFITEM **di1, DIFFITEM **di2,
+bool CDirView::OpenTwoItems(SELECTIONTYPE selectionType, uintptr_t pos1, uintptr_t pos2, DIFFITEM **di1, DIFFITEM **di2,
PathContext & paths, int & sel1, int & sel2, bool & isDir)
{
String pathLeft, pathRight;
* @param [in,out] isDir Is item folder?
* return false if there was error or item was completely processed.
*/
-bool CDirView::OpenThreeItems(UIntPtr pos1, UIntPtr pos2, UIntPtr pos3, DIFFITEM **di1, DIFFITEM **di2, DIFFITEM **di3,
+bool CDirView::OpenThreeItems(uintptr_t pos1, uintptr_t pos2, uintptr_t pos3, DIFFITEM **di1, DIFFITEM **di2, DIFFITEM **di3,
PathContext & paths, int & sel1, int & sel2, int & sel3, bool & isDir)
{
String pathLeft, pathMiddle, pathRight;
CDirDoc * pDoc = GetDocument();
// First, figure out what was selected (store into pos1 & pos2)
- UIntPtr pos1 = NULL, pos2 = NULL, pos3 = NULL;
+ uintptr_t pos1 = NULL, pos2 = NULL, pos3 = NULL;
int sel1 = -1, sel2 = -1, sel3 = -1;
if (!GetSelectedItems(&sel1, &sel2, &sel3))
{
CDirDoc * pDoc = GetDocument();
// First, figure out what was selected (store into pos1 & pos2)
- UIntPtr pos1 = NULL, pos2 = NULL;
+ uintptr_t pos1 = NULL, pos2 = NULL;
int sel1 = -1, sel2 = -1, sel3 = -1;
if (!GetSelectedItems(&sel1, &sel2, &sel3))
{
* @param [in] idx Item's index to list in UI.
* @return Key for item in given index.
*/
-UIntPtr CDirView::GetItemKey(int idx) const
+uintptr_t CDirView::GetItemKey(int idx) const
{
- return (UIntPtr) m_pList->GetItemData(idx);
+ return (uintptr_t) m_pList->GetItemData(idx);
}
// SetItemKey & GetItemKey encapsulate how the display list items
*/
DIFFITEM & CDirView::GetDiffItemRef(int sel)
{
- UIntPtr diffpos = GetItemKey(sel);
+ uintptr_t diffpos = GetItemKey(sel);
// If it is special item, return empty DIFFITEM
if (diffpos == SPECIAL_ITEM_POS)
* @brief Given key, get index of item which has it stored.
* This function searches from list in UI.
*/
-int CDirView::GetItemIndex(UIntPtr key)
+int CDirView::GetItemIndex(uintptr_t key)
{
LVFINDINFO findInfo;
const DIFFITEM& di = GetDiffItem(sel);
if (di.parent != NULL)
{
- int i = GetItemIndex((UIntPtr)di.parent);
+ int i = GetItemIndex((uintptr_t)di.parent);
if (i >= 0)
MoveFocus(sel, i, GetSelectedCount());
}
for (int i = 0; i < selCount; i++)
{
// Don't select special items (SPECIAL_ITEM_POS)
- UIntPtr diffpos = GetItemKey(i);
+ uintptr_t diffpos = GetItemKey(i);
if (diffpos != SPECIAL_ITEM_POS)
m_pList->SetItemState(i, LVIS_SELECTED, LVIS_SELECTED);
}
m_pList->SetRedraw(FALSE); // Turn off updating (better performance)
while ((sel = m_pList->GetNextItem(sel, LVNI_SELECTED)) != -1)
{
- UIntPtr pos = GetItemKey(sel);
- if (pos == (UIntPtr) SPECIAL_ITEM_POS)
+ uintptr_t pos = GetItemKey(sel);
+ if (pos == (uintptr_t) SPECIAL_ITEM_POS)
continue;
pDoc->SetItemViewFlag(pos, ViewCustomFlags::HIDDEN, ViewCustomFlags::VISIBILITY);
const DIFFITEM &di = GetDiffItem(sel);
else
{
// Don't show number to special items
- UIntPtr pos = GetItemKey(focusItem);
+ uintptr_t pos = GetItemKey(focusItem);
if (pos != SPECIAL_ITEM_POS)
{
// If compare is non-recursive reduce special items count
{
CDirDoc *pDoc = GetDocument();
CDiffContext &ctxt = (CDiffContext &)pDoc->GetDiffContext();
- UIntPtr diffpos = ctxt.GetFirstDiffPosition();
+ uintptr_t diffpos = ctxt.GetFirstDiffPosition();
while (diffpos)
{
DIFFITEM &di = ctxt.GetNextDiffRefPosition(diffpos);
{
CDirDoc *pDoc = GetDocument();
CDiffContext &ctxt = (CDiffContext &)pDoc->GetDiffContext();
- UIntPtr diffpos = ctxt.GetFirstDiffPosition();
+ uintptr_t diffpos = ctxt.GetFirstDiffPosition();
while (diffpos)
{
DIFFITEM &di = ctxt.GetNextDiffRefPosition(diffpos);
{
DirViewTreeState *pTreeState = new DirViewTreeState();
CDiffContext &ctxt = const_cast<CDiffContext &>(GetDocument()->GetDiffContext());
- UIntPtr diffpos = ctxt.GetFirstDiffPosition();
+ uintptr_t diffpos = ctxt.GetFirstDiffPosition();
while (diffpos)
{
DIFFITEM &di = ctxt.GetNextDiffRefPosition(diffpos);
void CDirView::RestoreTreeState(DirViewTreeState *pTreeState)
{
CDiffContext &ctxt = const_cast<CDiffContext &>(GetDocument()->GetDiffContext());
- UIntPtr diffpos = ctxt.GetFirstDiffPosition();
+ uintptr_t diffpos = ctxt.GetFirstDiffPosition();
while (diffpos)
{
DIFFITEM &di = ctxt.GetNextDiffRefPosition(diffpos);
int nRows = m_pList->GetItemCount();
for (int currRow = nRows - 1; currRow >= 0; currRow--)
{
- UIntPtr pos = GetItemKey(currRow);
+ uintptr_t pos = GetItemKey(currRow);
if (pos == SPECIAL_ITEM_POS)
continue;
#include <afxcview.h>
#include <map>
#include <memory>
-#define POCO_NO_UNWINDOWS 1
-#include <Poco/Types.h>
#include "OptionsDiffColors.h"
#include "SortHeaderCtrl.h"
#include "UnicodeString.h"
/**
* @brief Position value for special items (..) in directory compare view.
*/
-const Poco::UIntPtr SPECIAL_ITEM_POS = (Poco::UIntPtr) - 1L;
+const uintptr_t SPECIAL_ITEM_POS = (uintptr_t) - 1L;
/** Default column width in directory compare */
const UINT DefColumnWidth = 150;
void StartCompare(CompareStats *pCompareStats);
void Redisplay();
- void RedisplayChildren(Poco::UIntPtr diffpos, int level, UINT &index, int &alldiffs);
+ void RedisplayChildren(uintptr_t diffpos, int level, UINT &index, int &alldiffs);
void UpdateResources();
void LoadColumnHeaderItems();
- Poco::UIntPtr GetItemKey(int idx) const;
- int GetItemIndex(Poco::UIntPtr key);
+ uintptr_t GetItemKey(int idx) const;
+ int GetItemIndex(uintptr_t key);
// for populating list
void DeleteAllDisplayItems();
void SetColumnWidths();
private:
void InitiateSort();
void NameColumn(int id, int subitem);
- int AddNewItem(int i, Poco::UIntPtr diffpos, int iImage, int iIndent);
+ int AddNewItem(int i, uintptr_t diffpos, int iImage, int iIndent);
bool IsDefaultSortAscending(int col) const;
int ColPhysToLog(int i) const { return m_invcolorder[i]; }
int ColLogToPhys(int i) const { return m_colorder[i]; } /**< -1 if not displayed */
int AddSpecialItems();
void GetCurrentColRegKeys(std::vector<String>& colKeys);
void WarnContentsChanged(const String & failedPath);
- void OpenSpecialItems(Poco::UIntPtr pos1, Poco::UIntPtr pos2, Poco::UIntPtr pos3);
- bool OpenOneItem(Poco::UIntPtr pos1, DIFFITEM **di1, DIFFITEM **di2, DIFFITEM **di3,
+ void OpenSpecialItems(uintptr_t pos1, uintptr_t pos2, uintptr_t pos3);
+ bool OpenOneItem(uintptr_t pos1, DIFFITEM **di1, DIFFITEM **di2, DIFFITEM **di3,
PathContext &paths, int & sel1, bool & isDir);
- bool OpenTwoItems(SELECTIONTYPE selectionType, Poco::UIntPtr pos1, Poco::UIntPtr pos2, DIFFITEM **di1, DIFFITEM **di2,
+ bool OpenTwoItems(SELECTIONTYPE selectionType, uintptr_t pos1, uintptr_t pos2, DIFFITEM **di1, DIFFITEM **di2,
PathContext &paths, int & sel1, int & sel2, bool & isDir);
- bool OpenThreeItems(Poco::UIntPtr pos1, Poco::UIntPtr pos2, Poco::UIntPtr pos3, DIFFITEM **di1, DIFFITEM **di2, DIFFITEM **di3,
+ bool OpenThreeItems(uintptr_t pos1, uintptr_t pos2, uintptr_t pos3, DIFFITEM **di1, DIFFITEM **di2, DIFFITEM **di3,
PathContext &paths, int & sel1, int & sel2, int & sel3, bool & isDir);
bool CreateFoldersPair(DIFFITEM & di, bool side1, String &newFolder);
static char THIS_FILE[] = __FILE__;
#endif
-using Poco::UIntPtr;
-
/////////////////////////////////////////////////////////////////////////////
if (lParam2 == -1)
return 1;
- UIntPtr diffposl = (UIntPtr)lParam1;
- UIntPtr diffposr = (UIntPtr)lParam2;
+ uintptr_t diffposl = (uintptr_t)lParam1;
+ uintptr_t diffposr = (uintptr_t)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 diffpos, int iImage, int iIndent)
+int CDirView::AddNewItem(int i, uintptr_t 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 = ColPhysToLog(pParam->item.iSubItem);
- UIntPtr key = GetItemKey(nIdx);
+ uintptr_t key = GetItemKey(nIdx);
if (key == SPECIAL_ITEM_POS)
{
if (IsColName(i))
#include "stdafx.h"
#include "DirViewColItems.h"
#include <shlwapi.h>
+#include <cstdint>
#include <Poco/Timestamp.h>
#include "UnicodeString.h"
#include "Merge.h"
static const UINT KILO = 1024;
static const UINT MEGA = 1024 * KILO;
static const UINT GIGA = 1024 * MEGA;
-static const __int64 TERA = 1024 * (__int64) GIGA;
+static const int64_t TERA = 1024 * (int64_t) GIGA;
/**
* @}
*/
/**
- * @brief Function to compare two __int64s for a sort
+ * @brief Function to compare two int64_ts for a sort
*/
-static int cmp64(__int64 i1, __int64 i2)
+static int cmp64(int64_t i1, int64_t i2)
{
if (i1==i2) return 0;
return i1>i2 ? 1 : -1;
}
/**
- * @brief Convert __int64 to int sign
+ * @brief Convert int64_t to int sign
*/
-static int sign64(__int64 val)
+static int sign64(int64_t val)
{
if (val>0) return 1;
if (val<0) return -1;
* @note Localized suffix strings are read from resource.
* @todo Can't handle > terabyte filesizes.
*/
-static String MakeShortSize(__int64 size)
+static String MakeShortSize(int64_t size)
{
-#pragma warning(disable:4244) // warning C4244: '=' : conversion from '__int64' to 'double', possible loss of data
+#pragma warning(disable:4244) // warning C4244: '=' : conversion from 'int64_t' to 'double', possible loss of data
double fsize = size;
-#pragma warning(default:4244) // warning C4244: '=' : conversion from '__int64' to 'double', possible loss of data
+#pragma warning(default:4244) // warning C4244: '=' : conversion from 'int64_t' to 'double', possible loss of data
double number = 0;
int ndigits = 0;
String suffix;
ndigits = 1;
}
}
- else if (size < (__int64)TERA)
+ else if (size < (int64_t)TERA)
{
- number = fsize / ((__int64)GIGA);
+ number = fsize / ((int64_t)GIGA);
suffix = theApp.LoadString(IDS_SUFFIX_GIGA);
- if (size < (__int64)GIGA * 10)
+ if (size < (int64_t)GIGA * 10)
{
ndigits = 2;
}
- else if (size < (__int64)GIGA * 100)
+ else if (size < (int64_t)GIGA * 100)
{
ndigits = 1;
}
*/
static String ColTimeGet(const CDiffContext *, const void *p)
{
- const __int64 r = *static_cast<const __int64*>(p) / Timestamp::resolution();
+ const int64_t r = *static_cast<const int64_t*>(p) / Timestamp::resolution();
if (r)
return locality::TimeString(&r);
else
*/
static String ColSizeGet(const CDiffContext *, const void *p)
{
- const __int64 &r = *static_cast<const __int64*>(p);
+ const int64_t &r = *static_cast<const int64_t*>(p);
String s;
if (r != -1)
{
*/
static String ColSizeShortGet(const CDiffContext *, const void *p)
{
- const __int64 &r = *static_cast<const __int64*>(p);
+ const int64_t &r = *static_cast<const int64_t*>(p);
String s;
if (r != -1)
{
*/
static int ColTimeSort(const CDiffContext *, const void *p, const void *q)
{
- const __int64 &r = *static_cast<const __int64*>(p);
- const __int64 &s = *static_cast<const __int64*>(q);
+ const int64_t &r = *static_cast<const int64_t*>(p);
+ const int64_t &s = *static_cast<const int64_t*>(q);
return cmp64(r, s);
}
*/
static int ColSizeSort(const CDiffContext *, const void *p, const void *q)
{
- const __int64 &r = *static_cast<const __int64*>(p);
- const __int64 &s = *static_cast<const __int64*>(q);
+ const int64_t &r = *static_cast<const int64_t*>(p);
+ const int64_t &s = *static_cast<const int64_t*>(q);
return cmp64(r, s);
}
#ifndef FileTextStats_h_included
#define FileTextStats_h_included
-#define POCO_NO_UNWINDOWS 1
-#include <Poco/Types.h>
-
/**
* @brief Structure containing statistics about compared file.
* This structure contains EOL-byte and zero-byte statistics from compared
#include "WaitStatusCursor.h"
#include "../Externals/winimerge/src/WinIMergeLib.h"
#include <cmath>
+#include <cstdint>
#include <Shlwapi.h>
#ifdef _DEBUG
int tolerance = 0;
if (GetOptionsMgr()->GetBool(OPT_IGNORE_SMALL_FILETIME))
tolerance = SmallTimeDiff; // From MainFrm.h
- Poco::Int64 timeDiff = dfi.mtime - m_fileInfo[pane].mtime;
+ int64_t timeDiff = dfi.mtime - m_fileInfo[pane].mtime;
if (timeDiff < 0) timeDiff = -timeDiff;
if ((timeDiff > tolerance * Poco::Timestamp::resolution()) || (dfi.size != m_fileInfo[pane].size))
return true;
#include "StdAfx.h"
#include "MergeDoc.h"
+#include <cstdint>
#include <shlwapi.h> // PathCompactPathEx()
#include <io.h>
#include <Poco/Timestamp.h>
dfi.Update(szPath);
- Poco::Int64 timeDiff = dfi.mtime - fileInfo->mtime;
+ int64_t timeDiff = dfi.mtime - fileInfo->mtime;
if (timeDiff < 0) timeDiff = -timeDiff;
if ((timeDiff > tolerance * Poco::Timestamp::resolution()) || (dfi.size != fileInfo->size))
{
// $Id: locality.cpp 5918 2008-09-07 16:05:46Z sdottaka $
#include "locality.h"
+#include <cstdint>
#include <windows.h>
#include <Poco/Format.h>
#include <Poco/Debugger.h>
using Poco::format;
using Poco::Debugger;
using Poco::Timestamp;
-using Poco::Int64;
namespace locality {
* @param [in] n Number to convert.
* @return Converted string.
*/
-String NumToLocaleStr(Int64 n)
+String NumToLocaleStr(int64_t n)
{
TCHAR numbuff[34];
_i64tot(n, numbuff, 10);
* @param [in] tim Time in seconds since 1.1.1970.
* @return Time as a string, proper to show in the GUI.
*/
-String TimeString(const Int64 * tim)
+String TimeString(const int64_t * tim)
{
if (!tim) return _T("---");
#define locality_h_included
#include "UnicodeString.h"
-#include <Poco/Types.h>
+#include <cstdint>
namespace locality {
String NumToLocaleStr(int n);
-String NumToLocaleStr(Poco::Int64 n);
+String NumToLocaleStr(int64_t n);
String GetLocaleStr(const TCHAR *str, int decimalDigits = 0);
-String TimeString(const Poco::Int64 * tim);
+String TimeString(const int64_t * tim);
};
#include "markdown.h"
#include <cstring>
+#include <cstdint>
#include <Poco/ByteOrder.h>
#include <Poco/NumberParser.h>
#include <Poco/SharedMemory.h>
using Poco::NumberParser;
using Poco::SharedMemory;
using Poco::File;
-using Poco::UInt16;
#ifndef _WIN32
# include <strings.h>
if (pCopy)
{
for (int i = 0; i < cbImage / 2; ++i)
- *((UInt16 *)pCopy + i) = Poco::ByteOrder::flipBytes(*((UInt16 *)pImage + i));
+ *((uint16_t *)pCopy + i) = Poco::ByteOrder::flipBytes(*((uint16_t *)pImage + i));
}
delete m_pSharedMemory;
case 2 + 0 + 8:
// little endian
int cchImage = cbImage / 2;
- UInt16 *pchImage = (UInt16 *)pImage;
+ uint16_t *pchImage = (uint16_t *)pImage;
if (nByteOrder & 8)
{
++pchImage;
pCopy = new unsigned char[cbImage];
if (pCopy)
{
- UInt16 *pu16;
+ uint16_t *pu16;
unsigned char *pu8;
- for (pu16 = (UInt16 *)pchImage, pu8 = (unsigned char *)pCopy; pu16 < pchImage + cchImage; ++pu16)
+ for (pu16 = (uint16_t *)pchImage, pu8 = (unsigned char *)pCopy; pu16 < pchImage + cchImage; ++pu16)
pu8 += ucr::Ucs4_to_Utf8(*pu16, pu8);
}
delete m_pSharedMemory;
if (pCopy)
{
for (int i = 0; i < cbImage / 2; ++i)
- *((UInt16 *)pCopy + i) = Poco::ByteOrder::flipBytes(*((UInt16 *)pImage + i));
+ *((uint16_t *)pCopy + i) = Poco::ByteOrder::flipBytes(*((uint16_t *)pImage + i));
}
delete m_pSharedMemory;
m_pSharedMemory = NULL;