| 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 r
ights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All r
ights reserved. |
| 6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 return true; | 682 return true; |
| 683 } | 683 } |
| 684 return false; | 684 return false; |
| 685 } | 685 } |
| 686 | 686 |
| 687 typedef int32_t (*icuCaseConverter)(UChar*, int32_t, const UChar*, int32_t, cons
t char*, UErrorCode*); | 687 typedef int32_t (*icuCaseConverter)(UChar*, int32_t, const UChar*, int32_t, cons
t char*, UErrorCode*); |
| 688 | 688 |
| 689 static PassRefPtr<StringImpl> caseConvert(const UChar* source16, size_t length,
icuCaseConverter converter, const char* locale, StringImpl* originalString) | 689 static PassRefPtr<StringImpl> caseConvert(const UChar* source16, size_t length,
icuCaseConverter converter, const char* locale, StringImpl* originalString) |
| 690 { | 690 { |
| 691 UChar* data16; | 691 UChar* data16; |
| 692 int32_t targetLength = length; | 692 size_t targetLength = length; |
| 693 RefPtr<StringImpl> output = StringImpl::createUninitialized(length, data16); | 693 RefPtr<StringImpl> output = StringImpl::createUninitialized(length, data16); |
| 694 do { | 694 do { |
| 695 UErrorCode status = U_ZERO_ERROR; | 695 UErrorCode status = U_ZERO_ERROR; |
| 696 targetLength = converter(data16, targetLength, source16, length, locale,
&status); | 696 targetLength = converter(data16, targetLength, source16, length, locale,
&status); |
| 697 if (U_SUCCESS(status)) { | 697 if (U_SUCCESS(status)) { |
| 698 output->truncateAssumingIsolated(targetLength); | 698 if (length > 0) |
| 699 output->truncateAssumingIsolated(targetLength); |
| 699 return output.release(); | 700 return output.release(); |
| 700 } | 701 } |
| 701 if (status != U_BUFFER_OVERFLOW_ERROR) | 702 if (status != U_BUFFER_OVERFLOW_ERROR) |
| 702 return originalString; | 703 return originalString; |
| 703 // Expand the buffer. | 704 // Expand the buffer. |
| 704 output = StringImpl::createUninitialized(targetLength, data16); | 705 output = StringImpl::createUninitialized(targetLength, data16); |
| 705 } while (true); | 706 } while (true); |
| 706 } | 707 } |
| 707 | 708 |
| 708 PassRefPtr<StringImpl> StringImpl::lower(const AtomicString& localeIdentifier) | 709 PassRefPtr<StringImpl> StringImpl::lower(const AtomicString& localeIdentifier) |
| (...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2085 | 2086 |
| 2086 size_t StringImpl::sizeInBytes() const | 2087 size_t StringImpl::sizeInBytes() const |
| 2087 { | 2088 { |
| 2088 size_t size = length(); | 2089 size_t size = length(); |
| 2089 if (!is8Bit()) | 2090 if (!is8Bit()) |
| 2090 size *= 2; | 2091 size *= 2; |
| 2091 return size + sizeof(*this); | 2092 return size + sizeof(*this); |
| 2092 } | 2093 } |
| 2093 | 2094 |
| 2094 } // namespace WTF | 2095 } // namespace WTF |
| OLD | NEW |