From 37cfa1bd8bd68eb12aa8c5d4097537c2859d4265 Mon Sep 17 00:00:00 2001 From: wangyikai Date: Mon, 30 Jun 2025 16:58:55 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90hc-gen=E3=80=91hc-gen=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E5=AE=89=E5=85=A8=E8=A7=84=E8=8C=83=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wangyikai --- framework/tools/hc-gen/src/ast.h | 2 +- framework/tools/hc-gen/src/option.cpp | 2 +- framework/tools/hc-gen/src/startup_cfg_gen.cpp | 6 +++--- framework/tools/hc-gen/src/text_gen.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/framework/tools/hc-gen/src/ast.h b/framework/tools/hc-gen/src/ast.h index 17a4b1411..af5be3e62 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 c661d3301..f6176249d 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 bcb5d2f18..9aca5ff2c 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 6ac78346a..d8387a5ba 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; } -- Gitee