Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(489)

Side by Side Diff: third_party/WebKit/Source/platform/wtf/text/StringImpl.cpp

Issue 2919443002: Use IMMEDIATE_CRASH() instead of CRASH() directly (Closed)
Patch Set: Use IMMEDIATE_CRASH() instead of CRASH() directly Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (length_ > static_cast<unsigned>(numeric_limits<int32_t>::max()))
654 CRASH(); 654 IMMEDIATE_CRASH();
655 int length = length_; 655 int length = length_;
656 656
657 RefPtr<StringImpl> upconverted = UpconvertedString(); 657 RefPtr<StringImpl> upconverted = UpconvertedString();
658 const UChar* source16 = upconverted->Characters16(); 658 const UChar* source16 = upconverted->Characters16();
659 return CaseConvert(source16, length, u_strToLower, locale_for_conversion, 659 return CaseConvert(source16, length, u_strToLower, locale_for_conversion,
660 this); 660 this);
661 } 661 }
662 662
663 PassRefPtr<StringImpl> StringImpl::UpperUnicode( 663 PassRefPtr<StringImpl> StringImpl::UpperUnicode(
664 const AtomicString& locale_identifier) { 664 const AtomicString& locale_identifier) {
665 // Use the more-optimized code path most of the time. 665 // Use the more-optimized code path most of the time.
666 // Only Turkic (tr and az) languages, Greek and Lithuanian require 666 // Only Turkic (tr and az) languages, Greek and Lithuanian require
667 // locale-specific uppercasing rules. 667 // locale-specific uppercasing rules.
668 const char* locale_for_conversion = 0; 668 const char* locale_for_conversion = 0;
669 if (LocaleIdMatchesLang(locale_identifier, "tr") || 669 if (LocaleIdMatchesLang(locale_identifier, "tr") ||
670 LocaleIdMatchesLang(locale_identifier, "az")) 670 LocaleIdMatchesLang(locale_identifier, "az"))
671 locale_for_conversion = "tr"; 671 locale_for_conversion = "tr";
672 else if (LocaleIdMatchesLang(locale_identifier, "el")) 672 else if (LocaleIdMatchesLang(locale_identifier, "el"))
673 locale_for_conversion = "el"; 673 locale_for_conversion = "el";
674 else if (LocaleIdMatchesLang(locale_identifier, "lt")) 674 else if (LocaleIdMatchesLang(locale_identifier, "lt"))
675 locale_for_conversion = "lt"; 675 locale_for_conversion = "lt";
676 else 676 else
677 return UpperUnicode(); 677 return UpperUnicode();
678 678
679 if (length_ > static_cast<unsigned>(numeric_limits<int32_t>::max())) 679 if (length_ > static_cast<unsigned>(numeric_limits<int32_t>::max()))
680 CRASH(); 680 IMMEDIATE_CRASH();
681 int length = length_; 681 int length = length_;
682 682
683 RefPtr<StringImpl> upconverted = UpconvertedString(); 683 RefPtr<StringImpl> upconverted = UpconvertedString();
684 const UChar* source16 = upconverted->Characters16(); 684 const UChar* source16 = upconverted->Characters16();
685 685
686 return CaseConvert(source16, length, u_strToUpper, locale_for_conversion, 686 return CaseConvert(source16, length, u_strToUpper, locale_for_conversion,
687 this); 687 this);
688 } 688 }
689 689
690 PassRefPtr<StringImpl> StringImpl::Fill(UChar character) { 690 PassRefPtr<StringImpl> StringImpl::Fill(UChar character) {
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
2014 } else if (LocaleIdMatchesLang(locale_identifier, "lt")) { 2014 } else if (LocaleIdMatchesLang(locale_identifier, "lt")) {
2015 // TODO(rob.buis) implement upper-casing rules for lt 2015 // TODO(rob.buis) implement upper-casing rules for lt
2016 // like in StringImpl::upper(locale). 2016 // like in StringImpl::upper(locale).
2017 } 2017 }
2018 } 2018 }
2019 2019
2020 return ToUpper(c); 2020 return ToUpper(c);
2021 } 2021 }
2022 2022
2023 } // namespace WTF 2023 } // namespace WTF
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698