From d0e51fb5f0bef16d299da6735e771a03a152eeca Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Wed, 26 Mar 2014 19:43:12 +0400 Subject: [PATCH 1/2] Make use of Visual C++ runtime memory leak tracing --- cli/main.cpp | 5 +++++ lib/config.h | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/cli/main.cpp b/cli/main.cpp index 6333953cb..a203c9818 100644 --- a/cli/main.cpp +++ b/cli/main.cpp @@ -108,6 +108,11 @@ void CheckOther::checkZeroDivision() */ int main(int argc, char* argv[]) { + // MS Visual C++ memory leak debug tracing +#if defined(_MSC_VER) && defined(_DEBUG) + _CrtSetDbgFlag( _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ) | _CRTDBG_LEAK_CHECK_DF); +#endif + CppCheckExecutor exec; #ifdef _WIN32 char exename[1024] = {0}; diff --git a/lib/config.h b/lib/config.h index 130164d5e..b81b499c1 100644 --- a/lib/config.h +++ b/lib/config.h @@ -13,4 +13,10 @@ # define CPPCHECKLIB #endif +// MS Visual C++ memory leak debug tracing +#if defined(_MSC_VER) && defined(_DEBUG) +# define _CRTDBG_MAP_ALLOC +# include +#endif + #endif // configH From d0b37283284bb28193fe13d408a8c3a9e3937e76 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Thu, 27 Mar 2014 10:23:47 +0400 Subject: [PATCH 2/2] Get rid of assert in isdigit() when processing cyrillic characters. --- lib/token.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/token.cpp b/lib/token.cpp index c943c6192..ac3aa6f5d 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -76,7 +76,7 @@ void Token::update_property_info() _type = eVariable; else if (_type != eVariable && _type != eFunction && _type != eType) _type = eName; - } else if (std::isdigit(_str[0]) || (_str.length() > 1 && _str[0] == '-' && std::isdigit((unsigned char)_str[1]))) + } else if (std::isdigit((unsigned char)_str[0]) || (_str.length() > 1 && _str[0] == '-' && std::isdigit((unsigned char)_str[1]))) _type = eNumber; else if (_str.length() > 1 && _str[0] == '"' && _str[_str.length()-1] == '"') _type = eString;