mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Internal change
PiperOrigin-RevId: 334569306 Change-Id: Ibf1b3a24b57b02ce1c5e6106e5331520dfdf7112
This commit is contained in:
parent
d292a9af7b
commit
575f24f5df
|
@ -54,7 +54,7 @@ absl::StatusOr<std::unique_ptr<Buffer>> Buffer::CreateFromFd(int fd) {
|
||||||
|
|
||||||
// Creates a new Buffer of the specified size, backed by a temporary file that
|
// Creates a new Buffer of the specified size, backed by a temporary file that
|
||||||
// will be immediately deleted.
|
// will be immediately deleted.
|
||||||
absl::StatusOr<std::unique_ptr<Buffer>> Buffer::CreateWithSize(int64_t size) {
|
absl::StatusOr<std::unique_ptr<Buffer>> Buffer::CreateWithSize(int64 size) {
|
||||||
int fd;
|
int fd;
|
||||||
if (!util::CreateMemFd(&fd)) {
|
if (!util::CreateMemFd(&fd)) {
|
||||||
return absl::InternalError("Could not create buffer temp file");
|
return absl::InternalError("Could not create buffer temp file");
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Buffer final {
|
||||||
|
|
||||||
// Creates a new Buffer of the specified size, backed by a temporary file that
|
// Creates a new Buffer of the specified size, backed by a temporary file that
|
||||||
// will be immediately deleted.
|
// will be immediately deleted.
|
||||||
static absl::StatusOr<std::unique_ptr<Buffer>> CreateWithSize(int64_t size);
|
static absl::StatusOr<std::unique_ptr<Buffer>> CreateWithSize(int64 size);
|
||||||
|
|
||||||
// Returns a pointer to the buffer, which is read/write.
|
// Returns a pointer to the buffer, which is read/write.
|
||||||
uint8_t* data() const { return buf_; }
|
uint8_t* data() const { return buf_; }
|
||||||
|
|
|
@ -128,10 +128,10 @@ class Comms {
|
||||||
bool SendUint32(uint32_t v) { return SendGeneric(v, kTagUint32); }
|
bool SendUint32(uint32_t v) { return SendGeneric(v, kTagUint32); }
|
||||||
bool RecvInt32(int32_t* v) { return RecvIntGeneric(v, kTagInt32); }
|
bool RecvInt32(int32_t* v) { return RecvIntGeneric(v, kTagInt32); }
|
||||||
bool SendInt32(int32_t v) { return SendGeneric(v, kTagInt32); }
|
bool SendInt32(int32_t v) { return SendGeneric(v, kTagInt32); }
|
||||||
bool RecvUint64(uint64_t* v) { return RecvIntGeneric(v, kTagUint64); }
|
bool RecvUint64(uint64* v) { return RecvIntGeneric(v, kTagUint64); }
|
||||||
bool SendUint64(uint64_t v) { return SendGeneric(v, kTagUint64); }
|
bool SendUint64(uint64 v) { return SendGeneric(v, kTagUint64); }
|
||||||
bool RecvInt64(int64_t* v) { return RecvIntGeneric(v, kTagInt64); }
|
bool RecvInt64(int64* v) { return RecvIntGeneric(v, kTagInt64); }
|
||||||
bool SendInt64(int64_t v) { return SendGeneric(v, kTagInt64); }
|
bool SendInt64(int64 v) { return SendGeneric(v, kTagInt64); }
|
||||||
bool RecvBool(bool* v) { return RecvIntGeneric(v, kTagBool); }
|
bool RecvBool(bool* v) { return RecvIntGeneric(v, kTagBool); }
|
||||||
bool SendBool(bool v) { return SendGeneric(v, kTagBool); }
|
bool SendBool(bool v) { return SendGeneric(v, kTagBool); }
|
||||||
bool RecvString(std::string* v);
|
bool RecvString(std::string* v);
|
||||||
|
|
|
@ -174,13 +174,13 @@ TEST_F(CommsTest, TestSendRecv64) {
|
||||||
ASSERT_THAT(comms->SendUint64(1099511627776ULL), IsTrue());
|
ASSERT_THAT(comms->SendUint64(1099511627776ULL), IsTrue());
|
||||||
|
|
||||||
// Recv Int64.
|
// Recv Int64.
|
||||||
int64_t tmp64;
|
int64 tmp64;
|
||||||
ASSERT_THAT(comms->RecvInt64(&tmp64), IsTrue());
|
ASSERT_THAT(comms->RecvInt64(&tmp64), IsTrue());
|
||||||
EXPECT_THAT(tmp64, Eq(-1099511627776LL));
|
EXPECT_THAT(tmp64, Eq(-1099511627776LL));
|
||||||
};
|
};
|
||||||
auto b = [](Comms* comms) {
|
auto b = [](Comms* comms) {
|
||||||
// Recv Uint64.
|
// Recv Uint64.
|
||||||
uint64_t tmpu64;
|
uint64 tmpu64;
|
||||||
ASSERT_THAT(comms->RecvUint64(&tmpu64), IsTrue());
|
ASSERT_THAT(comms->RecvUint64(&tmpu64), IsTrue());
|
||||||
EXPECT_THAT(tmpu64, Eq(1099511627776ULL));
|
EXPECT_THAT(tmpu64, Eq(1099511627776ULL));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user