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

Side by Side Diff: device/bluetooth/bluetooth_uuid.cc

Issue 286993002: [Bluetooth] Use base::ToLowerASCII() rather than tolower(), as the later is locale-sensitive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/bluetooth/bluetooth_uuid.h" 5 #include "device/bluetooth/bluetooth_uuid.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 10
(...skipping 24 matching lines...) Expand all
35 if (!(uuid.size() == 4 || uuid.size() == 8 || uuid.size() == 36)) 35 if (!(uuid.size() == 4 || uuid.size() == 8 || uuid.size() == 36))
36 return; 36 return;
37 37
38 for (size_t i = 0; i < uuid.size(); ++i) { 38 for (size_t i = 0; i < uuid.size(); ++i) {
39 if (i == 8 || i == 13 || i == 18 || i == 23) { 39 if (i == 8 || i == 13 || i == 18 || i == 23) {
40 if (uuid[i] != '-') 40 if (uuid[i] != '-')
41 return; 41 return;
42 } else { 42 } else {
43 if (!IsHexDigit(uuid[i])) 43 if (!IsHexDigit(uuid[i]))
44 return; 44 return;
45 uuid[i] = tolower(uuid[i]); 45 uuid[i] = base::ToLowerASCII(uuid[i]);
46 } 46 }
47 } 47 }
48 48
49 canonical->assign(uuid); 49 canonical->assign(uuid);
50 if (uuid.size() == 4) { 50 if (uuid.size() == 4) {
51 canonical_128->assign(kCommonUuidPrefix + uuid + kCommonUuidPostfix); 51 canonical_128->assign(kCommonUuidPrefix + uuid + kCommonUuidPostfix);
52 *format = BluetoothUUID::kFormat16Bit; 52 *format = BluetoothUUID::kFormat16Bit;
53 } else if (uuid.size() == 8) { 53 } else if (uuid.size() == 8) {
54 canonical_128->assign(uuid + kCommonUuidPostfix); 54 canonical_128->assign(uuid + kCommonUuidPostfix);
55 *format = BluetoothUUID::kFormat32Bit; 55 *format = BluetoothUUID::kFormat32Bit;
(...skipping 30 matching lines...) Expand all
86 86
87 bool BluetoothUUID::operator!=(const BluetoothUUID& uuid) const { 87 bool BluetoothUUID::operator!=(const BluetoothUUID& uuid) const {
88 return canonical_value_ != uuid.canonical_value_; 88 return canonical_value_ != uuid.canonical_value_;
89 } 89 }
90 90
91 void PrintTo(const BluetoothUUID& uuid, std::ostream* out) { 91 void PrintTo(const BluetoothUUID& uuid, std::ostream* out) {
92 *out << uuid.canonical_value(); 92 *out << uuid.canonical_value();
93 } 93 }
94 94
95 } // namespace device 95 } // namespace device
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698