提交 33814601 编写于 作者: W whm

feat:dailycheck

Signed-off-by: Nwhm <weihongming2@huawei.com>
上级 e7108524
......@@ -31,7 +31,7 @@ public:
PROT_WRITE = 2,
};
explicit NAPIAshmem(sptr<Ashmem> &ashmem);
NAPIAshmem():ashmem_(nullptr){}
NAPIAshmem() : ashmem_(nullptr) {}
~NAPIAshmem() = default;
const sptr<Ashmem> &GetAshmem()
{
......
......@@ -41,7 +41,7 @@ static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, LOG_ID_IPC,
#define CHECK_WRITE_CAPACITY(env, lenToWrite, napiParcel) \
do { \
size_t cap = napiParcel->maxCapacityToWrite_ - napiParcel->nativeParcel_->GetWritePosition(); \
if (cap < lenToWrite) { \
if (cap < (lenToWrite)) { \
DBINDER_LOGI("No enough capacity to write"); \
napi_throw_range_error(env, nullptr, "No enough capacity to write"); \
} \
......@@ -50,7 +50,7 @@ static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, LOG_ID_IPC,
#define REWIND_IF_WRITE_CHECK_FAIL(env, lenToWrite, pos, napiParcel) \
do { \
size_t cap = napiParcel->maxCapacityToWrite_ - napiParcel->nativeParcel_->GetWritePosition(); \
if (cap < lenToWrite) { \
if (cap < (lenToWrite)) { \
DBINDER_LOGI("No enough capacity to write"); \
napiParcel->nativeParcel_->RewindWrite(pos); \
napi_throw_range_error(env, nullptr, "No enough capacity to write"); \
......@@ -60,7 +60,7 @@ static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, LOG_ID_IPC,
#define CHECK_READ_LENGTH(env, arrayLength, typeSize, napiParcel) \
do { \
size_t remainSize = napiParcel->nativeParcel_->GetDataSize() - napiParcel->nativeParcel_->GetReadPosition(); \
if ((arrayLength < 0) || (arrayLength > remainSize) || ((arrayLength * typeSize) > remainSize)) { \
if (((arrayLength) < 0) || ((arrayLength) > remainSize) || (((arrayLength) * (typeSize)) > remainSize)) { \
DBINDER_LOGI("No enough data to read"); \
napi_throw_range_error(env, nullptr, "No enough data to read"); \
} \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册