diff --git a/device/cmds/src/parse_plugin_config.cpp b/device/cmds/src/parse_plugin_config.cpp index ec36d4b55c9497d7ce723a3e12c63d473e3b03cd..a8bc058ce21468018e11af327c175230f50fa05b 100644 --- a/device/cmds/src/parse_plugin_config.cpp +++ b/device/cmds/src/parse_plugin_config.cpp @@ -97,7 +97,7 @@ std::string ParsePluginConfig::GetPluginsConfig(std::string& content) bool ParsePluginConfig::SetSerializePluginsConfig(const std::string& pluginName, ProfilerPluginConfig& pluginConfig) { bool ret = false; - if (pluginConfigMap.count(pluginName) == 0) { + if (pluginConfigMap.find(pluginName) == pluginConfigMap.end()) { printf("unknown plugin: %s\n", pluginName.c_str()); return ret; } diff --git a/device/plugins/native_daemon/test/unittest/common/native/stack_preprocess_test.cpp b/device/plugins/native_daemon/test/unittest/common/native/stack_preprocess_test.cpp index 533d7f69333ac241a3f70a279cdcc91a35d43777..99f7e521ff213c076831807721ed8b91896b29d0 100644 --- a/device/plugins/native_daemon/test/unittest/common/native/stack_preprocess_test.cpp +++ b/device/plugins/native_daemon/test/unittest/common/native/stack_preprocess_test.cpp @@ -24,9 +24,8 @@ using namespace testing::ext; using namespace OHOS::Developtools::NativeDaemon; namespace { - constexpr static uint32_t MAX_MATCH_INTERVAL = 3600; - constexpr static uint32_t MAX_MATCH_CNT = 1000; -} +constexpr static uint32_t MAX_MATCH_INTERVAL = 3600; +constexpr static uint32_t MAX_MATCH_CNT = 1000; class StackPreprocessTest : public testing::Test { public: @@ -51,23 +50,6 @@ void StackPreprocessTest::TearDown(void) { } -long WriteFunc(WriterStruct* writer, const void* data, size_t size) -{ - if (writer == nullptr || data == nullptr || size <= 0) { - return -1; - } - - return 0; -} - -bool FlushFunc(WriterStruct* writer) -{ - if (writer == nullptr) { - return false; - } - return true; -} - /* @tc.name: StackPreprocessTest001 @tc.desc: test StackPreprocess with overcceeding max matching interval. @@ -106,4 +88,5 @@ HWTEST_F(StackPreprocessTest, StackPreprocessTest003, TestSize.Level1) FILE* fpHookData = nullptr; StackPreprocess preprocess(nullptr, hookConfig, 0, fpHookData); ASSERT_TRUE(hookConfig.save_file() && fpHookData == nullptr); +} } \ No newline at end of file diff --git a/device/plugins/native_hook/src/hook_socket_client.cpp b/device/plugins/native_hook/src/hook_socket_client.cpp index 1179ad2517890aa56d987aa2723c4daa3c80fef2..53ca539af7ab05023a97b3eb46615c2514567279 100644 --- a/device/plugins/native_hook/src/hook_socket_client.cpp +++ b/device/plugins/native_hook/src/hook_socket_client.cpp @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include #include "hook_socket_client.h" #include "common.h" @@ -26,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/device/services/profiler_service/src/trace_file_writer.cpp b/device/services/profiler_service/src/trace_file_writer.cpp index 4b1c7317e27e168017379d796eb79809d0e7bb8f..f3a897ead88f10800c7c64dd0625c46a0a624848 100644 --- a/device/services/profiler_service/src/trace_file_writer.cpp +++ b/device/services/profiler_service/src/trace_file_writer.cpp @@ -39,7 +39,7 @@ constexpr int GB_TO_BYTE = (1024 * 1024 * 1024); constexpr int SPLIT_FILE_MIN_SIZE = 200; // split file min size constexpr int SPLIT_FILE_DEFAULT_NUM = 10; // split file default num constexpr size_t DEFULT_PAGES = 64 * 256; // 64M -const int PIECE_HEAD_LEN = 4; +constexpr int PIECE_HEAD_LEN = 4; } // namespace TraceFileWriter::TraceFileWriter(const std::string& path) : TraceFileWriter(path, false, 0, 0) {} diff --git a/hiebpf/src/hiebpf.cpp b/hiebpf/src/hiebpf.cpp index 902b72c8b7167891fb7e680e570a57c0b92ad2cb..c94b0c7556ad54f6f7156ce0201d66a3c604cf08 100644 --- a/hiebpf/src/hiebpf.cpp +++ b/hiebpf/src/hiebpf.cpp @@ -208,6 +208,7 @@ int main(int argc, char* argv[]) (void)dup2(nullFd, STDOUT_FILENO); // redirect stdout to /dev/null g_ipcServer.SetHandleCallback(HandleIpcMessage); if (!g_ipcServer.Start()) { + close(nullFd); return 0; } } else { // parent process