summaryrefslogtreecommitdiff
path: root/libs/binder/RpcState.cpp
diff options
context:
space:
mode:
author Yifan Hong <elsk@google.com> 2021-08-04 14:59:10 -0700
committer Yifan Hong <elsk@google.com> 2021-08-05 18:41:49 +0000
commit218c4070b9b274e604d77cf284140a1f73859a2a (patch)
treee0cfb94a27c4f74531816e8716d1585a852f101c /libs/binder/RpcState.cpp
parent5bff74281079ff595935bf95793999f2fa3a0d86 (diff)
binder: RpcTransport: change to size_t.
- Change return type to Result<size_t> because negative numbers (-1) are converted to an Error(). - Change size argument from int to size_t because size_t is unsigned and is the best type to represent a "size". Test: pass Bug: 190868302 Fixes: 195592175 Change-Id: Ide26d2d5cc11a9b776fc3dc0a2281300f611b327
Diffstat (limited to 'libs/binder/RpcState.cpp')
-rw-r--r--libs/binder/RpcState.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libs/binder/RpcState.cpp b/libs/binder/RpcState.cpp
index 6563bc85aa..23382c3858 100644
--- a/libs/binder/RpcState.cpp
+++ b/libs/binder/RpcState.cpp
@@ -601,7 +601,7 @@ status_t RpcState::getAndExecuteCommand(const sp<RpcSession::RpcConnection>& con
status_t RpcState::drainCommands(const sp<RpcSession::RpcConnection>& connection,
const sp<RpcSession>& session, CommandType type) {
uint8_t buf;
- while (connection->rpcTransport->peek(&buf, sizeof(buf)).value_or(-1) > 0) {
+ while (connection->rpcTransport->peek(&buf, sizeof(buf)).value_or(0) > 0) {
status_t status = getAndExecuteCommand(connection, session, type);
if (status != OK) return status;
}