Skip to content

Commit

Permalink
Merge d20e9d0 into 58795ee
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanAizek authored Jul 20, 2022
2 parents 58795ee + d20e9d0 commit c0acf24
Show file tree
Hide file tree
Showing 68 changed files with 157 additions and 167 deletions.
5 changes: 3 additions & 2 deletions sakura_core/CDicMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions sakura_core/CGrepAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ){
Expand Down
7 changes: 4 additions & 3 deletions sakura_core/CGrepEnumFileBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions sakura_core/CGrepEnumKeys.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class CGrepEnumKeys {
}

// 除外ファイルの2つの解析済み配列から1つのリストを作る
auto GetExcludeFiles() const -> std::list<decltype(m_vecExceptFileKeys)::value_type> {
std::list<decltype(m_vecExceptFileKeys)::value_type> excludeFiles;
auto GetExcludeFiles() const -> std::vector<decltype(m_vecExceptFileKeys)::value_type> {
std::vector<decltype(m_vecExceptFileKeys)::value_type> excludeFiles;
const auto& fileKeys = m_vecExceptFileKeys;
excludeFiles.insert( excludeFiles.cend(), fileKeys.cbegin(), fileKeys.cend() );
const auto& absFileKeys = m_vecExceptAbsFileKeys;
Expand All @@ -79,8 +79,8 @@ class CGrepEnumKeys {
}

// 除外フォルダーの2つの解析済み配列から1つのリストを作る
auto GetExcludeFolders() const -> std::list<decltype(m_vecExceptFolderKeys)::value_type> {
std::list<decltype(m_vecExceptFolderKeys)::value_type> excludeFolders;
auto GetExcludeFolders() const -> std::vector<decltype(m_vecExceptFolderKeys)::value_type> {
std::vector<decltype(m_vecExceptFolderKeys)::value_type> excludeFolders;
const auto& folderKeys = m_vecExceptFolderKeys;
excludeFolders.insert( excludeFolders.cend(), folderKeys.cbegin(), folderKeys.cend() );
const auto& absFolderKeys = m_vecExceptAbsFolderKeys;
Expand Down
12 changes: 6 additions & 6 deletions sakura_core/CProfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ using namespace std;
*/
void CProfile::Init( void )
{
m_strProfileName = L"";
m_strProfileName.clear();
m_ProfileData.clear();
m_bRead = true;
return;
Expand Down Expand Up @@ -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) );
}
}
}
Expand Down Expand Up @@ -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++ ) {
Expand Down
1 change: 0 additions & 1 deletion sakura_core/CProfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/CPropertyManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<STypeConfig> pType(new STypeConfig());
auto pType = std::make_unique<STypeConfig>();
CDocTypeManager().GetTypeConfig(nSettingType, *pType);
pcPropTypes->SetTypeData(*pType);
// Mar. 31, 2003 genta メモリ削減のためポインタに変更しProperySheet内で取得するように
Expand Down
4 changes: 2 additions & 2 deletions sakura_core/CSelectLang.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ class CLoadString
/*
|| Constructors
*/
CLoadString(){}
CLoadString() = default;
CLoadString( UINT uid ){ LoadString( uid ); } // 文字列読み込み付きコンストラクタ
/*virtual*/ ~CLoadString(){}
/*virtual*/ ~CLoadString() = default;

/*
|| Attributes & Operations
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/_main/CControlTray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
}
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/basis/CMySize.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down
3 changes: 1 addition & 2 deletions sakura_core/basis/CStrictRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions sakura_core/charset/CCodePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 8 additions & 4 deletions sakura_core/cmd/CViewCommander_Bookmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 分割したビューも更新
Expand Down
10 changes: 5 additions & 5 deletions sakura_core/cmd/CViewCommander_File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ void CViewCommander::Command_FILEOPEN( const WCHAR* filename, ECodeType nCharCod
//ロード情報
SLoadInfo sLoadInfo(filename?filename:L"", nCharCode, bViewMode);
std::vector<std::wstring> 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];
Expand Down Expand Up @@ -693,8 +693,6 @@ BOOL CViewCommander::Command_PUTFILE(
{ /* 選択範囲を出力 */
try
{
CBinaryOutputStream out(filename,true);

// 選択範囲の取得 -> cMem
CNativeW cMem;
m_pCommanderView->GetSelectedDataSimple(cMem);
Expand All @@ -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&)
{
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/cmd/CViewCommander_Grep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down
8 changes: 4 additions & 4 deletions sakura_core/cmd/CViewCommander_Search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions sakura_core/cmd/CViewCommander_TagJump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -390,7 +390,7 @@ bool CViewCommander::Command_TagJumpNoMessage( bool bClose )
break;
}
// 相対パスだった→◎”を探す
strFile = strPath;
strFile = std::move(strPath);
searchMode = TAGLIST_ROOT;
continue;
}
Expand All @@ -404,7 +404,7 @@ bool CViewCommander::Command_TagJumpNoMessage( bool bClose )
break;
}
if (IsFileExists2(strPath.c_str())) {
strJumpToFile = strPath;
strJumpToFile = std::move(strPath);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/dlg/CDlgAbout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/dlg/CDlgGrep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ){
Expand Down
4 changes: 1 addition & 3 deletions sakura_core/dlg/CDlgOpenFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
extern std::shared_ptr<IDlgOpenFile> New_CDlgOpenFile_CommonFileDialog();
extern std::shared_ptr<IDlgOpenFile> New_CDlgOpenFile_CommonItemDialog();

CDlgOpenFile::CDlgOpenFile()
{
}
CDlgOpenFile::CDlgOpenFile() = default;

void CDlgOpenFile::Create(
HINSTANCE hInstance,
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/dlg/CDlgOpenFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class CDlgOpenFile final : public IDlgOpenFile
public:
//コンストラクタ・デストラクタ
CDlgOpenFile();
~CDlgOpenFile() {}
~CDlgOpenFile() = default;

void Create(
HINSTANCE hInstance,
Expand Down
8 changes: 4 additions & 4 deletions sakura_core/dlg/CDlgOpenFile_CommonFileDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ bool CDlgOpenFile_CommonFileDialog::DoModal_GetOpenFileName( WCHAR* pszPath, EFi
}

/* 構造体の初期化 */
std::unique_ptr<CDlgOpenFileData> pData( new CDlgOpenFileData() );
auto pData = std::make_unique<CDlgOpenFileData>();
InitOfn( &pData->m_ofn ); // 2005.10.29 ryoji
pData->m_pcDlgOpenFile = this;
pData->m_ofn.lCustData = (LPARAM)(pData.get());
Expand Down Expand Up @@ -827,7 +827,7 @@ bool CDlgOpenFile_CommonFileDialog::DoModal_GetSaveFileName( WCHAR* pszPath )
}

/* 構造体の初期化 */
std::unique_ptr<CDlgOpenFileData> pData( new CDlgOpenFileData() );
auto pData = std::make_unique<CDlgOpenFileData>();
InitOfn( &pData->m_ofn ); // 2005.10.29 ryoji
pData->m_pcDlgOpenFile = this;
pData->m_ofn.lCustData = (LPARAM)(pData.get());
Expand Down Expand Up @@ -865,7 +865,7 @@ bool CDlgOpenFile_CommonFileDialog::DoModalOpenDlg(
bool bOptions
)
{
std::unique_ptr<CDlgOpenFileData> pData( new CDlgOpenFileData() );
auto pData = std::make_unique<CDlgOpenFileData>();
pData->m_bIsSaveDialog = FALSE; /* 保存のダイアログか */

bool bMultiSelect = pFileNames != NULL;
Expand Down Expand Up @@ -971,7 +971,7 @@ bool CDlgOpenFile_CommonFileDialog::DoModalSaveDlg(
bool bSimpleMode
)
{
std::unique_ptr<CDlgOpenFileData> pData( new CDlgOpenFileData() );
auto pData = std::make_unique<CDlgOpenFileData>();
pData->m_bIsSaveDialog = TRUE; /* 保存のダイアログか */

// 2003.05.12 MIK
Expand Down
Loading

0 comments on commit c0acf24

Please sign in to comment.