From 325adc1d9cd625107e59e00d46569200b0019647 Mon Sep 17 00:00:00 2001 From: AOL Date: Thu, 16 Sep 2021 13:12:09 +0000 Subject: [PATCH 1/7] fix image load library error Signed-off-by: magekkkk --- frameworks/innerkitsimpl/pixelconverter/BUILD.gn | 3 ++- plugins/manager/BUILD.gn | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frameworks/innerkitsimpl/pixelconverter/BUILD.gn b/frameworks/innerkitsimpl/pixelconverter/BUILD.gn index 2389606bb..9f5bf5b23 100644 --- a/frameworks/innerkitsimpl/pixelconverter/BUILD.gn +++ b/frameworks/innerkitsimpl/pixelconverter/BUILD.gn @@ -146,7 +146,8 @@ ohos_shared_library("pixelconvertadapter") { external_deps = [ "hiviewdfx_hilog_native:libhilog" ] } - relative_install_dir = "module/multimedia" + + #relative_install_dir = "module/multimedia" subsystem_name = "multimedia" part_name = "multimedia_image_standard" } diff --git a/plugins/manager/BUILD.gn b/plugins/manager/BUILD.gn index b5b004090..11223d876 100644 --- a/plugins/manager/BUILD.gn +++ b/plugins/manager/BUILD.gn @@ -76,7 +76,8 @@ ohos_shared_library("pluginmanager") { external_deps = [ "hiviewdfx_hilog_native:libhilog" ] } - relative_install_dir = "module/multimedia" + + #relative_install_dir = "module/multimedia" subsystem_name = "multimedia" part_name = "multimedia_image_standard" } -- Gitee From 401ace08a7fef4e230f85d38612ded2ef1960a61 Mon Sep 17 00:00:00 2001 From: caochuan Date: Thu, 23 Sep 2021 14:33:00 +0800 Subject: [PATCH 2/7] Fix validation issues Signed-off-by: caochuan --- .../innerkitsimpl/converter/include/matrix.h | 2 +- .../kits/js/common/include/image_napi_utils.h | 9 ++++--- interfaces/innerkits/include/media_errors.h | 1 - .../js/common/include/image_source_napi.h | 7 +++--- .../kits/js/common/include/pixel_map_napi.h | 8 +++---- .../kits/native/include/image_pixel_map.h | 9 ------- mock/native/include/nocopyable.h | 17 +++++++++---- mock/native/include/refbase.h | 2 +- mock/native/include/rwlock.h | 4 ++-- mock/native/include/singleton.h | 17 +++++++++---- .../formatagentplugin/src/plugin_export.cpp | 2 +- .../image/libgifplugin/src/plugin_export.cpp | 2 +- .../image/libheifplugin/src/plugin_export.cpp | 2 +- .../image/libjpegplugin/src/plugin_export.cpp | 2 +- .../image/libpngplugin/src/plugin_export.cpp | 2 +- .../image/libwebpplugin/src/plugin_export.cpp | 2 +- .../manager/include/image/input_data_stream.h | 18 ++++++++++---- plugins/manager/include/plugin_service.h | 8 ++----- .../manager/include/pluginbase/plugin_utils.h | 24 ------------------- .../plugin_example2/plugin_export.cpp | 2 +- .../plugin_example3/plugin_export.cpp | 2 +- 21 files changed, 62 insertions(+), 80 deletions(-) diff --git a/frameworks/innerkitsimpl/converter/include/matrix.h b/frameworks/innerkitsimpl/converter/include/matrix.h index 7545c4c4c..f06b60835 100644 --- a/frameworks/innerkitsimpl/converter/include/matrix.h +++ b/frameworks/innerkitsimpl/converter/include/matrix.h @@ -108,7 +108,7 @@ public: constexpr Matrix(float sx, float kx, float tx, float ky, float sy, float ty, float p0, float p1, float p2, uint32_t operType) - : fMat_{ sx, kx, tx, ky, sy, ty, p0, p1, p2 }, operType_(operType){}; + : fMat_ { sx, kx, tx, ky, sy, ty, p0, p1, p2 }, operType_(operType){}; ~Matrix() = default; diff --git a/frameworks/kits/js/common/include/image_napi_utils.h b/frameworks/kits/js/common/include/image_napi_utils.h index f5d8e062f..f692d8d5a 100644 --- a/frameworks/kits/js/common/include/image_napi_utils.h +++ b/frameworks/kits/js/common/include/image_napi_utils.h @@ -26,7 +26,7 @@ #define IMG_NAPI_CHECK_RET_D(x, res, msg) \ do \ { \ - if(!(x)) \ + if (!(x)) \ { \ msg; \ return (res); \ @@ -36,7 +36,7 @@ do \ #define IMG_NAPI_CHECK_RET(x, res) \ do \ { \ - if(!(x)) \ + if (!(x)) \ { \ return (res); \ } \ @@ -69,7 +69,7 @@ do \ } \ } while (0) -#define IMG_ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0])) +#define IMG_ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) #define GET_BUFFER_BY_NAME(root, name, res, len) ImageNapiUtils::GetBufferByName(env, (root), (name), &(res), &(len)) #define GET_UINT32_BY_NAME(root, name, res) ImageNapiUtils::GetUint32ByName(env, (root), (name), &(res)) @@ -82,7 +82,6 @@ do \ namespace OHOS { namespace Media { - class ImageNapiUtils { public: static bool GetBufferByName(napi_env env, napi_value root, const char* name, void **res, size_t* len); @@ -94,4 +93,4 @@ public: }; } // namespace Media } // namespace OHOS -#endif // IMAGE_NAPI_UTILS_H \ No newline at end of file +#endif // IMAGE_NAPI_UTILS_H diff --git a/interfaces/innerkits/include/media_errors.h b/interfaces/innerkits/include/media_errors.h index 1699dc731..6cb2a1eeb 100644 --- a/interfaces/innerkits/include/media_errors.h +++ b/interfaces/innerkits/include/media_errors.h @@ -109,7 +109,6 @@ const int32_t ERR_MEDIA_NUMBER_OVERFLOW = BASE_MEDIA_ERR_OFFSET + 73; const int32_t ERR_MEDIA_DIS_PLAYER_UNSUPPORTED = BASE_MEDIA_ERR_OFFSET + 74; // media distribute player unsupporteded const int32_t ERR_MEDIA_UNKNOWN = BASE_MEDIA_ERR_OFFSET + 200; // media unknown error - } // namespace Media } // namespace OHOS #endif // MEDIA_ERRORS_H diff --git a/interfaces/kits/js/common/include/image_source_napi.h b/interfaces/kits/js/common/include/image_source_napi.h index 561ea5143..8f522dad4 100644 --- a/interfaces/kits/js/common/include/image_source_napi.h +++ b/interfaces/kits/js/common/include/image_source_napi.h @@ -35,14 +35,14 @@ private: static napi_value Constructor(napi_env env, napi_callback_info info); static void Destructor(napi_env env, void *nativeObject, void *finalize); - //readonly property + // readonly property static napi_value GetSupportedFormats(napi_env env, napi_callback_info info); - //static methods + // static methods static napi_value CreateImageSource(napi_env env, napi_callback_info info); static napi_value CreateIncrementalSource(napi_env env, napi_callback_info info); - //methods + // methods static napi_value GetImageInfo(napi_env env, napi_callback_info info); static napi_value CreatePixelMap(napi_env env, napi_callback_info info); static napi_value GetImagePropertyInt(napi_env env, napi_callback_info info); @@ -58,7 +58,6 @@ private: std::shared_ptr nativeImgSrc = nullptr; bool isRelease = false; }; - } // namespace Media } // namespace OHOS #endif /* PIXEL_MAP_NAPI_H_ */ diff --git a/interfaces/kits/js/common/include/pixel_map_napi.h b/interfaces/kits/js/common/include/pixel_map_napi.h index 065fe38ea..3764f4b54 100644 --- a/interfaces/kits/js/common/include/pixel_map_napi.h +++ b/interfaces/kits/js/common/include/pixel_map_napi.h @@ -38,14 +38,14 @@ private: static napi_value Constructor(napi_env env, napi_callback_info info); static void Destructor(napi_env env, void *nativeObject, void *finalize); - //readonly property + // readonly property static napi_value GetIsEditable(napi_env env, napi_callback_info info); - //static mothod + // static mothod static napi_value CreatePixelMap(napi_env env, napi_callback_info info); static void CreatePixelMapComplete(napi_env env, napi_status status, void *data); - //methods + // methods static napi_value ReadPixelsToBuffer(napi_env env, napi_callback_info info); static napi_value ReadPixels(napi_env env, napi_callback_info info); static napi_value WritePixels(napi_env env, napi_callback_info info); @@ -56,7 +56,6 @@ private: static napi_value getPixelBytesCount(napi_env env, napi_callback_info info); static napi_value Release(napi_env env, napi_callback_info info); - static napi_ref sConstructor_; static std::shared_ptr sPixelMap_; @@ -65,7 +64,6 @@ private: std::shared_ptr nativePixelMap_; bool isRelease = false; }; - } // namespace Media } // namespace OHOS #endif /* PIXEL_MAP_NAPI_H_ */ diff --git a/interfaces/kits/native/include/image_pixel_map.h b/interfaces/kits/native/include/image_pixel_map.h index 9dd564c6a..2b2b50277 100644 --- a/interfaces/kits/native/include/image_pixel_map.h +++ b/interfaces/kits/native/include/image_pixel_map.h @@ -117,9 +117,6 @@ struct OhosPixelMapInfo { * @since 3 * @version 1.0 */ -/* -int32_t GetImageInfo(JNIEnv *env, jobject pixelMapObject, OhosPixelMapInfo &info); -*/ /** * @brief Obtains the memory address of a given PixelMap object and locks the memory. * @@ -136,9 +133,6 @@ int32_t GetImageInfo(JNIEnv *env, jobject pixelMapObject, OhosPixelMapInfo &info * @since 3 * @version 1.0 */ -/* -int32_t AccessPixels(JNIEnv *env, jobject pixelMapObject, void **addrPtr); -*/ /** * @brief Unlocks the memory storing the pixel data of a given PixelMap to balance a successful call to {@link * AccessPixels}. @@ -151,9 +145,6 @@ int32_t AccessPixels(JNIEnv *env, jobject pixelMapObject, void **addrPtr); * @since 3 * @version 1.0 */ -/* -int32_t UnAccessPixels(JNIEnv *env, jobject pixelMapObject); -*/ #ifdef __cplusplus }; diff --git a/mock/native/include/nocopyable.h b/mock/native/include/nocopyable.h index 383f8199b..2b046ab45 100644 --- a/mock/native/include/nocopyable.h +++ b/mock/native/include/nocopyable.h @@ -17,16 +17,25 @@ #define UTILS_BASE_NOCOPYABLE_H namespace OHOS { #define DISALLOW_COPY_AND_MOVE(className) \ +do \ +{ \ DISALLOW_COPY(className); \ - DISALLOW_MOVE(className) + DISALLOW_MOVE(className); \ +} while (0) #define DISALLOW_COPY(className) \ +do \ +{ \ className(const className&) = delete; \ - className& operator= (const className&) = delete + className& operator= (const className&) = delete; \ +} while (0) #define DISALLOW_MOVE(className) \ +do \ +{ \ className(className&&) = delete; \ - className& operator= (className&&) = delete + className& operator= (className&&) = delete; \ +} while (0) class NoCopyable { protected: NoCopyable() {}; @@ -36,4 +45,4 @@ private: DISALLOW_COPY_AND_MOVE(NoCopyable); }; } // namespace OHOS -#endif \ No newline at end of file +#endif diff --git a/mock/native/include/refbase.h b/mock/native/include/refbase.h index 69426221a..57e1b0d54 100644 --- a/mock/native/include/refbase.h +++ b/mock/native/include/refbase.h @@ -389,7 +389,7 @@ inline sptr::~sptr() } template -inline sptr::sptr(WeakRefCounter *p, bool /* force */) +inline sptr::sptr(WeakRefCounter *p, bool/* force */) { if ((p != nullptr) && p->AttemptIncStrongRef(this)) { refs_ = reinterpret_cast(p->GetRefPtr()); diff --git a/mock/native/include/rwlock.h b/mock/native/include/rwlock.h index 3a9f1f9af..21e6cc3bd 100644 --- a/mock/native/include/rwlock.h +++ b/mock/native/include/rwlock.h @@ -52,7 +52,7 @@ private: std::atomic_uint writeWaitCount_; }; -template +template class UniqueWriteGuard : NoCopyable { public: explicit UniqueWriteGuard(RWLockable &rwLockable) @@ -74,7 +74,7 @@ private: }; -template +template class UniqueReadGuard : NoCopyable { public: explicit UniqueReadGuard(RWLockable &rwLockable) diff --git a/mock/native/include/singleton.h b/mock/native/include/singleton.h index 5662fcfdc..4d35a997d 100644 --- a/mock/native/include/singleton.h +++ b/mock/native/include/singleton.h @@ -22,27 +22,34 @@ namespace OHOS { #define DECLARE_DELAYED_SINGLETON(MyClass) \ +do \ +{ \ public: \ ~MyClass(); \ private: \ friend DelayedSingleton; \ - MyClass(); + MyClass(); \ +} while (0) #define DECLARE_DELAYED_REF_SINGLETON(MyClass) \ +do \ +{ \ private: \ friend DelayedRefSingleton; \ ~MyClass(); \ - MyClass(); - + MyClass(); \ +} while (0) #define DECLARE_SINGLETON(MyClass) \ +do \ +{ \ private: \ friend Singleton; \ MyClass& operator=(const MyClass&) = delete; \ MyClass(const MyClass&) = delete; \ MyClass(); \ - ~MyClass(); - + ~MyClass(); \ +} while (0) template class DelayedSingleton : public NoCopyable { diff --git a/plugins/common/libs/image/formatagentplugin/src/plugin_export.cpp b/plugins/common/libs/image/formatagentplugin/src/plugin_export.cpp index 63d32f2e6..9b8071909 100644 --- a/plugins/common/libs/image/formatagentplugin/src/plugin_export.cpp +++ b/plugins/common/libs/image/formatagentplugin/src/plugin_export.cpp @@ -51,4 +51,4 @@ static constexpr HiLogLabel LABEL = { LOG_CORE, LOG_TAG_DOMAIN_ID_PLUGIN, "LibIm // define the external interface of this plugin. PLUGIN_EXPORT_DEFAULT_EXTERNAL_START() PLUGIN_EXPORT_DEFAULT_EXTERNAL_STOP() -PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() +// PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() diff --git a/plugins/common/libs/image/libgifplugin/src/plugin_export.cpp b/plugins/common/libs/image/libgifplugin/src/plugin_export.cpp index a34d5407c..549b117b5 100644 --- a/plugins/common/libs/image/libgifplugin/src/plugin_export.cpp +++ b/plugins/common/libs/image/libgifplugin/src/plugin_export.cpp @@ -37,4 +37,4 @@ static constexpr HiLogLabel LABEL = { LOG_CORE, LOG_TAG_DOMAIN_ID_PLUGIN, "LibGi // define the external interface of this plugin. PLUGIN_EXPORT_DEFAULT_EXTERNAL_START() PLUGIN_EXPORT_DEFAULT_EXTERNAL_STOP() -PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() +// PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() diff --git a/plugins/common/libs/image/libheifplugin/src/plugin_export.cpp b/plugins/common/libs/image/libheifplugin/src/plugin_export.cpp index 7173d27ab..9e32a2164 100644 --- a/plugins/common/libs/image/libheifplugin/src/plugin_export.cpp +++ b/plugins/common/libs/image/libheifplugin/src/plugin_export.cpp @@ -37,4 +37,4 @@ static constexpr HiLogLabel LABEL = { LOG_CORE, LOG_TAG_DOMAIN_ID_PLUGIN, "LibHe // define the external interface of this plugin. PLUGIN_EXPORT_DEFAULT_EXTERNAL_START() PLUGIN_EXPORT_DEFAULT_EXTERNAL_STOP() -PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() +// PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() diff --git a/plugins/common/libs/image/libjpegplugin/src/plugin_export.cpp b/plugins/common/libs/image/libjpegplugin/src/plugin_export.cpp index 9677c35b7..bac59e55e 100644 --- a/plugins/common/libs/image/libjpegplugin/src/plugin_export.cpp +++ b/plugins/common/libs/image/libjpegplugin/src/plugin_export.cpp @@ -41,4 +41,4 @@ static constexpr HiLogLabel LABEL = { LOG_CORE, LOG_TAG_DOMAIN_ID_PLUGIN, "LibJp // define the external interface of this plugin. PLUGIN_EXPORT_DEFAULT_EXTERNAL_START() PLUGIN_EXPORT_DEFAULT_EXTERNAL_STOP() -PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() +// PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() diff --git a/plugins/common/libs/image/libpngplugin/src/plugin_export.cpp b/plugins/common/libs/image/libpngplugin/src/plugin_export.cpp index ed1f7697e..d9409b280 100644 --- a/plugins/common/libs/image/libpngplugin/src/plugin_export.cpp +++ b/plugins/common/libs/image/libpngplugin/src/plugin_export.cpp @@ -37,4 +37,4 @@ static constexpr HiLogLabel LABEL = { LOG_CORE, LOG_TAG_DOMAIN_ID_PLUGIN, "LibPn // define the external interface of this plugin. PLUGIN_EXPORT_DEFAULT_EXTERNAL_START() PLUGIN_EXPORT_DEFAULT_EXTERNAL_STOP() -PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() +// PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() diff --git a/plugins/common/libs/image/libwebpplugin/src/plugin_export.cpp b/plugins/common/libs/image/libwebpplugin/src/plugin_export.cpp index d1b81c859..571590925 100644 --- a/plugins/common/libs/image/libwebpplugin/src/plugin_export.cpp +++ b/plugins/common/libs/image/libwebpplugin/src/plugin_export.cpp @@ -37,4 +37,4 @@ static constexpr HiLogLabel LABEL = { LOG_CORE, LOG_TAG_DOMAIN_ID_PLUGIN, "LibWe // define the external interface of this plugin. PLUGIN_EXPORT_DEFAULT_EXTERNAL_START() PLUGIN_EXPORT_DEFAULT_EXTERNAL_STOP() -PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() +// PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() diff --git a/plugins/manager/include/image/input_data_stream.h b/plugins/manager/include/image/input_data_stream.h index a2f6f514e..398d48a3e 100644 --- a/plugins/manager/include/image/input_data_stream.h +++ b/plugins/manager/include/image/input_data_stream.h @@ -59,20 +59,28 @@ public: virtual bool Seek(uint32_t position) = 0; // get inherited class type - virtual uint32_t GetStreamType() { return -1; } + virtual uint32_t GetStreamType() { + return -1; + } // get raw pointer for BUFFER TYPE - virtual uint8_t *GetDataPtr() { return nullptr; } + virtual uint8_t *GetDataPtr() { + return nullptr; + } // whether the stream data is completed or not. - virtual bool IsStreamCompleted() { return true; } + virtual bool IsStreamCompleted() { + return true; + } // get stream size - virtual size_t GetStreamSize() { return 0; } + virtual size_t GetStreamSize() { + return 0; + } virtual ~InputDataStream() {} }; } // namespace ImagePlugin } // namespace OHOS -#endif // INPUT_DATA_STREAM_H \ No newline at end of file +#endif // INPUT_DATA_STREAM_H diff --git a/plugins/manager/include/plugin_service.h b/plugins/manager/include/plugin_service.h index d17422738..ea6113cb0 100644 --- a/plugins/manager/include/plugin_service.h +++ b/plugins/manager/include/plugin_service.h @@ -46,12 +46,8 @@ template inline uint16_t GetInterfaceId() return INVALID_IID; } -#define DECLARE_INTERFACE(InterfaceType, interfaceID) \ - template <> \ - inline uint16_t OHOS::MultimediaPlugin::GetInterfaceId() \ - { \ - return interfaceID; \ - } +#define DECLARE_INTERFACE(InterfaceType, interfaceID) template <> inline uint16_t OHOS::MultimediaPlugin::GetInterfaceId() { return interfaceID; } + } // namespace MultimediaPlugin } // namespace OHOS diff --git a/plugins/manager/include/pluginbase/plugin_utils.h b/plugins/manager/include/pluginbase/plugin_utils.h index 75cd73114..790d3bcb1 100644 --- a/plugins/manager/include/pluginbase/plugin_utils.h +++ b/plugins/manager/include/pluginbase/plugin_utils.h @@ -63,28 +63,4 @@ void PluginExternalStop() \ PLUGIN_LOG_D("call PluginExternalStop() in package: %{public}s.", PACKAGE_NAME.c_str()); \ return; \ } - -#define PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() \ -OHOS::MultimediaPlugin::PluginClassBase *PluginExternalCreate(const std::string &className) \ -{ \ - PLUGIN_LOG_D("PluginExternalCreate: create object for package: %{public}s, class: %{public}s.", \ - PACKAGE_NAME.c_str(), className.c_str()); \ - \ - auto iter = implClassMap.find(className); \ - if (iter == implClassMap.end()) { \ - PLUGIN_LOG_E("PluginExternalCreate: failed to find class: %{public}s, in package: %{public}s.", \ - className.c_str(), PACKAGE_NAME.c_str()); \ - return nullptr; \ - } \ - \ - auto creator = iter->second; \ - if (creator == nullptr) { \ - PLUGIN_LOG_E("PluginExternalCreate: null creator for class: %{public}s, in package: %{public}s.", \ - className.c_str(), PACKAGE_NAME.c_str()); \ - return nullptr; \ - } \ - \ - return creator(); \ -} - #endif // PLUGIN_UTILS_H diff --git a/plugins/manager/test/unittest/common/plugin_example/plugin_example2/plugin_export.cpp b/plugins/manager/test/unittest/common/plugin_example/plugin_example2/plugin_export.cpp index 2e6110112..761ae7c4d 100644 --- a/plugins/manager/test/unittest/common/plugin_example/plugin_example2/plugin_export.cpp +++ b/plugins/manager/test/unittest/common/plugin_example/plugin_example2/plugin_export.cpp @@ -40,5 +40,5 @@ static constexpr HiLogLabel LABEL = { LOG_CORE, LOG_TAG_DOMAIN_ID_PLUGIN, "plugi // define the external interface of this plugin PLUGIN_EXPORT_DEFAULT_EXTERNAL_START() PLUGIN_EXPORT_DEFAULT_EXTERNAL_STOP() -PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() +// PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() diff --git a/plugins/manager/test/unittest/common/plugin_example/plugin_example3/plugin_export.cpp b/plugins/manager/test/unittest/common/plugin_example/plugin_example3/plugin_export.cpp index db149a35b..0205a53f3 100644 --- a/plugins/manager/test/unittest/common/plugin_example/plugin_example3/plugin_export.cpp +++ b/plugins/manager/test/unittest/common/plugin_example/plugin_example3/plugin_export.cpp @@ -40,5 +40,5 @@ static constexpr HiLogLabel LABEL = { LOG_CORE, LOG_TAG_DOMAIN_ID_PLUGIN, "plugi // define the external interface of this plugin PLUGIN_EXPORT_DEFAULT_EXTERNAL_START() PLUGIN_EXPORT_DEFAULT_EXTERNAL_STOP() -PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() +// PLUGIN_EXPORT_DEFAULT_EXTERNAL_CREATE() -- Gitee From 3a94b3617bfb7b967bdbcd159b5db57869753d07 Mon Sep 17 00:00:00 2001 From: caochuan Date: Fri, 24 Sep 2021 09:17:59 +0800 Subject: [PATCH 3/7] Fix code check issue Signed-off-by: caochuan --- mock/native/include/refbase.h | 2 +- plugins/manager/include/image/input_data_stream.h | 8 ++++---- plugins/manager/include/plugin_service.h | 3 +-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/mock/native/include/refbase.h b/mock/native/include/refbase.h index 57e1b0d54..ea1a03235 100644 --- a/mock/native/include/refbase.h +++ b/mock/native/include/refbase.h @@ -389,7 +389,7 @@ inline sptr::~sptr() } template -inline sptr::sptr(WeakRefCounter *p, bool/* force */) +inline sptr::sptr(WeakRefCounter *p, bool) { if ((p != nullptr) && p->AttemptIncStrongRef(this)) { refs_ = reinterpret_cast(p->GetRefPtr()); diff --git a/plugins/manager/include/image/input_data_stream.h b/plugins/manager/include/image/input_data_stream.h index 398d48a3e..0a1bccd40 100644 --- a/plugins/manager/include/image/input_data_stream.h +++ b/plugins/manager/include/image/input_data_stream.h @@ -60,22 +60,22 @@ public: // get inherited class type virtual uint32_t GetStreamType() { - return -1; + return -1; } // get raw pointer for BUFFER TYPE virtual uint8_t *GetDataPtr() { - return nullptr; + return nullptr; } // whether the stream data is completed or not. virtual bool IsStreamCompleted() { - return true; + return true; } // get stream size virtual size_t GetStreamSize() { - return 0; + return 0; } virtual ~InputDataStream() {} diff --git a/plugins/manager/include/plugin_service.h b/plugins/manager/include/plugin_service.h index ea6113cb0..1ac4cf5ba 100644 --- a/plugins/manager/include/plugin_service.h +++ b/plugins/manager/include/plugin_service.h @@ -46,8 +46,7 @@ template inline uint16_t GetInterfaceId() return INVALID_IID; } -#define DECLARE_INTERFACE(InterfaceType, interfaceID) template <> inline uint16_t OHOS::MultimediaPlugin::GetInterfaceId() { return interfaceID; } - +#define DECLARE_INTERFACE(InterfaceType, interfaceID) template<> inline uint16_t OHOS::MultimediaPlugin::GetInterfaceId() { return interfaceID; } } // namespace MultimediaPlugin } // namespace OHOS -- Gitee From 947133b03e82d1326b07be3265e4a922e0410c00 Mon Sep 17 00:00:00 2001 From: caochuan Date: Fri, 24 Sep 2021 11:08:25 +0800 Subject: [PATCH 4/7] Fix code validation issues Signed-off-by: caochuan --- .../manager/include/image/input_data_stream.h | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/plugins/manager/include/image/input_data_stream.h b/plugins/manager/include/image/input_data_stream.h index 0a1bccd40..6e4cc61b1 100644 --- a/plugins/manager/include/image/input_data_stream.h +++ b/plugins/manager/include/image/input_data_stream.h @@ -59,23 +59,27 @@ public: virtual bool Seek(uint32_t position) = 0; // get inherited class type - virtual uint32_t GetStreamType() { - return -1; + virtual uint32_t GetStreamType() + { + return -1; } // get raw pointer for BUFFER TYPE - virtual uint8_t *GetDataPtr() { - return nullptr; + virtual uint8_t *GetDataPtr() + { + return nullptr; } // whether the stream data is completed or not. - virtual bool IsStreamCompleted() { - return true; + virtual bool IsStreamCompleted() + { + return true; } // get stream size - virtual size_t GetStreamSize() { - return 0; + virtual size_t GetStreamSize() + { + return 0; } virtual ~InputDataStream() {} -- Gitee From 1016c51c562e2029112adda91e9bce3311c2ee60 Mon Sep 17 00:00:00 2001 From: caochuan Date: Fri, 24 Sep 2021 13:38:22 +0800 Subject: [PATCH 5/7] Fix code validation issues Signed-off-by: caochuan --- mock/native/include/nocopyable.h | 4 ++-- plugins/manager/include/plugin_service.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mock/native/include/nocopyable.h b/mock/native/include/nocopyable.h index 2b046ab45..060a872d2 100644 --- a/mock/native/include/nocopyable.h +++ b/mock/native/include/nocopyable.h @@ -27,14 +27,14 @@ do \ do \ { \ className(const className&) = delete; \ - className& operator= (const className&) = delete; \ + (className)& operator= (const className&) = delete; \ } while (0) #define DISALLOW_MOVE(className) \ do \ { \ className(className&&) = delete; \ - className& operator= (className&&) = delete; \ + (className)& operator= (className&&) = delete; \ } while (0) class NoCopyable { protected: diff --git a/plugins/manager/include/plugin_service.h b/plugins/manager/include/plugin_service.h index 1ac4cf5ba..768c80d4f 100644 --- a/plugins/manager/include/plugin_service.h +++ b/plugins/manager/include/plugin_service.h @@ -46,7 +46,7 @@ template inline uint16_t GetInterfaceId() return INVALID_IID; } -#define DECLARE_INTERFACE(InterfaceType, interfaceID) template<> inline uint16_t OHOS::MultimediaPlugin::GetInterfaceId() { return interfaceID; } +#define DECLARE_INTERFACE(InterfaceType, interfaceID) template<> inline uint16_t OHOS::MultimediaPlugin::GetInterfaceId() { return interfaceID; } } // namespace MultimediaPlugin } // namespace OHOS -- Gitee From 52557729e3dcd7867822a6e9ace7756f4694d2b4 Mon Sep 17 00:00:00 2001 From: caochuan Date: Fri, 24 Sep 2021 14:25:22 +0800 Subject: [PATCH 6/7] Fix code check issue Signed-off-by: caochuan --- mock/native/include/nocopyable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mock/native/include/nocopyable.h b/mock/native/include/nocopyable.h index 060a872d2..e5203d024 100644 --- a/mock/native/include/nocopyable.h +++ b/mock/native/include/nocopyable.h @@ -34,7 +34,7 @@ do \ do \ { \ className(className&&) = delete; \ - (className)& operator= (className&&) = delete; \ + (className)& operator= ((className)&&) = delete; \ } while (0) class NoCopyable { protected: -- Gitee From 2f843feafa3c3c39dcd25ba0666dcccf5cb121e3 Mon Sep 17 00:00:00 2001 From: caochuan Date: Fri, 24 Sep 2021 14:33:12 +0800 Subject: [PATCH 7/7] Fix loading issue Signed-off-by: caochuan --- frameworks/kits/js/common/native_module_ohos_image.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/kits/js/common/native_module_ohos_image.cpp b/frameworks/kits/js/common/native_module_ohos_image.cpp index 3e62211be..bd70d78e6 100644 --- a/frameworks/kits/js/common/native_module_ohos_image.cpp +++ b/frameworks/kits/js/common/native_module_ohos_image.cpp @@ -43,7 +43,7 @@ static napi_module g_module = { /* * module register */ -extern "C" __attribute__((constructor)) void RegisterModule(void) +extern "C" __attribute__((constructor)) void ImageRegisterModule(void) { napi_module_register(&g_module); } -- Gitee