| Index: net/tools/tld_cleanup/tld_cleanup_util.cc
|
| diff --git a/net/tools/tld_cleanup/tld_cleanup_util.cc b/net/tools/tld_cleanup/tld_cleanup_util.cc
|
| index 5a206e4c61afe0d7c0ebd2b2282ad00231d963ee..1635c77e27da0a9564ccfcddfbac2b24883a942e 100644
|
| --- a/net/tools/tld_cleanup/tld_cleanup_util.cc
|
| +++ b/net/tools/tld_cleanup/tld_cleanup_util.cc
|
| @@ -29,19 +29,20 @@ namespace tld_cleanup {
|
| // been created with write access.
|
| bool WriteRules(const RuleMap& rules, const base::FilePath& outfile) {
|
| std::string data;
|
| - data.append("%{\n"
|
| - "// Copyright 2012 The Chromium Authors. All rights reserved.\n"
|
| - "// Use of this source code is governed by a BSD-style license "
|
| - "that can be\n"
|
| - "// found in the LICENSE file.\n\n"
|
| - "// This file is generated by net/tools/tld_cleanup/.\n"
|
| - "// DO NOT MANUALLY EDIT!\n"
|
| - "%}\n"
|
| - "struct DomainRule {\n"
|
| - " int name_offset;\n"
|
| - " int type; // flags: 1: exception, 2: wildcard, 4: private\n"
|
| - "};\n"
|
| - "%%\n");
|
| + data.append(
|
| + "%{\n"
|
| + "// Copyright 2012 The Chromium Authors. All rights reserved.\n"
|
| + "// Use of this source code is governed by a BSD-style license "
|
| + "that can be\n"
|
| + "// found in the LICENSE file.\n\n"
|
| + "// This file is generated by net/tools/tld_cleanup/.\n"
|
| + "// DO NOT MANUALLY EDIT!\n"
|
| + "%}\n"
|
| + "struct DomainRule {\n"
|
| + " int name_offset;\n"
|
| + " int type; // flags: 1: exception, 2: wildcard, 4: private\n"
|
| + "};\n"
|
| + "%%\n");
|
|
|
| for (RuleMap::const_iterator i = rules.begin(); i != rules.end(); ++i) {
|
| data.append(i->first);
|
| @@ -61,9 +62,8 @@ bool WriteRules(const RuleMap& rules, const base::FilePath& outfile) {
|
|
|
| data.append("%%\n");
|
|
|
| - int written = base::WriteFile(outfile,
|
| - data.data(),
|
| - static_cast<int>(data.size()));
|
| + int written =
|
| + base::WriteFile(outfile, data.data(), static_cast<int>(data.size()));
|
|
|
| return written == static_cast<int>(data.size());
|
| }
|
| @@ -129,8 +129,7 @@ NormalizeResult NormalizeRule(std::string* domain, Rule* rule) {
|
| return result;
|
| }
|
|
|
| -NormalizeResult NormalizeDataToRuleMap(const std::string data,
|
| - RuleMap* rules) {
|
| +NormalizeResult NormalizeDataToRuleMap(const std::string data, RuleMap* rules) {
|
| CHECK(rules);
|
| // We do a lot of string assignment during parsing, but simplicity is more
|
| // important than performance here.
|
| @@ -144,18 +143,17 @@ NormalizeResult NormalizeDataToRuleMap(const std::string data,
|
| int end_private_length = arraysize(kEndPrivateDomainsComment) - 1;
|
| while (line_start < data.size()) {
|
| if (line_start + begin_private_length < data.size() &&
|
| - !data.compare(line_start, begin_private_length,
|
| - kBeginPrivateDomainsComment)) {
|
| + !data.compare(
|
| + line_start, begin_private_length, kBeginPrivateDomainsComment)) {
|
| is_private = true;
|
| line_end = line_start + begin_private_length;
|
| } else if (line_start + end_private_length < data.size() &&
|
| - !data.compare(line_start, end_private_length,
|
| - kEndPrivateDomainsComment)) {
|
| + !data.compare(
|
| + line_start, end_private_length, kEndPrivateDomainsComment)) {
|
| is_private = false;
|
| line_end = line_start + end_private_length;
|
| - } else if (line_start + 1 < data.size() &&
|
| - data[line_start] == '/' &&
|
| - data[line_start + 1] == '/') {
|
| + } else if (line_start + 1 < data.size() && data[line_start] == '/' &&
|
| + data[line_start + 1] == '/') {
|
| // Skip comments.
|
| line_end = data.find_first_of("\r\n", line_start);
|
| if (line_end == std::string::npos)
|
| @@ -250,6 +248,5 @@ NormalizeResult NormalizeFile(const base::FilePath& in_filename,
|
| return result;
|
| }
|
|
|
| -
|
| } // namespace tld_cleanup
|
| } // namespace net
|
|
|