| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 // Returns the canonicalized version of the input character according to scheme | 137 // Returns the canonicalized version of the input character according to scheme |
| 138 // rules. This is implemented alongside the scheme canonicalizer, and is | 138 // rules. This is implemented alongside the scheme canonicalizer, and is |
| 139 // required for relative URL resolving to test for scheme equality. | 139 // required for relative URL resolving to test for scheme equality. |
| 140 // | 140 // |
| 141 // Returns 0 if the input character is not a valid scheme character. | 141 // Returns 0 if the input character is not a valid scheme character. |
| 142 char CanonicalSchemeChar(char16 ch); | 142 char CanonicalSchemeChar(char16 ch); |
| 143 | 143 |
| 144 // Write a single character, escaped, to the output. This always escapes: it | 144 // Write a single character, escaped, to the output. This always escapes: it |
| 145 // does no checking that thee character requires escaping. | 145 // does no checking that thee character requires escaping. |
| 146 inline void AppendEscapedChar(unsigned char ch, | 146 // Escaping makes sense only 8 bit chars, so code works in all cases of |
| 147 CanonOutput* output) { | 147 // input parameters (8/16bit). |
| 148 template<typename UINCHAR, typename OUTCHAR> |
| 149 inline void AppendEscapedChar(UINCHAR ch, |
| 150 CanonOutputT<OUTCHAR>* output) { |
| 148 output->push_back('%'); | 151 output->push_back('%'); |
| 149 output->push_back(kHexCharLookup[ch >> 4]); | 152 output->push_back(kHexCharLookup[ch >> 4]); |
| 150 output->push_back(kHexCharLookup[ch & 0xf]); | 153 output->push_back(kHexCharLookup[ch & 0xf]); |
| 151 } | 154 } |
| 152 | 155 |
| 153 // The character we'll substitute for undecodable or invalid characters. | 156 // The character we'll substitute for undecodable or invalid characters. |
| 154 extern const char16 kUnicodeReplacementCharacter; | 157 extern const char16 kUnicodeReplacementCharacter; |
| 155 | 158 |
| 156 // UTF-8 functions ------------------------------------------------------------ | 159 // UTF-8 functions ------------------------------------------------------------ |
| 157 | 160 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 inline unsigned long long _strtoui64(const char* nptr, | 452 inline unsigned long long _strtoui64(const char* nptr, |
| 450 char** endptr, int base) { | 453 char** endptr, int base) { |
| 451 return strtoull(nptr, endptr, base); | 454 return strtoull(nptr, endptr, base); |
| 452 } | 455 } |
| 453 | 456 |
| 454 #endif // WIN32 | 457 #endif // WIN32 |
| 455 | 458 |
| 456 } // namespace url_canon | 459 } // namespace url_canon |
| 457 | 460 |
| 458 #endif // GOOGLEURL_SRC_URL_CANON_INTERNAL_H__ | 461 #endif // GOOGLEURL_SRC_URL_CANON_INTERNAL_H__ |
| OLD | NEW |