From 9df1d95dd219f70c5a744647c546a1701b65c803 Mon Sep 17 00:00:00 2001 From: lyj_love_code Date: Wed, 24 Nov 2021 15:55:12 +0800 Subject: [PATCH] fix codex Signed-off-by: lyj_love_code --- frameworks/native/format.cpp | 12 ++++++------ frameworks/native/include/format.h | 2 +- services/hilogtool/include/log_controller.h | 2 +- services/hilogtool/include/log_display.h | 2 +- services/hilogtool/log_controller.cpp | 4 ++-- services/hilogtool/log_display.cpp | 4 ++-- services/hilogtool/main.cpp | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/frameworks/native/format.cpp b/frameworks/native/format.cpp index d4ad608..fd675c4 100644 --- a/frameworks/native/format.cpp +++ b/frameworks/native/format.cpp @@ -59,7 +59,7 @@ int ColorFromLevel(uint16_t level) } } -int HilogShowTimeBuffer(char* buffer, int bufLen, int32_t showFormat, +int HilogShowTimeBuffer(char* buffer, int bufLen, uint32_t showFormat, const HilogShowFormatBuffer& contentOut) { time_t now = contentOut.tv_sec; @@ -72,7 +72,7 @@ int HilogShowTimeBuffer(char* buffer, int bufLen, int32_t showFormat, if ((showFormat & (1 << EPOCH_SHOWFORMAT)) || (showFormat & (1 << MONOTONIC_SHOWFORMAT))) { ret = snprintf_s(buffer, bufLen, bufLen - 1, (showFormat & (1 << MONOTONIC_SHOWFORMAT)) ? "%6lld" : "%19lld", (long long)now); - timeLen += ((ret > 0) ? ret : 0); + timeLen += ((ret > 0) ? ret : 0); } else { ptm = localtime(&now); if (ptm == nullptr) { @@ -82,11 +82,11 @@ int HilogShowTimeBuffer(char* buffer, int bufLen, int32_t showFormat, timeLen = strlen(buffer); if (showFormat & (1 << YEAR_SHOWFORMAT)) { timeLen = strftime(buffer, bufLen, "%Y-%m-%d %H:%M:%S", ptm); - timeLen = strlen(buffer); + timeLen = strlen(buffer); } if (showFormat & (1 << ZONE_SHOWFORMAT)) { timeLen = strftime(buffer, bufLen, "%z %m-%d %H:%M:%S", ptm); - timeLen = strlen(buffer); + timeLen = strlen(buffer); } if (showFormat & (1 << TIME_NSEC_SHOWFORMAT)) { ret = snprintf_s(buffer + timeLen, bufLen - timeLen, bufLen - timeLen - 1, @@ -99,13 +99,13 @@ int HilogShowTimeBuffer(char* buffer, int bufLen, int32_t showFormat, } else { ret = snprintf_s(buffer + timeLen, bufLen - timeLen, bufLen - timeLen - 1, ".%03llu", nsecTime / NS2MS); - timeLen += ((ret > 0) ? ret : 0); + timeLen += ((ret > 0) ? ret : 0); } } return timeLen; } -void HilogShowBuffer(char* buffer, int bufLen, const HilogShowFormatBuffer& contentOut, int32_t showFormat) +void HilogShowBuffer(char* buffer, int bufLen, const HilogShowFormatBuffer& contentOut, uint32_t showFormat) { int logLen = 0; int ret = 0; diff --git a/frameworks/native/include/format.h b/frameworks/native/include/format.h index 585a121..a3a6923 100644 --- a/frameworks/native/include/format.h +++ b/frameworks/native/include/format.h @@ -21,7 +21,7 @@ namespace OHOS { namespace HiviewDFX { const char* ParsedFromLevel(uint16_t level); int ColorFromLevel(uint16_t level); -void HilogShowBuffer(char* buffer, int bufLen, const HilogShowFormatBuffer& contentOut, int32_t showFormat); +void HilogShowBuffer(char* buffer, int bufLen, const HilogShowFormatBuffer& contentOut, uint32_t showFormat); } // namespace HiviewDFX } // namespace OHOS #endif /* LOG_FORMAT_H */ diff --git a/services/hilogtool/include/log_controller.h b/services/hilogtool/include/log_controller.h index 3bfad11..cc5bb15 100644 --- a/services/hilogtool/include/log_controller.h +++ b/services/hilogtool/include/log_controller.h @@ -34,7 +34,7 @@ inline void PrintBuffer(void* pBuff, unsigned int nLen); void NextRequestOp(SeqPacketSocketClient& controller, uint16_t sendId); void LogQueryRequestOp(SeqPacketSocketClient& controller, const HilogArgs* context); void LogQueryResponseOp(SeqPacketSocketClient& controller, char* recvBuffer, uint32_t bufLen, - const HilogArgs* context, int32_t format); + const HilogArgs* context, uint32_t format); int32_t BufferSizeOp(SeqPacketSocketClient& controller, uint8_t msgCmd, const std::string& logTypeStr, const std::string& buffSizeStr); int32_t StatisticInfoOp(SeqPacketSocketClient& controller, uint8_t msgCmd, diff --git a/services/hilogtool/include/log_display.h b/services/hilogtool/include/log_display.h index 6d24551..b92025b 100644 --- a/services/hilogtool/include/log_display.h +++ b/services/hilogtool/include/log_display.h @@ -25,7 +25,7 @@ namespace HiviewDFX { using namespace std; int32_t ControlCmdResult(const char* message); std::string ParseErrorCode(ErrorCode errorCode); -void HilogShowLog(int32_t showFormat, HilogDataMessage* contentOut, +void HilogShowLog(uint32_t showFormat, HilogDataMessage* contentOut, const HilogArgs* context, vector& tailBuffer); HilogShowFormat HilogFormat (const char* formatArg); } // namespace HiviewDFX diff --git a/services/hilogtool/log_controller.cpp b/services/hilogtool/log_controller.cpp index 24ef3cd..994eec7 100644 --- a/services/hilogtool/log_controller.cpp +++ b/services/hilogtool/log_controller.cpp @@ -211,7 +211,7 @@ void LogQueryRequestOp(SeqPacketSocketClient& controller, const HilogArgs* conte } void LogQueryResponseOp(SeqPacketSocketClient& controller, char* recvBuffer, uint32_t bufLen, - const HilogArgs* context, int32_t format) + const HilogArgs* context, uint32_t format) { static std::vector tailBuffer; LogQueryResponse* rsp = reinterpret_cast(recvBuffer); @@ -252,7 +252,7 @@ void LogQueryResponseOp(SeqPacketSocketClient& controller, char* recvBuffer, uin } } } -int32_t BufferSizeOp(SeqPacketSocketClient& controller, uint8_t msgCmd, const std::string& logTypeStr, +int32_t BufferSizeOp(SeqPacketSocketClient& controller, uint8_t msgCmd, const std::string& logTypeStr, const std::string& buffSizeStr) { char msgToSend[MSG_MAX_LEN] = {0}; diff --git a/services/hilogtool/log_display.cpp b/services/hilogtool/log_display.cpp index 648b265..59f496e 100644 --- a/services/hilogtool/log_display.cpp +++ b/services/hilogtool/log_display.cpp @@ -70,7 +70,7 @@ unordered_map errorMsg {ERR_BUFF_SIZE_INVALID, "Invalid buffer size, buffer size should be more than 0 and less than " + to_string(MAX_BUFFER_SIZE)}, {ERR_COMMAND_INVALID, "Invalid command, only one control command can be executed each time"} -}; +}; string ParseErrorCode(ErrorCode errorCode) { @@ -436,7 +436,7 @@ bool HilogMatchByRegex(string context, string regExpArg) } } -void HilogShowLog(int32_t showFormat, HilogDataMessage* data, const HilogArgs* context, +void HilogShowLog(uint32_t showFormat, HilogDataMessage* data, const HilogArgs* context, vector& tailBuffer) { if (data->sendId == SENDIDN) { diff --git a/services/hilogtool/main.cpp b/services/hilogtool/main.cpp index 3c85b81..69867cc 100644 --- a/services/hilogtool/main.cpp +++ b/services/hilogtool/main.cpp @@ -174,7 +174,7 @@ int HilogEntry(int argc, char* argv[]) regex delimiter(","); context.noBlockMode = 0; int32_t ret = 0; - int32_t showFormat = 0; + uint32_t showFormat = 0; int controlCount = 0; for (int argsCount = 0; argsCount < argc; argsCount++) { args.push_back(argv[argsCount]); -- Gitee