diff --git a/LICENSE b/LICENSE old mode 100755 new mode 100644 diff --git a/README.md b/README.md old mode 100755 new mode 100644 index 63948cec1aa1046ae6488e72f27da56f87651ffa..dbe03525c4a5b9dcfa30448025792a252f0234aa --- a/README.md +++ b/README.md @@ -29,9 +29,9 @@ utils/native Utils subsystem -utils +[utils](https://gitee.com/openharmony/utils/blob/master/README.md) -**utils\_native** +[utils\_native](https://gitee.com/openharmony/utils_native/blob/master/README.md) -[utils\_native\_lite](https://gitee.com/openharmony/utils_native_lite) +[utils\_native\_lite](https://gitee.com/openharmony/utils_native_lite/blob/master/README.md) diff --git a/README_zh.md b/README_zh.md old mode 100755 new mode 100644 index 979ba0292502329c60f0cd705d67c1eeebfdd8c6..dddd47ed95a2c4726d9d8ef377b8aa665d602a4b --- a/README_zh.md +++ b/README_zh.md @@ -9,11 +9,11 @@ C++公共基础类库提供了一些常用的C++开发工具类,包括: -- 文件、路径、字符串相关操作的能力增强接口; -- 读写锁、信号量、定时器、线程增强及线程池等接口; -- 安全数据容器、数据序列化等接口; -- 各子系统的错误码相关定义; -- C语言安全函数接口。 +- 文件、路径、字符串相关操作的能力增强接口 +- 读写锁、信号量、定时器、线程增强及线程池等接口 +- 安全数据容器、数据序列化等接口 +- 各子系统的错误码相关定义 +- C语言安全函数接口 ## 目录 @@ -29,9 +29,9 @@ utils/native 公共基础库子系统 -utils +[utils](https://gitee.com/openharmony/utils/blob/master/README_zh.md) -**utils\_native** +[utils\_native](https://gitee.com/openharmony/utils_native/blob/master/README_zh.md) -[utils\_native\_lite](https://gitee.com/openharmony/utils_native_lite) +[utils\_native\_lite](https://gitee.com/openharmony/utils_native_lite/blob/master/README_zh.md) diff --git a/base/include/ashmem.h b/base/include/ashmem.h old mode 100755 new mode 100644 index 82a57000d9bd431cb65892719227c3e15534d380..50f9b1ff3cd289eb62fad05e10a4fd8c4b4a7d97 --- a/base/include/ashmem.h +++ b/base/include/ashmem.h @@ -45,6 +45,7 @@ public: { return memoryFd_; }; + private: int memoryFd_; int32_t memorySize_; diff --git a/base/include/common_errors.h b/base/include/common_errors.h old mode 100755 new mode 100644 index cf0634d82977ab7ff6d571c62459bed62751e70e..2758bff1206c74ea32a6c4eb6d99c5526ef3e513 --- a/base/include/common_errors.h +++ b/base/include/common_errors.h @@ -40,4 +40,4 @@ enum { } // Utils } // OHOS -#endif \ No newline at end of file +#endif diff --git a/base/include/common_timer_errors.h b/base/include/common_timer_errors.h old mode 100755 new mode 100644 index 768ed9958989a47840f58df39bf2fc96762c98be..8b155920873233e70dc83d2a507cd0738666d90d --- a/base/include/common_timer_errors.h +++ b/base/include/common_timer_errors.h @@ -50,4 +50,4 @@ enum { } // Utils } // OHOS -#endif \ No newline at end of file +#endif diff --git a/base/include/datetime_ex.h b/base/include/datetime_ex.h old mode 100755 new mode 100644 index e37cc9aa461a62f87ddede8c3f98e32222cbd675..42baf6e6e7fdf68a4a0889c1aa1dd42b57cee4a6 --- a/base/include/datetime_ex.h +++ b/base/include/datetime_ex.h @@ -102,4 +102,4 @@ int64_t GetTickCount(); int64_t GetMicroTickCount(); } -#endif \ No newline at end of file +#endif diff --git a/base/include/directory_ex.h b/base/include/directory_ex.h old mode 100755 new mode 100644 index 3721cb6fa24c380afebda0e198e10f246427b844..ee7d46c5cf02ae62fcb8c06391b3a1ce310408d5 --- a/base/include/directory_ex.h +++ b/base/include/directory_ex.h @@ -111,4 +111,4 @@ bool ChangeModeDirectory(const std::string& path, const mode_t& mode); */ bool PathToRealPath(const std::string& path, std::string& realPath); } // OHOS -#endif \ No newline at end of file +#endif diff --git a/base/include/errors.h b/base/include/errors.h old mode 100755 new mode 100644 diff --git a/base/include/flat_obj.h b/base/include/flat_obj.h old mode 100755 new mode 100644 index a06d0ea2aa2eac3251f5e6c4b152c5bb1145373c..0c7dd7cee766f434c9404cead448ff6347b3a076 --- a/base/include/flat_obj.h +++ b/base/include/flat_obj.h @@ -1,20 +1,20 @@ -/* - * 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_FLAT_OBJ_H -#define UTILS_BASE_FLAT_OBJ_H +/* + * 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_FLAT_OBJ_H +#define UTILS_BASE_FLAT_OBJ_H #include #include @@ -40,4 +40,4 @@ struct parcel_flat_binder_object { binder_uintptr_t cookie; }; -#endif \ No newline at end of file +#endif diff --git a/base/include/nocopyable.h b/base/include/nocopyable.h index 626451aa57b74147de1f22c55a15d035bbccb187..6807232afdd95952db1729d597c1cacf638c07a9 100644 --- a/base/include/nocopyable.h +++ b/base/include/nocopyable.h @@ -33,8 +33,8 @@ namespace OHOS { class NoCopyable { protected: - NoCopyable() {}; - virtual ~NoCopyable() {}; + NoCopyable() {} + virtual ~NoCopyable() {} private: DISALLOW_COPY_AND_MOVE(NoCopyable); diff --git a/base/include/parcel.h b/base/include/parcel.h old mode 100755 new mode 100644 diff --git a/base/include/pubdef.h b/base/include/pubdef.h old mode 100755 new mode 100644 diff --git a/base/include/rwlock.h b/base/include/rwlock.h old mode 100755 new mode 100644 diff --git a/base/include/safe_block_queue.h b/base/include/safe_block_queue.h old mode 100755 new mode 100644 index f026169fc192c999a03c1dc54012db8c2f868ca0..0196c92e644c1914f7b8e65c0d925c629c37dbb3 --- a/base/include/safe_block_queue.h +++ b/base/include/safe_block_queue.h @@ -103,7 +103,7 @@ public: return queueT_.size() == maxSize_; } - virtual ~SafeBlockQueue() {}; + virtual ~SafeBlockQueue() {} protected: unsigned long maxSize_; @@ -121,7 +121,7 @@ public: unfinishedTaskCount_ = 0; } - virtual ~SafeBlockQueueTracking() {}; + virtual ~SafeBlockQueueTracking() {} virtual void Push(T const& elem) { diff --git a/base/include/safe_map.h b/base/include/safe_map.h old mode 100755 new mode 100644 diff --git a/base/include/safe_queue.h b/base/include/safe_queue.h old mode 100755 new mode 100644 diff --git a/base/include/securec.h b/base/include/securec.h old mode 100755 new mode 100644 diff --git a/base/include/securec_p.h b/base/include/securec_p.h old mode 100755 new mode 100644 diff --git a/base/include/securectype.h b/base/include/securectype.h old mode 100755 new mode 100644 index 564c9f4741dce0aebfb929c2529e0b0ccb4e01e9..976328bb902ea193bea6e6efb8db3b553725e7ea --- a/base/include/securectype.h +++ b/base/include/securectype.h @@ -81,14 +81,14 @@ /* SECUREC_PCLINT for tool do not recognize __attribute__ just for pclint */ #if SECUREC_SUPPORT_FORMAT_WARNING && !defined(SECUREC_PCLINT) -#define SECUREC_ATTRIBUTE(x,y) __attribute__((format(printf, (x), (y)))) +#define SECUREC_ATTRIBUTE(x, y) __attribute__((format(printf, (x), (y)))) #else -#define SECUREC_ATTRIBUTE(x,y) +#define SECUREC_ATTRIBUTE(x, y) #endif /* SECUREC_PCLINT for tool do not recognize __builtin_expect ,just for pclint */ #if defined(__GNUC__) && \ - ((__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3 /* above 3.4 */ ))) && \ + ((__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3 /* above 3.4 */))) && \ !defined(SECUREC_PCLINT) /* This is a built-in function that can be used without a declaration, if you encounter an undeclared compilation alarm, * you can add -DSECUREC_NEED_BUILTIN_EXPECT_DECLARE to compiler options @@ -181,14 +181,14 @@ long __builtin_expect(long exp, long c); #define SECUREC_STRNCPY_SM(dest, destMax, src, count) \ (((void *)dest != NULL && (void *)src != NULL && (size_t)destMax >0 && \ (((unsigned long long)(destMax) & (unsigned long long)(-2)) < SECUREC_STRING_MAX_LEN) && \ - (SECUREC_TWO_MIN(count , strlen(src)) + 1) <= (size_t)destMax ) ? \ + (SECUREC_TWO_MIN(count , strlen(src)) + 1) <= (size_t)destMax) ? \ ((count < strlen(src))? (memcpy(dest, src, count), *((char *)dest + count) = '\0', EOK): \ - (memcpy(dest, src, strlen(src) + 1), EOK ) ) :(strncpy_error(dest, destMax, src, count))) + (memcpy(dest, src, strlen(src) + 1), EOK )) :(strncpy_error(dest, destMax, src, count))) #define SECUREC_STRCPY_SM(dest, destMax, src) \ (((void *)dest != NULL && (void *)src != NULL && (size_t)destMax >0 && \ (((unsigned long long)(destMax) & (unsigned long long)(-2)) < SECUREC_STRING_MAX_LEN) && \ - (strlen(src) + 1) <= (size_t)destMax )? (memcpy(dest, src, strlen(src) + 1), EOK): \ + (strlen(src) + 1) <= (size_t)destMax)? (memcpy(dest, src, strlen(src) + 1), EOK): \ (strcpy_error(dest, destMax, src))) /* for strcat_s performance optimization */ diff --git a/base/include/semaphore_ex.h b/base/include/semaphore_ex.h old mode 100755 new mode 100644 diff --git a/base/include/singleton.h b/base/include/singleton.h old mode 100755 new mode 100644 diff --git a/base/include/sorted_vector.h b/base/include/sorted_vector.h old mode 100755 new mode 100644 index 2877445bd0ffb5a18bab33fe199e7fd8278596af..01e90a9e98496cbf32d45fa81a313e8828758574 --- a/base/include/sorted_vector.h +++ b/base/include/sorted_vector.h @@ -43,7 +43,7 @@ public: SortedVector(const std::vector& orivect); - virtual ~SortedVector() {}; + virtual ~SortedVector() {} // copy operator SortedVector& operator=(const SortedVector& rhs); SortedVector& operator=(const SortedVector& rhs); @@ -65,8 +65,8 @@ public: // Cstyle access // when use it , you should make sure it sorted~! - inline const TYPE* Array() const { return vec_.data(); }; - TYPE* EditArray() { return vec_.data(); }; + inline const TYPE* Array() const { return vec_.data(); } + TYPE* EditArray() { return vec_.data(); } ssize_t IndexOf(const TYPE& item) const; size_t OrderOf(const TYPE& item) const; diff --git a/base/include/string_ex.h b/base/include/string_ex.h old mode 100755 new mode 100644 diff --git a/base/include/thread_ex.h b/base/include/thread_ex.h old mode 100755 new mode 100644 index 7bc0e8a6392746d4228df2edc019fb9be4a9f12f..5ee6aad358a4a6e5191026230102b87378782dae --- a/base/include/thread_ex.h +++ b/base/include/thread_ex.h @@ -54,6 +54,7 @@ public: bool IsRunning() const; pthread_t GetThread() const { return thread_; } + protected: virtual bool Run() = 0; // Derived class must implement Run() diff --git a/base/include/thread_pool.h b/base/include/thread_pool.h old mode 100755 new mode 100644 diff --git a/base/include/timer.h b/base/include/timer.h old mode 100755 new mode 100644 diff --git a/base/include/unique_fd.h b/base/include/unique_fd.h old mode 100755 new mode 100644 diff --git a/base/src/ashmem.cpp b/base/src/ashmem.cpp old mode 100755 new mode 100644 diff --git a/base/src/datetime_ex.cpp b/base/src/datetime_ex.cpp old mode 100755 new mode 100644 diff --git a/base/src/directory_ex.cpp b/base/src/directory_ex.cpp old mode 100755 new mode 100644 diff --git a/base/src/event_demultiplexer.cpp b/base/src/event_demultiplexer.cpp old mode 100755 new mode 100644 diff --git a/base/src/event_handler.cpp b/base/src/event_handler.cpp old mode 100755 new mode 100644 index a886fa1c28ad89365639fc6c69a520077d5e0222..f318cd0477aad27e1e8ceec45fbe75329382d221 --- a/base/src/event_handler.cpp +++ b/base/src/event_handler.cpp @@ -83,4 +83,4 @@ void EventHandler::Update() } } // Utils -} // OHOS \ No newline at end of file +} // OHOS diff --git a/base/src/event_handler.h b/base/src/event_handler.h old mode 100755 new mode 100644 index c2434779b8abcbef921f70899ee4b3841c9087a0..5a17082454b27aaeb709b3a9877736b55a70000f --- a/base/src/event_handler.h +++ b/base/src/event_handler.h @@ -34,7 +34,7 @@ public: EventHandler(const EventHandler&) = delete; EventHandler& operator=(const EventHandler&&) = delete; EventHandler(const EventHandler&&) = delete; - ~EventHandler() {}; + ~EventHandler() {} int GetHandle() const { return (fd_); } uint32_t Events() const { return (events_); } diff --git a/base/src/event_reactor.cpp b/base/src/event_reactor.cpp old mode 100755 new mode 100644 index 33e2d2fdb8f7a620dd65e36a1c4617357956d411..cfb6f533361a7537e42fef2c1bed8a074f7697d7 --- a/base/src/event_reactor.cpp +++ b/base/src/event_reactor.cpp @@ -127,4 +127,4 @@ void EventReactor::CancelTimer(int timerFd) } } // namespace Utils -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/base/src/event_reactor.h b/base/src/event_reactor.h old mode 100755 new mode 100644 diff --git a/base/src/file_ex.cpp b/base/src/file_ex.cpp old mode 100755 new mode 100644 diff --git a/base/src/observer.cpp b/base/src/observer.cpp old mode 100755 new mode 100644 diff --git a/base/src/parcel.cpp b/base/src/parcel.cpp old mode 100755 new mode 100644 diff --git a/base/src/refbase.cpp b/base/src/refbase.cpp index 1b2968ee190f15c56e8416d409fdcede2d830109..0a164e403eb9802e28d9d884927aa48d65866fa4 100644 --- a/base/src/refbase.cpp +++ b/base/src/refbase.cpp @@ -269,7 +269,7 @@ RefBase::RefBase() : refs_(new RefCounter()) RefBase::RefBase(const RefBase &) { - refs_ = new RefCounter(); + refs_ = new (std::nothrow) RefCounter(); if (refs_ != nullptr) { refs_->IncRefCount(); refs_->SetCallback(std::bind(&RefBase::RefPtrCallback, this)); @@ -294,7 +294,7 @@ RefBase &RefBase::operator=(const RefBase &) refs_->DecRefCount(); } - refs_ = new RefCounter(); + refs_ = new (std::nothrow) RefCounter(); if (refs_ != nullptr) { refs_->IncRefCount(); refs_->SetCallback(std::bind(&RefBase::RefPtrCallback, this)); diff --git a/base/src/rwlock.cpp b/base/src/rwlock.cpp old mode 100755 new mode 100644 index 4b176dcd90c4429be79e9a0a8817ecaef35153bf..74b21fe255c94f15eccc803ecb9e04716ff39412 --- a/base/src/rwlock.cpp +++ b/base/src/rwlock.cpp @@ -88,4 +88,4 @@ void RWLock::UnLockWrite() } } // namespace Utils -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/base/src/securec/fscanf_s.c b/base/src/securec/fscanf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/fwscanf_s.c b/base/src/securec/fwscanf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/gets_s.c b/base/src/securec/gets_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/memcpy_s.c b/base/src/securec/memcpy_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/memmove_s.c b/base/src/securec/memmove_s.c old mode 100755 new mode 100644 index ac2c85998d75711c5843ba9129d8a247380491d3..0dc5fd5a95abde2236f2224a5de4e19c8607f7ed --- a/base/src/securec/memmove_s.c +++ b/base/src/securec/memmove_s.c @@ -59,21 +59,21 @@ static void SecUtilMemmove(void *dst, const void *src, size_t count) * Copies count bytes of characters from src to dest. * * - * dest Destination object. + * dest Destination object. * destMax Size of the destination buffer. - * src Source object. - * count Number of characters to copy. + * src Source object. + * count Number of characters to copy. * * * dest buffer is updated. * * - * EOK Success + * EOK Success * EINVAL dest is NULL and destMax != 0 and destMax <= SECUREC_MEM_MAX_LEN - * EINVAL_AND_RESET dest != NULL and src is NULL and destMax != 0 and destMax <= SECUREC_MEM_MAX_LEN - * ERANGE destMax > SECUREC_MEM_MAX_LEN or destMax is 0 - * ERANGE_AND_RESET count > destMax and dest != NULL and src != NULL and destMax != 0 - * and destMax <= SECUREC_MEM_MAX_LEN + * EINVAL_AND_RESET dest != NULL and src is NULL and destMax != 0 and destMax <= SECUREC_MEM_MAX_LEN + * ERANGE destMax > SECUREC_MEM_MAX_LEN or destMax is 0 + * ERANGE_AND_RESET count > destMax and dest != NULL and src != NULL and destMax != 0 + * and destMax <= SECUREC_MEM_MAX_LEN * * If an error occurred, dest will be filled with 0 when dest and destMax valid. * If some regions of the source area and the destination overlap, memmove_s diff --git a/base/src/securec/memset_s.c b/base/src/securec/memset_s.c old mode 100755 new mode 100644 index f915589482a3cfce6ea72d534018090a66bdc443..269cb1b65bd2895f9ad82f3979a883d926541e30 --- a/base/src/securec/memset_s.c +++ b/base/src/securec/memset_s.c @@ -61,14 +61,14 @@ typedef union { SecStrBuf1 buf1; } SecStrBuf32Union; /* C standard initializes the first member of the consortium. */ -static const SecStrBuf32 g_allZero = {{'\0','\0','\0','\0','\0','\0','\0','\0', - '\0','\0','\0','\0','\0','\0','\0','\0', - '\0','\0','\0','\0','\0','\0','\0','\0', - '\0','\0','\0','\0','\0','\0','\0','\0'}}; -static const SecStrBuf32 g_allFF = {{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}}; +static const SecStrBuf32 g_allZero = {{'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'}}; +static const SecStrBuf32 g_allFF = {{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}}; static const SecStrBuf32Union *SecStrictAliasingCast(const SecStrBuf32 *buf) { diff --git a/base/src/securec/scanf_s.c b/base/src/securec/scanf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/secinput.h b/base/src/securec/secinput.h old mode 100755 new mode 100644 index b08281ae9e60af8c3838bd0fed6053c97da99be9..62111424112e7938a3e7436e163d4bad2b3ebf7e --- a/base/src/securec/secinput.h +++ b/base/src/securec/secinput.h @@ -97,8 +97,8 @@ extern "C" { /* Reserved file operation macro interface */ #define SECUREC_LOCK_FILE(s) #define SECUREC_UNLOCK_FILE(s) -#define SECUREC_LOCK_STDIN(i,s) -#define SECUREC_UNLOCK_STDIN(i,s) +#define SECUREC_LOCK_STDIN(i, s) +#define SECUREC_UNLOCK_STDIN(i, s) #endif diff --git a/base/src/securec/securecutil.c b/base/src/securec/securecutil.c old mode 100755 new mode 100644 index c40467af5b55e2f3cc6ae95938549bbc3ac12c6b..71ac5ba2ea99207e59142ae5d10f199ad37caa83 --- a/base/src/securec/securecutil.c +++ b/base/src/securec/securecutil.c @@ -22,7 +22,7 @@ #if SECUREC_IN_KERNEL == 0 /* put a char to output */ -#define SECUREC_PUTC(_c,_stream) ((--(_stream)->count >= 0) ? ((*(_stream)->cur++ = (char)(_c)) & 0xff) : EOF) +#define SECUREC_PUTC(_c, _stream) ((--(_stream)->count >= 0) ? ((*(_stream)->cur++ = (char)(_c)) & 0xff) : EOF) /* to clear e835 */ #define SECUREC_PUTC_ZERO(_stream) ((--(_stream)->count >= 0) ? ((*(_stream)->cur++ = (char)('\0'))) : EOF) diff --git a/base/src/securec/securecutil.h b/base/src/securec/securecutil.h old mode 100755 new mode 100644 index 0243971e1bdb4eb2fdd62fad84761b8c9ab87df2..c012bc77f981dbc00ff90824658914e155158d9e --- a/base/src/securec/securecutil.h +++ b/base/src/securec/securecutil.h @@ -281,13 +281,13 @@ typedef struct { #elif defined(SECUREC_ERROR_HANDLER_BY_PRINTF) #if SECUREC_IN_KERNEL -#define SECUREC_ERROR_INVALID_PARAMTER(msg) printk( "%s invalid argument\n",msg) +#define SECUREC_ERROR_INVALID_PARAMTER(msg) printk( "%s invalid argument\n", msg) #define SECUREC_ERROR_INVALID_RANGE(msg) printk( "%s invalid dest buffer size\n", msg) -#define SECUREC_ERROR_BUFFER_OVERLAP(msg) printk( "%s buffer overlap\n",msg) +#define SECUREC_ERROR_BUFFER_OVERLAP(msg) printk( "%s buffer overlap\n", msg) #else -#define SECUREC_ERROR_INVALID_PARAMTER(msg) printf( "%s invalid argument\n",msg) +#define SECUREC_ERROR_INVALID_PARAMTER(msg) printf( "%s invalid argument\n", msg) #define SECUREC_ERROR_INVALID_RANGE(msg) printf( "%s invalid dest buffer size\n", msg) -#define SECUREC_ERROR_BUFFER_OVERLAP(msg) printf( "%s buffer overlap\n",msg) +#define SECUREC_ERROR_BUFFER_OVERLAP(msg) printf( "%s buffer overlap\n", msg) #endif #elif defined(SECUREC_ERROR_HANDLER_BY_FILE_LOG) diff --git a/base/src/securec/secureinput_a.c b/base/src/securec/secureinput_a.c old mode 100755 new mode 100644 diff --git a/base/src/securec/secureinput_w.c b/base/src/securec/secureinput_w.c old mode 100755 new mode 100644 diff --git a/base/src/securec/secureprintoutput.h b/base/src/securec/secureprintoutput.h old mode 100755 new mode 100644 diff --git a/base/src/securec/secureprintoutput_a.c b/base/src/securec/secureprintoutput_a.c old mode 100755 new mode 100644 diff --git a/base/src/securec/secureprintoutput_w.c b/base/src/securec/secureprintoutput_w.c old mode 100755 new mode 100644 diff --git a/base/src/securec/snprintf_s.c b/base/src/securec/snprintf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/sprintf_s.c b/base/src/securec/sprintf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/sscanf_s.c b/base/src/securec/sscanf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/strcat_s.c b/base/src/securec/strcat_s.c old mode 100755 new mode 100644 index d4a9443c60134b9c1e861d803fef8f50b4b59b2e..2dc7a9eb1ddcfb7f9c86637a17d0ac97c7278d33 --- a/base/src/securec/strcat_s.c +++ b/base/src/securec/strcat_s.c @@ -18,7 +18,7 @@ #if SECUREC_HAVE_STRNLEN #define SECUREC_STRCAT_LEN_THRESHOLD 8 -#define SECUREC_CALC_STR_LEN(str,maxLen,len) do { \ +#define SECUREC_CALC_STR_LEN(str,maxLen, len) do { \ if (*((str) + 0) == '\0') { \ len = 0; \ } else if (*((str) + 1) == '\0') { \ diff --git a/base/src/securec/strcpy_s.c b/base/src/securec/strcpy_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/strncat_s.c b/base/src/securec/strncat_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/strncpy_s.c b/base/src/securec/strncpy_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/strtok_s.c b/base/src/securec/strtok_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/swprintf_s.c b/base/src/securec/swprintf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/swscanf_s.c b/base/src/securec/swscanf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/vfscanf_s.c b/base/src/securec/vfscanf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/vfwscanf_s.c b/base/src/securec/vfwscanf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/vscanf_s.c b/base/src/securec/vscanf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/vsnprintf_s.c b/base/src/securec/vsnprintf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/vsnprintf_s_p.c b/base/src/securec/vsnprintf_s_p.c old mode 100755 new mode 100644 index f941a59c53bb12b707c73201d810b63fc084a807..6e48ed00ac08d86b154db97b22687a1606cd195b --- a/base/src/securec/vsnprintf_s_p.c +++ b/base/src/securec/vsnprintf_s_p.c @@ -1,22 +1,22 @@ -/* - * 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. - */ - -#include "secureprintoutput.h" - -static inline int SecVsnprintfPImpl(char *string, size_t count, int priv, const char *format, va_list arglist); - +/* + * 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. + */ + +#include "secureprintoutput.h" + +static inline int SecVsnprintfPImpl(char *string, size_t count, int priv, const char *format, va_list arglist); + /******************************************************************************* * * The vsnprintf_s function is equivalent to the vsnprintf function @@ -29,8 +29,8 @@ static inline int SecVsnprintfPImpl(char *string, size_t count, int priv, const * strDest Storage location for the output. * destMax The size of the strDest for output. * count Maximum number of character to write(not including - * the terminating NULL) - * priv_on whether print for not-public args + * the terminating NULL) + * priv_on whether print for not-public args * format Format-control string. * arglist pointer to list of arguments. * @@ -45,7 +45,7 @@ static inline int SecVsnprintfPImpl(char *string, size_t count, int priv, const * If there is a runtime-constraint violation, strDest[0] will be set to the '\0' when strDest and destMax valid ******************************************************************************* */ -int vsnprintfp_s(char *strDest, size_t destMax, size_t count, int priv, const char *format, va_list arglist) +int vsnprintfp_s(char *strDest, size_t destMax, size_t count, int priv, const char *format, va_list arglist) { int retVal; @@ -54,18 +54,18 @@ int vsnprintfp_s(char *strDest, size_t destMax, size_t count, int priv, const c if (strDest != NULL && destMax > 0) { strDest[0] = '\0'; } - SECUREC_ERROR_INVALID_PARAMTER("vsnprintfp_s"); + SECUREC_ERROR_INVALID_PARAMTER("vsnprintfp_s"); return -1; } if (destMax > count) { - retVal = SecVsnprintfPImpl(strDest, count + 1, priv, format, arglist); + retVal = SecVsnprintfPImpl(strDest, count + 1, priv, format, arglist); if (retVal == SECUREC_PRINTF_TRUNCATE) { /* lsd add to keep dest buffer not destroyed 2014.2.18 */ /* the string has been truncated, return -1 */ return -1; /* to skip error handler, return strlen(strDest) or -1 */ } } else { /* destMax <= count */ - retVal = SecVsnprintfPImpl(strDest, destMax, priv, format, arglist); + retVal = SecVsnprintfPImpl(strDest, destMax, priv, format, arglist); #ifdef SECUREC_COMPATIBLE_WIN_FORMAT if (retVal == SECUREC_PRINTF_TRUNCATE && count == (size_t)-1) { return -1; @@ -78,16 +78,16 @@ int vsnprintfp_s(char *strDest, size_t destMax, size_t count, int priv, const c if (retVal == SECUREC_PRINTF_TRUNCATE) { /* Buffer too small */ - SECUREC_ERROR_INVALID_RANGE("vsnprintfp_s"); + SECUREC_ERROR_INVALID_RANGE("vsnprintfp_s"); } - SECUREC_ERROR_INVALID_PARAMTER("vsnprintfp_s"); + SECUREC_ERROR_INVALID_PARAMTER("vsnprintfp_s"); return -1; } return retVal; -} - +} + #ifdef SECUREC_FOR_WCHAR #undef SECUREC_FOR_WCHAR #endif @@ -96,15 +96,15 @@ typedef char SecChar; #define SECUREC_CHAR(x) x #define SECUREC_WRITE_MULTI_CHAR SecWriteMultiChar -#define SECUREC_WRITE_STRING SecWriteString -#include "output_p.inl" - +#define SECUREC_WRITE_STRING SecWriteString +#include "output_p.inl" + /* put a char to output */ -#define SECUREC_PUTC(_c,_stream) ((--(_stream)->count >= 0) ? ((*(_stream)->cur++ = (char)(_c)) & 0xff) : EOF) +#define SECUREC_PUTC(_c, _stream) ((--(_stream)->count >= 0) ? ((*(_stream)->cur++ = (char)(_c)) & 0xff) : EOF) /* to clear e835 */ #define SECUREC_PUTC_ZERO(_stream) ((--(_stream)->count >= 0) ? ((*(_stream)->cur++ = (char)('\0'))) : EOF) - -static inline int SecVsnprintfPImpl(char *string, size_t count, int priv, const char *format, va_list arglist) + +static inline int SecVsnprintfPImpl(char *string, size_t count, int priv, const char *format, va_list arglist) { SecPrintfStream str; int retVal; @@ -112,7 +112,7 @@ static inline int SecVsnprintfPImpl(char *string, size_t count, int priv, const str.count = (int)count; /* this count include \0 character */ str.cur = string; - retVal = SecOutputPS(&str, priv, format, arglist); + retVal = SecOutputPS(&str, priv, format, arglist); if ((retVal >= 0) && (SECUREC_PUTC_ZERO(&str) != EOF)) { return (retVal); } else if (str.count < 0) { @@ -122,4 +122,4 @@ static inline int SecVsnprintfPImpl(char *string, size_t count, int priv, const } return -1; -} +} diff --git a/base/src/securec/vsprintf_s.c b/base/src/securec/vsprintf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/vsscanf_s.c b/base/src/securec/vsscanf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/vswprintf_s.c b/base/src/securec/vswprintf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/vswscanf_s.c b/base/src/securec/vswscanf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/vwscanf_s.c b/base/src/securec/vwscanf_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/wcscat_s.c b/base/src/securec/wcscat_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/wcscpy_s.c b/base/src/securec/wcscpy_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/wcsncat_s.c b/base/src/securec/wcsncat_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/wcsncpy_s.c b/base/src/securec/wcsncpy_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/wcstok_s.c b/base/src/securec/wcstok_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/wmemcpy_s.c b/base/src/securec/wmemcpy_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/wmemmove_s.c b/base/src/securec/wmemmove_s.c old mode 100755 new mode 100644 diff --git a/base/src/securec/wscanf_s.c b/base/src/securec/wscanf_s.c old mode 100755 new mode 100644 diff --git a/base/src/semaphore_ex.cpp b/base/src/semaphore_ex.cpp old mode 100755 new mode 100644 index cc587b000f7a03bc208bae29aa96399829e77643..205bf09cc36159ab6f7419a0496120a5811b3fbd --- a/base/src/semaphore_ex.cpp +++ b/base/src/semaphore_ex.cpp @@ -158,4 +158,4 @@ void Semaphore::Post() } } -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/base/src/string_ex.cpp b/base/src/string_ex.cpp old mode 100755 new mode 100644 diff --git a/base/src/thread_ex.cpp b/base/src/thread_ex.cpp old mode 100755 new mode 100644 index f055e76b01ee9a91795e1c8cf1c28eb82ac787fc..3ba97b25b7ce16d5e4f7be5d27f52d56bc670103 --- a/base/src/thread_ex.cpp +++ b/base/src/thread_ex.cpp @@ -42,6 +42,7 @@ struct ThreadParam { std::string threadName = t->name; delete t; + t = nullptr; // set thread priority (void)setpriority(PRIO_PROCESS, 0, prio); @@ -221,4 +222,4 @@ int Thread::ThreadStart(void* args) return 0; } -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/base/src/thread_pool.cpp b/base/src/thread_pool.cpp old mode 100755 new mode 100644 index fd3da316b2bb44c003e30d2ed0966b7531d08081..0eea4118dd3c70eb586562976f1193b26fbb6439 --- a/base/src/thread_pool.cpp +++ b/base/src/thread_pool.cpp @@ -45,7 +45,7 @@ uint32_t ThreadPool::Start(int numThreads) threads_.reserve(numThreads); for (int i = 0; i < numThreads; ++i) { - threads_.push_back(std::thread(&ThreadPool::WorkInThread,this)); + threads_.push_back(std::thread(&ThreadPool::WorkInThread, this)); } return ERR_OK; } diff --git a/base/src/timer.cpp b/base/src/timer.cpp old mode 100755 new mode 100644 index 988f98c369a1d9b95087bb42356dbbb4cfbbc155..8302ace2fe6e7b4e5f0021cac4e9ede4a4498fd4 --- a/base/src/timer.cpp +++ b/base/src/timer.cpp @@ -242,4 +242,4 @@ void Timer::EraseUnusedTimerId(uint32_t interval, const std::vector& u } } // namespace Utils -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/base/src/timer_event_handler.cpp b/base/src/timer_event_handler.cpp old mode 100755 new mode 100644 index 644f10abdf7abcd4eefb96ddd7db2c297b64b336..c710cdfabe82f3b0dbc1202bc458736e0274b9c1 --- a/base/src/timer_event_handler.cpp +++ b/base/src/timer_event_handler.cpp @@ -112,4 +112,4 @@ void TimerEventHandler::TimeOut() } } // namespace Utils -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/base/src/timer_event_handler.h b/base/src/timer_event_handler.h old mode 100755 new mode 100644 index ace2c8e70a7729242b4b76e6e14478c0460146bf..3201480b565c24485bf547ee8318f73ee90e9618 --- a/base/src/timer_event_handler.h +++ b/base/src/timer_event_handler.h @@ -28,6 +28,7 @@ class EventReactor; class TimerEventHandler { using TimerCallback = std::function; + public: TimerEventHandler(EventReactor* p, uint32_t timeout, bool once); ~TimerEventHandler(); diff --git a/base/src/unicode_ex.cpp b/base/src/unicode_ex.cpp old mode 100755 new mode 100644 diff --git a/base/test/unittest/common/utils_ashmem_test.cpp b/base/test/unittest/common/utils_ashmem_test.cpp old mode 100755 new mode 100644 diff --git a/base/test/unittest/common/utils_datetime_test.cpp b/base/test/unittest/common/utils_datetime_test.cpp old mode 100755 new mode 100644 diff --git a/base/test/unittest/common/utils_directory_test.cpp b/base/test/unittest/common/utils_directory_test.cpp old mode 100755 new mode 100644 diff --git a/base/test/unittest/common/utils_file_test.cpp b/base/test/unittest/common/utils_file_test.cpp old mode 100755 new mode 100644 index 60e1f98e05246ba0c7c28706c1fbd962ffd95620..e897cfdf6413bdcac35496049d25cd968d941377 --- a/base/test/unittest/common/utils_file_test.cpp +++ b/base/test/unittest/common/utils_file_test.cpp @@ -53,11 +53,11 @@ void UtilsFileTest::TearDown(void) bool CreateTestFile(const std::string& path, const std::string& content) { - ofstream out(path, ios_base::out | ios_base::trunc); - if (out.is_open()) { + ofstream out(path, ios_base::out | ios_base::trunc); + if (out.is_open()) { out << content; return true; - } + } std::cout << "open file failed!" << path << std::endl; return false; @@ -757,7 +757,7 @@ HWTEST_F(UtilsFileTest, testCountStrInFile003, TestSize.Level0) string content(32*1024*1024, 't'); CreateTestFile(filename, content); EXPECT_EQ(CountStrInFile(filename, str1, true), 0); - EXPECT_EQ(CountStrInFile(filename, str2, true),1); + EXPECT_EQ(CountStrInFile(filename, str2, true), 1); RemoveTestFile(filename); } @@ -796,4 +796,4 @@ HWTEST_F(UtilsFileTest, testCountStrInFile005, TestSize.Level0) EXPECT_EQ(CountStrInFile(filename, str1, true), 2); EXPECT_EQ(CountStrInFile(filename, str1, false), 3); RemoveTestFile(filename); -} \ No newline at end of file +} diff --git a/base/test/unittest/common/utils_observer_test.cpp b/base/test/unittest/common/utils_observer_test.cpp index f3c04bb7a6bc878fa582a7d66485fba16bef7924..b446b7331e42e2b1af572bb8d03aad472e81259c 100644 --- a/base/test/unittest/common/utils_observer_test.cpp +++ b/base/test/unittest/common/utils_observer_test.cpp @@ -25,8 +25,8 @@ using namespace std; class BookList: public Observable { public: BookList() { books_.clear(); } - void AddBook(const string& book) - { + void AddBook(const string& book) + { books_.insert(book); SetChanged(); NotifyObservers(); @@ -34,11 +34,11 @@ public: void RemoveBook(const string& book) { - books_.erase(book); + books_.erase(book); SetChanged(); NotifyObservers(); } - + const set& GetBooks() { return books_; } private: set books_; @@ -91,7 +91,7 @@ HWTEST_F(UtilsObserverTest, test_ObserverNotify, TestSize.Level0) shared_ptr bookObserver1 = make_shared(); shared_ptr bookObserver2 = make_shared(); shared_ptr bookObserver3 = make_shared(); - + bookList.AddObserver(bookObserver1); bookList.AddObserver(bookObserver2); bookList.AddObserver(bookObserver3); @@ -113,7 +113,7 @@ HWTEST_F(UtilsObserverTest, test_ObserverNotify, TestSize.Level0) EXPECT_EQ(bookObserver1->GetBooksCount(), 1); EXPECT_EQ(bookObserver2->GetBooksCount(), 0); EXPECT_EQ(bookObserver3->GetBooksCount(), 2); - + } @@ -123,7 +123,7 @@ HWTEST_F(UtilsObserverTest, test_RemoveAllObserver, TestSize.Level0) shared_ptr bookObserver1 = make_shared(); shared_ptr bookObserver2 = make_shared(); shared_ptr bookObserver3 = make_shared(); - + bookList.AddObserver(bookObserver1); bookList.AddObserver(bookObserver2); bookList.AddObserver(bookObserver3); diff --git a/base/test/unittest/common/utils_parcel_test.cpp b/base/test/unittest/common/utils_parcel_test.cpp old mode 100755 new mode 100644 diff --git a/base/test/unittest/common/utils_refbase_test.cpp b/base/test/unittest/common/utils_refbase_test.cpp old mode 100755 new mode 100644 index ebd7f64449db7054d6b4a06c6700cbfab39d4e4e..6919203cc248aee450094446dc34784e718035b0 --- a/base/test/unittest/common/utils_refbase_test.cpp +++ b/base/test/unittest/common/utils_refbase_test.cpp @@ -80,9 +80,9 @@ private: class IRemoteObject : public virtual RefBase { public: - IRemoteObject() { ExtendObjectLifetime(); }; + IRemoteObject() { ExtendObjectLifetime(); } virtual bool IsProxyObject() = 0; - ~IRemoteObject() {}; + ~IRemoteObject() {} }; class RefBaseTestTracker : public RefBase { @@ -205,7 +205,7 @@ public: tracker->TrackObject(this); tracker->TrackNewObject(this); }; - ~IPCObjectProxy() {}; + ~IPCObjectProxy() {} void RefPtrCallback() override; void OnLastStrongRef(const void *objectId) override; void OnFirstStrongRef(const void *objectId) override; @@ -398,6 +398,7 @@ public: public: static inline int g_checkCount = 0; + private: int value_; }; diff --git a/base/test/unittest/common/utils_safe_block_queue_test.cpp b/base/test/unittest/common/utils_safe_block_queue_test.cpp old mode 100755 new mode 100644 diff --git a/base/test/unittest/common/utils_safe_block_queue_tracking.cpp b/base/test/unittest/common/utils_safe_block_queue_tracking.cpp old mode 100755 new mode 100644 index a6713e12912fab4f76f527552436b3213f8ef81a..d4422d665d485a5973f61b7ba5a0da07fb6d4e83 --- a/base/test/unittest/common/utils_safe_block_queue_tracking.cpp +++ b/base/test/unittest/common/utils_safe_block_queue_tracking.cpp @@ -22,7 +22,7 @@ #include #include // std::chrono::seconds -#include // std::thread, std::this_thread::sleep_for + using namespace testing::ext; using namespace OHOS; diff --git a/base/test/unittest/common/utils_safe_map_test.cpp b/base/test/unittest/common/utils_safe_map_test.cpp old mode 100755 new mode 100644 index 295f1c159e8750238a036d73185e29cb7de300c9..55c0882a27aa1eb2ab52372658b4f432ccf31089 --- a/base/test/unittest/common/utils_safe_map_test.cpp +++ b/base/test/unittest/common/utils_safe_map_test.cpp @@ -19,12 +19,7 @@ #include #include #include - -#include - #include // std::chrono::seconds -#include // std::cout -#include // std::thread, std::this_thread::sleep_for using namespace testing::ext; using namespace OHOS; @@ -377,4 +372,4 @@ HWTEST_F(UtilsSafeMap, testUtilsConcurrentWriteAndFindAndSet001, TestSize.Level0 ASSERT_EQ(i + 1, result[i]); } }); -} \ No newline at end of file +} diff --git a/base/test/unittest/common/utils_safe_queue_test.cpp b/base/test/unittest/common/utils_safe_queue_test.cpp index 3786a7b41976c67678b003c712bf08c8b9e8da03..5fcbd3132dce6e2039e705a5a08299770d516519 100644 --- a/base/test/unittest/common/utils_safe_queue_test.cpp +++ b/base/test/unittest/common/utils_safe_queue_test.cpp @@ -19,12 +19,7 @@ #include #include #include - -#include - #include // std::chrono::seconds -#include // std::cout -#include // std::thread, std::this_thread::sleep_for using namespace testing::ext; using namespace OHOS; diff --git a/base/test/unittest/common/utils_securec_test.cpp b/base/test/unittest/common/utils_securec_test.cpp index 406292b198edbfa196329a09ca621391fba64dc0..c4afcedc9e84fc59c49d17021899074f08459a07 100644 --- a/base/test/unittest/common/utils_securec_test.cpp +++ b/base/test/unittest/common/utils_securec_test.cpp @@ -138,4 +138,4 @@ HWTEST_F(UtilsSecurecTest, test_sprintf_s_01, TestSize.Level0) errno_t result = sprintf_s(cBase, sizeof(cBase), "%d", 12345); EXPECT_EQ(string(cBase), "12345"); EXPECT_NE(result, 0); -} \ No newline at end of file +} diff --git a/base/test/unittest/common/utils_singleton_test.cpp b/base/test/unittest/common/utils_singleton_test.cpp index ded12b66803c8b0a3968a808592ff1c69c774aab..0a0e22bdf0b33ab0c369af1e947d7035775bb755 100644 --- a/base/test/unittest/common/utils_singleton_test.cpp +++ b/base/test/unittest/common/utils_singleton_test.cpp @@ -36,7 +36,7 @@ class SingletonDeclearTest { public: void* GetObjAddr() { return (void*)this; } }; - + SingletonDeclearTest::~SingletonDeclearTest() {}; SingletonDeclearTest::SingletonDeclearTest() {}; diff --git a/base/test/unittest/common/utils_sorted_vector_test.cpp b/base/test/unittest/common/utils_sorted_vector_test.cpp old mode 100755 new mode 100644 diff --git a/base/test/unittest/common/utils_string_test.cpp b/base/test/unittest/common/utils_string_test.cpp old mode 100755 new mode 100644 diff --git a/base/test/unittest/common/utils_thread_pool_test.cpp b/base/test/unittest/common/utils_thread_pool_test.cpp old mode 100755 new mode 100644 index 6a0cd20497b897b499c6e9b37f2e7bc106372e5a..b8e62a8d640f769562c1df77cd0834964cbe6316 --- a/base/test/unittest/common/utils_thread_pool_test.cpp +++ b/base/test/unittest/common/utils_thread_pool_test.cpp @@ -134,7 +134,7 @@ HWTEST_F(UtilsThreadPoolTest, test_05, TestSize.Level0) sleep(1); EXPECT_EQ((int)pool.GetCurTaskNum(), 0); - // add 5 task, add 3 times and sub 2 times + // add 5 tasks, add 3 times and sub 2 times EXPECT_EQ(g_times, 1); pool.Stop(); } diff --git a/base/test/unittest/common/utils_thread_test.cpp b/base/test/unittest/common/utils_thread_test.cpp old mode 100755 new mode 100644 index 1cc7fca76cd60e3a55fefdef28a0bce38203b86a..8163ca66e7200e5bffe1cfd01aa9d4aa974fc7b4 --- a/base/test/unittest/common/utils_thread_test.cpp +++ b/base/test/unittest/common/utils_thread_test.cpp @@ -64,7 +64,7 @@ int GetThreadPriority(const pthread_t& thread) int ret; // scheduling parameters of target thread - ret = pthread_getschedparam (thread, &policy, ¶m); + ret = pthread_getschedparam(thread, &policy, ¶m); if (ret != 0) { printf("pthread_getschedparam failed! thread:%lu, ret:%d\n", thread, ret); return -1; @@ -109,7 +109,7 @@ public: {}; TestThread() = delete; - ~TestThread() {}; + ~TestThread() {} bool ReadyToWork() override; @@ -164,7 +164,6 @@ HWTEST_F(UtilsThreadTest, testThread001, TestSize.Level0) EXPECT_EQ(test->name_, DEFAULT_THREAD_NAME); // get stacksize of threa, may be different because of system memory align - EXPECT_EQ(test->data_, 0); EXPECT_EQ(times, 0); test->NotifyExitSync(); @@ -214,7 +213,7 @@ HWTEST_F(UtilsThreadTest, testThread003, TestSize.Level0) pthread_t thread = test->GetThread(); // pthread_equal return non-zero if equal - EXPECT_EQ(pthread_equal(thread ,-1) != 0, (test->IsRunning() ? false : true)); + EXPECT_EQ(pthread_equal(thread , -1) != 0, (test->IsRunning() ? false : true)); // ReadyToWork return false, RUN will not be called! EXPECT_EQ(test->priority_, DEFAULT_PRIO); @@ -269,7 +268,7 @@ HWTEST_F(UtilsThreadTest, testThread005, TestSize.Level0) pthread_t thread = test->GetThread(); // pthread_equal return non-zero if equal - EXPECT_EQ(pthread_equal(thread ,-1) != 0, (test->IsRunning() ? false : true)); + EXPECT_EQ(pthread_equal(thread , -1) != 0, (test->IsRunning() ? false : true)); // ReadyToWork return false, RUN will not be called! EXPECT_EQ(test->priority_, DEFAULT_PRIO); diff --git a/base/test/unittest/common/utils_timer_test.cpp b/base/test/unittest/common/utils_timer_test.cpp old mode 100755 new mode 100644 diff --git a/base/test/unittest/common/utils_unique_fd_test.cpp b/base/test/unittest/common/utils_unique_fd_test.cpp old mode 100755 new mode 100644