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 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;