diff --git a/frameworks/innerkitsimpl/rdb/src/rdb_service_proxy.cpp b/frameworks/innerkitsimpl/rdb/src/rdb_service_proxy.cpp index 7c9471f7ba46cd42766398269c37a3ce7f9a887b..53c93569767c7a9a0f6ad0dfd4a6d617eb1e2206 100644 --- a/frameworks/innerkitsimpl/rdb/src/rdb_service_proxy.cpp +++ b/frameworks/innerkitsimpl/rdb/src/rdb_service_proxy.cpp @@ -54,7 +54,11 @@ std::string RdbServiceProxy::ObtainDistributedTableName(const std::string &devic ZLOGE("write descriptor failed"); return ""; } - if (!DistributedKv::ITypesUtil::Marshalling(data, device, table)) { + if (!data.WriteString(device)) { + ZLOGE("write device failed"); + return ""; + } + if (!data.WriteString(table)) { ZLOGE("write table failed"); return ""; } @@ -99,10 +103,14 @@ int32_t RdbServiceProxy::InitNotifier(const RdbSyncerParam ¶m, const sptr tables; - if (!DistributedKv::ITypesUtil::Unmarshalling(data, param, tables)) { + if (!DistributedKv::ITypesUtil::Unmarshalling(data, param)) { ZLOGE("read param failed"); reply.WriteInt32(RDB_ERROR); return RDB_OK; } - + std::vector tables; + data.ReadStringVector(&tables); reply.WriteInt32(SetDistributedTables(param, tables)); return RDB_OK; } @@ -83,10 +83,20 @@ int32_t RdbServiceStub::OnRemoteSetDistributedTables(MessageParcel &data, Messag int32_t RdbServiceStub::OnRemoteDoSync(MessageParcel &data, MessageParcel &reply) { RdbSyncerParam param; + if (!DistributedKv::ITypesUtil::Unmarshalling(data, param)) { + ZLOGE("read param failed"); + reply.WriteInt32(RDB_ERROR); + return RDB_OK; + } SyncOption option {}; + if (!DistributedKv::ITypesUtil::Unmarshalling(data, option)) { + ZLOGE("read option failed"); + reply.WriteInt32(RDB_ERROR); + return RDB_OK; + } RdbPredicates predicates; - if (!DistributedKv::ITypesUtil::Unmarshalling(data, param, option, predicates)) { - ZLOGE("read param or option or predicates failed"); + if (!DistributedKv::ITypesUtil::Unmarshalling(data, predicates)) { + ZLOGE("read predicates failed"); reply.WriteInt32(RDB_ERROR); return RDB_OK; } @@ -106,11 +116,26 @@ int32_t RdbServiceStub::OnRemoteDoSync(MessageParcel &data, MessageParcel &reply int32_t RdbServiceStub::OnRemoteDoAsync(MessageParcel &data, MessageParcel &reply) { RdbSyncerParam param; + if (!DistributedKv::ITypesUtil::Unmarshalling(data, param)) { + ZLOGE("read param failed"); + reply.WriteInt32(RDB_ERROR); + return RDB_OK; + } uint32_t seqNum; + if (!data.ReadUint32(seqNum)) { + ZLOGI("read seq num failed"); + reply.WriteInt32(RDB_ERROR); + return RDB_OK; + } SyncOption option {}; + if (!DistributedKv::ITypesUtil::Unmarshalling(data, option)) { + ZLOGE("read option failed"); + reply.WriteInt32(RDB_ERROR); + return RDB_OK; + } RdbPredicates predicates; - if (!DistributedKv::ITypesUtil::Unmarshalling(data, param, seqNum, option, predicates)) { - ZLOGE("read param failed"); + if (!DistributedKv::ITypesUtil::Unmarshalling(data, predicates)) { + ZLOGE("read predicates failed"); reply.WriteInt32(RDB_ERROR); return RDB_OK; }