Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion sakura_core/_os/CClipboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ bool CClipboard::GetText(IWBuffer* cmemBuf, bool* pbColumnSelect, bool* pbLineSe
}
if( hUnicode != NULL ){
wchar_t* szData = static_cast<wchar_t*>(::GlobalLock(hUnicode));
cmemBuf->Append( szData, GlobalSize(hUnicode)/2);
cmemBuf->Append( szData, GlobalSize(hUnicode) / 2 - 1);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

なんとも言えないけど正しくはこんな感じなんでしょうね。

		cmemBuf->Append( szData, wcsnlen(szData, GlobalSize(hUnicode) / 2))

GlobalSizeの戻り値を信用できるかどうかは微妙なので、自前でNUL終端を検索してやるのがベターです。

::GlobalUnlock(hUnicode);
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/_os/CClipboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct StdWStringBuffer : public IWBuffer {
try {
wstr->reserve(nDataLen);
}
catch (std::bad_alloc& exp) {
catch (std::bad_alloc&) {
;
}
}
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/cmd/CViewCommander_Clipboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ void CViewCommander::Command_INSTEXT(
}

if( nTextLen < 0 ){
nTextLen = CLogicInt(wcslen( pszText ));
nTextLen = wcslen( pszText );
}

CWaitCursor cWaitCursor( m_pCommanderView->GetHwnd(),
Expand Down