| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) | 4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All |
| 6 * rights reserved. | 6 * rights reserved. |
| 7 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 7 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 // function in ICU. | 643 // function in ICU. |
| 644 const char* locale_for_conversion = 0; | 644 const char* locale_for_conversion = 0; |
| 645 if (LocaleIdMatchesLang(locale_identifier, "tr") || | 645 if (LocaleIdMatchesLang(locale_identifier, "tr") || |
| 646 LocaleIdMatchesLang(locale_identifier, "az")) | 646 LocaleIdMatchesLang(locale_identifier, "az")) |
| 647 locale_for_conversion = "tr"; | 647 locale_for_conversion = "tr"; |
| 648 else if (LocaleIdMatchesLang(locale_identifier, "lt")) | 648 else if (LocaleIdMatchesLang(locale_identifier, "lt")) |
| 649 locale_for_conversion = "lt"; | 649 locale_for_conversion = "lt"; |
| 650 else | 650 else |
| 651 return LowerUnicode(); | 651 return LowerUnicode(); |
| 652 | 652 |
| 653 if (length_ > static_cast<unsigned>(numeric_limits<int32_t>::max())) | 653 CHECK_LE(length_, static_cast<unsigned>(numeric_limits<int32_t>::max())); |
| 654 IMMEDIATE_CRASH(); | |
| 655 int length = length_; | 654 int length = length_; |
| 656 | 655 |
| 657 RefPtr<StringImpl> upconverted = UpconvertedString(); | 656 RefPtr<StringImpl> upconverted = UpconvertedString(); |
| 658 const UChar* source16 = upconverted->Characters16(); | 657 const UChar* source16 = upconverted->Characters16(); |
| 659 return CaseConvert(source16, length, u_strToLower, locale_for_conversion, | 658 return CaseConvert(source16, length, u_strToLower, locale_for_conversion, |
| 660 this); | 659 this); |
| 661 } | 660 } |
| 662 | 661 |
| 663 PassRefPtr<StringImpl> StringImpl::UpperUnicode( | 662 PassRefPtr<StringImpl> StringImpl::UpperUnicode( |
| 664 const AtomicString& locale_identifier) { | 663 const AtomicString& locale_identifier) { |
| 665 // Use the more-optimized code path most of the time. | 664 // Use the more-optimized code path most of the time. |
| 666 // Only Turkic (tr and az) languages, Greek and Lithuanian require | 665 // Only Turkic (tr and az) languages, Greek and Lithuanian require |
| 667 // locale-specific uppercasing rules. | 666 // locale-specific uppercasing rules. |
| 668 const char* locale_for_conversion = 0; | 667 const char* locale_for_conversion = 0; |
| 669 if (LocaleIdMatchesLang(locale_identifier, "tr") || | 668 if (LocaleIdMatchesLang(locale_identifier, "tr") || |
| 670 LocaleIdMatchesLang(locale_identifier, "az")) | 669 LocaleIdMatchesLang(locale_identifier, "az")) |
| 671 locale_for_conversion = "tr"; | 670 locale_for_conversion = "tr"; |
| 672 else if (LocaleIdMatchesLang(locale_identifier, "el")) | 671 else if (LocaleIdMatchesLang(locale_identifier, "el")) |
| 673 locale_for_conversion = "el"; | 672 locale_for_conversion = "el"; |
| 674 else if (LocaleIdMatchesLang(locale_identifier, "lt")) | 673 else if (LocaleIdMatchesLang(locale_identifier, "lt")) |
| 675 locale_for_conversion = "lt"; | 674 locale_for_conversion = "lt"; |
| 676 else | 675 else |
| 677 return UpperUnicode(); | 676 return UpperUnicode(); |
| 678 | 677 |
| 679 if (length_ > static_cast<unsigned>(numeric_limits<int32_t>::max())) | 678 CHECK_LE(length_, static_cast<unsigned>(numeric_limits<int32_t>::max())); |
| 680 IMMEDIATE_CRASH(); | |
| 681 int length = length_; | 679 int length = length_; |
| 682 | 680 |
| 683 RefPtr<StringImpl> upconverted = UpconvertedString(); | 681 RefPtr<StringImpl> upconverted = UpconvertedString(); |
| 684 const UChar* source16 = upconverted->Characters16(); | 682 const UChar* source16 = upconverted->Characters16(); |
| 685 | 683 |
| 686 return CaseConvert(source16, length, u_strToUpper, locale_for_conversion, | 684 return CaseConvert(source16, length, u_strToUpper, locale_for_conversion, |
| 687 this); | 685 this); |
| 688 } | 686 } |
| 689 | 687 |
| 690 PassRefPtr<StringImpl> StringImpl::Fill(UChar character) { | 688 PassRefPtr<StringImpl> StringImpl::Fill(UChar character) { |
| (...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2014 } else if (LocaleIdMatchesLang(locale_identifier, "lt")) { | 2012 } else if (LocaleIdMatchesLang(locale_identifier, "lt")) { |
| 2015 // TODO(rob.buis) implement upper-casing rules for lt | 2013 // TODO(rob.buis) implement upper-casing rules for lt |
| 2016 // like in StringImpl::upper(locale). | 2014 // like in StringImpl::upper(locale). |
| 2017 } | 2015 } |
| 2018 } | 2016 } |
| 2019 | 2017 |
| 2020 return ToUpper(c); | 2018 return ToUpper(c); |
| 2021 } | 2019 } |
| 2022 | 2020 |
| 2023 } // namespace WTF | 2021 } // namespace WTF |
| OLD | NEW |