Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
communication_ipc
提交
8a3c869d
C
communication_ipc
项目概览
OpenHarmony
/
communication_ipc
大约 1 年 前同步成功
通知
20
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
communication_ipc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8a3c869d
编写于
5月 20, 2022
作者:
L
liubb_0516
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move messageparcelappend to utils parcel
Signed-off-by:
N
liubb_0516
<
liubeibei8@huawei.com
>
上级
a5633443
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
3 addition
and
42 deletion
+3
-42
interfaces/innerkits/ipc_core/include/message_parcel.h
interfaces/innerkits/ipc_core/include/message_parcel.h
+0
-1
ipc/native/src/core/source/message_parcel.cpp
ipc/native/src/core/source/message_parcel.cpp
+0
-39
ipc/test/auxiliary/native/src/test_service_skeleton.cpp
ipc/test/auxiliary/native/src/test_service_skeleton.cpp
+3
-2
未找到文件。
interfaces/innerkits/ipc_core/include/message_parcel.h
浏览文件 @
8a3c869d
...
@@ -50,7 +50,6 @@ public:
...
@@ -50,7 +50,6 @@ public:
{
{
needCloseFd_
=
true
;
needCloseFd_
=
true
;
};
};
bool
MessageParcelAppend
(
MessageParcel
&
data
);
private:
private:
#ifndef CONFIG_IPC_SINGLE
#ifndef CONFIG_IPC_SINGLE
...
...
ipc/native/src/core/source/message_parcel.cpp
浏览文件 @
8a3c869d
...
@@ -422,43 +422,4 @@ sptr<Ashmem> MessageParcel::ReadAshmem()
...
@@ -422,43 +422,4 @@ sptr<Ashmem> MessageParcel::ReadAshmem()
}
}
return
new
(
std
::
nothrow
)
Ashmem
(
fd
,
size
);
return
new
(
std
::
nothrow
)
Ashmem
(
fd
,
size
);
}
}
bool
MessageParcel
::
MessageParcelAppend
(
MessageParcel
&
data
)
{
size_t
dataSize
=
data
.
GetDataSize
();
if
(
dataSize
==
0
)
{
DBINDER_LOGE
(
"no data to append"
);
return
true
;
}
uintptr_t
dataPtr
=
data
.
GetData
();
size_t
writeCursorOld
=
this
->
GetWritePosition
();
if
(
!
WriteBuffer
(
reinterpret_cast
<
void
*>
(
dataPtr
),
dataSize
))
{
DBINDER_LOGE
(
"data append write buffer failed"
);
return
false
;
}
size_t
objectSize
=
data
.
GetOffsetsSize
();
if
(
objectSize
==
0
)
{
return
true
;
}
binder_size_t
objectOffsets
=
data
.
GetObjectOffsets
();
auto
*
newObjectOffsets
=
reinterpret_cast
<
binder_size_t
*>
(
objectOffsets
);
for
(
size_t
index
=
0
;
index
<
objectSize
;
index
++
)
{
if
(
EnsureObjectsCapacity
())
{
size_t
offset
=
writeCursorOld
+
newObjectOffsets
[
index
];
bool
res
=
WriteObjectOffset
(
offset
);
if
(
!
res
)
{
DBINDER_LOGE
(
"parcel append write offsets failed"
);
return
false
;
}
flat_binder_object
*
flat
=
reinterpret_cast
<
flat_binder_object
*>
(
this
->
GetData
()
+
offset
);
if
(
flat
->
hdr
.
type
==
BINDER_TYPE_FD
)
{
flat
->
handle
=
dup
(
flat
->
handle
);
}
}
else
{
DBINDER_LOGE
(
"Failed to ensure parcel capacity"
);
return
false
;
}
}
return
true
;
}
}
// namespace OHOS
}
// namespace OHOS
ipc/test/auxiliary/native/src/test_service_skeleton.cpp
浏览文件 @
8a3c869d
...
@@ -428,7 +428,7 @@ int TestServiceProxy::TestAccessTokenID(int32_t ftoken_expected)
...
@@ -428,7 +428,7 @@ int TestServiceProxy::TestAccessTokenID(int32_t ftoken_expected)
int
TestServiceProxy
::
TestMessageParcelAppend
(
MessageParcel
&
dst
,
MessageParcel
&
src
)
int
TestServiceProxy
::
TestMessageParcelAppend
(
MessageParcel
&
dst
,
MessageParcel
&
src
)
{
{
bool
res
=
dst
.
Message
ParcelAppend
(
src
);
bool
res
=
dst
.
ParcelAppend
(
src
);
if
(
!
res
)
{
if
(
!
res
)
{
ZLOGE
(
LABEL
,
"TestMessageParcelAppend without ipc failed"
);
ZLOGE
(
LABEL
,
"TestMessageParcelAppend without ipc failed"
);
return
-
1
;
return
-
1
;
...
@@ -439,7 +439,7 @@ int TestServiceProxy::TestMessageParcelAppend(MessageParcel &dst, MessageParcel
...
@@ -439,7 +439,7 @@ int TestServiceProxy::TestMessageParcelAppend(MessageParcel &dst, MessageParcel
int
TestServiceProxy
::
TestMessageParcelAppendWithIpc
(
MessageParcel
&
dst
,
MessageParcel
&
src
,
int
TestServiceProxy
::
TestMessageParcelAppendWithIpc
(
MessageParcel
&
dst
,
MessageParcel
&
src
,
MessageParcel
&
reply
,
bool
withObject
)
MessageParcel
&
reply
,
bool
withObject
)
{
{
bool
res
=
dst
.
Message
ParcelAppend
(
src
);
bool
res
=
dst
.
ParcelAppend
(
src
);
if
(
!
res
)
{
if
(
!
res
)
{
ZLOGE
(
LABEL
,
"TestMessageParcelAppend with ipc failed"
);
ZLOGE
(
LABEL
,
"TestMessageParcelAppend with ipc failed"
);
return
-
1
;
return
-
1
;
...
@@ -685,6 +685,7 @@ int TestServiceStub::OnRemoteRequest(uint32_t code,
...
@@ -685,6 +685,7 @@ int TestServiceStub::OnRemoteRequest(uint32_t code,
reply
.
WriteInt32
(
data
.
ReadInt32
());
reply
.
WriteInt32
(
data
.
ReadInt32
());
reply
.
WriteString
(
data
.
ReadString
());
reply
.
WriteString
(
data
.
ReadString
());
reply
.
WriteRemoteObject
(
data
.
ReadRemoteObject
());
reply
.
WriteRemoteObject
(
data
.
ReadRemoteObject
());
reply
.
WriteFileDescriptor
(
data
.
ReadFileDescriptor
());
break
;
break
;
}
}
default:
default:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录