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

Side by Side Diff: device/udev_linux/udev.cc

Issue 1200053004: Move more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/udev_linux/udev.h" 5 #include "device/udev_linux/udev.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "device/udev_linux/udev_loader.h" 8 #include "device/udev_linux/udev_loader.h"
9 9
10 namespace device { 10 namespace device {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 const char* key) { 164 const char* key) {
165 return StringOrEmptyIfNull(udev_device_get_sysattr_value(udev_device, key)); 165 return StringOrEmptyIfNull(udev_device_get_sysattr_value(udev_device, key));
166 } 166 }
167 167
168 std::string UdevDecodeString(const std::string& encoded) { 168 std::string UdevDecodeString(const std::string& encoded) {
169 std::string decoded; 169 std::string decoded;
170 const size_t size = encoded.size(); 170 const size_t size = encoded.size();
171 for (size_t i = 0; i < size; ++i) { 171 for (size_t i = 0; i < size; ++i) {
172 char c = encoded[i]; 172 char c = encoded[i];
173 if ((i + 3 < size) && c == '\\' && encoded[i + 1] == 'x') { 173 if ((i + 3 < size) && c == '\\' && encoded[i + 1] == 'x') {
174 c = (HexDigitToInt(encoded[i + 2]) << 4) + 174 c = (base::HexDigitToInt(encoded[i + 2]) << 4) +
175 HexDigitToInt(encoded[i + 3]); 175 base::HexDigitToInt(encoded[i + 3]);
176 i += 3; 176 i += 3;
177 } 177 }
178 decoded.push_back(c); 178 decoded.push_back(c);
179 } 179 }
180 return decoded; 180 return decoded;
181 } 181 }
182 182
183 } // namespace device 183 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_uuid.cc ('k') | extensions/browser/api/networking_config/networking_config_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698