OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ppapi/shared_impl/private/ppb_char_set_shared.h" | 5 #include "ppapi/shared_impl/private/ppb_char_set_shared.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/icu_string_conversions.h" | 9 #include "base/i18n/icu_string_conversions.h" |
10 #include "ppapi/c/dev/ppb_memory_dev.h" | 10 #include "ppapi/c/dev/ppb_memory_dev.h" |
11 #include "ppapi/thunk/thunk.h" | 11 #include "ppapi/thunk/thunk.h" |
12 #include "unicode/ucnv.h" | 12 #include "third_party/icu/public/common/unicode/ucnv.h" |
13 #include "unicode/ucnv_cb.h" | 13 #include "third_party/icu/public/common/unicode/ucnv_cb.h" |
14 #include "unicode/ucnv_err.h" | 14 #include "third_party/icu/public/common/unicode/ucnv_err.h" |
15 #include "unicode/ustring.h" | 15 #include "third_party/icu/public/common/unicode/ustring.h" |
16 | 16 |
17 namespace ppapi { | 17 namespace ppapi { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 PP_CharSet_Trusted_ConversionError DeprecatedToConversionError( | 21 PP_CharSet_Trusted_ConversionError DeprecatedToConversionError( |
22 PP_CharSet_ConversionError on_error) { | 22 PP_CharSet_ConversionError on_error) { |
23 switch (on_error) { | 23 switch (on_error) { |
24 case PP_CHARSET_CONVERSIONERROR_SKIP: | 24 case PP_CHARSET_CONVERSIONERROR_SKIP: |
25 return PP_CHARSET_TRUSTED_CONVERSIONERROR_SKIP; | 25 return PP_CHARSET_TRUSTED_CONVERSIONERROR_SKIP; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 if (output_buffer) { | 230 if (output_buffer) { |
231 memcpy(output_buffer, output.c_str(), | 231 memcpy(output_buffer, output.c_str(), |
232 std::min(*output_utf16_length, static_cast<uint32_t>(output.size())) | 232 std::min(*output_utf16_length, static_cast<uint32_t>(output.size())) |
233 * sizeof(uint16_t)); | 233 * sizeof(uint16_t)); |
234 } | 234 } |
235 *output_utf16_length = static_cast<uint32_t>(output.size()); | 235 *output_utf16_length = static_cast<uint32_t>(output.size()); |
236 return PP_TRUE; | 236 return PP_TRUE; |
237 } | 237 } |
238 | 238 |
239 } // namespace ppapi | 239 } // namespace ppapi |
OLD | NEW |