diff --git a/frameworks/libhilog/utils/log_utils.cpp b/frameworks/libhilog/utils/log_utils.cpp index be9ab9f6c8ae710959bacba176880ec0eba32870..0e3d8d12d2a594de9418a0611897fa8c92a7d92a 100644 --- a/frameworks/libhilog/utils/log_utils.cpp +++ b/frameworks/libhilog/utils/log_utils.cpp @@ -86,7 +86,7 @@ uint64_t Str2Size(const string& str) uint64_t index = str.size() - 1; uint64_t unit = g_SizeMap.GetValue(str[index]); - uint64_t value = stoull(str.substr(0, unit !=0 ? index : index + 1)); + uint64_t value = stoull(str.substr(0, unit != 0 ? index : index + 1)); return value * (unit != 0 ? unit : 1); } @@ -337,21 +337,21 @@ uint32_t GetBitsCount(uint64_t n) uint32_t count = 0; while (n != 0) { ++count; - n = n & (n-1); + n = n & (n - 1); } return count; } uint16_t GetBitPos(uint64_t n) { - if (!(n && (!(n & (n-1))))) { // only accpet the number which is power of 2 + if (!(n && (!(n & (n - 1))))) { // only accpet the number which is power of 2 return 0; } uint16_t i = 0; while (n >> (i++)) {} i--; - return i-1; + return i - 1; } enum class Radix { diff --git a/services/hilogd/log_stats.cpp b/services/hilogd/log_stats.cpp index c624610a123f4bf35db4d4c670f77d4d67075b99..fa181668dfd9732d6f2515c8c3312b0d9e354dc5 100644 --- a/services/hilogd/log_stats.cpp +++ b/services/hilogd/log_stats.cpp @@ -32,7 +32,7 @@ LogStats::LogStats() } LogStats::~LogStats() {} -static inline int idxLvl(uint16_t lvl) +static inline int IdxLvl(uint16_t lvl) { return static_cast(lvl) - LevelBase; } @@ -63,7 +63,7 @@ static void UpdateStats(StatsEntry &entry, const StatsInfo &info) entry.monoTimeAuditStart.SetTimeStamp(info.mono_sec, info.tv_nsec); } - int lvl = idxLvl(info.level); + int lvl = IdxLvl(info.level); entry.lines[lvl]++; entry.len[lvl] += info.len; entry.dropped += info.dropped; @@ -110,7 +110,7 @@ static void StatsInfo2NewStatsEntry(const StatsInfo &info, StatsEntry &entry) for (uint64_t &i : entry.len) { i = 0; } - int lvl = idxLvl(info.level); + int lvl = IdxLvl(info.level); entry.lines[lvl] = 1; entry.len[lvl] = info.len; } @@ -178,7 +178,7 @@ void LogStats::Count(const StatsInfo &info) { if (enable) { std::scoped_lock lk(lock); - int index = idxLvl(info.level); + int index = IdxLvl(info.level); totalLines[index]++; totalLens[index] += info.len; UpdateDomainTable(info);