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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 static PassRefPtr<StringImpl> caseConvert(const UChar* source16, size_t length,
icuCaseConverter converter, const char* locale, StringImpl* originalString) | 675 static PassRefPtr<StringImpl> caseConvert(const UChar* source16, size_t length,
icuCaseConverter converter, const char* locale, StringImpl* originalString) |
676 { | 676 { |
677 UChar* data16; | 677 UChar* data16; |
678 size_t targetLength = length; | 678 size_t targetLength = length; |
679 RefPtr<StringImpl> output = StringImpl::createUninitialized(length, data16); | 679 RefPtr<StringImpl> output = StringImpl::createUninitialized(length, data16); |
680 do { | 680 do { |
681 UErrorCode status = U_ZERO_ERROR; | 681 UErrorCode status = U_ZERO_ERROR; |
682 targetLength = converter(data16, targetLength, source16, length, locale,
&status); | 682 targetLength = converter(data16, targetLength, source16, length, locale,
&status); |
683 if (U_SUCCESS(status)) { | 683 if (U_SUCCESS(status)) { |
684 if (length > 0) | 684 if (length > 0) |
685 output->truncateAssumingIsolated(targetLength); | 685 return output->substring(0, targetLength); |
686 return output.release(); | 686 return output.release(); |
687 } | 687 } |
688 if (status != U_BUFFER_OVERFLOW_ERROR) | 688 if (status != U_BUFFER_OVERFLOW_ERROR) |
689 return originalString; | 689 return originalString; |
690 // Expand the buffer. | 690 // Expand the buffer. |
691 output = StringImpl::createUninitialized(targetLength, data16); | 691 output = StringImpl::createUninitialized(targetLength, data16); |
692 } while (true); | 692 } while (true); |
693 } | 693 } |
694 | 694 |
695 PassRefPtr<StringImpl> StringImpl::lower(const AtomicString& localeIdentifier) | 695 PassRefPtr<StringImpl> StringImpl::lower(const AtomicString& localeIdentifier) |
(...skipping 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2109 } else if (localeIdMatchesLang(localeIdentifier, "lt")) { | 2109 } else if (localeIdMatchesLang(localeIdentifier, "lt")) { |
2110 // TODO(rob.buis) implement upper-casing rules for lt | 2110 // TODO(rob.buis) implement upper-casing rules for lt |
2111 // like in StringImpl::upper(locale). | 2111 // like in StringImpl::upper(locale). |
2112 } | 2112 } |
2113 } | 2113 } |
2114 | 2114 |
2115 return toUpper(c); | 2115 return toUpper(c); |
2116 } | 2116 } |
2117 | 2117 |
2118 } // namespace WTF | 2118 } // namespace WTF |
OLD | NEW |