Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: chromeos/binder/transaction_data_reader.cc

Issue 1995983002: Fix "unused variable" warnings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/transaction_data_reader.h" 5 #include "chromeos/binder/transaction_data_reader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "chromeos/binder/binder_driver_api.h" 11 #include "chromeos/binder/binder_driver_api.h"
12 #include "chromeos/binder/local_object.h" 12 #include "chromeos/binder/local_object.h"
13 #include "chromeos/binder/object.h" 13 #include "chromeos/binder/object.h"
14 #include "chromeos/binder/remote_object.h" 14 #include "chromeos/binder/remote_object.h"
15 #include "chromeos/binder/transaction_data.h" 15 #include "chromeos/binder/transaction_data.h"
16 16
17 namespace binder { 17 namespace binder {
18 18
19 namespace { 19 namespace {
20 20
21 // Adds appropriate padding to the given size to make it 4-byte aligned. 21 // Adds appropriate padding to the given size to make it 4-byte aligned.
22 size_t AddPadding(size_t n) { 22 size_t AddPadding(size_t n) {
23 return (n + 3) & (~3); 23 return (n + 3) & (~3);
24 } 24 }
25 25
26 } // namespace 26 } // namespace
27 27
28 TransactionDataReader::TransactionDataReader(const TransactionData& data) 28 TransactionDataReader::TransactionDataReader(const TransactionData& data)
29 : data_(data), 29 : reader_(reinterpret_cast<const char*>(data.GetData()),
30 reader_(reinterpret_cast<const char*>(data.GetData()),
31 data.GetDataSize()) {} 30 data.GetDataSize()) {}
32 31
33 TransactionDataReader::~TransactionDataReader() {} 32 TransactionDataReader::~TransactionDataReader() {}
34 33
35 bool TransactionDataReader::HasMoreData() const { 34 bool TransactionDataReader::HasMoreData() const {
36 return reader_.HasMoreData(); 35 return reader_.HasMoreData();
37 } 36 }
38 37
39 bool TransactionDataReader::ReadData(void* buf, size_t n) { 38 bool TransactionDataReader::ReadData(void* buf, size_t n) {
40 DCHECK(buf); 39 DCHECK(buf);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 bool TransactionDataReader::ReadFileDescriptor(int* fd) { 130 bool TransactionDataReader::ReadFileDescriptor(int* fd) {
132 flat_binder_object obj = {}; 131 flat_binder_object obj = {};
133 if (!ReadData(&obj, sizeof(obj)) || obj.type != BINDER_TYPE_FD) { 132 if (!ReadData(&obj, sizeof(obj)) || obj.type != BINDER_TYPE_FD) {
134 return false; 133 return false;
135 } 134 }
136 *fd = obj.handle; 135 *fd = obj.handle;
137 return true; 136 return true;
138 } 137 }
139 138
140 } // namespace binder 139 } // namespace binder
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698