Skip to content

Commit

Permalink
Merge pull request #1618 from berryzplus/feature/refactoring_of_cmemory
Browse files Browse the repository at this point in the history
メモリバッファクラスをx64対応できるように書き替える
  • Loading branch information
berryzplus authored Apr 11, 2021
2 parents ab89e26 + 690659c commit f62f209
Show file tree
Hide file tree
Showing 16 changed files with 477 additions and 469 deletions.
2 changes: 1 addition & 1 deletion sakura_core/_os/CClipboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ bool CClipboard::GetText(CNativeW* cmemBuf, bool* pbColumnSelect, bool* pbLineSe
CMemory cmemSjis( szData, GlobalSize(hText) );
CNativeW cmemUni;
CShiftJis::SJISToUnicode(cmemSjis, &cmemUni);
cmemSjis.Clean();
cmemSjis.Reset();
// '\0'までを取得
cmemUni._SetStringLength(wcslen(cmemUni.GetStringPtr()));
cmemUni.swap(*cmemBuf);
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/charset/CCodeBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "CEol.h"
#include "env/CommonSetting.h"

void CCodeBase::GetBom(CMemory* pcmemBom){ pcmemBom->Clear(); } //!< BOMデータ取得
void CCodeBase::GetBom(CMemory* pcmemBom){ pcmemBom->Reset(); } //!< BOMデータ取得

// 表示用16表示 UNICODE → Hex 変換 2008/6/9 Uchi
EConvertResult CCodeBase::UnicodeToHex(const wchar_t* cSrc, const int iSLen, WCHAR* pDst, const CommonSetting_Statusbar* psStatusbar)
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 @@ -225,7 +225,7 @@ void CCodePage::GetEol(CMemory* pcmemEol, EEolType eEolType)
CodeToUnicode(*pcmemEol, &temp2);
// 双方向変換ができる場合だけ設定
if( !CNativeW::IsEqual(temp, temp2) ){
pcmemEol->Clear();
pcmemEol->Reset();
}
}

Expand All @@ -237,7 +237,7 @@ void CCodePage::GetBom(CMemory* pcmemBom)
CNativeW temp2;
CodeToUnicode(*pcmemBom, &temp2);
if( !CNativeW::IsEqual(temp, temp2) ){
pcmemBom->Clear();
pcmemBom->Reset();
}
}

Expand Down
13 changes: 5 additions & 8 deletions sakura_core/charset/CUnicode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,9 @@ EConvertResult CUnicode::_UnicodeToUnicode_in( const CMemory& cSrc, CNativeW* pD

if( bBigEndian ){
if( &cSrc != pDstMem2 && !bCopy ){
// コピーしつつ UnicodeBe -> Unicode
pDstMem2->SwabHLByte(cSrc);
}else{
pDstMem2->SwapHLByte(); // UnicodeBe -> Unicode
pDstMem2->SetRawDataHoldBuffer( cSrc );
}
pDstMem2->SwapHLByte(); // UnicodeBe -> Unicode
}else if( !bCopy ){
pDstMem2->SetRawDataHoldBuffer(pSrc, nSrcLen);
}
Expand All @@ -71,11 +69,10 @@ EConvertResult CUnicode::_UnicodeToUnicode_in( const CMemory& cSrc, CNativeW* pD
EConvertResult CUnicode::_UnicodeToUnicode_out( const CNativeW& cSrc, CMemory* pDstMem, const bool bBigEndian )
{
if( bBigEndian == true ){
if( cSrc._GetMemory() == pDstMem ){
pDstMem->SwapHLByte(); // Unicode -> UnicodeBe
}else{
pDstMem->SwabHLByte(*(cSrc._GetMemory()));
if( cSrc._GetMemory() != pDstMem ){
pDstMem->SetRawDataHoldBuffer( *(cSrc._GetMemory()) );
}
pDstMem->SwapHLByte(); // Unicode -> UnicodeBe
}else{
if( cSrc._GetMemory() != pDstMem ){
pDstMem->SetRawDataHoldBuffer(*(cSrc._GetMemory()));
Expand Down
4 changes: 2 additions & 2 deletions sakura_core/convert/CDecode_UuDecode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ bool CDecode_UuDecode::DoDecode( const CNativeW& pcSrc, CMemory* pcDst )
CEol ceol;
bool bsuccess = false;

pcDst->Clear();
pcDst->Reset();
psrc = pcSrc.GetStringPtr();
nsrclen = pcSrc.GetStringLength();

Expand All @@ -49,7 +49,7 @@ bool CDecode_UuDecode::DoDecode( const CNativeW& pcSrc, CMemory* pcDst )
return false;
}
pcDst->AllocBuffer( (nsrclen / 4) * 3 + 10 );
pw_base = pw = static_cast<char *>( pcDst->GetRawPtr() );
pw_base = pw = reinterpret_cast<char *>( pcDst->GetRawPtr() );

// 先頭の改行・空白文字をスキップ
for( ncuridx = 0; ncuridx < nsrclen; ++ncuridx ){
Expand Down
Loading

0 comments on commit f62f209

Please sign in to comment.