Skip to content

Commit

Permalink
Merge pull request #396 from berryzplus/feature/upgrade_smart_ptr
Browse files Browse the repository at this point in the history
非推奨テンプレートstd::auto_ptrを一括置換する
  • Loading branch information
berryzplus authored Sep 2, 2018
2 parents e1bd5e3 + 196cc3f commit 01c31e1
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions sakura_core/CGrepAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void CGrepAgent::AddTail( CEditView* pcEditView, const CNativeW& cmem, bool bAdd
HANDLE out = ::GetStdHandle(STD_OUTPUT_HANDLE);
if( out && out != INVALID_HANDLE_VALUE ){
CMemory cmemOut;
std::auto_ptr<CCodeBase> pcCodeBase( CCodeFactory::CreateCodeBase(
std::unique_ptr<CCodeBase> pcCodeBase( CCodeFactory::CreateCodeBase(
pcEditView->GetDocument()->GetDocumentEncoding(), 0) );
pcCodeBase->UnicodeToCode( cmem, &cmemOut );
DWORD dwWrite = 0;
Expand Down Expand Up @@ -1593,7 +1593,7 @@ class CWriteData{
size_t bufferSize;
std::deque<CNativeW> buffer;
CBinaryOutputStream* out;
std::auto_ptr<CCodeBase> pcCodeBase;
std::unique_ptr<CCodeBase> pcCodeBase;
CNativeW& memMessage;
};

Expand Down
2 changes: 1 addition & 1 deletion sakura_core/CPropertyManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ bool CPropertyManager::OpenPropertySheetTypes( HWND hWnd, int nPageNum, CTypeCon
CPropTypes* pcPropTypes = new CPropTypes();
pcPropTypes->Create( G_AppInstance(), m_hwndOwner );

std::auto_ptr<STypeConfig> pType(new STypeConfig());
std::unique_ptr<STypeConfig> pType(new STypeConfig());
CDocTypeManager().GetTypeConfig(nSettingType, *pType);
pcPropTypes->SetTypeData(*pType);
// Mar. 31, 2003 genta メモリ削減のためポインタに変更しProperySheet内で取得するように
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/CWriteManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ EConvertResult CWriteManager::WriteFile_From_CDocLineMgr(
)
{
EConvertResult nRetVal = RESULT_COMPLETE;
std::auto_ptr<CCodeBase> pcCodeBase( CCodeFactory::CreateCodeBase(sSaveInfo.eCharCode,0) );
std::unique_ptr<CCodeBase> pcCodeBase( CCodeFactory::CreateCodeBase(sSaveInfo.eCharCode,0) );

{
// 変換テスト
Expand Down
4 changes: 2 additions & 2 deletions sakura_core/cmd/CViewCommander_File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ BOOL CViewCommander::Command_PUTFILE(
// 2007.09.08 genta CEditDoc::FileWrite()にならって砂時計カーソル
CWaitCursor cWaitCursor( m_pCommanderView->GetHwnd() );

std::auto_ptr<CCodeBase> pcSaveCode( CCodeFactory::CreateCodeBase(nSaveCharCode,0) );
std::unique_ptr<CCodeBase> pcSaveCode( CCodeFactory::CreateCodeBase(nSaveCharCode,0) );

bool bBom = false;
if (CCodeTypeName(nSaveCharCode).UseBom()) {
Expand All @@ -635,7 +635,7 @@ BOOL CViewCommander::Command_PUTFILE(
const CNativeW* pConvBuffer;
if( bBom ){
CNativeW cmemBom;
std::auto_ptr<CCodeBase> pcUtf16( CCodeFactory::CreateCodeBase(CODE_UNICODE,0) );
std::unique_ptr<CCodeBase> pcUtf16( CCodeFactory::CreateCodeBase(CODE_UNICODE,0) );
pcUtf16->GetBom(cmemBom._GetMemory());
cMem2.AppendNativeData(cmemBom);
cMem2.AppendNativeData(cMem);
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/convert/CConvert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void CConvertMediator::ConvMemory( CNativeW* pCMemory, EFunctionCode nFuncCode,
case F_CODECNV_AUTO2SJIS:
{
int nFlag = true;
std::auto_ptr<CCodeBase> pcCode( CCodeFactory::CreateCodeBase(ecode, nFlag) );
std::unique_ptr<CCodeBase> pcCode( CCodeFactory::CreateCodeBase(ecode, nFlag) );
pcCode->CodeToUnicode(*(pCMemory->_GetMemory()), pCMemory);
}
break;
Expand Down
8 changes: 4 additions & 4 deletions sakura_core/dlg/CDlgOpenFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ bool CDlgOpenFile::DoModal_GetOpenFileName( TCHAR* pszPath, EFilter eAddFiler )
}

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

/* 構造体の初期化 */
std::auto_ptr<CDlgOpenFileData> pData( new CDlgOpenFileData() );
std::unique_ptr<CDlgOpenFileData> pData( new CDlgOpenFileData() );
InitOfn( &pData->m_ofn ); // 2005.10.29 ryoji
pData->m_pcDlgOpenFile = this;
pData->m_ofn.lCustData = (LPARAM)(pData.get());
Expand Down Expand Up @@ -910,7 +910,7 @@ bool CDlgOpenFile::DoModal_GetSaveFileName( TCHAR* pszPath )
*/
bool CDlgOpenFile::DoModalOpenDlg( SLoadInfo* pLoadInfo, std::vector<std::tstring>* pFileNames, bool bOptions )
{
std::auto_ptr<CDlgOpenFileData> pData( new CDlgOpenFileData() );
std::unique_ptr<CDlgOpenFileData> pData( new CDlgOpenFileData() );
pData->m_bIsSaveDialog = FALSE; /* 保存のダイアログか */

bool bMultiSelect = pFileNames != NULL;
Expand Down Expand Up @@ -1011,7 +1011,7 @@ bool CDlgOpenFile::DoModalOpenDlg( SLoadInfo* pLoadInfo, std::vector<std::tstrin
*/
bool CDlgOpenFile::DoModalSaveDlg(SSaveInfo* pSaveInfo, bool bSimpleMode)
{
std::auto_ptr<CDlgOpenFileData> pData( new CDlgOpenFileData() );
std::unique_ptr<CDlgOpenFileData> pData( new CDlgOpenFileData() );
pData->m_bIsSaveDialog = TRUE; /* 保存のダイアログか */

// 2003.05.12 MIK
Expand Down
4 changes: 2 additions & 2 deletions sakura_core/dlg/CDlgPluginOption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void CDlgPluginOption::SetData( void )
ListView_DeleteAllItems( hwndList ); // リストを空にする
m_Line = -1; // 行非選択

std::auto_ptr<CDataProfile> cProfile( new CDataProfile );
std::unique_ptr<CDataProfile> cProfile( new CDataProfile );
cProfile->SetReadingMode();
cProfile->ReadProfile( m_cPlugin->GetOptionPath().c_str() );

Expand Down Expand Up @@ -226,7 +226,7 @@ int CDlgPluginOption::GetData( void )
// リスト
hwndList = GetItemHwnd( IDC_LIST_PLUGIN_OPTIONS );

std::auto_ptr<CDataProfile> cProfile( new CDataProfile );
std::unique_ptr<CDataProfile> cProfile( new CDataProfile );
cProfile->SetReadingMode();
cProfile->ReadProfile( m_cPlugin->GetOptionPath().c_str() );
cProfile->SetWritingMode();
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/dlg/CDlgTagJumpList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ int CDlgTagJumpList::SearchBestTag( void )
if( m_pcList->GetCount() <= 0 ) return -1; //選べません。
if( NULL == m_pszFileName ) return 0;

std::auto_ptr<TagPathInfo> mem_lpPathInfo( new TagPathInfo );
std::unique_ptr<TagPathInfo> mem_lpPathInfo( new TagPathInfo );
TagPathInfo* lpPathInfo= mem_lpPathInfo.get();
int nMatch1 = -1;
int nMatch2 = -1;
Expand Down
10 changes: 5 additions & 5 deletions sakura_core/typeprop/CDlgTypeList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ bool CDlgTypeList::InitializeType( void )
return false;
}
// _DefaultConfig(&types); //規定値をコピー
std::auto_ptr<STypeConfig> type(new STypeConfig());
std::unique_ptr<STypeConfig> type(new STypeConfig());
if( 0 != iDocType ){
CDocTypeManager().GetTypeConfig(CTypeConfig(0), *type); // 基本をコピー

Expand Down Expand Up @@ -624,8 +624,8 @@ bool CDlgTypeList::UpType()
// 基本の場合には何もしない
return true;
}
std::auto_ptr<STypeConfig> type1(new STypeConfig());
std::auto_ptr<STypeConfig> type2(new STypeConfig());
std::unique_ptr<STypeConfig> type1(new STypeConfig());
std::unique_ptr<STypeConfig> type2(new STypeConfig());
CDocTypeManager().GetTypeConfig(CTypeConfig(iDocType), *type1);
CDocTypeManager().GetTypeConfig(CTypeConfig(iDocType - 1), *type2);
--(type1->m_nIdx);
Expand All @@ -646,8 +646,8 @@ bool CDlgTypeList::DownType()
// 基本、最後の場合には何もしない
return true;
}
std::auto_ptr<STypeConfig> type1(new STypeConfig());
std::auto_ptr<STypeConfig> type2(new STypeConfig());
std::unique_ptr<STypeConfig> type1(new STypeConfig());
std::unique_ptr<STypeConfig> type2(new STypeConfig());
CDocTypeManager().GetTypeConfig(CTypeConfig(iDocType), *type1);
CDocTypeManager().GetTypeConfig(CTypeConfig(iDocType + 1), *type2);
++(type1->m_nIdx);
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/view/CEditView_ExecCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class COutputAdapterUTF8: public COutputAdapterDefault
bool OutputA(const ACHAR* pBuf, int size = -1);

protected:
std::auto_ptr<CCodeBase> pcCodeBase;
std::unique_ptr<CCodeBase> pcCodeBase;
};

/*! @brief 外部コマンドの実行
Expand Down

0 comments on commit 01c31e1

Please sign in to comment.