diff --git a/frameworks/native/format.cpp b/frameworks/native/format.cpp index d4ad608e3c410fe279f38ca1b95b90c8c0d86d53..fd675c416ceafb05b3a175f1cb6c7b5026d359b4 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 585a1218e68cb7606db241e31ddcc94b960a8310..a3a6923c126b12c4043081dbbc0f9702c35fb938 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 3bfad11741851526f562b0f9fdd6acb03097b21a..cc5bb158e935619779b62cd4b76171f1c49aa89c 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 6d24551ae9c8a1d4f18360a84dcd4ada77f94606..b92025ba34c05d94b5587b674a760ea466abca2a 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 24ef3cd30d31fd01b08bef8a9435648ad6261542..994eec7e7d930d62a5610d8cf849aebc220b5b8f 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 648b265915231887514b4dfa935c01b857095e46..59f496e2a8c463a61b6030c898dc271cf636ac5f 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 3c85b815ad743095579f7c48cbde347bc8c2c176..69867cc372586fccbaf8021b8384f71f6734f93b 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]);