| 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/escape.h" | 5 #include "net/base/escape.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 if ((index + 2) >= escaped_text.size()) | 107 if ((index + 2) >= escaped_text.size()) |
| 108 return false; | 108 return false; |
| 109 if (escaped_text[index] != '%') | 109 if (escaped_text[index] != '%') |
| 110 return false; | 110 return false; |
| 111 const typename STR::value_type most_sig_digit( | 111 const typename STR::value_type most_sig_digit( |
| 112 static_cast<typename STR::value_type>(escaped_text[index + 1])); | 112 static_cast<typename STR::value_type>(escaped_text[index + 1])); |
| 113 const typename STR::value_type least_sig_digit( | 113 const typename STR::value_type least_sig_digit( |
| 114 static_cast<typename STR::value_type>(escaped_text[index + 2])); | 114 static_cast<typename STR::value_type>(escaped_text[index + 2])); |
| 115 if (IsHexDigit(most_sig_digit) && IsHexDigit(least_sig_digit)) { | 115 if (IsHexDigit(most_sig_digit) && IsHexDigit(least_sig_digit)) { |
| 116 *value = HexDigitToInt(most_sig_digit) * 16 + | 116 *value = HexDigitToInt(most_sig_digit) * 16 + |
| 117 HexDigitToInt(least_sig_digit); | 117 HexDigitToInt(least_sig_digit); |
| 118 return true; | 118 return true; |
| 119 } | 119 } |
| 120 return false; | 120 return false; |
| 121 } | 121 } |
| 122 | 122 |
| 123 // Unescapes |escaped_text| according to |rules|, returning the resulting | 123 // Unescapes |escaped_text| according to |rules|, returning the resulting |
| 124 // string. Fills in an |adjustments| parameter, if non-NULL, so it reflects | 124 // string. Fills in an |adjustments| parameter, if non-NULL, so it reflects |
| 125 // the alterations done to the string that are not one-character-to-one- | 125 // the alterations done to the string that are not one-character-to-one- |
| 126 // character. The resulting |adjustments| will always be sorted by increasing | 126 // character. The resulting |adjustments| will always be sorted by increasing |
| 127 // offset. | 127 // offset. |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 1, kEscapeToChars[i].replacement); | 402 1, kEscapeToChars[i].replacement); |
| 403 break; | 403 break; |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 } | 406 } |
| 407 } | 407 } |
| 408 return text; | 408 return text; |
| 409 } | 409 } |
| 410 | 410 |
| 411 } // namespace net | 411 } // namespace net |
| OLD | NEW |