mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-23 18:20:04 +00:00
!8621 Fix type mismatch
Merge pull request !8621 from diartyz/type_mismatch
This commit is contained in:
commit
188a6fec98
@ -176,22 +176,22 @@ public:
|
||||
return RawDataEmit(data, length, bufferSize_);
|
||||
}
|
||||
|
||||
ssize_t RawDataEmit(const void *data, size_t length, ssize_t offset)
|
||||
ssize_t RawDataEmit(const void *data, size_t length, size_t offset)
|
||||
{
|
||||
if (length <= 0 || offset < 0) {
|
||||
if (length <= 0) {
|
||||
return -1;
|
||||
}
|
||||
if ((static_cast<size_t>(offset) + length) > bufferCapacity_) {
|
||||
if ((offset + length) > bufferCapacity_) {
|
||||
if (!AllocateBuffer(length)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (memcpy_s(buffer_ + offset, bufferCapacity_ - static_cast<size_t>(offset), data, length) != EOK) {
|
||||
if (memcpy_s(buffer_ + offset, bufferCapacity_ - offset, data, length) != EOK) {
|
||||
LOG_FULL(ERROR) << "Failed to memcpy_s Data";
|
||||
return -1;
|
||||
}
|
||||
ssize_t res = offset;
|
||||
if (bufferSize_ == static_cast<size_t>(offset)) {
|
||||
if (bufferSize_ == offset) {
|
||||
bufferSize_ += length;
|
||||
}
|
||||
return res;
|
||||
@ -207,7 +207,7 @@ public:
|
||||
return RawDataEmit(reinterpret_cast<uint8_t *>(&c), U64_SIZE);
|
||||
}
|
||||
|
||||
ssize_t EmitU64(uint64_t c, ssize_t offset)
|
||||
ssize_t EmitU64(uint64_t c, size_t offset)
|
||||
{
|
||||
return RawDataEmit(reinterpret_cast<uint8_t *>(&c), U64_SIZE, offset);
|
||||
}
|
||||
|
@ -126,13 +126,13 @@ bool ValueSerializer::WriteValue(JSThread *thread,
|
||||
for (auto &entry : detachCallbackInfo_) {
|
||||
auto info = entry.second;
|
||||
DetachFunc detachNative = reinterpret_cast<DetachFunc>(info->detachFunc);
|
||||
if (detachNative == nullptr || !(entry.first >= 0)) {
|
||||
if (detachNative == nullptr || entry.first < 0) {
|
||||
LOG_ECMA(ERROR) << "ValueSerialize: SerializeNativeBindingObject detachNative == nullptr";
|
||||
notSupport_ = true;
|
||||
break;
|
||||
}
|
||||
void *buffer = detachNative(info->env, info->nativeValue, info->hint, info->detachData);
|
||||
data_->EmitU64(reinterpret_cast<uint64_t>(buffer), entry.first);
|
||||
data_->EmitU64(reinterpret_cast<uint64_t>(buffer), static_cast<size_t>(entry.first));
|
||||
}
|
||||
}
|
||||
if (notSupport_) {
|
||||
|
Loading…
Reference in New Issue
Block a user