提交 330b4bc7 编写于 作者: L liangshenglin1

fix bug of JS RemoteObject constructor and translate RemoteObject array.

Signed-off-by: Nliangshenglin1 <liangshenglin1@huawei.com>
上级 356c98fb
...@@ -239,7 +239,7 @@ bool DBinderBaseInvoker<T>::IRemoteObjectTranslate(char *dataBuffer, binder_size ...@@ -239,7 +239,7 @@ bool DBinderBaseInvoker<T>::IRemoteObjectTranslate(char *dataBuffer, binder_size
} }
uint32_t totalSize = 0; uint32_t totalSize = 0;
uintptr_t *binderObjectsOffsets = reinterpret_cast<uintptr_t *>(data.GetObjectOffsets()); binder_size_t *binderObjectsOffsets = reinterpret_cast<binder_size_t *>(data.GetObjectOffsets());
uint32_t offsetOfSession = buffer_size + data.GetOffsetsSize() * sizeof(binder_size_t); uint32_t offsetOfSession = buffer_size + data.GetOffsetsSize() * sizeof(binder_size_t);
char *flatOffset = dataBuffer + offsetOfSession; char *flatOffset = dataBuffer + offsetOfSession;
......
...@@ -33,7 +33,7 @@ public: ...@@ -33,7 +33,7 @@ public:
explicit NAPIAshmem(sptr<Ashmem> &ashmem); explicit NAPIAshmem(sptr<Ashmem> &ashmem);
NAPIAshmem():ashmem_(nullptr){} NAPIAshmem():ashmem_(nullptr){}
~NAPIAshmem() = default; ~NAPIAshmem() = default;
sptr<Ashmem> &GetAshmem() const sptr<Ashmem> &GetAshmem()
{ {
return ashmem_; return ashmem_;
} }
...@@ -58,4 +58,4 @@ private: ...@@ -58,4 +58,4 @@ private:
sptr<Ashmem> ashmem_; sptr<Ashmem> ashmem_;
}; };
} // namespace OHOS } // namespace OHOS
#endif #endif
\ No newline at end of file
...@@ -765,11 +765,9 @@ napi_value NAPI_ohos_rpc_CreateJsRemoteObject(napi_env env, const sptr<IRemoteOb ...@@ -765,11 +765,9 @@ napi_value NAPI_ohos_rpc_CreateJsRemoteObject(napi_env env, const sptr<IRemoteOb
std::string desc = Str16ToStr8(descriptor); std::string desc = Str16ToStr8(descriptor);
napi_value jsDesc = nullptr; napi_value jsDesc = nullptr;
napi_create_string_utf8(env, desc.c_str(), desc.length(), &jsDesc); napi_create_string_utf8(env, desc.c_str(), desc.length(), &jsDesc);
napi_value len = nullptr;
napi_create_int32(env, desc.length(), &len);
// create a new js remote object // create a new js remote object
size_t argc = 2; size_t argc = 1;
napi_value argv[2] = { jsDesc, len }; napi_value argv[1] = { jsDesc };
napi_value jsRemoteObject = nullptr; napi_value jsRemoteObject = nullptr;
status = napi_new_instance(env, constructor, argc, argv, &jsRemoteObject); status = napi_new_instance(env, constructor, argc, argv, &jsRemoteObject);
NAPI_ASSERT(env, status == napi_ok, "failed to construct js RemoteObject"); NAPI_ASSERT(env, status == napi_ok, "failed to construct js RemoteObject");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册