OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 if (std::string::npos == version_key_index) { | 47 if (std::string::npos == version_key_index) { |
48 return; | 48 return; |
49 } | 49 } |
50 size_t start_index = lsb_release.find_first_of('=', version_key_index); | 50 size_t start_index = lsb_release.find_first_of('=', version_key_index); |
51 start_index++; // Move past '='. | 51 start_index++; // Move past '='. |
52 size_t length = lsb_release.find_first_of('\n', start_index) - start_index; | 52 size_t length = lsb_release.find_first_of('\n', start_index) - start_index; |
53 std::string version = lsb_release.substr(start_index, length); | 53 std::string version = lsb_release.substr(start_index, length); |
54 StringTokenizer tokenizer(version, "."); | 54 StringTokenizer tokenizer(version, "."); |
55 for (int i = 0; i < 3 && tokenizer.GetNext(); i++) { | 55 for (int i = 0; i < 3 && tokenizer.GetNext(); i++) { |
56 if (0 == i) { | 56 if (0 == i) { |
57 StringToInt(tokenizer.token(), major_version); | 57 StringToInt(tokenizer.token_begin(), |
| 58 tokenizer.token_end(), |
| 59 major_version); |
58 *minor_version = *bugfix_version = 0; | 60 *minor_version = *bugfix_version = 0; |
59 } else if (1 == i) { | 61 } else if (1 == i) { |
60 StringToInt(tokenizer.token(), minor_version); | 62 StringToInt(tokenizer.token_begin(), |
| 63 tokenizer.token_end(), |
| 64 minor_version); |
61 } else { // 2 == i | 65 } else { // 2 == i |
62 StringToInt(tokenizer.token(), bugfix_version); | 66 StringToInt(tokenizer.token_begin(), |
| 67 tokenizer.token_end(), |
| 68 bugfix_version); |
63 } | 69 } |
64 } | 70 } |
65 } | 71 } |
66 | 72 |
67 } // namespace base | 73 } // namespace base |
OLD | NEW |