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

Side by Side Diff: chrome/browser/safe_browsing/chunk_range.cc

Issue 39206: NO CODE CHANGE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // Implementation of ChunkRange class. 5 // Implementation of ChunkRange class.
6 6
7 #include "chrome/browser/safe_browsing/chunk_range.h" 7 #include "chrome/browser/safe_browsing/chunk_range.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } else { 66 } else {
67 result->append(StringPrintf("%d-%d", it->start(), it->stop())); 67 result->append(StringPrintf("%d-%d", it->start(), it->stop()));
68 } 68 }
69 } 69 }
70 } 70 }
71 71
72 bool StringToRanges(const std::string& input, 72 bool StringToRanges(const std::string& input,
73 std::vector<ChunkRange>* ranges) { 73 std::vector<ChunkRange>* ranges) {
74 DCHECK(ranges); 74 DCHECK(ranges);
75 75
76 // Crack the string into chunk parts, then crack each part looking for a range . 76 // Crack the string into chunk parts, then crack each part looking for a
77 // range.
77 std::vector<std::string> chunk_parts; 78 std::vector<std::string> chunk_parts;
78 SplitString(input, ',', &chunk_parts); 79 SplitString(input, ',', &chunk_parts);
79 80
80 for (size_t i = 0; i < chunk_parts.size(); ++i) { 81 for (size_t i = 0; i < chunk_parts.size(); ++i) {
81 std::vector<std::string> chunk_ranges; 82 std::vector<std::string> chunk_ranges;
82 SplitString(chunk_parts[i], '-', &chunk_ranges); 83 SplitString(chunk_parts[i], '-', &chunk_ranges);
83 int start = atoi(chunk_ranges[0].c_str()); 84 int start = atoi(chunk_ranges[0].c_str());
84 int stop = start; 85 int stop = start;
85 if (chunk_ranges.size() == 2) 86 if (chunk_ranges.size() == 2)
86 stop = atoi(chunk_ranges[1].c_str()); 87 stop = atoi(chunk_ranges[1].c_str());
(...skipping 26 matching lines...) Expand all
113 // Adjust our mid point. 114 // Adjust our mid point.
114 if (chunk.stop() < chunk_number) 115 if (chunk.stop() < chunk_number)
115 low = mid + 1; 116 low = mid + 1;
116 else 117 else
117 high = mid - 1; 118 high = mid - 1;
118 } 119 }
119 120
120 return false; 121 return false;
121 } 122 }
122 123
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/resource_dispatcher_host.h ('k') | chrome/browser/safe_browsing/protocol_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698