OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights | 3 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights |
4 * reserved. | 4 * reserved. |
5 * Copyright (C) 2009 Google Inc. All rights reserved. | 5 * Copyright (C) 2009 Google Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 #endif | 481 #endif |
482 | 482 |
483 #ifdef STRING_STATS | 483 #ifdef STRING_STATS |
484 ALWAYS_INLINE static StringStats& stringStats() { return m_stringStats; } | 484 ALWAYS_INLINE static StringStats& stringStats() { return m_stringStats; } |
485 #endif | 485 #endif |
486 static const UChar kLatin1CaseFoldTable[256]; | 486 static const UChar kLatin1CaseFoldTable[256]; |
487 | 487 |
488 private: | 488 private: |
489 template <typename CharType> | 489 template <typename CharType> |
490 static size_t AllocationSize(unsigned length) { | 490 static size_t AllocationSize(unsigned length) { |
491 RELEASE_ASSERT( | 491 CHECK_LE(length, |
492 length <= ((std::numeric_limits<unsigned>::max() - sizeof(StringImpl)) / | 492 ((std::numeric_limits<unsigned>::max() - sizeof(StringImpl)) / |
493 sizeof(CharType))); | 493 sizeof(CharType))); |
494 return sizeof(StringImpl) + length * sizeof(CharType); | 494 return sizeof(StringImpl) + length * sizeof(CharType); |
495 } | 495 } |
496 | 496 |
497 PassRefPtr<StringImpl> Replace(UChar pattern, | 497 PassRefPtr<StringImpl> Replace(UChar pattern, |
498 const LChar* replacement, | 498 const LChar* replacement, |
499 unsigned replacement_length); | 499 unsigned replacement_length); |
500 PassRefPtr<StringImpl> Replace(UChar pattern, | 500 PassRefPtr<StringImpl> Replace(UChar pattern, |
501 const UChar* replacement, | 501 const UChar* replacement, |
502 unsigned replacement_length); | 502 unsigned replacement_length); |
503 | 503 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 inline size_t StringImpl::Find(UChar character, unsigned start) { | 751 inline size_t StringImpl::Find(UChar character, unsigned start) { |
752 if (Is8Bit()) | 752 if (Is8Bit()) |
753 return WTF::Find(Characters8(), length_, character, start); | 753 return WTF::Find(Characters8(), length_, character, start); |
754 return WTF::Find(Characters16(), length_, character, start); | 754 return WTF::Find(Characters16(), length_, character, start); |
755 } | 755 } |
756 | 756 |
757 inline unsigned LengthOfNullTerminatedString(const UChar* string) { | 757 inline unsigned LengthOfNullTerminatedString(const UChar* string) { |
758 size_t length = 0; | 758 size_t length = 0; |
759 while (string[length] != UChar(0)) | 759 while (string[length] != UChar(0)) |
760 ++length; | 760 ++length; |
761 RELEASE_ASSERT(length <= std::numeric_limits<unsigned>::max()); | 761 CHECK_LE(length, std::numeric_limits<unsigned>::max()); |
762 return static_cast<unsigned>(length); | 762 return static_cast<unsigned>(length); |
763 } | 763 } |
764 | 764 |
765 template <size_t inlineCapacity> | 765 template <size_t inlineCapacity> |
766 bool EqualIgnoringNullity(const Vector<UChar, inlineCapacity>& a, | 766 bool EqualIgnoringNullity(const Vector<UChar, inlineCapacity>& a, |
767 StringImpl* b) { | 767 StringImpl* b) { |
768 if (!b) | 768 if (!b) |
769 return !a.size(); | 769 return !a.size(); |
770 if (a.size() != b->length()) | 770 if (a.size() != b->length()) |
771 return false; | 771 return false; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 using WTF::kTextCaseASCIIInsensitive; | 898 using WTF::kTextCaseASCIIInsensitive; |
899 using WTF::kTextCaseUnicodeInsensitive; | 899 using WTF::kTextCaseUnicodeInsensitive; |
900 using WTF::kTextCaseSensitive; | 900 using WTF::kTextCaseSensitive; |
901 using WTF::TextCaseSensitivity; | 901 using WTF::TextCaseSensitivity; |
902 using WTF::Equal; | 902 using WTF::Equal; |
903 using WTF::EqualNonNull; | 903 using WTF::EqualNonNull; |
904 using WTF::LengthOfNullTerminatedString; | 904 using WTF::LengthOfNullTerminatedString; |
905 using WTF::ReverseFind; | 905 using WTF::ReverseFind; |
906 | 906 |
907 #endif | 907 #endif |
OLD | NEW |