| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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_report_descriptor.h" | 5 #include "device/hid/hid_report_descriptor.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 | 8 |
| 9 namespace device { | 9 namespace device { |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 const int kBitsPerByte = 8; | 13 const int kBitsPerByte = 8; |
| 14 | 14 |
| 15 } // namespace | 15 } // namespace |
| 16 | 16 |
| 17 HidReportDescriptor::HidReportDescriptor(const std::vector<uint8>& bytes) { | 17 HidReportDescriptor::HidReportDescriptor(const std::vector<uint8_t>& bytes) { |
| 18 size_t header_index = 0; | 18 size_t header_index = 0; |
| 19 HidReportDescriptorItem* item = NULL; | 19 HidReportDescriptorItem* item = NULL; |
| 20 while (header_index < bytes.size()) { | 20 while (header_index < bytes.size()) { |
| 21 item = new HidReportDescriptorItem(&bytes[header_index], item); | 21 item = new HidReportDescriptorItem(&bytes[header_index], item); |
| 22 items_.push_back(linked_ptr<HidReportDescriptorItem>(item)); | 22 items_.push_back(linked_ptr<HidReportDescriptorItem>(item)); |
| 23 header_index += item->GetSize(); | 23 header_index += item->GetSize(); |
| 24 } | 24 } |
| 25 } | 25 } |
| 26 | 26 |
| 27 HidReportDescriptor::~HidReportDescriptor() {} | 27 HidReportDescriptor::~HidReportDescriptor() {} |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 *max_feature_report_size = | 150 *max_feature_report_size = |
| 151 std::max(*max_feature_report_size, current_feature_report_size); | 151 std::max(*max_feature_report_size, current_feature_report_size); |
| 152 | 152 |
| 153 // Convert bits into bytes | 153 // Convert bits into bytes |
| 154 *max_input_report_size /= kBitsPerByte; | 154 *max_input_report_size /= kBitsPerByte; |
| 155 *max_output_report_size /= kBitsPerByte; | 155 *max_output_report_size /= kBitsPerByte; |
| 156 *max_feature_report_size /= kBitsPerByte; | 156 *max_feature_report_size /= kBitsPerByte; |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace device | 159 } // namespace device |
| OLD | NEW |