diff --git a/framework/tools/hc-gen/src/ast.h b/framework/tools/hc-gen/src/ast.h index 17a4b14118e22c34991377a71d2a6079854e20b2..af5be3e62097fa1c86de36060f1e3e693a43732c 100644 --- a/framework/tools/hc-gen/src/ast.h +++ b/framework/tools/hc-gen/src/ast.h @@ -383,7 +383,7 @@ public: return false; } } else { - uint32_t ret = forwardCallback(roundWalkObj, walkDepth); + auto ret = forwardCallback(roundWalkObj, walkDepth); /* when callback return EASTWALKBREAK, not walk current's child */ if (ret && ret != EASTWALKBREAK) { return false; diff --git a/framework/tools/hc-gen/src/option.cpp b/framework/tools/hc-gen/src/option.cpp index c661d330176bb4fcf5d0d6754ba6010040bbc7c8..f6176249d398e35938e52a3b62c27dcc58649441 100644 --- a/framework/tools/hc-gen/src/option.cpp +++ b/framework/tools/hc-gen/src/option.cpp @@ -42,7 +42,7 @@ Option &Option::Parse(int argc, char **argv) break; } - if (optind >= argc) { + if (optind >= argc || optind < 0) { Logger().Error() << "Miss input file name"; SetOptionError(); break; diff --git a/framework/tools/hc-gen/src/startup_cfg_gen.cpp b/framework/tools/hc-gen/src/startup_cfg_gen.cpp index bcb5d2f18e7893ba9981b06ca9c842ac304f2bd7..9aca5ff2c697daab5a3442edaaf6c88b84b988ac 100644 --- a/framework/tools/hc-gen/src/startup_cfg_gen.cpp +++ b/framework/tools/hc-gen/src/startup_cfg_gen.cpp @@ -191,8 +191,8 @@ void StartupCfgGen::HostInfoOutput(const std::string &name, bool end) if (!hostInfoMap_[name].initConfig.empty()) { for (auto &info : hostInfoMap_[name].initConfig) { - int firstQuotePos = info.find("\""); - int secondQuotePos = info.find("\"", firstQuotePos + 1); + size_t firstQuotePos = info.find("\""); + size_t secondQuotePos = info.find("\"", firstQuotePos + 1); configedKeywords.insert(info.substr(firstQuotePos + 1, secondQuotePos - (firstQuotePos + 1))); } } @@ -365,7 +365,7 @@ void StartupCfgGen::GetMallocOpt(const std::shared_ptr &hostInfo, std::vector mallocOptions = {}; GetConfigVector(term, mallocOptions); for (auto mallocOption : mallocOptions) { - int separatorPos = mallocOption.find(MALLOPT_SEPARATOR); + size_t separatorPos = mallocOption.find(MALLOPT_SEPARATOR); std::string malloptKey = mallocOption.substr(0, separatorPos); std::string malloptValue = mallocOption.substr(separatorPos + 1, mallocOption.length() - (separatorPos + 1)); diff --git a/framework/tools/hc-gen/src/text_gen.cpp b/framework/tools/hc-gen/src/text_gen.cpp index 6ac78346ab59110f6afbb3c60a91894c175178b2..d8387a5ba8079e4ff118c7bde43d66422d61ab7d 100644 --- a/framework/tools/hc-gen/src/text_gen.cpp +++ b/framework/tools/hc-gen/src/text_gen.cpp @@ -372,7 +372,7 @@ uint32_t TextGen::ImplementCloseBraceGen(const std::shared_ptr &objec if (object == ast_->GetAstRoot()) { ofs_ << "};\n"; } else { - ofs_ << Indent(depth) << "},\n"; + ofs_ << Indent(static_cast(depth)) << "},\n"; } return ofs_.good() ? NOERR : EOUTPUT; }