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

Side by Side Diff: ui/events/ozone/evdev/event_device_test_util.cc

Issue 1272823003: Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ui/events/ozone/evdev/event_device_test_util.h" 5 #include "ui/events/ozone/evdev/event_device_test_util.h"
6 6
7 #include "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 25 matching lines...) Expand all
36 36
37 if (ret.length() == 0) 37 if (ret.length() == 0)
38 ret = "0"; 38 ret = "0";
39 39
40 return ret; 40 return ret;
41 } 41 }
42 42
43 bool ParseBitfield(const std::string& bitfield, 43 bool ParseBitfield(const std::string& bitfield,
44 size_t max_bits, 44 size_t max_bits,
45 std::vector<unsigned long>* out) { 45 std::vector<unsigned long>* out) {
46 std::vector<std::string> groups; 46 std::vector<std::string> groups = base::SplitString(
47 base::SplitString(bitfield, ' ', &groups); 47 bitfield, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
48 48
49 out->resize(EVDEV_BITS_TO_LONGS(max_bits)); 49 out->resize(EVDEV_BITS_TO_LONGS(max_bits));
50 50
51 // Convert big endian 64-bit groups to little endian EVDEV_LONG_BIT groups. 51 // Convert big endian 64-bit groups to little endian EVDEV_LONG_BIT groups.
52 for (unsigned int i = 0; i < groups.size(); ++i) { 52 for (size_t i = 0; i < groups.size(); ++i) {
53 int off = groups.size() - 1 - i; 53 int off = groups.size() - 1 - i;
54 54
55 uint64_t val; 55 uint64_t val;
56 if (!base::HexStringToUInt64(groups[off], &val)) 56 if (!base::HexStringToUInt64(groups[off], &val))
57 return false; 57 return false;
58 58
59 for (int j = 0; j < kTestDataWordSize; ++j) { 59 for (int j = 0; j < kTestDataWordSize; ++j) {
60 unsigned int code = i * kTestDataWordSize + j; 60 unsigned int code = i * kTestDataWordSize + j;
61 61
62 if (code >= max_bits) 62 if (code >= max_bits)
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 } 492 }
493 493
494 int bustype = 0; 494 int bustype = 0;
495 sscanf(capabilities.bustype, "%x", &bustype); 495 sscanf(capabilities.bustype, "%x", &bustype);
496 devinfo->SetDeviceType(InputDeviceTypeFromBusType(bustype)); 496 devinfo->SetDeviceType(InputDeviceTypeFromBusType(bustype));
497 497
498 return true; 498 return true;
499 } 499 }
500 500
501 } // namespace ui 501 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/devices/x11/touch_factory_x11.cc ('k') | ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698