fixed: Item::Item(const Item & i) should clear the item table

git-svn-id: svn://ttmath.org/publicrep/ezc/trunk@330 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2010-12-06 00:22:38 +00:00
parent 0b09b5454f
commit c4f5f79218
2 changed files with 4 additions and 4 deletions

View File

@ -122,7 +122,7 @@ Item::Item()
Item::Item(const Item & i) : type(i.type), text(i.text), functions(i.functions) Item::Item(const Item & i) : type(i.type), text(i.text), file_name(i.file_name), functions(i.functions)
{ {
CopyItemTable(i); CopyItemTable(i);
} }
@ -133,8 +133,10 @@ Item & Item::operator=(const Item & i)
{ {
type = i.type; type = i.type;
text = i.text; text = i.text;
file_name = i.file_name;
functions = i.functions; functions = i.functions;
ClearItems();
CopyItemTable(i); CopyItemTable(i);
return *this; return *this;

View File

@ -374,7 +374,7 @@ void Pattern::ReadFile(const wchar_t * name, std::wstring & result)
{ {
if( !IsFileCorrect(name) ) if( !IsFileCorrect(name) )
{ {
CreateMsg(result, L"incorrect file name:", name); CreateMsg(result, L"incorrect file name: ", name);
} }
else else
{ {
@ -388,7 +388,6 @@ void Pattern::ReadFile(const wchar_t * name, std::wstring & result)
bool Pattern::ReadFileFromDir(const std::wstring & dir, const wchar_t * name, std::wstring & result) bool Pattern::ReadFileFromDir(const std::wstring & dir, const wchar_t * name, std::wstring & result)
{ {
if( dir.empty() ) if( dir.empty() )
@ -397,7 +396,6 @@ bool Pattern::ReadFileFromDir(const std::wstring & dir, const wchar_t * name, st
file_name = dir; file_name = dir;
file_name += '/'; file_name += '/';
file_name += name; file_name += name;
WideToUTF8(file_name, afile_name); WideToUTF8(file_name, afile_name);
std::ifstream file(afile_name.c_str()); std::ifstream file(afile_name.c_str());