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

Side by Side Diff: webrtc/base/versionparsing.cc

Issue 2373003002: Delete unused file versionparsing.h. (Closed)
Patch Set: Rebased. Created 4 years, 2 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
« no previous file with comments | « webrtc/base/versionparsing.h ('k') | webrtc/base/versionparsing_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/base/versionparsing.h"
12
13 #include <stdlib.h>
14
15 namespace rtc {
16
17 bool ParseVersionString(const std::string& version_str,
18 int num_expected_segments,
19 int version[]) {
20 size_t pos = 0;
21 for (int i = 0;;) {
22 size_t dot_pos = version_str.find('.', pos);
23 size_t n;
24 if (dot_pos == std::string::npos) {
25 // npos here is a special value meaning "to the end of the string"
26 n = std::string::npos;
27 } else {
28 n = dot_pos - pos;
29 }
30
31 version[i] = atoi(version_str.substr(pos, n).c_str());
32
33 if (++i >= num_expected_segments) break;
34
35 if (dot_pos == std::string::npos) {
36 // Previous segment was not terminated by a dot, but there's supposed to
37 // be more segments, so that's an error.
38 return false;
39 }
40 pos = dot_pos + 1;
41 }
42 return true;
43 }
44
45 int CompareVersions(const int version1[],
46 const int version2[],
47 int num_segments) {
48 for (int i = 0; i < num_segments; ++i) {
49 int diff = version1[i] - version2[i];
50 if (diff != 0) {
51 return diff;
52 }
53 }
54 return 0;
55 }
56
57 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/versionparsing.h ('k') | webrtc/base/versionparsing_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698