From 15ffd0578c69837d80b604be2db0ca4d7c532a7b Mon Sep 17 00:00:00 2001
From: Albert Wang
Date: Sat, 2 Nov 2019 18:08:46 -0700
Subject: [PATCH] tools: update icu to 65.1
Update the version of the bundled ICU (deps/icu-small) to ICU version
65.2.
Fixes: https://github.com/nodejs/node/issues/30211
Fixes: https://github.com/nodejs/node/issues/29540
---
deps/icu-small/README-FULL-ICU.txt | 5 +-
deps/icu-small/source/common/brkeng.cpp | 10 +-
deps/icu-small/source/common/brkiter.cpp | 6 +-
deps/icu-small/source/common/bytesinkutil.h | 2 +-
deps/icu-small/source/common/caniter.cpp | 12 +-
.../source/common/characterproperties.cpp | 13 +-
deps/icu-small/source/common/charstr.cpp | 23 +
deps/icu-small/source/common/charstr.h | 14 +
deps/icu-small/source/common/cmemory.cpp | 2 +-
deps/icu-small/source/common/cmemory.h | 47 +-
deps/icu-small/source/common/common.rc | 9 +-
deps/icu-small/source/common/cstr.cpp | 2 +-
deps/icu-small/source/common/cstr.h | 2 +-
deps/icu-small/source/common/cstring.cpp | 20 +-
deps/icu-small/source/common/cwchar.cpp | 3 +-
deps/icu-small/source/common/cwchar.h | 8 +-
deps/icu-small/source/common/dictbe.cpp | 95 +-
deps/icu-small/source/common/dictbe.h | 226 ++---
.../source/common/dictionarydata.cpp | 10 +-
deps/icu-small/source/common/dictionarydata.h | 2 +-
deps/icu-small/source/common/dtintrv.cpp | 11 +-
deps/icu-small/source/common/edits.cpp | 2 +-
deps/icu-small/source/common/filteredbrk.cpp | 34 +-
deps/icu-small/source/common/hash.h | 1 +
deps/icu-small/source/common/icudataver.cpp | 4 +-
deps/icu-small/source/common/icuplug.cpp | 102 +--
deps/icu-small/source/common/icuplugimp.h | 10 +-
.../icu-small/source/common/localebuilder.cpp | 60 +-
.../icu-small/source/common/localematcher.cpp | 720 +++++++++++++++
.../source/common/localeprioritylist.cpp | 239 +++++
.../source/common/localeprioritylist.h | 115 +++
deps/icu-small/source/common/localsvc.h | 2 +-
deps/icu-small/source/common/locavailable.cpp | 208 +++--
deps/icu-small/source/common/locbased.h | 4 +-
deps/icu-small/source/common/locdispnames.cpp | 22 +-
deps/icu-small/source/common/locdistance.cpp | 364 ++++++++
deps/icu-small/source/common/locdistance.h | 109 +++
deps/icu-small/source/common/locdspnm.cpp | 100 ++-
deps/icu-small/source/common/locid.cpp | 25 +-
deps/icu-small/source/common/loclikely.cpp | 37 +-
.../source/common/loclikelysubtags.cpp | 638 +++++++++++++
.../source/common/loclikelysubtags.h | 143 +++
deps/icu-small/source/common/locmap.cpp | 10 +-
deps/icu-small/source/common/locmap.h | 3 +-
deps/icu-small/source/common/locresdata.cpp | 14 +-
deps/icu-small/source/common/locutil.cpp | 4 +-
deps/icu-small/source/common/lsr.cpp | 101 +++
deps/icu-small/source/common/lsr.h | 72 ++
.../source/common/messagepattern.cpp | 2 +-
deps/icu-small/source/common/msvcres.h | 4 +-
deps/icu-small/source/common/mutex.h | 72 +-
deps/icu-small/source/common/normalizer2.cpp | 4 +-
.../icu-small/source/common/normalizer2impl.h | 6 +-
deps/icu-small/source/common/normlzr.cpp | 32 +-
deps/icu-small/source/common/pluralmap.cpp | 3 +-
deps/icu-small/source/common/punycode.cpp | 2 +-
deps/icu-small/source/common/putil.cpp | 88 +-
deps/icu-small/source/common/putilimp.h | 74 +-
deps/icu-small/source/common/rbbi.cpp | 12 +-
deps/icu-small/source/common/rbbi_cache.cpp | 2 +-
deps/icu-small/source/common/rbbi_cache.h | 4 +-
deps/icu-small/source/common/rbbicst.pl | 25 +-
deps/icu-small/source/common/rbbidata.cpp | 10 +-
deps/icu-small/source/common/rbbidata.h | 6 +-
deps/icu-small/source/common/rbbinode.cpp | 4 +-
deps/icu-small/source/common/rbbinode.h | 11 +-
deps/icu-small/source/common/rbbirb.cpp | 2 +-
deps/icu-small/source/common/rbbirb.h | 7 +-
deps/icu-small/source/common/rbbirpt.h | 160 ++--
deps/icu-small/source/common/rbbiscan.cpp | 6 +-
deps/icu-small/source/common/rbbiscan.h | 2 +-
deps/icu-small/source/common/rbbisetb.cpp | 4 +-
deps/icu-small/source/common/rbbistbl.cpp | 2 +-
deps/icu-small/source/common/rbbitblb.cpp | 22 +-
deps/icu-small/source/common/resbund.cpp | 5 +-
deps/icu-small/source/common/resbund_cnv.cpp | 2 +-
deps/icu-small/source/common/resource.h | 24 +-
deps/icu-small/source/common/restrace.cpp | 130 +++
deps/icu-small/source/common/restrace.h | 147 +++
deps/icu-small/source/common/ruleiter.h | 10 +-
deps/icu-small/source/common/schriter.cpp | 2 +-
deps/icu-small/source/common/serv.cpp | 241 +++--
deps/icu-small/source/common/serv.h | 59 +-
deps/icu-small/source/common/servlk.cpp | 2 +
deps/icu-small/source/common/servlkf.cpp | 8 +-
deps/icu-small/source/common/servloc.h | 53 +-
deps/icu-small/source/common/servls.cpp | 8 +-
deps/icu-small/source/common/servnotf.cpp | 30 +-
deps/icu-small/source/common/servnotf.h | 28 +-
deps/icu-small/source/common/servrbf.cpp | 2 +
deps/icu-small/source/common/servslkf.cpp | 2 +
deps/icu-small/source/common/sharedobject.h | 10 +-
deps/icu-small/source/common/sprpimpl.h | 18 +-
.../source/common/static_unicode_sets.h | 4 +-
deps/icu-small/source/common/uarrsort.cpp | 50 +-
deps/icu-small/source/common/ubidiimp.h | 82 +-
.../source/common/ubiditransform.cpp | 36 +-
deps/icu-small/source/common/ucase.cpp | 9 +-
deps/icu-small/source/common/uchar.cpp | 4 +-
deps/icu-small/source/common/uchriter.cpp | 2 +-
deps/icu-small/source/common/ucln_cmn.cpp | 17 +-
deps/icu-small/source/common/ucln_cmn.h | 5 +-
deps/icu-small/source/common/ucln_imp.h | 6 +-
deps/icu-small/source/common/ucmndata.h | 4 +-
deps/icu-small/source/common/ucnv.cpp | 60 +-
deps/icu-small/source/common/ucnv2022.cpp | 17 +-
deps/icu-small/source/common/ucnv_bld.cpp | 31 +-
deps/icu-small/source/common/ucnv_bld.h | 6 +-
deps/icu-small/source/common/ucnv_cnv.h | 8 +-
deps/icu-small/source/common/ucnv_err.cpp | 14 +-
deps/icu-small/source/common/ucnv_ext.h | 2 +-
deps/icu-small/source/common/ucnv_io.cpp | 2 +-
deps/icu-small/source/common/ucnv_lmb.cpp | 346 +++----
deps/icu-small/source/common/ucnv_u16.cpp | 10 +-
deps/icu-small/source/common/ucnv_u32.cpp | 12 +-
deps/icu-small/source/common/ucnv_u7.cpp | 2 +-
deps/icu-small/source/common/ucnv_u8.cpp | 8 +-
deps/icu-small/source/common/ucnvbocu.cpp | 4 +-
deps/icu-small/source/common/ucnvhz.cpp | 76 +-
deps/icu-small/source/common/ucnvisci.cpp | 36 +-
deps/icu-small/source/common/ucnvlat1.cpp | 2 +-
deps/icu-small/source/common/ucnvmbcs.cpp | 4 +-
deps/icu-small/source/common/ucnvmbcs.h | 10 +-
deps/icu-small/source/common/ucnvscsu.cpp | 6 +-
deps/icu-small/source/common/ucnvsel.cpp | 44 +-
deps/icu-small/source/common/ucol_swp.cpp | 10 +-
deps/icu-small/source/common/ucptrie.cpp | 2 +-
deps/icu-small/source/common/ucurr.cpp | 157 ++--
deps/icu-small/source/common/udata.cpp | 93 +-
deps/icu-small/source/common/uelement.h | 4 +-
deps/icu-small/source/common/uenum.cpp | 2 +-
deps/icu-small/source/common/uenumimp.h | 26 +-
deps/icu-small/source/common/uhash.cpp | 15 +-
deps/icu-small/source/common/uidna.cpp | 159 ++--
deps/icu-small/source/common/uinvchar.cpp | 20 +-
deps/icu-small/source/common/uinvchar.h | 89 ++
deps/icu-small/source/common/ulist.cpp | 42 +-
deps/icu-small/source/common/uloc.cpp | 53 +-
deps/icu-small/source/common/uloc_keytype.cpp | 1 +
deps/icu-small/source/common/uloc_tag.cpp | 10 +-
deps/icu-small/source/common/ulocimp.h | 8 +-
deps/icu-small/source/common/umapfile.cpp | 34 +-
deps/icu-small/source/common/umath.cpp | 1 +
deps/icu-small/source/common/umutex.cpp | 122 ++-
deps/icu-small/source/common/umutex.h | 121 +--
deps/icu-small/source/common/unames.cpp | 14 +-
.../source/common/unicode/appendable.h | 5 +
.../icu-small/source/common/unicode/brkiter.h | 10 +-
.../source/common/unicode/bytestream.h | 11 +-
.../source/common/unicode/bytestrie.h | 47 +
.../source/common/unicode/bytestriebuilder.h | 7 +-
.../icu-small/source/common/unicode/caniter.h | 6 +-
.../icu-small/source/common/unicode/casemap.h | 5 +
.../source/common/unicode/char16ptr.h | 7 +-
.../source/common/unicode/chariter.h | 96 +-
deps/icu-small/source/common/unicode/dbbi.h | 8 +-
.../icu-small/source/common/unicode/docmain.h | 12 +-
.../icu-small/source/common/unicode/dtintrv.h | 38 +-
deps/icu-small/source/common/unicode/edits.h | 7 +-
.../icu-small/source/common/unicode/enumset.h | 6 +-
.../source/common/unicode/errorcode.h | 7 +-
.../source/common/unicode/filteredbrk.h | 7 +
.../source/common/unicode/icudataver.h | 4 +-
.../icu-small/source/common/unicode/icuplug.h | 69 +-
deps/icu-small/source/common/unicode/idna.h | 5 +
.../source/common/unicode/localebuilder.h | 27 +-
.../source/common/unicode/localematcher.h | 605 +++++++++++++
.../source/common/unicode/locdspnm.h | 4 +
deps/icu-small/source/common/unicode/locid.h | 165 +++-
.../source/common/unicode/messagepattern.h | 4 +
.../source/common/unicode/normalizer2.h | 5 +
.../icu-small/source/common/unicode/normlzr.h | 15 +-
.../source/common/unicode/parseerr.h | 8 +-
.../source/common/unicode/parsepos.h | 9 +-
.../source/common/unicode/platform.h | 80 +-
deps/icu-small/source/common/unicode/putil.h | 12 +-
deps/icu-small/source/common/unicode/rbbi.h | 15 +-
deps/icu-small/source/common/unicode/rep.h | 23 +-
.../icu-small/source/common/unicode/resbund.h | 22 +-
.../source/common/unicode/schriter.h | 12 +-
.../source/common/unicode/simpleformatter.h | 5 +
.../source/common/unicode/std_string.h | 4 +
.../icu-small/source/common/unicode/strenum.h | 29 +-
.../source/common/unicode/stringpiece.h | 41 +-
.../source/common/unicode/stringtriebuilder.h | 19 +-
.../source/common/unicode/symtable.h | 9 +-
deps/icu-small/source/common/unicode/ucat.h | 10 +-
deps/icu-small/source/common/unicode/uchar.h | 23 +-
.../source/common/unicode/ucharstrie.h | 47 +
.../source/common/unicode/ucharstriebuilder.h | 5 +
.../source/common/unicode/uchriter.h | 12 +-
deps/icu-small/source/common/unicode/uclean.h | 36 +-
.../icu-small/source/common/unicode/ucnv_cb.h | 54 +-
.../source/common/unicode/ucnv_err.h | 58 +-
.../icu-small/source/common/unicode/ucnvsel.h | 2 +-
.../icu-small/source/common/unicode/uconfig.h | 10 +-
deps/icu-small/source/common/unicode/ucpmap.h | 19 +-
.../icu-small/source/common/unicode/ucptrie.h | 116 ++-
deps/icu-small/source/common/unicode/ucurr.h | 143 +--
deps/icu-small/source/common/unicode/udata.h | 66 +-
deps/icu-small/source/common/unicode/uenum.h | 8 +-
deps/icu-small/source/common/unicode/uidna.h | 66 +-
deps/icu-small/source/common/unicode/uiter.h | 2 +-
.../source/common/unicode/uldnames.h | 24 +-
deps/icu-small/source/common/unicode/uloc.h | 260 ++++--
.../source/common/unicode/umachine.h | 40 +-
deps/icu-small/source/common/unicode/umisc.h | 14 +-
.../source/common/unicode/umutablecptrie.h | 27 +-
.../icu-small/source/common/unicode/unifilt.h | 16 +-
.../source/common/unicode/unifunct.h | 9 +-
.../source/common/unicode/unimatch.h | 11 +-
deps/icu-small/source/common/unicode/uniset.h | 19 +-
deps/icu-small/source/common/unicode/unistr.h | 46 +-
deps/icu-small/source/common/unicode/unorm.h | 4 +
.../icu-small/source/common/unicode/uobject.h | 34 +-
.../icu-small/source/common/unicode/urename.h | 24 +-
deps/icu-small/source/common/unicode/urep.h | 6 +-
deps/icu-small/source/common/unicode/uset.h | 16 +-
.../source/common/unicode/usetiter.h | 13 +-
deps/icu-small/source/common/unicode/ushape.h | 76 +-
deps/icu-small/source/common/unicode/usprep.h | 26 +-
.../icu-small/source/common/unicode/ustring.h | 150 ++--
deps/icu-small/source/common/unicode/utext.h | 104 +--
deps/icu-small/source/common/unicode/utf.h | 4 +-
deps/icu-small/source/common/unicode/utf16.h | 96 +-
deps/icu-small/source/common/unicode/utf8.h | 97 +-
.../icu-small/source/common/unicode/utf_old.h | 205 +++--
deps/icu-small/source/common/unicode/utrace.h | 91 +-
deps/icu-small/source/common/unicode/utypes.h | 46 +-
.../icu-small/source/common/unicode/uvernum.h | 12 +-
.../source/common/unicode/uversion.h | 34 +-
deps/icu-small/source/common/unifiedcache.cpp | 51 +-
deps/icu-small/source/common/unifiedcache.h | 58 +-
deps/icu-small/source/common/uniset.cpp | 8 +-
deps/icu-small/source/common/uniset_props.cpp | 11 +-
deps/icu-small/source/common/unisetspan.cpp | 4 +-
deps/icu-small/source/common/unistr.cpp | 22 +-
deps/icu-small/source/common/unistr_props.cpp | 2 +-
deps/icu-small/source/common/unistrappender.h | 4 +-
deps/icu-small/source/common/unorm.cpp | 8 +-
deps/icu-small/source/common/unormimp.h | 2 +-
deps/icu-small/source/common/ures_cnv.cpp | 4 +-
deps/icu-small/source/common/uresbund.cpp | 524 ++++++-----
deps/icu-small/source/common/uresdata.cpp | 102 ++-
deps/icu-small/source/common/uresdata.h | 76 +-
deps/icu-small/source/common/uresimp.h | 68 +-
deps/icu-small/source/common/usc_impl.cpp | 12 +-
deps/icu-small/source/common/uset.cpp | 30 +-
deps/icu-small/source/common/uset_imp.h | 1 +
deps/icu-small/source/common/uset_props.cpp | 8 +-
deps/icu-small/source/common/usetiter.cpp | 2 +-
deps/icu-small/source/common/ushape.cpp | 4 +-
deps/icu-small/source/common/usprep.cpp | 148 ++-
deps/icu-small/source/common/ustr_cnv.cpp | 8 +-
deps/icu-small/source/common/ustr_cnv.h | 4 +-
deps/icu-small/source/common/ustr_imp.h | 6 +-
.../source/common/ustr_titlecase_brkiter.cpp | 14 +-
deps/icu-small/source/common/ustr_wcs.cpp | 124 +--
deps/icu-small/source/common/ustrenum.cpp | 8 +-
deps/icu-small/source/common/ustrenum.h | 1 +
deps/icu-small/source/common/ustring.cpp | 44 +-
deps/icu-small/source/common/ustrtrns.cpp | 36 +-
deps/icu-small/source/common/utext.cpp | 6 +-
deps/icu-small/source/common/util.cpp | 14 +-
deps/icu-small/source/common/util.h | 19 +-
deps/icu-small/source/common/util_props.cpp | 1 +
deps/icu-small/source/common/utrace.cpp | 45 +-
deps/icu-small/source/common/utracimp.h | 105 ++-
deps/icu-small/source/common/utrie.h | 19 +-
deps/icu-small/source/common/utrie2.h | 16 +-
deps/icu-small/source/common/uvector.cpp | 15 +-
deps/icu-small/source/common/uvector.h | 8 +-
deps/icu-small/source/common/uvectr32.cpp | 7 +-
deps/icu-small/source/common/uvectr32.h | 8 +-
deps/icu-small/source/common/uvectr64.cpp | 7 +-
deps/icu-small/source/common/uvectr64.h | 8 +-
deps/icu-small/source/common/wintz.h | 2 +-
.../in/{icudt64l.dat.bz2 => icudt65l.dat.bz2} | Bin 9780309 -> 9881112 bytes
deps/icu-small/source/i18n/alphaindex.cpp | 9 +-
deps/icu-small/source/i18n/anytrans.cpp | 2 +-
deps/icu-small/source/i18n/anytrans.h | 2 +-
deps/icu-small/source/i18n/astro.cpp | 19 +-
deps/icu-small/source/i18n/basictz.cpp | 8 +-
deps/icu-small/source/i18n/bocsu.h | 4 +-
deps/icu-small/source/i18n/brktrans.cpp | 2 +-
deps/icu-small/source/i18n/brktrans.h | 4 +-
deps/icu-small/source/i18n/buddhcal.cpp | 8 +-
deps/icu-small/source/i18n/buddhcal.h | 5 +-
deps/icu-small/source/i18n/calendar.cpp | 11 +-
deps/icu-small/source/i18n/casetrn.cpp | 6 +-
deps/icu-small/source/i18n/casetrn.h | 4 +-
deps/icu-small/source/i18n/cecal.cpp | 2 +-
deps/icu-small/source/i18n/chnsecal.cpp | 64 +-
deps/icu-small/source/i18n/chnsecal.h | 18 +-
deps/icu-small/source/i18n/choicfmt.cpp | 54 +-
deps/icu-small/source/i18n/coleitr.cpp | 20 +-
deps/icu-small/source/i18n/coll.cpp | 62 +-
.../source/i18n/collationdatabuilder.cpp | 2 +-
.../source/i18n/collationiterator.cpp | 4 +-
.../source/i18n/collationweights.cpp | 2 +-
deps/icu-small/source/i18n/collationweights.h | 2 +-
deps/icu-small/source/i18n/collunsafe.h | 2 +-
.../source/i18n/compactdecimalformat.cpp | 8 +-
deps/icu-small/source/i18n/coptccal.cpp | 6 +-
deps/icu-small/source/i18n/coptccal.h | 62 +-
deps/icu-small/source/i18n/cpdtrans.cpp | 24 +-
deps/icu-small/source/i18n/cpdtrans.h | 4 +-
deps/icu-small/source/i18n/csdetect.cpp | 6 +-
deps/icu-small/source/i18n/csmatch.cpp | 6 +-
deps/icu-small/source/i18n/csmatch.h | 8 +-
deps/icu-small/source/i18n/csr2022.cpp | 20 +-
deps/icu-small/source/i18n/csr2022.h | 10 +-
deps/icu-small/source/i18n/csrecog.cpp | 2 +-
deps/icu-small/source/i18n/csrecog.h | 4 +-
deps/icu-small/source/i18n/csrmbcs.cpp | 2 +-
deps/icu-small/source/i18n/csrsbcs.cpp | 847 +++++++++---------
deps/icu-small/source/i18n/csrsbcs.h | 26 +-
deps/icu-small/source/i18n/csrucode.cpp | 7 +-
deps/icu-small/source/i18n/csrucode.h | 4 +-
deps/icu-small/source/i18n/csrutf8.cpp | 2 +-
deps/icu-small/source/i18n/csrutf8.h | 6 +-
deps/icu-small/source/i18n/curramt.cpp | 4 +-
deps/icu-small/source/i18n/currfmt.cpp | 2 +-
deps/icu-small/source/i18n/currfmt.h | 2 +-
deps/icu-small/source/i18n/currpinf.cpp | 24 +-
deps/icu-small/source/i18n/currunit.cpp | 4 +-
deps/icu-small/source/i18n/dangical.cpp | 57 +-
deps/icu-small/source/i18n/dangical.h | 11 +-
deps/icu-small/source/i18n/datefmt.cpp | 18 +-
deps/icu-small/source/i18n/dcfmtsym.cpp | 20 +-
deps/icu-small/source/i18n/decContext.cpp | 1 +
deps/icu-small/source/i18n/decContext.h | 2 +-
deps/icu-small/source/i18n/decNumber.cpp | 2 +-
deps/icu-small/source/i18n/decNumber.h | 2 +-
deps/icu-small/source/i18n/decNumberLocal.h | 4 +-
deps/icu-small/source/i18n/decimfmt.cpp | 377 ++++----
.../i18n/double-conversion-bignum-dtoa.cpp | 40 +-
.../source/i18n/double-conversion-bignum.cpp | 581 ++++++------
.../source/i18n/double-conversion-bignum.h | 68 +-
.../i18n/double-conversion-cached-powers.cpp | 204 ++---
.../i18n/double-conversion-cached-powers.h | 26 +-
.../source/i18n/double-conversion-diy-fp.cpp | 74 --
.../source/i18n/double-conversion-diy-fp.h | 59 +-
.../double-conversion-double-to-string.cpp | 450 ++++++++++
.../i18n/double-conversion-double-to-string.h | 419 +++++++++
.../i18n/double-conversion-fast-dtoa.cpp | 54 +-
.../source/i18n/double-conversion-ieee.h | 38 +-
...=> double-conversion-string-to-double.cpp} | 462 +---------
.../i18n/double-conversion-string-to-double.h | 244 +++++
.../source/i18n/double-conversion-strtod.cpp | 146 ++-
.../source/i18n/double-conversion-strtod.h | 5 +
.../source/i18n/double-conversion-utils.h | 107 ++-
.../icu-small/source/i18n/double-conversion.h | 557 +-----------
deps/icu-small/source/i18n/dtfmtsym.cpp | 28 +-
deps/icu-small/source/i18n/dtitv_impl.h | 6 +-
deps/icu-small/source/i18n/dtitvfmt.cpp | 31 +-
deps/icu-small/source/i18n/dtitvinf.cpp | 4 +-
deps/icu-small/source/i18n/dtptngen.cpp | 82 +-
deps/icu-small/source/i18n/erarules.cpp | 2 +
deps/icu-small/source/i18n/esctrn.cpp | 2 +-
deps/icu-small/source/i18n/esctrn.h | 2 +-
deps/icu-small/source/i18n/ethpccal.cpp | 6 +-
deps/icu-small/source/i18n/ethpccal.h | 54 +-
deps/icu-small/source/i18n/fmtable.cpp | 48 +-
deps/icu-small/source/i18n/fmtableimp.h | 2 +-
...ilder.cpp => formatted_string_builder.cpp} | 230 +----
.../source/i18n/formatted_string_builder.h | 253 ++++++
.../icu-small/source/i18n/formattedval_impl.h | 41 +-
.../source/i18n/formattedval_sbimpl.cpp | 182 +++-
deps/icu-small/source/i18n/fpositer.cpp | 1 +
deps/icu-small/source/i18n/funcrepl.cpp | 4 +-
deps/icu-small/source/i18n/funcrepl.h | 2 +-
deps/icu-small/source/i18n/gender.cpp | 4 +-
deps/icu-small/source/i18n/gregocal.cpp | 122 +--
deps/icu-small/source/i18n/gregoimp.cpp | 4 +-
deps/icu-small/source/i18n/gregoimp.h | 6 +-
deps/icu-small/source/i18n/hebrwcal.cpp | 17 +-
deps/icu-small/source/i18n/hebrwcal.h | 43 +-
deps/icu-small/source/i18n/i18n.rc | 9 +-
deps/icu-small/source/i18n/indiancal.cpp | 27 +-
deps/icu-small/source/i18n/indiancal.h | 43 +-
deps/icu-small/source/i18n/inputext.cpp | 7 +-
deps/icu-small/source/i18n/inputext.h | 8 +-
deps/icu-small/source/i18n/islamcal.cpp | 29 +-
deps/icu-small/source/i18n/islamcal.h | 81 +-
deps/icu-small/source/i18n/japancal.cpp | 8 +-
deps/icu-small/source/i18n/japancal.h | 15 +-
deps/icu-small/source/i18n/listformatter.cpp | 8 +-
deps/icu-small/source/i18n/measfmt.cpp | 243 +++--
deps/icu-small/source/i18n/measunit.cpp | 578 +++++++-----
deps/icu-small/source/i18n/measure.cpp | 4 +-
deps/icu-small/source/i18n/msgfmt.cpp | 6 +-
deps/icu-small/source/i18n/msgfmt_impl.h | 2 +-
deps/icu-small/source/i18n/name2uni.cpp | 8 +-
deps/icu-small/source/i18n/name2uni.h | 2 +-
deps/icu-small/source/i18n/nfrlist.h | 14 +-
deps/icu-small/source/i18n/nfrs.cpp | 10 +-
deps/icu-small/source/i18n/nfrs.h | 2 +-
deps/icu-small/source/i18n/nfrule.cpp | 10 +-
deps/icu-small/source/i18n/nfrule.h | 21 +-
deps/icu-small/source/i18n/nfsubs.cpp | 41 +-
deps/icu-small/source/i18n/nfsubs.h | 52 +-
deps/icu-small/source/i18n/nortrans.cpp | 2 +-
deps/icu-small/source/i18n/nortrans.h | 2 +-
deps/icu-small/source/i18n/nounit.cpp | 2 +-
deps/icu-small/source/i18n/nultrans.cpp | 2 +-
deps/icu-small/source/i18n/nultrans.h | 2 +-
.../source/i18n/number_affixutils.cpp | 8 +-
.../icu-small/source/i18n/number_affixutils.h | 10 +-
.../icu-small/source/i18n/number_asformat.cpp | 10 +-
deps/icu-small/source/i18n/number_asformat.h | 2 +-
deps/icu-small/source/i18n/number_capi.cpp | 27 +
deps/icu-small/source/i18n/number_compact.cpp | 6 +-
.../source/i18n/number_currencysymbols.cpp | 6 +-
.../source/i18n/number_decimalquantity.cpp | 21 +-
.../source/i18n/number_decimalquantity.h | 11 +-
deps/icu-small/source/i18n/number_decnum.h | 2 +
deps/icu-small/source/i18n/number_fluent.cpp | 4 +-
.../source/i18n/number_formatimpl.cpp | 76 +-
.../icu-small/source/i18n/number_formatimpl.h | 24 +-
.../source/i18n/number_longnames.cpp | 29 +-
deps/icu-small/source/i18n/number_longnames.h | 9 +-
deps/icu-small/source/i18n/number_mapper.h | 12 +-
.../source/i18n/number_modifiers.cpp | 22 +-
deps/icu-small/source/i18n/number_modifiers.h | 56 +-
deps/icu-small/source/i18n/number_output.cpp | 13 +-
deps/icu-small/source/i18n/number_padding.cpp | 6 +-
.../source/i18n/number_patternmodifier.cpp | 38 +-
.../source/i18n/number_patternmodifier.h | 16 +-
.../source/i18n/number_patternstring.cpp | 7 +-
.../source/i18n/number_patternstring.h | 4 +-
.../icu-small/source/i18n/number_rounding.cpp | 14 +-
.../source/i18n/number_scientific.cpp | 14 +-
.../icu-small/source/i18n/number_scientific.h | 2 +-
.../source/i18n/number_skeletons.cpp | 11 +-
deps/icu-small/source/i18n/number_skeletons.h | 6 +-
.../source/i18n/number_stringbuilder.h | 164 ----
deps/icu-small/source/i18n/number_types.h | 28 +-
deps/icu-small/source/i18n/number_utils.cpp | 11 +
deps/icu-small/source/i18n/number_utils.h | 45 +-
deps/icu-small/source/i18n/number_utypes.h | 6 +-
deps/icu-small/source/i18n/numfmt.cpp | 40 +-
.../source/i18n/numparse_affixes.cpp | 30 +-
deps/icu-small/source/i18n/numparse_affixes.h | 2 +-
.../source/i18n/numparse_compositions.cpp | 1 +
.../source/i18n/numparse_currency.cpp | 1 +
.../source/i18n/numparse_decimal.cpp | 1 +
deps/icu-small/source/i18n/numparse_impl.cpp | 6 +-
deps/icu-small/source/i18n/numparse_impl.h | 1 +
.../source/i18n/numparse_parsednumber.cpp | 5 +-
.../source/i18n/numparse_scientific.cpp | 65 +-
.../source/i18n/numparse_scientific.h | 2 +
.../source/i18n/numparse_stringsegment.h | 24 -
.../source/i18n/numparse_symbols.cpp | 9 +-
deps/icu-small/source/i18n/numparse_symbols.h | 2 +-
deps/icu-small/source/i18n/numparse_types.h | 115 +--
.../icu-small/source/i18n/numrange_fluent.cpp | 4 +-
deps/icu-small/source/i18n/numrange_impl.cpp | 2 +-
deps/icu-small/source/i18n/numrange_impl.h | 6 +-
deps/icu-small/source/i18n/numsys.cpp | 10 +-
deps/icu-small/source/i18n/numsys_impl.h | 2 +-
deps/icu-small/source/i18n/olsontz.cpp | 25 +-
deps/icu-small/source/i18n/olsontz.h | 40 +-
deps/icu-small/source/i18n/persncal.cpp | 19 +-
deps/icu-small/source/i18n/persncal.h | 67 +-
deps/icu-small/source/i18n/plurfmt.cpp | 15 +-
deps/icu-small/source/i18n/plurrule.cpp | 6 +-
deps/icu-small/source/i18n/plurrule_impl.h | 2 +-
deps/icu-small/source/i18n/quant.cpp | 4 +-
deps/icu-small/source/i18n/quant.h | 2 +-
.../source/i18n/quantityformatter.cpp | 10 +-
.../icu-small/source/i18n/quantityformatter.h | 17 +-
deps/icu-small/source/i18n/rbnf.cpp | 193 ++--
deps/icu-small/source/i18n/rbt.cpp | 18 +-
deps/icu-small/source/i18n/rbt.h | 4 +-
deps/icu-small/source/i18n/rbt_data.cpp | 2 +-
deps/icu-small/source/i18n/rbt_pars.cpp | 74 +-
deps/icu-small/source/i18n/rbt_pars.h | 12 +-
deps/icu-small/source/i18n/rbt_rule.cpp | 28 +-
deps/icu-small/source/i18n/rbt_rule.h | 4 +-
deps/icu-small/source/i18n/rbt_set.cpp | 8 +-
deps/icu-small/source/i18n/rbt_set.h | 2 +-
deps/icu-small/source/i18n/rbtz.cpp | 13 +-
deps/icu-small/source/i18n/regexcmp.cpp | 121 +--
deps/icu-small/source/i18n/regexcmp.h | 4 +-
deps/icu-small/source/i18n/regexcst.h | 330 +++----
deps/icu-small/source/i18n/regexcst.pl | 3 +
deps/icu-small/source/i18n/regeximp.cpp | 5 +-
deps/icu-small/source/i18n/regeximp.h | 7 +-
deps/icu-small/source/i18n/regexst.cpp | 14 +-
deps/icu-small/source/i18n/regexst.h | 3 +-
deps/icu-small/source/i18n/region.cpp | 44 +-
deps/icu-small/source/i18n/region_impl.h | 2 +-
deps/icu-small/source/i18n/reldatefmt.cpp | 20 +-
deps/icu-small/source/i18n/reldtfmt.cpp | 20 +-
deps/icu-small/source/i18n/reldtfmt.h | 4 +-
deps/icu-small/source/i18n/rematch.cpp | 145 +--
deps/icu-small/source/i18n/remtrans.cpp | 6 +-
deps/icu-small/source/i18n/remtrans.h | 2 +-
deps/icu-small/source/i18n/repattrn.cpp | 12 +-
.../source/i18n/rulebasedcollator.cpp | 2 +-
.../source/i18n/scientificnumberformatter.cpp | 4 +-
deps/icu-small/source/i18n/scriptset.cpp | 4 +-
deps/icu-small/source/i18n/search.cpp | 62 +-
deps/icu-small/source/i18n/selfmt.cpp | 2 +-
deps/icu-small/source/i18n/selfmtimpl.h | 4 +-
deps/icu-small/source/i18n/simpletz.cpp | 67 +-
deps/icu-small/source/i18n/smpdtfmt.cpp | 50 +-
deps/icu-small/source/i18n/smpdtfst.cpp | 6 +-
deps/icu-small/source/i18n/smpdtfst.h | 6 +-
deps/icu-small/source/i18n/sortkey.cpp | 2 +-
...e_stringsegment.cpp => string_segment.cpp} | 7 +-
deps/icu-small/source/i18n/string_segment.h | 134 +++
deps/icu-small/source/i18n/strmatch.cpp | 14 +-
deps/icu-small/source/i18n/strmatch.h | 6 +-
deps/icu-small/source/i18n/strrepl.cpp | 4 +-
deps/icu-small/source/i18n/strrepl.h | 2 +-
deps/icu-small/source/i18n/stsearch.cpp | 38 +-
deps/icu-small/source/i18n/taiwncal.cpp | 6 +-
deps/icu-small/source/i18n/taiwncal.h | 5 +-
deps/icu-small/source/i18n/timezone.cpp | 26 +-
deps/icu-small/source/i18n/titletrn.cpp | 6 +-
deps/icu-small/source/i18n/titletrn.h | 2 +-
deps/icu-small/source/i18n/tmunit.cpp | 28 +-
deps/icu-small/source/i18n/tmutamt.cpp | 16 +-
deps/icu-small/source/i18n/tmutfmt.cpp | 10 +-
deps/icu-small/source/i18n/tolowtrn.cpp | 4 +-
deps/icu-small/source/i18n/tolowtrn.h | 2 +-
deps/icu-small/source/i18n/toupptrn.cpp | 2 +-
deps/icu-small/source/i18n/toupptrn.h | 2 +-
deps/icu-small/source/i18n/translit.cpp | 97 +-
deps/icu-small/source/i18n/transreg.cpp | 28 +-
deps/icu-small/source/i18n/tridpars.cpp | 50 +-
deps/icu-small/source/i18n/tridpars.h | 4 +-
deps/icu-small/source/i18n/tzfmt.cpp | 45 +-
deps/icu-small/source/i18n/tzgnames.cpp | 52 +-
deps/icu-small/source/i18n/tzgnames.h | 2 +-
deps/icu-small/source/i18n/tznames.cpp | 19 +-
deps/icu-small/source/i18n/tznames_impl.cpp | 67 +-
deps/icu-small/source/i18n/tznames_impl.h | 4 +-
deps/icu-small/source/i18n/tzrule.cpp | 9 +-
deps/icu-small/source/i18n/ucal.cpp | 45 +-
deps/icu-small/source/i18n/ucln_in.cpp | 1 +
deps/icu-small/source/i18n/ucol.cpp | 6 +-
deps/icu-small/source/i18n/ucol_sit.cpp | 8 +-
deps/icu-small/source/i18n/ucoleitr.cpp | 28 +-
deps/icu-small/source/i18n/udat.cpp | 34 +-
deps/icu-small/source/i18n/ulocdata.cpp | 10 +-
deps/icu-small/source/i18n/umsg.cpp | 30 +-
deps/icu-small/source/i18n/unesctrn.cpp | 6 +-
deps/icu-small/source/i18n/unesctrn.h | 2 +-
deps/icu-small/source/i18n/uni2name.cpp | 4 +-
deps/icu-small/source/i18n/uni2name.h | 2 +-
.../source/i18n/unicode/alphaindex.h | 24 +-
deps/icu-small/source/i18n/unicode/basictz.h | 14 +-
deps/icu-small/source/i18n/unicode/calendar.h | 27 +-
deps/icu-small/source/i18n/unicode/choicfmt.h | 9 +-
deps/icu-small/source/i18n/unicode/coleitr.h | 54 +-
deps/icu-small/source/i18n/unicode/coll.h | 24 +-
.../i18n/unicode/compactdecimalformat.h | 7 +-
deps/icu-small/source/i18n/unicode/curramt.h | 15 +-
deps/icu-small/source/i18n/unicode/currpinf.h | 32 +-
deps/icu-small/source/i18n/unicode/currunit.h | 11 +-
deps/icu-small/source/i18n/unicode/datefmt.h | 46 +-
deps/icu-small/source/i18n/unicode/dcfmtsym.h | 8 +-
deps/icu-small/source/i18n/unicode/decimfmt.h | 33 +-
deps/icu-small/source/i18n/unicode/dtfmtsym.h | 10 +-
deps/icu-small/source/i18n/unicode/dtitvfmt.h | 6 +-
deps/icu-small/source/i18n/unicode/dtitvinf.h | 7 +-
deps/icu-small/source/i18n/unicode/dtptngen.h | 12 +-
deps/icu-small/source/i18n/unicode/dtrule.h | 16 +-
deps/icu-small/source/i18n/unicode/fieldpos.h | 28 +-
deps/icu-small/source/i18n/unicode/fmtable.h | 4 +
deps/icu-small/source/i18n/unicode/format.h | 16 +-
.../source/i18n/unicode/formattedvalue.h | 29 +-
deps/icu-small/source/i18n/unicode/fpositer.h | 7 +-
deps/icu-small/source/i18n/unicode/gender.h | 6 +-
deps/icu-small/source/i18n/unicode/gregocal.h | 35 +-
.../source/i18n/unicode/listformatter.h | 6 +-
deps/icu-small/source/i18n/unicode/measfmt.h | 29 +-
deps/icu-small/source/i18n/unicode/measunit.h | 237 ++++-
deps/icu-small/source/i18n/unicode/measure.h | 13 +-
deps/icu-small/source/i18n/unicode/msgfmt.h | 10 +-
deps/icu-small/source/i18n/unicode/nounit.h | 9 +-
.../source/i18n/unicode/numberformatter.h | 281 +++---
.../i18n/unicode/numberrangeformatter.h | 139 +--
deps/icu-small/source/i18n/unicode/numfmt.h | 20 +-
deps/icu-small/source/i18n/unicode/numsys.h | 8 +-
deps/icu-small/source/i18n/unicode/plurfmt.h | 21 +-
deps/icu-small/source/i18n/unicode/plurrule.h | 4 +
deps/icu-small/source/i18n/unicode/rbnf.h | 30 +-
deps/icu-small/source/i18n/unicode/rbtz.h | 10 +-
deps/icu-small/source/i18n/unicode/regex.h | 87 +-
deps/icu-small/source/i18n/unicode/region.h | 53 +-
.../source/i18n/unicode/reldatefmt.h | 29 +-
.../i18n/unicode/scientificnumberformatter.h | 13 +-
deps/icu-small/source/i18n/unicode/search.h | 270 +++---
deps/icu-small/source/i18n/unicode/selfmt.h | 9 +-
deps/icu-small/source/i18n/unicode/simpletz.h | 12 +-
deps/icu-small/source/i18n/unicode/smpdtfmt.h | 8 +-
deps/icu-small/source/i18n/unicode/sortkey.h | 12 +-
deps/icu-small/source/i18n/unicode/stsearch.h | 236 ++---
deps/icu-small/source/i18n/unicode/tblcoll.h | 11 +-
deps/icu-small/source/i18n/unicode/timezone.h | 40 +-
deps/icu-small/source/i18n/unicode/tmunit.h | 7 +-
deps/icu-small/source/i18n/unicode/tmutamt.h | 42 +-
deps/icu-small/source/i18n/unicode/tmutfmt.h | 8 +-
deps/icu-small/source/i18n/unicode/translit.h | 4 +
deps/icu-small/source/i18n/unicode/tzfmt.h | 7 +-
deps/icu-small/source/i18n/unicode/tznames.h | 5 +
deps/icu-small/source/i18n/unicode/tzrule.h | 22 +-
deps/icu-small/source/i18n/unicode/tztrans.h | 10 +-
deps/icu-small/source/i18n/unicode/ucal.h | 218 +++--
deps/icu-small/source/i18n/unicode/ucol.h | 354 ++++----
deps/icu-small/source/i18n/unicode/ucoleitr.h | 80 +-
deps/icu-small/source/i18n/unicode/ucsdet.h | 22 +-
deps/icu-small/source/i18n/unicode/udat.h | 2 +
.../source/i18n/unicode/udateintervalformat.h | 2 +-
deps/icu-small/source/i18n/unicode/udatpg.h | 38 +-
.../source/i18n/unicode/uformattedvalue.h | 13 +-
.../source/i18n/unicode/ulistformatter.h | 6 +-
deps/icu-small/source/i18n/unicode/umsg.h | 80 +-
deps/icu-small/source/i18n/unicode/unirepl.h | 6 +-
deps/icu-small/source/i18n/unicode/unum.h | 86 +-
.../source/i18n/unicode/unumberformatter.h | 71 +-
deps/icu-small/source/i18n/unicode/unumsys.h | 2 +-
deps/icu-small/source/i18n/unicode/uregex.h | 204 ++---
deps/icu-small/source/i18n/unicode/uregion.h | 28 +-
.../source/i18n/unicode/ureldatefmt.h | 4 +-
deps/icu-small/source/i18n/unicode/usearch.h | 362 ++++----
deps/icu-small/source/i18n/unicode/uspoof.h | 496 +++++-----
deps/icu-small/source/i18n/unicode/utmscale.h | 59 +-
deps/icu-small/source/i18n/unicode/utrans.h | 63 +-
deps/icu-small/source/i18n/unicode/vtzone.h | 12 +-
deps/icu-small/source/i18n/unum.cpp | 75 +-
deps/icu-small/source/i18n/uregex.cpp | 3 +-
deps/icu-small/source/i18n/uregexc.cpp | 2 +-
deps/icu-small/source/i18n/usearch.cpp | 34 +-
deps/icu-small/source/i18n/uspoof.cpp | 16 +-
deps/icu-small/source/i18n/uspoof_build.cpp | 8 +-
deps/icu-small/source/i18n/uspoof_conf.cpp | 5 +-
deps/icu-small/source/i18n/uspoof_conf.h | 8 +-
deps/icu-small/source/i18n/uspoof_impl.cpp | 20 +-
deps/icu-small/source/i18n/uspoof_impl.h | 9 +-
deps/icu-small/source/i18n/usrchimp.h | 42 +-
deps/icu-small/source/i18n/utmscale.cpp | 14 +-
deps/icu-small/source/i18n/utrans.cpp | 14 +-
deps/icu-small/source/i18n/vtzone.cpp | 42 +-
deps/icu-small/source/i18n/vzone.cpp | 6 +-
deps/icu-small/source/i18n/vzone.h | 8 +-
deps/icu-small/source/i18n/windtfmt.cpp | 7 +-
deps/icu-small/source/i18n/windtfmt.h | 4 +-
deps/icu-small/source/i18n/winnmfmt.cpp | 6 +-
deps/icu-small/source/i18n/winnmfmt.h | 4 +-
deps/icu-small/source/i18n/wintzimpl.cpp | 8 +-
deps/icu-small/source/i18n/wintzimpl.h | 2 +-
deps/icu-small/source/i18n/zonemeta.cpp | 29 +-
deps/icu-small/source/i18n/zrule.cpp | 10 +-
deps/icu-small/source/i18n/zrule.h | 12 +-
deps/icu-small/source/i18n/ztrans.cpp | 2 +-
deps/icu-small/source/i18n/ztrans.h | 4 +-
.../databuilder/filtration_schema.json | 169 ++++
deps/icu-small/source/stubdata/stubdata.cpp | 8 +-
deps/icu-small/source/tools/escapesrc/cptbl.h | 7 +-
.../source/tools/escapesrc/escapesrc.cpp | 16 +-
.../source/tools/escapesrc/tblgen.cpp | 8 +-
.../source/tools/genccode/genccode.c | 15 +-
deps/icu-small/source/tools/genrb/derb.cpp | 2 +-
.../icu-small/source/tools/genrb/filterrb.cpp | 3 +
deps/icu-small/source/tools/genrb/genrb.cpp | 8 +-
deps/icu-small/source/tools/genrb/parse.cpp | 104 +--
.../icu-small/source/tools/genrb/prscmnts.cpp | 45 +-
deps/icu-small/source/tools/genrb/prscmnts.h | 7 +-
deps/icu-small/source/tools/genrb/rbutil.c | 12 +-
deps/icu-small/source/tools/genrb/read.c | 14 +-
deps/icu-small/source/tools/genrb/reslist.cpp | 2 +-
deps/icu-small/source/tools/genrb/reslist.h | 4 +-
deps/icu-small/source/tools/genrb/rle.c | 5 +-
deps/icu-small/source/tools/genrb/rle.h | 2 +-
deps/icu-small/source/tools/genrb/ustr.c | 8 +-
deps/icu-small/source/tools/genrb/ustr.h | 8 +-
.../source/tools/pkgdata/pkgdata.cpp | 144 +--
.../source/tools/toolutil/dbgutil.cpp | 4 +-
.../icu-small/source/tools/toolutil/dbgutil.h | 2 +-
.../source/tools/toolutil/filestrm.cpp | 6 +-
.../source/tools/toolutil/filetools.cpp | 2 +-
.../source/tools/toolutil/flagparser.cpp | 2 +-
.../icu-small/source/tools/toolutil/package.h | 2 +
.../source/tools/toolutil/pkg_genc.cpp | 244 +++--
.../source/tools/toolutil/pkg_genc.h | 25 +-
.../source/tools/toolutil/pkgitems.cpp | 9 +-
.../source/tools/toolutil/toolutil.cpp | 8 +-
.../source/tools/toolutil/toolutil.h | 6 +-
.../icu-small/source/tools/toolutil/ucbuf.cpp | 36 +-
deps/icu-small/source/tools/toolutil/ucbuf.h | 5 +-
deps/icu-small/source/tools/toolutil/ucm.h | 1 +
.../source/tools/toolutil/ucmstate.cpp | 1 +
.../source/tools/toolutil/unewdata.cpp | 17 +-
.../source/tools/toolutil/uoptions.h | 2 +-
.../source/tools/toolutil/uparse.cpp | 2 +-
.../source/tools/toolutil/writesrc.cpp | 4 +-
.../source/tools/toolutil/xmlparser.cpp | 33 +-
.../source/tools/toolutil/xmlparser.h | 2 +-
tools/icu/current_ver.dep | 4 +-
704 files changed, 17705 insertions(+), 11605 deletions(-)
create mode 100644 deps/icu-small/source/common/localematcher.cpp
create mode 100644 deps/icu-small/source/common/localeprioritylist.cpp
create mode 100644 deps/icu-small/source/common/localeprioritylist.h
create mode 100644 deps/icu-small/source/common/locdistance.cpp
create mode 100644 deps/icu-small/source/common/locdistance.h
create mode 100644 deps/icu-small/source/common/loclikelysubtags.cpp
create mode 100644 deps/icu-small/source/common/loclikelysubtags.h
create mode 100644 deps/icu-small/source/common/lsr.cpp
create mode 100644 deps/icu-small/source/common/lsr.h
create mode 100644 deps/icu-small/source/common/restrace.cpp
create mode 100644 deps/icu-small/source/common/restrace.h
create mode 100644 deps/icu-small/source/common/unicode/localematcher.h
rename deps/icu-small/source/data/in/{icudt64l.dat.bz2 => icudt65l.dat.bz2} (54%)
delete mode 100644 deps/icu-small/source/i18n/double-conversion-diy-fp.cpp
create mode 100644 deps/icu-small/source/i18n/double-conversion-double-to-string.cpp
create mode 100644 deps/icu-small/source/i18n/double-conversion-double-to-string.h
rename deps/icu-small/source/i18n/{double-conversion.cpp => double-conversion-string-to-double.cpp} (63%)
create mode 100644 deps/icu-small/source/i18n/double-conversion-string-to-double.h
rename deps/icu-small/source/i18n/{number_stringbuilder.cpp => formatted_string_builder.cpp} (58%)
create mode 100644 deps/icu-small/source/i18n/formatted_string_builder.h
delete mode 100644 deps/icu-small/source/i18n/number_stringbuilder.h
delete mode 100644 deps/icu-small/source/i18n/numparse_stringsegment.h
rename deps/icu-small/source/i18n/{numparse_stringsegment.cpp => string_segment.cpp} (96%)
create mode 100644 deps/icu-small/source/i18n/string_segment.h
create mode 100644 deps/icu-small/source/python/icutools/databuilder/filtration_schema.json
diff --git a/deps/icu-small/README-FULL-ICU.txt b/deps/icu-small/README-FULL-ICU.txt
index d954e58a5fa0e3..7a351738a584f8 100644
--- a/deps/icu-small/README-FULL-ICU.txt
+++ b/deps/icu-small/README-FULL-ICU.txt
@@ -1,8 +1,9 @@
ICU sources - auto generated by shrink-icu-src.py
This directory contains the ICU subset used by --with-intl=full-icu
-It is a strict subset of ICU 64 source files with the following exception(s):
-* deps/icu-small/source/data/in/icudt64l.dat.bz2 : compressed data file
+It is a strict subset of ICU 65 source files with the following exception(s):
+* deps/icu-small/source/data/in/icudt65l.dat.bz2 : compressed data file
To rebuild this directory, see ../../tools/icu/README.md
+
diff --git a/deps/icu-small/source/common/brkeng.cpp b/deps/icu-small/source/common/brkeng.cpp
index 42771b3617747d..78492db66201f1 100644
--- a/deps/icu-small/source/common/brkeng.cpp
+++ b/deps/icu-small/source/common/brkeng.cpp
@@ -78,7 +78,7 @@ UnhandledEngine::findBreaks( UText *text,
int32_t /* startPos */,
int32_t endPos,
UVector32 &/*foundBreaks*/ ) const {
- UChar32 c = utext_current32(text);
+ UChar32 c = utext_current32(text);
while((int32_t)utext_getNativeIndex(text) < endPos && fHandled->contains(c)) {
utext_next32(text); // TODO: recast loop to work with post-increment operations.
c = utext_current32(text);
@@ -129,7 +129,7 @@ ICULanguageBreakFactory::getEngineFor(UChar32 c) {
const LanguageBreakEngine *lbe = NULL;
UErrorCode status = U_ZERO_ERROR;
- static UMutex gBreakEngineMutex = U_MUTEX_INITIALIZER;
+ static UMutex gBreakEngineMutex;
Mutex m(&gBreakEngineMutex);
if (fEngines == NULL) {
@@ -149,7 +149,7 @@ ICULanguageBreakFactory::getEngineFor(UChar32 c) {
}
}
}
-
+
// We didn't find an engine. Create one.
lbe = loadEngineFor(c);
if (lbe != NULL) {
@@ -224,7 +224,7 @@ ICULanguageBreakFactory::loadEngineFor(UChar32 c) {
}
DictionaryMatcher *
-ICULanguageBreakFactory::loadDictionaryMatcherFor(UScriptCode script) {
+ICULanguageBreakFactory::loadDictionaryMatcherFor(UScriptCode script) {
UErrorCode status = U_ZERO_ERROR;
// open root from brkitr tree.
UResourceBundle *b = ures_open(U_ICUDATA_BRKITR, "", &status);
@@ -265,7 +265,7 @@ ICULanguageBreakFactory::loadDictionaryMatcherFor(UScriptCode script) {
m = new UCharsDictionaryMatcher(characters, file);
}
if (m == NULL) {
- // no matcher exists to take ownership - either we are an invalid
+ // no matcher exists to take ownership - either we are an invalid
// type or memory allocation failed
udata_close(file);
}
diff --git a/deps/icu-small/source/common/brkiter.cpp b/deps/icu-small/source/common/brkiter.cpp
index 23e0cc3c153392..3d1366a6688009 100644
--- a/deps/icu-small/source/common/brkiter.cpp
+++ b/deps/icu-small/source/common/brkiter.cpp
@@ -119,7 +119,7 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st
// If there is a result, set the valid locale and actual locale, and the kind
if (U_SUCCESS(status) && result != NULL) {
U_LOCALE_BASED(locBased, *(BreakIterator*)result);
- locBased.setLocaleIDs(ures_getLocaleByType(b, ULOC_VALID_LOCALE, &status),
+ locBased.setLocaleIDs(ures_getLocaleByType(b, ULOC_VALID_LOCALE, &status),
actualLocale.data());
}
@@ -277,7 +277,7 @@ ICUBreakIteratorService::~ICUBreakIteratorService() {}
// defined in ucln_cmn.h
U_NAMESPACE_END
-static icu::UInitOnce gInitOnceBrkiter;
+static icu::UInitOnce gInitOnceBrkiter = U_INITONCE_INITIALIZER;
static icu::ICULocaleService* gService = NULL;
@@ -299,7 +299,7 @@ static UBool U_CALLCONV breakiterator_cleanup(void) {
U_CDECL_END
U_NAMESPACE_BEGIN
-static void U_CALLCONV
+static void U_CALLCONV
initService(void) {
gService = new ICUBreakIteratorService();
ucln_common_registerCleanup(UCLN_COMMON_BREAKITERATOR, breakiterator_cleanup);
diff --git a/deps/icu-small/source/common/bytesinkutil.h b/deps/icu-small/source/common/bytesinkutil.h
index 69e4cbcd263932..6808fbe6777837 100644
--- a/deps/icu-small/source/common/bytesinkutil.h
+++ b/deps/icu-small/source/common/bytesinkutil.h
@@ -59,7 +59,7 @@ class U_COMMON_API ByteSinkUtil {
ByteSink &sink, uint32_t options, Edits *edits);
};
-class CharStringByteSink : public ByteSink {
+class U_COMMON_API CharStringByteSink : public ByteSink {
public:
CharStringByteSink(CharString* dest);
~CharStringByteSink() override;
diff --git a/deps/icu-small/source/common/caniter.cpp b/deps/icu-small/source/common/caniter.cpp
index d57c64247fc591..b28acfc84ee3b0 100644
--- a/deps/icu-small/source/common/caniter.cpp
+++ b/deps/icu-small/source/common/caniter.cpp
@@ -208,12 +208,12 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
goto CleanPartialInitialization;
}
- // i should initialy be the number of code units at the
+ // i should initialy be the number of code units at the
// start of the string
i = U16_LENGTH(source.char32At(0));
//int32_t i = 1;
// find the segments
- // This code iterates through the source string and
+ // This code iterates through the source string and
// extracts segments that end up on a codepoint that
// doesn't start any decompositions. (Analysis is done
// on the NFD form - see above).
@@ -241,7 +241,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
for (i = 0; i < current_length; i++) {
current[i] = 0;
}
- // for each segment, get all the combinations that can produce
+ // for each segment, get all the combinations that can produce
// it after NFD normalization
for (i = 0; i < pieces_length; ++i) {
//if (PROGRESS) printf("SEGMENT\n");
@@ -316,7 +316,7 @@ void U_EXPORT2 CanonicalIterator::permute(UnicodeString &source, UBool skipZeros
if(U_FAILURE(status)) {
return;
}
- // The upper remove is destructive. The question is do we have to make a copy, or we don't care about the contents
+ // The upper remove is destructive. The question is do we have to make a copy, or we don't care about the contents
// of source at this point.
// prefix this character to all of them
@@ -493,9 +493,9 @@ Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const UCh
}
/**
- * See if the decomposition of cp2 is at segment starting at segmentPos
+ * See if the decomposition of cp2 is at segment starting at segmentPos
* (with canonical rearrangment!)
- * If so, take the remainder, and return the equivalents
+ * If so, take the remainder, and return the equivalents
*/
Hashtable *CanonicalIterator::extract(Hashtable *fillinResult, UChar32 comp, const UChar *segment, int32_t segLen, int32_t segmentPos, UErrorCode &status) {
//Hashtable *CanonicalIterator::extract(UChar32 comp, const UnicodeString &segment, int32_t segLen, int32_t segmentPos, UErrorCode &status) {
diff --git a/deps/icu-small/source/common/characterproperties.cpp b/deps/icu-small/source/common/characterproperties.cpp
index 5a57364375b372..7b50a4e2051b97 100644
--- a/deps/icu-small/source/common/characterproperties.cpp
+++ b/deps/icu-small/source/common/characterproperties.cpp
@@ -38,8 +38,8 @@ UBool U_CALLCONV characterproperties_cleanup();
constexpr int32_t NUM_INCLUSIONS = UPROPS_SRC_COUNT + UCHAR_INT_LIMIT - UCHAR_INT_START;
struct Inclusion {
- UnicodeSet *fSet;
- UInitOnce fInitOnce;
+ UnicodeSet *fSet = nullptr;
+ UInitOnce fInitOnce = U_INITONCE_INITIALIZER;
};
Inclusion gInclusions[NUM_INCLUSIONS]; // cached getInclusions()
@@ -47,10 +47,7 @@ UnicodeSet *sets[UCHAR_BINARY_LIMIT] = {};
UCPMap *maps[UCHAR_INT_LIMIT - UCHAR_INT_START] = {};
-icu::UMutex *cpMutex() {
- static icu::UMutex m = U_MUTEX_INITIALIZER;
- return &m;
-}
+icu::UMutex cpMutex;
//----------------------------------------------------------------
// Inclusions list
@@ -361,7 +358,7 @@ u_getBinaryPropertySet(UProperty property, UErrorCode *pErrorCode) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return nullptr;
}
- Mutex m(cpMutex());
+ Mutex m(&cpMutex);
UnicodeSet *set = sets[property];
if (set == nullptr) {
sets[property] = set = makeSet(property, *pErrorCode);
@@ -377,7 +374,7 @@ u_getIntPropertyMap(UProperty property, UErrorCode *pErrorCode) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return nullptr;
}
- Mutex m(cpMutex());
+ Mutex m(&cpMutex);
UCPMap *map = maps[property - UCHAR_INT_START];
if (map == nullptr) {
maps[property - UCHAR_INT_START] = map = makeMap(property, *pErrorCode);
diff --git a/deps/icu-small/source/common/charstr.cpp b/deps/icu-small/source/common/charstr.cpp
index 852cc539457760..dda29dac63273c 100644
--- a/deps/icu-small/source/common/charstr.cpp
+++ b/deps/icu-small/source/common/charstr.cpp
@@ -35,6 +35,17 @@ CharString& CharString::operator=(CharString&& src) U_NOEXCEPT {
return *this;
}
+char *CharString::cloneData(UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ char *p = static_cast(uprv_malloc(len + 1));
+ if (p == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
+ uprv_memcpy(p, buffer.getAlias(), len + 1);
+ return p;
+}
+
CharString &CharString::copyFrom(const CharString &s, UErrorCode &errorCode) {
if(U_SUCCESS(errorCode) && this!=&s && ensureCapacity(s.len+1, 0, errorCode)) {
len=s.len;
@@ -52,6 +63,18 @@ int32_t CharString::lastIndexOf(char c) const {
return -1;
}
+bool CharString::contains(StringPiece s) const {
+ if (s.empty()) { return false; }
+ const char *p = buffer.getAlias();
+ int32_t lastStart = len - s.length();
+ for (int32_t i = 0; i <= lastStart; ++i) {
+ if (uprv_memcmp(p + i, s.data(), s.length()) == 0) {
+ return true;
+ }
+ }
+ return false;
+}
+
CharString &CharString::truncate(int32_t newLength) {
if(newLength<0) {
newLength=0;
diff --git a/deps/icu-small/source/common/charstr.h b/deps/icu-small/source/common/charstr.h
index 1a97e01988f991..23b950ed6ecc76 100644
--- a/deps/icu-small/source/common/charstr.h
+++ b/deps/icu-small/source/common/charstr.h
@@ -82,10 +82,24 @@ class U_COMMON_API CharString : public UMemory {
const char *data() const { return buffer.getAlias(); }
char *data() { return buffer.getAlias(); }
+ /**
+ * Allocates length()+1 chars and copies the NUL-terminated data().
+ * The caller must uprv_free() the result.
+ */
+ char *cloneData(UErrorCode &errorCode) const;
+
+ bool operator==(StringPiece other) const {
+ return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0);
+ }
+ bool operator!=(StringPiece other) const {
+ return !operator==(other);
+ }
/** @return last index of c, or -1 if c is not in this string */
int32_t lastIndexOf(char c) const;
+ bool contains(StringPiece s) const;
+
CharString &clear() { len=0; buffer[0]=0; return *this; }
CharString &truncate(int32_t newLength);
diff --git a/deps/icu-small/source/common/cmemory.cpp b/deps/icu-small/source/common/cmemory.cpp
index 0b7e432c4dee46..663c1411e4cb3b 100644
--- a/deps/icu-small/source/common/cmemory.cpp
+++ b/deps/icu-small/source/common/cmemory.cpp
@@ -38,7 +38,7 @@ static UMemFreeFn *pFree;
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
#include
static int n=0;
-static long b=0;
+static long b=0;
#endif
U_CAPI void * U_EXPORT2
diff --git a/deps/icu-small/source/common/cmemory.h b/deps/icu-small/source/common/cmemory.h
index f501b20a14ca13..7f7fd8d08642d5 100644
--- a/deps/icu-small/source/common/cmemory.h
+++ b/deps/icu-small/source/common/cmemory.h
@@ -64,45 +64,44 @@ uprv_free(void *mem);
U_CAPI void * U_EXPORT2
uprv_calloc(size_t num, size_t size) U_MALLOC_ATTR U_ALLOC_SIZE_ATTR2(1,2);
-/**
- * This should align the memory properly on any machine.
- * This is very useful for the safeClone functions.
- */
-typedef union {
- long t1;
- double t2;
- void *t3;
-} UAlignedMemory;
-
/**
* Get the least significant bits of a pointer (a memory address).
* For example, with a mask of 3, the macro gets the 2 least significant bits,
* which will be 0 if the pointer is 32-bit (4-byte) aligned.
*
- * ptrdiff_t is the most appropriate integer type to cast to.
- * size_t should work too, since on most (or all?) platforms it has the same
- * width as ptrdiff_t.
+ * uintptr_t is the most appropriate integer type to cast to.
*/
-#define U_POINTER_MASK_LSB(ptr, mask) (((ptrdiff_t)(char *)(ptr)) & (mask))
+#define U_POINTER_MASK_LSB(ptr, mask) ((uintptr_t)(ptr) & (mask))
/**
- * Get the amount of bytes that a pointer is off by from
- * the previous UAlignedMemory-aligned pointer.
- */
-#define U_ALIGNMENT_OFFSET(ptr) U_POINTER_MASK_LSB(ptr, sizeof(UAlignedMemory) - 1)
-
-/**
- * Get the amount of bytes to add to a pointer
- * in order to get the next UAlignedMemory-aligned address.
+ * Create & return an instance of "type" in statically allocated storage.
+ * e.g.
+ * static std::mutex *myMutex = STATIC_NEW(std::mutex);
+ * To destroy an object created in this way, invoke the destructor explicitly, e.g.
+ * myMutex->~mutex();
+ * DO NOT use delete.
+ * DO NOT use with class UMutex, which has specific support for static instances.
+ *
+ * STATIC_NEW is intended for use when
+ * - We want a static (or global) object.
+ * - We don't want it to ever be destructed, or to explicitly control destruction,
+ * to avoid use-after-destruction problems.
+ * - We want to avoid an ordinary heap allocated object,
+ * to avoid the possibility of memory allocation failures, and
+ * to avoid memory leak reports, from valgrind, for example.
+ * This is defined as a macro rather than a template function because each invocation
+ * must define distinct static storage for the object being returned.
*/
-#define U_ALIGNMENT_OFFSET_UP(ptr) (sizeof(UAlignedMemory) - U_ALIGNMENT_OFFSET(ptr))
+#define STATIC_NEW(type) [] () { \
+ alignas(type) static char storage[sizeof(type)]; \
+ return new(storage) type();} ()
/**
* Heap clean up function, called from u_cleanup()
* Clears any user heap functions from u_setMemoryFunctions()
* Does NOT deallocate any remaining allocated memory.
*/
-U_CFUNC UBool
+U_CFUNC UBool
cmemory_cleanup(void);
/**
diff --git a/deps/icu-small/source/common/common.rc b/deps/icu-small/source/common/common.rc
index 5c723a27c52820..020abacc0d81fe 100644
--- a/deps/icu-small/source/common/common.rc
+++ b/deps/icu-small/source/common/common.rc
@@ -18,7 +18,7 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-//
+//
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#pragma code_page(1252)
@@ -29,17 +29,17 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
// TEXTINCLUDE
//
-1 TEXTINCLUDE
+1 TEXTINCLUDE
BEGIN
"msvcres.h\0"
END
-2 TEXTINCLUDE
+2 TEXTINCLUDE
BEGIN
"#include \0"
END
-3 TEXTINCLUDE
+3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
@@ -107,3 +107,4 @@ END
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
+
diff --git a/deps/icu-small/source/common/cstr.cpp b/deps/icu-small/source/common/cstr.cpp
index 0114434329ad7e..24654f8fc22897 100644
--- a/deps/icu-small/source/common/cstr.cpp
+++ b/deps/icu-small/source/common/cstr.cpp
@@ -30,7 +30,7 @@ CStr::CStr(const UnicodeString &in) {
}
#else
// No conversion available. Convert any invariant characters; substitute '?' for the rest.
- // Note: can't just call u_UCharsToChars() or CharString.appendInvariantChars() on the
+ // Note: can't just call u_UCharsToChars() or CharString.appendInvariantChars() on the
// whole string because they require that the entire input be invariant.
char buf[2];
for (int i=0; i=2 && radix<=16);
uval = (uint32_t) v;
if(v<0 && radix == 10) {
/* Only in base 10 do we conside numbers to be signed. */
- uval = (uint32_t)(-v);
+ uval = (uint32_t)(-v);
buffer[length++] = '-';
}
-
+
tbx = sizeof(tbuf)-1;
tbuf[tbx] = 0; /* We are generating the digits backwards. Null term the end. */
do {
@@ -177,7 +177,7 @@ T_CString_integerToString(char* buffer, int32_t v, int32_t radix)
tbuf[--tbx] = (char)(T_CString_itosOffset(digit));
uval = uval / radix;
} while (uval != 0);
-
+
/* copy converted number into user buffer */
uprv_strcpy(buffer+length, tbuf+tbx);
length += sizeof(tbuf) - tbx -1;
@@ -199,15 +199,15 @@ T_CString_int64ToString(char* buffer, int64_t v, uint32_t radix)
uint8_t digit;
int32_t length = 0;
uint64_t uval;
-
+
U_ASSERT(radix>=2 && radix<=16);
uval = (uint64_t) v;
if(v<0 && radix == 10) {
/* Only in base 10 do we conside numbers to be signed. */
- uval = (uint64_t)(-v);
+ uval = (uint64_t)(-v);
buffer[length++] = '-';
}
-
+
tbx = sizeof(tbuf)-1;
tbuf[tbx] = 0; /* We are generating the digits backwards. Null term the end. */
do {
@@ -215,7 +215,7 @@ T_CString_int64ToString(char* buffer, int64_t v, uint32_t radix)
tbuf[--tbx] = (char)(T_CString_itosOffset(digit));
uval = uval / radix;
} while (uval != 0);
-
+
/* copy converted number into user buffer */
uprv_strcpy(buffer+length, tbuf+tbx);
length += sizeof(tbuf) - tbx -1;
@@ -331,7 +331,7 @@ uprv_strndup(const char *src, int32_t n) {
dup = uprv_strdup(src);
} else {
dup = (char*)uprv_malloc(n+1);
- if (dup) {
+ if (dup) {
uprv_memcpy(dup, src, n);
dup[n] = 0;
}
diff --git a/deps/icu-small/source/common/cwchar.cpp b/deps/icu-small/source/common/cwchar.cpp
index 4fd531114e8df8..20c7d71e0f0769 100644
--- a/deps/icu-small/source/common/cwchar.cpp
+++ b/deps/icu-small/source/common/cwchar.cpp
@@ -1,6 +1,6 @@
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
-/*
+/*
******************************************************************************
*
* Copyright (C) 2001, International Business Machines
@@ -52,3 +52,4 @@ U_CAPI size_t uprv_wcslen(const wchar_t *src) {
}
#endif
+
diff --git a/deps/icu-small/source/common/cwchar.h b/deps/icu-small/source/common/cwchar.h
index 939eb599d69f8f..8fd041a1b9c568 100644
--- a/deps/icu-small/source/common/cwchar.h
+++ b/deps/icu-small/source/common/cwchar.h
@@ -1,6 +1,6 @@
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
-/*
+/*
******************************************************************************
*
* Copyright (C) 2001, International Business Machines
@@ -42,11 +42,11 @@
# define uprv_wcscat wcscat
# define uprv_wcslen wcslen
#else
-U_CAPI wchar_t* U_EXPORT2
+U_CAPI wchar_t* U_EXPORT2
uprv_wcscpy(wchar_t *dst, const wchar_t *src);
-U_CAPI wchar_t* U_EXPORT2
+U_CAPI wchar_t* U_EXPORT2
uprv_wcscat(wchar_t *dst, const wchar_t *src);
-U_CAPI size_t U_EXPORT2
+U_CAPI size_t U_EXPORT2
uprv_wcslen(const wchar_t *src);
#endif
diff --git a/deps/icu-small/source/common/dictbe.cpp b/deps/icu-small/source/common/dictbe.cpp
index 6ceba21a244047..c769138ae4b391 100644
--- a/deps/icu-small/source/common/dictbe.cpp
+++ b/deps/icu-small/source/common/dictbe.cpp
@@ -67,7 +67,7 @@ DictionaryBreakEngine::findBreaks( UText *text,
rangeEnd = current;
result = divideUpDictionaryRange(text, rangeStart, rangeEnd, foundBreaks);
utext_setNativeIndex(text, current);
-
+
return result;
}
@@ -105,24 +105,24 @@ class PossibleWord {
public:
PossibleWord() : count(0), prefix(0), offset(-1), mark(0), current(0) {}
~PossibleWord() {}
-
+
// Fill the list of candidates if needed, select the longest, and return the number found
int32_t candidates( UText *text, DictionaryMatcher *dict, int32_t rangeEnd );
-
+
// Select the currently marked candidate, point after it in the text, and invalidate self
int32_t acceptMarked( UText *text );
-
+
// Back up from the current candidate to the next shorter one; return TRUE if that exists
// and point the text after it
UBool backUp( UText *text );
-
+
// Return the longest prefix this candidate location shares with a dictionary word
// Return value is in code points.
int32_t longestPrefix() { return prefix; }
-
+
// Mark the current candidate as the one we like
void markCurrent() { mark = current; }
-
+
// Get length in code points of the marked word.
int32_t markedCPLength() { return cpLengths[mark]; }
};
@@ -238,16 +238,16 @@ ThaiBreakEngine::divideUpDictionaryRange( UText *text,
int32_t current;
UErrorCode status = U_ZERO_ERROR;
PossibleWord words[THAI_LOOKAHEAD];
-
+
utext_setNativeIndex(text, rangeStart);
-
+
while (U_SUCCESS(status) && (current = (int32_t)utext_getNativeIndex(text)) < rangeEnd) {
cpWordLength = 0;
cuWordLength = 0;
// Look for candidate words at the current position
int32_t candidates = words[wordsFound%THAI_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
-
+
// If we found exactly one, use that
if (candidates == 1) {
cuWordLength = words[wordsFound % THAI_LOOKAHEAD].acceptMarked(text);
@@ -268,12 +268,12 @@ ThaiBreakEngine::divideUpDictionaryRange( UText *text,
words[wordsFound%THAI_LOOKAHEAD].markCurrent();
wordsMatched = 2;
}
-
+
// If we're already at the end of the range, we're done
if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) {
goto foundBest;
}
-
+
// See if any of the possible second words is followed by a third word
do {
// If we find a third word, stop right away
@@ -292,13 +292,13 @@ ThaiBreakEngine::divideUpDictionaryRange( UText *text,
cpWordLength = words[wordsFound % THAI_LOOKAHEAD].markedCPLength();
wordsFound += 1;
}
-
+
// We come here after having either found a word or not. We look ahead to the
// next word. If it's not a dictionary word, we will combine it with the word we
// just found (if there is one), but only if the preceding word does not exceed
// the threshold.
// The text iterator should now be positioned at the end of the word we found.
-
+
UChar32 uc = 0;
if ((int32_t)utext_getNativeIndex(text) < rangeEnd && cpWordLength < THAI_ROOT_COMBINE_THRESHOLD) {
// if it is a dictionary word, do nothing. If it isn't, then if there is
@@ -334,12 +334,12 @@ ThaiBreakEngine::divideUpDictionaryRange( UText *text,
}
}
}
-
+
// Bump the word count if there wasn't already one
if (cuWordLength <= 0) {
wordsFound += 1;
}
-
+
// Update the length with the passed-over characters
cuWordLength += chars;
}
@@ -348,14 +348,14 @@ ThaiBreakEngine::divideUpDictionaryRange( UText *text,
utext_setNativeIndex(text, current+cuWordLength);
}
}
-
+
// Never stop before a combining mark.
int32_t currPos;
while ((currPos = (int32_t)utext_getNativeIndex(text)) < rangeEnd && fMarkSet.contains(utext_current32(text))) {
utext_next32(text);
cuWordLength += (int32_t)utext_getNativeIndex(text) - currPos;
}
-
+
// Look ahead for possible suffixes if a dictionary word does not follow.
// We do this in code rather than using a rule so that the heuristic
// resynch continues to function. For example, one of the suffix characters
@@ -473,16 +473,16 @@ LaoBreakEngine::divideUpDictionaryRange( UText *text,
int32_t current;
UErrorCode status = U_ZERO_ERROR;
PossibleWord words[LAO_LOOKAHEAD];
-
+
utext_setNativeIndex(text, rangeStart);
-
+
while (U_SUCCESS(status) && (current = (int32_t)utext_getNativeIndex(text)) < rangeEnd) {
cuWordLength = 0;
cpWordLength = 0;
// Look for candidate words at the current position
int32_t candidates = words[wordsFound%LAO_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
-
+
// If we found exactly one, use that
if (candidates == 1) {
cuWordLength = words[wordsFound % LAO_LOOKAHEAD].acceptMarked(text);
@@ -503,12 +503,12 @@ LaoBreakEngine::divideUpDictionaryRange( UText *text,
words[wordsFound%LAO_LOOKAHEAD].markCurrent();
wordsMatched = 2;
}
-
+
// If we're already at the end of the range, we're done
if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) {
goto foundBest;
}
-
+
// See if any of the possible second words is followed by a third word
do {
// If we find a third word, stop right away
@@ -526,7 +526,7 @@ LaoBreakEngine::divideUpDictionaryRange( UText *text,
cpWordLength = words[wordsFound % LAO_LOOKAHEAD].markedCPLength();
wordsFound += 1;
}
-
+
// We come here after having either found a word or not. We look ahead to the
// next word. If it's not a dictionary word, we will combine it withe the word we
// just found (if there is one), but only if the preceding word does not exceed
@@ -564,12 +564,12 @@ LaoBreakEngine::divideUpDictionaryRange( UText *text,
}
}
}
-
+
// Bump the word count if there wasn't already one
if (cuWordLength <= 0) {
wordsFound += 1;
}
-
+
// Update the length with the passed-over characters
cuWordLength += chars;
}
@@ -578,14 +578,14 @@ LaoBreakEngine::divideUpDictionaryRange( UText *text,
utext_setNativeIndex(text, current + cuWordLength);
}
}
-
+
// Never stop before a combining mark.
int32_t currPos;
while ((currPos = (int32_t)utext_getNativeIndex(text)) < rangeEnd && fMarkSet.contains(utext_current32(text))) {
utext_next32(text);
cuWordLength += (int32_t)utext_getNativeIndex(text) - currPos;
}
-
+
// Look ahead for possible suffixes if a dictionary word does not follow.
// We do this in code rather than using a rule so that the heuristic
// resynch continues to function. For example, one of the suffix characters
@@ -666,16 +666,16 @@ BurmeseBreakEngine::divideUpDictionaryRange( UText *text,
int32_t current;
UErrorCode status = U_ZERO_ERROR;
PossibleWord words[BURMESE_LOOKAHEAD];
-
+
utext_setNativeIndex(text, rangeStart);
-
+
while (U_SUCCESS(status) && (current = (int32_t)utext_getNativeIndex(text)) < rangeEnd) {
cuWordLength = 0;
cpWordLength = 0;
// Look for candidate words at the current position
int32_t candidates = words[wordsFound%BURMESE_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
-
+
// If we found exactly one, use that
if (candidates == 1) {
cuWordLength = words[wordsFound % BURMESE_LOOKAHEAD].acceptMarked(text);
@@ -696,12 +696,12 @@ BurmeseBreakEngine::divideUpDictionaryRange( UText *text,
words[wordsFound%BURMESE_LOOKAHEAD].markCurrent();
wordsMatched = 2;
}
-
+
// If we're already at the end of the range, we're done
if ((int32_t)utext_getNativeIndex(text) >= rangeEnd) {
goto foundBest;
}
-
+
// See if any of the possible second words is followed by a third word
do {
// If we find a third word, stop right away
@@ -719,7 +719,7 @@ BurmeseBreakEngine::divideUpDictionaryRange( UText *text,
cpWordLength = words[wordsFound % BURMESE_LOOKAHEAD].markedCPLength();
wordsFound += 1;
}
-
+
// We come here after having either found a word or not. We look ahead to the
// next word. If it's not a dictionary word, we will combine it withe the word we
// just found (if there is one), but only if the preceding word does not exceed
@@ -757,12 +757,12 @@ BurmeseBreakEngine::divideUpDictionaryRange( UText *text,
}
}
}
-
+
// Bump the word count if there wasn't already one
if (cuWordLength <= 0) {
wordsFound += 1;
}
-
+
// Update the length with the passed-over characters
cuWordLength += chars;
}
@@ -771,14 +771,14 @@ BurmeseBreakEngine::divideUpDictionaryRange( UText *text,
utext_setNativeIndex(text, current + cuWordLength);
}
}
-
+
// Never stop before a combining mark.
int32_t currPos;
while ((currPos = (int32_t)utext_getNativeIndex(text)) < rangeEnd && fMarkSet.contains(utext_current32(text))) {
utext_next32(text);
cuWordLength += (int32_t)utext_getNativeIndex(text) - currPos;
}
-
+
// Look ahead for possible suffixes if a dictionary word does not follow.
// We do this in code rather than using a rule so that the heuristic
// resynch continues to function. For example, one of the suffix characters
@@ -1027,7 +1027,7 @@ KhmerBreakEngine::divideUpDictionaryRange( UText *text,
foundBreaks.push((current+cuWordLength), status);
}
}
-
+
// Don't return a break for the end of the dictionary range if there is one there.
if (foundBreaks.peeki() >= rangeEnd) {
(void) foundBreaks.popi();
@@ -1098,7 +1098,7 @@ static inline int32_t utext_i32_flag(int32_t bitIndex) {
return (int32_t)1 << bitIndex;
}
-
+
/*
* @param text A UText representing the text
* @param rangeStart The start of the range of dictionary characters
@@ -1106,7 +1106,7 @@ static inline int32_t utext_i32_flag(int32_t bitIndex) {
* @param foundBreaks vector to receive the break positions
* @return The number of breaks found
*/
-int32_t
+int32_t
CjkBreakEngine::divideUpDictionaryRange( UText *inText,
int32_t rangeStart,
int32_t rangeEnd,
@@ -1169,7 +1169,7 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
if (U_FAILURE(status)) {
return 0;
}
-
+
UnicodeString fragment;
UnicodeString normalizedFragment;
for (int32_t srcI = 0; srcI < inString.length();) { // Once per normalization chunk
@@ -1238,7 +1238,7 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
}
}
}
-
+
// bestSnlp[i] is the snlp of the best segmentation of the first i
// code points in the range to be matched.
UVector32 bestSnlp(numCodePts + 1, status);
@@ -1248,7 +1248,7 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
}
- // prev[i] is the index of the last CJK code point in the previous word in
+ // prev[i] is the index of the last CJK code point in the previous word in
// the best segmentation of the first i characters.
UVector32 prev(numCodePts + 1, status);
for(int32_t i = 0; i <= numCodePts; i++){
@@ -1283,8 +1283,8 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
// Note: lengths is filled with code point lengths
// The NULL parameter is the ignored code unit lengths.
- // if there are no single character matches found in the dictionary
- // starting with this character, treat character as a 1-character word
+ // if there are no single character matches found in the dictionary
+ // starting with this character, treat character as a 1-character word
// with the highest value possible, i.e. the least likely to occur.
// Exclude Korean characters from this treatment, as they should be left
// together by default.
@@ -1357,7 +1357,7 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
numBreaks++;
}
- // Now that we're done, convert positions in t_boundary[] (indices in
+ // Now that we're done, convert positions in t_boundary[] (indices in
// the normalized input string) back to indices in the original input UText
// while reversing t_boundary and pushing values to foundBreaks.
int32_t prevCPPos = -1;
@@ -1391,3 +1391,4 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
+
diff --git a/deps/icu-small/source/common/dictbe.h b/deps/icu-small/source/common/dictbe.h
index 99d176cc2e7bcf..731bfdff9f225e 100644
--- a/deps/icu-small/source/common/dictbe.h
+++ b/deps/icu-small/source/common/dictbe.h
@@ -68,7 +68,7 @@ class DictionaryBreakEngine : public LanguageBreakEngine {
* Find any breaks within a run in the supplied text.
*
* @param text A UText representing the text. The iterator is left at
- * the end of the run of characters which the engine is capable of handling
+ * the end of the run of characters which the engine is capable of handling
* that starts from the first character in the range.
* @param startPos The start of the run within the supplied text.
* @param endPos The end of the run within the supplied text.
@@ -218,118 +218,118 @@ class LaoBreakEngine : public DictionaryBreakEngine {
};
-/*******************************************************************
- * BurmeseBreakEngine
- */
-
-/**
- * BurmeseBreakEngine is a kind of DictionaryBreakEngine that uses a
- * DictionaryMatcher and heuristics to determine Burmese-specific breaks.
- *
- * After it is constructed a BurmeseBreakEngine may be shared between
- * threads without synchronization.
- */
-class BurmeseBreakEngine : public DictionaryBreakEngine {
- private:
- /**
- * The set of characters handled by this engine
- * @internal
- */
-
- UnicodeSet fBurmeseWordSet;
- UnicodeSet fEndWordSet;
- UnicodeSet fBeginWordSet;
- UnicodeSet fMarkSet;
- DictionaryMatcher *fDictionary;
-
- public:
-
- /**
- * Default constructor.
- *
- * @param adoptDictionary A DictionaryMatcher to adopt. Deleted when the
- * engine is deleted.
- */
- BurmeseBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status);
-
- /**
- * Virtual destructor.
- */
- virtual ~BurmeseBreakEngine();
-
- protected:
- /**
- * Divide up a range of known dictionary characters.
- *
- * @param text A UText representing the text
- * @param rangeStart The start of the range of dictionary characters
- * @param rangeEnd The end of the range of dictionary characters
- * @param foundBreaks Output of C array of int32_t break positions, or 0
- * @return The number of breaks found
- */
- virtual int32_t divideUpDictionaryRange( UText *text,
- int32_t rangeStart,
- int32_t rangeEnd,
- UVector32 &foundBreaks ) const;
-
-};
-
-/*******************************************************************
- * KhmerBreakEngine
- */
-
-/**
- * KhmerBreakEngine is a kind of DictionaryBreakEngine that uses a
- * DictionaryMatcher and heuristics to determine Khmer-specific breaks.
- *
- * After it is constructed a KhmerBreakEngine may be shared between
- * threads without synchronization.
- */
-class KhmerBreakEngine : public DictionaryBreakEngine {
- private:
- /**
- * The set of characters handled by this engine
- * @internal
- */
-
- UnicodeSet fKhmerWordSet;
- UnicodeSet fEndWordSet;
- UnicodeSet fBeginWordSet;
- UnicodeSet fMarkSet;
- DictionaryMatcher *fDictionary;
-
- public:
-
- /**
- * Default constructor.
- *
- * @param adoptDictionary A DictionaryMatcher to adopt. Deleted when the
- * engine is deleted.
- */
- KhmerBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status);
-
- /**
- * Virtual destructor.
- */
- virtual ~KhmerBreakEngine();
-
- protected:
- /**
- * Divide up a range of known dictionary characters.
- *
- * @param text A UText representing the text
- * @param rangeStart The start of the range of dictionary characters
- * @param rangeEnd The end of the range of dictionary characters
- * @param foundBreaks Output of C array of int32_t break positions, or 0
- * @return The number of breaks found
- */
- virtual int32_t divideUpDictionaryRange( UText *text,
- int32_t rangeStart,
- int32_t rangeEnd,
- UVector32 &foundBreaks ) const;
-
-};
-
+/*******************************************************************
+ * BurmeseBreakEngine
+ */
+
+/**
+ * BurmeseBreakEngine is a kind of DictionaryBreakEngine that uses a
+ * DictionaryMatcher and heuristics to determine Burmese-specific breaks.
+ *
+ * After it is constructed a BurmeseBreakEngine may be shared between
+ * threads without synchronization.
+ */
+class BurmeseBreakEngine : public DictionaryBreakEngine {
+ private:
+ /**
+ * The set of characters handled by this engine
+ * @internal
+ */
+
+ UnicodeSet fBurmeseWordSet;
+ UnicodeSet fEndWordSet;
+ UnicodeSet fBeginWordSet;
+ UnicodeSet fMarkSet;
+ DictionaryMatcher *fDictionary;
+
+ public:
+
+ /**
+ * Default constructor.
+ *
+ * @param adoptDictionary A DictionaryMatcher to adopt. Deleted when the
+ * engine is deleted.
+ */
+ BurmeseBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status);
+
+ /**
+ * Virtual destructor.
+ */
+ virtual ~BurmeseBreakEngine();
+
+ protected:
+ /**
+ * Divide up a range of known dictionary characters.
+ *
+ * @param text A UText representing the text
+ * @param rangeStart The start of the range of dictionary characters
+ * @param rangeEnd The end of the range of dictionary characters
+ * @param foundBreaks Output of C array of int32_t break positions, or 0
+ * @return The number of breaks found
+ */
+ virtual int32_t divideUpDictionaryRange( UText *text,
+ int32_t rangeStart,
+ int32_t rangeEnd,
+ UVector32 &foundBreaks ) const;
+
+};
+
+/*******************************************************************
+ * KhmerBreakEngine
+ */
+
+/**
+ * KhmerBreakEngine is a kind of DictionaryBreakEngine that uses a
+ * DictionaryMatcher and heuristics to determine Khmer-specific breaks.
+ *
+ * After it is constructed a KhmerBreakEngine may be shared between
+ * threads without synchronization.
+ */
+class KhmerBreakEngine : public DictionaryBreakEngine {
+ private:
+ /**
+ * The set of characters handled by this engine
+ * @internal
+ */
+
+ UnicodeSet fKhmerWordSet;
+ UnicodeSet fEndWordSet;
+ UnicodeSet fBeginWordSet;
+ UnicodeSet fMarkSet;
+ DictionaryMatcher *fDictionary;
+
+ public:
+
+ /**
+ * Default constructor.
+ *
+ * @param adoptDictionary A DictionaryMatcher to adopt. Deleted when the
+ * engine is deleted.
+ */
+ KhmerBreakEngine(DictionaryMatcher *adoptDictionary, UErrorCode &status);
+
+ /**
+ * Virtual destructor.
+ */
+ virtual ~KhmerBreakEngine();
+
+ protected:
+ /**
+ * Divide up a range of known dictionary characters.
+ *
+ * @param text A UText representing the text
+ * @param rangeStart The start of the range of dictionary characters
+ * @param rangeEnd The end of the range of dictionary characters
+ * @param foundBreaks Output of C array of int32_t break positions, or 0
+ * @return The number of breaks found
+ */
+ virtual int32_t divideUpDictionaryRange( UText *text,
+ int32_t rangeStart,
+ int32_t rangeEnd,
+ UVector32 &foundBreaks ) const;
+
+};
+
#if !UCONFIG_NO_NORMALIZATION
/*******************************************************************
diff --git a/deps/icu-small/source/common/dictionarydata.cpp b/deps/icu-small/source/common/dictionarydata.cpp
index 0efa5874931a07..6e2dbee5b618be 100644
--- a/deps/icu-small/source/common/dictionarydata.cpp
+++ b/deps/icu-small/source/common/dictionarydata.cpp
@@ -30,7 +30,7 @@ const int32_t DictionaryData::TRANSFORM_NONE = 0;
const int32_t DictionaryData::TRANSFORM_TYPE_OFFSET = 0x1000000;
const int32_t DictionaryData::TRANSFORM_TYPE_MASK = 0x7f000000;
const int32_t DictionaryData::TRANSFORM_OFFSET_MASK = 0x1fffff;
-
+
DictionaryMatcher::~DictionaryMatcher() {
}
@@ -172,10 +172,10 @@ udict_swap(const UDataSwapper *ds, const void *inData, int32_t length,
headerSize = udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
if (pErrorCode == NULL || U_FAILURE(*pErrorCode)) return 0;
pInfo = (const UDataInfo *)((const char *)inData + 4);
- if (!(pInfo->dataFormat[0] == 0x44 &&
- pInfo->dataFormat[1] == 0x69 &&
- pInfo->dataFormat[2] == 0x63 &&
- pInfo->dataFormat[3] == 0x74 &&
+ if (!(pInfo->dataFormat[0] == 0x44 &&
+ pInfo->dataFormat[1] == 0x69 &&
+ pInfo->dataFormat[2] == 0x63 &&
+ pInfo->dataFormat[3] == 0x74 &&
pInfo->formatVersion[0] == 1)) {
udata_printError(ds, "udict_swap(): data format %02x.%02x.%02x.%02x (format version %02x) is not recognized as dictionary data\n",
pInfo->dataFormat[0], pInfo->dataFormat[1], pInfo->dataFormat[2], pInfo->dataFormat[3], pInfo->formatVersion[0]);
diff --git a/deps/icu-small/source/common/dictionarydata.h b/deps/icu-small/source/common/dictionarydata.h
index d86c6dfdbbc71b..0d303d9a8dcfdb 100644
--- a/deps/icu-small/source/common/dictionarydata.h
+++ b/deps/icu-small/source/common/dictionarydata.h
@@ -62,7 +62,7 @@ class U_COMMON_API DictionaryData : public UMemory {
/**
* Wrapper class around generic dictionaries, implementing matches().
* getType() should return a TRIE_TYPE_??? constant from DictionaryData.
- *
+ *
* All implementations of this interface must be thread-safe if they are to be used inside of the
* dictionary-based break iteration code.
*/
diff --git a/deps/icu-small/source/common/dtintrv.cpp b/deps/icu-small/source/common/dtintrv.cpp
index dee637e62c07d4..80bb5d6dbd13f8 100644
--- a/deps/icu-small/source/common/dtintrv.cpp
+++ b/deps/icu-small/source/common/dtintrv.cpp
@@ -5,7 +5,7 @@
* others. All Rights Reserved.
*******************************************************************************
*
-* File DTINTRV.CPP
+* File DTINTRV.CPP
*
*******************************************************************************
*/
@@ -34,7 +34,7 @@ DateInterval::~DateInterval(){}
DateInterval::DateInterval(const DateInterval& other)
: UObject(other) {
*this = other;
-}
+}
DateInterval&
@@ -47,16 +47,17 @@ DateInterval::operator=(const DateInterval& other) {
}
-DateInterval*
+DateInterval*
DateInterval::clone() const {
return new DateInterval(*this);
}
-UBool
-DateInterval::operator==(const DateInterval& other) const {
+UBool
+DateInterval::operator==(const DateInterval& other) const {
return ( fromDate == other.fromDate && toDate == other.toDate );
}
U_NAMESPACE_END
+
diff --git a/deps/icu-small/source/common/edits.cpp b/deps/icu-small/source/common/edits.cpp
index 00a8d601a1cc80..95f0c19a728cf4 100644
--- a/deps/icu-small/source/common/edits.cpp
+++ b/deps/icu-small/source/common/edits.cpp
@@ -243,7 +243,7 @@ UBool Edits::growArray() {
return TRUE;
}
-UBool Edits::copyErrorTo(UErrorCode &outErrorCode) {
+UBool Edits::copyErrorTo(UErrorCode &outErrorCode) const {
if (U_FAILURE(outErrorCode)) { return TRUE; }
if (U_SUCCESS(errorCode_)) { return FALSE; }
outErrorCode = errorCode_;
diff --git a/deps/icu-small/source/common/filteredbrk.cpp b/deps/icu-small/source/common/filteredbrk.cpp
index 162b38de5d6fa2..c07128cbce10e1 100644
--- a/deps/icu-small/source/common/filteredbrk.cpp
+++ b/deps/icu-small/source/common/filteredbrk.cpp
@@ -137,7 +137,7 @@ static const UChar kFULLSTOP = 0x002E; // '.'
*/
class SimpleFilteredSentenceBreakData : public UMemory {
public:
- SimpleFilteredSentenceBreakData(UCharsTrie *forwards, UCharsTrie *backwards )
+ SimpleFilteredSentenceBreakData(UCharsTrie *forwards, UCharsTrie *backwards )
: fForwardsPartialTrie(forwards), fBackwardsTrie(backwards), refcount(1) { }
SimpleFilteredSentenceBreakData *incr() { refcount++; return this; }
SimpleFilteredSentenceBreakData *decr() { if((--refcount) <= 0) delete this; return 0; }
@@ -173,7 +173,7 @@ class SimpleFilteredSentenceBreakIterator : public BreakIterator {
status = U_SAFECLONE_ALLOCATED_WARNING;
return clone();
}
- virtual BreakIterator* clone(void) const { return new SimpleFilteredSentenceBreakIterator(*this); }
+ virtual SimpleFilteredSentenceBreakIterator* clone() const { return new SimpleFilteredSentenceBreakIterator(*this); }
virtual UClassID getDynamicClassID(void) const { return NULL; }
virtual UBool operator==(const BreakIterator& o) const { if(this==&o) return true; return false; }
@@ -217,7 +217,7 @@ class SimpleFilteredSentenceBreakIterator : public BreakIterator {
int32_t internalPrev(int32_t n);
/**
* set up the UText with the value of the fDelegate.
- * Call this before calling breakExceptionAt.
+ * Call this before calling breakExceptionAt.
* May be able to avoid excess calls
*/
void resetState(UErrorCode &status);
@@ -361,7 +361,7 @@ SimpleFilteredSentenceBreakIterator::internalNext(int32_t n) {
default:
case kNoExceptionHere:
return n;
- }
+ }
}
return n;
}
@@ -390,7 +390,7 @@ SimpleFilteredSentenceBreakIterator::internalPrev(int32_t n) {
default:
case kNoExceptionHere:
return n;
- }
+ }
}
return n;
}
@@ -433,9 +433,9 @@ UBool SimpleFilteredSentenceBreakIterator::isBoundary(int32_t offset) {
default:
case kNoExceptionHere:
return true;
- }
+ }
}
-
+
int32_t
SimpleFilteredSentenceBreakIterator::next(int32_t offset) {
return internalNext(fDelegate->next(offset));
@@ -472,7 +472,7 @@ SimpleFilteredBreakIteratorBuilder::~SimpleFilteredBreakIteratorBuilder()
{
}
-SimpleFilteredBreakIteratorBuilder::SimpleFilteredBreakIteratorBuilder(UErrorCode &status)
+SimpleFilteredBreakIteratorBuilder::SimpleFilteredBreakIteratorBuilder(UErrorCode &status)
: fSet(status)
{
}
@@ -483,16 +483,16 @@ SimpleFilteredBreakIteratorBuilder::SimpleFilteredBreakIteratorBuilder(const Loc
if(U_SUCCESS(status)) {
UErrorCode subStatus = U_ZERO_ERROR;
LocalUResourceBundlePointer b(ures_open(U_ICUDATA_BRKITR, fromLocale.getBaseName(), &subStatus));
- if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) {
- status = subStatus; // copy the failing status
+ if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) {
+ status = subStatus; // copy the failing status
#if FB_DEBUG
fprintf(stderr, "open BUNDLE %s : %s, %s\n", fromLocale.getBaseName(), "[exit]", u_errorName(status));
#endif
return; // leaves the builder empty, if you try to use it.
}
LocalUResourceBundlePointer exceptions(ures_getByKeyWithFallback(b.getAlias(), "exceptions", NULL, &subStatus));
- if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) {
- status = subStatus; // copy the failing status
+ if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) {
+ status = subStatus; // copy the failing status
#if FB_DEBUG
fprintf(stderr, "open EXCEPTIONS %s : %s, %s\n", fromLocale.getBaseName(), "[exit]", u_errorName(status));
#endif
@@ -506,9 +506,9 @@ SimpleFilteredBreakIteratorBuilder::SimpleFilteredBreakIteratorBuilder(const Loc
fprintf(stderr, "open SentenceBreak %s => %s, %s\n", fromLocale.getBaseName(), ures_getLocale(breaks.getAlias(), &subsub), u_errorName(subStatus));
}
#endif
-
- if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) {
- status = subStatus; // copy the failing status
+
+ if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) {
+ status = subStatus; // copy the failing status
#if FB_DEBUG
fprintf(stderr, "open %s : %s, %s\n", fromLocale.getBaseName(), "[exit]", u_errorName(status));
#endif
@@ -516,7 +516,7 @@ SimpleFilteredBreakIteratorBuilder::SimpleFilteredBreakIteratorBuilder(const Loc
}
LocalUResourceBundlePointer strs;
- subStatus = status; // Pick up inherited warning status now
+ subStatus = status; // Pick up inherited warning status now
do {
strs.adoptInstead(ures_getNextResource(breaks.getAlias(), strs.orphan(), &subStatus));
if(strs.isValid() && U_SUCCESS(subStatus)) {
@@ -573,7 +573,7 @@ SimpleFilteredBreakIteratorBuilder::build(BreakIterator* adoptBreakIterator, UEr
int32_t subCount = fSet.size();
UnicodeString *ustrs_ptr = newUnicodeStringArray(subCount);
-
+
LocalArray ustrs(ustrs_ptr);
LocalMemory partials;
diff --git a/deps/icu-small/source/common/hash.h b/deps/icu-small/source/common/hash.h
index fa1e4ee9affc7b..f02cb7087a508b 100644
--- a/deps/icu-small/source/common/hash.h
+++ b/deps/icu-small/source/common/hash.h
@@ -245,3 +245,4 @@ inline UBool Hashtable::equals(const Hashtable& that)const{
U_NAMESPACE_END
#endif
+
diff --git a/deps/icu-small/source/common/icudataver.cpp b/deps/icu-small/source/common/icudataver.cpp
index 6dd3ea1baee607..d31441137416be 100644
--- a/deps/icu-small/source/common/icudataver.cpp
+++ b/deps/icu-small/source/common/icudataver.cpp
@@ -16,11 +16,11 @@
U_CAPI void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status) {
UResourceBundle *icudatares = NULL;
-
+
if (U_FAILURE(*status)) {
return;
}
-
+
if (dataVersionFillin != NULL) {
icudatares = ures_openDirect(NULL, U_ICU_VERSION_BUNDLE , status);
if (U_SUCCESS(*status)) {
diff --git a/deps/icu-small/source/common/icuplug.cpp b/deps/icu-small/source/common/icuplug.cpp
index c3c8231b77d572..c6439cc819a322 100644
--- a/deps/icu-small/source/common/icuplug.cpp
+++ b/deps/icu-small/source/common/icuplug.cpp
@@ -45,7 +45,7 @@ using namespace icu;
#endif
/**
- * Internal structure of an ICU plugin.
+ * Internal structure of an ICU plugin.
*/
struct UPlugData {
@@ -75,21 +75,21 @@ struct UPlugData {
* @param listSize the number of entries in the list
* @param memberSize the size of one member
* @param itemToRemove the item number of the member
- * @return the new listsize
+ * @return the new listsize
*/
static int32_t uplug_removeEntryAt(void *list, int32_t listSize, int32_t memberSize, int32_t itemToRemove) {
uint8_t *bytePtr = (uint8_t *)list;
-
+
/* get rid of some bad cases first */
if(listSize<1) {
return listSize;
}
-
+
/* is there anything to move? */
if(listSize > itemToRemove+1) {
memmove(bytePtr+(itemToRemove*memberSize), bytePtr+((itemToRemove+1)*memberSize), memberSize);
}
-
+
return listSize-1;
}
@@ -98,13 +98,13 @@ static int32_t uplug_removeEntryAt(void *list, int32_t listSize, int32_t memberS
#if U_ENABLE_DYLOAD
/**
- * Library management. Internal.
+ * Library management. Internal.
* @internal
*/
struct UPlugLibrary;
/**
- * Library management. Internal.
+ * Library management. Internal.
* @internal
*/
typedef struct UPlugLibrary {
@@ -125,7 +125,7 @@ static int32_t libraryMax = UPLUG_LIBRARY_INITIAL_COUNT;
*/
static int32_t searchForLibraryName(const char *libName) {
int32_t i;
-
+
for(i=0;i=pastPlug) {
return NULL;
} else {
@@ -286,7 +286,7 @@ static void uplug_callPlug(UPlugData *plug, UPlugReason reason, UErrorCode *stat
static void uplug_unloadPlug(UPlugData *plug, UErrorCode *status) {
if(plug->awaitingLoad) { /* shouldn't happen. Plugin hasn'tbeen loaded yet.*/
*status = U_INTERNAL_PROGRAM_ERROR;
- return;
+ return;
}
if(U_SUCCESS(plug->pluginStatus)) {
/* Don't unload a plug which has a failing load status - means it didn't actually load. */
@@ -297,11 +297,11 @@ static void uplug_unloadPlug(UPlugData *plug, UErrorCode *status) {
static void uplug_queryPlug(UPlugData *plug, UErrorCode *status) {
if(!plug->awaitingLoad || !(plug->level == UPLUG_LEVEL_UNKNOWN) ) { /* shouldn't happen. Plugin hasn'tbeen loaded yet.*/
*status = U_INTERNAL_PROGRAM_ERROR;
- return;
+ return;
}
plug->level = UPLUG_LEVEL_INVALID;
uplug_callPlug(plug, UPLUG_REASON_QUERY, status);
- if(U_SUCCESS(*status)) {
+ if(U_SUCCESS(*status)) {
if(plug->level == UPLUG_LEVEL_INVALID) {
plug->pluginStatus = U_PLUGIN_DIDNT_SET_LEVEL;
plug->awaitingLoad = FALSE;
@@ -372,17 +372,17 @@ static UPlugData *uplug_allocatePlug(UPlugEntrypoint *entrypoint, const char *co
} else {
plug->config[0] = 0;
}
-
+
if(symName!=NULL) {
uprv_strncpy(plug->sym, symName, UPLUG_NAME_MAX);
} else {
plug->sym[0] = 0;
}
-
+
plug->entrypoint = entrypoint;
plug->lib = lib;
uplug_queryPlug(plug, status);
-
+
return plug;
}
@@ -421,7 +421,7 @@ uplug_removePlug(UPlugData *plug, UErrorCode *status) {
UPlugData *cursor = NULL;
UPlugData *plugToRemove = NULL;
if(U_FAILURE(*status)) return;
-
+
for(cursor=pluginList;cursor!=NULL;) {
if(cursor==plug) {
plugToRemove = plug;
@@ -430,14 +430,14 @@ uplug_removePlug(UPlugData *plug, UErrorCode *status) {
cursor = uplug_nextPlug(cursor);
}
}
-
+
uplug_doUnloadPlug(plugToRemove, status);
}
-U_CAPI void U_EXPORT2
+U_CAPI void U_EXPORT2
uplug_setPlugNoUnload(UPlugData *data, UBool dontUnload)
{
data->dontUnload = dontUnload;
@@ -508,10 +508,10 @@ uplug_getConfiguration(UPlugData *data) {
}
U_INTERNAL UPlugData* U_EXPORT2
-uplug_getPlugInternal(int32_t n) {
+uplug_getPlugInternal(int32_t n) {
if(n <0 || n >= pluginCount) {
return NULL;
- } else {
+ } else {
return &(pluginList[n]);
}
}
@@ -551,7 +551,7 @@ uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UE
#if U_ENABLE_DYLOAD
-static UPlugData*
+static UPlugData*
uplug_initErrorPlug(const char *libName, const char *sym, const char *config, const char *nameOrError, UErrorCode loadStatus, UErrorCode *status)
{
UPlugData *plug = uplug_allocateEmptyPlug(status);
@@ -583,7 +583,7 @@ uplug_initErrorPlug(const char *libName, const char *sym, const char *config, co
/**
* Fetch a plugin from DLL, and then initialize it from a library- but don't load it.
*/
-static UPlugData*
+static UPlugData*
uplug_initPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status) {
void *lib = NULL;
UPlugData *plug = NULL;
@@ -615,7 +615,7 @@ uplug_initPlugFromLibrary(const char *libName, const char *sym, const char *conf
}
U_CAPI UPlugData* U_EXPORT2
-uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status) {
+uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status) {
UPlugData *plug = NULL;
if(U_FAILURE(*status)) { return NULL; }
plug = uplug_initPlugFromLibrary(libName, sym, config, status);
@@ -635,7 +635,7 @@ U_CAPI UPlugLevel U_EXPORT2 uplug_getCurrentLevel() {
static UBool U_CALLCONV uplug_cleanup(void)
{
int32_t i;
-
+
UPlugData *pluginToRemove;
/* cleanup plugs */
for(i=0;iawaitingLoad = FALSE;
- }
+ }
}
- }
+ }
for(i=0;iawaitingLoad) {
- if(pluginToLoad->level == UPLUG_LEVEL_INVALID) {
+ if(pluginToLoad->level == UPLUG_LEVEL_INVALID) {
pluginToLoad->pluginStatus = U_PLUGIN_DIDNT_SET_LEVEL;
} else if(pluginToLoad->level == UPLUG_LEVEL_UNKNOWN) {
pluginToLoad->pluginStatus = U_INTERNAL_PROGRAM_ERROR;
@@ -697,7 +697,7 @@ static void uplug_loadWaitingPlugs(UErrorCode *status) {
pluginToLoad->awaitingLoad = FALSE;
}
}
-
+
#if UPLUG_TRACE
DBG((stderr, " Done Loading Plugs. Level: %d\n", (int32_t)uplug_getCurrentLevel()));
#endif
@@ -733,7 +733,7 @@ uplug_init(UErrorCode *status) {
}
if(U_FAILURE(*status)) return;
-#if defined(DEFAULT_ICU_PLUGINS)
+#if defined(DEFAULT_ICU_PLUGINS)
if(plugin_dir.isEmpty()) {
plugin_dir.append(DEFAULT_ICU_PLUGINS, -1, *status);
}
@@ -745,7 +745,7 @@ uplug_init(UErrorCode *status) {
if(!plugin_dir.isEmpty()) {
FILE *f;
-
+
CharString pluginFile;
#ifdef OS390BATCH
/* There are potentially a lot of ways to implement a plugin directory on OS390/zOS */
@@ -778,16 +778,16 @@ uplug_init(UErrorCode *status) {
#endif
return;
}
-
- /* plugin_file is not used for processing - it is only used
+
+ /* plugin_file is not used for processing - it is only used
so that uplug_getPluginFile() works (i.e. icuinfo)
*/
uprv_strncpy(plugin_file, pluginFile.data(), sizeof(plugin_file));
-
+
#if UPLUG_TRACE
DBG((stderr, "pluginfile= %s len %d/%d\n", plugin_file, (int)strlen(plugin_file), (int)sizeof(plugin_file)));
#endif
-
+
#ifdef __MVS__
if (iscics()) /* 12 Nov 2011 JAM */
{
@@ -803,8 +803,8 @@ uplug_init(UErrorCode *status) {
char linebuf[1024];
char *p, *libName=NULL, *symName=NULL, *config=NULL;
int32_t line = 0;
-
-
+
+
while(fgets(linebuf,1023,f)) {
line++;
@@ -830,7 +830,7 @@ uplug_init(UErrorCode *status) {
while(*p&&!isspace((int)*p)) {
p++;
}
-
+
if(*p) { /* has config */
*p=0;
++p;
@@ -841,7 +841,7 @@ uplug_init(UErrorCode *status) {
config = p;
}
}
-
+
/* chop whitespace at the end of the config */
if(config!=NULL&&*config!=0) {
p = config+strlen(config);
@@ -849,9 +849,9 @@ uplug_init(UErrorCode *status) {
*p=0;
}
}
-
+
/* OK, we're good. */
- {
+ {
UErrorCode subStatus = U_ZERO_ERROR;
UPlugData *plug = uplug_initPlugFromLibrary(libName, symName, config, &subStatus);
if(U_FAILURE(subStatus) && U_SUCCESS(*status)) {
@@ -880,3 +880,5 @@ uplug_init(UErrorCode *status) {
}
#endif
+
+
diff --git a/deps/icu-small/source/common/icuplugimp.h b/deps/icu-small/source/common/icuplugimp.h
index 282c639b40e271..3cad8f87f18ca2 100644
--- a/deps/icu-small/source/common/icuplugimp.h
+++ b/deps/icu-small/source/common/icuplugimp.h
@@ -9,7 +9,7 @@
******************************************************************************
*
* FILE NAME : icuplugimp.h
-*
+*
* Internal functions for the ICU plugin system
*
* Date Name Description
@@ -26,7 +26,7 @@
#if UCONFIG_ENABLE_PLUGINS
/*========================*/
-/** @{ Library Manipulation
+/** @{ Library Manipulation
*/
/**
@@ -65,7 +65,7 @@ uplug_findLibrary(void *lib, UErrorCode *status);
*/
/**
- * Initialize the plugins
+ * Initialize the plugins
* @param status error result
* @internal - Internal use only.
*/
@@ -75,12 +75,12 @@ uplug_init(UErrorCode *status);
/**
* Get raw plug N
* @internal - Internal use only
- */
+ */
U_INTERNAL UPlugData* U_EXPORT2
uplug_getPlugInternal(int32_t n);
/**
- * Get the name of the plugin file.
+ * Get the name of the plugin file.
* @internal - Internal use only.
*/
U_INTERNAL const char* U_EXPORT2
diff --git a/deps/icu-small/source/common/localebuilder.cpp b/deps/icu-small/source/common/localebuilder.cpp
index fe931fcf759dfd..1dd8131e5895a5 100644
--- a/deps/icu-small/source/common/localebuilder.cpp
+++ b/deps/icu-small/source/common/localebuilder.cpp
@@ -157,13 +157,18 @@ _isKeywordValue(const char* key, const char* value, int32_t value_len)
}
static void
-_copyExtensions(const Locale& from, Locale* to, bool validate, UErrorCode& errorCode)
+_copyExtensions(const Locale& from, icu::StringEnumeration *keywords,
+ Locale& to, bool validate, UErrorCode& errorCode)
{
if (U_FAILURE(errorCode)) { return; }
- LocalPointer iter(from.createKeywords(errorCode));
- if (U_FAILURE(errorCode) || iter.isNull()) { return; }
+ LocalPointer ownedKeywords;
+ if (keywords == nullptr) {
+ ownedKeywords.adoptInstead(from.createKeywords(errorCode));
+ if (U_FAILURE(errorCode) || ownedKeywords.isNull()) { return; }
+ keywords = ownedKeywords.getAlias();
+ }
const char* key;
- while ((key = iter->next(nullptr, errorCode)) != nullptr) {
+ while ((key = keywords->next(nullptr, errorCode)) != nullptr) {
CharString value;
CharStringByteSink sink(&value);
from.getKeywordValue(key, sink, errorCode);
@@ -176,34 +181,34 @@ _copyExtensions(const Locale& from, Locale* to, bool validate, UErrorCode& error
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
- to->setKeywordValue(key, value.data(), errorCode);
+ to.setKeywordValue(key, value.data(), errorCode);
if (U_FAILURE(errorCode)) { return; }
}
}
void static
-_clearUAttributesAndKeyType(Locale* locale, UErrorCode& errorCode)
+_clearUAttributesAndKeyType(Locale& locale, UErrorCode& errorCode)
{
// Clear Unicode attributes
- locale->setKeywordValue(kAttributeKey, "", errorCode);
+ locale.setKeywordValue(kAttributeKey, "", errorCode);
// Clear all Unicode keyword values
- LocalPointer iter(locale->createUnicodeKeywords(errorCode));
+ LocalPointer iter(locale.createUnicodeKeywords(errorCode));
if (U_FAILURE(errorCode) || iter.isNull()) { return; }
const char* key;
while ((key = iter->next(nullptr, errorCode)) != nullptr) {
- locale->setUnicodeKeywordValue(key, nullptr, errorCode);
+ locale.setUnicodeKeywordValue(key, nullptr, errorCode);
}
}
static void
-_setUnicodeExtensions(Locale* locale, const CharString& value, UErrorCode& errorCode)
+_setUnicodeExtensions(Locale& locale, const CharString& value, UErrorCode& errorCode)
{
// Add the unicode extensions to extensions_
CharString locale_str("und-u-", errorCode);
locale_str.append(value, errorCode);
_copyExtensions(
- Locale::forLanguageTag(locale_str.data(), errorCode),
+ Locale::forLanguageTag(locale_str.data(), errorCode), nullptr,
locale, false, errorCode);
}
@@ -235,10 +240,10 @@ LocaleBuilder& LocaleBuilder::setExtension(char key, StringPiece value)
status_);
return *this;
}
- _clearUAttributesAndKeyType(extensions_, status_);
+ _clearUAttributesAndKeyType(*extensions_, status_);
if (U_FAILURE(status_)) { return *this; }
if (!value.empty()) {
- _setUnicodeExtensions(extensions_, value_str, status_);
+ _setUnicodeExtensions(*extensions_, value_str, status_);
}
return *this;
}
@@ -401,6 +406,24 @@ Locale makeBogusLocale() {
return bogus;
}
+void LocaleBuilder::copyExtensionsFrom(const Locale& src, UErrorCode& errorCode)
+{
+ if (U_FAILURE(errorCode)) { return; }
+ LocalPointer keywords(src.createKeywords(errorCode));
+ if (U_FAILURE(errorCode) || keywords.isNull() || keywords->count(errorCode) == 0) {
+ // Error, or no extensions to copy.
+ return;
+ }
+ if (extensions_ == nullptr) {
+ extensions_ = new Locale();
+ if (extensions_ == nullptr) {
+ status_ = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ }
+ _copyExtensions(src, keywords.getAlias(), *extensions_, false, errorCode);
+}
+
Locale LocaleBuilder::build(UErrorCode& errorCode)
{
if (U_FAILURE(errorCode)) {
@@ -425,7 +448,7 @@ Locale LocaleBuilder::build(UErrorCode& errorCode)
}
Locale product(locale_str.data());
if (extensions_ != nullptr) {
- _copyExtensions(*extensions_, &product, true, errorCode);
+ _copyExtensions(*extensions_, nullptr, product, true, errorCode);
}
if (U_FAILURE(errorCode)) {
return makeBogusLocale();
@@ -433,4 +456,13 @@ Locale LocaleBuilder::build(UErrorCode& errorCode)
return product;
}
+UBool LocaleBuilder::copyErrorTo(UErrorCode &outErrorCode) const {
+ if (U_FAILURE(outErrorCode)) {
+ // Do not overwrite the older error code
+ return TRUE;
+ }
+ outErrorCode = status_;
+ return U_FAILURE(outErrorCode);
+}
+
U_NAMESPACE_END
diff --git a/deps/icu-small/source/common/localematcher.cpp b/deps/icu-small/source/common/localematcher.cpp
new file mode 100644
index 00000000000000..d975fe759b4ce1
--- /dev/null
+++ b/deps/icu-small/source/common/localematcher.cpp
@@ -0,0 +1,720 @@
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// localematcher.cpp
+// created: 2019may08 Markus W. Scherer
+
+#ifndef __LOCMATCHER_H__
+#define __LOCMATCHER_H__
+
+#include "unicode/utypes.h"
+#include "unicode/localebuilder.h"
+#include "unicode/localematcher.h"
+#include "unicode/locid.h"
+#include "unicode/stringpiece.h"
+#include "unicode/uobject.h"
+#include "cstring.h"
+#include "localeprioritylist.h"
+#include "loclikelysubtags.h"
+#include "locdistance.h"
+#include "lsr.h"
+#include "uassert.h"
+#include "uhash.h"
+#include "uvector.h"
+
+#define UND_LSR LSR("und", "", "")
+
+/**
+ * Indicator for the lifetime of desired-locale objects passed into the LocaleMatcher.
+ *
+ * @draft ICU 65
+ */
+enum ULocMatchLifetime {
+ /**
+ * Locale objects are temporary.
+ * The matcher will make a copy of a locale that will be used beyond one function call.
+ *
+ * @draft ICU 65
+ */
+ ULOCMATCH_TEMPORARY_LOCALES,
+ /**
+ * Locale objects are stored at least as long as the matcher is used.
+ * The matcher will keep only a pointer to a locale that will be used beyond one function call,
+ * avoiding a copy.
+ *
+ * @draft ICU 65
+ */
+ ULOCMATCH_STORED_LOCALES // TODO: permanent? cached? clone?
+};
+#ifndef U_IN_DOXYGEN
+typedef enum ULocMatchLifetime ULocMatchLifetime;
+#endif
+
+U_NAMESPACE_BEGIN
+
+LocaleMatcher::Result::Result(LocaleMatcher::Result &&src) U_NOEXCEPT :
+ desiredLocale(src.desiredLocale),
+ supportedLocale(src.supportedLocale),
+ desiredIndex(src.desiredIndex),
+ supportedIndex(src.supportedIndex),
+ desiredIsOwned(src.desiredIsOwned) {
+ if (desiredIsOwned) {
+ src.desiredLocale = nullptr;
+ src.desiredIndex = -1;
+ src.desiredIsOwned = FALSE;
+ }
+}
+
+LocaleMatcher::Result::~Result() {
+ if (desiredIsOwned) {
+ delete desiredLocale;
+ }
+}
+
+LocaleMatcher::Result &LocaleMatcher::Result::operator=(LocaleMatcher::Result &&src) U_NOEXCEPT {
+ this->~Result();
+
+ desiredLocale = src.desiredLocale;
+ supportedLocale = src.supportedLocale;
+ desiredIndex = src.desiredIndex;
+ supportedIndex = src.supportedIndex;
+ desiredIsOwned = src.desiredIsOwned;
+
+ if (desiredIsOwned) {
+ src.desiredLocale = nullptr;
+ src.desiredIndex = -1;
+ src.desiredIsOwned = FALSE;
+ }
+ return *this;
+}
+
+Locale LocaleMatcher::Result::makeResolvedLocale(UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode) || supportedLocale == nullptr) {
+ return Locale::getRoot();
+ }
+ const Locale *bestDesired = getDesiredLocale();
+ if (bestDesired == nullptr || *supportedLocale == *bestDesired) {
+ return *supportedLocale;
+ }
+ LocaleBuilder b;
+ b.setLocale(*supportedLocale);
+
+ // Copy the region from bestDesired, if there is one.
+ const char *region = bestDesired->getCountry();
+ if (*region != 0) {
+ b.setRegion(region);
+ }
+
+ // Copy the variants from bestDesired, if there are any.
+ // Note that this will override any supportedLocale variants.
+ // For example, "sco-ulster-fonipa" + "...-fonupa" => "sco-fonupa" (replacing ulster).
+ const char *variants = bestDesired->getVariant();
+ if (*variants != 0) {
+ b.setVariant(variants);
+ }
+
+ // Copy the extensions from bestDesired, if there are any.
+ // C++ note: The following note, copied from Java, may not be true,
+ // as long as C++ copies by legacy ICU keyword, not by extension singleton.
+ // Note that this will override any supportedLocale extensions.
+ // For example, "th-u-nu-latn-ca-buddhist" + "...-u-nu-native" => "th-u-nu-native"
+ // (replacing calendar).
+ b.copyExtensionsFrom(*bestDesired, errorCode);
+ return b.build(errorCode);
+}
+
+LocaleMatcher::Builder::Builder(LocaleMatcher::Builder &&src) U_NOEXCEPT :
+ errorCode_(src.errorCode_),
+ supportedLocales_(src.supportedLocales_),
+ thresholdDistance_(src.thresholdDistance_),
+ demotion_(src.demotion_),
+ defaultLocale_(src.defaultLocale_),
+ favor_(src.favor_) {
+ src.supportedLocales_ = nullptr;
+ src.defaultLocale_ = nullptr;
+}
+
+LocaleMatcher::Builder::~Builder() {
+ delete supportedLocales_;
+ delete defaultLocale_;
+}
+
+LocaleMatcher::Builder &LocaleMatcher::Builder::operator=(LocaleMatcher::Builder &&src) U_NOEXCEPT {
+ this->~Builder();
+
+ errorCode_ = src.errorCode_;
+ supportedLocales_ = src.supportedLocales_;
+ thresholdDistance_ = src.thresholdDistance_;
+ demotion_ = src.demotion_;
+ defaultLocale_ = src.defaultLocale_;
+ favor_ = src.favor_;
+
+ src.supportedLocales_ = nullptr;
+ src.defaultLocale_ = nullptr;
+ return *this;
+}
+
+void LocaleMatcher::Builder::clearSupportedLocales() {
+ if (supportedLocales_ != nullptr) {
+ supportedLocales_->removeAllElements();
+ }
+}
+
+bool LocaleMatcher::Builder::ensureSupportedLocaleVector() {
+ if (U_FAILURE(errorCode_)) { return false; }
+ if (supportedLocales_ != nullptr) { return true; }
+ supportedLocales_ = new UVector(uprv_deleteUObject, nullptr, errorCode_);
+ if (U_FAILURE(errorCode_)) { return false; }
+ if (supportedLocales_ == nullptr) {
+ errorCode_ = U_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ return true;
+}
+
+LocaleMatcher::Builder &LocaleMatcher::Builder::setSupportedLocalesFromListString(
+ StringPiece locales) {
+ LocalePriorityList list(locales, errorCode_);
+ if (U_FAILURE(errorCode_)) { return *this; }
+ clearSupportedLocales();
+ if (!ensureSupportedLocaleVector()) { return *this; }
+ int32_t length = list.getLengthIncludingRemoved();
+ for (int32_t i = 0; i < length; ++i) {
+ Locale *locale = list.orphanLocaleAt(i);
+ if (locale == nullptr) { continue; }
+ supportedLocales_->addElement(locale, errorCode_);
+ if (U_FAILURE(errorCode_)) {
+ delete locale;
+ break;
+ }
+ }
+ return *this;
+}
+
+LocaleMatcher::Builder &LocaleMatcher::Builder::setSupportedLocales(Locale::Iterator &locales) {
+ if (U_FAILURE(errorCode_)) { return *this; }
+ clearSupportedLocales();
+ if (!ensureSupportedLocaleVector()) { return *this; }
+ while (locales.hasNext()) {
+ const Locale &locale = locales.next();
+ Locale *clone = locale.clone();
+ if (clone == nullptr) {
+ errorCode_ = U_MEMORY_ALLOCATION_ERROR;
+ break;
+ }
+ supportedLocales_->addElement(clone, errorCode_);
+ if (U_FAILURE(errorCode_)) {
+ delete clone;
+ break;
+ }
+ }
+ return *this;
+}
+
+LocaleMatcher::Builder &LocaleMatcher::Builder::addSupportedLocale(const Locale &locale) {
+ if (!ensureSupportedLocaleVector()) { return *this; }
+ Locale *clone = locale.clone();
+ if (clone == nullptr) {
+ errorCode_ = U_MEMORY_ALLOCATION_ERROR;
+ return *this;
+ }
+ supportedLocales_->addElement(clone, errorCode_);
+ if (U_FAILURE(errorCode_)) {
+ delete clone;
+ }
+ return *this;
+}
+
+LocaleMatcher::Builder &LocaleMatcher::Builder::setDefaultLocale(const Locale *defaultLocale) {
+ if (U_FAILURE(errorCode_)) { return *this; }
+ Locale *clone = nullptr;
+ if (defaultLocale != nullptr) {
+ clone = defaultLocale->clone();
+ if (clone == nullptr) {
+ errorCode_ = U_MEMORY_ALLOCATION_ERROR;
+ return *this;
+ }
+ }
+ delete defaultLocale_;
+ defaultLocale_ = clone;
+ return *this;
+}
+
+LocaleMatcher::Builder &LocaleMatcher::Builder::setFavorSubtag(ULocMatchFavorSubtag subtag) {
+ if (U_FAILURE(errorCode_)) { return *this; }
+ favor_ = subtag;
+ return *this;
+}
+
+LocaleMatcher::Builder &LocaleMatcher::Builder::setDemotionPerDesiredLocale(ULocMatchDemotion demotion) {
+ if (U_FAILURE(errorCode_)) { return *this; }
+ demotion_ = demotion;
+ return *this;
+}
+
+#if 0
+/**
+ * Internal only!
+ *
+ * @param thresholdDistance the thresholdDistance to set, with -1 = default
+ * @return this Builder object
+ * @internal
+ * @deprecated This API is ICU internal only.
+ */
+@Deprecated
+LocaleMatcher::Builder &LocaleMatcher::Builder::internalSetThresholdDistance(int32_t thresholdDistance) {
+ if (U_FAILURE(errorCode_)) { return *this; }
+ if (thresholdDistance > 100) {
+ thresholdDistance = 100;
+ }
+ thresholdDistance_ = thresholdDistance;
+ return *this;
+}
+#endif
+
+UBool LocaleMatcher::Builder::copyErrorTo(UErrorCode &outErrorCode) const {
+ if (U_FAILURE(outErrorCode)) { return TRUE; }
+ if (U_SUCCESS(errorCode_)) { return FALSE; }
+ outErrorCode = errorCode_;
+ return TRUE;
+}
+
+LocaleMatcher LocaleMatcher::Builder::build(UErrorCode &errorCode) const {
+ if (U_SUCCESS(errorCode) && U_FAILURE(errorCode_)) {
+ errorCode = errorCode_;
+ }
+ return LocaleMatcher(*this, errorCode);
+}
+
+namespace {
+
+LSR getMaximalLsrOrUnd(const XLikelySubtags &likelySubtags, const Locale &locale,
+ UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode) || locale.isBogus() || *locale.getName() == 0 /* "und" */) {
+ return UND_LSR;
+ } else {
+ return likelySubtags.makeMaximizedLsrFrom(locale, errorCode);
+ }
+}
+
+int32_t hashLSR(const UHashTok token) {
+ const LSR *lsr = static_cast(token.pointer);
+ return lsr->hashCode;
+}
+
+UBool compareLSRs(const UHashTok t1, const UHashTok t2) {
+ const LSR *lsr1 = static_cast(t1.pointer);
+ const LSR *lsr2 = static_cast(t2.pointer);
+ return *lsr1 == *lsr2;
+}
+
+bool putIfAbsent(UHashtable *lsrToIndex, const LSR &lsr, int32_t i, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return false; }
+ U_ASSERT(i > 0);
+ int32_t index = uhash_geti(lsrToIndex, &lsr);
+ if (index != 0) {
+ return false;
+ } else {
+ uhash_puti(lsrToIndex, const_cast(&lsr), i, &errorCode);
+ return U_SUCCESS(errorCode);
+ }
+}
+
+} // namespace
+
+LocaleMatcher::LocaleMatcher(const Builder &builder, UErrorCode &errorCode) :
+ likelySubtags(*XLikelySubtags::getSingleton(errorCode)),
+ localeDistance(*LocaleDistance::getSingleton(errorCode)),
+ thresholdDistance(builder.thresholdDistance_),
+ demotionPerDesiredLocale(0),
+ favorSubtag(builder.favor_),
+ supportedLocales(nullptr), lsrs(nullptr), supportedLocalesLength(0),
+ supportedLsrToIndex(nullptr),
+ supportedLSRs(nullptr), supportedIndexes(nullptr), supportedLSRsLength(0),
+ ownedDefaultLocale(nullptr), defaultLocale(nullptr), defaultLocaleIndex(-1) {
+ if (U_FAILURE(errorCode)) { return; }
+ if (thresholdDistance < 0) {
+ thresholdDistance = localeDistance.getDefaultScriptDistance();
+ }
+ supportedLocalesLength = builder.supportedLocales_ != nullptr ?
+ builder.supportedLocales_->size() : 0;
+ const Locale *def = builder.defaultLocale_;
+ int32_t idef = -1;
+ if (supportedLocalesLength > 0) {
+ // Store the supported locales in input order,
+ // so that when different types are used (e.g., language tag strings)
+ // we can return those by parallel index.
+ supportedLocales = static_cast(
+ uprv_malloc(supportedLocalesLength * sizeof(const Locale *)));
+ // Supported LRSs in input order.
+ // In C++, we store these permanently to simplify ownership management
+ // in the hash tables. Duplicate LSRs (if any) are unused overhead.
+ lsrs = new LSR[supportedLocalesLength];
+ if (supportedLocales == nullptr || lsrs == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ // If the constructor fails partway, we need null pointers for destructibility.
+ uprv_memset(supportedLocales, 0, supportedLocalesLength * sizeof(const Locale *));
+ // Also find the first supported locale whose LSR is
+ // the same as that for the default locale.
+ LSR builderDefaultLSR;
+ const LSR *defLSR = nullptr;
+ if (def != nullptr) {
+ builderDefaultLSR = getMaximalLsrOrUnd(likelySubtags, *def, errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ defLSR = &builderDefaultLSR;
+ }
+ for (int32_t i = 0; i < supportedLocalesLength; ++i) {
+ const Locale &locale = *static_cast(builder.supportedLocales_->elementAt(i));
+ supportedLocales[i] = locale.clone();
+ if (supportedLocales[i] == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ const Locale &supportedLocale = *supportedLocales[i];
+ LSR &lsr = lsrs[i] = getMaximalLsrOrUnd(likelySubtags, supportedLocale, errorCode);
+ lsr.setHashCode();
+ if (U_FAILURE(errorCode)) { return; }
+ if (idef < 0 && defLSR != nullptr && lsr == *defLSR) {
+ idef = i;
+ defLSR = &lsr; // owned pointer to put into supportedLsrToIndex
+ if (*def == supportedLocale) {
+ def = &supportedLocale; // owned pointer to keep
+ }
+ }
+ }
+
+ // We need an unordered map from LSR to first supported locale with that LSR,
+ // and an ordered list of (LSR, supported index).
+ // We insert the supported locales in the following order:
+ // 1. Default locale, if it is supported.
+ // 2. Priority locales (aka "paradigm locales") in builder order.
+ // 3. Remaining locales in builder order.
+ // In Java, we use a LinkedHashMap for both map & ordered lists.
+ // In C++, we use separate structures.
+ // We over-allocate arrays of LSRs and indexes for simplicity.
+ // We reserve slots at the array starts for the default and paradigm locales,
+ // plus enough for all supported locales.
+ // If there are few paradigm locales and few duplicate supported LSRs,
+ // then the amount of wasted space is small.
+ supportedLsrToIndex = uhash_openSize(hashLSR, compareLSRs, uhash_compareLong,
+ supportedLocalesLength, &errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ int32_t paradigmLimit = 1 + localeDistance.getParadigmLSRsLength();
+ int32_t suppLSRsCapacity = paradigmLimit + supportedLocalesLength;
+ supportedLSRs = static_cast(
+ uprv_malloc(suppLSRsCapacity * sizeof(const LSR *)));
+ supportedIndexes = static_cast(
+ uprv_malloc(suppLSRsCapacity * sizeof(int32_t)));
+ if (supportedLSRs == nullptr || supportedIndexes == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ int32_t paradigmIndex = 0;
+ int32_t otherIndex = paradigmLimit;
+ if (idef >= 0) {
+ uhash_puti(supportedLsrToIndex, const_cast(defLSR), idef + 1, &errorCode);
+ supportedLSRs[0] = defLSR;
+ supportedIndexes[0] = idef;
+ paradigmIndex = 1;
+ }
+ for (int32_t i = 0; i < supportedLocalesLength; ++i) {
+ if (i == idef) { continue; }
+ const Locale &locale = *supportedLocales[i];
+ const LSR &lsr = lsrs[i];
+ if (defLSR == nullptr) {
+ U_ASSERT(i == 0);
+ def = &locale;
+ defLSR = &lsr;
+ idef = 0;
+ uhash_puti(supportedLsrToIndex, const_cast(&lsr), 0 + 1, &errorCode);
+ supportedLSRs[0] = &lsr;
+ supportedIndexes[0] = 0;
+ paradigmIndex = 1;
+ } else if (idef >= 0 && lsr == *defLSR) {
+ // lsr == *defLSR means that this supported locale is
+ // a duplicate of the default locale.
+ // Either an explicit default locale is supported, and we added it before the loop,
+ // or there is no explicit default locale, and this is
+ // a duplicate of the first supported locale.
+ // In both cases, idef >= 0 now, so otherwise we can skip the comparison.
+ // For a duplicate, putIfAbsent() is a no-op, so nothing to do.
+ } else {
+ if (putIfAbsent(supportedLsrToIndex, lsr, i + 1, errorCode)) {
+ if (localeDistance.isParadigmLSR(lsr)) {
+ supportedLSRs[paradigmIndex] = &lsr;
+ supportedIndexes[paradigmIndex++] = i;
+ } else {
+ supportedLSRs[otherIndex] = &lsr;
+ supportedIndexes[otherIndex++] = i;
+ }
+ }
+ }
+ if (U_FAILURE(errorCode)) { return; }
+ }
+ // Squeeze out unused array slots.
+ if (paradigmIndex < paradigmLimit && paradigmLimit < otherIndex) {
+ uprv_memmove(supportedLSRs + paradigmIndex, supportedLSRs + paradigmLimit,
+ (otherIndex - paradigmLimit) * sizeof(const LSR *));
+ uprv_memmove(supportedIndexes + paradigmIndex, supportedIndexes + paradigmLimit,
+ (otherIndex - paradigmLimit) * sizeof(int32_t));
+ }
+ supportedLSRsLength = otherIndex - (paradigmLimit - paradigmIndex);
+ }
+
+ if (def != nullptr && (idef < 0 || def != supportedLocales[idef])) {
+ ownedDefaultLocale = def->clone();
+ if (ownedDefaultLocale == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ def = ownedDefaultLocale;
+ }
+ defaultLocale = def;
+ defaultLocaleIndex = idef;
+
+ if (builder.demotion_ == ULOCMATCH_DEMOTION_REGION) {
+ demotionPerDesiredLocale = localeDistance.getDefaultDemotionPerDesiredLocale();
+ }
+}
+
+LocaleMatcher::LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT :
+ likelySubtags(src.likelySubtags),
+ localeDistance(src.localeDistance),
+ thresholdDistance(src.thresholdDistance),
+ demotionPerDesiredLocale(src.demotionPerDesiredLocale),
+ favorSubtag(src.favorSubtag),
+ supportedLocales(src.supportedLocales), lsrs(src.lsrs),
+ supportedLocalesLength(src.supportedLocalesLength),
+ supportedLsrToIndex(src.supportedLsrToIndex),
+ supportedLSRs(src.supportedLSRs),
+ supportedIndexes(src.supportedIndexes),
+ supportedLSRsLength(src.supportedLSRsLength),
+ ownedDefaultLocale(src.ownedDefaultLocale), defaultLocale(src.defaultLocale),
+ defaultLocaleIndex(src.defaultLocaleIndex) {
+ src.supportedLocales = nullptr;
+ src.lsrs = nullptr;
+ src.supportedLocalesLength = 0;
+ src.supportedLsrToIndex = nullptr;
+ src.supportedLSRs = nullptr;
+ src.supportedIndexes = nullptr;
+ src.supportedLSRsLength = 0;
+ src.ownedDefaultLocale = nullptr;
+ src.defaultLocale = nullptr;
+ src.defaultLocaleIndex = -1;
+}
+
+LocaleMatcher::~LocaleMatcher() {
+ for (int32_t i = 0; i < supportedLocalesLength; ++i) {
+ delete supportedLocales[i];
+ }
+ uprv_free(supportedLocales);
+ delete[] lsrs;
+ uhash_close(supportedLsrToIndex);
+ uprv_free(supportedLSRs);
+ uprv_free(supportedIndexes);
+ delete ownedDefaultLocale;
+}
+
+LocaleMatcher &LocaleMatcher::operator=(LocaleMatcher &&src) U_NOEXCEPT {
+ this->~LocaleMatcher();
+
+ thresholdDistance = src.thresholdDistance;
+ demotionPerDesiredLocale = src.demotionPerDesiredLocale;
+ favorSubtag = src.favorSubtag;
+ supportedLocales = src.supportedLocales;
+ lsrs = src.lsrs;
+ supportedLocalesLength = src.supportedLocalesLength;
+ supportedLsrToIndex = src.supportedLsrToIndex;
+ supportedLSRs = src.supportedLSRs;
+ supportedIndexes = src.supportedIndexes;
+ supportedLSRsLength = src.supportedLSRsLength;
+ ownedDefaultLocale = src.ownedDefaultLocale;
+ defaultLocale = src.defaultLocale;
+ defaultLocaleIndex = src.defaultLocaleIndex;
+
+ src.supportedLocales = nullptr;
+ src.lsrs = nullptr;
+ src.supportedLocalesLength = 0;
+ src.supportedLsrToIndex = nullptr;
+ src.supportedLSRs = nullptr;
+ src.supportedIndexes = nullptr;
+ src.supportedLSRsLength = 0;
+ src.ownedDefaultLocale = nullptr;
+ src.defaultLocale = nullptr;
+ src.defaultLocaleIndex = -1;
+ return *this;
+}
+
+class LocaleLsrIterator {
+public:
+ LocaleLsrIterator(const XLikelySubtags &likelySubtags, Locale::Iterator &locales,
+ ULocMatchLifetime lifetime) :
+ likelySubtags(likelySubtags), locales(locales), lifetime(lifetime) {}
+
+ ~LocaleLsrIterator() {
+ if (lifetime == ULOCMATCH_TEMPORARY_LOCALES) {
+ delete remembered;
+ }
+ }
+
+ bool hasNext() const {
+ return locales.hasNext();
+ }
+
+ LSR next(UErrorCode &errorCode) {
+ current = &locales.next();
+ return getMaximalLsrOrUnd(likelySubtags, *current, errorCode);
+ }
+
+ void rememberCurrent(int32_t desiredIndex, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return; }
+ bestDesiredIndex = desiredIndex;
+ if (lifetime == ULOCMATCH_STORED_LOCALES) {
+ remembered = current;
+ } else {
+ // ULOCMATCH_TEMPORARY_LOCALES
+ delete remembered;
+ remembered = new Locale(*current);
+ if (remembered == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ }
+ }
+ }
+
+ const Locale *orphanRemembered() {
+ const Locale *rem = remembered;
+ remembered = nullptr;
+ return rem;
+ }
+
+ int32_t getBestDesiredIndex() const {
+ return bestDesiredIndex;
+ }
+
+private:
+ const XLikelySubtags &likelySubtags;
+ Locale::Iterator &locales;
+ ULocMatchLifetime lifetime;
+ const Locale *current = nullptr, *remembered = nullptr;
+ int32_t bestDesiredIndex = -1;
+};
+
+const Locale *LocaleMatcher::getBestMatch(const Locale &desiredLocale, UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ int32_t suppIndex = getBestSuppIndex(
+ getMaximalLsrOrUnd(likelySubtags, desiredLocale, errorCode),
+ nullptr, errorCode);
+ return U_SUCCESS(errorCode) && suppIndex >= 0 ? supportedLocales[suppIndex] : defaultLocale;
+}
+
+const Locale *LocaleMatcher::getBestMatch(Locale::Iterator &desiredLocales,
+ UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ if (!desiredLocales.hasNext()) {
+ return defaultLocale;
+ }
+ LocaleLsrIterator lsrIter(likelySubtags, desiredLocales, ULOCMATCH_TEMPORARY_LOCALES);
+ int32_t suppIndex = getBestSuppIndex(lsrIter.next(errorCode), &lsrIter, errorCode);
+ return U_SUCCESS(errorCode) && suppIndex >= 0 ? supportedLocales[suppIndex] : defaultLocale;
+}
+
+const Locale *LocaleMatcher::getBestMatchForListString(
+ StringPiece desiredLocaleList, UErrorCode &errorCode) const {
+ LocalePriorityList list(desiredLocaleList, errorCode);
+ LocalePriorityList::Iterator iter = list.iterator();
+ return getBestMatch(iter, errorCode);
+}
+
+LocaleMatcher::Result LocaleMatcher::getBestMatchResult(
+ const Locale &desiredLocale, UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode)) {
+ return Result(nullptr, defaultLocale, -1, defaultLocaleIndex, FALSE);
+ }
+ int32_t suppIndex = getBestSuppIndex(
+ getMaximalLsrOrUnd(likelySubtags, desiredLocale, errorCode),
+ nullptr, errorCode);
+ if (U_FAILURE(errorCode) || suppIndex < 0) {
+ return Result(nullptr, defaultLocale, -1, defaultLocaleIndex, FALSE);
+ } else {
+ return Result(&desiredLocale, supportedLocales[suppIndex], 0, suppIndex, FALSE);
+ }
+}
+
+LocaleMatcher::Result LocaleMatcher::getBestMatchResult(
+ Locale::Iterator &desiredLocales, UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode) || !desiredLocales.hasNext()) {
+ return Result(nullptr, defaultLocale, -1, defaultLocaleIndex, FALSE);
+ }
+ LocaleLsrIterator lsrIter(likelySubtags, desiredLocales, ULOCMATCH_TEMPORARY_LOCALES);
+ int32_t suppIndex = getBestSuppIndex(lsrIter.next(errorCode), &lsrIter, errorCode);
+ if (U_FAILURE(errorCode) || suppIndex < 0) {
+ return Result(nullptr, defaultLocale, -1, defaultLocaleIndex, FALSE);
+ } else {
+ return Result(lsrIter.orphanRemembered(), supportedLocales[suppIndex],
+ lsrIter.getBestDesiredIndex(), suppIndex, TRUE);
+ }
+}
+
+int32_t LocaleMatcher::getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remainingIter,
+ UErrorCode &errorCode) const {
+ if (U_FAILURE(errorCode)) { return -1; }
+ int32_t desiredIndex = 0;
+ int32_t bestSupportedLsrIndex = -1;
+ for (int32_t bestDistance = thresholdDistance;;) {
+ // Quick check for exact maximized LSR.
+ // Returns suppIndex+1 where 0 means not found.
+ if (supportedLsrToIndex != nullptr) {
+ desiredLSR.setHashCode();
+ int32_t index = uhash_geti(supportedLsrToIndex, &desiredLSR);
+ if (index != 0) {
+ int32_t suppIndex = index - 1;
+ if (remainingIter != nullptr) {
+ remainingIter->rememberCurrent(desiredIndex, errorCode);
+ }
+ return suppIndex;
+ }
+ }
+ int32_t bestIndexAndDistance = localeDistance.getBestIndexAndDistance(
+ desiredLSR, supportedLSRs, supportedLSRsLength, bestDistance, favorSubtag);
+ if (bestIndexAndDistance >= 0) {
+ bestDistance = bestIndexAndDistance & 0xff;
+ if (remainingIter != nullptr) {
+ remainingIter->rememberCurrent(desiredIndex, errorCode);
+ if (U_FAILURE(errorCode)) { return -1; }
+ }
+ bestSupportedLsrIndex = bestIndexAndDistance >= 0 ? bestIndexAndDistance >> 8 : -1;
+ }
+ if ((bestDistance -= demotionPerDesiredLocale) <= 0) {
+ break;
+ }
+ if (remainingIter == nullptr || !remainingIter->hasNext()) {
+ break;
+ }
+ desiredLSR = remainingIter->next(errorCode);
+ if (U_FAILURE(errorCode)) { return -1; }
+ ++desiredIndex;
+ }
+ if (bestSupportedLsrIndex < 0) {
+ // no good match
+ return -1;
+ }
+ return supportedIndexes[bestSupportedLsrIndex];
+}
+
+double LocaleMatcher::internalMatch(const Locale &desired, const Locale &supported, UErrorCode &errorCode) const {
+ // Returns the inverse of the distance: That is, 1-distance(desired, supported).
+ LSR suppLSR = getMaximalLsrOrUnd(likelySubtags, supported, errorCode);
+ if (U_FAILURE(errorCode)) { return 0; }
+ const LSR *pSuppLSR = &suppLSR;
+ int32_t distance = localeDistance.getBestIndexAndDistance(
+ getMaximalLsrOrUnd(likelySubtags, desired, errorCode),
+ &pSuppLSR, 1,
+ thresholdDistance, favorSubtag) & 0xff;
+ return (100 - distance) / 100.0;
+}
+
+U_NAMESPACE_END
+
+#endif // __LOCMATCHER_H__
diff --git a/deps/icu-small/source/common/localeprioritylist.cpp b/deps/icu-small/source/common/localeprioritylist.cpp
new file mode 100644
index 00000000000000..06442fb46a83ad
--- /dev/null
+++ b/deps/icu-small/source/common/localeprioritylist.cpp
@@ -0,0 +1,239 @@
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// localeprioritylist.cpp
+// created: 2019jul11 Markus W. Scherer
+
+#include "unicode/utypes.h"
+#include "unicode/localpointer.h"
+#include "unicode/locid.h"
+#include "unicode/stringpiece.h"
+#include "unicode/uobject.h"
+#include "charstr.h"
+#include "cmemory.h"
+#include "localeprioritylist.h"
+#include "uarrsort.h"
+#include "uassert.h"
+#include "uhash.h"
+
+U_NAMESPACE_BEGIN
+
+namespace {
+
+int32_t hashLocale(const UHashTok token) {
+ auto *locale = static_cast(token.pointer);
+ return locale->hashCode();
+}
+
+UBool compareLocales(const UHashTok t1, const UHashTok t2) {
+ auto *l1 = static_cast(t1.pointer);
+ auto *l2 = static_cast(t2.pointer);
+ return *l1 == *l2;
+}
+
+constexpr int32_t WEIGHT_ONE = 1000;
+
+struct LocaleAndWeight {
+ Locale *locale;
+ int32_t weight; // 0..1000 = 0.0..1.0
+ int32_t index; // force stable sort
+
+ int32_t compare(const LocaleAndWeight &other) const {
+ int32_t diff = other.weight - weight; // descending: other-this
+ if (diff != 0) { return diff; }
+ return index - other.index;
+ }
+};
+
+int32_t U_CALLCONV
+compareLocaleAndWeight(const void * /*context*/, const void *left, const void *right) {
+ return static_cast(left)->
+ compare(*static_cast(right));
+}
+
+const char *skipSpaces(const char *p, const char *limit) {
+ while (p < limit && *p == ' ') { ++p; }
+ return p;
+}
+
+int32_t findTagLength(const char *p, const char *limit) {
+ // Look for accept-language delimiters.
+ // Leave other validation up to the Locale constructor.
+ const char *q;
+ for (q = p; q < limit; ++q) {
+ char c = *q;
+ if (c == ' ' || c == ',' || c == ';') { break; }
+ }
+ return static_cast(q - p);
+}
+
+/**
+ * Parses and returns a qvalue weight in millis.
+ * Advances p to after the parsed substring.
+ * Returns a negative value if parsing fails.
+ */
+int32_t parseWeight(const char *&p, const char *limit) {
+ p = skipSpaces(p, limit);
+ char c;
+ if (p == limit || ((c = *p) != '0' && c != '1')) { return -1; }
+ int32_t weight = (c - '0') * 1000;
+ if (++p == limit || *p != '.') { return weight; }
+ int32_t multiplier = 100;
+ while (++p != limit && '0' <= (c = *p) && c <= '9') {
+ c -= '0';
+ if (multiplier > 0) {
+ weight += c * multiplier;
+ multiplier /= 10;
+ } else if (multiplier == 0) {
+ // round up
+ if (c >= 5) { ++weight; }
+ multiplier = -1;
+ } // else ignore further fraction digits
+ }
+ return weight <= WEIGHT_ONE ? weight : -1; // bad if > 1.0
+}
+
+} // namespace
+
+/**
+ * Nothing but a wrapper over a MaybeStackArray of LocaleAndWeight.
+ *
+ * This wrapper exists (and is not in an anonymous namespace)
+ * so that we can forward-declare it in the header file and
+ * don't have to expose the MaybeStackArray specialization and
+ * the LocaleAndWeight to code (like the test) that #includes localeprioritylist.h.
+ * Also, otherwise we would have to do a platform-specific
+ * template export declaration of some kind for the MaybeStackArray specialization
+ * to be properly exported from the common DLL.
+ */
+struct LocaleAndWeightArray : public UMemory {
+ MaybeStackArray array;
+};
+
+LocalePriorityList::LocalePriorityList(StringPiece s, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return; }
+ list = new LocaleAndWeightArray();
+ if (list == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ const char *p = s.data();
+ const char *limit = p + s.length();
+ while ((p = skipSpaces(p, limit)) != limit) {
+ if (*p == ',') { // empty range field
+ ++p;
+ continue;
+ }
+ int32_t tagLength = findTagLength(p, limit);
+ if (tagLength == 0) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ CharString tag(p, tagLength, errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ Locale locale = Locale(tag.data());
+ if (locale.isBogus()) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ int32_t weight = WEIGHT_ONE;
+ if ((p = skipSpaces(p + tagLength, limit)) != limit && *p == ';') {
+ if ((p = skipSpaces(p + 1, limit)) == limit || *p != 'q' ||
+ (p = skipSpaces(p + 1, limit)) == limit || *p != '=' ||
+ (++p, (weight = parseWeight(p, limit)) < 0)) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ p = skipSpaces(p, limit);
+ }
+ if (p != limit && *p != ',') { // trailing junk
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ add(locale, weight, errorCode);
+ if (p == limit) { break; }
+ ++p;
+ }
+ sort(errorCode);
+}
+
+LocalePriorityList::~LocalePriorityList() {
+ if (list != nullptr) {
+ for (int32_t i = 0; i < listLength; ++i) {
+ delete list->array[i].locale;
+ }
+ delete list;
+ }
+ uhash_close(map);
+}
+
+const Locale *LocalePriorityList::localeAt(int32_t i) const {
+ return list->array[i].locale;
+}
+
+Locale *LocalePriorityList::orphanLocaleAt(int32_t i) {
+ if (list == nullptr) { return nullptr; }
+ LocaleAndWeight &lw = list->array[i];
+ Locale *l = lw.locale;
+ lw.locale = nullptr;
+ return l;
+}
+
+bool LocalePriorityList::add(const Locale &locale, int32_t weight, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return false; }
+ if (map == nullptr) {
+ if (weight <= 0) { return true; } // do not add q=0
+ map = uhash_open(hashLocale, compareLocales, uhash_compareLong, &errorCode);
+ if (U_FAILURE(errorCode)) { return false; }
+ }
+ LocalPointer clone;
+ int32_t index = uhash_geti(map, &locale);
+ if (index != 0) {
+ // Duplicate: Remove the old item and append it anew.
+ LocaleAndWeight &lw = list->array[index - 1];
+ clone.adoptInstead(lw.locale);
+ lw.locale = nullptr;
+ lw.weight = 0;
+ ++numRemoved;
+ }
+ if (weight <= 0) { // do not add q=0
+ if (index != 0) {
+ // Not strictly necessary but cleaner.
+ uhash_removei(map, &locale);
+ }
+ return true;
+ }
+ if (clone.isNull()) {
+ clone.adoptInstead(locale.clone());
+ if (clone.isNull() || (clone->isBogus() && !locale.isBogus())) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ }
+ if (listLength == list->array.getCapacity()) {
+ int32_t newCapacity = listLength < 50 ? 100 : 4 * listLength;
+ if (list->array.resize(newCapacity, listLength) == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ }
+ uhash_puti(map, clone.getAlias(), listLength + 1, &errorCode);
+ if (U_FAILURE(errorCode)) { return false; }
+ LocaleAndWeight &lw = list->array[listLength];
+ lw.locale = clone.orphan();
+ lw.weight = weight;
+ lw.index = listLength++;
+ if (weight < WEIGHT_ONE) { hasWeights = true; }
+ U_ASSERT(uhash_count(map) == getLength());
+ return true;
+}
+
+void LocalePriorityList::sort(UErrorCode &errorCode) {
+ // Sort by descending weights if there is a mix of weights.
+ // The comparator forces a stable sort via the item index.
+ if (U_FAILURE(errorCode) || getLength() <= 1 || !hasWeights) { return; }
+ uprv_sortArray(list->array.getAlias(), listLength, sizeof(LocaleAndWeight),
+ compareLocaleAndWeight, nullptr, FALSE, &errorCode);
+}
+
+U_NAMESPACE_END
diff --git a/deps/icu-small/source/common/localeprioritylist.h b/deps/icu-small/source/common/localeprioritylist.h
new file mode 100644
index 00000000000000..80ca38a7b52892
--- /dev/null
+++ b/deps/icu-small/source/common/localeprioritylist.h
@@ -0,0 +1,115 @@
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// localeprioritylist.h
+// created: 2019jul11 Markus W. Scherer
+
+#ifndef __LOCALEPRIORITYLIST_H__
+#define __LOCALEPRIORITYLIST_H__
+
+#include "unicode/utypes.h"
+#include "unicode/locid.h"
+#include "unicode/stringpiece.h"
+#include "unicode/uobject.h"
+
+struct UHashtable;
+
+U_NAMESPACE_BEGIN
+
+struct LocaleAndWeightArray;
+
+/**
+ * Parses a list of locales from an accept-language string.
+ * We are a bit more lenient than the spec:
+ * We accept extra whitespace in more places, empty range fields,
+ * and any number of qvalue fraction digits.
+ *
+ * https://tools.ietf.org/html/rfc2616#section-14.4
+ * 14.4 Accept-Language
+ *
+ * Accept-Language = "Accept-Language" ":"
+ * 1#( language-range [ ";" "q" "=" qvalue ] )
+ * language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
+ *
+ * Each language-range MAY be given an associated quality value which
+ * represents an estimate of the user's preference for the languages
+ * specified by that range. The quality value defaults to "q=1". For
+ * example,
+ *
+ * Accept-Language: da, en-gb;q=0.8, en;q=0.7
+ *
+ * https://tools.ietf.org/html/rfc2616#section-3.9
+ * 3.9 Quality Values
+ *
+ * HTTP content negotiation (section 12) uses short "floating point"
+ * numbers to indicate the relative importance ("weight") of various
+ * negotiable parameters. A weight is normalized to a real number in
+ * the range 0 through 1, where 0 is the minimum and 1 the maximum
+ * value. If a parameter has a quality value of 0, then content with
+ * this parameter is `not acceptable' for the client. HTTP/1.1
+ * applications MUST NOT generate more than three digits after the
+ * decimal point. User configuration of these values SHOULD also be
+ * limited in this fashion.
+ *
+ * qvalue = ( "0" [ "." 0*3DIGIT ] )
+ * | ( "1" [ "." 0*3("0") ] )
+ */
+class U_COMMON_API LocalePriorityList : public UMemory {
+public:
+ class Iterator : public Locale::Iterator {
+ public:
+ UBool hasNext() const override { return count < length; }
+
+ const Locale &next() override {
+ for(;;) {
+ const Locale *locale = list.localeAt(index++);
+ if (locale != nullptr) {
+ ++count;
+ return *locale;
+ }
+ }
+ }
+
+ private:
+ friend class LocalePriorityList;
+
+ Iterator(const LocalePriorityList &list) : list(list), length(list.getLength()) {}
+
+ const LocalePriorityList &list;
+ int32_t index = 0;
+ int32_t count = 0;
+ const int32_t length;
+ };
+
+ LocalePriorityList(StringPiece s, UErrorCode &errorCode);
+
+ ~LocalePriorityList();
+
+ int32_t getLength() const { return listLength - numRemoved; }
+
+ int32_t getLengthIncludingRemoved() const { return listLength; }
+
+ Iterator iterator() const { return Iterator(*this); }
+
+ const Locale *localeAt(int32_t i) const;
+
+ Locale *orphanLocaleAt(int32_t i);
+
+private:
+ LocalePriorityList(const LocalePriorityList &) = delete;
+ LocalePriorityList &operator=(const LocalePriorityList &) = delete;
+
+ bool add(const Locale &locale, int32_t weight, UErrorCode &errorCode);
+
+ void sort(UErrorCode &errorCode);
+
+ LocaleAndWeightArray *list = nullptr;
+ int32_t listLength = 0;
+ int32_t numRemoved = 0;
+ bool hasWeights = false; // other than 1.0
+ UHashtable *map = nullptr;
+};
+
+U_NAMESPACE_END
+
+#endif // __LOCALEPRIORITYLIST_H__
diff --git a/deps/icu-small/source/common/localsvc.h b/deps/icu-small/source/common/localsvc.h
index 0339a44dcd95ec..33640195135bd8 100644
--- a/deps/icu-small/source/common/localsvc.h
+++ b/deps/icu-small/source/common/localsvc.h
@@ -16,7 +16,7 @@
/**
* Prototype for user-supplied service hook. This function is expected to return
* a type of factory object specific to the requested service.
- *
+ *
* @param what service-specific string identifying the specific user hook
* @param status error status
* @return a service-specific hook, or NULL on failure.
diff --git a/deps/icu-small/source/common/locavailable.cpp b/deps/icu-small/source/common/locavailable.cpp
index 1e608ffb9e1c84..e8ec512e370992 100644
--- a/deps/icu-small/source/common/locavailable.cpp
+++ b/deps/icu-small/source/common/locavailable.cpp
@@ -19,11 +19,13 @@
* that then do not depend on resource bundle code and res_index bundles.
*/
+#include "unicode/errorcode.h"
#include "unicode/utypes.h"
#include "unicode/locid.h"
#include "unicode/uloc.h"
#include "unicode/ures.h"
#include "cmemory.h"
+#include "cstring.h"
#include "ucln_cmn.h"
#include "uassert.h"
#include "umutex.h"
@@ -62,7 +64,7 @@ U_NAMESPACE_BEGIN
void U_CALLCONV locale_available_init() {
// This function is a friend of class Locale.
// This function is only invoked via umtx_initOnce().
-
+
// for now, there is a hardcoded list, so just walk through that list and set it up.
// Note: this function is a friend of class Locale.
availableLocaleListCount = uloc_countAvailable();
@@ -95,84 +97,174 @@ U_NAMESPACE_USE
/* ### Constants **************************************************/
-/* These strings describe the resources we attempt to load from
- the locale ResourceBundle data file.*/
-static const char _kIndexLocaleName[] = "res_index";
-static const char _kIndexTag[] = "InstalledLocales";
+namespace {
-static char** _installedLocales = NULL;
-static int32_t _installedLocalesCount = 0;
-static icu::UInitOnce _installedLocalesInitOnce;
+// Enough capacity for the two lists in the res_index.res file
+const char** gAvailableLocaleNames[2] = {};
+int32_t gAvailableLocaleCounts[2] = {};
+icu::UInitOnce ginstalledLocalesInitOnce = U_INITONCE_INITIALIZER;
-/* ### Get available **************************************************/
+class AvailableLocalesSink : public ResourceSink {
+ public:
+ void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) U_OVERRIDE {
+ ResourceTable resIndexTable = value.getTable(status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ for (int32_t i = 0; resIndexTable.getKeyAndValue(i, key, value); ++i) {
+ ULocAvailableType type;
+ if (uprv_strcmp(key, "InstalledLocales") == 0) {
+ type = ULOC_AVAILABLE_DEFAULT;
+ } else if (uprv_strcmp(key, "AliasLocales") == 0) {
+ type = ULOC_AVAILABLE_ONLY_LEGACY_ALIASES;
+ } else {
+ // CLDRVersion, etc.
+ continue;
+ }
+ ResourceTable availableLocalesTable = value.getTable(status);
+ if (U_FAILURE(status)) {
+ return;
+ }
+ gAvailableLocaleCounts[type] = availableLocalesTable.getSize();
+ gAvailableLocaleNames[type] = static_cast(
+ uprv_malloc(gAvailableLocaleCounts[type] * sizeof(const char*)));
+ if (gAvailableLocaleNames[type] == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ for (int32_t j = 0; availableLocalesTable.getKeyAndValue(j, key, value); ++j) {
+ gAvailableLocaleNames[type][j] = key;
+ }
+ }
+ }
+};
-static UBool U_CALLCONV uloc_cleanup(void) {
- char ** temp;
+class AvailableLocalesStringEnumeration : public StringEnumeration {
+ public:
+ AvailableLocalesStringEnumeration(ULocAvailableType type) : fType(type) {
+ }
+
+ const char* next(int32_t *resultLength, UErrorCode&) override {
+ ULocAvailableType actualType = fType;
+ int32_t actualIndex = fIndex++;
+
+ // If the "combined" list was requested, resolve that now
+ if (fType == ULOC_AVAILABLE_WITH_LEGACY_ALIASES) {
+ int32_t defaultLocalesCount = gAvailableLocaleCounts[ULOC_AVAILABLE_DEFAULT];
+ if (actualIndex < defaultLocalesCount) {
+ actualType = ULOC_AVAILABLE_DEFAULT;
+ } else {
+ actualIndex -= defaultLocalesCount;
+ actualType = ULOC_AVAILABLE_ONLY_LEGACY_ALIASES;
+ }
+ }
- if (_installedLocales) {
- temp = _installedLocales;
- _installedLocales = NULL;
+ // Return the requested string
+ int32_t count = gAvailableLocaleCounts[actualType];
+ const char* result;
+ if (actualIndex < count) {
+ result = gAvailableLocaleNames[actualType][actualIndex];
+ if (resultLength != nullptr) {
+ *resultLength = static_cast(uprv_strlen(result));
+ }
+ } else {
+ result = nullptr;
+ if (resultLength != nullptr) {
+ *resultLength = 0;
+ }
+ }
+ return result;
+ }
- _installedLocalesCount = 0;
- _installedLocalesInitOnce.reset();
+ void reset(UErrorCode&) override {
+ fIndex = 0;
+ }
- uprv_free(temp);
+ int32_t count(UErrorCode&) const override {
+ if (fType == ULOC_AVAILABLE_WITH_LEGACY_ALIASES) {
+ return gAvailableLocaleCounts[ULOC_AVAILABLE_DEFAULT]
+ + gAvailableLocaleCounts[ULOC_AVAILABLE_ONLY_LEGACY_ALIASES];
+ } else {
+ return gAvailableLocaleCounts[fType];
+ }
}
+
+ private:
+ ULocAvailableType fType;
+ int32_t fIndex = 0;
+};
+
+/* ### Get available **************************************************/
+
+static UBool U_CALLCONV uloc_cleanup(void) {
+ for (int32_t i = 0; i < UPRV_LENGTHOF(gAvailableLocaleNames); i++) {
+ uprv_free(gAvailableLocaleNames[i]);
+ gAvailableLocaleNames[i] = nullptr;
+ gAvailableLocaleCounts[i] = 0;
+ }
+ ginstalledLocalesInitOnce.reset();
return TRUE;
}
// Load Installed Locales. This function will be called exactly once
// via the initOnce mechanism.
-static void U_CALLCONV loadInstalledLocales() {
- UErrorCode status = U_ZERO_ERROR;
- int32_t i = 0;
- int32_t localeCount;
-
- U_ASSERT(_installedLocales == NULL);
- U_ASSERT(_installedLocalesCount == 0);
+static void U_CALLCONV loadInstalledLocales(UErrorCode& status) {
+ ucln_common_registerCleanup(UCLN_COMMON_ULOC, uloc_cleanup);
- _installedLocalesCount = 0;
+ icu::LocalUResourceBundlePointer rb(ures_openDirect(NULL, "res_index", &status));
+ AvailableLocalesSink sink;
+ ures_getAllItemsWithFallback(rb.getAlias(), "", sink, status);
+}
- icu::LocalUResourceBundlePointer indexLocale(ures_openDirect(NULL, _kIndexLocaleName, &status));
- icu::StackUResourceBundle installed;
+void _load_installedLocales(UErrorCode& status) {
+ umtx_initOnce(ginstalledLocalesInitOnce, &loadInstalledLocales, status);
+}
- ures_getByKey(indexLocale.getAlias(), _kIndexTag, installed.getAlias(), &status);
+} // namespace
- if(U_SUCCESS(status)) {
- localeCount = ures_getSize(installed.getAlias());
- _installedLocales = (char **) uprv_malloc(sizeof(char*) * (localeCount+1));
- if (_installedLocales != NULL) {
- ures_resetIterator(installed.getAlias());
- while(ures_hasNext(installed.getAlias())) {
- ures_getNextString(installed.getAlias(), NULL, (const char **)&_installedLocales[i++], &status);
- }
- _installedLocales[i] = NULL;
- _installedLocalesCount = localeCount;
- ucln_common_registerCleanup(UCLN_COMMON_ULOC, uloc_cleanup);
- }
+U_CAPI const char* U_EXPORT2
+uloc_getAvailable(int32_t offset) {
+ icu::ErrorCode status;
+ _load_installedLocales(status);
+ if (status.isFailure()) {
+ return nullptr;
+ }
+ if (offset > gAvailableLocaleCounts[0]) {
+ // *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
}
+ return gAvailableLocaleNames[0][offset];
}
-static void _load_installedLocales()
-{
- umtx_initOnce(_installedLocalesInitOnce, &loadInstalledLocales);
+U_CAPI int32_t U_EXPORT2
+uloc_countAvailable() {
+ icu::ErrorCode status;
+ _load_installedLocales(status);
+ if (status.isFailure()) {
+ return 0;
+ }
+ return gAvailableLocaleCounts[0];
}
-U_CAPI const char* U_EXPORT2
-uloc_getAvailable(int32_t offset)
-{
-
- _load_installedLocales();
-
- if (offset > _installedLocalesCount)
- return NULL;
- return _installedLocales[offset];
+U_CAPI UEnumeration* U_EXPORT2
+uloc_openAvailableByType(ULocAvailableType type, UErrorCode* status) {
+ if (U_FAILURE(*status)) {
+ return nullptr;
+ }
+ if (type < 0 || type >= ULOC_AVAILABLE_COUNT) {
+ *status = U_ILLEGAL_ARGUMENT_ERROR;
+ return nullptr;
+ }
+ _load_installedLocales(*status);
+ if (U_FAILURE(*status)) {
+ return nullptr;
+ }
+ LocalPointer result(
+ new AvailableLocalesStringEnumeration(type), *status);
+ if (U_FAILURE(*status)) {
+ return nullptr;
+ }
+ return uenum_openFromStringEnumeration(result.orphan(), status);
}
-U_CAPI int32_t U_EXPORT2
-uloc_countAvailable()
-{
- _load_installedLocales();
- return _installedLocalesCount;
-}
diff --git a/deps/icu-small/source/common/locbased.h b/deps/icu-small/source/common/locbased.h
index 6db6a41dc416df..45738863b5ec96 100644
--- a/deps/icu-small/source/common/locbased.h
+++ b/deps/icu-small/source/common/locbased.h
@@ -22,7 +22,7 @@
* `actualLocale' of size ULOC_FULLNAME_CAPACITY
*/
#define U_LOCALE_BASED(varname, objname) \
- LocaleBased varname((objname).validLocale, (objname).actualLocale);
+ LocaleBased varname((objname).validLocale, (objname).actualLocale)
U_NAMESPACE_BEGIN
@@ -88,7 +88,7 @@ class U_COMMON_API LocaleBased : public UMemory {
private:
char* valid;
-
+
char* actual;
};
diff --git a/deps/icu-small/source/common/locdispnames.cpp b/deps/icu-small/source/common/locdispnames.cpp
index 7216a3a3083e3d..d92348e31c8843 100644
--- a/deps/icu-small/source/common/locdispnames.cpp
+++ b/deps/icu-small/source/common/locdispnames.cpp
@@ -296,7 +296,7 @@ static const char _kSeparator[] = "separator";
static int32_t
_getStringOrCopyKey(const char *path, const char *locale,
- const char *tableKey,
+ const char *tableKey,
const char* subTableKey,
const char *itemKey,
const char *substitute,
@@ -320,7 +320,7 @@ _getStringOrCopyKey(const char *path, const char *locale,
} else {
/* second-level item, use special fallback */
s=uloc_getTableStringWithFallback(path, locale,
- tableKey,
+ tableKey,
subTableKey,
itemKey,
&length,
@@ -409,7 +409,7 @@ uloc_getDisplayScript(const char* locale,
UErrorCode err = U_ZERO_ERROR;
int32_t res = _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity,
uloc_getScript, _kScriptsStandAlone, &err);
-
+
if ( err == U_USING_DEFAULT_WARNING ) {
return _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity,
uloc_getScript, _kScripts, pErrorCode);
@@ -488,7 +488,7 @@ uloc_getDisplayName(const char *locale,
const UChar *pattern;
int32_t patLen = 0;
int32_t sub0Pos, sub1Pos;
-
+
UChar formatOpenParen = 0x0028; // (
UChar formatReplaceOpenParen = 0x005B; // [
UChar formatCloseParen = 0x0029; // )
@@ -785,9 +785,9 @@ uloc_getDisplayKeyword(const char* keyword,
/* pass itemKey=NULL to look for a top-level item */
return _getStringOrCopyKey(U_ICUDATA_LANG, displayLocale,
- _kKeys, NULL,
- keyword,
- keyword,
+ _kKeys, NULL,
+ keyword,
+ keyword,
dest, destCapacity,
status);
@@ -825,8 +825,8 @@ uloc_getDisplayKeywordValue( const char* locale,
if (*status == U_STRING_NOT_TERMINATED_WARNING)
*status = U_BUFFER_OVERFLOW_ERROR;
- /*
- * if the keyword is equal to currency .. then to get the display name
+ /*
+ * if the keyword is equal to currency .. then to get the display name
* we need to do the fallback ourselves
*/
if(uprv_stricmp(keyword, _kCurrency)==0){
@@ -872,11 +872,11 @@ uloc_getDisplayKeywordValue( const char* locale,
}
}
-
+
}else{
return _getStringOrCopyKey(U_ICUDATA_LANG, displayLocale,
- _kTypes, keyword,
+ _kTypes, keyword,
keywordValue,
keywordValue,
dest, destCapacity,
diff --git a/deps/icu-small/source/common/locdistance.cpp b/deps/icu-small/source/common/locdistance.cpp
new file mode 100644
index 00000000000000..800d0eacf2b605
--- /dev/null
+++ b/deps/icu-small/source/common/locdistance.cpp
@@ -0,0 +1,364 @@
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// locdistance.cpp
+// created: 2019may08 Markus W. Scherer
+
+#include "unicode/utypes.h"
+#include "unicode/bytestrie.h"
+#include "unicode/localematcher.h"
+#include "unicode/locid.h"
+#include "unicode/uobject.h"
+#include "unicode/ures.h"
+#include "cstring.h"
+#include "locdistance.h"
+#include "loclikelysubtags.h"
+#include "uassert.h"
+#include "ucln_cmn.h"
+#include "uinvchar.h"
+#include "umutex.h"
+
+U_NAMESPACE_BEGIN
+
+namespace {
+
+/**
+ * Bit flag used on the last character of a subtag in the trie.
+ * Must be set consistently by the builder and the lookup code.
+ */
+constexpr int32_t END_OF_SUBTAG = 0x80;
+/** Distance value bit flag, set by the builder. */
+constexpr int32_t DISTANCE_SKIP_SCRIPT = 0x80;
+/** Distance value bit flag, set by trieNext(). */
+constexpr int32_t DISTANCE_IS_FINAL = 0x100;
+constexpr int32_t DISTANCE_IS_FINAL_OR_SKIP_SCRIPT = DISTANCE_IS_FINAL | DISTANCE_SKIP_SCRIPT;
+
+constexpr int32_t ABOVE_THRESHOLD = 100;
+
+// Indexes into array of distances.
+enum {
+ IX_DEF_LANG_DISTANCE,
+ IX_DEF_SCRIPT_DISTANCE,
+ IX_DEF_REGION_DISTANCE,
+ IX_MIN_REGION_DISTANCE,
+ IX_LIMIT
+};
+
+LocaleDistance *gLocaleDistance = nullptr;
+UInitOnce gInitOnce = U_INITONCE_INITIALIZER;
+
+UBool U_CALLCONV cleanup() {
+ delete gLocaleDistance;
+ gLocaleDistance = nullptr;
+ gInitOnce.reset();
+ return TRUE;
+}
+
+} // namespace
+
+void U_CALLCONV LocaleDistance::initLocaleDistance(UErrorCode &errorCode) {
+ // This function is invoked only via umtx_initOnce().
+ U_ASSERT(gLocaleDistance == nullptr);
+ const XLikelySubtags &likely = *XLikelySubtags::getSingleton(errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ const LocaleDistanceData &data = likely.getDistanceData();
+ if (data.distanceTrieBytes == nullptr ||
+ data.regionToPartitions == nullptr || data.partitions == nullptr ||
+ // ok if no paradigms
+ data.distances == nullptr) {
+ errorCode = U_MISSING_RESOURCE_ERROR;
+ return;
+ }
+ gLocaleDistance = new LocaleDistance(data);
+ if (gLocaleDistance == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ ucln_common_registerCleanup(UCLN_COMMON_LOCALE_DISTANCE, cleanup);
+}
+
+const LocaleDistance *LocaleDistance::getSingleton(UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ umtx_initOnce(gInitOnce, &LocaleDistance::initLocaleDistance, errorCode);
+ return gLocaleDistance;
+}
+
+LocaleDistance::LocaleDistance(const LocaleDistanceData &data) :
+ trie(data.distanceTrieBytes),
+ regionToPartitionsIndex(data.regionToPartitions), partitionArrays(data.partitions),
+ paradigmLSRs(data.paradigms), paradigmLSRsLength(data.paradigmsLength),
+ defaultLanguageDistance(data.distances[IX_DEF_LANG_DISTANCE]),
+ defaultScriptDistance(data.distances[IX_DEF_SCRIPT_DISTANCE]),
+ defaultRegionDistance(data.distances[IX_DEF_REGION_DISTANCE]),
+ minRegionDistance(data.distances[IX_MIN_REGION_DISTANCE]) {
+ // For the default demotion value, use the
+ // default region distance between unrelated Englishes.
+ // Thus, unless demotion is turned off,
+ // a mere region difference for one desired locale
+ // is as good as a perfect match for the next following desired locale.
+ // As of CLDR 36, we have .
+ LSR en("en", "Latn", "US");
+ LSR enGB("en", "Latn", "GB");
+ const LSR *p_enGB = &enGB;
+ defaultDemotionPerDesiredLocale = getBestIndexAndDistance(en, &p_enGB, 1,
+ 50, ULOCMATCH_FAVOR_LANGUAGE) & 0xff;
+}
+
+int32_t LocaleDistance::getBestIndexAndDistance(
+ const LSR &desired,
+ const LSR **supportedLSRs, int32_t supportedLSRsLength,
+ int32_t threshold, ULocMatchFavorSubtag favorSubtag) const {
+ BytesTrie iter(trie);
+ // Look up the desired language only once for all supported LSRs.
+ // Its "distance" is either a match point value of 0, or a non-match negative value.
+ // Note: The data builder verifies that there are no <*, supported> or rules.
+ int32_t desLangDistance = trieNext(iter, desired.language, false);
+ uint64_t desLangState = desLangDistance >= 0 && supportedLSRsLength > 1 ? iter.getState64() : 0;
+ // Index of the supported LSR with the lowest distance.
+ int32_t bestIndex = -1;
+ for (int32_t slIndex = 0; slIndex < supportedLSRsLength; ++slIndex) {
+ const LSR &supported = *supportedLSRs[slIndex];
+ bool star = false;
+ int32_t distance = desLangDistance;
+ if (distance >= 0) {
+ U_ASSERT((distance & DISTANCE_IS_FINAL) == 0);
+ if (slIndex != 0) {
+ iter.resetToState64(desLangState);
+ }
+ distance = trieNext(iter, supported.language, true);
+ }
+ // Note: The data builder verifies that there are no rules with "any" (*) language and
+ // real (non *) script or region subtags.
+ // This means that if the lookup for either language fails we can use
+ // the default distances without further lookups.
+ int32_t flags;
+ if (distance >= 0) {
+ flags = distance & DISTANCE_IS_FINAL_OR_SKIP_SCRIPT;
+ distance &= ~DISTANCE_IS_FINAL_OR_SKIP_SCRIPT;
+ } else { // <*, *>
+ if (uprv_strcmp(desired.language, supported.language) == 0) {
+ distance = 0;
+ } else {
+ distance = defaultLanguageDistance;
+ }
+ flags = 0;
+ star = true;
+ }
+ U_ASSERT(0 <= distance && distance <= 100);
+ // We implement "favor subtag" by reducing the language subtag distance
+ // (unscientifically reducing it to a quarter of the normal value),
+ // so that the script distance is relatively more important.
+ // For example, given a default language distance of 80, we reduce it to 20,
+ // which is below the default threshold of 50, which is the default script distance.
+ if (favorSubtag == ULOCMATCH_FAVOR_SCRIPT) {
+ distance >>= 2;
+ }
+ if (distance >= threshold) {
+ continue;
+ }
+
+ int32_t scriptDistance;
+ if (star || flags != 0) {
+ if (uprv_strcmp(desired.script, supported.script) == 0) {
+ scriptDistance = 0;
+ } else {
+ scriptDistance = defaultScriptDistance;
+ }
+ } else {
+ scriptDistance = getDesSuppScriptDistance(iter, iter.getState64(),
+ desired.script, supported.script);
+ flags = scriptDistance & DISTANCE_IS_FINAL;
+ scriptDistance &= ~DISTANCE_IS_FINAL;
+ }
+ distance += scriptDistance;
+ if (distance >= threshold) {
+ continue;
+ }
+
+ if (uprv_strcmp(desired.region, supported.region) == 0) {
+ // regionDistance = 0
+ } else if (star || (flags & DISTANCE_IS_FINAL) != 0) {
+ distance += defaultRegionDistance;
+ } else {
+ int32_t remainingThreshold = threshold - distance;
+ if (minRegionDistance >= remainingThreshold) {
+ continue;
+ }
+
+ // From here on we know the regions are not equal.
+ // Map each region to zero or more partitions. (zero = one non-matching string)
+ // (Each array of single-character partition strings is encoded as one string.)
+ // If either side has more than one, then we find the maximum distance.
+ // This could be optimized by adding some more structure, but probably not worth it.
+ distance += getRegionPartitionsDistance(
+ iter, iter.getState64(),
+ partitionsForRegion(desired),
+ partitionsForRegion(supported),
+ remainingThreshold);
+ }
+ if (distance < threshold) {
+ if (distance == 0) {
+ return slIndex << 8;
+ }
+ bestIndex = slIndex;
+ threshold = distance;
+ }
+ }
+ return bestIndex >= 0 ? (bestIndex << 8) | threshold : 0xffffff00 | ABOVE_THRESHOLD;
+}
+
+int32_t LocaleDistance::getDesSuppScriptDistance(
+ BytesTrie &iter, uint64_t startState, const char *desired, const char *supported) {
+ // Note: The data builder verifies that there are no <*, supported> or rules.
+ int32_t distance = trieNext(iter, desired, false);
+ if (distance >= 0) {
+ distance = trieNext(iter, supported, true);
+ }
+ if (distance < 0) {
+ UStringTrieResult result = iter.resetToState64(startState).next(u'*'); // <*, *>
+ U_ASSERT(USTRINGTRIE_HAS_VALUE(result));
+ if (uprv_strcmp(desired, supported) == 0) {
+ distance = 0; // same script
+ } else {
+ distance = iter.getValue();
+ U_ASSERT(distance >= 0);
+ }
+ if (result == USTRINGTRIE_FINAL_VALUE) {
+ distance |= DISTANCE_IS_FINAL;
+ }
+ }
+ return distance;
+}
+
+int32_t LocaleDistance::getRegionPartitionsDistance(
+ BytesTrie &iter, uint64_t startState,
+ const char *desiredPartitions, const char *supportedPartitions, int32_t threshold) {
+ char desired = *desiredPartitions++;
+ char supported = *supportedPartitions++;
+ U_ASSERT(desired != 0 && supported != 0);
+ // See if we have single desired/supported partitions, from NUL-terminated
+ // partition strings without explicit length.
+ bool suppLengthGt1 = *supportedPartitions != 0; // gt1: more than 1 character
+ // equivalent to: if (desLength == 1 && suppLength == 1)
+ if (*desiredPartitions == 0 && !suppLengthGt1) {
+ // Fastpath for single desired/supported partitions.
+ UStringTrieResult result = iter.next(uprv_invCharToAscii(desired) | END_OF_SUBTAG);
+ if (USTRINGTRIE_HAS_NEXT(result)) {
+ result = iter.next(uprv_invCharToAscii(supported) | END_OF_SUBTAG);
+ if (USTRINGTRIE_HAS_VALUE(result)) {
+ return iter.getValue();
+ }
+ }
+ return getFallbackRegionDistance(iter, startState);
+ }
+
+ const char *supportedStart = supportedPartitions - 1; // for restart of inner loop
+ int32_t regionDistance = 0;
+ // Fall back to * only once, not for each pair of partition strings.
+ bool star = false;
+ for (;;) {
+ // Look up each desired-partition string only once,
+ // not for each (desired, supported) pair.
+ UStringTrieResult result = iter.next(uprv_invCharToAscii(desired) | END_OF_SUBTAG);
+ if (USTRINGTRIE_HAS_NEXT(result)) {
+ uint64_t desState = suppLengthGt1 ? iter.getState64() : 0;
+ for (;;) {
+ result = iter.next(uprv_invCharToAscii(supported) | END_OF_SUBTAG);
+ int32_t d;
+ if (USTRINGTRIE_HAS_VALUE(result)) {
+ d = iter.getValue();
+ } else if (star) {
+ d = 0;
+ } else {
+ d = getFallbackRegionDistance(iter, startState);
+ star = true;
+ }
+ if (d >= threshold) {
+ return d;
+ } else if (regionDistance < d) {
+ regionDistance = d;
+ }
+ if ((supported = *supportedPartitions++) != 0) {
+ iter.resetToState64(desState);
+ } else {
+ break;
+ }
+ }
+ } else if (!star) {
+ int32_t d = getFallbackRegionDistance(iter, startState);
+ if (d >= threshold) {
+ return d;
+ } else if (regionDistance < d) {
+ regionDistance = d;
+ }
+ star = true;
+ }
+ if ((desired = *desiredPartitions++) != 0) {
+ iter.resetToState64(startState);
+ supportedPartitions = supportedStart;
+ supported = *supportedPartitions++;
+ } else {
+ break;
+ }
+ }
+ return regionDistance;
+}
+
+int32_t LocaleDistance::getFallbackRegionDistance(BytesTrie &iter, uint64_t startState) {
+#if U_DEBUG
+ UStringTrieResult result =
+#endif
+ iter.resetToState64(startState).next(u'*'); // <*, *>
+ U_ASSERT(USTRINGTRIE_HAS_VALUE(result));
+ int32_t distance = iter.getValue();
+ U_ASSERT(distance >= 0);
+ return distance;
+}
+
+int32_t LocaleDistance::trieNext(BytesTrie &iter, const char *s, bool wantValue) {
+ uint8_t c;
+ if ((c = *s) == 0) {
+ return -1; // no empty subtags in the distance data
+ }
+ for (;;) {
+ c = uprv_invCharToAscii(c);
+ // EBCDIC: If *s is not an invariant character,
+ // then c is now 0 and will simply not match anything, which is harmless.
+ uint8_t next = *++s;
+ if (next != 0) {
+ if (!USTRINGTRIE_HAS_NEXT(iter.next(c))) {
+ return -1;
+ }
+ } else {
+ // last character of this subtag
+ UStringTrieResult result = iter.next(c | END_OF_SUBTAG);
+ if (wantValue) {
+ if (USTRINGTRIE_HAS_VALUE(result)) {
+ int32_t value = iter.getValue();
+ if (result == USTRINGTRIE_FINAL_VALUE) {
+ value |= DISTANCE_IS_FINAL;
+ }
+ return value;
+ }
+ } else {
+ if (USTRINGTRIE_HAS_NEXT(result)) {
+ return 0;
+ }
+ }
+ return -1;
+ }
+ c = next;
+ }
+}
+
+UBool LocaleDistance::isParadigmLSR(const LSR &lsr) const {
+ // Linear search for a very short list (length 6 as of 2019).
+ // If there are many paradigm LSRs we should use a hash set.
+ U_ASSERT(paradigmLSRsLength <= 15);
+ for (int32_t i = 0; i < paradigmLSRsLength; ++i) {
+ if (lsr == paradigmLSRs[i]) { return true; }
+ }
+ return false;
+}
+
+U_NAMESPACE_END
diff --git a/deps/icu-small/source/common/locdistance.h b/deps/icu-small/source/common/locdistance.h
new file mode 100644
index 00000000000000..7439f51c56bf8c
--- /dev/null
+++ b/deps/icu-small/source/common/locdistance.h
@@ -0,0 +1,109 @@
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// locdistance.h
+// created: 2019may08 Markus W. Scherer
+
+#ifndef __LOCDISTANCE_H__
+#define __LOCDISTANCE_H__
+
+#include "unicode/utypes.h"
+#include "unicode/bytestrie.h"
+#include "unicode/localematcher.h"
+#include "unicode/locid.h"
+#include "unicode/uobject.h"
+#include "lsr.h"
+
+U_NAMESPACE_BEGIN
+
+struct LocaleDistanceData;
+
+/**
+ * Offline-built data for LocaleMatcher.
+ * Mostly but not only the data for mapping locales to their maximized forms.
+ */
+class LocaleDistance final : public UMemory {
+public:
+ static const LocaleDistance *getSingleton(UErrorCode &errorCode);
+
+ /**
+ * Finds the supported LSR with the smallest distance from the desired one.
+ * Equivalent LSR subtags must be normalized into a canonical form.
+ *
+ * Returns the index of the lowest-distance supported LSR in bits 31..8
+ * (negative if none has a distance below the threshold),
+ * and its distance (0..ABOVE_THRESHOLD) in bits 7..0.
+ */
+ int32_t getBestIndexAndDistance(const LSR &desired,
+ const LSR **supportedLSRs, int32_t supportedLSRsLength,
+ int32_t threshold, ULocMatchFavorSubtag favorSubtag) const;
+
+ int32_t getParadigmLSRsLength() const { return paradigmLSRsLength; }
+
+ UBool isParadigmLSR(const LSR &lsr) const;
+
+ int32_t getDefaultScriptDistance() const {
+ return defaultScriptDistance;
+ }
+
+ int32_t getDefaultDemotionPerDesiredLocale() const {
+ return defaultDemotionPerDesiredLocale;
+ }
+
+private:
+ LocaleDistance(const LocaleDistanceData &data);
+ LocaleDistance(const LocaleDistance &other) = delete;
+ LocaleDistance &operator=(const LocaleDistance &other) = delete;
+
+ static void initLocaleDistance(UErrorCode &errorCode);
+
+ static int32_t getDesSuppScriptDistance(BytesTrie &iter, uint64_t startState,
+ const char *desired, const char *supported);
+
+ static int32_t getRegionPartitionsDistance(
+ BytesTrie &iter, uint64_t startState,
+ const char *desiredPartitions, const char *supportedPartitions,
+ int32_t threshold);
+
+ static int32_t getFallbackRegionDistance(BytesTrie &iter, uint64_t startState);
+
+ static int32_t trieNext(BytesTrie &iter, const char *s, bool wantValue);
+
+ const char *partitionsForRegion(const LSR &lsr) const {
+ // ill-formed region -> one non-matching string
+ int32_t pIndex = regionToPartitionsIndex[lsr.regionIndex];
+ return partitionArrays[pIndex];
+ }
+
+ int32_t getDefaultRegionDistance() const {
+ return defaultRegionDistance;
+ }
+
+ // The trie maps each dlang+slang+dscript+sscript+dregion+sregion
+ // (encoded in ASCII with bit 7 set on the last character of each subtag) to a distance.
+ // There is also a trie value for each subsequence of whole subtags.
+ // One '*' is used for a (desired, supported) pair of "und", "Zzzz"/"", or "ZZ"/"".
+ BytesTrie trie;
+
+ /**
+ * Maps each region to zero or more single-character partitions.
+ */
+ const uint8_t *regionToPartitionsIndex;
+ const char **partitionArrays;
+
+ /**
+ * Used to get the paradigm region for a cluster, if there is one.
+ */
+ const LSR *paradigmLSRs;
+ int32_t paradigmLSRsLength;
+
+ int32_t defaultLanguageDistance;
+ int32_t defaultScriptDistance;
+ int32_t defaultRegionDistance;
+ int32_t minRegionDistance;
+ int32_t defaultDemotionPerDesiredLocale;
+};
+
+U_NAMESPACE_END
+
+#endif // __LOCDISTANCE_H__
diff --git a/deps/icu-small/source/common/locdspnm.cpp b/deps/icu-small/source/common/locdspnm.cpp
index da35be9e766e50..43334f51964622 100644
--- a/deps/icu-small/source/common/locdspnm.cpp
+++ b/deps/icu-small/source/common/locdspnm.cpp
@@ -291,6 +291,7 @@ class LocaleDisplayNamesImpl : public LocaleDisplayNames {
UnicodeString formatCloseParen;
UnicodeString formatReplaceCloseParen;
UDisplayContext nameLength;
+ UDisplayContext substitute;
// Constants for capitalization context usage types.
enum CapContextUsage {
@@ -337,7 +338,7 @@ class LocaleDisplayNamesImpl : public LocaleDisplayNames {
UnicodeString& result) const;
private:
UnicodeString& localeIdName(const char* localeId,
- UnicodeString& result) const;
+ UnicodeString& result, bool substitute) const;
UnicodeString& appendWithSep(UnicodeString& buffer, const UnicodeString& src) const;
UnicodeString& adjustForUsageAndContext(CapContextUsage usage, UnicodeString& result) const;
UnicodeString& scriptDisplayName(const char* script, UnicodeString& result, UBool skipAdjust) const;
@@ -359,6 +360,7 @@ LocaleDisplayNamesImpl::LocaleDisplayNamesImpl(const Locale& locale,
, capitalizationContext(UDISPCTX_CAPITALIZATION_NONE)
, capitalizationBrkIter(NULL)
, nameLength(UDISPCTX_LENGTH_FULL)
+ , substitute(UDISPCTX_SUBSTITUTE)
{
initialize();
}
@@ -371,6 +373,7 @@ LocaleDisplayNamesImpl::LocaleDisplayNamesImpl(const Locale& locale,
, capitalizationContext(UDISPCTX_CAPITALIZATION_NONE)
, capitalizationBrkIter(NULL)
, nameLength(UDISPCTX_LENGTH_FULL)
+ , substitute(UDISPCTX_SUBSTITUTE)
{
while (length-- > 0) {
UDisplayContext value = *contexts++;
@@ -385,6 +388,9 @@ LocaleDisplayNamesImpl::LocaleDisplayNamesImpl(const Locale& locale,
case UDISPCTX_TYPE_DISPLAY_LENGTH:
nameLength = value;
break;
+ case UDISPCTX_TYPE_SUBSTITUTE_HANDLING:
+ substitute = value;
+ break;
default:
break;
}
@@ -535,6 +541,8 @@ LocaleDisplayNamesImpl::getContext(UDisplayContextType type) const {
return capitalizationContext;
case UDISPCTX_TYPE_DISPLAY_LENGTH:
return nameLength;
+ case UDISPCTX_TYPE_SUBSTITUTE_HANDLING:
+ return substitute;
default:
break;
}
@@ -549,7 +557,7 @@ LocaleDisplayNamesImpl::adjustForUsageAndContext(CapContextUsage usage,
if ( result.length() > 0 && u_islower(result.char32At(0)) && capitalizationBrkIter!= NULL &&
( capitalizationContext==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE || fCapitalization[usage] ) ) {
// note fCapitalization[usage] won't be set unless capitalizationContext is UI_LIST_OR_MENU or STANDALONE
- static UMutex capitalizationBrkIterLock = U_MUTEX_INITIALIZER;
+ static UMutex capitalizationBrkIterLock;
Mutex lock(&capitalizationBrkIterLock);
result.toTitle(capitalizationBrkIter, locale, U_TITLECASE_NO_LOWERCASE | U_TITLECASE_NO_BREAK_ADJUSTMENT);
}
@@ -583,7 +591,7 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
do { // loop construct is so we can break early out of search
if (hasScript && hasCountry) {
ncat(buffer, ULOC_FULLNAME_CAPACITY, lang, "_", script, "_", country, (char *)0);
- localeIdName(buffer, resultName);
+ localeIdName(buffer, resultName, false);
if (!resultName.isBogus()) {
hasScript = FALSE;
hasCountry = FALSE;
@@ -592,7 +600,7 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
}
if (hasScript) {
ncat(buffer, ULOC_FULLNAME_CAPACITY, lang, "_", script, (char *)0);
- localeIdName(buffer, resultName);
+ localeIdName(buffer, resultName, false);
if (!resultName.isBogus()) {
hasScript = FALSE;
break;
@@ -600,7 +608,7 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
}
if (hasCountry) {
ncat(buffer, ULOC_FULLNAME_CAPACITY, lang, "_", country, (char*)0);
- localeIdName(buffer, resultName);
+ localeIdName(buffer, resultName, false);
if (!resultName.isBogus()) {
hasCountry = FALSE;
break;
@@ -609,7 +617,11 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
} while (FALSE);
}
if (resultName.isBogus() || resultName.isEmpty()) {
- localeIdName(lang, resultName);
+ localeIdName(lang, resultName, substitute == UDISPCTX_SUBSTITUTE);
+ if (resultName.isBogus()) {
+ result.setToBogus();
+ return result;
+ }
}
UnicodeString resultRemainder;
@@ -617,13 +629,28 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
UErrorCode status = U_ZERO_ERROR;
if (hasScript) {
- resultRemainder.append(scriptDisplayName(script, temp, TRUE));
+ UnicodeString script_str = scriptDisplayName(script, temp, TRUE);
+ if (script_str.isBogus()) {
+ result.setToBogus();
+ return result;
+ }
+ resultRemainder.append(script_str);
}
if (hasCountry) {
- appendWithSep(resultRemainder, regionDisplayName(country, temp, TRUE));
+ UnicodeString region_str = regionDisplayName(country, temp, TRUE);
+ if (region_str.isBogus()) {
+ result.setToBogus();
+ return result;
+ }
+ appendWithSep(resultRemainder, region_str);
}
if (hasVariant) {
- appendWithSep(resultRemainder, variantDisplayName(variant, temp, TRUE));
+ UnicodeString variant_str = variantDisplayName(variant, temp, TRUE);
+ if (variant_str.isBogus()) {
+ result.setToBogus();
+ return result;
+ }
+ appendWithSep(resultRemainder, variant_str);
}
resultRemainder.findAndReplace(formatOpenParen, formatReplaceOpenParen);
resultRemainder.findAndReplace(formatCloseParen, formatReplaceCloseParen);
@@ -689,14 +716,18 @@ LocaleDisplayNamesImpl::localeDisplayName(const char* localeId,
// private
UnicodeString&
LocaleDisplayNamesImpl::localeIdName(const char* localeId,
- UnicodeString& result) const {
+ UnicodeString& result, bool substitute) const {
if (nameLength == UDISPCTX_LENGTH_SHORT) {
langData.getNoFallback("Languages%short", localeId, result);
if (!result.isBogus()) {
return result;
}
}
- return langData.getNoFallback("Languages", localeId, result);
+ if (substitute) {
+ return langData.get("Languages", localeId, result);
+ } else {
+ return langData.getNoFallback("Languages", localeId, result);
+ }
}
UnicodeString&
@@ -706,12 +737,16 @@ LocaleDisplayNamesImpl::languageDisplayName(const char* lang,
return result = UnicodeString(lang, -1, US_INV);
}
if (nameLength == UDISPCTX_LENGTH_SHORT) {
- langData.get("Languages%short", lang, result);
+ langData.getNoFallback("Languages%short", lang, result);
if (!result.isBogus()) {
return adjustForUsageAndContext(kCapContextUsageLanguage, result);
}
}
- langData.get("Languages", lang, result);
+ if (substitute == UDISPCTX_SUBSTITUTE) {
+ langData.get("Languages", lang, result);
+ } else {
+ langData.getNoFallback("Languages", lang, result);
+ }
return adjustForUsageAndContext(kCapContextUsageLanguage, result);
}
@@ -720,12 +755,16 @@ LocaleDisplayNamesImpl::scriptDisplayName(const char* script,
UnicodeString& result,
UBool skipAdjust) const {
if (nameLength == UDISPCTX_LENGTH_SHORT) {
- langData.get("Scripts%short", script, result);
+ langData.getNoFallback("Scripts%short", script, result);
if (!result.isBogus()) {
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageScript, result);
}
}
- langData.get("Scripts", script, result);
+ if (substitute == UDISPCTX_SUBSTITUTE) {
+ langData.get("Scripts", script, result);
+ } else {
+ langData.getNoFallback("Scripts", script, result);
+ }
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageScript, result);
}
@@ -746,12 +785,16 @@ LocaleDisplayNamesImpl::regionDisplayName(const char* region,
UnicodeString& result,
UBool skipAdjust) const {
if (nameLength == UDISPCTX_LENGTH_SHORT) {
- regionData.get("Countries%short", region, result);
+ regionData.getNoFallback("Countries%short", region, result);
if (!result.isBogus()) {
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageTerritory, result);
}
}
- regionData.get("Countries", region, result);
+ if (substitute == UDISPCTX_SUBSTITUTE) {
+ regionData.get("Countries", region, result);
+ } else {
+ regionData.getNoFallback("Countries", region, result);
+ }
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageTerritory, result);
}
@@ -767,7 +810,11 @@ LocaleDisplayNamesImpl::variantDisplayName(const char* variant,
UnicodeString& result,
UBool skipAdjust) const {
// don't have a resource for short variant names
- langData.get("Variants", variant, result);
+ if (substitute == UDISPCTX_SUBSTITUTE) {
+ langData.get("Variants", variant, result);
+ } else {
+ langData.getNoFallback("Variants", variant, result);
+ }
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageVariant, result);
}
@@ -782,7 +829,11 @@ LocaleDisplayNamesImpl::keyDisplayName(const char* key,
UnicodeString& result,
UBool skipAdjust) const {
// don't have a resource for short key names
- langData.get("Keys", key, result);
+ if (substitute == UDISPCTX_SUBSTITUTE) {
+ langData.get("Keys", key, result);
+ } else {
+ langData.getNoFallback("Keys", key, result);
+ }
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageKey, result);
}
@@ -802,9 +853,8 @@ LocaleDisplayNamesImpl::keyValueDisplayName(const char* key,
UErrorCode sts = U_ZERO_ERROR;
UnicodeString ustrValue(value, -1, US_INV);
int32_t len;
- UBool isChoice = FALSE;
const UChar *currencyName = ucurr_getName(ustrValue.getTerminatedBuffer(),
- locale.getBaseName(), UCURR_LONG_NAME, &isChoice, &len, &sts);
+ locale.getBaseName(), UCURR_LONG_NAME, nullptr /* isChoiceFormat */, &len, &sts);
if (U_FAILURE(sts)) {
// Return the value as is on failure
result = ustrValue;
@@ -815,12 +865,16 @@ LocaleDisplayNamesImpl::keyValueDisplayName(const char* key,
}
if (nameLength == UDISPCTX_LENGTH_SHORT) {
- langData.get("Types%short", key, value, result);
+ langData.getNoFallback("Types%short", key, value, result);
if (!result.isBogus()) {
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageKeyValue, result);
}
}
- langData.get("Types", key, value, result);
+ if (substitute == UDISPCTX_SUBSTITUTE) {
+ langData.get("Types", key, value, result);
+ } else {
+ langData.getNoFallback("Types", key, value, result);
+ }
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageKeyValue, result);
}
diff --git a/deps/icu-small/source/common/locid.cpp b/deps/icu-small/source/common/locid.cpp
index 06986b636adc31..c6d3f88fc3be07 100644
--- a/deps/icu-small/source/common/locid.cpp
+++ b/deps/icu-small/source/common/locid.cpp
@@ -38,19 +38,19 @@
#include "unicode/strenum.h"
#include "unicode/stringpiece.h"
#include "unicode/uloc.h"
-#include "putilimp.h"
-#include "mutex.h"
-#include "umutex.h"
-#include "uassert.h"
+
+#include "bytesinkutil.h"
+#include "charstr.h"
#include "cmemory.h"
#include "cstring.h"
+#include "mutex.h"
+#include "putilimp.h"
#include "uassert.h"
+#include "ucln_cmn.h"
#include "uhash.h"
#include "ulocimp.h"
-#include "ucln_cmn.h"
+#include "umutex.h"
#include "ustr_imp.h"
-#include "charstr.h"
-#include "bytesinkutil.h"
U_CDECL_BEGIN
static UBool U_CALLCONV locale_cleanup(void);
@@ -62,10 +62,7 @@ static Locale *gLocaleCache = NULL;
static UInitOnce gLocaleCacheInitOnce = U_INITONCE_INITIALIZER;
// gDefaultLocaleMutex protects all access to gDefaultLocalesHashT and gDefaultLocale.
-static UMutex *gDefaultLocaleMutex() {
- static UMutex m = U_MUTEX_INITIALIZER;
- return &m;
-}
+static UMutex gDefaultLocaleMutex;
static UHashtable *gDefaultLocalesHashT = NULL;
static Locale *gDefaultLocale = NULL;
@@ -174,7 +171,7 @@ U_NAMESPACE_BEGIN
Locale *locale_set_default_internal(const char *id, UErrorCode& status) {
// Synchronize this entire function.
- Mutex lock(gDefaultLocaleMutex());
+ Mutex lock(&gDefaultLocaleMutex);
UBool canonicalize = FALSE;
@@ -711,7 +708,7 @@ const Locale& U_EXPORT2
Locale::getDefault()
{
{
- Mutex lock(gDefaultLocaleMutex());
+ Mutex lock(&gDefaultLocaleMutex);
if (gDefaultLocale != NULL) {
return *gDefaultLocale;
}
@@ -1399,5 +1396,7 @@ Locale::getBaseName() const {
return baseName;
}
+Locale::Iterator::~Iterator() = default;
+
//eof
U_NAMESPACE_END
diff --git a/deps/icu-small/source/common/loclikely.cpp b/deps/icu-small/source/common/loclikely.cpp
index 50cc2a65de0b2d..a4a4181cb13b5c 100644
--- a/deps/icu-small/source/common/loclikely.cpp
+++ b/deps/icu-small/source/common/loclikely.cpp
@@ -148,7 +148,7 @@ appendTag(
* to be used when constructing the new tag. If the alternateTags parameter is NULL, or
* it contains no language tag, the default tag for the unknown language is used.
*
- * If the length of the new string exceeds the capacity of the output buffer,
+ * If the length of the new string exceeds the capacity of the output buffer,
* the function copies as many bytes to the output buffer as it can, and returns
* the error U_BUFFER_OVERFLOW_ERROR.
*
@@ -366,7 +366,7 @@ createTagStringWithAlternates(
* must be less than or equal to 0. If the lang parameter is an empty string, the
* default value for an unknown language is written to the output buffer.
*
- * If the length of the new string exceeds the capacity of the output buffer,
+ * If the length of the new string exceeds the capacity of the output buffer,
* the function copies as many bytes to the output buffer as it can, and returns
* the error U_BUFFER_OVERFLOW_ERROR.
*
@@ -508,7 +508,7 @@ parseTagString(
*/
if (_isIDSeparator(*position)) {
++position;
- }
+ }
}
subtagLength = ulocimp_getCountry(position, region, *regionLength, &position);
@@ -807,24 +807,24 @@ createLikelySubtagsString(
return FALSE;
}
-#define CHECK_TRAILING_VARIANT_SIZE(trailing, trailingLength) \
- { int32_t count = 0; \
- int32_t i; \
- for (i = 0; i < trailingLength; i++) { \
- if (trailing[i] == '-' || trailing[i] == '_') { \
- count = 0; \
- if (count > 8) { \
- goto error; \
- } \
- } else if (trailing[i] == '@') { \
- break; \
- } else if (count > 8) { \
+#define CHECK_TRAILING_VARIANT_SIZE(trailing, trailingLength) UPRV_BLOCK_MACRO_BEGIN { \
+ int32_t count = 0; \
+ int32_t i; \
+ for (i = 0; i < trailingLength; i++) { \
+ if (trailing[i] == '-' || trailing[i] == '_') { \
+ count = 0; \
+ if (count > 8) { \
goto error; \
- } else { \
- count++; \
} \
+ } else if (trailing[i] == '@') { \
+ break; \
+ } else if (count > 8) { \
+ goto error; \
+ } else { \
+ count++; \
} \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
static void
_uloc_addLikelySubtags(const char* localeID,
@@ -1355,3 +1355,4 @@ ulocimp_getRegionForSupplementalData(const char *localeID, UBool inferRegion,
uprv_strncpy(region, rgBuf, regionCapacity);
return u_terminateChars(region, regionCapacity, rgLen, status);
}
+
diff --git a/deps/icu-small/source/common/loclikelysubtags.cpp b/deps/icu-small/source/common/loclikelysubtags.cpp
new file mode 100644
index 00000000000000..d7f5e124c2c790
--- /dev/null
+++ b/deps/icu-small/source/common/loclikelysubtags.cpp
@@ -0,0 +1,638 @@
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// loclikelysubtags.cpp
+// created: 2019may08 Markus W. Scherer
+
+#include
+#include "unicode/utypes.h"
+#include "unicode/bytestrie.h"
+#include "unicode/localpointer.h"
+#include "unicode/locid.h"
+#include "unicode/uobject.h"
+#include "unicode/ures.h"
+#include "charstr.h"
+#include "cstring.h"
+#include "loclikelysubtags.h"
+#include "lsr.h"
+#include "uassert.h"
+#include "ucln_cmn.h"
+#include "uhash.h"
+#include "uinvchar.h"
+#include "umutex.h"
+#include "uresdata.h"
+#include "uresimp.h"
+
+U_NAMESPACE_BEGIN
+
+namespace {
+
+constexpr char PSEUDO_ACCENTS_PREFIX = '\''; // -XA, -PSACCENT
+constexpr char PSEUDO_BIDI_PREFIX = '+'; // -XB, -PSBIDI
+constexpr char PSEUDO_CRACKED_PREFIX = ','; // -XC, -PSCRACK
+
+/**
+ * Stores NUL-terminated strings with duplicate elimination.
+ * Checks for unique UTF-16 string pointers and converts to invariant characters.
+ */
+class UniqueCharStrings {
+public:
+ UniqueCharStrings(UErrorCode &errorCode) : strings(nullptr) {
+ uhash_init(&map, uhash_hashUChars, uhash_compareUChars, uhash_compareLong, &errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ strings = new CharString();
+ if (strings == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ }
+ }
+ ~UniqueCharStrings() {
+ uhash_close(&map);
+ delete strings;
+ }
+
+ /** Returns/orphans the CharString that contains all strings. */
+ CharString *orphanCharStrings() {
+ CharString *result = strings;
+ strings = nullptr;
+ return result;
+ }
+
+ /** Adds a string and returns a unique number for it. */
+ int32_t add(const UnicodeString &s, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return 0; }
+ if (isFrozen) {
+ errorCode = U_NO_WRITE_PERMISSION;
+ return 0;
+ }
+ // The string points into the resource bundle.
+ const char16_t *p = s.getBuffer();
+ int32_t oldIndex = uhash_geti(&map, p);
+ if (oldIndex != 0) { // found duplicate
+ return oldIndex;
+ }
+ // Explicit NUL terminator for the previous string.
+ // The strings object is also terminated with one implicit NUL.
+ strings->append(0, errorCode);
+ int32_t newIndex = strings->length();
+ strings->appendInvariantChars(s, errorCode);
+ uhash_puti(&map, const_cast(p), newIndex, &errorCode);
+ return newIndex;
+ }
+
+ void freeze() { isFrozen = true; }
+
+ /**
+ * Returns a string pointer for its unique number, if this object is frozen.
+ * Otherwise nullptr.
+ */
+ const char *get(int32_t i) const {
+ U_ASSERT(isFrozen);
+ return isFrozen && i > 0 ? strings->data() + i : nullptr;
+ }
+
+private:
+ UHashtable map;
+ CharString *strings;
+ bool isFrozen = false;
+};
+
+} // namespace
+
+LocaleDistanceData::LocaleDistanceData(LocaleDistanceData &&data) :
+ distanceTrieBytes(data.distanceTrieBytes),
+ regionToPartitions(data.regionToPartitions),
+ partitions(data.partitions),
+ paradigms(data.paradigms), paradigmsLength(data.paradigmsLength),
+ distances(data.distances) {
+ data.partitions = nullptr;
+ data.paradigms = nullptr;
+}
+
+LocaleDistanceData::~LocaleDistanceData() {
+ uprv_free(partitions);
+ delete[] paradigms;
+}
+
+// TODO(ICU-20777): Rename to just LikelySubtagsData.
+struct XLikelySubtagsData {
+ UResourceBundle *langInfoBundle = nullptr;
+ UniqueCharStrings strings;
+ CharStringMap languageAliases;
+ CharStringMap regionAliases;
+ const uint8_t *trieBytes = nullptr;
+ LSR *lsrs = nullptr;
+ int32_t lsrsLength = 0;
+
+ LocaleDistanceData distanceData;
+
+ XLikelySubtagsData(UErrorCode &errorCode) : strings(errorCode) {}
+
+ ~XLikelySubtagsData() {
+ ures_close(langInfoBundle);
+ delete[] lsrs;
+ }
+
+ void load(UErrorCode &errorCode) {
+ langInfoBundle = ures_openDirect(nullptr, "langInfo", &errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ StackUResourceBundle stackTempBundle;
+ ResourceDataValue value;
+ ures_getValueWithFallback(langInfoBundle, "likely", stackTempBundle.getAlias(),
+ value, errorCode);
+ ResourceTable likelyTable = value.getTable(errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+
+ // Read all strings in the resource bundle and convert them to invariant char *.
+ LocalMemory languageIndexes, regionIndexes, lsrSubtagIndexes;
+ int32_t languagesLength = 0, regionsLength = 0, lsrSubtagsLength = 0;
+ if (!readStrings(likelyTable, "languageAliases", value,
+ languageIndexes, languagesLength, errorCode) ||
+ !readStrings(likelyTable, "regionAliases", value,
+ regionIndexes, regionsLength, errorCode) ||
+ !readStrings(likelyTable, "lsrs", value,
+ lsrSubtagIndexes,lsrSubtagsLength, errorCode)) {
+ return;
+ }
+ if ((languagesLength & 1) != 0 ||
+ (regionsLength & 1) != 0 ||
+ (lsrSubtagsLength % 3) != 0) {
+ errorCode = U_INVALID_FORMAT_ERROR;
+ return;
+ }
+ if (lsrSubtagsLength == 0) {
+ errorCode = U_MISSING_RESOURCE_ERROR;
+ return;
+ }
+
+ if (!likelyTable.findValue("trie", value)) {
+ errorCode = U_MISSING_RESOURCE_ERROR;
+ return;
+ }
+ int32_t length;
+ trieBytes = value.getBinary(length, errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+
+ // Also read distance/matcher data if available,
+ // to open & keep only one resource bundle pointer
+ // and to use one single UniqueCharStrings.
+ UErrorCode matchErrorCode = U_ZERO_ERROR;
+ ures_getValueWithFallback(langInfoBundle, "match", stackTempBundle.getAlias(),
+ value, matchErrorCode);
+ LocalMemory partitionIndexes, paradigmSubtagIndexes;
+ int32_t partitionsLength = 0, paradigmSubtagsLength = 0;
+ if (U_SUCCESS(matchErrorCode)) {
+ ResourceTable matchTable = value.getTable(errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+
+ if (matchTable.findValue("trie", value)) {
+ distanceData.distanceTrieBytes = value.getBinary(length, errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ }
+
+ if (matchTable.findValue("regionToPartitions", value)) {
+ distanceData.regionToPartitions = value.getBinary(length, errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ if (length < LSR::REGION_INDEX_LIMIT) {
+ errorCode = U_INVALID_FORMAT_ERROR;
+ return;
+ }
+ }
+
+ if (!readStrings(matchTable, "partitions", value,
+ partitionIndexes, partitionsLength, errorCode) ||
+ !readStrings(matchTable, "paradigms", value,
+ paradigmSubtagIndexes, paradigmSubtagsLength, errorCode)) {
+ return;
+ }
+ if ((paradigmSubtagsLength % 3) != 0) {
+ errorCode = U_INVALID_FORMAT_ERROR;
+ return;
+ }
+
+ if (matchTable.findValue("distances", value)) {
+ distanceData.distances = value.getIntVector(length, errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ if (length < 4) { // LocaleDistance IX_LIMIT
+ errorCode = U_INVALID_FORMAT_ERROR;
+ return;
+ }
+ }
+ } else if (matchErrorCode == U_MISSING_RESOURCE_ERROR) {
+ // ok for likely subtags
+ } else { // error other than missing resource
+ errorCode = matchErrorCode;
+ return;
+ }
+
+ // Fetch & store invariant-character versions of strings
+ // only after we have collected and de-duplicated all of them.
+ strings.freeze();
+
+ languageAliases = CharStringMap(languagesLength / 2, errorCode);
+ for (int32_t i = 0; i < languagesLength; i += 2) {
+ languageAliases.put(strings.get(languageIndexes[i]),
+ strings.get(languageIndexes[i + 1]), errorCode);
+ }
+
+ regionAliases = CharStringMap(regionsLength / 2, errorCode);
+ for (int32_t i = 0; i < regionsLength; i += 2) {
+ regionAliases.put(strings.get(regionIndexes[i]),
+ strings.get(regionIndexes[i + 1]), errorCode);
+ }
+ if (U_FAILURE(errorCode)) { return; }
+
+ lsrsLength = lsrSubtagsLength / 3;
+ lsrs = new LSR[lsrsLength];
+ if (lsrs == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ for (int32_t i = 0, j = 0; i < lsrSubtagsLength; i += 3, ++j) {
+ lsrs[j] = LSR(strings.get(lsrSubtagIndexes[i]),
+ strings.get(lsrSubtagIndexes[i + 1]),
+ strings.get(lsrSubtagIndexes[i + 2]));
+ }
+
+ if (partitionsLength > 0) {
+ distanceData.partitions = static_cast(
+ uprv_malloc(partitionsLength * sizeof(const char *)));
+ if (distanceData.partitions == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ for (int32_t i = 0; i < partitionsLength; ++i) {
+ distanceData.partitions[i] = strings.get(partitionIndexes[i]);
+ }
+ }
+
+ if (paradigmSubtagsLength > 0) {
+ distanceData.paradigmsLength = paradigmSubtagsLength / 3;
+ LSR *paradigms = new LSR[distanceData.paradigmsLength];
+ if (paradigms == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ for (int32_t i = 0, j = 0; i < paradigmSubtagsLength; i += 3, ++j) {
+ paradigms[j] = LSR(strings.get(paradigmSubtagIndexes[i]),
+ strings.get(paradigmSubtagIndexes[i + 1]),
+ strings.get(paradigmSubtagIndexes[i + 2]));
+ }
+ distanceData.paradigms = paradigms;
+ }
+ }
+
+private:
+ bool readStrings(const ResourceTable &table, const char *key, ResourceValue &value,
+ LocalMemory &indexes, int32_t &length, UErrorCode &errorCode) {
+ if (table.findValue(key, value)) {
+ ResourceArray stringArray = value.getArray(errorCode);
+ if (U_FAILURE(errorCode)) { return false; }
+ length = stringArray.getSize();
+ if (length == 0) { return true; }
+ int32_t *rawIndexes = indexes.allocateInsteadAndCopy(length);
+ if (rawIndexes == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return false;
+ }
+ for (int i = 0; i < length; ++i) {
+ stringArray.getValue(i, value); // returns TRUE because i < length
+ rawIndexes[i] = strings.add(value.getUnicodeString(errorCode), errorCode);
+ if (U_FAILURE(errorCode)) { return false; }
+ }
+ }
+ return true;
+ }
+};
+
+namespace {
+
+XLikelySubtags *gLikelySubtags = nullptr;
+UInitOnce gInitOnce = U_INITONCE_INITIALIZER;
+
+UBool U_CALLCONV cleanup() {
+ delete gLikelySubtags;
+ gLikelySubtags = nullptr;
+ gInitOnce.reset();
+ return TRUE;
+}
+
+} // namespace
+
+void U_CALLCONV XLikelySubtags::initLikelySubtags(UErrorCode &errorCode) {
+ // This function is invoked only via umtx_initOnce().
+ U_ASSERT(gLikelySubtags == nullptr);
+ XLikelySubtagsData data(errorCode);
+ data.load(errorCode);
+ if (U_FAILURE(errorCode)) { return; }
+ gLikelySubtags = new XLikelySubtags(data);
+ if (gLikelySubtags == nullptr) {
+ errorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
+ }
+ ucln_common_registerCleanup(UCLN_COMMON_LIKELY_SUBTAGS, cleanup);
+}
+
+const XLikelySubtags *XLikelySubtags::getSingleton(UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return nullptr; }
+ umtx_initOnce(gInitOnce, &XLikelySubtags::initLikelySubtags, errorCode);
+ return gLikelySubtags;
+}
+
+XLikelySubtags::XLikelySubtags(XLikelySubtagsData &data) :
+ langInfoBundle(data.langInfoBundle),
+ strings(data.strings.orphanCharStrings()),
+ languageAliases(std::move(data.languageAliases)),
+ regionAliases(std::move(data.regionAliases)),
+ trie(data.trieBytes),
+ lsrs(data.lsrs),
+#if U_DEBUG
+ lsrsLength(data.lsrsLength),
+#endif
+ distanceData(std::move(data.distanceData)) {
+ data.langInfoBundle = nullptr;
+ data.lsrs = nullptr;
+
+ // Cache the result of looking up language="und" encoded as "*", and "und-Zzzz" ("**").
+ UStringTrieResult result = trie.next(u'*');
+ U_ASSERT(USTRINGTRIE_HAS_NEXT(result));
+ trieUndState = trie.getState64();
+ result = trie.next(u'*');
+ U_ASSERT(USTRINGTRIE_HAS_NEXT(result));
+ trieUndZzzzState = trie.getState64();
+ result = trie.next(u'*');
+ U_ASSERT(USTRINGTRIE_HAS_VALUE(result));
+ defaultLsrIndex = trie.getValue();
+ trie.reset();
+
+ for (char16_t c = u'a'; c <= u'z'; ++c) {
+ result = trie.next(c);
+ if (result == USTRINGTRIE_NO_VALUE) {
+ trieFirstLetterStates[c - u'a'] = trie.getState64();
+ }
+ trie.reset();
+ }
+}
+
+XLikelySubtags::~XLikelySubtags() {
+ ures_close(langInfoBundle);
+ delete strings;
+ delete[] lsrs;
+}
+
+LSR XLikelySubtags::makeMaximizedLsrFrom(const Locale &locale, UErrorCode &errorCode) const {
+ const char *name = locale.getName();
+ if (uprv_isAtSign(name[0]) && name[1] == 'x' && name[2] == '=') { // name.startsWith("@x=")
+ // Private use language tag x-subtag-subtag...
+ return LSR(name, "", "");
+ }
+ return makeMaximizedLsr(locale.getLanguage(), locale.getScript(), locale.getCountry(),
+ locale.getVariant(), errorCode);
+}
+
+namespace {
+
+const char *getCanonical(const CharStringMap &aliases, const char *alias) {
+ const char *canonical = aliases.get(alias);
+ return canonical == nullptr ? alias : canonical;
+}
+
+} // namespace
+
+LSR XLikelySubtags::makeMaximizedLsr(const char *language, const char *script, const char *region,
+ const char *variant, UErrorCode &errorCode) const {
+ // Handle pseudolocales like en-XA, ar-XB, fr-PSCRACK.
+ // They should match only themselves,
+ // not other locales with what looks like the same language and script subtags.
+ char c1;
+ if (region[0] == 'X' && (c1 = region[1]) != 0 && region[2] == 0) {
+ switch (c1) {
+ case 'A':
+ return LSR(PSEUDO_ACCENTS_PREFIX, language, script, region, errorCode);
+ case 'B':
+ return LSR(PSEUDO_BIDI_PREFIX, language, script, region, errorCode);
+ case 'C':
+ return LSR(PSEUDO_CRACKED_PREFIX, language, script, region, errorCode);
+ default: // normal locale
+ break;
+ }
+ }
+
+ if (variant[0] == 'P' && variant[1] == 'S') {
+ if (uprv_strcmp(variant, "PSACCENT") == 0) {
+ return LSR(PSEUDO_ACCENTS_PREFIX, language, script,
+ *region == 0 ? "XA" : region, errorCode);
+ } else if (uprv_strcmp(variant, "PSBIDI") == 0) {
+ return LSR(PSEUDO_BIDI_PREFIX, language, script,
+ *region == 0 ? "XB" : region, errorCode);
+ } else if (uprv_strcmp(variant, "PSCRACK") == 0) {
+ return LSR(PSEUDO_CRACKED_PREFIX, language, script,
+ *region == 0 ? "XC" : region, errorCode);
+ }
+ // else normal locale
+ }
+
+ language = getCanonical(languageAliases, language);
+ // (We have no script mappings.)
+ region = getCanonical(regionAliases, region);
+ return maximize(language, script, region);
+}
+
+LSR XLikelySubtags::maximize(const char *language, const char *script, const char *region) const {
+ if (uprv_strcmp(language, "und") == 0) {
+ language = "";
+ }
+ if (uprv_strcmp(script, "Zzzz") == 0) {
+ script = "";
+ }
+ if (uprv_strcmp(region, "ZZ") == 0) {
+ region = "";
+ }
+ if (*script != 0 && *region != 0 && *language != 0) {
+ return LSR(language, script, region); // already maximized
+ }
+
+ uint32_t retainOldMask = 0;
+ BytesTrie iter(trie);
+ uint64_t state;
+ int32_t value;
+ // Small optimization: Array lookup for first language letter.
+ int32_t c0;
+ if (0 <= (c0 = uprv_lowerOrdinal(language[0])) && c0 <= 25 &&
+ language[1] != 0 && // language.length() >= 2
+ (state = trieFirstLetterStates[c0]) != 0) {
+ value = trieNext(iter.resetToState64(state), language, 1);
+ } else {
+ value = trieNext(iter, language, 0);
+ }
+ if (value >= 0) {
+ if (*language != 0) {
+ retainOldMask |= 4;
+ }
+ state = iter.getState64();
+ } else {
+ retainOldMask |= 4;
+ iter.resetToState64(trieUndState); // "und" ("*")
+ state = 0;
+ }
+
+ if (value > 0) {
+ // Intermediate or final value from just language.
+ if (value == SKIP_SCRIPT) {
+ value = 0;
+ }
+ if (*script != 0) {
+ retainOldMask |= 2;
+ }
+ } else {
+ value = trieNext(iter, script, 0);
+ if (value >= 0) {
+ if (*script != 0) {
+ retainOldMask |= 2;
+ }
+ state = iter.getState64();
+ } else {
+ retainOldMask |= 2;
+ if (state == 0) {
+ iter.resetToState64(trieUndZzzzState); // "und-Zzzz" ("**")
+ } else {
+ iter.resetToState64(state);
+ value = trieNext(iter, "", 0);
+ U_ASSERT(value >= 0);
+ state = iter.getState64();
+ }
+ }
+ }
+
+ if (value > 0) {
+ // Final value from just language or language+script.
+ if (*region != 0) {
+ retainOldMask |= 1;
+ }
+ } else {
+ value = trieNext(iter, region, 0);
+ if (value >= 0) {
+ if (*region != 0) {
+ retainOldMask |= 1;
+ }
+ } else {
+ retainOldMask |= 1;
+ if (state == 0) {
+ value = defaultLsrIndex;
+ } else {
+ iter.resetToState64(state);
+ value = trieNext(iter, "", 0);
+ U_ASSERT(value > 0);
+ }
+ }
+ }
+ U_ASSERT(value < lsrsLength);
+ const LSR &result = lsrs[value];
+
+ if (*language == 0) {
+ language = "und";
+ }
+
+ if (retainOldMask == 0) {
+ // Quickly return a copy of the lookup-result LSR
+ // without new allocation of the subtags.
+ return LSR(result.language, result.script, result.region);
+ }
+ if ((retainOldMask & 4) == 0) {
+ language = result.language;
+ }
+ if ((retainOldMask & 2) == 0) {
+ script = result.script;
+ }
+ if ((retainOldMask & 1) == 0) {
+ region = result.region;
+ }
+ return LSR(language, script, region);
+}
+
+int32_t XLikelySubtags::trieNext(BytesTrie &iter, const char *s, int32_t i) {
+ UStringTrieResult result;
+ uint8_t c;
+ if ((c = s[i]) == 0) {
+ result = iter.next(u'*');
+ } else {
+ for (;;) {
+ c = uprv_invCharToAscii(c);
+ // EBCDIC: If s[i] is not an invariant character,
+ // then c is now 0 and will simply not match anything, which is harmless.
+ uint8_t next = s[++i];
+ if (next != 0) {
+ if (!USTRINGTRIE_HAS_NEXT(iter.next(c))) {
+ return -1;
+ }
+ } else {
+ // last character of this subtag
+ result = iter.next(c | 0x80);
+ break;
+ }
+ c = next;
+ }
+ }
+ switch (result) {
+ case USTRINGTRIE_NO_MATCH: return -1;
+ case USTRINGTRIE_NO_VALUE: return 0;
+ case USTRINGTRIE_INTERMEDIATE_VALUE:
+ U_ASSERT(iter.getValue() == SKIP_SCRIPT);
+ return SKIP_SCRIPT;
+ case USTRINGTRIE_FINAL_VALUE: return iter.getValue();
+ default: return -1;
+ }
+}
+
+// TODO(ICU-20777): Switch Locale/uloc_ likely-subtags API from the old code
+// in loclikely.cpp to this new code, including activating this
+// minimizeSubtags() function. The LocaleMatcher does not minimize.
+#if 0
+LSR XLikelySubtags::minimizeSubtags(const char *languageIn, const char *scriptIn,
+ const char *regionIn, ULocale.Minimize fieldToFavor,
+ UErrorCode &errorCode) const {
+ LSR result = maximize(languageIn, scriptIn, regionIn);
+
+ // We could try just a series of checks, like:
+ // LSR result2 = addLikelySubtags(languageIn, "", "");
+ // if result.equals(result2) return result2;
+ // However, we can optimize 2 of the cases:
+ // (languageIn, "", "")
+ // (languageIn, "", regionIn)
+
+ // value00 = lookup(result.language, "", "")
+ BytesTrie iter = new BytesTrie(trie);
+ int value = trieNext(iter, result.language, 0);
+ U_ASSERT(value >= 0);
+ if (value == 0) {
+ value = trieNext(iter, "", 0);
+ U_ASSERT(value >= 0);
+ if (value == 0) {
+ value = trieNext(iter, "", 0);
+ }
+ }
+ U_ASSERT(value > 0);
+ LSR value00 = lsrs[value];
+ boolean favorRegionOk = false;
+ if (result.script.equals(value00.script)) { //script is default
+ if (result.region.equals(value00.region)) {
+ return new LSR(result.language, "", "");
+ } else if (fieldToFavor == ULocale.Minimize.FAVOR_REGION) {
+ return new LSR(result.language, "", result.region);
+ } else {
+ favorRegionOk = true;
+ }
+ }
+
+ // The last case is not as easy to optimize.
+ // Maybe do later, but for now use the straightforward code.
+ LSR result2 = maximize(languageIn, scriptIn, "");
+ if (result2.equals(result)) {
+ return new LSR(result.language, result.script, "");
+ } else if (favorRegionOk) {
+ return new LSR(result.language, "", result.region);
+ }
+ return result;
+}
+#endif
+
+U_NAMESPACE_END
diff --git a/deps/icu-small/source/common/loclikelysubtags.h b/deps/icu-small/source/common/loclikelysubtags.h
new file mode 100644
index 00000000000000..8c8a08ac5e314e
--- /dev/null
+++ b/deps/icu-small/source/common/loclikelysubtags.h
@@ -0,0 +1,143 @@
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// loclikelysubtags.h
+// created: 2019may08 Markus W. Scherer
+
+#ifndef __LOCLIKELYSUBTAGS_H__
+#define __LOCLIKELYSUBTAGS_H__
+
+#include
+#include "unicode/utypes.h"
+#include "unicode/bytestrie.h"
+#include "unicode/locid.h"
+#include "unicode/uobject.h"
+#include "unicode/ures.h"
+#include "lsr.h"
+#include "uhash.h"
+
+U_NAMESPACE_BEGIN
+
+struct XLikelySubtagsData;
+
+/**
+ * Map of const char * keys & values.
+ * Stores pointers as is: Does not own/copy/adopt/release strings.
+ */
+class CharStringMap final : public UMemory {
+public:
+ /** Constructs an unusable non-map. */
+ CharStringMap() : map(nullptr) {}
+ CharStringMap(int32_t size, UErrorCode &errorCode) {
+ map = uhash_openSize(uhash_hashChars, uhash_compareChars, uhash_compareChars,
+ size, &errorCode);
+ }
+ CharStringMap(CharStringMap &&other) U_NOEXCEPT : map(other.map) {
+ other.map = nullptr;
+ }
+ CharStringMap(const CharStringMap &other) = delete;
+ ~CharStringMap() {
+ uhash_close(map);
+ }
+
+ CharStringMap &operator=(CharStringMap &&other) U_NOEXCEPT {
+ map = other.map;
+ other.map = nullptr;
+ return *this;
+ }
+ CharStringMap &operator=(const CharStringMap &other) = delete;
+
+ const char *get(const char *key) const { return static_cast(uhash_get(map, key)); }
+ void put(const char *key, const char *value, UErrorCode &errorCode) {
+ uhash_put(map, const_cast(key), const_cast(value), &errorCode);
+ }
+
+private:
+ UHashtable *map;
+};
+
+struct LocaleDistanceData {
+ LocaleDistanceData() = default;
+ LocaleDistanceData(LocaleDistanceData &&data);
+ ~LocaleDistanceData();
+
+ const uint8_t *distanceTrieBytes = nullptr;
+ const uint8_t *regionToPartitions = nullptr;
+ const char **partitions = nullptr;
+ const LSR *paradigms = nullptr;
+ int32_t paradigmsLength = 0;
+ const int32_t *distances = nullptr;
+
+private:
+ LocaleDistanceData &operator=(const LocaleDistanceData &) = delete;
+};
+
+// TODO(ICU-20777): Rename to just LikelySubtags.
+class XLikelySubtags final : public UMemory {
+public:
+ ~XLikelySubtags();
+
+ static constexpr int32_t SKIP_SCRIPT = 1;
+
+ // VisibleForTesting
+ static const XLikelySubtags *getSingleton(UErrorCode &errorCode);
+
+ // VisibleForTesting
+ LSR makeMaximizedLsrFrom(const Locale &locale, UErrorCode &errorCode) const;
+
+ // TODO(ICU-20777): Switch Locale/uloc_ likely-subtags API from the old code
+ // in loclikely.cpp to this new code, including activating this
+ // minimizeSubtags() function. The LocaleMatcher does not minimize.
+#if 0
+ LSR minimizeSubtags(const char *languageIn, const char *scriptIn, const char *regionIn,
+ ULocale.Minimize fieldToFavor, UErrorCode &errorCode) const;
+#endif
+
+ // visible for LocaleDistance
+ const LocaleDistanceData &getDistanceData() const { return distanceData; }
+
+private:
+ XLikelySubtags(XLikelySubtagsData &data);
+ XLikelySubtags(const XLikelySubtags &other) = delete;
+ XLikelySubtags &operator=(const XLikelySubtags &other) = delete;
+
+ static void initLikelySubtags(UErrorCode &errorCode);
+
+ LSR makeMaximizedLsr(const char *language, const char *script, const char *region,
+ const char *variant, UErrorCode &errorCode) const;
+
+ /**
+ * Raw access to addLikelySubtags. Input must be in canonical format, eg "en", not "eng" or "EN".
+ */
+ LSR maximize(const char *language, const char *script, const char *region) const;
+
+ static int32_t trieNext(BytesTrie &iter, const char *s, int32_t i);
+
+ UResourceBundle *langInfoBundle;
+ // We could store the strings by value, except that if there were few enough strings,
+ // moving the contents could copy it to a different array,
+ // invalidating the pointers stored in the maps.
+ CharString *strings;
+ CharStringMap languageAliases;
+ CharStringMap regionAliases;
+
+ // The trie maps each lang+script+region (encoded in ASCII) to an index into lsrs.
+ // There is also a trie value for each intermediate lang and lang+script.
+ // '*' is used instead of "und", "Zzzz"/"" and "ZZ"/"".
+ BytesTrie trie;
+ uint64_t trieUndState;
+ uint64_t trieUndZzzzState;
+ int32_t defaultLsrIndex;
+ uint64_t trieFirstLetterStates[26];
+ const LSR *lsrs;
+#if U_DEBUG
+ int32_t lsrsLength;
+#endif
+
+ // distance/matcher data: see comment in XLikelySubtagsData::load()
+ LocaleDistanceData distanceData;
+};
+
+U_NAMESPACE_END
+
+#endif // __LOCLIKELYSUBTAGS_H__
diff --git a/deps/icu-small/source/common/locmap.cpp b/deps/icu-small/source/common/locmap.cpp
index 46986399b23e7a..a6311343551ed4 100644
--- a/deps/icu-small/source/common/locmap.cpp
+++ b/deps/icu-small/source/common/locmap.cpp
@@ -20,7 +20,7 @@
*
* Date Name Description
* 3/11/97 aliu Fixed off-by-one bug in assignment operator. Added
- * setId() method and safety check against
+ * setId() method and safety check against
* MAX_ID_LENGTH.
* 04/23/99 stephen Added C wrapper for convertToPosix.
* 09/18/00 george Removed the memory leaks.
@@ -115,7 +115,7 @@ static const ILcidPosixElement locmap_ ## id [] =
// Keep static locale variables inside the function so that
// it can be created properly during static init.
//
-// Note: This table should be updated periodically. Check the [MS-LCID] Windows Language Code Identifier
+// Note: This table should be updated periodically. Check the [MS-LCID] Windows Language Code Identifier
// (LCID) Reference defined at https://msdn.microsoft.com/en-us/library/cc233965.aspx
//
// Microsoft is moving away from LCID in favor of locale name as of Vista. This table needs to be
@@ -129,7 +129,7 @@ static const ILcidPosixElement locmap_ ## id [] =
////////////////////////////////////////////
*/
-// TODO: For Windows ideally this table would be a list of exceptions rather than a complete list as
+// TODO: For Windows ideally this table would be a list of exceptions rather than a complete list as
// LocaleNameToLCID and LCIDToLocaleName provide 90% of these.
ILCID_POSIX_ELEMENT_ARRAY(0x0436, af, af_ZA)
@@ -521,7 +521,7 @@ ILCID_POSIX_SUBTABLE(nl) {
/* The "no" locale split into nb and nn. By default in ICU, "no" is nb.*/
// TODO: Not all of these are needed on Windows, but I don't know how ICU treats preferred ones here.
ILCID_POSIX_SUBTABLE(no) {
- {0x14, "no"}, /* really nb_NO - actually Windows differentiates between neutral (no region) and specific (with region) */
+ {0x14, "no"}, /* really nb_NO - actually Windows differentiates between neutral (no region) and specific (with region) */
{0x7c14, "nb"}, /* really nb */
{0x0414, "nb_NO"}, /* really nb_NO. Keep first in the 414 list. */
{0x0414, "no_NO"}, /* really nb_NO */
@@ -1267,7 +1267,7 @@ uprv_convertToLCID(const char *langID, const char* posixID, UErrorCode* status)
mid = (high+low) >> 1; /*Finds median*/
- if (mid == oldmid)
+ if (mid == oldmid)
break;
compVal = uprv_strcmp(langID, gPosixIDmap[mid].regionMaps->posixID);
diff --git a/deps/icu-small/source/common/locmap.h b/deps/icu-small/source/common/locmap.h
index 492a9413628ffb..e669873a143bfd 100644
--- a/deps/icu-small/source/common/locmap.h
+++ b/deps/icu-small/source/common/locmap.h
@@ -9,7 +9,7 @@
******************************************************************************
*
* File locmap.h : Locale Mapping Classes
-*
+*
*
* Created by: Helena Shih
*
@@ -37,3 +37,4 @@ U_CAPI uint32_t uprv_convertToLCIDPlatform(const char* localeID, UErrorCode* sta
U_CAPI uint32_t uprv_convertToLCID(const char* langID, const char* posixID, UErrorCode* status);
#endif /* LOCMAP_H */
+
diff --git a/deps/icu-small/source/common/locresdata.cpp b/deps/icu-small/source/common/locresdata.cpp
index 69d744306417d5..d1d9a4729f107b 100644
--- a/deps/icu-small/source/common/locresdata.cpp
+++ b/deps/icu-small/source/common/locresdata.cpp
@@ -83,9 +83,9 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
if(U_FAILURE(errorCode)){
*pErrorCode = errorCode;
}
-
+
break;*/
-
+
ures_getByKeyWithFallback(table.getAlias(), subTableKey, table.getAlias(), &errorCode);
}
if(U_SUCCESS(errorCode)){
@@ -112,8 +112,8 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
break;
}
}
-
- if(U_FAILURE(errorCode)){
+
+ if(U_FAILURE(errorCode)){
/* still can't figure out ?.. try the fallback mechanism */
int32_t len = 0;
@@ -126,9 +126,9 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
*pErrorCode = errorCode;
break;
}
-
+
u_UCharsToChars(fallbackLocale, explicitFallbackName, len);
-
+
/* guard against recursive fallback */
if(uprv_strcmp(explicitFallbackName, locale)==0){
*pErrorCode = U_INTERNAL_PROGRAM_ERROR;
@@ -207,7 +207,7 @@ uloc_getCharacterOrientation(const char* localeId,
/**
* Get the layout line orientation for the specified locale.
- *
+ *
* @param localeID locale name
* @param status Error status
* @return an enum indicating the layout orientation for lines.
diff --git a/deps/icu-small/source/common/locutil.cpp b/deps/icu-small/source/common/locutil.cpp
index 74745a37d6d47c..3d9d69ff7ed0e2 100644
--- a/deps/icu-small/source/common/locutil.cpp
+++ b/deps/icu-small/source/common/locutil.cpp
@@ -33,7 +33,7 @@ static icu::Hashtable * LocaleUtility_cache = NULL;
*/
/**
- * Release all static memory held by Locale Utility.
+ * Release all static memory held by Locale Utility.
*/
U_CDECL_BEGIN
static UBool U_CALLCONV service_cleanup(void) {
@@ -271,3 +271,5 @@ U_NAMESPACE_END
/* !UCONFIG_NO_SERVICE */
#endif
+
+
diff --git a/deps/icu-small/source/common/lsr.cpp b/deps/icu-small/source/common/lsr.cpp
new file mode 100644
index 00000000000000..0c28eeda1bc7b6
--- /dev/null
+++ b/deps/icu-small/source/common/lsr.cpp
@@ -0,0 +1,101 @@
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// lsr.cpp
+// created: 2019may08 Markus W. Scherer
+
+#include "unicode/utypes.h"
+#include "charstr.h"
+#include "cmemory.h"
+#include "cstring.h"
+#include "lsr.h"
+#include "uinvchar.h"
+#include "ustr_imp.h"
+
+U_NAMESPACE_BEGIN
+
+LSR::LSR(char prefix, const char *lang, const char *scr, const char *r, UErrorCode &errorCode) :
+ language(nullptr), script(nullptr), region(r),
+ regionIndex(indexForRegion(region)) {
+ if (U_SUCCESS(errorCode)) {
+ CharString langScript;
+ langScript.append(prefix, errorCode).append(lang, errorCode).append('\0', errorCode);
+ int32_t scriptOffset = langScript.length();
+ langScript.append(prefix, errorCode).append(scr, errorCode);
+ owned = langScript.cloneData(errorCode);
+ if (U_SUCCESS(errorCode)) {
+ language = owned;
+ script = owned + scriptOffset;
+ }
+ }
+}
+
+LSR::LSR(LSR &&other) U_NOEXCEPT :
+ language(other.language), script(other.script), region(other.region), owned(other.owned),
+ regionIndex(other.regionIndex), hashCode(other.hashCode) {
+ if (owned != nullptr) {
+ other.language = other.script = "";
+ other.owned = nullptr;
+ other.hashCode = 0;
+ }
+}
+
+void LSR::deleteOwned() {
+ uprv_free(owned);
+}
+
+LSR &LSR::operator=(LSR &&other) U_NOEXCEPT {
+ this->~LSR();
+ language = other.language;
+ script = other.script;
+ region = other.region;
+ regionIndex = other.regionIndex;
+ owned = other.owned;
+ hashCode = other.hashCode;
+ if (owned != nullptr) {
+ other.language = other.script = "";
+ other.owned = nullptr;
+ other.hashCode = 0;
+ }
+ return *this;
+}
+
+UBool LSR::operator==(const LSR &other) const {
+ return
+ uprv_strcmp(language, other.language) == 0 &&
+ uprv_strcmp(script, other.script) == 0 &&
+ regionIndex == other.regionIndex &&
+ // Compare regions if both are ill-formed (and their indexes are 0).
+ (regionIndex > 0 || uprv_strcmp(region, other.region) == 0);
+}
+
+int32_t LSR::indexForRegion(const char *region) {
+ int32_t c = region[0];
+ int32_t a = c - '0';
+ if (0 <= a && a <= 9) { // digits: "419"
+ int32_t b = region[1] - '0';
+ if (b < 0 || 9 < b) { return 0; }
+ c = region[2] - '0';
+ if (c < 0 || 9 < c || region[3] != 0) { return 0; }
+ return (10 * a + b) * 10 + c + 1;
+ } else { // letters: "DE"
+ a = uprv_upperOrdinal(c);
+ if (a < 0 || 25 < a) { return 0; }
+ int32_t b = uprv_upperOrdinal(region[1]);
+ if (b < 0 || 25 < b || region[2] != 0) { return 0; }
+ return 26 * a + b + 1001;
+ }
+ return 0;
+}
+
+LSR &LSR::setHashCode() {
+ if (hashCode == 0) {
+ hashCode =
+ (ustr_hashCharsN(language, static_cast(uprv_strlen(language))) * 37 +
+ ustr_hashCharsN(script, static_cast(uprv_strlen(script)))) * 37 +
+ regionIndex;
+ }
+ return *this;
+}
+
+U_NAMESPACE_END
diff --git a/deps/icu-small/source/common/lsr.h b/deps/icu-small/source/common/lsr.h
new file mode 100644
index 00000000000000..db6cf938f47d02
--- /dev/null
+++ b/deps/icu-small/source/common/lsr.h
@@ -0,0 +1,72 @@
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// lsr.h
+// created: 2019may08 Markus W. Scherer
+
+#ifndef __LSR_H__
+#define __LSR_H__
+
+#include "unicode/utypes.h"
+#include "unicode/uobject.h"
+#include "cstring.h"
+
+U_NAMESPACE_BEGIN
+
+struct LSR final : public UMemory {
+ static constexpr int32_t REGION_INDEX_LIMIT = 1001 + 26 * 26;
+
+ const char *language;
+ const char *script;
+ const char *region;
+ char *owned = nullptr;
+ /** Index for region, 0 if ill-formed. @see indexForRegion */
+ int32_t regionIndex = 0;
+ /** Only set for LSRs that will be used in a hash table. */
+ int32_t hashCode = 0;
+
+ LSR() : language("und"), script(""), region("") {}
+
+ /** Constructor which aliases all subtag pointers. */
+ LSR(const char *lang, const char *scr, const char *r) :
+ language(lang), script(scr), region(r),
+ regionIndex(indexForRegion(region)) {}
+ /**
+ * Constructor which prepends the prefix to the language and script,
+ * copies those into owned memory, and aliases the region.
+ */
+ LSR(char prefix, const char *lang, const char *scr, const char *r, UErrorCode &errorCode);
+ LSR(LSR &&other) U_NOEXCEPT;
+ LSR(const LSR &other) = delete;
+ inline ~LSR() {
+ // Pure inline code for almost all instances.
+ if (owned != nullptr) {
+ deleteOwned();
+ }
+ }
+
+ LSR &operator=(LSR &&other) U_NOEXCEPT;
+ LSR &operator=(const LSR &other) = delete;
+
+ /**
+ * Returns a positive index (>0) for a well-formed region code.
+ * Do not rely on a particular region->index mapping; it may change.
+ * Returns 0 for ill-formed strings.
+ */
+ static int32_t indexForRegion(const char *region);
+
+ UBool operator==(const LSR &other) const;
+
+ inline UBool operator!=(const LSR &other) const {
+ return !operator==(other);
+ }
+
+ LSR &setHashCode();
+
+private:
+ void deleteOwned();
+};
+
+U_NAMESPACE_END
+
+#endif // __LSR_H__
diff --git a/deps/icu-small/source/common/messagepattern.cpp b/deps/icu-small/source/common/messagepattern.cpp
index 2f79780bd2c233..f223d0671164fb 100644
--- a/deps/icu-small/source/common/messagepattern.cpp
+++ b/deps/icu-small/source/common/messagepattern.cpp
@@ -454,7 +454,7 @@ MessagePattern::parseMessage(int32_t index, int32_t msgStartLength,
UChar c=msg.charAt(index++);
if(c==u_apos) {
if(index==msg.length()) {
- // The apostrophe is the last character in the pattern.
+ // The apostrophe is the last character in the pattern.
// Add a Part for auto-quoting.
addPart(UMSGPAT_PART_TYPE_INSERT_CHAR, index, 0,
u_apos, errorCode); // value=char to be inserted
diff --git a/deps/icu-small/source/common/msvcres.h b/deps/icu-small/source/common/msvcres.h
index d6581b27ebce51..0cace85e7472d0 100644
--- a/deps/icu-small/source/common/msvcres.h
+++ b/deps/icu-small/source/common/msvcres.h
@@ -11,8 +11,8 @@
//
/*
-These are defined before unicode/uversion.h in order to prevent
-STLPort's broken stddef.h from being used when rc.exe parses this file.
+These are defined before unicode/uversion.h in order to prevent
+STLPort's broken stddef.h from being used when rc.exe parses this file.
*/
#define _STLP_OUTERMOST_HEADER_ID 0
#define _STLP_WINCE 1
diff --git a/deps/icu-small/source/common/mutex.h b/deps/icu-small/source/common/mutex.h
index 5223397bbcc10a..44b1f90ba04dd2 100644
--- a/deps/icu-small/source/common/mutex.h
+++ b/deps/icu-small/source/common/mutex.h
@@ -28,50 +28,48 @@
U_NAMESPACE_BEGIN
-//----------------------------------------------------------------------------
-// Code within that accesses shared static or global data should
-// should instantiate a Mutex object while doing so. You should make your own
-// private mutex where possible.
-
-// For example:
-//
-// UMutex myMutex = U_MUTEX_INITIALIZER;
-//
-// void Function(int arg1, int arg2)
-// {
-// static Object* foo; // Shared read-write object
-// Mutex mutex(&myMutex); // or no args for the global lock
-// foo->Method();
-// // When 'mutex' goes out of scope and gets destroyed here, the lock is released
-// }
-//
-// Note: Do NOT use the form 'Mutex mutex();' as that merely forward-declares a function
-// returning a Mutex. This is a common mistake which silently slips through the
-// compiler!!
-//
+/**
+ * Mutex is a helper class for convenient locking and unlocking of a UMutex.
+ *
+ * Creating a local scope Mutex will lock a UMutex, holding the lock until the Mutex
+ * goes out of scope.
+ *
+ * If no UMutex is specified, the ICU global mutex is implied.
+ *
+ * For example:
+ *
+ * static UMutex myMutex;
+ *
+ * void Function(int arg1, int arg2)
+ * {
+ * static Object* foo; // Shared read-write object
+ * Mutex mutex(&myMutex); // or no args for the global lock
+ * foo->Method();
+ * // When 'mutex' goes out of scope and gets destroyed here, the lock is released
+ * }
+ *
+ * Note: Do NOT use the form 'Mutex mutex();' as that merely forward-declares a function
+ * returning a Mutex. This is a common mistake which silently slips through the
+ * compiler!!
+ */
class U_COMMON_API Mutex : public UMemory {
public:
- inline Mutex(UMutex *mutex = NULL);
- inline ~Mutex();
+ Mutex(UMutex *mutex = nullptr) : fMutex(mutex) {
+ umtx_lock(fMutex);
+ }
+ ~Mutex() {
+ umtx_unlock(fMutex);
+ }
-private:
- UMutex *fMutex;
+ Mutex(const Mutex &other) = delete; // forbid assigning of this class
+ Mutex &operator=(const Mutex &other) = delete; // forbid copying of this class
+ void *operator new(size_t s) = delete; // forbid heap allocation. Locals only.
- Mutex(const Mutex &other); // forbid copying of this class
- Mutex &operator=(const Mutex &other); // forbid copying of this class
+private:
+ UMutex *fMutex;
};
-inline Mutex::Mutex(UMutex *mutex)
- : fMutex(mutex)
-{
- umtx_lock(fMutex);
-}
-
-inline Mutex::~Mutex()
-{
- umtx_unlock(fMutex);
-}
U_NAMESPACE_END
diff --git a/deps/icu-small/source/common/normalizer2.cpp b/deps/icu-small/source/common/normalizer2.cpp
index ca5d3aba1a1874..6be7e0b21a2bf9 100644
--- a/deps/icu-small/source/common/normalizer2.cpp
+++ b/deps/icu-small/source/common/normalizer2.cpp
@@ -293,11 +293,11 @@ U_CDECL_BEGIN
static UBool U_CALLCONV uprv_normalizer2_cleanup() {
delete noopSingleton;
noopSingleton = NULL;
- noopInitOnce.reset();
+ noopInitOnce.reset();
#if NORM2_HARDCODE_NFC_DATA
delete nfcSingleton;
nfcSingleton = NULL;
- nfcInitOnce.reset();
+ nfcInitOnce.reset();
#endif
return TRUE;
}
diff --git a/deps/icu-small/source/common/normalizer2impl.h b/deps/icu-small/source/common/normalizer2impl.h
index 7ecdef6d9c8032..cf3015ea881bfc 100644
--- a/deps/icu-small/source/common/normalizer2impl.h
+++ b/deps/icu-small/source/common/normalizer2impl.h
@@ -245,9 +245,7 @@ class U_COMMON_API ReorderingBuffer : public UMemory {
*/
class U_COMMON_API Normalizer2Impl : public UObject {
public:
- Normalizer2Impl() : normTrie(NULL), fCanonIterData(NULL) {
- fCanonIterDataInitOnce.reset();
- }
+ Normalizer2Impl() : normTrie(NULL), fCanonIterData(NULL) { }
virtual ~Normalizer2Impl();
void init(const int32_t *inIndexes, const UCPTrie *inTrie,
@@ -723,7 +721,7 @@ class U_COMMON_API Normalizer2Impl : public UObject {
const uint16_t *extraData; // mappings and/or compositions for yesYes, yesNo & noNo characters
const uint8_t *smallFCD; // [0x100] one bit per 32 BMP code points, set if any FCD!=0
- UInitOnce fCanonIterDataInitOnce;
+ UInitOnce fCanonIterDataInitOnce = U_INITONCE_INITIALIZER;
CanonIterData *fCanonIterData;
};
diff --git a/deps/icu-small/source/common/normlzr.cpp b/deps/icu-small/source/common/normlzr.cpp
index 20b9f3df2ffccc..2dea0ffc33c91d 100644
--- a/deps/icu-small/source/common/normlzr.cpp
+++ b/deps/icu-small/source/common/normlzr.cpp
@@ -2,7 +2,7 @@
// License & terms of use: http://www.unicode.org/copyright.html
/*
*************************************************************************
- * COPYRIGHT:
+ * COPYRIGHT:
* Copyright (c) 1996-2012, International Business Machines Corporation and
* others. All Rights Reserved.
*************************************************************************
@@ -94,7 +94,7 @@ Normalizer::~Normalizer()
delete text;
}
-Normalizer*
+Normalizer*
Normalizer::clone() const
{
return new Normalizer(*this);
@@ -107,7 +107,7 @@ int32_t Normalizer::hashCode() const
{
return text->hashCode() + fUMode + fOptions + buffer.hashCode() + bufferPos + currentIndex + nextIndex;
}
-
+
UBool Normalizer::operator==(const Normalizer& that) const
{
return
@@ -125,9 +125,9 @@ UBool Normalizer::operator==(const Normalizer& that) const
//-------------------------------------------------------------------------
void U_EXPORT2
-Normalizer::normalize(const UnicodeString& source,
+Normalizer::normalize(const UnicodeString& source,
UNormalizationMode mode, int32_t options,
- UnicodeString& result,
+ UnicodeString& result,
UErrorCode &status) {
if(source.isBogus() || U_FAILURE(status)) {
result.setToBogus();
@@ -160,17 +160,17 @@ Normalizer::normalize(const UnicodeString& source,
}
void U_EXPORT2
-Normalizer::compose(const UnicodeString& source,
+Normalizer::compose(const UnicodeString& source,
UBool compat, int32_t options,
- UnicodeString& result,
+ UnicodeString& result,
UErrorCode &status) {
normalize(source, compat ? UNORM_NFKC : UNORM_NFC, options, result, status);
}
void U_EXPORT2
-Normalizer::decompose(const UnicodeString& source,
+Normalizer::decompose(const UnicodeString& source,
UBool compat, int32_t options,
- UnicodeString& result,
+ UnicodeString& result,
UErrorCode &status) {
normalize(source, compat ? UNORM_NFKD : UNORM_NFD, options, result, status);
}
@@ -368,7 +368,7 @@ int32_t Normalizer::endIndex() const {
//-------------------------------------------------------------------------
void
-Normalizer::setMode(UNormalizationMode newMode)
+Normalizer::setMode(UNormalizationMode newMode)
{
fUMode = newMode;
init();
@@ -381,8 +381,8 @@ Normalizer::getUMode() const
}
void
-Normalizer::setOption(int32_t option,
- UBool value)
+Normalizer::setOption(int32_t option,
+ UBool value)
{
if (value) {
fOptions |= option;
@@ -403,7 +403,7 @@ Normalizer::getOption(int32_t option) const
* The iteration position is set to the beginning of the input text.
*/
void
-Normalizer::setText(const UnicodeString& newText,
+Normalizer::setText(const UnicodeString& newText,
UErrorCode &status)
{
if (U_FAILURE(status)) {
@@ -424,8 +424,8 @@ Normalizer::setText(const UnicodeString& newText,
* The iteration position is set to the beginning of the string.
*/
void
-Normalizer::setText(const CharacterIterator& newText,
- UErrorCode &status)
+Normalizer::setText(const CharacterIterator& newText,
+ UErrorCode &status)
{
if (U_FAILURE(status)) {
return;
@@ -463,7 +463,7 @@ Normalizer::setText(ConstChar16Ptr newText,
* @param result Receives a copy of the text under iteration.
*/
void
-Normalizer::getText(UnicodeString& result)
+Normalizer::getText(UnicodeString& result)
{
text->getText(result);
}
diff --git a/deps/icu-small/source/common/pluralmap.cpp b/deps/icu-small/source/common/pluralmap.cpp
index a85dd1c979ffef..ec87f0198e19eb 100644
--- a/deps/icu-small/source/common/pluralmap.cpp
+++ b/deps/icu-small/source/common/pluralmap.cpp
@@ -29,7 +29,7 @@ PluralMapBase::Category
PluralMapBase::toCategory(const UnicodeString &pluralForm) {
CharString cCategory;
UErrorCode status = U_ZERO_ERROR;
- cCategory.appendInvariantChars(pluralForm, status);
+ cCategory.appendInvariantChars(pluralForm, status);
return U_FAILURE(status) ? NONE : toCategory(cCategory.data());
}
@@ -41,3 +41,4 @@ const char *PluralMapBase::getCategoryName(Category c) {
U_NAMESPACE_END
+
diff --git a/deps/icu-small/source/common/punycode.cpp b/deps/icu-small/source/common/punycode.cpp
index 4f0b9ea9cd385f..90fe1ec3c8026f 100644
--- a/deps/icu-small/source/common/punycode.cpp
+++ b/deps/icu-small/source/common/punycode.cpp
@@ -467,7 +467,7 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
}
i+=digit*w;
- /** RAM: comment out the old code for conformance with draft-ietf-idn-punycode-03.txt
+ /** RAM: comment out the old code for conformance with draft-ietf-idn-punycode-03.txt
t=k-bias;
if(t(uprv_malloc(uprv_strlen(posixID) + 1 + 1));
+ // Over-allocate in case we replace "C" with "en_US_POSIX" (+10), + null termination
+ char *correctedPOSIXLocale = static_cast(uprv_malloc(uprv_strlen(posixID) + 10 + 1));
if (correctedPOSIXLocale == nullptr) {
return nullptr;
}
@@ -1641,11 +1648,18 @@ The leftmost codepage (.xxx) wins.
char *limit;
if ((limit = uprv_strchr(correctedPOSIXLocale, '.')) != nullptr) {
*limit = 0;
- if ((limit = uprv_strchr(correctedPOSIXLocale, '@')) != nullptr) {
- *limit = 0;
- }
+ }
+ if ((limit = uprv_strchr(correctedPOSIXLocale, '@')) != nullptr) {
+ *limit = 0;
}
+ if ((uprv_strcmp("C", correctedPOSIXLocale) == 0) // no @ variant
+ || (uprv_strcmp("POSIX", correctedPOSIXLocale) == 0)) {
+ // Raw input was C.* or POSIX.*, Give it a nice POSIX default value.
+ // (The "C"/"POSIX" case is handled in uprv_getPOSIXIDForCategory())
+ uprv_strcpy(correctedPOSIXLocale, "en_US_POSIX");
+ }
+
/* Note that we scan the *uncorrected* ID. */
const char *p;
if ((p = uprv_strrchr(posixID, '@')) != nullptr) {
@@ -1668,7 +1682,7 @@ The leftmost codepage (.xxx) wins.
if ((q = uprv_strchr(p, '.')) != nullptr) {
/* How big will the resulting string be? */
int32_t len = (int32_t)(uprv_strlen(correctedPOSIXLocale) + (q-p));
- uprv_strncat(correctedPOSIXLocale, p, q-p);
+ uprv_strncat(correctedPOSIXLocale, p, q-p); // do not include charset
correctedPOSIXLocale[len] = 0;
}
else {
@@ -2053,7 +2067,7 @@ int_getDefaultCodepage()
static char codepage[64];
DWORD codepageNumber = 0;
-#if U_PLATFORM_HAS_WINUWP_API > 0
+#if U_PLATFORM_HAS_WINUWP_API == 1
// UWP doesn't have a direct API to get the default ACP as Microsoft would rather
// have folks use Unicode than a "system" code page, however this is the same
// codepage as the system default locale codepage. (FWIW, the system locale is
@@ -2066,7 +2080,7 @@ int_getDefaultCodepage()
#endif
// Special case for UTF-8
if (codepageNumber == 65001)
- {
+ {
return "UTF-8";
}
// Windows codepages can look like windows-1252, so format the found number
@@ -2259,7 +2273,7 @@ u_getVersion(UVersionInfo versionArray) {
}
/**
- * icucfg.h dependent code
+ * icucfg.h dependent code
*/
#if U_ENABLE_DYLOAD && HAVE_DLOPEN && !U_PLATFORM_USES_ONLY_WIN32_API
@@ -2319,15 +2333,15 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
U_INTERNAL void * U_EXPORT2
uprv_dl_open(const char *libName, UErrorCode *status) {
HMODULE lib = NULL;
-
+
if(U_FAILURE(*status)) return NULL;
-
+
lib = LoadLibraryA(libName);
-
+
if(lib==NULL) {
*status = U_MISSING_RESOURCE_ERROR;
}
-
+
return (void*)lib;
}
@@ -2335,9 +2349,9 @@ U_INTERNAL void U_EXPORT2
uprv_dl_close(void *lib, UErrorCode *status) {
HMODULE handle = (HMODULE)lib;
if(U_FAILURE(*status)) return;
-
+
FreeLibrary(handle);
-
+
return;
}
@@ -2345,11 +2359,11 @@ U_INTERNAL UVoidFunction* U_EXPORT2
uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
HMODULE handle = (HMODULE)lib;
UVoidFunction* addr = NULL;
-
+
if(U_FAILURE(*status) || lib==NULL) return NULL;
-
+
addr = (UVoidFunction*)GetProcAddress(handle, sym);
-
+
if(addr==NULL) {
DWORD lastError = GetLastError();
if(lastError == ERROR_PROC_NOT_FOUND) {
@@ -2358,7 +2372,7 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
*status = U_UNSUPPORTED_ERROR; /* other unknown error. */
}
}
-
+
return addr;
}
diff --git a/deps/icu-small/source/common/putilimp.h b/deps/icu-small/source/common/putilimp.h
index f9c13d8e1b27bf..d9c90cf4e75638 100644
--- a/deps/icu-small/source/common/putilimp.h
+++ b/deps/icu-small/source/common/putilimp.h
@@ -178,76 +178,6 @@ typedef size_t uintptr_t;
/** @} */
-/*===========================================================================*/
-/** @{ GCC built in functions for atomic memory operations */
-/*===========================================================================*/
-
-/**
- * \def U_HAVE_GCC_ATOMICS
- * @internal
- */
-#ifdef U_HAVE_GCC_ATOMICS
- /* Use the predefined value. */
-#elif U_PLATFORM == U_PF_MINGW
- #define U_HAVE_GCC_ATOMICS 0
-#elif U_GCC_MAJOR_MINOR >= 404 || defined(__clang__)
- /* TODO: Intel icc and IBM xlc on AIX also support gcc atomics. (Intel originated them.)
- * Add them for these compilers.
- * Note: Clang sets __GNUC__ defines for version 4.2, so misses the 4.4 test here.
- */
-# define U_HAVE_GCC_ATOMICS 1
-#else
-# define U_HAVE_GCC_ATOMICS 0
-#endif
-
-/** @} */
-
-/**
- * \def U_HAVE_STD_ATOMICS
- * Defines whether to use the C++11 std::atomic functions.
- * If false, ICU will fall back to compiler or platform specific alternatives.
- * Note: support for these fall back options for atomics will be removed in a future version
- * of ICU, and the use of C++ 11 atomics will be required.
- * @internal
- */
-#ifdef U_HAVE_STD_ATOMICS
- /* Use the predefined value. */
-#else
-# define U_HAVE_STD_ATOMICS 1
-#endif
-
-/**
- * \def U_HAVE_CLANG_ATOMICS
- * Defines whether Clang c11 style built-in atomics are available.
- * These are used in preference to gcc atomics when both are available.
- */
-#ifdef U_HAVE_CLANG_ATOMICS
- /* Use the predefined value. */
-#elif __has_builtin(__c11_atomic_load) && \
- __has_builtin(__c11_atomic_store) && \
- __has_builtin(__c11_atomic_fetch_add) && \
- __has_builtin(__c11_atomic_fetch_sub)
-# define U_HAVE_CLANG_ATOMICS 1
-#else
-# define U_HAVE_CLANG_ATOMICS 0
-#endif
-
-
-/**
- * \def U_HAVE_STD_MUTEX
- * Defines whether to use the C++11 std::mutex functions.
- * If false, ICU will fall back to compiler or platform specific alternatives.
- * std::mutex is preferred, and used by default unless this setting is overridden.
- * Note: support for other options for mutexes will be removed in a future version
- * of ICU, and the use of std::mutex will be required.
- * @internal
- */
-#ifdef U_HAVE_STD_MUTEX
- /* Use the predefined value. */
-#else
-# define U_HAVE_STD_MUTEX 1
-#endif
-
/*===========================================================================*/
/** @{ Programs used by ICU code */
/*===========================================================================*/
@@ -438,7 +368,7 @@ U_INTERNAL UBool U_EXPORT2 uprv_mul32_overflow(int32_t a, int32_t b, int32_t* re
* Return the default codepage for this platform and locale.
* This function can call setlocale() on Unix platforms. Please read the
* platform documentation on setlocale() before calling this function.
- * @return the default codepage for this platform
+ * @return the default codepage for this platform
* @internal
*/
U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void);
@@ -447,7 +377,7 @@ U_INTERNAL const char* U_EXPORT2 uprv_getDefaultCodepage(void);
/**
* Please use uloc_getDefault() instead.
* Return the default locale ID string by querying the system, or
- * zero if one cannot be found.
+ * zero if one cannot be found.
* This function can call setlocale() on Unix platforms. Please read the
* platform documentation on setlocale() before calling this function.
* @return the default locale ID string
diff --git a/deps/icu-small/source/common/rbbi.cpp b/deps/icu-small/source/common/rbbi.cpp
index 3b116ffaf6cba7..01dae48de44c1d 100644
--- a/deps/icu-small/source/common/rbbi.cpp
+++ b/deps/icu-small/source/common/rbbi.cpp
@@ -323,8 +323,8 @@ void RuleBasedBreakIterator::init(UErrorCode &status) {
// Virtual function: does the right thing with subclasses.
//
//-----------------------------------------------------------------------------
-BreakIterator*
-RuleBasedBreakIterator::clone(void) const {
+RuleBasedBreakIterator*
+RuleBasedBreakIterator::clone() const {
return new RuleBasedBreakIterator(*this);
}
@@ -352,7 +352,7 @@ RuleBasedBreakIterator::operator==(const BreakIterator& that) const {
// or have a different iteration position.
// Note that fText's position is always the same as the break iterator's position.
return FALSE;
- };
+ }
if (!(fPosition == that2.fPosition &&
fRuleStatusIndex == that2.fRuleStatusIndex &&
@@ -1079,10 +1079,8 @@ const uint8_t *RuleBasedBreakIterator::getBinaryRules(uint32_t &length) {
}
-BreakIterator * RuleBasedBreakIterator::createBufferClone(void * /*stackBuffer*/,
- int32_t &bufferSize,
- UErrorCode &status)
-{
+RuleBasedBreakIterator *RuleBasedBreakIterator::createBufferClone(
+ void * /*stackBuffer*/, int32_t &bufferSize, UErrorCode &status) {
if (U_FAILURE(status)){
return NULL;
}
diff --git a/deps/icu-small/source/common/rbbi_cache.cpp b/deps/icu-small/source/common/rbbi_cache.cpp
index 17ee2320802f60..4f9e83360a2a32 100644
--- a/deps/icu-small/source/common/rbbi_cache.cpp
+++ b/deps/icu-small/source/common/rbbi_cache.cpp
@@ -519,7 +519,7 @@ UBool RuleBasedBreakIterator::BreakCache::populatePreceding(UErrorCode &status)
// The initial handleNext() only advanced by a single code point. Go again.
position = fBI->handleNext(); // Safe rules identify safe pairs.
}
- };
+ }
positionStatusIdx = fBI->fRuleStatusIndex;
}
} while (position >= fromPosition);
diff --git a/deps/icu-small/source/common/rbbi_cache.h b/deps/icu-small/source/common/rbbi_cache.h
index 864ff811aaaff3..7991d6c0c7bf4c 100644
--- a/deps/icu-small/source/common/rbbi_cache.h
+++ b/deps/icu-small/source/common/rbbi_cache.h
@@ -30,7 +30,7 @@ U_NAMESPACE_BEGIN
*
* The boundaries are stored in a simple ArrayList (vector), with the
* assumption that they will be accessed sequentially.
- */
+ */
class RuleBasedBreakIterator::DictionaryCache: public UMemory {
public:
DictionaryCache(RuleBasedBreakIterator *bi, UErrorCode &status);
@@ -55,7 +55,7 @@ class RuleBasedBreakIterator::DictionaryCache: public UMemory {
RuleBasedBreakIterator *fBI;
-
+
UVector32 fBreaks; // A vector containing the boundaries.
int32_t fPositionInCache; // Index in fBreaks of last boundary returned by following()
// or preceding(). Optimizes sequential access.
diff --git a/deps/icu-small/source/common/rbbicst.pl b/deps/icu-small/source/common/rbbicst.pl
index 839b9501dda953..32dd2ffff10742 100755
--- a/deps/icu-small/source/common/rbbicst.pl
+++ b/deps/icu-small/source/common/rbbicst.pl
@@ -264,7 +264,7 @@
$n++;
}
print " \n";
-
+
#
# Emit constants for char class names
#
@@ -272,8 +272,8 @@
print " static final short kRuleSet_$setName = $charClasses{$setName};\n";
}
print "\n\n";
-
-
+
+
print " static class RBBIRuleTableElement { \n";
print " short fAction; \n";
print " short fCharClass; \n";
@@ -291,20 +291,20 @@
print " } \n";
print " }; \n";
print " \n";
-
-
+
+
print " static RBBIRuleTableElement[] gRuleParseStateTable = { \n ";
- print " new RBBIRuleTableElement(doNOP, 0, 0,0, true, null ) // 0 \n"; #output the unused state 0.
+ print " new RBBIRuleTableElement(doNOP, 0, 0,0, true, null ) // 0 \n"; #output the unused state 0.
for ($state=1; $state < $num_states; $state++) {
print " , new RBBIRuleTableElement($state_func_name[$state],";
if ($state_literal_chars[$state] ne "") {
$c = $state_literal_chars[$state];
- print("'$c', ");
+ print("'$c', ");
}else {
print " $charClasses{$state_char_class[$state]},";
}
print " $states{$state_dest_state[$state]},";
-
+
# The push-state field is optional. If omitted, fill field with a zero, which flags
# the state machine that there is no push state.
if ($state_push_state[$state] eq "") {
@@ -313,14 +313,14 @@
print " $states{$state_push_state[$state]},";
}
print " $state_flag[$state], ";
-
+
# if this is the first row of the table for this state, put out the state name.
if ($stateNames[$state] ne "") {
print " \"$stateNames[$state]\") ";
} else {
print " null ) ";
}
-
+
# Put out a comment showing the number (index) of this state row,
print " // $state ";
print "\n";
@@ -328,7 +328,7 @@
print " };\n";
print "}; \n";
-
+
}
else
{
@@ -454,3 +454,6 @@
print "U_NAMESPACE_END\n";
print "#endif\n";
}
+
+
+
diff --git a/deps/icu-small/source/common/rbbidata.cpp b/deps/icu-small/source/common/rbbidata.cpp
index fdcb564961362e..1d4c9e5895f376 100644
--- a/deps/icu-small/source/common/rbbidata.cpp
+++ b/deps/icu-small/source/common/rbbidata.cpp
@@ -323,7 +323,7 @@ ubrk_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outD
//
const uint8_t *inBytes =(const uint8_t *)inData+headerSize;
RBBIDataHeader *rbbiDH = (RBBIDataHeader *)inBytes;
- if (ds->readUInt32(rbbiDH->fMagic) != 0xb1a0 ||
+ if (ds->readUInt32(rbbiDH->fMagic) != 0xb1a0 ||
!RBBIDataWrapper::isDataVersionAcceptable(rbbiDH->fFormatVersion) ||
ds->readUInt32(rbbiDH->fLength) < sizeof(RBBIDataHeader)) {
udata_printError(ds, "ubrk_swap(): RBBI Data header is invalid.\n");
@@ -377,23 +377,23 @@ ubrk_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outD
//
int32_t topSize = offsetof(RBBIStateTable, fTableData);
- // Forward state table.
+ // Forward state table.
tableStartOffset = ds->readUInt32(rbbiDH->fFTable);
tableLength = ds->readUInt32(rbbiDH->fFTableLen);
if (tableLength > 0) {
- ds->swapArray32(ds, inBytes+tableStartOffset, topSize,
+ ds->swapArray32(ds, inBytes+tableStartOffset, topSize,
outBytes+tableStartOffset, status);
ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize,
outBytes+tableStartOffset+topSize, status);
}
-
+
// Reverse state table. Same layout as forward table, above.
tableStartOffset = ds->readUInt32(rbbiDH->fRTable);
tableLength = ds->readUInt32(rbbiDH->fRTableLen);
if (tableLength > 0) {
- ds->swapArray32(ds, inBytes+tableStartOffset, topSize,
+ ds->swapArray32(ds, inBytes+tableStartOffset, topSize,
outBytes+tableStartOffset, status);
ds->swapArray16(ds, inBytes+tableStartOffset+topSize, tableLength-topSize,
outBytes+tableStartOffset+topSize, status);
diff --git a/deps/icu-small/source/common/rbbidata.h b/deps/icu-small/source/common/rbbidata.h
index 3e573039d0f491..b7de6ce073cbc5 100644
--- a/deps/icu-small/source/common/rbbidata.h
+++ b/deps/icu-small/source/common/rbbidata.h
@@ -60,8 +60,8 @@ U_NAMESPACE_BEGIN
// The current RBBI data format version.
static const uint8_t RBBI_DATA_FORMAT_VERSION[] = {5, 0, 0, 0};
-/*
- * The following structs map exactly onto the raw data from ICU common data file.
+/*
+ * The following structs map exactly onto the raw data from ICU common data file.
*/
struct RBBIDataHeader {
uint32_t fMagic; /* == 0xbla0 */
@@ -171,7 +171,7 @@ class RBBIDataWrapper : public UMemory {
const RBBIStateTable *fForwardTable;
const RBBIStateTable *fReverseTable;
const UChar *fRuleSource;
- const int32_t *fRuleStatusTable;
+ const int32_t *fRuleStatusTable;
/* number of int32_t values in the rule status table. Used to sanity check indexing */
int32_t fStatusMaxIdx;
diff --git a/deps/icu-small/source/common/rbbinode.cpp b/deps/icu-small/source/common/rbbinode.cpp
index 2181d81acad2f2..69d84151fe818a 100644
--- a/deps/icu-small/source/common/rbbinode.cpp
+++ b/deps/icu-small/source/common/rbbinode.cpp
@@ -343,7 +343,7 @@ U_CFUNC void RBBI_DEBUG_printUnicodeString(const UnicodeString &s, int minWidth)
void RBBINode::printNodeHeader() {
RBBIDebugPrintf(" Address serial type LeftChild RightChild Parent position value\n");
}
-
+
void RBBINode::printTree(const RBBINode *node, UBool printHeading) {
if (printHeading) {
printNodeHeader();
@@ -356,7 +356,7 @@ void RBBINode::printTree(const RBBINode *node, UBool printHeading) {
if (node->fLeftChild != NULL) {
printTree(node->fLeftChild, FALSE);
}
-
+
if (node->fRightChild != NULL) {
printTree(node->fRightChild, FALSE);
}
diff --git a/deps/icu-small/source/common/rbbinode.h b/deps/icu-small/source/common/rbbinode.h
index e33662167fe3fd..f3525960225500 100644
--- a/deps/icu-small/source/common/rbbinode.h
+++ b/deps/icu-small/source/common/rbbinode.h
@@ -46,21 +46,21 @@ class RBBINode : public UMemory {
opLParen
};
- enum OpPrecedence {
+ enum OpPrecedence {
precZero,
precStart,
precLParen,
precOpOr,
precOpCat
};
-
+
NodeType fType;
RBBINode *fParent;
RBBINode *fLeftChild;
RBBINode *fRightChild;
UnicodeSet *fInputSet; // For uset nodes only.
OpPrecedence fPrecedence; // For binary ops only.
-
+
UnicodeString fText; // Text corresponding to this node.
// May be lazily evaluated when (if) needed
// for some node types.
@@ -94,7 +94,7 @@ class RBBINode : public UMemory {
RBBINode(NodeType t);
RBBINode(const RBBINode &other);
~RBBINode();
-
+
RBBINode *cloneTree();
RBBINode *flattenVariables();
void flattenSets();
@@ -117,10 +117,11 @@ class RBBINode : public UMemory {
};
#ifdef RBBI_DEBUG
-U_CFUNC void
+U_CFUNC void
RBBI_DEBUG_printUnicodeString(const UnicodeString &s, int minWidth=0);
#endif
U_NAMESPACE_END
#endif
+
diff --git a/deps/icu-small/source/common/rbbirb.cpp b/deps/icu-small/source/common/rbbirb.cpp
index 5f5661af94776d..08c577696c2254 100644
--- a/deps/icu-small/source/common/rbbirb.cpp
+++ b/deps/icu-small/source/common/rbbirb.cpp
@@ -242,7 +242,7 @@ RBBIRuleBuilder::createRuleBasedBreakIterator( const UnicodeString &rules,
if (U_FAILURE(status)) {
delete This;
This = NULL;
- }
+ }
else if(This == NULL) { // test for NULL
status = U_MEMORY_ALLOCATION_ERROR;
}
diff --git a/deps/icu-small/source/common/rbbirb.h b/deps/icu-small/source/common/rbbirb.h
index 37992daabb0b14..037c1dc2ce8ff7 100644
--- a/deps/icu-small/source/common/rbbirb.h
+++ b/deps/icu-small/source/common/rbbirb.h
@@ -91,7 +91,7 @@ class RBBISymbolTable : public UMemory, public SymbolTable {
// A do-nothing inline function for non-debug builds. Member funcs can't be empty
// or the call sites won't compile.
int32_t fFakeField;
- #define rbbiSymtablePrint() fFakeField=0;
+ #define rbbiSymtablePrint() fFakeField=0;
#endif
private:
@@ -223,7 +223,7 @@ typedef std::pair IntPair;
#define RBBIDebugPrintf printf
#define RBBIDebugPuts puts
#else
-#undef RBBIDebugPrintf
+#undef RBBIDebugPrintf
#define RBBIDebugPuts(arg)
#endif
@@ -232,3 +232,6 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
#endif
+
+
+
diff --git a/deps/icu-small/source/common/rbbirpt.h b/deps/icu-small/source/common/rbbirpt.h
index b94c4c25cbfb8c..586953c90c6fa4 100644
--- a/deps/icu-small/source/common/rbbirpt.h
+++ b/deps/icu-small/source/common/rbbirpt.h
@@ -8,8 +8,8 @@
// It is generated by the Perl script "rbbicst.pl" from
// the rule parser state definitions file "rbbirpt.txt".
//
-// Copyright (C) 2002-2016 International Business Machines Corporation
-// and others. All rights reserved.
+// Copyright (C) 2002-2016 International Business Machines Corporation
+// and others. All rights reserved.
//
//---------------------------------------------------------------------------------
#ifndef RBBIRPT_H
@@ -81,107 +81,107 @@ struct RBBIRuleTableEl {
static const struct RBBIRuleTableEl gRuleParseStateTable[] = {
{doNOP, 0, 0, 0, TRUE}
, {doExprStart, 254, 29, 9, FALSE} // 1 start
- , {doNOP, 132, 1,0, TRUE} // 2
- , {doNoChain, 94 /* ^ */, 12, 9, TRUE} // 3
- , {doExprStart, 36 /* $ */, 88, 98, FALSE} // 4
- , {doNOP, 33 /* ! */, 19,0, TRUE} // 5
- , {doNOP, 59 /* ; */, 1,0, TRUE} // 6
- , {doNOP, 252, 0,0, FALSE} // 7
- , {doExprStart, 255, 29, 9, FALSE} // 8
+ , {doNOP, 132, 1,0, TRUE} // 2
+ , {doNoChain, 94 /* ^ */, 12, 9, TRUE} // 3
+ , {doExprStart, 36 /* $ */, 88, 98, FALSE} // 4
+ , {doNOP, 33 /* ! */, 19,0, TRUE} // 5
+ , {doNOP, 59 /* ; */, 1,0, TRUE} // 6
+ , {doNOP, 252, 0,0, FALSE} // 7
+ , {doExprStart, 255, 29, 9, FALSE} // 8
, {doEndOfRule, 59 /* ; */, 1,0, TRUE} // 9 break-rule-end
- , {doNOP, 132, 9,0, TRUE} // 10
- , {doRuleError, 255, 103,0, FALSE} // 11
+ , {doNOP, 132, 9,0, TRUE} // 10
+ , {doRuleError, 255, 103,0, FALSE} // 11
, {doExprStart, 254, 29,0, FALSE} // 12 start-after-caret
- , {doNOP, 132, 12,0, TRUE} // 13
- , {doRuleError, 94 /* ^ */, 103,0, FALSE} // 14
- , {doExprStart, 36 /* $ */, 88, 37, FALSE} // 15
- , {doRuleError, 59 /* ; */, 103,0, FALSE} // 16
- , {doRuleError, 252, 103,0, FALSE} // 17
- , {doExprStart, 255, 29,0, FALSE} // 18
+ , {doNOP, 132, 12,0, TRUE} // 13
+ , {doRuleError, 94 /* ^ */, 103,0, FALSE} // 14
+ , {doExprStart, 36 /* $ */, 88, 37, FALSE} // 15
+ , {doRuleError, 59 /* ; */, 103,0, FALSE} // 16
+ , {doRuleError, 252, 103,0, FALSE} // 17
+ , {doExprStart, 255, 29,0, FALSE} // 18
, {doNOP, 33 /* ! */, 21,0, TRUE} // 19 rev-option
- , {doReverseDir, 255, 28, 9, FALSE} // 20
+ , {doReverseDir, 255, 28, 9, FALSE} // 20
, {doOptionStart, 130, 23,0, TRUE} // 21 option-scan1
- , {doRuleError, 255, 103,0, FALSE} // 22
+ , {doRuleError, 255, 103,0, FALSE} // 22
, {doNOP, 129, 23,0, TRUE} // 23 option-scan2
- , {doOptionEnd, 255, 25,0, FALSE} // 24
+ , {doOptionEnd, 255, 25,0, FALSE} // 24
, {doNOP, 59 /* ; */, 1,0, TRUE} // 25 option-scan3
- , {doNOP, 132, 25,0, TRUE} // 26
- , {doRuleError, 255, 103,0, FALSE} // 27
+ , {doNOP, 132, 25,0, TRUE} // 26
+ , {doRuleError, 255, 103,0, FALSE} // 27
, {doExprStart, 255, 29, 9, FALSE} // 28 reverse-rule
, {doRuleChar, 254, 38,0, TRUE} // 29 term
- , {doNOP, 132, 29,0, TRUE} // 30
- , {doRuleChar, 131, 38,0, TRUE} // 31
- , {doNOP, 91 /* [ */, 94, 38, FALSE} // 32
- , {doLParen, 40 /* ( */, 29, 38, TRUE} // 33
- , {doNOP, 36 /* $ */, 88, 37, FALSE} // 34
- , {doDotAny, 46 /* . */, 38,0, TRUE} // 35
- , {doRuleError, 255, 103,0, FALSE} // 36
+ , {doNOP, 132, 29,0, TRUE} // 30
+ , {doRuleChar, 131, 38,0, TRUE} // 31
+ , {doNOP, 91 /* [ */, 94, 38, FALSE} // 32
+ , {doLParen, 40 /* ( */, 29, 38, TRUE} // 33
+ , {doNOP, 36 /* $ */, 88, 37, FALSE} // 34
+ , {doDotAny, 46 /* . */, 38,0, TRUE} // 35
+ , {doRuleError, 255, 103,0, FALSE} // 36
, {doCheckVarDef, 255, 38,0, FALSE} // 37 term-var-ref
, {doNOP, 132, 38,0, TRUE} // 38 expr-mod
- , {doUnaryOpStar, 42 /* * */, 43,0, TRUE} // 39
- , {doUnaryOpPlus, 43 /* + */, 43,0, TRUE} // 40
- , {doUnaryOpQuestion, 63 /* ? */, 43,0, TRUE} // 41
- , {doNOP, 255, 43,0, FALSE} // 42
+ , {doUnaryOpStar, 42 /* * */, 43,0, TRUE} // 39
+ , {doUnaryOpPlus, 43 /* + */, 43,0, TRUE} // 40
+ , {doUnaryOpQuestion, 63 /* ? */, 43,0, TRUE} // 41
+ , {doNOP, 255, 43,0, FALSE} // 42
, {doExprCatOperator, 254, 29,0, FALSE} // 43 expr-cont
- , {doNOP, 132, 43,0, TRUE} // 44
- , {doExprCatOperator, 131, 29,0, FALSE} // 45
- , {doExprCatOperator, 91 /* [ */, 29,0, FALSE} // 46
- , {doExprCatOperator, 40 /* ( */, 29,0, FALSE} // 47
- , {doExprCatOperator, 36 /* $ */, 29,0, FALSE} // 48
- , {doExprCatOperator, 46 /* . */, 29,0, FALSE} // 49
- , {doExprCatOperator, 47 /* / */, 55,0, FALSE} // 50
- , {doExprCatOperator, 123 /* { */, 67,0, TRUE} // 51
- , {doExprOrOperator, 124 /* | */, 29,0, TRUE} // 52
- , {doExprRParen, 41 /* ) */, 255,0, TRUE} // 53
- , {doExprFinished, 255, 255,0, FALSE} // 54
+ , {doNOP, 132, 43,0, TRUE} // 44
+ , {doExprCatOperator, 131, 29,0, FALSE} // 45
+ , {doExprCatOperator, 91 /* [ */, 29,0, FALSE} // 46
+ , {doExprCatOperator, 40 /* ( */, 29,0, FALSE} // 47
+ , {doExprCatOperator, 36 /* $ */, 29,0, FALSE} // 48
+ , {doExprCatOperator, 46 /* . */, 29,0, FALSE} // 49
+ , {doExprCatOperator, 47 /* / */, 55,0, FALSE} // 50
+ , {doExprCatOperator, 123 /* { */, 67,0, TRUE} // 51
+ , {doExprOrOperator, 124 /* | */, 29,0, TRUE} // 52
+ , {doExprRParen, 41 /* ) */, 255,0, TRUE} // 53
+ , {doExprFinished, 255, 255,0, FALSE} // 54
, {doSlash, 47 /* / */, 57,0, TRUE} // 55 look-ahead
- , {doNOP, 255, 103,0, FALSE} // 56
+ , {doNOP, 255, 103,0, FALSE} // 56
, {doExprCatOperator, 254, 29,0, FALSE} // 57 expr-cont-no-slash
- , {doNOP, 132, 43,0, TRUE} // 58
- , {doExprCatOperator, 131, 29,0, FALSE} // 59
- , {doExprCatOperator, 91 /* [ */, 29,0, FALSE} // 60
- , {doExprCatOperator, 40 /* ( */, 29,0, FALSE} // 61
- , {doExprCatOperator, 36 /* $ */, 29,0, FALSE} // 62
- , {doExprCatOperator, 46 /* . */, 29,0, FALSE} // 63
- , {doExprOrOperator, 124 /* | */, 29,0, TRUE} // 64
- , {doExprRParen, 41 /* ) */, 255,0, TRUE} // 65
- , {doExprFinished, 255, 255,0, FALSE} // 66
+ , {doNOP, 132, 43,0, TRUE} // 58
+ , {doExprCatOperator, 131, 29,0, FALSE} // 59
+ , {doExprCatOperator, 91 /* [ */, 29,0, FALSE} // 60
+ , {doExprCatOperator, 40 /* ( */, 29,0, FALSE} // 61
+ , {doExprCatOperator, 36 /* $ */, 29,0, FALSE} // 62
+ , {doExprCatOperator, 46 /* . */, 29,0, FALSE} // 63
+ , {doExprOrOperator, 124 /* | */, 29,0, TRUE} // 64
+ , {doExprRParen, 41 /* ) */, 255,0, TRUE} // 65
+ , {doExprFinished, 255, 255,0, FALSE} // 66
, {doNOP, 132, 67,0, TRUE} // 67 tag-open
- , {doStartTagValue, 128, 70,0, FALSE} // 68
- , {doTagExpectedError, 255, 103,0, FALSE} // 69
+ , {doStartTagValue, 128, 70,0, FALSE} // 68
+ , {doTagExpectedError, 255, 103,0, FALSE} // 69
, {doNOP, 132, 74,0, TRUE} // 70 tag-value
- , {doNOP, 125 /* } */, 74,0, FALSE} // 71
- , {doTagDigit, 128, 70,0, TRUE} // 72
- , {doTagExpectedError, 255, 103,0, FALSE} // 73
+ , {doNOP, 125 /* } */, 74,0, FALSE} // 71
+ , {doTagDigit, 128, 70,0, TRUE} // 72
+ , {doTagExpectedError, 255, 103,0, FALSE} // 73
, {doNOP, 132, 74,0, TRUE} // 74 tag-close
- , {doTagValue, 125 /* } */, 77,0, TRUE} // 75
- , {doTagExpectedError, 255, 103,0, FALSE} // 76
+ , {doTagValue, 125 /* } */, 77,0, TRUE} // 75
+ , {doTagExpectedError, 255, 103,0, FALSE} // 76
, {doExprCatOperator, 254, 29,0, FALSE} // 77 expr-cont-no-tag
- , {doNOP, 132, 77,0, TRUE} // 78
- , {doExprCatOperator, 131, 29,0, FALSE} // 79
- , {doExprCatOperator, 91 /* [ */, 29,0, FALSE} // 80
- , {doExprCatOperator, 40 /* ( */, 29,0, FALSE} // 81
- , {doExprCatOperator, 36 /* $ */, 29,0, FALSE} // 82
- , {doExprCatOperator, 46 /* . */, 29,0, FALSE} // 83
- , {doExprCatOperator, 47 /* / */, 55,0, FALSE} // 84
- , {doExprOrOperator, 124 /* | */, 29,0, TRUE} // 85
- , {doExprRParen, 41 /* ) */, 255,0, TRUE} // 86
- , {doExprFinished, 255, 255,0, FALSE} // 87
+ , {doNOP, 132, 77,0, TRUE} // 78
+ , {doExprCatOperator, 131, 29,0, FALSE} // 79
+ , {doExprCatOperator, 91 /* [ */, 29,0, FALSE} // 80
+ , {doExprCatOperator, 40 /* ( */, 29,0, FALSE} // 81
+ , {doExprCatOperator, 36 /* $ */, 29,0, FALSE} // 82
+ , {doExprCatOperator, 46 /* . */, 29,0, FALSE} // 83
+ , {doExprCatOperator, 47 /* / */, 55,0, FALSE} // 84
+ , {doExprOrOperator, 124 /* | */, 29,0, TRUE} // 85
+ , {doExprRParen, 41 /* ) */, 255,0, TRUE} // 86
+ , {doExprFinished, 255, 255,0, FALSE} // 87
, {doStartVariableName, 36 /* $ */, 90,0, TRUE} // 88 scan-var-name
- , {doNOP, 255, 103,0, FALSE} // 89
+ , {doNOP, 255, 103,0, FALSE} // 89
, {doNOP, 130, 92,0, TRUE} // 90 scan-var-start
- , {doVariableNameExpectedErr, 255, 103,0, FALSE} // 91
+ , {doVariableNameExpectedErr, 255, 103,0, FALSE} // 91
, {doNOP, 129, 92,0, TRUE} // 92 scan-var-body
- , {doEndVariableName, 255, 255,0, FALSE} // 93
+ , {doEndVariableName, 255, 255,0, FALSE} // 93
, {doScanUnicodeSet, 91 /* [ */, 255,0, TRUE} // 94 scan-unicode-set
- , {doScanUnicodeSet, 112 /* p */, 255,0, TRUE} // 95
- , {doScanUnicodeSet, 80 /* P */, 255,0, TRUE} // 96
- , {doNOP, 255, 103,0, FALSE} // 97
+ , {doScanUnicodeSet, 112 /* p */, 255,0, TRUE} // 95
+ , {doScanUnicodeSet, 80 /* P */, 255,0, TRUE} // 96
+ , {doNOP, 255, 103,0, FALSE} // 97
, {doNOP, 132, 98,0, TRUE} // 98 assign-or-rule
- , {doStartAssign, 61 /* = */, 29, 101, TRUE} // 99
- , {doNOP, 255, 37, 9, FALSE} // 100
+ , {doStartAssign, 61 /* = */, 29, 101, TRUE} // 99
+ , {doNOP, 255, 37, 9, FALSE} // 100
, {doEndAssign, 59 /* ; */, 1,0, TRUE} // 101 assign-end
- , {doRuleErrorAssignExpr, 255, 103,0, FALSE} // 102
+ , {doRuleErrorAssignExpr, 255, 103,0, FALSE} // 102
, {doExit, 255, 103,0, TRUE} // 103 errorDeath
};
#ifdef RBBI_DEBUG
diff --git a/deps/icu-small/source/common/rbbiscan.cpp b/deps/icu-small/source/common/rbbiscan.cpp
index 170c212e13fd1f..f536ab5d39863c 100644
--- a/deps/icu-small/source/common/rbbiscan.cpp
+++ b/deps/icu-small/source/common/rbbiscan.cpp
@@ -96,7 +96,7 @@ RBBIRuleScanner::RBBIRuleScanner(RBBIRuleBuilder *rb)
fLineNum = 1;
fCharNum = 0;
fLastChar = 0;
-
+
fStateTable = NULL;
fStack[0] = 0;
fStackPtr = 0;
@@ -357,7 +357,7 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
thisRule->fRuleRoot = TRUE;
// Flag if chaining into this rule is wanted.
- //
+ //
if (fRB->fChainRules && // If rule chaining is enabled globally via !!chain
!fNoChainInRule) { // and no '^' chain-in inhibit was on this rule
thisRule->fChainIn = TRUE;
@@ -1114,7 +1114,7 @@ void RBBIRuleScanner::parse() {
if (U_FAILURE(*fRB->fStatus)) {
return;
}
-
+
// If there are no forward rules set an error.
//
if (fRB->fForwardTree == NULL) {
diff --git a/deps/icu-small/source/common/rbbiscan.h b/deps/icu-small/source/common/rbbiscan.h
index cac60fb18a11b8..c51b4cf2a68aa1 100644
--- a/deps/icu-small/source/common/rbbiscan.h
+++ b/deps/icu-small/source/common/rbbiscan.h
@@ -34,7 +34,7 @@ class RBBISymbolTable;
//--------------------------------------------------------------------------------
//
// class RBBIRuleScanner does the lowest level, character-at-a-time
-// scanning of break iterator rules.
+// scanning of break iterator rules.
//
// The output of the scanner is parse trees for
// the rule expressions and a list of all Unicode Sets
diff --git a/deps/icu-small/source/common/rbbisetb.cpp b/deps/icu-small/source/common/rbbisetb.cpp
index e6b98cf3e22b98..36e2e07e9c65a0 100644
--- a/deps/icu-small/source/common/rbbisetb.cpp
+++ b/deps/icu-small/source/common/rbbisetb.cpp
@@ -207,7 +207,7 @@ void RBBISetBuilder::buildRanges() {
}
if (rlRange->fNum == 0) {
fGroupCount ++;
- rlRange->fNum = fGroupCount+2;
+ rlRange->fNum = fGroupCount+2;
rlRange->setDictionaryFlag();
addValToSets(rlRange->fIncludesSets, fGroupCount+2);
}
@@ -397,7 +397,7 @@ UBool RBBISetBuilder::sawBOF() const {
//------------------------------------------------------------------------
//
// getFirstChar Given a runtime RBBI character category, find
-// the first UChar32 that is in the set of chars
+// the first UChar32 that is in the set of chars
// in the category.
//------------------------------------------------------------------------
UChar32 RBBISetBuilder::getFirstChar(int32_t category) const {
diff --git a/deps/icu-small/source/common/rbbistbl.cpp b/deps/icu-small/source/common/rbbistbl.cpp
index d90992290c3e63..5303f7609698ec 100644
--- a/deps/icu-small/source/common/rbbistbl.cpp
+++ b/deps/icu-small/source/common/rbbistbl.cpp
@@ -45,7 +45,7 @@ RBBISymbolTable::RBBISymbolTable(RBBIRuleScanner *rs, const UnicodeString &rules
{
fHashTable = NULL;
fCachedSetLookup = NULL;
-
+
fHashTable = uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, &status);
// uhash_open checks status
if (U_FAILURE(status)) {
diff --git a/deps/icu-small/source/common/rbbitblb.cpp b/deps/icu-small/source/common/rbbitblb.cpp
index e6ae2dc654a88c..a20b51777cda7a 100644
--- a/deps/icu-small/source/common/rbbitblb.cpp
+++ b/deps/icu-small/source/common/rbbitblb.cpp
@@ -86,11 +86,11 @@ void RBBITableBuilder::buildForwardTable() {
#endif
//
- // If the rules contained any references to {bof}
+ // If the rules contained any references to {bof}
// add a {bof} to the
- // tree. Means that all matches must start out with the
+ // tree. Means that all matches must start out with the
// {bof} fake character.
- //
+ //
if (fRB->fSetBuilder->sawBOF()) {
RBBINode *bofTop = new RBBINode(RBBINode::opCat);
RBBINode *bofLeaf = new RBBINode(RBBINode::leafChar);
@@ -421,9 +421,9 @@ void RBBITableBuilder::calcChainedFollowPos(RBBINode *tree) {
}
// Collect all leaf nodes that can start matches for rules
- // with inbound chaining enabled, which is the union of the
+ // with inbound chaining enabled, which is the union of the
// firstPosition sets from each of the rule root nodes.
-
+
UVector ruleRootNodes(*fStatus);
addRuleRootNodes(&ruleRootNodes, tree);
@@ -534,7 +534,7 @@ void RBBITableBuilder::bofFixup() {
// (excluding the fake bofNode)
// We want the nodes that can start a match in the
// part labeled "rest of tree"
- //
+ //
UVector *matchStartNodes = fTree->fLeftChild->fRightChild->fFirstPosSet;
RBBINode *startNode;
@@ -550,7 +550,7 @@ void RBBITableBuilder::bofFixup() {
// explicitly written into a rule.
// Add everything from the followPos set of this node to the
// followPos set of the fake bofNode at the start of the tree.
- //
+ //
setAdd(bofNode->fFollowPos, startNode->fFollowPos);
}
}
@@ -571,7 +571,7 @@ void RBBITableBuilder::buildStateTable() {
}
RBBIStateDescriptor *failState;
// Set it to NULL to avoid uninitialized warning
- RBBIStateDescriptor *initialState = NULL;
+ RBBIStateDescriptor *initialState = NULL;
//
// Add a dummy state 0 - the stop state. Not from Aho.
int lastInputSymbol = fRB->fSetBuilder->getNumCharCategories() - 1;
@@ -648,8 +648,8 @@ void RBBITableBuilder::buildStateTable() {
if (U == NULL) {
U = new UVector(*fStatus);
if (U == NULL) {
- *fStatus = U_MEMORY_ALLOCATION_ERROR;
- goto ExitBuildSTdeleteall;
+ *fStatus = U_MEMORY_ALLOCATION_ERROR;
+ goto ExitBuildSTdeleteall;
}
}
setAdd(U, p->fFollowPos);
@@ -679,7 +679,7 @@ void RBBITableBuilder::buildStateTable() {
{
RBBIStateDescriptor *newState = new RBBIStateDescriptor(lastInputSymbol, fStatus);
if (newState == NULL) {
- *fStatus = U_MEMORY_ALLOCATION_ERROR;
+ *fStatus = U_MEMORY_ALLOCATION_ERROR;
}
if (U_FAILURE(*fStatus)) {
goto ExitBuildSTdeleteall;
diff --git a/deps/icu-small/source/common/resbund.cpp b/deps/icu-small/source/common/resbund.cpp
index 00dbf6f8fe2e9c..7c5063b21143c4 100644
--- a/deps/icu-small/source/common/resbund.cpp
+++ b/deps/icu-small/source/common/resbund.cpp
@@ -51,6 +51,7 @@
#include "unicode/utypes.h"
#include "unicode/resbund.h"
+#include "cmemory.h"
#include "mutex.h"
#include "uassert.h"
#include "umutex.h"
@@ -205,7 +206,7 @@ ResourceBundle::ResourceBundle(UResourceBundle *res, UErrorCode& err)
}
}
-ResourceBundle::ResourceBundle(const char* path, const Locale& locale, UErrorCode& err)
+ResourceBundle::ResourceBundle(const char* path, const Locale& locale, UErrorCode& err)
:UObject(), fLocale(NULL)
{
fResource = ures_open(path, locale.getName(), &err);
@@ -377,7 +378,7 @@ void ResourceBundle::getVersion(UVersionInfo versionInfo) const {
}
const Locale &ResourceBundle::getLocale(void) const {
- static UMutex gLocaleLock = U_MUTEX_INITIALIZER;
+ static UMutex gLocaleLock;
Mutex lock(&gLocaleLock);
if (fLocale != NULL) {
return *fLocale;
diff --git a/deps/icu-small/source/common/resbund_cnv.cpp b/deps/icu-small/source/common/resbund_cnv.cpp
index ae854fe739cd32..45c0b399bfff45 100644
--- a/deps/icu-small/source/common/resbund_cnv.cpp
+++ b/deps/icu-small/source/common/resbund_cnv.cpp
@@ -39,7 +39,7 @@ ResourceBundle::ResourceBundle( const UnicodeString& path,
constructForLocale(path, Locale::getDefault(), error);
}
-void
+void
ResourceBundle::constructForLocale(const UnicodeString& path,
const Locale& locale,
UErrorCode& error)
diff --git a/deps/icu-small/source/common/resource.h b/deps/icu-small/source/common/resource.h
index 3dbff785ef12a8..5199b858880770 100644
--- a/deps/icu-small/source/common/resource.h
+++ b/deps/icu-small/source/common/resource.h
@@ -28,6 +28,7 @@
#include "unicode/utypes.h"
#include "unicode/unistr.h"
#include "unicode/ures.h"
+#include "restrace.h"
struct ResourceData;
@@ -47,8 +48,10 @@ class U_COMMON_API ResourceArray {
ResourceArray() : items16(NULL), items32(NULL), length(0) {}
/** Only for implementation use. @internal */
- ResourceArray(const uint16_t *i16, const uint32_t *i32, int32_t len) :
- items16(i16), items32(i32), length(len) {}
+ ResourceArray(const uint16_t *i16, const uint32_t *i32, int32_t len,
+ const ResourceTracer& traceInfo) :
+ items16(i16), items32(i32), length(len),
+ fTraceInfo(traceInfo) {}
/**
* @return The number of items in the array resource.
@@ -68,6 +71,7 @@ class U_COMMON_API ResourceArray {
const uint16_t *items16;
const uint32_t *items32;
int32_t length;
+ ResourceTracer fTraceInfo;
};
/**
@@ -80,27 +84,37 @@ class U_COMMON_API ResourceTable {
/** Only for implementation use. @internal */
ResourceTable(const uint16_t *k16, const int32_t *k32,
- const uint16_t *i16, const uint32_t *i32, int32_t len) :
- keys16(k16), keys32(k32), items16(i16), items32(i32), length(len) {}
+ const uint16_t *i16, const uint32_t *i32, int32_t len,
+ const ResourceTracer& traceInfo) :
+ keys16(k16), keys32(k32), items16(i16), items32(i32), length(len),
+ fTraceInfo(traceInfo) {}
/**
* @return The number of items in the array resource.
*/
int32_t getSize() const { return length; }
/**
- * @param i Array item index.
+ * @param i Table item index.
* @param key Output-only, receives the key of the i'th item.
* @param value Output-only, receives the value of the i'th item.
* @return TRUE if i is non-negative and less than getSize().
*/
UBool getKeyAndValue(int32_t i, const char *&key, ResourceValue &value) const;
+ /**
+ * @param key Key string to find in the table.
+ * @param value Output-only, receives the value of the item with that key.
+ * @return TRUE if the table contains the key.
+ */
+ UBool findValue(const char *key, ResourceValue &value) const;
+
private:
const uint16_t *keys16;
const int32_t *keys32;
const uint16_t *items16;
const uint32_t *items32;
int32_t length;
+ ResourceTracer fTraceInfo;
};
/**
diff --git a/deps/icu-small/source/common/restrace.cpp b/deps/icu-small/source/common/restrace.cpp
new file mode 100644
index 00000000000000..5c6498850e2f8f
--- /dev/null
+++ b/deps/icu-small/source/common/restrace.cpp
@@ -0,0 +1,130 @@
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if U_ENABLE_TRACING
+
+#include "restrace.h"
+#include "charstr.h"
+#include "cstring.h"
+#include "utracimp.h"
+#include "uresimp.h"
+#include "uassert.h"
+#include "util.h"
+
+U_NAMESPACE_BEGIN
+
+ResourceTracer::~ResourceTracer() = default;
+
+void ResourceTracer::trace(const char* resType) const {
+ U_ASSERT(fResB || fParent);
+ UTRACE_ENTRY(UTRACE_UDATA_RESOURCE);
+ UErrorCode status = U_ZERO_ERROR;
+
+ CharString filePath;
+ getFilePath(filePath, status);
+
+ CharString resPath;
+ getResPath(resPath, status);
+
+ // The longest type ("intvector") is 9 chars
+ const char kSpaces[] = " ";
+ CharString format;
+ format.append(kSpaces, sizeof(kSpaces) - 1 - uprv_strlen(resType), status);
+ format.append("(%s) %s @ %s", status);
+
+ UTRACE_DATA3(UTRACE_VERBOSE,
+ format.data(),
+ resType,
+ filePath.data(),
+ resPath.data());
+ UTRACE_EXIT_STATUS(status);
+}
+
+void ResourceTracer::traceOpen() const {
+ U_ASSERT(fResB);
+ UTRACE_ENTRY(UTRACE_UDATA_BUNDLE);
+ UErrorCode status = U_ZERO_ERROR;
+
+ CharString filePath;
+ UTRACE_DATA1(UTRACE_VERBOSE, "%s", getFilePath(filePath, status).data());
+ UTRACE_EXIT_STATUS(status);
+}
+
+CharString& ResourceTracer::getFilePath(CharString& output, UErrorCode& status) const {
+ if (fResB) {
+ output.append(fResB->fData->fPath, status);
+ output.append('/', status);
+ output.append(fResB->fData->fName, status);
+ output.append(".res", status);
+ } else {
+ fParent->getFilePath(output, status);
+ }
+ return output;
+}
+
+CharString& ResourceTracer::getResPath(CharString& output, UErrorCode& status) const {
+ if (fResB) {
+ output.append('/', status);
+ output.append(fResB->fResPath, status);
+ // removing the trailing /
+ U_ASSERT(output[output.length()-1] == '/');
+ output.truncate(output.length()-1);
+ } else {
+ fParent->getResPath(output, status);
+ }
+ if (fKey) {
+ output.append('/', status);
+ output.append(fKey, status);
+ }
+ if (fIndex != -1) {
+ output.append('[', status);
+ UnicodeString indexString;
+ ICU_Utility::appendNumber(indexString, fIndex);
+ output.appendInvariantChars(indexString, status);
+ output.append(']', status);
+ }
+ return output;
+}
+
+void FileTracer::traceOpen(const char* path, const char* type, const char* name) {
+ if (uprv_strcmp(type, "res") == 0) {
+ traceOpenResFile(path, name);
+ } else {
+ traceOpenDataFile(path, type, name);
+ }
+}
+
+void FileTracer::traceOpenDataFile(const char* path, const char* type, const char* name) {
+ UTRACE_ENTRY(UTRACE_UDATA_DATA_FILE);
+ UErrorCode status = U_ZERO_ERROR;
+
+ CharString filePath;
+ filePath.append(path, status);
+ filePath.append('/', status);
+ filePath.append(name, status);
+ filePath.append('.', status);
+ filePath.append(type, status);
+
+ UTRACE_DATA1(UTRACE_VERBOSE, "%s", filePath.data());
+ UTRACE_EXIT_STATUS(status);
+}
+
+void FileTracer::traceOpenResFile(const char* path, const char* name) {
+ UTRACE_ENTRY(UTRACE_UDATA_RES_FILE);
+ UErrorCode status = U_ZERO_ERROR;
+
+ CharString filePath;
+ filePath.append(path, status);
+ filePath.append('/', status);
+ filePath.append(name, status);
+ filePath.append(".res", status);
+
+ UTRACE_DATA1(UTRACE_VERBOSE, "%s", filePath.data());
+ UTRACE_EXIT_STATUS(status);
+}
+
+U_NAMESPACE_END
+
+#endif // U_ENABLE_TRACING
diff --git a/deps/icu-small/source/common/restrace.h b/deps/icu-small/source/common/restrace.h
new file mode 100644
index 00000000000000..ef29eaed578107
--- /dev/null
+++ b/deps/icu-small/source/common/restrace.h
@@ -0,0 +1,147 @@
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#ifndef __RESTRACE_H__
+#define __RESTRACE_H__
+
+#include "unicode/utypes.h"
+
+#if U_ENABLE_TRACING
+
+struct UResourceBundle;
+
+U_NAMESPACE_BEGIN
+
+class CharString;
+
+/**
+ * Instances of this class store information used to trace reads from resource
+ * bundles when ICU is built with --enable-tracing.
+ *
+ * All arguments of type const UResourceBundle*, const char*, and
+ * const ResourceTracer& are stored as pointers. The caller must retain
+ * ownership for the lifetime of this ResourceTracer.
+ *
+ * Exported as U_COMMON_API for Windows because it is a value field
+ * in other exported types.
+ */
+class U_COMMON_API ResourceTracer {
+public:
+ ResourceTracer() :
+ fResB(nullptr),
+ fParent(nullptr),
+ fKey(nullptr),
+ fIndex(-1) {}
+
+ ResourceTracer(const UResourceBundle* resB) :
+ fResB(resB),
+ fParent(nullptr),
+ fKey(nullptr),
+ fIndex(-1) {}
+
+ ResourceTracer(const UResourceBundle* resB, const char* key) :
+ fResB(resB),
+ fParent(nullptr),
+ fKey(key),
+ fIndex(-1) {}
+
+ ResourceTracer(const UResourceBundle* resB, int32_t index) :
+ fResB(resB),
+ fParent(nullptr),
+ fKey(nullptr),
+ fIndex(index) {}
+
+ ResourceTracer(const ResourceTracer& parent, const char* key) :
+ fResB(nullptr),
+ fParent(&parent),
+ fKey(key),
+ fIndex(-1) {}
+
+ ResourceTracer(const ResourceTracer& parent, int32_t index) :
+ fResB(nullptr),
+ fParent(&parent),
+ fKey(nullptr),
+ fIndex(index) {}
+
+ ~ResourceTracer();
+
+ void trace(const char* type) const;
+ void traceOpen() const;
+
+ /**
+ * Calls trace() if the resB or parent provided to the constructor was
+ * non-null; otherwise, does nothing.
+ */
+ void maybeTrace(const char* type) const {
+ if (fResB || fParent) {
+ trace(type);
+ }
+ }
+
+private:
+ const UResourceBundle* fResB;
+ const ResourceTracer* fParent;
+ const char* fKey;
+ int32_t fIndex;
+
+ CharString& getFilePath(CharString& output, UErrorCode& status) const;
+
+ CharString& getResPath(CharString& output, UErrorCode& status) const;
+};
+
+/**
+ * This class provides methods to trace data file reads when ICU is built
+ * with --enable-tracing.
+ */
+class FileTracer {
+public:
+ static void traceOpen(const char* path, const char* type, const char* name);
+
+private:
+ static void traceOpenDataFile(const char* path, const char* type, const char* name);
+ static void traceOpenResFile(const char* path, const char* name);
+};
+
+U_NAMESPACE_END
+
+#else // U_ENABLE_TRACING
+
+U_NAMESPACE_BEGIN
+
+/**
+ * Default trivial implementation when --enable-tracing is not used.
+ */
+class U_COMMON_API ResourceTracer {
+public:
+ ResourceTracer() {}
+
+ ResourceTracer(const void*) {}
+
+ ResourceTracer(const void*, const char*) {}
+
+ ResourceTracer(const void*, int32_t) {}
+
+ ResourceTracer(const ResourceTracer&, const char*) {}
+
+ ResourceTracer(const ResourceTracer&, int32_t) {}
+
+ void trace(const char*) const {}
+
+ void traceOpen() const {}
+
+ void maybeTrace(const char*) const {}
+};
+
+/**
+ * Default trivial implementation when --enable-tracing is not used.
+ */
+class FileTracer {
+public:
+ static void traceOpen(const char*, const char*, const char*) {}
+};
+
+U_NAMESPACE_END
+
+#endif // U_ENABLE_TRACING
+
+#endif //__RESTRACE_H__
diff --git a/deps/icu-small/source/common/ruleiter.h b/deps/icu-small/source/common/ruleiter.h
index b6edc657aff261..4e1be53823d78a 100644
--- a/deps/icu-small/source/common/ruleiter.h
+++ b/deps/icu-small/source/common/ruleiter.h
@@ -39,7 +39,7 @@ class RuleCharacterIterator : public UMemory {
private:
/**
* Text being iterated.
- */
+ */
const UnicodeString& text;
/**
@@ -51,7 +51,7 @@ class RuleCharacterIterator : public UMemory {
* Symbol table used to parse and dereference variables. May be 0.
*/
const SymbolTable* sym;
-
+
/**
* Current variable expansion, or 0 if none.
*/
@@ -102,7 +102,7 @@ class RuleCharacterIterator : public UMemory {
*/
RuleCharacterIterator(const UnicodeString& text, const SymbolTable* sym,
ParsePosition& pos);
-
+
/**
* Returns true if this iterator has no more characters to return.
*/
@@ -207,7 +207,7 @@ class RuleCharacterIterator : public UMemory {
* representation of this object
*/
// UnicodeString& toString(UnicodeString& result) const;
-
+
private:
/**
* Returns the current 32-bit code point without parsing escapes, parsing
@@ -215,7 +215,7 @@ class RuleCharacterIterator : public UMemory {
* @return the current 32-bit code point
*/
UChar32 _current() const;
-
+
/**
* Advances the position by the given amount.
* @param count the number of 16-bit code units to advance past
diff --git a/deps/icu-small/source/common/schriter.cpp b/deps/icu-small/source/common/schriter.cpp
index f852800aaae6bd..17b68aee9d923a 100644
--- a/deps/icu-small/source/common/schriter.cpp
+++ b/deps/icu-small/source/common/schriter.cpp
@@ -101,7 +101,7 @@ StringCharacterIterator::operator==(const ForwardCharacterIterator& that) const
&& end == realThat.end;
}
-CharacterIterator*
+StringCharacterIterator*
StringCharacterIterator::clone() const {
return new StringCharacterIterator(*this);
}
diff --git a/deps/icu-small/source/common/serv.cpp b/deps/icu-small/source/common/serv.cpp
index 40940740d02b45..ce545b9dbd5ecb 100644
--- a/deps/icu-small/source/common/serv.cpp
+++ b/deps/icu-small/source/common/serv.cpp
@@ -26,60 +26,60 @@ U_NAMESPACE_BEGIN
const UChar ICUServiceKey::PREFIX_DELIMITER = 0x002F; /* '/' */
-ICUServiceKey::ICUServiceKey(const UnicodeString& id)
+ICUServiceKey::ICUServiceKey(const UnicodeString& id)
: _id(id) {
}
-ICUServiceKey::~ICUServiceKey()
+ICUServiceKey::~ICUServiceKey()
{
}
-const UnicodeString&
-ICUServiceKey::getID() const
+const UnicodeString&
+ICUServiceKey::getID() const
{
return _id;
}
-UnicodeString&
-ICUServiceKey::canonicalID(UnicodeString& result) const
+UnicodeString&
+ICUServiceKey::canonicalID(UnicodeString& result) const
{
return result.append(_id);
}
-UnicodeString&
-ICUServiceKey::currentID(UnicodeString& result) const
+UnicodeString&
+ICUServiceKey::currentID(UnicodeString& result) const
{
return canonicalID(result);
}
-UnicodeString&
-ICUServiceKey::currentDescriptor(UnicodeString& result) const
+UnicodeString&
+ICUServiceKey::currentDescriptor(UnicodeString& result) const
{
prefix(result);
result.append(PREFIX_DELIMITER);
return currentID(result);
}
-UBool
-ICUServiceKey::fallback()
+UBool
+ICUServiceKey::fallback()
{
return FALSE;
}
-UBool
-ICUServiceKey::isFallbackOf(const UnicodeString& id) const
+UBool
+ICUServiceKey::isFallbackOf(const UnicodeString& id) const
{
return id == _id;
}
-UnicodeString&
-ICUServiceKey::prefix(UnicodeString& result) const
+UnicodeString&
+ICUServiceKey::prefix(UnicodeString& result) const
{
return result;
}
-UnicodeString&
-ICUServiceKey::parsePrefix(UnicodeString& result)
+UnicodeString&
+ICUServiceKey::parsePrefix(UnicodeString& result)
{
int32_t n = result.indexOf(PREFIX_DELIMITER);
if (n < 0) {
@@ -89,8 +89,8 @@ ICUServiceKey::parsePrefix(UnicodeString& result)
return result;
}
-UnicodeString&
-ICUServiceKey::parseSuffix(UnicodeString& result)
+UnicodeString&
+ICUServiceKey::parseSuffix(UnicodeString& result)
{
int32_t n = result.indexOf(PREFIX_DELIMITER);
if (n >= 0) {
@@ -100,8 +100,8 @@ ICUServiceKey::parseSuffix(UnicodeString& result)
}
#ifdef SERVICE_DEBUG
-UnicodeString&
-ICUServiceKey::debug(UnicodeString& result) const
+UnicodeString&
+ICUServiceKey::debug(UnicodeString& result) const
{
debugClass(result);
result.append((UnicodeString)" id: ");
@@ -109,8 +109,8 @@ ICUServiceKey::debug(UnicodeString& result) const
return result;
}
-UnicodeString&
-ICUServiceKey::debugClass(UnicodeString& result) const
+UnicodeString&
+ICUServiceKey::debugClass(UnicodeString& result) const
{
return result.append((UnicodeString)"ICUServiceKey");
}
@@ -124,30 +124,30 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ICUServiceKey)
ICUServiceFactory::~ICUServiceFactory() {}
-SimpleFactory::SimpleFactory(UObject* instanceToAdopt, const UnicodeString& id, UBool visible)
+SimpleFactory::SimpleFactory(UObject* instanceToAdopt, const UnicodeString& id, UBool visible)
: _instance(instanceToAdopt), _id(id), _visible(visible)
{
}
-SimpleFactory::~SimpleFactory()
+SimpleFactory::~SimpleFactory()
{
delete _instance;
}
-UObject*
-SimpleFactory::create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const
+UObject*
+SimpleFactory::create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const
{
if (U_SUCCESS(status)) {
UnicodeString temp;
if (_id == key.currentID(temp)) {
- return service->cloneInstance(_instance);
+ return service->cloneInstance(_instance);
}
}
return NULL;
}
-void
-SimpleFactory::updateVisibleIDs(Hashtable& result, UErrorCode& status) const
+void
+SimpleFactory::updateVisibleIDs(Hashtable& result, UErrorCode& status) const
{
if (_visible) {
result.put(_id, (void*)this, status); // cast away const
@@ -156,8 +156,8 @@ SimpleFactory::updateVisibleIDs(Hashtable& result, UErrorCode& status) const
}
}
-UnicodeString&
-SimpleFactory::getDisplayName(const UnicodeString& id, const Locale& /* locale */, UnicodeString& result) const
+UnicodeString&
+SimpleFactory::getDisplayName(const UnicodeString& id, const Locale& /* locale */, UnicodeString& result) const
{
if (_visible && _id == id) {
result = _id;
@@ -168,8 +168,8 @@ SimpleFactory::getDisplayName(const UnicodeString& id, const Locale& /* locale *
}
#ifdef SERVICE_DEBUG
-UnicodeString&
-SimpleFactory::debug(UnicodeString& toAppendTo) const
+UnicodeString&
+SimpleFactory::debug(UnicodeString& toAppendTo) const
{
debugClass(toAppendTo);
toAppendTo.append((UnicodeString)" id: ");
@@ -179,8 +179,8 @@ SimpleFactory::debug(UnicodeString& toAppendTo) const
return toAppendTo;
}
-UnicodeString&
-SimpleFactory::debugClass(UnicodeString& toAppendTo) const
+UnicodeString&
+SimpleFactory::debugClass(UnicodeString& toAppendTo) const
{
return toAppendTo.append((UnicodeString)"SimpleFactory");
}
@@ -217,14 +217,14 @@ class CacheEntry : public UMemory {
delete service;
}
- CacheEntry(const UnicodeString& _actualDescriptor, UObject* _service)
+ CacheEntry(const UnicodeString& _actualDescriptor, UObject* _service)
: refcount(1), actualDescriptor(_actualDescriptor), service(_service) {
}
/**
* Instantiation creates an initial reference, so don't call this
* unless you're creating a new pointer to this. Management of
- * that pointer will have to know how to deal with refcounts.
+ * that pointer will have to know how to deal with refcounts.
* Return true if the resource has not already been released.
*/
CacheEntry* ref() {
@@ -281,8 +281,8 @@ class DNCache : public UMemory {
Hashtable cache;
const Locale locale;
- DNCache(const Locale& _locale)
- : cache(), locale(_locale)
+ DNCache(const Locale& _locale)
+ : cache(), locale(_locale)
{
// cache.setKeyDeleter(uprv_deleteUObject);
}
@@ -293,8 +293,8 @@ class DNCache : public UMemory {
******************************************************************
*/
-StringPair*
-StringPair::create(const UnicodeString& displayName,
+StringPair*
+StringPair::create(const UnicodeString& displayName,
const UnicodeString& id,
UErrorCode& status)
{
@@ -310,12 +310,12 @@ StringPair::create(const UnicodeString& displayName,
return NULL;
}
-UBool
+UBool
StringPair::isBogus() const {
return displayName.isBogus() || id.isBogus();
}
-StringPair::StringPair(const UnicodeString& _displayName,
+StringPair::StringPair(const UnicodeString& _displayName,
const UnicodeString& _id)
: displayName(_displayName)
, id(_id)
@@ -333,10 +333,7 @@ U_CDECL_END
******************************************************************
*/
-static UMutex *lock() {
- static UMutex m = U_MUTEX_INITIALIZER;
- return &m;
-}
+static UMutex lock;
ICUService::ICUService()
: name()
@@ -348,7 +345,7 @@ ICUService::ICUService()
{
}
-ICUService::ICUService(const UnicodeString& newName)
+ICUService::ICUService(const UnicodeString& newName)
: name(newName)
, timestamp(0)
, factories(NULL)
@@ -361,21 +358,21 @@ ICUService::ICUService(const UnicodeString& newName)
ICUService::~ICUService()
{
{
- Mutex mutex(lock());
+ Mutex mutex(&lock);
clearCaches();
delete factories;
factories = NULL;
}
}
-UObject*
-ICUService::get(const UnicodeString& descriptor, UErrorCode& status) const
+UObject*
+ICUService::get(const UnicodeString& descriptor, UErrorCode& status) const
{
return get(descriptor, NULL, status);
}
-UObject*
-ICUService::get(const UnicodeString& descriptor, UnicodeString* actualReturn, UErrorCode& status) const
+UObject*
+ICUService::get(const UnicodeString& descriptor, UnicodeString* actualReturn, UErrorCode& status) const
{
UObject* result = NULL;
ICUServiceKey* key = createKey(&descriptor, status);
@@ -386,8 +383,8 @@ ICUService::get(const UnicodeString& descriptor, UnicodeString* actualReturn, UE
return result;
}
-UObject*
-ICUService::getKey(ICUServiceKey& key, UErrorCode& status) const
+UObject*
+ICUService::getKey(ICUServiceKey& key, UErrorCode& status) const
{
return getKey(key, NULL, status);
}
@@ -395,8 +392,8 @@ ICUService::getKey(ICUServiceKey& key, UErrorCode& status) const
// this is a vector that subclasses of ICUService can override to further customize the result object
// before returning it. All other public get functions should call this one.
-UObject*
-ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const
+UObject*
+ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const
{
return getKey(key, actualReturn, NULL, status);
}
@@ -406,9 +403,9 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode&
// reentrantly even without knowing the thread.
class XMutex : public UMemory {
public:
- inline XMutex(UMutex *mutex, UBool reentering)
+ inline XMutex(UMutex *mutex, UBool reentering)
: fMutex(mutex)
- , fActive(!reentering)
+ , fActive(!reentering)
{
if (fActive) umtx_lock(fMutex);
}
@@ -428,8 +425,8 @@ struct UVectorDeleter {
};
// called only by factories, treat as private
-UObject*
-ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUServiceFactory* factory, UErrorCode& status) const
+UObject*
+ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUServiceFactory* factory, UErrorCode& status) const
{
if (U_FAILURE(status)) {
return NULL;
@@ -443,16 +440,16 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
CacheEntry* result = NULL;
{
- // The factory list can't be modified until we're done,
+ // The factory list can't be modified until we're done,
// otherwise we might update the cache with an invalid result.
// The cache has to stay in synch with the factory list.
- // ICU doesn't have monitors so we can't use rw locks, so
+ // ICU doesn't have monitors so we can't use rw locks, so
// we single-thread everything using this service, for now.
// if factory is not null, we're calling from within the mutex,
// and since some unix machines don't have reentrant mutexes we
// need to make sure not to try to lock it again.
- XMutex mutex(lock(), factory != NULL);
+ XMutex mutex(&lock, factory != NULL);
if (serviceCache == NULL) {
ncthis->serviceCache = new Hashtable(status);
@@ -498,7 +495,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
}
// first test of cache failed, so we'll have to update
- // the cache if we eventually succeed-- that is, if we're
+ // the cache if we eventually succeed-- that is, if we're
// going to update the cache at all.
putInCache = TRUE;
@@ -522,7 +519,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
}
}
- // prepare to load the cache with all additional ids that
+ // prepare to load the cache with all additional ids that
// will resolve to result, assuming we'll succeed. We
// don't want to keep querying on an id that's going to
// fallback to the one that succeeded, we want to hit the
@@ -572,8 +569,8 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
// strip null prefix
if (result->actualDescriptor.indexOf((UChar)0x2f) == 0) { // U+002f=slash (/)
actualReturn->remove();
- actualReturn->append(result->actualDescriptor,
- 1,
+ actualReturn->append(result->actualDescriptor,
+ 1,
result->actualDescriptor.length() - 1);
} else {
*actualReturn = result->actualDescriptor;
@@ -597,19 +594,19 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
return handleDefault(key, actualReturn, status);
}
-UObject*
-ICUService::handleDefault(const ICUServiceKey& /* key */, UnicodeString* /* actualIDReturn */, UErrorCode& /* status */) const
+UObject*
+ICUService::handleDefault(const ICUServiceKey& /* key */, UnicodeString* /* actualIDReturn */, UErrorCode& /* status */) const
{
return NULL;
}
-UVector&
+UVector&
ICUService::getVisibleIDs(UVector& result, UErrorCode& status) const {
return getVisibleIDs(result, NULL, status);
}
-UVector&
-ICUService::getVisibleIDs(UVector& result, const UnicodeString* matchID, UErrorCode& status) const
+UVector&
+ICUService::getVisibleIDs(UVector& result, const UnicodeString* matchID, UErrorCode& status) const
{
result.removeAllElements();
@@ -618,7 +615,7 @@ ICUService::getVisibleIDs(UVector& result, const UnicodeString* matchID, UErrorC
}
{
- Mutex mutex(lock());
+ Mutex mutex(&lock);
const Hashtable* map = getVisibleIDMap(status);
if (map != NULL) {
ICUServiceKey* fallbackKey = createKey(matchID, status);
@@ -657,7 +654,7 @@ ICUService::getVisibleIDs(UVector& result, const UnicodeString* matchID, UErrorC
return result;
}
-const Hashtable*
+const Hashtable*
ICUService::getVisibleIDMap(UErrorCode& status) const {
if (U_FAILURE(status)) return NULL;
@@ -684,18 +681,18 @@ ICUService::getVisibleIDMap(UErrorCode& status) const {
}
-UnicodeString&
-ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result) const
+UnicodeString&
+ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result) const
{
return getDisplayName(id, result, Locale::getDefault());
}
-UnicodeString&
-ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const Locale& locale) const
+UnicodeString&
+ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const Locale& locale) const
{
{
UErrorCode status = U_ZERO_ERROR;
- Mutex mutex(lock());
+ Mutex mutex(&lock);
const Hashtable* map = getVisibleIDMap(status);
if (map != NULL) {
ICUServiceFactory* f = (ICUServiceFactory*)map->get(id);
@@ -724,30 +721,30 @@ ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const
return result;
}
-UVector&
-ICUService::getDisplayNames(UVector& result, UErrorCode& status) const
+UVector&
+ICUService::getDisplayNames(UVector& result, UErrorCode& status) const
{
return getDisplayNames(result, Locale::getDefault(), NULL, status);
}
-UVector&
-ICUService::getDisplayNames(UVector& result, const Locale& locale, UErrorCode& status) const
+UVector&
+ICUService::getDisplayNames(UVector& result, const Locale& locale, UErrorCode& status) const
{
return getDisplayNames(result, locale, NULL, status);
}
-UVector&
-ICUService::getDisplayNames(UVector& result,
- const Locale& locale,
- const UnicodeString* matchID,
- UErrorCode& status) const
+UVector&
+ICUService::getDisplayNames(UVector& result,
+ const Locale& locale,
+ const UnicodeString* matchID,
+ UErrorCode& status) const
{
result.removeAllElements();
result.setDeleter(userv_deleteStringPair);
if (U_SUCCESS(status)) {
ICUService* ncthis = (ICUService*)this; // cast away semantic const
- Mutex mutex(lock());
+ Mutex mutex(&lock);
if (dnCache != NULL && dnCache->locale != locale) {
delete dnCache;
@@ -759,7 +756,7 @@ ICUService::getDisplayNames(UVector& result,
if (U_FAILURE(status)) {
return result;
}
- ncthis->dnCache = new DNCache(locale);
+ ncthis->dnCache = new DNCache(locale);
if (dnCache == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return result;
@@ -792,7 +789,7 @@ ICUService::getDisplayNames(UVector& result,
* nextElement(pos) will skip the position at pos and begin the iteration
* at the next position, which in this case will be 0.
*/
- int32_t pos = UHASH_FIRST;
+ int32_t pos = UHASH_FIRST;
const UHashElement *entry = NULL;
while ((entry = dnCache->cache.nextElement(pos)) != NULL) {
const UnicodeString* id = (const UnicodeString*)entry->value.pointer;
@@ -813,13 +810,13 @@ ICUService::getDisplayNames(UVector& result,
}
URegistryKey
-ICUService::registerInstance(UObject* objToAdopt, const UnicodeString& id, UErrorCode& status)
+ICUService::registerInstance(UObject* objToAdopt, const UnicodeString& id, UErrorCode& status)
{
return registerInstance(objToAdopt, id, TRUE, status);
}
URegistryKey
-ICUService::registerInstance(UObject* objToAdopt, const UnicodeString& id, UBool visible, UErrorCode& status)
+ICUService::registerInstance(UObject* objToAdopt, const UnicodeString& id, UBool visible, UErrorCode& status)
{
ICUServiceKey* key = createKey(&id, status);
if (key != NULL) {
@@ -836,7 +833,7 @@ ICUService::registerInstance(UObject* objToAdopt, const UnicodeString& id, UBool
return NULL;
}
-ICUServiceFactory*
+ICUServiceFactory*
ICUService::createSimpleFactory(UObject* objToAdopt, const UnicodeString& id, UBool visible, UErrorCode& status)
{
if (U_SUCCESS(status)) {
@@ -849,10 +846,10 @@ ICUService::createSimpleFactory(UObject* objToAdopt, const UnicodeString& id, UB
}
URegistryKey
-ICUService::registerFactory(ICUServiceFactory* factoryToAdopt, UErrorCode& status)
+ICUService::registerFactory(ICUServiceFactory* factoryToAdopt, UErrorCode& status)
{
if (U_SUCCESS(status) && factoryToAdopt != NULL) {
- Mutex mutex(lock());
+ Mutex mutex(&lock);
if (factories == NULL) {
factories = new UVector(deleteUObject, NULL, status);
@@ -877,13 +874,13 @@ ICUService::registerFactory(ICUServiceFactory* factoryToAdopt, UErrorCode& statu
return (URegistryKey)factoryToAdopt;
}
-UBool
-ICUService::unregister(URegistryKey rkey, UErrorCode& status)
+UBool
+ICUService::unregister(URegistryKey rkey, UErrorCode& status)
{
ICUServiceFactory *factory = (ICUServiceFactory*)rkey;
UBool result = FALSE;
if (factory != NULL && factories != NULL) {
- Mutex mutex(lock());
+ Mutex mutex(&lock);
if (factories->removeElement(factory)) {
clearCaches();
@@ -899,39 +896,39 @@ ICUService::unregister(URegistryKey rkey, UErrorCode& status)
return result;
}
-void
-ICUService::reset()
+void
+ICUService::reset()
{
{
- Mutex mutex(lock());
+ Mutex mutex(&lock);
reInitializeFactories();
clearCaches();
}
notifyChanged();
}
-void
-ICUService::reInitializeFactories()
+void
+ICUService::reInitializeFactories()
{
if (factories != NULL) {
factories->removeAllElements();
}
}
-UBool
-ICUService::isDefault() const
+UBool
+ICUService::isDefault() const
{
return countFactories() == 0;
}
-ICUServiceKey*
-ICUService::createKey(const UnicodeString* id, UErrorCode& status) const
+ICUServiceKey*
+ICUService::createKey(const UnicodeString* id, UErrorCode& status) const
{
return (U_FAILURE(status) || id == NULL) ? NULL : new ICUServiceKey(*id);
}
-void
-ICUService::clearCaches()
+void
+ICUService::clearCaches()
{
// callers synchronize before use
++timestamp;
@@ -942,33 +939,33 @@ ICUService::clearCaches()
delete serviceCache; serviceCache = NULL;
}
-void
-ICUService::clearServiceCache()
+void
+ICUService::clearServiceCache()
{
// callers synchronize before use
delete serviceCache; serviceCache = NULL;
}
-UBool
-ICUService::acceptsListener(const EventListener& l) const
+UBool
+ICUService::acceptsListener(const EventListener& l) const
{
return dynamic_cast(&l) != NULL;
}
-void
-ICUService::notifyListener(EventListener& l) const
+void
+ICUService::notifyListener(EventListener& l) const
{
((ServiceListener&)l).serviceChanged(*this);
}
UnicodeString&
-ICUService::getName(UnicodeString& result) const
+ICUService::getName(UnicodeString& result) const
{
return result.append(name);
}
-int32_t
-ICUService::countFactories() const
+int32_t
+ICUService::countFactories() const
{
return factories == NULL ? 0 : factories->size();
}
diff --git a/deps/icu-small/source/common/serv.h b/deps/icu-small/source/common/serv.h
index 70695839a8f3ce..e1f69cd4119e5d 100644
--- a/deps/icu-small/source/common/serv.h
+++ b/deps/icu-small/source/common/serv.h
@@ -61,16 +61,16 @@ class DNCache;
* The descriptor contains an optional prefix, followed by '/'
* and the currentID. Factories that handle complex keys,
* for example number format factories that generate multiple
- * kinds of formatters for the same locale, use the descriptor
- * to provide a fully unique identifier for the service object,
+ * kinds of formatters for the same locale, use the descriptor
+ * to provide a fully unique identifier for the service object,
* while using the currentID (in this case, the locale string),
* as the visible IDs that can be localized.
*
* The default implementation of ICUServiceKey has no fallbacks and
- * has no custom descriptors.
+ * has no custom descriptors.
*/
class U_COMMON_API ICUServiceKey : public UObject {
- private:
+ private:
const UnicodeString _id;
protected:
@@ -111,7 +111,7 @@ class U_COMMON_API ICUServiceKey : public UObject {
* the canonical ID to result. Result is returned as a convenience.
*
* @param result the output parameter to which the current id will be appended.
- * @return the modified result.
+ * @return the modified result.
*/
virtual UnicodeString& currentID(UnicodeString& result) const;
@@ -127,7 +127,7 @@ class U_COMMON_API ICUServiceKey : public UObject {
* instantiate the service.
*
* @param result the output parameter to which the current id will be appended.
- * @return the modified result.
+ * @return the modified result.
*/
virtual UnicodeString& currentDescriptor(UnicodeString& result) const;
@@ -162,10 +162,10 @@ class U_COMMON_API ICUServiceKey : public UObject {
/**
* A utility to parse the prefix out of a descriptor string. Only
- * the (undelimited) prefix, if any, remains in result. Result is returned as a
+ * the (undelimited) prefix, if any, remains in result. Result is returned as a
* convenience.
*
- * @param result an input/output parameter that on entry is a descriptor, and
+ * @param result an input/output parameter that on entry is a descriptor, and
* on exit is the prefix of that descriptor.
* @return the modified result.
*/
@@ -173,10 +173,10 @@ class U_COMMON_API ICUServiceKey : public UObject {
/**
* A utility to parse the suffix out of a descriptor string. Only
- * the (undelimited) suffix, if any, remains in result. Result is returned as a
+ * the (undelimited) suffix, if any, remains in result. Result is returned as a
* convenience.
*
- * @param result an input/output parameter that on entry is a descriptor, and
+ * @param result an input/output parameter that on entry is a descriptor, and
* on exit is the suffix of that descriptor.
* @return the modified result.
*/
@@ -254,7 +254,7 @@ class U_COMMON_API ICUServiceFactory : public UObject {
/**
* Return, in result, the display name of the id in the provided locale.
- * This is an id, not a descriptor. If the id is
+ * This is an id, not a descriptor. If the id is
* not visible, sets result to bogus. If the
* incoming result is bogus, it remains bogus. Result is returned as a
* convenience. Results are not defined if id is not one supported by this
@@ -290,7 +290,7 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory {
public:
/**
- *
Construct a SimpleFactory that maps a single ID to a single
+ *
Construct a SimpleFactory that maps a single ID to a single
* service instance. If visible is TRUE, the ID will be visible.
* The instance must not be NULL. The SimpleFactory will adopt
* the instance, which must not be changed subsequent to this call.
@@ -318,7 +318,7 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory {
virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const;
/**
- * This implementation adds a mapping from ID -> this to result if visible is TRUE,
+ *
This implementation adds a mapping from ID -> this to result if visible is TRUE,
* otherwise it removes ID from result.
*
* @param result the mapping table to update.
@@ -376,22 +376,22 @@ class U_COMMON_API ServiceListener : public EventListener {
* This method is called when the service changes. At the time of the
* call this listener is registered with the service. It must
* not modify the notifier in the context of this call.
- *
+ *
* @param service the service that changed.
*/
virtual void serviceChanged(const ICUService& service) const = 0;
-
+
public:
/**
* UObject RTTI boilerplate.
*/
static UClassID U_EXPORT2 getStaticClassID();
-
+
/**
* UObject RTTI boilerplate.
*/
virtual UClassID getDynamicClassID() const;
-
+
};
/*
@@ -422,7 +422,7 @@ class U_COMMON_API StringPair : public UMemory {
* @param status the error code status.
* @return a StringPair if the creation was successful, otherwise NULL.
*/
- static StringPair* create(const UnicodeString& displayName,
+ static StringPair* create(const UnicodeString& displayName,
const UnicodeString& id,
UErrorCode& status);
@@ -521,10 +521,10 @@ class U_COMMON_API StringPair : public UMemory {
* subclass of ICUService that uses Locale names as IDs and uses
* ICUServiceKeys that implement the standard resource bundle fallback
* strategy. Most clients will wish to subclass it instead of
- * ICUService.
+ * ICUService.
*/
class U_COMMON_API ICUService : public ICUNotifier {
- protected:
+ protected:
/**
* Name useful for debugging.
*/
@@ -631,7 +631,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
* has no fallback. If no object is found, the result of handleDefault
* is returned.
*
- * Subclasses can override this method to further customize the
+ *
Subclasses can override this method to further customize the
* result before returning it.
*
* @param key the key.
@@ -646,7 +646,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
* of a previous getKey call, to determine what previously-registered factories would
* have returned. For details, see getKey(ICUServiceKey&, UErrorCode&). Subclasses
* should not call it directly, but call through one of the other get functions.
- *
+ *
* @param key the key.
* @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL.
* @param factory the factory making the recursive call.
@@ -710,7 +710,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
UnicodeString& getDisplayName(const UnicodeString& id, UnicodeString& result, const Locale& locale) const;
/**
- * Convenience override of getDisplayNames(const Locale&, const UnicodeString*) that
+ *
Convenience override of getDisplayNames(const Locale&, const UnicodeString*) that
* uses the current default Locale as the locale and NULL for
* the matchID.
*
@@ -721,7 +721,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
UVector& getDisplayNames(UVector& result, UErrorCode& status) const;
/**
- * Convenience override of getDisplayNames(const Locale&, const UnicodeString*) that
+ *
Convenience override of getDisplayNames(const Locale&, const UnicodeString*) that
* uses NULL for the matchID.
*
* @param result a vector to hold the returned displayName/id StringPairs.
@@ -755,8 +755,8 @@ class U_COMMON_API ICUService : public ICUNotifier {
* @param status the error code status.
* @return the result vector. */
UVector& getDisplayNames(UVector& result,
- const Locale& locale,
- const UnicodeString* matchID,
+ const Locale& locale,
+ const UnicodeString* matchID,
UErrorCode& status) const;
/**
@@ -772,7 +772,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
URegistryKey registerInstance(UObject* objToAdopt, const UnicodeString& id, UErrorCode& status);
/**
- * Register a service instance with the provided ID. The ID will be
+ *
Register a service instance with the provided ID. The ID will be
* canonicalized. The canonicalized ID will be returned by
* getVisibleIDs if visible is TRUE. The service instance will be adopted and
* must not be modified subsequent to this call.
@@ -819,7 +819,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
* listeners.
*
* @param rkey the registry key.
- * @param status the error code status.
+ * @param status the error code status.
* @return TRUE if the call successfully unregistered the factory.
*/
virtual UBool unregister(URegistryKey rkey, UErrorCode& status);
@@ -835,7 +835,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
/**
* Return TRUE if the service is in its default state.
*
- * The default implementation returns TRUE if there are no
+ *
The default implementation returns TRUE if there are no
* factories registered.
*/
virtual UBool isDefault(void) const;
@@ -993,3 +993,4 @@ U_NAMESPACE_END
/* ICUSERV_H */
#endif
+
diff --git a/deps/icu-small/source/common/servlk.cpp b/deps/icu-small/source/common/servlk.cpp
index 27b046f1e504f5..538982ca36285c 100644
--- a/deps/icu-small/source/common/servlk.cpp
+++ b/deps/icu-small/source/common/servlk.cpp
@@ -184,3 +184,5 @@ U_NAMESPACE_END
/* !UCONFIG_NO_SERVICE */
#endif
+
+
diff --git a/deps/icu-small/source/common/servlkf.cpp b/deps/icu-small/source/common/servlkf.cpp
index 6e46bd2079722a..84f2347cddef0d 100644
--- a/deps/icu-small/source/common/servlkf.cpp
+++ b/deps/icu-small/source/common/servlkf.cpp
@@ -105,9 +105,9 @@ LocaleKeyFactory::getDisplayName(const UnicodeString& id, const Locale& locale,
}
UObject*
-LocaleKeyFactory::handleCreate(const Locale& /* loc */,
- int32_t /* kind */,
- const ICUService* /* service */,
+LocaleKeyFactory::handleCreate(const Locale& /* loc */,
+ int32_t /* kind */,
+ const ICUService* /* service */,
UErrorCode& /* status */) const {
return NULL;
}
@@ -148,3 +148,5 @@ U_NAMESPACE_END
/* !UCONFIG_NO_SERVICE */
#endif
+
+
diff --git a/deps/icu-small/source/common/servloc.h b/deps/icu-small/source/common/servloc.h
index 501989424423ea..ccf6433379ddb3 100644
--- a/deps/icu-small/source/common/servloc.h
+++ b/deps/icu-small/source/common/servloc.h
@@ -60,11 +60,11 @@ class ServiceListener;
*
* Canonicalization adjusts the locale string so that the
* section before the first understore is in lower case, and the rest
- * is in upper case, with no trailing underscores.
+ * is in upper case, with no trailing underscores.
*/
class U_COMMON_API LocaleKey : public ICUServiceKey {
- private:
+ private:
int32_t _kind;
UnicodeString _primaryID;
UnicodeString _fallbackID;
@@ -78,15 +78,15 @@ class U_COMMON_API LocaleKey : public ICUServiceKey {
/**
* Create a LocaleKey with canonical primary and fallback IDs.
*/
- static LocaleKey* createWithCanonicalFallback(const UnicodeString* primaryID,
+ static LocaleKey* createWithCanonicalFallback(const UnicodeString* primaryID,
const UnicodeString* canonicalFallbackID,
UErrorCode& status);
/**
* Create a LocaleKey with canonical primary and fallback IDs.
*/
- static LocaleKey* createWithCanonicalFallback(const UnicodeString* primaryID,
- const UnicodeString* canonicalFallbackID,
+ static LocaleKey* createWithCanonicalFallback(const UnicodeString* primaryID,
+ const UnicodeString* canonicalFallbackID,
int32_t kind,
UErrorCode& status);
@@ -97,9 +97,9 @@ class U_COMMON_API LocaleKey : public ICUServiceKey {
* fallbackID is the current default locale's string in
* canonical form.
*/
- LocaleKey(const UnicodeString& primaryID,
- const UnicodeString& canonicalPrimaryID,
- const UnicodeString* canonicalFallbackID,
+ LocaleKey(const UnicodeString& primaryID,
+ const UnicodeString& canonicalPrimaryID,
+ const UnicodeString* canonicalFallbackID,
int32_t kind);
public:
@@ -145,16 +145,16 @@ class U_COMMON_API LocaleKey : public ICUServiceKey {
* First falls back through the primary ID, then through
* the fallbackID. The final fallback is the empty string,
* unless the primary id was the empty string, in which case
- * there is no fallback.
+ * there is no fallback.
*/
virtual UBool fallback();
/**
* Return true if a key created from id matches, or would eventually
- * fallback to match, the canonical ID of this key.
+ * fallback to match, the canonical ID of this key.
*/
virtual UBool isFallbackOf(const UnicodeString& id) const;
-
+
public:
/**
* UObject boilerplate.
@@ -183,7 +183,7 @@ class U_COMMON_API LocaleKey : public ICUServiceKey {
/**
* A subclass of ICUServiceFactory that uses LocaleKeys, and is able to
* 'cover' more specific locales with more general locales that it
- * supports.
+ * supports.
*
*
Coverage may be either of the values VISIBLE or INVISIBLE.
*
@@ -203,7 +203,7 @@ class U_COMMON_API LocaleKeyFactory : public ICUServiceFactory {
enum {
/**
* Coverage value indicating that the factory makes
- * its locales visible, and does not cover more specific
+ * its locales visible, and does not cover more specific
* locales.
*/
VISIBLE = 0,
@@ -263,13 +263,13 @@ class U_COMMON_API LocaleKeyFactory : public ICUServiceFactory {
virtual UObject* handleCreate(const Locale& loc, int32_t kind, const ICUService* service, UErrorCode& status) const;
/**
- * Return true if this id is one the factory supports (visible or
+ * Return true if this id is one the factory supports (visible or
* otherwise).
*/
// virtual UBool isSupportedID(const UnicodeString& id, UErrorCode& status) const;
/**
- * Return the set of ids that this factory supports (visible or
+ * Return the set of ids that this factory supports (visible or
* otherwise). This can be called often and might need to be
* cached if it is expensive to create.
*/
@@ -306,14 +306,14 @@ class U_COMMON_API SimpleLocaleKeyFactory : public LocaleKeyFactory {
const int32_t _kind;
public:
- SimpleLocaleKeyFactory(UObject* objToAdopt,
- const UnicodeString& locale,
- int32_t kind,
+ SimpleLocaleKeyFactory(UObject* objToAdopt,
+ const UnicodeString& locale,
+ int32_t kind,
int32_t coverage);
- SimpleLocaleKeyFactory(UObject* objToAdopt,
- const Locale& locale,
- int32_t kind,
+ SimpleLocaleKeyFactory(UObject* objToAdopt,
+ const Locale& locale,
+ int32_t kind,
int32_t coverage);
/**
@@ -366,7 +366,7 @@ class U_COMMON_API SimpleLocaleKeyFactory : public LocaleKeyFactory {
* IDs. Subclasses then override handleCreate to create the actual service
* object. The default implementation returns a resource bundle.
*/
-class U_COMMON_API ICUResourceBundleFactory : public LocaleKeyFactory
+class U_COMMON_API ICUResourceBundleFactory : public LocaleKeyFactory
{
protected:
UnicodeString _bundleName;
@@ -422,7 +422,7 @@ class U_COMMON_API ICUResourceBundleFactory : public LocaleKeyFactory
******************************************************************
*/
-class U_COMMON_API ICULocaleService : public ICUService
+class U_COMMON_API ICULocaleService : public ICUService
{
private:
Locale fallbackLocale;
@@ -447,7 +447,7 @@ class U_COMMON_API ICULocaleService : public ICUService
#if 0
// redeclare because of overload resolution rules?
// no, causes ambiguities since both UnicodeString and Locale have constructors that take a const char*
- // need some compiler flag to remove warnings
+ // need some compiler flag to remove warnings
UObject* get(const UnicodeString& descriptor, UErrorCode& status) const {
return ICUService::get(descriptor, status);
}
@@ -475,12 +475,12 @@ class U_COMMON_API ICULocaleService : public ICUService
* get(Locale, String, Locale[]) with a null kind.
*/
UObject* get(const Locale& locale, Locale* actualReturn, UErrorCode& status) const;
-
+
/**
* Convenience override for callers using locales. This uses
* createKey(Locale.toString(), kind) to create a key, calls getKey, and then
* if actualReturn is not null, returns the actualResult from
- * getKey (stripping any prefix) into a Locale.
+ * getKey (stripping any prefix) into a Locale.
*/
UObject* get(const Locale& locale, int32_t kind, Locale* actualReturn, UErrorCode& status) const;
@@ -548,3 +548,4 @@ U_NAMESPACE_END
/* ICULSERV_H */
#endif
+
diff --git a/deps/icu-small/source/common/servls.cpp b/deps/icu-small/source/common/servls.cpp
index 0b1b1b947d514e..81dc4f750ea93e 100644
--- a/deps/icu-small/source/common/servls.cpp
+++ b/deps/icu-small/source/common/servls.cpp
@@ -92,12 +92,12 @@ ICULocaleService::get(const Locale& locale, int32_t kind, Locale* actualReturn,
URegistryKey
-ICULocaleService::registerInstance(UObject* objToAdopt, const UnicodeString& locale,
+ICULocaleService::registerInstance(UObject* objToAdopt, const UnicodeString& locale,
UBool visible, UErrorCode& status)
{
Locale loc;
LocaleUtility::initLocaleFromName(locale, loc);
- return registerInstance(objToAdopt, loc, LocaleKey::KIND_ANY,
+ return registerInstance(objToAdopt, loc, LocaleKey::KIND_ANY,
visible ? LocaleKeyFactory::VISIBLE : LocaleKeyFactory::INVISIBLE, status);
}
@@ -263,7 +263,7 @@ ICULocaleService::validateFallbackLocale() const
{
const Locale& loc = Locale::getDefault();
ICULocaleService* ncThis = (ICULocaleService*)this;
- static UMutex llock = U_MUTEX_INITIALIZER;
+ static UMutex llock;
{
Mutex mutex(&llock);
if (loc != fallbackLocale) {
@@ -291,3 +291,5 @@ U_NAMESPACE_END
/* !UCONFIG_NO_SERVICE */
#endif
+
+
diff --git a/deps/icu-small/source/common/servnotf.cpp b/deps/icu-small/source/common/servnotf.cpp
index 9b5997bd17f509..f577795cae9d47 100644
--- a/deps/icu-small/source/common/servnotf.cpp
+++ b/deps/icu-small/source/common/servnotf.cpp
@@ -21,27 +21,24 @@ U_NAMESPACE_BEGIN
EventListener::~EventListener() {}
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(EventListener)
-static UMutex *notifyLock() {
- static UMutex m = U_MUTEX_INITIALIZER;
- return &m;
-}
+static UMutex notifyLock;
-ICUNotifier::ICUNotifier(void)
-: listeners(NULL)
+ICUNotifier::ICUNotifier(void)
+: listeners(NULL)
{
}
ICUNotifier::~ICUNotifier(void) {
{
- Mutex lmx(notifyLock());
+ Mutex lmx(¬ifyLock);
delete listeners;
listeners = NULL;
}
}
-void
-ICUNotifier::addListener(const EventListener* l, UErrorCode& status)
+void
+ICUNotifier::addListener(const EventListener* l, UErrorCode& status)
{
if (U_SUCCESS(status)) {
if (l == NULL) {
@@ -50,7 +47,7 @@ ICUNotifier::addListener(const EventListener* l, UErrorCode& status)
}
if (acceptsListener(*l)) {
- Mutex lmx(notifyLock());
+ Mutex lmx(¬ifyLock);
if (listeners == NULL) {
listeners = new UVector(5, status);
} else {
@@ -73,8 +70,8 @@ ICUNotifier::addListener(const EventListener* l, UErrorCode& status)
}
}
-void
-ICUNotifier::removeListener(const EventListener *l, UErrorCode& status)
+void
+ICUNotifier::removeListener(const EventListener *l, UErrorCode& status)
{
if (U_SUCCESS(status)) {
if (l == NULL) {
@@ -83,7 +80,7 @@ ICUNotifier::removeListener(const EventListener *l, UErrorCode& status)
}
{
- Mutex lmx(notifyLock());
+ Mutex lmx(¬ifyLock);
if (listeners != NULL) {
// identity equality check
for (int i = 0, e = listeners->size(); i < e; ++i) {
@@ -102,11 +99,11 @@ ICUNotifier::removeListener(const EventListener *l, UErrorCode& status)
}
}
-void
-ICUNotifier::notifyChanged(void)
+void
+ICUNotifier::notifyChanged(void)
{
if (listeners != NULL) {
- Mutex lmx(notifyLock());
+ Mutex lmx(¬ifyLock);
if (listeners != NULL) {
for (int i = 0, e = listeners->size(); i < e; ++i) {
EventListener* el = (EventListener*)listeners->elementAt(i);
@@ -120,3 +117,4 @@ U_NAMESPACE_END
/* UCONFIG_NO_SERVICE */
#endif
+
diff --git a/deps/icu-small/source/common/servnotf.h b/deps/icu-small/source/common/servnotf.h
index cf92fc169e927f..dba7a0fea3b2bc 100644
--- a/deps/icu-small/source/common/servnotf.h
+++ b/deps/icu-small/source/common/servnotf.h
@@ -34,7 +34,7 @@ U_NAMESPACE_END
U_NAMESPACE_BEGIN
class U_COMMON_API EventListener : public UObject {
-public:
+public:
virtual ~EventListener();
public:
@@ -62,54 +62,54 @@ class U_COMMON_API EventListener : public UObject {
* eventually dequeues the list and calls notifyListener on each
* listener in the list.
*
- * Subclasses override acceptsListener and notifyListener
+ *
Subclasses override acceptsListener and notifyListener
* to add type-safe notification. AcceptsListener should return
* true if the listener is of the appropriate type; ICUNotifier
* itself will ensure the listener is non-null and that the
* identical listener is not already registered with the Notifier.
- * NotifyListener should cast the listener to the appropriate
+ * NotifyListener should cast the listener to the appropriate
* type and call the appropriate method on the listener.
*/
class U_COMMON_API ICUNotifier : public UMemory {
private: UVector* listeners;
-
-public:
+
+public:
ICUNotifier(void);
-
+
virtual ~ICUNotifier(void);
-
+
/**
* Add a listener to be notified when notifyChanged is called.
* The listener must not be null. AcceptsListener must return
* true for the listener. Attempts to concurrently
* register the identical listener more than once will be
- * silently ignored.
+ * silently ignored.
*/
virtual void addListener(const EventListener* l, UErrorCode& status);
-
+
/**
* Stop notifying this listener. The listener must
* not be null. Attemps to remove a listener that is
* not registered will be silently ignored.
*/
virtual void removeListener(const EventListener* l, UErrorCode& status);
-
+
/**
* ICU doesn't spawn its own threads. All listeners are notified in
* the thread of the caller. Misbehaved listeners can therefore
* indefinitely block the calling thread. Callers should beware of
- * deadlock situations.
+ * deadlock situations.
*/
virtual void notifyChanged(void);
-
-protected:
+
+protected:
/**
* Subclasses implement this to return TRUE if the listener is
* of the appropriate type.
*/
virtual UBool acceptsListener(const EventListener& l) const = 0;
-
+
/**
* Subclasses implement this to notify the listener.
*/
diff --git a/deps/icu-small/source/common/servrbf.cpp b/deps/icu-small/source/common/servrbf.cpp
index 3f143afadf62bb..94279ab3a1513b 100644
--- a/deps/icu-small/source/common/servrbf.cpp
+++ b/deps/icu-small/source/common/servrbf.cpp
@@ -92,3 +92,5 @@ U_NAMESPACE_END
/* !UCONFIG_NO_SERVICE */
#endif
+
+
diff --git a/deps/icu-small/source/common/servslkf.cpp b/deps/icu-small/source/common/servslkf.cpp
index 4aa10414a038d3..09154d1b9198e7 100644
--- a/deps/icu-small/source/common/servslkf.cpp
+++ b/deps/icu-small/source/common/servslkf.cpp
@@ -119,3 +119,5 @@ U_NAMESPACE_END
/* !UCONFIG_NO_SERVICE */
#endif
+
+
diff --git a/deps/icu-small/source/common/sharedobject.h b/deps/icu-small/source/common/sharedobject.h
index 878594c7ffa772..c0a5aba4782821 100644
--- a/deps/icu-small/source/common/sharedobject.h
+++ b/deps/icu-small/source/common/sharedobject.h
@@ -78,7 +78,7 @@ class U_COMMON_API SharedObject : public UObject {
* Decrements the number of hard references to this object, and
* arrange for possible cache-eviction and/or deletion if ref
* count goes to zero. Thread-safe.
- *
+ *
* Not for use from within the UnifiedCache implementation.
*/
void removeRef() const;
@@ -108,12 +108,12 @@ class U_COMMON_API SharedObject : public UObject {
*/
void deleteIfZeroRefCount() const;
-
+
/**
* Returns a writable version of ptr.
* If there is exactly one owner, then ptr itself is returned as a
* non-const pointer.
- * If there are multiple owners, then ptr is replaced with a
+ * If there are multiple owners, then ptr is replaced with a
* copy-constructed clone,
* and that is returned.
* Returns NULL if cloning failed.
@@ -136,7 +136,7 @@ class U_COMMON_API SharedObject : public UObject {
* Makes dest an owner of the object pointed to by src while adjusting
* reference counts and deleting the previous object dest pointed to
* if necessary. Before this call is made, dest must either be NULL or
- * be included in the reference count of the object it points to.
+ * be included in the reference count of the object it points to.
*
* T must be a subclass of SharedObject.
*/
@@ -174,7 +174,7 @@ class U_COMMON_API SharedObject : public UObject {
* Reference count, excluding references from within the UnifiedCache implementation.
*/
mutable u_atomic_int32_t hardRefCount;
-
+
mutable const UnifiedCacheBase *cachePtr;
};
diff --git a/deps/icu-small/source/common/sprpimpl.h b/deps/icu-small/source/common/sprpimpl.h
index 26de904b1fde5a..ca0bcdb51695cc 100644
--- a/deps/icu-small/source/common/sprpimpl.h
+++ b/deps/icu-small/source/common/sprpimpl.h
@@ -36,20 +36,20 @@
enum UStringPrepType{
USPREP_UNASSIGNED = 0x0000 ,
USPREP_MAP = 0x0001 ,
- USPREP_PROHIBITED = 0x0002 ,
+ USPREP_PROHIBITED = 0x0002 ,
USPREP_DELETE = 0x0003 ,
- USPREP_TYPE_LIMIT = 0x0004
+ USPREP_TYPE_LIMIT = 0x0004
};
typedef enum UStringPrepType UStringPrepType;
#ifdef USPREP_TYPE_NAMES_ARRAY
static const char* usprepTypeNames[] ={
- "UNASSIGNED" ,
- "MAP" ,
- "PROHIBITED" ,
+ "UNASSIGNED" ,
+ "MAP" ,
+ "PROHIBITED" ,
"DELETE",
- "TYPE_LIMIT"
+ "TYPE_LIMIT"
};
#endif
@@ -60,7 +60,7 @@ enum{
enum{
_SPREP_TYPE_THRESHOLD = 0xFFF0,
- _SPREP_MAX_INDEX_VALUE = 0x3FBF, /*16139*/
+ _SPREP_MAX_INDEX_VALUE = 0x3FBF, /*16139*/
_SPREP_MAX_INDEX_TOP_LENGTH = 0x0003
};
@@ -68,7 +68,7 @@ enum{
enum {
_SPREP_INDEX_TRIE_SIZE = 0, /* number of bytes in StringPrep trie */
_SPREP_INDEX_MAPPING_DATA_SIZE = 1, /* The array that contains the mapping */
- _SPREP_NORM_CORRECTNS_LAST_UNI_VERSION = 2, /* The index of Unicode version of last entry in NormalizationCorrections.txt */
+ _SPREP_NORM_CORRECTNS_LAST_UNI_VERSION = 2, /* The index of Unicode version of last entry in NormalizationCorrections.txt */
_SPREP_ONE_UCHAR_MAPPING_INDEX_START = 3, /* The starting index of 1 UChar mapping index in the mapping data array */
_SPREP_TWO_UCHARS_MAPPING_INDEX_START = 4, /* The starting index of 2 UChars mapping index in the mapping data array */
_SPREP_THREE_UCHARS_MAPPING_INDEX_START = 5, /* The starting index of 3 UChars mapping index in the mapping data array */
@@ -101,7 +101,7 @@ struct UStringPrepProfile{
* @internal
*/
U_CAPI void U_EXPORT2
-uprv_syntaxError(const UChar* rules,
+uprv_syntaxError(const UChar* rules,
int32_t pos,
int32_t rulesLen,
UParseError* parseError);
diff --git a/deps/icu-small/source/common/static_unicode_sets.h b/deps/icu-small/source/common/static_unicode_sets.h
index 9d8a5fcddc9953..5d90ce5908de98 100644
--- a/deps/icu-small/source/common/static_unicode_sets.h
+++ b/deps/icu-small/source/common/static_unicode_sets.h
@@ -83,9 +83,9 @@ enum Key {
*
* This method is always safe and OK to chain: in the case of a memory or other
* error, it returns an empty set from static memory.
- *
+ *
* Example:
- *
+ *
* UBool hasIgnorables = unisets::get(unisets::DEFAULT_IGNORABLES)->contains(...);
*
* @param key The desired UnicodeSet according to the enum in this file.
diff --git a/deps/icu-small/source/common/uarrsort.cpp b/deps/icu-small/source/common/uarrsort.cpp
index 03c4d4e7fc44aa..60905821649db9 100644
--- a/deps/icu-small/source/common/uarrsort.cpp
+++ b/deps/icu-small/source/common/uarrsort.cpp
@@ -34,6 +34,10 @@ enum {
STACK_ITEM_SIZE=200
};
+static constexpr int32_t sizeInMaxAlignTs(int32_t sizeInBytes) {
+ return (sizeInBytes + sizeof(max_align_t) - 1) / sizeof(max_align_t);
+}
+
/* UComparator convenience implementations ---------------------------------- */
U_CAPI int32_t U_EXPORT2
@@ -134,25 +138,15 @@ doInsertionSort(char *array, int32_t length, int32_t itemSize,
static void
insertionSort(char *array, int32_t length, int32_t itemSize,
UComparator *cmp, const void *context, UErrorCode *pErrorCode) {
- UAlignedMemory v[STACK_ITEM_SIZE/sizeof(UAlignedMemory)+1];
- void *pv;
- /* allocate an intermediate item variable (v) */
- if(itemSize<=STACK_ITEM_SIZE) {
- pv=v;
- } else {
- pv=uprv_malloc(itemSize);
- if(pv==NULL) {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return;
- }
+ icu::MaybeStackArray v;
+ if (sizeInMaxAlignTs(itemSize) > v.getCapacity() &&
+ v.resize(sizeInMaxAlignTs(itemSize)) == nullptr) {
+ *pErrorCode = U_MEMORY_ALLOCATION_ERROR;
+ return;
}
- doInsertionSort(array, length, itemSize, cmp, context, pv);
-
- if(pv!=v) {
- uprv_free(pv);
- }
+ doInsertionSort(array, length, itemSize, cmp, context, v.getAlias());
}
/* QuickSort ---------------------------------------------------------------- */
@@ -238,26 +232,16 @@ subQuickSort(char *array, int32_t start, int32_t limit, int32_t itemSize,
static void
quickSort(char *array, int32_t length, int32_t itemSize,
UComparator *cmp, const void *context, UErrorCode *pErrorCode) {
- UAlignedMemory xw[(2*STACK_ITEM_SIZE)/sizeof(UAlignedMemory)+1];
- void *p;
-
/* allocate two intermediate item variables (x and w) */
- if(itemSize<=STACK_ITEM_SIZE) {
- p=xw;
- } else {
- p=uprv_malloc(2*itemSize);
- if(p==NULL) {
- *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return;
- }
+ icu::MaybeStackArray xw;
+ if(sizeInMaxAlignTs(itemSize)*2 > xw.getCapacity() &&
+ xw.resize(sizeInMaxAlignTs(itemSize) * 2) == nullptr) {
+ *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
+ return;
}
- subQuickSort(array, 0, length, itemSize,
- cmp, context, p, (char *)p+itemSize);
-
- if(p!=xw) {
- uprv_free(p);
- }
+ subQuickSort(array, 0, length, itemSize, cmp, context,
+ xw.getAlias(), xw.getAlias() + sizeInMaxAlignTs(itemSize));
}
/* uprv_sortArray() API ----------------------------------------------------- */
diff --git a/deps/icu-small/source/common/ubidiimp.h b/deps/icu-small/source/common/ubidiimp.h
index a5d0727495d767..9746b2bc103102 100644
--- a/deps/icu-small/source/common/ubidiimp.h
+++ b/deps/icu-small/source/common/ubidiimp.h
@@ -198,8 +198,8 @@ typedef struct Run {
/* in a Run, logicalStart will get this bit set if the run level is odd */
#define INDEX_ODD_BIT (1UL<<31)
-#define MAKE_INDEX_ODD_PAIR(index, level) ((index)|((int32_t)(level)<<31))
-#define ADD_ODD_BIT_FROM_LEVEL(x, level) ((x)|=((int32_t)(level)<<31))
+#define MAKE_INDEX_ODD_PAIR(index, level) ((index)|((int32_t)((level)&1)<<31))
+#define ADD_ODD_BIT_FROM_LEVEL(x, level) ((x)|=((int32_t)((level)&1)<<31))
#define REMOVE_ODD_BIT(x) ((x)&=~INDEX_ODD_BIT)
#define GET_INDEX(x) ((x)&~INDEX_ODD_BIT)
@@ -387,41 +387,49 @@ typedef union {
} BidiMemoryForAllocation;
/* Macros for initial checks at function entry */
-#define RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrcode, retvalue) \
- if((pErrcode)==NULL || U_FAILURE(*pErrcode)) return retvalue
-#define RETURN_IF_NOT_VALID_PARA(bidi, errcode, retvalue) \
- if(!IS_VALID_PARA(bidi)) { \
- errcode=U_INVALID_STATE_ERROR; \
- return retvalue; \
- }
-#define RETURN_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode, retvalue) \
- if(!IS_VALID_PARA_OR_LINE(bidi)) { \
- errcode=U_INVALID_STATE_ERROR; \
- return retvalue; \
- }
-#define RETURN_IF_BAD_RANGE(arg, start, limit, errcode, retvalue) \
- if((arg)<(start) || (arg)>=(limit)) { \
- (errcode)=U_ILLEGAL_ARGUMENT_ERROR; \
- return retvalue; \
- }
-
-#define RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrcode) \
- if((pErrcode)==NULL || U_FAILURE(*pErrcode)) return
-#define RETURN_VOID_IF_NOT_VALID_PARA(bidi, errcode) \
- if(!IS_VALID_PARA(bidi)) { \
- errcode=U_INVALID_STATE_ERROR; \
- return; \
- }
-#define RETURN_VOID_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode) \
- if(!IS_VALID_PARA_OR_LINE(bidi)) { \
- errcode=U_INVALID_STATE_ERROR; \
- return; \
- }
-#define RETURN_VOID_IF_BAD_RANGE(arg, start, limit, errcode) \
- if((arg)<(start) || (arg)>=(limit)) { \
- (errcode)=U_ILLEGAL_ARGUMENT_ERROR; \
- return; \
- }
+#define RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \
+ if((pErrcode)==NULL || U_FAILURE(*pErrcode)) return retvalue; \
+} UPRV_BLOCK_MACRO_END
+#define RETURN_IF_NOT_VALID_PARA(bidi, errcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \
+ if(!IS_VALID_PARA(bidi)) { \
+ errcode=U_INVALID_STATE_ERROR; \
+ return retvalue; \
+ } \
+} UPRV_BLOCK_MACRO_END
+#define RETURN_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \
+ if(!IS_VALID_PARA_OR_LINE(bidi)) { \
+ errcode=U_INVALID_STATE_ERROR; \
+ return retvalue; \
+ } \
+} UPRV_BLOCK_MACRO_END
+#define RETURN_IF_BAD_RANGE(arg, start, limit, errcode, retvalue) UPRV_BLOCK_MACRO_BEGIN { \
+ if((arg)<(start) || (arg)>=(limit)) { \
+ (errcode)=U_ILLEGAL_ARGUMENT_ERROR; \
+ return retvalue; \
+ } \
+} UPRV_BLOCK_MACRO_END
+
+#define RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrcode) UPRV_BLOCK_MACRO_BEGIN { \
+ if((pErrcode)==NULL || U_FAILURE(*pErrcode)) return; \
+} UPRV_BLOCK_MACRO_END
+#define RETURN_VOID_IF_NOT_VALID_PARA(bidi, errcode) UPRV_BLOCK_MACRO_BEGIN { \
+ if(!IS_VALID_PARA(bidi)) { \
+ errcode=U_INVALID_STATE_ERROR; \
+ return; \
+ } \
+} UPRV_BLOCK_MACRO_END
+#define RETURN_VOID_IF_NOT_VALID_PARA_OR_LINE(bidi, errcode) UPRV_BLOCK_MACRO_BEGIN { \
+ if(!IS_VALID_PARA_OR_LINE(bidi)) { \
+ errcode=U_INVALID_STATE_ERROR; \
+ return; \
+ } \
+} UPRV_BLOCK_MACRO_END
+#define RETURN_VOID_IF_BAD_RANGE(arg, start, limit, errcode) UPRV_BLOCK_MACRO_BEGIN { \
+ if((arg)<(start) || (arg)>=(limit)) { \
+ (errcode)=U_ILLEGAL_ARGUMENT_ERROR; \
+ return; \
+ } \
+} UPRV_BLOCK_MACRO_END
/* helper function to (re)allocate memory if allowed */
U_CFUNC UBool
diff --git a/deps/icu-small/source/common/ubiditransform.cpp b/deps/icu-small/source/common/ubiditransform.cpp
index 394df6092d21b1..5b0d5cf96a4e03 100644
--- a/deps/icu-small/source/common/ubiditransform.cpp
+++ b/deps/icu-small/source/common/ubiditransform.cpp
@@ -31,11 +31,11 @@
#define SHAPE_LOGICAL U_SHAPE_TEXT_DIRECTION_LOGICAL
#define SHAPE_VISUAL U_SHAPE_TEXT_DIRECTION_VISUAL_LTR
-#define CHECK_LEN(STR, LEN, ERROR) { \
- if (LEN == 0) return 0; \
- if (LEN < -1) { *(ERROR) = U_ILLEGAL_ARGUMENT_ERROR; return 0; } \
- if (LEN == -1) LEN = u_strlen(STR); \
- }
+#define CHECK_LEN(STR, LEN, ERROR) UPRV_BLOCK_MACRO_BEGIN { \
+ if (LEN == 0) return 0; \
+ if (LEN < -1) { *(ERROR) = U_ILLEGAL_ARGUMENT_ERROR; return 0; } \
+ if (LEN == -1) LEN = u_strlen(STR); \
+} UPRV_BLOCK_MACRO_END
#define MAX_ACTIONS 7
@@ -118,7 +118,7 @@ ubiditransform_close(UBiDiTransform *pBiDiTransform)
/**
* Performs Bidi resolution of text.
- *
+ *
* @param pTransform Pointer to the UBiDiTransform
structure.
* @param pErrorCode Pointer to the error code value.
*
@@ -135,7 +135,7 @@ action_resolve(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
/**
* Performs basic reordering of text (Logical -> Visual LTR).
- *
+ *
* @param pTransform Pointer to the UBiDiTransform
structure.
* @param pErrorCode Pointer to the error code value.
*
@@ -155,7 +155,7 @@ action_reorder(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
/**
* Sets "inverse" mode on the UBiDi
object.
- *
+ *
* @param pTransform Pointer to the UBiDiTransform
structure.
* @param pErrorCode Pointer to the error code value.
*
@@ -174,7 +174,7 @@ action_setInverse(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
/**
* Sets "runs only" reordering mode indicating a Logical LTR <-> Logical RTL
* transformation.
- *
+ *
* @param pTransform Pointer to the UBiDiTransform
structure.
* @param pErrorCode Pointer to the error code value.
*
@@ -191,7 +191,7 @@ action_setRunsOnly(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
/**
* Performs string reverse.
- *
+ *
* @param pTransform Pointer to the UBiDiTransform
structure.
* @param pErrorCode Pointer to the error code value.
*
@@ -212,7 +212,7 @@ action_reverse(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
* Applies a new value to the text that serves as input at the current
* processing step. This value is identical to the original one when we begin
* the processing, but usually changes as the transformation progresses.
- *
+ *
* @param pTransform A pointer to the UBiDiTransform
structure.
* @param newSrc A pointer whose value is to be used as input text.
* @param newLength A length of the new text in UChar
s.
@@ -243,12 +243,12 @@ updateSrc(UBiDiTransform *pTransform, const UChar *newSrc, uint32_t newLength,
}
u_strncpy(pTransform->src, newSrc, newLength);
pTransform->srcLength = u_terminateUChars(pTransform->src,
- pTransform->srcSize, newLength, pErrorCode);
+ pTransform->srcSize, newLength, pErrorCode);
}
/**
* Calls a lower level shaping function.
- *
+ *
* @param pTransform Pointer to the UBiDiTransform
structure.
* @param options Shaping options.
* @param pErrorCode Pointer to the error code value.
@@ -263,7 +263,7 @@ doShape(UBiDiTransform *pTransform, uint32_t options, UErrorCode *pErrorCode)
/**
* Performs digit and letter shaping.
- *
+ *
* @param pTransform Pointer to the UBiDiTransform
structure.
* @param pErrorCode Pointer to the error code value.
*
@@ -293,7 +293,7 @@ action_shapeArabic(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
/**
* Performs character mirroring.
- *
+ *
* @param pTransform Pointer to the UBiDiTransform
structure.
* @param pErrorCode Pointer to the error code value.
*
@@ -314,10 +314,10 @@ action_mirror(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
}
do {
UBool isOdd = ubidi_getLevelAt(pTransform->pBidi, i) & 1;
- U16_NEXT(pTransform->src, i, pTransform->srcLength, c);
+ U16_NEXT(pTransform->src, i, pTransform->srcLength, c);
U16_APPEND_UNSAFE(pTransform->dest, j, isOdd ? u_charMirror(c) : c);
} while (i < pTransform->srcLength);
-
+
*pTransform->pDestLength = pTransform->srcLength;
pTransform->reorderingOptions = UBIDI_REORDER_DEFAULT;
return TRUE;
@@ -416,7 +416,7 @@ resolveBaseDirection(const UChar *text, uint32_t length,
/**
* Finds a valid ReorderingScheme
matching the
* caller-defined scheme.
- *
+ *
* @return A valid ReorderingScheme
object or NULL
*/
static const ReorderingScheme*
diff --git a/deps/icu-small/source/common/ucase.cpp b/deps/icu-small/source/common/ucase.cpp
index 50c8d20c1fce73..4ec25a27a503bb 100644
--- a/deps/icu-small/source/common/ucase.cpp
+++ b/deps/icu-small/source/common/ucase.cpp
@@ -116,7 +116,7 @@ static const uint8_t flagsOffset[256]={
* moved to the last uint16_t of the value, use +1 for beginning of next slot
* @param value (out) int32_t or uint32_t output if hasSlot, otherwise not modified
*/
-#define GET_SLOT_VALUE(excWord, idx, pExc16, value) \
+#define GET_SLOT_VALUE(excWord, idx, pExc16, value) UPRV_BLOCK_MACRO_BEGIN { \
if(((excWord)&UCASE_EXC_DOUBLE_SLOTS)==0) { \
(pExc16)+=SLOT_OFFSET(excWord, idx); \
(value)=*pExc16; \
@@ -124,7 +124,8 @@ static const uint8_t flagsOffset[256]={
(pExc16)+=2*SLOT_OFFSET(excWord, idx); \
(value)=*pExc16++; \
(value)=((value)<<16)|*pExc16; \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
/* simple case mappings ----------------------------------------------------- */
@@ -689,7 +690,7 @@ ucase_isCaseSensitive(UChar32 c) {
* - The general category of C is
* Nonspacing Mark (Mn), or Enclosing Mark (Me), or Format Control (Cf), or
* Letter Modifier (Lm), or Symbol Modifier (Sk)
- * - C is one of the following characters
+ * - C is one of the following characters
* U+0027 APOSTROPHE
* U+00AD SOFT HYPHEN (SHY)
* U+2019 RIGHT SINGLE QUOTATION MARK
@@ -1505,7 +1506,7 @@ U_CAPI UChar32 U_EXPORT2
u_tolower(UChar32 c) {
return ucase_tolower(c);
}
-
+
/* Transforms the Unicode character to its upper case equivalent.*/
U_CAPI UChar32 U_EXPORT2
u_toupper(UChar32 c) {
diff --git a/deps/icu-small/source/common/uchar.cpp b/deps/icu-small/source/common/uchar.cpp
index 60fe75c78dec03..b54cd626d10fb3 100644
--- a/deps/icu-small/source/common/uchar.cpp
+++ b/deps/icu-small/source/common/uchar.cpp
@@ -14,7 +14,7 @@
* 04/02/97 aliu Creation.
* 4/15/99 Madhu Updated all the function definitions for C Implementation
* 5/20/99 Madhu Added the function u_getVersion()
-* 8/19/1999 srl Upgraded scripts to Unicode3.0
+* 8/19/1999 srl Upgraded scripts to Unicode3.0
* 11/11/1999 weiv added u_isalnum(), cleaned comments
* 01/11/2000 helena Renamed u_getVersion to u_getUnicodeVersion.
* 06/20/2000 helena OS/400 port changes; mostly typecast.
@@ -40,7 +40,7 @@
/* constants and macros for access to the data ------------------------------ */
/* getting a uint32_t properties word from the data */
-#define GET_PROPS(c, result) ((result)=UTRIE2_GET16(&propsTrie, c));
+#define GET_PROPS(c, result) ((result)=UTRIE2_GET16(&propsTrie, c))
/* API functions ------------------------------------------------------------ */
diff --git a/deps/icu-small/source/common/uchriter.cpp b/deps/icu-small/source/common/uchriter.cpp
index 822168f5c8e600..bedbabc74c2351 100644
--- a/deps/icu-small/source/common/uchriter.cpp
+++ b/deps/icu-small/source/common/uchriter.cpp
@@ -89,7 +89,7 @@ UCharCharacterIterator::hashCode() const {
return ustr_hashUCharsN(text, textLength) ^ pos ^ begin ^ end;
}
-CharacterIterator*
+UCharCharacterIterator*
UCharCharacterIterator::clone() const {
return new UCharCharacterIterator(*this);
}
diff --git a/deps/icu-small/source/common/ucln_cmn.cpp b/deps/icu-small/source/common/ucln_cmn.cpp
index d78491df419fb0..f3e07c6b89183f 100644
--- a/deps/icu-small/source/common/ucln_cmn.cpp
+++ b/deps/icu-small/source/common/ucln_cmn.cpp
@@ -52,7 +52,7 @@ u_cleanup(void)
/*#endif*/
}
-U_CAPI void U_EXPORT2 ucln_cleanupOne(ECleanupLibraryType libType)
+U_CAPI void U_EXPORT2 ucln_cleanupOne(ECleanupLibraryType libType)
{
if (gLibCleanupFunctions[libType])
{
@@ -65,9 +65,20 @@ U_CFUNC void
ucln_common_registerCleanup(ECleanupCommonType type,
cleanupFunc *func)
{
+ // Thread safety messiness: From ticket 10295, calls to registerCleanup() may occur
+ // concurrently. Although such cases should be storing the same value, they raise errors
+ // from the thread sanity checker. Doing the store within a mutex avoids those.
+ // BUT that can trigger a recursive entry into std::call_once() in umutex.cpp when this code,
+ // running from the call_once function, tries to grab the ICU global mutex, which
+ // re-enters the mutex init path. So, work-around by special casing UCLN_COMMON_MUTEX, not
+ // using the ICU global mutex for it.
+ //
+ // No other point in ICU uses std::call_once().
+
U_ASSERT(UCLN_COMMON_START < type && type < UCLN_COMMON_COUNT);
- if (UCLN_COMMON_START < type && type < UCLN_COMMON_COUNT)
- {
+ if (type == UCLN_COMMON_MUTEX) {
+ gCommonCleanupFunctions[type] = func;
+ } else if (UCLN_COMMON_START < type && type < UCLN_COMMON_COUNT) {
icu::Mutex m; // See ticket 10295 for discussion.
gCommonCleanupFunctions[type] = func;
}
diff --git a/deps/icu-small/source/common/ucln_cmn.h b/deps/icu-small/source/common/ucln_cmn.h
index 0ca911b47d9875..b837fb946296a1 100644
--- a/deps/icu-small/source/common/ucln_cmn.h
+++ b/deps/icu-small/source/common/ucln_cmn.h
@@ -22,8 +22,6 @@
/* These are the cleanup functions for various APIs. */
/* @return true if cleanup complete successfully.*/
-U_CFUNC UBool umtx_cleanup(void);
-
U_CFUNC UBool utrace_cleanup(void);
U_CFUNC UBool ucln_lib_cleanup(void);
@@ -41,6 +39,8 @@ typedef enum ECleanupCommonType {
UCLN_COMMON_LOCALE_KEY_TYPE,
UCLN_COMMON_LOCALE,
UCLN_COMMON_LOCALE_AVAILABLE,
+ UCLN_COMMON_LIKELY_SUBTAGS,
+ UCLN_COMMON_LOCALE_DISTANCE,
UCLN_COMMON_ULOC,
UCLN_COMMON_CURRENCY,
UCLN_COMMON_LOADED_NORMALIZER2,
@@ -62,6 +62,7 @@ typedef enum ECleanupCommonType {
*/
UCLN_COMMON_UNIFIED_CACHE,
UCLN_COMMON_URES,
+ UCLN_COMMON_MUTEX, // Mutexes should be the last to be cleaned up.
UCLN_COMMON_COUNT /* This must be last */
} ECleanupCommonType;
diff --git a/deps/icu-small/source/common/ucln_imp.h b/deps/icu-small/source/common/ucln_imp.h
index 2e985669793b82..1bfcde0fb8eae2 100644
--- a/deps/icu-small/source/common/ucln_imp.h
+++ b/deps/icu-small/source/common/ucln_imp.h
@@ -113,13 +113,13 @@ U_CAPI void U_EXPORT2 UCLN_FINI ()
/* Windows: DllMain */
#elif U_PLATFORM_HAS_WIN32_API
-/*
+/*
* ICU's own DllMain.
*/
/* these are from putil.c */
/* READ READ READ READ! Are you getting compilation errors from windows.h?
- Any source file which includes this (ucln_imp.h) header MUST
+ Any source file which includes this (ucln_imp.h) header MUST
be defined with language extensions ON. */
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
@@ -168,7 +168,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
/* GCC - use __attribute((destructor)) */
static void ucln_destructor() __attribute__((destructor)) ;
-static void ucln_destructor()
+static void ucln_destructor()
{
UCLN_CLEAN_ME_UP;
}
diff --git a/deps/icu-small/source/common/ucmndata.h b/deps/icu-small/source/common/ucmndata.h
index 16844414327259..c3eba9f4d02102 100644
--- a/deps/icu-small/source/common/ucmndata.h
+++ b/deps/icu-small/source/common/ucmndata.h
@@ -98,12 +98,12 @@ U_CDECL_END
typedef struct {
LookupFn Lookup;
- NumEntriesFn NumEntries;
+ NumEntriesFn NumEntries;
} commonDataFuncs;
/*
- * Functions to check whether a UDataMemory refers to memory containing
+ * Functions to check whether a UDataMemory refers to memory containing
* a recognizable header and table of contents a Common Data Format
*
* If a valid header and TOC are found,
diff --git a/deps/icu-small/source/common/ucnv.cpp b/deps/icu-small/source/common/ucnv.cpp
index abf302eaddb7a8..856be708785796 100644
--- a/deps/icu-small/source/common/ucnv.cpp
+++ b/deps/icu-small/source/common/ucnv.cpp
@@ -25,6 +25,8 @@
#if !UCONFIG_NO_CONVERSION
+#include
+
#include "unicode/ustring.h"
#include "unicode/ucnv.h"
#include "unicode/ucnv_err.h"
@@ -81,7 +83,7 @@ ucnv_open (const char *name,
return r;
}
-U_CAPI UConverter* U_EXPORT2
+U_CAPI UConverter* U_EXPORT2
ucnv_openPackage (const char *packageName, const char *converterName, UErrorCode * err)
{
return ucnv_createConverterFromPackage(packageName, converterName, err);
@@ -148,7 +150,7 @@ ucnv_openCCSID (int32_t codepage,
return ucnv_createConverter(NULL, myName, err);
}
-/* Creating a temporary stack-based object that can be used in one thread,
+/* Creating a temporary stack-based object that can be used in one thread,
and created from a converter that is shared across threads.
*/
@@ -158,7 +160,6 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
UConverter *localConverter, *allocatedConverter;
int32_t stackBufferSize;
int32_t bufferSizeNeeded;
- char *stackBufferChars = (char *)stackBuffer;
UErrorCode cbErr;
UConverterToUnicodeArgs toUArgs = {
sizeof(UConverterToUnicodeArgs),
@@ -224,23 +225,22 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
}
}
-
- /* Pointers on 64-bit platforms need to be aligned
- * on a 64-bit boundary in memory.
+ /* Adjust (if necessary) the stackBuffer pointer to be aligned correctly for a UConverter.
+ * TODO(Jira ICU-20736) Redo this using std::align() once g++4.9 compatibility is no longer needed.
*/
- if (U_ALIGNMENT_OFFSET(stackBuffer) != 0) {
- int32_t offsetUp = (int32_t)U_ALIGNMENT_OFFSET_UP(stackBufferChars);
- if(stackBufferSize > offsetUp) {
- stackBufferSize -= offsetUp;
- stackBufferChars += offsetUp;
+ if (stackBuffer) {
+ uintptr_t p = reinterpret_cast(stackBuffer);
+ uintptr_t aligned_p = (p + alignof(UConverter) - 1) & ~(alignof(UConverter) - 1);
+ ptrdiff_t pointerAdjustment = aligned_p - p;
+ if (bufferSizeNeeded + pointerAdjustment <= stackBufferSize) {
+ stackBuffer = reinterpret_cast(aligned_p);
+ stackBufferSize -= pointerAdjustment;
} else {
/* prevent using the stack buffer but keep the size > 0 so that we do not just preflight */
stackBufferSize = 1;
}
}
- stackBuffer = (void *)stackBufferChars;
-
/* Now, see if we must allocate any memory */
if (stackBufferSize < bufferSizeNeeded || stackBuffer == NULL)
{
@@ -448,7 +448,7 @@ ucnv_setSubstChars (UConverter * converter,
{
if (U_FAILURE (*err))
return;
-
+
/*Makes sure that the subChar is within the codepages char length boundaries */
if ((len > converter->sharedData->staticData->maxBytesPerChar)
|| (len < converter->sharedData->staticData->minBytesPerChar))
@@ -456,7 +456,7 @@ ucnv_setSubstChars (UConverter * converter,
*err = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
-
+
uprv_memcpy (converter->subChars, mySubChar, len); /*copies the subchars */
converter->subCharLen = len; /*sets the new len */
@@ -466,7 +466,7 @@ ucnv_setSubstChars (UConverter * converter,
* we set subChar1 to 0.
*/
converter->subChar1 = 0;
-
+
return;
}
@@ -475,7 +475,7 @@ ucnv_setSubstString(UConverter *cnv,
const UChar *s,
int32_t length,
UErrorCode *err) {
- UAlignedMemory cloneBuffer[U_CNV_SAFECLONE_BUFFERSIZE / sizeof(UAlignedMemory) + 1];
+ alignas(UConverter) char cloneBuffer[U_CNV_SAFECLONE_BUFFERSIZE];
char chars[UCNV_ERROR_BUFFER_LENGTH];
UConverter *clone;
@@ -657,7 +657,7 @@ ucnv_getMinCharSize (const UConverter * converter)
U_CAPI const char* U_EXPORT2
ucnv_getName (const UConverter * converter, UErrorCode * err)
-
+
{
if (U_FAILURE (*err))
return NULL;
@@ -1226,7 +1226,7 @@ ucnv_fromUnicode(UConverter *cnv,
*err=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
-
+
/* output the target overflow buffer */
if( cnv->charErrorBufferLength>0 &&
ucnv_outputOverflowFromUnicode(cnv, target, targetLimit, &offsets, err)
@@ -1672,7 +1672,7 @@ ucnv_toUnicode(UConverter *cnv,
*err=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
-
+
/* output the target overflow buffer */
if( cnv->UCharErrorBufferLength>0 &&
ucnv_outputOverflowToUnicode(cnv, target, targetLimit, &offsets, err)
@@ -2083,7 +2083,7 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
-
+
if(pivotStart==NULL) {
if(!flush) {
/* streaming conversion requires an explicit pivot buffer */
@@ -2332,7 +2332,7 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
break;
}
}
-
+
/*
* toUnicode(source -> pivot);
*
@@ -2609,7 +2609,7 @@ ucnv_getType(const UConverter* converter)
}
U_CAPI void U_EXPORT2
-ucnv_getStarters(const UConverter* converter,
+ucnv_getStarters(const UConverter* converter,
UBool starters[256],
UErrorCode* err)
{
@@ -2652,8 +2652,8 @@ static const UAmbiguousConverter *ucnv_getAmbiguous(const UConverter *cnv)
}
U_CAPI void U_EXPORT2
-ucnv_fixFileSeparator(const UConverter *cnv,
- UChar* source,
+ucnv_fixFileSeparator(const UConverter *cnv,
+ UChar* source,
int32_t sourceLength) {
const UAmbiguousConverter *a;
int32_t i;
@@ -2751,7 +2751,7 @@ ucnv_detectUnicodeSignature( const char* source,
int32_t dummy;
/* initial 0xa5 bytes: make sure that if we read fromUChar32 > 0){
return 1;
}
- return 0;
+ return 0;
}
diff --git a/deps/icu-small/source/common/ucnv2022.cpp b/deps/icu-small/source/common/ucnv2022.cpp
index 4a35ff85e10fa0..dbc5bb7e07b2d6 100644
--- a/deps/icu-small/source/common/ucnv2022.cpp
+++ b/deps/icu-small/source/common/ucnv2022.cpp
@@ -1232,7 +1232,7 @@ _2022FromGR94DBCS(uint32_t value) {
/*
* This method does the reverse of _2022FromGR94DBCS(). Given the 2022 code point, it returns the
* 2 byte value that is in the range A1..FE for each byte. Otherwise it returns the 2022 code point
- * unchanged.
+ * unchanged.
*/
static inline uint32_t
_2022ToGR94DBCS(uint32_t value) {
@@ -3571,20 +3571,11 @@ _ISO_2022_WriteSub(UConverterFromUnicodeArgs *args, int32_t offsetIndex, UErrorC
/*
* Structure for cloning an ISO 2022 converter into a single memory block.
- * ucnv_safeClone() of the converter will align the entire cloneStruct,
- * and then ucnv_safeClone() of the sub-converter may additionally align
- * currentConverter inside the cloneStruct, for which we need the deadSpace
- * after currentConverter.
- * This is because UAlignedMemory may be larger than the actually
- * necessary alignment size for the platform.
- * The other cloneStruct fields will not be moved around,
- * and are aligned properly with cloneStruct's alignment.
*/
struct cloneStruct
{
UConverter cnv;
UConverter currentConverter;
- UAlignedMemory deadSpace;
UConverterDataISO2022 mydata;
};
@@ -3602,6 +3593,10 @@ _ISO_2022_SafeClone(
UConverterDataISO2022 *cnvData;
int32_t i, size;
+ if (U_FAILURE(*status)){
+ return nullptr;
+ }
+
if (*pBufferSize == 0) { /* 'preflighting' request - set needed size into *pBufferSize */
*pBufferSize = (int32_t)sizeof(struct cloneStruct);
return NULL;
@@ -3619,7 +3614,7 @@ _ISO_2022_SafeClone(
/* share the subconverters */
if(cnvData->currentConverter != NULL) {
- size = (int32_t)(sizeof(UConverter) + sizeof(UAlignedMemory)); /* include size of padding */
+ size = (int32_t)sizeof(UConverter);
localClone->mydata.currentConverter =
ucnv_safeClone(cnvData->currentConverter,
&localClone->currentConverter,
diff --git a/deps/icu-small/source/common/ucnv_bld.cpp b/deps/icu-small/source/common/ucnv_bld.cpp
index e6ef833f4e4317..56fc3d6822f74f 100644
--- a/deps/icu-small/source/common/ucnv_bld.cpp
+++ b/deps/icu-small/source/common/ucnv_bld.cpp
@@ -194,10 +194,7 @@ static struct {
/*initializes some global variables */
static UHashtable *SHARED_DATA_HASHTABLE = NULL;
-static icu::UMutex *cnvCacheMutex() { /* Mutex for synchronizing cnv cache access. */
- static icu::UMutex m = U_MUTEX_INITIALIZER;
- return &m;
-}
+static icu::UMutex cnvCacheMutex;
/* Note: the global mutex is used for */
/* reference count updates. */
@@ -227,7 +224,7 @@ static UBool gDefaultConverterContainsOption;
static const char DATA_TYPE[] = "cnv";
/* ucnv_flushAvailableConverterCache. This is only called from ucnv_cleanup().
- * If it is ever to be called from elsewhere, synchronization
+ * If it is ever to be called from elsewhere, synchronization
* will need to be considered.
*/
static void
@@ -602,9 +599,9 @@ U_CFUNC void
ucnv_unloadSharedDataIfReady(UConverterSharedData *sharedData)
{
if(sharedData != NULL && sharedData->isReferenceCounted) {
- umtx_lock(cnvCacheMutex());
+ umtx_lock(&cnvCacheMutex);
ucnv_unload(sharedData);
- umtx_unlock(cnvCacheMutex());
+ umtx_unlock(&cnvCacheMutex);
}
}
@@ -612,9 +609,9 @@ U_CFUNC void
ucnv_incrementRefCount(UConverterSharedData *sharedData)
{
if(sharedData != NULL && sharedData->isReferenceCounted) {
- umtx_lock(cnvCacheMutex());
+ umtx_lock(&cnvCacheMutex);
sharedData->referenceCounter++;
- umtx_unlock(cnvCacheMutex());
+ umtx_unlock(&cnvCacheMutex);
}
}
@@ -815,9 +812,9 @@ ucnv_loadSharedData(const char *converterName,
pArgs->nestedLoads=1;
pArgs->pkg=NULL;
- umtx_lock(cnvCacheMutex());
+ umtx_lock(&cnvCacheMutex);
mySharedConverterData = ucnv_load(pArgs, err);
- umtx_unlock(cnvCacheMutex());
+ umtx_unlock(&cnvCacheMutex);
if (U_FAILURE (*err) || (mySharedConverterData == NULL))
{
return NULL;
@@ -1064,7 +1061,7 @@ ucnv_flushCache ()
* because the sequence of looking up in the cache + incrementing
* is protected by cnvCacheMutex.
*/
- umtx_lock(cnvCacheMutex());
+ umtx_lock(&cnvCacheMutex);
/*
* double loop: A delta/extension-only converter has a pointer to its base table's
* shared data; the first iteration of the outer loop may see the delta converter
@@ -1093,7 +1090,7 @@ ucnv_flushCache ()
}
}
} while(++i == 1 && remaining > 0);
- umtx_unlock(cnvCacheMutex());
+ umtx_unlock(&cnvCacheMutex);
UTRACE_DATA1(UTRACE_INFO, "ucnv_flushCache() exits with %d converters remaining", remaining);
@@ -1199,7 +1196,7 @@ internalSetName(const char *name, UErrorCode *status) {
}
algorithmicSharedData = getAlgorithmicTypeFromName(stackArgs.name);
- umtx_lock(cnvCacheMutex());
+ umtx_lock(&cnvCacheMutex);
gDefaultAlgorithmicSharedData = algorithmicSharedData;
gDefaultConverterContainsOption = containsOption;
@@ -1215,7 +1212,7 @@ internalSetName(const char *name, UErrorCode *status) {
ucnv_enableCleanup();
- umtx_unlock(cnvCacheMutex());
+ umtx_unlock(&cnvCacheMutex);
}
#endif
@@ -1240,7 +1237,7 @@ ucnv_getDefaultName() {
but ucnv_setDefaultName is not thread safe.
*/
{
- icu::Mutex lock(cnvCacheMutex());
+ icu::Mutex lock(&cnvCacheMutex);
name = gDefaultConverterName;
}
if(name==NULL) {
@@ -1312,7 +1309,7 @@ ucnv_setDefaultName(const char *converterName) {
/* The close may make the current name go away. */
ucnv_close(cnv);
-
+
/* reset the converter cache */
u_flushDefaultConverter();
}
diff --git a/deps/icu-small/source/common/ucnv_bld.h b/deps/icu-small/source/common/ucnv_bld.h
index caa263f56d938b..18b3795e4d8b13 100644
--- a/deps/icu-small/source/common/ucnv_bld.h
+++ b/deps/icu-small/source/common/ucnv_bld.h
@@ -66,8 +66,8 @@ typedef struct UConverterImpl UConverterImpl;
typedef struct UConverterStaticData { /* +offset: size */
uint32_t structSize; /* +0: 4 Size of this structure */
-
- char name
+
+ char name
[UCNV_MAX_CONVERTER_NAME_LENGTH]; /* +4: 60 internal name of the converter- invariant chars */
int32_t codepage; /* +64: 4 codepage # (now IBM-$codepage) */
@@ -80,7 +80,7 @@ typedef struct UConverterStaticData { /* +offset: size */
uint8_t subChar[UCNV_MAX_SUBCHAR_LEN]; /* +72: 4 [note: 4 and 8 byte boundary] */
int8_t subCharLen; /* +76: 1 */
-
+
uint8_t hasToUnicodeFallback; /* +77: 1 UBool needs to be changed to UBool to be consistent across platform */
uint8_t hasFromUnicodeFallback; /* +78: 1 */
uint8_t unicodeMask; /* +79: 1 bit 0: has supplementary bit 1: has single surrogates */
diff --git a/deps/icu-small/source/common/ucnv_cnv.h b/deps/icu-small/source/common/ucnv_cnv.h
index a996e2959784cf..2eed2c60df60c3 100644
--- a/deps/icu-small/source/common/ucnv_cnv.h
+++ b/deps/icu-small/source/common/ucnv_cnv.h
@@ -154,7 +154,7 @@ typedef void (*UConverterGetStarters)(const UConverter* converter,
UErrorCode *pErrorCode);
/* If this function pointer is null or if the function returns null
- * the name field in static data struct should be returned by
+ * the name field in static data struct should be returned by
* ucnv_getName() API function
*/
typedef const char * (*UConverterGetName) (const UConverter *cnv);
@@ -177,9 +177,9 @@ typedef void (*UConverterWriteSub) (UConverterFromUnicodeArgs *pArgs, int32_t of
* the initial state of the converter. It is not expected to increment the
* reference counts of the standard data types such as the shared data.
*/
-typedef UConverter * (*UConverterSafeClone) (const UConverter *cnv,
+typedef UConverter * (*UConverterSafeClone) (const UConverter *cnv,
void *stackBuffer,
- int32_t *pBufferSize,
+ int32_t *pBufferSize,
UErrorCode *status);
/**
@@ -258,7 +258,7 @@ struct UConverterImpl {
extern const UConverterSharedData
_MBCSData, _Latin1Data,
_UTF8Data, _UTF16BEData, _UTF16LEData, _UTF32BEData, _UTF32LEData,
- _ISO2022Data,
+ _ISO2022Data,
_LMBCSData1,_LMBCSData2, _LMBCSData3, _LMBCSData4, _LMBCSData5, _LMBCSData6,
_LMBCSData8,_LMBCSData11,_LMBCSData16,_LMBCSData17,_LMBCSData18,_LMBCSData19,
_HZData,_ISCIIData, _SCSUData, _ASCIIData,
diff --git a/deps/icu-small/source/common/ucnv_err.cpp b/deps/icu-small/source/common/ucnv_err.cpp
index 63794d2334f62b..6b738face5e7fb 100644
--- a/deps/icu-small/source/common/ucnv_err.cpp
+++ b/deps/icu-small/source/common/ucnv_err.cpp
@@ -129,7 +129,7 @@ UCNV_TO_U_CALLBACK_STOP (
}
U_CAPI void U_EXPORT2
-UCNV_FROM_U_CALLBACK_SKIP (
+UCNV_FROM_U_CALLBACK_SKIP (
const void *context,
UConverterFromUnicodeArgs *fromUArgs,
const UChar* codeUnits,
@@ -217,7 +217,7 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
UConverterFromUCallback ignoredCallback = NULL;
const void *ignoredContext;
-
+
if (reason > UCNV_IRREGULAR)
{
return;
@@ -237,14 +237,14 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
&original,
&originalContext,
&err2);
-
+
if (U_FAILURE (err2))
{
*err = err2;
return;
- }
+ }
if(context==NULL)
- {
+ {
while (i < length)
{
valueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
@@ -334,7 +334,7 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[i++], 16, 4);
}
}
- }
+ }
myValueSource = valueString;
/* reset the error */
@@ -427,7 +427,7 @@ UCNV_TO_U_CALLBACK_ESCAPE (
}
if(context==NULL)
- {
+ {
while (i < length)
{
uniValueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
diff --git a/deps/icu-small/source/common/ucnv_ext.h b/deps/icu-small/source/common/ucnv_ext.h
index 7b753ac217d8d5..dceea7ef12617a 100644
--- a/deps/icu-small/source/common/ucnv_ext.h
+++ b/deps/icu-small/source/common/ucnv_ext.h
@@ -248,7 +248,7 @@
* the result bytes in fromUBytes[]; (0 indexes fromUBytes[0])
* }
* }
- *
+ *
* The first pair in a section contains the number of following pairs in the
* UChar position (16 bits, number=1..0xffff).
* The value of the initial pair is used when the current UChar is not found
diff --git a/deps/icu-small/source/common/ucnv_io.cpp b/deps/icu-small/source/common/ucnv_io.cpp
index d9e91314ed5347..7a95a3f1e61dd7 100644
--- a/deps/icu-small/source/common/ucnv_io.cpp
+++ b/deps/icu-small/source/common/ucnv_io.cpp
@@ -10,7 +10,7 @@
*
*
* ucnv_io.cpp:
-* initializes global variables and defines functions pertaining to converter
+* initializes global variables and defines functions pertaining to converter
* name resolution aspect of the conversion code.
*
* new implementation:
diff --git a/deps/icu-small/source/common/ucnv_lmb.cpp b/deps/icu-small/source/common/ucnv_lmb.cpp
index 6dd8e83428a0af..168392837b5459 100644
--- a/deps/icu-small/source/common/ucnv_lmb.cpp
+++ b/deps/icu-small/source/common/ucnv_lmb.cpp
@@ -1,6 +1,6 @@
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
-/*
+/*
**********************************************************************
* Copyright (C) 2000-2016, International Business Machines
* Corporation and others. All Rights Reserved.
@@ -15,9 +15,9 @@
* extensively hacked up by: Jim Snyder-Grant
*
* Modification History:
-*
+*
* Date Name Description
-*
+*
* 06/20/2000 helena OS/400 port changes; mostly typecast.
* 06/27/2000 Jim Snyder-Grant Deal with partial characters and small buffers.
* Add comments to document LMBCS format and implementation
@@ -48,16 +48,16 @@
(Lotus Multi-Byte Character Set)
- LMBCS was invented in the late 1980's and is primarily used in Lotus Notes
- databases and in Lotus 1-2-3 files. Programmers who work with the APIs
+ LMBCS was invented in the late 1980's and is primarily used in Lotus Notes
+ databases and in Lotus 1-2-3 files. Programmers who work with the APIs
into these products will sometimes need to deal with strings in this format.
- The code in this file provides an implementation for an ICU converter of
- LMBCS to and from Unicode.
+ The code in this file provides an implementation for an ICU converter of
+ LMBCS to and from Unicode.
- Since the LMBCS character set is only sparsely documented in existing
- printed or online material, we have added extensive annotation to this
- file to serve as a guide to understanding LMBCS.
+ Since the LMBCS character set is only sparsely documented in existing
+ printed or online material, we have added extensive annotation to this
+ file to serve as a guide to understanding LMBCS.
LMBCS was originally designed with these four sometimes-competing design goals:
@@ -69,11 +69,11 @@
All of the national character sets LMBCS was trying to encode are 'ANSI'
- based, in that the bytes from 0x20 - 0x7F are almost exactly the
- same common Latin unaccented characters and symbols in all character sets.
+ based, in that the bytes from 0x20 - 0x7F are almost exactly the
+ same common Latin unaccented characters and symbols in all character sets.
- So, in order to help meet the speed & memory design goals, the common ANSI
- bytes from 0x20-0x7F are represented by the same single-byte values in LMBCS.
+ So, in order to help meet the speed & memory design goals, the common ANSI
+ bytes from 0x20-0x7F are represented by the same single-byte values in LMBCS.
The general LMBCS code unit is from 1-3 bytes. We can describe the 3 bytes as
follows:
@@ -86,21 +86,21 @@
#define ULMBCS_CHARSIZE_MAX 3
/*
The single-byte values from 0x20 to 0x7F are examples of single D1 bytes.
- We often have to figure out if byte values are below or above this, so we
- use the ANSI nomenclature 'C0' and 'C1' to refer to the range of control
+ We often have to figure out if byte values are below or above this, so we
+ use the ANSI nomenclature 'C0' and 'C1' to refer to the range of control
characters just above & below the common lower-ANSI range */
-#define ULMBCS_C0END 0x1F
-#define ULMBCS_C1START 0x80
+#define ULMBCS_C0END 0x1F
+#define ULMBCS_C1START 0x80
/*
- Since LMBCS is always dealing in byte units. we create a local type here for
+ Since LMBCS is always dealing in byte units. we create a local type here for
dealing with these units of LMBCS code units:
-*/
+*/
typedef uint8_t ulmbcs_byte_t;
-/*
- Most of the values less than 0x20 are reserved in LMBCS to announce
- which national character standard is being used for the 'D' bytes.
+/*
+ Most of the values less than 0x20 are reserved in LMBCS to announce
+ which national character standard is being used for the 'D' bytes.
In the comments we show the common name and the IBM character-set ID
for these character-set announcers:
*/
@@ -119,105 +119,105 @@ typedef uint8_t ulmbcs_byte_t;
#define ULMBCS_GRP_CN 0x13 /* Chinese TC :ibm-1386 */
/*
- So, the beginning of understanding LMBCS is that IF the first byte of a LMBCS
- character is one of those 12 values, you can interpret the remaining bytes of
- that character as coming from one of those character sets. Since the lower
- ANSI bytes already are represented in single bytes, using one of the character
- set announcers is used to announce a character that starts with a byte of
+ So, the beginning of understanding LMBCS is that IF the first byte of a LMBCS
+ character is one of those 12 values, you can interpret the remaining bytes of
+ that character as coming from one of those character sets. Since the lower
+ ANSI bytes already are represented in single bytes, using one of the character
+ set announcers is used to announce a character that starts with a byte of
0x80 or greater.
- The character sets are arranged so that the single byte sets all appear
- before the multi-byte character sets. When we need to tell whether a
+ The character sets are arranged so that the single byte sets all appear
+ before the multi-byte character sets. When we need to tell whether a
group byte is for a single byte char set or not we use this define: */
-#define ULMBCS_DOUBLEOPTGROUP_START 0x10
+#define ULMBCS_DOUBLEOPTGROUP_START 0x10
-/*
-However, to fully understand LMBCS, you must also understand a series of
-exceptions & optimizations made in service of the design goals.
+/*
+However, to fully understand LMBCS, you must also understand a series of
+exceptions & optimizations made in service of the design goals.
First, those of you who are character set mavens may have noticed that
-the 'double-byte' character sets are actually multi-byte character sets
+the 'double-byte' character sets are actually multi-byte character sets
that can have 1 or two bytes, even in the upper-ascii range. To force
-each group byte to introduce a fixed-width encoding (to make it faster to
-count characters), we use a convention of doubling up on the group byte
+each group byte to introduce a fixed-width encoding (to make it faster to
+count characters), we use a convention of doubling up on the group byte
to introduce any single-byte character > 0x80 in an otherwise double-byte
-character set. So, for example, the LMBCS sequence x10 x10 xAE is the
+character set. So, for example, the LMBCS sequence x10 x10 xAE is the
same as '0xAE' in the Japanese code page 943.
-Next, you will notice that the list of group bytes has some gaps.
+Next, you will notice that the list of group bytes has some gaps.
These are used in various ways.
-We reserve a few special single byte values for common control
+We reserve a few special single byte values for common control
characters. These are in the same place as their ANSI eqivalents for speed.
*/
-
+
#define ULMBCS_HT 0x09 /* Fixed control char - Horizontal Tab */
#define ULMBCS_LF 0x0A /* Fixed control char - Line Feed */
#define ULMBCS_CR 0x0D /* Fixed control char - Carriage Return */
-/* Then, 1-2-3 reserved a special single-byte character to put at the
+/* Then, 1-2-3 reserved a special single-byte character to put at the
beginning of internal 'system' range names: */
-#define ULMBCS_123SYSTEMRANGE 0x19
+#define ULMBCS_123SYSTEMRANGE 0x19
-/* Then we needed a place to put all the other ansi control characters
-that must be moved to different values because LMBCS reserves those
-values for other purposes. To represent the control characters, we start
-with a first byte of 0xF & add the control chaarcter value as the
+/* Then we needed a place to put all the other ansi control characters
+that must be moved to different values because LMBCS reserves those
+values for other purposes. To represent the control characters, we start
+with a first byte of 0xF & add the control chaarcter value as the
second byte */
-#define ULMBCS_GRP_CTRL 0x0F
+#define ULMBCS_GRP_CTRL 0x0F
-/* For the C0 controls (less than 0x20), we add 0x20 to preserve the
-useful doctrine that any byte less than 0x20 in a LMBCS char must be
+/* For the C0 controls (less than 0x20), we add 0x20 to preserve the
+useful doctrine that any byte less than 0x20 in a LMBCS char must be
the first byte of a character:*/
-#define ULMBCS_CTRLOFFSET 0x20
+#define ULMBCS_CTRLOFFSET 0x20
-/*
-Where to put the characters that aren't part of any of the 12 national
-character sets? The first thing that was done, in the earlier years of
+/*
+Where to put the characters that aren't part of any of the 12 national
+character sets? The first thing that was done, in the earlier years of
LMBCS, was to use up the spaces of the form
- [G] D1,
-
+ [G] D1,
+
where 'G' was one of the single-byte character groups, and
- D1 was less than 0x80. These sequences are gathered together
- into a Lotus-invented doublebyte character set to represent a
- lot of stray values. Internally, in this implementation, we track this
+ D1 was less than 0x80. These sequences are gathered together
+ into a Lotus-invented doublebyte character set to represent a
+ lot of stray values. Internally, in this implementation, we track this
as group '0', as a place to tuck this exceptions list.*/
-#define ULMBCS_GRP_EXCEPT 0x00
+#define ULMBCS_GRP_EXCEPT 0x00
/*
- Finally, as the durability and usefulness of UNICODE became clear,
- LOTUS added a new group 0x14 to hold Unicode values not otherwise
+ Finally, as the durability and usefulness of UNICODE became clear,
+ LOTUS added a new group 0x14 to hold Unicode values not otherwise
represented in LMBCS: */
-#define ULMBCS_GRP_UNICODE 0x14
+#define ULMBCS_GRP_UNICODE 0x14
/* The two bytes appearing after a 0x14 are intrepreted as UFT-16 BE
-(Big-Endian) characters. The exception comes when the UTF16
+(Big-Endian) characters. The exception comes when the UTF16
representation would have a zero as the second byte. In that case,
-'F6' is used in its place, and the bytes are swapped. (This prevents
+'F6' is used in its place, and the bytes are swapped. (This prevents
LMBCS from encoding any Unicode values of the form U+F6xx, but that's OK:
0xF6xx is in the middle of the Private Use Area.)*/
-#define ULMBCS_UNICOMPATZERO 0xF6
+#define ULMBCS_UNICOMPATZERO 0xF6
-/* It is also useful in our code to have a constant for the size of
+/* It is also useful in our code to have a constant for the size of
a LMBCS char that holds a literal Unicode value */
-#define ULMBCS_UNICODE_SIZE 3
+#define ULMBCS_UNICODE_SIZE 3
-/*
-To squish the LMBCS representations down even further, and to make
-translations even faster,sometimes the optimization group byte can be dropped
-from a LMBCS character. This is decided on a process-by-process basis. The
+/*
+To squish the LMBCS representations down even further, and to make
+translations even faster,sometimes the optimization group byte can be dropped
+from a LMBCS character. This is decided on a process-by-process basis. The
group byte that is dropped is called the 'optimization group'.
For Notes, the optimzation group is always 0x1.*/
-#define ULMBCS_DEFAULTOPTGROUP 0x1
-/* For 1-2-3 files, the optimzation group is stored in the header of the 1-2-3
-file.
+#define ULMBCS_DEFAULTOPTGROUP 0x1
+/* For 1-2-3 files, the optimzation group is stored in the header of the 1-2-3
+file.
- In any case, when using ICU, you either pass in the
-optimization group as part of the name of the converter (LMBCS-1, LMBCS-2,
-etc.). Using plain 'LMBCS' as the name of the converter will give you
+ In any case, when using ICU, you either pass in the
+optimization group as part of the name of the converter (LMBCS-1, LMBCS-2,
+etc.). Using plain 'LMBCS' as the name of the converter will give you
LMBCS-1.
@@ -228,7 +228,7 @@ Because of the extensive use of other character sets, the LMBCS converter
keeps a mapping between optimization groups and IBM character sets, so that
ICU converters can be created and used as needed. */
-/* As you can see, even though any byte below 0x20 could be an optimization
+/* As you can see, even though any byte below 0x20 could be an optimization
byte, only those at 0x13 or below can map to an actual converter. To limit
some loops and searches, we define a value for that last group converter:*/
@@ -257,12 +257,12 @@ static const char * const OptGroupByteToCPName[ULMBCS_GRP_LAST + 1] = {
/* 0x0013 */ "windows-936"
/* The rest are null, including the 0x0014 Unicode compatibility region
- and 0x0019, the 1-2-3 system range control char */
+ and 0x0019, the 1-2-3 system range control char */
};
-/* That's approximately all the data that's needed for translating
- LMBCS to Unicode.
+/* That's approximately all the data that's needed for translating
+ LMBCS to Unicode.
However, to translate Unicode to LMBCS, we need some more support.
@@ -270,18 +270,18 @@ However, to translate Unicode to LMBCS, we need some more support.
That's because there are often more than one possible mappings from a Unicode
code point back into LMBCS. The first thing we do is look up into a table
to figure out if there are more than one possible mappings. This table,
-arranged by Unicode values (including ranges) either lists which group
+arranged by Unicode values (including ranges) either lists which group
to use, or says that it could go into one or more of the SBCS sets, or
-into one or more of the DBCS sets. (If the character exists in both DBCS &
-SBCS, the table will place it in the SBCS sets, to make the LMBCS code point
+into one or more of the DBCS sets. (If the character exists in both DBCS &
+SBCS, the table will place it in the SBCS sets, to make the LMBCS code point
length as small as possible. Here's the two special markers we use to indicate
ambiguous mappings: */
-#define ULMBCS_AMBIGUOUS_SBCS 0x80 /* could fit in more than one
- LMBCS sbcs native encoding
+#define ULMBCS_AMBIGUOUS_SBCS 0x80 /* could fit in more than one
+ LMBCS sbcs native encoding
(example: most accented latin) */
-#define ULMBCS_AMBIGUOUS_MBCS 0x81 /* could fit in more than one
- LMBCS mbcs native encoding
+#define ULMBCS_AMBIGUOUS_MBCS 0x81 /* could fit in more than one
+ LMBCS mbcs native encoding
(example: Unihan) */
#define ULMBCS_AMBIGUOUS_ALL 0x82
/* And here's a simple way to see if a group falls in an appropriate range */
@@ -296,7 +296,7 @@ ambiguous mappings: */
/* The table & some code to use it: */
-static const struct _UniLMBCSGrpMap
+static const struct _UniLMBCSGrpMap
{
const UChar uniStartRange;
const UChar uniEndRange;
@@ -443,29 +443,29 @@ static const struct _UniLMBCSGrpMap
{0xFF01, 0xFFEE, ULMBCS_AMBIGUOUS_MBCS},
{0xFFFF, 0xFFFF, ULMBCS_GRP_UNICODE}
};
-
-static ulmbcs_byte_t
+
+static ulmbcs_byte_t
FindLMBCSUniRange(UChar uniChar)
{
const struct _UniLMBCSGrpMap * pTable = UniLMBCSGrpMap;
- while (uniChar > pTable->uniEndRange)
+ while (uniChar > pTable->uniEndRange)
{
pTable++;
}
- if (uniChar >= pTable->uniStartRange)
+ if (uniChar >= pTable->uniStartRange)
{
return pTable->GrpType;
}
return ULMBCS_GRP_UNICODE;
}
-/*
-We also ask the creator of a converter to send in a preferred locale
+/*
+We also ask the creator of a converter to send in a preferred locale
that we can use in resolving ambiguous mappings. They send the locale
-in as a string, and we map it, if possible, to one of the
-LMBCS groups. We use this table, and the associated code, to
+in as a string, and we map it, if possible, to one of the
+LMBCS groups. We use this table, and the associated code, to
do the lookup: */
/**************************************************
@@ -534,12 +534,12 @@ static const struct _LocaleLMBCSGrpMap
};
-static ulmbcs_byte_t
+static ulmbcs_byte_t
FindLMBCSLocale(const char *LocaleID)
{
const struct _LocaleLMBCSGrpMap *pTable = LocaleLMBCSGrpMap;
- if ((!LocaleID) || (!*LocaleID))
+ if ((!LocaleID) || (!*LocaleID))
{
return 0;
}
@@ -561,16 +561,16 @@ FindLMBCSLocale(const char *LocaleID)
}
-/*
- Before we get to the main body of code, here's how we hook up to the rest
- of ICU. ICU converters are required to define a structure that includes
+/*
+ Before we get to the main body of code, here's how we hook up to the rest
+ of ICU. ICU converters are required to define a structure that includes
some function pointers, and some common data, in the style of a C++
vtable. There is also room in there for converter-specific data. LMBCS
uses that converter-specific data to keep track of the 12 subconverters
- we use, the optimization group, and the group (if any) that matches the
+ we use, the optimization group, and the group (if any) that matches the
locale. We have one structure instantiated for each of the 12 possible
- optimization groups. To avoid typos & to avoid boring the reader, we
- put the declarations of these structures and functions into macros. To see
+ optimization groups. To avoid typos & to avoid boring the reader, we
+ put the declarations of these structures and functions into macros. To see
the definitions of these structures, see unicode\ucnv_bld.h
*/
@@ -617,7 +617,7 @@ const UConverterSharedData _LMBCSData##n= \
/* The only function we needed to duplicate 12 times was the 'open'
function, which will do basically the same thing except set a different
-optimization group. So, we put the common stuff into a worker function,
+optimization group. So, we put the common stuff into a worker function,
and set up another macro to stamp out the 12 open functions:*/
#define DEFINE_LMBCS_OPEN(n) \
static void U_CALLCONV \
@@ -627,7 +627,7 @@ static void U_CALLCONV \
/* Here's the open worker & the common close function */
-static void
+static void
_LMBCSOpenWorker(UConverter* _this,
UConverterLoadArgs *pArgs,
UErrorCode* err,
@@ -645,7 +645,7 @@ _LMBCSOpenWorker(UConverter* _this,
stackArgs.onlyTestIsLoadable = pArgs->onlyTestIsLoadable;
- for (i=0; i <= ULMBCS_GRP_LAST && U_SUCCESS(*err); i++)
+ for (i=0; i <= ULMBCS_GRP_LAST && U_SUCCESS(*err); i++)
{
if(OptGroupByteToCPName[i] != NULL) {
extraInfo->OptGrpConverter[i] = ucnv_loadSharedData(OptGroupByteToCPName[i], &stackPieces, &stackArgs, err);
@@ -667,7 +667,7 @@ _LMBCSOpenWorker(UConverter* _this,
U_CDECL_BEGIN
static void U_CALLCONV
-_LMBCSClose(UConverter * _this)
+_LMBCSClose(UConverter * _this)
{
if (_this->extraInfo != NULL)
{
@@ -692,9 +692,9 @@ typedef struct LMBCSClone {
} LMBCSClone;
static UConverter * U_CALLCONV
-_LMBCSSafeClone(const UConverter *cnv,
- void *stackBuffer,
- int32_t *pBufferSize,
+_LMBCSSafeClone(const UConverter *cnv,
+ void *stackBuffer,
+ int32_t *pBufferSize,
UErrorCode *status) {
(void)status;
LMBCSClone *newLMBCS;
@@ -736,10 +736,10 @@ _LMBCSSafeClone(const UConverter *cnv,
* This may need to be looked at again as Lotus uses _LMBCSGetUnicodeSet(). (091216)
*/
-/*
+/*
Here's the basic helper function that we use when converting from
- Unicode to LMBCS, and we suspect that a Unicode character will fit into
- one of the 12 groups. The return value is the number of bytes written
+ Unicode to LMBCS, and we suspect that a Unicode character will fit into
+ one of the 12 groups. The return value is the number of bytes written
starting at pStartLMBCS (if any).
*/
@@ -751,7 +751,7 @@ LMBCSConversionWorker (
UChar * pUniChar, /* The input unicode character */
ulmbcs_byte_t * lastConverterIndex, /* output: track last successful group used */
UBool * groups_tried /* output: track any unsuccessful groups */
-)
+)
{
ulmbcs_byte_t * pLMBCS = pStartLMBCS;
UConverterSharedData * xcnv = extraInfo->OptGrpConverter[group];
@@ -780,7 +780,7 @@ LMBCSConversionWorker (
except with the exception group.
*/
U_ASSERT((firstByte <= ULMBCS_C0END) || (firstByte >= ULMBCS_C1START) || (group == ULMBCS_GRP_EXCEPT));
-
+
/* use converted data: first write 0, 1 or two group bytes */
if (group != ULMBCS_GRP_EXCEPT && extraInfo->OptGroup != group)
{
@@ -820,11 +820,11 @@ LMBCSConversionWorker (
}
-/* This is a much simpler version of above, when we
+/* This is a much simpler version of above, when we
know we are writing LMBCS using the Unicode group
*/
-static size_t
-LMBCSConvertUni(ulmbcs_byte_t * pLMBCS, UChar uniChar)
+static size_t
+LMBCSConvertUni(ulmbcs_byte_t * pLMBCS, UChar uniChar)
{
/* encode into LMBCS Unicode range */
uint8_t LowCh = (uint8_t)(uniChar & 0x00FF);
@@ -859,21 +859,21 @@ _LMBCSFromUnicode(UConverterFromUnicodeArgs* args,
int32_t bytes_written;
UBool groups_tried[ULMBCS_GRP_LAST+1];
UConverterDataLMBCS * extraInfo = (UConverterDataLMBCS *) args->converter->extraInfo;
- int sourceIndex = 0;
+ int sourceIndex = 0;
/* Basic strategy: attempt to fill in local LMBCS 1-char buffer.(LMBCS)
- If that succeeds, see if it will all fit into the target & copy it over
+ If that succeeds, see if it will all fit into the target & copy it over
if it does.
We try conversions in the following order:
1. Single-byte ascii & special fixed control chars (&null)
- 2. Look up group in table & try that (could be
+ 2. Look up group in table & try that (could be
A) Unicode group
B) control group,
- C) national encoding,
+ C) national encoding,
or ambiguous SBCS or MBCS group (on to step 4...)
-
+
3. If its ambiguous, try this order:
A) The optimization group
B) The locale group
@@ -912,8 +912,8 @@ _LMBCSFromUnicode(UConverterFromUnicodeArgs* args,
extraInfo->localeConverterIndex = ULMBCS_GRP_L1;
}
if (((uniChar > ULMBCS_C0END) && (uniChar < ULMBCS_C1START)) ||
- uniChar == 0 || uniChar == ULMBCS_HT || uniChar == ULMBCS_CR ||
- uniChar == ULMBCS_LF || uniChar == ULMBCS_123SYSTEMRANGE
+ uniChar == 0 || uniChar == ULMBCS_HT || uniChar == ULMBCS_CR ||
+ uniChar == ULMBCS_LF || uniChar == ULMBCS_123SYSTEMRANGE
)
{
*pLMBCS++ = (ulmbcs_byte_t ) uniChar;
@@ -921,15 +921,15 @@ _LMBCSFromUnicode(UConverterFromUnicodeArgs* args,
}
- if (!bytes_written)
+ if (!bytes_written)
{
/* Check by UNICODE range (Strategy 2) */
ulmbcs_byte_t group = FindLMBCSUniRange(uniChar);
-
+
if (group == ULMBCS_GRP_UNICODE) /* (Strategy 2A) */
{
pLMBCS += LMBCSConvertUni(pLMBCS,uniChar);
-
+
bytes_written = (int32_t)(pLMBCS - LMBCS);
}
else if (group == ULMBCS_GRP_CTRL) /* (Strategy 2B) */
@@ -951,7 +951,7 @@ _LMBCSFromUnicode(UConverterFromUnicodeArgs* args,
{
/* a specific converter has been identified - use it */
bytes_written = (int32_t)LMBCSConversionWorker (
- extraInfo, group, pLMBCS, &uniChar,
+ extraInfo, group, pLMBCS, &uniChar,
&lastConverterIndex, groups_tried);
}
if (!bytes_written) /* the ambiguous group cases (Strategy 3) */
@@ -1004,15 +1004,15 @@ _LMBCSFromUnicode(UConverterFromUnicodeArgs* args,
}
if (!bytes_written)
{
- /* just check every possible matching converter (Strategy 3D) */
+ /* just check every possible matching converter (Strategy 3D) */
ulmbcs_byte_t grp_start;
- ulmbcs_byte_t grp_end;
+ ulmbcs_byte_t grp_end;
ulmbcs_byte_t grp_ix;
- grp_start = (ulmbcs_byte_t)((group == ULMBCS_AMBIGUOUS_MBCS)
- ? ULMBCS_DOUBLEOPTGROUP_START
+ grp_start = (ulmbcs_byte_t)((group == ULMBCS_AMBIGUOUS_MBCS)
+ ? ULMBCS_DOUBLEOPTGROUP_START
: ULMBCS_GRP_L1);
- grp_end = (ulmbcs_byte_t)((group == ULMBCS_AMBIGUOUS_MBCS)
- ? ULMBCS_GRP_LAST
+ grp_end = (ulmbcs_byte_t)((group == ULMBCS_AMBIGUOUS_MBCS)
+ ? ULMBCS_GRP_LAST
: ULMBCS_GRP_TH);
if(group == ULMBCS_AMBIGUOUS_ALL)
{
@@ -1020,22 +1020,22 @@ _LMBCSFromUnicode(UConverterFromUnicodeArgs* args,
grp_end = ULMBCS_GRP_LAST;
}
for (grp_ix = grp_start;
- grp_ix <= grp_end && !bytes_written;
+ grp_ix <= grp_end && !bytes_written;
grp_ix++)
{
if (extraInfo->OptGrpConverter [grp_ix] && !groups_tried [grp_ix])
{
bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
- grp_ix, pLMBCS, &uniChar,
+ grp_ix, pLMBCS, &uniChar,
&lastConverterIndex, groups_tried);
}
}
- /* a final conversion fallback to the exceptions group if its likely
+ /* a final conversion fallback to the exceptions group if its likely
to be single byte (Strategy 3E) */
if (!bytes_written && grp_start == ULMBCS_GRP_L1)
{
bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
- ULMBCS_GRP_EXCEPT, pLMBCS, &uniChar,
+ ULMBCS_GRP_EXCEPT, pLMBCS, &uniChar,
&lastConverterIndex, groups_tried);
}
}
@@ -1048,7 +1048,7 @@ _LMBCSFromUnicode(UConverterFromUnicodeArgs* args,
}
}
}
-
+
/* we have a translation. increment source and write as much as posible to target */
args->source++;
pLMBCS = LMBCS;
@@ -1077,7 +1077,7 @@ _LMBCSFromUnicode(UConverterFromUnicodeArgs* args,
}
/*Fix for SPR#DJOE66JFN3 (Lotus)*/
extraInfo->localeConverterIndex = OldConverterIndex;
- }
+ }
}
@@ -1091,7 +1091,7 @@ GetUniFromLMBCSUni(char const ** ppLMBCSin) /* Called with LMBCS-style Unicode
uint8_t HighCh = *(*ppLMBCSin)++; /* Big-endian Unicode in LMBCS compatibility group*/
uint8_t LowCh = *(*ppLMBCSin)++;
- if (HighCh == ULMBCS_UNICOMPATZERO )
+ if (HighCh == ULMBCS_UNICOMPATZERO )
{
HighCh = LowCh;
LowCh = 0; /* zero-byte in LSB special character */
@@ -1101,17 +1101,19 @@ GetUniFromLMBCSUni(char const ** ppLMBCSin) /* Called with LMBCS-style Unicode
-/* CHECK_SOURCE_LIMIT: Helper macro to verify that there are at least'index'
+/* CHECK_SOURCE_LIMIT: Helper macro to verify that there are at least'index'
bytes left in source up to sourceLimit.Errors appropriately if not.
If we reach the limit, then update the source pointer to there to consume
all input as required by ICU converter semantics.
*/
-#define CHECK_SOURCE_LIMIT(index) \
- if (args->source+index > args->sourceLimit){\
- *err = U_TRUNCATED_CHAR_FOUND;\
- args->source = args->sourceLimit;\
- return 0xffff;}
+#define CHECK_SOURCE_LIMIT(index) UPRV_BLOCK_MACRO_BEGIN { \
+ if (args->source+index > args->sourceLimit) { \
+ *err = U_TRUNCATED_CHAR_FOUND; \
+ args->source = args->sourceLimit; \
+ return 0xffff; \
+ } \
+} UPRV_BLOCK_MACRO_END
/* Return the Unicode representation for the current LMBCS character */
@@ -1130,32 +1132,32 @@ _LMBCSGetNextUCharWorker(UConverterToUnicodeArgs* args,
}
/* Grab first byte & save address for error recovery */
CurByte = *((ulmbcs_byte_t *) (args->source++));
-
+
/*
* at entry of each if clause:
* 1. 'CurByte' points at the first byte of a LMBCS character
- * 2. '*source'points to the next byte of the source stream after 'CurByte'
+ * 2. '*source'points to the next byte of the source stream after 'CurByte'
*
* the job of each if clause is:
* 1. set '*source' to point at the beginning of next char (nop if LMBCS char is only 1 byte)
* 2. set 'uniChar' up with the right Unicode value, or set 'err' appropriately
*/
-
+
/* First lets check the simple fixed values. */
if(((CurByte > ULMBCS_C0END) && (CurByte < ULMBCS_C1START)) /* ascii range */
- || (CurByte == 0)
- || CurByte == ULMBCS_HT || CurByte == ULMBCS_CR
+ || (CurByte == 0)
+ || CurByte == ULMBCS_HT || CurByte == ULMBCS_CR
|| CurByte == ULMBCS_LF || CurByte == ULMBCS_123SYSTEMRANGE)
{
uniChar = CurByte;
}
- else
+ else
{
UConverterDataLMBCS * extraInfo;
- ulmbcs_byte_t group;
- UConverterSharedData *cnv;
-
+ ulmbcs_byte_t group;
+ UConverterSharedData *cnv;
+
if (CurByte == ULMBCS_GRP_CTRL) /* Control character group - no opt group update */
{
ulmbcs_byte_t C0C1byte;
@@ -1163,15 +1165,15 @@ _LMBCSGetNextUCharWorker(UConverterToUnicodeArgs* args,
C0C1byte = *(args->source)++;
uniChar = (C0C1byte < ULMBCS_C1START) ? C0C1byte - ULMBCS_CTRLOFFSET : C0C1byte;
}
- else
+ else
if (CurByte == ULMBCS_GRP_UNICODE) /* Unicode compatibility group: BigEndian UTF16 */
{
CHECK_SOURCE_LIMIT(2);
-
+
/* don't check for error indicators fffe/ffff below */
return GetUniFromLMBCSUni(&(args->source));
}
- else if (CurByte <= ULMBCS_CTRLOFFSET)
+ else if (CurByte <= ULMBCS_CTRLOFFSET)
{
group = CurByte; /* group byte is in the source */
extraInfo = (UConverterDataLMBCS *) args->converter->extraInfo;
@@ -1179,7 +1181,7 @@ _LMBCSGetNextUCharWorker(UConverterToUnicodeArgs* args,
{
/* this is not a valid group byte - no converter*/
*err = U_INVALID_CHAR_FOUND;
- }
+ }
else if (group >= ULMBCS_DOUBLEOPTGROUP_START) /* double byte conversion */
{
@@ -1200,21 +1202,21 @@ _LMBCSGetNextUCharWorker(UConverterToUnicodeArgs* args,
else { /* single byte conversion */
CHECK_SOURCE_LIMIT(1);
CurByte = *(args->source)++;
-
+
if (CurByte >= ULMBCS_C1START)
{
uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP(cnv, CurByte);
}
else
{
- /* The non-optimizable oddballs where there is an explicit byte
+ /* The non-optimizable oddballs where there is an explicit byte
* AND the second byte is not in the upper ascii range
*/
char bytes[2];
extraInfo = (UConverterDataLMBCS *) args->converter->extraInfo;
- cnv = extraInfo->OptGrpConverter [ULMBCS_GRP_EXCEPT];
-
+ cnv = extraInfo->OptGrpConverter [ULMBCS_GRP_EXCEPT];
+
/* Lookup value must include opt group */
bytes[0] = group;
bytes[1] = CurByte;
@@ -1275,15 +1277,15 @@ _LMBCSToUnicodeWithOffsets(UConverterToUnicodeArgs* args,
if (args->converter->toULength) /* reassemble char from previous call */
{
- const char *saveSourceLimit;
+ const char *saveSourceLimit;
size_t size_old = args->converter->toULength;
/* limit from source is either remainder of temp buffer, or user limit on source */
size_t size_new_maybe_1 = sizeof(LMBCS) - size_old;
size_t size_new_maybe_2 = args->sourceLimit - args->source;
size_t size_new = (size_new_maybe_1 < size_new_maybe_2) ? size_new_maybe_1 : size_new_maybe_2;
-
-
+
+
uprv_memcpy(LMBCS, args->converter->toUBytes, size_old);
uprv_memcpy(LMBCS + size_old, args->source, size_new);
saveSourceLimit = args->sourceLimit;
@@ -1340,7 +1342,7 @@ _LMBCSToUnicodeWithOffsets(UConverterToUnicodeArgs* args,
{
*err = U_BUFFER_OVERFLOW_ERROR;
}
- else if (U_FAILURE(*err))
+ else if (U_FAILURE(*err))
{
/* If character incomplete or unmappable/illegal, store it in toUBytes[] */
args->converter->toULength = savebytes;
diff --git a/deps/icu-small/source/common/ucnv_u16.cpp b/deps/icu-small/source/common/ucnv_u16.cpp
index 6c1b87d3c939c6..a5e8367400ae69 100644
--- a/deps/icu-small/source/common/ucnv_u16.cpp
+++ b/deps/icu-small/source/common/ucnv_u16.cpp
@@ -1,6 +1,6 @@
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
-/*
+/*
**********************************************************************
* Copyright (C) 2002-2015, International Business Machines
* Corporation and others. All Rights Reserved.
@@ -199,7 +199,7 @@ _UTF16BEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
} else {
length=0; /* from here on, length counts the bytes in overflow[] */
}
-
+
if(c!=0) {
/*
* c is a surrogate, and
@@ -567,7 +567,7 @@ _UTF16BEGetNextUChar(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
pArgs->source=(const char *)s;
return c;
-}
+}
static void U_CALLCONV
_UTF16BEReset(UConverter *cnv, UConverterResetChoice choice) {
@@ -800,7 +800,7 @@ _UTF16LEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
} else {
length=0; /* from here on, length counts the bytes in overflow[] */
}
-
+
if(c!=0) {
/*
* c is a surrogate, and
@@ -1168,7 +1168,7 @@ _UTF16LEGetNextUChar(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
pArgs->source=(const char *)s;
return c;
-}
+}
static void U_CALLCONV
_UTF16LEReset(UConverter *cnv, UConverterResetChoice choice) {
diff --git a/deps/icu-small/source/common/ucnv_u32.cpp b/deps/icu-small/source/common/ucnv_u32.cpp
index 13444a3afd97f1..9f98914b9d734d 100644
--- a/deps/icu-small/source/common/ucnv_u32.cpp
+++ b/deps/icu-small/source/common/ucnv_u32.cpp
@@ -1,6 +1,6 @@
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
-/*
+/*
**********************************************************************
* Copyright (C) 2002-2015, International Business Machines
* Corporation and others. All Rights Reserved.
@@ -84,7 +84,7 @@ T_UConverter_toUnicode_UTF32_BE(UConverterToUnicodeArgs * args,
if (ch <= MAXIMUM_UTF && !U_IS_SURROGATE(ch)) {
/* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
- if (ch <= MAXIMUM_UCS2)
+ if (ch <= MAXIMUM_UCS2)
{
/* fits in 16 bits */
*(myTarget++) = (UChar) ch;
@@ -434,7 +434,7 @@ T_UConverter_getNextUChar_UTF32_BE(UConverterToUnicodeArgs* args,
}
length = (int32_t)((const uint8_t *)args->sourceLimit - mySource);
- if (length < 4)
+ if (length < 4)
{
/* got a partial character */
uprv_memcpy(args->converter->toUBytes, mySource, length);
@@ -640,7 +640,7 @@ T_UConverter_toUnicode_UTF32_LE_OFFSET_LOGIC(UConverterToUnicodeArgs * args,
if (ch <= MAXIMUM_UTF && !U_IS_SURROGATE(ch))
{
/* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
- if (ch <= MAXIMUM_UCS2)
+ if (ch <= MAXIMUM_UCS2)
{
/* fits in 16 bits */
*(myTarget++) = (UChar) ch;
@@ -929,7 +929,7 @@ T_UConverter_getNextUChar_UTF32_LE(UConverterToUnicodeArgs* args,
}
length = (int32_t)((const uint8_t *)args->sourceLimit - mySource);
- if (length < 4)
+ if (length < 4)
{
/* got a partial character */
uprv_memcpy(args->converter->toUBytes, mySource, length);
@@ -1247,7 +1247,7 @@ static const UConverterStaticData _UTF32StaticData = {
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved */
};
-const UConverterSharedData _UTF32Data =
+const UConverterSharedData _UTF32Data =
UCNV_IMMUTABLE_SHARED_DATA_INITIALIZER(&_UTF32StaticData, &_UTF32Impl);
#endif
diff --git a/deps/icu-small/source/common/ucnv_u7.cpp b/deps/icu-small/source/common/ucnv_u7.cpp
index ec7befe9fc9a78..87ba8cf37ec191 100644
--- a/deps/icu-small/source/common/ucnv_u7.cpp
+++ b/deps/icu-small/source/common/ucnv_u7.cpp
@@ -1,6 +1,6 @@
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
-/*
+/*
**********************************************************************
* Copyright (C) 2002-2016, International Business Machines
* Corporation and others. All Rights Reserved.
diff --git a/deps/icu-small/source/common/ucnv_u8.cpp b/deps/icu-small/source/common/ucnv_u8.cpp
index 878d67304c7d89..9b518e08df6785 100644
--- a/deps/icu-small/source/common/ucnv_u8.cpp
+++ b/deps/icu-small/source/common/ucnv_u8.cpp
@@ -1,6 +1,6 @@
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
-/*
+/*
**********************************************************************
* Copyright (C) 2002-2016, International Business Machines
* Corporation and others. All Rights Reserved.
@@ -134,7 +134,7 @@ static void U_CALLCONV ucnv_toUnicode_UTF8 (UConverterToUnicodeArgs * args,
ch -= offsetsFromUTF8[inBytes];
/* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
- if (ch <= MAXIMUM_UCS2)
+ if (ch <= MAXIMUM_UCS2)
{
/* fits in 16 bits */
*(myTarget++) = (UChar) ch;
@@ -250,7 +250,7 @@ static void U_CALLCONV ucnv_toUnicode_UTF8_OFFSETS_LOGIC (UConverterToUnicodeAr
ch -= offsetsFromUTF8[inBytes];
/* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
- if (ch <= MAXIMUM_UCS2)
+ if (ch <= MAXIMUM_UCS2)
{
/* fits in 16 bits */
*(myTarget++) = (UChar) ch;
@@ -640,7 +640,7 @@ static UChar32 U_CALLCONV ucnv_getNextUChar_UTF8(UConverterToUnicodeArgs *args,
cnv->toULength = i;
*err = U_ILLEGAL_CHAR_FOUND;
return 0xffff;
-}
+}
U_CDECL_END
/* UTF-8-from-UTF-8 conversion functions ------------------------------------ */
diff --git a/deps/icu-small/source/common/ucnvbocu.cpp b/deps/icu-small/source/common/ucnvbocu.cpp
index 5b66c5059a55ba..7c2aab56558c8c 100644
--- a/deps/icu-small/source/common/ucnvbocu.cpp
+++ b/deps/icu-small/source/common/ucnvbocu.cpp
@@ -202,14 +202,14 @@ bocu1TrailToByte[BOCU1_TRAIL_CONTROLS_COUNT]={
* @param d Divisor.
* @param m Output variable for the rest (modulo result).
*/
-#define NEGDIVMOD(n, d, m) { \
+#define NEGDIVMOD(n, d, m) UPRV_BLOCK_MACRO_BEGIN { \
(m)=(n)%(d); \
(n)/=(d); \
if((m)<0) { \
--(n); \
(m)+=(d); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/* Faster versions of packDiff() for single-byte-encoded diff values. */
diff --git a/deps/icu-small/source/common/ucnvhz.cpp b/deps/icu-small/source/common/ucnvhz.cpp
index 31595374696d8c..6b2f5faaf0a59a 100644
--- a/deps/icu-small/source/common/ucnvhz.cpp
+++ b/deps/icu-small/source/common/ucnvhz.cpp
@@ -1,6 +1,6 @@
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
-/*
+/*
**********************************************************************
* Copyright (C) 2000-2015, International Business Machines
* Corporation and others. All Rights Reserved.
@@ -13,7 +13,7 @@
* created on: 2000oct16
* created by: Ram Viswanadha
* 10/31/2000 Ram Implemented offsets logic function
-*
+*
*/
#include "unicode/utypes.h"
@@ -38,7 +38,7 @@
#define ESC_LEN 2
-#define CONCAT_ESCAPE_MACRO( args, targetIndex,targetLength,strToAppend, err, len,sourceIndex){ \
+#define CONCAT_ESCAPE_MACRO(args, targetIndex,targetLength,strToAppend, err, len,sourceIndex) UPRV_BLOCK_MACRO_BEGIN { \
while(len-->0){ \
if(targetIndex < targetLength){ \
args->target[targetIndex] = (unsigned char) *strToAppend; \
@@ -53,7 +53,7 @@
} \
strToAppend++; \
} \
-}
+} UPRV_BLOCK_MACRO_END
typedef struct{
@@ -117,7 +117,7 @@ _HZReset(UConverter *cnv, UConverterResetChoice choice){
}
if(choice!=UCNV_RESET_TO_UNICODE) {
cnv->fromUnicodeStatus= 0;
- cnv->fromUChar32=0x0000;
+ cnv->fromUChar32=0x0000;
if(cnv->extraInfo != NULL){
((UConverterDataHZ*)cnv->extraInfo)->isEscapeAppended = FALSE;
((UConverterDataHZ*)cnv->extraInfo)->targetIndex = 0;
@@ -129,7 +129,7 @@ _HZReset(UConverter *cnv, UConverterResetChoice choice){
/**************************************HZ Encoding*************************************************
* Rules for HZ encoding
-*
+*
* In ASCII mode, a byte is interpreted as an ASCII character, unless a
* '~' is encountered. The character '~' is an escape character. By
* convention, it must be immediately followed ONLY by '~', '{' or '\n'
@@ -162,7 +162,7 @@ UConverter_toUnicode_HZ_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
UChar32 targetUniChar = 0x0000;
int32_t mySourceChar = 0x0000;
UConverterDataHZ* myData=(UConverterDataHZ*)(args->converter->extraInfo);
- tempBuf[0]=0;
+ tempBuf[0]=0;
tempBuf[1]=0;
/* Calling code already handles this situation. */
@@ -170,11 +170,11 @@ UConverter_toUnicode_HZ_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
*err = U_ILLEGAL_ARGUMENT_ERROR;
return;
}*/
-
+
while(mySource< mySourceLimit){
-
+
if(myTarget < args->targetLimit){
-
+
mySourceChar= (unsigned char) *mySource++;
if(args->converter->mode == UCNV_TILDE) {
@@ -349,7 +349,7 @@ UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
UBool oldIsTargetUCharDBCS;
int len =0;
const char* escSeq=NULL;
-
+
/* Calling code already handles this situation. */
/*if ((args->converter == NULL) || (args->targetLimit < myTarget) || (args->sourceLimit < args->source)){
*err = U_ILLEGAL_ARGUMENT_ERROR;
@@ -362,9 +362,9 @@ UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
while (mySourceIndex < mySourceLength){
targetUniChar = missingCharMarker;
if (myTargetIndex < targetLength){
-
+
mySourceChar = (UChar) mySource[mySourceIndex++];
-
+
oldIsTargetUCharDBCS = isTargetUCharDBCS;
if(mySourceChar ==UCNV_TILDE){
@@ -389,7 +389,7 @@ UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
}
}
if (targetUniChar != missingCharMarker){
- myConverterData->isTargetUCharDBCS = isTargetUCharDBCS = (UBool)(targetUniChar>0x00FF);
+ myConverterData->isTargetUCharDBCS = isTargetUCharDBCS = (UBool)(targetUniChar>0x00FF);
if(oldIsTargetUCharDBCS != isTargetUCharDBCS || !myConverterData->isEscapeAppended ){
/*Shifting from a double byte to single byte mode*/
if(!isTargetUCharDBCS){
@@ -403,10 +403,10 @@ UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
escSeq = DB_ESCAPE;
CONCAT_ESCAPE_MACRO(args, myTargetIndex, targetLength, escSeq,err,len,mySourceIndex);
myConverterData->isEscapeAppended = TRUE;
-
+
}
}
-
+
if(isTargetUCharDBCS){
if( myTargetIndex > 8);
@@ -421,7 +421,7 @@ UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
}else{
args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = (char) targetUniChar;
*err = U_BUFFER_OVERFLOW_ERROR;
- }
+ }
}else{
args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] =(char) (targetUniChar >> 8);
args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = (char) targetUniChar;
@@ -434,7 +434,7 @@ UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
if(offsets){
*(offsets++) = mySourceIndex-1;
}
-
+
}else{
args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = (char) targetUniChar;
*err = U_BUFFER_OVERFLOW_ERROR;
@@ -503,7 +503,7 @@ _HZ_WriteSub(UConverterFromUnicodeArgs *args, int32_t offsetIndex, UErrorCode *e
char *p;
char buffer[4];
p = buffer;
-
+
if( convData->isTargetUCharDBCS){
*p++= UCNV_TILDE;
*p++= UCNV_CLOSE_BRACE;
@@ -518,39 +518,31 @@ _HZ_WriteSub(UConverterFromUnicodeArgs *args, int32_t offsetIndex, UErrorCode *e
/*
* Structure for cloning an HZ converter into a single memory block.
- * ucnv_safeClone() of the HZ converter will align the entire cloneHZStruct,
- * and then ucnv_safeClone() of the sub-converter may additionally align
- * subCnv inside the cloneHZStruct, for which we need the deadSpace after
- * subCnv. This is because UAlignedMemory may be larger than the actually
- * necessary alignment size for the platform.
- * The other cloneHZStruct fields will not be moved around,
- * and are aligned properly with cloneHZStruct's alignment.
*/
struct cloneHZStruct
{
UConverter cnv;
UConverter subCnv;
- UAlignedMemory deadSpace;
UConverterDataHZ mydata;
};
static UConverter * U_CALLCONV
-_HZ_SafeClone(const UConverter *cnv,
- void *stackBuffer,
- int32_t *pBufferSize,
+_HZ_SafeClone(const UConverter *cnv,
+ void *stackBuffer,
+ int32_t *pBufferSize,
UErrorCode *status)
{
struct cloneHZStruct * localClone;
int32_t size, bufferSizeNeeded = sizeof(struct cloneHZStruct);
if (U_FAILURE(*status)){
- return 0;
+ return nullptr;
}
if (*pBufferSize == 0){ /* 'preflighting' request - set needed size into *pBufferSize */
*pBufferSize = bufferSizeNeeded;
- return 0;
+ return nullptr;
}
localClone = (struct cloneHZStruct *)stackBuffer;
@@ -561,7 +553,7 @@ _HZ_SafeClone(const UConverter *cnv,
localClone->cnv.isExtraLocal = TRUE;
/* deep-clone the sub-converter */
- size = (int32_t)(sizeof(UConverter) + sizeof(UAlignedMemory)); /* include size of padding */
+ size = (int32_t)sizeof(UConverter);
((UConverterDataHZ*)localClone->cnv.extraInfo)->gbConverter =
ucnv_safeClone(((UConverterDataHZ*)cnv->extraInfo)->gbConverter, &localClone->subCnv, &size, status);
@@ -586,20 +578,20 @@ U_CDECL_END
static const UConverterImpl _HZImpl={
UCNV_HZ,
-
+
NULL,
NULL,
-
+
_HZOpen,
_HZClose,
_HZReset,
-
+
UConverter_toUnicode_HZ_OFFSETS_LOGIC,
UConverter_toUnicode_HZ_OFFSETS_LOGIC,
UConverter_fromUnicode_HZ_OFFSETS_LOGIC,
UConverter_fromUnicode_HZ_OFFSETS_LOGIC,
NULL,
-
+
NULL,
NULL,
_HZ_WriteSub,
@@ -612,14 +604,14 @@ static const UConverterImpl _HZImpl={
static const UConverterStaticData _HZStaticData={
sizeof(UConverterStaticData),
"HZ",
- 0,
- UCNV_IBM,
- UCNV_HZ,
- 1,
+ 0,
+ UCNV_IBM,
+ UCNV_HZ,
+ 1,
4,
{ 0x1a, 0, 0, 0 },
1,
- FALSE,
+ FALSE,
FALSE,
0,
0,
diff --git a/deps/icu-small/source/common/ucnvisci.cpp b/deps/icu-small/source/common/ucnvisci.cpp
index d0c07f2b27fae9..44a7c05a3c8113 100644
--- a/deps/icu-small/source/common/ucnvisci.cpp
+++ b/deps/icu-small/source/common/ucnvisci.cpp
@@ -213,13 +213,13 @@ _ISCIIOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode) {
converterData->currentMaskFromUnicode
= converterData->currentMaskToUnicode
= converterData->defMaskToUnicode = lookupInitialData[pArgs->options & UCNV_OPTIONS_VERSION_MASK].maskEnum;
-
+
converterData->isFirstBuffer=TRUE;
(void)uprv_strcpy(converterData->name, ISCII_CNV_PREFIX);
len = (int32_t)uprv_strlen(converterData->name);
converterData->name[len]= (char)((pArgs->options & UCNV_OPTIONS_VERSION_MASK) + '0');
converterData->name[len+1]=0;
-
+
converterData->prevToUnicodeStatus = 0x0000;
} else {
uprv_free(cnv->extraInfo);
@@ -831,7 +831,7 @@ static const uint16_t nuktaSpecialCases[][2]={
};
-#define WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,targetByteUnit,err){ \
+#define WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,targetByteUnit,err) UPRV_BLOCK_MACRO_BEGIN { \
int32_t offset = (int32_t)(source - args->source-1); \
/* write the targetUniChar to target */ \
if(target < targetLimit){ \
@@ -884,7 +884,7 @@ static const uint16_t nuktaSpecialCases[][2]={
(uint8_t) (targetByteUnit); \
*err = U_BUFFER_OVERFLOW_ERROR; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/* Rules:
* Explicit Halant :
@@ -934,12 +934,12 @@ UConverter_fromUnicode_ISCII_OFFSETS_LOGIC(
break;
}
}
-
+
sourceChar = *source++;
tempContextFromUnicode = converterData->contextCharFromUnicode;
-
+
targetByteUnit = missingCharMarker;
-
+
/*check if input is in ASCII and C0 control codes range*/
if (sourceChar <= ASCII_END) {
args->converter->fromUnicodeStatus = sourceChar;
@@ -989,8 +989,8 @@ UConverter_fromUnicode_ISCII_OFFSETS_LOGIC(
deltaChanged =TRUE;
converterData->isFirstBuffer=FALSE;
}
-
- if (converterData->currentDeltaFromUnicode == PNJ_DELTA) {
+
+ if (converterData->currentDeltaFromUnicode == PNJ_DELTA) {
if (sourceChar == PNJ_TIPPI) {
/* Make sure Tippi is converterd to Bindi. */
sourceChar = PNJ_BINDI;
@@ -998,7 +998,7 @@ UConverter_fromUnicode_ISCII_OFFSETS_LOGIC(
/* This is for consonant cluster handling. */
converterData->contextCharFromUnicode = PNJ_ADHAK;
}
-
+
}
/* Normalize all Indic codepoints to Devanagari and map them to ISCII */
/* now subtract the new delta from sourceChar*/
@@ -1031,7 +1031,7 @@ UConverter_fromUnicode_ISCII_OFFSETS_LOGIC(
break;
}
}
-
+
if (converterData->currentDeltaFromUnicode == PNJ_DELTA && (sourceChar + PNJ_DELTA) == PNJ_ADHAK) {
continue;
}
@@ -1119,7 +1119,7 @@ static const uint16_t lookupTable[][2]={
{ GURMUKHI, PNJ_MASK }
};
-#define WRITE_TO_TARGET_TO_U(args,source,target,offsets,offset,targetUniChar,delta, err){\
+#define WRITE_TO_TARGET_TO_U(args,source,target,offsets,offset,targetUniChar,delta, err) UPRV_BLOCK_MACRO_BEGIN { \
/* add offset to current Indic Block */ \
if(targetUniChar>ASCII_END && \
targetUniChar != ZWJ && \
@@ -1140,9 +1140,9 @@ static const uint16_t lookupTable[][2]={
(UChar)targetUniChar; \
*err = U_BUFFER_OVERFLOW_ERROR; \
} \
-}
+} UPRV_BLOCK_MACRO_END
-#define GET_MAPPING(sourceChar,targetUniChar,data){ \
+#define GET_MAPPING(sourceChar,targetUniChar,data) UPRV_BLOCK_MACRO_BEGIN { \
targetUniChar = toUnicodeTable[(sourceChar)] ; \
/* is the code point valid in current script? */ \
if(sourceChar> ASCII_END && \
@@ -1153,7 +1153,7 @@ static const uint16_t lookupTable[][2]={
targetUniChar=missingCharMarker; \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/***********
* Rules for ISCII to Unicode converter
@@ -1189,7 +1189,7 @@ UConverter_toUnicode_ISCII_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, UErrorCo
UChar32 tempTargetUniChar = 0x0000;
UChar* contextCharToUnicode= NULL;
UBool found;
- int i;
+ int i;
int offset = 0;
if ((args->converter == NULL) || (target < args->target) || (source < args->source)) {
@@ -1245,7 +1245,7 @@ UConverter_toUnicode_ISCII_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, UErrorCo
/* We currently support only Anudatta and Devanagari abbreviation sign */
if (sourceChar==0xBF || sourceChar == 0xB8) {
targetUniChar = (sourceChar==0xBF) ? DEV_ABBR_SIGN : DEV_ANUDATTA;
-
+
/* find out if the mapping is valid in this state */
if (validityTable[(uint8_t)targetUniChar] & data->currentMaskToUnicode) {
*contextCharToUnicode= NO_CHAR_MARKER;
@@ -1452,7 +1452,7 @@ UConverter_toUnicode_ISCII_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, UErrorCo
WRITE_TO_TARGET_TO_U(args,source,target,args->offsets,(source-args->source -1),data->prevToUnicodeStatus,0,err);
data->prevToUnicodeStatus = 0x0000;
}
- /* Check to make sure that Bindi and Tippi are handled correctly for Gurmukhi script.
+ /* Check to make sure that Bindi and Tippi are handled correctly for Gurmukhi script.
* If 0xA2 is preceded by a codepoint in the PNJ_BINDI_TIPPI_SET then the target codepoint should be Tippi instead of Bindi.
*/
if (data->currentDeltaToUnicode == PNJ_DELTA && (targetUniChar + PNJ_DELTA) == PNJ_BINDI && isPNJBindiTippi((*toUnicodeStatus + PNJ_DELTA))) {
diff --git a/deps/icu-small/source/common/ucnvlat1.cpp b/deps/icu-small/source/common/ucnvlat1.cpp
index 15eeb5c51f5fb3..358bc0caa25a19 100644
--- a/deps/icu-small/source/common/ucnvlat1.cpp
+++ b/deps/icu-small/source/common/ucnvlat1.cpp
@@ -1,6 +1,6 @@
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
-/*
+/*
**********************************************************************
* Copyright (C) 2000-2015, International Business Machines
* Corporation and others. All Rights Reserved.
diff --git a/deps/icu-small/source/common/ucnvmbcs.cpp b/deps/icu-small/source/common/ucnvmbcs.cpp
index 2fec6b4b1510d6..ca9b0a335ad156 100644
--- a/deps/icu-small/source/common/ucnvmbcs.cpp
+++ b/deps/icu-small/source/common/ucnvmbcs.cpp
@@ -35,7 +35,7 @@
* limitations and adds m:n character mappings and other features.
* See ucnv_ext.h for details.
*
-* Change history:
+* Change history:
*
* 5/6/2001 Ram Moved MBCS_SINGLE_RESULT_FROM_U,MBCS_STAGE_2_FROM_U,
* MBCS_VALUE_2_FROM_STAGE_2, MBCS_VALUE_4_FROM_STAGE_2
@@ -849,7 +849,7 @@ ucnv_MBCSEnumToUnicode(UConverterMBCSTable *mbcsTable,
}
}
-U_CFUNC void
+U_CFUNC void
ucnv_MBCSGetFilteredUnicodeSetForUnicode(const UConverterSharedData *sharedData,
const USetAdder *sa,
UConverterUnicodeSet which,
diff --git a/deps/icu-small/source/common/ucnvmbcs.h b/deps/icu-small/source/common/ucnvmbcs.h
index a750b92e499c6e..209cdc532d4d23 100644
--- a/deps/icu-small/source/common/ucnvmbcs.h
+++ b/deps/icu-small/source/common/ucnvmbcs.h
@@ -180,15 +180,15 @@
* -- normal base table with optional extension
*
* int32_t stateTable[countStates][256];
- *
+ *
* struct _MBCSToUFallback { (fallbacks are sorted by offset)
* uint32_t offset;
* UChar32 codePoint;
* } toUFallbacks[countToUFallbacks];
- *
+ *
* uint16_t unicodeCodeUnits[(offsetFromUTable-offsetToUCodeUnits)/2];
* (padded to an even number of units)
- *
+ *
* -- stage 1 tables
* if(staticData.unicodeMask&UCNV_HAS_SUPPLEMENTARY) {
* -- stage 1 table for all of Unicode
@@ -566,10 +566,10 @@ ucnv_MBCSSingleFromUChar32(UConverterSharedData *sharedData,
U_CFUNC UConverterType
ucnv_MBCSGetType(const UConverter* converter);
-U_CFUNC void
+U_CFUNC void
ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
UErrorCode *pErrorCode);
-U_CFUNC void
+U_CFUNC void
ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
UErrorCode *pErrorCode);
diff --git a/deps/icu-small/source/common/ucnvscsu.cpp b/deps/icu-small/source/common/ucnvscsu.cpp
index eb7b7ad5c8793e..74b5722b975bff 100644
--- a/deps/icu-small/source/common/ucnvscsu.cpp
+++ b/deps/icu-small/source/common/ucnvscsu.cpp
@@ -1969,9 +1969,9 @@ struct cloneSCSUStruct
};
static UConverter * U_CALLCONV
-_SCSUSafeClone(const UConverter *cnv,
- void *stackBuffer,
- int32_t *pBufferSize,
+_SCSUSafeClone(const UConverter *cnv,
+ void *stackBuffer,
+ int32_t *pBufferSize,
UErrorCode *status)
{
struct cloneSCSUStruct * localClone;
diff --git a/deps/icu-small/source/common/ucnvsel.cpp b/deps/icu-small/source/common/ucnvsel.cpp
index 6ccee1ae61fd70..2dff5ac1bc8388 100644
--- a/deps/icu-small/source/common/ucnvsel.cpp
+++ b/deps/icu-small/source/common/ucnvsel.cpp
@@ -658,7 +658,7 @@ static const UEnumeration defaultEncodings = {
ucnvsel_close_selector_iterator,
ucnvsel_count_encodings,
uenum_unextDefault,
- ucnvsel_next_encoding,
+ ucnvsel_next_encoding,
ucnvsel_reset_iterator
};
@@ -691,36 +691,36 @@ static int16_t countOnes(uint32_t* mask, int32_t len) {
/* internal function! */
static UEnumeration *selectForMask(const UConverterSelector* sel,
- uint32_t *mask, UErrorCode *status) {
+ uint32_t *theMask, UErrorCode *status) {
+ LocalMemory mask(theMask);
// this is the context we will use. Store a table of indices to which
// encodings are legit.
- struct Enumerator* result = (Enumerator*)uprv_malloc(sizeof(Enumerator));
- if (result == NULL) {
- uprv_free(mask);
+ LocalMemory result(static_cast(uprv_malloc(sizeof(Enumerator))));
+ if (result.isNull()) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
- result->index = NULL; // this will be allocated later!
+ result->index = nullptr; // this will be allocated later!
result->length = result->cur = 0;
result->sel = sel;
- UEnumeration *en = (UEnumeration *)uprv_malloc(sizeof(UEnumeration));
- if (en == NULL) {
+ LocalMemory en(static_cast(uprv_malloc(sizeof(UEnumeration))));
+ if (en.isNull()) {
// TODO(markus): Combine Enumerator and UEnumeration into one struct.
- uprv_free(mask);
- uprv_free(result);
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
- memcpy(en, &defaultEncodings, sizeof(UEnumeration));
- en->context = result;
-
+ memcpy(en.getAlias(), &defaultEncodings, sizeof(UEnumeration));
+
int32_t columns = (sel->encodingsCount+31)/32;
- int16_t numOnes = countOnes(mask, columns);
+ int16_t numOnes = countOnes(mask.getAlias(), columns);
// now, we know the exact space we need for index
if (numOnes > 0) {
- result->index = (int16_t*) uprv_malloc(numOnes * sizeof(int16_t));
-
+ result->index = static_cast(uprv_malloc(numOnes * sizeof(int16_t)));
+ if (result->index == nullptr) {
+ *status = U_MEMORY_ALLOCATION_ERROR;
+ return nullptr;
+ }
int32_t i, j;
int16_t k = 0;
for (j = 0 ; j < columns; j++) {
@@ -734,8 +734,8 @@ static UEnumeration *selectForMask(const UConverterSelector* sel,
}
} //otherwise, index will remain NULL (and will never be touched by
//the enumerator code anyway)
- uprv_free(mask);
- return en;
+ en->context = result.orphan();
+ return en.orphan();
}
/* check a string against the selector - UTF16 version */
@@ -767,7 +767,7 @@ ucnvsel_selectForString(const UConverterSelector* sel,
} else {
limit = NULL;
}
-
+
while (limit == NULL ? *s != 0 : s != limit) {
UChar32 c;
uint16_t pvIndex;
@@ -808,7 +808,7 @@ ucnvsel_selectForUTF8(const UConverterSelector* sel,
if(s!=NULL) {
const char *limit = s + length;
-
+
while (s != limit) {
uint16_t pvIndex;
UTRIE2_U8_NEXT16(sel->trie, s, limit, pvIndex);
diff --git a/deps/icu-small/source/common/ucol_swp.cpp b/deps/icu-small/source/common/ucol_swp.cpp
index 97b5c4aff50c88..1af19863fa84e7 100644
--- a/deps/icu-small/source/common/ucol_swp.cpp
+++ b/deps/icu-small/source/common/ucol_swp.cpp
@@ -173,7 +173,7 @@ swapFormatVersion3(const UDataSwapper *ds,
header.contractionUCACombosSize=udata_readInt32(ds, inHeader->contractionUCACombosSize);
header.scriptToLeadByte= ds->readUInt32(inHeader->scriptToLeadByte);
header.leadByteToScript= ds->readUInt32(inHeader->leadByteToScript);
-
+
/* swap the 32-bit integers in the header */
ds->swapArray32(ds, inHeader, (int32_t)((const char *)&inHeader->jamoSpecial-(const char *)inHeader),
outHeader, pErrorCode);
@@ -244,21 +244,21 @@ swapFormatVersion3(const UDataSwapper *ds,
ds->swapArray16(ds, inBytes+header.contractionUCACombos, (int32_t)count,
outBytes+header.contractionUCACombos, pErrorCode);
}
-
+
/* swap the script to lead bytes */
if(header.scriptToLeadByte!=0) {
int indexCount = ds->readUInt16(*((uint16_t*)(inBytes+header.scriptToLeadByte))); // each entry = 2 * uint16
int dataCount = ds->readUInt16(*((uint16_t*)(inBytes+header.scriptToLeadByte + 2))); // each entry = uint16
- ds->swapArray16(ds, inBytes+header.scriptToLeadByte,
+ ds->swapArray16(ds, inBytes+header.scriptToLeadByte,
4 + (4 * indexCount) + (2 * dataCount),
outBytes+header.scriptToLeadByte, pErrorCode);
}
-
+
/* swap the lead byte to scripts */
if(header.leadByteToScript!=0) {
int indexCount = ds->readUInt16(*((uint16_t*)(inBytes+header.leadByteToScript))); // each entry = uint16
int dataCount = ds->readUInt16(*((uint16_t*)(inBytes+header.leadByteToScript + 2))); // each entry = uint16
- ds->swapArray16(ds, inBytes+header.leadByteToScript,
+ ds->swapArray16(ds, inBytes+header.leadByteToScript,
4 + (2 * indexCount) + (2 * dataCount),
outBytes+header.leadByteToScript, pErrorCode);
}
diff --git a/deps/icu-small/source/common/ucptrie.cpp b/deps/icu-small/source/common/ucptrie.cpp
index b72e318387a186..0004160a238b0e 100644
--- a/deps/icu-small/source/common/ucptrie.cpp
+++ b/deps/icu-small/source/common/ucptrie.cpp
@@ -280,7 +280,7 @@ UChar32 getRange(const void *t, UChar32 start,
int32_t prevI3Block = -1;
int32_t prevBlock = -1;
UChar32 c = start;
- uint32_t trieValue, value;
+ uint32_t trieValue, value = nullValue;
bool haveValue = false;
do {
int32_t i3Block;
diff --git a/deps/icu-small/source/common/ucurr.cpp b/deps/icu-small/source/common/ucurr.cpp
index dba3247fef2c98..dfee3bd3000595 100644
--- a/deps/icu-small/source/common/ucurr.cpp
+++ b/deps/icu-small/source/common/ucurr.cpp
@@ -110,7 +110,7 @@ class EquivIterator : public icu::UMemory {
// Constructor. hash stores the equivalence relationships; s is the string
// for which we find equivalent strings.
inline EquivIterator(const icu::Hashtable& hash, const icu::UnicodeString& s)
- : _hash(hash) {
+ : _hash(hash) {
_start = _current = &s;
}
inline ~EquivIterator() { }
@@ -228,7 +228,7 @@ static const icu::Hashtable* getCurrSymbolsEquiv();
/**
* Cleanup callback func
*/
-static UBool U_CALLCONV
+static UBool U_CALLCONV
isoCodes_cleanup(void)
{
if (gIsoCodes != NULL) {
@@ -242,7 +242,7 @@ isoCodes_cleanup(void)
/**
* Cleanup callback func
*/
-static UBool U_CALLCONV
+static UBool U_CALLCONV
currSymbolsEquiv_cleanup(void)
{
delete const_cast(gCurrSymbolsEquiv);
@@ -365,10 +365,7 @@ U_CDECL_END
#if !UCONFIG_NO_SERVICE
struct CReg;
-static UMutex *gCRegLock() {
- static UMutex m = U_MUTEX_INITIALIZER;
- return &m;
-}
+static UMutex gCRegLock;
static CReg* gCRegHead = 0;
struct CReg : public icu::UMemory {
@@ -394,14 +391,14 @@ struct CReg : public icu::UMemory {
if (status && U_SUCCESS(*status) && _iso && _id) {
CReg* n = new CReg(_iso, _id);
if (n) {
- umtx_lock(gCRegLock());
+ umtx_lock(&gCRegLock);
if (!gCRegHead) {
/* register for the first time */
ucln_common_registerCleanup(UCLN_COMMON_CURRENCY, currency_cleanup);
}
n->next = gCRegHead;
gCRegHead = n;
- umtx_unlock(gCRegLock());
+ umtx_unlock(&gCRegLock);
return n;
}
*status = U_MEMORY_ALLOCATION_ERROR;
@@ -411,7 +408,7 @@ struct CReg : public icu::UMemory {
static UBool unreg(UCurrRegistryKey key) {
UBool found = FALSE;
- umtx_lock(gCRegLock());
+ umtx_lock(&gCRegLock);
CReg** p = &gCRegHead;
while (*p) {
@@ -424,13 +421,13 @@ struct CReg : public icu::UMemory {
p = &((*p)->next);
}
- umtx_unlock(gCRegLock());
+ umtx_unlock(&gCRegLock);
return found;
}
static const UChar* get(const char* id) {
const UChar* result = NULL;
- umtx_lock(gCRegLock());
+ umtx_lock(&gCRegLock);
CReg* p = gCRegHead;
/* register cleanup of the mutex */
@@ -442,7 +439,7 @@ struct CReg : public icu::UMemory {
}
p = p->next;
}
- umtx_unlock(gCRegLock());
+ umtx_unlock(&gCRegLock);
return result;
}
@@ -679,10 +676,10 @@ ucurr_getName(const UChar* currency,
char buf[ISO_CURRENCY_CODE_LENGTH+1];
myUCharsToChars(buf, currency);
-
+
/* Normalize the keyword value to uppercase */
T_CString_toUpperCase(buf);
-
+
const UChar* s = NULL;
ec2 = U_ZERO_ERROR;
LocalUResourceBundlePointer rb(ures_open(U_ICUDATA_CURR, loc, &ec2));
@@ -716,7 +713,9 @@ ucurr_getName(const UChar* currency,
// We no longer support choice format data in names. Data should not contain
// choice patterns.
- *isChoiceFormat = FALSE;
+ if (isChoiceFormat != NULL) {
+ *isChoiceFormat = FALSE;
+ }
if (U_SUCCESS(ec2)) {
U_ASSERT(s != NULL);
return s;
@@ -777,11 +776,11 @@ ucurr_getPluralName(const UChar* currency,
if (U_FAILURE(ec2)) {
// fall back to "other"
ec2 = U_ZERO_ERROR;
- s = ures_getStringByKeyWithFallback(rb, "other", len, &ec2);
+ s = ures_getStringByKeyWithFallback(rb, "other", len, &ec2);
if (U_FAILURE(ec2)) {
ures_close(rb);
// fall back to long name in Currencies
- return ucurr_getName(currency, locale, UCURR_LONG_NAME,
+ return ucurr_getName(currency, locale, UCURR_LONG_NAME,
isChoiceFormat, len, ec);
}
}
@@ -834,7 +833,7 @@ typedef struct {
static int U_CALLCONV currencyNameComparator(const void* a, const void* b) {
const CurrencyNameStruct* currName_1 = (const CurrencyNameStruct*)a;
const CurrencyNameStruct* currName_2 = (const CurrencyNameStruct*)b;
- for (int32_t i = 0;
+ for (int32_t i = 0;
i < MIN(currName_1->currencyNameLen, currName_2->currencyNameLen);
++i) {
if (currName_1->currencyName[i] < currName_2->currencyName[i]) {
@@ -856,7 +855,7 @@ static int U_CALLCONV currencyNameComparator(const void* a, const void* b) {
// Give a locale, return the maximum number of currency names associated with
// this locale.
// It gets currency names from resource bundles using fallback.
-// It is the maximum number because in the fallback chain, some of the
+// It is the maximum number because in the fallback chain, some of the
// currency names are duplicated.
// For example, given locale as "en_US", the currency names get from resource
// bundle in "en_US" and "en" are duplicated. The fallback mechanism will count
@@ -908,7 +907,7 @@ getCurrencyNameCount(const char* loc, int32_t* total_currency_name_count, int32_
}
}
-static UChar*
+static UChar*
toUpperCase(const UChar* source, int32_t len, const char* locale) {
UChar* dest = NULL;
UErrorCode ec = U_ZERO_ERROR;
@@ -919,7 +918,7 @@ toUpperCase(const UChar* source, int32_t len, const char* locale) {
u_strToUpper(dest, destLen, source, len, locale, &ec);
if (U_FAILURE(ec)) {
u_memcpy(dest, source, len);
- }
+ }
return dest;
}
@@ -931,11 +930,11 @@ toUpperCase(const UChar* source, int32_t len, const char* locale) {
// return the malloc-ed currency name arrays and the total number of currency
// names in the array.
static void
-collectCurrencyNames(const char* locale,
- CurrencyNameStruct** currencyNames,
- int32_t* total_currency_name_count,
- CurrencyNameStruct** currencySymbols,
- int32_t* total_currency_symbol_count,
+collectCurrencyNames(const char* locale,
+ CurrencyNameStruct** currencyNames,
+ int32_t* total_currency_name_count,
+ CurrencyNameStruct** currencySymbols,
+ int32_t* total_currency_symbol_count,
UErrorCode& ec) {
U_NAMESPACE_USE
const icu::Hashtable *currencySymbolsEquiv = getCurrSymbolsEquiv();
@@ -987,13 +986,13 @@ collectCurrencyNames(const char* locale,
// TODO: uhash_put wont change key/value?
iso = (char*)ures_getKey(names);
if (localeLevel == 0) {
- uhash_put(currencyIsoCodes, iso, iso, &ec3);
+ uhash_put(currencyIsoCodes, iso, iso, &ec3);
} else {
if (uhash_get(currencyIsoCodes, iso) != NULL) {
ures_close(names);
continue;
} else {
- uhash_put(currencyIsoCodes, iso, iso, &ec3);
+ uhash_put(currencyIsoCodes, iso, iso, &ec3);
}
}
// Add currency symbol.
@@ -1044,19 +1043,19 @@ collectCurrencyNames(const char* locale,
iso = (char*)ures_getKey(names);
// Using hash to remove duplicated ISO codes in fallback chain.
if (localeLevel == 0) {
- uhash_put(currencyPluralIsoCodes, iso, iso, &ec4);
+ uhash_put(currencyPluralIsoCodes, iso, iso, &ec4);
} else {
if (uhash_get(currencyPluralIsoCodes, iso) != NULL) {
ures_close(names);
continue;
} else {
- uhash_put(currencyPluralIsoCodes, iso, iso, &ec4);
+ uhash_put(currencyPluralIsoCodes, iso, iso, &ec4);
}
}
int32_t num = ures_getSize(names);
int32_t len;
for (int32_t j = 0; j < num; ++j) {
- // TODO: remove duplicates between singular name and
+ // TODO: remove duplicates between singular name and
// currency long name?
s = ures_getStringByIndex(names, j, &len, &ec5);
(*currencyNames)[*total_currency_name_count].IsoCode = iso;
@@ -1080,9 +1079,9 @@ collectCurrencyNames(const char* locale,
uhash_close(currencyPluralIsoCodes);
// quick sort the struct
- qsort(*currencyNames, *total_currency_name_count,
+ qsort(*currencyNames, *total_currency_name_count,
sizeof(CurrencyNameStruct), currencyNameComparator);
- qsort(*currencySymbols, *total_currency_symbol_count,
+ qsort(*currencySymbols, *total_currency_symbol_count,
sizeof(CurrencyNameStruct), currencyNameComparator);
#ifdef UCURR_DEBUG
@@ -1119,13 +1118,13 @@ collectCurrencyNames(const char* locale,
}
// @param currencyNames: currency names array
-// @param indexInCurrencyNames: the index of the character in currency names
+// @param indexInCurrencyNames: the index of the character in currency names
// array against which the comparison is done
// @param key: input text char to compare against
// @param begin(IN/OUT): the begin index of matching range in currency names array
// @param end(IN/OUT): the end index of matching range in currency names array.
static int32_t
-binarySearch(const CurrencyNameStruct* currencyNames,
+binarySearch(const CurrencyNameStruct* currencyNames,
int32_t indexInCurrencyNames,
const UChar key,
int32_t* begin, int32_t* end) {
@@ -1239,7 +1238,7 @@ binarySearch(const CurrencyNameStruct* currencyNames,
// @param maxMatchIndex: the index in currencyName which has the longest
// match with input text.
static void
-linearSearch(const CurrencyNameStruct* currencyNames,
+linearSearch(const CurrencyNameStruct* currencyNames,
int32_t begin, int32_t end,
const UChar* text, int32_t textLen,
int32_t *partialMatchLen,
@@ -1278,7 +1277,7 @@ linearSearch(const CurrencyNameStruct* currencyNames,
// @param maxMatchIndex: the index in currencyName which has the longest
// match with input text.
static void
-searchCurrencyName(const CurrencyNameStruct* currencyNames,
+searchCurrencyName(const CurrencyNameStruct* currencyNames,
int32_t total_currency_count,
const UChar* text, int32_t textLen,
int32_t *partialMatchLen,
@@ -1312,8 +1311,8 @@ searchCurrencyName(const CurrencyNameStruct* currencyNames,
break;
}
*partialMatchLen = MAX(*partialMatchLen, index + 1);
- if (matchIndex != -1) {
- // find an exact match for text from text[0] to text[index]
+ if (matchIndex != -1) {
+ // find an exact match for text from text[0] to text[index]
// in currencyNames array.
*maxMatchLen = index + 1;
*maxMatchIndex = matchIndex;
@@ -1342,7 +1341,7 @@ typedef struct {
// reference count.
// reference count is set to 1 when an entry is put to cache.
// it increases by 1 before accessing, and decreased by 1 after accessing.
- // The entry is deleted when ref count is zero, which means
+ // The entry is deleted when ref count is zero, which means
// the entry is replaced out of cache and no process is accessing it.
int32_t refCount;
} CurrencyNameCacheEntry;
@@ -1356,10 +1355,7 @@ static CurrencyNameCacheEntry* currCache[CURRENCY_NAME_CACHE_NUM] = {NULL};
// It is a simple round-robin replacement strategy.
static int8_t currentCacheEntryIndex = 0;
-static UMutex *gCurrencyCacheMutex() {
- static UMutex m = U_MUTEX_INITIALIZER;
- return &m;
-}
+static UMutex gCurrencyCacheMutex;
// Cache deletion
static void
@@ -1408,7 +1404,7 @@ getCacheEntry(const char* locale, UErrorCode& ec) {
CurrencyNameStruct* currencySymbols = NULL;
CurrencyNameCacheEntry* cacheEntry = NULL;
- umtx_lock(gCurrencyCacheMutex());
+ umtx_lock(&gCurrencyCacheMutex);
// in order to handle racing correctly,
// not putting 'search' in a separate function.
int8_t found = -1;
@@ -1423,13 +1419,13 @@ getCacheEntry(const char* locale, UErrorCode& ec) {
cacheEntry = currCache[found];
++(cacheEntry->refCount);
}
- umtx_unlock(gCurrencyCacheMutex());
+ umtx_unlock(&gCurrencyCacheMutex);
if (found == -1) {
collectCurrencyNames(locale, ¤cyNames, &total_currency_name_count, ¤cySymbols, &total_currency_symbol_count, ec);
if (U_FAILURE(ec)) {
return NULL;
}
- umtx_lock(gCurrencyCacheMutex());
+ umtx_lock(&gCurrencyCacheMutex);
// check again.
for (int8_t i = 0; i < CURRENCY_NAME_CACHE_NUM; ++i) {
if (currCache[i]!= NULL &&
@@ -1439,9 +1435,9 @@ getCacheEntry(const char* locale, UErrorCode& ec) {
}
}
if (found == -1) {
- // insert new entry to
+ // insert new entry to
// currentCacheEntryIndex % CURRENCY_NAME_CACHE_NUM
- // and remove the existing entry
+ // and remove the existing entry
// currentCacheEntryIndex % CURRENCY_NAME_CACHE_NUM
// from cache.
cacheEntry = currCache[currentCacheEntryIndex];
@@ -1468,19 +1464,19 @@ getCacheEntry(const char* locale, UErrorCode& ec) {
cacheEntry = currCache[found];
++(cacheEntry->refCount);
}
- umtx_unlock(gCurrencyCacheMutex());
+ umtx_unlock(&gCurrencyCacheMutex);
}
return cacheEntry;
}
static void releaseCacheEntry(CurrencyNameCacheEntry* cacheEntry) {
- umtx_lock(gCurrencyCacheMutex());
+ umtx_lock(&gCurrencyCacheMutex);
--(cacheEntry->refCount);
if (cacheEntry->refCount == 0) { // remove
deleteCacheEntry(cacheEntry);
}
- umtx_unlock(gCurrencyCacheMutex());
+ umtx_unlock(&gCurrencyCacheMutex);
}
U_CAPI void
@@ -1507,8 +1503,8 @@ uprv_parseCurrency(const char* locale,
int32_t start = pos.getIndex();
- UChar inputText[MAX_CURRENCY_NAME_LEN];
- UChar upperText[MAX_CURRENCY_NAME_LEN];
+ UChar inputText[MAX_CURRENCY_NAME_LEN];
+ UChar upperText[MAX_CURRENCY_NAME_LEN];
int32_t textLen = MIN(MAX_CURRENCY_NAME_LEN, text.length() - start);
text.extract(start, textLen, inputText);
UErrorCode ec1 = U_ZERO_ERROR;
@@ -1520,7 +1516,7 @@ uprv_parseCurrency(const char* locale,
int32_t max = 0;
int32_t matchIndex = -1;
// case in-sensitive comparision against currency names
- searchCurrencyName(currencyNames, total_currency_name_count,
+ searchCurrencyName(currencyNames, total_currency_name_count,
upperText, textLen, partialMatchLen, &max, &matchIndex);
#ifdef UCURR_DEBUG
@@ -1531,7 +1527,7 @@ uprv_parseCurrency(const char* locale,
int32_t matchIndexInSymbol = -1;
if (type != UCURR_LONG_NAME) { // not name only
// case sensitive comparison against currency symbols and ISO code.
- searchCurrencyName(currencySymbols, total_currency_symbol_count,
+ searchCurrencyName(currencySymbols, total_currency_symbol_count,
inputText, textLen,
partialMatchLen,
&maxInSymbol, &matchIndexInSymbol);
@@ -1601,10 +1597,9 @@ uprv_getStaticCurrencyName(const UChar* iso, const char* loc,
{
U_NAMESPACE_USE
- UBool isChoiceFormat;
int32_t len;
const UChar* currname = ucurr_getName(iso, loc, UCURR_SYMBOL_NAME,
- &isChoiceFormat, &len, &ec);
+ nullptr /* isChoiceFormat */, &len, &ec);
if (U_SUCCESS(ec)) {
result.setTo(currname, len);
}
@@ -2062,11 +2057,11 @@ ucurr_createCurrencyList(UHashtable *isoCodes, UErrorCode* status){
UResourceBundle *currencyMapArray = ures_getByKey(rb, CURRENCY_MAP, rb, &localStatus);
if (U_SUCCESS(localStatus)) {
- // process each entry in currency map
+ // process each entry in currency map
for (int32_t i=0; icontext = values;
-
+
UResourceBundle *bundle = ures_openDirect(U_ICUDATA_CURR, "supplementalData", status);
ures_getByKey(bundle, "CurrencyMap", bundle, status);
UResourceBundle bundlekey, regbndl, curbndl, to;
@@ -2554,7 +2549,7 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key,
ures_initStackObject(®bndl);
ures_initStackObject(&curbndl);
ures_initStackObject(&to);
-
+
while (U_SUCCESS(*status) && ures_hasNext(bundle)) {
ures_getNextResource(bundle, &bundlekey, status);
if (U_FAILURE(*status)) {
@@ -2595,11 +2590,11 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key,
if(curIDLength+1 > ULOC_KEYWORDS_CAPACITY) {
*status = U_BUFFER_OVERFLOW_ERROR;
} else {
- u_UCharsToChars(defString, curID, curIDLength+1);
+ u_UCharsToChars(defString, curID, curIDLength+1);
}
}
}
-#endif
+#endif
if (U_FAILURE(*status)) {
break;
@@ -2621,7 +2616,7 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key,
uprv_free(curID);
}
}
-
+
}
if (U_SUCCESS(*status)) {
if (commonlyUsed) {
@@ -2646,7 +2641,7 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key,
}
}
}
-
+
ulist_resetList((UList *)(en->context));
} else {
ulist_deleteList(values);
@@ -2659,9 +2654,9 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key,
ures_close(®bndl);
ures_close(&bundlekey);
ures_close(bundle);
-
+
ulist_deleteList(otherValues);
-
+
return en;
}
diff --git a/deps/icu-small/source/common/udata.cpp b/deps/icu-small/source/common/udata.cpp
index 99efbc97eed737..ec9c999cea41a6 100644
--- a/deps/icu-small/source/common/udata.cpp
+++ b/deps/icu-small/source/common/udata.cpp
@@ -33,6 +33,7 @@ might have to #include some other header
#include "cstring.h"
#include "mutex.h"
#include "putilimp.h"
+#include "restrace.h"
#include "uassert.h"
#include "ucln_cmn.h"
#include "ucmndata.h"
@@ -110,11 +111,12 @@ static u_atomic_int32_t gHaveTriedToLoadCommonData = ATOMIC_INT32_T_INITIALIZER(
static UHashtable *gCommonDataCache = NULL; /* Global hash table of opened ICU data files. */
static icu::UInitOnce gCommonDataCacheInitOnce = U_INITONCE_INITIALIZER;
-#if U_PLATFORM_HAS_WINUWP_API == 0
+#if !defined(ICU_DATA_DIR_WINDOWS)
static UDataFileAccess gDataFileAccess = UDATA_DEFAULT_ACCESS; // Access not synchronized.
// Modifying is documented as thread-unsafe.
#else
-static UDataFileAccess gDataFileAccess = UDATA_NO_FILES; // Windows UWP looks in one spot explicitly
+// If we are using the Windows data directory, then look in one spot only.
+static UDataFileAccess gDataFileAccess = UDATA_NO_FILES;
#endif
static UBool U_CALLCONV
@@ -206,7 +208,7 @@ setCommonICUData(UDataMemory *pData, /* The new common data. Belongs to ca
return didUpdate;
}
-#if U_PLATFORM_HAS_WINUWP_API == 0
+#if !defined(ICU_DATA_DIR_WINDOWS)
static UBool
setCommonICUDataPointer(const void *pData, UBool /*warn*/, UErrorCode *pErrorCode) {
@@ -320,7 +322,7 @@ static UDataMemory *udata_findCachedData(const char *path, UErrorCode &err)
retVal = el->item;
}
#ifdef UDATA_DEBUG
- fprintf(stderr, "Cache: [%s] -> %p\n", baseName, retVal);
+ fprintf(stderr, "Cache: [%s] -> %p\n", baseName, (void*) retVal);
#endif
return retVal;
}
@@ -382,8 +384,8 @@ static UDataMemory *udata_cacheDataItem(const char *path, UDataMemory *item, UEr
umtx_unlock(NULL);
#ifdef UDATA_DEBUG
- fprintf(stderr, "Cache: [%s] <<< %p : %s. vFunc=%p\n", newElement->name,
- newElement->item, u_errorName(subErr), newElement->item->vFuncs);
+ fprintf(stderr, "Cache: [%s] <<< %p : %s. vFunc=%p\n", newElement->name,
+ (void*) newElement->item, u_errorName(subErr), (void*) newElement->item->vFuncs);
#endif
if (subErr == U_USING_DEFAULT_WARNING || U_FAILURE(subErr)) {
@@ -434,13 +436,13 @@ class UDataPathIterator
/**
* @param iter The iterator to be initialized. Its current state does not matter.
- * @param inPath The full pathname to be iterated over. If NULL, defaults to U_ICUDATA_NAME
- * @param pkg Package which is being searched for, ex "icudt28l". Will ignore leaf directories such as /icudt28l
- * @param item Item to be searched for. Can include full path, such as /a/b/foo.dat
+ * @param inPath The full pathname to be iterated over. If NULL, defaults to U_ICUDATA_NAME
+ * @param pkg Package which is being searched for, ex "icudt28l". Will ignore leaf directories such as /icudt28l
+ * @param item Item to be searched for. Can include full path, such as /a/b/foo.dat
* @param inSuffix Optional item suffix, if not-null (ex. ".dat") then 'path' can contain 'item' explicitly.
- * Ex: 'stuff.dat' would be found in '/a/foo:/tmp/stuff.dat:/bar/baz' as item #2.
+ * Ex: 'stuff.dat' would be found in '/a/foo:/tmp/stuff.dat:/bar/baz' as item #2.
* '/blarg/stuff.dat' would also be found.
- * Note: inSuffix may also be the 'item' being searched for as well, (ex: "ibm-5348_P100-1997.cnv"), in which case
+ * Note: inSuffix may also be the 'item' being searched for as well, (ex: "ibm-5348_P100-1997.cnv"), in which case
* the 'item' parameter is often the same as pkg. (Though sometimes might have a tree part as well, ex: "icudt62l-curr").
*/
UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg,
@@ -477,7 +479,7 @@ UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg,
nextPath = itemPath.data();
}
#ifdef UDATA_DEBUG
- fprintf(stderr, "SUFFIX=%s [%p]\n", inSuffix, inSuffix);
+ fprintf(stderr, "SUFFIX=%s [%p]\n", inSuffix, (void*) inSuffix);
#endif
/** Suffix **/
@@ -492,12 +494,11 @@ UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg,
/* pathBuffer will hold the output path strings returned by this iterator */
#ifdef UDATA_DEBUG
- fprintf(stderr, "%p: init %s -> [path=%s], [base=%s], [suff=%s], [itempath=%s], [nextpath=%s], [checklast4=%s]\n",
- iter,
+ fprintf(stderr, "0: init %s -> [path=%s], [base=%s], [suff=%s], [itempath=%s], [nextpath=%s], [checklast4=%s]\n",
item,
path,
basename,
- suffix,
+ suffix.data(),
itemPath.data(),
nextPath,
checkLastFour?"TRUE":"false");
@@ -507,8 +508,8 @@ UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg,
/**
* Get the next path on the list.
*
- * @param iter The Iter to be used
- * @param len If set, pointer to the length of the returned path, for convenience.
+ * @param iter The Iter to be used
+ * @param len If set, pointer to the length of the returned path, for convenience.
* @return Pointer to the next path segment, or NULL if there are no more.
*/
const char *UDataPathIterator::next(UErrorCode *pErrorCode)
@@ -536,7 +537,7 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode)
nextPath = uprv_strchr(currentPath, U_PATH_SEP_CHAR);
if(nextPath == NULL) {
/* segment: entire path */
- pathLen = (int32_t)uprv_strlen(currentPath);
+ pathLen = (int32_t)uprv_strlen(currentPath);
} else {
/* segment: until next segment */
pathLen = (int32_t)(nextPath - currentPath);
@@ -552,8 +553,8 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode)
#ifdef UDATA_DEBUG
fprintf(stderr, "rest of path (IDD) = %s\n", currentPath);
fprintf(stderr, " ");
- {
- uint32_t qqq;
+ {
+ int32_t qqq;
for(qqq=0;qqq=4) &&
uprv_strncmp(pathBuffer.data() +(pathLen-4), suffix.data(), 4)==0 && /* suffix matches */
uprv_strncmp(findBasename(pathBuffer.data()), basename, basenameLen)==0 && /* base matches */
uprv_strlen(pathBasename)==(basenameLen+4)) { /* base+suffix = full len */
#ifdef UDATA_DEBUG
- fprintf(stderr, "Have %s file on the path: %s\n", suffix, pathBuffer.data());
+ fprintf(stderr, "Have %s file on the path: %s\n", suffix.data(), pathBuffer.data());
#endif
/* do nothing */
}
- else
+ else
{ /* regular dir path */
if(pathBuffer[pathLen-1] != U_FILE_SEP_CHAR) {
if((pathLen>=4) &&
@@ -640,7 +641,8 @@ U_NAMESPACE_END
* our common data. *
* *
*----------------------------------------------------------------------*/
-#if U_PLATFORM_HAS_WINUWP_API == 0 // Windows UWP Platform does not support dll icu data at this time
+#if !defined(ICU_DATA_DIR_WINDOWS)
+// When using the Windows system data, we expect only a single data file.
extern "C" const DataHeader U_DATA_API U_ICUDATA_ENTRY_POINT;
#endif
@@ -679,7 +681,7 @@ openCommonData(const char *path, /* Path from OpenChoice? */
UDataMemory_init(&tData);
- /* ??????? TODO revisit this */
+ /* ??????? TODO revisit this */
if (commonDataIndex >= 0) {
/* "mini-cache" for common ICU data */
if(commonDataIndex >= UPRV_LENGTHOF(gCommonICUDataArray)) {
@@ -690,7 +692,8 @@ openCommonData(const char *path, /* Path from OpenChoice? */
if(gCommonICUDataArray[commonDataIndex] != NULL) {
return gCommonICUDataArray[commonDataIndex];
}
-#if U_PLATFORM_HAS_WINUWP_API == 0 // Windows UWP Platform does not support dll icu data at this time
+#if !defined(ICU_DATA_DIR_WINDOWS)
+// When using the Windows system data, we expect only a single data file.
int32_t i;
for(i = 0; i < commonDataIndex; ++i) {
if(gCommonICUDataArray[i]->pHeader == &U_ICUDATA_ENTRY_POINT) {
@@ -714,7 +717,8 @@ openCommonData(const char *path, /* Path from OpenChoice? */
setCommonICUDataPointer(uprv_getICUData_conversion(), FALSE, pErrorCode);
}
*/
-#if U_PLATFORM_HAS_WINUWP_API == 0 // Windows UWP Platform does not support dll icu data at this time
+#if !defined(ICU_DATA_DIR_WINDOWS)
+// When using the Windows system data, we expect only a single data file.
setCommonICUDataPointer(&U_ICUDATA_ENTRY_POINT, FALSE, pErrorCode);
{
Mutex lock;
@@ -831,7 +835,7 @@ static UBool extendICUData(UErrorCode *pErr)
* Use a specific mutex to avoid nested locks of the global mutex.
*/
#if MAP_IMPLEMENTATION==MAP_STDIO
- static UMutex extendICUDataMutex = U_MUTEX_INITIALIZER;
+ static UMutex extendICUDataMutex;
umtx_lock(&extendICUDataMutex);
#endif
if(!umtx_loadAcquire(gHaveTriedToLoadCommonData)) {
@@ -979,9 +983,9 @@ checkDataItem
}
/**
- * @return 0 if not loaded, 1 if loaded or err
+ * @return 0 if not loaded, 1 if loaded or err
*/
-static UDataMemory *doLoadFromIndividualFiles(const char *pkgName,
+static UDataMemory *doLoadFromIndividualFiles(const char *pkgName,
const char *dataPath, const char *tocEntryPathSuffix,
/* following arguments are the same as doOpenChoice itself */
const char *path, const char *type, const char *name,
@@ -1037,9 +1041,9 @@ static UDataMemory *doLoadFromIndividualFiles(const char *pkgName,
}
/**
- * @return 0 if not loaded, 1 if loaded or err
+ * @return 0 if not loaded, 1 if loaded or err
*/
-static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName*/,
+static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName*/,
const char * /*dataPath*/, const char * /*tocEntryPathSuffix*/, const char *tocEntryName,
/* following arguments are the same as doOpenChoice itself */
const char *path, const char *type, const char *name,
@@ -1070,13 +1074,13 @@ static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName
/* look up the data piece in the common data */
pHeader=pCommonData->vFuncs->Lookup(pCommonData, tocEntryName, &length, subErrorCode);
#ifdef UDATA_DEBUG
- fprintf(stderr, "%s: pHeader=%p - %s\n", tocEntryName, pHeader, u_errorName(*subErrorCode));
+ fprintf(stderr, "%s: pHeader=%p - %s\n", tocEntryName, (void*) pHeader, u_errorName(*subErrorCode));
#endif
if(pHeader!=NULL) {
pEntryData = checkDataItem(pHeader, isAcceptable, context, type, name, subErrorCode, pErrorCode);
#ifdef UDATA_DEBUG
- fprintf(stderr, "pEntryData=%p\n", pEntryData);
+ fprintf(stderr, "pEntryData=%p\n", (void*) pEntryData);
#endif
if (U_FAILURE(*pErrorCode)) {
return NULL;
@@ -1168,11 +1172,14 @@ doOpenChoice(const char *path, const char *type, const char *name,
UBool isICUData = FALSE;
+ FileTracer::traceOpen(path, type, name);
+
+
/* Is this path ICU data? */
if(path == NULL ||
!strcmp(path, U_ICUDATA_ALIAS) || /* "ICUDATA" */
!uprv_strncmp(path, U_ICUDATA_NAME U_TREE_SEPARATOR_STRING, /* "icudt26e-" */
- uprv_strlen(U_ICUDATA_NAME U_TREE_SEPARATOR_STRING)) ||
+ uprv_strlen(U_ICUDATA_NAME U_TREE_SEPARATOR_STRING)) ||
!uprv_strncmp(path, U_ICUDATA_ALIAS U_TREE_SEPARATOR_STRING, /* "ICUDATA-" */
uprv_strlen(U_ICUDATA_ALIAS U_TREE_SEPARATOR_STRING))) {
isICUData = TRUE;
@@ -1219,7 +1226,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
}
} else {
treeChar = uprv_strchr(path, U_TREE_SEPARATOR);
- if(treeChar) {
+ if(treeChar) {
treeName.append(treeChar+1, *pErrorCode); /* following '-' */
if(isICUData) {
pkgName.append(U_ICUDATA_NAME, *pErrorCode);
@@ -1247,7 +1254,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
fprintf(stderr, " P=%s T=%s\n", pkgName.data(), treeName.data());
#endif
- /* setting up the entry name and file name
+ /* setting up the entry name and file name
* Make up a full name by appending the type to the supplied
* name, assuming that a type was supplied.
*/
@@ -1276,12 +1283,12 @@ doOpenChoice(const char *path, const char *type, const char *name,
fprintf(stderr, " tocEntryPath = %s\n", tocEntryName.data());
#endif
-#if U_PLATFORM_HAS_WINUWP_API == 0 // Windows UWP Platform does not support dll icu data at this time
+#if !defined(ICU_DATA_DIR_WINDOWS)
if(path == NULL) {
path = COMMON_DATA_NAME; /* "icudt26e" */
}
#else
- // Windows UWP expects only a single data file.
+ // When using the Windows system data, we expects only a single data file.
path = COMMON_DATA_NAME; /* "icudt26e" */
#endif
@@ -1314,7 +1321,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
fprintf(stderr, "Trying packages (UDATA_PACKAGES_FIRST)\n");
#endif
/* #2 */
- retVal = doLoadFromCommonData(isICUData,
+ retVal = doLoadFromCommonData(isICUData,
pkgName.data(), dataPath, tocEntryPathSuffix, tocEntryName.data(),
path, type, name, isAcceptable, context, &subErrorCode, pErrorCode);
if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
@@ -1339,7 +1346,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
}
/**** COMMON PACKAGE */
- if((gDataFileAccess==UDATA_ONLY_PACKAGES) ||
+ if((gDataFileAccess==UDATA_ONLY_PACKAGES) ||
(gDataFileAccess==UDATA_FILES_FIRST)) {
#ifdef UDATA_DEBUG
fprintf(stderr, "Trying packages (UDATA_ONLY_PACKAGES || UDATA_FILES_FIRST)\n");
@@ -1351,10 +1358,10 @@ doOpenChoice(const char *path, const char *type, const char *name,
return retVal;
}
}
-
+
/* Load from DLL. If we haven't attempted package load, we also haven't had any chance to
try a DLL (static or setCommonData/etc) load.
- If we ever have a "UDATA_ONLY_FILES", add it to the or list here. */
+ If we ever have a "UDATA_ONLY_FILES", add it to the or list here. */
if(gDataFileAccess==UDATA_NO_FILES) {
#ifdef UDATA_DEBUG
fprintf(stderr, "Trying common data (UDATA_NO_FILES)\n");
diff --git a/deps/icu-small/source/common/uelement.h b/deps/icu-small/source/common/uelement.h
index 9d45f09fb87f65..05f36a098253dd 100644
--- a/deps/icu-small/source/common/uelement.h
+++ b/deps/icu-small/source/common/uelement.h
@@ -74,7 +74,7 @@ U_CDECL_END
* @param key2 The string for comparison
* @return true if key1 and key2 are equal, return false otherwise.
*/
-U_CAPI UBool U_EXPORT2
+U_CAPI UBool U_EXPORT2
uhash_compareUnicodeString(const UElement key1, const UElement key2);
/**
@@ -85,7 +85,7 @@ uhash_compareUnicodeString(const UElement key1, const UElement key2);
* @param key2 The string for comparison
* @return true if key1 and key2 are equal, return false otherwise.
*/
-U_CAPI UBool U_EXPORT2
+U_CAPI UBool U_EXPORT2
uhash_compareCaselessUnicodeString(const UElement key1, const UElement key2);
#endif /* __UELEMENT_H__ */
diff --git a/deps/icu-small/source/common/uenum.cpp b/deps/icu-small/source/common/uenum.cpp
index f75cfb7ac3ff6a..11d895ebcd7463 100644
--- a/deps/icu-small/source/common/uenum.cpp
+++ b/deps/icu-small/source/common/uenum.cpp
@@ -51,7 +51,7 @@ static void* _getBuffer(UEnumeration* en, int32_t capacity) {
}
((_UEnumBuffer*) en->baseContext)->len = capacity;
}
-
+
return (void*) & ((_UEnumBuffer*) en->baseContext)->data;
}
diff --git a/deps/icu-small/source/common/uenumimp.h b/deps/icu-small/source/common/uenumimp.h
index 93854406403b39..9c9df75ae0497a 100644
--- a/deps/icu-small/source/common/uenumimp.h
+++ b/deps/icu-small/source/common/uenumimp.h
@@ -23,14 +23,14 @@
U_CDECL_BEGIN
-/**
- * following are the type declarations for
+/**
+ * following are the type declarations for
* implementations of APIs. If any of these
* functions are NULL, U_UNSUPPORTED_ERROR
* is returned. If close is NULL, the enumeration
* object is going to be released.
* Initial error checking is done in the body
- * of API function, so the implementations
+ * of API function, so the implementations
* need not to check the initial error condition.
*/
@@ -63,13 +63,13 @@ UEnumCount(UEnumeration *en, UErrorCode *status);
* This function returns the next element as a UChar *,
* or NULL after all elements haven been enumerated.
*
- * @param en enumeration
+ * @param en enumeration
* @param resultLength pointer to result length
* @param status pointer to UErrorCode variable
* @return next element as UChar *,
* or NULL after all elements haven been enumerated
*/
-typedef const UChar* U_CALLCONV
+typedef const UChar* U_CALLCONV
UEnumUNext(UEnumeration* en,
int32_t* resultLength,
UErrorCode* status);
@@ -80,13 +80,13 @@ UEnumUNext(UEnumeration* en,
* This function returns the next element as a char *,
* or NULL after all elements haven been enumerated.
*
- * @param en enumeration
+ * @param en enumeration
* @param resultLength pointer to result length
* @param status pointer to UErrorCode variable
* @return next element as char *,
* or NULL after all elements haven been enumerated
*/
-typedef const char* U_CALLCONV
+typedef const char* U_CALLCONV
UEnumNext(UEnumeration* en,
int32_t* resultLength,
UErrorCode* status);
@@ -94,14 +94,14 @@ UEnumNext(UEnumeration* en,
/**
* Function type declaration for uenum_reset().
*
- * This function should reset the enumeration
+ * This function should reset the enumeration
* object
*
- * @param en enumeration
+ * @param en enumeration
* @param status pointer to UErrorCode variable
*/
-typedef void U_CALLCONV
-UEnumReset(UEnumeration* en,
+typedef void U_CALLCONV
+UEnumReset(UEnumeration* en,
UErrorCode* status);
@@ -112,8 +112,8 @@ struct UEnumeration {
/* context. Use it for what you need */
void *context;
- /**
- * these are functions that will
+ /**
+ * these are functions that will
* be used for APIs
*/
/* called from uenum_close */
diff --git a/deps/icu-small/source/common/uhash.cpp b/deps/icu-small/source/common/uhash.cpp
index 79241a282913ed..86311ceb0b25d1 100644
--- a/deps/icu-small/source/common/uhash.cpp
+++ b/deps/icu-small/source/common/uhash.cpp
@@ -119,13 +119,14 @@ static const float RESIZE_POLICY_RATIO_TABLE[6] = {
/* This macro expects a UHashTok.pointer as its keypointer and
valuepointer parameters */
-#define HASH_DELETE_KEY_VALUE(hash, keypointer, valuepointer) \
- if (hash->keyDeleter != NULL && keypointer != NULL) { \
- (*hash->keyDeleter)(keypointer); \
- } \
- if (hash->valueDeleter != NULL && valuepointer != NULL) { \
- (*hash->valueDeleter)(valuepointer); \
- }
+#define HASH_DELETE_KEY_VALUE(hash, keypointer, valuepointer) UPRV_BLOCK_MACRO_BEGIN { \
+ if (hash->keyDeleter != NULL && keypointer != NULL) { \
+ (*hash->keyDeleter)(keypointer); \
+ } \
+ if (hash->valueDeleter != NULL && valuepointer != NULL) { \
+ (*hash->valueDeleter)(valuepointer); \
+ } \
+} UPRV_BLOCK_MACRO_END
/*
* Constants for hinting whether a key or value is an integer
diff --git a/deps/icu-small/source/common/uidna.cpp b/deps/icu-small/source/common/uidna.cpp
index 6d56fcb8f517af..ac2f9c3c8cd963 100644
--- a/deps/icu-small/source/common/uidna.cpp
+++ b/deps/icu-small/source/common/uidna.cpp
@@ -47,7 +47,7 @@ static const UChar ACE_PREFIX[] ={ 0x0078,0x006E,0x002d,0x002d } ;
#define CAPITAL_A 0x0041
#define CAPITAL_Z 0x005A
-inline static UChar
+inline static UChar
toASCIILower(UChar ch){
if(CAPITAL_A <= ch && ch <= CAPITAL_Z){
return ch + LOWER_CASE_DELTA;
@@ -55,27 +55,25 @@ toASCIILower(UChar ch){
return ch;
}
-inline static UBool
+inline static UBool
startsWithPrefix(const UChar* src , int32_t srcLength){
- UBool startsWithPrefix = TRUE;
-
if(srcLength < ACE_PREFIX_LENGTH){
return FALSE;
}
for(int8_t i=0; i< ACE_PREFIX_LENGTH; i++){
if(toASCIILower(src[i]) != ACE_PREFIX[i]){
- startsWithPrefix = FALSE;
+ return FALSE;
}
}
- return startsWithPrefix;
+ return TRUE;
}
inline static int32_t
-compareCaseInsensitiveASCII(const UChar* s1, int32_t s1Len,
+compareCaseInsensitiveASCII(const UChar* s1, int32_t s1Len,
const UChar* s2, int32_t s2Len){
-
+
int32_t minLength;
int32_t lengthResult;
@@ -103,10 +101,10 @@ compareCaseInsensitiveASCII(const UChar* s1, int32_t s1Len,
if(i == minLength) {
return lengthResult;
}
-
+
c1 = s1[i];
c2 = s2[i];
-
+
/* Case-insensitive comparison */
if(c1!=c2) {
rc=(int32_t)toASCIILower(c1)-(int32_t)toASCIILower(c2);
@@ -121,9 +119,9 @@ compareCaseInsensitiveASCII(const UChar* s1, int32_t s1Len,
/**
- * Ascertain if the given code point is a label separator as
+ * Ascertain if the given code point is a label separator as
* defined by the IDNA RFC
- *
+ *
* @param ch The code point to be ascertained
* @return true if the char is a label separator
* @stable ICU 2.8
@@ -136,12 +134,12 @@ static inline UBool isLabelSeparator(UChar ch){
case 0xFF61:
return TRUE;
default:
- return FALSE;
+ return FALSE;
}
}
// returns the length of the label excluding the separator
-// if *limit == separator then the length returned does not include
+// if *limit == separator then the length returned does not include
// the separtor.
static inline int32_t
getNextSeparator(UChar *src, int32_t srcLength,
@@ -157,7 +155,7 @@ getNextSeparator(UChar *src, int32_t srcLength,
if(isLabelSeparator(src[i])){
*limit = src + (i+1); // go past the delimiter
return i;
-
+
}
}
}else{
@@ -182,7 +180,7 @@ static inline UBool isLDHChar(UChar ch){
return FALSE;
}
//[\\u002D \\u0030-\\u0039 \\u0041-\\u005A \\u0061-\\u007A]
- if( (ch==0x002D) ||
+ if( (ch==0x002D) ||
(0x0030 <= ch && ch <= 0x0039) ||
(0x0041 <= ch && ch <= 0x005A) ||
(0x0061 <= ch && ch <= 0x007A)
@@ -192,8 +190,8 @@ static inline UBool isLDHChar(UChar ch){
return FALSE;
}
-static int32_t
-_internal_toASCII(const UChar* src, int32_t srcLength,
+static int32_t
+_internal_toASCII(const UChar* src, int32_t srcLength,
UChar* dest, int32_t destCapacity,
int32_t options,
UStringPrepProfile* nameprep,
@@ -205,18 +203,18 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
UChar b1Stack[MAX_LABEL_BUFFER_SIZE], b2Stack[MAX_LABEL_BUFFER_SIZE];
//initialize pointers to stack buffers
UChar *b1 = b1Stack, *b2 = b2Stack;
- int32_t b1Len=0, b2Len,
- b1Capacity = MAX_LABEL_BUFFER_SIZE,
+ int32_t b1Len=0, b2Len,
+ b1Capacity = MAX_LABEL_BUFFER_SIZE,
b2Capacity = MAX_LABEL_BUFFER_SIZE ,
reqLength=0;
int32_t namePrepOptions = ((options & UIDNA_ALLOW_UNASSIGNED) != 0) ? USPREP_ALLOW_UNASSIGNED: 0;
UBool* caseFlags = NULL;
-
+
// the source contains all ascii codepoints
UBool srcIsASCII = TRUE;
// assume the source contains all LDH codepoints
- UBool srcIsLDH = TRUE;
+ UBool srcIsLDH = TRUE;
int32_t j=0;
@@ -224,11 +222,11 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
UBool useSTD3ASCIIRules = (UBool)((options & UIDNA_USE_STD3_RULES) != 0);
int32_t failPos = -1;
-
+
if(srcLength == -1){
srcLength = u_strlen(src);
}
-
+
if(srcLength > b1Capacity){
b1 = (UChar*) uprv_malloc(srcLength * U_SIZEOF_UCHAR);
if(b1==NULL){
@@ -238,18 +236,18 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
b1Capacity = srcLength;
}
- // step 1
+ // step 1
for( j=0;j 0x7F){
srcIsASCII = FALSE;
}
b1[b1Len++] = src[j];
}
-
+
// step 2 is performed only if the source contains non ASCII
if(srcIsASCII == FALSE){
-
- // step 2
+
+ // step 2
b1Len = usprep_prepare(nameprep, src, srcLength, b1, b1Capacity, namePrepOptions, parseError, status);
if(*status == U_BUFFER_OVERFLOW_ERROR){
@@ -265,7 +263,7 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
}
*status = U_ZERO_ERROR; // reset error
-
+
b1Len = usprep_prepare(nameprep, src, srcLength, b1, b1Len, namePrepOptions, parseError, status);
}
}
@@ -281,7 +279,7 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
// for step 3 & 4
srcIsASCII = TRUE;
for( j=0;j 0x7F){
srcIsASCII = FALSE;
}else if(isLDHChar(b1[j])==FALSE){ // if the char is in ASCII range verify that it is an LDH character
@@ -305,7 +303,7 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
// failPos is always set the index of failure
uprv_syntaxError(b1,failPos, b1Len,parseError);
}else if(b1[0] == HYPHEN){
- // fail position is 0
+ // fail position is 0
uprv_syntaxError(b1,0,b1Len,parseError);
}else{
// the last index in the source is always length-1
@@ -340,14 +338,14 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
if(*status == U_BUFFER_OVERFLOW_ERROR){
// redo processing of string
/* we do not have enough room so grow the buffer*/
- b2 = (UChar*) uprv_malloc(b2Len * U_SIZEOF_UCHAR);
+ b2 = (UChar*) uprv_malloc(b2Len * U_SIZEOF_UCHAR);
if(b2 == NULL){
*status = U_MEMORY_ALLOCATION_ERROR;
goto CLEANUP;
}
*status = U_ZERO_ERROR; // reset error
-
+
b2Len = u_strToPunycode(b1,b1Len,b2,b2Len,caseFlags, status);
}
//error bail out
@@ -369,7 +367,7 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
u_memcpy(dest+ACE_PREFIX_LENGTH, b2, b2Len);
}else{
- *status = U_IDNA_ACE_PREFIX_ERROR;
+ *status = U_IDNA_ACE_PREFIX_ERROR;
//position of failure is 0
uprv_syntaxError(b1,0,b1Len,parseError);
goto CLEANUP;
@@ -388,7 +386,7 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
uprv_free(b2);
}
uprv_free(caseFlags);
-
+
return u_terminateUChars(dest, destCapacity, reqLength, status);
}
@@ -403,7 +401,7 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
//get the options
//UBool useSTD3ASCIIRules = (UBool)((options & UIDNA_USE_STD3_RULES) != 0);
- int32_t namePrepOptions = ((options & UIDNA_ALLOW_UNASSIGNED) != 0) ? USPREP_ALLOW_UNASSIGNED: 0;
+ int32_t namePrepOptions = ((options & UIDNA_ALLOW_UNASSIGNED) != 0) ? USPREP_ALLOW_UNASSIGNED: 0;
// TODO Revisit buffer handling. The label should not be over 63 ASCII characters. ICU4J may need to be updated too.
UChar b1Stack[MAX_LABEL_BUFFER_SIZE], b2Stack[MAX_LABEL_BUFFER_SIZE], b3Stack[MAX_LABEL_BUFFER_SIZE];
@@ -411,7 +409,7 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
//initialize pointers to stack buffers
UChar *b1 = b1Stack, *b2 = b2Stack, *b1Prime=NULL, *b3=b3Stack;
int32_t b1Len = 0, b2Len, b1PrimeLen, b3Len,
- b1Capacity = MAX_LABEL_BUFFER_SIZE,
+ b1Capacity = MAX_LABEL_BUFFER_SIZE,
b2Capacity = MAX_LABEL_BUFFER_SIZE,
b3Capacity = MAX_LABEL_BUFFER_SIZE,
reqLength=0;
@@ -422,7 +420,7 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
/*UBool srcIsLDH = TRUE;
int32_t failPos =0;*/
- // step 1: find out if all the codepoints in src are ASCII
+ // step 1: find out if all the codepoints in src are ASCII
if(srcLength==-1){
srcLength = 0;
for(;src[srcLength]!=0;){
@@ -441,6 +439,7 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
for(int32_t j=0; j 0x7f){
srcIsASCII = FALSE;
+ break;
}/*else if(isLDHChar(src[j])==FALSE){
// here we do not assemble surrogates
// since we know that LDH code points
@@ -452,7 +451,7 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
}else{
return 0;
}
-
+
if(srcIsASCII == FALSE){
// step 2: process the string
b1Len = usprep_prepare(nameprep, src, srcLength, b1, b1Capacity, namePrepOptions, parseError, status);
@@ -466,7 +465,7 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
}
*status = U_ZERO_ERROR; // reset error
-
+
b1Len = usprep_prepare(nameprep, src, srcLength, b1, b1Len, namePrepOptions, parseError, status);
}
//bail out on error
@@ -480,7 +479,7 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
b1Len = srcLength;
}
- // The RFC states that
+ // The RFC states that
//
// ToUnicode never fails. If any step fails, then the original input
// is returned immediately in that step.
@@ -559,7 +558,7 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
// failPos is always set the index of failure
uprv_syntaxError(src,failPos, srcLength,parseError);
}else if(src[0] == HYPHEN){
- // fail position is 0
+ // fail position is 0
uprv_syntaxError(src,0,srcLength,parseError);
}else{
// the last index in the source is always length-1
@@ -588,7 +587,7 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
}
uprv_free(caseFlags);
- // The RFC states that
+ // The RFC states that
//
// ToUnicode never fails. If any step fails, then the original input
// is returned immediately in that step.
@@ -609,12 +608,12 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
}
U_CAPI int32_t U_EXPORT2
-uidna_toASCII(const UChar* src, int32_t srcLength,
+uidna_toASCII(const UChar* src, int32_t srcLength,
UChar* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
UErrorCode* status){
-
+
if(status == NULL || U_FAILURE(*status)){
return 0;
}
@@ -624,16 +623,16 @@ uidna_toASCII(const UChar* src, int32_t srcLength,
}
UStringPrepProfile* nameprep = usprep_openByType(USPREP_RFC3491_NAMEPREP, status);
-
+
if(U_FAILURE(*status)){
return -1;
}
-
+
int32_t retLen = _internal_toASCII(src, srcLength, dest, destCapacity, options, nameprep, parseError, status);
-
+
/* close the profile*/
usprep_close(nameprep);
-
+
return retLen;
}
@@ -650,18 +649,18 @@ uidna_toUnicode(const UChar* src, int32_t srcLength,
if( (src==NULL) || (srcLength < -1) || (destCapacity<0) || (!dest && destCapacity > 0)){
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
- }
+ }
UStringPrepProfile* nameprep = usprep_openByType(USPREP_RFC3491_NAMEPREP, status);
-
+
if(U_FAILURE(*status)){
return -1;
}
-
+
int32_t retLen = _internal_toUnicode(src, srcLength, dest, destCapacity, options, nameprep, parseError, status);
usprep_close(nameprep);
-
+
return retLen;
}
@@ -684,12 +683,12 @@ uidna_IDNToASCII( const UChar *src, int32_t srcLength,
int32_t reqLength = 0;
UStringPrepProfile* nameprep = usprep_openByType(USPREP_RFC3491_NAMEPREP, status);
-
+
if(U_FAILURE(*status)){
return 0;
}
- //initialize pointers
+ //initialize pointers
UChar *delimiter = (UChar*)src;
UChar *labelStart = (UChar*)src;
UChar *currentDest = (UChar*) dest;
@@ -704,24 +703,24 @@ uidna_IDNToASCII( const UChar *src, int32_t srcLength,
labelLen = getNextSeparator(labelStart,remainingLen, &delimiter,&done);
labelReqLength = 0;
if(!(labelLen==0 && done)){// make sure this is not a root label separator.
-
- labelReqLength = _internal_toASCII( labelStart, labelLen,
- currentDest, remainingDestCapacity,
- options, nameprep,
+
+ labelReqLength = _internal_toASCII( labelStart, labelLen,
+ currentDest, remainingDestCapacity,
+ options, nameprep,
parseError, status);
-
+
if(*status == U_BUFFER_OVERFLOW_ERROR){
-
+
*status = U_ZERO_ERROR; // reset error
remainingDestCapacity = 0;
}
}
-
+
if(U_FAILURE(*status)){
break;
}
-
+
reqLength +=labelReqLength;
// adjust the destination pointer
if(labelReqLength < remainingDestCapacity){
@@ -755,7 +754,7 @@ uidna_IDNToASCII( const UChar *src, int32_t srcLength,
}
usprep_close(nameprep);
-
+
return u_terminateUChars(dest, destCapacity, reqLength, status);
}
@@ -765,7 +764,7 @@ uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
int32_t options,
UParseError* parseError,
UErrorCode* status){
-
+
if(status == NULL || U_FAILURE(*status)){
return 0;
}
@@ -777,7 +776,7 @@ uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
int32_t reqLength = 0;
UStringPrepProfile* nameprep = usprep_openByType(USPREP_RFC3491_NAMEPREP, status);
-
+
if(U_FAILURE(*status)){
return 0;
}
@@ -794,21 +793,21 @@ uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
for(;;){
labelLen = getNextSeparator(labelStart,remainingLen, &delimiter,&done);
-
- // The RFC states that
+
+ // The RFC states that
//
// ToUnicode never fails. If any step fails, then the original input
// is returned immediately in that step.
//
// _internal_toUnicode will copy the label.
- /*if(labelLen==0 && done==FALSE){
+ /*if(labelLen==0 && done==FALSE){
*status = U_IDNA_ZERO_LENGTH_LABEL_ERROR;
break;
}*/
-
- labelReqLength = _internal_toUnicode(labelStart, labelLen,
- currentDest, remainingDestCapacity,
- options, nameprep,
+
+ labelReqLength = _internal_toUnicode(labelStart, labelLen,
+ currentDest, remainingDestCapacity,
+ options, nameprep,
parseError, status);
if(*status == U_BUFFER_OVERFLOW_ERROR){
@@ -819,7 +818,7 @@ uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
if(U_FAILURE(*status)){
break;
}
-
+
reqLength +=labelReqLength;
// adjust the destination pointer
if(labelReqLength < remainingDestCapacity){
@@ -854,7 +853,7 @@ uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
}
usprep_close(nameprep);
-
+
return u_terminateUChars(dest, destCapacity, reqLength, status);
}
@@ -872,7 +871,7 @@ uidna_compare( const UChar *s1, int32_t length1,
UChar *b1 = b1Stack, *b2 = b2Stack;
int32_t b1Len, b2Len, b1Capacity = MAX_IDN_BUFFER_SIZE, b2Capacity = MAX_IDN_BUFFER_SIZE;
int32_t result=-1;
-
+
UParseError parseError;
b1Len = uidna_IDNToASCII(s1, length1, b1, b1Capacity, options, &parseError, status);
@@ -885,9 +884,9 @@ uidna_compare( const UChar *s1, int32_t length1,
}
*status = U_ZERO_ERROR; // reset error
-
+
b1Len = uidna_IDNToASCII(s1,length1,b1,b1Len, options, &parseError, status);
-
+
}
b2Len = uidna_IDNToASCII(s2,length2, b2,b2Capacity, options, &parseError, status);
@@ -900,9 +899,9 @@ uidna_compare( const UChar *s1, int32_t length1,
}
*status = U_ZERO_ERROR; // reset error
-
+
b2Len = uidna_IDNToASCII(s2, length2, b2, b2Len, options, &parseError, status);
-
+
}
// when toASCII is applied all label separators are replaced with FULL_STOP
result = compareCaseInsensitiveASCII(b1,b1Len,b2,b2Len);
diff --git a/deps/icu-small/source/common/uinvchar.cpp b/deps/icu-small/source/common/uinvchar.cpp
index 2e0f42d9274d2a..05bcf10df48921 100644
--- a/deps/icu-small/source/common/uinvchar.cpp
+++ b/deps/icu-small/source/common/uinvchar.cpp
@@ -207,7 +207,8 @@ u_UCharsToChars(const UChar *us, char *cs, int32_t length) {
while(length>0) {
u=*us++;
if(!UCHAR_IS_INVARIANT(u)) {
- UPRV_UNREACHABLE; /* Variant characters were used. These are not portable in ICU. */
+ U_ASSERT(FALSE); /* Variant characters were used. These are not portable in ICU. */
+ u=0;
}
*cs++=(char)UCHAR_TO_CHAR(u);
--length;
@@ -445,6 +446,13 @@ uprv_copyEbcdic(const UDataSwapper *ds,
return length;
}
+U_CFUNC UBool
+uprv_isEbcdicAtSign(char c) {
+ static const uint8_t ebcdicAtSigns[] = {
+ 0x7C, 0x44, 0x66, 0x80, 0xAC, 0xAE, 0xAF, 0xB5, 0xEC, 0xEF, 0x00 };
+ return c != 0 && uprv_strchr((const char *)ebcdicAtSigns, c) != nullptr;
+}
+
/* compare invariant strings; variant characters compare less than others and unlike each other */
U_CFUNC int32_t
uprv_compareInvAscii(const UDataSwapper *ds,
@@ -561,6 +569,11 @@ uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2) {
}
}
+U_CAPI char U_EXPORT2
+uprv_ebcdicToAscii(char c) {
+ return (char)asciiFromEbcdic[(uint8_t)c];
+}
+
U_CAPI char U_EXPORT2
uprv_ebcdicToLowercaseAscii(char c) {
return (char)lowercaseAsciiFromEbcdic[(uint8_t)c];
@@ -571,7 +584,7 @@ uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n)
{
uint8_t *orig_dst = dst;
- if(n==-1) {
+ if(n==-1) {
n = static_cast(uprv_strlen((const char*)src)+1); /* copy NUL */
}
/* copy non-null */
@@ -592,7 +605,7 @@ uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n)
{
uint8_t *orig_dst = dst;
- if(n==-1) {
+ if(n==-1) {
n = static_cast(uprv_strlen((const char*)src)+1); /* copy NUL */
}
/* copy non-null */
@@ -611,3 +624,4 @@ uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n)
}
return orig_dst;
}
+
diff --git a/deps/icu-small/source/common/uinvchar.h b/deps/icu-small/source/common/uinvchar.h
index 56dddfa8fde9bb..a43cfcd98286fe 100644
--- a/deps/icu-small/source/common/uinvchar.h
+++ b/deps/icu-small/source/common/uinvchar.h
@@ -68,6 +68,75 @@ uprv_isInvariantUString(const UChar *s, int32_t length);
# error Unknown charset family!
#endif
+#ifdef __cplusplus
+
+U_NAMESPACE_BEGIN
+
+/**
+ * Like U_UPPER_ORDINAL(x) but with validation.
+ * Returns 0..25 for A..Z else a value outside 0..25.
+ */
+inline int32_t uprv_upperOrdinal(int32_t c) {
+#if U_CHARSET_FAMILY==U_ASCII_FAMILY
+ return c - 'A';
+#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
+ // EBCDIC: A-Z (26 letters) is split into three ranges A-I (9 letters), J-R (9), S-Z (8).
+ // https://en.wikipedia.org/wiki/EBCDIC_037#Codepage_layout
+ if (c <= 'I') { return c - 'A'; } // A-I --> 0-8
+ if (c < 'J') { return -1; }
+ if (c <= 'R') { return c - 'J' + 9; } // J-R --> 9..17
+ if (c < 'S') { return -1; }
+ return c - 'S' + 18; // S-Z --> 18..25
+#else
+# error Unknown charset family!
+#endif
+}
+
+// Like U_UPPER_ORDINAL(x) but for lowercase and with validation.
+// Returns 0..25 for a..z else a value outside 0..25.
+inline int32_t uprv_lowerOrdinal(int32_t c) {
+#if U_CHARSET_FAMILY==U_ASCII_FAMILY
+ return c - 'a';
+#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
+ // EBCDIC: a-z (26 letters) is split into three ranges a-i (9 letters), j-r (9), s-z (8).
+ // https://en.wikipedia.org/wiki/EBCDIC_037#Codepage_layout
+ if (c <= 'i') { return c - 'a'; } // a-i --> 0-8
+ if (c < 'j') { return -1; }
+ if (c <= 'r') { return c - 'j' + 9; } // j-r --> 9..17
+ if (c < 's') { return -1; }
+ return c - 's' + 18; // s-z --> 18..25
+#else
+# error Unknown charset family!
+#endif
+}
+
+U_NAMESPACE_END
+
+#endif
+
+/**
+ * Returns true if c == '@' is possible.
+ * The @ sign is variant, and the @ sign used on one
+ * EBCDIC machine won't be compiled the same way on other EBCDIC based machines.
+ * @internal
+ */
+U_CFUNC UBool
+uprv_isEbcdicAtSign(char c);
+
+/**
+ * \def uprv_isAtSign
+ * Returns true if c == '@' is possible.
+ * For ASCII, checks for exactly '@'. For EBCDIC, calls uprv_isEbcdicAtSign().
+ * @internal
+ */
+#if U_CHARSET_FAMILY==U_ASCII_FAMILY
+# define uprv_isAtSign(c) ((c)=='@')
+#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
+# define uprv_isAtSign(c) uprv_isEbcdicAtSign(c)
+#else
+# error Unknown charset family!
+#endif
+
/**
* Compare two EBCDIC invariant-character strings in ASCII order.
* @internal
@@ -88,6 +157,26 @@ uprv_compareInvEbcdicAsAscii(const char *s1, const char *s2);
# error Unknown charset family!
#endif
+/**
+ * Converts an EBCDIC invariant character to ASCII.
+ * @internal
+ */
+U_INTERNAL char U_EXPORT2
+uprv_ebcdicToAscii(char c);
+
+/**
+ * \def uprv_invCharToAscii
+ * Converts an invariant character to ASCII.
+ * @internal
+ */
+#if U_CHARSET_FAMILY==U_ASCII_FAMILY
+# define uprv_invCharToAscii(c) (c)
+#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
+# define uprv_invCharToAscii(c) uprv_ebcdicToAscii(c)
+#else
+# error Unknown charset family!
+#endif
+
/**
* Converts an EBCDIC invariant character to lowercase ASCII.
* @internal
diff --git a/deps/icu-small/source/common/ulist.cpp b/deps/icu-small/source/common/ulist.cpp
index 07cbcc8303ac91..c5180431c31b75 100644
--- a/deps/icu-small/source/common/ulist.cpp
+++ b/deps/icu-small/source/common/ulist.cpp
@@ -15,10 +15,10 @@
typedef struct UListNode UListNode;
struct UListNode {
void *data;
-
+
UListNode *next;
UListNode *previous;
-
+
/* When data is created with uprv_malloc, needs to be freed during deleteList function. */
UBool forceDelete;
};
@@ -27,7 +27,7 @@ struct UList {
UListNode *curr;
UListNode *head;
UListNode *tail;
-
+
int32_t size;
};
@@ -35,22 +35,22 @@ static void ulist_addFirstItem(UList *list, UListNode *newItem);
U_CAPI UList *U_EXPORT2 ulist_createEmptyList(UErrorCode *status) {
UList *newList = NULL;
-
+
if (U_FAILURE(*status)) {
return NULL;
}
-
+
newList = (UList *)uprv_malloc(sizeof(UList));
if (newList == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
-
+
newList->curr = NULL;
newList->head = NULL;
newList->tail = NULL;
newList->size = 0;
-
+
return newList;
}
@@ -90,14 +90,14 @@ static void ulist_removeItem(UList *list, UListNode *p) {
U_CAPI void U_EXPORT2 ulist_addItemEndList(UList *list, const void *data, UBool forceDelete, UErrorCode *status) {
UListNode *newItem = NULL;
-
+
if (U_FAILURE(*status) || list == NULL || data == NULL) {
if (forceDelete) {
uprv_free((void *)data);
}
return;
}
-
+
newItem = (UListNode *)uprv_malloc(sizeof(UListNode));
if (newItem == NULL) {
if (forceDelete) {
@@ -108,7 +108,7 @@ U_CAPI void U_EXPORT2 ulist_addItemEndList(UList *list, const void *data, UBool
}
newItem->data = (void *)(data);
newItem->forceDelete = forceDelete;
-
+
if (list->size == 0) {
ulist_addFirstItem(list, newItem);
} else {
@@ -117,20 +117,20 @@ U_CAPI void U_EXPORT2 ulist_addItemEndList(UList *list, const void *data, UBool
list->tail->next = newItem;
list->tail = newItem;
}
-
+
list->size++;
}
U_CAPI void U_EXPORT2 ulist_addItemBeginList(UList *list, const void *data, UBool forceDelete, UErrorCode *status) {
UListNode *newItem = NULL;
-
+
if (U_FAILURE(*status) || list == NULL || data == NULL) {
if (forceDelete) {
uprv_free((void *)data);
}
return;
}
-
+
newItem = (UListNode *)uprv_malloc(sizeof(UListNode));
if (newItem == NULL) {
if (forceDelete) {
@@ -141,7 +141,7 @@ U_CAPI void U_EXPORT2 ulist_addItemBeginList(UList *list, const void *data, UBoo
}
newItem->data = (void *)(data);
newItem->forceDelete = forceDelete;
-
+
if (list->size == 0) {
ulist_addFirstItem(list, newItem);
} else {
@@ -150,7 +150,7 @@ U_CAPI void U_EXPORT2 ulist_addItemBeginList(UList *list, const void *data, UBoo
list->head->previous = newItem;
list->head = newItem;
}
-
+
list->size++;
}
@@ -184,14 +184,14 @@ U_CAPI UBool U_EXPORT2 ulist_removeString(UList *list, const char *data) {
U_CAPI void *U_EXPORT2 ulist_getNext(UList *list) {
UListNode *curr = NULL;
-
+
if (list == NULL || list->curr == NULL) {
return NULL;
}
-
+
curr = list->curr;
list->curr = curr->next;
-
+
return curr->data;
}
@@ -199,7 +199,7 @@ U_CAPI int32_t U_EXPORT2 ulist_getListSize(const UList *list) {
if (list != NULL) {
return list->size;
}
-
+
return -1;
}
@@ -240,7 +240,7 @@ U_CAPI int32_t U_EXPORT2 ulist_count_keyword_values(UEnumeration *en, UErrorCode
if (U_FAILURE(*status)) {
return -1;
}
-
+
return ulist_getListSize((UList *)(en->context));
}
@@ -261,7 +261,7 @@ U_CAPI void U_EXPORT2 ulist_reset_keyword_values_iterator(UEnumeration *en, UErr
if (U_FAILURE(*status)) {
return ;
}
-
+
ulist_resetList((UList *)(en->context));
}
diff --git a/deps/icu-small/source/common/uloc.cpp b/deps/icu-small/source/common/uloc.cpp
index 73b43204b814b9..6a9bfcfbff5999 100644
--- a/deps/icu-small/source/common/uloc.cpp
+++ b/deps/icu-small/source/common/uloc.cpp
@@ -148,7 +148,8 @@ static const char * const LANGUAGES[] = {
"mad", "maf", "mag", "mai", "mak", "man", "mas", "mde",
"mdf", "mdh", "mdr", "men", "mer", "mfe", "mg", "mga",
"mgh", "mgo", "mh", "mi", "mic", "min", "mis", "mk",
- "ml", "mn", "mnc", "mni", "moh", "mos", "mr", "mrj",
+ "ml", "mn", "mnc", "mni", "mo",
+ "moh", "mos", "mr", "mrj",
"ms", "mt", "mua", "mul", "mus", "mwl", "mwr", "mwv",
"my", "mye", "myv", "mzn",
"na", "nan", "nap", "naq", "nb", "nd", "nds", "ne",
@@ -264,7 +265,8 @@ static const char * const LANGUAGES_3[] = {
"mad", "maf", "mag", "mai", "mak", "man", "mas", "mde",
"mdf", "mdh", "mdr", "men", "mer", "mfe", "mlg", "mga",
"mgh", "mgo", "mah", "mri", "mic", "min", "mis", "mkd",
- "mal", "mon", "mnc", "mni", "moh", "mos", "mar", "mrj",
+ "mal", "mon", "mnc", "mni", "mol",
+ "moh", "mos", "mar", "mrj",
"msa", "mlt", "mua", "mul", "mus", "mwl", "mwr", "mwv",
"mya", "mye", "myv", "mzn",
"nau", "nan", "nap", "naq", "nob", "nde", "nds", "nep",
@@ -480,14 +482,15 @@ static const CanonicalizationMap CANONICALIZE_MAP[] = {
/* Test if the locale id has BCP47 u extension and does not have '@' */
#define _hasBCP47Extension(id) (id && uprv_strstr(id, "@") == NULL && getShortestSubtagLength(localeID) == 1)
/* Converts the BCP47 id to Unicode id. Does nothing to id if conversion fails */
-#define _ConvertBCP47(finalID, id, buffer, length,err) \
- if (uloc_forLanguageTag(id, buffer, length, NULL, err) <= 0 || \
- U_FAILURE(*err) || *err == U_STRING_NOT_TERMINATED_WARNING) { \
- finalID=id; \
- if (*err == U_STRING_NOT_TERMINATED_WARNING) { *err = U_BUFFER_OVERFLOW_ERROR; } \
- } else { \
- finalID=buffer; \
- }
+#define _ConvertBCP47(finalID, id, buffer, length,err) UPRV_BLOCK_MACRO_BEGIN { \
+ if (uloc_forLanguageTag(id, buffer, length, NULL, err) <= 0 || \
+ U_FAILURE(*err) || *err == U_STRING_NOT_TERMINATED_WARNING) { \
+ finalID=id; \
+ if (*err == U_STRING_NOT_TERMINATED_WARNING) { *err = U_BUFFER_OVERFLOW_ERROR; } \
+ } else { \
+ finalID=buffer; \
+ } \
+} UPRV_BLOCK_MACRO_END
/* Gets the size of the shortest subtag in the given localeID. */
static int32_t getShortestSubtagLength(const char *localeID) {
int32_t localeIDLength = static_cast(uprv_strlen(localeID));
@@ -1454,31 +1457,29 @@ static const UEnumeration gKeywordsEnum = {
U_CAPI UEnumeration* U_EXPORT2
uloc_openKeywordList(const char *keywordList, int32_t keywordListSize, UErrorCode* status)
{
- UKeywordsContext *myContext = NULL;
- UEnumeration *result = NULL;
+ LocalMemory myContext;
+ LocalMemory result;
- if(U_FAILURE(*status)) {
- return NULL;
+ if (U_FAILURE(*status)) {
+ return nullptr;
}
- result = (UEnumeration *)uprv_malloc(sizeof(UEnumeration));
- /* Null pointer test */
- if (result == NULL) {
+ myContext.adoptInstead(static_cast(uprv_malloc(sizeof(UKeywordsContext))));
+ result.adoptInstead(static_cast(uprv_malloc(sizeof(UEnumeration))));
+ if (myContext.isNull() || result.isNull()) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
- uprv_memcpy(result, &gKeywordsEnum, sizeof(UEnumeration));
- myContext = static_cast(uprv_malloc(sizeof(UKeywordsContext)));
- if (myContext == NULL) {
+ uprv_memcpy(result.getAlias(), &gKeywordsEnum, sizeof(UEnumeration));
+ myContext->keywords = static_cast(uprv_malloc(keywordListSize+1));
+ if (myContext->keywords == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- uprv_free(result);
- return NULL;
+ return nullptr;
}
- myContext->keywords = (char *)uprv_malloc(keywordListSize+1);
uprv_memcpy(myContext->keywords, keywordList, keywordListSize);
myContext->keywords[keywordListSize] = 0;
myContext->current = myContext->keywords;
- result->context = myContext;
- return result;
+ result->context = myContext.orphan();
+ return result.orphan();
}
U_CAPI UEnumeration* U_EXPORT2
diff --git a/deps/icu-small/source/common/uloc_keytype.cpp b/deps/icu-small/source/common/uloc_keytype.cpp
index 25f35b5ced42d5..019da058cf491d 100644
--- a/deps/icu-small/source/common/uloc_keytype.cpp
+++ b/deps/icu-small/source/common/uloc_keytype.cpp
@@ -531,3 +531,4 @@ ulocimp_toLegacyType(const char* key, const char* type, UBool* isKnownKey, UBool
}
return NULL;
}
+
diff --git a/deps/icu-small/source/common/uloc_tag.cpp b/deps/icu-small/source/common/uloc_tag.cpp
index c732170cb62b9c..1c10c48182c887 100644
--- a/deps/icu-small/source/common/uloc_tag.cpp
+++ b/deps/icu-small/source/common/uloc_tag.cpp
@@ -930,7 +930,7 @@ _addExtensionToList(ExtensionListEntry **first, ExtensionListEntry *ext, UBool l
cmp = *(ext->key) - *(cur->key);
}
} else if (len == 1) {
- cmp = *(ext->key) - LDMLEXT;
+ cmp = *(ext->key) - LDMLEXT;
} else if (curlen == 1) {
cmp = LDMLEXT - *(cur->key);
} else {
@@ -1558,10 +1558,8 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
return;
}
- if (!_addAttributeToList(&attrFirst, attr)) {
- *status = U_ILLEGAL_ARGUMENT_ERROR;
- return;
- }
+ // duplicate attribute is ignored, causes no error.
+ _addAttributeToList(&attrFirst, attr);
/* next tag */
pTag += len;
@@ -1739,7 +1737,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
pType = LOCALE_TYPE_YES;
}
- /* Special handling for u-va-posix, since we want to treat this as a variant,
+ /* Special handling for u-va-posix, since we want to treat this as a variant,
not as a keyword */
if (!variantExists && !uprv_strcmp(pKey, POSIX_KEY) && !uprv_strcmp(pType, POSIX_VALUE) ) {
*posixVariant = TRUE;
diff --git a/deps/icu-small/source/common/ulocimp.h b/deps/icu-small/source/common/ulocimp.h
index dac82872e6ed40..31d3c44d0bec68 100644
--- a/deps/icu-small/source/common/ulocimp.h
+++ b/deps/icu-small/source/common/ulocimp.h
@@ -41,10 +41,10 @@ uloc_getTableStringWithFallback(
/*returns TRUE if a is an ID separator FALSE otherwise*/
#define _isIDSeparator(a) (a == '_' || a == '-')
-U_CFUNC const char*
+U_CFUNC const char*
uloc_getCurrentCountryID(const char* oldID);
-U_CFUNC const char*
+U_CFUNC const char*
uloc_getCurrentLanguageID(const char* oldID);
U_CFUNC int32_t
@@ -123,7 +123,7 @@ ulocimp_forLanguageTag(const char* langtag,
* (3) if inferRegion is TRUE, the region suggested by
* getLikelySubtags on the localeID.
* If no region is found, returns length 0.
- *
+ *
* @param localeID
* The complete locale ID (with keywords) from which
* to get the region to use for supplemental data.
@@ -132,7 +132,7 @@ ulocimp_forLanguageTag(const char* langtag,
* no other region is found.
* @param region
* Buffer in which to put the region ID found; should
- * have a capacity at least ULOC_COUNTRY_CAPACITY.
+ * have a capacity at least ULOC_COUNTRY_CAPACITY.
* @param regionCapacity
* The actual capacity of the region buffer.
* @param status
diff --git a/deps/icu-small/source/common/umapfile.cpp b/deps/icu-small/source/common/umapfile.cpp
index 40b543fb2219bc..3e714876a4dc62 100644
--- a/deps/icu-small/source/common/umapfile.cpp
+++ b/deps/icu-small/source/common/umapfile.cpp
@@ -136,7 +136,7 @@ typedef HANDLE MemoryMap;
/* open the input file */
#if U_PLATFORM_HAS_WINUWP_API == 0
- // Note: In the non-UWP code-path (ie: Win32), the value of the path variable might have come from
+ // Note: In the non-UWP code-path (ie: Win32), the value of the path variable might have come from
// the CRT 'getenv' function, and would be therefore be encoded in the default ANSI code page.
// This means that we can't call the *W version of API below, whereas in the UWP code-path
// there is no 'getenv' call, and thus the string will be only UTF-8/Invariant characters.
@@ -178,7 +178,7 @@ typedef HANDLE MemoryMap;
CloseHandle(file);
if (map == nullptr) {
- // If we failed to create the mapping due to an out-of-memory error, then
+ // If we failed to create the mapping due to an out-of-memory error, then
// we want to report that error back to the caller.
if (HRESULT_FROM_WIN32(GetLastError()) == E_OUTOFMEMORY) {
*status = U_MEMORY_ALLOCATION_ERROR;
@@ -360,14 +360,14 @@ typedef HANDLE MemoryMap;
}
return dest;
}
-
+
/*------------------------------------------------------------------------------
- *
- * computeDirPath given a user-supplied path of an item to be opened,
- * compute and return
- * - the full directory path to be used
+ *
+ * computeDirPath given a user-supplied path of an item to be opened,
+ * compute and return
+ * - the full directory path to be used
* when opening the file.
- * - Pointer to null at end of above returned path
+ * - Pointer to null at end of above returned path
*
* Parameters:
* path: input path. Buffer is not altered.
@@ -379,23 +379,23 @@ typedef HANDLE MemoryMap;
* TODO: This works the way ICU historically has, but the
* whole data fallback search path is so complicated that
* probably almost no one will ever really understand it,
- * the potential for confusion is large. (It's not just
+ * the potential for confusion is large. (It's not just
* this one function, but the whole scheme.)
- *
+ *
*------------------------------------------------------------------------------*/
static char *uprv_computeDirPath(const char *path, char *pathBuffer)
{
char *finalSlash; /* Ptr to last dir separator in input path, or null if none. */
int32_t pathLen; /* Length of the returned directory path */
-
+
finalSlash = 0;
if (path != 0) {
finalSlash = uprv_strrchr(path, U_FILE_SEP_CHAR);
}
-
+
*pathBuffer = 0;
if (finalSlash == 0) {
- /* No user-supplied path.
+ /* No user-supplied path.
* Copy the ICU_DATA path to the path buffer and return that*/
const char *icuDataDir;
icuDataDir=u_getDataDirectory();
@@ -405,8 +405,8 @@ typedef HANDLE MemoryMap;
/* there is no icuDataDir either. Just return the empty pathBuffer. */
return pathBuffer;
}
- }
-
+ }
+
/* User supplied path did contain a directory portion.
* Copy it to the output path buffer */
pathLen = (int32_t)(finalSlash - path + 1);
@@ -414,7 +414,7 @@ typedef HANDLE MemoryMap;
*(pathBuffer+pathLen) = 0;
return pathBuffer+pathLen;
}
-
+
# define DATA_TYPE "dat"
@@ -522,7 +522,7 @@ typedef HANDLE MemoryMap;
pData->map = nullptr;
pData->mapAddr = nullptr;
pData->pHeader = nullptr;
- }
+ }
}
#else
diff --git a/deps/icu-small/source/common/umath.cpp b/deps/icu-small/source/common/umath.cpp
index 3ab72ab482386c..7cf4b317494083 100644
--- a/deps/icu-small/source/common/umath.cpp
+++ b/deps/icu-small/source/common/umath.cpp
@@ -23,3 +23,4 @@ uprv_min(int32_t x, int32_t y)
{
return (x > y ? y : x);
}
+
diff --git a/deps/icu-small/source/common/umutex.cpp b/deps/icu-small/source/common/umutex.cpp
index 20b03d6cd3e416..ccbee9960a39e7 100644
--- a/deps/icu-small/source/common/umutex.cpp
+++ b/deps/icu-small/source/common/umutex.cpp
@@ -24,6 +24,7 @@
#include "unicode/utypes.h"
#include "uassert.h"
+#include "ucln_cmn.h"
#include "cmemory.h"
U_NAMESPACE_BEGIN
@@ -35,60 +36,94 @@ U_NAMESPACE_BEGIN
#error U_USER_MUTEX_CPP not supported
#endif
+
/*************************************************************************************************
*
* ICU Mutex wrappers.
*
*************************************************************************************************/
-// The ICU global mutex. Used when ICU implementation code passes NULL for the mutex pointer.
-static UMutex *globalMutex() {
- static UMutex m = U_MUTEX_INITIALIZER;
- return &m;
-}
+namespace {
+std::mutex *initMutex;
+std::condition_variable *initCondition;
-U_CAPI void U_EXPORT2
-umtx_lock(UMutex *mutex) {
- if (mutex == nullptr) {
- mutex = globalMutex();
- }
- mutex->fMutex.lock();
-}
+// The ICU global mutex.
+// Used when ICU implementation code passes nullptr for the mutex pointer.
+UMutex globalMutex;
+std::once_flag initFlag;
+std::once_flag *pInitFlag = &initFlag;
-U_CAPI void U_EXPORT2
-umtx_unlock(UMutex* mutex)
-{
- if (mutex == nullptr) {
- mutex = globalMutex();
- }
- mutex->fMutex.unlock();
-}
+} // Anonymous namespace
-UConditionVar::UConditionVar() : fCV() {
+U_CDECL_BEGIN
+static UBool U_CALLCONV umtx_cleanup() {
+ initMutex->~mutex();
+ initCondition->~condition_variable();
+ UMutex::cleanup();
+
+ // Reset the once_flag, by destructing it and creating a fresh one in its place.
+ // Do not use this trick anywhere else in ICU; use umtx_initOnce, not std::call_once().
+ pInitFlag->~once_flag();
+ pInitFlag = new(&initFlag) std::once_flag();
+ return true;
}
-UConditionVar::~UConditionVar() {
+static void U_CALLCONV umtx_init() {
+ initMutex = STATIC_NEW(std::mutex);
+ initCondition = STATIC_NEW(std::condition_variable);
+ ucln_common_registerCleanup(UCLN_COMMON_MUTEX, umtx_cleanup);
+}
+U_CDECL_END
+
+
+std::mutex *UMutex::getMutex() {
+ std::mutex *retPtr = fMutex.load(std::memory_order_acquire);
+ if (retPtr == nullptr) {
+ std::call_once(*pInitFlag, umtx_init);
+ std::lock_guard guard(*initMutex);
+ retPtr = fMutex.load(std::memory_order_acquire);
+ if (retPtr == nullptr) {
+ fMutex = new(fStorage) std::mutex();
+ retPtr = fMutex;
+ fListLink = gListHead;
+ gListHead = this;
+ }
+ }
+ U_ASSERT(retPtr != nullptr);
+ return retPtr;
}
-U_CAPI void U_EXPORT2
-umtx_condWait(UConditionVar *cond, UMutex *mutex) {
- if (mutex == nullptr) {
- mutex = globalMutex();
+UMutex *UMutex::gListHead = nullptr;
+
+void UMutex::cleanup() {
+ UMutex *next = nullptr;
+ for (UMutex *m = gListHead; m != nullptr; m = next) {
+ (*m->fMutex).~mutex();
+ m->fMutex = nullptr;
+ next = m->fListLink;
+ m->fListLink = nullptr;
}
- cond->fCV.wait(mutex->fMutex);
+ gListHead = nullptr;
}
-U_CAPI void U_EXPORT2
-umtx_condBroadcast(UConditionVar *cond) {
- cond->fCV.notify_all();
+U_CAPI void U_EXPORT2
+umtx_lock(UMutex *mutex) {
+ if (mutex == nullptr) {
+ mutex = &globalMutex;
+ }
+ mutex->lock();
}
-U_CAPI void U_EXPORT2
-umtx_condSignal(UConditionVar *cond) {
- cond->fCV.notify_one();
+U_CAPI void U_EXPORT2
+umtx_unlock(UMutex* mutex)
+{
+ if (mutex == nullptr) {
+ mutex = &globalMutex;
+ }
+ mutex->unlock();
}
@@ -98,17 +133,6 @@ umtx_condSignal(UConditionVar *cond) {
*
*************************************************************************************************/
-static std::mutex &initMutex() {
- static std::mutex m;
- return m;
-}
-
-static std::condition_variable &initCondition() {
- static std::condition_variable cv;
- return cv;
-}
-
-
// This function is called when a test of a UInitOnce::fState reveals that
// initialization has not completed, that we either need to call the init
// function on this thread, or wait for some other thread to complete.
@@ -119,8 +143,8 @@ static std::condition_variable &initCondition() {
//
U_COMMON_API UBool U_EXPORT2
umtx_initImplPreInit(UInitOnce &uio) {
- std::unique_lock lock(initMutex());
-
+ std::call_once(*pInitFlag, umtx_init);
+ std::unique_lock lock(*initMutex);
if (umtx_loadAcquire(uio.fState) == 0) {
umtx_storeRelease(uio.fState, 1);
return true; // Caller will next call the init function.
@@ -128,7 +152,7 @@ umtx_initImplPreInit(UInitOnce &uio) {
while (umtx_loadAcquire(uio.fState) == 1) {
// Another thread is currently running the initialization.
// Wait until it completes.
- initCondition().wait(lock);
+ initCondition->wait(lock);
}
U_ASSERT(uio.fState == 2);
return false;
@@ -145,10 +169,10 @@ umtx_initImplPreInit(UInitOnce &uio) {
U_COMMON_API void U_EXPORT2
umtx_initImplPostInit(UInitOnce &uio) {
{
- std::unique_lock lock(initMutex());
+ std::unique_lock lock(*initMutex);
umtx_storeRelease(uio.fState, 2);
}
- initCondition().notify_all();
+ initCondition->notify_all();
}
U_NAMESPACE_END
diff --git a/deps/icu-small/source/common/umutex.h b/deps/icu-small/source/common/umutex.h
index 1674d00bb2d59b..2503aa4a29144c 100755
--- a/deps/icu-small/source/common/umutex.h
+++ b/deps/icu-small/source/common/umutex.h
@@ -23,6 +23,7 @@
#include
#include
#include
+#include
#include "unicode/utypes.h"
#include "unicode/uclean.h"
@@ -36,10 +37,11 @@
#error U_USER_ATOMICS and U_USER_MUTEX_H are not supported
#endif
-
-// Export an explicit template instantiation of std::atomic.
+// Export an explicit template instantiation of std::atomic.
// When building DLLs for Windows this is required as it is used as a data member of the exported SharedObject class.
// See digitlst.h, pluralaffix.h, datefmt.h, and others for similar examples.
+//
+// Similar story for std::atomic, and the exported UMutex class.
#if U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN && !defined(U_IN_DOXYGEN)
#if defined(__clang__) || defined(_MSC_VER)
#if defined(__clang__)
@@ -48,12 +50,14 @@
#pragma clang diagnostic ignored "-Winstantiation-after-specialization"
#endif
template struct U_COMMON_API std::atomic;
+template struct U_COMMON_API std::atomic;
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
#elif defined(__GNUC__)
// For GCC this class is already exported/visible, so no need for U_COMMON_API.
template struct std::atomic;
+template struct std::atomic;
#endif
#endif
@@ -180,49 +184,78 @@ template void umtx_initOnce(UInitOnce &uio, void (U_CALLCONV *fp)(T, UE
}
}
+// UMutex should be constexpr-constructible, so that no initialization code
+// is run during startup.
+// This works on all C++ libraries except MS VS before VS2019.
+#if (defined(_CPPLIB_VER) && !defined(_MSVC_STL_VERSION)) || \
+ (defined(_MSVC_STL_VERSION) && _MSVC_STL_VERSION < 142)
+ // (VS std lib older than VS2017) || (VS std lib version < VS2019)
+# define UMUTEX_CONSTEXPR
+#else
+# define UMUTEX_CONSTEXPR constexpr
+#endif
-/*************************************************************************************************
+/**
+ * UMutex - ICU Mutex class.
*
- * ICU Mutex wrappers. Originally wrapped operating system mutexes, giving the rest of ICU a
- * platform independent set of mutex operations. Now vestigial, wrapping std::mutex only.
- * For internal ICU use only.
+ * This is the preferred Mutex class for use within ICU implementation code.
+ * It is a thin wrapper over C++ std::mutex, with these additions:
+ * - Static instances are safe, not triggering static construction or destruction,
+ * and the associated order of construction or destruction issues.
+ * - Plumbed into u_cleanup() for destructing the underlying std::mutex,
+ * which frees any OS level resources they may be holding.
*
- *************************************************************************************************/
+ * Limitations:
+ * - Static or global instances only. Cannot be heap allocated. Cannot appear as a
+ * member of another class.
+ * - No condition variables or other advanced features. If needed, you will need to use
+ * std::mutex and std::condition_variable directly. For an example, see unifiedcache.cpp
+ *
+ * Typical Usage:
+ * static UMutex myMutex;
+ *
+ * {
+ * Mutex lock(myMutex);
+ * ... // Do stuff that is protected by myMutex;
+ * } // myMutex is released when lock goes out of scope.
+ */
-struct UMutex : public icu::UMemory {
- UMutex() = default;
+class U_COMMON_API UMutex {
+public:
+ UMUTEX_CONSTEXPR UMutex() {}
~UMutex() = default;
+
UMutex(const UMutex &other) = delete;
UMutex &operator =(const UMutex &other) = delete;
+ void *operator new(size_t) = delete;
- std::mutex fMutex = {}; // Note: struct - pubic members - because most access is from
- // // plain C style functions (umtx_lock(), etc.)
-};
+ // requirements for C++ BasicLockable, allows UMutex to work with std::lock_guard
+ void lock() {
+ std::mutex *m = fMutex.load(std::memory_order_acquire);
+ if (m == nullptr) { m = getMutex(); }
+ m->lock();
+ }
+ void unlock() { fMutex.load(std::memory_order_relaxed)->unlock(); }
+ static void cleanup();
-struct UConditionVar : public icu::UMemory {
- U_COMMON_API UConditionVar();
- U_COMMON_API ~UConditionVar();
- UConditionVar(const UConditionVar &other) = delete;
- UConditionVar &operator =(const UConditionVar &other) = delete;
+private:
+ alignas(std::mutex) char fStorage[sizeof(std::mutex)] {};
+ std::atomic fMutex { nullptr };
- std::condition_variable_any fCV;
-};
+ /** All initialized UMutexes are kept in a linked list, so that they can be found,
+ * and the underlying std::mutex destructed, by u_cleanup().
+ */
+ UMutex *fListLink { nullptr };
+ static UMutex *gListHead;
-#define U_MUTEX_INITIALIZER {}
-#define U_CONDITION_INITIALIZER {}
+ /** Out-of-line function to lazily initialize a UMutex on first use.
+ * Initial fast check is inline, in lock(). The returned value may never
+ * be nullptr.
+ */
+ std::mutex *getMutex();
+};
-// Implementation notes for UConditionVar:
-//
-// Use an out-of-line constructor to reduce problems with the ICU dependency checker.
-// On Linux, the default constructor of std::condition_variable_any
-// produces an in-line reference to global operator new(), which the
-// dependency checker flags for any file that declares a UConditionVar. With
-// an out-of-line constructor, the dependency is constrained to umutex.o
-//
-// Do not export (U_COMMON_API) the entire class, but only the constructor
-// and destructor, to avoid Windows build problems with attempting to export the
-// std::condition_variable_any.
/* Lock a mutex.
* @param mutex The given mutex to be locked. Pass NULL to specify
@@ -237,30 +270,6 @@ U_INTERNAL void U_EXPORT2 umtx_lock(UMutex* mutex);
*/
U_INTERNAL void U_EXPORT2 umtx_unlock (UMutex* mutex);
-/*
- * Wait on a condition variable.
- * The calling thread will unlock the mutex and wait on the condition variable.
- * The mutex must be locked by the calling thread when invoking this function.
- *
- * @param cond the condition variable to wait on.
- * @param mutex the associated mutex.
- */
-
-U_INTERNAL void U_EXPORT2 umtx_condWait(UConditionVar *cond, UMutex *mutex);
-
-
-/*
- * Broadcast wakeup of all threads waiting on a Condition.
- *
- * @param cond the condition variable.
- */
-U_INTERNAL void U_EXPORT2 umtx_condBroadcast(UConditionVar *cond);
-
-/*
- * Signal a condition variable, waking up one waiting thread.
- */
-U_INTERNAL void U_EXPORT2 umtx_condSignal(UConditionVar *cond);
-
U_NAMESPACE_END
diff --git a/deps/icu-small/source/common/unames.cpp b/deps/icu-small/source/common/unames.cpp
index 038743004ea589..cde8b5ad7e51d4 100644
--- a/deps/icu-small/source/common/unames.cpp
+++ b/deps/icu-small/source/common/unames.cpp
@@ -144,7 +144,7 @@ static const char * const charCatNames[U_CHAR_EXTENDED_CATEGORY_COUNT] = {
"format",
"private use area",
"surrogate",
- "dash punctuation",
+ "dash punctuation",
"start punctuation",
"end punctuation",
"connector punctuation",
@@ -212,13 +212,13 @@ isDataLoaded(UErrorCode *pErrorCode) {
return U_SUCCESS(*pErrorCode);
}
-#define WRITE_CHAR(buffer, bufferLength, bufferPos, c) { \
+#define WRITE_CHAR(buffer, bufferLength, bufferPos, c) UPRV_BLOCK_MACRO_BEGIN { \
if((bufferLength)>0) { \
*(buffer)++=c; \
--(bufferLength); \
} \
++(bufferPos); \
-}
+} UPRV_BLOCK_MACRO_END
#define U_ISO_COMMENT U_CHAR_NAME_CHOICE_COUNT
@@ -451,7 +451,7 @@ static uint16_t getExtName(uint32_t code, char *buffer, uint16_t bufferLength) {
UChar32 cp;
int ndigits, i;
-
+
WRITE_CHAR(buffer, bufferLength, length, '<');
while (catname[length - 1]) {
WRITE_CHAR(buffer, bufferLength, length, catname[length - 1]);
@@ -639,7 +639,7 @@ enumGroupNames(UCharNames *names, const uint16_t *group,
* It only needs to do it if it is called with a real function and not
* with the dummy DO_FIND_NAME, because u_charFromName() does a check
* for extended names by itself.
- */
+ */
static UBool
enumExtNames(UChar32 start, UChar32 end,
UEnumCharNamesFn *fn, void *context)
@@ -647,7 +647,7 @@ enumExtNames(UChar32 start, UChar32 end,
if(fn!=DO_FIND_NAME) {
char buffer[200];
uint16_t length;
-
+
while(start<=end) {
buffer[length = getExtName(start, buffer, sizeof(buffer))] = 0;
/* here, we assume that the buffer is large enough */
@@ -765,7 +765,7 @@ enumNames(UCharNames *names,
}
return enumExtNames(start, limit - 1, fn, context);
}
-
+
return TRUE;
}
diff --git a/deps/icu-small/source/common/unicode/appendable.h b/deps/icu-small/source/common/unicode/appendable.h
index 8512c2f30311b8..4beacaf6583620 100644
--- a/deps/icu-small/source/common/unicode/appendable.h
+++ b/deps/icu-small/source/common/unicode/appendable.h
@@ -23,6 +23,9 @@
*/
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
U_NAMESPACE_BEGIN
@@ -231,4 +234,6 @@ class U_COMMON_API UnicodeStringAppendable : public Appendable {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __APPENDABLE_H__
diff --git a/deps/icu-small/source/common/unicode/brkiter.h b/deps/icu-small/source/common/unicode/brkiter.h
index ac1bf1df29f214..b944497345479b 100644
--- a/deps/icu-small/source/common/unicode/brkiter.h
+++ b/deps/icu-small/source/common/unicode/brkiter.h
@@ -29,6 +29,10 @@
* \brief C++ API: Break Iterator.
*/
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#if UCONFIG_NO_BREAK_ITERATION
U_NAMESPACE_BEGIN
@@ -135,7 +139,7 @@ class U_COMMON_API BreakIterator : public UObject {
* method which subclasses implement.
* @stable ICU 2.0
*/
- virtual BreakIterator* clone(void) const = 0;
+ virtual BreakIterator* clone() const = 0;
/**
* Return a polymorphic class ID for this object. Different subclasses
@@ -493,6 +497,7 @@ class U_COMMON_API BreakIterator : public UObject {
static UnicodeString& U_EXPORT2 getDisplayName(const Locale& objectLocale,
UnicodeString& name);
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Deprecated functionality. Use clone() instead.
*
@@ -515,6 +520,7 @@ class U_COMMON_API BreakIterator : public UObject {
virtual BreakIterator * createBufferClone(void *stackBuffer,
int32_t &BufferSize,
UErrorCode &status) = 0;
+#endif // U_FORCE_HIDE_DEPRECATED_API
#ifndef U_HIDE_DEPRECATED_API
@@ -658,5 +664,7 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // BRKITER_H
//eof
diff --git a/deps/icu-small/source/common/unicode/bytestream.h b/deps/icu-small/source/common/unicode/bytestream.h
index 61d1e8aca651d7..0d60492fe23556 100644
--- a/deps/icu-small/source/common/unicode/bytestream.h
+++ b/deps/icu-small/source/common/unicode/bytestream.h
@@ -38,6 +38,9 @@
*/
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
#include "unicode/std_string.h"
@@ -133,7 +136,7 @@ class U_COMMON_API ByteSink : public UMemory {
// -------------------------------------------------------------
// Some standard implementations
-/**
+/**
* Implementation of ByteSink that writes to a flat byte array,
* with bounds-checking:
* This sink will not write more than capacity bytes to outbuf.
@@ -223,7 +226,7 @@ class U_COMMON_API CheckedArrayByteSink : public ByteSink {
CheckedArrayByteSink &operator=(const CheckedArrayByteSink &) = delete;
};
-/**
+/**
* Implementation of ByteSink that writes to a "string".
* The StringClass is usually instantiated with a std::string.
* @stable ICU 4.2
@@ -239,7 +242,7 @@ class StringByteSink : public ByteSink {
StringByteSink(StringClass* dest) : dest_(dest) { }
/**
* Constructs a ByteSink that reserves append capacity and will append bytes to the dest string.
- *
+ *
* @param dest pointer to string object to append to
* @param initialAppendCapacity capacity beyond dest->length() to be reserve()d
* @stable ICU 60
@@ -267,4 +270,6 @@ class StringByteSink : public ByteSink {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __BYTESTREAM_H__
diff --git a/deps/icu-small/source/common/unicode/bytestrie.h b/deps/icu-small/source/common/unicode/bytestrie.h
index c57b8ccfeb5960..51405f64a10e64 100644
--- a/deps/icu-small/source/common/unicode/bytestrie.h
+++ b/deps/icu-small/source/common/unicode/bytestrie.h
@@ -23,6 +23,9 @@
*/
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/stringpiece.h"
#include "unicode/uobject.h"
#include "unicode/ustringtrie.h"
@@ -94,6 +97,41 @@ class U_COMMON_API BytesTrie : public UMemory {
return *this;
}
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns the state of this trie as a 64-bit integer.
+ * The state value is never 0.
+ *
+ * @return opaque state value
+ * @see resetToState64
+ * @draft ICU 65
+ */
+ uint64_t getState64() const {
+ return (static_cast(remainingMatchLength_ + 2) << kState64RemainingShift) |
+ (uint64_t)(pos_ - bytes_);
+ }
+
+ /**
+ * Resets this trie to the saved state.
+ * Unlike resetToState(State), the 64-bit state value
+ * must be from getState64() from the same trie object or
+ * from one initialized the exact same way.
+ * Because of no validation, this method is faster.
+ *
+ * @param state The opaque trie state value from getState64().
+ * @return *this
+ * @see getState64
+ * @see resetToState
+ * @see reset
+ * @draft ICU 65
+ */
+ BytesTrie &resetToState64(uint64_t state) {
+ remainingMatchLength_ = static_cast(state >> kState64RemainingShift) - 2;
+ pos_ = bytes_ + (state & kState64PosMask);
+ return *this;
+ }
+#endif /* U_HIDE_DRAFT_API */
+
/**
* BytesTrie state object, for saving a trie's current state
* and resetting the trie back to this state later.
@@ -502,6 +540,13 @@ class U_COMMON_API BytesTrie : public UMemory {
static const int32_t kMaxTwoByteDelta=((kMinThreeByteDeltaLead-kMinTwoByteDeltaLead)<<8)-1; // 0x2fff
static const int32_t kMaxThreeByteDelta=((kFourByteDeltaLead-kMinThreeByteDeltaLead)<<16)-1; // 0xdffff
+ // For getState64():
+ // The remainingMatchLength_ is -1..14=(kMaxLinearMatchLength=0x10)-2
+ // so we need at least 5 bits for that.
+ // We add 2 to store it as a positive value 1..16=kMaxLinearMatchLength.
+ static constexpr int32_t kState64RemainingShift = 59;
+ static constexpr uint64_t kState64PosMask = (UINT64_C(1) << kState64RemainingShift) - 1;
+
uint8_t *ownedArray_;
// Fixed value referencing the BytesTrie bytes.
@@ -517,4 +562,6 @@ class U_COMMON_API BytesTrie : public UMemory {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __BYTESTRIE_H__
diff --git a/deps/icu-small/source/common/unicode/bytestriebuilder.h b/deps/icu-small/source/common/unicode/bytestriebuilder.h
index b164e3bbd685f7..b98374bb8fdbc1 100644
--- a/deps/icu-small/source/common/unicode/bytestriebuilder.h
+++ b/deps/icu-small/source/common/unicode/bytestriebuilder.h
@@ -23,6 +23,9 @@
#define __BYTESTRIEBUILDER_H__
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/bytestrie.h"
#include "unicode/stringpiece.h"
#include "unicode/stringtriebuilder.h"
@@ -153,7 +156,7 @@ class U_COMMON_API BytesTrieBuilder : public StringTrieBuilder {
private:
const char *s;
};
-
+
virtual Node *createLinearMatchNode(int32_t i, int32_t byteIndex, int32_t length,
Node *nextNode) const;
@@ -179,4 +182,6 @@ class U_COMMON_API BytesTrieBuilder : public StringTrieBuilder {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __BYTESTRIEBUILDER_H__
diff --git a/deps/icu-small/source/common/unicode/caniter.h b/deps/icu-small/source/common/unicode/caniter.h
index b47e35da07bb7f..13e524ff6ad316 100644
--- a/deps/icu-small/source/common/unicode/caniter.h
+++ b/deps/icu-small/source/common/unicode/caniter.h
@@ -12,6 +12,8 @@
#include "unicode/utypes.h"
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_NORMALIZATION
#include "unicode/uobject.h"
@@ -21,7 +23,7 @@
* \file
* \brief C++ API: Canonical Iterator
*/
-
+
/** Should permutation skip characters with combining class zero
* Should be either TRUE or FALSE. This is a compile time option
* @stable ICU 2.4
@@ -207,4 +209,6 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_NORMALIZATION */
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/casemap.h b/deps/icu-small/source/common/unicode/casemap.h
index 477eb484d136b6..53af84fa74d65f 100644
--- a/deps/icu-small/source/common/unicode/casemap.h
+++ b/deps/icu-small/source/common/unicode/casemap.h
@@ -8,6 +8,9 @@
#define __CASEMAP_H__
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/stringpiece.h"
#include "unicode/uobject.h"
@@ -489,4 +492,6 @@ class U_COMMON_API CaseMap U_FINAL : public UMemory {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __CASEMAP_H__
diff --git a/deps/icu-small/source/common/unicode/char16ptr.h b/deps/icu-small/source/common/unicode/char16ptr.h
index a7c5f1a0c5ed56..c8a9ae6c35d646 100644
--- a/deps/icu-small/source/common/unicode/char16ptr.h
+++ b/deps/icu-small/source/common/unicode/char16ptr.h
@@ -7,9 +7,12 @@
#ifndef __CHAR16PTR_H__
#define __CHAR16PTR_H__
-#include
#include "unicode/utypes.h"
+#if U_SHOW_CPLUSPLUS_API
+
+#include
+
/**
* \file
* \brief C++ API: char16_t pointer wrappers with
@@ -305,4 +308,6 @@ inline OldUChar *toOldUCharPtr(char16_t *p) {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __CHAR16PTR_H__
diff --git a/deps/icu-small/source/common/unicode/chariter.h b/deps/icu-small/source/common/unicode/chariter.h
index 292794f6d65832..db86f79e42ee2e 100644
--- a/deps/icu-small/source/common/unicode/chariter.h
+++ b/deps/icu-small/source/common/unicode/chariter.h
@@ -13,13 +13,16 @@
#define CHARITER_H
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
#include "unicode/unistr.h"
/**
* \file
* \brief C++ API: Character Iterator
*/
-
+
U_NAMESPACE_BEGIN
/**
* Abstract class that defines an API for forward-only iteration
@@ -68,7 +71,7 @@ U_NAMESPACE_BEGIN
*
*
* Example:
- * \code
+ * \code
* void function1(ForwardCharacterIterator &it) {
* UChar32 c;
* while(it.hasNext()) {
@@ -96,27 +99,27 @@ class U_COMMON_API ForwardCharacterIterator : public UObject {
* @stable ICU 2.0
*/
enum { DONE = 0xffff };
-
+
/**
- * Destructor.
+ * Destructor.
* @stable ICU 2.0
*/
virtual ~ForwardCharacterIterator();
-
+
/**
* Returns true when both iterators refer to the same
- * character in the same character-storage object.
+ * character in the same character-storage object.
* @param that The ForwardCharacterIterator to be compared for equality
* @return true when both iterators refer to the same
* character in the same character-storage object
* @stable ICU 2.0
*/
virtual UBool operator==(const ForwardCharacterIterator& that) const = 0;
-
+
/**
* Returns true when the iterators refer to different
* text-storage objects, or to different characters in the
- * same text-storage object.
+ * same text-storage object.
* @param that The ForwardCharacterIterator to be compared for inequality
* @return true when the iterators refer to different
* text-storage objects, or to different characters in the
@@ -124,23 +127,23 @@ class U_COMMON_API ForwardCharacterIterator : public UObject {
* @stable ICU 2.0
*/
inline UBool operator!=(const ForwardCharacterIterator& that) const;
-
+
/**
- * Generates a hash code for this iterator.
+ * Generates a hash code for this iterator.
* @return the hash code.
* @stable ICU 2.0
*/
virtual int32_t hashCode(void) const = 0;
-
+
/**
* Returns a UClassID for this ForwardCharacterIterator ("poor man's
* RTTI"). Despite the fact that this function is public,
- * DO NOT CONSIDER IT PART OF CHARACTERITERATOR'S API!
- * @return a UClassID for this ForwardCharacterIterator
+ * DO NOT CONSIDER IT PART OF CHARACTERITERATOR'S API!
+ * @return a UClassID for this ForwardCharacterIterator
* @stable ICU 2.0
*/
virtual UClassID getDynamicClassID(void) const = 0;
-
+
/**
* Gets the current code unit for returning and advances to the next code unit
* in the iteration range
@@ -150,7 +153,7 @@ class U_COMMON_API ForwardCharacterIterator : public UObject {
* @stable ICU 2.0
*/
virtual char16_t nextPostInc(void) = 0;
-
+
/**
* Gets the current code point for returning and advances to the next code point
* in the iteration range
@@ -160,7 +163,7 @@ class U_COMMON_API ForwardCharacterIterator : public UObject {
* @stable ICU 2.0
*/
virtual UChar32 next32PostInc(void) = 0;
-
+
/**
* Returns FALSE if there are no more code units or code points
* at or after the current position in the iteration range.
@@ -171,14 +174,14 @@ class U_COMMON_API ForwardCharacterIterator : public UObject {
* @stable ICU 2.0
*/
virtual UBool hasNext() = 0;
-
+
protected:
/** Default constructor to be overridden in the implementing class. @stable ICU 2.0*/
ForwardCharacterIterator();
-
+
/** Copy constructor to be overridden in the implementing class. @stable ICU 2.0*/
ForwardCharacterIterator(const ForwardCharacterIterator &other);
-
+
/**
* Assignment operator to be overridden in the implementing class.
* @stable ICU 2.0
@@ -290,7 +293,7 @@ class U_COMMON_API ForwardCharacterIterator : public UObject {
* \endcode
*
* Traverse the text from start to finish
- *
+ *
* \code
* void traverseForward(CharacterIterator& iter)
* {
@@ -311,7 +314,7 @@ class U_COMMON_API ForwardCharacterIterator : public UObject {
* }
* \endcode
*
- * Traverse both forward and backward from a given position in the text.
+ * Traverse both forward and backward from a given position in the text.
* Calls to notBoundary() in this example represents some additional stopping criteria.
*
* \code
@@ -326,7 +329,7 @@ class U_COMMON_API ForwardCharacterIterator : public UObject {
* c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
* c = iter.previous()) {}
* int32_t start = iter.getIndex() + 1;
- *
+ *
* cout << "start: " << start << " end: " << end << endl;
* for (c = iter.setIndex(start); iter.getIndex() < end; c = iter.next() ) {
* processChar(c);
@@ -373,11 +376,11 @@ class U_COMMON_API CharacterIterator : public ForwardCharacterIterator {
* Returns a pointer to a new CharacterIterator of the same
* concrete class as this one, and referring to the same
* character in the same text-storage object as this one. The
- * caller is responsible for deleting the new clone.
+ * caller is responsible for deleting the new clone.
* @return a pointer to a new CharacterIterator
* @stable ICU 2.0
*/
- virtual CharacterIterator* clone(void) const = 0;
+ virtual CharacterIterator* clone() const = 0;
/**
* Sets the iterator to refer to the first code unit in its
@@ -436,7 +439,7 @@ class U_COMMON_API CharacterIterator : public ForwardCharacterIterator {
* @stable ICU 2.0
*/
virtual char16_t last(void) = 0;
-
+
/**
* Sets the iterator to refer to the last code point in its
* iteration range, and returns that code unit.
@@ -458,7 +461,7 @@ class U_COMMON_API CharacterIterator : public ForwardCharacterIterator {
/**
* Sets the iterator to refer to the "position"-th code unit
* in the text-storage object the iterator refers to, and
- * returns that code unit.
+ * returns that code unit.
* @param position the "position"-th code unit in the text-storage object
* @return the "position"-th code unit.
* @stable ICU 2.0
@@ -479,19 +482,19 @@ class U_COMMON_API CharacterIterator : public ForwardCharacterIterator {
virtual UChar32 setIndex32(int32_t position) = 0;
/**
- * Returns the code unit the iterator currently refers to.
- * @return the current code unit.
+ * Returns the code unit the iterator currently refers to.
+ * @return the current code unit.
* @stable ICU 2.0
*/
virtual char16_t current(void) const = 0;
-
+
/**
- * Returns the code point the iterator currently refers to.
+ * Returns the code point the iterator currently refers to.
* @return the current code point.
* @stable ICU 2.0
*/
virtual UChar32 current32(void) const = 0;
-
+
/**
* Advances to the next code unit in the iteration range
* (toward endIndex()), and returns that code unit. If there are
@@ -500,7 +503,7 @@ class U_COMMON_API CharacterIterator : public ForwardCharacterIterator {
* @stable ICU 2.0
*/
virtual char16_t next(void) = 0;
-
+
/**
* Advances to the next code point in the iteration range
* (toward endIndex()), and returns that code point. If there are
@@ -512,11 +515,11 @@ class U_COMMON_API CharacterIterator : public ForwardCharacterIterator {
* @stable ICU 2.0
*/
virtual UChar32 next32(void) = 0;
-
+
/**
* Advances to the previous code unit in the iteration range
* (toward startIndex()), and returns that code unit. If there are
- * no more code units to return, returns DONE.
+ * no more code units to return, returns DONE.
* @return the previous code unit.
* @stable ICU 2.0
*/
@@ -525,8 +528,8 @@ class U_COMMON_API CharacterIterator : public ForwardCharacterIterator {
/**
* Advances to the previous code point in the iteration range
* (toward startIndex()), and returns that code point. If there are
- * no more code points to return, returns DONE.
- * @return the previous code point.
+ * no more code points to return, returns DONE.
+ * @return the previous code point.
* @stable ICU 2.0
*/
virtual UChar32 previous32(void) = 0;
@@ -547,29 +550,29 @@ class U_COMMON_API CharacterIterator : public ForwardCharacterIterator {
* object of the character returned by first(). Since it's
* possible to create an iterator that iterates across only
* part of a text-storage object, this number isn't
- * necessarily 0.
+ * necessarily 0.
* @returns the numeric index in the underlying text-storage
* object of the character returned by first().
* @stable ICU 2.0
*/
inline int32_t startIndex(void) const;
-
+
/**
* Returns the numeric index in the underlying text-storage
* object of the position immediately BEYOND the character
- * returned by last().
+ * returned by last().
* @return the numeric index in the underlying text-storage
* object of the position immediately BEYOND the character
* returned by last().
* @stable ICU 2.0
*/
inline int32_t endIndex(void) const;
-
+
/**
* Returns the numeric index in the underlying text-storage
* object of the character the iterator currently refers to
- * (i.e., the character returned by current()).
- * @return the numeric index in the text-storage object of
+ * (i.e., the character returned by current()).
+ * @return the numeric index in the text-storage object of
* the character the iterator currently refers to
* @stable ICU 2.0
*/
@@ -615,8 +618,8 @@ class U_COMMON_API CharacterIterator : public ForwardCharacterIterator {
/**
* Copies the text under iteration into the UnicodeString
- * referred to by "result".
- * @param result Receives a copy of the text under iteration.
+ * referred to by "result".
+ * @param result Receives a copy of the text under iteration.
* @stable ICU 2.0
*/
virtual void getText(UnicodeString& result) = 0;
@@ -645,7 +648,7 @@ class U_COMMON_API CharacterIterator : public ForwardCharacterIterator {
* @stable ICU 2.0
*/
CharacterIterator(int32_t length, int32_t textBegin, int32_t textEnd, int32_t position);
-
+
/**
* Copy constructor.
*
@@ -725,4 +728,7 @@ CharacterIterator::getLength(void) const {
}
U_NAMESPACE_END
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/dbbi.h b/deps/icu-small/source/common/unicode/dbbi.h
index 62509c5227b9da..3de9cc381408c5 100644
--- a/deps/icu-small/source/common/unicode/dbbi.h
+++ b/deps/icu-small/source/common/unicode/dbbi.h
@@ -13,6 +13,10 @@
#ifndef DBBI_H
#define DBBI_H
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/rbbi.h"
#if !UCONFIG_NO_BREAK_ITERATION
@@ -21,7 +25,7 @@
* \file
* \brief C++ API: Dictionary Based Break Iterator
*/
-
+
U_NAMESPACE_BEGIN
#ifndef U_HIDE_DEPRECATED_API
@@ -39,4 +43,6 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/docmain.h b/deps/icu-small/source/common/unicode/docmain.h
index 89906799877622..704139a85ed558 100644
--- a/deps/icu-small/source/common/unicode/docmain.h
+++ b/deps/icu-small/source/common/unicode/docmain.h
@@ -1,7 +1,7 @@
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
- * COPYRIGHT:
+ * COPYRIGHT:
* Copyright (c) 1997-2012, International Business Machines Corporation and
* others. All Rights Reserved.
*
@@ -22,7 +22,7 @@
/*! \mainpage
*
* \section API API Reference Usage
- *
+ *
* C++ Programmers:
* Use Class Hierarchy or Alphabetical List
* or Compound List
@@ -31,7 +31,7 @@
* "BreakIterator". Once you are at the class, you will find an inheritance
* chart, a list of the public members, a detailed description of the class,
* then detailed member descriptions.
- *
+ *
* C Programmers:
* Use Module List or File Members
* to find a list of all the functions and constants.
@@ -46,7 +46,7 @@
*
*
API References for Previous Releases
* The API References for each release of ICU are also available as
- * a zip file from the ICU
+ * a zip file from the ICU
* download page.
*
*
@@ -99,7 +99,7 @@
*
*
* Codepage Conversion |
- * ucnv.h, ucnvsel.hb |
+ * ucnv.h, ucnvsel.h |
* C API |
*
*
@@ -115,7 +115,7 @@
*
* Locales |
* uloc.h |
- * icu::Locale, icu::LocaleBuilder |
+ * icu::Locale, icu::LocaleBuilder, icu::LocaleMatcher |
*
*
* Resource Bundles |
diff --git a/deps/icu-small/source/common/unicode/dtintrv.h b/deps/icu-small/source/common/unicode/dtintrv.h
index 625456f0c868e9..15e15c9d405b69 100644
--- a/deps/icu-small/source/common/unicode/dtintrv.h
+++ b/deps/icu-small/source/common/unicode/dtintrv.h
@@ -6,7 +6,7 @@
* others. All Rights Reserved.
*******************************************************************************
*
-* File DTINTRV.H
+* File DTINTRV.H
*
*******************************************************************************
*/
@@ -15,6 +15,9 @@
#define __DTINTRV_H__
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
/**
@@ -22,7 +25,6 @@
* \brief C++ API: Date Interval data type
*/
-
U_NAMESPACE_BEGIN
@@ -34,7 +36,7 @@ U_NAMESPACE_BEGIN
class U_COMMON_API DateInterval : public UObject {
public:
- /**
+ /**
* Construct a DateInterval given a from date and a to date.
* @param fromDate The from date in date interval.
* @param toDate The to date in date interval.
@@ -47,15 +49,15 @@ class U_COMMON_API DateInterval : public UObject {
* @stable ICU 4.0
*/
virtual ~DateInterval();
-
- /**
+
+ /**
* Get the from date.
* @return the from date in dateInterval.
* @stable ICU 4.0
*/
inline UDate getFromDate() const;
- /**
+ /**
* Get the to date.
* @return the to date in dateInterval.
* @stable ICU 4.0
@@ -89,7 +91,7 @@ class U_COMMON_API DateInterval : public UObject {
*/
virtual UClassID getDynamicClassID(void) const;
-
+
/**
* Copy constructor.
* @stable ICU 4.0
@@ -118,7 +120,7 @@ class U_COMMON_API DateInterval : public UObject {
/**
- * clone this object.
+ * clone this object.
* The caller owns the result and should delete it when done.
* @return a cloned DateInterval
* @stable ICU 4.0
@@ -126,7 +128,7 @@ class U_COMMON_API DateInterval : public UObject {
virtual DateInterval* clone() const;
private:
- /**
+ /**
* Default constructor, not implemented.
*/
DateInterval();
@@ -137,24 +139,26 @@ class U_COMMON_API DateInterval : public UObject {
} ;// end class DateInterval
-inline UDate
-DateInterval::getFromDate() const {
- return fromDate;
+inline UDate
+DateInterval::getFromDate() const {
+ return fromDate;
}
-inline UDate
-DateInterval::getToDate() const {
- return toDate;
+inline UDate
+DateInterval::getToDate() const {
+ return toDate;
}
-inline UBool
-DateInterval::operator!=(const DateInterval& other) const {
+inline UBool
+DateInterval::operator!=(const DateInterval& other) const {
return ( !operator==(other) );
}
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/edits.h b/deps/icu-small/source/common/unicode/edits.h
index 79e98b0cc27ac6..c3ceaccb3b3802 100644
--- a/deps/icu-small/source/common/unicode/edits.h
+++ b/deps/icu-small/source/common/unicode/edits.h
@@ -8,6 +8,9 @@
#define __EDITS_H__
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
/**
@@ -159,7 +162,7 @@ class U_COMMON_API Edits U_FINAL : public UMemory {
* @return TRUE if U_FAILURE(outErrorCode)
* @stable ICU 59
*/
- UBool copyErrorTo(UErrorCode &outErrorCode);
+ UBool copyErrorTo(UErrorCode &outErrorCode) const;
/**
* How much longer is the new text compared with the old text?
@@ -523,4 +526,6 @@ class U_COMMON_API Edits U_FINAL : public UMemory {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __EDITS_H__
diff --git a/deps/icu-small/source/common/unicode/enumset.h b/deps/icu-small/source/common/unicode/enumset.h
index 82d633ed016b5e..bde8c455c0dd2b 100644
--- a/deps/icu-small/source/common/unicode/enumset.h
+++ b/deps/icu-small/source/common/unicode/enumset.h
@@ -25,7 +25,7 @@ U_NAMESPACE_BEGIN
/* Can't use #ifndef U_HIDE_INTERNAL_API for the entire EnumSet class, needed in .h file declarations */
/**
- * enum bitset for boolean fields. Similar to Java EnumSet<>.
+ * enum bitset for boolean fields. Similar to Java EnumSet<>.
* Needs to range check. Used for private instance variables.
* @internal
* \cond
@@ -49,9 +49,9 @@ class EnumSet {
fBools = other.fBools;
return *this;
}
-
+
inline uint32_t getAll() const {
- return fBools;
+ return fBools;
}
#endif /* U_HIDE_INTERNAL_API */
diff --git a/deps/icu-small/source/common/unicode/errorcode.h b/deps/icu-small/source/common/unicode/errorcode.h
index 1e5df8f03e88fe..fe7b5183232cd1 100644
--- a/deps/icu-small/source/common/unicode/errorcode.h
+++ b/deps/icu-small/source/common/unicode/errorcode.h
@@ -20,12 +20,15 @@
#define __ERRORCODE_H__
/**
- * \file
+ * \file
* \brief C++ API: ErrorCode class intended to make it easier to use
* ICU C and C++ APIs from C++ user code.
*/
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
U_NAMESPACE_BEGIN
@@ -136,4 +139,6 @@ class U_COMMON_API ErrorCode: public UMemory {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __ERRORCODE_H__
diff --git a/deps/icu-small/source/common/unicode/filteredbrk.h b/deps/icu-small/source/common/unicode/filteredbrk.h
index 2444114e9a14bf..42936763259e2d 100644
--- a/deps/icu-small/source/common/unicode/filteredbrk.h
+++ b/deps/icu-small/source/common/unicode/filteredbrk.h
@@ -11,6 +11,9 @@
#define FILTEREDBRK_H
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/brkiter.h"
#if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION
@@ -101,6 +104,7 @@ class U_COMMON_API FilteredBreakIteratorBuilder : public UObject {
*/
virtual UBool unsuppressBreakAfter(const UnicodeString& string, UErrorCode& status) = 0;
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* This function has been deprecated in favor of wrapIteratorWithFilter()
* The behavior is identical.
@@ -111,6 +115,7 @@ class U_COMMON_API FilteredBreakIteratorBuilder : public UObject {
* @see wrapBreakIteratorWithFilter()
*/
virtual BreakIterator *build(BreakIterator* adoptBreakIterator, UErrorCode& status) = 0;
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Wrap (adopt) an existing break iterator in a new filtered instance.
@@ -142,4 +147,6 @@ U_NAMESPACE_END
#endif // #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_FILTERED_BREAK_ITERATION
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // #ifndef FILTEREDBRK_H
diff --git a/deps/icu-small/source/common/unicode/icudataver.h b/deps/icu-small/source/common/unicode/icudataver.h
index d5c728da880f8f..1cb202e3d45c62 100644
--- a/deps/icu-small/source/common/unicode/icudataver.h
+++ b/deps/icu-small/source/common/unicode/icudataver.h
@@ -32,10 +32,10 @@
/**
* Retrieves the data version from icuver and stores it in dataVersionFillin.
- *
+ *
* @param dataVersionFillin icuver data version information to be filled in if not-null
* @param status stores the error code from the calls to resource bundle
- *
+ *
* @stable ICU 49
*/
U_STABLE void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status);
diff --git a/deps/icu-small/source/common/unicode/icuplug.h b/deps/icu-small/source/common/unicode/icuplug.h
index 827cbe94b61cf8..2e57b149e14ede 100644
--- a/deps/icu-small/source/common/unicode/icuplug.h
+++ b/deps/icu-small/source/common/unicode/icuplug.h
@@ -17,7 +17,7 @@
/**
* \file
- * \brief C API: ICU Plugin API
+ * \brief C API: ICU Plugin API
*
* C API: ICU Plugin API
*
@@ -25,31 +25,31 @@
*
* Loading and Configuration
*
- * At ICU startup time, the environment variable "ICU_PLUGINS" will be
- * queried for a directory name. If it is not set, the preprocessor symbol
+ *
At ICU startup time, the environment variable "ICU_PLUGINS" will be
+ * queried for a directory name. If it is not set, the preprocessor symbol
* "DEFAULT_ICU_PLUGINS" will be checked for a default value.
*
- * Within the above-named directory, the file "icuplugins##.txt" will be
- * opened, if present, where ## is the major+minor number of the currently
+ *
Within the above-named directory, the file "icuplugins##.txt" will be
+ * opened, if present, where ## is the major+minor number of the currently
* running ICU (such as, 44 for ICU 4.4, thus icuplugins44.txt)
*
* The configuration file has this format:
*
*
* - Hash (#) begins a comment line
- *
+ *
* - Non-comment lines have two or three components:
* LIBRARYNAME ENTRYPOINT [ CONFIGURATION .. ]
*
* - Tabs or spaces separate the three items.
*
- * - LIBRARYNAME is the name of a shared library, either a short name if
+ *
- LIBRARYNAME is the name of a shared library, either a short name if
* it is on the loader path, or a full pathname.
*
- * - ENTRYPOINT is the short (undecorated) symbol name of the plugin's
+ *
- ENTRYPOINT is the short (undecorated) symbol name of the plugin's
* entrypoint, as above.
*
- * - CONFIGURATION is the entire rest of the line . It's passed as-is to
+ *
- CONFIGURATION is the entire rest of the line . It's passed as-is to
* the plugin.
*
*
@@ -59,25 +59,25 @@
* # this is icuplugins44.txt
* testplug.dll myPlugin hello=world
* \endcode
- * Plugins are categorized as "high" or "low" level. Low level are those
- * which must be run BEFORE high level plugins, and before any operations
- * which cause ICU to be 'initialized'. If a plugin is low level but
- * causes ICU to allocate memory or become initialized, that plugin is said
+ *
Plugins are categorized as "high" or "low" level. Low level are those
+ * which must be run BEFORE high level plugins, and before any operations
+ * which cause ICU to be 'initialized'. If a plugin is low level but
+ * causes ICU to allocate memory or become initialized, that plugin is said
* to cause a 'level change'.
*
- * At load time, ICU first queries all plugins to determine their level,
- * then loads all 'low' plugins first, and then loads all 'high' plugins.
+ *
At load time, ICU first queries all plugins to determine their level,
+ * then loads all 'low' plugins first, and then loads all 'high' plugins.
* Plugins are otherwise loaded in the order listed in the configuration file.
- *
+ *
* Implementing a Plugin
* \code
- * U_CAPI UPlugTokenReturn U_EXPORT2
+ * U_CAPI UPlugTokenReturn U_EXPORT2
* myPlugin (UPlugData *plug, UPlugReason reason, UErrorCode *status) {
* if(reason==UPLUG_REASON_QUERY) {
* uplug_setPlugName(plug, "Simple Plugin");
* uplug_setPlugLevel(plug, UPLUG_LEVEL_HIGH);
* } else if(reason==UPLUG_REASON_LOAD) {
- * ... Set up some ICU things here....
+ * ... Set up some ICU things here....
* } else if(reason==UPLUG_REASON_UNLOAD) {
* ... unload, clean up ...
* }
@@ -85,20 +85,20 @@
* }
* \endcode
*
- * The UPlugData* is an opaque pointer to the plugin-specific data, and is
+ *
The UPlugData* is an opaque pointer to the plugin-specific data, and is
* used in all other API calls.
*
* The API contract is:
- * - The plugin MUST always return UPLUG_TOKEN as a return value- to
+ *
- The plugin MUST always return UPLUG_TOKEN as a return value- to
* indicate that it is a valid plugin.
*
- * - When the 'reason' parameter is set to UPLUG_REASON_QUERY, the
- * plugin MUST call uplug_setPlugLevel() to indicate whether it is a high
+ *
- When the 'reason' parameter is set to UPLUG_REASON_QUERY, the
+ * plugin MUST call uplug_setPlugLevel() to indicate whether it is a high
* level or low level plugin.
*
- * - When the 'reason' parameter is UPLUG_REASON_QUERY, the plugin
+ *
- When the 'reason' parameter is UPLUG_REASON_QUERY, the plugin
* SHOULD call uplug_setPlugName to indicate a human readable plugin name.
- *
+ *
*
* \internal ICU 4.4 Technology Preview
*/
@@ -119,7 +119,7 @@
#ifndef U_HIDE_INTERNAL_API
/**
* @{
- * Opaque structure passed to/from a plugin.
+ * Opaque structure passed to/from a plugin.
* use the APIs to access it.
* @internal ICU 4.4 Technology Preview
*/
@@ -130,7 +130,7 @@ typedef struct UPlugData UPlugData;
/** @} */
/**
- * Random Token to identify a valid ICU plugin. Plugins must return this
+ * Random Token to identify a valid ICU plugin. Plugins must return this
* from the entrypoint.
* @internal ICU 4.4 Technology Preview
*/
@@ -144,7 +144,7 @@ typedef struct UPlugData UPlugData;
/**
- * Return value from a plugin entrypoint.
+ * Return value from a plugin entrypoint.
* Must always be set to UPLUG_TOKEN
* @see UPLUG_TOKEN
* @internal ICU 4.4 Technology Preview
@@ -188,7 +188,7 @@ typedef enum {
/**
* Entrypoint for an ICU plugin.
- * @param plug the UPlugData handle.
+ * @param plug the UPlugData handle.
* @param status the plugin's extended status code.
* @return A valid plugin must return UPLUG_TOKEN
* @internal ICU 4.4 Technology Preview
@@ -208,7 +208,7 @@ typedef UPlugTokenReturn (U_EXPORT2 UPlugEntrypoint) (
* @param dontUnload set true if this plugin can't be unloaded
* @internal ICU 4.4 Technology Preview
*/
-U_INTERNAL void U_EXPORT2
+U_INTERNAL void U_EXPORT2
uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload);
/**
@@ -246,7 +246,7 @@ uplug_getCurrentLevel(void);
* @internal ICU 4.4 Technology Preview
*/
U_INTERNAL UErrorCode U_EXPORT2
-uplug_getPlugLoadStatus(UPlugData *plug);
+uplug_getPlugLoadStatus(UPlugData *plug);
/**
* Set the human-readable name of this plugin.
@@ -287,7 +287,7 @@ uplug_getLibraryName(UPlugData *plug, UErrorCode *status);
/**
* Return the library used for this plugin, if known.
- * Plugins could use this to load data out of their
+ * Plugins could use this to load data out of their
* @param plug plugin data handle
* @return the library, or NULL
* @internal ICU 4.4 Technology Preview
@@ -334,7 +334,7 @@ uplug_getConfiguration(UPlugData *plug);
* }
* \endcode
* Not thread safe- do not call while plugs are added or removed.
- * @param prior pass in 'NULL' to get the first (most recent) plug,
+ * @param prior pass in 'NULL' to get the first (most recent) plug,
* otherwise pass the value returned on a prior call to uplug_nextPlug
* @return the next oldest plugin, or NULL if no more.
* @internal ICU 4.4 Technology Preview
@@ -344,7 +344,7 @@ uplug_nextPlug(UPlugData *prior);
/**
* Inject a plugin as if it were loaded from a library.
- * This is useful for testing plugins.
+ * This is useful for testing plugins.
* Note that it will have a 'NULL' library pointer associated
* with it, and therefore no llibrary will be closed at cleanup time.
* Low level plugins may not be able to load, as ordering can't be enforced.
@@ -372,7 +372,7 @@ U_INTERNAL UPlugData* U_EXPORT2
uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status);
/**
- * Remove a plugin.
+ * Remove a plugin.
* Will request the plugin to be unloaded, and close the library if needed
* @param plug plugin handle to close
* @param status error result
@@ -385,3 +385,4 @@ uplug_removePlug(UPlugData *plug, UErrorCode *status);
#endif /* UCONFIG_ENABLE_PLUGINS */
#endif /* _ICUPLUG */
+
diff --git a/deps/icu-small/source/common/unicode/idna.h b/deps/icu-small/source/common/unicode/idna.h
index f08658e502e200..6dfcfe48db28f1 100644
--- a/deps/icu-small/source/common/unicode/idna.h
+++ b/deps/icu-small/source/common/unicode/idna.h
@@ -24,6 +24,8 @@
#include "unicode/utypes.h"
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_IDNA
#include "unicode/bytestream.h"
@@ -322,4 +324,7 @@ class U_COMMON_API IDNAInfo : public UMemory {
U_NAMESPACE_END
#endif // UCONFIG_NO_IDNA
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __IDNA_H__
diff --git a/deps/icu-small/source/common/unicode/localebuilder.h b/deps/icu-small/source/common/unicode/localebuilder.h
index 960e5980c03c2e..19e10f1c070924 100644
--- a/deps/icu-small/source/common/unicode/localebuilder.h
+++ b/deps/icu-small/source/common/unicode/localebuilder.h
@@ -3,11 +3,14 @@
#ifndef __LOCALEBUILDER_H__
#define __LOCALEBUILDER_H__
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/locid.h"
+#include "unicode/localematcher.h"
#include "unicode/stringpiece.h"
#include "unicode/uobject.h"
-#include "unicode/utypes.h"
-
#ifndef U_HIDE_DRAFT_API
/**
@@ -276,7 +279,24 @@ class U_COMMON_API LocaleBuilder : public UObject {
*/
Locale build(UErrorCode& status);
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Sets the UErrorCode if an error occurred while recording sets.
+ * Preserves older error codes in the outErrorCode.
+ * @param outErrorCode Set to an error code that occurred while setting subtags.
+ * Unchanged if there is no such error or if outErrorCode
+ * already contained an error.
+ * @return TRUE if U_FAILURE(outErrorCode)
+ * @draft ICU 65
+ */
+ UBool copyErrorTo(UErrorCode &outErrorCode) const;
+#endif /* U_HIDE_DRAFT_API */
+
private:
+ friend class LocaleMatcher::Result;
+
+ void copyExtensionsFrom(const Locale& src, UErrorCode& errorCode);
+
UErrorCode status_;
char language_[9];
char script_[5];
@@ -289,4 +309,7 @@ class U_COMMON_API LocaleBuilder : public UObject {
U_NAMESPACE_END
#endif // U_HIDE_DRAFT_API
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __LOCALEBUILDER_H__
diff --git a/deps/icu-small/source/common/unicode/localematcher.h b/deps/icu-small/source/common/unicode/localematcher.h
new file mode 100644
index 00000000000000..701123f750b222
--- /dev/null
+++ b/deps/icu-small/source/common/unicode/localematcher.h
@@ -0,0 +1,605 @@
+// © 2019 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html#License
+
+// localematcher.h
+// created: 2019may08 Markus W. Scherer
+
+#ifndef __LOCALEMATCHER_H__
+#define __LOCALEMATCHER_H__
+
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#include "unicode/locid.h"
+#include "unicode/stringpiece.h"
+#include "unicode/uobject.h"
+
+/**
+ * \file
+ * \brief C++ API: Locale matcher: User's desired locales vs. application's supported locales.
+ */
+
+#ifndef U_HIDE_DRAFT_API
+
+/**
+ * Builder option for whether the language subtag or the script subtag is most important.
+ *
+ * @see Builder#setFavorSubtag(FavorSubtag)
+ * @draft ICU 65
+ */
+enum ULocMatchFavorSubtag {
+ /**
+ * Language differences are most important, then script differences, then region differences.
+ * (This is the default behavior.)
+ *
+ * @draft ICU 65
+ */
+ ULOCMATCH_FAVOR_LANGUAGE,
+ /**
+ * Makes script differences matter relatively more than language differences.
+ *
+ * @draft ICU 65
+ */
+ ULOCMATCH_FAVOR_SCRIPT
+};
+#ifndef U_IN_DOXYGEN
+typedef enum ULocMatchFavorSubtag ULocMatchFavorSubtag;
+#endif
+
+/**
+ * Builder option for whether all desired locales are treated equally or
+ * earlier ones are preferred.
+ *
+ * @see Builder#setDemotionPerDesiredLocale(Demotion)
+ * @draft ICU 65
+ */
+enum ULocMatchDemotion {
+ /**
+ * All desired locales are treated equally.
+ *
+ * @draft ICU 65
+ */
+ ULOCMATCH_DEMOTION_NONE,
+ /**
+ * Earlier desired locales are preferred.
+ *
+ * From each desired locale to the next,
+ * the distance to any supported locale is increased by an additional amount
+ * which is at least as large as most region mismatches.
+ * A later desired locale has to have a better match with some supported locale
+ * due to more than merely having the same region subtag.
+ *
+ *
For example: Supported={en, sv} desired=[en-GB, sv]
+ * yields Result(en-GB, en)
because
+ * with the demotion of sv its perfect match is no better than
+ * the region distance between the earlier desired locale en-GB and en=en-US.
+ *
+ *
Notes:
+ *
+ * - In some cases, language and/or script differences can be as small as
+ * the typical region difference. (Example: sr-Latn vs. sr-Cyrl)
+ *
- It is possible for certain region differences to be larger than usual,
+ * and larger than the demotion.
+ * (As of CLDR 35 there is no such case, but
+ * this is possible in future versions of the data.)
+ *
+ *
+ * @draft ICU 65
+ */
+ ULOCMATCH_DEMOTION_REGION
+};
+#ifndef U_IN_DOXYGEN
+typedef enum ULocMatchDemotion ULocMatchDemotion;
+#endif
+
+struct UHashtable;
+
+U_NAMESPACE_BEGIN
+
+struct LSR;
+
+class LocaleDistance;
+class LocaleLsrIterator;
+class UVector;
+class XLikelySubtags;
+
+/**
+ * Immutable class that picks the best match between a user's desired locales and
+ * an application's supported locales.
+ * Movable but not copyable.
+ *
+ * Example:
+ *
+ * UErrorCode errorCode = U_ZERO_ERROR;
+ * LocaleMatcher matcher = LocaleMatcher::Builder().setSupportedLocales("fr, en-GB, en").build(errorCode);
+ * Locale *bestSupported = matcher.getBestLocale(Locale.US, errorCode); // "en"
+ *
+ *
+ * A matcher takes into account when languages are close to one another,
+ * such as Danish and Norwegian,
+ * and when regional variants are close, like en-GB and en-AU as opposed to en-US.
+ *
+ *
If there are multiple supported locales with the same (language, script, region)
+ * likely subtags, then the current implementation returns the first of those locales.
+ * It ignores variant subtags (except for pseudolocale variants) and extensions.
+ * This may change in future versions.
+ *
+ *
For example, the current implementation does not distinguish between
+ * de, de-DE, de-Latn, de-1901, de-u-co-phonebk.
+ *
+ *
If you prefer one equivalent locale over another, then provide only the preferred one,
+ * or place it earlier in the list of supported locales.
+ *
+ *
Otherwise, the order of supported locales may have no effect on the best-match results.
+ * The current implementation compares each desired locale with supported locales
+ * in the following order:
+ * 1. Default locale, if supported;
+ * 2. CLDR "paradigm locales" like en-GB and es-419;
+ * 3. other supported locales.
+ * This may change in future versions.
+ *
+ *
Often a product will just need one matcher instance, built with the languages
+ * that it supports. However, it may want multiple instances with different
+ * default languages based on additional information, such as the domain.
+ *
+ *
This class is not intended for public subclassing.
+ *
+ * @draft ICU 65
+ */
+class U_COMMON_API LocaleMatcher : public UMemory {
+public:
+ /**
+ * Data for the best-matching pair of a desired and a supported locale.
+ * Movable but not copyable.
+ *
+ * @draft ICU 65
+ */
+ class U_COMMON_API Result : public UMemory {
+ public:
+ /**
+ * Move constructor; might modify the source.
+ * This object will have the same contents that the source object had.
+ *
+ * @param src Result to move contents from.
+ * @draft ICU 65
+ */
+ Result(Result &&src) U_NOEXCEPT;
+
+ /**
+ * Destructor.
+ *
+ * @draft ICU 65
+ */
+ ~Result();
+
+ /**
+ * Move assignment; might modify the source.
+ * This object will have the same contents that the source object had.
+ *
+ * @param src Result to move contents from.
+ * @draft ICU 65
+ */
+ Result &operator=(Result &&src) U_NOEXCEPT;
+
+ /**
+ * Returns the best-matching desired locale.
+ * nullptr if the list of desired locales is empty or if none matched well enough.
+ *
+ * @return the best-matching desired locale, or nullptr.
+ * @draft ICU 65
+ */
+ inline const Locale *getDesiredLocale() const { return desiredLocale; }
+
+ /**
+ * Returns the best-matching supported locale.
+ * If none matched well enough, this is the default locale.
+ * The default locale is nullptr if the list of supported locales is empty and
+ * no explicit default locale is set.
+ *
+ * @return the best-matching supported locale, or nullptr.
+ * @draft ICU 65
+ */
+ inline const Locale *getSupportedLocale() const { return supportedLocale; }
+
+ /**
+ * Returns the index of the best-matching desired locale in the input Iterable order.
+ * -1 if the list of desired locales is empty or if none matched well enough.
+ *
+ * @return the index of the best-matching desired locale, or -1.
+ * @draft ICU 65
+ */
+ inline int32_t getDesiredIndex() const { return desiredIndex; }
+
+ /**
+ * Returns the index of the best-matching supported locale in the
+ * constructor’s or builder’s input order (“set” Collection plus “added” locales).
+ * If the matcher was built from a locale list string, then the iteration order is that
+ * of a LocalePriorityList built from the same string.
+ * -1 if the list of supported locales is empty or if none matched well enough.
+ *
+ * @return the index of the best-matching supported locale, or -1.
+ * @draft ICU 65
+ */
+ inline int32_t getSupportedIndex() const { return supportedIndex; }
+
+ /**
+ * Takes the best-matching supported locale and adds relevant fields of the
+ * best-matching desired locale, such as the -t- and -u- extensions.
+ * May replace some fields of the supported locale.
+ * The result is the locale that should be used for date and number formatting, collation, etc.
+ * Returns the root locale if getSupportedLocale() returns nullptr.
+ *
+ *
Example: desired=ar-SA-u-nu-latn, supported=ar-EG, resolved locale=ar-SA-u-nu-latn
+ *
+ * @return a locale combining the best-matching desired and supported locales.
+ * @draft ICU 65
+ */
+ Locale makeResolvedLocale(UErrorCode &errorCode) const;
+
+ private:
+ Result(const Locale *desired, const Locale *supported,
+ int32_t desIndex, int32_t suppIndex, UBool owned) :
+ desiredLocale(desired), supportedLocale(supported),
+ desiredIndex(desIndex), supportedIndex(suppIndex),
+ desiredIsOwned(owned) {}
+
+ Result(const Result &other) = delete;
+ Result &operator=(const Result &other) = delete;
+
+ const Locale *desiredLocale;
+ const Locale *supportedLocale;
+ int32_t desiredIndex;
+ int32_t supportedIndex;
+ UBool desiredIsOwned;
+
+ friend class LocaleMatcher;
+ };
+
+ /**
+ * LocaleMatcher builder.
+ * Movable but not copyable.
+ *
+ * @see LocaleMatcher#builder()
+ * @draft ICU 65
+ */
+ class U_COMMON_API Builder : public UMemory {
+ public:
+ /**
+ * Constructs a builder used in chaining parameters for building a LocaleMatcher.
+ *
+ * @return a new Builder object
+ * @draft ICU 65
+ */
+ Builder() {}
+
+ /**
+ * Move constructor; might modify the source.
+ * This builder will have the same contents that the source builder had.
+ *
+ * @param src Builder to move contents from.
+ * @draft ICU 65
+ */
+ Builder(Builder &&src) U_NOEXCEPT;
+
+ /**
+ * Destructor.
+ *
+ * @draft ICU 65
+ */
+ ~Builder();
+
+ /**
+ * Move assignment; might modify the source.
+ * This builder will have the same contents that the source builder had.
+ *
+ * @param src Builder to move contents from.
+ * @draft ICU 65
+ */
+ Builder &operator=(Builder &&src) U_NOEXCEPT;
+
+ /**
+ * Parses an Accept-Language string
+ * (RFC 2616 Section 14.4),
+ * such as "af, en, fr;q=0.9", and sets the supported locales accordingly.
+ * Allows whitespace in more places but does not allow "*".
+ * Clears any previously set/added supported locales first.
+ *
+ * @param locales the Accept-Language string of locales to set
+ * @return this Builder object
+ * @draft ICU 65
+ */
+ Builder &setSupportedLocalesFromListString(StringPiece locales);
+
+ /**
+ * Copies the supported locales, preserving iteration order.
+ * Clears any previously set/added supported locales first.
+ * Duplicates are allowed, and are not removed.
+ *
+ * @param locales the list of locale
+ * @return this Builder object
+ * @draft ICU 65
+ */
+ Builder &setSupportedLocales(Locale::Iterator &locales);
+
+ /**
+ * Copies the supported locales from the begin/end range, preserving iteration order.
+ * Clears any previously set/added supported locales first.
+ * Duplicates are allowed, and are not removed.
+ *
+ * Each of the iterator parameter values must be an
+ * input iterator whose value is convertible to const Locale &.
+ *
+ * @param begin Start of range.
+ * @param end Exclusive end of range.
+ * @return this Builder object
+ * @draft ICU 65
+ */
+ template
+ Builder &setSupportedLocales(Iter begin, Iter end) {
+ if (U_FAILURE(errorCode_)) { return *this; }
+ clearSupportedLocales();
+ while (begin != end) {
+ addSupportedLocale(*begin++);
+ }
+ return *this;
+ }
+
+ /**
+ * Copies the supported locales from the begin/end range, preserving iteration order.
+ * Calls the converter to convert each *begin to a Locale or const Locale &.
+ * Clears any previously set/added supported locales first.
+ * Duplicates are allowed, and are not removed.
+ *
+ * Each of the iterator parameter values must be an
+ * input iterator whose value is convertible to const Locale &.
+ *
+ * @param begin Start of range.
+ * @param end Exclusive end of range.
+ * @param converter Converter from *begin to const Locale & or compatible.
+ * @return this Builder object
+ * @draft ICU 65
+ */
+ template
+ Builder &setSupportedLocalesViaConverter(Iter begin, Iter end, Conv converter) {
+ if (U_FAILURE(errorCode_)) { return *this; }
+ clearSupportedLocales();
+ while (begin != end) {
+ addSupportedLocale(converter(*begin++));
+ }
+ return *this;
+ }
+
+ /**
+ * Adds another supported locale.
+ * Duplicates are allowed, and are not removed.
+ *
+ * @param locale another locale
+ * @return this Builder object
+ * @draft ICU 65
+ */
+ Builder &addSupportedLocale(const Locale &locale);
+
+ /**
+ * Sets the default locale; if nullptr, or if it is not set explicitly,
+ * then the first supported locale is used as the default locale.
+ *
+ * @param defaultLocale the default locale (will be copied)
+ * @return this Builder object
+ * @draft ICU 65
+ */
+ Builder &setDefaultLocale(const Locale *defaultLocale);
+
+ /**
+ * If ULOCMATCH_FAVOR_SCRIPT, then the language differences are smaller than script
+ * differences.
+ * This is used in situations (such as maps) where
+ * it is better to fall back to the same script than a similar language.
+ *
+ * @param subtag the subtag to favor
+ * @return this Builder object
+ * @draft ICU 65
+ */
+ Builder &setFavorSubtag(ULocMatchFavorSubtag subtag);
+
+ /**
+ * Option for whether all desired locales are treated equally or
+ * earlier ones are preferred (this is the default).
+ *
+ * @param demotion the demotion per desired locale to set.
+ * @return this Builder object
+ * @draft ICU 65
+ */
+ Builder &setDemotionPerDesiredLocale(ULocMatchDemotion demotion);
+
+ /**
+ * Sets the UErrorCode if an error occurred while setting parameters.
+ * Preserves older error codes in the outErrorCode.
+ *
+ * @param outErrorCode Set to an error code if it does not contain one already
+ * and an error occurred while setting parameters.
+ * Otherwise unchanged.
+ * @return TRUE if U_FAILURE(outErrorCode)
+ * @draft ICU 65
+ */
+ UBool copyErrorTo(UErrorCode &outErrorCode) const;
+
+ /**
+ * Builds and returns a new locale matcher.
+ * This builder can continue to be used.
+ *
+ * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test,
+ * or else the function returns immediately. Check for U_FAILURE()
+ * on output or use with function chaining. (See User Guide for details.)
+ * @return new LocaleMatcher.
+ * @draft ICU 65
+ */
+ LocaleMatcher build(UErrorCode &errorCode) const;
+
+ private:
+ friend class LocaleMatcher;
+
+ Builder(const Builder &other) = delete;
+ Builder &operator=(const Builder &other) = delete;
+
+ void clearSupportedLocales();
+ bool ensureSupportedLocaleVector();
+
+ UErrorCode errorCode_ = U_ZERO_ERROR;
+ UVector *supportedLocales_ = nullptr;
+ int32_t thresholdDistance_ = -1;
+ ULocMatchDemotion demotion_ = ULOCMATCH_DEMOTION_REGION;
+ Locale *defaultLocale_ = nullptr;
+ ULocMatchFavorSubtag favor_ = ULOCMATCH_FAVOR_LANGUAGE;
+ };
+
+ // FYI No public LocaleMatcher constructors in C++; use the Builder.
+
+ /**
+ * Move copy constructor; might modify the source.
+ * This matcher will have the same settings that the source matcher had.
+ * @param src source matcher
+ * @draft ICU 65
+ */
+ LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT;
+
+ /**
+ * Destructor.
+ * @draft ICU 65
+ */
+ ~LocaleMatcher();
+
+ /**
+ * Move assignment operator; might modify the source.
+ * This matcher will have the same settings that the source matcher had.
+ * The behavior is undefined if *this and src are the same object.
+ * @param src source matcher
+ * @return *this
+ * @draft ICU 65
+ */
+ LocaleMatcher &operator=(LocaleMatcher &&src) U_NOEXCEPT;
+
+ /**
+ * Returns the supported locale which best matches the desired locale.
+ *
+ * @param desiredLocale Typically a user's language.
+ * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test,
+ * or else the function returns immediately. Check for U_FAILURE()
+ * on output or use with function chaining. (See User Guide for details.)
+ * @return the best-matching supported locale.
+ * @draft ICU 65
+ */
+ const Locale *getBestMatch(const Locale &desiredLocale, UErrorCode &errorCode) const;
+
+ /**
+ * Returns the supported locale which best matches one of the desired locales.
+ *
+ * @param desiredLocales Typically a user's languages, in order of preference (descending).
+ * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test,
+ * or else the function returns immediately. Check for U_FAILURE()
+ * on output or use with function chaining. (See User Guide for details.)
+ * @return the best-matching supported locale.
+ * @draft ICU 65
+ */
+ const Locale *getBestMatch(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const;
+
+ /**
+ * Parses an Accept-Language string
+ * (RFC 2616 Section 14.4),
+ * such as "af, en, fr;q=0.9",
+ * and returns the supported locale which best matches one of the desired locales.
+ * Allows whitespace in more places but does not allow "*".
+ *
+ * @param desiredLocaleList Typically a user's languages, as an Accept-Language string.
+ * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test,
+ * or else the function returns immediately. Check for U_FAILURE()
+ * on output or use with function chaining. (See User Guide for details.)
+ * @return the best-matching supported locale.
+ * @draft ICU 65
+ */
+ const Locale *getBestMatchForListString(StringPiece desiredLocaleList, UErrorCode &errorCode) const;
+
+ /**
+ * Returns the best match between the desired locale and the supported locales.
+ * If the result's desired locale is not nullptr, then it is the address of the input locale.
+ * It has not been cloned.
+ *
+ * @param desiredLocale Typically a user's language.
+ * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test,
+ * or else the function returns immediately. Check for U_FAILURE()
+ * on output or use with function chaining. (See User Guide for details.)
+ * @return the best-matching pair of the desired and a supported locale.
+ * @draft ICU 65
+ */
+ Result getBestMatchResult(const Locale &desiredLocale, UErrorCode &errorCode) const;
+
+ /**
+ * Returns the best match between the desired and supported locales.
+ * If the result's desired locale is not nullptr, then it is a clone of
+ * the best-matching desired locale. The Result object owns the clone.
+ *
+ * @param desiredLocales Typically a user's languages, in order of preference (descending).
+ * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test,
+ * or else the function returns immediately. Check for U_FAILURE()
+ * on output or use with function chaining. (See User Guide for details.)
+ * @return the best-matching pair of a desired and a supported locale.
+ * @draft ICU 65
+ */
+ Result getBestMatchResult(Locale::Iterator &desiredLocales, UErrorCode &errorCode) const;
+
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ * Returns a fraction between 0 and 1, where 1 means that the languages are a
+ * perfect match, and 0 means that they are completely different.
+ *
+ * This is mostly an implementation detail, and the precise values may change over time.
+ * The implementation may use either the maximized forms or the others ones, or both.
+ * The implementation may or may not rely on the forms to be consistent with each other.
+ *
+ *
Callers should construct and use a matcher rather than match pairs of locales directly.
+ *
+ * @param desired Desired locale.
+ * @param supported Supported locale.
+ * @param errorCode ICU error code. Its input value must pass the U_SUCCESS() test,
+ * or else the function returns immediately. Check for U_FAILURE()
+ * on output or use with function chaining. (See User Guide for details.)
+ * @return value between 0 and 1, inclusive.
+ * @internal (has a known user)
+ */
+ double internalMatch(const Locale &desired, const Locale &supported, UErrorCode &errorCode) const;
+#endif // U_HIDE_INTERNAL_API
+
+private:
+ LocaleMatcher(const Builder &builder, UErrorCode &errorCode);
+ LocaleMatcher(const LocaleMatcher &other) = delete;
+ LocaleMatcher &operator=(const LocaleMatcher &other) = delete;
+
+ int32_t getBestSuppIndex(LSR desiredLSR, LocaleLsrIterator *remainingIter, UErrorCode &errorCode) const;
+
+ const XLikelySubtags &likelySubtags;
+ const LocaleDistance &localeDistance;
+ int32_t thresholdDistance;
+ int32_t demotionPerDesiredLocale;
+ ULocMatchFavorSubtag favorSubtag;
+
+ // These are in input order.
+ const Locale ** supportedLocales;
+ LSR *lsrs;
+ int32_t supportedLocalesLength;
+ // These are in preference order: 1. Default locale 2. paradigm locales 3. others.
+ UHashtable *supportedLsrToIndex; // Map stores index+1 because 0 is "not found"
+ // Array versions of the supportedLsrToIndex keys and values.
+ // The distance lookup loops over the supportedLSRs and returns the index of the best match.
+ const LSR **supportedLSRs;
+ int32_t *supportedIndexes;
+ int32_t supportedLSRsLength;
+ Locale *ownedDefaultLocale;
+ const Locale *defaultLocale;
+ int32_t defaultLocaleIndex;
+};
+
+U_NAMESPACE_END
+
+#endif // U_HIDE_DRAFT_API
+#endif // U_SHOW_CPLUSPLUS_API
+#endif // __LOCALEMATCHER_H__
diff --git a/deps/icu-small/source/common/unicode/locdspnm.h b/deps/icu-small/source/common/unicode/locdspnm.h
index f6e778356feced..4f06f857044c6e 100644
--- a/deps/icu-small/source/common/unicode/locdspnm.h
+++ b/deps/icu-small/source/common/unicode/locdspnm.h
@@ -12,6 +12,8 @@
#include "unicode/utypes.h"
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Provides display names of Locale and its components.
@@ -204,4 +206,6 @@ U_NAMESPACE_END
#endif
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/locid.h b/deps/icu-small/source/common/unicode/locid.h
index 7350e381ffa540..57c669b3343173 100644
--- a/deps/icu-small/source/common/unicode/locid.h
+++ b/deps/icu-small/source/common/unicode/locid.h
@@ -31,11 +31,14 @@
#ifndef LOCID_H
#define LOCID_H
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/bytestream.h"
#include "unicode/localpointer.h"
#include "unicode/strenum.h"
#include "unicode/stringpiece.h"
-#include "unicode/utypes.h"
#include "unicode/uobject.h"
#include "unicode/putil.h"
#include "unicode/uloc.h"
@@ -284,16 +287,14 @@ class U_COMMON_API Locale : public UObject {
*/
Locale(const Locale& other);
-#ifndef U_HIDE_DRAFT_API
/**
* Move constructor; might leave source in bogus state.
* This locale will have the same contents that the source locale had.
*
* @param other The Locale object being moved in.
- * @draft ICU 63
+ * @stable ICU 63
*/
Locale(Locale&& other) U_NOEXCEPT;
-#endif // U_HIDE_DRAFT_API
/**
* Destructor
@@ -310,7 +311,6 @@ class U_COMMON_API Locale : public UObject {
*/
Locale& operator=(const Locale& other);
-#ifndef U_HIDE_DRAFT_API
/**
* Move assignment operator; might leave source in bogus state.
* This locale will have the same contents that the source locale had.
@@ -318,10 +318,9 @@ class U_COMMON_API Locale : public UObject {
*
* @param other The Locale object being moved in.
* @return *this
- * @draft ICU 63
+ * @stable ICU 63
*/
Locale& operator=(Locale&& other) U_NOEXCEPT;
-#endif // U_HIDE_DRAFT_API
/**
* Checks if two locale keys are the same.
@@ -389,7 +388,6 @@ class U_COMMON_API Locale : public UObject {
UErrorCode& success);
#endif /* U_HIDE_SYSTEM_API */
-#ifndef U_HIDE_DRAFT_API
/**
* Returns a Locale for the specified BCP47 language tag string.
* If the specified language tag contains any ill-formed subtags,
@@ -405,7 +403,7 @@ class U_COMMON_API Locale : public UObject {
* @param tag the input BCP47 language tag.
* @param status error information if creating the Locale failed.
* @return the Locale for the specified BCP47 language tag.
- * @draft ICU 63
+ * @stable ICU 63
*/
static Locale U_EXPORT2 forLanguageTag(StringPiece tag, UErrorCode& status);
@@ -420,7 +418,7 @@ class U_COMMON_API Locale : public UObject {
* @param sink the output sink receiving the BCP47 language
* tag for this Locale.
* @param status error information if creating the language tag failed.
- * @draft ICU 63
+ * @stable ICU 63
*/
void toLanguageTag(ByteSink& sink, UErrorCode& status) const;
@@ -432,11 +430,10 @@ class U_COMMON_API Locale : public UObject {
*
* @param status error information if creating the language tag failed.
* @return the BCP47 language tag for this Locale.
- * @draft ICU 63
+ * @stable ICU 63
*/
template
inline StringClass toLanguageTag(UErrorCode& status) const;
-#endif // U_HIDE_DRAFT_API
/**
* Creates a locale which has had minimal canonicalization
@@ -508,7 +505,6 @@ class U_COMMON_API Locale : public UObject {
*/
const char * getBaseName() const;
-#ifndef U_HIDE_DRAFT_API
/**
* Add the likely subtags for this Locale, per the algorithm described
* in the following CLDR technical report:
@@ -536,7 +532,7 @@ class U_COMMON_API Locale : public UObject {
* @param status error information if maximizing this Locale failed.
* If this Locale is not well-formed, the error code is
* U_ILLEGAL_ARGUMENT_ERROR.
- * @draft ICU 63
+ * @stable ICU 63
*/
void addLikelySubtags(UErrorCode& status);
@@ -567,24 +563,21 @@ class U_COMMON_API Locale : public UObject {
* @param status error information if maximizing this Locale failed.
* If this Locale is not well-formed, the error code is
* U_ILLEGAL_ARGUMENT_ERROR.
- * @draft ICU 63
+ * @stable ICU 63
*/
void minimizeSubtags(UErrorCode& status);
-#endif // U_HIDE_DRAFT_API
/**
* Gets the list of keywords for the specified locale.
*
* @param status the status code
- * @return pointer to StringEnumeration class, or NULL if there are no keywords.
+ * @return pointer to StringEnumeration class, or NULL if there are no keywords.
* Client must dispose of it by calling delete.
* @see getKeywords
* @stable ICU 2.8
*/
StringEnumeration * createKeywords(UErrorCode &status) const;
-#ifndef U_HIDE_DRAFT_API
-
/**
* Gets the list of Unicode keywords for the specified locale.
*
@@ -592,7 +585,7 @@ class U_COMMON_API Locale : public UObject {
* @return pointer to StringEnumeration class, or NULL if there are no keywords.
* Client must dispose of it by calling delete.
* @see getUnicodeKeywords
- * @draft ICU 63
+ * @stable ICU 63
*/
StringEnumeration * createUnicodeKeywords(UErrorCode &status) const;
@@ -605,7 +598,7 @@ class U_COMMON_API Locale : public UObject {
*
* @param iterator an STL style output iterator to write the keywords to.
* @param status error information if creating set of keywords failed.
- * @draft ICU 63
+ * @stable ICU 63
*/
template
inline void getKeywords(OutputIterator iterator, UErrorCode& status) const;
@@ -619,13 +612,11 @@ class U_COMMON_API Locale : public UObject {
*
* @param iterator an STL style output iterator to write the keywords to.
* @param status error information if creating set of keywords failed.
- * @draft ICU 63
+ * @stable ICU 63
*/
template
inline void getUnicodeKeywords(OutputIterator iterator, UErrorCode& status) const;
-#endif // U_HIDE_DRAFT_API
-
/**
* Gets the value for a keyword.
*
@@ -644,7 +635,6 @@ class U_COMMON_API Locale : public UObject {
*/
int32_t getKeywordValue(const char* keywordName, char *buffer, int32_t bufferCapacity, UErrorCode &status) const;
-#ifndef U_HIDE_DRAFT_API
/**
* Gets the value for a keyword.
*
@@ -656,7 +646,7 @@ class U_COMMON_API Locale : public UObject {
* @param keywordName name of the keyword for which we want the value.
* @param sink the sink to receive the keyword value.
* @param status error information if getting the value failed.
- * @draft ICU 63
+ * @stable ICU 63
*/
void getKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& status) const;
@@ -671,7 +661,7 @@ class U_COMMON_API Locale : public UObject {
* @param keywordName name of the keyword for which we want the value.
* @param status error information if getting the value failed.
* @return the keyword value.
- * @draft ICU 63
+ * @stable ICU 63
*/
template
inline StringClass getKeywordValue(StringPiece keywordName, UErrorCode& status) const;
@@ -687,7 +677,7 @@ class U_COMMON_API Locale : public UObject {
* @param keywordName name of the keyword for which we want the value.
* @param sink the sink to receive the keyword value.
* @param status error information if getting the value failed.
- * @draft ICU 63
+ * @stable ICU 63
*/
void getUnicodeKeywordValue(StringPiece keywordName, ByteSink& sink, UErrorCode& status) const;
@@ -702,11 +692,10 @@ class U_COMMON_API Locale : public UObject {
* @param keywordName name of the keyword for which we want the value.
* @param status error information if getting the value failed.
* @return the keyword value.
- * @draft ICU 63
+ * @stable ICU 63
*/
template
inline StringClass getUnicodeKeywordValue(StringPiece keywordName, UErrorCode& status) const;
-#endif // U_HIDE_DRAFT_API
/**
* Sets or removes the value for a keyword.
@@ -729,7 +718,6 @@ class U_COMMON_API Locale : public UObject {
*/
void setKeywordValue(const char* keywordName, const char* keywordValue, UErrorCode &status);
-#ifndef U_HIDE_DRAFT_API
/**
* Sets or removes the value for a keyword.
*
@@ -746,7 +734,7 @@ class U_COMMON_API Locale : public UObject {
* NULL, will result in the keyword being removed. No error is given if
* that keyword does not exist.
* @param status Returns any error information while performing this operation.
- * @draft ICU 63
+ * @stable ICU 63
*/
void setKeywordValue(StringPiece keywordName, StringPiece keywordValue, UErrorCode& status);
@@ -766,10 +754,9 @@ class U_COMMON_API Locale : public UObject {
* NULL, will result in the keyword being removed. No error is given if
* that keyword does not exist.
* @param status Returns any error information while performing this operation.
- * @draft ICU 63
+ * @stable ICU 63
*/
void setUnicodeKeywordValue(StringPiece keywordName, StringPiece keywordValue, UErrorCode& status);
-#endif // U_HIDE_DRAFT_API
/**
* returns the locale's three-letter language code, as specified
@@ -1008,6 +995,104 @@ class U_COMMON_API Locale : public UObject {
*/
virtual UClassID getDynamicClassID() const;
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * A Locale iterator interface similar to a Java Iterator.
+ * @draft ICU 65
+ */
+ class U_COMMON_API Iterator /* not : public UObject because this is an interface/mixin class */ {
+ public:
+ /** @draft ICU 65 */
+ virtual ~Iterator();
+
+ /**
+ * @return TRUE if next() can be called again.
+ * @draft ICU 65
+ */
+ virtual UBool hasNext() const = 0;
+
+ /**
+ * @return the next locale.
+ * @draft ICU 65
+ */
+ virtual const Locale &next() = 0;
+ };
+
+ /**
+ * A generic Locale iterator implementation over Locale input iterators.
+ * @draft ICU 65
+ */
+ template
+ class RangeIterator : public Iterator, public UMemory {
+ public:
+ /**
+ * Constructs an iterator from a begin/end range.
+ * Each of the iterator parameter values must be an
+ * input iterator whose value is convertible to const Locale &.
+ *
+ * @param begin Start of range.
+ * @param end Exclusive end of range.
+ * @draft ICU 65
+ */
+ RangeIterator(Iter begin, Iter end) : it_(begin), end_(end) {}
+
+ /**
+ * @return TRUE if next() can be called again.
+ * @draft ICU 65
+ */
+ UBool hasNext() const override { return it_ != end_; }
+
+ /**
+ * @return the next locale.
+ * @draft ICU 65
+ */
+ const Locale &next() override { return *it_++; }
+
+ private:
+ Iter it_;
+ const Iter end_;
+ };
+
+ /**
+ * A generic Locale iterator implementation over Locale input iterators.
+ * Calls the converter to convert each *begin to a const Locale &.
+ * @draft ICU 65
+ */
+ template
+ class ConvertingIterator : public Iterator, public UMemory {
+ public:
+ /**
+ * Constructs an iterator from a begin/end range.
+ * Each of the iterator parameter values must be an
+ * input iterator whose value the converter converts to const Locale &.
+ *
+ * @param begin Start of range.
+ * @param end Exclusive end of range.
+ * @param converter Converter from *begin to const Locale & or compatible.
+ * @draft ICU 65
+ */
+ ConvertingIterator(Iter begin, Iter end, Conv converter) :
+ it_(begin), end_(end), converter_(converter) {}
+
+ /**
+ * @return TRUE if next() can be called again.
+ * @draft ICU 65
+ */
+ UBool hasNext() const override { return it_ != end_; }
+
+ /**
+ * @return the next locale.
+ * @draft ICU 65
+ */
+ const Locale &next() override { return converter_(*it_++); }
+
+ private:
+ Iter it_;
+ const Iter end_;
+ Conv converter_;
+ };
+#endif // U_HIDE_DRAFT_API
+
protected: /* only protected for testing purposes. DO NOT USE. */
#ifndef U_HIDE_INTERNAL_API
/**
@@ -1074,7 +1159,6 @@ Locale::operator!=(const Locale& other) const
return !operator==(other);
}
-#ifndef U_HIDE_DRAFT_API
template inline StringClass
Locale::toLanguageTag(UErrorCode& status) const
{
@@ -1083,7 +1167,6 @@ Locale::toLanguageTag(UErrorCode& status) const
toLanguageTag(sink, status);
return result;
}
-#endif // U_HIDE_DRAFT_API
inline const char *
Locale::getCountry() const
@@ -1115,13 +1198,11 @@ Locale::getName() const
return fullName;
}
-#ifndef U_HIDE_DRAFT_API
-
template inline void
Locale::getKeywords(OutputIterator iterator, UErrorCode& status) const
{
LocalPointer keys(createKeywords(status));
- if (U_FAILURE(status)) {
+ if (U_FAILURE(status) || keys.isNull()) {
return;
}
for (;;) {
@@ -1138,7 +1219,7 @@ template inline void
Locale::getUnicodeKeywords(OutputIterator iterator, UErrorCode& status) const
{
LocalPointer keys(createUnicodeKeywords(status));
- if (U_FAILURE(status)) {
+ if (U_FAILURE(status) || keys.isNull()) {
return;
}
for (;;) {
@@ -1169,8 +1250,6 @@ Locale::getUnicodeKeywordValue(StringPiece keywordName, UErrorCode& status) cons
return result;
}
-#endif // U_HIDE_DRAFT_API
-
inline UBool
Locale::isBogus(void) const {
return fIsBogus;
@@ -1178,4 +1257,6 @@ Locale::isBogus(void) const {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/messagepattern.h b/deps/icu-small/source/common/unicode/messagepattern.h
index 9f2a86551ca417..04f00a8757d783 100644
--- a/deps/icu-small/source/common/unicode/messagepattern.h
+++ b/deps/icu-small/source/common/unicode/messagepattern.h
@@ -24,6 +24,8 @@
#include "unicode/utypes.h"
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_FORMATTING
#include "unicode/parseerr.h"
@@ -942,4 +944,6 @@ U_NAMESPACE_END
#endif // !UCONFIG_NO_FORMATTING
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __MESSAGEPATTERN_H__
diff --git a/deps/icu-small/source/common/unicode/normalizer2.h b/deps/icu-small/source/common/unicode/normalizer2.h
index 4caa0e31034b2d..4aeb3bb3d82921 100644
--- a/deps/icu-small/source/common/unicode/normalizer2.h
+++ b/deps/icu-small/source/common/unicode/normalizer2.h
@@ -26,6 +26,8 @@
#include "unicode/utypes.h"
+#if U_SHOW_CPLUSPLUS_API
+
#if !UCONFIG_NO_NORMALIZATION
#include "unicode/stringpiece.h"
@@ -771,4 +773,7 @@ class U_COMMON_API FilteredNormalizer2 : public Normalizer2 {
U_NAMESPACE_END
#endif // !UCONFIG_NO_NORMALIZATION
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __NORMALIZER2_H__
diff --git a/deps/icu-small/source/common/unicode/normlzr.h b/deps/icu-small/source/common/unicode/normlzr.h
index 82335ae6d7d19b..07a596bd11b918 100644
--- a/deps/icu-small/source/common/unicode/normlzr.h
+++ b/deps/icu-small/source/common/unicode/normlzr.h
@@ -13,11 +13,13 @@
#include "unicode/utypes.h"
+#if U_SHOW_CPLUSPLUS_API
+
/**
- * \file
+ * \file
* \brief C++ API: Unicode Normalization
*/
-
+
#if !UCONFIG_NO_NORMALIZATION
#include "unicode/chariter.h"
@@ -183,6 +185,7 @@ class U_COMMON_API Normalizer : public UObject {
Normalizer(const CharacterIterator& iter, UNormalizationMode mode);
#endif /* U_HIDE_DEPRECATED_API */
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Copy constructor.
* @param copy The object to be copied.
@@ -195,7 +198,7 @@ class U_COMMON_API Normalizer : public UObject {
* @deprecated ICU 56 Use Normalizer2 instead.
*/
virtual ~Normalizer();
-
+#endif // U_FORCE_HIDE_DEPRECATED_API
//-------------------------------------------------------------------------
// Static utility methods
@@ -599,7 +602,7 @@ class U_COMMON_API Normalizer : public UObject {
* @return a pointer to a new Normalizer
* @deprecated ICU 56 Use Normalizer2 instead.
*/
- Normalizer* clone(void) const;
+ Normalizer* clone() const;
/**
* Generates a hash code for this iterator.
@@ -723,12 +726,14 @@ class U_COMMON_API Normalizer : public UObject {
static UClassID U_EXPORT2 getStaticClassID();
#endif /* U_HIDE_DEPRECATED_API */
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* ICU "poor man's RTTI", returns a UClassID for the actual class.
* @return a UClassID for the actual class.
* @deprecated ICU 56 Use Normalizer2 instead.
*/
virtual UClassID getDynamicClassID() const;
+#endif // U_FORCE_HIDE_DEPRECATED_API
private:
//-------------------------------------------------------------------------
@@ -807,3 +812,5 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_NORMALIZATION */
#endif // NORMLZR_H
+
+#endif /* U_SHOW_CPLUSPLUS_API */
diff --git a/deps/icu-small/source/common/unicode/parseerr.h b/deps/icu-small/source/common/unicode/parseerr.h
index c05487601cb0d1..c23cc273b828eb 100644
--- a/deps/icu-small/source/common/unicode/parseerr.h
+++ b/deps/icu-small/source/common/unicode/parseerr.h
@@ -23,7 +23,7 @@
/**
* The capacity of the context strings in UParseError.
* @stable ICU 2.0
- */
+ */
enum { U_PARSE_CONTEXT_LEN = 16 };
/**
@@ -52,7 +52,7 @@ enum { U_PARSE_CONTEXT_LEN = 16 };
* Examples of engines which use UParseError (or may use it in the
* future) are Transliterator, RuleBasedBreakIterator, and
* RegexPattern.
- *
+ *
* @stable ICU 2.0
*/
typedef struct UParseError {
@@ -78,14 +78,14 @@ typedef struct UParseError {
/**
* Textual context before the error. Null-terminated. The empty
* string if not supported by parser.
- * @stable ICU 2.0
+ * @stable ICU 2.0
*/
UChar preContext[U_PARSE_CONTEXT_LEN];
/**
* The error itself and/or textual context after the error.
* Null-terminated. The empty string if not supported by parser.
- * @stable ICU 2.0
+ * @stable ICU 2.0
*/
UChar postContext[U_PARSE_CONTEXT_LEN];
diff --git a/deps/icu-small/source/common/unicode/parsepos.h b/deps/icu-small/source/common/unicode/parsepos.h
index c02c8169565738..909d288d48d0fe 100644
--- a/deps/icu-small/source/common/unicode/parsepos.h
+++ b/deps/icu-small/source/common/unicode/parsepos.h
@@ -19,16 +19,19 @@
#define PARSEPOS_H
#include "unicode/utypes.h"
-#include "unicode/uobject.h"
+#if U_SHOW_CPLUSPLUS_API
+
+#include "unicode/uobject.h"
+
U_NAMESPACE_BEGIN
/**
* \file
* \brief C++ API: Canonical Iterator
*/
-/**
+/**
* ParsePosition
is a simple class used by Format
* and its subclasses to keep track of the current position during parsing.
* The parseObject
method in the various Format
@@ -229,4 +232,6 @@ ParsePosition::setErrorIndex(int32_t ei)
}
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/platform.h b/deps/icu-small/source/common/unicode/platform.h
index ee0d8b7a000303..ad75b298a42c52 100644
--- a/deps/icu-small/source/common/unicode/platform.h
+++ b/deps/icu-small/source/common/unicode/platform.h
@@ -135,6 +135,14 @@
/** Fuchsia is a POSIX-ish platform. @internal */
#define U_PF_FUCHSIA 4100
/* Maximum value for Linux-based platform is 4499 */
+/**
+ * Emscripten is a C++ transpiler for the Web that can target asm.js or
+ * WebAssembly. It provides some POSIX-compatible wrappers and stubs and
+ * some Linux-like functionality, but is not fully compatible with
+ * either.
+ * @internal
+ */
+#define U_PF_EMSCRIPTEN 5010
/** z/OS is the successor to OS/390 which was the successor to MVS. @internal */
#define U_PF_OS390 9000
/** "IBM i" is the current name of what used to be i5/OS and earlier OS/400. @internal */
@@ -192,6 +200,8 @@
# define U_PLATFORM U_PF_OS390
#elif defined(__OS400__) || defined(__TOS_OS400__)
# define U_PLATFORM U_PF_OS400
+#elif defined(__EMSCRIPTEN__)
+# define U_PLATFORM U_PF_EMSCRIPTEN
#else
# define U_PLATFORM U_PF_UNKNOWN
#endif
@@ -400,7 +410,7 @@
#endif
/**
- * \def U_HAVE_DEBUG_LOCATION_NEW
+ * \def U_HAVE_DEBUG_LOCATION_NEW
* Define this to define the MFC debug version of the operator new.
*
* @stable ICU 3.4
@@ -414,26 +424,40 @@
#endif
/* Compatibility with compilers other than clang: http://clang.llvm.org/docs/LanguageExtensions.html */
-#ifndef __has_attribute
-# define __has_attribute(x) 0
+#ifdef __has_attribute
+# define UPRV_HAS_ATTRIBUTE(x) __has_attribute(x)
+#else
+# define UPRV_HAS_ATTRIBUTE(x) 0
#endif
-#ifndef __has_cpp_attribute
-# define __has_cpp_attribute(x) 0
+#ifdef __has_cpp_attribute
+# define UPRV_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
+#else
+# define UPRV_HAS_CPP_ATTRIBUTE(x) 0
#endif
-#ifndef __has_declspec_attribute
-# define __has_declspec_attribute(x) 0
+#ifdef __has_declspec_attribute
+# define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) __has_declspec_attribute(x)
+#else
+# define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) 0
#endif
-#ifndef __has_builtin
-# define __has_builtin(x) 0
+#ifdef __has_builtin
+# define UPRV_HAS_BUILTIN(x) __has_builtin(x)
+#else
+# define UPRV_HAS_BUILTIN(x) 0
#endif
-#ifndef __has_feature
-# define __has_feature(x) 0
+#ifdef __has_feature
+# define UPRV_HAS_FEATURE(x) __has_feature(x)
+#else
+# define UPRV_HAS_FEATURE(x) 0
#endif
-#ifndef __has_extension
-# define __has_extension(x) 0
+#ifdef __has_extension
+# define UPRV_HAS_EXTENSION(x) __has_extension(x)
+#else
+# define UPRV_HAS_EXTENSION(x) 0
#endif
-#ifndef __has_warning
-# define __has_warning(x) 0
+#ifdef __has_warning
+# define UPRV_HAS_WARNING(x) __has_warning(x)
+#else
+# define UPRV_HAS_WARNING(x) 0
#endif
/**
@@ -452,7 +476,9 @@
* Attribute to specify the size of the allocated buffer for malloc-like functions
* @internal
*/
-#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || __has_attribute(alloc_size)
+#if (defined(__GNUC__) && \
+ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || \
+ UPRV_HAS_ATTRIBUTE(alloc_size)
# define U_ALLOC_SIZE_ATTR(X) __attribute__ ((alloc_size(X)))
# define U_ALLOC_SIZE_ATTR2(X,Y) __attribute__ ((alloc_size(X,Y)))
#else
@@ -516,8 +542,9 @@ namespace std {
#elif defined(__clang__)
// Test for compiler vs. feature separately.
// Other compilers might choke on the feature test.
-# if __has_cpp_attribute(clang::fallthrough) || \
- (__has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough"))
+# if UPRV_HAS_CPP_ATTRIBUTE(clang::fallthrough) || \
+ (UPRV_HAS_FEATURE(cxx_attributes) && \
+ UPRV_HAS_WARNING("-Wimplicit-fallthrough"))
# define U_FALLTHROUGH [[clang::fallthrough]]
# endif
#elif defined(__GNUC__) && (__GNUC__ >= 7)
@@ -620,7 +647,8 @@ namespace std {
*/
#ifdef U_CHARSET_IS_UTF8
/* Use the predefined value. */
-#elif U_PLATFORM_IS_LINUX_BASED || U_PLATFORM_IS_DARWIN_BASED
+#elif U_PLATFORM_IS_LINUX_BASED || U_PLATFORM_IS_DARWIN_BASED || \
+ U_PLATFORM == U_PF_EMSCRIPTEN
# define U_CHARSET_IS_UTF8 1
#else
# define U_CHARSET_IS_UTF8 0
@@ -707,7 +735,7 @@ namespace std {
* narrow-character strings are in EBCDIC.
*/
# define U_SIZEOF_WCHAR_T 2
-#else
+# else
/*
* LOCALETYPE(*CLD) or LOCALETYPE(*LOCALE) is specified.
* Wide-character strings are in 16-bit EBCDIC,
@@ -786,12 +814,13 @@ namespace std {
/* Use the predefined value. */
#elif defined(U_STATIC_IMPLEMENTATION)
# define U_EXPORT
-#elif defined(_MSC_VER) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport))
+#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(dllexport) && \
+ UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport))
# define U_EXPORT __declspec(dllexport)
#elif defined(__GNUC__)
# define U_EXPORT __attribute__((visibility("default")))
#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \
- || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550)
+ || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550)
# define U_EXPORT __global
/*#elif defined(__HP_aCC) || defined(__HP_cc)
# define U_EXPORT __declspec(dllexport)*/
@@ -810,11 +839,12 @@ namespace std {
#ifdef U_IMPORT
/* Use the predefined value. */
-#elif defined(_MSC_VER) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport))
+#elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(dllexport) && \
+ UPRV_HAS_DECLSPEC_ATTRIBUTE(dllimport))
/* Windows needs to export/import data. */
# define U_IMPORT __declspec(dllimport)
#else
-# define U_IMPORT
+# define U_IMPORT
#endif
/**
@@ -852,4 +882,4 @@ namespace std {
#endif
/* @} */
-#endif
+#endif // _PLATFORM_H
diff --git a/deps/icu-small/source/common/unicode/putil.h b/deps/icu-small/source/common/unicode/putil.h
index 14bb99ccc545b2..759b136c13e4ac 100644
--- a/deps/icu-small/source/common/unicode/putil.h
+++ b/deps/icu-small/source/common/unicode/putil.h
@@ -43,7 +43,7 @@
*/
/**
- * Return the ICU data directory.
+ * Return the ICU data directory.
* The data directory is where common format ICU data files (.dat files)
* are loaded from. Note that normal use of the built-in ICU
* facilities does not require loading of an external data file;
@@ -56,21 +56,21 @@
* If a data directory was specified at ICU build time
*
* \code
- * #define ICU_DATA_DIR "path"
+ * #define ICU_DATA_DIR "path"
* \endcode
*
use that,
* otherwise no data directory is available.
*
* @return the data directory, or an empty string ("") if no data directory has
* been specified.
- *
+ *
* @stable ICU 2.0
*/
U_STABLE const char* U_EXPORT2 u_getDataDirectory(void);
-/**
- * Set the ICU data directory.
+/**
+ * Set the ICU data directory.
* The data directory is where common format ICU data files (.dat files)
* are loaded from. Note that normal use of the built-in ICU
* facilities does not require loading of an external data file;
@@ -98,7 +98,7 @@ U_STABLE void U_EXPORT2 u_setDataDirectory(const char *directory);
*
* @return the time zone data override directory.
* @internal
- */
+ */
U_INTERNAL const char * U_EXPORT2 u_getTimeZoneFilesDirectory(UErrorCode *status);
/**
diff --git a/deps/icu-small/source/common/unicode/rbbi.h b/deps/icu-small/source/common/unicode/rbbi.h
index 365ae2d3d2ac75..7825f603a51c1b 100644
--- a/deps/icu-small/source/common/unicode/rbbi.h
+++ b/deps/icu-small/source/common/unicode/rbbi.h
@@ -18,6 +18,8 @@
#include "unicode/utypes.h"
+#if U_SHOW_CPLUSPLUS_API
+
/**
* \file
* \brief C++ API: Rule Based Break Iterator
@@ -272,7 +274,7 @@ class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator {
* @return a newly-constructed RuleBasedBreakIterator
* @stable ICU 2.0
*/
- virtual BreakIterator* clone() const;
+ virtual RuleBasedBreakIterator* clone() const;
/**
* Compute a hash code for this BreakIterator
@@ -536,6 +538,7 @@ class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator {
*/
static UClassID U_EXPORT2 getStaticClassID(void);
+#ifndef U_FORCE_HIDE_DEPRECATED_API
/**
* Deprecated functionality. Use clone() instead.
*
@@ -562,10 +565,10 @@ class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator {
* or if the stackBuffer was too small to hold the clone.
* @deprecated ICU 52. Use clone() instead.
*/
- virtual BreakIterator * createBufferClone(void *stackBuffer,
- int32_t &BufferSize,
- UErrorCode &status);
-
+ virtual RuleBasedBreakIterator *createBufferClone(void *stackBuffer,
+ int32_t &BufferSize,
+ UErrorCode &status);
+#endif // U_FORCE_HIDE_DEPRECATED_API
/**
* Return the binary form of compiled break rules,
@@ -696,4 +699,6 @@ U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/rep.h b/deps/icu-small/source/common/unicode/rep.h
index b1023a37a2daf1..6dd4530647e628 100644
--- a/deps/icu-small/source/common/unicode/rep.h
+++ b/deps/icu-small/source/common/unicode/rep.h
@@ -16,13 +16,17 @@
#ifndef REP_H
#define REP_H
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
/**
- * \file
+ * \file
* \brief C++ API: Replaceable String
*/
-
+
U_NAMESPACE_BEGIN
class UnicodeString;
@@ -83,7 +87,7 @@ class U_COMMON_API Replaceable : public UObject {
* Returns the number of 16-bit code units in the text.
* @return number of 16-bit code units in text
* @stable ICU 1.8
- */
+ */
inline int32_t length() const;
/**
@@ -110,7 +114,7 @@ class U_COMMON_API Replaceable : public UObject {
inline UChar32 char32At(int32_t offset) const;
/**
- * Copies characters in the range [start, limit)
+ * Copies characters in the range [start, limit)
* into the UnicodeString target.
* @param start offset of first character which will be copied
* @param limit offset immediately following the last character to
@@ -140,7 +144,7 @@ class U_COMMON_API Replaceable : public UObject {
* @param limit the ending index, exclusive; start <= limit
* <= length()
.
* @param text the text to replace characters start
- * to limit - 1
+ * to limit - 1
* @stable ICU 2.0
*/
virtual void handleReplaceBetween(int32_t start,
@@ -160,7 +164,7 @@ class U_COMMON_API Replaceable : public UObject {
* Copies a substring of this object, retaining metadata.
* This method is used to duplicate or reorder substrings.
* The destination index must not overlap the source range.
- *
+ *
* @param start the beginning index, inclusive; 0 <= start <=
* limit
.
* @param limit the ending index, exclusive; start <= limit <=
@@ -189,9 +193,6 @@ class U_COMMON_API Replaceable : public UObject {
* Clones can be used concurrently in multiple threads.
* If a subclass does not implement clone(), or if an error occurs,
* then NULL is returned.
- * The clone functions in all subclasses return a pointer to a Replaceable
- * because some compilers do not support covariant (same-as-this)
- * return types; cast to the appropriate subclass if necessary.
* The caller must delete the clone.
*
* @return a clone of this object
@@ -223,7 +224,7 @@ class U_COMMON_API Replaceable : public UObject {
/**
* Virtual version of length().
* @stable ICU 2.4
- */
+ */
virtual int32_t getLength() const = 0;
/**
@@ -260,4 +261,6 @@ Replaceable::char32At(int32_t offset) const {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/resbund.h b/deps/icu-small/source/common/unicode/resbund.h
index ab0b60bbb28fcc..2894067528724f 100644
--- a/deps/icu-small/source/common/unicode/resbund.h
+++ b/deps/icu-small/source/common/unicode/resbund.h
@@ -49,16 +49,19 @@
#define RESBUND_H
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
#include "unicode/ures.h"
#include "unicode/unistr.h"
#include "unicode/locid.h"
/**
- * \file
+ * \file
* \brief C++ API: Resource Bundle
*/
-
+
U_NAMESPACE_BEGIN
/**
@@ -82,8 +85,8 @@ class U_COMMON_API ResourceBundle : public UObject {
/**
* Constructor
*
- * @param packageName The packageName and locale together point to an ICU udata object,
- * as defined by udata_open( packageName, "res", locale, err)
+ * @param packageName The packageName and locale together point to an ICU udata object,
+ * as defined by udata_open( packageName, "res", locale, err)
* or equivalent. Typically, packageName will refer to a (.dat) file, or to
* a package registered with udata_setAppData(). Using a full file or directory
* pathname for packageName is deprecated.
@@ -112,8 +115,8 @@ class U_COMMON_API ResourceBundle : public UObject {
/**
* Construct a resource bundle for the default bundle in the specified package.
*
- * @param packageName The packageName and locale together point to an ICU udata object,
- * as defined by udata_open( packageName, "res", locale, err)
+ * @param packageName The packageName and locale together point to an ICU udata object,
+ * as defined by udata_open( packageName, "res", locale, err)
* or equivalent. Typically, packageName will refer to a (.dat) file, or to
* a package registered with udata_setAppData(). Using a full file or directory
* pathname for packageName is deprecated.
@@ -135,8 +138,8 @@ class U_COMMON_API ResourceBundle : public UObject {
* Standard constructor, constructs a resource bundle for the locale-specific
* bundle in the specified package.
*
- * @param packageName The packageName and locale together point to an ICU udata object,
- * as defined by udata_open( packageName, "res", locale, err)
+ * @param packageName The packageName and locale together point to an ICU udata object,
+ * as defined by udata_open( packageName, "res", locale, err)
* or equivalent. Typically, packageName will refer to a (.dat) file, or to
* a package registered with udata_setAppData(). Using a full file or directory
* pathname for packageName is deprecated.
@@ -489,4 +492,7 @@ class U_COMMON_API ResourceBundle : public UObject {
};
U_NAMESPACE_END
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/schriter.h b/deps/icu-small/source/common/unicode/schriter.h
index 1a12769e8df106..1ca5b70fca5828 100644
--- a/deps/icu-small/source/common/unicode/schriter.h
+++ b/deps/icu-small/source/common/unicode/schriter.h
@@ -21,14 +21,17 @@
#define SCHRITER_H
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/chariter.h"
#include "unicode/uchriter.h"
/**
- * \file
+ * \file
* \brief C++ API: String Character Iterator
*/
-
+
U_NAMESPACE_BEGIN
/**
* A concrete subclass of CharacterIterator that iterates over the
@@ -130,7 +133,7 @@ class U_COMMON_API StringCharacterIterator : public UCharCharacterIterator {
* @return the newly cloned object.
* @stable ICU 2.0
*/
- virtual CharacterIterator* clone(void) const;
+ virtual StringCharacterIterator* clone() const;
/**
* Sets the iterator to iterate over the provided string.
@@ -186,4 +189,7 @@ class U_COMMON_API StringCharacterIterator : public UCharCharacterIterator {
};
U_NAMESPACE_END
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/simpleformatter.h b/deps/icu-small/source/common/unicode/simpleformatter.h
index 3f7d93dc094a18..9414bca3085ad4 100644
--- a/deps/icu-small/source/common/unicode/simpleformatter.h
+++ b/deps/icu-small/source/common/unicode/simpleformatter.h
@@ -17,6 +17,9 @@
*/
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/unistr.h"
U_NAMESPACE_BEGIN
@@ -333,4 +336,6 @@ class U_COMMON_API SimpleFormatter U_FINAL : public UMemory {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __SIMPLEFORMATTER_H__
diff --git a/deps/icu-small/source/common/unicode/std_string.h b/deps/icu-small/source/common/unicode/std_string.h
index 729c56399506eb..bf87230167ecf2 100644
--- a/deps/icu-small/source/common/unicode/std_string.h
+++ b/deps/icu-small/source/common/unicode/std_string.h
@@ -27,6 +27,8 @@
#include "unicode/utypes.h"
+#if U_SHOW_CPLUSPLUS_API
+
// Workaround for a libstdc++ bug before libstdc++4.6 (2011).
// https://bugs.llvm.org/show_bug.cgi?id=13364
#if defined(__GLIBCXX__)
@@ -34,4 +36,6 @@ namespace std { class type_info; }
#endif
#include
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __STD_STRING_H__
diff --git a/deps/icu-small/source/common/unicode/strenum.h b/deps/icu-small/source/common/unicode/strenum.h
index fa525d4f5227da..8601f1f7c401f7 100644
--- a/deps/icu-small/source/common/unicode/strenum.h
+++ b/deps/icu-small/source/common/unicode/strenum.h
@@ -12,14 +12,18 @@
#ifndef STRENUM_H
#define STRENUM_H
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
#include "unicode/unistr.h"
/**
- * \file
+ * \file
* \brief C++ API: String Enumeration
*/
-
+
U_NAMESPACE_BEGIN
/**
@@ -52,9 +56,9 @@ U_NAMESPACE_BEGIN
* ICU 2.8 adds some default implementations and helper functions
* for subclasses.
*
- * @stable ICU 2.4
+ * @stable ICU 2.4
*/
-class U_COMMON_API StringEnumeration : public UObject {
+class U_COMMON_API StringEnumeration : public UObject {
public:
/**
* Destructor.
@@ -67,9 +71,6 @@ class U_COMMON_API StringEnumeration : public UObject {
* Clones can be used concurrently in multiple threads.
* If a subclass does not implement clone(), or if an error occurs,
* then NULL is returned.
- * The clone functions in all subclasses return a base class pointer
- * because some compilers do not support covariant (same-as-this)
- * return types; cast to the appropriate subclass if necessary.
* The caller must delete the clone.
*
* @return a clone of this object
@@ -126,7 +127,7 @@ class U_COMMON_API StringEnumeration : public UObject {
* @param resultLength a pointer to receive the length, can be NULL.
* @return a pointer to the string, or NULL.
*
- * @stable ICU 2.4
+ * @stable ICU 2.4
*/
virtual const char* next(int32_t *resultLength, UErrorCode& status);
@@ -151,7 +152,7 @@ class U_COMMON_API StringEnumeration : public UObject {
* @param resultLength a ponter to receive the length, can be NULL.
* @return a pointer to the string, or NULL.
*
- * @stable ICU 2.4
+ * @stable ICU 2.4
*/
virtual const char16_t* unext(int32_t *resultLength, UErrorCode& status);
@@ -173,7 +174,7 @@ class U_COMMON_API StringEnumeration : public UObject {
* @param status the error code.
* @return a pointer to the string, or NULL.
*
- * @stable ICU 2.4
+ * @stable ICU 2.4
*/
virtual const UnicodeString* snext(UErrorCode& status);
@@ -187,7 +188,7 @@ class U_COMMON_API StringEnumeration : public UObject {
*
* @param status the error code.
*
- * @stable ICU 2.4
+ * @stable ICU 2.4
*/
virtual void reset(UErrorCode& status) = 0;
@@ -196,7 +197,7 @@ class U_COMMON_API StringEnumeration : public UObject {
*
* @param that The other string enumeration to compare this object to
* @return TRUE if the enumerations are equal. FALSE if not.
- * @stable ICU 3.6
+ * @stable ICU 3.6
*/
virtual UBool operator==(const StringEnumeration& that)const;
/**
@@ -204,7 +205,7 @@ class U_COMMON_API StringEnumeration : public UObject {
*
* @param that The other string enumeration to compare this object to
* @return TRUE if the enumerations are equal. FALSE if not.
- * @stable ICU 3.6
+ * @stable ICU 3.6
*/
virtual UBool operator!=(const StringEnumeration& that)const;
@@ -274,5 +275,7 @@ class U_COMMON_API StringEnumeration : public UObject {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
/* STRENUM_H */
#endif
diff --git a/deps/icu-small/source/common/unicode/stringpiece.h b/deps/icu-small/source/common/unicode/stringpiece.h
index 640fbac5a827d0..f581091f872070 100644
--- a/deps/icu-small/source/common/unicode/stringpiece.h
+++ b/deps/icu-small/source/common/unicode/stringpiece.h
@@ -23,11 +23,17 @@
#define __STRINGPIECE_H__
/**
- * \file
+ * \file
* \brief C++ API: StringPiece: Read-only byte string wrapper class.
*/
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#include
+#include
+
#include "unicode/uobject.h"
#include "unicode/std_string.h"
@@ -74,6 +80,33 @@ class U_COMMON_API StringPiece : public UMemory {
*/
StringPiece(const std::string& str)
: ptr_(str.data()), length_(static_cast(str.size())) { }
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Constructs from some other implementation of a string piece class, from any
+ * C++ record type that has these two methods:
+ *
+ * \code{.cpp}
+ *
+ * struct OtherStringPieceClass {
+ * const char* data();
+ * size_t size();
+ * };
+ *
+ * \endcode
+ *
+ * The other string piece class will typically be std::string_view from C++17
+ * or absl::string_view from Abseil.
+ *
+ * @param str the other string piece
+ * @draft ICU 65
+ */
+ template ::value &&
+ std::is_same::value>::type>
+ StringPiece(T str)
+ : ptr_(str.data()), length_(static_cast(str.size())) {}
+#endif // U_HIDE_DRAFT_API
/**
* Constructs from a const char * pointer and a specified length.
* @param offset a const char * pointer (need not be terminated)
@@ -144,7 +177,7 @@ class U_COMMON_API StringPiece : public UMemory {
/**
* Reset the stringpiece to refer to new data.
- * @param str a pointer to a NUL-terminated string.
+ * @param str a pointer to a NUL-terminated string.
* @stable ICU 4.8
*/
void set(const char* str);
@@ -205,7 +238,7 @@ class U_COMMON_API StringPiece : public UMemory {
* @return TRUE if the string data is equal
* @stable ICU 4.8
*/
-U_EXPORT UBool U_EXPORT2
+U_EXPORT UBool U_EXPORT2
operator==(const StringPiece& x, const StringPiece& y);
/**
@@ -221,4 +254,6 @@ inline UBool operator!=(const StringPiece& x, const StringPiece& y) {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __STRINGPIECE_H__
diff --git a/deps/icu-small/source/common/unicode/stringtriebuilder.h b/deps/icu-small/source/common/unicode/stringtriebuilder.h
index c27fbd67960d70..2c47dd415b1884 100644
--- a/deps/icu-small/source/common/unicode/stringtriebuilder.h
+++ b/deps/icu-small/source/common/unicode/stringtriebuilder.h
@@ -18,6 +18,9 @@
#define __STRINGTRIEBUILDER_H__
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
/**
@@ -272,7 +275,7 @@ class U_COMMON_API StringTrieBuilder : public UObject {
// Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API,
// it is needed for layout of other objects.
/**
- * @internal
+ * @internal
*/
class ValueNode : public Node {
public:
@@ -289,8 +292,8 @@ class U_COMMON_API StringTrieBuilder : public UObject {
};
#ifndef U_HIDE_INTERNAL_API
- /**
- * @internal
+ /**
+ * @internal
*/
class IntermediateValueNode : public ValueNode {
public:
@@ -307,7 +310,7 @@ class U_COMMON_API StringTrieBuilder : public UObject {
// Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API,
// it is needed for layout of other objects.
/**
- * @internal
+ * @internal
*/
class LinearMatchNode : public ValueNode {
public:
@@ -323,7 +326,7 @@ class U_COMMON_API StringTrieBuilder : public UObject {
#ifndef U_HIDE_INTERNAL_API
/**
- * @internal
+ * @internal
*/
class BranchNode : public Node {
public:
@@ -333,7 +336,7 @@ class U_COMMON_API StringTrieBuilder : public UObject {
};
/**
- * @internal
+ * @internal
*/
class ListBranchNode : public BranchNode {
public:
@@ -365,7 +368,7 @@ class U_COMMON_API StringTrieBuilder : public UObject {
};
/**
- * @internal
+ * @internal
*/
class SplitBranchNode : public BranchNode {
public:
@@ -418,4 +421,6 @@ class U_COMMON_API StringTrieBuilder : public UObject {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __STRINGTRIEBUILDER_H__
diff --git a/deps/icu-small/source/common/unicode/symtable.h b/deps/icu-small/source/common/unicode/symtable.h
index c2dc95a61bc020..b64d877f97430f 100644
--- a/deps/icu-small/source/common/unicode/symtable.h
+++ b/deps/icu-small/source/common/unicode/symtable.h
@@ -13,14 +13,17 @@
#define SYMTABLE_H
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
/**
- * \file
+ * \file
* \brief C++ API: An interface that defines both lookup protocol and parsing of
* symbolic names.
*/
-
+
U_NAMESPACE_BEGIN
class ParsePosition;
@@ -111,4 +114,6 @@ class U_COMMON_API SymbolTable /* not : public UObject because this is an interf
};
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/ucat.h b/deps/icu-small/source/common/unicode/ucat.h
index f9c18b47d6c9b8..4d1ff3f6b28d1e 100644
--- a/deps/icu-small/source/common/unicode/ucat.h
+++ b/deps/icu-small/source/common/unicode/ucat.h
@@ -50,7 +50,7 @@
* 1%5 { "Good afternoon." }
* 1%7 { "Good evening." }
* 1%8 { "Good night." }
- *
+ *
* 4%14 { "Please " }
* 4%19 { "Thank you." }
* 4%20 { "Sincerely," }
@@ -67,7 +67,7 @@ U_CDECL_BEGIN
/**
* An ICU message catalog descriptor, analogous to nl_catd.
- *
+ *
* @stable ICU 2.6
*/
typedef UResourceBundle* u_nl_catd;
@@ -100,7 +100,7 @@ typedef UResourceBundle* u_nl_catd;
* is responsible for calling u_catclose() to close the message
* catalog. If the ec parameter indicates failure, then NULL will be
* returned.
- *
+ *
* @stable ICU 2.6
*/
U_STABLE u_nl_catd U_EXPORT2
@@ -111,7 +111,7 @@ u_catopen(const char* name, const char* locale, UErrorCode* ec);
*
* @param catd a message catalog descriptor to be closed. May be NULL,
* in which case no action is taken.
- *
+ *
* @stable ICU 2.6
*/
U_STABLE void U_EXPORT2
@@ -146,7 +146,7 @@ u_catclose(u_nl_catd catd);
* for any reason, then s is returned. This includes the situation in
* which ec indicates a failing error code upon entry to this
* function.
- *
+ *
* @stable ICU 2.6
*/
U_STABLE const UChar* U_EXPORT2
diff --git a/deps/icu-small/source/common/unicode/uchar.h b/deps/icu-small/source/common/unicode/uchar.h
index d70c964e38e5b8..1b7ee099be7ca2 100644
--- a/deps/icu-small/source/common/unicode/uchar.h
+++ b/deps/icu-small/source/common/unicode/uchar.h
@@ -2578,8 +2578,6 @@ typedef enum UVerticalOrientation {
U_STABLE UBool U_EXPORT2
u_hasBinaryProperty(UChar32 c, UProperty which);
-#ifndef U_HIDE_DRAFT_API
-
/**
* Returns a frozen USet for a binary property.
* The library retains ownership over the returned object.
@@ -2593,13 +2591,11 @@ u_hasBinaryProperty(UChar32 c, UProperty which);
* @see UProperty
* @see u_hasBinaryProperty
* @see Unicode::fromUSet
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI const USet * U_EXPORT2
u_getBinaryPropertySet(UProperty property, UErrorCode *pErrorCode);
-#endif // U_HIDE_DRAFT_API
-
/**
* Check if a code point has the Alphabetic Unicode property.
* Same as u_hasBinaryProperty(c, UCHAR_ALPHABETIC).
@@ -2757,8 +2753,6 @@ u_getIntPropertyMinValue(UProperty which);
U_STABLE int32_t U_EXPORT2
u_getIntPropertyMaxValue(UProperty which);
-#ifndef U_HIDE_DRAFT_API
-
/**
* Returns an immutable UCPMap for an enumerated/catalog/int-valued property.
* The library retains ownership over the returned object.
@@ -2772,13 +2766,11 @@ u_getIntPropertyMaxValue(UProperty which);
* @return the property as a map
* @see UProperty
* @see u_getIntPropertyValue
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI const UCPMap * U_EXPORT2
u_getIntPropertyMap(UProperty property, UErrorCode *pErrorCode);
-#endif // U_HIDE_DRAFT_API
-
/**
* Get the numeric value for a Unicode code point as defined in the
* Unicode Character Database.
@@ -3197,15 +3189,14 @@ U_STABLE UBool U_EXPORT2
u_isprint(UChar32 c);
/**
- * Determines whether the specified code point is a base character.
+ * Non-standard: Determines whether the specified code point is a base character.
* True for general categories "L" (letters), "N" (numbers),
* "Mc" (spacing combining marks), and "Me" (enclosing marks).
*
- * Note that this is different from the Unicode definition in
- * chapter 3.5, conformance clause D13,
- * which defines base characters to be all characters (not Cn)
- * that do not graphically combine with preceding characters (M)
- * and that are neither control (Cc) or format (Cf) characters.
+ * Note that this is different from the Unicode Standard definition in
+ * chapter 3.6, conformance clause D51 “Base character”,
+ * which defines base characters as the code points with general categories
+ * Letter (L), Number (N), Punctuation (P), Symbol (S), or Space Separator (Zs).
*
* @param c the code point to be tested
* @return TRUE if the code point is a base character according to this function
diff --git a/deps/icu-small/source/common/unicode/ucharstrie.h b/deps/icu-small/source/common/unicode/ucharstrie.h
index dfc93f6d0bae8a..d5729d944ee3a2 100644
--- a/deps/icu-small/source/common/unicode/ucharstrie.h
+++ b/deps/icu-small/source/common/unicode/ucharstrie.h
@@ -24,6 +24,9 @@
*/
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/unistr.h"
#include "unicode/uobject.h"
#include "unicode/ustringtrie.h"
@@ -94,6 +97,41 @@ class U_COMMON_API UCharsTrie : public UMemory {
return *this;
}
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Returns the state of this trie as a 64-bit integer.
+ * The state value is never 0.
+ *
+ * @return opaque state value
+ * @see resetToState64
+ * @draft ICU 65
+ */
+ uint64_t getState64() const {
+ return (static_cast(remainingMatchLength_ + 2) << kState64RemainingShift) |
+ (uint64_t)(pos_ - uchars_);
+ }
+
+ /**
+ * Resets this trie to the saved state.
+ * Unlike resetToState(State), the 64-bit state value
+ * must be from getState64() from the same trie object or
+ * from one initialized the exact same way.
+ * Because of no validation, this method is faster.
+ *
+ * @param state The opaque trie state value from getState64().
+ * @return *this
+ * @see getState64
+ * @see resetToState
+ * @see reset
+ * @draft ICU 65
+ */
+ UCharsTrie &resetToState64(uint64_t state) {
+ remainingMatchLength_ = static_cast(state >> kState64RemainingShift) - 2;
+ pos_ = uchars_ + (state & kState64PosMask);
+ return *this;
+ }
+#endif /* U_HIDE_DRAFT_API */
+
/**
* UCharsTrie state object, for saving a trie's current state
* and resetting the trie back to this state later.
@@ -560,6 +598,13 @@ class U_COMMON_API UCharsTrie : public UMemory {
static const int32_t kMaxTwoUnitDelta=((kThreeUnitDeltaLead-kMinTwoUnitDeltaLead)<<16)-1; // 0x03feffff
+ // For getState64():
+ // The remainingMatchLength_ is -1..14=(kMaxLinearMatchLength=0x10)-2
+ // so we need at least 5 bits for that.
+ // We add 2 to store it as a positive value 1..16=kMaxLinearMatchLength.
+ static constexpr int32_t kState64RemainingShift = 59;
+ static constexpr uint64_t kState64PosMask = (UINT64_C(1) << kState64RemainingShift) - 1;
+
char16_t *ownedArray_;
// Fixed value referencing the UCharsTrie words.
@@ -575,4 +620,6 @@ class U_COMMON_API UCharsTrie : public UMemory {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __UCHARSTRIE_H__
diff --git a/deps/icu-small/source/common/unicode/ucharstriebuilder.h b/deps/icu-small/source/common/unicode/ucharstriebuilder.h
index 2aa4757e52cb07..540dcc047fd563 100644
--- a/deps/icu-small/source/common/unicode/ucharstriebuilder.h
+++ b/deps/icu-small/source/common/unicode/ucharstriebuilder.h
@@ -18,6 +18,9 @@
#define __UCHARSTRIEBUILDER_H__
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/stringtriebuilder.h"
#include "unicode/ucharstrie.h"
#include "unicode/unistr.h"
@@ -184,4 +187,6 @@ class U_COMMON_API UCharsTrieBuilder : public StringTrieBuilder {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif // __UCHARSTRIEBUILDER_H__
diff --git a/deps/icu-small/source/common/unicode/uchriter.h b/deps/icu-small/source/common/unicode/uchriter.h
index 38f67c5b454cba..a485259b808f2b 100644
--- a/deps/icu-small/source/common/unicode/uchriter.h
+++ b/deps/icu-small/source/common/unicode/uchriter.h
@@ -11,13 +11,16 @@
#define UCHRITER_H
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/chariter.h"
/**
- * \file
+ * \file
* \brief C++ API: char16_t Character Iterator
*/
-
+
U_NAMESPACE_BEGIN
/**
@@ -132,7 +135,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator {
* @return the CharacterIterator newly created
* @stable ICU 2.0
*/
- virtual CharacterIterator* clone(void) const;
+ virtual UCharCharacterIterator* clone() const;
/**
* Sets the iterator to refer to the first code unit in its
@@ -384,4 +387,7 @@ class U_COMMON_API UCharCharacterIterator : public CharacterIterator {
};
U_NAMESPACE_END
+
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/uclean.h b/deps/icu-small/source/common/unicode/uclean.h
index ab0cd6da6ba780..7cef6dba68b815 100644
--- a/deps/icu-small/source/common/unicode/uclean.h
+++ b/deps/icu-small/source/common/unicode/uclean.h
@@ -22,7 +22,7 @@
* \file
* \brief C API: Initialize and clean up ICU
*/
-
+
/**
* Initialize ICU.
*
@@ -48,8 +48,8 @@
* failure, as usual.
*
* @stable ICU 2.6
- */
-U_STABLE void U_EXPORT2
+ */
+U_STABLE void U_EXPORT2
u_init(UErrorCode *status);
#ifndef U_HIDE_SYSTEM_API
@@ -66,10 +66,10 @@ u_init(UErrorCode *status);
* just before the library unload.
*
* u_cleanup() also clears any ICU heap functions, mutex functions or
- * trace functions that may have been set for the process.
+ * trace functions that may have been set for the process.
* This has the effect of restoring ICU to its initial condition, before
* any of these override functions were installed. Refer to
- * u_setMemoryFunctions(), u_setMutexFunctions and
+ * u_setMemoryFunctions(), u_setMutexFunctions and
* utrace_setFunctions(). If ICU is to be reinitialized after
* calling u_cleanup(), these runtime override functions will need to
* be set up again if they are still required.
@@ -85,7 +85,7 @@ u_init(UErrorCode *status);
* calling u_init(). An application must invoke u_init() first from one single
* thread before allowing other threads call u_init(). All threads existing
* at the time of the first thread's call to u_init() must also call
- * u_init() themselves before continuing with other ICU operations.
+ * u_init() themselves before continuing with other ICU operations.
*
* The use of u_cleanup() just before an application terminates is optional,
* but it should be called only once for performance reasons. The primary
@@ -98,7 +98,7 @@ u_init(UErrorCode *status);
* @stable ICU 2.0
* @system
*/
-U_STABLE void U_EXPORT2
+U_STABLE void U_EXPORT2
u_cleanup(void);
U_CDECL_BEGIN
@@ -147,9 +147,9 @@ typedef void U_CALLCONV UMemFreeFn (const void *context, void *mem);
* @param status Receives error values.
* @stable ICU 2.8
* @system
- */
-U_STABLE void U_EXPORT2
-u_setMemoryFunctions(const void *context, UMemAllocFn * U_CALLCONV_FPTR a, UMemReallocFn * U_CALLCONV_FPTR r, UMemFreeFn * U_CALLCONV_FPTR f,
+ */
+U_STABLE void U_EXPORT2
+u_setMemoryFunctions(const void *context, UMemAllocFn * U_CALLCONV_FPTR a, UMemReallocFn * U_CALLCONV_FPTR r, UMemFreeFn * U_CALLCONV_FPTR f,
UErrorCode *status);
U_CDECL_END
@@ -182,8 +182,8 @@ U_CDECL_BEGIN
* as a parameter.
* @param context user supplied value, obtained from u_setMutexFunctions().
* @param mutex Receives a pointer that identifies the new mutex.
- * The mutex init function must set the UMTX to a non-null value.
- * Subsequent calls by ICU to lock, unlock, or destroy a mutex will
+ * The mutex init function must set the UMTX to a non-null value.
+ * Subsequent calls by ICU to lock, unlock, or destroy a mutex will
* identify the mutex by the UMTX value.
* @param status Error status. Report errors back to ICU by setting this variable
* with an error code.
@@ -213,7 +213,7 @@ U_CDECL_END
* u_init() has been called.
* @param context This pointer value will be saved, and then (later) passed as
* a parameter to the user-supplied mutex functions each time they
- * are called.
+ * are called.
* @param init Pointer to a mutex initialization function. Must be non-null.
* @param destroy Pointer to the mutex destroy function. Must be non-null.
* @param lock pointer to the mutex lock function. Must be non-null.
@@ -221,8 +221,8 @@ U_CDECL_END
* @param status Receives error values.
* @deprecated ICU 52. This function is no longer supported.
* @system
- */
-U_DEPRECATED void U_EXPORT2
+ */
+U_DEPRECATED void U_EXPORT2
u_setMutexFunctions(const void *context, UMtxInitFn *init, UMtxFn *destroy, UMtxFn *lock, UMtxFn *unlock,
UErrorCode *status);
@@ -245,14 +245,14 @@ typedef int32_t U_CALLCONV UMtxAtomicFn(const void *context, int32_t *p);
* u_init() has been called.
* @param context This pointer value will be saved, and then (later) passed as
* a parameter to the increment and decrement functions each time they
- * are called. This function can only be called
+ * are called. This function can only be called
* @param inc Pointer to a function to do an atomic increment operation. Must be non-null.
* @param dec Pointer to a function to do an atomic decrement operation. Must be non-null.
* @param status Receives error values.
* @deprecated ICU 52. This function is no longer supported.
* @system
- */
-U_DEPRECATED void U_EXPORT2
+ */
+U_DEPRECATED void U_EXPORT2
u_setAtomicIncDecFunctions(const void *context, UMtxAtomicFn *inc, UMtxAtomicFn *dec,
UErrorCode *status);
diff --git a/deps/icu-small/source/common/unicode/ucnv_cb.h b/deps/icu-small/source/common/unicode/ucnv_cb.h
index 632cc0b35f26c5..14169ed61c14c9 100644
--- a/deps/icu-small/source/common/unicode/ucnv_cb.h
+++ b/deps/icu-small/source/common/unicode/ucnv_cb.h
@@ -8,52 +8,52 @@
* ucnv_cb.h:
* External APIs for the ICU's codeset conversion library
* Helena Shih
- *
+ *
* Modification History:
*
* Date Name Description
*/
/**
- * \file
+ * \file
* \brief C UConverter functions to aid the writers of callbacks
*
*
Callback API for UConverter
- *
+ *
* These functions are provided here for the convenience of the callback
* writer. If you are just looking for callback functions to use, please
- * see ucnv_err.h. DO NOT call these functions directly when you are
+ * see ucnv_err.h. DO NOT call these functions directly when you are
* working with converters, unless your code has been called as a callback
* via ucnv_setFromUCallback or ucnv_setToUCallback !!
- *
+ *
* A note about error codes and overflow. Unlike other ICU functions,
* these functions do not expect the error status to be U_ZERO_ERROR.
* Callbacks must be much more careful about their error codes.
* The error codes used here are in/out parameters, which should be passed
* back in the callback's error parameter.
- *
- * For example, if you call ucnv_cbfromUWriteBytes to write data out
- * to the output codepage, it may return U_BUFFER_OVERFLOW_ERROR if
- * the data did not fit in the target. But this isn't a failing error,
+ *
+ * For example, if you call ucnv_cbfromUWriteBytes to write data out
+ * to the output codepage, it may return U_BUFFER_OVERFLOW_ERROR if
+ * the data did not fit in the target. But this isn't a failing error,
* in fact, ucnv_cbfromUWriteBytes may be called AGAIN with the error
* status still U_BUFFER_OVERFLOW_ERROR to attempt to write further bytes,
* which will also go into the internal overflow buffers.
- *
+ *
* Concerning offsets, the 'offset' parameters here are relative to the start
- * of SOURCE. For example, Suppose the string "ABCD" was being converted
+ * of SOURCE. For example, Suppose the string "ABCD" was being converted
* from Unicode into a codepage which doesn't have a mapping for 'B'.
* 'A' will be written out correctly, but
* The FromU Callback will be called on an unassigned character for 'B'.
* At this point, this is the state of the world:
* Target: A [..] [points after A]
* Source: A B [C] D [points to C - B has been consumed]
- * 0 1 2 3
- * codePoint = "B" [the unassigned codepoint]
- *
+ * 0 1 2 3
+ * codePoint = "B" [the unassigned codepoint]
+ *
* Now, suppose a callback wants to write the substitution character '?' to
- * the target. It calls ucnv_cbFromUWriteBytes() to write the ?.
- * It should pass ZERO as the offset, because the offset as far as the
- * callback is concerned is relative to the SOURCE pointer [which points
+ * the target. It calls ucnv_cbFromUWriteBytes() to write the ?.
+ * It should pass ZERO as the offset, because the offset as far as the
+ * callback is concerned is relative to the SOURCE pointer [which points
* before 'C'.] If the callback goes into the args and consumes 'C' also,
* it would call FromUWriteBytes with an offset of 1 (and advance the source
* pointer).
@@ -78,8 +78,8 @@
* @param source source bytes to write
* @param length length of bytes to write
* @param offsetIndex the relative offset index from callback.
- * @param err error status. If U_BUFFER_OVERFLOW is returned, then U_BUFFER_OVERFLOW must
- * be returned to the user, because it means that not all data could be written into the target buffer, and some is
+ * @param err error status. If U_BUFFER_OVERFLOW is returned, then U_BUFFER_OVERFLOW must
+ * be returned to the user, because it means that not all data could be written into the target buffer, and some is
* in the converter error buffer.
* @see ucnv_cbFromUWriteSub
* @stable ICU 2.0
@@ -92,25 +92,25 @@ ucnv_cbFromUWriteBytes (UConverterFromUnicodeArgs *args,
UErrorCode * err);
/**
- * ONLY used by FromU callback functions.
- * This function will write out the correct substitution character sequence
+ * ONLY used by FromU callback functions.
+ * This function will write out the correct substitution character sequence
* to the target.
*
* @param args callback fromUnicode arguments
* @param offsetIndex the relative offset index from the current source pointer to be used
- * @param err error status. If U_BUFFER_OVERFLOW is returned, then U_BUFFER_OVERFLOW must
- * be returned to the user, because it means that not all data could be written into the target buffer, and some is
+ * @param err error status. If U_BUFFER_OVERFLOW is returned, then U_BUFFER_OVERFLOW must
+ * be returned to the user, because it means that not all data could be written into the target buffer, and some is
* in the converter error buffer.
* @see ucnv_cbFromUWriteBytes
* @stable ICU 2.0
*/
-U_STABLE void U_EXPORT2
+U_STABLE void U_EXPORT2
ucnv_cbFromUWriteSub (UConverterFromUnicodeArgs *args,
int32_t offsetIndex,
UErrorCode * err);
/**
- * ONLY used by fromU callback functions.
+ * ONLY used by fromU callback functions.
* This function will write out the error character(s) to the target UChar buffer.
*
* @param args callback fromUnicode arguments
@@ -129,7 +129,7 @@ U_STABLE void U_EXPORT2 ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args,
/**
* ONLY used by ToU callback functions.
- * This function will write out the specified characters to the target
+ * This function will write out the specified characters to the target
* UChar buffer.
*
* @param args callback toUnicode arguments
@@ -147,7 +147,7 @@ U_STABLE void U_EXPORT2 ucnv_cbToUWriteUChars (UConverterToUnicodeArgs *args,
UErrorCode * err);
/**
- * ONLY used by ToU callback functions.
+ * ONLY used by ToU callback functions.
* This function will write out the Unicode substitution character (U+FFFD).
*
* @param args callback fromUnicode arguments
diff --git a/deps/icu-small/source/common/unicode/ucnv_err.h b/deps/icu-small/source/common/unicode/ucnv_err.h
index 08c96c14407c22..d234710a8b1880 100644
--- a/deps/icu-small/source/common/unicode/ucnv_err.h
+++ b/deps/icu-small/source/common/unicode/ucnv_err.h
@@ -108,7 +108,7 @@ typedef struct UConverter UConverter;
#define UCNV_SKIP_STOP_ON_ILLEGAL "i"
/**
- * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to ICU (%UXXXX)
+ * FROM_U_CALLBACK_ESCAPE context option to escape the code unit according to ICU (%UXXXX)
* @stable ICU 2.0
*/
#define UCNV_ESCAPE_ICU NULL
@@ -148,24 +148,24 @@ typedef struct UConverter UConverter;
*/
#define UCNV_ESCAPE_CSS2 "S"
-/**
- * The process condition code to be used with the callbacks.
- * Codes which are greater than UCNV_IRREGULAR should be
+/**
+ * The process condition code to be used with the callbacks.
+ * Codes which are greater than UCNV_IRREGULAR should be
* passed on to any chained callbacks.
* @stable ICU 2.0
*/
typedef enum {
UCNV_UNASSIGNED = 0, /**< The code point is unassigned.
The error code U_INVALID_CHAR_FOUND will be set. */
- UCNV_ILLEGAL = 1, /**< The code point is illegal. For example,
+ UCNV_ILLEGAL = 1, /**< The code point is illegal. For example,
\\x81\\x2E is illegal in SJIS because \\x2E
- is not a valid trail byte for the \\x81
+ is not a valid trail byte for the \\x81
lead byte.
Also, starting with Unicode 3.0.1, non-shortest byte sequences
in UTF-8 (like \\xC1\\xA1 instead of \\x61 for U+0061)
are also illegal, not just irregular.
The error code U_ILLEGAL_CHAR_FOUND will be set. */
- UCNV_IRREGULAR = 2, /**< The codepoint is not a regular sequence in
+ UCNV_IRREGULAR = 2, /**< The codepoint is not a regular sequence in
the encoding. For example, \\xED\\xA0\\x80..\\xED\\xBF\\xBF
are irregular UTF-8 byte sequences for single surrogate
code points.
@@ -179,8 +179,8 @@ typedef enum {
converter. the pointer available as the
'context' is an alias to the original converters'
context pointer. If the context must be owned
- by the new converter, the callback must clone
- the data and call ucnv_setFromUCallback
+ by the new converter, the callback must clone
+ the data and call ucnv_setFromUCallback
(or setToUCallback) with the correct pointer.
@stable ICU 2.2
*/
@@ -269,7 +269,7 @@ U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_STOP (
* DO NOT CALL THIS FUNCTION DIRECTLY!
* This From Unicode callback skips any ILLEGAL_SEQUENCE, or
* skips only UNASSINGED_SEQUENCE depending on the context parameter
- * simply ignoring those characters.
+ * simply ignoring those characters.
*
* @param context The function currently recognizes the callback options:
* UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
@@ -295,7 +295,7 @@ U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SKIP (
/**
* DO NOT CALL THIS FUNCTION DIRECTLY!
- * This From Unicode callback will Substitute the ILLEGAL SEQUENCE, or
+ * This From Unicode callback will Substitute the ILLEGAL SEQUENCE, or
* UNASSIGNED_SEQUENCE depending on context parameter, with the
* current substitution string for the converter. This is the default
* callback.
@@ -330,33 +330,33 @@ U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_SUBSTITUTE (
*
* @param context The function currently recognizes the callback options:
*
- * - UCNV_ESCAPE_ICU: Substitues the ILLEGAL SEQUENCE with the hexadecimal
- * representation in the format %UXXXX, e.g. "%uFFFE%u00AC%uC8FE").
- * In the Event the converter doesn't support the characters {%,U}[A-F][0-9],
+ *
- UCNV_ESCAPE_ICU: Substitues the ILLEGAL SEQUENCE with the hexadecimal
+ * representation in the format %UXXXX, e.g. "%uFFFE%u00AC%uC8FE").
+ * In the Event the converter doesn't support the characters {%,U}[A-F][0-9],
* it will substitute the illegal sequence with the substitution characters.
* Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
* %UD84D%UDC56
- * - UCNV_ESCAPE_JAVA: Substitues the ILLEGAL SEQUENCE with the hexadecimal
- * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE").
- * In the Event the converter doesn't support the characters {\,u}[A-F][0-9],
+ *
- UCNV_ESCAPE_JAVA: Substitues the ILLEGAL SEQUENCE with the hexadecimal
+ * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE").
+ * In the Event the converter doesn't support the characters {\,u}[A-F][0-9],
* it will substitute the illegal sequence with the substitution characters.
* Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
* \\uD84D\\uDC56
- * - UCNV_ESCAPE_C: Substitues the ILLEGAL SEQUENCE with the hexadecimal
- * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE").
- * In the Event the converter doesn't support the characters {\,u,U}[A-F][0-9],
+ *
- UCNV_ESCAPE_C: Substitues the ILLEGAL SEQUENCE with the hexadecimal
+ * representation in the format \\uXXXX, e.g. "\\uFFFE\\u00AC\\uC8FE").
+ * In the Event the converter doesn't support the characters {\,u,U}[A-F][0-9],
* it will substitute the illegal sequence with the substitution characters.
* Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
* \\U00023456
- * - UCNV_ESCAPE_XML_DEC: Substitues the ILLEGAL SEQUENCE with the decimal
- * representation in the format \htmlonly&#DDDDDDDD;, e.g. "¬죾")\endhtmlonly.
- * In the Event the converter doesn't support the characters {&,#}[0-9],
+ *
- UCNV_ESCAPE_XML_DEC: Substitues the ILLEGAL SEQUENCE with the decimal
+ * representation in the format \htmlonly&#DDDDDDDD;, e.g. "¬죾")\endhtmlonly.
+ * In the Event the converter doesn't support the characters {&,#}[0-9],
* it will substitute the illegal sequence with the substitution characters.
* Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
* 𣑖 and Zero padding is ignored.
- * - UCNV_ESCAPE_XML_HEX:Substitues the ILLEGAL SEQUENCE with the decimal
- * representation in the format \htmlonly&#xXXXX; e.g. "¬죾")\endhtmlonly.
- * In the Event the converter doesn't support the characters {&,#,x}[0-9],
+ *
- UCNV_ESCAPE_XML_HEX:Substitues the ILLEGAL SEQUENCE with the decimal
+ * representation in the format \htmlonly&#xXXXX; e.g. "¬죾")\endhtmlonly.
+ * In the Event the converter doesn't support the characters {&,#,x}[0-9],
* it will substitute the illegal sequence with the substitution characters.
* Note that codeUnit(32bit int eg: unit of a surrogate pair) is represented as
* \htmlonly𣑖\endhtmlonly
@@ -384,7 +384,7 @@ U_STABLE void U_EXPORT2 UCNV_FROM_U_CALLBACK_ESCAPE (
* DO NOT CALL THIS FUNCTION DIRECTLY!
* This To Unicode callback skips any ILLEGAL_SEQUENCE, or
* skips only UNASSINGED_SEQUENCE depending on the context parameter
- * simply ignoring those characters.
+ * simply ignoring those characters.
*
* @param context The function currently recognizes the callback options:
* UCNV_SKIP_STOP_ON_ILLEGAL: STOPS at the ILLEGAL_SEQUENCE,
@@ -408,7 +408,7 @@ U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_SKIP (
/**
* DO NOT CALL THIS FUNCTION DIRECTLY!
- * This To Unicode callback will Substitute the ILLEGAL SEQUENCE,or
+ * This To Unicode callback will Substitute the ILLEGAL SEQUENCE,or
* UNASSIGNED_SEQUENCE depending on context parameter, with the
* Unicode substitution character, U+FFFD.
*
@@ -462,4 +462,4 @@ U_STABLE void U_EXPORT2 UCNV_TO_U_CALLBACK_ESCAPE (
#endif
-/*UCNV_ERR_H*/
+/*UCNV_ERR_H*/
diff --git a/deps/icu-small/source/common/unicode/ucnvsel.h b/deps/icu-small/source/common/unicode/ucnvsel.h
index 5fee53f179ace7..d423845ceb6297 100644
--- a/deps/icu-small/source/common/unicode/ucnvsel.h
+++ b/deps/icu-small/source/common/unicode/ucnvsel.h
@@ -55,7 +55,7 @@ typedef struct UConverterSelector UConverterSelector;
* If converterListSize is 0, build for all available converters.
* If excludedCodePoints is NULL, don't exclude any code points.
*
- * @param converterList a pointer to encoding names needed to be involved.
+ * @param converterList a pointer to encoding names needed to be involved.
* Can be NULL if converterListSize==0.
* The list and the names will be cloned, and the caller
* retains ownership of the original.
diff --git a/deps/icu-small/source/common/unicode/uconfig.h b/deps/icu-small/source/common/unicode/uconfig.h
index 9c82d828125603..bbc232d1ed8fdf 100644
--- a/deps/icu-small/source/common/unicode/uconfig.h
+++ b/deps/icu-small/source/common/unicode/uconfig.h
@@ -1,6 +1,6 @@
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
-/*
+/*
**********************************************************************
* Copyright (C) 2002-2016, International Business Machines
* Corporation and others. All Rights Reserved.
@@ -76,7 +76,7 @@
#endif
/**
- * Determines whether to enable auto cleanup of libraries.
+ * Determines whether to enable auto cleanup of libraries.
* @internal
*/
#ifndef UCLN_NO_AUTO_CLEANUP
@@ -256,7 +256,7 @@
# define UCONFIG_NO_FILE_IO 0
#endif
-#if UCONFIG_NO_FILE_IO && defined(U_TIMEZONE_FILES_DIR)
+#if UCONFIG_NO_FILE_IO && defined(U_TIMEZONE_FILES_DIR)
# error Contradictory file io switches in uconfig.h.
#endif
@@ -374,7 +374,7 @@
* On platforms where U_PLATFORM_HAS_WIN32_API is true, this switch determines
* if the Windows platform APIs are used for LCID<->Locale Name conversions.
* Otherwise, only the built-in ICU tables are used.
- *
+ *
* @internal ICU 64
*/
#ifndef UCONFIG_USE_WINDOWS_LCID_MAPPING_API
@@ -453,4 +453,4 @@
# define UCONFIG_NO_FILTERED_BREAK_ITERATION 0
#endif
-#endif
+#endif // __UCONFIG_H__
diff --git a/deps/icu-small/source/common/unicode/ucpmap.h b/deps/icu-small/source/common/unicode/ucpmap.h
index f2c42b6b7f4bee..31e1365cac850a 100644
--- a/deps/icu-small/source/common/unicode/ucpmap.h
+++ b/deps/icu-small/source/common/unicode/ucpmap.h
@@ -9,8 +9,6 @@
#include "unicode/utypes.h"
-#ifndef U_HIDE_DRAFT_API
-
U_CDECL_BEGIN
/**
@@ -28,7 +26,7 @@ U_CDECL_BEGIN
*
* @see UCPTrie
* @see UMutableCPTrie
- * @draft ICU 63
+ * @stable ICU 63
*/
typedef struct UCPMap UCPMap;
@@ -39,13 +37,13 @@ typedef struct UCPMap UCPMap;
* @see ucpmap_getRange
* @see ucptrie_getRange
* @see umutablecptrie_getRange
- * @draft ICU 63
+ * @stable ICU 63
*/
enum UCPMapRangeOption {
/**
* ucpmap_getRange() enumerates all same-value ranges as stored in the map.
* Most users should use this option.
- * @draft ICU 63
+ * @stable ICU 63
*/
UCPMAP_RANGE_NORMAL,
/**
@@ -61,7 +59,7 @@ enum UCPMapRangeOption {
* special values optimized for UTF-16 string processing
* or for special error behavior for unpaired surrogates,
* but those values are not to be associated with the lead surrogate code *points*.
- * @draft ICU 63
+ * @stable ICU 63
*/
UCPMAP_RANGE_FIXED_LEAD_SURROGATES,
/**
@@ -77,7 +75,7 @@ enum UCPMapRangeOption {
* special values optimized for UTF-16 string processing
* or for special error behavior for unpaired surrogates,
* but those values are not to be associated with the lead surrogate code *points*.
- * @draft ICU 63
+ * @stable ICU 63
*/
UCPMAP_RANGE_FIXED_ALL_SURROGATES
};
@@ -93,7 +91,7 @@ typedef enum UCPMapRangeOption UCPMapRangeOption;
* @param c the code point
* @return the map value,
* or an implementation-defined error value if the code point is not in the range 0..U+10FFFF
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI uint32_t U_EXPORT2
ucpmap_get(const UCPMap *map, UChar32 c);
@@ -110,7 +108,7 @@ ucpmap_get(const UCPMap *map, UChar32 c);
* @param context an opaque pointer, as passed into the getRange function
* @param value a value from the map
* @return the modified value
- * @draft ICU 63
+ * @stable ICU 63
*/
typedef uint32_t U_CALLCONV
UCPMapValueFilter(const void *context, uint32_t value);
@@ -149,7 +147,7 @@ UCPMapValueFilter(const void *context, uint32_t value);
* may have been modified by filter(context, map value)
* if that function pointer is not NULL
* @return the range end code point, or -1 if start is not a valid code point
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI UChar32 U_EXPORT2
ucpmap_getRange(const UCPMap *map, UChar32 start,
@@ -158,5 +156,4 @@ ucpmap_getRange(const UCPMap *map, UChar32 start,
U_CDECL_END
-#endif // U_HIDE_DRAFT_API
#endif
diff --git a/deps/icu-small/source/common/unicode/ucptrie.h b/deps/icu-small/source/common/unicode/ucptrie.h
index 2718c984e43197..be06a227928286 100644
--- a/deps/icu-small/source/common/unicode/ucptrie.h
+++ b/deps/icu-small/source/common/unicode/ucptrie.h
@@ -9,8 +9,6 @@
#include "unicode/utypes.h"
-#ifndef U_HIDE_DRAFT_API
-
#include "unicode/localpointer.h"
#include "unicode/ucpmap.h"
#include "unicode/utf8.h"
@@ -55,7 +53,7 @@ typedef union UCPTrieData {
* The macros will return bogus values, or may crash, if used on the wrong type or value width.
*
* @see UMutableCPTrie
- * @draft ICU 63
+ * @stable ICU 63
*/
struct UCPTrie {
#ifndef U_IN_DOXYGEN
@@ -115,23 +113,23 @@ typedef struct UCPTrie UCPTrie;
* @see umutablecptrie_buildImmutable
* @see ucptrie_openFromBinary
* @see ucptrie_getType
- * @draft ICU 63
+ * @stable ICU 63
*/
enum UCPTrieType {
/**
* For ucptrie_openFromBinary() to accept any type.
* ucptrie_getType() will return the actual type.
- * @draft ICU 63
+ * @stable ICU 63
*/
UCPTRIE_TYPE_ANY = -1,
/**
* Fast/simple/larger BMP data structure. Use functions and "fast" macros.
- * @draft ICU 63
+ * @stable ICU 63
*/
UCPTRIE_TYPE_FAST,
/**
* Small/slower BMP data structure. Use functions and "small" macros.
- * @draft ICU 63
+ * @stable ICU 63
*/
UCPTRIE_TYPE_SMALL
};
@@ -145,30 +143,30 @@ typedef enum UCPTrieType UCPTrieType;
* @see umutablecptrie_buildImmutable
* @see ucptrie_openFromBinary
* @see ucptrie_getValueWidth
- * @draft ICU 63
+ * @stable ICU 63
*/
enum UCPTrieValueWidth {
/**
* For ucptrie_openFromBinary() to accept any data value width.
* ucptrie_getValueWidth() will return the actual data value width.
- * @draft ICU 63
+ * @stable ICU 63
*/
UCPTRIE_VALUE_BITS_ANY = -1,
/**
* The trie stores 16 bits per data value.
* It returns them as unsigned values 0..0xffff=65535.
- * @draft ICU 63
+ * @stable ICU 63
*/
UCPTRIE_VALUE_BITS_16,
/**
* The trie stores 32 bits per data value.
- * @draft ICU 63
+ * @stable ICU 63
*/
UCPTRIE_VALUE_BITS_32,
/**
* The trie stores 8 bits per data value.
* It returns them as unsigned values 0..0xff=255.
- * @draft ICU 63
+ * @stable ICU 63
*/
UCPTRIE_VALUE_BITS_8
};
@@ -200,7 +198,7 @@ typedef enum UCPTrieValueWidth UCPTrieValueWidth;
* @see umutablecptrie_open
* @see umutablecptrie_buildImmutable
* @see ucptrie_toBinary
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI UCPTrie * U_EXPORT2
ucptrie_openFromBinary(UCPTrieType type, UCPTrieValueWidth valueWidth,
@@ -211,30 +209,11 @@ ucptrie_openFromBinary(UCPTrieType type, UCPTrieValueWidth valueWidth,
* Closes a trie and releases associated memory.
*
* @param trie the trie
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI void U_EXPORT2
ucptrie_close(UCPTrie *trie);
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUCPTriePointer
- * "Smart pointer" class, closes a UCPTrie via ucptrie_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @draft ICU 63
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUCPTriePointer, UCPTrie, ucptrie_close);
-
-U_NAMESPACE_END
-
-#endif
-
/**
* Returns the trie type.
*
@@ -242,7 +221,7 @@ U_NAMESPACE_END
* @return the trie type
* @see ucptrie_openFromBinary
* @see UCPTRIE_TYPE_ANY
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI UCPTrieType U_EXPORT2
ucptrie_getType(const UCPTrie *trie);
@@ -254,7 +233,7 @@ ucptrie_getType(const UCPTrie *trie);
* @return the number of bits in a trie data value
* @see ucptrie_openFromBinary
* @see UCPTRIE_VALUE_BITS_ANY
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI UCPTrieValueWidth U_EXPORT2
ucptrie_getValueWidth(const UCPTrie *trie);
@@ -271,7 +250,7 @@ ucptrie_getValueWidth(const UCPTrie *trie);
* @param c the code point
* @return the trie value,
* or the trie error value if the code point is not in the range 0..U+10FFFF
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI uint32_t U_EXPORT2
ucptrie_get(const UCPTrie *trie, UChar32 c);
@@ -310,7 +289,7 @@ ucptrie_get(const UCPTrie *trie, UChar32 c);
* may have been modified by filter(context, trie value)
* if that function pointer is not NULL
* @return the range end code point, or -1 if start is not a valid code point
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI UChar32 U_EXPORT2
ucptrie_getRange(const UCPTrie *trie, UChar32 start,
@@ -330,7 +309,7 @@ ucptrie_getRange(const UCPTrie *trie, UChar32 start,
* @return the number of bytes written or (if buffer overflow) needed for the trie
*
* @see ucptrie_openFromBinary()
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI int32_t U_EXPORT2
ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *pErrorCode);
@@ -341,7 +320,7 @@ ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *
* Do not use this macro in any other way.
*
* @see UCPTRIE_VALUE_BITS_16
- * @draft ICU 63
+ * @stable ICU 63
*/
#define UCPTRIE_16(trie, i) ((trie)->data.ptr16[i])
@@ -351,7 +330,7 @@ ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *
* Do not use this macro in any other way.
*
* @see UCPTRIE_VALUE_BITS_32
- * @draft ICU 63
+ * @stable ICU 63
*/
#define UCPTRIE_32(trie, i) ((trie)->data.ptr32[i])
@@ -361,7 +340,7 @@ ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *
* Do not use this macro in any other way.
*
* @see UCPTRIE_VALUE_BITS_8
- * @draft ICU 63
+ * @stable ICU 63
*/
#define UCPTRIE_8(trie, i) ((trie)->data.ptr8[i])
@@ -373,7 +352,7 @@ ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *
* @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
* @param c (UChar32, in) the input code point
* @return The code point's trie value.
- * @draft ICU 63
+ * @stable ICU 63
*/
#define UCPTRIE_FAST_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_CP_INDEX(trie, 0xffff, c))
@@ -385,7 +364,7 @@ ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *
* @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
* @param c (UChar32, in) the input code point
* @return The code point's trie value.
- * @draft ICU 63
+ * @stable ICU 63
*/
#define UCPTRIE_SMALL_GET(trie, dataAccess, c) \
dataAccess(trie, _UCPTRIE_CP_INDEX(trie, UCPTRIE_SMALL_MAX, c))
@@ -401,9 +380,9 @@ ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *
* @param limit (const UChar *, in) the limit pointer for the text, or NULL if NUL-terminated
* @param c (UChar32, out) variable for the code point
* @param result (out) variable for the trie lookup result
- * @draft ICU 63
+ * @stable ICU 63
*/
-#define UCPTRIE_FAST_U16_NEXT(trie, dataAccess, src, limit, c, result) { \
+#define UCPTRIE_FAST_U16_NEXT(trie, dataAccess, src, limit, c, result) UPRV_BLOCK_MACRO_BEGIN { \
(c) = *(src)++; \
int32_t __index; \
if (!U16_IS_SURROGATE(c)) { \
@@ -419,7 +398,7 @@ ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *
} \
} \
(result) = dataAccess(trie, __index); \
-}
+} UPRV_BLOCK_MACRO_END
/**
* UTF-16: Reads the previous code point (UChar32 c, out), pre-decrements src,
@@ -432,9 +411,9 @@ ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *
* @param src (const UChar *, in/out) the source text pointer
* @param c (UChar32, out) variable for the code point
* @param result (out) variable for the trie lookup result
- * @draft ICU 63
+ * @stable ICU 63
*/
-#define UCPTRIE_FAST_U16_PREV(trie, dataAccess, start, src, c, result) { \
+#define UCPTRIE_FAST_U16_PREV(trie, dataAccess, start, src, c, result) UPRV_BLOCK_MACRO_BEGIN { \
(c) = *--(src); \
int32_t __index; \
if (!U16_IS_SURROGATE(c)) { \
@@ -450,7 +429,7 @@ ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *
} \
} \
(result) = dataAccess(trie, __index); \
-}
+} UPRV_BLOCK_MACRO_END
/**
* UTF-8: Post-increments src and gets a value from the trie.
@@ -466,9 +445,9 @@ ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *
* @param src (const char *, in/out) the source text pointer
* @param limit (const char *, in) the limit pointer for the text (must not be NULL)
* @param result (out) variable for the trie lookup result
- * @draft ICU 63
+ * @stable ICU 63
*/
-#define UCPTRIE_FAST_U8_NEXT(trie, dataAccess, src, limit, result) { \
+#define UCPTRIE_FAST_U8_NEXT(trie, dataAccess, src, limit, result) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __lead = (uint8_t)*(src)++; \
if (!U8_IS_SINGLE(__lead)) { \
uint8_t __t1, __t2, __t3; \
@@ -496,7 +475,7 @@ ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *
} \
} \
(result) = dataAccess(trie, __lead); \
-}
+} UPRV_BLOCK_MACRO_END
/**
* UTF-8: Pre-decrements src and gets a value from the trie.
@@ -512,9 +491,9 @@ ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *
* @param start (const char *, in) the start pointer for the text
* @param src (const char *, in/out) the source text pointer
* @param result (out) variable for the trie lookup result
- * @draft ICU 63
+ * @stable ICU 63
*/
-#define UCPTRIE_FAST_U8_PREV(trie, dataAccess, start, src, result) { \
+#define UCPTRIE_FAST_U8_PREV(trie, dataAccess, start, src, result) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __index = (uint8_t)*--(src); \
if (!U8_IS_SINGLE(__index)) { \
__index = ucptrie_internalU8PrevIndex((trie), __index, (const uint8_t *)(start), \
@@ -523,7 +502,7 @@ ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *
__index >>= 3; \
} \
(result) = dataAccess(trie, __index); \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Returns a trie value for an ASCII code point, without range checking.
@@ -532,7 +511,7 @@ ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *
* @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
* @param c (UChar32, in) the input code point; must be U+0000..U+007F
* @return The ASCII code point's trie value.
- * @draft ICU 63
+ * @stable ICU 63
*/
#define UCPTRIE_ASCII_GET(trie, dataAccess, c) dataAccess(trie, c)
@@ -545,7 +524,7 @@ ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *
* @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
* @param c (UChar32, in) the input code point, must be U+0000..U+FFFF
* @return The BMP code point's trie value.
- * @draft ICU 63
+ * @stable ICU 63
*/
#define UCPTRIE_FAST_BMP_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_FAST_INDEX(trie, c))
@@ -557,7 +536,7 @@ ucptrie_toBinary(const UCPTrie *trie, void *data, int32_t capacity, UErrorCode *
* @param dataAccess UCPTRIE_16, UCPTRIE_32, or UCPTRIE_8 according to the trie’s value width
* @param c (UChar32, in) the input code point, must be U+10000..U+10FFFF
* @return The supplementary code point's trie value.
- * @draft ICU 63
+ * @stable ICU 63
*/
#define UCPTRIE_FAST_SUPP_GET(trie, dataAccess, c) dataAccess(trie, _UCPTRIE_SMALL_INDEX(trie, c))
@@ -642,5 +621,24 @@ ucptrie_internalU8PrevIndex(const UCPTrie *trie, UChar32 c,
U_CDECL_END
#endif // U_IN_DOXYGEN
-#endif // U_HIDE_DRAFT_API
+
+#if U_SHOW_CPLUSPLUS_API
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUCPTriePointer
+ * "Smart pointer" class, closes a UCPTrie via ucptrie_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 63
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUCPTriePointer, UCPTrie, ucptrie_close);
+
+U_NAMESPACE_END
+
+#endif // U_SHOW_CPLUSPLUS_API
+
#endif
diff --git a/deps/icu-small/source/common/unicode/ucurr.h b/deps/icu-small/source/common/unicode/ucurr.h
index a1c6de80b772f7..f91cc0df7c61cc 100644
--- a/deps/icu-small/source/common/unicode/ucurr.h
+++ b/deps/icu-small/source/common/unicode/ucurr.h
@@ -13,7 +13,7 @@
#include "unicode/uenum.h"
/**
- * \file
+ * \file
* \brief C API: Encapsulates information about a currency.
*
* The ucurr API encapsulates information about a currency, as defined by
@@ -61,11 +61,11 @@ enum UCurrencyUsage {
#endif // U_HIDE_DEPRECATED_API
};
/** Currency Usage used for Decimal Format */
-typedef enum UCurrencyUsage UCurrencyUsage;
+typedef enum UCurrencyUsage UCurrencyUsage;
/**
* Finds a currency code for the given locale.
- * @param locale the locale for which to retrieve a currency code.
+ * @param locale the locale for which to retrieve a currency code.
* Currency can be specified by the "currency" keyword
* in which case it overrides the default currency code
* @param buff fill in buffer. Can be NULL for preflighting.
@@ -74,8 +74,8 @@ typedef enum UCurrencyUsage UCurrencyUsage;
* must not be NULL.
* @param ec error code
* @return length of the currency string. It should always be 3. If 0,
- * currency couldn't be found or the input values are
- * invalid.
+ * currency couldn't be found or the input values are
+ * invalid.
* @stable ICU 2.8
*/
U_STABLE int32_t U_EXPORT2
@@ -134,14 +134,14 @@ typedef const void* UCurrRegistryKey;
* @stable ICU 2.6
*/
U_STABLE UCurrRegistryKey U_EXPORT2
-ucurr_register(const UChar* isoCode,
- const char* locale,
+ucurr_register(const UChar* isoCode,
+ const char* locale,
UErrorCode* status);
/**
* Unregister the previously-registered currency definitions using the
* URegistryKey returned from ucurr_register. Key becomes invalid after
- * a successful call and should not be used again. Any currency
- * that might have been hidden by the original ucurr_register call is
+ * a successful call and should not be used again. Any currency
+ * that might have been hidden by the original ucurr_register call is
* restored.
* @param key the registry key returned by a previous call to ucurr_register
* @param status the in/out status code, no special meanings are assigned
@@ -159,14 +159,14 @@ ucurr_unregister(UCurrRegistryKey key, UErrorCode* status);
* @param currency null-terminated 3-letter ISO 4217 code
* @param locale locale in which to display currency
* @param nameStyle selector for which kind of name to return
- * @param isChoiceFormat fill-in set to TRUE if the returned value
- * is a ChoiceFormat pattern; otherwise it is a static string
+ * @param isChoiceFormat always set to FALSE, or can be NULL;
+ * display names are static strings;
+ * since ICU 4.4, ChoiceFormat patterns are no longer supported
* @param len fill-in parameter to receive length of result
* @param ec error code
* @return pointer to display string of 'len' UChars. If the resource
* data contains no entry for 'currency', then 'currency' itself is
- * returned. If *isChoiceFormat is TRUE, then the result is a
- * ChoiceFormat pattern. Otherwise it is a static string.
+ * returned.
* @stable ICU 2.6
*/
U_STABLE const UChar* U_EXPORT2
@@ -183,8 +183,9 @@ ucurr_getName(const UChar* currency,
* currency object in the en_US locale is "US dollar" or "US dollars".
* @param currency null-terminated 3-letter ISO 4217 code
* @param locale locale in which to display currency
- * @param isChoiceFormat fill-in set to TRUE if the returned value
- * is a ChoiceFormat pattern; otherwise it is a static string
+ * @param isChoiceFormat always set to FALSE, or can be NULL;
+ * display names are static strings;
+ * since ICU 4.4, ChoiceFormat patterns are no longer supported
* @param pluralCount plural count
* @param len fill-in parameter to receive length of result
* @param ec error code
@@ -240,7 +241,7 @@ ucurr_getDefaultFractionDigits(const UChar* currency,
* @stable ICU 54
*/
U_STABLE int32_t U_EXPORT2
-ucurr_getDefaultFractionDigitsForUsage(const UChar* currency,
+ucurr_getDefaultFractionDigitsForUsage(const UChar* currency,
const UCurrencyUsage usage,
UErrorCode* ec);
@@ -320,7 +321,7 @@ typedef enum UCurrCurrencyType {
* Provides a UEnumeration object for listing ISO-4217 codes.
* @param currType You can use one of several UCurrCurrencyType values for this
* variable. You can also | (or) them together to get a specific list of
- * currencies. Most people will want to use the (UCURR_CURRENCY|UCURR_NON_DEPRECATED) value to
+ * currencies. Most people will want to use the (UCURR_COMMON|UCURR_NON_DEPRECATED) value to
* get a list of current currencies.
* @param pErrorCode Error code
* @stable ICU 3.2
@@ -329,38 +330,38 @@ U_STABLE UEnumeration * U_EXPORT2
ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode);
/**
- * Queries if the given ISO 4217 3-letter code is available on the specified date range.
- *
- * Note: For checking availability of a currency on a specific date, specify the date on both 'from' and 'to'
- *
- * When 'from' is U_DATE_MIN and 'to' is U_DATE_MAX, this method checks if the specified currency is available any time.
+ * Queries if the given ISO 4217 3-letter code is available on the specified date range.
+ *
+ * Note: For checking availability of a currency on a specific date, specify the date on both 'from' and 'to'
+ *
+ * When 'from' is U_DATE_MIN and 'to' is U_DATE_MAX, this method checks if the specified currency is available any time.
* If 'from' and 'to' are same UDate value, this method checks if the specified currency is available on that date.
- *
- * @param isoCode
- * The ISO 4217 3-letter code.
- *
- * @param from
- * The lower bound of the date range, inclusive. When 'from' is U_DATE_MIN, check the availability
- * of the currency any date before 'to'
- *
- * @param to
- * The upper bound of the date range, inclusive. When 'to' is U_DATE_MAX, check the availability of
- * the currency any date after 'from'
- *
- * @param errorCode
- * ICU error code
- *
- * @return TRUE if the given ISO 4217 3-letter code is supported on the specified date range.
- *
- * @stable ICU 4.8
- */
+ *
+ * @param isoCode
+ * The ISO 4217 3-letter code.
+ *
+ * @param from
+ * The lower bound of the date range, inclusive. When 'from' is U_DATE_MIN, check the availability
+ * of the currency any date before 'to'
+ *
+ * @param to
+ * The upper bound of the date range, inclusive. When 'to' is U_DATE_MAX, check the availability of
+ * the currency any date after 'from'
+ *
+ * @param errorCode
+ * ICU error code
+ *
+ * @return TRUE if the given ISO 4217 3-letter code is supported on the specified date range.
+ *
+ * @stable ICU 4.8
+ */
U_STABLE UBool U_EXPORT2
-ucurr_isAvailable(const UChar* isoCode,
- UDate from,
- UDate to,
+ucurr_isAvailable(const UChar* isoCode,
+ UDate from,
+ UDate to,
UErrorCode* errorCode);
-/**
+/**
* Finds the number of valid currency codes for the
* given locale and date.
* @param locale the locale for which to retrieve the
@@ -375,36 +376,36 @@ ucurr_isAvailable(const UChar* isoCode,
* @stable ICU 4.0
*/
U_STABLE int32_t U_EXPORT2
-ucurr_countCurrencies(const char* locale,
- UDate date,
- UErrorCode* ec);
+ucurr_countCurrencies(const char* locale,
+ UDate date,
+ UErrorCode* ec);
-/**
- * Finds a currency code for the given locale and date
- * @param locale the locale for which to retrieve a currency code.
- * Currency can be specified by the "currency" keyword
- * in which case it overrides the default currency code
- * @param date the date for which to retrieve a currency code for
- * the given locale.
+/**
+ * Finds a currency code for the given locale and date
+ * @param locale the locale for which to retrieve a currency code.
+ * Currency can be specified by the "currency" keyword
+ * in which case it overrides the default currency code
+ * @param date the date for which to retrieve a currency code for
+ * the given locale.
* @param index the index within the available list of currency codes
* for the given locale on the given date.
- * @param buff fill in buffer. Can be NULL for preflighting.
- * @param buffCapacity capacity of the fill in buffer. Can be 0 for
- * preflighting. If it is non-zero, the buff parameter
- * must not be NULL.
- * @param ec error code
- * @return length of the currency string. It should always be 3.
- * If 0, currency couldn't be found or the input values are
- * invalid.
- * @stable ICU 4.0
- */
-U_STABLE int32_t U_EXPORT2
-ucurr_forLocaleAndDate(const char* locale,
- UDate date,
+ * @param buff fill in buffer. Can be NULL for preflighting.
+ * @param buffCapacity capacity of the fill in buffer. Can be 0 for
+ * preflighting. If it is non-zero, the buff parameter
+ * must not be NULL.
+ * @param ec error code
+ * @return length of the currency string. It should always be 3.
+ * If 0, currency couldn't be found or the input values are
+ * invalid.
+ * @stable ICU 4.0
+ */
+U_STABLE int32_t U_EXPORT2
+ucurr_forLocaleAndDate(const char* locale,
+ UDate date,
int32_t index,
- UChar* buff,
- int32_t buffCapacity,
- UErrorCode* ec);
+ UChar* buff,
+ int32_t buffCapacity,
+ UErrorCode* ec);
/**
* Given a key and a locale, returns an array of string values in a preferred
diff --git a/deps/icu-small/source/common/unicode/udata.h b/deps/icu-small/source/common/unicode/udata.h
index 6419c359f606af..325ffcf17db054 100644
--- a/deps/icu-small/source/common/unicode/udata.h
+++ b/deps/icu-small/source/common/unicode/udata.h
@@ -38,16 +38,16 @@ U_CDECL_BEGIN
*
* See the User Guide Data Management chapter.
*/
-
+
#ifndef U_HIDE_INTERNAL_API
/**
- * Character used to separate package names from tree names
+ * Character used to separate package names from tree names
* @internal ICU 3.0
*/
#define U_TREE_SEPARATOR '-'
/**
- * String used to separate package names from tree names
+ * String used to separate package names from tree names
* @internal ICU 3.0
*/
#define U_TREE_SEPARATOR_STRING "-"
@@ -65,7 +65,7 @@ U_CDECL_BEGIN
#define U_TREE_ENTRY_SEP_STRING "/"
/**
- * Alias for standard ICU data
+ * Alias for standard ICU data
* @internal ICU 3.0
*/
#define U_ICUDATA_ALIAS "ICUDATA"
@@ -115,7 +115,7 @@ typedef struct {
* @stable ICU 2.0 */
uint16_t size;
- /** unused, set to 0
+ /** unused, set to 0
* @stable ICU 2.0*/
uint16_t reservedWord;
@@ -124,27 +124,27 @@ typedef struct {
* @stable ICU 2.0 */
uint8_t isBigEndian;
- /** see U_CHARSET_FAMILY values in utypes.h
+ /** see U_CHARSET_FAMILY values in utypes.h
* @stable ICU 2.0*/
uint8_t charsetFamily;
- /** sizeof(UChar), one of { 1, 2, 4 }
+ /** sizeof(UChar), one of { 1, 2, 4 }
* @stable ICU 2.0*/
uint8_t sizeofUChar;
- /** unused, set to 0
+ /** unused, set to 0
* @stable ICU 2.0*/
uint8_t reservedByte;
- /** data format identifier
+ /** data format identifier
* @stable ICU 2.0*/
uint8_t dataFormat[4];
- /** versions: [0] major [1] minor [2] milli [3] micro
+ /** versions: [0] major [1] minor [2] milli [3] micro
* @stable ICU 2.0*/
uint8_t formatVersion[4];
- /** versions: [0] major [1] minor [2] milli [3] micro
+ /** versions: [0] major [1] minor [2] milli [3] micro
* @stable ICU 2.0*/
uint8_t dataVersion[4];
} UDataInfo;
@@ -264,25 +264,6 @@ udata_openChoice(const char *path, const char *type, const char *name,
U_STABLE void U_EXPORT2
udata_close(UDataMemory *pData);
-#if U_SHOW_CPLUSPLUS_API
-
-U_NAMESPACE_BEGIN
-
-/**
- * \class LocalUDataMemoryPointer
- * "Smart pointer" class, closes a UDataMemory via udata_close().
- * For most methods see the LocalPointerBase base class.
- *
- * @see LocalPointerBase
- * @see LocalPointer
- * @stable ICU 4.4
- */
-U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close);
-
-U_NAMESPACE_END
-
-#endif
-
/**
* Get the pointer to the actual data inside the data memory.
* The data is read-only.
@@ -421,17 +402,36 @@ typedef enum UDataFileAccess {
/**
* This function may be called to control how ICU loads data. It must be called
- * before any ICU data is loaded, including application data loaded with
- * ures/ResourceBundle or udata APIs. This function is not multithread safe.
+ * before any ICU data is loaded, including application data loaded with
+ * ures/ResourceBundle or udata APIs. This function is not multithread safe.
* The results of calling it while other threads are loading data are undefined.
* @param access The type of file access to be used
* @param status Error code.
* @see UDataFileAccess
- * @stable ICU 3.4
+ * @stable ICU 3.4
*/
U_STABLE void U_EXPORT2
udata_setFileAccess(UDataFileAccess access, UErrorCode *status);
U_CDECL_END
+#if U_SHOW_CPLUSPLUS_API
+
+U_NAMESPACE_BEGIN
+
+/**
+ * \class LocalUDataMemoryPointer
+ * "Smart pointer" class, closes a UDataMemory via udata_close().
+ * For most methods see the LocalPointerBase base class.
+ *
+ * @see LocalPointerBase
+ * @see LocalPointer
+ * @stable ICU 4.4
+ */
+U_DEFINE_LOCAL_OPEN_POINTER(LocalUDataMemoryPointer, UDataMemory, udata_close);
+
+U_NAMESPACE_END
+
+#endif // U_SHOW_CPLUSPLUS_API
+
#endif
diff --git a/deps/icu-small/source/common/unicode/uenum.h b/deps/icu-small/source/common/unicode/uenum.h
index eb8ecdf88b6ec5..c670eeafb1626b 100644
--- a/deps/icu-small/source/common/unicode/uenum.h
+++ b/deps/icu-small/source/common/unicode/uenum.h
@@ -30,9 +30,9 @@ U_NAMESPACE_END
/**
* \file
- * \brief C API: String Enumeration
+ * \brief C API: String Enumeration
*/
-
+
/**
* An enumeration object.
* For usage in C programs.
@@ -77,7 +77,7 @@ U_NAMESPACE_END
* U_ENUM_OUT_OF_SYNC_ERROR.
* This is a convenience function. It can end up being very
* expensive as all the items might have to be pre-fetched (depending
- * on the type of data being traversed). Use with caution and only
+ * on the type of data being traversed). Use with caution and only
* when necessary.
* @param en UEnumeration structure pointer
* @param status error code, can be U_ENUM_OUT_OF_SYNC_ERROR if the
@@ -153,7 +153,7 @@ uenum_next(UEnumeration* en,
* to start at the first element.
* @param en the iterator object
* @param status the error code, set to U_ENUM_OUT_OF_SYNC_ERROR if
- * the iterator is out of sync with its service.
+ * the iterator is out of sync with its service.
* @stable ICU 2.2
*/
U_STABLE void U_EXPORT2
diff --git a/deps/icu-small/source/common/unicode/uidna.h b/deps/icu-small/source/common/unicode/uidna.h
index cb79ba8545008e..0dafb762017441 100644
--- a/deps/icu-small/source/common/unicode/uidna.h
+++ b/deps/icu-small/source/common/unicode/uidna.h
@@ -538,7 +538,7 @@ enum {
* and are designed to be chainable, i.e., applying ToASCII or ToUnicode operations
* multiple times to an input string will yield the same result as applying the operation
* once.
- * ToUnicode(ToUnicode(ToUnicode...(ToUnicode(string)))) == ToUnicode(string)
+ * ToUnicode(ToUnicode(ToUnicode...(ToUnicode(string)))) == ToUnicode(string)
* ToASCII(ToASCII(ToASCII...(ToASCII(string))) == ToASCII(string).
*
* @param src Input UChar array containing label in Unicode.
@@ -549,18 +549,18 @@ enum {
*
* - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points
* and do not use STD3 ASCII rules
- * If unassigned code points are found the operation fails with
+ * If unassigned code points are found the operation fails with
* U_UNASSIGNED_ERROR error code.
*
* - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations
- * If this option is set, the unassigned code points are in the input
+ * If this option is set, the unassigned code points are in the input
* are treated as normal Unicode code points.
*
* - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions
- * If this option is set and the input does not satisfy STD3 rules,
+ * If this option is set and the input does not satisfy STD3 rules,
* the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR
*
- * @param parseError Pointer to UParseError struct to receive information on position
+ * @param parseError Pointer to UParseError struct to receive information on position
* of error if an error is encountered. Can be NULL.
* @param status ICU in/out error code parameter.
* U_INVALID_CHAR_FOUND if src contains
@@ -573,7 +573,7 @@ enum {
* @deprecated ICU 55 Use UTS #46 instead via uidna_openUTS46() or class IDNA.
*/
U_DEPRECATED int32_t U_EXPORT2
-uidna_toASCII(const UChar* src, int32_t srcLength,
+uidna_toASCII(const UChar* src, int32_t srcLength,
UChar* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
@@ -594,21 +594,21 @@ uidna_toASCII(const UChar* src, int32_t srcLength,
*
* - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points
* and do not use STD3 ASCII rules
- * If unassigned code points are found the operation fails with
+ * If unassigned code points are found the operation fails with
* U_UNASSIGNED_ERROR error code.
*
* - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations
- * If this option is set, the unassigned code points are in the input
- * are treated as normal Unicode code points. Note: This option is
- * required on toUnicode operation because the RFC mandates
+ * If this option is set, the unassigned code points are in the input
+ * are treated as normal Unicode code points. Note: This option is
+ * required on toUnicode operation because the RFC mandates
* verification of decoded ACE input by applying toASCII and comparing
* its output with source
*
* - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions
- * If this option is set and the input does not satisfy STD3 rules,
+ * If this option is set and the input does not satisfy STD3 rules,
* the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR
*
- * @param parseError Pointer to UParseError struct to receive information on position
+ * @param parseError Pointer to UParseError struct to receive information on position
* of error if an error is encountered. Can be NULL.
* @param status ICU in/out error code parameter.
* U_INVALID_CHAR_FOUND if src contains
@@ -630,14 +630,14 @@ uidna_toUnicode(const UChar* src, int32_t srcLength,
/**
* IDNA2003: Convenience function that implements the IDNToASCII operation as defined in the IDNA RFC.
- * This operation is done on complete domain names, e.g: "www.example.com".
- * It is important to note that this operation can fail. If it fails, then the input
+ * This operation is done on complete domain names, e.g: "www.example.com".
+ * It is important to note that this operation can fail. If it fails, then the input
* domain name cannot be used as an Internationalized Domain Name and the application
* should have methods defined to deal with the failure.
*
* Note: IDNA RFC specifies that a conformant application should divide a domain name
- * into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each,
- * and then convert. This function does not offer that level of granularity. The options once
+ * into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each,
+ * and then convert. This function does not offer that level of granularity. The options once
* set will apply to all labels in the domain name
*
* @param src Input UChar array containing IDN in Unicode.
@@ -648,18 +648,18 @@ uidna_toUnicode(const UChar* src, int32_t srcLength,
*
* - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points
* and do not use STD3 ASCII rules
- * If unassigned code points are found the operation fails with
+ * If unassigned code points are found the operation fails with
* U_UNASSIGNED_CODE_POINT_FOUND error code.
*
* - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations
- * If this option is set, the unassigned code points are in the input
+ * If this option is set, the unassigned code points are in the input
* are treated as normal Unicode code points.
*
* - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions
- * If this option is set and the input does not satisfy STD3 rules,
+ * If this option is set and the input does not satisfy STD3 rules,
* the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR
*
- * @param parseError Pointer to UParseError struct to receive information on position
+ * @param parseError Pointer to UParseError struct to receive information on position
* of error if an error is encountered. Can be NULL.
* @param status ICU in/out error code parameter.
* U_INVALID_CHAR_FOUND if src contains
@@ -680,11 +680,11 @@ uidna_IDNToASCII( const UChar* src, int32_t srcLength,
/**
* IDNA2003: Convenience function that implements the IDNToUnicode operation as defined in the IDNA RFC.
- * This operation is done on complete domain names, e.g: "www.example.com".
+ * This operation is done on complete domain names, e.g: "www.example.com".
*
* Note: IDNA RFC specifies that a conformant application should divide a domain name
- * into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each,
- * and then convert. This function does not offer that level of granularity. The options once
+ * into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each,
+ * and then convert. This function does not offer that level of granularity. The options once
* set will apply to all labels in the domain name
*
* @param src Input UChar array containing IDN in ASCII (ACE encoded) form.
@@ -695,18 +695,18 @@ uidna_IDNToASCII( const UChar* src, int32_t srcLength,
*
* - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points
* and do not use STD3 ASCII rules
- * If unassigned code points are found the operation fails with
+ * If unassigned code points are found the operation fails with
* U_UNASSIGNED_CODE_POINT_FOUND error code.
*
* - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations
- * If this option is set, the unassigned code points are in the input
+ * If this option is set, the unassigned code points are in the input
* are treated as normal Unicode code points.
*
* - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions
- * If this option is set and the input does not satisfy STD3 rules,
+ * If this option is set and the input does not satisfy STD3 rules,
* the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR
*
- * @param parseError Pointer to UParseError struct to receive information on position
+ * @param parseError Pointer to UParseError struct to receive information on position
* of error if an error is encountered. Can be NULL.
* @param status ICU in/out error code parameter.
* U_INVALID_CHAR_FOUND if src contains
@@ -728,10 +728,10 @@ uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
/**
* IDNA2003: Compare two IDN strings for equivalence.
* This function splits the domain names into labels and compares them.
- * According to IDN RFC, whenever two labels are compared, they are
- * considered equal if and only if their ASCII forms (obtained by
+ * According to IDN RFC, whenever two labels are compared, they are
+ * considered equal if and only if their ASCII forms (obtained by
* applying toASCII) match using an case-insensitive ASCII comparison.
- * Two domain names are considered a match if and only if all labels
+ * Two domain names are considered a match if and only if all labels
* match regardless of whether label separators match.
*
* @param s1 First source string.
@@ -743,15 +743,15 @@ uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
*
* - UIDNA_DEFAULT Use default options, i.e., do not process unassigned code points
* and do not use STD3 ASCII rules
- * If unassigned code points are found the operation fails with
+ * If unassigned code points are found the operation fails with
* U_UNASSIGNED_CODE_POINT_FOUND error code.
*
* - UIDNA_ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations
- * If this option is set, the unassigned code points are in the input
+ * If this option is set, the unassigned code points are in the input
* are treated as normal Unicode code points.
*
* - UIDNA_USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions
- * If this option is set and the input does not satisfy STD3 rules,
+ * If this option is set and the input does not satisfy STD3 rules,
* the operation will fail with U_IDNA_STD3_ASCII_RULES_ERROR
*
* @param status ICU error code in/out parameter.
diff --git a/deps/icu-small/source/common/unicode/uiter.h b/deps/icu-small/source/common/unicode/uiter.h
index 3b8537204cecfa..11ad75acd515c6 100644
--- a/deps/icu-small/source/common/unicode/uiter.h
+++ b/deps/icu-small/source/common/unicode/uiter.h
@@ -171,7 +171,7 @@ UCharIteratorHasNext(UCharIterator *iter);
*/
typedef UBool U_CALLCONV
UCharIteratorHasPrevious(UCharIterator *iter);
-
+
/**
* Function type declaration for UCharIterator.current().
*
diff --git a/deps/icu-small/source/common/unicode/uldnames.h b/deps/icu-small/source/common/unicode/uldnames.h
index 3a3c0a06573c36..3ebffa23db5f12 100644
--- a/deps/icu-small/source/common/unicode/uldnames.h
+++ b/deps/icu-small/source/common/unicode/uldnames.h
@@ -45,11 +45,11 @@ typedef enum {
*/
struct ULocaleDisplayNames;
-/**
- * C typedef for struct ULocaleDisplayNames.
- * @stable ICU 4.4
+/**
+ * C typedef for struct ULocaleDisplayNames.
+ * @stable ICU 4.4
*/
-typedef struct ULocaleDisplayNames ULocaleDisplayNames;
+typedef struct ULocaleDisplayNames ULocaleDisplayNames;
#if !UCONFIG_NO_FORMATTING
@@ -59,9 +59,9 @@ typedef struct ULocaleDisplayNames ULocaleDisplayNames;
* dialectHandling. The usual value for dialectHandling is
* ULOC_STANDARD_NAMES.
*
- * @param locale the display locale
- * @param dialectHandling how to select names for locales
- * @return a ULocaleDisplayNames instance
+ * @param locale the display locale
+ * @param dialectHandling how to select names for locales
+ * @return a ULocaleDisplayNames instance
* @param pErrorCode the status code
* @stable ICU 4.4
*/
@@ -103,7 +103,7 @@ U_NAMESPACE_END
* Returns the locale used to determine the display names. This is
* not necessarily the same locale passed to {@link #uldn_open}.
* @param ldn the LocaleDisplayNames instance
- * @return the display locale
+ * @return the display locale
* @stable ICU 4.4
*/
U_STABLE const char * U_EXPORT2
@@ -272,14 +272,14 @@ uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn,
* Returns an instance of LocaleDisplayNames that returns names formatted
* for the provided locale, using the provided UDisplayContext settings.
*
-* @param locale The display locale
+* @param locale The display locale
* @param contexts List of one or more context settings (e.g. for dialect
* handling, capitalization, etc.
* @param length Number of items in the contexts list
* @param pErrorCode Pointer to UErrorCode input/output status. If at entry this indicates
* a failure status, the function will do nothing; otherwise this will be
-* updated with any new status from the function.
-* @return a ULocaleDisplayNames instance
+* updated with any new status from the function.
+* @return a ULocaleDisplayNames instance
* @stable ICU 51
*/
U_STABLE ULocaleDisplayNames * U_EXPORT2
@@ -292,7 +292,7 @@ uldn_openForContext(const char * locale, UDisplayContext *contexts,
* @param type the UDisplayContextType whose value to return
* @param pErrorCode Pointer to UErrorCode input/output status. If at entry this indicates
* a failure status, the function will do nothing; otherwise this will be
-* updated with any new status from the function.
+* updated with any new status from the function.
* @return the UDisplayContextValue for the specified type.
* @stable ICU 51
*/
diff --git a/deps/icu-small/source/common/unicode/uloc.h b/deps/icu-small/source/common/unicode/uloc.h
index 5531070841187d..c45edad9e0942b 100644
--- a/deps/icu-small/source/common/unicode/uloc.h
+++ b/deps/icu-small/source/common/unicode/uloc.h
@@ -26,9 +26,9 @@
#include "unicode/utypes.h"
#include "unicode/uenum.h"
-/**
+/**
* \file
- * \brief C API: Locale
+ * \brief C API: Locale
*
* ULoc C API for Locale
* A Locale
represents a specific geographical, political,
@@ -46,9 +46,9 @@
*
* \code
* newLanguage
- *
+ *
* newLanguage + newCountry
- *
+ *
* newLanguage + newCountry + newVariant
* \endcode
*
@@ -69,7 +69,7 @@
* http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html
*
*
- * The third option requires another additional information--the
+ * The third option requires another additional information--the
* Variant.
* The Variant codes are vendor and browser-specific.
* For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX.
@@ -119,7 +119,7 @@
*
* The ICU provides a number of services that perform locale-sensitive
* operations. For example, the unum_xxx
functions format
- * numbers, currency, or percentages in a locale-sensitive manner.
+ * numbers, currency, or percentages in a locale-sensitive manner.
*
* \htmlonly\endhtmlonly
*
@@ -127,12 +127,12 @@
* UErrorCode success = U_ZERO_ERROR;
* UNumberFormat *nf;
* const char* myLocale = "fr_FR";
- *
- * nf = unum_open( UNUM_DEFAULT, NULL, success );
+ *
+ * nf = unum_open( UNUM_DEFAULT, NULL, success );
* unum_close(nf);
* nf = unum_open( UNUM_CURRENCY, NULL, success );
* unum_close(nf);
- * nf = unum_open( UNUM_PERCENT, NULL, success );
+ * nf = unum_open( UNUM_PERCENT, NULL, success );
* unum_close(nf);
* \endcode
*
@@ -141,13 +141,13 @@
* and one without; the latter using the default locale.
* \htmlonly\endhtmlonly
*
- * \code
- *
- * nf = unum_open( UNUM_DEFAULT, myLocale, success );
+ * \code
+ *
+ * nf = unum_open( UNUM_DEFAULT, myLocale, success );
* unum_close(nf);
* nf = unum_open( UNUM_CURRENCY, myLocale, success );
* unum_close(nf);
- * nf = unum_open( UNUM_PERCENT, myLocale, success );
+ * nf = unum_open( UNUM_PERCENT, myLocale, success );
* unum_close(nf);
* \endcode
*
@@ -157,7 +157,7 @@
* just a mechanism for identifying these services.
*
*
- * Each international service that performs locale-sensitive operations
+ * Each international service that performs locale-sensitive operations
* allows you
* to get all the available objects of that type. You can sift
* through these objects by language, country, or variant,
@@ -172,22 +172,22 @@
* int32_t uloc_countAvailable();
* int32_t
* uloc_getDisplayName(const char* localeID,
- * const char* inLocaleID,
+ * const char* inLocaleID,
* UChar* result,
* int32_t maxResultSize,
* UErrorCode* err);
- *
+ *
* \endcode
*
* \htmlonly
\endhtmlonly
*
- * Concerning POSIX/RFC1766 Locale IDs,
+ * Concerning POSIX/RFC1766 Locale IDs,
* the getLanguage/getCountry/getVariant/getName functions do understand
* the POSIX type form of language_COUNTRY.ENCODING\@VARIANT
* and if there is not an ICU-stype variant, uloc_getVariant() for example
* will return the one listed after the \@at sign. As well, the hyphen
* "-" is recognized as a country/variant separator similarly to RFC1766.
- * So for example, "en-us" will be interpreted as en_US.
+ * So for example, "en-us" will be interpreted as en_US.
* As a result, uloc_getName() is far from a no-op, and will have the
* effect of converting POSIX/RFC1766 IDs into ICU form, although it does
* NOT map any of the actual codes (i.e. russian->ru) in any way.
@@ -304,7 +304,7 @@
/**
* Unicode code point for '=' for assigning value to a keyword.
* @see ULOC_KEYWORD_ASSIGN
- * @stable ICU 4.6
+ * @stable ICU 4.6
*/
#define ULOC_KEYWORD_ASSIGN_UNICODE 0x3D
@@ -323,31 +323,31 @@
/**
* Constants for *_getLocale()
- * Allow user to select whether she wants information on
+ * Allow user to select whether she wants information on
* requested, valid or actual locale.
* For example, a collator for "en_US_CALIFORNIA" was
- * requested. In the current state of ICU (2.0),
+ * requested. In the current state of ICU (2.0),
* the requested locale is "en_US_CALIFORNIA",
* the valid locale is "en_US" (most specific locale supported by ICU)
- * and the actual locale is "root" (the collation data comes unmodified
+ * and the actual locale is "root" (the collation data comes unmodified
* from the UCA)
- * The locale is considered supported by ICU if there is a core ICU bundle
+ * The locale is considered supported by ICU if there is a core ICU bundle
* for that locale (although it may be empty).
* @stable ICU 2.1
*/
typedef enum {
- /** This is locale the data actually comes from
+ /** This is locale the data actually comes from
* @stable ICU 2.1
*/
ULOC_ACTUAL_LOCALE = 0,
- /** This is the most specific locale supported by ICU
+ /** This is the most specific locale supported by ICU
* @stable ICU 2.1
*/
ULOC_VALID_LOCALE = 1,
#ifndef U_HIDE_DEPRECATED_API
/** This is the requested locale
- * @deprecated ICU 2.8
+ * @deprecated ICU 2.8
*/
ULOC_REQUESTED_LOCALE = 2,
@@ -361,12 +361,12 @@ typedef enum {
#ifndef U_HIDE_SYSTEM_API
/**
- * Gets ICU's default locale.
+ * Gets ICU's default locale.
* The returned string is a snapshot in time, and will remain valid
* and unchanged even when uloc_setDefault() is called.
* The returned storage is owned by ICU, and must not be altered or deleted
* by the caller.
- *
+ *
* @return the ICU default locale
* @system
* @stable ICU 2.0
@@ -375,7 +375,7 @@ U_STABLE const char* U_EXPORT2
uloc_getDefault(void);
/**
- * Sets ICU's default locale.
+ * Sets ICU's default locale.
* By default (without calling this function), ICU's default locale will be based
* on information obtained from the underlying system environment.
*
@@ -401,11 +401,11 @@ uloc_setDefault(const char* localeID,
*
* @param localeID the locale to get the ISO language code with
* @param language the language code for localeID
- * @param languageCapacity the size of the language buffer to store the
+ * @param languageCapacity the size of the language buffer to store the
* language code with
* @param err error information if retrieving the language code failed
- * @return the actual buffer size needed for the language code. If it's greater
- * than languageCapacity, the returned language code will be truncated.
+ * @return the actual buffer size needed for the language code. If it's greater
+ * than languageCapacity, the returned language code will be truncated.
* @stable ICU 2.0
*/
U_STABLE int32_t U_EXPORT2
@@ -419,11 +419,11 @@ uloc_getLanguage(const char* localeID,
*
* @param localeID the locale to get the ISO language code with
* @param script the language code for localeID
- * @param scriptCapacity the size of the language buffer to store the
+ * @param scriptCapacity the size of the language buffer to store the
* language code with
* @param err error information if retrieving the language code failed
- * @return the actual buffer size needed for the language code. If it's greater
- * than scriptCapacity, the returned language code will be truncated.
+ * @return the actual buffer size needed for the language code. If it's greater
+ * than scriptCapacity, the returned language code will be truncated.
* @stable ICU 2.8
*/
U_STABLE int32_t U_EXPORT2
@@ -437,11 +437,11 @@ uloc_getScript(const char* localeID,
*
* @param localeID the locale to get the country code with
* @param country the country code for localeID
- * @param countryCapacity the size of the country buffer to store the
+ * @param countryCapacity the size of the country buffer to store the
* country code with
* @param err error information if retrieving the country code failed
- * @return the actual buffer size needed for the country code. If it's greater
- * than countryCapacity, the returned country code will be truncated.
+ * @return the actual buffer size needed for the country code. If it's greater
+ * than countryCapacity, the returned country code will be truncated.
* @stable ICU 2.0
*/
U_STABLE int32_t U_EXPORT2
@@ -455,11 +455,11 @@ uloc_getCountry(const char* localeID,
*
* @param localeID the locale to get the variant code with
* @param variant the variant code for localeID
- * @param variantCapacity the size of the variant buffer to store the
+ * @param variantCapacity the size of the variant buffer to store the
* variant code with
* @param err error information if retrieving the variant code failed
- * @return the actual buffer size needed for the variant code. If it's greater
- * than variantCapacity, the returned variant code will be truncated.
+ * @return the actual buffer size needed for the variant code. If it's greater
+ * than variantCapacity, the returned variant code will be truncated.
* @stable ICU 2.0
*/
U_STABLE int32_t U_EXPORT2
@@ -481,8 +481,8 @@ uloc_getVariant(const char* localeID,
* @param name fill in buffer for the name without keywords.
* @param nameCapacity capacity of the fill in buffer.
* @param err error information if retrieving the full name failed
- * @return the actual buffer size needed for the full name. If it's greater
- * than nameCapacity, the returned full name will be truncated.
+ * @return the actual buffer size needed for the full name. If it's greater
+ * than nameCapacity, the returned full name will be truncated.
* @stable ICU 2.0
*/
U_STABLE int32_t U_EXPORT2
@@ -501,11 +501,11 @@ uloc_getName(const char* localeID,
*
* @param localeID the locale to get the full name with
* @param name the full name for localeID
- * @param nameCapacity the size of the name buffer to store the
+ * @param nameCapacity the size of the name buffer to store the
* full name with
* @param err error information if retrieving the full name failed
- * @return the actual buffer size needed for the full name. If it's greater
- * than nameCapacity, the returned full name will be truncated.
+ * @return the actual buffer size needed for the full name. If it's greater
+ * than nameCapacity, the returned full name will be truncated.
* @stable ICU 2.8
*/
U_STABLE int32_t U_EXPORT2
@@ -558,11 +558,11 @@ uloc_getLCID(const char* localeID);
* inLocale would result in "Anglais", while passing Locale::getGerman()
* for inLocale would result in "Englisch".
* @param language the displayable language code for localeID
- * @param languageCapacity the size of the language buffer to store the
+ * @param languageCapacity the size of the language buffer to store the
* displayable language code with
* @param status error information if retrieving the displayable language code failed
- * @return the actual buffer size needed for the displayable language code. If it's greater
- * than languageCapacity, the returned language code will be truncated.
+ * @return the actual buffer size needed for the displayable language code. If it's greater
+ * than languageCapacity, the returned language code will be truncated.
* @stable ICU 2.0
*/
U_STABLE int32_t U_EXPORT2
@@ -581,11 +581,11 @@ uloc_getDisplayLanguage(const char* locale,
* inLocale would result in "", while passing Locale::getGerman()
* for inLocale would result in "". NULL may be used to specify the default.
* @param script the displayable script for the localeID
- * @param scriptCapacity the size of the script buffer to store the
+ * @param scriptCapacity the size of the script buffer to store the
* displayable script code with
* @param status error information if retrieving the displayable script code failed
- * @return the actual buffer size needed for the displayable script code. If it's greater
- * than scriptCapacity, the returned displayable script code will be truncated.
+ * @return the actual buffer size needed for the displayable script code. If it's greater
+ * than scriptCapacity, the returned displayable script code will be truncated.
* @stable ICU 2.8
*/
U_STABLE int32_t U_EXPORT2
@@ -606,11 +606,11 @@ uloc_getDisplayScript(const char* locale,
* inLocale would result in "Anglais", while passing Locale::getGerman()
* for inLocale would result in "Englisch". NULL may be used to specify the default.
* @param country the displayable country code for localeID
- * @param countryCapacity the size of the country buffer to store the
+ * @param countryCapacity the size of the country buffer to store the
* displayable country code with
* @param status error information if retrieving the displayable country code failed
- * @return the actual buffer size needed for the displayable country code. If it's greater
- * than countryCapacity, the returned displayable country code will be truncated.
+ * @return the actual buffer size needed for the displayable country code. If it's greater
+ * than countryCapacity, the returned displayable country code will be truncated.
* @stable ICU 2.0
*/
U_STABLE int32_t U_EXPORT2
@@ -630,11 +630,11 @@ uloc_getDisplayCountry(const char* locale,
* inLocale would result in "Anglais", while passing Locale::getGerman()
* for inLocale would result in "Englisch". NULL may be used to specify the default.
* @param variant the displayable variant code for localeID
- * @param variantCapacity the size of the variant buffer to store the
+ * @param variantCapacity the size of the variant buffer to store the
* displayable variant code with
* @param status error information if retrieving the displayable variant code failed
- * @return the actual buffer size needed for the displayable variant code. If it's greater
- * than variantCapacity, the returned displayable variant code will be truncated.
+ * @return the actual buffer size needed for the displayable variant code. If it's greater
+ * than variantCapacity, the returned displayable variant code will be truncated.
* @stable ICU 2.0
*/
U_STABLE int32_t U_EXPORT2
@@ -646,8 +646,8 @@ uloc_getDisplayVariant(const char* locale,
/**
* Gets the keyword name suitable for display for the specified locale.
- * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display
- * string for the keyword collation.
+ * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display
+ * string for the keyword collation.
* Usage:
*
* UErrorCode status = U_ZERO_ERROR;
@@ -676,11 +676,11 @@ uloc_getDisplayVariant(const char* locale,
* for inLocale would result in "Englisch". NULL may be used to specify the default.
* @param dest the buffer to which the displayable keyword should be written.
* @param destCapacity The size of the buffer (number of UChars). If it is 0, then
- * dest may be NULL and the function will only return the length of the
+ * dest may be NULL and the function will only return the length of the
* result without writing any of the result string (pre-flighting).
- * @param status error information if retrieving the displayable string failed.
+ * @param status error information if retrieving the displayable string failed.
* Should not be NULL and should not indicate failure on entry.
- * @return the actual buffer size needed for the displayable variant code.
+ * @return the actual buffer size needed for the displayable variant code.
* @see #uloc_openKeywords
* @stable ICU 2.8
*/
@@ -692,7 +692,7 @@ uloc_getDisplayKeyword(const char* keyword,
UErrorCode* status);
/**
* Gets the value of the keyword suitable for display for the specified locale.
- * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display
+ * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display
* string for PHONEBOOK, in the display locale, when "collation" is specified as the keyword.
*
* @param locale The locale to get the displayable variant code with. NULL may be used to specify the default.
@@ -703,11 +703,11 @@ uloc_getDisplayKeyword(const char* keyword,
* for inLocale would result in "Englisch". NULL may be used to specify the default.
* @param dest the buffer to which the displayable keyword should be written.
* @param destCapacity The size of the buffer (number of UChars). If it is 0, then
- * dest may be NULL and the function will only return the length of the
+ * dest may be NULL and the function will only return the length of the
* result without writing any of the result string (pre-flighting).
- * @param status error information if retrieving the displayable string failed.
+ * @param status error information if retrieving the displayable string failed.
* Should not be NULL and must not indicate failure on entry.
- * @return the actual buffer size needed for the displayable variant code.
+ * @return the actual buffer size needed for the displayable variant code.
* @stable ICU 2.8
*/
U_STABLE int32_t U_EXPORT2
@@ -726,11 +726,11 @@ uloc_getDisplayKeywordValue( const char* locale,
* inLocale would result in "Anglais", while passing Locale::getGerman()
* for inLocale would result in "Englisch". NULL may be used to specify the default.
* @param result the displayable name for localeID
- * @param maxResultSize the size of the name buffer to store the
+ * @param maxResultSize the size of the name buffer to store the
* displayable full name with
* @param err error information if retrieving the displayable name failed
- * @return the actual buffer size needed for the displayable name. If it's greater
- * than maxResultSize, the returned displayable name will be truncated.
+ * @return the actual buffer size needed for the displayable name. If it's greater
+ * than maxResultSize, the returned displayable name will be truncated.
* @stable ICU 2.0
*/
U_STABLE int32_t U_EXPORT2
@@ -742,12 +742,18 @@ uloc_getDisplayName(const char* localeID,
/**
- * Gets the specified locale from a list of all available locales.
- * The return value is a pointer to an item of
- * a locale name array. Both this array and the pointers
- * it contains are owned by ICU and should not be deleted or written through
- * by the caller. The locale name is terminated by a null pointer.
- * @param n the specific locale name index of the available locale list
+ * Gets the specified locale from a list of available locales.
+ *
+ * This method corresponds to uloc_openAvailableByType called with the
+ * ULOC_AVAILABLE_DEFAULT type argument.
+ *
+ * The return value is a pointer to an item of a locale name array. Both this
+ * array and the pointers it contains are owned by ICU and should not be
+ * deleted or written through by the caller. The locale name is terminated by
+ * a null pointer.
+ *
+ * @param n the specific locale name index of the available locale list;
+ * should not exceed the number returned by uloc_countAvailable.
* @return a specified locale name of all available locales
* @stable ICU 2.0
*/
@@ -762,6 +768,72 @@ uloc_getAvailable(int32_t n);
*/
U_STABLE int32_t U_EXPORT2 uloc_countAvailable(void);
+#ifndef U_HIDE_DRAFT_API
+
+/**
+ * Types for uloc_getAvailableByType and uloc_countAvailableByType.
+ *
+ * @draft ICU 65
+ */
+typedef enum ULocAvailableType {
+ /**
+ * Locales that return data when passed to ICU APIs,
+ * but not including legacy or alias locales.
+ *
+ * @draft ICU 65
+ */
+ ULOC_AVAILABLE_DEFAULT,
+
+ /**
+ * Legacy or alias locales that return data when passed to ICU APIs.
+ * Examples of supported legacy or alias locales:
+ *
+ * - iw (alias to he)
+ * - mo (alias to ro)
+ * - zh_CN (alias to zh_Hans_CN)
+ * - sr_BA (alias to sr_Cyrl_BA)
+ * - ars (alias to ar_SA)
+ *
+ * The locales in this set are disjoint from the ones in
+ * ULOC_AVAILABLE_DEFAULT. To get both sets at the same time, use
+ * ULOC_AVAILABLE_WITH_LEGACY_ALIASES.
+ *
+ * @draft ICU 65
+ */
+ ULOC_AVAILABLE_ONLY_LEGACY_ALIASES,
+
+ /**
+ * The union of the locales in ULOC_AVAILABLE_DEFAULT and
+ * ULOC_AVAILABLE_ONLY_LEGACY_ALIAS.
+ *
+ * @draft ICU 65
+ */
+ ULOC_AVAILABLE_WITH_LEGACY_ALIASES,
+
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ * @internal
+ */
+ ULOC_AVAILABLE_COUNT
+#endif
+} ULocAvailableType;
+
+/**
+ * Gets a list of available locales according to the type argument, allowing
+ * the user to access different sets of supported locales in ICU.
+ *
+ * The returned UEnumeration must be closed by the caller.
+ *
+ * @param type Type choice from ULocAvailableType.
+ * @param status Set if an error occurred.
+ * @return a UEnumeration owned by the caller, or nullptr on failure.
+ * @draft ICU 65
+ */
+U_DRAFT UEnumeration* U_EXPORT2
+uloc_openAvailableByType(ULocAvailableType type, UErrorCode* status);
+
+#endif // U_HIDE_DRAFT_API
+
/**
*
* Gets a list of all available 2-letter language codes defined in ISO 639,
@@ -820,16 +892,16 @@ uloc_getParent(const char* localeID,
* ICU format. It does NOT map aliased names in any way.
* See the top of this header file.
*
- * This API strips off the keyword part, so "de_DE\@collation=phonebook"
- * will become "de_DE".
+ * This API strips off the keyword part, so "de_DE\@collation=phonebook"
+ * will become "de_DE".
* This API supports preflighting.
*
* @param localeID the locale to get the full name with
* @param name fill in buffer for the name without keywords.
* @param nameCapacity capacity of the fill in buffer.
* @param err error information if retrieving the full name failed
- * @return the actual buffer size needed for the full name. If it's greater
- * than nameCapacity, the returned full name will be truncated.
+ * @return the actual buffer size needed for the full name. If it's greater
+ * than nameCapacity, the returned full name will be truncated.
* @stable ICU 2.8
*/
U_STABLE int32_t U_EXPORT2
@@ -853,7 +925,7 @@ uloc_openKeywords(const char* localeID,
/**
* Get the value for a keyword. Locale name does not need to be normalized.
- *
+ *
* @param localeID locale name containing the keyword ("de_DE@currency=EURO;collation=PHONEBOOK")
* @param keywordName name of the keyword for which we want the value; must not be
* NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive.
@@ -888,7 +960,7 @@ uloc_getKeywordValue(const char* localeID,
* @param keywordName name of the keyword to be set; must not be
* NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive.
* @param keywordValue value of the keyword to be set. If 0-length or
- * NULL, will result in the keyword being removed; no error is given if
+ * NULL, will result in the keyword being removed; no error is given if
* that keyword does not exist. Otherwise, must consist only of
* [A-Za-z0-9] and [/_+-].
* @param buffer input buffer containing well-formed locale ID to be
@@ -939,7 +1011,7 @@ typedef enum {
/**
* Get the layout character orientation for the specified locale.
- *
+ *
* @param localeId locale name
* @param status Error status
* @return an enum indicating the layout orientation for characters.
@@ -951,7 +1023,7 @@ uloc_getCharacterOrientation(const char* localeId,
/**
* Get the layout line orientation for the specified locale.
- *
+ *
* @param localeId locale name
* @param status Error status
* @return an enum indicating the layout orientation for lines.
@@ -970,7 +1042,7 @@ uloc_getLineOrientation(const char* localeId,
typedef enum {
ULOC_ACCEPT_FAILED = 0, /* No exact match was found. */
ULOC_ACCEPT_VALID = 1, /* An exact match was found. */
- ULOC_ACCEPT_FALLBACK = 2 /* A fallback was found, for example,
+ ULOC_ACCEPT_FALLBACK = 2 /* A fallback was found, for example,
Accept list contained 'ja_JP'
which matched available locale 'ja'. */
} UAcceptResult;
@@ -1009,7 +1081,7 @@ uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
* @stable ICU 3.2
*/
U_STABLE int32_t U_EXPORT2
-uloc_acceptLanguage(char *result, int32_t resultAvailable,
+uloc_acceptLanguage(char *result, int32_t resultAvailable,
UAcceptResult *outResult, const char **acceptList,
int32_t acceptListCount,
UEnumeration* availableLocales,
@@ -1025,7 +1097,7 @@ uloc_acceptLanguage(char *result, int32_t resultAvailable,
* @param localeCapacity the size of the output buffer
* @param status an error is returned if the LCID is unrecognized or the output buffer
* is too small
- * @return actual the actual size of the locale ID, not including NUL-termination
+ * @return actual the actual size of the locale ID, not including NUL-termination
* @stable ICU 3.8
*/
U_STABLE int32_t U_EXPORT2
@@ -1116,7 +1188,7 @@ uloc_minimizeSubtags(const char* localeID,
* Returns a locale ID for the specified BCP47 language tag string.
* If the specified language tag contains any ill-formed subtags,
* the first such subtag and all following subtags are ignored.
- *
+ *
* This implements the 'Language-Tag' production of BCP47, and so
* supports grandfathered (regular and irregular) as well as private
* use language tags. Private use tags are represented as 'x-whatever',
@@ -1143,8 +1215,8 @@ uloc_forLanguageTag(const char* langtag,
UErrorCode* err);
/**
- * Returns a well-formed language tag for this locale ID.
- *
+ * Returns a well-formed language tag for this locale ID.
+ *
* Note: When strict
is FALSE, any locale
* fields which do not satisfy the BCP47 syntax requirement will
* be omitted from the result. When strict
is
@@ -1180,14 +1252,14 @@ uloc_toLanguageTag(const char* localeID,
* then the pointer to the input keyword itself will be returned.
* For example,
* uloc_toUnicodeLocaleKey("ZZ")
returns "ZZ".
- *
+ *
* @param keyword the input locale keyword (either legacy key
* such as "collation" or BCP 47 Unicode locale extension
* key such as "co").
* @return the well-formed BCP 47 Unicode locale extension key,
* or NULL if the specified locale keyword cannot be
* mapped to a well-formed BCP 47 Unicode locale extension
- * key.
+ * key.
* @see uloc_toLegacyKey
* @stable ICU 54
*/
@@ -1209,7 +1281,7 @@ uloc_toUnicodeLocaleKey(const char* keyword);
* For example,
* uloc_toUnicodeLocaleType("Foo", "Bar")
returns "Bar",
* uloc_toUnicodeLocaleType("variableTop", "00A4")
returns "00A4".
- *
+ *
* @param keyword the locale keyword (either legacy key such as
* "collation" or BCP 47 Unicode locale extension
* key such as "co").
@@ -1229,7 +1301,7 @@ uloc_toUnicodeLocaleType(const char* keyword, const char* value);
* Converts the specified keyword (BCP 47 Unicode locale extension key, or
* legacy key) to the legacy key. For example, legacy key "collation" is
* returned for the input BCP 47 Unicode locale extension key "co".
- *
+ *
* @param keyword the input locale keyword (either BCP 47 Unicode locale
* extension key or legacy key).
* @return the well-formed legacy key, or NULL if the specified
diff --git a/deps/icu-small/source/common/unicode/umachine.h b/deps/icu-small/source/common/unicode/umachine.h
index 6d932cfcfb2ae4..c52984cef39566 100644
--- a/deps/icu-small/source/common/unicode/umachine.h
+++ b/deps/icu-small/source/common/unicode/umachine.h
@@ -95,7 +95,7 @@
# define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated))
/**
* \def U_ATTRIBUTE_DEPRECATED
- * This is used for Visual C++ specific attributes
+ * This is used for Visual C++ specific attributes
* @internal
*/
#elif defined(_MSC_VER) && (_MSC_VER >= 1400)
@@ -140,6 +140,42 @@
#define U_FINAL final
#endif
+// Before ICU 65, function-like, multi-statement ICU macros were just defined as
+// series of statements wrapped in { } blocks and the caller could choose to
+// either treat them as if they were actual functions and end the invocation
+// with a trailing ; creating an empty statement after the block or else omit
+// this trailing ; using the knowledge that the macro would expand to { }.
+//
+// But doing so doesn't work well with macros that look like functions and
+// compiler warnings about empty statements (ICU-20601) and ICU 65 therefore
+// switches to the standard solution of wrapping such macros in do { } while.
+//
+// This will however break existing code that depends on being able to invoke
+// these macros without a trailing ; so to be able to remain compatible with
+// such code the wrapper is itself defined as macros so that it's possible to
+// build ICU 65 and later with the old macro behaviour, like this:
+//
+// export CPPFLAGS='-DUPRV_BLOCK_MACRO_BEGIN="" -DUPRV_BLOCK_MACRO_END=""'
+// runConfigureICU ...
+//
+
+/**
+ * \def UPRV_BLOCK_MACRO_BEGIN
+ * Defined as the "do" keyword by default.
+ * @internal
+ */
+#ifndef UPRV_BLOCK_MACRO_BEGIN
+#define UPRV_BLOCK_MACRO_BEGIN do
+#endif
+
+/**
+ * \def UPRV_BLOCK_MACRO_END
+ * Defined as "while (FALSE)" by default.
+ * @internal
+ */
+#ifndef UPRV_BLOCK_MACRO_END
+#define UPRV_BLOCK_MACRO_END while (FALSE)
+#endif
/*==========================================================================*/
/* limits for int32_t etc., like in POSIX inttypes.h */
@@ -392,7 +428,7 @@ typedef int32_t UChar32;
* This value is intended for sentinel values for APIs that
* (take or) return single code points (UChar32).
* It is outside of the Unicode code point range 0..0x10ffff.
- *
+ *
* For example, a "done" or "error" value in a new API
* could be indicated with U_SENTINEL.
*
diff --git a/deps/icu-small/source/common/unicode/umisc.h b/deps/icu-small/source/common/unicode/umisc.h
index a46fa323c8c1a3..213290b9afa33c 100644
--- a/deps/icu-small/source/common/unicode/umisc.h
+++ b/deps/icu-small/source/common/unicode/umisc.h
@@ -21,29 +21,29 @@
/**
* \file
- * \brief C API:misc definitions
+ * \brief C API:misc definitions
*
- * This file contains miscellaneous definitions for the C APIs.
+ * This file contains miscellaneous definitions for the C APIs.
*/
U_CDECL_BEGIN
-/** A struct representing a range of text containing a specific field
+/** A struct representing a range of text containing a specific field
* @stable ICU 2.0
*/
typedef struct UFieldPosition {
/**
- * The field
+ * The field
* @stable ICU 2.0
*/
int32_t field;
/**
- * The start of the text range containing field
+ * The start of the text range containing field
* @stable ICU 2.0
*/
int32_t beginIndex;
- /**
- * The limit of the text range containing field
+ /**
+ * The limit of the text range containing field
* @stable ICU 2.0
*/
int32_t endIndex;
diff --git a/deps/icu-small/source/common/unicode/umutablecptrie.h b/deps/icu-small/source/common/unicode/umutablecptrie.h
index e75191a4495209..13e71ef25e8c87 100644
--- a/deps/icu-small/source/common/unicode/umutablecptrie.h
+++ b/deps/icu-small/source/common/unicode/umutablecptrie.h
@@ -9,8 +9,6 @@
#include "unicode/utypes.h"
-#ifndef U_HIDE_DRAFT_API
-
#include "unicode/localpointer.h"
#include "unicode/ucpmap.h"
#include "unicode/ucptrie.h"
@@ -44,7 +42,7 @@ U_CDECL_BEGIN
*
* @see UCPTrie
* @see umutablecptrie_buildImmutable
- * @draft ICU 63
+ * @stable ICU 63
*/
typedef struct UMutableCPTrie UMutableCPTrie;
@@ -59,7 +57,7 @@ typedef struct UMutableCPTrie UMutableCPTrie;
* @param errorValue the value for out-of-range code points and ill-formed UTF-8/16
* @param pErrorCode an in/out ICU UErrorCode
* @return the trie
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI UMutableCPTrie * U_EXPORT2
umutablecptrie_open(uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode);
@@ -71,7 +69,7 @@ umutablecptrie_open(uint32_t initialValue, uint32_t errorValue, UErrorCode *pErr
* @param other the trie to clone
* @param pErrorCode an in/out ICU UErrorCode
* @return the trie clone
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI UMutableCPTrie * U_EXPORT2
umutablecptrie_clone(const UMutableCPTrie *other, UErrorCode *pErrorCode);
@@ -80,7 +78,7 @@ umutablecptrie_clone(const UMutableCPTrie *other, UErrorCode *pErrorCode);
* Closes a mutable trie and releases associated memory.
*
* @param trie the trie
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI void U_EXPORT2
umutablecptrie_close(UMutableCPTrie *trie);
@@ -96,7 +94,7 @@ U_NAMESPACE_BEGIN
*
* @see LocalPointerBase
* @see LocalPointer
- * @draft ICU 63
+ * @stable ICU 63
*/
U_DEFINE_LOCAL_OPEN_POINTER(LocalUMutableCPTriePointer, UMutableCPTrie, umutablecptrie_close);
@@ -111,7 +109,7 @@ U_NAMESPACE_END
* @param map the source map
* @param pErrorCode an in/out ICU UErrorCode
* @return the mutable trie
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI UMutableCPTrie * U_EXPORT2
umutablecptrie_fromUCPMap(const UCPMap *map, UErrorCode *pErrorCode);
@@ -123,7 +121,7 @@ umutablecptrie_fromUCPMap(const UCPMap *map, UErrorCode *pErrorCode);
* @param trie the immutable trie
* @param pErrorCode an in/out ICU UErrorCode
* @return the mutable trie
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI UMutableCPTrie * U_EXPORT2
umutablecptrie_fromUCPTrie(const UCPTrie *trie, UErrorCode *pErrorCode);
@@ -134,7 +132,7 @@ umutablecptrie_fromUCPTrie(const UCPTrie *trie, UErrorCode *pErrorCode);
* @param trie the trie
* @param c the code point
* @return the value
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI uint32_t U_EXPORT2
umutablecptrie_get(const UMutableCPTrie *trie, UChar32 c);
@@ -166,7 +164,7 @@ umutablecptrie_get(const UMutableCPTrie *trie, UChar32 c);
* may have been modified by filter(context, trie value)
* if that function pointer is not NULL
* @return the range end code point, or -1 if start is not a valid code point
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI UChar32 U_EXPORT2
umutablecptrie_getRange(const UMutableCPTrie *trie, UChar32 start,
@@ -180,7 +178,7 @@ umutablecptrie_getRange(const UMutableCPTrie *trie, UChar32 start,
* @param c the code point
* @param value the value
* @param pErrorCode an in/out ICU UErrorCode
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI void U_EXPORT2
umutablecptrie_set(UMutableCPTrie *trie, UChar32 c, uint32_t value, UErrorCode *pErrorCode);
@@ -194,7 +192,7 @@ umutablecptrie_set(UMutableCPTrie *trie, UChar32 c, uint32_t value, UErrorCode *
* @param end the last code point to get the value (inclusive)
* @param value the value
* @param pErrorCode an in/out ICU UErrorCode
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI void U_EXPORT2
umutablecptrie_setRange(UMutableCPTrie *trie,
@@ -229,7 +227,7 @@ umutablecptrie_setRange(UMutableCPTrie *trie,
* @param pErrorCode an in/out ICU UErrorCode
*
* @see umutablecptrie_fromUCPTrie
- * @draft ICU 63
+ * @stable ICU 63
*/
U_CAPI UCPTrie * U_EXPORT2
umutablecptrie_buildImmutable(UMutableCPTrie *trie, UCPTrieType type, UCPTrieValueWidth valueWidth,
@@ -237,5 +235,4 @@ umutablecptrie_buildImmutable(UMutableCPTrie *trie, UCPTrieType type, UCPTrieVal
U_CDECL_END
-#endif // U_HIDE_DRAFT_API
#endif
diff --git a/deps/icu-small/source/common/unicode/unifilt.h b/deps/icu-small/source/common/unicode/unifilt.h
index 99cce785b6eec8..420e1a190564f0 100644
--- a/deps/icu-small/source/common/unicode/unifilt.h
+++ b/deps/icu-small/source/common/unicode/unifilt.h
@@ -12,11 +12,15 @@
#ifndef UNIFILT_H
#define UNIFILT_H
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/unifunct.h"
#include "unicode/unimatch.h"
/**
- * \file
+ * \file
* \brief C++ API: Unicode Filter
*/
@@ -67,6 +71,14 @@ class U_COMMON_API UnicodeFilter : public UnicodeFunctor, public UnicodeMatcher
*/
virtual ~UnicodeFilter();
+ /**
+ * Clones this object polymorphically.
+ * The caller owns the result and should delete it when done.
+ * @return clone, or nullptr if an error occurred
+ * @stable ICU 2.4
+ */
+ virtual UnicodeFilter* clone() const = 0;
+
/**
* Returns true for characters that are in the selected
* subset. In other words, if a character is to be
@@ -119,4 +131,6 @@ class U_COMMON_API UnicodeFilter : public UnicodeFunctor, public UnicodeMatcher
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/unifunct.h b/deps/icu-small/source/common/unicode/unifunct.h
index 66a02ce7cd5ce8..7d31af7dafb772 100644
--- a/deps/icu-small/source/common/unicode/unifunct.h
+++ b/deps/icu-small/source/common/unicode/unifunct.h
@@ -13,13 +13,16 @@
#define UNIFUNCT_H
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
/**
- * \file
+ * \file
* \brief C++ API: Unicode Functor
*/
-
+
U_NAMESPACE_BEGIN
class UnicodeMatcher;
@@ -124,4 +127,6 @@ class U_COMMON_API UnicodeFunctor : public UObject {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/unimatch.h b/deps/icu-small/source/common/unicode/unimatch.h
index 8bf39950187b1b..5a192b1b427da4 100644
--- a/deps/icu-small/source/common/unicode/unimatch.h
+++ b/deps/icu-small/source/common/unicode/unimatch.h
@@ -13,10 +13,11 @@
#include "unicode/utypes.h"
/**
- * \file
+ * \file
* \brief C++ API: Unicode Matcher
*/
+#if U_SHOW_CPLUSPLUS_API
U_NAMESPACE_BEGIN
@@ -38,7 +39,7 @@ enum UMatchDegree {
* @stable ICU 2.4
*/
U_MISMATCH,
-
+
/**
* Constant returned by matches()
indicating a
* partial match between the text and this matcher. This value is
@@ -50,7 +51,7 @@ enum UMatchDegree {
* @stable ICU 2.4
*/
U_PARTIAL_MATCH,
-
+
/**
* Constant returned by matches()
indicating a
* complete match between the text and this matcher. For an
@@ -84,7 +85,7 @@ class U_COMMON_API UnicodeMatcher /* not : public UObject because this is an int
* Matching in the forward direction is indicated by limit >
* offset. Characters from offset forwards to limit-1 will be
* considered for matching.
- *
+ *
* Matching in the reverse direction is indicated by limit <
* offset. Characters from offset backwards to limit+1 will be
* considered for matching.
@@ -162,4 +163,6 @@ class U_COMMON_API UnicodeMatcher /* not : public UObject because this is an int
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/uniset.h b/deps/icu-small/source/common/unicode/uniset.h
index e5e7726d604a73..974231100353f5 100644
--- a/deps/icu-small/source/common/unicode/uniset.h
+++ b/deps/icu-small/source/common/unicode/uniset.h
@@ -13,6 +13,10 @@
#ifndef UNICODESET_H
#define UNICODESET_H
+#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/ucpmap.h"
#include "unicode/unifilt.h"
#include "unicode/unistr.h"
@@ -261,7 +265,7 @@ class RuleCharacterIterator;
*
*
* \htmlonly\endhtmlonly
- *
+ *
* Note:
* - Most UnicodeSet methods do not take a UErrorCode parameter because
* there are usually very few opportunities for failure other than a shortage
@@ -501,7 +505,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter {
* @see cloneAsThawed
* @stable ICU 2.0
*/
- virtual UnicodeFunctor* clone() const;
+ virtual UnicodeSet* clone() const;
/**
* Returns the hash code value for this set.
@@ -531,7 +535,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter {
* @stable ICU 4.2
*/
inline static const UnicodeSet *fromUSet(const USet *uset);
-
+
/**
* Produce a USet * pointer for this UnicodeSet.
* USet is the plain C type for UnicodeSet
@@ -579,7 +583,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter {
* @see cloneAsThawed
* @stable ICU 3.8
*/
- UnicodeFunctor *freeze();
+ UnicodeSet *freeze();
/**
* Clone the set and make the clone mutable.
@@ -589,7 +593,7 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter {
* @see isFrozen
* @stable ICU 3.8
*/
- UnicodeFunctor *cloneAsThawed() const;
+ UnicodeSet *cloneAsThawed() const;
//----------------------------------------------------------------
// Public API
@@ -1651,11 +1655,10 @@ class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter {
const UnicodeSet* inclusions,
UErrorCode &status);
-#ifndef U_HIDE_DRAFT_API // Skipped: ucpmap.h is draft only.
+ // UCPMap is now stable ICU 63
void applyIntPropertyValue(const UCPMap *map,
UCPMapValueFilter *filter, const void *context,
UErrorCode &errorCode);
-#endif /* U_HIDE_DRAFT_API */
/**
* Set the new pattern to cache.
@@ -1736,4 +1739,6 @@ inline int32_t UnicodeSet::spanBack(const UnicodeString &s, int32_t limit, USetS
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/unistr.h b/deps/icu-small/source/common/unicode/unistr.h
index 8fd144425e87c0..da79053765acf6 100644
--- a/deps/icu-small/source/common/unicode/unistr.h
+++ b/deps/icu-small/source/common/unicode/unistr.h
@@ -28,8 +28,11 @@
* \brief C++ API: Unicode String
*/
-#include
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
+#include
#include "unicode/char16ptr.h"
#include "unicode/rep.h"
#include "unicode/std_string.h"
@@ -209,7 +212,9 @@ class UnicodeStringAppendable; // unicode/appendable.h
* similar functionality as the Java String and StringBuffer/StringBuilder classes.
* It is a concrete implementation of the abstract class Replaceable (for transliteration).
*
- * A UnicodeString may also "alias" an external array of characters
+ * The UnicodeString equivalent of std::string’s clear() is remove().
+ *
+ * A UnicodeString may "alias" an external array of characters
* (that is, point to it, rather than own the array)
* whose lifetime must then at least match the lifetime of the aliasing object.
* This aliasing may be preserved when returning a UnicodeString by value,
@@ -2092,8 +2097,7 @@ class U_COMMON_API UnicodeString : public Replaceable
* s.truncate(0); // set to an empty string (complete truncation), or
* s=UnicodeString(); // assign an empty string, or
* s.setTo((UChar32)-1); // set to a pseudo code point that is out of range, or
- * static const char16_t nul=0;
- * s.setTo(&nul, 0); // set to an empty C Unicode string
+ * s.setTo(u"", 0); // set to an empty C Unicode string
* }
* \endcode
*
@@ -2534,11 +2538,14 @@ class U_COMMON_API UnicodeString : public Replaceable
/* Remove operations */
/**
- * Remove all characters from the UnicodeString object.
+ * Removes all characters from the UnicodeString object and clears the bogus flag.
+ * This is the UnicodeString equivalent of std::string’s clear().
+ *
* @return a reference to this
+ * @see setToBogus
* @stable ICU 2.0
*/
- inline UnicodeString& remove(void);
+ inline UnicodeString& remove();
/**
* Remove the characters in the range
@@ -3034,11 +3041,11 @@ class U_COMMON_API UnicodeString : public Replaceable
* uint16_t * constructor.
* Delegates to UnicodeString(const char16_t *, int32_t).
* @param text UTF-16 string
- * @param length string length
+ * @param textLength string length
* @stable ICU 59
*/
- UnicodeString(const uint16_t *text, int32_t length) :
- UnicodeString(ConstChar16Ptr(text), length) {}
+ UnicodeString(const uint16_t *text, int32_t textLength) :
+ UnicodeString(ConstChar16Ptr(text), textLength) {}
#endif
#if U_SIZEOF_WCHAR_T==2 || defined(U_IN_DOXYGEN)
@@ -3047,21 +3054,21 @@ class U_COMMON_API UnicodeString : public Replaceable
* (Only defined if U_SIZEOF_WCHAR_T==2.)
* Delegates to UnicodeString(const char16_t *, int32_t).
* @param text NUL-terminated UTF-16 string
- * @param length string length
+ * @param textLength string length
* @stable ICU 59
*/
- UnicodeString(const wchar_t *text, int32_t length) :
- UnicodeString(ConstChar16Ptr(text), length) {}
+ UnicodeString(const wchar_t *text, int32_t textLength) :
+ UnicodeString(ConstChar16Ptr(text), textLength) {}
#endif
/**
* nullptr_t constructor.
* Effectively the same as the default constructor, makes an empty string object.
* @param text nullptr
- * @param length ignored
+ * @param textLength ignored
* @stable ICU 59
*/
- inline UnicodeString(const std::nullptr_t text, int32_t length);
+ inline UnicodeString(const std::nullptr_t text, int32_t textLength);
/**
* Readonly-aliasing char16_t* constructor.
@@ -3266,13 +3273,13 @@ class U_COMMON_API UnicodeString : public Replaceable
* }
* \endcode
* @param src String using only invariant characters.
- * @param length Length of src, or -1 if NUL-terminated.
+ * @param textLength Length of src, or -1 if NUL-terminated.
* @param inv Signature-distinguishing paramater, use US_INV.
*
* @see US_INV
* @stable ICU 3.2
*/
- UnicodeString(const char *src, int32_t length, enum EInvariant inv);
+ UnicodeString(const char *src, int32_t textLength, enum EInvariant inv);
/**
@@ -3323,9 +3330,6 @@ class U_COMMON_API UnicodeString : public Replaceable
* Clones can be used concurrently in multiple threads.
* If a subclass does not implement clone(), or if an error occurs,
* then NULL is returned.
- * The clone functions in all subclasses return a pointer to a Replaceable
- * because some compilers do not support covariant (same-as-this)
- * return types; cast to the appropriate subclass if necessary.
* The caller must delete the clone.
*
* @return a clone of this object
@@ -3334,7 +3338,7 @@ class U_COMMON_API UnicodeString : public Replaceable
* @see getDynamicClassID
* @stable ICU 2.6
*/
- virtual Replaceable *clone() const;
+ virtual UnicodeString *clone() const;
/** Destructor.
* @stable ICU 2.0
@@ -4748,4 +4752,6 @@ UnicodeString::reverse(int32_t start,
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/unorm.h b/deps/icu-small/source/common/unicode/unorm.h
index 3839de129573c1..09dd366a968c1b 100644
--- a/deps/icu-small/source/common/unicode/unorm.h
+++ b/deps/icu-small/source/common/unicode/unorm.h
@@ -131,6 +131,8 @@
// Do not conditionalize the following enum with #ifndef U_HIDE_DEPRECATED_API,
// it is needed for layout of Normalizer object.
+#ifndef U_FORCE_HIDE_DEPRECATED_API
+
/**
* Constants for normalization modes.
* @deprecated ICU 56 Use unorm2.h instead.
@@ -155,6 +157,8 @@ typedef enum {
UNORM_MODE_COUNT
} UNormalizationMode;
+#endif // U_FORCE_HIDE_DEPRECATED_API
+
#ifndef U_HIDE_DEPRECATED_API
/**
diff --git a/deps/icu-small/source/common/unicode/uobject.h b/deps/icu-small/source/common/unicode/uobject.h
index 53b8eb005f4cc0..eeb331ce973cf0 100644
--- a/deps/icu-small/source/common/unicode/uobject.h
+++ b/deps/icu-small/source/common/unicode/uobject.h
@@ -20,6 +20,9 @@
#define __UOBJECT_H__
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/platform.h"
/**
@@ -34,16 +37,16 @@
* Previously, define this to define the throw() specification so
* certain functions do not throw any exceptions
*
- * UMemory operator new methods should have the throw() specification
- * appended to them, so that the compiler adds the additional NULL check
- * before calling constructors. Without, if operator new
returns NULL the
- * constructor is still called, and if the constructor references member
+ * UMemory operator new methods should have the throw() specification
+ * appended to them, so that the compiler adds the additional NULL check
+ * before calling constructors. Without, if operator new
returns NULL the
+ * constructor is still called, and if the constructor references member
* data, (which it typically does), the result is a segmentation violation.
*
* @stable ICU 4.2. Since ICU 64, Use U_NOEXCEPT instead. See ICU-20422.
*/
#ifndef U_NO_THROW
-#define U_NO_THROW throw()
+#define U_NO_THROW U_NOEXCEPT
#endif
/*===========================================================================*/
@@ -113,7 +116,7 @@ class U_COMMON_API UMemory {
public:
/* test versions for debugging shaper heap memory problems */
-#ifdef SHAPER_MEMORY_DEBUG
+#ifdef SHAPER_MEMORY_DEBUG
static void * NewArray(int size, int count);
static void * GrowArray(void * array, int newSize );
static void FreeArray(void * array );
@@ -172,19 +175,19 @@ class U_COMMON_API UMemory {
#if U_HAVE_DEBUG_LOCATION_NEW
/**
* This method overrides the MFC debug version of the operator new
- *
+ *
* @param size The requested memory size
* @param file The file where the allocation was requested
- * @param line The line where the allocation was requested
- */
+ * @param line The line where the allocation was requested
+ */
static void * U_EXPORT2 operator new(size_t size, const char* file, int line) U_NOEXCEPT;
/**
* This method provides a matching delete for the MFC debug new
- *
+ *
* @param p The pointer to the allocated memory
* @param file The file where the allocation was requested
- * @param line The line where the allocation was requested
- */
+ * @param line The line where the allocation was requested
+ */
static void U_EXPORT2 operator delete(void* p, const char* file, int line) U_NOEXCEPT;
#endif /* U_HAVE_DEBUG_LOCATION_NEW */
#endif /* U_OVERRIDE_CXX_ALLOCATION */
@@ -212,11 +215,8 @@ class U_COMMON_API UMemory {
* The clone() function is not available in UObject because it is not
* implemented by all ICU classes.
* Many ICU services provide a clone() function for their class trees,
- * defined on the service's C++ base class, and all subclasses within that
- * service class tree return a pointer to the service base class
+ * defined on the service's C++ base class
* (which itself is a subclass of UObject).
- * This is because some compilers do not support covariant (same-as-this)
- * return types; cast to the appropriate subclass if necessary.
*
* @stable ICU 2.2
*/
@@ -319,4 +319,6 @@ class U_COMMON_API UObject : public UMemory {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/urename.h b/deps/icu-small/source/common/unicode/urename.h
index eaf56c9614d7f2..e302bf0976e01d 100644
--- a/deps/icu-small/source/common/unicode/urename.h
+++ b/deps/icu-small/source/common/unicode/urename.h
@@ -193,10 +193,13 @@
#define res_getAlias U_ICU_ENTRY_POINT_RENAME(res_getAlias)
#define res_getArrayItem U_ICU_ENTRY_POINT_RENAME(res_getArrayItem)
#define res_getBinary U_ICU_ENTRY_POINT_RENAME(res_getBinary)
+#define res_getBinaryNoTrace U_ICU_ENTRY_POINT_RENAME(res_getBinaryNoTrace)
#define res_getIntVector U_ICU_ENTRY_POINT_RENAME(res_getIntVector)
+#define res_getIntVectorNoTrace U_ICU_ENTRY_POINT_RENAME(res_getIntVectorNoTrace)
#define res_getPublicType U_ICU_ENTRY_POINT_RENAME(res_getPublicType)
#define res_getResource U_ICU_ENTRY_POINT_RENAME(res_getResource)
#define res_getString U_ICU_ENTRY_POINT_RENAME(res_getString)
+#define res_getStringNoTrace U_ICU_ENTRY_POINT_RENAME(res_getStringNoTrace)
#define res_getTableItemByIndex U_ICU_ENTRY_POINT_RENAME(res_getTableItemByIndex)
#define res_getTableItemByKey U_ICU_ENTRY_POINT_RENAME(res_getTableItemByKey)
#define res_load U_ICU_ENTRY_POINT_RENAME(res_load)
@@ -523,6 +526,7 @@
#define ucal_getDefaultTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getDefaultTimeZone)
#define ucal_getFieldDifference U_ICU_ENTRY_POINT_RENAME(ucal_getFieldDifference)
#define ucal_getGregorianChange U_ICU_ENTRY_POINT_RENAME(ucal_getGregorianChange)
+#define ucal_getHostTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_getHostTimeZone)
#define ucal_getKeywordValuesForLocale U_ICU_ENTRY_POINT_RENAME(ucal_getKeywordValuesForLocale)
#define ucal_getLimit U_ICU_ENTRY_POINT_RENAME(ucal_getLimit)
#define ucal_getLocaleByType U_ICU_ENTRY_POINT_RENAME(ucal_getLocaleByType)
@@ -575,7 +579,6 @@
#define ucasemap_getLocale U_ICU_ENTRY_POINT_RENAME(ucasemap_getLocale)
#define ucasemap_getOptions U_ICU_ENTRY_POINT_RENAME(ucasemap_getOptions)
#define ucasemap_internalUTF8ToTitle U_ICU_ENTRY_POINT_RENAME(ucasemap_internalUTF8ToTitle)
-#define ucasemap_mapUTF8 U_ICU_ENTRY_POINT_RENAME(ucasemap_mapUTF8)
#define ucasemap_open U_ICU_ENTRY_POINT_RENAME(ucasemap_open)
#define ucasemap_setBreakIterator U_ICU_ENTRY_POINT_RENAME(ucasemap_setBreakIterator)
#define ucasemap_setLocale U_ICU_ENTRY_POINT_RENAME(ucasemap_setLocale)
@@ -930,16 +933,9 @@
#define ufieldpositer_close U_ICU_ENTRY_POINT_RENAME(ufieldpositer_close)
#define ufieldpositer_next U_ICU_ENTRY_POINT_RENAME(ufieldpositer_next)
#define ufieldpositer_open U_ICU_ENTRY_POINT_RENAME(ufieldpositer_open)
-#define ufile_close_translit U_ICU_ENTRY_POINT_RENAME(ufile_close_translit)
-#define ufile_fill_uchar_buffer U_ICU_ENTRY_POINT_RENAME(ufile_fill_uchar_buffer)
-#define ufile_flush_io U_ICU_ENTRY_POINT_RENAME(ufile_flush_io)
-#define ufile_flush_translit U_ICU_ENTRY_POINT_RENAME(ufile_flush_translit)
#define ufile_getch U_ICU_ENTRY_POINT_RENAME(ufile_getch)
#define ufile_getch32 U_ICU_ENTRY_POINT_RENAME(ufile_getch32)
-#define ufmt_64tou U_ICU_ENTRY_POINT_RENAME(ufmt_64tou)
#define ufmt_close U_ICU_ENTRY_POINT_RENAME(ufmt_close)
-#define ufmt_defaultCPToUnicode U_ICU_ENTRY_POINT_RENAME(ufmt_defaultCPToUnicode)
-#define ufmt_digitvalue U_ICU_ENTRY_POINT_RENAME(ufmt_digitvalue)
#define ufmt_getArrayItemByIndex U_ICU_ENTRY_POINT_RENAME(ufmt_getArrayItemByIndex)
#define ufmt_getArrayLength U_ICU_ENTRY_POINT_RENAME(ufmt_getArrayLength)
#define ufmt_getDate U_ICU_ENTRY_POINT_RENAME(ufmt_getDate)
@@ -951,11 +947,7 @@
#define ufmt_getType U_ICU_ENTRY_POINT_RENAME(ufmt_getType)
#define ufmt_getUChars U_ICU_ENTRY_POINT_RENAME(ufmt_getUChars)
#define ufmt_isNumeric U_ICU_ENTRY_POINT_RENAME(ufmt_isNumeric)
-#define ufmt_isdigit U_ICU_ENTRY_POINT_RENAME(ufmt_isdigit)
#define ufmt_open U_ICU_ENTRY_POINT_RENAME(ufmt_open)
-#define ufmt_ptou U_ICU_ENTRY_POINT_RENAME(ufmt_ptou)
-#define ufmt_uto64 U_ICU_ENTRY_POINT_RENAME(ufmt_uto64)
-#define ufmt_utop U_ICU_ENTRY_POINT_RENAME(ufmt_utop)
#define ufmtval_getString U_ICU_ENTRY_POINT_RENAME(ufmtval_getString)
#define ufmtval_nextPosition U_ICU_ENTRY_POINT_RENAME(ufmtval_nextPosition)
#define ugender_getInstance U_ICU_ENTRY_POINT_RENAME(ugender_getInstance)
@@ -1103,6 +1095,7 @@
#define uloc_getVariant U_ICU_ENTRY_POINT_RENAME(uloc_getVariant)
#define uloc_isRightToLeft U_ICU_ENTRY_POINT_RENAME(uloc_isRightToLeft)
#define uloc_minimizeSubtags U_ICU_ENTRY_POINT_RENAME(uloc_minimizeSubtags)
+#define uloc_openAvailableByType U_ICU_ENTRY_POINT_RENAME(uloc_openAvailableByType)
#define uloc_openKeywordList U_ICU_ENTRY_POINT_RENAME(uloc_openKeywordList)
#define uloc_openKeywords U_ICU_ENTRY_POINT_RENAME(uloc_openKeywords)
#define uloc_setDefault U_ICU_ENTRY_POINT_RENAME(uloc_setDefault)
@@ -1159,9 +1152,6 @@
#define umsg_toPattern U_ICU_ENTRY_POINT_RENAME(umsg_toPattern)
#define umsg_vformat U_ICU_ENTRY_POINT_RENAME(umsg_vformat)
#define umsg_vparse U_ICU_ENTRY_POINT_RENAME(umsg_vparse)
-#define umtx_condBroadcast U_ICU_ENTRY_POINT_RENAME(umtx_condBroadcast)
-#define umtx_condSignal U_ICU_ENTRY_POINT_RENAME(umtx_condSignal)
-#define umtx_condWait U_ICU_ENTRY_POINT_RENAME(umtx_condWait)
#define umtx_lock U_ICU_ENTRY_POINT_RENAME(umtx_lock)
#define umtx_unlock U_ICU_ENTRY_POINT_RENAME(umtx_unlock)
#define umutablecptrie_buildImmutable U_ICU_ENTRY_POINT_RENAME(umutablecptrie_buildImmutable)
@@ -1327,7 +1317,6 @@
#define uprv_decNumberAbs U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAbs)
#define uprv_decNumberAdd U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAdd)
#define uprv_decNumberAnd U_ICU_ENTRY_POINT_RENAME(uprv_decNumberAnd)
-#define uprv_decNumberClass U_ICU_ENTRY_POINT_RENAME(uprv_decNumberClass)
#define uprv_decNumberClassToString U_ICU_ENTRY_POINT_RENAME(uprv_decNumberClassToString)
#define uprv_decNumberCompare U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompare)
#define uprv_decNumberCompareSignal U_ICU_ENTRY_POINT_RENAME(uprv_decNumberCompareSignal)
@@ -1393,6 +1382,7 @@
#define uprv_dlsym_func U_ICU_ENTRY_POINT_RENAME(uprv_dlsym_func)
#define uprv_eastrncpy U_ICU_ENTRY_POINT_RENAME(uprv_eastrncpy)
#define uprv_ebcdicFromAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicFromAscii)
+#define uprv_ebcdicToAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicToAscii)
#define uprv_ebcdicToLowercaseAscii U_ICU_ENTRY_POINT_RENAME(uprv_ebcdicToLowercaseAscii)
#define uprv_ebcdictolower U_ICU_ENTRY_POINT_RENAME(uprv_ebcdictolower)
#define uprv_fabs U_ICU_ENTRY_POINT_RENAME(uprv_fabs)
@@ -1412,6 +1402,7 @@
#define uprv_getUTCtime U_ICU_ENTRY_POINT_RENAME(uprv_getUTCtime)
#define uprv_int32Comparator U_ICU_ENTRY_POINT_RENAME(uprv_int32Comparator)
#define uprv_isASCIILetter U_ICU_ENTRY_POINT_RENAME(uprv_isASCIILetter)
+#define uprv_isEbcdicAtSign U_ICU_ENTRY_POINT_RENAME(uprv_isEbcdicAtSign)
#define uprv_isInfinite U_ICU_ENTRY_POINT_RENAME(uprv_isInfinite)
#define uprv_isInvariantString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantString)
#define uprv_isInvariantUString U_ICU_ENTRY_POINT_RENAME(uprv_isInvariantUString)
@@ -1579,6 +1570,7 @@
#define ures_getUTF8String U_ICU_ENTRY_POINT_RENAME(ures_getUTF8String)
#define ures_getUTF8StringByIndex U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByIndex)
#define ures_getUTF8StringByKey U_ICU_ENTRY_POINT_RENAME(ures_getUTF8StringByKey)
+#define ures_getValueWithFallback U_ICU_ENTRY_POINT_RENAME(ures_getValueWithFallback)
#define ures_getVersion U_ICU_ENTRY_POINT_RENAME(ures_getVersion)
#define ures_getVersionByKey U_ICU_ENTRY_POINT_RENAME(ures_getVersionByKey)
#define ures_getVersionNumber U_ICU_ENTRY_POINT_RENAME(ures_getVersionNumber)
diff --git a/deps/icu-small/source/common/unicode/urep.h b/deps/icu-small/source/common/unicode/urep.h
index c54ba7c4661414..932202ddb04b1c 100644
--- a/deps/icu-small/source/common/unicode/urep.h
+++ b/deps/icu-small/source/common/unicode/urep.h
@@ -88,7 +88,7 @@ typedef struct UReplaceableCallbacks {
*/
UChar32 (*char32At)(const UReplaceable* rep,
int32_t offset);
-
+
/**
* Function pointer that replaces text between start and limit in
* this text with the given text. Attributes (out of band info)
@@ -110,7 +110,7 @@ typedef struct UReplaceableCallbacks {
int32_t limit,
const UChar* text,
int32_t textLength);
-
+
/**
* Function pointer that copies the characters in the range
* [start, limit) into the array dst.
@@ -148,7 +148,7 @@ typedef struct UReplaceableCallbacks {
void (*copy)(UReplaceable* rep,
int32_t start,
int32_t limit,
- int32_t dest);
+ int32_t dest);
} UReplaceableCallbacks;
diff --git a/deps/icu-small/source/common/unicode/uset.h b/deps/icu-small/source/common/unicode/uset.h
index ef6bbb5c38f3fb..18482c10e73844 100644
--- a/deps/icu-small/source/common/unicode/uset.h
+++ b/deps/icu-small/source/common/unicode/uset.h
@@ -57,7 +57,7 @@ enum {
* Ignore white space within patterns unless quoted or escaped.
* @stable ICU 2.4
*/
- USET_IGNORE_SPACE = 1,
+ USET_IGNORE_SPACE = 1,
/**
* Enable case insensitive matching. E.g., "[ab]" with this flag
@@ -85,7 +85,7 @@ enum {
*
* @stable ICU 2.4
*/
- USET_CASE_INSENSITIVE = 2,
+ USET_CASE_INSENSITIVE = 2,
/**
* Enable case insensitive matching. E.g., "[ab]" with this flag
@@ -265,7 +265,7 @@ uset_openEmpty(void);
/**
* Creates a USet object that contains the range of characters
- * start..end, inclusive. If start > end
+ * start..end, inclusive. If start > end
* then an empty set is created (same as using uset_openEmpty()).
* @param start first character of the range, inclusive
* @param end last character of the range, inclusive
@@ -402,11 +402,11 @@ uset_set(USet* set,
/**
* Modifies the set to represent the set specified by the given
- * pattern. See the UnicodeSet class description for the syntax of
+ * pattern. See the UnicodeSet class description for the syntax of
* the pattern language. See also the User Guide chapter about UnicodeSet.
* Empties the set passed before applying the pattern.
* A frozen set will not be modified.
- * @param set The set to which the pattern is to be applied.
+ * @param set The set to which the pattern is to be applied.
* @param pattern A pointer to UChar string specifying what characters are in the set.
* The character at pattern[0] must be a '['.
* @param patternLength The length of the UChar string. -1 if NUL terminated.
@@ -414,14 +414,14 @@ uset_set(USet* set,
* Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
* @param status Returns an error if the pattern cannot be parsed.
* @return Upon successful parse, the value is either
- * the index of the character after the closing ']'
+ * the index of the character after the closing ']'
* of the parsed pattern.
- * If the status code indicates failure, then the return value
+ * If the status code indicates failure, then the return value
* is the index of the error in the source.
*
* @stable ICU 2.8
*/
-U_STABLE int32_t U_EXPORT2
+U_STABLE int32_t U_EXPORT2
uset_applyPattern(USet *set,
const UChar *pattern, int32_t patternLength,
uint32_t options,
diff --git a/deps/icu-small/source/common/unicode/usetiter.h b/deps/icu-small/source/common/unicode/usetiter.h
index 057adbc04f5f05..c6396fd76c7ff3 100644
--- a/deps/icu-small/source/common/unicode/usetiter.h
+++ b/deps/icu-small/source/common/unicode/usetiter.h
@@ -10,11 +10,14 @@
#define USETITER_H
#include "unicode/utypes.h"
+
+#if U_SHOW_CPLUSPLUS_API
+
#include "unicode/uobject.h"
#include "unicode/unistr.h"
/**
- * \file
+ * \file
* \brief C++ API: UnicodeSetIterator iterates over the contents of a UnicodeSet.
*/
@@ -162,14 +165,14 @@ class U_COMMON_API UnicodeSetIterator : public UObject {
* Ownership of the returned string remains with the iterator.
* The string is guaranteed to remain valid only until the iterator is
* advanced to the next item, or until the iterator is deleted.
- *
+ *
* @stable ICU 2.4
*/
const UnicodeString& getString();
/**
- * Advances the iteration position to the next element in the set,
- * which can be either a single code point or a string.
+ * Advances the iteration position to the next element in the set,
+ * which can be either a single code point or a string.
* If there are no more elements in the set, return false.
*
*
@@ -317,4 +320,6 @@ inline UChar32 UnicodeSetIterator::getCodepointEnd() const {
U_NAMESPACE_END
+#endif /* U_SHOW_CPLUSPLUS_API */
+
#endif
diff --git a/deps/icu-small/source/common/unicode/ushape.h b/deps/icu-small/source/common/unicode/ushape.h
index 3064e0857281c5..78b4d027a83f55 100644
--- a/deps/icu-small/source/common/unicode/ushape.h
+++ b/deps/icu-small/source/common/unicode/ushape.h
@@ -24,7 +24,7 @@
/**
* \file
* \brief C API: Arabic shaping
- *
+ *
*/
/**
@@ -117,7 +117,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
* This option is an alias to U_SHAPE_LENGTH_GROW_SHRINK
* @stable ICU 4.2
*/
-#define U_SHAPE_LAMALEF_RESIZE 0
+#define U_SHAPE_LAMALEF_RESIZE 0
/**
* Memory option: the result must have the same length as the source.
@@ -133,7 +133,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
* This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_NEAR
* @stable ICU 4.2
*/
-#define U_SHAPE_LAMALEF_NEAR 1
+#define U_SHAPE_LAMALEF_NEAR 1
/**
* Memory option: the result must have the same length as the source.
@@ -149,7 +149,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
* This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_AT_END
* @stable ICU 4.2
*/
-#define U_SHAPE_LAMALEF_END 2
+#define U_SHAPE_LAMALEF_END 2
/**
* Memory option: the result must have the same length as the source.
@@ -165,7 +165,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
* This option is an alias to U_SHAPE_LENGTH_FIXED_SPACES_AT_BEGINNING
* @stable ICU 4.2
*/
-#define U_SHAPE_LAMALEF_BEGIN 3
+#define U_SHAPE_LAMALEF_BEGIN 3
/**
@@ -174,14 +174,14 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
* If there is no space at end, use spaces at beginning of the buffer. If there
* is no space at beginning of the buffer, use spaces at the near (i.e. the space
* after the LAMALEF character).
- * If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h)
+ * If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h)
* will be set in pErrorCode
*
- * Deshaping Mode: Perform the same function as the flag equals U_SHAPE_LAMALEF_END.
+ * Deshaping Mode: Perform the same function as the flag equals U_SHAPE_LAMALEF_END.
* Affects: LamAlef options
* @stable ICU 4.2
*/
-#define U_SHAPE_LAMALEF_AUTO 0x10000
+#define U_SHAPE_LAMALEF_AUTO 0x10000
/** Bit mask for memory options. @stable ICU 2.0 */
#define U_SHAPE_LENGTH_MASK 0x10003 /* Changed old value 3 */
@@ -301,7 +301,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
/** Bit mask for digit type options. @stable ICU 2.0 */
#define U_SHAPE_DIGIT_TYPE_MASK 0x300 /* I need to change this from 0x3f00 to 0x300 */
-/**
+/**
* Tashkeel aggregation option:
* Replaces any combination of U+0651 with one of
* U+064C, U+064D, U+064E, U+064F, U+0650 with
@@ -314,28 +314,28 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
/** Bit mask for tashkeel aggregation. @stable ICU 3.6 */
#define U_SHAPE_AGGREGATE_TASHKEEL_MASK 0x4000
-/**
+/**
* Presentation form option:
* Don't replace Arabic Presentation Forms-A and Arabic Presentation Forms-B
* characters with 0+06xx characters, before shaping.
* @stable ICU 3.6
*/
#define U_SHAPE_PRESERVE_PRESENTATION 0x8000
-/** Presentation form option:
- * Replace Arabic Presentation Forms-A and Arabic Presentationo Forms-B with
+/** Presentation form option:
+ * Replace Arabic Presentation Forms-A and Arabic Presentationo Forms-B with
* their unshaped correspondants in range 0+06xx, before shaping.
- * @stable ICU 3.6
+ * @stable ICU 3.6
*/
#define U_SHAPE_PRESERVE_PRESENTATION_NOOP 0
/** Bit mask for preserve presentation form. @stable ICU 3.6 */
#define U_SHAPE_PRESERVE_PRESENTATION_MASK 0x8000
-/* Seen Tail option */
+/* Seen Tail option */
/**
* Memory option: the result must have the same length as the source.
- * Shaping mode: The SEEN family character will expand into two characters using space near
+ * Shaping mode: The SEEN family character will expand into two characters using space near
* the SEEN family character(i.e. the space after the character).
- * If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h)
+ * If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h)
* will be set in pErrorCode
*
* De-shaping mode: Any Seen character followed by Tail character will be
@@ -346,17 +346,17 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
#define U_SHAPE_SEEN_TWOCELL_NEAR 0x200000
/**
- * Bit mask for Seen memory options.
+ * Bit mask for Seen memory options.
* @stable ICU 4.2
*/
#define U_SHAPE_SEEN_MASK 0x700000
-/* YehHamza option */
+/* YehHamza option */
/**
* Memory option: the result must have the same length as the source.
- * Shaping mode: The YEHHAMZA character will expand into two characters using space near it
+ * Shaping mode: The YEHHAMZA character will expand into two characters using space near it
* (i.e. the space after the character
- * If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h)
+ * If there are no spaces found, an error U_NO_SPACE_AVAILABLE (as defined in utypes.h)
* will be set in pErrorCode
*
* De-shaping mode: Any Yeh (final or isolated) character followed by Hamza character will be
@@ -368,15 +368,15 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
/**
- * Bit mask for YehHamza memory options.
+ * Bit mask for YehHamza memory options.
* @stable ICU 4.2
*/
#define U_SHAPE_YEHHAMZA_MASK 0x3800000
-/* New Tashkeel options */
+/* New Tashkeel options */
/**
* Memory option: the result must have the same length as the source.
- * Shaping mode: Tashkeel characters will be replaced by spaces.
+ * Shaping mode: Tashkeel characters will be replaced by spaces.
* Spaces will be placed at beginning of the buffer
*
* De-shaping mode: N/A
@@ -387,7 +387,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
/**
* Memory option: the result must have the same length as the source.
- * Shaping mode: Tashkeel characters will be replaced by spaces.
+ * Shaping mode: Tashkeel characters will be replaced by spaces.
* Spaces will be placed at end of the buffer
*
* De-shaping mode: N/A
@@ -398,8 +398,8 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
/**
* Memory option: allow the result to have a different length than the source.
- * Shaping mode: Tashkeel characters will be removed, buffer length will shrink.
- * De-shaping mode: N/A
+ * Shaping mode: Tashkeel characters will be removed, buffer length will shrink.
+ * De-shaping mode: N/A
*
* Affect: Tashkeel options
* @stable ICU 4.2
@@ -417,46 +417,46 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
*/
#define U_SHAPE_TASHKEEL_REPLACE_BY_TATWEEL 0xC0000
-/**
- * Bit mask for Tashkeel replacement with Space or Tatweel memory options.
+/**
+ * Bit mask for Tashkeel replacement with Space or Tatweel memory options.
* @stable ICU 4.2
*/
#define U_SHAPE_TASHKEEL_MASK 0xE0000
-/* Space location Control options */
+/* Space location Control options */
/**
* This option affect the meaning of BEGIN and END options. if this option is not used the default
- * for BEGIN and END will be as following:
+ * for BEGIN and END will be as following:
* The Default (for both Visual LTR, Visual RTL and Logical Text)
* 1. BEGIN always refers to the start address of physical memory.
* 2. END always refers to the end address of physical memory.
*
- * If this option is used it will swap the meaning of BEGIN and END only for Visual LTR text.
+ * If this option is used it will swap the meaning of BEGIN and END only for Visual LTR text.
*
* The effect on BEGIN and END Memory Options will be as following:
* A. BEGIN For Visual LTR text: This will be the beginning (right side) of the visual text(
- * corresponding to the physical memory address end for Visual LTR text, Same as END in
+ * corresponding to the physical memory address end for Visual LTR text, Same as END in
* default behavior)
- * B. BEGIN For Logical text: Same as BEGIN in default behavior.
+ * B. BEGIN For Logical text: Same as BEGIN in default behavior.
* C. END For Visual LTR text: This will be the end (left side) of the visual text (corresponding
* to the physical memory address beginning for Visual LTR text, Same as BEGIN in default behavior.
- * D. END For Logical text: Same as END in default behavior).
+ * D. END For Logical text: Same as END in default behavior).
* Affects: All LamAlef BEGIN, END and AUTO options.
* @stable ICU 4.2
*/
#define U_SHAPE_SPACES_RELATIVE_TO_TEXT_BEGIN_END 0x4000000
/**
- * Bit mask for swapping BEGIN and END for Visual LTR text
+ * Bit mask for swapping BEGIN and END for Visual LTR text
* @stable ICU 4.2
*/
#define U_SHAPE_SPACES_RELATIVE_TO_TEXT_MASK 0x4000000
/**
- * If this option is used, shaping will use the new Unicode code point for TAIL (i.e. 0xFE73).
+ * If this option is used, shaping will use the new Unicode code point for TAIL (i.e. 0xFE73).
* If this option is not specified (Default), old unofficial Unicode TAIL code point is used (i.e. 0x200B)
- * De-shaping will not use this option as it will always search for both the new Unicode code point for the
+ * De-shaping will not use this option as it will always search for both the new Unicode code point for the
* TAIL (i.e. 0xFE73) or the old unofficial Unicode TAIL code point (i.e. 0x200B) and de-shape the
* Seen-Family letter accordingly.
*
@@ -468,7 +468,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
#define U_SHAPE_TAIL_NEW_UNICODE 0x8000000
/**
- * Bit mask for new Unicode Tail option
+ * Bit mask for new Unicode Tail option
* @stable ICU 4.8
*/
#define U_SHAPE_TAIL_TYPE_MASK 0x8000000
diff --git a/deps/icu-small/source/common/unicode/usprep.h b/deps/icu-small/source/common/unicode/usprep.h
index 7cdc6cdd18ea6b..914eb84871b4bb 100644
--- a/deps/icu-small/source/common/unicode/usprep.h
+++ b/deps/icu-small/source/common/unicode/usprep.h
@@ -20,7 +20,7 @@
#define __USPREP_H__
/**
- * \file
+ * \file
* \brief C API: Implements the StringPrep algorithm.
*/
@@ -35,14 +35,14 @@
* Unicode Strings are prepared. Each profiles contains tables which describe
* how a code point should be treated. The tables are broadly classified into
*
- * - Unassigned Table: Contains code points that are unassigned
- * in the Unicode Version supported by StringPrep. Currently
+ *
- Unassigned Table: Contains code points that are unassigned
+ * in the Unicode Version supported by StringPrep. Currently
* RFC 3454 supports Unicode 3.2.
* - Prohibited Table: Contains code points that are prohibited from
* the output of the StringPrep processing function.
* - Mapping Table: Contains code points that are deleted from the output or case mapped.
*
- *
+ *
* The procedure for preparing Unicode strings:
*
* - Map: For each character in the input, check if it has a mapping
@@ -70,17 +70,17 @@
typedef struct UStringPrepProfile UStringPrepProfile;
-/**
+/**
* Option to prohibit processing of unassigned code points in the input
- *
+ *
* @see usprep_prepare
* @stable ICU 2.8
*/
#define USPREP_DEFAULT 0x0000
-/**
+/**
* Option to allow processing of unassigned code points in the input
- *
+ *
* @see usprep_prepare
* @stable ICU 2.8
*/
@@ -182,7 +182,7 @@ typedef enum UStringPrepProfileType {
* @stable ICU 2.8
*/
U_STABLE UStringPrepProfile* U_EXPORT2
-usprep_open(const char* path,
+usprep_open(const char* path,
const char* fileName,
UErrorCode* status);
@@ -233,7 +233,7 @@ U_NAMESPACE_END
* checks for prohibited and BiDi characters in the order defined by RFC 3454
* depending on the options specified in the profile.
*
- * @param prep The profile to use
+ * @param prep The profile to use
* @param src Pointer to UChar buffer containing the string to prepare
* @param srcLength Number of characters in the source string
* @param dest Pointer to the destination buffer to receive the output
@@ -242,10 +242,10 @@ U_NAMESPACE_END
*
* - USPREP_DEFAULT Prohibit processing of unassigned code points in the input
*
- * - USPREP_ALLOW_UNASSIGNED Treat the unassigned code points are in the input
+ * - USPREP_ALLOW_UNASSIGNED Treat the unassigned code points are in the input
* as normal Unicode code points.
*
- * @param parseError Pointer to UParseError struct to receive information on position
+ * @param parseError Pointer to UParseError struct to receive information on position
* of error if an error is encountered. Can be NULL.
* @param status ICU in/out error code parameter.
* U_INVALID_CHAR_FOUND if src contains
@@ -259,7 +259,7 @@ U_NAMESPACE_END
U_STABLE int32_t U_EXPORT2
usprep_prepare( const UStringPrepProfile* prep,
- const UChar* src, int32_t srcLength,
+ const UChar* src, int32_t srcLength,
UChar* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
diff --git a/deps/icu-small/source/common/unicode/ustring.h b/deps/icu-small/source/common/unicode/ustring.h
index 0d2274a0cabb51..245b766545ab25 100644
--- a/deps/icu-small/source/common/unicode/ustring.h
+++ b/deps/icu-small/source/common/unicode/ustring.h
@@ -24,7 +24,7 @@
/**
* \def UBRK_TYPEDEF_UBREAK_ITERATOR
- * @internal
+ * @internal
*/
#ifndef UBRK_TYPEDEF_UBREAK_ITERATOR
@@ -141,11 +141,11 @@ u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number);
* @stable ICU 2.0
*/
U_STABLE UChar* U_EXPORT2
-u_strcat(UChar *dst,
+u_strcat(UChar *dst,
const UChar *src);
/**
- * Concatenate two ustrings.
+ * Concatenate two ustrings.
* Appends at most
n
characters from src
to dst
.
* Adds a terminating NUL.
* If src is too long, then only n-1
characters will be copied
@@ -159,8 +159,8 @@ u_strcat(UChar *dst,
* @stable ICU 2.0
*/
U_STABLE UChar* U_EXPORT2
-u_strncat(UChar *dst,
- const UChar *src,
+u_strncat(UChar *dst,
+ const UChar *src,
int32_t n);
/**
@@ -410,7 +410,7 @@ u_strspn(const UChar *string, const UChar *matchSet);
* @stable ICU 2.0
*/
U_STABLE UChar * U_EXPORT2
-u_strtok_r(UChar *src,
+u_strtok_r(UChar *src,
const UChar *delim,
UChar **saveState);
@@ -425,7 +425,7 @@ u_strtok_r(UChar *src,
* @stable ICU 2.0
*/
U_STABLE int32_t U_EXPORT2
-u_strcmp(const UChar *s1,
+u_strcmp(const UChar *s1,
const UChar *s2);
/**
@@ -544,7 +544,7 @@ u_strCaseCompare(const UChar *s1, int32_t length1,
UErrorCode *pErrorCode);
/**
- * Compare two ustrings for bitwise equality.
+ * Compare two ustrings for bitwise equality.
* Compares at most n
characters.
*
* @param ucs1 A string to compare (can be NULL/invalid if n<=0).
@@ -556,8 +556,8 @@ u_strCaseCompare(const UChar *s1, int32_t length1,
* @stable ICU 2.0
*/
U_STABLE int32_t U_EXPORT2
-u_strncmp(const UChar *ucs1,
- const UChar *ucs2,
+u_strncmp(const UChar *ucs1,
+ const UChar *ucs2,
int32_t n);
/**
@@ -655,7 +655,7 @@ u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options)
* @stable ICU 2.0
*/
U_STABLE UChar* U_EXPORT2
-u_strcpy(UChar *dst,
+u_strcpy(UChar *dst,
const UChar *src);
/**
@@ -670,8 +670,8 @@ u_strcpy(UChar *dst,
* @stable ICU 2.0
*/
U_STABLE UChar* U_EXPORT2
-u_strncpy(UChar *dst,
- const UChar *src,
+u_strncpy(UChar *dst,
+ const UChar *src,
int32_t n);
#if !UCONFIG_NO_CONVERSION
@@ -913,10 +913,10 @@ u_memrchr32(const UChar *s, UChar32 c, int32_t count);
* }
* return u_strcmp(ustringVar1, ustringVar2);
* }
- *
+ *
* Note that the macros will NOT consistently work if their argument is another #`define`.
* The following will not work on all platforms, don't use it.
- *
+ *
* #define GLUCK "Mr. Gluck"
* U_STRING_DECL(var, GLUCK, 9)
* U_STRING_INIT(var, GLUCK, 9)
@@ -1187,11 +1187,11 @@ u_strFoldCase(UChar *dest, int32_t destCapacity,
* @param dest A buffer for the result string. The result will be zero-terminated if
* the buffer is large enough.
* @param destCapacity The size of the buffer (number of wchar_t's). If it is 0, then
- * dest may be NULL and the function will only return the length of the
+ * dest may be NULL and the function will only return the length of the
* result without writing any of the result string (pre-flighting).
- * @param pDestLength A pointer to receive the number of units written to the destination. If
- * pDestLength!=NULL then *pDestLength is always set to the
- * number of output units corresponding to the transformation of
+ * @param pDestLength A pointer to receive the number of units written to the destination. If
+ * pDestLength!=NULL then *pDestLength is always set to the
+ * number of output units corresponding to the transformation of
* all the input units, even in case of a buffer overflow.
* @param src The original source string
* @param srcLength The length of the original string. If -1, then src must be zero-terminated.
@@ -1201,10 +1201,10 @@ u_strFoldCase(UChar *dest, int32_t destCapacity,
* @stable ICU 2.0
*/
U_STABLE wchar_t* U_EXPORT2
-u_strToWCS(wchar_t *dest,
+u_strToWCS(wchar_t *dest,
int32_t destCapacity,
int32_t *pDestLength,
- const UChar *src,
+ const UChar *src,
int32_t srcLength,
UErrorCode *pErrorCode);
/**
@@ -1216,11 +1216,11 @@ u_strToWCS(wchar_t *dest,
* @param dest A buffer for the result string. The result will be zero-terminated if
* the buffer is large enough.
* @param destCapacity The size of the buffer (number of UChars). If it is 0, then
- * dest may be NULL and the function will only return the length of the
+ * dest may be NULL and the function will only return the length of the
* result without writing any of the result string (pre-flighting).
- * @param pDestLength A pointer to receive the number of units written to the destination. If
- * pDestLength!=NULL then *pDestLength is always set to the
- * number of output units corresponding to the transformation of
+ * @param pDestLength A pointer to receive the number of units written to the destination. If
+ * pDestLength!=NULL then *pDestLength is always set to the
+ * number of output units corresponding to the transformation of
* all the input units, even in case of a buffer overflow.
* @param src The original source string
* @param srcLength The length of the original string. If -1, then src must be zero-terminated.
@@ -1231,7 +1231,7 @@ u_strToWCS(wchar_t *dest,
*/
U_STABLE UChar* U_EXPORT2
u_strFromWCS(UChar *dest,
- int32_t destCapacity,
+ int32_t destCapacity,
int32_t *pDestLength,
const wchar_t *src,
int32_t srcLength,
@@ -1245,11 +1245,11 @@ u_strFromWCS(UChar *dest,
* @param dest A buffer for the result string. The result will be zero-terminated if
* the buffer is large enough.
* @param destCapacity The size of the buffer (number of chars). If it is 0, then
- * dest may be NULL and the function will only return the length of the
+ * dest may be NULL and the function will only return the length of the
* result without writing any of the result string (pre-flighting).
- * @param pDestLength A pointer to receive the number of units written to the destination. If
- * pDestLength!=NULL then *pDestLength is always set to the
- * number of output units corresponding to the transformation of
+ * @param pDestLength A pointer to receive the number of units written to the destination. If
+ * pDestLength!=NULL then *pDestLength is always set to the
+ * number of output units corresponding to the transformation of
* all the input units, even in case of a buffer overflow.
* @param src The original source string
* @param srcLength The length of the original string. If -1, then src must be zero-terminated.
@@ -1260,11 +1260,11 @@ u_strFromWCS(UChar *dest,
* @see u_strToUTF8WithSub
* @see u_strFromUTF8
*/
-U_STABLE char* U_EXPORT2
-u_strToUTF8(char *dest,
+U_STABLE char* U_EXPORT2
+u_strToUTF8(char *dest,
int32_t destCapacity,
int32_t *pDestLength,
- const UChar *src,
+ const UChar *src,
int32_t srcLength,
UErrorCode *pErrorCode);
@@ -1275,11 +1275,11 @@ u_strToUTF8(char *dest,
* @param dest A buffer for the result string. The result will be zero-terminated if
* the buffer is large enough.
* @param destCapacity The size of the buffer (number of UChars). If it is 0, then
- * dest may be NULL and the function will only return the length of the
+ * dest may be NULL and the function will only return the length of the
* result without writing any of the result string (pre-flighting).
- * @param pDestLength A pointer to receive the number of units written to the destination. If
- * pDestLength!=NULL then *pDestLength is always set to the
- * number of output units corresponding to the transformation of
+ * @param pDestLength A pointer to receive the number of units written to the destination. If
+ * pDestLength!=NULL then *pDestLength is always set to the
+ * number of output units corresponding to the transformation of
* all the input units, even in case of a buffer overflow.
* @param src The original source string
* @param srcLength The length of the original string. If -1, then src must be zero-terminated.
@@ -1291,10 +1291,10 @@ u_strToUTF8(char *dest,
* @see u_strFromUTF8Lenient
*/
U_STABLE UChar* U_EXPORT2
-u_strFromUTF8(UChar *dest,
+u_strFromUTF8(UChar *dest,
int32_t destCapacity,
int32_t *pDestLength,
- const char *src,
+ const char *src,
int32_t srcLength,
UErrorCode *pErrorCode);
@@ -1308,11 +1308,11 @@ u_strFromUTF8(UChar *dest,
* @param dest A buffer for the result string. The result will be zero-terminated if
* the buffer is large enough.
* @param destCapacity The size of the buffer (number of chars). If it is 0, then
- * dest may be NULL and the function will only return the length of the
+ * dest may be NULL and the function will only return the length of the
* result without writing any of the result string (pre-flighting).
- * @param pDestLength A pointer to receive the number of units written to the destination. If
- * pDestLength!=NULL then *pDestLength is always set to the
- * number of output units corresponding to the transformation of
+ * @param pDestLength A pointer to receive the number of units written to the destination. If
+ * pDestLength!=NULL then *pDestLength is always set to the
+ * number of output units corresponding to the transformation of
* all the input units, even in case of a buffer overflow.
* @param src The original source string
* @param srcLength The length of the original string. If -1, then src must be zero-terminated.
@@ -1352,11 +1352,11 @@ u_strToUTF8WithSub(char *dest,
* @param dest A buffer for the result string. The result will be zero-terminated if
* the buffer is large enough.
* @param destCapacity The size of the buffer (number of UChars). If it is 0, then
- * dest may be NULL and the function will only return the length of the
+ * dest may be NULL and the function will only return the length of the
* result without writing any of the result string (pre-flighting).
- * @param pDestLength A pointer to receive the number of units written to the destination. If
- * pDestLength!=NULL then *pDestLength is always set to the
- * number of output units corresponding to the transformation of
+ * @param pDestLength A pointer to receive the number of units written to the destination. If
+ * pDestLength!=NULL then *pDestLength is always set to the
+ * number of output units corresponding to the transformation of
* all the input units, even in case of a buffer overflow.
* @param src The original source string
* @param srcLength The length of the original string. If -1, then src must be zero-terminated.
@@ -1414,13 +1414,13 @@ u_strFromUTF8WithSub(UChar *dest,
* @param dest A buffer for the result string. The result will be zero-terminated if
* the buffer is large enough.
* @param destCapacity The size of the buffer (number of UChars). If it is 0, then
- * dest may be NULL and the function will only return the length of the
+ * dest may be NULL and the function will only return the length of the
* result without writing any of the result string (pre-flighting).
* Unlike for other ICU functions, if srcLength>=0 then it
* must be destCapacity>=srcLength.
- * @param pDestLength A pointer to receive the number of units written to the destination. If
- * pDestLength!=NULL then *pDestLength is always set to the
- * number of output units corresponding to the transformation of
+ * @param pDestLength A pointer to receive the number of units written to the destination. If
+ * pDestLength!=NULL then *pDestLength is always set to the
+ * number of output units corresponding to the transformation of
* all the input units, even in case of a buffer overflow.
* Unlike for other ICU functions, if srcLength>=0 but
* destCapacitychunkOffset <= (ut)->nativeIndexingLimit? \
(ut)->chunkNativeStart+(ut)->chunkOffset : \
- (ut)->pFuncs->mapOffsetToNative(ut))
+ (ut)->pFuncs->mapOffsetToNative(ut))
/**
* inline version of utext_setNativeIndex(), for performance-critical situations.
@@ -766,12 +766,14 @@ utext_extract(UText *ut,
*
* @stable ICU 3.8
*/
-#define UTEXT_SETNATIVEINDEX(ut, ix) \
- { int64_t __offset = (ix) - (ut)->chunkNativeStart; \
- if (__offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit && (ut)->chunkContents[__offset]<0xdc00) { \
- (ut)->chunkOffset=(int32_t)__offset; \
- } else { \
- utext_setNativeIndex((ut), (ix)); } }
+#define UTEXT_SETNATIVEINDEX(ut, ix) UPRV_BLOCK_MACRO_BEGIN { \
+ int64_t __offset = (ix) - (ut)->chunkNativeStart; \
+ if (__offset>=0 && __offset<(int64_t)(ut)->nativeIndexingLimit && (ut)->chunkContents[__offset]<0xdc00) { \
+ (ut)->chunkOffset=(int32_t)__offset; \
+ } else { \
+ utext_setNativeIndex((ut), (ix)); \
+ } \
+} UPRV_BLOCK_MACRO_END
@@ -882,7 +884,7 @@ utext_replace(UText *ut,
* copied or moved.
* @param move If TRUE, then the substring is moved, not copied/duplicated.
* @param status receives any error status. Possible errors include U_NO_WRITE_PERMISSION
- *
+ *
* @stable ICU 3.4
*/
U_STABLE void U_EXPORT2
@@ -948,7 +950,7 @@ enum {
* There is meta data associated with the text.
* @see Replaceable::hasMetaData()
* @stable ICU 3.4
- */
+ */
UTEXT_PROVIDER_HAS_META_DATA = 4,
/**
* Text provider owns the text storage.
@@ -973,7 +975,7 @@ enum {
* and be prepared to handle failures.
*
* A shallow clone replicates only the UText data structures; it does not make
- * a copy of the underlying text. Shallow clones can be used as an efficient way to
+ * a copy of the underlying text. Shallow clones can be used as an efficient way to
* have multiple iterators active in a single text string that is not being
* modified.
*
@@ -1182,7 +1184,7 @@ UTextMapNativeIndexToUTF16(const UText *ut, int64_t nativeIndex);
* Function type declaration for UText.utextClose().
*
* A Text Provider close function is only required for provider types that make
- * allocations in their open function (or other functions) that must be
+ * allocations in their open function (or other functions) that must be
* cleaned when the UText is closed.
*
* The allocation of the UText struct itself and any "extra" storage
@@ -1311,7 +1313,7 @@ struct UTextFuncs {
* @internal
*/
UTextClose *spare1;
-
+
/**
* (private) Spare function pointer
* @internal
@@ -1380,9 +1382,9 @@ struct UText {
* @stable ICU 3.4
*/
int32_t sizeOfStruct;
-
+
/* ------ 16 byte alignment boundary ----------- */
-
+
/**
* (protected) Native index of the first character position following
@@ -1407,7 +1409,7 @@ struct UText {
int32_t nativeIndexingLimit;
/* ---- 16 byte alignment boundary------ */
-
+
/**
* (protected) Native index of the first character in the text chunk.
* @stable ICU 3.6
@@ -1428,7 +1430,7 @@ struct UText {
int32_t chunkLength;
/* ---- 16 byte alignment boundary-- */
-
+
/**
* (protected) pointer to a chunk of text in UTF-16 format.
@@ -1466,7 +1468,7 @@ struct UText {
* Not used by UText common code.
* @stable ICU 3.6
*/
- const void *p;
+ const void *p;
/**
* (protected) Pointer fields available for use by the text provider.
* Not used by UText common code.
@@ -1489,7 +1491,7 @@ struct UText {
/* --- 16 byte alignment boundary--- */
-
+
/**
* (protected) Integer field reserved for use by the text provider.
diff --git a/deps/icu-small/source/common/unicode/utf.h b/deps/icu-small/source/common/unicode/utf.h
index aa5698069154cc..ef512997f05a15 100644
--- a/deps/icu-small/source/common/unicode/utf.h
+++ b/deps/icu-small/source/common/unicode/utf.h
@@ -107,7 +107,7 @@
*
* Usage:
* ICU coding guidelines for if() statements should be followed when using these macros.
- * Compound statements (curly braces {}) must be used for if-else-while...
+ * Compound statements (curly braces {}) must be used for if-else-while...
* bodies and all macro statements should be terminated with semicolon.
*
* @stable ICU 2.4
@@ -167,7 +167,7 @@
* @stable ICU 2.8
*/
#define U_IS_SUPPLEMENTARY(c) ((uint32_t)((c)-0x10000)<=0xfffff)
-
+
/**
* Is this code point a lead surrogate (U+d800..U+dbff)?
* @param c 32-bit code point
diff --git a/deps/icu-small/source/common/unicode/utf16.h b/deps/icu-small/source/common/unicode/utf16.h
index 0908b4f00e9bf1..9fd7d5c8a77279 100644
--- a/deps/icu-small/source/common/unicode/utf16.h
+++ b/deps/icu-small/source/common/unicode/utf16.h
@@ -19,7 +19,7 @@
/**
* \file
* \brief C API: 16-bit Unicode handling macros
- *
+ *
* This file defines macros to deal with 16-bit Unicode (UTF-16) code units and strings.
*
* For more information see utf.h and the ICU User Guide Strings chapter
@@ -27,7 +27,7 @@
*
* Usage:
* ICU coding guidelines for if() statements should be followed when using these macros.
- * Compound statements (curly braces {}) must be used for if-else-while...
+ * Compound statements (curly braces {}) must be used for if-else-while...
* bodies and all macro statements should be terminated with semicolon.
*/
@@ -163,7 +163,7 @@
* @see U16_GET
* @stable ICU 2.4
*/
-#define U16_GET_UNSAFE(s, i, c) { \
+#define U16_GET_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
if(U16_IS_SURROGATE(c)) { \
if(U16_IS_SURROGATE_LEAD(c)) { \
@@ -172,7 +172,7 @@
(c)=U16_GET_SUPPLEMENTARY((s)[(i)-1], (c)); \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Get a code point from a string at a random-access offset,
@@ -197,7 +197,7 @@
* @see U16_GET_UNSAFE
* @stable ICU 2.4
*/
-#define U16_GET(s, start, i, length, c) { \
+#define U16_GET(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
if(U16_IS_SURROGATE(c)) { \
uint16_t __c2; \
@@ -211,7 +211,7 @@
} \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Get a code point from a string at a random-access offset,
@@ -236,7 +236,7 @@
* @see U16_GET_UNSAFE
* @stable ICU 60
*/
-#define U16_GET_OR_FFFD(s, start, i, length, c) { \
+#define U16_GET_OR_FFFD(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
if(U16_IS_SURROGATE(c)) { \
uint16_t __c2; \
@@ -254,7 +254,7 @@
} \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/* definitions with forward iteration --------------------------------------- */
@@ -277,12 +277,12 @@
* @see U16_NEXT
* @stable ICU 2.4
*/
-#define U16_NEXT_UNSAFE(s, i, c) { \
+#define U16_NEXT_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if(U16_IS_LEAD(c)) { \
(c)=U16_GET_SUPPLEMENTARY((c), (s)[(i)++]); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Get a code point from a string at a code point boundary offset,
@@ -305,7 +305,7 @@
* @see U16_NEXT_UNSAFE
* @stable ICU 2.4
*/
-#define U16_NEXT(s, i, length, c) { \
+#define U16_NEXT(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if(U16_IS_LEAD(c)) { \
uint16_t __c2; \
@@ -314,7 +314,7 @@
(c)=U16_GET_SUPPLEMENTARY((c), __c2); \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Get a code point from a string at a code point boundary offset,
@@ -337,7 +337,7 @@
* @see U16_NEXT_UNSAFE
* @stable ICU 60
*/
-#define U16_NEXT_OR_FFFD(s, i, length, c) { \
+#define U16_NEXT_OR_FFFD(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if(U16_IS_SURROGATE(c)) { \
uint16_t __c2; \
@@ -348,7 +348,7 @@
(c)=0xfffd; \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Append a code point to a string, overwriting 1 or 2 code units.
@@ -363,14 +363,14 @@
* @see U16_APPEND
* @stable ICU 2.4
*/
-#define U16_APPEND_UNSAFE(s, i, c) { \
+#define U16_APPEND_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0xffff) { \
(s)[(i)++]=(uint16_t)(c); \
} else { \
(s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \
(s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Append a code point to a string, overwriting 1 or 2 code units.
@@ -389,7 +389,7 @@
* @see U16_APPEND_UNSAFE
* @stable ICU 2.4
*/
-#define U16_APPEND(s, i, capacity, c, isError) { \
+#define U16_APPEND(s, i, capacity, c, isError) UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0xffff) { \
(s)[(i)++]=(uint16_t)(c); \
} else if((uint32_t)(c)<=0x10ffff && (i)+1<(capacity)) { \
@@ -398,7 +398,7 @@
} else /* c>0x10ffff or not enough space */ { \
(isError)=TRUE; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Advance the string offset from one code point boundary to the next.
@@ -410,11 +410,11 @@
* @see U16_FWD_1
* @stable ICU 2.4
*/
-#define U16_FWD_1_UNSAFE(s, i) { \
+#define U16_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
if(U16_IS_LEAD((s)[(i)++])) { \
++(i); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Advance the string offset from one code point boundary to the next.
@@ -429,11 +429,11 @@
* @see U16_FWD_1_UNSAFE
* @stable ICU 2.4
*/
-#define U16_FWD_1(s, i, length) { \
+#define U16_FWD_1(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \
if(U16_IS_LEAD((s)[(i)++]) && (i)!=(length) && U16_IS_TRAIL((s)[i])) { \
++(i); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Advance the string offset from one code point boundary to the n-th next one,
@@ -447,13 +447,13 @@
* @see U16_FWD_N
* @stable ICU 2.4
*/
-#define U16_FWD_N_UNSAFE(s, i, n) { \
+#define U16_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
U16_FWD_1_UNSAFE(s, i); \
--__N; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Advance the string offset from one code point boundary to the n-th next one,
@@ -470,13 +470,13 @@
* @see U16_FWD_N_UNSAFE
* @stable ICU 2.4
*/
-#define U16_FWD_N(s, i, length, n) { \
+#define U16_FWD_N(s, i, length, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0 && ((i)<(length) || ((length)<0 && (s)[i]!=0))) { \
U16_FWD_1(s, i, length); \
--__N; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Adjust a random-access offset to a code point boundary
@@ -491,11 +491,11 @@
* @see U16_SET_CP_START
* @stable ICU 2.4
*/
-#define U16_SET_CP_START_UNSAFE(s, i) { \
+#define U16_SET_CP_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
if(U16_IS_TRAIL((s)[i])) { \
--(i); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Adjust a random-access offset to a code point boundary
@@ -511,11 +511,11 @@
* @see U16_SET_CP_START_UNSAFE
* @stable ICU 2.4
*/
-#define U16_SET_CP_START(s, start, i) { \
+#define U16_SET_CP_START(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
if(U16_IS_TRAIL((s)[i]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \
--(i); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/* definitions with backward iteration -------------------------------------- */
@@ -539,12 +539,12 @@
* @see U16_PREV
* @stable ICU 2.4
*/
-#define U16_PREV_UNSAFE(s, i, c) { \
+#define U16_PREV_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(U16_IS_TRAIL(c)) { \
(c)=U16_GET_SUPPLEMENTARY((s)[--(i)], (c)); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the previous one
@@ -566,7 +566,7 @@
* @see U16_PREV_UNSAFE
* @stable ICU 2.4
*/
-#define U16_PREV(s, start, i, c) { \
+#define U16_PREV(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(U16_IS_TRAIL(c)) { \
uint16_t __c2; \
@@ -575,7 +575,7 @@
(c)=U16_GET_SUPPLEMENTARY(__c2, (c)); \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the previous one
@@ -597,7 +597,7 @@
* @see U16_PREV_UNSAFE
* @stable ICU 60
*/
-#define U16_PREV_OR_FFFD(s, start, i, c) { \
+#define U16_PREV_OR_FFFD(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(U16_IS_SURROGATE(c)) { \
uint16_t __c2; \
@@ -608,7 +608,7 @@
(c)=0xfffd; \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the previous one.
@@ -621,11 +621,11 @@
* @see U16_BACK_1
* @stable ICU 2.4
*/
-#define U16_BACK_1_UNSAFE(s, i) { \
+#define U16_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
if(U16_IS_TRAIL((s)[--(i)])) { \
--(i); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the previous one.
@@ -639,11 +639,11 @@
* @see U16_BACK_1_UNSAFE
* @stable ICU 2.4
*/
-#define U16_BACK_1(s, start, i) { \
+#define U16_BACK_1(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
if(U16_IS_TRAIL((s)[--(i)]) && (i)>(start) && U16_IS_LEAD((s)[(i)-1])) { \
--(i); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the n-th one before it,
@@ -658,13 +658,13 @@
* @see U16_BACK_N
* @stable ICU 2.4
*/
-#define U16_BACK_N_UNSAFE(s, i, n) { \
+#define U16_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
U16_BACK_1_UNSAFE(s, i); \
--__N; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the n-th one before it,
@@ -680,13 +680,13 @@
* @see U16_BACK_N_UNSAFE
* @stable ICU 2.4
*/
-#define U16_BACK_N(s, start, i, n) { \
+#define U16_BACK_N(s, start, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0 && (i)>(start)) { \
U16_BACK_1(s, start, i); \
--__N; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Adjust a random-access offset to a code point boundary after a code point.
@@ -701,11 +701,11 @@
* @see U16_SET_CP_LIMIT
* @stable ICU 2.4
*/
-#define U16_SET_CP_LIMIT_UNSAFE(s, i) { \
+#define U16_SET_CP_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
if(U16_IS_LEAD((s)[(i)-1])) { \
++(i); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Adjust a random-access offset to a code point boundary after a code point.
@@ -724,10 +724,10 @@
* @see U16_SET_CP_LIMIT_UNSAFE
* @stable ICU 2.4
*/
-#define U16_SET_CP_LIMIT(s, start, i, length) { \
+#define U16_SET_CP_LIMIT(s, start, i, length) UPRV_BLOCK_MACRO_BEGIN { \
if((start)<(i) && ((i)<(length) || (length)<0) && U16_IS_LEAD((s)[(i)-1]) && U16_IS_TRAIL((s)[i])) { \
++(i); \
} \
-}
+} UPRV_BLOCK_MACRO_END
#endif
diff --git a/deps/icu-small/source/common/unicode/utf8.h b/deps/icu-small/source/common/unicode/utf8.h
index 41155f119bbb86..4987a00e8e08bf 100644
--- a/deps/icu-small/source/common/unicode/utf8.h
+++ b/deps/icu-small/source/common/unicode/utf8.h
@@ -19,7 +19,7 @@
/**
* \file
* \brief C API: 8-bit Unicode handling macros
- *
+ *
* This file defines macros to deal with 8-bit Unicode (UTF-8) code units (bytes) and strings.
*
* For more information see utf.h and the ICU User Guide Strings chapter
@@ -27,7 +27,7 @@
*
* Usage:
* ICU coding guidelines for if() statements should be followed when using these macros.
- * Compound statements (curly braces {}) must be used for if-else-while...
+ * Compound statements (curly braces {}) must be used for if-else-while...
* bodies and all macro statements should be terminated with semicolon.
*/
@@ -229,11 +229,11 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_GET
* @stable ICU 2.4
*/
-#define U8_GET_UNSAFE(s, i, c) { \
+#define U8_GET_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
int32_t _u8_get_unsafe_index=(int32_t)(i); \
U8_SET_CP_START_UNSAFE(s, _u8_get_unsafe_index); \
U8_NEXT_UNSAFE(s, _u8_get_unsafe_index, c); \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Get a code point from a string at a random-access offset,
@@ -256,11 +256,11 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_GET_UNSAFE
* @stable ICU 2.4
*/
-#define U8_GET(s, start, i, length, c) { \
+#define U8_GET(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
int32_t _u8_get_index=(i); \
U8_SET_CP_START(s, start, _u8_get_index); \
U8_NEXT(s, _u8_get_index, length, c); \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Get a code point from a string at a random-access offset,
@@ -287,11 +287,11 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_GET
* @stable ICU 51
*/
-#define U8_GET_OR_FFFD(s, start, i, length, c) { \
+#define U8_GET_OR_FFFD(s, start, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
int32_t _u8_get_index=(i); \
U8_SET_CP_START(s, start, _u8_get_index); \
U8_NEXT_OR_FFFD(s, _u8_get_index, length, c); \
-}
+} UPRV_BLOCK_MACRO_END
/* definitions with forward iteration --------------------------------------- */
@@ -312,7 +312,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_NEXT
* @stable ICU 2.4
*/
-#define U8_NEXT_UNSAFE(s, i, c) { \
+#define U8_NEXT_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(uint8_t)(s)[(i)++]; \
if(!U8_IS_SINGLE(c)) { \
if((c)<0xe0) { \
@@ -326,7 +326,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
(i)+=3; \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Get a code point from a string at a code point boundary offset,
@@ -377,7 +377,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
#define U8_NEXT_OR_FFFD(s, i, length, c) U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, 0xfffd)
/** @internal */
-#define U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, sub) { \
+#define U8_INTERNAL_NEXT_OR_SUB(s, i, length, c, sub) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(uint8_t)(s)[(i)++]; \
if(!U8_IS_SINGLE(c)) { \
uint8_t __t = 0; \
@@ -403,7 +403,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
(c)=(sub); /* ill-formed*/ \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Append a code point to a string, overwriting 1 to 4 bytes.
@@ -418,7 +418,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_APPEND
* @stable ICU 2.4
*/
-#define U8_APPEND_UNSAFE(s, i, c) { \
+#define U8_APPEND_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
uint32_t __uc=(c); \
if(__uc<=0x7f) { \
(s)[(i)++]=(uint8_t)__uc; \
@@ -436,7 +436,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
} \
(s)[(i)++]=(uint8_t)((__uc&0x3f)|0x80); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Append a code point to a string, overwriting 1 to 4 bytes.
@@ -455,7 +455,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_APPEND_UNSAFE
* @stable ICU 2.4
*/
-#define U8_APPEND(s, i, capacity, c, isError) { \
+#define U8_APPEND(s, i, capacity, c, isError) UPRV_BLOCK_MACRO_BEGIN { \
uint32_t __uc=(c); \
if(__uc<=0x7f) { \
(s)[(i)++]=(uint8_t)__uc; \
@@ -474,7 +474,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
} else { \
(isError)=TRUE; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Advance the string offset from one code point boundary to the next.
@@ -486,9 +486,9 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_FWD_1
* @stable ICU 2.4
*/
-#define U8_FWD_1_UNSAFE(s, i) { \
+#define U8_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
(i)+=1+U8_COUNT_TRAIL_BYTES_UNSAFE((s)[i]); \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Advance the string offset from one code point boundary to the next.
@@ -503,7 +503,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_FWD_1_UNSAFE
* @stable ICU 2.4
*/
-#define U8_FWD_1(s, i, length) { \
+#define U8_FWD_1(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \
uint8_t __b=(s)[(i)++]; \
if(U8_IS_LEAD(__b) && (i)!=(length)) { \
uint8_t __t1=(s)[i]; \
@@ -524,7 +524,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
} \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Advance the string offset from one code point boundary to the n-th next one,
@@ -538,13 +538,13 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_FWD_N
* @stable ICU 2.4
*/
-#define U8_FWD_N_UNSAFE(s, i, n) { \
+#define U8_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
U8_FWD_1_UNSAFE(s, i); \
--__N; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Advance the string offset from one code point boundary to the n-th next one,
@@ -561,13 +561,13 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_FWD_N_UNSAFE
* @stable ICU 2.4
*/
-#define U8_FWD_N(s, i, length, n) { \
+#define U8_FWD_N(s, i, length, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0 && ((i)<(length) || ((length)<0 && (s)[i]!=0))) { \
U8_FWD_1(s, i, length); \
--__N; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Adjust a random-access offset to a code point boundary
@@ -582,9 +582,9 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_SET_CP_START
* @stable ICU 2.4
*/
-#define U8_SET_CP_START_UNSAFE(s, i) { \
+#define U8_SET_CP_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
while(U8_IS_TRAIL((s)[i])) { --(i); } \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Adjust a random-access offset to a code point boundary
@@ -603,11 +603,11 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_TRUNCATE_IF_INCOMPLETE
* @stable ICU 2.4
*/
-#define U8_SET_CP_START(s, start, i) { \
+#define U8_SET_CP_START(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
if(U8_IS_TRAIL((s)[(i)])) { \
(i)=utf8_back1SafeBody(s, start, (i)); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* If the string ends with a UTF-8 byte sequence that is valid so far
@@ -635,7 +635,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_SET_CP_START
* @stable ICU 61
*/
-#define U8_TRUNCATE_IF_INCOMPLETE(s, start, length) \
+#define U8_TRUNCATE_IF_INCOMPLETE(s, start, length) UPRV_BLOCK_MACRO_BEGIN { \
if((length)>(start)) { \
uint8_t __b1=s[(length)-1]; \
if(U8_IS_SINGLE(__b1)) { \
@@ -656,7 +656,8 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
} \
} \
} \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
/* definitions with backward iteration -------------------------------------- */
@@ -679,7 +680,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_PREV
* @stable ICU 2.4
*/
-#define U8_PREV_UNSAFE(s, i, c) { \
+#define U8_PREV_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(uint8_t)(s)[--(i)]; \
if(U8_IS_TRAIL(c)) { \
uint8_t __b, __count=1, __shift=6; \
@@ -699,7 +700,7 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
} \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the previous one
@@ -721,12 +722,12 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_PREV_UNSAFE
* @stable ICU 2.4
*/
-#define U8_PREV(s, start, i, c) { \
+#define U8_PREV(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(uint8_t)(s)[--(i)]; \
if(!U8_IS_SINGLE(c)) { \
(c)=utf8_prevCharSafeBody((const uint8_t *)s, start, &(i), c, -1); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the previous one
@@ -752,12 +753,12 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_PREV
* @stable ICU 51
*/
-#define U8_PREV_OR_FFFD(s, start, i, c) { \
+#define U8_PREV_OR_FFFD(s, start, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(uint8_t)(s)[--(i)]; \
if(!U8_IS_SINGLE(c)) { \
(c)=utf8_prevCharSafeBody((const uint8_t *)s, start, &(i), c, -3); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the previous one.
@@ -770,9 +771,9 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_BACK_1
* @stable ICU 2.4
*/
-#define U8_BACK_1_UNSAFE(s, i) { \
+#define U8_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
while(U8_IS_TRAIL((s)[--(i)])) {} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the previous one.
@@ -786,11 +787,11 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_BACK_1_UNSAFE
* @stable ICU 2.4
*/
-#define U8_BACK_1(s, start, i) { \
+#define U8_BACK_1(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
if(U8_IS_TRAIL((s)[--(i)])) { \
(i)=utf8_back1SafeBody(s, start, (i)); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the n-th one before it,
@@ -805,13 +806,13 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_BACK_N
* @stable ICU 2.4
*/
-#define U8_BACK_N_UNSAFE(s, i, n) { \
+#define U8_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
U8_BACK_1_UNSAFE(s, i); \
--__N; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Move the string offset from one code point boundary to the n-th one before it,
@@ -827,13 +828,13 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_BACK_N_UNSAFE
* @stable ICU 2.4
*/
-#define U8_BACK_N(s, start, i, n) { \
+#define U8_BACK_N(s, start, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0 && (i)>(start)) { \
U8_BACK_1(s, start, i); \
--__N; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Adjust a random-access offset to a code point boundary after a code point.
@@ -848,10 +849,10 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_SET_CP_LIMIT
* @stable ICU 2.4
*/
-#define U8_SET_CP_LIMIT_UNSAFE(s, i) { \
+#define U8_SET_CP_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
U8_BACK_1_UNSAFE(s, i); \
U8_FWD_1_UNSAFE(s, i); \
-}
+} UPRV_BLOCK_MACRO_END
/**
* Adjust a random-access offset to a code point boundary after a code point.
@@ -870,11 +871,11 @@ utf8_back1SafeBody(const uint8_t *s, int32_t start, int32_t i);
* @see U8_SET_CP_LIMIT_UNSAFE
* @stable ICU 2.4
*/
-#define U8_SET_CP_LIMIT(s, start, i, length) { \
+#define U8_SET_CP_LIMIT(s, start, i, length) UPRV_BLOCK_MACRO_BEGIN { \
if((start)<(i) && ((i)<(length) || (length)<0)) { \
U8_BACK_1(s, start, i); \
U8_FWD_1(s, i, length); \
} \
-}
+} UPRV_BLOCK_MACRO_END
#endif
diff --git a/deps/icu-small/source/common/unicode/utf_old.h b/deps/icu-small/source/common/unicode/utf_old.h
index 55c17c01df6db3..b2428e6b31e282 100644
--- a/deps/icu-small/source/common/unicode/utf_old.h
+++ b/deps/icu-small/source/common/unicode/utf_old.h
@@ -19,9 +19,6 @@
/**
* \file
* \brief C API: Deprecated macros for Unicode string handling
- */
-
-/**
*
* The macros in utf_old.h are all deprecated and their use discouraged.
* Some of the design principles behind the set of UTF macros
@@ -139,12 +136,16 @@
*
*
*
- * @deprecated ICU 2.4. Use the macros in utf.h, utf16.h, utf8.h instead.
+ * Deprecated ICU 2.4. Use the macros in utf.h, utf16.h, utf8.h instead.
*/
#ifndef __UTF_OLD_H__
#define __UTF_OLD_H__
+#include "unicode/utf.h"
+#include "unicode/utf8.h"
+#include "unicode/utf16.h"
+
/**
* \def U_HIDE_OBSOLETE_UTF_OLD_H
*
@@ -162,10 +163,6 @@
#if !defined(U_HIDE_DEPRECATED_API) && !U_HIDE_OBSOLETE_UTF_OLD_H
-#include "unicode/utf.h"
-#include "unicode/utf8.h"
-#include "unicode/utf16.h"
-
/* Formerly utf.h, part 1 --------------------------------------------------- */
#ifdef U_USE_UTF_DEPRECATES
@@ -365,21 +362,21 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
#define UTF8_ARRAY_SIZE(size) ((5*(size))/2)
/** @deprecated ICU 2.4. Renamed to U8_GET_UNSAFE, see utf_old.h. */
-#define UTF8_GET_CHAR_UNSAFE(s, i, c) { \
+#define UTF8_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
int32_t _utf8_get_char_unsafe_index=(int32_t)(i); \
UTF8_SET_CHAR_START_UNSAFE(s, _utf8_get_char_unsafe_index); \
UTF8_NEXT_CHAR_UNSAFE(s, _utf8_get_char_unsafe_index, c); \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Use U8_GET instead, see utf_old.h. */
-#define UTF8_GET_CHAR_SAFE(s, start, i, length, c, strict) { \
+#define UTF8_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
int32_t _utf8_get_char_safe_index=(int32_t)(i); \
UTF8_SET_CHAR_START_SAFE(s, start, _utf8_get_char_safe_index); \
UTF8_NEXT_CHAR_SAFE(s, _utf8_get_char_safe_index, length, c, strict); \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_NEXT_UNSAFE, see utf_old.h. */
-#define UTF8_NEXT_CHAR_UNSAFE(s, i, c) { \
+#define UTF8_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if((uint8_t)((c)-0xc0)<0x35) { \
uint8_t __count=UTF8_COUNT_TRAIL_BYTES(c); \
@@ -396,10 +393,10 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
break; \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_APPEND_UNSAFE, see utf_old.h. */
-#define UTF8_APPEND_CHAR_UNSAFE(s, i, c) { \
+#define UTF8_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0x7f) { \
(s)[(i)++]=(uint8_t)(c); \
} else { \
@@ -416,29 +413,29 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
} \
(s)[(i)++]=(uint8_t)(((c)&0x3f)|0x80); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_FWD_1_UNSAFE, see utf_old.h. */
-#define UTF8_FWD_1_UNSAFE(s, i) { \
+#define UTF8_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
(i)+=1+UTF8_COUNT_TRAIL_BYTES((s)[i]); \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_FWD_N_UNSAFE, see utf_old.h. */
-#define UTF8_FWD_N_UNSAFE(s, i, n) { \
+#define UTF8_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
UTF8_FWD_1_UNSAFE(s, i); \
--__N; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_SET_CP_START_UNSAFE, see utf_old.h. */
-#define UTF8_SET_CHAR_START_UNSAFE(s, i) { \
+#define UTF8_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
while(UTF8_IS_TRAIL((s)[i])) { --(i); } \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Use U8_NEXT instead, see utf_old.h. */
-#define UTF8_NEXT_CHAR_SAFE(s, i, length, c, strict) { \
+#define UTF8_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if((c)>=0x80) { \
if(UTF8_IS_LEAD(c)) { \
@@ -447,16 +444,16 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
(c)=UTF8_ERROR_VALUE_1; \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Use U8_APPEND instead, see utf_old.h. */
-#define UTF8_APPEND_CHAR_SAFE(s, i, length, c) { \
+#define UTF8_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0x7f) { \
(s)[(i)++]=(uint8_t)(c); \
} else { \
(i)=utf8_appendCharSafeBody(s, (int32_t)(i), (int32_t)(length), c, NULL); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_FWD_1, see utf_old.h. */
#define UTF8_FWD_1_SAFE(s, i, length) U8_FWD_1(s, i, length)
@@ -468,7 +465,7 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
#define UTF8_SET_CHAR_START_SAFE(s, start, i) U8_SET_CP_START(s, start, i)
/** @deprecated ICU 2.4. Renamed to U8_PREV_UNSAFE, see utf_old.h. */
-#define UTF8_PREV_CHAR_UNSAFE(s, i, c) { \
+#define UTF8_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(UTF8_IS_TRAIL(c)) { \
uint8_t __b, __count=1, __shift=6; \
@@ -488,30 +485,30 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
} \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_BACK_1_UNSAFE, see utf_old.h. */
-#define UTF8_BACK_1_UNSAFE(s, i) { \
+#define UTF8_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
while(UTF8_IS_TRAIL((s)[--(i)])) {} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_BACK_N_UNSAFE, see utf_old.h. */
-#define UTF8_BACK_N_UNSAFE(s, i, n) { \
+#define UTF8_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
UTF8_BACK_1_UNSAFE(s, i); \
--__N; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_SET_CP_LIMIT_UNSAFE, see utf_old.h. */
-#define UTF8_SET_CHAR_LIMIT_UNSAFE(s, i) { \
+#define UTF8_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
UTF8_BACK_1_UNSAFE(s, i); \
UTF8_FWD_1_UNSAFE(s, i); \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Use U8_PREV instead, see utf_old.h. */
-#define UTF8_PREV_CHAR_SAFE(s, start, i, c, strict) { \
+#define UTF8_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if((c)>=0x80) { \
if((c)<=0xbf) { \
@@ -520,7 +517,7 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
(c)=UTF8_ERROR_VALUE_1; \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U8_BACK_1, see utf_old.h. */
#define UTF8_BACK_1_SAFE(s, start, i) U8_BACK_1(s, start, i)
@@ -593,7 +590,7 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
* UTF16_PREV_CHAR[_UNSAFE]() is more efficient for that.
* @deprecated ICU 2.4. Renamed to U16_GET_UNSAFE, see utf_old.h.
*/
-#define UTF16_GET_CHAR_UNSAFE(s, i, c) { \
+#define UTF16_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
if(UTF_IS_SURROGATE(c)) { \
if(UTF_IS_SURROGATE_FIRST(c)) { \
@@ -602,10 +599,10 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
(c)=UTF16_GET_PAIR_VALUE((s)[(i)-1], (c)); \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Use U16_GET instead, see utf_old.h. */
-#define UTF16_GET_CHAR_SAFE(s, start, i, length, c, strict) { \
+#define UTF16_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
if(UTF_IS_SURROGATE(c)) { \
uint16_t __c2; \
@@ -629,51 +626,51 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
} else if((strict) && !UTF_IS_UNICODE_CHAR(c)) { \
(c)=UTF_ERROR_VALUE; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_NEXT_UNSAFE, see utf_old.h. */
-#define UTF16_NEXT_CHAR_UNSAFE(s, i, c) { \
+#define UTF16_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if(UTF_IS_FIRST_SURROGATE(c)) { \
(c)=UTF16_GET_PAIR_VALUE((c), (s)[(i)++]); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_APPEND_UNSAFE, see utf_old.h. */
-#define UTF16_APPEND_CHAR_UNSAFE(s, i, c) { \
+#define UTF16_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0xffff) { \
(s)[(i)++]=(uint16_t)(c); \
} else { \
(s)[(i)++]=(uint16_t)(((c)>>10)+0xd7c0); \
(s)[(i)++]=(uint16_t)(((c)&0x3ff)|0xdc00); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_FWD_1_UNSAFE, see utf_old.h. */
-#define UTF16_FWD_1_UNSAFE(s, i) { \
+#define UTF16_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
if(UTF_IS_FIRST_SURROGATE((s)[(i)++])) { \
++(i); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_FWD_N_UNSAFE, see utf_old.h. */
-#define UTF16_FWD_N_UNSAFE(s, i, n) { \
+#define UTF16_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
UTF16_FWD_1_UNSAFE(s, i); \
--__N; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_SET_CP_START_UNSAFE, see utf_old.h. */
-#define UTF16_SET_CHAR_START_UNSAFE(s, i) { \
+#define UTF16_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
if(UTF_IS_SECOND_SURROGATE((s)[i])) { \
--(i); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Use U16_NEXT instead, see utf_old.h. */
-#define UTF16_NEXT_CHAR_SAFE(s, i, length, c, strict) { \
+#define UTF16_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if(UTF_IS_FIRST_SURROGATE(c)) { \
uint16_t __c2; \
@@ -689,10 +686,10 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
/* unmatched second surrogate or other non-character */ \
(c)=UTF_ERROR_VALUE; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Use U16_APPEND instead, see utf_old.h. */
-#define UTF16_APPEND_CHAR_SAFE(s, i, length, c) { \
+#define UTF16_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0xffff) { \
(s)[(i)++]=(uint16_t)(c); \
} else if((uint32_t)(c)<=0x10ffff) { \
@@ -705,7 +702,7 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
} else /* c>0x10ffff, write error value */ { \
(s)[(i)++]=UTF_ERROR_VALUE; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_FWD_1, see utf_old.h. */
#define UTF16_FWD_1_SAFE(s, i, length) U16_FWD_1(s, i, length)
@@ -717,38 +714,38 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
#define UTF16_SET_CHAR_START_SAFE(s, start, i) U16_SET_CP_START(s, start, i)
/** @deprecated ICU 2.4. Renamed to U16_PREV_UNSAFE, see utf_old.h. */
-#define UTF16_PREV_CHAR_UNSAFE(s, i, c) { \
+#define UTF16_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(UTF_IS_SECOND_SURROGATE(c)) { \
(c)=UTF16_GET_PAIR_VALUE((s)[--(i)], (c)); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_BACK_1_UNSAFE, see utf_old.h. */
-#define UTF16_BACK_1_UNSAFE(s, i) { \
+#define UTF16_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
if(UTF_IS_SECOND_SURROGATE((s)[--(i)])) { \
--(i); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_BACK_N_UNSAFE, see utf_old.h. */
-#define UTF16_BACK_N_UNSAFE(s, i, n) { \
+#define UTF16_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __N=(n); \
while(__N>0) { \
UTF16_BACK_1_UNSAFE(s, i); \
--__N; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_SET_CP_LIMIT_UNSAFE, see utf_old.h. */
-#define UTF16_SET_CHAR_LIMIT_UNSAFE(s, i) { \
+#define UTF16_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
if(UTF_IS_FIRST_SURROGATE((s)[(i)-1])) { \
++(i); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Use U16_PREV instead, see utf_old.h. */
-#define UTF16_PREV_CHAR_SAFE(s, start, i, c, strict) { \
+#define UTF16_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(UTF_IS_SECOND_SURROGATE(c)) { \
uint16_t __c2; \
@@ -764,7 +761,7 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
/* unmatched first surrogate or other non-character */ \
(c)=UTF_ERROR_VALUE; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Renamed to U16_BACK_1, see utf_old.h. */
#define UTF16_BACK_1_SAFE(s, start, i) U16_BACK_1(s, start, i)
@@ -830,122 +827,122 @@ U_CFUNC U_IMPORT const uint8_t utf8_countTrailBytes[]; /* U_IMPORT2? */ /*U_I
#define UTF32_ARRAY_SIZE(size) (size)
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_GET_CHAR_UNSAFE(s, i, c) { \
+#define UTF32_GET_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_GET_CHAR_SAFE(s, start, i, length, c, strict) { \
+#define UTF32_GET_CHAR_SAFE(s, start, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[i]; \
if(!UTF32_IS_SAFE(c, strict)) { \
(c)=UTF_ERROR_VALUE; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/* definitions with forward iteration --------------------------------------- */
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_NEXT_CHAR_UNSAFE(s, i, c) { \
+#define UTF32_NEXT_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_APPEND_CHAR_UNSAFE(s, i, c) { \
+#define UTF32_APPEND_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(s)[(i)++]=(c); \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_FWD_1_UNSAFE(s, i) { \
+#define UTF32_FWD_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
++(i); \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_FWD_N_UNSAFE(s, i, n) { \
+#define UTF32_FWD_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
(i)+=(n); \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_SET_CHAR_START_UNSAFE(s, i) { \
-}
+#define UTF32_SET_CHAR_START_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_NEXT_CHAR_SAFE(s, i, length, c, strict) { \
+#define UTF32_NEXT_CHAR_SAFE(s, i, length, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[(i)++]; \
if(!UTF32_IS_SAFE(c, strict)) { \
(c)=UTF_ERROR_VALUE; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_APPEND_CHAR_SAFE(s, i, length, c) { \
+#define UTF32_APPEND_CHAR_SAFE(s, i, length, c) UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c)<=0x10ffff) { \
(s)[(i)++]=(c); \
} else /* c>0x10ffff, write 0xfffd */ { \
(s)[(i)++]=0xfffd; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_FWD_1_SAFE(s, i, length) { \
+#define UTF32_FWD_1_SAFE(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \
++(i); \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_FWD_N_SAFE(s, i, length, n) { \
+#define UTF32_FWD_N_SAFE(s, i, length, n) UPRV_BLOCK_MACRO_BEGIN { \
if(((i)+=(n))>(length)) { \
(i)=(length); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_SET_CHAR_START_SAFE(s, start, i) { \
-}
+#define UTF32_SET_CHAR_START_SAFE(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
+} UPRV_BLOCK_MACRO_END
/* definitions with backward iteration -------------------------------------- */
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_PREV_CHAR_UNSAFE(s, i, c) { \
+#define UTF32_PREV_CHAR_UNSAFE(s, i, c) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_BACK_1_UNSAFE(s, i) { \
+#define UTF32_BACK_1_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
--(i); \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_BACK_N_UNSAFE(s, i, n) { \
+#define UTF32_BACK_N_UNSAFE(s, i, n) UPRV_BLOCK_MACRO_BEGIN { \
(i)-=(n); \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_SET_CHAR_LIMIT_UNSAFE(s, i) { \
-}
+#define UTF32_SET_CHAR_LIMIT_UNSAFE(s, i) UPRV_BLOCK_MACRO_BEGIN { \
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_PREV_CHAR_SAFE(s, start, i, c, strict) { \
+#define UTF32_PREV_CHAR_SAFE(s, start, i, c, strict) UPRV_BLOCK_MACRO_BEGIN { \
(c)=(s)[--(i)]; \
if(!UTF32_IS_SAFE(c, strict)) { \
(c)=UTF_ERROR_VALUE; \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_BACK_1_SAFE(s, start, i) { \
+#define UTF32_BACK_1_SAFE(s, start, i) UPRV_BLOCK_MACRO_BEGIN { \
--(i); \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_BACK_N_SAFE(s, start, i, n) { \
+#define UTF32_BACK_N_SAFE(s, start, i, n) UPRV_BLOCK_MACRO_BEGIN { \
(i)-=(n); \
if((i)<(start)) { \
(i)=(start); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** @deprecated ICU 2.4. Obsolete, see utf_old.h. */
-#define UTF32_SET_CHAR_LIMIT_SAFE(s, i, length) { \
-}
+#define UTF32_SET_CHAR_LIMIT_SAFE(s, i, length) UPRV_BLOCK_MACRO_BEGIN { \
+} UPRV_BLOCK_MACRO_END
/* Formerly utf.h, part 2 --------------------------------------------------- */
diff --git a/deps/icu-small/source/common/unicode/utrace.h b/deps/icu-small/source/common/unicode/utrace.h
index bf6fd036f06c41..5afcd9f4490828 100644
--- a/deps/icu-small/source/common/unicode/utrace.h
+++ b/deps/icu-small/source/common/unicode/utrace.h
@@ -27,15 +27,15 @@
/**
* \file
- * \brief C API: Definitions for ICU tracing/logging.
+ * \brief C API: Definitions for ICU tracing/logging.
*
* This provides API for debugging the internals of ICU without the use of
* a traditional debugger.
*
- * By default, tracing is disabled in ICU. If you need to debug ICU with
+ * By default, tracing is disabled in ICU. If you need to debug ICU with
* tracing, please compile ICU with the --enable-tracing configure option.
*/
-
+
U_CDECL_BEGIN
/**
@@ -66,6 +66,7 @@ typedef enum UTraceFunctionNumber {
UTRACE_FUNCTION_START=0,
UTRACE_U_INIT=UTRACE_FUNCTION_START,
UTRACE_U_CLEANUP,
+
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal collation trace location.
@@ -83,6 +84,7 @@ typedef enum UTraceFunctionNumber {
UTRACE_UCNV_FLUSH_CACHE,
UTRACE_UCNV_LOAD,
UTRACE_UCNV_UNLOAD,
+
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal collation trace location.
@@ -101,13 +103,80 @@ typedef enum UTraceFunctionNumber {
UTRACE_UCOL_STRCOLLITER,
UTRACE_UCOL_OPEN_FROM_SHORT_STRING,
UTRACE_UCOL_STRCOLLUTF8, /**< @stable ICU 50 */
+
#ifndef U_HIDE_DEPRECATED_API
/**
* One more than the highest normal collation trace location.
* @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
*/
- UTRACE_COLLATION_LIMIT
+ UTRACE_COLLATION_LIMIT,
#endif // U_HIDE_DEPRECATED_API
+
+#ifndef U_HIDE_DRAFT_API
+
+ /**
+ * The lowest resource/data location.
+ * @draft ICU 65
+ */
+ UTRACE_UDATA_START=0x3000,
+
+ /**
+ * Indicates that a value was read from a resource bundle. Provides three
+ * C-style strings to UTraceData: type, file name, and resource path. The
+ * possible types are:
+ *
+ * - "string" (a string value was accessed)
+ * - "binary" (a binary value was accessed)
+ * - "intvector" (a integer vector value was accessed)
+ * - "int" (a signed integer value was accessed)
+ * - "uint" (a unsigned integer value was accessed)
+ * - "get" (a path was loaded, but the value was not accessed)
+ * - "getalias" (a path was loaded, and an alias was resolved)
+ *
+ * @draft ICU 65
+ */
+ UTRACE_UDATA_RESOURCE=UTRACE_UDATA_START,
+
+ /**
+ * Indicates that a resource bundle was opened.
+ *
+ * Provides one C-style string to UTraceData: file name.
+ * @draft ICU 65
+ */
+ UTRACE_UDATA_BUNDLE,
+
+ /**
+ * Indicates that a data file was opened, but not *.res files.
+ *
+ * Provides one C-style string to UTraceData: file name.
+ *
+ * @draft ICU 65
+ */
+ UTRACE_UDATA_DATA_FILE,
+
+ /**
+ * Indicates that a *.res file was opened.
+ *
+ * This differs from UTRACE_UDATA_BUNDLE because a res file is typically
+ * opened only once per application runtime, but the bundle corresponding
+ * to that res file may be opened many times.
+ *
+ * Provides one C-style string to UTraceData: file name.
+ *
+ * @draft ICU 65
+ */
+ UTRACE_UDATA_RES_FILE,
+
+#endif // U_HIDE_DRAFT_API
+
+#ifndef U_HIDE_INTERNAL_API
+ /**
+ * One more than the highest normal resource/data trace location.
+ * @internal The numeric value may change over time, see ICU ticket #12420.
+ */
+ UTRACE_RES_DATA_LIMIT,
+#endif // U_HIDE_INTERNAL_API
+
} UTraceFunctionNumber;
/**
@@ -151,7 +220,7 @@ UTraceEntry(const void *context, int32_t fnNumber);
* @stable ICU 2.8
*/
typedef void U_CALLCONV
-UTraceExit(const void *context, int32_t fnNumber,
+UTraceExit(const void *context, int32_t fnNumber,
const char *fmt, va_list args);
/**
@@ -187,11 +256,11 @@ UTraceData(const void *context, int32_t fnNumber, int32_t level,
* here will in turn be passed to each of the tracing
* functions UTraceEntry, UTraceExit and UTraceData.
* ICU does not use or alter this pointer.
- * @param e Callback function to be called on entry to a
+ * @param e Callback function to be called on entry to a
* a traced ICU function.
* @param x Callback function to be called on exit from a
* traced ICU function.
- * @param d Callback function to be called from within a
+ * @param d Callback function to be called from within a
* traced ICU function, for the purpose of providing
* data to the trace.
*
@@ -259,7 +328,7 @@ utrace_getFunctions(const void **context,
* - S A UChar * string. Requires two params, (ptr, length). Length=-1 for nul term.
* - b A byte (8-bit integer).
* - h A 16-bit integer. Also a 16 bit Unicode code unit.
- * - d A 32-bit integer. Also a 20 bit Unicode code point value.
+ * - d A 32-bit integer. Also a 20 bit Unicode code point value.
* - l A 64-bit integer.
* - p A data pointer.
*
@@ -291,7 +360,7 @@ utrace_getFunctions(const void **context,
* the type casts will not be necessary in actual code
*
* UTraceDataFunc(context, fnNumber, level,
- * "There is a character %c in the string %s.", // Format String
+ * "There is a character %c in the string %s.", // Format String
* (char)c, (const char *)s); // varargs parameters
* -> There is a character 0x42 'B' in the string "Bravo".
*
@@ -330,7 +399,7 @@ utrace_getFunctions(const void **context,
* @param fmt Format specification for the data to output
* @param args Data to be formatted.
* @return Length of formatted output, including the terminating NUL.
- * If buffer capacity is insufficient, the required capacity is returned.
+ * If buffer capacity is insufficient, the required capacity is returned.
* @stable ICU 2.8
*/
U_STABLE int32_t U_EXPORT2
@@ -351,7 +420,7 @@ utrace_vformat(char *outBuf, int32_t capacity,
* @param fmt Format specification for the data to output
* @param ... Data to be formatted.
* @return Length of formatted output, including the terminating NUL.
- * If buffer capacity is insufficient, the required capacity is returned.
+ * If buffer capacity is insufficient, the required capacity is returned.
* @stable ICU 2.8
*/
U_STABLE int32_t U_EXPORT2
diff --git a/deps/icu-small/source/common/unicode/utypes.h b/deps/icu-small/source/common/unicode/utypes.h
index 49eb12cd40022c..8d8f54764e08bc 100644
--- a/deps/icu-small/source/common/unicode/utypes.h
+++ b/deps/icu-small/source/common/unicode/utypes.h
@@ -211,16 +211,16 @@ typedef double UDate;
/** The number of milliseconds per day @stable ICU 2.0 */
#define U_MILLIS_PER_DAY (86400000)
-/**
- * Maximum UDate value
- * @stable ICU 4.8
- */
+/**
+ * Maximum UDate value
+ * @stable ICU 4.8
+ */
#define U_DATE_MAX DBL_MAX
/**
- * Minimum UDate value
- * @stable ICU 4.8
- */
+ * Minimum UDate value
+ * @stable ICU 4.8
+ */
#define U_DATE_MIN -U_DATE_MAX
/*===========================================================================*/
@@ -385,17 +385,31 @@ typedef double UDate;
/*===========================================================================*/
/**
- * Error code to replace exception handling, so that the code is compatible with all C++ compilers,
- * and to use the same mechanism for C and C++.
+ * Standard ICU4C error code type, a substitute for exceptions.
+ *
+ * Initialize the UErrorCode with U_ZERO_ERROR, and check for success or
+ * failure using U_SUCCESS() or U_FAILURE():
+ *
+ * UErrorCode errorCode = U_ZERO_ERROR;
+ * // call ICU API that needs an error code parameter.
+ * if (U_FAILURE(errorCode)) {
+ * // An error occurred. Handle it here.
+ * }
+ *
+ * C++ code should use icu::ErrorCode, available in unicode/errorcode.h, or a
+ * suitable subclass.
+ *
+ * For more information, see:
+ * http://icu-project.org/userguide/conventions
+ *
+ * Note: By convention, ICU functions that take a reference (C++) or a pointer
+ * (C) to a UErrorCode first test:
+ *
+ * if (U_FAILURE(errorCode)) { return immediately; }
*
- * \par
- * ICU functions that take a reference (C++) or a pointer (C) to a UErrorCode
- * first test if(U_FAILURE(errorCode)) { return immediately; }
* so that in a chain of such functions the first one that sets an error code
* causes the following ones to not perform any operations.
*
- * \par
- * Error codes should be tested using U_FAILURE() and U_SUCCESS().
* @stable ICU 2.0
*/
typedef enum UErrorCode {
@@ -421,7 +435,7 @@ typedef enum UErrorCode {
U_AMBIGUOUS_ALIAS_WARNING = -122, /**< This converter alias can go to different converter implementations */
U_DIFFERENT_UCA_VERSION = -121, /**< ucol_open encountered a mismatch between UCA version and collator image version, so the collator was constructed from rules. No impact to further function */
-
+
U_PLUGIN_CHANGED_LEVEL_WARNING = -120, /**< A plugin caused a level change. May not be an error, but later plugins may not load. */
#ifndef U_HIDE_DEPRECATED_API
@@ -642,7 +656,7 @@ typedef enum UErrorCode {
U_STRINGPREP_PROHIBITED_ERROR = U_IDNA_PROHIBITED_ERROR,
U_STRINGPREP_UNASSIGNED_ERROR = U_IDNA_UNASSIGNED_ERROR,
U_STRINGPREP_CHECK_BIDI_ERROR = U_IDNA_CHECK_BIDI_ERROR,
-
+
/*
* Error codes in the range 0x10500-0x105ff are reserved for Plugin related error codes.
*/
diff --git a/deps/icu-small/source/common/unicode/uvernum.h b/deps/icu-small/source/common/unicode/uvernum.h
index 7c114be2cc87f1..0923c1d9189d0f 100644
--- a/deps/icu-small/source/common/unicode/uvernum.h
+++ b/deps/icu-small/source/common/unicode/uvernum.h
@@ -60,13 +60,13 @@
* This value will change in the subsequent releases of ICU
* @stable ICU 2.4
*/
-#define U_ICU_VERSION_MAJOR_NUM 64
+#define U_ICU_VERSION_MAJOR_NUM 65
/** The current ICU minor version as an integer.
* This value will change in the subsequent releases of ICU
* @stable ICU 2.6
*/
-#define U_ICU_VERSION_MINOR_NUM 2
+#define U_ICU_VERSION_MINOR_NUM 1
/** The current ICU patchlevel version as an integer.
* This value will change in the subsequent releases of ICU
@@ -86,7 +86,7 @@
* This value will change in the subsequent releases of ICU
* @stable ICU 2.6
*/
-#define U_ICU_VERSION_SUFFIX _64
+#define U_ICU_VERSION_SUFFIX _65
/**
* \def U_DEF2_ICU_ENTRY_POINT_RENAME
@@ -139,7 +139,7 @@
* This value will change in the subsequent releases of ICU
* @stable ICU 2.4
*/
-#define U_ICU_VERSION "64.2"
+#define U_ICU_VERSION "65.1"
/**
* The current ICU library major version number as a string, for library name suffixes.
@@ -152,13 +152,13 @@
*
* @stable ICU 2.6
*/
-#define U_ICU_VERSION_SHORT "64"
+#define U_ICU_VERSION_SHORT "65"
#ifndef U_HIDE_INTERNAL_API
/** Data version in ICU4C.
* @internal ICU 4.4 Internal Use Only
**/
-#define U_ICU_DATA_VERSION "64.2"
+#define U_ICU_DATA_VERSION "65.1"
#endif /* U_HIDE_INTERNAL_API */
/*===========================================================================
diff --git a/deps/icu-small/source/common/unicode/uversion.h b/deps/icu-small/source/common/unicode/uversion.h
index 3f0251d3994bcb..5700f62cbff3b9 100644
--- a/deps/icu-small/source/common/unicode/uversion.h
+++ b/deps/icu-small/source/common/unicode/uversion.h
@@ -18,7 +18,7 @@
/**
* \file
- * \brief C API: API for accessing ICU version numbers.
+ * \brief C API: API for accessing ICU version numbers.
*/
/*===========================================================================*/
/* Main ICU version information */
@@ -62,26 +62,22 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
/* C++ namespace if supported. Versioned unless versioning is disabled. */
/*===========================================================================*/
+/* Define C++ namespace symbols. */
+#ifdef __cplusplus
+
/**
* \def U_NAMESPACE_BEGIN
- * This is used to begin a declaration of a public ICU C++ API.
- * When not compiling for C++, it does nothing.
- * When compiling for C++, it begins an extern "C++" linkage block (to protect
- * against cases in which an external client includes ICU header files inside
- * an extern "C" linkage block).
+ * This is used to begin a declaration of a public ICU C++ API within
+ * versioned-ICU-namespace block.
*
- * It also begins a versioned-ICU-namespace block.
* @stable ICU 2.4
*/
/**
* \def U_NAMESPACE_END
* This is used to end a declaration of a public ICU C++ API.
- * When not compiling for C++, it does nothing.
- * When compiling for C++, it ends the extern "C++" block begun by
- * U_NAMESPACE_BEGIN.
+ * It ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN.
*
- * It also ends the versioned-ICU-namespace block begun by U_NAMESPACE_BEGIN.
* @stable ICU 2.4
*/
@@ -89,9 +85,6 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
* \def U_NAMESPACE_USE
* This is used to specify that the rest of the code uses the
* public ICU C++ API namespace.
- * This is invoked by default; we recommend that you turn it off:
- * See the "Recommended Build Options" section of the ICU4C readme
- * (http://source.icu-project.org/repos/icu/icu/trunk/readme.html#RecBuild)
* @stable ICU 2.4
*/
@@ -105,8 +98,6 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
* @stable ICU 2.4
*/
-/* Define C++ namespace symbols. */
-#ifdef __cplusplus
# if U_DISABLE_RENAMING
# define U_ICU_NAMESPACE icu
namespace U_ICU_NAMESPACE { }
@@ -116,8 +107,8 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
namespace icu = U_ICU_NAMESPACE;
# endif
-# define U_NAMESPACE_BEGIN extern "C++" { namespace U_ICU_NAMESPACE {
-# define U_NAMESPACE_END } }
+# define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE {
+# define U_NAMESPACE_END }
# define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE;
# define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
@@ -133,12 +124,7 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH];
# if U_USING_ICU_NAMESPACE
U_NAMESPACE_USE
# endif
-#else
-# define U_NAMESPACE_BEGIN
-# define U_NAMESPACE_END
-# define U_NAMESPACE_USE
-# define U_NAMESPACE_QUALIFIER
-#endif
+#endif /* __cplusplus */
/*===========================================================================*/
/* General version helper functions. Definitions in putil.c */
diff --git a/deps/icu-small/source/common/unifiedcache.cpp b/deps/icu-small/source/common/unifiedcache.cpp
index 641f4ec6594e12..f2dd916559588c 100644
--- a/deps/icu-small/source/common/unifiedcache.cpp
+++ b/deps/icu-small/source/common/unifiedcache.cpp
@@ -13,22 +13,15 @@
#include "unifiedcache.h"
#include // For std::max()
+#include
-#include "mutex.h"
#include "uassert.h"
#include "uhash.h"
#include "ucln_cmn.h"
-#include "umutex.h"
static icu::UnifiedCache *gCache = NULL;
-static icu::UMutex *gCacheMutex() {
- static icu::UMutex m = U_MUTEX_INITIALIZER;
- return &m;
-}
-static icu::UConditionVar *gInProgressValueAddedCond() {
- static icu::UConditionVar cv = U_CONDITION_INITIALIZER;
- return &cv;
-}
+static std::mutex *gCacheMutex = nullptr;
+static std::condition_variable *gInProgressValueAddedCond;
static icu::UInitOnce gCacheInitOnce = U_INITONCE_INITIALIZER;
static const int32_t MAX_EVICT_ITERATIONS = 10;
@@ -39,10 +32,12 @@ static const int32_t DEFAULT_PERCENTAGE_OF_IN_USE = 100;
U_CDECL_BEGIN
static UBool U_CALLCONV unifiedcache_cleanup() {
gCacheInitOnce.reset();
- if (gCache) {
- delete gCache;
- gCache = NULL;
- }
+ delete gCache;
+ gCache = nullptr;
+ gCacheMutex->~mutex();
+ gCacheMutex = nullptr;
+ gInProgressValueAddedCond->~condition_variable();
+ gInProgressValueAddedCond = nullptr;
return TRUE;
}
U_CDECL_END
@@ -77,6 +72,8 @@ static void U_CALLCONV cacheInit(UErrorCode &status) {
ucln_common_registerCleanup(
UCLN_COMMON_UNIFIED_CACHE, unifiedcache_cleanup);
+ gCacheMutex = STATIC_NEW(std::mutex);
+ gInProgressValueAddedCond = STATIC_NEW(std::condition_variable);
gCache = new UnifiedCache(status);
if (gCache == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
@@ -138,28 +135,28 @@ void UnifiedCache::setEvictionPolicy(
status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
- Mutex lock(gCacheMutex());
+ std::lock_guard lock(*gCacheMutex);
fMaxUnused = count;
fMaxPercentageOfInUse = percentageOfInUseItems;
}
int32_t UnifiedCache::unusedCount() const {
- Mutex lock(gCacheMutex());
+ std::lock_guard lock(*gCacheMutex);
return uhash_count(fHashtable) - fNumValuesInUse;
}
int64_t UnifiedCache::autoEvictedCount() const {
- Mutex lock(gCacheMutex());
+ std::lock_guard lock(*gCacheMutex);
return fAutoEvictedCount;
}
int32_t UnifiedCache::keyCount() const {
- Mutex lock(gCacheMutex());
+ std::lock_guard lock(*gCacheMutex);
return uhash_count(fHashtable);
}
void UnifiedCache::flush() const {
- Mutex lock(gCacheMutex());
+ std::lock_guard lock(*gCacheMutex);
// Use a loop in case cache items that are flushed held hard references to
// other cache items making those additional cache items eligible for
@@ -168,7 +165,7 @@ void UnifiedCache::flush() const {
}
void UnifiedCache::handleUnreferencedObject() const {
- Mutex lock(gCacheMutex());
+ std::lock_guard lock(*gCacheMutex);
--fNumValuesInUse;
_runEvictionSlice();
}
@@ -187,7 +184,7 @@ void UnifiedCache::dump() {
}
void UnifiedCache::dumpContents() const {
- Mutex lock(gCacheMutex());
+ std::lock_guard lock(*gCacheMutex);
_dumpContents();
}
@@ -227,7 +224,7 @@ UnifiedCache::~UnifiedCache() {
// Now all that should be left in the cache are entries that refer to
// each other and entries with hard references from outside the cache.
// Nothing we can do about these so proceed to wipe out the cache.
- Mutex lock(gCacheMutex());
+ std::lock_guard lock(*gCacheMutex);
_flush(TRUE);
}
uhash_close(fHashtable);
@@ -328,7 +325,7 @@ void UnifiedCache::_putIfAbsentAndGet(
const CacheKeyBase &key,
const SharedObject *&value,
UErrorCode &status) const {
- Mutex lock(gCacheMutex());
+ std::lock_guard lock(*gCacheMutex);
const UHashElement *element = uhash_find(fHashtable, &key);
if (element != NULL && !_inProgress(element)) {
_fetch(element, value, status);
@@ -353,15 +350,15 @@ UBool UnifiedCache::_poll(
UErrorCode &status) const {
U_ASSERT(value == NULL);
U_ASSERT(status == U_ZERO_ERROR);
- Mutex lock(gCacheMutex());
+ std::unique_lock lock(*gCacheMutex);
const UHashElement *element = uhash_find(fHashtable, &key);
// If the hash table contains an inProgress placeholder entry for this key,
// this means that another thread is currently constructing the value object.
// Loop, waiting for that construction to complete.
while (element != NULL && _inProgress(element)) {
- umtx_condWait(gInProgressValueAddedCond(), gCacheMutex());
- element = uhash_find(fHashtable, &key);
+ gInProgressValueAddedCond->wait(lock);
+ element = uhash_find(fHashtable, &key);
}
// If the hash table contains an entry for the key,
@@ -433,7 +430,7 @@ void UnifiedCache::_put(
// Tell waiting threads that we replace in-progress status with
// an error.
- umtx_condBroadcast(gInProgressValueAddedCond());
+ gInProgressValueAddedCond->notify_all();
}
void UnifiedCache::_fetch(
diff --git a/deps/icu-small/source/common/unifiedcache.h b/deps/icu-small/source/common/unifiedcache.h
index 5c0bd76f4a2b94..d6c9945126c222 100644
--- a/deps/icu-small/source/common/unifiedcache.h
+++ b/deps/icu-small/source/common/unifiedcache.h
@@ -39,7 +39,7 @@ class U_COMMON_API CacheKeyBase : public UObject {
/**
* Copy constructor. Needed to support cloning.
*/
- CacheKeyBase(const CacheKeyBase &other)
+ CacheKeyBase(const CacheKeyBase &other)
: UObject(other), fCreationStatus(other.fCreationStatus), fIsMaster(FALSE) { }
virtual ~CacheKeyBase();
@@ -95,7 +95,7 @@ class U_COMMON_API CacheKeyBase : public UObject {
/**
- * Templated version of CacheKeyBase.
+ * Templated version of CacheKeyBase.
* A key of type LocaleCacheKey maps to a value of type T.
*/
template
@@ -343,7 +343,7 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
virtual void handleUnreferencedObject() const;
virtual ~UnifiedCache();
-
+
private:
UHashtable *fHashtable;
mutable int32_t fEvictPos;
@@ -353,17 +353,17 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
int32_t fMaxPercentageOfInUse;
mutable int64_t fAutoEvictedCount;
SharedObject *fNoValue;
-
+
UnifiedCache(const UnifiedCache &other);
UnifiedCache &operator=(const UnifiedCache &other);
-
+
/**
* Flushes the contents of the cache. If cache values hold references to other
* cache values then _flush should be called in a loop until it returns FALSE.
- *
+ *
* On entry, gCacheMutex must be held.
* On exit, those values with are evictable are flushed.
- *
+ *
* @param all if false flush evictable items only, which are those with no external
* references, plus those that can be safely recreated.
* if true, flush all elements. Any values (sharedObjects) with remaining
@@ -373,7 +373,7 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
* @return TRUE if any value in cache was flushed or FALSE otherwise.
*/
UBool _flush(UBool all) const;
-
+
/**
* Gets value out of cache.
* On entry. gCacheMutex must not be held. value must be NULL. status
@@ -406,10 +406,10 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
const CacheKeyBase &key,
const SharedObject *&value,
UErrorCode &status) const;
-
+
/**
* Places a new value and creationStatus in the cache for the given key.
- * On entry, gCacheMutex must be held. key must not exist in the cache.
+ * On entry, gCacheMutex must be held. key must not exist in the cache.
* On exit, value and creation status placed under key. Soft reference added
* to value on successful add. On error sets status.
*/
@@ -418,15 +418,15 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
const SharedObject *value,
const UErrorCode creationStatus,
UErrorCode &status) const;
-
+
/**
* Places value and status at key if there is no value at key or if cache
* entry for key is in progress. Otherwise, it leaves the current value and
* status there.
- *
+ *
* On entry. gCacheMutex must not be held. Value must be
* included in the reference count of the object to which it points.
- *
+ *
* On exit, value and status are changed to what was already in the cache if
* something was there and not in progress. Otherwise, value and status are left
* unchanged in which case they are placed in the cache on a best-effort basis.
@@ -443,17 +443,17 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
* On entry, gCacheMutex must be held.
*/
const UHashElement *_nextElement() const;
-
+
/**
* Return the number of cache items that would need to be evicted
* to bring usage into conformance with eviction policy.
- *
+ *
* An item corresponds to an entry in the hash table, a hash table element.
- *
+ *
* On entry, gCacheMutex must be held.
*/
int32_t _computeCountOfItemsToEvict() const;
-
+
/**
* Run an eviction slice.
* On entry, gCacheMutex must be held.
@@ -461,20 +461,20 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
* 10 entries in the cache round robin style evicting them if they are eligible.
*/
void _runEvictionSlice() const;
-
+
/**
* Register a master cache entry. A master key is the first key to create
* a given SharedObject value. Subsequent keys whose create function
* produce referneces to an already existing SharedObject are not masters -
* they can be evicted and subsequently recreated.
- *
+ *
* On entry, gCacheMutex must be held.
* On exit, items in use count incremented, entry is marked as a master
* entry, and value registered with cache so that subsequent calls to
* addRef() and removeRef() on it correctly interact with the cache.
*/
void _registerMaster(const CacheKeyBase *theKey, const SharedObject *value) const;
-
+
/**
* Store a value and creation error status in given hash entry.
* On entry, gCacheMutex must be held. Hash entry element must be in progress.
@@ -494,32 +494,32 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
* @param value the SharedObject to be acted on.
*/
void removeSoftRef(const SharedObject *value) const;
-
+
/**
* Increment the hard reference count of the given SharedObject.
* gCacheMutex must be held by the caller.
* Update numValuesEvictable on transitions between zero and one reference.
- *
+ *
* @param value The SharedObject to be referenced.
* @return the hard reference count after the addition.
*/
int32_t addHardRef(const SharedObject *value) const;
-
+
/**
* Decrement the hard reference count of the given SharedObject.
* gCacheMutex must be held by the caller.
* Update numValuesEvictable on transitions between one and zero reference.
- *
+ *
* @param value The SharedObject to be referenced.
* @return the hard reference count after the removal.
*/
int32_t removeHardRef(const SharedObject *value) const;
-
+
#ifdef UNIFIED_CACHE_DEBUG
void _dumpContents() const;
#endif
-
+
/**
* Fetch value and error code from a particular hash entry.
* On entry, gCacheMutex must be held. value must be either NULL or must be
@@ -531,19 +531,19 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
*/
void _fetch(const UHashElement *element, const SharedObject *&value,
UErrorCode &status) const;
-
+
/**
* Determine if given hash entry is in progress.
* On entry, gCacheMutex must be held.
*/
UBool _inProgress(const UHashElement *element) const;
-
+
/**
* Determine if given hash entry is in progress.
* On entry, gCacheMutex must be held.
*/
UBool _inProgress(const SharedObject *theValue, UErrorCode creationStatus) const;
-
+
/**
* Determine if given hash entry is eligible for eviction.
* On entry, gCacheMutex must be held.
diff --git a/deps/icu-small/source/common/uniset.cpp b/deps/icu-small/source/common/uniset.cpp
index 1db382afe6f6ba..b73d612f246884 100644
--- a/deps/icu-small/source/common/uniset.cpp
+++ b/deps/icu-small/source/common/uniset.cpp
@@ -278,11 +278,11 @@ UnicodeSet& UnicodeSet::copyFrom(const UnicodeSet& o, UBool asThawed) {
* to support cloning in order to allow classes using
* UnicodeMatchers, such as Transliterator, to implement cloning.
*/
-UnicodeFunctor* UnicodeSet::clone() const {
+UnicodeSet* UnicodeSet::clone() const {
return new UnicodeSet(*this);
}
-UnicodeFunctor *UnicodeSet::cloneAsThawed() const {
+UnicodeSet *UnicodeSet::cloneAsThawed() const {
return new UnicodeSet(*this, TRUE);
}
@@ -1630,7 +1630,7 @@ UBool UnicodeSet::allocateStrings(UErrorCode &status) {
delete strings;
strings = NULL;
return FALSE;
- }
+ }
return TRUE;
}
@@ -2172,7 +2172,7 @@ void UnicodeSet::setPattern(const char16_t *newPat, int32_t newPatLen) {
// We can regenerate an equivalent pattern later when requested.
}
-UnicodeFunctor *UnicodeSet::freeze() {
+UnicodeSet *UnicodeSet::freeze() {
if(!isFrozen() && !isBogus()) {
compact();
diff --git a/deps/icu-small/source/common/uniset_props.cpp b/deps/icu-small/source/common/uniset_props.cpp
index 6f7918a91ab9ed..37277fcb751f44 100644
--- a/deps/icu-small/source/common/uniset_props.cpp
+++ b/deps/icu-small/source/common/uniset_props.cpp
@@ -365,7 +365,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
mode = 1;
patLocal.append((UChar) 0x5B /*'['*/);
chars.getPos(backup); // prepare to backup
- c = chars.next(opts, literal, ec);
+ c = chars.next(opts, literal, ec);
if (U_FAILURE(ec)) return;
if (c == 0x5E /*'^'*/ && !literal) {
invert = TRUE;
@@ -802,7 +802,10 @@ static UBool mungeCharName(char* dst, const char* src, int32_t dstCapacity) {
// Property set API
//----------------------------------------------------------------
-#define FAIL(ec) {ec=U_ILLEGAL_ARGUMENT_ERROR; return *this;}
+#define FAIL(ec) UPRV_BLOCK_MACRO_BEGIN { \
+ ec=U_ILLEGAL_ARGUMENT_ERROR; \
+ return *this; \
+} UPRV_BLOCK_MACRO_END
UnicodeSet&
UnicodeSet::applyIntPropertyValue(UProperty prop, int32_t value, UErrorCode& ec) {
@@ -1113,7 +1116,7 @@ UnicodeSet& UnicodeSet::applyPropertyPattern(const UnicodeString& pattern,
else {
// Handle case where no '=' is seen, and \N{}
pattern.extractBetween(pos, close, propName);
-
+
// Handle \N{name}
if (isName) {
// This is a little inefficient since it means we have to
@@ -1132,7 +1135,7 @@ UnicodeSet& UnicodeSet::applyPropertyPattern(const UnicodeString& pattern,
if (invert) {
complement();
}
-
+
// Move to the limit position after the close delimiter if the
// parse succeeded.
ppos.setIndex(close + (posix ? 2 : 1));
diff --git a/deps/icu-small/source/common/unisetspan.cpp b/deps/icu-small/source/common/unisetspan.cpp
index 0a8893472f958b..68e44d91ee7066 100644
--- a/deps/icu-small/source/common/unisetspan.cpp
+++ b/deps/icu-small/source/common/unisetspan.cpp
@@ -400,7 +400,7 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSetStringSpan &otherStri
if(otherStringSpan.pSpanNotSet==&otherStringSpan.spanSet) {
pSpanNotSet=&spanSet;
} else {
- pSpanNotSet=(UnicodeSet *)otherStringSpan.pSpanNotSet->clone();
+ pSpanNotSet=otherStringSpan.pSpanNotSet->clone();
}
// Allocate a block of meta data.
@@ -436,7 +436,7 @@ void UnicodeSetStringSpan::addToSpanNotSet(UChar32 c) {
if(spanSet.contains(c)) {
return; // Nothing to do.
}
- UnicodeSet *newSet=(UnicodeSet *)spanSet.cloneAsThawed();
+ UnicodeSet *newSet=spanSet.cloneAsThawed();
if(newSet==NULL) {
return; // Out of memory.
} else {
diff --git a/deps/icu-small/source/common/unistr.cpp b/deps/icu-small/source/common/unistr.cpp
index 31b0ed84bee07d..901bb3358ba56c 100644
--- a/deps/icu-small/source/common/unistr.cpp
+++ b/deps/icu-small/source/common/unistr.cpp
@@ -332,7 +332,7 @@ Replaceable::clone() const {
}
// UnicodeString overrides clone() with a real implementation
-Replaceable *
+UnicodeString *
UnicodeString::clone() const {
return new UnicodeString(*this);
}
@@ -672,7 +672,7 @@ UnicodeString::doCompare( int32_t start,
if(isBogus()) {
return -1;
}
-
+
// pin indices to legal values
pinIndices(start, length);
@@ -720,7 +720,7 @@ UnicodeString::doCompare( int32_t start,
if(minLength > 0 && chars != srcChars) {
int32_t result;
-# if U_IS_BIG_ENDIAN
+# if U_IS_BIG_ENDIAN
// big-endian: byte comparison works
result = uprv_memcmp(chars, srcChars, minLength * sizeof(UChar));
if(result != 0) {
@@ -952,7 +952,7 @@ UnicodeString::extract(int32_t start, int32_t len,
// else see unistr_cnv.cpp
#endif
-void
+void
UnicodeString::extractBetween(int32_t start,
int32_t limit,
UnicodeString& target) const {
@@ -1021,7 +1021,7 @@ UnicodeString::toUTF32(UChar32 *utf32, int32_t capacity, UErrorCode &errorCode)
return length32;
}
-int32_t
+int32_t
UnicodeString::indexOf(const UChar *srcChars,
int32_t srcStart,
int32_t srcLength,
@@ -1085,7 +1085,7 @@ UnicodeString::doIndexOf(UChar32 c,
}
}
-int32_t
+int32_t
UnicodeString::lastIndexOf(const UChar *srcChars,
int32_t srcStart,
int32_t srcLength,
@@ -1157,7 +1157,7 @@ UnicodeString::doLastIndexOf(UChar32 c,
// Write implementation
//========================================
-UnicodeString&
+UnicodeString&
UnicodeString::findAndReplace(int32_t start,
int32_t length,
const UnicodeString& oldText,
@@ -1611,7 +1611,7 @@ UnicodeString::handleReplaceBetween(int32_t start,
/**
* Replaceable API
*/
-void
+void
UnicodeString::copy(int32_t start, int32_t limit, int32_t dest) {
if (limit <= start) {
return; // Nothing to do; avoid bogus malloc call
@@ -1620,7 +1620,7 @@ UnicodeString::copy(int32_t start, int32_t limit, int32_t dest) {
// Check to make sure text is not null.
if (text != NULL) {
extractBetween(start, limit, text, 0);
- insert(dest, text, 0, limit - start);
+ insert(dest, text, 0, limit - start);
uprv_free(text);
}
}
@@ -1688,7 +1688,7 @@ UnicodeString::doReverse(int32_t start, int32_t length) {
return *this;
}
-UBool
+UBool
UnicodeString::padLeading(int32_t targetLength,
UChar padChar)
{
@@ -1710,7 +1710,7 @@ UnicodeString::padLeading(int32_t targetLength,
}
}
-UBool
+UBool
UnicodeString::padTrailing(int32_t targetLength,
UChar padChar)
{
diff --git a/deps/icu-small/source/common/unistr_props.cpp b/deps/icu-small/source/common/unistr_props.cpp
index 691bd085d6a923..40064757902ca8 100644
--- a/deps/icu-small/source/common/unistr_props.cpp
+++ b/deps/icu-small/source/common/unistr_props.cpp
@@ -25,7 +25,7 @@
U_NAMESPACE_BEGIN
-UnicodeString&
+UnicodeString&
UnicodeString::trim()
{
if(isBogus()) {
diff --git a/deps/icu-small/source/common/unistrappender.h b/deps/icu-small/source/common/unistrappender.h
index 134f31497f1525..75fcb9e775f1eb 100644
--- a/deps/icu-small/source/common/unistrappender.h
+++ b/deps/icu-small/source/common/unistrappender.h
@@ -26,7 +26,7 @@ U_NAMESPACE_BEGIN
* one character at a time in a loop. It stores appends in a buffer while
* never actually calling append on the unicode string unless the buffer
* fills up or is flushed.
- *
+ *
* proper usage:
* {
* UnicodeStringAppender appender(astring);
@@ -38,7 +38,7 @@ U_NAMESPACE_BEGIN
*/
class UnicodeStringAppender : public UMemory {
public:
-
+
/**
* dest is the UnicodeString being appended to. It must always
* exist while this instance exists.
diff --git a/deps/icu-small/source/common/unorm.cpp b/deps/icu-small/source/common/unorm.cpp
index 93f77e66afb40e..2d9f46052ffc43 100644
--- a/deps/icu-small/source/common/unorm.cpp
+++ b/deps/icu-small/source/common/unorm.cpp
@@ -15,8 +15,8 @@
* 02/01/01 synwee Added normalization quickcheck enum and method.
* 02/12/01 synwee Commented out quickcheck util api has been approved
* Added private method for doing FCD checks
-* 02/23/01 synwee Modified quickcheck and checkFCE to run through
-* string for codepoints < 0x300 for the normalization
+* 02/23/01 synwee Modified quickcheck and checkFCE to run through
+* string for codepoints < 0x300 for the normalization
* mode NFC.
* 05/25/01+ Markus Scherer total rewrite, implement all normalization here
* instead of just wrappers around normlzr.cpp,
@@ -45,7 +45,7 @@ U_NAMESPACE_USE
U_CAPI UNormalizationCheckResult U_EXPORT2
unorm_quickCheck(const UChar *src,
- int32_t srcLength,
+ int32_t srcLength,
UNormalizationMode mode,
UErrorCode *pErrorCode) {
const Normalizer2 *n2=Normalizer2Factory::getInstance(mode, *pErrorCode);
@@ -53,7 +53,7 @@ unorm_quickCheck(const UChar *src,
}
U_CAPI UNormalizationCheckResult U_EXPORT2
-unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength,
+unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength,
UNormalizationMode mode, int32_t options,
UErrorCode *pErrorCode) {
const Normalizer2 *n2=Normalizer2Factory::getInstance(mode, *pErrorCode);
diff --git a/deps/icu-small/source/common/unormimp.h b/deps/icu-small/source/common/unormimp.h
index 7f280551f7ef8e..88c7975cc4e783 100644
--- a/deps/icu-small/source/common/unormimp.h
+++ b/deps/icu-small/source/common/unormimp.h
@@ -188,7 +188,7 @@ enum {
* int32_t indexes[_NORM_INDEX_TOP]; -- _NORM_INDEX_TOP=32, see enum in this file
*
* UTrie normTrie; -- size in bytes=indexes[_NORM_INDEX_TRIE_SIZE]
- *
+ *
* uint16_t extraData[extraDataTop]; -- extraDataTop=indexes[_NORM_INDEX_UCHAR_COUNT]
* extraData[0] contains the number of units for
* FC_NFKC_Closure (formatVersion>=2.1)
diff --git a/deps/icu-small/source/common/ures_cnv.cpp b/deps/icu-small/source/common/ures_cnv.cpp
index 43515fda282972..1aa58e753ceeb4 100644
--- a/deps/icu-small/source/common/ures_cnv.cpp
+++ b/deps/icu-small/source/common/ures_cnv.cpp
@@ -27,8 +27,8 @@
#include "ustr_cnv.h"
U_CAPI UResourceBundle * U_EXPORT2
-ures_openU(const UChar *myPath,
- const char *localeID,
+ures_openU(const UChar *myPath,
+ const char *localeID,
UErrorCode *status)
{
char pathBuffer[1024];
diff --git a/deps/icu-small/source/common/uresbund.cpp b/deps/icu-small/source/common/uresbund.cpp
index c9f2c860da7c33..6c0e760389d753 100644
--- a/deps/icu-small/source/common/uresbund.cpp
+++ b/deps/icu-small/source/common/uresbund.cpp
@@ -31,6 +31,7 @@
#include "ucln_cmn.h"
#include "cmemory.h"
#include "cstring.h"
+#include "mutex.h"
#include "uhash.h"
#include "unicode/uenum.h"
#include "uenumimp.h"
@@ -38,6 +39,7 @@
#include "umutex.h"
#include "putilimp.h"
#include "uassert.h"
+#include "uresdata.h"
using namespace icu;
@@ -47,12 +49,9 @@ TODO: This cache should probably be removed when the deprecated code is
completely removed.
*/
static UHashtable *cache = NULL;
-static icu::UInitOnce gCacheInitOnce;
+static icu::UInitOnce gCacheInitOnce = U_INITONCE_INITIALIZER;
-static UMutex *resbMutex() {
- static UMutex m = U_MUTEX_INITIALIZER;
- return &m;
-}
+static UMutex resbMutex;
/* INTERNAL: hashes an entry */
static int32_t U_CALLCONV hashEntry(const UHashTok parm) {
@@ -78,7 +77,7 @@ static UBool U_CALLCONV compareEntries(const UHashTok p1, const UHashTok p2) {
/**
- * Internal function, gets parts of locale name according
+ * Internal function, gets parts of locale name according
* to the position of '_' character
*/
static UBool chopLocale(char *name) {
@@ -96,17 +95,16 @@ static UBool chopLocale(char *name) {
* Internal function
*/
static void entryIncrease(UResourceDataEntry *entry) {
- umtx_lock(resbMutex());
+ Mutex lock(&resbMutex);
entry->fCountExisting++;
while(entry->fParent != NULL) {
entry = entry->fParent;
entry->fCountExisting++;
}
- umtx_unlock(resbMutex());
}
/**
- * Internal function. Tries to find a resource in given Resource
+ * Internal function. Tries to find a resource in given Resource
* Bundle, as well as in its parents
*/
static const ResourceData *getFallbackData(const UResourceBundle* resBundle, const char* * resTag, UResourceDataEntry* *realData, Resource *res, UErrorCode *status) {
@@ -184,9 +182,8 @@ static int32_t ures_flushCache()
/*if shared data hasn't even been lazy evaluated yet
* return 0
*/
- umtx_lock(resbMutex());
+ Mutex lock(&resbMutex);
if (cache == NULL) {
- umtx_unlock(resbMutex());
return 0;
}
@@ -218,7 +215,6 @@ static int32_t ures_flushCache()
* got decremented by free_entry().
*/
} while(deletedMore);
- umtx_unlock(resbMutex());
return rbDeletedNum;
}
@@ -231,10 +227,9 @@ U_CAPI UBool U_EXPORT2 ures_dumpCacheContents(void) {
int32_t pos = UHASH_FIRST;
const UHashElement *e;
UResourceDataEntry *resB;
-
- umtx_lock(resbMutex());
+
+ Mutex lock(&resbMutex);
if (cache == NULL) {
- umtx_unlock(resbMutex());
fprintf(stderr,"%s:%d: RB Cache is NULL.\n", __FILE__, __LINE__);
return FALSE;
}
@@ -249,13 +244,10 @@ U_CAPI UBool U_EXPORT2 ures_dumpCacheContents(void) {
resB->fPath?resB->fPath:"NULL",
(void*)resB->fPool,
(void*)resB->fAlias,
- (void*)resB->fParent);
+ (void*)resB->fParent);
}
-
+
fprintf(stderr,"%s:%d: RB Cache still contains %d items.\n", __FILE__, __LINE__, uhash_count(cache));
-
- umtx_unlock(resbMutex());
-
return cacheNotEmpty;
}
@@ -278,7 +270,7 @@ static void U_CALLCONV createCache(UErrorCode &status) {
cache = uhash_open(hashEntry, compareEntries, NULL, &status);
ucln_common_registerCleanup(UCLN_COMMON_URES, ures_cleanup);
}
-
+
static void initCache(UErrorCode *status) {
umtx_initOnce(gCacheInitOnce, &createCache, *status);
}
@@ -401,7 +393,8 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE
/* We'll try to get alias string from the bundle */
aliasres = res_getResource(&(r->fData), "%%ALIAS");
if (aliasres != RES_BOGUS) {
- const UChar *alias = res_getString(&(r->fData), aliasres, &aliasLen);
+ // No tracing: called during initial data loading
+ const UChar *alias = res_getStringNoTrace(&(r->fData), aliasres, &aliasLen);
if(alias != NULL && aliasLen > 0) { /* if there is actual alias - unload and load new data */
u_UCharsToChars(alias, aliasName, aliasLen+1);
r->fAlias = init_entry(aliasName, path, status);
@@ -542,7 +535,8 @@ loadParentsExceptRoot(UResourceDataEntry *&t1,
Resource parentRes = res_getResource(&t1->fData, "%%Parent");
if (parentRes != RES_BOGUS) { // An explicit parent was found.
int32_t parentLocaleLen = 0;
- const UChar *parentLocaleName = res_getString(&(t1->fData), parentRes, &parentLocaleLen);
+ // No tracing: called during initial data loading
+ const UChar *parentLocaleName = res_getStringNoTrace(&(t1->fData), parentRes, &parentLocaleLen);
if(parentLocaleName != NULL && 0 < parentLocaleLen && parentLocaleLen < nameCapacity) {
u_UCharsToChars(parentLocaleName, name, parentLocaleLen + 1);
if (uprv_strcmp(name, kRootLocaleName) == 0) {
@@ -665,111 +659,109 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID,
usrDataPath[sizeof(usrDataPath) - 1] = 0;
}
}
+
+ Mutex lock(&resbMutex); // Lock resbMutex until the end of this function.
- umtx_lock(resbMutex());
- { /* umtx_lock */
- /* We're going to skip all the locales that do not have any data */
- r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus);
+ /* We're going to skip all the locales that do not have any data */
+ r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus);
+
+ // If we failed due to out-of-memory, report the failure and exit early.
+ if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
+ *status = intStatus;
+ goto finish;
+ }
+
+ if(r != NULL) { /* if there is one real locale, we can look for parents. */
+ t1 = r;
+ hasRealData = TRUE;
+ if ( usingUSRData ) { /* This code inserts user override data into the inheritance chain */
+ UErrorCode usrStatus = U_ZERO_ERROR;
+ UResourceDataEntry *u1 = init_entry(t1->fName, usrDataPath, &usrStatus);
+ // If we failed due to out-of-memory, report the failure and exit early.
+ if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
+ *status = intStatus;
+ goto finish;
+ }
+ if ( u1 != NULL ) {
+ if(u1->fBogus == U_ZERO_ERROR) {
+ u1->fParent = t1;
+ r = u1;
+ } else {
+ /* the USR override data wasn't found, set it to be deleted */
+ u1->fCountExisting = 0;
+ }
+ }
+ }
+ if (hasChopped && !isRoot) {
+ if (!loadParentsExceptRoot(t1, name, UPRV_LENGTHOF(name), usingUSRData, usrDataPath, status)) {
+ goto finish;
+ }
+ }
+ }
+ /* we could have reached this point without having any real data */
+ /* if that is the case, we need to chain in the default locale */
+ if(r==NULL && openType == URES_OPEN_LOCALE_DEFAULT_ROOT && !isDefault && !isRoot) {
+ /* insert default locale */
+ uprv_strcpy(name, uloc_getDefault());
+ r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus);
// If we failed due to out-of-memory, report the failure and exit early.
if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
*status = intStatus;
- goto finishUnlock;
+ goto finish;
}
-
- if(r != NULL) { /* if there is one real locale, we can look for parents. */
+ intStatus = U_USING_DEFAULT_WARNING;
+ if(r != NULL) { /* the default locale exists */
t1 = r;
hasRealData = TRUE;
- if ( usingUSRData ) { /* This code inserts user override data into the inheritance chain */
- UErrorCode usrStatus = U_ZERO_ERROR;
- UResourceDataEntry *u1 = init_entry(t1->fName, usrDataPath, &usrStatus);
- // If we failed due to out-of-memory, report the failure and exit early.
- if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
- *status = intStatus;
- goto finishUnlock;
- }
- if ( u1 != NULL ) {
- if(u1->fBogus == U_ZERO_ERROR) {
- u1->fParent = t1;
- r = u1;
- } else {
- /* the USR override data wasn't found, set it to be deleted */
- u1->fCountExisting = 0;
- }
- }
- }
+ isDefault = TRUE;
+ // TODO: Why not if (usingUSRData) { ... } like in the non-default-locale code path?
if (hasChopped && !isRoot) {
if (!loadParentsExceptRoot(t1, name, UPRV_LENGTHOF(name), usingUSRData, usrDataPath, status)) {
- goto finishUnlock;
+ goto finish;
}
}
}
+ }
- /* we could have reached this point without having any real data */
- /* if that is the case, we need to chain in the default locale */
- if(r==NULL && openType == URES_OPEN_LOCALE_DEFAULT_ROOT && !isDefault && !isRoot) {
- /* insert default locale */
- uprv_strcpy(name, uloc_getDefault());
- r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus);
- // If we failed due to out-of-memory, report the failure and exit early.
- if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
- *status = intStatus;
- goto finishUnlock;
- }
+ /* we could still have r == NULL at this point - maybe even default locale is not */
+ /* present */
+ if(r == NULL) {
+ uprv_strcpy(name, kRootLocaleName);
+ r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus);
+ // If we failed due to out-of-memory, report the failure and exit early.
+ if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
+ *status = intStatus;
+ goto finish;
+ }
+ if(r != NULL) {
+ t1 = r;
intStatus = U_USING_DEFAULT_WARNING;
- if(r != NULL) { /* the default locale exists */
- t1 = r;
- hasRealData = TRUE;
- isDefault = TRUE;
- // TODO: Why not if (usingUSRData) { ... } like in the non-default-locale code path?
- if (hasChopped && !isRoot) {
- if (!loadParentsExceptRoot(t1, name, UPRV_LENGTHOF(name), usingUSRData, usrDataPath, status)) {
- goto finishUnlock;
- }
- }
- }
+ hasRealData = TRUE;
+ } else { /* we don't even have the root locale */
+ *status = U_MISSING_RESOURCE_ERROR;
+ goto finish;
}
-
- /* we could still have r == NULL at this point - maybe even default locale is not */
- /* present */
- if(r == NULL) {
- uprv_strcpy(name, kRootLocaleName);
- r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus);
- // If we failed due to out-of-memory, report the failure and exit early.
- if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
- *status = intStatus;
- goto finishUnlock;
- }
- if(r != NULL) {
- t1 = r;
- intStatus = U_USING_DEFAULT_WARNING;
- hasRealData = TRUE;
- } else { /* we don't even have the root locale */
- *status = U_MISSING_RESOURCE_ERROR;
- goto finishUnlock;
- }
- } else if(!isRoot && uprv_strcmp(t1->fName, kRootLocaleName) != 0 &&
- t1->fParent == NULL && !r->fData.noFallback) {
- if (!insertRootBundle(t1, status)) {
- goto finishUnlock;
- }
- if(!hasRealData) {
- r->fBogus = U_USING_DEFAULT_WARNING;
- }
+ } else if(!isRoot && uprv_strcmp(t1->fName, kRootLocaleName) != 0 &&
+ t1->fParent == NULL && !r->fData.noFallback) {
+ if (!insertRootBundle(t1, status)) {
+ goto finish;
}
-
- // TODO: Does this ever loop?
- while(r != NULL && !isRoot && t1->fParent != NULL) {
- t1->fParent->fCountExisting++;
- t1 = t1->fParent;
+ if(!hasRealData) {
+ r->fBogus = U_USING_DEFAULT_WARNING;
}
- } /* umtx_lock */
-finishUnlock:
- umtx_unlock(resbMutex());
+ }
+
+ // TODO: Does this ever loop?
+ while(r != NULL && !isRoot && t1->fParent != NULL) {
+ t1->fParent->fCountExisting++;
+ t1 = t1->fParent;
+ }
+finish:
if(U_SUCCESS(*status)) {
if(intStatus != U_ZERO_ERROR) {
- *status = intStatus;
+ *status = intStatus;
}
return r;
} else {
@@ -790,7 +782,7 @@ entryOpenDirect(const char* path, const char* localeID, UErrorCode* status) {
return NULL;
}
- umtx_lock(resbMutex());
+ Mutex lock(&resbMutex);
// findFirstExisting() without fallbacks.
UResourceDataEntry *r = init_entry(localeID, path, status);
if(U_SUCCESS(*status)) {
@@ -828,7 +820,6 @@ entryOpenDirect(const char* path, const char* localeID, UErrorCode* status) {
t1 = t1->fParent;
}
}
- umtx_unlock(resbMutex());
return r;
}
@@ -866,14 +857,13 @@ static void entryCloseInt(UResourceDataEntry *resB) {
}
}
-/**
+/**
* API: closes a resource bundle and cleans up.
*/
static void entryClose(UResourceDataEntry *resB) {
- umtx_lock(resbMutex());
+ Mutex lock(&resbMutex);
entryCloseInt(resB);
- umtx_unlock(resbMutex());
}
/*
@@ -881,7 +871,7 @@ U_CFUNC void ures_setResPath(UResourceBundle *resB, const char* toAdd) {
if(resB->fResPath == NULL) {
resB->fResPath = resB->fResBuf;
*(resB->fResPath) = 0;
- }
+ }
resB->fResPathLen = uprv_strlen(toAdd);
if(RES_BUFSIZE <= resB->fResPathLen+1) {
if(resB->fResPath == resB->fResBuf) {
@@ -899,7 +889,7 @@ static void ures_appendResPath(UResourceBundle *resB, const char* toAdd, int32_t
resB->fResPath = resB->fResBuf;
*(resB->fResPath) = 0;
resB->fResPathLen = 0;
- }
+ }
resB->fResPathLen += lenToAdd;
if(RES_BUFSIZE <= resB->fResPathLen+1) {
if(resB->fResPath == resB->fResBuf) {
@@ -961,10 +951,10 @@ ures_close(UResourceBundle* resB)
ures_closeBundle(resB, TRUE);
}
-static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
- const char *key, int32_t idx, UResourceDataEntry *realData,
+static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
+ const char *key, int32_t idx, UResourceDataEntry *realData,
const UResourceBundle *parent, int32_t noAlias,
- UResourceBundle *resB, UErrorCode *status)
+ UResourceBundle *resB, UErrorCode *status)
{
if(status == NULL || U_FAILURE(*status)) {
return resB;
@@ -974,9 +964,9 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
return NULL;
}
if(RES_GET_TYPE(r) == URES_ALIAS) { /* This is an alias, need to exchange with real data */
- if(noAlias < URES_MAX_ALIAS_LEVEL) {
+ if(noAlias < URES_MAX_ALIAS_LEVEL) {
int32_t len = 0;
- const UChar *alias = res_getAlias(rdata, r, &len);
+ const UChar *alias = res_getAlias(rdata, r, &len);
if(len > 0) {
/* we have an alias, now let's cut it up */
char stackAlias[200];
@@ -1032,7 +1022,7 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
/* this is an XPath alias, starting with "/LOCALE/" */
/* it contains the path to a resource which should be looked up */
/* starting in the requested locale */
- keyPath = locale;
+ keyPath = locale;
locale = parent->fTopLevelData->fName; /* this is the requested locale's name */
path = realData->fPath; /* we will be looking in the same package */
} else {
@@ -1063,14 +1053,14 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
UResourceBundle *result = resB;
const char* temp = NULL;
UErrorCode intStatus = U_ZERO_ERROR;
- UResourceBundle *mainRes = ures_openDirect(path, locale, &intStatus);
+ UResourceBundle *mainRes = ures_openDirect(path, locale, &intStatus);
if(U_SUCCESS(intStatus)) {
if(keyPath == NULL) {
- /* no key path. This means that we are going to
+ /* no key path. This means that we are going to
* to use the corresponding resource from
* another bundle
*/
- /* first, we are going to get a corresponding parent
+ /* first, we are going to get a corresponding parent
* resource to the one we are searching.
*/
char *aKey = parent->fResPath;
@@ -1119,9 +1109,9 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
result = resB;
}
} else {
- /* this one is a bit trickier.
+ /* this one is a bit trickier.
* we start finding keys, but after we resolve one alias, the path might continue.
- * Consider:
+ * Consider:
* aliastest:alias { "testtypes/anotheralias/Sequence" }
* anotheralias:alias { "/ICUDATA/sh/CollationElements" }
* aliastest resource should finally have the sequence, not collation elements.
@@ -1141,7 +1131,7 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
result = mainRes;
/* now we have fallback following here */
do {
- r = dataEntry->fData.rootRes;
+ r = dataEntry->fData.rootRes;
/* this loop handles 'found' resources over several levels */
while(*myPath && U_SUCCESS(*status)) {
r = res_findResource(&(dataEntry->fData), r, &myPath, &temp);
@@ -1177,10 +1167,11 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
if(mainRes != result) {
ures_close(mainRes);
}
+ ResourceTracer(resB).maybeTrace("getalias");
return result;
}
} else {
- /* bad alias, should be an error */
+ /* bad alias, should be an error */
*status = U_ILLEGAL_ARGUMENT_ERROR;
return resB;
}
@@ -1206,9 +1197,9 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
if(resB->fVersion != NULL) {
uprv_free(resB->fVersion);
}
- /*
+ /*
weiv: if stack object was passed in, it doesn't really need to be reinited,
- since the purpose of initing is to remove stack junk. However, at this point
+ since the purpose of initing is to remove stack junk. However, at this point
we would not do anything to an allocated object, so stack object should be
treated the same
*/
@@ -1226,7 +1217,7 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
resB->fHasFallback = FALSE;
resB->fIsTopLevel = FALSE;
resB->fIndex = -1;
- resB->fKey = key;
+ resB->fKey = key;
/*resB->fParentRes = parent;*/
resB->fTopLevelData = parent->fTopLevelData;
if(parent->fResPath && parent != resB) {
@@ -1256,6 +1247,7 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
/*resB->fParent = parent->fRes;*/
uprv_memmove(&resB->fResData, rdata, sizeof(ResourceData));
resB->fSize = res_countArrayItems(&(resB->fResData), resB->fRes);
+ ResourceTracer(resB).trace("get");
return resB;
}
@@ -1304,7 +1296,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getString(const UResourceBundle* resB, int32_
*status = U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
}
- s = res_getString(&(resB->fResData), resB->fRes, len);
+ s = res_getString({resB}, &(resB->fResData), resB->fRes, len);
if (s == NULL) {
*status = U_RESOURCE_TYPE_MISMATCH;
}
@@ -1383,7 +1375,7 @@ ures_getUTF8String(const UResourceBundle *resB,
return ures_toUTF8String(s16, length16, dest, pLength, forceCopy, status);
}
-U_CAPI const uint8_t* U_EXPORT2 ures_getBinary(const UResourceBundle* resB, int32_t* len,
+U_CAPI const uint8_t* U_EXPORT2 ures_getBinary(const UResourceBundle* resB, int32_t* len,
UErrorCode* status) {
const uint8_t *p;
if (status==NULL || U_FAILURE(*status)) {
@@ -1393,14 +1385,14 @@ U_CAPI const uint8_t* U_EXPORT2 ures_getBinary(const UResourceBundle* resB, int3
*status = U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
}
- p = res_getBinary(&(resB->fResData), resB->fRes, len);
+ p = res_getBinary({resB}, &(resB->fResData), resB->fRes, len);
if (p == NULL) {
*status = U_RESOURCE_TYPE_MISMATCH;
}
return p;
}
-U_CAPI const int32_t* U_EXPORT2 ures_getIntVector(const UResourceBundle* resB, int32_t* len,
+U_CAPI const int32_t* U_EXPORT2 ures_getIntVector(const UResourceBundle* resB, int32_t* len,
UErrorCode* status) {
const int32_t *p;
if (status==NULL || U_FAILURE(*status)) {
@@ -1410,14 +1402,14 @@ U_CAPI const int32_t* U_EXPORT2 ures_getIntVector(const UResourceBundle* resB, i
*status = U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
}
- p = res_getIntVector(&(resB->fResData), resB->fRes, len);
+ p = res_getIntVector({resB}, &(resB->fResData), resB->fRes, len);
if (p == NULL) {
*status = U_RESOURCE_TYPE_MISMATCH;
}
return p;
}
-/* this function returns a signed integer */
+/* this function returns a signed integer */
/* it performs sign extension */
U_CAPI int32_t U_EXPORT2 ures_getInt(const UResourceBundle* resB, UErrorCode *status) {
if (status==NULL || U_FAILURE(*status)) {
@@ -1431,7 +1423,7 @@ U_CAPI int32_t U_EXPORT2 ures_getInt(const UResourceBundle* resB, UErrorCode *st
*status = U_RESOURCE_TYPE_MISMATCH;
return 0xffffffff;
}
- return RES_GET_INT(resB->fRes);
+ return res_getInt({resB}, resB->fRes);
}
U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resB, UErrorCode *status) {
@@ -1446,7 +1438,7 @@ U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resB, UErrorCode *
*status = U_RESOURCE_TYPE_MISMATCH;
return 0xffffffff;
}
- return RES_GET_UINT(resB->fRes);
+ return res_getUInt({resB}, resB->fRes);
}
U_CAPI UResType U_EXPORT2 ures_getType(const UResourceBundle *resB) {
@@ -1457,10 +1449,18 @@ U_CAPI UResType U_EXPORT2 ures_getType(const UResourceBundle *resB) {
}
U_CAPI const char * U_EXPORT2 ures_getKey(const UResourceBundle *resB) {
+ //
+ // TODO: Trace ures_getKey? I guess not usually.
+ //
+ // We usually get the key string to decide whether we want the value, or to
+ // make a key-value pair. Tracing the value should suffice.
+ //
+ // However, I believe we have some data (e.g., in res_index) where the key
+ // strings are the data. Tracing the enclosing table should suffice.
+ //
if(resB == NULL) {
return NULL;
}
-
return(resB->fKey);
}
@@ -1468,7 +1468,7 @@ U_CAPI int32_t U_EXPORT2 ures_getSize(const UResourceBundle *resB) {
if(resB == NULL) {
return 0;
}
-
+
return resB->fSize;
}
@@ -1480,7 +1480,7 @@ static const UChar* ures_getStringWithAlias(const UResourceBundle *resB, Resourc
ures_close(tempRes);
return result;
} else {
- return res_getString(&(resB->fResData), r, len);
+ return res_getString({resB, sIndex}, &(resB->fResData), r, len);
}
}
@@ -1500,7 +1500,7 @@ U_CAPI UBool U_EXPORT2 ures_hasNext(const UResourceBundle *resB) {
U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resB, int32_t* len, const char ** key, UErrorCode *status) {
Resource r = RES_BOGUS;
-
+
if (status==NULL || U_FAILURE(*status)) {
return NULL;
}
@@ -1508,7 +1508,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resB, int32_t*
*status = U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
}
-
+
if(resB->fIndex == resB->fSize-1) {
*status = U_INDEX_OUTOFBOUNDS_ERROR;
} else {
@@ -1516,7 +1516,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resB, int32_t*
switch(RES_GET_TYPE(resB->fRes)) {
case URES_STRING:
case URES_STRING_V2:
- return res_getString(&(resB->fResData), resB->fRes, len);
+ return res_getString({resB}, &(resB->fResData), resB->fRes, len);
case URES_TABLE:
case URES_TABLE16:
case URES_TABLE32:
@@ -1661,7 +1661,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resB,
switch(RES_GET_TYPE(resB->fRes)) {
case URES_STRING:
case URES_STRING_V2:
- return res_getString(&(resB->fResData), resB->fRes, len);
+ return res_getString({resB}, &(resB->fResData), resB->fRes, len);
case URES_TABLE:
case URES_TABLE16:
case URES_TABLE32:
@@ -1711,9 +1711,9 @@ ures_getUTF8StringByIndex(const UResourceBundle *resB,
}*/
U_CAPI UResourceBundle* U_EXPORT2
-ures_findResource(const char* path, UResourceBundle *fillIn, UErrorCode *status)
+ures_findResource(const char* path, UResourceBundle *fillIn, UErrorCode *status)
{
- UResourceBundle *first = NULL;
+ UResourceBundle *first = NULL;
UResourceBundle *result = fillIn;
char *packageName = NULL;
char *pathToResource = NULL, *save = NULL;
@@ -1766,7 +1766,7 @@ ures_findResource(const char* path, UResourceBundle *fillIn, UErrorCode *status)
}
U_CAPI UResourceBundle* U_EXPORT2
-ures_findSubResource(const UResourceBundle *resB, char* path, UResourceBundle *fillIn, UErrorCode *status)
+ures_findSubResource(const UResourceBundle *resB, char* path, UResourceBundle *fillIn, UErrorCode *status)
{
Resource res = RES_BOGUS;
UResourceBundle *result = fillIn;
@@ -1780,7 +1780,7 @@ ures_findSubResource(const UResourceBundle *resB, char* path, UResourceBundle *f
/* this loop is here because aliasing is resolved on this level, not on res level */
/* so, when we encounter an alias, it is not an aggregate resource, so we return */
do {
- res = res_findResource(&(resB->fResData), resB->fRes, &path, &key);
+ res = res_findResource(&(resB->fResData), resB->fRes, &path, &key);
if(res != RES_BOGUS) {
result = init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status);
resB = result;
@@ -1792,9 +1792,9 @@ ures_findSubResource(const UResourceBundle *resB, char* path, UResourceBundle *f
return result;
}
-U_INTERNAL const UChar* U_EXPORT2
-ures_getStringByKeyWithFallback(const UResourceBundle *resB,
- const char* inKey,
+U_INTERNAL const UChar* U_EXPORT2
+ures_getStringByKeyWithFallback(const UResourceBundle *resB,
+ const char* inKey,
int32_t* len,
UErrorCode *status) {
@@ -1821,7 +1821,7 @@ ures_getStringByKeyWithFallback(const UResourceBundle *resB,
/*
Like res_getTableItemByKey but accepts full paths like "NumberElements/latn/patternsShort".
-*/
+*/
static Resource getTableItemByKeyPath(const ResourceData *pResData, Resource table, const char *key) {
Resource resource = table; /* The current resource */
icu::CharString path;
@@ -1842,7 +1842,7 @@ static Resource getTableItemByKeyPath(const ResourceData *pResData, Resource tab
const char *pathP = pathPart;
resource = res_getTableItemByKey(pResData, resource, &t, &pathP);
type = (UResType)RES_GET_TYPE(resource);
- pathPart = nextPathPart;
+ pathPart = nextPathPart;
}
if (*pathPart) {
return RES_BOGUS;
@@ -1850,10 +1850,10 @@ static Resource getTableItemByKeyPath(const ResourceData *pResData, Resource tab
return resource;
}
-U_CAPI UResourceBundle* U_EXPORT2
-ures_getByKeyWithFallback(const UResourceBundle *resB,
- const char* inKey,
- UResourceBundle *fillIn,
+U_CAPI UResourceBundle* U_EXPORT2
+ures_getByKeyWithFallback(const UResourceBundle *resB,
+ const char* inKey,
+ UResourceBundle *fillIn,
UErrorCode *status) {
Resource res = RES_BOGUS, rootRes = RES_BOGUS;
/*UResourceDataEntry *realData = NULL;*/
@@ -1897,7 +1897,7 @@ ures_getByKeyWithFallback(const UResourceBundle *resB,
res = res_findResource(&(dataEntry->fData), rootRes, &myPath, &key);
if (RES_GET_TYPE(res) == URES_ALIAS && *myPath) {
/* We hit an alias, but we didn't finish following the path. */
- helper = init_resb_result(&(dataEntry->fData), res, NULL, -1, dataEntry, resB, 0, helper, status);
+ helper = init_resb_result(&(dataEntry->fData), res, NULL, -1, dataEntry, resB, 0, helper, status);
/*helper = init_resb_result(&(dataEntry->fData), res, inKey, -1, dataEntry, resB, 0, helper, status);*/
if(helper) {
dataEntry = helper->fData;
@@ -1928,7 +1928,7 @@ ures_getByKeyWithFallback(const UResourceBundle *resB,
} else {
fillIn = init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status);
}
- }
+ }
else {
*status = U_RESOURCE_TYPE_MISMATCH;
}
@@ -1953,10 +1953,10 @@ void getAllItemsWithFallback(
// When the sink sees the no-fallback/no-inheritance marker,
// then it would remove the parent's item.
// We would deserialize parent values even though they are overridden in a child bundle.
- value.pResData = &bundle->fResData;
+ value.setData(&bundle->fResData);
UResourceDataEntry *parentEntry = bundle->fData->fParent;
UBool hasParent = parentEntry != NULL && U_SUCCESS(parentEntry->fBogus);
- value.setResource(bundle->fRes);
+ value.setResource(bundle->fRes, ResourceTracer(bundle));
sink.put(bundle->fKey, value, !hasParent, errorCode);
if (hasParent) {
// We might try to query the sink whether
@@ -2001,31 +2001,60 @@ void getAllItemsWithFallback(
} // namespace
+// Requires a ResourceDataValue fill-in, so that we need not cast from a ResourceValue.
+// Unfortunately, the caller must know which subclass to make and pass in.
+// Alternatively, we could make it as polymorphic as in Java by
+// returning a ResourceValue pointer (possibly wrapped into a LocalPointer)
+// that the caller then owns.
+//
+// Also requires a UResourceBundle fill-in, so that the value's ResourceTracer
+// can point to a non-local bundle.
+// Without tracing, the child bundle could be a function-local object.
+U_CAPI void U_EXPORT2
+ures_getValueWithFallback(const UResourceBundle *bundle, const char *path,
+ UResourceBundle *tempFillIn,
+ ResourceDataValue &value, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return; }
+ if (path == nullptr) {
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return;
+ }
+ const UResourceBundle *rb;
+ if (*path == 0) {
+ // empty path
+ rb = bundle;
+ } else {
+ rb = ures_getByKeyWithFallback(bundle, path, tempFillIn, &errorCode);
+ if (U_FAILURE(errorCode)) {
+ return;
+ }
+ }
+ value.setData(&rb->fResData);
+ value.setResource(rb->fRes, ResourceTracer(rb));
+}
+
U_CAPI void U_EXPORT2
ures_getAllItemsWithFallback(const UResourceBundle *bundle, const char *path,
icu::ResourceSink &sink, UErrorCode &errorCode) {
if (U_FAILURE(errorCode)) { return; }
- if (path == NULL) {
+ if (path == nullptr) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
- UResourceBundle stackBundle;
- ures_initStackObject(&stackBundle);
+ StackUResourceBundle stackBundle;
const UResourceBundle *rb;
if (*path == 0) {
// empty path
rb = bundle;
} else {
- rb = ures_getByKeyWithFallback(bundle, path, &stackBundle, &errorCode);
+ rb = ures_getByKeyWithFallback(bundle, path, stackBundle.getAlias(), &errorCode);
if (U_FAILURE(errorCode)) {
- ures_close(&stackBundle);
return;
}
}
// Get all table items with fallback.
ResourceDataValue value;
getAllItemsWithFallback(rb, value, sink, errorCode);
- ures_close(&stackBundle);
}
U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, const char* inKey, UResourceBundle *fillIn, UErrorCode *status) {
@@ -2061,7 +2090,7 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, con
} else {
return init_resb_result(&(resB->fResData), res, key, -1, resB->fData, resB, 0, fillIn, status);
}
- }
+ }
#if 0
/* this is a kind of TODO item. If we have an array with an index table, we could do this. */
/* not currently */
@@ -2074,7 +2103,7 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, con
*status = U_MISSING_RESOURCE_ERROR;
}
}
-#endif
+#endif
else {
*status = U_RESOURCE_TYPE_MISMATCH;
}
@@ -2108,7 +2137,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
switch (RES_GET_TYPE(res)) {
case URES_STRING:
case URES_STRING_V2:
- return res_getString(rd, res, len);
+ return res_getString({resB, key}, rd, res, len);
case URES_ALIAS:
{
const UChar* result = 0;
@@ -2130,7 +2159,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
switch (RES_GET_TYPE(res)) {
case URES_STRING:
case URES_STRING_V2:
- return res_getString(&(resB->fResData), res, len);
+ return res_getString({resB, key}, &(resB->fResData), res, len);
case URES_ALIAS:
{
const UChar* result = 0;
@@ -2143,20 +2172,21 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
*status = U_RESOURCE_TYPE_MISMATCH;
}
}
- }
-#if 0
+ }
+#if 0
/* this is a kind of TODO item. If we have an array with an index table, we could do this. */
- /* not currently */
+ /* not currently */
else if(RES_GET_TYPE(resB->fRes) == URES_ARRAY && resB->fHasFallback == TRUE) {
/* here should go a first attempt to locate the key using index table */
const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
if(U_SUCCESS(*status)) {
+ // TODO: Tracing
return res_getString(rd, res, len);
} else {
*status = U_MISSING_RESOURCE_ERROR;
}
- }
-#endif
+ }
+#endif
else {
*status = U_RESOURCE_TYPE_MISMATCH;
}
@@ -2177,7 +2207,7 @@ ures_getUTF8StringByKey(const UResourceBundle *resB,
/* TODO: clean from here down */
/**
- * INTERNAL: Get the name of the first real locale (not placeholder)
+ * INTERNAL: Get the name of the first real locale (not placeholder)
* that has resource bundle data.
*/
U_INTERNAL const char* U_EXPORT2
@@ -2194,17 +2224,17 @@ ures_getLocaleInternal(const UResourceBundle* resourceBundle, UErrorCode* status
}
}
-U_CAPI const char* U_EXPORT2
-ures_getLocale(const UResourceBundle* resourceBundle,
+U_CAPI const char* U_EXPORT2
+ures_getLocale(const UResourceBundle* resourceBundle,
UErrorCode* status)
{
return ures_getLocaleInternal(resourceBundle, status);
}
-U_CAPI const char* U_EXPORT2
-ures_getLocaleByType(const UResourceBundle* resourceBundle,
- ULocDataLocaleType type,
+U_CAPI const char* U_EXPORT2
+ures_getLocaleByType(const UResourceBundle* resourceBundle,
+ ULocDataLocaleType type,
UErrorCode* status) {
if (status==NULL || U_FAILURE(*status)) {
return NULL;
@@ -2296,6 +2326,8 @@ ures_openWithType(UResourceBundle *r, const char* path, const char* localeID,
r->fSize = res_countArrayItems(&(r->fResData), r->fRes);
r->fIndex = -1;
+ ResourceTracer(r).traceOpen();
+
return r;
}
@@ -2310,7 +2342,7 @@ ures_openNoDefault(const char* path, const char* localeID, UErrorCode* status) {
}
/**
- * Opens a resource bundle without "canonicalizing" the locale name. No fallback will be performed
+ * Opens a resource bundle without "canonicalizing" the locale name. No fallback will be performed
* or sought. However, alias substitution will happen!
*/
U_CAPI UResourceBundle* U_EXPORT2
@@ -2319,10 +2351,10 @@ ures_openDirect(const char* path, const char* localeID, UErrorCode* status) {
}
/**
- * Internal API: This function is used to open a resource bundle
- * proper fallback chaining is executed while initialization.
+ * Internal API: This function is used to open a resource bundle
+ * proper fallback chaining is executed while initialization.
* The result is stored in cache for later fallback search.
- *
+ *
* Same as ures_open(), but uses the fill-in parameter and does not allocate a new bundle.
*/
U_INTERNAL void U_EXPORT2
@@ -2366,7 +2398,7 @@ ures_countArrayItems(const UResourceBundle* resourceBundle,
return 0;
}
ures_getByKey(resourceBundle, resourceKey, &resData, status);
-
+
if(resData.fResData.data != NULL) {
int32_t result = res_countArrayItems(&resData.fResData, resData.fRes);
ures_close(&resData);
@@ -2388,7 +2420,7 @@ ures_countArrayItems(const UResourceBundle* resourceBundle,
* @see ures_getVersion
* @internal
*/
-U_INTERNAL const char* U_EXPORT2
+U_INTERNAL const char* U_EXPORT2
ures_getVersionNumberInternal(const UResourceBundle *resourceBundle)
{
if (!resourceBundle) return NULL;
@@ -2402,24 +2434,24 @@ ures_getVersionNumberInternal(const UResourceBundle *resourceBundle)
int32_t len;
const UChar* minor_version = ures_getStringByKey(resourceBundle, kVersionTag, &minor_len, &status);
-
+
/* Determine the length of of the final version string. This is */
/* the length of the major part + the length of the separator */
/* (==1) + the length of the minor part (+ 1 for the zero byte at */
/* the end). */
len = (minor_len > 0) ? minor_len : 1;
-
+
/* Allocate the string, and build it up. */
/* + 1 for zero byte */
- ((UResourceBundle *)resourceBundle)->fVersion = (char *)uprv_malloc(1 + len);
+ ((UResourceBundle *)resourceBundle)->fVersion = (char *)uprv_malloc(1 + len);
/* Check for null pointer. */
if (((UResourceBundle *)resourceBundle)->fVersion == NULL) {
return NULL;
}
-
+
if(minor_len > 0) {
u_UCharsToChars(minor_version, resourceBundle->fVersion , minor_len);
resourceBundle->fVersion[len] = '\0';
@@ -2495,8 +2527,8 @@ ures_loc_nextLocale(UEnumeration* en,
return result;
}
-static void U_CALLCONV
-ures_loc_resetLocales(UEnumeration* en,
+static void U_CALLCONV
+ures_loc_resetLocales(UEnumeration* en,
UErrorCode* /*status*/) {
UResourceBundle *res = &((ULocalesContext *)en->context)->installed;
ures_resetIterator(res);
@@ -2541,7 +2573,7 @@ ures_openAvailableLocales(const char *path, UErrorCode *status)
ures_getByKey(idx, INDEX_TAG, &myContext->installed, status);
if(U_SUCCESS(*status)) {
#if defined(URES_TREE_DEBUG)
- fprintf(stderr, "Got %s::%s::[%s] : %s\n",
+ fprintf(stderr, "Got %s::%s::[%s] : %s\n",
path, INDEX_LOCALE_NAME, INDEX_TAG, ures_getKey(&myContext->installed));
#endif
en->context = myContext;
@@ -2554,9 +2586,9 @@ ures_openAvailableLocales(const char *path, UErrorCode *status)
uprv_free(en);
en = NULL;
}
-
+
ures_close(idx);
-
+
return en;
}
@@ -2593,17 +2625,17 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
}
uloc_getBaseName(locid, base, 1024-1,&subStatus);
#if defined(URES_TREE_DEBUG)
- fprintf(stderr, "getFunctionalEquivalent: \"%s\" [%s=%s] in %s - %s\n",
+ fprintf(stderr, "getFunctionalEquivalent: \"%s\" [%s=%s] in %s - %s\n",
locid, keyword, kwVal, base, u_errorName(subStatus));
#endif
ures_initStackObject(&bund1);
ures_initStackObject(&bund2);
-
-
+
+
uprv_strcpy(parent, base);
uprv_strcpy(found, base);
- if(isAvailable) {
+ if(isAvailable) {
UEnumeration *locEnum = ures_openAvailableLocales(path, &subStatus);
*isAvailable = TRUE;
if (U_SUCCESS(subStatus)) {
@@ -2616,7 +2648,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
*status = subStatus;
return 0;
}
-
+
do {
subStatus = U_ZERO_ERROR;
res = ures_open(path, parent, &subStatus);
@@ -2626,7 +2658,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
*isAvailable = FALSE;
}
isAvailable = NULL; /* only want to set this the first time around */
-
+
#if defined(URES_TREE_DEBUG)
fprintf(stderr, "%s;%s -> %s [%s]\n", path?path:"ICUDATA", parent, u_errorName(subStatus), ures_getLocale(res, &subStatus));
#endif
@@ -2646,21 +2678,21 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
if(U_SUCCESS(subStatus) && defLen) {
u_UCharsToChars(defUstr, defVal, u_strlen(defUstr));
#if defined(URES_TREE_DEBUG)
- fprintf(stderr, "%s;%s -> default %s=%s, %s\n",
+ fprintf(stderr, "%s;%s -> default %s=%s, %s\n",
path?path:"ICUDATA", parent, keyword, defVal, u_errorName(subStatus));
#endif
uprv_strcpy(defLoc, parent);
if(kwVal[0]==0) {
uprv_strcpy(kwVal, defVal);
#if defined(URES_TREE_DEBUG)
- fprintf(stderr, "%s;%s -> kwVal = %s\n",
+ fprintf(stderr, "%s;%s -> kwVal = %s\n",
path?path:"ICUDATA", parent, keyword, kwVal);
#endif
}
}
}
}
-
+
subStatus = U_ZERO_ERROR;
if (res != NULL) {
@@ -2670,11 +2702,11 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
uloc_getParent(found,parent,sizeof(parent),&subStatus);
ures_close(res);
} while(!defVal[0] && *found && uprv_strcmp(found, "root") != 0 && U_SUCCESS(*status));
-
+
/* Now, see if we can find the kwVal collator.. start the search over.. */
uprv_strcpy(parent, base);
uprv_strcpy(found, base);
-
+
do {
subStatus = U_ZERO_ERROR;
res = ures_open(path, parent, &subStatus);
@@ -2682,9 +2714,9 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
*isAvailable = FALSE;
}
isAvailable = NULL; /* only want to set this the first time around */
-
+
#if defined(URES_TREE_DEBUG)
- fprintf(stderr, "%s;%s -> %s (looking for %s)\n",
+ fprintf(stderr, "%s;%s -> %s (looking for %s)\n",
path?path:"ICUDATA", parent, u_errorName(subStatus), kwVal);
#endif
if(U_FAILURE(subStatus)) {
@@ -2701,7 +2733,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
#endif
if(subStatus == U_ZERO_ERROR) {
#if defined(URES_TREE_DEBUG)
- fprintf(stderr, "%s;%s -> full0 %s=%s, %s\n",
+ fprintf(stderr, "%s;%s -> full0 %s=%s, %s\n",
path?path:"ICUDATA", parent, keyword, kwVal, u_errorName(subStatus));
#endif
uprv_strcpy(full, parent);
@@ -2714,14 +2746,14 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
int32_t defLen;
/* look for default item */
#if defined(URES_TREE_DEBUG)
- fprintf(stderr, "%s;%s -> recalculating Default0\n",
+ fprintf(stderr, "%s;%s -> recalculating Default0\n",
path?path:"ICUDATA", full);
#endif
defUstr = ures_getStringByKey(&bund1, DEFAULT_TAG, &defLen, &subStatus);
if(U_SUCCESS(subStatus) && defLen) {
u_UCharsToChars(defUstr, defVal, u_strlen(defUstr));
#if defined(URES_TREE_DEBUG)
- fprintf(stderr, "%s;%s -> default0 %s=%s, %s\n",
+ fprintf(stderr, "%s;%s -> default0 %s=%s, %s\n",
path?path:"ICUDATA", full, keyword, defVal, u_errorName(subStatus));
#endif
uprv_strcpy(defLoc, full);
@@ -2734,20 +2766,20 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
#endif
} else {
#if defined(URES_TREE_DEBUG)
- fprintf(stderr, "err=%s in %s looking for %s\n",
+ fprintf(stderr, "err=%s in %s looking for %s\n",
u_errorName(subStatus), parent, kwVal);
#endif
}
}
}
-
+
subStatus = U_ZERO_ERROR;
-
+
uprv_strcpy(found, parent);
uloc_getParent(found,parent,1023,&subStatus);
ures_close(res);
} while(!full[0] && *found && U_SUCCESS(*status));
-
+
if((full[0]==0) && uprv_strcmp(kwVal, defVal)) {
#if defined(URES_TREE_DEBUG)
fprintf(stderr, "Failed to locate kw %s - try default %s\n", kwVal, defVal);
@@ -2755,7 +2787,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
uprv_strcpy(kwVal, defVal);
uprv_strcpy(parent, base);
uprv_strcpy(found, base);
-
+
do { /* search for 'default' named item */
subStatus = U_ZERO_ERROR;
res = ures_open(path, parent, &subStatus);
@@ -2763,7 +2795,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
*isAvailable = FALSE;
}
isAvailable = NULL; /* only want to set this the first time around */
-
+
#if defined(URES_TREE_DEBUG)
fprintf(stderr, "%s;%s -> %s (looking for default %s)\n",
path?path:"ICUDATA", parent, u_errorName(subStatus), kwVal);
@@ -2783,21 +2815,21 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
if(*full == 0) {
uprv_strcpy(full, "root");
}
-
+
/* now, recalculate default kw if need be */
if(uprv_strlen(defLoc) > uprv_strlen(full)) {
const UChar *defUstr;
int32_t defLen;
/* look for default item */
#if defined(URES_TREE_DEBUG)
- fprintf(stderr, "%s;%s -> recalculating Default1\n",
+ fprintf(stderr, "%s;%s -> recalculating Default1\n",
path?path:"ICUDATA", full);
#endif
defUstr = ures_getStringByKey(&bund1, DEFAULT_TAG, &defLen, &subStatus);
if(U_SUCCESS(subStatus) && defLen) {
u_UCharsToChars(defUstr, defVal, u_strlen(defUstr));
#if defined(URES_TREE_DEBUG)
- fprintf(stderr, "%s;%s -> default %s=%s, %s\n",
+ fprintf(stderr, "%s;%s -> default %s=%s, %s\n",
path?path:"ICUDATA", full, keyword, defVal, u_errorName(subStatus));
#endif
uprv_strcpy(defLoc, full);
@@ -2812,13 +2844,13 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
}
}
subStatus = U_ZERO_ERROR;
-
+
uprv_strcpy(found, parent);
uloc_getParent(found,parent,1023,&subStatus);
ures_close(res);
} while(!full[0] && *found && U_SUCCESS(*status));
}
-
+
if(U_SUCCESS(*status)) {
if(!full[0]) {
#if defined(URES_TREE_DEBUG)
@@ -2828,7 +2860,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
} else if(omitDefault) {
#if defined(URES_TREE_DEBUG)
fprintf(stderr,"Trim? full=%s, defLoc=%s, found=%s\n", full, defLoc, found);
-#endif
+#endif
if(uprv_strlen(defLoc) <= uprv_strlen(full)) {
/* found the keyword in a *child* of where the default tag was present. */
if(!uprv_strcmp(kwVal, defVal)) { /* if the requested kw is default, */
@@ -2854,10 +2886,10 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
}
}
/* we found the default locale - no need to repeat it.*/
-
+
ures_close(&bund1);
ures_close(&bund2);
-
+
length = (int32_t)uprv_strlen(found);
if(U_SUCCESS(*status)) {
@@ -2866,7 +2898,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
uprv_strncpy(result, found, copyLength);
}
if(length == 0) {
- *status = U_MISSING_RESOURCE_ERROR;
+ *status = U_MISSING_RESOURCE_ERROR;
}
} else {
length = 0;
@@ -2880,58 +2912,58 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
{
#define VALUES_BUF_SIZE 2048
#define VALUES_LIST_SIZE 512
-
+
char valuesBuf[VALUES_BUF_SIZE];
int32_t valuesIndex = 0;
const char *valuesList[VALUES_LIST_SIZE];
int32_t valuesCount = 0;
-
+
const char *locale;
int32_t locLen;
-
+
UEnumeration *locs = NULL;
-
+
UResourceBundle item;
UResourceBundle subItem;
-
+
ures_initStackObject(&item);
ures_initStackObject(&subItem);
locs = ures_openAvailableLocales(path, status);
-
+
if(U_FAILURE(*status)) {
ures_close(&item);
ures_close(&subItem);
return NULL;
}
-
+
valuesBuf[0]=0;
valuesBuf[1]=0;
-
+
while((locale = uenum_next(locs, &locLen, status)) != 0) {
UResourceBundle *bund = NULL;
UResourceBundle *subPtr = NULL;
UErrorCode subStatus = U_ZERO_ERROR; /* don't fail if a bundle is unopenable */
bund = ures_openDirect(path, locale, &subStatus);
-
+
#if defined(URES_TREE_DEBUG)
if(!bund || U_FAILURE(subStatus)) {
- fprintf(stderr, "%s-%s values: Can't open %s locale - skipping. (%s)\n",
+ fprintf(stderr, "%s-%s values: Can't open %s locale - skipping. (%s)\n",
path?path:"", keyword, locale, u_errorName(subStatus));
}
#endif
-
+
ures_getByKey(bund, keyword, &item, &subStatus);
-
+
if(!bund || U_FAILURE(subStatus)) {
#if defined(URES_TREE_DEBUG)
- fprintf(stderr, "%s-%s values: Can't find in %s - skipping. (%s)\n",
+ fprintf(stderr, "%s-%s values: Can't find in %s - skipping. (%s)\n",
path?path:"", keyword, locale, u_errorName(subStatus));
#endif
ures_close(bund);
bund = NULL;
continue;
}
-
+
while((subPtr = ures_getNextResource(&item,&subItem,&subStatus)) != 0
&& U_SUCCESS(subStatus)) {
const char *k;
@@ -2972,12 +3004,12 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
ures_close(bund);
}
valuesBuf[valuesIndex++] = 0; /* terminate */
-
+
ures_close(&item);
ures_close(&subItem);
uenum_close(locs);
#if defined(URES_TREE_DEBUG)
- fprintf(stderr, "%s: size %d, #%d\n", u_errorName(*status),
+ fprintf(stderr, "%s: size %d, #%d\n", u_errorName(*status),
valuesIndex, valuesCount);
#endif
return uloc_openKeywordList(valuesBuf, valuesIndex, status);
@@ -3052,7 +3084,7 @@ ures_getVersionByKey(const UResourceBundle* res, const char *key, UVersionInfo v
str = ures_getStringByKey(res, key, &len, status);
if(U_SUCCESS(*status)) {
u_versionFromUString(ver, str);
- }
+ }
}
/* eof */
diff --git a/deps/icu-small/source/common/uresdata.cpp b/deps/icu-small/source/common/uresdata.cpp
index a0b8d3ba904ad6..b3c2e2e27ccf9a 100644
--- a/deps/icu-small/source/common/uresdata.cpp
+++ b/deps/icu-small/source/common/uresdata.cpp
@@ -33,6 +33,7 @@
#include "uinvchar.h"
#include "uresdata.h"
#include "uresimp.h"
+#include "utracimp.h"
/*
* Resource access helpers
@@ -307,7 +308,7 @@ res_getPublicType(Resource res) {
}
U_CAPI const UChar * U_EXPORT2
-res_getString(const ResourceData *pResData, Resource res, int32_t *pLength) {
+res_getStringNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength) {
const UChar *p;
uint32_t offset=RES_GET_OFFSET(res);
int32_t length;
@@ -402,7 +403,8 @@ int32_t getStringArray(const ResourceData *pResData, const icu::ResourceArray &a
}
for(int32_t i = 0; i < length; ++i) {
int32_t sLength;
- const UChar *s = res_getString(pResData, array.internalGetResource(pResData, i), &sLength);
+ // No tracing: handled by the caller
+ const UChar *s = res_getStringNoTrace(pResData, array.internalGetResource(pResData, i), &sLength);
if(s == NULL) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
return 0;
@@ -434,7 +436,7 @@ res_getAlias(const ResourceData *pResData, Resource res, int32_t *pLength) {
}
U_CAPI const uint8_t * U_EXPORT2
-res_getBinary(const ResourceData *pResData, Resource res, int32_t *pLength) {
+res_getBinaryNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength) {
const uint8_t *p;
uint32_t offset=RES_GET_OFFSET(res);
int32_t length;
@@ -454,7 +456,7 @@ res_getBinary(const ResourceData *pResData, Resource res, int32_t *pLength) {
U_CAPI const int32_t * U_EXPORT2
-res_getIntVector(const ResourceData *pResData, Resource res, int32_t *pLength) {
+res_getIntVectorNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength) {
const int32_t *p;
uint32_t offset=RES_GET_OFFSET(res);
int32_t length;
@@ -507,7 +509,7 @@ const UChar *ResourceDataValue::getString(int32_t &length, UErrorCode &errorCode
if(U_FAILURE(errorCode)) {
return NULL;
}
- const UChar *s = res_getString(pResData, res, &length);
+ const UChar *s = res_getString(fTraceInfo, &getData(), res, &length);
if(s == NULL) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
}
@@ -518,7 +520,7 @@ const UChar *ResourceDataValue::getAliasString(int32_t &length, UErrorCode &erro
if(U_FAILURE(errorCode)) {
return NULL;
}
- const UChar *s = res_getAlias(pResData, res, &length);
+ const UChar *s = res_getAlias(&getData(), res, &length);
if(s == NULL) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
}
@@ -532,7 +534,7 @@ int32_t ResourceDataValue::getInt(UErrorCode &errorCode) const {
if(RES_GET_TYPE(res) != URES_INT) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
}
- return RES_GET_INT(res);
+ return res_getInt(fTraceInfo, res);
}
uint32_t ResourceDataValue::getUInt(UErrorCode &errorCode) const {
@@ -542,14 +544,14 @@ uint32_t ResourceDataValue::getUInt(UErrorCode &errorCode) const {
if(RES_GET_TYPE(res) != URES_INT) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
}
- return RES_GET_UINT(res);
+ return res_getUInt(fTraceInfo, res);
}
const int32_t *ResourceDataValue::getIntVector(int32_t &length, UErrorCode &errorCode) const {
if(U_FAILURE(errorCode)) {
return NULL;
}
- const int32_t *iv = res_getIntVector(pResData, res, &length);
+ const int32_t *iv = res_getIntVector(fTraceInfo, &getData(), res, &length);
if(iv == NULL) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
}
@@ -560,7 +562,7 @@ const uint8_t *ResourceDataValue::getBinary(int32_t &length, UErrorCode &errorCo
if(U_FAILURE(errorCode)) {
return NULL;
}
- const uint8_t *b = res_getBinary(pResData, res, &length);
+ const uint8_t *b = res_getBinary(fTraceInfo, &getData(), res, &length);
if(b == NULL) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
}
@@ -578,19 +580,19 @@ ResourceArray ResourceDataValue::getArray(UErrorCode &errorCode) const {
switch(RES_GET_TYPE(res)) {
case URES_ARRAY:
if (offset!=0) { // empty if offset==0
- items32 = (const Resource *)pResData->pRoot+offset;
+ items32 = (const Resource *)getData().pRoot+offset;
length = *items32++;
}
break;
case URES_ARRAY16:
- items16 = pResData->p16BitUnits+offset;
+ items16 = getData().p16BitUnits+offset;
length = *items16++;
break;
default:
errorCode = U_RESOURCE_TYPE_MISMATCH;
return ResourceArray();
}
- return ResourceArray(items16, items32, length);
+ return ResourceArray(items16, items32, length, fTraceInfo);
}
ResourceTable ResourceDataValue::getTable(UErrorCode &errorCode) const {
@@ -606,19 +608,19 @@ ResourceTable ResourceDataValue::getTable(UErrorCode &errorCode) const {
switch(RES_GET_TYPE(res)) {
case URES_TABLE:
if (offset != 0) { // empty if offset==0
- keys16 = (const uint16_t *)(pResData->pRoot+offset);
+ keys16 = (const uint16_t *)(getData().pRoot+offset);
length = *keys16++;
items32 = (const Resource *)(keys16+length+(~length&1));
}
break;
case URES_TABLE16:
- keys16 = pResData->p16BitUnits+offset;
+ keys16 = getData().p16BitUnits+offset;
length = *keys16++;
items16 = keys16 + length;
break;
case URES_TABLE32:
if (offset != 0) { // empty if offset==0
- keys32 = pResData->pRoot+offset;
+ keys32 = getData().pRoot+offset;
length = *keys32++;
items32 = (const Resource *)keys32 + length;
}
@@ -627,22 +629,22 @@ ResourceTable ResourceDataValue::getTable(UErrorCode &errorCode) const {
errorCode = U_RESOURCE_TYPE_MISMATCH;
return ResourceTable();
}
- return ResourceTable(keys16, keys32, items16, items32, length);
+ return ResourceTable(keys16, keys32, items16, items32, length, fTraceInfo);
}
UBool ResourceDataValue::isNoInheritanceMarker() const {
- return ::isNoInheritanceMarker(pResData, res);
+ return ::isNoInheritanceMarker(&getData(), res);
}
int32_t ResourceDataValue::getStringArray(UnicodeString *dest, int32_t capacity,
UErrorCode &errorCode) const {
- return ::getStringArray(pResData, getArray(errorCode), dest, capacity, errorCode);
+ return ::getStringArray(&getData(), getArray(errorCode), dest, capacity, errorCode);
}
int32_t ResourceDataValue::getStringArrayOrStringAsArray(UnicodeString *dest, int32_t capacity,
UErrorCode &errorCode) const {
if(URES_IS_ARRAY(res)) {
- return ::getStringArray(pResData, getArray(errorCode), dest, capacity, errorCode);
+ return ::getStringArray(&getData(), getArray(errorCode), dest, capacity, errorCode);
}
if(U_FAILURE(errorCode)) {
return 0;
@@ -656,7 +658,7 @@ int32_t ResourceDataValue::getStringArrayOrStringAsArray(UnicodeString *dest, in
return 1;
}
int32_t sLength;
- const UChar *s = res_getString(pResData, res, &sLength);
+ const UChar *s = res_getString(fTraceInfo, &getData(), res, &sLength);
if(s != NULL) {
dest[0].setTo(TRUE, s, sLength);
return 1;
@@ -671,7 +673,7 @@ UnicodeString ResourceDataValue::getStringOrFirstOfArray(UErrorCode &errorCode)
return us;
}
int32_t sLength;
- const UChar *s = res_getString(pResData, res, &sLength);
+ const UChar *s = res_getString(fTraceInfo, &getData(), res, &sLength);
if(s != NULL) {
us.setTo(TRUE, s, sLength);
return us;
@@ -681,7 +683,8 @@ UnicodeString ResourceDataValue::getStringOrFirstOfArray(UErrorCode &errorCode)
return us;
}
if(array.getSize() > 0) {
- s = res_getString(pResData, array.internalGetResource(pResData, 0), &sLength);
+ // Tracing is already performed above (unimportant for trace that this is an array)
+ s = res_getStringNoTrace(&getData(), array.internalGetResource(&getData(), 0), &sLength);
if(s != NULL) {
us.setTo(TRUE, s, sLength);
return us;
@@ -818,18 +821,45 @@ UBool icu::ResourceTable::getKeyAndValue(int32_t i,
const char *&key, icu::ResourceValue &value) const {
if(0 <= i && i < length) {
icu::ResourceDataValue &rdValue = static_cast(value);
- if (keys16 != NULL) {
- key = RES_GET_KEY16(rdValue.pResData, keys16[i]);
+ if (keys16 != nullptr) {
+ key = RES_GET_KEY16(&rdValue.getData(), keys16[i]);
} else {
- key = RES_GET_KEY32(rdValue.pResData, keys32[i]);
+ key = RES_GET_KEY32(&rdValue.getData(), keys32[i]);
}
Resource res;
- if (items16 != NULL) {
- res = makeResourceFrom16(rdValue.pResData, items16[i]);
+ if (items16 != nullptr) {
+ res = makeResourceFrom16(&rdValue.getData(), items16[i]);
} else {
res = items32[i];
}
- rdValue.setResource(res);
+ // Note: the ResourceTracer keeps a reference to the field of this
+ // ResourceTable. This is OK because the ResourceTable should remain
+ // alive for the duration that fields are being read from it
+ // (including nested fields).
+ rdValue.setResource(res, ResourceTracer(fTraceInfo, key));
+ return TRUE;
+ }
+ return FALSE;
+}
+
+UBool icu::ResourceTable::findValue(const char *key, ResourceValue &value) const {
+ icu::ResourceDataValue &rdValue = static_cast(value);
+ const char *realKey = nullptr;
+ int32_t i;
+ if (keys16 != nullptr) {
+ i = _res_findTableItem(&rdValue.getData(), keys16, length, key, &realKey);
+ } else {
+ i = _res_findTable32Item(&rdValue.getData(), keys32, length, key, &realKey);
+ }
+ if (i >= 0) {
+ Resource res;
+ if (items16 != nullptr) {
+ res = makeResourceFrom16(&rdValue.getData(), items16[i]);
+ } else {
+ res = items32[i];
+ }
+ // Same note about lifetime as in getKeyAndValue().
+ rdValue.setResource(res, ResourceTracer(fTraceInfo, key));
return TRUE;
}
return FALSE;
@@ -875,7 +905,13 @@ uint32_t icu::ResourceArray::internalGetResource(const ResourceData *pResData, i
UBool icu::ResourceArray::getValue(int32_t i, icu::ResourceValue &value) const {
if(0 <= i && i < length) {
icu::ResourceDataValue &rdValue = static_cast(value);
- rdValue.setResource(internalGetResource(rdValue.pResData, i));
+ // Note: the ResourceTracer keeps a reference to the field of this
+ // ResourceArray. This is OK because the ResourceArray should remain
+ // alive for the duration that fields are being read from it
+ // (including nested fields).
+ rdValue.setResource(
+ internalGetResource(&rdValue.getData(), i),
+ ResourceTracer(fTraceInfo, i));
return TRUE;
}
return FALSE;
@@ -899,13 +935,13 @@ res_findResource(const ResourceData *pResData, Resource r, char** path, const ch
if(!URES_IS_CONTAINER(type)) {
return RES_BOGUS;
}
-
+
while(nextSepP && *pathP && t1 != RES_BOGUS && URES_IS_CONTAINER(type)) {
/* Iteration stops if: the path has been consumed, we found a non-existing
* resource (t1 == RES_BOGUS) or we found a scalar resource (including alias)
*/
nextSepP = uprv_strchr(pathP, RES_PATH_SEPARATOR);
- /* if there are more separators, terminate string
+ /* if there are more separators, terminate string
* and set path to the remaining part of the string
*/
if(nextSepP != NULL) {
@@ -924,7 +960,7 @@ res_findResource(const ResourceData *pResData, Resource r, char** path, const ch
if(URES_IS_TABLE(type)) {
*key = pathP;
t2 = res_getTableItemByKey(pResData, t1, &indexR, key);
- if(t2 == RES_BOGUS) {
+ if(t2 == RES_BOGUS) {
/* if we fail to get the resource by key, maybe we got an index */
indexR = uprv_strtol(pathP, &closeIndex, 10);
if(indexR >= 0 && *closeIndex == 0) {
diff --git a/deps/icu-small/source/common/uresdata.h b/deps/icu-small/source/common/uresdata.h
index 4e28ddccf63199..d1b67babf29049 100644
--- a/deps/icu-small/source/common/uresdata.h
+++ b/deps/icu-small/source/common/uresdata.h
@@ -69,14 +69,16 @@ typedef uint32_t Resource;
#define RES_GET_OFFSET(res) ((res)&0x0fffffff)
#define RES_GET_POINTER(pRoot, res) ((pRoot)+RES_GET_OFFSET(res))
-/* get signed and unsigned integer values directly from the Resource handle */
+/* get signed and unsigned integer values directly from the Resource handle
+ * NOTE: For proper logging, please use the res_getInt() constexpr
+ */
#if U_SIGNED_RIGHT_SHIFT_IS_ARITHMETIC
-# define RES_GET_INT(res) (((int32_t)((res)<<4L))>>4L)
+# define RES_GET_INT_NO_TRACE(res) (((int32_t)((res)<<4L))>>4L)
#else
-# define RES_GET_INT(res) (int32_t)(((res)&0x08000000) ? (res)|0xf0000000 : (res)&0x07ffffff)
+# define RES_GET_INT_NO_TRACE(res) (int32_t)(((res)&0x08000000) ? (res)|0xf0000000 : (res)&0x07ffffff)
#endif
-#define RES_GET_UINT(res) ((res)&0x0fffffff)
+#define RES_GET_UINT_NO_TRACE(res) ((res)&0x0fffffff)
#define URES_IS_ARRAY(type) ((int32_t)(type)==URES_ARRAY || (int32_t)(type)==URES_ARRAY16)
#define URES_IS_TABLE(type) ((int32_t)(type)==URES_TABLE || (int32_t)(type)==URES_TABLE16 || (int32_t)(type)==URES_TABLE32)
@@ -423,22 +425,26 @@ res_unload(ResourceData *pResData);
U_INTERNAL UResType U_EXPORT2
res_getPublicType(Resource res);
+///////////////////////////////////////////////////////////////////////////
+// To enable tracing, use the inline versions of the res_get* functions. //
+///////////////////////////////////////////////////////////////////////////
+
/*
* Return a pointer to a zero-terminated, const UChar* string
* and set its length in *pLength.
* Returns NULL if not found.
*/
U_INTERNAL const UChar * U_EXPORT2
-res_getString(const ResourceData *pResData, Resource res, int32_t *pLength);
-
-U_INTERNAL const UChar * U_EXPORT2
-res_getAlias(const ResourceData *pResData, Resource res, int32_t *pLength);
+res_getStringNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength);
U_INTERNAL const uint8_t * U_EXPORT2
-res_getBinary(const ResourceData *pResData, Resource res, int32_t *pLength);
+res_getBinaryNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength);
U_INTERNAL const int32_t * U_EXPORT2
-res_getIntVector(const ResourceData *pResData, Resource res, int32_t *pLength);
+res_getIntVectorNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength);
+
+U_INTERNAL const UChar * U_EXPORT2
+res_getAlias(const ResourceData *pResData, Resource res, int32_t *pLength);
U_INTERNAL Resource U_EXPORT2
res_getResource(const ResourceData *pResData, const char *key);
@@ -470,17 +476,55 @@ U_CFUNC Resource res_findResource(const ResourceData *pResData, Resource r,
#ifdef __cplusplus
#include "resource.h"
+#include "restrace.h"
U_NAMESPACE_BEGIN
+inline const UChar* res_getString(const ResourceTracer& traceInfo,
+ const ResourceData *pResData, Resource res, int32_t *pLength) {
+ traceInfo.trace("string");
+ return res_getStringNoTrace(pResData, res, pLength);
+}
+
+inline const uint8_t* res_getBinary(const ResourceTracer& traceInfo,
+ const ResourceData *pResData, Resource res, int32_t *pLength) {
+ traceInfo.trace("binary");
+ return res_getBinaryNoTrace(pResData, res, pLength);
+}
+
+inline const int32_t* res_getIntVector(const ResourceTracer& traceInfo,
+ const ResourceData *pResData, Resource res, int32_t *pLength) {
+ traceInfo.trace("intvector");
+ return res_getIntVectorNoTrace(pResData, res, pLength);
+}
+
+inline int32_t res_getInt(const ResourceTracer& traceInfo, Resource res) {
+ traceInfo.trace("int");
+ return RES_GET_INT_NO_TRACE(res);
+}
+
+inline uint32_t res_getUInt(const ResourceTracer& traceInfo, Resource res) {
+ traceInfo.trace("uint");
+ return RES_GET_UINT_NO_TRACE(res);
+}
+
class ResourceDataValue : public ResourceValue {
public:
- ResourceDataValue() : pResData(NULL), res(static_cast(URES_NONE)) {}
+ ResourceDataValue() :
+ res(static_cast(URES_NONE)),
+ fTraceInfo() {}
virtual ~ResourceDataValue();
- void setData(const ResourceData *data) { pResData = data; }
- void setResource(Resource r) { res = r; }
+ void setData(const ResourceData *data) {
+ resData = *data;
+ }
+ void setResource(Resource r, ResourceTracer&& traceInfo) {
+ res = r;
+ fTraceInfo = traceInfo;
+ }
+
+ const ResourceData &getData() const { return resData; }
virtual UResType getType() const;
virtual const UChar *getString(int32_t &length, UErrorCode &errorCode) const;
virtual const UChar *getAliasString(int32_t &length, UErrorCode &errorCode) const;
@@ -497,10 +541,12 @@ class ResourceDataValue : public ResourceValue {
UErrorCode &errorCode) const;
virtual UnicodeString getStringOrFirstOfArray(UErrorCode &errorCode) const;
- const ResourceData *pResData;
-
private:
+ // TODO(ICU-20769): If UResourceBundle.fResData becomes a pointer,
+ // then remove this value field again and just store a pResData pointer.
+ ResourceData resData;
Resource res;
+ ResourceTracer fTraceInfo;
};
U_NAMESPACE_END
diff --git a/deps/icu-small/source/common/uresimp.h b/deps/icu-small/source/common/uresimp.h
index 16144012a5bc0d..f453ddc004a9fd 100644
--- a/deps/icu-small/source/common/uresimp.h
+++ b/deps/icu-small/source/common/uresimp.h
@@ -67,6 +67,9 @@ struct UResourceBundle {
char *fVersion;
UResourceDataEntry *fTopLevelData; /* for getting the valid locale */
char *fResPath; /* full path to the resource: "zh_TW/CollationElements/Sequence" */
+ // TODO(ICU-20769): Try to change the by-value fResData into a pointer,
+ // with the struct in only one place for each bundle.
+ // Also replace class ResourceDataValue.resData with a pResData pointer again.
ResourceData fResData;
char fResBuf[RES_BUFSIZE];
int32_t fResPathLen;
@@ -169,10 +172,10 @@ U_CFUNC UResourceBundle *ures_copyResb(UResourceBundle *r, const UResourceBundle
* Returns a resource that can be located using the pathToResource argument. One needs optional package, locale
* and path inside the locale, for example: "/myData/en/zoneStrings/3". Keys and indexes are supported. Keys
* need to reference data in named structures, while indexes can reference both named and anonymous resources.
- * Features a fill-in parameter.
- *
+ * Features a fill-in parameter.
+ *
* Note, this function does NOT have a syntax for specifying items within a tree. May want to consider a
- * syntax that delineates between package/tree and resource.
+ * syntax that delineates between package/tree and resource.
*
* @param pathToResource a path that will lead to the requested resource
* @param fillIn if NULL a new UResourceBundle struct is allocated and must be deleted by the caller.
@@ -181,16 +184,16 @@ U_CFUNC UResourceBundle *ures_copyResb(UResourceBundle *r, const UResourceBundle
* @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must delete it
*/
U_CAPI UResourceBundle* U_EXPORT2
-ures_findResource(const char* pathToResource,
- UResourceBundle *fillIn, UErrorCode *status);
+ures_findResource(const char* pathToResource,
+ UResourceBundle *fillIn, UErrorCode *status);
/**
- * Returns a sub resource that can be located using the pathToResource argument. One needs a path inside
+ * Returns a sub resource that can be located using the pathToResource argument. One needs a path inside
* the supplied resource, for example, if you have "en_US" resource bundle opened, you might ask for
* "zoneStrings/3". Keys and indexes are supported. Keys
- * need to reference data in named structures, while indexes can reference both
+ * need to reference data in named structures, while indexes can reference both
* named and anonymous resources.
- * Features a fill-in parameter.
+ * Features a fill-in parameter.
*
* @param resourceBundle a resource
* @param pathToResource a path that will lead to the requested resource
@@ -200,8 +203,8 @@ ures_findResource(const char* pathToResource,
* @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must delete it
*/
U_CAPI UResourceBundle* U_EXPORT2
-ures_findSubResource(const UResourceBundle *resB,
- char* pathToResource,
+ures_findSubResource(const UResourceBundle *resB,
+ char* pathToResource,
UResourceBundle *fillIn, UErrorCode *status);
/**
@@ -212,23 +215,23 @@ ures_findSubResource(const UResourceBundle *resB,
* @param resName top level resource. Example: "collations"
* @param keyword locale keyword. Example: "collation"
* @param locid The requested locale
- * @param isAvailable If non-null, pointer to fillin parameter that indicates whether the
- * requested locale was available. The locale is defined as 'available' if it physically
+ * @param isAvailable If non-null, pointer to fillin parameter that indicates whether the
+ * requested locale was available. The locale is defined as 'available' if it physically
* exists within the specified tree.
* @param omitDefault if TRUE, omit keyword and value if default. 'de_DE\@collation=standard' -> 'de_DE'
* @param status error code
- * @return the actual buffer size needed for the full locale. If it's greater
+ * @return the actual buffer size needed for the full locale. If it's greater
* than resultCapacity, the returned full name will be truncated and an error code will be returned.
*/
U_CAPI int32_t U_EXPORT2
-ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
+ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
const char *path, const char *resName, const char *keyword, const char *locid,
UBool *isAvailable, UBool omitDefault, UErrorCode *status);
/**
* Given a tree path and keyword, return a string enumeration of all possible values for that keyword.
* @param path path to the tree, or NULL for ICU data
- * @param keyword a particular keyword to consider, must match a top level resource name
+ * @param keyword a particular keyword to consider, must match a top level resource name
* within the tree.
* @param status error code
*/
@@ -248,14 +251,14 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
* Alternatively, you can supply a struct to be filled by this function.
* @param status: fills in the outgoing error code
* could be U_MISSING_RESOURCE_ERROR if the key is not found
- * could be a non-failing error
+ * could be a non-failing error
* e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING
* @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must delete it
*/
-U_CAPI UResourceBundle* U_EXPORT2
-ures_getByKeyWithFallback(const UResourceBundle *resB,
- const char* inKey,
- UResourceBundle *fillIn,
+U_CAPI UResourceBundle* U_EXPORT2
+ures_getByKeyWithFallback(const UResourceBundle *resB,
+ const char* inKey,
+ UResourceBundle *fillIn,
UErrorCode *status);
@@ -269,18 +272,23 @@ ures_getByKeyWithFallback(const UResourceBundle *resB,
* @param inKey a key associated with the requested resource
* @param status: fills in the outgoing error code
* could be U_MISSING_RESOURCE_ERROR if the key is not found
- * could be a non-failing error
+ * could be a non-failing error
* e.g.: U_USING_FALLBACK_WARNING,U_USING_DEFAULT_WARNING
* @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must delete it
*/
-U_CAPI const UChar* U_EXPORT2
-ures_getStringByKeyWithFallback(const UResourceBundle *resB,
- const char* inKey,
+U_CAPI const UChar* U_EXPORT2
+ures_getStringByKeyWithFallback(const UResourceBundle *resB,
+ const char* inKey,
int32_t* len,
UErrorCode *status);
#ifdef __cplusplus
+U_CAPI void U_EXPORT2
+ures_getValueWithFallback(const UResourceBundle *bundle, const char *path,
+ UResourceBundle *tempFillIn,
+ icu::ResourceDataValue &value, UErrorCode &errorCode);
+
U_CAPI void U_EXPORT2
ures_getAllItemsWithFallback(const UResourceBundle *bundle, const char *path,
icu::ResourceSink &sink, UErrorCode &errorCode);
@@ -310,13 +318,13 @@ ures_getVersionByKey(const UResourceBundle *resB,
* The caller does not own this string.
* @see ures_getVersion
*/
-U_CAPI const char* U_EXPORT2
+U_CAPI const char* U_EXPORT2
ures_getVersionNumberInternal(const UResourceBundle *resourceBundle);
/**
* Return the name of the Locale associated with this ResourceBundle. This API allows
- * you to query for the real locale of the resource. For example, if you requested
- * "en_US_CALIFORNIA" and only "en_US" bundle exists, "en_US" will be returned.
+ * you to query for the real locale of the resource. For example, if you requested
+ * "en_US_CALIFORNIA" and only "en_US" bundle exists, "en_US" will be returned.
* For subresources, the locale where this resource comes from will be returned.
* If fallback has occured, getLocale will reflect this.
*
@@ -326,13 +334,13 @@ ures_getVersionNumberInternal(const UResourceBundle *resourceBundle);
* @param status just for catching illegal arguments
* @return A Locale name
*/
-U_CAPI const char* U_EXPORT2
-ures_getLocaleInternal(const UResourceBundle* resourceBundle,
+U_CAPI const char* U_EXPORT2
+ures_getLocaleInternal(const UResourceBundle* resourceBundle,
UErrorCode* status);
/**
* Same as ures_openDirect() but uses the fill-in parameter instead of allocating a new bundle.
- *
+ *
* @param r The existing UResourceBundle to fill in. If NULL then status will be
* set to U_ILLEGAL_ARGUMENT_ERROR.
* @param packageName The packageName and locale together point to an ICU udata object,
diff --git a/deps/icu-small/source/common/usc_impl.cpp b/deps/icu-small/source/common/usc_impl.cpp
index d69880326a4cbd..111029b97496e7 100644
--- a/deps/icu-small/source/common/usc_impl.cpp
+++ b/deps/icu-small/source/common/usc_impl.cpp
@@ -79,7 +79,7 @@ static void push(UScriptRun *scriptRun, int32_t pairIndex, UScriptCode scriptCod
{
scriptRun->pushCount = LIMIT_INC(scriptRun->pushCount);
scriptRun->fixupCount = LIMIT_INC(scriptRun->fixupCount);
-
+
scriptRun->parenSP = INC1(scriptRun->parenSP);
scriptRun->parenStack[scriptRun->parenSP].pairIndex = pairIndex;
scriptRun->parenStack[scriptRun->parenSP].scriptCode = scriptCode;
@@ -90,14 +90,14 @@ static void pop(UScriptRun *scriptRun)
if (STACK_IS_EMPTY(scriptRun)) {
return;
}
-
+
if (scriptRun->fixupCount > 0) {
scriptRun->fixupCount -= 1;
}
-
+
scriptRun->pushCount -= 1;
scriptRun->parenSP = DEC1(scriptRun->parenSP);
-
+
/* If the stack is now empty, reset the stack
pointers to their initial values.
*/
@@ -109,7 +109,7 @@ static void pop(UScriptRun *scriptRun)
static void fixup(UScriptRun *scriptRun, UScriptCode scriptCode)
{
int32_t fixupSP = DEC(scriptRun->parenSP, scriptRun->fixupCount);
-
+
while (scriptRun->fixupCount-- > 0) {
fixupSP = INC1(fixupSP);
scriptRun->parenStack[fixupSP].scriptCode = scriptCode;
@@ -263,7 +263,7 @@ uscript_nextRun(UScriptRun *scriptRun, int32_t *pRunStart, int32_t *pRunLimit, U
if (scriptRun == NULL || scriptRun->scriptLimit >= scriptRun->textLength) {
return FALSE;
}
-
+
SYNC_FIXUP(scriptRun);
scriptRun->scriptCode = USCRIPT_COMMON;
diff --git a/deps/icu-small/source/common/uset.cpp b/deps/icu-small/source/common/uset.cpp
index 265a300b19060c..eae7981d52f0ce 100644
--- a/deps/icu-small/source/common/uset.cpp
+++ b/deps/icu-small/source/common/uset.cpp
@@ -83,7 +83,7 @@ uset_add(USet* set, UChar32 c) {
U_CAPI void U_EXPORT2
uset_addRange(USet* set, UChar32 start, UChar32 end) {
- ((UnicodeSet*) set)->UnicodeSet::add(start, end);
+ ((UnicodeSet*) set)->UnicodeSet::add(start, end);
}
U_CAPI void U_EXPORT2
@@ -527,40 +527,40 @@ uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex,
// efficiency.
// ---
// #define USET_GROW_DELTA 20
-//
+//
// static int32_t
// findChar(const UChar32* array, int32_t length, UChar32 c) {
// int32_t i;
-//
+//
// /* check the last range limit first for more efficient appending */
// if(length>0) {
// if(c>=array[length-1]) {
// return length;
// }
-//
+//
// /* do not check the last range limit again in the loop below */
// --length;
// }
-//
+//
// for(i=0; i=array[i]; ++i) {}
// return i;
// }
-//
+//
// static UBool
// addRemove(USet* set, UChar32 c, int32_t doRemove) {
// int32_t i, length, more;
-//
+//
// if(set==NULL || (uint32_t)c>0x10ffff) {
// return FALSE;
// }
-//
+//
// length=set->length;
// i=findChar(set->array, length, c);
// if((i&1)^doRemove) {
// /* c is already in the set */
// return TRUE;
// }
-//
+//
// /* how many more array items do we need? */
// if(iarray[i]) {
// /* c is just before the following range, extend that in-place by one */
@@ -600,7 +600,7 @@ uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex,
// /* insert two range limits c, c+1 */
// more=2;
// }
-//
+//
// /* insert range limits */
// if(length+more>set->capacity) {
// /* reallocate */
@@ -611,13 +611,13 @@ uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex,
// }
// set->capacity=newCapacity;
// uprv_memcpy(newArray, set->array, length*4);
-//
+//
// if(set->array!=set->staticBuffer) {
// uprv_free(set->array);
// }
// set->array=newArray;
// }
-//
+//
// if(iarray+i+more, set->array+i, (length-i)*4);
// }
@@ -626,15 +626,15 @@ uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex,
// set->array[i+1]=c+1;
// }
// set->length+=more;
-//
+//
// return TRUE;
// }
-//
+//
// U_CAPI UBool U_EXPORT2
// uset_add(USet* set, UChar32 c) {
// return addRemove(set, c, 0);
// }
-//
+//
// U_CAPI void U_EXPORT2
// uset_remove(USet* set, UChar32 c) {
// addRemove(set, c, 1);
diff --git a/deps/icu-small/source/common/uset_imp.h b/deps/icu-small/source/common/uset_imp.h
index 5f4a3113d9aaf7..7233b9303c3a17 100644
--- a/deps/icu-small/source/common/uset_imp.h
+++ b/deps/icu-small/source/common/uset_imp.h
@@ -59,3 +59,4 @@ typedef struct USetAdder USetAdder;
U_CDECL_END
#endif
+
diff --git a/deps/icu-small/source/common/uset_props.cpp b/deps/icu-small/source/common/uset_props.cpp
index b68175c1d23b14..f08e760b10d4e1 100644
--- a/deps/icu-small/source/common/uset_props.cpp
+++ b/deps/icu-small/source/common/uset_props.cpp
@@ -69,13 +69,13 @@ uset_openPatternOptions(const UChar* pattern, int32_t patternLength,
}
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
uset_applyPattern(USet *set,
const UChar *pattern, int32_t patternLength,
uint32_t options,
UErrorCode *status){
- // status code needs to be checked since we
+ // status code needs to be checked since we
// dereference it
if(status == NULL || U_FAILURE(*status)){
return 0;
@@ -92,9 +92,9 @@ uset_applyPattern(USet *set,
UnicodeString pat(pattern, patternLength);
ParsePosition pos;
-
+
((UnicodeSet*) set)->applyPattern(pat, pos, options, NULL, *status);
-
+
return pos.getIndex();
}
diff --git a/deps/icu-small/source/common/usetiter.cpp b/deps/icu-small/source/common/usetiter.cpp
index 5c9780548c182d..791516904944d3 100644
--- a/deps/icu-small/source/common/usetiter.cpp
+++ b/deps/icu-small/source/common/usetiter.cpp
@@ -120,7 +120,7 @@ void UnicodeSetIterator::reset() {
}
range = 0;
endElement = -1;
- nextElement = 0;
+ nextElement = 0;
if (endRange >= 0) {
loadRange(range);
}
diff --git a/deps/icu-small/source/common/ushape.cpp b/deps/icu-small/source/common/ushape.cpp
index 792de50bbcc736..ae13b5c11834c5 100644
--- a/deps/icu-small/source/common/ushape.cpp
+++ b/deps/icu-small/source/common/ushape.cpp
@@ -816,9 +816,9 @@ handleGeneratedSpaces(UChar *dest, int32_t sourceLength,
if(lamAlefOption || tashkeelOption){
uprv_memset(tempbuffer, 0, (sourceLength+1)*U_SIZEOF_UCHAR);
-
+
i = j = sourceLength; count = 0;
-
+
while(i >= 0) {
if ( (lamAlefOption && dest[i] == LAMALEF_SPACE_SUB) ||
(tashkeelOption && dest[i] == TASHKEEL_SPACE_SUB) ){
diff --git a/deps/icu-small/source/common/usprep.cpp b/deps/icu-small/source/common/usprep.cpp
index 9155ae077b3497..8351a773706c7a 100644
--- a/deps/icu-small/source/common/usprep.cpp
+++ b/deps/icu-small/source/common/usprep.cpp
@@ -45,13 +45,9 @@ U_CDECL_BEGIN
Static cache for already opened StringPrep profiles
*/
static UHashtable *SHARED_DATA_HASHTABLE = NULL;
-static icu::UInitOnce gSharedDataInitOnce;
-
-static UMutex *usprepMutex() {
- static UMutex m = U_MUTEX_INITIALIZER;
- return &m;
-}
+static icu::UInitOnce gSharedDataInitOnce = U_INITONCE_INITIALIZER;
+static UMutex usprepMutex;
/* format version of spp file */
//static uint8_t formatVersion[4]={ 0, 0, 0, 0 };
@@ -78,7 +74,7 @@ static const char * const PROFILE_NAMES[] = {
static UBool U_CALLCONV
isSPrepAcceptable(void * /* context */,
- const char * /* type */,
+ const char * /* type */,
const char * /* name */,
const UDataInfo *pInfo) {
if(
@@ -109,7 +105,7 @@ getSPrepFoldingOffset(uint32_t data) {
}
/* hashes an entry */
-static int32_t U_CALLCONV
+static int32_t U_CALLCONV
hashEntry(const UHashTok parm) {
UStringPrepKey *b = (UStringPrepKey *)parm.pointer;
UHashTok namekey, pathkey;
@@ -121,7 +117,7 @@ hashEntry(const UHashTok parm) {
}
/* compares two entries */
-static UBool U_CALLCONV
+static UBool U_CALLCONV
compareEntries(const UHashTok p1, const UHashTok p2) {
UStringPrepKey *b1 = (UStringPrepKey *)p1.pointer;
UStringPrepKey *b2 = (UStringPrepKey *)p2.pointer;
@@ -130,16 +126,16 @@ compareEntries(const UHashTok p1, const UHashTok p2) {
name2.pointer = b2->name;
path1.pointer = b1->path;
path2.pointer = b2->path;
- return ((UBool)(uhash_compareChars(name1, name2) &
+ return ((UBool)(uhash_compareChars(name1, name2) &
uhash_compareChars(path1, path2)));
}
-static void
+static void
usprep_unload(UStringPrepProfile* data){
udata_close(data->sprepData);
}
-static int32_t
+static int32_t
usprep_internal_flushCache(UBool noRefCount){
UStringPrepProfile *profile = NULL;
UStringPrepKey *key = NULL;
@@ -151,9 +147,9 @@ usprep_internal_flushCache(UBool noRefCount){
* if shared data hasn't even been lazy evaluated yet
* return 0
*/
- umtx_lock(usprepMutex());
+ umtx_lock(&usprepMutex);
if (SHARED_DATA_HASHTABLE == NULL) {
- umtx_unlock(usprepMutex());
+ umtx_unlock(&usprepMutex);
return 0;
}
@@ -163,7 +159,7 @@ usprep_internal_flushCache(UBool noRefCount){
profile = (UStringPrepProfile *) e->value.pointer;
key = (UStringPrepKey *) e->key.pointer;
- if ((noRefCount== FALSE && profile->refCount == 0) ||
+ if ((noRefCount== FALSE && profile->refCount == 0) ||
noRefCount== TRUE) {
deletedNum++;
uhash_removeElement(SHARED_DATA_HASHTABLE, e);
@@ -182,15 +178,15 @@ usprep_internal_flushCache(UBool noRefCount){
uprv_free(profile);
uprv_free(key);
}
-
+
}
- umtx_unlock(usprepMutex());
+ umtx_unlock(&usprepMutex);
return deletedNum;
}
-/* Works just like ucnv_flushCache()
-static int32_t
+/* Works just like ucnv_flushCache()
+static int32_t
usprep_flushCache(){
return usprep_internal_flushCache(FALSE);
}
@@ -220,18 +216,18 @@ createCache(UErrorCode &status) {
ucln_common_registerCleanup(UCLN_COMMON_USPREP, usprep_cleanup);
}
-static void
+static void
initCache(UErrorCode *status) {
umtx_initOnce(gSharedDataInitOnce, &createCache, *status);
}
static UBool U_CALLCONV
-loadData(UStringPrepProfile* profile,
- const char* path,
- const char* name,
- const char* type,
+loadData(UStringPrepProfile* profile,
+ const char* path,
+ const char* name,
+ const char* type,
UErrorCode* errorCode) {
- /* load Unicode SPREP data from file */
+ /* load Unicode SPREP data from file */
UTrie _sprepTrie={ 0,0,0,0,0,0,0 };
UDataMemory *dataMemory;
const int32_t *p=NULL;
@@ -262,7 +258,7 @@ loadData(UStringPrepProfile* profile,
}
/* in the mutex block, set the data for this process */
- umtx_lock(usprepMutex());
+ umtx_lock(&usprepMutex);
if(profile->sprepData==NULL) {
profile->sprepData=dataMemory;
dataMemory=NULL;
@@ -271,17 +267,17 @@ loadData(UStringPrepProfile* profile,
} else {
p=(const int32_t *)udata_getMemory(profile->sprepData);
}
- umtx_unlock(usprepMutex());
+ umtx_unlock(&usprepMutex);
/* initialize some variables */
profile->mappingData=(uint16_t *)((uint8_t *)(p+_SPREP_INDEX_TOP)+profile->indexes[_SPREP_INDEX_TRIE_SIZE]);
-
+
u_getUnicodeVersion(normUnicodeVersion);
- normUniVer = (normUnicodeVersion[0] << 24) + (normUnicodeVersion[1] << 16) +
+ normUniVer = (normUnicodeVersion[0] << 24) + (normUnicodeVersion[1] << 16) +
(normUnicodeVersion[2] << 8 ) + (normUnicodeVersion[3]);
- sprepUniVer = (dataVersion[0] << 24) + (dataVersion[1] << 16) +
+ sprepUniVer = (dataVersion[0] << 24) + (dataVersion[1] << 16) +
(dataVersion[2] << 8 ) + (dataVersion[3]);
normCorrVer = profile->indexes[_SPREP_NORM_CORRECTNS_LAST_UNI_VERSION];
-
+
if(U_FAILURE(*errorCode)){
udata_close(dataMemory);
return FALSE;
@@ -305,8 +301,8 @@ loadData(UStringPrepProfile* profile,
return profile->isDataLoaded;
}
-static UStringPrepProfile*
-usprep_getProfile(const char* path,
+static UStringPrepProfile*
+usprep_getProfile(const char* path,
const char* name,
UErrorCode *status){
@@ -319,22 +315,22 @@ usprep_getProfile(const char* path,
}
UStringPrepKey stackKey;
- /*
- * const is cast way to save malloc, strcpy and free calls
- * we use the passed in pointers for fetching the data from the
+ /*
+ * const is cast way to save malloc, strcpy and free calls
+ * we use the passed in pointers for fetching the data from the
* hash table which is safe
*/
stackKey.name = (char*) name;
stackKey.path = (char*) path;
/* fetch the data from the cache */
- umtx_lock(usprepMutex());
+ umtx_lock(&usprepMutex);
profile = (UStringPrepProfile*) (uhash_get(SHARED_DATA_HASHTABLE,&stackKey));
if(profile != NULL) {
profile->refCount++;
}
- umtx_unlock(usprepMutex());
-
+ umtx_unlock(&usprepMutex);
+
if(profile == NULL) {
/* else load the data and put the data in the cache */
LocalMemory newProfile;
@@ -365,7 +361,7 @@ usprep_getProfile(const char* path,
return NULL;
}
- umtx_lock(usprepMutex());
+ umtx_lock(&usprepMutex);
// If another thread already inserted the same key/value, refcount and cleanup our thread data
profile = (UStringPrepProfile*) (uhash_get(SHARED_DATA_HASHTABLE,&stackKey));
if(profile != NULL) {
@@ -379,28 +375,28 @@ usprep_getProfile(const char* path,
if(path != NULL){
key->path = keyPath.orphan();
uprv_strcpy(key->path, path);
- }
+ }
profile = newProfile.orphan();
-
+
/* add the data object to the cache */
profile->refCount = 1;
uhash_put(SHARED_DATA_HASHTABLE, key.orphan(), profile, status);
}
- umtx_unlock(usprepMutex());
+ umtx_unlock(&usprepMutex);
}
return profile;
}
U_CAPI UStringPrepProfile* U_EXPORT2
-usprep_open(const char* path,
+usprep_open(const char* path,
const char* name,
UErrorCode* status){
if(status == NULL || U_FAILURE(*status)){
return NULL;
}
-
+
/* initialize the profile struct members */
return usprep_getProfile(path,name,status);
}
@@ -425,17 +421,17 @@ usprep_close(UStringPrepProfile* profile){
return;
}
- umtx_lock(usprepMutex());
+ umtx_lock(&usprepMutex);
/* decrement the ref count*/
if(profile->refCount > 0){
profile->refCount--;
}
- umtx_unlock(usprepMutex());
-
+ umtx_unlock(&usprepMutex);
+
}
-U_CFUNC void
-uprv_syntaxError(const UChar* rules,
+U_CFUNC void
+uprv_syntaxError(const UChar* rules,
int32_t pos,
int32_t rulesLen,
UParseError* parseError){
@@ -443,16 +439,16 @@ uprv_syntaxError(const UChar* rules,
return;
}
parseError->offset = pos;
- parseError->line = 0 ; // we are not using line numbers
-
+ parseError->line = 0 ; // we are not using line numbers
+
// for pre-context
int32_t start = (pos < U_PARSE_CONTEXT_LEN)? 0 : (pos - (U_PARSE_CONTEXT_LEN-1));
int32_t limit = pos;
-
+
u_memcpy(parseError->preContext,rules+start,limit-start);
//null terminate the buffer
parseError->preContext[limit-start] = 0;
-
+
// for post-context; include error rules[pos]
start = pos;
limit = start + (U_PARSE_CONTEXT_LEN-1);
@@ -472,8 +468,8 @@ getValues(uint16_t trieWord, int16_t& value, UBool& isIndex){
UStringPrepType type;
if(trieWord == 0){
- /*
- * Initial value stored in the mapping table
+ /*
+ * Initial value stored in the mapping table
* just return USPREP_TYPE_LIMIT .. so that
* the source codepoint is copied to the destination
*/
@@ -496,7 +492,7 @@ getValues(uint16_t trieWord, int16_t& value, UBool& isIndex){
value = (int16_t)trieWord;
value = (value >> 2);
}
-
+
if((trieWord>>2) == _SPREP_MAX_INDEX_VALUE){
type = USPREP_DELETE;
isIndex =FALSE;
@@ -507,14 +503,14 @@ getValues(uint16_t trieWord, int16_t& value, UBool& isIndex){
}
// TODO: change to writing to UnicodeString not UChar *
-static int32_t
-usprep_map( const UStringPrepProfile* profile,
- const UChar* src, int32_t srcLength,
+static int32_t
+usprep_map( const UStringPrepProfile* profile,
+ const UChar* src, int32_t srcLength,
UChar* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
UErrorCode* status ){
-
+
uint16_t result;
int32_t destIndex=0;
int32_t srcIndex;
@@ -531,11 +527,11 @@ usprep_map( const UStringPrepProfile* profile,
UChar32 ch;
U16_NEXT(src,srcIndex,srcLength,ch);
-
+
result=0;
UTRIE_GET16(&profile->sprepTrie,ch,result);
-
+
type = getValues(result, value, isIndex);
// check if the source codepoint is unassigned
@@ -544,9 +540,9 @@ usprep_map( const UStringPrepProfile* profile,
uprv_syntaxError(src,srcIndex-U16_LENGTH(ch), srcLength,parseError);
*status = U_STRINGPREP_UNASSIGNED_ERROR;
return 0;
-
+
}else if(type == USPREP_MAP){
-
+
int32_t index, length;
if(isIndex){
@@ -562,7 +558,7 @@ usprep_map( const UStringPrepProfile* profile,
length = 3;
}else{
length = profile->mappingData[index++];
-
+
}
/* copy mapping to destination */
@@ -571,7 +567,7 @@ usprep_map( const UStringPrepProfile* profile,
dest[destIndex] = profile->mappingData[index+i];
}
destIndex++; /* for pre-flighting */
- }
+ }
continue;
}else{
// subtract the delta to arrive at the code point
@@ -595,27 +591,27 @@ usprep_map( const UStringPrepProfile* profile,
}
destIndex +=2;
}
-
+
}
-
+
return u_terminateUChars(dest, destCapacity, destIndex, status);
}
/*
1) Map -- For each character in the input, check if it has a mapping
- and, if so, replace it with its mapping.
+ and, if so, replace it with its mapping.
2) Normalize -- Possibly normalize the result of step 1 using Unicode
- normalization.
+ normalization.
3) Prohibit -- Check for any characters that are not allowed in the
- output. If any are found, return an error.
+ output. If any are found, return an error.
4) Check bidi -- Possibly check for right-to-left characters, and if
any are found, make sure that the whole string satisfies the
requirements for bidirectional strings. If the string does not
satisfy the requirements for bidirectional strings, return an
- error.
+ error.
[Unicode3.2] defines several bidirectional categories; each character
has one bidirectional category assigned to it. For the purposes of
the requirements below, an "RandALCat character" is a character that
@@ -641,7 +637,7 @@ usprep_map( const UStringPrepProfile* profile,
*/
U_CAPI int32_t U_EXPORT2
usprep_prepare( const UStringPrepProfile* profile,
- const UChar* src, int32_t srcLength,
+ const UChar* src, int32_t srcLength,
UChar* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
@@ -727,7 +723,7 @@ usprep_prepare( const UStringPrepProfile* profile,
UBool isIndex;
UStringPrepType type = getValues(result, value, isIndex);
- if( type == USPREP_PROHIBITED ||
+ if( type == USPREP_PROHIBITED ||
((result < _SPREP_TYPE_THRESHOLD) && (result & 0x01) /* first bit says it the code point is prohibited*/)
){
*status = U_STRINGPREP_PROHIBITED_ERROR;
@@ -759,7 +755,7 @@ usprep_prepare( const UStringPrepProfile* profile,
}
//satisfy 3
- if( rightToLeft == TRUE &&
+ if( rightToLeft == TRUE &&
!((firstCharDir == U_RIGHT_TO_LEFT || firstCharDir == U_RIGHT_TO_LEFT_ARABIC) &&
(direction == U_RIGHT_TO_LEFT || direction == U_RIGHT_TO_LEFT_ARABIC))
){
diff --git a/deps/icu-small/source/common/ustr_cnv.cpp b/deps/icu-small/source/common/ustr_cnv.cpp
index d2c2afea1592b3..9a25a9905a2374 100644
--- a/deps/icu-small/source/common/ustr_cnv.cpp
+++ b/deps/icu-small/source/common/ustr_cnv.cpp
@@ -38,10 +38,10 @@ U_CAPI UConverter* U_EXPORT2
u_getDefaultConverter(UErrorCode *status)
{
UConverter *converter = NULL;
-
+
if (gDefaultConverter != NULL) {
icu::umtx_lock(NULL);
-
+
/* need to check to make sure it wasn't taken out from under us */
if (gDefaultConverter != NULL) {
converter = gDefaultConverter;
@@ -87,10 +87,10 @@ U_CAPI void U_EXPORT2
u_flushDefaultConverter()
{
UConverter *converter = NULL;
-
+
if (gDefaultConverter != NULL) {
icu::umtx_lock(NULL);
-
+
/* need to check to make sure it wasn't taken out from under us */
if (gDefaultConverter != NULL) {
converter = gDefaultConverter;
diff --git a/deps/icu-small/source/common/ustr_cnv.h b/deps/icu-small/source/common/ustr_cnv.h
index 12e86ea02f7264..861e3ebff0613b 100644
--- a/deps/icu-small/source/common/ustr_cnv.h
+++ b/deps/icu-small/source/common/ustr_cnv.h
@@ -1,6 +1,6 @@
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
-/*
+/*
**********************************************************************
* Copyright (C) 1999-2010, International Business Machines
* Corporation and others. All Rights Reserved.
@@ -40,7 +40,7 @@ U_CAPI void U_EXPORT2
u_releaseDefaultConverter(UConverter *converter);
/**
- * Flush the default converter, if cached.
+ * Flush the default converter, if cached.
* @internal
*/
U_CAPI void U_EXPORT2
diff --git a/deps/icu-small/source/common/ustr_imp.h b/deps/icu-small/source/common/ustr_imp.h
index 943824fa197645..c555ee37ea8096 100644
--- a/deps/icu-small/source/common/ustr_imp.h
+++ b/deps/icu-small/source/common/ustr_imp.h
@@ -1,6 +1,6 @@
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
-/*
+/*
**********************************************************************
* Copyright (C) 1999-2015, International Business Machines
* Corporation and others. All Rights Reserved.
@@ -37,10 +37,10 @@ uprv_strCompare(const UChar *s1, int32_t length1,
const UChar *s2, int32_t length2,
UBool strncmpStyle, UBool codePointOrder);
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
ustr_hashUCharsN(const UChar *str, int32_t length);
-U_CAPI int32_t U_EXPORT2
+U_CAPI int32_t U_EXPORT2
ustr_hashCharsN(const char *str, int32_t length);
U_CAPI int32_t U_EXPORT2
diff --git a/deps/icu-small/source/common/ustr_titlecase_brkiter.cpp b/deps/icu-small/source/common/ustr_titlecase_brkiter.cpp
index 056b40eb4175f6..457905eb60da00 100644
--- a/deps/icu-small/source/common/ustr_titlecase_brkiter.cpp
+++ b/deps/icu-small/source/common/ustr_titlecase_brkiter.cpp
@@ -45,7 +45,7 @@ class WholeStringBreakIterator : public BreakIterator {
WholeStringBreakIterator() : BreakIterator(), length(0) {}
~WholeStringBreakIterator() U_OVERRIDE;
UBool operator==(const BreakIterator&) const U_OVERRIDE;
- BreakIterator *clone() const U_OVERRIDE;
+ WholeStringBreakIterator *clone() const U_OVERRIDE;
static UClassID U_EXPORT2 getStaticClassID();
UClassID getDynamicClassID() const U_OVERRIDE;
CharacterIterator &getText() const U_OVERRIDE;
@@ -62,9 +62,9 @@ class WholeStringBreakIterator : public BreakIterator {
int32_t preceding(int32_t offset) U_OVERRIDE;
UBool isBoundary(int32_t offset) U_OVERRIDE;
int32_t next(int32_t n) U_OVERRIDE;
- BreakIterator *createBufferClone(void *stackBuffer, int32_t &BufferSize,
- UErrorCode &errorCode) U_OVERRIDE;
- BreakIterator &refreshInputText(UText *input, UErrorCode &errorCode) U_OVERRIDE;
+ WholeStringBreakIterator *createBufferClone(void *stackBuffer, int32_t &BufferSize,
+ UErrorCode &errorCode) U_OVERRIDE;
+ WholeStringBreakIterator &refreshInputText(UText *input, UErrorCode &errorCode) U_OVERRIDE;
private:
int32_t length;
@@ -74,7 +74,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(WholeStringBreakIterator)
WholeStringBreakIterator::~WholeStringBreakIterator() {}
UBool WholeStringBreakIterator::operator==(const BreakIterator&) const { return FALSE; }
-BreakIterator *WholeStringBreakIterator::clone() const { return nullptr; }
+WholeStringBreakIterator *WholeStringBreakIterator::clone() const { return nullptr; }
CharacterIterator &WholeStringBreakIterator::getText() const {
UPRV_UNREACHABLE; // really should not be called
@@ -113,14 +113,14 @@ int32_t WholeStringBreakIterator::preceding(int32_t /*offset*/) { return 0; }
UBool WholeStringBreakIterator::isBoundary(int32_t /*offset*/) { return FALSE; }
int32_t WholeStringBreakIterator::next(int32_t /*n*/) { return length; }
-BreakIterator *WholeStringBreakIterator::createBufferClone(
+WholeStringBreakIterator *WholeStringBreakIterator::createBufferClone(
void * /*stackBuffer*/, int32_t & /*BufferSize*/, UErrorCode &errorCode) {
if (U_SUCCESS(errorCode)) {
errorCode = U_UNSUPPORTED_ERROR;
}
return nullptr;
}
-BreakIterator &WholeStringBreakIterator::refreshInputText(
+WholeStringBreakIterator &WholeStringBreakIterator::refreshInputText(
UText * /*input*/, UErrorCode &errorCode) {
if (U_SUCCESS(errorCode)) {
errorCode = U_UNSUPPORTED_ERROR;
diff --git a/deps/icu-small/source/common/ustr_wcs.cpp b/deps/icu-small/source/common/ustr_wcs.cpp
index 0372824f21f615..e9f278e9691f76 100644
--- a/deps/icu-small/source/common/ustr_wcs.cpp
+++ b/deps/icu-small/source/common/ustr_wcs.cpp
@@ -35,7 +35,7 @@
#if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
// TODO: We should use CharString for char buffers and UnicodeString for UChar buffers.
// Then we could change this to work only with wchar_t buffers.
-static inline UBool
+static inline UBool
u_growAnyBufferFromStatic(void *context,
void **pBuffer, int32_t *pCapacity, int32_t reqCapacity,
int32_t length, int32_t size) {
@@ -61,11 +61,11 @@ u_growAnyBufferFromStatic(void *context,
}
/* helper function */
-static wchar_t*
-_strToWCS(wchar_t *dest,
+static wchar_t*
+_strToWCS(wchar_t *dest,
int32_t destCapacity,
int32_t *pDestLength,
- const UChar *src,
+ const UChar *src,
int32_t srcLength,
UErrorCode *pErrorCode){
@@ -78,20 +78,20 @@ _strToWCS(wchar_t *dest,
wchar_t* intTarget=NULL;
int32_t intTargetCapacity=0;
int count=0,retVal=0;
-
+
const UChar *pSrcLimit =NULL;
const UChar *pSrc = src;
conv = u_getDefaultConverter(pErrorCode);
-
+
if(U_FAILURE(*pErrorCode)){
return NULL;
}
-
+
if(srcLength == -1){
srcLength = u_strlen(pSrc);
}
-
+
pSrcLimit = pSrc + srcLength;
for(;;) {
@@ -101,11 +101,11 @@ _strToWCS(wchar_t *dest,
/* convert to chars using default converter */
ucnv_fromUnicode(conv,&tempBuf,tempBufLimit,&pSrc,pSrcLimit,NULL,(UBool)(pSrc==pSrcLimit),pErrorCode);
count =(tempBuf - saveBuf);
-
+
/* This should rarely occur */
if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR){
tempBuf = saveBuf;
-
+
/* we dont have enough room on the stack grow the buffer */
int32_t newCapacity = 2 * srcLength;
if(newCapacity <= tempBufCapacity) {
@@ -115,7 +115,7 @@ _strToWCS(wchar_t *dest,
newCapacity, count, 1)) {
goto cleanup;
}
-
+
saveBuf = tempBuf;
tempBufLimit = tempBuf + tempBufCapacity;
tempBuf = tempBuf + count;
@@ -133,18 +133,18 @@ _strToWCS(wchar_t *dest,
if(count>=tempBufCapacity){
tempBuf = saveBuf;
/* we dont have enough room on the stack grow the buffer */
- if(!u_growAnyBufferFromStatic(stackBuffer,(void**) &tempBuf, &tempBufCapacity,
+ if(!u_growAnyBufferFromStatic(stackBuffer,(void**) &tempBuf, &tempBufCapacity,
count+1, count, 1)) {
goto cleanup;
- }
+ }
saveBuf = tempBuf;
}
-
+
saveBuf[count]=0;
+
-
- /* allocate more space than required
- * here we assume that every char requires
+ /* allocate more space than required
+ * here we assume that every char requires
* no more than 2 wchar_ts
*/
intTargetCapacity = (count * _BUFFER_CAPACITY_MULTIPLIER + 1) /*for null termination */;
@@ -156,15 +156,15 @@ _strToWCS(wchar_t *dest,
int32_t remaining = intTargetCapacity;
wchar_t* pIntTarget=intTarget;
tempBuf = saveBuf;
-
+
/* now convert the mbs to wcs */
for(;;){
-
+
/* we can call the system API since we are sure that
* there is atleast 1 null in the input
*/
retVal = uprv_mbstowcs(pIntTarget,(tempBuf+nulLen),remaining);
-
+
if(retVal==-1){
*pErrorCode = U_INVALID_CHAR_FOUND;
break;
@@ -189,10 +189,10 @@ _strToWCS(wchar_t *dest,
/* we donot check for limit since tempBuf is null terminated */
while(tempBuf[nulLen++] != 0){
}
- nulVal = (nulLen < srcLength) ? 1 : 0;
+ nulVal = (nulLen < srcLength) ? 1 : 0;
pIntTarget = pIntTarget + retVal+nulVal;
remaining -=(retVal+nulVal);
-
+
/* check if we have reached the source limit*/
if(nulLen>=(count)){
break;
@@ -200,10 +200,10 @@ _strToWCS(wchar_t *dest,
}
}
count = (int32_t)(pIntTarget-intTarget);
-
+
if(0 < count && count <= destCapacity){
uprv_memcpy(dest, intTarget, (size_t)count*sizeof(wchar_t));
- }
+ }
if(pDestLength){
*pDestLength = count;
@@ -229,10 +229,10 @@ _strToWCS(wchar_t *dest,
#endif
U_CAPI wchar_t* U_EXPORT2
-u_strToWCS(wchar_t *dest,
+u_strToWCS(wchar_t *dest,
int32_t destCapacity,
int32_t *pDestLength,
- const UChar *src,
+ const UChar *src,
int32_t srcLength,
UErrorCode *pErrorCode){
@@ -240,14 +240,14 @@ u_strToWCS(wchar_t *dest,
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)){
return NULL;
}
-
+
if( (src==NULL && srcLength!=0) || srcLength < -1 ||
(destCapacity<0) || (dest == NULL && destCapacity > 0)
) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
}
-
+
#ifdef U_WCHAR_IS_UTF16
/* wchar_t is UTF-16 just do a memcpy */
if(srcLength == -1){
@@ -265,23 +265,23 @@ u_strToWCS(wchar_t *dest,
return dest;
#elif defined U_WCHAR_IS_UTF32
-
+
return (wchar_t*)u_strToUTF32((UChar32*)dest, destCapacity, pDestLength,
src, srcLength, pErrorCode);
#else
-
+
return _strToWCS(dest,destCapacity,pDestLength,src,srcLength, pErrorCode);
-
+
#endif
}
#if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
/* helper function */
-static UChar*
+static UChar*
_strFromWCS( UChar *dest,
- int32_t destCapacity,
+ int32_t destCapacity,
int32_t *pDestLength,
const wchar_t *src,
int32_t srcLength,
@@ -292,7 +292,7 @@ _strFromWCS( UChar *dest,
UChar* pTarget = NULL;
UChar* pTargetLimit = NULL;
UChar* target = NULL;
-
+
UChar uStack [_STACK_BUFFER_CAPACITY];
wchar_t wStack[_STACK_BUFFER_CAPACITY];
@@ -316,7 +316,7 @@ _strFromWCS( UChar *dest,
for(;;){
/* convert wchars to chars */
retVal = uprv_wcstombs(pCSrc,src, cStackCap);
-
+
if(retVal == -1){
*pErrorCode = U_ILLEGAL_CHAR_FOUND;
goto cleanup;
@@ -331,14 +331,14 @@ _strFromWCS( UChar *dest,
break;
}
}
-
+
}else{
- /* here the source is not null terminated
+ /* here the source is not null terminated
* so it may have nulls embeded and we need to
- * do some extra processing
+ * do some extra processing
*/
int32_t remaining =cStackCap;
-
+
pSrcLimit = src + srcLength;
for(;;){
@@ -363,7 +363,7 @@ _strFromWCS( UChar *dest,
remaining = cStackCap-(pCSrc - pCSave);
}
- /* we have found a null so convert the
+ /* we have found a null so convert the
* chunk from begining of non-null char to null
*/
retVal = uprv_wcstombs(pCSrc,pSrc,remaining);
@@ -382,7 +382,7 @@ _strFromWCS( UChar *dest,
}else{
- /* the source is not null terminated and we are
+ /* the source is not null terminated and we are
* end of source so we copy the source to a temp buffer
* null terminate it and convert wchar_ts to chars
*/
@@ -399,10 +399,10 @@ _strFromWCS( UChar *dest,
/* copy the contents to tempStack */
uprv_memcpy(pWStack, pSrc, (size_t)nulLen*sizeof(wchar_t));
}
-
+
/* null terminate the tempBuffer */
pWStack[nulLen] =0 ;
-
+
if(remaining < (nulLen * MB_CUR_MAX)){
/* Should rarely occur */
int32_t len = (pCSrc-pCSave);
@@ -417,7 +417,7 @@ _strFromWCS( UChar *dest,
}
/* convert to chars */
retVal = uprv_wcstombs(pCSrc,pWStack,remaining);
-
+
pCSrc += retVal;
pSrc += nulLen;
srcLength-=nulLen; /* decrement the srcLength */
@@ -426,30 +426,30 @@ _strFromWCS( UChar *dest,
}
}
- /* OK..now we have converted from wchar_ts to chars now
- * convert chars to UChars
+ /* OK..now we have converted from wchar_ts to chars now
+ * convert chars to UChars
*/
pCSrcLimit = pCSrc;
pCSrc = pCSave;
pTarget = target= dest;
- pTargetLimit = dest + destCapacity;
-
+ pTargetLimit = dest + destCapacity;
+
conv= u_getDefaultConverter(pErrorCode);
-
+
if(U_FAILURE(*pErrorCode)|| conv==NULL){
goto cleanup;
}
-
+
for(;;) {
-
+
*pErrorCode = U_ZERO_ERROR;
-
+
/* convert to stack buffer*/
ucnv_toUnicode(conv,&pTarget,pTargetLimit,(const char**)&pCSrc,pCSrcLimit,NULL,(UBool)(pCSrc==pCSrcLimit),pErrorCode);
-
+
/* increment count to number written to stack */
count+= pTarget - target;
-
+
if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR){
target = uStack;
pTarget = uStack;
@@ -457,17 +457,17 @@ _strFromWCS( UChar *dest,
} else {
break;
}
-
+
}
-
+
if(pDestLength){
*pDestLength =count;
}
u_terminateUChars(dest,destCapacity,count,pErrorCode);
-
+
cleanup:
-
+
if(cStack != pCSave){
uprv_free(pCSave);
}
@@ -475,7 +475,7 @@ _strFromWCS( UChar *dest,
if(wStack != pWStack){
uprv_free(pWStack);
}
-
+
u_releaseDefaultConverter(conv);
return dest;
@@ -484,7 +484,7 @@ _strFromWCS( UChar *dest,
U_CAPI UChar* U_EXPORT2
u_strFromWCS(UChar *dest,
- int32_t destCapacity,
+ int32_t destCapacity,
int32_t *pDestLength,
const wchar_t *src,
int32_t srcLength,
@@ -520,13 +520,13 @@ u_strFromWCS(UChar *dest,
return dest;
#elif defined U_WCHAR_IS_UTF32
-
+
return u_strFromUTF32(dest, destCapacity, pDestLength,
(UChar32*)src, srcLength, pErrorCode);
#else
- return _strFromWCS(dest,destCapacity,pDestLength,src,srcLength,pErrorCode);
+ return _strFromWCS(dest,destCapacity,pDestLength,src,srcLength,pErrorCode);
#endif
diff --git a/deps/icu-small/source/common/ustrenum.cpp b/deps/icu-small/source/common/ustrenum.cpp
index 8be79c98999256..ed23eaa232ec48 100644
--- a/deps/icu-small/source/common/ustrenum.cpp
+++ b/deps/icu-small/source/common/ustrenum.cpp
@@ -10,7 +10,7 @@
* Since: ICU 2.4
**********************************************************************
*/
-#include "utypeinfo.h" // for 'typeid' to work
+#include "utypeinfo.h" // for 'typeid' to work
#include "unicode/ustring.h"
#include "unicode/strenum.h"
@@ -120,9 +120,9 @@ StringEnumeration::setChars(const char *s, int32_t length, UErrorCode &status) {
return NULL;
}
-UBool
+UBool
StringEnumeration::operator==(const StringEnumeration& that)const {
- return typeid(*this) == typeid(that);
+ return typeid(*this) == typeid(that);
}
UBool
@@ -260,7 +260,7 @@ U_CDECL_END
* delete it (regardless of error status).
*/
U_CAPI UEnumeration* U_EXPORT2
-uenum_openFromStringEnumeration(icu::StringEnumeration* adopted, UErrorCode* ec) {
+uenum_openFromStringEnumeration(icu::StringEnumeration* adopted, UErrorCode* ec) {
UEnumeration* result = NULL;
if (U_SUCCESS(*ec) && adopted != NULL) {
result = (UEnumeration*) uprv_malloc(sizeof(UEnumeration));
diff --git a/deps/icu-small/source/common/ustrenum.h b/deps/icu-small/source/common/ustrenum.h
index 582727cd1f742b..a82162e2bde014 100644
--- a/deps/icu-small/source/common/ustrenum.h
+++ b/deps/icu-small/source/common/ustrenum.h
@@ -84,3 +84,4 @@ class U_COMMON_API UStringEnumeration : public StringEnumeration {
U_NAMESPACE_END
#endif
+
diff --git a/deps/icu-small/source/common/ustring.cpp b/deps/icu-small/source/common/ustring.cpp
index a1a51f4b1e1734..67cb4544b9a80f 100644
--- a/deps/icu-small/source/common/ustring.cpp
+++ b/deps/icu-small/source/common/ustring.cpp
@@ -575,7 +575,7 @@ u_strspn(const UChar *string, const UChar *matchSet)
/* ----- Text manipulation functions --- */
U_CAPI UChar* U_EXPORT2
-u_strtok_r(UChar *src,
+u_strtok_r(UChar *src,
const UChar *delim,
UChar **saveState)
{
@@ -625,7 +625,7 @@ u_strtok_r(UChar *src,
/* Miscellaneous functions -------------------------------------------------- */
U_CAPI UChar* U_EXPORT2
-u_strcat(UChar *dst,
+u_strcat(UChar *dst,
const UChar *src)
{
UChar *anchor = dst; /* save a pointer to start of dst */
@@ -640,9 +640,9 @@ u_strcat(UChar *dst,
}
U_CAPI UChar* U_EXPORT2
-u_strncat(UChar *dst,
- const UChar *src,
- int32_t n )
+u_strncat(UChar *dst,
+ const UChar *src,
+ int32_t n )
{
if(n > 0) {
UChar *anchor = dst; /* save a pointer to start of dst */
@@ -668,8 +668,8 @@ u_strncat(UChar *dst,
/* ----- Text property functions --- */
U_CAPI int32_t U_EXPORT2
-u_strcmp(const UChar *s1,
- const UChar *s2)
+u_strcmp(const UChar *s1,
+ const UChar *s2)
{
UChar c1, c2;
@@ -939,9 +939,9 @@ u_strcmpCodePointOrder(const UChar *s1, const UChar *s2) {
}
U_CAPI int32_t U_EXPORT2
-u_strncmp(const UChar *s1,
- const UChar *s2,
- int32_t n)
+u_strncmp(const UChar *s1,
+ const UChar *s2,
+ int32_t n)
{
if(n > 0) {
int32_t rc;
@@ -964,8 +964,8 @@ u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n) {
}
U_CAPI UChar* U_EXPORT2
-u_strcpy(UChar *dst,
- const UChar *src)
+u_strcpy(UChar *dst,
+ const UChar *src)
{
UChar *anchor = dst; /* save a pointer to start of dst */
@@ -976,9 +976,9 @@ u_strcpy(UChar *dst,
}
U_CAPI UChar* U_EXPORT2
-u_strncpy(UChar *dst,
- const UChar *src,
- int32_t n)
+u_strncpy(UChar *dst,
+ const UChar *src,
+ int32_t n)
{
UChar *anchor = dst; /* save a pointer to start of dst */
@@ -991,7 +991,7 @@ u_strncpy(UChar *dst,
}
U_CAPI int32_t U_EXPORT2
-u_strlen(const UChar *s)
+u_strlen(const UChar *s)
{
#if U_SIZEOF_WCHAR_T == U_SIZEOF_UCHAR
return (int32_t)uprv_wcslen((const wchar_t *)s);
@@ -1221,7 +1221,7 @@ u_unescapeAt(UNESCAPE_CHAR_AT charAt,
int8_t n = 0;
int8_t minDig = 0;
int8_t maxDig = 0;
- int8_t bitsPerDigit = 4;
+ int8_t bitsPerDigit = 4;
int8_t dig;
int32_t i;
UBool braces = FALSE;
@@ -1428,7 +1428,7 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) {
* NUL-terminate a string no matter what its type.
* Set warning and error codes accordingly.
*/
-#define __TERMINATE_STRING(dest, destCapacity, length, pErrorCode) \
+#define __TERMINATE_STRING(dest, destCapacity, length, pErrorCode) UPRV_BLOCK_MACRO_BEGIN { \
if(pErrorCode!=NULL && U_SUCCESS(*pErrorCode)) { \
/* not a public function, so no complete argument checking */ \
\
@@ -1448,7 +1448,8 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) {
/* even the string itself did not fit - set an error code */ \
*pErrorCode=U_BUFFER_OVERFLOW_ERROR; \
} \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
U_CAPI int32_t U_EXPORT2
u_terminateUChars(UChar *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode) {
@@ -1488,7 +1489,7 @@ u_terminateWChars(wchar_t *dest, int32_t destCapacity, int32_t length, UErrorCod
the output range. [LIU]
*/
-#define STRING_HASH(TYPE, STR, STRLEN, DEREF) \
+#define STRING_HASH(TYPE, STR, STRLEN, DEREF) UPRV_BLOCK_MACRO_BEGIN { \
uint32_t hash = 0; \
const TYPE *p = (const TYPE*) STR; \
if (p != NULL) { \
@@ -1500,7 +1501,8 @@ u_terminateWChars(wchar_t *dest, int32_t destCapacity, int32_t length, UErrorCod
p += inc; \
} \
} \
- return static_cast(hash)
+ return static_cast(hash); \
+} UPRV_BLOCK_MACRO_END
/* Used by UnicodeString to compute its hashcode - Not public API. */
U_CAPI int32_t U_EXPORT2
diff --git a/deps/icu-small/source/common/ustrtrns.cpp b/deps/icu-small/source/common/ustrtrns.cpp
index 583ec63c323aee..5dc032c02fb807 100644
--- a/deps/icu-small/source/common/ustrtrns.cpp
+++ b/deps/icu-small/source/common/ustrtrns.cpp
@@ -36,7 +36,7 @@
#include "ustr_imp.h"
#include "uassert.h"
-U_CAPI UChar* U_EXPORT2
+U_CAPI UChar* U_EXPORT2
u_strFromUTF32WithSub(UChar *dest,
int32_t destCapacity,
int32_t *pDestLength,
@@ -132,13 +132,13 @@ u_strFromUTF32WithSub(UChar *dest,
/* Terminate the buffer */
u_terminateUChars(dest, destCapacity, reqLength, pErrorCode);
-
+
return dest;
}
-U_CAPI UChar* U_EXPORT2
+U_CAPI UChar* U_EXPORT2
u_strFromUTF32(UChar *dest,
- int32_t destCapacity,
+ int32_t destCapacity,
int32_t *pDestLength,
const UChar32 *src,
int32_t srcLength,
@@ -150,7 +150,7 @@ u_strFromUTF32(UChar *dest,
pErrorCode);
}
-U_CAPI UChar32* U_EXPORT2
+U_CAPI UChar32* U_EXPORT2
u_strToUTF32WithSub(UChar32 *dest,
int32_t destCapacity,
int32_t *pDestLength,
@@ -242,11 +242,11 @@ u_strToUTF32WithSub(UChar32 *dest,
return dest;
}
-U_CAPI UChar32* U_EXPORT2
-u_strToUTF32(UChar32 *dest,
+U_CAPI UChar32* U_EXPORT2
+u_strToUTF32(UChar32 *dest,
int32_t destCapacity,
int32_t *pDestLength,
- const UChar *src,
+ const UChar *src,
int32_t srcLength,
UErrorCode *pErrorCode) {
return u_strToUTF32WithSub(
@@ -566,7 +566,7 @@ u_strFromUTF8Lenient(UChar *dest,
if(U_FAILURE(*pErrorCode)){
return NULL;
}
-
+
if( (src==NULL && srcLength!=0) || srcLength < -1 ||
(destCapacity<0) || (dest == NULL && destCapacity > 0)
) {
@@ -788,8 +788,8 @@ _appendUTF8(uint8_t *pDest, UChar32 c) {
return pDest;
}
-
-U_CAPI char* U_EXPORT2
+
+U_CAPI char* U_EXPORT2
u_strToUTF8WithSub(char *dest,
int32_t destCapacity,
int32_t *pDestLength,
@@ -807,7 +807,7 @@ u_strToUTF8WithSub(char *dest,
if(U_FAILURE(*pErrorCode)){
return NULL;
}
-
+
if( (pSrc==NULL && srcLength!=0) || srcLength < -1 ||
(destCapacity<0) || (dest == NULL && destCapacity > 0) ||
subchar > 0x10ffff || U_IS_SURROGATE(subchar)
@@ -852,7 +852,7 @@ u_strToUTF8WithSub(char *dest,
int32_t length;
/*need not check for NUL because NUL fails U16_IS_TRAIL() anyway*/
- if(U16_IS_SURROGATE_LEAD(ch) && U16_IS_TRAIL(ch2=*pSrc)) {
+ if(U16_IS_SURROGATE_LEAD(ch) && U16_IS_TRAIL(ch2=*pSrc)) {
++pSrc;
ch=U16_GET_SUPPLEMENTARY(ch, ch2);
} else if(subchar>=0) {
@@ -939,7 +939,7 @@ u_strToUTF8WithSub(char *dest,
break; /* recompute count */
}
- if(U16_IS_SURROGATE_LEAD(ch) && U16_IS_TRAIL(ch2=*pSrc)) {
+ if(U16_IS_SURROGATE_LEAD(ch) && U16_IS_TRAIL(ch2=*pSrc)) {
++pSrc;
ch=U16_GET_SUPPLEMENTARY(ch, ch2);
@@ -994,7 +994,7 @@ u_strToUTF8WithSub(char *dest,
} else /* ch is a surrogate */ {
int32_t length;
- if(U16_IS_SURROGATE_LEAD(ch) && pSrc=0) {
@@ -1053,7 +1053,7 @@ u_strToUTF8WithSub(char *dest,
return dest;
}
-U_CAPI char* U_EXPORT2
+U_CAPI char* U_EXPORT2
u_strToUTF8(char *dest,
int32_t destCapacity,
int32_t *pDestLength,
@@ -1309,12 +1309,12 @@ u_strFromJavaModifiedUTF8WithSub(
return dest;
}
-U_CAPI char* U_EXPORT2
+U_CAPI char* U_EXPORT2
u_strToJavaModifiedUTF8(
char *dest,
int32_t destCapacity,
int32_t *pDestLength,
- const UChar *src,
+ const UChar *src,
int32_t srcLength,
UErrorCode *pErrorCode) {
int32_t reqLength=0;
diff --git a/deps/icu-small/source/common/utext.cpp b/deps/icu-small/source/common/utext.cpp
index 5e3a005626e6b8..9a77228cfc6d18 100644
--- a/deps/icu-small/source/common/utext.cpp
+++ b/deps/icu-small/source/common/utext.cpp
@@ -567,7 +567,7 @@ enum {
struct ExtendedUText {
UText ut;
- UAlignedMemory extension;
+ max_align_t extension;
};
static const UText emptyText = UTEXT_INITIALIZER;
@@ -582,7 +582,7 @@ utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) {
// We need to heap-allocate storage for the new UText
int32_t spaceRequired = sizeof(UText);
if (extraSpace > 0) {
- spaceRequired = sizeof(ExtendedUText) + extraSpace - sizeof(UAlignedMemory);
+ spaceRequired = sizeof(ExtendedUText) + extraSpace - sizeof(max_align_t);
}
ut = (UText *)uprv_malloc(spaceRequired);
if (ut == NULL) {
@@ -1302,7 +1302,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) {
// If index is at the end, there is no character there to look at.
if (ix != ut->b) {
// Note: this function will only move the index back if it is on a trail byte
- // and there is a preceding lead byte and the sequence from the lead
+ // and there is a preceding lead byte and the sequence from the lead
// through this trail could be part of a valid UTF-8 sequence
// Otherwise the index remains unchanged.
U8_SET_CP_START(s8, 0, ix);
diff --git a/deps/icu-small/source/common/util.cpp b/deps/icu-small/source/common/util.cpp
index 838a201a73d803..86e5c791bad98e 100644
--- a/deps/icu-small/source/common/util.cpp
+++ b/deps/icu-small/source/common/util.cpp
@@ -169,7 +169,7 @@ int32_t ICU_Utility::skipWhitespace(const UnicodeString& str, int32_t& pos,
//? if (!isForward) {
//? --pos; // pos is a limit, so back up by one
//? }
-//?
+//?
//? while (pos != stop &&
//? PatternProps::isWhiteSpace(c = text.char32At(pos))) {
//? if (isForward) {
@@ -276,6 +276,16 @@ int32_t ICU_Utility::parsePattern(const UnicodeString& pat,
return -1; // text ended before end of pat
}
+int32_t ICU_Utility::parseAsciiInteger(const UnicodeString& str, int32_t& pos) {
+ int32_t result = 0;
+ UChar c;
+ while (pos < str.length() && (c = str.charAt(pos)) >= u'0' && c <= u'9') {
+ result = result * 10 + (c - u'0');
+ pos++;
+ }
+ return result;
+}
+
/**
* Append a character to a rule that is being built up. To flush
* the quoteBuf to rule, make one final call with isLiteral == TRUE.
@@ -376,7 +386,7 @@ void ICU_Utility::appendToRule(UnicodeString& rule,
quoteBuf.append(c);
}
}
-
+
// Otherwise just append
else {
rule.append(c);
diff --git a/deps/icu-small/source/common/util.h b/deps/icu-small/source/common/util.h
index 92cdc9ef69a58a..f3f71dce458e6c 100644
--- a/deps/icu-small/source/common/util.h
+++ b/deps/icu-small/source/common/util.h
@@ -153,7 +153,7 @@ class U_COMMON_API ICU_Utility /* not : public UObject because all methods are s
*/
static int32_t parsePattern(const UnicodeString& rule, int32_t pos, int32_t limit,
const UnicodeString& pattern, int32_t* parsedInts);
-
+
/**
* Parse a pattern string within the given Replaceable and a parsing
* pattern. Characters are matched literally and case-sensitively
@@ -179,12 +179,21 @@ class U_COMMON_API ICU_Utility /* not : public UObject because all methods are s
* Parse an integer at pos, either of the form \d+ or of the form
* 0x[0-9A-Fa-f]+ or 0[0-7]+, that is, in standard decimal, hex,
* or octal format.
- * @param pos INPUT-OUTPUT parameter. On input, the first
- * character to parse. On output, the character after the last
- * parsed character.
+ * @param pos INPUT-OUTPUT parameter. On input, the index of the first
+ * character to parse. On output, the index of the character after the
+ * last parsed character.
*/
static int32_t parseInteger(const UnicodeString& rule, int32_t& pos, int32_t limit);
+ /**
+ * Parse an integer at pos using only ASCII digits.
+ * Base 10 only.
+ * @param pos INPUT-OUTPUT parameter. On input, the index of the first
+ * character to parse. On output, the index of the character after the
+ * last parsed character.
+ */
+ static int32_t parseAsciiInteger(const UnicodeString& str, int32_t& pos);
+
/**
* Parse a Unicode identifier from the given string at the given
* position. Return the identifier, or an empty string if there
@@ -225,7 +234,7 @@ class U_COMMON_API ICU_Utility /* not : public UObject because all methods are s
UBool isLiteral,
UBool escapeUnprintable,
UnicodeString& quoteBuf);
-
+
static void appendToRule(UnicodeString& rule,
const UnicodeString& text,
UBool isLiteral,
diff --git a/deps/icu-small/source/common/util_props.cpp b/deps/icu-small/source/common/util_props.cpp
index 36057a6066db94..95a112bc9122c3 100644
--- a/deps/icu-small/source/common/util_props.cpp
+++ b/deps/icu-small/source/common/util_props.cpp
@@ -214,3 +214,4 @@ int32_t ICU_Utility::parseNumber(const UnicodeString& text,
}
U_NAMESPACE_END
+
diff --git a/deps/icu-small/source/common/utrace.cpp b/deps/icu-small/source/common/utrace.cpp
index 01bdb38e907518..c981546594706c 100644
--- a/deps/icu-small/source/common/utrace.cpp
+++ b/deps/icu-small/source/common/utrace.cpp
@@ -75,14 +75,14 @@ utrace_exit(int32_t fnNumber, int32_t returnType, ...) {
va_end(args);
}
}
+
-
-
-U_CAPI void U_EXPORT2
+
+U_CAPI void U_EXPORT2
utrace_data(int32_t fnNumber, int32_t level, const char *fmt, ...) {
if (pTraceDataFunc != NULL) {
va_list args;
- va_start(args, fmt );
+ va_start(args, fmt );
(*pTraceDataFunc)(gTraceContext, fnNumber, level, fmt, args);
va_end(args);
}
@@ -146,7 +146,7 @@ static void outputPtrBytes(void *val, char *outBuf, int32_t *outIx, int32_t capa
p += sizeof(void *) - 1;
#endif
- /* Loop through the bytes of the ptr as it sits in memory, from
+ /* Loop through the bytes of the ptr as it sits in memory, from
* most significant to least significant end */
for (i=0; i 0) {
outputHexBytes(longArg, charsToOutput, outBuf, &outIx, capacity);
@@ -386,7 +386,7 @@ utrace_format(char *outBuf, int32_t capacity,
int32_t indent, const char *fmt, ...) {
int32_t retVal;
va_list args;
- va_start(args, fmt );
+ va_start(args, fmt );
retVal = utrace_vformat(outBuf, capacity, indent, fmt, args);
va_end(args);
return retVal;
@@ -429,7 +429,7 @@ utrace_getLevel() {
}
-U_CFUNC UBool
+U_CFUNC UBool
utrace_cleanup() {
pTraceEntryFunc = NULL;
pTraceExitFunc = NULL;
@@ -461,7 +461,7 @@ trConvNames[] = {
NULL
};
-
+
static const char * const
trCollNames[] = {
"ucol_open",
@@ -477,6 +477,16 @@ trCollNames[] = {
};
+static const char* const
+trResDataNames[] = {
+ "resc",
+ "bundle-open",
+ "file-open",
+ "res-open",
+ NULL
+};
+
+
U_CAPI const char * U_EXPORT2
utrace_functionName(int32_t fnNumber) {
if(UTRACE_FUNCTION_START <= fnNumber && fnNumber < UTRACE_FUNCTION_LIMIT) {
@@ -485,7 +495,10 @@ utrace_functionName(int32_t fnNumber) {
return trConvNames[fnNumber - UTRACE_CONVERSION_START];
} else if(UTRACE_COLLATION_START <= fnNumber && fnNumber < UTRACE_COLLATION_LIMIT){
return trCollNames[fnNumber - UTRACE_COLLATION_START];
+ } else if(UTRACE_UDATA_START <= fnNumber && fnNumber < UTRACE_RES_DATA_LIMIT){
+ return trResDataNames[fnNumber - UTRACE_UDATA_START];
} else {
return "[BOGUS Trace Function Number]";
}
}
+
diff --git a/deps/icu-small/source/common/utracimp.h b/deps/icu-small/source/common/utracimp.h
index c2819830e1ba52..f32fe1db394824 100644
--- a/deps/icu-small/source/common/utracimp.h
+++ b/deps/icu-small/source/common/utracimp.h
@@ -47,8 +47,8 @@
U_CDECL_BEGIN
-/**
- * Traced Function Exit return types.
+/**
+ * Traced Function Exit return types.
* Flags indicating the number and types of varargs included in a call
* to a UTraceExit function.
* Bits 0-3: The function return type. First variable param.
@@ -117,15 +117,15 @@ U_CDECL_END
#define UTRACE_LEVEL(level) (utrace_getLevel()>=(level))
/**
- * Flag bit in utraceFnNumber, the local variable added to each function
+ * Flag bit in utraceFnNumber, the local variable added to each function
* with tracing code to contains the function number.
*
* Set the flag if the function's entry is traced, which will cause the
- * function's exit to also be traced. utraceFnNumber is uncoditionally
+ * function's exit to also be traced. utraceFnNumber is uncoditionally
* set at entry, whether or not the entry is traced, so that it will
* always be available for error trace output.
* @internal
- */
+ */
#define UTRACE_TRACED_ENTRY 0x80000000
/**
@@ -144,10 +144,12 @@ U_CDECL_END
*/
#define UTRACE_ENTRY(fnNumber) \
int32_t utraceFnNumber=(fnNumber); \
+UPRV_BLOCK_MACRO_BEGIN { \
if(utrace_getLevel()>=UTRACE_INFO) { \
utrace_entry(fnNumber); \
utraceFnNumber |= UTRACE_TRACED_ENTRY; \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
/**
@@ -162,10 +164,12 @@ U_CDECL_END
*/
#define UTRACE_ENTRY_OC(fnNumber) \
int32_t utraceFnNumber=(fnNumber); \
+UPRV_BLOCK_MACRO_BEGIN { \
if(utrace_getLevel()>=UTRACE_OPEN_CLOSE) { \
utrace_entry(fnNumber); \
utraceFnNumber |= UTRACE_TRACED_ENTRY; \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement for each exit point of a function that has a UTRACE_ENTRY()
@@ -179,10 +183,11 @@ U_CDECL_END
*
* @internal
*/
-#define UTRACE_EXIT() \
- {if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
+#define UTRACE_EXIT() UPRV_BLOCK_MACRO_BEGIN { \
+ if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
utrace_exit(utraceFnNumber & ~UTRACE_TRACED_ENTRY, UTRACE_EXITV_NONE); \
- }}
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement for each exit point of a function that has a UTRACE_ENTRY()
@@ -190,27 +195,31 @@ U_CDECL_END
*
* @param val The function's return value, int32_t or comatible type.
*
- * @internal
+ * @internal
*/
-#define UTRACE_EXIT_VALUE(val) \
- {if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
+#define UTRACE_EXIT_VALUE(val) UPRV_BLOCK_MACRO_BEGIN { \
+ if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
utrace_exit(utraceFnNumber & ~UTRACE_TRACED_ENTRY, UTRACE_EXITV_I32, val); \
- }}
+ } \
+} UPRV_BLOCK_MACRO_END
-#define UTRACE_EXIT_STATUS(status) \
- {if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
+#define UTRACE_EXIT_STATUS(status) UPRV_BLOCK_MACRO_BEGIN { \
+ if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
utrace_exit(utraceFnNumber & ~UTRACE_TRACED_ENTRY, UTRACE_EXITV_STATUS, status); \
- }}
+ } \
+} UPRV_BLOCK_MACRO_END
-#define UTRACE_EXIT_VALUE_STATUS(val, status) \
- {if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
+#define UTRACE_EXIT_VALUE_STATUS(val, status) UPRV_BLOCK_MACRO_BEGIN { \
+ if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
utrace_exit(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (UTRACE_EXITV_I32 | UTRACE_EXITV_STATUS), val, status); \
- }}
+ } \
+} UPRV_BLOCK_MACRO_END
-#define UTRACE_EXIT_PTR_STATUS(ptr, status) \
- {if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
+#define UTRACE_EXIT_PTR_STATUS(ptr, status) UPRV_BLOCK_MACRO_BEGIN { \
+ if(utraceFnNumber & UTRACE_TRACED_ENTRY) { \
utrace_exit(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (UTRACE_EXITV_PTR | UTRACE_EXITV_STATUS), ptr, status); \
- }}
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -220,10 +229,11 @@ U_CDECL_END
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA0(level, fmt) \
+#define UTRACE_DATA0(level, fmt) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt)); \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -233,10 +243,11 @@ U_CDECL_END
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA1(level, fmt, a) \
+#define UTRACE_DATA1(level, fmt, a) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY , (level), (fmt), (a)); \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -246,10 +257,11 @@ U_CDECL_END
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA2(level, fmt, a, b) \
+#define UTRACE_DATA2(level, fmt, a, b) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY , (level), (fmt), (a), (b)); \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -259,10 +271,11 @@ U_CDECL_END
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA3(level, fmt, a, b, c) \
+#define UTRACE_DATA3(level, fmt, a, b, c) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c)); \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -272,10 +285,11 @@ U_CDECL_END
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA4(level, fmt, a, b, c, d) \
+#define UTRACE_DATA4(level, fmt, a, b, c, d) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d)); \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -285,10 +299,11 @@ U_CDECL_END
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA5(level, fmt, a, b, c, d, e) \
+#define UTRACE_DATA5(level, fmt, a, b, c, d, e) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d), (e)); \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -298,10 +313,11 @@ U_CDECL_END
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA6(level, fmt, a, b, c, d, e, f) \
+#define UTRACE_DATA6(level, fmt, a, b, c, d, e, f) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d), (e), (f)); \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -311,10 +327,11 @@ U_CDECL_END
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA7(level, fmt, a, b, c, d, e, f, g) \
+#define UTRACE_DATA7(level, fmt, a, b, c, d, e, f, g) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d), (e), (f), (g)); \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -324,10 +341,11 @@ U_CDECL_END
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA8(level, fmt, a, b, c, d, e, f, g, h) \
+#define UTRACE_DATA8(level, fmt, a, b, c, d, e, f, g, h) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d), (e), (f), (g), (h)); \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
/**
* Trace statement used inside functions that have a UTRACE_ENTRY() statement.
@@ -337,10 +355,11 @@ U_CDECL_END
* Calls utrace_data() if the level is high enough.
* @internal
*/
-#define UTRACE_DATA9(level, fmt, a, b, c, d, e, f, g, h, i) \
+#define UTRACE_DATA9(level, fmt, a, b, c, d, e, f, g, h, i) UPRV_BLOCK_MACRO_BEGIN { \
if(UTRACE_LEVEL(level)) { \
utrace_data(utraceFnNumber & ~UTRACE_TRACED_ENTRY, (level), (fmt), (a), (b), (c), (d), (e), (f), (g), (h), (i)); \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
#else
diff --git a/deps/icu-small/source/common/utrie.h b/deps/icu-small/source/common/utrie.h
index 3e2197eda6c261..532ba778eb6ed1 100644
--- a/deps/icu-small/source/common/utrie.h
+++ b/deps/icu-small/source/common/utrie.h
@@ -182,7 +182,7 @@ typedef struct UTrie UTrie;
]
/** Internal trie getter from a pair of surrogates */
-#define _UTRIE_GET_FROM_PAIR(trie, data, c, c2, result, resultType) { \
+#define _UTRIE_GET_FROM_PAIR(trie, data, c, c2, result, resultType) UPRV_BLOCK_MACRO_BEGIN { \
int32_t __offset; \
\
/* get data for lead surrogate */ \
@@ -195,18 +195,18 @@ typedef struct UTrie UTrie;
} else { \
(result)=(resultType)((trie)->initialValue); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** Internal trie getter from a BMP code point, treating a lead surrogate as a normal code point */
#define _UTRIE_GET_FROM_BMP(trie, data, c16) \
- _UTRIE_GET_RAW(trie, data, 0xd800<=(c16) && (c16)<=0xdbff ? UTRIE_LEAD_INDEX_DISP : 0, c16);
+ _UTRIE_GET_RAW(trie, data, 0xd800<=(c16) && (c16)<=0xdbff ? UTRIE_LEAD_INDEX_DISP : 0, c16)
/**
* Internal trie getter from a code point.
* Could be faster(?) but longer with
* if((c32)<=0xd7ff) { (result)=_UTRIE_GET_RAW(trie, data, 0, c32); }
*/
-#define _UTRIE_GET(trie, data, c32, result, resultType) \
+#define _UTRIE_GET(trie, data, c32, result, resultType) UPRV_BLOCK_MACRO_BEGIN { \
if((uint32_t)(c32)<=0xffff) { \
/* BMP code points */ \
(result)=_UTRIE_GET_FROM_BMP(trie, data, c32); \
@@ -217,10 +217,11 @@ typedef struct UTrie UTrie;
} else { \
/* out of range */ \
(result)=(resultType)((trie)->initialValue); \
- }
+ } \
+} UPRV_BLOCK_MACRO_END
/** Internal next-post-increment: get the next code point (c, c2) and its data */
-#define _UTRIE_NEXT(trie, data, src, limit, c, c2, result, resultType) { \
+#define _UTRIE_NEXT(trie, data, src, limit, c, c2, result, resultType) UPRV_BLOCK_MACRO_BEGIN { \
(c)=*(src)++; \
if(!U16_IS_LEAD(c)) { \
(c2)=0; \
@@ -233,10 +234,10 @@ typedef struct UTrie UTrie;
(c2)=0; \
(result)=_UTRIE_GET_RAW((trie), data, UTRIE_LEAD_INDEX_DISP, (c)); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** Internal previous: get the previous code point (c, c2) and its data */
-#define _UTRIE_PREVIOUS(trie, data, start, src, c, c2, result, resultType) { \
+#define _UTRIE_PREVIOUS(trie, data, start, src, c, c2, result, resultType) UPRV_BLOCK_MACRO_BEGIN { \
(c)=*--(src); \
if(!U16_IS_SURROGATE(c)) { \
(c2)=0; \
@@ -257,7 +258,7 @@ typedef struct UTrie UTrie;
(c2)=0; \
(result)=_UTRIE_GET_RAW((trie), data, UTRIE_LEAD_INDEX_DISP, (c)); \
} \
-}
+} UPRV_BLOCK_MACRO_END
/* Public UTrie API ---------------------------------------------------------*/
diff --git a/deps/icu-small/source/common/utrie2.h b/deps/icu-small/source/common/utrie2.h
index 75028ee23ac1e9..671f44e16a65cc 100644
--- a/deps/icu-small/source/common/utrie2.h
+++ b/deps/icu-small/source/common/utrie2.h
@@ -871,7 +871,7 @@ utrie2_internalU8PrevIndex(const UTrie2 *trie, UChar32 c,
(trie)->data[_UTRIE2_INDEX_FROM_CP(trie, asciiOffset, c)]
/** Internal next-post-increment: get the next code point (c) and its data. */
-#define _UTRIE2_U16_NEXT(trie, data, src, limit, c, result) { \
+#define _UTRIE2_U16_NEXT(trie, data, src, limit, c, result) UPRV_BLOCK_MACRO_BEGIN { \
{ \
uint16_t __c2; \
(c)=*(src)++; \
@@ -885,10 +885,10 @@ utrie2_internalU8PrevIndex(const UTrie2 *trie, UChar32 c,
(result)=_UTRIE2_GET_FROM_SUPP((trie), data, (c)); \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** Internal pre-decrement-previous: get the previous code point (c) and its data */
-#define _UTRIE2_U16_PREV(trie, data, start, src, c, result) { \
+#define _UTRIE2_U16_PREV(trie, data, start, src, c, result) UPRV_BLOCK_MACRO_BEGIN { \
{ \
uint16_t __c2; \
(c)=*--(src); \
@@ -900,10 +900,10 @@ utrie2_internalU8PrevIndex(const UTrie2 *trie, UChar32 c,
(result)=_UTRIE2_GET_FROM_SUPP((trie), data, (c)); \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** Internal UTF-8 next-post-increment: get the next code point's data. */
-#define _UTRIE2_U8_NEXT(trie, ascii, data, src, limit, result) { \
+#define _UTRIE2_U8_NEXT(trie, ascii, data, src, limit, result) UPRV_BLOCK_MACRO_BEGIN { \
uint8_t __lead=(uint8_t)*(src)++; \
if(U8_IS_SINGLE(__lead)) { \
(result)=(trie)->ascii[__lead]; \
@@ -935,10 +935,10 @@ utrie2_internalU8PrevIndex(const UTrie2 *trie, UChar32 c,
(result)=(trie)->data[__index>>3]; \
} \
} \
-}
+} UPRV_BLOCK_MACRO_END
/** Internal UTF-8 pre-decrement-previous: get the previous code point's data. */
-#define _UTRIE2_U8_PREV(trie, ascii, data, start, src, result) { \
+#define _UTRIE2_U8_PREV(trie, ascii, data, start, src, result) UPRV_BLOCK_MACRO_BEGIN { \
uint8_t __b=(uint8_t)*--(src); \
if(U8_IS_SINGLE(__b)) { \
(result)=(trie)->ascii[__b]; \
@@ -948,7 +948,7 @@ utrie2_internalU8PrevIndex(const UTrie2 *trie, UChar32 c,
(src)-=__index&7; \
(result)=(trie)->data[__index>>3]; \
} \
-}
+} UPRV_BLOCK_MACRO_END
U_CDECL_END
diff --git a/deps/icu-small/source/common/uvector.cpp b/deps/icu-small/source/common/uvector.cpp
index ad3a813e3706ac..cf19edf646fb0a 100644
--- a/deps/icu-small/source/common/uvector.cpp
+++ b/deps/icu-small/source/common/uvector.cpp
@@ -26,7 +26,7 @@ U_NAMESPACE_BEGIN
*/
#define HINT_KEY_POINTER (1)
#define HINT_KEY_INTEGER (0)
-
+
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UVector)
UVector::UVector(UErrorCode &status) :
@@ -335,17 +335,17 @@ UBool UVector::ensureCapacity(int32_t minimumCapacity, UErrorCode &status) {
}
if (capacity < minimumCapacity) {
if (capacity > (INT32_MAX - 1) / 2) { // integer overflow check
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return FALSE;
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return FALSE;
}
int32_t newCap = capacity * 2;
if (newCap < minimumCapacity) {
newCap = minimumCapacity;
}
if (newCap > (int32_t)(INT32_MAX / sizeof(UElement))) { // integer overflow check
- // We keep the original memory contents on bad minimumCapacity.
- status = U_ILLEGAL_ARGUMENT_ERROR;
- return FALSE;
+ // We keep the original memory contents on bad minimumCapacity.
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return FALSE;
}
UElement* newElems = (UElement *)uprv_realloc(elements, sizeof(UElement)*newCap);
if (newElems == NULL) {
@@ -492,7 +492,7 @@ void UVector::sortedInsert(UElement e, UElementComparator *compare, UErrorCode&
*
* The context pointer to this function is a pointer back
* (with some extra indirection) to the user supplied comparator.
- *
+ *
*/
static int32_t U_CALLCONV
sortComparator(const void *context, const void *left, const void *right) {
@@ -564,3 +564,4 @@ void UVector::sortWithUComparator(UComparator *compare, const void *context, UEr
}
U_NAMESPACE_END
+
diff --git a/deps/icu-small/source/common/uvector.h b/deps/icu-small/source/common/uvector.h
index a7625cd01ac59a..98318d14c60063 100644
--- a/deps/icu-small/source/common/uvector.h
+++ b/deps/icu-small/source/common/uvector.h
@@ -135,7 +135,7 @@ class U_COMMON_API UVector : public UObject {
void insertElementAt(void* obj, int32_t index, UErrorCode &status);
void insertElementAt(int32_t elem, int32_t index, UErrorCode &status);
-
+
void* elementAt(int32_t index) const;
int32_t elementAti(int32_t index) const;
@@ -314,11 +314,11 @@ class U_COMMON_API UStack : public UVector {
inline void* peek(void) const;
inline int32_t peeki(void) const;
-
+
void* pop(void);
-
+
int32_t popi(void);
-
+
inline void* push(void* obj, UErrorCode &status);
inline int32_t push(int32_t i, UErrorCode &status);
diff --git a/deps/icu-small/source/common/uvectr32.cpp b/deps/icu-small/source/common/uvectr32.cpp
index 6e0760d7184040..d1ae6599585086 100644
--- a/deps/icu-small/source/common/uvectr32.cpp
+++ b/deps/icu-small/source/common/uvectr32.cpp
@@ -23,7 +23,7 @@ U_NAMESPACE_BEGIN
* or a pointer. If a hint bit is zero, then the associated
* token is assumed to be an integer. This is needed for iSeries
*/
-
+
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UVector32)
UVector32::UVector32(UErrorCode &status) :
@@ -253,7 +253,7 @@ void UVector32::setMaxCapacity(int32_t limit) {
// Current capacity is within the new limit.
return;
}
-
+
// New maximum capacity is smaller than the current size.
// Realloc the storage to the new, smaller size.
int32_t* newElems = (int32_t *)uprv_realloc(elements, sizeof(int32_t)*maxCapacity);
@@ -288,7 +288,7 @@ void UVector32::setSize(int32_t newSize) {
for (i=count; iO879i2C4!!;~NcyYhfUY?!NayG*)*af6xz)Ukb~c>cxETsH7=@5txr
zGbNOK#Z$?0>$-bKe5xoIfCNBY^*YFW_td+w15H~~eRc17wHz0_irUB!OHK~t>?VhE
z?cH$|77rE!08o~*;b;H_aF?*It!|semlKuiwsI0vn^&$0{M1orjH`z>*`dIMt6sjR
z?UQ;~)WnZ^<8RviF^e%1rp-9^idX
zuq0OR!ar2lE%czZb>BTQn!QrkEnqy^9dr2TYLf3M?CR1*yy4uQ+xMgy`m!UrtWmt%
zt~gEc%&(&I6xdch_ptricLnV-qxR`;hdA4+KFU5&R9ns!xO>gW;Gyj3U0w-ctj+k(-mboE1g^BhwZD#C(?lSj&=xKPo^{vbBo<^1esO*7^*FQ!9EWVBbvH
zdn1SRMYv{VBdQa>&2I`Ie}t)_QeY97iW1RphxZJ;LL0M{i&0bZJzcZ!H5S9f%+rT*
zYs-fi>LpBpVsTy>$_oGhW-$Q(%$Wqk=5BA`7d?b-}#L9;yV}xbC|<5!fd6
zIwMS8eS+op
z9MPTUWI~jjh_9e#G0X^d6d@43JP#h=~vUgBwL{>ihKFH-9>|j{bxO8t(tu
zMSL0?z|lmnT}Uk(6O2L|68P{aDhd#10!6|5BLq{muVQz+atZ>l3wB`Q+i;gx-~Gi@
zRoyDO&JtjG-+cVq#fSy~DoFxW$c*d|MF^y`y^(P1vG=Nr+H+IgL2_>sTdt2~|Fwo^
zC6aXWve)>e*AKRSH?h{8x8`Ji?Gf60xnp<)@CuX%Os;$hbQLn`J)dUVDu4!)jGNp}
zxa1GT?CEES&8*-h%~C_b>Y7!Z4odr){2OqODB+U-RFE3aF5Pj-<_!OFBlNIuVG-!nz{3>
zdyjm9j0!Zx(x1;7V1TfA$SjJ|j>|(Yt-1KNVPA(oh8e&PfL*wD?A_a*^Yt}rY*x$*
zE12*Ur5=p@8i?&$qtjjA+uIgZ1^MSm_q>$Y`tNy5FvV5@&gXo+!hQdtevPJ1Sg`SIB_uoD6?rw<>|t!N;M#tm5$C8
zsNogr5CYBQDgr{eF2Lzrc!3;Hw|T=OBL&6>!G*97d?nBhW=KvgDMe3JhoE8cMessE
z5$foG@U8B4ANa7gt$!!E=B^l0m5t6CuaN5l8!L(W0@F9K1Ms~eseXl#Z
zzQOnYhjJ?$f?lMh@5BO!3fvq%W4#F83-rQzi+u2xM0cNz?lIT-s4(;f8+dvztcpB~
z9wqr7T(Q=Uy4%YQ-KeH7%>Yy>VaH@}SDib6QV4{hXeQ3^+E*U{Sf$$f0{f8*_c%tY
z7LD1`8@@GW9!8f0sz6GpFMGU(eNF`M%T_m3u!W?*g2V_DJpHj#ad0&&|5-%?L{Q}_
z*+Xtf{x9745w`Ef#h!W}VbloQHyugayyQE&JO7Lf{Eztol-Fj+FE6uXJ_63?-3Zav
zr|8%wcWA+}n=FPDd|}v5Vm=Q(PcEh&-LY$1eq9eI8LHGQmu}c5*nPWH6$FqfC*-DQ
zzzgC9rd!Ux(N4G2ph7Lcp&HE
zLec8sSHB-{M#31wfq|mF@27B3FZ>9$;=dzbTUNubeK!P9*7ySMk)JAt*k$V6{Os#_
z09AOv0z1ExUK-K=VE=bw{D=O{29>;)F{mP1zl`bB@9L#(Q^&g1L!t5KZ%{{vkDvp%
zy!%Os<~{IVz5j29((82+jfYrJ@NXa*(#wN7=j|R5p#hPNo;xz*?#8a83b83T9|SQk
z7dtrEX0zk=qfTwbsCO+ap}-FzZ+Zv}fbsD+lc^KuU78oHK6(}qu2gO39Wh2iAshKm
zTrD+^`2g=k)MQ#2X31bs1ynMO|F*4+gA!jUO{1pqf~+n-klJ_qr8D08Gpy%*&93v6
zt;U(i)^7gVwyBz{eSpQIyWA=a`Kosd-z9yOs&^>E3un<
zTmu)x#I^<~LV3;l2GzRE+y%zkg#~&NqDOSMzkhn_?)e;`uDouFX3vpV%satnJ9Y)dc5wa-os@yc=tj9cRIcR!|tBohaZW|0EBB%kB75e*c_k&
zCEzCSK>YGvZU7p9U}u!)>EbVlcChZ!L5bP)*(Yz;wztpnghZh3N^HR2<^Jvm%HZBo
z!Vc_&hc@6k7^b-NW!wS1Qrw8C}8|#Bhf`I={
zPTvjw>opT>)i2BqFfinF|FnIui@c5mYZK`V#+=zPlnee(1Qh&-{dYnR{+}{j!GG8P
zzY-|;|JD6B4URRlVK?AiHRb3mt1W;C-dpv~{{U
zF4EJxd#Yd>L;wKHehxTAM8wM2kf;ayBHBEW*2trmz;_9|@e-$CLet>Q{DsMo;oTb$
z68Yde1`g3tyhzKzx&=QuXivo&U~{>_8=F{EcfoKpyS>M!r;mZ2XFqKN&!v>d5)RMw
zHpvkN005rt-Me={Ko$CyqwxxCtlgDC>Qvlg0RH}klx1>FOn|RD7+PGOmvnU&QCp8=
zTO4r>rLq$)Ht^|i|A~nMiZ{vE>3Z+T{wy^n1}*RMXKvkAeRU0Z9inJ^f@Q4&VBxQR
zJ7Q5QQ^eEFSCeUDdCMfO)T*juV^fb;*otM>f%!M>OONCx*D$fs5zos-sym+y&vMu@
zY@RxB`=L8hTWsqD+RGu*+19O3fw{=ve6{_W$NG}smhW6x-d-=@EB3=60%NVbcOhpR
z+6!}cx2;{YG|OD)kB6~dO^1%uR$rT6Glz=g_BIb8nCG9M8@E37D&=?Z!@Qm%53v51
zH}C=wHer)uM>zNS1I*hZBYJLm*UoM3^FLlpM4}?WNi^_`4S==dVJzfHXHIe*Nu-QA
zV>3jxHu%`0sZ~29^`c;489BTp2mmB9bBNn$1`rf<4LXej*^~>=Ytzw#?;EEdeIJVH
zK7jxeZL^%)WAHiMk+t0opxy7Cv2~Bo$mMI3y`%52?K0|sr{=4@fc7YU7_45(
z5|#Tnp{S^cc8G&yRsebcZ2=r7ycrxBCa*P*7FxEN6jLOao=HuiEUN%tfsc2+D>U}azFb*7o3IG6aUlzv{QtO%E1CWW
zzmVH3PB~6WR!W6L6YHa4-OI_8)Y3tAFf2lx?-33~!dHf(%BE=N$*w+5NlVf==(!sk$+t{&HsA!kOh(0Vvey{1RD4IoCOK
zlMYw?JhZ8&L=+ruL{njiQE^O3yW{@dT?2=6LZ&~`g0s)SuADfhM4`2ab6*d(EbxRWa)rujLzBQg}uU0(&
z+r;)3gOxhBA%R0LywmCBCdind2Qi)g*=D!#X
zEx*o!2Pw$y+g_|I_&q@m^xWFdCTAq+C_H%HMGewq^TOuTdZjLFXp~A1_+iKqcH49h
z7h3idX$r?)o0-Pxt`isP63A{J8Pg6)+lg_hRu=lwWb2ku6{8oetjtI&>aB9jw_APJ
z36ZF=-5S``=dxi|%*YAJJ49!ukh2nxbE7oY!U`)JV*2do)Cr3^b{5T5ysUsnxG)s@
zl)JxS4J%FhA(SvAN#{mo4w6G=$B|G_t0R-!_{GD_wv)z$RiMgE5`1g=*_9me?ej0w
zp?TcJe8j=}zbQ|D8#60?I1AmGnXSI606!yjx-7@oqG{V~H>ABtGpUK?qtbk0Z7-6t
zsbOTQwJmoSq(e+!QL0>dN$Z;it>?WwAj?T_U)~NnI^oJ{DKnTyK*M1lu`NZjnD1L+bhf;wBDu1$yA}2ED%ED}
zz(-$UNI^PHB2pga6bp|`+b0_MAWatMexx$r!=V}fWx=GPPPZy0@G`^WW%S92r}x)W
zYC^IR#~F3lnFn%5XB7CsWd)Q{9nWXz(cU1KRIX7G8cmh4$*eh`rFikfK#-YN)3aRh
zJOZ=?)RCMg!N?1^Bog;@T$Wa_LS@ZVwlqpC(Bj)wV$#2-TAm2ey5%j2a}%T)1Sey_
z!%L@ST5xUfY`;w86vkE`Bg-F`w4}|mHhp7iKf5`DWe>_tCyXa;o*4<;9A$i2_?UgY
z;i(eKf(xXV?^n7unl_wewNWZMK(%VSH3?n)@bK3JTxVh%n>+f_^b*Sajq#TeOvFLN
zO_|7xH7V2ze9smzsr@0PC{))L({R-SbnZytkhz#*%x^wq#CbAP*?jW7`%Up|jQyI)
zIo|Oy@4119-wPDt>Rm{>ty0J}0q-arvCX6={_wn5mr_FUCsSB8rR0q1i)yamVpEqu
z>LLQEU-#{DKk<2Tg4C>{Ql5z%wyp3hJGU@@#Y5R2vN~#(@lP4I8KknB3g+1US9;tX
ze2%}W*!ne)H$#YZtWq{3)Fz7p706cQq-r+nKE6Lql{iF5;n7jm7ML{Jv|5$mthVWD
zRw7PXexgj}jcu+o8>yKfp`q2%5{dBYvXc*9{hFnMn}U3u)byZta@(Ekg;;l7h3mDh5J@*qR9!W`|~pcggaYqo{j3HhQM=q1AC^T+Nt
zuI!J$`X=6rabGHyD_+LS~M2a&32-UJ3sG?i5HN!;UZ@Gmu7sN=jZX
zb>!UWstA2sE|5?$)C9t()Zct%SM}ny&XJ9D`=`bvKEBVBLqhNO-wdI@Vjq{O)&88_
zZ-4(y_J!wf&X#WJF9Z%~{o_LbFWDBHHSXQt6*y12H{^8?kgZR0R_1X%qn6B$F(&~Nks39nuXA>90P^#*buDOba6fh#hAR`b+qr=048GV#0
zcREr6k2a%<8^5=u@HH)>s0r+Jcy*E6?NDQVx9aYW%FQ#5e8yP%{^TVFxb%JCl*af2
z{nn5l?<4f;`~%xWW9U1eght5{A;)LLnA`XL_nou976Kh{YJVSwqFlb$^pSCZza9*|
zclb*zXM8sm>fYxQJNviH2!UvJ6
zB!5JQW|GB2fN*#vX)1g;pR}#Lm-xKHk*cJ~6tlpqNwfvDRQRAI8R?12;KC|Myyh&h
zH4ZPlf5Jt_ihMxJf~YE&v+zB59A}F_i_f$$CdJY#$uH<_)#P!DW9FqG;3
zzx7n{@(M+b{*(O|TGal+K9*yRfs8lFJ@(L|Dq$Tu*d6^=qvG_V%!zvrqq4@ZD+c~S
zu+sHC)Vq)9iQs9F1HFLu>Gj8_v;H43ab?9N%wRL#sU$Ey-r+-6bWk!
zp%gxnab~P68Kh{Bu#~6~k_?*XO_1egD4HxD(NFh|K0u?z7~EuJ(3RW+;@j#{|ow|uF7+>*(!UGFy@`kWvWKhpq6;rdhv=jst
zKGE~vI{o(W_fJs2RsAysax(vC%O&(nOcH=Da)CVIa;057+FhR*x1b_XMyMhR)l0Myj8N5
zWEc&cY5I)Pn&*V}&TLvGGMwVt(rL(PRh)Z;>UI;-W!dVp&OBz(4e!P?nN}3gbM!21
zRzHZkp$Ucqd2QxX=OOH=5(~0r!Cj+31KAKoUj3L+P&E^uk|LqEY$hZoR)!4}gU*IY
z6VEJJ(Lya&E)8f)T}k4>nNN;vZRfJKSuR11(3}q*Ri8I4D2oA#A3RdejNN(Wxt`p7
z$jG_xbIz{nuXle8JPeI2gCJ%f^$wRR!`4KMX6V1trt6u+)93a~?V3T}1FJHJ|jx*SKb<)YN|
zPRcZfzO`4?atM1p`gbSmobzH%?zdV$zU3`%-jiW`-1QPBFCFiKP93d4uxm%EFMEQh
zSE2bIRL))f6>fgJPuMa`sG%9<-%t^pPh%CJQO$E97~x*#mDp@=ZM}KB-C#to3b@#_q;qGQ3W%0
zc$Zg-{8bgR7|$7J<&x3OM@wehGgtb(H1CU&>W0!mn4E3+nseL9&Xw@%2S^N#rKw+A
zcJJXAE9BtPgq~t52;R7+4}7%sa1L*`Zk&yvTFsjIEN$
zSDiWO8%k_JY(>piS8+}WX+=0hYq60|_GmYoqKO^p49ezANC=_PlJM&YQ>5Pz1iq0m
zX=|sUmjX-5B8rX(^~lgQz*9P*@N|IaQ21287$l>05F;Cggp%YO2mIvJw@8&RW_9&3
zg>9vUR|j8W%H~D_O&FD2LGAec_iY$8z29NSADxWkI?8g)(wNJ(obX0Vo<~qGA53xq
zKYqdT=zGJ=GSRjD$@0qi^99p^er3Lx(RMA-8mkYF&M)2M2Fv{0RM&gnYxQ2d!x}
zZMf8>h?q#}l!O3$GV9*_#I8v)SQA=<*w4J`bS&%GoCSJ^Ctz@elXtu(O$t{5Dr%({
z+pb~-504WY?b}_k-p1!pbvEiNggRooU)xWA{+{*al}};orqnJQxUFkn=jQX9Tr-D{
z+_*jco*{N^IN0aAT~!q)O|LXnr($f&o@U%LwvEtB|2@-jubQz2qpOAMFLWxJz1e%sy)0}ja9{sCR|%-{Q?I-ryjG&VzKe|zl0b~7uNr71a!n60tZ6%5
zZZ&vWftzTJ7d&wy`}B&5sT34<7eZ4sMVD>P5IMh_N#v(iSg<>Ty%&g@
zfN=0zO~i2Yr}4?~sR(FU=5MpcSjV78H58PzxX%*Ul@H%VF12K~$+ynR^FHe|U-jNi
zH>-yH4k^7CsDBYab`7vh$=j99fz#xx+U&jBFs#ipt?a&iCJ`9}J?Gb~E3@JZ>(oF7
zYJ+ir0Ox#N_aUhR5(r)_;k);{WK{$qo3+620EvpE7rF
zae3$(Kj(T0h2;~c^vQZ(!x=l(91L}Kw>()k9|wjDwn`kvk8SQaXSBt#5PpUl^_i`%
z`3NnK)H|?Z=5g08XZQ)eLm^r-iEK8lx!-f$9n6%cp%17H3HPyZOTnLYtG0E3VqB4U
zv}R9=8r$z))Y@^9kZsj78dVfc=$xH{Y8X3rjWKOoH3t`N**pILvcrIQsdI!`j;x5s
z$R@A)EoL?>+CAsUico5Y(!t%jveMj$S~K%%qAVu%jNMX{Zv!ZT14!thxtbx)gzuPt
z5~G~guFuap&{9Y(LhjI;8g=9NSlcl8t*xtr%gauN)?La#Q`WIL3fNlod9umrsWiKi
zc-N$kQ+B73p|=7sHQsW2o{YE<*B1vLzx@4-&Y!QBvUhDa0+fwCzN{T0Arg2=z0CaE
z4}ii#JW|1%%`q-qM5!{V?ceN{u{#0i4-dw~YW?0@30*o}fvPS7GqHg~mX($EzQ;fN7$%qBPxnjrzOkAe
z>%Kqh((!d~Lkcu|V)Y|W0dKECA5EG~RS{8{&70gq)#Y8V1HL+2SQ{jMG@$wL{VN(=
zG_&`V6xR3Z)-JEG<^}Ac(a(eHmnHRX6%XBlmP4QrX}&ejeO~20F`v-I6$2)4W2Nq}
ze@;IgD*oSFtQlsM+QNgGUHozV
zstw@S7?J*1c8X-lfF-qKf(eY{&g)Z!36jr3MBwFC6Ir?PN?zZ-x#37qMROC6ilqg1
z2omF*o9Sw+w#&HV7@5adbq^C{X>Ks^x0iA}7mVC-{@i3%(|Cq{8S^=~sOw+&)q7zG
z`j9t-d~#+Q$%2mH;Wy=S5l#PksKhwAhQDM@G0CC)qo^K~t#
z8rNruwPxJqDHKzhnWbYiGHE<7D75f0@L?ecTb3-rx4$J&THOJ~}DB%Fcn4kI2(X~0?w
z@~dLjtVr~odd%R)TW0Ud^h-wd#-2HA2#X~F;L7+FZ+K9H@QgjwTB?Tcc@$tr;^8`P
z&yIPPX~Y${p%O=q5qX6uGmpyQB^0PazfJ62*QAhNcORbp+WXj-UohWrmlaU
zZ>!jlqH2+Kz3MrM?JOA$%GoK-GRUx`CH
zl(rCmUg^5%KAh`a;uJ|9!-9BpXObma-35wu_x{H;RKa57YW-;6VeOS{l7SmJb$iB?f_z+S4Zghdrh
zoLflJfR=&@7BodtAweYxrC|(v3%ny7M+T6f+mZntL948SqB&?bUNG3a;FB&bgsdW>
zRi=QA&|agoC{?qH4-y-J&Zf==VS_}QW5}mz6vQL7LNp54KoN(uI9iyR%VechY(Tc+
zVmr_}8)qd1rxqtq^LOXQ?C2bNrbOQtQg=qLR?Y6_D0v0KkmMS_8
z{$v?Uh8zVc@Oy0rm56sp{E@SCk>RP?IMuCE=-F@t{DUAp%p#|%(kg;zh-{HM9Ihg$
z?2|T8v^Fn;`XE1TJbdD8;yUs$h-5wjfxn`yY8`bhMMf`V4+jvh$uti)3|LLH)k|Vp
zSBy+9Ed*twOB>Yi0wK|bgjJ=(Y1;qpx$&e07!uC7z<6}RSQ=^6MKTbhjyxN%pxaVL
zHXIBS#5LM-CM1JQ17kp%bkP-?1uZQ|wP+zN;|`&`R%uGAnvsfyWCjLAIl=6?O4=3k
z%gpL+q4TrW>!A_FRyCSvpMVk$T{H;M$p{pP*x-*6WaK>sotQFSAz`L$p=lGoh99TB
zxU)UAr5%zo$VM}?yss!HaePyKc>WdHOd;?5_*zCA7V?JG=yuYcd4Em4-@XFNZzIw2
zH~08XIab$)uwTQ}x=lJx_mvLSZl(>_UR^bb=2JJVBCv&~po&k0x1gY^pjEpXTokJf
z#E=XPQDkF7Z-Eb;MaR(o_r%dmQ-pxhBB|IS#EX7|tXSVJw1$M5gw
zyaSoH_6hG-O0QP@CjYkfck_RX&w?vsQV^1*w^j9OX!=Q*9lL4$YOO4A^M;-l220A(
zwwS-o_T_){?Q3uQv;G=$_RG--{WCkFi9ff2p>|0dYe%Do5^nNgoSl6J8#9Cq0>4LC
z9Z5!48Z#HpR+WKamdX_x!zP@iUD_I6ZTAUzHKG;QAr%*$ppA}>28f}Jt~t+J$bh67
zd;G0vGy+aSu`LF5wrCazpDG&@3PB-7uL!LrR06lEe3jRnl@0lXAC*s`K(8r<#}%E-P(kZ(%&j%;3~6%X}l0eXCPh
zz$Ikv+4H5~)Zg_oIt0!NYM6s-`|Id~NDlsOje?b+@zaAz^@uzA{R8u#8l4ss1CjT$
znJ18+j3R!L0a?Ovb~qtp#AfhlPzrrhJL0rIkC=lf+tw_^VvBd*_b#qYCtlxd=P-I|<^qD2XruOx`2>X0GGEMKxYL1rp$(P)TvQF@VP%)cco%KVuKXv^KhXHa+G
z)J#h*b7Pe%lw{P5WO&EeQZ3WAM3iPHuh<6MjCGD_XO<|5X46u3=%k1XC5~c1@=W7S
z(~yHNq=m;|d`II3R1O(Zw%F1a;!l`M82y>O?czhkx+X;KrjX}(cIo$(JdW84C|Gi0
zmuT3dbDfrL&h%1QUKF_&eDVX+rPZ7HG&*#g-R2=+>}tY?;GR-I3}-`GO(FF#ngKl^
z%Tlo>>W@i)XvQDg8}=_*=fe7jaf|!A6Q9D^<8H}L3*
z>G+N!nYpIjVzrV+5WoFM|Y-)*Zp~jl27Y|4LXM{r4XdS7Z>(iZMx@ZD6%qE
zlqO0vm?6sgg0Z)mpMAhJUeB3&<@eoK-FFQRm2y`SnLs(Z;#@&KO-h=CmNwOT9z)4l
zTNaO*QHw^FE-uYObEzd+LM8?nPMB2ZL4*q2$0ufAWur@7aBf!)*ET05OASw=*FcO1
z@hX6Lr8OjJCLnkfmXX;e`~cDgRzy7>q)DxD%v!rwPv!T9T{PTy*W8RM@QAw?CImob18V(mZG9ZTh`yczQ9Ndxj_MR%4`9$1Mcbe0Uy3isUw+pl77Kdb6cs
z`T2_`rcH>4$Ej=VjOH(GMw&QTpffMiFoo?yG4hENTb<4E?N-ifY_jRZ5D%^lLB_uX
z+%EdZ%SY%RLu>p1#hV2VD<`-*R&xQJnxK0pM#@WL-M6m4^{stDGn!+Fb+XAC1w6-P
zdIW1Oo2ALe*UG4|?AvlEX(3-7SmIVoU3w{XPuAYLgPsh@y|}!f4GT)>e@kmM5Gs`o
zHkBDF1>;hqufFSrjYp@OY`KmjHd~`*ELtejiesrY1ow2
z{`z91V&-zjechQ_{B-#Cz)j3vWGf=VsH^OI(ZF|(W`8``TLP!z~_q?R>+y6iYL=vi|~f2b!N
zF`MS=oeKIUE6{{>5^Nh((i6wZQBrk;7Mm(R(7;H@5vxyGwa(%CNMF7jrsc@D@P2+$
zjP{+Fp|xA0{*zRKm*ksFFISPw#qgn%mC98Lc$g4eR9(%zhc7ApO*$DFjV6RqBaV{{
zH+w_+LvLi9+gv1@qL`OS7xr_bl(r&%($;4JscH&Rq4LnK?3&Mltz}#D`ogY~Zu_D|
z2j8svck}gCfQ?CF#eyFR8F>S>R#7+YKtW^e&jzsIi-%UV*_fX$Apj(saGFt74U?yL
zBVk(594&ayy;6TB1q)3nR1EEpMW1N0Bsgh+euHb=QLN#HFL5KQsbDuYN0vBFV>(
zIY3S6Zofu~w#-oyG&j75V?LO!E@fd(Q+8A~txf%M%>JaDE!jCN?iS1LSf7re=9)8UPVlJf}krO$CNDr3!d@7%KWs2K>$v?y&4Oo7^w60ZLI{
zWK!-C@vp5VP@`{k#F6}A@?#BR+N7^2R{FALp>aHMK#IE0k7bTFbN%Y;EJH@e>LYO_
zuELX-upt^Xc>*=jl13n*q3#*UI5Ec!OAO)B*gCo!I>x|GWbjAO$wFD3Gc_nbh^sKA
zdNE3Y%Q{(zQal~(ZWJz2mR=Nj?>1&Nt%jFi$zHG`jR?n!Up|dO9mHJ7<4UfP9+(x$
z2BDb}qQg3K!c|P%Pk*PHwSAP>ya6SPJNobgBUh1K1Wifpy8l3$wG3H)crNf8uT%8}
ze@^#hub`fwaJ%H@Wy>||o&7@Q;r#qUvls1Ql~u`e+yj5$Pr6KOr%_Y77X)_6VI7}warb2w)K@=OOIF64|35w+cXd&QW
z_f+>ZRL_zZPdX_Njh_!OAfxfqnDd7hXraoHWPp%stMq;
zTM2j!MkX=CpnI}&=_HP+nze8^aWYk
zXiyJDWZ2~IK#NabG1V@vaT*(^Y*+ATQNhpVfZ&lTdvA$bi$v
zR(*l3Ewa_EF-C#jGBX@bTRPJ(_PL})H)_FdF`UfhzEPjF4MT$(Z*YPey;P>ZJeG13
zMvD@eqYqhMU80y<4>~wFK=|rbw`u9yj-C|95etXkKLaih5rT(MIfqeJGAZLEM=X`_
zG6r1LTmNUM}2qp
z7qTEnRWHkb5igHc-Z_7>4zLGEOUGWpUFY}mvcL
zL|h-?QGi1E@U8BG6_B}FXcW^3{bkZ-E{0rV=^M{K`R25#fe2f!PNwPcN
zpBwKCuEfLZGgzD5x3=oL_2*`ex!;r_L7z4=%-2p()QQu`28A*b6a~MR?`Oqs=C$a^`i8462`>Tfek)>7iA@t&_<(X(c&}SYrfrqb
zhM*chaN9n!6v$QG&iJlQm3Xm_odwQEd+BePd5113GV3|L0e@uX21)BIAWA&+QIpHW
z#Fix%KAw$vKo|9Na^P`uz#LAhj`J#Cq9b^cYoj6ckA^USECf%n>2E`(XD!APZ$OkQ
z$;mHClVkXoM4@dtlB3X6BZx+X#vWWD5ym8|eSB-en03Gc5N-GOXa&~k(dQ>wJ5nPnsM_~P}jMQcB*!RHS%Ru@0!V0iauvT2lYGQ0zSW<04aw7y8HdNw1}
zV29MxO0Ol{F>5T%WM{P0DjoCik=dH_wPA{V(64&g%8oy%k{Rv9qKqOfel}bk(|;#0
z@k3aJqEFLyAB#sacvg>{KM2>=?k8?veqEk(Gw=0g?v#7MyTLGd`BgwLMvIp!_AdKd
z_Jinxz*{Q)GVo3myfwzagq7lMAF?`7t
zuxv2%;7{~5Y#!;94d0$S|zh1+?OgV-I?bZ<3@F<8QDxX!DpKu^QKg!<_)5$M2
z@z4`Z^snh}S`QSHojGx#zN6V
z+qtUczqTkK4xYkGPthO0Ncu0FINVQ_J-3h|ep!#12*c+%dp
zxalX&^mu`HHG$HaoH=^L;{;zv;2XpaA+i<#A)q{izFvnttMtC@*kIUT9(w;US?Z(=
zuqxM5lCJHzY+}=})>F@uL0_g=BYCkzQZjr<#@nXSSjmb1cdPvc0t!}rutfHT7}bf_5u1KJ>sV(e8CFE=7v9cH|I6YqvFFZ<3Z$?K
zt&CU_;_l@6uTGK#4o0i{bq
zlCSDY*XkvjQ&?Hr?64*`2e~TYIeqyPXq{@&?-+J{&;q@V2cI;B#J#<
zK5(U-V#HPx4wKPSjDDPFT(pb)LjGarbNKusiHUExTh5_PVR^II{9n)-dkVC_9qM~!
zBxv~ePqAgBR~YP9@7d}%p|4zoUV6G4D?=OLZyPrxm)U5W
z$|v31yiwXcrn-ARP8Y_&$O>lT@MKZlV=>7b(fxCCQ{;B9ty>!D6S)wL}
zp3DALBp!IljC$Sf%ih1@9Nud+Uvk}>76IXo%6*P+%DwzKP42zJt~ER6Jc`~kd8CB|
zcw3aWgpP&LnI(<35s?q03|1yj3x2)kM!fe^n(Vdbn{j+qNlg_RW^MUc{i*_!asU(
zW;G32n-)BDFsyB71i7szL>)h(Wq9CJ5$Ul6I^?$w@~+V3mvNVd(h7<&dSog8^o`MC
zn6+xmQ?MAEeOU8gkGtt0arf
z%6H;zOsJU&DV|%>c6ocw&iF4gUI#?tie>TNlC%F91zH4pEh=d*_vb68YlU{FDbOD{
z>Ixq)#0qi~tR6+pKFL~GAIi)tPm<9hsg`&7wt@0g9(ZQ(d4`VgzYT?fifkx|HGj^!
zxcR`6SJ>jy6|FKeAhAtK%%%Jv(DNiuw699loCSdK?+q*B7Dqd!4BTm6MxLf^sQmwo
zYZ+H+Xz+bw>C_$&n~HbtR8hU-?aJ0Mwz%3(3t4frJZoG8X?a+ML@s87Ff7Wm6>eqy
z^m%nT>Xd9tr}MNUXVl_y4qp*=o6Y*`+NM00ZA>E3`kn9WG)|DEY!g9aH4DP+
zfIYQdTXbjia)RdX=*ePP>lI&f)QSQaLvWf2L)c+i-p4`90uqetnoBL{v~Av$WAbgw
z4At>&k{pZ)F0YU*a2V4Ou70hayN4Vb`k%*)EXTeg^L6zNDSoGl@FlDW(xM!
zRKN>JZE914VCN|)Bi?K95}>7Y(se|lpetP9mSqF=f_K#v#5BWGlLdvGB#(-sgsQWx
zA|(BGv>dWS%kam&*-Nxr(=Xux<@cw+^yg%gq3xZ=U;F(6>n(kYMLY$xh__1d&l3yN
zRy%N7H)K1(YbqcGEv|2!yzfN2bF?NXp)}i~%QWVLDMog3dVV9i{gSJ)wZGpv;LK_X
z^szwRF`q`o9c$19cWni5Y8L
zXu4u_wURxdta`9Pcqkn9@r|RDh>+;JNqUcS>krKt<4-EDrtHcAryYqQ*N(5l4Z%Yt
z_HGBk&W&8znW!XLB9p(jaYOuMCsSu4ElohE)uK3GhAuR}(hj&s77vSC{+1PkaS>nz
zvK#k0N0hAn5^s3@VS^pk*w(|e`vvC(?=LjlNK`-tm?(1okuCPE|A4>irnrP3E{pdo
zbE2lj*IdR(!p*a0Ew}s5<$l)p-2$J&k6=7hB#ne5QI<2~$0EiN-E~?jw&wjC;>Zc^
z1>bsJNxS_Y(tCn*w=N6E;_)Ovi1c5`&?USOQMI0u3znFbBz+ke(W4h+XjQZnIa9J^syXhTkp|K-SQd$(NKj!fOP(1p7mB5P%x>I9q&+n!fky#!I1tDk%nt~XDu%*y;906aj$
zzwSQY@b5k+Hm~^S-#;Gfsqp>hyw#!((~*&(NMbAlAj`!cGl#DG>&LR<#?m#J5Zw^S
zTA{lf28{Y1X{V}N$^M#MDKmPZ8HyqTAO|Z&G>`)cE%8yw-4wDU*1C$M7ekF))bD%8
zl2^ao0E_TufgJvSF9b(K5SIOe0Sv5YTYQ>ugv|?qCcsJt2mk{J4SSnf7!9VzO;!g^YW*sEQKXvE46gX^JgeO;J=Y)jnJGz3
zzulKBWF{vrDdSaA%SZw6Ut*80$piEE-VscR;EorC3HMmNUD
z3mMHz;CNTsh!XcdWBD|?tt5P)JsA#Tj-;73gb(GC4fEKuBMBXb=rSb+k+!TCC>WXn
zj7Aei2~NeLbf0O-R673daUjSgZnW*u!cRY;roJJQ6CsVx!0vyQB@?)@!SM5;sXu(ajr6s6_z@;Y##C8a
z74$WcS(I8;hxQTldMw>r;*^8K^%AIbem@U9I($Q-K7~C-W~RK%*r{&m9nRcxNhI^=
z52P|eSV7_-h~ns(suIdI4NJv7J6-9tbuvGf>e?ow&hu03>Iz||!F+G%6uW!4W0NfPP%Di{i4rkZ6SlQJuDrdYZJM5s`hLDWx0^}s2Y
zRWvA^=M&DEJ9cR%W6J{;
zwk351ENQmRTPxo98C5&6QObuNfkjZk_d=K>GAoU&fYhy
z=so*%YB!n{9?O#0?`CU>*<0bgt>w&cJQQjuyWH~LpV;t+p{quG&aZLg2=(`ZekHjvsn
z*(!l*foUp%L1`Yp*Nh;LES8ESE@5
zqV%mSPJ(R8sxdBzGZ!x9#%_#i>q
zMsSiMTvm5isMtX!N-7NkA`jQ$d43-H_}Ra|-=>CIXPMZDBoygu#{GUZ&EP$(Z;eo@
z#|M>@7wC?MK?`@>N%)$q(DD{rWhwWzZw33DhSEtQbKH^$4$@;-1F+W|4lZmWINl1L_>v5(#tPqEx^
z25ld33vB(ln2vkX0JrVdV3&-X}}Yba`avuEz_b-@%)kZ5|;oDpG`;|YOqaYzoKFW8sK>1HRl%Uf(W=BoZL0Ox*6mwpo2OaI?
zapV+M<8#2tYa=DmJu4)b#HFy2Rah!_
ztkZEjS&OfwYF^f@TN-DK^4bG&1O^Qs=YG)aHoKi(2UEar8uhwzuYORbMMa-3LZ)@9
z-dz>;l#!>Z$7efM5viDg{uENiA})H84J2)iaZd1|N6^Z801QFk0D!~;@lp{nK(*l$
zpEh}e->Lx`P}ndUD>D+HNB{=Lsn}SFfiVVT!dj@4LD>k2NHGW&=)s0<{*AuD*^<{0
zM8T(}NEkFcy!69FGdD$W%X_lC-7eGWTjd3ys3!lDSX%)sx3GeUEoPB1^sGxN>>0jN
zsyas#YXxxPLvGt5E*#boP-VfG!+HkUa!YONtEL+)o|73$a0#+&3Cqa&JPOg_Lq9Dj
zA*~~T2KWW>xeVjD79tk}>^2DVc$(l^#0k2$8O??X{4+XO;|_RKQh4
z6)_vSN`b7%(F__!X@Nmgbwg0n11vlUq^zbOOJ${Q>0|w;iB`d5)a<1AkbEa{Ub9oOhI~j$o
zyd?cqA@iIHW=EV2x>M+B
zye`ZU@Oo}fm~C!;=ju86_gGa=Qh&ETaMD`Euxnn1i8RJG*w}_W5H5C+vpP@Sr3QDN
zIEF__`F=q?$)k!3G?TkOzAGJjh8k=EWmwIoHq?ABOPA$xGZyc27}kkoHG8t6->lXA
z_mhd9S>s^y7PpcG4YVf6GxbwycB-w-f;Iq}4Z7qN7+g)o>);_o^re+&HOY&t=cu7G
zQ2`+h0|$8;H`jqqP`XKGiqslj2Q$j8*kECoy~(Y;QNjAm_sO5B=l>to)CP?Fs3F3HY(t7FhpO3uI{hV4=m)94-A`FjYF?ymrZVVqf=2CzVDymbOq*tZTASa
z(i=$L8nW#IYz4t^!jox82?nVMM$=+}kQ~gP#D)SONasJ`&@W%7cXz<+`~_}17WlP@
z2@0j18q%u5$s2Yyv&AJw>v2q`H#wR4jTb?Zj#}B#BKQD<+K>
z(s(AK)fF`L7KqYH>OKKs@9yEdSHCHe5d{pKm7;LM#kxymVA{a#`H>|9%(Sy}0yo*R1Wbna(l~
zt(iSTsnqH2wMRT(Y1%1j%1MCZG7eiRAHIksI5k&);(-Jk(3G7lF<5pmLgKTLP
z(5-pU*t)tCBD>JdmW*G!->oTlySzv}6+AUb%Lw+*RE1Sh*hi6?c6sJGqBK6
zGu9XykaOCH)M#)brkaL3EMZHY5z9pm3j}5|rlSVXvU+s!O~@WexvSY|l^b;t;2IHP
zcU)rE2Gs^V4QEqei6%<94FFxqf!D3r?h!x{al=>J+*#?@Y{)brcsO*i6@wgnPK?ra
z1QWz+YzcrEzWa`wV8#m~8wavw%#bt*lS>D!8OSrEfR;!aXrgt!?Mkdz#>h#@@sZji
z8U$QzogC&hWFBJ`)FkHpn)GXVL@X#Fl2fuQqESK!F3hF8d`6{KVmnKeL=ax@pz+w<
z+;+YE$eHEbtIsRjc+YdPv!Ep72Cx@B*w25uHMr$|_NEHr{1@itg3|6_CnzS0O)}D{
zfdopGco0bhh#>+BD4_;mLARDhdQD!g!W6Xg6;8x#4Y}g2&LZ&SrPACX4HT92Pzp08
zL3*~;Buha8IH+*SD6+J?$%ZK+3o4m7NjNl=lLZE3l1nNRCOp11u@prOW40qibJYyN
z9MU%8xSe=Sn$?{HoQWXRLvWQ$$*xPC#Yw=xHGpWB(Jg@mAZ3mi5odyr0xECD>UW+|
zu9v)0O~w?H%9g;2cFO9?l2M*8nvB@!z|yzwEM057RAq)o8|I2a@jM>{`-Xwvr6NJp
zah?&wn!eb3Vp==|!>CV-sXEL$<%J~}vnU0Ao$G~g!O&&gw{*B|I3f@wjZ+Nhl_>C@
zj*1LcR*;!Q9d*AwcRCTE#+vrbZ?5~m%f#;DcWM;tqlVctbY(S`$uV{n_)KW?TOIJOI*u^2eO=j@#__*IJWe1%j)%s>t>5#0&3eSG7A+G38bQsnp#AdyflL4i{m+0O{|hgA(zia9+U}VqAxOLE32oC
zYI`%0m~X&Ch&Npii?Y^q
zQPxDBONpb6Gr|fLrbY_FwBN0V5yCF?FBN!$5Q6HQml&)}90*oSa8ne?6H&I(>ay()
z^3Mfo$-f;Xnab+QoFJ!JfMG@wB!g{bv#uC-#)~EfS6WlDcpTbyIw!8oF%wsvJ<1y3
zD(q-S30lZAu2)XgRT$?tH;qomTE1|{B(>${H<_5cUn-(OyeXF@Y=Z)0lHoj$GX{=v
zog1d7sxjzNShq_@j!y|TBM3>
zqnrk%R}`h)0St6SY$3}1{>oaqt=EtDK0oKH=kj?xrPO<0r5yL@@chpjOL%@uN^Dvq
z#(l*y+b(lswA^HFbiIzJ@=isCNgGJx+Pk-Rt`|%d7
zhK29X51o6z#QPpY+v+IocbGOgnB3}VA^{xR1)xQIBh{J%u~Qu#3owZK)$JKXB6u^)
zLpx0-DjZ1_G#DVl6c6JVKK!HLAps>+upA*2qC20!&V#CM?jZy>lP$T2hR*B0xF>y<
z?t2`p_-nV6zHs#5v^5|GMUIzTNNcPObMMgyu1VRL*285WbqcBsOLpOr1Z*)015zO*AjQTvQ
z`I3hz03jmjILXevZ!NT2vb`kztQ5`Q8Z_Bz9rTLDCmh_>A$00
zeD`?g=~>V=`w?)E5JU)oW+yXf`uz2wBT6GhoX=`Bj;+jy?V;nUO&V3r;8MaA)
z46g!#G+oO_sI^U+k`+)`6JmJWk4zERZCnliRPs3KaqYL@p~NIF^b9e&8(uAV8R!wG
zww65pL>1ZXQ0?`C8$n%a`H4_NE0?x_prh=1&^w)I(J0bN$rKVxk!&jz5BlX?zIZLS7bIM!qf
z7dVQY=Jc@~Q&LX#(VC?uETzi}yq`eHkGsqYiBHFE4+s%x0zd^EB6^p
z*PQM90}=au23d;lxeufHJ&zM`@m_y}_PL%bkH4ppc98(Pkq?S=)#}*kW5C!C2&-qr
zG+;X$9U(x9{^_X{4K$Oth(AB1$k54AhzC0gSx}V7uk825Lohi9C^%S>EM>9`B)}*;
z11XF`WeI0T!+h{ET-TEF16RV}4$qmJ_L?q`ijSt~%vwXzd2RDkYao3Nz+;
zT+?pmVBl`BNQ6wm>Lqq9vbU*JjkBWh3#kJbBE7$G0@f77`AyvW=8PDgC|
zJ?UhLC#3$~A*+75x9C3wu9;q|74(O~RQ=vm!iX0n&X1$u26Ou+jiUW$W#weoQITb6
zk6*v;x;eR)ii(m%i{|<@C=k46Kgjj=>}7f+;%%R4NhAz;4J;
zYZxG*6jy;D@C%VBO4G2A3=dba&@6}3#UfrZ0CC&%CS!n1GG!&I7T(u4j85*9JTv8q
zG)Y8>Nc$X?%6VQ9DXLYjjiGz_-ShmHvr@TJhLOTN@wE!Qc_Wt6Sm^bRPA@UHAnUVp
zmEig@{JneBu2uB*dUN3cS8w
zQm3(eXZzm8-`_FJ=sZzMC6b>j+vwE
zg9D@N#DPa_G;mE~wZ^rmswDY=kid{YLQu#M(-Le+?}S51F^!2dgT84h
z2~|W&l+Y*=KoJ_=@h6hT1Q&PAd@9Z6s*02p1cLRllT>~UD)xBbLahTwjhe;_2NGLz
zBrTWE#qpyYqbB`>fcw6R@8NQ}KV{_^_I!4OLox(_qy(>5Iu3OB>Q5Y@sFTo@naK
zhAyp&2AXx139uSK4GFQF;L;YHVv~Au5-3WVp~QfpG?)onh}zDU#fzxkqd97Xn$iy=
zDCw8ICTn=D3v>@kfuQtJ;|p;+n?|y%zLs}+8HW0CwS&c2&K$E8&5>|AZl#d^`k1~_
z_0-=)XW;O|I(9B<%O>KjgR6PBfpAwmsoB+MzPr6GY_q8vts_IElI~F8S`j8jp!bSN
z5QOoTs-UG#pkbyMgrv0&1~gb`TX!K0LM00mKZA##!s;a%+6SM@qMFBbJiN7`#>q(+=VP=KIVH0DkWEAUvibu~~t5htGr9@;8s5BQz^qaK;0
zgudQM{?IyVO%$L49|v4Ng)U85`L#FrWqtb-%6x)$@?Y3b^W`v!&)8~!8ekAXksz;k
z)NXBI;{u1*-_;KHxv>d!z^_!I4X&+dYd5%ogep1*gT_2eeBoLy-uFupqTwk+3qs9+v`rxCBge2vD$sU
zX2!=hitW(-HibbI1)*uNRBE9rAhME@sHmtZLqJ73MyfF`6(rFK?Am}hRGJ}-X(YtP
z4UK>Zh2j9nJqR}5wwt<|F3|U@!CxWzYkod*UrVbO>li(5(upc_Hdm(UQqF<3!AGQ`
zGnV09^!s~?rPZu8ncCm*cSY>_j+66#RDL1xJ|1^GFgfMHs3j(nfu+wdCi-S=kQYvs
zA%>89X{sBN5vQk3B@!G>l;Bm7K;nRvGoiCDFA&Eh5(x_n&XP#n+H#iP0xH#O+SU2~
zX!M_~>71>CWDwCYms6+GS98SPx0)<*)-GjNssJ8QWyhT
zqn%0>$uY79@v<=QFJ$4D@}lCJH@@SC%+<5cR@zsb;0$bUD#PeCDRLs?B`Op)$visb
z*yPj8tNVJl3B<8545o33%1*ldtF4AXqyotszG5^gu4m*?*EI3IDci7wlS3O7q|p&WGa0+<3u}29
z?A~{ttv7^16<#@64?`Elc$<2J6(`;zqYee;DlfKF++0v%#fX*&Z9@@6BgpU`
z;yCQ`S?LToSGW!kR%DWfiwz>CgqaYT5XO?}`*cVp`@5lH42c9m0dw%w
zD|FCkr<`@pyP4+a`4ao;g+PfD&q!e>onl@&Llu%0=izJYc$*d_vNL|;w|DTC|LF9-
zS0$5WiIAFQ+(n_j0bIw$&ntrCQflOtDG*V#!Wb_o`ILc7oMwa+F~2
znaecfc{+6??)?5x(~LLb0HkC?L`Y50*p^axYpbNPm93N-4Lp2R+fqH3QDv}*F_f`}
ztYkxA!nB4R-ontEqgf_^IwJ~#BfHn-wfVguv7O&msy0_H#)RZV_juhmaQ+Vx^%GaT
zZT~sXx_V{eT475wJ@-dpsYy8Ix(Ro&v|SfH2jOr3)3vI6x7d`+Fcj#_(ef?c`ODVR
zn%(!-`&>uf0s3MQ*t1U1YA8`6B_R;fH^!4v0uTWJR~|N123=d7H%XIr1ZyQ~4N!?v
zutKFEP-bOiU`VYAGKggwT18UH0U|_bQ9z_9X-ZKVDk33B)eR#Bsz#txs`z4|j1s8D
zB?C|%ZJBP)SDWb~
zaVP_rd8eZ0!DJQfi4WZNUFQ+G6V)y!;3)?SS@YJFHkD>)irN`XTO?6ezM;v)_*7;S
z@n8WJ9EcE^=tqZ5mkrU+3op?+>MQ&ugIbPdTFYv>PlACWwY49OEy$hCcy9@
zhR{j+qBmizRM%E*stCDX2>-052a_!};
zT~9;Y698iQiPKF(39u~JTbJ!h!^Tg1J63Lrq5EYq0Zza)Oh_0=Zpb*g0QCSo2PQTT
zkR~l@G6km6ma_F+CN8DbRIqT~uL6fCVLsP{uz(;EKuAG0sx3|q7Qc_>vr5eJosy)B
zlTw040%m=>Zo^Mcx?FE^awA)xI;W8;JYR}g>vPMIh{r(*c>hP)`LD(KE%qcmX3e|2
zlH}#bF}MKoI{k!D2a+EQjbJeOy_j-Qml2BIRaI40RW$G8Bd+IsF6+|j
z@Y}C*#o*y;z9*Ezx8CQ7k-UBFeog=k1O?!(Z6lS=Xb8MW2y0=2NG~Bu#HOXOjaYLh
z05EYy_vC(2!(&3mFhNlUD$9&tY^q6#Bo7W5!iGT*3`sgdM1wGh6N4~ws{^s7XJdo!
zlp6>e78gt^WUq>3cs0!y!EkG4BaB%HLMvNcWl>bqS3J{AEU%R@nNm+ZYJ(+wY^FyF
zB{(_Ik~6|riK5CHxgk{&(PSSrF%p!tvRR)s2DsNuWUg7s%#Bq>h|46AjIzOSl`wqJ
zg2~W&oaZ)aLB210-uBBpT;~kUwu&IRNg@gsAeaa$xx1Euo%#GER$lAO$CLP6<^VdA&RTnlvQX_+V4y-OO|=z
z3y#3s_6ozXHq%2v!wSQ4;IOe|qU4g|s8|-8*5HJ~?uGogWC%c(a-CA8SQNSO^SfhT?9PhnBjCiKOa8lS}
zxT;#m(Dz^`!+k5hC%;U#O1Rew
z?k1m|inZJT`V6#FN?1QUjPg(%OXD@Bd0
zsuyln(JrO;IP)|}8tmeWT{eVg%Z9mhaLz5F?GsrSI=VAFl{->|A(AdZ>gEz8375~6y=vsqx94RzHl^;9+Q&b(5cV(YA?
zpiN~#ZM}|hUHic?vGrU|wd&thQedvT^jhm_l7=$%mEOI7406uKPk$vt4G_rt;q|;S
znsGZX8&4(4Wjpn0O>;iRoQ{S41m=@8kg>MWYNhMCq66~FNNvgsYQx?U5!iv0_>(8fLxX=7UsWjX;Q7I-jg&7Hwn{ja)j14lvo(UStjf$(1%^%vA>9*k)M
zu(TGG%`BrPCtk!+vP&~!($~WgfwbVr{pzOF$}b7)8Z}FDcSs${u-d<@0jkey(g=y^1yll;cEQ))(*U>(iKIb{9FCNvLaM#un+C
zF+To?&m_&ypK}yOWV@jHv&Ti$rhN>W8ac3vmqpP0(bBtgV96x+l_Dj$;PS-$0^@Q?syqKW`;*Uu
z7Ol+nRLl^#croS8b>zlfW(_
zc5$mxVpiZ4TN~B43q|ZMbr&=vg)4KNj9s~h3~kGSyb5mBMr-!hR4CJva^vlW5kzB6
zV!RN*FGlsFJ=?d23EP7e%|SiKI7@RjN^dcE^HoMVEr6DMqKtUty(8!lqZGICMwMWc
zSAnuoU3J`6I&xvjlI=32G*yPnt`pw5a{b!qy!;muDbc3L;LMAnG~vT7@T{@CmbIa(
zg=JFk-&))*i}A~bMOlF+>D`LTmkjpTJoVSr=C+B(TevDk)=tXqv|x@~Gi1qoCPl+8
zH&0e8f<LsHdh3lZLg{-JmhMOt7l{93=xtR<&VMcqmZso4r
z77C=27HQFm*+Xz+rc1bS)a-Jxn1zaizUTn{7b77U@cYGV99qS
z+6Bv(G2{LV*+ki?zMI)sbxe|BE(GW<{rbX2Ho#`hf~js>j%)A7j2+isrwC=n2_u!+
zu0t@xUORJWXw2ul@{D;Zs{I2rGU3WH=wn7$#)@xaYHwgp)tPH6@VuFZ7DKu!y!L7+bybTXv_b=4Duz}-*#m+h!x1Z5c_1~>1dS>0
zb%@6Rra_B^;vob2@uR;h-CorFYd*i%zSCfrSDH^*k81x*PbJWN8GTBRB^pt2%}E1$
zVMH{;)X~dSdbf?)r&)LxOfYEK%ZHjNk!gKujXR|NM=QM750TCT*{r;wKpaEIlf!F%pWnrWPK>`ayNQn2+hz(LuEhP&=
zHC<@?#>O<*#aL&jZH6eYGtszsdMx&zHHu~7!?SZ+W2Vt>nX6)Sp8!CpC6?zL$3KeK
z?9OA`S*+C)?MmlXwyJf0itDV79Eh%?un}GW16~nTR}H@7Pf!{h4jXa}u??ZcS+>>>
zvefRL^r4b$_2m-Ku%spV$)rRj4t!>0FTr^
z6Xg8|Dvw4%3zQE+_QCLrJmTr}gvhy5Lz;h#XQNbUZ6lHuiox={zNOwr6MELCm(%0B
zf39ufFLWRpYi7AQyW*Aos{_O?6JrfsQ>uh;g02fWN^w@(7i#@+S;R;bJp{r?5qEN5
zUHN4$2wz{DABT(Wv;Mz^fHN@HFDM>O&Bgl8G})IJbN-oiWMBW~IlL#p(p7>vqd-cQooHpb@Y9ei;Zq!h4(IhHf=^MB~%GREJ&Wa)8XfwJ<&}TNbV>uZu=IieU
zpTVt8s6j9lqI5#n<3gfODu=;OAaiySYY#Mn2{S9)%gn0*C=)oob4CR-
z(G*uzRFR1!2pn31jF@^V<&x1Ff{IK{uf3Z$>aY*~w^bf*!3jr-9!r@(n2x~aAxoVh
zn`Ue_6q>8_mmSLB$oa0ci4&-lK;+(qtciRCvG@rfXCb{&r%2$?{VJA?3+~M34ewJI
z*jcO#oaHoad#`2PY-yx@Ldz1m7{c^tO(F&+hJiqPuU+cBO`R8*yo2czEZWZUQet4j
zw