diff -r 7fdc9a71d314 -r 8ad140f3dd41 analyzetool/commandlineengine/src/arguments.cpp --- a/analyzetool/commandlineengine/src/arguments.cpp Wed Sep 15 13:53:27 2010 +0300 +++ b/analyzetool/commandlineengine/src/arguments.cpp Wed Oct 13 16:17:58 2010 +0300 @@ -22,13 +22,11 @@ bool parseAnalyzeArguments( vector& vArgs, ARGUMENTS& args ); bool parseParseArguments( vector& vArgs, ARGUMENTS& args ); bool checkDataFileName( string& sFileName ); -bool checkDataFilePath( string& sFilePath ); bool parseSbsConfiguration( string& sConfiguration, ARGUMENTS& args ); // Constants for old "hooking" parameter parsing. #define INVALID_PARAMETER "AnalyzeTool : Error, invalid parameter: " -const char DATAFILENAME_INVALID_CHARS[] = " &^+-@$*()|\\/[]{}<>?;:,\"'"; -const char DATAFILEPATH_INVALID_CHARS[] = " &^+-@$%*()|/[]{}<>?;,\"'"; +const char DATAFILENAME_INVALID_CHARS[] = " &^+-@$%*()|\\/[]{}<>?;:,\"'"; /** * Check datafile name for invalid characters. @@ -46,40 +44,6 @@ } /** -* Check datafile path for invalid characters and correct format. -* @return true if file path ok. -*/ -bool checkDataFilePath( string& sFilePath ) -{ - for ( size_t i = 0; i < sFilePath.length(); i++ ) - { - char c = sFilePath.at( i ); - if( strchr( DATAFILEPATH_INVALID_CHARS, c ) != 0 ) - return false; - // first char must be drive letter a-z - if( i == 0 && ( c = tolower( c ) < 'a' || c > 'z' ) ) - return false; - // if last char is not '\', add it - if( i == sFilePath.length()-1 && c != '\\' ) - sFilePath.append( "\\" ); - } - - // ':\' after drive letter - if( sFilePath.find( ":\\" ) != 1 ) - return false; - - // there can be only one ':' on pos 1 - if( sFilePath.find( ":", 2 ) != string::npos ) - return false; - - //check double slashes - if( sFilePath.find( "\\\\" ) != string::npos ) - return false; - - return true; -} - -/** * Parse base arguments from given vector of strings. * Removes debug / help arguments from vector. */ @@ -214,19 +178,16 @@ args.eMainSwitch = SWITCH_HELP; else if ( ! _stricmp( (*it).c_str(), "-me" ) ) { - cout << AT_MSG << "This feature is no longer supported. You can use -tr parameter for output to trace. \n" << endl; + args.eMainSwitch = SWITCH_HOOK; + args.eHookSwitch = HOOK_EXTERNAL; } - else if ( ! _stricmp( (*it).c_str(), "-e" ) || ! _stricmp( (*it).c_str(), "-tr" ) ) + else if ( ! _stricmp( (*it).c_str(), "-e" ) ) { args.eMainSwitch = SWITCH_HOOK; args.eHookSwitch = HOOK_EXTERNAL_FAST; } else if ( ! _stricmp( (*it).c_str(), "-mi" ) ) { - cout << AT_MSG << "This feature is no longer supported. You can use -lf parameter for logging to file. \n" << endl; - } - else if ( ! _stricmp( (*it).c_str(), "-lf" ) ) - { args.eMainSwitch = SWITCH_HOOK; args.eHookSwitch = HOOK_INTERNAL; } @@ -394,8 +355,7 @@ } else if ( ! _stricmp( it->c_str(), "sbs" ) || ! _stricmp( it->c_str(), "abld" ) - || ! _stricmp( it->c_str(), "-f" ) - || ! _stricmp( it->c_str(), "-fp" ) ) + || ! _stricmp( it->c_str(), "-f" ) ) { bRet = false; cout << AT_MSG << "Error, missing call stack size parameter." << endl; @@ -447,13 +407,13 @@ if ( it == vArgs.end() ) { bRet = false; - cout << AT_MSG << "Error, missing log file name." << endl; + cout << AT_MSG << "Error, missing internal data gathering file name." << endl; break; } else if ( ! _stricmp( it->c_str(), "sbs" ) || ! _stricmp( it->c_str(), "abld" ) ) { bRet = false; - cout << AT_MSG << "Error, missing log file name." << endl; + cout << AT_MSG << "Error, missing internal data gathering file name." << endl; break; } else @@ -467,41 +427,7 @@ else { bRet = false; - cout << AT_MSG << "Error, specified log file name contains invalid character(s)." << endl; - break; - } - } - } - // Data file path. - else if ( _stricmp( it->c_str(), "-fp" ) == 0 ) - { - it++; - if ( it == vArgs.end() ) - { - bRet = false; - cout << AT_MSG << "Error, missing path for log file." << endl; - break; - } - else if ( ! _stricmp( it->c_str(), "sbs" ) || ! _stricmp( it->c_str(), "abld" ) ) - { - bRet = false; - cout << AT_MSG << "Error, missing path for log file." << endl; - break; - } - else - { - string sFormattedPath = string(*it); - if ( checkDataFilePath( sFormattedPath ) ) - { - // Pickup filename. - args.HOOK.bDataFilePath = true; - args.HOOK.sDataFilePath = sFormattedPath; - } - else - { - bRet = false; - cout << AT_MSG << "Error, specified log file path contains invalid character(s) " - << "or is in wrong format. Please, check help for correct format," << endl; + cout << AT_MSG << "Error, specified internal data gathering file name contains invalid character(s)." << endl; break; } }