Skip to content

Commit

Permalink
Merge 2ebe5a4 into cac7829
Browse files Browse the repository at this point in the history
  • Loading branch information
sanomari authored Jun 12, 2022
2 parents cac7829 + 2ebe5a4 commit e1dda7c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions sakura_core/CGrepAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1738,17 +1738,20 @@ class CError_WriteFileOpen

class CWriteData{
public:
CWriteData(int& hit, LPCWSTR name, ECodeType code_, bool bBom_, bool bOldSave_, CNativeW& message)
CWriteData(int& hit, LPCWSTR name_, ECodeType code_, bool bBom_, bool bOldSave_, CNativeW& message)
:nHitCount(hit)
,fileName(name)
,fileName(name_)
,name(name_)
,code(code_)
,bBom(bBom_)
,bOldSave(bOldSave_)
,bufferSize(0)
,out(NULL)
,pcCodeBase(CCodeFactory::CreateCodeBase(code_,0))
,memMessage(message)
{}
{
name += L".skrnew";
}
void AppendBuffer(const CNativeW& strLine)
{
if( !out ){
Expand All @@ -1765,8 +1768,6 @@ class CWriteData{
void OutputHead()
{
if( !out ){
std::wstring name = fileName;
name += L".skrnew";
try{
out = new CBinaryOutputStream(name.c_str(), true);
}catch( const CError_FileOpen& ){
Expand Down Expand Up @@ -1819,8 +1820,6 @@ class CWriteData{
return;
}
}
std::wstring name(fileName);
name += L".skrnew";
if( FALSE == ::MoveFile( name.c_str(), fileName ) ){
memMessage.AppendString( LS(STR_GREP_REP_ERR_REPLACE) );
memMessage.AppendStringF( L"[%s]\r\n", fileName );
Expand All @@ -1835,14 +1834,13 @@ class CWriteData{
out->Close();
delete out;
out = NULL;
std::wstring name(fileName);
name += L".skrnew";
::DeleteFile( name.c_str() );
}
}
private:
int& nHitCount;
LPCWSTR fileName;
std::wstring name;
ECodeType code;
bool bBom;
bool bOldSave;
Expand Down

0 comments on commit e1dda7c

Please sign in to comment.