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

Side by Side Diff: chromeos/accelerometer/accelerometer_reader.cc

Issue 1719983005: base: Stop overloading ReadFileToString() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix errors Created 4 years, 10 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 "chromeos/accelerometer/accelerometer_reader.h" 5 #include "chromeos/accelerometer/accelerometer_reader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 const int kNumberOfAxes = 3; 84 const int kNumberOfAxes = 3;
85 85
86 // The size of data in one reading of the accelerometers. 86 // The size of data in one reading of the accelerometers.
87 const int kSizeOfReading = kDataSize * kNumberOfAxes; 87 const int kSizeOfReading = kDataSize * kNumberOfAxes;
88 88
89 // Reads |path| to the unsigned int pointed to by |value|. Returns true on 89 // Reads |path| to the unsigned int pointed to by |value|. Returns true on
90 // success or false on failure. 90 // success or false on failure.
91 bool ReadFileToInt(const base::FilePath& path, int* value) { 91 bool ReadFileToInt(const base::FilePath& path, int* value) {
92 std::string s; 92 std::string s;
93 DCHECK(value); 93 DCHECK(value);
94 if (!base::ReadFileToString(path, &s, kMaxAsciiUintLength)) { 94 if (!base::ReadFileToStringWithMaxSize(path, &s, kMaxAsciiUintLength)) {
95 return false; 95 return false;
96 } 96 }
97 base::TrimWhitespaceASCII(s, base::TRIM_ALL, &s); 97 base::TrimWhitespaceASCII(s, base::TRIM_ALL, &s);
98 if (!base::StringToInt(s, value)) { 98 if (!base::StringToInt(s, value)) {
99 LOG(ERROR) << "Failed to parse int \"" << s << "\" from " << path.value(); 99 LOG(ERROR) << "Failed to parse int \"" << s << "\" from " << path.value();
100 return false; 100 return false;
101 } 101 }
102 return true; 102 return true;
103 } 103 }
104 104
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 } 501 }
502 502
503 AccelerometerReader::AccelerometerReader() 503 AccelerometerReader::AccelerometerReader()
504 : accelerometer_file_reader_(new AccelerometerFileReader()) { 504 : accelerometer_file_reader_(new AccelerometerFileReader()) {
505 } 505 }
506 506
507 AccelerometerReader::~AccelerometerReader() { 507 AccelerometerReader::~AccelerometerReader() {
508 } 508 }
509 509
510 } // namespace chromeos 510 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/test/ppapi/ppapi_filechooser_browsertest.cc ('k') | components/policy/core/common/cloud/user_cloud_policy_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698