diff --git a/dm/test/unittest/screenshot_test.cpp b/dm/test/unittest/screenshot_test.cpp index 0d87691a..a9627219 100644 --- a/dm/test/unittest/screenshot_test.cpp +++ b/dm/test/unittest/screenshot_test.cpp @@ -13,11 +13,12 @@ * limitations under the License. */ +#include "screenshot_test.h" + #include #include "mock_display_manager_adapter.h" #include "singleton_mocker.h" -#include "screenshot_test.h" using namespace testing; using namespace testing::ext; @@ -67,10 +68,14 @@ static std::shared_ptr CreatePixelMap() } uint8_t *pic = (uint8_t *)data; - memset_s(pic, voulumeSize, pixelValue, voulumeSize); + if (memset_s(pic, voulumeSize, pixelValue, voulumeSize) != EOK) { + free(data); + return nullptr; + } uint32_t colorLen = voulumeSize * bitmapDepth; auto pixelMap = Media::PixelMap::Create(data, colorLen, opt); + free(data); if (pixelMap == nullptr) { return nullptr; } diff --git a/dmserver/src/display_manager_stub.cpp b/dmserver/src/display_manager_stub.cpp index c8b47c33..5acacc40 100644 --- a/dmserver/src/display_manager_stub.cpp +++ b/dmserver/src/display_manager_stub.cpp @@ -108,12 +108,12 @@ int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, } case TRANS_ID_GET_DISPLAY_SNAPSHOT: { DisplayId displayId = data.ReadUint64(); - std::shared_ptr dispalySnapshot = GetDisplaySnapshot(displayId); - if (dispalySnapshot == nullptr) { + std::shared_ptr displaySnapshot = GetDisplaySnapshot(displayId); + if (displaySnapshot == nullptr) { reply.WriteParcelable(nullptr); break; } - reply.WriteParcelable(dispalySnapshot.get()); + reply.WriteParcelable(displaySnapshot.get()); } case TRANS_ID_REGISTER_DISPLAY_MANAGER_AGENT: { auto agent = iface_cast(data.ReadRemoteObject()); diff --git a/interfaces/innerkits/wm/window_option.h b/interfaces/innerkits/wm/window_option.h index 30f8b23b..cc0b1ef5 100644 --- a/interfaces/innerkits/wm/window_option.h +++ b/interfaces/innerkits/wm/window_option.h @@ -75,6 +75,6 @@ private: { WindowType::WINDOW_TYPE_NAVIGATION_BAR, SystemBarProperty() }, }; }; -} -} +} // namespace Rosen +} // namespace OHOS #endif // OHOS_ROSEN_WINDOW_OPTION_H diff --git a/wm/src/window_option.cpp b/wm/src/window_option.cpp index 2a17e919..4696794b 100644 --- a/wm/src/window_option.cpp +++ b/wm/src/window_option.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 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 @@ -172,6 +172,6 @@ const std::unordered_map& WindowOption::GetSystem { return sysBarPropMap_; } -} -} +} // namespace Rosen +} // namespace OHOS diff --git a/wmserver/src/window_node.cpp b/wmserver/src/window_node.cpp index bc1f37ac..7819610f 100644 --- a/wmserver/src/window_node.cpp +++ b/wmserver/src/window_node.cpp @@ -192,5 +192,5 @@ WindowSizeChangeReason WindowNode::GetWindowSizeChangeReason() const { return windowSizeChangeReason_; } -} -} +} // namespace Rosen +} // namespace OHOS