!76 suited to specification

Merge pull request !76 from zhoushilin/master
This commit is contained in:
openharmony_ci
2022-03-25 11:44:02 +00:00
committed by Gitee
111 changed files with 147 additions and 153 deletions
Executable → Regular
View File
Executable → Regular
+3 -3
View File
@@ -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)
Executable → Regular
+8 -8
View File
@@ -9,11 +9,11 @@
C++公共基础类库提供了一些常用的C++开发工具类,包括:
- 文件、路径、字符串相关操作的能力增强接口
- 读写锁、信号量、定时器、线程增强及线程池等接口
- 安全数据容器、数据序列化等接口
- 各子系统的错误码相关定义
- C语言安全函数接口
- 文件、路径、字符串相关操作的能力增强接口
- 读写锁、信号量、定时器、线程增强及线程池等接口
- 安全数据容器、数据序列化等接口
- 各子系统的错误码相关定义
- C语言安全函数接口
## 目录<a name="section17271017133915"></a>
@@ -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)
Executable → Regular
+1
View File
@@ -45,6 +45,7 @@ public:
{
return memoryFd_;
};
private:
int memoryFd_;
int32_t memorySize_;
Executable → Regular
+1 -1
View File
@@ -40,4 +40,4 @@ enum {
} // Utils
} // OHOS
#endif
#endif
+1 -1
View File
@@ -50,4 +50,4 @@ enum {
} // Utils
} // OHOS
#endif
#endif
Executable → Regular
+1 -1
View File
@@ -102,4 +102,4 @@ int64_t GetTickCount();
int64_t GetMicroTickCount();
}
#endif
#endif
Executable → Regular
+1 -1
View File
@@ -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
#endif
Executable → Regular
View File
Executable → Regular
+18 -18
View File
@@ -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 <sys/types.h>
#include <linux/types.h>
@@ -40,4 +40,4 @@ struct parcel_flat_binder_object {
binder_uintptr_t cookie;
};
#endif
#endif
+2 -2
View File
@@ -33,8 +33,8 @@ namespace OHOS {
class NoCopyable {
protected:
NoCopyable() {};
virtual ~NoCopyable() {};
NoCopyable() {}
virtual ~NoCopyable() {}
private:
DISALLOW_COPY_AND_MOVE(NoCopyable);
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
+2 -2
View File
@@ -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)
{
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
+6 -6
View File
@@ -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 */
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
+3 -3
View File
@@ -43,7 +43,7 @@ public:
SortedVector(const std::vector<TYPE>& orivect);
virtual ~SortedVector() {};
virtual ~SortedVector() {}
// copy operator
SortedVector<TYPE, AllowDuplicate>& operator=(const SortedVector<TYPE, false>& rhs);
SortedVector<TYPE, AllowDuplicate>& operator=(const SortedVector<TYPE, true>& 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;
Executable → Regular
View File
Executable → Regular
+1
View File
@@ -54,6 +54,7 @@ public:
bool IsRunning() const;
pthread_t GetThread() const { return thread_; }
protected:
virtual bool Run() = 0; // Derived class must implement Run()
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
+1 -1
View File
@@ -83,4 +83,4 @@ void EventHandler::Update()
}
} // Utils
} // OHOS
} // OHOS
Executable → Regular
+1 -1
View File
@@ -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_); }
Executable → Regular
+1 -1
View File
@@ -127,4 +127,4 @@ void EventReactor::CancelTimer(int timerFd)
}
} // namespace Utils
} // namespace OHOS
} // namespace OHOS
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
+2 -2
View File
@@ -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));
Executable → Regular
+1 -1
View File
@@ -88,4 +88,4 @@ void RWLock::UnLockWrite()
}
} // namespace Utils
} // namespace OHOS
} // namespace OHOS
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
+8 -8
View File
@@ -59,21 +59,21 @@ static void SecUtilMemmove(void *dst, const void *src, size_t count)
* Copies count bytes of characters from src to dest.
*
* <INPUT PARAMETERS>
* 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.
*
* <OUTPUT PARAMETERS>
* dest buffer is updated.
*
* <RETURN VALUE>
* 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
Executable → Regular
+8 -8
View File
@@ -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)
{
Executable → Regular
View File
Executable → Regular
+2 -2
View File
@@ -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
Executable → Regular
+1 -1
View File
@@ -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)
Executable → Regular
+4 -4
View File
@@ -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)
Executable → Regular
View File
Executable → Regular
View File
View File
View File
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
+1 -1
View File
@@ -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') { \
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
+37 -37
View File
@@ -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);
/*******************************************************************************
* <FUNCTION DESCRIPTION>
* 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 <private> for not-public args
* the terminating NULL)
* priv_on whether print <private> 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;
}
}
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
View File
Executable → Regular
+1 -1
View File
@@ -158,4 +158,4 @@ void Semaphore::Post()
}
}
} // namespace OHOS
} // namespace OHOS
Executable → Regular
View File
Executable → Regular
+2 -1
View File
@@ -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
} // namespace OHOS
Executable → Regular
+1 -1
View File
@@ -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;
}
Executable → Regular
+1 -1
View File
@@ -242,4 +242,4 @@ void Timer::EraseUnusedTimerId(uint32_t interval, const std::vector<uint32_t>& u
}
} // namespace Utils
} // namespace OHOS
} // namespace OHOS
Executable → Regular
+1 -1
View File
@@ -112,4 +112,4 @@ void TimerEventHandler::TimeOut()
}
} // namespace Utils
} // namespace OHOS
} // namespace OHOS
Executable → Regular
+1
View File
@@ -28,6 +28,7 @@ class EventReactor;
class TimerEventHandler {
using TimerCallback = std::function<void(int timerFd)>;
public:
TimerEventHandler(EventReactor* p, uint32_t timeout, bool once);
~TimerEventHandler();
Executable → Regular
View File
View File
View File
View File
+5 -5
View File
@@ -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);
}
}
@@ -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<string>& GetBooks() { return books_; }
private:
set<string> books_;
@@ -91,7 +91,7 @@ HWTEST_F(UtilsObserverTest, test_ObserverNotify, TestSize.Level0)
shared_ptr<BookObserver> bookObserver1 = make_shared<BookObserver>();
shared_ptr<BookObserver> bookObserver2 = make_shared<BookObserver>();
shared_ptr<BookObserver> bookObserver3 = make_shared<BookObserver>();
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<BookObserver> bookObserver1 = make_shared<BookObserver>();
shared_ptr<BookObserver> bookObserver2 = make_shared<BookObserver>();
shared_ptr<BookObserver> bookObserver3 = make_shared<BookObserver>();
bookList.AddObserver(bookObserver1);
bookList.AddObserver(bookObserver2);
bookList.AddObserver(bookObserver3);
View File
+4 -3
View File
@@ -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_;
};
View File

Some files were not shown because too many files have changed in this diff Show More