diff --git a/src/functions.h b/src/functions.h index a5aca84..dcbcbba 100755 --- a/src/functions.h +++ b/src/functions.h @@ -87,6 +87,7 @@ public: bool Find(const std::string & key, Function ** fun); bool Find(const std::wstring & key, Function ** fun); void Clear(); + size_t Size(); private: @@ -245,6 +246,12 @@ void Functions::Clear() } +template +size_t Functions::Size() +{ + return functions_tab.size(); +} + } // namespace Ezc diff --git a/src/pattern.cpp b/src/pattern.cpp index 9a8fda7..441b8eb 100755 --- a/src/pattern.cpp +++ b/src/pattern.cpp @@ -279,7 +279,7 @@ void Pattern::SetCommentary(const std::wstring & com_start, const std::wstring & void Pattern::CreateMsg(std::wstring & out, const char * type, const char * arg) { out = commentary_start; - out += L"EZC: "; + out += L"Ezc: "; AssignString(type, out, false); if( arg ) @@ -295,7 +295,7 @@ void Pattern::CreateMsg(std::wstring & out, const char * type, const char * arg) void Pattern::CreateMsg(std::wstring & out, const wchar_t * type, const wchar_t * arg) { out = commentary_start; - out += L"EZC: "; + out += L"Ezc: "; out += type; if( arg ) @@ -412,7 +412,7 @@ bool Pattern::ReadFileFromDir(const std::wstring & dir, const wchar_t * name, st ReadFile(file, result); #ifdef EZC_USE_WINIX_LOGGER - log << log3 << "EZC: read pattern: " << afile_name << logend; + log << log3 << "Ezc: read pattern: " << afile_name << logend; #endif file_name.clear(); @@ -932,7 +932,7 @@ void Pattern::CreateTreeReadIncludeSkipAllowFlag(Item & item) if( include_level > include_level_max ) { #ifdef EZC_USE_WINIX_LOGGER - log << log1 << "EZC: \"include\" directive has reached the maximum level" << logend; + log << log1 << "Ezc: \"include\" directive has reached the maximum level" << logend; #endif return; diff --git a/src/stringconv.cpp b/src/stringconv.cpp index 04e6445..7994cae 100755 --- a/src/stringconv.cpp +++ b/src/stringconv.cpp @@ -51,7 +51,9 @@ size_t len; dst.clear(); for(len=0 ; src[len] ; ++len){} - dst.reserve(len); + + if( dst.capacity() < dst.size() + len ) + dst.reserve(dst.size() + len + 128); for( ; *src ; ++src ) dst += static_cast(*src); @@ -63,7 +65,8 @@ void AssignString(const std::string & src, std::wstring & dst, bool clear) if( clear ) dst.clear(); - dst.reserve(src.size()); + if( dst.capacity() < dst.size() + src.size() ) + dst.reserve(dst.size() + src.size() + 128); for(size_t i=0 ; i(src[i]); @@ -78,7 +81,9 @@ size_t len; dst.clear(); for(len=0 ; src[len] ; ++len){} - dst.reserve(len); + + if( dst.capacity() < dst.size() + len ) + dst.reserve(dst.size() + len + 128); for( ; *src ; ++src ) dst += static_cast(*src); @@ -90,7 +95,8 @@ void AssignString(const std::wstring & src, std::string & dst, bool clear) if( clear ) dst.clear(); - dst.reserve(src.size()); + if( dst.capacity() < dst.size() + src.size() ) + dst.reserve(dst.size() + src.size() + 128); for(size_t i=0 ; i(src[i]);