OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project 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 // limitations under the License. | 4 // limitations under the License. |
5 | 5 |
6 #include "src/i18n.h" | 6 #include "src/i18n.h" |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/api.h" | 10 #include "src/api.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 number_format = static_cast<icu::DecimalFormat*>( | 264 number_format = static_cast<icu::DecimalFormat*>( |
265 icu::NumberFormat::createInstance(icu_locale, format_style, status)); | 265 icu::NumberFormat::createInstance(icu_locale, format_style, status)); |
266 | 266 |
267 if (U_FAILURE(status)) { | 267 if (U_FAILURE(status)) { |
268 delete number_format; | 268 delete number_format; |
269 return NULL; | 269 return NULL; |
270 } | 270 } |
271 | 271 |
272 UErrorCode status_digits = U_ZERO_ERROR; | 272 UErrorCode status_digits = U_ZERO_ERROR; |
273 uint32_t fraction_digits = ucurr_getDefaultFractionDigits( | 273 uint32_t fraction_digits = ucurr_getDefaultFractionDigits( |
274 currency.getTerminatedBuffer(), &status_digits); | 274 reinterpret_cast<const UChar*>(currency.getTerminatedBuffer()), |
| 275 &status_digits); |
275 if (U_SUCCESS(status_digits)) { | 276 if (U_SUCCESS(status_digits)) { |
276 number_format->setMinimumFractionDigits(fraction_digits); | 277 number_format->setMinimumFractionDigits(fraction_digits); |
277 number_format->setMaximumFractionDigits(fraction_digits); | 278 number_format->setMaximumFractionDigits(fraction_digits); |
278 } else { | 279 } else { |
279 // Set min & max to default values (previously in i18n.js) | 280 // Set min & max to default values (previously in i18n.js) |
280 number_format->setMinimumFractionDigits(0); | 281 number_format->setMinimumFractionDigits(0); |
281 number_format->setMaximumFractionDigits(3); | 282 number_format->setMaximumFractionDigits(3); |
282 } | 283 } |
283 } else if (style == UNICODE_STRING_SIMPLE("percent")) { | 284 } else if (style == UNICODE_STRING_SIMPLE("percent")) { |
284 number_format = static_cast<icu::DecimalFormat*>( | 285 number_format = static_cast<icu::DecimalFormat*>( |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 | 895 |
895 void V8BreakIterator::DeleteBreakIterator( | 896 void V8BreakIterator::DeleteBreakIterator( |
896 const v8::WeakCallbackInfo<void>& data) { | 897 const v8::WeakCallbackInfo<void>& data) { |
897 delete reinterpret_cast<icu::BreakIterator*>(data.GetInternalField(0)); | 898 delete reinterpret_cast<icu::BreakIterator*>(data.GetInternalField(0)); |
898 delete reinterpret_cast<icu::UnicodeString*>(data.GetInternalField(1)); | 899 delete reinterpret_cast<icu::UnicodeString*>(data.GetInternalField(1)); |
899 GlobalHandles::Destroy(reinterpret_cast<Object**>(data.GetParameter())); | 900 GlobalHandles::Destroy(reinterpret_cast<Object**>(data.GetParameter())); |
900 } | 901 } |
901 | 902 |
902 } // namespace internal | 903 } // namespace internal |
903 } // namespace v8 | 904 } // namespace v8 |
OLD | NEW |