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

Side by Side Diff: base/sys_info_chromeos.cc

Issue 8921006: Standardize StringToInt{,64} interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix call syntax of StringToInt() in Chrome OS code. Created 9 years 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
« no previous file with comments | « base/string_piece.h ('k') | chrome/browser/autocomplete_history_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/sys_info.h" 5 #include "base/sys_info.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
12 #include "base/string_piece.h"
12 #include "base/string_tokenizer.h" 13 #include "base/string_tokenizer.h"
13 #include "base/threading/thread_restrictions.h" 14 #include "base/threading/thread_restrictions.h"
14 15
15 #include <execinfo.h> 16 #include <execinfo.h>
16 17
17 namespace base { 18 namespace base {
18 19
19 static const char* kLinuxStandardBaseVersionKeys[] = { 20 static const char* kLinuxStandardBaseVersionKeys[] = {
20 "CHROMEOS_RELEASE_VERSION", 21 "CHROMEOS_RELEASE_VERSION",
21 "GOOGLE_RELEASE", 22 "GOOGLE_RELEASE",
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return; 90 return;
90 } 91 }
91 92
92 size_t start_index = lsb_release.find_first_of('=', version_key_index); 93 size_t start_index = lsb_release.find_first_of('=', version_key_index);
93 start_index++; // Move past '='. 94 start_index++; // Move past '='.
94 size_t length = lsb_release.find_first_of('\n', start_index) - start_index; 95 size_t length = lsb_release.find_first_of('\n', start_index) - start_index;
95 std::string version = lsb_release.substr(start_index, length); 96 std::string version = lsb_release.substr(start_index, length);
96 StringTokenizer tokenizer(version, "."); 97 StringTokenizer tokenizer(version, ".");
97 for (int i = 0; i < 3 && tokenizer.GetNext(); ++i) { 98 for (int i = 0; i < 3 && tokenizer.GetNext(); ++i) {
98 if (0 == i) { 99 if (0 == i) {
99 StringToInt(tokenizer.token_begin(), 100 StringToInt(StringPiece(tokenizer.token_begin(),
100 tokenizer.token_end(), 101 tokenizer.token_end()),
101 major_version); 102 major_version);
102 *minor_version = *bugfix_version = 0; 103 *minor_version = *bugfix_version = 0;
103 } else if (1 == i) { 104 } else if (1 == i) {
104 StringToInt(tokenizer.token_begin(), 105 StringToInt(StringPiece(tokenizer.token_begin(),
105 tokenizer.token_end(), 106 tokenizer.token_end()),
106 minor_version); 107 minor_version);
107 } else { // 2 == i 108 } else { // 2 == i
108 StringToInt(tokenizer.token_begin(), 109 StringToInt(StringPiece(tokenizer.token_begin(),
109 tokenizer.token_end(), 110 tokenizer.token_end()),
110 bugfix_version); 111 bugfix_version);
111 } 112 }
112 } 113 }
113 } 114 }
114 115
115 } // namespace base 116 } // namespace base
OLDNEW
« no previous file with comments | « base/string_piece.h ('k') | chrome/browser/autocomplete_history_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698