From a29aaadf2feafb1379768bdc7aed75137d8ace15 Mon Sep 17 00:00:00 2001 From: hufeng Date: Thu, 16 Jun 2022 16:36:18 +0800 Subject: [PATCH] Fix the defect detected by static analysis tool Signed-off-by: hufeng Change-Id: Idc1d04ff9125e85501740b18310a804792f1180a --- ts2panda/ts2abc/main.cpp | 3 ++- ts2panda/ts2abc/ts2abc.cpp | 4 ++-- ts2panda/ts2abc/ts2abc.h | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ts2panda/ts2abc/main.cpp b/ts2panda/ts2abc/main.cpp index 3d69fada83..382a88797c 100644 --- a/ts2panda/ts2abc/main.cpp +++ b/ts2panda/ts2abc/main.cpp @@ -86,13 +86,14 @@ int main(int argc, const char *argv[]) std::string output; std::string data = ""; + std::string optLogLevel(options.GetOptLogLevelArg()); if (Preprocess(options, argParser, output, data, usage) == RETURN_FAILED) { return RETURN_FAILED; } if (!GenerateProgram(data, output, options.GetCompileByPipeArg(), - options.GetOptLevelArg(), options.GetOptLogLevelArg())) { + options.GetOptLevelArg(), optLogLevel)) { std::cerr << "call GenerateProgram fail" << std::endl; return RETURN_FAILED; } diff --git a/ts2panda/ts2abc/ts2abc.cpp b/ts2panda/ts2abc/ts2abc.cpp index bd84aaa274..277d29d21b 100644 --- a/ts2panda/ts2abc/ts2abc.cpp +++ b/ts2panda/ts2abc/ts2abc.cpp @@ -1277,8 +1277,8 @@ static bool ReadFromPipe(panda::pandasm::Program &prog) return true; } -bool GenerateProgram([[maybe_unused]] const std::string &data, std::string output, bool isParsingFromPipe, - int optLevel, std::string optLogLevel) +bool GenerateProgram([[maybe_unused]] const std::string &data, const std::string &output, bool isParsingFromPipe, + int optLevel, std::string &optLogLevel) { panda::pandasm::Program prog = panda::pandasm::Program(); prog.lang = panda::pandasm::extensions::Language::ECMASCRIPT; diff --git a/ts2panda/ts2abc/ts2abc.h b/ts2panda/ts2abc/ts2abc.h index 9a08c1569c..9e5a7653fe 100644 --- a/ts2panda/ts2abc/ts2abc.h +++ b/ts2panda/ts2abc/ts2abc.h @@ -48,8 +48,8 @@ enum class OptLevel { }; bool HandleJsonFile(const std::string &input, std::string &data); -bool GenerateProgram(const std::string &data, std::string output, bool isParsingFromPipe, - int optLevel, std::string optLogLevel); +bool GenerateProgram(const std::string &data, const std::string &output, bool isParsingFromPipe, + int optLevel, std::string &optLogLevel); bool GetDebugLog(); void ParseLogEnable(const Json::Value &rootValue); bool GetDebugModeEnabled(); -- Gitee