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.
*
*