| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 // sucks, and we don't use the encoding properly, which will make some | 750 // sucks, and we don't use the encoding properly, which will make some |
| 751 // obscure anchor navigations fail. | 751 // obscure anchor navigations fail. |
| 752 CString cstr = str.utf8(); | 752 CString cstr = str.utf8(); |
| 753 | 753 |
| 754 const char* input = cstr.data(); | 754 const char* input = cstr.data(); |
| 755 int inputLength = cstr.length(); | 755 int inputLength = cstr.length(); |
| 756 url_canon::RawCanonOutputT<char> unescaped; | 756 url_canon::RawCanonOutputT<char> unescaped; |
| 757 for (int i = 0; i < inputLength; i++) { | 757 for (int i = 0; i < inputLength; i++) { |
| 758 if (input[i] == '%') { | 758 if (input[i] == '%') { |
| 759 unsigned char ch; | 759 unsigned char ch; |
| 760 if (url_canon::DecodeEscaped(input, &i, inputLength, &ch)) { | 760 if (url_canon::DecodeEscaped(input, &i, inputLength, &ch)) |
| 761 if (!ch) { | 761 unescaped.push_back(ch); |
| 762 // Never unescape NULLs. | 762 else { |
| 763 unescaped.push_back('%'); | |
| 764 unescaped.push_back('0'); | |
| 765 unescaped.push_back('0'); | |
| 766 } else | |
| 767 unescaped.push_back(ch); | |
| 768 } else { | |
| 769 // Invalid escape sequence, copy the percent literal. | 763 // Invalid escape sequence, copy the percent literal. |
| 770 unescaped.push_back('%'); | 764 unescaped.push_back('%'); |
| 771 } | 765 } |
| 772 } else { | 766 } else { |
| 773 // Regular non-escaped 8-bit character. | 767 // Regular non-escaped 8-bit character. |
| 774 unescaped.push_back(input[i]); | 768 unescaped.push_back(input[i]); |
| 775 } | 769 } |
| 776 } | 770 } |
| 777 | 771 |
| 778 // Convert that 8-bit to UTF-16. It's not clear IE does this at all to | 772 // Convert that 8-bit to UTF-16. It's not clear IE does this at all to |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 | 973 |
| 980 if (a.port() != b.port()) | 974 if (a.port() != b.port()) |
| 981 return false; | 975 return false; |
| 982 | 976 |
| 983 return true; | 977 return true; |
| 984 } | 978 } |
| 985 | 979 |
| 986 } // namespace WebCore | 980 } // namespace WebCore |
| 987 | 981 |
| 988 #endif // USE(GOOGLEURL) | 982 #endif // USE(GOOGLEURL) |
| OLD | NEW |