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

Side by Side Diff: device/serial/serial_device_enumerator_mac.cc

Issue 1542163002: Switch to standard integer types in device/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win Created 4 years, 12 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 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/serial/serial_device_enumerator_mac.h" 5 #include "device/serial/serial_device_enumerator_mac.h"
6 6
7 #include <IOKit/serial/IOSerialKeys.h> 7 #include <IOKit/serial/IOSerialKeys.h>
8 #include <IOKit/usb/IOUSBLib.h> 8 #include <IOKit/usb/IOUSBLib.h>
9 #include <stdint.h>
9 10
10 #include <algorithm> 11 #include <algorithm>
11 12
12 #include "base/files/file_enumerator.h" 13 #include "base/files/file_enumerator.h"
13 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
14 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
15 #include "base/mac/scoped_cftyperef.h" 16 #include "base/mac/scoped_cftyperef.h"
16 #include "base/mac/scoped_ioobject.h" 17 #include "base/mac/scoped_ioobject.h"
17 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
18 #include "base/metrics/sparse_histogram.h" 19 #include "base/metrics/sparse_histogram.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 mojo::String* value) { 66 mojo::String* value) {
66 CFStringRef propValue = GetCFStringProperty(service, key); 67 CFStringRef propValue = GetCFStringProperty(service, key);
67 if (propValue) { 68 if (propValue) {
68 *value = base::SysCFStringRefToUTF8(propValue); 69 *value = base::SysCFStringRefToUTF8(propValue);
69 return true; 70 return true;
70 } 71 }
71 72
72 return false; 73 return false;
73 } 74 }
74 75
75 // Searches the specified service for a uint16 property with the specified key, 76 // Searches the specified service for a uint16_t property with the specified
76 // sets value to that property's value, and returns whether the operation was 77 // key, sets value to that property's value, and returns whether the operation
77 // successful. 78 // was successful.
78 bool GetUInt16Property(io_service_t service, 79 bool GetUInt16Property(io_service_t service,
79 const CFStringRef key, 80 const CFStringRef key,
80 uint16_t* value) { 81 uint16_t* value) {
81 CFNumberRef propValue = GetCFNumberProperty(service, key); 82 CFNumberRef propValue = GetCFNumberProperty(service, key);
82 if (propValue) { 83 if (propValue) {
83 int intValue; 84 int intValue;
84 if (CFNumberGetValue(propValue, kCFNumberIntType, &intValue)) { 85 if (CFNumberGetValue(propValue, kCFNumberIntType, &intValue)) {
85 *value = static_cast<uint16_t>(intValue); 86 *value = static_cast<uint16_t>(intValue);
86 return true; 87 return true;
87 } 88 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 233 }
233 234
234 mojo::Array<mojo::String> paths; 235 mojo::Array<mojo::String> paths;
235 mojo::Array<serial::DeviceInfoPtr> devices; 236 mojo::Array<serial::DeviceInfoPtr> devices;
236 deviceMap.DecomposeMapTo(&paths, &devices); 237 deviceMap.DecomposeMapTo(&paths, &devices);
237 238
238 return devices.Pass(); 239 return devices.Pass();
239 } 240 }
240 241
241 } // namespace device 242 } // namespace device
OLDNEW
« no previous file with comments | « device/serial/serial_device_enumerator_mac.h ('k') | device/serial/serial_device_enumerator_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698