diff --git a/frameworks/innerkitsimpl/converter/include/matrix.h b/frameworks/innerkitsimpl/converter/include/matrix.h index 7545c4c4cde235bd4279f0dacafba3d1f3bd0cc1..f06b60835029a0dcd2095d03d30e07a1eed257a7 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/innerkitsimpl/pixelconverter/BUILD.gn b/frameworks/innerkitsimpl/pixelconverter/BUILD.gn index 2389606bbac1bbfc4d8bf630433c891e5b4a81e3..9f5bf5b23076e420958f1c4f1a359c8e503cb52d 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/frameworks/kits/js/common/include/image_napi_utils.h b/frameworks/kits/js/common/include/image_napi_utils.h index f5d8e062fdbfaf845690c68ce484e2a3457ac1fc..f692d8d5aa5e50c2f3b30fc5c5ba013dbbe29ab8 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/frameworks/kits/js/common/native_module_ohos_image.cpp b/frameworks/kits/js/common/native_module_ohos_image.cpp index 3e62211bee444435af78be7614d2d1acbb9d8b01..bd70d78e60cdf60b51e492c40d40a8ab51c15035 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); } diff --git a/interfaces/innerkits/include/media_errors.h b/interfaces/innerkits/include/media_errors.h index 1699dc731963e7ecdb63a9219ddbd1b358259db0..6cb2a1eeb86bd05f0c69d222a7e6796269abfdcd 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/innerkits/include/pixel_map.h b/interfaces/innerkits/include/pixel_map.h index 687a4e7bf2646a428ac27febc45448e9abe90ec7..68a5a44b8b4bdb13abd023aec94a59b48f117717 100644 --- a/interfaces/innerkits/include/pixel_map.h +++ b/interfaces/innerkits/include/pixel_map.h @@ -18,7 +18,6 @@ #include #include "image_type.h" -#include "refbase.h" #include "parcel.h" namespace OHOS { diff --git a/interfaces/kits/js/common/include/image_source_napi.h b/interfaces/kits/js/common/include/image_source_napi.h index 561ea51431f1edfabb53cbcc68fab3c85dc65272..8f522dad4a969a3f8be7f2e6209a989d6ed7ec07 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 065fe38ea1771c72079266e51b086a897a735c2d..3764f4b54236c683ca3be70600eaa705fc67c2b8 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 9dd564c6a413bca15b9c1cd9f5ed25ab9fb5d4e6..2b2b502779888bd4e5905404c638c71fdf102b33 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 383f8199b9a0b2caac2db599aa693fb5c6bd0a81..e5203d024e9b3a176864681357f1ffc50d73c537 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 deleted file mode 100644 index 69426221acdb9ba9a055c59af20e7c219da50a51..0000000000000000000000000000000000000000 --- a/mock/native/include/refbase.h +++ /dev/null @@ -1,679 +0,0 @@ -/* - * Copyright (C) 2021 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 - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef UTILS_BASE_REFBASE_H -#define UTILS_BASE_REFBASE_H - -#include -#include - -namespace OHOS { -#define INITIAL_PRIMARY_VALUE (1 << 28) - -class RefBase; - -class RefCounter { -public: - using RefPtrCallback = std::function; - - RefCounter(); - - explicit RefCounter(RefCounter *counter); - - RefCounter &operator=(const RefCounter &counter); - - virtual ~RefCounter(); - - void SetCallback(const RefPtrCallback& callback); - - void RemoveCallback(); - - int GetRefCount(); - - void IncRefCount(); - - void DecRefCount(); - - bool IsRefPtrValid(); - - int IncStrongRefCount(const void *objectId); - - int DecStrongRefCount(const void *objectId); - - int GetStrongRefCount(); - - int IncWeakRefCount(const void *objectId); - - int DecWeakRefCount(const void *objectId); - - int GetWeakRefCount(); - - void SetAttemptAcquire(); - - bool IsAttemptAcquireSet(); - - void ClearAttemptAcquire(); - - bool AttemptIncStrongRef(const void *objectId, int &outCount); - - bool IsLifeTimeExtended(); - - void ExtendObjectLifetime(); - -private: - std::atomic atomicStrong_; - std::atomic atomicWeak_; - std::atomic atomicRefCount_; - std::atomic atomicFlags_; - std::atomic atomicAttempt_; - RefPtrCallback callback_ = nullptr; - static constexpr unsigned int FLAG_EXTEND_LIFE_TIME = 0x00000002; -}; - -class WeakRefCounter { -public: - WeakRefCounter(RefCounter *base, void *cookie); - - virtual ~WeakRefCounter(); - - void *GetRefPtr(); - - void IncWeakRefCount(const void *objectId); - - void DecWeakRefCount(const void *objectId); - - bool AttemptIncStrongRef(const void *objectId); - -private: - std::atomic atomicWeak_; - RefCounter *refCounter_ = nullptr; - void *cookie_ = nullptr; -}; - -class RefBase { -public: - RefBase(); - - RefBase(const RefBase &refbase); - - RefBase &operator=(const RefBase &refbase); - - RefBase(RefBase &&refbase) noexcept; - - RefBase &operator=(RefBase &&refbase) noexcept; - - virtual ~RefBase(); - - void RefPtrCallback(); - - void ExtendObjectLifetime(); - - void IncStrongRef(const void *objectId); - - void DecStrongRef(const void *objectId); - - int GetSptrRefCount(); - - WeakRefCounter *CreateWeakRef(void *cookie); - - void IncWeakRef(const void *objectId); - - void DecWeakRef(const void *objectId); - - int GetWptrRefCount(); - - bool AttemptAcquire(const void *objectId); - - bool AttemptIncStrongRef(const void *objectId); - - bool IsAttemptAcquireSet(); - - bool IsExtendLifeTimeSet(); - - virtual void OnFirstStrongRef(const void *objectId); - - virtual void OnLastStrongRef(const void *objectId); - - virtual void OnLastWeakRef(const void *objectId); - - virtual bool OnAttemptPromoted(const void *objectId); - -private: - RefCounter *refs_ = nullptr; -}; - -template -class wptr; - -template -class sptr { - friend class wptr; - -public: - sptr(); - - ~sptr(); - - sptr(T *other); - - sptr(const sptr &other); - - sptr(sptr &&other); - - sptr &operator=(sptr &&other); - - template - sptr(const sptr &other); - - inline sptr(WeakRefCounter *p, bool force); - - inline T *GetRefPtr() const - { - return refs_; - } - - inline void ForceSetRefPtr(T *other); - - void clear(); - - inline operator T *() const - { - return refs_; - } - - inline T &operator*() const - { - return *refs_; - } - - inline T *operator->() const - { - return refs_; - } - - inline bool operator!() const - { - return refs_ == nullptr; - } - - sptr &operator=(T *other); - - sptr &operator=(const sptr &other); - - sptr &operator=(const wptr &other); - - template - sptr &operator=(const sptr &other); - - bool operator==(const T *other) const; - - inline bool operator!=(const T *other) const - { - return !operator==(other); - } - - bool operator==(const wptr &other) const; - - inline bool operator!=(const wptr &other) const - { - return !operator==(other); - } - - bool operator==(const sptr &other) const; - - inline bool operator!=(const sptr &other) const - { - return !operator==(other); - } - -private: - T *refs_ = nullptr; -}; - -template -inline void sptr::ForceSetRefPtr(T *other) -{ - refs_ = other; -} - -template -inline sptr::sptr() -{ - refs_ = nullptr; -} - -template -inline sptr::sptr(T *other) -{ - refs_ = other; - if (refs_ != nullptr) { - refs_->IncStrongRef(this); - } -} - -template -inline sptr::sptr(const sptr &other) -{ - refs_ = other.GetRefPtr(); - if (refs_ != nullptr) { - refs_->IncStrongRef(this); - } -} - -template -sptr::sptr(sptr &&other) -{ - refs_ = other.GetRefPtr(); - other.ForceSetRefPtr(nullptr); -} - -template -sptr &sptr::operator=(sptr &&other) -{ - if (refs_ != nullptr) { - refs_->DecStrongRef(this); - } - refs_ = other.GetRefPtr(); - other.ForceSetRefPtr(nullptr); - return *this; -} - -template -template -sptr::sptr(const sptr &other) : refs_(other.GetRefPtr()) -{ - if (refs_ != nullptr) { - refs_->IncStrongRef(this); - } -} - -template -inline sptr &sptr::operator=(T *other) -{ - if (other != nullptr) { - other->IncStrongRef(this); - } - if (refs_ != nullptr) { - refs_->DecStrongRef(this); - } - refs_ = other; - return *this; -} - -template -inline sptr &sptr::operator=(const sptr &other) -{ - T *otherRef(other.GetRefPtr()); - if (otherRef != nullptr) { - otherRef->IncStrongRef(this); - } - if (refs_ != nullptr) { - refs_->DecStrongRef(this); - } - refs_ = otherRef; - return *this; -} - -template -inline sptr &sptr::operator=(const wptr &other) -{ - if ((other != nullptr) && other.AttemptIncStrongRef(this)) { - refs_ = other.GetRefPtr(); - } else { - refs_ = nullptr; - } - return *this; -} - -template -template -sptr &sptr::operator=(const sptr &other) -{ - T *otherRef(other.GetRefPtr()); - if (otherRef != nullptr) { - otherRef->IncStrongRef(this); - } - if (refs_ != nullptr) { - refs_->DecStrongRef(this); - } - refs_ = otherRef; - return *this; -} - -template -inline bool sptr::operator==(const T *other) const -{ - return other == refs_; -} - -template -inline bool sptr::operator==(const wptr &other) const -{ - return refs_ == other.GetRefPtr(); -} - -template -inline bool sptr::operator==(const sptr &other) const -{ - return refs_ == other.GetRefPtr(); -} - -template -void sptr::clear() -{ - if (refs_) { - refs_->DecStrongRef(this); - refs_ = 0; - } -} - -template -inline sptr::~sptr() -{ - if (refs_ != nullptr) { - refs_->DecStrongRef(this); - } -} - -template -inline sptr::sptr(WeakRefCounter *p, bool /* force */) -{ - if ((p != nullptr) && p->AttemptIncStrongRef(this)) { - refs_ = reinterpret_cast(p->GetRefPtr()); - } else { - refs_ = nullptr; - } -} - -template -class wptr { - template - friend class wptr; - -public: - wptr(); - - wptr(T *other); - - wptr(const wptr &other); - - wptr(const sptr &other); - - template - wptr(const wptr &other); - - template - wptr(const sptr &other); - - wptr &operator=(T *other); - - template - wptr &operator=(O *other); - - wptr &operator=(const wptr &other); - - wptr &operator=(const sptr &other); - - template - wptr &operator=(const wptr &other); - - template - wptr &operator=(const sptr &other); - - inline T *operator*() const - { - return *refs_; - } - inline T *operator->() const - { - return reinterpret_cast(refs_->GetRefPtr()); - } - - bool operator==(const T *other) const; - - inline bool operator!=(const T *other) const - { - return !operator==(other); - }; - - bool operator==(const wptr &other) const; - - inline bool operator!=(const wptr &other) const - { - return !operator==(other); - } - - bool operator==(const sptr &other) const; - - inline bool operator!=(const sptr &other) const - { - return !operator==(other); - } - - T *GetRefPtr() const; - - inline bool AttemptIncStrongRef(const void *objectId) const - { - return refs_->AttemptIncStrongRef(objectId); - } - - const sptr promote() const; - - ~wptr(); - -private: - WeakRefCounter *refs_ = nullptr; -}; - -template -inline T *wptr::GetRefPtr() const -{ - return (refs_ != nullptr) ? reinterpret_cast(refs_->GetRefPtr()) : nullptr; -} - -template -wptr::wptr() -{ - refs_ = nullptr; -} - -template -wptr::wptr(T *other) -{ - if (other != nullptr) { - refs_ = other->CreateWeakRef(other); - if (refs_ != nullptr) { - refs_->IncWeakRefCount(this); - } - } else { - refs_ = nullptr; - } -} - -template -wptr::wptr(const wptr &other) -{ - refs_ = other.refs_; - if (refs_ != nullptr) { - refs_->IncWeakRefCount(this); - } -} - -template -wptr::wptr(const sptr &other) -{ - if (other.GetRefPtr() != nullptr) { - refs_ = other->CreateWeakRef(other.GetRefPtr()); - if (refs_ != nullptr) { - refs_->IncWeakRefCount(this); - } - } -} - -template -template -wptr::wptr(const wptr &other) -{ - refs_ = other.refs_; - if (refs_ != nullptr) { - refs_->IncWeakRefCount(this); - } -} - -template -template -wptr::wptr(const sptr &other) -{ - if (other.GetRefPtr() != nullptr) { - refs_ = other->CreateWeakRef(other.GetRefPtr()); - if (refs_ != nullptr) { - refs_->IncWeakRefCount(this); - } - } -} - -template -wptr &wptr::operator=(T *other) -{ - WeakRefCounter *newWeakRef = nullptr; - if (other != nullptr) { - newWeakRef = other->CreateWeakRef(other); - if (newWeakRef != nullptr) { - newWeakRef->IncWeakRefCount(this); - } - } - if (refs_ != nullptr) { - refs_->DecWeakRefCount(this); - } - refs_ = newWeakRef; - return *this; -} - -template -template -wptr &wptr::operator=(O *other) -{ - T *object = reinterpret_cast(other); - WeakRefCounter *newWeakRef = nullptr; - if (object != nullptr) { - newWeakRef = object->CreateWeakRef(object); - if (newWeakRef != nullptr) { - newWeakRef->IncWeakRefCount(this); - } - } - if (refs_ != nullptr) { - refs_->DecWeakRefCount(this); - } - - refs_ = newWeakRef; - return *this; -} - -template -inline wptr &wptr::operator=(const wptr &other) -{ - if (other.refs_ != nullptr) { - other.refs_->IncWeakRefCount(this); - } - if (refs_ != nullptr) { - refs_->DecWeakRefCount(this); - } - refs_ = other.refs_; - return *this; -} - -template -inline wptr &wptr::operator=(const sptr &other) -{ - WeakRefCounter *newWeakRef = nullptr; - if (other.GetRefPtr() != nullptr) { - newWeakRef = other->CreateWeakRef(other.GetRefPtr()); - if (newWeakRef != nullptr) { - newWeakRef->IncWeakRefCount(this); - } - } - if (refs_ != nullptr) { - refs_->DecWeakRefCount(this); - } - refs_ = newWeakRef; - return *this; -} - -template -template -wptr &wptr::operator=(const wptr &other) -{ - if (other.refs_ != nullptr) { - other.refs_->IncWeakRefCount(this); - } - if (refs_ != nullptr) { - refs_->DecWeakRefCount(this); - } - refs_ = other.refs_; - return *this; -} - -template -template -wptr &wptr::operator=(const sptr &other) -{ - WeakRefCounter *newWeakRef = nullptr; - if (other.GetRefPtr() != nullptr) { - newWeakRef = other->CreateWeakRef(other->GetRefPtr()); - if (newWeakRef != nullptr) { - newWeakRef->IncWeakRefCount(this); - } - } - if (refs_ != nullptr) { - refs_->DecWeakRefCount(this); - } - refs_ = newWeakRef; - return *this; -} - -template -inline bool wptr::operator==(const T *other) const -{ - return GetRefPtr() == other; -} - -template -inline bool wptr::operator==(const wptr &other) const -{ - return GetRefPtr() == other.GetRefPtr(); -} - -template -inline bool wptr::operator==(const sptr &other) const -{ - return GetRefPtr() == other.GetRefPtr(); -} - -template -inline const sptr wptr::promote() const -{ - return sptr(refs_, true); -} - -template -inline wptr::~wptr() -{ - if (refs_ != nullptr) { - refs_->DecWeakRefCount(this); - } -} -} // namespace OHOS -#endif diff --git a/mock/native/include/rwlock.h b/mock/native/include/rwlock.h index 3a9f1f9af78680062f0b72027e13eb1f0deb9c0d..21e6cc3bd727800807d3e5abd940bd7aee9648e0 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 5662fcfdc272a784ecc3e66728ee57ff20862fe6..4d35a997d87a2f4060ec5ca8ce992c1b120e19fd 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 63d32f2e640fce5ba6ab8505114732bd165f53d8..9b80719096b3d936164f74d970e6c3da43fbeb9b 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 a34d5407c17b37ca08b183f40b070dfc691ccc44..549b117b51dcfaf7e3598595d4965fbc20826cfb 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 7173d27abd60a27f42555a67b89ce86dad42f01d..9e32a21647bb65b5d7dbcd841ceba6e218665f25 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 9677c35b766c410850c3bebe315dfbc7bab247c2..bac59e55efc0c4cdc6a798d37d3519e95d1bf400 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 ed1f7697e9191b5cb72729dd7c634eeb6504268d..d9409b28016c273666949a6ad31ab311b4ee5f81 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 d1b81c859cf3fabcd89496fb94bced9a444be1d9..57159092550d828ecae9a57a24a77465a97aa433 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/BUILD.gn b/plugins/manager/BUILD.gn index b5b0040905a3372d708ecfd279da026b0af00cab..11223d876f16db7b088a0c4891627da5be04e013 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" } diff --git a/plugins/manager/include/image/input_data_stream.h b/plugins/manager/include/image/input_data_stream.h index a2f6f514e8b434d788ea76d522e752c7d0daddba..6e4cc61b12e6976c69e5a2b8d65e0436a4ca730e 100644 --- a/plugins/manager/include/image/input_data_stream.h +++ b/plugins/manager/include/image/input_data_stream.h @@ -59,20 +59,32 @@ 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 d17422738c11424ee8906d051810038f0a01c5fb..79425417ea47434fd0092fe51e9121ad28cddfc9 100644 --- a/plugins/manager/include/plugin_service.h +++ b/plugins/manager/include/plugin_service.h @@ -45,13 +45,8 @@ template inline uint16_t GetInterfaceId() { return INVALID_IID; } - -#define DECLARE_INTERFACE(InterfaceType, interfaceID) \ - template <> \ - inline uint16_t OHOS::MultimediaPlugin::GetInterfaceId() \ - { \ - return interfaceID; \ - } +#define GET_INTERFACE_ID OHOS::MultimediaPlugin::GetInterfaceId +#define DECLARE_INTERFACE(Type, ID) template<> inline uint16_t GET_INTERFACE_ID() { return ID; } } // namespace MultimediaPlugin } // namespace OHOS diff --git a/plugins/manager/include/pluginbase/plugin_utils.h b/plugins/manager/include/pluginbase/plugin_utils.h index 75cd7311495f85623eb9011d2e72ee1aa860f5db..790d3bcb1ed3200146b2c42d51bc7438b987ea7b 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 2e61101123d563f3bb2ea5befe4849a9674d2419..761ae7c4d2ef68fc211abd501abd3cb22beff792 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 db149a35bafe6e7f26ee5d24a77b7e2ad0f9aa75..0205a53f35a04c67e0e6abb71db0867f90493e40 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()