From 83a08daff789c3b6c1572923aa2481fdd59bca30 Mon Sep 17 00:00:00 2001 From: Wiktor Garbacz Date: Thu, 1 Oct 2020 06:44:57 -0700 Subject: [PATCH] Change `int64` to `size_t` in Buffer PiperOrigin-RevId: 334802978 Change-Id: I7e421b1a6a98138139003cc4dc2a548ebe366e3e --- sandboxed_api/sandbox2/buffer.cc | 2 +- sandboxed_api/sandbox2/buffer.h | 2 +- sandboxed_api/sandbox2/comms.h | 8 ++++---- sandboxed_api/sandbox2/comms_test.cc | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sandboxed_api/sandbox2/buffer.cc b/sandboxed_api/sandbox2/buffer.cc index c494061..81dabcf 100644 --- a/sandboxed_api/sandbox2/buffer.cc +++ b/sandboxed_api/sandbox2/buffer.cc @@ -54,7 +54,7 @@ absl::StatusOr> Buffer::CreateFromFd(int fd) { // Creates a new Buffer of the specified size, backed by a temporary file that // will be immediately deleted. -absl::StatusOr> Buffer::CreateWithSize(int64 size) { +absl::StatusOr> Buffer::CreateWithSize(size_t size) { int fd; if (!util::CreateMemFd(&fd)) { return absl::InternalError("Could not create buffer temp file"); diff --git a/sandboxed_api/sandbox2/buffer.h b/sandboxed_api/sandbox2/buffer.h index d6024b5..e9e9bc3 100644 --- a/sandboxed_api/sandbox2/buffer.h +++ b/sandboxed_api/sandbox2/buffer.h @@ -41,7 +41,7 @@ class Buffer final { // Creates a new Buffer of the specified size, backed by a temporary file that // will be immediately deleted. - static absl::StatusOr> CreateWithSize(int64 size); + static absl::StatusOr> CreateWithSize(size_t size); // Returns a pointer to the buffer, which is read/write. uint8_t* data() const { return buf_; } diff --git a/sandboxed_api/sandbox2/comms.h b/sandboxed_api/sandbox2/comms.h index c3fac21..fca8c53 100644 --- a/sandboxed_api/sandbox2/comms.h +++ b/sandboxed_api/sandbox2/comms.h @@ -128,10 +128,10 @@ class Comms { bool SendUint32(uint32_t v) { return SendGeneric(v, kTagUint32); } bool RecvInt32(int32_t* v) { return RecvIntGeneric(v, kTagInt32); } bool SendInt32(int32_t v) { return SendGeneric(v, kTagInt32); } - bool RecvUint64(uint64* v) { return RecvIntGeneric(v, kTagUint64); } - bool SendUint64(uint64 v) { return SendGeneric(v, kTagUint64); } - bool RecvInt64(int64* v) { return RecvIntGeneric(v, kTagInt64); } - bool SendInt64(int64 v) { return SendGeneric(v, kTagInt64); } + bool RecvUint64(uint64_t* v) { return RecvIntGeneric(v, kTagUint64); } + bool SendUint64(uint64_t v) { return SendGeneric(v, kTagUint64); } + bool RecvInt64(int64_t* v) { return RecvIntGeneric(v, kTagInt64); } + bool SendInt64(int64_t v) { return SendGeneric(v, kTagInt64); } bool RecvBool(bool* v) { return RecvIntGeneric(v, kTagBool); } bool SendBool(bool v) { return SendGeneric(v, kTagBool); } bool RecvString(std::string* v); diff --git a/sandboxed_api/sandbox2/comms_test.cc b/sandboxed_api/sandbox2/comms_test.cc index 496045e..bb8eedd 100644 --- a/sandboxed_api/sandbox2/comms_test.cc +++ b/sandboxed_api/sandbox2/comms_test.cc @@ -174,13 +174,13 @@ TEST_F(CommsTest, TestSendRecv64) { ASSERT_THAT(comms->SendUint64(1099511627776ULL), IsTrue()); // Recv Int64. - int64 tmp64; + int64_t tmp64; ASSERT_THAT(comms->RecvInt64(&tmp64), IsTrue()); EXPECT_THAT(tmp64, Eq(-1099511627776LL)); }; auto b = [](Comms* comms) { // Recv Uint64. - uint64 tmpu64; + uint64_t tmpu64; ASSERT_THAT(comms->RecvUint64(&tmpu64), IsTrue()); EXPECT_THAT(tmpu64, Eq(1099511627776ULL));