| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/base/net_util.h" | 5 #include "net/base/net_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 size_t length = filename->size(); | 766 size_t length = filename->size(); |
| 767 size_t pos = filename->find_last_not_of(FILE_PATH_LITERAL(" .")); | 767 size_t pos = filename->find_last_not_of(FILE_PATH_LITERAL(" .")); |
| 768 filename->resize((pos == std::string::npos) ? 0 : (pos + 1)); | 768 filename->resize((pos == std::string::npos) ? 0 : (pos + 1)); |
| 769 TrimWhitespace(*filename, TRIM_TRAILING, filename); | 769 TrimWhitespace(*filename, TRIM_TRAILING, filename); |
| 770 if (filename->empty()) | 770 if (filename->empty()) |
| 771 return; | 771 return; |
| 772 size_t trimmed = length - filename->size(); | 772 size_t trimmed = length - filename->size(); |
| 773 if (trimmed) | 773 if (trimmed) |
| 774 filename->insert(filename->end(), trimmed, kReplace[0]); | 774 filename->insert(filename->end(), trimmed, kReplace[0]); |
| 775 } | 775 } |
| 776 TrimString(*filename, FILE_PATH_LITERAL("."), filename); | 776 base::TrimString(*filename, FILE_PATH_LITERAL("."), filename); |
| 777 if (filename->empty()) | 777 if (filename->empty()) |
| 778 return; | 778 return; |
| 779 // Replace any path information by changing path separators. | 779 // Replace any path information by changing path separators. |
| 780 ReplaceSubstringsAfterOffset(filename, 0, FILE_PATH_LITERAL("/"), kReplace); | 780 ReplaceSubstringsAfterOffset(filename, 0, FILE_PATH_LITERAL("/"), kReplace); |
| 781 ReplaceSubstringsAfterOffset(filename, 0, FILE_PATH_LITERAL("\\"), kReplace); | 781 ReplaceSubstringsAfterOffset(filename, 0, FILE_PATH_LITERAL("\\"), kReplace); |
| 782 } | 782 } |
| 783 | 783 |
| 784 // Returns the filename determined from the last component of the path portion | 784 // Returns the filename determined from the last component of the path portion |
| 785 // of the URL. Returns an empty string if the URL doesn't have a path or is | 785 // of the URL. Returns an empty string if the URL doesn't have a path or is |
| 786 // invalid. If the generated filename is not reliable, | 786 // invalid. If the generated filename is not reliable, |
| (...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2210 } | 2210 } |
| 2211 return a1.size() * CHAR_BIT; | 2211 return a1.size() * CHAR_BIT; |
| 2212 } | 2212 } |
| 2213 | 2213 |
| 2214 unsigned MaskPrefixLength(const IPAddressNumber& mask) { | 2214 unsigned MaskPrefixLength(const IPAddressNumber& mask) { |
| 2215 IPAddressNumber all_ones(mask.size(), 0xFF); | 2215 IPAddressNumber all_ones(mask.size(), 0xFF); |
| 2216 return CommonPrefixLength(mask, all_ones); | 2216 return CommonPrefixLength(mask, all_ones); |
| 2217 } | 2217 } |
| 2218 | 2218 |
| 2219 } // namespace net | 2219 } // namespace net |
| OLD | NEW |