diff --git a/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/BUILD.gn b/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/BUILD.gn index 63b7f2bdaf5910c2badf09d8835e75c3aee17328..a2bdb174d245012644d5b50864dee35161e54514 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/BUILD.gn +++ b/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# Copyright (c) 2022-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -46,6 +46,13 @@ ohos_unittest("DhfwkSaManagerTest") { "//third_party/googletest:gtest_main", ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"DhfwkSaManagerTest\"", diff --git a/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/include/dhfwk_sa_manager_test.h b/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/include/dhfwk_sa_manager_test.h index ec8e533ad268d0992c0c60295d9f555e8ec372ab..64ae929157d5dcacd8a4cfaf2428c61a6b01c44f 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/include/dhfwk_sa_manager_test.h +++ b/interfaces/inner_kits/test/unittest/common/ipc/dhfwk_sa_manager/include/dhfwk_sa_manager_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -24,9 +24,7 @@ #include "distributed_hardware_errno.h" #include "idistributed_hardware.h" -#define private public #include "dhfwk_sa_manager.h" -#undef private namespace OHOS { namespace DistributedHardware { diff --git a/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/BUILD.gn b/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/BUILD.gn index d613a9c5c1234d3c6d1bc9780b31b59e724a9bd2..75a2d9ecfb26e4bb0ac4fa23f9fbf48448882d27 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/BUILD.gn +++ b/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/BUILD.gn @@ -46,6 +46,13 @@ ohos_unittest("DistributedHardwareProxyTest") { "//third_party/googletest:gtest_main", ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"DistributedHardwareProxyTest\"", diff --git a/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/include/distributed_hardware_proxy_test.h b/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/include/distributed_hardware_proxy_test.h index da187b0a5b4b37fad626596104b07d7cb0b47d62..704ac0b6dcf33fda950bbe06a0c5a43c5ee9b3db 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/include/distributed_hardware_proxy_test.h +++ b/interfaces/inner_kits/test/unittest/common/ipc/distributed_hardware_proxy/include/distributed_hardware_proxy_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -23,9 +23,7 @@ #include "device_type.h" #include "distributed_hardware_errno.h" #include "idistributed_hardware.h" -#define private public #include "distributed_hardware_proxy.h" -#undef private namespace OHOS { namespace DistributedHardware { diff --git a/interfaces/inner_kits/test/unittest/common/ipc/publisher_listener_stub/BUILD.gn b/interfaces/inner_kits/test/unittest/common/ipc/publisher_listener_stub/BUILD.gn index 809b2f689fef38f9a09fa4d4bc3916c24eed6397..8de2a7655d6f0f4764983b241ead1e01d6978adb 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/publisher_listener_stub/BUILD.gn +++ b/interfaces/inner_kits/test/unittest/common/ipc/publisher_listener_stub/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# Copyright (c) 2022-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -46,6 +46,13 @@ ohos_unittest("PublisherListenerStubTest") { "//third_party/googletest:gtest_main", ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"PublisherListenerStubTest\"", diff --git a/interfaces/inner_kits/test/unittest/common/ipc/publisher_listener_stub/include/publisher_listener_stub_test.h b/interfaces/inner_kits/test/unittest/common/ipc/publisher_listener_stub/include/publisher_listener_stub_test.h index 5f32cdefa3cf53e2255ec2f5f8fc268782eafacd..85333c5f37f3bee7f9d20a86f7911fdc8716d068 100644 --- a/interfaces/inner_kits/test/unittest/common/ipc/publisher_listener_stub/include/publisher_listener_stub_test.h +++ b/interfaces/inner_kits/test/unittest/common/ipc/publisher_listener_stub/include/publisher_listener_stub_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -26,9 +26,7 @@ #include "ipublisher_listener.h" #include "iremote_stub.h" #include "idistributed_hardware.h" -#define private public #include "publisher_listener_stub.h" -#undef private namespace OHOS { namespace DistributedHardware { diff --git a/services/distributedhardwarefwkservice/test/unittest/common/accessmanager/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/accessmanager/BUILD.gn index dcbc89f51c542572f8ebb0cc8ed5ae663d8437f7..cf4da5e2562ad3688f9de76fc840ba7a8af4ff25 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/accessmanager/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/accessmanager/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023 Huawei Device Co., Ltd. +# Copyright (c) 2021-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -43,6 +43,13 @@ ohos_unittest("AccessManagerTest") { configs = [ ":module_private_config" ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + deps = [ "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", "${utils_path}:distributedhardwareutils", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/accessmanager/access_manager_test.cpp b/services/distributedhardwarefwkservice/test/unittest/common/accessmanager/access_manager_test.cpp index 8955b0750b27d20a446eb981b707be3db147515a..833e90d483eee67d215ec04a47976af9587f548f 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/accessmanager/access_manager_test.cpp +++ b/services/distributedhardwarefwkservice/test/unittest/common/accessmanager/access_manager_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -21,10 +21,8 @@ #include "gtest/gtest.h" -#define private public #include "access_manager.h" #include "distributed_hardware_manager_factory.h" -#undef private #include "dm_device_info.h" #include "distributed_hardware_errno.h" using namespace testing::ext; diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentloader/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/componentloader/BUILD.gn index 193efc0564c1c6c49a4f3b21d390ee9a18f62f11..dcc6ed3999de7298fb5cd2ba8e928ab341aee2a5 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/componentloader/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/componentloader/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023 Huawei Device Co., Ltd. +# Copyright (c) 2021-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -44,6 +44,13 @@ ohos_unittest("ComponentLoaderTest") { configs = [ ":module_private_config" ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + deps = [ "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", "${utils_path}:distributedhardwareutils", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentloader/include/component_loader_test.h b/services/distributedhardwarefwkservice/test/unittest/common/componentloader/include/component_loader_test.h index d0d847d835cb70edb1a80ebe2eccc5fc449101a2..9143cff0347ef2365e6e7d19aa143e37b1617177 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/componentloader/include/component_loader_test.h +++ b/services/distributedhardwarefwkservice/test/unittest/common/componentloader/include/component_loader_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -17,9 +17,8 @@ #define OHOS_DISTRIBUTED_HARDWARE_COMPONENT_LOADER_TEST_H #include -#define private public #include "componentloader/component_loader.cpp" -#undef private + namespace OHOS { namespace DistributedHardware { class ComponentLoaderTest : public testing::Test { diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentloader/src/component_loader_test.cpp b/services/distributedhardwarefwkservice/test/unittest/common/componentloader/src/component_loader_test.cpp index e18cd4420354115ebd26d74ed1831f33d6bbef34..f050a65a916c3daa7855aac873596c689d17503f 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/componentloader/src/component_loader_test.cpp +++ b/services/distributedhardwarefwkservice/test/unittest/common/componentloader/src/component_loader_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,9 +14,7 @@ */ #include "component_loader_test.h" -#define private public #include "component_loader.h" -#undef private #include "distributed_hardware_log.h" #include "hitrace_meter.h" #include "hidump_helper.h" diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/BUILD.gn index b887fafeaa2333963367baec614d83b138bc2ac8..9a0a2619f57e242ce6905443705d8df01f5c917b 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023 Huawei Device Co., Ltd. +# Copyright (c) 2021-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -58,6 +58,13 @@ ohos_unittest("ComponentMonitorTest") { "samgr:samgr_proxy", ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"ComponentMonitorTest\"", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/include/component_monitor_test.h b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/include/component_monitor_test.h index 66cbeec0cd4158fe9225723629d13f52a0ad9f15..875c2496fad638d3fd8314cc290fb423e451e2a5 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/include/component_monitor_test.h +++ b/services/distributedhardwarefwkservice/test/unittest/common/componentmanager/component_monitior/include/component_monitor_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -18,9 +18,7 @@ #include "gtest/gtest.h" -#define private public #include "component_monitor.h" -#undef private namespace OHOS { namespace DistributedHardware { diff --git a/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwareservice/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwareservice/BUILD.gn index b1ffab8bc24bcc936368c87f90324088ff9837a5..acec492e5fe62f7ce02636a76334de61890f988a 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwareservice/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwareservice/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# Copyright (c) 2022-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -48,6 +48,14 @@ ohos_unittest("DistributedHardwareServiceTest") { "//third_party/googletest:gtest_main", ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + "-Dprotected=public", + ] + defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"DistributedHardwareServiceTest\"", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwareservice/src/distributed_hardware_service_test.cpp b/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwareservice/src/distributed_hardware_service_test.cpp index 2b37f317313a74e9b810f050515d8ca672f1d1d0..fbb6915fcc10d23f9a478c9f00d23de229c16946 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwareservice/src/distributed_hardware_service_test.cpp +++ b/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwareservice/src/distributed_hardware_service_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -23,13 +23,9 @@ #include "dh_context.h" #include "distributed_hardware_errno.h" #include "distributed_hardware_log.h" -#define protected public -#define private public #include "distributed_hardware_service.h" #include "distributed_hardware_manager.h" #include "task_board.h" -#undef private -#undef protected #include "mock_publisher_listener.h" using namespace testing::ext; diff --git a/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/BUILD.gn index bbde54fd5d5843e48a429fbd683dae9aebe4d181..65d09344f3a6a6a93e316b2058c22be050b41714 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# Copyright (c) 2022-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -48,6 +48,13 @@ ohos_unittest("DistributedHardwareStubTest") { "//third_party/googletest:gtest_main", ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"DistributedHardwareStubTest\"", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/include/distributed_hardware_stub_test.h b/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/include/distributed_hardware_stub_test.h index 460bf5e51ed21c8c17c9204240dbfce8c47eb666..59b44d30ef94ae8be83fb5a202a8589fedf3c6fa 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/include/distributed_hardware_stub_test.h +++ b/services/distributedhardwarefwkservice/test/unittest/common/distributedhardwarestub/include/distributed_hardware_stub_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -20,9 +20,7 @@ #include "distributed_hardware_errno.h" #include "distributed_hardware_fwk_kit_paras.h" -#define private public #include "distributed_hardware_stub.h" -#undef private namespace OHOS { namespace DistributedHardware { diff --git a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/enabledcompsdump/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/enabledcompsdump/BUILD.gn index 0e912ddb8e63ce0067dac82c337802066dd54e1d..b3bbb572594fe2c89ea5e5e260c009d1bb058e46 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/enabledcompsdump/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/enabledcompsdump/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# Copyright (c) 2022-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -40,6 +40,13 @@ ohos_unittest("EnabledCompsDumpTest") { "//third_party/googletest:gtest_main", ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"EnabledCompsDumpTest\"", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/enabledcompsdump/src/enabled_comps_dump_test.cpp b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/enabledcompsdump/src/enabled_comps_dump_test.cpp index fceaced286faa2740172d85e811c7a12ac964609..fe9d6df21ce3b2d221664aa4776223d768b6c421 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/enabledcompsdump/src/enabled_comps_dump_test.cpp +++ b/services/distributedhardwarefwkservice/test/unittest/common/hidumphelper/enabledcompsdump/src/enabled_comps_dump_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -19,9 +19,7 @@ #include #include -#define private public #include "enabled_comps_dump.h" -#undef private using namespace testing::ext; namespace OHOS { diff --git a/services/distributedhardwarefwkservice/test/unittest/common/ipc/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/ipc/BUILD.gn index f188e1a663ca3c679a1528eb4f186393b7bd9e5d..fa57d758c3db93851814fc87829ce77ce16d9892 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/ipc/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/ipc/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. +# Copyright (c) 2022-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -38,6 +38,13 @@ ohos_unittest("PublisherListenerProxyTest") { "//third_party/googletest:gtest_main", ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"PublisherListenerProxyTest\"", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/ipc/include/publisher_listener_proxy_test.h b/services/distributedhardwarefwkservice/test/unittest/common/ipc/include/publisher_listener_proxy_test.h index e7afb95c5ad902a51c74216cf89f37e5f44dac4e..80f08fea75cf9a65f4b5dc67db506f1b44db16a1 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/ipc/include/publisher_listener_proxy_test.h +++ b/services/distributedhardwarefwkservice/test/unittest/common/ipc/include/publisher_listener_proxy_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -20,9 +20,7 @@ #include #include -#define private public #include "publisher_listener_proxy.h" -#undef private #include "distributed_hardware_errno.h" namespace OHOS { diff --git a/services/distributedhardwarefwkservice/test/unittest/common/localhardwaremanager/localhardwaremanager/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/localhardwaremanager/localhardwaremanager/BUILD.gn index 7905c5e84cef39b8e804fb5eb2d5f2a57281a45a..7c8f2c4a48f3d408bc1569e5459235198d79e45c 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/localhardwaremanager/localhardwaremanager/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/localhardwaremanager/localhardwaremanager/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# Copyright (c) 2022-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -48,6 +48,13 @@ ohos_unittest("LocalHardwareManagerTest") { configs = [ ":module_private_config" ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + deps = [ "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", "//third_party/googletest:gtest_main", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/localhardwaremanager/localhardwaremanager/src/local_hardware_manager_test.cpp b/services/distributedhardwarefwkservice/test/unittest/common/localhardwaremanager/localhardwaremanager/src/local_hardware_manager_test.cpp index 045c6e6f9d351ff06a1bc328754d00034e4ec687..b9df061a3061a0038fddec0a5e77063c6f5b3d11 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/localhardwaremanager/localhardwaremanager/src/local_hardware_manager_test.cpp +++ b/services/distributedhardwarefwkservice/test/unittest/common/localhardwaremanager/localhardwaremanager/src/local_hardware_manager_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,12 +15,10 @@ #include "local_hardware_manager_test.h" -#define private public #include "capability_info_manager.h" #include "component_loader.h" #include "dh_context.h" #include "local_hardware_manager.h" -#undef private #include "mock_hardware_handler.h" using namespace testing::ext; diff --git a/services/distributedhardwarefwkservice/test/unittest/common/localhardwaremanager/pluginlistenerimpl/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/localhardwaremanager/pluginlistenerimpl/BUILD.gn index 99d25e2f26fc72120019fe3e58dad497417547aa..f9fa7b30dfe3308a8164a723a98e12df53d7537c 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/localhardwaremanager/pluginlistenerimpl/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/localhardwaremanager/pluginlistenerimpl/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# Copyright (c) 2022-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -46,6 +46,13 @@ ohos_unittest("PluginListenerImplTest") { configs = [ ":module_private_config" ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + deps = [ "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", "//third_party/googletest:gtest_main", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/localhardwaremanager/pluginlistenerimpl/include/plugin_listener_impl_test.h b/services/distributedhardwarefwkservice/test/unittest/common/localhardwaremanager/pluginlistenerimpl/include/plugin_listener_impl_test.h index a6d34db69cb1cee862b64045674b93ac02e98147..14bc98466bae3aac3418aa11f487626d1d941b9c 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/localhardwaremanager/pluginlistenerimpl/include/plugin_listener_impl_test.h +++ b/services/distributedhardwarefwkservice/test/unittest/common/localhardwaremanager/pluginlistenerimpl/include/plugin_listener_impl_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -18,9 +18,7 @@ #include -#define private public #include "plugin_listener_impl.h" -#undef private namespace OHOS { namespace DistributedHardware { diff --git a/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatency/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatency/BUILD.gn index 4d4ffd5dc6da23631caed3d93b925b7289d2f10e..70db21154e04849c0d42433188b511886e17308b 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatency/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatency/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# Copyright (c) 2022-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -41,6 +41,13 @@ ohos_unittest("LowLatencyTest") { "//third_party/googletest:gtest_main", ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"LowLatencyTest\"", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatency/include/low_latency_test.h b/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatency/include/low_latency_test.h index 914222113ea742df6f3a51bee53f6e020e297187..5701c07c3e0d4c1f8546ad94cf2c9e94af448142 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatency/include/low_latency_test.h +++ b/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatency/include/low_latency_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -20,9 +20,7 @@ #include #include -#define private public #include "low_latency.h" -#undef private #include "distributed_hardware_errno.h" namespace OHOS { diff --git a/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatencylistener/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatencylistener/BUILD.gn index 3aea19cd959caad9833263149ad8134a81874590..ba1409bb27f0abe45bb0c4b69b866d8110c464cc 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatencylistener/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatencylistener/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# Copyright (c) 2022-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -41,6 +41,13 @@ ohos_unittest("LowLatencyListenerTest") { "//third_party/googletest:gtest_main", ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"LowLatencyListenerTest\"", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatencylistener/include/low_latency_listener_test.h b/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatencylistener/include/low_latency_listener_test.h index 0a38cae4f6eba3757d7a3ea4cb870fade297f049..5d6eadd979ac08810187f840e18481a6d57003d5 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatencylistener/include/low_latency_listener_test.h +++ b/services/distributedhardwarefwkservice/test/unittest/common/lowlatency/lowlatencylistener/include/low_latency_listener_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -20,10 +20,8 @@ #include #include -#define private public #include "low_latency_listener.h" #include "low_latency_timer.h" -#undef private #include "distributed_hardware_errno.h" namespace OHOS { diff --git a/services/distributedhardwarefwkservice/test/unittest/common/publisher/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/publisher/BUILD.gn index cda9ac005bc5e04ce9bc45b64fc642a894078fc6..9a3be618e5e142d733268720e321a25fa01807b3 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/publisher/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/publisher/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023 Huawei Device Co., Ltd. +# Copyright (c) 2021-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -38,6 +38,13 @@ ohos_unittest("PublisherItemTest") { "//third_party/googletest:gtest_main", ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + external_deps = [ "c_utils:utils", "kv_store:distributeddata_inner", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/publisher/include/publisher_item_test.h b/services/distributedhardwarefwkservice/test/unittest/common/publisher/include/publisher_item_test.h index 419cd442c3163ed6e347932bc51019c7b9cb844d..6938fc2bcc9cb14d00cea0ba370977366150deb3 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/publisher/include/publisher_item_test.h +++ b/services/distributedhardwarefwkservice/test/unittest/common/publisher/include/publisher_item_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -19,9 +19,7 @@ #include #include -#define private public #include "publisher_item.h" -#undef private namespace OHOS { namespace DistributedHardware { diff --git a/services/distributedhardwarefwkservice/test/unittest/common/resourcemanager/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/resourcemanager/BUILD.gn index 15157c635abe9ebe3f05df39a943b1536646d6c2..f7aac2208547302510acfdafbaf9aed60a44f957 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/resourcemanager/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/resourcemanager/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023 Huawei Device Co., Ltd. +# Copyright (c) 2021-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -41,6 +41,13 @@ ohos_unittest("ResourceManagerTest") { configs = [ ":module_private_config" ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + deps = [ "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", "${utils_path}:distributedhardwareutils", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/resourcemanager/src/resource_manager_test.cpp b/services/distributedhardwarefwkservice/test/unittest/common/resourcemanager/src/resource_manager_test.cpp index 32ac7c31207fcc36eb0f3dc4478b8fca9569404b..a2c82ac7afaa06244f8bf51e71258c5a41587c7d 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/resourcemanager/src/resource_manager_test.cpp +++ b/services/distributedhardwarefwkservice/test/unittest/common/resourcemanager/src/resource_manager_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -20,11 +20,9 @@ #include #include -#define private public #include "capability_info.h" #include "capability_info_manager.h" #include "version_info_event.h" -#undef private #include "dh_context.h" #include "distributed_hardware_errno.h" #include "distributed_hardware_log.h" diff --git a/services/distributedhardwarefwkservice/test/unittest/common/task/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/task/BUILD.gn index cbb8b49fea44eea0172cfd37275b59610e82dd30..e660da3bb2dcca8a3741e6b21179d11b214c5485 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/task/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/task/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023 Huawei Device Co., Ltd. +# Copyright (c) 2021-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -55,6 +55,13 @@ ohos_unittest("DHTaskTest") { external_deps = [ "c_utils:utils" ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"TaskTest\"", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/task/include/task_test.h b/services/distributedhardwarefwkservice/test/unittest/common/task/include/task_test.h index 8f5f6987d8d604f6344bfc86e1bf96312a58545f..5dc6f3f5c8ebf371272c263a65aa24fdbc9ef571 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/task/include/task_test.h +++ b/services/distributedhardwarefwkservice/test/unittest/common/task/include/task_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -18,14 +18,12 @@ #include -#define private public #include "disable_task.h" #include "enable_task.h" #include "offline_task.h" #include "task.h" #include "task_board.h" #include "task_executor.h" -#undef private namespace OHOS { namespace DistributedHardware { diff --git a/services/distributedhardwarefwkservice/test/unittest/common/versioninfomanager/versioninfo/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/versioninfomanager/versioninfo/BUILD.gn index ac50f7da1c54e4365be8b4134fa2158aaa70d485..c2dcce67819512ab93b52b661b12357dbcbe1d8f 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/versioninfomanager/versioninfo/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/versioninfomanager/versioninfo/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# Copyright (c) 2022-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -41,6 +41,13 @@ ohos_unittest("VersionInfoTest") { configs = [ ":module_private_config" ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + deps = [ "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", "${utils_path}:distributedhardwareutils", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/versioninfomanager/versioninfo/src/version_info_test.cpp b/services/distributedhardwarefwkservice/test/unittest/common/versioninfomanager/versioninfo/src/version_info_test.cpp index 34db268b17e617704602e57a6b7badc11b5c606f..2b4aeeb44b168d661ce00b0bb7eb0d61379cf4f4 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/versioninfomanager/versioninfo/src/version_info_test.cpp +++ b/services/distributedhardwarefwkservice/test/unittest/common/versioninfomanager/versioninfo/src/version_info_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -19,11 +19,9 @@ #include #include -#define private public #include "version_info_manager.h" #include "version_manager.h" #include "version_info.h" -#undef private #include "dh_context.h" #include "distributed_hardware_errno.h" #include "distributed_hardware_log.h" diff --git a/services/distributedhardwarefwkservice/test/unittest/common/versioninfomanager/versioninfomanager/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/versioninfomanager/versioninfomanager/BUILD.gn index d9cfa77b9048e86aa1aa717efb1e6a01933bc670..b2cf3ffc79a7f7403467b9695e28d4838d525e9b 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/versioninfomanager/versioninfomanager/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/versioninfomanager/versioninfomanager/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# Copyright (c) 2022-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -42,6 +42,13 @@ ohos_unittest("VersioninfoManagerTest") { configs = [ ":module_private_config" ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + deps = [ "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", "${utils_path}:distributedhardwareutils", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/versioninfomanager/versioninfomanager/src/version_info_manager_test.cpp b/services/distributedhardwarefwkservice/test/unittest/common/versioninfomanager/versioninfomanager/src/version_info_manager_test.cpp index db1694ab6f619914d3e8291d497bbd39f6fa5416..af4847cc0413fe492a982086d299f55c2e66a37a 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/versioninfomanager/versioninfomanager/src/version_info_manager_test.cpp +++ b/services/distributedhardwarefwkservice/test/unittest/common/versioninfomanager/versioninfomanager/src/version_info_manager_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -19,11 +19,9 @@ #include #include -#define private public #include "version_info_manager.h" #include "version_manager.h" #include "version_info_event.h" -#undef private #include "dh_context.h" #include "distributed_hardware_log.h" diff --git a/services/distributedhardwarefwkservice/test/unittest/common/versionmanager/BUILD.gn b/services/distributedhardwarefwkservice/test/unittest/common/versionmanager/BUILD.gn index e0984cb04578f1ddea6026ffe1fb38daec4be4d8..5a6483ef857e719dddfe34b16b0c87215136c52f 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/versionmanager/BUILD.gn +++ b/services/distributedhardwarefwkservice/test/unittest/common/versionmanager/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# Copyright (c) 2022-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -53,6 +53,13 @@ ohos_unittest("VersionManagerTest") { "kv_store:distributeddata_inner", ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + defines = [ "HI_LOG_ENABLE", "DH_LOG_TAG=\"VersionManagerTest\"", diff --git a/services/distributedhardwarefwkservice/test/unittest/common/versionmanager/src/version_manager_test.cpp b/services/distributedhardwarefwkservice/test/unittest/common/versionmanager/src/version_manager_test.cpp index 6c34d0134bbe02a006760a3144c8a14250c924e9..45383b2fa4852f2c9162b0d977833ed8fd4df21b 100644 --- a/services/distributedhardwarefwkservice/test/unittest/common/versionmanager/src/version_manager_test.cpp +++ b/services/distributedhardwarefwkservice/test/unittest/common/versionmanager/src/version_manager_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,9 +15,7 @@ #include "version_manager_test.h" -#define private public #include "component_loader.h" -#undef private #include "version_manager.h" using namespace testing::ext; diff --git a/utils/include/histreamer_query_tool.h b/utils/include/histreamer_query_tool.h index dbbb1398582a1a4fc817f69228de444a7599c6cc..16d81f28ac0cb0f9cebd7204360e00471d7de1ec 100644 --- a/utils/include/histreamer_query_tool.h +++ b/utils/include/histreamer_query_tool.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,6 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +#ifndef OHOS_HISTREAMER_QUERY_TOOL_H +#define OHOS_HISTREAMER_QUERY_TOOL_H + #include #include #include "single_instance.h" @@ -34,4 +38,5 @@ private: void Init(); }; } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/utils/src/anonymous_string.cpp b/utils/src/anonymous_string.cpp index be63436b0a5e215ef1bafa0961cdc43d77761258..43b12921511c0ed53bf965a17dd93c8f2c55482f 100644 --- a/utils/src/anonymous_string.cpp +++ b/utils/src/anonymous_string.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -22,11 +22,15 @@ namespace OHOS { namespace DistributedHardware { -std::string GetAnonyString(const std::string &value) -{ +namespace { constexpr size_t INT32_SHORT_ID_LENGTH = 20; constexpr size_t INT32_PLAINTEXT_LENGTH = 4; constexpr size_t INT32_MIN_ID_LENGTH = 3; + constexpr int32_t INT32_STRING_LENGTH = 40; +} + +std::string GetAnonyString(const std::string &value) +{ std::string res; std::string tmpStr("******"); size_t strLen = value.length(); @@ -49,7 +53,6 @@ std::string GetAnonyString(const std::string &value) std::string GetAnonyInt32(const int32_t value) { - constexpr int32_t INT32_STRING_LENGTH = 40; char tempBuffer[INT32_STRING_LENGTH] = ""; int32_t secRet = sprintf_s(tempBuffer, INT32_STRING_LENGTH, "%d", value); if (secRet <= 0) { diff --git a/utils/src/dh_utils_tool.cpp b/utils/src/dh_utils_tool.cpp index 0533742a2cd974d42ec3d5081b4b9a020b3e526d..c0f7eda253b1bc2e37af88277077a648a6722935 100644 --- a/utils/src/dh_utils_tool.cpp +++ b/utils/src/dh_utils_tool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -31,9 +31,14 @@ namespace OHOS { namespace DistributedHardware { -constexpr int32_t MS_ONE_SECOND = 1000; -constexpr int32_t WORD_WIDTH_8 = 8; -constexpr int32_t WORD_WIDTH_4 = 4; +namespace { + constexpr int32_t MS_ONE_SECOND = 1000; + constexpr int32_t WORD_WIDTH_8 = 8; + constexpr int32_t WORD_WIDTH_4 = 4; + constexpr int32_t WIDTH = 4; + constexpr unsigned char MASK = 0x0F; + constexpr int32_t DOUBLE_TIMES = 2; +} int64_t GetCurrentTime() { @@ -91,24 +96,21 @@ std::string GetDeviceIdByUUID(const std::string &uuid) std::string Sha256(const std::string& in) { - unsigned char out[SHA256_DIGEST_LENGTH * 2 + 1] = {0}; + unsigned char result[SHA256_DIGEST_LENGTH * 2 + 1] = {0}; SHA256_CTX ctx; SHA256_Init(&ctx); SHA256_Update(&ctx, in.data(), in.size()); - SHA256_Final(&out[SHA256_DIGEST_LENGTH], &ctx); + SHA256_Final(&result[SHA256_DIGEST_LENGTH], &ctx); // here we translate sha256 hash to hexadecimal. each 8-bit char will be presented by two characters([0-9a-f]) - constexpr int32_t WIDTH = 4; - constexpr unsigned char MASK = 0x0F; const char* hexCode = "0123456789abcdef"; - constexpr int32_t DOUBLE_TIMES = 2; for (int32_t i = 0; i < SHA256_DIGEST_LENGTH; ++i) { - unsigned char value = out[SHA256_DIGEST_LENGTH + i]; + unsigned char value = result[SHA256_DIGEST_LENGTH + i]; // uint8_t is 2 digits in hexadecimal. - out[i * DOUBLE_TIMES] = hexCode[(value >> WIDTH) & MASK]; - out[i * DOUBLE_TIMES + 1] = hexCode[value & MASK]; + result[i * DOUBLE_TIMES] = hexCode[(value >> WIDTH) & MASK]; + result[i * DOUBLE_TIMES + 1] = hexCode[value & MASK]; } - out[SHA256_DIGEST_LENGTH * DOUBLE_TIMES] = 0; - return reinterpret_cast(out); + result[SHA256_DIGEST_LENGTH * DOUBLE_TIMES] = 0; + return reinterpret_cast(result); } DeviceInfo GetLocalDeviceInfo() diff --git a/utils/test/unittest/common/eventtrance/BUILD.gn b/utils/test/unittest/common/eventtrance/BUILD.gn index e240e684246b313e8e3754a81e9e65a98ff4a8bc..41bf071065d1765eefdebd3cccb0d7efdffd0a38 100644 --- a/utils/test/unittest/common/eventtrance/BUILD.gn +++ b/utils/test/unittest/common/eventtrance/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Huawei Device Co., Ltd. +# Copyright (c) 2022-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -41,6 +41,13 @@ ohos_unittest("EventTranceTest") { configs = [ ":module_private_config" ] + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + ] + deps = [ "${services_path}/distributedhardwarefwkservice:distributedhardwarefwksvr", "${utils_path}:distributedhardwareutils", diff --git a/utils/test/unittest/common/eventtrance/event_trance_test.h b/utils/test/unittest/common/eventtrance/event_trance_test.h index c5c74609d466bf3b637acae3d787fac756826613..70d226fc0cbd70dd61320cea50ebc892b3656ed8 100644 --- a/utils/test/unittest/common/eventtrance/event_trance_test.h +++ b/utils/test/unittest/common/eventtrance/event_trance_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -18,9 +18,7 @@ #include -#define private public #include "dh_context.h" -#undef private #include "dh_utils_hisysevent.h" #include "dh_utils_hitrace.h"