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

Side by Side Diff: device/hid/hid_connection_linux.cc

Issue 656583003: Fix type truncation warnings in HID code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile Created 6 years, 2 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
« no previous file with comments | « no previous file | device/hid/hid_connection_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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 "device/hid/hid_connection_linux.h" 5 #include "device/hid/hid_connection_linux.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <libudev.h> 9 #include <libudev.h>
10 #include <linux/hidraw.h> 10 #include <linux/hidraw.h>
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 104 }
105 callback.Run(true); 105 callback.Run(true);
106 } 106 }
107 } 107 }
108 108
109 void HidConnectionLinux::PlatformGetFeatureReport( 109 void HidConnectionLinux::PlatformGetFeatureReport(
110 uint8_t report_id, 110 uint8_t report_id,
111 const ReadCallback& callback) { 111 const ReadCallback& callback) {
112 // The first byte of the destination buffer is the report ID being requested 112 // The first byte of the destination buffer is the report ID being requested
113 // and is overwritten by the feature report. 113 // and is overwritten by the feature report.
114 DCHECK_GT(device_info().max_feature_report_size, 0); 114 DCHECK_GT(device_info().max_feature_report_size, 0u);
115 scoped_refptr<net::IOBufferWithSize> buffer( 115 scoped_refptr<net::IOBufferWithSize> buffer(
116 new net::IOBufferWithSize(device_info().max_feature_report_size + 1)); 116 new net::IOBufferWithSize(device_info().max_feature_report_size + 1));
117 buffer->data()[0] = report_id; 117 buffer->data()[0] = report_id;
118 118
119 int result = ioctl(device_file_.GetPlatformFile(), 119 int result = ioctl(device_file_.GetPlatformFile(),
120 HIDIOCGFEATURE(buffer->size()), 120 HIDIOCGFEATURE(buffer->size()),
121 buffer->data()); 121 buffer->data());
122 if (result < 0) { 122 if (result < 0) {
123 VPLOG(1) << "Failed to get feature report"; 123 VPLOG(1) << "Failed to get feature report";
124 callback.Run(false, NULL, 0); 124 callback.Run(false, NULL, 0);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 PendingHidReport report = pending_reports_.front(); 219 PendingHidReport report = pending_reports_.front();
220 220
221 pending_reports_.pop(); 221 pending_reports_.pop();
222 if (CompleteRead(report.buffer, report.size, read.callback)) { 222 if (CompleteRead(report.buffer, report.size, read.callback)) {
223 pending_reads_.pop(); 223 pending_reads_.pop();
224 } 224 }
225 } 225 }
226 } 226 }
227 227
228 } // namespace device 228 } // namespace device
OLDNEW
« no previous file with comments | « no previous file | device/hid/hid_connection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698