From 5289e462449a0f007fad15a89682134d9caac3a9 Mon Sep 17 00:00:00 2001 From: yaomanhai Date: Thu, 26 Aug 2021 10:36:51 +0000 Subject: [PATCH] code format Signed-off-by: yaomanhai --- frameworks/native/format.cpp | 2 +- frameworks/native/hilog_printf.cpp | 4 ++-- services/hilogd/log_buffer.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frameworks/native/format.cpp b/frameworks/native/format.cpp index 55d8481..b814ed7 100644 --- a/frameworks/native/format.cpp +++ b/frameworks/native/format.cpp @@ -160,7 +160,7 @@ void HilogShowBuffer(char* buffer, int bufLen, const HilogShowFormatBuffer& cont logLen += ((ret > 0) ? ret : 0); ret = snprintf_s(buffer + logLen, bufLen - logLen, bufLen - logLen - 1, " %s", contentOut.data + contentOut.tag_len); - logLen += ((ret > 0) ? ret : 0); + logLen += ((ret > 0) ? ret : 0); } } } diff --git a/frameworks/native/hilog_printf.cpp b/frameworks/native/hilog_printf.cpp index d40da43..2541ec9 100644 --- a/frameworks/native/hilog_printf.cpp +++ b/frameworks/native/hilog_printf.cpp @@ -117,11 +117,11 @@ static uint32_t ParseProcessQuota() break; } ret = sscanf_s(quotaValue, "%d", &proQuota); - if (ret != 0) { + if (ret <= 0) { cout << "invalid quota config" << endl; } break; - } + } } ifs.close(); return proQuota; diff --git a/services/hilogd/log_buffer.cpp b/services/hilogd/log_buffer.cpp index d1f162c..7a4e683 100644 --- a/services/hilogd/log_buffer.cpp +++ b/services/hilogd/log_buffer.cpp @@ -231,7 +231,7 @@ void HilogBuffer::RemoveLogReader(std::shared_ptr reader) { logReaderListMutex.lock(); const auto findIter = std::find_if(logReaderList.begin(), logReaderList.end(), - [reader](const std::weak_ptr& ptr0) { + [&reader](const std::weak_ptr& ptr0) { return ptr0.lock() == reader; }); if (findIter != logReaderList.end()) { -- Gitee