OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/utf_offset_string_conversions.h" | 5 #include "base/utf_offset_string_conversions.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
11 #include "base/utf_string_conversion_utils.h" | 11 #include "base/utf_string_conversion_utils.h" |
12 | 12 |
13 using base::PrepareForUTF16Or32Output; | 13 using base::PrepareForUTF16Or32Output; |
14 using base::ReadUnicodeCharacter; | 14 using base::ReadUnicodeCharacter; |
15 using base::WriteUnicodeCharacter; | 15 using base::WriteUnicodeCharacter; |
16 | 16 |
17 // Converts the given source Unicode character type to the given destination | 17 // Converts the given source Unicode character type to the given destination |
18 // Unicode character type as a STL string. The given input buffer and size | 18 // Unicode character type as a STL string. The given input buffer and size |
19 // determine the source, and the given output STL string will be replaced by | 19 // determine the source, and the given output STL string will be replaced by |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 if (*offset <= i->original_offset) | 135 if (*offset <= i->original_offset) |
136 break; | 136 break; |
137 if (*offset < (i->original_offset + i->original_length)) { | 137 if (*offset < (i->original_offset + i->original_length)) { |
138 *offset = string16::npos; | 138 *offset = string16::npos; |
139 return; | 139 return; |
140 } | 140 } |
141 adjustment += (i->original_length - i->output_length); | 141 adjustment += (i->original_length - i->output_length); |
142 } | 142 } |
143 *offset -= adjustment; | 143 *offset -= adjustment; |
144 } | 144 } |
OLD | NEW |