From 8fe1714d6db5dce1c206ea84732b51ea26cd7613 Mon Sep 17 00:00:00 2001 From: peilixia Date: Thu, 18 May 2023 19:02:12 +0800 Subject: [PATCH] Alarm clearing Issue: I77SY1 Test: NA Signed-off-by: peilixia Change-Id: I2eb596dd6369b9c936a11d62bd58bff737081e97 --- base/include/datetime_ex.h | 4 +- base/include/directory_ex.h | 17 ++++---- base/include/observer.h | 4 +- base/include/refbase.h | 2 +- base/include/safe_map.h | 10 ++--- base/include/singleton.h | 42 +++++++++---------- base/include/sorted_vector.h | 24 +++++------ base/include/unique_fd.h | 2 +- .../unittest/common/utils_refbase_test.cpp | 1 - 9 files changed, 52 insertions(+), 54 deletions(-) diff --git a/base/include/datetime_ex.h b/base/include/datetime_ex.h index b6ae42e..cc94633 100644 --- a/base/include/datetime_ex.h +++ b/base/include/datetime_ex.h @@ -123,8 +123,8 @@ int64_t GetDaysSince1970ToNow(); /** * @brief Get current timezone. * - * @param timezone Today the world is divided into 24 timezones, they are - * medium timezone (zero timezone), east 1-12 timezone, west 1-12 timezone.The + * @param timezone Today the world is divided into 24 timezones, they are + * medium timezone (zero timezone), east 1-12 timezone, west 1-12 timezone.The * East time zone is +1 to +12 and the West time zone is -1 to -12. * @return return true if get success, else false. */ diff --git a/base/include/directory_ex.h b/base/include/directory_ex.h index 9312c56..dc3e410 100644 --- a/base/include/directory_ex.h +++ b/base/include/directory_ex.h @@ -25,12 +25,11 @@ namespace OHOS { /** * @brief Get the full absolute path to the current program. * - * /proc/self/exe represents the current program, and its source path can be - * read with the readlink function to get the absolute path of the current + * /proc/self/exe represents the current program, and its source path can be + * read with the readlink function to get the absolute path of the current * program. */ std::string GetCurrentProcFullFileName(); -std::string GetCurrentProcFullFileName(); /** * @brief Get the absolute path of the current program. @@ -48,7 +47,7 @@ std::string ExtractFilePath(const std::string& fileFullName); std::string ExtractFileName(const std::string& fileFullName); /** - * @brief Obtain the filename extension to the corresponding file by the full + * @brief Obtain the filename extension to the corresponding file by the full * path. */ std::string ExtractFileExt(const std::string& fileName); @@ -56,7 +55,7 @@ std::string ExtractFileExt(const std::string& fileName); /** * @brief Exclude the end '/' from the strPath. * - * Determine whether the path has ended with '/', and returns the path after + * Determine whether the path has ended with '/', and returns the path after * removing '/', otherwise returns the path directly. */ std::string ExcludeTrailingPathDelimiter(const std::string& path); @@ -64,7 +63,7 @@ std::string ExcludeTrailingPathDelimiter(const std::string& path); /** * @brief Include the end '/' from the strPath. * - * Determine whether the path has ended with "/", and returns the path after + * Determine whether the path has ended with "/", and returns the path after * adding '/', otherwise returns the path directly. */ std::string IncludeTrailingPathDelimiter(const std::string& path); @@ -89,7 +88,7 @@ bool IsEmptyFolder(const std::string& path); * * Parent directory can be created at the same time when it does not exist. * - * @note If there are problems such as 'Permission Denied', the creation may + * @note If there are problems such as 'Permission Denied', the creation may * also fail. * @return Return true if create success, else false. */ @@ -101,7 +100,7 @@ bool ForceCreateDirectory(const std::string& path); * All subdirs and files will also be deleted. * * @note It is not necessarily successful to delete. - * @note If there are problems such as 'Permission Denied', the deletion may + * @note If there are problems such as 'Permission Denied', the deletion may * also fail. * @return Return true if delete success, else false. */ @@ -128,7 +127,7 @@ uint64_t GetFolderSize(const std::string& path); bool ChangeModeFile(const std::string& fileName, const mode_t& mode); /** - * @brief Change authority of the directory specified by path and all of its + * @brief Change authority of the directory specified by path and all of its * subdirectories. * * @param mode Specify the changed permissions, see chmod(). diff --git a/base/include/observer.h b/base/include/observer.h index 46d9700..07e60f9 100644 --- a/base/include/observer.h +++ b/base/include/observer.h @@ -45,7 +45,7 @@ public: /** * @brief Add the specified observer to the set of observers. * - * If `o` is valid and does not exist in the observer set, the observer + * If `o` is valid and does not exist in the observer set, the observer * will be added, otherwise this function will return directly. */ void AddObserver(const std::shared_ptr& o); @@ -70,7 +70,7 @@ public: /** * @brief Notify all observers, and pass the data 'arg' to the observer. * - * If the `changed_` is true, call the `Update()` function to notify all + * If the `changed_` is true, call the `Update()` function to notify all * observers to respond. * * @param arg Parameters and data maybe used for Observer::Update(). diff --git a/base/include/refbase.h b/base/include/refbase.h index 107a46f..66db564 100644 --- a/base/include/refbase.h +++ b/base/include/refbase.h @@ -347,7 +347,7 @@ private: * @ingroup SmartPointer * @brief A base class which can be managed by a smart pointer. * - * @note All classes which intend to be managed by smart pointers should be + * @note All classes which intend to be managed by smart pointers should be * derived from RefBase. */ class RefBase { diff --git a/base/include/safe_map.h b/base/include/safe_map.h index 4a3fc61..b137ab5 100644 --- a/base/include/safe_map.h +++ b/base/include/safe_map.h @@ -65,7 +65,7 @@ public: /** * @brief Determine whether the map is empty or not. * - * when multithread calling Empty() return a tmp status, some threads may + * when multithread calling Empty() return a tmp status, some threads may * insert just after Empty() call. * * @return Return true if it is empty, otherwise returns false. @@ -81,7 +81,7 @@ public: * * @param key The key to be inserted. * @param value The value to be inserted. - * @return Return true if the insertion is successful, otherwise returns + * @return Return true if the insertion is successful, otherwise returns * false. */ bool Insert(const K& key, const V& value) @@ -96,7 +96,7 @@ public: * * @param key The key to be inserted. * @param value The value to be inserted. - * @note Delete and then insert when the key exists, ensuring that the + * @note Delete and then insert when the key exists, ensuring that the * final value is inserted. */ void EnsureInsert(const K& key, const V& value) @@ -134,7 +134,7 @@ public: } /** - * @brief Search for elements in the map and replace the `oldValue` + * @brief Search for elements in the map and replace the `oldValue` * corresponding to the key with `newValue`. * * @param Key The key to be found. @@ -185,7 +185,7 @@ public: /** * @brief Iterate through the elements in the map. * - * @param callback A specific function that performs custom operations on + * @param callback A specific function that performs custom operations on * each KV key-value pair. */ void Iterate(const SafeMapCallBack& callback) diff --git a/base/include/singleton.h b/base/include/singleton.h index fc79332..3f3f4e4 100644 --- a/base/include/singleton.h +++ b/base/include/singleton.h @@ -23,11 +23,11 @@ namespace OHOS { /** - * The purpose of the following macro definitions is to reduce the need + * The purpose of the following macro definitions is to reduce the need * to write repetitive code when defining singleton classes on the client side. - * - * Taking DelayedSingleton as an example, when declaring the target class as a - * singleton, add the DECLARE_DELAYED_SINGLETON (class_name) to the class + * + * Taking DelayedSingleton as an example, when declaring the target class as a + * singleton, add the DECLARE_DELAYED_SINGLETON (class_name) to the class * declaration.\n * When using the target singleton, call class_name::GetInstance()->. */ @@ -35,11 +35,11 @@ namespace OHOS { /** * @brief Set `MyClass` as a `DelayedSingleton`. * - * `MyClass` object can be obtained by calling + * `MyClass` object can be obtained by calling * `DelayedSingleton::GetInstance()`. * * @param MyClass Target class to be set as a singleton. - * @note This macro definition should be used into the body of a class + * @note This macro definition should be used into the body of a class * definition. */ #define DECLARE_DELAYED_SINGLETON(MyClass)\ @@ -52,11 +52,11 @@ private:\ /** * @brief Set `MyClass` as a `DelayedRefSingleton`. * - * `MyClass` object can be obtained by calling + * `MyClass` object can be obtained by calling * `DelayedRefSingleton::GetInstance()`. * * @param MyClass Target class to be set as a singleton. - * @note This macro definition should be used into the body of a class + * @note This macro definition should be used into the body of a class * definition. */ #define DECLARE_DELAYED_REF_SINGLETON(MyClass)\ @@ -68,11 +68,11 @@ private:\ /** * @brief Set `MyClass` as a `Singleton`. * - * `MyClass` object can be obtained by calling + * `MyClass` object can be obtained by calling * `Singleton::GetInstance()`. * * @param MyClass Target class to be set as a singleton. - * @note This macro definition should be used into the body of a class + * @note This macro definition should be used into the body of a class * definition. */ #define DECLARE_SINGLETON(MyClass)\ @@ -93,8 +93,8 @@ public: /** * @brief Create a unique instance object and return. * - * Use smart pointer to manage resources, and when all shared_ptrs are - * destroyed, the new object will also be deleted. This avoids memory + * Use smart pointer to manage resources, and when all shared_ptrs are + * destroyed, the new object will also be deleted. This avoids memory * leaks.\n * Lock is added only when the pointer is empty to avoid locking every time * the `GetInstance()` method is called, reducing the overhead of lock. @@ -103,16 +103,16 @@ public: /** * @brief Release the ownership of managed object of the smart pointer. * - * @note After calling this method, the 'GetInstance()' method will create - * a new object, and if the old object has an external 'std::shared_ptr' - * reference, the developer needs to release it himself to guarantee a + * @note After calling this method, the 'GetInstance()' method will create + * a new object, and if the old object has an external 'std::shared_ptr' + * reference, the developer needs to release it himself to guarantee a * singleton. */ static void DestroyInstance(); private: static std::shared_ptr instance_; // Record the created DelayedSingleton instance. - static std::mutex mutex_; // Mutex, which guarantees that only one thread is accessing a common resource at any time. + static std::mutex mutex_; // Guarantees that only one thread is accessing a common resource at any time. }; template @@ -146,7 +146,7 @@ void DelayedSingleton::DestroyInstance() } /** - * @brief class DelayedRefSingleton is a thread-safe, lazy initialized + * @brief class DelayedRefSingleton is a thread-safe, lazy initialized * singleton(with ordinary pointer and lock). */ template @@ -155,12 +155,12 @@ public: /** * @brief Create a unique instance object and return. * - * Pointer is used in the implementation, and the return type is a - * reference:the instance returned by reference has a lifetime that is + * Pointer is used in the implementation, and the return type is a + * reference:the instance returned by reference has a lifetime that is * managed by non-user code. * * @note The instance may not have been created at a certain point in time, - * or it can be deleted, which cannot prevent the user from using delete + * or it can be deleted, which cannot prevent the user from using delete * keyword to cause the object to be destroyed in advance. */ static T& GetInstance(); @@ -190,7 +190,7 @@ T& DelayedRefSingleton::GetInstance() } /** - * @brief class Singleton is a normal initialized singleton(no pointers and + * @brief class Singleton is a normal initialized singleton(no pointers and * locks are used). */ template diff --git a/base/include/sorted_vector.h b/base/include/sorted_vector.h index 1f7aeed..ed23d8e 100644 --- a/base/include/sorted_vector.h +++ b/base/include/sorted_vector.h @@ -79,7 +79,7 @@ public: inline bool IsEmpty() const { return vec_.empty(); } /** - * @brief Return how many items can be stored before reallocating new + * @brief Return how many items can be stored before reallocating new * storage space. */ inline size_t Capacity() const { return vec_.capacity(); } @@ -87,7 +87,7 @@ public: /** * @brief Set the vector's capacity to `size`. * - * @return Return `size` if the vector's capacity is changed to `size`, + * @return Return `size` if the vector's capacity is changed to `size`, * otherwise return `CAPACITY_NOT_CHANGED`(-1). */ ssize_t SetCapcity(size_t size) @@ -102,13 +102,13 @@ public: // Cstyle access /** - * @brief Return a const pointer to the first item of a vector, which is + * @brief Return a const pointer to the first item of a vector, which is * used to access the item. */ inline const TYPE* Array() const { return vec_.data(); } /** - * @brief Return a non-const pointer to the first item of a vector that is + * @brief Return a non-const pointer to the first item of a vector that is * used to access the item of the vector. * * @note When use it , you should make sure it is sorted. @@ -159,8 +159,8 @@ public: * @brief Return the item value of a vector. * * @param index `index` value. - * @return If `index` is less than 0, the value of - * vector[vector.size() + `index`] is returned, otherwise the value of + * @return If `index` is less than 0, the value of + * vector[vector.size() + `index`] is returned, otherwise the value of * vector[`index`] is returned. */ const TYPE& MirrorItemAt(ssize_t index) const @@ -175,7 +175,7 @@ public: /** * @brief Add a new 'item' in the correct place. * - * @return Return the position of the new item on success, otherwise it + * @return Return the position of the new item on success, otherwise it * returns `ADD_FAIL`(-1) */ ssize_t Add(const TYPE& item); @@ -203,11 +203,11 @@ public: size_t Merge(const SortedVector& sortedVector); /** - * @brief If `index` is less than the vector's size, delete the item at + * @brief If `index` is less than the vector's size, delete the item at * `index`. * * @param index `index` value. - * @return If `index` is greater than or equal to the size of the vector, + * @return If `index` is greater than or equal to the size of the vector, * the iterator of the last item is returned, otherwise the iterator of the * next item of the deleted item is returned. */ @@ -220,7 +220,7 @@ public: } /** - * @brief An iterator that returns a vector starting item of a non-const + * @brief An iterator that returns a vector starting item of a non-const * type. */ iterator Begin() @@ -237,7 +237,7 @@ public: } /** - * @brief Return an iterator for an item at the end of a vector of a + * @brief Return an iterator for an item at the end of a vector of a * non-const type. */ iterator End() @@ -246,7 +246,7 @@ public: } /** - * @brief Return an iterator for the item at the end of a vector of type + * @brief Return an iterator for the item at the end of a vector of type * const. */ const_iterator End() const diff --git a/base/include/unique_fd.h b/base/include/unique_fd.h index 2d7c7da..0bc90d9 100644 --- a/base/include/unique_fd.h +++ b/base/include/unique_fd.h @@ -125,7 +125,7 @@ public: * @brief Release the management of current fd, set it to -1. * * @return Return the original fd before release. - * @note Released fd need to be taken over by another UniqueFdAddDeletor + * @note Released fd need to be taken over by another UniqueFdAddDeletor * object, otherwise it must be closed manually. */ int Release() diff --git a/base/test/unittest/common/utils_refbase_test.cpp b/base/test/unittest/common/utils_refbase_test.cpp index 2d3b149..2f73db7 100644 --- a/base/test/unittest/common/utils_refbase_test.cpp +++ b/base/test/unittest/common/utils_refbase_test.cpp @@ -770,7 +770,6 @@ private: */ HWTEST_F(UtilsRefbaseTest, testWptrefbase001, TestSize.Level0) { - // test wptr::wptr(const wptr&) wptr testOrigWptrObject(new WptrTest()); EXPECT_EQ(testOrigWptrObject->GetWptrRefCount(), 1); -- Gitee