OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/binder/writable_transaction_data.h" | 5 #include "chromeos/binder/writable_transaction_data.h" |
6 | 6 |
7 namespace binder { | 7 namespace binder { |
8 | 8 |
9 WritableTransactionData::WritableTransactionData() {} | 9 WritableTransactionData::WritableTransactionData() {} |
10 | 10 |
11 WritableTransactionData::~WritableTransactionData() {} | 11 WritableTransactionData::~WritableTransactionData() {} |
12 | 12 |
13 uintptr_t WritableTransactionData::GetCookie() const { | 13 uintptr_t WritableTransactionData::GetCookie() const { |
14 return 0; | 14 return 0; |
15 } | 15 } |
16 | 16 |
17 uint32 WritableTransactionData::GetCode() const { | 17 uint32_t WritableTransactionData::GetCode() const { |
18 return code_; | 18 return code_; |
19 } | 19 } |
20 | 20 |
21 pid_t WritableTransactionData::GetSenderPID() const { | 21 pid_t WritableTransactionData::GetSenderPID() const { |
22 return 0; | 22 return 0; |
23 } | 23 } |
24 | 24 |
25 uid_t WritableTransactionData::GetSenderEUID() const { | 25 uid_t WritableTransactionData::GetSenderEUID() const { |
26 return 0; | 26 return 0; |
27 } | 27 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 | 60 |
61 void WritableTransactionData::WriteData(const void* data, size_t n) { | 61 void WritableTransactionData::WriteData(const void* data, size_t n) { |
62 data_.insert(data_.end(), static_cast<const char*>(data), | 62 data_.insert(data_.end(), static_cast<const char*>(data), |
63 static_cast<const char*>(data) + n); | 63 static_cast<const char*>(data) + n); |
64 if (n % 4 != 0) { // Add padding. | 64 if (n % 4 != 0) { // Add padding. |
65 data_.resize(data_.size() + 4 - (n % 4)); | 65 data_.resize(data_.size() + 4 - (n % 4)); |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 void WritableTransactionData::WriteInt32(int32 value) { | 69 void WritableTransactionData::WriteInt32(int32_t value) { |
70 // Binder is not used for inter-device communication, so no endian conversion. | 70 // Binder is not used for inter-device communication, so no endian conversion. |
71 // The same applies to other Write() methods. | 71 // The same applies to other Write() methods. |
72 WriteData(&value, sizeof(value)); | 72 WriteData(&value, sizeof(value)); |
73 } | 73 } |
74 | 74 |
75 void WritableTransactionData::WriteUint32(uint32 value) { | 75 void WritableTransactionData::WriteUint32(uint32_t value) { |
76 WriteData(&value, sizeof(value)); | 76 WriteData(&value, sizeof(value)); |
77 } | 77 } |
78 | 78 |
79 void WritableTransactionData::WriteInt64(int64 value) { | 79 void WritableTransactionData::WriteInt64(int64_t value) { |
80 WriteData(&value, sizeof(value)); | 80 WriteData(&value, sizeof(value)); |
81 } | 81 } |
82 | 82 |
83 void WritableTransactionData::WriteUint64(uint64 value) { | 83 void WritableTransactionData::WriteUint64(uint64_t value) { |
84 WriteData(&value, sizeof(value)); | 84 WriteData(&value, sizeof(value)); |
85 } | 85 } |
86 | 86 |
87 void WritableTransactionData::WriteFloat(float value) { | 87 void WritableTransactionData::WriteFloat(float value) { |
88 WriteData(&value, sizeof(value)); | 88 WriteData(&value, sizeof(value)); |
89 } | 89 } |
90 | 90 |
91 void WritableTransactionData::WriteDouble(double value) { | 91 void WritableTransactionData::WriteDouble(double value) { |
92 WriteData(&value, sizeof(value)); | 92 WriteData(&value, sizeof(value)); |
93 } | 93 } |
94 | 94 |
95 } // namespace binder | 95 } // namespace binder |
OLD | NEW |