Skip to content

Commit

Permalink
Merge pull request #1589 from usagisita/feature/fix_dlginput1_text_le…
Browse files Browse the repository at this point in the history
…ngth

CDlgInput1で文字列長はNUL終端を含まない長さを指定するはずが1文字多いところがあるのを修正
  • Loading branch information
usagisita authored Mar 15, 2021
2 parents 4bd1fbb + 6538488 commit 95d9b03
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions sakura_core/dlg/CDlgFavorite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ void CDlgFavorite::AddItem()
CDlgInput1 cDlgInput1;
std::wstring strTitle = LS( STR_DLGFAV_ADD );
std::wstring strMessage = LS( STR_DLGFAV_ADD_PROMPT );
if( !cDlgInput1.DoModal( G_AppInstance(), GetHwnd(), strTitle.c_str(), strMessage.c_str(), max_size, szAddText ) ){
if( !cDlgInput1.DoModal( G_AppInstance(), GetHwnd(), strTitle.c_str(), strMessage.c_str(), max_size - 1, szAddText ) ){
return;
}

Expand Down Expand Up @@ -965,7 +965,7 @@ void CDlgFavorite::EditItem()
CDlgInput1 cDlgInput1;
std::wstring strTitle = LS( STR_DLGFAV_EDIT );
std::wstring strMessage = LS( STR_DLGFAV_EDIT_PROMPT );
if( !cDlgInput1.DoModal(G_AppInstance(), GetHwnd(), strTitle.c_str(), strMessage.c_str(), max_size, szText) ){
if( !cDlgInput1.DoModal(G_AppInstance(), GetHwnd(), strTitle.c_str(), strMessage.c_str(), max_size - 1, szText) ){
return;
}
GetFavorite(m_nCurrentTab);
Expand Down
1 change: 0 additions & 1 deletion sakura_core/dlg/CDlgPrintSetting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ BOOL CDlgPrintSetting::OnDestroy( void )

BOOL CDlgPrintSetting::OnNotify(NMHDR* pNMHDR)
{
CDlgInput1 cDlgInput1;
NM_UPDOWN* pMNUD;
int idCtrl;
BOOL bSpinDown;
Expand Down
4 changes: 2 additions & 2 deletions sakura_core/dlg/CDlgProfileMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ void CDlgProfileMgr::CreateProf()
std::wstring strTitle = LS(STR_DLGPROFILE_NEW_PROF_TITLE);
std::wstring strMessage = LS(STR_DLGPROFILE_NEW_PROF_MSG);
szText[0] = L'\0';
if( !cDlgInput1.DoModal(::GetModuleHandle(NULL), GetHwnd(), strTitle.c_str(), strMessage.c_str(), max_size, szText) ){
if( !cDlgInput1.DoModal(::GetModuleHandle(NULL), GetHwnd(), strTitle.c_str(), strMessage.c_str(), max_size - 1, szText) ){
return;
}
if( szText[0] == L'\0' ){
Expand Down Expand Up @@ -402,7 +402,7 @@ void CDlgProfileMgr::RenameProf()
std::wstring strTitle = LS(STR_DLGPROFILE_RENAME_TITLE);
std::wstring strMessage = LS(STR_DLGPROFILE_RENAME_MSG);
int max_size = _MAX_PATH;
if( !cDlgInput1.DoModal(::GetModuleHandle(NULL), GetHwnd(), strTitle.c_str(), strMessage.c_str(), max_size, szText) ){
if( !cDlgInput1.DoModal(::GetModuleHandle(NULL), GetHwnd(), strTitle.c_str(), strMessage.c_str(), max_size - 1, szText) ){
return;
}
if( szText[0] == L'\0' ){
Expand Down
4 changes: 2 additions & 2 deletions sakura_core/outline/CDlgFileTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -776,11 +776,11 @@ BOOL CDlgFileTree::OnBnClicked( int wID )
std::wstring strTitle = LS(STR_DLGREPLC_STR);
WCHAR szPathFrom[_MAX_PATH];
szPathFrom[0] = L'\0';
if( dlgInput.DoModal(G_AppInstance(), GetHwnd(), strTitle.c_str(), strMsg.c_str(), _countof(szPathFrom), szPathFrom) ){
if( dlgInput.DoModal(G_AppInstance(), GetHwnd(), strTitle.c_str(), strMsg.c_str(), _countof(szPathFrom) - 1, szPathFrom) ){
WCHAR szPathTo[_MAX_PATH];
szPathTo[0] = L'\0';
strMsg = LS(STR_FILETREE_REPLACE_PATH_TO);
if( dlgInput.DoModal( G_AppInstance(), GetHwnd(), strTitle.c_str(), strMsg.c_str(), _countof(szPathTo), szPathTo) ){
if( dlgInput.DoModal( G_AppInstance(), GetHwnd(), strTitle.c_str(), strMsg.c_str(), _countof(szPathTo) - 1, szPathTo) ){
int nItemsCount = (int)m_fileTreeSetting.m_aItems.size();
for( int i = 0; i < nItemsCount; i++ ){
SFileTreeItem& item = m_fileTreeSetting.m_aItems[i];
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/print/CPrintPreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ void CPrintPreview::OnPreviewGoDirectPage( void )
m_hwndPrintPreviewBar,
LS(STR_ERR_DLGPRNPRVW5),
szMessage,
INPUT_PAGE_NUM_LEN,
_countof(szPageNum) - 1,
szPageNum
);
if( FALSE != bDlgInputPageResult ){
Expand Down

0 comments on commit 95d9b03

Please sign in to comment.