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

Unified Diff: src/inspector/search-util.cc

Issue 2332163002: [inspector] fixed all shorten-64-to-32 warnings (Closed)
Patch Set: rebased Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/inspector/injected-script.cc ('k') | src/inspector/string-16.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/search-util.cc
diff --git a/src/inspector/search-util.cc b/src/inspector/search-util.cc
index 04afd4d75e1c96a349214a5d5f6cb579c7ab25e9..a6fba06c115b724f3c74cb00a2df80ac2a4d7d3f 100644
--- a/src/inspector/search-util.cc
+++ b/src/inspector/search-util.cc
@@ -16,8 +16,8 @@ namespace {
String16 findMagicComment(const String16& content, const String16& name,
bool multiline) {
DCHECK(name.find("=") == String16::kNotFound);
- unsigned length = content.length();
- unsigned nameLength = name.length();
+ size_t length = content.length();
+ size_t nameLength = name.length();
size_t pos = length;
size_t equalSignPos = 0;
@@ -56,7 +56,7 @@ String16 findMagicComment(const String16& content, const String16& name,
if (newLine != String16::kNotFound) match = match.substring(0, newLine);
match = match.stripWhiteSpace();
- for (unsigned i = 0; i < match.length(); ++i) {
+ for (size_t i = 0; i < match.length(); ++i) {
UChar c = match[i];
if (c == '"' || c == '\'' || c == ' ' || c == '\t') return "";
}
@@ -67,7 +67,7 @@ String16 findMagicComment(const String16& content, const String16& name,
String16 createSearchRegexSource(const String16& text) {
String16Builder result;
- for (unsigned i = 0; i < text.length(); i++) {
+ for (size_t i = 0; i < text.length(); i++) {
UChar c = text[i];
if (c == '[' || c == ']' || c == '(' || c == ')' || c == '{' || c == '}' ||
c == '+' || c == '-' || c == '*' || c == '.' || c == ',' || c == '?' ||
@@ -80,19 +80,19 @@ String16 createSearchRegexSource(const String16& text) {
return result.toString();
}
-std::unique_ptr<std::vector<unsigned>> lineEndings(const String16& text) {
- std::unique_ptr<std::vector<unsigned>> result(new std::vector<unsigned>());
+std::unique_ptr<std::vector<size_t>> lineEndings(const String16& text) {
+ std::unique_ptr<std::vector<size_t>> result(new std::vector<size_t>());
const String16 lineEndString = "\n";
- unsigned start = 0;
+ size_t start = 0;
while (start < text.length()) {
size_t lineEnd = text.find(lineEndString, start);
if (lineEnd == String16::kNotFound) break;
- result->push_back(static_cast<unsigned>(lineEnd));
+ result->push_back(lineEnd);
start = lineEnd + 1;
}
- result->push_back(static_cast<unsigned>(text.length()));
+ result->push_back(text.length());
return result;
}
@@ -102,11 +102,11 @@ std::vector<std::pair<int, String16>> scriptRegexpMatchesByLines(
std::vector<std::pair<int, String16>> result;
if (text.isEmpty()) return result;
- std::unique_ptr<std::vector<unsigned>> endings(lineEndings(text));
- unsigned size = endings->size();
- unsigned start = 0;
- for (unsigned lineNumber = 0; lineNumber < size; ++lineNumber) {
- unsigned lineEnd = endings->at(lineNumber);
+ std::unique_ptr<std::vector<size_t>> endings(lineEndings(text));
+ size_t size = endings->size();
+ size_t start = 0;
+ for (size_t lineNumber = 0; lineNumber < size; ++lineNumber) {
+ size_t lineEnd = endings->at(lineNumber);
String16 line = text.substring(start, lineEnd - start);
if (line.length() && line[line.length() - 1] == '\r')
line = line.substring(0, line.length() - 1);
« no previous file with comments | « src/inspector/injected-script.cc ('k') | src/inspector/string-16.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698