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
diff --git a/libs/binder/RpcState.cpp b/libs/binder/RpcState.cpp
index 6563bc8..23382c3 100644
--- a/libs/binder/RpcState.cpp
+++ b/libs/binder/RpcState.cpp
@@ -601,7 +601,7 @@
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;
}