Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions sakura_core/window/CEditWnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4014,27 +4014,20 @@ void CEditWnd::ChangeFileNameNotify( const WCHAR* pszTabCaption, const WCHAR* _p
{
const WCHAR* pszFilePath = _pszFilePath;

EditNode *p;
int nIndex;

if( nullptr == pszTabCaption ) pszTabCaption = L""; //ガード
if( nullptr == pszFilePath ) pszFilePath = L""; //ガード 2006.01.28 ryoji

CRecentEditNode cRecentEditNode;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

指摘じゃないです。編集ノードの操作に責任を持つクラスがたくさんあるので、将来的にCRecentEditNodeクラスを削除すべきと思っています。

nIndex = cRecentEditNode.FindItemByHwnd( GetHwnd() );
int nIndex = cRecentEditNode.FindItemByHwnd( GetHwnd() );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

指摘じゃないですが、 const auto で宣言すべきと思います。
int でも構わないけど const は付けるべき。

if( -1 != nIndex )
{
p = cRecentEditNode.GetItem( nIndex );
EditNode *p = cRecentEditNode.GetItem( nIndex );
if( p )
{
int size = _countof( p->m_szTabCaption ) - 1;
wcsncpy( p->m_szTabCaption, pszTabCaption, size );
p->m_szTabCaption[ size ] = L'\0';
wcsncpy_s( p->m_szTabCaption, _countof(p->m_szTabCaption), pszTabCaption, _TRUNCATE );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

指摘じゃないです。 m_szTabCaptionが生配列なのを対策したいですが、StaticStringに移行しようとするとここを含めてあちこち変えないといけないので手が付けられない状態です。


// 2006.01.28 ryoji ファイル名、Grepモード追加
size = _countof2( p->m_szFilePath ) - 1;
wcsncpy( p->m_szFilePath, pszFilePath, size );
p->m_szFilePath[ size ] = L'\0';
wcsncpy_s( p->m_szFilePath, _countof2(p->m_szFilePath), pszFilePath, _TRUNCATE );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

指摘じゃないです。m_szFilePathはCFilePathなので、以下のように書けます。

Suggested change
wcsncpy_s( p->m_szFilePath, _countof2(p->m_szFilePath), pszFilePath, _TRUNCATE );
p->m_szFilePath = pszFilePath;


p->m_bIsGrep = bIsGrep;
}
Expand Down
Loading