| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <errno.h> | 5 #include <errno.h> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 | 7 |
| 8 #include <cstdio> | 8 #include <cstdio> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 if (override_source) { | 67 if (override_source) { |
| 68 *dest = override_source; | 68 *dest = override_source; |
| 69 *dest_component = override_component; | 69 *dest_component = override_component; |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 // Similar to DoOverrideComponent except that it takes a UTF-16 input and does | 73 // Similar to DoOverrideComponent except that it takes a UTF-16 input and does |
| 74 // not actually set the output character pointer. | 74 // not actually set the output character pointer. |
| 75 // | 75 // |
| 76 // The input is converted to UTF-8 at the end of the given buffer as a temporary | 76 // The input is converted to UTF-8 at the end of the given buffer as a temporary |
| 77 // holding place. The component indentifying the portion of the buffer used in | 77 // holding place. The component identifying the portion of the buffer used in |
| 78 // the |utf8_buffer| will be specified in |*dest_component|. | 78 // the |utf8_buffer| will be specified in |*dest_component|. |
| 79 // | 79 // |
| 80 // This will not actually set any |dest| pointer like DoOverrideComponent | 80 // This will not actually set any |dest| pointer like DoOverrideComponent |
| 81 // does because all of the pointers will point into the |utf8_buffer|, which | 81 // does because all of the pointers will point into the |utf8_buffer|, which |
| 82 // may get resized while we're overriding a subsequent component. Instead, the | 82 // may get resized while we're overriding a subsequent component. Instead, the |
| 83 // caller should use the beginning of the |utf8_buffer| as the string pointer | 83 // caller should use the beginning of the |utf8_buffer| as the string pointer |
| 84 // for all components once all overrides have been prepared. | 84 // for all components once all overrides have been prepared. |
| 85 bool PrepareUTF16OverrideComponent( | 85 bool PrepareUTF16OverrideComponent( |
| 86 const base::char16* override_source, | 86 const base::char16* override_source, |
| 87 const url_parse::Component& override_component, | 87 const url_parse::Component& override_component, |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 for (int i = 0; i < written; ++i) { | 396 for (int i = 0; i < written; ++i) { |
| 397 buffer[i] = static_cast<base::char16>(temp[i]); | 397 buffer[i] = static_cast<base::char16>(temp[i]); |
| 398 } | 398 } |
| 399 buffer[written] = '\0'; | 399 buffer[written] = '\0'; |
| 400 return 0; | 400 return 0; |
| 401 } | 401 } |
| 402 | 402 |
| 403 #endif // !WIN32 | 403 #endif // !WIN32 |
| 404 | 404 |
| 405 } // namespace url_canon | 405 } // namespace url_canon |
| OLD | NEW |