| OLD | NEW |
| 1 // Copyright 2007, Google Inc. | 1 // Copyright 2007, Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 0, 0 , 0, 0 ,
0, | 95 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 0, 0 , 0, 0 ,
0, |
| 96 // ` a b c d e f g h i j k l m n
o | 96 // ` a b c d e f g h i j k l m n
o |
| 97 0 , 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', '
o', | 97 0 , 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', '
o', |
| 98 // p q r s t u v w x y z { | } ~ | 98 // p q r s t u v w x y z { | } ~ |
| 99 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 0 , 0 , 0 , 0 ,
0 }; | 99 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 0 , 0 , 0 , 0 ,
0 }; |
| 100 | 100 |
| 101 // This could be a table lookup as well by setting the high bit for each | 101 // This could be a table lookup as well by setting the high bit for each |
| 102 // valid character, but it's only called once per URL, and it makes the lookup | 102 // valid character, but it's only called once per URL, and it makes the lookup |
| 103 // table easier to read not having extra stuff in it. | 103 // table easier to read not having extra stuff in it. |
| 104 inline bool IsSchemeFirstChar(unsigned char c) { | 104 inline bool IsSchemeFirstChar(unsigned char c) { |
| 105 return (c >= 'a' && c < 'z') || (c >= 'A' && c < 'Z'); | 105 return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); |
| 106 } | 106 } |
| 107 | 107 |
| 108 template<typename CHAR, typename UCHAR> | 108 template<typename CHAR, typename UCHAR> |
| 109 bool DoScheme(const CHAR* spec, | 109 bool DoScheme(const CHAR* spec, |
| 110 const url_parse::Component& scheme, | 110 const url_parse::Component& scheme, |
| 111 CanonOutput* output, | 111 CanonOutput* output, |
| 112 url_parse::Component* out_scheme) { | 112 url_parse::Component* out_scheme) { |
| 113 if (scheme.len <= 0) { | 113 if (scheme.len <= 0) { |
| 114 // Scheme is unspecified or empty, convert to empty by appending a colon. | 114 // Scheme is unspecified or empty, convert to empty by appending a colon. |
| 115 *out_scheme = url_parse::Component(output->length(), 0); | 115 *out_scheme = url_parse::Component(output->length(), 0); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 } | 382 } |
| 383 | 383 |
| 384 void CanonicalizeRef(const char16* spec, | 384 void CanonicalizeRef(const char16* spec, |
| 385 const url_parse::Component& ref, | 385 const url_parse::Component& ref, |
| 386 CanonOutput* output, | 386 CanonOutput* output, |
| 387 url_parse::Component* out_ref) { | 387 url_parse::Component* out_ref) { |
| 388 DoCanonicalizeRef<char16, char16>(spec, ref, output, out_ref); | 388 DoCanonicalizeRef<char16, char16>(spec, ref, output, out_ref); |
| 389 } | 389 } |
| 390 | 390 |
| 391 } // namespace url_canon | 391 } // namespace url_canon |
| OLD | NEW |