From f210acbf5c1d3415c5ebb85d611e62322ddac745 Mon Sep 17 00:00:00 2001 From: sdottaka Date: Fri, 28 Nov 2014 21:29:52 +0900 Subject: [PATCH] Use std::unique_ptr/shared_ptr instead of boost::scoped_ptr/scoped_array/shared_ptr --HG-- branch : stable --- Src/Common/Bitmap.cpp | 4 ++-- Src/Common/DragDrop.cpp | 4 ++-- Src/Common/ExConverter.cpp | 6 +++--- Src/Common/UniFile.cpp | 4 ++-- Src/Common/multiformatText.cpp | 13 ++++++------- Src/Common/unicoder.cpp | 4 ++-- Src/Common/version.h | 4 ++-- Src/CompareEngines/ByteCompare.cpp | 6 +++--- Src/CompareEngines/ByteCompare.h | 4 ++-- Src/CompareEngines/DiffUtils.cpp | 6 +++--- Src/CompareEngines/DiffUtils.h | 8 ++++---- Src/ConfigLog.cpp | 4 ++-- Src/ConfigLog.h | 4 ++-- Src/DiffContext.cpp | 18 +++++++++--------- Src/DiffContext.h | 10 +++++----- Src/DiffFileData.cpp | 2 +- Src/DiffThread.h | 6 +++--- Src/DiffWrapper.cpp | 6 +++--- Src/DiffWrapper.h | 10 +++++----- Src/DirDoc.cpp | 10 +++++----- Src/DirDoc.h | 8 ++++---- Src/DirItem.cpp | 2 +- Src/DirScan.cpp | 4 ++-- Src/DirView.cpp | 14 +++++++------- Src/DirView.h | 12 ++++++------ Src/EditorFilepathBar.cpp | 2 +- Src/EditorFilepathBar.h | 4 ++-- Src/FileActionScript.h | 8 ++++---- Src/FileFilter.h | 6 +++--- Src/FileFilterHelper.cpp | 2 +- Src/FileFilterHelper.h | 6 +++--- Src/FilterList.h | 4 ++-- Src/FolderCmp.cpp | 6 +++--- Src/FolderCmp.h | 8 ++++---- Src/LineFiltersList.h | 4 ++-- Src/LocationView.cpp | 8 ++++---- Src/LocationView.h | 4 ++-- Src/MainFrm.cpp | 2 +- Src/MainFrm.h | 7 +++---- Src/Merge.h | 14 +++++++------- Src/MergeDoc.h | 10 +++++----- Src/MergeDocLineDiffs.cpp | 4 ++-- Src/PluginManager.h | 4 ++-- Src/Plugins.h | 8 ++++---- Src/SelectUnpackerDlg.h | 6 +++--- Src/UniMarkdownFile.cpp | 4 ++-- Src/UniMarkdownFile.h | 4 ++-- Src/codepage_detect.cpp | 4 ++-- 48 files changed, 150 insertions(+), 152 deletions(-) diff --git a/Src/Common/Bitmap.cpp b/Src/Common/Bitmap.cpp index 9b8d5ae01..258cf8c35 100644 --- a/Src/Common/Bitmap.cpp +++ b/Src/Common/Bitmap.cpp @@ -10,7 +10,7 @@ #include "StdAfx.h" #include "Bitmap.h" #include -#include +#include #ifdef _DEBUG #define new DEBUG_NEW @@ -88,7 +88,7 @@ CBitmap *GetDarkenedBitmap(CDC *pDC, CBitmap *pBitmap) bi.bmiHeader.biClrUsed = 0; bi.bmiHeader.biClrImportant = 0; - boost::scoped_array pbuf(new BYTE[bi.bmiHeader.biSizeImage]); + std::unique_ptr pbuf(new BYTE[bi.bmiHeader.biSizeImage]); GetDIBits(dcMem.m_hDC, (HBITMAP)*pBitmapDarkened, 0, bm.bmHeight, pbuf.get(), &bi, DIB_RGB_COLORS); int x; diff --git a/Src/Common/DragDrop.cpp b/Src/Common/DragDrop.cpp index 4fa760495..65f4b08dd 100644 --- a/Src/Common/DragDrop.cpp +++ b/Src/Common/DragDrop.cpp @@ -1,5 +1,5 @@ #include "DragDrop.h" -#include +#include #include "paths.h" // @@ -24,7 +24,7 @@ bool GetDroppedFiles(HDROP dropInfo, std::vector& files) // Allocate memory to contain full pathname & zero byte wPathnameSize += 1; - boost::scoped_array npszFile(new TCHAR[wPathnameSize]); + std::unique_ptr npszFile(new TCHAR[wPathnameSize]); // Copy the pathname into the buffer DragQueryFile(dropInfo, x, npszFile.get(), wPathnameSize); diff --git a/Src/Common/ExConverter.cpp b/Src/Common/ExConverter.cpp index 510b7f26b..b8968c1c7 100644 --- a/Src/Common/ExConverter.cpp +++ b/Src/Common/ExConverter.cpp @@ -9,7 +9,7 @@ #include "ExConverter.h" #include #include -#include +#include #include "unicoder.h" #include "codepage.h" @@ -100,7 +100,7 @@ public: else { size_t wsize = *srcbytes * 2 + 6; - boost::scoped_array pbuf(new wchar_t[wsize]); + std::unique_ptr pbuf(new wchar_t[wsize]); bsucceeded = convertToUnicode(srcCodepage, (const char *)src, srcbytes, pbuf.get(), &wsize); if (!bsucceeded) { @@ -148,7 +148,7 @@ public: return defcodepage; srcsize = static_cast(size); dstsize = static_cast(size * sizeof(wchar_t)); - boost::scoped_array pdst(new unsigned char[size * sizeof(wchar_t)]); + std::unique_ptr pdst(new unsigned char[size * sizeof(wchar_t)]); SetLastError(0); hr = pcc->DoConversion((unsigned char *)data, &srcsize, pdst.get(), &dstsize); pcc->GetSourceCodePage((unsigned *)&codepage); diff --git a/Src/Common/UniFile.cpp b/Src/Common/UniFile.cpp index 2c1d8f929..3d4f976a1 100644 --- a/Src/Common/UniFile.cpp +++ b/Src/Common/UniFile.cpp @@ -35,7 +35,7 @@ THE SOFTWARE. #include #include #include -#include +#include #include "UnicodeString.h" #include "unicoder.h" #include "paths.h" // paths_GetLongbPath() @@ -827,7 +827,7 @@ bool UniStdioFile::ReadBom() // Read 8 KB at max for get enough data determining UTF-8 without BOM. const int max_size = 8 * 1024; - boost::scoped_array buff(new unsigned char[max_size]); + std::unique_ptr buff(new unsigned char[max_size]); size_t bytes = fread(&buff[0], 1, max_size, m_fp); m_data = 0; diff --git a/Src/Common/multiformatText.cpp b/Src/Common/multiformatText.cpp index caf5a3abf..5257ed8d0 100644 --- a/Src/Common/multiformatText.cpp +++ b/Src/Common/multiformatText.cpp @@ -34,8 +34,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -235,7 +234,7 @@ const TCHAR *storageForPlugins::GetDataFileUnicode() try { { - boost::scoped_ptr pshmIn; + std::unique_ptr pshmIn; // Get source data if (m_bCurrentIsFile) { @@ -320,7 +319,7 @@ BSTR * storageForPlugins::GetDataBufferUnicode() try { { - boost::scoped_ptr pshmIn; + std::unique_ptr pshmIn; // Get source data if (m_bCurrentIsFile) { @@ -351,7 +350,7 @@ BSTR * storageForPlugins::GetDataBufferUnicode() int textRealSize = textForeseenSize; // allocate the memory - boost::scoped_array tempBSTR(new wchar_t[textForeseenSize]); + std::unique_ptr tempBSTR(new wchar_t[textForeseenSize]); // fill in the data wchar_t * pbstrBuffer = tempBSTR.get(); @@ -394,7 +393,7 @@ const TCHAR *storageForPlugins::GetDataFileAnsi() try { { - boost::scoped_ptr pshmIn; + std::unique_ptr pshmIn; // Get source data if (m_bCurrentIsFile) { @@ -487,7 +486,7 @@ VARIANT * storageForPlugins::GetDataBufferAnsi() try { { - boost::scoped_ptr pshmIn; + std::unique_ptr pshmIn; // Get source data if (m_bCurrentIsFile) { diff --git a/Src/Common/unicoder.cpp b/Src/Common/unicoder.cpp index 254dfddbf..edfe9e816 100644 --- a/Src/Common/unicoder.cpp +++ b/Src/Common/unicoder.cpp @@ -20,7 +20,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #include #include #include -#include +#include #include #include "UnicodeString.h" #include "ExConverter.h" @@ -717,7 +717,7 @@ int CrossConvert(const char* src, unsigned srclen, char* dest, unsigned destsize // Convert input to Unicode, using specified codepage DWORD flags = 0; int wlen = srclen * 2 + 6; - boost::scoped_array wbuff(new wchar_t[wlen]); + std::unique_ptr wbuff(new wchar_t[wlen]); int n; if (cpin == CP_UCS2LE) { diff --git a/Src/Common/version.h b/Src/Common/version.h index a4c441cce..01debe4a2 100644 --- a/Src/Common/version.h +++ b/Src/Common/version.h @@ -10,7 +10,7 @@ #define VERSIONTOOLS_H #include -#include +#include #include "UnicodeString.h" /** @@ -25,7 +25,7 @@ class CVersionInfo { private: VS_FIXEDFILEINFO m_FixedFileInfo; /**< Fixed file information */ - boost::scoped_array m_pVffInfo; /**< Pointer to version information block */ + std::unique_ptr m_pVffInfo; /**< Pointer to version information block */ BOOL m_bVersionOnly; /**< Ask version numbers only */ BOOL m_bDllVersion; /**< Dll file version is being queried */ WORD m_wLanguage; /**< Language-ID to use (if given) */ diff --git a/Src/CompareEngines/ByteCompare.cpp b/Src/CompareEngines/ByteCompare.cpp index 11b075a8e..ad73bce31 100644 --- a/Src/CompareEngines/ByteCompare.cpp +++ b/Src/CompareEngines/ByteCompare.cpp @@ -39,9 +39,9 @@ static void CopyTextStats(const FileTextStats * stats, FileTextStats * myTextSta * @brief Default constructor. */ ByteCompare::ByteCompare() - : m_pOptions(NULL) - , m_piAbortable(NULL) - , m_inf(NULL) + : m_pOptions(nullptr) + , m_piAbortable(nullptr) + , m_inf(nullptr) { } diff --git a/Src/CompareEngines/ByteCompare.h b/Src/CompareEngines/ByteCompare.h index e0248e7ab..8dc6725ea 100644 --- a/Src/CompareEngines/ByteCompare.h +++ b/Src/CompareEngines/ByteCompare.h @@ -9,7 +9,7 @@ #ifndef _BYTE_COMPARE_H_ #define _BYTE_COMPARE_H_ -#include +#include #include "FileTextStats.h" class CompareOptions; @@ -40,7 +40,7 @@ public: void GetTextStats(int side, FileTextStats *stats) const; private: - boost::scoped_ptr m_pOptions; /**< Compare options for diffutils. */ + std::unique_ptr m_pOptions; /**< Compare options for diffutils. */ IAbortable * m_piAbortable; file_data * m_inf; /**< Compared files data (for diffutils). */ FileTextStats m_textStats[2]; diff --git a/Src/CompareEngines/DiffUtils.cpp b/Src/CompareEngines/DiffUtils.cpp index e491f9b16..bad34ed4d 100644 --- a/Src/CompareEngines/DiffUtils.cpp +++ b/Src/CompareEngines/DiffUtils.cpp @@ -31,9 +31,9 @@ static void CopyTextStats(const file_data * inf, FileTextStats * myTextStats); * @brief Default constructor. */ DiffUtils::DiffUtils() - : m_pOptions(NULL) - , m_pFilterList(NULL) - , m_inf(NULL) + : m_pOptions(nullptr) + , m_pFilterList(nullptr) + , m_inf(nullptr) , m_FilterCommentsManager(new ::FilterCommentsManager) , m_pDiffWrapper(new ::CDiffWrapper) , m_ndiffs(0) diff --git a/Src/CompareEngines/DiffUtils.h b/Src/CompareEngines/DiffUtils.h index 5b4a58911..fb7e8edb6 100644 --- a/Src/CompareEngines/DiffUtils.h +++ b/Src/CompareEngines/DiffUtils.h @@ -10,7 +10,7 @@ #ifndef _DIFF_UTILS_H_ #define _DIFF_UTILS_H_ -#include +#include class CompareOptions; class FilterList; @@ -49,14 +49,14 @@ public: void SetCodepage(int codepage) { m_codepage = codepage; } private: - boost::scoped_ptr m_pOptions; /**< Compare options for diffutils. */ + std::unique_ptr m_pOptions; /**< Compare options for diffutils. */ FilterList * m_pFilterList; /**< Filter list for line filters. */ file_data * m_inf; /**< Compared files data (for diffutils). */ int m_ndiffs; /**< Real diffs found. */ int m_ntrivialdiffs; /**< Ignored diffs found. */ int m_codepage; /**< Codepage used in line filter */ - boost::scoped_ptr m_FilterCommentsManager; /**< Comments filtering manager */ - boost::scoped_ptr m_pDiffWrapper; + std::unique_ptr m_FilterCommentsManager; /**< Comments filtering manager */ + std::unique_ptr m_pDiffWrapper; }; diff --git a/Src/ConfigLog.cpp b/Src/ConfigLog.cpp index c0f0a13a5..64a720c5a 100644 --- a/Src/ConfigLog.cpp +++ b/Src/ConfigLog.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include "Constants.h" #include "version.h" #include "UniFile.h" @@ -230,7 +230,7 @@ void CConfigLog::WriteArchiveSupport() if (DWORD cchPath = GetEnvironmentVariable(_T("path"), 0, 0)) { static const TCHAR cSep[] = _T(";"); - boost::scoped_array pchPath(new TCHAR[cchPath]); + std::unique_ptr pchPath(new TCHAR[cchPath]); GetEnvironmentVariable(_T("PATH"), pchPath.get(), cchPath); LPTSTR pchItem = &pchPath[0]; while (int cchItem = StrCSpn(pchItem += StrSpn(pchItem, cSep), cSep)) diff --git a/Src/ConfigLog.h b/Src/ConfigLog.h index 028e2547e..199ecc271 100644 --- a/Src/ConfigLog.h +++ b/Src/ConfigLog.h @@ -26,7 +26,7 @@ #define _CONFIGLOG_H_ #include "UnicodeString.h" -#include +#include class UniStdioFile; @@ -65,7 +65,7 @@ private: // Implementation data private: String m_sFileName; - boost::scoped_ptr m_pfile; + std::unique_ptr m_pfile; }; #endif /* _CONFIGLOG_H_ */ \ No newline at end of file diff --git a/Src/DiffContext.cpp b/Src/DiffContext.cpp index fdb3585c4..0d9774cc2 100644 --- a/Src/DiffContext.cpp +++ b/Src/DiffContext.cpp @@ -55,18 +55,18 @@ using Poco::FastMutex; * @param [in] compareMethod Main compare method for this compare. */ CDiffContext::CDiffContext(const PathContext & paths, int compareMethod) -: m_piFilterGlobal(NULL) -, m_piPluginInfos(NULL) +: m_piFilterGlobal(nullptr) +, m_piPluginInfos(nullptr) , m_nCompMethod(compareMethod) , m_bIgnoreSmallTimeDiff(false) -, m_pCompareStats(NULL) -, m_piAbortable(NULL) +, m_pCompareStats(nullptr) +, m_piAbortable(nullptr) , m_bStopAfterFirstDiff(false) -, m_pFilterList(NULL) -, m_pDiffWrapper(NULL) -, m_pContentCompareOptions(NULL) -, m_pQuickCompareOptions(NULL) -, m_pOptions(NULL) +, m_pFilterList(nullptr) +, m_pDiffWrapper(nullptr) +, m_pContentCompareOptions(nullptr) +, m_pQuickCompareOptions(nullptr) +, m_pOptions(nullptr) , m_bPluginsEnabled(false) , m_bRecursive(false) , m_bWalkUniques(true) diff --git a/Src/DiffContext.h b/Src/DiffContext.h index ed8876715..fb368f87d 100644 --- a/Src/DiffContext.h +++ b/Src/DiffContext.h @@ -12,7 +12,7 @@ #define POCO_NO_UNWINDOWS 1 #include #include -#include +#include #include "PathContext.h" #include "DiffFileInfo.h" #include "DiffItemList.h" @@ -184,7 +184,7 @@ public: bool m_bRecursive; /**< Do we include subfolders to compare? */ bool m_bPluginsEnabled; /**< Are plugins enabled? */ - boost::scoped_ptr m_pFilterList; /**< Filter list for line filters */ + std::unique_ptr m_pFilterList; /**< Filter list for line filters */ CDiffWrapper *m_pDiffWrapper; private: @@ -196,9 +196,9 @@ private: */ int m_nCompMethod; - boost::scoped_ptr m_pOptions; /**< Generalized compare options. */ - boost::scoped_ptr m_pContentCompareOptions; /**< Per compare method compare options. */ - boost::scoped_ptr m_pQuickCompareOptions; /**< Per compare method compare options. */ + std::unique_ptr m_pOptions; /**< Generalized compare options. */ + std::unique_ptr m_pContentCompareOptions; /**< Per compare method compare options. */ + std::unique_ptr m_pQuickCompareOptions; /**< Per compare method compare options. */ PathContext m_paths; /**< (root) paths for this context */ IAbortable *m_piAbortable; /**< Interface for aborting the compare. */ Poco::FastMutex m_mutex; diff --git a/Src/DiffFileData.cpp b/Src/DiffFileData.cpp index d5ebe76a5..4a4d0874d 100644 --- a/Src/DiffFileData.cpp +++ b/Src/DiffFileData.cpp @@ -16,7 +16,7 @@ #include #include #endif -#include +#include #include "DiffItem.h" #include "FileLocation.h" #include "diff.h" diff --git a/Src/DiffThread.h b/Src/DiffThread.h index cf10da67f..efed9c48c 100644 --- a/Src/DiffThread.h +++ b/Src/DiffThread.h @@ -25,7 +25,7 @@ #ifndef _DIFFTHREAD_H #define _DIFFTHREAD_H -#include +#include #include #include #include @@ -111,8 +111,8 @@ public: private: CDiffContext * m_pDiffContext; /**< Compare context storing results. */ Poco::Thread m_threads[2]; /**< Compare threads. */ - boost::scoped_ptr m_pDiffParm; /**< Structure for sending data to threads. */ - boost::scoped_ptr m_pAbortgate; + std::unique_ptr m_pDiffParm; /**< Structure for sending data to threads. */ + std::unique_ptr m_pAbortgate; bool m_bAborting; /**< Is compare aborting? */ bool m_bOnlyRequested; /**< Are we comparing only requested items (Update?) */ }; diff --git a/Src/DiffWrapper.cpp b/Src/DiffWrapper.cpp index b684bd83f..61878ae57 100644 --- a/Src/DiffWrapper.cpp +++ b/Src/DiffWrapper.cpp @@ -83,10 +83,10 @@ CDiffWrapper::CDiffWrapper() , m_bAppendFiles(false) , m_nDiffs(0) , m_codepage(GetACP()) -, m_infoPrediffer(NULL) -, m_pDiffList(NULL) +, m_infoPrediffer(nullptr) +, m_pDiffList(nullptr) , m_bPathsAreTemp(false) -, m_pFilterList(NULL) +, m_pFilterList(nullptr) , m_bPluginsEnabled(false) { memset(&m_status, 0, sizeof(DIFFSTATUS)); diff --git a/Src/DiffWrapper.h b/Src/DiffWrapper.h index 4acd2e5ef..ea5d9a779 100644 --- a/Src/DiffWrapper.h +++ b/Src/DiffWrapper.h @@ -27,7 +27,7 @@ #ifndef _DIFFWRAPPER_H #define _DIFFWRAPPER_H -#include +#include #include "diff.h" #include "FileLocation.h" #include "PathContext.h" @@ -210,7 +210,7 @@ public: private: DiffutilsOptions m_options; DIFFSTATUS m_status; /**< Status of last compare */ - boost::scoped_ptr m_pFilterList; /**< List of linefilters. */ + std::unique_ptr m_pFilterList; /**< List of linefilters. */ PathContext m_files; /**< Full path to diff'ed file. */ PathContext m_alternativePaths; /**< file's alternative path (may be relative). */ PathContext m_originalFile; /**< file's original (NON-TEMP) path. */ @@ -218,7 +218,7 @@ private: String m_sPatchFile; /**< Full path to created patch file. */ bool m_bPathsAreTemp; /**< Are compared paths temporary? */ /// prediffer info are stored only for MergeDoc - boost::scoped_ptr m_infoPrediffer; + std::unique_ptr m_infoPrediffer; /// prediffer info are stored only for MergeDoc String m_sToFindPrediffer; bool m_bUseDiffList; /**< Are results returned in difflist? */ @@ -228,8 +228,8 @@ private: int m_nDiffs; /**< Difference count */ int m_codepage; /**< Codepage used in line filter */ DiffList *m_pDiffList; /**< Pointer to external DiffList */ - boost::scoped_ptr m_pMovedLines[3]; - boost::scoped_ptr m_FilterCommentsManager; /**< Comments filtering manager */ + std::unique_ptr m_pMovedLines[3]; + std::unique_ptr m_FilterCommentsManager; /**< Comments filtering manager */ bool m_bPluginsEnabled; /**< Are plugins enabled? */ }; diff --git a/Src/DirDoc.cpp b/Src/DirDoc.cpp index 4bf2d7016..b7d44e0ee 100644 --- a/Src/DirDoc.cpp +++ b/Src/DirDoc.cpp @@ -72,14 +72,14 @@ IMPLEMENT_DYNCREATE(CDirDoc, CDocument) * @brief Constructor. */ CDirDoc::CDirDoc() -: m_pCtxt(NULL) -, m_pDirView(NULL) -, m_pCompareStats(NULL) +: m_pCtxt(nullptr) +, m_pDirView(nullptr) +, m_pCompareStats(nullptr) , m_bRecursive(FALSE) -, m_statusCursor(NULL) +, m_statusCursor(nullptr) , m_bReuseCloses(FALSE) , m_bMarkedRescan(FALSE) -, m_pTempPathContext(NULL) +, m_pTempPathContext(nullptr) { m_nDirs = m_nDirsTemp; diff --git a/Src/DirDoc.h b/Src/DirDoc.h index 019b40722..414a620ff 100644 --- a/Src/DirDoc.h +++ b/Src/DirDoc.h @@ -30,7 +30,7 @@ #define AFX_DIRDOC_H__0B17B4C1_356F_11D1_95CD_444553540000__INCLUDED_ #pragma once -#include +#include #include "DiffThread.h" #include "PluginManager.h" @@ -161,13 +161,13 @@ protected: // Implementation data private: - boost::scoped_ptr m_pCtxt; /**< Pointer to diff-data */ + std::unique_ptr m_pCtxt; /**< Pointer to diff-data */ CDirView *m_pDirView; /**< Pointer to GUI */ - boost::scoped_ptr m_pCompareStats; /**< Compare statistics */ + std::unique_ptr m_pCompareStats; /**< Compare statistics */ MergeDocPtrList m_MergeDocs; /**< List of file compares opened from this compare */ bool m_bRO[3]; /**< Is left/middle/right side read-only */ bool m_bRecursive; /**< Is current compare recursive? */ - boost::scoped_ptr m_statusCursor; + std::unique_ptr m_statusCursor; String m_strDesc[3]; /**< Left/middle/right side desription text */ PluginManager m_pluginman; bool m_bReuseCloses; /**< Are we closing because of reuse? */ diff --git a/Src/DirItem.cpp b/Src/DirItem.cpp index 5305a0a1a..596773f65 100644 --- a/Src/DirItem.cpp +++ b/Src/DirItem.cpp @@ -30,7 +30,7 @@ #include "paths.h" #include "TFile.h" -using boost::shared_ptr; +using std::shared_ptr; /** * @brief Convert file flags to string presentation. diff --git a/Src/DirScan.cpp b/Src/DirScan.cpp index 3ac794f64..7757a6717 100644 --- a/Src/DirScan.cpp +++ b/Src/DirScan.cpp @@ -8,6 +8,7 @@ #include "DirScan.h" #include +#include #define POCO_NO_UNWINDOWS 1 #include #include @@ -20,7 +21,6 @@ #include #include #include -#include #include "DiffThread.h" #include "UnicodeString.h" #include "DiffWrapper.h" @@ -107,7 +107,7 @@ private: CDiffContext *m_pCtxt; }; -typedef boost::shared_ptr DiffWorkerPtr; +typedef std::shared_ptr DiffWorkerPtr; /** * @brief Collect file- and folder-names to list. diff --git a/Src/DirView.cpp b/Src/DirView.cpp index 094d50d6d..2f0b71d05 100644 --- a/Src/DirView.cpp +++ b/Src/DirView.cpp @@ -135,20 +135,20 @@ IMPLEMENT_DYNCREATE(CDirView, CListView) CDirView::CDirView() : m_numcols(-1) , m_dispcols(-1) - , m_pList(NULL) + , m_pList(nullptr) , m_nHiddenItems(0) , m_bNeedSearchFirstDiffItem(true) , m_bNeedSearchLastDiffItem(true) , m_firstDiffItem(-1) , m_lastDiffItem(-1) - , m_pCmpProgressBar(NULL) + , m_pCmpProgressBar(nullptr) , m_compareStart(0) , m_bTreeMode(false) - , m_pShellContextMenuLeft(NULL) - , m_pShellContextMenuMiddle(NULL) - , m_pShellContextMenuRight(NULL) - , m_hCurrentMenu(NULL) - , m_pSavedTreeState(NULL) + , m_pShellContextMenuLeft(nullptr) + , m_pShellContextMenuMiddle(nullptr) + , m_pShellContextMenuRight(nullptr) + , m_hCurrentMenu(nullptr) + , m_pSavedTreeState(nullptr) { m_dwDefaultStyle &= ~LVS_TYPEMASK; // Show selection all the time, so user can see current item even when diff --git a/Src/DirView.h b/Src/DirView.h index 052d786bc..75077abc1 100644 --- a/Src/DirView.h +++ b/Src/DirView.h @@ -33,7 +33,7 @@ // CDirView view #include #include -#include +#include #define POCO_NO_UNWINDOWS 1 #include #include "OptionsDiffColors.h" @@ -289,7 +289,7 @@ protected: CFont m_font; /**< User-selected font */ UINT m_nHiddenItems; /**< Count of items we have hidden */ bool m_bTreeMode; /**< TRUE if tree mode is on*/ - boost::scoped_ptr m_pCmpProgressBar; + std::unique_ptr m_pCmpProgressBar; clock_t m_compareStart; /**< Starting process time of the compare */ bool m_bUserCancelEdit; /**< TRUE if the user cancels rename */ String m_lastCopyFolder; /**< Last Copy To -target folder. */ @@ -300,11 +300,11 @@ protected: bool m_bNeedSearchLastDiffItem; COLORSETTINGS m_cachedColors; /**< Cached color settings */ - boost::scoped_ptr m_pShellContextMenuLeft; /**< Shell context menu for group of left files */ - boost::scoped_ptr m_pShellContextMenuMiddle; /**< Shell context menu for group of middle files */ - boost::scoped_ptr m_pShellContextMenuRight; /**< Shell context menu for group of right files */ + std::unique_ptr m_pShellContextMenuLeft; /**< Shell context menu for group of left files */ + std::unique_ptr m_pShellContextMenuMiddle; /**< Shell context menu for group of middle files */ + std::unique_ptr m_pShellContextMenuRight; /**< Shell context menu for group of right files */ HMENU m_hCurrentMenu; /**< Current shell context menu (either left or right) */ - boost::scoped_ptr m_pSavedTreeState; + std::unique_ptr m_pSavedTreeState; // Generated message map functions afx_msg void OnColumnClick(NMHDR* pNMHDR, LRESULT* pResult); diff --git a/Src/EditorFilepathBar.cpp b/Src/EditorFilepathBar.cpp index 6c780fdf4..3a5719e7a 100644 --- a/Src/EditorFilepathBar.cpp +++ b/Src/EditorFilepathBar.cpp @@ -45,7 +45,7 @@ END_MESSAGE_MAP() * @brief Constructor. */ CEditorFilePathBar::CEditorFilePathBar() -: m_pFont(NULL), m_nPanes(2) +: m_pFont(nullptr), m_nPanes(2) { } diff --git a/Src/EditorFilepathBar.h b/Src/EditorFilepathBar.h index f6e0f825a..db50f5b03 100644 --- a/Src/EditorFilepathBar.h +++ b/Src/EditorFilepathBar.h @@ -29,7 +29,7 @@ #ifndef __EDITORFILEPATHBAR_H__ #define __EDITORFILEPATHBAR_H__ -#include +#include #include "FilepathEdit.h" /** @@ -78,7 +78,7 @@ protected: private: // this dialog uses custom edit boxes CFilepathEdit m_Edit[3]; /**< Edit controls. */ - boost::scoped_ptr m_pFont; /**< Font for editcontrols */ + std::unique_ptr m_pFont; /**< Font for editcontrols */ int m_nPanes; }; diff --git a/Src/FileActionScript.h b/Src/FileActionScript.h index aa431d6f1..e0f600f4f 100644 --- a/Src/FileActionScript.h +++ b/Src/FileActionScript.h @@ -26,7 +26,7 @@ #define _FILEACTIONSCRIPT_H_ #include -#include +#include class ShellFileOperations; @@ -153,11 +153,11 @@ protected: private: std::vector m_actions; /**< List of all actions for this script. */ - boost::scoped_ptr m_pCopyOperations; /**< Copy operations. */ + std::unique_ptr m_pCopyOperations; /**< Copy operations. */ BOOL m_bHasCopyOperations; /**< flag if we've put anything into m_pCopyOperations */ - boost::scoped_ptr m_pMoveOperations; /**< Move operations. */ + std::unique_ptr m_pMoveOperations; /**< Move operations. */ BOOL m_bHasMoveOperations; /**< flag if we've put anything into m_pMoveOperations */ - boost::scoped_ptr m_pDelOperations; /**< Delete operations. */ + std::unique_ptr m_pDelOperations; /**< Delete operations. */ BOOL m_bHasDelOperations; /**< flag if we've put anything into m_pDelOperations */ BOOL m_bUseRecycleBin; /**< Use recycle bin for script actions? */ HWND m_hParentWindow; /**< Parent window for showing messages */ diff --git a/Src/FileFilter.h b/Src/FileFilter.h index 131930526..dfa273693 100644 --- a/Src/FileFilter.h +++ b/Src/FileFilter.h @@ -25,9 +25,9 @@ #define __FILEFILTER_H__ #include +#include #define POCO_NO_UNWINDOWS 1 #include -#include #include "UnicodeString.h" /** @@ -50,7 +50,7 @@ struct FileFilterElement } }; -typedef boost::shared_ptr FileFilterElementPtr; +typedef std::shared_ptr FileFilterElementPtr; /** * @brief One actual filter. @@ -75,6 +75,6 @@ struct FileFilter static void EmptyFilterList(std::vector *filterList); }; -typedef boost::shared_ptr FileFilterPtr; +typedef std::shared_ptr FileFilterPtr; #endif diff --git a/Src/FileFilterHelper.cpp b/Src/FileFilterHelper.cpp index cd801cee2..4b73b3cbe 100644 --- a/Src/FileFilterHelper.cpp +++ b/Src/FileFilterHelper.cpp @@ -37,7 +37,7 @@ using std::vector; * @brief Constructor, creates new filtermanager. */ FileFilterHelper::FileFilterHelper() -: m_pMaskFilter(NULL) +: m_pMaskFilter(nullptr) , m_bUseMask(true) , m_fileFilterMgr(new FileFilterMgr) { diff --git a/Src/FileFilterHelper.h b/Src/FileFilterHelper.h index 70fd95817..f9b60d037 100644 --- a/Src/FileFilterHelper.h +++ b/Src/FileFilterHelper.h @@ -26,7 +26,7 @@ #define _FILEFILTERHELPER_H_ #include -#include +#include #include "UnicodeString.h" #include "DirItem.h" @@ -154,9 +154,9 @@ protected: String ParseExtensions(const String &extensions) const; private: - boost::scoped_ptr m_pMaskFilter; /*< Filter for filemasks (*.cpp) */ + std::unique_ptr m_pMaskFilter; /*< Filter for filemasks (*.cpp) */ FileFilter * m_currentFilter; /*< Currently selected filefilter */ - boost::scoped_ptr m_fileFilterMgr; /*< Associated FileFilterMgr */ + std::unique_ptr m_fileFilterMgr; /*< Associated FileFilterMgr */ String m_sFileFilterPath; /*< Path to current filter */ String m_sMask; /*< File mask (if defined) "*.cpp *.h" etc */ bool m_bUseMask; /*< If TRUE file mask is used, filter otherwise */ diff --git a/Src/FilterList.h b/Src/FilterList.h index 56f24cce1..f91fa2af3 100644 --- a/Src/FilterList.h +++ b/Src/FilterList.h @@ -11,9 +11,9 @@ #include #include +#include #define POCO_NO_UNWINDOWS 1 #include -#include #include "codepage.h" /** @@ -29,7 +29,7 @@ struct filter_item filter_item(const std::string &filter, int reOpts) : filterAsString(filter), regexp(filter, reOpts) {} }; -typedef boost::shared_ptr filter_item_ptr; +typedef std::shared_ptr filter_item_ptr; /** * @brief Regular expression list. diff --git a/Src/FolderCmp.cpp b/Src/FolderCmp.cpp index ef03293cc..e73a4fa10 100644 --- a/Src/FolderCmp.cpp +++ b/Src/FolderCmp.cpp @@ -30,9 +30,9 @@ using CompareEngines::TimeSizeCompare; static void GetComparePaths(CDiffContext * pCtxt, const DIFFITEM &di, PathContext & files); FolderCmp::FolderCmp() -: m_pDiffUtilsEngine(NULL) -, m_pByteCompare(NULL) -, m_pTimeSizeCompare(NULL) +: m_pDiffUtilsEngine(nullptr) +, m_pByteCompare(nullptr) +, m_pTimeSizeCompare(nullptr) , m_ndiffs(CDiffContext::DIFFS_UNKNOWN) , m_ntrivialdiffs(CDiffContext::DIFFS_UNKNOWN) { diff --git a/Src/FolderCmp.h b/Src/FolderCmp.h index 4559ebdb4..1e1571816 100644 --- a/Src/FolderCmp.h +++ b/Src/FolderCmp.h @@ -9,7 +9,7 @@ #ifndef _FOLDERCMP_H_ #define _FOLDERCMP_H_ -#include +#include #include "DiffFileData.h" #include "DiffUtils.h" #include "ByteCompare.h" @@ -53,9 +53,9 @@ public: DiffFileData m_diffFileData; private: - boost::scoped_ptr m_pDiffUtilsEngine; - boost::scoped_ptr m_pByteCompare; - boost::scoped_ptr m_pTimeSizeCompare; + std::unique_ptr m_pDiffUtilsEngine; + std::unique_ptr m_pByteCompare; + std::unique_ptr m_pTimeSizeCompare; }; diff --git a/Src/LineFiltersList.h b/Src/LineFiltersList.h index 53789203d..c4894b43c 100644 --- a/Src/LineFiltersList.h +++ b/Src/LineFiltersList.h @@ -10,7 +10,7 @@ #define _LINEFILTERS_LIST_H_ #include -#include +#include #include "UnicodeString.h" class COptionsMgr; @@ -25,7 +25,7 @@ struct LineFilterItem LineFilterItem() : enabled(false) { } }; -typedef boost::shared_ptr LineFilterItemPtr; +typedef std::shared_ptr LineFilterItemPtr; /** @brief List of line filters. diff --git a/Src/LocationView.cpp b/Src/LocationView.cpp index e4f604e0e..d5e912964 100644 --- a/Src/LocationView.cpp +++ b/Src/LocationView.cpp @@ -89,8 +89,8 @@ CLocationView::CLocationView() : m_visibleTop(-1) , m_visibleBottom(-1) // MOVEDLINE_LIST m_movedLines; //*< List of moved block connecting lines */ - , m_hwndFrame(NULL) - , m_pSavedBackgroundBitmap(NULL) + , m_hwndFrame(nullptr) + , m_pSavedBackgroundBitmap(nullptr) , m_bDrawn(false) , m_bRecalculateBlocks(TRUE) // calculate for the first time { @@ -979,8 +979,8 @@ void CLocationView::DrawVisibleAreaRect(CDC *pClientDC, int nTopLine, int nBotto m_visibleBottom = nBottomCoord; CRect rcVisibleArea(2, m_visibleTop, rc.right - 2, m_visibleBottom); - boost::scoped_ptr pBitmap(CopyRectToBitmap(pClientDC, rcVisibleArea)); - boost::scoped_ptr pDarkenedBitmap(GetDarkenedBitmap(pClientDC, pBitmap.get())); + std::unique_ptr pBitmap(CopyRectToBitmap(pClientDC, rcVisibleArea)); + std::unique_ptr pDarkenedBitmap(GetDarkenedBitmap(pClientDC, pBitmap.get())); DrawBitmap(pClientDC, rcVisibleArea.left, rcVisibleArea.top, pDarkenedBitmap.get()); } diff --git a/Src/LocationView.h b/Src/LocationView.h index a28e2fb62..de8fea0c8 100644 --- a/Src/LocationView.h +++ b/Src/LocationView.h @@ -14,7 +14,7 @@ #define __LOCATIONVIEW_H__ #include -#include +#include class CMergeDoc; class CMergeEditView; @@ -113,7 +113,7 @@ private: int m_nSubLineCount[3]; //*< Cached subline count */ MOVEDLINE_LIST m_movedLines; //*< List of moved block connecting lines */ HWND m_hwndFrame; //*< Frame window handle */ - boost::scoped_ptr m_pSavedBackgroundBitmap; //*< Saved background */ + std::unique_ptr m_pSavedBackgroundBitmap; //*< Saved background */ bool m_bDrawn; //*< Is already drawn in location pane? */ std::vector m_diffBlocks; //*< List of pre-calculated diff blocks. BOOL m_bRecalculateBlocks; //*< Recalculate diff blocks in next repaint. diff --git a/Src/MainFrm.cpp b/Src/MainFrm.cpp index 4f17d476c..347177822 100644 --- a/Src/MainFrm.cpp +++ b/Src/MainFrm.cpp @@ -2031,7 +2031,7 @@ void CMainFrame::OnToolsFilters() LineFiltersDlg lineFiltersDlg; FileFiltersDlg fileFiltersDlg; vector fileFilters; - boost::scoped_ptr lineFilters(new LineFiltersList()); + std::unique_ptr lineFilters(new LineFiltersList()); String selectedFilter; const String origFilter = theApp.m_pGlobalFileFilter->GetFilterNameOrMask(); sht.AddPage(&fileFiltersDlg); diff --git a/Src/MainFrm.h b/Src/MainFrm.h index 3abc33bdc..f0944e73f 100644 --- a/Src/MainFrm.h +++ b/Src/MainFrm.h @@ -30,8 +30,7 @@ #define AFX_MAINFRM_H__BBCD4F8C_34E4_11D1_BAA6_00A024706EDC__INCLUDED_ #include -#include -#include +#include #include "ToolBarXPThemes.h" #include "MDITabBar.h" #include "PathContext.h" @@ -49,7 +48,7 @@ class LineFiltersList; class TempFile; struct FileLocation; -typedef boost::shared_ptr TempFilePtr; +typedef std::shared_ptr TempFilePtr; // typed lists (homogenous pointer lists) typedef CTypedPtrList OpenDocList; @@ -205,7 +204,7 @@ protected: static const MENUITEM_ICON m_MenuIcons[]; - boost::scoped_ptr m_pMenus[MENU_COUNT]; /**< Menus for different views */ + std::unique_ptr m_pMenus[MENU_COUNT]; /**< Menus for different views */ std::vector m_tempFiles; /**< List of possibly needed temp files. */ // Generated message map functions diff --git a/Src/Merge.h b/Src/Merge.h index 4d90d449c..c8cb61a9c 100644 --- a/Src/Merge.h +++ b/Src/Merge.h @@ -33,7 +33,7 @@ #error include 'stdafx.h' before including this file for PCH #endif -#include +#include #include "MergeCmdLineInfo.h" #include "resource.h" // main symbols @@ -78,16 +78,16 @@ public: CMultiDocTemplate* m_pDiffTemplate; CMultiDocTemplate* m_pHexMergeTemplate; CMultiDocTemplate* m_pDirTemplate; - boost::scoped_ptr m_pLangDlg; - boost::scoped_ptr m_pGlobalFileFilter; - boost::scoped_ptr m_pSyntaxColors; /**< Syntax color container */ - boost::scoped_ptr m_pVssHelper; /**< Helper class for VSS integration */ + std::unique_ptr m_pLangDlg; + std::unique_ptr m_pGlobalFileFilter; + std::unique_ptr m_pSyntaxColors; /**< Syntax color container */ + std::unique_ptr m_pVssHelper; /**< Helper class for VSS integration */ CString m_strSaveAsPath; /**< "3rd path" where output saved if given */ BOOL m_bEscShutdown; /**< If commandline switch -e given ESC closes appliction */ SyntaxColors * GetMainSyntaxColors() { return m_pSyntaxColors.get(); } BOOL m_bClearCaseTool; /**< WinMerge is executed as an external Rational ClearCase compare/merge tool. */ MergeCmdLineInfo::ExitNoDiff m_bExitIfNoDiff; /**< Exit if files are identical? */ - boost::scoped_ptr m_pLineFilters; /**< List of linefilters */ + std::unique_ptr m_pLineFilters; /**< List of linefilters */ /** * @name Version Control System (VCS) integration. @@ -218,7 +218,7 @@ protected: //}}AFX_MSG DECLARE_MESSAGE_MAP() private: - boost::scoped_ptr m_pOptions; + std::unique_ptr m_pOptions; CAssureScriptsForThread * m_mainThreadScripts; int m_nLastCompareResult; bool m_bNonInteractive; diff --git a/Src/MergeDoc.h b/Src/MergeDoc.h index f3d484da6..d5b555efb 100644 --- a/Src/MergeDoc.h +++ b/Src/MergeDoc.h @@ -31,7 +31,7 @@ #include "DiffTextBuffer.h" #include #include -#include +#include #include "DiffWrapper.h" #include "DiffList.h" #include "TempFile.h" @@ -176,7 +176,7 @@ public: // Begin declaration of CMergeDoc - boost::scoped_ptr m_ptBuf[3]; /**< Left/Middle/Right side text buffer */ + std::unique_ptr m_ptBuf[3]; /**< Left/Middle/Right side text buffer */ int m_nBuffers; protected: // create from serialization only @@ -185,8 +185,8 @@ protected: // create from serialization only // Operations public: - boost::scoped_ptr m_pSaveFileInfo[3]; - boost::scoped_ptr m_pRescanFileInfo[3]; + std::unique_ptr m_pSaveFileInfo[3]; + std::unique_ptr m_pRescanFileInfo[3]; DiffList m_diffList; UINT m_nTrivialDiffs; /**< Amount of trivial (ignored) diffs */ PathContext m_filePaths; /**< Filepaths for this document */ @@ -319,7 +319,7 @@ protected: COleDateTime m_LastRescan; /**< Time of last rescan (for delaying) */ CDiffWrapper m_diffWrapper; /// information about the file packer/unpacker - boost::scoped_ptr m_pInfoUnpacker; + std::unique_ptr m_pInfoUnpacker; String m_strDesc[3]; /**< Left/Middle/Right side description text */ BUFFERTYPE m_nBufferType[3]; bool m_bEditAfterRescan[3]; /**< Left/middle/right doc edited after rescanning */ diff --git a/Src/MergeDocLineDiffs.cpp b/Src/MergeDocLineDiffs.cpp index e4ff8456a..eecdd1ca0 100644 --- a/Src/MergeDocLineDiffs.cpp +++ b/Src/MergeDocLineDiffs.cpp @@ -10,7 +10,7 @@ #include "StdAfx.h" #include "MergeDoc.h" #include -#include +#include #include "Merge.h" #include "MergeEditView.h" #include "DiffTextBuffer.h" @@ -168,7 +168,7 @@ void CMergeDoc::GetWordDiffArray(int nLineIndex, vector *pWordDiffs) DIFFOPTIONS diffOptions = {0}; m_diffWrapper.GetOptions(&diffOptions); String str[3]; - boost::scoped_array nOffsets[3]; + std::unique_ptr nOffsets[3]; const int LineLimit = 20; bool diffPerLine = false; diff --git a/Src/PluginManager.h b/Src/PluginManager.h index 38ec64c6e..5b19317c1 100644 --- a/Src/PluginManager.h +++ b/Src/PluginManager.h @@ -3,7 +3,7 @@ #define POCO_NO_UNWINDOWS 1 #include -#include +#include #include // defines IPluginInfos #include "DiffContext.h" @@ -19,7 +19,7 @@ struct PluginFileInfo PrediffingInfo m_infoPrediffer; }; -typedef boost::shared_ptr PluginFileInfoPtr; +typedef std::shared_ptr PluginFileInfoPtr; /** * @brief Cache of known plugin infos diff --git a/Src/Plugins.h b/Src/Plugins.h index 8bac9b0cc..b7c794a29 100644 --- a/Src/Plugins.h +++ b/Src/Plugins.h @@ -34,11 +34,11 @@ #include #include #include -#include +#include #include "UnicodeString.h" struct FileFilterElement; -typedef boost::shared_ptr FileFilterElementPtr; +typedef std::shared_ptr FileFilterElementPtr; /** * @brief List of transformation categories (events) @@ -91,10 +91,10 @@ private: PluginInfo& operator=( const PluginInfo& ); // non copyable }; -typedef boost::shared_ptr PluginInfoPtr; +typedef std::shared_ptr PluginInfoPtr; typedef std::vector PluginArray; -typedef boost::shared_ptr PluginArrayPtr; +typedef std::shared_ptr PluginArrayPtr; /** * @brief Cache for the scriptlets' interfaces during the life of a thread. diff --git a/Src/SelectUnpackerDlg.h b/Src/SelectUnpackerDlg.h index 282e76acc..2aea17c9b 100644 --- a/Src/SelectUnpackerDlg.h +++ b/Src/SelectUnpackerDlg.h @@ -30,7 +30,7 @@ #define AFX_SELECTUNPACKERDLG_H__C8FD4C3A_5ED5_43D3_ADAE_A2378369705C__INCLUDED_ #include -#include +#include ///////////////////////////////////////////////////////////////////////////// // CSelectUnpackerDlgDlg dialog @@ -78,9 +78,9 @@ protected: std::vector m_bWithFileFlags; // const data "no plugin" - boost::scoped_ptr noPlugin; + std::unique_ptr noPlugin; // const data "automatic plugin" - boost::scoped_ptr automaticPlugin; + std::unique_ptr automaticPlugin; // input value CString m_filteredFilenames; diff --git a/Src/UniMarkdownFile.cpp b/Src/UniMarkdownFile.cpp index 639b62c11..eec9694f8 100644 --- a/Src/UniMarkdownFile.cpp +++ b/Src/UniMarkdownFile.cpp @@ -16,10 +16,10 @@ static void CollapseWhitespace(String &line); * @brief Constructor. */ UniMarkdownFile::UniMarkdownFile() -: m_pMarkdown(NULL) +: m_pMarkdown(nullptr) , m_depth(0) , m_bMove(false) -, m_transparent(NULL) +, m_transparent(nullptr) { } diff --git a/Src/UniMarkdownFile.h b/Src/UniMarkdownFile.h index fabd73d22..d09c58a9b 100644 --- a/Src/UniMarkdownFile.h +++ b/Src/UniMarkdownFile.h @@ -6,7 +6,7 @@ // ID line follows -- this is updated by SVN // $Id$ -#include +#include #include "Common/UniFile.h" class CMarkdown; @@ -31,5 +31,5 @@ private: int m_depth; bool m_bMove; unsigned char *m_transparent; - boost::scoped_ptr m_pMarkdown; + std::unique_ptr m_pMarkdown; }; diff --git a/Src/codepage_detect.cpp b/Src/codepage_detect.cpp index 66a2f6243..cf7686f8d 100644 --- a/Src/codepage_detect.cpp +++ b/Src/codepage_detect.cpp @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include "unicoder.h" #include "ExConverter.h" #include "codepage.h" @@ -130,7 +130,7 @@ static unsigned demoGuessEncoding_html(const char *src, size_t len, int defcodep static unsigned demoGuessEncoding_xml(const char *src, size_t len, int defcodepage) { const char *psrc = src; - boost::scoped_array buf; + std::unique_ptr buf; if (len >= 2 && (src[0] == 0 || src[1] == 0)) { buf.reset(new char[len]); -- 2.11.0