Changeset 275084 in webkit
- Timestamp:
- Mar 26, 2021, 2:25:21 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
Modules/applepay/PaymentRequestValidator.mm (modified) (2 diffs)
-
platform/text/EncodingTables.cpp (modified) (5 diffs)
-
platform/text/TextCodecICU.cpp (modified) (1 diff)
-
platform/text/TextCodecICU.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r275082 r275084 1 2021-03-26 Yusuke Suzuki <ysuzuki@apple.com> 2 3 Use ICUDeleter to encode ucnv_close/uenum_close call into type of deleter of std::unique_ptr 4 https://bugs.webkit.org/show_bug.cgi?id=223503 5 6 Reviewed by Alex Christensen. 7 8 Use ICUDeleter<ucnv_close> instead of holding ucnv_close pointer in ICUConverterPtr. 9 This deleter encodes ucnv_close calls into type so that we do not need to hold a pointer 10 to ucnv_close. 11 12 We also use ICUDeleter<uenum_close> in place where we use UEnumeration. 13 14 * Modules/applepay/PaymentRequestValidator.mm: 15 (WebCore::validateCurrencyCode): 16 * platform/text/EncodingTables.cpp: 17 (WebCore::jis0208): 18 (WebCore::jis0212): 19 (WebCore::big5): 20 (WebCore::eucKR): 21 (WebCore::gb18030): 22 * platform/text/TextCodecICU.cpp: 23 (WebCore::TextCodecICU::createICUConverter const): 24 * platform/text/TextCodecICU.h: 25 1 26 2021-03-26 Jessie Berlin <jberlin@webkit.org> 2 27 -
trunk/Source/WebCore/Modules/applepay/PaymentRequestValidator.mm
r273143 r275084 33 33 #import <unicode/ucurr.h> 34 34 #import <unicode/uloc.h> 35 #import <wtf/unicode/icu/ICUHelpers.h> 35 36 36 37 namespace WebCore { … … 116 117 117 118 UErrorCode errorCode = U_ZERO_ERROR; 118 auto currencyCodes = std::unique_ptr<UEnumeration, void (*)(UEnumeration*)>(ucurr_openISOCurrencies(UCURR_ALL, &errorCode), uenum_close);119 auto currencyCodes = std::unique_ptr<UEnumeration, ICUDeleter<uenum_close>>(ucurr_openISOCurrencies(UCURR_ALL, &errorCode)); 119 120 120 121 int32_t length; -
trunk/Source/WebCore/platform/text/EncodingTables.cpp
r274569 r275084 1067 1067 1068 1068 UErrorCode error = U_ZERO_ERROR; 1069 auto icuConverter = ICUConverterPtr { ucnv_open("EUC-JP", &error) , ucnv_close};1069 auto icuConverter = ICUConverterPtr { ucnv_open("EUC-JP", &error) }; 1070 1070 ASSERT(!error); 1071 1071 … … 1872 1872 1873 1873 UErrorCode error = U_ZERO_ERROR; 1874 auto icuConverter = ICUConverterPtr { ucnv_open("EUC-JP", &error) , ucnv_close};1874 auto icuConverter = ICUConverterPtr { ucnv_open("EUC-JP", &error) }; 1875 1875 ASSERT(!error); 1876 1876 … … 4883 4883 4884 4884 UErrorCode error = U_ZERO_ERROR; 4885 auto icuConverter = ICUConverterPtr { ucnv_open("Big-5", &error) , ucnv_close};4885 auto icuConverter = ICUConverterPtr { ucnv_open("Big-5", &error) }; 4886 4886 ASSERT(!error); 4887 4887 … … 7073 7073 array = new std::array<std::pair<uint16_t, UChar>, 17048>; 7074 7074 UErrorCode error = U_ZERO_ERROR; 7075 auto icuConverter = ICUConverterPtr { ucnv_open("windows-949", &error) , ucnv_close};7075 auto icuConverter = ICUConverterPtr { ucnv_open("windows-949", &error) }; 7076 7076 ASSERT(U_SUCCESS(error)); 7077 7077 auto getPair = [icuConverter = WTFMove(icuConverter)] (uint16_t pointer) -> Optional<std::pair<uint16_t, UChar>> { … … 8612 8612 array = new std::array<UChar, 23940>; 8613 8613 UErrorCode error = U_ZERO_ERROR; 8614 auto icuConverter = ICUConverterPtr { ucnv_open("gb18030", &error) , ucnv_close};8614 auto icuConverter = ICUConverterPtr { ucnv_open("gb18030", &error) }; 8615 8615 for (size_t pointer = 0; pointer < 23940; pointer++) { 8616 8616 uint8_t icuInput[2]; -
trunk/Source/WebCore/platform/text/TextCodecICU.cpp
r269499 r275084 187 187 188 188 UErrorCode error = U_ZERO_ERROR; 189 m_converter = ICUConverterPtr { ucnv_open(m_canonicalConverterName, &error) , ucnv_close};189 m_converter = ICUConverterPtr { ucnv_open(m_canonicalConverterName, &error) }; 190 190 if (m_converter) 191 191 ucnv_setFallback(m_converter.get(), true); -
trunk/Source/WebCore/platform/text/TextCodecICU.h
r269499 r275084 29 29 #include "TextCodec.h" 30 30 #include <unicode/ucnv.h> 31 #include <wtf/unicode/icu/ICUHelpers.h> 31 32 32 33 namespace WebCore { 33 34 34 using ICUConverterPtr = std::unique_ptr<UConverter, void (*)(UConverter*)>;35 using ICUConverterPtr = std::unique_ptr<UConverter, ICUDeleter<ucnv_close>>; 35 36 36 37 class TextCodecICU final : public TextCodec { … … 53 54 const char* const m_encodingName; 54 55 const char* const m_canonicalConverterName; 55 mutable ICUConverterPtr m_converter { nullptr, ucnv_close };56 mutable ICUConverterPtr m_converter; 56 57 }; 57 58 … … 59 60 WTF_MAKE_STRUCT_FAST_ALLOCATED; 60 61 61 ICUConverterPtr converter { nullptr, ucnv_close };62 ICUConverterPtr converter; 62 63 }; 63 64
Note:
See TracChangeset
for help on using the changeset viewer.