diff --git a/sakura_core/CDicMgr.cpp b/sakura_core/CDicMgr.cpp index 4579f2ec7c..0532477fdc 100644 --- a/sakura_core/CDicMgr.cpp +++ b/sakura_core/CDicMgr.cpp @@ -52,7 +52,8 @@ BOOL CDicMgr::Search( CRunningTimer cRunningTimer( L"CDicMgr::Search" ); #endif long i; - const wchar_t* pszDelimit = L" /// "; + constexpr auto& pszDelimit = L" /// "; + constexpr auto cchDelimit = _countof(pszDelimit) - 1; wchar_t* pszWork; int nRes; wchar_t* pszToken; @@ -81,7 +82,7 @@ BOOL CDicMgr::Search( pszWork = wcsstr( szLine, pszDelimit ); if( NULL != pszWork && szLine[0] != L';' ){ *pszWork = L'\0'; - pszWork += wcslen( pszDelimit ); + pszWork += cchDelimit; /* 最初のトークンを取得します。 */ wchar_t *context = NULL; diff --git a/sakura_core/CGrepAgent.cpp b/sakura_core/CGrepAgent.cpp index 5f2b6e657b..4cba6b4b61 100644 --- a/sakura_core/CGrepAgent.cpp +++ b/sakura_core/CGrepAgent.cpp @@ -122,8 +122,7 @@ class CFileLoadOrWnd{ , m_nLineNum(0) { } - ~CFileLoadOrWnd(){ - } + ~CFileLoadOrWnd() = default; ECodeType FileOpen(const WCHAR* pszFile, bool bBigFile, ECodeType charCode, int nFlag) { if( m_hWnd ){ diff --git a/sakura_core/CGrepEnumFileBase.h b/sakura_core/CGrepEnumFileBase.h index 88a8229332..3590e23fc6 100644 --- a/sakura_core/CGrepEnumFileBase.h +++ b/sakura_core/CGrepEnumFileBase.h @@ -115,8 +115,9 @@ class CGrepEnumFileBase { int Enumerates( LPCWSTR lpBaseFolder, VGrepEnumKeys& vecKeys, CGrepEnumOptions& option, CGrepEnumFileBase* pExceptItems = NULL ){ int found = 0; + const auto cchBaseFolder = lpBaseFolder ? wcsnlen_s(lpBaseFolder, 4096 - 1) : 0; // FIXME: パス長の上限は暫定値。 for( int i = 0; i < (int)vecKeys.size(); i++ ){ - int baseLen = wcslen( lpBaseFolder ); + int baseLen = cchBaseFolder; LPWSTR lpPath = new WCHAR[ baseLen + wcslen( vecKeys[ i ] ) + 2 ]; if( NULL == lpPath ) break; wcscpy( lpPath, lpBaseFolder ); @@ -163,11 +164,11 @@ class CGrepEnumFileBase { if( IsValid( w32fd, lpName ) ){ if( pExceptItems && pExceptItems->IsExist( lpFullPath ) ){ }else{ - m_vpItems.push_back( PairGrepEnumItem( lpName, w32fd.nFileSizeLow ) ); + m_vpItems.emplace_back( lpName, w32fd.nFileSizeLow ); found++; // 2011.11.19 if( pExceptItems && nKeyDirLen ){ // フォルダーを含んだパスなら検索済みとして除外指定に追加する - pExceptItems->m_vpItems.push_back( PairGrepEnumItem( lpFullPath, w32fd.nFileSizeLow ) ); + pExceptItems->m_vpItems.emplace_back( lpFullPath, w32fd.nFileSizeLow ); }else{ delete [] lpFullPath; } diff --git a/sakura_core/CGrepEnumKeys.h b/sakura_core/CGrepEnumKeys.h index 798ff6456e..e697155e88 100644 --- a/sakura_core/CGrepEnumKeys.h +++ b/sakura_core/CGrepEnumKeys.h @@ -69,8 +69,8 @@ class CGrepEnumKeys { } // 除外ファイルの2つの解析済み配列から1つのリストを作る - auto GetExcludeFiles() const -> std::list { - std::list excludeFiles; + auto GetExcludeFiles() const -> std::vector { + std::vector excludeFiles; const auto& fileKeys = m_vecExceptFileKeys; excludeFiles.insert( excludeFiles.cend(), fileKeys.cbegin(), fileKeys.cend() ); const auto& absFileKeys = m_vecExceptAbsFileKeys; @@ -79,8 +79,8 @@ class CGrepEnumKeys { } // 除外フォルダーの2つの解析済み配列から1つのリストを作る - auto GetExcludeFolders() const -> std::list { - std::list excludeFolders; + auto GetExcludeFolders() const -> std::vector { + std::vector excludeFolders; const auto& folderKeys = m_vecExceptFolderKeys; excludeFolders.insert( excludeFolders.cend(), folderKeys.cbegin(), folderKeys.cend() ); const auto& absFolderKeys = m_vecExceptAbsFolderKeys; diff --git a/sakura_core/CProfile.cpp b/sakura_core/CProfile.cpp index 3c98157985..04dae91616 100644 --- a/sakura_core/CProfile.cpp +++ b/sakura_core/CProfile.cpp @@ -72,7 +72,7 @@ using namespace std; */ void CProfile::Init( void ) { - m_strProfileName = L""; + m_strProfileName.clear(); m_ProfileData.clear(); m_bRead = true; return; @@ -100,17 +100,17 @@ void CProfile::ReadOneline( // セクション取得 // Jan. 29, 2004 genta compare使用 if( line.compare( 0, 1, LTEXT("[") ) == 0 - && line.find( LTEXT("=") ) == line.npos - && line.find( LTEXT("]") ) == ( line.size() - 1 ) ) { + && line.find( LTEXT('=') ) == line.npos + && line.find( LTEXT(']') ) == ( line.size() - 1 ) ) { Section Buffer; Buffer.strSectionName = line.substr( 1, line.size() - 1 - 1 ); m_ProfileData.push_back( Buffer ); } // エントリ取得 else if( !m_ProfileData.empty() ) { //最初のセクション以前の行のエントリは無視 - wstring::size_type idx = line.find( LTEXT("=") ); + wstring::size_type idx = line.find( LTEXT('=') ); if( line.npos != idx ) { - m_ProfileData.back().mapEntries.insert( PAIR_STR_STR( line.substr(0,idx), line.substr(idx+1) ) ); + m_ProfileData.back().mapEntries.emplace( line.substr(0,idx), line.substr(idx+1) ); } } } @@ -247,7 +247,7 @@ bool CProfile::WriteProfile( std::vector< wstring > vecLine; if( NULL != pszComment ) { - vecLine.push_back( LTEXT(";") + wstring( pszComment ) ); // //->; 2008/5/24 Uchi + vecLine.emplace_back( LTEXT(";") + wstring( pszComment ) ); // //->; 2008/5/24 Uchi vecLine.push_back( LTEXT("") ); } for(auto iter = m_ProfileData.cbegin(); iter != m_ProfileData.cend(); iter++ ) { diff --git a/sakura_core/CProfile.h b/sakura_core/CProfile.h index b075f8476f..ad86b29555 100644 --- a/sakura_core/CProfile.h +++ b/sakura_core/CProfile.h @@ -54,7 +54,6 @@ class CProfile typedef std::wstring wstring; typedef std::string string; - typedef std::pair< wstring, wstring > PAIR_STR_STR; typedef std::map< wstring, wstring > MAP_STR_STR; struct Section { diff --git a/sakura_core/CPropertyManager.cpp b/sakura_core/CPropertyManager.cpp index c056fa02a5..0b495b14db 100644 --- a/sakura_core/CPropertyManager.cpp +++ b/sakura_core/CPropertyManager.cpp @@ -111,7 +111,7 @@ bool CPropertyManager::OpenPropertySheetTypes( HWND hWnd, int nPageNum, CTypeCon CPropTypes* pcPropTypes = new CPropTypes(); pcPropTypes->Create( G_AppInstance(), m_hwndOwner ); - std::unique_ptr pType(new STypeConfig()); + auto pType = std::make_unique(); CDocTypeManager().GetTypeConfig(nSettingType, *pType); pcPropTypes->SetTypeData(*pType); // Mar. 31, 2003 genta メモリ削減のためポインタに変更しProperySheet内で取得するように diff --git a/sakura_core/CSelectLang.h b/sakura_core/CSelectLang.h index 3f003a5f00..3d83e1c6be 100644 --- a/sakura_core/CSelectLang.h +++ b/sakura_core/CSelectLang.h @@ -130,9 +130,9 @@ class CLoadString /* || Constructors */ - CLoadString(){} + CLoadString() = default; CLoadString( UINT uid ){ LoadString( uid ); } // 文字列読み込み付きコンストラクタ - /*virtual*/ ~CLoadString(){} + /*virtual*/ ~CLoadString() = default; /* || Attributes & Operations diff --git a/sakura_core/_main/CControlTray.cpp b/sakura_core/_main/CControlTray.cpp index 6132f84002..15a774e755 100644 --- a/sakura_core/_main/CControlTray.cpp +++ b/sakura_core/_main/CControlTray.cpp @@ -815,7 +815,7 @@ LRESULT CControlTray::DispatchEvent( int iBitmap = CMenuDrawer::TOOLBAR_ICON_PLUGCOMMAND_DEFAULT - 1; const CPlug* plug = *it; if( !plug->m_sIcon.empty() ){ - iBitmap = m_cMenuDrawer.m_pcIcons->Add( plug->m_cPlugin.GetFilePath( plug->m_sIcon.c_str() ).c_str() ); + iBitmap = m_cMenuDrawer.m_pcIcons->Add( plug->m_cPlugin.GetFilePath( plug->m_sIcon ).c_str() ); } m_cMenuDrawer.AddToolButton( iBitmap, plug->GetFunctionCode() ); } diff --git a/sakura_core/basis/CMySize.h b/sakura_core/basis/CMySize.h index 3f73ecadf4..dab1fe8d26 100644 --- a/sakura_core/basis/CMySize.h +++ b/sakura_core/basis/CMySize.h @@ -32,7 +32,7 @@ class CMySize : public SIZE{ public: //コンストラクタ・デストラクタ - CMySize(){} //※初期化なし + CMySize() : CMySize(0, 0) {} CMySize(int _cx,int _cy){ cx=_cx; cy=_cy; } CMySize(const SIZE& rhs){ cx=rhs.cx; cy=rhs.cy; } diff --git a/sakura_core/basis/CStrictRange.h b/sakura_core/basis/CStrictRange.h index 7093c989e9..fbb0928718 100644 --- a/sakura_core/basis/CStrictRange.h +++ b/sakura_core/basis/CStrictRange.h @@ -41,9 +41,8 @@ class CRangeBase{ CRangeBase(Me&&) noexcept = default; Me& operator = (Me&&) noexcept = default; CRangeBase(const PointType& _ptFrom,const PointType& _ptTo) + : m_ptFrom(_ptFrom), m_ptTo(_ptTo) { - m_ptFrom=_ptFrom; - m_ptTo=_ptTo; } ~CRangeBase() = default; diff --git a/sakura_core/charset/CCodePage.cpp b/sakura_core/charset/CCodePage.cpp index 6e836564d2..4420c7cef3 100644 --- a/sakura_core/charset/CCodePage.cpp +++ b/sakura_core/charset/CCodePage.cpp @@ -394,8 +394,8 @@ CCodePage::CodePageList& CCodePage::GetCodePageList() } } // 独自実装部分を定義 - result.push_back( CCodePage::CodePageList::value_type(12000, L"12000 (UTF-32LE)") ); - result.push_back( CCodePage::CodePageList::value_type(12001, L"12001 (UTF-32BE)") ); + result.emplace_back( 12000, L"12000 (UTF-32LE)" ); + result.emplace_back( 12001, L"12001 (UTF-32BE)" ); std::sort(result.begin(),result.end(), sortByCodePage()); return result; diff --git a/sakura_core/cmd/CViewCommander_Bookmark.cpp b/sakura_core/cmd/CViewCommander_Bookmark.cpp index 0775619a6c..dcbffd246c 100644 --- a/sakura_core/cmd/CViewCommander_Bookmark.cpp +++ b/sakura_core/cmd/CViewCommander_Bookmark.cpp @@ -268,14 +268,18 @@ void CViewCommander::Command_BOOKMARK_SET(void) ); for(CLogicInt nY=ptFrom.GetY2();nY<=ptTo.y;nY++){ pCDocLine=GetDocument()->m_cDocLineMgr.GetLine( nY ); - CBookmarkSetter cBookmark(pCDocLine); - if(pCDocLine)cBookmark.SetBookmark(!cBookmark.IsBookmarked()); + if(pCDocLine){ + CBookmarkSetter cBookmark(pCDocLine); + cBookmark.SetBookmark(!cBookmark.IsBookmarked()); + } } } else{ pCDocLine=GetDocument()->m_cDocLineMgr.GetLine( GetCaret().GetCaretLogicPos().GetY2() ); - CBookmarkSetter cBookmark(pCDocLine); - if(pCDocLine)cBookmark.SetBookmark(!cBookmark.IsBookmarked()); + if(pCDocLine){ + CBookmarkSetter cBookmark(pCDocLine); + cBookmark.SetBookmark(!cBookmark.IsBookmarked()); + } } // 2002.01.16 hor 分割したビューも更新 diff --git a/sakura_core/cmd/CViewCommander_File.cpp b/sakura_core/cmd/CViewCommander_File.cpp index 2b74ada4cf..178fe24387 100644 --- a/sakura_core/cmd/CViewCommander_File.cpp +++ b/sakura_core/cmd/CViewCommander_File.cpp @@ -110,10 +110,10 @@ void CViewCommander::Command_FILEOPEN( const WCHAR* filename, ECodeType nCharCod //ロード情報 SLoadInfo sLoadInfo(filename?filename:L"", nCharCode, bViewMode); std::vector files; - std::wstring defName = (defaultName ? defaultName : L""); //必要であれば「ファイルを開く」ダイアログ if(!sLoadInfo.cFilePath.IsValidPath()){ + std::wstring defName = (defaultName ? defaultName : L""); if( !defName.empty() ){ WCHAR szPath[_MAX_PATH]; WCHAR szDir[_MAX_DIR]; @@ -693,8 +693,6 @@ BOOL CViewCommander::Command_PUTFILE( { /* 選択範囲を出力 */ try { - CBinaryOutputStream out(filename,true); - // 選択範囲の取得 -> cMem CNativeW cMem; m_pCommanderView->GetSelectedDataSimple(cMem); @@ -719,8 +717,10 @@ BOOL CViewCommander::Command_PUTFILE( pcSaveCode->UnicodeToCode(*pConvBuffer, &cDst); //書込 - if( 0 < cDst.GetRawLength() ) - out.Write(cDst.GetRawPtr(),cDst.GetRawLength()); + if( 0 < cDst.GetRawLength() ){ + CBinaryOutputStream out(filename, true); + out.Write(cDst.GetRawPtr(), cDst.GetRawLength()); + } } catch(const CError_FileOpen&) { diff --git a/sakura_core/cmd/CViewCommander_Grep.cpp b/sakura_core/cmd/CViewCommander_Grep.cpp index 9761adca6b..7db4b7383d 100644 --- a/sakura_core/cmd/CViewCommander_Grep.cpp +++ b/sakura_core/cmd/CViewCommander_Grep.cpp @@ -250,7 +250,7 @@ void CViewCommander::Command_GREP_REPLACE( void ) if( cDlgGrepRep.m_bGrepSeparateFolder )wcscat( pOpt, L"D" ); if( cDlgGrepRep.m_bPaste )wcscat( pOpt, L"C" ); // クリップボードから貼り付け if( cDlgGrepRep.m_bBackup )wcscat( pOpt, L"O" ); // バックアップ作成 - if( 0 < wcslen( pOpt ) ){ + if( pOpt[0] ) { cCmdLine.AppendString( L" -GOPT=" ); cCmdLine.AppendString( pOpt ); } diff --git a/sakura_core/cmd/CViewCommander_Search.cpp b/sakura_core/cmd/CViewCommander_Search.cpp index 7a204fa102..65d9ed2c01 100644 --- a/sakura_core/cmd/CViewCommander_Search.cpp +++ b/sakura_core/cmd/CViewCommander_Search.cpp @@ -657,7 +657,7 @@ void CViewCommander::Command_REPLACE( HWND hwndParent ) cMemRepKey2 = cMemRepKey; cMemRepKey2 += cMemMatchStr; } else if (nReplaceTarget == 2) { // 選択終点へ挿入 - cMemRepKey2 = cMemMatchStr; + cMemRepKey2 = std::move(cMemMatchStr); cMemRepKey2 += cMemRepKey; } else { cMemRepKey2 = cMemRepKey; @@ -966,10 +966,10 @@ void CViewCommander::Command_REPLACE_ALL() cMemRepKey2 = cmemClip; cMemRepKey2 += cMemMatchStr; } else if (nReplaceTarget == 2) { // 選択終点へ挿入 - cMemRepKey2 = cMemMatchStr; + cMemRepKey2 = std::move(cMemMatchStr); cMemRepKey2 += cmemClip; } else { - cMemRepKey2 = cmemClip; + cMemRepKey2 = std::move(cmemClip); } // 正規表現オプションの設定2006.04.01 かろと int nFlag = (m_pCommanderView->m_sCurSearchOption.bLoHiCase ? CBregexp::optCaseSensitive : CBregexp::optNothing); @@ -1094,8 +1094,8 @@ void CViewCommander::Command_REPLACE_ALL() out = left < right && (...) というのがまさに対応を迫られた痕跡ですよ。 */ const CLayoutInt firstLeft = ptNewFrom.x - raggedLeftDiff; - const CLogicInt lastRight = (Int)ptNew.x - colDif; if (ptNewFrom.y == ptNew.y) { // 一番よくあるケースではレイアウトの取得・計算が不要。 + const CLogicInt lastRight = (Int)ptNew.x - colDif; out = firstLeft < sRangeA.GetFrom().x || boxRight.x < lastRight; } else { for (CLayoutInt ll = ptNewFrom.y; ll <= ptNew.y; ++ll) { // ll = Layout Line diff --git a/sakura_core/cmd/CViewCommander_TagJump.cpp b/sakura_core/cmd/CViewCommander_TagJump.cpp index da72712da7..6e54bacc98 100644 --- a/sakura_core/cmd/CViewCommander_TagJump.cpp +++ b/sakura_core/cmd/CViewCommander_TagJump.cpp @@ -46,7 +46,7 @@ static bool GetQuoteFilePath(const wchar_t* pLine, std::wstring& str, size_t size) { const wchar_t* pFileEnd = wcschr( pLine, L'\"' ); - str = L""; + str.clear(); if (pFileEnd == nullptr) { return false; } @@ -74,7 +74,7 @@ static bool IsFileExists2( const wchar_t* pszFile ) static bool IsHWNDTag( const wchar_t* pLine, std::wstring& str, int* pnLen = NULL ) { if( 0 == wcsncmp(pLine, L":HWND:[", 7) ){ - const wchar_t* pFileEnd = wcsstr( pLine, L"]" ); + const wchar_t* pFileEnd = wcschr( pLine, L']' ); if( pFileEnd ){ const int nLen = pFileEnd - pLine + 1; int i = 7; @@ -390,7 +390,7 @@ bool CViewCommander::Command_TagJumpNoMessage( bool bClose ) break; } // 相対パスだった→◎”を探す - strFile = strPath; + strFile = std::move(strPath); searchMode = TAGLIST_ROOT; continue; } @@ -404,7 +404,7 @@ bool CViewCommander::Command_TagJumpNoMessage( bool bClose ) break; } if (IsFileExists2(strPath.c_str())) { - strJumpToFile = strPath; + strJumpToFile = std::move(strPath); break; } } diff --git a/sakura_core/dlg/CDlgAbout.cpp b/sakura_core/dlg/CDlgAbout.cpp index 5fad824420..d735db8ab0 100644 --- a/sakura_core/dlg/CDlgAbout.cpp +++ b/sakura_core/dlg/CDlgAbout.cpp @@ -241,7 +241,7 @@ BOOL CDlgAbout::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam ) // 2011.06.01 nasukoji 各国語メッセージリソース対応 LPCWSTR pszDesc = LS( IDS_ABOUT_DESCRIPTION ); WCHAR szMsg[2048]; - if( wcslen(pszDesc) > 0 ){ + if( pszDesc[0] != '\0' ) { wcsncpy( szMsg, pszDesc, _countof(szMsg) - 1 ); szMsg[_countof(szMsg) - 1] = 0; ::DlgItem_SetText( GetHwnd(), IDC_EDIT_ABOUT, szMsg ); diff --git a/sakura_core/dlg/CDlgGrep.cpp b/sakura_core/dlg/CDlgGrep.cpp index 7bdcf03c70..3c8bd1b625 100644 --- a/sakura_core/dlg/CDlgGrep.cpp +++ b/sakura_core/dlg/CDlgGrep.cpp @@ -847,7 +847,7 @@ int CDlgGrep::GetData( void ) m_pShareData->m_Common.m_sSearch.m_bGrepOutputBaseFolder = m_bGrepOutputBaseFolder; m_pShareData->m_Common.m_sSearch.m_bGrepSeparateFolder = m_bGrepSeparateFolder; - if( 0 != wcslen( m_szFile ) ){ + if( m_szFile[0] != '\0' ) { CGrepEnumKeys enumKeys; int nErrorNo = enumKeys.SetFileKeys( m_szFile ); if( 1 == nErrorNo ){ diff --git a/sakura_core/dlg/CDlgOpenFile.cpp b/sakura_core/dlg/CDlgOpenFile.cpp index 2dfdc64f8b..9a83b7bfb7 100644 --- a/sakura_core/dlg/CDlgOpenFile.cpp +++ b/sakura_core/dlg/CDlgOpenFile.cpp @@ -25,9 +25,7 @@ extern std::shared_ptr New_CDlgOpenFile_CommonFileDialog(); extern std::shared_ptr New_CDlgOpenFile_CommonItemDialog(); -CDlgOpenFile::CDlgOpenFile() -{ -} +CDlgOpenFile::CDlgOpenFile() = default; void CDlgOpenFile::Create( HINSTANCE hInstance, diff --git a/sakura_core/dlg/CDlgOpenFile.h b/sakura_core/dlg/CDlgOpenFile.h index 1a6d6993ef..a3352fb54d 100644 --- a/sakura_core/dlg/CDlgOpenFile.h +++ b/sakura_core/dlg/CDlgOpenFile.h @@ -91,7 +91,7 @@ class CDlgOpenFile final : public IDlgOpenFile public: //コンストラクタ・デストラクタ CDlgOpenFile(); - ~CDlgOpenFile() {} + ~CDlgOpenFile() = default; void Create( HINSTANCE hInstance, diff --git a/sakura_core/dlg/CDlgOpenFile_CommonFileDialog.cpp b/sakura_core/dlg/CDlgOpenFile_CommonFileDialog.cpp index f86b9e1226..4e9c2d87f0 100644 --- a/sakura_core/dlg/CDlgOpenFile_CommonFileDialog.cpp +++ b/sakura_core/dlg/CDlgOpenFile_CommonFileDialog.cpp @@ -742,7 +742,7 @@ bool CDlgOpenFile_CommonFileDialog::DoModal_GetOpenFileName( WCHAR* pszPath, EFi } /* 構造体の初期化 */ - std::unique_ptr pData( new CDlgOpenFileData() ); + auto pData = std::make_unique(); InitOfn( &pData->m_ofn ); // 2005.10.29 ryoji pData->m_pcDlgOpenFile = this; pData->m_ofn.lCustData = (LPARAM)(pData.get()); @@ -827,7 +827,7 @@ bool CDlgOpenFile_CommonFileDialog::DoModal_GetSaveFileName( WCHAR* pszPath ) } /* 構造体の初期化 */ - std::unique_ptr pData( new CDlgOpenFileData() ); + auto pData = std::make_unique(); InitOfn( &pData->m_ofn ); // 2005.10.29 ryoji pData->m_pcDlgOpenFile = this; pData->m_ofn.lCustData = (LPARAM)(pData.get()); @@ -865,7 +865,7 @@ bool CDlgOpenFile_CommonFileDialog::DoModalOpenDlg( bool bOptions ) { - std::unique_ptr pData( new CDlgOpenFileData() ); + auto pData = std::make_unique(); pData->m_bIsSaveDialog = FALSE; /* 保存のダイアログか */ bool bMultiSelect = pFileNames != NULL; @@ -971,7 +971,7 @@ bool CDlgOpenFile_CommonFileDialog::DoModalSaveDlg( bool bSimpleMode ) { - std::unique_ptr pData( new CDlgOpenFileData() ); + auto pData = std::make_unique(); pData->m_bIsSaveDialog = TRUE; /* 保存のダイアログか */ // 2003.05.12 MIK diff --git a/sakura_core/dlg/CDlgOpenFile_CommonItemDialog.cpp b/sakura_core/dlg/CDlgOpenFile_CommonItemDialog.cpp index 81e4d6b6a0..3b17bf27c9 100644 --- a/sakura_core/dlg/CDlgOpenFile_CommonItemDialog.cpp +++ b/sakura_core/dlg/CDlgOpenFile_CommonItemDialog.cpp @@ -462,6 +462,7 @@ bool CDlgOpenFile_CommonItemDialog::DoModal_GetOpenFileName( WCHAR* pszPath, EFi { // 2003.05.12 MIK std::vector specs; + specs.reserve(7); std::vector strs; strs.reserve(8); diff --git a/sakura_core/dlg/CDlgPluginOption.cpp b/sakura_core/dlg/CDlgPluginOption.cpp index d188b5f33c..0745d7b49f 100644 --- a/sakura_core/dlg/CDlgPluginOption.cpp +++ b/sakura_core/dlg/CDlgPluginOption.cpp @@ -47,6 +47,8 @@ #define BOOL_DISP_TRUE L"\u2611" #define BOOL_DISP_FALSE L"\u2610" +using namespace std::string_literals; + // 編集領域を表示、非表示にする static inline void CtrlShow(HWND hwndDlg, int id, BOOL bShow) { @@ -119,7 +121,7 @@ void CDlgPluginOption::SetData( void ) ListView_DeleteAllItems( hwndList ); // リストを空にする m_Line = -1; // 行非選択 - std::unique_ptr cProfile( new CDataProfile ); + auto cProfile = std::make_unique(); cProfile->SetReadingMode(); cProfile->ReadProfile( m_cPlugin->GetOptionPath().c_str() ); @@ -139,17 +141,16 @@ void CDlgPluginOption::SetData( void ) wstring sSection; wstring sKey; wstring sValue; - wstring sType; cOpt->GetKey(&sSection, &sKey); if( sSection.empty() || sKey.empty() ) { - sValue = L""; + sValue.clear(); } else { if( !cProfile->IOProfileData( sSection.c_str(), sKey.c_str(), sValue ) ){ // Optionが見つからなかったらDefault値を設定 sValue = cOpt->GetDefaultVal(); - if( sValue != wstring(L"") ){ + if( sValue.length() ){ bLoadDefault = true; cProfile->SetWritingMode(); cProfile->IOProfileData( sSection.c_str(), sKey.c_str(), sValue ); @@ -159,7 +160,7 @@ void CDlgPluginOption::SetData( void ) } if (cOpt->GetType() == OPTION_TYPE_BOOL) { - wcscpy( buf, sValue == wstring( L"0") || sValue == wstring( L"") ? BOOL_DISP_FALSE : BOOL_DISP_TRUE ); + wcscpy_s( buf, sValue == L"0"s || sValue.empty() ? BOOL_DISP_FALSE : BOOL_DISP_TRUE ); } else if (cOpt->GetType() == OPTION_TYPE_INT) { // 数値へ正規化 @@ -223,7 +224,7 @@ int CDlgPluginOption::GetData( void ) // リスト hwndList = GetItemHwnd( IDC_LIST_PLUGIN_OPTIONS ); - std::unique_ptr cProfile( new CDataProfile ); + auto cProfile = std::make_unique(); cProfile->SetReadingMode(); cProfile->ReadProfile( m_cPlugin->GetOptionPath().c_str() ); cProfile->SetWritingMode(); diff --git a/sakura_core/dlg/CDlgProfileMgr.cpp b/sakura_core/dlg/CDlgProfileMgr.cpp index 4b45aeb92a..cccdfbac3d 100644 --- a/sakura_core/dlg/CDlgProfileMgr.cpp +++ b/sakura_core/dlg/CDlgProfileMgr.cpp @@ -203,7 +203,7 @@ int CDlgProfileMgr::GetData(bool bStart) MyList_GetText( hwndList, nCurIndex, szText ); m_strProfileName = szText; if( m_strProfileName == L"(default)" ){ - m_strProfileName = L""; + m_strProfileName.clear(); } bool bDefaultSelect = IsDlgButtonCheckedBool( GetHwnd(), IDC_CHECK_PROF_DEFSTART ); SProfileSettings settings; diff --git a/sakura_core/dlg/CDlgReplace.cpp b/sakura_core/dlg/CDlgReplace.cpp index 1b6040c7c4..945e16637b 100644 --- a/sakura_core/dlg/CDlgReplace.cpp +++ b/sakura_core/dlg/CDlgReplace.cpp @@ -245,7 +245,7 @@ int CDlgReplace::GetData( void ) /* 置換後文字列 */ if( ::IsDlgButtonChecked( GetHwnd(), IDC_RADIO_LINEDELETE ) ){ - m_strText2 = L""; + m_strText2.clear(); }else{ ApiWrap::DlgItem_GetText( GetHwnd(), IDC_COMBO_TEXT2, m_strText2 ); } diff --git a/sakura_core/dlg/CDlgTagJumpList.cpp b/sakura_core/dlg/CDlgTagJumpList.cpp index 6e5c69abed..2866ac55f1 100644 --- a/sakura_core/dlg/CDlgTagJumpList.cpp +++ b/sakura_core/dlg/CDlgTagJumpList.cpp @@ -887,7 +887,7 @@ int CDlgTagJumpList::SearchBestTag( void ) if( m_pcList->GetCount() <= 0 ) return -1; //選べません。 if( NULL == m_pszFileName ) return 0; - std::unique_ptr mem_lpPathInfo( new TagPathInfo ); + auto mem_lpPathInfo = std::make_unique(); TagPathInfo* lpPathInfo= mem_lpPathInfo.get(); int nMatch1 = -1; int nMatch2 = -1; diff --git a/sakura_core/doc/CDocFileOperation.cpp b/sakura_core/doc/CDocFileOperation.cpp index 9cd51c6f0d..7bba39dc4d 100644 --- a/sakura_core/doc/CDocFileOperation.cpp +++ b/sakura_core/doc/CDocFileOperation.cpp @@ -179,8 +179,6 @@ void CDocFileOperation::ReloadCurrentFile( } //カーソル位置保存 - CLayoutInt nViewTopLine = GetEditWnd().GetActiveView().GetTextArea().GetViewTopLine(); /* 表示域の一番上の行(0開始) */ - CLayoutInt nViewLeftCol = GetEditWnd().GetActiveView().GetTextArea().GetViewLeftCol(); /* 表示域の一番左の桁(0開始) */ CLayoutPoint ptCaretPosXY = GetEditWnd().GetActiveView().GetCaret().GetCaretLayoutPos(); //ロード @@ -195,6 +193,8 @@ void CDocFileOperation::ReloadCurrentFile( // カーソル位置復元 (※ここではオプションのカーソル位置復元(=改行単位)が指定されていない場合でも復元する) // 2007.08.23 ryoji 表示領域復元 if( ptCaretPosXY.GetY2() < m_pcDocRef->m_cLayoutMgr.GetLineCount() ){ + CLayoutInt nViewTopLine = GetEditWnd().GetActiveView().GetTextArea().GetViewTopLine(); /* 表示域の一番上の行(0開始) */ + CLayoutInt nViewLeftCol = GetEditWnd().GetActiveView().GetTextArea().GetViewLeftCol(); /* 表示域の一番左の桁(0開始) */ GetEditWnd().GetActiveView().GetTextArea().SetViewTopLine(nViewTopLine); GetEditWnd().GetActiveView().GetTextArea().SetViewLeftCol(nViewLeftCol); } diff --git a/sakura_core/doc/CDocOutline.cpp b/sakura_core/doc/CDocOutline.cpp index 50d8984ea1..242d587525 100644 --- a/sakura_core/doc/CDocOutline.cpp +++ b/sakura_core/doc/CDocOutline.cpp @@ -74,7 +74,7 @@ int CDocOutline::ReadRuleFile( const WCHAR* pszFilename, SOneRule* pcOneRule, in int nCount = 0; bRegex = false; bool bRegexReplace = false; - title = L""; + title.clear(); int regexOption = CBregexp::optCaseSensitive; // 通常モード @@ -226,7 +226,7 @@ void CDocOutline::MakeFuncList_RuleFile( CFuncInfoArr* pcFuncInfoArr, std::wstri return; } if( 0 < title.size() ){ - sTitleOverride = title.c_str(); + sTitleOverride = title; } /* ネストの深さは、32レベルまで、ひとつのヘッダーは、最長256文字まで区別 diff --git a/sakura_core/doc/logic/CDocLine.cpp b/sakura_core/doc/logic/CDocLine.cpp index 2725e642e8..e98c85e3a6 100644 --- a/sakura_core/doc/logic/CDocLine.cpp +++ b/sakura_core/doc/logic/CDocLine.cpp @@ -22,9 +22,7 @@ CDocLine::CDocLine() { } -CDocLine::~CDocLine() -{ -} +CDocLine::~CDocLine() = default; /* 空行(スペース、タブ、改行記号のみの行)かどうかを取得する true:空行だ。 diff --git a/sakura_core/docplus/CDiffManager.h b/sakura_core/docplus/CDiffManager.h index 1c4324dd09..c3cea8bc9a 100644 --- a/sakura_core/docplus/CDiffManager.h +++ b/sakura_core/docplus/CDiffManager.h @@ -50,7 +50,7 @@ enum EDiffMark : char { //! DIFF挙動の管理 class CDiffManager : public TSingleton{ friend class TSingleton; - CDiffManager(){} + CDiffManager() = default; public: void SetDiffUse(bool b){ m_bIsDiffUse = b; } diff --git a/sakura_core/env/CSakuraEnvironment.cpp b/sakura_core/env/CSakuraEnvironment.cpp index a8472a4474..6d40be997b 100644 --- a/sakura_core/env/CSakuraEnvironment.cpp +++ b/sakura_core/env/CSakuraEnvironment.cpp @@ -715,7 +715,7 @@ std::wstring CSakuraEnvironment::GetDlgInitialDir(bool bControlProcess) { CEditDoc* pcDoc = CEditDoc::GetInstance(0); //###### if( pcDoc && pcDoc->m_cDocFile.GetFilePathClass().IsValidPath() ){ - return pcDoc->m_cDocFile.GetFilePathClass().GetDirPath().c_str(); + return pcDoc->m_cDocFile.GetFilePathClass().GetDirPath(); } EOpenDialogDir eOpenDialogDir = GetDllShareData().m_Common.m_sEdit.m_eOpenDialogDir; diff --git a/sakura_core/env/CommonSetting.cpp b/sakura_core/env/CommonSetting.cpp index 2726d412ac..67cd094cac 100644 --- a/sakura_core/env/CommonSetting.cpp +++ b/sakura_core/env/CommonSetting.cpp @@ -79,9 +79,7 @@ class CommonValue{ private: typedef CommonValue Me; public: - CommonValue() - { - } + CommonValue() = default; void Regist(const char* szEntryKey) { //CommonValueリストに自分を追加 diff --git a/sakura_core/extmodule/CBregexp.cpp b/sakura_core/extmodule/CBregexp.cpp index fcfe140e86..0b4d12fd1f 100644 --- a/sakura_core/extmodule/CBregexp.cpp +++ b/sakura_core/extmodule/CBregexp.cpp @@ -231,18 +231,18 @@ wchar_t* CBregexp::MakePattern( const wchar_t* szPattern, const wchar_t* szPatte { using namespace WCODE; static const wchar_t* szCRLF = CRLF; //!< 復帰・改行 - static const wchar_t szCR[] = {CR,0}; //!< 復帰 - static const wchar_t szLF[] = {LF,0}; //!< 改行 + static const wchar_t szCR[] = {CR,0}; //!< 復帰 + static const wchar_t szLF[] = {LF,0}; //!< 改行 static const wchar_t BOT_SUBST[] = L"s/\\$(\\)*)$/([\\\\r\\\\n]+)\\$$1/k"; //!< 行末パターンの置換用パターン int nLen; //!< szPatternの長さ BREGEXP_W* sReg = NULL; //!< コンパイル構造体 - wchar_t szMsg[80] = L""; //!< エラーメッセージ - wchar_t szAdd2[5] = L""; //!< 行末あり置換の $数字 格納用 + wchar_t szAdd2[5] = {}; //!< 行末あり置換の $数字 格納用 int nParens = 0; //!< 検索パターン(szPattern)中の括弧の数(行末時に使用) - wchar_t *szNPattern; //!< 検索パターン + wchar_t *szNPattern; //!< 検索パターン nLen = CheckPattern( szPattern ); if( (m_ePatType & PAT_BOTTOM) != 0 ) { + wchar_t szMsg[80] = {}; //!< エラーメッセージ bool bJustDollar = false; // 行末指定の$のみであるフラグ($の前に \r\nが指定されていない) szNPattern = MakePatternSub(szPattern, NULL, NULL, nOption); int matched = BMatch( szNPattern, szCRLF, szCRLF+wcslen(szCRLF), &sReg, szMsg ); diff --git a/sakura_core/extmodule/CDllHandler.cpp b/sakura_core/extmodule/CDllHandler.cpp index 5344e667ce..53b29ce32b 100644 --- a/sakura_core/extmodule/CDllHandler.cpp +++ b/sakura_core/extmodule/CDllHandler.cpp @@ -138,7 +138,7 @@ bool CDllImp::DeinitDll(bool force) noexcept //DLL解放 if( ret || force ){ //DLL名を解放 - m_strLoadedDllName = L""; + m_strLoadedDllName.clear(); //DLL解放 ::FreeLibrary( m_hInstance ); diff --git a/sakura_core/io/CFileLoad.cpp b/sakura_core/io/CFileLoad.cpp index 8bdf8d281c..d4c7112dd0 100644 --- a/sakura_core/io/CFileLoad.cpp +++ b/sakura_core/io/CFileLoad.cpp @@ -407,7 +407,7 @@ EConvertResult CFileLoad::ReadLine_core( if( m_bBomExist && 1 <= pUnicodeBuffer->GetStringLength() ){ if( pUnicodeBuffer->GetStringPtr()[0] == 0xfeff ){ CNativeW tmp(pUnicodeBuffer->GetStringPtr() + 1, pUnicodeBuffer->GetStringLength() - 1); - *pUnicodeBuffer = tmp; + *pUnicodeBuffer = std::move(tmp); } } } diff --git a/sakura_core/io/CZipFile.cpp b/sakura_core/io/CZipFile.cpp index a4a6f43e53..26308230c9 100644 --- a/sakura_core/io/CZipFile.cpp +++ b/sakura_core/io/CZipFile.cpp @@ -86,7 +86,7 @@ bool CZipFile::ChkPluginDef(const std::wstring& sDefFile, std::wstring& sFolderN long lCount; bool bFoundDef = false; - sFolderName = L""; + sFolderName.clear(); // ZIP File List hr = pZipFile->Items(&pZipFileItems); diff --git a/sakura_core/macro/CIfObj.h b/sakura_core/macro/CIfObj.h index 1a11cc1d31..92334f15de 100644 --- a/sakura_core/macro/CIfObj.h +++ b/sakura_core/macro/CIfObj.h @@ -59,7 +59,7 @@ class ImplementsIUnknown: public Base virtual ULONG STDMETHODCALLTYPE Release() { -- m_RefCount; int R = m_RefCount; if(m_RefCount == 0) delete this; return R; } public: ImplementsIUnknown(): m_RefCount(0) {} - virtual ~ImplementsIUnknown(){} + virtual ~ImplementsIUnknown() = default; }; //WSH一般 diff --git a/sakura_core/macro/CMacro.cpp b/sakura_core/macro/CMacro.cpp index 8a2f2fc1c5..70491f794a 100644 --- a/sakura_core/macro/CMacro.cpp +++ b/sakura_core/macro/CMacro.cpp @@ -800,7 +800,7 @@ bool CMacro::HandleCommand( if( bBackupFlag ){ GetDllShareData().m_Common.m_sSearch = backupFlags; pcEditView->m_sCurSearchOption = backupLocalFlags; - pcEditView->m_strCurSearchKey = backupStr; + pcEditView->m_strCurSearchKey = std::move(backupStr); pcEditView->m_bCurSearchUpdate = true; pcEditView->m_nCurSearchKeySequence = GetDllShareData().m_Common.m_sSearch.m_nSearchKeySequence; pcEditView->ChangeCurRegexp( backupKeyMark ); @@ -1004,9 +1004,9 @@ bool CMacro::HandleCommand( if( bBackupFlag ){ GetDllShareData().m_Common.m_sSearch = backupFlags; pcEditView->m_sCurSearchOption = backupLocalFlags; - pcEditView->m_strCurSearchKey = backupStr; + pcEditView->m_strCurSearchKey = std::move(backupStr); pcEditView->m_bCurSearchUpdate = true; - cDlgReplace.m_strText2 = backupStrRep; + cDlgReplace.m_strText2 = std::move(backupStrRep); pcEditView->m_nCurSearchKeySequence = GetDllShareData().m_Common.m_sSearch.m_nSearchKeySequence; pcEditView->ChangeCurRegexp( backupKeyMark ); pcEditView->m_bCurSrchKeyMark = backupKeyMark; diff --git a/sakura_core/macro/CMacroFactory.cpp b/sakura_core/macro/CMacroFactory.cpp index fb85b32718..1ec219bded 100644 --- a/sakura_core/macro/CMacroFactory.cpp +++ b/sakura_core/macro/CMacroFactory.cpp @@ -36,8 +36,7 @@ static const WCHAR NULSTR[] = L""; -CMacroFactory::CMacroFactory() -{} +CMacroFactory::CMacroFactory() = default; /*! 与えられた拡張子をmapのkeyに変換する diff --git a/sakura_core/macro/CSMacroMgr.cpp b/sakura_core/macro/CSMacroMgr.cpp index 7c93c0eac7..5a20694f40 100644 --- a/sakura_core/macro/CSMacroMgr.cpp +++ b/sakura_core/macro/CSMacroMgr.cpp @@ -676,7 +676,7 @@ BOOL CSMacroMgr::Load( int idx, HINSTANCE hInstance, const WCHAR* pszPath, const ext = pszType; } - m_sMacroPath = L""; + m_sMacroPath.clear(); *ppMacro = CMacroFactory::getInstance()->Create(ext); if( *ppMacro == NULL ) return FALSE; diff --git a/sakura_core/macro/CSMacroMgr.h b/sakura_core/macro/CSMacroMgr.h index e25b66de50..1dc6652893 100644 --- a/sakura_core/macro/CSMacroMgr.h +++ b/sakura_core/macro/CSMacroMgr.h @@ -130,7 +130,7 @@ class CSMacroMgr { return ( 0 <= idx && idx < MAX_CUSTMACRO ) ? m_pShareData->m_Common.m_sMacro.m_MacroTable[idx].m_szFile : - ( (idx == STAND_KEYMACRO || idx == TEMP_KEYMACRO) && m_sMacroPath != L"" ) ? + ( (idx == STAND_KEYMACRO || idx == TEMP_KEYMACRO) && m_sMacroPath.length() ) ? m_sMacroPath.c_str() : NULL; } diff --git a/sakura_core/macro/CWSHManager.cpp b/sakura_core/macro/CWSHManager.cpp index ee811dd6e5..b330ebeb60 100644 --- a/sakura_core/macro/CWSHManager.cpp +++ b/sakura_core/macro/CWSHManager.cpp @@ -92,7 +92,7 @@ bool CWSHMacroManager::ExecKeyMacro(CEditView *EditView, int flags) const BOOL CWSHMacroManager::LoadKeyMacro(HINSTANCE hInstance, const WCHAR* pszPath) { //ソース読み込み -> m_Source - m_Source=L""; + m_Source.clear(); CTextInputStream in(pszPath); if(!in) diff --git a/sakura_core/outline/CDlgFuncList.cpp b/sakura_core/outline/CDlgFuncList.cpp index 0a3e1c3663..7b4b5dca09 100644 --- a/sakura_core/outline/CDlgFuncList.cpp +++ b/sakura_core/outline/CDlgFuncList.cpp @@ -762,7 +762,7 @@ void CDlgFuncList::SetData() bool CDlgFuncList::GetTreeFileFullName(HWND hwndTree, HTREEITEM target, std::wstring* pPath, int* pnItem) { - *pPath = L""; + (*pPath).clear(); *pnItem = -1; do{ TVITEM tvItem; @@ -777,7 +777,7 @@ bool CDlgFuncList::GetTreeFileFullName(HWND hwndTree, HTREEITEM target, std::wst std::wstring path = m_pcFuncInfoArr->GetAt(*pnItem)->m_cmemFileName.GetStringPtr(); path += L"\\"; path += *pPath; - *pPath = path; + *pPath = std::move(path); return true; } if( tvItem.lParam != -1 && tvItem.lParam != -2 ){ @@ -787,7 +787,7 @@ bool CDlgFuncList::GetTreeFileFullName(HWND hwndTree, HTREEITEM target, std::wst std::wstring path = szFileName; path += L"\\"; path += *pPath; - *pPath = path; + *pPath = std::move(path); }else{ *pPath = szFileName; } @@ -830,7 +830,7 @@ int CDlgFuncList::GetData( void ) TV_ITEM tvi; m_cFuncInfo = NULL; - m_sJumpFile = L""; + m_sJumpFile.clear(); hwndList = GetItemHwnd( IDC_LIST_FL ); if( m_nViewType == VIEWTYPE_LIST ){ // List @@ -870,7 +870,7 @@ int CDlgFuncList::GetData( void ) if( tvi.lParam == -1 ){ int nItem; if( !GetTreeFileFullName( hwndTree, htiItem, &m_sJumpFile, &nItem ) ){ - m_sJumpFile = L""; // error + m_sJumpFile.clear(); // error } } } diff --git a/sakura_core/outline/CFuncInfo.cpp b/sakura_core/outline/CFuncInfo.cpp index 9fb04fefe0..0c4e00eac6 100644 --- a/sakura_core/outline/CFuncInfo.cpp +++ b/sakura_core/outline/CFuncInfo.cpp @@ -41,6 +41,4 @@ CFuncInfo::CFuncInfo( } /* CFuncInfoクラス消滅 */ -CFuncInfo::~CFuncInfo() -{ -} +CFuncInfo::~CFuncInfo() = default; diff --git a/sakura_core/outline/CFuncInfoArr.cpp b/sakura_core/outline/CFuncInfoArr.cpp index f391369987..3e77457610 100644 --- a/sakura_core/outline/CFuncInfoArr.cpp +++ b/sakura_core/outline/CFuncInfoArr.cpp @@ -138,7 +138,7 @@ void CFuncInfoArr::SetAppendText( int info, std::wstring s, bool overwrite ) }else{ // キーが存在する場合、値を書き換える if( overwrite ){ - m_AppendTextArr[ info ] = s; + m_AppendTextArr[ info ] = std::move(s); } } } diff --git a/sakura_core/plugin/CDllPlugin.cpp b/sakura_core/plugin/CDllPlugin.cpp index 2f60861d1a..6dbc1c1ee8 100644 --- a/sakura_core/plugin/CDllPlugin.cpp +++ b/sakura_core/plugin/CDllPlugin.cpp @@ -75,7 +75,7 @@ bool CDllPlugin::ReadPluginDef( CDataProfile *cProfile, CDataProfile *cProfileMl // プラグ実行 bool CDllPlugin::InvokePlug( CEditView* view, CPlug& plug_raw, CWSHIfObj::List& params ) { - wstring dllPath = GetFilePath( m_sDllName.c_str() ); + wstring dllPath = GetFilePath( m_sDllName ); EDllResult resInit = InitDll( dllPath.c_str() ); if( resInit != DLL_SUCCESS ){ ::MYMESSAGEBOX( view->m_hwndParent, MB_OK, LS(STR_DLLPLG_TITLE), LS(STR_DLLPLG_INIT_ERR1), dllPath.c_str(), m_sName.c_str() ); diff --git a/sakura_core/plugin/CPlugin.cpp b/sakura_core/plugin/CPlugin.cpp index 20c428ea7c..de473e9823 100644 --- a/sakura_core/plugin/CPlugin.cpp +++ b/sakura_core/plugin/CPlugin.cpp @@ -108,7 +108,7 @@ bool CPlugin::ReadPluginDefPlug( CDataProfile *cProfile, CDataProfile *cProfileM if( cProfileMlang ){ cProfileMlang->IOProfileData( PII_PLUG, sKeyLabel.c_str(), sLabel ); } - if (sLabel == L"") { + if (sLabel.empty()) { sLabel = sHandler; // Labelが無ければハンドラ名で代用 } @@ -141,7 +141,7 @@ bool CPlugin::ReadPluginDefCommand( CDataProfile *cProfile, CDataProfile *cProfi if( cProfileMlang ){ cProfileMlang->IOProfileData( PII_COMMAND, bufKey, sLabel ); } - if (sLabel == L"") { + if (sLabel.empty()) { sLabel = sHandler; // Labelが無ければハンドラ名で代用 } //アイコンの取得 @@ -172,9 +172,12 @@ bool CPlugin::ReadPluginDefOption( CDataProfile *cProfile, CDataProfile *cProfil wstring sDefaultVal; WCHAR bufKey[64]; - sSection = L""; + sSection.clear(); for( int nCount = 1; nCount < MAX_PLUG_OPTION; nCount++ ){ //添え字は1から始める - sKey = sLabel = sType = sDefaultVal= L""; + sKey.clear(); + sLabel.clear(); + sType.clear(); + sDefaultVal.clear(); //Keyの取得 _swprintf( bufKey, L"O[%d].Key", nCount ); if( cProfile->IOProfileData( PII_OPTION, bufKey, sKey ) ){ @@ -262,7 +265,7 @@ std::vector wstring_split( std::wstring sTrg, wchar_t cSep ) splitVec.push_back( sTrg.substr( 0, idx ) ); sTrg = sTrg.substr( ++idx ); } - if (sTrg != L"") { + if (sTrg.length()) { splitVec.push_back( sTrg ); } @@ -275,7 +278,7 @@ bool CPlugin::ReadPluginDefString( CDataProfile *cProfile, CDataProfile *cProfil { WCHAR bufKey[64]; m_aStrings.clear(); - m_aStrings.push_back( wstring(L"") ); // 0番目ダミー + m_aStrings.emplace_back( std::wstring() ); // 0番目ダミー for( int nCount = 1; nCount < MAX_PLUG_STRING; nCount++ ){ //添え字は1から始める wstring sVal = L""; _swprintf( bufKey, L"S[%d]", nCount ); diff --git a/sakura_core/plugin/CPlugin.h b/sakura_core/plugin/CPlugin.h index b125037832..a3ccd0d9ae 100644 --- a/sakura_core/plugin/CPlugin.h +++ b/sakura_core/plugin/CPlugin.h @@ -185,22 +185,20 @@ class CPluginOption //コンストラクタ public: CPluginOption( CPlugin* parent, wstring sLabel, wstring sSection, wstring sKey, wstring sType, wstring sSelects, wstring sDefaultVal, int index) + : m_sLabel(sLabel), m_sSection(sSection), m_sKey(sKey) { m_parent = parent; - m_sLabel = sLabel; - m_sSection = sSection; - m_sKey = sKey; // 小文字変換 std::transform( sType.begin (), sType.end (), sType.begin (), my_towlower2 ); - m_sType = sType; - m_sSelects = sSelects; - m_sDefaultVal = sDefaultVal; + m_sType = std::move(sType); + m_sSelects = std::move(sSelects); + m_sDefaultVal = std::move(sDefaultVal); m_index = index; } //デストラクタ public: - ~CPluginOption() {} + ~CPluginOption() = default; //操作 public: diff --git a/sakura_core/plugin/CPluginIfObj.h b/sakura_core/plugin/CPluginIfObj.h index d97b975c20..c5ce4915ec 100644 --- a/sakura_core/plugin/CPluginIfObj.h +++ b/sakura_core/plugin/CPluginIfObj.h @@ -144,7 +144,7 @@ class CPluginIfObj : public CWSHIfObj { Wrap(&Result)->Receive(S); return true; }else if( 0 == num ){ - std::wstring str = m_cPlugin.m_sLangName.c_str(); + std::wstring str = m_cPlugin.m_sLangName; SysString S(str.c_str(), str.size()); Wrap(&Result)->Receive(S); return true; diff --git a/sakura_core/plugin/CPluginManager.cpp b/sakura_core/plugin/CPluginManager.cpp index bfaa818c55..b192497e50 100644 --- a/sakura_core/plugin/CPluginManager.cpp +++ b/sakura_core/plugin/CPluginManager.cpp @@ -425,7 +425,7 @@ int CPluginManager::InstallPlugin( CommonSetting& common, const WCHAR* pszPlugin auto_sprintf( szPlugKey, L"C[%d]", i); sPlugCmd.clear(); cProfDef.IOProfileData( PII_COMMAND, szPlugKey, sPlugCmd ); - if (sPlugCmd == L"") { + if (sPlugCmd.empty()) { break; } plugin_table[nEmpty].m_nCmdNum = i; @@ -446,7 +446,7 @@ bool CPluginManager::LoadAllPlugin(CommonSetting* common) std::wstring szLangName; { std::wstring szDllName = GetDllShareData().m_Common.m_sWindow.m_szLanguageDll; - if( szDllName == L"" ){ + if( szDllName.empty() ){ szLangName = L"ja_JP"; }else{ // "sakura_lang_*.dll" diff --git a/sakura_core/plugin/CWSHPlugin.cpp b/sakura_core/plugin/CWSHPlugin.cpp index eb99f8180d..eb1933a2a8 100644 --- a/sakura_core/plugin/CWSHPlugin.cpp +++ b/sakura_core/plugin/CWSHPlugin.cpp @@ -77,7 +77,7 @@ bool CWSHPlugin::InvokePlug( CEditView* view, CPlug& plug, CWSHIfObj::List& para CWSHMacroManager* pWsh = NULL; if( !m_bUseCache || wshPlug.m_Wsh == NULL ){ - CFilePath path( plug.m_cPlugin.GetFilePath( plug.m_sHandler.c_str() ).c_str() ); + CFilePath path( plug.m_cPlugin.GetFilePath( plug.m_sHandler ).c_str() ); pWsh = (CWSHMacroManager*)CWSHMacroManager::Creator( path.GetExt( true ) ); if( pWsh == NULL ){ return false; } diff --git a/sakura_core/prop/CPropComMainMenu.cpp b/sakura_core/prop/CPropComMainMenu.cpp index c5f55facf5..a0a4f640f6 100644 --- a/sakura_core/prop/CPropComMainMenu.cpp +++ b/sakura_core/prop/CPropComMainMenu.cpp @@ -831,7 +831,7 @@ INT_PTR CPropMainMenu::DispatchEvent( static wstring SupplementAmpersand( wstring sLavel) { size_t nPos =0; - while ((nPos = sLavel.find( L"&", nPos)) != wstring::npos) { + while ((nPos = sLavel.find( L'&', nPos)) != wstring::npos) { if (sLavel[nPos+1] != L'&') { // &&でない sLavel.replace( nPos, 1, L"&&"); @@ -845,7 +845,7 @@ static wstring SupplementAmpersand( wstring sLavel) static wstring RemoveAmpersand( wstring sLavel) { size_t nPos =0; - while ((nPos = sLavel.find( L"&", nPos)) != wstring::npos) { + while ((nPos = sLavel.find( L'&', nPos)) != wstring::npos) { if (sLavel[nPos+1] == L'&') { // && sLavel.replace( nPos, 1, L""); @@ -1204,7 +1204,7 @@ bool CPropMainMenu::Check_MainMenu( { HTREEITEM htiItem; - sErrMsg = L""; + sErrMsg.clear(); htiItem = TreeView_GetRoot( hwndTree ); @@ -1348,7 +1348,7 @@ bool CPropMainMenu::Check_MainMenu_Sub( } if (nLevel == 0) { - sErrMsg = L""; + sErrMsg.clear(); if (!bOptionOk) { sErrMsg += LS(STR_PROPCOMMAINMENU_ERR2); bRet = false; diff --git a/sakura_core/prop/CPropComPlugin.cpp b/sakura_core/prop/CPropComPlugin.cpp index f948e986f4..065f5763af 100644 --- a/sakura_core/prop/CPropComPlugin.cpp +++ b/sakura_core/prop/CPropComPlugin.cpp @@ -225,7 +225,7 @@ INT_PTR CPropPlugin::DispatchEvent( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR if( sel >= 0 && m_Common.m_sPlugin.m_PluginTable[sel].m_state == PLS_LOADED ){ // 2010.08.21 プラグイン名(フォルダー名)の同一性の確認 CPlugin* plugin = CPluginManager::getInstance()->GetPlugin(sel); - wstring sDirName = plugin->GetFolderName().c_str(); + wstring sDirName = plugin->GetFolderName(); if( plugin && 0 == wmemicmp(sDirName.c_str(), m_Common.m_sPlugin.m_PluginTable[sel].m_szName ) ){ CDlgPluginOption cDlgPluginOption; cDlgPluginOption.DoModal( ::GetModuleHandle(NULL), hwndDlg, this, sel ); @@ -545,7 +545,7 @@ std::wstring CPropPlugin::GetReadMeFile(const std::wstring& sName) } if (!fl->IsFileExist()) { - sReadMeName = L""; + sReadMeName.clear(); } delete fl; return sReadMeName; @@ -617,7 +617,7 @@ static void LoadPluginTemp(CommonSetting& common, CMenuDrawer& cMenuDrawer) int iBitmap = CMenuDrawer::TOOLBAR_ICON_PLUGCOMMAND_DEFAULT - 1; const CPlug* plug = *it; if( !plug->m_sIcon.empty() ){ - iBitmap = cMenuDrawer.m_pcIcons->Add( plug->m_cPlugin.GetFilePath( plug->m_sIcon.c_str() ).c_str() ); + iBitmap = cMenuDrawer.m_pcIcons->Add( plug->m_cPlugin.GetFilePath( plug->m_sIcon ).c_str() ); } cMenuDrawer.AddToolButton( iBitmap, plug->GetFunctionCode() ); } diff --git a/sakura_core/prop/CPropCommon.cpp b/sakura_core/prop/CPropCommon.cpp index ad96185f44..6b6b098f4b 100644 --- a/sakura_core/prop/CPropCommon.cpp +++ b/sakura_core/prop/CPropCommon.cpp @@ -162,9 +162,7 @@ CPropCommon::CPropCommon() return; } -CPropCommon::~CPropCommon() -{ -} +CPropCommon::~CPropCommon() = default; /* 初期化 */ //@@@ 2002.01.03 YAZAKI m_tbMyButtonなどをCShareDataからCMenuDrawerへ移動したことによる修正。 diff --git a/sakura_core/typeprop/CDlgTypeAscertain.cpp b/sakura_core/typeprop/CDlgTypeAscertain.cpp index efbe34db5c..12795f46d3 100644 --- a/sakura_core/typeprop/CDlgTypeAscertain.cpp +++ b/sakura_core/typeprop/CDlgTypeAscertain.cpp @@ -81,7 +81,7 @@ BOOL CDlgTypeAscertain::OnBnClicked( int wID ) wchar_t buff2[_MAX_PATH + 20]; m_psi->bAddType = IsDlgButtonCheckedBool( GetHwnd(), IDC_RADIO_TYPE_ADD ); - m_psi->sColorFile = L""; + m_psi->sColorFile.clear(); m_psi->nColorType = Combo_GetCurSel( GetItemHwnd( IDC_COMBO_COLORS ) ) - 1; if (m_psi->nColorType >= MAX_TYPES && Combo_GetLBText( GetItemHwnd( IDC_COMBO_COLORS ), m_psi->nColorType + 1, buff1)) { if (_stscanf( buff1, L"File -- %ls", buff2 ) > 0) { diff --git a/sakura_core/typeprop/CDlgTypeList.cpp b/sakura_core/typeprop/CDlgTypeList.cpp index f32cc1625b..3f141e1c5c 100644 --- a/sakura_core/typeprop/CDlgTypeList.cpp +++ b/sakura_core/typeprop/CDlgTypeList.cpp @@ -517,7 +517,7 @@ bool CDlgTypeList::InitializeType( void ) return false; } // _DefaultConfig(&types); //規定値をコピー - std::unique_ptr type(new STypeConfig()); + auto type = std::make_unique(); if( 0 != iDocType ){ CDocTypeManager().GetTypeConfig(CTypeConfig(0), *type); // 基本をコピー @@ -632,8 +632,8 @@ bool CDlgTypeList::UpType() // 基本の場合には何もしない return true; } - std::unique_ptr type1(new STypeConfig()); - std::unique_ptr type2(new STypeConfig()); + auto type1 = std::make_unique(); + auto type2 = std::make_unique(); CDocTypeManager().GetTypeConfig(CTypeConfig(iDocType), *type1); CDocTypeManager().GetTypeConfig(CTypeConfig(iDocType - 1), *type2); --(type1->m_nIdx); @@ -654,8 +654,8 @@ bool CDlgTypeList::DownType() // 基本、最後の場合には何もしない return true; } - std::unique_ptr type1(new STypeConfig()); - std::unique_ptr type2(new STypeConfig()); + auto type1 = std::make_unique(); + auto type2 = std::make_unique(); CDocTypeManager().GetTypeConfig(CTypeConfig(iDocType), *type1); CDocTypeManager().GetTypeConfig(CTypeConfig(iDocType + 1), *type2); ++(type1->m_nIdx); @@ -866,7 +866,7 @@ int RegistExt(LPCWSTR sExt, bool bDefProg) { if( szProgID_HKLM[0] != L'\0' ) { - if( (errorCode = CopyRegistry(HKEY_LOCAL_MACHINE, (sBasePath + szProgID_HKLM).c_str(), HKEY_CURRENT_USER, sProgIDPath.c_str())) != 0 ){ return errorCode; } + if( (errorCode = CopyRegistry(HKEY_LOCAL_MACHINE, sBasePath + szProgID_HKLM, HKEY_CURRENT_USER, sProgIDPath)) != 0 ){ return errorCode; } } } @@ -955,7 +955,6 @@ int UnregistExt(LPCWSTR sExt) CharLower(szLowerExt); wstring sDotExt = sBasePath + L"." + szLowerExt; - wstring sGenProgID = wstring() + szLowerExt + L"file"; CRegKey keyExt; if((errorCode = keyExt.Open(HKEY_CURRENT_USER, sDotExt.c_str(), KEY_READ | KEY_WRITE)) != 0) @@ -974,7 +973,6 @@ int UnregistExt(LPCWSTR sExt) wstring sProgIDPath = sBasePath + szProgID; wstring sShellPath = sProgIDPath + L"\\shell"; wstring sShellActionPath = sShellPath + L"\\" + ACTION_NAME; - wstring sShellActionCommandPath = sShellActionPath + L"\\command"; wstring sBackupPath = sShellActionPath + ACTION_BACKUP_PATH; CRegKey keyShellAction; @@ -1047,7 +1045,6 @@ int CheckExt(LPCWSTR sExt, bool *pbRMenu, bool *pbDblClick) CharLower(szLowerExt); wstring sDotExt = sBasePath + L"." + szLowerExt; - wstring sGenProgID = wstring() + szLowerExt + L"file"; CRegKey keyExt; if((errorCode = keyExt.Open(HKEY_CURRENT_USER, sDotExt.c_str(), KEY_READ)) != 0) diff --git a/sakura_core/typeprop/CImpExpManager.cpp b/sakura_core/typeprop/CImpExpManager.cpp index 16fac0eaf9..20730fcde9 100644 --- a/sakura_core/typeprop/CImpExpManager.cpp +++ b/sakura_core/typeprop/CImpExpManager.cpp @@ -357,7 +357,6 @@ bool CImpExpType::Import( const wstring& sFileName, wstring& sErrMsg ) wchar_t* pSlashPos; wchar_t szFileName[_MAX_PATH+1]; bool bCase; - wstring sErrMag; CommonSetting& common = m_pShareData->m_Common; // 強調キーワード @@ -636,7 +635,7 @@ bool CImpExpRegex::Import( const wstring& sFileName, wstring& sErrMsg ) if( line.length() < 12 ) continue; if( wmemcmp(&line[0], L"RxKey[", 6) != 0 ) continue; if( wmemcmp(&line[9], L"]=", 2) != 0 ) continue; - auto sepPos = line.find_first_of(L",", 11); // ColorName と RegexKeyword の間の区切り文字の存在を確認する + auto sepPos = line.find_first_of(L',', 11); // ColorName と RegexKeyword の間の区切り文字の存在を確認する if( sepPos == decltype(line)::npos ) continue; line[sepPos] = L'\0'; // 区切り文字をNULL終端に置き換える事で標準Cライブラリの関数で ColorName を読み取りやすくする const wchar_t* pColorNameInLine = &line[11]; @@ -766,10 +765,10 @@ bool CImpExpKeyHelp::Import( const wstring& sFileName, wstring& sErrMsg ) WCHAR *p1, *p2, *p3; p1 = &buff[9]; p3 = p1; //結果確認用に初期化 - if( NULL != (p2=wcsstr(p1,LTEXT(","))) ){ + if( p2 = wcschr(p1, L',') ){ *p2 = LTEXT('\0'); p2 += 1; //カンマの次が、次の要素 - if( NULL != (p3=wcsstr(p2,LTEXT(","))) ){ + if( NULL != (p3=wcschr(p2,LTEXT(','))) ){ *p3 = LTEXT('\0'); p3 += 1; //カンマの次が、次の要素 } diff --git a/sakura_core/typeprop/CPropTypes.cpp b/sakura_core/typeprop/CPropTypes.cpp index 51cb5e57ec..44045bd959 100644 --- a/sakura_core/typeprop/CPropTypes.cpp +++ b/sakura_core/typeprop/CPropTypes.cpp @@ -109,9 +109,7 @@ CPropTypes::CPropTypes() (static_cast(this))->CPropTypes_Screen(); } -CPropTypes::~CPropTypes() -{ -} +CPropTypes::~CPropTypes() = default; /* 初期化 */ void CPropTypes::Create( HINSTANCE hInstApp, HWND hwndParent ) diff --git a/sakura_core/types/CType_Asm.cpp b/sakura_core/types/CType_Asm.cpp index c3b006bf83..b6603956c7 100644 --- a/sakura_core/types/CType_Asm.cpp +++ b/sakura_core/types/CType_Asm.cpp @@ -81,7 +81,7 @@ void CDocOutline::MakeTopicList_asm( CFuncInfoArr* pcFuncInfoArr ) } //行コメント削除 - p = wcsstr( pTmpLine, L";" ); + p = wcschr( pTmpLine, L';' ); if( p ) *p = L'\0'; length = wcslen( pTmpLine ); @@ -93,9 +93,9 @@ void CDocOutline::MakeTopicList_asm( CFuncInfoArr* pcFuncInfoArr ) token[ j ] = my_strtok( pTmpLine, length, &offset, L" \t\r\n" ); if( token[ j ] == NULL ) break; //トークンに含まれるべき文字でないか? - if( wcsstr( token[ j ], L"\"") != NULL - || wcsstr( token[ j ], L"\\") != NULL - || wcsstr( token[ j ], L"'" ) != NULL ){ + if( wcschr( token[ j ], L'\"') != NULL + || wcschr( token[ j ], L'\\') != NULL + || wcschr( token[ j ], L'\'' ) != NULL ){ token[ j ] = NULL; break; } diff --git a/sakura_core/uiparts/CGraphics.cpp b/sakura_core/uiparts/CGraphics.cpp index 04968462f5..d8f568077a 100644 --- a/sakura_core/uiparts/CGraphics.cpp +++ b/sakura_core/uiparts/CGraphics.cpp @@ -37,7 +37,7 @@ class CGDIStock using Me = CGDIStock; public: - CGDIStock(){} + CGDIStock() = default; CGDIStock(const Me&) = delete; Me& operator = (const Me&) = delete; CGDIStock(Me&&) noexcept = delete; diff --git a/sakura_core/util/file.cpp b/sakura_core/util/file.cpp index 5acb616072..79b0dce4cd 100644 --- a/sakura_core/util/file.cpp +++ b/sakura_core/util/file.cpp @@ -832,7 +832,6 @@ void GetExistPathW( wchar_t *po , const wchar_t *pi ) { wchar_t *pw,*ps; int cnt; - wchar_t drv[4] = L"_:\\"; int dl; /* ドライブの状態 */ /* pi の内容を @@ -851,6 +850,7 @@ void GetExistPathW( wchar_t *po , const wchar_t *pi ) dl = GetExistPath_NO_DriveLetter; /*「ドライブレターが無い」にしておく*/ if( *(po+1)==L':' && WCODE::IsAZ(*po) ){ /* 先頭にドライブレターがある。そのドライブが有効かどうか判定する */ + wchar_t drv[4] = L"_:\\"; drv[0] = *po; if( _waccess(drv,0) == 0 ) dl = GetExistPath_AV_Drive; /* 有効 */ else dl = GetExistPath_IV_Drive; /* 無効 */ diff --git a/sakura_core/view/CEditView.cpp b/sakura_core/view/CEditView.cpp index b78da3282e..e4271b8e76 100644 --- a/sakura_core/view/CEditView.cpp +++ b/sakura_core/view/CEditView.cpp @@ -708,8 +708,8 @@ LRESULT CEditView::DispatchEvent( // MYTRACE( L" WM_VSCROLL nPos=%d\n", GetScrollPos( m_hwndVScrollBar, SB_CTL ) ); // Sep. 11, 2004 genta 同期スクロールの関数化 { - CLayoutInt Scroll = OnVScroll( - (int) LOWORD( wParam ), ((int) HIWORD( wParam )) * m_nVScrollRate ); + // 垂直スクロールする + auto Scroll = OnVScroll(LOWORD(wParam), HIWORD(wParam) * m_nVScrollRate); // シフトキーが押されていないときだけ同期スクロール if(!GetKeyState_Shift()){ @@ -723,8 +723,8 @@ LRESULT CEditView::DispatchEvent( // MYTRACE( L" WM_HSCROLL nPos=%d\n", GetScrollPos( m_hwndHScrollBar, SB_CTL ) ); // Sep. 11, 2004 genta 同期スクロールの関数化 { - CLayoutInt Scroll = OnHScroll( - (int) LOWORD( wParam ), ((int) HIWORD( wParam )) ); + // 水平スクロールする + auto Scroll = OnHScroll(LOWORD(wParam), HIWORD(wParam)); // シフトキーが押されていないときだけ同期スクロール if(!GetKeyState_Shift()){ @@ -1396,9 +1396,9 @@ void CEditView::ConvSelectedArea( EFunctionCode nFuncCode ) nIdxFrom = CLogicInt(0); nIdxTo = CLogicInt(0); } - CLogicInt nDelPos = nDelPosNext; nDelLen = nDelLenNext; if( nLineNum < rcSelLayout.bottom && 0 < nDelLen ){ + CLogicInt nDelPos = nDelPosNext; CLayoutPoint sPos; m_pcEditDoc->m_cLayoutMgr.GetLineStr( nLineNum + CLayoutInt(1), &nLineLen2, &pcLayout ); sPos.Set( @@ -1826,7 +1826,6 @@ bool CEditView::GetSelectedData( wchar_t* pszLineNum = NULL; const wchar_t* pszSpaces = L" "; const CLayout* pcLayout; - CEol appendEol( neweol ); /* 範囲選択がされていない */ if( !GetSelectionInfo().IsTextSelected() ){ @@ -1915,7 +1914,8 @@ bool CEditView::GetSelectedData( } } else{ - cmemBuf->SetString(L""); + CEol appendEol(neweol); + cmemBuf->Clear(); //<< 2002/04/18 Azumaiya // これから貼り付けに使う領域の大まかなサイズを取得する。 @@ -2648,7 +2648,7 @@ bool CEditView::ShowKeywordHelp( POINT po, LPCWSTR pszHelp, LPRECT prcHokanWin) return false; } }else{ - m_cTipWnd.m_cKey = cmemCurText; + m_cTipWnd.m_cKey = std::move(cmemCurText); /* 検索実行 */ if(!KeySearchCore(&m_cTipWnd.m_cKey)) // 2006.04.10 fon return FALSE; diff --git a/sakura_core/view/CEditView_Command_New.cpp b/sakura_core/view/CEditView_Command_New.cpp index 54c7b63b23..128783ae5b 100644 --- a/sakura_core/view/CEditView_Command_New.cpp +++ b/sakura_core/view/CEditView_Command_New.cpp @@ -116,11 +116,11 @@ void CEditView::InsertData_CEditView( || m_pTypeData->m_bKinsokuKuto ); //@@@ 2002.04.19 MIK CLayoutInt nLineAllColLen; - CLogicInt nIdxFrom = CLogicInt(0); CLayoutInt nColumnFrom = ptInsertPos.GetX2(); CNativeW cMem(L""); COpeLineData insData; if( pLine ){ + CLogicInt nIdxFrom = CLogicInt(0); // 更新が前行からになる可能性を調べる // 2009.02.17 ryoji // ※折り返し行頭への句読点入力で前の行だけが更新される場合もある // ※挿入位置は行途中でも句読点入力+ワードラップで前の文字列から続けて前行に回り込む場合もある diff --git a/sakura_core/view/CEditView_Mouse.cpp b/sakura_core/view/CEditView_Mouse.cpp index d168cc4331..82e7407cc7 100644 --- a/sakura_core/view/CEditView_Mouse.cpp +++ b/sakura_core/view/CEditView_Mouse.cpp @@ -1572,7 +1572,7 @@ void CEditView::OnLBUTTONDBLCLK( WPARAM fwKeys, int _xPos , int _yPos ) strOPEN = L"ht" + strURL; } else{ - strOPEN = strURL; + strOPEN = std::move(strURL); } } { diff --git a/sakura_core/view/CEditView_Paint.cpp b/sakura_core/view/CEditView_Paint.cpp index 6d42eb6ca3..2d401e39b0 100644 --- a/sakura_core/view/CEditView_Paint.cpp +++ b/sakura_core/view/CEditView_Paint.cpp @@ -71,6 +71,7 @@ void CEditView_Paint::Call_OnPaint( //領域を作成 -> rc std::vector rcs; + rcs.reserve(3); if(nPaintFlag & PAINT_LINENUMBER)rcs.push_back(rcLineNumber); if(nPaintFlag & PAINT_RULER)rcs.push_back(rcRuler); if(nPaintFlag & PAINT_BODY)rcs.push_back(rcBody); diff --git a/sakura_core/window/CEditWnd.cpp b/sakura_core/window/CEditWnd.cpp index cd2ff90a3d..86146b4823 100644 --- a/sakura_core/window/CEditWnd.cpp +++ b/sakura_core/window/CEditWnd.cpp @@ -2195,7 +2195,7 @@ void CEditWnd::OnCommand( WORD wNotifyCode, WORD wID , HWND hwndCtl ) if( strText.length() < _MAX_PATH ){ CSearchKeywordManager().AddToSearchKeyArr( strText.c_str() ); } - GetActiveView().m_strCurSearchKey = strText; + GetActiveView().m_strCurSearchKey = std::move(strText); GetActiveView().m_bCurSearchUpdate = true; GetActiveView().ChangeCurRegexp(); } @@ -4840,7 +4840,7 @@ void CEditWnd::RegisterPluginCommand( CPlug* plug ) { int iBitmap = CMenuDrawer::TOOLBAR_ICON_PLUGCOMMAND_DEFAULT - 1; if( !plug->m_sIcon.empty() ){ - iBitmap = m_cMenuDrawer.m_pcIcons->Add( plug->m_cPlugin.GetFilePath( plug->m_sIcon.c_str() ).c_str() ); + iBitmap = m_cMenuDrawer.m_pcIcons->Add( plug->m_cPlugin.GetFilePath( plug->m_sIcon ).c_str() ); } m_cMenuDrawer.AddToolButton( iBitmap, plug->GetFunctionCode() ); diff --git a/sakura_core/window/CMainToolBar.cpp b/sakura_core/window/CMainToolBar.cpp index 354209a576..b2ea75db4e 100644 --- a/sakura_core/window/CMainToolBar.cpp +++ b/sakura_core/window/CMainToolBar.cpp @@ -68,7 +68,7 @@ void CMainToolBar::ProcSearchBox( MSG *msg ) //検索キーを登録 CSearchKeywordManager().AddToSearchKeyArr( strText.c_str() ); } - m_pOwner->GetActiveView().m_strCurSearchKey = strText; + m_pOwner->GetActiveView().m_strCurSearchKey = std::move(strText); m_pOwner->GetActiveView().m_bCurSearchUpdate = true; m_pOwner->GetActiveView().ChangeCurRegexp(); @@ -604,7 +604,7 @@ int CMainToolBar::GetSearchKey(std::wstring& strText) if( m_hwndSearchBox ){ ApiWrap::Wnd_GetText( m_hwndSearchBox, strText ); }else{ - strText = L""; + strText.clear(); } return strText.length(); }