summaryrefslogtreecommitdiffstats
path: root/thirdparty/icu4c/common
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2023-05-23 03:05:01 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2023-05-23 03:26:16 +0300
commitb64df2bf74eddbf28e2e484d05c46a5ad0d7ee14 (patch)
tree92094a0540179f5722b1fe10499ef45155928fcb /thirdparty/icu4c/common
parentd5c1b9f883adbb54900c145eafcaa789d0fd563c (diff)
downloadredot-engine-b64df2bf74eddbf28e2e484d05c46a5ad0d7ee14.tar.gz
Update HarfBuzz, ICU and FreeType
HarfBuzz: Update to version 7.3.0 ICU4C: Update to version 73.1 FreeType: Update to version 2.13.0
Diffstat (limited to 'thirdparty/icu4c/common')
-rw-r--r--thirdparty/icu4c/common/appendable.cpp14
-rw-r--r--thirdparty/icu4c/common/bmpset.cpp12
-rw-r--r--thirdparty/icu4c/common/bmpset.h4
-rw-r--r--thirdparty/icu4c/common/brkeng.cpp34
-rw-r--r--thirdparty/icu4c/common/brkeng.h2
-rw-r--r--thirdparty/icu4c/common/brkiter.cpp62
-rw-r--r--thirdparty/icu4c/common/bytestream.cpp4
-rw-r--r--thirdparty/icu4c/common/bytestrie.cpp18
-rw-r--r--thirdparty/icu4c/common/bytestriebuilder.cpp34
-rw-r--r--thirdparty/icu4c/common/bytestrieiterator.cpp26
-rw-r--r--thirdparty/icu4c/common/caniter.cpp84
-rw-r--r--thirdparty/icu4c/common/characterproperties.cpp26
-rw-r--r--thirdparty/icu4c/common/chariter.cpp6
-rw-r--r--thirdparty/icu4c/common/charstr.cpp16
-rw-r--r--thirdparty/icu4c/common/charstr.h6
-rw-r--r--thirdparty/icu4c/common/charstrmap.h4
-rw-r--r--thirdparty/icu4c/common/cmemory.cpp18
-rw-r--r--thirdparty/icu4c/common/cmemory.h94
-rw-r--r--thirdparty/icu4c/common/cpputils.h4
-rw-r--r--thirdparty/icu4c/common/cstr.cpp2
-rw-r--r--thirdparty/icu4c/common/cstring.cpp18
-rw-r--r--thirdparty/icu4c/common/dictbe.cpp33
-rw-r--r--thirdparty/icu4c/common/dictbe.h4
-rw-r--r--thirdparty/icu4c/common/dictionarydata.cpp20
-rw-r--r--thirdparty/icu4c/common/dictionarydata.h12
-rw-r--r--thirdparty/icu4c/common/edits.cpp10
-rw-r--r--thirdparty/icu4c/common/emojiprops.cpp12
-rw-r--r--thirdparty/icu4c/common/emojiprops.h6
-rw-r--r--thirdparty/icu4c/common/filteredbrk.cpp74
-rw-r--r--thirdparty/icu4c/common/filterednormalizer2.cpp8
-rw-r--r--thirdparty/icu4c/common/hash.h14
-rw-r--r--thirdparty/icu4c/common/icudataver.cpp6
-rw-r--r--thirdparty/icu4c/common/icuplug.cpp112
-rw-r--r--thirdparty/icu4c/common/loadednormalizer2impl.cpp86
-rw-r--r--thirdparty/icu4c/common/localefallback_data.h1656
-rw-r--r--thirdparty/icu4c/common/localematcher.cpp12
-rw-r--r--thirdparty/icu4c/common/locavailable.cpp14
-rw-r--r--thirdparty/icu4c/common/locbased.cpp4
-rw-r--r--thirdparty/icu4c/common/locdispnames.cpp116
-rw-r--r--thirdparty/icu4c/common/locdspnm.cpp96
-rw-r--r--thirdparty/icu4c/common/locid.cpp158
-rw-r--r--thirdparty/icu4c/common/loclikely.cpp118
-rw-r--r--thirdparty/icu4c/common/locmap.cpp6
-rw-r--r--thirdparty/icu4c/common/locresdata.cpp20
-rw-r--r--thirdparty/icu4c/common/locutil.cpp54
-rw-r--r--thirdparty/icu4c/common/lsr.cpp4
-rw-r--r--thirdparty/icu4c/common/lsr.h4
-rw-r--r--thirdparty/icu4c/common/lstmbe.cpp18
-rw-r--r--thirdparty/icu4c/common/lstmbe.h4
-rw-r--r--thirdparty/icu4c/common/messagepattern.cpp172
-rw-r--r--thirdparty/icu4c/common/mlbe.cpp270
-rw-r--r--thirdparty/icu4c/common/mlbe.h116
-rw-r--r--thirdparty/icu4c/common/norm2allmodes.h142
-rw-r--r--thirdparty/icu4c/common/normalizer2.cpp120
-rw-r--r--thirdparty/icu4c/common/normalizer2impl.cpp274
-rw-r--r--thirdparty/icu4c/common/normalizer2impl.h94
-rw-r--r--thirdparty/icu4c/common/normlzr.cpp14
-rw-r--r--thirdparty/icu4c/common/patternprops.cpp16
-rw-r--r--thirdparty/icu4c/common/patternprops.h8
-rw-r--r--thirdparty/icu4c/common/pluralmap.cpp2
-rw-r--r--thirdparty/icu4c/common/pluralmap.h40
-rw-r--r--thirdparty/icu4c/common/propname.cpp22
-rw-r--r--thirdparty/icu4c/common/propsvec.cpp44
-rw-r--r--thirdparty/icu4c/common/punycode.cpp42
-rw-r--r--thirdparty/icu4c/common/putil.cpp274
-rw-r--r--thirdparty/icu4c/common/rbbi.cpp196
-rw-r--r--thirdparty/icu4c/common/rbbi_cache.cpp2
-rw-r--r--thirdparty/icu4c/common/rbbidata.cpp20
-rw-r--r--thirdparty/icu4c/common/rbbidata.h4
-rw-r--r--thirdparty/icu4c/common/rbbinode.cpp50
-rw-r--r--thirdparty/icu4c/common/rbbirb.cpp40
-rw-r--r--thirdparty/icu4c/common/rbbiscan.cpp80
-rw-r--r--thirdparty/icu4c/common/rbbiscan.h2
-rw-r--r--thirdparty/icu4c/common/rbbisetb.cpp26
-rw-r--r--thirdparty/icu4c/common/rbbistbl.cpp38
-rw-r--r--thirdparty/icu4c/common/rbbitblb.cpp78
-rw-r--r--thirdparty/icu4c/common/rbbitblb.h2
-rw-r--r--thirdparty/icu4c/common/resbund.cpp50
-rw-r--r--thirdparty/icu4c/common/resbund_cnv.cpp8
-rw-r--r--thirdparty/icu4c/common/resource.h12
-rw-r--r--thirdparty/icu4c/common/ruleiter.cpp2
-rw-r--r--thirdparty/icu4c/common/schriter.cpp2
-rw-r--r--thirdparty/icu4c/common/serv.cpp168
-rw-r--r--thirdparty/icu4c/common/serv.h70
-rw-r--r--thirdparty/icu4c/common/servlk.cpp14
-rw-r--r--thirdparty/icu4c/common/servlkf.cpp20
-rw-r--r--thirdparty/icu4c/common/servloc.h4
-rw-r--r--thirdparty/icu4c/common/servls.cpp40
-rw-r--r--thirdparty/icu4c/common/servnotf.cpp22
-rw-r--r--thirdparty/icu4c/common/servnotf.h6
-rw-r--r--thirdparty/icu4c/common/servrbf.cpp12
-rw-r--r--thirdparty/icu4c/common/servslkf.cpp12
-rw-r--r--thirdparty/icu4c/common/sharedobject.h20
-rw-r--r--thirdparty/icu4c/common/simpleformatter.cpp36
-rw-r--r--thirdparty/icu4c/common/static_unicode_sets.cpp2
-rw-r--r--thirdparty/icu4c/common/stringpiece.cpp4
-rw-r--r--thirdparty/icu4c/common/stringtriebuilder.cpp74
-rw-r--r--thirdparty/icu4c/common/uarrsort.cpp4
-rw-r--r--thirdparty/icu4c/common/ubidi.cpp150
-rw-r--r--thirdparty/icu4c/common/ubidi_props.cpp2
-rw-r--r--thirdparty/icu4c/common/ubidi_props_data.h6
-rw-r--r--thirdparty/icu4c/common/ubidiln.cpp46
-rw-r--r--thirdparty/icu4c/common/ubiditransform.cpp86
-rw-r--r--thirdparty/icu4c/common/ubidiwrt.cpp58
-rw-r--r--thirdparty/icu4c/common/ubrk.cpp52
-rw-r--r--thirdparty/icu4c/common/ucase.cpp297
-rw-r--r--thirdparty/icu4c/common/ucase.h10
-rw-r--r--thirdparty/icu4c/common/ucase_props_data.h6
-rw-r--r--thirdparty/icu4c/common/ucasemap.cpp42
-rw-r--r--thirdparty/icu4c/common/ucasemap_imp.h24
-rw-r--r--thirdparty/icu4c/common/ucasemap_titlecase_brkiter.cpp6
-rw-r--r--thirdparty/icu4c/common/ucat.cpp12
-rw-r--r--thirdparty/icu4c/common/uchar.cpp42
-rw-r--r--thirdparty/icu4c/common/uchar_props_data.h8
-rw-r--r--thirdparty/icu4c/common/ucharstrie.cpp40
-rw-r--r--thirdparty/icu4c/common/ucharstriebuilder.cpp92
-rw-r--r--thirdparty/icu4c/common/ucharstrieiterator.cpp30
-rw-r--r--thirdparty/icu4c/common/uchriter.cpp18
-rw-r--r--thirdparty/icu4c/common/ucln_cmn.cpp12
-rw-r--r--thirdparty/icu4c/common/ucmndata.cpp18
-rw-r--r--thirdparty/icu4c/common/ucnv.cpp455
-rw-r--r--thirdparty/icu4c/common/ucnv2022.cpp160
-rw-r--r--thirdparty/icu4c/common/ucnv_bld.cpp224
-rw-r--r--thirdparty/icu4c/common/ucnv_cb.cpp16
-rw-r--r--thirdparty/icu4c/common/ucnv_cnv.cpp26
-rw-r--r--thirdparty/icu4c/common/ucnv_ct.cpp36
-rw-r--r--thirdparty/icu4c/common/ucnv_err.cpp102
-rw-r--r--thirdparty/icu4c/common/ucnv_ext.cpp54
-rw-r--r--thirdparty/icu4c/common/ucnv_io.cpp72
-rw-r--r--thirdparty/icu4c/common/ucnv_lmb.cpp72
-rw-r--r--thirdparty/icu4c/common/ucnv_set.cpp8
-rw-r--r--thirdparty/icu4c/common/ucnv_u16.cpp166
-rw-r--r--thirdparty/icu4c/common/ucnv_u32.cpp124
-rw-r--r--thirdparty/icu4c/common/ucnv_u7.cpp164
-rw-r--r--thirdparty/icu4c/common/ucnv_u8.cpp76
-rw-r--r--thirdparty/icu4c/common/ucnvbocu.cpp72
-rw-r--r--thirdparty/icu4c/common/ucnvdisp.cpp10
-rw-r--r--thirdparty/icu4c/common/ucnvhz.cpp46
-rw-r--r--thirdparty/icu4c/common/ucnvisci.cpp58
-rw-r--r--thirdparty/icu4c/common/ucnvlat1.cpp72
-rw-r--r--thirdparty/icu4c/common/ucnvmbcs.cpp308
-rw-r--r--thirdparty/icu4c/common/ucnvscsu.cpp150
-rw-r--r--thirdparty/icu4c/common/ucnvsel.cpp114
-rw-r--r--thirdparty/icu4c/common/ucol_data.h4
-rw-r--r--thirdparty/icu4c/common/ucol_swp.cpp14
-rw-r--r--thirdparty/icu4c/common/ucurr.cpp304
-rw-r--r--thirdparty/icu4c/common/udata.cpp212
-rw-r--r--thirdparty/icu4c/common/udatamem.cpp20
-rw-r--r--thirdparty/icu4c/common/udataswp.cpp52
-rw-r--r--thirdparty/icu4c/common/uenum.cpp56
-rw-r--r--thirdparty/icu4c/common/uhash.cpp122
-rw-r--r--thirdparty/icu4c/common/uidna.cpp136
-rw-r--r--thirdparty/icu4c/common/uinvchar.cpp38
-rw-r--r--thirdparty/icu4c/common/uiter.cpp86
-rw-r--r--thirdparty/icu4c/common/ulist.cpp70
-rw-r--r--thirdparty/icu4c/common/uloc.cpp180
-rw-r--r--thirdparty/icu4c/common/uloc_keytype.cpp114
-rw-r--r--thirdparty/icu4c/common/uloc_tag.cpp240
-rw-r--r--thirdparty/icu4c/common/ulocimp.h6
-rw-r--r--thirdparty/icu4c/common/umapfile.cpp4
-rw-r--r--thirdparty/icu4c/common/unames.cpp62
-rw-r--r--thirdparty/icu4c/common/unicode/appendable.h4
-rw-r--r--thirdparty/icu4c/common/unicode/brkiter.h4
-rw-r--r--thirdparty/icu4c/common/unicode/bytestrie.h16
-rw-r--r--thirdparty/icu4c/common/unicode/caniter.h2
-rw-r--r--thirdparty/icu4c/common/unicode/casemap.h66
-rw-r--r--thirdparty/icu4c/common/unicode/char16ptr.h4
-rw-r--r--thirdparty/icu4c/common/unicode/chariter.h8
-rw-r--r--thirdparty/icu4c/common/unicode/docmain.h4
-rw-r--r--thirdparty/icu4c/common/unicode/edits.h14
-rw-r--r--thirdparty/icu4c/common/unicode/icuplug.h8
-rw-r--r--thirdparty/icu4c/common/unicode/localematcher.h12
-rw-r--r--thirdparty/icu4c/common/unicode/localpointer.h102
-rw-r--r--thirdparty/icu4c/common/unicode/locid.h22
-rw-r--r--thirdparty/icu4c/common/unicode/messagepattern.h10
-rw-r--r--thirdparty/icu4c/common/unicode/normalizer2.h44
-rw-r--r--thirdparty/icu4c/common/unicode/normlzr.h2
-rw-r--r--thirdparty/icu4c/common/unicode/parsepos.h2
-rw-r--r--thirdparty/icu4c/common/unicode/platform.h35
-rw-r--r--thirdparty/icu4c/common/unicode/rbbi.h74
-rw-r--r--thirdparty/icu4c/common/unicode/rep.h2
-rw-r--r--thirdparty/icu4c/common/unicode/resbund.h12
-rw-r--r--thirdparty/icu4c/common/unicode/simpleformatter.h10
-rw-r--r--thirdparty/icu4c/common/unicode/strenum.h30
-rw-r--r--thirdparty/icu4c/common/unicode/stringtriebuilder.h20
-rw-r--r--thirdparty/icu4c/common/unicode/symtable.h8
-rw-r--r--thirdparty/icu4c/common/unicode/uchar.h24
-rw-r--r--thirdparty/icu4c/common/unicode/ucharstrie.h18
-rw-r--r--thirdparty/icu4c/common/unicode/uclean.h6
-rw-r--r--thirdparty/icu4c/common/unicode/uconfig.h10
-rw-r--r--thirdparty/icu4c/common/unicode/udata.h4
-rw-r--r--thirdparty/icu4c/common/unicode/umachine.h36
-rw-r--r--thirdparty/icu4c/common/unicode/uniset.h45
-rw-r--r--thirdparty/icu4c/common/unicode/unistr.h97
-rw-r--r--thirdparty/icu4c/common/unicode/uobject.h26
-rw-r--r--thirdparty/icu4c/common/unicode/urename.h15
-rw-r--r--thirdparty/icu4c/common/unicode/ures.h8
-rw-r--r--thirdparty/icu4c/common/unicode/uset.h58
-rw-r--r--thirdparty/icu4c/common/unicode/usetiter.h2
-rw-r--r--thirdparty/icu4c/common/unicode/ustring.h6
-rw-r--r--thirdparty/icu4c/common/unicode/utext.h16
-rw-r--r--thirdparty/icu4c/common/unicode/uvernum.h10
-rw-r--r--thirdparty/icu4c/common/unifiedcache.cpp44
-rw-r--r--thirdparty/icu4c/common/unifiedcache.h36
-rw-r--r--thirdparty/icu4c/common/uniset.cpp84
-rw-r--r--thirdparty/icu4c/common/uniset_closure.cpp274
-rw-r--r--thirdparty/icu4c/common/uniset_props.cpp37
-rw-r--r--thirdparty/icu4c/common/unisetspan.cpp64
-rw-r--r--thirdparty/icu4c/common/unisetspan.h8
-rw-r--r--thirdparty/icu4c/common/unistr.cpp310
-rw-r--r--thirdparty/icu4c/common/unistr_case.cpp24
-rw-r--r--thirdparty/icu4c/common/unistr_case_locale.cpp4
-rw-r--r--thirdparty/icu4c/common/unistr_cnv.cpp10
-rw-r--r--thirdparty/icu4c/common/unistr_props.cpp2
-rw-r--r--thirdparty/icu4c/common/unistrappender.h6
-rw-r--r--thirdparty/icu4c/common/unorm.cpp44
-rw-r--r--thirdparty/icu4c/common/unormcmp.cpp42
-rw-r--r--thirdparty/icu4c/common/unormimp.h2
-rw-r--r--thirdparty/icu4c/common/uobject.cpp18
-rw-r--r--thirdparty/icu4c/common/uposixdefs.h2
-rw-r--r--thirdparty/icu4c/common/uprops.cpp29
-rw-r--r--thirdparty/icu4c/common/uprops.h1
-rw-r--r--thirdparty/icu4c/common/ures_cnv.cpp18
-rw-r--r--thirdparty/icu4c/common/uresbund.cpp583
-rw-r--r--thirdparty/icu4c/common/uresdata.cpp140
-rw-r--r--thirdparty/icu4c/common/uresdata.h6
-rw-r--r--thirdparty/icu4c/common/uresimp.h6
-rw-r--r--thirdparty/icu4c/common/usc_impl.cpp40
-rw-r--r--thirdparty/icu4c/common/uscript.cpp19
-rw-r--r--thirdparty/icu4c/common/uscript_props.cpp4
-rw-r--r--thirdparty/icu4c/common/uset.cpp44
-rw-r--r--thirdparty/icu4c/common/uset_imp.h11
-rw-r--r--thirdparty/icu4c/common/uset_props.cpp34
-rw-r--r--thirdparty/icu4c/common/usetiter.cpp22
-rw-r--r--thirdparty/icu4c/common/ushape.cpp168
-rw-r--r--thirdparty/icu4c/common/usprep.cpp130
-rw-r--r--thirdparty/icu4c/common/ustack.cpp4
-rw-r--r--thirdparty/icu4c/common/ustr_cnv.cpp78
-rw-r--r--thirdparty/icu4c/common/ustr_titlecase_brkiter.cpp58
-rw-r--r--thirdparty/icu4c/common/ustr_wcs.cpp80
-rw-r--r--thirdparty/icu4c/common/ustrcase.cpp204
-rw-r--r--thirdparty/icu4c/common/ustrcase_locale.cpp18
-rw-r--r--thirdparty/icu4c/common/ustrenum.cpp76
-rw-r--r--thirdparty/icu4c/common/ustrenum.h4
-rw-r--r--thirdparty/icu4c/common/ustrfmt.cpp14
-rw-r--r--thirdparty/icu4c/common/ustring.cpp398
-rw-r--r--thirdparty/icu4c/common/ustrtrns.cpp268
-rw-r--r--thirdparty/icu4c/common/utext.cpp281
-rw-r--r--thirdparty/icu4c/common/utf_impl.cpp2
-rw-r--r--thirdparty/icu4c/common/util.cpp30
-rw-r--r--thirdparty/icu4c/common/util.h4
-rw-r--r--thirdparty/icu4c/common/util_props.cpp6
-rw-r--r--thirdparty/icu4c/common/utrace.cpp70
-rw-r--r--thirdparty/icu4c/common/utrie.cpp80
-rw-r--r--thirdparty/icu4c/common/utrie2.cpp58
-rw-r--r--thirdparty/icu4c/common/utrie2.h14
-rw-r--r--thirdparty/icu4c/common/utrie2_builder.cpp96
-rw-r--r--thirdparty/icu4c/common/utrie_swap.cpp6
-rw-r--r--thirdparty/icu4c/common/uts46.cpp120
-rw-r--r--thirdparty/icu4c/common/uvector.cpp2
-rw-r--r--thirdparty/icu4c/common/uvector.h22
-rw-r--r--thirdparty/icu4c/common/uvectr32.cpp10
-rw-r--r--thirdparty/icu4c/common/uvectr32.h26
-rw-r--r--thirdparty/icu4c/common/uvectr64.cpp10
-rw-r--r--thirdparty/icu4c/common/uvectr64.h20
-rw-r--r--thirdparty/icu4c/common/wintz.cpp8
266 files changed, 8994 insertions, 7536 deletions
diff --git a/thirdparty/icu4c/common/appendable.cpp b/thirdparty/icu4c/common/appendable.cpp
index f9b20180eb..c0fbcc6530 100644
--- a/thirdparty/icu4c/common/appendable.cpp
+++ b/thirdparty/icu4c/common/appendable.cpp
@@ -25,23 +25,23 @@ Appendable::~Appendable() {}
UBool
Appendable::appendCodePoint(UChar32 c) {
if(c<=0xffff) {
- return appendCodeUnit((UChar)c);
+ return appendCodeUnit((char16_t)c);
} else {
return appendCodeUnit(U16_LEAD(c)) && appendCodeUnit(U16_TRAIL(c));
}
}
UBool
-Appendable::appendString(const UChar *s, int32_t length) {
+Appendable::appendString(const char16_t *s, int32_t length) {
if(length<0) {
- UChar c;
+ char16_t c;
while((c=*s++)!=0) {
if(!appendCodeUnit(c)) {
return false;
}
}
} else if(length>0) {
- const UChar *limit=s+length;
+ const char16_t *limit=s+length;
do {
if(!appendCodeUnit(*s++)) {
return false;
@@ -56,14 +56,14 @@ Appendable::reserveAppendCapacity(int32_t /*appendCapacity*/) {
return true;
}
-UChar *
+char16_t *
Appendable::getAppendBuffer(int32_t minCapacity,
int32_t /*desiredCapacityHint*/,
- UChar *scratch, int32_t scratchCapacity,
+ char16_t *scratch, int32_t scratchCapacity,
int32_t *resultCapacity) {
if(minCapacity<1 || scratchCapacity<minCapacity) {
*resultCapacity=0;
- return NULL;
+ return nullptr;
}
*resultCapacity=scratchCapacity;
return scratch;
diff --git a/thirdparty/icu4c/common/bmpset.cpp b/thirdparty/icu4c/common/bmpset.cpp
index 14ab894267..641c675c67 100644
--- a/thirdparty/icu4c/common/bmpset.cpp
+++ b/thirdparty/icu4c/common/bmpset.cpp
@@ -319,9 +319,9 @@ BMPSet::contains(UChar32 c) const {
* Check for sufficient length for trail unit for each surrogate pair.
* Handle single surrogates as surrogate code points as usual in ICU.
*/
-const UChar *
-BMPSet::span(const UChar *s, const UChar *limit, USetSpanCondition spanCondition) const {
- UChar c, c2;
+const char16_t *
+BMPSet::span(const char16_t *s, const char16_t *limit, USetSpanCondition spanCondition) const {
+ char16_t c, c2;
if(spanCondition) {
// span
@@ -408,9 +408,9 @@ BMPSet::span(const UChar *s, const UChar *limit, USetSpanCondition spanCondition
}
/* Symmetrical with span(). */
-const UChar *
-BMPSet::spanBack(const UChar *s, const UChar *limit, USetSpanCondition spanCondition) const {
- UChar c, c2;
+const char16_t *
+BMPSet::spanBack(const char16_t *s, const char16_t *limit, USetSpanCondition spanCondition) const {
+ char16_t c, c2;
if(spanCondition) {
// span
diff --git a/thirdparty/icu4c/common/bmpset.h b/thirdparty/icu4c/common/bmpset.h
index e1982ac669..fad0310038 100644
--- a/thirdparty/icu4c/common/bmpset.h
+++ b/thirdparty/icu4c/common/bmpset.h
@@ -48,14 +48,14 @@ public:
* It must be s<limit and spanCondition==0 or 1.
* @return The string pointer which limits the span.
*/
- const UChar *span(const UChar *s, const UChar *limit, USetSpanCondition spanCondition) const;
+ const char16_t *span(const char16_t *s, const char16_t *limit, USetSpanCondition spanCondition) const;
/*
* Span the trailing substring for which each character c has spanCondition==contains(c).
* It must be s<limit and spanCondition==0 or 1.
* @return The string pointer which starts the span.
*/
- const UChar *spanBack(const UChar *s, const UChar *limit, USetSpanCondition spanCondition) const;
+ const char16_t *spanBack(const char16_t *s, const char16_t *limit, USetSpanCondition spanCondition) const;
/*
* Span the initial substring for which each character c has spanCondition==contains(c).
diff --git a/thirdparty/icu4c/common/brkeng.cpp b/thirdparty/icu4c/common/brkeng.cpp
index bd6abbb55a..ce3d09cf23 100644
--- a/thirdparty/icu4c/common/brkeng.cpp
+++ b/thirdparty/icu4c/common/brkeng.cpp
@@ -130,7 +130,7 @@ U_NAMESPACE_BEGIN
const LanguageBreakEngine *
ICULanguageBreakFactory::getEngineFor(UChar32 c) {
- const LanguageBreakEngine *lbe = NULL;
+ const LanguageBreakEngine *lbe = nullptr;
UErrorCode status = U_ZERO_ERROR;
static UMutex gBreakEngineMutex;
@@ -147,7 +147,7 @@ ICULanguageBreakFactory::getEngineFor(UChar32 c) {
int32_t i = fEngines->size();
while (--i >= 0) {
lbe = (const LanguageBreakEngine *)(fEngines->elementAt(i));
- if (lbe != NULL && lbe->handles(c)) {
+ if (lbe != nullptr && lbe->handles(c)) {
return lbe;
}
}
@@ -185,7 +185,7 @@ ICULanguageBreakFactory::loadEngineFor(UChar32 c) {
}
status = U_ZERO_ERROR; // fallback to dictionary based
DictionaryMatcher *m = loadDictionaryMatcherFor(code);
- if (m != NULL) {
+ if (m != nullptr) {
switch(code) {
case USCRIPT_THAI:
engine = new ThaiBreakEngine(m, status);
@@ -230,17 +230,17 @@ ICULanguageBreakFactory::loadEngineFor(UChar32 c) {
default:
break;
}
- if (engine == NULL) {
+ if (engine == nullptr) {
delete m;
}
else if (U_FAILURE(status)) {
delete engine;
- engine = NULL;
+ engine = nullptr;
}
return engine;
}
}
- return NULL;
+ return nullptr;
}
DictionaryMatcher *
@@ -250,16 +250,16 @@ ICULanguageBreakFactory::loadDictionaryMatcherFor(UScriptCode script) {
UResourceBundle *b = ures_open(U_ICUDATA_BRKITR, "", &status);
b = ures_getByKeyWithFallback(b, "dictionaries", b, &status);
int32_t dictnlength = 0;
- const UChar *dictfname =
+ const char16_t *dictfname =
ures_getStringByKeyWithFallback(b, uscript_getShortName(script), &dictnlength, &status);
if (U_FAILURE(status)) {
ures_close(b);
- return NULL;
+ return nullptr;
}
CharString dictnbuf;
CharString ext;
- const UChar *extStart = u_memrchr(dictfname, 0x002e, dictnlength); // last dot
- if (extStart != NULL) {
+ const char16_t *extStart = u_memrchr(dictfname, 0x002e, dictnlength); // last dot
+ if (extStart != nullptr) {
int32_t len = (int32_t)(extStart - dictfname);
ext.appendInvariantChars(UnicodeString(false, extStart + 1, dictnlength - len - 1), status);
dictnlength = len;
@@ -274,29 +274,29 @@ ICULanguageBreakFactory::loadDictionaryMatcherFor(UScriptCode script) {
const int32_t *indexes = (const int32_t *)data;
const int32_t offset = indexes[DictionaryData::IX_STRING_TRIE_OFFSET];
const int32_t trieType = indexes[DictionaryData::IX_TRIE_TYPE] & DictionaryData::TRIE_TYPE_MASK;
- DictionaryMatcher *m = NULL;
+ DictionaryMatcher *m = nullptr;
if (trieType == DictionaryData::TRIE_TYPE_BYTES) {
const int32_t transform = indexes[DictionaryData::IX_TRANSFORM];
const char *characters = (const char *)(data + offset);
m = new BytesDictionaryMatcher(characters, transform, file);
}
else if (trieType == DictionaryData::TRIE_TYPE_UCHARS) {
- const UChar *characters = (const UChar *)(data + offset);
+ const char16_t *characters = (const char16_t *)(data + offset);
m = new UCharsDictionaryMatcher(characters, file);
}
- if (m == NULL) {
+ if (m == nullptr) {
// no matcher exists to take ownership - either we are an invalid
// type or memory allocation failed
udata_close(file);
}
return m;
- } else if (dictfname != NULL) {
+ } else if (dictfname != nullptr) {
// we don't have a dictionary matcher.
- // returning NULL here will cause us to fail to find a dictionary break engine, as expected
+ // returning nullptr here will cause us to fail to find a dictionary break engine, as expected
status = U_ZERO_ERROR;
- return NULL;
+ return nullptr;
}
- return NULL;
+ return nullptr;
}
U_NAMESPACE_END
diff --git a/thirdparty/icu4c/common/brkeng.h b/thirdparty/icu4c/common/brkeng.h
index 127ba59e18..240dc8f4d3 100644
--- a/thirdparty/icu4c/common/brkeng.h
+++ b/thirdparty/icu4c/common/brkeng.h
@@ -266,7 +266,7 @@ protected:
* <p>Create a DictionaryMatcher for the specified script and break type.</p>
* @param script An ISO 15924 script code that identifies the dictionary to be
* created.
- * @return A DictionaryMatcher with the desired characteristics, or NULL.
+ * @return A DictionaryMatcher with the desired characteristics, or nullptr.
*/
virtual DictionaryMatcher *loadDictionaryMatcherFor(UScriptCode script);
};
diff --git a/thirdparty/icu4c/common/brkiter.cpp b/thirdparty/icu4c/common/brkiter.cpp
index d6996734e3..41e4e0dff5 100644
--- a/thirdparty/icu4c/common/brkiter.cpp
+++ b/thirdparty/icu4c/common/brkiter.cpp
@@ -60,15 +60,15 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st
char ext[4]={'\0'};
CharString actualLocale;
int32_t size;
- const UChar* brkfname = NULL;
+ const char16_t* brkfname = nullptr;
UResourceBundle brkRulesStack;
UResourceBundle brkNameStack;
UResourceBundle *brkRules = &brkRulesStack;
UResourceBundle *brkName = &brkNameStack;
- RuleBasedBreakIterator *result = NULL;
+ RuleBasedBreakIterator *result = nullptr;
if (U_FAILURE(status))
- return NULL;
+ return nullptr;
ures_initStackObject(brkRules);
ures_initStackObject(brkName);
@@ -95,9 +95,9 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st
if (U_SUCCESS(status) && brkfname) {
actualLocale.append(ures_getLocaleInternal(brkName, &status), -1, status);
- UChar* extStart=u_strchr(brkfname, 0x002e);
+ char16_t* extStart=u_strchr(brkfname, 0x002e);
int len = 0;
- if(extStart!=NULL){
+ if (extStart != nullptr){
len = (int)(extStart-brkfname);
u_UCharsToChars(extStart+1, ext, sizeof(ext)); // nul terminates the buff
u_UCharsToChars(brkfname, fnbuff, len);
@@ -112,14 +112,14 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st
UDataMemory* file = udata_open(U_ICUDATA_BRKITR, ext, fnbuff, &status);
if (U_FAILURE(status)) {
ures_close(b);
- return NULL;
+ return nullptr;
}
// Create a RuleBasedBreakIterator
- result = new RuleBasedBreakIterator(file, uprv_strstr(type, "phrase") != NULL, status);
+ result = new RuleBasedBreakIterator(file, uprv_strstr(type, "phrase") != nullptr, status);
// If there is a result, set the valid locale and actual locale, and the kind
- if (U_SUCCESS(status) && result != NULL) {
+ if (U_SUCCESS(status) && result != nullptr) {
U_LOCALE_BASED(locBased, *(BreakIterator*)result);
locBased.setLocaleIDs(ures_getLocaleByType(b, ULOC_VALID_LOCALE, &status),
actualLocale.data());
@@ -127,12 +127,12 @@ BreakIterator::buildInstance(const Locale& loc, const char *type, UErrorCode &st
ures_close(b);
- if (U_FAILURE(status) && result != NULL) { // Sometimes redundant check, but simple
+ if (U_FAILURE(status) && result != nullptr) { // Sometimes redundant check, but simple
delete result;
- return NULL;
+ return nullptr;
}
- if (result == NULL) {
+ if (result == nullptr) {
udata_close(file);
if (U_SUCCESS(status)) {
status = U_MEMORY_ALLOCATION_ERROR;
@@ -260,7 +260,7 @@ public:
}
virtual UObject* handleDefault(const ICUServiceKey& key, UnicodeString* /*actualID*/, UErrorCode& status) const override {
- LocaleKey& lkey = (LocaleKey&)key;
+ LocaleKey& lkey = static_cast<LocaleKey&>(const_cast<ICUServiceKey&>(key));
int32_t kind = lkey.kind();
Locale loc;
lkey.currentLocale(loc);
@@ -280,7 +280,7 @@ ICUBreakIteratorService::~ICUBreakIteratorService() {}
U_NAMESPACE_END
static icu::UInitOnce gInitOnceBrkiter {};
-static icu::ICULocaleService* gService = NULL;
+static icu::ICULocaleService* gService = nullptr;
@@ -288,11 +288,11 @@ static icu::ICULocaleService* gService = NULL;
* Release all static memory held by breakiterator.
*/
U_CDECL_BEGIN
-static UBool U_CALLCONV breakiterator_cleanup(void) {
+static UBool U_CALLCONV breakiterator_cleanup() {
#if !UCONFIG_NO_SERVICE
if (gService) {
delete gService;
- gService = NULL;
+ gService = nullptr;
}
gInitOnceBrkiter.reset();
#endif
@@ -302,13 +302,13 @@ U_CDECL_END
U_NAMESPACE_BEGIN
static void U_CALLCONV
-initService(void) {
+initService() {
gService = new ICUBreakIteratorService();
ucln_common_registerCleanup(UCLN_COMMON_BREAKITERATOR, breakiterator_cleanup);
}
static ICULocaleService*
-getService(void)
+getService()
{
umtx_initOnce(gInitOnceBrkiter, &initService);
return gService;
@@ -318,9 +318,9 @@ getService(void)
// -------------------------------------
static inline UBool
-hasService(void)
+hasService()
{
- return !gInitOnceBrkiter.isReset() && getService() != NULL;
+ return !gInitOnceBrkiter.isReset() && getService() != nullptr;
}
// -------------------------------------
@@ -329,9 +329,9 @@ URegistryKey U_EXPORT2
BreakIterator::registerInstance(BreakIterator* toAdopt, const Locale& locale, UBreakIteratorType kind, UErrorCode& status)
{
ICULocaleService *service = getService();
- if (service == NULL) {
+ if (service == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
return service->registerInstance(toAdopt, locale, kind, status);
}
@@ -353,11 +353,11 @@ BreakIterator::unregister(URegistryKey key, UErrorCode& status)
// -------------------------------------
StringEnumeration* U_EXPORT2
-BreakIterator::getAvailableLocales(void)
+BreakIterator::getAvailableLocales()
{
ICULocaleService *service = getService();
- if (service == NULL) {
- return NULL;
+ if (service == nullptr) {
+ return nullptr;
}
return service->getAvailableLocales();
}
@@ -369,7 +369,7 @@ BreakIterator*
BreakIterator::createInstance(const Locale& loc, int32_t kind, UErrorCode& status)
{
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
#if !UCONFIG_NO_SERVICE
@@ -386,7 +386,7 @@ BreakIterator::createInstance(const Locale& loc, int32_t kind, UErrorCode& statu
// handleDefault calls), so we don't touch it. YES, A COMMENT
// THIS LONG is a sign of bad code -- so the action item is to
// revisit this in ICU 3.0 and clean it up/fix it/remove it.
- if (U_SUCCESS(status) && (result != NULL) && *actualLoc.getName() != 0) {
+ if (U_SUCCESS(status) && (result != nullptr) && *actualLoc.getName() != 0) {
U_LOCALE_BASED(locBased, *result);
locBased.setLocaleIDs(actualLoc.getName(), actualLoc.getName());
}
@@ -407,10 +407,10 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
{
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
- BreakIterator *result = NULL;
+ BreakIterator *result = nullptr;
switch (kind) {
case UBRK_CHARACTER:
{
@@ -439,8 +439,8 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
uprv_strcat(lb_lw, "_");
uprv_strcat(lb_lw, value.data());
}
- // lw=phrase is only supported in Japanese.
- if (uprv_strcmp(loc.getLanguage(), "ja") == 0) {
+ // lw=phrase is only supported in Japanese and Korean
+ if (uprv_strcmp(loc.getLanguage(), "ja") == 0 || uprv_strcmp(loc.getLanguage(), "ko") == 0) {
value.clear();
loc.getKeywordValue("lw", valueSink, kvStatus);
if (U_SUCCESS(kvStatus) && value == "phrase") {
@@ -485,7 +485,7 @@ BreakIterator::makeInstance(const Locale& loc, int32_t kind, UErrorCode& status)
}
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
return result;
diff --git a/thirdparty/icu4c/common/bytestream.cpp b/thirdparty/icu4c/common/bytestream.cpp
index c14f206dfe..bd870cd3b2 100644
--- a/thirdparty/icu4c/common/bytestream.cpp
+++ b/thirdparty/icu4c/common/bytestream.cpp
@@ -20,7 +20,7 @@ char* ByteSink::GetAppendBuffer(int32_t min_capacity,
int32_t* result_capacity) {
if (min_capacity < 1 || scratch_capacity < min_capacity) {
*result_capacity = 0;
- return NULL;
+ return nullptr;
}
*result_capacity = scratch_capacity;
return scratch;
@@ -70,7 +70,7 @@ char* CheckedArrayByteSink::GetAppendBuffer(int32_t min_capacity,
int32_t* result_capacity) {
if (min_capacity < 1 || scratch_capacity < min_capacity) {
*result_capacity = 0;
- return NULL;
+ return nullptr;
}
int32_t available = capacity_ - size_;
if (available >= min_capacity) {
diff --git a/thirdparty/icu4c/common/bytestrie.cpp b/thirdparty/icu4c/common/bytestrie.cpp
index c272cc4022..532ea9e9c0 100644
--- a/thirdparty/icu4c/common/bytestrie.cpp
+++ b/thirdparty/icu4c/common/bytestrie.cpp
@@ -68,7 +68,7 @@ BytesTrie::jumpByDelta(const uint8_t *pos) {
UStringTrieResult
BytesTrie::current() const {
const uint8_t *pos=pos_;
- if(pos==NULL) {
+ if(pos==nullptr) {
return USTRINGTRIE_NO_MATCH;
} else {
int32_t node;
@@ -182,7 +182,7 @@ BytesTrie::nextImpl(const uint8_t *pos, int32_t inByte) {
UStringTrieResult
BytesTrie::next(int32_t inByte) {
const uint8_t *pos=pos_;
- if(pos==NULL) {
+ if(pos==nullptr) {
return USTRINGTRIE_NO_MATCH;
}
if(inByte<0) {
@@ -212,7 +212,7 @@ BytesTrie::next(const char *s, int32_t sLength) {
return current();
}
const uint8_t *pos=pos_;
- if(pos==NULL) {
+ if(pos==nullptr) {
return USTRINGTRIE_NO_MATCH;
}
int32_t length=remainingMatchLength_; // Actual remaining match length minus 1.
@@ -317,8 +317,8 @@ BytesTrie::findUniqueValueFromBranch(const uint8_t *pos, int32_t length,
UBool haveUniqueValue, int32_t &uniqueValue) {
while(length>kMaxBranchLinearSubNodeLength) {
++pos; // ignore the comparison byte
- if(NULL==findUniqueValueFromBranch(jumpByDelta(pos), length>>1, haveUniqueValue, uniqueValue)) {
- return NULL;
+ if(nullptr==findUniqueValueFromBranch(jumpByDelta(pos), length>>1, haveUniqueValue, uniqueValue)) {
+ return nullptr;
}
length=length-(length>>1);
pos=skipDelta(pos);
@@ -333,7 +333,7 @@ BytesTrie::findUniqueValueFromBranch(const uint8_t *pos, int32_t length,
if(isFinal) {
if(haveUniqueValue) {
if(value!=uniqueValue) {
- return NULL;
+ return nullptr;
}
} else {
uniqueValue=value;
@@ -341,7 +341,7 @@ BytesTrie::findUniqueValueFromBranch(const uint8_t *pos, int32_t length,
}
} else {
if(!findUniqueValue(pos+value, haveUniqueValue, uniqueValue)) {
- return NULL;
+ return nullptr;
}
haveUniqueValue=true;
}
@@ -358,7 +358,7 @@ BytesTrie::findUniqueValue(const uint8_t *pos, UBool haveUniqueValue, int32_t &u
node=*pos++;
}
pos=findUniqueValueFromBranch(pos, node+1, haveUniqueValue, uniqueValue);
- if(pos==NULL) {
+ if(pos==nullptr) {
return false;
}
haveUniqueValue=true;
@@ -387,7 +387,7 @@ BytesTrie::findUniqueValue(const uint8_t *pos, UBool haveUniqueValue, int32_t &u
int32_t
BytesTrie::getNextBytes(ByteSink &out) const {
const uint8_t *pos=pos_;
- if(pos==NULL) {
+ if(pos==nullptr) {
return 0;
}
if(remainingMatchLength_>=0) {
diff --git a/thirdparty/icu4c/common/bytestriebuilder.cpp b/thirdparty/icu4c/common/bytestriebuilder.cpp
index ac7d3d867e..876e0dfa16 100644
--- a/thirdparty/icu4c/common/bytestriebuilder.cpp
+++ b/thirdparty/icu4c/common/bytestriebuilder.cpp
@@ -127,13 +127,13 @@ BytesTrieElement::compareStringTo(const BytesTrieElement &other, const CharStrin
}
BytesTrieBuilder::BytesTrieBuilder(UErrorCode &errorCode)
- : strings(NULL), elements(NULL), elementsCapacity(0), elementsLength(0),
- bytes(NULL), bytesCapacity(0), bytesLength(0) {
+ : strings(nullptr), elements(nullptr), elementsCapacity(0), elementsLength(0),
+ bytes(nullptr), bytesCapacity(0), bytesLength(0) {
if(U_FAILURE(errorCode)) {
return;
}
strings=new CharString();
- if(strings==NULL) {
+ if(strings==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
}
}
@@ -162,7 +162,7 @@ BytesTrieBuilder::add(StringPiece s, int32_t value, UErrorCode &errorCode) {
newCapacity=4*elementsCapacity;
}
BytesTrieElement *newElements=new BytesTrieElement[newCapacity];
- if(newElements==NULL) {
+ if(newElements==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return *this; // error instead of dereferencing null
}
@@ -192,13 +192,13 @@ U_CDECL_END
BytesTrie *
BytesTrieBuilder::build(UStringTrieBuildOption buildOption, UErrorCode &errorCode) {
buildBytes(buildOption, errorCode);
- BytesTrie *newTrie=NULL;
+ BytesTrie *newTrie=nullptr;
if(U_SUCCESS(errorCode)) {
newTrie=new BytesTrie(bytes, bytes+(bytesCapacity-bytesLength));
- if(newTrie==NULL) {
+ if(newTrie==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
} else {
- bytes=NULL; // The new trie now owns the array.
+ bytes=nullptr; // The new trie now owns the array.
bytesCapacity=0;
}
}
@@ -220,7 +220,7 @@ BytesTrieBuilder::buildBytes(UStringTrieBuildOption buildOption, UErrorCode &err
if(U_FAILURE(errorCode)) {
return;
}
- if(bytes!=NULL && bytesLength>0) {
+ if(bytes!=nullptr && bytesLength>0) {
// Already built.
return;
}
@@ -256,7 +256,7 @@ BytesTrieBuilder::buildBytes(UStringTrieBuildOption buildOption, UErrorCode &err
if(bytesCapacity<capacity) {
uprv_free(bytes);
bytes=static_cast<char *>(uprv_malloc(capacity));
- if(bytes==NULL) {
+ if(bytes==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
bytesCapacity=0;
return;
@@ -264,7 +264,7 @@ BytesTrieBuilder::buildBytes(UStringTrieBuildOption buildOption, UErrorCode &err
bytesCapacity=capacity;
}
StringTrieBuilder::build(buildOption, elementsLength, errorCode);
- if(bytes==NULL) {
+ if(bytes==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
}
}
@@ -282,7 +282,7 @@ BytesTrieBuilder::getElementStringLength(int32_t i) const {
return elements[i].getStringLength(*strings);
}
-UChar
+char16_t
BytesTrieBuilder::getElementUnit(int32_t i, int32_t byteIndex) const {
return (uint8_t)elements[i].charAt(byteIndex, *strings);
}
@@ -329,7 +329,7 @@ BytesTrieBuilder::skipElementsBySomeUnits(int32_t i, int32_t byteIndex, int32_t
}
int32_t
-BytesTrieBuilder::indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, UChar byte) const {
+BytesTrieBuilder::indexOfElementWithNextUnit(int32_t i, int32_t byteIndex, char16_t byte) const {
char b=(char)byte;
while(b==elements[i].charAt(byteIndex, *strings)) {
++i;
@@ -351,13 +351,13 @@ BytesTrieBuilder::BTLinearMatchNode::operator==(const Node &other) const {
if(!LinearMatchNode::operator==(other)) {
return false;
}
- const BTLinearMatchNode &o=(const BTLinearMatchNode &)other;
+ const BTLinearMatchNode &o=static_cast<const BTLinearMatchNode &>(other);
return 0==uprv_memcmp(s, o.s, length);
}
void
BytesTrieBuilder::BTLinearMatchNode::write(StringTrieBuilder &builder) {
- BytesTrieBuilder &b=(BytesTrieBuilder &)builder;
+ BytesTrieBuilder &b=static_cast<BytesTrieBuilder &>(builder);
next->write(builder);
b.write(s, length);
offset=b.write(b.getMinLinearMatch()+length-1);
@@ -374,7 +374,7 @@ BytesTrieBuilder::createLinearMatchNode(int32_t i, int32_t byteIndex, int32_t le
UBool
BytesTrieBuilder::ensureCapacity(int32_t length) {
- if(bytes==NULL) {
+ if(bytes==nullptr) {
return false; // previous memory allocation had failed
}
if(length>bytesCapacity) {
@@ -383,10 +383,10 @@ BytesTrieBuilder::ensureCapacity(int32_t length) {
newCapacity*=2;
} while(newCapacity<=length);
char *newBytes=static_cast<char *>(uprv_malloc(newCapacity));
- if(newBytes==NULL) {
+ if(newBytes==nullptr) {
// unable to allocate memory
uprv_free(bytes);
- bytes=NULL;
+ bytes=nullptr;
bytesCapacity=0;
return false;
}
diff --git a/thirdparty/icu4c/common/bytestrieiterator.cpp b/thirdparty/icu4c/common/bytestrieiterator.cpp
index eacb7eedb0..65f54be48a 100644
--- a/thirdparty/icu4c/common/bytestrieiterator.cpp
+++ b/thirdparty/icu4c/common/bytestrieiterator.cpp
@@ -27,7 +27,7 @@ BytesTrie::Iterator::Iterator(const void *trieBytes, int32_t maxStringLength,
: bytes_(static_cast<const uint8_t *>(trieBytes)),
pos_(bytes_), initialPos_(bytes_),
remainingMatchLength_(-1), initialRemainingMatchLength_(-1),
- str_(NULL), maxLength_(maxStringLength), value_(0), stack_(NULL) {
+ str_(nullptr), maxLength_(maxStringLength), value_(0), stack_(nullptr) {
if(U_FAILURE(errorCode)) {
return;
}
@@ -39,7 +39,7 @@ BytesTrie::Iterator::Iterator(const void *trieBytes, int32_t maxStringLength,
// cost is minimal.
str_=new CharString();
stack_=new UVector32(errorCode);
- if(U_SUCCESS(errorCode) && (str_==NULL || stack_==NULL)) {
+ if(U_SUCCESS(errorCode) && (str_==nullptr || stack_==nullptr)) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
}
}
@@ -49,7 +49,7 @@ BytesTrie::Iterator::Iterator(const BytesTrie &trie, int32_t maxStringLength,
: bytes_(trie.bytes_), pos_(trie.pos_), initialPos_(trie.pos_),
remainingMatchLength_(trie.remainingMatchLength_),
initialRemainingMatchLength_(trie.remainingMatchLength_),
- str_(NULL), maxLength_(maxStringLength), value_(0), stack_(NULL) {
+ str_(nullptr), maxLength_(maxStringLength), value_(0), stack_(nullptr) {
if(U_FAILURE(errorCode)) {
return;
}
@@ -58,7 +58,7 @@ BytesTrie::Iterator::Iterator(const BytesTrie &trie, int32_t maxStringLength,
if(U_FAILURE(errorCode)) {
return;
}
- if(str_==NULL || stack_==NULL) {
+ if(str_==nullptr || stack_==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -96,7 +96,7 @@ BytesTrie::Iterator::reset() {
}
UBool
-BytesTrie::Iterator::hasNext() const { return pos_!=NULL || !stack_->isEmpty(); }
+BytesTrie::Iterator::hasNext() const { return pos_!=nullptr || !stack_->isEmpty(); }
UBool
BytesTrie::Iterator::next(UErrorCode &errorCode) {
@@ -104,7 +104,7 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) {
return false;
}
const uint8_t *pos=pos_;
- if(pos==NULL) {
+ if(pos==nullptr) {
if(stack_->isEmpty()) {
return false;
}
@@ -118,7 +118,7 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) {
length=(int32_t)((uint32_t)length>>16);
if(length>1) {
pos=branchNext(pos, length, errorCode);
- if(pos==NULL) {
+ if(pos==nullptr) {
return true; // Reached a final value.
}
} else {
@@ -137,7 +137,7 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) {
UBool isFinal=(UBool)(node&kValueIsFinal);
value_=readValue(pos, node>>1);
if(isFinal || (maxLength_>0 && str_->length()==maxLength_)) {
- pos_=NULL;
+ pos_=nullptr;
} else {
pos_=skipValue(pos, node);
}
@@ -151,7 +151,7 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) {
node=*pos++;
}
pos=branchNext(pos, node+1, errorCode);
- if(pos==NULL) {
+ if(pos==nullptr) {
return true; // Reached a final value.
}
} else {
@@ -170,12 +170,12 @@ BytesTrie::Iterator::next(UErrorCode &errorCode) {
StringPiece
BytesTrie::Iterator::getString() const {
- return str_ == NULL ? StringPiece() : str_->toStringPiece();
+ return str_ == nullptr ? StringPiece() : str_->toStringPiece();
}
UBool
BytesTrie::Iterator::truncateAndStop() {
- pos_=NULL;
+ pos_=nullptr;
value_=-1; // no real value for str
return true;
}
@@ -203,9 +203,9 @@ BytesTrie::Iterator::branchNext(const uint8_t *pos, int32_t length, UErrorCode &
stack_->addElement(((length-1)<<16)|str_->length(), errorCode);
str_->append((char)trieByte, errorCode);
if(isFinal) {
- pos_=NULL;
+ pos_=nullptr;
value_=value;
- return NULL;
+ return nullptr;
} else {
return pos+value;
}
diff --git a/thirdparty/icu4c/common/caniter.cpp b/thirdparty/icu4c/common/caniter.cpp
index 81f17265fb..64a3c65d29 100644
--- a/thirdparty/icu4c/common/caniter.cpp
+++ b/thirdparty/icu4c/common/caniter.cpp
@@ -68,10 +68,10 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CanonicalIterator)
*@param source string to get results for
*/
CanonicalIterator::CanonicalIterator(const UnicodeString &sourceStr, UErrorCode &status) :
- pieces(NULL),
+ pieces(nullptr),
pieces_length(0),
- pieces_lengths(NULL),
- current(NULL),
+ pieces_lengths(nullptr),
+ current(nullptr),
current_length(0),
nfd(*Normalizer2::getNFDInstance(status)),
nfcImpl(*Normalizer2Factory::getNFCImpl(status))
@@ -87,23 +87,23 @@ CanonicalIterator::~CanonicalIterator() {
void CanonicalIterator::cleanPieces() {
int32_t i = 0;
- if(pieces != NULL) {
+ if(pieces != nullptr) {
for(i = 0; i < pieces_length; i++) {
- if(pieces[i] != NULL) {
+ if(pieces[i] != nullptr) {
delete[] pieces[i];
}
}
uprv_free(pieces);
- pieces = NULL;
+ pieces = nullptr;
pieces_length = 0;
}
- if(pieces_lengths != NULL) {
+ if(pieces_lengths != nullptr) {
uprv_free(pieces_lengths);
- pieces_lengths = NULL;
+ pieces_lengths = nullptr;
}
- if(current != NULL) {
+ if(current != nullptr) {
uprv_free(current);
- current = NULL;
+ current = nullptr;
current_length = 0;
}
}
@@ -170,7 +170,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
UChar32 cp = 0;
int32_t start = 0;
int32_t i = 0;
- UnicodeString *list = NULL;
+ UnicodeString *list = nullptr;
nfd.normalize(newSource, source, status);
if(U_FAILURE(status)) {
@@ -187,7 +187,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
pieces_length = 1;
current = (int32_t*)uprv_malloc(1 * sizeof(int32_t));
current_length = 1;
- if (pieces == NULL || pieces_lengths == NULL || current == NULL) {
+ if (pieces == nullptr || pieces_lengths == nullptr || current == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
goto CleanPartialInitialization;
}
@@ -233,7 +233,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
pieces_lengths = (int32_t*)uprv_malloc(list_length * sizeof(int32_t));
current = (int32_t*)uprv_malloc(list_length * sizeof(int32_t));
current_length = list_length;
- if (pieces == NULL || pieces_lengths == NULL || current == NULL) {
+ if (pieces == nullptr || pieces_lengths == nullptr || current == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
goto CleanPartialInitialization;
}
@@ -252,7 +252,7 @@ void CanonicalIterator::setSource(const UnicodeString &newSource, UErrorCode &st
return;
// Common section to cleanup all local variables and reset object variables.
CleanPartialInitialization:
- if (list != NULL) {
+ if (list != nullptr) {
delete[] list;
}
cleanPieces();
@@ -276,7 +276,7 @@ void U_EXPORT2 CanonicalIterator::permute(UnicodeString &source, UBool skipZeros
// we check for length < 2 to keep from counting code points all the time
if (source.length() <= 2 && source.countChar32() <= 1) {
UnicodeString *toPut = new UnicodeString(source);
- /* test for NULL */
+ /* test for nullptr */
if (toPut == 0) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
@@ -295,7 +295,7 @@ void U_EXPORT2 CanonicalIterator::permute(UnicodeString &source, UBool skipZeros
for (i = 0; i < source.length(); i += U16_LENGTH(cp)) {
cp = source.char32At(i);
- const UHashElement *ne = NULL;
+ const UHashElement *ne = nullptr;
int32_t el = UHASH_FIRST;
UnicodeString subPermuteString = source;
@@ -321,11 +321,11 @@ void U_EXPORT2 CanonicalIterator::permute(UnicodeString &source, UBool skipZeros
// prefix this character to all of them
ne = subpermute.nextElement(el);
- while (ne != NULL) {
+ while (ne != nullptr) {
UnicodeString *permRes = (UnicodeString *)(ne->value.pointer);
UnicodeString *chStr = new UnicodeString(cp);
- //test for NULL
- if (chStr == NULL) {
+ //test for nullptr
+ if (chStr == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -352,7 +352,7 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
permutations.setValueDeleter(uprv_deleteUObject);
basic.setValueDeleter(uprv_deleteUObject);
- UChar USeg[256];
+ char16_t USeg[256];
int32_t segLen = segment.extract(USeg, 256, status);
getEquivalents2(&basic, USeg, segLen, status);
@@ -360,23 +360,23 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
// add only the ones that are canonically equivalent
// TODO: optimize by not permuting any class zero.
- const UHashElement *ne = NULL;
+ const UHashElement *ne = nullptr;
int32_t el = UHASH_FIRST;
//Iterator it = basic.iterator();
ne = basic.nextElement(el);
//while (it.hasNext())
- while (ne != NULL) {
+ while (ne != nullptr) {
//String item = (String) it.next();
UnicodeString item = *((UnicodeString *)(ne->value.pointer));
permutations.removeAll();
permute(item, CANITER_SKIP_ZEROES, &permutations, status);
- const UHashElement *ne2 = NULL;
+ const UHashElement *ne2 = nullptr;
int32_t el2 = UHASH_FIRST;
//Iterator it2 = permutations.iterator();
ne2 = permutations.nextElement(el2);
//while (it2.hasNext())
- while (ne2 != NULL) {
+ while (ne2 != nullptr) {
//String possible = (String) it2.next();
//UnicodeString *possible = new UnicodeString(*((UnicodeString *)(ne2->value.pointer)));
UnicodeString possible(*((UnicodeString *)(ne2->value.pointer)));
@@ -403,24 +403,24 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
}
// convert into a String[] to clean up storage
//String[] finalResult = new String[result.size()];
- UnicodeString *finalResult = NULL;
+ UnicodeString *finalResult = nullptr;
int32_t resultCount;
if((resultCount = result.count()) != 0) {
finalResult = new UnicodeString[resultCount];
if (finalResult == 0) {
status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
}
else {
status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
//result.toArray(finalResult);
result_len = 0;
el = UHASH_FIRST;
ne = result.nextElement(el);
- while(ne != NULL) {
+ while(ne != nullptr) {
finalResult[result_len++] = *((UnicodeString *)(ne->value.pointer));
ne = result.nextElement(el);
}
@@ -429,10 +429,10 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
return finalResult;
}
-Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const UChar *segment, int32_t segLen, UErrorCode &status) {
+Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const char16_t *segment, int32_t segLen, UErrorCode &status) {
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
//if (PROGRESS) printf("Adding: %s\n", UToS(Tr(segment)));
@@ -457,7 +457,7 @@ Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const UCh
UChar32 cp2 = iter.getCodepoint();
Hashtable remainder(status);
remainder.setValueDeleter(uprv_deleteUObject);
- if (extract(&remainder, cp2, segment, segLen, i, status) == NULL) {
+ if (extract(&remainder, cp2, segment, segLen, i, status) == nullptr) {
continue;
}
@@ -467,13 +467,13 @@ Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const UCh
int32_t el = UHASH_FIRST;
const UHashElement *ne = remainder.nextElement(el);
- while (ne != NULL) {
+ while (ne != nullptr) {
UnicodeString item = *((UnicodeString *)(ne->value.pointer));
UnicodeString *toAdd = new UnicodeString(prefix);
- /* test for NULL */
+ /* test for nullptr */
if (toAdd == 0) {
status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
*toAdd += item;
fillinResult->put(*toAdd, toAdd, status);
@@ -487,7 +487,7 @@ Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const UCh
/* Test for buffer overflows */
if(U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
return fillinResult;
}
@@ -497,13 +497,13 @@ Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const UCh
* (with canonical rearrangement!)
* 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(Hashtable *fillinResult, UChar32 comp, const char16_t *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) {
//if (PROGRESS) printf(" extract: %s, ", UToS(Tr(UnicodeString(comp))));
//if (PROGRESS) printf("%s, %i\n", UToS(Tr(segment)), segmentPos);
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
UnicodeString temp(comp);
@@ -511,13 +511,13 @@ Hashtable *CanonicalIterator::extract(Hashtable *fillinResult, UChar32 comp, con
UnicodeString decompString;
nfd.normalize(temp, decompString, status);
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
if (decompString.isBogus()) {
status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
- const UChar *decomp=decompString.getBuffer();
+ const char16_t *decomp=decompString.getBuffer();
int32_t decompLen=decompString.length();
// See if it matches the start of segment (at segmentPos)
@@ -561,7 +561,7 @@ Hashtable *CanonicalIterator::extract(Hashtable *fillinResult, UChar32 comp, con
}
}
if (!ok)
- return NULL; // we failed, characters left over
+ return nullptr; // we failed, characters left over
//if (PROGRESS) printf("Matches\n");
@@ -575,7 +575,7 @@ Hashtable *CanonicalIterator::extract(Hashtable *fillinResult, UChar32 comp, con
UnicodeString trial;
nfd.normalize(temp, trial, status);
if(U_FAILURE(status) || trial.compare(segment+segmentPos, segLen - segmentPos) != 0) {
- return NULL;
+ return nullptr;
}
return getEquivalents2(fillinResult, temp.getBuffer()+inputLen, temp.length()-inputLen, status);
diff --git a/thirdparty/icu4c/common/characterproperties.cpp b/thirdparty/icu4c/common/characterproperties.cpp
index 2316a391a3..978e6761ce 100644
--- a/thirdparty/icu4c/common/characterproperties.cpp
+++ b/thirdparty/icu4c/common/characterproperties.cpp
@@ -67,7 +67,7 @@ _set_addRange(USet *set, UChar32 start, UChar32 end) {
}
void U_CALLCONV
-_set_addString(USet *set, const UChar *str, int32_t length) {
+_set_addString(USet *set, const char16_t *str, int32_t length) {
((UnicodeSet *)set)->add(icu::UnicodeString((UBool)(length<0), str, length));
}
@@ -377,22 +377,30 @@ UCPMap *makeMap(UProperty property, UErrorCode &errorCode) {
} // namespace
-U_NAMESPACE_USE
+U_NAMESPACE_BEGIN
-U_CAPI const USet * U_EXPORT2
-u_getBinaryPropertySet(UProperty property, UErrorCode *pErrorCode) {
- if (U_FAILURE(*pErrorCode)) { return nullptr; }
+const UnicodeSet *CharacterProperties::getBinaryPropertySet(UProperty property, UErrorCode &errorCode) {
+ if (U_FAILURE(errorCode)) { return nullptr; }
if (property < 0 || UCHAR_BINARY_LIMIT <= property) {
- *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return nullptr;
}
Mutex m(&cpMutex);
UnicodeSet *set = sets[property];
if (set == nullptr) {
- sets[property] = set = makeSet(property, *pErrorCode);
+ sets[property] = set = makeSet(property, errorCode);
}
- if (U_FAILURE(*pErrorCode)) { return nullptr; }
- return set->toUSet();
+ return set;
+}
+
+U_NAMESPACE_END
+
+U_NAMESPACE_USE
+
+U_CAPI const USet * U_EXPORT2
+u_getBinaryPropertySet(UProperty property, UErrorCode *pErrorCode) {
+ const UnicodeSet *set = CharacterProperties::getBinaryPropertySet(property, *pErrorCode);
+ return U_SUCCESS(*pErrorCode) ? set->toUSet() : nullptr;
}
U_CAPI const UCPMap * U_EXPORT2
diff --git a/thirdparty/icu4c/common/chariter.cpp b/thirdparty/icu4c/common/chariter.cpp
index 887119a0eb..16f3b1e14d 100644
--- a/thirdparty/icu4c/common/chariter.cpp
+++ b/thirdparty/icu4c/common/chariter.cpp
@@ -85,14 +85,14 @@ CharacterIterator::operator=(const CharacterIterator &that) {
// implementing first[32]PostInc() directly in a subclass should be faster
// but these implementations make subclassing a little easier
-UChar
-CharacterIterator::firstPostInc(void) {
+char16_t
+CharacterIterator::firstPostInc() {
setToStart();
return nextPostInc();
}
UChar32
-CharacterIterator::first32PostInc(void) {
+CharacterIterator::first32PostInc() {
setToStart();
return next32PostInc();
}
diff --git a/thirdparty/icu4c/common/charstr.cpp b/thirdparty/icu4c/common/charstr.cpp
index 8a0994c737..f76cc8a4dc 100644
--- a/thirdparty/icu4c/common/charstr.cpp
+++ b/thirdparty/icu4c/common/charstr.cpp
@@ -26,12 +26,12 @@
U_NAMESPACE_BEGIN
-CharString::CharString(CharString&& src) U_NOEXCEPT
+CharString::CharString(CharString&& src) noexcept
: buffer(std::move(src.buffer)), len(src.len) {
src.len = 0; // not strictly necessary because we make no guarantees on the source string
}
-CharString& CharString::operator=(CharString&& src) U_NOEXCEPT {
+CharString& CharString::operator=(CharString&& src) noexcept {
buffer = std::move(src.buffer);
len = src.len;
src.len = 0; // not strictly necessary because we make no guarantees on the source string
@@ -113,7 +113,7 @@ CharString &CharString::append(const char *s, int32_t sLength, UErrorCode &error
if(U_FAILURE(errorCode)) {
return *this;
}
- if(sLength<-1 || (s==NULL && sLength!=0)) {
+ if(sLength<-1 || (s==nullptr && sLength!=0)) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return *this;
}
@@ -181,7 +181,7 @@ char *CharString::getAppendBuffer(int32_t minCapacity,
UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
resultCapacity=0;
- return NULL;
+ return nullptr;
}
int32_t appendCapacity=buffer.getCapacity()-len-1; // -1 for NUL
if(appendCapacity>=minCapacity) {
@@ -193,14 +193,14 @@ char *CharString::getAppendBuffer(int32_t minCapacity,
return buffer.getAlias()+len;
}
resultCapacity=0;
- return NULL;
+ return nullptr;
}
CharString &CharString::appendInvariantChars(const UnicodeString &s, UErrorCode &errorCode) {
return appendInvariantChars(s.getBuffer(), s.length(), errorCode);
}
-CharString &CharString::appendInvariantChars(const UChar* uchars, int32_t ucharsLen, UErrorCode &errorCode) {
+CharString &CharString::appendInvariantChars(const char16_t* uchars, int32_t ucharsLen, UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
return *this;
}
@@ -226,8 +226,8 @@ UBool CharString::ensureCapacity(int32_t capacity,
if(desiredCapacityHint==0) {
desiredCapacityHint=capacity+buffer.getCapacity();
}
- if( (desiredCapacityHint<=capacity || buffer.resize(desiredCapacityHint, len+1)==NULL) &&
- buffer.resize(capacity, len+1)==NULL
+ if( (desiredCapacityHint<=capacity || buffer.resize(desiredCapacityHint, len+1)==nullptr) &&
+ buffer.resize(capacity, len+1)==nullptr
) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return false;
diff --git a/thirdparty/icu4c/common/charstr.h b/thirdparty/icu4c/common/charstr.h
index 92a75d3d2f..7749a804b9 100644
--- a/thirdparty/icu4c/common/charstr.h
+++ b/thirdparty/icu4c/common/charstr.h
@@ -59,13 +59,13 @@ public:
* Move constructor; might leave src in an undefined state.
* This string will have the same contents and state that the source string had.
*/
- CharString(CharString &&src) U_NOEXCEPT;
+ CharString(CharString &&src) noexcept;
/**
* Move assignment operator; might leave src in an undefined state.
* This string will have the same contents and state that the source string had.
* The behavior is undefined if *this and src are the same object.
*/
- CharString &operator=(CharString &&src) U_NOEXCEPT;
+ CharString &operator=(CharString &&src) noexcept;
/**
* Replaces this string's contents with the other string's contents.
@@ -156,7 +156,7 @@ public:
UErrorCode &errorCode);
CharString &appendInvariantChars(const UnicodeString &s, UErrorCode &errorCode);
- CharString &appendInvariantChars(const UChar* uchars, int32_t ucharsLen, UErrorCode& errorCode);
+ CharString &appendInvariantChars(const char16_t* uchars, int32_t ucharsLen, UErrorCode& errorCode);
/**
* Appends a filename/path part, e.g., a directory name.
diff --git a/thirdparty/icu4c/common/charstrmap.h b/thirdparty/icu4c/common/charstrmap.h
index 3320a46208..64d5fd1254 100644
--- a/thirdparty/icu4c/common/charstrmap.h
+++ b/thirdparty/icu4c/common/charstrmap.h
@@ -26,7 +26,7 @@ public:
map = uhash_openSize(uhash_hashChars, uhash_compareChars, uhash_compareChars,
size, &errorCode);
}
- CharStringMap(CharStringMap &&other) U_NOEXCEPT : map(other.map) {
+ CharStringMap(CharStringMap &&other) noexcept : map(other.map) {
other.map = nullptr;
}
CharStringMap(const CharStringMap &other) = delete;
@@ -34,7 +34,7 @@ public:
uhash_close(map);
}
- CharStringMap &operator=(CharStringMap &&other) U_NOEXCEPT {
+ CharStringMap &operator=(CharStringMap &&other) noexcept {
map = other.map;
other.map = nullptr;
return *this;
diff --git a/thirdparty/icu4c/common/cmemory.cpp b/thirdparty/icu4c/common/cmemory.cpp
index 64f5034921..e59d4b0efe 100644
--- a/thirdparty/icu4c/common/cmemory.cpp
+++ b/thirdparty/icu4c/common/cmemory.cpp
@@ -15,8 +15,8 @@
* If you have a need to replace ICU allocation, this is the
* place to do it.
*
-* Note that uprv_malloc(0) returns a non-NULL pointer, and
-* that a subsequent free of that pointer value is a NOP.
+* Note that uprv_malloc(0) returns a non-nullptr pointer,
+* and that a subsequent free of that pointer value is a NOP.
*
******************************************************************************
*/
@@ -103,7 +103,7 @@ uprv_free(void *buffer) {
U_CAPI void * U_EXPORT2
uprv_calloc(size_t num, size_t size) {
- void *mem = NULL;
+ void *mem = nullptr;
size *= num;
mem = uprv_malloc(size);
if (mem) {
@@ -118,7 +118,7 @@ u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMem
if (U_FAILURE(*status)) {
return;
}
- if (a==NULL || r==NULL || f==NULL) {
+ if (a==nullptr || r==nullptr || f==nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -129,10 +129,10 @@ u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMem
}
-U_CFUNC UBool cmemory_cleanup(void) {
- pContext = NULL;
- pAlloc = NULL;
- pRealloc = NULL;
- pFree = NULL;
+U_CFUNC UBool cmemory_cleanup() {
+ pContext = nullptr;
+ pAlloc = nullptr;
+ pRealloc = nullptr;
+ pFree = nullptr;
return true;
}
diff --git a/thirdparty/icu4c/common/cmemory.h b/thirdparty/icu4c/common/cmemory.h
index f03b7dcce6..3705c2dfd0 100644
--- a/thirdparty/icu4c/common/cmemory.h
+++ b/thirdparty/icu4c/common/cmemory.h
@@ -192,13 +192,13 @@ public:
* Constructor takes ownership.
* @param p simple pointer to an array of T items that is adopted
*/
- explicit LocalMemory(T *p=NULL) : LocalPointerBase<T>(p) {}
+ explicit LocalMemory(T *p=nullptr) : LocalPointerBase<T>(p) {}
/**
* Move constructor, leaves src with isNull().
* @param src source smart pointer
*/
- LocalMemory(LocalMemory<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
- src.ptr=NULL;
+ LocalMemory(LocalMemory<T> &&src) noexcept : LocalPointerBase<T>(src.ptr) {
+ src.ptr=nullptr;
}
/**
* Destructor deletes the memory it owns.
@@ -212,17 +212,17 @@ public:
* @param src source smart pointer
* @return *this
*/
- LocalMemory<T> &operator=(LocalMemory<T> &&src) U_NOEXCEPT {
+ LocalMemory<T> &operator=(LocalMemory<T> &&src) noexcept {
uprv_free(LocalPointerBase<T>::ptr);
LocalPointerBase<T>::ptr=src.ptr;
- src.ptr=NULL;
+ src.ptr=nullptr;
return *this;
}
/**
* Swap pointers.
* @param other other smart pointer
*/
- void swap(LocalMemory<T> &other) U_NOEXCEPT {
+ void swap(LocalMemory<T> &other) noexcept {
T *temp=LocalPointerBase<T>::ptr;
LocalPointerBase<T>::ptr=other.ptr;
other.ptr=temp;
@@ -232,7 +232,7 @@ public:
* @param p1 will get p2's pointer
* @param p2 will get p1's pointer
*/
- friend inline void swap(LocalMemory<T> &p1, LocalMemory<T> &p2) U_NOEXCEPT {
+ friend inline void swap(LocalMemory<T> &p1, LocalMemory<T> &p2) noexcept {
p1.swap(p2);
}
/**
@@ -248,21 +248,21 @@ public:
* Deletes the array it owns, allocates a new one and reset its bytes to 0.
* Returns the new array pointer.
* If the allocation fails, then the current array is unchanged and
- * this method returns NULL.
+ * this method returns nullptr.
* @param newCapacity must be >0
- * @return the allocated array pointer, or NULL if the allocation failed
+ * @return the allocated array pointer, or nullptr if the allocation failed
*/
inline T *allocateInsteadAndReset(int32_t newCapacity=1);
/**
* Deletes the array it owns and allocates a new one, copying length T items.
* Returns the new array pointer.
* If the allocation fails, then the current array is unchanged and
- * this method returns NULL.
+ * this method returns nullptr.
* @param newCapacity must be >0
* @param length number of T items to be copied from the old array to the new one;
* must be no more than the capacity of the old array,
* which the caller must track because the LocalMemory does not track it
- * @return the allocated array pointer, or NULL if the allocation failed
+ * @return the allocated array pointer, or nullptr if the allocation failed
*/
inline T *allocateInsteadAndCopy(int32_t newCapacity=1, int32_t length=0);
/**
@@ -278,14 +278,14 @@ template<typename T>
inline T *LocalMemory<T>::allocateInsteadAndReset(int32_t newCapacity) {
if(newCapacity>0) {
T *p=(T *)uprv_malloc(newCapacity*sizeof(T));
- if(p!=NULL) {
+ if(p!=nullptr) {
uprv_memset(p, 0, newCapacity*sizeof(T));
uprv_free(LocalPointerBase<T>::ptr);
LocalPointerBase<T>::ptr=p;
}
return p;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -294,7 +294,7 @@ template<typename T>
inline T *LocalMemory<T>::allocateInsteadAndCopy(int32_t newCapacity, int32_t length) {
if(newCapacity>0) {
T *p=(T *)uprv_malloc(newCapacity*sizeof(T));
- if(p!=NULL) {
+ if(p!=nullptr) {
if(length>0) {
if(length>newCapacity) {
length=newCapacity;
@@ -306,7 +306,7 @@ inline T *LocalMemory<T>::allocateInsteadAndCopy(int32_t newCapacity, int32_t le
}
return p;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -332,10 +332,10 @@ template<typename T, int32_t stackCapacity>
class MaybeStackArray {
public:
// No heap allocation. Use only on the stack.
- static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete;
- static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete;
+ static void* U_EXPORT2 operator new(size_t) noexcept = delete;
+ static void* U_EXPORT2 operator new[](size_t) noexcept = delete;
#if U_HAVE_PLACEMENT_NEW
- static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete;
+ static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete;
#endif
/**
@@ -364,11 +364,11 @@ public:
/**
* Move constructor: transfers ownership or copies the stack array.
*/
- MaybeStackArray(MaybeStackArray<T, stackCapacity> &&src) U_NOEXCEPT;
+ MaybeStackArray(MaybeStackArray<T, stackCapacity> &&src) noexcept;
/**
* Move assignment: transfers ownership or copies the stack array.
*/
- MaybeStackArray<T, stackCapacity> &operator=(MaybeStackArray<T, stackCapacity> &&src) U_NOEXCEPT;
+ MaybeStackArray<T, stackCapacity> &operator=(MaybeStackArray<T, stackCapacity> &&src) noexcept;
/**
* Returns the array capacity (number of T items).
* @return array capacity
@@ -403,11 +403,11 @@ public:
/**
* Deletes the array (if owned) and aliases another one, no transfer of ownership.
* If the arguments are illegal, then the current array is unchanged.
- * @param otherArray must not be NULL
+ * @param otherArray must not be nullptr
* @param otherCapacity must be >0
*/
void aliasInstead(T *otherArray, int32_t otherCapacity) {
- if(otherArray!=NULL && otherCapacity>0) {
+ if(otherArray!=nullptr && otherCapacity>0) {
releaseArray();
ptr=otherArray;
capacity=otherCapacity;
@@ -418,17 +418,17 @@ public:
* Deletes the array (if owned) and allocates a new one, copying length T items.
* Returns the new array pointer.
* If the allocation fails, then the current array is unchanged and
- * this method returns NULL.
+ * this method returns nullptr.
* @param newCapacity can be less than or greater than the current capacity;
* must be >0
* @param length number of T items to be copied from the old array to the new one
- * @return the allocated array pointer, or NULL if the allocation failed
+ * @return the allocated array pointer, or nullptr if the allocation failed
*/
inline T *resize(int32_t newCapacity, int32_t length=0);
/**
* Gives up ownership of the array if owned, or else clones it,
* copying length T items; resets itself to the internal stack array.
- * Returns NULL if the allocation failed.
+ * Returns nullptr if the allocation failed.
* @param length number of T items to copy when cloning,
* and capacity of the clone when cloning
* @param resultCapacity will be set to the returned array's capacity (output-only)
@@ -443,7 +443,7 @@ protected:
if (U_FAILURE(status)) {
return;
}
- if (this->resize(src.capacity, 0) == NULL) {
+ if (this->resize(src.capacity, 0) == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -475,7 +475,7 @@ private:
template<typename T, int32_t stackCapacity>
icu::MaybeStackArray<T, stackCapacity>::MaybeStackArray(
- MaybeStackArray <T, stackCapacity>&& src) U_NOEXCEPT
+ MaybeStackArray <T, stackCapacity>&& src) noexcept
: ptr(src.ptr), capacity(src.capacity), needToRelease(src.needToRelease) {
if (src.ptr == src.stackArray) {
ptr = stackArray;
@@ -487,7 +487,7 @@ icu::MaybeStackArray<T, stackCapacity>::MaybeStackArray(
template<typename T, int32_t stackCapacity>
inline MaybeStackArray <T, stackCapacity>&
-MaybeStackArray<T, stackCapacity>::operator=(MaybeStackArray <T, stackCapacity>&& src) U_NOEXCEPT {
+MaybeStackArray<T, stackCapacity>::operator=(MaybeStackArray <T, stackCapacity>&& src) noexcept {
releaseArray(); // in case this instance had its own memory allocated
capacity = src.capacity;
needToRelease = src.needToRelease;
@@ -508,7 +508,7 @@ inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t
::fprintf(::stderr, "MaybeStackArray (resize) alloc %d * %lu\n", newCapacity, sizeof(T));
#endif
T *p=(T *)uprv_malloc(newCapacity*sizeof(T));
- if(p!=NULL) {
+ if(p!=nullptr) {
if(length>0) {
if(length>capacity) {
length=capacity;
@@ -525,7 +525,7 @@ inline T *MaybeStackArray<T, stackCapacity>::resize(int32_t newCapacity, int32_t
}
return p;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -535,7 +535,7 @@ inline T *MaybeStackArray<T, stackCapacity>::orphanOrClone(int32_t length, int32
if(needToRelease) {
p=ptr;
} else if(length<=0) {
- return NULL;
+ return nullptr;
} else {
if(length>capacity) {
length=capacity;
@@ -544,8 +544,8 @@ inline T *MaybeStackArray<T, stackCapacity>::orphanOrClone(int32_t length, int32
#if U_DEBUG && defined(UPRV_MALLOC_COUNT)
::fprintf(::stderr,"MaybeStacArray (orphan) alloc %d * %lu\n", length,sizeof(T));
#endif
- if(p==NULL) {
- return NULL;
+ if(p==nullptr) {
+ return nullptr;
}
uprv_memcpy(p, ptr, (size_t)length*sizeof(T));
}
@@ -568,10 +568,10 @@ template<typename H, typename T, int32_t stackCapacity>
class MaybeStackHeaderAndArray {
public:
// No heap allocation. Use only on the stack.
- static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete;
- static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete;
+ static void* U_EXPORT2 operator new(size_t) noexcept = delete;
+ static void* U_EXPORT2 operator new[](size_t) noexcept = delete;
#if U_HAVE_PLACEMENT_NEW
- static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete;
+ static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete;
#endif
/**
@@ -618,11 +618,11 @@ public:
/**
* Deletes the memory block (if owned) and aliases another one, no transfer of ownership.
* If the arguments are illegal, then the current memory is unchanged.
- * @param otherArray must not be NULL
+ * @param otherArray must not be nullptr
* @param otherCapacity must be >0
*/
void aliasInstead(H *otherMemory, int32_t otherCapacity) {
- if(otherMemory!=NULL && otherCapacity>0) {
+ if(otherMemory!=nullptr && otherCapacity>0) {
releaseMemory();
ptr=otherMemory;
capacity=otherCapacity;
@@ -634,17 +634,17 @@ public:
* copying the header and length T array items.
* Returns the new header pointer.
* If the allocation fails, then the current memory is unchanged and
- * this method returns NULL.
+ * this method returns nullptr.
* @param newCapacity can be less than or greater than the current capacity;
* must be >0
* @param length number of T items to be copied from the old array to the new one
- * @return the allocated pointer, or NULL if the allocation failed
+ * @return the allocated pointer, or nullptr if the allocation failed
*/
inline H *resize(int32_t newCapacity, int32_t length=0);
/**
* Gives up ownership of the memory if owned, or else clones it,
* copying the header and length T array items; resets itself to the internal memory.
- * Returns NULL if the allocation failed.
+ * Returns nullptr if the allocation failed.
* @param length number of T items to copy when cloning,
* and array capacity of the clone when cloning
* @param resultCapacity will be set to the returned array's capacity (output-only)
@@ -680,7 +680,7 @@ inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::resize(int32_t newCapac
::fprintf(::stderr,"MaybeStackHeaderAndArray alloc %d + %d * %ul\n", sizeof(H),newCapacity,sizeof(T));
#endif
H *p=(H *)uprv_malloc(sizeof(H)+newCapacity*sizeof(T));
- if(p!=NULL) {
+ if(p!=nullptr) {
if(length<0) {
length=0;
} else if(length>0) {
@@ -699,7 +699,7 @@ inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::resize(int32_t newCapac
}
return p;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -719,8 +719,8 @@ inline H *MaybeStackHeaderAndArray<H, T, stackCapacity>::orphanOrClone(int32_t l
::fprintf(::stderr,"MaybeStackHeaderAndArray (orphan) alloc %ul + %d * %lu\n", sizeof(H),length,sizeof(T));
#endif
p=(H *)uprv_malloc(sizeof(H)+length*sizeof(T));
- if(p==NULL) {
- return NULL;
+ if(p==nullptr) {
+ return nullptr;
}
uprv_memcpy(p, ptr, sizeof(H)+(size_t)length*sizeof(T));
}
@@ -768,12 +768,12 @@ public:
MemoryPool(const MemoryPool&) = delete;
MemoryPool& operator=(const MemoryPool&) = delete;
- MemoryPool(MemoryPool&& other) U_NOEXCEPT : fCount(other.fCount),
+ MemoryPool(MemoryPool&& other) noexcept : fCount(other.fCount),
fPool(std::move(other.fPool)) {
other.fCount = 0;
}
- MemoryPool& operator=(MemoryPool&& other) U_NOEXCEPT {
+ MemoryPool& operator=(MemoryPool&& other) noexcept {
// Since `this` may contain instances that need to be deleted, we can't
// just throw them away and replace them with `other`. The normal way of
// dealing with this in C++ is to swap `this` and `other`, rather than
diff --git a/thirdparty/icu4c/common/cpputils.h b/thirdparty/icu4c/common/cpputils.h
index 307e570486..2eda999a65 100644
--- a/thirdparty/icu4c/common/cpputils.h
+++ b/thirdparty/icu4c/common/cpputils.h
@@ -62,8 +62,8 @@ inline void uprv_arrayCopy(const int32_t* src, int32_t srcStart,
static
inline void
-uprv_arrayCopy(const UChar *src, int32_t srcStart,
- UChar *dst, int32_t dstStart, int32_t count)
+uprv_arrayCopy(const char16_t *src, int32_t srcStart,
+ char16_t *dst, int32_t dstStart, int32_t count)
{ uprv_memcpy(dst+dstStart, src+srcStart, (size_t)count * sizeof(*src)); }
/**
diff --git a/thirdparty/icu4c/common/cstr.cpp b/thirdparty/icu4c/common/cstr.cpp
index 24654f8fc2..b87597e450 100644
--- a/thirdparty/icu4c/common/cstr.cpp
+++ b/thirdparty/icu4c/common/cstr.cpp
@@ -21,7 +21,7 @@ U_NAMESPACE_BEGIN
CStr::CStr(const UnicodeString &in) {
UErrorCode status = U_ZERO_ERROR;
#if !UCONFIG_NO_CONVERSION || U_CHARSET_IS_UTF8
- int32_t length = in.extract(0, in.length(), static_cast<char *>(NULL), static_cast<uint32_t>(0));
+ int32_t length = in.extract(0, in.length(), static_cast<char *>(nullptr), static_cast<uint32_t>(0));
int32_t resultCapacity = 0;
char *buf = s.getAppendBuffer(length, length, resultCapacity, status);
if (U_SUCCESS(status)) {
diff --git a/thirdparty/icu4c/common/cstring.cpp b/thirdparty/icu4c/common/cstring.cpp
index 06275c4b56..e95816c130 100644
--- a/thirdparty/icu4c/common/cstring.cpp
+++ b/thirdparty/icu4c/common/cstring.cpp
@@ -189,7 +189,7 @@ T_CString_integerToString(char* buffer, int32_t v, int32_t radix)
/*
* Takes a int64_t and fills in a char* string with that number "radix"-based.
* Writes at most 21: chars ("-9223372036854775807" plus NUL).
- * Returns the length of the string, not including the terminating NULL.
+ * Returns the length of the string, not including the terminating NUL.
*/
U_CAPI int32_t U_EXPORT2
T_CString_int64ToString(char* buffer, int64_t v, uint32_t radix)
@@ -233,16 +233,16 @@ T_CString_stringToInteger(const char *integerString, int32_t radix)
U_CAPI int U_EXPORT2
uprv_stricmp(const char *str1, const char *str2) {
- if(str1==NULL) {
- if(str2==NULL) {
+ if(str1==nullptr) {
+ if(str2==nullptr) {
return 0;
} else {
return -1;
}
- } else if(str2==NULL) {
+ } else if(str2==nullptr) {
return 1;
} else {
- /* compare non-NULL strings lexically with lowercase */
+ /* compare non-nullptr strings lexically with lowercase */
int rc;
unsigned char c1, c2;
@@ -272,16 +272,16 @@ uprv_stricmp(const char *str1, const char *str2) {
U_CAPI int U_EXPORT2
uprv_strnicmp(const char *str1, const char *str2, uint32_t n) {
- if(str1==NULL) {
- if(str2==NULL) {
+ if(str1==nullptr) {
+ if(str2==nullptr) {
return 0;
} else {
return -1;
}
- } else if(str2==NULL) {
+ } else if(str2==nullptr) {
return 1;
} else {
- /* compare non-NULL strings lexically with lowercase */
+ /* compare non-nullptr strings lexically with lowercase */
int rc;
unsigned char c1, c2;
diff --git a/thirdparty/icu4c/common/dictbe.cpp b/thirdparty/icu4c/common/dictbe.cpp
index 768eb49b95..0e420c67c5 100644
--- a/thirdparty/icu4c/common/dictbe.cpp
+++ b/thirdparty/icu4c/common/dictbe.cpp
@@ -140,7 +140,7 @@ int32_t PossibleWord::candidates( UText *text, DictionaryMatcher *dict, int32_t
int32_t start = (int32_t)utext_getNativeIndex(text);
if (start != offset) {
offset = start;
- count = dict->matches(text, rangeEnd-start, UPRV_LENGTHOF(cuLengths), cuLengths, cpLengths, NULL, &prefix);
+ count = dict->matches(text, rangeEnd-start, UPRV_LENGTHOF(cuLengths), cuLengths, cpLengths, nullptr, &prefix);
// Dictionary leaves text after longest prefix, not longest word. Back up.
if (count <= 0) {
utext_setNativeIndex(text, start);
@@ -1054,9 +1054,10 @@ foundBest:
*/
static const uint32_t kuint32max = 0xFFFFFFFF;
CjkBreakEngine::CjkBreakEngine(DictionaryMatcher *adoptDictionary, LanguageType type, UErrorCode &status)
-: DictionaryBreakEngine(), fDictionary(adoptDictionary) {
+: DictionaryBreakEngine(), fDictionary(adoptDictionary), isCj(false) {
UTRACE_ENTRY(UTRACE_UBRK_CREATE_BREAK_ENGINE);
UTRACE_DATA1(UTRACE_INFO, "dictbe=%s", "Hani");
+ fMlBreakEngine = nullptr;
nfkcNorm2 = Normalizer2::getNFKCInstance(status);
// Korean dictionary only includes Hangul syllables
fHangulWordSet.applyPattern(UnicodeString(u"[\\uac00-\\ud7a3]"), status);
@@ -1073,11 +1074,20 @@ CjkBreakEngine::CjkBreakEngine(DictionaryMatcher *adoptDictionary, LanguageType
if (U_SUCCESS(status)) {
setCharacters(fHangulWordSet);
}
- } else { //Chinese and Japanese
+ } else { // Chinese and Japanese
UnicodeSet cjSet(UnicodeString(u"[[:Han:][:Hiragana:][:Katakana:]\\u30fc\\uff70\\uff9e\\uff9f]"), status);
+ isCj = true;
if (U_SUCCESS(status)) {
setCharacters(cjSet);
+#if UCONFIG_USE_ML_PHRASE_BREAKING
+ fMlBreakEngine = new MlBreakEngine(fDigitOrOpenPunctuationOrAlphabetSet,
+ fClosePunctuationSet, status);
+ if (fMlBreakEngine == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ }
+#else
initJapanesePhraseParameter(status);
+#endif
}
}
UTRACE_EXIT_STATUS(status);
@@ -1085,6 +1095,7 @@ CjkBreakEngine::CjkBreakEngine(DictionaryMatcher *adoptDictionary, LanguageType
CjkBreakEngine::~CjkBreakEngine(){
delete fDictionary;
+ delete fMlBreakEngine;
}
// The katakanaCost values below are based on the length frequencies of all
@@ -1135,7 +1146,7 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
UnicodeString inString;
// inputMap[inStringIndex] = corresponding native index from UText inText.
- // If NULL then mapping is 1:1
+ // If nullptr then mapping is 1:1
LocalPointer<UVector32> inputMap;
// if UText has the input string as one contiguous UTF-16 chunk
@@ -1251,7 +1262,15 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
}
}
}
-
+
+#if UCONFIG_USE_ML_PHRASE_BREAKING
+ // PhraseBreaking is supported in ja and ko; MlBreakEngine only supports ja.
+ if (isPhraseBreaking && isCj) {
+ return fMlBreakEngine->divideUpRange(inText, rangeStart, rangeEnd, foundBreaks, inString,
+ inputMap, status);
+ }
+#endif
+
// 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);
@@ -1292,9 +1311,9 @@ CjkBreakEngine::divideUpDictionaryRange( UText *inText,
int32_t count;
utext_setNativeIndex(&fu, ix);
count = fDictionary->matches(&fu, maxWordSize, numCodePts,
- NULL, lengths.getBuffer(), values.getBuffer(), NULL);
+ nullptr, lengths.getBuffer(), values.getBuffer(), nullptr);
// Note: lengths is filled with code point lengths
- // The NULL parameter is the ignored code unit lengths.
+ // The nullptr 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
diff --git a/thirdparty/icu4c/common/dictbe.h b/thirdparty/icu4c/common/dictbe.h
index ca1a3c28b7..a2c761bdc3 100644
--- a/thirdparty/icu4c/common/dictbe.h
+++ b/thirdparty/icu4c/common/dictbe.h
@@ -16,11 +16,13 @@
#include "brkeng.h"
#include "hash.h"
+#include "mlbe.h"
#include "uvectr32.h"
U_NAMESPACE_BEGIN
class DictionaryMatcher;
+class MlBreakEngine;
class Normalizer2;
/*******************************************************************
@@ -374,6 +376,8 @@ class CjkBreakEngine : public DictionaryBreakEngine {
DictionaryMatcher *fDictionary;
const Normalizer2 *nfkcNorm2;
+ MlBreakEngine *fMlBreakEngine;
+ bool isCj;
private:
// Load Japanese extensions.
diff --git a/thirdparty/icu4c/common/dictionarydata.cpp b/thirdparty/icu4c/common/dictionarydata.cpp
index 6e2dbee5b6..80b6d82d56 100644
--- a/thirdparty/icu4c/common/dictionarydata.cpp
+++ b/thirdparty/icu4c/common/dictionarydata.cpp
@@ -57,13 +57,13 @@ int32_t UCharsDictionaryMatcher::matches(UText *text, int32_t maxLength, int32_t
codePointsMatched += 1;
if (USTRINGTRIE_HAS_VALUE(result)) {
if (wordCount < limit) {
- if (values != NULL) {
+ if (values != nullptr) {
values[wordCount] = uct.getValue();
}
- if (lengths != NULL) {
+ if (lengths != nullptr) {
lengths[wordCount] = lengthMatched;
}
- if (cpLengths != NULL) {
+ if (cpLengths != nullptr) {
cpLengths[wordCount] = codePointsMatched;
}
++wordCount;
@@ -80,7 +80,7 @@ int32_t UCharsDictionaryMatcher::matches(UText *text, int32_t maxLength, int32_t
}
}
- if (prefix != NULL) {
+ if (prefix != nullptr) {
*prefix = codePointsMatched;
}
return wordCount;
@@ -124,13 +124,13 @@ int32_t BytesDictionaryMatcher::matches(UText *text, int32_t maxLength, int32_t
codePointsMatched += 1;
if (USTRINGTRIE_HAS_VALUE(result)) {
if (wordCount < limit) {
- if (values != NULL) {
+ if (values != nullptr) {
values[wordCount] = bt.getValue();
}
- if (lengths != NULL) {
+ if (lengths != nullptr) {
lengths[wordCount] = lengthMatched;
}
- if (cpLengths != NULL) {
+ if (cpLengths != nullptr) {
cpLengths[wordCount] = codePointsMatched;
}
++wordCount;
@@ -147,7 +147,7 @@ int32_t BytesDictionaryMatcher::matches(UText *text, int32_t maxLength, int32_t
}
}
- if (prefix != NULL) {
+ if (prefix != nullptr) {
*prefix = codePointsMatched;
}
return wordCount;
@@ -170,7 +170,7 @@ udict_swap(const UDataSwapper *ds, const void *inData, int32_t length,
int32_t i, offset, size;
headerSize = udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
- if (pErrorCode == NULL || U_FAILURE(*pErrorCode)) return 0;
+ if (pErrorCode == nullptr || U_FAILURE(*pErrorCode)) return 0;
pInfo = (const UDataInfo *)((const char *)inData + 4);
if (!(pInfo->dataFormat[0] == 0x44 &&
pInfo->dataFormat[1] == 0x69 &&
@@ -184,7 +184,7 @@ udict_swap(const UDataSwapper *ds, const void *inData, int32_t length,
}
inBytes = (const uint8_t *)inData + headerSize;
- outBytes = (uint8_t *)outData + headerSize;
+ outBytes = (outData == nullptr) ? nullptr : (uint8_t *)outData + headerSize;
inIndexes = (const int32_t *)inBytes;
if (length >= 0) {
diff --git a/thirdparty/icu4c/common/dictionarydata.h b/thirdparty/icu4c/common/dictionarydata.h
index e75716f54b..8751e502d5 100644
--- a/thirdparty/icu4c/common/dictionarydata.h
+++ b/thirdparty/icu4c/common/dictionarydata.h
@@ -79,15 +79,15 @@ public:
* matching words to be found.
* @param lengths output array, filled with the lengths of the matches, in order,
* from shortest to longest. Lengths are in native indexing units
- * of the UText. May be NULL.
+ * of the UText. May be nullptr.
* @param cpLengths output array, filled with the lengths of the matches, in order,
* from shortest to longest. Lengths are the number of Unicode code points.
- * May be NULL.
+ * May be nullptr.
* @param values Output array, filled with the values associated with the words found.
- * May be NULL.
+ * May be nullptr.
* @param prefix Output parameter, the code point length of the prefix match, even if that
* prefix didn't lead to a complete word. Will always be >= the cpLength
- * of the longest complete word matched. May be NULL.
+ * of the longest complete word matched. May be nullptr.
* @return Number of matching words found.
*/
virtual int32_t matches(UText *text, int32_t maxLength, int32_t limit,
@@ -103,14 +103,14 @@ class U_COMMON_API UCharsDictionaryMatcher : public DictionaryMatcher {
public:
// constructs a new UCharsDictionaryMatcher.
// The UDataMemory * will be closed on this object's destruction.
- UCharsDictionaryMatcher(const UChar *c, UDataMemory *f) : characters(c), file(f) { }
+ UCharsDictionaryMatcher(const char16_t *c, UDataMemory *f) : characters(c), file(f) { }
virtual ~UCharsDictionaryMatcher();
virtual int32_t matches(UText *text, int32_t maxLength, int32_t limit,
int32_t *lengths, int32_t *cpLengths, int32_t *values,
int32_t *prefix) const override;
virtual int32_t getType() const override;
private:
- const UChar *characters;
+ const char16_t *characters;
UDataMemory *file;
};
diff --git a/thirdparty/icu4c/common/edits.cpp b/thirdparty/icu4c/common/edits.cpp
index 21d7c3f006..3348145d48 100644
--- a/thirdparty/icu4c/common/edits.cpp
+++ b/thirdparty/icu4c/common/edits.cpp
@@ -35,7 +35,7 @@ const int32_t LENGTH_IN_2TRAIL = 62;
} // namespace
-void Edits::releaseArray() U_NOEXCEPT {
+void Edits::releaseArray() noexcept {
if (array != stackArray) {
uprv_free(array);
}
@@ -63,7 +63,7 @@ Edits &Edits::copyArray(const Edits &other) {
return *this;
}
-Edits &Edits::moveArray(Edits &src) U_NOEXCEPT {
+Edits &Edits::moveArray(Edits &src) noexcept {
if (U_FAILURE(errorCode_)) {
length = delta = numChanges = 0;
return *this;
@@ -94,7 +94,7 @@ Edits &Edits::operator=(const Edits &other) {
return copyArray(other);
}
-Edits &Edits::operator=(Edits &&src) U_NOEXCEPT {
+Edits &Edits::operator=(Edits &&src) noexcept {
length = src.length;
delta = src.delta;
numChanges = src.numChanges;
@@ -106,7 +106,7 @@ Edits::~Edits() {
releaseArray();
}
-void Edits::reset() U_NOEXCEPT {
+void Edits::reset() noexcept {
length = delta = numChanges = 0;
errorCode_ = U_ZERO_ERROR;
}
@@ -233,7 +233,7 @@ UBool Edits::growArray() {
return false;
}
uint16_t *newArray = (uint16_t *)uprv_malloc((size_t)newCapacity * 2);
- if (newArray == NULL) {
+ if (newArray == nullptr) {
errorCode_ = U_MEMORY_ALLOCATION_ERROR;
return false;
}
diff --git a/thirdparty/icu4c/common/emojiprops.cpp b/thirdparty/icu4c/common/emojiprops.cpp
index d07e07c6cc..f2b3f4762f 100644
--- a/thirdparty/icu4c/common/emojiprops.cpp
+++ b/thirdparty/icu4c/common/emojiprops.cpp
@@ -46,7 +46,7 @@ void U_CALLCONV initSingleton(UErrorCode &errorCode) {
// TODO: turn this into a shared helper function
// Requires the major version to match, and then requires at least the minor version.
UBool udata_isAcceptableMajorMinor(
- const UDataInfo &info, const UChar *dataFormat, uint8_t major, uint8_t minor) {
+ const UDataInfo &info, const char16_t *dataFormat, uint8_t major, uint8_t minor) {
return
info.size >= 20 &&
info.isBigEndian == U_IS_BIG_ENDIAN &&
@@ -104,7 +104,7 @@ EmojiProps::load(UErrorCode &errorCode) {
offset = inIndexes[i];
nextOffset = inIndexes[i + 1];
// Set/leave nullptr if there is no UCharsTrie.
- const UChar *p = nextOffset > offset ? (const UChar *)(inBytes + offset) : nullptr;
+ const char16_t *p = nextOffset > offset ? (const char16_t *)(inBytes + offset) : nullptr;
stringTries[getStringTrieIndex(i)] = p;
}
}
@@ -160,14 +160,14 @@ EmojiProps::hasBinaryPropertyImpl(UChar32 c, UProperty which) const {
}
UBool
-EmojiProps::hasBinaryProperty(const UChar *s, int32_t length, UProperty which) {
+EmojiProps::hasBinaryProperty(const char16_t *s, int32_t length, UProperty which) {
UErrorCode errorCode = U_ZERO_ERROR;
const EmojiProps *ep = getSingleton(errorCode);
return U_SUCCESS(errorCode) && ep->hasBinaryPropertyImpl(s, length, which);
}
UBool
-EmojiProps::hasBinaryPropertyImpl(const UChar *s, int32_t length, UProperty which) const {
+EmojiProps::hasBinaryPropertyImpl(const char16_t *s, int32_t length, UProperty which) const {
if (s == nullptr && length != 0) { return false; }
if (length <= 0 && (length == 0 || *s == 0)) { return false; } // empty string
// The caller should have delegated single code points to hasBinaryProperty(c, which).
@@ -181,7 +181,7 @@ EmojiProps::hasBinaryPropertyImpl(const UChar *s, int32_t length, UProperty whic
lastProp = UCHAR_RGI_EMOJI_ZWJ_SEQUENCE;
}
for (int32_t prop = firstProp; prop <= lastProp; ++prop) {
- const UChar *trieUChars = stringTries[prop - UCHAR_BASIC_EMOJI];
+ const char16_t *trieUChars = stringTries[prop - UCHAR_BASIC_EMOJI];
if (trieUChars != nullptr) {
UCharsTrie trie(trieUChars);
UStringTrieResult result = trie.next(s, length);
@@ -206,7 +206,7 @@ EmojiProps::addStrings(const USetAdder *sa, UProperty which, UErrorCode &errorCo
lastProp = UCHAR_RGI_EMOJI_ZWJ_SEQUENCE;
}
for (int32_t prop = firstProp; prop <= lastProp; ++prop) {
- const UChar *trieUChars = stringTries[prop - UCHAR_BASIC_EMOJI];
+ const char16_t *trieUChars = stringTries[prop - UCHAR_BASIC_EMOJI];
if (trieUChars != nullptr) {
UCharsTrie::Iterator iter(trieUChars, 0, errorCode);
while (iter.next(errorCode)) {
diff --git a/thirdparty/icu4c/common/emojiprops.h b/thirdparty/icu4c/common/emojiprops.h
index 457847c303..777b7b11a8 100644
--- a/thirdparty/icu4c/common/emojiprops.h
+++ b/thirdparty/icu4c/common/emojiprops.h
@@ -23,7 +23,7 @@ public:
static const EmojiProps *getSingleton(UErrorCode &errorCode);
static UBool hasBinaryProperty(UChar32 c, UProperty which);
- static UBool hasBinaryProperty(const UChar *s, int32_t length, UProperty which);
+ static UBool hasBinaryProperty(const char16_t *s, int32_t length, UProperty which);
void addPropertyStarts(const USetAdder *sa, UErrorCode &errorCode) const;
void addStrings(const USetAdder *sa, UProperty which, UErrorCode &errorCode) const;
@@ -78,11 +78,11 @@ private:
void load(UErrorCode &errorCode);
UBool hasBinaryPropertyImpl(UChar32 c, UProperty which) const;
- UBool hasBinaryPropertyImpl(const UChar *s, int32_t length, UProperty which) const;
+ UBool hasBinaryPropertyImpl(const char16_t *s, int32_t length, UProperty which) const;
UDataMemory *memory = nullptr;
UCPTrie *cpTrie = nullptr;
- const UChar *stringTries[6] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
+ const char16_t *stringTries[6] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
};
U_NAMESPACE_END
diff --git a/thirdparty/icu4c/common/filteredbrk.cpp b/thirdparty/icu4c/common/filteredbrk.cpp
index baa1d4e42d..a705b037c4 100644
--- a/thirdparty/icu4c/common/filteredbrk.cpp
+++ b/thirdparty/icu4c/common/filteredbrk.cpp
@@ -35,7 +35,7 @@ static void _fb_trace(const char *m, const UnicodeString *s, UBool b, int32_t d,
if(s) {
s->extract(0,s->length(),buf,2048);
} else {
- strcpy(buf,"NULL");
+ strcpy(buf,"nullptr");
}
fprintf(stderr,"%s:%d: %s. s='%s'(%p), b=%c, d=%d\n",
f, l, m, buf, (const void*)s, b?'T':'F',(int)d);
@@ -102,7 +102,7 @@ class UStringSet : public UVector {
inline UBool add(const UnicodeString& str, UErrorCode &status) {
if(U_FAILURE(status)) return false;
UnicodeString *t = new UnicodeString(str);
- if(t==NULL) {
+ if(t==nullptr) {
status = U_MEMORY_ALLOCATION_ERROR; return false;
}
return adopt(t, status);
@@ -130,7 +130,7 @@ static const int32_t kPARTIAL = (1<<0); //< partial - need to run through forwar
static const int32_t kMATCH = (1<<1); //< exact match - skip this one.
static const int32_t kSuppressInReverse = (1<<0);
static const int32_t kAddToForward = (1<<1);
-static const UChar kFULLSTOP = 0x002E; // '.'
+static const char16_t kFULLSTOP = 0x002E; // '.'
/**
* Shared data for SimpleFilteredSentenceBreakIterator
@@ -191,7 +191,7 @@ public:
return clone();
}
virtual SimpleFilteredSentenceBreakIterator* clone() const override { return new SimpleFilteredSentenceBreakIterator(*this); }
- virtual UClassID getDynamicClassID(void) const override { return NULL; }
+ virtual UClassID getDynamicClassID() const override { return nullptr; }
virtual bool operator==(const BreakIterator& o) const override { if(this==&o) return true; return false; }
/* -- text modifying -- */
@@ -202,20 +202,20 @@ public:
/* -- other functions that are just delegated -- */
virtual UText *getUText(UText *fillIn, UErrorCode &status) const override { return fDelegate->getUText(fillIn,status); }
- virtual CharacterIterator& getText(void) const override { return fDelegate->getText(); }
+ virtual CharacterIterator& getText() const override { return fDelegate->getText(); }
/* -- ITERATION -- */
- virtual int32_t first(void) override;
+ virtual int32_t first() override;
virtual int32_t preceding(int32_t offset) override;
- virtual int32_t previous(void) override;
+ virtual int32_t previous() override;
virtual UBool isBoundary(int32_t offset) override;
- virtual int32_t current(void) const override { return fDelegate->current(); } // we keep the delegate current, so this should be correct.
+ virtual int32_t current() const override { return fDelegate->current(); } // we keep the delegate current, so this should be correct.
- virtual int32_t next(void) override;
+ virtual int32_t next() override;
virtual int32_t next(int32_t n) override;
virtual int32_t following(int32_t offset) override;
- virtual int32_t last(void) override;
+ virtual int32_t last() override;
private:
/**
@@ -289,11 +289,11 @@ SimpleFilteredSentenceBreakIterator::breakExceptionAt(int32_t n) {
// Assume a space is following the '.' (so we handle the case: "Mr. /Brown")
if(utext_previous32(fText.getAlias())==u' ') { // TODO: skip a class of chars here??
// TODO only do this the 1st time?
- //if(debug2) u_printf("skipping prev: |%C| \n", (UChar)uch);
+ //if(debug2) u_printf("skipping prev: |%C| \n", (char16_t)uch);
} else {
- //if(debug2) u_printf("not skipping prev: |%C| \n", (UChar)uch);
+ //if(debug2) u_printf("not skipping prev: |%C| \n", (char16_t)uch);
utext_next32(fText.getAlias());
- //if(debug2) u_printf(" -> : |%C| \n", (UChar)uch);
+ //if(debug2) u_printf(" -> : |%C| \n", (char16_t)uch);
}
{
@@ -309,20 +309,20 @@ SimpleFilteredSentenceBreakIterator::breakExceptionAt(int32_t n) {
if(!USTRINGTRIE_HAS_NEXT(r)) {
break;
}
- //if(debug2) u_printf("rev< /%C/ cont?%d @%d\n", (UChar)uch, r, utext_getNativeIndex(fText.getAlias()));
+ //if(debug2) u_printf("rev< /%C/ cont?%d @%d\n", (char16_t)uch, r, utext_getNativeIndex(fText.getAlias()));
}
}
//if(bestValue >= 0) {
- //if(debug2) u_printf("rev<+/%C/+end of seq.. r=%d, bestPosn=%d, bestValue=%d\n", (UChar)uch, r, bestPosn, bestValue);
+ //if(debug2) u_printf("rev<+/%C/+end of seq.. r=%d, bestPosn=%d, bestValue=%d\n", (char16_t)uch, r, bestPosn, bestValue);
//}
if(bestPosn>=0) {
- //if(debug2) u_printf("rev< /%C/ end of seq.. r=%d, bestPosn=%d, bestValue=%d\n", (UChar)uch, r, bestPosn, bestValue);
+ //if(debug2) u_printf("rev< /%C/ end of seq.. r=%d, bestPosn=%d, bestValue=%d\n", (char16_t)uch, r, bestPosn, bestValue);
//if(USTRINGTRIE_MATCHES(r)) { // matched - so, now what?
//int32_t bestValue = iter.getValue();
- ////if(debug2) u_printf("rev< /%C/ matched, skip..%d bestValue=%d\n", (UChar)uch, r, bestValue);
+ ////if(debug2) u_printf("rev< /%C/ matched, skip..%d bestValue=%d\n", (char16_t)uch, r, bestValue);
if(bestValue == kMATCH) { // exact match!
//if(debug2) u_printf(" exact backward match\n");
@@ -340,15 +340,15 @@ SimpleFilteredSentenceBreakIterator::breakExceptionAt(int32_t n) {
UChar32 uch;
while((uch=utext_next32(fText.getAlias()))!=U_SENTINEL &&
USTRINGTRIE_HAS_NEXT(rfwd=iter.nextForCodePoint(uch))) {
- //if(debug2) u_printf("fwd> /%C/ cont?%d @%d\n", (UChar)uch, rfwd, utext_getNativeIndex(fText.getAlias()));
+ //if(debug2) u_printf("fwd> /%C/ cont?%d @%d\n", (char16_t)uch, rfwd, utext_getNativeIndex(fText.getAlias()));
}
if(USTRINGTRIE_MATCHES(rfwd)) {
- //if(debug2) u_printf("fwd> /%C/ == forward match!\n", (UChar)uch);
+ //if(debug2) u_printf("fwd> /%C/ == forward match!\n", (char16_t)uch);
// only full matches here, nothing to check
// skip the next:
return kExceptionHere;
} else {
- //if(debug2) u_printf("fwd> /%C/ no match.\n", (UChar)uch);
+ //if(debug2) u_printf("fwd> /%C/ no match.\n", (char16_t)uch);
// no match (no exception) -return the 'underlying' break
return kNoExceptionHere;
}
@@ -356,7 +356,7 @@ SimpleFilteredSentenceBreakIterator::breakExceptionAt(int32_t n) {
return kNoExceptionHere; // internal error and/or no forwards trie
}
} else {
- //if(debug2) u_printf("rev< /%C/ .. no match..%d\n", (UChar)uch, r); // no best match
+ //if(debug2) u_printf("rev< /%C/ .. no match..%d\n", (char16_t)uch, r); // no best match
return kNoExceptionHere; // No match - so exit. Not an exception.
}
}
@@ -428,7 +428,7 @@ SimpleFilteredSentenceBreakIterator::next() {
}
int32_t
-SimpleFilteredSentenceBreakIterator::first(void) {
+SimpleFilteredSentenceBreakIterator::first() {
// Don't suppress a break opportunity at the beginning of text.
return fDelegate->first();
}
@@ -439,7 +439,7 @@ SimpleFilteredSentenceBreakIterator::preceding(int32_t offset) {
}
int32_t
-SimpleFilteredSentenceBreakIterator::previous(void) {
+SimpleFilteredSentenceBreakIterator::previous() {
return internalPrev(fDelegate->previous());
}
@@ -473,7 +473,7 @@ SimpleFilteredSentenceBreakIterator::following(int32_t offset) {
}
int32_t
-SimpleFilteredSentenceBreakIterator::last(void) {
+SimpleFilteredSentenceBreakIterator::last() {
// Don't suppress a break opportunity at the end of text.
return fDelegate->last();
}
@@ -516,7 +516,7 @@ SimpleFilteredBreakIteratorBuilder::SimpleFilteredBreakIteratorBuilder(const Loc
#endif
return; // leaves the builder empty, if you try to use it.
}
- LocalUResourceBundlePointer exceptions(ures_getByKeyWithFallback(b.getAlias(), "exceptions", NULL, &subStatus));
+ LocalUResourceBundlePointer exceptions(ures_getByKeyWithFallback(b.getAlias(), "exceptions", nullptr, &subStatus));
if (U_FAILURE(subStatus) || (subStatus == U_USING_DEFAULT_WARNING) ) {
status = subStatus; // copy the failing status
#if FB_DEBUG
@@ -524,7 +524,7 @@ SimpleFilteredBreakIteratorBuilder::SimpleFilteredBreakIteratorBuilder(const Loc
#endif
return; // leaves the builder empty, if you try to use it.
}
- LocalUResourceBundlePointer breaks(ures_getByKeyWithFallback(exceptions.getAlias(), "SentenceBreak", NULL, &subStatus));
+ LocalUResourceBundlePointer breaks(ures_getByKeyWithFallback(exceptions.getAlias(), "SentenceBreak", nullptr, &subStatus));
#if FB_DEBUG
{
@@ -590,7 +590,7 @@ SimpleFilteredBreakIteratorBuilder::build(BreakIterator* adoptBreakIterator, UEr
LocalPointer<UCharsTrieBuilder> builder(new UCharsTrieBuilder(status), status);
LocalPointer<UCharsTrieBuilder> builder2(new UCharsTrieBuilder(status), status);
if(U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
int32_t revCount = 0;
@@ -620,7 +620,7 @@ SimpleFilteredBreakIteratorBuilder::build(BreakIterator* adoptBreakIterator, UEr
} else {
FB_TRACE("build",abbr,false,i);
status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
partials[n] = 0; // default: not partial
n++;
@@ -682,21 +682,21 @@ SimpleFilteredBreakIteratorBuilder::build(BreakIterator* adoptBreakIterator, UEr
////if(debug2) u_printf("SUPPRESS- not Added(%d): /%S/ status=%s\n",partials[i], ustrs[i].getTerminatedBuffer(), u_errorName(status));
}
}
- FB_TRACE("AbbrCount",NULL,false, subCount);
+ FB_TRACE("AbbrCount",nullptr,false, subCount);
if(revCount>0) {
backwardsTrie.adoptInstead(builder->build(USTRINGTRIE_BUILD_FAST, status));
if(U_FAILURE(status)) {
- FB_TRACE(u_errorName(status),NULL,false, -1);
- return NULL;
+ FB_TRACE(u_errorName(status),nullptr,false, -1);
+ return nullptr;
}
}
if(fwdCount>0) {
forwardsPartialTrie.adoptInstead(builder2->build(USTRINGTRIE_BUILD_FAST, status));
if(U_FAILURE(status)) {
- FB_TRACE(u_errorName(status),NULL,false, -1);
- return NULL;
+ FB_TRACE(u_errorName(status),nullptr,false, -1);
+ return nullptr;
}
}
@@ -714,9 +714,9 @@ FilteredBreakIteratorBuilder::~FilteredBreakIteratorBuilder() {
FilteredBreakIteratorBuilder *
FilteredBreakIteratorBuilder::createInstance(const Locale& where, UErrorCode& status) {
- if(U_FAILURE(status)) return NULL;
+ if(U_FAILURE(status)) return nullptr;
LocalPointer<FilteredBreakIteratorBuilder> ret(new SimpleFilteredBreakIteratorBuilder(where, status), status);
- return (U_SUCCESS(status))? ret.orphan(): NULL;
+ return (U_SUCCESS(status))? ret.orphan(): nullptr;
}
FilteredBreakIteratorBuilder *
@@ -726,9 +726,9 @@ FilteredBreakIteratorBuilder::createInstance(UErrorCode &status) {
FilteredBreakIteratorBuilder *
FilteredBreakIteratorBuilder::createEmptyInstance(UErrorCode& status) {
- if(U_FAILURE(status)) return NULL;
+ if(U_FAILURE(status)) return nullptr;
LocalPointer<FilteredBreakIteratorBuilder> ret(new SimpleFilteredBreakIteratorBuilder(status), status);
- return (U_SUCCESS(status))? ret.orphan(): NULL;
+ return (U_SUCCESS(status))? ret.orphan(): nullptr;
}
U_NAMESPACE_END
diff --git a/thirdparty/icu4c/common/filterednormalizer2.cpp b/thirdparty/icu4c/common/filterednormalizer2.cpp
index 63f01206e9..5eafcb6d78 100644
--- a/thirdparty/icu4c/common/filterednormalizer2.cpp
+++ b/thirdparty/icu4c/common/filterednormalizer2.cpp
@@ -346,15 +346,15 @@ U_NAMESPACE_USE
U_CAPI UNormalizer2 * U_EXPORT2
unorm2_openFiltered(const UNormalizer2 *norm2, const USet *filterSet, UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
- if(filterSet==NULL) {
+ if(filterSet==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
Normalizer2 *fn2=new FilteredNormalizer2(*(Normalizer2 *)norm2,
*UnicodeSet::fromUSet(filterSet));
- if(fn2==NULL) {
+ if(fn2==nullptr) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
}
return (UNormalizer2 *)fn2;
diff --git a/thirdparty/icu4c/common/hash.h b/thirdparty/icu4c/common/hash.h
index c9afeaf562..bc103ee72c 100644
--- a/thirdparty/icu4c/common/hash.h
+++ b/thirdparty/icu4c/common/hash.h
@@ -97,7 +97,7 @@ public:
inline int32_t removei(const UnicodeString& key);
- inline void removeAll(void);
+ inline void removeAll();
inline UBool containsKey(const UnicodeString& key) const;
@@ -159,7 +159,7 @@ inline Hashtable::Hashtable(UBool ignoreKeyCase, UErrorCode& status)
: uhash_hashUnicodeString,
ignoreKeyCase ? uhash_compareCaselessUnicodeString
: uhash_compareUnicodeString,
- NULL,
+ nullptr,
status);
}
@@ -170,25 +170,25 @@ inline Hashtable::Hashtable(UBool ignoreKeyCase, int32_t size, UErrorCode& statu
: uhash_hashUnicodeString,
ignoreKeyCase ? uhash_compareCaselessUnicodeString
: uhash_compareUnicodeString,
- NULL, size,
+ nullptr, size,
status);
}
inline Hashtable::Hashtable(UErrorCode& status)
: hash(0)
{
- init(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, status);
+ init(uhash_hashUnicodeString, uhash_compareUnicodeString, nullptr, status);
}
inline Hashtable::Hashtable()
: hash(0)
{
UErrorCode status = U_ZERO_ERROR;
- init(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, status);
+ init(uhash_hashUnicodeString, uhash_compareUnicodeString, nullptr, status);
}
inline Hashtable::~Hashtable() {
- if (hash != NULL) {
+ if (hash != nullptr) {
uhash_close(hash);
}
}
@@ -246,7 +246,7 @@ inline const UHashElement* Hashtable::nextElement(int32_t& pos) const {
return uhash_nextElement(hash, &pos);
}
-inline void Hashtable::removeAll(void) {
+inline void Hashtable::removeAll() {
uhash_removeAll(hash);
}
diff --git a/thirdparty/icu4c/common/icudataver.cpp b/thirdparty/icu4c/common/icudataver.cpp
index d314411374..809d080512 100644
--- a/thirdparty/icu4c/common/icudataver.cpp
+++ b/thirdparty/icu4c/common/icudataver.cpp
@@ -15,14 +15,14 @@
#include "uresimp.h" /* for ures_getVersionByKey */
U_CAPI void U_EXPORT2 u_getDataVersion(UVersionInfo dataVersionFillin, UErrorCode *status) {
- UResourceBundle *icudatares = NULL;
+ UResourceBundle *icudatares = nullptr;
if (U_FAILURE(*status)) {
return;
}
- if (dataVersionFillin != NULL) {
- icudatares = ures_openDirect(NULL, U_ICU_VERSION_BUNDLE , status);
+ if (dataVersionFillin != nullptr) {
+ icudatares = ures_openDirect(nullptr, U_ICU_VERSION_BUNDLE , status);
if (U_SUCCESS(*status)) {
ures_getVersionByKey(icudatares, U_ICU_DATA_KEY, dataVersionFillin, status);
}
diff --git a/thirdparty/icu4c/common/icuplug.cpp b/thirdparty/icu4c/common/icuplug.cpp
index 72b5d27175..7aa70a506b 100644
--- a/thirdparty/icu4c/common/icuplug.cpp
+++ b/thirdparty/icu4c/common/icuplug.cpp
@@ -52,9 +52,9 @@ struct UPlugData {
UPlugEntrypoint *entrypoint; /**< plugin entrypoint */
uint32_t structSize; /**< initialized to the size of this structure */
uint32_t token; /**< must be U_PLUG_TOKEN */
- void *lib; /**< plugin library, or NULL */
+ void *lib; /**< plugin library, or nullptr */
char libName[UPLUG_NAME_MAX]; /**< library name */
- char sym[UPLUG_NAME_MAX]; /**< plugin symbol, or NULL */
+ char sym[UPLUG_NAME_MAX]; /**< plugin symbol, or nullptr */
char config[UPLUG_NAME_MAX]; /**< configuration data */
void *context; /**< user context data */
char name[UPLUG_NAME_MAX]; /**< name of plugin */
@@ -148,9 +148,9 @@ static int32_t searchForLibrary(void *lib) {
U_CAPI char * U_EXPORT2
uplug_findLibrary(void *lib, UErrorCode *status) {
int32_t libEnt;
- char *ret = NULL;
+ char *ret = nullptr;
if(U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
libEnt = searchForLibrary(lib);
if(libEnt!=-1) {
@@ -164,9 +164,9 @@ uplug_findLibrary(void *lib, UErrorCode *status) {
U_CAPI void * U_EXPORT2
uplug_openLibrary(const char *libName, UErrorCode *status) {
int32_t libEntry = -1;
- void *lib = NULL;
+ void *lib = nullptr;
- if(U_FAILURE(*status)) return NULL;
+ if(U_FAILURE(*status)) return nullptr;
libEntry = searchForLibraryName(libName);
if(libEntry == -1) {
@@ -177,7 +177,7 @@ uplug_openLibrary(const char *libName, UErrorCode *status) {
#if UPLUG_TRACE
DBG((stderr, "uplug_openLibrary() - out of library slots (max %d)\n", libraryMax));
#endif
- return NULL;
+ return nullptr;
}
/* Some operating systems don't want
DL operations from multiple threads. */
@@ -186,9 +186,9 @@ uplug_openLibrary(const char *libName, UErrorCode *status) {
DBG((stderr, "uplug_openLibrary(%s,%s) libEntry %d, lib %p\n", libName, u_errorName(*status), libEntry, lib));
#endif
- if(libraryList[libEntry].lib == NULL || U_FAILURE(*status)) {
+ if(libraryList[libEntry].lib == nullptr || U_FAILURE(*status)) {
/* cleanup. */
- libraryList[libEntry].lib = NULL; /* failure with open */
+ libraryList[libEntry].lib = nullptr; /* failure with open */
libraryList[libEntry].name[0] = 0;
#if UPLUG_TRACE
DBG((stderr, "uplug_openLibrary(%s,%s) libEntry %d, lib %p\n", libName, u_errorName(*status), libEntry, lib));
@@ -252,14 +252,14 @@ static int32_t uplug_pluginNumber(UPlugData* d) {
U_CAPI UPlugData * U_EXPORT2
uplug_nextPlug(UPlugData *prior) {
- if(prior==NULL) {
+ if(prior==nullptr) {
return pluginList;
} else {
UPlugData *nextPlug = &prior[1];
UPlugData *pastPlug = &pluginList[pluginCount];
if(nextPlug>=pastPlug) {
- return NULL;
+ return nullptr;
} else {
return nextPlug;
}
@@ -273,7 +273,7 @@ uplug_nextPlug(UPlugData *prior) {
*/
static void uplug_callPlug(UPlugData *plug, UPlugReason reason, UErrorCode *status) {
UPlugTokenReturn token;
- if(plug==NULL||U_FAILURE(*status)) {
+ if(plug==nullptr||U_FAILURE(*status)) {
return;
}
token = (*(plug->entrypoint))(plug, reason, status);
@@ -330,15 +330,15 @@ static void uplug_loadPlug(UPlugData *plug, UErrorCode *status) {
static UPlugData *uplug_allocateEmptyPlug(UErrorCode *status)
{
- UPlugData *plug = NULL;
+ UPlugData *plug = nullptr;
if(U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
if(pluginCount == UPLUG_PLUGIN_INITIAL_COUNT) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
plug = &pluginList[pluginCount++];
@@ -353,8 +353,8 @@ static UPlugData *uplug_allocateEmptyPlug(UErrorCode *status)
plug->libName[0] = 0;
plug->config[0]=0;
plug->sym[0]=0;
- plug->lib=NULL;
- plug->entrypoint=NULL;
+ plug->lib=nullptr;
+ plug->entrypoint=nullptr;
return plug;
@@ -364,16 +364,16 @@ static UPlugData *uplug_allocatePlug(UPlugEntrypoint *entrypoint, const char *co
UErrorCode *status) {
UPlugData *plug = uplug_allocateEmptyPlug(status);
if(U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
- if(config!=NULL) {
+ if(config!=nullptr) {
uprv_strncpy(plug->config, config, UPLUG_NAME_MAX);
} else {
plug->config[0] = 0;
}
- if(symName!=NULL) {
+ if(symName!=nullptr) {
uprv_strncpy(plug->sym, symName, UPLUG_NAME_MAX);
} else {
plug->sym[0] = 0;
@@ -393,7 +393,7 @@ static void uplug_deallocatePlug(UPlugData *plug, UErrorCode *status) {
uplug_closeLibrary(plug->lib, &subStatus);
#endif
}
- plug->lib = NULL;
+ plug->lib = nullptr;
if(U_SUCCESS(*status) && U_FAILURE(subStatus)) {
*status = subStatus;
}
@@ -410,7 +410,7 @@ static void uplug_deallocatePlug(UPlugData *plug, UErrorCode *status) {
}
static void uplug_doUnloadPlug(UPlugData *plugToRemove, UErrorCode *status) {
- if(plugToRemove != NULL) {
+ if(plugToRemove != nullptr) {
uplug_unloadPlug(plugToRemove, status);
uplug_deallocatePlug(plugToRemove, status);
}
@@ -418,14 +418,14 @@ static void uplug_doUnloadPlug(UPlugData *plugToRemove, UErrorCode *status) {
U_CAPI void U_EXPORT2
uplug_removePlug(UPlugData *plug, UErrorCode *status) {
- UPlugData *cursor = NULL;
- UPlugData *plugToRemove = NULL;
+ UPlugData *cursor = nullptr;
+ UPlugData *plugToRemove = nullptr;
if(U_FAILURE(*status)) return;
- for(cursor=pluginList;cursor!=NULL;) {
+ for(cursor=pluginList;cursor!=nullptr;) {
if(cursor==plug) {
plugToRemove = plug;
- cursor=NULL;
+ cursor=nullptr;
} else {
cursor = uplug_nextPlug(cursor);
}
@@ -481,7 +481,7 @@ uplug_getLibraryName(UPlugData *data, UErrorCode *status) {
#if U_ENABLE_DYLOAD
return uplug_findLibrary(data->lib, status);
#else
- return NULL;
+ return nullptr;
#endif
}
}
@@ -510,7 +510,7 @@ uplug_getConfiguration(UPlugData *data) {
U_CAPI UPlugData* U_EXPORT2
uplug_getPlugInternal(int32_t n) {
if(n <0 || n >= pluginCount) {
- return NULL;
+ return nullptr;
} else {
return &(pluginList[n]);
}
@@ -530,7 +530,7 @@ uplug_getPlugLoadStatus(UPlugData *plug) {
*/
static UPlugData* uplug_initPlugFromEntrypointAndLibrary(UPlugEntrypoint *entrypoint, const char *config, void *lib, const char *sym,
UErrorCode *status) {
- UPlugData *plug = NULL;
+ UPlugData *plug = nullptr;
plug = uplug_allocatePlug(entrypoint, config, lib, sym, status);
@@ -538,13 +538,13 @@ static UPlugData* uplug_initPlugFromEntrypointAndLibrary(UPlugEntrypoint *entryp
return plug;
} else {
uplug_deallocatePlug(plug, status);
- return NULL;
+ return nullptr;
}
}
U_CAPI UPlugData* U_EXPORT2
uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status) {
- UPlugData* plug = uplug_initPlugFromEntrypointAndLibrary(entrypoint, config, NULL, NULL, status);
+ UPlugData* plug = uplug_initPlugFromEntrypointAndLibrary(entrypoint, config, nullptr, nullptr, status);
uplug_loadPlug(plug, status);
return plug;
}
@@ -555,25 +555,25 @@ 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);
- if(U_FAILURE(*status)) return NULL;
+ if(U_FAILURE(*status)) return nullptr;
plug->pluginStatus = loadStatus;
plug->awaitingLoad = false; /* Won't load. */
plug->dontUnload = true; /* cannot unload. */
- if(sym!=NULL) {
+ if(sym!=nullptr) {
uprv_strncpy(plug->sym, sym, UPLUG_NAME_MAX);
}
- if(libName!=NULL) {
+ if(libName!=nullptr) {
uprv_strncpy(plug->libName, libName, UPLUG_NAME_MAX);
}
- if(nameOrError!=NULL) {
+ if(nameOrError!=nullptr) {
uprv_strncpy(plug->name, nameOrError, UPLUG_NAME_MAX);
}
- if(config!=NULL) {
+ if(config!=nullptr) {
uprv_strncpy(plug->config, config, UPLUG_NAME_MAX);
}
@@ -585,39 +585,39 @@ uplug_initErrorPlug(const char *libName, const char *sym, const char *config, co
*/
static UPlugData*
uplug_initPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status) {
- void *lib = NULL;
- UPlugData *plug = NULL;
- if(U_FAILURE(*status)) { return NULL; }
+ void *lib = nullptr;
+ UPlugData *plug = nullptr;
+ if(U_FAILURE(*status)) { return nullptr; }
lib = uplug_openLibrary(libName, status);
- if(lib!=NULL && U_SUCCESS(*status)) {
- UPlugEntrypoint *entrypoint = NULL;
+ if(lib!=nullptr && U_SUCCESS(*status)) {
+ UPlugEntrypoint *entrypoint = nullptr;
entrypoint = (UPlugEntrypoint*)uprv_dlsym_func(lib, sym, status);
- if(entrypoint!=NULL&&U_SUCCESS(*status)) {
+ if(entrypoint!=nullptr&&U_SUCCESS(*status)) {
plug = uplug_initPlugFromEntrypointAndLibrary(entrypoint, config, lib, sym, status);
- if(plug!=NULL&&U_SUCCESS(*status)) {
+ if(plug!=nullptr&&U_SUCCESS(*status)) {
plug->lib = lib; /* plug takes ownership of library */
- lib = NULL; /* library is now owned by plugin. */
+ lib = nullptr; /* library is now owned by plugin. */
}
} else {
UErrorCode subStatus = U_ZERO_ERROR;
- plug = uplug_initErrorPlug(libName,sym,config,"ERROR: Could not load entrypoint",(lib==NULL)?U_MISSING_RESOURCE_ERROR:*status,&subStatus);
+ plug = uplug_initErrorPlug(libName,sym,config,"ERROR: Could not load entrypoint",(lib==nullptr)?U_MISSING_RESOURCE_ERROR:*status,&subStatus);
}
- if(lib!=NULL) { /* still need to close the lib */
+ if(lib!=nullptr) { /* still need to close the lib */
UErrorCode subStatus = U_ZERO_ERROR;
uplug_closeLibrary(lib, &subStatus); /* don't care here */
}
} else {
UErrorCode subStatus = U_ZERO_ERROR;
- plug = uplug_initErrorPlug(libName,sym,config,"ERROR: could not load library",(lib==NULL)?U_MISSING_RESOURCE_ERROR:*status,&subStatus);
+ plug = uplug_initErrorPlug(libName,sym,config,"ERROR: could not load library",(lib==nullptr)?U_MISSING_RESOURCE_ERROR:*status,&subStatus);
}
return plug;
}
U_CAPI UPlugData* U_EXPORT2
uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status) {
- UPlugData *plug = NULL;
- if(U_FAILURE(*status)) { return NULL; }
+ UPlugData *plug = nullptr;
+ if(U_FAILURE(*status)) { return nullptr; }
plug = uplug_initPlugFromLibrary(libName, sym, config, status);
uplug_loadPlug(plug, status);
@@ -632,7 +632,7 @@ U_CAPI UPlugLevel U_EXPORT2 uplug_getCurrentLevel() {
return gCurrentLevel;
}
-static UBool U_CALLCONV uplug_cleanup(void)
+static UBool U_CALLCONV uplug_cleanup()
{
int32_t i;
@@ -712,7 +712,7 @@ uplug_getPluginFile() {
#if U_ENABLE_DYLOAD && !UCONFIG_NO_FILE_IO
return plugin_file;
#else
- return NULL;
+ return nullptr;
#endif
}
@@ -728,7 +728,7 @@ uplug_init(UErrorCode *status) {
const char *env = getenv("ICU_PLUGINS");
if(U_FAILURE(*status)) return;
- if(env != NULL) {
+ if(env != nullptr) {
plugin_dir.append(env, -1, *status);
}
if(U_FAILURE(*status)) return;
@@ -791,7 +791,7 @@ uplug_init(UErrorCode *status) {
#ifdef __MVS__
if (iscics()) /* 12 Nov 2011 JAM */
{
- f = NULL;
+ f = nullptr;
}
else
#endif
@@ -799,9 +799,9 @@ uplug_init(UErrorCode *status) {
f = fopen(pluginFile.data(), "r");
}
- if(f != NULL) {
+ if(f != nullptr) {
char linebuf[1024];
- char *p, *libName=NULL, *symName=NULL, *config=NULL;
+ char *p, *libName=nullptr, *symName=nullptr, *config=nullptr;
int32_t line = 0;
@@ -843,7 +843,7 @@ uplug_init(UErrorCode *status) {
}
/* chop whitespace at the end of the config */
- if(config!=NULL&&*config!=0) {
+ if(config!=nullptr&&*config!=0) {
p = config+strlen(config);
while(p>config&&isspace((int)*(--p))) {
*p=0;
diff --git a/thirdparty/icu4c/common/loadednormalizer2impl.cpp b/thirdparty/icu4c/common/loadednormalizer2impl.cpp
index 24ff629f84..768564edc8 100644
--- a/thirdparty/icu4c/common/loadednormalizer2impl.cpp
+++ b/thirdparty/icu4c/common/loadednormalizer2impl.cpp
@@ -33,7 +33,7 @@ U_NAMESPACE_BEGIN
class LoadedNormalizer2Impl : public Normalizer2Impl {
public:
- LoadedNormalizer2Impl() : memory(NULL), ownedTrie(NULL) {}
+ LoadedNormalizer2Impl() : memory(nullptr), ownedTrie(nullptr) {}
virtual ~LoadedNormalizer2Impl();
void load(const char *packageName, const char *name, UErrorCode &errorCode);
@@ -93,7 +93,7 @@ LoadedNormalizer2Impl::load(const char *packageName, const char *name, UErrorCod
int32_t offset=inIndexes[IX_NORM_TRIE_OFFSET];
int32_t nextOffset=inIndexes[IX_EXTRA_DATA_OFFSET];
ownedTrie=ucptrie_openFromBinary(UCPTRIE_TYPE_FAST, UCPTRIE_VALUE_BITS_16,
- inBytes+offset, nextOffset-offset, NULL,
+ inBytes+offset, nextOffset-offset, nullptr,
&errorCode);
if(U_FAILURE(errorCode)) {
return;
@@ -117,12 +117,12 @@ Norm2AllModes::createInstance(const char *packageName,
const char *name,
UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
- return NULL;
+ return nullptr;
}
LoadedNormalizer2Impl *impl=new LoadedNormalizer2Impl;
- if(impl==NULL) {
+ if(impl==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
impl->load(packageName, name, errorCode);
return createInstance(impl, errorCode);
@@ -143,19 +143,19 @@ static icu::UInitOnce nfkcInitOnce {};
static Norm2AllModes *nfkc_cfSingleton;
static icu::UInitOnce nfkc_cfInitOnce {};
-static UHashtable *cache=NULL;
+static UHashtable *cache=nullptr;
// UInitOnce singleton initialization function
static void U_CALLCONV initSingletons(const char *what, UErrorCode &errorCode) {
#if !NORM2_HARDCODE_NFC_DATA
if (uprv_strcmp(what, "nfc") == 0) {
- nfcSingleton = Norm2AllModes::createInstance(NULL, "nfc", errorCode);
+ nfcSingleton = Norm2AllModes::createInstance(nullptr, "nfc", errorCode);
} else
#endif
if (uprv_strcmp(what, "nfkc") == 0) {
- nfkcSingleton = Norm2AllModes::createInstance(NULL, "nfkc", errorCode);
+ nfkcSingleton = Norm2AllModes::createInstance(nullptr, "nfkc", errorCode);
} else if (uprv_strcmp(what, "nfkc_cf") == 0) {
- nfkc_cfSingleton = Norm2AllModes::createInstance(NULL, "nfkc_cf", errorCode);
+ nfkc_cfSingleton = Norm2AllModes::createInstance(nullptr, "nfkc_cf", errorCode);
} else {
UPRV_UNREACHABLE_EXIT; // Unknown singleton
}
@@ -171,20 +171,20 @@ static void U_CALLCONV deleteNorm2AllModes(void *allModes) {
static UBool U_CALLCONV uprv_loaded_normalizer2_cleanup() {
#if !NORM2_HARDCODE_NFC_DATA
delete nfcSingleton;
- nfcSingleton = NULL;
+ nfcSingleton = nullptr;
nfcInitOnce.reset();
#endif
delete nfkcSingleton;
- nfkcSingleton = NULL;
+ nfkcSingleton = nullptr;
nfkcInitOnce.reset();
delete nfkc_cfSingleton;
- nfkc_cfSingleton = NULL;
+ nfkc_cfSingleton = nullptr;
nfkc_cfInitOnce.reset();
uhash_close(cache);
- cache=NULL;
+ cache=nullptr;
return true;
}
@@ -193,7 +193,7 @@ U_CDECL_END
#if !NORM2_HARDCODE_NFC_DATA
const Norm2AllModes *
Norm2AllModes::getNFCInstance(UErrorCode &errorCode) {
- if(U_FAILURE(errorCode)) { return NULL; }
+ if(U_FAILURE(errorCode)) { return nullptr; }
umtx_initOnce(nfcInitOnce, &initSingletons, "nfc", errorCode);
return nfcSingleton;
}
@@ -201,14 +201,14 @@ Norm2AllModes::getNFCInstance(UErrorCode &errorCode) {
const Norm2AllModes *
Norm2AllModes::getNFKCInstance(UErrorCode &errorCode) {
- if(U_FAILURE(errorCode)) { return NULL; }
+ if(U_FAILURE(errorCode)) { return nullptr; }
umtx_initOnce(nfkcInitOnce, &initSingletons, "nfkc", errorCode);
return nfkcSingleton;
}
const Norm2AllModes *
Norm2AllModes::getNFKC_CFInstance(UErrorCode &errorCode) {
- if(U_FAILURE(errorCode)) { return NULL; }
+ if(U_FAILURE(errorCode)) { return nullptr; }
umtx_initOnce(nfkc_cfInitOnce, &initSingletons, "nfkc_cf", errorCode);
return nfkc_cfSingleton;
}
@@ -217,48 +217,48 @@ Norm2AllModes::getNFKC_CFInstance(UErrorCode &errorCode) {
const Normalizer2 *
Normalizer2::getNFCInstance(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
- return allModes!=NULL ? &allModes->comp : NULL;
+ return allModes!=nullptr ? &allModes->comp : nullptr;
}
const Normalizer2 *
Normalizer2::getNFDInstance(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
- return allModes!=NULL ? &allModes->decomp : NULL;
+ return allModes!=nullptr ? &allModes->decomp : nullptr;
}
const Normalizer2 *Normalizer2Factory::getFCDInstance(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
- return allModes!=NULL ? &allModes->fcd : NULL;
+ return allModes!=nullptr ? &allModes->fcd : nullptr;
}
const Normalizer2 *Normalizer2Factory::getFCCInstance(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
- return allModes!=NULL ? &allModes->fcc : NULL;
+ return allModes!=nullptr ? &allModes->fcc : nullptr;
}
const Normalizer2Impl *
Normalizer2Factory::getNFCImpl(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
- return allModes!=NULL ? allModes->impl : NULL;
+ return allModes!=nullptr ? allModes->impl : nullptr;
}
#endif
const Normalizer2 *
Normalizer2::getNFKCInstance(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFKCInstance(errorCode);
- return allModes!=NULL ? &allModes->comp : NULL;
+ return allModes!=nullptr ? &allModes->comp : nullptr;
}
const Normalizer2 *
Normalizer2::getNFKDInstance(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFKCInstance(errorCode);
- return allModes!=NULL ? &allModes->decomp : NULL;
+ return allModes!=nullptr ? &allModes->decomp : nullptr;
}
const Normalizer2 *
Normalizer2::getNFKCCasefoldInstance(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFKC_CFInstance(errorCode);
- return allModes!=NULL ? &allModes->comp : NULL;
+ return allModes!=nullptr ? &allModes->comp : nullptr;
}
const Normalizer2 *
@@ -267,14 +267,14 @@ Normalizer2::getInstance(const char *packageName,
UNormalization2Mode mode,
UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
- return NULL;
+ return nullptr;
}
- if(name==NULL || *name==0) {
+ if(name==nullptr || *name==0) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
- const Norm2AllModes *allModes=NULL;
- if(packageName==NULL) {
+ const Norm2AllModes *allModes=nullptr;
+ if(packageName==nullptr) {
if(0==uprv_strcmp(name, "nfc")) {
allModes=Norm2AllModes::getNFCInstance(errorCode);
} else if(0==uprv_strcmp(name, "nfkc")) {
@@ -283,34 +283,34 @@ Normalizer2::getInstance(const char *packageName,
allModes=Norm2AllModes::getNFKC_CFInstance(errorCode);
}
}
- if(allModes==NULL && U_SUCCESS(errorCode)) {
+ if(allModes==nullptr && U_SUCCESS(errorCode)) {
{
Mutex lock;
- if(cache!=NULL) {
+ if(cache!=nullptr) {
allModes=(Norm2AllModes *)uhash_get(cache, name);
}
}
- if(allModes==NULL) {
+ if(allModes==nullptr) {
ucln_common_registerCleanup(UCLN_COMMON_LOADED_NORMALIZER2, uprv_loaded_normalizer2_cleanup);
LocalPointer<Norm2AllModes> localAllModes(
Norm2AllModes::createInstance(packageName, name, errorCode));
if(U_SUCCESS(errorCode)) {
Mutex lock;
- if(cache==NULL) {
- cache=uhash_open(uhash_hashChars, uhash_compareChars, NULL, &errorCode);
+ if(cache==nullptr) {
+ cache=uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &errorCode);
if(U_FAILURE(errorCode)) {
- return NULL;
+ return nullptr;
}
uhash_setKeyDeleter(cache, uprv_free);
uhash_setValueDeleter(cache, deleteNorm2AllModes);
}
void *temp=uhash_get(cache, name);
- if(temp==NULL) {
+ if(temp==nullptr) {
int32_t keyLength= static_cast<int32_t>(uprv_strlen(name)+1);
char *nameCopy=(char *)uprv_malloc(keyLength);
- if(nameCopy==NULL) {
+ if(nameCopy==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
uprv_memcpy(nameCopy, name, keyLength);
allModes=localAllModes.getAlias();
@@ -322,7 +322,7 @@ Normalizer2::getInstance(const char *packageName,
}
}
}
- if(allModes!=NULL && U_SUCCESS(errorCode)) {
+ if(allModes!=nullptr && U_SUCCESS(errorCode)) {
switch(mode) {
case UNORM2_COMPOSE:
return &allModes->comp;
@@ -336,13 +336,13 @@ Normalizer2::getInstance(const char *packageName,
break; // do nothing
}
}
- return NULL;
+ return nullptr;
}
const Normalizer2 *
Normalizer2Factory::getInstance(UNormalizationMode mode, UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
- return NULL;
+ return nullptr;
}
switch(mode) {
case UNORM_NFD:
@@ -363,13 +363,13 @@ Normalizer2Factory::getInstance(UNormalizationMode mode, UErrorCode &errorCode)
const Normalizer2Impl *
Normalizer2Factory::getNFKCImpl(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFKCInstance(errorCode);
- return allModes!=NULL ? allModes->impl : NULL;
+ return allModes!=nullptr ? allModes->impl : nullptr;
}
const Normalizer2Impl *
Normalizer2Factory::getNFKC_CFImpl(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFKC_CFInstance(errorCode);
- return allModes!=NULL ? allModes->impl : NULL;
+ return allModes!=nullptr ? allModes->impl : nullptr;
}
U_NAMESPACE_END
diff --git a/thirdparty/icu4c/common/localefallback_data.h b/thirdparty/icu4c/common/localefallback_data.h
index da725de42d..d2eb7eaafd 100644
--- a/thirdparty/icu4c/common/localefallback_data.h
+++ b/thirdparty/icu4c/common/localefallback_data.h
@@ -11,418 +11,1135 @@
//======================================================================
// Default script table
const char scriptCodeChars[] =
- "Aghb\0Ahom\0Arab\0Armi\0Armn\0Avst\0Bamu\0Bass\0Beng\0Brah\0Cakm\0"
- "Cans\0Cari\0Cham\0Cher\0Chrs\0Copt\0Cprt\0Cyrl\0Deva\0Egyp\0Ethi\0"
- "Geor\0Gong\0Gonm\0Goth\0Grek\0Gujr\0Guru\0Hans\0Hant\0Hebr\0Hluw\0"
- "Hmnp\0Ital\0Jpan\0Kali\0Kana\0Kawi\0Khar\0Khmr\0Kits\0Knda\0Kore\0"
- "Lana\0Laoo\0Lepc\0Lina\0Lisu\0Lyci\0Lydi\0Mand\0Mani\0Medf\0Merc\0"
- "Mlym\0Mong\0Mroo\0Mymr\0Narb\0Nkoo\0Nshu\0Ogam\0Olck\0Orkh\0Orya\0"
- "Osge\0Ougr\0Pauc\0Phli\0Phnx\0Plrd\0Prti\0Rohg\0Runr\0Samr\0Sarb\0"
- "Saur\0Sgnw\0Sinh\0Sogd\0Sora\0Soyo\0Syrc\0Tale\0Talu\0Taml\0Tang\0"
- "Tavt\0Telu\0Tfng\0Thaa\0Thai\0Tibt\0Tnsa\0Toto\0Ugar\0Vaii\0Wcho\0"
- "Xpeo\0Xsux\0Yiii\0";
+ "Aghb\0Ahom\0Arab\0Armi\0Armn\0Avst\0Bamu\0Bass\0Batk\0Beng\0Bopo\0"
+ "Brah\0Cakm\0Cans\0Cari\0Cham\0Cher\0Chrs\0Copt\0Cprt\0Cyrl\0Deva\0"
+ "Egyp\0Elym\0Ethi\0Geor\0Gong\0Gonm\0Goth\0Gran\0Grek\0Gujr\0Guru\0"
+ "Hang\0Hani\0Hans\0Hant\0Hebr\0Hluw\0Hmnp\0Ital\0Java\0Jpan\0Kali\0"
+ "Kana\0Kawi\0Khar\0Khmr\0Kits\0Knda\0Kore\0Lana\0Laoo\0Lepc\0Lina\0"
+ "Linb\0Lisu\0Lyci\0Lydi\0Mand\0Mani\0Marc\0Medf\0Merc\0Mlym\0Modi\0"
+ "Mong\0Mroo\0Mtei\0Mymr\0Narb\0Newa\0Nkoo\0Nshu\0Ogam\0Olck\0Orkh\0"
+ "Orya\0Osge\0Ougr\0Pauc\0Phli\0Phnx\0Plrd\0Prti\0Rjng\0Rohg\0Runr\0"
+ "Samr\0Sarb\0Saur\0Sgnw\0Sinh\0Sogd\0Sora\0Soyo\0Syrc\0Tagb\0Takr\0"
+ "Tale\0Talu\0Taml\0Tang\0Tavt\0Telu\0Tfng\0Thaa\0Thai\0Tibt\0Tnsa\0"
+ "Toto\0Ugar\0Vaii\0Wcho\0Xpeo\0Xsux\0Yiii\0";
const char dsLocaleIDChars[] =
- "ab\0abq\0adp\0ady\0ae\0aeb\0aho\0ajt\0akk\0alt\0am\0apc\0apd\0"
- "ar\0arc\0arq\0ars\0ary\0arz\0as\0ase\0av\0avl\0awa\0az_IQ\0az_IR\0"
- "az_RU\0ba\0bal\0bap\0bax\0bcq\0be\0bej\0bfq\0bft\0bfy\0bg\0bgc\0"
- "bgn\0bgx\0bhb\0bhi\0bho\0bji\0bjj\0blt\0bn\0bo\0bpy\0bqi\0bra\0"
- "brh\0brx\0bsq\0bst\0btv\0bua\0byn\0ccp\0ce\0chm\0chr\0cja\0cjm\0"
- "ckb\0cmg\0cop\0cr\0crh\0crk\0crl\0csw\0ctd\0cu\0cv\0dar\0dcc\0"
- "dgl\0dmf\0doi\0drh\0drs\0dty\0dv\0dz\0egy\0eky\0el\0esg\0ett\0"
- "fa\0fia\0fub\0gan\0gbm\0gbz\0gez\0ggn\0gjk\0gju\0glk\0gmv\0gof\0"
- "gom\0gon\0got\0grc\0grt\0gu\0gvr\0gwc\0gwt\0ha_CM\0ha_SD\0hak\0"
- "haz\0hdy\0he\0hi\0hlu\0hmd\0hnd\0hne\0hnj\0hno\0hoc\0hoj\0hsn\0"
- "hy\0ii\0inh\0iu\0iw\0ja\0ji\0jml\0ka\0kaa\0kaw\0kbd\0kby\0kdt\0"
- "kfr\0kfy\0khb\0khn\0kht\0khw\0kjg\0kk\0kk_AF\0kk_CN\0kk_IR\0kk_MN\0"
- "km\0kn\0ko\0koi\0kok\0kqy\0krc\0kru\0ks\0ktb\0ku_LB\0kum\0kv\0"
- "kvx\0kxc\0kxl\0kxm\0kxp\0ky\0ky_CN\0kzh\0lab\0lad\0lah\0lbe\0"
- "lcp\0lep\0lez\0lif\0lis\0lki\0lmn\0lo\0lrc\0luz\0lwl\0lzh\0mag\0"
- "mai\0man_GN\0mde\0mdf\0mdx\0mfa\0mgp\0mk\0mki\0ml\0mn\0mn_CN\0"
- "mni\0mnw\0mr\0mrd\0mrj\0mro\0ms_CC\0mtr\0mvy\0mwr\0mww\0my\0mym\0"
- "myv\0myz\0mzn\0nan\0ne\0new\0nnp\0nod\0noe\0non\0nqo\0nsk\0nst\0"
- "oj\0ojs\0or\0oru\0os\0osa\0ota\0otk\0oui\0pa\0pa_PK\0pal\0peo\0"
- "phl\0phn\0pka\0pnt\0ppa\0pra\0prd\0ps\0raj\0rhg\0rif\0rjs\0rkt\0"
- "rmt\0ru\0rue\0ryu\0sa\0sah\0sat\0saz\0sck\0scl\0sd\0sd_IN\0sdh\0"
- "sga\0sgw\0shi\0shn\0shu\0si\0skr\0smp\0sog\0sou\0sr\0srb\0srx\0"
- "swb\0swv\0syl\0syr\0ta\0taj\0tcy\0tdd\0tdg\0tdh\0te\0tg\0tg_PK\0"
- "th\0thl\0thq\0thr\0ti\0tig\0tkt\0trw\0tsd\0tsf\0tsj\0tt\0tts\0"
- "txg\0txo\0tyv\0udi\0udm\0ug\0ug_KZ\0ug_MN\0uga\0uk\0unr\0unr_NP\0"
- "unx\0ur\0uz_AF\0uz_CN\0vai\0wal\0wbq\0wbr\0wni\0wsg\0wtm\0wuu\0"
- "xco\0xcr\0xlc\0xld\0xmf\0xmn\0xmr\0xna\0xnr\0xpr\0xsa\0xsr\0yi\0"
- "yue\0yue_CN\0zdj\0zgh\0zh\0zh_AU\0zh_BN\0zh_GB\0zh_GF\0zh_HK\0"
- "zh_ID\0zh_MO\0zh_PA\0zh_PF\0zh_PH\0zh_SR\0zh_TH\0zh_TW\0zh_US\0"
- "zh_VN\0zhx\0zkt\0";
+ "aaf\0aao\0aat\0ab\0abh\0abl\0abq\0abv\0acm\0acq\0acw\0acx\0adf\0"
+ "adp\0adx\0ady\0ae\0aeb\0aec\0aee\0aeq\0afb\0agi\0agj\0agx\0ahg\0"
+ "aho\0ahr\0aib\0aij\0ain\0aio\0aiq\0ajp\0ajt\0akk\0akv\0alk\0all\0"
+ "alr\0alt\0alw\0am\0ams\0amw\0ani\0anp\0anr\0anu\0aot\0apc\0apd\0"
+ "aph\0aqc\0ar\0arc\0arq\0ars\0ary\0arz\0as\0ase\0ask\0atn\0atv\0"
+ "auj\0auz\0av\0avd\0avl\0awa\0awn\0axm\0ayh\0ayl\0ayn\0ayp\0az_IQ\0"
+ "az_IR\0az_RU\0azb\0ba\0bal\0bap\0bax\0bbl\0bcq\0bdv\0bdz\0be\0"
+ "bee\0bej\0bfb\0bfq\0bft\0bfu\0bfw\0bfy\0bfz\0bg\0bgc\0bgd\0bgn\0"
+ "bgp\0bgq\0bgw\0bgx\0bha\0bhb\0bhd\0bhe\0bhh\0bhi\0bhj\0bhm\0bhn\0"
+ "bho\0bht\0bhu\0biy\0bjf\0bji\0bjj\0bjm\0blk\0blt\0bmj\0bn\0bns\0"
+ "bo\0bph\0bpx\0bpy\0bqi\0bra\0brb\0brd\0brh\0brk\0brv\0brx\0bsh\0"
+ "bsk\0bsq\0bst\0btd\0btm\0btv\0bua\0bwe\0bxm\0bxu\0byh\0byn\0byw\0"
+ "bzi\0cbn\0ccp\0cde\0cdh\0cdi\0cdj\0cdm\0cdo\0cdz\0ce\0cgk\0chg\0"
+ "chm\0chr\0chx\0cih\0cja\0cji\0cjm\0cjy\0ckb\0ckt\0clh\0clw\0cmg\0"
+ "cna\0cnp\0cog\0cop\0cpg\0cr\0crh\0crj\0crk\0crl\0crm\0csh\0csp\0"
+ "csw\0ctd\0ctg\0ctn\0ctt\0cu\0cuu\0cv\0czh\0czk\0daq\0dar\0dcc\0"
+ "ddo\0def\0deh\0der\0dgl\0dhi\0dhn\0dho\0dhw\0dka\0dlg\0dmf\0dmk\0"
+ "dml\0dng\0dnu\0dnv\0doi\0dox\0dre\0drh\0drq\0drs\0dry\0dso\0dty\0"
+ "dub\0duh\0dus\0dv\0dwk\0dwz\0dz\0dzl\0ecr\0ecy\0egy\0eky\0el\0"
+ "emg\0emu\0enf\0enh\0era\0esg\0esh\0ett\0eve\0evn\0fa\0fay\0faz\0"
+ "fia\0fmu\0fub\0gan\0gaq\0gas\0gau\0gbj\0gbk\0gbl\0gbm\0gbz\0gdb\0"
+ "gdo\0gdx\0gez\0ggg\0ggn\0gha\0ghe\0ghr\0ght\0gig\0gin\0gjk\0gju\0"
+ "gld\0glh\0glk\0gmv\0gmy\0goe\0gof\0gok\0gom\0gon\0got\0gra\0grc\0"
+ "grt\0gru\0gu\0gvr\0gwc\0gwf\0gwt\0gyo\0gzi\0ha_CM\0ha_SD\0hac\0"
+ "hak\0har\0haz\0hbo\0hdy\0he\0hi\0hii\0hit\0hkh\0hlb\0hlu\0hmd\0"
+ "hmj\0hmq\0hnd\0hne\0hnj\0hnj_AU\0hnj_CN\0hnj_FR\0hnj_GF\0hnj_LA\0"
+ "hnj_MM\0hnj_SR\0hnj_TH\0hnj_US\0hnj_VN\0hno\0hoc\0hoh\0hoj\0how\0"
+ "hoy\0hpo\0hrt\0hrz\0hsn\0hss\0htx\0hut\0huy\0huz\0hy\0hyw\0ii\0"
+ "imy\0inh\0int\0ior\0iru\0isk\0itk\0itl\0iu\0iw\0ja\0jad\0jat\0"
+ "jbe\0jbn\0jct\0jda\0jdg\0jdt\0jee\0jge\0ji\0jje\0jkm\0jml\0jna\0"
+ "jnd\0jnl\0jns\0jog\0jpa\0jpr\0jul\0jun\0juy\0jya\0jye\0ka\0kaa\0"
+ "kap\0kaw\0kbd\0kbu\0kby\0kca\0kdq\0kdt\0ket\0kex\0key\0kfa\0kfb\0"
+ "kfc\0kfd\0kfe\0kfh\0kfi\0kfk\0kfm\0kfp\0kfq\0kfr\0kfs\0kfx\0kfy\0"
+ "kgj\0kgy\0khb\0khf\0khg\0khn\0kht\0khv\0khw\0kif\0kim\0kip\0kjg\0"
+ "kjh\0kjl\0kjo\0kjp\0kjt\0kk\0kk_AF\0kk_CN\0kk_IR\0kk_MN\0kkf\0"
+ "kkh\0kkt\0kle\0klj\0klr\0km\0kmj\0kmz\0kn\0ko\0koi\0kok\0kpt\0"
+ "kpy\0kqd\0kqy\0kra\0krc\0krk\0krr\0kru\0krv\0ks\0ksu\0ksw\0ksz\0"
+ "ktb\0ktl\0ktp\0ku_LB\0kuf\0kum\0kv\0kva\0kvq\0kvt\0kvx\0kvy\0"
+ "kxc\0kxf\0kxk\0kxl\0kxm\0kxp\0kxv\0ky\0ky_CN\0kyu\0kyv\0kyw\0"
+ "kzh\0lab\0lad\0lae\0lah\0lbc\0lbe\0lbf\0lbj\0lbm\0lbo\0lbr\0lcp\0"
+ "lep\0lez\0lhm\0lhs\0lif\0lis\0lkh\0lki\0lmh\0lmn\0lo\0loy\0lpo\0"
+ "lrc\0lrk\0lrl\0lsa\0lsd\0lss\0luk\0luu\0luv\0luz\0lwl\0lwm\0lya\0"
+ "lzh\0mag\0mai\0man_GN\0mby\0mde\0mdf\0mdx\0mdy\0mfa\0mfi\0mgp\0"
+ "mhj\0mid\0mjl\0mjq\0mjr\0mjt\0mju\0mjv\0mjz\0mk\0mkb\0mke\0mki\0"
+ "mkm\0ml\0mlf\0mn\0mn_CN\0mni\0mnj\0mns\0mnw\0mpz\0mr\0mra\0mrd\0"
+ "mrj\0mro\0mrr\0ms_CC\0mtm\0mtr\0mud\0muk\0mut\0muv\0muz\0mvf\0"
+ "mvy\0mvz\0mwr\0mwt\0mww\0my\0mym\0myv\0myz\0mzn\0nan\0nao\0ncd\0"
+ "ncq\0ndf\0ne\0neg\0neh\0nei\0new\0ngt\0nio\0nit\0niv\0nli\0nlm\0"
+ "nlx\0nmm\0nnp\0nod\0noe\0nog\0noi\0non\0nos\0npb\0nqo\0nsd\0nsf\0"
+ "nsk\0nst\0nsv\0nty\0ntz\0nwc\0nwx\0nyl\0nyq\0oaa\0oac\0oar\0oav\0"
+ "obm\0obr\0odk\0oht\0oj\0ojs\0okm\0oko\0okz\0ola\0ole\0omk\0omp\0"
+ "omr\0oon\0or\0ort\0oru\0orv\0os\0osa\0osc\0osi\0ota\0otb\0otk\0"
+ "oty\0oui\0pa\0pa_PK\0pal\0paq\0pbt\0pcb\0pce\0pcf\0pcg\0pch\0"
+ "pci\0pcj\0peg\0peo\0pgd\0pgg\0pgl\0pgn\0phd\0phk\0phl\0phn\0pho\0"
+ "phr\0pht\0phv\0phw\0pi\0pka\0pkr\0plk\0pll\0pmh\0pnt\0ppa\0pra\0"
+ "prc\0prd\0prp\0prt\0prx\0ps\0psh\0psi\0pst\0pum\0pwo\0pwr\0pww\0"
+ "pyx\0qxq\0raa\0rab\0raf\0rah\0raj\0rav\0rbb\0rdb\0rei\0rhg\0rji\0"
+ "rjs\0rka\0rki\0rkt\0rmi\0rmt\0rmz\0rsk\0rtw\0ru\0rue\0rut\0rwr\0"
+ "ryu\0sa\0sah\0sam\0sat\0saz\0sbn\0sbu\0sck\0scl\0scp\0sct\0scu\0"
+ "scx\0sd\0sd_IN\0sdb\0sdf\0sdg\0sdh\0sds\0sel\0sfm\0sga\0sgh\0"
+ "sgj\0sgr\0sgt\0sgw\0sgy\0shd\0shi\0shm\0shn\0shu\0shv\0si\0sia\0"
+ "sip\0siy\0siz\0sjd\0sjp\0sjt\0skb\0skj\0skr\0slq\0smh\0smp\0smu\0"
+ "smy\0soa\0sog\0soi\0sou\0spt\0spv\0sqo\0sqq\0sqt\0sr\0srb\0srh\0"
+ "srx\0srz\0ssh\0sss\0sts\0stv\0sty\0suz\0sva\0swb\0swi\0swv\0syc\0"
+ "syl\0syn\0syr\0syw\0ta\0tab\0taj\0tbk\0tcn\0tco\0tcx\0tcy\0tda\0"
+ "tdb\0tdd\0tdg\0tdh\0te\0tes\0tg\0tg_PK\0tge\0tgf\0th\0the\0thf\0"
+ "thi\0thl\0thm\0thq\0thr\0ths\0ti\0tig\0tij\0tin\0tjl\0tjo\0tkb\0"
+ "tks\0tkt\0tmk\0tmr\0tnv\0tov\0tpu\0tra\0trg\0trm\0trw\0tsd\0tsf\0"
+ "tsj\0tt\0tth\0tto\0tts\0tvn\0twm\0txg\0txo\0tyr\0tyv\0ude\0udg\0"
+ "udi\0udm\0ug\0ug_KZ\0ug_MN\0uga\0ugh\0ugo\0uk\0uki\0ulc\0unr\0"
+ "unr_NP\0unx\0ur\0urk\0ush\0uum\0uz_AF\0uz_CN\0uzs\0vaa\0vaf\0"
+ "vah\0vai\0vas\0vav\0vay\0vgr\0vmd\0vmh\0wal\0wbk\0wbq\0wbr\0wlo\0"
+ "wme\0wne\0wni\0wsg\0wsv\0wtm\0wuu\0xal\0xan\0xas\0xco\0xcr\0xdq\0"
+ "xhe\0xhm\0xis\0xka\0xkc\0xkj\0xkp\0xlc\0xld\0xly\0xmf\0xmn\0xmr\0"
+ "xna\0xnr\0xpg\0xpi\0xpm\0xpr\0xrm\0xrn\0xsa\0xsr\0xss\0xub\0xuj\0"
+ "xve\0xvi\0xwo\0xzh\0yai\0ybh\0ybi\0ydg\0yea\0yej\0yeu\0ygp\0yhd\0"
+ "yi\0yig\0yih\0yiv\0ykg\0yna\0ynk\0yoi\0yoy\0yrk\0ysd\0ysn\0ysp\0"
+ "ysr\0ysy\0yud\0yue\0yue_CN\0yug\0yux\0ywq\0ywu\0zau\0zba\0zch\0"
+ "zdj\0zeh\0zen\0zgb\0zgh\0zgm\0zgn\0zh\0zh_AU\0zh_BN\0zh_GB\0zh_GF\0"
+ "zh_HK\0zh_ID\0zh_MO\0zh_PA\0zh_PF\0zh_PH\0zh_SR\0zh_TH\0zh_TW\0"
+ "zh_US\0zh_VN\0zhd\0zhx\0zkb\0zko\0zkt\0zkz\0zlj\0zln\0zlq\0zqe\0"
+ "zrp\0zum\0zyg\0zyn\0zzj\0";
const int32_t defaultScriptTable[] = {
- 0, 90, // ab -> Cyrl
- 3, 90, // abq -> Cyrl
- 7, 465, // adp -> Tibt
- 11, 90, // ady -> Cyrl
- 15, 25, // ae -> Avst
- 18, 10, // aeb -> Arab
- 22, 5, // aho -> Ahom
- 26, 10, // ajt -> Arab
- 30, 500, // akk -> Xsux
- 34, 90, // alt -> Cyrl
- 38, 105, // am -> Ethi
- 41, 10, // apc -> Arab
- 45, 10, // apd -> Arab
- 49, 10, // ar -> Arab
- 52, 15, // arc -> Armi
- 56, 10, // arq -> Arab
- 60, 10, // ars -> Arab
- 64, 10, // ary -> Arab
- 68, 10, // arz -> Arab
- 72, 40, // as -> Beng
- 75, 390, // ase -> Sgnw
- 79, 90, // av -> Cyrl
- 82, 10, // avl -> Arab
- 86, 95, // awa -> Deva
- 90, 10, // az_IQ -> Arab
- 96, 10, // az_IR -> Arab
- 102, 90, // az_RU -> Cyrl
- 108, 90, // ba -> Cyrl
- 111, 10, // bal -> Arab
- 115, 95, // bap -> Deva
- 119, 30, // bax -> Bamu
- 123, 105, // bcq -> Ethi
- 127, 90, // be -> Cyrl
- 130, 10, // bej -> Arab
- 134, 430, // bfq -> Taml
- 138, 10, // bft -> Arab
- 142, 95, // bfy -> Deva
- 146, 90, // bg -> Cyrl
- 149, 95, // bgc -> Deva
- 153, 10, // bgn -> Arab
- 157, 130, // bgx -> Grek
- 161, 95, // bhb -> Deva
- 165, 95, // bhi -> Deva
- 169, 95, // bho -> Deva
- 173, 105, // bji -> Ethi
- 177, 95, // bjj -> Deva
- 181, 440, // blt -> Tavt
- 185, 40, // bn -> Beng
- 188, 465, // bo -> Tibt
- 191, 40, // bpy -> Beng
- 195, 10, // bqi -> Arab
- 199, 95, // bra -> Deva
- 203, 10, // brh -> Arab
- 207, 95, // brx -> Deva
- 211, 35, // bsq -> Bass
- 215, 105, // bst -> Ethi
- 219, 95, // btv -> Deva
- 223, 90, // bua -> Cyrl
- 227, 105, // byn -> Ethi
- 231, 50, // ccp -> Cakm
- 235, 90, // ce -> Cyrl
- 238, 90, // chm -> Cyrl
- 242, 70, // chr -> Cher
- 246, 10, // cja -> Arab
- 250, 65, // cjm -> Cham
- 254, 10, // ckb -> Arab
- 258, 410, // cmg -> Soyo
- 262, 80, // cop -> Copt
- 266, 55, // cr -> Cans
- 269, 90, // crh -> Cyrl
- 273, 55, // crk -> Cans
- 277, 55, // crl -> Cans
- 281, 55, // csw -> Cans
- 285, 340, // ctd -> Pauc
- 289, 90, // cu -> Cyrl
- 292, 90, // cv -> Cyrl
- 295, 90, // dar -> Cyrl
- 299, 10, // dcc -> Arab
- 303, 10, // dgl -> Arab
- 307, 265, // dmf -> Medf
- 311, 95, // doi -> Deva
- 315, 280, // drh -> Mong
- 319, 105, // drs -> Ethi
- 323, 95, // dty -> Deva
- 327, 455, // dv -> Thaa
- 330, 465, // dz -> Tibt
- 333, 100, // egy -> Egyp
- 337, 180, // eky -> Kali
- 341, 130, // el -> Grek
- 344, 120, // esg -> Gonm
- 348, 170, // ett -> Ital
- 352, 10, // fa -> Arab
- 355, 10, // fia -> Arab
- 359, 10, // fub -> Arab
- 363, 145, // gan -> Hans
- 367, 95, // gbm -> Deva
- 371, 10, // gbz -> Arab
- 375, 105, // gez -> Ethi
- 379, 95, // ggn -> Deva
- 383, 10, // gjk -> Arab
- 387, 10, // gju -> Arab
- 391, 10, // glk -> Arab
- 395, 105, // gmv -> Ethi
- 399, 105, // gof -> Ethi
- 403, 95, // gom -> Deva
- 407, 445, // gon -> Telu
- 411, 125, // got -> Goth
- 415, 85, // grc -> Cprt
- 419, 40, // grt -> Beng
- 423, 135, // gu -> Gujr
- 426, 95, // gvr -> Deva
- 430, 10, // gwc -> Arab
- 434, 10, // gwt -> Arab
- 438, 10, // ha_CM -> Arab
- 444, 10, // ha_SD -> Arab
- 450, 145, // hak -> Hans
- 454, 10, // haz -> Arab
- 458, 105, // hdy -> Ethi
- 462, 155, // he -> Hebr
- 465, 95, // hi -> Deva
- 468, 160, // hlu -> Hluw
- 472, 355, // hmd -> Plrd
- 476, 10, // hnd -> Arab
- 480, 95, // hne -> Deva
- 484, 165, // hnj -> Hmnp
- 488, 10, // hno -> Arab
- 492, 95, // hoc -> Deva
- 496, 95, // hoj -> Deva
- 500, 145, // hsn -> Hans
- 504, 20, // hy -> Armn
- 507, 505, // ii -> Yiii
- 510, 90, // inh -> Cyrl
- 514, 55, // iu -> Cans
- 517, 155, // iw -> Hebr
- 520, 175, // ja -> Jpan
- 523, 155, // ji -> Hebr
- 526, 95, // jml -> Deva
- 530, 110, // ka -> Geor
- 533, 90, // kaa -> Cyrl
- 537, 190, // kaw -> Kawi
- 541, 90, // kbd -> Cyrl
- 545, 10, // kby -> Arab
- 549, 460, // kdt -> Thai
- 553, 95, // kfr -> Deva
- 557, 95, // kfy -> Deva
- 561, 425, // khb -> Talu
- 565, 95, // khn -> Deva
- 569, 290, // kht -> Mymr
- 573, 10, // khw -> Arab
- 577, 225, // kjg -> Laoo
- 581, 90, // kk -> Cyrl
- 584, 10, // kk_AF -> Arab
- 590, 10, // kk_CN -> Arab
- 596, 10, // kk_IR -> Arab
- 602, 10, // kk_MN -> Arab
- 608, 200, // km -> Khmr
- 611, 210, // kn -> Knda
- 614, 215, // ko -> Kore
- 617, 90, // koi -> Cyrl
- 621, 95, // kok -> Deva
- 625, 105, // kqy -> Ethi
- 629, 90, // krc -> Cyrl
- 633, 95, // kru -> Deva
- 637, 10, // ks -> Arab
- 640, 105, // ktb -> Ethi
- 644, 10, // ku_LB -> Arab
- 650, 90, // kum -> Cyrl
- 654, 90, // kv -> Cyrl
- 657, 10, // kvx -> Arab
- 661, 105, // kxc -> Ethi
- 665, 95, // kxl -> Deva
- 669, 460, // kxm -> Thai
- 673, 10, // kxp -> Arab
- 677, 90, // ky -> Cyrl
- 680, 10, // ky_CN -> Arab
- 686, 10, // kzh -> Arab
- 690, 235, // lab -> Lina
- 694, 155, // lad -> Hebr
- 698, 10, // lah -> Arab
- 702, 90, // lbe -> Cyrl
- 706, 460, // lcp -> Thai
- 710, 230, // lep -> Lepc
- 714, 90, // lez -> Cyrl
- 718, 95, // lif -> Deva
- 722, 240, // lis -> Lisu
- 726, 10, // lki -> Arab
- 730, 445, // lmn -> Telu
- 734, 225, // lo -> Laoo
- 737, 10, // lrc -> Arab
- 741, 10, // luz -> Arab
- 745, 460, // lwl -> Thai
- 749, 145, // lzh -> Hans
- 753, 95, // mag -> Deva
- 757, 95, // mai -> Deva
- 761, 300, // man_GN -> Nkoo
- 768, 10, // mde -> Arab
- 772, 90, // mdf -> Cyrl
- 776, 105, // mdx -> Ethi
- 780, 10, // mfa -> Arab
- 784, 95, // mgp -> Deva
- 788, 90, // mk -> Cyrl
- 791, 10, // mki -> Arab
- 795, 275, // ml -> Mlym
- 798, 90, // mn -> Cyrl
- 801, 280, // mn_CN -> Mong
- 807, 40, // mni -> Beng
- 811, 290, // mnw -> Mymr
- 815, 95, // mr -> Deva
- 818, 95, // mrd -> Deva
- 822, 90, // mrj -> Cyrl
- 826, 285, // mro -> Mroo
- 830, 10, // ms_CC -> Arab
- 836, 95, // mtr -> Deva
- 840, 10, // mvy -> Arab
- 844, 95, // mwr -> Deva
- 848, 165, // mww -> Hmnp
- 852, 290, // my -> Mymr
- 855, 105, // mym -> Ethi
- 859, 90, // myv -> Cyrl
- 863, 255, // myz -> Mand
- 867, 10, // mzn -> Arab
- 871, 145, // nan -> Hans
- 875, 95, // ne -> Deva
- 878, 95, // new -> Deva
- 882, 490, // nnp -> Wcho
- 886, 220, // nod -> Lana
- 890, 95, // noe -> Deva
- 894, 370, // non -> Runr
- 898, 300, // nqo -> Nkoo
- 902, 55, // nsk -> Cans
- 906, 470, // nst -> Tnsa
- 910, 55, // oj -> Cans
- 913, 55, // ojs -> Cans
- 917, 325, // or -> Orya
- 920, 10, // oru -> Arab
- 924, 90, // os -> Cyrl
- 927, 330, // osa -> Osge
- 931, 10, // ota -> Arab
- 935, 320, // otk -> Orkh
- 939, 335, // oui -> Ougr
- 943, 140, // pa -> Guru
- 946, 10, // pa_PK -> Arab
- 952, 345, // pal -> Phli
- 956, 495, // peo -> Xpeo
- 960, 10, // phl -> Arab
- 964, 350, // phn -> Phnx
- 968, 45, // pka -> Brah
- 972, 130, // pnt -> Grek
- 976, 95, // ppa -> Deva
- 980, 195, // pra -> Khar
- 984, 10, // prd -> Arab
- 988, 10, // ps -> Arab
- 991, 95, // raj -> Deva
- 995, 365, // rhg -> Rohg
- 999, 450, // rif -> Tfng
- 1003, 95, // rjs -> Deva
- 1007, 40, // rkt -> Beng
- 1011, 10, // rmt -> Arab
- 1015, 90, // ru -> Cyrl
- 1018, 90, // rue -> Cyrl
- 1022, 185, // ryu -> Kana
- 1026, 95, // sa -> Deva
- 1029, 90, // sah -> Cyrl
- 1033, 315, // sat -> Olck
- 1037, 385, // saz -> Saur
- 1041, 95, // sck -> Deva
- 1045, 10, // scl -> Arab
- 1049, 10, // sd -> Arab
- 1052, 95, // sd_IN -> Deva
- 1058, 10, // sdh -> Arab
- 1062, 310, // sga -> Ogam
- 1066, 105, // sgw -> Ethi
- 1070, 450, // shi -> Tfng
- 1074, 290, // shn -> Mymr
- 1078, 10, // shu -> Arab
- 1082, 395, // si -> Sinh
- 1085, 10, // skr -> Arab
- 1089, 375, // smp -> Samr
- 1093, 400, // sog -> Sogd
- 1097, 460, // sou -> Thai
- 1101, 90, // sr -> Cyrl
- 1104, 405, // srb -> Sora
- 1108, 95, // srx -> Deva
- 1112, 10, // swb -> Arab
- 1116, 95, // swv -> Deva
- 1120, 40, // syl -> Beng
- 1124, 415, // syr -> Syrc
- 1128, 430, // ta -> Taml
- 1131, 95, // taj -> Deva
- 1135, 210, // tcy -> Knda
- 1139, 420, // tdd -> Tale
- 1143, 95, // tdg -> Deva
- 1147, 95, // tdh -> Deva
- 1151, 445, // te -> Telu
- 1154, 90, // tg -> Cyrl
- 1157, 10, // tg_PK -> Arab
- 1163, 460, // th -> Thai
- 1166, 95, // thl -> Deva
- 1170, 95, // thq -> Deva
- 1174, 95, // thr -> Deva
- 1178, 105, // ti -> Ethi
- 1181, 105, // tig -> Ethi
- 1185, 95, // tkt -> Deva
- 1189, 10, // trw -> Arab
- 1193, 130, // tsd -> Grek
- 1197, 95, // tsf -> Deva
- 1201, 465, // tsj -> Tibt
- 1205, 90, // tt -> Cyrl
- 1208, 460, // tts -> Thai
- 1212, 435, // txg -> Tang
- 1216, 475, // txo -> Toto
- 1220, 90, // tyv -> Cyrl
- 1224, 0, // udi -> Aghb
- 1228, 90, // udm -> Cyrl
- 1232, 10, // ug -> Arab
- 1235, 90, // ug_KZ -> Cyrl
- 1241, 90, // ug_MN -> Cyrl
- 1247, 480, // uga -> Ugar
- 1251, 90, // uk -> Cyrl
- 1254, 40, // unr -> Beng
- 1258, 95, // unr_NP -> Deva
- 1265, 40, // unx -> Beng
- 1269, 10, // ur -> Arab
- 1272, 10, // uz_AF -> Arab
- 1278, 90, // uz_CN -> Cyrl
- 1284, 485, // vai -> Vaii
- 1288, 105, // wal -> Ethi
- 1292, 445, // wbq -> Telu
- 1296, 95, // wbr -> Deva
- 1300, 10, // wni -> Arab
- 1304, 115, // wsg -> Gong
- 1308, 95, // wtm -> Deva
- 1312, 145, // wuu -> Hans
- 1316, 75, // xco -> Chrs
- 1320, 60, // xcr -> Cari
- 1324, 245, // xlc -> Lyci
- 1328, 250, // xld -> Lydi
- 1332, 110, // xmf -> Geor
- 1336, 260, // xmn -> Mani
- 1340, 270, // xmr -> Merc
- 1344, 295, // xna -> Narb
- 1348, 95, // xnr -> Deva
- 1352, 360, // xpr -> Prti
- 1356, 380, // xsa -> Sarb
- 1360, 95, // xsr -> Deva
- 1364, 155, // yi -> Hebr
- 1367, 150, // yue -> Hant
- 1371, 145, // yue_CN -> Hans
- 1378, 10, // zdj -> Arab
- 1382, 450, // zgh -> Tfng
- 1386, 145, // zh -> Hans
- 1389, 150, // zh_AU -> Hant
- 1395, 150, // zh_BN -> Hant
- 1401, 150, // zh_GB -> Hant
- 1407, 150, // zh_GF -> Hant
- 1413, 150, // zh_HK -> Hant
- 1419, 150, // zh_ID -> Hant
- 1425, 150, // zh_MO -> Hant
- 1431, 150, // zh_PA -> Hant
- 1437, 150, // zh_PF -> Hant
- 1443, 150, // zh_PH -> Hant
- 1449, 150, // zh_SR -> Hant
- 1455, 150, // zh_TH -> Hant
- 1461, 150, // zh_TW -> Hant
- 1467, 150, // zh_US -> Hant
- 1473, 150, // zh_VN -> Hant
- 1479, 305, // zhx -> Nshu
- 1483, 205, // zkt -> Kits
+ 0, 320, // aaf -> Mlym
+ 4, 10, // aao -> Arab
+ 8, 150, // aat -> Grek
+ 12, 100, // ab -> Cyrl
+ 15, 10, // abh -> Arab
+ 19, 425, // abl -> Rjng
+ 23, 100, // abq -> Cyrl
+ 27, 10, // abv -> Arab
+ 31, 10, // acm -> Arab
+ 35, 10, // acq -> Arab
+ 39, 10, // acw -> Arab
+ 43, 10, // acx -> Arab
+ 47, 10, // adf -> Arab
+ 51, 540, // adp -> Tibt
+ 55, 540, // adx -> Tibt
+ 59, 100, // ady -> Cyrl
+ 63, 25, // ae -> Avst
+ 66, 10, // aeb -> Arab
+ 70, 10, // aec -> Arab
+ 74, 10, // aee -> Arab
+ 78, 10, // aeq -> Arab
+ 82, 10, // afb -> Arab
+ 86, 105, // agi -> Deva
+ 90, 120, // agj -> Ethi
+ 94, 100, // agx -> Cyrl
+ 98, 120, // ahg -> Ethi
+ 102, 5, // aho -> Ahom
+ 106, 105, // ahr -> Deva
+ 110, 10, // aib -> Arab
+ 114, 185, // aij -> Hebr
+ 118, 220, // ain -> Kana
+ 122, 345, // aio -> Mymr
+ 126, 10, // aiq -> Arab
+ 130, 10, // ajp -> Arab
+ 134, 10, // ajt -> Arab
+ 138, 575, // akk -> Xsux
+ 142, 100, // akv -> Cyrl
+ 146, 260, // alk -> Laoo
+ 150, 320, // all -> Mlym
+ 154, 100, // alr -> Cyrl
+ 158, 100, // alt -> Cyrl
+ 162, 120, // alw -> Ethi
+ 166, 120, // am -> Ethi
+ 169, 210, // ams -> Jpan
+ 173, 480, // amw -> Syrc
+ 177, 100, // ani -> Cyrl
+ 181, 105, // anp -> Deva
+ 185, 105, // anr -> Deva
+ 189, 120, // anu -> Ethi
+ 193, 45, // aot -> Beng
+ 197, 10, // apc -> Arab
+ 201, 10, // apd -> Arab
+ 205, 105, // aph -> Deva
+ 209, 100, // aqc -> Cyrl
+ 213, 10, // ar -> Arab
+ 216, 15, // arc -> Armi
+ 220, 10, // arq -> Arab
+ 224, 10, // ars -> Arab
+ 228, 10, // ary -> Arab
+ 232, 10, // arz -> Arab
+ 236, 45, // as -> Beng
+ 239, 455, // ase -> Sgnw
+ 243, 10, // ask -> Arab
+ 247, 10, // atn -> Arab
+ 251, 100, // atv -> Cyrl
+ 255, 10, // auj -> Arab
+ 259, 10, // auz -> Arab
+ 263, 100, // av -> Cyrl
+ 266, 10, // avd -> Arab
+ 270, 10, // avl -> Arab
+ 274, 105, // awa -> Deva
+ 278, 120, // awn -> Ethi
+ 282, 20, // axm -> Armn
+ 286, 10, // ayh -> Arab
+ 290, 10, // ayl -> Arab
+ 294, 10, // ayn -> Arab
+ 298, 10, // ayp -> Arab
+ 302, 10, // az_IQ -> Arab
+ 308, 10, // az_IR -> Arab
+ 314, 100, // az_RU -> Cyrl
+ 320, 10, // azb -> Arab
+ 324, 100, // ba -> Cyrl
+ 327, 10, // bal -> Arab
+ 331, 105, // bap -> Deva
+ 335, 30, // bax -> Bamu
+ 339, 125, // bbl -> Geor
+ 343, 120, // bcq -> Ethi
+ 347, 385, // bdv -> Orya
+ 351, 10, // bdz -> Arab
+ 355, 100, // be -> Cyrl
+ 358, 105, // bee -> Deva
+ 362, 10, // bej -> Arab
+ 366, 105, // bfb -> Deva
+ 370, 505, // bfq -> Taml
+ 374, 10, // bft -> Arab
+ 378, 540, // bfu -> Tibt
+ 382, 385, // bfw -> Orya
+ 386, 105, // bfy -> Deva
+ 390, 105, // bfz -> Deva
+ 394, 100, // bg -> Cyrl
+ 397, 105, // bgc -> Deva
+ 401, 105, // bgd -> Deva
+ 405, 10, // bgn -> Arab
+ 409, 10, // bgp -> Arab
+ 413, 105, // bgq -> Deva
+ 417, 105, // bgw -> Deva
+ 421, 150, // bgx -> Grek
+ 425, 105, // bha -> Deva
+ 429, 105, // bhb -> Deva
+ 433, 105, // bhd -> Deva
+ 437, 10, // bhe -> Arab
+ 441, 100, // bhh -> Cyrl
+ 445, 105, // bhi -> Deva
+ 449, 105, // bhj -> Deva
+ 453, 10, // bhm -> Arab
+ 457, 480, // bhn -> Syrc
+ 461, 105, // bho -> Deva
+ 465, 490, // bht -> Takr
+ 469, 105, // bhu -> Deva
+ 473, 105, // biy -> Deva
+ 477, 480, // bjf -> Syrc
+ 481, 120, // bji -> Ethi
+ 485, 105, // bjj -> Deva
+ 489, 10, // bjm -> Arab
+ 493, 345, // blk -> Mymr
+ 497, 515, // blt -> Tavt
+ 501, 105, // bmj -> Deva
+ 505, 45, // bn -> Beng
+ 508, 105, // bns -> Deva
+ 512, 540, // bo -> Tibt
+ 515, 100, // bph -> Cyrl
+ 519, 105, // bpx -> Deva
+ 523, 45, // bpy -> Beng
+ 527, 10, // bqi -> Arab
+ 531, 105, // bra -> Deva
+ 535, 235, // brb -> Khmr
+ 539, 105, // brd -> Deva
+ 543, 10, // brh -> Arab
+ 547, 10, // brk -> Arab
+ 551, 260, // brv -> Laoo
+ 555, 105, // brx -> Deva
+ 559, 10, // bsh -> Arab
+ 563, 10, // bsk -> Arab
+ 567, 35, // bsq -> Bass
+ 571, 120, // bst -> Ethi
+ 575, 40, // btd -> Batk
+ 579, 40, // btm -> Batk
+ 583, 105, // btv -> Deva
+ 587, 100, // bua -> Cyrl
+ 591, 345, // bwe -> Mymr
+ 595, 100, // bxm -> Cyrl
+ 599, 330, // bxu -> Mong
+ 603, 105, // byh -> Deva
+ 607, 120, // byn -> Ethi
+ 611, 105, // byw -> Deva
+ 615, 535, // bzi -> Thai
+ 619, 535, // cbn -> Thai
+ 623, 60, // ccp -> Cakm
+ 627, 520, // cde -> Telu
+ 631, 105, // cdh -> Deva
+ 635, 155, // cdi -> Gujr
+ 639, 105, // cdj -> Deva
+ 643, 105, // cdm -> Deva
+ 647, 175, // cdo -> Hans
+ 651, 45, // cdz -> Beng
+ 655, 100, // ce -> Cyrl
+ 658, 540, // cgk -> Tibt
+ 662, 10, // chg -> Arab
+ 666, 100, // chm -> Cyrl
+ 670, 80, // chr -> Cher
+ 674, 105, // chx -> Deva
+ 678, 105, // cih -> Deva
+ 682, 10, // cja -> Arab
+ 686, 100, // cji -> Cyrl
+ 690, 75, // cjm -> Cham
+ 694, 175, // cjy -> Hans
+ 698, 10, // ckb -> Arab
+ 702, 100, // ckt -> Cyrl
+ 706, 10, // clh -> Arab
+ 710, 100, // clw -> Cyrl
+ 714, 475, // cmg -> Soyo
+ 718, 540, // cna -> Tibt
+ 722, 175, // cnp -> Hans
+ 726, 535, // cog -> Thai
+ 730, 90, // cop -> Copt
+ 734, 150, // cpg -> Grek
+ 738, 65, // cr -> Cans
+ 741, 100, // crh -> Cyrl
+ 745, 65, // crj -> Cans
+ 749, 65, // crk -> Cans
+ 753, 65, // crl -> Cans
+ 757, 65, // crm -> Cans
+ 761, 345, // csh -> Mymr
+ 765, 175, // csp -> Hans
+ 769, 65, // csw -> Cans
+ 773, 400, // ctd -> Pauc
+ 777, 45, // ctg -> Beng
+ 781, 105, // ctn -> Deva
+ 785, 505, // ctt -> Taml
+ 789, 100, // cu -> Cyrl
+ 792, 255, // cuu -> Lana
+ 796, 100, // cv -> Cyrl
+ 799, 175, // czh -> Hans
+ 803, 185, // czk -> Hebr
+ 807, 105, // daq -> Deva
+ 811, 100, // dar -> Cyrl
+ 815, 10, // dcc -> Arab
+ 819, 100, // ddo -> Cyrl
+ 823, 10, // def -> Arab
+ 827, 10, // deh -> Arab
+ 831, 45, // der -> Beng
+ 835, 10, // dgl -> Arab
+ 839, 105, // dhi -> Deva
+ 843, 155, // dhn -> Gujr
+ 847, 105, // dho -> Deva
+ 851, 105, // dhw -> Deva
+ 855, 540, // dka -> Tibt
+ 859, 100, // dlg -> Cyrl
+ 863, 310, // dmf -> Medf
+ 867, 10, // dmk -> Arab
+ 871, 10, // dml -> Arab
+ 875, 100, // dng -> Cyrl
+ 879, 345, // dnu -> Mymr
+ 883, 345, // dnv -> Mymr
+ 887, 105, // doi -> Deva
+ 891, 120, // dox -> Ethi
+ 895, 540, // dre -> Tibt
+ 899, 330, // drh -> Mong
+ 903, 105, // drq -> Deva
+ 907, 120, // drs -> Ethi
+ 911, 105, // dry -> Deva
+ 915, 385, // dso -> Orya
+ 919, 105, // dty -> Deva
+ 923, 155, // dub -> Gujr
+ 927, 105, // duh -> Deva
+ 931, 105, // dus -> Deva
+ 935, 530, // dv -> Thaa
+ 938, 385, // dwk -> Orya
+ 942, 105, // dwz -> Deva
+ 946, 540, // dz -> Tibt
+ 949, 540, // dzl -> Tibt
+ 953, 150, // ecr -> Grek
+ 957, 95, // ecy -> Cprt
+ 961, 110, // egy -> Egyp
+ 965, 215, // eky -> Kali
+ 969, 150, // el -> Grek
+ 972, 105, // emg -> Deva
+ 976, 105, // emu -> Deva
+ 980, 100, // enf -> Cyrl
+ 984, 100, // enh -> Cyrl
+ 988, 505, // era -> Taml
+ 992, 135, // esg -> Gonm
+ 996, 10, // esh -> Arab
+ 1000, 200, // ett -> Ital
+ 1004, 100, // eve -> Cyrl
+ 1008, 100, // evn -> Cyrl
+ 1012, 10, // fa -> Arab
+ 1015, 10, // fay -> Arab
+ 1019, 10, // faz -> Arab
+ 1023, 10, // fia -> Arab
+ 1027, 105, // fmu -> Deva
+ 1031, 10, // fub -> Arab
+ 1035, 175, // gan -> Hans
+ 1039, 385, // gaq -> Orya
+ 1043, 155, // gas -> Gujr
+ 1047, 520, // gau -> Telu
+ 1051, 385, // gbj -> Orya
+ 1055, 105, // gbk -> Deva
+ 1059, 155, // gbl -> Gujr
+ 1063, 105, // gbm -> Deva
+ 1067, 10, // gbz -> Arab
+ 1071, 385, // gdb -> Orya
+ 1075, 100, // gdo -> Cyrl
+ 1079, 105, // gdx -> Deva
+ 1083, 120, // gez -> Ethi
+ 1087, 10, // ggg -> Arab
+ 1091, 105, // ggn -> Deva
+ 1095, 10, // gha -> Arab
+ 1099, 105, // ghe -> Deva
+ 1103, 10, // ghr -> Arab
+ 1107, 540, // ght -> Tibt
+ 1111, 10, // gig -> Arab
+ 1115, 100, // gin -> Cyrl
+ 1119, 10, // gjk -> Arab
+ 1123, 10, // gju -> Arab
+ 1127, 100, // gld -> Cyrl
+ 1131, 10, // glh -> Arab
+ 1135, 10, // glk -> Arab
+ 1139, 120, // gmv -> Ethi
+ 1143, 275, // gmy -> Linb
+ 1147, 540, // goe -> Tibt
+ 1151, 120, // gof -> Ethi
+ 1155, 105, // gok -> Deva
+ 1159, 105, // gom -> Deva
+ 1163, 520, // gon -> Telu
+ 1167, 140, // got -> Goth
+ 1171, 105, // gra -> Deva
+ 1175, 95, // grc -> Cprt
+ 1179, 45, // grt -> Beng
+ 1183, 120, // gru -> Ethi
+ 1187, 155, // gu -> Gujr
+ 1190, 105, // gvr -> Deva
+ 1194, 10, // gwc -> Arab
+ 1198, 10, // gwf -> Arab
+ 1202, 10, // gwt -> Arab
+ 1206, 105, // gyo -> Deva
+ 1210, 10, // gzi -> Arab
+ 1214, 10, // ha_CM -> Arab
+ 1220, 10, // ha_SD -> Arab
+ 1226, 10, // hac -> Arab
+ 1230, 175, // hak -> Hans
+ 1234, 120, // har -> Ethi
+ 1238, 10, // haz -> Arab
+ 1242, 185, // hbo -> Hebr
+ 1246, 120, // hdy -> Ethi
+ 1250, 185, // he -> Hebr
+ 1253, 105, // hi -> Deva
+ 1256, 490, // hii -> Takr
+ 1260, 575, // hit -> Xsux
+ 1264, 10, // hkh -> Arab
+ 1268, 105, // hlb -> Deva
+ 1272, 190, // hlu -> Hluw
+ 1276, 415, // hmd -> Plrd
+ 1280, 50, // hmj -> Bopo
+ 1284, 50, // hmq -> Bopo
+ 1288, 10, // hnd -> Arab
+ 1292, 105, // hne -> Deva
+ 1296, 195, // hnj -> Hmnp
+ 1300, 260, // hnj_AU -> Laoo
+ 1307, 260, // hnj_CN -> Laoo
+ 1314, 260, // hnj_FR -> Laoo
+ 1321, 260, // hnj_GF -> Laoo
+ 1328, 260, // hnj_LA -> Laoo
+ 1335, 260, // hnj_MM -> Laoo
+ 1342, 260, // hnj_SR -> Laoo
+ 1349, 260, // hnj_TH -> Laoo
+ 1356, 195, // hnj_US -> Hmnp
+ 1363, 260, // hnj_VN -> Laoo
+ 1370, 10, // hno -> Arab
+ 1374, 105, // hoc -> Deva
+ 1378, 10, // hoh -> Arab
+ 1382, 105, // hoj -> Deva
+ 1386, 170, // how -> Hani
+ 1390, 105, // hoy -> Deva
+ 1394, 345, // hpo -> Mymr
+ 1398, 480, // hrt -> Syrc
+ 1402, 10, // hrz -> Arab
+ 1406, 175, // hsn -> Hans
+ 1410, 10, // hss -> Arab
+ 1414, 575, // htx -> Xsux
+ 1418, 105, // hut -> Deva
+ 1422, 185, // huy -> Hebr
+ 1426, 100, // huz -> Cyrl
+ 1430, 20, // hy -> Armn
+ 1433, 20, // hyw -> Armn
+ 1437, 580, // ii -> Yiii
+ 1440, 285, // imy -> Lyci
+ 1444, 100, // inh -> Cyrl
+ 1448, 345, // int -> Mymr
+ 1452, 120, // ior -> Ethi
+ 1456, 505, // iru -> Taml
+ 1460, 10, // isk -> Arab
+ 1464, 185, // itk -> Hebr
+ 1468, 100, // itl -> Cyrl
+ 1472, 65, // iu -> Cans
+ 1475, 185, // iw -> Hebr
+ 1478, 210, // ja -> Jpan
+ 1481, 10, // jad -> Arab
+ 1485, 10, // jat -> Arab
+ 1489, 185, // jbe -> Hebr
+ 1493, 10, // jbn -> Arab
+ 1497, 100, // jct -> Cyrl
+ 1501, 540, // jda -> Tibt
+ 1505, 10, // jdg -> Arab
+ 1509, 100, // jdt -> Cyrl
+ 1513, 105, // jee -> Deva
+ 1517, 125, // jge -> Geor
+ 1521, 185, // ji -> Hebr
+ 1524, 165, // jje -> Hang
+ 1528, 345, // jkm -> Mymr
+ 1532, 105, // jml -> Deva
+ 1536, 490, // jna -> Takr
+ 1540, 10, // jnd -> Arab
+ 1544, 105, // jnl -> Deva
+ 1548, 105, // jns -> Deva
+ 1552, 10, // jog -> Arab
+ 1556, 185, // jpa -> Hebr
+ 1560, 185, // jpr -> Hebr
+ 1564, 105, // jul -> Deva
+ 1568, 385, // jun -> Orya
+ 1572, 385, // juy -> Orya
+ 1576, 540, // jya -> Tibt
+ 1580, 185, // jye -> Hebr
+ 1584, 125, // ka -> Geor
+ 1587, 100, // kaa -> Cyrl
+ 1591, 100, // kap -> Cyrl
+ 1595, 225, // kaw -> Kawi
+ 1599, 100, // kbd -> Cyrl
+ 1603, 10, // kbu -> Arab
+ 1607, 10, // kby -> Arab
+ 1611, 100, // kca -> Cyrl
+ 1615, 45, // kdq -> Beng
+ 1619, 535, // kdt -> Thai
+ 1623, 100, // ket -> Cyrl
+ 1627, 105, // kex -> Deva
+ 1631, 520, // key -> Telu
+ 1635, 245, // kfa -> Knda
+ 1639, 105, // kfb -> Deva
+ 1643, 520, // kfc -> Telu
+ 1647, 245, // kfd -> Knda
+ 1651, 505, // kfe -> Taml
+ 1655, 320, // kfh -> Mlym
+ 1659, 505, // kfi -> Taml
+ 1663, 105, // kfk -> Deva
+ 1667, 10, // kfm -> Arab
+ 1671, 105, // kfp -> Deva
+ 1675, 105, // kfq -> Deva
+ 1679, 105, // kfr -> Deva
+ 1683, 105, // kfs -> Deva
+ 1687, 105, // kfx -> Deva
+ 1691, 105, // kfy -> Deva
+ 1695, 105, // kgj -> Deva
+ 1699, 105, // kgy -> Deva
+ 1703, 500, // khb -> Talu
+ 1707, 535, // khf -> Thai
+ 1711, 540, // khg -> Tibt
+ 1715, 105, // khn -> Deva
+ 1719, 345, // kht -> Mymr
+ 1723, 100, // khv -> Cyrl
+ 1727, 10, // khw -> Arab
+ 1731, 105, // kif -> Deva
+ 1735, 100, // kim -> Cyrl
+ 1739, 105, // kip -> Deva
+ 1743, 260, // kjg -> Laoo
+ 1747, 100, // kjh -> Cyrl
+ 1751, 105, // kjl -> Deva
+ 1755, 105, // kjo -> Deva
+ 1759, 345, // kjp -> Mymr
+ 1763, 535, // kjt -> Thai
+ 1767, 100, // kk -> Cyrl
+ 1770, 10, // kk_AF -> Arab
+ 1776, 10, // kk_CN -> Arab
+ 1782, 10, // kk_IR -> Arab
+ 1788, 10, // kk_MN -> Arab
+ 1794, 540, // kkf -> Tibt
+ 1798, 255, // kkh -> Lana
+ 1802, 105, // kkt -> Deva
+ 1806, 105, // kle -> Deva
+ 1810, 10, // klj -> Arab
+ 1814, 105, // klr -> Deva
+ 1818, 235, // km -> Khmr
+ 1821, 105, // kmj -> Deva
+ 1825, 10, // kmz -> Arab
+ 1829, 245, // kn -> Knda
+ 1832, 250, // ko -> Kore
+ 1835, 100, // koi -> Cyrl
+ 1839, 105, // kok -> Deva
+ 1843, 100, // kpt -> Cyrl
+ 1847, 100, // kpy -> Cyrl
+ 1851, 480, // kqd -> Syrc
+ 1855, 120, // kqy -> Ethi
+ 1859, 105, // kra -> Deva
+ 1863, 100, // krc -> Cyrl
+ 1867, 100, // krk -> Cyrl
+ 1871, 235, // krr -> Khmr
+ 1875, 105, // kru -> Deva
+ 1879, 235, // krv -> Khmr
+ 1883, 10, // ks -> Arab
+ 1886, 345, // ksu -> Mymr
+ 1890, 345, // ksw -> Mymr
+ 1894, 105, // ksz -> Deva
+ 1898, 120, // ktb -> Ethi
+ 1902, 10, // ktl -> Arab
+ 1906, 415, // ktp -> Plrd
+ 1910, 10, // ku_LB -> Arab
+ 1916, 260, // kuf -> Laoo
+ 1920, 100, // kum -> Cyrl
+ 1924, 100, // kv -> Cyrl
+ 1927, 100, // kva -> Cyrl
+ 1931, 345, // kvq -> Mymr
+ 1935, 345, // kvt -> Mymr
+ 1939, 10, // kvx -> Arab
+ 1943, 215, // kvy -> Kali
+ 1947, 120, // kxc -> Ethi
+ 1951, 345, // kxf -> Mymr
+ 1955, 345, // kxk -> Mymr
+ 1959, 105, // kxl -> Deva
+ 1963, 535, // kxm -> Thai
+ 1967, 10, // kxp -> Arab
+ 1971, 385, // kxv -> Orya
+ 1975, 100, // ky -> Cyrl
+ 1978, 10, // ky_CN -> Arab
+ 1984, 215, // kyu -> Kali
+ 1988, 105, // kyv -> Deva
+ 1992, 105, // kyw -> Deva
+ 1996, 10, // kzh -> Arab
+ 2000, 270, // lab -> Lina
+ 2004, 185, // lad -> Hebr
+ 2008, 105, // lae -> Deva
+ 2012, 10, // lah -> Arab
+ 2016, 280, // lbc -> Lisu
+ 2020, 100, // lbe -> Cyrl
+ 2024, 105, // lbf -> Deva
+ 2028, 540, // lbj -> Tibt
+ 2032, 105, // lbm -> Deva
+ 2036, 260, // lbo -> Laoo
+ 2040, 105, // lbr -> Deva
+ 2044, 535, // lcp -> Thai
+ 2048, 265, // lep -> Lepc
+ 2052, 100, // lez -> Cyrl
+ 2056, 105, // lhm -> Deva
+ 2060, 480, // lhs -> Syrc
+ 2064, 105, // lif -> Deva
+ 2068, 280, // lis -> Lisu
+ 2072, 540, // lkh -> Tibt
+ 2076, 10, // lki -> Arab
+ 2080, 105, // lmh -> Deva
+ 2084, 520, // lmn -> Telu
+ 2088, 260, // lo -> Laoo
+ 2091, 105, // loy -> Deva
+ 2095, 415, // lpo -> Plrd
+ 2099, 10, // lrc -> Arab
+ 2103, 10, // lrk -> Arab
+ 2107, 10, // lrl -> Arab
+ 2111, 10, // lsa -> Arab
+ 2115, 185, // lsd -> Hebr
+ 2119, 10, // lss -> Arab
+ 2123, 540, // luk -> Tibt
+ 2127, 105, // luu -> Deva
+ 2131, 10, // luv -> Arab
+ 2135, 10, // luz -> Arab
+ 2139, 535, // lwl -> Thai
+ 2143, 535, // lwm -> Thai
+ 2147, 540, // lya -> Tibt
+ 2151, 175, // lzh -> Hans
+ 2155, 105, // mag -> Deva
+ 2159, 105, // mai -> Deva
+ 2163, 360, // man_GN -> Nkoo
+ 2170, 10, // mby -> Arab
+ 2174, 10, // mde -> Arab
+ 2178, 100, // mdf -> Cyrl
+ 2182, 120, // mdx -> Ethi
+ 2186, 120, // mdy -> Ethi
+ 2190, 10, // mfa -> Arab
+ 2194, 10, // mfi -> Arab
+ 2198, 105, // mgp -> Deva
+ 2202, 10, // mhj -> Arab
+ 2206, 295, // mid -> Mand
+ 2210, 105, // mjl -> Deva
+ 2214, 320, // mjq -> Mlym
+ 2218, 320, // mjr -> Mlym
+ 2222, 105, // mjt -> Deva
+ 2226, 520, // mju -> Telu
+ 2230, 320, // mjv -> Mlym
+ 2234, 105, // mjz -> Deva
+ 2238, 100, // mk -> Cyrl
+ 2241, 105, // mkb -> Deva
+ 2245, 105, // mke -> Deva
+ 2249, 10, // mki -> Arab
+ 2253, 535, // mkm -> Thai
+ 2257, 320, // ml -> Mlym
+ 2260, 535, // mlf -> Thai
+ 2264, 100, // mn -> Cyrl
+ 2267, 330, // mn_CN -> Mong
+ 2273, 45, // mni -> Beng
+ 2277, 10, // mnj -> Arab
+ 2281, 100, // mns -> Cyrl
+ 2285, 345, // mnw -> Mymr
+ 2289, 535, // mpz -> Thai
+ 2293, 105, // mr -> Deva
+ 2296, 535, // mra -> Thai
+ 2300, 105, // mrd -> Deva
+ 2304, 100, // mrj -> Cyrl
+ 2308, 335, // mro -> Mroo
+ 2312, 105, // mrr -> Deva
+ 2316, 10, // ms_CC -> Arab
+ 2322, 100, // mtm -> Cyrl
+ 2326, 105, // mtr -> Deva
+ 2330, 100, // mud -> Cyrl
+ 2334, 540, // muk -> Tibt
+ 2338, 105, // mut -> Deva
+ 2342, 505, // muv -> Taml
+ 2346, 120, // muz -> Ethi
+ 2350, 330, // mvf -> Mong
+ 2354, 10, // mvy -> Arab
+ 2358, 120, // mvz -> Ethi
+ 2362, 105, // mwr -> Deva
+ 2366, 345, // mwt -> Mymr
+ 2370, 195, // mww -> Hmnp
+ 2374, 345, // my -> Mymr
+ 2377, 120, // mym -> Ethi
+ 2381, 100, // myv -> Cyrl
+ 2385, 295, // myz -> Mand
+ 2389, 10, // mzn -> Arab
+ 2393, 175, // nan -> Hans
+ 2397, 105, // nao -> Deva
+ 2401, 105, // ncd -> Deva
+ 2405, 260, // ncq -> Laoo
+ 2409, 100, // ndf -> Cyrl
+ 2413, 105, // ne -> Deva
+ 2416, 100, // neg -> Cyrl
+ 2420, 540, // neh -> Tibt
+ 2424, 575, // nei -> Xsux
+ 2428, 105, // new -> Deva
+ 2432, 260, // ngt -> Laoo
+ 2436, 100, // nio -> Cyrl
+ 2440, 520, // nit -> Telu
+ 2444, 100, // niv -> Cyrl
+ 2448, 10, // nli -> Arab
+ 2452, 10, // nlm -> Arab
+ 2456, 105, // nlx -> Deva
+ 2460, 105, // nmm -> Deva
+ 2464, 565, // nnp -> Wcho
+ 2468, 255, // nod -> Lana
+ 2472, 105, // noe -> Deva
+ 2476, 100, // nog -> Cyrl
+ 2480, 105, // noi -> Deva
+ 2484, 435, // non -> Runr
+ 2488, 580, // nos -> Yiii
+ 2492, 540, // npb -> Tibt
+ 2496, 360, // nqo -> Nkoo
+ 2500, 580, // nsd -> Yiii
+ 2504, 580, // nsf -> Yiii
+ 2508, 65, // nsk -> Cans
+ 2512, 545, // nst -> Tnsa
+ 2516, 580, // nsv -> Yiii
+ 2520, 580, // nty -> Yiii
+ 2524, 10, // ntz -> Arab
+ 2528, 355, // nwc -> Newa
+ 2532, 105, // nwx -> Deva
+ 2536, 535, // nyl -> Thai
+ 2540, 10, // nyq -> Arab
+ 2544, 100, // oaa -> Cyrl
+ 2548, 100, // oac -> Cyrl
+ 2552, 480, // oar -> Syrc
+ 2556, 125, // oav -> Geor
+ 2560, 410, // obm -> Phnx
+ 2564, 345, // obr -> Mymr
+ 2568, 10, // odk -> Arab
+ 2572, 575, // oht -> Xsux
+ 2576, 65, // oj -> Cans
+ 2579, 65, // ojs -> Cans
+ 2583, 165, // okm -> Hang
+ 2587, 170, // oko -> Hani
+ 2591, 235, // okz -> Khmr
+ 2595, 105, // ola -> Deva
+ 2599, 540, // ole -> Tibt
+ 2603, 100, // omk -> Cyrl
+ 2607, 340, // omp -> Mtei
+ 2611, 325, // omr -> Modi
+ 2615, 105, // oon -> Deva
+ 2619, 385, // or -> Orya
+ 2622, 520, // ort -> Telu
+ 2626, 10, // oru -> Arab
+ 2630, 100, // orv -> Cyrl
+ 2634, 100, // os -> Cyrl
+ 2637, 390, // osa -> Osge
+ 2641, 200, // osc -> Ital
+ 2645, 205, // osi -> Java
+ 2649, 10, // ota -> Arab
+ 2653, 540, // otb -> Tibt
+ 2657, 380, // otk -> Orkh
+ 2661, 145, // oty -> Gran
+ 2665, 395, // oui -> Ougr
+ 2669, 160, // pa -> Guru
+ 2672, 10, // pa_PK -> Arab
+ 2678, 405, // pal -> Phli
+ 2682, 100, // paq -> Cyrl
+ 2686, 10, // pbt -> Arab
+ 2690, 235, // pcb -> Khmr
+ 2694, 345, // pce -> Mymr
+ 2698, 320, // pcf -> Mlym
+ 2702, 320, // pcg -> Mlym
+ 2706, 105, // pch -> Deva
+ 2710, 105, // pci -> Deva
+ 2714, 520, // pcj -> Telu
+ 2718, 385, // peg -> Orya
+ 2722, 570, // peo -> Xpeo
+ 2726, 230, // pgd -> Khar
+ 2730, 105, // pgg -> Deva
+ 2734, 370, // pgl -> Ogam
+ 2738, 200, // pgn -> Ital
+ 2742, 105, // phd -> Deva
+ 2746, 345, // phk -> Mymr
+ 2750, 10, // phl -> Arab
+ 2754, 410, // phn -> Phnx
+ 2758, 260, // pho -> Laoo
+ 2762, 10, // phr -> Arab
+ 2766, 535, // pht -> Thai
+ 2770, 10, // phv -> Arab
+ 2774, 105, // phw -> Deva
+ 2778, 460, // pi -> Sinh
+ 2781, 55, // pka -> Brah
+ 2785, 320, // pkr -> Mlym
+ 2789, 10, // plk -> Arab
+ 2793, 345, // pll -> Mymr
+ 2797, 55, // pmh -> Brah
+ 2801, 150, // pnt -> Grek
+ 2805, 105, // ppa -> Deva
+ 2809, 230, // pra -> Khar
+ 2813, 10, // prc -> Arab
+ 2817, 10, // prd -> Arab
+ 2821, 155, // prp -> Gujr
+ 2825, 535, // prt -> Thai
+ 2829, 10, // prx -> Arab
+ 2833, 10, // ps -> Arab
+ 2836, 10, // psh -> Arab
+ 2840, 10, // psi -> Arab
+ 2844, 10, // pst -> Arab
+ 2848, 105, // pum -> Deva
+ 2852, 345, // pwo -> Mymr
+ 2856, 105, // pwr -> Deva
+ 2860, 535, // pww -> Thai
+ 2864, 345, // pyx -> Mymr
+ 2868, 10, // qxq -> Arab
+ 2872, 105, // raa -> Deva
+ 2876, 105, // rab -> Deva
+ 2880, 105, // raf -> Deva
+ 2884, 45, // rah -> Beng
+ 2888, 105, // raj -> Deva
+ 2892, 105, // rav -> Deva
+ 2896, 345, // rbb -> Mymr
+ 2900, 10, // rdb -> Arab
+ 2904, 385, // rei -> Orya
+ 2908, 430, // rhg -> Rohg
+ 2912, 105, // rji -> Deva
+ 2916, 105, // rjs -> Deva
+ 2920, 235, // rka -> Khmr
+ 2924, 345, // rki -> Mymr
+ 2928, 45, // rkt -> Beng
+ 2932, 20, // rmi -> Armn
+ 2936, 10, // rmt -> Arab
+ 2940, 345, // rmz -> Mymr
+ 2944, 100, // rsk -> Cyrl
+ 2948, 105, // rtw -> Deva
+ 2952, 100, // ru -> Cyrl
+ 2955, 100, // rue -> Cyrl
+ 2959, 100, // rut -> Cyrl
+ 2963, 105, // rwr -> Deva
+ 2967, 220, // ryu -> Kana
+ 2971, 105, // sa -> Deva
+ 2974, 100, // sah -> Cyrl
+ 2978, 440, // sam -> Samr
+ 2982, 375, // sat -> Olck
+ 2986, 450, // saz -> Saur
+ 2990, 10, // sbn -> Arab
+ 2994, 540, // sbu -> Tibt
+ 2998, 105, // sck -> Deva
+ 3002, 10, // scl -> Arab
+ 3006, 105, // scp -> Deva
+ 3010, 260, // sct -> Laoo
+ 3014, 490, // scu -> Takr
+ 3018, 150, // scx -> Grek
+ 3022, 10, // sd -> Arab
+ 3025, 105, // sd_IN -> Deva
+ 3031, 10, // sdb -> Arab
+ 3035, 10, // sdf -> Arab
+ 3039, 10, // sdg -> Arab
+ 3043, 10, // sdh -> Arab
+ 3047, 10, // sds -> Arab
+ 3051, 100, // sel -> Cyrl
+ 3055, 415, // sfm -> Plrd
+ 3059, 370, // sga -> Ogam
+ 3063, 100, // sgh -> Cyrl
+ 3067, 105, // sgj -> Deva
+ 3071, 10, // sgr -> Arab
+ 3075, 540, // sgt -> Tibt
+ 3079, 120, // sgw -> Ethi
+ 3083, 10, // sgy -> Arab
+ 3087, 10, // shd -> Arab
+ 3091, 525, // shi -> Tfng
+ 3095, 10, // shm -> Arab
+ 3099, 345, // shn -> Mymr
+ 3103, 10, // shu -> Arab
+ 3107, 10, // shv -> Arab
+ 3111, 460, // si -> Sinh
+ 3114, 100, // sia -> Cyrl
+ 3118, 540, // sip -> Tibt
+ 3122, 10, // siy -> Arab
+ 3126, 10, // siz -> Arab
+ 3130, 100, // sjd -> Cyrl
+ 3134, 105, // sjp -> Deva
+ 3138, 100, // sjt -> Cyrl
+ 3142, 535, // skb -> Thai
+ 3146, 105, // skj -> Deva
+ 3150, 10, // skr -> Arab
+ 3154, 10, // slq -> Arab
+ 3158, 580, // smh -> Yiii
+ 3162, 440, // smp -> Samr
+ 3166, 235, // smu -> Khmr
+ 3170, 10, // smy -> Arab
+ 3174, 515, // soa -> Tavt
+ 3178, 465, // sog -> Sogd
+ 3182, 105, // soi -> Deva
+ 3186, 535, // sou -> Thai
+ 3190, 540, // spt -> Tibt
+ 3194, 385, // spv -> Orya
+ 3198, 10, // sqo -> Arab
+ 3202, 260, // sqq -> Laoo
+ 3206, 10, // sqt -> Arab
+ 3210, 100, // sr -> Cyrl
+ 3213, 470, // srb -> Sora
+ 3217, 10, // srh -> Arab
+ 3221, 105, // srx -> Deva
+ 3225, 10, // srz -> Arab
+ 3229, 10, // ssh -> Arab
+ 3233, 260, // sss -> Laoo
+ 3237, 10, // sts -> Arab
+ 3241, 120, // stv -> Ethi
+ 3245, 100, // sty -> Cyrl
+ 3249, 105, // suz -> Deva
+ 3253, 125, // sva -> Geor
+ 3257, 10, // swb -> Arab
+ 3261, 170, // swi -> Hani
+ 3265, 105, // swv -> Deva
+ 3269, 480, // syc -> Syrc
+ 3273, 45, // syl -> Beng
+ 3277, 480, // syn -> Syrc
+ 3281, 480, // syr -> Syrc
+ 3285, 105, // syw -> Deva
+ 3289, 505, // ta -> Taml
+ 3292, 100, // tab -> Cyrl
+ 3296, 105, // taj -> Deva
+ 3300, 485, // tbk -> Tagb
+ 3304, 540, // tcn -> Tibt
+ 3308, 345, // tco -> Mymr
+ 3312, 505, // tcx -> Taml
+ 3316, 245, // tcy -> Knda
+ 3320, 525, // tda -> Tfng
+ 3324, 105, // tdb -> Deva
+ 3328, 495, // tdd -> Tale
+ 3332, 105, // tdg -> Deva
+ 3336, 105, // tdh -> Deva
+ 3340, 520, // te -> Telu
+ 3343, 205, // tes -> Java
+ 3347, 100, // tg -> Cyrl
+ 3350, 10, // tg_PK -> Arab
+ 3356, 105, // tge -> Deva
+ 3360, 540, // tgf -> Tibt
+ 3364, 535, // th -> Thai
+ 3367, 105, // the -> Deva
+ 3371, 105, // thf -> Deva
+ 3375, 495, // thi -> Tale
+ 3379, 105, // thl -> Deva
+ 3383, 535, // thm -> Thai
+ 3387, 105, // thq -> Deva
+ 3391, 105, // thr -> Deva
+ 3395, 105, // ths -> Deva
+ 3399, 120, // ti -> Ethi
+ 3402, 120, // tig -> Ethi
+ 3406, 105, // tij -> Deva
+ 3410, 100, // tin -> Cyrl
+ 3414, 345, // tjl -> Mymr
+ 3418, 10, // tjo -> Arab
+ 3422, 105, // tkb -> Deva
+ 3426, 10, // tks -> Arab
+ 3430, 105, // tkt -> Deva
+ 3434, 105, // tmk -> Deva
+ 3438, 480, // tmr -> Syrc
+ 3442, 60, // tnv -> Cakm
+ 3446, 10, // tov -> Arab
+ 3450, 235, // tpu -> Khmr
+ 3454, 10, // tra -> Arab
+ 3458, 185, // trg -> Hebr
+ 3462, 10, // trm -> Arab
+ 3466, 10, // trw -> Arab
+ 3470, 150, // tsd -> Grek
+ 3474, 105, // tsf -> Deva
+ 3478, 540, // tsj -> Tibt
+ 3482, 100, // tt -> Cyrl
+ 3485, 260, // tth -> Laoo
+ 3489, 260, // tto -> Laoo
+ 3493, 535, // tts -> Thai
+ 3497, 345, // tvn -> Mymr
+ 3501, 105, // twm -> Deva
+ 3505, 510, // txg -> Tang
+ 3509, 550, // txo -> Toto
+ 3513, 515, // tyr -> Tavt
+ 3517, 100, // tyv -> Cyrl
+ 3521, 100, // ude -> Cyrl
+ 3525, 320, // udg -> Mlym
+ 3529, 0, // udi -> Aghb
+ 3533, 100, // udm -> Cyrl
+ 3537, 10, // ug -> Arab
+ 3540, 100, // ug_KZ -> Cyrl
+ 3546, 100, // ug_MN -> Cyrl
+ 3552, 555, // uga -> Ugar
+ 3556, 100, // ugh -> Cyrl
+ 3560, 535, // ugo -> Thai
+ 3564, 100, // uk -> Cyrl
+ 3567, 385, // uki -> Orya
+ 3571, 100, // ulc -> Cyrl
+ 3575, 45, // unr -> Beng
+ 3579, 105, // unr_NP -> Deva
+ 3586, 45, // unx -> Beng
+ 3590, 10, // ur -> Arab
+ 3593, 535, // urk -> Thai
+ 3597, 10, // ush -> Arab
+ 3601, 150, // uum -> Grek
+ 3605, 10, // uz_AF -> Arab
+ 3611, 100, // uz_CN -> Cyrl
+ 3617, 10, // uzs -> Arab
+ 3621, 505, // vaa -> Taml
+ 3625, 10, // vaf -> Arab
+ 3629, 105, // vah -> Deva
+ 3633, 560, // vai -> Vaii
+ 3637, 105, // vas -> Deva
+ 3641, 105, // vav -> Deva
+ 3645, 105, // vay -> Deva
+ 3649, 10, // vgr -> Arab
+ 3653, 245, // vmd -> Knda
+ 3657, 10, // vmh -> Arab
+ 3661, 120, // wal -> Ethi
+ 3665, 10, // wbk -> Arab
+ 3669, 520, // wbq -> Telu
+ 3673, 105, // wbr -> Deva
+ 3677, 10, // wlo -> Arab
+ 3681, 105, // wme -> Deva
+ 3685, 10, // wne -> Arab
+ 3689, 10, // wni -> Arab
+ 3693, 130, // wsg -> Gong
+ 3697, 10, // wsv -> Arab
+ 3701, 105, // wtm -> Deva
+ 3705, 175, // wuu -> Hans
+ 3709, 100, // xal -> Cyrl
+ 3713, 120, // xan -> Ethi
+ 3717, 100, // xas -> Cyrl
+ 3721, 85, // xco -> Chrs
+ 3725, 70, // xcr -> Cari
+ 3729, 100, // xdq -> Cyrl
+ 3733, 10, // xhe -> Arab
+ 3737, 235, // xhm -> Khmr
+ 3741, 385, // xis -> Orya
+ 3745, 10, // xka -> Arab
+ 3749, 10, // xkc -> Arab
+ 3753, 10, // xkj -> Arab
+ 3757, 10, // xkp -> Arab
+ 3761, 285, // xlc -> Lyci
+ 3765, 290, // xld -> Lydi
+ 3769, 115, // xly -> Elym
+ 3773, 125, // xmf -> Geor
+ 3777, 300, // xmn -> Mani
+ 3781, 315, // xmr -> Merc
+ 3785, 350, // xna -> Narb
+ 3789, 105, // xnr -> Deva
+ 3793, 150, // xpg -> Grek
+ 3797, 370, // xpi -> Ogam
+ 3801, 100, // xpm -> Cyrl
+ 3805, 420, // xpr -> Prti
+ 3809, 100, // xrm -> Cyrl
+ 3813, 100, // xrn -> Cyrl
+ 3817, 445, // xsa -> Sarb
+ 3821, 105, // xsr -> Deva
+ 3825, 100, // xss -> Cyrl
+ 3829, 505, // xub -> Taml
+ 3833, 505, // xuj -> Taml
+ 3837, 200, // xve -> Ital
+ 3841, 10, // xvi -> Arab
+ 3845, 100, // xwo -> Cyrl
+ 3849, 305, // xzh -> Marc
+ 3853, 100, // yai -> Cyrl
+ 3857, 105, // ybh -> Deva
+ 3861, 105, // ybi -> Deva
+ 3865, 10, // ydg -> Arab
+ 3869, 320, // yea -> Mlym
+ 3873, 150, // yej -> Grek
+ 3877, 520, // yeu -> Telu
+ 3881, 415, // ygp -> Plrd
+ 3885, 185, // yhd -> Hebr
+ 3889, 185, // yi -> Hebr
+ 3892, 580, // yig -> Yiii
+ 3896, 185, // yih -> Hebr
+ 3900, 580, // yiv -> Yiii
+ 3904, 100, // ykg -> Cyrl
+ 3908, 415, // yna -> Plrd
+ 3912, 100, // ynk -> Cyrl
+ 3916, 210, // yoi -> Jpan
+ 3920, 535, // yoy -> Thai
+ 3924, 100, // yrk -> Cyrl
+ 3928, 580, // ysd -> Yiii
+ 3932, 580, // ysn -> Yiii
+ 3936, 580, // ysp -> Yiii
+ 3940, 100, // ysr -> Cyrl
+ 3944, 415, // ysy -> Plrd
+ 3948, 185, // yud -> Hebr
+ 3952, 180, // yue -> Hant
+ 3956, 175, // yue_CN -> Hans
+ 3963, 100, // yug -> Cyrl
+ 3967, 100, // yux -> Cyrl
+ 3971, 415, // ywq -> Plrd
+ 3975, 415, // ywu -> Plrd
+ 3979, 540, // zau -> Tibt
+ 3983, 10, // zba -> Arab
+ 3987, 170, // zch -> Hani
+ 3991, 10, // zdj -> Arab
+ 3995, 170, // zeh -> Hani
+ 3999, 525, // zen -> Tfng
+ 4003, 170, // zgb -> Hani
+ 4007, 525, // zgh -> Tfng
+ 4011, 170, // zgm -> Hani
+ 4015, 170, // zgn -> Hani
+ 4019, 175, // zh -> Hans
+ 4022, 180, // zh_AU -> Hant
+ 4028, 180, // zh_BN -> Hant
+ 4034, 180, // zh_GB -> Hant
+ 4040, 180, // zh_GF -> Hant
+ 4046, 180, // zh_HK -> Hant
+ 4052, 180, // zh_ID -> Hant
+ 4058, 180, // zh_MO -> Hant
+ 4064, 180, // zh_PA -> Hant
+ 4070, 180, // zh_PF -> Hant
+ 4076, 180, // zh_PH -> Hant
+ 4082, 180, // zh_SR -> Hant
+ 4088, 180, // zh_TH -> Hant
+ 4094, 180, // zh_TW -> Hant
+ 4100, 180, // zh_US -> Hant
+ 4106, 180, // zh_VN -> Hant
+ 4112, 170, // zhd -> Hani
+ 4116, 365, // zhx -> Nshu
+ 4120, 100, // zkb -> Cyrl
+ 4124, 100, // zko -> Cyrl
+ 4128, 240, // zkt -> Kits
+ 4132, 100, // zkz -> Cyrl
+ 4136, 170, // zlj -> Hani
+ 4140, 170, // zln -> Hani
+ 4144, 170, // zlq -> Hani
+ 4148, 170, // zqe -> Hani
+ 4152, 185, // zrp -> Hebr
+ 4156, 10, // zum -> Arab
+ 4160, 170, // zyg -> Hani
+ 4164, 170, // zyn -> Hani
+ 4168, 170, // zzj -> Hani
};
//======================================================================
@@ -444,24 +1161,24 @@ const char parentLocaleChars[] =
"es_CU\0es_DO\0es_EC\0es_GT\0es_HN\0es_MX\0es_NI\0es_PA\0es_PE\0"
"es_PR\0es_PY\0es_SV\0es_US\0es_UY\0es_VE\0ff_Adlm\0ff_Arab\0fr_HT\0"
"ha_Arab\0hi_Latn\0ht\0iu_Latn\0kk_Arab\0ks_Deva\0ku_Arab\0ky_Arab\0"
- "ky_Latn\0ml_Arab\0mn_Mong\0mni_Mtei\0ms_Arab\0nb\0nn\0no\0pa_Arab\0"
- "pt_AO\0pt_CH\0pt_CV\0pt_FR\0pt_GQ\0pt_GW\0pt_LU\0pt_MO\0pt_MZ\0"
- "pt_PT\0pt_ST\0pt_TL\0root\0sat_Deva\0sd_Deva\0sd_Khoj\0sd_Sind\0"
- "shi_Latn\0so_Arab\0sr_Latn\0sw_Arab\0tg_Arab\0ug_Cyrl\0uz_Arab\0"
- "uz_Cyrl\0vai_Latn\0wo_Arab\0yo_Arab\0yue_Hans\0zh_Hant\0zh_Hant_HK\0"
- "zh_Hant_MO\0";
+ "ky_Latn\0ml_Arab\0mn_Mong\0mni_Mtei\0ms_Arab\0nb\0nn\0no\0no_NO\0"
+ "pa_Arab\0pt_AO\0pt_CH\0pt_CV\0pt_FR\0pt_GQ\0pt_GW\0pt_LU\0pt_MO\0"
+ "pt_MZ\0pt_PT\0pt_ST\0pt_TL\0root\0sat_Deva\0sd_Deva\0sd_Khoj\0"
+ "sd_Sind\0shi_Latn\0so_Arab\0sr_Latn\0sw_Arab\0tg_Arab\0ug_Cyrl\0"
+ "uz_Arab\0uz_Cyrl\0vai_Latn\0wo_Arab\0yo_Arab\0yue_Hans\0zh_Hant\0"
+ "zh_Hant_HK\0zh_Hant_MO\0";
const int32_t parentLocaleTable[] = {
- 0, 1017, // az_Arab -> root
- 8, 1017, // az_Cyrl -> root
- 16, 1017, // bal_Latn -> root
- 25, 1017, // blt_Latn -> root
- 34, 1017, // bm_Nkoo -> root
- 42, 1017, // bs_Cyrl -> root
- 50, 1017, // byn_Latn -> root
- 59, 1017, // cu_Glag -> root
- 67, 1017, // dje_Arab -> root
- 76, 1017, // dyo_Arab -> root
+ 0, 1023, // az_Arab -> root
+ 8, 1023, // az_Cyrl -> root
+ 16, 1023, // bal_Latn -> root
+ 25, 1023, // blt_Latn -> root
+ 34, 1023, // bm_Nkoo -> root
+ 42, 1023, // bs_Cyrl -> root
+ 50, 1023, // byn_Latn -> root
+ 59, 1023, // cu_Glag -> root
+ 67, 1023, // dje_Arab -> root
+ 76, 1023, // dyo_Arab -> root
92, 85, // en_150 -> en_001
99, 85, // en_AG -> en_001
105, 85, // en_AI -> en_001
@@ -483,7 +1200,7 @@ const int32_t parentLocaleTable[] = {
201, 85, // en_DG -> en_001
207, 92, // en_DK -> en_150
213, 85, // en_DM -> en_001
- 219, 1017, // en_Dsrt -> root
+ 219, 1023, // en_Dsrt -> root
227, 85, // en_ER -> en_001
233, 92, // en_FI -> en_150
239, 85, // en_FJ -> en_001
@@ -542,7 +1259,7 @@ const int32_t parentLocaleTable[] = {
557, 85, // en_SS -> en_001
563, 85, // en_SX -> en_001
569, 85, // en_SZ -> en_001
- 575, 1017, // en_Shaw -> root
+ 575, 1023, // en_Shaw -> root
583, 85, // en_TC -> en_001
589, 85, // en_TK -> en_001
595, 85, // en_TO -> en_001
@@ -579,53 +1296,54 @@ const int32_t parentLocaleTable[] = {
788, 667, // es_US -> es_419
794, 667, // es_UY -> es_419
800, 667, // es_VE -> es_419
- 806, 1017, // ff_Adlm -> root
- 814, 1017, // ff_Arab -> root
- 828, 1017, // ha_Arab -> root
+ 806, 1023, // ff_Adlm -> root
+ 814, 1023, // ff_Arab -> root
+ 828, 1023, // ha_Arab -> root
836, 323, // hi_Latn -> en_IN
844, 822, // ht -> fr_HT
- 847, 1017, // iu_Latn -> root
- 855, 1017, // kk_Arab -> root
- 863, 1017, // ks_Deva -> root
- 871, 1017, // ku_Arab -> root
- 879, 1017, // ky_Arab -> root
- 887, 1017, // ky_Latn -> root
- 895, 1017, // ml_Arab -> root
- 903, 1017, // mn_Mong -> root
- 911, 1017, // mni_Mtei -> root
- 920, 1017, // ms_Arab -> root
+ 847, 1023, // iu_Latn -> root
+ 855, 1023, // kk_Arab -> root
+ 863, 1023, // ks_Deva -> root
+ 871, 1023, // ku_Arab -> root
+ 879, 1023, // ky_Arab -> root
+ 887, 1023, // ky_Latn -> root
+ 895, 1023, // ml_Arab -> root
+ 903, 1023, // mn_Mong -> root
+ 911, 1023, // mni_Mtei -> root
+ 920, 1023, // ms_Arab -> root
928, 934, // nb -> no
931, 934, // nn -> no
- 937, 1017, // pa_Arab -> root
- 945, 999, // pt_AO -> pt_PT
- 951, 999, // pt_CH -> pt_PT
- 957, 999, // pt_CV -> pt_PT
- 963, 999, // pt_FR -> pt_PT
- 969, 999, // pt_GQ -> pt_PT
- 975, 999, // pt_GW -> pt_PT
- 981, 999, // pt_LU -> pt_PT
- 987, 999, // pt_MO -> pt_PT
- 993, 999, // pt_MZ -> pt_PT
- 1005, 999, // pt_ST -> pt_PT
- 1011, 999, // pt_TL -> pt_PT
- 1022, 1017, // sat_Deva -> root
- 1031, 1017, // sd_Deva -> root
- 1039, 1017, // sd_Khoj -> root
- 1047, 1017, // sd_Sind -> root
- 1055, 1017, // shi_Latn -> root
- 1064, 1017, // so_Arab -> root
- 1072, 1017, // sr_Latn -> root
- 1080, 1017, // sw_Arab -> root
- 1088, 1017, // tg_Arab -> root
- 1096, 1017, // ug_Cyrl -> root
- 1104, 1017, // uz_Arab -> root
- 1112, 1017, // uz_Cyrl -> root
- 1120, 1017, // vai_Latn -> root
- 1129, 1017, // wo_Arab -> root
- 1137, 1017, // yo_Arab -> root
- 1145, 1017, // yue_Hans -> root
- 1154, 1017, // zh_Hant -> root
- 1173, 1162, // zh_Hant_MO -> zh_Hant_HK
+ 937, 934, // no_NO -> no
+ 943, 1023, // pa_Arab -> root
+ 951, 1005, // pt_AO -> pt_PT
+ 957, 1005, // pt_CH -> pt_PT
+ 963, 1005, // pt_CV -> pt_PT
+ 969, 1005, // pt_FR -> pt_PT
+ 975, 1005, // pt_GQ -> pt_PT
+ 981, 1005, // pt_GW -> pt_PT
+ 987, 1005, // pt_LU -> pt_PT
+ 993, 1005, // pt_MO -> pt_PT
+ 999, 1005, // pt_MZ -> pt_PT
+ 1011, 1005, // pt_ST -> pt_PT
+ 1017, 1005, // pt_TL -> pt_PT
+ 1028, 1023, // sat_Deva -> root
+ 1037, 1023, // sd_Deva -> root
+ 1045, 1023, // sd_Khoj -> root
+ 1053, 1023, // sd_Sind -> root
+ 1061, 1023, // shi_Latn -> root
+ 1070, 1023, // so_Arab -> root
+ 1078, 1023, // sr_Latn -> root
+ 1086, 1023, // sw_Arab -> root
+ 1094, 1023, // tg_Arab -> root
+ 1102, 1023, // ug_Cyrl -> root
+ 1110, 1023, // uz_Arab -> root
+ 1118, 1023, // uz_Cyrl -> root
+ 1126, 1023, // vai_Latn -> root
+ 1135, 1023, // wo_Arab -> root
+ 1143, 1023, // yo_Arab -> root
+ 1151, 1023, // yue_Hans -> root
+ 1160, 1023, // zh_Hant -> root
+ 1179, 1168, // zh_Hant_MO -> zh_Hant_HK
};
diff --git a/thirdparty/icu4c/common/localematcher.cpp b/thirdparty/icu4c/common/localematcher.cpp
index 2f8664b6f7..5f8c703df7 100644
--- a/thirdparty/icu4c/common/localematcher.cpp
+++ b/thirdparty/icu4c/common/localematcher.cpp
@@ -51,7 +51,7 @@ typedef enum ULocMatchLifetime ULocMatchLifetime;
U_NAMESPACE_BEGIN
-LocaleMatcher::Result::Result(LocaleMatcher::Result &&src) U_NOEXCEPT :
+LocaleMatcher::Result::Result(LocaleMatcher::Result &&src) noexcept :
desiredLocale(src.desiredLocale),
supportedLocale(src.supportedLocale),
desiredIndex(src.desiredIndex),
@@ -70,7 +70,7 @@ LocaleMatcher::Result::~Result() {
}
}
-LocaleMatcher::Result &LocaleMatcher::Result::operator=(LocaleMatcher::Result &&src) U_NOEXCEPT {
+LocaleMatcher::Result &LocaleMatcher::Result::operator=(LocaleMatcher::Result &&src) noexcept {
this->~Result();
desiredLocale = src.desiredLocale;
@@ -122,7 +122,7 @@ Locale LocaleMatcher::Result::makeResolvedLocale(UErrorCode &errorCode) const {
return b.build(errorCode);
}
-LocaleMatcher::Builder::Builder(LocaleMatcher::Builder &&src) U_NOEXCEPT :
+LocaleMatcher::Builder::Builder(LocaleMatcher::Builder &&src) noexcept :
errorCode_(src.errorCode_),
supportedLocales_(src.supportedLocales_),
thresholdDistance_(src.thresholdDistance_),
@@ -142,7 +142,7 @@ LocaleMatcher::Builder::~Builder() {
delete maxDistanceSupported_;
}
-LocaleMatcher::Builder &LocaleMatcher::Builder::operator=(LocaleMatcher::Builder &&src) U_NOEXCEPT {
+LocaleMatcher::Builder &LocaleMatcher::Builder::operator=(LocaleMatcher::Builder &&src) noexcept {
this->~Builder();
errorCode_ = src.errorCode_;
@@ -483,7 +483,7 @@ LocaleMatcher::LocaleMatcher(const Builder &builder, UErrorCode &errorCode) :
}
}
-LocaleMatcher::LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT :
+LocaleMatcher::LocaleMatcher(LocaleMatcher &&src) noexcept :
likelySubtags(src.likelySubtags),
localeDistance(src.localeDistance),
thresholdDistance(src.thresholdDistance),
@@ -520,7 +520,7 @@ LocaleMatcher::~LocaleMatcher() {
delete ownedDefaultLocale;
}
-LocaleMatcher &LocaleMatcher::operator=(LocaleMatcher &&src) U_NOEXCEPT {
+LocaleMatcher &LocaleMatcher::operator=(LocaleMatcher &&src) noexcept {
this->~LocaleMatcher();
thresholdDistance = src.thresholdDistance;
diff --git a/thirdparty/icu4c/common/locavailable.cpp b/thirdparty/icu4c/common/locavailable.cpp
index cf341e1f74..0ea2093988 100644
--- a/thirdparty/icu4c/common/locavailable.cpp
+++ b/thirdparty/icu4c/common/locavailable.cpp
@@ -35,7 +35,7 @@
U_NAMESPACE_BEGIN
-static icu::Locale* availableLocaleList = NULL;
+static icu::Locale* availableLocaleList = nullptr;
static int32_t availableLocaleListCount;
static icu::UInitOnce gInitOnceLocale {};
@@ -43,13 +43,13 @@ U_NAMESPACE_END
U_CDECL_BEGIN
-static UBool U_CALLCONV locale_available_cleanup(void)
+static UBool U_CALLCONV locale_available_cleanup()
{
U_NAMESPACE_USE
if (availableLocaleList) {
delete []availableLocaleList;
- availableLocaleList = NULL;
+ availableLocaleList = nullptr;
}
availableLocaleListCount = 0;
gInitOnceLocale.reset();
@@ -71,7 +71,7 @@ void U_CALLCONV locale_available_init() {
if(availableLocaleListCount) {
availableLocaleList = new Locale[availableLocaleListCount];
}
- if (availableLocaleList == NULL) {
+ if (availableLocaleList == nullptr) {
availableLocaleListCount= 0;
}
for (int32_t locCount=availableLocaleListCount-1; locCount>=0; --locCount) {
@@ -106,7 +106,7 @@ icu::UInitOnce ginstalledLocalesInitOnce {};
class AvailableLocalesSink : public ResourceSink {
public:
- void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) U_OVERRIDE {
+ void put(const char *key, ResourceValue &value, UBool /*noFallback*/, UErrorCode &status) override {
ResourceTable resIndexTable = value.getTable(status);
if (U_FAILURE(status)) {
return;
@@ -196,7 +196,7 @@ class AvailableLocalesStringEnumeration : public StringEnumeration {
/* ### Get available **************************************************/
-static UBool U_CALLCONV uloc_cleanup(void) {
+static UBool U_CALLCONV uloc_cleanup() {
for (int32_t i = 0; i < UPRV_LENGTHOF(gAvailableLocaleNames); i++) {
uprv_free(gAvailableLocaleNames[i]);
gAvailableLocaleNames[i] = nullptr;
@@ -212,7 +212,7 @@ static UBool U_CALLCONV uloc_cleanup(void) {
static void U_CALLCONV loadInstalledLocales(UErrorCode& status) {
ucln_common_registerCleanup(UCLN_COMMON_ULOC, uloc_cleanup);
- icu::LocalUResourceBundlePointer rb(ures_openDirect(NULL, "res_index", &status));
+ icu::LocalUResourceBundlePointer rb(ures_openDirect(nullptr, "res_index", &status));
AvailableLocalesSink sink;
ures_getAllItemsWithFallback(rb.getAlias(), "", sink, status);
}
diff --git a/thirdparty/icu4c/common/locbased.cpp b/thirdparty/icu4c/common/locbased.cpp
index ff378b4cc7..adcf2f843c 100644
--- a/thirdparty/icu4c/common/locbased.cpp
+++ b/thirdparty/icu4c/common/locbased.cpp
@@ -22,7 +22,7 @@ Locale LocaleBased::getLocale(ULocDataLocaleType type, UErrorCode& status) const
const char* LocaleBased::getLocaleID(ULocDataLocaleType type, UErrorCode& status) const {
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
switch(type) {
@@ -32,7 +32,7 @@ const char* LocaleBased::getLocaleID(ULocDataLocaleType type, UErrorCode& status
return actual;
default:
status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
}
diff --git a/thirdparty/icu4c/common/locdispnames.cpp b/thirdparty/icu4c/common/locdispnames.cpp
index 637556cc71..3ec1b81c81 100644
--- a/thirdparty/icu4c/common/locdispnames.cpp
+++ b/thirdparty/icu4c/common/locdispnames.cpp
@@ -55,7 +55,7 @@ Locale::getDisplayLanguage(UnicodeString& dispLang) const
UnicodeString&
Locale::getDisplayLanguage(const Locale &displayLocale,
UnicodeString &result) const {
- UChar *buffer;
+ char16_t *buffer;
UErrorCode errorCode=U_ZERO_ERROR;
int32_t length;
@@ -95,7 +95,7 @@ Locale::getDisplayScript(UnicodeString& dispScript) const
UnicodeString&
Locale::getDisplayScript(const Locale &displayLocale,
UnicodeString &result) const {
- UChar *buffer;
+ char16_t *buffer;
UErrorCode errorCode=U_ZERO_ERROR;
int32_t length;
@@ -135,7 +135,7 @@ Locale::getDisplayCountry(UnicodeString& dispCntry) const
UnicodeString&
Locale::getDisplayCountry(const Locale &displayLocale,
UnicodeString &result) const {
- UChar *buffer;
+ char16_t *buffer;
UErrorCode errorCode=U_ZERO_ERROR;
int32_t length;
@@ -175,7 +175,7 @@ Locale::getDisplayVariant(UnicodeString& dispVar) const
UnicodeString&
Locale::getDisplayVariant(const Locale &displayLocale,
UnicodeString &result) const {
- UChar *buffer;
+ char16_t *buffer;
UErrorCode errorCode=U_ZERO_ERROR;
int32_t length;
@@ -215,7 +215,7 @@ Locale::getDisplayName( UnicodeString& name ) const
UnicodeString&
Locale::getDisplayName(const Locale &displayLocale,
UnicodeString &result) const {
- UChar *buffer;
+ char16_t *buffer;
UErrorCode errorCode=U_ZERO_ERROR;
int32_t length;
@@ -302,12 +302,12 @@ _getStringOrCopyKey(const char *path, const char *locale,
const char* subTableKey,
const char *itemKey,
const char *substitute,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UErrorCode *pErrorCode) {
- const UChar *s = NULL;
+ const char16_t *s = nullptr;
int32_t length = 0;
- if(itemKey==NULL) {
+ if(itemKey==nullptr) {
/* top-level item: normal resource bundle access */
icu::LocalUResourceBundlePointer rb(ures_open(path, locale, pErrorCode));
@@ -318,7 +318,7 @@ _getStringOrCopyKey(const char *path, const char *locale,
} else {
bool isLanguageCode = (uprv_strncmp(tableKey, _kLanguages, 9) == 0);
/* Language code should not be a number. If it is, set the error code. */
- if (isLanguageCode && uprv_strtol(itemKey, NULL, 10)) {
+ if (isLanguageCode && uprv_strtol(itemKey, nullptr, 10)) {
*pErrorCode = U_MISSING_RESOURCE_ERROR;
} else {
/* second-level item, use special fallback */
@@ -344,7 +344,7 @@ _getStringOrCopyKey(const char *path, const char *locale,
if(U_SUCCESS(*pErrorCode)) {
int32_t copyLength=uprv_min(length, destCapacity);
- if(copyLength>0 && s != NULL) {
+ if(copyLength>0 && s != nullptr) {
u_memcpy(dest, s, copyLength);
}
} else {
@@ -362,21 +362,21 @@ typedef int32_t U_CALLCONV UDisplayNameGetter(const char *, char *, int32_t, UE
static int32_t
_getDisplayNameForComponent(const char *locale,
const char *displayLocale,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UDisplayNameGetter *getter,
const char *tag,
UErrorCode *pErrorCode) {
char localeBuffer[ULOC_FULLNAME_CAPACITY*4];
int32_t length;
UErrorCode localStatus;
- const char* root = NULL;
+ const char* root = nullptr;
/* argument checking */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(destCapacity<0 || (destCapacity>0 && dest==NULL)) {
+ if(destCapacity<0 || (destCapacity>0 && dest==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -399,7 +399,7 @@ _getDisplayNameForComponent(const char *locale,
root = tag == _kCountries ? U_ICUDATA_REGION : U_ICUDATA_LANG;
return _getStringOrCopyKey(root, displayLocale,
- tag, NULL, localeBuffer,
+ tag, nullptr, localeBuffer,
localeBuffer,
dest, destCapacity,
pErrorCode);
@@ -408,7 +408,7 @@ _getDisplayNameForComponent(const char *locale,
U_CAPI int32_t U_EXPORT2
uloc_getDisplayLanguage(const char *locale,
const char *displayLocale,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UErrorCode *pErrorCode) {
return _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity,
uloc_getLanguage, _kLanguages, pErrorCode);
@@ -417,7 +417,7 @@ uloc_getDisplayLanguage(const char *locale,
U_CAPI int32_t U_EXPORT2
uloc_getDisplayScript(const char* locale,
const char* displayLocale,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UErrorCode *pErrorCode)
{
UErrorCode err = U_ZERO_ERROR;
@@ -442,7 +442,7 @@ uloc_getDisplayScript(const char* locale,
static int32_t
uloc_getDisplayScriptInContext(const char* locale,
const char* displayLocale,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UErrorCode *pErrorCode)
{
return _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity,
@@ -452,7 +452,7 @@ uloc_getDisplayScriptInContext(const char* locale,
U_CAPI int32_t U_EXPORT2
uloc_getDisplayCountry(const char *locale,
const char *displayLocale,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UErrorCode *pErrorCode) {
return _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity,
uloc_getCountry, _kCountries, pErrorCode);
@@ -466,7 +466,7 @@ uloc_getDisplayCountry(const char *locale,
U_CAPI int32_t U_EXPORT2
uloc_getDisplayVariant(const char *locale,
const char *displayLocale,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UErrorCode *pErrorCode) {
return _getDisplayNameForComponent(locale, displayLocale, dest, destCapacity,
uloc_getVariant, _kVariants, pErrorCode);
@@ -487,14 +487,14 @@ uloc_getDisplayVariant(const char *locale,
U_CAPI int32_t U_EXPORT2
uloc_getDisplayName(const char *locale,
const char *displayLocale,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UErrorCode *pErrorCode)
{
- static const UChar defaultSeparator[9] = { 0x007b, 0x0030, 0x007d, 0x002c, 0x0020, 0x007b, 0x0031, 0x007d, 0x0000 }; /* "{0}, {1}" */
- static const UChar sub0[4] = { 0x007b, 0x0030, 0x007d , 0x0000 } ; /* {0} */
- static const UChar sub1[4] = { 0x007b, 0x0031, 0x007d , 0x0000 } ; /* {1} */
+ static const char16_t defaultSeparator[9] = { 0x007b, 0x0030, 0x007d, 0x002c, 0x0020, 0x007b, 0x0031, 0x007d, 0x0000 }; /* "{0}, {1}" */
+ static const char16_t sub0[4] = { 0x007b, 0x0030, 0x007d , 0x0000 } ; /* {0} */
+ static const char16_t sub1[4] = { 0x007b, 0x0031, 0x007d , 0x0000 } ; /* {1} */
static const int32_t subLen = 3;
- static const UChar defaultPattern[10] = {
+ static const char16_t defaultPattern[10] = {
0x007b, 0x0030, 0x007d, 0x0020, 0x0028, 0x007b, 0x0031, 0x007d, 0x0029, 0x0000
}; /* {0} ({1}) */
static const int32_t defaultPatLen = 9;
@@ -503,16 +503,16 @@ uloc_getDisplayName(const char *locale,
int32_t length; /* of formatted result */
- const UChar *separator;
+ const char16_t *separator;
int32_t sepLen = 0;
- const UChar *pattern;
+ const char16_t *pattern;
int32_t patLen = 0;
int32_t sub0Pos, sub1Pos;
- UChar formatOpenParen = 0x0028; // (
- UChar formatReplaceOpenParen = 0x005B; // [
- UChar formatCloseParen = 0x0029; // )
- UChar formatReplaceCloseParen = 0x005D; // ]
+ char16_t formatOpenParen = 0x0028; // (
+ char16_t formatReplaceOpenParen = 0x005B; // [
+ char16_t formatCloseParen = 0x0029; // )
+ char16_t formatReplaceCloseParen = 0x005D; // ]
UBool haveLang = true; /* assume true, set false if we find we don't have
a lang component in the locale */
@@ -522,11 +522,11 @@ uloc_getDisplayName(const char *locale,
int32_t langi = 0; /* index of the language substitution (0 or 1), virtually always 0 */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(destCapacity<0 || (destCapacity>0 && dest==NULL)) {
+ if(destCapacity<0 || (destCapacity>0 && dest==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -537,7 +537,7 @@ uloc_getDisplayName(const char *locale,
icu::LocalUResourceBundlePointer locbundle(
ures_open(U_ICUDATA_LANG, displayLocale, &status));
icu::LocalUResourceBundlePointer dspbundle(
- ures_getByKeyWithFallback(locbundle.getAlias(), _kLocaleDisplayPattern, NULL, &status));
+ ures_getByKeyWithFallback(locbundle.getAlias(), _kLocaleDisplayPattern, nullptr, &status));
separator=ures_getStringByKeyWithFallback(dspbundle.getAlias(), _kSeparator, &sepLen, &status);
pattern=ures_getStringByKeyWithFallback(dspbundle.getAlias(), _kPattern, &patLen, &status);
@@ -557,13 +557,13 @@ uloc_getDisplayName(const char *locale,
* This is similar to how pattern is handled below.
*/
{
- UChar *p0=u_strstr(separator, sub0);
- UChar *p1=u_strstr(separator, sub1);
- if (p0==NULL || p1==NULL || p1<p0) {
+ char16_t *p0=u_strstr(separator, sub0);
+ char16_t *p1=u_strstr(separator, sub1);
+ if (p0==nullptr || p1==nullptr || p1<p0) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
- separator = (const UChar *)p0 + subLen;
+ separator = (const char16_t *)p0 + subLen;
sepLen = static_cast<int32_t>(p1 - separator);
}
@@ -574,9 +574,9 @@ uloc_getDisplayName(const char *locale,
sub1Pos=defaultSub1Pos;
// use default formatOpenParen etc. set above
} else { /* non-default pattern */
- UChar *p0=u_strstr(pattern, sub0);
- UChar *p1=u_strstr(pattern, sub1);
- if (p0==NULL || p1==NULL) {
+ char16_t *p0=u_strstr(pattern, sub0);
+ char16_t *p1=u_strstr(pattern, sub1);
+ if (p0==nullptr || p1==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -586,7 +586,7 @@ uloc_getDisplayName(const char *locale,
int32_t t=sub0Pos; sub0Pos=sub1Pos; sub1Pos=t;
langi=1;
}
- if (u_strchr(pattern, 0xFF08) != NULL) {
+ if (u_strchr(pattern, 0xFF08) != nullptr) {
formatOpenParen = 0xFF08; // fullwidth (
formatReplaceOpenParen = 0xFF3B; // fullwidth [
formatCloseParen = 0xFF09; // fullwidth )
@@ -602,7 +602,7 @@ uloc_getDisplayName(const char *locale,
* adjust the parameters so padding is not added, and repeat.
*/
do {
- UChar* p=dest;
+ char16_t* p=dest;
int32_t patPos=0; /* position in the pattern, used for non-substitution portions */
int32_t langLen=0; /* length of language substitution */
int32_t langPos=0; /* position in output of language substitution */
@@ -665,7 +665,7 @@ uloc_getDisplayName(const char *locale,
U_FALLTHROUGH;
default: {
const char* kw=uenum_next(kenum.getAlias(), &len, pErrorCode);
- if (kw == NULL) {
+ if (kw == nullptr) {
len=0; /* mark that we didn't add a component */
subdone=true;
} else {
@@ -712,7 +712,7 @@ uloc_getDisplayName(const char *locale,
if (len>0) {
/* we added a component, so add separator and write it if there's room. */
if(len+sepLen<=cap) {
- const UChar * plimit = p + len;
+ const char16_t * plimit = p + len;
for (; p < plimit; p++) {
if (*p == formatOpenParen) {
*p = formatReplaceOpenParen;
@@ -788,24 +788,24 @@ uloc_getDisplayName(const char *locale,
U_CAPI int32_t U_EXPORT2
uloc_getDisplayKeyword(const char* keyword,
const char* displayLocale,
- UChar* dest,
+ char16_t* dest,
int32_t destCapacity,
UErrorCode* status){
/* argument checking */
- if(status==NULL || U_FAILURE(*status)) {
+ if(status==nullptr || U_FAILURE(*status)) {
return 0;
}
- if(destCapacity<0 || (destCapacity>0 && dest==NULL)) {
+ if(destCapacity<0 || (destCapacity>0 && dest==nullptr)) {
*status=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
- /* pass itemKey=NULL to look for a top-level item */
+ /* pass itemKey=nullptr to look for a top-level item */
return _getStringOrCopyKey(U_ICUDATA_LANG, displayLocale,
- _kKeys, NULL,
+ _kKeys, nullptr,
keyword,
keyword,
dest, destCapacity,
@@ -820,17 +820,17 @@ U_CAPI int32_t U_EXPORT2
uloc_getDisplayKeywordValue( const char* locale,
const char* keyword,
const char* displayLocale,
- UChar* dest,
+ char16_t* dest,
int32_t destCapacity,
UErrorCode* status){
/* argument checking */
- if(status==NULL || U_FAILURE(*status)) {
+ if(status==nullptr || U_FAILURE(*status)) {
return 0;
}
- if(destCapacity<0 || (destCapacity>0 && dest==NULL)) {
+ if(destCapacity<0 || (destCapacity>0 && dest==nullptr)) {
*status=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -849,14 +849,14 @@ uloc_getDisplayKeywordValue( const char* locale,
if(uprv_stricmp(keyword, _kCurrency)==0){
int32_t dispNameLen = 0;
- const UChar *dispName = NULL;
+ const char16_t *dispName = nullptr;
icu::LocalUResourceBundlePointer bundle(
ures_open(U_ICUDATA_CURR, displayLocale, status));
icu::LocalUResourceBundlePointer currencies(
- ures_getByKey(bundle.getAlias(), _kCurrencies, NULL, status));
+ ures_getByKey(bundle.getAlias(), _kCurrencies, nullptr, status));
icu::LocalUResourceBundlePointer currency(
- ures_getByKeyWithFallback(currencies.getAlias(), keywordValue.data(), NULL, status));
+ ures_getByKeyWithFallback(currencies.getAlias(), keywordValue.data(), nullptr, status));
dispName = ures_getStringByIndex(currency.getAlias(), UCURRENCY_DISPLAY_NAME_INDEX, &dispNameLen, status);
@@ -869,8 +869,8 @@ uloc_getDisplayKeywordValue( const char* locale,
}
}
- /* now copy the dispName over if not NULL */
- if(dispName != NULL){
+ /* now copy the dispName over if not nullptr */
+ if(dispName != nullptr){
if(dispNameLen <= destCapacity){
u_memcpy(dest, dispName, dispNameLen);
return u_terminateUChars(dest, destCapacity, dispNameLen, status);
diff --git a/thirdparty/icu4c/common/locdspnm.cpp b/thirdparty/icu4c/common/locdspnm.cpp
index 401f1fecbf..73fe531c54 100644
--- a/thirdparty/icu4c/common/locdspnm.cpp
+++ b/thirdparty/icu4c/common/locdspnm.cpp
@@ -40,7 +40,7 @@ static int32_t ncat(char *buffer, uint32_t buflen, ...) {
char *p = buffer;
const char* e = buffer + buflen - 1;
- if (buffer == NULL || buflen < 1) {
+ if (buffer == nullptr || buflen < 1) {
return -1;
}
@@ -86,16 +86,16 @@ public:
inline UnicodeString &
ICUDataTable::get(const char* tableKey, const char* itemKey, UnicodeString& result) const {
- return get(tableKey, NULL, itemKey, result);
+ return get(tableKey, nullptr, itemKey, result);
}
inline UnicodeString &
ICUDataTable::getNoFallback(const char* tableKey, const char* itemKey, UnicodeString& result) const {
- return getNoFallback(tableKey, NULL, itemKey, result);
+ return getNoFallback(tableKey, nullptr, itemKey, result);
}
ICUDataTable::ICUDataTable(const char* path, const Locale& locale)
- : path(NULL), locale(Locale::getRoot())
+ : path(nullptr), locale(Locale::getRoot())
{
if (path) {
int32_t len = static_cast<int32_t>(uprv_strlen(path));
@@ -110,7 +110,7 @@ ICUDataTable::ICUDataTable(const char* path, const Locale& locale)
ICUDataTable::~ICUDataTable() {
if (path) {
uprv_free((void*) path);
- path = NULL;
+ path = nullptr;
}
}
@@ -125,7 +125,7 @@ ICUDataTable::get(const char* tableKey, const char* subTableKey, const char* ite
UErrorCode status = U_ZERO_ERROR;
int32_t len = 0;
- const UChar *s = uloc_getTableStringWithFallback(path, locale.getName(),
+ const char16_t *s = uloc_getTableStringWithFallback(path, locale.getName(),
tableKey, subTableKey, itemKey,
&len, &status);
if (U_SUCCESS(status) && len > 0) {
@@ -140,7 +140,7 @@ ICUDataTable::getNoFallback(const char* tableKey, const char* subTableKey, const
UErrorCode status = U_ZERO_ERROR;
int32_t len = 0;
- const UChar *s = uloc_getTableStringWithFallback(path, locale.getName(),
+ const char16_t *s = uloc_getTableStringWithFallback(path, locale.getName(),
tableKey, subTableKey, itemKey,
&len, &status);
if (U_SUCCESS(status)) {
@@ -347,7 +347,7 @@ private:
UnicodeString& keyDisplayName(const char* key, UnicodeString& result, UBool skipAdjust) const;
UnicodeString& keyValueDisplayName(const char* key, const char* value,
UnicodeString& result, UBool skipAdjust) const;
- void initialize(void);
+ void initialize();
struct CapitalizationContextSink;
};
@@ -358,7 +358,7 @@ LocaleDisplayNamesImpl::LocaleDisplayNamesImpl(const Locale& locale,
, langData(U_ICUDATA_LANG, locale)
, regionData(U_ICUDATA_REGION, locale)
, capitalizationContext(UDISPCTX_CAPITALIZATION_NONE)
- , capitalizationBrkIter(NULL)
+ , capitalizationBrkIter(nullptr)
, nameLength(UDISPCTX_LENGTH_FULL)
, substitute(UDISPCTX_SUBSTITUTE)
{
@@ -371,7 +371,7 @@ LocaleDisplayNamesImpl::LocaleDisplayNamesImpl(const Locale& locale,
, langData(U_ICUDATA_LANG, locale)
, regionData(U_ICUDATA_REGION, locale)
, capitalizationContext(UDISPCTX_CAPITALIZATION_NONE)
- , capitalizationBrkIter(NULL)
+ , capitalizationBrkIter(nullptr)
, nameLength(UDISPCTX_LENGTH_FULL)
, substitute(UDISPCTX_SUBSTITUTE)
{
@@ -447,7 +447,7 @@ struct LocaleDisplayNamesImpl::CapitalizationContextSink : public ResourceSink {
LocaleDisplayNamesImpl::CapitalizationContextSink::~CapitalizationContextSink() {}
void
-LocaleDisplayNamesImpl::initialize(void) {
+LocaleDisplayNamesImpl::initialize() {
LocaleDisplayNamesImpl *nonConstThis = (LocaleDisplayNamesImpl *)this;
nonConstThis->locale = langData.getLocale() == Locale::getRoot()
? regionData.getLocale()
@@ -467,16 +467,16 @@ LocaleDisplayNamesImpl::initialize(void) {
pattern = UnicodeString("{0} ({1})", -1, US_INV);
}
format.applyPatternMinMaxArguments(pattern, 2, 2, status);
- if (pattern.indexOf((UChar)0xFF08) >= 0) {
- formatOpenParen.setTo((UChar)0xFF08); // fullwidth (
- formatReplaceOpenParen.setTo((UChar)0xFF3B); // fullwidth [
- formatCloseParen.setTo((UChar)0xFF09); // fullwidth )
- formatReplaceCloseParen.setTo((UChar)0xFF3D); // fullwidth ]
+ if (pattern.indexOf((char16_t)0xFF08) >= 0) {
+ formatOpenParen.setTo((char16_t)0xFF08); // fullwidth (
+ formatReplaceOpenParen.setTo((char16_t)0xFF3B); // fullwidth [
+ formatCloseParen.setTo((char16_t)0xFF09); // fullwidth )
+ formatReplaceCloseParen.setTo((char16_t)0xFF3D); // fullwidth ]
} else {
- formatOpenParen.setTo((UChar)0x0028); // (
- formatReplaceOpenParen.setTo((UChar)0x005B); // [
- formatCloseParen.setTo((UChar)0x0029); // )
- formatReplaceCloseParen.setTo((UChar)0x005D); // ]
+ formatOpenParen.setTo((char16_t)0x0028); // (
+ formatReplaceOpenParen.setTo((char16_t)0x005B); // [
+ formatCloseParen.setTo((char16_t)0x0029); // )
+ formatReplaceCloseParen.setTo((char16_t)0x005D); // ]
}
UnicodeString ktPattern;
@@ -492,7 +492,7 @@ LocaleDisplayNamesImpl::initialize(void) {
// Also check whether we will need a break iterator (depends on the data)
UBool needBrkIter = false;
if (capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU || capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_STANDALONE) {
- LocalUResourceBundlePointer resource(ures_open(NULL, locale.getName(), &status));
+ LocalUResourceBundlePointer resource(ures_open(nullptr, locale.getName(), &status));
if (U_FAILURE(status)) { return; }
CapitalizationContextSink sink(*this);
ures_getAllItemsWithFallback(resource.getAlias(), "contextTransforms", sink, status);
@@ -510,7 +510,7 @@ LocaleDisplayNamesImpl::initialize(void) {
capitalizationBrkIter = BreakIterator::createSentenceInstance(locale, status);
if (U_FAILURE(status)) {
delete capitalizationBrkIter;
- capitalizationBrkIter = NULL;
+ capitalizationBrkIter = nullptr;
}
}
#endif
@@ -554,7 +554,7 @@ LocaleDisplayNamesImpl::adjustForUsageAndContext(CapContextUsage usage,
UnicodeString& result) const {
#if !UCONFIG_NO_BREAK_ITERATION
// check to see whether we need to titlecase result
- if ( result.length() > 0 && u_islower(result.char32At(0)) && capitalizationBrkIter!= NULL &&
+ if ( result.length() > 0 && u_islower(result.char32At(0)) && capitalizationBrkIter!= nullptr &&
( 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;
@@ -660,7 +660,7 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
UnicodeString temp2;
char value[ULOC_KEYWORD_AND_VALUES_CAPACITY]; // sigh, no ULOC_VALUE_CAPACITY
const char* key;
- while ((key = e->next((int32_t *)0, status)) != NULL) {
+ while ((key = e->next((int32_t *)0, status)) != nullptr) {
value[0] = 0;
loc.getKeywordValue(key, value, ULOC_KEYWORD_AND_VALUES_CAPACITY, status);
if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING) {
@@ -680,7 +680,7 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
appendWithSep(resultRemainder, temp3);
} else {
appendWithSep(resultRemainder, temp)
- .append((UChar)0x3d /* = */)
+ .append((char16_t)0x3d /* = */)
.append(temp2);
}
}
@@ -702,7 +702,7 @@ LocaleDisplayNamesImpl::appendWithSep(UnicodeString& buffer, const UnicodeString
} else {
const UnicodeString *values[2] = { &buffer, &src };
UErrorCode status = U_ZERO_ERROR;
- separatorFormat.formatAndReplace(values, 2, buffer, NULL, 0, status);
+ separatorFormat.formatAndReplace(values, 2, buffer, nullptr, 0, status);
}
return buffer;
}
@@ -724,7 +724,7 @@ LocaleDisplayNamesImpl::localeIdName(const char* localeId,
}
}
langData.getNoFallback("Languages", localeId, result);
- if (result.isBogus() && uprv_strchr(localeId, '_') == NULL) {
+ if (result.isBogus() && uprv_strchr(localeId, '_') == nullptr) {
// Canonicalize lang and try again, ICU-20870
// (only for language codes without script or region)
Locale canonLocale = Locale::createCanonical(localeId);
@@ -747,7 +747,7 @@ LocaleDisplayNamesImpl::localeIdName(const char* localeId,
UnicodeString&
LocaleDisplayNamesImpl::languageDisplayName(const char* lang,
UnicodeString& result) const {
- if (uprv_strcmp("root", lang) == 0 || uprv_strchr(lang, '_') != NULL) {
+ if (uprv_strcmp("root", lang) == 0 || uprv_strchr(lang, '_') != nullptr) {
return result = UnicodeString(lang, -1, US_INV);
}
if (nameLength == UDISPCTX_LENGTH_SHORT) {
@@ -879,7 +879,7 @@ LocaleDisplayNamesImpl::keyValueDisplayName(const char* key,
UErrorCode sts = U_ZERO_ERROR;
UnicodeString ustrValue(value, -1, US_INV);
int32_t len;
- const UChar *currencyName = ucurr_getName(ustrValue.getTerminatedBuffer(),
+ const char16_t *currencyName = ucurr_getName(ustrValue.getTerminatedBuffer(),
locale.getBaseName(), UCURR_LONG_NAME, nullptr /* isChoiceFormat */, &len, &sts);
if (U_FAILURE(sts)) {
// Return the value as is on failure
@@ -922,7 +922,7 @@ LocaleDisplayNames::createInstance(const Locale& locale,
LocaleDisplayNames*
LocaleDisplayNames::createInstance(const Locale& locale,
UDisplayContext *contexts, int32_t length) {
- if (contexts == NULL) {
+ if (contexts == nullptr) {
length = 0;
}
return new LocaleDisplayNamesImpl(locale, contexts, length);
@@ -941,7 +941,7 @@ uldn_open(const char * locale,
if (U_FAILURE(*pErrorCode)) {
return 0;
}
- if (locale == NULL) {
+ if (locale == nullptr) {
locale = uloc_getDefault();
}
return (ULocaleDisplayNames *)LocaleDisplayNames::createInstance(Locale(locale), dialectHandling);
@@ -954,7 +954,7 @@ uldn_openForContext(const char * locale,
if (U_FAILURE(*pErrorCode)) {
return 0;
}
- if (locale == NULL) {
+ if (locale == nullptr) {
locale = uloc_getDefault();
}
return (ULocaleDisplayNames *)LocaleDisplayNames::createInstance(Locale(locale), contexts, length);
@@ -971,7 +971,7 @@ uldn_getLocale(const ULocaleDisplayNames *ldn) {
if (ldn) {
return ((const LocaleDisplayNames *)ldn)->getLocale().getName();
}
- return NULL;
+ return nullptr;
}
U_CAPI UDialectHandling U_EXPORT2
@@ -995,13 +995,13 @@ uldn_getContext(const ULocaleDisplayNames *ldn,
U_CAPI int32_t U_EXPORT2
uldn_localeDisplayName(const ULocaleDisplayNames *ldn,
const char *locale,
- UChar *result,
+ char16_t *result,
int32_t maxResultSize,
UErrorCode *pErrorCode) {
if (U_FAILURE(*pErrorCode)) {
return 0;
}
- if (ldn == NULL || locale == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) {
+ if (ldn == nullptr || locale == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -1017,13 +1017,13 @@ uldn_localeDisplayName(const ULocaleDisplayNames *ldn,
U_CAPI int32_t U_EXPORT2
uldn_languageDisplayName(const ULocaleDisplayNames *ldn,
const char *lang,
- UChar *result,
+ char16_t *result,
int32_t maxResultSize,
UErrorCode *pErrorCode) {
if (U_FAILURE(*pErrorCode)) {
return 0;
}
- if (ldn == NULL || lang == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) {
+ if (ldn == nullptr || lang == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -1035,13 +1035,13 @@ uldn_languageDisplayName(const ULocaleDisplayNames *ldn,
U_CAPI int32_t U_EXPORT2
uldn_scriptDisplayName(const ULocaleDisplayNames *ldn,
const char *script,
- UChar *result,
+ char16_t *result,
int32_t maxResultSize,
UErrorCode *pErrorCode) {
if (U_FAILURE(*pErrorCode)) {
return 0;
}
- if (ldn == NULL || script == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) {
+ if (ldn == nullptr || script == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -1053,7 +1053,7 @@ uldn_scriptDisplayName(const ULocaleDisplayNames *ldn,
U_CAPI int32_t U_EXPORT2
uldn_scriptCodeDisplayName(const ULocaleDisplayNames *ldn,
UScriptCode scriptCode,
- UChar *result,
+ char16_t *result,
int32_t maxResultSize,
UErrorCode *pErrorCode) {
return uldn_scriptDisplayName(ldn, uscript_getName(scriptCode), result, maxResultSize, pErrorCode);
@@ -1062,13 +1062,13 @@ uldn_scriptCodeDisplayName(const ULocaleDisplayNames *ldn,
U_CAPI int32_t U_EXPORT2
uldn_regionDisplayName(const ULocaleDisplayNames *ldn,
const char *region,
- UChar *result,
+ char16_t *result,
int32_t maxResultSize,
UErrorCode *pErrorCode) {
if (U_FAILURE(*pErrorCode)) {
return 0;
}
- if (ldn == NULL || region == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) {
+ if (ldn == nullptr || region == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -1080,13 +1080,13 @@ uldn_regionDisplayName(const ULocaleDisplayNames *ldn,
U_CAPI int32_t U_EXPORT2
uldn_variantDisplayName(const ULocaleDisplayNames *ldn,
const char *variant,
- UChar *result,
+ char16_t *result,
int32_t maxResultSize,
UErrorCode *pErrorCode) {
if (U_FAILURE(*pErrorCode)) {
return 0;
}
- if (ldn == NULL || variant == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) {
+ if (ldn == nullptr || variant == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -1098,13 +1098,13 @@ uldn_variantDisplayName(const ULocaleDisplayNames *ldn,
U_CAPI int32_t U_EXPORT2
uldn_keyDisplayName(const ULocaleDisplayNames *ldn,
const char *key,
- UChar *result,
+ char16_t *result,
int32_t maxResultSize,
UErrorCode *pErrorCode) {
if (U_FAILURE(*pErrorCode)) {
return 0;
}
- if (ldn == NULL || key == NULL || (result == NULL && maxResultSize > 0) || maxResultSize < 0) {
+ if (ldn == nullptr || key == nullptr || (result == nullptr && maxResultSize > 0) || maxResultSize < 0) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -1117,13 +1117,13 @@ U_CAPI int32_t U_EXPORT2
uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn,
const char *key,
const char *value,
- UChar *result,
+ char16_t *result,
int32_t maxResultSize,
UErrorCode *pErrorCode) {
if (U_FAILURE(*pErrorCode)) {
return 0;
}
- if (ldn == NULL || key == NULL || value == NULL || (result == NULL && maxResultSize > 0)
+ if (ldn == nullptr || key == nullptr || value == nullptr || (result == nullptr && maxResultSize > 0)
|| maxResultSize < 0) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
diff --git a/thirdparty/icu4c/common/locid.cpp b/thirdparty/icu4c/common/locid.cpp
index 5cd083866c..70a794ae07 100644
--- a/thirdparty/icu4c/common/locid.cpp
+++ b/thirdparty/icu4c/common/locid.cpp
@@ -58,18 +58,18 @@
#include "uvector.h"
U_CDECL_BEGIN
-static UBool U_CALLCONV locale_cleanup(void);
+static UBool U_CALLCONV locale_cleanup();
U_CDECL_END
U_NAMESPACE_BEGIN
-static Locale *gLocaleCache = NULL;
+static Locale *gLocaleCache = nullptr;
static UInitOnce gLocaleCacheInitOnce {};
// gDefaultLocaleMutex protects all access to gDefaultLocalesHashT and gDefaultLocale.
static UMutex gDefaultLocaleMutex;
-static UHashtable *gDefaultLocalesHashT = NULL;
-static Locale *gDefaultLocale = NULL;
+static UHashtable *gDefaultLocalesHashT = nullptr;
+static Locale *gDefaultLocale = nullptr;
/**
* \def ULOC_STRING_LIMIT
@@ -115,19 +115,19 @@ deleteLocale(void *obj) {
delete (icu::Locale *) obj;
}
-static UBool U_CALLCONV locale_cleanup(void)
+static UBool U_CALLCONV locale_cleanup()
{
U_NAMESPACE_USE
delete [] gLocaleCache;
- gLocaleCache = NULL;
+ gLocaleCache = nullptr;
gLocaleCacheInitOnce.reset();
if (gDefaultLocalesHashT) {
uhash_close(gDefaultLocalesHashT); // Automatically deletes all elements, using deleter func.
- gDefaultLocalesHashT = NULL;
+ gDefaultLocalesHashT = nullptr;
}
- gDefaultLocale = NULL;
+ gDefaultLocale = nullptr;
return true;
}
@@ -135,9 +135,9 @@ static UBool U_CALLCONV locale_cleanup(void)
static void U_CALLCONV locale_init(UErrorCode &status) {
U_NAMESPACE_USE
- U_ASSERT(gLocaleCache == NULL);
+ U_ASSERT(gLocaleCache == nullptr);
gLocaleCache = new Locale[(int)eMAX_LOCALES];
- if (gLocaleCache == NULL) {
+ if (gLocaleCache == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -173,11 +173,11 @@ Locale *locale_set_default_internal(const char *id, UErrorCode& status) {
UBool canonicalize = false;
- // If given a NULL string for the locale id, grab the default
+ // If given a nullptr string for the locale id, grab the default
// name from the system.
// (Different from most other locale APIs, where a null name means use
// the current ICU default locale.)
- if (id == NULL) {
+ if (id == nullptr) {
id = uprv_getDefaultLocaleID(); // This function not thread safe? TODO: verify.
canonicalize = true; // always canonicalize host ID
}
@@ -196,8 +196,8 @@ Locale *locale_set_default_internal(const char *id, UErrorCode& status) {
return gDefaultLocale;
}
- if (gDefaultLocalesHashT == NULL) {
- gDefaultLocalesHashT = uhash_open(uhash_hashChars, uhash_compareChars, NULL, &status);
+ if (gDefaultLocalesHashT == nullptr) {
+ gDefaultLocalesHashT = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &status);
if (U_FAILURE(status)) {
return gDefaultLocale;
}
@@ -206,9 +206,9 @@ Locale *locale_set_default_internal(const char *id, UErrorCode& status) {
}
Locale *newDefault = (Locale *)uhash_get(gDefaultLocalesHashT, localeNameBuf.data());
- if (newDefault == NULL) {
+ if (newDefault == nullptr) {
newDefault = new Locale(Locale::eBOGUS);
- if (newDefault == NULL) {
+ if (newDefault == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return gDefaultLocale;
}
@@ -235,7 +235,7 @@ locale_set_default(const char *id)
/* end */
U_CFUNC const char *
-locale_get_default(void)
+locale_get_default()
{
U_NAMESPACE_USE
return Locale::getDefault().getName();
@@ -257,19 +257,19 @@ Locale::~Locale()
if ((baseName != fullName) && (baseName != fullNameBuffer)) {
uprv_free(baseName);
}
- baseName = NULL;
+ baseName = nullptr;
/*if fullName is on the heap, we free it*/
if (fullName != fullNameBuffer)
{
uprv_free(fullName);
- fullName = NULL;
+ fullName = nullptr;
}
}
Locale::Locale()
- : UObject(), fullName(fullNameBuffer), baseName(NULL)
+ : UObject(), fullName(fullNameBuffer), baseName(nullptr)
{
- init(NULL, false);
+ init(nullptr, false);
}
/*
@@ -278,7 +278,7 @@ Locale::Locale()
* the default locale.)
*/
Locale::Locale(Locale::ELocaleType)
- : UObject(), fullName(fullNameBuffer), baseName(NULL)
+ : UObject(), fullName(fullNameBuffer), baseName(nullptr)
{
setToBogus();
}
@@ -288,11 +288,11 @@ Locale::Locale( const char * newLanguage,
const char * newCountry,
const char * newVariant,
const char * newKeywords)
- : UObject(), fullName(fullNameBuffer), baseName(NULL)
+ : UObject(), fullName(fullNameBuffer), baseName(nullptr)
{
- if( (newLanguage==NULL) && (newCountry == NULL) && (newVariant == NULL) )
+ if( (newLanguage==nullptr) && (newCountry == nullptr) && (newVariant == nullptr) )
{
- init(NULL, false); /* shortcut */
+ init(nullptr, false); /* shortcut */
}
else
{
@@ -305,7 +305,7 @@ Locale::Locale( const char * newLanguage,
// Check the sizes of the input strings.
// Language
- if ( newLanguage != NULL )
+ if ( newLanguage != nullptr )
{
lsize = (int32_t)uprv_strlen(newLanguage);
if ( lsize < 0 || lsize > ULOC_STRING_LIMIT ) { // int32 wrap
@@ -317,7 +317,7 @@ Locale::Locale( const char * newLanguage,
CharString togo(newLanguage, lsize, status); // start with newLanguage
// _Country
- if ( newCountry != NULL )
+ if ( newCountry != nullptr )
{
csize = (int32_t)uprv_strlen(newCountry);
if ( csize < 0 || csize > ULOC_STRING_LIMIT ) { // int32 wrap
@@ -327,7 +327,7 @@ Locale::Locale( const char * newLanguage,
}
// _Variant
- if ( newVariant != NULL )
+ if ( newVariant != nullptr )
{
// remove leading _'s
while(newVariant[0] == SEP_CHAR)
@@ -347,7 +347,7 @@ Locale::Locale( const char * newLanguage,
}
}
- if ( newKeywords != NULL)
+ if ( newKeywords != nullptr)
{
ksize = (int32_t)uprv_strlen(newKeywords);
if ( ksize < 0 || ksize > ULOC_STRING_LIMIT ) {
@@ -402,12 +402,12 @@ Locale::Locale( const char * newLanguage,
}
Locale::Locale(const Locale &other)
- : UObject(other), fullName(fullNameBuffer), baseName(NULL)
+ : UObject(other), fullName(fullNameBuffer), baseName(nullptr)
{
*this = other;
}
-Locale::Locale(Locale&& other) U_NOEXCEPT
+Locale::Locale(Locale&& other) noexcept
: UObject(other), fullName(fullNameBuffer), baseName(fullName) {
*this = std::move(other);
}
@@ -445,7 +445,7 @@ Locale& Locale::operator=(const Locale& other) {
return *this;
}
-Locale& Locale::operator=(Locale&& other) U_NOEXCEPT {
+Locale& Locale::operator=(Locale&& other) noexcept {
if ((baseName != fullName) && (baseName != fullNameBuffer)) uprv_free(baseName);
if (fullName != fullNameBuffer) uprv_free(fullName);
@@ -1513,7 +1513,7 @@ AliasReplacer::replaceTransformedExtensions(
CharString& transformedExtensions, CharString& output, UErrorCode& status)
{
// The content of the transformedExtensions will be modified in this
- // function to NULL-terminating (tkey-tvalue) pairs.
+ // function to NUL-terminating (tkey-tvalue) pairs.
if (U_FAILURE(status)) {
return false;
}
@@ -1548,7 +1548,7 @@ AliasReplacer::replaceTransformedExtensions(
}
const char* nextTKey = ultag_getTKeyStart(tvalue);
if (nextTKey != nullptr) {
- *((char*)(nextTKey-1)) = '\0'; // NULL terminate tvalue
+ *((char*)(nextTKey-1)) = '\0'; // NUL terminate tvalue
}
tfields.insertElementAt((void*)tkey, tfields.size(), status);
if (U_FAILURE(status)) {
@@ -1570,7 +1570,7 @@ AliasReplacer::replaceTransformedExtensions(
return false;
}
// Split the "tkey-tvalue" pair string so that we can canonicalize the tvalue.
- *((char*)tvalue++) = '\0'; // NULL terminate tkey
+ *((char*)tvalue++) = '\0'; // NUL terminate tkey
output.append(tfield, status).append('-', status);
const char* bcpTValue = ulocimp_toBcpType(tfield, tvalue, nullptr, nullptr);
output.append((bcpTValue == nullptr) ? tvalue : bcpTValue, status);
@@ -1822,7 +1822,7 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
if ((baseName != fullName) && (baseName != fullNameBuffer)) {
uprv_free(baseName);
}
- baseName = NULL;
+ baseName = nullptr;
if(fullName != fullNameBuffer) {
uprv_free(fullName);
fullName = fullNameBuffer;
@@ -1840,7 +1840,7 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
int32_t length;
UErrorCode err;
- if(localeID == NULL) {
+ if(localeID == nullptr) {
// not an error, just set the default locale
return *this = getDefault();
}
@@ -1889,8 +1889,8 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
// variant may contain @foo or .foo POSIX cruft; remove it
separator = uprv_strchr(field[fieldIdx-1], '@');
char* sep2 = uprv_strchr(field[fieldIdx-1], '.');
- if (separator!=NULL || sep2!=NULL) {
- if (separator==NULL || (sep2!=NULL && separator > sep2)) {
+ if (separator!=nullptr || sep2!=nullptr) {
+ if (separator==nullptr || (sep2!=nullptr && separator > sep2)) {
separator = sep2;
}
fieldLen[fieldIdx-1] = (int32_t)(separator - field[fieldIdx-1]);
@@ -1974,14 +1974,14 @@ Locale::initBaseName(UErrorCode &status) {
if (U_FAILURE(status)) {
return;
}
- U_ASSERT(baseName==NULL || baseName==fullName);
+ U_ASSERT(baseName==nullptr || baseName==fullName);
const char *atPtr = uprv_strchr(fullName, '@');
const char *eqPtr = uprv_strchr(fullName, '=');
if (atPtr && eqPtr && atPtr < eqPtr) {
// Key words exist.
int32_t baseNameLength = (int32_t)(atPtr - fullName);
baseName = (char *)uprv_malloc(baseNameLength + 1);
- if (baseName == NULL) {
+ if (baseName == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -2012,7 +2012,7 @@ Locale::setToBogus() {
if((baseName != fullName) && (baseName != fullNameBuffer)) {
uprv_free(baseName);
}
- baseName = NULL;
+ baseName = nullptr;
if(fullName != fullNameBuffer) {
uprv_free(fullName);
fullName = fullNameBuffer;
@@ -2030,12 +2030,12 @@ Locale::getDefault()
{
{
Mutex lock(&gDefaultLocaleMutex);
- if (gDefaultLocale != NULL) {
+ if (gDefaultLocale != nullptr) {
return *gDefaultLocale;
}
}
UErrorCode status = U_ZERO_ERROR;
- return *locale_set_default_internal(NULL, status);
+ return *locale_set_default_internal(nullptr, status);
}
@@ -2244,134 +2244,134 @@ void Locale::setFromPOSIXID(const char *posixID)
}
const Locale & U_EXPORT2
-Locale::getRoot(void)
+Locale::getRoot()
{
return getLocale(eROOT);
}
const Locale & U_EXPORT2
-Locale::getEnglish(void)
+Locale::getEnglish()
{
return getLocale(eENGLISH);
}
const Locale & U_EXPORT2
-Locale::getFrench(void)
+Locale::getFrench()
{
return getLocale(eFRENCH);
}
const Locale & U_EXPORT2
-Locale::getGerman(void)
+Locale::getGerman()
{
return getLocale(eGERMAN);
}
const Locale & U_EXPORT2
-Locale::getItalian(void)
+Locale::getItalian()
{
return getLocale(eITALIAN);
}
const Locale & U_EXPORT2
-Locale::getJapanese(void)
+Locale::getJapanese()
{
return getLocale(eJAPANESE);
}
const Locale & U_EXPORT2
-Locale::getKorean(void)
+Locale::getKorean()
{
return getLocale(eKOREAN);
}
const Locale & U_EXPORT2
-Locale::getChinese(void)
+Locale::getChinese()
{
return getLocale(eCHINESE);
}
const Locale & U_EXPORT2
-Locale::getSimplifiedChinese(void)
+Locale::getSimplifiedChinese()
{
return getLocale(eCHINA);
}
const Locale & U_EXPORT2
-Locale::getTraditionalChinese(void)
+Locale::getTraditionalChinese()
{
return getLocale(eTAIWAN);
}
const Locale & U_EXPORT2
-Locale::getFrance(void)
+Locale::getFrance()
{
return getLocale(eFRANCE);
}
const Locale & U_EXPORT2
-Locale::getGermany(void)
+Locale::getGermany()
{
return getLocale(eGERMANY);
}
const Locale & U_EXPORT2
-Locale::getItaly(void)
+Locale::getItaly()
{
return getLocale(eITALY);
}
const Locale & U_EXPORT2
-Locale::getJapan(void)
+Locale::getJapan()
{
return getLocale(eJAPAN);
}
const Locale & U_EXPORT2
-Locale::getKorea(void)
+Locale::getKorea()
{
return getLocale(eKOREA);
}
const Locale & U_EXPORT2
-Locale::getChina(void)
+Locale::getChina()
{
return getLocale(eCHINA);
}
const Locale & U_EXPORT2
-Locale::getPRC(void)
+Locale::getPRC()
{
return getLocale(eCHINA);
}
const Locale & U_EXPORT2
-Locale::getTaiwan(void)
+Locale::getTaiwan()
{
return getLocale(eTAIWAN);
}
const Locale & U_EXPORT2
-Locale::getUK(void)
+Locale::getUK()
{
return getLocale(eUK);
}
const Locale & U_EXPORT2
-Locale::getUS(void)
+Locale::getUS()
{
return getLocale(eUS);
}
const Locale & U_EXPORT2
-Locale::getCanada(void)
+Locale::getCanada()
{
return getLocale(eCANADA);
}
const Locale & U_EXPORT2
-Locale::getCanadaFrench(void)
+Locale::getCanadaFrench()
{
return getLocale(eCANADA_FRENCH);
}
@@ -2381,12 +2381,12 @@ Locale::getLocale(int locid)
{
Locale *localeCache = getLocaleCache();
U_ASSERT((locid < eMAX_LOCALES)&&(locid>=0));
- if (localeCache == NULL) {
+ if (localeCache == nullptr) {
// Failure allocating the locale cache.
- // The best we can do is return a NULL reference.
+ // The best we can do is return a nullptr reference.
locid = 0;
}
- return localeCache[locid]; /*operating on NULL*/
+ return localeCache[locid]; /*operating on nullptr*/
}
/*
@@ -2394,7 +2394,7 @@ This function is defined this way in order to get around static
initialization and static destruction.
*/
Locale *
-Locale::getLocaleCache(void)
+Locale::getLocaleCache()
{
UErrorCode status = U_ZERO_ERROR;
umtx_initOnce(gLocaleCacheInitOnce, locale_init, status);
@@ -2410,17 +2410,17 @@ private:
static const char fgClassID;/* Warning this is used beyond the typical RTTI usage. */
public:
- static UClassID U_EXPORT2 getStaticClassID(void) { return (UClassID)&fgClassID; }
- virtual UClassID getDynamicClassID(void) const override { return getStaticClassID(); }
+ static UClassID U_EXPORT2 getStaticClassID() { return (UClassID)&fgClassID; }
+ virtual UClassID getDynamicClassID() const override { return getStaticClassID(); }
public:
KeywordEnumeration(const char *keys, int32_t keywordLen, int32_t currentIndex, UErrorCode &status)
: keywords((char *)&fgClassID), current((char *)&fgClassID), length(0) {
if(U_SUCCESS(status) && keywordLen != 0) {
- if(keys == NULL || keywordLen < 0) {
+ if(keys == nullptr || keywordLen < 0) {
status = U_ILLEGAL_ARGUMENT_ERROR;
} else {
keywords = (char *)uprv_malloc(keywordLen+1);
- if (keywords == NULL) {
+ if (keywords == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
}
else {
@@ -2458,14 +2458,14 @@ public:
result = current;
len = (int32_t)uprv_strlen(current);
current += len+1;
- if(resultLength != NULL) {
+ if(resultLength != nullptr) {
*resultLength = len;
}
} else {
- if(resultLength != NULL) {
+ if(resultLength != nullptr) {
*resultLength = 0;
}
- result = NULL;
+ result = nullptr;
}
return result;
}
@@ -2518,7 +2518,7 @@ UnicodeKeywordEnumeration::~UnicodeKeywordEnumeration() = default;
StringEnumeration *
Locale::createKeywords(UErrorCode &status) const
{
- StringEnumeration *result = NULL;
+ StringEnumeration *result = nullptr;
if (U_FAILURE(status)) {
return result;
@@ -2547,7 +2547,7 @@ Locale::createKeywords(UErrorCode &status) const
StringEnumeration *
Locale::createUnicodeKeywords(UErrorCode &status) const
{
- StringEnumeration *result = NULL;
+ StringEnumeration *result = nullptr;
if (U_FAILURE(status)) {
return result;
diff --git a/thirdparty/icu4c/common/loclikely.cpp b/thirdparty/icu4c/common/loclikely.cpp
index ec0dca28a4..d2a05c6364 100644
--- a/thirdparty/icu4c/common/loclikely.cpp
+++ b/thirdparty/icu4c/common/loclikely.cpp
@@ -54,23 +54,23 @@ findLikelySubtags(const char* localeID,
char* buffer,
int32_t bufferLength,
UErrorCode* err) {
- const char* result = NULL;
+ const char* result = nullptr;
if (!U_FAILURE(*err)) {
int32_t resLen = 0;
- const UChar* s = NULL;
+ const char16_t* s = nullptr;
UErrorCode tmpErr = U_ZERO_ERROR;
- icu::LocalUResourceBundlePointer subtags(ures_openDirect(NULL, "likelySubtags", &tmpErr));
+ icu::LocalUResourceBundlePointer subtags(ures_openDirect(nullptr, "likelySubtags", &tmpErr));
if (U_SUCCESS(tmpErr)) {
icu::CharString und;
- if (localeID != NULL) {
+ if (localeID != nullptr) {
if (*localeID == '\0') {
localeID = unknownLanguage;
} else if (*localeID == '_') {
und.append(unknownLanguage, *err);
und.append(localeID, *err);
if (U_FAILURE(*err)) {
- return NULL;
+ return nullptr;
}
localeID = und.data();
}
@@ -140,12 +140,12 @@ appendTag(
/**
* Create a tag string from the supplied parameters. The lang, script and region
- * parameters may be NULL pointers. If they are, their corresponding length parameters
+ * parameters may be nullptr pointers. If they are, their corresponding length parameters
* must be less than or equal to 0.
*
* If any of the language, script or region parameters are empty, and the alternateTags
- * parameter is not NULL, it will be parsed for potential language, script and region tags
- * to be used when constructing the new tag. If the alternateTags parameter is NULL, or
+ * parameter is not nullptr, it will be parsed for potential language, script and region tags
+ * to be used when constructing the new tag. If the alternateTags parameter is nullptr, 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,
@@ -211,7 +211,7 @@ createTagStringWithAlternates(
&tagLength,
/*withSeparator=*/false);
}
- else if (alternateTags == NULL) {
+ else if (alternateTags == nullptr) {
/*
* Use the empty string for an unknown language, if
* we found no language.
@@ -258,7 +258,7 @@ createTagStringWithAlternates(
&tagLength,
/*withSeparator=*/true);
}
- else if (alternateTags != NULL) {
+ else if (alternateTags != nullptr) {
/*
* Parse the alternateTags string for the script.
*/
@@ -295,7 +295,7 @@ createTagStringWithAlternates(
regionAppended = true;
}
- else if (alternateTags != NULL) {
+ else if (alternateTags != nullptr) {
/*
* Parse the alternateTags string for the region.
*/
@@ -362,7 +362,7 @@ error:
/**
* Create a tag string from the supplied parameters. The lang, script and region
- * parameters may be NULL pointers. If they are, their corresponding length parameters
+ * parameters may be nullptr pointers. If they are, their corresponding length parameters
* 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.
*
@@ -406,7 +406,7 @@ createTagString(
regionLength,
trailing,
trailingLength,
- NULL,
+ nullptr,
sink,
err);
}
@@ -454,13 +454,13 @@ parseTagString(
int32_t subtagLength = 0;
if(U_FAILURE(*err) ||
- localeID == NULL ||
- lang == NULL ||
- langLength == NULL ||
- script == NULL ||
- scriptLength == NULL ||
- region == NULL ||
- regionLength == NULL) {
+ localeID == nullptr ||
+ lang == nullptr ||
+ langLength == nullptr ||
+ script == nullptr ||
+ scriptLength == nullptr ||
+ region == nullptr ||
+ regionLength == nullptr) {
goto error;
}
@@ -575,7 +575,7 @@ createLikelySubtagsString(
**/
if (scriptLength > 0 && regionLength > 0) {
- const char* likelySubtags = NULL;
+ const char* likelySubtags = nullptr;
icu::CharString tagBuffer;
{
@@ -587,7 +587,7 @@ createLikelySubtagsString(
scriptLength,
region,
regionLength,
- NULL,
+ nullptr,
0,
sink,
err);
@@ -606,16 +606,16 @@ createLikelySubtagsString(
goto error;
}
- if (likelySubtags != NULL) {
+ if (likelySubtags != nullptr) {
/* Always use the language tag from the
maximal string, since it may be more
specific than the one provided. */
createTagStringWithAlternates(
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
variants,
variantsLength,
@@ -631,7 +631,7 @@ createLikelySubtagsString(
**/
if (scriptLength > 0) {
- const char* likelySubtags = NULL;
+ const char* likelySubtags = nullptr;
icu::CharString tagBuffer;
{
@@ -641,9 +641,9 @@ createLikelySubtagsString(
langLength,
script,
scriptLength,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
sink,
err);
@@ -662,14 +662,14 @@ createLikelySubtagsString(
goto error;
}
- if (likelySubtags != NULL) {
+ if (likelySubtags != nullptr) {
/* Always use the language tag from the
maximal string, since it may be more
specific than the one provided. */
createTagStringWithAlternates(
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
region,
regionLength,
@@ -687,7 +687,7 @@ createLikelySubtagsString(
**/
if (regionLength > 0) {
- const char* likelySubtags = NULL;
+ const char* likelySubtags = nullptr;
icu::CharString tagBuffer;
{
@@ -695,11 +695,11 @@ createLikelySubtagsString(
createTagString(
lang,
langLength,
- NULL,
+ nullptr,
0,
region,
regionLength,
- NULL,
+ nullptr,
0,
sink,
err);
@@ -718,16 +718,16 @@ createLikelySubtagsString(
goto error;
}
- if (likelySubtags != NULL) {
+ if (likelySubtags != nullptr) {
/* Always use the language tag from the
maximal string, since it may be more
specific than the one provided. */
createTagStringWithAlternates(
- NULL,
+ nullptr,
0,
script,
scriptLength,
- NULL,
+ nullptr,
0,
variants,
variantsLength,
@@ -742,7 +742,7 @@ createLikelySubtagsString(
* Finally, try just the language.
**/
{
- const char* likelySubtags = NULL;
+ const char* likelySubtags = nullptr;
icu::CharString tagBuffer;
{
@@ -750,11 +750,11 @@ createLikelySubtagsString(
createTagString(
lang,
langLength,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
sink,
err);
@@ -773,12 +773,12 @@ createLikelySubtagsString(
goto error;
}
- if (likelySubtags != NULL) {
+ if (likelySubtags != nullptr) {
/* Always use the language tag from the
maximal string, since it may be more
specific than the one provided. */
createTagStringWithAlternates(
- NULL,
+ nullptr,
0,
script,
scriptLength,
@@ -841,7 +841,7 @@ _uloc_addLikelySubtags(const char* localeID,
if(U_FAILURE(*err)) {
goto error;
}
- if (localeID == NULL) {
+ if (localeID == nullptr) {
goto error;
}
@@ -930,7 +930,7 @@ _uloc_minimizeSubtags(const char* localeID,
if(U_FAILURE(*err)) {
goto error;
}
- else if (localeID == NULL) {
+ else if (localeID == nullptr) {
goto error;
}
@@ -974,7 +974,7 @@ _uloc_minimizeSubtags(const char* localeID,
scriptLength,
region,
regionLength,
- NULL,
+ nullptr,
0,
baseSink,
err);
@@ -1031,11 +1031,11 @@ _uloc_minimizeSubtags(const char* localeID,
createLikelySubtagsString(
lang,
langLength,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
tagSink,
err);
@@ -1053,9 +1053,9 @@ _uloc_minimizeSubtags(const char* localeID,
createTagString(
lang,
langLength,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
trailing,
trailingLength,
@@ -1076,11 +1076,11 @@ _uloc_minimizeSubtags(const char* localeID,
createLikelySubtagsString(
lang,
langLength,
- NULL,
+ nullptr,
0,
region,
regionLength,
- NULL,
+ nullptr,
0,
tagSink,
err);
@@ -1098,7 +1098,7 @@ _uloc_minimizeSubtags(const char* localeID,
createTagString(
lang,
langLength,
- NULL,
+ nullptr,
0,
region,
regionLength,
@@ -1124,9 +1124,9 @@ _uloc_minimizeSubtags(const char* localeID,
langLength,
script,
scriptLength,
- NULL,
+ nullptr,
0,
- NULL,
+ nullptr,
0,
tagSink,
err);
@@ -1146,7 +1146,7 @@ _uloc_minimizeSubtags(const char* localeID,
langLength,
script,
scriptLength,
- NULL,
+ nullptr,
0,
trailing,
trailingLength,
@@ -1324,7 +1324,7 @@ uloc_isRightToLeft(const char *locale) {
}
if (langLength > 0) {
const char* langPtr = uprv_strstr(LANG_DIR_STRING, lang);
- if (langPtr != NULL) {
+ if (langPtr != nullptr) {
switch (langPtr[langLength]) {
case '-': return false;
case '+': return true;
diff --git a/thirdparty/icu4c/common/locmap.cpp b/thirdparty/icu4c/common/locmap.cpp
index 78cfd1ca86..7a0e90e8bd 100644
--- a/thirdparty/icu4c/common/locmap.cpp
+++ b/thirdparty/icu4c/common/locmap.cpp
@@ -1054,7 +1054,7 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr
uint16_t langID;
uint32_t localeIndex;
UBool bLookup = true;
- const char *pPosixID = NULL;
+ const char *pPosixID = nullptr;
#if U_PLATFORM_HAS_WIN32_API && UCONFIG_USE_WINDOWS_LCID_MAPPING_API
static_assert(ULOC_FULLNAME_CAPACITY > LOCALE_NAME_MAX_LENGTH, "Windows locale names have smaller length than ICU locale names.");
@@ -1110,7 +1110,7 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr
#endif
if (bLookup) {
- const char *pCandidate = NULL;
+ const char *pCandidate = nullptr;
langID = LANGUAGE_LCID(hostid);
for (localeIndex = 0; localeIndex < gLocaleCount; localeIndex++) {
@@ -1123,7 +1123,7 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr
/* On Windows, when locale name has a variant, we still look up the hardcoded table.
If a match in the hardcoded table is longer than the Windows locale name without
variant, we use the one as the result */
- if (pCandidate && (pPosixID == NULL || uprv_strlen(pCandidate) > uprv_strlen(pPosixID))) {
+ if (pCandidate && (pPosixID == nullptr || uprv_strlen(pCandidate) > uprv_strlen(pPosixID))) {
pPosixID = pCandidate;
}
}
diff --git a/thirdparty/icu4c/common/locresdata.cpp b/thirdparty/icu4c/common/locresdata.cpp
index d1d9a4729f..7a0969dff5 100644
--- a/thirdparty/icu4c/common/locresdata.cpp
+++ b/thirdparty/icu4c/common/locresdata.cpp
@@ -41,7 +41,7 @@
* default locale because that would result in a mix of languages that is
* unpredictable to the programmer and most likely useless.
*/
-U_CAPI const UChar * U_EXPORT2
+U_CAPI const char16_t * U_EXPORT2
uloc_getTableStringWithFallback(const char *path, const char *locale,
const char *tableKey, const char *subTableKey,
const char *itemKey,
@@ -49,7 +49,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
UErrorCode *pErrorCode)
{
/* char localeBuffer[ULOC_FULLNAME_CAPACITY*4];*/
- const UChar *item=NULL;
+ const char16_t *item=nullptr;
UErrorCode errorCode;
char explicitFallbackName[ULOC_FULLNAME_CAPACITY] = {0};
@@ -63,7 +63,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
if(U_FAILURE(errorCode)) {
/* total failure, not even root could be opened */
*pErrorCode=errorCode;
- return NULL;
+ return nullptr;
} else if(errorCode==U_USING_DEFAULT_WARNING ||
(errorCode==U_USING_FALLBACK_WARNING && *pErrorCode!=U_USING_DEFAULT_WARNING)
) {
@@ -76,7 +76,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
icu::StackUResourceBundle subTable;
ures_getByKeyWithFallback(rb.getAlias(), tableKey, table.getAlias(), &errorCode);
- if (subTableKey != NULL) {
+ if (subTableKey != nullptr) {
/*
ures_getByKeyWithFallback(table.getAlias(), subTableKey, subTable.getAlias(), &errorCode);
item = ures_getStringByKeyWithFallback(subTable.getAlias(), itemKey, pLength, &errorCode);
@@ -91,7 +91,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
if(U_SUCCESS(errorCode)){
item = ures_getStringByKeyWithFallback(table.getAlias(), itemKey, pLength, &errorCode);
if(U_FAILURE(errorCode)){
- const char* replacement = NULL;
+ const char* replacement = nullptr;
*pErrorCode = errorCode; /*save the errorCode*/
errorCode = U_ZERO_ERROR;
/* may be a deprecated code */
@@ -101,7 +101,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
replacement = uloc_getCurrentLanguageID(itemKey);
}
/*pointer comparison is ok since uloc_getCurrentCountryID & uloc_getCurrentLanguageID return the key itself is replacement is not found*/
- if(replacement!=NULL && itemKey != replacement){
+ if(replacement!=nullptr && itemKey != replacement){
item = ures_getStringByKeyWithFallback(table.getAlias(), replacement, pLength, &errorCode);
if(U_SUCCESS(errorCode)){
*pErrorCode = errorCode;
@@ -117,7 +117,7 @@ uloc_getTableStringWithFallback(const char *path, const char *locale,
/* still can't figure out ?.. try the fallback mechanism */
int32_t len = 0;
- const UChar* fallbackLocale = NULL;
+ const char16_t* fallbackLocale = nullptr;
*pErrorCode = errorCode;
errorCode = U_ZERO_ERROR;
@@ -162,12 +162,12 @@ _uloc_getOrientationHelper(const char* localeId,
uloc_canonicalize(localeId, localeBuffer, sizeof(localeBuffer), status);
if (!U_FAILURE(*status)) {
- const UChar* const value =
+ const char16_t* const value =
uloc_getTableStringWithFallback(
- NULL,
+ nullptr,
localeBuffer,
"layout",
- NULL,
+ nullptr,
key,
&length,
status);
diff --git a/thirdparty/icu4c/common/locutil.cpp b/thirdparty/icu4c/common/locutil.cpp
index 6e2bd497f8..776d1d5963 100644
--- a/thirdparty/icu4c/common/locutil.cpp
+++ b/thirdparty/icu4c/common/locutil.cpp
@@ -22,11 +22,11 @@
// see LocaleUtility::getAvailableLocaleNames
static icu::UInitOnce LocaleUtilityInitOnce {};
-static icu::Hashtable * LocaleUtility_cache = NULL;
+static icu::Hashtable * LocaleUtility_cache = nullptr;
-#define UNDERSCORE_CHAR ((UChar)0x005f)
-#define AT_SIGN_CHAR ((UChar)64)
-#define PERIOD_CHAR ((UChar)46)
+#define UNDERSCORE_CHAR ((char16_t)0x005f)
+#define AT_SIGN_CHAR ((char16_t)64)
+#define PERIOD_CHAR ((char16_t)46)
/*
******************************************************************
@@ -36,10 +36,10 @@ static icu::Hashtable * LocaleUtility_cache = NULL;
* Release all static memory held by Locale Utility.
*/
U_CDECL_BEGIN
-static UBool U_CALLCONV service_cleanup(void) {
+static UBool U_CALLCONV service_cleanup() {
if (LocaleUtility_cache) {
delete LocaleUtility_cache;
- LocaleUtility_cache = NULL;
+ LocaleUtility_cache = nullptr;
}
return true;
}
@@ -47,15 +47,15 @@ static UBool U_CALLCONV service_cleanup(void) {
static void U_CALLCONV locale_utility_init(UErrorCode &status) {
using namespace icu;
- U_ASSERT(LocaleUtility_cache == NULL);
+ U_ASSERT(LocaleUtility_cache == nullptr);
ucln_common_registerCleanup(UCLN_COMMON_SERVICE, service_cleanup);
LocaleUtility_cache = new Hashtable(status);
if (U_FAILURE(status)) {
delete LocaleUtility_cache;
- LocaleUtility_cache = NULL;
+ LocaleUtility_cache = nullptr;
return;
}
- if (LocaleUtility_cache == NULL) {
+ if (LocaleUtility_cache == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -69,7 +69,7 @@ U_NAMESPACE_BEGIN
UnicodeString&
LocaleUtility::canonicalLocaleString(const UnicodeString* id, UnicodeString& result)
{
- if (id == NULL) {
+ if (id == nullptr) {
result.setToBogus();
} else {
// Fix case only (no other changes) up to the first '@' or '.' or
@@ -94,14 +94,14 @@ LocaleUtility::canonicalLocaleString(const UnicodeString* id, UnicodeString& res
n = end;
}
for (; i < n; ++i) {
- UChar c = result.charAt(i);
+ char16_t c = result.charAt(i);
if (c >= 0x0041 && c <= 0x005a) {
c += 0x20;
result.setCharAt(i, c);
}
}
for (n = end; i < n; ++i) {
- UChar c = result.charAt(i);
+ char16_t c = result.charAt(i);
if (c >= 0x0061 && c <= 0x007a) {
c -= 0x20;
result.setCharAt(i, c);
@@ -112,7 +112,7 @@ LocaleUtility::canonicalLocaleString(const UnicodeString* id, UnicodeString& res
#if 0
// This code does a proper full level 2 canonicalization of id.
- // It's nasty to go from UChar to char to char to UChar -- but
+ // It's nasty to go from char16_t to char to char to char16_t -- but
// that's what you have to do to use the uloc_canonicalize
// function on UnicodeStrings.
@@ -172,7 +172,7 @@ LocaleUtility::initLocaleFromName(const UnicodeString& id, Locale& result)
int32_t prev, i;
prev = 0;
for(;;) {
- i = id.indexOf((UChar)0x40, prev);
+ i = id.indexOf((char16_t)0x40, prev);
if(i < 0) {
// no @ between prev and the rest of the string
id.extract(prev, INT32_MAX, buffer + prev, BUFLEN - prev, US_INV);
@@ -214,45 +214,45 @@ LocaleUtility::getAvailableLocaleNames(const UnicodeString& bundleID)
UErrorCode status = U_ZERO_ERROR;
umtx_initOnce(LocaleUtilityInitOnce, locale_utility_init, status);
Hashtable *cache = LocaleUtility_cache;
- if (cache == NULL) {
+ if (cache == nullptr) {
// Catastrophic failure.
- return NULL;
+ return nullptr;
}
Hashtable* htp;
- umtx_lock(NULL);
+ umtx_lock(nullptr);
htp = (Hashtable*) cache->get(bundleID);
- umtx_unlock(NULL);
+ umtx_unlock(nullptr);
- if (htp == NULL) {
+ if (htp == nullptr) {
htp = new Hashtable(status);
if (htp && U_SUCCESS(status)) {
CharString cbundleID;
cbundleID.appendInvariantChars(bundleID, status);
- const char* path = cbundleID.isEmpty() ? NULL : cbundleID.data();
+ const char* path = cbundleID.isEmpty() ? nullptr : cbundleID.data();
icu::LocalUEnumerationPointer uenum(ures_openAvailableLocales(path, &status));
for (;;) {
- const UChar* id = uenum_unext(uenum.getAlias(), NULL, &status);
- if (id == NULL) {
+ const char16_t* id = uenum_unext(uenum.getAlias(), nullptr, &status);
+ if (id == nullptr) {
break;
}
htp->put(UnicodeString(id), (void*)htp, status);
}
if (U_FAILURE(status)) {
delete htp;
- return NULL;
+ return nullptr;
}
- umtx_lock(NULL);
+ umtx_lock(nullptr);
Hashtable *t = static_cast<Hashtable *>(cache->get(bundleID));
- if (t != NULL) {
+ if (t != nullptr) {
// Another thread raced through this code, creating the cache entry first.
// Discard ours and return theirs.
- umtx_unlock(NULL);
+ umtx_unlock(nullptr);
delete htp;
htp = t;
} else {
cache->put(bundleID, (void*)htp, status);
- umtx_unlock(NULL);
+ umtx_unlock(nullptr);
}
}
}
diff --git a/thirdparty/icu4c/common/lsr.cpp b/thirdparty/icu4c/common/lsr.cpp
index 1f0b69ab0f..39eb46df27 100644
--- a/thirdparty/icu4c/common/lsr.cpp
+++ b/thirdparty/icu4c/common/lsr.cpp
@@ -31,7 +31,7 @@ LSR::LSR(char prefix, const char *lang, const char *scr, const char *r, int32_t
}
}
-LSR::LSR(LSR &&other) U_NOEXCEPT :
+LSR::LSR(LSR &&other) noexcept :
language(other.language), script(other.script), region(other.region), owned(other.owned),
regionIndex(other.regionIndex), flags(other.flags),
hashCode(other.hashCode) {
@@ -46,7 +46,7 @@ void LSR::deleteOwned() {
uprv_free(owned);
}
-LSR &LSR::operator=(LSR &&other) U_NOEXCEPT {
+LSR &LSR::operator=(LSR &&other) noexcept {
this->~LSR();
language = other.language;
script = other.script;
diff --git a/thirdparty/icu4c/common/lsr.h b/thirdparty/icu4c/common/lsr.h
index af993c11d6..a2f7c8bb15 100644
--- a/thirdparty/icu4c/common/lsr.h
+++ b/thirdparty/icu4c/common/lsr.h
@@ -45,7 +45,7 @@ struct LSR final : public UMemory {
*/
LSR(char prefix, const char *lang, const char *scr, const char *r, int32_t f,
UErrorCode &errorCode);
- LSR(LSR &&other) U_NOEXCEPT;
+ LSR(LSR &&other) noexcept;
LSR(const LSR &other) = delete;
inline ~LSR() {
// Pure inline code for almost all instances.
@@ -54,7 +54,7 @@ struct LSR final : public UMemory {
}
}
- LSR &operator=(LSR &&other) U_NOEXCEPT;
+ LSR &operator=(LSR &&other) noexcept;
LSR &operator=(const LSR &other) = delete;
/**
diff --git a/thirdparty/icu4c/common/lstmbe.cpp b/thirdparty/icu4c/common/lstmbe.cpp
index f6114cdfe2..fb8eb01761 100644
--- a/thirdparty/icu4c/common/lstmbe.cpp
+++ b/thirdparty/icu4c/common/lstmbe.cpp
@@ -361,7 +361,7 @@ struct LSTMData : public UMemory {
~LSTMData();
UHashtable* fDict;
EmbeddingType fType;
- const UChar* fName;
+ const char16_t* fName;
ConstArray2D fEmbedding;
ConstArray2D fForwardW;
ConstArray2D fForwardU;
@@ -394,7 +394,7 @@ LSTMData::LSTMData(UResourceBundle* rb, UErrorCode &status)
ures_getByKey(rb, "hunits", nullptr, &status));
if (U_FAILURE(status)) return;
int32_t hunits = ures_getInt(hunits_res.getAlias(), &status);
- const UChar* type = ures_getStringByKey(rb, "type", nullptr, &status);
+ const char16_t* type = ures_getStringByKey(rb, "type", nullptr, &status);
if (U_FAILURE(status)) return;
if (u_strCompare(type, -1, u"codepoints", -1, false) == 0) {
fType = CODE_POINTS;
@@ -419,7 +419,7 @@ LSTMData::LSTMData(UResourceBundle* rb, UErrorCode &status)
int32_t stringLength;
for (int32_t idx = 0; idx < num_index; idx++) {
stringArray.getValue(idx, value);
- const UChar* str = value.getString(stringLength, status);
+ const char16_t* str = value.getString(stringLength, status);
uhash_putiAllowZero(fDict, (void*)str, idx, &status);
if (U_FAILURE(status)) return;
#ifdef LSTM_VECTORIZER_DEBUG
@@ -477,7 +477,7 @@ public:
UVector32 &offsets, UVector32 &indices,
UErrorCode &status) const = 0;
protected:
- int32_t stringToIndex(const UChar* str) const {
+ int32_t stringToIndex(const char16_t* str) const {
UBool found = false;
int32_t ret = uhash_getiAndFound(fDict, (const void*)str, &found);
if (!found) {
@@ -524,13 +524,13 @@ void CodePointsVectorizer::vectorize(
if (U_FAILURE(status)) return;
utext_setNativeIndex(text, startPos);
int32_t current;
- UChar str[2] = {0, 0};
+ char16_t str[2] = {0, 0};
while (U_SUCCESS(status) &&
(current = (int32_t)utext_getNativeIndex(text)) < endPos) {
// Since the LSTMBreakEngine is currently only accept chars in BMP,
// we can ignore the possibility of hitting supplementary code
// point.
- str[0] = (UChar) utext_next32(text);
+ str[0] = (char16_t) utext_next32(text);
U_ASSERT(!U_IS_SURROGATE(str[0]));
offsets.addElement(current, status);
indices.addElement(stringToIndex(str), status);
@@ -576,7 +576,7 @@ void GraphemeClusterVectorizer::vectorize(
}
int32_t last = startPos;
int32_t current = startPos;
- UChar str[MAX_GRAPHEME_CLSTER_LENGTH];
+ char16_t str[MAX_GRAPHEME_CLSTER_LENGTH];
while ((current = graphemeIter->next()) != BreakIterator::DONE) {
if (current >= endPos) {
break;
@@ -777,7 +777,7 @@ LSTMBreakEngine::~LSTMBreakEngine() {
delete fVectorizer;
}
-const UChar* LSTMBreakEngine::name() const {
+const char16_t* LSTMBreakEngine::name() const {
return fData->fName;
}
@@ -846,7 +846,7 @@ U_CAPI void U_EXPORT2 DeleteLSTMData(const LSTMData* data)
delete data;
}
-U_CAPI const UChar* U_EXPORT2 LSTMDataName(const LSTMData* data)
+U_CAPI const char16_t* U_EXPORT2 LSTMDataName(const LSTMData* data)
{
return data->fName;
}
diff --git a/thirdparty/icu4c/common/lstmbe.h b/thirdparty/icu4c/common/lstmbe.h
index ffdf805eca..77c97d85fa 100644
--- a/thirdparty/icu4c/common/lstmbe.h
+++ b/thirdparty/icu4c/common/lstmbe.h
@@ -45,7 +45,7 @@ public:
*/
virtual ~LSTMBreakEngine();
- virtual const UChar* name() const;
+ virtual const char16_t* name() const;
protected:
/**
@@ -79,7 +79,7 @@ U_CAPI const LSTMData* U_EXPORT2 CreateLSTMDataForScript(
UScriptCode script, UErrorCode& status);
U_CAPI void U_EXPORT2 DeleteLSTMData(const LSTMData* data);
-U_CAPI const UChar* U_EXPORT2 LSTMDataName(const LSTMData* data);
+U_CAPI const char16_t* U_EXPORT2 LSTMDataName(const LSTMData* data);
U_NAMESPACE_END
diff --git a/thirdparty/icu4c/common/messagepattern.cpp b/thirdparty/icu4c/common/messagepattern.cpp
index 52afab5f02..82cb638e4e 100644
--- a/thirdparty/icu4c/common/messagepattern.cpp
+++ b/thirdparty/icu4c/common/messagepattern.cpp
@@ -32,56 +32,56 @@ U_NAMESPACE_BEGIN
// Unicode character/code point constants ---------------------------------- ***
-static const UChar u_pound=0x23;
-static const UChar u_apos=0x27;
-static const UChar u_plus=0x2B;
-static const UChar u_comma=0x2C;
-static const UChar u_minus=0x2D;
-static const UChar u_dot=0x2E;
-static const UChar u_colon=0x3A;
-static const UChar u_lessThan=0x3C;
-static const UChar u_equal=0x3D;
-static const UChar u_A=0x41;
-static const UChar u_C=0x43;
-static const UChar u_D=0x44;
-static const UChar u_E=0x45;
-static const UChar u_H=0x48;
-static const UChar u_I=0x49;
-static const UChar u_L=0x4C;
-static const UChar u_N=0x4E;
-static const UChar u_O=0x4F;
-static const UChar u_P=0x50;
-static const UChar u_R=0x52;
-static const UChar u_S=0x53;
-static const UChar u_T=0x54;
-static const UChar u_U=0x55;
-static const UChar u_Z=0x5A;
-static const UChar u_a=0x61;
-static const UChar u_c=0x63;
-static const UChar u_d=0x64;
-static const UChar u_e=0x65;
-static const UChar u_f=0x66;
-static const UChar u_h=0x68;
-static const UChar u_i=0x69;
-static const UChar u_l=0x6C;
-static const UChar u_n=0x6E;
-static const UChar u_o=0x6F;
-static const UChar u_p=0x70;
-static const UChar u_r=0x72;
-static const UChar u_s=0x73;
-static const UChar u_t=0x74;
-static const UChar u_u=0x75;
-static const UChar u_z=0x7A;
-static const UChar u_leftCurlyBrace=0x7B;
-static const UChar u_pipe=0x7C;
-static const UChar u_rightCurlyBrace=0x7D;
-static const UChar u_lessOrEqual=0x2264; // U+2264 is <=
-
-static const UChar kOffsetColon[]={ // "offset:"
+static const char16_t u_pound=0x23;
+static const char16_t u_apos=0x27;
+static const char16_t u_plus=0x2B;
+static const char16_t u_comma=0x2C;
+static const char16_t u_minus=0x2D;
+static const char16_t u_dot=0x2E;
+static const char16_t u_colon=0x3A;
+static const char16_t u_lessThan=0x3C;
+static const char16_t u_equal=0x3D;
+static const char16_t u_A=0x41;
+static const char16_t u_C=0x43;
+static const char16_t u_D=0x44;
+static const char16_t u_E=0x45;
+static const char16_t u_H=0x48;
+static const char16_t u_I=0x49;
+static const char16_t u_L=0x4C;
+static const char16_t u_N=0x4E;
+static const char16_t u_O=0x4F;
+static const char16_t u_P=0x50;
+static const char16_t u_R=0x52;
+static const char16_t u_S=0x53;
+static const char16_t u_T=0x54;
+static const char16_t u_U=0x55;
+static const char16_t u_Z=0x5A;
+static const char16_t u_a=0x61;
+static const char16_t u_c=0x63;
+static const char16_t u_d=0x64;
+static const char16_t u_e=0x65;
+static const char16_t u_f=0x66;
+static const char16_t u_h=0x68;
+static const char16_t u_i=0x69;
+static const char16_t u_l=0x6C;
+static const char16_t u_n=0x6E;
+static const char16_t u_o=0x6F;
+static const char16_t u_p=0x70;
+static const char16_t u_r=0x72;
+static const char16_t u_s=0x73;
+static const char16_t u_t=0x74;
+static const char16_t u_u=0x75;
+static const char16_t u_z=0x7A;
+static const char16_t u_leftCurlyBrace=0x7B;
+static const char16_t u_pipe=0x7C;
+static const char16_t u_rightCurlyBrace=0x7D;
+static const char16_t u_lessOrEqual=0x2264; // U+2264 is <=
+
+static const char16_t kOffsetColon[]={ // "offset:"
u_o, u_f, u_f, u_s, u_e, u_t, u_colon
};
-static const UChar kOther[]={ // "other"
+static const char16_t kOther[]={ // "other"
u_o, u_t, u_h, u_e, u_r
};
@@ -112,7 +112,7 @@ MessagePatternList<T, stackCapacity>::copyFrom(
int32_t length,
UErrorCode &errorCode) {
if(U_SUCCESS(errorCode) && length>0) {
- if(length>a.getCapacity() && NULL==a.resize(length)) {
+ if(length>a.getCapacity() && nullptr==a.resize(length)) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -126,7 +126,7 @@ MessagePatternList<T, stackCapacity>::ensureCapacityForOneMore(int32_t oldLength
if(U_FAILURE(errorCode)) {
return false;
}
- if(a.getCapacity()>oldLength || a.resize(2*oldLength, oldLength)!=NULL) {
+ if(a.getCapacity()>oldLength || a.resize(2*oldLength, oldLength)!=nullptr) {
return true;
}
errorCode=U_MEMORY_ALLOCATION_ERROR;
@@ -145,24 +145,24 @@ class MessagePatternPartsList : public MessagePatternList<MessagePattern::Part,
MessagePattern::MessagePattern(UErrorCode &errorCode)
: aposMode(UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE),
- partsList(NULL), parts(NULL), partsLength(0),
- numericValuesList(NULL), numericValues(NULL), numericValuesLength(0),
+ partsList(nullptr), parts(nullptr), partsLength(0),
+ numericValuesList(nullptr), numericValues(nullptr), numericValuesLength(0),
hasArgNames(false), hasArgNumbers(false), needsAutoQuoting(false) {
init(errorCode);
}
MessagePattern::MessagePattern(UMessagePatternApostropheMode mode, UErrorCode &errorCode)
: aposMode(mode),
- partsList(NULL), parts(NULL), partsLength(0),
- numericValuesList(NULL), numericValues(NULL), numericValuesLength(0),
+ partsList(nullptr), parts(nullptr), partsLength(0),
+ numericValuesList(nullptr), numericValues(nullptr), numericValuesLength(0),
hasArgNames(false), hasArgNumbers(false), needsAutoQuoting(false) {
init(errorCode);
}
MessagePattern::MessagePattern(const UnicodeString &pattern, UParseError *parseError, UErrorCode &errorCode)
: aposMode(UCONFIG_MSGPAT_DEFAULT_APOSTROPHE_MODE),
- partsList(NULL), parts(NULL), partsLength(0),
- numericValuesList(NULL), numericValues(NULL), numericValuesLength(0),
+ partsList(nullptr), parts(nullptr), partsLength(0),
+ numericValuesList(nullptr), numericValues(nullptr), numericValuesLength(0),
hasArgNames(false), hasArgNumbers(false), needsAutoQuoting(false) {
if(init(errorCode)) {
parse(pattern, parseError, errorCode);
@@ -175,7 +175,7 @@ MessagePattern::init(UErrorCode &errorCode) {
return false;
}
partsList=new MessagePatternPartsList();
- if(partsList==NULL) {
+ if(partsList==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -185,8 +185,8 @@ MessagePattern::init(UErrorCode &errorCode) {
MessagePattern::MessagePattern(const MessagePattern &other)
: UObject(other), aposMode(other.aposMode), msg(other.msg),
- partsList(NULL), parts(NULL), partsLength(0),
- numericValuesList(NULL), numericValues(NULL), numericValuesLength(0),
+ partsList(nullptr), parts(nullptr), partsLength(0),
+ numericValuesList(nullptr), numericValues(nullptr), numericValuesLength(0),
hasArgNames(other.hasArgNames), hasArgNumbers(other.hasArgNumbers),
needsAutoQuoting(other.needsAutoQuoting) {
UErrorCode errorCode=U_ZERO_ERROR;
@@ -217,13 +217,13 @@ MessagePattern::copyStorage(const MessagePattern &other, UErrorCode &errorCode)
if(U_FAILURE(errorCode)) {
return false;
}
- parts=NULL;
+ parts=nullptr;
partsLength=0;
- numericValues=NULL;
+ numericValues=nullptr;
numericValuesLength=0;
- if(partsList==NULL) {
+ if(partsList==nullptr) {
partsList=new MessagePatternPartsList();
- if(partsList==NULL) {
+ if(partsList==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -238,9 +238,9 @@ MessagePattern::copyStorage(const MessagePattern &other, UErrorCode &errorCode)
partsLength=other.partsLength;
}
if(other.numericValuesLength>0) {
- if(numericValuesList==NULL) {
+ if(numericValuesList==nullptr) {
numericValuesList=new MessagePatternDoubleList();
- if(numericValuesList==NULL) {
+ if(numericValuesList==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -351,7 +351,7 @@ MessagePattern::autoQuoteApostropheDeep() const {
for(int32_t i=count; i>0;) {
const Part &part=getPart(--i);
if(part.getType()==UMSGPAT_PART_TYPE_INSERT_CHAR) {
- modified.insert(part.index, (UChar)part.value);
+ modified.insert(part.index, (char16_t)part.value);
}
}
return modified;
@@ -407,7 +407,7 @@ MessagePattern::preParse(const UnicodeString &pattern, UParseError *parseError,
if(U_FAILURE(errorCode)) {
return;
}
- if(parseError!=NULL) {
+ if(parseError!=nullptr) {
parseError->line=0;
parseError->offset=0;
parseError->preContext[0]=0;
@@ -422,10 +422,10 @@ MessagePattern::preParse(const UnicodeString &pattern, UParseError *parseError,
void
MessagePattern::postParse() {
- if(partsList!=NULL) {
+ if(partsList!=nullptr) {
parts=partsList->a.getAlias();
}
- if(numericValuesList!=NULL) {
+ if(numericValuesList!=nullptr) {
numericValues=numericValuesList->a.getAlias();
}
}
@@ -451,7 +451,7 @@ MessagePattern::parseMessage(int32_t index, int32_t msgStartLength,
if(index>=msg.length()) {
break;
}
- UChar c=msg.charAt(index++);
+ char16_t c=msg.charAt(index++);
if(c==u_apos) {
if(index==msg.length()) {
// The apostrophe is the last character in the pattern.
@@ -582,7 +582,7 @@ MessagePattern::parseArg(int32_t index, int32_t argStartLength, int32_t nestingL
errorCode=U_UNMATCHED_BRACES;
return 0;
}
- UChar c=msg.charAt(index);
+ char16_t c=msg.charAt(index);
if(c==u_rightCurlyBrace) {
// all done
} else if(c!=u_comma) {
@@ -663,7 +663,7 @@ MessagePattern::parseSimpleStyle(int32_t index, UParseError *parseError, UErrorC
int32_t start=index;
int32_t nestedBraces=0;
while(index<msg.length()) {
- UChar c=msg.charAt(index++);
+ char16_t c=msg.charAt(index++);
if(c==u_apos) {
// Treat apostrophe as quoting but include it in the style part.
// Find the end of the quoted literal text.
@@ -738,7 +738,7 @@ MessagePattern::parseChoiceStyle(int32_t index, int32_t nestingLevel,
errorCode=U_PATTERN_SYNTAX_ERROR;
return 0;
}
- UChar c=msg.charAt(index);
+ char16_t c=msg.charAt(index);
if(!(c==u_pound || c==u_lessThan || c==u_lessOrEqual)) { // U+2264 is <=
setParseError(parseError, start); // Expected choice separator (#<\u2264) instead of c.
errorCode=U_PATTERN_SYNTAX_ERROR;
@@ -895,7 +895,7 @@ MessagePattern::parseArgNumber(const UnicodeString &s, int32_t start, int32_t li
int32_t number;
// Defer numeric errors until we know there are only digits.
UBool badNumber;
- UChar c=s.charAt(start++);
+ char16_t c=s.charAt(start++);
if(c==0x30) {
if(start==limit) {
return 0;
@@ -941,7 +941,7 @@ MessagePattern::parseDouble(int32_t start, int32_t limit, UBool allowInfinity,
int32_t value=0;
int32_t isNegative=0; // not boolean so that we can easily add it to value
int32_t index=start;
- UChar c=msg.charAt(index++);
+ char16_t c=msg.charAt(index++);
if(c==u_minus) {
isNegative=1;
if(index==limit) {
@@ -1004,17 +1004,17 @@ MessagePattern::parseDouble(int32_t start, int32_t limit, UBool allowInfinity,
int32_t
MessagePattern::skipWhiteSpace(int32_t index) {
- const UChar *s=msg.getBuffer();
+ const char16_t *s=msg.getBuffer();
int32_t msgLength=msg.length();
- const UChar *t=PatternProps::skipWhiteSpace(s+index, msgLength-index);
+ const char16_t *t=PatternProps::skipWhiteSpace(s+index, msgLength-index);
return (int32_t)(t-s);
}
int32_t
MessagePattern::skipIdentifier(int32_t index) {
- const UChar *s=msg.getBuffer();
+ const char16_t *s=msg.getBuffer();
int32_t msgLength=msg.length();
- const UChar *t=PatternProps::skipIdentifier(s+index, msgLength-index);
+ const char16_t *t=PatternProps::skipIdentifier(s+index, msgLength-index);
return (int32_t)(t-s);
}
@@ -1022,7 +1022,7 @@ int32_t
MessagePattern::skipDouble(int32_t index) {
int32_t msgLength=msg.length();
while(index<msgLength) {
- UChar c=msg.charAt(index);
+ char16_t c=msg.charAt(index);
// U+221E: Allow the infinity symbol, for ChoiceFormat patterns.
if((c<0x30 && c!=u_plus && c!=u_minus && c!=u_dot) || (c>0x39 && c!=u_e && c!=u_E && c!=0x221e)) {
break;
@@ -1039,7 +1039,7 @@ MessagePattern::isArgTypeChar(UChar32 c) {
UBool
MessagePattern::isChoice(int32_t index) {
- UChar c;
+ char16_t c;
return
((c=msg.charAt(index++))==u_c || c==u_C) &&
((c=msg.charAt(index++))==u_h || c==u_H) &&
@@ -1051,7 +1051,7 @@ MessagePattern::isChoice(int32_t index) {
UBool
MessagePattern::isPlural(int32_t index) {
- UChar c;
+ char16_t c;
return
((c=msg.charAt(index++))==u_p || c==u_P) &&
((c=msg.charAt(index++))==u_l || c==u_L) &&
@@ -1063,7 +1063,7 @@ MessagePattern::isPlural(int32_t index) {
UBool
MessagePattern::isSelect(int32_t index) {
- UChar c;
+ char16_t c;
return
((c=msg.charAt(index++))==u_s || c==u_S) &&
((c=msg.charAt(index++))==u_e || c==u_E) &&
@@ -1075,7 +1075,7 @@ MessagePattern::isSelect(int32_t index) {
UBool
MessagePattern::isOrdinal(int32_t index) {
- UChar c;
+ char16_t c;
return
((c=msg.charAt(index++))==u_o || c==u_O) &&
((c=msg.charAt(index++))==u_r || c==u_R) &&
@@ -1127,9 +1127,9 @@ MessagePattern::addArgDoublePart(double numericValue, int32_t start, int32_t len
return;
}
int32_t numericIndex=numericValuesLength;
- if(numericValuesList==NULL) {
+ if(numericValuesList==nullptr) {
numericValuesList=new MessagePatternDoubleList();
- if(numericValuesList==NULL) {
+ if(numericValuesList==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1147,7 +1147,7 @@ MessagePattern::addArgDoublePart(double numericValue, int32_t start, int32_t len
void
MessagePattern::setParseError(UParseError *parseError, int32_t index) {
- if(parseError==NULL) {
+ if(parseError==nullptr) {
return;
}
parseError->offset=index;
diff --git a/thirdparty/icu4c/common/mlbe.cpp b/thirdparty/icu4c/common/mlbe.cpp
new file mode 100644
index 0000000000..7e734f2c8a
--- /dev/null
+++ b/thirdparty/icu4c/common/mlbe.cpp
@@ -0,0 +1,270 @@
+// © 2022 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#include "unicode/utypes.h"
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
+#include "cmemory.h"
+#include "mlbe.h"
+#include "uassert.h"
+#include "ubrkimpl.h"
+#include "unicode/resbund.h"
+#include "unicode/udata.h"
+#include "unicode/utf16.h"
+#include "uresimp.h"
+#include "util.h"
+#include "uvectr32.h"
+
+U_NAMESPACE_BEGIN
+
+enum class ModelIndex { kUWStart = 0, kBWStart = 6, kTWStart = 9 };
+
+MlBreakEngine::MlBreakEngine(const UnicodeSet &digitOrOpenPunctuationOrAlphabetSet,
+ const UnicodeSet &closePunctuationSet, UErrorCode &status)
+ : fDigitOrOpenPunctuationOrAlphabetSet(digitOrOpenPunctuationOrAlphabetSet),
+ fClosePunctuationSet(closePunctuationSet),
+ fNegativeSum(0) {
+ if (U_FAILURE(status)) {
+ return;
+ }
+ loadMLModel(status);
+}
+
+MlBreakEngine::~MlBreakEngine() {}
+
+int32_t MlBreakEngine::divideUpRange(UText *inText, int32_t rangeStart, int32_t rangeEnd,
+ UVector32 &foundBreaks, const UnicodeString &inString,
+ const LocalPointer<UVector32> &inputMap,
+ UErrorCode &status) const {
+ if (U_FAILURE(status)) {
+ return 0;
+ }
+ if (rangeStart >= rangeEnd) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
+
+ UVector32 boundary(inString.countChar32() + 1, status);
+ if (U_FAILURE(status)) {
+ return 0;
+ }
+ int32_t numBreaks = 0;
+ int32_t codePointLength = inString.countChar32();
+ // The ML algorithm groups six char and evaluates whether the 4th char is a breakpoint.
+ // In each iteration, it evaluates the 4th char and then moves forward one char like a sliding
+ // window. Initially, the first six values in the indexList are [-1, -1, 0, 1, 2, 3]. After
+ // moving forward, finally the last six values in the indexList are
+ // [length-4, length-3, length-2, length-1, -1, -1]. The "+4" here means four extra "-1".
+ int32_t indexSize = codePointLength + 4;
+ int32_t *indexList = (int32_t *)uprv_malloc(indexSize * sizeof(int32_t));
+ if (indexList == nullptr) {
+ status = U_MEMORY_ALLOCATION_ERROR;
+ return 0;
+ }
+ int32_t numCodeUnits = initIndexList(inString, indexList, status);
+
+ // Add a break for the start.
+ boundary.addElement(0, status);
+ numBreaks++;
+ if (U_FAILURE(status)) return 0;
+
+ for (int32_t idx = 0; idx + 1 < codePointLength && U_SUCCESS(status); idx++) {
+ numBreaks =
+ evaluateBreakpoint(inString, indexList, idx, numCodeUnits, numBreaks, boundary, status);
+ if (idx + 4 < codePointLength) {
+ indexList[idx + 6] = numCodeUnits;
+ numCodeUnits += U16_LENGTH(inString.char32At(indexList[idx + 6]));
+ }
+ }
+ uprv_free(indexList);
+
+ if (U_FAILURE(status)) return 0;
+
+ // Add a break for the end if there is not one there already.
+ if (boundary.lastElementi() != inString.countChar32()) {
+ boundary.addElement(inString.countChar32(), status);
+ numBreaks++;
+ }
+
+ int32_t prevCPPos = -1;
+ int32_t prevUTextPos = -1;
+ int32_t correctedNumBreaks = 0;
+ for (int32_t i = 0; i < numBreaks; i++) {
+ int32_t cpPos = boundary.elementAti(i);
+ int32_t utextPos = inputMap.isValid() ? inputMap->elementAti(cpPos) : cpPos + rangeStart;
+ U_ASSERT(cpPos > prevCPPos);
+ U_ASSERT(utextPos >= prevUTextPos);
+
+ if (utextPos > prevUTextPos) {
+ if (utextPos != rangeStart ||
+ (utextPos > 0 &&
+ fClosePunctuationSet.contains(utext_char32At(inText, utextPos - 1)))) {
+ foundBreaks.push(utextPos, status);
+ correctedNumBreaks++;
+ }
+ } else {
+ // Normalization expanded the input text, the dictionary found a boundary
+ // within the expansion, giving two boundaries with the same index in the
+ // original text. Ignore the second. See ticket #12918.
+ --numBreaks;
+ }
+ prevCPPos = cpPos;
+ prevUTextPos = utextPos;
+ }
+ (void)prevCPPos; // suppress compiler warnings about unused variable
+
+ UChar32 nextChar = utext_char32At(inText, rangeEnd);
+ if (!foundBreaks.isEmpty() && foundBreaks.peeki() == rangeEnd) {
+ // In phrase breaking, there has to be a breakpoint between Cj character and
+ // the number/open punctuation.
+ // E.g. る文字「そうだ、京都」->る▁文字▁「そうだ、▁京都」-> breakpoint between 字 and「
+ // E.g. 乗車率90%程度だろうか -> 乗車▁率▁90%▁程度だろうか -> breakpoint between 率 and 9
+ // E.g. しかもロゴがUnicode! -> しかも▁ロゴが▁Unicode!-> breakpoint between が and U
+ if (!fDigitOrOpenPunctuationOrAlphabetSet.contains(nextChar)) {
+ foundBreaks.popi();
+ correctedNumBreaks--;
+ }
+ }
+
+ return correctedNumBreaks;
+}
+
+int32_t MlBreakEngine::evaluateBreakpoint(const UnicodeString &inString, int32_t *indexList,
+ int32_t startIdx, int32_t numCodeUnits, int32_t numBreaks,
+ UVector32 &boundary, UErrorCode &status) const {
+ if (U_FAILURE(status)) {
+ return numBreaks;
+ }
+ int32_t start = 0, end = 0;
+ int32_t score = fNegativeSum;
+
+ for (int i = 0; i < 6; i++) {
+ // UW1 ~ UW6
+ start = startIdx + i;
+ if (indexList[start] != -1) {
+ end = (indexList[start + 1] != -1) ? indexList[start + 1] : numCodeUnits;
+ score += fModel[static_cast<int32_t>(ModelIndex::kUWStart) + i].geti(
+ inString.tempSubString(indexList[start], end - indexList[start]));
+ }
+ }
+ for (int i = 0; i < 3; i++) {
+ // BW1 ~ BW3
+ start = startIdx + i + 1;
+ if (indexList[start] != -1 && indexList[start + 1] != -1) {
+ end = (indexList[start + 2] != -1) ? indexList[start + 2] : numCodeUnits;
+ score += fModel[static_cast<int32_t>(ModelIndex::kBWStart) + i].geti(
+ inString.tempSubString(indexList[start], end - indexList[start]));
+ }
+ }
+ for (int i = 0; i < 4; i++) {
+ // TW1 ~ TW4
+ start = startIdx + i;
+ if (indexList[start] != -1 && indexList[start + 1] != -1 && indexList[start + 2] != -1) {
+ end = (indexList[start + 3] != -1) ? indexList[start + 3] : numCodeUnits;
+ score += fModel[static_cast<int32_t>(ModelIndex::kTWStart) + i].geti(
+ inString.tempSubString(indexList[start], end - indexList[start]));
+ }
+ }
+
+ if (score > 0) {
+ boundary.addElement(startIdx + 1, status);
+ numBreaks++;
+ }
+ return numBreaks;
+}
+
+int32_t MlBreakEngine::initIndexList(const UnicodeString &inString, int32_t *indexList,
+ UErrorCode &status) const {
+ if (U_FAILURE(status)) {
+ return 0;
+ }
+ int32_t index = 0;
+ int32_t length = inString.countChar32();
+ // Set all (lenght+4) items inside indexLength to -1 presuming -1 is 4 bytes of 0xff.
+ uprv_memset(indexList, 0xff, (length + 4) * sizeof(int32_t));
+ if (length > 0) {
+ indexList[2] = 0;
+ index = U16_LENGTH(inString.char32At(0));
+ if (length > 1) {
+ indexList[3] = index;
+ index += U16_LENGTH(inString.char32At(index));
+ if (length > 2) {
+ indexList[4] = index;
+ index += U16_LENGTH(inString.char32At(index));
+ if (length > 3) {
+ indexList[5] = index;
+ index += U16_LENGTH(inString.char32At(index));
+ }
+ }
+ }
+ }
+ return index;
+}
+
+void MlBreakEngine::loadMLModel(UErrorCode &error) {
+ // BudouX's model consists of thirteen categories, each of which is make up of pairs of the
+ // feature and its score. As integrating it into jaml.txt, we define thirteen kinds of key and
+ // value to represent the feature and the corresponding score respectively.
+
+ if (U_FAILURE(error)) return;
+
+ UnicodeString key;
+ StackUResourceBundle stackTempBundle;
+ ResourceDataValue modelKey;
+
+ LocalUResourceBundlePointer rbp(ures_openDirect(U_ICUDATA_BRKITR, "jaml", &error));
+ UResourceBundle *rb = rbp.getAlias();
+ if (U_FAILURE(error)) return;
+
+ int32_t index = 0;
+ initKeyValue(rb, "UW1Keys", "UW1Values", fModel[index++], error);
+ initKeyValue(rb, "UW2Keys", "UW2Values", fModel[index++], error);
+ initKeyValue(rb, "UW3Keys", "UW3Values", fModel[index++], error);
+ initKeyValue(rb, "UW4Keys", "UW4Values", fModel[index++], error);
+ initKeyValue(rb, "UW5Keys", "UW5Values", fModel[index++], error);
+ initKeyValue(rb, "UW6Keys", "UW6Values", fModel[index++], error);
+ initKeyValue(rb, "BW1Keys", "BW1Values", fModel[index++], error);
+ initKeyValue(rb, "BW2Keys", "BW2Values", fModel[index++], error);
+ initKeyValue(rb, "BW3Keys", "BW3Values", fModel[index++], error);
+ initKeyValue(rb, "TW1Keys", "TW1Values", fModel[index++], error);
+ initKeyValue(rb, "TW2Keys", "TW2Values", fModel[index++], error);
+ initKeyValue(rb, "TW3Keys", "TW3Values", fModel[index++], error);
+ initKeyValue(rb, "TW4Keys", "TW4Values", fModel[index++], error);
+ fNegativeSum /= 2;
+}
+
+void MlBreakEngine::initKeyValue(UResourceBundle *rb, const char *keyName, const char *valueName,
+ Hashtable &model, UErrorCode &error) {
+ int32_t keySize = 0;
+ int32_t valueSize = 0;
+ int32_t stringLength = 0;
+ UnicodeString key;
+ StackUResourceBundle stackTempBundle;
+ ResourceDataValue modelKey;
+
+ // get modelValues
+ LocalUResourceBundlePointer modelValue(ures_getByKey(rb, valueName, nullptr, &error));
+ const int32_t *value = ures_getIntVector(modelValue.getAlias(), &valueSize, &error);
+ if (U_FAILURE(error)) return;
+
+ // get modelKeys
+ ures_getValueWithFallback(rb, keyName, stackTempBundle.getAlias(), modelKey, error);
+ ResourceArray stringArray = modelKey.getArray(error);
+ keySize = stringArray.getSize();
+ if (U_FAILURE(error)) return;
+
+ for (int32_t idx = 0; idx < keySize; idx++) {
+ stringArray.getValue(idx, modelKey);
+ key = UnicodeString(modelKey.getString(stringLength, error));
+ if (U_SUCCESS(error)) {
+ U_ASSERT(idx < valueSize);
+ fNegativeSum -= value[idx];
+ model.puti(key, value[idx], error);
+ }
+ }
+}
+
+U_NAMESPACE_END
+
+#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
diff --git a/thirdparty/icu4c/common/mlbe.h b/thirdparty/icu4c/common/mlbe.h
new file mode 100644
index 0000000000..38de47e5f5
--- /dev/null
+++ b/thirdparty/icu4c/common/mlbe.h
@@ -0,0 +1,116 @@
+// © 2022 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
+
+#ifndef MLBREAKENGINE_H
+#define MLBREAKENGINE_H
+
+#include "hash.h"
+#include "unicode/resbund.h"
+#include "unicode/uniset.h"
+#include "unicode/utext.h"
+#include "uvectr32.h"
+
+U_NAMESPACE_BEGIN
+
+#if !UCONFIG_NO_BREAK_ITERATION
+
+/**
+ * A machine learning break engine for the phrase breaking in Japanese.
+ */
+class MlBreakEngine : public UMemory {
+ public:
+ /**
+ * Constructor.
+ *
+ * @param digitOrOpenPunctuationOrAlphabetSet An UnicodeSet with the digit, open punctuation and
+ * alphabet.
+ * @param closePunctuationSet An UnicodeSet with close punctuation.
+ * @param status Information on any errors encountered.
+ */
+ MlBreakEngine(const UnicodeSet &digitOrOpenPunctuationOrAlphabetSet,
+ const UnicodeSet &closePunctuationSet, UErrorCode &status);
+
+ /**
+ * Virtual destructor.
+ */
+ virtual ~MlBreakEngine();
+
+ public:
+ /**
+ * Divide up a range of characters handled by this break engine.
+ *
+ * @param inText A UText representing the text
+ * @param rangeStart The start of the range of the characters
+ * @param rangeEnd The end of the range of the characters
+ * @param foundBreaks Output of C array of int32_t break positions, or 0
+ * @param inString The normalized string of text ranging from rangeStart to rangeEnd
+ * @param inputMap The vector storing the native index of inText
+ * @param status Information on any errors encountered.
+ * @return The number of breaks found
+ */
+ int32_t divideUpRange(UText *inText, int32_t rangeStart, int32_t rangeEnd,
+ UVector32 &foundBreaks, const UnicodeString &inString,
+ const LocalPointer<UVector32> &inputMap, UErrorCode &status) const;
+
+ private:
+ /**
+ * Load the machine learning's model file.
+ *
+ * @param error Information on any errors encountered.
+ */
+ void loadMLModel(UErrorCode &error);
+
+ /**
+ * In the machine learning's model file, specify the name of the key and value to load the
+ * corresponding feature and its score.
+ *
+ * @param rb A ResouceBundle corresponding to the model file.
+ * @param keyName The kay name in the model file.
+ * @param valueName The value name in the model file.
+ * @param model A hashtable to store the pairs of the feature and its score.
+ * @param error Information on any errors encountered.
+ */
+ void initKeyValue(UResourceBundle *rb, const char *keyName, const char *valueName,
+ Hashtable &model, UErrorCode &error);
+
+ /**
+ * Initialize the index list from the input string.
+ *
+ * @param inString A input string to be segmented.
+ * @param indexList A code unit index list of inString.
+ * @param status Information on any errors encountered.
+ * @return The number of code units of the first four characters in inString.
+ */
+ int32_t initIndexList(const UnicodeString &inString, int32_t *indexList,
+ UErrorCode &status) const;
+
+ /**
+ * Evaluate whether the index is a potential breakpoint.
+ *
+ * @param inString A input string to be segmented.
+ * @param indexList A code unit index list of the inString.
+ * @param startIdx The start index of the indexList.
+ * @param numCodeUnits The current code unit boundary of the indexList.
+ * @param numBreaks The accumulated number of breakpoints.
+ * @param boundary A vector including the index of the breakpoint.
+ * @param status Information on any errors encountered.
+ * @return The number of breakpoints
+ */
+ int32_t evaluateBreakpoint(const UnicodeString &inString, int32_t *indexList, int32_t startIdx,
+ int32_t numCodeUnits, int32_t numBreaks, UVector32 &boundary,
+ UErrorCode &status) const;
+
+ void printUnicodeString(const UnicodeString &s) const;
+
+ UnicodeSet fDigitOrOpenPunctuationOrAlphabetSet;
+ UnicodeSet fClosePunctuationSet;
+ Hashtable fModel[13]; // {UW1, UW2, ... UW6, BW1, ... BW3, TW1, TW2, ... TW4} 6+3+4= 13
+ int32_t fNegativeSum;
+};
+
+#endif
+
+U_NAMESPACE_END
+
+/* MLBREAKENGINE_H */
+#endif
diff --git a/thirdparty/icu4c/common/norm2allmodes.h b/thirdparty/icu4c/common/norm2allmodes.h
index 584835da57..6347fba9cb 100644
--- a/thirdparty/icu4c/common/norm2allmodes.h
+++ b/thirdparty/icu4c/common/norm2allmodes.h
@@ -38,13 +38,13 @@ public:
virtual UnicodeString &
normalize(const UnicodeString &src,
UnicodeString &dest,
- UErrorCode &errorCode) const U_OVERRIDE {
+ UErrorCode &errorCode) const override {
if(U_FAILURE(errorCode)) {
dest.setToBogus();
return dest;
}
- const UChar *sArray=src.getBuffer();
- if(&dest==&src || sArray==NULL) {
+ const char16_t *sArray=src.getBuffer();
+ if(&dest==&src || sArray==nullptr) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
dest.setToBogus();
return dest;
@@ -57,20 +57,20 @@ public:
return dest;
}
virtual void
- normalize(const UChar *src, const UChar *limit,
+ normalize(const char16_t *src, const char16_t *limit,
ReorderingBuffer &buffer, UErrorCode &errorCode) const = 0;
// normalize and append
virtual UnicodeString &
normalizeSecondAndAppend(UnicodeString &first,
const UnicodeString &second,
- UErrorCode &errorCode) const U_OVERRIDE {
+ UErrorCode &errorCode) const override {
return normalizeSecondAndAppend(first, second, true, errorCode);
}
virtual UnicodeString &
append(UnicodeString &first,
const UnicodeString &second,
- UErrorCode &errorCode) const U_OVERRIDE {
+ UErrorCode &errorCode) const override {
return normalizeSecondAndAppend(first, second, false, errorCode);
}
UnicodeString &
@@ -82,8 +82,8 @@ public:
if(U_FAILURE(errorCode)) {
return first;
}
- const UChar *secondArray=second.getBuffer();
- if(&first==&second || secondArray==NULL) {
+ const char16_t *secondArray=second.getBuffer();
+ if(&first==&second || secondArray==nullptr) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return first;
}
@@ -103,15 +103,15 @@ public:
return first;
}
virtual void
- normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize,
+ normalizeAndAppend(const char16_t *src, const char16_t *limit, UBool doNormalize,
UnicodeString &safeMiddle,
ReorderingBuffer &buffer, UErrorCode &errorCode) const = 0;
virtual UBool
- getDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE {
- UChar buffer[4];
+ getDecomposition(UChar32 c, UnicodeString &decomposition) const override {
+ char16_t buffer[4];
int32_t length;
- const UChar *d=impl.getDecomposition(c, buffer, length);
- if(d==NULL) {
+ const char16_t *d=impl.getDecomposition(c, buffer, length);
+ if(d==nullptr) {
return false;
}
if(d==buffer) {
@@ -122,11 +122,11 @@ public:
return true;
}
virtual UBool
- getRawDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE {
- UChar buffer[30];
+ getRawDecomposition(UChar32 c, UnicodeString &decomposition) const override {
+ char16_t buffer[30];
int32_t length;
- const UChar *d=impl.getRawDecomposition(c, buffer, length);
- if(d==NULL) {
+ const char16_t *d=impl.getRawDecomposition(c, buffer, length);
+ if(d==nullptr) {
return false;
}
if(d==buffer) {
@@ -137,47 +137,47 @@ public:
return true;
}
virtual UChar32
- composePair(UChar32 a, UChar32 b) const U_OVERRIDE {
+ composePair(UChar32 a, UChar32 b) const override {
return impl.composePair(a, b);
}
virtual uint8_t
- getCombiningClass(UChar32 c) const U_OVERRIDE {
+ getCombiningClass(UChar32 c) const override {
return impl.getCC(impl.getNorm16(c));
}
// quick checks
virtual UBool
- isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE {
+ isNormalized(const UnicodeString &s, UErrorCode &errorCode) const override {
if(U_FAILURE(errorCode)) {
return false;
}
- const UChar *sArray=s.getBuffer();
- if(sArray==NULL) {
+ const char16_t *sArray=s.getBuffer();
+ if(sArray==nullptr) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return false;
}
- const UChar *sLimit=sArray+s.length();
+ const char16_t *sLimit=sArray+s.length();
return sLimit==spanQuickCheckYes(sArray, sLimit, errorCode);
}
virtual UNormalizationCheckResult
- quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE {
+ quickCheck(const UnicodeString &s, UErrorCode &errorCode) const override {
return Normalizer2WithImpl::isNormalized(s, errorCode) ? UNORM_YES : UNORM_NO;
}
virtual int32_t
- spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE {
+ spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const override {
if(U_FAILURE(errorCode)) {
return 0;
}
- const UChar *sArray=s.getBuffer();
- if(sArray==NULL) {
+ const char16_t *sArray=s.getBuffer();
+ if(sArray==nullptr) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
return (int32_t)(spanQuickCheckYes(sArray, sArray+s.length(), errorCode)-sArray);
}
- virtual const UChar *
- spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const = 0;
+ virtual const char16_t *
+ spanQuickCheckYes(const char16_t *src, const char16_t *limit, UErrorCode &errorCode) const = 0;
virtual UNormalizationCheckResult getQuickCheck(UChar32) const {
return UNORM_YES;
@@ -193,21 +193,21 @@ public:
private:
virtual void
- normalize(const UChar *src, const UChar *limit,
- ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE {
+ normalize(const char16_t *src, const char16_t *limit,
+ ReorderingBuffer &buffer, UErrorCode &errorCode) const override {
impl.decompose(src, limit, &buffer, errorCode);
}
using Normalizer2WithImpl::normalize; // Avoid warning about hiding base class function.
virtual void
- normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize,
+ normalizeAndAppend(const char16_t *src, const char16_t *limit, UBool doNormalize,
UnicodeString &safeMiddle,
- ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE {
+ ReorderingBuffer &buffer, UErrorCode &errorCode) const override {
impl.decomposeAndAppend(src, limit, doNormalize, safeMiddle, buffer, errorCode);
}
void
normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
- Edits *edits, UErrorCode &errorCode) const U_OVERRIDE {
+ Edits *edits, UErrorCode &errorCode) const override {
if (U_FAILURE(errorCode)) {
return;
}
@@ -219,7 +219,7 @@ private:
sink.Flush();
}
virtual UBool
- isNormalizedUTF8(StringPiece sp, UErrorCode &errorCode) const U_OVERRIDE {
+ isNormalizedUTF8(StringPiece sp, UErrorCode &errorCode) const override {
if(U_FAILURE(errorCode)) {
return false;
}
@@ -228,21 +228,21 @@ private:
return sLimit == impl.decomposeUTF8(0, s, sLimit, nullptr, nullptr, errorCode);
}
- virtual const UChar *
- spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const U_OVERRIDE {
- return impl.decompose(src, limit, NULL, errorCode);
+ virtual const char16_t *
+ spanQuickCheckYes(const char16_t *src, const char16_t *limit, UErrorCode &errorCode) const override {
+ return impl.decompose(src, limit, nullptr, errorCode);
}
using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function.
- virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const U_OVERRIDE {
+ virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const override {
return impl.isDecompYes(impl.getNorm16(c)) ? UNORM_YES : UNORM_NO;
}
- virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE {
+ virtual UBool hasBoundaryBefore(UChar32 c) const override {
return impl.hasDecompBoundaryBefore(c);
}
- virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE {
+ virtual UBool hasBoundaryAfter(UChar32 c) const override {
return impl.hasDecompBoundaryAfter(c);
}
- virtual UBool isInert(UChar32 c) const U_OVERRIDE {
+ virtual UBool isInert(UChar32 c) const override {
return impl.isDecompInert(c);
}
};
@@ -255,15 +255,15 @@ public:
private:
virtual void
- normalize(const UChar *src, const UChar *limit,
- ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE {
+ normalize(const char16_t *src, const char16_t *limit,
+ ReorderingBuffer &buffer, UErrorCode &errorCode) const override {
impl.compose(src, limit, onlyContiguous, true, buffer, errorCode);
}
using Normalizer2WithImpl::normalize; // Avoid warning about hiding base class function.
void
normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
- Edits *edits, UErrorCode &errorCode) const U_OVERRIDE {
+ Edits *edits, UErrorCode &errorCode) const override {
if (U_FAILURE(errorCode)) {
return;
}
@@ -277,19 +277,19 @@ private:
}
virtual void
- normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize,
+ normalizeAndAppend(const char16_t *src, const char16_t *limit, UBool doNormalize,
UnicodeString &safeMiddle,
- ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE {
+ ReorderingBuffer &buffer, UErrorCode &errorCode) const override {
impl.composeAndAppend(src, limit, doNormalize, onlyContiguous, safeMiddle, buffer, errorCode);
}
virtual UBool
- isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE {
+ isNormalized(const UnicodeString &s, UErrorCode &errorCode) const override {
if(U_FAILURE(errorCode)) {
return false;
}
- const UChar *sArray=s.getBuffer();
- if(sArray==NULL) {
+ const char16_t *sArray=s.getBuffer();
+ if(sArray==nullptr) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return false;
}
@@ -301,7 +301,7 @@ private:
return impl.compose(sArray, sArray+s.length(), onlyContiguous, false, buffer, errorCode);
}
virtual UBool
- isNormalizedUTF8(StringPiece sp, UErrorCode &errorCode) const U_OVERRIDE {
+ isNormalizedUTF8(StringPiece sp, UErrorCode &errorCode) const override {
if(U_FAILURE(errorCode)) {
return false;
}
@@ -309,12 +309,12 @@ private:
return impl.composeUTF8(0, onlyContiguous, s, s + sp.length(), nullptr, nullptr, errorCode);
}
virtual UNormalizationCheckResult
- quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE {
+ quickCheck(const UnicodeString &s, UErrorCode &errorCode) const override {
if(U_FAILURE(errorCode)) {
return UNORM_MAYBE;
}
- const UChar *sArray=s.getBuffer();
- if(sArray==NULL) {
+ const char16_t *sArray=s.getBuffer();
+ if(sArray==nullptr) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return UNORM_MAYBE;
}
@@ -322,21 +322,21 @@ private:
impl.composeQuickCheck(sArray, sArray+s.length(), onlyContiguous, &qcResult);
return qcResult;
}
- virtual const UChar *
- spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &) const U_OVERRIDE {
- return impl.composeQuickCheck(src, limit, onlyContiguous, NULL);
+ virtual const char16_t *
+ spanQuickCheckYes(const char16_t *src, const char16_t *limit, UErrorCode &) const override {
+ return impl.composeQuickCheck(src, limit, onlyContiguous, nullptr);
}
using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function.
- virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const U_OVERRIDE {
+ virtual UNormalizationCheckResult getQuickCheck(UChar32 c) const override {
return impl.getCompQuickCheck(impl.getNorm16(c));
}
- virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE {
+ virtual UBool hasBoundaryBefore(UChar32 c) const override {
return impl.hasCompBoundaryBefore(c);
}
- virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE {
+ virtual UBool hasBoundaryAfter(UChar32 c) const override {
return impl.hasCompBoundaryAfter(c, onlyContiguous);
}
- virtual UBool isInert(UChar32 c) const U_OVERRIDE {
+ virtual UBool isInert(UChar32 c) const override {
return impl.isCompInert(c, onlyContiguous);
}
@@ -350,29 +350,29 @@ public:
private:
virtual void
- normalize(const UChar *src, const UChar *limit,
- ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE {
+ normalize(const char16_t *src, const char16_t *limit,
+ ReorderingBuffer &buffer, UErrorCode &errorCode) const override {
impl.makeFCD(src, limit, &buffer, errorCode);
}
using Normalizer2WithImpl::normalize; // Avoid warning about hiding base class function.
virtual void
- normalizeAndAppend(const UChar *src, const UChar *limit, UBool doNormalize,
+ normalizeAndAppend(const char16_t *src, const char16_t *limit, UBool doNormalize,
UnicodeString &safeMiddle,
- ReorderingBuffer &buffer, UErrorCode &errorCode) const U_OVERRIDE {
+ ReorderingBuffer &buffer, UErrorCode &errorCode) const override {
impl.makeFCDAndAppend(src, limit, doNormalize, safeMiddle, buffer, errorCode);
}
- virtual const UChar *
- spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const U_OVERRIDE {
- return impl.makeFCD(src, limit, NULL, errorCode);
+ virtual const char16_t *
+ spanQuickCheckYes(const char16_t *src, const char16_t *limit, UErrorCode &errorCode) const override {
+ return impl.makeFCD(src, limit, nullptr, errorCode);
}
using Normalizer2WithImpl::spanQuickCheckYes; // Avoid warning about hiding base class function.
- virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE {
+ virtual UBool hasBoundaryBefore(UChar32 c) const override {
return impl.hasFCDBoundaryBefore(c);
}
- virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE {
+ virtual UBool hasBoundaryAfter(UChar32 c) const override {
return impl.hasFCDBoundaryAfter(c);
}
- virtual UBool isInert(UChar32 c) const U_OVERRIDE {
+ virtual UBool isInert(UChar32 c) const override {
return impl.isFCDInert(c);
}
};
diff --git a/thirdparty/icu4c/common/normalizer2.cpp b/thirdparty/icu4c/common/normalizer2.cpp
index 3617264490..6856736b88 100644
--- a/thirdparty/icu4c/common/normalizer2.cpp
+++ b/thirdparty/icu4c/common/normalizer2.cpp
@@ -87,7 +87,7 @@ class NoopNormalizer2 : public Normalizer2 {
virtual UnicodeString &
normalize(const UnicodeString &src,
UnicodeString &dest,
- UErrorCode &errorCode) const U_OVERRIDE {
+ UErrorCode &errorCode) const override {
if(U_SUCCESS(errorCode)) {
if(&dest!=&src) {
dest=src;
@@ -99,7 +99,7 @@ class NoopNormalizer2 : public Normalizer2 {
}
virtual void
normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
- Edits *edits, UErrorCode &errorCode) const U_OVERRIDE {
+ Edits *edits, UErrorCode &errorCode) const override {
if(U_SUCCESS(errorCode)) {
if (edits != nullptr) {
if ((options & U_EDITS_NO_RESET) == 0) {
@@ -117,7 +117,7 @@ class NoopNormalizer2 : public Normalizer2 {
virtual UnicodeString &
normalizeSecondAndAppend(UnicodeString &first,
const UnicodeString &second,
- UErrorCode &errorCode) const U_OVERRIDE {
+ UErrorCode &errorCode) const override {
if(U_SUCCESS(errorCode)) {
if(&first!=&second) {
first.append(second);
@@ -130,7 +130,7 @@ class NoopNormalizer2 : public Normalizer2 {
virtual UnicodeString &
append(UnicodeString &first,
const UnicodeString &second,
- UErrorCode &errorCode) const U_OVERRIDE {
+ UErrorCode &errorCode) const override {
if(U_SUCCESS(errorCode)) {
if(&first!=&second) {
first.append(second);
@@ -141,29 +141,29 @@ class NoopNormalizer2 : public Normalizer2 {
return first;
}
virtual UBool
- getDecomposition(UChar32, UnicodeString &) const U_OVERRIDE {
+ getDecomposition(UChar32, UnicodeString &) const override {
return false;
}
- // No need to U_OVERRIDE the default getRawDecomposition().
+ // No need to override the default getRawDecomposition().
virtual UBool
- isNormalized(const UnicodeString &, UErrorCode &errorCode) const U_OVERRIDE {
+ isNormalized(const UnicodeString &, UErrorCode &errorCode) const override {
return U_SUCCESS(errorCode);
}
virtual UBool
- isNormalizedUTF8(StringPiece, UErrorCode &errorCode) const U_OVERRIDE {
+ isNormalizedUTF8(StringPiece, UErrorCode &errorCode) const override {
return U_SUCCESS(errorCode);
}
virtual UNormalizationCheckResult
- quickCheck(const UnicodeString &, UErrorCode &) const U_OVERRIDE {
+ quickCheck(const UnicodeString &, UErrorCode &) const override {
return UNORM_YES;
}
virtual int32_t
- spanQuickCheckYes(const UnicodeString &s, UErrorCode &) const U_OVERRIDE {
+ spanQuickCheckYes(const UnicodeString &s, UErrorCode &) const override {
return s.length();
}
- virtual UBool hasBoundaryBefore(UChar32) const U_OVERRIDE { return true; }
- virtual UBool hasBoundaryAfter(UChar32) const U_OVERRIDE { return true; }
- virtual UBool isInert(UChar32) const U_OVERRIDE { return true; }
+ virtual UBool hasBoundaryBefore(UChar32) const override { return true; }
+ virtual UBool hasBoundaryAfter(UChar32) const override { return true; }
+ virtual UBool isInert(UChar32) const override { return true; }
};
NoopNormalizer2::~NoopNormalizer2() {}
@@ -190,7 +190,7 @@ static void U_CALLCONV initNoopSingleton(UErrorCode &errorCode) {
return;
}
noopSingleton=new NoopNormalizer2;
- if(noopSingleton==NULL) {
+ if(noopSingleton==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -198,7 +198,7 @@ static void U_CALLCONV initNoopSingleton(UErrorCode &errorCode) {
}
const Normalizer2 *Normalizer2Factory::getNoopInstance(UErrorCode &errorCode) {
- if(U_FAILURE(errorCode)) { return NULL; }
+ if(U_FAILURE(errorCode)) { return nullptr; }
umtx_initOnce(noopInitOnce, &initNoopSingleton, errorCode);
return noopSingleton;
}
@@ -216,13 +216,13 @@ Norm2AllModes *
Norm2AllModes::createInstance(Normalizer2Impl *impl, UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
delete impl;
- return NULL;
+ return nullptr;
}
Norm2AllModes *allModes=new Norm2AllModes(impl);
- if(allModes==NULL) {
+ if(allModes==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
delete impl;
- return NULL;
+ return nullptr;
}
return allModes;
}
@@ -231,12 +231,12 @@ Norm2AllModes::createInstance(Normalizer2Impl *impl, UErrorCode &errorCode) {
Norm2AllModes *
Norm2AllModes::createNFCInstance(UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
- return NULL;
+ return nullptr;
}
Normalizer2Impl *impl=new Normalizer2Impl;
- if(impl==NULL) {
+ if(impl==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
impl->init(norm2_nfc_data_indexes, &norm2_nfc_data_trie,
norm2_nfc_data_extraData, norm2_nfc_data_smallFCD);
@@ -254,7 +254,7 @@ static void U_CALLCONV initNFCSingleton(UErrorCode &errorCode) {
const Norm2AllModes *
Norm2AllModes::getNFCInstance(UErrorCode &errorCode) {
- if(U_FAILURE(errorCode)) { return NULL; }
+ if(U_FAILURE(errorCode)) { return nullptr; }
umtx_initOnce(nfcInitOnce, &initNFCSingleton, errorCode);
return nfcSingleton;
}
@@ -262,29 +262,29 @@ Norm2AllModes::getNFCInstance(UErrorCode &errorCode) {
const Normalizer2 *
Normalizer2::getNFCInstance(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
- return allModes!=NULL ? &allModes->comp : NULL;
+ return allModes!=nullptr ? &allModes->comp : nullptr;
}
const Normalizer2 *
Normalizer2::getNFDInstance(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
- return allModes!=NULL ? &allModes->decomp : NULL;
+ return allModes!=nullptr ? &allModes->decomp : nullptr;
}
const Normalizer2 *Normalizer2Factory::getFCDInstance(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
- return allModes!=NULL ? &allModes->fcd : NULL;
+ return allModes!=nullptr ? &allModes->fcd : nullptr;
}
const Normalizer2 *Normalizer2Factory::getFCCInstance(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
- return allModes!=NULL ? &allModes->fcc : NULL;
+ return allModes!=nullptr ? &allModes->fcc : nullptr;
}
const Normalizer2Impl *
Normalizer2Factory::getNFCImpl(UErrorCode &errorCode) {
const Norm2AllModes *allModes=Norm2AllModes::getNFCInstance(errorCode);
- return allModes!=NULL ? allModes->impl : NULL;
+ return allModes!=nullptr ? allModes->impl : nullptr;
}
#endif // NORM2_HARDCODE_NFC_DATA
@@ -292,11 +292,11 @@ U_CDECL_BEGIN
static UBool U_CALLCONV uprv_normalizer2_cleanup() {
delete noopSingleton;
- noopSingleton = NULL;
+ noopSingleton = nullptr;
noopInitOnce.reset();
#if NORM2_HARDCODE_NFC_DATA
delete nfcSingleton;
- nfcSingleton = NULL;
+ nfcSingleton = nullptr;
nfcInitOnce.reset();
#endif
return true;
@@ -327,29 +327,29 @@ unorm2_close(UNormalizer2 *norm2) {
U_CAPI int32_t U_EXPORT2
unorm2_normalize(const UNormalizer2 *norm2,
- const UChar *src, int32_t length,
- UChar *dest, int32_t capacity,
+ const char16_t *src, int32_t length,
+ char16_t *dest, int32_t capacity,
UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
return 0;
}
- if( (src==NULL ? length!=0 : length<-1) ||
- (dest==NULL ? capacity!=0 : capacity<0) ||
- (src==dest && src!=NULL)
+ if( (src==nullptr ? length!=0 : length<-1) ||
+ (dest==nullptr ? capacity!=0 : capacity<0) ||
+ (src==dest && src!=nullptr)
) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
UnicodeString destString(dest, 0, capacity);
- // length==0: Nothing to do, and n2wi->normalize(NULL, NULL, buffer, ...) would crash.
+ // length==0: Nothing to do, and n2wi->normalize(nullptr, nullptr, buffer, ...) would crash.
if(length!=0) {
const Normalizer2 *n2=(const Normalizer2 *)norm2;
const Normalizer2WithImpl *n2wi=dynamic_cast<const Normalizer2WithImpl *>(n2);
- if(n2wi!=NULL) {
+ if(n2wi!=nullptr) {
// Avoid duplicate argument checking and support NUL-terminated src.
ReorderingBuffer buffer(n2wi->impl, destString);
if(buffer.init(length, *pErrorCode)) {
- n2wi->normalize(src, length>=0 ? src+length : NULL, buffer, *pErrorCode);
+ n2wi->normalize(src, length>=0 ? src+length : nullptr, buffer, *pErrorCode);
}
} else {
UnicodeString srcString(length<0, src, length);
@@ -361,34 +361,34 @@ unorm2_normalize(const UNormalizer2 *norm2,
static int32_t
normalizeSecondAndAppend(const UNormalizer2 *norm2,
- UChar *first, int32_t firstLength, int32_t firstCapacity,
- const UChar *second, int32_t secondLength,
+ char16_t *first, int32_t firstLength, int32_t firstCapacity,
+ const char16_t *second, int32_t secondLength,
UBool doNormalize,
UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
return 0;
}
- if( (second==NULL ? secondLength!=0 : secondLength<-1) ||
- (first==NULL ? (firstCapacity!=0 || firstLength!=0) :
+ if( (second==nullptr ? secondLength!=0 : secondLength<-1) ||
+ (first==nullptr ? (firstCapacity!=0 || firstLength!=0) :
(firstCapacity<0 || firstLength<-1)) ||
- (first==second && first!=NULL)
+ (first==second && first!=nullptr)
) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
UnicodeString firstString(first, firstLength, firstCapacity);
firstLength=firstString.length(); // In case it was -1.
- // secondLength==0: Nothing to do, and n2wi->normalizeAndAppend(NULL, NULL, buffer, ...) would crash.
+ // secondLength==0: Nothing to do, and n2wi->normalizeAndAppend(nullptr, nullptr, buffer, ...) would crash.
if(secondLength!=0) {
const Normalizer2 *n2=(const Normalizer2 *)norm2;
const Normalizer2WithImpl *n2wi=dynamic_cast<const Normalizer2WithImpl *>(n2);
- if(n2wi!=NULL) {
+ if(n2wi!=nullptr) {
// Avoid duplicate argument checking and support NUL-terminated src.
UnicodeString safeMiddle;
{
ReorderingBuffer buffer(n2wi->impl, firstString);
if(buffer.init(firstLength+secondLength+1, *pErrorCode)) { // destCapacity>=-1
- n2wi->normalizeAndAppend(second, secondLength>=0 ? second+secondLength : NULL,
+ n2wi->normalizeAndAppend(second, secondLength>=0 ? second+secondLength : nullptr,
doNormalize, safeMiddle, buffer, *pErrorCode);
}
} // The ReorderingBuffer destructor finalizes firstString.
@@ -396,7 +396,7 @@ normalizeSecondAndAppend(const UNormalizer2 *norm2,
// Restore the modified suffix of the first string.
// This does not restore first[] array contents between firstLength and firstCapacity.
// (That might be uninitialized memory, as far as we know.)
- if(first!=NULL) { /* don't dereference NULL */
+ if(first!=nullptr) { /* don't dereference nullptr */
safeMiddle.extract(0, 0x7fffffff, first+firstLength-safeMiddle.length());
if(firstLength<firstCapacity) {
first[firstLength]=0; // NUL-terminate in case it was originally.
@@ -417,8 +417,8 @@ normalizeSecondAndAppend(const UNormalizer2 *norm2,
U_CAPI int32_t U_EXPORT2
unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2,
- UChar *first, int32_t firstLength, int32_t firstCapacity,
- const UChar *second, int32_t secondLength,
+ char16_t *first, int32_t firstLength, int32_t firstCapacity,
+ const char16_t *second, int32_t secondLength,
UErrorCode *pErrorCode) {
return normalizeSecondAndAppend(norm2,
first, firstLength, firstCapacity,
@@ -428,8 +428,8 @@ unorm2_normalizeSecondAndAppend(const UNormalizer2 *norm2,
U_CAPI int32_t U_EXPORT2
unorm2_append(const UNormalizer2 *norm2,
- UChar *first, int32_t firstLength, int32_t firstCapacity,
- const UChar *second, int32_t secondLength,
+ char16_t *first, int32_t firstLength, int32_t firstCapacity,
+ const char16_t *second, int32_t secondLength,
UErrorCode *pErrorCode) {
return normalizeSecondAndAppend(norm2,
first, firstLength, firstCapacity,
@@ -439,12 +439,12 @@ unorm2_append(const UNormalizer2 *norm2,
U_CAPI int32_t U_EXPORT2
unorm2_getDecomposition(const UNormalizer2 *norm2,
- UChar32 c, UChar *decomposition, int32_t capacity,
+ UChar32 c, char16_t *decomposition, int32_t capacity,
UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
return 0;
}
- if(decomposition==NULL ? capacity!=0 : capacity<0) {
+ if(decomposition==nullptr ? capacity!=0 : capacity<0) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -458,12 +458,12 @@ unorm2_getDecomposition(const UNormalizer2 *norm2,
U_CAPI int32_t U_EXPORT2
unorm2_getRawDecomposition(const UNormalizer2 *norm2,
- UChar32 c, UChar *decomposition, int32_t capacity,
+ UChar32 c, char16_t *decomposition, int32_t capacity,
UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
return 0;
}
- if(decomposition==NULL ? capacity!=0 : capacity<0) {
+ if(decomposition==nullptr ? capacity!=0 : capacity<0) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -487,12 +487,12 @@ unorm2_getCombiningClass(const UNormalizer2 *norm2, UChar32 c) {
U_CAPI UBool U_EXPORT2
unorm2_isNormalized(const UNormalizer2 *norm2,
- const UChar *s, int32_t length,
+ const char16_t *s, int32_t length,
UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
return 0;
}
- if((s==NULL && length!=0) || length<-1) {
+ if((s==nullptr && length!=0) || length<-1) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -502,12 +502,12 @@ unorm2_isNormalized(const UNormalizer2 *norm2,
U_CAPI UNormalizationCheckResult U_EXPORT2
unorm2_quickCheck(const UNormalizer2 *norm2,
- const UChar *s, int32_t length,
+ const char16_t *s, int32_t length,
UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
return UNORM_NO;
}
- if((s==NULL && length!=0) || length<-1) {
+ if((s==nullptr && length!=0) || length<-1) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return UNORM_NO;
}
@@ -517,12 +517,12 @@ unorm2_quickCheck(const UNormalizer2 *norm2,
U_CAPI int32_t U_EXPORT2
unorm2_spanQuickCheckYes(const UNormalizer2 *norm2,
- const UChar *s, int32_t length,
+ const char16_t *s, int32_t length,
UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
return 0;
}
- if((s==NULL && length!=0) || length<-1) {
+ if((s==nullptr && length!=0) || length<-1) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
diff --git a/thirdparty/icu4c/common/normalizer2impl.cpp b/thirdparty/icu4c/common/normalizer2impl.cpp
index d7e05e44d7..cdf570d76b 100644
--- a/thirdparty/icu4c/common/normalizer2impl.cpp
+++ b/thirdparty/icu4c/common/normalizer2impl.cpp
@@ -81,8 +81,8 @@ UChar32 codePointFromValidUTF8(const uint8_t *cpStart, const uint8_t *cpLimit) {
case 2:
return ((c&0x1f)<<6) | (cpStart[1]&0x3f);
case 3:
- // no need for (c&0xf) because the upper bits are truncated after <<12 in the cast to (UChar)
- return (UChar)((c<<12) | ((cpStart[1]&0x3f)<<6) | (cpStart[2]&0x3f));
+ // no need for (c&0xf) because the upper bits are truncated after <<12 in the cast to (char16_t)
+ return (char16_t)((c<<12) | ((cpStart[1]&0x3f)<<6) | (cpStart[2]&0x3f));
case 4:
return ((c&7)<<18) | ((cpStart[1]&0x3f)<<12) | ((cpStart[2]&0x3f)<<6) | (cpStart[3]&0x3f);
default:
@@ -182,7 +182,7 @@ ReorderingBuffer::ReorderingBuffer(const Normalizer2Impl &ni, UnicodeString &des
UBool ReorderingBuffer::init(int32_t destCapacity, UErrorCode &errorCode) {
int32_t length=str.length();
start=str.getBuffer(destCapacity);
- if(start==NULL) {
+ if(start==nullptr) {
// getBuffer() already did str.setToBogus()
errorCode=U_MEMORY_ALLOCATION_ERROR;
return false;
@@ -204,7 +204,7 @@ UBool ReorderingBuffer::init(int32_t destCapacity, UErrorCode &errorCode) {
return true;
}
-UBool ReorderingBuffer::equals(const UChar *otherStart, const UChar *otherLimit) const {
+UBool ReorderingBuffer::equals(const char16_t *otherStart, const char16_t *otherLimit) const {
int32_t length=(int32_t)(limit-start);
return
length==(int32_t)(otherLimit-otherStart) &&
@@ -256,7 +256,7 @@ UBool ReorderingBuffer::appendSupplementary(UChar32 c, uint8_t cc, UErrorCode &e
return true;
}
-UBool ReorderingBuffer::append(const UChar *s, int32_t length, UBool isNFD,
+UBool ReorderingBuffer::append(const char16_t *s, int32_t length, UBool isNFD,
uint8_t leadCC, uint8_t trailCC,
UErrorCode &errorCode) {
if(length==0) {
@@ -272,7 +272,7 @@ UBool ReorderingBuffer::append(const UChar *s, int32_t length, UBool isNFD,
} else if(leadCC<=1) {
reorderStart=limit+1; // Ok if not a code point boundary.
}
- const UChar *sLimit=s+length;
+ const char16_t *sLimit=s+length;
do { *limit++=*s++; } while(s!=sLimit);
lastCC=trailCC;
} else {
@@ -304,7 +304,7 @@ UBool ReorderingBuffer::appendZeroCC(UChar32 c, UErrorCode &errorCode) {
}
remainingCapacity-=cpLength;
if(cpLength==1) {
- *limit++=(UChar)c;
+ *limit++=(char16_t)c;
} else {
limit[0]=U16_LEAD(c);
limit[1]=U16_TRAIL(c);
@@ -315,7 +315,7 @@ UBool ReorderingBuffer::appendZeroCC(UChar32 c, UErrorCode &errorCode) {
return true;
}
-UBool ReorderingBuffer::appendZeroCC(const UChar *s, const UChar *sLimit, UErrorCode &errorCode) {
+UBool ReorderingBuffer::appendZeroCC(const char16_t *s, const char16_t *sLimit, UErrorCode &errorCode) {
if(s==sLimit) {
return true;
}
@@ -362,7 +362,7 @@ UBool ReorderingBuffer::resize(int32_t appendLength, UErrorCode &errorCode) {
newCapacity=256;
}
start=str.getBuffer(newCapacity);
- if(start==NULL) {
+ if(start==nullptr) {
// getBuffer() already did str.setToBogus()
errorCode=U_MEMORY_ALLOCATION_ERROR;
return false;
@@ -375,7 +375,7 @@ UBool ReorderingBuffer::resize(int32_t appendLength, UErrorCode &errorCode) {
void ReorderingBuffer::skipPrevious() {
codePointLimit=codePointStart;
- UChar c=*--codePointStart;
+ char16_t c=*--codePointStart;
if(U16_IS_TRAIL(c) && start<codePointStart && U16_IS_LEAD(*(codePointStart-1))) {
--codePointStart;
}
@@ -387,7 +387,7 @@ uint8_t ReorderingBuffer::previousCC() {
return 0;
}
UChar32 c=*--codePointStart;
- UChar c2;
+ char16_t c2;
if(U16_IS_TRAIL(c) && start<codePointStart && U16_IS_LEAD(c2=*(codePointStart-1))) {
--codePointStart;
c=U16_GET_SUPPLEMENTARY(c2, c);
@@ -400,8 +400,8 @@ uint8_t ReorderingBuffer::previousCC() {
void ReorderingBuffer::insert(UChar32 c, uint8_t cc) {
for(setIterator(), skipPrevious(); previousCC()>cc;) {}
// insert c at codePointLimit, after the character with prevCC<=cc
- UChar *q=limit;
- UChar *r=limit+=U16_LENGTH(c);
+ char16_t *q=limit;
+ char16_t *r=limit+=U16_LENGTH(c);
do {
*--r=*--q;
} while(codePointLimit!=q);
@@ -429,9 +429,9 @@ Normalizer2Impl::~Normalizer2Impl() {
void
Normalizer2Impl::init(const int32_t *inIndexes, const UCPTrie *inTrie,
const uint16_t *inExtraData, const uint8_t *inSmallFCD) {
- minDecompNoCP = static_cast<UChar>(inIndexes[IX_MIN_DECOMP_NO_CP]);
- minCompNoMaybeCP = static_cast<UChar>(inIndexes[IX_MIN_COMP_NO_MAYBE_CP]);
- minLcccCP = static_cast<UChar>(inIndexes[IX_MIN_LCCC_CP]);
+ minDecompNoCP = static_cast<char16_t>(inIndexes[IX_MIN_DECOMP_NO_CP]);
+ minCompNoMaybeCP = static_cast<char16_t>(inIndexes[IX_MIN_COMP_NO_MAYBE_CP]);
+ minLcccCP = static_cast<char16_t>(inIndexes[IX_MIN_LCCC_CP]);
minYesNo = static_cast<uint16_t>(inIndexes[IX_MIN_YES_NO]);
minYesNoMappingsOnly = static_cast<uint16_t>(inIndexes[IX_MIN_YES_NO_MAPPINGS_ONLY]);
@@ -503,7 +503,7 @@ Normalizer2Impl::addPropertyStarts(const USetAdder *sa, UErrorCode & /*errorCode
}
/* add Hangul LV syllables and LV+1 because of skippables */
- for(UChar c=Hangul::HANGUL_BASE; c<Hangul::HANGUL_LIMIT; c+=Hangul::JAMO_T_COUNT) {
+ for(char16_t c=Hangul::HANGUL_BASE; c<Hangul::HANGUL_LIMIT; c+=Hangul::JAMO_T_COUNT) {
sa->add(sa->set, c);
sa->add(sa->set, c+1);
}
@@ -524,8 +524,8 @@ Normalizer2Impl::addCanonIterPropertyStarts(const USetAdder *sa, UErrorCode &err
}
}
-const UChar *
-Normalizer2Impl::copyLowPrefixFromNulTerminated(const UChar *src,
+const char16_t *
+Normalizer2Impl::copyLowPrefixFromNulTerminated(const char16_t *src,
UChar32 minNeedDataCP,
ReorderingBuffer *buffer,
UErrorCode &errorCode) const {
@@ -534,13 +534,13 @@ Normalizer2Impl::copyLowPrefixFromNulTerminated(const UChar *src,
// data and check the first part of the string.
// After this prefix, determine the string length to simplify the rest
// of the code.
- const UChar *prevSrc=src;
- UChar c;
+ const char16_t *prevSrc=src;
+ char16_t c;
while((c=*src++)<minNeedDataCP && c!=0) {}
// Back out the last character for full processing.
// Copy this prefix.
if(--src!=prevSrc) {
- if(buffer!=NULL) {
+ if(buffer!=nullptr) {
buffer->appendZeroCC(prevSrc, src, errorCode);
}
}
@@ -554,8 +554,8 @@ Normalizer2Impl::decompose(const UnicodeString &src, UnicodeString &dest,
dest.setToBogus();
return dest;
}
- const UChar *sArray=src.getBuffer();
- if(&dest==&src || sArray==NULL) {
+ const char16_t *sArray=src.getBuffer();
+ if(&dest==&src || sArray==nullptr) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
dest.setToBogus();
return dest;
@@ -565,11 +565,11 @@ Normalizer2Impl::decompose(const UnicodeString &src, UnicodeString &dest,
}
void
-Normalizer2Impl::decompose(const UChar *src, const UChar *limit,
+Normalizer2Impl::decompose(const char16_t *src, const char16_t *limit,
UnicodeString &dest,
int32_t destLengthEstimate,
UErrorCode &errorCode) const {
- if(destLengthEstimate<0 && limit!=NULL) {
+ if(destLengthEstimate<0 && limit!=nullptr) {
destLengthEstimate=(int32_t)(limit-src);
}
dest.remove();
@@ -580,14 +580,14 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit,
}
// Dual functionality:
-// buffer!=NULL: normalize
-// buffer==NULL: isNormalized/spanQuickCheckYes
-const UChar *
-Normalizer2Impl::decompose(const UChar *src, const UChar *limit,
+// buffer!=nullptr: normalize
+// buffer==nullptr: isNormalized/spanQuickCheckYes
+const char16_t *
+Normalizer2Impl::decompose(const char16_t *src, const char16_t *limit,
ReorderingBuffer *buffer,
UErrorCode &errorCode) const {
UChar32 minNoCP=minDecompNoCP;
- if(limit==NULL) {
+ if(limit==nullptr) {
src=copyLowPrefixFromNulTerminated(src, minNoCP, buffer, errorCode);
if(U_FAILURE(errorCode)) {
return src;
@@ -595,12 +595,12 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit,
limit=u_strchr(src, 0);
}
- const UChar *prevSrc;
+ const char16_t *prevSrc;
UChar32 c=0;
uint16_t norm16=0;
// only for quick check
- const UChar *prevBoundary=src;
+ const char16_t *prevBoundary=src;
uint8_t prevCC=0;
for(;;) {
@@ -613,7 +613,7 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit,
} else if(!U16_IS_LEAD(c)) {
break;
} else {
- UChar c2;
+ char16_t c2;
if((src+1)!=limit && U16_IS_TRAIL(c2=src[1])) {
c=U16_GET_SUPPLEMENTARY(c, c2);
norm16=UCPTRIE_FAST_SUPP_GET(normTrie, UCPTRIE_16, c);
@@ -629,7 +629,7 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit,
}
// copy these code units all at once
if(src!=prevSrc) {
- if(buffer!=NULL) {
+ if(buffer!=nullptr) {
if(!buffer->appendZeroCC(prevSrc, src, errorCode)) {
break;
}
@@ -644,7 +644,7 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit,
// Check one above-minimum, relevant code point.
src+=U16_LENGTH(c);
- if(buffer!=NULL) {
+ if(buffer!=nullptr) {
if(!decompose(c, norm16, *buffer, errorCode)) {
break;
}
@@ -669,8 +669,8 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *limit,
// fail the quick check loop and/or where the quick check loop's overhead
// is unlikely to be amortized.
// Called by the compose() and makeFCD() implementations.
-const UChar *
-Normalizer2Impl::decomposeShort(const UChar *src, const UChar *limit,
+const char16_t *
+Normalizer2Impl::decomposeShort(const char16_t *src, const char16_t *limit,
UBool stopAtCompBoundary, UBool onlyContiguous,
ReorderingBuffer &buffer, UErrorCode &errorCode) const {
if (U_FAILURE(errorCode)) {
@@ -680,7 +680,7 @@ Normalizer2Impl::decomposeShort(const UChar *src, const UChar *limit,
if (stopAtCompBoundary && *src < minCompNoMaybeCP) {
return src;
}
- const UChar *prevSrc = src;
+ const char16_t *prevSrc = src;
UChar32 c;
uint16_t norm16;
UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, src, limit, c, norm16);
@@ -714,7 +714,7 @@ UBool Normalizer2Impl::decompose(UChar32 c, uint16_t norm16,
return buffer.append(c, 0, errorCode);
} else if(isHangulLV(norm16) || isHangulLVT(norm16)) {
// Hangul syllable: decompose algorithmically
- UChar jamos[3];
+ char16_t jamos[3];
return buffer.appendZeroCC(jamos, jamos+Hangul::decompose(c, jamos), errorCode);
}
// c decomposes, get everything from the variable-length extra data
@@ -728,7 +728,7 @@ UBool Normalizer2Impl::decompose(UChar32 c, uint16_t norm16,
} else {
leadCC=0;
}
- return buffer.append((const UChar *)mapping+1, length, true, leadCC, trailCC, errorCode);
+ return buffer.append((const char16_t *)mapping+1, length, true, leadCC, trailCC, errorCode);
}
// Dual functionality:
@@ -943,14 +943,14 @@ Normalizer2Impl::decomposeShort(const uint8_t *src, const uint8_t *limit,
return src;
}
-const UChar *
-Normalizer2Impl::getDecomposition(UChar32 c, UChar buffer[4], int32_t &length) const {
+const char16_t *
+Normalizer2Impl::getDecomposition(UChar32 c, char16_t buffer[4], int32_t &length) const {
uint16_t norm16;
if(c<minDecompNoCP || isMaybeOrNonZeroCC(norm16=getNorm16(c))) {
// c does not decompose
return nullptr;
}
- const UChar *decomp = nullptr;
+ const char16_t *decomp = nullptr;
if(isDecompNoAlgorithmic(norm16)) {
// Maps to an isCompYesAndZeroCC.
c=mapAlgorithmic(c, norm16);
@@ -970,19 +970,19 @@ Normalizer2Impl::getDecomposition(UChar32 c, UChar buffer[4], int32_t &length) c
// c decomposes, get everything from the variable-length extra data
const uint16_t *mapping=getMapping(norm16);
length=*mapping&MAPPING_LENGTH_MASK;
- return (const UChar *)mapping+1;
+ return (const char16_t *)mapping+1;
}
// The capacity of the buffer must be 30=MAPPING_LENGTH_MASK-1
// so that a raw mapping fits that consists of one unit ("rm0")
// plus all but the first two code units of the normal mapping.
// The maximum length of a normal mapping is 31=MAPPING_LENGTH_MASK.
-const UChar *
-Normalizer2Impl::getRawDecomposition(UChar32 c, UChar buffer[30], int32_t &length) const {
+const char16_t *
+Normalizer2Impl::getRawDecomposition(UChar32 c, char16_t buffer[30], int32_t &length) const {
uint16_t norm16;
if(c<minDecompNoCP || isDecompYes(norm16=getNorm16(c))) {
// c does not decompose
- return NULL;
+ return nullptr;
} else if(isHangulLV(norm16) || isHangulLVT(norm16)) {
// Hangul syllable: decompose algorithmically
Hangul::getRawDecomposition(c, buffer);
@@ -1005,21 +1005,21 @@ Normalizer2Impl::getRawDecomposition(UChar32 c, UChar buffer[30], int32_t &lengt
uint16_t rm0=*rawMapping;
if(rm0<=MAPPING_LENGTH_MASK) {
length=rm0;
- return (const UChar *)rawMapping-rm0;
+ return (const char16_t *)rawMapping-rm0;
} else {
// Copy the normal mapping and replace its first two code units with rm0.
- buffer[0]=(UChar)rm0;
- u_memcpy(buffer+1, (const UChar *)mapping+1+2, mLength-2);
+ buffer[0]=(char16_t)rm0;
+ u_memcpy(buffer+1, (const char16_t *)mapping+1+2, mLength-2);
length=mLength-1;
return buffer;
}
} else {
length=mLength;
- return (const UChar *)mapping+1;
+ return (const char16_t *)mapping+1;
}
}
-void Normalizer2Impl::decomposeAndAppend(const UChar *src, const UChar *limit,
+void Normalizer2Impl::decomposeAndAppend(const char16_t *src, const char16_t *limit,
UBool doDecompose,
UnicodeString &safeMiddle,
ReorderingBuffer &buffer,
@@ -1032,9 +1032,9 @@ void Normalizer2Impl::decomposeAndAppend(const UChar *src, const UChar *limit,
// Just merge the strings at the boundary.
bool isFirst = true;
uint8_t firstCC = 0, prevCC = 0, cc;
- const UChar *p = src;
+ const char16_t *p = src;
while (p != limit) {
- const UChar *codePointStart = p;
+ const char16_t *codePointStart = p;
UChar32 c;
uint16_t norm16;
UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, p, limit, c, norm16);
@@ -1048,7 +1048,7 @@ void Normalizer2Impl::decomposeAndAppend(const UChar *src, const UChar *limit,
}
prevCC = cc;
}
- if(limit==NULL) { // appendZeroCC() needs limit!=NULL
+ if(limit==nullptr) { // appendZeroCC() needs limit!=nullptr
limit=u_strchr(p, 0);
}
@@ -1218,13 +1218,13 @@ void Normalizer2Impl::addComposites(const uint16_t *list, UnicodeSet &set) const
*/
void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStartIndex,
UBool onlyContiguous) const {
- UChar *p=buffer.getStart()+recomposeStartIndex;
- UChar *limit=buffer.getLimit();
+ char16_t *p=buffer.getStart()+recomposeStartIndex;
+ char16_t *limit=buffer.getLimit();
if(p==limit) {
return;
}
- UChar *starter, *pRemove, *q, *r;
+ char16_t *starter, *pRemove, *q, *r;
const uint16_t *compositionsList;
UChar32 c, compositeAndFwd;
uint16_t norm16;
@@ -1233,8 +1233,8 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
// Some of the following variables are not used until we have a forward-combining starter
// and are only initialized now to avoid compiler warnings.
- compositionsList=NULL; // used as indicator for whether we have a forward-combining starter
- starter=NULL;
+ compositionsList=nullptr; // used as indicator for whether we have a forward-combining starter
+ starter=nullptr;
starterIsSupplementary=false;
prevCC=0;
@@ -1244,7 +1244,7 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
if( // this character combines backward and
isMaybe(norm16) &&
// we have seen a starter that combines forward and
- compositionsList!=NULL &&
+ compositionsList!=nullptr &&
// the backward-combining character is not blocked
(prevCC<cc || prevCC==0)
) {
@@ -1252,15 +1252,15 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
// c is a Jamo V/T, see if we can compose it with the previous character.
if(c<Hangul::JAMO_T_BASE) {
// c is a Jamo Vowel, compose with previous Jamo L and following Jamo T.
- UChar prev=(UChar)(*starter-Hangul::JAMO_L_BASE);
+ char16_t prev=(char16_t)(*starter-Hangul::JAMO_L_BASE);
if(prev<Hangul::JAMO_L_COUNT) {
pRemove=p-1;
- UChar syllable=(UChar)
+ char16_t syllable=(char16_t)
(Hangul::HANGUL_BASE+
(prev*Hangul::JAMO_V_COUNT+(c-Hangul::JAMO_V_BASE))*
Hangul::JAMO_T_COUNT);
- UChar t;
- if(p!=limit && (t=(UChar)(*p-Hangul::JAMO_T_BASE))<Hangul::JAMO_T_COUNT) {
+ char16_t t;
+ if(p!=limit && (t=(char16_t)(*p-Hangul::JAMO_T_BASE))<Hangul::JAMO_T_COUNT) {
++p;
syllable+=t; // The next character was a Jamo T.
}
@@ -1284,7 +1284,7 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
if(p==limit) {
break;
}
- compositionsList=NULL;
+ compositionsList=nullptr;
continue;
} else if((compositeAndFwd=combine(compositionsList, c))>=0) {
// The starter and the combining mark (c) do combine.
@@ -1298,7 +1298,7 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
starter[0]=U16_LEAD(composite);
starter[1]=U16_TRAIL(composite);
} else {
- *starter=(UChar)composite;
+ *starter=(char16_t)composite;
// The composite is shorter than the starter,
// move the intermediate characters forward one.
starterIsSupplementary=false;
@@ -1323,7 +1323,7 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
*--starter=U16_LEAD(composite); // undo the temporary increment
} else {
// both are on the BMP
- *starter=(UChar)composite;
+ *starter=(char16_t)composite;
}
/* remove the combining mark by moving the following text over it */
@@ -1346,7 +1346,7 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
compositionsList=
getCompositionsListForComposite(getRawNorm16(composite));
} else {
- compositionsList=NULL;
+ compositionsList=nullptr;
}
// We combined; continue with looking for compositions.
@@ -1363,7 +1363,7 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
// If c did not combine, then check if it is a starter.
if(cc==0) {
// Found a new starter.
- if((compositionsList=getCompositionsListForDecompYes(norm16))!=NULL) {
+ if((compositionsList=getCompositionsListForDecompYes(norm16))!=nullptr) {
// It may combine with something, prepare for it.
if(U_IS_BMP(c)) {
starterIsSupplementary=false;
@@ -1375,7 +1375,7 @@ void Normalizer2Impl::recompose(ReorderingBuffer &buffer, int32_t recomposeStart
}
} else if(onlyContiguous) {
// FCC: no discontiguous compositions; any intervening character blocks.
- compositionsList=NULL;
+ compositionsList=nullptr;
}
}
buffer.setReorderingLimit(limit);
@@ -1435,16 +1435,16 @@ Normalizer2Impl::composePair(UChar32 a, UChar32 b) const {
// doCompose: normalize
// !doCompose: isNormalized (buffer must be empty and initialized)
UBool
-Normalizer2Impl::compose(const UChar *src, const UChar *limit,
+Normalizer2Impl::compose(const char16_t *src, const char16_t *limit,
UBool onlyContiguous,
UBool doCompose,
ReorderingBuffer &buffer,
UErrorCode &errorCode) const {
- const UChar *prevBoundary=src;
+ const char16_t *prevBoundary=src;
UChar32 minNoMaybeCP=minCompNoMaybeCP;
- if(limit==NULL) {
+ if(limit==nullptr) {
src=copyLowPrefixFromNulTerminated(src, minNoMaybeCP,
- doCompose ? &buffer : NULL,
+ doCompose ? &buffer : nullptr,
errorCode);
if(U_FAILURE(errorCode)) {
return false;
@@ -1463,7 +1463,7 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit,
for (;;) {
// Fast path: Scan over a sequence of characters below the minimum "no or maybe" code point,
// or with (compYes && ccc==0) properties.
- const UChar *prevSrc;
+ const char16_t *prevSrc;
UChar32 c = 0;
uint16_t norm16 = 0;
for (;;) {
@@ -1482,7 +1482,7 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit,
if(!U16_IS_LEAD(c)) {
break;
} else {
- UChar c2;
+ char16_t c2;
if(src!=limit && U16_IS_TRAIL(c2=*src)) {
++src;
c=U16_GET_SUPPLEMENTARY(c, c2);
@@ -1528,7 +1528,7 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit,
if (prevBoundary != prevSrc && !buffer.appendZeroCC(prevBoundary, prevSrc, errorCode)) {
break;
}
- const UChar *mapping = reinterpret_cast<const UChar *>(getMapping(norm16));
+ const char16_t *mapping = reinterpret_cast<const char16_t *>(getMapping(norm16));
int32_t length = *mapping++ & MAPPING_LENGTH_MASK;
if(!buffer.appendZeroCC(mapping, mapping + length, errorCode)) {
break;
@@ -1552,11 +1552,11 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit,
// Other "noNo" type, or need to examine more text around this character:
// Fall through to the slow path.
} else if (isJamoVT(norm16) && prevBoundary != prevSrc) {
- UChar prev=*(prevSrc-1);
+ char16_t prev=*(prevSrc-1);
if(c<Hangul::JAMO_T_BASE) {
// The current character is a Jamo Vowel,
// compose with previous Jamo L and following Jamo T.
- UChar l = (UChar)(prev-Hangul::JAMO_L_BASE);
+ char16_t l = (char16_t)(prev-Hangul::JAMO_L_BASE);
if(l<Hangul::JAMO_L_COUNT) {
if (!doCompose) {
return false;
@@ -1581,7 +1581,7 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit,
if (prevBoundary != prevSrc && !buffer.appendZeroCC(prevBoundary, prevSrc, errorCode)) {
break;
}
- if(!buffer.appendBMP((UChar)syllable, 0, errorCode)) {
+ if(!buffer.appendBMP((char16_t)syllable, 0, errorCode)) {
break;
}
prevBoundary = src;
@@ -1606,7 +1606,7 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit,
if (prevBoundary != prevSrc && !buffer.appendZeroCC(prevBoundary, prevSrc, errorCode)) {
break;
}
- if(!buffer.appendBMP((UChar)syllable, 0, errorCode)) {
+ if(!buffer.appendBMP((char16_t)syllable, 0, errorCode)) {
break;
}
prevBoundary = src;
@@ -1627,7 +1627,7 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit,
} else {
// If !onlyContiguous (not FCC), then we ignore the tccc of
// the previous character which passed the quick check "yes && ccc==0" test.
- const UChar *nextSrc;
+ const char16_t *nextSrc;
uint16_t n16;
for (;;) {
if (src == limit) {
@@ -1667,7 +1667,7 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit,
// Slow path: Find the nearest boundaries around the current character,
// decompose and recompose.
if (prevBoundary != prevSrc && !norm16HasCompBoundaryBefore(norm16)) {
- const UChar *p = prevSrc;
+ const char16_t *p = prevSrc;
UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, prevBoundary, p, c, norm16);
if (!norm16HasCompBoundaryAfter(norm16, onlyContiguous)) {
prevSrc = p;
@@ -1703,17 +1703,17 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit,
}
// Very similar to compose(): Make the same changes in both places if relevant.
-// pQCResult==NULL: spanQuickCheckYes
-// pQCResult!=NULL: quickCheck (*pQCResult must be UNORM_YES)
-const UChar *
-Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit,
+// pQCResult==nullptr: spanQuickCheckYes
+// pQCResult!=nullptr: quickCheck (*pQCResult must be UNORM_YES)
+const char16_t *
+Normalizer2Impl::composeQuickCheck(const char16_t *src, const char16_t *limit,
UBool onlyContiguous,
UNormalizationCheckResult *pQCResult) const {
- const UChar *prevBoundary=src;
+ const char16_t *prevBoundary=src;
UChar32 minNoMaybeCP=minCompNoMaybeCP;
- if(limit==NULL) {
+ if(limit==nullptr) {
UErrorCode errorCode=U_ZERO_ERROR;
- src=copyLowPrefixFromNulTerminated(src, minNoMaybeCP, NULL, errorCode);
+ src=copyLowPrefixFromNulTerminated(src, minNoMaybeCP, nullptr, errorCode);
limit=u_strchr(src, 0);
if (prevBoundary != src) {
if (hasCompBoundaryAfter(*(src-1), onlyContiguous)) {
@@ -1727,7 +1727,7 @@ Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit,
for(;;) {
// Fast path: Scan over a sequence of characters below the minimum "no or maybe" code point,
// or with (compYes && ccc==0) properties.
- const UChar *prevSrc;
+ const char16_t *prevSrc;
UChar32 c = 0;
uint16_t norm16 = 0;
for (;;) {
@@ -1743,7 +1743,7 @@ Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit,
if(!U16_IS_LEAD(c)) {
break;
} else {
- UChar c2;
+ char16_t c2;
if(src!=limit && U16_IS_TRAIL(c2=*src)) {
++src;
c=U16_GET_SUPPLEMENTARY(c, c2);
@@ -1766,7 +1766,7 @@ Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit,
if (norm16HasCompBoundaryBefore(norm16)) {
prevBoundary = prevSrc;
} else {
- const UChar *p = prevSrc;
+ const char16_t *p = prevSrc;
uint16_t n16;
UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, prevBoundary, p, c, n16);
if (norm16HasCompBoundaryAfter(n16, onlyContiguous)) {
@@ -1788,7 +1788,7 @@ Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit,
} else {
// If !onlyContiguous (not FCC), then we ignore the tccc of
// the previous character which passed the quick check "yes && ccc==0" test.
- const UChar *nextSrc;
+ const char16_t *nextSrc;
for (;;) {
if (norm16 < MIN_YES_YES_WITH_CC) {
if (pQCResult != nullptr) {
@@ -1821,30 +1821,30 @@ Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit,
}
}
}
- if(pQCResult!=NULL) {
+ if(pQCResult!=nullptr) {
*pQCResult=UNORM_NO;
}
return prevBoundary;
}
}
-void Normalizer2Impl::composeAndAppend(const UChar *src, const UChar *limit,
+void Normalizer2Impl::composeAndAppend(const char16_t *src, const char16_t *limit,
UBool doCompose,
UBool onlyContiguous,
UnicodeString &safeMiddle,
ReorderingBuffer &buffer,
UErrorCode &errorCode) const {
if(!buffer.isEmpty()) {
- const UChar *firstStarterInSrc=findNextCompBoundary(src, limit, onlyContiguous);
+ const char16_t *firstStarterInSrc=findNextCompBoundary(src, limit, onlyContiguous);
if(src!=firstStarterInSrc) {
- const UChar *lastStarterInDest=findPreviousCompBoundary(buffer.getStart(),
+ const char16_t *lastStarterInDest=findPreviousCompBoundary(buffer.getStart(),
buffer.getLimit(), onlyContiguous);
int32_t destSuffixLength=(int32_t)(buffer.getLimit()-lastStarterInDest);
UnicodeString middle(lastStarterInDest, destSuffixLength);
buffer.removeSuffix(destSuffixLength);
safeMiddle=middle;
middle.append(src, (int32_t)(firstStarterInSrc-src));
- const UChar *middleStart=middle.getBuffer();
+ const char16_t *middleStart=middle.getBuffer();
compose(middleStart, middleStart+middle.length(), onlyContiguous,
true, buffer, errorCode);
if(U_FAILURE(errorCode)) {
@@ -1856,7 +1856,7 @@ void Normalizer2Impl::composeAndAppend(const UChar *src, const UChar *limit,
if(doCompose) {
compose(src, limit, onlyContiguous, true, buffer, errorCode);
} else {
- if(limit==NULL) { // appendZeroCC() needs limit!=NULL
+ if(limit==nullptr) { // appendZeroCC() needs limit!=nullptr
limit=u_strchr(src, 0);
}
buffer.appendZeroCC(src, limit, errorCode);
@@ -1933,7 +1933,7 @@ Normalizer2Impl::composeUTF8(uint32_t options, UBool onlyContiguous,
}
const uint16_t *mapping = getMapping(norm16);
int32_t length = *mapping++ & MAPPING_LENGTH_MASK;
- if (!ByteSinkUtil::appendChange(prevSrc, src, (const UChar *)mapping, length,
+ if (!ByteSinkUtil::appendChange(prevSrc, src, (const char16_t *)mapping, length,
*sink, edits, errorCode)) {
break;
}
@@ -2120,7 +2120,7 @@ Normalizer2Impl::composeUTF8(uint32_t options, UBool onlyContiguous,
return true;
}
-UBool Normalizer2Impl::hasCompBoundaryBefore(const UChar *src, const UChar *limit) const {
+UBool Normalizer2Impl::hasCompBoundaryBefore(const char16_t *src, const char16_t *limit) const {
if (src == limit || *src < minCompNoMaybeCP) {
return true;
}
@@ -2139,7 +2139,7 @@ UBool Normalizer2Impl::hasCompBoundaryBefore(const uint8_t *src, const uint8_t *
return norm16HasCompBoundaryBefore(norm16);
}
-UBool Normalizer2Impl::hasCompBoundaryAfter(const UChar *start, const UChar *p,
+UBool Normalizer2Impl::hasCompBoundaryAfter(const char16_t *start, const char16_t *p,
UBool onlyContiguous) const {
if (start == p) {
return true;
@@ -2160,10 +2160,10 @@ UBool Normalizer2Impl::hasCompBoundaryAfter(const uint8_t *start, const uint8_t
return norm16HasCompBoundaryAfter(norm16, onlyContiguous);
}
-const UChar *Normalizer2Impl::findPreviousCompBoundary(const UChar *start, const UChar *p,
+const char16_t *Normalizer2Impl::findPreviousCompBoundary(const char16_t *start, const char16_t *p,
UBool onlyContiguous) const {
while (p != start) {
- const UChar *codePointLimit = p;
+ const char16_t *codePointLimit = p;
UChar32 c;
uint16_t norm16;
UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, start, p, c, norm16);
@@ -2177,10 +2177,10 @@ const UChar *Normalizer2Impl::findPreviousCompBoundary(const UChar *start, const
return p;
}
-const UChar *Normalizer2Impl::findNextCompBoundary(const UChar *p, const UChar *limit,
+const char16_t *Normalizer2Impl::findNextCompBoundary(const char16_t *p, const char16_t *limit,
UBool onlyContiguous) const {
while (p != limit) {
- const UChar *codePointStart = p;
+ const char16_t *codePointStart = p;
UChar32 c;
uint16_t norm16;
UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, p, limit, c, norm16);
@@ -2194,7 +2194,7 @@ const UChar *Normalizer2Impl::findNextCompBoundary(const UChar *p, const UChar *
return p;
}
-uint8_t Normalizer2Impl::getPreviousTrailCC(const UChar *start, const UChar *p) const {
+uint8_t Normalizer2Impl::getPreviousTrailCC(const char16_t *start, const char16_t *p) const {
if (start == p) {
return 0;
}
@@ -2267,17 +2267,17 @@ uint16_t Normalizer2Impl::getFCD16FromNormData(UChar32 c) const {
#endif
// Dual functionality:
-// buffer!=NULL: normalize
-// buffer==NULL: isNormalized/quickCheck/spanQuickCheckYes
-const UChar *
-Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
+// buffer!=nullptr: normalize
+// buffer==nullptr: isNormalized/quickCheck/spanQuickCheckYes
+const char16_t *
+Normalizer2Impl::makeFCD(const char16_t *src, const char16_t *limit,
ReorderingBuffer *buffer,
UErrorCode &errorCode) const {
// Tracks the last FCD-safe boundary, before lccc=0 or after properly-ordered tccc<=1.
// Similar to the prevBoundary in the compose() implementation.
- const UChar *prevBoundary=src;
+ const char16_t *prevBoundary=src;
int32_t prevFCD16=0;
- if(limit==NULL) {
+ if(limit==nullptr) {
src=copyLowPrefixFromNulTerminated(src, minLcccCP, buffer, errorCode);
if(U_FAILURE(errorCode)) {
return src;
@@ -2300,7 +2300,7 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
// The exception is the call to decomposeShort() which uses the buffer
// in the normal way.
- const UChar *prevSrc;
+ const char16_t *prevSrc;
UChar32 c=0;
uint16_t fcd16=0;
@@ -2315,7 +2315,7 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
++src;
} else {
if(U16_IS_LEAD(c)) {
- UChar c2;
+ char16_t c2;
if((src+1)!=limit && U16_IS_TRAIL(c2=src[1])) {
c=U16_GET_SUPPLEMENTARY(c, c2);
}
@@ -2330,7 +2330,7 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
}
// copy these code units all at once
if(src!=prevSrc) {
- if(buffer!=NULL && !buffer->appendZeroCC(prevSrc, src, errorCode)) {
+ if(buffer!=nullptr && !buffer->appendZeroCC(prevSrc, src, errorCode)) {
break;
}
if(src==limit) {
@@ -2350,7 +2350,7 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
}
}
} else {
- const UChar *p=src-1;
+ const char16_t *p=src-1;
if(U16_IS_TRAIL(*p) && prevSrc<p && U16_IS_LEAD(*(p-1))) {
--p;
// Need to fetch the previous character's FCD value because
@@ -2376,12 +2376,12 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
if((fcd16&0xff)<=1) {
prevBoundary=src;
}
- if(buffer!=NULL && !buffer->appendZeroCC(c, errorCode)) {
+ if(buffer!=nullptr && !buffer->appendZeroCC(c, errorCode)) {
break;
}
prevFCD16=fcd16;
continue;
- } else if(buffer==NULL) {
+ } else if(buffer==nullptr) {
return prevBoundary; // quick check "no"
} else {
/*
@@ -2410,22 +2410,22 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
return src;
}
-void Normalizer2Impl::makeFCDAndAppend(const UChar *src, const UChar *limit,
+void Normalizer2Impl::makeFCDAndAppend(const char16_t *src, const char16_t *limit,
UBool doMakeFCD,
UnicodeString &safeMiddle,
ReorderingBuffer &buffer,
UErrorCode &errorCode) const {
if(!buffer.isEmpty()) {
- const UChar *firstBoundaryInSrc=findNextFCDBoundary(src, limit);
+ const char16_t *firstBoundaryInSrc=findNextFCDBoundary(src, limit);
if(src!=firstBoundaryInSrc) {
- const UChar *lastBoundaryInDest=findPreviousFCDBoundary(buffer.getStart(),
+ const char16_t *lastBoundaryInDest=findPreviousFCDBoundary(buffer.getStart(),
buffer.getLimit());
int32_t destSuffixLength=(int32_t)(buffer.getLimit()-lastBoundaryInDest);
UnicodeString middle(lastBoundaryInDest, destSuffixLength);
buffer.removeSuffix(destSuffixLength);
safeMiddle=middle;
middle.append(src, (int32_t)(firstBoundaryInSrc-src));
- const UChar *middleStart=middle.getBuffer();
+ const char16_t *middleStart=middle.getBuffer();
makeFCD(middleStart, middleStart+middle.length(), &buffer, errorCode);
if(U_FAILURE(errorCode)) {
return;
@@ -2436,16 +2436,16 @@ void Normalizer2Impl::makeFCDAndAppend(const UChar *src, const UChar *limit,
if(doMakeFCD) {
makeFCD(src, limit, &buffer, errorCode);
} else {
- if(limit==NULL) { // appendZeroCC() needs limit!=NULL
+ if(limit==nullptr) { // appendZeroCC() needs limit!=nullptr
limit=u_strchr(src, 0);
}
buffer.appendZeroCC(src, limit, errorCode);
}
}
-const UChar *Normalizer2Impl::findPreviousFCDBoundary(const UChar *start, const UChar *p) const {
+const char16_t *Normalizer2Impl::findPreviousFCDBoundary(const char16_t *start, const char16_t *p) const {
while(start<p) {
- const UChar *codePointLimit = p;
+ const char16_t *codePointLimit = p;
UChar32 c;
uint16_t norm16;
UCPTRIE_FAST_U16_PREV(normTrie, UCPTRIE_16, start, p, c, norm16);
@@ -2459,9 +2459,9 @@ const UChar *Normalizer2Impl::findPreviousFCDBoundary(const UChar *start, const
return p;
}
-const UChar *Normalizer2Impl::findNextFCDBoundary(const UChar *p, const UChar *limit) const {
+const char16_t *Normalizer2Impl::findNextFCDBoundary(const char16_t *p, const char16_t *limit) const {
while(p<limit) {
- const UChar *codePointStart=p;
+ const char16_t *codePointStart=p;
UChar32 c;
uint16_t norm16;
UCPTRIE_FAST_U16_NEXT(normTrie, UCPTRIE_16, p, limit, c, norm16);
@@ -2479,7 +2479,7 @@ const UChar *Normalizer2Impl::findNextFCDBoundary(const UChar *p, const UChar *l
CanonIterData::CanonIterData(UErrorCode &errorCode) :
mutableTrie(umutablecptrie_open(0, 0, &errorCode)), trie(nullptr),
- canonStartSets(uprv_deleteUObject, NULL, errorCode) {}
+ canonStartSets(uprv_deleteUObject, nullptr, errorCode) {}
CanonIterData::~CanonIterData() {
umutablecptrie_close(mutableTrie);
@@ -2535,9 +2535,9 @@ initCanonIterData(Normalizer2Impl *impl, UErrorCode &errorCode) {
U_CDECL_END
void InitCanonIterData::doInit(Normalizer2Impl *impl, UErrorCode &errorCode) {
- U_ASSERT(impl->fCanonIterData == NULL);
+ U_ASSERT(impl->fCanonIterData == nullptr);
impl->fCanonIterData = new CanonIterData(errorCode);
- if (impl->fCanonIterData == NULL) {
+ if (impl->fCanonIterData == nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
}
if (U_SUCCESS(errorCode)) {
@@ -2562,7 +2562,7 @@ void InitCanonIterData::doInit(Normalizer2Impl *impl, UErrorCode &errorCode) {
}
if (U_FAILURE(errorCode)) {
delete impl->fCanonIterData;
- impl->fCanonIterData = NULL;
+ impl->fCanonIterData = nullptr;
}
}
@@ -2710,7 +2710,7 @@ unorm2_swap(const UDataSwapper *ds,
/* udata_swapDataHeader checks the arguments */
headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
@@ -2733,7 +2733,7 @@ unorm2_swap(const UDataSwapper *ds,
}
inBytes=(const uint8_t *)inData+headerSize;
- outBytes=(uint8_t *)outData+headerSize;
+ outBytes=(outData == nullptr) ? nullptr : (uint8_t *)outData+headerSize;
inIndexes=(const int32_t *)inBytes;
int32_t minIndexesLength;
diff --git a/thirdparty/icu4c/common/normalizer2impl.h b/thirdparty/icu4c/common/normalizer2impl.h
index 449e778384..2cca33d349 100644
--- a/thirdparty/icu4c/common/normalizer2impl.h
+++ b/thirdparty/icu4c/common/normalizer2impl.h
@@ -99,16 +99,16 @@ public:
* Decomposes c, which must be a Hangul syllable, into buffer
* and returns the length of the decomposition (2 or 3).
*/
- static inline int32_t decompose(UChar32 c, UChar buffer[3]) {
+ static inline int32_t decompose(UChar32 c, char16_t buffer[3]) {
c-=HANGUL_BASE;
UChar32 c2=c%JAMO_T_COUNT;
c/=JAMO_T_COUNT;
- buffer[0]=(UChar)(JAMO_L_BASE+c/JAMO_V_COUNT);
- buffer[1]=(UChar)(JAMO_V_BASE+c%JAMO_V_COUNT);
+ buffer[0]=(char16_t)(JAMO_L_BASE+c/JAMO_V_COUNT);
+ buffer[1]=(char16_t)(JAMO_V_BASE+c%JAMO_V_COUNT);
if(c2==0) {
return 2;
} else {
- buffer[2]=(UChar)(JAMO_T_BASE+c2);
+ buffer[2]=(char16_t)(JAMO_T_BASE+c2);
return 3;
}
}
@@ -117,17 +117,17 @@ public:
* Decomposes c, which must be a Hangul syllable, into buffer.
* This is the raw, not recursive, decomposition. Its length is always 2.
*/
- static inline void getRawDecomposition(UChar32 c, UChar buffer[2]) {
+ static inline void getRawDecomposition(UChar32 c, char16_t buffer[2]) {
UChar32 orig=c;
c-=HANGUL_BASE;
UChar32 c2=c%JAMO_T_COUNT;
if(c2==0) {
c/=JAMO_T_COUNT;
- buffer[0]=(UChar)(JAMO_L_BASE+c/JAMO_V_COUNT);
- buffer[1]=(UChar)(JAMO_V_BASE+c%JAMO_V_COUNT);
+ buffer[0]=(char16_t)(JAMO_L_BASE+c/JAMO_V_COUNT);
+ buffer[1]=(char16_t)(JAMO_V_BASE+c%JAMO_V_COUNT);
} else {
- buffer[0]=(UChar)(orig-c2); // LV syllable
- buffer[1]=(UChar)(JAMO_T_BASE+c2);
+ buffer[0]=(char16_t)(orig-c2); // LV syllable
+ buffer[1]=(char16_t)(JAMO_T_BASE+c2);
}
}
private:
@@ -154,22 +154,22 @@ public:
UBool isEmpty() const { return start==limit; }
int32_t length() const { return (int32_t)(limit-start); }
- UChar *getStart() { return start; }
- UChar *getLimit() { return limit; }
+ char16_t *getStart() { return start; }
+ char16_t *getLimit() { return limit; }
uint8_t getLastCC() const { return lastCC; }
- UBool equals(const UChar *start, const UChar *limit) const;
+ UBool equals(const char16_t *start, const char16_t *limit) const;
UBool equals(const uint8_t *otherStart, const uint8_t *otherLimit) const;
UBool append(UChar32 c, uint8_t cc, UErrorCode &errorCode) {
return (c<=0xffff) ?
- appendBMP((UChar)c, cc, errorCode) :
+ appendBMP((char16_t)c, cc, errorCode) :
appendSupplementary(c, cc, errorCode);
}
- UBool append(const UChar *s, int32_t length, UBool isNFD,
+ UBool append(const char16_t *s, int32_t length, UBool isNFD,
uint8_t leadCC, uint8_t trailCC,
UErrorCode &errorCode);
- UBool appendBMP(UChar c, uint8_t cc, UErrorCode &errorCode) {
+ UBool appendBMP(char16_t c, uint8_t cc, UErrorCode &errorCode) {
if(remainingCapacity==0 && !resize(1, errorCode)) {
return false;
}
@@ -186,10 +186,10 @@ public:
return true;
}
UBool appendZeroCC(UChar32 c, UErrorCode &errorCode);
- UBool appendZeroCC(const UChar *s, const UChar *sLimit, UErrorCode &errorCode);
+ UBool appendZeroCC(const char16_t *s, const char16_t *sLimit, UErrorCode &errorCode);
void remove();
void removeSuffix(int32_t suffixLength);
- void setReorderingLimit(UChar *newLimit) {
+ void setReorderingLimit(char16_t *newLimit) {
remainingCapacity+=(int32_t)(limit-newLimit);
reorderStart=limit=newLimit;
lastCC=0;
@@ -213,9 +213,9 @@ private:
UBool appendSupplementary(UChar32 c, uint8_t cc, UErrorCode &errorCode);
void insert(UChar32 c, uint8_t cc);
- static void writeCodePoint(UChar *p, UChar32 c) {
+ static void writeCodePoint(char16_t *p, UChar32 c) {
if(c<=0xffff) {
- *p=(UChar)c;
+ *p=(char16_t)c;
} else {
p[0]=U16_LEAD(c);
p[1]=U16_TRAIL(c);
@@ -225,7 +225,7 @@ private:
const Normalizer2Impl &impl;
UnicodeString &str;
- UChar *start, *reorderStart, *limit;
+ char16_t *start, *reorderStart, *limit;
int32_t remainingCapacity;
uint8_t lastCC;
@@ -234,7 +234,7 @@ private:
void skipPrevious(); // Requires start<codePointStart.
uint8_t previousCC(); // Returns 0 if there is no previous character.
- UChar *codePointStart, *codePointLimit;
+ char16_t *codePointStart, *codePointLimit;
};
/**
@@ -322,12 +322,12 @@ public:
* @param limit The end of the string, or NULL.
* @return The lccc(c) in bits 15..8 and tccc(c) in bits 7..0.
*/
- uint16_t nextFCD16(const UChar *&s, const UChar *limit) const {
+ uint16_t nextFCD16(const char16_t *&s, const char16_t *limit) const {
UChar32 c=*s++;
if(c<minDecompNoCP || !singleLeadMightHaveNonZeroFCD16(c)) {
return 0;
}
- UChar c2;
+ char16_t c2;
if(U16_IS_LEAD(c) && s!=limit && U16_IS_TRAIL(c2=*s)) {
c=U16_GET_SUPPLEMENTARY(c, c2);
++s;
@@ -340,7 +340,7 @@ public:
* @param s A valid pointer into a string. Requires start<s.
* @return The lccc(c) in bits 15..8 and tccc(c) in bits 7..0.
*/
- uint16_t previousFCD16(const UChar *start, const UChar *&s) const {
+ uint16_t previousFCD16(const char16_t *start, const char16_t *&s) const {
UChar32 c=*--s;
if(c<minDecompNoCP) {
return 0;
@@ -350,7 +350,7 @@ public:
return 0;
}
} else {
- UChar c2;
+ char16_t c2;
if(start<s && U16_IS_LEAD(c2=*(s-1))) {
c=U16_GET_SUPPLEMENTARY(c2, c);
--s;
@@ -376,7 +376,7 @@ public:
* @param length out-only, takes the length of the decomposition, if any
* @return pointer to the decomposition, or NULL if none
*/
- const UChar *getDecomposition(UChar32 c, UChar buffer[4], int32_t &length) const;
+ const char16_t *getDecomposition(UChar32 c, char16_t buffer[4], int32_t &length) const;
/**
* Gets the raw decomposition for one code point.
@@ -385,7 +385,7 @@ public:
* @param length out-only, takes the length of the decomposition, if any
* @return pointer to the decomposition, or NULL if none
*/
- const UChar *getRawDecomposition(UChar32 c, UChar buffer[30], int32_t &length) const;
+ const char16_t *getRawDecomposition(UChar32 c, char16_t buffer[30], int32_t &length) const;
UChar32 composePair(UChar32 a, UChar32 b) const;
@@ -480,13 +480,13 @@ public:
* limit can be NULL if src is NUL-terminated.
* destLengthEstimate is the initial dest buffer capacity and can be -1.
*/
- void decompose(const UChar *src, const UChar *limit,
+ void decompose(const char16_t *src, const char16_t *limit,
UnicodeString &dest, int32_t destLengthEstimate,
UErrorCode &errorCode) const;
- const UChar *decompose(const UChar *src, const UChar *limit,
+ const char16_t *decompose(const char16_t *src, const char16_t *limit,
ReorderingBuffer *buffer, UErrorCode &errorCode) const;
- void decomposeAndAppend(const UChar *src, const UChar *limit,
+ void decomposeAndAppend(const char16_t *src, const char16_t *limit,
UBool doDecompose,
UnicodeString &safeMiddle,
ReorderingBuffer &buffer,
@@ -497,15 +497,15 @@ public:
const uint8_t *src, const uint8_t *limit,
ByteSink *sink, Edits *edits, UErrorCode &errorCode) const;
- UBool compose(const UChar *src, const UChar *limit,
+ UBool compose(const char16_t *src, const char16_t *limit,
UBool onlyContiguous,
UBool doCompose,
ReorderingBuffer &buffer,
UErrorCode &errorCode) const;
- const UChar *composeQuickCheck(const UChar *src, const UChar *limit,
+ const char16_t *composeQuickCheck(const char16_t *src, const char16_t *limit,
UBool onlyContiguous,
UNormalizationCheckResult *pQCResult) const;
- void composeAndAppend(const UChar *src, const UChar *limit,
+ void composeAndAppend(const char16_t *src, const char16_t *limit,
UBool doCompose,
UBool onlyContiguous,
UnicodeString &safeMiddle,
@@ -517,9 +517,9 @@ public:
const uint8_t *src, const uint8_t *limit,
ByteSink *sink, icu::Edits *edits, UErrorCode &errorCode) const;
- const UChar *makeFCD(const UChar *src, const UChar *limit,
+ const char16_t *makeFCD(const char16_t *src, const char16_t *limit,
ReorderingBuffer *buffer, UErrorCode &errorCode) const;
- void makeFCDAndAppend(const UChar *src, const UChar *limit,
+ void makeFCDAndAppend(const char16_t *src, const char16_t *limit,
UBool doMakeFCD,
UnicodeString &safeMiddle,
ReorderingBuffer &buffer,
@@ -608,7 +608,7 @@ private:
return (uint8_t)(*getMapping(norm16)>>8); // tccc from yesNo
}
}
- uint8_t getPreviousTrailCC(const UChar *start, const UChar *p) const;
+ uint8_t getPreviousTrailCC(const char16_t *start, const char16_t *p) const;
uint8_t getPreviousTrailCC(const uint8_t *start, const uint8_t *p) const;
// Requires algorithmic-NoNo.
@@ -651,14 +651,14 @@ private:
getCompositionsListForComposite(norm16);
}
- const UChar *copyLowPrefixFromNulTerminated(const UChar *src,
+ const char16_t *copyLowPrefixFromNulTerminated(const char16_t *src,
UChar32 minNeedDataCP,
ReorderingBuffer *buffer,
UErrorCode &errorCode) const;
enum StopAt { STOP_AT_LIMIT, STOP_AT_DECOMP_BOUNDARY, STOP_AT_COMP_BOUNDARY };
- const UChar *decomposeShort(const UChar *src, const UChar *limit,
+ const char16_t *decomposeShort(const char16_t *src, const char16_t *limit,
UBool stopAtCompBoundary, UBool onlyContiguous,
ReorderingBuffer &buffer, UErrorCode &errorCode) const;
UBool decompose(UChar32 c, uint16_t norm16,
@@ -679,9 +679,9 @@ private:
UBool norm16HasCompBoundaryBefore(uint16_t norm16) const {
return norm16 < minNoNoCompNoMaybeCC || isAlgorithmicNoNo(norm16);
}
- UBool hasCompBoundaryBefore(const UChar *src, const UChar *limit) const;
+ UBool hasCompBoundaryBefore(const char16_t *src, const char16_t *limit) const;
UBool hasCompBoundaryBefore(const uint8_t *src, const uint8_t *limit) const;
- UBool hasCompBoundaryAfter(const UChar *start, const UChar *p,
+ UBool hasCompBoundaryAfter(const char16_t *start, const char16_t *p,
UBool onlyContiguous) const;
UBool hasCompBoundaryAfter(const uint8_t *start, const uint8_t *p,
UBool onlyContiguous) const;
@@ -695,11 +695,11 @@ private:
(norm16 & DELTA_TCCC_MASK) <= DELTA_TCCC_1 : *getMapping(norm16) <= 0x1ff);
}
- const UChar *findPreviousCompBoundary(const UChar *start, const UChar *p, UBool onlyContiguous) const;
- const UChar *findNextCompBoundary(const UChar *p, const UChar *limit, UBool onlyContiguous) const;
+ const char16_t *findPreviousCompBoundary(const char16_t *start, const char16_t *p, UBool onlyContiguous) const;
+ const char16_t *findNextCompBoundary(const char16_t *p, const char16_t *limit, UBool onlyContiguous) const;
- const UChar *findPreviousFCDBoundary(const UChar *start, const UChar *p) const;
- const UChar *findNextFCDBoundary(const UChar *p, const UChar *limit) const;
+ const char16_t *findPreviousFCDBoundary(const char16_t *start, const char16_t *p) const;
+ const char16_t *findNextFCDBoundary(const char16_t *p, const char16_t *limit) const;
void makeCanonIterDataFromNorm16(UChar32 start, UChar32 end, const uint16_t norm16,
CanonIterData &newData, UErrorCode &errorCode) const;
@@ -710,9 +710,9 @@ private:
// UVersionInfo dataVersion;
// BMP code point thresholds for quick check loops looking at single UTF-16 code units.
- UChar minDecompNoCP;
- UChar minCompNoMaybeCP;
- UChar minLcccCP;
+ char16_t minDecompNoCP;
+ char16_t minCompNoMaybeCP;
+ char16_t minLcccCP;
// Norm16 value thresholds for quick check combinations and types of extra data.
uint16_t minYesNo;
diff --git a/thirdparty/icu4c/common/normlzr.cpp b/thirdparty/icu4c/common/normlzr.cpp
index 58de61591f..52b9ffd54a 100644
--- a/thirdparty/icu4c/common/normlzr.cpp
+++ b/thirdparty/icu4c/common/normlzr.cpp
@@ -38,7 +38,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Normalizer)
//-------------------------------------------------------------------------
Normalizer::Normalizer(const UnicodeString& str, UNormalizationMode mode) :
- UObject(), fFilteredNorm2(NULL), fNorm2(NULL), fUMode(mode), fOptions(0),
+ UObject(), fFilteredNorm2(nullptr), fNorm2(nullptr), fUMode(mode), fOptions(0),
text(new StringCharacterIterator(str)),
currentIndex(0), nextIndex(0),
buffer(), bufferPos(0)
@@ -47,7 +47,7 @@ Normalizer::Normalizer(const UnicodeString& str, UNormalizationMode mode) :
}
Normalizer::Normalizer(ConstChar16Ptr str, int32_t length, UNormalizationMode mode) :
- UObject(), fFilteredNorm2(NULL), fNorm2(NULL), fUMode(mode), fOptions(0),
+ UObject(), fFilteredNorm2(nullptr), fNorm2(nullptr), fUMode(mode), fOptions(0),
text(new UCharCharacterIterator(str, length)),
currentIndex(0), nextIndex(0),
buffer(), bufferPos(0)
@@ -56,7 +56,7 @@ Normalizer::Normalizer(ConstChar16Ptr str, int32_t length, UNormalizationMode mo
}
Normalizer::Normalizer(const CharacterIterator& iter, UNormalizationMode mode) :
- UObject(), fFilteredNorm2(NULL), fNorm2(NULL), fUMode(mode), fOptions(0),
+ UObject(), fFilteredNorm2(nullptr), fNorm2(nullptr), fUMode(mode), fOptions(0),
text(iter.clone()),
currentIndex(0), nextIndex(0),
buffer(), bufferPos(0)
@@ -65,7 +65,7 @@ Normalizer::Normalizer(const CharacterIterator& iter, UNormalizationMode mode) :
}
Normalizer::Normalizer(const Normalizer &copy) :
- UObject(copy), fFilteredNorm2(NULL), fNorm2(NULL), fUMode(copy.fUMode), fOptions(copy.fOptions),
+ UObject(copy), fFilteredNorm2(nullptr), fNorm2(nullptr), fUMode(copy.fUMode), fOptions(copy.fOptions),
text(copy.text->clone()),
currentIndex(copy.currentIndex), nextIndex(copy.nextIndex),
buffer(copy.buffer), bufferPos(copy.bufferPos)
@@ -410,7 +410,7 @@ Normalizer::setText(const UnicodeString& newText,
return;
}
CharacterIterator *newIter = new StringCharacterIterator(newText);
- if (newIter == NULL) {
+ if (newIter == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -431,7 +431,7 @@ Normalizer::setText(const CharacterIterator& newText,
return;
}
CharacterIterator *newIter = newText.clone();
- if (newIter == NULL) {
+ if (newIter == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -449,7 +449,7 @@ Normalizer::setText(ConstChar16Ptr newText,
return;
}
CharacterIterator *newIter = new UCharCharacterIterator(newText, length);
- if (newIter == NULL) {
+ if (newIter == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
diff --git a/thirdparty/icu4c/common/patternprops.cpp b/thirdparty/icu4c/common/patternprops.cpp
index da3243d301..9922683cda 100644
--- a/thirdparty/icu4c/common/patternprops.cpp
+++ b/thirdparty/icu4c/common/patternprops.cpp
@@ -164,8 +164,8 @@ PatternProps::isWhiteSpace(UChar32 c) {
}
}
-const UChar *
-PatternProps::skipWhiteSpace(const UChar *s, int32_t length) {
+const char16_t *
+PatternProps::skipWhiteSpace(const char16_t *s, int32_t length) {
while(length>0 && isWhiteSpace(*s)) {
++s;
--length;
@@ -183,8 +183,8 @@ PatternProps::skipWhiteSpace(const UnicodeString& s, int32_t start) {
return i;
}
-const UChar *
-PatternProps::trimWhiteSpace(const UChar *s, int32_t &length) {
+const char16_t *
+PatternProps::trimWhiteSpace(const char16_t *s, int32_t &length) {
if(length<=0 || (!isWhiteSpace(s[0]) && !isWhiteSpace(s[length-1]))) {
return s;
}
@@ -205,11 +205,11 @@ PatternProps::trimWhiteSpace(const UChar *s, int32_t &length) {
}
UBool
-PatternProps::isIdentifier(const UChar *s, int32_t length) {
+PatternProps::isIdentifier(const char16_t *s, int32_t length) {
if(length<=0) {
return false;
}
- const UChar *limit=s+length;
+ const char16_t *limit=s+length;
do {
if(isSyntaxOrWhiteSpace(*s++)) {
return false;
@@ -218,8 +218,8 @@ PatternProps::isIdentifier(const UChar *s, int32_t length) {
return true;
}
-const UChar *
-PatternProps::skipIdentifier(const UChar *s, int32_t length) {
+const char16_t *
+PatternProps::skipIdentifier(const char16_t *s, int32_t length) {
while(length>0 && !isSyntaxOrWhiteSpace(*s)) {
++s;
--length;
diff --git a/thirdparty/icu4c/common/patternprops.h b/thirdparty/icu4c/common/patternprops.h
index 4ead56e1cd..23a88333f4 100644
--- a/thirdparty/icu4c/common/patternprops.h
+++ b/thirdparty/icu4c/common/patternprops.h
@@ -62,7 +62,7 @@ public:
* Skips over Pattern_White_Space starting at s.
* @return The smallest pointer at or after s with a non-white space character.
*/
- static const UChar *skipWhiteSpace(const UChar *s, int32_t length);
+ static const char16_t *skipWhiteSpace(const char16_t *s, int32_t length);
/**
* Skips over Pattern_White_Space starting at index start in s.
@@ -73,21 +73,21 @@ public:
/**
* @return s except with leading and trailing Pattern_White_Space removed and length adjusted.
*/
- static const UChar *trimWhiteSpace(const UChar *s, int32_t &length);
+ static const char16_t *trimWhiteSpace(const char16_t *s, int32_t &length);
/**
* Tests whether the string contains a "pattern identifier", that is,
* whether it contains only non-Pattern_White_Space, non-Pattern_Syntax characters.
* @return true if there are no Pattern_White_Space or Pattern_Syntax characters in s.
*/
- static UBool isIdentifier(const UChar *s, int32_t length);
+ static UBool isIdentifier(const char16_t *s, int32_t length);
/**
* Skips over a "pattern identifier" starting at index s.
* @return The smallest pointer at or after s with
* a Pattern_White_Space or Pattern_Syntax character.
*/
- static const UChar *skipIdentifier(const UChar *s, int32_t length);
+ static const char16_t *skipIdentifier(const char16_t *s, int32_t length);
private:
PatternProps() = delete; // no constructor: all static methods
diff --git a/thirdparty/icu4c/common/pluralmap.cpp b/thirdparty/icu4c/common/pluralmap.cpp
index ec87f0198e..7e6156de89 100644
--- a/thirdparty/icu4c/common/pluralmap.cpp
+++ b/thirdparty/icu4c/common/pluralmap.cpp
@@ -36,7 +36,7 @@ PluralMapBase::toCategory(const UnicodeString &pluralForm) {
const char *PluralMapBase::getCategoryName(Category c) {
int32_t index = c;
return (index < 0 || index >= UPRV_LENGTHOF(gPluralForms)) ?
- NULL : gPluralForms[index];
+ nullptr : gPluralForms[index];
}
diff --git a/thirdparty/icu4c/common/pluralmap.h b/thirdparty/icu4c/common/pluralmap.h
index 4988fd2699..11683599ed 100644
--- a/thirdparty/icu4c/common/pluralmap.h
+++ b/thirdparty/icu4c/common/pluralmap.h
@@ -53,7 +53,7 @@ public:
/**
* Converts a category to a name.
- * Passing NONE or CATEGORY_COUNT for category returns NULL.
+ * Passing NONE or CATEGORY_COUNT for category returns nullptr.
*/
static const char *getCategoryName(Category category);
};
@@ -89,7 +89,7 @@ public:
fVariants[0] = &fOtherVariant;
for (int32_t i = 1; i < UPRV_LENGTHOF(fVariants); ++i) {
fVariants[i] = other.fVariants[i] ?
- new T(*other.fVariants[i]) : NULL;
+ new T(*other.fVariants[i]) : nullptr;
}
}
@@ -98,12 +98,12 @@ public:
return *this;
}
for (int32_t i = 0; i < UPRV_LENGTHOF(fVariants); ++i) {
- if (fVariants[i] != NULL && other.fVariants[i] != NULL) {
+ if (fVariants[i] != nullptr && other.fVariants[i] != nullptr) {
*fVariants[i] = *other.fVariants[i];
- } else if (fVariants[i] != NULL) {
+ } else if (fVariants[i] != nullptr) {
delete fVariants[i];
- fVariants[i] = NULL;
- } else if (other.fVariants[i] != NULL) {
+ fVariants[i] = nullptr;
+ } else if (other.fVariants[i] != nullptr) {
fVariants[i] = new T(*other.fVariants[i]);
} else {
// do nothing
@@ -125,28 +125,28 @@ public:
*fVariants[0] = T();
for (int32_t i = 1; i < UPRV_LENGTHOF(fVariants); ++i) {
delete fVariants[i];
- fVariants[i] = NULL;
+ fVariants[i] = nullptr;
}
}
/**
* Iterates through the mappings in this instance, set index to NONE
* prior to using. Call next repeatedly to get the values until it
- * returns NULL. Each time next returns, caller may pass index
+ * returns nullptr. Each time next returns, caller may pass index
* to getCategoryName() to get the name of the plural category.
- * When this function returns NULL, index is CATEGORY_COUNT
+ * When this function returns nullptr, index is CATEGORY_COUNT
*/
const T *next(Category &index) const {
int32_t idx = index;
++idx;
for (; idx < UPRV_LENGTHOF(fVariants); ++idx) {
- if (fVariants[idx] != NULL) {
+ if (fVariants[idx] != nullptr) {
index = static_cast<Category>(idx);
return fVariants[idx];
}
}
index = static_cast<Category>(idx);
- return NULL;
+ return nullptr;
}
/**
@@ -172,7 +172,7 @@ public:
*/
const T &get(Category v) const {
int32_t index = v;
- if (index < 0 || index >= UPRV_LENGTHOF(fVariants) || fVariants[index] == NULL) {
+ if (index < 0 || index >= UPRV_LENGTHOF(fVariants) || fVariants[index] == nullptr) {
return *fVariants[0];
}
return *fVariants[index];
@@ -207,7 +207,7 @@ public:
T *getMutable(
Category category,
UErrorCode &status) {
- return getMutable(category, NULL, status);
+ return getMutable(category, nullptr, status);
}
/**
@@ -218,7 +218,7 @@ public:
T *getMutable(
const char *category,
UErrorCode &status) {
- return getMutable(toCategory(category), NULL, status);
+ return getMutable(toCategory(category), nullptr, status);
}
/**
@@ -243,7 +243,7 @@ public:
if (fVariants[i] == rhs.fVariants[i]) {
continue;
}
- if (fVariants[i] == NULL || rhs.fVariants[i] == NULL) {
+ if (fVariants[i] == nullptr || rhs.fVariants[i] == nullptr) {
return false;
}
if (!eqFunc(*fVariants[i], *rhs.fVariants[i])) {
@@ -262,15 +262,15 @@ private:
const T *defaultValue,
UErrorCode &status) {
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
int32_t index = category;
if (index < 0 || index >= UPRV_LENGTHOF(fVariants)) {
status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
- if (fVariants[index] == NULL) {
- fVariants[index] = defaultValue == NULL ?
+ if (fVariants[index] == nullptr) {
+ fVariants[index] = defaultValue == nullptr ?
new T() : new T(*defaultValue);
}
if (!fVariants[index]) {
@@ -282,7 +282,7 @@ private:
void initializeNew() {
fVariants[0] = &fOtherVariant;
for (int32_t i = 1; i < UPRV_LENGTHOF(fVariants); ++i) {
- fVariants[i] = NULL;
+ fVariants[i] = nullptr;
}
}
};
diff --git a/thirdparty/icu4c/common/propname.cpp b/thirdparty/icu4c/common/propname.cpp
index 8f0045fdac..45062bfbd9 100644
--- a/thirdparty/icu4c/common/propname.cpp
+++ b/thirdparty/icu4c/common/propname.cpp
@@ -204,20 +204,20 @@ int32_t PropNameData::findPropertyValueNameGroup(int32_t valueMapIndex, int32_t
const char *PropNameData::getName(const char *nameGroup, int32_t nameIndex) {
int32_t numNames=*nameGroup++;
if(nameIndex<0 || numNames<=nameIndex) {
- return NULL;
+ return nullptr;
}
// Skip nameIndex names.
for(; nameIndex>0; --nameIndex) {
nameGroup=uprv_strchr(nameGroup, 0)+1;
}
if(*nameGroup==0) {
- return NULL; // no name (Property[Value]Aliases.txt has "n/a")
+ return nullptr; // no name (Property[Value]Aliases.txt has "n/a")
}
return nameGroup;
}
UBool PropNameData::containsName(BytesTrie &trie, const char *name) {
- if(name==NULL) {
+ if(name==nullptr) {
return false;
}
UStringTrieResult result=USTRINGTRIE_NO_VALUE;
@@ -239,7 +239,7 @@ UBool PropNameData::containsName(BytesTrie &trie, const char *name) {
const char *PropNameData::getPropertyName(int32_t property, int32_t nameChoice) {
int32_t valueMapIndex=findProperty(property);
if(valueMapIndex==0) {
- return NULL; // Not a known property.
+ return nullptr; // Not a known property.
}
return getName(nameGroups+valueMaps[valueMapIndex], nameChoice);
}
@@ -247,11 +247,11 @@ const char *PropNameData::getPropertyName(int32_t property, int32_t nameChoice)
const char *PropNameData::getPropertyValueName(int32_t property, int32_t value, int32_t nameChoice) {
int32_t valueMapIndex=findProperty(property);
if(valueMapIndex==0) {
- return NULL; // Not a known property.
+ return nullptr; // Not a known property.
}
int32_t nameGroupOffset=findPropertyValueNameGroup(valueMaps[valueMapIndex+1], value);
if(nameGroupOffset==0) {
- return NULL;
+ return nullptr;
}
return getName(nameGroups+nameGroupOffset, nameChoice);
}
@@ -289,7 +289,10 @@ U_NAMESPACE_END
U_CAPI const char* U_EXPORT2
u_getPropertyName(UProperty property,
- UPropertyNameChoice nameChoice) {
+ UPropertyNameChoice nameChoice) UPRV_NO_SANITIZE_UNDEFINED {
+ // The nameChoice is really an integer with a couple of named constants.
+ // Unicode allows for names other than short and long ones.
+ // If present, these will be returned for U_LONG_PROPERTY_NAME + i, where i=1, 2,...
U_NAMESPACE_USE
return PropNameData::getPropertyName(property, nameChoice);
}
@@ -303,7 +306,10 @@ u_getPropertyEnum(const char* alias) {
U_CAPI const char* U_EXPORT2
u_getPropertyValueName(UProperty property,
int32_t value,
- UPropertyNameChoice nameChoice) {
+ UPropertyNameChoice nameChoice) UPRV_NO_SANITIZE_UNDEFINED {
+ // The nameChoice is really an integer with a couple of named constants.
+ // Unicode allows for names other than short and long ones.
+ // If present, these will be returned for U_LONG_PROPERTY_NAME + i, where i=1, 2,...
U_NAMESPACE_USE
return PropNameData::getPropertyValueName(property, value, nameChoice);
}
diff --git a/thirdparty/icu4c/common/propsvec.cpp b/thirdparty/icu4c/common/propsvec.cpp
index e5caa4b9d2..18cc3e8cd8 100644
--- a/thirdparty/icu4c/common/propsvec.cpp
+++ b/thirdparty/icu4c/common/propsvec.cpp
@@ -47,21 +47,21 @@ upvec_open(int32_t columns, UErrorCode *pErrorCode) {
uint32_t cp;
if(U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
if(columns<1) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
columns+=2; /* count range start and limit columns */
pv=(UPropsVectors *)uprv_malloc(sizeof(UPropsVectors));
v=(uint32_t *)uprv_malloc(UPVEC_INITIAL_ROWS*columns*4);
- if(pv==NULL || v==NULL) {
+ if(pv==nullptr || v==nullptr) {
uprv_free(pv);
uprv_free(v);
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
uprv_memset(pv, 0, sizeof(UPropsVectors));
pv->v=v;
@@ -85,7 +85,7 @@ upvec_open(int32_t columns, UErrorCode *pErrorCode) {
U_CAPI void U_EXPORT2
upvec_close(UPropsVectors *pv) {
- if(pv!=NULL) {
+ if(pv!=nullptr) {
uprv_free(pv->v);
uprv_free(pv);
}
@@ -165,7 +165,7 @@ upvec_setValue(UPropsVectors *pv,
if(U_FAILURE(*pErrorCode)) {
return;
}
- if( pv==NULL ||
+ if( pv==nullptr ||
start<0 || start>end || end>UPVEC_MAX_CP ||
column<0 || column>=(pv->columns-2)
) {
@@ -216,7 +216,7 @@ upvec_setValue(UPropsVectors *pv,
return;
}
newVectors=(uint32_t *)uprv_malloc(newMaxRows*columns*4);
- if(newVectors==NULL) {
+ if(newVectors==nullptr) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -296,15 +296,15 @@ upvec_getRow(const UPropsVectors *pv, int32_t rowIndex,
int32_t columns;
if(pv->isCompacted || rowIndex<0 || rowIndex>=pv->rows) {
- return NULL;
+ return nullptr;
}
columns=pv->columns;
row=pv->v+rowIndex*columns;
- if(pRangeStart!=NULL) {
+ if(pRangeStart!=nullptr) {
*pRangeStart=(UChar32)row[0];
}
- if(pRangeEnd!=NULL) {
+ if(pRangeEnd!=nullptr) {
*pRangeEnd=(UChar32)row[1]-1;
}
return row+2;
@@ -342,7 +342,7 @@ upvec_compact(UPropsVectors *pv, UPVecCompactHandler *handler, void *context, UE
if(U_FAILURE(*pErrorCode)) {
return;
}
- if(handler==NULL) {
+ if(handler==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -437,12 +437,12 @@ upvec_compact(UPropsVectors *pv, UPVecCompactHandler *handler, void *context, UE
U_CAPI const uint32_t * U_EXPORT2
upvec_getArray(const UPropsVectors *pv, int32_t *pRows, int32_t *pColumns) {
if(!pv->isCompacted) {
- return NULL;
+ return nullptr;
}
- if(pRows!=NULL) {
+ if(pRows!=nullptr) {
*pRows=pv->rows;
}
- if(pColumns!=NULL) {
+ if(pColumns!=nullptr) {
*pColumns=pv->columns-2;
}
return pv->v;
@@ -455,23 +455,23 @@ upvec_cloneArray(const UPropsVectors *pv,
int32_t byteLength;
if(U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
if(!pv->isCompacted) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
byteLength=pv->rows*(pv->columns-2)*4;
clonedArray=(uint32_t *)uprv_malloc(byteLength);
- if(clonedArray==NULL) {
+ if(clonedArray==nullptr) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
uprv_memcpy(clonedArray, pv->v, byteLength);
- if(pRows!=NULL) {
+ if(pRows!=nullptr) {
*pRows=pv->rows;
}
- if(pColumns!=NULL) {
+ if(pColumns!=nullptr) {
*pColumns=pv->columns-2;
}
return clonedArray;
@@ -479,12 +479,12 @@ upvec_cloneArray(const UPropsVectors *pv,
U_CAPI UTrie2 * U_EXPORT2
upvec_compactToUTrie2WithRowIndexes(UPropsVectors *pv, UErrorCode *pErrorCode) {
- UPVecToUTrie2Context toUTrie2={ NULL, 0, 0, 0 };
+ UPVecToUTrie2Context toUTrie2={ nullptr, 0, 0, 0 };
upvec_compact(pv, upvec_compactToUTrie2Handler, &toUTrie2, pErrorCode);
utrie2_freeze(toUTrie2.trie, UTRIE2_16_VALUE_BITS, pErrorCode);
if(U_FAILURE(*pErrorCode)) {
utrie2_close(toUTrie2.trie);
- toUTrie2.trie=NULL;
+ toUTrie2.trie=nullptr;
}
return toUTrie2.trie;
}
diff --git a/thirdparty/icu4c/common/punycode.cpp b/thirdparty/icu4c/common/punycode.cpp
index f95722da27..7ebdebc188 100644
--- a/thirdparty/icu4c/common/punycode.cpp
+++ b/thirdparty/icu4c/common/punycode.cpp
@@ -179,21 +179,21 @@ constexpr int32_t DECODE_MAX_CHARS=2000;
// encode
U_CAPI int32_t
-u_strToPunycode(const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destCapacity,
+u_strToPunycode(const char16_t *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
const UBool *caseFlags,
UErrorCode *pErrorCode) {
int32_t cpBuffer[ENCODE_MAX_CODE_UNITS];
int32_t n, delta, handledCPCount, basicLength, destLength, bias, j, m, q, k, t, srcCPCount;
- UChar c, c2;
+ char16_t c, c2;
/* argument checking */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(src==NULL || srcLength<-1 || (dest==NULL && destCapacity!=0)) {
+ if(src==nullptr || srcLength<-1 || (dest==nullptr && destCapacity!=0)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -221,13 +221,13 @@ u_strToPunycode(const UChar *src, int32_t srcLength,
cpBuffer[srcCPCount++]=0;
if(destLength<destCapacity) {
dest[destLength]=
- caseFlags!=NULL ?
+ caseFlags!=nullptr ?
asciiCaseMap((char)c, caseFlags[j]) :
(char)c;
}
++destLength;
} else {
- n=(caseFlags!=NULL && caseFlags[j])<<31L;
+ n=(caseFlags!=nullptr && caseFlags[j])<<31L;
if(U16_IS_SINGLE(c)) {
n|=c;
} else if(U16_IS_LEAD(c) && U16_IS_TRAIL(c2=src[j+1])) {
@@ -249,13 +249,13 @@ u_strToPunycode(const UChar *src, int32_t srcLength,
cpBuffer[srcCPCount++]=0;
if(destLength<destCapacity) {
dest[destLength]=
- caseFlags!=NULL ?
+ caseFlags!=nullptr ?
asciiCaseMap((char)c, caseFlags[j]) :
(char)c;
}
++destLength;
} else {
- n=(caseFlags!=NULL && caseFlags[j])<<31L;
+ n=(caseFlags!=nullptr && caseFlags[j])<<31L;
if(U16_IS_SINGLE(c)) {
n|=c;
} else if(U16_IS_LEAD(c) && (j+1)<srcLength && U16_IS_TRAIL(c2=src[j+1])) {
@@ -371,20 +371,20 @@ u_strToPunycode(const UChar *src, int32_t srcLength,
// decode
U_CAPI int32_t
-u_strFromPunycode(const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destCapacity,
+u_strFromPunycode(const char16_t *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
UBool *caseFlags,
UErrorCode *pErrorCode) {
int32_t n, destLength, i, bias, basicLength, j, in, oldi, w, k, digit, t,
destCPCount, firstSupplementaryIndex, cpLength;
- UChar b;
+ char16_t b;
/* argument checking */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(src==NULL || srcLength<-1 || (dest==NULL && destCapacity!=0)) {
+ if(src==nullptr || srcLength<-1 || (dest==nullptr && destCapacity!=0)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -421,9 +421,9 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
}
if(j<destCapacity) {
- dest[j]=(UChar)b;
+ dest[j]=(char16_t)b;
- if(caseFlags!=NULL) {
+ if(caseFlags!=nullptr) {
caseFlags[j]=IS_BASIC_UPPERCASE(b);
}
}
@@ -525,7 +525,7 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
/* Insert n at position i of the output: */
cpLength=U16_LENGTH(n);
- if(dest!=NULL && ((destLength+cpLength)<=destCapacity)) {
+ if(dest!=nullptr && ((destLength+cpLength)<=destCapacity)) {
int32_t codeUnitIndex;
/*
@@ -550,12 +550,12 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
U16_FWD_N(dest, codeUnitIndex, destLength, i-codeUnitIndex);
}
- /* use the UChar index codeUnitIndex instead of the code point index i */
+ /* use the char16_t index codeUnitIndex instead of the code point index i */
if(codeUnitIndex<destLength) {
uprv_memmove(dest+codeUnitIndex+cpLength,
dest+codeUnitIndex,
(destLength-codeUnitIndex)*U_SIZEOF_UCHAR);
- if(caseFlags!=NULL) {
+ if(caseFlags!=nullptr) {
uprv_memmove(caseFlags+codeUnitIndex+cpLength,
caseFlags+codeUnitIndex,
destLength-codeUnitIndex);
@@ -563,13 +563,13 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
}
if(cpLength==1) {
/* BMP, insert one code unit */
- dest[codeUnitIndex]=(UChar)n;
+ dest[codeUnitIndex]=(char16_t)n;
} else {
/* supplementary character, insert two code units */
dest[codeUnitIndex]=U16_LEAD(n);
dest[codeUnitIndex+1]=U16_TRAIL(n);
}
- if(caseFlags!=NULL) {
+ if(caseFlags!=nullptr) {
/* Case of last character determines uppercase flag: */
caseFlags[codeUnitIndex]=IS_BASIC_UPPERCASE(src[in-1]);
if(cpLength==2) {
diff --git a/thirdparty/icu4c/common/putil.cpp b/thirdparty/icu4c/common/putil.cpp
index f27c8737d2..ab904af20a 100644
--- a/thirdparty/icu4c/common/putil.cpp
+++ b/thirdparty/icu4c/common/putil.cpp
@@ -248,7 +248,7 @@ UBool fakeClock_set = false; /** True if fake clock has spun up **/
static UDate getUTCtime_real() {
struct timeval posixTime;
- gettimeofday(&posixTime, NULL);
+ gettimeofday(&posixTime, nullptr);
return (UDate)(((int64_t)posixTime.tv_sec * U_MILLIS_PER_SECOND) + (posixTime.tv_usec/1000));
}
@@ -258,7 +258,7 @@ static UDate getUTCtime_fake() {
if(!fakeClock_set) {
UDate real = getUTCtime_real();
const char *fake_start = getenv("U_FAKETIME_START");
- if((fake_start!=NULL) && (fake_start[0]!=0)) {
+ if((fake_start!=nullptr) && (fake_start[0]!=0)) {
sscanf(fake_start,"%lf",&fakeClock_t0);
fakeClock_dt = fakeClock_t0 - real;
fprintf(stderr,"U_DEBUG_FAKETIME was set at compile time, so the ICU clock will start at a preset value\n"
@@ -319,7 +319,7 @@ uprv_getRawUTCtime()
#if HAVE_GETTIMEOFDAY
struct timeval posixTime;
- gettimeofday(&posixTime, NULL);
+ gettimeofday(&posixTime, nullptr);
return (UDate)(((int64_t)posixTime.tv_sec * U_MILLIS_PER_SECOND) + (posixTime.tv_usec/1000));
#else
time_t epochtime;
@@ -580,7 +580,7 @@ uprv_trunc(double d)
* type of arbitrary bit length.
*/
U_CAPI double U_EXPORT2
-uprv_maxMantissa(void)
+uprv_maxMantissa()
{
return pow(2.0, DBL_MANT_DIG + 1.0) - 1.0;
}
@@ -612,11 +612,11 @@ uprv_maximumPtr(void * base)
* Unlike other operating systems, the pointer model isn't determined at
* compile time on i5/OS.
*/
- if ((base != NULL) && (_TESTPTR(base, _C_TERASPACE_CHECK))) {
+ if ((base != nullptr) && (_TESTPTR(base, _C_TERASPACE_CHECK))) {
/* if it is a TERASPACE pointer the max is 2GB - 4k */
return ((void *)(((char *)base)-((uint32_t)(base))+((uint32_t)0x7fffefff)));
}
- /* otherwise 16MB since NULL ptr is not checkable or the ptr is not TERASPACE */
+ /* otherwise 16MB since nullptr ptr is not checkable or the ptr is not TERASPACE */
return ((void *)(((char *)base)-((uint32_t)(base))+((uint32_t)0xffefff)));
#else
@@ -722,7 +722,7 @@ extern U_IMPORT char *U_TZNAME[];
#include <dirent.h> /* Needed to search through system timezone files */
#endif
static char gTimeZoneBuffer[PATH_MAX];
-static char *gTimeZoneBufferPtr = NULL;
+static const char *gTimeZoneBufferPtr = nullptr;
#endif
#if !U_PLATFORM_USES_ONLY_WIN32_API
@@ -879,7 +879,7 @@ static const char* remapShortTimeZone(const char *stdID, const char *dstID, int3
return OFFSET_ZONE_MAPPINGS[idx].olsonID;
}
}
- return NULL;
+ return nullptr;
}
#endif
@@ -907,14 +907,14 @@ static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFil
char bufferFile[MAX_READ_SIZE];
UBool result = true;
- if (tzInfo->defaultTZFilePtr == NULL) {
+ if (tzInfo->defaultTZFilePtr == nullptr) {
tzInfo->defaultTZFilePtr = fopen(defaultTZFileName, "r");
}
file = fopen(TZFileName, "r");
tzInfo->defaultTZPosition = 0; /* reset position to begin search */
- if (file != NULL && tzInfo->defaultTZFilePtr != NULL) {
+ if (file != nullptr && tzInfo->defaultTZFilePtr != nullptr) {
/* First check that the file size are equal. */
if (tzInfo->defaultTZFileSize == 0) {
fseek(tzInfo->defaultTZFilePtr, 0, SEEK_END);
@@ -930,7 +930,7 @@ static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFil
/* Store the data from the files in separate buffers and
* compare each byte to determine equality.
*/
- if (tzInfo->defaultTZBuffer == NULL) {
+ if (tzInfo->defaultTZBuffer == nullptr) {
rewind(tzInfo->defaultTZFilePtr);
tzInfo->defaultTZBuffer = (char*)uprv_malloc(sizeof(char) * tzInfo->defaultTZFileSize);
sizeFileRead = fread(tzInfo->defaultTZBuffer, 1, tzInfo->defaultTZFileSize, tzInfo->defaultTZFilePtr);
@@ -953,7 +953,7 @@ static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFil
result = false;
}
- if (file != NULL) {
+ if (file != nullptr) {
fclose(file);
}
@@ -964,17 +964,17 @@ static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFil
/* dirent also lists two entries: "." and ".." that we can safely ignore. */
#define SKIP1 "."
#define SKIP2 ".."
-static UBool U_CALLCONV putil_cleanup(void);
-static CharString *gSearchTZFileResult = NULL;
+static UBool U_CALLCONV putil_cleanup();
+static CharString *gSearchTZFileResult = nullptr;
/*
* This method recursively traverses the directory given for a matching TZ file and returns the first match.
* This function is not thread safe - it uses a global, gSearchTZFileResult, to hold its results.
*/
static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
- DIR* dirp = NULL;
- struct dirent* dirEntry = NULL;
- char* result = NULL;
+ DIR* dirp = nullptr;
+ struct dirent* dirEntry = nullptr;
+ char* result = nullptr;
UErrorCode status = U_ZERO_ERROR;
/* Save the current path */
@@ -984,20 +984,20 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
}
dirp = opendir(path);
- if (dirp == NULL) {
+ if (dirp == nullptr) {
goto cleanupAndReturn;
}
- if (gSearchTZFileResult == NULL) {
+ if (gSearchTZFileResult == nullptr) {
gSearchTZFileResult = new CharString;
- if (gSearchTZFileResult == NULL) {
+ if (gSearchTZFileResult == nullptr) {
goto cleanupAndReturn;
}
ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup);
}
/* Check each entry in the directory. */
- while((dirEntry = readdir(dirp)) != NULL) {
+ while((dirEntry = readdir(dirp)) != nullptr) {
const char* dirName = dirEntry->d_name;
if (uprv_strcmp(dirName, SKIP1) != 0 && uprv_strcmp(dirName, SKIP2) != 0
&& uprv_strcmp(TZFILE_SKIP, dirName) != 0 && uprv_strcmp(TZFILE_SKIP2, dirName) != 0) {
@@ -1008,8 +1008,8 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
break;
}
- DIR* subDirp = NULL;
- if ((subDirp = opendir(newpath.data())) != NULL) {
+ DIR* subDirp = nullptr;
+ if ((subDirp = opendir(newpath.data())) != nullptr) {
/* If this new path is a directory, make a recursive call with the newpath. */
closedir(subDirp);
newpath.append('/', status);
@@ -1021,11 +1021,11 @@ static char* searchForTZFile(const char* path, DefaultTZInfo* tzInfo) {
Have to get out here. Otherwise, we'd keep looking
and return the first match in the top-level directory
if there's a match in the top-level. If not, this function
- would return NULL and set gTimeZoneBufferPtr to NULL in initDefault().
+ would return nullptr and set gTimeZoneBufferPtr to nullptr in initDefault().
It worked without this in most cases because we have a fallback of calling
localtime_r to figure out the default timezone.
*/
- if (result != NULL)
+ if (result != nullptr)
break;
} else {
if(compareBinaryFiles(TZDEFAULT, newpath.data(), tzInfo)) {
@@ -1074,7 +1074,7 @@ static void u_property_read(void* cookie, const char* name, const char* value,
#endif
U_CAPI void U_EXPORT2
-uprv_tzname_clear_cache(void)
+uprv_tzname_clear_cache()
{
#if U_PLATFORM == U_PF_ANDROID
/* Android's timezone is stored in system property. */
@@ -1104,7 +1104,7 @@ uprv_tzname_clear_cache(void)
#endif
#if defined(CHECK_LOCALTIME_LINK) && !defined(DEBUG_SKIP_LOCALTIME_LINK)
- gTimeZoneBufferPtr = NULL;
+ gTimeZoneBufferPtr = nullptr;
#endif
}
@@ -1112,11 +1112,11 @@ U_CAPI const char* U_EXPORT2
uprv_tzname(int n)
{
(void)n; // Avoid unreferenced parameter warning.
- const char *tzid = NULL;
+ const char *tzid = nullptr;
#if U_PLATFORM_USES_ONLY_WIN32_API
tzid = uprv_detectWindowsTimeZone();
- if (tzid != NULL) {
+ if (tzid != nullptr) {
return tzid;
}
@@ -1134,7 +1134,7 @@ uprv_tzname(int n)
int ret;
tzid = getenv("TZFILE");
- if (tzid != NULL) {
+ if (tzid != nullptr) {
return tzid;
}
#endif*/
@@ -1146,7 +1146,7 @@ uprv_tzname(int n)
#else
tzid = getenv("TZ");
#endif
- if (tzid != NULL && isValidOlsonID(tzid)
+ if (tzid != nullptr && isValidOlsonID(tzid)
#if U_PLATFORM == U_PF_SOLARIS
/* Don't misinterpret TZ "localtime" on Solaris as a time zone name. */
&& uprv_strcmp(tzid, TZ_ENV_CHECK) != 0
@@ -1165,46 +1165,46 @@ uprv_tzname(int n)
#if defined(CHECK_LOCALTIME_LINK) && !defined(DEBUG_SKIP_LOCALTIME_LINK)
/* Caller must handle threading issues */
- if (gTimeZoneBufferPtr == NULL) {
+ if (gTimeZoneBufferPtr == nullptr) {
/*
This is a trick to look at the name of the link to get the Olson ID
because the tzfile contents is underspecified.
This isn't guaranteed to work because it may not be a symlink.
*/
- int32_t ret = (int32_t)readlink(TZDEFAULT, gTimeZoneBuffer, sizeof(gTimeZoneBuffer)-1);
- if (0 < ret) {
+ char *ret = realpath(TZDEFAULT, gTimeZoneBuffer);
+ if (ret != nullptr && uprv_strcmp(TZDEFAULT, gTimeZoneBuffer) != 0) {
int32_t tzZoneInfoTailLen = uprv_strlen(TZZONEINFOTAIL);
- gTimeZoneBuffer[ret] = 0;
- char * tzZoneInfoTailPtr = uprv_strstr(gTimeZoneBuffer, TZZONEINFOTAIL);
-
- if (tzZoneInfoTailPtr != NULL
- && isValidOlsonID(tzZoneInfoTailPtr + tzZoneInfoTailLen))
- {
- return (gTimeZoneBufferPtr = tzZoneInfoTailPtr + tzZoneInfoTailLen);
+ const char *tzZoneInfoTailPtr = uprv_strstr(gTimeZoneBuffer, TZZONEINFOTAIL);
+ if (tzZoneInfoTailPtr != nullptr) {
+ tzZoneInfoTailPtr += tzZoneInfoTailLen;
+ skipZoneIDPrefix(&tzZoneInfoTailPtr);
+ if (isValidOlsonID(tzZoneInfoTailPtr)) {
+ return (gTimeZoneBufferPtr = tzZoneInfoTailPtr);
+ }
}
} else {
#if defined(SEARCH_TZFILE)
DefaultTZInfo* tzInfo = (DefaultTZInfo*)uprv_malloc(sizeof(DefaultTZInfo));
- if (tzInfo != NULL) {
- tzInfo->defaultTZBuffer = NULL;
+ if (tzInfo != nullptr) {
+ tzInfo->defaultTZBuffer = nullptr;
tzInfo->defaultTZFileSize = 0;
- tzInfo->defaultTZFilePtr = NULL;
+ tzInfo->defaultTZFilePtr = nullptr;
tzInfo->defaultTZstatus = false;
tzInfo->defaultTZPosition = 0;
gTimeZoneBufferPtr = searchForTZFile(TZZONEINFO, tzInfo);
/* Free previously allocated memory */
- if (tzInfo->defaultTZBuffer != NULL) {
+ if (tzInfo->defaultTZBuffer != nullptr) {
uprv_free(tzInfo->defaultTZBuffer);
}
- if (tzInfo->defaultTZFilePtr != NULL) {
+ if (tzInfo->defaultTZFilePtr != nullptr) {
fclose(tzInfo->defaultTZFilePtr);
}
uprv_free(tzInfo);
}
- if (gTimeZoneBufferPtr != NULL && isValidOlsonID(gTimeZoneBufferPtr)) {
+ if (gTimeZoneBufferPtr != nullptr && isValidOlsonID(gTimeZoneBufferPtr)) {
return gTimeZoneBufferPtr;
}
#endif
@@ -1247,7 +1247,7 @@ uprv_tzname(int n)
daylightType = U_DAYLIGHT_NONE;
}
tzid = remapShortTimeZone(U_TZNAME[0], U_TZNAME[1], daylightType, uprv_timezone());
- if (tzid != NULL) {
+ if (tzid != nullptr) {
return tzid;
}
}
@@ -1261,37 +1261,37 @@ uprv_tzname(int n)
/* Get and set the ICU data directory --------------------------------------- */
static icu::UInitOnce gDataDirInitOnce {};
-static char *gDataDirectory = NULL;
+static char *gDataDirectory = nullptr;
UInitOnce gTimeZoneFilesInitOnce {};
-static CharString *gTimeZoneFilesDirectory = NULL;
+static CharString *gTimeZoneFilesDirectory = nullptr;
#if U_POSIX_LOCALE || U_PLATFORM_USES_ONLY_WIN32_API
- static const char *gCorrectedPOSIXLocale = NULL; /* Sometimes heap allocated */
+ static const char *gCorrectedPOSIXLocale = nullptr; /* Sometimes heap allocated */
static bool gCorrectedPOSIXLocaleHeapAllocated = false;
#endif
-static UBool U_CALLCONV putil_cleanup(void)
+static UBool U_CALLCONV putil_cleanup()
{
if (gDataDirectory && *gDataDirectory) {
uprv_free(gDataDirectory);
}
- gDataDirectory = NULL;
+ gDataDirectory = nullptr;
gDataDirInitOnce.reset();
delete gTimeZoneFilesDirectory;
- gTimeZoneFilesDirectory = NULL;
+ gTimeZoneFilesDirectory = nullptr;
gTimeZoneFilesInitOnce.reset();
#ifdef SEARCH_TZFILE
delete gSearchTZFileResult;
- gSearchTZFileResult = NULL;
+ gSearchTZFileResult = nullptr;
#endif
#if U_POSIX_LOCALE || U_PLATFORM_USES_ONLY_WIN32_API
if (gCorrectedPOSIXLocale && gCorrectedPOSIXLocaleHeapAllocated) {
uprv_free(const_cast<char *>(gCorrectedPOSIXLocale));
- gCorrectedPOSIXLocale = NULL;
+ gCorrectedPOSIXLocale = nullptr;
gCorrectedPOSIXLocaleHeapAllocated = false;
}
#endif
@@ -1307,9 +1307,9 @@ u_setDataDirectory(const char *directory) {
char *newDataDir;
int32_t length;
- if(directory==NULL || *directory==0) {
+ if(directory==nullptr || *directory==0) {
/* A small optimization to prevent the malloc and copy when the
- shared library is used, and this is a way to make sure that NULL
+ shared library is used, and this is a way to make sure that nullptr
is never returned.
*/
newDataDir = (char *)"";
@@ -1318,7 +1318,7 @@ u_setDataDirectory(const char *directory) {
length=(int32_t)uprv_strlen(directory);
newDataDir = (char *)uprv_malloc(length + 2);
/* Exit out if newDataDir could not be created. */
- if (newDataDir == NULL) {
+ if (newDataDir == nullptr) {
return;
}
uprv_strcpy(newDataDir, directory);
@@ -1326,7 +1326,7 @@ u_setDataDirectory(const char *directory) {
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
{
char *p;
- while((p = uprv_strchr(newDataDir, U_FILE_ALT_SEP_CHAR)) != NULL) {
+ while((p = uprv_strchr(newDataDir, U_FILE_ALT_SEP_CHAR)) != nullptr) {
*p = U_FILE_SEP_CHAR;
}
}
@@ -1389,7 +1389,7 @@ static BOOL U_CALLCONV getIcuDataDirectoryUnderWindowsDirectory(char* directoryB
UErrorCode status = U_ZERO_ERROR;
int32_t windowsPathUtf8Len = 0;
u_strToUTF8(windowsPathUtf8, static_cast<int32_t>(UPRV_LENGTHOF(windowsPathUtf8)),
- &windowsPathUtf8Len, reinterpret_cast<const UChar*>(windowsPath), -1, &status);
+ &windowsPathUtf8Len, reinterpret_cast<const char16_t*>(windowsPath), -1, &status);
if (U_SUCCESS(status) && (status != U_STRING_NOT_TERMINATED_WARNING) &&
(windowsPathUtf8Len < (UPRV_LENGTHOF(windowsPathUtf8) - 1))) {
@@ -1419,7 +1419,7 @@ static void U_CALLCONV dataDirectoryInitFn() {
return;
}
- const char *path = NULL;
+ const char *path = nullptr;
#if defined(ICU_DATA_DIR_PREFIX_ENV_VAR)
char datadir_path_buffer[PATH_MAX];
#endif
@@ -1452,7 +1452,7 @@ static void U_CALLCONV dataDirectoryInitFn() {
* set their own path.
*/
#if defined(ICU_DATA_DIR) || defined(U_ICU_DATA_DEFAULT_DIR)
- if(path==NULL || *path==0) {
+ if(path==nullptr || *path==0) {
# if defined(ICU_DATA_DIR_PREFIX_ENV_VAR)
const char *prefix = getenv(ICU_DATA_DIR_PREFIX_ENV_VAR);
# endif
@@ -1462,8 +1462,8 @@ static void U_CALLCONV dataDirectoryInitFn() {
path=U_ICU_DATA_DEFAULT_DIR;
# endif
# if defined(ICU_DATA_DIR_PREFIX_ENV_VAR)
- if (prefix != NULL) {
- snprintf(datadir_path_buffer, PATH_MAX, "%s%s", prefix, path);
+ if (prefix != nullptr) {
+ snprintf(datadir_path_buffer, sizeof(datadir_path_buffer), "%s%s", prefix, path);
path=datadir_path_buffer;
}
# endif
@@ -1477,7 +1477,7 @@ static void U_CALLCONV dataDirectoryInitFn() {
}
#endif
- if(path==NULL) {
+ if(path==nullptr) {
/* It looks really bad, set it to something. */
path = "";
}
@@ -1487,7 +1487,7 @@ static void U_CALLCONV dataDirectoryInitFn() {
}
U_CAPI const char * U_EXPORT2
-u_getDataDirectory(void) {
+u_getDataDirectory() {
umtx_initOnce(gDataDirInitOnce, &dataDirectoryInitFn);
return gDataDirectory;
}
@@ -1500,7 +1500,7 @@ static void setTimeZoneFilesDir(const char *path, UErrorCode &status) {
gTimeZoneFilesDirectory->append(path, status);
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
char *p = gTimeZoneFilesDirectory->data();
- while ((p = uprv_strchr(p, U_FILE_ALT_SEP_CHAR)) != NULL) {
+ while ((p = uprv_strchr(p, U_FILE_ALT_SEP_CHAR)) != nullptr) {
*p = U_FILE_SEP_CHAR;
}
#endif
@@ -1510,10 +1510,10 @@ static void setTimeZoneFilesDir(const char *path, UErrorCode &status) {
#define TO_STRING_2(x) #x
static void U_CALLCONV TimeZoneDataDirInitFn(UErrorCode &status) {
- U_ASSERT(gTimeZoneFilesDirectory == NULL);
+ U_ASSERT(gTimeZoneFilesDirectory == nullptr);
ucln_common_registerCleanup(UCLN_COMMON_PUTIL, putil_cleanup);
gTimeZoneFilesDirectory = new CharString();
- if (gTimeZoneFilesDirectory == NULL) {
+ if (gTimeZoneFilesDirectory == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1541,19 +1541,19 @@ static void U_CALLCONV TimeZoneDataDirInitFn(UErrorCode &status) {
#endif // U_PLATFORM_HAS_WINUWP_API
#if defined(U_TIMEZONE_FILES_DIR)
- if (dir == NULL) {
+ if (dir == nullptr) {
// Build time configuration setting.
dir = TO_STRING(U_TIMEZONE_FILES_DIR);
}
#endif
- if (dir == NULL) {
+ if (dir == nullptr) {
dir = "";
}
#if defined(ICU_TIMEZONE_FILES_DIR_PREFIX_ENV_VAR)
- if (prefix != NULL) {
- snprintf(timezonefilesdir_path_buffer, PATH_MAX, "%s%s", prefix, dir);
+ if (prefix != nullptr) {
+ snprintf(timezonefilesdir_path_buffer, sizeof(timezonefilesdir_path_buffer), "%s%s", prefix, dir);
dir = timezonefilesdir_path_buffer;
}
#endif
@@ -1586,7 +1586,7 @@ u_setTimeZoneFilesDirectory(const char *path, UErrorCode *status) {
*/
static const char *uprv_getPOSIXIDForCategory(int category)
{
- const char* posixID = NULL;
+ const char* posixID = nullptr;
if (category == LC_MESSAGES || category == LC_CTYPE) {
/*
* On Solaris two different calls to setlocale can result in
@@ -1596,7 +1596,7 @@ static const char *uprv_getPOSIXIDForCategory(int category)
*
* LC_ALL can't be used because it's platform dependent. The LANG
* environment variable seems to affect LC_CTYPE variable by default.
- * Here is what setlocale(LC_ALL, NULL) can return.
+ * Here is what setlocale(LC_ALL, nullptr) can return.
* HPUX can return 'C C C C C C C'
* Solaris can return /en_US/C/C/C/C/C on the second try.
* Linux can return LC_CTYPE=C;LC_NUMERIC=C;...
@@ -1604,9 +1604,9 @@ static const char *uprv_getPOSIXIDForCategory(int category)
* The default codepage detection also needs to use LC_CTYPE.
*
* Do not call setlocale(LC_*, "")! Using an empty string instead
- * of NULL, will modify the libc behavior.
+ * of nullptr, will modify the libc behavior.
*/
- posixID = setlocale(category, NULL);
+ posixID = setlocale(category, nullptr);
if ((posixID == 0)
|| (uprv_strcmp("C", posixID) == 0)
|| (uprv_strcmp("POSIX", posixID) == 0))
@@ -1647,9 +1647,9 @@ static const char *uprv_getPOSIXIDForCategory(int category)
/* Return just the POSIX id for the default locale, whatever happens to be in
* it. It gets the value from LC_MESSAGES and indirectly from LC_ALL and LANG.
*/
-static const char *uprv_getPOSIXIDForDefaultLocale(void)
+static const char *uprv_getPOSIXIDForDefaultLocale()
{
- static const char* posixID = NULL;
+ static const char* posixID = nullptr;
if (posixID == 0) {
posixID = uprv_getPOSIXIDForCategory(LC_MESSAGES);
}
@@ -1660,9 +1660,9 @@ static const char *uprv_getPOSIXIDForDefaultLocale(void)
/* Return just the POSIX id for the default codepage, whatever happens to be in
* it. It gets the value from LC_CTYPE and indirectly from LC_ALL and LANG.
*/
-static const char *uprv_getPOSIXIDForDefaultCodepage(void)
+static const char *uprv_getPOSIXIDForDefaultCodepage()
{
- static const char* posixID = NULL;
+ static const char* posixID = nullptr;
if (posixID == 0) {
posixID = uprv_getPOSIXIDForCategory(LC_CTYPE);
}
@@ -1861,16 +1861,16 @@ The leftmost codepage (.xxx) wins.
const char *localeID = getenv("LC_ALL");
char *p;
- if (localeID == NULL)
+ if (localeID == nullptr)
localeID = getenv("LANG");
- if (localeID == NULL)
- localeID = setlocale(LC_ALL, NULL);
+ if (localeID == nullptr)
+ localeID = setlocale(LC_ALL, nullptr);
/* Make sure we have something... */
- if (localeID == NULL)
+ if (localeID == nullptr)
return "en_US_POSIX";
/* Extract the locale name from the path. */
- if((p = uprv_strrchr(localeID, '/')) != NULL)
+ if((p = uprv_strrchr(localeID, '/')) != nullptr)
{
/* Increment p to start of locale name. */
p++;
@@ -1881,7 +1881,7 @@ The leftmost codepage (.xxx) wins.
uprv_strcpy(correctedLocale, localeID);
/* Strip off the '.locale' extension. */
- if((p = uprv_strchr(correctedLocale, '.')) != NULL) {
+ if((p = uprv_strchr(correctedLocale, '.')) != nullptr) {
*p = 0;
}
@@ -1961,12 +1961,12 @@ names to the ICU alias table in the data directory.
*/
static const char*
remapPlatformDependentCodepage(const char *locale, const char *name) {
- if (locale != NULL && *locale == 0) {
+ if (locale != nullptr && *locale == 0) {
/* Make sure that an empty locale is handled the same way. */
- locale = NULL;
+ locale = nullptr;
}
- if (name == NULL) {
- return NULL;
+ if (name == nullptr) {
+ return nullptr;
}
#if U_PLATFORM == U_PF_AIX
if (uprv_strcmp(name, "IBM-943") == 0) {
@@ -1978,7 +1978,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) {
name = "IBM-5348";
}
#elif U_PLATFORM == U_PF_SOLARIS
- if (locale != NULL && uprv_strcmp(name, "EUC") == 0) {
+ if (locale != nullptr && uprv_strcmp(name, "EUC") == 0) {
/* Solaris underspecifies the "EUC" name. */
if (uprv_strcmp(locale, "zh_CN") == 0) {
name = "EUC-CN";
@@ -2005,7 +2005,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) {
name = "ISO-8859-1";
}
#elif U_PLATFORM_IS_DARWIN_BASED
- if (locale == NULL && *name == 0) {
+ if (locale == nullptr && *name == 0) {
/*
No locale was specified, and an empty name was passed in.
This usually indicates that nl_langinfo didn't return valid information.
@@ -2017,7 +2017,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) {
/* Remap CP949 to a similar codepage to avoid issues with backslash and won symbol. */
name = "EUC-KR";
}
- else if (locale != NULL && uprv_strcmp(locale, "en_US_POSIX") != 0 && uprv_strcmp(name, "US-ASCII") == 0) {
+ else if (locale != nullptr && uprv_strcmp(locale, "en_US_POSIX") != 0 && uprv_strcmp(name, "US-ASCII") == 0) {
/*
* For non C/POSIX locale, default the code page to UTF-8 instead of US-ASCII.
*/
@@ -2029,7 +2029,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) {
name = "EUC-KR";
}
#elif U_PLATFORM == U_PF_HPUX
- if (locale != NULL && uprv_strcmp(locale, "zh_HK") == 0 && uprv_strcmp(name, "big5") == 0) {
+ if (locale != nullptr && uprv_strcmp(locale, "zh_HK") == 0 && uprv_strcmp(name, "big5") == 0) {
/* HP decided to extend big5 as hkbig5 even though it's not compatible :-( */
/* zh_TW.big5 is not the same charset as zh_HK.big5! */
name = "hkbig5";
@@ -2043,7 +2043,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) {
name = "eucjis";
}
#elif U_PLATFORM == U_PF_LINUX
- if (locale != NULL && uprv_strcmp(name, "euc") == 0) {
+ if (locale != nullptr && uprv_strcmp(name, "euc") == 0) {
/* Linux underspecifies the "EUC" name. */
if (uprv_strcmp(locale, "korean") == 0) {
name = "EUC-KR";
@@ -2061,7 +2061,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) {
*/
name = "eucjis";
}
- else if (locale != NULL && uprv_strcmp(locale, "en_US_POSIX") != 0 &&
+ else if (locale != nullptr && uprv_strcmp(locale, "en_US_POSIX") != 0 &&
(uprv_strcmp(name, "ANSI_X3.4-1968") == 0 || uprv_strcmp(name, "US-ASCII") == 0)) {
/*
* For non C/POSIX locale, default the code page to UTF-8 instead of US-ASCII.
@@ -2070,13 +2070,13 @@ remapPlatformDependentCodepage(const char *locale, const char *name) {
}
/*
* Linux returns ANSI_X3.4-1968 for C/POSIX, but the call site takes care of
- * it by falling back to 'US-ASCII' when NULL is returned from this
+ * it by falling back to 'US-ASCII' when nullptr is returned from this
* function. So, we don't have to worry about it here.
*/
#endif
- /* return NULL when "" is passed in */
+ /* return nullptr when "" is passed in */
if (*name == 0) {
- name = NULL;
+ name = nullptr;
}
return name;
}
@@ -2085,16 +2085,16 @@ static const char*
getCodepageFromPOSIXID(const char *localeName, char * buffer, int32_t buffCapacity)
{
char localeBuf[100];
- const char *name = NULL;
- char *variant = NULL;
+ const char *name = nullptr;
+ char *variant = nullptr;
- if (localeName != NULL && (name = (uprv_strchr(localeName, '.'))) != NULL) {
+ if (localeName != nullptr && (name = (uprv_strchr(localeName, '.'))) != nullptr) {
size_t localeCapacity = uprv_min(sizeof(localeBuf), (name-localeName)+1);
uprv_strncpy(localeBuf, localeName, localeCapacity);
- localeBuf[localeCapacity-1] = 0; /* ensure NULL termination */
+ localeBuf[localeCapacity-1] = 0; /* ensure NUL termination */
name = uprv_strncpy(buffer, name+1, buffCapacity);
- buffer[buffCapacity-1] = 0; /* ensure NULL termination */
- if ((variant = const_cast<char *>(uprv_strchr(name, '@'))) != NULL) {
+ buffer[buffCapacity-1] = 0; /* ensure NUL termination */
+ if ((variant = const_cast<char *>(uprv_strchr(name, '@'))) != nullptr) {
*variant = 0;
}
name = remapPlatformDependentCodepage(localeBuf, name);
@@ -2124,7 +2124,7 @@ int_getDefaultCodepage()
}
/* else use the default */
}
- sprintf(codepage,"ibm-%d", ccsid);
+ snprintf(codepage, sizeof(codepage), "ibm-%d", ccsid);
return codepage;
#elif U_PLATFORM == U_PF_OS390
@@ -2132,7 +2132,7 @@ int_getDefaultCodepage()
strncpy(codepage, nl_langinfo(CODESET),63-strlen(UCNV_SWAP_LFNL_OPTION_STRING));
strcat(codepage,UCNV_SWAP_LFNL_OPTION_STRING);
- codepage[63] = 0; /* NULL terminate */
+ codepage[63] = 0; /* NUL terminate */
return codepage;
@@ -2161,7 +2161,7 @@ int_getDefaultCodepage()
// are between 3 and 19999
if (codepageNumber > 0 && codepageNumber < 20000)
{
- sprintf(codepage, "windows-%ld", codepageNumber);
+ snprintf(codepage, sizeof(codepage), "windows-%ld", codepageNumber);
return codepage;
}
// If the codepage number call failed then return UTF-8
@@ -2169,8 +2169,8 @@ int_getDefaultCodepage()
#elif U_POSIX_LOCALE
static char codesetName[100];
- const char *localeName = NULL;
- const char *name = NULL;
+ const char *localeName = nullptr;
+ const char *name = nullptr;
localeName = uprv_getPOSIXIDForDefaultCodepage();
uprv_memset(codesetName, 0, sizeof(codesetName));
@@ -2193,10 +2193,10 @@ int_getDefaultCodepage()
} else
#endif
{
- codeset = remapPlatformDependentCodepage(NULL, codeset);
+ codeset = remapPlatformDependentCodepage(nullptr, codeset);
}
- if (codeset != NULL) {
+ if (codeset != nullptr) {
uprv_strncpy(codesetName, codeset, sizeof(codesetName));
codesetName[sizeof(codesetName)-1] = 0;
return codesetName;
@@ -2229,12 +2229,12 @@ int_getDefaultCodepage()
U_CAPI const char* U_EXPORT2
uprv_getDefaultCodepage()
{
- static char const *name = NULL;
- umtx_lock(NULL);
- if (name == NULL) {
+ static char const *name = nullptr;
+ umtx_lock(nullptr);
+ if (name == nullptr) {
name = int_getDefaultCodepage();
}
- umtx_unlock(NULL);
+ umtx_unlock(nullptr);
return name;
}
#endif /* !U_CHARSET_IS_UTF8 */
@@ -2249,11 +2249,11 @@ u_versionFromString(UVersionInfo versionArray, const char *versionString) {
char *end;
uint16_t part=0;
- if(versionArray==NULL) {
+ if(versionArray==nullptr) {
return;
}
- if(versionString!=NULL) {
+ if(versionString!=nullptr) {
for(;;) {
versionArray[part]=(uint8_t)uprv_strtoul(versionString, &end, 10);
if(end==versionString || ++part==U_MAX_VERSION_LENGTH || *end!=U_VERSION_DELIMITER) {
@@ -2269,8 +2269,8 @@ u_versionFromString(UVersionInfo versionArray, const char *versionString) {
}
U_CAPI void U_EXPORT2
-u_versionFromUString(UVersionInfo versionArray, const UChar *versionString) {
- if(versionArray!=NULL && versionString!=NULL) {
+u_versionFromUString(UVersionInfo versionArray, const char16_t *versionString) {
+ if(versionArray!=nullptr && versionString!=nullptr) {
char versionChars[U_MAX_VERSION_STRING_LENGTH+1];
int32_t len = u_strlen(versionString);
if(len>U_MAX_VERSION_STRING_LENGTH) {
@@ -2287,11 +2287,11 @@ u_versionToString(const UVersionInfo versionArray, char *versionString) {
uint16_t count, part;
uint8_t field;
- if(versionString==NULL) {
+ if(versionString==nullptr) {
return;
}
- if(versionArray==NULL) {
+ if(versionArray==nullptr) {
versionString[0]=0;
return;
}
@@ -2362,10 +2362,10 @@ u_getVersion(UVersionInfo versionArray) {
U_CAPI void * U_EXPORT2
uprv_dl_open(const char *libName, UErrorCode *status) {
- void *ret = NULL;
+ void *ret = nullptr;
if(U_FAILURE(*status)) return ret;
ret = dlopen(libName, RTLD_NOW|RTLD_GLOBAL);
- if(ret==NULL) {
+ if(ret==nullptr) {
#ifdef U_TRACE_DYLOAD
printf("dlerror on dlopen(%s): %s\n", libName, dlerror());
#endif
@@ -2386,10 +2386,10 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
UVoidFunction *fp;
void *vp;
} uret;
- uret.fp = NULL;
+ uret.fp = nullptr;
if(U_FAILURE(*status)) return uret.fp;
uret.vp = dlsym(lib, sym);
- if(uret.vp == NULL) {
+ if(uret.vp == nullptr) {
#ifdef U_TRACE_DYLOAD
printf("dlerror on dlsym(%p,%s): %s\n", lib,sym, dlerror());
#endif
@@ -2405,13 +2405,13 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
U_CAPI void * U_EXPORT2
uprv_dl_open(const char *libName, UErrorCode *status) {
- HMODULE lib = NULL;
+ HMODULE lib = nullptr;
- if(U_FAILURE(*status)) return NULL;
+ if(U_FAILURE(*status)) return nullptr;
lib = LoadLibraryA(libName);
- if(lib==NULL) {
+ if(lib==nullptr) {
*status = U_MISSING_RESOURCE_ERROR;
}
@@ -2431,13 +2431,13 @@ uprv_dl_close(void *lib, UErrorCode *status) {
U_CAPI UVoidFunction* U_EXPORT2
uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
HMODULE handle = (HMODULE)lib;
- UVoidFunction* addr = NULL;
+ UVoidFunction* addr = nullptr;
- if(U_FAILURE(*status) || lib==NULL) return NULL;
+ if(U_FAILURE(*status) || lib==nullptr) return nullptr;
addr = (UVoidFunction*)GetProcAddress(handle, sym);
- if(addr==NULL) {
+ if(addr==nullptr) {
DWORD lastError = GetLastError();
if(lastError == ERROR_PROC_NOT_FOUND) {
*status = U_MISSING_RESOURCE_ERROR;
@@ -2456,9 +2456,9 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
U_CAPI void * U_EXPORT2
uprv_dl_open(const char *libName, UErrorCode *status) {
(void)libName;
- if(U_FAILURE(*status)) return NULL;
+ if(U_FAILURE(*status)) return nullptr;
*status = U_UNSUPPORTED_ERROR;
- return NULL;
+ return nullptr;
}
U_CAPI void U_EXPORT2
@@ -2476,7 +2476,7 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) {
if(U_SUCCESS(*status)) {
*status = U_UNSUPPORTED_ERROR;
}
- return (UVoidFunction*)NULL;
+ return (UVoidFunction*)nullptr;
}
#endif
diff --git a/thirdparty/icu4c/common/rbbi.cpp b/thirdparty/icu4c/common/rbbi.cpp
index 2769263894..73716ab406 100644
--- a/thirdparty/icu4c/common/rbbi.cpp
+++ b/thirdparty/icu4c/common/rbbi.cpp
@@ -63,9 +63,8 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RuleBasedBreakIterator)
* tables object that is passed in as a parameter.
*/
RuleBasedBreakIterator::RuleBasedBreakIterator(RBBIDataHeader* data, UErrorCode &status)
- : fSCharIter(UnicodeString())
+ : RuleBasedBreakIterator(&status)
{
- init(status);
fData = new RBBIDataWrapper(data, status); // status checked in constructor
if (U_FAILURE(status)) {return;}
if(fData == nullptr) {
@@ -102,13 +101,12 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(UDataMemory* udm, UBool isPhraseB
RuleBasedBreakIterator::RuleBasedBreakIterator(const uint8_t *compiledRules,
uint32_t ruleLength,
UErrorCode &status)
- : fSCharIter(UnicodeString())
+ : RuleBasedBreakIterator(&status)
{
- init(status);
if (U_FAILURE(status)) {
return;
}
- if (compiledRules == NULL || ruleLength < sizeof(RBBIDataHeader)) {
+ if (compiledRules == nullptr || ruleLength < sizeof(RBBIDataHeader)) {
status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -141,9 +139,8 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(const uint8_t *compiledRules,
//
//-------------------------------------------------------------------------------
RuleBasedBreakIterator::RuleBasedBreakIterator(UDataMemory* udm, UErrorCode &status)
- : fSCharIter(UnicodeString())
+ : RuleBasedBreakIterator(&status)
{
- init(status);
fData = new RBBIDataWrapper(udm, status); // status checked in constructor
if (U_FAILURE(status)) {return;}
if(fData == nullptr) {
@@ -170,9 +167,8 @@ RuleBasedBreakIterator::RuleBasedBreakIterator(UDataMemory* udm, UErrorCode &sta
RuleBasedBreakIterator::RuleBasedBreakIterator( const UnicodeString &rules,
UParseError &parseError,
UErrorCode &status)
- : fSCharIter(UnicodeString())
+ : RuleBasedBreakIterator(&status)
{
- init(status);
if (U_FAILURE(status)) {return;}
RuleBasedBreakIterator *bi = (RuleBasedBreakIterator *)
RBBIRuleBuilder::createRuleBasedBreakIterator(rules, &parseError, status);
@@ -194,10 +190,39 @@ RuleBasedBreakIterator::RuleBasedBreakIterator( const UnicodeString &rules,
// of rules.
//-------------------------------------------------------------------------------
RuleBasedBreakIterator::RuleBasedBreakIterator()
- : fSCharIter(UnicodeString())
+ : RuleBasedBreakIterator(nullptr)
{
- UErrorCode status = U_ZERO_ERROR;
- init(status);
+}
+
+/**
+ * Simple Constructor with an error code.
+ * Handles common initialization for all other constructors.
+ */
+RuleBasedBreakIterator::RuleBasedBreakIterator(UErrorCode *status) {
+ UErrorCode ec = U_ZERO_ERROR;
+ if (status == nullptr) {
+ status = &ec;
+ }
+ utext_openUChars(&fText, nullptr, 0, status);
+ LocalPointer<DictionaryCache> lpDictionaryCache(new DictionaryCache(this, *status), *status);
+ LocalPointer<BreakCache> lpBreakCache(new BreakCache(this, *status), *status);
+ if (U_FAILURE(*status)) {
+ fErrorCode = *status;
+ return;
+ }
+ fDictionaryCache = lpDictionaryCache.orphan();
+ fBreakCache = lpBreakCache.orphan();
+
+#ifdef RBBI_DEBUG
+ static UBool debugInitDone = false;
+ if (debugInitDone == false) {
+ char *debugEnv = getenv("U_RBBIDEBUG");
+ if (debugEnv && uprv_strstr(debugEnv, "trace")) {
+ gTrace = true;
+ }
+ debugInitDone = true;
+ }
+#endif
}
@@ -208,11 +233,8 @@ RuleBasedBreakIterator::RuleBasedBreakIterator()
//
//-------------------------------------------------------------------------------
RuleBasedBreakIterator::RuleBasedBreakIterator(const RuleBasedBreakIterator& other)
-: BreakIterator(other),
- fSCharIter(UnicodeString())
+: RuleBasedBreakIterator()
{
- UErrorCode status = U_ZERO_ERROR;
- this->init(status);
*this = other;
}
@@ -261,9 +283,9 @@ RuleBasedBreakIterator::operator=(const RuleBasedBreakIterator& that) {
}
BreakIterator::operator=(that);
- if (fLanguageBreakEngines != NULL) {
+ if (fLanguageBreakEngines != nullptr) {
delete fLanguageBreakEngines;
- fLanguageBreakEngines = NULL; // Just rebuild for now
+ fLanguageBreakEngines = nullptr; // Just rebuild for now
}
// TODO: clone fLanguageBreakEngines from "that"
UErrorCode status = U_ZERO_ERROR;
@@ -274,22 +296,22 @@ RuleBasedBreakIterator::operator=(const RuleBasedBreakIterator& that) {
}
fCharIter = &fSCharIter;
- if (that.fCharIter != NULL && that.fCharIter != &that.fSCharIter) {
+ if (that.fCharIter != nullptr && that.fCharIter != &that.fSCharIter) {
// This is a little bit tricky - it will initially appear that
// this->fCharIter is adopted, even if that->fCharIter was
// not adopted. That's ok.
fCharIter = that.fCharIter->clone();
}
fSCharIter = that.fSCharIter;
- if (fCharIter == NULL) {
+ if (fCharIter == nullptr) {
fCharIter = &fSCharIter;
}
- if (fData != NULL) {
+ if (fData != nullptr) {
fData->removeReference();
- fData = NULL;
+ fData = nullptr;
}
- if (that.fData != NULL) {
+ if (that.fData != nullptr) {
fData = that.fData->addReference();
}
@@ -315,58 +337,6 @@ RuleBasedBreakIterator::operator=(const RuleBasedBreakIterator& that) {
return *this;
}
-
-
-//-----------------------------------------------------------------------------
-//
-// init() Shared initialization routine. Used by all the constructors.
-// Initializes all fields, leaving the object in a consistent state.
-//
-//-----------------------------------------------------------------------------
-void RuleBasedBreakIterator::init(UErrorCode &status) {
- fCharIter = nullptr;
- fData = nullptr;
- fPosition = 0;
- fRuleStatusIndex = 0;
- fDone = false;
- fDictionaryCharCount = 0;
- fLanguageBreakEngines = nullptr;
- fUnhandledBreakEngine = nullptr;
- fBreakCache = nullptr;
- fDictionaryCache = nullptr;
- fLookAheadMatches = nullptr;
- fIsPhraseBreaking = false;
-
- // Note: IBM xlC is unable to assign or initialize member fText from UTEXT_INITIALIZER.
- // fText = UTEXT_INITIALIZER;
- static const UText initializedUText = UTEXT_INITIALIZER;
- uprv_memcpy(&fText, &initializedUText, sizeof(UText));
-
- if (U_FAILURE(status)) {
- return;
- }
-
- utext_openUChars(&fText, NULL, 0, &status);
- fDictionaryCache = new DictionaryCache(this, status);
- fBreakCache = new BreakCache(this, status);
- if (U_SUCCESS(status) && (fDictionaryCache == NULL || fBreakCache == NULL)) {
- status = U_MEMORY_ALLOCATION_ERROR;
- }
-
-#ifdef RBBI_DEBUG
- static UBool debugInitDone = false;
- if (debugInitDone == false) {
- char *debugEnv = getenv("U_RBBIDEBUG");
- if (debugEnv && uprv_strstr(debugEnv, "trace")) {
- gTrace = true;
- }
- debugInitDone = true;
- }
-#endif
-}
-
-
-
//-----------------------------------------------------------------------------
//
// clone - Returns a newly-constructed RuleBasedBreakIterator with the same
@@ -396,7 +366,7 @@ RuleBasedBreakIterator::operator==(const BreakIterator& that) const {
// and does not implement an equality function that would otherwise be
// checked at this point.
- const RuleBasedBreakIterator& that2 = (const RuleBasedBreakIterator&) that;
+ const RuleBasedBreakIterator& that2 = static_cast<const RuleBasedBreakIterator&>(that);
if (!utext_equals(&fText, &that2.fText)) {
// The two break iterators are operating on different text,
@@ -412,7 +382,7 @@ RuleBasedBreakIterator::operator==(const BreakIterator& that) const {
}
if (that2.fData == fData ||
- (fData != NULL && that2.fData != NULL && *that2.fData == *fData)) {
+ (fData != nullptr && that2.fData != nullptr && *that2.fData == *fData)) {
// The two break iterators are using the same rules.
return true;
}
@@ -424,9 +394,9 @@ RuleBasedBreakIterator::operator==(const BreakIterator& that) const {
* @return A hash code
*/
int32_t
-RuleBasedBreakIterator::hashCode(void) const {
+RuleBasedBreakIterator::hashCode() const {
int32_t hash = 0;
- if (fData != NULL) {
+ if (fData != nullptr) {
hash = fData->hashCode();
}
return hash;
@@ -447,7 +417,7 @@ void RuleBasedBreakIterator::setText(UText *ut, UErrorCode &status) {
// Return one over an empty string instead - this is the closest
// we can come to signaling a failure.
// (GetText() is obsolete, this failure is sort of OK)
- fSCharIter.setText(UnicodeString());
+ fSCharIter.setText(u"", 0);
if (fCharIter != &fSCharIter) {
// existing fCharIter was adopted from the outside. Delete it now.
@@ -494,10 +464,10 @@ RuleBasedBreakIterator::adoptText(CharacterIterator* newText) {
UErrorCode status = U_ZERO_ERROR;
fBreakCache->reset();
fDictionaryCache->reset();
- if (newText==NULL || newText->startIndex() != 0) {
+ if (newText==nullptr || newText->startIndex() != 0) {
// startIndex !=0 wants to be an error, but there's no way to report it.
// Make the iterator text be an empty string.
- utext_openUChars(&fText, NULL, 0, &status);
+ utext_openUChars(&fText, nullptr, 0, &status);
} else {
utext_openCharacterIterator(&fText, newText, &status);
}
@@ -520,7 +490,7 @@ RuleBasedBreakIterator::setText(const UnicodeString& newText) {
// Needed in case someone calls getText().
// Can not, unfortunately, do this lazily on the (probably never)
// call to getText(), because getText is const.
- fSCharIter.setText(newText);
+ fSCharIter.setText(newText.getBuffer(), newText.length());
if (fCharIter != &fSCharIter) {
// old fCharIter was adopted from the outside. Delete it.
@@ -542,7 +512,7 @@ RuleBasedBreakIterator &RuleBasedBreakIterator::refreshInputText(UText *input, U
if (U_FAILURE(status)) {
return *this;
}
- if (input == NULL) {
+ if (input == nullptr) {
status = U_ILLEGAL_ARGUMENT_ERROR;
return *this;
}
@@ -568,7 +538,7 @@ RuleBasedBreakIterator &RuleBasedBreakIterator::refreshInputText(UText *input, U
* Sets the current iteration position to the beginning of the text, position zero.
* @return The new iterator position, which is zero.
*/
-int32_t RuleBasedBreakIterator::first(void) {
+int32_t RuleBasedBreakIterator::first() {
UErrorCode status = U_ZERO_ERROR;
if (!fBreakCache->seek(0)) {
fBreakCache->populateNear(0, status);
@@ -582,7 +552,7 @@ int32_t RuleBasedBreakIterator::first(void) {
* Sets the current iteration position to the end of the text.
* @return The text's past-the-end offset.
*/
-int32_t RuleBasedBreakIterator::last(void) {
+int32_t RuleBasedBreakIterator::last() {
int32_t endPos = (int32_t)utext_nativeLength(&fText);
UBool endShouldBeBoundary = isBoundary(endPos); // Has side effect of setting iterator position.
(void)endShouldBeBoundary;
@@ -620,7 +590,7 @@ int32_t RuleBasedBreakIterator::next(int32_t n) {
* Advances the iterator to the next boundary position.
* @return The position of the first boundary after this one.
*/
-int32_t RuleBasedBreakIterator::next(void) {
+int32_t RuleBasedBreakIterator::next() {
fBreakCache->next();
return fDone ? UBRK_DONE : fPosition;
}
@@ -633,7 +603,7 @@ int32_t RuleBasedBreakIterator::next(void) {
*
* @return The position of the boundary position immediately preceding the starting position.
*/
-int32_t RuleBasedBreakIterator::previous(void) {
+int32_t RuleBasedBreakIterator::previous() {
UErrorCode status = U_ZERO_ERROR;
fBreakCache->previous(status);
return fDone ? UBRK_DONE : fPosition;
@@ -730,7 +700,7 @@ UBool RuleBasedBreakIterator::isBoundary(int32_t offset) {
* Returns the current iteration position.
* @return The current iteration position.
*/
-int32_t RuleBasedBreakIterator::current(void) const {
+int32_t RuleBasedBreakIterator::current() const {
return fPosition;
}
@@ -1009,7 +979,7 @@ int32_t RuleBasedBreakIterator::handleSafePrevious(int32_t fromPosition) {
#endif
// if we're already at the start of the text, return DONE.
- if (fData == NULL || UTEXT_GETNATIVEINDEX(&fText)==0) {
+ if (fData == nullptr || UTEXT_GETNATIVEINDEX(&fText)==0) {
return BreakIterator::DONE;
}
@@ -1117,10 +1087,10 @@ int32_t RuleBasedBreakIterator::getRuleStatusVec(
//
//-------------------------------------------------------------------------------
const uint8_t *RuleBasedBreakIterator::getBinaryRules(uint32_t &length) {
- const uint8_t *retPtr = NULL;
+ const uint8_t *retPtr = nullptr;
length = 0;
- if (fData != NULL) {
+ if (fData != nullptr) {
retPtr = (const uint8_t *)fData->fHeader;
length = fData->fHeader->fLength;
}
@@ -1131,16 +1101,16 @@ const uint8_t *RuleBasedBreakIterator::getBinaryRules(uint32_t &length) {
RuleBasedBreakIterator *RuleBasedBreakIterator::createBufferClone(
void * /*stackBuffer*/, int32_t &bufferSize, UErrorCode &status) {
if (U_FAILURE(status)){
- return NULL;
+ return nullptr;
}
if (bufferSize == 0) {
bufferSize = 1; // preflighting for deprecated functionality
- return NULL;
+ return nullptr;
}
BreakIterator *clonedBI = clone();
- if (clonedBI == NULL) {
+ if (clonedBI == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
} else {
status = U_SAFECLONE_ALLOCATED_WARNING;
@@ -1160,7 +1130,7 @@ static icu::UInitOnce gRBBIInitOnce {};
* Release all static memory held by breakiterator.
*/
U_CDECL_BEGIN
-UBool U_CALLCONV rbbi_cleanup(void) {
+UBool U_CALLCONV rbbi_cleanup() {
delete gLanguageBreakFactories;
gLanguageBreakFactories = nullptr;
delete gEmptyString;
@@ -1185,14 +1155,14 @@ static void U_CALLCONV rbbiInit() {
static void U_CALLCONV initLanguageFactories() {
UErrorCode status = U_ZERO_ERROR;
- U_ASSERT(gLanguageBreakFactories == NULL);
- gLanguageBreakFactories = new UStack(_deleteFactory, NULL, status);
- if (gLanguageBreakFactories != NULL && U_SUCCESS(status)) {
+ U_ASSERT(gLanguageBreakFactories == nullptr);
+ gLanguageBreakFactories = new UStack(_deleteFactory, nullptr, status);
+ if (gLanguageBreakFactories != nullptr && U_SUCCESS(status)) {
ICULanguageBreakFactory *builtIn = new ICULanguageBreakFactory(status);
gLanguageBreakFactories->push(builtIn, status);
#ifdef U_LOCAL_SERVICE_HOOK
LanguageBreakFactory *extra = (LanguageBreakFactory *)uprv_svc_hook("languageBreakFactory", &status);
- if (extra != NULL) {
+ if (extra != nullptr) {
gLanguageBreakFactories->push(extra, status);
}
#endif
@@ -1205,16 +1175,16 @@ static const LanguageBreakEngine*
getLanguageBreakEngineFromFactory(UChar32 c)
{
umtx_initOnce(gLanguageBreakFactoriesInitOnce, &initLanguageFactories);
- if (gLanguageBreakFactories == NULL) {
- return NULL;
+ if (gLanguageBreakFactories == nullptr) {
+ return nullptr;
}
int32_t i = gLanguageBreakFactories->size();
- const LanguageBreakEngine *lbe = NULL;
+ const LanguageBreakEngine *lbe = nullptr;
while (--i >= 0) {
LanguageBreakFactory *factory = (LanguageBreakFactory *)(gLanguageBreakFactories->elementAt(i));
lbe = factory->getEngineFor(c);
- if (lbe != NULL) {
+ if (lbe != nullptr) {
break;
}
}
@@ -1230,15 +1200,15 @@ getLanguageBreakEngineFromFactory(UChar32 c)
//-------------------------------------------------------------------------------
const LanguageBreakEngine *
RuleBasedBreakIterator::getLanguageBreakEngine(UChar32 c) {
- const LanguageBreakEngine *lbe = NULL;
+ const LanguageBreakEngine *lbe = nullptr;
UErrorCode status = U_ZERO_ERROR;
- if (fLanguageBreakEngines == NULL) {
+ if (fLanguageBreakEngines == nullptr) {
fLanguageBreakEngines = new UStack(status);
- if (fLanguageBreakEngines == NULL || U_FAILURE(status)) {
+ if (fLanguageBreakEngines == nullptr || U_FAILURE(status)) {
delete fLanguageBreakEngines;
fLanguageBreakEngines = 0;
- return NULL;
+ return nullptr;
}
}
@@ -1255,7 +1225,7 @@ RuleBasedBreakIterator::getLanguageBreakEngine(UChar32 c) {
lbe = getLanguageBreakEngineFromFactory(c);
// If we got one, use it and push it on our stack.
- if (lbe != NULL) {
+ if (lbe != nullptr) {
fLanguageBreakEngines->push((void *)lbe, status);
// Even if we can't remember it, we can keep looking it up, so
// return it even if the push fails.
@@ -1264,9 +1234,9 @@ RuleBasedBreakIterator::getLanguageBreakEngine(UChar32 c) {
// No engine is forthcoming for this character. Add it to the
// reject set. Create the reject break engine if needed.
- if (fUnhandledBreakEngine == NULL) {
+ if (fUnhandledBreakEngine == nullptr) {
fUnhandledBreakEngine = new UnhandledEngine(status);
- if (U_SUCCESS(status) && fUnhandledBreakEngine == NULL) {
+ if (U_SUCCESS(status) && fUnhandledBreakEngine == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return nullptr;
}
@@ -1278,7 +1248,7 @@ RuleBasedBreakIterator::getLanguageBreakEngine(UChar32 c) {
if (U_FAILURE(status)) {
delete fUnhandledBreakEngine;
fUnhandledBreakEngine = 0;
- return NULL;
+ return nullptr;
}
}
@@ -1303,7 +1273,7 @@ void RuleBasedBreakIterator::dumpTables() {
const UnicodeString&
RuleBasedBreakIterator::getRules() const {
- if (fData != NULL) {
+ if (fData != nullptr) {
return fData->getRuleSourceString();
} else {
umtx_initOnce(gRBBIInitOnce, &rbbiInit);
diff --git a/thirdparty/icu4c/common/rbbi_cache.cpp b/thirdparty/icu4c/common/rbbi_cache.cpp
index 45e02528cf..02ca555a89 100644
--- a/thirdparty/icu4c/common/rbbi_cache.cpp
+++ b/thirdparty/icu4c/common/rbbi_cache.cpp
@@ -162,7 +162,7 @@ void RuleBasedBreakIterator::DictionaryCache::populateDictionary(int32_t startPo
// Ask the language object if there are any breaks. It will add them to the cache and
// leave the text pointer on the other side of its range, ready to search for the next one.
- if (lbe != NULL) {
+ if (lbe != nullptr) {
foundBreakCount += lbe->findBreaks(text, rangeStart, rangeEnd, fBreaks, fBI->fIsPhraseBreaking, status);
}
diff --git a/thirdparty/icu4c/common/rbbidata.cpp b/thirdparty/icu4c/common/rbbidata.cpp
index f50fc458a5..49603b6193 100644
--- a/thirdparty/icu4c/common/rbbidata.cpp
+++ b/thirdparty/icu4c/common/rbbidata.cpp
@@ -78,13 +78,13 @@ UBool RBBIDataWrapper::isDataVersionAcceptable(const UVersionInfo version) {
//
//-----------------------------------------------------------------------------
void RBBIDataWrapper::init0() {
- fHeader = NULL;
- fForwardTable = NULL;
- fReverseTable = NULL;
- fRuleSource = NULL;
- fRuleStatusTable = NULL;
- fTrie = NULL;
- fUDataMem = NULL;
+ fHeader = nullptr;
+ fForwardTable = nullptr;
+ fReverseTable = nullptr;
+ fRuleSource = nullptr;
+ fRuleStatusTable = nullptr;
+ fTrie = nullptr;
+ fUDataMem = nullptr;
fRefCount = 0;
fDontFreeData = true;
}
@@ -246,7 +246,7 @@ void RBBIDataWrapper::printTable(const char *heading, const RBBIStateTable *tab
}
RBBIDebugPrintf("\n");
- if (table == NULL) {
+ if (table == nullptr) {
RBBIDebugPrintf(" N U L L T A B L E\n\n");
return;
}
@@ -305,10 +305,10 @@ U_CAPI int32_t U_EXPORT2
ubrk_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outData,
UErrorCode *status) {
- if (status == NULL || U_FAILURE(*status)) {
+ if (status == nullptr || U_FAILURE(*status)) {
return 0;
}
- if(ds==NULL || inData==NULL || length<-1 || (length>0 && outData==NULL)) {
+ if(ds==nullptr || inData==nullptr || length<-1 || (length>0 && outData==nullptr)) {
*status=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
diff --git a/thirdparty/icu4c/common/rbbidata.h b/thirdparty/icu4c/common/rbbidata.h
index 1bc76d5e5d..c48de3d935 100644
--- a/thirdparty/icu4c/common/rbbidata.h
+++ b/thirdparty/icu4c/common/rbbidata.h
@@ -85,7 +85,7 @@ struct RBBIDataHeader {
uint32_t fTrie; /* Offset to Trie data for character categories */
uint32_t fTrieLen;
uint32_t fRuleSource; /* Offset to the source for for the break */
- uint32_t fRuleSourceLen; /* rules. Stored UChar *. */
+ uint32_t fRuleSourceLen; /* rules. Stored char16_t *. */
uint32_t fStatusTable; /* Offset to the table of rule status values */
uint32_t fStatusTableLen;
@@ -205,7 +205,7 @@ private:
U_NAMESPACE_END
-U_CFUNC UBool rbbi_cleanup(void);
+U_CFUNC UBool rbbi_cleanup();
#endif /* C++ */
diff --git a/thirdparty/icu4c/common/rbbinode.cpp b/thirdparty/icu4c/common/rbbinode.cpp
index da5937cafd..7aa75d5ffb 100644
--- a/thirdparty/icu4c/common/rbbinode.cpp
+++ b/thirdparty/icu4c/common/rbbinode.cpp
@@ -52,10 +52,10 @@ RBBINode::RBBINode(NodeType t) : UMemory() {
fSerialNum = ++gLastSerial;
#endif
fType = t;
- fParent = NULL;
- fLeftChild = NULL;
- fRightChild = NULL;
- fInputSet = NULL;
+ fParent = nullptr;
+ fLeftChild = nullptr;
+ fRightChild = nullptr;
+ fInputSet = nullptr;
fFirstPos = 0;
fLastPos = 0;
fNullable = false;
@@ -82,9 +82,9 @@ RBBINode::RBBINode(const RBBINode &other) : UMemory(other) {
fSerialNum = ++gLastSerial;
#endif
fType = other.fType;
- fParent = NULL;
- fLeftChild = NULL;
- fRightChild = NULL;
+ fParent = nullptr;
+ fLeftChild = nullptr;
+ fRightChild = nullptr;
fInputSet = other.fInputSet;
fPrecedence = other.fPrecedence;
fText = other.fText;
@@ -113,7 +113,7 @@ RBBINode::RBBINode(const RBBINode &other) : UMemory(other) {
RBBINode::~RBBINode() {
// printf("deleting node %8x serial %4d\n", this, this->fSerialNum);
delete fInputSet;
- fInputSet = NULL;
+ fInputSet = nullptr;
switch (this->fType) {
case varRef:
@@ -124,9 +124,9 @@ RBBINode::~RBBINode() {
default:
delete fLeftChild;
- fLeftChild = NULL;
+ fLeftChild = nullptr;
delete fRightChild;
- fRightChild = NULL;
+ fRightChild = nullptr;
}
@@ -158,12 +158,12 @@ RBBINode *RBBINode::cloneTree() {
} else {
n = new RBBINode(*this);
// Check for null pointer.
- if (n != NULL) {
- if (fLeftChild != NULL) {
+ if (n != nullptr) {
+ if (fLeftChild != nullptr) {
n->fLeftChild = fLeftChild->cloneTree();
n->fLeftChild->fParent = n;
}
- if (fRightChild != NULL) {
+ if (fRightChild != nullptr) {
n->fRightChild = fRightChild->cloneTree();
n->fRightChild->fParent = n;
}
@@ -195,7 +195,7 @@ RBBINode *RBBINode::cloneTree() {
RBBINode *RBBINode::flattenVariables() {
if (fType == varRef) {
RBBINode *retNode = fLeftChild->cloneTree();
- if (retNode != NULL) {
+ if (retNode != nullptr) {
retNode->fRuleRoot = this->fRuleRoot;
retNode->fChainIn = this->fChainIn;
}
@@ -203,11 +203,11 @@ RBBINode *RBBINode::flattenVariables() {
return retNode;
}
- if (fLeftChild != NULL) {
+ if (fLeftChild != nullptr) {
fLeftChild = fLeftChild->flattenVariables();
fLeftChild->fParent = this;
}
- if (fRightChild != NULL) {
+ if (fRightChild != nullptr) {
fRightChild = fRightChild->flattenVariables();
fRightChild->fParent = this;
}
@@ -226,7 +226,7 @@ RBBINode *RBBINode::flattenVariables() {
void RBBINode::flattenSets() {
U_ASSERT(fType != setRef);
- if (fLeftChild != NULL) {
+ if (fLeftChild != nullptr) {
if (fLeftChild->fType==setRef) {
RBBINode *setRefNode = fLeftChild;
RBBINode *usetNode = setRefNode->fLeftChild;
@@ -239,7 +239,7 @@ void RBBINode::flattenSets() {
}
}
- if (fRightChild != NULL) {
+ if (fRightChild != nullptr) {
if (fRightChild->fType==setRef) {
RBBINode *setRefNode = fRightChild;
RBBINode *usetNode = setRefNode->fLeftChild;
@@ -270,10 +270,10 @@ void RBBINode::findNodes(UVector *dest, RBBINode::NodeType kind, UErrorCode &s
if (fType == kind) {
dest->addElement(this, status);
}
- if (fLeftChild != NULL) {
+ if (fLeftChild != nullptr) {
fLeftChild->findNodes(dest, kind, status);
}
- if (fRightChild != NULL) {
+ if (fRightChild != nullptr) {
fRightChild->findNodes(dest, kind, status);
}
}
@@ -287,7 +287,7 @@ void RBBINode::findNodes(UVector *dest, RBBINode::NodeType kind, UErrorCode &s
#ifdef RBBI_DEBUG
static int32_t serial(const RBBINode *node) {
- return (node == NULL? -1 : node->fSerialNum);
+ return (node == nullptr? -1 : node->fSerialNum);
}
@@ -311,7 +311,7 @@ void RBBINode::printNode(const RBBINode *node) {
"opLParen"
};
- if (node==NULL) {
+ if (node==nullptr) {
RBBIDebugPrintf("%10p", (void *)node);
} else {
RBBIDebugPrintf("%10p %5d %12s %c%c %5d %5d %5d %6d %d ",
@@ -350,15 +350,15 @@ void RBBINode::printTree(const RBBINode *node, UBool printHeading) {
printNodeHeader();
}
printNode(node);
- if (node != NULL) {
+ if (node != nullptr) {
// Only dump the definition under a variable reference if asked to.
// Unconditionally dump children of all other node types.
if (node->fType != varRef) {
- if (node->fLeftChild != NULL) {
+ if (node->fLeftChild != nullptr) {
printTree(node->fLeftChild, false);
}
- if (node->fRightChild != NULL) {
+ if (node->fRightChild != nullptr) {
printTree(node->fRightChild, false);
}
}
diff --git a/thirdparty/icu4c/common/rbbirb.cpp b/thirdparty/icu4c/common/rbbirb.cpp
index a9d76f2482..7177254ec4 100644
--- a/thirdparty/icu4c/common/rbbirb.cpp
+++ b/thirdparty/icu4c/common/rbbirb.cpp
@@ -52,26 +52,26 @@ RBBIRuleBuilder::RBBIRuleBuilder(const UnicodeString &rules,
{
fStatus = &status; // status is checked below
fParseError = parseErr;
- fDebugEnv = NULL;
+ fDebugEnv = nullptr;
#ifdef RBBI_DEBUG
fDebugEnv = getenv("U_RBBIDEBUG");
#endif
- fForwardTree = NULL;
- fReverseTree = NULL;
- fSafeFwdTree = NULL;
- fSafeRevTree = NULL;
+ fForwardTree = nullptr;
+ fReverseTree = nullptr;
+ fSafeFwdTree = nullptr;
+ fSafeRevTree = nullptr;
fDefaultTree = &fForwardTree;
- fForwardTable = NULL;
- fRuleStatusVals = NULL;
+ fForwardTable = nullptr;
+ fRuleStatusVals = nullptr;
fChainRules = false;
fLBCMNoChain = false;
fLookAheadHardBreak = false;
- fUSetNodes = NULL;
- fRuleStatusVals = NULL;
- fScanner = NULL;
- fSetBuilder = NULL;
+ fUSetNodes = nullptr;
+ fRuleStatusVals = nullptr;
+ fScanner = nullptr;
+ fSetBuilder = nullptr;
if (parseErr) {
uprv_memset(parseErr, 0, sizeof(UParseError));
}
@@ -104,7 +104,7 @@ RBBIRuleBuilder::~RBBIRuleBuilder() {
int i;
for (i=0; ; i++) {
RBBINode *n = (RBBINode *)fUSetNodes->elementAt(i);
- if (n==NULL) {
+ if (n==nullptr) {
break;
}
delete n;
@@ -138,7 +138,7 @@ RBBIDataHeader *RBBIRuleBuilder::flattenData() {
int32_t i;
if (U_FAILURE(*fStatus)) {
- return NULL;
+ return nullptr;
}
// Remove whitespace from the rules to make it smaller.
@@ -183,9 +183,9 @@ RBBIDataHeader *RBBIRuleBuilder::flattenData() {
#endif
RBBIDataHeader *data = (RBBIDataHeader *)uprv_malloc(totalSize);
- if (data == NULL) {
+ if (data == nullptr) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
uprv_memset(data, 0, totalSize);
@@ -226,7 +226,7 @@ RBBIDataHeader *RBBIRuleBuilder::flattenData() {
fStrippedRules.getBuffer(), fStrippedRules.length(),
0xfffd, nullptr, fStatus);
if (U_FAILURE(*fStatus)) {
- return NULL;
+ return nullptr;
}
return data;
@@ -250,7 +250,7 @@ RBBIRuleBuilder::createRuleBasedBreakIterator( const UnicodeString &rules,
//
RBBIRuleBuilder builder(rules, parseError, status);
if (U_FAILURE(status)) { // status checked here bcos build below doesn't
- return NULL;
+ return nullptr;
}
RBBIDataHeader *data = builder.build(status);
@@ -267,9 +267,9 @@ RBBIRuleBuilder::createRuleBasedBreakIterator( const UnicodeString &rules,
RuleBasedBreakIterator *This = new RuleBasedBreakIterator(data, status);
if (U_FAILURE(status)) {
delete This;
- This = NULL;
+ This = nullptr;
}
- else if(This == NULL) { // test for NULL
+ else if(This == nullptr) { // test for nullptr
status = U_MEMORY_ALLOCATION_ERROR;
}
return This;
@@ -328,7 +328,7 @@ RBBIDataHeader *RBBIRuleBuilder::build(UErrorCode &status) {
// Package up the compiled data into a memory image
// in the run-time format.
//
- RBBIDataHeader *data = flattenData(); // returns NULL if error
+ RBBIDataHeader *data = flattenData(); // returns nullptr if error
if (U_FAILURE(status)) {
return nullptr;
}
diff --git a/thirdparty/icu4c/common/rbbiscan.cpp b/thirdparty/icu4c/common/rbbiscan.cpp
index 92cf77664f..455ace78b8 100644
--- a/thirdparty/icu4c/common/rbbiscan.cpp
+++ b/thirdparty/icu4c/common/rbbiscan.cpp
@@ -46,7 +46,7 @@
// source form of the state transition table for the RBBI rule parser.
//
//------------------------------------------------------------------------------
-static const UChar gRuleSet_rule_char_pattern[] = {
+static const char16_t gRuleSet_rule_char_pattern[] = {
// Characters that may appear as literals in patterns without escaping or quoting.
// [ ^ [ \ p { Z } \ u 0 0 2 0
0x5b, 0x5e, 0x5b, 0x5c, 0x70, 0x7b, 0x5a, 0x7d, 0x5c, 0x75, 0x30, 0x30, 0x32, 0x30,
@@ -55,19 +55,19 @@ static const UChar gRuleSet_rule_char_pattern[] = {
// { L } ] - [ \ p { N } ] ]
0x7b, 0x4c, 0x7d, 0x5d, 0x2d, 0x5b, 0x5c, 0x70, 0x7b, 0x4e, 0x7d, 0x5d, 0x5d, 0};
-static const UChar gRuleSet_name_char_pattern[] = {
+static const char16_t gRuleSet_name_char_pattern[] = {
// [ _ \ p { L } \ p { N } ]
0x5b, 0x5f, 0x5c, 0x70, 0x7b, 0x4c, 0x7d, 0x5c, 0x70, 0x7b, 0x4e, 0x7d, 0x5d, 0};
-static const UChar gRuleSet_digit_char_pattern[] = {
+static const char16_t gRuleSet_digit_char_pattern[] = {
// [ 0 - 9 ]
0x5b, 0x30, 0x2d, 0x39, 0x5d, 0};
-static const UChar gRuleSet_name_start_char_pattern[] = {
+static const char16_t gRuleSet_name_start_char_pattern[] = {
// [ _ \ p { L } ]
0x5b, 0x5f, 0x5c, 0x70, 0x7b, 0x4c, 0x7d, 0x5d, 0 };
-static const UChar kAny[] = {0x61, 0x6e, 0x79, 0x00}; // "any"
+static const char16_t kAny[] = {0x61, 0x6e, 0x79, 0x00}; // "any"
U_CDECL_BEGIN
@@ -97,18 +97,18 @@ RBBIRuleScanner::RBBIRuleScanner(RBBIRuleBuilder *rb)
fCharNum = 0;
fLastChar = 0;
- fStateTable = NULL;
+ fStateTable = nullptr;
fStack[0] = 0;
fStackPtr = 0;
- fNodeStack[0] = NULL;
+ fNodeStack[0] = nullptr;
fNodeStackPtr = 0;
fReverseRule = false;
fLookAheadRule = false;
fNoChainInRule = false;
- fSymbolTable = NULL;
- fSetTable = NULL;
+ fSymbolTable = nullptr;
+ fSetTable = nullptr;
fRuleNum = 0;
fOptionStart = 0;
@@ -146,11 +146,11 @@ RBBIRuleScanner::RBBIRuleScanner(RBBIRuleBuilder *rb)
}
fSymbolTable = new RBBISymbolTable(this, rb->fRules, *rb->fStatus);
- if (fSymbolTable == NULL) {
+ if (fSymbolTable == nullptr) {
*rb->fStatus = U_MEMORY_ALLOCATION_ERROR;
return;
}
- fSetTable = uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, rb->fStatus);
+ fSetTable = uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, nullptr, rb->fStatus);
if (U_FAILURE(*rb->fStatus)) {
return;
}
@@ -166,9 +166,9 @@ RBBIRuleScanner::RBBIRuleScanner(RBBIRuleBuilder *rb)
//------------------------------------------------------------------------------
RBBIRuleScanner::~RBBIRuleScanner() {
delete fSymbolTable;
- if (fSetTable != NULL) {
+ if (fSetTable != nullptr) {
uhash_close(fSetTable);
- fSetTable = NULL;
+ fSetTable = nullptr;
}
@@ -199,7 +199,7 @@ RBBIRuleScanner::~RBBIRuleScanner() {
//------------------------------------------------------------------------------
UBool RBBIRuleScanner::doParseActions(int32_t action)
{
- RBBINode *n = NULL;
+ RBBINode *n = nullptr;
UBool returnVal = true;
@@ -374,7 +374,7 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
//
RBBINode **destRules = (fReverseRule? &fRB->fSafeRevTree : fRB->fDefaultTree);
- if (*destRules != NULL) {
+ if (*destRules != nullptr) {
// This is not the first rule encountered.
// OR previous stuff (from *destRules)
// with the current rule expression (on the Node Stack)
@@ -583,7 +583,7 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
case doEndVariableName:
n = fNodeStack[fNodeStackPtr];
- if (n==NULL || n->fType != RBBINode::varRef) {
+ if (n==nullptr || n->fType != RBBINode::varRef) {
error(U_BRK_INTERNAL_ERROR);
break;
}
@@ -598,7 +598,7 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
case doCheckVarDef:
n = fNodeStack[fNodeStackPtr];
- if (n->fLeftChild == NULL) {
+ if (n->fLeftChild == nullptr) {
error(U_BRK_UNDEFINED_VARIABLE);
returnVal = false;
}
@@ -737,7 +737,7 @@ void RBBIRuleScanner::findSetFor(const UnicodeString &s, RBBINode *node, Unicode
// If so, just use the cached set in the new node.
// delete any set provided by the caller, since we own it.
el = (RBBISetTableEl *)uhash_get(fSetTable, &s);
- if (el != NULL) {
+ if (el != nullptr) {
delete setToAdopt;
node->fLeftChild = el->val;
U_ASSERT(node->fLeftChild->fType == RBBINode::uset);
@@ -747,7 +747,7 @@ void RBBIRuleScanner::findSetFor(const UnicodeString &s, RBBINode *node, Unicode
// Haven't seen this set before.
// If the caller didn't provide us with a prebuilt set,
// create a new UnicodeSet now.
- if (setToAdopt == NULL) {
+ if (setToAdopt == nullptr) {
if (s.compare(kAny, -1) == 0) {
setToAdopt = new UnicodeSet(0x000000, 0x10ffff);
} else {
@@ -762,7 +762,7 @@ void RBBIRuleScanner::findSetFor(const UnicodeString &s, RBBINode *node, Unicode
// This new uset node becomes the child of the caller's setReference node.
//
RBBINode *usetNode = new RBBINode(RBBINode::uset);
- if (usetNode == NULL) {
+ if (usetNode == nullptr) {
error(U_MEMORY_ALLOCATION_ERROR);
return;
}
@@ -783,14 +783,14 @@ void RBBIRuleScanner::findSetFor(const UnicodeString &s, RBBINode *node, Unicode
//
el = (RBBISetTableEl *)uprv_malloc(sizeof(RBBISetTableEl));
UnicodeString *tkey = new UnicodeString(s);
- if (tkey == NULL || el == NULL || setToAdopt == NULL) {
+ if (tkey == nullptr || el == nullptr || setToAdopt == nullptr) {
// Delete to avoid memory leak
delete tkey;
- tkey = NULL;
+ tkey = nullptr;
uprv_free(el);
- el = NULL;
+ el = nullptr;
delete setToAdopt;
- setToAdopt = NULL;
+ setToAdopt = nullptr;
error(U_MEMORY_ALLOCATION_ERROR);
return;
@@ -809,15 +809,15 @@ void RBBIRuleScanner::findSetFor(const UnicodeString &s, RBBINode *node, Unicode
// Numeric because there is no portable way to enter them as literals.
// (Think EBCDIC).
//
-static const UChar chCR = 0x0d; // New lines, for terminating comments.
-static const UChar chLF = 0x0a;
-static const UChar chNEL = 0x85; // NEL newline variant
-static const UChar chLS = 0x2028; // Unicode Line Separator
-static const UChar chApos = 0x27; // single quote, for quoted chars.
-static const UChar chPound = 0x23; // '#', introduces a comment.
-static const UChar chBackSlash = 0x5c; // '\' introduces a char escape
-static const UChar chLParen = 0x28;
-static const UChar chRParen = 0x29;
+static const char16_t chCR = 0x0d; // New lines, for terminating comments.
+static const char16_t chLF = 0x0a;
+static const char16_t chNEL = 0x85; // NEL newline variant
+static const char16_t chLS = 0x2028; // Unicode Line Separator
+static const char16_t chApos = 0x27; // single quote, for quoted chars.
+static const char16_t chPound = 0x23; // '#', introduces a comment.
+static const char16_t chBackSlash = 0x5c; // '\' introduces a char escape
+static const char16_t chLParen = 0x28;
+static const char16_t chRParen = 0x29;
//------------------------------------------------------------------------------
@@ -918,7 +918,7 @@ void RBBIRuleScanner::nextChar(RBBIRuleChar &c) {
// Toggle quoting mode.
// Return either '(' or ')', because quotes cause a grouping of the quoted text.
fQuoteMode = !fQuoteMode;
- if (fQuoteMode == true) {
+ if (fQuoteMode) {
c.fChar = chLParen;
} else {
c.fChar = chRParen;
@@ -1119,7 +1119,7 @@ void RBBIRuleScanner::parse() {
// If there are no forward rules set an error.
//
- if (fRB->fForwardTree == NULL) {
+ if (fRB->fForwardTree == nullptr) {
error(U_BRK_RULE_SYNTAX);
return;
}
@@ -1169,16 +1169,16 @@ void RBBIRuleScanner::printNodeStack(const char *title) {
//------------------------------------------------------------------------------
RBBINode *RBBIRuleScanner::pushNewNode(RBBINode::NodeType t) {
if (U_FAILURE(*fRB->fStatus)) {
- return NULL;
+ return nullptr;
}
if (fNodeStackPtr >= kStackSize - 1) {
error(U_BRK_RULE_SYNTAX);
RBBIDebugPuts("RBBIRuleScanner::pushNewNode - stack overflow.");
- return NULL;
+ return nullptr;
}
fNodeStackPtr++;
fNodeStack[fNodeStackPtr] = new RBBINode(t);
- if (fNodeStack[fNodeStackPtr] == NULL) {
+ if (fNodeStack[fNodeStackPtr] == nullptr) {
*fRB->fStatus = U_MEMORY_ALLOCATION_ERROR;
}
return fNodeStack[fNodeStackPtr];
@@ -1214,7 +1214,7 @@ void RBBIRuleScanner::scanSet() {
startPos = fScanIndex;
UErrorCode localStatus = U_ZERO_ERROR;
uset = new UnicodeSet();
- if (uset == NULL) {
+ if (uset == nullptr) {
localStatus = U_MEMORY_ALLOCATION_ERROR;
} else {
uset->applyPatternIgnoreSpace(fRB->fRules, pos, fSymbolTable, localStatus);
@@ -1232,7 +1232,7 @@ void RBBIRuleScanner::scanSet() {
// Verify that the set contains at least one code point.
//
- U_ASSERT(uset!=NULL);
+ U_ASSERT(uset!=nullptr);
if (uset->isEmpty()) {
// This set is empty.
// Make it an error, because it almost certainly is not what the user wanted.
diff --git a/thirdparty/icu4c/common/rbbiscan.h b/thirdparty/icu4c/common/rbbiscan.h
index bf3203880b..8a419b9d76 100644
--- a/thirdparty/icu4c/common/rbbiscan.h
+++ b/thirdparty/icu4c/common/rbbiscan.h
@@ -86,7 +86,7 @@ private:
void error(UErrorCode e); // error reporting convenience function.
void fixOpStack(RBBINode::OpPrecedence p);
// a character.
- void findSetFor(const UnicodeString &s, RBBINode *node, UnicodeSet *setToAdopt = NULL);
+ void findSetFor(const UnicodeString &s, RBBINode *node, UnicodeSet *setToAdopt = nullptr);
UChar32 nextCharLL();
#ifdef RBBI_DEBUG
diff --git a/thirdparty/icu4c/common/rbbisetb.cpp b/thirdparty/icu4c/common/rbbisetb.cpp
index 11c47156d6..e6c72954bc 100644
--- a/thirdparty/icu4c/common/rbbisetb.cpp
+++ b/thirdparty/icu4c/common/rbbisetb.cpp
@@ -74,7 +74,7 @@ RBBISetBuilder::~RBBISetBuilder()
RangeDescriptor *nextRangeDesc;
// Walk through & delete the linked list of RangeDescriptors
- for (nextRangeDesc = fRangeList; nextRangeDesc!=NULL;) {
+ for (nextRangeDesc = fRangeList; nextRangeDesc!=nullptr;) {
RangeDescriptor *r = nextRangeDesc;
nextRangeDesc = r->fNext;
delete r;
@@ -104,7 +104,7 @@ void RBBISetBuilder::buildRanges() {
// that is in no sets.
//
fRangeList = new RangeDescriptor(*fStatus); // will check for status here
- if (fRangeList == NULL) {
+ if (fRangeList == nullptr) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -121,7 +121,7 @@ void RBBISetBuilder::buildRanges() {
int ni;
for (ni=0; ; ni++) { // Loop over each of the UnicodeSets encountered in the input rules
usetNode = (RBBINode *)this->fRB->fUSetNodes->elementAt(ni);
- if (usetNode==NULL) {
+ if (usetNode==nullptr) {
break;
}
@@ -252,7 +252,7 @@ void RBBISetBuilder::buildRanges() {
UnicodeString bofString(u"bof");
for (ni=0; ; ni++) { // Loop over each of the UnicodeSets encountered in the input rules
usetNode = (RBBINode *)this->fRB->fUSetNodes->elementAt(ni);
- if (usetNode==NULL) {
+ if (usetNode==nullptr) {
break;
}
UnicodeSet *inputSet = usetNode->fInputSet;
@@ -376,12 +376,12 @@ void RBBISetBuilder::addValToSets(UVector *sets, uint32_t val) {
void RBBISetBuilder::addValToSet(RBBINode *usetNode, uint32_t val) {
RBBINode *leafNode = new RBBINode(RBBINode::leafChar);
- if (leafNode == NULL) {
+ if (leafNode == nullptr) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;
return;
}
leafNode->fVal = (unsigned short)val;
- if (usetNode->fLeftChild == NULL) {
+ if (usetNode->fLeftChild == nullptr) {
usetNode->fLeftChild = leafNode;
leafNode->fParent = usetNode;
} else {
@@ -389,7 +389,7 @@ void RBBISetBuilder::addValToSet(RBBINode *usetNode, uint32_t val) {
// Set up an OR node, with the previous stuff as the left child
// and the new value as the right child.
RBBINode *orNode = new RBBINode(RBBINode::opOr);
- if (orNode == NULL) {
+ if (orNode == nullptr) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -507,9 +507,9 @@ void RBBISetBuilder::printRangeGroups() {
RBBINode *usetNode = (RBBINode *)rlRange->fIncludesSets->elementAt(i);
UnicodeString setName = UNICODE_STRING("anon", 4);
RBBINode *setRef = usetNode->fParent;
- if (setRef != NULL) {
+ if (setRef != nullptr) {
RBBINode *varRef = setRef->fParent;
- if (varRef != NULL && varRef->fType == RBBINode::varRef) {
+ if (varRef != nullptr && varRef->fType == RBBINode::varRef) {
setName = varRef->fText;
}
}
@@ -551,16 +551,16 @@ void RBBISetBuilder::printSets() {
UnicodeString setName;
usetNode = (RBBINode *)fRB->fUSetNodes->elementAt(i);
- if (usetNode == NULL) {
+ if (usetNode == nullptr) {
break;
}
RBBIDebugPrintf("%3d ", i);
setName = UNICODE_STRING("anonymous", 9);
setRef = usetNode->fParent;
- if (setRef != NULL) {
+ if (setRef != nullptr) {
varRef = setRef->fParent;
- if (varRef != NULL && varRef->fType == RBBINode::varRef) {
+ if (varRef != nullptr && varRef->fType == RBBINode::varRef) {
setName = varRef->fText;
}
}
@@ -568,7 +568,7 @@ void RBBISetBuilder::printSets() {
RBBIDebugPrintf(" ");
RBBI_DEBUG_printUnicodeString(usetNode->fText);
RBBIDebugPrintf("\n");
- if (usetNode->fLeftChild != NULL) {
+ if (usetNode->fLeftChild != nullptr) {
RBBINode::printTree(usetNode->fLeftChild, true);
}
}
diff --git a/thirdparty/icu4c/common/rbbistbl.cpp b/thirdparty/icu4c/common/rbbistbl.cpp
index 554aeb793f..844351bd0d 100644
--- a/thirdparty/icu4c/common/rbbistbl.cpp
+++ b/thirdparty/icu4c/common/rbbistbl.cpp
@@ -41,12 +41,12 @@ U_CDECL_END
U_NAMESPACE_BEGIN
RBBISymbolTable::RBBISymbolTable(RBBIRuleScanner *rs, const UnicodeString &rules, UErrorCode &status)
- :fRules(rules), fRuleScanner(rs), ffffString(UChar(0xffff))
+ :fRules(rules), fRuleScanner(rs), ffffString(char16_t(0xffff))
{
- fHashTable = NULL;
- fCachedSetLookup = NULL;
+ fHashTable = nullptr;
+ fCachedSetLookup = nullptr;
- fHashTable = uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, &status);
+ fHashTable = uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, nullptr, &status);
// uhash_open checks status
if (U_FAILURE(status)) {
return;
@@ -79,8 +79,8 @@ const UnicodeString *RBBISymbolTable::lookup(const UnicodeString& s) const
RBBISymbolTable *This = (RBBISymbolTable *)this; // cast off const
el = (RBBISymbolTableEntry *)uhash_get(fHashTable, &s);
- if (el == NULL) {
- return NULL;
+ if (el == nullptr) {
+ return nullptr;
}
varRefNode = el->val;
@@ -98,7 +98,7 @@ const UnicodeString *RBBISymbolTable::lookup(const UnicodeString& s) const
// The variable refers to something other than just a set.
// return the original source string for the expression
retString = &exprNode->fText;
- This->fCachedSetLookup = NULL;
+ This->fCachedSetLookup = nullptr;
}
return retString;
}
@@ -118,7 +118,7 @@ const UnicodeString *RBBISymbolTable::lookup(const UnicodeString& s) const
// and we just need to remember what set to return between these two calls.
const UnicodeFunctor *RBBISymbolTable::lookupMatcher(UChar32 ch) const
{
- UnicodeSet *retVal = NULL;
+ UnicodeSet *retVal = nullptr;
RBBISymbolTable *This = (RBBISymbolTable *)this; // cast off const
if (ch == 0xffff) {
retVal = fCachedSetLookup;
@@ -144,7 +144,7 @@ UnicodeString RBBISymbolTable::parseReference(const UnicodeString& text,
int32_t i = start;
UnicodeString result;
while (i < limit) {
- UChar c = text.charAt(i);
+ char16_t c = text.charAt(i);
if ((i==start && !u_isIDStart(c)) || !u_isIDPart(c)) {
break;
}
@@ -163,15 +163,15 @@ UnicodeString RBBISymbolTable::parseReference(const UnicodeString& text,
//
// RBBISymbolTable::lookupNode Given a key (a variable name), return the
// corresponding RBBI Node. If there is no entry
-// in the table for this name, return NULL.
+// in the table for this name, return nullptr.
//
RBBINode *RBBISymbolTable::lookupNode(const UnicodeString &key) const{
- RBBINode *retNode = NULL;
+ RBBINode *retNode = nullptr;
RBBISymbolTableEntry *el;
el = (RBBISymbolTableEntry *)uhash_get(fHashTable, &key);
- if (el != NULL) {
+ if (el != nullptr) {
retNode = el->val;
}
return retNode;
@@ -191,13 +191,13 @@ void RBBISymbolTable::addEntry (const UnicodeString &key, RBBINode *
return;
}
e = (RBBISymbolTableEntry *)uhash_get(fHashTable, &key);
- if (e != NULL) {
+ if (e != nullptr) {
err = U_BRK_VARIABLE_REDFINITION;
return;
}
e = new RBBISymbolTableEntry;
- if (e == NULL) {
+ if (e == nullptr) {
err = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -207,7 +207,7 @@ void RBBISymbolTable::addEntry (const UnicodeString &key, RBBINode *
}
-RBBISymbolTableEntry::RBBISymbolTableEntry() : UMemory(), key(), val(NULL) {}
+RBBISymbolTableEntry::RBBISymbolTableEntry() : UMemory(), key(), val(nullptr) {}
RBBISymbolTableEntry::~RBBISymbolTableEntry() {
// The "val" of a symbol table entry is a variable reference node.
@@ -215,7 +215,7 @@ RBBISymbolTableEntry::~RBBISymbolTableEntry() {
// Unlike other node types, children of variable reference nodes are not
// automatically recursively deleted. We do it manually here.
delete val->fLeftChild;
- val->fLeftChild = NULL;
+ val->fLeftChild = nullptr;
delete val;
@@ -233,10 +233,10 @@ void RBBISymbolTable::rbbiSymtablePrint() const {
"-------------------------------------------------------------------\n");
int32_t pos = UHASH_FIRST;
- const UHashElement *e = NULL;
+ const UHashElement *e = nullptr;
for (;;) {
e = uhash_nextElement(fHashTable, &pos);
- if (e == NULL ) {
+ if (e == nullptr ) {
break;
}
RBBISymbolTableEntry *s = (RBBISymbolTableEntry *)e->value.pointer;
@@ -249,7 +249,7 @@ void RBBISymbolTable::rbbiSymtablePrint() const {
pos = -1;
for (;;) {
e = uhash_nextElement(fHashTable, &pos);
- if (e == NULL ) {
+ if (e == nullptr ) {
break;
}
RBBISymbolTableEntry *s = (RBBISymbolTableEntry *)e->value.pointer;
diff --git a/thirdparty/icu4c/common/rbbitblb.cpp b/thirdparty/icu4c/common/rbbitblb.cpp
index 0e3ec7999f..0c2bcff4e5 100644
--- a/thirdparty/icu4c/common/rbbitblb.cpp
+++ b/thirdparty/icu4c/common/rbbitblb.cpp
@@ -73,7 +73,7 @@ void RBBITableBuilder::buildForwardTable() {
// If there were no rules, just return. This situation can easily arise
// for the reverse rules.
- if (fTree==NULL) {
+ if (fTree==nullptr) {
return;
}
@@ -99,7 +99,7 @@ void RBBITableBuilder::buildForwardTable() {
RBBINode *bofTop = new RBBINode(RBBINode::opCat);
RBBINode *bofLeaf = new RBBINode(RBBINode::leafChar);
// Delete and exit if memory allocation failed.
- if (bofTop == NULL || bofLeaf == NULL) {
+ if (bofTop == nullptr || bofLeaf == nullptr) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;
delete bofTop;
delete bofLeaf;
@@ -119,7 +119,7 @@ void RBBITableBuilder::buildForwardTable() {
//
RBBINode *cn = new RBBINode(RBBINode::opCat);
// Exit if memory allocation failed.
- if (cn == NULL) {
+ if (cn == nullptr) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -127,7 +127,7 @@ void RBBITableBuilder::buildForwardTable() {
fTree->fParent = cn;
RBBINode *endMarkerNode = cn->fRightChild = new RBBINode(RBBINode::endMark);
// Delete and exit if memory allocation failed.
- if (cn->fRightChild == NULL) {
+ if (cn->fRightChild == nullptr) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;
delete cn;
return;
@@ -203,7 +203,7 @@ void RBBITableBuilder::buildForwardTable() {
//
//-----------------------------------------------------------------------------
void RBBITableBuilder::calcNullable(RBBINode *n) {
- if (n == NULL) {
+ if (n == nullptr) {
return;
}
if (n->fType == RBBINode::setRef ||
@@ -250,7 +250,7 @@ void RBBITableBuilder::calcNullable(RBBINode *n) {
//
//-----------------------------------------------------------------------------
void RBBITableBuilder::calcFirstPos(RBBINode *n) {
- if (n == NULL) {
+ if (n == nullptr) {
return;
}
if (n->fType == RBBINode::leafChar ||
@@ -296,7 +296,7 @@ void RBBITableBuilder::calcFirstPos(RBBINode *n) {
//
//-----------------------------------------------------------------------------
void RBBITableBuilder::calcLastPos(RBBINode *n) {
- if (n == NULL) {
+ if (n == nullptr) {
return;
}
if (n->fType == RBBINode::leafChar ||
@@ -342,7 +342,7 @@ void RBBITableBuilder::calcLastPos(RBBINode *n) {
//
//-----------------------------------------------------------------------------
void RBBITableBuilder::calcFollowPos(RBBINode *n) {
- if (n == NULL ||
+ if (n == nullptr ||
n->fType == RBBINode::leafChar ||
n->fType == RBBINode::endMark) {
return;
@@ -387,7 +387,7 @@ void RBBITableBuilder::calcFollowPos(RBBINode *n) {
//
//-----------------------------------------------------------------------------
void RBBITableBuilder::addRuleRootNodes(UVector *dest, RBBINode *node) {
- if (node == NULL || U_FAILURE(*fStatus)) {
+ if (node == nullptr || U_FAILURE(*fStatus)) {
return;
}
U_ASSERT(!dest->hasDeleter());
@@ -567,21 +567,21 @@ void RBBITableBuilder::buildStateTable() {
return;
}
RBBIStateDescriptor *failState;
- // Set it to NULL to avoid uninitialized warning
- RBBIStateDescriptor *initialState = NULL;
+ // Set it to nullptr to avoid uninitialized warning
+ RBBIStateDescriptor *initialState = nullptr;
//
// Add a dummy state 0 - the stop state. Not from Aho.
int lastInputSymbol = fRB->fSetBuilder->getNumCharCategories() - 1;
failState = new RBBIStateDescriptor(lastInputSymbol, fStatus);
- if (failState == NULL) {
+ if (failState == nullptr) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;
goto ExitBuildSTdeleteall;
}
failState->fPositions = new UVector(*fStatus);
- if (failState->fPositions == NULL) {
+ if (failState->fPositions == nullptr) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;
}
- if (failState->fPositions == NULL || U_FAILURE(*fStatus)) {
+ if (failState->fPositions == nullptr || U_FAILURE(*fStatus)) {
goto ExitBuildSTdeleteall;
}
fDStates->addElement(failState, *fStatus);
@@ -592,14 +592,14 @@ void RBBITableBuilder::buildStateTable() {
// initially, the only unmarked state in Dstates is firstpos(root),
// where toot is the root of the syntax tree for (r)#;
initialState = new RBBIStateDescriptor(lastInputSymbol, fStatus);
- if (initialState == NULL) {
+ if (initialState == nullptr) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;
}
if (U_FAILURE(*fStatus)) {
goto ExitBuildSTdeleteall;
}
initialState->fPositions = new UVector(*fStatus);
- if (initialState->fPositions == NULL) {
+ if (initialState->fPositions == nullptr) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;
}
if (U_FAILURE(*fStatus)) {
@@ -613,7 +613,7 @@ void RBBITableBuilder::buildStateTable() {
// while there is an unmarked state T in Dstates do begin
for (;;) {
- RBBIStateDescriptor *T = NULL;
+ RBBIStateDescriptor *T = nullptr;
int32_t tx;
for (tx=1; tx<fDStates->size(); tx++) {
RBBIStateDescriptor *temp;
@@ -623,7 +623,7 @@ void RBBITableBuilder::buildStateTable() {
break;
}
}
- if (T == NULL) {
+ if (T == nullptr) {
break;
}
@@ -636,15 +636,15 @@ void RBBITableBuilder::buildStateTable() {
// let U be the set of positions that are in followpos(p)
// for some position p in T
// such that the symbol at position p is a;
- UVector *U = NULL;
+ UVector *U = nullptr;
RBBINode *p;
int32_t px;
for (px=0; px<T->fPositions->size(); px++) {
p = (RBBINode *)T->fPositions->elementAt(px);
if ((p->fType == RBBINode::leafChar) && (p->fVal == a)) {
- if (U == NULL) {
+ if (U == nullptr) {
U = new UVector(*fStatus);
- if (U == NULL) {
+ if (U == nullptr) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;
goto ExitBuildSTdeleteall;
}
@@ -656,7 +656,7 @@ void RBBITableBuilder::buildStateTable() {
// if U is not empty and not in DStates then
int32_t ux = 0;
UBool UinDstates = false;
- if (U != NULL) {
+ if (U != nullptr) {
U_ASSERT(U->size() > 0);
int ix;
for (ix=0; ix<fDStates->size(); ix++) {
@@ -675,7 +675,7 @@ void RBBITableBuilder::buildStateTable() {
if (!UinDstates)
{
RBBIStateDescriptor *newState = new RBBIStateDescriptor(lastInputSymbol, fStatus);
- if (newState == NULL) {
+ if (newState == nullptr) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;
}
if (U_FAILURE(*fStatus)) {
@@ -942,7 +942,7 @@ void RBBITableBuilder::mergeRuleStatusVals() {
for (n=0; n<fDStates->size(); n++) {
RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(n);
UVector *thisStatesTagValues = sd->fTagVals;
- if (thisStatesTagValues == NULL) {
+ if (thisStatesTagValues == nullptr) {
// No tag values are explicitly associated with this state.
// Set the default tag value.
sd->fTagsIdx = 0;
@@ -1012,10 +1012,10 @@ void RBBITableBuilder::mergeRuleStatusVals() {
void RBBITableBuilder::sortedAdd(UVector **vector, int32_t val) {
int32_t i;
- if (*vector == NULL) {
+ if (*vector == nullptr) {
*vector = new UVector(*fStatus);
}
- if (*vector == NULL || U_FAILURE(*fStatus)) {
+ if (*vector == nullptr || U_FAILURE(*fStatus)) {
return;
}
UVector *vec = *vector;
@@ -1053,7 +1053,7 @@ void RBBITableBuilder::setAdd(UVector *dest, UVector *source) {
void **destLim, **sourceLim;
if (destOriginalSize > destArray.getCapacity()) {
- if (destArray.resize(destOriginalSize) == NULL) {
+ if (destArray.resize(destOriginalSize) == nullptr) {
return;
}
}
@@ -1061,7 +1061,7 @@ void RBBITableBuilder::setAdd(UVector *dest, UVector *source) {
destLim = destPtr + destOriginalSize; // destArray.getArrayLimit()?
if (sourceSize > sourceArray.getCapacity()) {
- if (sourceArray.resize(sourceSize) == NULL) {
+ if (sourceArray.resize(sourceSize) == nullptr) {
return;
}
}
@@ -1125,7 +1125,7 @@ UBool RBBITableBuilder::setEquals(UVector *a, UVector *b) {
//-----------------------------------------------------------------------------
#ifdef RBBI_DEBUG
void RBBITableBuilder::printPosSets(RBBINode *n) {
- if (n==NULL) {
+ if (n==nullptr) {
return;
}
printf("\n");
@@ -1339,7 +1339,7 @@ int32_t RBBITableBuilder::getTableSize() const {
int32_t numCols;
int32_t rowSize;
- if (fTree == NULL) {
+ if (fTree == nullptr) {
return 0;
}
@@ -1373,7 +1373,7 @@ void RBBITableBuilder::exportTable(void *where) {
uint32_t state;
int col;
- if (U_FAILURE(*fStatus) || fTree == NULL) {
+ if (U_FAILURE(*fStatus) || fTree == nullptr) {
return;
}
@@ -1651,7 +1651,7 @@ void RBBITableBuilder::printSet(UVector *s) {
int32_t i;
for (i=0; i<s->size(); i++) {
const RBBINode *v = static_cast<const RBBINode *>(s->elementAt(i));
- RBBIDebugPrintf("%5d", v==NULL? -1 : v->fSerialNum);
+ RBBIDebugPrintf("%5d", v==nullptr? -1 : v->fSerialNum);
}
RBBIDebugPrintf("\n");
}
@@ -1777,15 +1777,15 @@ RBBIStateDescriptor::RBBIStateDescriptor(int lastInputSymbol, UErrorCode *fStatu
fAccepting = 0;
fLookAhead = 0;
fTagsIdx = 0;
- fTagVals = NULL;
- fPositions = NULL;
- fDtran = NULL;
+ fTagVals = nullptr;
+ fPositions = nullptr;
+ fDtran = nullptr;
fDtran = new UVector32(lastInputSymbol+1, *fStatus);
if (U_FAILURE(*fStatus)) {
return;
}
- if (fDtran == NULL) {
+ if (fDtran == nullptr) {
*fStatus = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1800,9 +1800,9 @@ RBBIStateDescriptor::~RBBIStateDescriptor() {
delete fPositions;
delete fDtran;
delete fTagVals;
- fPositions = NULL;
- fDtran = NULL;
- fTagVals = NULL;
+ fPositions = nullptr;
+ fDtran = nullptr;
+ fTagVals = nullptr;
}
U_NAMESPACE_END
diff --git a/thirdparty/icu4c/common/rbbitblb.h b/thirdparty/icu4c/common/rbbitblb.h
index 2ac66da11f..01eee3da4e 100644
--- a/thirdparty/icu4c/common/rbbitblb.h
+++ b/thirdparty/icu4c/common/rbbitblb.h
@@ -156,7 +156,7 @@ private:
public:
#ifdef RBBI_DEBUG
void printSet(UVector *s);
- void printPosSets(RBBINode *n /* = NULL*/);
+ void printPosSets(RBBINode *n /* = nullptr */);
void printStates();
void printRuleStatusTable();
void printReverseTable();
diff --git a/thirdparty/icu4c/common/resbund.cpp b/thirdparty/icu4c/common/resbund.cpp
index 8591a625f9..54383c981d 100644
--- a/thirdparty/icu4c/common/resbund.cpp
+++ b/thirdparty/icu4c/common/resbund.cpp
@@ -177,13 +177,13 @@ U_NAMESPACE_BEGIN
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ResourceBundle)
ResourceBundle::ResourceBundle(UErrorCode &err)
- :UObject(), fLocale(NULL)
+ :UObject(), fLocale(nullptr)
{
fResource = ures_open(0, Locale::getDefault().getName(), &err);
}
ResourceBundle::ResourceBundle(const ResourceBundle &other)
- :UObject(other), fLocale(NULL)
+ :UObject(other), fLocale(nullptr)
{
UErrorCode status = U_ZERO_ERROR;
@@ -191,23 +191,23 @@ ResourceBundle::ResourceBundle(const ResourceBundle &other)
fResource = ures_copyResb(0, other.fResource, &status);
} else {
/* Copying a bad resource bundle */
- fResource = NULL;
+ fResource = nullptr;
}
}
ResourceBundle::ResourceBundle(UResourceBundle *res, UErrorCode& err)
- :UObject(), fLocale(NULL)
+ :UObject(), fLocale(nullptr)
{
if (res) {
fResource = ures_copyResb(0, res, &err);
} else {
/* Copying a bad resource bundle */
- fResource = NULL;
+ fResource = nullptr;
}
}
ResourceBundle::ResourceBundle(const char* path, const Locale& locale, UErrorCode& err)
- :UObject(), fLocale(NULL)
+ :UObject(), fLocale(nullptr)
{
fResource = ures_open(path, locale.getName(), &err);
}
@@ -220,18 +220,18 @@ ResourceBundle& ResourceBundle::operator=(const ResourceBundle& other)
}
if(fResource != 0) {
ures_close(fResource);
- fResource = NULL;
+ fResource = nullptr;
}
- if (fLocale != NULL) {
+ if (fLocale != nullptr) {
delete fLocale;
- fLocale = NULL;
+ fLocale = nullptr;
}
UErrorCode status = U_ZERO_ERROR;
if (other.fResource) {
fResource = ures_copyResb(0, other.fResource, &status);
} else {
/* Copying a bad resource bundle */
- fResource = NULL;
+ fResource = nullptr;
}
return *this;
}
@@ -241,7 +241,7 @@ ResourceBundle::~ResourceBundle()
if(fResource != 0) {
ures_close(fResource);
}
- if(fLocale != NULL) {
+ if(fLocale != nullptr) {
delete(fLocale);
}
}
@@ -253,7 +253,7 @@ ResourceBundle::clone() const {
UnicodeString ResourceBundle::getString(UErrorCode& status) const {
int32_t len = 0;
- const UChar *r = ures_getString(fResource, &len, &status);
+ const char16_t *r = ures_getString(fResource, &len, &status);
return UnicodeString(true, r, len);
}
@@ -273,27 +273,27 @@ int32_t ResourceBundle::getInt(UErrorCode& status) const {
return ures_getInt(fResource, &status);
}
-const char *ResourceBundle::getName(void) const {
+const char *ResourceBundle::getName() const {
return ures_getName(fResource);
}
-const char *ResourceBundle::getKey(void) const {
+const char *ResourceBundle::getKey() const {
return ures_getKey(fResource);
}
-UResType ResourceBundle::getType(void) const {
+UResType ResourceBundle::getType() const {
return ures_getType(fResource);
}
-int32_t ResourceBundle::getSize(void) const {
+int32_t ResourceBundle::getSize() const {
return ures_getSize(fResource);
}
-UBool ResourceBundle::hasNext(void) const {
+UBool ResourceBundle::hasNext() const {
return ures_hasNext(fResource);
}
-void ResourceBundle::resetIterator(void) {
+void ResourceBundle::resetIterator() {
ures_resetIterator(fResource);
}
@@ -311,13 +311,13 @@ ResourceBundle ResourceBundle::getNext(UErrorCode& status) {
UnicodeString ResourceBundle::getNextString(UErrorCode& status) {
int32_t len = 0;
- const UChar* r = ures_getNextString(fResource, &len, 0, &status);
+ const char16_t* r = ures_getNextString(fResource, &len, 0, &status);
return UnicodeString(true, r, len);
}
UnicodeString ResourceBundle::getNextString(const char ** key, UErrorCode& status) {
int32_t len = 0;
- const UChar* r = ures_getNextString(fResource, &len, key, &status);
+ const char16_t* r = ures_getNextString(fResource, &len, key, &status);
return UnicodeString(true, r, len);
}
@@ -335,7 +335,7 @@ ResourceBundle ResourceBundle::get(int32_t indexR, UErrorCode& status) const {
UnicodeString ResourceBundle::getStringEx(int32_t indexS, UErrorCode& status) const {
int32_t len = 0;
- const UChar* r = ures_getStringByIndex(fResource, indexS, &len, &status);
+ const char16_t* r = ures_getStringByIndex(fResource, indexS, &len, &status);
return UnicodeString(true, r, len);
}
@@ -363,7 +363,7 @@ ResourceBundle ResourceBundle::getWithFallback(const char* key, UErrorCode& stat
}
UnicodeString ResourceBundle::getStringEx(const char* key, UErrorCode& status) const {
int32_t len = 0;
- const UChar* r = ures_getStringByKey(fResource, key, &len, &status);
+ const char16_t* r = ures_getStringByKey(fResource, key, &len, &status);
return UnicodeString(true, r, len);
}
@@ -377,17 +377,17 @@ void ResourceBundle::getVersion(UVersionInfo versionInfo) const {
ures_getVersion(fResource, versionInfo);
}
-const Locale &ResourceBundle::getLocale(void) const {
+const Locale &ResourceBundle::getLocale() const {
static UMutex gLocaleLock;
Mutex lock(&gLocaleLock);
- if (fLocale != NULL) {
+ if (fLocale != nullptr) {
return *fLocale;
}
UErrorCode status = U_ZERO_ERROR;
const char *localeName = ures_getLocaleInternal(fResource, &status);
ResourceBundle *ncThis = const_cast<ResourceBundle *>(this);
ncThis->fLocale = new Locale(localeName);
- return ncThis->fLocale != NULL ? *ncThis->fLocale : Locale::getDefault();
+ return ncThis->fLocale != nullptr ? *ncThis->fLocale : Locale::getDefault();
}
const Locale ResourceBundle::getLocale(ULocDataLocaleType type, UErrorCode &status) const
diff --git a/thirdparty/icu4c/common/resbund_cnv.cpp b/thirdparty/icu4c/common/resbund_cnv.cpp
index 45c0b399bf..7f83f06f0e 100644
--- a/thirdparty/icu4c/common/resbund_cnv.cpp
+++ b/thirdparty/icu4c/common/resbund_cnv.cpp
@@ -27,14 +27,14 @@ U_NAMESPACE_BEGIN
ResourceBundle::ResourceBundle( const UnicodeString& path,
const Locale& locale,
UErrorCode& error)
- :UObject(), fLocale(NULL)
+ :UObject(), fLocale(nullptr)
{
constructForLocale(path, locale, error);
}
ResourceBundle::ResourceBundle( const UnicodeString& path,
UErrorCode& error)
- :UObject(), fLocale(NULL)
+ :UObject(), fLocale(nullptr)
{
constructForLocale(path, Locale::getDefault(), error);
}
@@ -45,11 +45,11 @@ ResourceBundle::constructForLocale(const UnicodeString& path,
UErrorCode& error)
{
if (path.isEmpty()) {
- fResource = ures_open(NULL, locale.getName(), &error);
+ fResource = ures_open(nullptr, locale.getName(), &error);
}
else {
UnicodeString nullTerminatedPath(path);
- nullTerminatedPath.append((UChar)0);
+ nullTerminatedPath.append((char16_t)0);
fResource = ures_openU(nullTerminatedPath.getBuffer(), locale.getName(), &error);
}
}
diff --git a/thirdparty/icu4c/common/resource.h b/thirdparty/icu4c/common/resource.h
index 1483f7d6bc..79ed897bd1 100644
--- a/thirdparty/icu4c/common/resource.h
+++ b/thirdparty/icu4c/common/resource.h
@@ -45,7 +45,7 @@ class ResourceValue;
class U_COMMON_API ResourceArray {
public:
/** Constructs an empty array object. */
- ResourceArray() : items16(NULL), items32(NULL), length(0) {}
+ ResourceArray() : items16(nullptr), items32(nullptr), length(0) {}
/** Only for implementation use. @internal */
ResourceArray(const uint16_t *i16, const uint32_t *i32, int32_t len,
@@ -80,7 +80,7 @@ private:
class U_COMMON_API ResourceTable {
public:
/** Constructs an empty table object. */
- ResourceTable() : keys16(NULL), keys32(NULL), items16(NULL), items32(NULL), length(0) {}
+ ResourceTable() : keys16(nullptr), keys32(nullptr), items16(nullptr), items32(nullptr), length(0) {}
/** Only for implementation use. @internal */
ResourceTable(const uint16_t *k16, const int32_t *k32,
@@ -136,22 +136,22 @@ public:
*
* @see ures_getString()
*/
- virtual const UChar *getString(int32_t &length, UErrorCode &errorCode) const = 0;
+ virtual const char16_t *getString(int32_t &length, UErrorCode &errorCode) const = 0;
inline UnicodeString getUnicodeString(UErrorCode &errorCode) const {
int32_t len = 0;
- const UChar *r = getString(len, errorCode);
+ const char16_t *r = getString(len, errorCode);
return UnicodeString(true, r, len);
}
/**
* Sets U_RESOURCE_TYPE_MISMATCH if this is not an alias resource.
*/
- virtual const UChar *getAliasString(int32_t &length, UErrorCode &errorCode) const = 0;
+ virtual const char16_t *getAliasString(int32_t &length, UErrorCode &errorCode) const = 0;
inline UnicodeString getAliasUnicodeString(UErrorCode &errorCode) const {
int32_t len = 0;
- const UChar *r = getAliasString(len, errorCode);
+ const char16_t *r = getAliasString(len, errorCode);
return UnicodeString(true, r, len);
}
diff --git a/thirdparty/icu4c/common/ruleiter.cpp b/thirdparty/icu4c/common/ruleiter.cpp
index 33ffd3d833..690635a908 100644
--- a/thirdparty/icu4c/common/ruleiter.cpp
+++ b/thirdparty/icu4c/common/ruleiter.cpp
@@ -130,7 +130,7 @@ void RuleCharacterIterator::jumpahead(int32_t count) {
UnicodeString& RuleCharacterIterator::toString(UnicodeString& result) const {
int32_t b = pos.getIndex();
text.extract(0, b, result);
- return result.append((UChar) 0x7C).append(text, b, 0x7FFFFFFF); // Insert '|' at index
+ return result.append((char16_t) 0x7C).append(text, b, 0x7FFFFFFF); // Insert '|' at index
}
*/
diff --git a/thirdparty/icu4c/common/schriter.cpp b/thirdparty/icu4c/common/schriter.cpp
index 83b3db4ab0..d4bac8fd4f 100644
--- a/thirdparty/icu4c/common/schriter.cpp
+++ b/thirdparty/icu4c/common/schriter.cpp
@@ -93,7 +93,7 @@ StringCharacterIterator::operator==(const ForwardCharacterIterator& that) const
return false;
}
- StringCharacterIterator& realThat = (StringCharacterIterator&)that;
+ const StringCharacterIterator& realThat = static_cast<const StringCharacterIterator&>(that);
return text == realThat.text
&& pos == realThat.pos
diff --git a/thirdparty/icu4c/common/serv.cpp b/thirdparty/icu4c/common/serv.cpp
index 9d8c04149c..5248f7c192 100644
--- a/thirdparty/icu4c/common/serv.cpp
+++ b/thirdparty/icu4c/common/serv.cpp
@@ -25,7 +25,7 @@ U_NAMESPACE_BEGIN
******************************************************************
*/
-const UChar ICUServiceKey::PREFIX_DELIMITER = 0x002F; /* '/' */
+const char16_t ICUServiceKey::PREFIX_DELIMITER = 0x002F; /* '/' */
ICUServiceKey::ICUServiceKey(const UnicodeString& id)
: _id(id) {
@@ -144,7 +144,7 @@ SimpleFactory::create(const ICUServiceKey& key, const ICUService* service, UErro
return service->cloneInstance(_instance);
}
}
- return NULL;
+ return nullptr;
}
void
@@ -243,7 +243,7 @@ public:
CacheEntry* unref() {
if ((--refcount) == 0) {
delete this;
- return NULL;
+ return nullptr;
}
return this;
}
@@ -294,14 +294,14 @@ StringPair::create(const UnicodeString& displayName,
{
if (U_SUCCESS(status)) {
StringPair* sp = new StringPair(displayName, id);
- if (sp == NULL || sp->isBogus()) {
+ if (sp == nullptr || sp->isBogus()) {
status = U_MEMORY_ALLOCATION_ERROR;
delete sp;
- return NULL;
+ return nullptr;
}
return sp;
}
- return NULL;
+ return nullptr;
}
UBool
@@ -332,20 +332,20 @@ static UMutex lock;
ICUService::ICUService()
: name()
, timestamp(0)
-, factories(NULL)
-, serviceCache(NULL)
-, idCache(NULL)
-, dnCache(NULL)
+, factories(nullptr)
+, serviceCache(nullptr)
+, idCache(nullptr)
+, dnCache(nullptr)
{
}
ICUService::ICUService(const UnicodeString& newName)
: name(newName)
, timestamp(0)
-, factories(NULL)
-, serviceCache(NULL)
-, idCache(NULL)
-, dnCache(NULL)
+, factories(nullptr)
+, serviceCache(nullptr)
+, idCache(nullptr)
+, dnCache(nullptr)
{
}
@@ -355,20 +355,20 @@ ICUService::~ICUService()
Mutex mutex(&lock);
clearCaches();
delete factories;
- factories = NULL;
+ factories = nullptr;
}
}
UObject*
ICUService::get(const UnicodeString& descriptor, UErrorCode& status) const
{
- return get(descriptor, NULL, status);
+ return get(descriptor, nullptr, status);
}
UObject*
ICUService::get(const UnicodeString& descriptor, UnicodeString* actualReturn, UErrorCode& status) const
{
- UObject* result = NULL;
+ UObject* result = nullptr;
ICUServiceKey* key = createKey(&descriptor, status);
if (key) {
result = getKey(*key, actualReturn, status);
@@ -380,7 +380,7 @@ ICUService::get(const UnicodeString& descriptor, UnicodeString* actualReturn, UE
UObject*
ICUService::getKey(ICUServiceKey& key, UErrorCode& status) const
{
- return getKey(key, NULL, status);
+ return getKey(key, nullptr, status);
}
// this is a vector that subclasses of ICUService can override to further customize the result object
@@ -389,7 +389,7 @@ ICUService::getKey(ICUServiceKey& key, UErrorCode& status) const
UObject*
ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const
{
- return getKey(key, actualReturn, NULL, status);
+ return getKey(key, actualReturn, nullptr, status);
}
// make it possible to call reentrantly on systems that don't have reentrant mutexes.
@@ -417,7 +417,7 @@ UObject*
ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUServiceFactory* factory, UErrorCode& status) const
{
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
if (isDefault()) {
@@ -426,7 +426,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
ICUService* ncthis = (ICUService*)this; // cast away semantic const
- CacheEntry* result = NULL;
+ CacheEntry* result = nullptr;
{
// The factory list can't be modified until we're done,
// otherwise we might update the cache with an invalid result.
@@ -437,17 +437,17 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
// 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 != nullptr);
- if (serviceCache == NULL) {
+ if (serviceCache == nullptr) {
ncthis->serviceCache = new Hashtable(status);
- if (ncthis->serviceCache == NULL) {
+ if (ncthis->serviceCache == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
if (U_FAILURE(status)) {
delete serviceCache;
- return NULL;
+ return nullptr;
}
serviceCache->setValueDeleter(cacheDeleter);
}
@@ -460,7 +460,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
int32_t limit = factories->size();
UBool cacheResult = true;
- if (factory != NULL) {
+ if (factory != nullptr) {
for (int32_t i = 0; i < limit; ++i) {
if (factory == (const ICUServiceFactory*)factories->elementAt(i)) {
startIndex = i + 1;
@@ -470,7 +470,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
if (startIndex == 0) {
// throw new InternalError("Factory " + factory + "not registered with service: " + this);
status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
cacheResult = false;
}
@@ -479,7 +479,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
currentDescriptor.remove();
key.currentDescriptor(currentDescriptor);
result = (CacheEntry*)serviceCache->get(currentDescriptor);
- if (result != NULL) {
+ if (result != nullptr) {
break;
}
@@ -493,13 +493,13 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
ICUServiceFactory* f = (ICUServiceFactory*)factories->elementAt(index++);
LocalPointer<UObject> service(f->create(key, this, status));
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
if (service.isValid()) {
result = new CacheEntry(currentDescriptor, service.getAlias());
- if (result == NULL) {
+ if (result == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
service.orphan(); // result now owns service.
@@ -513,32 +513,32 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
// fallback to the one that succeeded, we want to hit the
// cache the first time next goaround.
if (cacheDescriptorList.isNull()) {
- cacheDescriptorList.adoptInsteadAndCheckErrorCode(new UVector(uprv_deleteUObject, NULL, 5, status), status);
+ cacheDescriptorList.adoptInsteadAndCheckErrorCode(new UVector(uprv_deleteUObject, nullptr, 5, status), status);
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
}
LocalPointer<UnicodeString> idToCache(new UnicodeString(currentDescriptor), status);
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
if (idToCache->isBogus()) {
status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
cacheDescriptorList->adoptElement(idToCache.orphan(), status);
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
} while (key.fallback());
outerEnd:
- if (result != NULL) {
+ if (result != nullptr) {
if (putInCache && cacheResult) {
serviceCache->put(result->actualDescriptor, result, status);
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
if (cacheDescriptorList.isValid()) {
@@ -547,7 +547,7 @@ outerEnd:
serviceCache->put(*desc, result, status);
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
result->ref();
@@ -556,9 +556,9 @@ outerEnd:
}
}
- if (actualReturn != NULL) {
+ if (actualReturn != nullptr) {
// strip null prefix
- if (result->actualDescriptor.indexOf((UChar)0x2f) == 0) { // U+002f=slash (/)
+ if (result->actualDescriptor.indexOf((char16_t)0x2f) == 0) { // U+002f=slash (/)
actualReturn->remove();
actualReturn->append(result->actualDescriptor,
1,
@@ -570,7 +570,7 @@ outerEnd:
if (actualReturn->isBogus()) {
status = U_MEMORY_ALLOCATION_ERROR;
delete result;
- return NULL;
+ return nullptr;
}
}
@@ -588,12 +588,12 @@ outerEnd:
UObject*
ICUService::handleDefault(const ICUServiceKey& /* key */, UnicodeString* /* actualIDReturn */, UErrorCode& /* status */) const
{
- return NULL;
+ return nullptr;
}
UVector&
ICUService::getVisibleIDs(UVector& result, UErrorCode& status) const {
- return getVisibleIDs(result, NULL, status);
+ return getVisibleIDs(result, nullptr, status);
}
UVector&
@@ -609,17 +609,17 @@ ICUService::getVisibleIDs(UVector& result, const UnicodeString* matchID, UErrorC
{
Mutex mutex(&lock);
const Hashtable* map = getVisibleIDMap(status);
- if (map != NULL) {
+ if (map != nullptr) {
ICUServiceKey* fallbackKey = createKey(matchID, status);
for (int32_t pos = UHASH_FIRST; U_SUCCESS(status); ) {
const UHashElement* e = map->nextElement(pos);
- if (e == NULL) {
+ if (e == nullptr) {
break;
}
const UnicodeString* id = (const UnicodeString*)e->key.pointer;
- if (fallbackKey != NULL) {
+ if (fallbackKey != nullptr) {
if (!fallbackKey->isFallbackOf(*id)) {
continue;
}
@@ -640,23 +640,23 @@ ICUService::getVisibleIDs(UVector& result, const UnicodeString* matchID, UErrorC
const Hashtable*
ICUService::getVisibleIDMap(UErrorCode& status) const {
- if (U_FAILURE(status)) return NULL;
+ if (U_FAILURE(status)) return nullptr;
// must only be called when lock is already held
ICUService* ncthis = (ICUService*)this; // cast away semantic const
- if (idCache == NULL) {
+ if (idCache == nullptr) {
ncthis->idCache = new Hashtable(status);
- if (idCache == NULL) {
+ if (idCache == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
- } else if (factories != NULL) {
+ } else if (factories != nullptr) {
for (int32_t pos = factories->size(); --pos >= 0;) {
ICUServiceFactory* f = (ICUServiceFactory*)factories->elementAt(pos);
f->updateVisibleIDs(*idCache, status);
}
if (U_FAILURE(status)) {
delete idCache;
- ncthis->idCache = NULL;
+ ncthis->idCache = nullptr;
}
}
}
@@ -678,9 +678,9 @@ ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const
UErrorCode status = U_ZERO_ERROR;
Mutex mutex(&lock);
const Hashtable* map = getVisibleIDMap(status);
- if (map != NULL) {
+ if (map != nullptr) {
ICUServiceFactory* f = (ICUServiceFactory*)map->get(id);
- if (f != NULL) {
+ if (f != nullptr) {
f->getDisplayName(id, locale, result);
return result;
}
@@ -688,11 +688,11 @@ ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const
// fallback
status = U_ZERO_ERROR;
ICUServiceKey* fallbackKey = createKey(&id, status);
- while (fallbackKey != NULL && fallbackKey->fallback()) {
+ while (fallbackKey != nullptr && fallbackKey->fallback()) {
UnicodeString us;
fallbackKey->currentID(us);
f = (ICUServiceFactory*)map->get(us);
- if (f != NULL) {
+ if (f != nullptr) {
f->getDisplayName(id, locale, result);
delete fallbackKey;
return result;
@@ -708,14 +708,14 @@ ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const
UVector&
ICUService::getDisplayNames(UVector& result, UErrorCode& status) const
{
- return getDisplayNames(result, Locale::getDefault(), NULL, status);
+ return getDisplayNames(result, Locale::getDefault(), nullptr, status);
}
UVector&
ICUService::getDisplayNames(UVector& result, const Locale& locale, UErrorCode& status) const
{
- return getDisplayNames(result, locale, NULL, status);
+ return getDisplayNames(result, locale, nullptr, status);
}
UVector&
@@ -730,25 +730,25 @@ ICUService::getDisplayNames(UVector& result,
ICUService* ncthis = (ICUService*)this; // cast away semantic const
Mutex mutex(&lock);
- if (dnCache != NULL && dnCache->locale != locale) {
+ if (dnCache != nullptr && dnCache->locale != locale) {
delete dnCache;
- ncthis->dnCache = NULL;
+ ncthis->dnCache = nullptr;
}
- if (dnCache == NULL) {
+ if (dnCache == nullptr) {
const Hashtable* m = getVisibleIDMap(status);
if (U_FAILURE(status)) {
return result;
}
ncthis->dnCache = new DNCache(locale);
- if (dnCache == NULL) {
+ if (dnCache == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return result;
}
int32_t pos = UHASH_FIRST;
- const UHashElement* entry = NULL;
- while ((entry = m->nextElement(pos)) != NULL) {
+ const UHashElement* entry = nullptr;
+ while ((entry = m->nextElement(pos)) != nullptr) {
const UnicodeString* id = (const UnicodeString*)entry->key.pointer;
ICUServiceFactory* f = (ICUServiceFactory*)entry->value.pointer;
UnicodeString dname;
@@ -762,7 +762,7 @@ ICUService::getDisplayNames(UVector& result,
}
}
delete dnCache;
- ncthis->dnCache = NULL;
+ ncthis->dnCache = nullptr;
return result;
}
}
@@ -774,10 +774,10 @@ ICUService::getDisplayNames(UVector& result,
* at the next position, which in this case will be 0.
*/
int32_t pos = UHASH_FIRST;
- const UHashElement *entry = NULL;
- while ((entry = dnCache->cache.nextElement(pos)) != NULL) {
+ const UHashElement *entry = nullptr;
+ while ((entry = dnCache->cache.nextElement(pos)) != nullptr) {
const UnicodeString* id = (const UnicodeString*)entry->value.pointer;
- if (matchKey != NULL && !matchKey->isFallbackOf(*id)) {
+ if (matchKey != nullptr && !matchKey->isFallbackOf(*id)) {
continue;
}
const UnicodeString* dn = (const UnicodeString*)entry->key.pointer;
@@ -803,30 +803,30 @@ URegistryKey
ICUService::registerInstance(UObject* objToAdopt, const UnicodeString& id, UBool visible, UErrorCode& status)
{
ICUServiceKey* key = createKey(&id, status);
- if (key != NULL) {
+ if (key != nullptr) {
UnicodeString canonicalID;
key->canonicalID(canonicalID);
delete key;
ICUServiceFactory* f = createSimpleFactory(objToAdopt, canonicalID, visible, status);
- if (f != NULL) {
+ if (f != nullptr) {
return registerFactory(f, status);
}
}
delete objToAdopt;
- return NULL;
+ return nullptr;
}
ICUServiceFactory*
ICUService::createSimpleFactory(UObject* objToAdopt, const UnicodeString& id, UBool visible, UErrorCode& status)
{
if (U_SUCCESS(status)) {
- if ((objToAdopt != NULL) && (!id.isBogus())) {
+ if ((objToAdopt != nullptr) && (!id.isBogus())) {
return new SimpleFactory(objToAdopt, id, visible);
}
status = U_ILLEGAL_ARGUMENT_ERROR;
}
- return NULL;
+ return nullptr;
}
URegistryKey
@@ -865,7 +865,7 @@ ICUService::unregister(URegistryKey rkey, UErrorCode& status)
{
ICUServiceFactory *factory = (ICUServiceFactory*)rkey;
UBool result = false;
- if (factory != NULL && factories != NULL) {
+ if (factory != nullptr && factories != nullptr) {
Mutex mutex(&lock);
if (factories->removeElement(factory)) {
@@ -896,7 +896,7 @@ ICUService::reset()
void
ICUService::reInitializeFactories()
{
- if (factories != NULL) {
+ if (factories != nullptr) {
factories->removeAllElements();
}
}
@@ -910,7 +910,7 @@ ICUService::isDefault() const
ICUServiceKey*
ICUService::createKey(const UnicodeString* id, UErrorCode& status) const
{
- return (U_FAILURE(status) || id == NULL) ? NULL : new ICUServiceKey(*id);
+ return (U_FAILURE(status) || id == nullptr) ? nullptr : new ICUServiceKey(*id);
}
void
@@ -919,29 +919,29 @@ ICUService::clearCaches()
// callers synchronize before use
++timestamp;
delete dnCache;
- dnCache = NULL;
+ dnCache = nullptr;
delete idCache;
- idCache = NULL;
- delete serviceCache; serviceCache = NULL;
+ idCache = nullptr;
+ delete serviceCache; serviceCache = nullptr;
}
void
ICUService::clearServiceCache()
{
// callers synchronize before use
- delete serviceCache; serviceCache = NULL;
+ delete serviceCache; serviceCache = nullptr;
}
UBool
ICUService::acceptsListener(const EventListener& l) const
{
- return dynamic_cast<const ServiceListener*>(&l) != NULL;
+ return dynamic_cast<const ServiceListener*>(&l) != nullptr;
}
void
ICUService::notifyListener(EventListener& l) const
{
- ((ServiceListener&)l).serviceChanged(*this);
+ (static_cast<ServiceListener&>(l)).serviceChanged(*this);
}
UnicodeString&
@@ -953,7 +953,7 @@ ICUService::getName(UnicodeString& result) const
int32_t
ICUService::countFactories() const
{
- return factories == NULL ? 0 : factories->size();
+ return factories == nullptr ? 0 : factories->size();
}
int32_t
diff --git a/thirdparty/icu4c/common/serv.h b/thirdparty/icu4c/common/serv.h
index 3bd3d9a9b9..9aea548fc3 100644
--- a/thirdparty/icu4c/common/serv.h
+++ b/thirdparty/icu4c/common/serv.h
@@ -74,7 +74,7 @@ class U_COMMON_API ICUServiceKey : public UObject {
const UnicodeString _id;
protected:
- static const UChar PREFIX_DELIMITER;
+ static const char16_t PREFIX_DELIMITER;
public:
@@ -217,7 +217,7 @@ class U_COMMON_API ICUServiceFactory : public UObject {
/**
* <p>Create a service object from the key, if this factory
- * supports the key. Otherwise, return NULL.</p>
+ * supports the key. Otherwise, return nullptr.</p>
*
* <p>If the factory supports the key, then it can call
* the service's getKey(ICUServiceKey, String[], ICUServiceFactory) method
@@ -230,7 +230,7 @@ class U_COMMON_API ICUServiceFactory : public UObject {
* @param key the service key.
* @param service the service with which this factory is registered.
* @param status the error code status.
- * @return the service object, or NULL if the factory does not support the key.
+ * @return the service object, or nullptr if the factory does not support the key.
*/
virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const = 0;
@@ -292,7 +292,7 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory {
/**
* <p>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 must not be nullptr. The SimpleFactory will adopt
* the instance, which must not be changed subsequent to this call.</p>
*
* @param instanceToAdopt the service instance to adopt.
@@ -313,7 +313,7 @@ class U_COMMON_API SimpleFactory : public ICUServiceFactory {
* @param key the service key.
* @param service the service with which this factory is registered.
* @param status the error code status.
- * @return the service object, or NULL if the factory does not support the key.
+ * @return the service object, or nullptr if the factory does not support the key.
*/
virtual UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const override;
@@ -420,7 +420,7 @@ public:
* @param displayName the displayName.
* @param id the ID.
* @param status the error code status.
- * @return a StringPair if the creation was successful, otherwise NULL.
+ * @return a StringPair if the creation was successful, otherwise nullptr.
*/
static StringPair* create(const UnicodeString& displayName,
const UnicodeString& id,
@@ -593,7 +593,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
*
* @param descriptor the descriptor.
* @param status the error code status.
- * @return the service instance, or NULL.
+ * @return the service instance, or nullptr.
*/
UObject* get(const UnicodeString& descriptor, UErrorCode& status) const;
@@ -602,9 +602,9 @@ class U_COMMON_API ICUService : public ICUNotifier {
* createKey to create a key from the provided descriptor.</p>
*
* @param descriptor the descriptor.
- * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL.
+ * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or nullptr.
* @param status the error code status.
- * @return the service instance, or NULL.
+ * @return the service instance, or nullptr.
*/
UObject* get(const UnicodeString& descriptor, UnicodeString* actualReturn, UErrorCode& status) const;
@@ -613,15 +613,15 @@ class U_COMMON_API ICUService : public ICUNotifier {
*
* @param key the key.
* @param status the error code status.
- * @return the service instance, or NULL.
+ * @return the service instance, or nullptr.
*/
UObject* getKey(ICUServiceKey& key, UErrorCode& status) const;
/**
* <p>Given a key, return a service object, and, if actualReturn
- * is not NULL, the descriptor with which it was found in the
+ * is not nullptr, the descriptor with which it was found in the
* first element of actualReturn. If no service object matches
- * this key, returns NULL and leaves actualReturn unchanged.</p>
+ * this key, returns nullptr and leaves actualReturn unchanged.</p>
*
* <p>This queries the cache using the key's descriptor, and if no
* object in the cache matches, tries the key on each
@@ -635,9 +635,9 @@ class U_COMMON_API ICUService : public ICUNotifier {
* result before returning it.
*
* @param key the key.
- * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL.
+ * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or nullptr.
* @param status the error code status.
- * @return the service instance, or NULL.
+ * @return the service instance, or nullptr.
*/
virtual UObject* getKey(ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const;
@@ -648,10 +648,10 @@ class U_COMMON_API ICUService : public ICUNotifier {
* should not call it directly, but call through one of the other get functions.</p>
*
* @param key the key.
- * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL.
+ * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or nullptr.
* @param factory the factory making the recursive call.
* @param status the error code status.
- * @return the service instance, or NULL.
+ * @return the service instance, or nullptr.
*/
UObject* getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUServiceFactory* factory, UErrorCode& status) const;
@@ -677,11 +677,11 @@ class U_COMMON_API ICUService : public ICUNotifier {
* new elements, if any, are added.</p>
*
* <p>matchID is passed to createKey to create a key. If the key
- * is not NULL, its isFallbackOf method is used to filter out IDs
+ * is not nullptr, its isFallbackOf method is used to filter out IDs
* that don't match the key or have it as a fallback.</p>
*
* @param result a vector to hold the returned IDs.
- * @param matchID an ID used to filter the result, or NULL if all IDs are desired.
+ * @param matchID an ID used to filter the result, or nullptr if all IDs are desired.
* @param status the error code status.
* @return the result vector.
*/
@@ -711,7 +711,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
/**
* <p>Convenience override of getDisplayNames(const Locale&, const UnicodeString*) that
- * uses the current default Locale as the locale and NULL for
+ * uses the current default Locale as the locale and nullptr for
* the matchID.</p>
*
* @param result a vector to hold the returned displayName/id StringPairs.
@@ -722,7 +722,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
/**
* <p>Convenience override of getDisplayNames(const Locale&, const UnicodeString*) that
- * uses NULL for the matchID.</p>
+ * uses nullptr for the matchID.</p>
*
* @param result a vector to hold the returned displayName/id StringPairs.
* @param locale the locale in which to localize the ID.
@@ -746,12 +746,12 @@ class U_COMMON_API ICUService : public ICUNotifier {
* discarded before new elements, if any, are added.</p>
*
* <p>matchID is passed to createKey to create a key. If the key
- * is not NULL, its isFallbackOf method is used to filter out IDs
+ * is not nullptr, its isFallbackOf method is used to filter out IDs
* that don't match the key or have it as a fallback.</p>
*
* @param result a vector to hold the returned displayName/id StringPairs.
* @param locale the locale in which to localize the ID.
- * @param matchID an ID used to filter the result, or NULL if all IDs are desired.
+ * @param matchID an ID used to filter the result, or nullptr if all IDs are desired.
* @param status the error code status.
* @return the result vector. */
UVector& getDisplayNames(UVector& result,
@@ -830,7 +830,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
*
* <p>This issues a serviceChanged notification to registered listeners.</p>
*/
- virtual void reset(void);
+ virtual void reset();
/**
* <p>Return true if the service is in its default state.</p>
@@ -838,10 +838,10 @@ class U_COMMON_API ICUService : public ICUNotifier {
* <p>The default implementation returns true if there are no
* factories registered.</p>
*/
- virtual UBool isDefault(void) const;
+ virtual UBool isDefault() const;
/**
- * <p>Create a key from an ID. If ID is NULL, returns NULL.</p>
+ * <p>Create a key from an ID. If ID is nullptr, returns nullptr.</p>
*
* <p>The default implementation creates an ICUServiceKey instance.
* Subclasses can override to define more useful keys appropriate
@@ -849,7 +849,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
*
* @param a pointer to the ID for which to create a default ICUServiceKey.
* @param status the error code status.
- * @return the ICUServiceKey corresponding to ID, or NULL.
+ * @return the ICUServiceKey corresponding to ID, or nullptr.
*/
virtual ICUServiceKey* createKey(const UnicodeString* id, UErrorCode& status) const;
@@ -859,7 +859,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
* This is public so factories can call it, but should really be protected.</p>
*
* @param instance the service instance to clone.
- * @return a clone of the passed-in instance, or NULL if cloning was unsuccessful.
+ * @return a clone of the passed-in instance, or nullptr if cloning was unsuccessful.
*/
virtual UObject* cloneInstance(UObject* instance) const = 0;
@@ -895,18 +895,18 @@ class U_COMMON_API ICUService : public ICUNotifier {
* directly, since it must only be called while holding write
* access to the factory list.</p>
*/
- virtual void reInitializeFactories(void);
+ virtual void reInitializeFactories();
/**
* <p>Default handler for this service if no factory in the factory list
* handled the key passed to getKey.</p>
*
- * <p>The default implementation returns NULL.</p>
+ * <p>The default implementation returns nullptr.</p>
*
* @param key the key.
- * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or NULL.
+ * @param actualReturn a pointer to a UnicodeString to hold the matched descriptor, or nullptr.
* @param status the error code status.
- * @return the service instance, or NULL.
+ * @return the service instance, or nullptr.
*/
virtual UObject* handleDefault(const ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const;
@@ -918,7 +918,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
* should generally not call this method directly, as it must only
* be called while synchronized on the factory lock.</p>
*/
- virtual void clearCaches(void);
+ virtual void clearCaches();
/**
* <p>Return true if the listener is accepted.</p>
@@ -955,7 +955,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
* the resolution of IDs also changes, requiring the cache to be
* flushed, but not the visible IDs themselves.</p>
*/
- void clearServiceCache(void);
+ void clearServiceCache();
/**
* <p>Return a map from visible IDs to factories.
@@ -972,14 +972,14 @@ class U_COMMON_API ICUService : public ICUNotifier {
*
* @return the timestamp.
*/
- int32_t getTimestamp(void) const;
+ int32_t getTimestamp() const;
/**
* <p>Return the number of registered factories.</p>
*
* @return the number of factories registered at the time of the call.
*/
- int32_t countFactories(void) const;
+ int32_t countFactories() const;
private:
diff --git a/thirdparty/icu4c/common/servlk.cpp b/thirdparty/icu4c/common/servlk.cpp
index 7021806659..ba275ea301 100644
--- a/thirdparty/icu4c/common/servlk.cpp
+++ b/thirdparty/icu4c/common/servlk.cpp
@@ -21,9 +21,9 @@
#include "charstr.h"
#include "uassert.h"
-#define UNDERSCORE_CHAR ((UChar)0x005f)
-#define AT_SIGN_CHAR ((UChar)64)
-#define PERIOD_CHAR ((UChar)46)
+#define UNDERSCORE_CHAR ((char16_t)0x005f)
+#define AT_SIGN_CHAR ((char16_t)64)
+#define PERIOD_CHAR ((char16_t)46)
U_NAMESPACE_BEGIN
@@ -41,8 +41,8 @@ LocaleKey::createWithCanonicalFallback(const UnicodeString* primaryID,
int32_t kind,
UErrorCode& status)
{
- if (primaryID == NULL || U_FAILURE(status)) {
- return NULL;
+ if (primaryID == nullptr || U_FAILURE(status)) {
+ return nullptr;
}
UnicodeString canonicalPrimaryID;
LocaleUtility::canonicalLocaleString(primaryID, canonicalPrimaryID);
@@ -61,7 +61,7 @@ LocaleKey::LocaleKey(const UnicodeString& primaryID,
{
_fallbackID.setToBogus();
if (_primaryID.length() != 0) {
- if (canonicalFallbackID != NULL && _primaryID != *canonicalFallbackID) {
+ if (canonicalFallbackID != nullptr && _primaryID != *canonicalFallbackID) {
_fallbackID = *canonicalFallbackID;
}
}
@@ -74,7 +74,7 @@ LocaleKey::~LocaleKey() {}
UnicodeString&
LocaleKey::prefix(UnicodeString& result) const {
if (_kind != KIND_ANY) {
- UChar buffer[64];
+ char16_t buffer[64];
uprv_itou(buffer, 64, _kind, 10, 0);
UnicodeString temp(buffer);
result.append(temp);
diff --git a/thirdparty/icu4c/common/servlkf.cpp b/thirdparty/icu4c/common/servlkf.cpp
index 7ccb0c72aa..f5bb0418c4 100644
--- a/thirdparty/icu4c/common/servlkf.cpp
+++ b/thirdparty/icu4c/common/servlkf.cpp
@@ -22,9 +22,9 @@
#include "ucln_cmn.h"
#include "uassert.h"
-#define UNDERSCORE_CHAR ((UChar)0x005f)
-#define AT_SIGN_CHAR ((UChar)64)
-#define PERIOD_CHAR ((UChar)46)
+#define UNDERSCORE_CHAR ((char16_t)0x005f)
+#define AT_SIGN_CHAR ((char16_t)64)
+#define PERIOD_CHAR ((char16_t)46)
U_NAMESPACE_BEGIN
@@ -47,14 +47,14 @@ LocaleKeyFactory::~LocaleKeyFactory() {
UObject*
LocaleKeyFactory::create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const {
if (handlesKey(key, status)) {
- const LocaleKey& lkey = (const LocaleKey&)key;
+ const LocaleKey& lkey = static_cast<const LocaleKey&>(key);
int32_t kind = lkey.kind();
Locale loc;
lkey.currentLocale(loc);
return handleCreate(loc, kind, service, status);
}
- return NULL;
+ return nullptr;
}
UBool
@@ -63,7 +63,7 @@ LocaleKeyFactory::handlesKey(const ICUServiceKey& key, UErrorCode& status) const
if (supported) {
UnicodeString id;
key.currentID(id);
- return supported->get(id) != NULL;
+ return supported->get(id) != nullptr;
}
return false;
}
@@ -73,9 +73,9 @@ LocaleKeyFactory::updateVisibleIDs(Hashtable& result, UErrorCode& status) const
const Hashtable* supported = getSupportedIDs(status);
if (supported) {
UBool visible = (_coverage & 0x1) == 0;
- const UHashElement* elem = NULL;
+ const UHashElement* elem = nullptr;
int32_t pos = UHASH_FIRST;
- while ((elem = supported->nextElement(pos)) != NULL) {
+ while ((elem = supported->nextElement(pos)) != nullptr) {
const UnicodeString& id = *((const UnicodeString*)elem->key.pointer);
if (!visible) {
result.remove(id);
@@ -109,7 +109,7 @@ LocaleKeyFactory::handleCreate(const Locale& /* loc */,
int32_t /* kind */,
const ICUService* /* service */,
UErrorCode& /* status */) const {
- return NULL;
+ return nullptr;
}
//UBool
@@ -120,7 +120,7 @@ LocaleKeyFactory::handleCreate(const Locale& /* loc */,
const Hashtable*
LocaleKeyFactory::getSupportedIDs(UErrorCode& /* status */) const {
- return NULL;
+ return nullptr;
}
#ifdef SERVICE_DEBUG
diff --git a/thirdparty/icu4c/common/servloc.h b/thirdparty/icu4c/common/servloc.h
index 29c50a27d1..49d1240905 100644
--- a/thirdparty/icu4c/common/servloc.h
+++ b/thirdparty/icu4c/common/servloc.h
@@ -258,7 +258,7 @@ public:
protected:
/**
* Utility method used by create(ICUServiceKey, ICUService). Subclasses can implement
- * this instead of create. The default returns NULL.
+ * this instead of create. The default returns nullptr.
*/
virtual UObject* handleCreate(const Locale& loc, int32_t kind, const ICUService* service, UErrorCode& status) const;
@@ -518,7 +518,7 @@ class U_COMMON_API ICULocaleService : public ICUService
* Convenience method for callers using locales. This returns the standard
* service ID enumeration.
*/
- virtual StringEnumeration* getAvailableLocales(void) const;
+ virtual StringEnumeration* getAvailableLocales() const;
protected:
diff --git a/thirdparty/icu4c/common/servls.cpp b/thirdparty/icu4c/common/servls.cpp
index 19481122ef..978a956df7 100644
--- a/thirdparty/icu4c/common/servls.cpp
+++ b/thirdparty/icu4c/common/servls.cpp
@@ -20,9 +20,9 @@
#include "charstr.h"
#include "uassert.h"
-#define UNDERSCORE_CHAR ((UChar)0x005f)
-#define AT_SIGN_CHAR ((UChar)64)
-#define PERIOD_CHAR ((UChar)46)
+#define UNDERSCORE_CHAR ((char16_t)0x005f)
+#define AT_SIGN_CHAR ((char16_t)64)
+#define PERIOD_CHAR ((char16_t)46)
U_NAMESPACE_BEGIN
@@ -44,13 +44,13 @@ ICULocaleService::~ICULocaleService()
UObject*
ICULocaleService::get(const Locale& locale, UErrorCode& status) const
{
- return get(locale, LocaleKey::KIND_ANY, NULL, status);
+ return get(locale, LocaleKey::KIND_ANY, nullptr, status);
}
UObject*
ICULocaleService::get(const Locale& locale, int32_t kind, UErrorCode& status) const
{
- return get(locale, kind, NULL, status);
+ return get(locale, kind, nullptr, status);
}
UObject*
@@ -62,7 +62,7 @@ ICULocaleService::get(const Locale& locale, Locale* actualReturn, UErrorCode& st
UObject*
ICULocaleService::get(const Locale& locale, int32_t kind, Locale* actualReturn, UErrorCode& status) const
{
- UObject* result = NULL;
+ UObject* result = nullptr;
if (U_FAILURE(status)) {
return result;
}
@@ -73,13 +73,13 @@ ICULocaleService::get(const Locale& locale, int32_t kind, Locale* actualReturn,
} else {
ICUServiceKey* key = createKey(&locName, kind, status);
if (key) {
- if (actualReturn == NULL) {
+ if (actualReturn == nullptr) {
result = getKey(*key, status);
} else {
UnicodeString temp;
result = getKey(*key, &temp, status);
- if (result != NULL) {
+ if (result != nullptr) {
key->parseSuffix(temp);
LocaleUtility::initLocaleFromName(temp, *actualReturn);
}
@@ -117,11 +117,11 @@ URegistryKey
ICULocaleService::registerInstance(UObject* objToAdopt, const Locale& locale, int32_t kind, int32_t coverage, UErrorCode& status)
{
ICUServiceFactory * factory = new SimpleLocaleKeyFactory(objToAdopt, locale, kind, coverage);
- if (factory != NULL) {
+ if (factory != nullptr) {
return registerFactory(factory, status);
}
delete objToAdopt;
- return NULL;
+ return nullptr;
}
#if 0
@@ -143,11 +143,11 @@ URegistryKey
ICULocaleService::registerInstance(UObject* objToAdopt, const UnicodeString& locale, int32_t kind, int32_t coverage, UErrorCode& status)
{
ICUServiceFactory * factory = new SimpleLocaleKeyFactory(objToAdopt, locale, kind, coverage);
- if (factory != NULL) {
+ if (factory != nullptr) {
return registerFactory(factory, status);
}
delete objToAdopt;
- return NULL;
+ return nullptr;
}
#endif
@@ -162,7 +162,7 @@ private:
ServiceEnumeration(const ICULocaleService* service, UErrorCode &status)
: _service(service)
, _timestamp(service->getTimestamp())
- , _ids(uprv_deleteUObject, NULL, status)
+ , _ids(uprv_deleteUObject, nullptr, status)
, _pos(0)
{
_service->getVisibleIDs(_ids, status);
@@ -171,7 +171,7 @@ private:
ServiceEnumeration(const ServiceEnumeration &other, UErrorCode &status)
: _service(other._service)
, _timestamp(other._timestamp)
- , _ids(uprv_deleteUObject, NULL, status)
+ , _ids(uprv_deleteUObject, nullptr, status)
, _pos(0)
{
if(U_SUCCESS(status)) {
@@ -197,7 +197,7 @@ public:
return result;
}
delete result;
- return NULL;
+ return nullptr;
}
virtual ~ServiceEnumeration();
@@ -207,7 +207,7 @@ public:
ServiceEnumeration *cl = new ServiceEnumeration(*this, status);
if(U_FAILURE(status)) {
delete cl;
- cl = NULL;
+ cl = nullptr;
}
return cl;
}
@@ -230,7 +230,7 @@ public:
if (upToDate(status) && (_pos < _ids.size())) {
return (const UnicodeString*)_ids[_pos++];
}
- return NULL;
+ return nullptr;
}
virtual void reset(UErrorCode& status) override {
@@ -245,8 +245,8 @@ public:
}
public:
- static UClassID U_EXPORT2 getStaticClassID(void);
- virtual UClassID getDynamicClassID(void) const override;
+ static UClassID U_EXPORT2 getStaticClassID();
+ virtual UClassID getDynamicClassID() const override;
};
ServiceEnumeration::~ServiceEnumeration() {}
@@ -254,7 +254,7 @@ ServiceEnumeration::~ServiceEnumeration() {}
UOBJECT_DEFINE_RTTI_IMPLEMENTATION(ServiceEnumeration)
StringEnumeration*
-ICULocaleService::getAvailableLocales(void) const
+ICULocaleService::getAvailableLocales() const
{
return ServiceEnumeration::create(this);
}
diff --git a/thirdparty/icu4c/common/servnotf.cpp b/thirdparty/icu4c/common/servnotf.cpp
index d9fb388752..b2ad663a48 100644
--- a/thirdparty/icu4c/common/servnotf.cpp
+++ b/thirdparty/icu4c/common/servnotf.cpp
@@ -23,16 +23,16 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(EventListener)
static UMutex notifyLock;
-ICUNotifier::ICUNotifier(void)
-: listeners(NULL)
+ICUNotifier::ICUNotifier()
+: listeners(nullptr)
{
}
-ICUNotifier::~ICUNotifier(void) {
+ICUNotifier::~ICUNotifier() {
{
Mutex lmx(&notifyLock);
delete listeners;
- listeners = NULL;
+ listeners = nullptr;
}
}
@@ -41,14 +41,14 @@ void
ICUNotifier::addListener(const EventListener* l, UErrorCode& status)
{
if (U_SUCCESS(status)) {
- if (l == NULL) {
+ if (l == nullptr) {
status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
if (acceptsListener(*l)) {
Mutex lmx(&notifyLock);
- if (listeners == NULL) {
+ if (listeners == nullptr) {
LocalPointer<UVector> lpListeners(new UVector(5, status), status);
if (U_FAILURE(status)) {
return;
@@ -78,14 +78,14 @@ void
ICUNotifier::removeListener(const EventListener *l, UErrorCode& status)
{
if (U_SUCCESS(status)) {
- if (l == NULL) {
+ if (l == nullptr) {
status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
{
Mutex lmx(&notifyLock);
- if (listeners != NULL) {
+ if (listeners != nullptr) {
// identity equality check
for (int i = 0, e = listeners->size(); i < e; ++i) {
const EventListener* el = (const EventListener*)listeners->elementAt(i);
@@ -93,7 +93,7 @@ ICUNotifier::removeListener(const EventListener *l, UErrorCode& status)
listeners->removeElementAt(i);
if (listeners->size() == 0) {
delete listeners;
- listeners = NULL;
+ listeners = nullptr;
}
return;
}
@@ -104,10 +104,10 @@ ICUNotifier::removeListener(const EventListener *l, UErrorCode& status)
}
void
-ICUNotifier::notifyChanged(void)
+ICUNotifier::notifyChanged()
{
Mutex lmx(&notifyLock);
- if (listeners != NULL) {
+ if (listeners != nullptr) {
for (int i = 0, e = listeners->size(); i < e; ++i) {
EventListener* el = (EventListener*)listeners->elementAt(i);
notifyListener(*el);
diff --git a/thirdparty/icu4c/common/servnotf.h b/thirdparty/icu4c/common/servnotf.h
index e3b2cac32e..840fe1ae87 100644
--- a/thirdparty/icu4c/common/servnotf.h
+++ b/thirdparty/icu4c/common/servnotf.h
@@ -75,9 +75,9 @@ class U_COMMON_API ICUNotifier : public UMemory {
private: UVector* listeners;
public:
- ICUNotifier(void);
+ ICUNotifier();
- virtual ~ICUNotifier(void);
+ virtual ~ICUNotifier();
/**
* Add a listener to be notified when notifyChanged is called.
@@ -101,7 +101,7 @@ public:
* indefinitely block the calling thread. Callers should beware of
* deadlock situations.
*/
- virtual void notifyChanged(void);
+ virtual void notifyChanged();
protected:
/**
diff --git a/thirdparty/icu4c/common/servrbf.cpp b/thirdparty/icu4c/common/servrbf.cpp
index 94279ab3a1..a4feca2c3b 100644
--- a/thirdparty/icu4c/common/servrbf.cpp
+++ b/thirdparty/icu4c/common/servrbf.cpp
@@ -22,9 +22,9 @@
#include "ucln_cmn.h"
#include "uassert.h"
-#define UNDERSCORE_CHAR ((UChar)0x005f)
-#define AT_SIGN_CHAR ((UChar)64)
-#define PERIOD_CHAR ((UChar)46)
+#define UNDERSCORE_CHAR ((char16_t)0x005f)
+#define AT_SIGN_CHAR ((char16_t)64)
+#define PERIOD_CHAR ((char16_t)46)
U_NAMESPACE_BEGIN
@@ -48,7 +48,7 @@ ICUResourceBundleFactory::getSupportedIDs(UErrorCode& status) const
if (U_SUCCESS(status)) {
return LocaleUtility::getAvailableLocaleNames(_bundleName);
}
- return NULL;
+ return nullptr;
}
UObject*
@@ -63,11 +63,11 @@ ICUResourceBundleFactory::handleCreate(const Locale& loc, int32_t /* kind */, co
int32_t length;
length=_bundleName.extract(0, INT32_MAX, pkg, (int32_t)sizeof(pkg), US_INV);
if(length>=(int32_t)sizeof(pkg)) {
- return NULL;
+ return nullptr;
}
return new ResourceBundle(pkg, loc, status);
}
- return NULL;
+ return nullptr;
}
#ifdef SERVICE_DEBUG
diff --git a/thirdparty/icu4c/common/servslkf.cpp b/thirdparty/icu4c/common/servslkf.cpp
index 09154d1b91..b3ab1cc9ce 100644
--- a/thirdparty/icu4c/common/servslkf.cpp
+++ b/thirdparty/icu4c/common/servslkf.cpp
@@ -21,9 +21,9 @@
#include "charstr.h"
#include "uassert.h"
-#define UNDERSCORE_CHAR ((UChar)0x005f)
-#define AT_SIGN_CHAR ((UChar)64)
-#define PERIOD_CHAR ((UChar)46)
+#define UNDERSCORE_CHAR ((char16_t)0x005f)
+#define AT_SIGN_CHAR ((char16_t)64)
+#define PERIOD_CHAR ((char16_t)46)
U_NAMESPACE_BEGIN
@@ -57,14 +57,14 @@ SimpleLocaleKeyFactory::SimpleLocaleKeyFactory(UObject* objToAdopt,
SimpleLocaleKeyFactory::~SimpleLocaleKeyFactory()
{
delete _obj;
- _obj = NULL;
+ _obj = nullptr;
}
UObject*
SimpleLocaleKeyFactory::create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const
{
if (U_SUCCESS(status)) {
- const LocaleKey& lkey = (const LocaleKey&)key;
+ const LocaleKey& lkey = static_cast<const LocaleKey&>(key);
if (_kind == LocaleKey::KIND_ANY || _kind == lkey.kind()) {
UnicodeString keyID;
lkey.currentID(keyID);
@@ -73,7 +73,7 @@ SimpleLocaleKeyFactory::create(const ICUServiceKey& key, const ICUService* servi
}
}
}
- return NULL;
+ return nullptr;
}
//UBool
diff --git a/thirdparty/icu4c/common/sharedobject.h b/thirdparty/icu4c/common/sharedobject.h
index 6298662bba..5532ec48d8 100644
--- a/thirdparty/icu4c/common/sharedobject.h
+++ b/thirdparty/icu4c/common/sharedobject.h
@@ -57,14 +57,14 @@ public:
SharedObject() :
softRefCount(0),
hardRefCount(0),
- cachePtr(NULL) {}
+ cachePtr(nullptr) {}
/** Initializes totalRefCount, softRefCount to 0. */
SharedObject(const SharedObject &other) :
UObject(other),
softRefCount(0),
hardRefCount(0),
- cachePtr(NULL) {}
+ cachePtr(nullptr) {}
virtual ~SharedObject();
@@ -116,7 +116,7 @@ public:
* If there are multiple owners, then ptr is replaced with a
* copy-constructed clone,
* and that is returned.
- * Returns NULL if cloning failed.
+ * Returns nullptr if cloning failed.
*
* T must be a subclass of SharedObject.
*/
@@ -125,7 +125,7 @@ public:
const T *p = ptr;
if(p->getRefCount() <= 1) { return const_cast<T *>(p); }
T *p2 = new T(*p);
- if(p2 == NULL) { return NULL; }
+ if(p2 == nullptr) { return nullptr; }
p->removeRef();
ptr = p2;
p2->addRef();
@@ -135,7 +135,7 @@ public:
/**
* 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
+ * if necessary. Before this call is made, dest must either be nullptr or
* be included in the reference count of the object it points to.
*
* T must be a subclass of SharedObject.
@@ -143,20 +143,20 @@ public:
template<typename T>
static void copyPtr(const T *src, const T *&dest) {
if(src != dest) {
- if(dest != NULL) { dest->removeRef(); }
+ if(dest != nullptr) { dest->removeRef(); }
dest = src;
- if(src != NULL) { src->addRef(); }
+ if(src != nullptr) { src->addRef(); }
}
}
/**
- * Equivalent to copyPtr(NULL, dest).
+ * Equivalent to copyPtr(nullptr, dest).
*/
template<typename T>
static void clearPtr(const T *&ptr) {
- if (ptr != NULL) {
+ if (ptr != nullptr) {
ptr->removeRef();
- ptr = NULL;
+ ptr = nullptr;
}
}
diff --git a/thirdparty/icu4c/common/simpleformatter.cpp b/thirdparty/icu4c/common/simpleformatter.cpp
index 01d3024cfc..1625627072 100644
--- a/thirdparty/icu4c/common/simpleformatter.cpp
+++ b/thirdparty/icu4c/common/simpleformatter.cpp
@@ -25,11 +25,11 @@ namespace {
*/
const int32_t ARG_NUM_LIMIT = 0x100;
/**
- * Initial and maximum char/UChar value set for a text segment.
+ * Initial and maximum char/char16_t value set for a text segment.
* Segment length char values are from ARG_NUM_LIMIT+1 to this value here.
* Normally 0xffff, but can be as small as ARG_NUM_LIMIT+1 for testing.
*/
-const UChar SEGMENT_LENGTH_PLACEHOLDER_CHAR = 0xffff;
+const char16_t SEGMENT_LENGTH_PLACEHOLDER_CHAR = 0xffff;
/**
* Maximum length of a text segment. Longer segments are split into shorter ones.
*/
@@ -45,7 +45,7 @@ enum {
};
inline UBool isInvalidArray(const void *array, int32_t length) {
- return (length < 0 || (array == NULL && length != 0));
+ return (length < 0 || (array == nullptr && length != 0));
}
} // namespace
@@ -70,15 +70,15 @@ UBool SimpleFormatter::applyPatternMinMaxArguments(
// Parse consistent with MessagePattern, but
// - support only simple numbered arguments
// - build a simple binary structure into the result string
- const UChar *patternBuffer = pattern.getBuffer();
+ const char16_t *patternBuffer = pattern.getBuffer();
int32_t patternLength = pattern.length();
// Reserve the first char for the number of arguments.
- compiledPattern.setTo((UChar)0);
+ compiledPattern.setTo((char16_t)0);
int32_t textLength = 0;
int32_t maxArg = -1;
UBool inQuote = false;
for (int32_t i = 0; i < patternLength;) {
- UChar c = patternBuffer[i++];
+ char16_t c = patternBuffer[i++];
if (c == APOS) {
if (i < patternLength && (c = patternBuffer[i]) == APOS) {
// double apostrophe, skip the second one
@@ -98,7 +98,7 @@ UBool SimpleFormatter::applyPatternMinMaxArguments(
} else if (!inQuote && c == OPEN_BRACE) {
if (textLength > 0) {
compiledPattern.setCharAt(compiledPattern.length() - textLength - 1,
- (UChar)(ARG_NUM_LIMIT + textLength));
+ (char16_t)(ARG_NUM_LIMIT + textLength));
textLength = 0;
}
int32_t argNumber;
@@ -129,7 +129,7 @@ UBool SimpleFormatter::applyPatternMinMaxArguments(
if (argNumber > maxArg) {
maxArg = argNumber;
}
- compiledPattern.append((UChar)argNumber);
+ compiledPattern.append((char16_t)argNumber);
continue;
} // else: c is part of literal text
// Append c and track the literal-text segment length.
@@ -144,14 +144,14 @@ UBool SimpleFormatter::applyPatternMinMaxArguments(
}
if (textLength > 0) {
compiledPattern.setCharAt(compiledPattern.length() - textLength - 1,
- (UChar)(ARG_NUM_LIMIT + textLength));
+ (char16_t)(ARG_NUM_LIMIT + textLength));
}
int32_t argCount = maxArg + 1;
if (argCount < min || max < argCount) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return false;
}
- compiledPattern.setCharAt(0, (UChar)argCount);
+ compiledPattern.setCharAt(0, (char16_t)argCount);
return true;
}
@@ -159,7 +159,7 @@ UnicodeString& SimpleFormatter::format(
const UnicodeString &value0,
UnicodeString &appendTo, UErrorCode &errorCode) const {
const UnicodeString *values[] = { &value0 };
- return formatAndAppend(values, 1, appendTo, NULL, 0, errorCode);
+ return formatAndAppend(values, 1, appendTo, nullptr, 0, errorCode);
}
UnicodeString& SimpleFormatter::format(
@@ -167,7 +167,7 @@ UnicodeString& SimpleFormatter::format(
const UnicodeString &value1,
UnicodeString &appendTo, UErrorCode &errorCode) const {
const UnicodeString *values[] = { &value0, &value1 };
- return formatAndAppend(values, 2, appendTo, NULL, 0, errorCode);
+ return formatAndAppend(values, 2, appendTo, nullptr, 0, errorCode);
}
UnicodeString& SimpleFormatter::format(
@@ -176,7 +176,7 @@ UnicodeString& SimpleFormatter::format(
const UnicodeString &value2,
UnicodeString &appendTo, UErrorCode &errorCode) const {
const UnicodeString *values[] = { &value0, &value1, &value2 };
- return formatAndAppend(values, 3, appendTo, NULL, 0, errorCode);
+ return formatAndAppend(values, 3, appendTo, nullptr, 0, errorCode);
}
UnicodeString& SimpleFormatter::formatAndAppend(
@@ -192,7 +192,7 @@ UnicodeString& SimpleFormatter::formatAndAppend(
return appendTo;
}
return format(compiledPattern.getBuffer(), compiledPattern.length(), values,
- appendTo, NULL, true,
+ appendTo, nullptr, true,
offsets, offsetsLength, errorCode);
}
@@ -207,7 +207,7 @@ UnicodeString &SimpleFormatter::formatAndReplace(
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return result;
}
- const UChar *cp = compiledPattern.getBuffer();
+ const char16_t *cp = compiledPattern.getBuffer();
int32_t cpLength = compiledPattern.length();
if (valuesLength < getArgumentLimit(cp, cpLength)) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
@@ -246,7 +246,7 @@ UnicodeString &SimpleFormatter::formatAndReplace(
}
UnicodeString SimpleFormatter::getTextWithNoArguments(
- const UChar *compiledPattern,
+ const char16_t *compiledPattern,
int32_t compiledPatternLength,
int32_t* offsets,
int32_t offsetsLength) {
@@ -272,7 +272,7 @@ UnicodeString SimpleFormatter::getTextWithNoArguments(
}
UnicodeString &SimpleFormatter::format(
- const UChar *compiledPattern, int32_t compiledPatternLength,
+ const char16_t *compiledPattern, int32_t compiledPatternLength,
const UnicodeString *const *values,
UnicodeString &result, const UnicodeString *resultCopy, UBool forbidResultAsValue,
int32_t *offsets, int32_t offsetsLength,
@@ -287,7 +287,7 @@ UnicodeString &SimpleFormatter::format(
int32_t n = compiledPattern[i++];
if (n < ARG_NUM_LIMIT) {
const UnicodeString *value = values[n];
- if (value == NULL) {
+ if (value == nullptr) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return result;
}
diff --git a/thirdparty/icu4c/common/static_unicode_sets.cpp b/thirdparty/icu4c/common/static_unicode_sets.cpp
index db9432f49a..0db5ea000d 100644
--- a/thirdparty/icu4c/common/static_unicode_sets.cpp
+++ b/thirdparty/icu4c/common/static_unicode_sets.cpp
@@ -72,7 +72,7 @@ void saveSet(Key key, const UnicodeString& unicodeSetPattern, UErrorCode& status
class ParseDataSink : public ResourceSink {
public:
- void put(const char* key, ResourceValue& value, UBool /*noFallback*/, UErrorCode& status) U_OVERRIDE {
+ void put(const char* key, ResourceValue& value, UBool /*noFallback*/, UErrorCode& status) override {
ResourceTable contextsTable = value.getTable(status);
if (U_FAILURE(status)) { return; }
for (int i = 0; contextsTable.getKeyAndValue(i, key, value); i++) {
diff --git a/thirdparty/icu4c/common/stringpiece.cpp b/thirdparty/icu4c/common/stringpiece.cpp
index 99089e08ef..eb9766c018 100644
--- a/thirdparty/icu4c/common/stringpiece.cpp
+++ b/thirdparty/icu4c/common/stringpiece.cpp
@@ -16,7 +16,7 @@
U_NAMESPACE_BEGIN
StringPiece::StringPiece(const char* str)
- : ptr_(str), length_((str == NULL) ? 0 : static_cast<int32_t>(uprv_strlen(str))) { }
+ : ptr_(str), length_((str == nullptr) ? 0 : static_cast<int32_t>(uprv_strlen(str))) { }
StringPiece::StringPiece(const StringPiece& x, int32_t pos) {
if (pos < 0) {
@@ -45,7 +45,7 @@ StringPiece::StringPiece(const StringPiece& x, int32_t pos, int32_t len) {
void StringPiece::set(const char* str) {
ptr_ = str;
- if (str != NULL)
+ if (str != nullptr)
length_ = static_cast<int32_t>(uprv_strlen(str));
else
length_ = 0;
diff --git a/thirdparty/icu4c/common/stringtriebuilder.cpp b/thirdparty/icu4c/common/stringtriebuilder.cpp
index e6670d1cb7..2a40dc88fd 100644
--- a/thirdparty/icu4c/common/stringtriebuilder.cpp
+++ b/thirdparty/icu4c/common/stringtriebuilder.cpp
@@ -36,7 +36,7 @@ U_CDECL_END
U_NAMESPACE_BEGIN
-StringTrieBuilder::StringTrieBuilder() : nodes(NULL) {}
+StringTrieBuilder::StringTrieBuilder() : nodes(nullptr) {}
StringTrieBuilder::~StringTrieBuilder() {
deleteCompactBuilder();
@@ -47,10 +47,10 @@ StringTrieBuilder::createCompactBuilder(int32_t sizeGuess, UErrorCode &errorCode
if(U_FAILURE(errorCode)) {
return;
}
- nodes=uhash_openSize(hashStringTrieNode, equalStringTrieNodes, NULL,
+ nodes=uhash_openSize(hashStringTrieNode, equalStringTrieNodes, nullptr,
sizeGuess, &errorCode);
if(U_SUCCESS(errorCode)) {
- if(nodes==NULL) {
+ if(nodes==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
} else {
uhash_setKeyDeleter(nodes, uprv_deleteUObject);
@@ -61,7 +61,7 @@ StringTrieBuilder::createCompactBuilder(int32_t sizeGuess, UErrorCode &errorCode
void
StringTrieBuilder::deleteCompactBuilder() {
uhash_close(nodes);
- nodes=NULL;
+ nodes=nullptr;
}
void
@@ -133,7 +133,7 @@ StringTrieBuilder::writeNode(int32_t start, int32_t limit, int32_t unitIndex) {
// length different units at unitIndex
int32_t
StringTrieBuilder::writeBranchSubNode(int32_t start, int32_t limit, int32_t unitIndex, int32_t length) {
- UChar middleUnits[kMaxSplitBranchLevels];
+ char16_t middleUnits[kMaxSplitBranchLevels];
int32_t lessThan[kMaxSplitBranchLevels];
int32_t ltLength=0;
while(length>getMaxBranchLinearSubNodeLength()) {
@@ -154,7 +154,7 @@ StringTrieBuilder::writeBranchSubNode(int32_t start, int32_t limit, int32_t unit
int32_t unitNumber=0;
do {
int32_t i=starts[unitNumber]=start;
- UChar unit=getElementUnit(i++, unitIndex);
+ char16_t unit=getElementUnit(i++, unitIndex);
i=indexOfElementWithNextUnit(i, unitIndex, unit);
isFinal[unitNumber]= start==i-1 && unitIndex+1==getElementStringLength(start);
start=i;
@@ -207,7 +207,7 @@ StringTrieBuilder::writeBranchSubNode(int32_t start, int32_t limit, int32_t unit
StringTrieBuilder::Node *
StringTrieBuilder::makeNode(int32_t start, int32_t limit, int32_t unitIndex, UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
- return NULL;
+ return nullptr;
}
UBool hasValue=false;
int32_t value=0;
@@ -244,7 +244,7 @@ StringTrieBuilder::makeNode(int32_t start, int32_t limit, int32_t unitIndex, UEr
Node *subNode=makeBranchSubNode(start, limit, unitIndex, length, errorCode);
node=new BranchHeadNode(length, subNode);
}
- if(hasValue && node!=NULL) {
+ if(hasValue && node!=nullptr) {
if(matchNodesCanHaveValues()) {
((ValueNode *)node)->setValue(value);
} else {
@@ -260,9 +260,9 @@ StringTrieBuilder::Node *
StringTrieBuilder::makeBranchSubNode(int32_t start, int32_t limit, int32_t unitIndex,
int32_t length, UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
- return NULL;
+ return nullptr;
}
- UChar middleUnits[kMaxSplitBranchLevels];
+ char16_t middleUnits[kMaxSplitBranchLevels];
Node *lessThan[kMaxSplitBranchLevels];
int32_t ltLength=0;
while(length>getMaxBranchLinearSubNodeLength()) {
@@ -278,18 +278,18 @@ StringTrieBuilder::makeBranchSubNode(int32_t start, int32_t limit, int32_t unitI
length=length-length/2;
}
if(U_FAILURE(errorCode)) {
- return NULL;
+ return nullptr;
}
ListBranchNode *listNode=new ListBranchNode();
- if(listNode==NULL) {
+ if(listNode==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
// For each unit, find its elements array start and whether it has a final value.
int32_t unitNumber=0;
do {
int32_t i=start;
- UChar unit=getElementUnit(i++, unitIndex);
+ char16_t unit=getElementUnit(i++, unitIndex);
i=indexOfElementWithNextUnit(i, unitIndex, unit);
if(start==i-1 && unitIndex+1==getElementStringLength(start)) {
listNode->add(unit, getElementValue(start));
@@ -299,7 +299,7 @@ StringTrieBuilder::makeBranchSubNode(int32_t start, int32_t limit, int32_t unitI
start=i;
} while(++unitNumber<length-1);
// unitNumber==length-1, and the maxUnit elements range is [start..limit[
- UChar unit=getElementUnit(start, unitIndex);
+ char16_t unit=getElementUnit(start, unitIndex);
if(start==limit-1 && unitIndex+1==getElementStringLength(start)) {
listNode->add(unit, getElementValue(start));
} else {
@@ -319,14 +319,14 @@ StringTrieBuilder::Node *
StringTrieBuilder::registerNode(Node *newNode, UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
delete newNode;
- return NULL;
+ return nullptr;
}
- if(newNode==NULL) {
+ if(newNode==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
const UHashElement *old=uhash_find(nodes, newNode);
- if(old!=NULL) {
+ if(old!=nullptr) {
delete newNode;
return (Node *)old->key.pointer;
}
@@ -339,7 +339,7 @@ StringTrieBuilder::registerNode(Node *newNode, UErrorCode &errorCode) {
U_ASSERT(oldValue==0);
if(U_FAILURE(errorCode)) {
delete newNode;
- return NULL;
+ return nullptr;
}
return newNode;
}
@@ -347,17 +347,17 @@ StringTrieBuilder::registerNode(Node *newNode, UErrorCode &errorCode) {
StringTrieBuilder::Node *
StringTrieBuilder::registerFinalValue(int32_t value, UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
- return NULL;
+ return nullptr;
}
FinalValueNode key(value);
const UHashElement *old=uhash_find(nodes, &key);
- if(old!=NULL) {
+ if(old!=nullptr) {
return (Node *)old->key.pointer;
}
Node *newNode=new FinalValueNode(value);
- if(newNode==NULL) {
+ if(newNode==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
// If uhash_puti() returns a non-zero value from an equivalent, previously
// registered node, then uhash_find() failed to find that and we will leak newNode.
@@ -368,7 +368,7 @@ StringTrieBuilder::registerFinalValue(int32_t value, UErrorCode &errorCode) {
U_ASSERT(oldValue==0);
if(U_FAILURE(errorCode)) {
delete newNode;
- return NULL;
+ return nullptr;
}
return newNode;
}
@@ -404,7 +404,7 @@ StringTrieBuilder::FinalValueNode::operator==(const Node &other) const {
if(!Node::operator==(other)) {
return false;
}
- const FinalValueNode &o=(const FinalValueNode &)other;
+ const FinalValueNode &o=static_cast<const FinalValueNode &>(other);
return value==o.value;
}
@@ -421,7 +421,7 @@ StringTrieBuilder::ValueNode::operator==(const Node &other) const {
if(!Node::operator==(other)) {
return false;
}
- const ValueNode &o=(const ValueNode &)other;
+ const ValueNode &o=static_cast<const ValueNode &>(other);
return hasValue==o.hasValue && (!hasValue || value==o.value);
}
@@ -433,7 +433,7 @@ StringTrieBuilder::IntermediateValueNode::operator==(const Node &other) const {
if(!ValueNode::operator==(other)) {
return false;
}
- const IntermediateValueNode &o=(const IntermediateValueNode &)other;
+ const IntermediateValueNode &o=static_cast<const IntermediateValueNode &>(other);
return next==o.next;
}
@@ -459,7 +459,7 @@ StringTrieBuilder::LinearMatchNode::operator==(const Node &other) const {
if(!ValueNode::operator==(other)) {
return false;
}
- const LinearMatchNode &o=(const LinearMatchNode &)other;
+ const LinearMatchNode &o=static_cast<const LinearMatchNode &>(other);
return length==o.length && next==o.next;
}
@@ -479,7 +479,7 @@ StringTrieBuilder::ListBranchNode::operator==(const Node &other) const {
if(!Node::operator==(other)) {
return false;
}
- const ListBranchNode &o=(const ListBranchNode &)other;
+ const ListBranchNode &o=static_cast<const ListBranchNode &>(other);
for(int32_t i=0; i<length; ++i) {
if(units[i]!=o.units[i] || values[i]!=o.values[i] || equal[i]!=o.equal[i]) {
return false;
@@ -496,7 +496,7 @@ StringTrieBuilder::ListBranchNode::markRightEdgesFirst(int32_t edgeNumber) {
int32_t i=length;
do {
Node *edge=equal[--i];
- if(edge!=NULL) {
+ if(edge!=nullptr) {
edgeNumber=edge->markRightEdgesFirst(edgeNumber-step);
}
// For all but the rightmost edge, decrement the edge number.
@@ -515,17 +515,17 @@ StringTrieBuilder::ListBranchNode::write(StringTrieBuilder &builder) {
// Instead we write the minUnit sub-node last, for a shorter delta.
int32_t unitNumber=length-1;
Node *rightEdge=equal[unitNumber];
- int32_t rightEdgeNumber= rightEdge==NULL ? firstEdgeNumber : rightEdge->getOffset();
+ int32_t rightEdgeNumber= rightEdge==nullptr ? firstEdgeNumber : rightEdge->getOffset();
do {
--unitNumber;
- if(equal[unitNumber]!=NULL) {
+ if(equal[unitNumber]!=nullptr) {
equal[unitNumber]->writeUnlessInsideRightEdge(firstEdgeNumber, rightEdgeNumber, builder);
}
} while(unitNumber>0);
// The maxUnit sub-node is written as the very last one because we do
// not jump for it at all.
unitNumber=length-1;
- if(rightEdge==NULL) {
+ if(rightEdge==nullptr) {
builder.writeValueAndFinal(values[unitNumber], true);
} else {
rightEdge->write(builder);
@@ -535,7 +535,7 @@ StringTrieBuilder::ListBranchNode::write(StringTrieBuilder &builder) {
while(--unitNumber>=0) {
int32_t value;
UBool isFinal;
- if(equal[unitNumber]==NULL) {
+ if(equal[unitNumber]==nullptr) {
// Write the final value for the one string ending with this unit.
value=values[unitNumber];
isFinal=true;
@@ -558,7 +558,7 @@ StringTrieBuilder::SplitBranchNode::operator==(const Node &other) const {
if(!Node::operator==(other)) {
return false;
}
- const SplitBranchNode &o=(const SplitBranchNode &)other;
+ const SplitBranchNode &o=static_cast<const SplitBranchNode &>(other);
return unit==o.unit && lessThan==o.lessThan && greaterOrEqual==o.greaterOrEqual;
}
@@ -592,7 +592,7 @@ StringTrieBuilder::BranchHeadNode::operator==(const Node &other) const {
if(!ValueNode::operator==(other)) {
return false;
}
- const BranchHeadNode &o=(const BranchHeadNode &)other;
+ const BranchHeadNode &o=static_cast<const BranchHeadNode &>(other);
return length==o.length && next==o.next;
}
diff --git a/thirdparty/icu4c/common/uarrsort.cpp b/thirdparty/icu4c/common/uarrsort.cpp
index 17b6964ffe..f9daa4b30f 100644
--- a/thirdparty/icu4c/common/uarrsort.cpp
+++ b/thirdparty/icu4c/common/uarrsort.cpp
@@ -256,10 +256,10 @@ U_CAPI void U_EXPORT2
uprv_sortArray(void *array, int32_t length, int32_t itemSize,
UComparator *cmp, const void *context,
UBool sortStable, UErrorCode *pErrorCode) {
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return;
}
- if((length>0 && array==NULL) || length<0 || itemSize<=0 || cmp==NULL) {
+ if((length>0 && array==nullptr) || length<0 || itemSize<=0 || cmp==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
diff --git a/thirdparty/icu4c/common/ubidi.cpp b/thirdparty/icu4c/common/ubidi.cpp
index eb40a212e1..fcf82fa97a 100644
--- a/thirdparty/icu4c/common/ubidi.cpp
+++ b/thirdparty/icu4c/common/ubidi.cpp
@@ -34,14 +34,14 @@
* rules of the BiDi algorithm, in this example to the second rule of the
* resolution of weak types.
*
- * For handling surrogate pairs, where two UChar's form one "abstract" (or UTF-32)
- * character according to UTF-16, the second UChar gets the directional property of
+ * For handling surrogate pairs, where two char16_t's form one "abstract" (or UTF-32)
+ * character according to UTF-16, the second char16_t gets the directional property of
* the entire character assigned, while the first one gets a BN, a boundary
* neutral, type, which is ignored by most of the algorithm according to
* rule (X9) and the implementation suggestions of the BiDi algorithm.
*
* Later, adjustWSLevels() will set the level for each BN to that of the
- * following character (UChar), which results in surrogate pairs getting the
+ * following character (char16_t), which results in surrogate pairs getting the
* same level on each of their surrogates.
*
* In a UTF-8 implementation, the same thing could be done: the last byte of
@@ -124,7 +124,7 @@ static const Flags flagO[2]={ DIRPROP_FLAG(LRO), DIRPROP_FLAG(RLO) };
/* UBiDi object management -------------------------------------------------- */
U_CAPI UBiDi * U_EXPORT2
-ubidi_open(void)
+ubidi_open()
{
UErrorCode errorCode=U_ZERO_ERROR;
return ubidi_openSized(0, 0, &errorCode);
@@ -135,21 +135,21 @@ ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode)
UBiDi *pBiDi;
/* check the argument values */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return NULL;
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
+ return nullptr;
} else if(maxLength<0 || maxRunCount<0) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL; /* invalid arguments */
+ return nullptr; /* invalid arguments */
}
/* allocate memory for the object */
pBiDi=(UBiDi *)uprv_malloc(sizeof(UBiDi));
- if(pBiDi==NULL) {
+ if(pBiDi==nullptr) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
- /* reset the object, all pointers NULL, all flags false, all sizes 0 */
+ /* reset the object, all pointers nullptr, all flags false, all sizes 0 */
uprv_memset(pBiDi, 0, sizeof(UBiDi));
/* allocate memory for arrays as requested */
@@ -178,18 +178,18 @@ ubidi_openSized(int32_t maxLength, int32_t maxRunCount, UErrorCode *pErrorCode)
return pBiDi;
} else {
ubidi_close(pBiDi);
- return NULL;
+ return nullptr;
}
}
/*
- * We are allowed to allocate memory if memory==NULL or
+ * We are allowed to allocate memory if memory==nullptr or
* mayAllocate==true for each array that we need.
* We also try to grow memory as needed if we
* allocate it.
*
* Assume sizeNeeded>0.
- * If *pMemory!=NULL, then assume *pSize>0.
+ * If *pMemory!=nullptr, then assume *pSize>0.
*
* ### this realloc() may unnecessarily copy the old data,
* which we know we don't need any more;
@@ -199,9 +199,9 @@ U_CFUNC UBool
ubidi_getMemory(BidiMemoryForAllocation *bidiMem, int32_t *pSize, UBool mayAllocate, int32_t sizeNeeded) {
void **pMemory = (void **)bidiMem;
/* check for existing memory */
- if(*pMemory==NULL) {
+ if(*pMemory==nullptr) {
/* we need to allocate memory */
- if(mayAllocate && (*pMemory=uprv_malloc(sizeNeeded))!=NULL) {
+ if(mayAllocate && (*pMemory=uprv_malloc(sizeNeeded))!=nullptr) {
*pSize=sizeNeeded;
return true;
} else {
@@ -222,7 +222,7 @@ ubidi_getMemory(BidiMemoryForAllocation *bidiMem, int32_t *pSize, UBool mayAlloc
* realloc, but it is needed when adding runs using getRunsMemory()
* in setParaRunsOnly()
*/
- if((memory=uprv_realloc(*pMemory, sizeNeeded))!=NULL) {
+ if((memory=uprv_realloc(*pMemory, sizeNeeded))!=nullptr) {
*pMemory=memory;
*pSize=sizeNeeded;
return true;
@@ -236,27 +236,27 @@ ubidi_getMemory(BidiMemoryForAllocation *bidiMem, int32_t *pSize, UBool mayAlloc
U_CAPI void U_EXPORT2
ubidi_close(UBiDi *pBiDi) {
- if(pBiDi!=NULL) {
- pBiDi->pParaBiDi=NULL; /* in case one tries to reuse this block */
- if(pBiDi->dirPropsMemory!=NULL) {
+ if(pBiDi!=nullptr) {
+ pBiDi->pParaBiDi=nullptr; /* in case one tries to reuse this block */
+ if(pBiDi->dirPropsMemory!=nullptr) {
uprv_free(pBiDi->dirPropsMemory);
}
- if(pBiDi->levelsMemory!=NULL) {
+ if(pBiDi->levelsMemory!=nullptr) {
uprv_free(pBiDi->levelsMemory);
}
- if(pBiDi->openingsMemory!=NULL) {
+ if(pBiDi->openingsMemory!=nullptr) {
uprv_free(pBiDi->openingsMemory);
}
- if(pBiDi->parasMemory!=NULL) {
+ if(pBiDi->parasMemory!=nullptr) {
uprv_free(pBiDi->parasMemory);
}
- if(pBiDi->runsMemory!=NULL) {
+ if(pBiDi->runsMemory!=nullptr) {
uprv_free(pBiDi->runsMemory);
}
- if(pBiDi->isolatesMemory!=NULL) {
+ if(pBiDi->isolatesMemory!=nullptr) {
uprv_free(pBiDi->isolatesMemory);
}
- if(pBiDi->insertPoints.points!=NULL) {
+ if(pBiDi->insertPoints.points!=nullptr) {
uprv_free(pBiDi->insertPoints.points);
}
@@ -268,7 +268,7 @@ ubidi_close(UBiDi *pBiDi) {
U_CAPI void U_EXPORT2
ubidi_setInverse(UBiDi *pBiDi, UBool isInverse) {
- if(pBiDi!=NULL) {
+ if(pBiDi!=nullptr) {
pBiDi->isInverse=isInverse;
pBiDi->reorderingMode = isInverse ? UBIDI_REORDER_INVERSE_NUMBERS_AS_L
: UBIDI_REORDER_DEFAULT;
@@ -277,7 +277,7 @@ ubidi_setInverse(UBiDi *pBiDi, UBool isInverse) {
U_CAPI UBool U_EXPORT2
ubidi_isInverse(UBiDi *pBiDi) {
- if(pBiDi!=NULL) {
+ if(pBiDi!=nullptr) {
return pBiDi->isInverse;
} else {
return false;
@@ -300,8 +300,8 @@ ubidi_isInverse(UBiDi *pBiDi) {
* fallbacks for unsupported combinations.
*/
U_CAPI void U_EXPORT2
-ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode) {
- if ((pBiDi!=NULL) && (reorderingMode >= UBIDI_REORDER_DEFAULT)
+ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode) UPRV_NO_SANITIZE_UNDEFINED {
+ if ((pBiDi!=nullptr) && (reorderingMode >= UBIDI_REORDER_DEFAULT)
&& (reorderingMode < UBIDI_REORDER_COUNT)) {
pBiDi->reorderingMode = reorderingMode;
pBiDi->isInverse = (UBool)(reorderingMode == UBIDI_REORDER_INVERSE_NUMBERS_AS_L);
@@ -310,7 +310,7 @@ ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode) {
U_CAPI UBiDiReorderingMode U_EXPORT2
ubidi_getReorderingMode(UBiDi *pBiDi) {
- if (pBiDi!=NULL) {
+ if (pBiDi!=nullptr) {
return pBiDi->reorderingMode;
} else {
return UBIDI_REORDER_DEFAULT;
@@ -322,14 +322,14 @@ ubidi_setReorderingOptions(UBiDi *pBiDi, uint32_t reorderingOptions) {
if (reorderingOptions & UBIDI_OPTION_REMOVE_CONTROLS) {
reorderingOptions&=~UBIDI_OPTION_INSERT_MARKS;
}
- if (pBiDi!=NULL) {
+ if (pBiDi!=nullptr) {
pBiDi->reorderingOptions=reorderingOptions;
}
}
U_CAPI uint32_t U_EXPORT2
ubidi_getReorderingOptions(UBiDi *pBiDi) {
- if (pBiDi!=NULL) {
+ if (pBiDi!=nullptr) {
return pBiDi->reorderingOptions;
} else {
return 0;
@@ -337,14 +337,14 @@ ubidi_getReorderingOptions(UBiDi *pBiDi) {
}
U_CAPI UBiDiDirection U_EXPORT2
-ubidi_getBaseDirection(const UChar *text,
+ubidi_getBaseDirection(const char16_t *text,
int32_t length){
int32_t i;
UChar32 uchar;
UCharDirection dir;
- if( text==NULL || length<-1 ){
+ if( text==nullptr || length<-1 ){
return UBIDI_NEUTRAL;
}
@@ -373,7 +373,7 @@ int32_t length){
*/
static DirProp
firstL_R_AL(UBiDi *pBiDi) {
- const UChar *text=pBiDi->prologue;
+ const char16_t *text=pBiDi->prologue;
int32_t length=pBiDi->proLength;
int32_t i;
UChar32 uchar;
@@ -426,7 +426,7 @@ checkParaCount(UBiDi *pBiDi) {
*/
static UBool
getDirProps(UBiDi *pBiDi) {
- const UChar *text=pBiDi->text;
+ const char16_t *text=pBiDi->text;
DirProp *dirProps=pBiDi->dirPropsMemory; /* pBiDi->dirProps is const */
int32_t i=0, originalLength=pBiDi->originalLength;
@@ -744,7 +744,7 @@ bracketProcessPDI(BracketData *bd) {
/* newly found opening bracket: create an openings entry */
static UBool /* return true if success */
-bracketAddOpening(BracketData *bd, UChar match, int32_t position) {
+bracketAddOpening(BracketData *bd, char16_t match, int32_t position) {
IsoRun *pLastIsoRun=&bd->isoRuns[bd->isoRunLast];
Opening *pOpening;
if(pLastIsoRun->limit>=bd->openingsCount) { /* no available new entry */
@@ -881,7 +881,7 @@ bracketProcessChar(BracketData *bd, int32_t position) {
dirProps=bd->pBiDi->dirProps;
dirProp=dirProps[position];
if(dirProp==ON) {
- UChar c, match;
+ char16_t c, match;
int32_t idx;
/* First see if it is a matching closing bracket. Hopefully, this is
more efficient than checking if it is a closing bracket at all */
@@ -918,7 +918,7 @@ bracketProcessChar(BracketData *bd, int32_t position) {
bracket or it is a case of N0d */
/* Now see if it is an opening bracket */
if(c)
- match= static_cast<UChar>(u_getBidiPairedBracket(c)); /* get the matching char */
+ match= static_cast<char16_t>(u_getBidiPairedBracket(c)); /* get the matching char */
else
match=0;
if(match!=c && /* has a matching char */
@@ -1072,7 +1072,7 @@ static UBiDiDirection
resolveExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) {
DirProp *dirProps=pBiDi->dirProps;
UBiDiLevel *levels=pBiDi->levels;
- const UChar *text=pBiDi->text;
+ const char16_t *text=pBiDi->text;
int32_t i=0, length=pBiDi->length;
Flags flags=pBiDi->flags; /* collect all directionalities in the text */
@@ -1797,7 +1797,7 @@ addPoint(UBiDi *pBiDi, int32_t pos, int32_t flag)
if (pInsertPoints->capacity == 0)
{
pInsertPoints->points=static_cast<Point *>(uprv_malloc(sizeof(Point)*FIRSTALLOC));
- if (pInsertPoints->points == NULL)
+ if (pInsertPoints->points == nullptr)
{
pInsertPoints->errorCode=U_MEMORY_ALLOCATION_ERROR;
return;
@@ -1809,7 +1809,7 @@ addPoint(UBiDi *pBiDi, int32_t pos, int32_t flag)
Point * savePoints=pInsertPoints->points;
pInsertPoints->points=static_cast<Point *>(uprv_realloc(pInsertPoints->points,
pInsertPoints->capacity*2*sizeof(Point)));
- if (pInsertPoints->points == NULL)
+ if (pInsertPoints->points == nullptr)
{
pInsertPoints->points=savePoints;
pInsertPoints->errorCode=U_MEMORY_ALLOCATION_ERROR;
@@ -2068,7 +2068,7 @@ processPropertySeq(UBiDi *pBiDi, LevState *pLevState, uint8_t _prop,
*/
static DirProp
lastL_R_AL(UBiDi *pBiDi) {
- const UChar *text=pBiDi->prologue;
+ const char16_t *text=pBiDi->prologue;
int32_t length=pBiDi->proLength;
int32_t i;
UChar32 uchar;
@@ -2096,7 +2096,7 @@ lastL_R_AL(UBiDi *pBiDi) {
*/
static DirProp
firstL_R_AL_EN_AN(UBiDi *pBiDi) {
- const UChar *text=pBiDi->epilogue;
+ const char16_t *text=pBiDi->epilogue;
int32_t length=pBiDi->epiLength;
int32_t i;
UChar32 uchar;
@@ -2326,13 +2326,13 @@ adjustWSLevels(UBiDi *pBiDi) {
U_CAPI void U_EXPORT2
ubidi_setContext(UBiDi *pBiDi,
- const UChar *prologue, int32_t proLength,
- const UChar *epilogue, int32_t epiLength,
+ const char16_t *prologue, int32_t proLength,
+ const char16_t *epilogue, int32_t epiLength,
UErrorCode *pErrorCode) {
/* check the argument values */
RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
- if(pBiDi==NULL || proLength<-1 || epiLength<-1 ||
- (prologue==NULL && proLength!=0) || (epilogue==NULL && epiLength!=0)) {
+ if(pBiDi==nullptr || proLength<-1 || epiLength<-1 ||
+ (prologue==nullptr && proLength!=0) || (epilogue==nullptr && epiLength!=0)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -2362,11 +2362,11 @@ setParaSuccess(UBiDi *pBiDi) {
#define BIDI_ABS(x) ((x)>=0 ? (x) : (-(x)))
static void
-setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length,
+setParaRunsOnly(UBiDi *pBiDi, const char16_t *text, int32_t length,
UBiDiLevel paraLevel, UErrorCode *pErrorCode) {
- int32_t *runsOnlyMemory = NULL;
+ int32_t *runsOnlyMemory = nullptr;
int32_t *visualMap;
- UChar *visualText;
+ char16_t *visualText;
int32_t saveLength, saveTrailingWSStart;
const UBiDiLevel *levels;
UBiDiLevel *saveLevels;
@@ -2381,17 +2381,17 @@ setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length,
pBiDi->reorderingMode=UBIDI_REORDER_DEFAULT;
if(length==0) {
- ubidi_setPara(pBiDi, text, length, paraLevel, NULL, pErrorCode);
+ ubidi_setPara(pBiDi, text, length, paraLevel, nullptr, pErrorCode);
goto cleanup3;
}
/* obtain memory for mapping table and visual text */
- runsOnlyMemory=static_cast<int32_t *>(uprv_malloc(length*(sizeof(int32_t)+sizeof(UChar)+sizeof(UBiDiLevel))));
- if(runsOnlyMemory==NULL) {
+ runsOnlyMemory=static_cast<int32_t *>(uprv_malloc(length*(sizeof(int32_t)+sizeof(char16_t)+sizeof(UBiDiLevel))));
+ if(runsOnlyMemory==nullptr) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
goto cleanup3;
}
visualMap=runsOnlyMemory;
- visualText=(UChar *)&visualMap[length];
+ visualText=(char16_t *)&visualMap[length];
saveLevels=(UBiDiLevel *)&visualText[length];
saveOptions=pBiDi->reorderingOptions;
if(saveOptions & UBIDI_OPTION_INSERT_MARKS) {
@@ -2399,7 +2399,7 @@ setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length,
pBiDi->reorderingOptions|=UBIDI_OPTION_REMOVE_CONTROLS;
}
paraLevel&=1; /* accept only 0 or 1 */
- ubidi_setPara(pBiDi, text, length, paraLevel, NULL, pErrorCode);
+ ubidi_setPara(pBiDi, text, length, paraLevel, nullptr, pErrorCode);
if(U_FAILURE(*pErrorCode)) {
goto cleanup3;
}
@@ -2437,7 +2437,7 @@ setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length,
*/
saveMayAllocateText=pBiDi->mayAllocateText;
pBiDi->mayAllocateText=false;
- ubidi_setPara(pBiDi, visualText, visualLength, paraLevel, NULL, pErrorCode);
+ ubidi_setPara(pBiDi, visualText, visualLength, paraLevel, nullptr, pErrorCode);
pBiDi->mayAllocateText=saveMayAllocateText;
ubidi_getRuns(pBiDi, pErrorCode);
if(U_FAILURE(*pErrorCode)) {
@@ -2551,7 +2551,7 @@ setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length,
/* ubidi_setPara ------------------------------------------------------------ */
U_CAPI void U_EXPORT2
-ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
+ubidi_setPara(UBiDi *pBiDi, const char16_t *text, int32_t length,
UBiDiLevel paraLevel, UBiDiLevel *embeddingLevels,
UErrorCode *pErrorCode) {
UBiDiDirection direction;
@@ -2559,7 +2559,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
/* check the argument values */
RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
- if(pBiDi==NULL || text==NULL || length<-1 ||
+ if(pBiDi==nullptr || text==nullptr || length<-1 ||
(paraLevel>UBIDI_MAX_EXPLICIT_LEVEL && paraLevel<UBIDI_DEFAULT_LTR)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
@@ -2576,16 +2576,16 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
}
/* initialize the UBiDi structure */
- pBiDi->pParaBiDi=NULL; /* mark unfinished setPara */
+ pBiDi->pParaBiDi=nullptr; /* mark unfinished setPara */
pBiDi->text=text;
pBiDi->length=pBiDi->originalLength=pBiDi->resultLength=length;
pBiDi->paraLevel=paraLevel;
pBiDi->direction=(UBiDiDirection)(paraLevel&1);
pBiDi->paraCount=1;
- pBiDi->dirProps=NULL;
- pBiDi->levels=NULL;
- pBiDi->runs=NULL;
+ pBiDi->dirProps=nullptr;
+ pBiDi->levels=nullptr;
+ pBiDi->runs=nullptr;
pBiDi->insertPoints.size=0; /* clean up from last call */
pBiDi->insertPoints.confirmed=0; /* clean up from last call */
@@ -2640,7 +2640,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
pBiDi->trailingWSStart=length; /* the levels[] will reflect the WS run */
/* are explicit levels specified? */
- if(embeddingLevels==NULL) {
+ if(embeddingLevels==nullptr) {
/* no: determine explicit levels according to the (Xn) rules */\
if(getLevelsMemory(pBiDi, length)) {
pBiDi->levels=pBiDi->levelsMemory;
@@ -2737,7 +2737,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
* Examples for "insignificant" ones are empty embeddings
* LRE-PDF, LRE-RLE-PDF-PDF, etc.
*/
- if(embeddingLevels==NULL && pBiDi->paraCount<=1 &&
+ if(embeddingLevels==nullptr && pBiDi->paraCount<=1 &&
!(pBiDi->flags&DIRPROP_FLAG_MULTI_RUNS)) {
resolveImplicitLevels(pBiDi, 0, length,
GET_LR_FROM_LEVEL(GET_PARALEVEL(pBiDi, 0)),
@@ -2856,14 +2856,14 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
U_CAPI void U_EXPORT2
ubidi_orderParagraphsLTR(UBiDi *pBiDi, UBool orderParagraphsLTR) {
- if(pBiDi!=NULL) {
+ if(pBiDi!=nullptr) {
pBiDi->orderParagraphsLTR=orderParagraphsLTR;
}
}
U_CAPI UBool U_EXPORT2
ubidi_isOrderParagraphsLTR(UBiDi *pBiDi) {
- if(pBiDi!=NULL) {
+ if(pBiDi!=nullptr) {
return pBiDi->orderParagraphsLTR;
} else {
return false;
@@ -2879,12 +2879,12 @@ ubidi_getDirection(const UBiDi *pBiDi) {
}
}
-U_CAPI const UChar * U_EXPORT2
+U_CAPI const char16_t * U_EXPORT2
ubidi_getText(const UBiDi *pBiDi) {
if(IS_VALID_PARA_OR_LINE(pBiDi)) {
return pBiDi->text;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -2952,13 +2952,13 @@ ubidi_getParagraphByIndex(const UBiDi *pBiDi, int32_t paraIndex,
} else {
paraStart=0;
}
- if(pParaStart!=NULL) {
+ if(pParaStart!=nullptr) {
*pParaStart=paraStart;
}
- if(pParaLimit!=NULL) {
+ if(pParaLimit!=nullptr) {
*pParaLimit=pBiDi->paras[paraIndex].limit;
}
- if(pParaLevel!=NULL) {
+ if(pParaLevel!=nullptr) {
*pParaLevel=GET_PARALEVEL(pBiDi, paraStart);
}
}
@@ -2987,7 +2987,7 @@ ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn,
const void **oldContext, UErrorCode *pErrorCode)
{
RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
- if(pBiDi==NULL) {
+ if(pBiDi==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -3006,7 +3006,7 @@ ubidi_setClassCallback(UBiDi *pBiDi, UBiDiClassCallback *newFn,
U_CAPI void U_EXPORT2
ubidi_getClassCallback(UBiDi *pBiDi, UBiDiClassCallback **fn, const void **context)
{
- if(pBiDi==NULL) {
+ if(pBiDi==nullptr) {
return;
}
if( fn )
@@ -3024,7 +3024,7 @@ ubidi_getCustomizedClass(UBiDi *pBiDi, UChar32 c)
{
UCharDirection dir;
- if( pBiDi->fnClassCallback == NULL ||
+ if( pBiDi->fnClassCallback == nullptr ||
(dir = (*pBiDi->fnClassCallback)(pBiDi->coClassCallback, c)) == U_BIDI_CLASS_DEFAULT )
{
dir = ubidi_getClass(c);
diff --git a/thirdparty/icu4c/common/ubidi_props.cpp b/thirdparty/icu4c/common/ubidi_props.cpp
index 3ba58f7af9..8f3f6a65c4 100644
--- a/thirdparty/icu4c/common/ubidi_props.cpp
+++ b/thirdparty/icu4c/common/ubidi_props.cpp
@@ -69,7 +69,7 @@ ubidi_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
}
/* add the start code point of each same-value range of the trie */
- utrie2_enum(&ubidi_props_singleton.trie, NULL, _enumPropertyStartsRange, sa);
+ utrie2_enum(&ubidi_props_singleton.trie, nullptr, _enumPropertyStartsRange, sa);
/* add the code points from the bidi mirroring table */
length=ubidi_props_singleton.indexes[UBIDI_IX_MIRROR_LENGTH];
diff --git a/thirdparty/icu4c/common/ubidi_props_data.h b/thirdparty/icu4c/common/ubidi_props_data.h
index 01fcc968cb..5dcd1d7c78 100644
--- a/thirdparty/icu4c/common/ubidi_props_data.h
+++ b/thirdparty/icu4c/common/ubidi_props_data.h
@@ -925,7 +925,7 @@ static const uint8_t ubidi_props_jgArray2[612]={
};
static const UBiDiProps ubidi_props_singleton={
- NULL,
+ nullptr,
ubidi_props_indexes,
ubidi_props_mirrors,
ubidi_props_jgArray,
@@ -933,7 +933,7 @@ static const UBiDiProps ubidi_props_singleton={
{
ubidi_props_trieIndex,
ubidi_props_trieIndex+3612,
- NULL,
+ nullptr,
3612,
9412,
0x1a0,
@@ -942,7 +942,7 @@ static const UBiDiProps ubidi_props_singleton={
0x0,
0x110000,
0x32dc,
- NULL, 0, false, false, 0, NULL
+ nullptr, 0, false, false, 0, nullptr
},
{ 2,2,0,0 }
};
diff --git a/thirdparty/icu4c/common/ubidiln.cpp b/thirdparty/icu4c/common/ubidiln.cpp
index 430ece39d2..63c4f9190a 100644
--- a/thirdparty/icu4c/common/ubidiln.cpp
+++ b/thirdparty/icu4c/common/ubidiln.cpp
@@ -37,7 +37,7 @@
* This means that there is a UBiDi object with a levels
* and a dirProps array.
* paraLevel and direction are also set.
- * Only if the length of the text is zero, then levels==dirProps==NULL.
+ * Only if the length of the text is zero, then levels==dirProps==nullptr.
*
* The overall directionality of the paragraph
* or line is used to bypass the reordering steps if possible.
@@ -134,25 +134,25 @@ ubidi_setLine(const UBiDi *pParaBiDi,
RETURN_VOID_IF_NOT_VALID_PARA(pParaBiDi, *pErrorCode);
RETURN_VOID_IF_BAD_RANGE(start, 0, limit, *pErrorCode);
RETURN_VOID_IF_BAD_RANGE(limit, 0, pParaBiDi->length+1, *pErrorCode);
- if(pLineBiDi==NULL) {
+ if(pLineBiDi==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
- if(ubidi_getParagraph(pParaBiDi, start, NULL, NULL, NULL, pErrorCode) !=
- ubidi_getParagraph(pParaBiDi, limit-1, NULL, NULL, NULL, pErrorCode)) {
+ if(ubidi_getParagraph(pParaBiDi, start, nullptr, nullptr, nullptr, pErrorCode) !=
+ ubidi_getParagraph(pParaBiDi, limit-1, nullptr, nullptr, nullptr, pErrorCode)) {
/* the line crosses a paragraph boundary */
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
/* set the values in pLineBiDi from its pParaBiDi parent */
- pLineBiDi->pParaBiDi=NULL; /* mark unfinished setLine */
+ pLineBiDi->pParaBiDi=nullptr; /* mark unfinished setLine */
pLineBiDi->text=pParaBiDi->text+start;
length=pLineBiDi->length=limit-start;
pLineBiDi->resultLength=pLineBiDi->originalLength=length;
pLineBiDi->paraLevel=GET_PARALEVEL(pParaBiDi, start);
pLineBiDi->paraCount=pParaBiDi->paraCount;
- pLineBiDi->runs=NULL;
+ pLineBiDi->runs=nullptr;
pLineBiDi->flags=0;
pLineBiDi->reorderingMode=pParaBiDi->reorderingMode;
pLineBiDi->reorderingOptions=pParaBiDi->reorderingOptions;
@@ -263,11 +263,11 @@ U_CAPI const UBiDiLevel * U_EXPORT2
ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) {
int32_t start, length;
- RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, NULL);
- RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, NULL);
+ RETURN_IF_NULL_OR_FAILING_ERRCODE(pErrorCode, nullptr);
+ RETURN_IF_NOT_VALID_PARA_OR_LINE(pBiDi, *pErrorCode, nullptr);
if((length=pBiDi->length)<=0) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
if((start=pBiDi->trailingWSStart)==length) {
/* the current levels array reflects the WS run */
@@ -297,7 +297,7 @@ ubidi_getLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) {
} else {
/* out of memory */
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
}
@@ -373,10 +373,10 @@ ubidi_getVisualRun(UBiDi *pBiDi, int32_t runIndex,
RETURN_IF_BAD_RANGE(runIndex, 0, pBiDi->runCount, errorCode, UBIDI_LTR);
start=pBiDi->runs[runIndex].logicalStart;
- if(pLogicalStart!=NULL) {
+ if(pLogicalStart!=nullptr) {
*pLogicalStart=GET_INDEX(start);
}
- if(pLength!=NULL) {
+ if(pLength!=nullptr) {
if(runIndex>0) {
*pLength=pBiDi->runs[runIndex].visualLimit-
pBiDi->runs[runIndex-1].visualLimit;
@@ -694,7 +694,7 @@ ubidi_getRuns(UBiDi *pBiDi, UErrorCode*) {
/* handle remove BiDi control characters */
if(pBiDi->controlCount>0) {
int32_t runIndex;
- const UChar *start=pBiDi->text, *limit=start+pBiDi->length, *pu;
+ const char16_t *start=pBiDi->text, *limit=start+pBiDi->length, *pu;
for(pu=start; pu<limit; pu++) {
if(IS_BIDI_CONTROL_CHAR(*pu)) {
runIndex=getRunFromLogicalIndex(pBiDi, (int32_t)(pu-start));
@@ -713,7 +713,7 @@ prepareReorder(const UBiDiLevel *levels, int32_t length,
int32_t start;
UBiDiLevel level, minLevel, maxLevel;
- if(levels==NULL || length<=0) {
+ if(levels==nullptr || length<=0) {
return false;
}
@@ -751,7 +751,7 @@ ubidi_reorderLogical(const UBiDiLevel *levels, int32_t length, int32_t *indexMap
int32_t start, limit, sumOfSosEos;
UBiDiLevel minLevel = 0, maxLevel = 0;
- if(indexMap==NULL || !prepareReorder(levels, length, indexMap, &minLevel, &maxLevel)) {
+ if(indexMap==nullptr || !prepareReorder(levels, length, indexMap, &minLevel, &maxLevel)) {
return;
}
@@ -814,7 +814,7 @@ ubidi_reorderVisual(const UBiDiLevel *levels, int32_t length, int32_t *indexMap)
int32_t start, end, limit, temp;
UBiDiLevel minLevel = 0, maxLevel = 0;
- if(indexMap==NULL || !prepareReorder(levels, length, indexMap, &minLevel, &maxLevel)) {
+ if(indexMap==nullptr || !prepareReorder(levels, length, indexMap, &minLevel, &maxLevel)) {
return;
}
@@ -941,7 +941,7 @@ ubidi_getVisualIndex(UBiDi *pBiDi, int32_t logicalIndex, UErrorCode *pErrorCode)
Run *runs=pBiDi->runs;
int32_t i, j, start, limit, length, insertRemove;
int32_t visualStart=0, controlFound=0;
- UChar uchar=pBiDi->text[logicalIndex];
+ char16_t uchar=pBiDi->text[logicalIndex];
/* is the logical index pointing to a control ? */
if(IS_BIDI_CONTROL_CHAR(uchar)) {
return UBIDI_MAP_NOWHERE;
@@ -1036,7 +1036,7 @@ ubidi_getLogicalIndex(UBiDi *pBiDi, int32_t visualIndex, UErrorCode *pErrorCode)
/* handle removed BiDi control characters */
int32_t controlFound=0, insertRemove, length;
int32_t logicalStart, logicalEnd, visualStart=0, j, k;
- UChar uchar;
+ char16_t uchar;
UBool evenRun;
/* add number of controls until visual index */
for(i=0; ; i++, visualStart+=length) {
@@ -1113,7 +1113,7 @@ ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
ubidi_countRuns(pBiDi, pErrorCode);
if(U_FAILURE(*pErrorCode)) {
/* no op */
- } else if(indexMap==NULL) {
+ } else if(indexMap==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
} else {
/* fill a logical-to-visual index map using the runs[] */
@@ -1171,7 +1171,7 @@ ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
int32_t controlFound=0, runCount=pBiDi->runCount;
int32_t length, insertRemove;
UBool evenRun;
- UChar uchar;
+ char16_t uchar;
visualStart=0;
/* subtract number of controls found until each index */
for(i=0; i<runCount; i++, visualStart+=length) {
@@ -1210,7 +1210,7 @@ ubidi_getLogicalMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
U_CAPI void U_EXPORT2
ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
RETURN_VOID_IF_NULL_OR_FAILING_ERRCODE(pErrorCode);
- if(indexMap==NULL) {
+ if(indexMap==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -1277,7 +1277,7 @@ ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
else if(pBiDi->controlCount>0) {
int32_t runCount=pBiDi->runCount, logicalEnd;
int32_t insertRemove, length, i, j, k, m;
- UChar uchar;
+ char16_t uchar;
UBool evenRun;
runs=pBiDi->runs;
visualStart=0;
@@ -1317,7 +1317,7 @@ ubidi_getVisualMap(UBiDi *pBiDi, int32_t *indexMap, UErrorCode *pErrorCode) {
U_CAPI void U_EXPORT2
ubidi_invertMap(const int32_t *srcMap, int32_t *destMap, int32_t length) {
- if(srcMap!=NULL && destMap!=NULL && length>0) {
+ if(srcMap!=nullptr && destMap!=nullptr && length>0) {
const int32_t *pi;
int32_t destLength=-1, count=0;
/* find highest value and count positive indexes in srcMap */
diff --git a/thirdparty/icu4c/common/ubiditransform.cpp b/thirdparty/icu4c/common/ubiditransform.cpp
index 24fffd9c46..01f5901a2c 100644
--- a/thirdparty/icu4c/common/ubiditransform.cpp
+++ b/thirdparty/icu4c/common/ubiditransform.cpp
@@ -78,8 +78,8 @@ typedef struct {
struct UBiDiTransform {
UBiDi *pBidi; /* pointer to a UBiDi object */
const ReorderingScheme *pActiveScheme; /* effective reordering scheme */
- UChar *src; /* input text */
- UChar *dest; /* output text */
+ char16_t *src; /* input text */
+ char16_t *dest; /* output text */
uint32_t srcLength; /* input text length - not really needed as we are zero-terminated and can u_strlen */
uint32_t srcSize; /* input text capacity excluding the trailing zero */
uint32_t destSize; /* output text capacity */
@@ -92,10 +92,10 @@ struct UBiDiTransform {
U_CAPI UBiDiTransform* U_EXPORT2
ubiditransform_open(UErrorCode *pErrorCode)
{
- UBiDiTransform *pBiDiTransform = NULL;
+ UBiDiTransform *pBiDiTransform = nullptr;
if (U_SUCCESS(*pErrorCode)) {
pBiDiTransform = (UBiDiTransform*) uprv_calloc(1, sizeof(UBiDiTransform));
- if (pBiDiTransform == NULL) {
+ if (pBiDiTransform == nullptr) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
}
}
@@ -105,11 +105,11 @@ ubiditransform_open(UErrorCode *pErrorCode)
U_CAPI void U_EXPORT2
ubiditransform_close(UBiDiTransform *pBiDiTransform)
{
- if (pBiDiTransform != NULL) {
- if (pBiDiTransform->pBidi != NULL) {
+ if (pBiDiTransform != nullptr) {
+ if (pBiDiTransform->pBidi != nullptr) {
ubidi_close(pBiDiTransform->pBidi);
}
- if (pBiDiTransform->src != NULL) {
+ if (pBiDiTransform->src != nullptr) {
uprv_free(pBiDiTransform->src);
}
uprv_free(pBiDiTransform);
@@ -129,7 +129,7 @@ static UBool
action_resolve(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
{
ubidi_setPara(pTransform->pBidi, pTransform->src, pTransform->srcLength,
- pTransform->pActiveScheme->baseLevel, NULL, pErrorCode);
+ pTransform->pActiveScheme->baseLevel, nullptr, pErrorCode);
return false;
}
@@ -215,12 +215,12 @@ action_reverse(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
*
* @param pTransform A pointer to the <code>UBiDiTransform</code> structure.
* @param newSrc A pointer whose value is to be used as input text.
- * @param newLength A length of the new text in <code>UChar</code>s.
- * @param newSize A new source capacity in <code>UChar</code>s.
+ * @param newLength A length of the new text in <code>char16_t</code>s.
+ * @param newSize A new source capacity in <code>char16_t</code>s.
* @param pErrorCode Pointer to the error code value.
*/
static void
-updateSrc(UBiDiTransform *pTransform, const UChar *newSrc, uint32_t newLength,
+updateSrc(UBiDiTransform *pTransform, const char16_t *newSrc, uint32_t newLength,
uint32_t newSize, UErrorCode *pErrorCode)
{
if (newSize < newLength) {
@@ -229,12 +229,12 @@ updateSrc(UBiDiTransform *pTransform, const UChar *newSrc, uint32_t newLength,
}
if (newSize > pTransform->srcSize) {
newSize += 50; // allocate slightly more than needed right now
- if (pTransform->src != NULL) {
+ if (pTransform->src != nullptr) {
uprv_free(pTransform->src);
- pTransform->src = NULL;
+ pTransform->src = nullptr;
}
- pTransform->src = (UChar *)uprv_malloc(newSize * sizeof(UChar));
- if (pTransform->src == NULL) {
+ pTransform->src = (char16_t *)uprv_malloc(newSize * sizeof(char16_t));
+ if (pTransform->src == nullptr) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
//pTransform->srcLength = pTransform->srcSize = 0;
return;
@@ -331,52 +331,52 @@ static const ReorderingScheme Schemes[] =
{
/* 0: Logical LTR => Visual LTR */
{LTR, LOGICAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
- {action_shapeArabic, action_resolve, action_reorder, NULL}},
+ {action_shapeArabic, action_resolve, action_reorder, nullptr}},
/* 1: Logical RTL => Visual LTR */
{RTL, LOGICAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL,
- {action_resolve, action_reorder, action_shapeArabic, NULL}},
+ {action_resolve, action_reorder, action_shapeArabic, nullptr}},
/* 2: Logical LTR => Visual RTL */
{LTR, LOGICAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
- {action_shapeArabic, action_resolve, action_reorder, action_reverse, NULL}},
+ {action_shapeArabic, action_resolve, action_reorder, action_reverse, nullptr}},
/* 3: Logical RTL => Visual RTL */
{RTL, LOGICAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL,
- {action_resolve, action_reorder, action_shapeArabic, action_reverse, NULL}},
+ {action_resolve, action_reorder, action_shapeArabic, action_reverse, nullptr}},
/* 4: Visual LTR => Logical RTL */
{LTR, VISUAL, RTL, LOGICAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL,
- {action_shapeArabic, action_setInverse, action_resolve, action_reorder, NULL}},
+ {action_shapeArabic, action_setInverse, action_resolve, action_reorder, nullptr}},
/* 5: Visual RTL => Logical RTL */
{RTL, VISUAL, RTL, LOGICAL, SHAPE_LOGICAL, SHAPE_VISUAL, RTL,
- {action_reverse, action_shapeArabic, action_setInverse, action_resolve, action_reorder, NULL}},
+ {action_reverse, action_shapeArabic, action_setInverse, action_resolve, action_reorder, nullptr}},
/* 6: Visual LTR => Logical LTR */
{LTR, VISUAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
- {action_setInverse, action_resolve, action_reorder, action_shapeArabic, NULL}},
+ {action_setInverse, action_resolve, action_reorder, action_shapeArabic, nullptr}},
/* 7: Visual RTL => Logical LTR */
{RTL, VISUAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
- {action_reverse, action_setInverse, action_resolve, action_reorder, action_shapeArabic, NULL}},
+ {action_reverse, action_setInverse, action_resolve, action_reorder, action_shapeArabic, nullptr}},
/* 8: Logical LTR => Logical RTL */
{LTR, LOGICAL, RTL, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
- {action_shapeArabic, action_resolve, action_mirror, action_setRunsOnly, action_resolve, action_reorder, NULL}},
+ {action_shapeArabic, action_resolve, action_mirror, action_setRunsOnly, action_resolve, action_reorder, nullptr}},
/* 9: Logical RTL => Logical LTR */
{RTL, LOGICAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, RTL,
- {action_resolve, action_mirror, action_setRunsOnly, action_resolve, action_reorder, action_shapeArabic, NULL}},
+ {action_resolve, action_mirror, action_setRunsOnly, action_resolve, action_reorder, action_shapeArabic, nullptr}},
/* 10: Visual LTR => Visual RTL */
{LTR, VISUAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR,
- {action_shapeArabic, action_setInverse, action_resolve, action_mirror, action_reverse, NULL}},
+ {action_shapeArabic, action_setInverse, action_resolve, action_mirror, action_reverse, nullptr}},
/* 11: Visual RTL => Visual LTR */
{RTL, VISUAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR,
- {action_reverse, action_shapeArabic, action_setInverse, action_resolve, action_mirror, NULL}},
+ {action_reverse, action_shapeArabic, action_setInverse, action_resolve, action_mirror, nullptr}},
/* 12: Logical LTR => Logical LTR */
{LTR, LOGICAL, LTR, LOGICAL, SHAPE_LOGICAL, SHAPE_LOGICAL, LTR,
- {action_resolve, action_mirror, action_shapeArabic, NULL}},
+ {action_resolve, action_mirror, action_shapeArabic, nullptr}},
/* 13: Logical RTL => Logical RTL */
{RTL, LOGICAL, RTL, LOGICAL, SHAPE_VISUAL, SHAPE_LOGICAL, RTL,
- {action_resolve, action_mirror, action_shapeArabic, NULL}},
+ {action_resolve, action_mirror, action_shapeArabic, nullptr}},
/* 14: Visual LTR => Visual LTR */
{LTR, VISUAL, LTR, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR,
- {action_resolve, action_mirror, action_shapeArabic, NULL}},
+ {action_resolve, action_mirror, action_shapeArabic, nullptr}},
/* 15: Visual RTL => Visual RTL */
{RTL, VISUAL, RTL, VISUAL, SHAPE_LOGICAL, SHAPE_VISUAL, LTR,
- {action_reverse, action_resolve, action_mirror, action_shapeArabic, action_reverse, NULL}}
+ {action_reverse, action_resolve, action_mirror, action_shapeArabic, action_reverse, nullptr}}
};
static const uint32_t nSchemes = sizeof(Schemes) / sizeof(*Schemes);
@@ -387,7 +387,7 @@ static const uint32_t nSchemes = sizeof(Schemes) / sizeof(*Schemes);
* of the first strong bidi character.
*/
static void
-resolveBaseDirection(const UChar *text, uint32_t length,
+resolveBaseDirection(const char16_t *text, uint32_t length,
UBiDiLevel *pInLevel, UBiDiLevel *pOutLevel)
{
switch (*pInLevel) {
@@ -417,7 +417,7 @@ resolveBaseDirection(const UChar *text, uint32_t length,
* Finds a valid <code>ReorderingScheme</code> matching the
* caller-defined scheme.
*
- * @return A valid <code>ReorderingScheme</code> object or NULL
+ * @return A valid <code>ReorderingScheme</code> object or nullptr
*/
static const ReorderingScheme*
findMatchingScheme(UBiDiLevel inLevel, UBiDiLevel outLevel,
@@ -431,13 +431,13 @@ findMatchingScheme(UBiDiLevel inLevel, UBiDiLevel outLevel,
return pScheme;
}
}
- return NULL;
+ return nullptr;
}
U_CAPI uint32_t U_EXPORT2
ubiditransform_transform(UBiDiTransform *pBiDiTransform,
- const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destSize,
+ const char16_t *src, int32_t srcLength,
+ char16_t *dest, int32_t destSize,
UBiDiLevel inParaLevel, UBiDiOrder inOrder,
UBiDiLevel outParaLevel, UBiDiOrder outOrder,
UBiDiMirroring doMirroring, uint32_t shapingOptions,
@@ -446,19 +446,19 @@ ubiditransform_transform(UBiDiTransform *pBiDiTransform,
uint32_t destLength = 0;
UBool textChanged = false;
const UBiDiTransform *pOrigTransform = pBiDiTransform;
- const UBiDiAction *action = NULL;
+ const UBiDiAction *action = nullptr;
if (U_FAILURE(*pErrorCode)) {
return 0;
}
- if (src == NULL || dest == NULL) {
+ if (src == nullptr || dest == nullptr) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
CHECK_LEN(src, srcLength, pErrorCode);
CHECK_LEN(dest, destSize, pErrorCode);
- if (pBiDiTransform == NULL) {
+ if (pBiDiTransform == nullptr) {
pBiDiTransform = ubiditransform_open(pErrorCode);
if (U_FAILURE(*pErrorCode)) {
return 0;
@@ -470,7 +470,7 @@ ubiditransform_transform(UBiDiTransform *pBiDiTransform,
pBiDiTransform->pActiveScheme = findMatchingScheme(inParaLevel, outParaLevel,
inOrder, outOrder);
- if (pBiDiTransform->pActiveScheme == NULL) {
+ if (pBiDiTransform->pActiveScheme == nullptr) {
goto cleanup;
}
pBiDiTransform->reorderingOptions = doMirroring ? UBIDI_DO_MIRRORING
@@ -486,7 +486,7 @@ ubiditransform_transform(UBiDiTransform *pBiDiTransform,
if (U_FAILURE(*pErrorCode)) {
goto cleanup;
}
- if (pBiDiTransform->pBidi == NULL) {
+ if (pBiDiTransform->pBidi == nullptr) {
pBiDiTransform->pBidi = ubidi_openSized(0, 0, pErrorCode);
if (U_FAILURE(*pErrorCode)) {
goto cleanup;
@@ -521,8 +521,8 @@ cleanup:
if (pOrigTransform != pBiDiTransform) {
ubiditransform_close(pBiDiTransform);
} else {
- pBiDiTransform->dest = NULL;
- pBiDiTransform->pDestLength = NULL;
+ pBiDiTransform->dest = nullptr;
+ pBiDiTransform->pDestLength = nullptr;
pBiDiTransform->srcLength = 0;
pBiDiTransform->destSize = 0;
}
diff --git a/thirdparty/icu4c/common/ubidiwrt.cpp b/thirdparty/icu4c/common/ubidiwrt.cpp
index a69c0a4b8b..969807c243 100644
--- a/thirdparty/icu4c/common/ubidiwrt.cpp
+++ b/thirdparty/icu4c/common/ubidiwrt.cpp
@@ -56,8 +56,8 @@
* we are writing RTL output in reverse.
*/
static int32_t
-doWriteForward(const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destSize,
+doWriteForward(const char16_t *src, int32_t srcLength,
+ char16_t *dest, int32_t destSize,
uint16_t options,
UErrorCode *pErrorCode) {
/* optimize for several combinations of options */
@@ -93,7 +93,7 @@ doWriteForward(const UChar *src, int32_t srcLength,
case UBIDI_REMOVE_BIDI_CONTROLS: {
/* copy the LTR run and remove any BiDi control characters */
int32_t remaining=destSize;
- UChar c;
+ char16_t c;
do {
c=*src++;
if(!IS_BIDI_CONTROL_CHAR(c)) {
@@ -149,8 +149,8 @@ doWriteForward(const UChar *src, int32_t srcLength,
}
static int32_t
-doWriteReverse(const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destSize,
+doWriteReverse(const char16_t *src, int32_t srcLength,
+ char16_t *dest, int32_t destSize,
uint16_t options,
UErrorCode *pErrorCode) {
/*
@@ -248,7 +248,7 @@ doWriteReverse(const UChar *src, int32_t srcLength,
/* we need to find out the destination length of the run,
which will not include the BiDi control characters */
int32_t length=srcLength;
- UChar ch;
+ char16_t ch;
i=0;
do {
@@ -306,26 +306,26 @@ doWriteReverse(const UChar *src, int32_t srcLength,
}
U_CAPI int32_t U_EXPORT2
-ubidi_writeReverse(const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destSize,
+ubidi_writeReverse(const char16_t *src, int32_t srcLength,
+ char16_t *dest, int32_t destSize,
uint16_t options,
UErrorCode *pErrorCode) {
int32_t destLength;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
/* more error checking */
- if( src==NULL || srcLength<-1 ||
- destSize<0 || (destSize>0 && dest==NULL))
+ if( src==nullptr || srcLength<-1 ||
+ destSize<0 || (destSize>0 && dest==nullptr))
{
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
/* do input and output overlap? */
- if( dest!=NULL &&
+ if( dest!=nullptr &&
((src>=dest && src<dest+destSize) ||
(dest>=src && dest<src+srcLength)))
{
@@ -355,29 +355,29 @@ ubidi_writeReverse(const UChar *src, int32_t srcLength,
#endif
U_CAPI int32_t U_EXPORT2
ubidi_writeReordered(UBiDi *pBiDi,
- UChar *dest, int32_t destSize,
+ char16_t *dest, int32_t destSize,
uint16_t options,
UErrorCode *pErrorCode) {
- const UChar *text;
- UChar *saveDest;
+ const char16_t *text;
+ char16_t *saveDest;
int32_t length, destCapacity;
int32_t run, runCount, logicalStart, runLength;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
/* more error checking */
- if( pBiDi==NULL ||
- (text=pBiDi->text)==NULL || (length=pBiDi->length)<0 ||
- destSize<0 || (destSize>0 && dest==NULL))
+ if( pBiDi==nullptr ||
+ (text=pBiDi->text)==nullptr || (length=pBiDi->length)<0 ||
+ destSize<0 || (destSize>0 && dest==nullptr))
{
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
/* do input and output overlap? */
- if( dest!=NULL &&
+ if( dest!=nullptr &&
((text>=dest && text<dest+destSize) ||
(dest>=text && dest<text+pBiDi->originalLength)))
{
@@ -451,7 +451,7 @@ ubidi_writeReordered(UBiDi *pBiDi,
dest, destSize,
options, pErrorCode);
}
- if(dest!=NULL) {
+ if(dest!=nullptr) {
dest+=runLength;
}
destSize-=runLength;
@@ -459,8 +459,8 @@ ubidi_writeReordered(UBiDi *pBiDi,
} else {
/* insert BiDi controls for "inverse BiDi" */
const DirProp *dirProps=pBiDi->dirProps;
- const UChar *src;
- UChar uc;
+ const char16_t *src;
+ char16_t uc;
UBiDiDirection dir;
int32_t markFlag;
@@ -495,7 +495,7 @@ ubidi_writeReordered(UBiDi *pBiDi,
runLength=doWriteForward(src, runLength,
dest, destSize,
(uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
- if(dest!=NULL) {
+ if(dest!=nullptr) {
dest+=runLength;
}
destSize-=runLength;
@@ -539,7 +539,7 @@ ubidi_writeReordered(UBiDi *pBiDi,
runLength=doWriteReverse(src, runLength,
dest, destSize,
options, pErrorCode);
- if(dest!=NULL) {
+ if(dest!=nullptr) {
dest+=runLength;
}
destSize-=runLength;
@@ -578,7 +578,7 @@ ubidi_writeReordered(UBiDi *pBiDi,
dest, destSize,
options, pErrorCode);
}
- if(dest!=NULL) {
+ if(dest!=nullptr) {
dest+=runLength;
}
destSize-=runLength;
@@ -586,7 +586,7 @@ ubidi_writeReordered(UBiDi *pBiDi,
} else {
/* insert BiDi controls for "inverse BiDi" */
const DirProp *dirProps=pBiDi->dirProps;
- const UChar *src;
+ const char16_t *src;
UBiDiDirection dir;
for(run=runCount; --run>=0;) {
@@ -605,7 +605,7 @@ ubidi_writeReordered(UBiDi *pBiDi,
runLength=doWriteReverse(src, runLength,
dest, destSize,
(uint16_t)(options&~UBIDI_DO_MIRRORING), pErrorCode);
- if(dest!=NULL) {
+ if(dest!=nullptr) {
dest+=runLength;
}
destSize-=runLength;
@@ -627,7 +627,7 @@ ubidi_writeReordered(UBiDi *pBiDi,
runLength=doWriteForward(src, runLength,
dest, destSize,
options, pErrorCode);
- if(dest!=NULL) {
+ if(dest!=nullptr) {
dest+=runLength;
}
destSize-=runLength;
diff --git a/thirdparty/icu4c/common/ubrk.cpp b/thirdparty/icu4c/common/ubrk.cpp
index f4e064961f..46ec0d785a 100644
--- a/thirdparty/icu4c/common/ubrk.cpp
+++ b/thirdparty/icu4c/common/ubrk.cpp
@@ -33,7 +33,7 @@ U_NAMESPACE_USE
U_CAPI UBreakIterator* U_EXPORT2
ubrk_open(UBreakIteratorType type,
const char *locale,
- const UChar *text,
+ const char16_t *text,
int32_t textLength,
UErrorCode *status)
{
@@ -79,7 +79,7 @@ ubrk_open(UBreakIteratorType type,
UBreakIterator *uBI = (UBreakIterator *)result;
- if (text != NULL) {
+ if (text != nullptr) {
ubrk_setText(uBI, text, textLength, status);
}
return uBI;
@@ -94,14 +94,14 @@ ubrk_open(UBreakIteratorType type,
//
//------------------------------------------------------------------------------
U_CAPI UBreakIterator* U_EXPORT2
-ubrk_openRules( const UChar *rules,
+ubrk_openRules( const char16_t *rules,
int32_t rulesLength,
- const UChar *text,
+ const char16_t *text,
int32_t textLength,
UParseError *parseErr,
UErrorCode *status) {
- if (status == NULL || U_FAILURE(*status)){
+ if (status == nullptr || U_FAILURE(*status)){
return 0;
}
@@ -113,7 +113,7 @@ ubrk_openRules( const UChar *rules,
}
UBreakIterator *uBI = (UBreakIterator *)result;
- if (text != NULL) {
+ if (text != nullptr) {
ubrk_setText(uBI, text, textLength, status);
}
return uBI;
@@ -122,22 +122,22 @@ ubrk_openRules( const UChar *rules,
U_CAPI UBreakIterator* U_EXPORT2
ubrk_openBinaryRules(const uint8_t *binaryRules, int32_t rulesLength,
- const UChar * text, int32_t textLength,
+ const char16_t * text, int32_t textLength,
UErrorCode * status)
{
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
if (rulesLength < 0) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
LocalPointer<RuleBasedBreakIterator> lpRBBI(new RuleBasedBreakIterator(binaryRules, rulesLength, *status), *status);
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
UBreakIterator *uBI = reinterpret_cast<UBreakIterator *>(lpRBBI.orphan());
- if (text != NULL) {
+ if (text != nullptr) {
ubrk_setText(uBI, text, textLength, status);
}
return uBI;
@@ -151,24 +151,24 @@ ubrk_safeClone(
int32_t *pBufferSize,
UErrorCode *status)
{
- if (status == NULL || U_FAILURE(*status)){
- return NULL;
+ if (status == nullptr || U_FAILURE(*status)){
+ return nullptr;
}
- if (bi == NULL) {
+ if (bi == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
- if (pBufferSize != NULL) {
+ if (pBufferSize != nullptr) {
int32_t inputSize = *pBufferSize;
*pBufferSize = 1;
if (inputSize == 0) {
- return NULL; // preflighting for deprecated functionality
+ return nullptr; // preflighting for deprecated functionality
}
}
BreakIterator *newBI = ((BreakIterator *)bi)->clone();
- if (newBI == NULL) {
+ if (newBI == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- } else if (pBufferSize != NULL) {
+ } else if (pBufferSize != nullptr) {
*status = U_SAFECLONE_ALLOCATED_WARNING;
}
return (UBreakIterator *)newBI;
@@ -188,14 +188,14 @@ ubrk_close(UBreakIterator *bi)
U_CAPI void U_EXPORT2
ubrk_setText(UBreakIterator* bi,
- const UChar* text,
+ const char16_t* text,
int32_t textLength,
UErrorCode* status)
{
UText ut = UTEXT_INITIALIZER;
utext_openUChars(&ut, text, textLength, status);
((BreakIterator*)bi)->setText(&ut, *status);
- // A stack allocated UText wrapping a UChar * string
+ // A stack allocated UText wrapping a char16_t * string
// can be dumped without explicitly closing it.
}
@@ -304,11 +304,11 @@ ubrk_getLocaleByType(const UBreakIterator *bi,
ULocDataLocaleType type,
UErrorCode* status)
{
- if (bi == NULL) {
+ if (bi == nullptr) {
if (U_SUCCESS(*status)) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
}
- return NULL;
+ return nullptr;
}
return ((BreakIterator*)bi)->getLocaleID(type, *status);
}
@@ -331,12 +331,12 @@ ubrk_getBinaryRules(UBreakIterator *bi,
if (U_FAILURE(*status)) {
return 0;
}
- if ((binaryRules == NULL && rulesCapacity > 0) || rulesCapacity < 0) {
+ if ((binaryRules == nullptr && rulesCapacity > 0) || rulesCapacity < 0) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
RuleBasedBreakIterator* rbbi;
- if ((rbbi = dynamic_cast<RuleBasedBreakIterator*>(reinterpret_cast<BreakIterator*>(bi))) == NULL) {
+ if ((rbbi = dynamic_cast<RuleBasedBreakIterator*>(reinterpret_cast<BreakIterator*>(bi))) == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -346,7 +346,7 @@ ubrk_getBinaryRules(UBreakIterator *bi,
*status = U_INDEX_OUTOFBOUNDS_ERROR;
return 0;
}
- if (binaryRules != NULL) { // if not preflighting
+ if (binaryRules != nullptr) { // if not preflighting
// Here we know rulesLength <= INT32_MAX and rulesCapacity >= 0, can cast safely
if ((int32_t)rulesLength > rulesCapacity) {
*status = U_BUFFER_OVERFLOW_ERROR;
diff --git a/thirdparty/icu4c/common/ucase.cpp b/thirdparty/icu4c/common/ucase.cpp
index 3d1750265b..392e1266ae 100644
--- a/thirdparty/icu4c/common/ucase.cpp
+++ b/thirdparty/icu4c/common/ucase.cpp
@@ -50,7 +50,7 @@ ucase_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
}
/* add the start code point of each same-value range of the trie */
- utrie2_enum(&ucase_props_singleton.trie, NULL, _enumPropertyStartsRange, sa);
+ utrie2_enum(&ucase_props_singleton.trie, nullptr, _enumPropertyStartsRange, sa);
/* add code points with hardcoded properties, plus the ones following them */
@@ -195,47 +195,17 @@ ucase_totitle(UChar32 c) {
return c;
}
-static const UChar iDot[2] = { 0x69, 0x307 };
-static const UChar jDot[2] = { 0x6a, 0x307 };
-static const UChar iOgonekDot[3] = { 0x12f, 0x307 };
-static const UChar iDotGrave[3] = { 0x69, 0x307, 0x300 };
-static const UChar iDotAcute[3] = { 0x69, 0x307, 0x301 };
-static const UChar iDotTilde[3] = { 0x69, 0x307, 0x303 };
+static const char16_t iDot[2] = { 0x69, 0x307 };
+static const char16_t jDot[2] = { 0x6a, 0x307 };
+static const char16_t iOgonekDot[3] = { 0x12f, 0x307 };
+static const char16_t iDotGrave[3] = { 0x69, 0x307, 0x300 };
+static const char16_t iDotAcute[3] = { 0x69, 0x307, 0x301 };
+static const char16_t iDotTilde[3] = { 0x69, 0x307, 0x303 };
U_CFUNC void U_EXPORT2
ucase_addCaseClosure(UChar32 c, const USetAdder *sa) {
- uint16_t props;
-
- /*
- * Hardcode the case closure of i and its relatives and ignore the
- * data file data for these characters.
- * The Turkic dotless i and dotted I with their case mapping conditions
- * and case folding option make the related characters behave specially.
- * This code matches their closure behavior to their case folding behavior.
- */
-
- switch(c) {
- case 0x49:
- /* regular i and I are in one equivalence class */
- sa->add(sa->set, 0x69);
- return;
- case 0x69:
- sa->add(sa->set, 0x49);
- return;
- case 0x130:
- /* dotted I is in a class with <0069 0307> (for canonical equivalence with <0049 0307>) */
- sa->addString(sa->set, iDot, 2);
- return;
- case 0x131:
- /* dotless i is in a class by itself */
- return;
- default:
- /* otherwise use the data file data */
- break;
- }
-
- props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
+ uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
if(!UCASE_HAS_EXCEPTION(props)) {
if(UCASE_GET_TYPE(props)!=UCASE_NONE) {
/* add the one simple case mapping, no matter what type it is */
@@ -249,19 +219,42 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa) {
* c has exceptions, so there may be multiple simple and/or
* full case mappings. Add them all.
*/
- const uint16_t *pe0, *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
- const UChar *closure;
+ const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
uint16_t excWord=*pe++;
- int32_t idx, closureLength, fullLength, length;
-
- pe0=pe;
+ const uint16_t *pe0=pe;
+
+ // Hardcode the case closure of i and its relatives and ignore the
+ // data file data for these characters.
+ // The Turkic dotless i and dotted I with their case mapping conditions
+ // and case folding option make the related characters behave specially.
+ // This code matches their closure behavior to their case folding behavior.
+ if (excWord&UCASE_EXC_CONDITIONAL_FOLD) {
+ // These characters have Turkic case foldings. Hardcode their closure.
+ if (c == 0x49) {
+ // Regular i and I are in one equivalence class.
+ sa->add(sa->set, 0x69);
+ return;
+ } else if (c == 0x130) {
+ // Dotted I is in a class with <0069 0307>
+ // (for canonical equivalence with <0049 0307>).
+ sa->addString(sa->set, iDot, 2);
+ return;
+ }
+ } else if (c == 0x69) {
+ sa->add(sa->set, 0x49);
+ return;
+ } else if (c == 0x131) {
+ // Dotless i is in a class by itself.
+ return;
+ }
/* add all simple case mappings */
- for(idx=UCASE_EXC_LOWER; idx<=UCASE_EXC_TITLE; ++idx) {
+ for(int32_t idx=UCASE_EXC_LOWER; idx<=UCASE_EXC_TITLE; ++idx) {
if(HAS_SLOT(excWord, idx)) {
pe=pe0;
- GET_SLOT_VALUE(excWord, idx, pe, c);
- sa->add(sa->set, c);
+ UChar32 mapping;
+ GET_SLOT_VALUE(excWord, idx, pe, mapping);
+ sa->add(sa->set, mapping);
}
}
if(HAS_SLOT(excWord, UCASE_EXC_DELTA)) {
@@ -272,19 +265,22 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa) {
}
/* get the closure string pointer & length */
+ const char16_t *closure;
+ int32_t closureLength;
if(HAS_SLOT(excWord, UCASE_EXC_CLOSURE)) {
pe=pe0;
GET_SLOT_VALUE(excWord, UCASE_EXC_CLOSURE, pe, closureLength);
closureLength&=UCASE_CLOSURE_MAX_LENGTH; /* higher bits are reserved */
- closure=(const UChar *)pe+1; /* behind this slot, unless there are full case mappings */
+ closure=(const char16_t *)pe+1; /* behind this slot, unless there are full case mappings */
} else {
closureLength=0;
- closure=NULL;
+ closure=nullptr;
}
/* add the full case folding */
if(HAS_SLOT(excWord, UCASE_EXC_FULL_MAPPINGS)) {
pe=pe0;
+ int32_t fullLength;
GET_SLOT_VALUE(excWord, UCASE_EXC_FULL_MAPPINGS, pe, fullLength);
/* start of full case mapping strings */
@@ -297,9 +293,9 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa) {
fullLength>>=4;
/* add the full case folding string */
- length=fullLength&0xf;
+ int32_t length=fullLength&0xf;
if(length!=0) {
- sa->addString(sa->set, (const UChar *)pe, length);
+ sa->addString(sa->set, (const char16_t *)pe, length);
pe+=length;
}
@@ -309,13 +305,150 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa) {
fullLength>>=4;
pe+=fullLength;
- closure=(const UChar *)pe; /* behind full case mappings */
+ closure=(const char16_t *)pe; /* behind full case mappings */
}
/* add each code point in the closure string */
- for(idx=0; idx<closureLength;) {
- U16_NEXT_UNSAFE(closure, idx, c);
- sa->add(sa->set, c);
+ for(int32_t idx=0; idx<closureLength;) {
+ UChar32 mapping;
+ U16_NEXT_UNSAFE(closure, idx, mapping);
+ sa->add(sa->set, mapping);
+ }
+ }
+}
+
+namespace {
+
+/**
+ * Add the simple case closure mapping,
+ * except if there is not actually an scf relationship between the two characters.
+ * TODO: Unicode should probably add the corresponding scf mappings.
+ * See https://crbug.com/v8/13377 and Unicode-internal PAG issue #23.
+ * If & when those scf mappings are added, we should be able to remove all of these exceptions.
+ */
+void addOneSimpleCaseClosure(UChar32 c, UChar32 t, const USetAdder *sa) {
+ switch (c) {
+ case 0x0390:
+ if (t == 0x1FD3) { return; }
+ break;
+ case 0x03B0:
+ if (t == 0x1FE3) { return; }
+ break;
+ case 0x1FD3:
+ if (t == 0x0390) { return; }
+ break;
+ case 0x1FE3:
+ if (t == 0x03B0) { return; }
+ break;
+ case 0xFB05:
+ if (t == 0xFB06) { return; }
+ break;
+ case 0xFB06:
+ if (t == 0xFB05) { return; }
+ break;
+ default:
+ break;
+ }
+ sa->add(sa->set, t);
+}
+
+} // namespace
+
+U_CFUNC void U_EXPORT2
+ucase_addSimpleCaseClosure(UChar32 c, const USetAdder *sa) {
+ uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
+ if(!UCASE_HAS_EXCEPTION(props)) {
+ if(UCASE_GET_TYPE(props)!=UCASE_NONE) {
+ /* add the one simple case mapping, no matter what type it is */
+ int32_t delta=UCASE_GET_DELTA(props);
+ if(delta!=0) {
+ sa->add(sa->set, c+delta);
+ }
+ }
+ } else {
+ // c has exceptions. Add the mappings relevant for scf=Simple_Case_Folding.
+ const uint16_t *pe=GET_EXCEPTIONS(&ucase_props_singleton, props);
+ uint16_t excWord=*pe++;
+ const uint16_t *pe0=pe;
+
+ // Hardcode the case closure of i and its relatives and ignore the
+ // data file data for these characters, like in ucase_addCaseClosure().
+ if (excWord&UCASE_EXC_CONDITIONAL_FOLD) {
+ // These characters have Turkic case foldings. Hardcode their closure.
+ if (c == 0x49) {
+ // Regular i and I are in one equivalence class.
+ sa->add(sa->set, 0x69);
+ return;
+ } else if (c == 0x130) {
+ // For scf=Simple_Case_Folding, dotted I is in a class by itself.
+ return;
+ }
+ } else if (c == 0x69) {
+ sa->add(sa->set, 0x49);
+ return;
+ } else if (c == 0x131) {
+ // Dotless i is in a class by itself.
+ return;
+ }
+
+ // Add all simple case mappings.
+ for(int32_t idx=UCASE_EXC_LOWER; idx<=UCASE_EXC_TITLE; ++idx) {
+ if(HAS_SLOT(excWord, idx)) {
+ pe=pe0;
+ UChar32 mapping;
+ GET_SLOT_VALUE(excWord, idx, pe, mapping);
+ addOneSimpleCaseClosure(c, mapping, sa);
+ }
+ }
+ if(HAS_SLOT(excWord, UCASE_EXC_DELTA)) {
+ pe=pe0;
+ int32_t delta;
+ GET_SLOT_VALUE(excWord, UCASE_EXC_DELTA, pe, delta);
+ UChar32 mapping = (excWord&UCASE_EXC_DELTA_IS_NEGATIVE)==0 ? c+delta : c-delta;
+ addOneSimpleCaseClosure(c, mapping, sa);
+ }
+
+ /* get the closure string pointer & length */
+ const char16_t *closure;
+ int32_t closureLength;
+ if(HAS_SLOT(excWord, UCASE_EXC_CLOSURE)) {
+ pe=pe0;
+ GET_SLOT_VALUE(excWord, UCASE_EXC_CLOSURE, pe, closureLength);
+ closureLength&=UCASE_CLOSURE_MAX_LENGTH; /* higher bits are reserved */
+ closure=(const char16_t *)pe+1; /* behind this slot, unless there are full case mappings */
+ } else {
+ closureLength=0;
+ closure=nullptr;
+ }
+
+ // Skip the full case mappings.
+ if(closureLength > 0 && HAS_SLOT(excWord, UCASE_EXC_FULL_MAPPINGS)) {
+ pe=pe0;
+ int32_t fullLength;
+ GET_SLOT_VALUE(excWord, UCASE_EXC_FULL_MAPPINGS, pe, fullLength);
+
+ /* start of full case mapping strings */
+ ++pe;
+
+ fullLength&=0xffff; /* bits 16 and higher are reserved */
+
+ // Skip all 4 full case mappings.
+ pe+=fullLength&UCASE_FULL_LOWER;
+ fullLength>>=4;
+ pe+=fullLength&0xf;
+ fullLength>>=4;
+ pe+=fullLength&0xf;
+ fullLength>>=4;
+ pe+=fullLength;
+
+ closure=(const char16_t *)pe; /* behind full case mappings */
+ }
+
+ // Add each code point in the closure string whose scf maps back to c.
+ for(int32_t idx=0; idx<closureLength;) {
+ UChar32 mapping;
+ U16_NEXT_UNSAFE(closure, idx, mapping);
+ addOneSimpleCaseClosure(c, mapping, sa);
}
}
}
@@ -325,7 +458,7 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa) {
* must be length>0 and max>0 and length<=max
*/
static inline int32_t
-strcmpMax(const UChar *s, int32_t length, const UChar *t, int32_t max) {
+strcmpMax(const char16_t *s, int32_t length, const char16_t *t, int32_t max) {
int32_t c1, c2;
max-=length; /* we require length<=max, so no need to decrement max in the loop */
@@ -350,10 +483,10 @@ strcmpMax(const UChar *s, int32_t length, const UChar *t, int32_t max) {
}
U_CFUNC UBool U_EXPORT2
-ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa) {
+ucase_addStringCaseClosure(const char16_t *s, int32_t length, const USetAdder *sa) {
int32_t i, start, limit, result, unfoldRows, unfoldRowWidth, unfoldStringWidth;
- if(ucase_props_singleton.unfold==NULL || s==NULL) {
+ if(ucase_props_singleton.unfold==nullptr || s==nullptr) {
return false; /* no reverse case folding data, or no string */
}
if(length<=1) {
@@ -383,7 +516,7 @@ ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa)
limit=unfoldRows;
while(start<limit) {
i=(start+limit)/2;
- const UChar *p=reinterpret_cast<const UChar *>(unfold+(i*unfoldRowWidth));
+ const char16_t *p=reinterpret_cast<const char16_t *>(unfold+(i*unfoldRowWidth));
result=strcmpMax(s, length, p, unfoldStringWidth);
if(result==0) {
@@ -409,7 +542,7 @@ ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa)
U_NAMESPACE_BEGIN
FullCaseFoldingIterator::FullCaseFoldingIterator()
- : unfold(reinterpret_cast<const UChar *>(ucase_props_singleton.unfold)),
+ : unfold(reinterpret_cast<const char16_t *>(ucase_props_singleton.unfold)),
unfoldRows(unfold[UCASE_UNFOLD_ROWS]),
unfoldRowWidth(unfold[UCASE_UNFOLD_ROW_WIDTH]),
unfoldStringWidth(unfold[UCASE_UNFOLD_STRING_WIDTH]),
@@ -421,7 +554,7 @@ FullCaseFoldingIterator::FullCaseFoldingIterator()
UChar32
FullCaseFoldingIterator::next(UnicodeString &full) {
// Advance past the last-delivered code point.
- const UChar *p=unfold+(currentRow*unfoldRowWidth);
+ const char16_t *p=unfold+(currentRow*unfoldRowWidth);
if(rowCpIndex>=unfoldRowWidth || p[rowCpIndex]==0) {
++currentRow;
p+=unfoldRowWidth;
@@ -708,7 +841,7 @@ ucase_isCaseSensitive(UChar32 c) {
#define is_sep(c) ((c)=='_' || (c)=='-' || (c)==0)
/**
- * Requires non-NULL locale ID but otherwise does the equivalent of
+ * Requires non-nullptr locale ID but otherwise does the equivalent of
* checking for language codes as if uloc_getLanguage() were called:
* Accepts both 2- and 3-letter codes and accepts case variants.
*/
@@ -721,7 +854,7 @@ ucase_getCaseLocale(const char *locale) {
* examined and copied/transformed.
*
* Because this code does not want to depend on uloc, the caller must
- * pass in a non-NULL locale, i.e., may need to call uloc_getDefault().
+ * pass in a non-nullptr locale, i.e., may need to call uloc_getDefault().
*/
char c=*locale++;
// Fastpath for English "en" which is often used for default (=root locale) case mappings,
@@ -904,7 +1037,7 @@ static UBool
isFollowedByCasedLetter(UCaseContextIterator *iter, void *context, int8_t dir) {
UChar32 c;
- if(iter==NULL) {
+ if(iter==nullptr) {
return false;
}
@@ -929,7 +1062,7 @@ isPrecededBySoftDotted(UCaseContextIterator *iter, void *context) {
int32_t dotType;
int8_t dir;
- if(iter==NULL) {
+ if(iter==nullptr) {
return false;
}
@@ -986,7 +1119,7 @@ isPrecededBy_I(UCaseContextIterator *iter, void *context) {
int32_t dotType;
int8_t dir;
- if(iter==NULL) {
+ if(iter==nullptr) {
return false;
}
@@ -1010,7 +1143,7 @@ isFollowedByMoreAbove(UCaseContextIterator *iter, void *context) {
int32_t dotType;
int8_t dir;
- if(iter==NULL) {
+ if(iter==nullptr) {
return false;
}
@@ -1033,7 +1166,7 @@ isFollowedByDotAbove(UCaseContextIterator *iter, void *context) {
int32_t dotType;
int8_t dir;
- if(iter==NULL) {
+ if(iter==nullptr) {
return false;
}
@@ -1053,7 +1186,7 @@ isFollowedByDotAbove(UCaseContextIterator *iter, void *context) {
U_CAPI int32_t U_EXPORT2
ucase_toFullLower(UChar32 c,
UCaseContextIterator *iter, void *context,
- const UChar **pString,
+ const char16_t **pString,
int32_t loc) {
// The sign of the result has meaning, input must be non-negative so that it can be returned as is.
U_ASSERT(c >= 0);
@@ -1180,7 +1313,7 @@ ucase_toFullLower(UChar32 c,
full&=UCASE_FULL_LOWER;
if(full!=0) {
/* set the output pointer to the lowercase mapping */
- *pString=reinterpret_cast<const UChar *>(pe+1);
+ *pString=reinterpret_cast<const char16_t *>(pe+1);
/* return the string length */
return full;
@@ -1204,7 +1337,7 @@ ucase_toFullLower(UChar32 c,
static int32_t
toUpperOrTitle(UChar32 c,
UCaseContextIterator *iter, void *context,
- const UChar **pString,
+ const char16_t **pString,
int32_t loc,
UBool upperNotTitle) {
// The sign of the result has meaning, input must be non-negative so that it can be returned as is.
@@ -1286,7 +1419,7 @@ toUpperOrTitle(UChar32 c,
if(full!=0) {
/* set the output pointer to the result string */
- *pString=reinterpret_cast<const UChar *>(pe);
+ *pString=reinterpret_cast<const char16_t *>(pe);
/* return the string length */
return full;
@@ -1315,7 +1448,7 @@ toUpperOrTitle(UChar32 c,
U_CAPI int32_t U_EXPORT2
ucase_toFullUpper(UChar32 c,
UCaseContextIterator *iter, void *context,
- const UChar **pString,
+ const char16_t **pString,
int32_t caseLocale) {
return toUpperOrTitle(c, iter, context, pString, caseLocale, true);
}
@@ -1323,7 +1456,7 @@ ucase_toFullUpper(UChar32 c,
U_CAPI int32_t U_EXPORT2
ucase_toFullTitle(UChar32 c,
UCaseContextIterator *iter, void *context,
- const UChar **pString,
+ const char16_t **pString,
int32_t caseLocale) {
return toUpperOrTitle(c, iter, context, pString, caseLocale, false);
}
@@ -1440,7 +1573,7 @@ ucase_fold(UChar32 c, uint32_t options) {
U_CAPI int32_t U_EXPORT2
ucase_toFullFolding(UChar32 c,
- const UChar **pString,
+ const char16_t **pString,
uint32_t options) {
// The sign of the result has meaning, input must be non-negative so that it can be returned as is.
U_ASSERT(c >= 0);
@@ -1493,7 +1626,7 @@ ucase_toFullFolding(UChar32 c,
if(full!=0) {
/* set the output pointer to the result string */
- *pString=reinterpret_cast<const UChar *>(pe);
+ *pString=reinterpret_cast<const char16_t *>(pe);
/* return the string length */
return full;
@@ -1562,7 +1695,7 @@ u_foldCase(UChar32 c, uint32_t options) {
U_CFUNC int32_t U_EXPORT2
ucase_hasBinaryProperty(UChar32 c, UProperty which) {
/* case mapping properties */
- const UChar *resultString;
+ const char16_t *resultString;
switch(which) {
case UCHAR_LOWERCASE:
return (UBool)(UCASE_LOWER==ucase_getType(c));
@@ -1589,17 +1722,17 @@ ucase_hasBinaryProperty(UChar32 c, UProperty which) {
* start sets for normalization and case mappings.
*/
case UCHAR_CHANGES_WHEN_LOWERCASED:
- return (UBool)(ucase_toFullLower(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
+ return (UBool)(ucase_toFullLower(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0);
case UCHAR_CHANGES_WHEN_UPPERCASED:
- return (UBool)(ucase_toFullUpper(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
+ return (UBool)(ucase_toFullUpper(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0);
case UCHAR_CHANGES_WHEN_TITLECASED:
- return (UBool)(ucase_toFullTitle(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
+ return (UBool)(ucase_toFullTitle(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0);
/* case UCHAR_CHANGES_WHEN_CASEFOLDED: -- in uprops.c */
case UCHAR_CHANGES_WHEN_CASEMAPPED:
return (UBool)(
- ucase_toFullLower(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0 ||
- ucase_toFullUpper(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0 ||
- ucase_toFullTitle(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
+ ucase_toFullLower(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0 ||
+ ucase_toFullUpper(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0 ||
+ ucase_toFullTitle(c, nullptr, nullptr, &resultString, UCASE_LOC_ROOT)>=0);
default:
return false;
}
diff --git a/thirdparty/icu4c/common/ucase.h b/thirdparty/icu4c/common/ucase.h
index 049f042912..e03b311870 100644
--- a/thirdparty/icu4c/common/ucase.h
+++ b/thirdparty/icu4c/common/ucase.h
@@ -108,6 +108,10 @@ ucase_fold(UChar32 c, uint32_t options);
U_CFUNC void U_EXPORT2
ucase_addCaseClosure(UChar32 c, const USetAdder *sa);
+/** Case closure with only scf=Simple_Case_Folding. */
+U_CFUNC void U_EXPORT2
+ucase_addSimpleCaseClosure(UChar32 c, const USetAdder *sa);
+
/**
* Maps the string to single code points and adds the associated case closure
* mappings.
@@ -142,7 +146,7 @@ private:
FullCaseFoldingIterator(const FullCaseFoldingIterator &) = delete; // no copy
FullCaseFoldingIterator &operator=(const FullCaseFoldingIterator &) = delete; // no assignment
- const UChar *unfold;
+ const char16_t *unfold;
int32_t unfoldRows;
int32_t unfoldRowWidth;
int32_t unfoldStringWidth;
@@ -159,9 +163,9 @@ private:
namespace LatinCase {
/** Case mapping/folding data for code points up to U+017F. */
-constexpr UChar LIMIT = 0x180;
+constexpr char16_t LIMIT = 0x180;
/** U+017F case-folds and uppercases crossing the ASCII boundary. */
-constexpr UChar LONG_S = 0x17f;
+constexpr char16_t LONG_S = 0x17f;
/** Exception: Complex mapping, or too-large delta. */
constexpr int8_t EXC = -0x80;
diff --git a/thirdparty/icu4c/common/ucase_props_data.h b/thirdparty/icu4c/common/ucase_props_data.h
index b7797d14d7..7e6de63fb7 100644
--- a/thirdparty/icu4c/common/ucase_props_data.h
+++ b/thirdparty/icu4c/common/ucase_props_data.h
@@ -974,14 +974,14 @@ static const uint16_t ucase_props_unfold[370]={
};
static const UCaseProps ucase_props_singleton={
- NULL,
+ nullptr,
ucase_props_indexes,
ucase_props_exceptions,
ucase_props_unfold,
{
ucase_props_trieIndex,
ucase_props_trieIndex+3412,
- NULL,
+ nullptr,
3412,
9736,
0x188,
@@ -990,7 +990,7 @@ static const UCaseProps ucase_props_singleton={
0x0,
0xe0800,
0x3358,
- NULL, 0, false, false, 0, NULL
+ nullptr, 0, false, false, 0, nullptr
},
{ 4,0,0,0 }
};
diff --git a/thirdparty/icu4c/common/ucasemap.cpp b/thirdparty/icu4c/common/ucasemap.cpp
index fc0439db0f..1d8a8b6c2f 100644
--- a/thirdparty/icu4c/common/ucasemap.cpp
+++ b/thirdparty/icu4c/common/ucasemap.cpp
@@ -49,7 +49,7 @@ U_NAMESPACE_USE
UCaseMap::UCaseMap(const char *localeID, uint32_t opts, UErrorCode *pErrorCode) :
#if !UCONFIG_NO_BREAK_ITERATION
- iter(NULL),
+ iter(nullptr),
#endif
caseLocale(UCASE_LOC_UNKNOWN), options(opts) {
ucasemap_setLocale(this, localeID, pErrorCode);
@@ -64,15 +64,15 @@ UCaseMap::~UCaseMap() {
U_CAPI UCaseMap * U_EXPORT2
ucasemap_open(const char *locale, uint32_t options, UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
UCaseMap *csm = new UCaseMap(locale, options, pErrorCode);
- if(csm==NULL) {
+ if(csm==nullptr) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
} else if (U_FAILURE(*pErrorCode)) {
delete csm;
- return NULL;
+ return nullptr;
}
return csm;
}
@@ -97,7 +97,7 @@ ucasemap_setLocale(UCaseMap *csm, const char *locale, UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
return;
}
- if (locale != NULL && *locale == 0) {
+ if (locale != nullptr && *locale == 0) {
csm->locale[0] = 0;
csm->caseLocale = UCASE_LOC_ROOT;
return;
@@ -136,14 +136,14 @@ namespace {
/* append a full case mapping result, see UCASE_MAX_STRING_LENGTH */
inline UBool
-appendResult(int32_t cpLength, int32_t result, const UChar *s,
+appendResult(int32_t cpLength, int32_t result, const char16_t *s,
ByteSink &sink, uint32_t options, icu::Edits *edits, UErrorCode &errorCode) {
U_ASSERT(U_SUCCESS(errorCode));
/* decode the result */
if(result<0) {
/* (not) original code point */
- if(edits!=NULL) {
+ if(edits!=nullptr) {
edits->addUnchanged(cpLength);
}
if((options & U_OMIT_UNCHANGED_TEXT) == 0) {
@@ -292,7 +292,7 @@ void toLower(int32_t caseLocale, uint32_t options,
break;
}
// slow path
- const UChar *s;
+ const char16_t *s;
if (caseLocale >= 0) {
csc->cpStart = cpStart;
csc->cpLimit = srcIndex;
@@ -402,7 +402,7 @@ void toUpper(int32_t caseLocale, uint32_t options,
// slow path
csc->cpStart = cpStart;
csc->cpLimit = srcIndex;
- const UChar *s;
+ const char16_t *s;
c = ucase_toFullUpper(c, utf8_caseContextIterator, csc, &s, caseLocale);
if (c >= 0) {
ByteSinkUtil::appendUnchanged(src + prev, cpStart - prev,
@@ -580,7 +580,7 @@ ucasemap_internalUTF8ToTitle(
if(c>=0) {
csc.cpStart=titleStart;
csc.cpLimit=titleLimit;
- const UChar *s;
+ const char16_t *s;
c=ucase_toFullTitle(c, utf8_caseContextIterator, &csc, &s, caseLocale);
if (!appendResult(titleLimit-titleStart, c, s, sink, options, edits, errorCode)) {
return;
@@ -757,11 +757,11 @@ void toUpper(uint32_t options,
int32_t newLength = (i2 - i) + numYpogegrammeni * 2; // 2 bytes per U+0399
change |= oldLength != newLength;
if (change) {
- if (edits != NULL) {
+ if (edits != nullptr) {
edits->addReplace(oldLength, newLength);
}
} else {
- if (edits != NULL) {
+ if (edits != nullptr) {
edits->addUnchanged(oldLength);
}
// Write unchanged text?
@@ -783,8 +783,8 @@ void toUpper(uint32_t options,
}
}
} else if(c>=0) {
- const UChar *s;
- c=ucase_toFullUpper(c, NULL, NULL, &s, UCASE_LOC_GREEK);
+ const char16_t *s;
+ c=ucase_toFullUpper(c, nullptr, nullptr, &s, UCASE_LOC_GREEK);
if (!appendResult(nextIndex - i, c, s, sink, options, edits, errorCode)) {
return;
}
@@ -891,8 +891,8 @@ ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_P
return 0;
}
if( destCapacity<0 ||
- (dest==NULL && destCapacity>0) ||
- (src==NULL && srcLength!=0) || srcLength<-1
+ (dest==nullptr && destCapacity>0) ||
+ (src==nullptr && srcLength!=0) || srcLength<-1
) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
@@ -904,7 +904,7 @@ ucasemap_mapUTF8(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_P
}
/* check for overlapping source and destination */
- if( dest!=NULL &&
+ if( dest!=nullptr &&
((src>=dest && src<(dest+destCapacity)) ||
(dest>=src && dest<(src+srcLength)))
) {
@@ -940,7 +940,7 @@ ucasemap_utf8ToLower(const UCaseMap *csm,
csm->caseLocale, csm->options, UCASEMAP_BREAK_ITERATOR_NULL
dest, destCapacity,
src, srcLength,
- ucasemap_internalUTF8ToLower, NULL, *pErrorCode);
+ ucasemap_internalUTF8ToLower, nullptr, *pErrorCode);
}
U_CAPI int32_t U_EXPORT2
@@ -952,7 +952,7 @@ ucasemap_utf8ToUpper(const UCaseMap *csm,
csm->caseLocale, csm->options, UCASEMAP_BREAK_ITERATOR_NULL
dest, destCapacity,
src, srcLength,
- ucasemap_internalUTF8ToUpper, NULL, *pErrorCode);
+ ucasemap_internalUTF8ToUpper, nullptr, *pErrorCode);
}
U_CAPI int32_t U_EXPORT2
@@ -964,7 +964,7 @@ ucasemap_utf8FoldCase(const UCaseMap *csm,
UCASE_LOC_ROOT, csm->options, UCASEMAP_BREAK_ITERATOR_NULL
dest, destCapacity,
src, srcLength,
- ucasemap_internalUTF8Fold, NULL, *pErrorCode);
+ ucasemap_internalUTF8Fold, nullptr, *pErrorCode);
}
U_NAMESPACE_BEGIN
diff --git a/thirdparty/icu4c/common/ucasemap_imp.h b/thirdparty/icu4c/common/ucasemap_imp.h
index e17a0ae5a3..71d0e9033f 100644
--- a/thirdparty/icu4c/common/ucasemap_imp.h
+++ b/thirdparty/icu4c/common/ucasemap_imp.h
@@ -139,16 +139,16 @@ ustrcase_getCaseLocale(const char *locale);
/** Implements UStringCaseMapper. */
U_CFUNC int32_t U_CALLCONV
ustrcase_internalToLower(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
icu::Edits *edits,
UErrorCode &errorCode);
/** Implements UStringCaseMapper. */
U_CFUNC int32_t U_CALLCONV
ustrcase_internalToUpper(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
icu::Edits *edits,
UErrorCode &errorCode);
@@ -158,8 +158,8 @@ ustrcase_internalToUpper(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_IT
U_CFUNC int32_t U_CALLCONV
ustrcase_internalToTitle(int32_t caseLocale, uint32_t options,
icu::BreakIterator *iter,
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
icu::Edits *edits,
UErrorCode &errorCode);
@@ -168,8 +168,8 @@ ustrcase_internalToTitle(int32_t caseLocale, uint32_t options,
/** Implements UStringCaseMapper. */
U_CFUNC int32_t U_CALLCONV
ustrcase_internalFold(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
icu::Edits *edits,
UErrorCode &errorCode);
@@ -179,8 +179,8 @@ ustrcase_internalFold(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERA
*/
U_CFUNC int32_t
ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
UStringCaseMapper *stringCaseMapper,
icu::Edits *edits,
UErrorCode &errorCode);
@@ -192,8 +192,8 @@ ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
*/
U_CFUNC int32_t
ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
UStringCaseMapper *stringCaseMapper,
UErrorCode &errorCode);
diff --git a/thirdparty/icu4c/common/ucasemap_titlecase_brkiter.cpp b/thirdparty/icu4c/common/ucasemap_titlecase_brkiter.cpp
index c21dfb7698..c2b44a2c78 100644
--- a/thirdparty/icu4c/common/ucasemap_titlecase_brkiter.cpp
+++ b/thirdparty/icu4c/common/ucasemap_titlecase_brkiter.cpp
@@ -66,7 +66,7 @@ int32_t CaseMap::utf8ToTitle(
utext_openUTF8(&utext, src, srcLength, &errorCode);
LocalPointer<BreakIterator> ownedIter;
iter = ustrcase_getTitleBreakIterator(nullptr, locale, options, iter, ownedIter, errorCode);
- if(iter==NULL) {
+ if(iter==nullptr) {
utext_close(&utext);
return 0;
}
@@ -111,7 +111,7 @@ ucasemap_utf8ToTitle(UCaseMap *csm,
if (U_FAILURE(*pErrorCode)) {
return 0;
}
- if(csm->iter==NULL) {
+ if(csm->iter==nullptr) {
LocalPointer<BreakIterator> ownedIter;
BreakIterator *iter = ustrcase_getTitleBreakIterator(
nullptr, csm->locale, csm->options, nullptr, ownedIter, *pErrorCode);
@@ -126,7 +126,7 @@ ucasemap_utf8ToTitle(UCaseMap *csm,
csm->caseLocale, csm->options, csm->iter,
dest, destCapacity,
src, srcLength,
- ucasemap_internalUTF8ToTitle, NULL, *pErrorCode);
+ ucasemap_internalUTF8ToTitle, nullptr, *pErrorCode);
utext_close(&utext);
return length;
}
diff --git a/thirdparty/icu4c/common/ucat.cpp b/thirdparty/icu4c/common/ucat.cpp
index dac56eeb5c..2f7fdcd980 100644
--- a/thirdparty/icu4c/common/ucat.cpp
+++ b/thirdparty/icu4c/common/ucat.cpp
@@ -43,18 +43,18 @@ u_catopen(const char* name, const char* locale, UErrorCode* ec) {
U_CAPI void U_EXPORT2
u_catclose(u_nl_catd catd) {
- ures_close((UResourceBundle*) catd); /* may be NULL */
+ ures_close((UResourceBundle*) catd); /* may be nullptr */
}
-U_CAPI const UChar* U_EXPORT2
+U_CAPI const char16_t* U_EXPORT2
u_catgets(u_nl_catd catd, int32_t set_num, int32_t msg_num,
- const UChar* s,
+ const char16_t* s,
int32_t* len, UErrorCode* ec) {
char key[MAX_KEY_LEN];
- const UChar* result;
+ const char16_t* result;
- if (ec == NULL || U_FAILURE(*ec)) {
+ if (ec == nullptr || U_FAILURE(*ec)) {
goto ERROR;
}
@@ -69,7 +69,7 @@ u_catgets(u_nl_catd catd, int32_t set_num, int32_t msg_num,
ERROR:
/* In case of any failure, return s */
- if (len != NULL) {
+ if (len != nullptr) {
*len = u_strlen(s);
}
return s;
diff --git a/thirdparty/icu4c/common/uchar.cpp b/thirdparty/icu4c/common/uchar.cpp
index 7789a3b88a..ff12962baa 100644
--- a/thirdparty/icu4c/common/uchar.cpp
+++ b/thirdparty/icu4c/common/uchar.cpp
@@ -76,7 +76,7 @@ U_CAPI void U_EXPORT2
u_enumCharTypes(UCharEnumTypeRange *enumRange, const void *context) {
struct _EnumTypeCallback callback;
- if(enumRange==NULL) {
+ if(enumRange==nullptr) {
return;
}
@@ -304,30 +304,6 @@ u_ispunct(UChar32 c) {
return (UBool)((CAT_MASK(props)&U_GC_P_MASK)!=0);
}
-/* Checks if the Unicode character can start a Unicode identifier.*/
-U_CAPI UBool U_EXPORT2
-u_isIDStart(UChar32 c) {
- /* same as u_isalpha() */
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)((CAT_MASK(props)&(U_GC_L_MASK|U_GC_NL_MASK))!=0);
-}
-
-/* Checks if the Unicode character can be a Unicode identifier part other than starting the
- identifier.*/
-U_CAPI UBool U_EXPORT2
-u_isIDPart(UChar32 c) {
- uint32_t props;
- GET_PROPS(c, props);
- return (UBool)(
- (CAT_MASK(props)&
- (U_GC_ND_MASK|U_GC_NL_MASK|
- U_GC_L_MASK|
- U_GC_PC_MASK|U_GC_MC_MASK|U_GC_MN_MASK)
- )!=0 ||
- u_isIDIgnorable(c));
-}
-
/*Checks if the Unicode character can be ignorable in a Java or Unicode identifier.*/
U_CAPI UBool U_EXPORT2
u_isIDIgnorable(UChar32 c) {
@@ -509,7 +485,7 @@ u_forDigit(int32_t digit, int8_t radix) {
U_CAPI void U_EXPORT2
u_getUnicodeVersion(UVersionInfo versionArray) {
- if(versionArray!=NULL) {
+ if(versionArray!=nullptr) {
uprv_memcpy(versionArray, dataVersion, U_MAX_VERSION_LENGTH);
}
}
@@ -546,7 +522,7 @@ uprv_getMaxValues(int32_t column) {
U_CAPI void U_EXPORT2
u_charAge(UChar32 c, UVersionInfo versionArray) {
- if(versionArray!=NULL) {
+ if(versionArray!=nullptr) {
uint32_t version=u_getUnicodeProperties(c, 0)>>UPROPS_AGE_SHIFT;
versionArray[0]=(uint8_t)(version>>4);
versionArray[1]=(uint8_t)(version&0xf);
@@ -556,7 +532,7 @@ u_charAge(UChar32 c, UVersionInfo versionArray) {
U_CAPI UScriptCode U_EXPORT2
uscript_getScript(UChar32 c, UErrorCode *pErrorCode) {
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return USCRIPT_INVALID_CODE;
}
if((uint32_t)c>0x10ffff) {
@@ -577,7 +553,7 @@ uscript_getScript(UChar32 c, UErrorCode *pErrorCode) {
}
U_CAPI UBool U_EXPORT2
-uscript_hasScript(UChar32 c, UScriptCode sc) {
+uscript_hasScript(UChar32 c, UScriptCode sc) UPRV_NO_SANITIZE_UNDEFINED {
uint32_t scriptX=u_getUnicodeProperties(c, 0)&UPROPS_SCRIPT_X_MASK;
uint32_t codeOrIndex=uprops_mergeScriptCodeOrIndex(scriptX);
if(scriptX<UPROPS_SCRIPT_X_WITH_COMMON) {
@@ -603,10 +579,10 @@ U_CAPI int32_t U_EXPORT2
uscript_getScriptExtensions(UChar32 c,
UScriptCode *scripts, int32_t capacity,
UErrorCode *pErrorCode) {
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(capacity<0 || (capacity>0 && scripts==NULL)) {
+ if(capacity<0 || (capacity>0 && scripts==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -666,7 +642,7 @@ uchar_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
}
/* add the start code point of each same-value range of the main trie */
- utrie2_enum(&propsTrie, NULL, _enumPropertyStartsRange, sa);
+ utrie2_enum(&propsTrie, nullptr, _enumPropertyStartsRange, sa);
/* add code points with hardcoded properties, plus the ones following them */
@@ -728,5 +704,5 @@ upropsvec_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
}
/* add the start code point of each same-value range of the properties vectors trie */
- utrie2_enum(&propsVectorsTrie, NULL, _enumPropertyStartsRange, sa);
+ utrie2_enum(&propsVectorsTrie, nullptr, _enumPropertyStartsRange, sa);
}
diff --git a/thirdparty/icu4c/common/uchar_props_data.h b/thirdparty/icu4c/common/uchar_props_data.h
index acbeadd249..f4d3932574 100644
--- a/thirdparty/icu4c/common/uchar_props_data.h
+++ b/thirdparty/icu4c/common/uchar_props_data.h
@@ -1456,7 +1456,7 @@ static const uint16_t propsTrie_index[23016]={
static const UTrie2 propsTrie={
propsTrie_index,
propsTrie_index+4692,
- NULL,
+ nullptr,
4692,
18324,
0xa40,
@@ -1465,7 +1465,7 @@ static const UTrie2 propsTrie={
0x0,
0x110000,
0x59e4,
- NULL, 0, false, false, 0, NULL
+ nullptr, 0, false, false, 0, nullptr
};
static const uint16_t propsVectorsTrie_index[32692]={
@@ -3518,7 +3518,7 @@ static const uint16_t propsVectorsTrie_index[32692]={
static const UTrie2 propsVectorsTrie={
propsVectorsTrie_index,
propsVectorsTrie_index+5348,
- NULL,
+ nullptr,
5348,
27344,
0xa40,
@@ -3527,7 +3527,7 @@ static const UTrie2 propsVectorsTrie={
0x0,
0x110000,
0x7fb0,
- NULL, 0, false, false, 0, NULL
+ nullptr, 0, false, false, 0, nullptr
};
static const uint32_t propsVectors[7230]={
diff --git a/thirdparty/icu4c/common/ucharstrie.cpp b/thirdparty/icu4c/common/ucharstrie.cpp
index 24ab425777..ba9cea7ba3 100644
--- a/thirdparty/icu4c/common/ucharstrie.cpp
+++ b/thirdparty/icu4c/common/ucharstrie.cpp
@@ -30,8 +30,8 @@ UCharsTrie::~UCharsTrie() {
UStringTrieResult
UCharsTrie::current() const {
- const UChar *pos=pos_;
- if(pos==NULL) {
+ const char16_t *pos=pos_;
+ if(pos==nullptr) {
return USTRINGTRIE_NO_MATCH;
} else {
int32_t node;
@@ -59,7 +59,7 @@ UCharsTrie::nextForCodePoint(UChar32 cp) {
}
UStringTrieResult
-UCharsTrie::branchNext(const UChar *pos, int32_t length, int32_t uchar) {
+UCharsTrie::branchNext(const char16_t *pos, int32_t length, int32_t uchar) {
// Branch according to the current unit.
if(length==0) {
length=*pos++;
@@ -121,7 +121,7 @@ UCharsTrie::branchNext(const UChar *pos, int32_t length, int32_t uchar) {
}
UStringTrieResult
-UCharsTrie::nextImpl(const UChar *pos, int32_t uchar) {
+UCharsTrie::nextImpl(const char16_t *pos, int32_t uchar) {
int32_t node=*pos++;
for(;;) {
if(node<kMinLinearMatch) {
@@ -153,8 +153,8 @@ UCharsTrie::nextImpl(const UChar *pos, int32_t uchar) {
UStringTrieResult
UCharsTrie::next(int32_t uchar) {
- const UChar *pos=pos_;
- if(pos==NULL) {
+ const char16_t *pos=pos_;
+ if(pos==nullptr) {
return USTRINGTRIE_NO_MATCH;
}
int32_t length=remainingMatchLength_; // Actual remaining match length minus 1.
@@ -176,13 +176,13 @@ UCharsTrie::next(int32_t uchar) {
UStringTrieResult
UCharsTrie::next(ConstChar16Ptr ptr, int32_t sLength) {
- const UChar *s=ptr;
+ const char16_t *s=ptr;
if(sLength<0 ? *s==0 : sLength==0) {
// Empty input.
return current();
}
- const UChar *pos=pos_;
- if(pos==NULL) {
+ const char16_t *pos=pos_;
+ if(pos==nullptr) {
return USTRINGTRIE_NO_MATCH;
}
int32_t length=remainingMatchLength_; // Actual remaining match length minus 1.
@@ -282,13 +282,13 @@ UCharsTrie::next(ConstChar16Ptr ptr, int32_t sLength) {
}
}
-const UChar *
-UCharsTrie::findUniqueValueFromBranch(const UChar *pos, int32_t length,
+const char16_t *
+UCharsTrie::findUniqueValueFromBranch(const char16_t *pos, int32_t length,
UBool haveUniqueValue, int32_t &uniqueValue) {
while(length>kMaxBranchLinearSubNodeLength) {
++pos; // ignore the comparison unit
- if(NULL==findUniqueValueFromBranch(jumpByDelta(pos), length>>1, haveUniqueValue, uniqueValue)) {
- return NULL;
+ if(nullptr==findUniqueValueFromBranch(jumpByDelta(pos), length>>1, haveUniqueValue, uniqueValue)) {
+ return nullptr;
}
length=length-(length>>1);
pos=skipDelta(pos);
@@ -304,7 +304,7 @@ UCharsTrie::findUniqueValueFromBranch(const UChar *pos, int32_t length,
if(isFinal) {
if(haveUniqueValue) {
if(value!=uniqueValue) {
- return NULL;
+ return nullptr;
}
} else {
uniqueValue=value;
@@ -312,7 +312,7 @@ UCharsTrie::findUniqueValueFromBranch(const UChar *pos, int32_t length,
}
} else {
if(!findUniqueValue(pos+value, haveUniqueValue, uniqueValue)) {
- return NULL;
+ return nullptr;
}
haveUniqueValue=true;
}
@@ -321,7 +321,7 @@ UCharsTrie::findUniqueValueFromBranch(const UChar *pos, int32_t length,
}
UBool
-UCharsTrie::findUniqueValue(const UChar *pos, UBool haveUniqueValue, int32_t &uniqueValue) {
+UCharsTrie::findUniqueValue(const char16_t *pos, UBool haveUniqueValue, int32_t &uniqueValue) {
int32_t node=*pos++;
for(;;) {
if(node<kMinLinearMatch) {
@@ -329,7 +329,7 @@ UCharsTrie::findUniqueValue(const UChar *pos, UBool haveUniqueValue, int32_t &un
node=*pos++;
}
pos=findUniqueValueFromBranch(pos, node+1, haveUniqueValue, uniqueValue);
- if(pos==NULL) {
+ if(pos==nullptr) {
return false;
}
haveUniqueValue=true;
@@ -365,8 +365,8 @@ UCharsTrie::findUniqueValue(const UChar *pos, UBool haveUniqueValue, int32_t &un
int32_t
UCharsTrie::getNextUChars(Appendable &out) const {
- const UChar *pos=pos_;
- if(pos==NULL) {
+ const char16_t *pos=pos_;
+ if(pos==nullptr) {
return 0;
}
if(remainingMatchLength_>=0) {
@@ -397,7 +397,7 @@ UCharsTrie::getNextUChars(Appendable &out) const {
}
void
-UCharsTrie::getNextBranchUChars(const UChar *pos, int32_t length, Appendable &out) {
+UCharsTrie::getNextBranchUChars(const char16_t *pos, int32_t length, Appendable &out) {
while(length>kMaxBranchLinearSubNodeLength) {
++pos; // ignore the comparison unit
getNextBranchUChars(jumpByDelta(pos), length>>1, out);
diff --git a/thirdparty/icu4c/common/ucharstriebuilder.cpp b/thirdparty/icu4c/common/ucharstriebuilder.cpp
index be3260941e..95b32711a8 100644
--- a/thirdparty/icu4c/common/ucharstriebuilder.cpp
+++ b/thirdparty/icu4c/common/ucharstriebuilder.cpp
@@ -47,7 +47,7 @@ public:
return strings[stringOffset];
}
- UChar charAt(int32_t index, const UnicodeString &strings) const {
+ char16_t charAt(int32_t index, const UnicodeString &strings) const {
return strings[stringOffset+1+index];
}
@@ -75,7 +75,7 @@ UCharsTrieElement::setTo(const UnicodeString &s, int32_t val,
return;
}
stringOffset=strings.length();
- strings.append((UChar)length);
+ strings.append((char16_t)length);
value=val;
strings.append(s);
}
@@ -86,8 +86,8 @@ UCharsTrieElement::compareStringTo(const UCharsTrieElement &other, const Unicode
}
UCharsTrieBuilder::UCharsTrieBuilder(UErrorCode & /*errorCode*/)
- : elements(NULL), elementsCapacity(0), elementsLength(0),
- uchars(NULL), ucharsCapacity(0), ucharsLength(0) {}
+ : elements(nullptr), elementsCapacity(0), elementsLength(0),
+ uchars(nullptr), ucharsCapacity(0), ucharsLength(0) {}
UCharsTrieBuilder::~UCharsTrieBuilder() {
delete[] elements;
@@ -112,7 +112,7 @@ UCharsTrieBuilder::add(const UnicodeString &s, int32_t value, UErrorCode &errorC
newCapacity=4*elementsCapacity;
}
UCharsTrieElement *newElements=new UCharsTrieElement[newCapacity];
- if(newElements==NULL) {
+ if(newElements==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return *this;
}
@@ -145,13 +145,13 @@ U_CDECL_END
UCharsTrie *
UCharsTrieBuilder::build(UStringTrieBuildOption buildOption, UErrorCode &errorCode) {
buildUChars(buildOption, errorCode);
- UCharsTrie *newTrie=NULL;
+ UCharsTrie *newTrie=nullptr;
if(U_SUCCESS(errorCode)) {
newTrie=new UCharsTrie(uchars, uchars+(ucharsCapacity-ucharsLength));
- if(newTrie==NULL) {
+ if(newTrie==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
} else {
- uchars=NULL; // The new trie now owns the array.
+ uchars=nullptr; // The new trie now owns the array.
ucharsCapacity=0;
}
}
@@ -173,7 +173,7 @@ UCharsTrieBuilder::buildUChars(UStringTrieBuildOption buildOption, UErrorCode &e
if(U_FAILURE(errorCode)) {
return;
}
- if(uchars!=NULL && ucharsLength>0) {
+ if(uchars!=nullptr && ucharsLength>0) {
// Already built.
return;
}
@@ -204,7 +204,7 @@ UCharsTrieBuilder::buildUChars(UStringTrieBuildOption buildOption, UErrorCode &e
prev.fastCopyFrom(current);
}
}
- // Create and UChar-serialize the trie for the elements.
+ // Create and char16_t-serialize the trie for the elements.
ucharsLength=0;
int32_t capacity=strings.length();
if(capacity<1024) {
@@ -212,8 +212,8 @@ UCharsTrieBuilder::buildUChars(UStringTrieBuildOption buildOption, UErrorCode &e
}
if(ucharsCapacity<capacity) {
uprv_free(uchars);
- uchars=static_cast<UChar *>(uprv_malloc(capacity*2));
- if(uchars==NULL) {
+ uchars=static_cast<char16_t *>(uprv_malloc(capacity*2));
+ if(uchars==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
ucharsCapacity=0;
return;
@@ -221,7 +221,7 @@ UCharsTrieBuilder::buildUChars(UStringTrieBuildOption buildOption, UErrorCode &e
ucharsCapacity=capacity;
}
StringTrieBuilder::build(buildOption, elementsLength, errorCode);
- if(uchars==NULL) {
+ if(uchars==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
}
}
@@ -231,7 +231,7 @@ UCharsTrieBuilder::getElementStringLength(int32_t i) const {
return elements[i].getStringLength(strings);
}
-UChar
+char16_t
UCharsTrieBuilder::getElementUnit(int32_t i, int32_t unitIndex) const {
return elements[i].charAt(unitIndex, strings);
}
@@ -257,7 +257,7 @@ UCharsTrieBuilder::countElementUnits(int32_t start, int32_t limit, int32_t unitI
int32_t length=0; // Number of different units at unitIndex.
int32_t i=start;
do {
- UChar unit=elements[i++].charAt(unitIndex, strings);
+ char16_t unit=elements[i++].charAt(unitIndex, strings);
while(i<limit && unit==elements[i].charAt(unitIndex, strings)) {
++i;
}
@@ -269,7 +269,7 @@ UCharsTrieBuilder::countElementUnits(int32_t start, int32_t limit, int32_t unitI
int32_t
UCharsTrieBuilder::skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t count) const {
do {
- UChar unit=elements[i++].charAt(unitIndex, strings);
+ char16_t unit=elements[i++].charAt(unitIndex, strings);
while(unit==elements[i].charAt(unitIndex, strings)) {
++i;
}
@@ -278,14 +278,14 @@ UCharsTrieBuilder::skipElementsBySomeUnits(int32_t i, int32_t unitIndex, int32_t
}
int32_t
-UCharsTrieBuilder::indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, UChar unit) const {
+UCharsTrieBuilder::indexOfElementWithNextUnit(int32_t i, int32_t unitIndex, char16_t unit) const {
while(unit==elements[i].charAt(unitIndex, strings)) {
++i;
}
return i;
}
-UCharsTrieBuilder::UCTLinearMatchNode::UCTLinearMatchNode(const UChar *units, int32_t len, Node *nextNode)
+UCharsTrieBuilder::UCTLinearMatchNode::UCTLinearMatchNode(const char16_t *units, int32_t len, Node *nextNode)
: LinearMatchNode(len, nextNode), s(units) {
hash=hash*37u+ustr_hashUCharsN(units, len);
}
@@ -298,7 +298,7 @@ UCharsTrieBuilder::UCTLinearMatchNode::operator==(const Node &other) const {
if(!LinearMatchNode::operator==(other)) {
return false;
}
- const UCTLinearMatchNode &o=(const UCTLinearMatchNode &)other;
+ const UCTLinearMatchNode &o=static_cast<const UCTLinearMatchNode &>(other);
return 0==u_memcmp(s, o.s, length);
}
@@ -321,7 +321,7 @@ UCharsTrieBuilder::createLinearMatchNode(int32_t i, int32_t unitIndex, int32_t l
UBool
UCharsTrieBuilder::ensureCapacity(int32_t length) {
- if(uchars==NULL) {
+ if(uchars==nullptr) {
return false; // previous memory allocation had failed
}
if(length>ucharsCapacity) {
@@ -329,11 +329,11 @@ UCharsTrieBuilder::ensureCapacity(int32_t length) {
do {
newCapacity*=2;
} while(newCapacity<=length);
- UChar *newUChars=static_cast<UChar *>(uprv_malloc(newCapacity*2));
- if(newUChars==NULL) {
+ char16_t *newUChars=static_cast<char16_t *>(uprv_malloc(newCapacity*2));
+ if(newUChars==nullptr) {
// unable to allocate memory
uprv_free(uchars);
- uchars=NULL;
+ uchars=nullptr;
ucharsCapacity=0;
return false;
}
@@ -351,13 +351,13 @@ UCharsTrieBuilder::write(int32_t unit) {
int32_t newLength=ucharsLength+1;
if(ensureCapacity(newLength)) {
ucharsLength=newLength;
- uchars[ucharsCapacity-ucharsLength]=(UChar)unit;
+ uchars[ucharsCapacity-ucharsLength]=(char16_t)unit;
}
return ucharsLength;
}
int32_t
-UCharsTrieBuilder::write(const UChar *s, int32_t length) {
+UCharsTrieBuilder::write(const char16_t *s, int32_t length) {
int32_t newLength=ucharsLength+length;
if(ensureCapacity(newLength)) {
ucharsLength=newLength;
@@ -376,22 +376,22 @@ UCharsTrieBuilder::writeValueAndFinal(int32_t i, UBool isFinal) {
if(0<=i && i<=UCharsTrie::kMaxOneUnitValue) {
return write(i|(isFinal<<15));
}
- UChar intUnits[3];
+ char16_t intUnits[3];
int32_t length;
if(i<0 || i>UCharsTrie::kMaxTwoUnitValue) {
- intUnits[0]=(UChar)(UCharsTrie::kThreeUnitValueLead);
- intUnits[1]=(UChar)((uint32_t)i>>16);
- intUnits[2]=(UChar)i;
+ intUnits[0]=(char16_t)(UCharsTrie::kThreeUnitValueLead);
+ intUnits[1]=(char16_t)((uint32_t)i>>16);
+ intUnits[2]=(char16_t)i;
length=3;
// } else if(i<=UCharsTrie::kMaxOneUnitValue) {
- // intUnits[0]=(UChar)(i);
+ // intUnits[0]=(char16_t)(i);
// length=1;
} else {
- intUnits[0]=(UChar)(UCharsTrie::kMinTwoUnitValueLead+(i>>16));
- intUnits[1]=(UChar)i;
+ intUnits[0]=(char16_t)(UCharsTrie::kMinTwoUnitValueLead+(i>>16));
+ intUnits[1]=(char16_t)i;
length=2;
}
- intUnits[0]=(UChar)(intUnits[0]|(isFinal<<15));
+ intUnits[0]=(char16_t)(intUnits[0]|(isFinal<<15));
return write(intUnits, length);
}
@@ -400,22 +400,22 @@ UCharsTrieBuilder::writeValueAndType(UBool hasValue, int32_t value, int32_t node
if(!hasValue) {
return write(node);
}
- UChar intUnits[3];
+ char16_t intUnits[3];
int32_t length;
if(value<0 || value>UCharsTrie::kMaxTwoUnitNodeValue) {
- intUnits[0]=(UChar)(UCharsTrie::kThreeUnitNodeValueLead);
- intUnits[1]=(UChar)((uint32_t)value>>16);
- intUnits[2]=(UChar)value;
+ intUnits[0]=(char16_t)(UCharsTrie::kThreeUnitNodeValueLead);
+ intUnits[1]=(char16_t)((uint32_t)value>>16);
+ intUnits[2]=(char16_t)value;
length=3;
} else if(value<=UCharsTrie::kMaxOneUnitNodeValue) {
- intUnits[0]=(UChar)((value+1)<<6);
+ intUnits[0]=(char16_t)((value+1)<<6);
length=1;
} else {
- intUnits[0]=(UChar)(UCharsTrie::kMinTwoUnitNodeValueLead+((value>>10)&0x7fc0));
- intUnits[1]=(UChar)value;
+ intUnits[0]=(char16_t)(UCharsTrie::kMinTwoUnitNodeValueLead+((value>>10)&0x7fc0));
+ intUnits[1]=(char16_t)value;
length=2;
}
- intUnits[0]|=(UChar)node;
+ intUnits[0]|=(char16_t)node;
return write(intUnits, length);
}
@@ -426,17 +426,17 @@ UCharsTrieBuilder::writeDeltaTo(int32_t jumpTarget) {
if(i<=UCharsTrie::kMaxOneUnitDelta) {
return write(i);
}
- UChar intUnits[3];
+ char16_t intUnits[3];
int32_t length;
if(i<=UCharsTrie::kMaxTwoUnitDelta) {
- intUnits[0]=(UChar)(UCharsTrie::kMinTwoUnitDeltaLead+(i>>16));
+ intUnits[0]=(char16_t)(UCharsTrie::kMinTwoUnitDeltaLead+(i>>16));
length=1;
} else {
- intUnits[0]=(UChar)(UCharsTrie::kThreeUnitDeltaLead);
- intUnits[1]=(UChar)(i>>16);
+ intUnits[0]=(char16_t)(UCharsTrie::kThreeUnitDeltaLead);
+ intUnits[1]=(char16_t)(i>>16);
length=2;
}
- intUnits[length++]=(UChar)i;
+ intUnits[length++]=(char16_t)i;
return write(intUnits, length);
}
diff --git a/thirdparty/icu4c/common/ucharstrieiterator.cpp b/thirdparty/icu4c/common/ucharstrieiterator.cpp
index 2ba43692dd..176aed6825 100644
--- a/thirdparty/icu4c/common/ucharstrieiterator.cpp
+++ b/thirdparty/icu4c/common/ucharstrieiterator.cpp
@@ -27,7 +27,7 @@ UCharsTrie::Iterator::Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLengt
pos_(uchars_), initialPos_(uchars_),
remainingMatchLength_(-1), initialRemainingMatchLength_(-1),
skipValue_(false),
- maxLength_(maxStringLength), value_(0), stack_(NULL) {
+ maxLength_(maxStringLength), value_(0), stack_(nullptr) {
if(U_FAILURE(errorCode)) {
return;
}
@@ -38,7 +38,7 @@ UCharsTrie::Iterator::Iterator(ConstChar16Ptr trieUChars, int32_t maxStringLengt
// via the UnicodeString and UVector32 implementations, so this additional
// cost is minimal.
stack_=new UVector32(errorCode);
- if(stack_==NULL) {
+ if(stack_==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
}
}
@@ -49,7 +49,7 @@ UCharsTrie::Iterator::Iterator(const UCharsTrie &trie, int32_t maxStringLength,
remainingMatchLength_(trie.remainingMatchLength_),
initialRemainingMatchLength_(trie.remainingMatchLength_),
skipValue_(false),
- maxLength_(maxStringLength), value_(0), stack_(NULL) {
+ maxLength_(maxStringLength), value_(0), stack_(nullptr) {
if(U_FAILURE(errorCode)) {
return;
}
@@ -57,7 +57,7 @@ UCharsTrie::Iterator::Iterator(const UCharsTrie &trie, int32_t maxStringLength,
if(U_FAILURE(errorCode)) {
return;
}
- if(stack_==NULL) {
+ if(stack_==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -95,15 +95,15 @@ UCharsTrie::Iterator::reset() {
}
UBool
-UCharsTrie::Iterator::hasNext() const { return pos_!=NULL || !stack_->isEmpty(); }
+UCharsTrie::Iterator::hasNext() const { return pos_!=nullptr || !stack_->isEmpty(); }
UBool
UCharsTrie::Iterator::next(UErrorCode &errorCode) {
if(U_FAILURE(errorCode)) {
return false;
}
- const UChar *pos=pos_;
- if(pos==NULL) {
+ const char16_t *pos=pos_;
+ if(pos==nullptr) {
if(stack_->isEmpty()) {
return false;
}
@@ -117,7 +117,7 @@ UCharsTrie::Iterator::next(UErrorCode &errorCode) {
length=(int32_t)((uint32_t)length>>16);
if(length>1) {
pos=branchNext(pos, length, errorCode);
- if(pos==NULL) {
+ if(pos==nullptr) {
return true; // Reached a final value.
}
} else {
@@ -145,7 +145,7 @@ UCharsTrie::Iterator::next(UErrorCode &errorCode) {
value_=readNodeValue(pos, node);
}
if(isFinal || (maxLength_>0 && str_.length()==maxLength_)) {
- pos_=NULL;
+ pos_=nullptr;
} else {
// We cannot skip the value right here because it shares its
// lead unit with a match node which we have to evaluate
@@ -165,7 +165,7 @@ UCharsTrie::Iterator::next(UErrorCode &errorCode) {
node=*pos++;
}
pos=branchNext(pos, node+1, errorCode);
- if(pos==NULL) {
+ if(pos==nullptr) {
return true; // Reached a final value.
}
} else {
@@ -182,8 +182,8 @@ UCharsTrie::Iterator::next(UErrorCode &errorCode) {
}
// Branch node, needs to take the first outbound edge and push state for the rest.
-const UChar *
-UCharsTrie::Iterator::branchNext(const UChar *pos, int32_t length, UErrorCode &errorCode) {
+const char16_t *
+UCharsTrie::Iterator::branchNext(const char16_t *pos, int32_t length, UErrorCode &errorCode) {
while(length>kMaxBranchLinearSubNodeLength) {
++pos; // ignore the comparison unit
// Push state for the greater-or-equal edge.
@@ -195,7 +195,7 @@ UCharsTrie::Iterator::branchNext(const UChar *pos, int32_t length, UErrorCode &e
}
// List of key-value pairs where values are either final values or jump deltas.
// Read the first (key, value) pair.
- UChar trieUnit=*pos++;
+ char16_t trieUnit=*pos++;
int32_t node=*pos++;
UBool isFinal=(UBool)(node>>15);
int32_t value=readValue(pos, node&=0x7fff);
@@ -204,9 +204,9 @@ UCharsTrie::Iterator::branchNext(const UChar *pos, int32_t length, UErrorCode &e
stack_->addElement(((length-1)<<16)|str_.length(), errorCode);
str_.append(trieUnit);
if(isFinal) {
- pos_=NULL;
+ pos_=nullptr;
value_=value;
- return NULL;
+ return nullptr;
} else {
return pos+value;
}
diff --git a/thirdparty/icu4c/common/uchriter.cpp b/thirdparty/icu4c/common/uchriter.cpp
index f2a9953841..a7d30977e0 100644
--- a/thirdparty/icu4c/common/uchriter.cpp
+++ b/thirdparty/icu4c/common/uchriter.cpp
@@ -75,7 +75,7 @@ UCharCharacterIterator::operator==(const ForwardCharacterIterator& that) const {
return false;
}
- UCharCharacterIterator& realThat = (UCharCharacterIterator&)that;
+ const UCharCharacterIterator& realThat = static_cast<const UCharCharacterIterator&>(that);
return text == realThat.text
&& textLength == realThat.textLength
@@ -94,7 +94,7 @@ UCharCharacterIterator::clone() const {
return new UCharCharacterIterator(*this);
}
-UChar
+char16_t
UCharCharacterIterator::first() {
pos = begin;
if(pos < end) {
@@ -104,7 +104,7 @@ UCharCharacterIterator::first() {
}
}
-UChar
+char16_t
UCharCharacterIterator::firstPostInc() {
pos = begin;
if(pos < end) {
@@ -114,7 +114,7 @@ UCharCharacterIterator::firstPostInc() {
}
}
-UChar
+char16_t
UCharCharacterIterator::last() {
pos = end;
if(pos > begin) {
@@ -124,7 +124,7 @@ UCharCharacterIterator::last() {
}
}
-UChar
+char16_t
UCharCharacterIterator::setIndex(int32_t position) {
if(position < begin) {
pos = begin;
@@ -140,7 +140,7 @@ UCharCharacterIterator::setIndex(int32_t position) {
}
}
-UChar
+char16_t
UCharCharacterIterator::current() const {
if (pos >= begin && pos < end) {
return text[pos];
@@ -149,7 +149,7 @@ UCharCharacterIterator::current() const {
}
}
-UChar
+char16_t
UCharCharacterIterator::next() {
if (pos + 1 < end) {
return text[++pos];
@@ -160,7 +160,7 @@ UCharCharacterIterator::next() {
}
}
-UChar
+char16_t
UCharCharacterIterator::nextPostInc() {
if (pos < end) {
return text[pos++];
@@ -174,7 +174,7 @@ UCharCharacterIterator::hasNext() {
return (UBool)(pos < end ? true : false);
}
-UChar
+char16_t
UCharCharacterIterator::previous() {
if (pos > begin) {
return text[--pos];
diff --git a/thirdparty/icu4c/common/ucln_cmn.cpp b/thirdparty/icu4c/common/ucln_cmn.cpp
index ea797d1344..c63bd22192 100644
--- a/thirdparty/icu4c/common/ucln_cmn.cpp
+++ b/thirdparty/icu4c/common/ucln_cmn.cpp
@@ -37,11 +37,11 @@ static cleanupFunc *gLibCleanupFunctions[UCLN_COMMON];
Please be sure that you have read ucln.h
************************************************/
U_CAPI void U_EXPORT2
-u_cleanup(void)
+u_cleanup()
{
UTRACE_ENTRY_OC(UTRACE_U_CLEANUP);
- icu::umtx_lock(NULL); /* Force a memory barrier, so that we are sure to see */
- icu::umtx_unlock(NULL); /* all state left around by any other threads. */
+ icu::umtx_lock(nullptr); /* Force a memory barrier, so that we are sure to see */
+ icu::umtx_unlock(nullptr); /* all state left around by any other threads. */
ucln_lib_cleanup();
@@ -57,7 +57,7 @@ U_CAPI void U_EXPORT2 ucln_cleanupOne(ECleanupLibraryType libType)
if (gLibCleanupFunctions[libType])
{
gLibCleanupFunctions[libType]();
- gLibCleanupFunctions[libType] = NULL;
+ gLibCleanupFunctions[libType] = nullptr;
}
}
@@ -102,7 +102,7 @@ ucln_registerCleanup(ECleanupLibraryType type,
}
}
-U_CFUNC UBool ucln_lib_cleanup(void) {
+U_CFUNC UBool ucln_lib_cleanup() {
int32_t libType = UCLN_START;
int32_t commonFunc = UCLN_COMMON_START;
@@ -114,7 +114,7 @@ U_CFUNC UBool ucln_lib_cleanup(void) {
if (gCommonCleanupFunctions[commonFunc])
{
gCommonCleanupFunctions[commonFunc]();
- gCommonCleanupFunctions[commonFunc] = NULL;
+ gCommonCleanupFunctions[commonFunc] = nullptr;
}
}
#if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
diff --git a/thirdparty/icu4c/common/ucmndata.cpp b/thirdparty/icu4c/common/ucmndata.cpp
index 4215d66257..69575d4e83 100644
--- a/thirdparty/icu4c/common/ucmndata.cpp
+++ b/thirdparty/icu4c/common/ucmndata.cpp
@@ -34,7 +34,7 @@
U_CFUNC uint16_t
udata_getHeaderSize(const DataHeader *udh) {
- if(udh==NULL) {
+ if(udh==nullptr) {
return 0;
} else if(udh->info.isBigEndian==U_IS_BIG_ENDIAN) {
/* same endianness */
@@ -48,7 +48,7 @@ udata_getHeaderSize(const DataHeader *udh) {
U_CFUNC uint16_t
udata_getInfoSize(const UDataInfo *info) {
- if(info==NULL) {
+ if(info==nullptr) {
return 0;
} else if(info->isBigEndian==U_IS_BIG_ENDIAN) {
/* same endianness */
@@ -216,7 +216,7 @@ static uint32_t U_CALLCONV
offsetTOCEntryCount(const UDataMemory *pData) {
int32_t retVal=0;
const UDataOffsetTOC *toc = (UDataOffsetTOC *)pData->toc;
- if (toc != NULL) {
+ if (toc != nullptr) {
retVal = toc->count;
}
return retVal;
@@ -229,7 +229,7 @@ offsetTOCLookupFn(const UDataMemory *pData,
UErrorCode *pErrorCode) {
(void)pErrorCode;
const UDataOffsetTOC *toc = (UDataOffsetTOC *)pData->toc;
- if(toc!=NULL) {
+ if(toc!=nullptr) {
const char *base=(const char *)toc;
int32_t number, count=(int32_t)toc->count;
@@ -257,7 +257,7 @@ offsetTOCLookupFn(const UDataMemory *pData,
#ifdef UDATA_DEBUG
fprintf(stderr, "%s: Not found.\n", tocEntryName);
#endif
- return NULL;
+ return nullptr;
}
} else {
#ifdef UDATA_DEBUG
@@ -271,7 +271,7 @@ offsetTOCLookupFn(const UDataMemory *pData,
static uint32_t U_CALLCONV pointerTOCEntryCount(const UDataMemory *pData) {
const PointerTOC *toc = (PointerTOC *)pData->toc;
- return (uint32_t)((toc != NULL) ? (toc->count) : 0);
+ return (uint32_t)((toc != nullptr) ? (toc->count) : 0);
}
static const DataHeader * U_CALLCONV pointerTOCLookupFn(const UDataMemory *pData,
@@ -279,7 +279,7 @@ static const DataHeader * U_CALLCONV pointerTOCLookupFn(const UDataMemory *pData
int32_t *pLength,
UErrorCode *pErrorCode) {
(void)pErrorCode;
- if(pData->toc!=NULL) {
+ if(pData->toc!=nullptr) {
const PointerTOC *toc = (PointerTOC *)pData->toc;
int32_t number, count=(int32_t)toc->count;
@@ -301,7 +301,7 @@ static const DataHeader * U_CALLCONV pointerTOCLookupFn(const UDataMemory *pData
#ifdef UDATA_DEBUG
fprintf(stderr, "%s: Not found.\n", name);
#endif
- return NULL;
+ return nullptr;
}
} else {
return pData->pHeader;
@@ -328,7 +328,7 @@ U_CFUNC void udata_checkCommonData(UDataMemory *udm, UErrorCode *err) {
return;
}
- if(udm==NULL || udm->pHeader==NULL) {
+ if(udm==nullptr || udm->pHeader==nullptr) {
*err=U_INVALID_FORMAT_ERROR;
} else if(!(udm->pHeader->dataHeader.magic1==0xda &&
udm->pHeader->dataHeader.magic2==0x27 &&
diff --git a/thirdparty/icu4c/common/ucnv.cpp b/thirdparty/icu4c/common/ucnv.cpp
index 26baa550c3..a7a07d65d6 100644
--- a/thirdparty/icu4c/common/ucnv.cpp
+++ b/thirdparty/icu4c/common/ucnv.cpp
@@ -48,7 +48,7 @@
typedef struct UAmbiguousConverter {
const char *name;
- const UChar variant5c;
+ const char16_t variant5c;
} UAmbiguousConverter;
static const UAmbiguousConverter ambiguousConverters[]={
@@ -75,11 +75,11 @@ ucnv_open (const char *name,
{
UConverter *r;
- if (err == NULL || U_FAILURE (*err)) {
- return NULL;
+ if (err == nullptr || U_FAILURE (*err)) {
+ return nullptr;
}
- r = ucnv_createConverter(NULL, name, err);
+ r = ucnv_createConverter(nullptr, name, err);
return r;
}
@@ -89,21 +89,21 @@ ucnv_openPackage (const char *packageName, const char *converterName, UErrorCo
return ucnv_createConverterFromPackage(packageName, converterName, err);
}
-/*Extracts the UChar* to a char* and calls through createConverter */
+/*Extracts the char16_t* to a char* and calls through createConverter */
U_CAPI UConverter* U_EXPORT2
-ucnv_openU (const UChar * name,
+ucnv_openU (const char16_t * name,
UErrorCode * err)
{
char asciiName[UCNV_MAX_CONVERTER_NAME_LENGTH];
- if (err == NULL || U_FAILURE(*err))
- return NULL;
- if (name == NULL)
- return ucnv_open (NULL, err);
+ if (err == nullptr || U_FAILURE(*err))
+ return nullptr;
+ if (name == nullptr)
+ return ucnv_open (nullptr, err);
if (u_strlen(name) >= UCNV_MAX_CONVERTER_NAME_LENGTH)
{
*err = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
return ucnv_open(u_austrcpy(asciiName, name), err);
}
@@ -140,14 +140,14 @@ ucnv_openCCSID (int32_t codepage,
char myName[UCNV_MAX_CONVERTER_NAME_LENGTH];
int32_t myNameLen;
- if (err == NULL || U_FAILURE (*err))
- return NULL;
+ if (err == nullptr || U_FAILURE (*err))
+ return nullptr;
/* ucnv_copyPlatformString could return "ibm-" or "cp" */
myNameLen = ucnv_copyPlatformString(myName, platform);
T_CString_integerToString(myName + myNameLen, codepage, 10);
- return ucnv_createConverter(NULL, myName, err);
+ return ucnv_createConverter(nullptr, myName, err);
}
/* Creating a temporary stack-based object that can be used in one thread,
@@ -164,47 +164,47 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
UConverterToUnicodeArgs toUArgs = {
sizeof(UConverterToUnicodeArgs),
true,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr
};
UConverterFromUnicodeArgs fromUArgs = {
sizeof(UConverterFromUnicodeArgs),
true,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr
};
UTRACE_ENTRY_OC(UTRACE_UCNV_CLONE);
- if (status == NULL || U_FAILURE(*status)){
+ if (status == nullptr || U_FAILURE(*status)){
UTRACE_EXIT_STATUS(status? *status: U_ILLEGAL_ARGUMENT_ERROR);
- return NULL;
+ return nullptr;
}
- if (cnv == NULL) {
+ if (cnv == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
UTRACE_EXIT_STATUS(*status);
- return NULL;
+ return nullptr;
}
UTRACE_DATA3(UTRACE_OPEN_CLOSE, "clone converter %s at %p into stackBuffer %p",
ucnv_getName(cnv, status), cnv, stackBuffer);
- if (cnv->sharedData->impl->safeClone != NULL) {
+ if (cnv->sharedData->impl->safeClone != nullptr) {
/* call the custom safeClone function for sizing */
bufferSizeNeeded = 0;
- cnv->sharedData->impl->safeClone(cnv, NULL, &bufferSizeNeeded, status);
+ cnv->sharedData->impl->safeClone(cnv, nullptr, &bufferSizeNeeded, status);
if (U_FAILURE(*status)) {
UTRACE_EXIT_STATUS(*status);
- return NULL;
+ return nullptr;
}
}
else
@@ -213,7 +213,7 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
bufferSizeNeeded = sizeof(UConverter);
}
- if (pBufferSize == NULL) {
+ if (pBufferSize == nullptr) {
stackBufferSize = 1;
pBufferSize = &stackBufferSize;
} else {
@@ -221,7 +221,7 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
if (stackBufferSize <= 0){ /* 'preflighting' request - set needed size into *pBufferSize */
*pBufferSize = bufferSizeNeeded;
UTRACE_EXIT_VALUE(bufferSizeNeeded);
- return NULL;
+ return nullptr;
}
}
@@ -242,17 +242,17 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
}
/* Now, see if we must allocate any memory */
- if (stackBufferSize < bufferSizeNeeded || stackBuffer == NULL)
+ if (stackBufferSize < bufferSizeNeeded || stackBuffer == nullptr)
{
/* allocate one here...*/
localConverter = allocatedConverter = (UConverter *) uprv_malloc (bufferSizeNeeded);
- if(localConverter == NULL) {
+ if(localConverter == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
UTRACE_EXIT_STATUS(*status);
- return NULL;
+ return nullptr;
}
- // If pBufferSize was NULL as the input, pBufferSize is set to &stackBufferSize in this function.
+ // If pBufferSize was nullptr as the input, pBufferSize is set to &stackBufferSize in this function.
if (pBufferSize != &stackBufferSize) {
*status = U_SAFECLONE_ALLOCATED_WARNING;
}
@@ -262,7 +262,7 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
} else {
/* just use the stack buffer */
localConverter = (UConverter*) stackBuffer;
- allocatedConverter = NULL;
+ allocatedConverter = nullptr;
}
uprv_memset(localConverter, 0, bufferSizeNeeded);
@@ -276,27 +276,27 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
localConverter->subChars = (uint8_t *)localConverter->subUChars;
} else {
localConverter->subChars = (uint8_t *)uprv_malloc(UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
- if (localConverter->subChars == NULL) {
+ if (localConverter->subChars == nullptr) {
uprv_free(allocatedConverter);
UTRACE_EXIT_STATUS(*status);
- return NULL;
+ return nullptr;
}
uprv_memcpy(localConverter->subChars, cnv->subChars, UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
}
/* now either call the safeclone fcn or not */
- if (cnv->sharedData->impl->safeClone != NULL) {
+ if (cnv->sharedData->impl->safeClone != nullptr) {
/* call the custom safeClone function */
localConverter = cnv->sharedData->impl->safeClone(cnv, localConverter, pBufferSize, status);
}
- if(localConverter==NULL || U_FAILURE(*status)) {
- if (allocatedConverter != NULL && allocatedConverter->subChars != (uint8_t *)allocatedConverter->subUChars) {
+ if(localConverter==nullptr || U_FAILURE(*status)) {
+ if (allocatedConverter != nullptr && allocatedConverter->subChars != (uint8_t *)allocatedConverter->subUChars) {
uprv_free(allocatedConverter->subChars);
}
uprv_free(allocatedConverter);
UTRACE_EXIT_STATUS(*status);
- return NULL;
+ return nullptr;
}
/* increment refcount of shared data if needed */
@@ -312,9 +312,9 @@ ucnv_safeClone(const UConverter* cnv, void *stackBuffer, int32_t *pBufferSize, U
/* allow callback functions to handle any memory allocation */
toUArgs.converter = fromUArgs.converter = localConverter;
cbErr = U_ZERO_ERROR;
- cnv->fromCharErrorBehaviour(cnv->toUContext, &toUArgs, NULL, 0, UCNV_CLONE, &cbErr);
+ cnv->fromCharErrorBehaviour(cnv->toUContext, &toUArgs, nullptr, 0, UCNV_CLONE, &cbErr);
cbErr = U_ZERO_ERROR;
- cnv->fromUCharErrorBehaviour(cnv->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_CLONE, &cbErr);
+ cnv->fromUCharErrorBehaviour(cnv->fromUContext, &fromUArgs, nullptr, 0, 0, UCNV_CLONE, &cbErr);
UTRACE_EXIT_PTR_STATUS(localConverter, *status);
return localConverter;
@@ -336,7 +336,7 @@ ucnv_close (UConverter * converter)
UTRACE_ENTRY_OC(UTRACE_UCNV_CLOSE);
- if (converter == NULL)
+ if (converter == nullptr)
{
UTRACE_EXIT();
return;
@@ -353,35 +353,35 @@ ucnv_close (UConverter * converter)
UConverterToUnicodeArgs toUArgs = {
sizeof(UConverterToUnicodeArgs),
true,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr
};
toUArgs.converter = converter;
errorCode = U_ZERO_ERROR;
- converter->fromCharErrorBehaviour(converter->toUContext, &toUArgs, NULL, 0, UCNV_CLOSE, &errorCode);
+ converter->fromCharErrorBehaviour(converter->toUContext, &toUArgs, nullptr, 0, UCNV_CLOSE, &errorCode);
}
if (converter->fromUCharErrorBehaviour != UCNV_FROM_U_DEFAULT_CALLBACK) {
UConverterFromUnicodeArgs fromUArgs = {
sizeof(UConverterFromUnicodeArgs),
true,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr
};
fromUArgs.converter = converter;
errorCode = U_ZERO_ERROR;
- converter->fromUCharErrorBehaviour(converter->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_CLOSE, &errorCode);
+ converter->fromUCharErrorBehaviour(converter->fromUContext, &fromUArgs, nullptr, 0, 0, UCNV_CLOSE, &errorCode);
}
- if (converter->sharedData->impl->close != NULL) {
+ if (converter->sharedData->impl->close != nullptr) {
converter->sharedData->impl->close(converter);
}
@@ -400,7 +400,7 @@ ucnv_close (UConverter * converter)
UTRACE_EXIT();
}
-/*returns a single Name from the list, will return NULL if out of bounds
+/*returns a single Name from the list, will return nullptr if out of bounds
*/
U_CAPI const char* U_EXPORT2
ucnv_getAvailableName (int32_t n)
@@ -412,7 +412,7 @@ ucnv_getAvailableName (int32_t n)
return name;
}
}
- return NULL;
+ return nullptr;
}
U_CAPI int32_t U_EXPORT2
@@ -479,7 +479,7 @@ ucnv_setSubstChars (UConverter * converter,
U_CAPI void U_EXPORT2
ucnv_setSubstString(UConverter *cnv,
- const UChar *s,
+ const char16_t *s,
int32_t length,
UErrorCode *err) {
alignas(UConverter) char cloneBuffer[U_CNV_SAFECLONE_BUFFERSIZE];
@@ -492,14 +492,14 @@ ucnv_setSubstString(UConverter *cnv,
/* Let the following functions check all arguments. */
cloneSize = sizeof(cloneBuffer);
clone = ucnv_safeClone(cnv, cloneBuffer, &cloneSize, err);
- ucnv_setFromUCallBack(clone, UCNV_FROM_U_CALLBACK_STOP, NULL, NULL, NULL, err);
+ ucnv_setFromUCallBack(clone, UCNV_FROM_U_CALLBACK_STOP, nullptr, nullptr, nullptr, err);
length8 = ucnv_fromUChars(clone, chars, (int32_t)sizeof(chars), s, length, err);
ucnv_close(clone);
if (U_FAILURE(*err)) {
return;
}
- if (cnv->sharedData->impl->writeSub == NULL
+ if (cnv->sharedData->impl->writeSub == nullptr
#if !UCONFIG_NO_LEGACY_CONVERSION
|| (cnv->sharedData->staticData->conversionType == UCNV_MBCS &&
ucnv_MBCSGetType(cnv) != UCNV_EBCDIC_STATEFUL)
@@ -517,7 +517,7 @@ ucnv_setSubstString(UConverter *cnv,
if (length > UCNV_ERROR_BUFFER_LENGTH) {
/*
* Should not occur. The converter should output at least one byte
- * per UChar, which means that ucnv_fromUChars() should catch all
+ * per char16_t, which means that ucnv_fromUChars() should catch all
* overflows.
*/
*err = U_BUFFER_OVERFLOW_ERROR;
@@ -539,7 +539,7 @@ ucnv_setSubstString(UConverter *cnv,
if (cnv->subChars == (uint8_t *)cnv->subUChars) {
/* Allocate a new buffer for the string. */
cnv->subChars = (uint8_t *)uprv_malloc(UCNV_ERROR_BUFFER_LENGTH * U_SIZEOF_UCHAR);
- if (cnv->subChars == NULL) {
+ if (cnv->subChars == nullptr) {
cnv->subChars = (uint8_t *)cnv->subUChars;
*err = U_MEMORY_ALLOCATION_ERROR;
return;
@@ -569,7 +569,7 @@ ucnv_setSubstString(UConverter *cnv,
*/
static void _reset(UConverter *converter, UConverterResetChoice choice,
UBool callCallback) {
- if(converter == NULL) {
+ if(converter == nullptr) {
return;
}
@@ -581,31 +581,31 @@ static void _reset(UConverter *converter, UConverterResetChoice choice,
UConverterToUnicodeArgs toUArgs = {
sizeof(UConverterToUnicodeArgs),
true,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr
};
toUArgs.converter = converter;
errorCode = U_ZERO_ERROR;
- converter->fromCharErrorBehaviour(converter->toUContext, &toUArgs, NULL, 0, UCNV_RESET, &errorCode);
+ converter->fromCharErrorBehaviour(converter->toUContext, &toUArgs, nullptr, 0, UCNV_RESET, &errorCode);
}
if(choice!=UCNV_RESET_TO_UNICODE && converter->fromUCharErrorBehaviour != UCNV_FROM_U_DEFAULT_CALLBACK) {
UConverterFromUnicodeArgs fromUArgs = {
sizeof(UConverterFromUnicodeArgs),
true,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr
};
fromUArgs.converter = converter;
errorCode = U_ZERO_ERROR;
- converter->fromUCharErrorBehaviour(converter->fromUContext, &fromUArgs, NULL, 0, 0, UCNV_RESET, &errorCode);
+ converter->fromUCharErrorBehaviour(converter->fromUContext, &fromUArgs, nullptr, 0, 0, UCNV_RESET, &errorCode);
}
}
@@ -625,7 +625,7 @@ static void _reset(UConverter *converter, UConverterResetChoice choice,
converter->preFromULength = 0;
}
- if (converter->sharedData->impl->reset != NULL) {
+ if (converter->sharedData->impl->reset != nullptr) {
/* call the custom reset function */
converter->sharedData->impl->reset(converter, choice);
}
@@ -667,7 +667,7 @@ ucnv_getName (const UConverter * converter, UErrorCode * err)
{
if (U_FAILURE (*err))
- return NULL;
+ return nullptr;
if(converter->sharedData->impl->getName){
const char* temp= converter->sharedData->impl->getName(converter);
if(temp)
@@ -833,7 +833,7 @@ static void
_fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
UConverterFromUnicode fromUnicode;
UConverter *cnv;
- const UChar *s;
+ const char16_t *s;
char *t;
int32_t *offsets;
int32_t sourceIndex;
@@ -841,8 +841,8 @@ _fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
UBool converterSawEndOfInput, calledCallback;
/* variables for m:n conversion */
- UChar replay[UCNV_EXT_MAX_UCHARS];
- const UChar *realSource, *realSourceLimit;
+ char16_t replay[UCNV_EXT_MAX_UCHARS];
+ const char16_t *realSource, *realSourceLimit;
int32_t realSourceIndex;
UBool realFlush;
@@ -853,11 +853,11 @@ _fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
/* get the converter implementation function */
sourceIndex=0;
- if(offsets==NULL) {
+ if(offsets==nullptr) {
fromUnicode=cnv->sharedData->impl->fromUnicode;
} else {
fromUnicode=cnv->sharedData->impl->fromUnicodeWithOffsets;
- if(fromUnicode==NULL) {
+ if(fromUnicode==nullptr) {
/* there is no WithOffsets implementation */
fromUnicode=cnv->sharedData->impl->fromUnicode;
/* we will write -1 for each offset */
@@ -867,10 +867,10 @@ _fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
if(cnv->preFromULength>=0) {
/* normal mode */
- realSource=NULL;
+ realSource=nullptr;
/* avoid compiler warnings - not otherwise necessary, and the values do not matter */
- realSourceLimit=NULL;
+ realSourceLimit=nullptr;
realFlush=false;
realSourceIndex=0;
} else {
@@ -942,7 +942,7 @@ _fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
*/
for(;;) {
/* update offsets if we write any */
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
int32_t length=(int32_t)(pArgs->target-t);
if(length>0) {
_updateOffsets(offsets, length, sourceIndex, errorInputLength);
@@ -967,7 +967,7 @@ _fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
* switch the source to new replay units (cannot occur while replaying)
* after offset handling and before end-of-input and callback handling
*/
- if(realSource==NULL) {
+ if(realSource==nullptr) {
realSource=pArgs->source;
realSourceLimit=pArgs->sourceLimit;
realFlush=pArgs->flush;
@@ -984,7 +984,7 @@ _fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
cnv->preFromULength=0;
} else {
/* see implementation note before _fromUnicodeWithCallback() */
- U_ASSERT(realSource==NULL);
+ U_ASSERT(realSource==nullptr);
*err=U_INTERNAL_PROGRAM_ERROR;
}
}
@@ -1000,14 +1000,14 @@ _fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
* (continue converting by breaking out of only the inner loop)
*/
break;
- } else if(realSource!=NULL) {
+ } else if(realSource!=nullptr) {
/* switch back from replaying to the real source and continue */
pArgs->source=realSource;
pArgs->sourceLimit=realSourceLimit;
pArgs->flush=realFlush;
sourceIndex=realSourceIndex;
- realSource=NULL;
+ realSource=nullptr;
break;
} else if(pArgs->flush && cnv->fromUChar32!=0) {
/*
@@ -1063,7 +1063,7 @@ _fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
* copied back into the UConverter
* and the real arguments must be restored
*/
- if(realSource!=NULL) {
+ if(realSource!=nullptr) {
int32_t length;
U_ASSERT(cnv->preFromULength==0);
@@ -1130,10 +1130,10 @@ ucnv_outputOverflowFromUnicode(UConverter *cnv,
int32_t i, length;
t=*target;
- if(pOffsets!=NULL) {
+ if(pOffsets!=nullptr) {
offsets=*pOffsets;
} else {
- offsets=NULL;
+ offsets=nullptr;
}
overflow=(char *)cnv->charErrorBuffer;
@@ -1150,7 +1150,7 @@ ucnv_outputOverflowFromUnicode(UConverter *cnv,
cnv->charErrorBufferLength=(int8_t)j;
*target=t;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*pOffsets=offsets;
}
*err=U_BUFFER_OVERFLOW_ERROR;
@@ -1159,7 +1159,7 @@ ucnv_outputOverflowFromUnicode(UConverter *cnv,
/* copy the overflow contents to the target */
*t++=overflow[i++];
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=-1; /* no source index available for old output */
}
}
@@ -1167,7 +1167,7 @@ ucnv_outputOverflowFromUnicode(UConverter *cnv,
/* the overflow buffer is completely copied to the target */
cnv->charErrorBufferLength=0;
*target=t;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*pOffsets=offsets;
}
return false;
@@ -1176,20 +1176,20 @@ ucnv_outputOverflowFromUnicode(UConverter *cnv,
U_CAPI void U_EXPORT2
ucnv_fromUnicode(UConverter *cnv,
char **target, const char *targetLimit,
- const UChar **source, const UChar *sourceLimit,
+ const char16_t **source, const char16_t *sourceLimit,
int32_t *offsets,
UBool flush,
UErrorCode *err) {
UConverterFromUnicodeArgs args;
- const UChar *s;
+ const char16_t *s;
char *t;
/* check parameters */
- if(err==NULL || U_FAILURE(*err)) {
+ if(err==nullptr || U_FAILURE(*err)) {
return;
}
- if(cnv==NULL || target==NULL || source==NULL) {
+ if(cnv==nullptr || target==nullptr || source==nullptr) {
*err=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -1200,10 +1200,10 @@ ucnv_fromUnicode(UConverter *cnv,
if ((const void *)U_MAX_PTR(sourceLimit) == (const void *)sourceLimit) {
/*
Prevent code from going into an infinite loop in case we do hit this
- limit. The limit pointer is expected to be on a UChar * boundary.
+ limit. The limit pointer is expected to be on a char16_t * boundary.
This also prevents the next argument check from failing.
*/
- sourceLimit = (const UChar *)(((const char *)sourceLimit) - 1);
+ sourceLimit = (const char16_t *)(((const char *)sourceLimit) - 1);
}
/*
@@ -1222,8 +1222,8 @@ ucnv_fromUnicode(UConverter *cnv,
* consumed or the target filled (unless an error occurs).
* An adjustment would be targetLimit=t+0x7fffffff; for example.
*
- * 3) Make sure that the user didn't incorrectly cast a UChar * pointer
- * to a char * pointer and provide an incomplete UChar code unit.
+ * 3) Make sure that the user didn't incorrectly cast a char16_t * pointer
+ * to a char * pointer and provide an incomplete char16_t code unit.
*/
if (sourceLimit<s || targetLimit<t ||
((size_t)(sourceLimit-s)>(size_t)0x3fffffff && sourceLimit>s) ||
@@ -1279,7 +1279,7 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
UConverterToUnicode toUnicode;
UConverter *cnv;
const char *s;
- UChar *t;
+ char16_t *t;
int32_t *offsets;
int32_t sourceIndex;
int32_t errorInputLength;
@@ -1298,11 +1298,11 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
/* get the converter implementation function */
sourceIndex=0;
- if(offsets==NULL) {
+ if(offsets==nullptr) {
toUnicode=cnv->sharedData->impl->toUnicode;
} else {
toUnicode=cnv->sharedData->impl->toUnicodeWithOffsets;
- if(toUnicode==NULL) {
+ if(toUnicode==nullptr) {
/* there is no WithOffsets implementation */
toUnicode=cnv->sharedData->impl->toUnicode;
/* we will write -1 for each offset */
@@ -1312,10 +1312,10 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
if(cnv->preToULength>=0) {
/* normal mode */
- realSource=NULL;
+ realSource=nullptr;
/* avoid compiler warnings - not otherwise necessary, and the values do not matter */
- realSourceLimit=NULL;
+ realSourceLimit=nullptr;
realFlush=false;
realSourceIndex=0;
} else {
@@ -1387,7 +1387,7 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
*/
for(;;) {
/* update offsets if we write any */
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
int32_t length=(int32_t)(pArgs->target-t);
if(length>0) {
_updateOffsets(offsets, length, sourceIndex, errorInputLength);
@@ -1412,7 +1412,7 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
* switch the source to new replay units (cannot occur while replaying)
* after offset handling and before end-of-input and callback handling
*/
- if(realSource==NULL) {
+ if(realSource==nullptr) {
realSource=pArgs->source;
realSourceLimit=pArgs->sourceLimit;
realFlush=pArgs->flush;
@@ -1429,7 +1429,7 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
cnv->preToULength=0;
} else {
/* see implementation note before _fromUnicodeWithCallback() */
- U_ASSERT(realSource==NULL);
+ U_ASSERT(realSource==nullptr);
*err=U_INTERNAL_PROGRAM_ERROR;
}
}
@@ -1445,14 +1445,14 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
* (continue converting by breaking out of only the inner loop)
*/
break;
- } else if(realSource!=NULL) {
+ } else if(realSource!=nullptr) {
/* switch back from replaying to the real source and continue */
pArgs->source=realSource;
pArgs->sourceLimit=realSourceLimit;
pArgs->flush=realFlush;
sourceIndex=realSourceIndex;
- realSource=NULL;
+ realSource=nullptr;
break;
} else if(pArgs->flush && cnv->toULength>0) {
/*
@@ -1510,7 +1510,7 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
* copied back into the UConverter
* and the real arguments must be restored
*/
- if(realSource!=NULL) {
+ if(realSource!=nullptr) {
int32_t length;
U_ASSERT(cnv->preToULength==0);
@@ -1568,18 +1568,18 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
*/
static UBool
ucnv_outputOverflowToUnicode(UConverter *cnv,
- UChar **target, const UChar *targetLimit,
+ char16_t **target, const char16_t *targetLimit,
int32_t **pOffsets,
UErrorCode *err) {
int32_t *offsets;
- UChar *overflow, *t;
+ char16_t *overflow, *t;
int32_t i, length;
t=*target;
- if(pOffsets!=NULL) {
+ if(pOffsets!=nullptr) {
offsets=*pOffsets;
} else {
- offsets=NULL;
+ offsets=nullptr;
}
overflow=cnv->UCharErrorBuffer;
@@ -1596,7 +1596,7 @@ ucnv_outputOverflowToUnicode(UConverter *cnv,
cnv->UCharErrorBufferLength=(int8_t)j;
*target=t;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*pOffsets=offsets;
}
*err=U_BUFFER_OVERFLOW_ERROR;
@@ -1605,7 +1605,7 @@ ucnv_outputOverflowToUnicode(UConverter *cnv,
/* copy the overflow contents to the target */
*t++=overflow[i++];
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=-1; /* no source index available for old output */
}
}
@@ -1613,7 +1613,7 @@ ucnv_outputOverflowToUnicode(UConverter *cnv,
/* the overflow buffer is completely copied to the target */
cnv->UCharErrorBufferLength=0;
*target=t;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*pOffsets=offsets;
}
return false;
@@ -1621,21 +1621,21 @@ ucnv_outputOverflowToUnicode(UConverter *cnv,
U_CAPI void U_EXPORT2
ucnv_toUnicode(UConverter *cnv,
- UChar **target, const UChar *targetLimit,
+ char16_t **target, const char16_t *targetLimit,
const char **source, const char *sourceLimit,
int32_t *offsets,
UBool flush,
UErrorCode *err) {
UConverterToUnicodeArgs args;
const char *s;
- UChar *t;
+ char16_t *t;
/* check parameters */
- if(err==NULL || U_FAILURE(*err)) {
+ if(err==nullptr || U_FAILURE(*err)) {
return;
}
- if(cnv==NULL || target==NULL || source==NULL) {
+ if(cnv==nullptr || target==nullptr || source==nullptr) {
*err=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -1646,10 +1646,10 @@ ucnv_toUnicode(UConverter *cnv,
if ((const void *)U_MAX_PTR(targetLimit) == (const void *)targetLimit) {
/*
Prevent code from going into an infinite loop in case we do hit this
- limit. The limit pointer is expected to be on a UChar * boundary.
+ limit. The limit pointer is expected to be on a char16_t * boundary.
This also prevents the next argument check from failing.
*/
- targetLimit = (const UChar *)(((const char *)targetLimit) - 1);
+ targetLimit = (const char16_t *)(((const char *)targetLimit) - 1);
}
/*
@@ -1668,8 +1668,8 @@ ucnv_toUnicode(UConverter *cnv,
* consumed or the target filled (unless an error occurs).
* An adjustment would be sourceLimit=t+0x7fffffff; for example.
*
- * 3) Make sure that the user didn't incorrectly cast a UChar * pointer
- * to a char * pointer and provide an incomplete UChar code unit.
+ * 3) Make sure that the user didn't incorrectly cast a char16_t * pointer
+ * to a char * pointer and provide an incomplete char16_t code unit.
*/
if (sourceLimit<s || targetLimit<t ||
((size_t)(sourceLimit-s)>(size_t)0x7fffffff && sourceLimit>s) ||
@@ -1723,20 +1723,20 @@ ucnv_toUnicode(UConverter *cnv,
U_CAPI int32_t U_EXPORT2
ucnv_fromUChars(UConverter *cnv,
char *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+ const char16_t *src, int32_t srcLength,
UErrorCode *pErrorCode) {
- const UChar *srcLimit;
+ const char16_t *srcLimit;
char *originalDest, *destLimit;
int32_t destLength;
/* check arguments */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if( cnv==NULL ||
- destCapacity<0 || (destCapacity>0 && dest==NULL) ||
- srcLength<-1 || (srcLength!=0 && src==NULL)
+ if( cnv==nullptr ||
+ destCapacity<0 || (destCapacity>0 && dest==nullptr) ||
+ srcLength<-1 || (srcLength!=0 && src==nullptr)
) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
@@ -1778,21 +1778,21 @@ ucnv_fromUChars(UConverter *cnv,
U_CAPI int32_t U_EXPORT2
ucnv_toUChars(UConverter *cnv,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
const char *src, int32_t srcLength,
UErrorCode *pErrorCode) {
const char *srcLimit;
- UChar *originalDest, *destLimit;
+ char16_t *originalDest, *destLimit;
int32_t destLength;
/* check arguments */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if( cnv==NULL ||
- destCapacity<0 || (destCapacity>0 && dest==NULL) ||
- srcLength<-1 || (srcLength!=0 && src==NULL))
+ if( cnv==nullptr ||
+ destCapacity<0 || (destCapacity>0 && dest==nullptr) ||
+ srcLength<-1 || (srcLength!=0 && src==nullptr))
{
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
@@ -1816,7 +1816,7 @@ ucnv_toUChars(UConverter *cnv,
/* if an overflow occurs, then get the preflighting length */
if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR)
{
- UChar buffer[1024];
+ char16_t buffer[1024];
destLimit=buffer+UPRV_LENGTHOF(buffer);
do {
@@ -1841,17 +1841,17 @@ ucnv_getNextUChar(UConverter *cnv,
const char **source, const char *sourceLimit,
UErrorCode *err) {
UConverterToUnicodeArgs args;
- UChar buffer[U16_MAX_LENGTH];
+ char16_t buffer[U16_MAX_LENGTH];
const char *s;
UChar32 c;
int32_t i, length;
/* check parameters */
- if(err==NULL || U_FAILURE(*err)) {
+ if(err==nullptr || U_FAILURE(*err)) {
return 0xffff;
}
- if(cnv==NULL || source==NULL) {
+ if(cnv==nullptr || source==nullptr) {
*err=U_ILLEGAL_ARGUMENT_ERROR;
return 0xffff;
}
@@ -1883,7 +1883,7 @@ ucnv_getNextUChar(UConverter *cnv,
/* flush the target overflow buffer */
if(cnv->UCharErrorBufferLength>0) {
- UChar *overflow;
+ char16_t *overflow;
overflow=cnv->UCharErrorBuffer;
i=0;
@@ -1916,7 +1916,7 @@ ucnv_getNextUChar(UConverter *cnv,
/* prepare the converter arguments */
args.converter=cnv;
args.flush=true;
- args.offsets=NULL;
+ args.offsets=nullptr;
args.source=s;
args.sourceLimit=sourceLimit;
args.target=buffer;
@@ -1932,7 +1932,7 @@ ucnv_getNextUChar(UConverter *cnv,
* U_TRUNCATED_CHAR_FOUND for truncated input,
* in addition to setting toULength/toUBytes[]
*/
- if(cnv->toULength==0 && cnv->sharedData->impl->getNextUChar!=NULL) {
+ if(cnv->toULength==0 && cnv->sharedData->impl->getNextUChar!=nullptr) {
c=cnv->sharedData->impl->getNextUChar(&args, err);
*source=s=args.source;
if(*err==U_INDEX_OUTOFBOUNDS_ERROR) {
@@ -1949,7 +1949,7 @@ ucnv_getNextUChar(UConverter *cnv,
}
}
- /* convert to one UChar in buffer[0], or handle getNextUChar() errors */
+ /* convert to one char16_t in buffer[0], or handle getNextUChar() errors */
_toUnicodeWithCallback(&args, err);
if(*err==U_BUFFER_OVERFLOW_ERROR) {
@@ -1960,7 +1960,7 @@ ucnv_getNextUChar(UConverter *cnv,
length=(int32_t)(args.target-buffer);
} else {
/* write the lead surrogate from the overflow buffer */
- buffer[0]=(UChar)c;
+ buffer[0]=(char16_t)c;
args.target=buffer+1;
i=0;
length=1;
@@ -1982,7 +1982,7 @@ ucnv_getNextUChar(UConverter *cnv,
/* consume c=buffer[0], done */
} else {
/* got a lead surrogate, see if a trail surrogate follows */
- UChar c2;
+ char16_t c2;
if(cnv->UCharErrorBufferLength>0) {
/* got overflow output from the conversion */
@@ -2045,13 +2045,13 @@ U_CAPI void U_EXPORT2
ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
char **target, const char *targetLimit,
const char **source, const char *sourceLimit,
- UChar *pivotStart, UChar **pivotSource,
- UChar **pivotTarget, const UChar *pivotLimit,
+ char16_t *pivotStart, char16_t **pivotSource,
+ char16_t **pivotTarget, const char16_t *pivotLimit,
UBool reset, UBool flush,
UErrorCode *pErrorCode) {
- UChar pivotBuffer[CHUNK_SIZE];
- const UChar *myPivotSource;
- UChar *myPivotTarget;
+ char16_t pivotBuffer[CHUNK_SIZE];
+ const char16_t *myPivotSource;
+ char16_t *myPivotTarget;
const char *s;
char *t;
@@ -2060,13 +2060,13 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
UConverterConvert convert;
/* error checking */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return;
}
- if( targetCnv==NULL || sourceCnv==NULL ||
- source==NULL || *source==NULL ||
- target==NULL || *target==NULL || targetLimit==NULL
+ if( targetCnv==nullptr || sourceCnv==nullptr ||
+ source==nullptr || *source==nullptr ||
+ target==nullptr || *target==nullptr || targetLimit==nullptr
) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
@@ -2074,7 +2074,7 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
s=*source;
t=*target;
- if((sourceLimit!=NULL && sourceLimit<s) || targetLimit<t) {
+ if((sourceLimit!=nullptr && sourceLimit<s) || targetLimit<t) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -2084,14 +2084,14 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
* int32_t. See ucnv_toUnicode() for a more detailed comment.
*/
if(
- (sourceLimit!=NULL && ((size_t)(sourceLimit-s)>(size_t)0x7fffffff && sourceLimit>s)) ||
+ (sourceLimit!=nullptr && ((size_t)(sourceLimit-s)>(size_t)0x7fffffff && sourceLimit>s)) ||
((size_t)(targetLimit-t)>(size_t)0x7fffffff && targetLimit>t)
) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
- if(pivotStart==NULL) {
+ if(pivotStart==nullptr) {
if(!flush) {
/* streaming conversion requires an explicit pivot buffer */
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
@@ -2100,19 +2100,19 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
/* use the stack pivot buffer */
myPivotSource=myPivotTarget=pivotStart=pivotBuffer;
- pivotSource=(UChar **)&myPivotSource;
+ pivotSource=(char16_t **)&myPivotSource;
pivotTarget=&myPivotTarget;
pivotLimit=pivotBuffer+CHUNK_SIZE;
} else if( pivotStart>=pivotLimit ||
- pivotSource==NULL || *pivotSource==NULL ||
- pivotTarget==NULL || *pivotTarget==NULL ||
- pivotLimit==NULL
+ pivotSource==nullptr || *pivotSource==nullptr ||
+ pivotTarget==nullptr || *pivotTarget==nullptr ||
+ pivotLimit==nullptr
) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
- if(sourceLimit==NULL) {
+ if(sourceLimit==nullptr) {
/* get limit of single-byte-NUL-terminated source string */
sourceLimit=uprv_strchr(*source, 0);
}
@@ -2123,7 +2123,7 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
*pivotSource=*pivotTarget=pivotStart;
} else if(targetCnv->charErrorBufferLength>0) {
/* output the targetCnv overflow buffer */
- if(ucnv_outputOverflowFromUnicode(targetCnv, target, targetLimit, NULL, pErrorCode)) {
+ if(ucnv_outputOverflowFromUnicode(targetCnv, target, targetLimit, nullptr, pErrorCode)) {
/* U_BUFFER_OVERFLOW_ERROR */
return;
}
@@ -2140,15 +2140,15 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
/* Is direct-UTF-8 conversion available? */
if( sourceCnv->sharedData->staticData->conversionType==UCNV_UTF8 &&
- targetCnv->sharedData->impl->fromUTF8!=NULL
+ targetCnv->sharedData->impl->fromUTF8!=nullptr
) {
convert=targetCnv->sharedData->impl->fromUTF8;
} else if( targetCnv->sharedData->staticData->conversionType==UCNV_UTF8 &&
- sourceCnv->sharedData->impl->toUTF8!=NULL
+ sourceCnv->sharedData->impl->toUTF8!=nullptr
) {
convert=sourceCnv->sharedData->impl->toUTF8;
} else {
- convert=NULL;
+ convert=nullptr;
}
/*
@@ -2170,21 +2170,21 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
* conversion, with function call overhead outweighing the benefits
* of direct conversion.
*/
- if(convert!=NULL && (pivotLimit-pivotStart)>32) {
+ if(convert!=nullptr && (pivotLimit-pivotStart)>32) {
pivotLimit=pivotStart+32;
}
/* prepare the converter arguments */
fromUArgs.converter=targetCnv;
fromUArgs.flush=false;
- fromUArgs.offsets=NULL;
+ fromUArgs.offsets=nullptr;
fromUArgs.target=*target;
fromUArgs.targetLimit=targetLimit;
fromUArgs.size=sizeof(fromUArgs);
toUArgs.converter=sourceCnv;
toUArgs.flush=flush;
- toUArgs.offsets=NULL;
+ toUArgs.offsets=nullptr;
toUArgs.source=s;
toUArgs.sourceLimit=sourceLimit;
toUArgs.targetLimit=pivotLimit;
@@ -2197,7 +2197,7 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
*
* Otherwise stop using s and t from here on.
*/
- s=t=NULL;
+ s=t=nullptr;
/*
* conversion loop
@@ -2229,7 +2229,7 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
_fromUnicodeWithCallback(&fromUArgs, pErrorCode);
if(U_FAILURE(*pErrorCode)) {
/* target overflow, or conversion error */
- *pivotSource=(UChar *)fromUArgs.source;
+ *pivotSource=(char16_t *)fromUArgs.source;
break;
}
@@ -2250,7 +2250,7 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
*/
/* output the sourceCnv overflow buffer */
if(sourceCnv->UCharErrorBufferLength>0) {
- if(ucnv_outputOverflowToUnicode(sourceCnv, pivotTarget, pivotLimit, NULL, pErrorCode)) {
+ if(ucnv_outputOverflowToUnicode(sourceCnv, pivotTarget, pivotLimit, nullptr, pErrorCode)) {
/* U_BUFFER_OVERFLOW_ERROR */
*pErrorCode=U_ZERO_ERROR;
}
@@ -2277,7 +2277,7 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
* but not if continuing a partial match
* or flushing the toUnicode replay buffer
*/
- if(convert!=NULL && targetCnv->preFromUFirstCP<0 && sourceCnv->preToULength==0) {
+ if(convert!=nullptr && targetCnv->preFromUFirstCP<0 && sourceCnv->preToULength==0) {
if(*pErrorCode==U_USING_DEFAULT_WARNING) {
/* remove a warning that may be set by this function */
*pErrorCode=U_ZERO_ERROR;
@@ -2405,8 +2405,8 @@ ucnv_internalConvert(UConverter *outConverter, UConverter *inConverter,
char *target, int32_t targetCapacity,
const char *source, int32_t sourceLength,
UErrorCode *pErrorCode) {
- UChar pivotBuffer[CHUNK_SIZE];
- UChar *pivot, *pivot2;
+ char16_t pivotBuffer[CHUNK_SIZE];
+ char16_t *pivot, *pivot2;
char *myTarget;
const char *sourceLimit;
@@ -2482,12 +2482,12 @@ ucnv_convert(const char *toConverterName, const char *fromConverterName,
UConverter *inConverter, *outConverter;
int32_t targetLength;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if( source==NULL || sourceLength<-1 ||
- targetCapacity<0 || (targetCapacity>0 && target==NULL)
+ if( source==nullptr || sourceLength<-1 ||
+ targetCapacity<0 || (targetCapacity>0 && target==nullptr)
) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
@@ -2533,12 +2533,12 @@ ucnv_convertAlgorithmic(UBool convertToAlgorithmic,
UConverter *algoConverter, *to, *from;
int32_t targetLength;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if( cnv==NULL || source==NULL || sourceLength<-1 ||
- targetCapacity<0 || (targetCapacity>0 && target==NULL)
+ if( cnv==nullptr || source==nullptr || sourceLength<-1 ||
+ targetCapacity<0 || (targetCapacity>0 && target==nullptr)
) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
@@ -2596,7 +2596,12 @@ ucnv_fromAlgorithmic(UConverter *cnv,
UConverterType algorithmicType,
char *target, int32_t targetCapacity,
const char *source, int32_t sourceLength,
- UErrorCode *pErrorCode) {
+ UErrorCode *pErrorCode) UPRV_NO_SANITIZE_UNDEFINED {
+
+ if(algorithmicType<0 || UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES<=algorithmicType) {
+ *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
+ return 0;
+ }
return ucnv_convertAlgorithmic(false, algorithmicType, cnv,
target, targetCapacity,
source, sourceLength,
@@ -2620,11 +2625,11 @@ ucnv_getStarters(const UConverter* converter,
UBool starters[256],
UErrorCode* err)
{
- if (err == NULL || U_FAILURE(*err)) {
+ if (err == nullptr || U_FAILURE(*err)) {
return;
}
- if(converter->sharedData->impl->getStarters != NULL) {
+ if(converter->sharedData->impl->getStarters != nullptr) {
converter->sharedData->impl->getStarters(converter, starters, err);
} else {
*err = U_ILLEGAL_ARGUMENT_ERROR;
@@ -2637,14 +2642,14 @@ static const UAmbiguousConverter *ucnv_getAmbiguous(const UConverter *cnv)
const char *name;
int32_t i;
- if(cnv==NULL) {
- return NULL;
+ if(cnv==nullptr) {
+ return nullptr;
}
errorCode=U_ZERO_ERROR;
name=ucnv_getName(cnv, &errorCode);
if(U_FAILURE(errorCode)) {
- return NULL;
+ return nullptr;
}
for(i=0; i<UPRV_LENGTHOF(ambiguousConverters); ++i)
@@ -2655,18 +2660,18 @@ static const UAmbiguousConverter *ucnv_getAmbiguous(const UConverter *cnv)
}
}
- return NULL;
+ return nullptr;
}
U_CAPI void U_EXPORT2
ucnv_fixFileSeparator(const UConverter *cnv,
- UChar* source,
+ char16_t* source,
int32_t sourceLength) {
const UAmbiguousConverter *a;
int32_t i;
- UChar variant5c;
+ char16_t variant5c;
- if(cnv==NULL || source==NULL || sourceLength<=0 || (a=ucnv_getAmbiguous(cnv))==NULL)
+ if(cnv==nullptr || source==nullptr || sourceLength<=0 || (a=ucnv_getAmbiguous(cnv))==nullptr)
{
return;
}
@@ -2681,7 +2686,7 @@ ucnv_fixFileSeparator(const UConverter *cnv,
U_CAPI UBool U_EXPORT2
ucnv_isAmbiguous(const UConverter *cnv) {
- return (UBool)(ucnv_getAmbiguous(cnv)!=NULL);
+ return (UBool)(ucnv_getAmbiguous(cnv)!=nullptr);
}
U_CAPI void U_EXPORT2
@@ -2702,11 +2707,11 @@ ucnv_getInvalidChars (const UConverter * converter,
int8_t * len,
UErrorCode * err)
{
- if (err == NULL || U_FAILURE(*err))
+ if (err == nullptr || U_FAILURE(*err))
{
return;
}
- if (len == NULL || errBytes == NULL || converter == NULL)
+ if (len == nullptr || errBytes == nullptr || converter == nullptr)
{
*err = U_ILLEGAL_ARGUMENT_ERROR;
return;
@@ -2724,15 +2729,15 @@ ucnv_getInvalidChars (const UConverter * converter,
U_CAPI void U_EXPORT2
ucnv_getInvalidUChars (const UConverter * converter,
- UChar *errChars,
+ char16_t *errChars,
int8_t * len,
UErrorCode * err)
{
- if (err == NULL || U_FAILURE(*err))
+ if (err == nullptr || U_FAILURE(*err))
{
return;
}
- if (len == NULL || errChars == NULL || converter == NULL)
+ if (len == nullptr || errChars == nullptr || converter == nullptr)
{
*err = U_ILLEGAL_ARGUMENT_ERROR;
return;
@@ -2763,16 +2768,16 @@ ucnv_detectUnicodeSignature( const char* source,
char start[SIG_MAX_LEN]={ '\xa5', '\xa5', '\xa5', '\xa5', '\xa5' };
int i = 0;
- if((pErrorCode==NULL) || U_FAILURE(*pErrorCode)){
- return NULL;
+ if((pErrorCode==nullptr) || U_FAILURE(*pErrorCode)){
+ return nullptr;
}
- if(source == NULL || sourceLength < -1){
+ if(source == nullptr || sourceLength < -1){
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
- if(signatureLength == NULL) {
+ if(signatureLength == nullptr) {
signatureLength = &dummy;
}
@@ -2836,16 +2841,16 @@ ucnv_detectUnicodeSignature( const char* source,
/* no known Unicode signature byte sequence recognized */
*signatureLength=0;
- return NULL;
+ return nullptr;
}
U_CAPI int32_t U_EXPORT2
ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status)
{
- if(status == NULL || U_FAILURE(*status)){
+ if(status == nullptr || U_FAILURE(*status)){
return -1;
}
- if(cnv == NULL){
+ if(cnv == nullptr){
*status = U_ILLEGAL_ARGUMENT_ERROR;
return -1;
}
@@ -2864,10 +2869,10 @@ ucnv_fromUCountPending(const UConverter* cnv, UErrorCode* status)
U_CAPI int32_t U_EXPORT2
ucnv_toUCountPending(const UConverter* cnv, UErrorCode* status){
- if(status == NULL || U_FAILURE(*status)){
+ if(status == nullptr || U_FAILURE(*status)){
return -1;
}
- if(cnv == NULL){
+ if(cnv == nullptr){
*status = U_ILLEGAL_ARGUMENT_ERROR;
return -1;
}
@@ -2888,7 +2893,7 @@ ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status){
return false;
}
- if (cnv == NULL) {
+ if (cnv == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return false;
}
diff --git a/thirdparty/icu4c/common/ucnv2022.cpp b/thirdparty/icu4c/common/ucnv2022.cpp
index ec096780e9..5989c1b405 100644
--- a/thirdparty/icu4c/common/ucnv2022.cpp
+++ b/thirdparty/icu4c/common/ucnv2022.cpp
@@ -348,13 +348,13 @@ static const int32_t escSeqStateTable_Key_2022[MAX_STATES_2022] = {
static const char* const escSeqStateTable_Result_2022[MAX_STATES_2022] = {
/* 0 1 2 3 4 5 6 7 8 9 */
- NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,NULL ,"latin1" ,"latin1"
+ nullptr ,nullptr ,nullptr ,nullptr ,nullptr ,nullptr ,nullptr ,nullptr ,"latin1" ,"latin1"
,"latin1" ,"ibm-865" ,"ibm-865" ,"ibm-865" ,"ibm-865" ,"ibm-865" ,"ibm-865" ,"JISX0201" ,"JISX0201" ,"latin1"
- ,"latin1" ,NULL ,"JISX-208" ,"ibm-5478" ,"JISX-208" ,NULL ,NULL ,NULL ,NULL ,"UTF8"
- ,"ISO-8859-1" ,"ISO-8859-7" ,"JIS-X-208" ,NULL ,"ibm-955" ,"ibm-367" ,"ibm-952" ,"ibm-949" ,"JISX-212" ,"ibm-1383"
+ ,"latin1" ,nullptr ,"JISX-208" ,"ibm-5478" ,"JISX-208" ,nullptr ,nullptr ,nullptr ,nullptr ,"UTF8"
+ ,"ISO-8859-1" ,"ISO-8859-7" ,"JIS-X-208" ,nullptr ,"ibm-955" ,"ibm-367" ,"ibm-952" ,"ibm-949" ,"JISX-212" ,"ibm-1383"
,"ibm-952" ,"ibm-964" ,"ibm-964" ,"ibm-964" ,"ibm-964" ,"ibm-964" ,"ibm-964" ,"ibm-5478" ,"ibm-949" ,"ISO-IR-165"
,"CNS-11643-1992,1" ,"CNS-11643-1992,2" ,"CNS-11643-1992,3" ,"CNS-11643-1992,4" ,"CNS-11643-1992,5" ,"CNS-11643-1992,6" ,"CNS-11643-1992,7" ,"UTF16_PlatformEndian" ,"UTF16_PlatformEndian" ,"UTF16_PlatformEndian"
- ,"UTF16_PlatformEndian" ,"UTF16_PlatformEndian" ,"UTF16_PlatformEndian" ,NULL ,"latin1" ,"ibm-912" ,"ibm-913" ,"ibm-914" ,"ibm-813" ,"ibm-1089"
+ ,"UTF16_PlatformEndian" ,"UTF16_PlatformEndian" ,"UTF16_PlatformEndian" ,nullptr ,"latin1" ,"ibm-912" ,"ibm-913" ,"ibm-914" ,"ibm-813" ,"ibm-1089"
,"ibm-920" ,"ibm-915" ,"ibm-915" ,"latin1"
};
@@ -481,7 +481,7 @@ _ISO2022Open(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
char myLocale[7]={' ',' ',' ',' ',' ',' ', '\0'};
cnv->extraInfo = uprv_malloc (sizeof (UConverterDataISO2022));
- if(cnv->extraInfo != NULL) {
+ if(cnv->extraInfo != nullptr) {
UConverterNamePieces stackPieces;
UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER;
UConverterDataISO2022 *myConverterData=(UConverterDataISO2022 *) cnv->extraInfo;
@@ -557,7 +557,7 @@ _ISO2022Open(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
if(pArgs->onlyTestIsLoadable) {
ucnv_canCreateConverter(cnvName, errorCode); /* errorCode carries result */
uprv_free(cnv->extraInfo);
- cnv->extraInfo=NULL;
+ cnv->extraInfo=nullptr;
return;
} else {
myConverterData->currentConverter=ucnv_open(cnvName, errorCode);
@@ -659,10 +659,10 @@ _ISO2022Close(UConverter *converter) {
UConverterSharedData **array = myData->myConverterArray;
int32_t i;
- if (converter->extraInfo != NULL) {
+ if (converter->extraInfo != nullptr) {
/*close the array of converter pointers and free the memory*/
for (i=0; i<UCNV_2022_MAX_CONVERTERS; i++) {
- if(array[i]!=NULL) {
+ if(array[i]!=nullptr) {
ucnv_unloadSharedDataIfReady(array[i]);
}
}
@@ -671,7 +671,7 @@ _ISO2022Close(UConverter *converter) {
if(!converter->isExtraLocal){
uprv_free (converter->extraInfo);
- converter->extraInfo = NULL;
+ converter->extraInfo = nullptr;
}
}
}
@@ -694,7 +694,7 @@ _ISO2022Reset(UConverter *converter, UConverterResetChoice choice) {
myConverterData->key = 0;
if (converter->mode == UCNV_SO){
ucnv_close (myConverterData->currentConverter);
- myConverterData->currentConverter=NULL;
+ myConverterData->currentConverter=nullptr;
}
converter->mode = UCNV_SI;
}
@@ -729,7 +729,7 @@ _ISO2022getName(const UConverter* cnv){
UConverterDataISO2022* myData= (UConverterDataISO2022*)cnv->extraInfo;
return myData->name;
}
- return NULL;
+ return nullptr;
}
U_CDECL_END
@@ -891,7 +891,7 @@ DONE:
case ISO_2022:
{
const char *chosenConverterName = escSeqStateTable_Result_2022[offset];
- if(chosenConverterName == NULL) {
+ if(chosenConverterName == nullptr) {
/* SS2 or SS3 */
*err = U_UNSUPPORTED_ESCAPE_SEQUENCE;
_this->toUCallbackReason = UCNV_UNASSIGNED;
@@ -1171,7 +1171,7 @@ MBCS_FROM_UCHAR32_ISO2022(UConverterSharedData* sharedData,
}
cx=sharedData->mbcs.extIndexes;
- if(cx!=NULL) {
+ if(cx!=nullptr) {
return ucnv_extSimpleMatchFromU(cx, c, value, useFallback);
}
@@ -1259,7 +1259,7 @@ T_UConverter_toUnicode_ISO_2022_OFFSETS_LOGIC(UConverterToUnicodeArgs* args,
UErrorCode* err){
const char* mySourceLimit, *realSourceLimit;
const char* sourceStart;
- const UChar* myTargetStart;
+ const char16_t* myTargetStart;
UConverter* saveThis;
UConverterDataISO2022* myData;
int8_t length;
@@ -1274,7 +1274,7 @@ T_UConverter_toUnicode_ISO_2022_OFFSETS_LOGIC(UConverterToUnicodeArgs* args,
mySourceLimit = getEndOfBuffer_2022(&(args->source), realSourceLimit, args->flush);
if(args->source < mySourceLimit) {
- if(myData->currentConverter==NULL) {
+ if(myData->currentConverter==nullptr) {
myData->currentConverter = ucnv_open("ASCII",err);
if(U_FAILURE(*err)){
return;
@@ -1322,7 +1322,7 @@ T_UConverter_toUnicode_ISO_2022_OFFSETS_LOGIC(UConverterToUnicodeArgs* args,
*/
if (U_FAILURE(*err) ||
(args->source == realSourceLimit) ||
- (args->offsets != NULL && (args->target != myTargetStart || args->source != sourceStart) ||
+ (args->offsets != nullptr && (args->target != myTargetStart || args->source != sourceStart) ||
(mySourceLimit < realSourceLimit && myData->currentConverter->toULength > 0))
) {
/* copy partial or error input for truncated detection and error handling */
@@ -1351,7 +1351,7 @@ T_UConverter_toUnicode_ISO_2022_OFFSETS_LOGIC(UConverterToUnicodeArgs* args,
realSourceLimit,
ISO_2022,
err);
- if (U_FAILURE(*err) || (args->source != sourceStart && args->offsets != NULL)) {
+ if (U_FAILURE(*err) || (args->source != sourceStart && args->offsets != nullptr)) {
/* let the ucnv.c code update its current offset */
return;
}
@@ -1667,8 +1667,8 @@ UConverter_fromUnicode_ISO_2022_JP_OFFSETS_LOGIC(UConverterFromUnicodeArgs* args
ISO2022State *pFromU2022State;
uint8_t *target = (uint8_t *) args->target;
const uint8_t *targetLimit = (const uint8_t *) args->targetLimit;
- const UChar* source = args->source;
- const UChar* sourceLimit = args->sourceLimit;
+ const char16_t* source = args->source;
+ const char16_t* sourceLimit = args->sourceLimit;
int32_t* offsets = args->offsets;
UChar32 sourceChar;
char buffer[8];
@@ -1703,7 +1703,7 @@ getTrail:
/*look ahead to find the trail surrogate*/
if(source < sourceLimit) {
/* test the following code unit */
- UChar trail=(UChar) *source;
+ char16_t trail=(char16_t) *source;
if(U16_IS_TRAIL(trail)) {
source++;
sourceChar=U16_GET_SUPPLEMENTARY(sourceChar, trail);
@@ -2082,7 +2082,7 @@ UConverter_toUnicode_ISO_2022_JP_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
UErrorCode* err){
char tempBuf[2];
const char *mySource = (char *) args->source;
- UChar *myTarget = args->target;
+ char16_t *myTarget = args->target;
const char *mySourceLimit = args->sourceLimit;
uint32_t targetUniChar = 0x0000;
uint32_t mySourceChar = 0x0000;
@@ -2281,25 +2281,25 @@ getTrailByte:
if(args->offsets){
args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2));
}
- *(myTarget++)=(UChar)targetUniChar;
+ *(myTarget++)=(char16_t)targetUniChar;
}
else if(targetUniChar > missingCharMarker){
/* disassemble the surrogate pair and write to output*/
targetUniChar-=0x0010000;
- *myTarget = (UChar)(0xd800+(UChar)(targetUniChar>>10));
+ *myTarget = (char16_t)(0xd800+(char16_t)(targetUniChar>>10));
if(args->offsets){
args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2));
}
++myTarget;
if(myTarget< args->targetLimit){
- *myTarget = (UChar)(0xdc00+(UChar)(targetUniChar&0x3ff));
+ *myTarget = (char16_t)(0xdc00+(char16_t)(targetUniChar&0x3ff));
if(args->offsets){
args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2));
}
++myTarget;
}else{
args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++]=
- (UChar)(0xdc00+(UChar)(targetUniChar&0x3ff));
+ (char16_t)(0xdc00+(char16_t)(targetUniChar&0x3ff));
}
}
@@ -2356,8 +2356,8 @@ UConverter_fromUnicode_ISO_2022_KR_OFFSETS_LOGIC_IBM(UConverterFromUnicodeArgs*
static void U_CALLCONV
UConverter_fromUnicode_ISO_2022_KR_OFFSETS_LOGIC(UConverterFromUnicodeArgs* args, UErrorCode* err){
- const UChar *source = args->source;
- const UChar *sourceLimit = args->sourceLimit;
+ const char16_t *source = args->source;
+ const char16_t *sourceLimit = args->sourceLimit;
unsigned char *target = (unsigned char *) args->target;
unsigned char *targetLimit = (unsigned char *) args->targetLimit;
int32_t* offsets = args->offsets;
@@ -2480,7 +2480,7 @@ getTrail:
/*look ahead to find the trail surrogate*/
if(source < sourceLimit) {
/* test the following code unit */
- UChar trail=(UChar) *source;
+ char16_t trail=(char16_t) *source;
if(U16_IS_TRAIL(trail)) {
source++;
sourceChar=U16_GET_SUPPLEMENTARY(sourceChar, trail);
@@ -2624,10 +2624,10 @@ UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC_IBM(UConverterToUnicodeArgs *args
*/
ucnv_MBCSToUnicodeWithOffsets(&subArgs, err);
- if(args->offsets != NULL && sourceStart != args->source) {
+ if(args->offsets != nullptr && sourceStart != args->source) {
/* update offsets to base them on the actual start of the input */
int32_t *offsets = args->offsets;
- UChar *target = args->target;
+ char16_t *target = args->target;
int32_t delta = (int32_t)(args->source - sourceStart);
while(target < subArgs.target) {
if(*offsets >= 0) {
@@ -2675,10 +2675,10 @@ UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
UErrorCode* err){
char tempBuf[2];
const char *mySource = ( char *) args->source;
- UChar *myTarget = args->target;
+ char16_t *myTarget = args->target;
const char *mySourceLimit = args->sourceLimit;
UChar32 targetUniChar = 0x0000;
- UChar mySourceChar = 0x0000;
+ char16_t mySourceChar = 0x0000;
UConverterDataISO2022* myData;
UConverterSharedData* sharedData ;
UBool useFallback;
@@ -2772,7 +2772,7 @@ getTrailByte:
/* report a pair of illegal bytes if the second byte is not a DBCS starter */
++mySource;
/* add another bit so that the code below writes 2 bytes in case of error */
- mySourceChar = static_cast<UChar>(0x10000 | (mySourceChar << 8) | trailByte);
+ mySourceChar = static_cast<char16_t>(0x10000 | (mySourceChar << 8) | trailByte);
}
} else {
args->converter->toUBytes[0] = (uint8_t)mySourceChar;
@@ -2789,7 +2789,7 @@ getTrailByte:
if(args->offsets) {
args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2));
}
- *(myTarget++)=(UChar)targetUniChar;
+ *(myTarget++)=(char16_t)targetUniChar;
}
else {
/* Call the callback function*/
@@ -2919,8 +2919,8 @@ UConverter_fromUnicode_ISO_2022_CN_OFFSETS_LOGIC(UConverterFromUnicodeArgs* args
ISO2022State *pFromU2022State;
uint8_t *target = (uint8_t *) args->target;
const uint8_t *targetLimit = (const uint8_t *) args->targetLimit;
- const UChar* source = args->source;
- const UChar* sourceLimit = args->sourceLimit;
+ const char16_t* source = args->source;
+ const char16_t* sourceLimit = args->sourceLimit;
int32_t* offsets = args->offsets;
UChar32 sourceChar;
char buffer[8];
@@ -2952,7 +2952,7 @@ getTrail:
/*look ahead to find the trail surrogate*/
if(source < sourceLimit) {
/* test the following code unit */
- UChar trail=(UChar) *source;
+ char16_t trail=(char16_t) *source;
if(U16_IS_TRAIL(trail)) {
source++;
sourceChar=U16_GET_SUPPLEMENTARY(sourceChar, trail);
@@ -3268,7 +3268,7 @@ UConverter_toUnicode_ISO_2022_CN_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
UErrorCode* err){
char tempBuf[3];
const char *mySource = (char *) args->source;
- UChar *myTarget = args->target;
+ char16_t *myTarget = args->target;
const char *mySourceLimit = args->sourceLimit;
uint32_t targetUniChar = 0x0000;
uint32_t mySourceChar = 0x0000;
@@ -3417,7 +3417,7 @@ getTrailByte:
}
else{
if(mySourceChar <= 0x7f) {
- targetUniChar = (UChar) mySourceChar;
+ targetUniChar = (char16_t) mySourceChar;
}
}
break;
@@ -3426,25 +3426,25 @@ getTrailByte:
if(args->offsets){
args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2));
}
- *(myTarget++)=(UChar)targetUniChar;
+ *(myTarget++)=(char16_t)targetUniChar;
}
else if(targetUniChar > missingCharMarker){
/* disassemble the surrogate pair and write to output*/
targetUniChar-=0x0010000;
- *myTarget = (UChar)(0xd800+(UChar)(targetUniChar>>10));
+ *myTarget = (char16_t)(0xd800+(char16_t)(targetUniChar>>10));
if(args->offsets){
args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2));
}
++myTarget;
if(myTarget< args->targetLimit){
- *myTarget = (UChar)(0xdc00+(UChar)(targetUniChar&0x3ff));
+ *myTarget = (char16_t)(0xdc00+(char16_t)(targetUniChar&0x3ff));
if(args->offsets){
args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2));
}
++myTarget;
}else{
args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++]=
- (UChar)(0xdc00+(UChar)(targetUniChar&0x3ff));
+ (char16_t)(0xdc00+(char16_t)(targetUniChar&0x3ff));
}
}
@@ -3599,7 +3599,7 @@ _ISO_2022_SafeClone(
if (*pBufferSize == 0) { /* 'preflighting' request - set needed size into *pBufferSize */
*pBufferSize = (int32_t)sizeof(struct cloneStruct);
- return NULL;
+ return nullptr;
}
cnvData = (UConverterDataISO2022 *)cnv->extraInfo;
@@ -3613,19 +3613,19 @@ _ISO_2022_SafeClone(
/* share the subconverters */
- if(cnvData->currentConverter != NULL) {
+ if(cnvData->currentConverter != nullptr) {
size = (int32_t)sizeof(UConverter);
localClone->mydata.currentConverter =
ucnv_safeClone(cnvData->currentConverter,
&localClone->currentConverter,
&size, status);
if(U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
}
for(i=0; i<UCNV_2022_MAX_CONVERTERS; ++i) {
- if(cnvData->myConverterArray[i] != NULL) {
+ if(cnvData->myConverterArray[i] != nullptr) {
ucnv_incrementRefCount(cnvData->myConverterArray[i]);
}
}
@@ -3721,7 +3721,7 @@ _ISO_2022_GetUnicodeSet(const UConverter *cnv,
for (i=0; i<UCNV_2022_MAX_CONVERTERS; i++) {
UConverterSetFilter filter;
- if(cnvData->myConverterArray[i]!=NULL) {
+ if(cnvData->myConverterArray[i]!=nullptr) {
if(cnvData->locale[0]=='j' && i==JISX208) {
/*
* Only add code points that map to Shift-JIS codes
@@ -3769,8 +3769,8 @@ _ISO_2022_GetUnicodeSet(const UConverter *cnv,
static const UConverterImpl _ISO2022Impl={
UCNV_ISO_2022,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_ISO2022Open,
_ISO2022Close,
@@ -3782,21 +3782,21 @@ static const UConverterImpl _ISO2022Impl={
ucnv_fromUnicode_UTF8,
ucnv_fromUnicode_UTF8_OFFSETS_LOGIC,
#else
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
#endif
- NULL,
+ nullptr,
- NULL,
+ nullptr,
_ISO2022getName,
_ISO_2022_WriteSub,
_ISO_2022_SafeClone,
_ISO_2022_GetUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
static const UConverterStaticData _ISO2022StaticData={
sizeof(UConverterStaticData),
@@ -3805,7 +3805,7 @@ static const UConverterStaticData _ISO2022StaticData={
UCNV_IBM,
UCNV_ISO_2022,
1,
- 3, /* max 3 bytes per UChar from UTF-8 (4 bytes from surrogate _pair_) */
+ 3, /* max 3 bytes per char16_t from UTF-8 (4 bytes from surrogate _pair_) */
{ 0x1a, 0, 0, 0 },
1,
false,
@@ -3821,8 +3821,8 @@ const UConverterSharedData _ISO2022Data=
static const UConverterImpl _ISO2022JPImpl={
UCNV_ISO_2022,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_ISO2022Open,
_ISO2022Close,
@@ -3832,16 +3832,16 @@ static const UConverterImpl _ISO2022JPImpl={
UConverter_toUnicode_ISO_2022_JP_OFFSETS_LOGIC,
UConverter_fromUnicode_ISO_2022_JP_OFFSETS_LOGIC,
UConverter_fromUnicode_ISO_2022_JP_OFFSETS_LOGIC,
- NULL,
+ nullptr,
- NULL,
+ nullptr,
_ISO2022getName,
_ISO_2022_WriteSub,
_ISO_2022_SafeClone,
_ISO_2022_GetUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
static const UConverterStaticData _ISO2022JPStaticData={
sizeof(UConverterStaticData),
@@ -3850,7 +3850,7 @@ static const UConverterStaticData _ISO2022JPStaticData={
UCNV_IBM,
UCNV_ISO_2022,
1,
- 6, /* max 6 bytes per UChar: 4-byte escape sequence + DBCS */
+ 6, /* max 6 bytes per char16_t: 4-byte escape sequence + DBCS */
{ 0x1a, 0, 0, 0 },
1,
false,
@@ -3872,8 +3872,8 @@ const UConverterSharedData _ISO2022JPData=
static const UConverterImpl _ISO2022KRImpl={
UCNV_ISO_2022,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_ISO2022Open,
_ISO2022Close,
@@ -3883,16 +3883,16 @@ static const UConverterImpl _ISO2022KRImpl={
UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC,
UConverter_fromUnicode_ISO_2022_KR_OFFSETS_LOGIC,
UConverter_fromUnicode_ISO_2022_KR_OFFSETS_LOGIC,
- NULL,
+ nullptr,
- NULL,
+ nullptr,
_ISO2022getName,
_ISO_2022_WriteSub,
_ISO_2022_SafeClone,
_ISO_2022_GetUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
static const UConverterStaticData _ISO2022KRStaticData={
sizeof(UConverterStaticData),
@@ -3901,7 +3901,7 @@ static const UConverterStaticData _ISO2022KRStaticData={
UCNV_IBM,
UCNV_ISO_2022,
1,
- 8, /* max 8 bytes per UChar */
+ 8, /* max 8 bytes per char16_t */
{ 0x1a, 0, 0, 0 },
1,
false,
@@ -3923,8 +3923,8 @@ static const UConverterImpl _ISO2022CNImpl={
UCNV_ISO_2022,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_ISO2022Open,
_ISO2022Close,
@@ -3934,16 +3934,16 @@ static const UConverterImpl _ISO2022CNImpl={
UConverter_toUnicode_ISO_2022_CN_OFFSETS_LOGIC,
UConverter_fromUnicode_ISO_2022_CN_OFFSETS_LOGIC,
UConverter_fromUnicode_ISO_2022_CN_OFFSETS_LOGIC,
- NULL,
+ nullptr,
- NULL,
+ nullptr,
_ISO2022getName,
_ISO_2022_WriteSub,
_ISO_2022_SafeClone,
_ISO_2022_GetUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
static const UConverterStaticData _ISO2022CNStaticData={
sizeof(UConverterStaticData),
@@ -3952,7 +3952,7 @@ static const UConverterStaticData _ISO2022CNStaticData={
UCNV_IBM,
UCNV_ISO_2022,
1,
- 8, /* max 8 bytes per UChar: 4-byte CNS designator + 2 bytes for SS2/SS3 + DBCS */
+ 8, /* max 8 bytes per char16_t: 4-byte CNS designator + 2 bytes for SS2/SS3 + DBCS */
{ 0x1a, 0, 0, 0 },
1,
false,
diff --git a/thirdparty/icu4c/common/ucnv_bld.cpp b/thirdparty/icu4c/common/ucnv_bld.cpp
index a0fbfe2d7f..564b645bed 100644
--- a/thirdparty/icu4c/common/ucnv_bld.cpp
+++ b/thirdparty/icu4c/common/ucnv_bld.cpp
@@ -57,10 +57,10 @@ extern void UCNV_DEBUG_LOG(char *what, char *who, void *p, int l);
static const UConverterSharedData * const
converterData[UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES]={
- NULL, NULL,
+ nullptr, nullptr,
#if UCONFIG_NO_LEGACY_CONVERSION
- NULL,
+ nullptr,
#else
&_MBCSData,
#endif
@@ -68,22 +68,22 @@ converterData[UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES]={
&_Latin1Data,
&_UTF8Data, &_UTF16BEData, &_UTF16LEData,
#if UCONFIG_ONLY_HTML_CONVERSION
- NULL, NULL,
+ nullptr, nullptr,
#else
&_UTF32BEData, &_UTF32LEData,
#endif
- NULL,
+ nullptr,
#if UCONFIG_NO_LEGACY_CONVERSION
- NULL,
+ nullptr,
#else
&_ISO2022Data,
#endif
#if UCONFIG_NO_LEGACY_CONVERSION || UCONFIG_ONLY_HTML_CONVERSION
- NULL, NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL, NULL,
- NULL,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr,
#else
&_LMBCSData1,&_LMBCSData2, &_LMBCSData3, &_LMBCSData4, &_LMBCSData5, &_LMBCSData6,
&_LMBCSData8,&_LMBCSData11,&_LMBCSData16,&_LMBCSData17,&_LMBCSData18,&_LMBCSData19,
@@ -91,27 +91,27 @@ converterData[UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES]={
#endif
#if UCONFIG_ONLY_HTML_CONVERSION
- NULL,
+ nullptr,
#else
&_SCSUData,
#endif
#if UCONFIG_NO_LEGACY_CONVERSION || UCONFIG_ONLY_HTML_CONVERSION
- NULL,
+ nullptr,
#else
&_ISCIIData,
#endif
&_ASCIIData,
#if UCONFIG_ONLY_HTML_CONVERSION
- NULL, NULL, &_UTF16Data, NULL, NULL, NULL,
+ nullptr, nullptr, &_UTF16Data, nullptr, nullptr, nullptr,
#else
&_UTF7Data, &_Bocu1Data, &_UTF16Data, &_UTF32Data, &_CESU8Data, &_IMAPData,
#endif
#if UCONFIG_NO_LEGACY_CONVERSION || UCONFIG_ONLY_HTML_CONVERSION
- NULL,
+ nullptr,
#else
&_CompoundTextData
#endif
@@ -193,20 +193,20 @@ static struct {
/*initializes some global variables */
-static UHashtable *SHARED_DATA_HASHTABLE = NULL;
+static UHashtable *SHARED_DATA_HASHTABLE = nullptr;
static icu::UMutex cnvCacheMutex;
/* Note: the global mutex is used for */
/* reference count updates. */
-static const char **gAvailableConverters = NULL;
+static const char **gAvailableConverters = nullptr;
static uint16_t gAvailableConverterCount = 0;
static icu::UInitOnce gAvailableConvertersInitOnce {};
#if !U_CHARSET_IS_UTF8
/* This contains the resolved converter name. So no further alias lookup is needed again. */
-static char gDefaultConverterNameBuffer[UCNV_MAX_CONVERTER_NAME_LENGTH + 1]; /* +1 for NULL */
-static const char *gDefaultConverterName = NULL;
+static char gDefaultConverterNameBuffer[UCNV_MAX_CONVERTER_NAME_LENGTH + 1]; /* +1 for nullptr */
+static const char *gDefaultConverterName = nullptr;
/*
If the default converter is an algorithmic converter, this is the cached value.
@@ -214,7 +214,7 @@ We don't cache a full UConverter and clone it because ucnv_clone doesn't have
less overhead than an algorithmic open. We don't cache non-algorithmic converters
because ucnv_flushCache must be able to unload the default converter and its table.
*/
-static const UConverterSharedData *gDefaultAlgorithmicSharedData = NULL;
+static const UConverterSharedData *gDefaultAlgorithmicSharedData = nullptr;
/* Does gDefaultConverterName have a converter option and require extra parsing? */
static UBool gDefaultConverterContainsOption;
@@ -232,7 +232,7 @@ ucnv_flushAvailableConverterCache() {
gAvailableConverterCount = 0;
if (gAvailableConverters) {
uprv_free((char **)gAvailableConverters);
- gAvailableConverters = NULL;
+ gAvailableConverters = nullptr;
}
gAvailableConvertersInitOnce.reset();
}
@@ -241,28 +241,28 @@ ucnv_flushAvailableConverterCache() {
/* in use by open converters. */
/* Not thread safe. */
/* Not supported API. */
-static UBool U_CALLCONV ucnv_cleanup(void) {
+static UBool U_CALLCONV ucnv_cleanup() {
ucnv_flushCache();
- if (SHARED_DATA_HASHTABLE != NULL && uhash_count(SHARED_DATA_HASHTABLE) == 0) {
+ if (SHARED_DATA_HASHTABLE != nullptr && uhash_count(SHARED_DATA_HASHTABLE) == 0) {
uhash_close(SHARED_DATA_HASHTABLE);
- SHARED_DATA_HASHTABLE = NULL;
+ SHARED_DATA_HASHTABLE = nullptr;
}
/* Isn't called from flushCache because other threads may have preexisting references to the table. */
ucnv_flushAvailableConverterCache();
#if !U_CHARSET_IS_UTF8
- gDefaultConverterName = NULL;
+ gDefaultConverterName = nullptr;
gDefaultConverterNameBuffer[0] = 0;
gDefaultConverterContainsOption = false;
- gDefaultAlgorithmicSharedData = NULL;
+ gDefaultAlgorithmicSharedData = nullptr;
#endif
- return (SHARED_DATA_HASHTABLE == NULL);
+ return (SHARED_DATA_HASHTABLE == nullptr);
}
U_CAPI void U_EXPORT2
-ucnv_enableCleanup(void) {
+ucnv_enableCleanup() {
ucln_common_registerCleanup(UCLN_COMMON_UCNV, ucnv_cleanup);
}
@@ -295,22 +295,22 @@ ucnv_data_unFlattenClone(UConverterLoadArgs *pArgs, UDataMemory *pData, UErrorCo
UConverterType type = (UConverterType)source->conversionType;
if(U_FAILURE(*status))
- return NULL;
+ return nullptr;
if( (uint16_t)type >= UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES ||
- converterData[type] == NULL ||
+ converterData[type] == nullptr ||
!converterData[type]->isReferenceCounted ||
converterData[type]->referenceCounter != 1 ||
source->structSize != sizeof(UConverterStaticData))
{
*status = U_INVALID_TABLE_FORMAT;
- return NULL;
+ return nullptr;
}
data = (UConverterSharedData *)uprv_malloc(sizeof(UConverterSharedData));
- if(data == NULL) {
+ if(data == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
/* copy initial values from the static structure for this type */
@@ -323,11 +323,11 @@ ucnv_data_unFlattenClone(UConverterLoadArgs *pArgs, UDataMemory *pData, UErrorCo
/* fill in fields from the loaded data */
data->dataMemory = (void*)pData; /* for future use */
- if(data->impl->load != NULL) {
+ if(data->impl->load != nullptr) {
data->impl->load(data, pArgs, raw + source->structSize, status);
if(U_FAILURE(*status)) {
uprv_free(data);
- return NULL;
+ return nullptr;
}
}
return data;
@@ -346,16 +346,16 @@ static UConverterSharedData *createConverterFromFile(UConverterLoadArgs *pArgs,
if (U_FAILURE (*err)) {
UTRACE_EXIT_STATUS(*err);
- return NULL;
+ return nullptr;
}
UTRACE_DATA2(UTRACE_OPEN_CLOSE, "load converter %s from package %s", pArgs->name, pArgs->pkg);
- data = udata_openChoice(pArgs->pkg, DATA_TYPE, pArgs->name, isCnvAcceptable, NULL, err);
+ data = udata_openChoice(pArgs->pkg, DATA_TYPE, pArgs->name, isCnvAcceptable, nullptr, err);
if(U_FAILURE(*err))
{
UTRACE_EXIT_STATUS(*err);
- return NULL;
+ return nullptr;
}
sharedData = ucnv_data_unFlattenClone(pArgs, data, err);
@@ -363,7 +363,7 @@ static UConverterSharedData *createConverterFromFile(UConverterLoadArgs *pArgs,
{
udata_close(data);
UTRACE_EXIT_STATUS(*err);
- return NULL;
+ return nullptr;
}
/*
@@ -413,7 +413,7 @@ getAlgorithmicTypeFromName(const char *realName)
}
}
- return NULL;
+ return nullptr;
}
/*
@@ -437,11 +437,11 @@ ucnv_shareConverterData(UConverterSharedData * data)
{
UErrorCode err = U_ZERO_ERROR;
/*Lazy evaluates the Hashtable itself */
- /*void *sanity = NULL;*/
+ /*void *sanity = nullptr;*/
- if (SHARED_DATA_HASHTABLE == NULL)
+ if (SHARED_DATA_HASHTABLE == nullptr)
{
- SHARED_DATA_HASHTABLE = uhash_openSize(uhash_hashChars, uhash_compareChars, NULL,
+ SHARED_DATA_HASHTABLE = uhash_openSize(uhash_hashChars, uhash_compareChars, nullptr,
ucnv_io_countKnownConverters(&err)*UCNV_CACHE_LOAD_FACTOR,
&err);
ucnv_enableCleanup();
@@ -454,7 +454,7 @@ ucnv_shareConverterData(UConverterSharedData * data)
/*
sanity = ucnv_getSharedConverterData (data->staticData->name);
- if(sanity != NULL)
+ if(sanity != nullptr)
{
UCNV_DEBUG_LOG("put:overwrite!",data->staticData->name,sanity);
}
@@ -466,7 +466,7 @@ ucnv_shareConverterData(UConverterSharedData * data)
uhash_put(SHARED_DATA_HASHTABLE,
(void*) data->staticData->name, /* Okay to cast away const as long as
- keyDeleter == NULL */
+ keyDeleter == nullptr */
data,
&err);
UCNV_DEBUG_LOG("put", data->staticData->name,data);
@@ -475,17 +475,17 @@ ucnv_shareConverterData(UConverterSharedData * data)
/* Look up a converter name in the shared data cache. */
/* cnvCacheMutex must be held by the caller to protect the hash table. */
-/* gets the shared data from the SHARED_DATA_HASHTABLE (might return NULL if it isn't there)
+/* gets the shared data from the SHARED_DATA_HASHTABLE (might return nullptr if it isn't there)
* @param name The name of the shared data
* @return the shared data from the SHARED_DATA_HASHTABLE
*/
static UConverterSharedData *
ucnv_getSharedConverterData(const char *name)
{
- /*special case when no Table has yet been created we return NULL */
- if (SHARED_DATA_HASHTABLE == NULL)
+ /*special case when no Table has yet been created we return nullptr */
+ if (SHARED_DATA_HASHTABLE == nullptr)
{
- return NULL;
+ return nullptr;
}
else
{
@@ -519,11 +519,11 @@ ucnv_deleteSharedConverterData(UConverterSharedData * deadSharedData)
return false;
}
- if (deadSharedData->impl->unload != NULL) {
+ if (deadSharedData->impl->unload != nullptr) {
deadSharedData->impl->unload(deadSharedData);
}
- if(deadSharedData->dataMemory != NULL)
+ if(deadSharedData->dataMemory != nullptr)
{
UDataMemory *data = (UDataMemory*)deadSharedData->dataMemory;
udata_close(data);
@@ -537,29 +537,29 @@ ucnv_deleteSharedConverterData(UConverterSharedData * deadSharedData)
/**
* Load a non-algorithmic converter.
- * If pkg==NULL, then this function must be called inside umtx_lock(&cnvCacheMutex).
+ * If pkg==nullptr, then this function must be called inside umtx_lock(&cnvCacheMutex).
*/
UConverterSharedData *
ucnv_load(UConverterLoadArgs *pArgs, UErrorCode *err) {
UConverterSharedData *mySharedConverterData;
- if(err == NULL || U_FAILURE(*err)) {
- return NULL;
+ if(err == nullptr || U_FAILURE(*err)) {
+ return nullptr;
}
- if(pArgs->pkg != NULL && *pArgs->pkg != 0) {
+ if(pArgs->pkg != nullptr && *pArgs->pkg != 0) {
/* application-provided converters are not currently cached */
return createConverterFromFile(pArgs, err);
}
mySharedConverterData = ucnv_getSharedConverterData(pArgs->name);
- if (mySharedConverterData == NULL)
+ if (mySharedConverterData == nullptr)
{
/*Not cached, we need to stream it in from file */
mySharedConverterData = createConverterFromFile(pArgs, err);
- if (U_FAILURE (*err) || (mySharedConverterData == NULL))
+ if (U_FAILURE (*err) || (mySharedConverterData == nullptr))
{
- return NULL;
+ return nullptr;
}
else if (!pArgs->onlyTestIsLoadable)
{
@@ -584,7 +584,7 @@ ucnv_load(UConverterLoadArgs *pArgs, UErrorCode *err) {
*/
U_CAPI void
ucnv_unload(UConverterSharedData *sharedData) {
- if(sharedData != NULL) {
+ if(sharedData != nullptr) {
if (sharedData->referenceCounter > 0) {
sharedData->referenceCounter--;
}
@@ -598,7 +598,7 @@ ucnv_unload(UConverterSharedData *sharedData) {
U_CFUNC void
ucnv_unloadSharedDataIfReady(UConverterSharedData *sharedData)
{
- if(sharedData != NULL && sharedData->isReferenceCounted) {
+ if(sharedData != nullptr && sharedData->isReferenceCounted) {
umtx_lock(&cnvCacheMutex);
ucnv_unload(sharedData);
umtx_unlock(&cnvCacheMutex);
@@ -608,7 +608,7 @@ ucnv_unloadSharedDataIfReady(UConverterSharedData *sharedData)
U_CFUNC void
ucnv_incrementRefCount(UConverterSharedData *sharedData)
{
- if(sharedData != NULL && sharedData->isReferenceCounted) {
+ if(sharedData != nullptr && sharedData->isReferenceCounted) {
umtx_lock(&cnvCacheMutex);
sharedData->referenceCounter++;
umtx_unlock(&cnvCacheMutex);
@@ -715,27 +715,27 @@ ucnv_loadSharedData(const char *converterName,
UErrorCode * err) {
UConverterNamePieces stackPieces;
UConverterLoadArgs stackArgs;
- UConverterSharedData *mySharedConverterData = NULL;
+ UConverterSharedData *mySharedConverterData = nullptr;
UErrorCode internalErrorCode = U_ZERO_ERROR;
UBool mayContainOption = true;
UBool checkForAlgorithmic = true;
if (U_FAILURE (*err)) {
- return NULL;
+ return nullptr;
}
- if(pPieces == NULL) {
- if(pArgs != NULL) {
+ if(pPieces == nullptr) {
+ if(pArgs != nullptr) {
/*
* Bad: We may set pArgs pointers to stackPieces fields
* which will be invalid after this function returns.
*/
*err = U_INTERNAL_PROGRAM_ERROR;
- return NULL;
+ return nullptr;
}
pPieces = &stackPieces;
}
- if(pArgs == NULL) {
+ if(pArgs == nullptr) {
uprv_memset(&stackArgs, 0, sizeof(stackArgs));
stackArgs.size = (int32_t)sizeof(stackArgs);
pArgs = &stackArgs;
@@ -749,17 +749,17 @@ ucnv_loadSharedData(const char *converterName,
pArgs->locale = pPieces->locale;
pArgs->options = pPieces->options;
- /* In case "name" is NULL we want to open the default converter. */
- if (converterName == NULL) {
+ /* In case "name" is nullptr we want to open the default converter. */
+ if (converterName == nullptr) {
#if U_CHARSET_IS_UTF8
pArgs->name = "UTF-8";
return (UConverterSharedData *)converterData[UCNV_UTF8];
#else
/* Call ucnv_getDefaultName first to query the name from the OS. */
pArgs->name = ucnv_getDefaultName();
- if (pArgs->name == NULL) {
+ if (pArgs->name == nullptr) {
*err = U_MISSING_RESOURCE_ERROR;
- return NULL;
+ return nullptr;
}
mySharedConverterData = (UConverterSharedData *)gDefaultAlgorithmicSharedData;
checkForAlgorithmic = false;
@@ -777,12 +777,12 @@ ucnv_loadSharedData(const char *converterName,
parseConverterOptions(converterName, pPieces, pArgs, err);
if (U_FAILURE(*err)) {
/* Very bad name used. */
- return NULL;
+ return nullptr;
}
/* get the canonical converter name */
pArgs->name = ucnv_io_getConverterName(pArgs->name, &mayContainOption, &internalErrorCode);
- if (U_FAILURE(internalErrorCode) || pArgs->name == NULL) {
+ if (U_FAILURE(internalErrorCode) || pArgs->name == nullptr) {
/*
* set the input name in case the converter was added
* without updating the alias table, or when there is no alias table
@@ -802,7 +802,7 @@ ucnv_loadSharedData(const char *converterName,
if (checkForAlgorithmic) {
mySharedConverterData = (UConverterSharedData *)getAlgorithmicTypeFromName(pArgs->name);
}
- if (mySharedConverterData == NULL)
+ if (mySharedConverterData == nullptr)
{
/* it is a data-based converter, get its shared data. */
/* Hold the cnvCacheMutex through the whole process of checking the */
@@ -810,14 +810,14 @@ ucnv_loadSharedData(const char *converterName,
/* to prevent other threads from modifying the cache during the */
/* process. */
pArgs->nestedLoads=1;
- pArgs->pkg=NULL;
+ pArgs->pkg=nullptr;
umtx_lock(&cnvCacheMutex);
mySharedConverterData = ucnv_load(pArgs, err);
umtx_unlock(&cnvCacheMutex);
- if (U_FAILURE (*err) || (mySharedConverterData == NULL))
+ if (U_FAILURE (*err) || (mySharedConverterData == nullptr))
{
- return NULL;
+ return nullptr;
}
}
@@ -851,7 +851,7 @@ ucnv_createConverter(UConverter *myUConverter, const char *converterName, UError
/* exit with error */
UTRACE_EXIT_STATUS(*err);
- return NULL;
+ return nullptr;
}
U_CFUNC UBool
@@ -894,15 +894,15 @@ ucnv_createAlgorithmicConverter(UConverter *myUConverter,
if(type<0 || UCNV_NUMBER_OF_SUPPORTED_CONVERTER_TYPES<=type) {
*err = U_ILLEGAL_ARGUMENT_ERROR;
UTRACE_EXIT_STATUS(U_ILLEGAL_ARGUMENT_ERROR);
- return NULL;
+ return nullptr;
}
sharedData = converterData[type];
- if(sharedData == NULL || sharedData->isReferenceCounted) {
+ if(sharedData == nullptr || sharedData->isReferenceCounted) {
/* not a valid type, or not an algorithmic converter */
*err = U_ILLEGAL_ARGUMENT_ERROR;
UTRACE_EXIT_STATUS(U_ILLEGAL_ARGUMENT_ERROR);
- return NULL;
+ return nullptr;
}
stackArgs.name = "";
@@ -928,7 +928,7 @@ ucnv_createConverterFromPackage(const char *packageName, const char *converterNa
if(U_FAILURE(*err)) {
UTRACE_EXIT_STATUS(*err);
- return NULL;
+ return nullptr;
}
UTRACE_DATA2(UTRACE_OPEN_CLOSE, "open converter %s from package %s", converterName, packageName);
@@ -941,7 +941,7 @@ ucnv_createConverterFromPackage(const char *packageName, const char *converterNa
if (U_FAILURE(*err)) {
/* Very bad name used. */
UTRACE_EXIT_STATUS(*err);
- return NULL;
+ return nullptr;
}
stackArgs.nestedLoads=1;
stackArgs.pkg=packageName;
@@ -951,16 +951,16 @@ ucnv_createConverterFromPackage(const char *packageName, const char *converterNa
if (U_FAILURE(*err)) {
UTRACE_EXIT_STATUS(*err);
- return NULL;
+ return nullptr;
}
/* create the actual converter */
- myUConverter = ucnv_createConverterFromSharedData(NULL, mySharedConverterData, &stackArgs, err);
+ myUConverter = ucnv_createConverterFromSharedData(nullptr, mySharedConverterData, &stackArgs, err);
if (U_FAILURE(*err)) {
ucnv_close(myUConverter);
UTRACE_EXIT_STATUS(*err);
- return NULL;
+ return nullptr;
}
UTRACE_EXIT_PTR_STATUS(myUConverter, *err);
@@ -980,14 +980,14 @@ ucnv_createConverterFromSharedData(UConverter *myUConverter,
ucnv_unloadSharedDataIfReady(mySharedConverterData);
return myUConverter;
}
- if(myUConverter == NULL)
+ if(myUConverter == nullptr)
{
myUConverter = (UConverter *) uprv_malloc (sizeof (UConverter));
- if(myUConverter == NULL)
+ if(myUConverter == nullptr)
{
*err = U_MEMORY_ALLOCATION_ERROR;
ucnv_unloadSharedDataIfReady(mySharedConverterData);
- return NULL;
+ return nullptr;
}
isCopyLocal = false;
} else {
@@ -1013,12 +1013,12 @@ ucnv_createConverterFromSharedData(UConverter *myUConverter,
myUConverter->toUCallbackReason = UCNV_ILLEGAL; /* default reason to invoke (*fromCharErrorBehaviour) */
}
- if(mySharedConverterData->impl->open != NULL) {
+ if(mySharedConverterData->impl->open != nullptr) {
mySharedConverterData->impl->open(myUConverter, pArgs, err);
if(U_FAILURE(*err) && !pArgs->onlyTestIsLoadable) {
/* don't ucnv_close() if onlyTestIsLoadable because not fully initialized */
ucnv_close(myUConverter);
- return NULL;
+ return nullptr;
}
}
@@ -1030,7 +1030,7 @@ ucnv_createConverterFromSharedData(UConverter *myUConverter,
U_CAPI int32_t U_EXPORT2
ucnv_flushCache ()
{
- UConverterSharedData *mySharedData = NULL;
+ UConverterSharedData *mySharedData = nullptr;
int32_t pos;
int32_t tableDeletedNum = 0;
const UHashElement *e;
@@ -1045,7 +1045,7 @@ ucnv_flushCache ()
/*if shared data hasn't even been lazy evaluated yet
* return 0
*/
- if (SHARED_DATA_HASHTABLE == NULL) {
+ if (SHARED_DATA_HASHTABLE == nullptr) {
UTRACE_EXIT_VALUE((int32_t)0);
return 0;
}
@@ -1072,7 +1072,7 @@ ucnv_flushCache ()
do {
remaining = 0;
pos = UHASH_FIRST;
- while ((e = uhash_nextElement (SHARED_DATA_HASHTABLE, &pos)) != NULL)
+ while ((e = uhash_nextElement (SHARED_DATA_HASHTABLE, &pos)) != nullptr)
{
mySharedData = (UConverterSharedData *) e->value.pointer;
/*deletes only if reference counter == 0 */
@@ -1102,7 +1102,7 @@ ucnv_flushCache ()
static void U_CALLCONV initAvailableConvertersList(UErrorCode &errCode) {
U_ASSERT(gAvailableConverterCount == 0);
- U_ASSERT(gAvailableConverters == NULL);
+ U_ASSERT(gAvailableConverters == nullptr);
ucnv_enableCleanup();
UEnumeration *allConvEnum = ucnv_openAllNames(&errCode);
@@ -1121,13 +1121,13 @@ static void U_CALLCONV initAvailableConvertersList(UErrorCode &errCode) {
/* Open the default converter to make sure that it has first dibs in the hash table. */
UErrorCode localStatus = U_ZERO_ERROR;
UConverter tempConverter;
- ucnv_close(ucnv_createConverter(&tempConverter, NULL, &localStatus));
+ ucnv_close(ucnv_createConverter(&tempConverter, nullptr, &localStatus));
gAvailableConverterCount = 0;
for (int32_t idx = 0; idx < allConverterCount; idx++) {
localStatus = U_ZERO_ERROR;
- const char *converterName = uenum_next(allConvEnum, NULL, &localStatus);
+ const char *converterName = uenum_next(allConvEnum, nullptr, &localStatus);
if (ucnv_canCreateConverter(converterName, &localStatus)) {
gAvailableConverters[gAvailableConverterCount++] = converterName;
}
@@ -1158,7 +1158,7 @@ ucnv_bld_getAvailableConverter(uint16_t n, UErrorCode *pErrorCode) {
}
*pErrorCode = U_INDEX_OUTOFBOUNDS_ERROR;
}
- return NULL;
+ return nullptr;
}
/* default converter name --------------------------------------------------- */
@@ -1181,7 +1181,7 @@ internalSetName(const char *name, UErrorCode *status) {
UConverterNamePieces stackPieces;
UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER;
int32_t length=(int32_t)(uprv_strlen(name));
- UBool containsOption = (UBool)(uprv_strchr(name, UCNV_OPTION_SEP_CHAR) != NULL);
+ UBool containsOption = (UBool)(uprv_strchr(name, UCNV_OPTION_SEP_CHAR) != nullptr);
const UConverterSharedData *algorithmicSharedData;
stackArgs.name = name;
@@ -1240,22 +1240,22 @@ ucnv_getDefaultName() {
icu::Mutex lock(&cnvCacheMutex);
name = gDefaultConverterName;
}
- if(name==NULL) {
+ if(name==nullptr) {
UErrorCode errorCode = U_ZERO_ERROR;
- UConverter *cnv = NULL;
+ UConverter *cnv = nullptr;
name = uprv_getDefaultCodepage();
/* if the name is there, test it out and get the canonical name with options */
- if(name != NULL) {
+ if(name != nullptr) {
cnv = ucnv_open(name, &errorCode);
- if(U_SUCCESS(errorCode) && cnv != NULL) {
+ if(U_SUCCESS(errorCode) && cnv != nullptr) {
name = ucnv_getName(cnv, &errorCode);
}
}
- if(name == NULL || name[0] == 0
- || U_FAILURE(errorCode) || cnv == NULL
+ if(name == nullptr || name[0] == 0
+ || U_FAILURE(errorCode) || cnv == nullptr
|| uprv_strlen(name)>=sizeof(gDefaultConverterNameBuffer))
{
/* Panic time, let's use a fallback. */
@@ -1288,21 +1288,21 @@ See internalSetName or the API reference for details.
*/
U_CAPI void U_EXPORT2
ucnv_setDefaultName(const char *converterName) {
- if(converterName==NULL) {
+ if(converterName==nullptr) {
/* reset to the default codepage */
- gDefaultConverterName=NULL;
+ gDefaultConverterName=nullptr;
} else {
UErrorCode errorCode = U_ZERO_ERROR;
- UConverter *cnv = NULL;
- const char *name = NULL;
+ UConverter *cnv = nullptr;
+ const char *name = nullptr;
/* if the name is there, test it out and get the canonical name with options */
cnv = ucnv_open(converterName, &errorCode);
- if(U_SUCCESS(errorCode) && cnv != NULL) {
+ if(U_SUCCESS(errorCode) && cnv != nullptr) {
name = ucnv_getName(cnv, &errorCode);
}
- if(U_SUCCESS(errorCode) && name!=NULL) {
+ if(U_SUCCESS(errorCode) && name!=nullptr) {
internalSetName(name, &errorCode);
}
/* else this converter is bad to use. Don't change it to a bad value. */
@@ -1353,7 +1353,7 @@ ucnv_swap(const UDataSwapper *ds,
/* udata_swapDataHeader checks the arguments */
headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
@@ -1376,7 +1376,7 @@ ucnv_swap(const UDataSwapper *ds,
}
inBytes=(const uint8_t *)inData+headerSize;
- outBytes=(uint8_t *)outData+headerSize;
+ outBytes=(outData == nullptr) ? nullptr : (uint8_t *)outData+headerSize;
/* read the initial UConverterStaticData structure after the UDataInfo header */
inStaticData=(const UConverterStaticData *)inBytes;
@@ -1416,7 +1416,7 @@ ucnv_swap(const UDataSwapper *ds,
}
inBytes+=staticDataSize;
- outBytes+=staticDataSize;
+ if (outBytes != nullptr) outBytes+=staticDataSize;
if(length>=0) {
length-=(int32_t)staticDataSize;
}
@@ -1509,7 +1509,7 @@ ucnv_swap(const UDataSwapper *ds,
}
/* avoid compiler warnings - not otherwise necessary, and the value does not matter */
- inExtIndexes=NULL;
+ inExtIndexes=nullptr;
} else {
/* there is extension data after the base data, see ucnv_ext.h */
if(length>=0 && length<(extOffset+UCNV_EXT_INDEXES_MIN_LENGTH*4)) {
diff --git a/thirdparty/icu4c/common/ucnv_cb.cpp b/thirdparty/icu4c/common/ucnv_cb.cpp
index 7bfde82870..dd559270dd 100644
--- a/thirdparty/icu4c/common/ucnv_cb.cpp
+++ b/thirdparty/icu4c/common/ucnv_cb.cpp
@@ -54,8 +54,8 @@ ucnv_cbFromUWriteBytes (UConverterFromUnicodeArgs *args,
U_CAPI void U_EXPORT2
ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args,
- const UChar** source,
- const UChar* sourceLimit,
+ const char16_t** source,
+ const char16_t* sourceLimit,
int32_t offsetIndex,
UErrorCode * err)
{
@@ -85,7 +85,7 @@ ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args,
args->targetLimit,
source,
sourceLimit,
- NULL, /* no offsets */
+ nullptr, /* no offsets */
false, /* no flush */
err);
@@ -140,7 +140,7 @@ ucnv_cbFromUWriteUChars(UConverterFromUnicodeArgs *args,
newTargetLimit,
source,
sourceLimit,
- NULL,
+ nullptr,
false,
&err2);
@@ -200,12 +200,12 @@ ucnv_cbFromUWriteSub (UConverterFromUnicodeArgs *args,
* and will not recurse.
* At worst we should get a U_BUFFER_OVERFLOW_ERROR.
*/
- const UChar *source = (const UChar *)converter->subChars;
+ const char16_t *source = (const char16_t *)converter->subChars;
ucnv_cbFromUWriteUChars(args, &source, source - length, offsetIndex, err);
return;
}
- if(converter->sharedData->impl->writeSub!=NULL) {
+ if(converter->sharedData->impl->writeSub!=nullptr) {
converter->sharedData->impl->writeSub(args, offsetIndex, err);
}
else if(converter->subChar1!=0 && (uint16_t)converter->invalidUCharBuffer[0]<=(uint16_t)0xffu) {
@@ -226,7 +226,7 @@ ucnv_cbFromUWriteSub (UConverterFromUnicodeArgs *args,
U_CAPI void U_EXPORT2
ucnv_cbToUWriteUChars (UConverterToUnicodeArgs *args,
- const UChar* source,
+ const char16_t* source,
int32_t length,
int32_t offsetIndex,
UErrorCode * err)
@@ -248,7 +248,7 @@ ucnv_cbToUWriteSub (UConverterToUnicodeArgs *args,
int32_t offsetIndex,
UErrorCode * err)
{
- static const UChar kSubstituteChar1 = 0x1A, kSubstituteChar = 0xFFFD;
+ static const char16_t kSubstituteChar1 = 0x1A, kSubstituteChar = 0xFFFD;
/* could optimize this case, just one uchar */
if(args->converter->invalidCharLength == 1 && args->converter->subChar1 != 0) {
diff --git a/thirdparty/icu4c/common/ucnv_cnv.cpp b/thirdparty/icu4c/common/ucnv_cnv.cpp
index ea71acf92c..ffff9429ad 100644
--- a/thirdparty/icu4c/common/ucnv_cnv.cpp
+++ b/thirdparty/icu4c/common/ucnv_cnv.cpp
@@ -62,7 +62,7 @@ ucnv_fromUWriteBytes(UConverter *cnv,
int32_t *o;
/* write bytes */
- if(offsets==NULL || (o=*offsets)==NULL) {
+ if(offsets==nullptr || (o=*offsets)==nullptr) {
while(length>0 && t<targetLimit) {
*t++=*bytes++;
--length;
@@ -80,7 +80,7 @@ ucnv_fromUWriteBytes(UConverter *cnv,
/* write overflow */
if(length>0) {
- if(cnv!=NULL) {
+ if(cnv!=nullptr) {
t=(char *)cnv->charErrorBuffer;
cnv->charErrorBufferLength=(int8_t)length;
do {
@@ -93,16 +93,16 @@ ucnv_fromUWriteBytes(UConverter *cnv,
U_CFUNC void
ucnv_toUWriteUChars(UConverter *cnv,
- const UChar *uchars, int32_t length,
- UChar **target, const UChar *targetLimit,
+ const char16_t *uchars, int32_t length,
+ char16_t **target, const char16_t *targetLimit,
int32_t **offsets,
int32_t sourceIndex,
UErrorCode *pErrorCode) {
- UChar *t=*target;
+ char16_t *t=*target;
int32_t *o;
/* write UChars */
- if(offsets==NULL || (o=*offsets)==NULL) {
+ if(offsets==nullptr || (o=*offsets)==nullptr) {
while(length>0 && t<targetLimit) {
*t++=*uchars++;
--length;
@@ -120,7 +120,7 @@ ucnv_toUWriteUChars(UConverter *cnv,
/* write overflow */
if(length>0) {
- if(cnv!=NULL) {
+ if(cnv!=nullptr) {
t=cnv->UCharErrorBuffer;
cnv->UCharErrorBufferLength=(int8_t)length;
do {
@@ -134,30 +134,30 @@ ucnv_toUWriteUChars(UConverter *cnv,
U_CFUNC void
ucnv_toUWriteCodePoint(UConverter *cnv,
UChar32 c,
- UChar **target, const UChar *targetLimit,
+ char16_t **target, const char16_t *targetLimit,
int32_t **offsets,
int32_t sourceIndex,
UErrorCode *pErrorCode) {
- UChar *t;
+ char16_t *t;
int32_t *o;
t=*target;
if(t<targetLimit) {
if(c<=0xffff) {
- *t++=(UChar)c;
+ *t++=(char16_t)c;
c=U_SENTINEL;
} else /* c is a supplementary code point */ {
*t++=U16_LEAD(c);
c=U16_TRAIL(c);
if(t<targetLimit) {
- *t++=(UChar)c;
+ *t++=(char16_t)c;
c=U_SENTINEL;
}
}
/* write offsets */
- if(offsets!=NULL && (o=*offsets)!=NULL) {
+ if(offsets!=nullptr && (o=*offsets)!=nullptr) {
*o++=sourceIndex;
if((*target+1)<t) {
*o++=sourceIndex;
@@ -170,7 +170,7 @@ ucnv_toUWriteCodePoint(UConverter *cnv,
/* write overflow from c */
if(c>=0) {
- if(cnv!=NULL) {
+ if(cnv!=nullptr) {
int8_t i=0;
U16_APPEND_UNSAFE(cnv->UCharErrorBuffer, i, c);
cnv->UCharErrorBufferLength=i;
diff --git a/thirdparty/icu4c/common/ucnv_ct.cpp b/thirdparty/icu4c/common/ucnv_ct.cpp
index c12e982b88..46f30e5ece 100644
--- a/thirdparty/icu4c/common/ucnv_ct.cpp
+++ b/thirdparty/icu4c/common/ucnv_ct.cpp
@@ -261,13 +261,13 @@ static COMPOUND_TEXT_CONVERTERS findStateFromEscSeq(const char* source, const ch
static void U_CALLCONV
_CompoundTextOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
cnv->extraInfo = uprv_malloc (sizeof (UConverterDataCompoundText));
- if (cnv->extraInfo != NULL) {
+ if (cnv->extraInfo != nullptr) {
UConverterDataCompoundText *myConverterData = (UConverterDataCompoundText *) cnv->extraInfo;
UConverterNamePieces stackPieces;
UConverterLoadArgs stackArgs=UCNV_LOAD_ARGS_INITIALIZER;
- myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_0] = NULL;
+ myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_0] = nullptr;
myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_1] = ucnv_loadSharedData("icu-internal-compound-s1", &stackPieces, &stackArgs, errorCode);
myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_2] = ucnv_loadSharedData("icu-internal-compound-s2", &stackPieces, &stackArgs, errorCode);
myConverterData->myConverterArray[COMPOUND_TEXT_SINGLE_3] = ucnv_loadSharedData("icu-internal-compound-s3", &stackPieces, &stackArgs, errorCode);
@@ -306,16 +306,16 @@ _CompoundTextClose(UConverter *converter) {
UConverterDataCompoundText* myConverterData = (UConverterDataCompoundText*)(converter->extraInfo);
int32_t i;
- if (converter->extraInfo != NULL) {
+ if (converter->extraInfo != nullptr) {
/*close the array of converter pointers and free the memory*/
for (i = 0; i < NUM_OF_CONVERTERS; i++) {
- if (myConverterData->myConverterArray[i] != NULL) {
+ if (myConverterData->myConverterArray[i] != nullptr) {
ucnv_unloadSharedDataIfReady(myConverterData->myConverterArray[i]);
}
}
uprv_free(converter->extraInfo);
- converter->extraInfo = NULL;
+ converter->extraInfo = nullptr;
}
}
@@ -336,8 +336,8 @@ UConverter_fromUnicode_CompoundText_OFFSETS(UConverterFromUnicodeArgs* args, UEr
UConverter *cnv = args->converter;
uint8_t *target = (uint8_t *) args->target;
const uint8_t *targetLimit = (const uint8_t *) args->targetLimit;
- const UChar* source = args->source;
- const UChar* sourceLimit = args->sourceLimit;
+ const char16_t* source = args->source;
+ const char16_t* sourceLimit = args->sourceLimit;
/* int32_t* offsets = args->offsets; */
UChar32 sourceChar;
UBool useFallback = cnv->useFallback;
@@ -368,7 +368,7 @@ getTrail:
/*look ahead to find the trail surrogate*/
if(source < sourceLimit) {
/* test the following code unit */
- UChar trail=(UChar) *source;
+ char16_t trail=(char16_t) *source;
if(U16_IS_TRAIL(trail)) {
source++;
sourceChar=U16_GET_SUPPLEMENTARY(sourceChar, trail);
@@ -467,14 +467,14 @@ static void U_CALLCONV
UConverter_toUnicode_CompoundText_OFFSETS(UConverterToUnicodeArgs *args,
UErrorCode* err){
const char *mySource = (char *) args->source;
- UChar *myTarget = args->target;
+ char16_t *myTarget = args->target;
const char *mySourceLimit = args->sourceLimit;
const char *tmpSourceLimit = mySourceLimit;
uint32_t mySourceChar = 0x0000;
COMPOUND_TEXT_CONVERTERS currentState, tmpState;
int32_t sourceOffset = 0;
UConverterDataCompoundText *myConverterData = (UConverterDataCompoundText *) args->converter->extraInfo;
- UConverterSharedData* savedSharedData = NULL;
+ UConverterSharedData* savedSharedData = nullptr;
UConverterToUnicodeArgs subArgs;
int32_t minArgsSize;
@@ -602,8 +602,8 @@ static const UConverterImpl _CompoundTextImpl = {
UCNV_COMPOUND_TEXT,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_CompoundTextOpen,
_CompoundTextClose,
@@ -613,15 +613,15 @@ static const UConverterImpl _CompoundTextImpl = {
UConverter_toUnicode_CompoundText_OFFSETS,
UConverter_fromUnicode_CompoundText_OFFSETS,
UConverter_fromUnicode_CompoundText_OFFSETS,
- NULL,
+ nullptr,
- NULL,
+ nullptr,
_CompoundTextgetName,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_CompoundText_GetUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
static const UConverterStaticData _CompoundTextStaticData = {
diff --git a/thirdparty/icu4c/common/ucnv_err.cpp b/thirdparty/icu4c/common/ucnv_err.cpp
index 4210673ef9..761c442632 100644
--- a/thirdparty/icu4c/common/ucnv_err.cpp
+++ b/thirdparty/icu4c/common/ucnv_err.cpp
@@ -91,7 +91,7 @@ U_CAPI void U_EXPORT2
UCNV_FROM_U_CALLBACK_STOP (
const void *context,
UConverterFromUnicodeArgs *fromUArgs,
- const UChar* codeUnits,
+ const char16_t* codeUnits,
int32_t length,
UChar32 codePoint,
UConverterCallbackReason reason,
@@ -132,7 +132,7 @@ U_CAPI void U_EXPORT2
UCNV_FROM_U_CALLBACK_SKIP (
const void *context,
UConverterFromUnicodeArgs *fromUArgs,
- const UChar* codeUnits,
+ const char16_t* codeUnits,
int32_t length,
UChar32 codePoint,
UConverterCallbackReason reason,
@@ -150,7 +150,7 @@ UCNV_FROM_U_CALLBACK_SKIP (
*/
*err = U_ZERO_ERROR;
}
- else if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
+ else if (context == nullptr || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
{
*err = U_ZERO_ERROR;
}
@@ -163,7 +163,7 @@ U_CAPI void U_EXPORT2
UCNV_FROM_U_CALLBACK_SUBSTITUTE (
const void *context,
UConverterFromUnicodeArgs *fromArgs,
- const UChar* codeUnits,
+ const char16_t* codeUnits,
int32_t length,
UChar32 codePoint,
UConverterCallbackReason reason,
@@ -180,7 +180,7 @@ UCNV_FROM_U_CALLBACK_SUBSTITUTE (
*/
*err = U_ZERO_ERROR;
}
- else if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
+ else if (context == nullptr || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
{
*err = U_ZERO_ERROR;
ucnv_cbFromUWriteSub(fromArgs, 0, err);
@@ -199,23 +199,23 @@ U_CAPI void U_EXPORT2
UCNV_FROM_U_CALLBACK_ESCAPE (
const void *context,
UConverterFromUnicodeArgs *fromArgs,
- const UChar *codeUnits,
+ const char16_t *codeUnits,
int32_t length,
UChar32 codePoint,
UConverterCallbackReason reason,
UErrorCode * err)
{
- UChar valueString[VALUE_STRING_LENGTH];
+ char16_t valueString[VALUE_STRING_LENGTH];
int32_t valueStringLength = 0;
int32_t i = 0;
- const UChar *myValueSource = NULL;
+ const char16_t *myValueSource = nullptr;
UErrorCode err2 = U_ZERO_ERROR;
- UConverterFromUCallback original = NULL;
+ UConverterFromUCallback original = nullptr;
const void *originalContext;
- UConverterFromUCallback ignoredCallback = NULL;
+ UConverterFromUCallback ignoredCallback = nullptr;
const void *ignoredContext;
if (reason > UCNV_IRREGULAR)
@@ -233,7 +233,7 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
ucnv_setFromUCallBack (fromArgs->converter,
(UConverterFromUCallback) UCNV_FROM_U_CALLBACK_SUBSTITUTE,
- NULL,
+ nullptr,
&original,
&originalContext,
&err2);
@@ -243,12 +243,12 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
*err = err2;
return;
}
- if(context==NULL)
+ if(context==nullptr)
{
while (i < length)
{
- valueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
- valueString[valueStringLength++] = (UChar) UNICODE_U_CODEPOINT; /* adding U */
+ valueString[valueStringLength++] = (char16_t) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
+ valueString[valueStringLength++] = (char16_t) UNICODE_U_CODEPOINT; /* adding U */
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[i++], 16, 4);
}
}
@@ -259,78 +259,78 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
case UCNV_PRV_ESCAPE_JAVA:
while (i < length)
{
- valueString[valueStringLength++] = (UChar) UNICODE_RS_CODEPOINT; /* adding \ */
- valueString[valueStringLength++] = (UChar) UNICODE_U_LOW_CODEPOINT; /* adding u */
+ valueString[valueStringLength++] = (char16_t) UNICODE_RS_CODEPOINT; /* adding \ */
+ valueString[valueStringLength++] = (char16_t) UNICODE_U_LOW_CODEPOINT; /* adding u */
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[i++], 16, 4);
}
break;
case UCNV_PRV_ESCAPE_C:
- valueString[valueStringLength++] = (UChar) UNICODE_RS_CODEPOINT; /* adding \ */
+ valueString[valueStringLength++] = (char16_t) UNICODE_RS_CODEPOINT; /* adding \ */
if(length==2){
- valueString[valueStringLength++] = (UChar) UNICODE_U_CODEPOINT; /* adding U */
+ valueString[valueStringLength++] = (char16_t) UNICODE_U_CODEPOINT; /* adding U */
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 8);
}
else{
- valueString[valueStringLength++] = (UChar) UNICODE_U_LOW_CODEPOINT; /* adding u */
+ valueString[valueStringLength++] = (char16_t) UNICODE_U_LOW_CODEPOINT; /* adding u */
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[0], 16, 4);
}
break;
case UCNV_PRV_ESCAPE_XML_DEC:
- valueString[valueStringLength++] = (UChar) UNICODE_AMP_CODEPOINT; /* adding & */
- valueString[valueStringLength++] = (UChar) UNICODE_HASH_CODEPOINT; /* adding # */
+ valueString[valueStringLength++] = (char16_t) UNICODE_AMP_CODEPOINT; /* adding & */
+ valueString[valueStringLength++] = (char16_t) UNICODE_HASH_CODEPOINT; /* adding # */
if(length==2){
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 10, 0);
}
else{
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[0], 10, 0);
}
- valueString[valueStringLength++] = (UChar) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
+ valueString[valueStringLength++] = (char16_t) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
break;
case UCNV_PRV_ESCAPE_XML_HEX:
- valueString[valueStringLength++] = (UChar) UNICODE_AMP_CODEPOINT; /* adding & */
- valueString[valueStringLength++] = (UChar) UNICODE_HASH_CODEPOINT; /* adding # */
- valueString[valueStringLength++] = (UChar) UNICODE_X_LOW_CODEPOINT; /* adding x */
+ valueString[valueStringLength++] = (char16_t) UNICODE_AMP_CODEPOINT; /* adding & */
+ valueString[valueStringLength++] = (char16_t) UNICODE_HASH_CODEPOINT; /* adding # */
+ valueString[valueStringLength++] = (char16_t) UNICODE_X_LOW_CODEPOINT; /* adding x */
if(length==2){
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 0);
}
else{
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[0], 16, 0);
}
- valueString[valueStringLength++] = (UChar) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
+ valueString[valueStringLength++] = (char16_t) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
break;
case UCNV_PRV_ESCAPE_UNICODE:
- valueString[valueStringLength++] = (UChar) UNICODE_LEFT_CURLY_CODEPOINT; /* adding { */
- valueString[valueStringLength++] = (UChar) UNICODE_U_CODEPOINT; /* adding U */
- valueString[valueStringLength++] = (UChar) UNICODE_PLUS_CODEPOINT; /* adding + */
+ valueString[valueStringLength++] = (char16_t) UNICODE_LEFT_CURLY_CODEPOINT; /* adding { */
+ valueString[valueStringLength++] = (char16_t) UNICODE_U_CODEPOINT; /* adding U */
+ valueString[valueStringLength++] = (char16_t) UNICODE_PLUS_CODEPOINT; /* adding + */
if (length == 2) {
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 4);
} else {
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[0], 16, 4);
}
- valueString[valueStringLength++] = (UChar) UNICODE_RIGHT_CURLY_CODEPOINT; /* adding } */
+ valueString[valueStringLength++] = (char16_t) UNICODE_RIGHT_CURLY_CODEPOINT; /* adding } */
break;
case UCNV_PRV_ESCAPE_CSS2:
- valueString[valueStringLength++] = (UChar) UNICODE_RS_CODEPOINT; /* adding \ */
+ valueString[valueStringLength++] = (char16_t) UNICODE_RS_CODEPOINT; /* adding \ */
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, codePoint, 16, 0);
/* Always add space character, because the next character might be whitespace,
which would erroneously be considered the termination of the escape sequence. */
- valueString[valueStringLength++] = (UChar) UNICODE_SPACE_CODEPOINT;
+ valueString[valueStringLength++] = (char16_t) UNICODE_SPACE_CODEPOINT;
break;
default:
while (i < length)
{
- valueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
- valueString[valueStringLength++] = (UChar) UNICODE_U_CODEPOINT; /* adding U */
+ valueString[valueStringLength++] = (char16_t) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
+ valueString[valueStringLength++] = (char16_t) UNICODE_U_CODEPOINT; /* adding U */
valueStringLength += uprv_itou (valueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint16_t)codeUnits[i++], 16, 4);
}
}
@@ -373,7 +373,7 @@ UCNV_TO_U_CALLBACK_SKIP (
(void)length;
if (reason <= UCNV_IRREGULAR)
{
- if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
+ if (context == nullptr || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
{
*err = U_ZERO_ERROR;
}
@@ -395,7 +395,7 @@ UCNV_TO_U_CALLBACK_SUBSTITUTE (
(void)length;
if (reason <= UCNV_IRREGULAR)
{
- if (context == NULL || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
+ if (context == nullptr || (*((char*)context) == UCNV_PRV_STOP_ON_ILLEGAL && reason == UCNV_UNASSIGNED))
{
*err = U_ZERO_ERROR;
ucnv_cbToUWriteSub(toArgs,0,err);
@@ -417,7 +417,7 @@ UCNV_TO_U_CALLBACK_ESCAPE (
UConverterCallbackReason reason,
UErrorCode * err)
{
- UChar uniValueString[VALUE_STRING_LENGTH];
+ char16_t uniValueString[VALUE_STRING_LENGTH];
int32_t valueStringLength = 0;
int32_t i = 0;
@@ -426,12 +426,12 @@ UCNV_TO_U_CALLBACK_ESCAPE (
return;
}
- if(context==NULL)
+ if(context==nullptr)
{
while (i < length)
{
- uniValueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
- uniValueString[valueStringLength++] = (UChar) UNICODE_X_CODEPOINT; /* adding X */
+ uniValueString[valueStringLength++] = (char16_t) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
+ uniValueString[valueStringLength++] = (char16_t) UNICODE_X_CODEPOINT; /* adding X */
valueStringLength += uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t) codeUnits[i++], 16, 2);
}
}
@@ -442,36 +442,36 @@ UCNV_TO_U_CALLBACK_ESCAPE (
case UCNV_PRV_ESCAPE_XML_DEC:
while (i < length)
{
- uniValueString[valueStringLength++] = (UChar) UNICODE_AMP_CODEPOINT; /* adding & */
- uniValueString[valueStringLength++] = (UChar) UNICODE_HASH_CODEPOINT; /* adding # */
+ uniValueString[valueStringLength++] = (char16_t) UNICODE_AMP_CODEPOINT; /* adding & */
+ uniValueString[valueStringLength++] = (char16_t) UNICODE_HASH_CODEPOINT; /* adding # */
valueStringLength += uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t)codeUnits[i++], 10, 0);
- uniValueString[valueStringLength++] = (UChar) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
+ uniValueString[valueStringLength++] = (char16_t) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
}
break;
case UCNV_PRV_ESCAPE_XML_HEX:
while (i < length)
{
- uniValueString[valueStringLength++] = (UChar) UNICODE_AMP_CODEPOINT; /* adding & */
- uniValueString[valueStringLength++] = (UChar) UNICODE_HASH_CODEPOINT; /* adding # */
- uniValueString[valueStringLength++] = (UChar) UNICODE_X_LOW_CODEPOINT; /* adding x */
+ uniValueString[valueStringLength++] = (char16_t) UNICODE_AMP_CODEPOINT; /* adding & */
+ uniValueString[valueStringLength++] = (char16_t) UNICODE_HASH_CODEPOINT; /* adding # */
+ uniValueString[valueStringLength++] = (char16_t) UNICODE_X_LOW_CODEPOINT; /* adding x */
valueStringLength += uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t)codeUnits[i++], 16, 0);
- uniValueString[valueStringLength++] = (UChar) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
+ uniValueString[valueStringLength++] = (char16_t) UNICODE_SEMICOLON_CODEPOINT; /* adding ; */
}
break;
case UCNV_PRV_ESCAPE_C:
while (i < length)
{
- uniValueString[valueStringLength++] = (UChar) UNICODE_RS_CODEPOINT; /* adding \ */
- uniValueString[valueStringLength++] = (UChar) UNICODE_X_LOW_CODEPOINT; /* adding x */
+ uniValueString[valueStringLength++] = (char16_t) UNICODE_RS_CODEPOINT; /* adding \ */
+ uniValueString[valueStringLength++] = (char16_t) UNICODE_X_LOW_CODEPOINT; /* adding x */
valueStringLength += uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t)codeUnits[i++], 16, 2);
}
break;
default:
while (i < length)
{
- uniValueString[valueStringLength++] = (UChar) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
- uniValueString[valueStringLength++] = (UChar) UNICODE_X_CODEPOINT; /* adding X */
+ uniValueString[valueStringLength++] = (char16_t) UNICODE_PERCENT_SIGN_CODEPOINT; /* adding % */
+ uniValueString[valueStringLength++] = (char16_t) UNICODE_X_CODEPOINT; /* adding X */
uprv_itou (uniValueString + valueStringLength, VALUE_STRING_LENGTH - valueStringLength, (uint8_t) codeUnits[i++], 16, 2);
valueStringLength += 2;
}
diff --git a/thirdparty/icu4c/common/ucnv_ext.cpp b/thirdparty/icu4c/common/ucnv_ext.cpp
index ffc3c93033..10d00a62c2 100644
--- a/thirdparty/icu4c/common/ucnv_ext.cpp
+++ b/thirdparty/icu4c/common/ucnv_ext.cpp
@@ -132,7 +132,7 @@ ucnv_extMatchToU(const int32_t *cx, int8_t sisoState,
int32_t i, j, idx, length, matchLength;
uint8_t b;
- if(cx==NULL || cx[UCNV_EXT_TO_U_LENGTH]<=0) {
+ if(cx==nullptr || cx[UCNV_EXT_TO_U_LENGTH]<=0) {
return 0; /* no extension data, no match */
}
@@ -198,7 +198,7 @@ ucnv_extMatchToU(const int32_t *cx, int8_t sisoState,
}
}
- /* search for the current UChar */
+ /* search for the current char16_t */
value=ucnv_extFindToU(toUSection, length, b);
if(value==0) {
/* no match here, stop with the longest match so far */
@@ -236,7 +236,7 @@ ucnv_extMatchToU(const int32_t *cx, int8_t sisoState,
static inline void
ucnv_extWriteToU(UConverter *cnv, const int32_t *cx,
uint32_t value,
- UChar **target, const UChar *targetLimit,
+ char16_t **target, const char16_t *targetLimit,
int32_t **offsets, int32_t srcIndex,
UErrorCode *pErrorCode) {
/* output the result */
@@ -251,7 +251,7 @@ ucnv_extWriteToU(UConverter *cnv, const int32_t *cx,
/* output a string - with correct data we have resultLength>0 */
ucnv_toUWriteUChars(
cnv,
- UCNV_EXT_ARRAY(cx, UCNV_EXT_TO_U_UCHARS_INDEX, UChar)+
+ UCNV_EXT_ARRAY(cx, UCNV_EXT_TO_U_UCHARS_INDEX, char16_t)+
UCNV_EXT_TO_U_GET_INDEX(value),
UCNV_EXT_TO_U_GET_LENGTH(value),
target, targetLimit,
@@ -279,7 +279,7 @@ U_CFUNC UBool
ucnv_extInitialMatchToU(UConverter *cnv, const int32_t *cx,
int32_t firstLength,
const char **src, const char *srcLimit,
- UChar **target, const UChar *targetLimit,
+ char16_t **target, const char16_t *targetLimit,
int32_t **offsets, int32_t srcIndex,
UBool flush,
UErrorCode *pErrorCode) {
@@ -343,7 +343,7 @@ ucnv_extSimpleMatchToU(const int32_t *cx,
/* try to match */
match=ucnv_extMatchToU(cx, -1,
source, length,
- NULL, 0,
+ nullptr, 0,
&value,
useFallback, true);
if(match==length) {
@@ -459,10 +459,10 @@ extFromUUseMapping(UBool useFallback, uint32_t value, UChar32 firstCP) {
}
/*
- * @return index of the UChar, if found; else <0
+ * @return index of the char16_t, if found; else <0
*/
static inline int32_t
-ucnv_extFindFromU(const UChar *fromUSection, int32_t length, UChar u) {
+ucnv_extFindFromU(const char16_t *fromUSection, int32_t length, char16_t u) {
int32_t i, start, limit;
/* binary search */
@@ -508,7 +508,7 @@ ucnv_extFindFromU(const UChar *fromUSection, int32_t length, UChar u) {
}
/*
- * @param cx pointer to extension data; if NULL, returns 0
+ * @param cx pointer to extension data; if nullptr, returns 0
* @param firstCP the first code point before all the other UChars
* @param pre UChars that must match; !initialMatch: partial match with them
* @param preLength length of pre, >=0
@@ -530,21 +530,21 @@ ucnv_extFindFromU(const UChar *fromUSection, int32_t length, UChar u) {
static int32_t
ucnv_extMatchFromU(const int32_t *cx,
UChar32 firstCP,
- const UChar *pre, int32_t preLength,
- const UChar *src, int32_t srcLength,
+ const char16_t *pre, int32_t preLength,
+ const char16_t *src, int32_t srcLength,
uint32_t *pMatchValue,
UBool useFallback, UBool flush) {
const uint16_t *stage12, *stage3;
const uint32_t *stage3b;
- const UChar *fromUTableUChars, *fromUSectionUChars;
+ const char16_t *fromUTableUChars, *fromUSectionUChars;
const uint32_t *fromUTableValues, *fromUSectionValues;
uint32_t value, matchValue;
int32_t i, j, idx, length, matchLength;
- UChar c;
+ char16_t c;
- if(cx==NULL) {
+ if(cx==nullptr) {
return 0; /* no extension data, no match */
}
@@ -575,7 +575,7 @@ ucnv_extMatchFromU(const int32_t *cx,
idx=(int32_t)UCNV_EXT_FROM_U_GET_PARTIAL_INDEX(value);
/* initialize */
- fromUTableUChars=UCNV_EXT_ARRAY(cx, UCNV_EXT_FROM_U_UCHARS_INDEX, UChar);
+ fromUTableUChars=UCNV_EXT_ARRAY(cx, UCNV_EXT_FROM_U_UCHARS_INDEX, char16_t);
fromUTableValues=UCNV_EXT_ARRAY(cx, UCNV_EXT_FROM_U_VALUES_INDEX, uint32_t);
matchValue=0;
@@ -618,7 +618,7 @@ ucnv_extMatchFromU(const int32_t *cx,
}
}
- /* search for the current UChar */
+ /* search for the current char16_t */
idx=ucnv_extFindFromU(fromUSectionUChars, length, c);
if(idx<0) {
/* no match here, stop with the longest match so far */
@@ -749,7 +749,7 @@ ucnv_extWriteFromU(UConverter *cnv, const int32_t *cx,
U_CFUNC UBool
ucnv_extInitialMatchFromU(UConverter *cnv, const int32_t *cx,
UChar32 cp,
- const UChar **src, const UChar *srcLimit,
+ const char16_t **src, const char16_t *srcLimit,
char **target, const char *targetLimit,
int32_t **offsets, int32_t srcIndex,
UBool flush,
@@ -759,7 +759,7 @@ ucnv_extInitialMatchFromU(UConverter *cnv, const int32_t *cx,
/* try to match */
match=ucnv_extMatchFromU(cx, cp,
- NULL, 0,
+ nullptr, 0,
*src, (int32_t)(srcLimit-*src),
&value,
cnv->useFallback, flush);
@@ -781,7 +781,7 @@ ucnv_extInitialMatchFromU(UConverter *cnv, const int32_t *cx,
return true;
} else if(match<0) {
/* save state for partial match */
- const UChar *s;
+ const char16_t *s;
int32_t j;
/* copy the first code point */
@@ -819,8 +819,8 @@ ucnv_extSimpleMatchFromU(const int32_t *cx,
/* try to match */
match=ucnv_extMatchFromU(cx,
cp,
- NULL, 0,
- NULL, 0,
+ nullptr, 0,
+ nullptr, 0,
&value,
useFallback, true);
if(match>=2) {
@@ -901,7 +901,7 @@ ucnv_extContinueMatchFromU(UConverter *cnv,
pErrorCode);
} else if(match<0) {
/* save state for partial match */
- const UChar *s;
+ const char16_t *s;
int32_t j;
/* just _append_ the newly consumed input to preFromU[] */
@@ -981,16 +981,16 @@ ucnv_extGetUnicodeSetString(const UConverterSharedData *sharedData,
UConverterUnicodeSet which,
int32_t minLength,
UChar32 firstCP,
- UChar s[UCNV_EXT_MAX_UCHARS], int32_t length,
+ char16_t s[UCNV_EXT_MAX_UCHARS], int32_t length,
int32_t sectionIndex,
UErrorCode *pErrorCode) {
- const UChar *fromUSectionUChars;
+ const char16_t *fromUSectionUChars;
const uint32_t *fromUSectionValues;
uint32_t value;
int32_t i, count;
- fromUSectionUChars=UCNV_EXT_ARRAY(cx, UCNV_EXT_FROM_U_UCHARS_INDEX, UChar)+sectionIndex;
+ fromUSectionUChars=UCNV_EXT_ARRAY(cx, UCNV_EXT_FROM_U_UCHARS_INDEX, char16_t)+sectionIndex;
fromUSectionValues=UCNV_EXT_ARRAY(cx, UCNV_EXT_FROM_U_VALUES_INDEX, uint32_t)+sectionIndex;
/* read first pair of the section */
@@ -1039,12 +1039,12 @@ ucnv_extGetUnicodeSet(const UConverterSharedData *sharedData,
uint32_t value;
int32_t st1, stage1Length, st2, st3, minLength;
- UChar s[UCNV_EXT_MAX_UCHARS];
+ char16_t s[UCNV_EXT_MAX_UCHARS];
UChar32 c;
int32_t length;
cx=sharedData->mbcs.extIndexes;
- if(cx==NULL) {
+ if(cx==nullptr) {
return;
}
diff --git a/thirdparty/icu4c/common/ucnv_io.cpp b/thirdparty/icu4c/common/ucnv_io.cpp
index c9d20cb941..48bb5be42b 100644
--- a/thirdparty/icu4c/common/ucnv_io.cpp
+++ b/thirdparty/icu4c/common/ucnv_io.cpp
@@ -174,7 +174,7 @@ typedef struct UAliasContext {
static const char DATA_NAME[] = "cnvalias";
static const char DATA_TYPE[] = "icu";
-static UDataMemory *gAliasData=NULL;
+static UDataMemory *gAliasData=nullptr;
static icu::UInitOnce gAliasDataInitOnce {};
enum {
@@ -216,11 +216,11 @@ isAcceptable(void * /*context*/,
pInfo->formatVersion[0]==3);
}
-static UBool U_CALLCONV ucnv_io_cleanup(void)
+static UBool U_CALLCONV ucnv_io_cleanup()
{
if (gAliasData) {
udata_close(gAliasData);
- gAliasData = NULL;
+ gAliasData = nullptr;
}
gAliasDataInitOnce.reset();
@@ -238,8 +238,8 @@ static void U_CALLCONV initAliasData(UErrorCode &errCode) {
ucln_common_registerCleanup(UCLN_COMMON_UCNV_IO, ucnv_io_cleanup);
- U_ASSERT(gAliasData == NULL);
- data = udata_openChoice(NULL, DATA_TYPE, DATA_NAME, isAcceptable, NULL, &errCode);
+ U_ASSERT(gAliasData == nullptr);
+ data = udata_openChoice(nullptr, DATA_TYPE, DATA_NAME, isAcceptable, nullptr, &errCode);
if(U_FAILURE(errCode)) {
return;
}
@@ -317,7 +317,7 @@ haveAliasData(UErrorCode *pErrorCode) {
static inline UBool
isAlias(const char *alias, UErrorCode *pErrorCode) {
- if(alias==NULL) {
+ if(alias==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return false;
}
@@ -615,7 +615,7 @@ findConverter(const char *alias, UBool *containsOption, UErrorCode *pErrorCode)
/*
* Is this alias in this list?
- * alias and listOffset should be non-NULL.
+ * alias and listOffset should be non-nullptr.
*/
static inline UBool
isAliasInList(const char *alias, uint32_t listOffset) {
@@ -650,7 +650,7 @@ findTaggedAliasListsOffset(const char *alias, const char *standard, UErrorCode *
uint32_t tagNum = getTagNumber(standard);
/* Make a quick guess. Hopefully they used a TR22 canonical alias. */
- convNum = findConverter(alias, NULL, &myErr);
+ convNum = findConverter(alias, nullptr, &myErr);
if (myErr != U_ZERO_ERROR) {
*pErrorCode = myErr;
}
@@ -701,7 +701,7 @@ findTaggedConverterNum(const char *alias, const char *standard, UErrorCode *pErr
uint32_t tagNum = getTagNumber(standard);
/* Make a quick guess. Hopefully they used a TR22 canonical alias. */
- convNum = findConverter(alias, NULL, &myErr);
+ convNum = findConverter(alias, nullptr, &myErr);
if (myErr != U_ZERO_ERROR) {
*pErrorCode = myErr;
}
@@ -762,7 +762,7 @@ ucnv_io_getConverterName(const char *alias, UBool *containsOption, UErrorCode *p
}
}
- return NULL;
+ return nullptr;
}
U_CDECL_BEGIN
@@ -804,7 +804,7 @@ ucnv_io_nextStandardAliases(UEnumeration *enumerator,
if (resultLength) {
*resultLength = 0;
}
- return NULL;
+ return nullptr;
}
static void U_CALLCONV
@@ -822,8 +822,8 @@ U_CDECL_END
/* Enumerate the aliases for the specified converter and standard tag */
static const UEnumeration gEnumAliases = {
- NULL,
- NULL,
+ nullptr,
+ nullptr,
ucnv_io_closeUEnumeration,
ucnv_io_countStandardAliases,
uenum_unextDefault,
@@ -836,7 +836,7 @@ ucnv_openStandardNames(const char *convName,
const char *standard,
UErrorCode *pErrorCode)
{
- UEnumeration *myEnum = NULL;
+ UEnumeration *myEnum = nullptr;
if (haveAliasData(pErrorCode) && isAlias(convName, pErrorCode)) {
uint32_t listOffset = findTaggedAliasListsOffset(convName, standard, pErrorCode);
@@ -847,16 +847,16 @@ ucnv_openStandardNames(const char *convName,
UAliasContext *myContext;
myEnum = static_cast<UEnumeration *>(uprv_malloc(sizeof(UEnumeration)));
- if (myEnum == NULL) {
+ if (myEnum == nullptr) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
uprv_memcpy(myEnum, &gEnumAliases, sizeof(UEnumeration));
myContext = static_cast<UAliasContext *>(uprv_malloc(sizeof(UAliasContext)));
- if (myContext == NULL) {
+ if (myContext == nullptr) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
uprv_free(myEnum);
- return NULL;
+ return nullptr;
}
myContext->listOffset = listOffset;
myContext->listIdx = 0;
@@ -870,7 +870,7 @@ ucnv_openStandardNames(const char *convName,
static uint16_t
ucnv_io_countAliases(const char *alias, UErrorCode *pErrorCode) {
if(haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) {
- uint32_t convNum = findConverter(alias, NULL, pErrorCode);
+ uint32_t convNum = findConverter(alias, nullptr, pErrorCode);
if (convNum < gMainTable.converterListSize) {
/* tagListNum - 1 is the ALL tag */
int32_t listOffset = gMainTable.taggedAliasArray[(gMainTable.tagListSize - 1)*gMainTable.converterListSize + convNum];
@@ -889,7 +889,7 @@ static uint16_t
ucnv_io_getAliases(const char *alias, uint16_t start, const char **aliases, UErrorCode *pErrorCode) {
if(haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) {
uint32_t currAlias;
- uint32_t convNum = findConverter(alias, NULL, pErrorCode);
+ uint32_t convNum = findConverter(alias, nullptr, pErrorCode);
if (convNum < gMainTable.converterListSize) {
/* tagListNum - 1 is the ALL tag */
int32_t listOffset = gMainTable.taggedAliasArray[(gMainTable.tagListSize - 1)*gMainTable.converterListSize + convNum];
@@ -913,7 +913,7 @@ ucnv_io_getAliases(const char *alias, uint16_t start, const char **aliases, UErr
static const char *
ucnv_io_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode) {
if(haveAliasData(pErrorCode) && isAlias(alias, pErrorCode)) {
- uint32_t convNum = findConverter(alias, NULL, pErrorCode);
+ uint32_t convNum = findConverter(alias, nullptr, pErrorCode);
if (convNum < gMainTable.converterListSize) {
/* tagListNum - 1 is the ALL tag */
int32_t listOffset = gMainTable.taggedAliasArray[(gMainTable.tagListSize - 1)*gMainTable.converterListSize + convNum];
@@ -932,7 +932,7 @@ ucnv_io_getAlias(const char *alias, uint16_t n, UErrorCode *pErrorCode) {
}
/* else converter not found */
}
- return NULL;
+ return nullptr;
}
static uint16_t
@@ -954,7 +954,7 @@ ucnv_getStandard(uint16_t n, UErrorCode *pErrorCode) {
*pErrorCode = U_INDEX_OUTOFBOUNDS_ERROR;
}
- return NULL;
+ return nullptr;
}
U_CAPI const char * U_EXPORT2
@@ -974,7 +974,7 @@ ucnv_getStandardName(const char *alias, const char *standard, UErrorCode *pError
}
}
- return NULL;
+ return nullptr;
}
U_CAPI uint16_t U_EXPORT2
@@ -997,7 +997,7 @@ ucnv_getAliases(const char *alias, const char **aliases, UErrorCode *pErrorCode)
}
U_CAPI uint16_t U_EXPORT2
-ucnv_countStandards(void)
+ucnv_countStandards()
{
UErrorCode err = U_ZERO_ERROR;
return ucnv_io_countStandards(&err);
@@ -1013,7 +1013,7 @@ ucnv_getCanonicalName(const char *alias, const char *standard, UErrorCode *pErro
}
}
- return NULL;
+ return nullptr;
}
U_CDECL_BEGIN
@@ -1042,7 +1042,7 @@ ucnv_io_nextAllConverters(UEnumeration *enumerator,
if (resultLength) {
*resultLength = 0;
}
- return NULL;
+ return nullptr;
}
static void U_CALLCONV
@@ -1051,8 +1051,8 @@ ucnv_io_resetAllConverters(UEnumeration *enumerator, UErrorCode * /*pErrorCode*/
}
U_CDECL_END
static const UEnumeration gEnumAllConverters = {
- NULL,
- NULL,
+ nullptr,
+ nullptr,
ucnv_io_closeUEnumeration,
ucnv_io_countAllConverters,
uenum_unextDefault,
@@ -1062,21 +1062,21 @@ static const UEnumeration gEnumAllConverters = {
U_CAPI UEnumeration * U_EXPORT2
ucnv_openAllNames(UErrorCode *pErrorCode) {
- UEnumeration *myEnum = NULL;
+ UEnumeration *myEnum = nullptr;
if (haveAliasData(pErrorCode)) {
uint16_t *myContext;
myEnum = static_cast<UEnumeration *>(uprv_malloc(sizeof(UEnumeration)));
- if (myEnum == NULL) {
+ if (myEnum == nullptr) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
uprv_memcpy(myEnum, &gEnumAllConverters, sizeof(UEnumeration));
myContext = static_cast<uint16_t *>(uprv_malloc(sizeof(uint16_t)));
- if (myContext == NULL) {
+ if (myContext == nullptr) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
uprv_free(myEnum);
- return NULL;
+ return nullptr;
}
*myContext = 0;
myEnum->context = myContext;
@@ -1153,7 +1153,7 @@ ucnv_swapAliases(const UDataSwapper *ds,
/* udata_swapDataHeader checks the arguments */
headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
@@ -1251,7 +1251,7 @@ ucnv_swapAliases(const UDataSwapper *ds,
tempTable.resort=resort;
} else {
tempTable.rows=(TempRow *)uprv_malloc(count*sizeof(TempRow)+count*2);
- if(tempTable.rows==NULL) {
+ if(tempTable.rows==nullptr) {
udata_printError(ds, "ucnv_swapAliases(): unable to allocate memory for sorting tables (max length: %u)\n",
count);
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
diff --git a/thirdparty/icu4c/common/ucnv_lmb.cpp b/thirdparty/icu4c/common/ucnv_lmb.cpp
index 78b8e40700..ab14a119ef 100644
--- a/thirdparty/icu4c/common/ucnv_lmb.cpp
+++ b/thirdparty/icu4c/common/ucnv_lmb.cpp
@@ -242,15 +242,15 @@ static const char * const OptGroupByteToCPName[ULMBCS_GRP_LAST + 1] = {
/* 0x0004 */ "windows-1256",
/* 0x0005 */ "windows-1251",
/* 0x0006 */ "ibm-852",
- /* 0x0007 */ NULL, /* Unused */
+ /* 0x0007 */ nullptr, /* Unused */
/* 0x0008 */ "windows-1254",
- /* 0x0009 */ NULL, /* Control char HT */
- /* 0x000A */ NULL, /* Control char LF */
+ /* 0x0009 */ nullptr, /* Control char HT */
+ /* 0x000A */ nullptr, /* Control char LF */
/* 0x000B */ "windows-874",
- /* 0x000C */ NULL, /* Unused */
- /* 0x000D */ NULL, /* Control char CR */
- /* 0x000E */ NULL, /* Unused */
- /* 0x000F */ NULL, /* Control chars: 0x0F20 + C0/C1 character: algorithmic */
+ /* 0x000C */ nullptr, /* Unused */
+ /* 0x000D */ nullptr, /* Control char CR */
+ /* 0x000E */ nullptr, /* Unused */
+ /* 0x000F */ nullptr, /* Control chars: 0x0F20 + C0/C1 character: algorithmic */
/* 0x0010 */ "windows-932",
/* 0x0011 */ "windows-949",
/* 0x0012 */ "windows-950",
@@ -298,8 +298,8 @@ ambiguous mappings: */
static const struct _UniLMBCSGrpMap
{
- const UChar uniStartRange;
- const UChar uniEndRange;
+ const char16_t uniStartRange;
+ const char16_t uniEndRange;
const ulmbcs_byte_t GrpType;
} UniLMBCSGrpMap[]
=
@@ -445,7 +445,7 @@ static const struct _UniLMBCSGrpMap
};
static ulmbcs_byte_t
-FindLMBCSUniRange(UChar uniChar)
+FindLMBCSUniRange(char16_t uniChar)
{
const struct _UniLMBCSGrpMap * pTable = UniLMBCSGrpMap;
@@ -530,7 +530,7 @@ static const struct _LocaleLMBCSGrpMap
/* {"vi", ULMBCS_GRP_L1}, */
{"zhTW", ULMBCS_GRP_TW},
{"zh", ULMBCS_GRP_CN},
- {NULL, ULMBCS_GRP_L1}
+ {nullptr, ULMBCS_GRP_L1}
};
@@ -589,22 +589,22 @@ U_CDECL_END
#define DECLARE_LMBCS_DATA(n) \
static const UConverterImpl _LMBCSImpl##n={\
UCNV_LMBCS_##n,\
- NULL,NULL,\
+ nullptr,nullptr,\
_LMBCSOpen##n,\
_LMBCSClose,\
- NULL,\
+ nullptr,\
_LMBCSToUnicodeWithOffsets,\
_LMBCSToUnicodeWithOffsets,\
_LMBCSFromUnicode,\
_LMBCSFromUnicode,\
- NULL,\
- NULL,\
- NULL,\
- NULL,\
+ nullptr,\
+ nullptr,\
+ nullptr,\
+ nullptr,\
_LMBCSSafeClone,\
ucnv_getCompleteUnicodeSet,\
- NULL,\
- NULL\
+ nullptr,\
+ nullptr\
};\
static const UConverterStaticData _LMBCSStaticData##n={\
sizeof(UConverterStaticData),\
@@ -635,7 +635,7 @@ _LMBCSOpenWorker(UConverter* _this,
{
UConverterDataLMBCS * extraInfo = (UConverterDataLMBCS*)uprv_malloc (sizeof (UConverterDataLMBCS));
_this->extraInfo = extraInfo;
- if(extraInfo != NULL)
+ if(extraInfo != nullptr)
{
UConverterNamePieces stackPieces;
UConverterLoadArgs stackArgs= UCNV_LOAD_ARGS_INITIALIZER;
@@ -647,7 +647,7 @@ _LMBCSOpenWorker(UConverter* _this,
for (i=0; i <= ULMBCS_GRP_LAST && U_SUCCESS(*err); i++)
{
- if(OptGroupByteToCPName[i] != NULL) {
+ if(OptGroupByteToCPName[i] != nullptr) {
extraInfo->OptGrpConverter[i] = ucnv_loadSharedData(OptGroupByteToCPName[i], &stackPieces, &stackArgs, err);
}
}
@@ -669,19 +669,19 @@ U_CDECL_BEGIN
static void U_CALLCONV
_LMBCSClose(UConverter * _this)
{
- if (_this->extraInfo != NULL)
+ if (_this->extraInfo != nullptr)
{
ulmbcs_byte_t Ix;
UConverterDataLMBCS * extraInfo = (UConverterDataLMBCS *) _this->extraInfo;
for (Ix=0; Ix <= ULMBCS_GRP_LAST; Ix++)
{
- if (extraInfo->OptGrpConverter[Ix] != NULL)
+ if (extraInfo->OptGrpConverter[Ix] != nullptr)
ucnv_unloadSharedDataIfReady(extraInfo->OptGrpConverter[Ix]);
}
if (!_this->isExtraLocal) {
uprv_free (_this->extraInfo);
- _this->extraInfo = NULL;
+ _this->extraInfo = nullptr;
}
}
}
@@ -703,7 +703,7 @@ _LMBCSSafeClone(const UConverter *cnv,
if(*pBufferSize<=0) {
*pBufferSize=(int32_t)sizeof(LMBCSClone);
- return NULL;
+ return nullptr;
}
extraInfo=(UConverterDataLMBCS *)cnv->extraInfo;
@@ -715,7 +715,7 @@ _LMBCSSafeClone(const UConverter *cnv,
/* share the subconverters */
for(i = 0; i <= ULMBCS_GRP_LAST; ++i) {
- if(extraInfo->OptGrpConverter[i] != NULL) {
+ if(extraInfo->OptGrpConverter[i] != nullptr) {
ucnv_incrementRefCount(extraInfo->OptGrpConverter[i]);
}
}
@@ -748,7 +748,7 @@ LMBCSConversionWorker (
UConverterDataLMBCS * extraInfo, /* subconverters, opt & locale groups */
ulmbcs_byte_t group, /* The group to try */
ulmbcs_byte_t * pStartLMBCS, /* where to put the results */
- UChar * pUniChar, /* The input unicode character */
+ char16_t * pUniChar, /* The input unicode character */
ulmbcs_byte_t * lastConverterIndex, /* output: track last successful group used */
UBool * groups_tried /* output: track any unsuccessful groups */
)
@@ -824,7 +824,7 @@ LMBCSConversionWorker (
know we are writing LMBCS using the Unicode group
*/
static size_t
-LMBCSConvertUni(ulmbcs_byte_t * pLMBCS, UChar uniChar)
+LMBCSConvertUni(ulmbcs_byte_t * pLMBCS, char16_t uniChar)
{
/* encode into LMBCS Unicode range */
uint8_t LowCh = (uint8_t)(uniChar & 0x00FF);
@@ -853,7 +853,7 @@ _LMBCSFromUnicode(UConverterFromUnicodeArgs* args,
UErrorCode* err)
{
ulmbcs_byte_t lastConverterIndex = 0;
- UChar uniChar;
+ char16_t uniChar;
ulmbcs_byte_t LMBCS[ULMBCS_CHARSIZE_MAX];
ulmbcs_byte_t * pLMBCS;
int32_t bytes_written;
@@ -1085,7 +1085,7 @@ _LMBCSFromUnicode(UConverterFromUnicodeArgs* args,
/* A function to call when we are looking at the Unicode group byte in LMBCS */
-static UChar
+static char16_t
GetUniFromLMBCSUni(char const ** ppLMBCSin) /* Called with LMBCS-style Unicode byte stream */
{
uint8_t HighCh = *(*ppLMBCSin)++; /* Big-endian Unicode in LMBCS compatibility group*/
@@ -1096,7 +1096,7 @@ GetUniFromLMBCSUni(char const ** ppLMBCSin) /* Called with LMBCS-style Unicode
HighCh = LowCh;
LowCh = 0; /* zero-byte in LSB special character */
}
- return (UChar)((HighCh << 8) | LowCh);
+ return (char16_t)((HighCh << 8) | LowCh);
}
@@ -1177,7 +1177,7 @@ _LMBCSGetNextUCharWorker(UConverterToUnicodeArgs* args,
{
group = CurByte; /* group byte is in the source */
extraInfo = (UConverterDataLMBCS *) args->converter->extraInfo;
- if (group > ULMBCS_GRP_LAST || (cnv = extraInfo->OptGrpConverter[group]) == NULL)
+ if (group > ULMBCS_GRP_LAST || (cnv = extraInfo->OptGrpConverter[group]) == nullptr)
{
/* this is not a valid group byte - no converter*/
*err = U_INVALID_CHAR_FOUND;
@@ -1264,10 +1264,10 @@ _LMBCSToUnicodeWithOffsets(UConverterToUnicodeArgs* args,
UErrorCode* err)
{
char LMBCS [ULMBCS_CHARSIZE_MAX];
- UChar uniChar; /* one output UNICODE char */
+ char16_t uniChar; /* one output UNICODE char */
const char * saveSource; /* beginning of current code point */
const char * pStartLMBCS = args->source; /* beginning of whole string */
- const char * errSource = NULL; /* pointer to actual input in case an error occurs */
+ const char * errSource = nullptr; /* pointer to actual input in case an error occurs */
int8_t savebytes = 0;
/* Process from source to limit, or until error */
@@ -1292,7 +1292,7 @@ _LMBCSToUnicodeWithOffsets(UConverterToUnicodeArgs* args,
args->source = errSource = LMBCS;
args->sourceLimit = LMBCS+size_old+size_new;
savebytes = (int8_t)(size_old+size_new);
- uniChar = (UChar) _LMBCSGetNextUCharWorker(args, err);
+ uniChar = (char16_t) _LMBCSGetNextUCharWorker(args, err);
args->source = saveSource + ((args->source - LMBCS) - size_old);
args->sourceLimit = saveSourceLimit;
@@ -1314,7 +1314,7 @@ _LMBCSToUnicodeWithOffsets(UConverterToUnicodeArgs* args,
else
{
errSource = saveSource;
- uniChar = (UChar) _LMBCSGetNextUCharWorker(args, err);
+ uniChar = (char16_t) _LMBCSGetNextUCharWorker(args, err);
savebytes = (int8_t)(args->source - saveSource);
}
if (U_SUCCESS(*err))
diff --git a/thirdparty/icu4c/common/ucnv_set.cpp b/thirdparty/icu4c/common/ucnv_set.cpp
index 926cee0de8..872d8bc066 100644
--- a/thirdparty/icu4c/common/ucnv_set.cpp
+++ b/thirdparty/icu4c/common/ucnv_set.cpp
@@ -34,23 +34,23 @@ ucnv_getUnicodeSet(const UConverter *cnv,
UConverterUnicodeSet whichSet,
UErrorCode *pErrorCode) {
/* argument checking */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return;
}
- if(cnv==NULL || setFillIn==NULL || whichSet<UCNV_ROUNDTRIP_SET || UCNV_SET_COUNT<=whichSet) {
+ if(cnv==nullptr || setFillIn==nullptr || whichSet<UCNV_ROUNDTRIP_SET || UCNV_SET_COUNT<=whichSet) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
/* does this converter support this function? */
- if(cnv->sharedData->impl->getUnicodeSet==NULL) {
+ if(cnv->sharedData->impl->getUnicodeSet==nullptr) {
*pErrorCode=U_UNSUPPORTED_ERROR;
return;
}
{
USetAdder sa={
- NULL,
+ nullptr,
uset_add,
uset_addRange,
uset_addString,
diff --git a/thirdparty/icu4c/common/ucnv_u16.cpp b/thirdparty/icu4c/common/ucnv_u16.cpp
index bebdede4c4..c3bcfef50c 100644
--- a/thirdparty/icu4c/common/ucnv_u16.cpp
+++ b/thirdparty/icu4c/common/ucnv_u16.cpp
@@ -52,12 +52,12 @@ static void U_CALLCONV
_UTF16BEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
- const UChar *source;
+ const char16_t *source;
char *target;
int32_t *offsets;
uint32_t targetCapacity, length, sourceIndex;
- UChar c, trail;
+ char16_t c, trail;
char overflow[4];
source=pArgs->source;
@@ -92,7 +92,7 @@ _UTF16BEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
/* c!=0 indicates in several places outside the main loops that a surrogate was found */
- if((c=(UChar)cnv->fromUChar32)!=0 && U16_IS_TRAIL(trail=*source) && targetCapacity>=4) {
+ if((c=(char16_t)cnv->fromUChar32)!=0 && U16_IS_TRAIL(trail=*source) && targetCapacity>=4) {
/* the last buffer ended with a lead surrogate, output the surrogate pair */
++source;
--length;
@@ -102,7 +102,7 @@ _UTF16BEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
target[3]=(uint8_t)trail;
target+=4;
targetCapacity-=4;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=-1;
*offsets++=-1;
*offsets++=-1;
@@ -123,7 +123,7 @@ _UTF16BEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
count>>=1;
length-=count;
- if(offsets==NULL) {
+ if(offsets==nullptr) {
while(count>0) {
c=*source++;
if(U16_IS_SINGLE(c)) {
@@ -257,11 +257,11 @@ _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
const uint8_t *source;
- UChar *target;
+ char16_t *target;
int32_t *offsets;
uint32_t targetCapacity, length, count, sourceIndex;
- UChar c, trail;
+ char16_t c, trail;
if(pArgs->converter->mode<8) {
_UTF16ToUnicodeWithOffsets(pArgs, pErrorCode);
@@ -287,7 +287,7 @@ _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
sourceIndex=0;
c=0;
- /* complete a partial UChar or pair from the last call */
+ /* complete a partial char16_t or pair from the last call */
if(cnv->toUnicodeStatus!=0) {
/*
* special case: single byte from a previous buffer,
@@ -306,11 +306,11 @@ _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
++sourceIndex;
--length;
if(count==2) {
- c=((UChar)p[0]<<8)|p[1];
+ c=((char16_t)p[0]<<8)|p[1];
if(U16_IS_SINGLE(c)) {
/* output the BMP code point */
*target++=c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=-1;
}
--targetCapacity;
@@ -325,14 +325,14 @@ _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
break;
}
} else if(count==4) {
- c=((UChar)p[0]<<8)|p[1];
- trail=((UChar)p[2]<<8)|p[3];
+ c=((char16_t)p[0]<<8)|p[1];
+ trail=((char16_t)p[2]<<8)|p[3];
if(U16_IS_TRAIL(trail)) {
/* output the surrogate pair */
*target++=c;
if(targetCapacity>=2) {
*target++=trail;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=-1;
*offsets++=-1;
}
@@ -384,14 +384,14 @@ _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
length-=count;
count>>=1;
targetCapacity-=count;
- if(offsets==NULL) {
+ if(offsets==nullptr) {
do {
- c=((UChar)source[0]<<8)|source[1];
+ c=((char16_t)source[0]<<8)|source[1];
source+=2;
if(U16_IS_SINGLE(c)) {
*target++=c;
} else if(U16_IS_SURROGATE_LEAD(c) && count>=2 &&
- U16_IS_TRAIL(trail=((UChar)source[0]<<8)|source[1])
+ U16_IS_TRAIL(trail=((char16_t)source[0]<<8)|source[1])
) {
source+=2;
--count;
@@ -403,14 +403,14 @@ _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
} while(--count>0);
} else {
do {
- c=((UChar)source[0]<<8)|source[1];
+ c=((char16_t)source[0]<<8)|source[1];
source+=2;
if(U16_IS_SINGLE(c)) {
*target++=c;
*offsets++=sourceIndex;
sourceIndex+=2;
} else if(U16_IS_SURROGATE_LEAD(c) && count>=2 &&
- U16_IS_TRAIL(trail=((UChar)source[0]<<8)|source[1])
+ U16_IS_TRAIL(trail=((char16_t)source[0]<<8)|source[1])
) {
source+=2;
--count;
@@ -447,12 +447,12 @@ _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
if(U16_IS_SURROGATE_LEAD(c)) {
if(length>=2) {
- if(U16_IS_TRAIL(trail=((UChar)source[0]<<8)|source[1])) {
+ if(U16_IS_TRAIL(trail=((char16_t)source[0]<<8)|source[1])) {
/* output the surrogate pair, will overflow (see conditions comment above) */
source+=2;
length-=2;
*target++=c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
cnv->UCharErrorBuffer[0]=trail;
@@ -509,7 +509,7 @@ _UTF16BEGetNextUChar(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
}
if(s+2>sourceLimit) {
- /* only one byte: truncated UChar */
+ /* only one byte: truncated char16_t */
pArgs->converter->toUBytes[0]=*s++;
pArgs->converter->toULength=1;
pArgs->source=(const char *)s;
@@ -517,7 +517,7 @@ _UTF16BEGetNextUChar(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
return 0xffff;
}
- /* get one UChar */
+ /* get one char16_t */
c=((UChar32)*s<<8)|s[1];
s+=2;
@@ -525,10 +525,10 @@ _UTF16BEGetNextUChar(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
if(U_IS_SURROGATE(c)) {
if(U16_IS_SURROGATE_LEAD(c)) {
if(s+2<=sourceLimit) {
- UChar trail;
+ char16_t trail;
- /* get a second UChar and see if it is a trail surrogate */
- trail=((UChar)*s<<8)|s[1];
+ /* get a second char16_t and see if it is a trail surrogate */
+ trail=((char16_t)*s<<8)|s[1];
if(U16_IS_TRAIL(trail)) {
c=U16_GET_SUPPLEMENTARY(c, trail);
s+=2;
@@ -610,11 +610,11 @@ U_CDECL_END
static const UConverterImpl _UTF16BEImpl={
UCNV_UTF16_BigEndian,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_UTF16BEOpen,
- NULL,
+ nullptr,
_UTF16BEReset,
_UTF16BEToUnicodeWithOffsets,
@@ -623,14 +623,14 @@ static const UConverterImpl _UTF16BEImpl={
_UTF16BEFromUnicodeWithOffsets,
_UTF16BEGetNextUChar,
- NULL,
+ nullptr,
_UTF16BEGetName,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
ucnv_getNonSurrogateUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
static const UConverterStaticData _UTF16BEStaticData={
@@ -653,12 +653,12 @@ static void U_CALLCONV
_UTF16LEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
- const UChar *source;
+ const char16_t *source;
char *target;
int32_t *offsets;
uint32_t targetCapacity, length, sourceIndex;
- UChar c, trail;
+ char16_t c, trail;
char overflow[4];
source=pArgs->source;
@@ -693,7 +693,7 @@ _UTF16LEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
/* c!=0 indicates in several places outside the main loops that a surrogate was found */
- if((c=(UChar)cnv->fromUChar32)!=0 && U16_IS_TRAIL(trail=*source) && targetCapacity>=4) {
+ if((c=(char16_t)cnv->fromUChar32)!=0 && U16_IS_TRAIL(trail=*source) && targetCapacity>=4) {
/* the last buffer ended with a lead surrogate, output the surrogate pair */
++source;
--length;
@@ -703,7 +703,7 @@ _UTF16LEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
target[3]=(uint8_t)(trail>>8);
target+=4;
targetCapacity-=4;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=-1;
*offsets++=-1;
*offsets++=-1;
@@ -724,7 +724,7 @@ _UTF16LEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
count>>=1;
length-=count;
- if(offsets==NULL) {
+ if(offsets==nullptr) {
while(count>0) {
c=*source++;
if(U16_IS_SINGLE(c)) {
@@ -858,11 +858,11 @@ _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
const uint8_t *source;
- UChar *target;
+ char16_t *target;
int32_t *offsets;
uint32_t targetCapacity, length, count, sourceIndex;
- UChar c, trail;
+ char16_t c, trail;
if(pArgs->converter->mode<8) {
_UTF16ToUnicodeWithOffsets(pArgs, pErrorCode);
@@ -888,7 +888,7 @@ _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
sourceIndex=0;
c=0;
- /* complete a partial UChar or pair from the last call */
+ /* complete a partial char16_t or pair from the last call */
if(cnv->toUnicodeStatus!=0) {
/*
* special case: single byte from a previous buffer,
@@ -907,11 +907,11 @@ _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
++sourceIndex;
--length;
if(count==2) {
- c=((UChar)p[1]<<8)|p[0];
+ c=((char16_t)p[1]<<8)|p[0];
if(U16_IS_SINGLE(c)) {
/* output the BMP code point */
*target++=c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=-1;
}
--targetCapacity;
@@ -926,14 +926,14 @@ _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
break;
}
} else if(count==4) {
- c=((UChar)p[1]<<8)|p[0];
- trail=((UChar)p[3]<<8)|p[2];
+ c=((char16_t)p[1]<<8)|p[0];
+ trail=((char16_t)p[3]<<8)|p[2];
if(U16_IS_TRAIL(trail)) {
/* output the surrogate pair */
*target++=c;
if(targetCapacity>=2) {
*target++=trail;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=-1;
*offsets++=-1;
}
@@ -985,14 +985,14 @@ _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
length-=count;
count>>=1;
targetCapacity-=count;
- if(offsets==NULL) {
+ if(offsets==nullptr) {
do {
- c=((UChar)source[1]<<8)|source[0];
+ c=((char16_t)source[1]<<8)|source[0];
source+=2;
if(U16_IS_SINGLE(c)) {
*target++=c;
} else if(U16_IS_SURROGATE_LEAD(c) && count>=2 &&
- U16_IS_TRAIL(trail=((UChar)source[1]<<8)|source[0])
+ U16_IS_TRAIL(trail=((char16_t)source[1]<<8)|source[0])
) {
source+=2;
--count;
@@ -1004,14 +1004,14 @@ _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
} while(--count>0);
} else {
do {
- c=((UChar)source[1]<<8)|source[0];
+ c=((char16_t)source[1]<<8)|source[0];
source+=2;
if(U16_IS_SINGLE(c)) {
*target++=c;
*offsets++=sourceIndex;
sourceIndex+=2;
} else if(U16_IS_SURROGATE_LEAD(c) && count>=2 &&
- U16_IS_TRAIL(trail=((UChar)source[1]<<8)|source[0])
+ U16_IS_TRAIL(trail=((char16_t)source[1]<<8)|source[0])
) {
source+=2;
--count;
@@ -1048,12 +1048,12 @@ _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
if(U16_IS_SURROGATE_LEAD(c)) {
if(length>=2) {
- if(U16_IS_TRAIL(trail=((UChar)source[1]<<8)|source[0])) {
+ if(U16_IS_TRAIL(trail=((char16_t)source[1]<<8)|source[0])) {
/* output the surrogate pair, will overflow (see conditions comment above) */
source+=2;
length-=2;
*target++=c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
cnv->UCharErrorBuffer[0]=trail;
@@ -1110,7 +1110,7 @@ _UTF16LEGetNextUChar(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
}
if(s+2>sourceLimit) {
- /* only one byte: truncated UChar */
+ /* only one byte: truncated char16_t */
pArgs->converter->toUBytes[0]=*s++;
pArgs->converter->toULength=1;
pArgs->source=(const char *)s;
@@ -1118,7 +1118,7 @@ _UTF16LEGetNextUChar(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
return 0xffff;
}
- /* get one UChar */
+ /* get one char16_t */
c=((UChar32)s[1]<<8)|*s;
s+=2;
@@ -1126,10 +1126,10 @@ _UTF16LEGetNextUChar(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
if(U_IS_SURROGATE(c)) {
if(U16_IS_SURROGATE_LEAD(c)) {
if(s+2<=sourceLimit) {
- UChar trail;
+ char16_t trail;
- /* get a second UChar and see if it is a trail surrogate */
- trail=((UChar)s[1]<<8)|*s;
+ /* get a second char16_t and see if it is a trail surrogate */
+ trail=((char16_t)s[1]<<8)|*s;
if(U16_IS_TRAIL(trail)) {
c=U16_GET_SUPPLEMENTARY(c, trail);
s+=2;
@@ -1211,11 +1211,11 @@ U_CDECL_END
static const UConverterImpl _UTF16LEImpl={
UCNV_UTF16_LittleEndian,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_UTF16LEOpen,
- NULL,
+ nullptr,
_UTF16LEReset,
_UTF16LEToUnicodeWithOffsets,
@@ -1224,14 +1224,14 @@ static const UConverterImpl _UTF16LEImpl={
_UTF16LEFromUnicodeWithOffsets,
_UTF16LEGetNextUChar,
- NULL,
+ nullptr,
_UTF16LEGetName,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
ucnv_getNonSurrogateUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
@@ -1447,7 +1447,7 @@ _UTF16ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
}
/* add BOM size to offsets - see comment at offsetDelta declaration */
- if(offsets!=NULL && offsetDelta!=0) {
+ if(offsets!=nullptr && offsetDelta!=0) {
int32_t *offsetsLimit=pArgs->offsets;
while(offsets<offsetsLimit) {
*offsets++ += offsetDelta;
@@ -1493,11 +1493,11 @@ U_CDECL_END
static const UConverterImpl _UTF16Impl = {
UCNV_UTF16,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_UTF16Open,
- NULL,
+ nullptr,
_UTF16Reset,
_UTF16ToUnicodeWithOffsets,
@@ -1506,14 +1506,14 @@ static const UConverterImpl _UTF16Impl = {
_UTF16PEFromUnicodeWithOffsets,
_UTF16GetNextUChar,
- NULL, /* ### TODO implement getStarters for all Unicode encodings?! */
+ nullptr, /* ### TODO implement getStarters for all Unicode encodings?! */
_UTF16GetName,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
ucnv_getNonSurrogateUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
static const UConverterStaticData _UTF16StaticData = {
@@ -1538,11 +1538,11 @@ const UConverterSharedData _UTF16Data =
static const UConverterImpl _UTF16v2Impl = {
UCNV_UTF16,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_UTF16Open,
- NULL,
+ nullptr,
_UTF16Reset,
_UTF16ToUnicodeWithOffsets,
@@ -1551,14 +1551,14 @@ static const UConverterImpl _UTF16v2Impl = {
_UTF16BEFromUnicodeWithOffsets,
_UTF16GetNextUChar,
- NULL, /* ### TODO implement getStarters for all Unicode encodings?! */
+ nullptr, /* ### TODO implement getStarters for all Unicode encodings?! */
_UTF16GetName,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
ucnv_getNonSurrogateUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
static const UConverterStaticData _UTF16v2StaticData = {
diff --git a/thirdparty/icu4c/common/ucnv_u32.cpp b/thirdparty/icu4c/common/ucnv_u32.cpp
index bc160b71dd..d513e8e7e0 100644
--- a/thirdparty/icu4c/common/ucnv_u32.cpp
+++ b/thirdparty/icu4c/common/ucnv_u32.cpp
@@ -48,9 +48,9 @@ T_UConverter_toUnicode_UTF32_BE(UConverterToUnicodeArgs * args,
UErrorCode * err)
{
const unsigned char *mySource = (unsigned char *) args->source;
- UChar *myTarget = args->target;
+ char16_t *myTarget = args->target;
const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
- const UChar *targetLimit = args->targetLimit;
+ const char16_t *targetLimit = args->targetLimit;
unsigned char *toUBytes = args->converter->toUBytes;
uint32_t ch, i;
@@ -87,18 +87,18 @@ morebytes:
if (ch <= MAXIMUM_UCS2)
{
/* fits in 16 bits */
- *(myTarget++) = (UChar) ch;
+ *(myTarget++) = (char16_t) ch;
}
else {
/* write out the surrogates */
*(myTarget++) = U16_LEAD(ch);
ch = U16_TRAIL(ch);
if (myTarget < targetLimit) {
- *(myTarget++) = (UChar)ch;
+ *(myTarget++) = (char16_t)ch;
}
else {
/* Put in overflow buffer (not handled here) */
- args->converter->UCharErrorBuffer[0] = (UChar) ch;
+ args->converter->UCharErrorBuffer[0] = (char16_t) ch;
args->converter->UCharErrorBufferLength = 1;
*err = U_BUFFER_OVERFLOW_ERROR;
break;
@@ -127,10 +127,10 @@ T_UConverter_toUnicode_UTF32_BE_OFFSET_LOGIC(UConverterToUnicodeArgs * args,
UErrorCode * err)
{
const unsigned char *mySource = (unsigned char *) args->source;
- UChar *myTarget = args->target;
+ char16_t *myTarget = args->target;
int32_t *myOffsets = args->offsets;
const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
- const UChar *targetLimit = args->targetLimit;
+ const char16_t *targetLimit = args->targetLimit;
unsigned char *toUBytes = args->converter->toUBytes;
uint32_t ch, i;
int32_t offsetNum = 0;
@@ -167,7 +167,7 @@ morebytes:
/* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
if (ch <= MAXIMUM_UCS2) {
/* fits in 16 bits */
- *(myTarget++) = (UChar) ch;
+ *(myTarget++) = (char16_t) ch;
*(myOffsets++) = offsetNum;
}
else {
@@ -177,12 +177,12 @@ morebytes:
ch = U16_TRAIL(ch);
if (myTarget < targetLimit)
{
- *(myTarget++) = (UChar)ch;
+ *(myTarget++) = (char16_t)ch;
*(myOffsets++) = offsetNum;
}
else {
/* Put in overflow buffer (not handled here) */
- args->converter->UCharErrorBuffer[0] = (UChar) ch;
+ args->converter->UCharErrorBuffer[0] = (char16_t) ch;
args->converter->UCharErrorBufferLength = 1;
*err = U_BUFFER_OVERFLOW_ERROR;
break;
@@ -213,9 +213,9 @@ static void U_CALLCONV
T_UConverter_fromUnicode_UTF32_BE(UConverterFromUnicodeArgs * args,
UErrorCode * err)
{
- const UChar *mySource = args->source;
+ const char16_t *mySource = args->source;
unsigned char *myTarget;
- const UChar *sourceLimit = args->sourceLimit;
+ const char16_t *sourceLimit = args->sourceLimit;
const unsigned char *targetLimit = (unsigned char *) args->targetLimit;
UChar32 ch, ch2;
unsigned int indexToWrite;
@@ -314,10 +314,10 @@ static void U_CALLCONV
T_UConverter_fromUnicode_UTF32_BE_OFFSET_LOGIC(UConverterFromUnicodeArgs * args,
UErrorCode * err)
{
- const UChar *mySource = args->source;
+ const char16_t *mySource = args->source;
unsigned char *myTarget;
int32_t *myOffsets;
- const UChar *sourceLimit = args->sourceLimit;
+ const char16_t *sourceLimit = args->sourceLimit;
const unsigned char *targetLimit = (unsigned char *) args->targetLimit;
UChar32 ch, ch2;
int32_t offsetNum = 0;
@@ -465,12 +465,12 @@ U_CDECL_END
static const UConverterImpl _UTF32BEImpl = {
UCNV_UTF32_BigEndian,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
T_UConverter_toUnicode_UTF32_BE,
T_UConverter_toUnicode_UTF32_BE_OFFSET_LOGIC,
@@ -478,14 +478,14 @@ static const UConverterImpl _UTF32BEImpl = {
T_UConverter_fromUnicode_UTF32_BE_OFFSET_LOGIC,
T_UConverter_getNextUChar_UTF32_BE,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
ucnv_getNonSurrogateUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
/* The 1232 CCSID refers to any version of Unicode with any endianness of UTF-32 */
@@ -510,9 +510,9 @@ T_UConverter_toUnicode_UTF32_LE(UConverterToUnicodeArgs * args,
UErrorCode * err)
{
const unsigned char *mySource = (unsigned char *) args->source;
- UChar *myTarget = args->target;
+ char16_t *myTarget = args->target;
const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
- const UChar *targetLimit = args->targetLimit;
+ const char16_t *targetLimit = args->targetLimit;
unsigned char *toUBytes = args->converter->toUBytes;
uint32_t ch, i;
@@ -554,18 +554,18 @@ morebytes:
/* Normal valid byte when the loop has not prematurely terminated (i < inBytes) */
if (ch <= MAXIMUM_UCS2) {
/* fits in 16 bits */
- *(myTarget++) = (UChar) ch;
+ *(myTarget++) = (char16_t) ch;
}
else {
/* write out the surrogates */
*(myTarget++) = U16_LEAD(ch);
ch = U16_TRAIL(ch);
if (myTarget < targetLimit) {
- *(myTarget++) = (UChar)ch;
+ *(myTarget++) = (char16_t)ch;
}
else {
/* Put in overflow buffer (not handled here) */
- args->converter->UCharErrorBuffer[0] = (UChar) ch;
+ args->converter->UCharErrorBuffer[0] = (char16_t) ch;
args->converter->UCharErrorBufferLength = 1;
*err = U_BUFFER_OVERFLOW_ERROR;
break;
@@ -595,10 +595,10 @@ T_UConverter_toUnicode_UTF32_LE_OFFSET_LOGIC(UConverterToUnicodeArgs * args,
UErrorCode * err)
{
const unsigned char *mySource = (unsigned char *) args->source;
- UChar *myTarget = args->target;
+ char16_t *myTarget = args->target;
int32_t *myOffsets = args->offsets;
const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
- const UChar *targetLimit = args->targetLimit;
+ const char16_t *targetLimit = args->targetLimit;
unsigned char *toUBytes = args->converter->toUBytes;
uint32_t ch, i;
int32_t offsetNum = 0;
@@ -643,7 +643,7 @@ morebytes:
if (ch <= MAXIMUM_UCS2)
{
/* fits in 16 bits */
- *(myTarget++) = (UChar) ch;
+ *(myTarget++) = (char16_t) ch;
*(myOffsets++) = offsetNum;
}
else {
@@ -653,13 +653,13 @@ morebytes:
ch = U16_TRAIL(ch);
if (myTarget < targetLimit)
{
- *(myTarget++) = (UChar)ch;
+ *(myTarget++) = (char16_t)ch;
*(myOffsets++) = offsetNum;
}
else
{
/* Put in overflow buffer (not handled here) */
- args->converter->UCharErrorBuffer[0] = (UChar) ch;
+ args->converter->UCharErrorBuffer[0] = (char16_t) ch;
args->converter->UCharErrorBufferLength = 1;
*err = U_BUFFER_OVERFLOW_ERROR;
break;
@@ -691,9 +691,9 @@ static void U_CALLCONV
T_UConverter_fromUnicode_UTF32_LE(UConverterFromUnicodeArgs * args,
UErrorCode * err)
{
- const UChar *mySource = args->source;
+ const char16_t *mySource = args->source;
unsigned char *myTarget;
- const UChar *sourceLimit = args->sourceLimit;
+ const char16_t *sourceLimit = args->sourceLimit;
const unsigned char *targetLimit = (unsigned char *) args->targetLimit;
UChar32 ch, ch2;
unsigned int indexToWrite;
@@ -800,10 +800,10 @@ static void U_CALLCONV
T_UConverter_fromUnicode_UTF32_LE_OFFSET_LOGIC(UConverterFromUnicodeArgs * args,
UErrorCode * err)
{
- const UChar *mySource = args->source;
+ const char16_t *mySource = args->source;
unsigned char *myTarget;
int32_t *myOffsets;
- const UChar *sourceLimit = args->sourceLimit;
+ const char16_t *sourceLimit = args->sourceLimit;
const unsigned char *targetLimit = (unsigned char *) args->targetLimit;
UChar32 ch, ch2;
unsigned int indexToWrite;
@@ -960,12 +960,12 @@ U_CDECL_END
static const UConverterImpl _UTF32LEImpl = {
UCNV_UTF32_LittleEndian,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
T_UConverter_toUnicode_UTF32_LE,
T_UConverter_toUnicode_UTF32_LE_OFFSET_LOGIC,
@@ -973,14 +973,14 @@ static const UConverterImpl _UTF32LEImpl = {
T_UConverter_fromUnicode_UTF32_LE_OFFSET_LOGIC,
T_UConverter_getNextUChar_UTF32_LE,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
ucnv_getNonSurrogateUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
/* The 1232 CCSID refers to any version of Unicode with any endianness of UTF-32 */
@@ -1126,7 +1126,7 @@ _UTF32ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
case 8:
/* call UTF-32BE */
pArgs->source=source;
- if(offsets==NULL) {
+ if(offsets==nullptr) {
T_UConverter_toUnicode_UTF32_BE(pArgs, pErrorCode);
} else {
T_UConverter_toUnicode_UTF32_BE_OFFSET_LOGIC(pArgs, pErrorCode);
@@ -1136,7 +1136,7 @@ _UTF32ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
case 9:
/* call UTF-32LE */
pArgs->source=source;
- if(offsets==NULL) {
+ if(offsets==nullptr) {
T_UConverter_toUnicode_UTF32_LE(pArgs, pErrorCode);
} else {
T_UConverter_toUnicode_UTF32_LE_OFFSET_LOGIC(pArgs, pErrorCode);
@@ -1149,7 +1149,7 @@ _UTF32ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
}
/* add BOM size to offsets - see comment at offsetDelta declaration */
- if(offsets!=NULL && offsetDelta!=0) {
+ if(offsets!=nullptr && offsetDelta!=0) {
int32_t *offsetsLimit=pArgs->offsets;
while(offsets<offsetsLimit) {
*offsets++ += offsetDelta;
@@ -1202,11 +1202,11 @@ U_CDECL_END
static const UConverterImpl _UTF32Impl = {
UCNV_UTF32,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_UTF32Open,
- NULL,
+ nullptr,
_UTF32Reset,
_UTF32ToUnicodeWithOffsets,
@@ -1220,14 +1220,14 @@ static const UConverterImpl _UTF32Impl = {
#endif
_UTF32GetNextUChar,
- NULL, /* ### TODO implement getStarters for all Unicode encodings?! */
- NULL,
- NULL,
- NULL,
+ nullptr, /* ### TODO implement getStarters for all Unicode encodings?! */
+ nullptr,
+ nullptr,
+ nullptr,
ucnv_getNonSurrogateUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
/* The 1236 CCSID refers to any version of Unicode with a BOM sensitive endianness of UTF-32 */
diff --git a/thirdparty/icu4c/common/ucnv_u7.cpp b/thirdparty/icu4c/common/ucnv_u7.cpp
index 8964ca01de..398b528e83 100644
--- a/thirdparty/icu4c/common/ucnv_u7.cpp
+++ b/thirdparty/icu4c/common/ucnv_u7.cpp
@@ -212,8 +212,8 @@ _UTF7ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
const uint8_t *source, *sourceLimit;
- UChar *target;
- const UChar *targetLimit;
+ char16_t *target;
+ const char16_t *targetLimit;
int32_t *offsets;
uint8_t *bytes;
@@ -280,7 +280,7 @@ directMode:
} else if(b!=PLUS) {
/* write directly encoded character */
*target++=b;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex++;
}
} else /* PLUS */ {
@@ -320,10 +320,10 @@ unicodeMode:
* base64Value==-1 for any legal character except base64 and minus sign, or
* base64Value==-3 for illegal characters:
* 1. In either case, leave Unicode mode.
- * 2.1. If we ended with an incomplete UChar or none after the +, then
+ * 2.1. If we ended with an incomplete char16_t or none after the +, then
* generate an error for the preceding erroneous sequence and deal with
* the current (possibly illegal) character next time through.
- * 2.2. Else the current char comes after a complete UChar, which was already
+ * 2.2. Else the current char comes after a complete char16_t, which was already
* pushed to the output buf, so:
* 2.2.1. If the current char is legal, just save it for processing next time.
* It may be for example, a plus which we need to deal with in direct mode.
@@ -339,14 +339,14 @@ unicodeMode:
*pErrorCode=U_ILLEGAL_CHAR_FOUND;
break;
} else if(bits!=0) {
- /* bits are illegally left over, a UChar is incomplete */
+ /* bits are illegally left over, a char16_t is incomplete */
/* don't include current char (legal or illegal) in error seq */
--source;
--byteIndex;
*pErrorCode=U_ILLEGAL_CHAR_FOUND;
break;
} else {
- /* previous UChar was complete */
+ /* previous char16_t was complete */
if(base64Value==-3) {
/* current character is illegal, deal with it here */
*pErrorCode=U_ILLEGAL_CHAR_FOUND;
@@ -374,8 +374,8 @@ unicodeMode:
++base64Counter;
break;
case 2:
- *target++=(UChar)((bits<<4)|(base64Value>>2));
- if(offsets!=NULL) {
+ *target++=(char16_t)((bits<<4)|(base64Value>>2));
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
sourceIndex=nextSourceIndex-1;
}
@@ -385,8 +385,8 @@ unicodeMode:
base64Counter=3;
break;
case 5:
- *target++=(UChar)((bits<<2)|(base64Value>>4));
- if(offsets!=NULL) {
+ *target++=(char16_t)((bits<<2)|(base64Value>>4));
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
sourceIndex=nextSourceIndex-1;
}
@@ -396,8 +396,8 @@ unicodeMode:
base64Counter=6;
break;
case 7:
- *target++=(UChar)((bits<<6)|base64Value);
- if(offsets!=NULL) {
+ *target++=(char16_t)((bits<<6)|base64Value);
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
sourceIndex=nextSourceIndex;
}
@@ -415,13 +415,13 @@ unicodeMode:
if(base64Counter==-1) {
/* +- i.e. a minus immediately following a plus */
*target++=PLUS;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex-1;
}
} else {
/* absorb the minus and leave the Unicode Mode */
if(bits!=0) {
- /* bits are illegally left over, a UChar is incomplete */
+ /* bits are illegally left over, a char16_t is incomplete */
*pErrorCode=U_ILLEGAL_CHAR_FOUND;
break;
}
@@ -462,12 +462,12 @@ static void U_CALLCONV
_UTF7FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
- const UChar *source, *sourceLimit;
+ const char16_t *source, *sourceLimit;
uint8_t *target, *targetLimit;
int32_t *offsets;
int32_t length, targetCapacity, sourceIndex;
- UChar c;
+ char16_t c;
/* UTF-7 state */
const UBool *encodeDirectly;
@@ -511,7 +511,7 @@ directMode:
if(c<=127 && encodeDirectly[c]) {
/* encode directly */
*target++=(uint8_t)c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex++;
}
} else if(c==PLUS) {
@@ -519,14 +519,14 @@ directMode:
*target++=PLUS;
if(target<targetLimit) {
*target++=MINUS;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
*offsets++=sourceIndex++;
}
/* realign length and targetCapacity */
goto directMode;
} else {
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex++;
}
cnv->charErrorBuffer[0]=MINUS;
@@ -538,7 +538,7 @@ directMode:
/* un-read this character and switch to Unicode Mode */
--source;
*target++=PLUS;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
inDirectMode=false;
@@ -567,7 +567,7 @@ unicodeMode:
if(base64Counter!=0) {
/* write remaining bits for the previous character */
*target++=toBase64[bits];
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex-1;
}
}
@@ -575,7 +575,7 @@ unicodeMode:
/* need to terminate with a minus */
if(target<targetLimit) {
*target++=MINUS;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex-1;
}
} else {
@@ -601,12 +601,12 @@ unicodeMode:
*target++=toBase64[c>>10];
if(target<targetLimit) {
*target++=toBase64[(c>>4)&0x3f];
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
*offsets++=sourceIndex++;
}
} else {
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex++;
}
cnv->charErrorBuffer[0]=toBase64[(c>>4)&0x3f];
@@ -622,13 +622,13 @@ unicodeMode:
*target++=toBase64[(c>>8)&0x3f];
if(target<targetLimit) {
*target++=toBase64[(c>>2)&0x3f];
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
*offsets++=sourceIndex;
*offsets++=sourceIndex++;
}
} else {
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
*offsets++=sourceIndex++;
}
@@ -637,7 +637,7 @@ unicodeMode:
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
}
} else {
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex++;
}
cnv->charErrorBuffer[0]=toBase64[(c>>8)&0x3f];
@@ -654,13 +654,13 @@ unicodeMode:
*target++=toBase64[(c>>6)&0x3f];
if(target<targetLimit) {
*target++=toBase64[c&0x3f];
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
*offsets++=sourceIndex;
*offsets++=sourceIndex++;
}
} else {
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
*offsets++=sourceIndex++;
}
@@ -669,7 +669,7 @@ unicodeMode:
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
}
} else {
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex++;
}
cnv->charErrorBuffer[0]=toBase64[(c>>6)&0x3f];
@@ -699,7 +699,7 @@ unicodeMode:
if (base64Counter!=0) {
if(target<targetLimit) {
*target++=toBase64[bits];
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex-1;
}
} else {
@@ -710,7 +710,7 @@ unicodeMode:
/* Add final MINUS to terminate unicodeMode */
if(target<targetLimit) {
*target++=MINUS;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex-1;
}
} else {
@@ -748,27 +748,27 @@ U_CDECL_END
static const UConverterImpl _UTF7Impl={
UCNV_UTF7,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_UTF7Open,
- NULL,
+ nullptr,
_UTF7Reset,
_UTF7ToUnicodeWithOffsets,
_UTF7ToUnicodeWithOffsets,
_UTF7FromUnicodeWithOffsets,
_UTF7FromUnicodeWithOffsets,
- NULL,
+ nullptr,
- NULL,
+ nullptr,
_UTF7GetName,
- NULL, /* we don't need writeSub() because we never call a callback at fromUnicode() */
- NULL,
+ nullptr, /* we don't need writeSub() because we never call a callback at fromUnicode() */
+ nullptr,
ucnv_getCompleteUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
static const UConverterStaticData _UTF7StaticData={
@@ -896,8 +896,8 @@ _IMAPToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
const uint8_t *source, *sourceLimit;
- UChar *target;
- const UChar *targetLimit;
+ char16_t *target;
+ const char16_t *targetLimit;
int32_t *offsets;
uint8_t *bytes;
@@ -914,7 +914,7 @@ _IMAPToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
int32_t sourceIndex, nextSourceIndex;
- UChar c;
+ char16_t c;
uint8_t b;
/* set up the local pointers */
@@ -965,7 +965,7 @@ directMode:
} else if(b!=AMPERSAND) {
/* write directly encoded character */
*target++=b;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex++;
}
} else /* AMPERSAND */ {
@@ -1021,7 +1021,7 @@ unicodeMode:
++base64Counter;
break;
case 2:
- c=(UChar)((bits<<4)|(base64Value>>2));
+ c=(char16_t)((bits<<4)|(base64Value>>2));
if(isLegalIMAP(c)) {
/* illegal */
inDirectMode=true;
@@ -1029,7 +1029,7 @@ unicodeMode:
goto endloop;
}
*target++=c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
sourceIndex=nextSourceIndex-1;
}
@@ -1039,7 +1039,7 @@ unicodeMode:
base64Counter=3;
break;
case 5:
- c=(UChar)((bits<<2)|(base64Value>>4));
+ c=(char16_t)((bits<<2)|(base64Value>>4));
if(isLegalIMAP(c)) {
/* illegal */
inDirectMode=true;
@@ -1047,7 +1047,7 @@ unicodeMode:
goto endloop;
}
*target++=c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
sourceIndex=nextSourceIndex-1;
}
@@ -1057,7 +1057,7 @@ unicodeMode:
base64Counter=6;
break;
case 7:
- c=(UChar)((bits<<6)|base64Value);
+ c=(char16_t)((bits<<6)|base64Value);
if(isLegalIMAP(c)) {
/* illegal */
inDirectMode=true;
@@ -1065,7 +1065,7 @@ unicodeMode:
goto endloop;
}
*target++=c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
sourceIndex=nextSourceIndex;
}
@@ -1083,13 +1083,13 @@ unicodeMode:
if(base64Counter==-1) {
/* &- i.e. a minus immediately following an ampersand */
*target++=AMPERSAND;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex-1;
}
} else {
/* absorb the minus and leave the Unicode Mode */
if(bits!=0 || (base64Counter!=0 && base64Counter!=3 && base64Counter!=6)) {
- /* bits are illegally left over, a UChar is incomplete */
+ /* bits are illegally left over, a char16_t is incomplete */
/* base64Counter other than 0, 3, 6 means non-minimal zero-padding, also illegal */
*pErrorCode=U_ILLEGAL_CHAR_FOUND;
break;
@@ -1163,12 +1163,12 @@ static void U_CALLCONV
_IMAPFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
- const UChar *source, *sourceLimit;
+ const char16_t *source, *sourceLimit;
uint8_t *target, *targetLimit;
int32_t *offsets;
int32_t length, targetCapacity, sourceIndex;
- UChar c;
+ char16_t c;
uint8_t b;
/* UTF-7 state */
@@ -1210,7 +1210,7 @@ directMode:
if(inSetDIMAP(c)) {
/* encode directly */
*target++=(uint8_t)c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex++;
}
} else if(c==AMPERSAND) {
@@ -1218,14 +1218,14 @@ directMode:
*target++=AMPERSAND;
if(target<targetLimit) {
*target++=MINUS;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
*offsets++=sourceIndex++;
}
/* realign length and targetCapacity */
goto directMode;
} else {
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex++;
}
cnv->charErrorBuffer[0]=MINUS;
@@ -1237,7 +1237,7 @@ directMode:
/* un-read this character and switch to Unicode Mode */
--source;
*target++=AMPERSAND;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
inDirectMode=false;
@@ -1266,14 +1266,14 @@ unicodeMode:
if(base64Counter!=0) {
/* write remaining bits for the previous character */
*target++=TO_BASE64_IMAP(bits);
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex-1;
}
}
/* need to terminate with a minus */
if(target<targetLimit) {
*target++=MINUS;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex-1;
}
} else {
@@ -1300,12 +1300,12 @@ unicodeMode:
if(target<targetLimit) {
b=(uint8_t)((c>>4)&0x3f);
*target++=TO_BASE64_IMAP(b);
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
*offsets++=sourceIndex++;
}
} else {
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex++;
}
b=(uint8_t)((c>>4)&0x3f);
@@ -1325,13 +1325,13 @@ unicodeMode:
if(target<targetLimit) {
b=(uint8_t)((c>>2)&0x3f);
*target++=TO_BASE64_IMAP(b);
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
*offsets++=sourceIndex;
*offsets++=sourceIndex++;
}
} else {
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
*offsets++=sourceIndex++;
}
@@ -1341,7 +1341,7 @@ unicodeMode:
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
}
} else {
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex++;
}
b=(uint8_t)((c>>8)&0x3f);
@@ -1363,13 +1363,13 @@ unicodeMode:
if(target<targetLimit) {
b=(uint8_t)(c&0x3f);
*target++=TO_BASE64_IMAP(b);
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
*offsets++=sourceIndex;
*offsets++=sourceIndex++;
}
} else {
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
*offsets++=sourceIndex++;
}
@@ -1379,7 +1379,7 @@ unicodeMode:
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
}
} else {
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex++;
}
b=(uint8_t)((c>>6)&0x3f);
@@ -1411,7 +1411,7 @@ unicodeMode:
if(base64Counter!=0) {
if(target<targetLimit) {
*target++=TO_BASE64_IMAP(bits);
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex-1;
}
} else {
@@ -1422,7 +1422,7 @@ unicodeMode:
/* need to terminate with a minus */
if(target<targetLimit) {
*target++=MINUS;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex-1;
}
} else {
@@ -1450,26 +1450,26 @@ U_CDECL_END
static const UConverterImpl _IMAPImpl={
UCNV_IMAP_MAILBOX,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_UTF7Open,
- NULL,
+ nullptr,
_UTF7Reset,
_IMAPToUnicodeWithOffsets,
_IMAPToUnicodeWithOffsets,
_IMAPFromUnicodeWithOffsets,
_IMAPFromUnicodeWithOffsets,
- NULL,
+ nullptr,
- NULL,
- NULL,
- NULL, /* we don't need writeSub() because we never call a callback at fromUnicode() */
- NULL,
+ nullptr,
+ nullptr,
+ nullptr, /* we don't need writeSub() because we never call a callback at fromUnicode() */
+ nullptr,
ucnv_getCompleteUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
static const UConverterStaticData _IMAPStaticData={
diff --git a/thirdparty/icu4c/common/ucnv_u8.cpp b/thirdparty/icu4c/common/ucnv_u8.cpp
index 3c27f2e46e..cf3bb22a02 100644
--- a/thirdparty/icu4c/common/ucnv_u8.cpp
+++ b/thirdparty/icu4c/common/ucnv_u8.cpp
@@ -67,9 +67,9 @@ static void U_CALLCONV ucnv_toUnicode_UTF8 (UConverterToUnicodeArgs * args,
{
UConverter *cnv = args->converter;
const unsigned char *mySource = (unsigned char *) args->source;
- UChar *myTarget = args->target;
+ char16_t *myTarget = args->target;
const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
- const UChar *targetLimit = args->targetLimit;
+ const char16_t *targetLimit = args->targetLimit;
unsigned char *toUBytes = cnv->toUBytes;
UBool isCESU8 = hasCESU8Data(cnv);
uint32_t ch, ch2 = 0;
@@ -93,7 +93,7 @@ static void U_CALLCONV ucnv_toUnicode_UTF8 (UConverterToUnicodeArgs * args,
ch = *(mySource++);
if (U8_IS_SINGLE(ch)) /* Simple case */
{
- *(myTarget++) = (UChar) ch;
+ *(myTarget++) = (char16_t) ch;
}
else
{
@@ -137,7 +137,7 @@ morebytes:
if (ch <= MAXIMUM_UCS2)
{
/* fits in 16 bits */
- *(myTarget++) = (UChar) ch;
+ *(myTarget++) = (char16_t) ch;
}
else
{
@@ -146,12 +146,12 @@ morebytes:
ch = U16_TRAIL(ch);
if (myTarget < targetLimit)
{
- *(myTarget++) = (UChar)ch;
+ *(myTarget++) = (char16_t)ch;
}
else
{
/* Put in overflow buffer (not handled here) */
- cnv->UCharErrorBuffer[0] = (UChar) ch;
+ cnv->UCharErrorBuffer[0] = (char16_t) ch;
cnv->UCharErrorBufferLength = 1;
*err = U_BUFFER_OVERFLOW_ERROR;
break;
@@ -183,11 +183,11 @@ static void U_CALLCONV ucnv_toUnicode_UTF8_OFFSETS_LOGIC (UConverterToUnicodeAr
{
UConverter *cnv = args->converter;
const unsigned char *mySource = (unsigned char *) args->source;
- UChar *myTarget = args->target;
+ char16_t *myTarget = args->target;
int32_t *myOffsets = args->offsets;
int32_t offsetNum = 0;
const unsigned char *sourceLimit = (unsigned char *) args->sourceLimit;
- const UChar *targetLimit = args->targetLimit;
+ const char16_t *targetLimit = args->targetLimit;
unsigned char *toUBytes = cnv->toUBytes;
UBool isCESU8 = hasCESU8Data(cnv);
uint32_t ch, ch2 = 0;
@@ -210,7 +210,7 @@ static void U_CALLCONV ucnv_toUnicode_UTF8_OFFSETS_LOGIC (UConverterToUnicodeAr
ch = *(mySource++);
if (U8_IS_SINGLE(ch)) /* Simple case */
{
- *(myTarget++) = (UChar) ch;
+ *(myTarget++) = (char16_t) ch;
*(myOffsets++) = offsetNum++;
}
else
@@ -253,7 +253,7 @@ morebytes:
if (ch <= MAXIMUM_UCS2)
{
/* fits in 16 bits */
- *(myTarget++) = (UChar) ch;
+ *(myTarget++) = (char16_t) ch;
*(myOffsets++) = offsetNum;
}
else
@@ -264,12 +264,12 @@ morebytes:
ch = U16_TRAIL(ch);
if (myTarget < targetLimit)
{
- *(myTarget++) = (UChar)ch;
+ *(myTarget++) = (char16_t)ch;
*(myOffsets++) = offsetNum;
}
else
{
- cnv->UCharErrorBuffer[0] = (UChar) ch;
+ cnv->UCharErrorBuffer[0] = (char16_t) ch;
cnv->UCharErrorBufferLength = 1;
*err = U_BUFFER_OVERFLOW_ERROR;
}
@@ -301,8 +301,8 @@ U_CFUNC void U_CALLCONV ucnv_fromUnicode_UTF8 (UConverterFromUnicodeArgs * args
UErrorCode * err)
{
UConverter *cnv = args->converter;
- const UChar *mySource = args->source;
- const UChar *sourceLimit = args->sourceLimit;
+ const char16_t *mySource = args->source;
+ const char16_t *sourceLimit = args->sourceLimit;
uint8_t *myTarget = (uint8_t *) args->target;
const uint8_t *targetLimit = (uint8_t *) args->targetLimit;
uint8_t *tempPtr;
@@ -415,9 +415,9 @@ U_CFUNC void U_CALLCONV ucnv_fromUnicode_UTF8_OFFSETS_LOGIC (UConverterFromUnic
UErrorCode * err)
{
UConverter *cnv = args->converter;
- const UChar *mySource = args->source;
+ const char16_t *mySource = args->source;
int32_t *myOffsets = args->offsets;
- const UChar *sourceLimit = args->sourceLimit;
+ const char16_t *sourceLimit = args->sourceLimit;
uint8_t *myTarget = (uint8_t *) args->target;
const uint8_t *targetLimit = (uint8_t *) args->targetLimit;
uint8_t *tempPtr;
@@ -859,12 +859,12 @@ U_CDECL_END
static const UConverterImpl _UTF8Impl={
UCNV_UTF8,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
ucnv_toUnicode_UTF8,
ucnv_toUnicode_UTF8_OFFSETS_LOGIC,
@@ -872,10 +872,10 @@ static const UConverterImpl _UTF8Impl={
ucnv_fromUnicode_UTF8_OFFSETS_LOGIC,
ucnv_getNextUChar_UTF8,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
ucnv_getNonSurrogateUnicodeSet,
ucnv_UTF8FromUTF8,
@@ -887,7 +887,7 @@ static const UConverterStaticData _UTF8StaticData={
sizeof(UConverterStaticData),
"UTF-8",
1208, UCNV_IBM, UCNV_UTF8,
- 1, 3, /* max 3 bytes per UChar from UTF-8 (4 bytes from surrogate _pair_) */
+ 1, 3, /* max 3 bytes per char16_t from UTF-8 (4 bytes from surrogate _pair_) */
{ 0xef, 0xbf, 0xbd, 0 },3,false,false,
0,
0,
@@ -903,27 +903,27 @@ const UConverterSharedData _UTF8Data=
static const UConverterImpl _CESU8Impl={
UCNV_CESU8,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
ucnv_toUnicode_UTF8,
ucnv_toUnicode_UTF8_OFFSETS_LOGIC,
ucnv_fromUnicode_UTF8,
ucnv_fromUnicode_UTF8_OFFSETS_LOGIC,
- NULL,
+ nullptr,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
ucnv_getCompleteUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
static const UConverterStaticData _CESU8StaticData={
diff --git a/thirdparty/icu4c/common/ucnvbocu.cpp b/thirdparty/icu4c/common/ucnvbocu.cpp
index edb49d36a9..007722e474 100644
--- a/thirdparty/icu4c/common/ucnvbocu.cpp
+++ b/thirdparty/icu4c/common/ucnvbocu.cpp
@@ -392,7 +392,7 @@ static void U_CALLCONV
_Bocu1FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
- const UChar *source, *sourceLimit;
+ const char16_t *source, *sourceLimit;
uint8_t *target;
int32_t targetCapacity;
int32_t *offsets;
@@ -456,7 +456,7 @@ fastSingle:
}
/* restore real values */
targetCapacity=(int32_t)((const uint8_t *)pArgs->targetLimit-target);
- sourceIndex=nextSourceIndex; /* wrong if offsets==NULL but does not matter */
+ sourceIndex=nextSourceIndex; /* wrong if offsets==nullptr but does not matter */
/* regular loop for all cases */
while(source<sourceLimit) {
@@ -485,7 +485,7 @@ fastSingle:
getTrail:
if(source<sourceLimit) {
/* test the following code unit */
- UChar trail=*source;
+ char16_t trail=*source;
if(U16_IS_TRAIL(trail)) {
++source;
++nextSourceIndex;
@@ -653,7 +653,7 @@ static void U_CALLCONV
_Bocu1FromUnicode(UConverterFromUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
- const UChar *source, *sourceLimit;
+ const char16_t *source, *sourceLimit;
uint8_t *target;
int32_t targetCapacity;
@@ -729,7 +729,7 @@ fastSingle:
getTrail:
if(source<sourceLimit) {
/* test the following code unit */
- UChar trail=*source;
+ char16_t trail=*source;
if(U16_IS_TRAIL(trail)) {
++source;
c=U16_GET_SUPPLEMENTARY(c, trail);
@@ -916,7 +916,7 @@ decodeBocu1LeadByte(int32_t b) {
}
/* return the state for decoding the trail byte(s) */
- return (diff<<2)|count;
+ return ((uint32_t)diff<<2)|count;
}
/**
@@ -957,8 +957,8 @@ _Bocu1ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
const uint8_t *source, *sourceLimit;
- UChar *target;
- const UChar *targetLimit;
+ char16_t *target;
+ const char16_t *targetLimit;
int32_t *offsets;
int32_t prev, count, diff, c;
@@ -1009,7 +1009,7 @@ fastSingle:
if(BOCU1_START_NEG_2<=(c=*source) && c<BOCU1_START_POS_2) {
c=prev+(c-BOCU1_MIDDLE);
if(c<0x3000) {
- *target++=(UChar)c;
+ *target++=(char16_t)c;
*offsets++=nextSourceIndex++;
prev=BOCU1_SIMPLE_PREV(c);
} else {
@@ -1019,7 +1019,7 @@ fastSingle:
if(c!=0x20) {
prev=BOCU1_ASCII_PREV;
}
- *target++=(UChar)c;
+ *target++=(char16_t)c;
*offsets++=nextSourceIndex++;
} else {
break;
@@ -1027,7 +1027,7 @@ fastSingle:
++source;
--count;
}
- sourceIndex=nextSourceIndex; /* wrong if offsets==NULL but does not matter */
+ sourceIndex=nextSourceIndex; /* wrong if offsets==nullptr but does not matter */
/* decode a sequence of single and lead bytes */
while(source<sourceLimit) {
@@ -1043,7 +1043,7 @@ fastSingle:
/* Write a code point directly from a single-byte difference. */
c=prev+(c-BOCU1_MIDDLE);
if(c<0x3000) {
- *target++=(UChar)c;
+ *target++=(char16_t)c;
*offsets++=sourceIndex;
prev=BOCU1_SIMPLE_PREV(c);
sourceIndex=nextSourceIndex;
@@ -1057,7 +1057,7 @@ fastSingle:
if(c!=0x20) {
prev=BOCU1_ASCII_PREV;
}
- *target++=(UChar)c;
+ *target++=(char16_t)c;
*offsets++=sourceIndex;
sourceIndex=nextSourceIndex;
continue;
@@ -1128,7 +1128,7 @@ getTrail:
/* calculate the next prev and output c */
prev=BOCU1_PREV(c);
if(c<=0xffff) {
- *target++=(UChar)c;
+ *target++=(char16_t)c;
*offsets++=sourceIndex;
} else {
/* output surrogate pair */
@@ -1157,7 +1157,7 @@ endloop:
} else {
/* set the converter state back into UConverter */
cnv->toUnicodeStatus=(uint32_t)prev;
- cnv->mode=(diff<<2)|count;
+ cnv->mode=(int32_t)((uint32_t)diff<<2)|count;
}
cnv->toULength=byteIndex;
@@ -1180,8 +1180,8 @@ _Bocu1ToUnicode(UConverterToUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
const uint8_t *source, *sourceLimit;
- UChar *target;
- const UChar *targetLimit;
+ char16_t *target;
+ const char16_t *targetLimit;
int32_t prev, count, diff, c;
@@ -1224,7 +1224,7 @@ fastSingle:
if(BOCU1_START_NEG_2<=(c=*source) && c<BOCU1_START_POS_2) {
c=prev+(c-BOCU1_MIDDLE);
if(c<0x3000) {
- *target++=(UChar)c;
+ *target++=(char16_t)c;
prev=BOCU1_SIMPLE_PREV(c);
} else {
break;
@@ -1233,7 +1233,7 @@ fastSingle:
if(c!=0x20) {
prev=BOCU1_ASCII_PREV;
}
- *target++=(UChar)c;
+ *target++=(char16_t)c;
} else {
break;
}
@@ -1254,7 +1254,7 @@ fastSingle:
/* Write a code point directly from a single-byte difference. */
c=prev+(c-BOCU1_MIDDLE);
if(c<0x3000) {
- *target++=(UChar)c;
+ *target++=(char16_t)c;
prev=BOCU1_SIMPLE_PREV(c);
goto fastSingle;
}
@@ -1266,7 +1266,7 @@ fastSingle:
if(c!=0x20) {
prev=BOCU1_ASCII_PREV;
}
- *target++=(UChar)c;
+ *target++=(char16_t)c;
continue;
} else if(BOCU1_START_NEG_3<=c && c<BOCU1_START_POS_3 && source<sourceLimit) {
/* Optimize two-byte case. */
@@ -1332,7 +1332,7 @@ getTrail:
/* calculate the next prev and output c */
prev=BOCU1_PREV(c);
if(c<=0xffff) {
- *target++=(UChar)c;
+ *target++=(char16_t)c;
} else {
/* output surrogate pair */
*target++=U16_LEAD(c);
@@ -1356,7 +1356,7 @@ endloop:
} else {
/* set the converter state back into UConverter */
cnv->toUnicodeStatus=(uint32_t)prev;
- cnv->mode=(diff<<2)|count;
+ cnv->mode=((uint32_t)diff<<2)|count;
}
cnv->toULength=byteIndex;
@@ -1371,27 +1371,27 @@ endloop:
static const UConverterImpl _Bocu1Impl={
UCNV_BOCU1,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
_Bocu1ToUnicode,
_Bocu1ToUnicodeWithOffsets,
_Bocu1FromUnicode,
_Bocu1FromUnicodeWithOffsets,
- NULL,
+ nullptr,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
ucnv_getCompleteUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
static const UConverterStaticData _Bocu1StaticData={
@@ -1399,7 +1399,7 @@ static const UConverterStaticData _Bocu1StaticData={
"BOCU-1",
1214, /* CCSID for BOCU-1 */
UCNV_IBM, UCNV_BOCU1,
- 1, 4, /* one UChar generates at least 1 byte and at most 4 bytes */
+ 1, 4, /* one char16_t generates at least 1 byte and at most 4 bytes */
{ 0x1a, 0, 0, 0 }, 1, /* BOCU-1 never needs to write a subchar */
false, false,
0,
diff --git a/thirdparty/icu4c/common/ucnvdisp.cpp b/thirdparty/icu4c/common/ucnvdisp.cpp
index ac86b98597..0830042d0b 100644
--- a/thirdparty/icu4c/common/ucnvdisp.cpp
+++ b/thirdparty/icu4c/common/ucnvdisp.cpp
@@ -35,25 +35,25 @@
U_CAPI int32_t U_EXPORT2
ucnv_getDisplayName(const UConverter *cnv,
const char *displayLocale,
- UChar *displayName, int32_t displayNameCapacity,
+ char16_t *displayName, int32_t displayNameCapacity,
UErrorCode *pErrorCode) {
UResourceBundle *rb;
- const UChar *name;
+ const char16_t *name;
int32_t length;
UErrorCode localStatus = U_ZERO_ERROR;
/* check arguments */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(cnv==NULL || displayNameCapacity<0 || (displayNameCapacity>0 && displayName==NULL)) {
+ if(cnv==nullptr || displayNameCapacity<0 || (displayNameCapacity>0 && displayName==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
/* open the resource bundle and get the display name string */
- rb=ures_open(NULL, displayLocale, pErrorCode);
+ rb=ures_open(nullptr, displayLocale, pErrorCode);
if(U_FAILURE(*pErrorCode)) {
return 0;
}
diff --git a/thirdparty/icu4c/common/ucnvhz.cpp b/thirdparty/icu4c/common/ucnvhz.cpp
index e0d2f0775d..fa0f2b40ea 100644
--- a/thirdparty/icu4c/common/ucnvhz.cpp
+++ b/thirdparty/icu4c/common/ucnvhz.cpp
@@ -42,7 +42,7 @@
while(len-->0){ \
if(targetIndex < targetLength){ \
args->target[targetIndex] = (unsigned char) *strToAppend; \
- if(args->offsets!=NULL){ \
+ if(args->offsets!=nullptr){ \
*(offsets++) = sourceIndex-1; \
} \
targetIndex++; \
@@ -84,7 +84,7 @@ _HZOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
cnv->mode=0;
cnv->fromUChar32=0x0000;
cnv->extraInfo = uprv_calloc(1, sizeof(UConverterDataHZ));
- if(cnv->extraInfo != NULL){
+ if(cnv->extraInfo != nullptr){
((UConverterDataHZ*)cnv->extraInfo)->gbConverter = gbConverter;
}
else {
@@ -96,12 +96,12 @@ _HZOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode){
static void U_CALLCONV
_HZClose(UConverter *cnv){
- if(cnv->extraInfo != NULL) {
+ if(cnv->extraInfo != nullptr) {
ucnv_close (((UConverterDataHZ *) (cnv->extraInfo))->gbConverter);
if(!cnv->isExtraLocal) {
uprv_free(cnv->extraInfo);
}
- cnv->extraInfo = NULL;
+ cnv->extraInfo = nullptr;
}
}
@@ -110,7 +110,7 @@ _HZReset(UConverter *cnv, UConverterResetChoice choice){
if(choice<=UCNV_RESET_TO_UNICODE) {
cnv->toUnicodeStatus = 0;
cnv->mode=0;
- if(cnv->extraInfo != NULL){
+ if(cnv->extraInfo != nullptr){
((UConverterDataHZ*)cnv->extraInfo)->isStateDBCS = false;
((UConverterDataHZ*)cnv->extraInfo)->isEmptySegment = false;
}
@@ -118,7 +118,7 @@ _HZReset(UConverter *cnv, UConverterResetChoice choice){
if(choice!=UCNV_RESET_TO_UNICODE) {
cnv->fromUnicodeStatus= 0;
cnv->fromUChar32=0x0000;
- if(cnv->extraInfo != NULL){
+ if(cnv->extraInfo != nullptr){
((UConverterDataHZ*)cnv->extraInfo)->isEscapeAppended = false;
((UConverterDataHZ*)cnv->extraInfo)->targetIndex = 0;
((UConverterDataHZ*)cnv->extraInfo)->sourceIndex = 0;
@@ -157,7 +157,7 @@ UConverter_toUnicode_HZ_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
UErrorCode* err){
char tempBuf[2];
const char *mySource = ( char *) args->source;
- UChar *myTarget = args->target;
+ char16_t *myTarget = args->target;
const char *mySourceLimit = args->sourceLimit;
UChar32 targetUniChar = 0x0000;
int32_t mySourceChar = 0x0000;
@@ -166,7 +166,7 @@ UConverter_toUnicode_HZ_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
tempBuf[1]=0;
/* Calling code already handles this situation. */
- /*if ((args->converter == NULL) || (args->targetLimit < args->target) || (mySourceLimit < args->source)){
+ /*if ((args->converter == nullptr) || (args->targetLimit < args->target) || (mySourceLimit < args->source)){
*err = U_ILLEGAL_ARGUMENT_ERROR;
return;
}*/
@@ -188,7 +188,7 @@ UConverter_toUnicode_HZ_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
if(args->offsets) {
args->offsets[myTarget - args->target]=(int32_t)(mySource - args->source - 2);
}
- *(myTarget++)=(UChar)mySourceChar;
+ *(myTarget++)=(char16_t)mySourceChar;
myData->isEmptySegment = false;
continue;
case UCNV_OPEN_BRACE:
@@ -288,7 +288,7 @@ UConverter_toUnicode_HZ_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
args->converter->mode = UCNV_TILDE;
continue;
} else if(mySourceChar <= 0x7f) {
- targetUniChar = (UChar)mySourceChar; /* ASCII */
+ targetUniChar = (char16_t)mySourceChar; /* ASCII */
myData->isEmptySegment = false; /* the segment has something valid */
} else {
targetUniChar = 0xffff;
@@ -300,7 +300,7 @@ UConverter_toUnicode_HZ_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
args->offsets[myTarget - args->target]=(int32_t)(mySource - args->source - 1-(myData->isStateDBCS));
}
- *(myTarget++)=(UChar)targetUniChar;
+ *(myTarget++)=(char16_t)targetUniChar;
}
else /* targetUniChar>=0xfffe */ {
if(targetUniChar == 0xfffe){
@@ -335,7 +335,7 @@ UConverter_toUnicode_HZ_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
static void U_CALLCONV
UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
UErrorCode * err){
- const UChar *mySource = args->source;
+ const char16_t *mySource = args->source;
char *myTarget = args->target;
int32_t* offsets = args->offsets;
int32_t mySourceIndex = 0;
@@ -348,10 +348,10 @@ UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
UBool isTargetUCharDBCS = (UBool) myConverterData->isTargetUCharDBCS;
UBool oldIsTargetUCharDBCS;
int len =0;
- const char* escSeq=NULL;
+ const char* escSeq=nullptr;
/* Calling code already handles this situation. */
- /*if ((args->converter == NULL) || (args->targetLimit < myTarget) || (args->sourceLimit < args->source)){
+ /*if ((args->converter == nullptr) || (args->targetLimit < myTarget) || (args->sourceLimit < args->source)){
*err = U_ILLEGAL_ARGUMENT_ERROR;
return;
}*/
@@ -363,7 +363,7 @@ UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
targetUniChar = missingCharMarker;
if (myTargetIndex < targetLength){
- mySourceChar = (UChar) mySource[mySourceIndex++];
+ mySourceChar = (char16_t) mySource[mySourceIndex++];
oldIsTargetUCharDBCS = isTargetUCharDBCS;
@@ -453,7 +453,7 @@ getTrail:
/*look ahead to find the trail surrogate*/
if(mySourceIndex < mySourceLength) {
/* test the following code unit */
- UChar trail=(UChar) args->source[mySourceIndex];
+ char16_t trail=(char16_t) args->source[mySourceIndex];
if(U16_IS_TRAIL(trail)) {
++mySourceIndex;
mySourceChar=U16_GET_SUPPLEMENTARY(args->converter->fromUChar32, trail);
@@ -579,8 +579,8 @@ static const UConverterImpl _HZImpl={
UCNV_HZ,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_HZOpen,
_HZClose,
@@ -590,15 +590,15 @@ static const UConverterImpl _HZImpl={
UConverter_toUnicode_HZ_OFFSETS_LOGIC,
UConverter_fromUnicode_HZ_OFFSETS_LOGIC,
UConverter_fromUnicode_HZ_OFFSETS_LOGIC,
- NULL,
+ nullptr,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_HZ_WriteSub,
_HZ_SafeClone,
_HZ_GetUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
static const UConverterStaticData _HZStaticData={
diff --git a/thirdparty/icu4c/common/ucnvisci.cpp b/thirdparty/icu4c/common/ucnvisci.cpp
index 4d747e1ff8..507a50c892 100644
--- a/thirdparty/icu4c/common/ucnvisci.cpp
+++ b/thirdparty/icu4c/common/ucnvisci.cpp
@@ -119,8 +119,8 @@ typedef enum {
#define ISCII_CNV_PREFIX "ISCII,version="
typedef struct {
- UChar contextCharToUnicode; /* previous Unicode codepoint for contextual analysis */
- UChar contextCharFromUnicode; /* previous Unicode codepoint for contextual analysis */
+ char16_t contextCharToUnicode; /* previous Unicode codepoint for contextual analysis */
+ char16_t contextCharFromUnicode; /* previous Unicode codepoint for contextual analysis */
uint16_t defDeltaToUnicode; /* delta for switching to default state when DEF is encountered */
uint16_t currentDeltaFromUnicode; /* current delta in Indic block */
uint16_t currentDeltaToUnicode; /* current delta in Indic block */
@@ -195,7 +195,7 @@ _ISCIIOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode) {
cnv->extraInfo = uprv_malloc(sizeof(UConverterDataISCII));
- if (cnv->extraInfo != NULL) {
+ if (cnv->extraInfo != nullptr) {
int32_t len=0;
UConverterDataISCII *converterData=
(UConverterDataISCII *) cnv->extraInfo;
@@ -223,7 +223,7 @@ _ISCIIOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode) {
converterData->prevToUnicodeStatus = 0x0000;
} else {
uprv_free(cnv->extraInfo);
- cnv->extraInfo = NULL;
+ cnv->extraInfo = nullptr;
*errorCode = U_ILLEGAL_ARGUMENT_ERROR;
}
@@ -234,11 +234,11 @@ _ISCIIOpen(UConverter *cnv, UConverterLoadArgs *pArgs, UErrorCode *errorCode) {
static void U_CALLCONV
_ISCIIClose(UConverter *cnv) {
- if (cnv->extraInfo!=NULL) {
+ if (cnv->extraInfo!=nullptr) {
if (!cnv->isExtraLocal) {
uprv_free(cnv->extraInfo);
}
- cnv->extraInfo=NULL;
+ cnv->extraInfo=nullptr;
}
}
@@ -248,7 +248,7 @@ _ISCIIgetName(const UConverter* cnv) {
UConverterDataISCII* myData= (UConverterDataISCII*)cnv->extraInfo;
return myData->name;
}
- return NULL;
+ return nullptr;
}
static void U_CALLCONV
@@ -895,8 +895,8 @@ static const uint16_t nuktaSpecialCases[][2]={
static void U_CALLCONV
UConverter_fromUnicode_ISCII_OFFSETS_LOGIC(
UConverterFromUnicodeArgs * args, UErrorCode * err) {
- const UChar *source = args->source;
- const UChar *sourceLimit = args->sourceLimit;
+ const char16_t *source = args->source;
+ const char16_t *sourceLimit = args->sourceLimit;
unsigned char *target = (unsigned char *) args->target;
unsigned char *targetLimit = (unsigned char *) args->targetLimit;
int32_t* offsets = args->offsets;
@@ -908,7 +908,7 @@ UConverter_fromUnicode_ISCII_OFFSETS_LOGIC(
uint16_t range = 0;
UBool deltaChanged = false;
- if ((args->converter == NULL) || (args->targetLimit < args->target) || (args->sourceLimit < args->source)) {
+ if ((args->converter == nullptr) || (args->targetLimit < args->target) || (args->sourceLimit < args->source)) {
*err = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -1052,7 +1052,7 @@ UConverter_fromUnicode_ISCII_OFFSETS_LOGIC(
}
} else if (targetByteUnit != missingCharMarker) {
if (targetByteUnit==ISCII_HALANT) {
- converterData->contextCharFromUnicode = (UChar)targetByteUnit;
+ converterData->contextCharFromUnicode = (char16_t)targetByteUnit;
}
/* write targetByteUnit to target*/
WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,targetByteUnit,err);
@@ -1068,7 +1068,7 @@ getTrail:
/*look ahead to find the trail surrogate*/
if (source < sourceLimit) {
/* test the following code unit */
- UChar trail= (*source);
+ char16_t trail= (*source);
if (U16_IS_TRAIL(trail)) {
source++;
sourceChar=U16_GET_SUPPLEMENTARY(sourceChar, trail);
@@ -1131,13 +1131,13 @@ static const uint16_t lookupTable[][2]={
} \
/* now write the targetUniChar */ \
if(target<args->targetLimit){ \
- *(target)++ = (UChar)targetUniChar; \
+ *(target)++ = (char16_t)targetUniChar; \
if(offsets){ \
*(offsets)++ = (int32_t)(offset); \
} \
}else{ \
args->converter->UCharErrorBuffer[args->converter->UCharErrorBufferLength++] = \
- (UChar)targetUniChar; \
+ (char16_t)targetUniChar; \
*err = U_BUFFER_OVERFLOW_ERROR; \
} \
} UPRV_BLOCK_MACRO_END
@@ -1179,20 +1179,20 @@ static const uint16_t lookupTable[][2]={
static void U_CALLCONV
UConverter_toUnicode_ISCII_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, UErrorCode* err) {
const char *source = ( char *) args->source;
- UChar *target = args->target;
+ char16_t *target = args->target;
const char *sourceLimit = args->sourceLimit;
- const UChar* targetLimit = args->targetLimit;
+ const char16_t* targetLimit = args->targetLimit;
uint32_t targetUniChar = 0x0000;
uint8_t sourceChar = 0x0000;
UConverterDataISCII* data;
- UChar32* toUnicodeStatus=NULL;
+ UChar32* toUnicodeStatus=nullptr;
UChar32 tempTargetUniChar = 0x0000;
- UChar* contextCharToUnicode= NULL;
+ char16_t* contextCharToUnicode= nullptr;
UBool found;
int i;
int offset = 0;
- if ((args->converter == NULL) || (target < args->target) || (source < args->source)) {
+ if ((args->converter == nullptr) || (target < args->target) || (source < args->source)) {
*err = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -1293,7 +1293,7 @@ UConverter_toUnicode_ISCII_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, UErrorCo
case ISCII_INV:
case EXT:
case ATR:
- *contextCharToUnicode = (UChar)sourceChar;
+ *contextCharToUnicode = (char16_t)sourceChar;
if (*toUnicodeStatus != missingCharMarker) {
/* Write the previous toUnicodeStatus, this was delayed to handle consonant clustering for Gurmukhi script. */
@@ -1471,8 +1471,8 @@ UConverter_toUnicode_ISCII_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, UErrorCo
if (targetUniChar != missingCharMarker) {
/* now save the targetUniChar for delayed write */
- *toUnicodeStatus = (UChar) targetUniChar;
- if (data->resetToDefaultToUnicode==true) {
+ *toUnicodeStatus = (char16_t) targetUniChar;
+ if (data->resetToDefaultToUnicode) {
data->currentDeltaToUnicode = data->defDeltaToUnicode;
data->currentMaskToUnicode = data->defMaskToUnicode;
data->resetToDefaultToUnicode=false;
@@ -1589,8 +1589,8 @@ static const UConverterImpl _ISCIIImpl={
UCNV_ISCII,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_ISCIIOpen,
_ISCIIClose,
@@ -1600,15 +1600,15 @@ static const UConverterImpl _ISCIIImpl={
UConverter_toUnicode_ISCII_OFFSETS_LOGIC,
UConverter_fromUnicode_ISCII_OFFSETS_LOGIC,
UConverter_fromUnicode_ISCII_OFFSETS_LOGIC,
- NULL,
+ nullptr,
- NULL,
+ nullptr,
_ISCIIgetName,
- NULL,
+ nullptr,
_ISCII_SafeClone,
_ISCIIGetUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
static const UConverterStaticData _ISCIIStaticData={
diff --git a/thirdparty/icu4c/common/ucnvlat1.cpp b/thirdparty/icu4c/common/ucnvlat1.cpp
index 05aad6a0e0..0920688526 100644
--- a/thirdparty/icu4c/common/ucnvlat1.cpp
+++ b/thirdparty/icu4c/common/ucnvlat1.cpp
@@ -36,7 +36,7 @@ static void U_CALLCONV
_Latin1ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
const uint8_t *source;
- UChar *target;
+ char16_t *target;
int32_t targetCapacity, length;
int32_t *offsets;
@@ -51,7 +51,7 @@ _Latin1ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
sourceIndex=0;
/*
- * since the conversion here is 1:1 UChar:uint8_t, we need only one counter
+ * since the conversion here is 1:1 char16_t:uint8_t, we need only one counter
* for the minimum of the sourceLength and targetCapacity
*/
length=(int32_t)((const uint8_t *)pArgs->sourceLimit-source);
@@ -82,7 +82,7 @@ _Latin1ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
source+=8;
} while(--count>0);
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
do {
offsets[0]=sourceIndex++;
offsets[1]=sourceIndex++;
@@ -108,7 +108,7 @@ _Latin1ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
pArgs->target=target;
/* set offsets */
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
while(length>0) {
*offsets++=sourceIndex++;
--length;
@@ -137,13 +137,13 @@ static void U_CALLCONV
_Latin1FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
- const UChar *source, *sourceLimit;
+ const char16_t *source, *sourceLimit;
uint8_t *target, *oldTarget;
int32_t targetCapacity, length;
int32_t *offsets;
UChar32 cp;
- UChar c, max;
+ char16_t c, max;
int32_t sourceIndex;
@@ -168,7 +168,7 @@ _Latin1FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
sourceIndex= cp==0 ? 0 : -1;
/*
- * since the conversion here is 1:1 UChar:uint8_t, we need only one counter
+ * since the conversion here is 1:1 char16_t:uint8_t, we need only one counter
* for the minimum of the sourceLength and targetCapacity
*/
length=(int32_t)(sourceLimit-source);
@@ -185,7 +185,7 @@ _Latin1FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
/* unroll the loop with the most common case */
if(targetCapacity>=16) {
int32_t count, loops;
- UChar u, oredChars;
+ char16_t u, oredChars;
loops=count=targetCapacity>>4;
do {
@@ -233,7 +233,7 @@ _Latin1FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
count=loops-count;
targetCapacity-=16*count;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
oldTarget+=16*count;
while(count>0) {
*offsets++=sourceIndex++;
@@ -274,7 +274,7 @@ _Latin1FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
getTrail:
if(source<sourceLimit) {
/* test the following code unit */
- UChar trail=*source;
+ char16_t trail=*source;
if(U16_IS_TRAIL(trail)) {
++source;
cp=U16_GET_SUPPLEMENTARY(cp, trail);
@@ -300,7 +300,7 @@ getTrail:
noMoreInput:
/* set offsets since the start */
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
size_t count=target-oldTarget;
while(count>0) {
*offsets++=sourceIndex++;
@@ -438,12 +438,12 @@ U_CDECL_END
static const UConverterImpl _Latin1Impl={
UCNV_LATIN_1,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
_Latin1ToUnicodeWithOffsets,
_Latin1ToUnicodeWithOffsets,
@@ -451,13 +451,13 @@ static const UConverterImpl _Latin1Impl={
_Latin1FromUnicodeWithOffsets,
_Latin1GetNextUChar,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_Latin1GetUnicodeSet,
- NULL,
+ nullptr,
ucnv_Latin1FromUTF8
};
@@ -482,7 +482,7 @@ static void U_CALLCONV
_ASCIIToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
const uint8_t *source, *sourceLimit;
- UChar *target, *oldTarget;
+ char16_t *target, *oldTarget;
int32_t targetCapacity, length;
int32_t *offsets;
@@ -501,7 +501,7 @@ _ASCIIToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
sourceIndex=0;
/*
- * since the conversion here is 1:1 UChar:uint8_t, we need only one counter
+ * since the conversion here is 1:1 char16_t:uint8_t, we need only one counter
* for the minimum of the sourceLength and targetCapacity
*/
length=(int32_t)(sourceLimit-source);
@@ -512,7 +512,7 @@ _ASCIIToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
if(targetCapacity>=8) {
/* This loop is unrolled for speed and improved pipelining. */
int32_t count, loops;
- UChar oredChars;
+ char16_t oredChars;
loops=count=targetCapacity>>3;
do {
@@ -536,7 +536,7 @@ _ASCIIToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
count=loops-count;
targetCapacity-=count*8;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
oldTarget+=count*8;
while(count>0) {
offsets[0]=sourceIndex++;
@@ -572,7 +572,7 @@ _ASCIIToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
}
/* set offsets since the start */
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
size_t count=target-oldTarget;
while(count>0) {
*offsets++=sourceIndex++;
@@ -717,12 +717,12 @@ U_CDECL_END
static const UConverterImpl _ASCIIImpl={
UCNV_US_ASCII,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
_ASCIIToUnicodeWithOffsets,
_ASCIIToUnicodeWithOffsets,
@@ -730,13 +730,13 @@ static const UConverterImpl _ASCIIImpl={
_Latin1FromUnicodeWithOffsets,
_ASCIIGetNextUChar,
- NULL,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
_ASCIIGetUnicodeSet,
- NULL,
+ nullptr,
ucnv_ASCIIFromUTF8
};
diff --git a/thirdparty/icu4c/common/ucnvmbcs.cpp b/thirdparty/icu4c/common/ucnvmbcs.cpp
index 0e753c8ffb..d760603980 100644
--- a/thirdparty/icu4c/common/ucnvmbcs.cpp
+++ b/thirdparty/icu4c/common/ucnvmbcs.cpp
@@ -438,8 +438,8 @@ static const UConverterImpl _SBCSUTF8Impl={
ucnv_MBCSUnload,
ucnv_MBCSOpen,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
ucnv_MBCSToUnicodeWithOffsets,
ucnv_MBCSToUnicodeWithOffsets,
@@ -450,10 +450,10 @@ static const UConverterImpl _SBCSUTF8Impl={
ucnv_MBCSGetStarters,
ucnv_MBCSGetName,
ucnv_MBCSWriteSub,
- NULL,
+ nullptr,
ucnv_MBCSGetUnicodeSet,
- NULL,
+ nullptr,
ucnv_SBCSFromUTF8
};
@@ -464,8 +464,8 @@ static const UConverterImpl _DBCSUTF8Impl={
ucnv_MBCSUnload,
ucnv_MBCSOpen,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
ucnv_MBCSToUnicodeWithOffsets,
ucnv_MBCSToUnicodeWithOffsets,
@@ -476,10 +476,10 @@ static const UConverterImpl _DBCSUTF8Impl={
ucnv_MBCSGetStarters,
ucnv_MBCSGetName,
ucnv_MBCSWriteSub,
- NULL,
+ nullptr,
ucnv_MBCSGetUnicodeSet,
- NULL,
+ nullptr,
ucnv_DBCSFromUTF8
};
@@ -490,8 +490,8 @@ static const UConverterImpl _MBCSImpl={
ucnv_MBCSUnload,
ucnv_MBCSOpen,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
ucnv_MBCSToUnicodeWithOffsets,
ucnv_MBCSToUnicodeWithOffsets,
@@ -502,10 +502,10 @@ static const UConverterImpl _MBCSImpl={
ucnv_MBCSGetStarters,
ucnv_MBCSGetName,
ucnv_MBCSWriteSub,
- NULL,
+ nullptr,
ucnv_MBCSGetUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
/* Static data is in tools/makeconv/ucnvstat.c for data-based
@@ -514,7 +514,7 @@ static const UConverterImpl _MBCSImpl={
const UConverterSharedData _MBCSData={
sizeof(UConverterSharedData), 1,
- NULL, NULL, false, true, &_MBCSImpl,
+ nullptr, nullptr, false, true, &_MBCSImpl,
0, UCNV_MBCS_TABLE_INITIALIZER
};
@@ -683,7 +683,7 @@ enumToU(UConverterMBCSTable *mbcsTable, int8_t stateProps[],
action=MBCS_ENTRY_FINAL_ACTION(entry);
if(action==MBCS_STATE_VALID_DIRECT_16) {
/* output BMP code point */
- c=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ c=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
} else if(action==MBCS_STATE_VALID_16) {
int32_t finalOffset=offset+MBCS_ENTRY_FINAL_VALUE_16(entry);
c=unicodeCodeUnits[finalOffset];
@@ -1104,7 +1104,7 @@ ucnv_MBCSGetUnicodeSet(const UConverter *cnv,
static UChar32
_extFromU(UConverter *cnv, const UConverterSharedData *sharedData,
UChar32 cp,
- const UChar **source, const UChar *sourceLimit,
+ const char16_t **source, const char16_t *sourceLimit,
uint8_t **target, const uint8_t *targetLimit,
int32_t **offsets, int32_t sourceIndex,
UBool flush,
@@ -1113,7 +1113,7 @@ _extFromU(UConverter *cnv, const UConverterSharedData *sharedData,
cnv->useSubChar1=false;
- if( (cx=sharedData->mbcs.extIndexes)!=NULL &&
+ if( (cx=sharedData->mbcs.extIndexes)!=nullptr &&
ucnv_extInitialMatchFromU(
cnv, cx,
cp, source, sourceLimit,
@@ -1172,13 +1172,13 @@ static int8_t
_extToU(UConverter *cnv, const UConverterSharedData *sharedData,
int8_t length,
const uint8_t **source, const uint8_t *sourceLimit,
- UChar **target, const UChar *targetLimit,
+ char16_t **target, const char16_t *targetLimit,
int32_t **offsets, int32_t sourceIndex,
UBool flush,
UErrorCode *pErrorCode) {
const int32_t *cx;
- if( (cx=sharedData->mbcs.extIndexes)!=NULL &&
+ if( (cx=sharedData->mbcs.extIndexes)!=nullptr &&
ucnv_extInitialMatchToU(
cnv, cx,
length, (const char **)source, (const char *)sourceLimit,
@@ -1349,7 +1349,7 @@ _EBCDICSwapLFNL(UConverterSharedData *sharedData, UErrorCode *pErrorCode) {
sizeofFromUBytes+
UCNV_MAX_CONVERTER_NAME_LENGTH+20;
p=(uint8_t *)uprv_malloc(size);
- if(p==NULL) {
+ if(p==nullptr) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return false;
}
@@ -1383,18 +1383,18 @@ _EBCDICSwapLFNL(UConverterSharedData *sharedData, UErrorCode *pErrorCode) {
uprv_strcat(name, UCNV_SWAP_LFNL_OPTION_STRING);
/* set the pointers */
- icu::umtx_lock(NULL);
- if(mbcsTable->swapLFNLStateTable==NULL) {
+ icu::umtx_lock(nullptr);
+ if(mbcsTable->swapLFNLStateTable==nullptr) {
mbcsTable->swapLFNLStateTable=newStateTable;
mbcsTable->swapLFNLFromUnicodeBytes=(uint8_t *)newResults;
mbcsTable->swapLFNLName=name;
- newStateTable=NULL;
+ newStateTable=nullptr;
}
- icu::umtx_unlock(NULL);
+ icu::umtx_unlock(nullptr);
/* release the allocated memory if another thread beat us to it */
- if(newStateTable!=NULL) {
+ if(newStateTable!=nullptr) {
uprv_free(newStateTable);
}
return true;
@@ -1489,7 +1489,7 @@ reconstituteData(UConverterMBCSTable *mbcsTable,
uint32_t *stage2;
uint32_t dataLength=stage1Length*2+fullStage2Length*4+mbcsTable->fromUBytesLength;
mbcsTable->reconstitutedData=(uint8_t *)uprv_malloc(dataLength);
- if(mbcsTable->reconstitutedData==NULL) {
+ if(mbcsTable->reconstitutedData==nullptr) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1593,7 +1593,7 @@ ucnv_MBCSLoad(UConverterSharedData *sharedData,
const char *baseName;
/* extension-only file, load the base table and set values appropriately */
- if((extIndexes=mbcsTable->extIndexes)==NULL) {
+ if((extIndexes=mbcsTable->extIndexes)==nullptr) {
/* extension-only file without extension */
*pErrorCode=U_INVALID_TABLE_FORMAT;
return;
@@ -1626,7 +1626,7 @@ ucnv_MBCSLoad(UConverterSharedData *sharedData,
return;
}
if( baseSharedData->staticData->conversionType!=UCNV_MBCS ||
- baseSharedData->mbcs.baseSharedData!=NULL
+ baseSharedData->mbcs.baseSharedData!=nullptr
) {
ucnv_unload(baseSharedData);
*pErrorCode=U_INVALID_TABLE_FORMAT;
@@ -1657,15 +1657,15 @@ ucnv_MBCSLoad(UConverterSharedData *sharedData,
* It is easier to just create the data for the extension converter
* separately when it is requested.
*/
- mbcsTable->swapLFNLStateTable=NULL;
- mbcsTable->swapLFNLFromUnicodeBytes=NULL;
- mbcsTable->swapLFNLName=NULL;
+ mbcsTable->swapLFNLStateTable=nullptr;
+ mbcsTable->swapLFNLFromUnicodeBytes=nullptr;
+ mbcsTable->swapLFNLName=nullptr;
/*
* The reconstitutedData must be deleted only when the base converter
* is unloaded.
*/
- mbcsTable->reconstitutedData=NULL;
+ mbcsTable->reconstitutedData=nullptr;
/*
* Set a special, runtime-only outputType if the extension converter
@@ -1703,7 +1703,7 @@ ucnv_MBCSLoad(UConverterSharedData *sharedData,
/* allocate a new state table and copy the base state table contents */
count=mbcsTable->countStates;
newStateTable=(int32_t (*)[256])uprv_malloc((count+1)*1024);
- if(newStateTable==NULL) {
+ if(newStateTable==nullptr) {
ucnv_unload(baseSharedData);
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return;
@@ -1828,7 +1828,7 @@ ucnv_MBCSLoad(UConverterSharedData *sharedData,
mbcsTable->mbcsIndex=(const uint16_t *)
(mbcsTable->fromUnicodeBytes+
(noFromU ? 0 : mbcsTable->fromUBytesLength));
- mbcsTable->maxFastUChar=(((UChar)header->version[2])<<8)|0xff;
+ mbcsTable->maxFastUChar=(((char16_t)header->version[2])<<8)|0xff;
}
}
@@ -1880,16 +1880,16 @@ static void U_CALLCONV
ucnv_MBCSUnload(UConverterSharedData *sharedData) {
UConverterMBCSTable *mbcsTable=&sharedData->mbcs;
- if(mbcsTable->swapLFNLStateTable!=NULL) {
+ if(mbcsTable->swapLFNLStateTable!=nullptr) {
uprv_free(mbcsTable->swapLFNLStateTable);
}
if(mbcsTable->stateTableOwned) {
uprv_free((void *)mbcsTable->stateTable);
}
- if(mbcsTable->baseSharedData!=NULL) {
+ if(mbcsTable->baseSharedData!=nullptr) {
ucnv_unload(mbcsTable->baseSharedData);
}
- if(mbcsTable->reconstitutedData!=NULL) {
+ if(mbcsTable->reconstitutedData!=nullptr) {
uprv_free(mbcsTable->reconstitutedData);
}
}
@@ -1919,9 +1919,9 @@ ucnv_MBCSOpen(UConverter *cnv,
/* do this because double-checked locking is broken */
UBool isCached;
- icu::umtx_lock(NULL);
- isCached=mbcsTable->swapLFNLStateTable!=NULL;
- icu::umtx_unlock(NULL);
+ icu::umtx_lock(nullptr);
+ isCached=mbcsTable->swapLFNLStateTable!=nullptr;
+ icu::umtx_unlock(nullptr);
if(!isCached) {
if(!_EBCDICSwapLFNL(cnv->sharedData, pErrorCode)) {
@@ -1935,18 +1935,18 @@ ucnv_MBCSOpen(UConverter *cnv,
}
}
- if(uprv_strstr(pArgs->name, "18030")!=NULL) {
- if(uprv_strstr(pArgs->name, "gb18030")!=NULL || uprv_strstr(pArgs->name, "GB18030")!=NULL) {
+ if(uprv_strstr(pArgs->name, "18030")!=nullptr) {
+ if(uprv_strstr(pArgs->name, "gb18030")!=nullptr || uprv_strstr(pArgs->name, "GB18030")!=nullptr) {
/* set a flag for GB 18030 mode, which changes the callback behavior */
cnv->options|=_MBCS_OPTION_GB18030;
}
- } else if((uprv_strstr(pArgs->name, "KEIS")!=NULL) || (uprv_strstr(pArgs->name, "keis")!=NULL)) {
+ } else if((uprv_strstr(pArgs->name, "KEIS")!=nullptr) || (uprv_strstr(pArgs->name, "keis")!=nullptr)) {
/* set a flag for KEIS converter, which changes the SI/SO character sequence */
cnv->options|=_MBCS_OPTION_KEIS;
- } else if((uprv_strstr(pArgs->name, "JEF")!=NULL) || (uprv_strstr(pArgs->name, "jef")!=NULL)) {
+ } else if((uprv_strstr(pArgs->name, "JEF")!=nullptr) || (uprv_strstr(pArgs->name, "jef")!=nullptr)) {
/* set a flag for JEF converter, which changes the SI/SO character sequence */
cnv->options|=_MBCS_OPTION_JEF;
- } else if((uprv_strstr(pArgs->name, "JIPS")!=NULL) || (uprv_strstr(pArgs->name, "jips")!=NULL)) {
+ } else if((uprv_strstr(pArgs->name, "JIPS")!=nullptr) || (uprv_strstr(pArgs->name, "jips")!=nullptr)) {
/* set a flag for JIPS converter, which changes the SI/SO character sequence */
cnv->options|=_MBCS_OPTION_JIPS;
}
@@ -1957,7 +1957,7 @@ ucnv_MBCSOpen(UConverter *cnv,
}
extIndexes=mbcsTable->extIndexes;
- if(extIndexes!=NULL) {
+ if(extIndexes!=nullptr) {
maxBytesPerUChar=(int8_t)UCNV_GET_MAX_BYTES_PER_UCHAR(extIndexes);
if(outputType==MBCS_OUTPUT_2_SISO) {
++maxBytesPerUChar; /* SO + multiple DBCS */
@@ -1989,7 +1989,7 @@ U_CDECL_BEGIN
static const char* U_CALLCONV
ucnv_MBCSGetName(const UConverter *cnv) {
- if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0 && cnv->sharedData->mbcs.swapLFNLName!=NULL) {
+ if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0 && cnv->sharedData->mbcs.swapLFNLName!=nullptr) {
return cnv->sharedData->mbcs.swapLFNLName;
} else {
return cnv->sharedData->staticData->name;
@@ -2034,8 +2034,8 @@ ucnv_MBCSSingleToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
const uint8_t *source, *sourceLimit;
- UChar *target;
- const UChar *targetLimit;
+ char16_t *target;
+ const char16_t *targetLimit;
int32_t *offsets;
const int32_t (*stateTable)[256];
@@ -2043,7 +2043,7 @@ ucnv_MBCSSingleToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
int32_t sourceIndex;
int32_t entry;
- UChar c;
+ char16_t c;
uint8_t action;
/* set up the local pointers */
@@ -2085,8 +2085,8 @@ ucnv_MBCSSingleToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
/* test the most common case first */
if(MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(entry)) {
/* output BMP code point */
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
- if(offsets!=NULL) {
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
@@ -2105,14 +2105,14 @@ ucnv_MBCSSingleToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
) {
entry=MBCS_ENTRY_FINAL_VALUE(entry);
/* output surrogate pair */
- *target++=(UChar)(0xd800|(UChar)(entry>>10));
- if(offsets!=NULL) {
+ *target++=(char16_t)(0xd800|(char16_t)(entry>>10));
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
- c=(UChar)(0xdc00|(UChar)(entry&0x3ff));
+ c=(char16_t)(0xdc00|(char16_t)(entry&0x3ff));
if(target<targetLimit) {
*target++=c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
} else {
@@ -2128,8 +2128,8 @@ ucnv_MBCSSingleToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
} else if(action==MBCS_STATE_FALLBACK_DIRECT_16) {
if(UCNV_TO_U_USE_FALLBACK(cnv)) {
/* output BMP code point */
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
- if(offsets!=NULL) {
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
@@ -2186,7 +2186,7 @@ ucnv_MBCSSingleToBMPWithOffsets(UConverterToUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
const uint8_t *source, *sourceLimit, *lastSource;
- UChar *target;
+ char16_t *target;
int32_t targetCapacity, length;
int32_t *offsets;
@@ -2216,7 +2216,7 @@ ucnv_MBCSSingleToBMPWithOffsets(UConverterToUnicodeArgs *pArgs,
lastSource=source;
/*
- * since the conversion here is 1:1 UChar:uint8_t, we need only one counter
+ * since the conversion here is 1:1 char16_t:uint8_t, we need only one counter
* for the minimum of the sourceLength and targetCapacity
*/
length=(int32_t)(sourceLimit-source);
@@ -2234,37 +2234,37 @@ unrolled:
loops=count=targetCapacity>>4;
do {
oredEntries=entry=stateTable[0][*source++];
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
oredEntries|=entry=stateTable[0][*source++];
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
oredEntries|=entry=stateTable[0][*source++];
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
oredEntries|=entry=stateTable[0][*source++];
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
oredEntries|=entry=stateTable[0][*source++];
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
oredEntries|=entry=stateTable[0][*source++];
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
oredEntries|=entry=stateTable[0][*source++];
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
oredEntries|=entry=stateTable[0][*source++];
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
oredEntries|=entry=stateTable[0][*source++];
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
oredEntries|=entry=stateTable[0][*source++];
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
oredEntries|=entry=stateTable[0][*source++];
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
oredEntries|=entry=stateTable[0][*source++];
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
oredEntries|=entry=stateTable[0][*source++];
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
oredEntries|=entry=stateTable[0][*source++];
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
oredEntries|=entry=stateTable[0][*source++];
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
oredEntries|=entry=stateTable[0][*source++];
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
/* were all 16 entries really valid? */
if(!MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(oredEntries)) {
@@ -2277,7 +2277,7 @@ unrolled:
count=loops-count;
targetCapacity-=16*count;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
lastSource+=16*count;
while(count>0) {
*offsets++=sourceIndex++;
@@ -2310,7 +2310,7 @@ unrolled:
/* test the most common case first */
if(MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(entry)) {
/* output BMP code point */
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
--targetCapacity;
continue;
}
@@ -2323,7 +2323,7 @@ unrolled:
if(action==MBCS_STATE_FALLBACK_DIRECT_16) {
if(UCNV_TO_U_USE_FALLBACK(cnv)) {
/* output BMP code point */
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
--targetCapacity;
continue;
}
@@ -2338,7 +2338,7 @@ unrolled:
}
/* set offsets since the start or the last extension */
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
int32_t count=(int32_t)(source-lastSource);
/* predecrement: do not set the offset for the callback-causing character */
@@ -2388,7 +2388,7 @@ unrolled:
}
/* set offsets since the start or the last callback */
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
size_t count=source-lastSource;
while(count>0) {
*offsets++=sourceIndex++;
@@ -2466,8 +2466,8 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
const uint8_t *source, *sourceLimit;
- UChar *target;
- const UChar *targetLimit;
+ char16_t *target;
+ const char16_t *targetLimit;
int32_t *offsets;
const int32_t (*stateTable)[256];
@@ -2481,7 +2481,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
int32_t sourceIndex, nextSourceIndex;
int32_t entry;
- UChar c;
+ char16_t c;
uint8_t action;
/* use optimized function if possible */
@@ -2558,7 +2558,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
if(byteIndex==0) {
/* optimized loop for 1/2-byte input and BMP output */
- if(offsets==NULL) {
+ if(offsets==nullptr) {
do {
entry=stateTable[state][*source];
if(MBCS_ENTRY_IS_TRANSITION(entry)) {
@@ -2585,7 +2585,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
if(MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(entry)) {
/* output BMP code point */
++source;
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
state=(uint8_t)MBCS_ENTRY_FINAL_STATE(entry); /* typically 0 */
} else {
/* leave the optimized loop */
@@ -2593,7 +2593,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
}
}
} while(source<sourceLimit && target<targetLimit);
- } else /* offsets!=NULL */ {
+ } else /* offsets!=nullptr */ {
do {
entry=stateTable[state][*source];
if(MBCS_ENTRY_IS_TRANSITION(entry)) {
@@ -2608,7 +2608,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
) {
++source;
*target++=c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
sourceIndex=(nextSourceIndex+=2);
}
@@ -2625,8 +2625,8 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
if(MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(entry)) {
/* output BMP code point */
++source;
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
- if(offsets!=NULL) {
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
sourceIndex=++nextSourceIndex;
}
@@ -2682,15 +2682,15 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
if(c<0xfffe) {
/* output BMP code point */
*target++=c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
byteIndex=0;
} else if(c==0xfffe) {
if(UCNV_TO_U_USE_FALLBACK(cnv) && (entry=(int32_t)ucnv_MBCSGetFallback(&cnv->sharedData->mbcs, offset))!=0xfffe) {
/* output fallback BMP code point */
- *target++=(UChar)entry;
- if(offsets!=NULL) {
+ *target++=(char16_t)entry;
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
byteIndex=0;
@@ -2701,8 +2701,8 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
}
} else if(action==MBCS_STATE_VALID_DIRECT_16) {
/* output BMP code point */
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
- if(offsets!=NULL) {
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
byteIndex=0;
@@ -2712,20 +2712,20 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
if(c<0xd800) {
/* output BMP code point below 0xd800 */
*target++=c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
byteIndex=0;
} else if(UCNV_TO_U_USE_FALLBACK(cnv) ? c<=0xdfff : c<=0xdbff) {
/* output roundtrip or fallback surrogate pair */
- *target++=(UChar)(c&0xdbff);
- if(offsets!=NULL) {
+ *target++=(char16_t)(c&0xdbff);
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
byteIndex=0;
if(target<targetLimit) {
*target++=unicodeCodeUnits[offset];
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
} else {
@@ -2740,7 +2740,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
} else if(UCNV_TO_U_USE_FALLBACK(cnv) ? (c&0xfffe)==0xe000 : c==0xe000) {
/* output roundtrip BMP code point above 0xd800 or fallback BMP code point */
*target++=unicodeCodeUnits[offset];
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
byteIndex=0;
@@ -2753,15 +2753,15 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
) {
entry=MBCS_ENTRY_FINAL_VALUE(entry);
/* output surrogate pair */
- *target++=(UChar)(0xd800|(UChar)(entry>>10));
- if(offsets!=NULL) {
+ *target++=(char16_t)(0xd800|(char16_t)(entry>>10));
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
byteIndex=0;
- c=(UChar)(0xdc00|(UChar)(entry&0x3ff));
+ c=(char16_t)(0xdc00|(char16_t)(entry&0x3ff));
if(target<targetLimit) {
*target++=c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
} else {
@@ -2793,8 +2793,8 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
} else if(action==MBCS_STATE_FALLBACK_DIRECT_16) {
if(UCNV_TO_U_USE_FALLBACK(cnv)) {
/* output BMP code point */
- *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
- if(offsets!=NULL) {
+ *target++=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
byteIndex=0;
@@ -2908,7 +2908,7 @@ ucnv_MBCSSingleGetNextUChar(UConverterToUnicodeArgs *pArgs,
if(MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(entry)) {
/* output BMP code point */
- return (UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ return (char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
}
/*
@@ -2924,7 +2924,7 @@ ucnv_MBCSSingleGetNextUChar(UConverterToUnicodeArgs *pArgs,
} else if(action==MBCS_STATE_FALLBACK_DIRECT_16) {
if(UCNV_TO_U_USE_FALLBACK(cnv)) {
/* output BMP code point */
- return (UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ return (char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
}
} else if(action==MBCS_STATE_UNASSIGNED) {
/* just fall through */
@@ -3054,7 +3054,7 @@ ucnv_MBCSGetNextUChar(UConverterToUnicodeArgs *pArgs,
action=(uint8_t)(MBCS_ENTRY_FINAL_ACTION(entry));
if(action==MBCS_STATE_VALID_DIRECT_16) {
/* output BMP code point */
- c=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ c=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
break;
} else if(action==MBCS_STATE_VALID_16) {
offset+=MBCS_ENTRY_FINAL_VALUE_16(entry);
@@ -3112,7 +3112,7 @@ ucnv_MBCSGetNextUChar(UConverterToUnicodeArgs *pArgs,
} else if(action==MBCS_STATE_FALLBACK_DIRECT_16) {
if(UCNV_TO_U_USE_FALLBACK(cnv)) {
/* output BMP code point */
- c=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ c=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
break;
}
} else if(action==MBCS_STATE_UNASSIGNED) {
@@ -3213,7 +3213,7 @@ ucnv_MBCSSingleSimpleGetNextUChar(UConverterSharedData *sharedData,
if(MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(entry)) {
/* output BMP code point */
- return (UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ return (char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
}
/*
@@ -3229,7 +3229,7 @@ ucnv_MBCSSingleSimpleGetNextUChar(UConverterSharedData *sharedData,
return 0xfffe;
}
/* output BMP code point */
- return (UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ return (char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
} else if(action==MBCS_STATE_FALLBACK_DIRECT_20) {
if(!TO_U_USE_FALLBACK(useFallback)) {
return 0xfffe;
@@ -3331,7 +3331,7 @@ ucnv_MBCSSimpleGetNextUChar(UConverterSharedData *sharedData,
break;
} else if(action==MBCS_STATE_VALID_DIRECT_16) {
/* output BMP code point */
- c=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ c=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
break;
} else if(action==MBCS_STATE_VALID_16_PAIR) {
offset+=MBCS_ENTRY_FINAL_VALUE_16(entry);
@@ -3360,7 +3360,7 @@ ucnv_MBCSSimpleGetNextUChar(UConverterSharedData *sharedData,
break;
}
/* output BMP code point */
- c=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
+ c=(char16_t)MBCS_ENTRY_FINAL_VALUE_16(entry);
break;
} else if(action==MBCS_STATE_FALLBACK_DIRECT_20) {
if(!TO_U_USE_FALLBACK(useFallback)) {
@@ -3391,7 +3391,7 @@ ucnv_MBCSSimpleGetNextUChar(UConverterSharedData *sharedData,
if(c==0xfffe) {
/* try an extension mapping */
const int32_t *cx=sharedData->mbcs.extIndexes;
- if(cx!=NULL) {
+ if(cx!=nullptr) {
return ucnv_extSimpleMatchToU(cx, source, length, useFallback);
}
}
@@ -3406,7 +3406,7 @@ static void
ucnv_MBCSDoubleFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
- const UChar *source, *sourceLimit;
+ const char16_t *source, *sourceLimit;
uint8_t *target;
int32_t targetCapacity;
int32_t *offsets;
@@ -3468,14 +3468,14 @@ ucnv_MBCSDoubleFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
if(targetCapacity>0) {
/*
* Get a correct Unicode code point:
- * a single UChar for a BMP code point or
+ * a single char16_t for a BMP code point or
* a matched surrogate pair for a "supplementary code point".
*/
c=*source++;
++nextSourceIndex;
if(c<=0x7f && IS_ASCII_ROUNDTRIP(c, asciiRoundtrips)) {
*target++=(uint8_t)c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
sourceIndex=nextSourceIndex;
}
@@ -3506,7 +3506,7 @@ ucnv_MBCSDoubleFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
getTrail:
if(source<sourceLimit) {
/* test the following code unit */
- UChar trail=*source;
+ char16_t trail=*source;
if(U16_IS_TRAIL(trail)) {
++source;
++nextSourceIndex;
@@ -3585,7 +3585,7 @@ unassigned:
if(value<=0xff) {
/* this is easy because we know that there is enough space */
*target++=(uint8_t)value;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
--targetCapacity;
@@ -3593,13 +3593,13 @@ unassigned:
*target++=(uint8_t)(value>>8);
if(2<=targetCapacity) {
*target++=(uint8_t)value;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
*offsets++=sourceIndex;
}
targetCapacity-=2;
} else {
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
cnv->charErrorBuffer[0]=(char)value;
@@ -3638,7 +3638,7 @@ static void
ucnv_MBCSSingleFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
- const UChar *source, *sourceLimit;
+ const char16_t *source, *sourceLimit;
uint8_t *target;
int32_t targetCapacity;
int32_t *offsets;
@@ -3701,7 +3701,7 @@ ucnv_MBCSSingleFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
if(targetCapacity>0) {
/*
* Get a correct Unicode code point:
- * a single UChar for a BMP code point or
+ * a single char16_t for a BMP code point or
* a matched surrogate pair for a "supplementary code point".
*/
c=*source++;
@@ -3711,7 +3711,7 @@ ucnv_MBCSSingleFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
getTrail:
if(source<sourceLimit) {
/* test the following code unit */
- UChar trail=*source;
+ char16_t trail=*source;
if(U16_IS_TRAIL(trail)) {
++source;
++nextSourceIndex;
@@ -3750,7 +3750,7 @@ getTrail:
/* length==1 */
/* this is easy because we know that there is enough space */
*target++=(uint8_t)value;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
--targetCapacity;
@@ -3814,7 +3814,7 @@ static void
ucnv_MBCSSingleFromBMPWithOffsets(UConverterFromUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
- const UChar *source, *sourceLimit, *lastSource;
+ const char16_t *source, *sourceLimit, *lastSource;
uint8_t *target;
int32_t targetCapacity, length;
int32_t *offsets;
@@ -3861,7 +3861,7 @@ ucnv_MBCSSingleFromBMPWithOffsets(UConverterFromUnicodeArgs *pArgs,
lastSource=source;
/*
- * since the conversion here is 1:1 UChar:uint8_t, we need only one counter
+ * since the conversion here is 1:1 char16_t:uint8_t, we need only one counter
* for the minimum of the sourceLength and targetCapacity
*/
length=(int32_t)(sourceLimit-source);
@@ -3908,7 +3908,7 @@ unrolled:
count=loops-count;
targetCapacity-=4*count;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
lastSource+=4*count;
while(count>0) {
*offsets++=sourceIndex++;
@@ -3926,7 +3926,7 @@ unrolled:
while(targetCapacity>0) {
/*
* Get a correct Unicode code point:
- * a single UChar for a BMP code point or
+ * a single char16_t for a BMP code point or
* a matched surrogate pair for a "supplementary code point".
*/
c=*source++;
@@ -3960,7 +3960,7 @@ unrolled:
getTrail:
if(source<sourceLimit) {
/* test the following code unit */
- UChar trail=*source;
+ char16_t trail=*source;
if(U16_IS_TRAIL(trail)) {
++source;
c=U16_GET_SUPPLEMENTARY(c, trail);
@@ -3992,7 +3992,7 @@ getTrail:
length=U16_LENGTH(c);
/* set offsets since the start or the last extension */
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
int32_t count=(int32_t)(source-lastSource);
/* do not set the offset for this character */
@@ -4042,7 +4042,7 @@ getTrail:
}
/* set offsets since the start or the last callback */
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
size_t count=source-lastSource;
if (count > 0 && *pErrorCode == U_TRUNCATED_CHAR_FOUND) {
/*
@@ -4071,7 +4071,7 @@ U_CFUNC void
ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
- const UChar *source, *sourceLimit;
+ const char16_t *source, *sourceLimit;
uint8_t *target;
int32_t targetCapacity;
int32_t *offsets;
@@ -4135,7 +4135,7 @@ ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
if(cnv->sharedData->mbcs.utf8Friendly) {
mbcsIndex=cnv->sharedData->mbcs.mbcsIndex;
} else {
- mbcsIndex=NULL;
+ mbcsIndex=nullptr;
}
if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
bytes=cnv->sharedData->mbcs.swapLFNLFromUnicodeBytes;
@@ -4197,14 +4197,14 @@ ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
if(targetCapacity>0) {
/*
* Get a correct Unicode code point:
- * a single UChar for a BMP code point or
+ * a single char16_t for a BMP code point or
* a matched surrogate pair for a "supplementary code point".
*/
c=*source++;
++nextSourceIndex;
if(c<=0x7f && IS_ASCII_ROUNDTRIP(c, asciiRoundtrips)) {
*target++=(uint8_t)c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
prevSourceIndex=sourceIndex;
sourceIndex=nextSourceIndex;
@@ -4218,7 +4218,7 @@ ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
* to avoid dealing with surrogates.
* MBCS_FAST_MAX must be >=0xd7ff.
*/
- if(c<=0xd7ff && mbcsIndex!=NULL) {
+ if(c<=0xd7ff && mbcsIndex!=nullptr) {
value=mbcsIndex[c>>6];
/* get the bytes and the length for the output (copied from below and adapted for utf8Friendly data) */
@@ -4390,7 +4390,7 @@ ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
getTrail:
if(source<sourceLimit) {
/* test the following code unit */
- UChar trail=*source;
+ char16_t trail=*source;
if(U16_IS_TRAIL(trail)) {
++source;
++nextSourceIndex;
@@ -4628,7 +4628,7 @@ unassigned:
targetCapacity=(int32_t)(pArgs->targetLimit-(char *)target);
/* normal end of conversion: prepare for a new character */
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
prevSourceIndex=sourceIndex;
sourceIndex=nextSourceIndex;
}
@@ -4640,7 +4640,7 @@ unassigned:
/* write the output character bytes from value and length */
/* from the first if in the loop we know that targetCapacity>0 */
if(length<=targetCapacity) {
- if(offsets==NULL) {
+ if(offsets==nullptr) {
switch(length) {
/* each branch falls through to the next one */
case 4:
@@ -4719,19 +4719,19 @@ unassigned:
/* each branch falls through to the next one */
case 3:
*target++=(uint8_t)(value>>16);
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
U_FALLTHROUGH;
case 2:
*target++=(uint8_t)(value>>8);
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
U_FALLTHROUGH;
case 1:
*target++=(uint8_t)value;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
U_FALLTHROUGH;
@@ -4749,7 +4749,7 @@ unassigned:
/* normal end of conversion: prepare for a new character */
c=0;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
prevSourceIndex=sourceIndex;
sourceIndex=nextSourceIndex;
}
@@ -4787,7 +4787,7 @@ unassigned:
*target++=(uint8_t)siBytes[1];
}
}
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
/* set the last source character's index (sourceIndex points at sourceLimit now) */
*offsets++=prevSourceIndex;
}
@@ -4961,7 +4961,7 @@ ucnv_MBCSFromUChar32(UConverterSharedData *sharedData,
}
cx=sharedData->mbcs.extIndexes;
- if(cx!=NULL) {
+ if(cx!=nullptr) {
length=ucnv_extSimpleMatchFromU(cx, c, pValue, useFallback);
return length>=0 ? length : -length; /* return abs(length); */
}
@@ -5257,12 +5257,12 @@ moreBytes:
* If we have a partial match on c, we will return and revert
* to UTF-8->UTF-16->charset conversion.
*/
- static const UChar nul=0;
- const UChar *noSource=&nul;
+ static const char16_t nul=0;
+ const char16_t *noSource=&nul;
c=_extFromU(cnv, cnv->sharedData,
c, &noSource, noSource,
&target, target+targetCapacity,
- NULL, -1,
+ nullptr, -1,
pFromUArgs->flush,
pErrorCode);
@@ -5560,12 +5560,12 @@ unassigned:
* If we have a partial match on c, we will return and revert
* to UTF-8->UTF-16->charset conversion.
*/
- static const UChar nul=0;
- const UChar *noSource=&nul;
+ static const char16_t nul=0;
+ const char16_t *noSource=&nul;
c=_extFromU(cnv, cnv->sharedData,
c, &noSource, noSource,
&target, target+targetCapacity,
- NULL, -1,
+ nullptr, -1,
pFromUArgs->flush,
pErrorCode);
@@ -5658,7 +5658,7 @@ ucnv_MBCSWriteSub(UConverterFromUnicodeArgs *pArgs,
/* first, select between subChar and subChar1 */
if( cnv->subChar1!=0 &&
- (cnv->sharedData->mbcs.extIndexes!=NULL ?
+ (cnv->sharedData->mbcs.extIndexes!=nullptr ?
cnv->useSubChar1 :
(cnv->invalidUCharBuffer[0]<=0xff))
) {
diff --git a/thirdparty/icu4c/common/ucnvscsu.cpp b/thirdparty/icu4c/common/ucnvscsu.cpp
index 86e850a998..2138e289ca 100644
--- a/thirdparty/icu4c/common/ucnvscsu.cpp
+++ b/thirdparty/icu4c/common/ucnvscsu.cpp
@@ -200,8 +200,8 @@ _SCSUOpen(UConverter *cnv,
return;
}
cnv->extraInfo=uprv_malloc(sizeof(SCSUData));
- if(cnv->extraInfo!=NULL) {
- if(locale!=NULL && locale[0]=='j' && locale[1]=='a' && (locale[2]==0 || locale[2]=='_')) {
+ if(cnv->extraInfo!=nullptr) {
+ if(locale!=nullptr && locale[0]=='j' && locale[1]=='a' && (locale[2]==0 || locale[2]=='_')) {
((SCSUData *)cnv->extraInfo)->locale=l_ja;
} else {
((SCSUData *)cnv->extraInfo)->locale=lGeneric;
@@ -218,11 +218,11 @@ _SCSUOpen(UConverter *cnv,
static void U_CALLCONV
_SCSUClose(UConverter *cnv) {
- if(cnv->extraInfo!=NULL) {
+ if(cnv->extraInfo!=nullptr) {
if(!cnv->isExtraLocal) {
uprv_free(cnv->extraInfo);
}
- cnv->extraInfo=NULL;
+ cnv->extraInfo=nullptr;
}
}
@@ -234,8 +234,8 @@ _SCSUToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
UConverter *cnv;
SCSUData *scsu;
const uint8_t *source, *sourceLimit;
- UChar *target;
- const UChar *targetLimit;
+ char16_t *target;
+ const char16_t *targetLimit;
int32_t *offsets;
UBool isSingleByteMode;
uint8_t state, byteOne;
@@ -294,33 +294,33 @@ fastSingle:
++nextSourceIndex;
if(b<=0x7f) {
/* write US-ASCII graphic character or DEL */
- *target++=(UChar)b;
- if(offsets!=NULL) {
+ *target++=(char16_t)b;
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
} else {
/* write from dynamic window */
uint32_t c=scsu->toUDynamicOffsets[dynamicWindow]+(b&0x7f);
if(c<=0xffff) {
- *target++=(UChar)c;
- if(offsets!=NULL) {
+ *target++=(char16_t)c;
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
} else {
/* output surrogate pair */
- *target++=(UChar)(0xd7c0+(c>>10));
+ *target++=(char16_t)(0xd7c0+(c>>10));
if(target<targetLimit) {
- *target++=(UChar)(0xdc00|(c&0x3ff));
- if(offsets!=NULL) {
+ *target++=(char16_t)(0xdc00|(c&0x3ff));
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
*offsets++=sourceIndex;
}
} else {
/* target overflow */
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
- cnv->UCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff));
+ cnv->UCharErrorBuffer[0]=(char16_t)(0xdc00|(c&0x3ff));
cnv->UCharErrorBufferLength=1;
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
goto endloop;
@@ -347,8 +347,8 @@ singleByteMode:
/* here: b<0x20 because otherwise we would be in fastSingle */
if((1UL<<b)&0x2601 /* binary 0010 0110 0000 0001, check for b==0xd || b==0xa || b==9 || b==0 */) {
/* CR/LF/TAB/NUL */
- *target++=(UChar)b;
- if(offsets!=NULL) {
+ *target++=(char16_t)b;
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
sourceIndex=nextSourceIndex;
@@ -392,8 +392,8 @@ singleByteMode:
state=quotePairTwo;
break;
case quotePairTwo:
- *target++=(UChar)((byteOne<<8)|b);
- if(offsets!=NULL) {
+ *target++=(char16_t)((byteOne<<8)|b);
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
sourceIndex=nextSourceIndex;
@@ -402,33 +402,33 @@ singleByteMode:
case quoteOne:
if(b<0x80) {
/* all static offsets are in the BMP */
- *target++=(UChar)(staticOffsets[quoteWindow]+b);
- if(offsets!=NULL) {
+ *target++=(char16_t)(staticOffsets[quoteWindow]+b);
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
} else {
/* write from dynamic window */
uint32_t c=scsu->toUDynamicOffsets[quoteWindow]+(b&0x7f);
if(c<=0xffff) {
- *target++=(UChar)c;
- if(offsets!=NULL) {
+ *target++=(char16_t)c;
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
} else {
/* output surrogate pair */
- *target++=(UChar)(0xd7c0+(c>>10));
+ *target++=(char16_t)(0xd7c0+(c>>10));
if(target<targetLimit) {
- *target++=(UChar)(0xdc00|(c&0x3ff));
- if(offsets!=NULL) {
+ *target++=(char16_t)(0xdc00|(c&0x3ff));
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
*offsets++=sourceIndex;
}
} else {
/* target overflow */
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
- cnv->UCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff));
+ cnv->UCharErrorBuffer[0]=(char16_t)(0xdc00|(c&0x3ff));
cnv->UCharErrorBufferLength=1;
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
goto endloop;
@@ -478,8 +478,8 @@ singleByteMode:
if(state==readCommand) {
fastUnicode:
while(source+1<sourceLimit && target<targetLimit && (uint8_t)((b=*source)-UC0)>(Urs-UC0)) {
- *target++=(UChar)((b<<8)|source[1]);
- if(offsets!=NULL) {
+ *target++=(char16_t)((b<<8)|source[1]);
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
sourceIndex=nextSourceIndex;
@@ -542,8 +542,8 @@ fastUnicode:
state=quotePairTwo;
break;
case quotePairTwo:
- *target++=(UChar)((byteOne<<8)|b);
- if(offsets!=NULL) {
+ *target++=(char16_t)((byteOne<<8)|b);
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
sourceIndex=nextSourceIndex;
@@ -588,8 +588,8 @@ _SCSUToUnicode(UConverterToUnicodeArgs *pArgs,
UConverter *cnv;
SCSUData *scsu;
const uint8_t *source, *sourceLimit;
- UChar *target;
- const UChar *targetLimit;
+ char16_t *target;
+ const char16_t *targetLimit;
UBool isSingleByteMode;
uint8_t state, byteOne;
int8_t quoteWindow, dynamicWindow;
@@ -639,20 +639,20 @@ fastSingle:
++source;
if(b<=0x7f) {
/* write US-ASCII graphic character or DEL */
- *target++=(UChar)b;
+ *target++=(char16_t)b;
} else {
/* write from dynamic window */
uint32_t c=scsu->toUDynamicOffsets[dynamicWindow]+(b&0x7f);
if(c<=0xffff) {
- *target++=(UChar)c;
+ *target++=(char16_t)c;
} else {
/* output surrogate pair */
- *target++=(UChar)(0xd7c0+(c>>10));
+ *target++=(char16_t)(0xd7c0+(c>>10));
if(target<targetLimit) {
- *target++=(UChar)(0xdc00|(c&0x3ff));
+ *target++=(char16_t)(0xdc00|(c&0x3ff));
} else {
/* target overflow */
- cnv->UCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff));
+ cnv->UCharErrorBuffer[0]=(char16_t)(0xdc00|(c&0x3ff));
cnv->UCharErrorBufferLength=1;
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
goto endloop;
@@ -677,7 +677,7 @@ singleByteMode:
/* here: b<0x20 because otherwise we would be in fastSingle */
if((1UL<<b)&0x2601 /* binary 0010 0110 0000 0001, check for b==0xd || b==0xa || b==9 || b==0 */) {
/* CR/LF/TAB/NUL */
- *target++=(UChar)b;
+ *target++=(char16_t)b;
goto fastSingle;
} else if(SC0<=b) {
if(b<=SC7) {
@@ -716,26 +716,26 @@ singleByteMode:
state=quotePairTwo;
break;
case quotePairTwo:
- *target++=(UChar)((byteOne<<8)|b);
+ *target++=(char16_t)((byteOne<<8)|b);
state=readCommand;
goto fastSingle;
case quoteOne:
if(b<0x80) {
/* all static offsets are in the BMP */
- *target++=(UChar)(staticOffsets[quoteWindow]+b);
+ *target++=(char16_t)(staticOffsets[quoteWindow]+b);
} else {
/* write from dynamic window */
uint32_t c=scsu->toUDynamicOffsets[quoteWindow]+(b&0x7f);
if(c<=0xffff) {
- *target++=(UChar)c;
+ *target++=(char16_t)c;
} else {
/* output surrogate pair */
- *target++=(UChar)(0xd7c0+(c>>10));
+ *target++=(char16_t)(0xd7c0+(c>>10));
if(target<targetLimit) {
- *target++=(UChar)(0xdc00|(c&0x3ff));
+ *target++=(char16_t)(0xdc00|(c&0x3ff));
} else {
/* target overflow */
- cnv->UCharErrorBuffer[0]=(UChar)(0xdc00|(c&0x3ff));
+ cnv->UCharErrorBuffer[0]=(char16_t)(0xdc00|(c&0x3ff));
cnv->UCharErrorBufferLength=1;
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
goto endloop;
@@ -782,7 +782,7 @@ singleByteMode:
if(state==readCommand) {
fastUnicode:
while(source+1<sourceLimit && target<targetLimit && (uint8_t)((b=*source)-UC0)>(Urs-UC0)) {
- *target++=(UChar)((b<<8)|source[1]);
+ *target++=(char16_t)((b<<8)|source[1]);
source+=2;
}
}
@@ -839,7 +839,7 @@ fastUnicode:
state=quotePairTwo;
break;
case quotePairTwo:
- *target++=(UChar)((byteOne<<8)|b);
+ *target++=(char16_t)((byteOne<<8)|b);
state=readCommand;
goto fastUnicode;
}
@@ -1012,7 +1012,7 @@ _SCSUFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
SCSUData *scsu;
- const UChar *source, *sourceLimit;
+ const char16_t *source, *sourceLimit;
uint8_t *target;
int32_t targetCapacity;
int32_t *offsets;
@@ -1029,7 +1029,7 @@ _SCSUFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
/* variables for compression heuristics */
uint32_t offset;
- UChar lead, trail;
+ char16_t lead, trail;
int code;
int8_t window;
@@ -1076,7 +1076,7 @@ loop:
if((c-0x20)<=0x5f) {
/* pass US-ASCII graphic character through */
*target++=(uint8_t)c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
--targetCapacity;
@@ -1084,7 +1084,7 @@ loop:
if((1UL<<c)&0x2601 /* binary 0010 0110 0000 0001, check for b==0xd || b==0xa || b==9 || b==0 */) {
/* CR/LF/TAB/NUL */
*target++=(uint8_t)c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
--targetCapacity;
@@ -1097,14 +1097,14 @@ loop:
} else if((delta=c-currentOffset)<=0x7f) {
/* use the current dynamic window */
*target++=(uint8_t)(delta|0x80);
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
--targetCapacity;
} else if(U16_IS_SURROGATE(c)) {
if(U16_IS_SURROGATE_LEAD(c)) {
getTrailSingle:
- lead=(UChar)c;
+ lead=(char16_t)c;
if(source<sourceLimit) {
/* test the following code unit */
trail=*source;
@@ -1135,7 +1135,7 @@ getTrailSingle:
if((delta=c-currentOffset)<=0x7f) {
/* use the current dynamic window */
*target++=(uint8_t)(delta|0x80);
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
--targetCapacity;
@@ -1161,7 +1161,7 @@ getTrailSingle:
/* change to Unicode mode and output this (lead, trail) pair */
isSingleByteMode=false;
*target++=(uint8_t)SCU;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
--targetCapacity;
@@ -1255,7 +1255,7 @@ getTrailSingle:
if(targetCapacity>=2) {
*target++=(uint8_t)(c>>8);
*target++=(uint8_t)c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
*offsets++=sourceIndex;
}
@@ -1301,7 +1301,7 @@ getTrailSingle:
/* c is a surrogate */
if(U16_IS_SURROGATE_LEAD(c)) {
getTrailUnicode:
- lead=(UChar)c;
+ lead=(char16_t)c;
if(source<sourceLimit) {
/* test the following code unit */
trail=*source;
@@ -1392,7 +1392,7 @@ outputBytes:
/* write the output character bytes from c and length [code copied from ucnvmbcs.c] */
/* from the first if in the loop we know that targetCapacity>0 */
if(length<=targetCapacity) {
- if(offsets==NULL) {
+ if(offsets==nullptr) {
switch(length) {
/* each branch falls through to the next one */
case 4:
@@ -1480,19 +1480,19 @@ outputBytes:
/* each branch falls through to the next one */
case 3:
*target++=(uint8_t)(c>>16);
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
U_FALLTHROUGH;
case 2:
*target++=(uint8_t)(c>>8);
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
U_FALLTHROUGH;
case 1:
*target++=(uint8_t)c;
- if(offsets!=NULL) {
+ if(offsets!=nullptr) {
*offsets++=sourceIndex;
}
U_FALLTHROUGH;
@@ -1520,7 +1520,7 @@ _SCSUFromUnicode(UConverterFromUnicodeArgs *pArgs,
UErrorCode *pErrorCode) {
UConverter *cnv;
SCSUData *scsu;
- const UChar *source, *sourceLimit;
+ const char16_t *source, *sourceLimit;
uint8_t *target;
int32_t targetCapacity;
@@ -1534,7 +1534,7 @@ _SCSUFromUnicode(UConverterFromUnicodeArgs *pArgs,
/* variables for compression heuristics */
uint32_t offset;
- UChar lead, trail;
+ char16_t lead, trail;
int code;
int8_t window;
@@ -1594,7 +1594,7 @@ loop:
} else if(U16_IS_SURROGATE(c)) {
if(U16_IS_SURROGATE_LEAD(c)) {
getTrailSingle:
- lead=(UChar)c;
+ lead=(char16_t)c;
if(source<sourceLimit) {
/* test the following code unit */
trail=*source;
@@ -1778,7 +1778,7 @@ getTrailSingle:
/* c is a surrogate */
if(U16_IS_SURROGATE_LEAD(c)) {
getTrailUnicode:
- lead=(UChar)c;
+ lead=(char16_t)c;
if(source<sourceLimit) {
/* test the following code unit */
trail=*source;
@@ -1923,7 +1923,7 @@ outputBytes:
cnv->charErrorBufferLength=(int8_t)length;
/* now output what fits into the regular target */
- c>>=8*length; /* length was reduced by targetCapacity */
+ c = (length == 4) ? 0 : c >> 8*length; /* length was reduced by targetCapacity */
switch(targetCapacity) {
/* each branch falls through to the next one */
case 3:
@@ -2000,8 +2000,8 @@ U_CDECL_END
static const UConverterImpl _SCSUImpl={
UCNV_SCSU,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
_SCSUOpen,
_SCSUClose,
@@ -2011,15 +2011,15 @@ static const UConverterImpl _SCSUImpl={
_SCSUToUnicodeWithOffsets,
_SCSUFromUnicode,
_SCSUFromUnicodeWithOffsets,
- NULL,
+ nullptr,
- NULL,
+ nullptr,
_SCSUGetName,
- NULL,
+ nullptr,
_SCSUSafeClone,
ucnv_getCompleteUnicodeSet,
- NULL,
- NULL
+ nullptr,
+ nullptr
};
static const UConverterStaticData _SCSUStaticData={
@@ -2027,7 +2027,7 @@ static const UConverterStaticData _SCSUStaticData={
"SCSU",
1212, /* CCSID for SCSU */
UCNV_IBM, UCNV_SCSU,
- 1, 3, /* one UChar generates at least 1 byte and at most 3 bytes */
+ 1, 3, /* one char16_t generates at least 1 byte and at most 3 bytes */
/*
* The subchar here is ignored because _SCSUOpen() sets U+fffd as a Unicode
* substitution string.
diff --git a/thirdparty/icu4c/common/ucnvsel.cpp b/thirdparty/icu4c/common/ucnvsel.cpp
index 15ee596a23..a286646395 100644
--- a/thirdparty/icu4c/common/ucnvsel.cpp
+++ b/thirdparty/icu4c/common/ucnvsel.cpp
@@ -104,7 +104,7 @@ static void generateSelectorData(UConverterSelector* result,
UChar32 start_char;
UChar32 end_char;
UErrorCode smallStatus = U_ZERO_ERROR;
- uset_getItem(unicode_point_set, j, &start_char, &end_char, NULL, 0,
+ uset_getItem(unicode_point_set, j, &start_char, &end_char, nullptr, 0,
&smallStatus);
if (U_FAILURE(smallStatus)) {
// this will be reached for the converters that fill the set with
@@ -128,7 +128,7 @@ static void generateSelectorData(UConverterSelector* result,
UChar32 start_char;
UChar32 end_char;
- uset_getItem(excludedCodePoints, j, &start_char, &end_char, NULL, 0,
+ uset_getItem(excludedCodePoints, j, &start_char, &end_char, nullptr, 0,
status);
for (int32_t col = 0; col < columns; col++) {
upvec_setValue(upvec, start_char, end_char, col, static_cast<uint32_t>(~0), static_cast<uint32_t>(~0),
@@ -140,25 +140,25 @@ static void generateSelectorData(UConverterSelector* result,
// alright. Now, let's put things in the same exact form you'd get when you
// unserialize things.
result->trie = upvec_compactToUTrie2WithRowIndexes(upvec, status);
- result->pv = upvec_cloneArray(upvec, &result->pvCount, NULL, status);
+ result->pv = upvec_cloneArray(upvec, &result->pvCount, nullptr, status);
result->pvCount *= columns; // number of uint32_t = rows * columns
result->ownPv = true;
}
/* open a selector. If converterListSize is 0, build for all converters.
- If excludedCodePoints is NULL, don't exclude any codepoints */
+ If excludedCodePoints is nullptr, don't exclude any codepoints */
U_CAPI UConverterSelector* U_EXPORT2
ucnvsel_open(const char* const* converterList, int32_t converterListSize,
const USet* excludedCodePoints,
const UConverterUnicodeSet whichSet, UErrorCode* status) {
// check if already failed
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
// ensure args make sense!
- if (converterListSize < 0 || (converterList == NULL && converterListSize != 0)) {
+ if (converterListSize < 0 || (converterList == nullptr && converterListSize != 0)) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
// allocate a new converter
@@ -166,28 +166,28 @@ ucnvsel_open(const char* const* converterList, int32_t converterListSize,
(UConverterSelector*)uprv_malloc(sizeof(UConverterSelector)));
if (newSelector.isNull()) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
uprv_memset(newSelector.getAlias(), 0, sizeof(UConverterSelector));
if (converterListSize == 0) {
- converterList = NULL;
+ converterList = nullptr;
converterListSize = ucnv_countAvailable();
}
newSelector->encodings =
(char**)uprv_malloc(converterListSize * sizeof(char*));
if (!newSelector->encodings) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
- newSelector->encodings[0] = NULL; // now we can call ucnvsel_close()
+ newSelector->encodings[0] = nullptr; // now we can call ucnvsel_close()
// make a backup copy of the list of converters
int32_t totalSize = 0;
int32_t i;
for (i = 0; i < converterListSize; i++) {
totalSize +=
- (int32_t)uprv_strlen(converterList != NULL ? converterList[i] : ucnv_getAvailableName(i)) + 1;
+ (int32_t)uprv_strlen(converterList != nullptr ? converterList[i] : ucnv_getAvailableName(i)) + 1;
}
// 4-align the totalSize to 4-align the size of the serialized form
int32_t encodingStrPadding = totalSize & 3;
@@ -198,13 +198,13 @@ ucnvsel_open(const char* const* converterList, int32_t converterListSize,
char* allStrings = (char*) uprv_malloc(totalSize);
if (!allStrings) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
for (i = 0; i < converterListSize; i++) {
newSelector->encodings[i] = allStrings;
uprv_strcpy(newSelector->encodings[i],
- converterList != NULL ? converterList[i] : ucnv_getAvailableName(i));
+ converterList != nullptr ? converterList[i] : ucnv_getAvailableName(i));
allStrings += uprv_strlen(newSelector->encodings[i]) + 1;
}
while (encodingStrPadding > 0) {
@@ -219,7 +219,7 @@ ucnvsel_open(const char* const* converterList, int32_t converterListSize,
upvec_close(upvec);
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
return newSelector.orphan();
@@ -289,13 +289,13 @@ ucnvsel_serialize(const UConverterSelector* sel,
// ensure args make sense!
uint8_t *p = (uint8_t *)buffer;
if (bufferCapacity < 0 ||
- (bufferCapacity > 0 && (p == NULL || (U_POINTER_MASK_LSB(p, 3) != 0)))
+ (bufferCapacity > 0 && (p == nullptr || (U_POINTER_MASK_LSB(p, 3) != 0)))
) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
// add up the size of the serialized form
- int32_t serializedTrieSize = utrie2_serialize(sel->trie, NULL, 0, status);
+ int32_t serializedTrieSize = utrie2_serialize(sel->trie, nullptr, 0, status);
if (*status != U_BUFFER_OVERFLOW_ERROR && U_FAILURE(*status)) {
return 0;
}
@@ -466,21 +466,21 @@ U_CAPI UConverterSelector* U_EXPORT2
ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* status) {
// check if already failed
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
// ensure args make sense!
const uint8_t *p = (const uint8_t *)buffer;
if (length <= 0 ||
- (length > 0 && (p == NULL || (U_POINTER_MASK_LSB(p, 3) != 0)))
+ (length > 0 && (p == nullptr || (U_POINTER_MASK_LSB(p, 3) != 0)))
) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
// header
if (length < 32) {
// not even enough space for a minimal header
*status = U_INDEX_OUTOFBOUNDS_ERROR;
- return NULL;
+ return nullptr;
}
const DataHeader *pHeader = (const DataHeader *)p;
if (!(
@@ -493,40 +493,40 @@ ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* statu
)) {
/* header not valid or dataFormat not recognized */
*status = U_INVALID_FORMAT_ERROR;
- return NULL;
+ return nullptr;
}
if (pHeader->info.formatVersion[0] != 1) {
*status = U_UNSUPPORTED_ERROR;
- return NULL;
+ return nullptr;
}
- uint8_t* swapped = NULL;
+ uint8_t* swapped = nullptr;
if (pHeader->info.isBigEndian != U_IS_BIG_ENDIAN ||
pHeader->info.charsetFamily != U_CHARSET_FAMILY
) {
// swap the data
UDataSwapper *ds =
udata_openSwapperForInputData(p, length, U_IS_BIG_ENDIAN, U_CHARSET_FAMILY, status);
- int32_t totalSize = ucnvsel_swap(ds, p, -1, NULL, status);
+ int32_t totalSize = ucnvsel_swap(ds, p, -1, nullptr, status);
if (U_FAILURE(*status)) {
udata_closeSwapper(ds);
- return NULL;
+ return nullptr;
}
if (length < totalSize) {
udata_closeSwapper(ds);
*status = U_INDEX_OUTOFBOUNDS_ERROR;
- return NULL;
+ return nullptr;
}
swapped = (uint8_t*)uprv_malloc(totalSize);
- if (swapped == NULL) {
+ if (swapped == nullptr) {
udata_closeSwapper(ds);
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
ucnvsel_swap(ds, p, length, swapped, status);
udata_closeSwapper(ds);
if (U_FAILURE(*status)) {
uprv_free(swapped);
- return NULL;
+ return nullptr;
}
p = swapped;
pHeader = (const DataHeader *)p;
@@ -535,7 +535,7 @@ ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* statu
// not even enough space for the header and the indexes
uprv_free(swapped);
*status = U_INDEX_OUTOFBOUNDS_ERROR;
- return NULL;
+ return nullptr;
}
p += pHeader->dataHeader.headerSize;
length -= pHeader->dataHeader.headerSize;
@@ -544,7 +544,7 @@ ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* statu
if (length < indexes[UCNVSEL_INDEX_SIZE]) {
uprv_free(swapped);
*status = U_INDEX_OUTOFBOUNDS_ERROR;
- return NULL;
+ return nullptr;
}
p += UCNVSEL_INDEX_COUNT * 4;
// create and populate the selector object
@@ -552,12 +552,12 @@ ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* statu
char **encodings =
(char **)uprv_malloc(
indexes[UCNVSEL_INDEX_NAMES_COUNT] * sizeof(char *));
- if (sel == NULL || encodings == NULL) {
+ if (sel == nullptr || encodings == nullptr) {
uprv_free(swapped);
uprv_free(sel);
uprv_free(encodings);
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
uprv_memset(sel, 0, sizeof(UConverterSelector));
sel->pvCount = indexes[UCNVSEL_INDEX_PV_COUNT];
@@ -567,12 +567,12 @@ ucnvsel_openFromSerialized(const void* buffer, int32_t length, UErrorCode* statu
sel->swapped = swapped;
// trie
sel->trie = utrie2_openFromSerialized(UTRIE2_16_VALUE_BITS,
- p, indexes[UCNVSEL_INDEX_TRIE_SIZE], NULL,
+ p, indexes[UCNVSEL_INDEX_TRIE_SIZE], nullptr,
status);
p += indexes[UCNVSEL_INDEX_TRIE_SIZE];
if (U_FAILURE(*status)) {
ucnvsel_close(sel);
- return NULL;
+ return nullptr;
}
// bit vectors
sel->pv = (uint32_t *)p;
@@ -622,14 +622,14 @@ static const char* U_CALLCONV ucnvsel_next_encoding(UEnumeration* enumerator,
UErrorCode* status) {
// check if already failed
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
int16_t cur = ((Enumerator*)(enumerator->context))->cur;
const UConverterSelector* sel;
const char* result;
if (cur >= ((Enumerator*)(enumerator->context))->length) {
- return NULL;
+ return nullptr;
}
sel = ((Enumerator*)(enumerator->context))->sel;
result = sel->encodings[((Enumerator*)(enumerator->context))->index[cur] ];
@@ -653,8 +653,8 @@ U_CDECL_END
static const UEnumeration defaultEncodings = {
- NULL,
- NULL,
+ nullptr,
+ nullptr,
ucnvsel_close_selector_iterator,
ucnvsel_count_encodings,
uenum_unextDefault,
@@ -732,7 +732,7 @@ static UEnumeration *selectForMask(const UConverterSelector* sel,
v >>= 1;
}
}
- } //otherwise, index will remain NULL (and will never be touched by
+ } //otherwise, index will remain nullptr (and will never be touched by
//the enumerator code anyway)
en->context = result.orphan();
return en.orphan();
@@ -741,34 +741,34 @@ static UEnumeration *selectForMask(const UConverterSelector* sel,
/* check a string against the selector - UTF16 version */
U_CAPI UEnumeration * U_EXPORT2
ucnvsel_selectForString(const UConverterSelector* sel,
- const UChar *s, int32_t length, UErrorCode *status) {
+ const char16_t *s, int32_t length, UErrorCode *status) {
// check if already failed
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
// ensure args make sense!
- if (sel == NULL || (s == NULL && length != 0)) {
+ if (sel == nullptr || (s == nullptr && length != 0)) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
int32_t columns = (sel->encodingsCount+31)/32;
uint32_t* mask = (uint32_t*) uprv_malloc(columns * 4);
- if (mask == NULL) {
+ if (mask == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
uprv_memset(mask, ~0, columns *4);
- if(s!=NULL) {
- const UChar *limit;
+ if(s!=nullptr) {
+ const char16_t *limit;
if (length >= 0) {
limit = s + length;
} else {
- limit = NULL;
+ limit = nullptr;
}
- while (limit == NULL ? *s != 0 : s != limit) {
+ while (limit == nullptr ? *s != 0 : s != limit) {
UChar32 c;
uint16_t pvIndex;
UTRIE2_U16_NEXT16(sel->trie, s, limit, c, pvIndex);
@@ -786,19 +786,19 @@ ucnvsel_selectForUTF8(const UConverterSelector* sel,
const char *s, int32_t length, UErrorCode *status) {
// check if already failed
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
// ensure args make sense!
- if (sel == NULL || (s == NULL && length != 0)) {
+ if (sel == nullptr || (s == nullptr && length != 0)) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
int32_t columns = (sel->encodingsCount+31)/32;
uint32_t* mask = (uint32_t*) uprv_malloc(columns * 4);
- if (mask == NULL) {
+ if (mask == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
uprv_memset(mask, ~0, columns *4);
@@ -806,7 +806,7 @@ ucnvsel_selectForUTF8(const UConverterSelector* sel,
length = (int32_t)uprv_strlen(s);
}
- if(s!=NULL) {
+ if(s!=nullptr) {
const char *limit = s + length;
while (s != limit) {
diff --git a/thirdparty/icu4c/common/ucol_data.h b/thirdparty/icu4c/common/ucol_data.h
index 83f54abba1..28cf94ffc8 100644
--- a/thirdparty/icu4c/common/ucol_data.h
+++ b/thirdparty/icu4c/common/ucol_data.h
@@ -43,7 +43,7 @@ typedef struct {
uint32_t magic; /* magic number - lets us know whether reserved data is reset or junked */
uint32_t mappingPosition; /* const uint8_t *mappingPosition; */
uint32_t expansion; /* uint32_t *expansion; */
- uint32_t contractionIndex; /* UChar *contractionIndex; */
+ uint32_t contractionIndex; /* char16_t *contractionIndex; */
uint32_t contractionCEs; /* uint32_t *contractionCEs; */
uint32_t contractionSize; /* needed for various closures */
/*int32_t latinOneMapping;*/ /* this is now handled in the trie itself *//* fast track to latin1 chars */
@@ -60,7 +60,7 @@ typedef struct {
/* in contractions. */
int32_t contractionUCACombosSize; /* number of UCA contraction items. */
- /*Length is contractionUCACombosSize*contractionUCACombosWidth*sizeof(UChar) */
+ /*Length is contractionUCACombosSize*contractionUCACombosWidth*sizeof(char16_t) */
UBool jamoSpecial; /* is jamoSpecial */
UBool isBigEndian; /* is this data big endian? from the UDataInfo header*/
uint8_t charSetFamily; /* what is the charset family of this data from the UDataInfo header*/
diff --git a/thirdparty/icu4c/common/ucol_swp.cpp b/thirdparty/icu4c/common/ucol_swp.cpp
index 59704ff8f6..b5894a1fef 100644
--- a/thirdparty/icu4c/common/ucol_swp.cpp
+++ b/thirdparty/icu4c/common/ucol_swp.cpp
@@ -33,13 +33,13 @@
U_CAPI UBool U_EXPORT2
ucol_looksLikeCollationBinary(const UDataSwapper *ds,
const void *inData, int32_t length) {
- if(ds==NULL || inData==NULL || length<-1) {
+ if(ds==nullptr || inData==nullptr || length<-1) {
return false;
}
// First check for format version 4+ which has a standard data header.
UErrorCode errorCode=U_ZERO_ERROR;
- (void)udata_swapDataHeader(ds, inData, -1, NULL, &errorCode);
+ (void)udata_swapDataHeader(ds, inData, -1, nullptr, &errorCode);
if(U_SUCCESS(errorCode)) {
const UDataInfo &info=*(const UDataInfo *)((const char *)inData+4);
if(info.dataFormat[0]==0x55 && // dataFormat="UCol"
@@ -103,7 +103,7 @@ swapFormatVersion3(const UDataSwapper *ds,
if(U_FAILURE(*pErrorCode)) {
return 0;
}
- if(ds==NULL || inData==NULL || length<-1 || (length>0 && outData==NULL)) {
+ if(ds==nullptr || inData==nullptr || length<-1 || (length>0 && outData==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -204,7 +204,7 @@ swapFormatVersion3(const UDataSwapper *ds,
/* swap the contractions */
if(header.contractionSize!=0) {
- /* contractionIndex: UChar[] */
+ /* contractionIndex: char16_t[] */
ds->swapArray16(ds, inBytes+header.contractionIndex, header.contractionSize*2,
outBytes+header.contractionIndex, pErrorCode);
@@ -336,7 +336,7 @@ swapFormatVersion4(const UDataSwapper *ds,
for(int32_t i=indexesLength; i<=IX_TOTAL_SIZE; ++i) {
indexes[i]=-1;
}
- inIndexes=NULL; // Make sure we do not accidentally use these instead of indexes[].
+ inIndexes=nullptr; // Make sure we do not accidentally use these instead of indexes[].
// Get the total length of the data.
int32_t size;
@@ -506,7 +506,7 @@ ucol_swap(const UDataSwapper *ds,
inData=(const char *)inData+headerSize;
if(length>=0) { length-=headerSize; }
- outData=(char *)outData+headerSize;
+ outData=(outData == nullptr) ? nullptr : (char *)outData+headerSize;
int32_t collationSize;
if(info.formatVersion[0]>=4) {
collationSize=swapFormatVersion4(ds, inData, length, outData, *pErrorCode);
@@ -537,7 +537,7 @@ ucol_swapInverseUCA(const UDataSwapper *ds,
/* udata_swapDataHeader checks the arguments */
headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
diff --git a/thirdparty/icu4c/common/ucurr.cpp b/thirdparty/icu4c/common/ucurr.cpp
index 928d049fb5..ffca8aac5f 100644
--- a/thirdparty/icu4c/common/ucurr.cpp
+++ b/thirdparty/icu4c/common/ucurr.cpp
@@ -49,7 +49,7 @@ using namespace icu;
#endif
typedef struct IsoCodeEntry {
- const UChar *isoCode; /* const because it's a reference to a resource bundle string. */
+ const char16_t *isoCode; /* const because it's a reference to a resource bundle string. */
UDate from;
UDate to;
} IsoCodeEntry;
@@ -96,11 +96,11 @@ static const char CURRENCIES_VARIANT[] = "Currencies%variant";
static const char CURRENCYPLURALS[] = "CurrencyPlurals";
// ISO codes mapping table
-static const UHashtable* gIsoCodes = NULL;
+static const UHashtable* gIsoCodes = nullptr;
static icu::UInitOnce gIsoCodesInitOnce {};
// Currency symbol equivalances
-static const icu::Hashtable* gCurrSymbolsEquiv = NULL;
+static const icu::Hashtable* gCurrSymbolsEquiv = nullptr;
static icu::UInitOnce gCurrSymbolsEquivInitOnce {};
U_NAMESPACE_BEGIN
@@ -117,8 +117,8 @@ public:
}
inline ~EquivIterator() { }
- // next returns the next equivalent string or NULL if there are no more.
- // If s has no equivalent strings, next returns NULL on the first call.
+ // next returns the next equivalent string or nullptr if there are no more.
+ // If s has no equivalent strings, next returns nullptr on the first call.
const icu::UnicodeString *next();
private:
const icu::Hashtable& _hash;
@@ -129,12 +129,12 @@ private:
const icu::UnicodeString *
EquivIterator::next() {
const icu::UnicodeString* _next = (const icu::UnicodeString*) _hash.get(*_current);
- if (_next == NULL) {
+ if (_next == nullptr) {
U_ASSERT(_current == _start);
- return NULL;
+ return nullptr;
}
if (*_next == *_start) {
- return NULL;
+ return nullptr;
}
_current = _next;
return _next;
@@ -161,7 +161,7 @@ static void makeEquivalent(
const icu::UnicodeString *firstRight = rightIter.next();
const icu::UnicodeString *nextLeft = firstLeft;
const icu::UnicodeString *nextRight = firstRight;
- while (nextLeft != NULL && nextRight != NULL) {
+ while (nextLeft != nullptr && nextRight != nullptr) {
if (*nextLeft == rhs || *nextRight == lhs) {
// Already equivalent
return;
@@ -172,17 +172,17 @@ static void makeEquivalent(
// Not equivalent. Must join.
icu::UnicodeString *newFirstLeft;
icu::UnicodeString *newFirstRight;
- if (firstRight == NULL && firstLeft == NULL) {
+ if (firstRight == nullptr && firstLeft == nullptr) {
// Neither lhs or rhs belong to an equivalence circle, so we form
// a new equivalnce circle of just lhs and rhs.
newFirstLeft = new icu::UnicodeString(rhs);
newFirstRight = new icu::UnicodeString(lhs);
- } else if (firstRight == NULL) {
+ } else if (firstRight == nullptr) {
// lhs belongs to an equivalence circle, but rhs does not, so we link
// rhs into lhs' circle.
newFirstLeft = new icu::UnicodeString(rhs);
newFirstRight = new icu::UnicodeString(*firstLeft);
- } else if (firstLeft == NULL) {
+ } else if (firstLeft == nullptr) {
// rhs belongs to an equivlance circle, but lhs does not, so we link
// lhs into rhs' circle.
newFirstLeft = new icu::UnicodeString(*firstRight);
@@ -193,7 +193,7 @@ static void makeEquivalent(
newFirstLeft = new icu::UnicodeString(*firstRight);
newFirstRight = new icu::UnicodeString(*firstLeft);
}
- if (newFirstLeft == NULL || newFirstRight == NULL) {
+ if (newFirstLeft == nullptr || newFirstRight == nullptr) {
delete newFirstLeft;
delete newFirstRight;
status = U_MEMORY_ALLOCATION_ERROR;
@@ -209,7 +209,7 @@ static void makeEquivalent(
static int32_t countEquivalent(const icu::Hashtable &hash, const icu::UnicodeString &s) {
int32_t result = 0;
icu::EquivIterator iter(hash, s);
- while (iter.next() != NULL) {
+ while (iter.next() != nullptr) {
++result;
}
#ifdef UCURR_DEBUG_EQUIV
@@ -231,11 +231,11 @@ static const icu::Hashtable* getCurrSymbolsEquiv();
* Cleanup callback func
*/
static UBool U_CALLCONV
-isoCodes_cleanup(void)
+isoCodes_cleanup()
{
- if (gIsoCodes != NULL) {
+ if (gIsoCodes != nullptr) {
uhash_close(const_cast<UHashtable *>(gIsoCodes));
- gIsoCodes = NULL;
+ gIsoCodes = nullptr;
}
gIsoCodesInitOnce.reset();
return true;
@@ -245,10 +245,10 @@ isoCodes_cleanup(void)
* Cleanup callback func
*/
static UBool U_CALLCONV
-currSymbolsEquiv_cleanup(void)
+currSymbolsEquiv_cleanup()
{
delete const_cast<icu::Hashtable *>(gCurrSymbolsEquiv);
- gCurrSymbolsEquiv = NULL;
+ gCurrSymbolsEquiv = nullptr;
gCurrSymbolsEquivInitOnce.reset();
return true;
}
@@ -272,11 +272,11 @@ deleteUnicode(void *obj) {
}
/**
- * Unfortunately, we have to convert the UChar* currency code to char*
+ * Unfortunately, we have to convert the char16_t* currency code to char*
* to use it as a resource key.
*/
static inline char*
-myUCharsToChars(char* resultOfLen4, const UChar* currency) {
+myUCharsToChars(char* resultOfLen4, const char16_t* currency) {
u_UCharsToChars(currency, resultOfLen4, ISO_CURRENCY_CODE_LENGTH);
resultOfLen4[ISO_CURRENCY_CODE_LENGTH] = 0;
return resultOfLen4;
@@ -291,7 +291,7 @@ myUCharsToChars(char* resultOfLen4, const UChar* currency) {
* and cashRounding ).
*/
static const int32_t*
-_findMetaData(const UChar* currency, UErrorCode& ec) {
+_findMetaData(const char16_t* currency, UErrorCode& ec) {
if (currency == 0 || *currency == 0) {
if (U_SUCCESS(ec)) {
@@ -315,10 +315,10 @@ _findMetaData(const UChar* currency, UErrorCode& ec) {
// Look up our currency, or if that's not available, then DEFAULT
char buf[ISO_CURRENCY_CODE_LENGTH+1];
UErrorCode ec2 = U_ZERO_ERROR; // local error code: soft failure
- UResourceBundle* rb = ures_getByKey(currencyMeta, myUCharsToChars(buf, currency), NULL, &ec2);
+ UResourceBundle* rb = ures_getByKey(currencyMeta, myUCharsToChars(buf, currency), nullptr, &ec2);
if (U_FAILURE(ec2)) {
ures_close(rb);
- rb = ures_getByKey(currencyMeta,DEFAULT_META, NULL, &ec);
+ rb = ures_getByKey(currencyMeta,DEFAULT_META, nullptr, &ec);
if (U_FAILURE(ec)) {
ures_close(currencyMeta);
ures_close(rb);
@@ -361,7 +361,7 @@ idForLocale(const char* locale, char* countryAndVariant, int capacity, UErrorCod
// don't use ICUService since we don't need fallback
U_CDECL_BEGIN
-static UBool U_CALLCONV currency_cleanup(void);
+static UBool U_CALLCONV currency_cleanup();
U_CDECL_END
#if !UCONFIG_NO_SERVICE
@@ -372,10 +372,10 @@ static CReg* gCRegHead = 0;
struct CReg : public icu::UMemory {
CReg *next;
- UChar iso[ISO_CURRENCY_CODE_LENGTH+1];
+ char16_t iso[ISO_CURRENCY_CODE_LENGTH+1];
char id[ULOC_FULLNAME_CAPACITY];
- CReg(const UChar* _iso, const char* _id)
+ CReg(const char16_t* _iso, const char* _id)
: next(0)
{
int32_t len = (int32_t)uprv_strlen(_id);
@@ -388,7 +388,7 @@ struct CReg : public icu::UMemory {
iso[ISO_CURRENCY_CODE_LENGTH] = 0;
}
- static UCurrRegistryKey reg(const UChar* _iso, const char* _id, UErrorCode* status)
+ static UCurrRegistryKey reg(const char16_t* _iso, const char* _id, UErrorCode* status)
{
if (status && U_SUCCESS(*status) && _iso && _id) {
CReg* n = new CReg(_iso, _id);
@@ -427,8 +427,8 @@ struct CReg : public icu::UMemory {
return found;
}
- static const UChar* get(const char* id) {
- const UChar* result = NULL;
+ static const char16_t* get(const char* id) {
+ const char16_t* result = nullptr;
umtx_lock(&gCRegLock);
CReg* p = gCRegHead;
@@ -446,7 +446,7 @@ struct CReg : public icu::UMemory {
}
/* This doesn't need to be thread safe. It's for u_cleanup only. */
- static void cleanup(void) {
+ static void cleanup() {
while (gCRegHead) {
CReg* n = gCRegHead;
gCRegHead = gCRegHead->next;
@@ -458,14 +458,14 @@ struct CReg : public icu::UMemory {
// -------------------------------------
U_CAPI UCurrRegistryKey U_EXPORT2
-ucurr_register(const UChar* isoCode, const char* locale, UErrorCode *status)
+ucurr_register(const char16_t* isoCode, const char* locale, UErrorCode *status)
{
if (status && U_SUCCESS(*status)) {
char id[ULOC_FULLNAME_CAPACITY];
idForLocale(locale, id, sizeof(id), status);
return CReg::reg(isoCode, id, status);
}
- return NULL;
+ return nullptr;
}
// -------------------------------------
@@ -485,14 +485,14 @@ ucurr_unregister(UCurrRegistryKey key, UErrorCode* status)
/**
* Release all static memory held by currency.
*/
-/*The declaration here is needed so currency_cleanup(void)
+/*The declaration here is needed so currency_cleanup()
* can call this function.
*/
static UBool U_CALLCONV
-currency_cache_cleanup(void);
+currency_cache_cleanup();
U_CDECL_BEGIN
-static UBool U_CALLCONV currency_cleanup(void) {
+static UBool U_CALLCONV currency_cleanup() {
#if !UCONFIG_NO_SERVICE
CReg::cleanup();
#endif
@@ -511,7 +511,7 @@ U_CDECL_END
U_CAPI int32_t U_EXPORT2
ucurr_forLocale(const char* locale,
- UChar* buff,
+ char16_t* buff,
int32_t buffCapacity,
UErrorCode* ec) {
if (U_FAILURE(*ec)) { return 0; }
@@ -540,7 +540,7 @@ ucurr_forLocale(const char* locale,
}
#if !UCONFIG_NO_SERVICE
- const UChar* result = CReg::get(id);
+ const char16_t* result = CReg::get(id);
if (result) {
if(buffCapacity > u_strlen(result)) {
u_strcpy(buff, result);
@@ -555,7 +555,7 @@ ucurr_forLocale(const char* locale,
idDelim[0] = 0;
}
- const UChar* s = NULL; // Currency code from data file.
+ const char16_t* s = nullptr; // Currency code from data file.
if (id[0] == 0) {
// No point looking in the data for an empty string.
// This is what we would get.
@@ -575,7 +575,7 @@ ucurr_forLocale(const char* locale,
ures_getByIndex(countryArray, i, nullptr, &localStatus));
// The currency is legal tender if it is *not* marked with tender{"false"}.
UErrorCode tenderStatus = localStatus;
- const UChar *tender =
+ const char16_t *tender =
ures_getStringByKey(currencyReq.getAlias(), "tender", nullptr, &tenderStatus);
bool isTender = U_FAILURE(tenderStatus) || u_strcmp(tender, u"false") != 0;
if (!isTender && s != nullptr) {
@@ -641,7 +641,7 @@ static UBool fallback(char *loc) {
}
/*
char *i = uprv_strrchr(loc, '_');
- if (i == NULL) {
+ if (i == nullptr) {
i = loc;
}
*i = 0;
@@ -650,8 +650,8 @@ static UBool fallback(char *loc) {
}
-U_CAPI const UChar* U_EXPORT2
-ucurr_getName(const UChar* currency,
+U_CAPI const char16_t* U_EXPORT2
+ucurr_getName(const char16_t* currency,
const char* locale,
UCurrNameStyle nameStyle,
UBool* isChoiceFormat, // fillin
@@ -705,7 +705,7 @@ ucurr_getName(const UChar* currency,
/* Normalize the keyword value to uppercase */
T_CString_toUpperCase(buf);
- const UChar* s = NULL;
+ const char16_t* s = nullptr;
ec2 = U_ZERO_ERROR;
LocalUResourceBundlePointer rb(ures_open(U_ICUDATA_CURR, loc, &ec2));
@@ -734,7 +734,7 @@ ucurr_getName(const UChar* currency,
choice = UCURR_SYMBOL_NAME;
}
}
- if (s == NULL) {
+ if (s == nullptr) {
ures_getByKey(rb.getAlias(), CURRENCIES, rb.getAlias(), &ec2);
ures_getByKeyWithFallback(rb.getAlias(), buf, rb.getAlias(), &ec2);
s = ures_getStringByIndex(rb.getAlias(), choice, len, &ec2);
@@ -751,11 +751,11 @@ ucurr_getName(const UChar* currency,
// We no longer support choice format data in names. Data should not contain
// choice patterns.
- if (isChoiceFormat != NULL) {
+ if (isChoiceFormat != nullptr) {
*isChoiceFormat = false;
}
if (U_SUCCESS(ec2)) {
- U_ASSERT(s != NULL);
+ U_ASSERT(s != nullptr);
return s;
}
@@ -765,8 +765,8 @@ ucurr_getName(const UChar* currency,
return currency;
}
-U_CAPI const UChar* U_EXPORT2
-ucurr_getPluralName(const UChar* currency,
+U_CAPI const char16_t* U_EXPORT2
+ucurr_getPluralName(const char16_t* currency,
const char* locale,
UBool* isChoiceFormat,
const char* pluralCount,
@@ -801,7 +801,7 @@ ucurr_getPluralName(const UChar* currency,
char buf[ISO_CURRENCY_CODE_LENGTH+1];
myUCharsToChars(buf, currency);
- const UChar* s = NULL;
+ const char16_t* s = nullptr;
ec2 = U_ZERO_ERROR;
UResourceBundle* rb = ures_open(U_ICUDATA_CURR, loc, &ec2);
@@ -831,7 +831,7 @@ ucurr_getPluralName(const UChar* currency,
|| (ec2 == U_USING_FALLBACK_WARNING && *ec != U_USING_DEFAULT_WARNING)) {
*ec = ec2;
}
- U_ASSERT(s != NULL);
+ U_ASSERT(s != nullptr);
return s;
}
@@ -852,7 +852,7 @@ ucurr_getPluralName(const UChar* currency,
typedef struct {
const char* IsoCode; // key
- UChar* currencyName; // value
+ char16_t* currencyName; // value
int32_t currencyNameLen; // value length
int32_t flag; // flags
} CurrencyNameStruct;
@@ -903,7 +903,7 @@ getCurrencyNameCount(const char* loc, int32_t* total_currency_name_count, int32_
U_NAMESPACE_USE
*total_currency_name_count = 0;
*total_currency_symbol_count = 0;
- const UChar* s = NULL;
+ const char16_t* s = nullptr;
char locale[ULOC_FULLNAME_CAPACITY] = "";
uprv_strcpy(locale, loc);
const icu::Hashtable *currencySymbolsEquiv = getCurrSymbolsEquiv();
@@ -911,14 +911,14 @@ getCurrencyNameCount(const char* loc, int32_t* total_currency_name_count, int32_
UErrorCode ec2 = U_ZERO_ERROR;
// TODO: ures_openDirect?
UResourceBundle* rb = ures_open(U_ICUDATA_CURR, locale, &ec2);
- UResourceBundle* curr = ures_getByKey(rb, CURRENCIES, NULL, &ec2);
+ UResourceBundle* curr = ures_getByKey(rb, CURRENCIES, nullptr, &ec2);
int32_t n = ures_getSize(curr);
for (int32_t i=0; i<n; ++i) {
- UResourceBundle* names = ures_getByIndex(curr, i, NULL, &ec2);
+ UResourceBundle* names = ures_getByIndex(curr, i, nullptr, &ec2);
int32_t len;
s = ures_getStringByIndex(names, UCURR_SYMBOL_NAME, &len, &ec2);
++(*total_currency_symbol_count); // currency symbol
- if (currencySymbolsEquiv != NULL) {
+ if (currencySymbolsEquiv != nullptr) {
*total_currency_symbol_count += countEquivalent(*currencySymbolsEquiv, UnicodeString(true, s, len));
}
++(*total_currency_symbol_count); // iso code
@@ -928,10 +928,10 @@ getCurrencyNameCount(const char* loc, int32_t* total_currency_name_count, int32_
// currency plurals
UErrorCode ec3 = U_ZERO_ERROR;
- UResourceBundle* curr_p = ures_getByKey(rb, CURRENCYPLURALS, NULL, &ec3);
+ UResourceBundle* curr_p = ures_getByKey(rb, CURRENCYPLURALS, nullptr, &ec3);
n = ures_getSize(curr_p);
for (int32_t i=0; i<n; ++i) {
- UResourceBundle* names = ures_getByIndex(curr_p, i, NULL, &ec3);
+ UResourceBundle* names = ures_getByIndex(curr_p, i, nullptr, &ec3);
*total_currency_name_count += ures_getSize(names);
ures_close(names);
}
@@ -945,14 +945,14 @@ getCurrencyNameCount(const char* loc, int32_t* total_currency_name_count, int32_
}
}
-static UChar*
-toUpperCase(const UChar* source, int32_t len, const char* locale) {
- UChar* dest = NULL;
+static char16_t*
+toUpperCase(const char16_t* source, int32_t len, const char* locale) {
+ char16_t* dest = nullptr;
UErrorCode ec = U_ZERO_ERROR;
int32_t destLen = u_strToUpper(dest, 0, source, len, locale, &ec);
ec = U_ZERO_ERROR;
- dest = (UChar*)uprv_malloc(sizeof(UChar) * MAX(destLen, len));
+ dest = (char16_t*)uprv_malloc(sizeof(char16_t) * MAX(destLen, len));
u_strToUpper(dest, destLen, source, len, locale, &ec);
if (U_FAILURE(ec)) {
u_memcpy(dest, source, len);
@@ -993,14 +993,14 @@ collectCurrencyNames(const char* locale,
*currencySymbols = (CurrencyNameStruct*)uprv_malloc
(sizeof(CurrencyNameStruct) * (*total_currency_symbol_count));
- if(currencyNames == NULL || currencySymbols == NULL) {
+ if(currencyNames == nullptr || currencySymbols == nullptr) {
ec = U_MEMORY_ALLOCATION_ERROR;
}
if (U_FAILURE(ec)) return;
- const UChar* s = NULL; // currency name
- char* iso = NULL; // currency ISO code
+ const char16_t* s = nullptr; // currency name
+ char* iso = nullptr; // currency ISO code
*total_currency_name_count = 0;
*total_currency_symbol_count = 0;
@@ -1009,16 +1009,16 @@ collectCurrencyNames(const char* locale,
UErrorCode ec4 = U_ZERO_ERROR;
// Using hash to remove duplicates caused by locale fallback
- UHashtable* currencyIsoCodes = uhash_open(uhash_hashChars, uhash_compareChars, NULL, &ec3);
- UHashtable* currencyPluralIsoCodes = uhash_open(uhash_hashChars, uhash_compareChars, NULL, &ec4);
+ UHashtable* currencyIsoCodes = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &ec3);
+ UHashtable* currencyPluralIsoCodes = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &ec4);
for (int32_t localeLevel = 0; ; ++localeLevel) {
ec2 = U_ZERO_ERROR;
// TODO: ures_openDirect
UResourceBundle* rb = ures_open(U_ICUDATA_CURR, loc, &ec2);
- UResourceBundle* curr = ures_getByKey(rb, CURRENCIES, NULL, &ec2);
+ UResourceBundle* curr = ures_getByKey(rb, CURRENCIES, nullptr, &ec2);
int32_t n = ures_getSize(curr);
for (int32_t i=0; i<n; ++i) {
- UResourceBundle* names = ures_getByIndex(curr, i, NULL, &ec2);
+ UResourceBundle* names = ures_getByIndex(curr, i, nullptr, &ec2);
int32_t len;
s = ures_getStringByIndex(names, UCURR_SYMBOL_NAME, &len, &ec2);
// TODO: uhash_put wont change key/value?
@@ -1026,7 +1026,7 @@ collectCurrencyNames(const char* locale,
if (localeLevel == 0) {
uhash_put(currencyIsoCodes, iso, iso, &ec3);
} else {
- if (uhash_get(currencyIsoCodes, iso) != NULL) {
+ if (uhash_get(currencyIsoCodes, iso) != nullptr) {
ures_close(names);
continue;
} else {
@@ -1035,18 +1035,18 @@ collectCurrencyNames(const char* locale,
}
// Add currency symbol.
(*currencySymbols)[*total_currency_symbol_count].IsoCode = iso;
- (*currencySymbols)[*total_currency_symbol_count].currencyName = (UChar*)s;
+ (*currencySymbols)[*total_currency_symbol_count].currencyName = (char16_t*)s;
(*currencySymbols)[*total_currency_symbol_count].flag = 0;
(*currencySymbols)[(*total_currency_symbol_count)++].currencyNameLen = len;
// Add equivalent symbols
- if (currencySymbolsEquiv != NULL) {
+ if (currencySymbolsEquiv != nullptr) {
UnicodeString str(true, s, len);
icu::EquivIterator iter(*currencySymbolsEquiv, str);
const UnicodeString *symbol;
- while ((symbol = iter.next()) != NULL) {
+ while ((symbol = iter.next()) != nullptr) {
(*currencySymbols)[*total_currency_symbol_count].IsoCode = iso;
(*currencySymbols)[*total_currency_symbol_count].currencyName =
- const_cast<UChar*>(symbol->getBuffer());
+ const_cast<char16_t*>(symbol->getBuffer());
(*currencySymbols)[*total_currency_symbol_count].flag = 0;
(*currencySymbols)[(*total_currency_symbol_count)++].currencyNameLen = symbol->length();
}
@@ -1055,7 +1055,7 @@ collectCurrencyNames(const char* locale,
// Add currency long name.
s = ures_getStringByIndex(names, UCURR_LONG_NAME, &len, &ec2);
(*currencyNames)[*total_currency_name_count].IsoCode = iso;
- UChar* upperName = toUpperCase(s, len, locale);
+ char16_t* upperName = toUpperCase(s, len, locale);
(*currencyNames)[*total_currency_name_count].currencyName = upperName;
(*currencyNames)[*total_currency_name_count].flag = NEED_TO_BE_DELETED;
(*currencyNames)[(*total_currency_name_count)++].currencyNameLen = len;
@@ -1063,7 +1063,7 @@ collectCurrencyNames(const char* locale,
// put (iso, 3, and iso) in to array
// Add currency ISO code.
(*currencySymbols)[*total_currency_symbol_count].IsoCode = iso;
- (*currencySymbols)[*total_currency_symbol_count].currencyName = (UChar*)uprv_malloc(sizeof(UChar)*3);
+ (*currencySymbols)[*total_currency_symbol_count].currencyName = (char16_t*)uprv_malloc(sizeof(char16_t)*3);
// Must convert iso[] into Unicode
u_charsToUChars(iso, (*currencySymbols)[*total_currency_symbol_count].currencyName, 3);
(*currencySymbols)[*total_currency_symbol_count].flag = NEED_TO_BE_DELETED;
@@ -1074,16 +1074,16 @@ collectCurrencyNames(const char* locale,
// currency plurals
UErrorCode ec5 = U_ZERO_ERROR;
- UResourceBundle* curr_p = ures_getByKey(rb, CURRENCYPLURALS, NULL, &ec5);
+ UResourceBundle* curr_p = ures_getByKey(rb, CURRENCYPLURALS, nullptr, &ec5);
n = ures_getSize(curr_p);
for (int32_t i=0; i<n; ++i) {
- UResourceBundle* names = ures_getByIndex(curr_p, i, NULL, &ec5);
+ UResourceBundle* names = ures_getByIndex(curr_p, i, nullptr, &ec5);
iso = (char*)ures_getKey(names);
// Using hash to remove duplicated ISO codes in fallback chain.
if (localeLevel == 0) {
uhash_put(currencyPluralIsoCodes, iso, iso, &ec4);
} else {
- if (uhash_get(currencyPluralIsoCodes, iso) != NULL) {
+ if (uhash_get(currencyPluralIsoCodes, iso) != nullptr) {
ures_close(names);
continue;
} else {
@@ -1097,7 +1097,7 @@ collectCurrencyNames(const char* locale,
// currency long name?
s = ures_getStringByIndex(names, j, &len, &ec5);
(*currencyNames)[*total_currency_name_count].IsoCode = iso;
- UChar* upperName = toUpperCase(s, len, locale);
+ char16_t* upperName = toUpperCase(s, len, locale);
(*currencyNames)[*total_currency_name_count].currencyName = upperName;
(*currencyNames)[*total_currency_name_count].flag = NEED_TO_BE_DELETED;
(*currencyNames)[(*total_currency_name_count)++].currencyNameLen = len;
@@ -1164,7 +1164,7 @@ collectCurrencyNames(const char* locale,
static int32_t
binarySearch(const CurrencyNameStruct* currencyNames,
int32_t indexInCurrencyNames,
- const UChar key,
+ const char16_t key,
int32_t* begin, int32_t* end) {
#ifdef UCURR_DEBUG
printf("key = %x\n", key);
@@ -1278,14 +1278,14 @@ binarySearch(const CurrencyNameStruct* currencyNames,
static void
linearSearch(const CurrencyNameStruct* currencyNames,
int32_t begin, int32_t end,
- const UChar* text, int32_t textLen,
+ const char16_t* text, int32_t textLen,
int32_t *partialMatchLen,
int32_t *maxMatchLen, int32_t* maxMatchIndex) {
int32_t initialPartialMatchLen = *partialMatchLen;
for (int32_t index = begin; index <= end; ++index) {
int32_t len = currencyNames[index].currencyNameLen;
if (len > *maxMatchLen && len <= textLen &&
- uprv_memcmp(currencyNames[index].currencyName, text, len * sizeof(UChar)) == 0) {
+ uprv_memcmp(currencyNames[index].currencyName, text, len * sizeof(char16_t)) == 0) {
*partialMatchLen = MAX(*partialMatchLen, len);
*maxMatchIndex = index;
*maxMatchLen = len;
@@ -1317,7 +1317,7 @@ linearSearch(const CurrencyNameStruct* currencyNames,
static void
searchCurrencyName(const CurrencyNameStruct* currencyNames,
int32_t total_currency_count,
- const UChar* text, int32_t textLen,
+ const char16_t* text, int32_t textLen,
int32_t *partialMatchLen,
int32_t* maxMatchLen, int32_t* maxMatchIndex) {
*maxMatchIndex = -1;
@@ -1388,7 +1388,7 @@ typedef struct {
#define CURRENCY_NAME_CACHE_NUM 10
// Reserve 10 cache entries.
-static CurrencyNameCacheEntry* currCache[CURRENCY_NAME_CACHE_NUM] = {NULL};
+static CurrencyNameCacheEntry* currCache[CURRENCY_NAME_CACHE_NUM] = {nullptr};
// Using an index to indicate which entry to be replaced when cache is full.
// It is a simple round-robin replacement strategy.
static int8_t currentCacheEntryIndex = 0;
@@ -1417,7 +1417,7 @@ deleteCacheEntry(CurrencyNameCacheEntry* entry) {
// Cache clean up
static UBool U_CALLCONV
-currency_cache_cleanup(void) {
+currency_cache_cleanup() {
for (int32_t i = 0; i < CURRENCY_NAME_CACHE_NUM; ++i) {
if (currCache[i]) {
deleteCacheEntry(currCache[i]);
@@ -1437,17 +1437,17 @@ static CurrencyNameCacheEntry*
getCacheEntry(const char* locale, UErrorCode& ec) {
int32_t total_currency_name_count = 0;
- CurrencyNameStruct* currencyNames = NULL;
+ CurrencyNameStruct* currencyNames = nullptr;
int32_t total_currency_symbol_count = 0;
- CurrencyNameStruct* currencySymbols = NULL;
- CurrencyNameCacheEntry* cacheEntry = NULL;
+ CurrencyNameStruct* currencySymbols = nullptr;
+ CurrencyNameCacheEntry* cacheEntry = nullptr;
umtx_lock(&gCurrencyCacheMutex);
// in order to handle racing correctly,
// not putting 'search' in a separate function.
int8_t found = -1;
for (int8_t i = 0; i < CURRENCY_NAME_CACHE_NUM; ++i) {
- if (currCache[i]!= NULL &&
+ if (currCache[i]!= nullptr &&
uprv_strcmp(locale, currCache[i]->locale) == 0) {
found = i;
break;
@@ -1461,12 +1461,12 @@ getCacheEntry(const char* locale, UErrorCode& ec) {
if (found == -1) {
collectCurrencyNames(locale, &currencyNames, &total_currency_name_count, &currencySymbols, &total_currency_symbol_count, ec);
if (U_FAILURE(ec)) {
- return NULL;
+ return nullptr;
}
umtx_lock(&gCurrencyCacheMutex);
// check again.
for (int8_t i = 0; i < CURRENCY_NAME_CACHE_NUM; ++i) {
- if (currCache[i]!= NULL &&
+ if (currCache[i]!= nullptr &&
uprv_strcmp(locale, currCache[i]->locale) == 0) {
found = i;
break;
@@ -1523,7 +1523,7 @@ uprv_parseCurrency(const char* locale,
icu::ParsePosition& pos,
int8_t type,
int32_t* partialMatchLen,
- UChar* result,
+ char16_t* result,
UErrorCode& ec) {
U_NAMESPACE_USE
if (U_FAILURE(ec)) {
@@ -1541,8 +1541,8 @@ uprv_parseCurrency(const char* locale,
int32_t start = pos.getIndex();
- UChar inputText[MAX_CURRENCY_NAME_LEN];
- UChar upperText[MAX_CURRENCY_NAME_LEN];
+ char16_t inputText[MAX_CURRENCY_NAME_LEN];
+ char16_t 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;
@@ -1630,13 +1630,13 @@ void uprv_currencyLeads(const char* locale, icu::UnicodeSet& result, UErrorCode&
* DecimalFormat and DecimalFormatSymbols.
*/
U_CAPI void
-uprv_getStaticCurrencyName(const UChar* iso, const char* loc,
+uprv_getStaticCurrencyName(const char16_t* iso, const char* loc,
icu::UnicodeString& result, UErrorCode& ec)
{
U_NAMESPACE_USE
int32_t len;
- const UChar* currname = ucurr_getName(iso, loc, UCURR_SYMBOL_NAME,
+ const char16_t* currname = ucurr_getName(iso, loc, UCURR_SYMBOL_NAME,
nullptr /* isChoiceFormat */, &len, &ec);
if (U_SUCCESS(ec)) {
result.setTo(currname, len);
@@ -1644,12 +1644,12 @@ uprv_getStaticCurrencyName(const UChar* iso, const char* loc,
}
U_CAPI int32_t U_EXPORT2
-ucurr_getDefaultFractionDigits(const UChar* currency, UErrorCode* ec) {
+ucurr_getDefaultFractionDigits(const char16_t* currency, UErrorCode* ec) {
return ucurr_getDefaultFractionDigitsForUsage(currency,UCURR_USAGE_STANDARD,ec);
}
U_CAPI int32_t U_EXPORT2
-ucurr_getDefaultFractionDigitsForUsage(const UChar* currency, const UCurrencyUsage usage, UErrorCode* ec) {
+ucurr_getDefaultFractionDigitsForUsage(const char16_t* currency, const UCurrencyUsage usage, UErrorCode* ec) {
int32_t fracDigits = 0;
if (U_SUCCESS(*ec)) {
switch (usage) {
@@ -1667,12 +1667,12 @@ ucurr_getDefaultFractionDigitsForUsage(const UChar* currency, const UCurrencyUsa
}
U_CAPI double U_EXPORT2
-ucurr_getRoundingIncrement(const UChar* currency, UErrorCode* ec) {
+ucurr_getRoundingIncrement(const char16_t* currency, UErrorCode* ec) {
return ucurr_getRoundingIncrementForUsage(currency, UCURR_USAGE_STANDARD, ec);
}
U_CAPI double U_EXPORT2
-ucurr_getRoundingIncrementForUsage(const UChar* currency, const UCurrencyUsage usage, UErrorCode* ec) {
+ucurr_getRoundingIncrementForUsage(const char16_t* currency, const UCurrencyUsage usage, UErrorCode* ec) {
double result = 0.0;
const int32_t *data = _findMetaData(currency, *ec);
@@ -2032,7 +2032,7 @@ static const struct CurrencyList {
{"ZWD", UCURR_COMMON|UCURR_DEPRECATED},
{"ZWL", UCURR_COMMON|UCURR_DEPRECATED},
{"ZWR", UCURR_COMMON|UCURR_DEPRECATED},
- { NULL, 0 } // Leave here to denote the end of the list.
+ { nullptr, 0 } // Leave here to denote the end of the list.
};
#define UCURR_MATCHES_BITMASK(variable, typeToMatch) \
@@ -2045,7 +2045,7 @@ ucurr_countCurrencyList(UEnumeration *enumerator, UErrorCode * /*pErrorCode*/) {
int32_t count = 0;
/* Count the number of items matching the type we are looking for. */
- for (int32_t idx = 0; gCurrencyList[idx].currency != NULL; idx++) {
+ for (int32_t idx = 0; gCurrencyList[idx].currency != nullptr; idx++) {
if (UCURR_MATCHES_BITMASK(gCurrencyList[idx].currType, currType)) {
count++;
}
@@ -2075,7 +2075,7 @@ ucurr_nextCurrencyList(UEnumeration *enumerator,
if (resultLength) {
*resultLength = 0;
}
- return NULL;
+ return nullptr;
}
static void U_CALLCONV
@@ -2101,34 +2101,34 @@ ucurr_createCurrencyList(UHashtable *isoCodes, UErrorCode* status){
// process each entry in currency map
for (int32_t i=0; i<ures_getSize(currencyMapArray); i++) {
// get the currency resource
- UResourceBundle *currencyArray = ures_getByIndex(currencyMapArray, i, NULL, &localStatus);
+ UResourceBundle *currencyArray = ures_getByIndex(currencyMapArray, i, nullptr, &localStatus);
// process each currency
if (U_SUCCESS(localStatus)) {
for (int32_t j=0; j<ures_getSize(currencyArray); j++) {
// get the currency resource
- UResourceBundle *currencyRes = ures_getByIndex(currencyArray, j, NULL, &localStatus);
+ UResourceBundle *currencyRes = ures_getByIndex(currencyArray, j, nullptr, &localStatus);
IsoCodeEntry *entry = (IsoCodeEntry*)uprv_malloc(sizeof(IsoCodeEntry));
- if (entry == NULL) {
+ if (entry == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return;
}
// get the ISO code
int32_t isoLength = 0;
- UResourceBundle *idRes = ures_getByKey(currencyRes, "id", NULL, &localStatus);
- if (idRes == NULL) {
+ UResourceBundle *idRes = ures_getByKey(currencyRes, "id", nullptr, &localStatus);
+ if (idRes == nullptr) {
continue;
}
- const UChar *isoCode = ures_getString(idRes, &isoLength, &localStatus);
+ const char16_t *isoCode = ures_getString(idRes, &isoLength, &localStatus);
// get from date
UDate fromDate = U_DATE_MIN;
- UResourceBundle *fromRes = ures_getByKey(currencyRes, "from", NULL, &localStatus);
+ UResourceBundle *fromRes = ures_getByKey(currencyRes, "from", nullptr, &localStatus);
if (U_SUCCESS(localStatus)) {
int32_t fromLength = 0;
const int32_t *fromArray = ures_getIntVector(fromRes, &fromLength, &localStatus);
- int64_t currDate64 = (int64_t)fromArray[0] << 32;
+ int64_t currDate64 = ((uint64_t)fromArray[0]) << 32;
currDate64 |= ((int64_t)fromArray[1] & (int64_t)INT64_C(0x00000000FFFFFFFF));
fromDate = (UDate)currDate64;
}
@@ -2137,12 +2137,12 @@ ucurr_createCurrencyList(UHashtable *isoCodes, UErrorCode* status){
// get to date
UDate toDate = U_DATE_MAX;
localStatus = U_ZERO_ERROR;
- UResourceBundle *toRes = ures_getByKey(currencyRes, "to", NULL, &localStatus);
+ UResourceBundle *toRes = ures_getByKey(currencyRes, "to", nullptr, &localStatus);
if (U_SUCCESS(localStatus)) {
int32_t toLength = 0;
const int32_t *toArray = ures_getIntVector(toRes, &toLength, &localStatus);
- int64_t currDate64 = (int64_t)toArray[0] << 32;
+ int64_t currDate64 = (uint64_t)toArray[0] << 32;
currDate64 |= ((int64_t)toArray[1] & (int64_t)INT64_C(0x00000000FFFFFFFF));
toDate = (UDate)currDate64;
}
@@ -2156,7 +2156,7 @@ ucurr_createCurrencyList(UHashtable *isoCodes, UErrorCode* status){
entry->to = toDate;
localStatus = U_ZERO_ERROR;
- uhash_put(isoCodes, (UChar *)isoCode, entry, &localStatus);
+ uhash_put(isoCodes, (char16_t *)isoCode, entry, &localStatus);
}
} else {
*status = localStatus;
@@ -2171,8 +2171,8 @@ ucurr_createCurrencyList(UHashtable *isoCodes, UErrorCode* status){
}
static const UEnumeration gEnumCurrencyList = {
- NULL,
- NULL,
+ nullptr,
+ nullptr,
ucurr_closeCurrencyList,
ucurr_countCurrencyList,
uenum_unextDefault,
@@ -2183,10 +2183,10 @@ U_CDECL_END
static void U_CALLCONV initIsoCodes(UErrorCode &status) {
- U_ASSERT(gIsoCodes == NULL);
+ U_ASSERT(gIsoCodes == nullptr);
ucln_common_registerCleanup(UCLN_COMMON_CURRENCY, currency_cleanup);
- UHashtable *isoCodes = uhash_open(uhash_hashUChars, uhash_compareUChars, NULL, &status);
+ UHashtable *isoCodes = uhash_open(uhash_hashUChars, uhash_compareUChars, nullptr, &status);
if (U_FAILURE(status)) {
return;
}
@@ -2221,11 +2221,11 @@ static void populateCurrSymbolsEquiv(icu::Hashtable *hash, UErrorCode &status) {
}
static void U_CALLCONV initCurrSymbolsEquiv() {
- U_ASSERT(gCurrSymbolsEquiv == NULL);
+ U_ASSERT(gCurrSymbolsEquiv == nullptr);
UErrorCode status = U_ZERO_ERROR;
ucln_common_registerCleanup(UCLN_COMMON_CURRENCY, currency_cleanup);
icu::Hashtable *temp = new icu::Hashtable(status);
- if (temp == NULL) {
+ if (temp == nullptr) {
return;
}
if (U_FAILURE(status)) {
@@ -2242,14 +2242,14 @@ static void U_CALLCONV initCurrSymbolsEquiv() {
}
U_CAPI UBool U_EXPORT2
-ucurr_isAvailable(const UChar* isoCode, UDate from, UDate to, UErrorCode* eErrorCode) {
+ucurr_isAvailable(const char16_t* isoCode, UDate from, UDate to, UErrorCode* eErrorCode) {
umtx_initOnce(gIsoCodesInitOnce, &initIsoCodes, *eErrorCode);
if (U_FAILURE(*eErrorCode)) {
return false;
}
IsoCodeEntry* result = (IsoCodeEntry *) uhash_get(gIsoCodes, isoCode);
- if (result == NULL) {
+ if (result == nullptr) {
return false;
} else if (from > to) {
*eErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
@@ -2267,20 +2267,20 @@ static const icu::Hashtable* getCurrSymbolsEquiv() {
U_CAPI UEnumeration * U_EXPORT2
ucurr_openISOCurrencies(uint32_t currType, UErrorCode *pErrorCode) {
- UEnumeration *myEnum = NULL;
+ UEnumeration *myEnum = nullptr;
UCurrencyContext *myContext;
myEnum = (UEnumeration*)uprv_malloc(sizeof(UEnumeration));
- if (myEnum == NULL) {
+ if (myEnum == nullptr) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
uprv_memcpy(myEnum, &gEnumCurrencyList, sizeof(UEnumeration));
myContext = (UCurrencyContext*)uprv_malloc(sizeof(UCurrencyContext));
- if (myContext == NULL) {
+ if (myContext == nullptr) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
uprv_free(myEnum);
- return NULL;
+ return nullptr;
}
myContext->currType = currType;
myContext->listIdx = 0;
@@ -2295,7 +2295,7 @@ ucurr_countCurrencies(const char* locale,
{
int32_t currCount = 0;
- if (ec != NULL && U_SUCCESS(*ec))
+ if (ec != nullptr && U_SUCCESS(*ec))
{
// local variables
UErrorCode localStatus = U_ZERO_ERROR;
@@ -2329,21 +2329,21 @@ ucurr_countCurrencies(const char* locale,
for (int32_t i=0; i<ures_getSize(countryArray); i++)
{
// get the currency resource
- UResourceBundle *currencyRes = ures_getByIndex(countryArray, i, NULL, &localStatus);
+ UResourceBundle *currencyRes = ures_getByIndex(countryArray, i, nullptr, &localStatus);
// get the from date
int32_t fromLength = 0;
- UResourceBundle *fromRes = ures_getByKey(currencyRes, "from", NULL, &localStatus);
+ UResourceBundle *fromRes = ures_getByKey(currencyRes, "from", nullptr, &localStatus);
const int32_t *fromArray = ures_getIntVector(fromRes, &fromLength, &localStatus);
- int64_t currDate64 = (int64_t)fromArray[0] << 32;
+ int64_t currDate64 = (int64_t)((uint64_t)(fromArray[0]) << 32);
currDate64 |= ((int64_t)fromArray[1] & (int64_t)INT64_C(0x00000000FFFFFFFF));
UDate fromDate = (UDate)currDate64;
if (ures_getSize(currencyRes)> 2)
{
int32_t toLength = 0;
- UResourceBundle *toRes = ures_getByKey(currencyRes, "to", NULL, &localStatus);
+ UResourceBundle *toRes = ures_getByKey(currencyRes, "to", nullptr, &localStatus);
const int32_t *toArray = ures_getIntVector(toRes, &toLength, &localStatus);
currDate64 = (int64_t)toArray[0] << 32;
@@ -2399,15 +2399,15 @@ U_CAPI int32_t U_EXPORT2
ucurr_forLocaleAndDate(const char* locale,
UDate date,
int32_t index,
- UChar* buff,
+ char16_t* buff,
int32_t buffCapacity,
UErrorCode* ec)
{
int32_t resLen = 0;
int32_t currIndex = 0;
- const UChar* s = NULL;
+ const char16_t* s = nullptr;
- if (ec != NULL && U_SUCCESS(*ec))
+ if (ec != nullptr && U_SUCCESS(*ec))
{
// check the arguments passed
if ((buff && buffCapacity) || !buffCapacity )
@@ -2451,22 +2451,22 @@ ucurr_forLocaleAndDate(const char* locale,
for (int32_t i=0; i<ures_getSize(countryArray); i++)
{
// get the currency resource
- UResourceBundle *currencyRes = ures_getByIndex(countryArray, i, NULL, &localStatus);
+ UResourceBundle *currencyRes = ures_getByIndex(countryArray, i, nullptr, &localStatus);
s = ures_getStringByKey(currencyRes, "id", &resLen, &localStatus);
// get the from date
int32_t fromLength = 0;
- UResourceBundle *fromRes = ures_getByKey(currencyRes, "from", NULL, &localStatus);
+ UResourceBundle *fromRes = ures_getByKey(currencyRes, "from", nullptr, &localStatus);
const int32_t *fromArray = ures_getIntVector(fromRes, &fromLength, &localStatus);
- int64_t currDate64 = (int64_t)fromArray[0] << 32;
+ int64_t currDate64 = (int64_t)((uint64_t)fromArray[0] << 32);
currDate64 |= ((int64_t)fromArray[1] & (int64_t)INT64_C(0x00000000FFFFFFFF));
UDate fromDate = (UDate)currDate64;
if (ures_getSize(currencyRes)> 2)
{
int32_t toLength = 0;
- UResourceBundle *toRes = ures_getByKey(currencyRes, "to", NULL, &localStatus);
+ UResourceBundle *toRes = ures_getByKey(currencyRes, "to", nullptr, &localStatus);
const int32_t *toArray = ures_getIntVector(toRes, &toLength, &localStatus);
currDate64 = (int64_t)toArray[0] << 32;
@@ -2550,8 +2550,8 @@ ucurr_forLocaleAndDate(const char* locale,
}
static const UEnumeration defaultKeywordValues = {
- NULL,
- NULL,
+ nullptr,
+ nullptr,
ulist_close_keyword_values_iterator,
ulist_count_keyword_values,
uenum_unextDefault,
@@ -2568,15 +2568,15 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key,
UList *values = ulist_createEmptyList(status);
UList *otherValues = ulist_createEmptyList(status);
UEnumeration *en = (UEnumeration *)uprv_malloc(sizeof(UEnumeration));
- if (U_FAILURE(*status) || en == NULL) {
- if (en == NULL) {
+ if (U_FAILURE(*status) || en == nullptr) {
+ if (en == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
} else {
uprv_free(en);
}
ulist_deleteList(values);
ulist_deleteList(otherValues);
- return NULL;
+ return nullptr;
}
memcpy(en, &defaultKeywordValues, sizeof(UEnumeration));
en->context = values;
@@ -2614,7 +2614,7 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key,
}
char *curID = (char *)uprv_malloc(sizeof(char) * ULOC_KEYWORDS_CAPACITY);
int32_t curIDLength = ULOC_KEYWORDS_CAPACITY;
- if (curID == NULL) {
+ if (curID == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
break;
}
@@ -2624,7 +2624,7 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key,
/* optimize - use the utf-8 string */
#else
{
- const UChar* defString = ures_getStringByKey(&curbndl, "id", &curIDLength, status);
+ const char16_t* defString = ures_getStringByKey(&curbndl, "id", &curIDLength, status);
if(U_SUCCESS(*status)) {
if(curIDLength+1 > ULOC_KEYWORDS_CAPACITY) {
*status = U_BUFFER_OVERFLOW_ERROR;
@@ -2667,9 +2667,9 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key,
}
} else {
// Consolidate the list
- char *value = NULL;
+ char *value = nullptr;
ulist_resetList(otherValues);
- while ((value = (char *)ulist_getNext(otherValues)) != NULL) {
+ while ((value = (char *)ulist_getNext(otherValues)) != nullptr) {
if (!ulist_containsString(values, value, (int32_t)uprv_strlen(value))) {
char *tmpValue = (char *)uprv_malloc(sizeof(char) * ULOC_KEYWORDS_CAPACITY);
uprv_memcpy(tmpValue, value, uprv_strlen(value) + 1);
@@ -2685,8 +2685,8 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key,
} else {
ulist_deleteList(values);
uprv_free(en);
- values = NULL;
- en = NULL;
+ values = nullptr;
+ en = nullptr;
}
ures_close(&to);
ures_close(&curbndl);
@@ -2701,7 +2701,7 @@ U_CAPI UEnumeration *U_EXPORT2 ucurr_getKeywordValuesForLocale(const char *key,
U_CAPI int32_t U_EXPORT2
-ucurr_getNumericCode(const UChar* currency) {
+ucurr_getNumericCode(const char16_t* currency) {
int32_t code = 0;
if (currency && u_strlen(currency) == ISO_CURRENCY_CODE_LENGTH) {
UErrorCode status = U_ZERO_ERROR;
diff --git a/thirdparty/icu4c/common/udata.cpp b/thirdparty/icu4c/common/udata.cpp
index 2bc74c9789..76d970f3f2 100644
--- a/thirdparty/icu4c/common/udata.cpp
+++ b/thirdparty/icu4c/common/udata.cpp
@@ -104,11 +104,11 @@ static UDataMemory *udata_findCachedData(const char *path, UErrorCode &err);
* that they really need, reducing the size of binaries that take advantage
* of this.
*/
-static UDataMemory *gCommonICUDataArray[10] = { NULL }; // Access protected by icu global mutex.
+static UDataMemory *gCommonICUDataArray[10] = { nullptr }; // Access protected by icu global mutex.
static u_atomic_int32_t gHaveTriedToLoadCommonData {0}; // See extendICUData().
-static UHashtable *gCommonDataCache = NULL; /* Global hash table of opened ICU data files. */
+static UHashtable *gCommonDataCache = nullptr; /* Global hash table of opened ICU data files. */
static icu::UInitOnce gCommonDataCacheInitOnce {};
#if !defined(ICU_DATA_DIR_WINDOWS)
@@ -120,19 +120,19 @@ static UDataFileAccess gDataFileAccess = UDATA_NO_FILES;
#endif
static UBool U_CALLCONV
-udata_cleanup(void)
+udata_cleanup()
{
int32_t i;
if (gCommonDataCache) { /* Delete the cache of user data mappings. */
uhash_close(gCommonDataCache); /* Table owns the contents, and will delete them. */
- gCommonDataCache = NULL; /* Cleanup is not thread safe. */
+ gCommonDataCache = nullptr; /* Cleanup is not thread safe. */
}
gCommonDataCacheInitOnce.reset();
- for (i = 0; i < UPRV_LENGTHOF(gCommonICUDataArray) && gCommonICUDataArray[i] != NULL; ++i) {
+ for (i = 0; i < UPRV_LENGTHOF(gCommonICUDataArray) && gCommonICUDataArray[i] != nullptr; ++i) {
udata_close(gCommonICUDataArray[i]);
- gCommonICUDataArray[i] = NULL;
+ gCommonICUDataArray[i] = nullptr;
}
gHaveTriedToLoadCommonData = 0;
@@ -146,13 +146,13 @@ findCommonICUDataByName(const char *inBasename, UErrorCode &err)
int32_t i;
UDataMemory *pData = udata_findCachedData(inBasename, err);
- if (U_FAILURE(err) || pData == NULL)
+ if (U_FAILURE(err) || pData == nullptr)
return false;
{
Mutex lock;
for (i = 0; i < UPRV_LENGTHOF(gCommonICUDataArray); ++i) {
- if ((gCommonICUDataArray[i] != NULL) && (gCommonICUDataArray[i]->pHeader == pData->pHeader)) {
+ if ((gCommonICUDataArray[i] != nullptr) && (gCommonICUDataArray[i]->pHeader == pData->pHeader)) {
/* The data pointer is already in the array. */
found = true;
break;
@@ -184,9 +184,9 @@ setCommonICUData(UDataMemory *pData, /* The new common data. Belongs to ca
/* deleted - someone may still have a pointer to it lying around in */
/* their locals. */
UDatamemory_assign(newCommonData, pData);
- umtx_lock(NULL);
+ umtx_lock(nullptr);
for (i = 0; i < UPRV_LENGTHOF(gCommonICUDataArray); ++i) {
- if (gCommonICUDataArray[i] == NULL) {
+ if (gCommonICUDataArray[i] == nullptr) {
gCommonICUDataArray[i] = newCommonData;
didUpdate = true;
break;
@@ -195,7 +195,7 @@ setCommonICUData(UDataMemory *pData, /* The new common data. Belongs to ca
break;
}
}
- umtx_unlock(NULL);
+ umtx_unlock(nullptr);
if (i == UPRV_LENGTHOF(gCommonICUDataArray) && warn) {
*pErr = U_USING_DEFAULT_WARNING;
@@ -224,7 +224,7 @@ setCommonICUDataPointer(const void *pData, UBool /*warn*/, UErrorCode *pErrorCod
static const char *
findBasename(const char *path) {
const char *basename=uprv_strrchr(path, U_FILE_SEP_CHAR);
- if(basename==NULL) {
+ if(basename==nullptr) {
return path;
} else {
return basename+1;
@@ -235,13 +235,13 @@ findBasename(const char *path) {
static const char *
packageNameFromPath(const char *path)
{
- if((path == NULL) || (*path == 0)) {
+ if((path == nullptr) || (*path == 0)) {
return U_ICUDATA_NAME;
}
path = findBasename(path);
- if((path == NULL) || (*path == 0)) {
+ if((path == nullptr) || (*path == 0)) {
return U_ICUDATA_NAME;
}
@@ -281,12 +281,12 @@ static void U_CALLCONV DataCacheElement_deleter(void *pDCEl) {
}
static void U_CALLCONV udata_initHashTable(UErrorCode &err) {
- U_ASSERT(gCommonDataCache == NULL);
- gCommonDataCache = uhash_open(uhash_hashChars, uhash_compareChars, NULL, &err);
+ U_ASSERT(gCommonDataCache == nullptr);
+ gCommonDataCache = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &err);
if (U_FAILURE(err)) {
return;
}
- U_ASSERT(gCommonDataCache != NULL);
+ U_ASSERT(gCommonDataCache != nullptr);
uhash_setValueDeleter(gCommonDataCache, DataCacheElement_deleter);
ucln_common_registerCleanup(UCLN_COMMON_UDATA, udata_cleanup);
}
@@ -305,20 +305,20 @@ static UHashtable *udata_getHashTable(UErrorCode &err) {
static UDataMemory *udata_findCachedData(const char *path, UErrorCode &err)
{
UHashtable *htable;
- UDataMemory *retVal = NULL;
+ UDataMemory *retVal = nullptr;
DataCacheElement *el;
const char *baseName;
htable = udata_getHashTable(err);
if (U_FAILURE(err)) {
- return NULL;
+ return nullptr;
}
baseName = findBasename(path); /* Cache remembers only the base name, not the full path. */
- umtx_lock(NULL);
+ umtx_lock(nullptr);
el = (DataCacheElement *)uhash_get(htable, baseName);
- umtx_unlock(NULL);
- if (el != NULL) {
+ umtx_unlock(nullptr);
+ if (el != nullptr) {
retVal = el->item;
}
#ifdef UDATA_DEBUG
@@ -333,45 +333,45 @@ static UDataMemory *udata_cacheDataItem(const char *path, UDataMemory *item, UEr
const char *baseName;
int32_t nameLen;
UHashtable *htable;
- DataCacheElement *oldValue = NULL;
+ DataCacheElement *oldValue = nullptr;
UErrorCode subErr = U_ZERO_ERROR;
htable = udata_getHashTable(*pErr);
if (U_FAILURE(*pErr)) {
- return NULL;
+ return nullptr;
}
/* Create a new DataCacheElement - the thingy we store in the hash table -
* and copy the supplied path and UDataMemoryItems into it.
*/
newElement = (DataCacheElement *)uprv_malloc(sizeof(DataCacheElement));
- if (newElement == NULL) {
+ if (newElement == nullptr) {
*pErr = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
newElement->item = UDataMemory_createNewInstance(pErr);
if (U_FAILURE(*pErr)) {
uprv_free(newElement);
- return NULL;
+ return nullptr;
}
UDatamemory_assign(newElement->item, item);
baseName = findBasename(path);
nameLen = (int32_t)uprv_strlen(baseName);
newElement->name = (char *)uprv_malloc(nameLen+1);
- if (newElement->name == NULL) {
+ if (newElement->name == nullptr) {
*pErr = U_MEMORY_ALLOCATION_ERROR;
uprv_free(newElement->item);
uprv_free(newElement);
- return NULL;
+ return nullptr;
}
uprv_strcpy(newElement->name, baseName);
/* Stick the new DataCacheElement into the hash table.
*/
- umtx_lock(NULL);
+ umtx_lock(nullptr);
oldValue = (DataCacheElement *)uhash_get(htable, path);
- if (oldValue != NULL) {
+ if (oldValue != nullptr) {
subErr = U_USING_DEFAULT_WARNING;
}
else {
@@ -381,7 +381,7 @@ static UDataMemory *udata_cacheDataItem(const char *path, UDataMemory *item, UEr
newElement, /* Value */
&subErr);
}
- umtx_unlock(NULL);
+ umtx_unlock(nullptr);
#ifdef UDATA_DEBUG
fprintf(stderr, "Cache: [%s] <<< %p : %s. vFunc=%p\n", newElement->name,
@@ -393,7 +393,7 @@ static UDataMemory *udata_cacheDataItem(const char *path, UDataMemory *item, UEr
uprv_free(newElement->name);
uprv_free(newElement->item);
uprv_free(newElement);
- return oldValue ? oldValue->item : NULL;
+ return oldValue ? oldValue->item : nullptr;
}
return newElement->item;
@@ -436,7 +436,7 @@ private:
/**
* @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 inPath The full pathname to be iterated over. If nullptr, 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.
@@ -453,14 +453,14 @@ UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg,
fprintf(stderr, "SUFFIX1=%s PATH=%s\n", inSuffix, inPath);
#endif
/** Path **/
- if(inPath == NULL) {
+ if(inPath == nullptr) {
path = u_getDataDirectory();
} else {
path = inPath;
}
/** Package **/
- if(pkg != NULL) {
+ if(pkg != nullptr) {
packageStub.append(U_FILE_SEP_CHAR, *pErrorCode).append(pkg, *pErrorCode);
#ifdef UDATA_DEBUG
fprintf(stderr, "STUB=%s [%d]\n", packageStub.data(), packageStub.length());
@@ -483,7 +483,7 @@ UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg,
#endif
/** Suffix **/
- if(inSuffix != NULL) {
+ if(inSuffix != nullptr) {
suffix = inSuffix;
} else {
suffix = "";
@@ -510,21 +510,21 @@ UDataPathIterator::UDataPathIterator(const char *inPath, const char *pkg,
*
* @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.
+ * @return Pointer to the next path segment, or nullptr if there are no more.
*/
const char *UDataPathIterator::next(UErrorCode *pErrorCode)
{
if(U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
- const char *currentPath = NULL;
+ const char *currentPath = nullptr;
int32_t pathLen = 0;
const char *pathBasename;
do
{
- if( nextPath == NULL ) {
+ if( nextPath == nullptr ) {
break;
}
currentPath = nextPath;
@@ -535,7 +535,7 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode)
} else {
/* fix up next for next time */
nextPath = uprv_strchr(currentPath, U_PATH_SEP_CHAR);
- if(nextPath == NULL) {
+ if(nextPath == nullptr) {
/* segment: entire path */
pathLen = (int32_t)uprv_strlen(currentPath);
} else {
@@ -568,7 +568,7 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode)
/* check for .dat files */
pathBasename = findBasename(pathBuffer.data());
- if(checkLastFour == true &&
+ if(checkLastFour &&
(pathLen>=4) &&
uprv_strncmp(pathBuffer.data() +(pathLen-4), suffix.data(), 4)==0 && /* suffix matches */
uprv_strncmp(findBasename(pathBuffer.data()), basename, basenameLen)==0 && /* base matches */
@@ -626,7 +626,7 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode)
} while(path);
/* fell way off the end */
- return NULL;
+ return nullptr;
}
U_NAMESPACE_END
@@ -652,8 +652,8 @@ extern "C" const DataHeader U_DATA_API U_ICUDATA_ENTRY_POINT;
* to its data package, if it is linked in.
*/
/*
-extern const void *uprv_getICUData_collation(void) ATTRIBUTE_WEAK;
-extern const void *uprv_getICUData_conversion(void) ATTRIBUTE_WEAK;
+extern const void *uprv_getICUData_collation() ATTRIBUTE_WEAK;
+extern const void *uprv_getICUData_conversion() ATTRIBUTE_WEAK;
*/
/*----------------------------------------------------------------------*
@@ -668,7 +668,7 @@ extern const void *uprv_getICUData_conversion(void) ATTRIBUTE_WEAK;
*----------------------------------------------------------------------*/
static UDataMemory *
openCommonData(const char *path, /* Path from OpenChoice? */
- int32_t commonDataIndex, /* ICU Data (index >= 0) if path == NULL */
+ int32_t commonDataIndex, /* ICU Data (index >= 0) if path == nullptr */
UErrorCode *pErrorCode)
{
UDataMemory tData;
@@ -676,7 +676,7 @@ openCommonData(const char *path, /* Path from OpenChoice? */
const char *inBasename;
if (U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
UDataMemory_init(&tData);
@@ -685,11 +685,11 @@ openCommonData(const char *path, /* Path from OpenChoice? */
if (commonDataIndex >= 0) {
/* "mini-cache" for common ICU data */
if(commonDataIndex >= UPRV_LENGTHOF(gCommonICUDataArray)) {
- return NULL;
+ return nullptr;
}
{
Mutex lock;
- if(gCommonICUDataArray[commonDataIndex] != NULL) {
+ if(gCommonICUDataArray[commonDataIndex] != nullptr) {
return gCommonICUDataArray[commonDataIndex];
}
#if !defined(ICU_DATA_DIR_WINDOWS)
@@ -698,7 +698,7 @@ openCommonData(const char *path, /* Path from OpenChoice? */
for(i = 0; i < commonDataIndex; ++i) {
if(gCommonICUDataArray[i]->pHeader == &U_ICUDATA_ENTRY_POINT) {
/* The linked-in data is already in the list. */
- return NULL;
+ return nullptr;
}
}
#endif
@@ -746,14 +746,14 @@ openCommonData(const char *path, /* Path from OpenChoice? */
if (U_SUCCESS(*pErrorCode)) {
*pErrorCode=U_FILE_ACCESS_ERROR;
}
- return NULL;
+ return nullptr;
}
/* Is the requested common data file already open and cached? */
/* Note that the cache is keyed by the base name only. The rest of the path, */
/* if any, is not considered. */
UDataMemory *dataToReturn = udata_findCachedData(inBasename, *pErrorCode);
- if (dataToReturn != NULL || U_FAILURE(*pErrorCode)) {
+ if (dataToReturn != nullptr || U_FAILURE(*pErrorCode)) {
return dataToReturn;
}
@@ -763,7 +763,7 @@ openCommonData(const char *path, /* Path from OpenChoice? */
UDataPathIterator iter(u_getDataDirectory(), inBasename, path, ".dat", true, pErrorCode);
- while ((UDataMemory_isLoaded(&tData)==false) && (pathBuffer = iter.next(pErrorCode)) != NULL)
+ while ((UDataMemory_isLoaded(&tData)==false) && (pathBuffer = iter.next(pErrorCode)) != nullptr)
{
#ifdef UDATA_DEBUG
fprintf(stderr, "ocd: trying path %s - ", pathBuffer);
@@ -774,7 +774,7 @@ openCommonData(const char *path, /* Path from OpenChoice? */
#endif
}
if (U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
#if defined(OS390_STUBDATA) && defined(OS390BATCH)
@@ -789,12 +789,12 @@ openCommonData(const char *path, /* Path from OpenChoice? */
#endif
if (U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
if (!UDataMemory_isLoaded(&tData)) {
/* no common data */
*pErrorCode=U_FILE_ACCESS_ERROR;
- return NULL;
+ return nullptr;
}
/* we have mapped a file, check its header */
@@ -848,7 +848,7 @@ static UBool extendICUData(UErrorCode *pErr)
/* How about if there is no pData, eh... */
UDataMemory_init(&copyPData);
- if(pData != NULL) {
+ if(pData != nullptr) {
UDatamemory_assign(&copyPData, pData);
copyPData.map = 0; /* The mapping for this data is owned by the hash table */
copyPData.mapAddr = 0; /* which will unmap it when ICU is shut down. */
@@ -889,11 +889,11 @@ U_CAPI void U_EXPORT2
udata_setCommonData(const void *data, UErrorCode *pErrorCode) {
UDataMemory dataMemory;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return;
}
- if(data==NULL) {
+ if(data==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -919,10 +919,10 @@ udata_setAppData(const char *path, const void *data, UErrorCode *err)
{
UDataMemory udm;
- if(err==NULL || U_FAILURE(*err)) {
+ if(err==nullptr || U_FAILURE(*err)) {
return;
}
- if(data==NULL) {
+ if(data==nullptr) {
*err=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -941,7 +941,7 @@ udata_setAppData(const char *path, const void *data, UErrorCode *err)
* acceptable to the app. *
* If the data is good, create and return a UDataMemory *
* object that can be returned to the application. *
- * Return NULL on any sort of failure. *
+ * Return nullptr on any sort of failure. *
* *
*----------------------------------------------------------------------------*/
static UDataMemory *
@@ -958,19 +958,19 @@ checkDataItem
UErrorCode *fatalErr /* Bad error, caller should return immediately */
)
{
- UDataMemory *rDataMem = NULL; /* the new UDataMemory, to be returned. */
+ UDataMemory *rDataMem = nullptr; /* the new UDataMemory, to be returned. */
if (U_FAILURE(*fatalErr)) {
- return NULL;
+ return nullptr;
}
if(pHeader->dataHeader.magic1==0xda &&
pHeader->dataHeader.magic2==0x27 &&
- (isAcceptable==NULL || isAcceptable(context, type, name, &pHeader->info))
+ (isAcceptable==nullptr || isAcceptable(context, type, name, &pHeader->info))
) {
rDataMem=UDataMemory_createNewInstance(fatalErr);
if (U_FAILURE(*fatalErr)) {
- return NULL;
+ return nullptr;
}
rDataMem->pHeader = pHeader;
} else {
@@ -1001,7 +1001,7 @@ static UDataMemory *doLoadFromIndividualFiles(const char *pkgName,
/* init path iterator for individual files */
UDataPathIterator iter(dataPath, pkgName, path, tocEntryPathSuffix, false, pErrorCode);
- while ((pathBuffer = iter.next(pErrorCode)) != NULL)
+ while ((pathBuffer = iter.next(pErrorCode)) != nullptr)
{
#ifdef UDATA_DEBUG
fprintf(stderr, "UDATA: trying individual file %s\n", pathBuffer);
@@ -1009,7 +1009,7 @@ static UDataMemory *doLoadFromIndividualFiles(const char *pkgName,
if (uprv_mapFile(&dataMemory, pathBuffer, pErrorCode))
{
pEntryData = checkDataItem(dataMemory.pHeader, isAcceptable, context, type, name, subErrorCode, pErrorCode);
- if (pEntryData != NULL) {
+ if (pEntryData != nullptr) {
/* Data is good.
* Hand off ownership of the backing memory to the user's UDataMemory.
* and return it. */
@@ -1027,7 +1027,7 @@ static UDataMemory *doLoadFromIndividualFiles(const char *pkgName,
/* If we had a nasty error, bail out completely. */
if (U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
/* Otherwise remember that we found data but didn't like it for some reason */
@@ -1037,7 +1037,7 @@ static UDataMemory *doLoadFromIndividualFiles(const char *pkgName,
fprintf(stderr, "%s\n", UDataMemory_isLoaded(&dataMemory)?"LOADED":"not loaded");
#endif
}
- return NULL;
+ return nullptr;
}
/**
@@ -1068,7 +1068,7 @@ static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName
for (commonDataIndex = isICUData ? 0 : -1;;) {
pCommonData=openCommonData(path, commonDataIndex, subErrorCode); /** search for pkg **/
- if(U_SUCCESS(*subErrorCode) && pCommonData!=NULL) {
+ if(U_SUCCESS(*subErrorCode) && pCommonData!=nullptr) {
int32_t length;
/* look up the data piece in the common data */
@@ -1077,15 +1077,15 @@ static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName
fprintf(stderr, "%s: pHeader=%p - %s\n", tocEntryName, (void*) pHeader, u_errorName(*subErrorCode));
#endif
- if(pHeader!=NULL) {
+ if(pHeader!=nullptr) {
pEntryData = checkDataItem(pHeader, isAcceptable, context, type, name, subErrorCode, pErrorCode);
#ifdef UDATA_DEBUG
fprintf(stderr, "pEntryData=%p\n", (void*) pEntryData);
#endif
if (U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
- if (pEntryData != NULL) {
+ if (pEntryData != nullptr) {
pEntryData->length = length;
return pEntryData;
}
@@ -1094,20 +1094,20 @@ static UDataMemory *doLoadFromCommonData(UBool isICUData, const char * /*pkgName
// If we failed due to being out-of-memory, then stop early and report the error.
if (*subErrorCode == U_MEMORY_ALLOCATION_ERROR) {
*pErrorCode = *subErrorCode;
- return NULL;
+ return nullptr;
}
/* Data wasn't found. If we were looking for an ICUData item and there is
* more data available, load it and try again,
* otherwise break out of this loop. */
if (!isICUData) {
- return NULL;
- } else if (pCommonData != NULL) {
+ return nullptr;
+ } else if (pCommonData != nullptr) {
++commonDataIndex; /* try the next data package */
} else if ((!checkedExtendedICUData) && extendICUData(subErrorCode)) {
checkedExtendedICUData = true;
- /* try this data package slot again: it changed from NULL to non-NULL */
+ /* try this data package slot again: it changed from nullptr to non-nullptr */
} else {
- return NULL;
+ return nullptr;
}
}
}
@@ -1160,7 +1160,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
UDataMemoryIsAcceptable *isAcceptable, void *context,
UErrorCode *pErrorCode)
{
- UDataMemory *retVal = NULL;
+ UDataMemory *retVal = nullptr;
const char *dataPath;
@@ -1176,7 +1176,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
/* Is this path ICU data? */
- if(path == NULL ||
+ if(path == nullptr ||
!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)) ||
@@ -1189,10 +1189,10 @@ doOpenChoice(const char *path, const char *type, const char *name,
/* remap from alternate path char to the main one */
CharString altSepPath;
if(path) {
- if(uprv_strchr(path,U_FILE_ALT_SEP_CHAR) != NULL) {
+ if(uprv_strchr(path,U_FILE_ALT_SEP_CHAR) != nullptr) {
altSepPath.append(path, *pErrorCode);
char *p;
- while ((p = uprv_strchr(altSepPath.data(), U_FILE_ALT_SEP_CHAR)) != NULL) {
+ while ((p = uprv_strchr(altSepPath.data(), U_FILE_ALT_SEP_CHAR)) != nullptr) {
*p = U_FILE_SEP_CHAR;
}
#if defined (UDATA_DEBUG)
@@ -1210,7 +1210,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
CharString treeName;
/* ======= Set up strings */
- if(path==NULL) {
+ if(path==nullptr) {
pkgName.append(U_ICUDATA_NAME, *pErrorCode);
} else {
const char *pkg;
@@ -1232,7 +1232,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
pkgName.append(U_ICUDATA_NAME, *pErrorCode);
} else {
pkgName.append(path, (int32_t)(treeChar-path), *pErrorCode);
- if (first == NULL) {
+ if (first == nullptr) {
/*
This user data has no path, but there is a tree name.
Look up the correct path from the data cache later.
@@ -1271,7 +1271,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
tocEntryName.append(U_TREE_ENTRY_SEP_CHAR, *pErrorCode).append(name, *pErrorCode);
tocEntryPath.append(U_FILE_SEP_CHAR, *pErrorCode).append(name, *pErrorCode);
- if(type!=NULL && *type!=0) {
+ if(type!=nullptr && *type!=0) {
tocEntryName.append(".", *pErrorCode).append(type, *pErrorCode);
tocEntryPath.append(".", *pErrorCode).append(type, *pErrorCode);
}
@@ -1284,7 +1284,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
#endif
#if !defined(ICU_DATA_DIR_WINDOWS)
- if(path == NULL) {
+ if(path == nullptr) {
path = COMMON_DATA_NAME; /* "icudt26e" */
}
#else
@@ -1309,7 +1309,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
#endif
retVal = doLoadFromIndividualFiles(/* pkgName.data() */ "", tzFilesDir, tocEntryPathSuffix,
/* path */ "", type, name, isAcceptable, context, &subErrorCode, pErrorCode);
- if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
+ if((retVal != nullptr) || U_FAILURE(*pErrorCode)) {
return retVal;
}
}
@@ -1324,7 +1324,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
retVal = doLoadFromCommonData(isICUData,
pkgName.data(), dataPath, tocEntryPathSuffix, tocEntryName.data(),
path, type, name, isAcceptable, context, &subErrorCode, pErrorCode);
- if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
+ if((retVal != nullptr) || U_FAILURE(*pErrorCode)) {
return retVal;
}
}
@@ -1339,7 +1339,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
if ((dataPath && *dataPath) || !isICUData) {
retVal = doLoadFromIndividualFiles(pkgName.data(), dataPath, tocEntryPathSuffix,
path, type, name, isAcceptable, context, &subErrorCode, pErrorCode);
- if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
+ if((retVal != nullptr) || U_FAILURE(*pErrorCode)) {
return retVal;
}
}
@@ -1354,7 +1354,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
retVal = doLoadFromCommonData(isICUData,
pkgName.data(), dataPath, tocEntryPathSuffix, tocEntryName.data(),
path, type, name, isAcceptable, context, &subErrorCode, pErrorCode);
- if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
+ if((retVal != nullptr) || U_FAILURE(*pErrorCode)) {
return retVal;
}
}
@@ -1369,7 +1369,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
retVal = doLoadFromCommonData(isICUData,
pkgName.data(), "", tocEntryPathSuffix, tocEntryName.data(),
path, type, name, isAcceptable, context, &subErrorCode, pErrorCode);
- if((retVal != NULL) || U_FAILURE(*pErrorCode)) {
+ if((retVal != nullptr) || U_FAILURE(*pErrorCode)) {
return retVal;
}
}
@@ -1395,17 +1395,17 @@ U_CAPI UDataMemory * U_EXPORT2
udata_open(const char *path, const char *type, const char *name,
UErrorCode *pErrorCode) {
#ifdef UDATA_DEBUG
- fprintf(stderr, "udata_open(): Opening: %s : %s . %s\n", (path?path:"NULL"), name, type);
+ fprintf(stderr, "udata_open(): Opening: %s : %s . %s\n", (path?path:"nullptr"), name, type);
fflush(stderr);
#endif
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return NULL;
- } else if(name==NULL || *name==0) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
+ return nullptr;
+ } else if(name==nullptr || *name==0) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
} else {
- return doOpenChoice(path, type, name, NULL, NULL, pErrorCode);
+ return doOpenChoice(path, type, name, nullptr, nullptr, pErrorCode);
}
}
@@ -1416,14 +1416,14 @@ udata_openChoice(const char *path, const char *type, const char *name,
UDataMemoryIsAcceptable *isAcceptable, void *context,
UErrorCode *pErrorCode) {
#ifdef UDATA_DEBUG
- fprintf(stderr, "udata_openChoice(): Opening: %s : %s . %s\n", (path?path:"NULL"), name, type);
+ fprintf(stderr, "udata_openChoice(): Opening: %s : %s . %s\n", (path?path:"nullptr"), name, type);
#endif
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return NULL;
- } else if(name==NULL || *name==0 || isAcceptable==NULL) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
+ return nullptr;
+ } else if(name==nullptr || *name==0 || isAcceptable==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
} else {
return doOpenChoice(path, type, name, isAcceptable, context, pErrorCode);
}
@@ -1433,8 +1433,8 @@ udata_openChoice(const char *path, const char *type, const char *name,
U_CAPI void U_EXPORT2
udata_getInfo(UDataMemory *pData, UDataInfo *pInfo) {
- if(pInfo!=NULL) {
- if(pData!=NULL && pData->pHeader!=NULL) {
+ if(pInfo!=nullptr) {
+ if(pData!=nullptr && pData->pHeader!=nullptr) {
const UDataInfo *info=&pData->pHeader->info;
uint16_t dataInfoSize=udata_getInfoSize(info);
if(pInfo->size>dataInfoSize) {
diff --git a/thirdparty/icu4c/common/udatamem.cpp b/thirdparty/icu4c/common/udatamem.cpp
index 0f80de28eb..02be852320 100644
--- a/thirdparty/icu4c/common/udatamem.cpp
+++ b/thirdparty/icu4c/common/udatamem.cpp
@@ -42,10 +42,10 @@ U_CFUNC UDataMemory *UDataMemory_createNewInstance(UErrorCode *pErr) {
UDataMemory *This;
if (U_FAILURE(*pErr)) {
- return NULL;
+ return nullptr;
}
This = (UDataMemory *)uprv_malloc(sizeof(UDataMemory));
- if (This == NULL) {
+ if (This == nullptr) {
*pErr = U_MEMORY_ALLOCATION_ERROR; }
else {
UDataMemory_init(This);
@@ -59,7 +59,7 @@ U_CFUNC const DataHeader *
UDataMemory_normalizeDataPointer(const void *p) {
/* allow the data to be optionally prepended with an alignment-forcing double value */
const DataHeader *pdh = (const DataHeader *)p;
- if(pdh==NULL || (pdh->dataHeader.magic1==0xda && pdh->dataHeader.magic2==0x27)) {
+ if(pdh==nullptr || (pdh->dataHeader.magic1==0xda && pdh->dataHeader.magic2==0x27)) {
return pdh;
} else {
#if U_PLATFORM == U_PF_OS400
@@ -90,7 +90,7 @@ U_CFUNC void UDataMemory_setData (UDataMemory *This, const void *dataAddr) {
U_CAPI void U_EXPORT2
udata_close(UDataMemory *pData) {
- if(pData!=NULL) {
+ if(pData!=nullptr) {
uprv_unmapFile(pData);
if(pData->heapAllocated ) {
uprv_free(pData);
@@ -102,10 +102,10 @@ udata_close(UDataMemory *pData) {
U_CAPI const void * U_EXPORT2
udata_getMemory(UDataMemory *pData) {
- if(pData!=NULL && pData->pHeader!=NULL) {
+ if(pData!=nullptr && pData->pHeader!=nullptr) {
return (char *)(pData->pHeader)+udata_getHeaderSize(pData->pHeader);
} else {
- return NULL;
+ return nullptr;
}
}
@@ -131,7 +131,7 @@ udata_getMemory(UDataMemory *pData) {
*/
U_CAPI int32_t U_EXPORT2
udata_getLength(const UDataMemory *pData) {
- if(pData!=NULL && pData->pHeader!=NULL && pData->length>=0) {
+ if(pData!=nullptr && pData->pHeader!=nullptr && pData->length>=0) {
/*
* subtract the header size,
* return only the size of the actual data starting at udata_getMemory()
@@ -149,13 +149,13 @@ udata_getLength(const UDataMemory *pData) {
*/
U_CAPI const void * U_EXPORT2
udata_getRawMemory(const UDataMemory *pData) {
- if(pData!=NULL && pData->pHeader!=NULL) {
+ if(pData!=nullptr && pData->pHeader!=nullptr) {
return pData->pHeader;
} else {
- return NULL;
+ return nullptr;
}
}
U_CFUNC UBool UDataMemory_isLoaded(const UDataMemory *This) {
- return This->pHeader != NULL;
+ return This->pHeader != nullptr;
}
diff --git a/thirdparty/icu4c/common/udataswp.cpp b/thirdparty/icu4c/common/udataswp.cpp
index 86f302bd9c..bbce1a8ecd 100644
--- a/thirdparty/icu4c/common/udataswp.cpp
+++ b/thirdparty/icu4c/common/udataswp.cpp
@@ -38,10 +38,10 @@ uprv_swapArray16(const UDataSwapper *ds,
int32_t count;
uint16_t x;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(ds==NULL || inData==NULL || length<0 || (length&1)!=0 || outData==NULL) {
+ if(ds==nullptr || inData==nullptr || length<0 || (length&1)!=0 || outData==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -63,10 +63,10 @@ static int32_t U_CALLCONV
uprv_copyArray16(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode) {
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(ds==NULL || inData==NULL || length<0 || (length&1)!=0 || outData==NULL) {
+ if(ds==nullptr || inData==nullptr || length<0 || (length&1)!=0 || outData==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -86,10 +86,10 @@ uprv_swapArray32(const UDataSwapper *ds,
int32_t count;
uint32_t x;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(ds==NULL || inData==NULL || length<0 || (length&3)!=0 || outData==NULL) {
+ if(ds==nullptr || inData==nullptr || length<0 || (length&3)!=0 || outData==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -111,10 +111,10 @@ static int32_t U_CALLCONV
uprv_copyArray32(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode) {
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(ds==NULL || inData==NULL || length<0 || (length&3)!=0 || outData==NULL) {
+ if(ds==nullptr || inData==nullptr || length<0 || (length&3)!=0 || outData==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -133,10 +133,10 @@ uprv_swapArray64(const UDataSwapper *ds,
uint64_t *q;
int32_t count;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(ds==NULL || inData==NULL || length<0 || (length&7)!=0 || outData==NULL) {
+ if(ds==nullptr || inData==nullptr || length<0 || (length&7)!=0 || outData==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -160,10 +160,10 @@ static int32_t U_CALLCONV
uprv_copyArray64(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode) {
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(ds==NULL || inData==NULL || length<0 || (length&7)!=0 || outData==NULL) {
+ if(ds==nullptr || inData==nullptr || length<0 || (length&7)!=0 || outData==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -236,10 +236,10 @@ udata_swapInvStringBlock(const UDataSwapper *ds,
const char *inChars;
int32_t stringsLength;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
+ if(ds==nullptr || inData==nullptr || length<0 || (length>0 && outData==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -273,7 +273,7 @@ udata_printError(const UDataSwapper *ds,
...) {
va_list args;
- if(ds->printError!=NULL) {
+ if(ds->printError!=nullptr) {
va_start(args, fmt);
ds->printError(ds->printErrorContext, fmt, args);
va_end(args);
@@ -290,10 +290,10 @@ udata_swapDataHeader(const UDataSwapper *ds,
uint16_t headerSize, infoSize;
/* argument checking */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(ds==NULL || inData==NULL || length<-1 || (length>0 && outData==NULL)) {
+ if(ds==nullptr || inData==nullptr || length<-1 || (length>0 && outData==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -365,19 +365,19 @@ udata_openSwapper(UBool inIsBigEndian, uint8_t inCharset,
UErrorCode *pErrorCode) {
UDataSwapper *swapper;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return NULL;
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
+ return nullptr;
}
if(inCharset>U_EBCDIC_FAMILY || outCharset>U_EBCDIC_FAMILY) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
/* allocate the swapper */
swapper=(UDataSwapper *)uprv_malloc(sizeof(UDataSwapper));
- if(swapper==NULL) {
+ if(swapper==nullptr) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
uprv_memset(swapper, 0, sizeof(UDataSwapper));
@@ -423,15 +423,15 @@ udata_openSwapperForInputData(const void *data, int32_t length,
UBool inIsBigEndian;
int8_t inCharset;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
- return NULL;
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
+ return nullptr;
}
- if( data==NULL ||
+ if( data==nullptr ||
(length>=0 && length<(int32_t)sizeof(DataHeader)) ||
outCharset>U_EBCDIC_FAMILY
) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
pHeader=(const DataHeader *)data;
diff --git a/thirdparty/icu4c/common/uenum.cpp b/thirdparty/icu4c/common/uenum.cpp
index 11d895ebcd..7aab58c44c 100644
--- a/thirdparty/icu4c/common/uenum.cpp
+++ b/thirdparty/icu4c/common/uenum.cpp
@@ -33,21 +33,21 @@ static const int32_t PAD = 8;
or reallocating it if at least 'capacity' bytes are not available. */
static void* _getBuffer(UEnumeration* en, int32_t capacity) {
- if (en->baseContext != NULL) {
+ if (en->baseContext != nullptr) {
if (((_UEnumBuffer*) en->baseContext)->len < capacity) {
capacity += PAD;
en->baseContext = uprv_realloc(en->baseContext,
sizeof(int32_t) + capacity);
- if (en->baseContext == NULL) {
- return NULL;
+ if (en->baseContext == nullptr) {
+ return nullptr;
}
((_UEnumBuffer*) en->baseContext)->len = capacity;
}
} else {
capacity += PAD;
en->baseContext = uprv_malloc(sizeof(int32_t) + capacity);
- if (en->baseContext == NULL) {
- return NULL;
+ if (en->baseContext == nullptr) {
+ return nullptr;
}
((_UEnumBuffer*) en->baseContext)->len = capacity;
}
@@ -59,7 +59,7 @@ U_CAPI void U_EXPORT2
uenum_close(UEnumeration* en)
{
if (en) {
- if (en->close != NULL) {
+ if (en->close != nullptr) {
if (en->baseContext) {
uprv_free(en->baseContext);
}
@@ -76,7 +76,7 @@ uenum_count(UEnumeration* en, UErrorCode* status)
if (!en || U_FAILURE(*status)) {
return -1;
}
- if (en->count != NULL) {
+ if (en->count != nullptr) {
return en->count(en, status);
} else {
*status = U_UNSUPPORTED_ERROR;
@@ -85,18 +85,18 @@ uenum_count(UEnumeration* en, UErrorCode* status)
}
/* Don't call this directly. Only uenum_unext should be calling this. */
-U_CAPI const UChar* U_EXPORT2
+U_CAPI const char16_t* U_EXPORT2
uenum_unextDefault(UEnumeration* en,
int32_t* resultLength,
UErrorCode* status)
{
- UChar *ustr = NULL;
+ char16_t *ustr = nullptr;
int32_t len = 0;
- if (en->next != NULL) {
+ if (en->next != nullptr) {
const char *cstr = en->next(en, &len, status);
- if (cstr != NULL) {
- ustr = (UChar*) _getBuffer(en, (len+1) * sizeof(UChar));
- if (ustr == NULL) {
+ if (cstr != nullptr) {
+ ustr = (char16_t*) _getBuffer(en, (len+1) * sizeof(char16_t));
+ if (ustr == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
} else {
u_charsToUChars(cstr, ustr, len+1);
@@ -117,39 +117,39 @@ uenum_nextDefault(UEnumeration* en,
int32_t* resultLength,
UErrorCode* status)
{
- if (en->uNext != NULL) {
+ if (en->uNext != nullptr) {
char *tempCharVal;
- const UChar *tempUCharVal = en->uNext(en, resultLength, status);
- if (tempUCharVal == NULL) {
- return NULL;
+ const char16_t *tempUCharVal = en->uNext(en, resultLength, status);
+ if (tempUCharVal == nullptr) {
+ return nullptr;
}
tempCharVal = (char*)
_getBuffer(en, (*resultLength+1) * sizeof(char));
if (!tempCharVal) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
u_UCharsToChars(tempUCharVal, tempCharVal, *resultLength + 1);
return tempCharVal;
} else {
*status = U_UNSUPPORTED_ERROR;
- return NULL;
+ return nullptr;
}
}
-U_CAPI const UChar* U_EXPORT2
+U_CAPI const char16_t* U_EXPORT2
uenum_unext(UEnumeration* en,
int32_t* resultLength,
UErrorCode* status)
{
if (!en || U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
- if (en->uNext != NULL) {
+ if (en->uNext != nullptr) {
return en->uNext(en, resultLength, status);
} else {
*status = U_UNSUPPORTED_ERROR;
- return NULL;
+ return nullptr;
}
}
@@ -159,10 +159,10 @@ uenum_next(UEnumeration* en,
UErrorCode* status)
{
if (!en || U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
- if (en->next != NULL) {
- if (resultLength != NULL) {
+ if (en->next != nullptr) {
+ if (resultLength != nullptr) {
return en->next(en, resultLength, status);
}
else {
@@ -171,7 +171,7 @@ uenum_next(UEnumeration* en,
}
} else {
*status = U_UNSUPPORTED_ERROR;
- return NULL;
+ return nullptr;
}
}
@@ -181,7 +181,7 @@ uenum_reset(UEnumeration* en, UErrorCode* status)
if (!en || U_FAILURE(*status)) {
return;
}
- if (en->reset != NULL) {
+ if (en->reset != nullptr) {
en->reset(en, status);
} else {
*status = U_UNSUPPORTED_ERROR;
diff --git a/thirdparty/icu4c/common/uhash.cpp b/thirdparty/icu4c/common/uhash.cpp
index a04f9606c5..4d92dfa93f 100644
--- a/thirdparty/icu4c/common/uhash.cpp
+++ b/thirdparty/icu4c/common/uhash.cpp
@@ -44,9 +44,9 @@
* The central function is _uhash_find(). This function looks for a
* slot matching the given key and hashcode. If one is found, it
* returns a pointer to that slot. If the table is full, and no match
- * is found, it returns NULL -- in theory. This would make the code
+ * is found, it returns nullptr -- in theory. This would make the code
* more complicated, since all callers of _uhash_find() would then
- * have to check for a NULL result. To keep this from happening, we
+ * have to check for a nullptr result. To keep this from happening, we
* don't allow the table to fill. When there is only one
* empty/deleted slot left, uhash_put() will refuse to increase the
* count, and fail. This simplifies the code. In practice, one will
@@ -120,10 +120,10 @@ 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) UPRV_BLOCK_MACRO_BEGIN { \
- if (hash->keyDeleter != NULL && keypointer != NULL) { \
+ if (hash->keyDeleter != nullptr && keypointer != nullptr) { \
(*hash->keyDeleter)(keypointer); \
} \
- if (hash->valueDeleter != NULL && valuepointer != NULL) { \
+ if (hash->valueDeleter != nullptr && valuepointer != nullptr) { \
(*hash->valueDeleter)(valuepointer); \
} \
} UPRV_BLOCK_MACRO_END
@@ -148,16 +148,16 @@ _uhash_setElement(UHashtable *hash, UHashElement* e,
UHashTok key, UHashTok value, int8_t hint) {
UHashTok oldValue = e->value;
- if (hash->keyDeleter != NULL && e->key.pointer != NULL &&
+ if (hash->keyDeleter != nullptr && e->key.pointer != nullptr &&
e->key.pointer != key.pointer) { /* Avoid double deletion */
(*hash->keyDeleter)(e->key.pointer);
}
- if (hash->valueDeleter != NULL) {
- if (oldValue.pointer != NULL &&
+ if (hash->valueDeleter != nullptr) {
+ if (oldValue.pointer != nullptr &&
oldValue.pointer != value.pointer) { /* Avoid double deletion */
(*hash->valueDeleter)(oldValue.pointer);
}
- oldValue.pointer = NULL;
+ oldValue.pointer = nullptr;
}
/* Compilers should copy the UHashTok union correctly, but even if
* they do, memory heap tools (e.g. BoundsChecker) can get
@@ -187,13 +187,13 @@ _uhash_internalRemoveElement(UHashtable *hash, UHashElement* e) {
UHashTok empty;
U_ASSERT(!IS_EMPTY_OR_DELETED(e->hashcode));
--hash->count;
- empty.pointer = NULL; empty.integer = 0;
+ empty.pointer = nullptr; empty.integer = 0;
return _uhash_setElement(hash, e, HASH_DELETED, empty, empty, 0);
}
static void
_uhash_internalSetResizePolicy(UHashtable *hash, enum UHashResizePolicy policy) {
- U_ASSERT(hash != NULL);
+ U_ASSERT(hash != nullptr);
U_ASSERT(((int32_t)policy) >= 0);
U_ASSERT(((int32_t)policy) < 3);
hash->lowWaterRatio = RESIZE_POLICY_RATIO_TABLE[policy * 2];
@@ -227,12 +227,12 @@ _uhash_allocate(UHashtable *hash,
p = hash->elements = (UHashElement*)
uprv_malloc(sizeof(UHashElement) * hash->length);
- if (hash->elements == NULL) {
+ if (hash->elements == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return;
}
- emptytok.pointer = NULL; /* Only one of these two is needed */
+ emptytok.pointer = nullptr; /* Only one of these two is needed */
emptytok.integer = 0; /* but we don't know which one. */
limit = p + hash->length;
@@ -256,22 +256,22 @@ _uhash_init(UHashtable *result,
int32_t primeIndex,
UErrorCode *status)
{
- if (U_FAILURE(*status)) return NULL;
- U_ASSERT(keyHash != NULL);
- U_ASSERT(keyComp != NULL);
+ if (U_FAILURE(*status)) return nullptr;
+ U_ASSERT(keyHash != nullptr);
+ U_ASSERT(keyComp != nullptr);
result->keyHasher = keyHash;
result->keyComparator = keyComp;
result->valueComparator = valueComp;
- result->keyDeleter = NULL;
- result->valueDeleter = NULL;
+ result->keyDeleter = nullptr;
+ result->valueDeleter = nullptr;
result->allocated = false;
_uhash_internalSetResizePolicy(result, U_GROW);
_uhash_allocate(result, primeIndex, status);
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
return result;
@@ -285,12 +285,12 @@ _uhash_create(UHashFunction *keyHash,
UErrorCode *status) {
UHashtable *result;
- if (U_FAILURE(*status)) return NULL;
+ if (U_FAILURE(*status)) return nullptr;
result = (UHashtable*) uprv_malloc(sizeof(UHashtable));
- if (result == NULL) {
+ if (result == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
_uhash_init(result, keyHash, keyComp, valueComp, primeIndex, status);
@@ -298,7 +298,7 @@ _uhash_create(UHashFunction *keyHash,
if (U_FAILURE(*status)) {
uprv_free(result);
- return NULL;
+ return nullptr;
}
return result;
@@ -323,7 +323,7 @@ _uhash_create(UHashFunction *keyHash,
* values so that the searches stop within a reasonable amount of time.
* This can be changed by changing the high/low water marks.
*
- * In theory, this function can return NULL, if it is full (no empty
+ * In theory, this function can return nullptr, if it is full (no empty
* or deleted slots) and if no matching key is found. In practice, we
* prevent this elsewhere (in uhash_put) by making sure the last slot
* in the table is never filled.
@@ -424,7 +424,7 @@ _uhash_rehash(UHashtable *hash, UErrorCode *status) {
for (i = oldLength - 1; i >= 0; --i) {
if (!IS_EMPTY_OR_DELETED(old[i].hashcode)) {
UHashElement *e = _uhash_find(hash, old[i].key, old[i].hashcode);
- U_ASSERT(e != NULL);
+ U_ASSERT(e != nullptr);
U_ASSERT(e->hashcode == HASH_EMPTY);
e->key = old[i].key;
e->value = old[i].value;
@@ -448,8 +448,8 @@ _uhash_remove(UHashtable *hash,
*/
UHashTok result;
UHashElement* e = _uhash_find(hash, key, hash->keyHasher(key));
- U_ASSERT(e != NULL);
- result.pointer = NULL;
+ U_ASSERT(e != nullptr);
+ result.pointer = nullptr;
result.integer = 0;
if (!IS_EMPTY_OR_DELETED(e->hashcode)) {
result = _uhash_internalRemoveElement(hash, e);
@@ -470,7 +470,7 @@ _uhash_put(UHashtable *hash,
/* Put finds the position in the table for the new value. If the
* key is already in the table, it is deleted, if there is a
- * non-NULL keyDeleter. Then the key, the hash and the value are
+ * non-nullptr keyDeleter. Then the key, the hash and the value are
* all put at the position in their respective arrays.
*/
int32_t hashcode;
@@ -480,12 +480,12 @@ _uhash_put(UHashtable *hash,
if (U_FAILURE(*status)) {
goto err;
}
- U_ASSERT(hash != NULL);
+ U_ASSERT(hash != nullptr);
if ((hint & HINT_VALUE_POINTER) ?
- value.pointer == NULL :
+ value.pointer == nullptr :
value.integer == 0 && (hint & HINT_ALLOW_ZERO) == 0) {
- /* Disallow storage of NULL values, since NULL is returned by
- * get() to indicate an absent key. Storing NULL == removing.
+ /* Disallow storage of nullptr values, since nullptr is returned by
+ * get() to indicate an absent key. Storing nullptr == removing.
*/
return _uhash_remove(hash, key);
}
@@ -498,12 +498,12 @@ _uhash_put(UHashtable *hash,
hashcode = (*hash->keyHasher)(key);
e = _uhash_find(hash, key, hashcode);
- U_ASSERT(e != NULL);
+ U_ASSERT(e != nullptr);
if (IS_EMPTY_OR_DELETED(e->hashcode)) {
/* Important: We must never actually fill the table up. If we
- * do so, then _uhash_find() will return NULL, and we'll have
- * to check for NULL after every call to _uhash_find(). To
+ * do so, then _uhash_find() will return nullptr, and we'll have
+ * to check for nullptr after every call to _uhash_find(). To
* avoid this we make sure there is always at least one empty
* or deleted slot in the table. This only is a problem if we
* are out of memory and rehash isn't working.
@@ -518,18 +518,18 @@ _uhash_put(UHashtable *hash,
}
/* We must in all cases handle storage properly. If there was an
- * old key, then it must be deleted (if the deleter != NULL).
+ * old key, then it must be deleted (if the deleter != nullptr).
* Make hashcodes stored in table positive.
*/
return _uhash_setElement(hash, e, hashcode & 0x7FFFFFFF, key, value, hint);
err:
- /* If the deleters are non-NULL, this method adopts its key and/or
+ /* If the deleters are non-nullptr, this method adopts its key and/or
* value arguments, and we must be sure to delete the key and/or
* value in all cases, even upon failure.
*/
HASH_DELETE_KEY_VALUE(hash, key.pointer, value.pointer);
- emptytok.pointer = NULL; emptytok.integer = 0;
+ emptytok.pointer = nullptr; emptytok.integer = 0;
return emptytok;
}
@@ -591,19 +591,19 @@ uhash_initSize(UHashtable *fillinResult,
U_CAPI void U_EXPORT2
uhash_close(UHashtable *hash) {
- if (hash == NULL) {
+ if (hash == nullptr) {
return;
}
- if (hash->elements != NULL) {
- if (hash->keyDeleter != NULL || hash->valueDeleter != NULL) {
+ if (hash->elements != nullptr) {
+ if (hash->keyDeleter != nullptr || hash->valueDeleter != nullptr) {
int32_t pos=UHASH_FIRST;
UHashElement *e;
- while ((e = (UHashElement*) uhash_nextElement(hash, &pos)) != NULL) {
+ while ((e = (UHashElement*) uhash_nextElement(hash, &pos)) != nullptr) {
HASH_DELETE_KEY_VALUE(hash, e->key.pointer, e->value.pointer);
}
}
uprv_free(hash->elements);
- hash->elements = NULL;
+ hash->elements = nullptr;
}
if (hash->allocated) {
uprv_free(hash);
@@ -828,9 +828,9 @@ U_CAPI void U_EXPORT2
uhash_removeAll(UHashtable *hash) {
int32_t pos = UHASH_FIRST;
const UHashElement *e;
- U_ASSERT(hash != NULL);
+ U_ASSERT(hash != nullptr);
if (hash->count != 0) {
- while ((e = uhash_nextElement(hash, &pos)) != NULL) {
+ while ((e = uhash_nextElement(hash, &pos)) != nullptr) {
uhash_removeElement(hash, e);
}
}
@@ -866,7 +866,7 @@ uhash_find(const UHashtable *hash, const void* key) {
const UHashElement *e;
keyholder.pointer = (void*) key;
e = _uhash_find(hash, keyholder, hash->keyHasher(keyholder));
- return IS_EMPTY_OR_DELETED(e->hashcode) ? NULL : e;
+ return IS_EMPTY_OR_DELETED(e->hashcode) ? nullptr : e;
}
U_CAPI const UHashElement* U_EXPORT2
@@ -875,7 +875,7 @@ uhash_nextElement(const UHashtable *hash, int32_t *pos) {
* EMPTY and not DELETED.
*/
int32_t i;
- U_ASSERT(hash != NULL);
+ U_ASSERT(hash != nullptr);
for (i = *pos + 1; i < hash->length; ++i) {
if (!IS_EMPTY_OR_DELETED(hash->elements[i].hashcode)) {
*pos = i;
@@ -884,18 +884,18 @@ uhash_nextElement(const UHashtable *hash, int32_t *pos) {
}
/* No more elements */
- return NULL;
+ return nullptr;
}
U_CAPI void* U_EXPORT2
uhash_removeElement(UHashtable *hash, const UHashElement* e) {
- U_ASSERT(hash != NULL);
- U_ASSERT(e != NULL);
+ U_ASSERT(hash != nullptr);
+ U_ASSERT(e != nullptr);
if (!IS_EMPTY_OR_DELETED(e->hashcode)) {
UHashElement *nce = (UHashElement *)e;
return _uhash_internalRemoveElement(hash, nce).pointer;
}
- return NULL;
+ return nullptr;
}
/********************************************************************
@@ -928,20 +928,20 @@ uhash_tokp(void* p) {
U_CAPI int32_t U_EXPORT2
uhash_hashUChars(const UHashTok key) {
- const UChar *s = (const UChar *)key.pointer;
- return s == NULL ? 0 : ustr_hashUCharsN(s, u_strlen(s));
+ const char16_t *s = (const char16_t *)key.pointer;
+ return s == nullptr ? 0 : ustr_hashUCharsN(s, u_strlen(s));
}
U_CAPI int32_t U_EXPORT2
uhash_hashChars(const UHashTok key) {
const char *s = (const char *)key.pointer;
- return s == NULL ? 0 : static_cast<int32_t>(ustr_hashCharsN(s, static_cast<int32_t>(uprv_strlen(s))));
+ return s == nullptr ? 0 : static_cast<int32_t>(ustr_hashCharsN(s, static_cast<int32_t>(uprv_strlen(s))));
}
U_CAPI int32_t U_EXPORT2
uhash_hashIChars(const UHashTok key) {
const char *s = (const char *)key.pointer;
- return s == NULL ? 0 : ustr_hashICharsN(s, static_cast<int32_t>(uprv_strlen(s)));
+ return s == nullptr ? 0 : ustr_hashICharsN(s, static_cast<int32_t>(uprv_strlen(s)));
}
U_CAPI UBool U_EXPORT2
@@ -960,10 +960,10 @@ uhash_equals(const UHashtable* hash1, const UHashtable* hash2){
* with 64-bit pointers and 32-bit integer hashes.
* A valueComparator is normally optional.
*/
- if (hash1==NULL || hash2==NULL ||
+ if (hash1==nullptr || hash2==nullptr ||
hash1->keyComparator != hash2->keyComparator ||
hash1->valueComparator != hash2->valueComparator ||
- hash1->valueComparator == NULL)
+ hash1->valueComparator == nullptr)
{
/*
Normally we would return an error here about incompatible hash tables,
@@ -1002,12 +1002,12 @@ uhash_equals(const UHashtable* hash1, const UHashtable* hash2){
U_CAPI UBool U_EXPORT2
uhash_compareUChars(const UHashTok key1, const UHashTok key2) {
- const UChar *p1 = (const UChar*) key1.pointer;
- const UChar *p2 = (const UChar*) key2.pointer;
+ const char16_t *p1 = (const char16_t*) key1.pointer;
+ const char16_t *p2 = (const char16_t*) key2.pointer;
if (p1 == p2) {
return true;
}
- if (p1 == NULL || p2 == NULL) {
+ if (p1 == nullptr || p2 == nullptr) {
return false;
}
while (*p1 != 0 && *p1 == *p2) {
@@ -1024,7 +1024,7 @@ uhash_compareChars(const UHashTok key1, const UHashTok key2) {
if (p1 == p2) {
return true;
}
- if (p1 == NULL || p2 == NULL) {
+ if (p1 == nullptr || p2 == nullptr) {
return false;
}
while (*p1 != 0 && *p1 == *p2) {
@@ -1041,7 +1041,7 @@ uhash_compareIChars(const UHashTok key1, const UHashTok key2) {
if (p1 == p2) {
return true;
}
- if (p1 == NULL || p2 == NULL) {
+ if (p1 == nullptr || p2 == nullptr) {
return false;
}
while (*p1 != 0 && uprv_tolower(*p1) == uprv_tolower(*p2)) {
diff --git a/thirdparty/icu4c/common/uidna.cpp b/thirdparty/icu4c/common/uidna.cpp
index 1cbdeec327..949d128f93 100644
--- a/thirdparty/icu4c/common/uidna.cpp
+++ b/thirdparty/icu4c/common/uidna.cpp
@@ -30,7 +30,7 @@
#include "sprpimpl.h"
/* it is official IDNA ACE Prefix is "xn--" */
-static const UChar ACE_PREFIX[] ={ 0x0078,0x006E,0x002d,0x002d } ;
+static const char16_t ACE_PREFIX[] ={ 0x0078,0x006E,0x002d,0x002d } ;
#define ACE_PREFIX_LENGTH 4
#define MAX_LABEL_LENGTH 63
@@ -47,8 +47,8 @@ static const UChar ACE_PREFIX[] ={ 0x0078,0x006E,0x002d,0x002d } ;
#define CAPITAL_A 0x0041
#define CAPITAL_Z 0x005A
-inline static UChar
-toASCIILower(UChar ch){
+inline static char16_t
+toASCIILower(char16_t ch){
if(CAPITAL_A <= ch && ch <= CAPITAL_Z){
return ch + LOWER_CASE_DELTA;
}
@@ -56,7 +56,7 @@ toASCIILower(UChar ch){
}
inline static UBool
-startsWithPrefix(const UChar* src , int32_t srcLength){
+startsWithPrefix(const char16_t* src , int32_t srcLength){
if(srcLength < ACE_PREFIX_LENGTH){
return false;
}
@@ -71,8 +71,8 @@ startsWithPrefix(const UChar* src , int32_t srcLength){
inline static int32_t
-compareCaseInsensitiveASCII(const UChar* s1, int32_t s1Len,
- const UChar* s2, int32_t s2Len){
+compareCaseInsensitiveASCII(const char16_t* s1, int32_t s1Len,
+ const char16_t* s2, int32_t s2Len){
int32_t minLength;
int32_t lengthResult;
@@ -92,7 +92,7 @@ compareCaseInsensitiveASCII(const UChar* s1, int32_t s1Len,
lengthResult = 0;
}
- UChar c1,c2;
+ char16_t c1,c2;
int32_t rc;
for(int32_t i =0;/* no condition */;i++) {
@@ -126,7 +126,7 @@ compareCaseInsensitiveASCII(const UChar* s1, int32_t s1Len,
* @return true if the char is a label separator
* @stable ICU 2.8
*/
-static inline UBool isLabelSeparator(UChar ch){
+static inline UBool isLabelSeparator(char16_t ch){
switch(ch){
case 0x002e:
case 0x3002:
@@ -142,8 +142,8 @@ static inline UBool isLabelSeparator(UChar ch){
// if *limit == separator then the length returned does not include
// the separtor.
static inline int32_t
-getNextSeparator(UChar *src, int32_t srcLength,
- UChar **limit, UBool *done){
+getNextSeparator(char16_t *src, int32_t srcLength,
+ char16_t **limit, UBool *done){
if(srcLength == -1){
int32_t i;
for(i=0 ; ;i++){
@@ -174,7 +174,7 @@ getNextSeparator(UChar *src, int32_t srcLength,
return i;
}
}
-static inline UBool isLDHChar(UChar ch){
+static inline UBool isLDHChar(char16_t ch){
// high runner case
if(ch>0x007A){
return false;
@@ -191,8 +191,8 @@ static inline UBool isLDHChar(UChar ch){
}
static int32_t
-_internal_toASCII(const UChar* src, int32_t srcLength,
- UChar* dest, int32_t destCapacity,
+_internal_toASCII(const char16_t* src, int32_t srcLength,
+ char16_t* dest, int32_t destCapacity,
int32_t options,
UStringPrepProfile* nameprep,
UParseError* parseError,
@@ -200,16 +200,16 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
{
// 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];
+ char16_t b1Stack[MAX_LABEL_BUFFER_SIZE], b2Stack[MAX_LABEL_BUFFER_SIZE];
//initialize pointers to stack buffers
- UChar *b1 = b1Stack, *b2 = b2Stack;
+ char16_t *b1 = b1Stack, *b2 = b2Stack;
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;
+ UBool* caseFlags = nullptr;
// the source contains all ascii codepoints
UBool srcIsASCII = true;
@@ -228,8 +228,8 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
}
if(srcLength > b1Capacity){
- b1 = (UChar*) uprv_malloc(srcLength * U_SIZEOF_UCHAR);
- if(b1==NULL){
+ b1 = (char16_t*) uprv_malloc(srcLength * U_SIZEOF_UCHAR);
+ if(b1==nullptr){
*status = U_MEMORY_ALLOCATION_ERROR;
goto CLEANUP;
}
@@ -256,8 +256,8 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
if(b1 != b1Stack){
uprv_free(b1);
}
- b1 = (UChar*) uprv_malloc(b1Len * U_SIZEOF_UCHAR);
- if(b1==NULL){
+ b1 = (char16_t*) uprv_malloc(b1Len * U_SIZEOF_UCHAR);
+ if(b1==nullptr){
*status = U_MEMORY_ALLOCATION_ERROR;
goto CLEANUP;
}
@@ -287,7 +287,7 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
failPos = j;
}
}
- if(useSTD3ASCIIRules == true){
+ if(useSTD3ASCIIRules){
// verify 3a and 3b
// 3(a) Verify the absence of non-LDH ASCII code points; that is, the
// absence of 0..2C, 2E..2F, 3A..40, 5B..60, and 7B..7F.
@@ -338,8 +338,8 @@ _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);
- if(b2 == NULL){
+ b2 = (char16_t*) uprv_malloc(b2Len * U_SIZEOF_UCHAR);
+ if(b2 == nullptr){
*status = U_MEMORY_ALLOCATION_ERROR;
goto CLEANUP;
}
@@ -391,8 +391,8 @@ CLEANUP:
}
static int32_t
-_internal_toUnicode(const UChar* src, int32_t srcLength,
- UChar* dest, int32_t destCapacity,
+_internal_toUnicode(const char16_t* src, int32_t srcLength,
+ char16_t* dest, int32_t destCapacity,
int32_t options,
UStringPrepProfile* nameprep,
UParseError* parseError,
@@ -404,17 +404,17 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
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];
+ char16_t b1Stack[MAX_LABEL_BUFFER_SIZE], b2Stack[MAX_LABEL_BUFFER_SIZE], b3Stack[MAX_LABEL_BUFFER_SIZE];
//initialize pointers to stack buffers
- UChar *b1 = b1Stack, *b2 = b2Stack, *b1Prime=NULL, *b3=b3Stack;
+ char16_t *b1 = b1Stack, *b2 = b2Stack, *b1Prime=nullptr, *b3=b3Stack;
int32_t b1Len = 0, b2Len, b1PrimeLen, b3Len,
b1Capacity = MAX_LABEL_BUFFER_SIZE,
b2Capacity = MAX_LABEL_BUFFER_SIZE,
b3Capacity = MAX_LABEL_BUFFER_SIZE,
reqLength=0;
- UBool* caseFlags = NULL;
+ UBool* caseFlags = nullptr;
UBool srcIsASCII = true;
/*UBool srcIsLDH = true;
@@ -458,8 +458,8 @@ _internal_toUnicode(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*/
- b1 = (UChar*) uprv_malloc(b1Len * U_SIZEOF_UCHAR);
- if(b1==NULL){
+ b1 = (char16_t*) uprv_malloc(b1Len * U_SIZEOF_UCHAR);
+ if(b1==nullptr){
*status = U_MEMORY_ALLOCATION_ERROR;
goto CLEANUP;
}
@@ -475,7 +475,7 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
}else{
//just point src to b1
- b1 = (UChar*) src;
+ b1 = (char16_t*) src;
b1Len = srcLength;
}
@@ -498,8 +498,8 @@ _internal_toUnicode(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);
- if(b2==NULL){
+ b2 = (char16_t*) uprv_malloc(b2Len * U_SIZEOF_UCHAR);
+ if(b2==nullptr){
*status = U_MEMORY_ALLOCATION_ERROR;
goto CLEANUP;
}
@@ -516,8 +516,8 @@ _internal_toUnicode(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*/
- b3 = (UChar*) uprv_malloc(b3Len * U_SIZEOF_UCHAR);
- if(b3==NULL){
+ b3 = (char16_t*) uprv_malloc(b3Len * U_SIZEOF_UCHAR);
+ if(b3==nullptr){
*status = U_MEMORY_ALLOCATION_ERROR;
goto CLEANUP;
}
@@ -608,16 +608,16 @@ CLEANUP:
}
U_CAPI int32_t U_EXPORT2
-uidna_toASCII(const UChar* src, int32_t srcLength,
- UChar* dest, int32_t destCapacity,
+uidna_toASCII(const char16_t* src, int32_t srcLength,
+ char16_t* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
UErrorCode* status){
- if(status == NULL || U_FAILURE(*status)){
+ if(status == nullptr || U_FAILURE(*status)){
return 0;
}
- if((src==NULL) || (srcLength < -1) || (destCapacity<0) || (!dest && destCapacity > 0)){
+ if((src==nullptr) || (srcLength < -1) || (destCapacity<0) || (!dest && destCapacity > 0)){
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -637,16 +637,16 @@ uidna_toASCII(const UChar* src, int32_t srcLength,
}
U_CAPI int32_t U_EXPORT2
-uidna_toUnicode(const UChar* src, int32_t srcLength,
- UChar* dest, int32_t destCapacity,
+uidna_toUnicode(const char16_t* src, int32_t srcLength,
+ char16_t* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
UErrorCode* status){
- if(status == NULL || U_FAILURE(*status)){
+ if(status == nullptr || U_FAILURE(*status)){
return 0;
}
- if( (src==NULL) || (srcLength < -1) || (destCapacity<0) || (!dest && destCapacity > 0)){
+ if( (src==nullptr) || (srcLength < -1) || (destCapacity<0) || (!dest && destCapacity > 0)){
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -666,16 +666,16 @@ uidna_toUnicode(const UChar* src, int32_t srcLength,
U_CAPI int32_t U_EXPORT2
-uidna_IDNToASCII( const UChar *src, int32_t srcLength,
- UChar* dest, int32_t destCapacity,
+uidna_IDNToASCII( const char16_t *src, int32_t srcLength,
+ char16_t* dest, int32_t destCapacity,
int32_t options,
UParseError *parseError,
UErrorCode *status){
- if(status == NULL || U_FAILURE(*status)){
+ if(status == nullptr || U_FAILURE(*status)){
return 0;
}
- if((src==NULL) || (srcLength < -1) || (destCapacity<0) || (!dest && destCapacity > 0)){
+ if((src==nullptr) || (srcLength < -1) || (destCapacity<0) || (!dest && destCapacity > 0)){
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -689,9 +689,9 @@ uidna_IDNToASCII( const UChar *src, int32_t srcLength,
}
//initialize pointers
- UChar *delimiter = (UChar*)src;
- UChar *labelStart = (UChar*)src;
- UChar *currentDest = (UChar*) dest;
+ char16_t *delimiter = (char16_t*)src;
+ char16_t *labelStart = (char16_t*)src;
+ char16_t *currentDest = (char16_t*) dest;
int32_t remainingLen = srcLength;
int32_t remainingDestCapacity = destCapacity;
int32_t labelLen = 0, labelReqLength = 0;
@@ -731,7 +731,7 @@ uidna_IDNToASCII( const UChar *src, int32_t srcLength,
remainingDestCapacity = 0;
}
- if(done == true){
+ if(done){
break;
}
@@ -759,16 +759,16 @@ uidna_IDNToASCII( const UChar *src, int32_t srcLength,
}
U_CAPI int32_t U_EXPORT2
-uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
- UChar* dest, int32_t destCapacity,
+uidna_IDNToUnicode( const char16_t* src, int32_t srcLength,
+ char16_t* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
UErrorCode* status){
- if(status == NULL || U_FAILURE(*status)){
+ if(status == nullptr || U_FAILURE(*status)){
return 0;
}
- if((src==NULL) || (srcLength < -1) || (destCapacity<0) || (!dest && destCapacity > 0)){
+ if((src==nullptr) || (srcLength < -1) || (destCapacity<0) || (!dest && destCapacity > 0)){
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -782,9 +782,9 @@ uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
}
//initialize pointers
- UChar *delimiter = (UChar*)src;
- UChar *labelStart = (UChar*)src;
- UChar *currentDest = (UChar*) dest;
+ char16_t *delimiter = (char16_t*)src;
+ char16_t *labelStart = (char16_t*)src;
+ char16_t *currentDest = (char16_t*) dest;
int32_t remainingLen = srcLength;
int32_t remainingDestCapacity = destCapacity;
int32_t labelLen = 0, labelReqLength = 0;
@@ -829,7 +829,7 @@ uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
remainingDestCapacity = 0;
}
- if(done == true){
+ if(done){
break;
}
@@ -858,17 +858,17 @@ uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
}
U_CAPI int32_t U_EXPORT2
-uidna_compare( const UChar *s1, int32_t length1,
- const UChar *s2, int32_t length2,
+uidna_compare( const char16_t *s1, int32_t length1,
+ const char16_t *s2, int32_t length2,
int32_t options,
UErrorCode* status){
- if(status == NULL || U_FAILURE(*status)){
+ if(status == nullptr || U_FAILURE(*status)){
return -1;
}
- UChar b1Stack[MAX_IDN_BUFFER_SIZE], b2Stack[MAX_IDN_BUFFER_SIZE];
- UChar *b1 = b1Stack, *b2 = b2Stack;
+ char16_t b1Stack[MAX_IDN_BUFFER_SIZE], b2Stack[MAX_IDN_BUFFER_SIZE];
+ char16_t *b1 = b1Stack, *b2 = b2Stack;
int32_t b1Len, b2Len, b1Capacity = MAX_IDN_BUFFER_SIZE, b2Capacity = MAX_IDN_BUFFER_SIZE;
int32_t result=-1;
@@ -877,8 +877,8 @@ uidna_compare( const UChar *s1, int32_t length1,
b1Len = uidna_IDNToASCII(s1, length1, b1, b1Capacity, options, &parseError, status);
if(*status == U_BUFFER_OVERFLOW_ERROR){
// redo processing of string
- b1 = (UChar*) uprv_malloc(b1Len * U_SIZEOF_UCHAR);
- if(b1==NULL){
+ b1 = (char16_t*) uprv_malloc(b1Len * U_SIZEOF_UCHAR);
+ if(b1==nullptr){
*status = U_MEMORY_ALLOCATION_ERROR;
goto CLEANUP;
}
@@ -892,8 +892,8 @@ uidna_compare( const UChar *s1, int32_t length1,
b2Len = uidna_IDNToASCII(s2,length2, b2,b2Capacity, options, &parseError, status);
if(*status == U_BUFFER_OVERFLOW_ERROR){
// redo processing of string
- b2 = (UChar*) uprv_malloc(b2Len * U_SIZEOF_UCHAR);
- if(b2==NULL){
+ b2 = (char16_t*) uprv_malloc(b2Len * U_SIZEOF_UCHAR);
+ if(b2==nullptr){
*status = U_MEMORY_ALLOCATION_ERROR;
goto CLEANUP;
}
diff --git a/thirdparty/icu4c/common/uinvchar.cpp b/thirdparty/icu4c/common/uinvchar.cpp
index ffce3ec158..096a8e28d1 100644
--- a/thirdparty/icu4c/common/uinvchar.cpp
+++ b/thirdparty/icu4c/common/uinvchar.cpp
@@ -182,8 +182,8 @@ static const uint32_t invariantChars[4]={
U_CAPI void U_EXPORT2
-u_charsToUChars(const char *cs, UChar *us, int32_t length) {
- UChar u;
+u_charsToUChars(const char *cs, char16_t *us, int32_t length) {
+ char16_t u;
uint8_t c;
/*
@@ -193,7 +193,7 @@ u_charsToUChars(const char *cs, UChar *us, int32_t length) {
*/
while(length>0) {
c=(uint8_t)(*cs++);
- u=(UChar)CHAR_TO_UCHAR(c);
+ u=(char16_t)CHAR_TO_UCHAR(c);
U_ASSERT((u!=0 || c==0)); /* only invariant chars converted? */
*us++=u;
--length;
@@ -201,8 +201,8 @@ u_charsToUChars(const char *cs, UChar *us, int32_t length) {
}
U_CAPI void U_EXPORT2
-u_UCharsToChars(const UChar *us, char *cs, int32_t length) {
- UChar u;
+u_UCharsToChars(const char16_t *us, char *cs, int32_t length) {
+ char16_t u;
while(length>0) {
u=*us++;
@@ -260,8 +260,8 @@ uprv_isInvariantString(const char *s, int32_t length) {
}
U_CAPI UBool U_EXPORT2
-uprv_isInvariantUString(const UChar *s, int32_t length) {
- UChar c;
+uprv_isInvariantUString(const char16_t *s, int32_t length) {
+ char16_t c;
for(;;) {
if(length<0) {
@@ -303,10 +303,10 @@ uprv_ebcdicFromAscii(const UDataSwapper *ds,
int32_t count;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
+ if(ds==nullptr || inData==nullptr || length<0 || (length>0 && outData==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -340,10 +340,10 @@ uprv_copyAscii(const UDataSwapper *ds,
int32_t count;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
+ if(ds==nullptr || inData==nullptr || length<0 || (length>0 && outData==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -380,10 +380,10 @@ uprv_asciiFromEbcdic(const UDataSwapper *ds,
int32_t count;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
+ if(ds==nullptr || inData==nullptr || length<0 || (length>0 && outData==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -417,10 +417,10 @@ uprv_copyEbcdic(const UDataSwapper *ds,
int32_t count;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(ds==NULL || inData==NULL || length<0 || (length>0 && outData==NULL)) {
+ if(ds==nullptr || inData==nullptr || length<0 || (length>0 && outData==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -457,13 +457,13 @@ uprv_isEbcdicAtSign(char c) {
U_CFUNC int32_t
uprv_compareInvAscii(const UDataSwapper *ds,
const char *outString, int32_t outLength,
- const UChar *localString, int32_t localLength) {
+ const char16_t *localString, int32_t localLength) {
(void)ds;
int32_t minLength;
UChar32 c1, c2;
uint8_t c;
- if(outString==NULL || outLength<-1 || localString==NULL || localLength<-1) {
+ if(outString==nullptr || outLength<-1 || localString==nullptr || localLength<-1) {
return 0;
}
@@ -503,13 +503,13 @@ uprv_compareInvAscii(const UDataSwapper *ds,
U_CFUNC int32_t
uprv_compareInvEbcdic(const UDataSwapper *ds,
const char *outString, int32_t outLength,
- const UChar *localString, int32_t localLength) {
+ const char16_t *localString, int32_t localLength) {
(void)ds;
int32_t minLength;
UChar32 c1, c2;
uint8_t c;
- if(outString==NULL || outLength<-1 || localString==NULL || localLength<-1) {
+ if(outString==nullptr || outLength<-1 || localString==nullptr || localLength<-1) {
return 0;
}
diff --git a/thirdparty/icu4c/common/uiter.cpp b/thirdparty/icu4c/common/uiter.cpp
index c4ab7d6d56..be59eab2ee 100644
--- a/thirdparty/icu4c/common/uiter.cpp
+++ b/thirdparty/icu4c/common/uiter.cpp
@@ -74,7 +74,7 @@ static const UCharIterator noopIterator={
noopCurrent,
noopCurrent,
noopCurrent,
- NULL,
+ nullptr,
noopGetState,
noopSetState
};
@@ -82,14 +82,14 @@ static const UCharIterator noopIterator={
/* UCharIterator implementation for simple strings -------------------------- */
/*
- * This is an implementation of a code unit (UChar) iterator
- * for UChar * strings.
+ * This is an implementation of a code unit (char16_t) iterator
+ * for char16_t * strings.
*
* The UCharIterator.context field holds a pointer to the string.
*/
static int32_t U_CALLCONV
-stringIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) {
+stringIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) UPRV_NO_SANITIZE_UNDEFINED {
switch(origin) {
case UITER_ZERO:
return 0;
@@ -109,7 +109,7 @@ stringIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) {
}
static int32_t U_CALLCONV
-stringIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) {
+stringIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) UPRV_NO_SANITIZE_UNDEFINED {
int32_t pos;
switch(origin) {
@@ -154,7 +154,7 @@ stringIteratorHasPrevious(UCharIterator *iter) {
static UChar32 U_CALLCONV
stringIteratorCurrent(UCharIterator *iter) {
if(iter->index<iter->limit) {
- return ((const UChar *)(iter->context))[iter->index];
+ return ((const char16_t *)(iter->context))[iter->index];
} else {
return U_SENTINEL;
}
@@ -163,7 +163,7 @@ stringIteratorCurrent(UCharIterator *iter) {
static UChar32 U_CALLCONV
stringIteratorNext(UCharIterator *iter) {
if(iter->index<iter->limit) {
- return ((const UChar *)(iter->context))[iter->index++];
+ return ((const char16_t *)(iter->context))[iter->index++];
} else {
return U_SENTINEL;
}
@@ -172,7 +172,7 @@ stringIteratorNext(UCharIterator *iter) {
static UChar32 U_CALLCONV
stringIteratorPrevious(UCharIterator *iter) {
if(iter->index>iter->start) {
- return ((const UChar *)(iter->context))[--iter->index];
+ return ((const char16_t *)(iter->context))[--iter->index];
} else {
return U_SENTINEL;
}
@@ -185,9 +185,9 @@ stringIteratorGetState(const UCharIterator *iter) {
static void U_CALLCONV
stringIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) {
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
/* do nothing */
- } else if(iter==NULL) {
+ } else if(iter==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
} else if((int32_t)state<iter->start || iter->limit<(int32_t)state) {
*pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
@@ -205,13 +205,13 @@ static const UCharIterator stringIterator={
stringIteratorCurrent,
stringIteratorNext,
stringIteratorPrevious,
- NULL,
+ nullptr,
stringIteratorGetState,
stringIteratorSetState
};
U_CAPI void U_EXPORT2
-uiter_setString(UCharIterator *iter, const UChar *s, int32_t length) {
+uiter_setString(UCharIterator *iter, const char16_t *s, int32_t length) {
if(iter!=0) {
if(s!=0 && length>=-1) {
*iter=stringIterator;
@@ -231,12 +231,12 @@ uiter_setString(UCharIterator *iter, const UChar *s, int32_t length) {
/* UCharIterator implementation for UTF-16BE strings ------------------------ */
/*
- * This is an implementation of a code unit (UChar) iterator
+ * This is an implementation of a code unit (char16_t) iterator
* for UTF-16BE strings, i.e., strings in byte-vectors where
- * each UChar is stored as a big-endian pair of bytes.
+ * each char16_t is stored as a big-endian pair of bytes.
*
* The UCharIterator.context field holds a pointer to the string.
- * Everything works just like with a normal UChar iterator (uiter_setString),
+ * Everything works just like with a normal char16_t iterator (uiter_setString),
* except that UChars are assembled from byte pairs.
*/
@@ -244,7 +244,7 @@ uiter_setString(UCharIterator *iter, const UChar *s, int32_t length) {
static inline UChar32
utf16BEIteratorGet(UCharIterator *iter, int32_t index) {
const uint8_t *p=(const uint8_t *)iter->context;
- return ((UChar)p[2*index]<<8)|(UChar)p[2*index+1];
+ return ((char16_t)p[2*index]<<8)|(char16_t)p[2*index+1];
}
static UChar32 U_CALLCONV
@@ -291,13 +291,13 @@ static const UCharIterator utf16BEIterator={
utf16BEIteratorCurrent,
utf16BEIteratorNext,
utf16BEIteratorPrevious,
- NULL,
+ nullptr,
stringIteratorGetState,
stringIteratorSetState
};
/*
- * Count the number of UChars in a UTF-16BE string before a terminating UChar NUL,
+ * Count the number of UChars in a UTF-16BE string before a terminating char16_t NUL,
* i.e., before a pair of 0 bytes where the first 0 byte is at an even
* offset from s.
*/
@@ -306,10 +306,10 @@ utf16BE_strlen(const char *s) {
if(IS_POINTER_EVEN(s)) {
/*
* even-aligned, call u_strlen(s)
- * we are probably on a little-endian machine, but searching for UChar NUL
+ * we are probably on a little-endian machine, but searching for char16_t NUL
* does not care about endianness
*/
- return u_strlen((const UChar *)s);
+ return u_strlen((const char16_t *)s);
} else {
/* odd-aligned, search for pair of 0 bytes */
const char *p=s;
@@ -323,15 +323,15 @@ utf16BE_strlen(const char *s) {
U_CAPI void U_EXPORT2
uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length) {
- if(iter!=NULL) {
+ if(iter!=nullptr) {
/* allow only even-length strings (the input length counts bytes) */
- if(s!=NULL && (length==-1 || (length>=0 && IS_EVEN(length)))) {
+ if(s!=nullptr && (length==-1 || (length>=0 && IS_EVEN(length)))) {
/* length/=2, except that >>=1 also works for -1 (-1/2==0, -1>>1==-1) */
length>>=1;
if(U_IS_BIG_ENDIAN && IS_POINTER_EVEN(s)) {
- /* big-endian machine and 2-aligned UTF-16BE string: use normal UChar iterator */
- uiter_setString(iter, (const UChar *)s, length);
+ /* big-endian machine and 2-aligned UTF-16BE string: use normal char16_t iterator */
+ uiter_setString(iter, (const char16_t *)s, length);
return;
}
@@ -359,7 +359,7 @@ uiter_setUTF16BE(UCharIterator *iter, const char *s, int32_t length) {
*/
static int32_t U_CALLCONV
-characterIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) {
+characterIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) UPRV_NO_SANITIZE_UNDEFINED {
switch(origin) {
case UITER_ZERO:
return 0;
@@ -379,7 +379,7 @@ characterIteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) {
}
static int32_t U_CALLCONV
-characterIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) {
+characterIteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) UPRV_NO_SANITIZE_UNDEFINED {
switch(origin) {
case UITER_ZERO:
((CharacterIterator *)(iter->context))->setIndex(delta);
@@ -445,9 +445,9 @@ characterIteratorGetState(const UCharIterator *iter) {
static void U_CALLCONV
characterIteratorSetState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) {
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
/* do nothing */
- } else if(iter==NULL || iter->context==NULL) {
+ } else if(iter==nullptr || iter->context==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
} else if((int32_t)state<((CharacterIterator *)(iter->context))->startIndex() || ((CharacterIterator *)(iter->context))->endIndex()<(int32_t)state) {
*pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
@@ -465,7 +465,7 @@ static const UCharIterator characterIteratorWrapper={
characterIteratorCurrent,
characterIteratorNext,
characterIteratorPrevious,
- NULL,
+ nullptr,
characterIteratorGetState,
characterIteratorSetState
};
@@ -485,7 +485,7 @@ uiter_setCharacterIterator(UCharIterator *iter, CharacterIterator *charIter) {
/* UCharIterator wrapper around Replaceable --------------------------------- */
/*
- * This is an implementation of a code unit (UChar) iterator
+ * This is an implementation of a code unit (char16_t) iterator
* based on a Replaceable object.
*
* The UCharIterator.context field holds a pointer to the Replaceable.
@@ -529,7 +529,7 @@ static const UCharIterator replaceableIterator={
replaceableIteratorCurrent,
replaceableIteratorNext,
replaceableIteratorPrevious,
- NULL,
+ nullptr,
stringIteratorGetState,
stringIteratorSetState
};
@@ -561,7 +561,7 @@ uiter_setReplaceable(UCharIterator *iter, const Replaceable *rep) {
/*
* Minimal implementation:
- * Maintain a single-UChar buffer for an additional surrogate.
+ * Maintain a single-char16_t buffer for an additional surrogate.
* The caller must not modify start and limit because they are used internally.
*
* Use UCharIterator fields as follows:
@@ -586,7 +586,7 @@ uiter_setReplaceable(UCharIterator *iter, const Replaceable *rep) {
*/
static int32_t U_CALLCONV
-utf8IteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) {
+utf8IteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) UPRV_NO_SANITIZE_UNDEFINED {
switch(origin) {
case UITER_ZERO:
case UITER_START:
@@ -666,7 +666,7 @@ utf8IteratorGetIndex(UCharIterator *iter, UCharIteratorOrigin origin) {
}
static int32_t U_CALLCONV
-utf8IteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) {
+utf8IteratorMove(UCharIterator *iter, int32_t delta, UCharIteratorOrigin origin) UPRV_NO_SANITIZE_UNDEFINED {
const uint8_t *s;
UChar32 c;
int32_t pos; /* requested UTF-16 index */
@@ -873,7 +873,7 @@ utf8IteratorNext(UCharIterator *iter) {
int32_t index;
if(iter->reservedField!=0) {
- UChar trail=U16_TRAIL(iter->reservedField);
+ char16_t trail=U16_TRAIL(iter->reservedField);
iter->reservedField=0;
if((index=iter->index)>=0) {
iter->index=index+1;
@@ -908,7 +908,7 @@ utf8IteratorPrevious(UCharIterator *iter) {
int32_t index;
if(iter->reservedField!=0) {
- UChar lead=U16_LEAD(iter->reservedField);
+ char16_t lead=U16_LEAD(iter->reservedField);
iter->reservedField=0;
iter->start-=4; /* we stayed behind the supplementary code point; go before it now */
if((index=iter->index)>0) {
@@ -951,9 +951,9 @@ utf8IteratorSetState(UCharIterator *iter,
uint32_t state,
UErrorCode *pErrorCode)
{
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
/* do nothing */
- } else if(iter==NULL) {
+ } else if(iter==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
} else if(state==utf8IteratorGetState(iter)) {
/* setting to the current state: no-op */
@@ -995,7 +995,7 @@ static const UCharIterator utf8Iterator={
utf8IteratorCurrent,
utf8IteratorNext,
utf8IteratorPrevious,
- NULL,
+ nullptr,
utf8IteratorGetState,
utf8IteratorSetState
};
@@ -1085,7 +1085,7 @@ uiter_previous32(UCharIterator *iter) {
U_CAPI uint32_t U_EXPORT2
uiter_getState(const UCharIterator *iter) {
- if(iter==NULL || iter->getState==NULL) {
+ if(iter==nullptr || iter->getState==nullptr) {
return UITER_NO_STATE;
} else {
return iter->getState(iter);
@@ -1094,11 +1094,11 @@ uiter_getState(const UCharIterator *iter) {
U_CAPI void U_EXPORT2
uiter_setState(UCharIterator *iter, uint32_t state, UErrorCode *pErrorCode) {
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
/* do nothing */
- } else if(iter==NULL) {
+ } else if(iter==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- } else if(iter->setState==NULL) {
+ } else if(iter->setState==nullptr) {
*pErrorCode=U_UNSUPPORTED_ERROR;
} else {
iter->setState(iter, state, pErrorCode);
diff --git a/thirdparty/icu4c/common/ulist.cpp b/thirdparty/icu4c/common/ulist.cpp
index 57344715de..5bdf534c84 100644
--- a/thirdparty/icu4c/common/ulist.cpp
+++ b/thirdparty/icu4c/common/ulist.cpp
@@ -34,21 +34,21 @@ struct UList {
static void ulist_addFirstItem(UList *list, UListNode *newItem);
U_CAPI UList *U_EXPORT2 ulist_createEmptyList(UErrorCode *status) {
- UList *newList = NULL;
+ UList *newList = nullptr;
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
newList = (UList *)uprv_malloc(sizeof(UList));
- if (newList == NULL) {
+ if (newList == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
- newList->curr = NULL;
- newList->head = NULL;
- newList->tail = NULL;
+ newList->curr = nullptr;
+ newList->head = nullptr;
+ newList->tail = nullptr;
newList->size = 0;
return newList;
@@ -59,20 +59,20 @@ U_CAPI UList *U_EXPORT2 ulist_createEmptyList(UErrorCode *status) {
* This function properly sets the pointers for the first item added.
*/
static void ulist_addFirstItem(UList *list, UListNode *newItem) {
- newItem->next = NULL;
- newItem->previous = NULL;
+ newItem->next = nullptr;
+ newItem->previous = nullptr;
list->head = newItem;
list->tail = newItem;
}
static void ulist_removeItem(UList *list, UListNode *p) {
- if (p->previous == NULL) {
+ if (p->previous == nullptr) {
// p is the list head.
list->head = p->next;
} else {
p->previous->next = p->next;
}
- if (p->next == NULL) {
+ if (p->next == nullptr) {
// p is the list tail.
list->tail = p->previous;
} else {
@@ -89,9 +89,9 @@ 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;
+ UListNode *newItem = nullptr;
- if (U_FAILURE(*status) || list == NULL || data == NULL) {
+ if (U_FAILURE(*status) || list == nullptr || data == nullptr) {
if (forceDelete) {
uprv_free((void *)data);
}
@@ -99,7 +99,7 @@ U_CAPI void U_EXPORT2 ulist_addItemEndList(UList *list, const void *data, UBool
}
newItem = (UListNode *)uprv_malloc(sizeof(UListNode));
- if (newItem == NULL) {
+ if (newItem == nullptr) {
if (forceDelete) {
uprv_free((void *)data);
}
@@ -112,7 +112,7 @@ U_CAPI void U_EXPORT2 ulist_addItemEndList(UList *list, const void *data, UBool
if (list->size == 0) {
ulist_addFirstItem(list, newItem);
} else {
- newItem->next = NULL;
+ newItem->next = nullptr;
newItem->previous = list->tail;
list->tail->next = newItem;
list->tail = newItem;
@@ -122,9 +122,9 @@ U_CAPI void U_EXPORT2 ulist_addItemEndList(UList *list, const void *data, UBool
}
U_CAPI void U_EXPORT2 ulist_addItemBeginList(UList *list, const void *data, UBool forceDelete, UErrorCode *status) {
- UListNode *newItem = NULL;
+ UListNode *newItem = nullptr;
- if (U_FAILURE(*status) || list == NULL || data == NULL) {
+ if (U_FAILURE(*status) || list == nullptr || data == nullptr) {
if (forceDelete) {
uprv_free((void *)data);
}
@@ -132,7 +132,7 @@ U_CAPI void U_EXPORT2 ulist_addItemBeginList(UList *list, const void *data, UBoo
}
newItem = (UListNode *)uprv_malloc(sizeof(UListNode));
- if (newItem == NULL) {
+ if (newItem == nullptr) {
if (forceDelete) {
uprv_free((void *)data);
}
@@ -145,7 +145,7 @@ U_CAPI void U_EXPORT2 ulist_addItemBeginList(UList *list, const void *data, UBoo
if (list->size == 0) {
ulist_addFirstItem(list, newItem);
} else {
- newItem->previous = NULL;
+ newItem->previous = nullptr;
newItem->next = list->head;
list->head->previous = newItem;
list->head = newItem;
@@ -155,9 +155,9 @@ U_CAPI void U_EXPORT2 ulist_addItemBeginList(UList *list, const void *data, UBoo
}
U_CAPI UBool U_EXPORT2 ulist_containsString(const UList *list, const char *data, int32_t length) {
- if (list != NULL) {
+ if (list != nullptr) {
const UListNode *pointer;
- for (pointer = list->head; pointer != NULL; pointer = pointer->next) {
+ for (pointer = list->head; pointer != nullptr; pointer = pointer->next) {
if (length == (int32_t)uprv_strlen((const char *)pointer->data)) {
if (uprv_memcmp(data, pointer->data, length) == 0) {
return true;
@@ -169,9 +169,9 @@ U_CAPI UBool U_EXPORT2 ulist_containsString(const UList *list, const char *data,
}
U_CAPI UBool U_EXPORT2 ulist_removeString(UList *list, const char *data) {
- if (list != NULL) {
+ if (list != nullptr) {
UListNode *pointer;
- for (pointer = list->head; pointer != NULL; pointer = pointer->next) {
+ for (pointer = list->head; pointer != nullptr; pointer = pointer->next) {
if (uprv_strcmp(data, (const char *)pointer->data) == 0) {
ulist_removeItem(list, pointer);
// Remove only the first occurrence, like Java LinkedList.remove(Object).
@@ -183,10 +183,10 @@ U_CAPI UBool U_EXPORT2 ulist_removeString(UList *list, const char *data) {
}
U_CAPI void *U_EXPORT2 ulist_getNext(UList *list) {
- UListNode *curr = NULL;
+ UListNode *curr = nullptr;
- if (list == NULL || list->curr == NULL) {
- return NULL;
+ if (list == nullptr || list->curr == nullptr) {
+ return nullptr;
}
curr = list->curr;
@@ -196,7 +196,7 @@ U_CAPI void *U_EXPORT2 ulist_getNext(UList *list) {
}
U_CAPI int32_t U_EXPORT2 ulist_getListSize(const UList *list) {
- if (list != NULL) {
+ if (list != nullptr) {
return list->size;
}
@@ -204,17 +204,17 @@ U_CAPI int32_t U_EXPORT2 ulist_getListSize(const UList *list) {
}
U_CAPI void U_EXPORT2 ulist_resetList(UList *list) {
- if (list != NULL) {
+ if (list != nullptr) {
list->curr = list->head;
}
}
U_CAPI void U_EXPORT2 ulist_deleteList(UList *list) {
- UListNode *listHead = NULL;
+ UListNode *listHead = nullptr;
- if (list != NULL) {
+ if (list != nullptr) {
listHead = list->head;
- while (listHead != NULL) {
+ while (listHead != nullptr) {
UListNode *listPointer = listHead->next;
if (listHead->forceDelete) {
@@ -225,12 +225,12 @@ U_CAPI void U_EXPORT2 ulist_deleteList(UList *list) {
listHead = listPointer;
}
uprv_free(list);
- list = NULL;
+ list = nullptr;
}
}
U_CAPI void U_EXPORT2 ulist_close_keyword_values_iterator(UEnumeration *en) {
- if (en != NULL) {
+ if (en != nullptr) {
ulist_deleteList((UList *)(en->context));
uprv_free(en);
}
@@ -247,11 +247,11 @@ U_CAPI int32_t U_EXPORT2 ulist_count_keyword_values(UEnumeration *en, UErrorCode
U_CAPI const char * U_EXPORT2 ulist_next_keyword_value(UEnumeration *en, int32_t *resultLength, UErrorCode *status) {
const char *s;
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
s = (const char *)ulist_getNext((UList *)(en->context));
- if (s != NULL && resultLength != NULL) {
+ if (s != nullptr && resultLength != nullptr) {
*resultLength = static_cast<int32_t>(uprv_strlen(s));
}
return s;
diff --git a/thirdparty/icu4c/common/uloc.cpp b/thirdparty/icu4c/common/uloc.cpp
index 1da2abc361..395df1466e 100644
--- a/thirdparty/icu4c/common/uloc.cpp
+++ b/thirdparty/icu4c/common/uloc.cpp
@@ -56,7 +56,7 @@ U_NAMESPACE_USE
/* Locale stuff from locid.cpp */
U_CFUNC void locale_set_default(const char *id);
-U_CFUNC const char *locale_get_default(void);
+U_CFUNC const char *locale_get_default();
/* ### Data tables **************************************************/
@@ -71,8 +71,8 @@ U_CFUNC const char *locale_get_default(void);
* This list must be kept in sync with LANGUAGES_3, with corresponding
* entries matched.
*
- * This table should be terminated with a NULL entry, followed by a
- * second list, and another NULL entry. The first list is visible to
+ * This table should be terminated with a nullptr entry, followed by a
+ * second list, and another nullptr entry. The first list is visible to
* user code when this array is returned by API. The second list
* contains codes we support, but do not expose through user API.
*
@@ -180,16 +180,16 @@ static const char * const LANGUAGES[] = {
"yao", "yap", "yav", "ybb", "yi", "yo", "yrl", "yue",
"za", "zap", "zbl", "zea", "zen", "zgh", "zh", "zu",
"zun", "zxx", "zza",
-NULL,
+nullptr,
"in", "iw", "ji", "jw", "mo", "sh", "swc", "tl", /* obsolete language codes */
-NULL
+nullptr
};
static const char* const DEPRECATED_LANGUAGES[]={
- "in", "iw", "ji", "jw", "mo", NULL, NULL
+ "in", "iw", "ji", "jw", "mo", nullptr, nullptr
};
static const char* const REPLACEMENT_LANGUAGES[]={
- "id", "he", "yi", "jv", "ro", NULL, NULL
+ "id", "he", "yi", "jv", "ro", nullptr, nullptr
};
/**
@@ -204,8 +204,8 @@ static const char* const REPLACEMENT_LANGUAGES[]={
* Where a 3-letter language code has no 2-letter equivalent, the
* 3-letter code occupies both LANGUAGES[i] and LANGUAGES_3[i].
*
- * This table should be terminated with a NULL entry, followed by a
- * second list, and another NULL entry. The two lists correspond to
+ * This table should be terminated with a nullptr entry, followed by a
+ * second list, and another nullptr entry. The two lists correspond to
* the two lists in LANGUAGES.
*/
/* Generated using org.unicode.cldr.icu.GenerateISO639LanguageTables */
@@ -297,10 +297,10 @@ static const char * const LANGUAGES_3[] = {
"yao", "yap", "yav", "ybb", "yid", "yor", "yrl", "yue",
"zha", "zap", "zbl", "zea", "zen", "zgh", "zho", "zul",
"zun", "zxx", "zza",
-NULL,
+nullptr,
/* "in", "iw", "ji", "jw", "mo", "sh", "swc", "tl", */
"ind", "heb", "yid", "jaw", "mol", "srp", "swc", "tgl",
-NULL
+nullptr
};
/**
@@ -312,8 +312,8 @@ NULL
* This list must be kept in sync with COUNTRIES_3, with corresponding
* entries matched.
*
- * This table should be terminated with a NULL entry, followed by a
- * second list, and another NULL entry. The first list is visible to
+ * This table should be terminated with a nullptr entry, followed by a
+ * second list, and another nullptr entry. The first list is visible to
* user code when this array is returned by API. The second list
* contains codes we support, but do not expose through user API.
*
@@ -333,7 +333,7 @@ static const char * const COUNTRIES[] = {
"BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI",
"BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV",
"BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG",
- "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR",
+ "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CQ", "CR",
"CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DG", "DJ", "DK",
"DM", "DO", "DZ", "EA", "EC", "EE", "EG", "EH", "ER",
"ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR",
@@ -358,17 +358,17 @@ static const char * const COUNTRIES[] = {
"TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ",
"VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF",
"WS", "XK", "YE", "YT", "ZA", "ZM", "ZW",
-NULL,
+nullptr,
"AN", "BU", "CS", "FX", "RO", "SU", "TP", "YD", "YU", "ZR", /* obsolete country codes */
-NULL
+nullptr
};
static const char* const DEPRECATED_COUNTRIES[] = {
- "AN", "BU", "CS", "DD", "DY", "FX", "HV", "NH", "RH", "SU", "TP", "UK", "VD", "YD", "YU", "ZR", NULL, NULL /* deprecated country list */
+ "AN", "BU", "CS", "DD", "DY", "FX", "HV", "NH", "RH", "SU", "TP", "UK", "VD", "YD", "YU", "ZR", nullptr, nullptr /* deprecated country list */
};
static const char* const REPLACEMENT_COUNTRIES[] = {
/* "AN", "BU", "CS", "DD", "DY", "FX", "HV", "NH", "RH", "SU", "TP", "UK", "VD", "YD", "YU", "ZR" */
- "CW", "MM", "RS", "DE", "BJ", "FR", "BF", "VU", "ZW", "RU", "TL", "GB", "VN", "YE", "RS", "CD", NULL, NULL /* replacement country codes */
+ "CW", "MM", "RS", "DE", "BJ", "FR", "BF", "VU", "ZW", "RU", "TL", "GB", "VN", "YE", "RS", "CD", nullptr, nullptr /* replacement country codes */
};
/**
@@ -380,8 +380,8 @@ static const char* const REPLACEMENT_COUNTRIES[] = {
* COUNTRIES_3[i]. The commented-out lines are copied from COUNTRIES
* to make eyeballing this baby easier.
*
- * This table should be terminated with a NULL entry, followed by a
- * second list, and another NULL entry. The two lists correspond to
+ * This table should be terminated with a nullptr entry, followed by a
+ * second list, and another nullptr entry. The two lists correspond to
* the two lists in COUNTRIES.
*/
static const char * const COUNTRIES_3[] = {
@@ -395,8 +395,8 @@ static const char * const COUNTRIES_3[] = {
"BEN", "BLM", "BMU", "BRN", "BOL", "BES", "BRA", "BHS", "BTN", "BVT",
/* "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", */
"BWA", "BLR", "BLZ", "CAN", "CCK", "COD", "CAF", "COG",
-/* "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", */
- "CHE", "CIV", "COK", "CHL", "CMR", "CHN", "COL", "CRI",
+/* "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CQ", "CR", */
+ "CHE", "CIV", "COK", "CHL", "CMR", "CHN", "COL", "CRQ", "CRI",
/* "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DG", "DJ", "DK", */
"CUB", "CPV", "CUW", "CXR", "CYP", "CZE", "DEU", "DGA", "DJI", "DNK",
/* "DM", "DO", "DZ", "EA", "EC", "EE", "EG", "EH", "ER", */
@@ -445,10 +445,10 @@ static const char * const COUNTRIES_3[] = {
"VAT", "VCT", "VEN", "VGB", "VIR", "VNM", "VUT", "WLF",
/* "WS", "XK", "YE", "YT", "ZA", "ZM", "ZW", */
"WSM", "XKK", "YEM", "MYT", "ZAF", "ZMB", "ZWE",
-NULL,
+nullptr,
/* "AN", "BU", "CS", "FX", "RO", "SU", "TP", "YD", "YU", "ZR" */
"ANT", "BUR", "SCG", "FXX", "ROM", "SUN", "TMP", "YMD", "YUG", "ZAR",
-NULL
+nullptr
};
typedef struct CanonicalizationMap {
@@ -476,13 +476,13 @@ static const CanonicalizationMap CANONICALIZE_MAP[] = {
/* ### BCP47 Conversion *******************************************/
/* Test if the locale id has BCP47 u extension and does not have '@' */
-#define _hasBCP47Extension(id) (id && uprv_strstr(id, "@") == NULL && getShortestSubtagLength(localeID) == 1)
+#define _hasBCP47Extension(id) (id && uprv_strstr(id, "@") == nullptr && getShortestSubtagLength(localeID) == 1)
/* Converts the BCP47 id to Unicode id. Does nothing to id if conversion fails */
static const char* _ConvertBCP47(
const char* id, char* buffer, int32_t length,
UErrorCode* err, int32_t* pLocaleIdSize) {
const char* finalID;
- int32_t localeIDSize = uloc_forLanguageTag(id, buffer, length, NULL, err);
+ int32_t localeIDSize = uloc_forLanguageTag(id, buffer, length, nullptr, err);
if (localeIDSize <= 0 || U_FAILURE(*err) || *err == U_STRING_NOT_TERMINATED_WARNING) {
finalID=id;
if (*err == U_STRING_NOT_TERMINATED_WARNING) {
@@ -533,8 +533,8 @@ static int32_t getShortestSubtagLength(const char *localeID) {
U_CAPI const char * U_EXPORT2
locale_getKeywordsStart(const char *localeID) {
- const char *result = NULL;
- if((result = uprv_strchr(localeID, '@')) != NULL) {
+ const char *result = nullptr;
+ if((result = uprv_strchr(localeID, '@')) != nullptr) {
return result;
}
#if (U_CHARSET_FAMILY == U_EBCDIC_FAMILY)
@@ -545,14 +545,14 @@ locale_getKeywordsStart(const char *localeID) {
static const uint8_t ebcdicSigns[] = { 0x7C, 0x44, 0x66, 0x80, 0xAC, 0xAE, 0xAF, 0xB5, 0xEC, 0xEF, 0x00 };
const uint8_t *charToFind = ebcdicSigns;
while(*charToFind) {
- if((result = uprv_strchr(localeID, *charToFind)) != NULL) {
+ if((result = uprv_strchr(localeID, *charToFind)) != nullptr) {
return result;
}
charToFind++;
}
}
#endif
- return NULL;
+ return nullptr;
}
/**
@@ -613,8 +613,8 @@ ulocimp_getKeywords(const char *localeID,
int32_t maxKeywords = ULOC_MAX_NO_KEYWORDS;
int32_t numKeywords = 0;
const char* pos = localeID;
- const char* equalSign = NULL;
- const char* semicolon = NULL;
+ const char* equalSign = nullptr;
+ const char* semicolon = nullptr;
int32_t i = 0, j, n;
if(prev == '@') { /* start of keyword definition */
@@ -704,7 +704,7 @@ ulocimp_getKeywords(const char *localeID,
/* now we have a list of keywords */
/* we need to sort it */
- uprv_sortArray(keywordList, numKeywords, sizeof(KeywordStruct), compareKeywordStructs, NULL, false, status);
+ uprv_sortArray(keywordList, numKeywords, sizeof(KeywordStruct), compareKeywordStructs, nullptr, false, status);
/* Now construct the keyword part */
for(i = 0; i < numKeywords; i++) {
@@ -756,8 +756,8 @@ ulocimp_getKeywordValue(const char* localeID,
icu::ByteSink& sink,
UErrorCode* status)
{
- const char* startSearchHere = NULL;
- const char* nextSeparator = NULL;
+ const char* startSearchHere = nullptr;
+ const char* nextSeparator = nullptr;
char keywordNameBuffer[ULOC_KEYWORD_BUFFER_LEN];
char localeKeywordNameBuffer[ULOC_KEYWORD_BUFFER_LEN];
@@ -765,7 +765,7 @@ ulocimp_getKeywordValue(const char* localeID,
char tempBuffer[ULOC_FULLNAME_CAPACITY];
const char* tmpLocaleID;
- if (keywordName == NULL || keywordName[0] == 0) {
+ if (keywordName == nullptr || keywordName[0] == 0) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -783,7 +783,7 @@ ulocimp_getKeywordValue(const char* localeID,
}
startSearchHere = locale_getKeywordsStart(tmpLocaleID);
- if(startSearchHere == NULL) {
+ if(startSearchHere == nullptr) {
/* no keywords, return at once */
return;
}
@@ -876,10 +876,10 @@ uloc_setKeywordValue(const char* keywordName,
char keywordValueBuffer[ULOC_KEYWORDS_CAPACITY+1];
char localeKeywordNameBuffer[ULOC_KEYWORD_BUFFER_LEN];
int32_t rc;
- char* nextSeparator = NULL;
- char* nextEqualsign = NULL;
- char* startSearchHere = NULL;
- char* keywordStart = NULL;
+ char* nextSeparator = nullptr;
+ char* nextEqualsign = nullptr;
+ char* startSearchHere = nullptr;
+ char* keywordStart = nullptr;
CharString updatedKeysAndValues;
UBool handledInputKeyAndValue = false;
char keyValuePrefix = '@';
@@ -890,13 +890,13 @@ uloc_setKeywordValue(const char* keywordName,
if (*status == U_STRING_NOT_TERMINATED_WARNING) {
*status = U_ZERO_ERROR;
}
- if (keywordName == NULL || keywordName[0] == 0 || bufferCapacity <= 1) {
+ if (keywordName == nullptr || keywordName[0] == 0 || bufferCapacity <= 1) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
bufLen = (int32_t)uprv_strlen(buffer);
if(bufferCapacity<bufLen) {
- /* The capacity is less than the length?! Is this NULL terminated? */
+ /* The capacity is less than the length?! Is this NUL terminated? */
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -925,7 +925,7 @@ uloc_setKeywordValue(const char* keywordName,
keywordValueBuffer[keywordValueLen] = 0; /* terminate */
startSearchHere = (char*)locale_getKeywordsStart(buffer);
- if(startSearchHere == NULL || (startSearchHere[1]==0)) {
+ if(startSearchHere == nullptr || (startSearchHere[1]==0)) {
if(keywordValueLen == 0) { /* no keywords = nothing to remove */
U_ASSERT(*status != U_STRING_NOT_TERMINATED_WARNING);
return bufLen;
@@ -1100,7 +1100,7 @@ uloc_setKeywordValue(const char* keywordName,
/**
* Lookup 'key' in the array 'list'. The array 'list' should contain
- * a NULL entry, followed by more entries, and a second NULL entry.
+ * a nullptr entry, followed by more entries, and a second nullptr entry.
*
* The 'list' param should be LANGUAGES, LANGUAGES_3, COUNTRIES, or
* COUNTRIES_3.
@@ -1110,7 +1110,7 @@ static int16_t _findIndex(const char* const* list, const char* key)
const char* const* anchor = list;
int32_t pass = 0;
- /* Make two passes through two NULL-terminated arrays at 'list' */
+ /* Make two passes through two nullptr-terminated arrays at 'list' */
while (pass++ < 2) {
while (*list) {
if (uprv_strcmp(key, *list) == 0) {
@@ -1118,7 +1118,7 @@ static int16_t _findIndex(const char* const* list, const char* key)
}
list++;
}
- ++list; /* skip final NULL *CWB*/
+ ++list; /* skip final nullptr *CWB*/
}
return -1;
}
@@ -1185,7 +1185,7 @@ ulocimp_getLanguage(const char *localeID,
}
}
- if(pEnd!=NULL) {
+ if(pEnd!=nullptr) {
*pEnd=localeID;
}
@@ -1199,7 +1199,7 @@ ulocimp_getScript(const char *localeID,
CharString result;
int32_t idLen = 0;
- if (pEnd != NULL) {
+ if (pEnd != nullptr) {
*pEnd = localeID;
}
@@ -1212,7 +1212,7 @@ ulocimp_getScript(const char *localeID,
/* If it's exactly 4 characters long, then it's a script and not a country. */
if (idLen == 4) {
int32_t i;
- if (pEnd != NULL) {
+ if (pEnd != nullptr) {
*pEnd = localeID+idLen;
}
if (idLen >= 1) {
@@ -1254,7 +1254,7 @@ ulocimp_getCountry(const char *localeID,
result.clear();
}
- if(pEnd!=NULL) {
+ if(pEnd!=nullptr) {
*pEnd=localeID;
}
@@ -1292,7 +1292,7 @@ _getVariant(const char *localeID,
if(!hasVariant) {
if(prev=='@') {
/* keep localeID */
- } else if((localeID=locale_getKeywordsStart(localeID))!=NULL) {
+ } else if((localeID=locale_getKeywordsStart(localeID))!=nullptr) {
++localeID; /* point after the '@' */
} else {
return;
@@ -1347,7 +1347,7 @@ uloc_kw_nextKeyword(UEnumeration* en,
len = (int32_t)uprv_strlen(((UKeywordsContext *)en->context)->current);
((UKeywordsContext *)en->context)->current += len+1;
} else {
- result = NULL;
+ result = nullptr;
}
if (resultLength) {
*resultLength = len;
@@ -1365,8 +1365,8 @@ U_CDECL_END
static const UEnumeration gKeywordsEnum = {
- NULL,
- NULL,
+ nullptr,
+ nullptr,
uloc_kw_closeKeywords,
uloc_kw_countKeywords,
uenum_unextDefault,
@@ -1409,7 +1409,7 @@ uloc_openKeywords(const char* localeID,
char tempBuffer[ULOC_FULLNAME_CAPACITY];
const char* tmpLocaleID;
- if(status==NULL || U_FAILURE(*status)) {
+ if(status==nullptr || U_FAILURE(*status)) {
return 0;
}
@@ -1417,7 +1417,7 @@ uloc_openKeywords(const char* localeID,
tmpLocaleID = _ConvertBCP47(localeID, tempBuffer,
sizeof(tempBuffer), status, nullptr);
} else {
- if (localeID==NULL) {
+ if (localeID==nullptr) {
localeID=uloc_getDefault();
}
tmpLocaleID=localeID;
@@ -1450,16 +1450,16 @@ uloc_openKeywords(const char* localeID,
}
/* keywords are located after '@' */
- if((tmpLocaleID = locale_getKeywordsStart(tmpLocaleID)) != NULL) {
+ if((tmpLocaleID = locale_getKeywordsStart(tmpLocaleID)) != nullptr) {
CharString keywords;
CharStringByteSink sink(&keywords);
ulocimp_getKeywords(tmpLocaleID+1, '@', sink, false, status);
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
return uloc_openKeywordList(keywords.data(), keywords.length(), status);
}
- return NULL;
+ return nullptr;
}
@@ -1493,8 +1493,8 @@ _canonicalize(const char* localeID,
CharString localeIDWithHyphens; // if localeID has a BPC47 extension and have _, tmpLocaleID points to this
const char* origLocaleID;
const char* tmpLocaleID;
- const char* keywordAssign = NULL;
- const char* separatorIndicator = NULL;
+ const char* keywordAssign = nullptr;
+ const char* separatorIndicator = nullptr;
if (_hasBCP47Extension(localeID)) {
const char* localeIDPtr = localeID;
@@ -1520,7 +1520,7 @@ _canonicalize(const char* localeID,
&(tempBuffer.requestedCapacity));
} while (tempBuffer.needToTryAgain(err));
} else {
- if (localeID==NULL) {
+ if (localeID==nullptr) {
localeID=uloc_getDefault();
}
tmpLocaleID=localeID;
@@ -1602,15 +1602,15 @@ _canonicalize(const char* localeID,
}
/* Scan ahead to next '@' and determine if it is followed by '=' and/or ';'
- After this, tmpLocaleID either points to '@' or is NULL */
- if ((tmpLocaleID=locale_getKeywordsStart(tmpLocaleID))!=NULL) {
+ After this, tmpLocaleID either points to '@' or is nullptr */
+ if ((tmpLocaleID=locale_getKeywordsStart(tmpLocaleID))!=nullptr) {
keywordAssign = uprv_strchr(tmpLocaleID, '=');
separatorIndicator = uprv_strchr(tmpLocaleID, ';');
}
/* Copy POSIX-style variant, if any [mr@FOO] */
if (!OPTION_SET(options, _ULOC_CANONICALIZE) &&
- tmpLocaleID != NULL && keywordAssign == NULL) {
+ tmpLocaleID != nullptr && keywordAssign == nullptr) {
for (;;) {
char c = *tmpLocaleID;
if (c == 0) {
@@ -1623,7 +1623,7 @@ _canonicalize(const char* localeID,
if (OPTION_SET(options, _ULOC_CANONICALIZE)) {
/* Handle @FOO variant if @ is present and not followed by = */
- if (tmpLocaleID!=NULL && keywordAssign==NULL) {
+ if (tmpLocaleID!=nullptr && keywordAssign==nullptr) {
/* Add missing '_' if needed */
if (fieldCount < 2 || (fieldCount < 3 && scriptSize > 0)) {
do {
@@ -1647,7 +1647,7 @@ _canonicalize(const char* localeID,
for (j=0; j<UPRV_LENGTHOF(CANONICALIZE_MAP); j++) {
StringPiece id(CANONICALIZE_MAP[j].id);
if (tag == id) {
- if (id.empty() && tmpLocaleID != NULL) {
+ if (id.empty() && tmpLocaleID != nullptr) {
break; /* Don't remap "" if keywords present */
}
tag.clear();
@@ -1660,7 +1660,7 @@ _canonicalize(const char* localeID,
sink.Append(tag.data(), tag.length());
if (!OPTION_SET(options, _ULOC_STRIP_KEYWORDS)) {
- if (tmpLocaleID!=NULL && keywordAssign!=NULL &&
+ if (tmpLocaleID!=nullptr && keywordAssign!=nullptr &&
(!separatorIndicator || separatorIndicator > keywordAssign)) {
sink.Append("@", 1);
++fieldCount;
@@ -1683,11 +1683,11 @@ uloc_getParent(const char* localeID,
if (U_FAILURE(*err))
return 0;
- if (localeID == NULL)
+ if (localeID == nullptr)
localeID = uloc_getDefault();
lastUnderscore=uprv_strrchr(localeID, '_');
- if(lastUnderscore!=NULL) {
+ if(lastUnderscore!=nullptr) {
i=(int32_t)(lastUnderscore-localeID);
} else {
i=0;
@@ -1714,15 +1714,15 @@ uloc_getLanguage(const char* localeID,
{
/* uloc_getLanguage will return a 2 character iso-639 code if one exists. *CWB*/
- if (err==NULL || U_FAILURE(*err)) {
+ if (err==nullptr || U_FAILURE(*err)) {
return 0;
}
- if(localeID==NULL) {
+ if(localeID==nullptr) {
localeID=uloc_getDefault();
}
- return ulocimp_getLanguage(localeID, NULL, *err).extract(language, languageCapacity, *err);
+ return ulocimp_getLanguage(localeID, nullptr, *err).extract(language, languageCapacity, *err);
}
U_CAPI int32_t U_EXPORT2
@@ -1731,11 +1731,11 @@ uloc_getScript(const char* localeID,
int32_t scriptCapacity,
UErrorCode* err)
{
- if(err==NULL || U_FAILURE(*err)) {
+ if(err==nullptr || U_FAILURE(*err)) {
return 0;
}
- if(localeID==NULL) {
+ if(localeID==nullptr) {
localeID=uloc_getDefault();
}
@@ -1746,7 +1746,7 @@ uloc_getScript(const char* localeID,
}
if(_isIDSeparator(*localeID)) {
- return ulocimp_getScript(localeID+1, NULL, *err).extract(script, scriptCapacity, *err);
+ return ulocimp_getScript(localeID+1, nullptr, *err).extract(script, scriptCapacity, *err);
}
return u_terminateChars(script, scriptCapacity, 0, err);
}
@@ -1757,11 +1757,11 @@ uloc_getCountry(const char* localeID,
int32_t countryCapacity,
UErrorCode* err)
{
- if(err==NULL || U_FAILURE(*err)) {
+ if(err==nullptr || U_FAILURE(*err)) {
return 0;
}
- if(localeID==NULL) {
+ if(localeID==nullptr) {
localeID=uloc_getDefault();
}
@@ -1783,7 +1783,7 @@ uloc_getCountry(const char* localeID,
localeID = scriptID;
}
if(_isIDSeparator(*localeID)) {
- return ulocimp_getCountry(localeID+1, NULL, *err).extract(country, countryCapacity, *err);
+ return ulocimp_getCountry(localeID+1, nullptr, *err).extract(country, countryCapacity, *err);
}
}
return u_terminateChars(country, countryCapacity, 0, err);
@@ -1799,14 +1799,14 @@ uloc_getVariant(const char* localeID,
const char* tmpLocaleID;
int32_t i=0;
- if(err==NULL || U_FAILURE(*err)) {
+ if(err==nullptr || U_FAILURE(*err)) {
return 0;
}
if (_hasBCP47Extension(localeID)) {
tmpLocaleID =_ConvertBCP47(localeID, tempBuffer, sizeof(tempBuffer), err, nullptr);
} else {
- if (localeID==NULL) {
+ if (localeID==nullptr) {
localeID=uloc_getDefault();
}
tmpLocaleID=localeID;
@@ -1981,7 +1981,7 @@ uloc_getISO3Language(const char* localeID)
char lang[ULOC_LANG_CAPACITY];
UErrorCode err = U_ZERO_ERROR;
- if (localeID == NULL)
+ if (localeID == nullptr)
{
localeID = uloc_getDefault();
}
@@ -2001,7 +2001,7 @@ uloc_getISO3Country(const char* localeID)
char cntry[ULOC_LANG_CAPACITY];
UErrorCode err = U_ZERO_ERROR;
- if (localeID == NULL)
+ if (localeID == nullptr)
{
localeID = uloc_getDefault();
}
@@ -2134,7 +2134,7 @@ U_CAPI const char* U_EXPORT2
uloc_toUnicodeLocaleKey(const char* keyword)
{
const char* bcpKey = ulocimp_toBcpKey(keyword);
- if (bcpKey == NULL && ultag_isUnicodeLocaleKey(keyword, -1)) {
+ if (bcpKey == nullptr && ultag_isUnicodeLocaleKey(keyword, -1)) {
// unknown keyword, but syntax is fine..
return keyword;
}
@@ -2144,8 +2144,8 @@ uloc_toUnicodeLocaleKey(const char* keyword)
U_CAPI const char* U_EXPORT2
uloc_toUnicodeLocaleType(const char* keyword, const char* value)
{
- const char* bcpType = ulocimp_toBcpType(keyword, value, NULL, NULL);
- if (bcpType == NULL && ultag_isUnicodeLocaleType(value, -1)) {
+ const char* bcpType = ulocimp_toBcpType(keyword, value, nullptr, nullptr);
+ if (bcpType == nullptr && ultag_isUnicodeLocaleType(value, -1)) {
// unknown keyword, but syntax is fine..
return value;
}
@@ -2190,7 +2190,7 @@ U_CAPI const char* U_EXPORT2
uloc_toLegacyKey(const char* keyword)
{
const char* legacyKey = ulocimp_toLegacyKey(keyword);
- if (legacyKey == NULL) {
+ if (legacyKey == nullptr) {
// Checks if the specified locale key is well-formed with the legacy locale syntax.
//
// Note:
@@ -2208,8 +2208,8 @@ uloc_toLegacyKey(const char* keyword)
U_CAPI const char* U_EXPORT2
uloc_toLegacyType(const char* keyword, const char* value)
{
- const char* legacyType = ulocimp_toLegacyType(keyword, value, NULL, NULL);
- if (legacyType == NULL) {
+ const char* legacyType = ulocimp_toLegacyType(keyword, value, nullptr, nullptr);
+ if (legacyType == nullptr) {
// Checks if the specified locale type is well-formed with the legacy locale syntax.
//
// Note:
diff --git a/thirdparty/icu4c/common/uloc_keytype.cpp b/thirdparty/icu4c/common/uloc_keytype.cpp
index 12dc300492..a84b860907 100644
--- a/thirdparty/icu4c/common/uloc_keytype.cpp
+++ b/thirdparty/icu4c/common/uloc_keytype.cpp
@@ -23,7 +23,7 @@
#include "uvector.h"
#include "udataswp.h" /* for InvChar functions */
-static UHashtable* gLocExtKeyMap = NULL;
+static UHashtable* gLocExtKeyMap = nullptr;
static icu::UInitOnce gLocExtKeyMapInitOnce {};
// bit flags for special types
@@ -46,27 +46,27 @@ struct LocExtType : public icu::UMemory {
const char* bcpId;
};
-static icu::MemoryPool<icu::CharString>* gKeyTypeStringPool = NULL;
-static icu::MemoryPool<LocExtKeyData>* gLocExtKeyDataEntries = NULL;
-static icu::MemoryPool<LocExtType>* gLocExtTypeEntries = NULL;
+static icu::MemoryPool<icu::CharString>* gKeyTypeStringPool = nullptr;
+static icu::MemoryPool<LocExtKeyData>* gLocExtKeyDataEntries = nullptr;
+static icu::MemoryPool<LocExtType>* gLocExtTypeEntries = nullptr;
U_CDECL_BEGIN
static UBool U_CALLCONV
-uloc_key_type_cleanup(void) {
- if (gLocExtKeyMap != NULL) {
+uloc_key_type_cleanup() {
+ if (gLocExtKeyMap != nullptr) {
uhash_close(gLocExtKeyMap);
- gLocExtKeyMap = NULL;
+ gLocExtKeyMap = nullptr;
}
delete gLocExtKeyDataEntries;
- gLocExtKeyDataEntries = NULL;
+ gLocExtKeyDataEntries = nullptr;
delete gLocExtTypeEntries;
- gLocExtTypeEntries = NULL;
+ gLocExtTypeEntries = nullptr;
delete gKeyTypeStringPool;
- gKeyTypeStringPool = NULL;
+ gKeyTypeStringPool = nullptr;
gLocExtKeyMapInitOnce.reset();
return true;
@@ -80,34 +80,34 @@ initFromResourceBundle(UErrorCode& sts) {
U_NAMESPACE_USE
ucln_common_registerCleanup(UCLN_COMMON_LOCALE_KEY_TYPE, uloc_key_type_cleanup);
- gLocExtKeyMap = uhash_open(uhash_hashIChars, uhash_compareIChars, NULL, &sts);
+ gLocExtKeyMap = uhash_open(uhash_hashIChars, uhash_compareIChars, nullptr, &sts);
- LocalUResourceBundlePointer keyTypeDataRes(ures_openDirect(NULL, "keyTypeData", &sts));
- LocalUResourceBundlePointer keyMapRes(ures_getByKey(keyTypeDataRes.getAlias(), "keyMap", NULL, &sts));
- LocalUResourceBundlePointer typeMapRes(ures_getByKey(keyTypeDataRes.getAlias(), "typeMap", NULL, &sts));
+ LocalUResourceBundlePointer keyTypeDataRes(ures_openDirect(nullptr, "keyTypeData", &sts));
+ LocalUResourceBundlePointer keyMapRes(ures_getByKey(keyTypeDataRes.getAlias(), "keyMap", nullptr, &sts));
+ LocalUResourceBundlePointer typeMapRes(ures_getByKey(keyTypeDataRes.getAlias(), "typeMap", nullptr, &sts));
if (U_FAILURE(sts)) {
return;
}
UErrorCode tmpSts = U_ZERO_ERROR;
- LocalUResourceBundlePointer typeAliasRes(ures_getByKey(keyTypeDataRes.getAlias(), "typeAlias", NULL, &tmpSts));
+ LocalUResourceBundlePointer typeAliasRes(ures_getByKey(keyTypeDataRes.getAlias(), "typeAlias", nullptr, &tmpSts));
tmpSts = U_ZERO_ERROR;
- LocalUResourceBundlePointer bcpTypeAliasRes(ures_getByKey(keyTypeDataRes.getAlias(), "bcpTypeAlias", NULL, &tmpSts));
+ LocalUResourceBundlePointer bcpTypeAliasRes(ures_getByKey(keyTypeDataRes.getAlias(), "bcpTypeAlias", nullptr, &tmpSts));
// initialize pools storing dynamically allocated objects
gKeyTypeStringPool = new icu::MemoryPool<icu::CharString>;
- if (gKeyTypeStringPool == NULL) {
+ if (gKeyTypeStringPool == nullptr) {
sts = U_MEMORY_ALLOCATION_ERROR;
return;
}
gLocExtKeyDataEntries = new icu::MemoryPool<LocExtKeyData>;
- if (gLocExtKeyDataEntries == NULL) {
+ if (gLocExtKeyDataEntries == nullptr) {
sts = U_MEMORY_ALLOCATION_ERROR;
return;
}
gLocExtTypeEntries = new icu::MemoryPool<LocExtType>;
- if (gLocExtTypeEntries == NULL) {
+ if (gLocExtTypeEntries == nullptr) {
sts = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -130,7 +130,7 @@ initFromResourceBundle(UErrorCode& sts) {
const char* bcpKeyId = legacyKeyId;
if (!uBcpKeyId.isEmpty()) {
icu::CharString* bcpKeyIdBuf = gKeyTypeStringPool->create();
- if (bcpKeyIdBuf == NULL) {
+ if (bcpKeyIdBuf == nullptr) {
sts = U_MEMORY_ALLOCATION_ERROR;
break;
}
@@ -143,7 +143,7 @@ initFromResourceBundle(UErrorCode& sts) {
UBool isTZ = uprv_strcmp(legacyKeyId, "timezone") == 0;
- UHashtable* typeDataMap = uhash_open(uhash_hashIChars, uhash_compareIChars, NULL, &sts);
+ UHashtable* typeDataMap = uhash_open(uhash_hashIChars, uhash_compareIChars, nullptr, &sts);
if (U_FAILURE(sts)) {
break;
}
@@ -154,21 +154,21 @@ initFromResourceBundle(UErrorCode& sts) {
if (typeAliasRes.isValid()) {
tmpSts = U_ZERO_ERROR;
- typeAliasResByKey.adoptInstead(ures_getByKey(typeAliasRes.getAlias(), legacyKeyId, NULL, &tmpSts));
+ typeAliasResByKey.adoptInstead(ures_getByKey(typeAliasRes.getAlias(), legacyKeyId, nullptr, &tmpSts));
if (U_FAILURE(tmpSts)) {
typeAliasResByKey.orphan();
}
}
if (bcpTypeAliasRes.isValid()) {
tmpSts = U_ZERO_ERROR;
- bcpTypeAliasResByKey.adoptInstead(ures_getByKey(bcpTypeAliasRes.getAlias(), bcpKeyId, NULL, &tmpSts));
+ bcpTypeAliasResByKey.adoptInstead(ures_getByKey(bcpTypeAliasRes.getAlias(), bcpKeyId, nullptr, &tmpSts));
if (U_FAILURE(tmpSts)) {
bcpTypeAliasResByKey.orphan();
}
}
// look up type map for the key, and walk through the mapping data
- LocalUResourceBundlePointer typeMapResByKey(ures_getByKey(typeMapRes.getAlias(), legacyKeyId, NULL, &sts));
+ LocalUResourceBundlePointer typeMapResByKey(ures_getByKey(typeMapRes.getAlias(), legacyKeyId, nullptr, &sts));
if (U_FAILURE(sts)) {
// We fail here if typeMap does not have an entry corresponding to every entry in keyMap (should
// not happen for valid keyTypeData), or if ures_getByKeyfails fails for some other reason
@@ -202,10 +202,10 @@ initFromResourceBundle(UErrorCode& sts) {
if (isTZ) {
// a timezone key uses a colon instead of a slash in the resource.
// e.g. America:Los_Angeles
- if (uprv_strchr(legacyTypeId, ':') != NULL) {
+ if (uprv_strchr(legacyTypeId, ':') != nullptr) {
icu::CharString* legacyTypeIdBuf =
gKeyTypeStringPool->create(legacyTypeId, sts);
- if (legacyTypeIdBuf == NULL) {
+ if (legacyTypeIdBuf == nullptr) {
sts = U_MEMORY_ALLOCATION_ERROR;
break;
}
@@ -229,7 +229,7 @@ initFromResourceBundle(UErrorCode& sts) {
const char* bcpTypeId = legacyTypeId;
if (!uBcpTypeId.isEmpty()) {
icu::CharString* bcpTypeIdBuf = gKeyTypeStringPool->create();
- if (bcpTypeIdBuf == NULL) {
+ if (bcpTypeIdBuf == nullptr) {
sts = U_MEMORY_ALLOCATION_ERROR;
break;
}
@@ -245,7 +245,7 @@ initFromResourceBundle(UErrorCode& sts) {
// type under the same key. So we use a single
// map for lookup.
LocExtType* t = gLocExtTypeEntries->create();
- if (t == NULL) {
+ if (t == nullptr) {
sts = U_MEMORY_ALLOCATION_ERROR;
break;
}
@@ -269,19 +269,19 @@ initFromResourceBundle(UErrorCode& sts) {
while (ures_hasNext(typeAliasResByKey.getAlias()) && U_SUCCESS(sts)) {
int32_t toLen;
typeAliasDataEntry.adoptInstead(ures_getNextResource(typeAliasResByKey.getAlias(), typeAliasDataEntry.orphan(), &sts));
- const UChar* to = ures_getString(typeAliasDataEntry.getAlias(), &toLen, &sts);
+ const char16_t* to = ures_getString(typeAliasDataEntry.getAlias(), &toLen, &sts);
if (U_FAILURE(sts)) {
break;
}
// check if this is an alias of canonical legacy type
- if (uprv_compareInvWithUChar(NULL, legacyTypeId, -1, to, toLen) == 0) {
+ if (uprv_compareInvWithUChar(nullptr, legacyTypeId, -1, to, toLen) == 0) {
const char* from = ures_getKey(typeAliasDataEntry.getAlias());
if (isTZ) {
// replace colon with slash if necessary
- if (uprv_strchr(from, ':') != NULL) {
+ if (uprv_strchr(from, ':') != nullptr) {
icu::CharString* fromBuf =
gKeyTypeStringPool->create(from, sts);
- if (fromBuf == NULL) {
+ if (fromBuf == nullptr) {
sts = U_MEMORY_ALLOCATION_ERROR;
break;
}
@@ -310,12 +310,12 @@ initFromResourceBundle(UErrorCode& sts) {
while (ures_hasNext(bcpTypeAliasResByKey.getAlias()) && U_SUCCESS(sts)) {
int32_t toLen;
bcpTypeAliasDataEntry.adoptInstead(ures_getNextResource(bcpTypeAliasResByKey.getAlias(), bcpTypeAliasDataEntry.orphan(), &sts));
- const UChar* to = ures_getString(bcpTypeAliasDataEntry.getAlias(), &toLen, &sts);
+ const char16_t* to = ures_getString(bcpTypeAliasDataEntry.getAlias(), &toLen, &sts);
if (U_FAILURE(sts)) {
break;
}
// check if this is an alias of bcp type
- if (uprv_compareInvWithUChar(NULL, bcpTypeId, -1, to, toLen) == 0) {
+ if (uprv_compareInvWithUChar(nullptr, bcpTypeId, -1, to, toLen) == 0) {
const char* from = ures_getKey(bcpTypeAliasDataEntry.getAlias());
uhash_put(typeDataMap, (void*)from, t, &sts);
}
@@ -331,7 +331,7 @@ initFromResourceBundle(UErrorCode& sts) {
}
LocExtKeyData* keyData = gLocExtKeyDataEntries->create();
- if (keyData == NULL) {
+ if (keyData == nullptr) {
sts = U_MEMORY_ALLOCATION_ERROR;
break;
}
@@ -422,49 +422,49 @@ isSpecialTypeRgKeyValue(const char* val) {
U_CFUNC const char*
ulocimp_toBcpKey(const char* key) {
if (!init()) {
- return NULL;
+ return nullptr;
}
LocExtKeyData* keyData = (LocExtKeyData*)uhash_get(gLocExtKeyMap, key);
- if (keyData != NULL) {
+ if (keyData != nullptr) {
return keyData->bcpId;
}
- return NULL;
+ return nullptr;
}
U_CFUNC const char*
ulocimp_toLegacyKey(const char* key) {
if (!init()) {
- return NULL;
+ return nullptr;
}
LocExtKeyData* keyData = (LocExtKeyData*)uhash_get(gLocExtKeyMap, key);
- if (keyData != NULL) {
+ if (keyData != nullptr) {
return keyData->legacyId;
}
- return NULL;
+ return nullptr;
}
U_CFUNC const char*
ulocimp_toBcpType(const char* key, const char* type, UBool* isKnownKey, UBool* isSpecialType) {
- if (isKnownKey != NULL) {
+ if (isKnownKey != nullptr) {
*isKnownKey = false;
}
- if (isSpecialType != NULL) {
+ if (isSpecialType != nullptr) {
*isSpecialType = false;
}
if (!init()) {
- return NULL;
+ return nullptr;
}
LocExtKeyData* keyData = (LocExtKeyData*)uhash_get(gLocExtKeyMap, key);
- if (keyData != NULL) {
- if (isKnownKey != NULL) {
+ if (keyData != nullptr) {
+ if (isKnownKey != nullptr) {
*isKnownKey = true;
}
LocExtType* t = (LocExtType*)uhash_get(keyData->typeMap.getAlias(), type);
- if (t != NULL) {
+ if (t != nullptr) {
return t->bcpId;
}
if (keyData->specialTypes != SPECIALTYPE_NONE) {
@@ -479,37 +479,37 @@ ulocimp_toBcpType(const char* key, const char* type, UBool* isKnownKey, UBool* i
matched = isSpecialTypeRgKeyValue(type);
}
if (matched) {
- if (isSpecialType != NULL) {
+ if (isSpecialType != nullptr) {
*isSpecialType = true;
}
return type;
}
}
}
- return NULL;
+ return nullptr;
}
U_CFUNC const char*
ulocimp_toLegacyType(const char* key, const char* type, UBool* isKnownKey, UBool* isSpecialType) {
- if (isKnownKey != NULL) {
+ if (isKnownKey != nullptr) {
*isKnownKey = false;
}
- if (isSpecialType != NULL) {
+ if (isSpecialType != nullptr) {
*isSpecialType = false;
}
if (!init()) {
- return NULL;
+ return nullptr;
}
LocExtKeyData* keyData = (LocExtKeyData*)uhash_get(gLocExtKeyMap, key);
- if (keyData != NULL) {
- if (isKnownKey != NULL) {
+ if (keyData != nullptr) {
+ if (isKnownKey != nullptr) {
*isKnownKey = true;
}
LocExtType* t = (LocExtType*)uhash_get(keyData->typeMap.getAlias(), type);
- if (t != NULL) {
+ if (t != nullptr) {
return t->legacyId;
}
if (keyData->specialTypes != SPECIALTYPE_NONE) {
@@ -524,13 +524,13 @@ ulocimp_toLegacyType(const char* key, const char* type, UBool* isKnownKey, UBool
matched = isSpecialTypeRgKeyValue(type);
}
if (matched) {
- if (isSpecialType != NULL) {
+ if (isSpecialType != nullptr) {
*isSpecialType = true;
}
return type;
}
}
}
- return NULL;
+ return nullptr;
}
diff --git a/thirdparty/icu4c/common/uloc_tag.cpp b/thirdparty/icu4c/common/uloc_tag.cpp
index 01a0e0028f..43d597549f 100644
--- a/thirdparty/icu4c/common/uloc_tag.cpp
+++ b/thirdparty/icu4c/common/uloc_tag.cpp
@@ -501,7 +501,7 @@ _isVariantSubtag(const char* s, int32_t len) {
static UBool
_isSepListOf(UBool (*test)(const char*, int32_t), const char* s, int32_t len) {
const char *p = s;
- const char *pSubtag = NULL;
+ const char *pSubtag = nullptr;
if (len < 0) {
len = (int32_t)uprv_strlen(s);
@@ -509,19 +509,19 @@ _isSepListOf(UBool (*test)(const char*, int32_t), const char* s, int32_t len) {
while ((p - s) < len) {
if (*p == SEP) {
- if (pSubtag == NULL) {
+ if (pSubtag == nullptr) {
return false;
}
if (!test(pSubtag, (int32_t)(p - pSubtag))) {
return false;
}
- pSubtag = NULL;
- } else if (pSubtag == NULL) {
+ pSubtag = nullptr;
+ } else if (pSubtag == nullptr) {
pSubtag = p;
}
p++;
}
- if (pSubtag == NULL) {
+ if (pSubtag == nullptr) {
return false;
}
return test(pSubtag, (int32_t)(p - pSubtag));
@@ -837,20 +837,20 @@ static UBool
_addVariantToList(VariantListEntry **first, VariantListEntry *var) {
UBool bAdded = true;
- if (*first == NULL) {
- var->next = NULL;
+ if (*first == nullptr) {
+ var->next = nullptr;
*first = var;
} else {
VariantListEntry *prev, *cur;
int32_t cmp;
/* variants order should be preserved */
- prev = NULL;
+ prev = nullptr;
cur = *first;
while (true) {
- if (cur == NULL) {
+ if (cur == nullptr) {
prev->next = var;
- var->next = NULL;
+ var->next = nullptr;
break;
}
@@ -873,25 +873,25 @@ static UBool
_addAttributeToList(AttributeListEntry **first, AttributeListEntry *attr) {
UBool bAdded = true;
- if (*first == NULL) {
- attr->next = NULL;
+ if (*first == nullptr) {
+ attr->next = nullptr;
*first = attr;
} else {
AttributeListEntry *prev, *cur;
int32_t cmp;
/* reorder variants in alphabetical order */
- prev = NULL;
+ prev = nullptr;
cur = *first;
while (true) {
- if (cur == NULL) {
+ if (cur == nullptr) {
prev->next = attr;
- attr->next = NULL;
+ attr->next = nullptr;
break;
}
cmp = uprv_compareInvCharsAsAscii(attr->attribute, cur->attribute);
if (cmp < 0) {
- if (prev == NULL) {
+ if (prev == nullptr) {
*first = attr;
} else {
prev->next = attr;
@@ -917,20 +917,20 @@ static UBool
_addExtensionToList(ExtensionListEntry **first, ExtensionListEntry *ext, UBool localeToBCP) {
UBool bAdded = true;
- if (*first == NULL) {
- ext->next = NULL;
+ if (*first == nullptr) {
+ ext->next = nullptr;
*first = ext;
} else {
ExtensionListEntry *prev, *cur;
int32_t cmp;
/* reorder variants in alphabetical order */
- prev = NULL;
+ prev = nullptr;
cur = *first;
while (true) {
- if (cur == NULL) {
+ if (cur == nullptr) {
prev->next = ext;
- ext->next = NULL;
+ ext->next = nullptr;
break;
}
if (localeToBCP) {
@@ -969,7 +969,7 @@ _addExtensionToList(ExtensionListEntry **first, ExtensionListEntry *ext, UBool l
cmp = uprv_compareInvCharsAsAscii(ext->key, cur->key);
}
if (cmp < 0) {
- if (prev == NULL) {
+ if (prev == nullptr) {
*first = ext;
} else {
prev->next = ext;
@@ -994,18 +994,18 @@ static void
_initializeULanguageTag(ULanguageTag* langtag) {
int32_t i;
- langtag->buf = NULL;
+ langtag->buf = nullptr;
langtag->language = EMPTY;
for (i = 0; i < MAXEXTLANG; i++) {
- langtag->extlang[i] = NULL;
+ langtag->extlang[i] = nullptr;
}
langtag->script = EMPTY;
langtag->region = EMPTY;
- langtag->variants = NULL;
- langtag->extensions = NULL;
+ langtag->variants = nullptr;
+ langtag->extensions = nullptr;
langtag->legacy = EMPTY;
langtag->privateuse = EMPTY;
@@ -1132,8 +1132,8 @@ _appendRegionToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool stri
}
static void _sortVariants(VariantListEntry* first) {
- for (VariantListEntry* var1 = first; var1 != NULL; var1 = var1->next) {
- for (VariantListEntry* var2 = var1->next; var2 != NULL; var2 = var2->next) {
+ for (VariantListEntry* var1 = first; var1 != nullptr; var1 = var1->next) {
+ for (VariantListEntry* var2 = var1->next; var2 != nullptr; var2 = var2->next) {
// Swap var1->variant and var2->variant.
if (uprv_compareInvCharsAsAscii(var1->variant, var2->variant) > 0) {
const char* temp = var1->variant;
@@ -1166,9 +1166,9 @@ _appendVariantsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
char *p, *pVar;
UBool bNext = true;
VariantListEntry *var;
- VariantListEntry *varFirst = NULL;
+ VariantListEntry *varFirst = nullptr;
- pVar = NULL;
+ pVar = nullptr;
p = buf;
while (bNext) {
if (*p == SEP || *p == LOCALE_SEP || *p == 0) {
@@ -1177,7 +1177,7 @@ _appendVariantsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
} else {
*p = 0; /* terminate */
}
- if (pVar == NULL) {
+ if (pVar == nullptr) {
if (strict) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
break;
@@ -1195,7 +1195,7 @@ _appendVariantsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
if (uprv_strcmp(pVar,POSIX_VALUE) || len != (int32_t)uprv_strlen(POSIX_VALUE)) {
/* emit the variant to the list */
var = (VariantListEntry*)uprv_malloc(sizeof(VariantListEntry));
- if (var == NULL) {
+ if (var == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
break;
}
@@ -1222,15 +1222,15 @@ _appendVariantsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
}
}
/* reset variant starting position */
- pVar = NULL;
- } else if (pVar == NULL) {
+ pVar = nullptr;
+ } else if (pVar == nullptr) {
pVar = p;
}
p++;
}
if (U_SUCCESS(*status)) {
- if (varFirst != NULL) {
+ if (varFirst != nullptr) {
int32_t varLen;
/* per UTS35, we should sort the variants */
@@ -1238,7 +1238,7 @@ _appendVariantsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
/* write out validated/normalized variants to the target */
var = varFirst;
- while (var != NULL) {
+ while (var != nullptr) {
sink.Append("-", 1);
varLen = (int32_t)uprv_strlen(var->variant);
sink.Append(var->variant, varLen);
@@ -1249,7 +1249,7 @@ _appendVariantsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
/* clean up */
var = varFirst;
- while (var != NULL) {
+ while (var != nullptr) {
VariantListEntry *tmpVar = var->next;
uprv_free(var);
var = tmpVar;
@@ -1278,9 +1278,9 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
/* reorder extensions */
int32_t len;
const char *key;
- ExtensionListEntry *firstExt = NULL;
+ ExtensionListEntry *firstExt = nullptr;
ExtensionListEntry *ext;
- AttributeListEntry *firstAttr = NULL;
+ AttributeListEntry *firstAttr = nullptr;
AttributeListEntry *attr;
icu::MemoryPool<icu::CharString> extBufPool;
const char *bcpKey=nullptr, *bcpValue=nullptr;
@@ -1289,8 +1289,8 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
UBool isBcpUExt;
while (true) {
- key = uenum_next(keywordEnum.getAlias(), NULL, status);
- if (key == NULL) {
+ key = uenum_next(keywordEnum.getAlias(), nullptr, status);
+ if (key == nullptr) {
break;
}
@@ -1341,13 +1341,13 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
/* create AttributeListEntry */
attr = attrPool.create();
- if (attr == NULL) {
+ if (attr == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
break;
}
icu::CharString* attrValue =
strPool.create(attrBuf, attrBufLength, *status);
- if (attrValue == NULL) {
+ if (attrValue == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
break;
}
@@ -1365,11 +1365,11 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
}
/* for a place holder ExtensionListEntry */
bcpKey = LOCALE_ATTRIBUTE_KEY;
- bcpValue = NULL;
+ bcpValue = nullptr;
}
} else if (isBcpUExt) {
bcpKey = uloc_toUnicodeLocaleKey(key);
- if (bcpKey == NULL) {
+ if (bcpKey == nullptr) {
if (strict) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
break;
@@ -1379,7 +1379,7 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
/* we've checked buf is null-terminated above */
bcpValue = uloc_toUnicodeLocaleType(key, buf.data());
- if (bcpValue == NULL) {
+ if (bcpValue == nullptr) {
if (strict) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
break;
@@ -1441,7 +1441,7 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
/* create ExtensionListEntry */
ext = extPool.create();
- if (ext == NULL) {
+ if (ext == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
break;
}
@@ -1460,7 +1460,7 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
if (hadPosix) {
/* create ExtensionListEntry for POSIX */
ext = extPool.create();
- if (ext == NULL) {
+ if (ext == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1472,7 +1472,7 @@ _appendKeywordsToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool st
}
}
- if (U_SUCCESS(*status) && (firstExt != NULL || firstAttr != NULL)) {
+ if (U_SUCCESS(*status) && (firstExt != nullptr || firstAttr != nullptr)) {
UBool startLDMLExtension = false;
for (ext = firstExt; ext; ext = ext->next) {
if (!startLDMLExtension && uprv_strlen(ext->key) > 1) {
@@ -1514,7 +1514,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
const char *pKwds; /* beginning of key-type pairs */
UBool variantExists = *posixVariant;
- ExtensionListEntry *kwdFirst = NULL; /* first LDML keyword */
+ ExtensionListEntry *kwdFirst = nullptr; /* first LDML keyword */
ExtensionListEntry *kwd, *nextKwd;
int32_t len;
@@ -1523,10 +1523,10 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
*posixVariant = false;
pTag = ldmlext;
- pKwds = NULL;
+ pKwds = nullptr;
{
- AttributeListEntry *attrFirst = NULL; /* first attribute */
+ AttributeListEntry *attrFirst = nullptr; /* first attribute */
AttributeListEntry *attr, *nextAttr;
char attrBuf[ULOC_KEYWORD_AND_VALUES_CAPACITY];
@@ -1546,7 +1546,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
/* add this attribute to the list */
attr = attrPool.create();
- if (attr == NULL) {
+ if (attr == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1576,20 +1576,20 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
/* emit attributes as an LDML keyword, e.g. attribute=attr1-attr2 */
kwd = extPool.create();
- if (kwd == NULL) {
+ if (kwd == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return;
}
icu::CharString* value = kwdBuf.create();
- if (value == NULL) {
+ if (value == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return;
}
/* attribute subtags sorted in alphabetical order as type */
attr = attrFirst;
- while (attr != NULL) {
+ while (attr != nullptr) {
nextAttr = attr->next;
if (attr != attrFirst) {
value->append('-', *status);
@@ -1612,8 +1612,8 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
}
if (pKwds) {
- const char *pBcpKey = NULL; /* u extension key subtag */
- const char *pBcpType = NULL; /* beginning of u extension type subtag(s) */
+ const char *pBcpKey = nullptr; /* u extension key subtag */
+ const char *pBcpType = nullptr; /* beginning of u extension type subtag(s) */
int32_t bcpKeyLen = 0;
int32_t bcpTypeLen = 0;
UBool isDone = false;
@@ -1621,7 +1621,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
pTag = pKwds;
/* BCP47 representation of LDML key/type pairs */
while (!isDone) {
- const char *pNextBcpKey = NULL;
+ const char *pNextBcpKey = nullptr;
int32_t nextBcpKeyLen = 0;
UBool emitKeyword = false;
@@ -1639,7 +1639,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
bcpKeyLen = len;
}
} else {
- U_ASSERT(pBcpKey != NULL);
+ U_ASSERT(pBcpKey != nullptr);
/* within LDML type subtags */
if (pBcpType) {
bcpTypeLen += (len + 1);
@@ -1662,12 +1662,12 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
}
if (emitKeyword) {
- const char *pKey = NULL; /* LDML key */
- const char *pType = NULL; /* LDML type */
+ const char *pKey = nullptr; /* LDML key */
+ const char *pType = nullptr; /* LDML type */
char bcpKeyBuf[3]; /* BCP key length is always 2 for now */
- U_ASSERT(pBcpKey != NULL);
+ U_ASSERT(pBcpKey != nullptr);
if (bcpKeyLen >= (int32_t)sizeof(bcpKeyBuf)) {
/* the BCP key is invalid */
@@ -1681,7 +1681,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
/* u extension key to LDML key */
pKey = uloc_toLegacyKey(bcpKeyBuf);
- if (pKey == NULL) {
+ if (pKey == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -1692,7 +1692,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
*/
T_CString_toLowerCase(bcpKeyBuf);
icu::CharString* key = kwdBuf.create(bcpKeyBuf, bcpKeyLen, *status);
- if (key == NULL) {
+ if (key == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1715,7 +1715,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
/* BCP type to locale type */
pType = uloc_toLegacyType(pKey, bcpTypeBuf);
- if (pType == NULL) {
+ if (pType == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -1727,7 +1727,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
/* normalize to lower case */
T_CString_toLowerCase(bcpTypeBuf);
icu::CharString* type = kwdBuf.create(bcpTypeBuf, bcpTypeLen, *status);
- if (type == NULL) {
+ if (type == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1748,7 +1748,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
} else {
/* create an ExtensionListEntry for this keyword */
kwd = extPool.create();
- if (kwd == NULL) {
+ if (kwd == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1763,15 +1763,15 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
}
pBcpKey = pNextBcpKey;
- bcpKeyLen = pNextBcpKey != NULL ? nextBcpKeyLen : 0;
- pBcpType = NULL;
+ bcpKeyLen = pNextBcpKey != nullptr ? nextBcpKeyLen : 0;
+ pBcpType = nullptr;
bcpTypeLen = 0;
}
}
}
kwd = kwdFirst;
- while (kwd != NULL) {
+ while (kwd != nullptr) {
nextKwd = kwd->next;
_addExtensionToList(appendTo, kwd, false);
kwd = nextKwd;
@@ -1783,7 +1783,7 @@ static void
_appendKeywords(ULanguageTag* langtag, icu::ByteSink& sink, UErrorCode* status) {
int32_t i, n;
int32_t len;
- ExtensionListEntry *kwdFirst = NULL;
+ ExtensionListEntry *kwdFirst = nullptr;
ExtensionListEntry *kwd;
const char *key, *type;
icu::MemoryPool<ExtensionListEntry> extPool;
@@ -1812,7 +1812,7 @@ _appendKeywords(ULanguageTag* langtag, icu::ByteSink& sink, UErrorCode* status)
}
} else {
kwd = extPool.create();
- if (kwd == NULL) {
+ if (kwd == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
break;
}
@@ -1830,7 +1830,7 @@ _appendKeywords(ULanguageTag* langtag, icu::ByteSink& sink, UErrorCode* status)
if ((int32_t)uprv_strlen(type) > 0) {
/* add private use as a keyword */
kwd = extPool.create();
- if (kwd == NULL) {
+ if (kwd == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
} else {
kwd->key = PRIVATEUSE_KEY;
@@ -1849,7 +1849,7 @@ _appendKeywords(ULanguageTag* langtag, icu::ByteSink& sink, UErrorCode* status)
sink.Append(_POSIX, len);
}
- if (U_SUCCESS(*status) && kwdFirst != NULL) {
+ if (U_SUCCESS(*status) && kwdFirst != nullptr) {
/* write out the sorted keywords */
UBool firstValue = true;
kwd = kwdFirst;
@@ -1903,7 +1903,7 @@ _appendPrivateuseToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool
UBool firstValue = true;
UBool writeValue;
- pPriv = NULL;
+ pPriv = nullptr;
p = buf;
while (bNext) {
writeValue = false;
@@ -1913,7 +1913,7 @@ _appendPrivateuseToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool
} else {
*p = 0; /* terminate */
}
- if (pPriv != NULL) {
+ if (pPriv != nullptr) {
/* Private use in the canonical format is lowercase in BCP47 */
for (i = 0; *(pPriv + i) != 0; i++) {
*(pPriv + i) = uprv_tolower(*(pPriv + i));
@@ -1970,8 +1970,8 @@ _appendPrivateuseToLanguageTag(const char* localeID, icu::ByteSink& sink, UBool
}
}
/* reset private use starting position */
- pPriv = NULL;
- } else if (pPriv == NULL) {
+ pPriv = nullptr;
+ } else if (pPriv == nullptr) {
pPriv = p;
}
p++;
@@ -2029,12 +2029,12 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
UBool privateuseVar = false;
int32_t legacyLen = 0;
- if (parsedLen != NULL) {
+ if (parsedLen != nullptr) {
*parsedLen = 0;
}
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
if (tagLen < 0) {
@@ -2043,9 +2043,9 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
/* copy the entire string */
tagBuf = (char*)uprv_malloc(tagLen + 1);
- if (tagBuf == NULL) {
+ if (tagBuf == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
if (tagLen > 0) {
@@ -2059,7 +2059,7 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
if (t.isNull()) {
uprv_free(tagBuf);
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
_initializeULanguageTag(t.getAlias());
t->buf = tagBuf;
@@ -2093,9 +2093,9 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
if (tagLen < newTagLength) {
uprv_free(tagBuf);
tagBuf = (char*)uprv_malloc(newTagLength + 1);
- if (tagBuf == NULL) {
+ if (tagBuf == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
t->buf = tagBuf;
tagLen = newTagLength;
@@ -2154,9 +2154,9 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
next = LANG | PRIV;
pNext = pLastGoodPosition = tagBuf;
extlangIdx = 0;
- pExtension = NULL;
- pExtValueSubtag = NULL;
- pExtValueSubtagEnd = NULL;
+ pExtension = nullptr;
+ pExtValueSubtag = nullptr;
+ pExtValueSubtagEnd = nullptr;
while (pNext) {
char *pSep;
@@ -2173,7 +2173,7 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
}
if (*pSep == 0) {
/* last subtag */
- pNext = NULL;
+ pNext = nullptr;
} else {
pNext = pSep + 1;
}
@@ -2244,9 +2244,9 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
UBool isAdded;
var = (VariantListEntry*)uprv_malloc(sizeof(VariantListEntry));
- if (var == NULL) {
+ if (var == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
*pSep = 0;
var->variant = T_CString_toUpperCase(pSubtag);
@@ -2263,11 +2263,11 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
}
if (next & EXTS) {
if (_isExtensionSingleton(pSubtag, subtagLen)) {
- if (pExtension != NULL) {
- if (pExtValueSubtag == NULL || pExtValueSubtagEnd == NULL) {
+ if (pExtension != nullptr) {
+ if (pExtValueSubtag == nullptr || pExtValueSubtagEnd == nullptr) {
/* the previous extension is incomplete */
uprv_free(pExtension);
- pExtension = NULL;
+ pExtension = nullptr;
break;
}
@@ -2281,27 +2281,27 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
} else {
/* stop parsing here */
uprv_free(pExtension);
- pExtension = NULL;
+ pExtension = nullptr;
break;
}
}
/* create a new extension */
pExtension = (ExtensionListEntry*)uprv_malloc(sizeof(ExtensionListEntry));
- if (pExtension == NULL) {
+ if (pExtension == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
*pSep = 0;
pExtension->key = T_CString_toLowerCase(pSubtag);
- pExtension->value = NULL; /* will be set later */
+ pExtension->value = nullptr; /* will be set later */
/*
* reset the start and the end location of extension value
* subtags for this extension
*/
- pExtValueSubtag = NULL;
- pExtValueSubtagEnd = NULL;
+ pExtValueSubtag = nullptr;
+ pExtValueSubtagEnd = nullptr;
next = EXTV;
continue;
@@ -2309,7 +2309,7 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
}
if (next & EXTV) {
if (_isExtensionSubtag(pSubtag, subtagLen)) {
- if (pExtValueSubtag == NULL) {
+ if (pExtValueSubtag == nullptr) {
/* if the start position of this extension's value is not yet,
this one is the first value subtag */
pExtValueSubtag = pSubtag;
@@ -2326,12 +2326,12 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
if (uprv_tolower(*pSubtag) == PRIVATEUSE && subtagLen == 1) {
char *pPrivuseVal;
- if (pExtension != NULL) {
+ if (pExtension != nullptr) {
/* Process the last extension */
- if (pExtValueSubtag == NULL || pExtValueSubtagEnd == NULL) {
+ if (pExtValueSubtag == nullptr || pExtValueSubtagEnd == nullptr) {
/* the previous extension is incomplete */
uprv_free(pExtension);
- pExtension = NULL;
+ pExtension = nullptr;
break;
} else {
/* terminate the previous extension value */
@@ -2341,18 +2341,18 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
/* insert the extension to the list */
if (_addExtensionToList(&(t->extensions), pExtension, false)) {
pLastGoodPosition = pExtValueSubtagEnd;
- pExtension = NULL;
+ pExtension = nullptr;
} else {
/* stop parsing here */
uprv_free(pExtension);
- pExtension = NULL;
+ pExtension = nullptr;
break;
}
}
}
/* The rest of part will be private use value subtags */
- if (pNext == NULL) {
+ if (pNext == nullptr) {
/* empty private use subtag */
break;
}
@@ -2371,7 +2371,7 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
}
if (*pSep == 0) {
/* last subtag */
- pNext = NULL;
+ pNext = nullptr;
} else {
pNext = pSep + 1;
}
@@ -2407,9 +2407,9 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
break;
}
- if (pExtension != NULL) {
+ if (pExtension != nullptr) {
/* Process the last extension */
- if (pExtValueSubtag == NULL || pExtValueSubtagEnd == NULL) {
+ if (pExtValueSubtag == nullptr || pExtValueSubtagEnd == nullptr) {
/* the previous extension is incomplete */
uprv_free(pExtension);
} else {
@@ -2425,7 +2425,7 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
}
}
- if (parsedLen != NULL) {
+ if (parsedLen != nullptr) {
*parsedLen = (int32_t)(pLastGoodPosition - t->buf + parsedLenDelta);
}
@@ -2440,7 +2440,7 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
static void
ultag_close(ULanguageTag* langtag) {
- if (langtag == NULL) {
+ if (langtag == nullptr) {
return;
}
@@ -2476,7 +2476,7 @@ ultag_getLanguage(const ULanguageTag* langtag) {
static const char*
ultag_getJDKLanguage(const ULanguageTag* langtag) {
int32_t i;
- for (i = 0; DEPRECATEDLANGS[i] != NULL; i += 2) {
+ for (i = 0; DEPRECATEDLANGS[i] != nullptr; i += 2) {
if (uprv_compareInvCharsAsAscii(DEPRECATEDLANGS[i], langtag->language) == 0) {
return DEPRECATEDLANGS[i + 1];
}
@@ -2490,7 +2490,7 @@ ultag_getExtlang(const ULanguageTag* langtag, int32_t idx) {
if (idx >= 0 && idx < MAXEXTLANG) {
return langtag->extlang[idx];
}
- return NULL;
+ return nullptr;
}
static int32_t
@@ -2517,7 +2517,7 @@ ultag_getRegion(const ULanguageTag* langtag) {
static const char*
ultag_getVariant(const ULanguageTag* langtag, int32_t idx) {
- const char *var = NULL;
+ const char *var = nullptr;
VariantListEntry *cur = langtag->variants;
int32_t i = 0;
while (cur) {
@@ -2536,7 +2536,7 @@ ultag_getVariantsSize(const ULanguageTag* langtag) {
int32_t size = 0;
VariantListEntry *cur = langtag->variants;
while (true) {
- if (cur == NULL) {
+ if (cur == nullptr) {
break;
}
size++;
@@ -2547,7 +2547,7 @@ ultag_getVariantsSize(const ULanguageTag* langtag) {
static const char*
ultag_getExtensionKey(const ULanguageTag* langtag, int32_t idx) {
- const char *key = NULL;
+ const char *key = nullptr;
ExtensionListEntry *cur = langtag->extensions;
int32_t i = 0;
while (cur) {
@@ -2563,7 +2563,7 @@ ultag_getExtensionKey(const ULanguageTag* langtag, int32_t idx) {
static const char*
ultag_getExtensionValue(const ULanguageTag* langtag, int32_t idx) {
- const char *val = NULL;
+ const char *val = nullptr;
ExtensionListEntry *cur = langtag->extensions;
int32_t i = 0;
while (cur) {
@@ -2582,7 +2582,7 @@ ultag_getExtensionsSize(const ULanguageTag* langtag) {
int32_t size = 0;
ExtensionListEntry *cur = langtag->extensions;
while (true) {
- if (cur == NULL) {
+ if (cur == nullptr) {
break;
}
size++;
diff --git a/thirdparty/icu4c/common/ulocimp.h b/thirdparty/icu4c/common/ulocimp.h
index 755e02c6b8..48341054e3 100644
--- a/thirdparty/icu4c/common/ulocimp.h
+++ b/thirdparty/icu4c/common/ulocimp.h
@@ -333,10 +333,10 @@ public:
int32_t requestedCapacity = ULOC_FULLNAME_CAPACITY;
// No heap allocation. Use only on the stack.
- static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete;
- static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete;
+ static void* U_EXPORT2 operator new(size_t) noexcept = delete;
+ static void* U_EXPORT2 operator new[](size_t) noexcept = delete;
#if U_HAVE_PLACEMENT_NEW
- static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete;
+ static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete;
#endif
PreflightingLocaleIDBuffer() {}
diff --git a/thirdparty/icu4c/common/umapfile.cpp b/thirdparty/icu4c/common/umapfile.cpp
index 145582ea97..faa6d80786 100644
--- a/thirdparty/icu4c/common/umapfile.cpp
+++ b/thirdparty/icu4c/common/umapfile.cpp
@@ -147,7 +147,7 @@ typedef HANDLE MemoryMap;
// Convert from UTF-8 string to UTF-16 string.
wchar_t utf16Path[MAX_PATH];
int32_t pathUtf16Len = 0;
- u_strFromUTF8(reinterpret_cast<UChar*>(utf16Path), static_cast<int32_t>(UPRV_LENGTHOF(utf16Path)), &pathUtf16Len, path, -1, status);
+ u_strFromUTF8(reinterpret_cast<char16_t*>(utf16Path), static_cast<int32_t>(UPRV_LENGTHOF(utf16Path)), &pathUtf16Len, path, -1, status);
if (U_FAILURE(*status)) {
return false;
@@ -171,7 +171,7 @@ typedef HANDLE MemoryMap;
return false;
}
- // Note: We use NULL/nullptr for lpAttributes parameter below.
+ // Note: We use nullptr/nullptr for lpAttributes parameter below.
// This means our handle cannot be inherited and we will get the default security descriptor.
/* create an unnamed Windows file-mapping object for the specified file */
map = CreateFileMappingW(file, nullptr, PAGE_READONLY, 0, 0, nullptr);
diff --git a/thirdparty/icu4c/common/unames.cpp b/thirdparty/icu4c/common/unames.cpp
index b0ac991e1b..1b3192bf25 100644
--- a/thirdparty/icu4c/common/unames.cpp
+++ b/thirdparty/icu4c/common/unames.cpp
@@ -101,10 +101,10 @@ typedef struct {
UChar32 code;
} FindName;
-#define DO_FIND_NAME NULL
+#define DO_FIND_NAME nullptr
-static UDataMemory *uCharNamesData=NULL;
-static UCharNames *uCharNames=NULL;
+static UDataMemory *uCharNamesData=nullptr;
+static UCharNames *uCharNames=nullptr;
static icu::UInitOnce gCharNamesInitOnce {};
/*
@@ -162,14 +162,14 @@ static const char * const charCatNames[U_CHAR_EXTENDED_CATEGORY_COUNT] = {
/* implementation ----------------------------------------------------------- */
-static UBool U_CALLCONV unames_cleanup(void)
+static UBool U_CALLCONV unames_cleanup()
{
if(uCharNamesData) {
udata_close(uCharNamesData);
- uCharNamesData = NULL;
+ uCharNamesData = nullptr;
}
if(uCharNames) {
- uCharNames = NULL;
+ uCharNames = nullptr;
}
gCharNamesInitOnce.reset();
gMaxNameLength=0;
@@ -193,12 +193,12 @@ isAcceptable(void * /*context*/,
static void U_CALLCONV
loadCharNames(UErrorCode &status) {
- U_ASSERT(uCharNamesData == NULL);
- U_ASSERT(uCharNames == NULL);
+ U_ASSERT(uCharNamesData == nullptr);
+ U_ASSERT(uCharNames == nullptr);
- uCharNamesData = udata_openChoice(NULL, DATA_TYPE, DATA_NAME, isAcceptable, NULL, &status);
+ uCharNamesData = udata_openChoice(nullptr, DATA_TYPE, DATA_NAME, isAcceptable, nullptr, &status);
if(U_FAILURE(status)) {
- uCharNamesData = NULL;
+ uCharNamesData = nullptr;
} else {
uCharNames = (UCharNames *)udata_getMemory(uCharNamesData);
}
@@ -801,7 +801,7 @@ writeFactorSuffix(const uint16_t *factors, uint16_t count,
/* write each element */
for(;;) {
- if(elementBases!=NULL) {
+ if(elementBases!=nullptr) {
*elementBases++=s;
}
@@ -811,7 +811,7 @@ writeFactorSuffix(const uint16_t *factors, uint16_t count,
while(*s++!=0) {}
--factor;
}
- if(elements!=NULL) {
+ if(elements!=nullptr) {
*elements++=s;
}
@@ -913,7 +913,7 @@ getAlgName(AlgorithmicRange *range, uint32_t code, UCharNameChoice nameChoice,
}
bufferPos+=writeFactorSuffix(factors, count,
- s, code-range->start, indexes, NULL, NULL, buffer, bufferLength);
+ s, code-range->start, indexes, nullptr, nullptr, buffer, bufferLength);
break;
}
default:
@@ -1319,7 +1319,7 @@ calcNameSetLength(const uint16_t *tokens, uint16_t tokenCount, const uint8_t *to
++length;
} else {
/* count token word */
- if(tokenLengths!=NULL) {
+ if(tokenLengths!=nullptr) {
/* use cached token length */
tokenLength=tokenLengths[c];
if(tokenLength==0) {
@@ -1354,7 +1354,7 @@ calcGroupNameSetsLengths(int32_t maxNameLength) {
int32_t groupCount, lineNumber, length;
tokenLengths=(int8_t *)uprv_malloc(tokenCount);
- if(tokenLengths!=NULL) {
+ if(tokenLengths!=nullptr) {
uprv_memset(tokenLengths, 0, tokenCount);
}
@@ -1402,7 +1402,7 @@ calcGroupNameSetsLengths(int32_t maxNameLength) {
--groupCount;
}
- if(tokenLengths!=NULL) {
+ if(tokenLengths!=nullptr) {
uprv_free(tokenLengths);
}
@@ -1456,10 +1456,10 @@ u_charName(UChar32 code, UCharNameChoice nameChoice,
int32_t length;
/* check the argument values */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
} else if(nameChoice>=U_CHAR_NAME_CHOICE_COUNT ||
- bufferLength<0 || (bufferLength>0 && buffer==NULL)
+ bufferLength<0 || (bufferLength>0 && buffer==nullptr)
) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
@@ -1505,9 +1505,9 @@ u_getISOComment(UChar32 /*c*/,
char *dest, int32_t destCapacity,
UErrorCode *pErrorCode) {
/* check the argument values */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
- } else if(destCapacity<0 || (destCapacity>0 && dest==NULL)) {
+ } else if(destCapacity<0 || (destCapacity>0 && dest==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -1529,11 +1529,11 @@ u_charFromName(UCharNameChoice nameChoice,
char c0;
static constexpr UChar32 error = 0xffff; /* Undefined, but use this for backwards compatibility. */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return error;
}
- if(nameChoice>=U_CHAR_NAME_CHOICE_COUNT || name==NULL || *name==0) {
+ if(nameChoice>=U_CHAR_NAME_CHOICE_COUNT || name==nullptr || *name==0) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return error;
}
@@ -1641,11 +1641,11 @@ u_enumCharNames(UChar32 start, UChar32 limit,
uint32_t *p;
uint32_t i;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return;
}
- if(nameChoice>=U_CHAR_NAME_CHOICE_COUNT || fn==NULL) {
+ if(nameChoice>=U_CHAR_NAME_CHOICE_COUNT || fn==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -1716,7 +1716,7 @@ uprv_getMaxCharNameLength() {
*/
static void
charSetToUSet(uint32_t cset[8], const USetAdder *sa) {
- UChar us[256];
+ char16_t us[256];
char cs[256];
int32_t i, length;
@@ -1736,12 +1736,12 @@ charSetToUSet(uint32_t cset[8], const USetAdder *sa) {
}
}
- /* convert the char string to a UChar string */
+ /* convert the char string to a char16_t string */
u_charsToUChars(cs, us, length);
- /* add each UChar to the USet */
+ /* add each char16_t to the USet */
for(i=0; i<length; ++i) {
- if(us[i]!=0 || cs[i]==0) { /* non-invariant chars become (UChar)0 */
+ if(us[i]!=0 || cs[i]==0) { /* non-invariant chars become (char16_t)0 */
sa->add(sa->set, us[i]);
}
}
@@ -1850,7 +1850,7 @@ uchar_swapNames(const UDataSwapper *ds,
/* udata_swapDataHeader checks the arguments */
headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
@@ -1872,7 +1872,7 @@ uchar_swapNames(const UDataSwapper *ds,
}
inBytes=(const uint8_t *)inData+headerSize;
- outBytes=(uint8_t *)outData+headerSize;
+ outBytes=(outData == nullptr) ? nullptr : (uint8_t *)outData+headerSize;
if(length<0) {
algNamesOffset=ds->readUInt32(((const uint32_t *)inBytes)[3]);
} else {
@@ -1954,7 +1954,7 @@ uchar_swapNames(const UDataSwapper *ds,
* go through a temporary array to support in-place swapping
*/
temp=(uint16_t *)uprv_malloc(tokenCount*2);
- if(temp==NULL) {
+ if(temp==nullptr) {
udata_printError(ds, "out of memory swapping %u unames.icu tokens\n",
tokenCount);
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
diff --git a/thirdparty/icu4c/common/unicode/appendable.h b/thirdparty/icu4c/common/unicode/appendable.h
index f77df88e39..0e37f4562a 100644
--- a/thirdparty/icu4c/common/unicode/appendable.h
+++ b/thirdparty/icu4c/common/unicode/appendable.h
@@ -79,7 +79,7 @@ public:
/**
* Appends a string.
* The default implementation calls appendCodeUnit(char16_t) for each code unit.
- * @param s string, must not be NULL if length!=0
+ * @param s string, must not be nullptr if length!=0
* @param length string length, or -1 if NUL-terminated
* @return true if the operation succeeded
* @stable ICU 4.8
@@ -186,7 +186,7 @@ public:
/**
* Appends a string to the UnicodeString.
- * @param s string, must not be NULL if length!=0
+ * @param s string, must not be nullptr if length!=0
* @param length string length, or -1 if NUL-terminated
* @return true if the operation succeeded
* @stable ICU 4.8
diff --git a/thirdparty/icu4c/common/unicode/brkiter.h b/thirdparty/icu4c/common/unicode/brkiter.h
index 3a121cf703..108652799e 100644
--- a/thirdparty/icu4c/common/unicode/brkiter.h
+++ b/thirdparty/icu4c/common/unicode/brkiter.h
@@ -162,7 +162,7 @@ public:
* access the text without impacting any break iterator operations,
* but the underlying text itself must not be altered.
*
- * @param fillIn A UText to be filled in. If NULL, a new UText will be
+ * @param fillIn A UText to be filled in. If nullptr, a new UText will be
* allocated to hold the result.
* @param status receives any error codes.
* @return The current UText for this break iterator. If an input
@@ -503,7 +503,7 @@ public:
*
* Thread safe client-buffer-based cloning operation
* Do NOT call delete on a safeclone, since 'new' is not used to create it.
- * @param stackBuffer user allocated space for the new clone. If NULL new memory will be allocated.
+ * @param stackBuffer user allocated space for the new clone. If nullptr new memory will be allocated.
* If buffer is not large enough, new memory will be allocated.
* @param BufferSize reference to size of allocated space.
* If BufferSize == 0, a sufficient size for use in cloning will
diff --git a/thirdparty/icu4c/common/unicode/bytestrie.h b/thirdparty/icu4c/common/unicode/bytestrie.h
index 8fe66780f5..1719a6bb83 100644
--- a/thirdparty/icu4c/common/unicode/bytestrie.h
+++ b/thirdparty/icu4c/common/unicode/bytestrie.h
@@ -69,7 +69,7 @@ public:
* @stable ICU 4.8
*/
BytesTrie(const void *trieBytes)
- : ownedArray_(NULL), bytes_(static_cast<const uint8_t *>(trieBytes)),
+ : ownedArray_(nullptr), bytes_(static_cast<const uint8_t *>(trieBytes)),
pos_(bytes_), remainingMatchLength_(-1) {}
/**
@@ -85,7 +85,7 @@ public:
* @stable ICU 4.8
*/
BytesTrie(const BytesTrie &other)
- : ownedArray_(NULL), bytes_(other.bytes_),
+ : ownedArray_(nullptr), bytes_(other.bytes_),
pos_(other.pos_), remainingMatchLength_(other.remainingMatchLength_) {}
/**
@@ -143,7 +143,7 @@ public:
* Constructs an empty State.
* @stable ICU 4.8
*/
- State() { bytes=NULL; }
+ State() { bytes=nullptr; }
private:
friend class BytesTrie;
@@ -177,7 +177,7 @@ public:
* @stable ICU 4.8
*/
BytesTrie &resetToState(const State &state) {
- if(bytes_==state.bytes && bytes_!=NULL) {
+ if(bytes_==state.bytes && bytes_!=nullptr) {
pos_=state.pos;
remainingMatchLength_=state.remainingMatchLength;
}
@@ -227,7 +227,7 @@ public:
* result=next(c);
* return result;
* \endcode
- * @param s A string or byte sequence. Can be NULL if length is 0.
+ * @param s A string or byte sequence. Can be nullptr if length is 0.
* @param length The length of the byte sequence. Can be -1 if NUL-terminated.
* @return The match/value Result.
* @stable ICU 4.8
@@ -262,7 +262,7 @@ public:
inline UBool hasUniqueValue(int32_t &uniqueValue) const {
const uint8_t *pos=pos_;
// Skip the rest of a pending linear-match node.
- return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, false, uniqueValue);
+ return pos!=nullptr && findUniqueValue(pos+remainingMatchLength_+1, false, uniqueValue);
}
/**
@@ -397,7 +397,7 @@ private:
BytesTrie &operator=(const BytesTrie &other) = delete;
inline void stop() {
- pos_=NULL;
+ pos_=nullptr;
}
// Reads a compact 32-bit integer.
@@ -555,7 +555,7 @@ private:
// Iterator variables.
- // Pointer to next trie byte to read. NULL if no more matches.
+ // Pointer to next trie byte to read. nullptr if no more matches.
const uint8_t *pos_;
// Remaining length of a linear-match node, minus 1. Negative if not in such a node.
int32_t remainingMatchLength_;
diff --git a/thirdparty/icu4c/common/unicode/caniter.h b/thirdparty/icu4c/common/unicode/caniter.h
index db400a531b..035bd0e64e 100644
--- a/thirdparty/icu4c/common/unicode/caniter.h
+++ b/thirdparty/icu4c/common/unicode/caniter.h
@@ -73,7 +73,7 @@ Results for: {LATIN CAPITAL LETTER A WITH RING ABOVE}{LATIN SMALL LETTER D}{COMB
* @author C++ port by V. Weinstein
* @stable ICU 2.4
*/
-class U_COMMON_API CanonicalIterator U_FINAL : public UObject {
+class U_COMMON_API CanonicalIterator final : public UObject {
public:
/**
* Construct a CanonicalIterator object
diff --git a/thirdparty/icu4c/common/unicode/casemap.h b/thirdparty/icu4c/common/unicode/casemap.h
index 53af84fa74..eca7cbf80a 100644
--- a/thirdparty/icu4c/common/unicode/casemap.h
+++ b/thirdparty/icu4c/common/unicode/casemap.h
@@ -30,7 +30,7 @@ class Edits;
*
* @stable ICU 59
*/
-class U_COMMON_API CaseMap U_FINAL : public UMemory {
+class U_COMMON_API CaseMap final : public UMemory {
public:
/**
* Lowercases a UTF-16 string and optionally records edits.
@@ -38,7 +38,7 @@ public:
* The result may be longer or shorter than the original.
* The source string and the destination buffer must not overlap.
*
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param locale The locale ID. ("" = root locale, nullptr = default locale.)
* @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
* @param src The original string.
* @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
@@ -46,13 +46,13 @@ public:
* the buffer is large enough.
* The contents is undefined in case of failure.
* @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then
- * dest may be NULL and the function will only return the length of the result
+ * dest may be nullptr and the function will only return the length of the result
* without writing any of the result string.
* @param edits Records edits for index mapping, working with styled text,
* and getting only changes (if any).
* The Edits contents is undefined if any error occurs.
* This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * options includes U_EDITS_NO_RESET. edits can be nullptr.
* @param errorCode Reference to an in/out error code value
* which must not indicate a failure before the function call.
* @return The length of the result string, if successful.
@@ -74,7 +74,7 @@ public:
* The result may be longer or shorter than the original.
* The source string and the destination buffer must not overlap.
*
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param locale The locale ID. ("" = root locale, nullptr = default locale.)
* @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
* @param src The original string.
* @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
@@ -82,13 +82,13 @@ public:
* the buffer is large enough.
* The contents is undefined in case of failure.
* @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then
- * dest may be NULL and the function will only return the length of the result
+ * dest may be nullptr and the function will only return the length of the result
* without writing any of the result string.
* @param edits Records edits for index mapping, working with styled text,
* and getting only changes (if any).
* The Edits contents is undefined if any error occurs.
* This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * options includes U_EDITS_NO_RESET. edits can be nullptr.
* @param errorCode Reference to an in/out error code value
* which must not indicate a failure before the function call.
* @return The length of the result string, if successful.
@@ -116,7 +116,7 @@ public:
* that are to be titlecased. It titlecases those characters and lowercases
* all others. (This can be modified with options bits.)
*
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param locale The locale ID. ("" = root locale, nullptr = default locale.)
* @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
* U_TITLECASE_NO_LOWERCASE,
* U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED,
@@ -124,7 +124,7 @@ public:
* @param iter A break iterator to find the first characters of words that are to be titlecased.
* It is set to the source string (setText())
* and used one or more times for iteration (first() and next()).
- * If NULL, then a word break iterator for the locale is used
+ * If nullptr, then a word break iterator for the locale is used
* (or something equivalent).
* @param src The original string.
* @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
@@ -132,13 +132,13 @@ public:
* the buffer is large enough.
* The contents is undefined in case of failure.
* @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then
- * dest may be NULL and the function will only return the length of the result
+ * dest may be nullptr and the function will only return the length of the result
* without writing any of the result string.
* @param edits Records edits for index mapping, working with styled text,
* and getting only changes (if any).
* The Edits contents is undefined if any error occurs.
* This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * options includes U_EDITS_NO_RESET. edits can be nullptr.
* @param errorCode Reference to an in/out error code value
* which must not indicate a failure before the function call.
* @return The length of the result string, if successful.
@@ -175,13 +175,13 @@ public:
* the buffer is large enough.
* The contents is undefined in case of failure.
* @param destCapacity The size of the buffer (number of char16_ts). If it is 0, then
- * dest may be NULL and the function will only return the length of the result
+ * dest may be nullptr and the function will only return the length of the result
* without writing any of the result string.
* @param edits Records edits for index mapping, working with styled text,
* and getting only changes (if any).
* The Edits contents is undefined if any error occurs.
* This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * options includes U_EDITS_NO_RESET. edits can be nullptr.
* @param errorCode Reference to an in/out error code value
* which must not indicate a failure before the function call.
* @return The length of the result string, if successful.
@@ -202,7 +202,7 @@ public:
* Casing is locale-dependent and context-sensitive.
* The result may be longer or shorter than the original.
*
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param locale The locale ID. ("" = root locale, nullptr = default locale.)
* @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
* @param src The original string.
* @param sink A ByteSink to which the result string is written.
@@ -211,7 +211,7 @@ public:
* and getting only changes (if any).
* The Edits contents is undefined if any error occurs.
* This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * options includes U_EDITS_NO_RESET. edits can be nullptr.
* @param errorCode Reference to an in/out error code value
* which must not indicate a failure before the function call.
*
@@ -228,7 +228,7 @@ public:
* Casing is locale-dependent and context-sensitive.
* The result may be longer or shorter than the original.
*
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param locale The locale ID. ("" = root locale, nullptr = default locale.)
* @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
* @param src The original string.
* @param sink A ByteSink to which the result string is written.
@@ -237,7 +237,7 @@ public:
* and getting only changes (if any).
* The Edits contents is undefined if any error occurs.
* This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * options includes U_EDITS_NO_RESET. edits can be nullptr.
* @param errorCode Reference to an in/out error code value
* which must not indicate a failure before the function call.
*
@@ -260,7 +260,7 @@ public:
* that are to be titlecased. It titlecases those characters and lowercases
* all others. (This can be modified with options bits.)
*
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param locale The locale ID. ("" = root locale, nullptr = default locale.)
* @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
* U_TITLECASE_NO_LOWERCASE,
* U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED,
@@ -268,7 +268,7 @@ public:
* @param iter A break iterator to find the first characters of words that are to be titlecased.
* It is set to the source string (setUText())
* and used one or more times for iteration (first() and next()).
- * If NULL, then a word break iterator for the locale is used
+ * If nullptr, then a word break iterator for the locale is used
* (or something equivalent).
* @param src The original string.
* @param sink A ByteSink to which the result string is written.
@@ -277,7 +277,7 @@ public:
* and getting only changes (if any).
* The Edits contents is undefined if any error occurs.
* This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * options includes U_EDITS_NO_RESET. edits can be nullptr.
* @param errorCode Reference to an in/out error code value
* which must not indicate a failure before the function call.
*
@@ -308,7 +308,7 @@ public:
* and getting only changes (if any).
* The Edits contents is undefined if any error occurs.
* This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * options includes U_EDITS_NO_RESET. edits can be nullptr.
* @param errorCode Reference to an in/out error code value
* which must not indicate a failure before the function call.
*
@@ -326,7 +326,7 @@ public:
* The result may be longer or shorter than the original.
* The source string and the destination buffer must not overlap.
*
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param locale The locale ID. ("" = root locale, nullptr = default locale.)
* @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
* @param src The original string.
* @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
@@ -334,13 +334,13 @@ public:
* the buffer is large enough.
* The contents is undefined in case of failure.
* @param destCapacity The size of the buffer (number of bytes). If it is 0, then
- * dest may be NULL and the function will only return the length of the result
+ * dest may be nullptr and the function will only return the length of the result
* without writing any of the result string.
* @param edits Records edits for index mapping, working with styled text,
* and getting only changes (if any).
* The Edits contents is undefined if any error occurs.
* This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * options includes U_EDITS_NO_RESET. edits can be nullptr.
* @param errorCode Reference to an in/out error code value
* which must not indicate a failure before the function call.
* @return The length of the result string, if successful.
@@ -362,7 +362,7 @@ public:
* The result may be longer or shorter than the original.
* The source string and the destination buffer must not overlap.
*
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param locale The locale ID. ("" = root locale, nullptr = default locale.)
* @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT and U_EDITS_NO_RESET.
* @param src The original string.
* @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
@@ -370,13 +370,13 @@ public:
* the buffer is large enough.
* The contents is undefined in case of failure.
* @param destCapacity The size of the buffer (number of bytes). If it is 0, then
- * dest may be NULL and the function will only return the length of the result
+ * dest may be nullptr and the function will only return the length of the result
* without writing any of the result string.
* @param edits Records edits for index mapping, working with styled text,
* and getting only changes (if any).
* The Edits contents is undefined if any error occurs.
* This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * options includes U_EDITS_NO_RESET. edits can be nullptr.
* @param errorCode Reference to an in/out error code value
* which must not indicate a failure before the function call.
* @return The length of the result string, if successful.
@@ -404,7 +404,7 @@ public:
* that are to be titlecased. It titlecases those characters and lowercases
* all others. (This can be modified with options bits.)
*
- * @param locale The locale ID. ("" = root locale, NULL = default locale.)
+ * @param locale The locale ID. ("" = root locale, nullptr = default locale.)
* @param options Options bit set, usually 0. See U_OMIT_UNCHANGED_TEXT, U_EDITS_NO_RESET,
* U_TITLECASE_NO_LOWERCASE,
* U_TITLECASE_NO_BREAK_ADJUSTMENT, U_TITLECASE_ADJUST_TO_CASED,
@@ -412,7 +412,7 @@ public:
* @param iter A break iterator to find the first characters of words that are to be titlecased.
* It is set to the source string (setUText())
* and used one or more times for iteration (first() and next()).
- * If NULL, then a word break iterator for the locale is used
+ * If nullptr, then a word break iterator for the locale is used
* (or something equivalent).
* @param src The original string.
* @param srcLength The length of the original string. If -1, then src must be NUL-terminated.
@@ -420,13 +420,13 @@ public:
* the buffer is large enough.
* The contents is undefined in case of failure.
* @param destCapacity The size of the buffer (number of bytes). If it is 0, then
- * dest may be NULL and the function will only return the length of the result
+ * dest may be nullptr and the function will only return the length of the result
* without writing any of the result string.
* @param edits Records edits for index mapping, working with styled text,
* and getting only changes (if any).
* The Edits contents is undefined if any error occurs.
* This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * options includes U_EDITS_NO_RESET. edits can be nullptr.
* @param errorCode Reference to an in/out error code value
* which must not indicate a failure before the function call.
* @return The length of the result string, if successful.
@@ -462,13 +462,13 @@ public:
* the buffer is large enough.
* The contents is undefined in case of failure.
* @param destCapacity The size of the buffer (number of bytes). If it is 0, then
- * dest may be NULL and the function will only return the length of the result
+ * dest may be nullptr and the function will only return the length of the result
* without writing any of the result string.
* @param edits Records edits for index mapping, working with styled text,
* and getting only changes (if any).
* The Edits contents is undefined if any error occurs.
* This function calls edits->reset() first unless
- * options includes U_EDITS_NO_RESET. edits can be NULL.
+ * options includes U_EDITS_NO_RESET. edits can be nullptr.
* @param errorCode Reference to an in/out error code value
* which must not indicate a failure before the function call.
* @return The length of the result string, if successful.
diff --git a/thirdparty/icu4c/common/unicode/char16ptr.h b/thirdparty/icu4c/common/unicode/char16ptr.h
index c8a9ae6c35..de8182c7ad 100644
--- a/thirdparty/icu4c/common/unicode/char16ptr.h
+++ b/thirdparty/icu4c/common/unicode/char16ptr.h
@@ -39,7 +39,7 @@ U_NAMESPACE_BEGIN
* char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types.
* @stable ICU 59
*/
-class U_COMMON_API Char16Ptr U_FINAL {
+class U_COMMON_API Char16Ptr final {
public:
/**
* Copies the pointer.
@@ -146,7 +146,7 @@ char16_t *Char16Ptr::get() const { return u_.cp; }
* const char16_t * wrapper with implicit conversion from distinct but bit-compatible pointer types.
* @stable ICU 59
*/
-class U_COMMON_API ConstChar16Ptr U_FINAL {
+class U_COMMON_API ConstChar16Ptr final {
public:
/**
* Copies the pointer.
diff --git a/thirdparty/icu4c/common/unicode/chariter.h b/thirdparty/icu4c/common/unicode/chariter.h
index 4f320b90e2..45f4d984c7 100644
--- a/thirdparty/icu4c/common/unicode/chariter.h
+++ b/thirdparty/icu4c/common/unicode/chariter.h
@@ -297,7 +297,7 @@ protected:
* \code
* void traverseForward(CharacterIterator& iter)
* {
- * for(char16_t c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
+ * for(char16_t c = iter.first(); c != CharacterIterator::DONE; c = iter.next()) {
* processChar(c);
* }
* }
@@ -308,7 +308,7 @@ protected:
* \code
* void traverseBackward(CharacterIterator& iter)
* {
- * for(char16_t c = iter.last(); c != CharacterIterator.DONE; c = iter.previous()) {
+ * for(char16_t c = iter.last(); c != CharacterIterator::DONE; c = iter.previous()) {
* processChar(c);
* }
* }
@@ -322,11 +322,11 @@ protected:
* {
* char16_t c;
* for (c = iter.setIndex(pos);
- * c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
+ * c != CharacterIterator::DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
* c = iter.next()) {}
* int32_t end = iter.getIndex();
* for (c = iter.setIndex(pos);
- * c != CharacterIterator.DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
+ * c != CharacterIterator::DONE && (Unicode::isLetter(c) || Unicode::isDigit(c));
* c = iter.previous()) {}
* int32_t start = iter.getIndex() + 1;
*
diff --git a/thirdparty/icu4c/common/unicode/docmain.h b/thirdparty/icu4c/common/unicode/docmain.h
index 4e29e283cd..1349f49703 100644
--- a/thirdparty/icu4c/common/unicode/docmain.h
+++ b/thirdparty/icu4c/common/unicode/docmain.h
@@ -149,8 +149,8 @@
* </tr>
* <tr>
* <td>Number Formatting<br/>(includes currency and unit formatting)</td>
- * <td>unumberformatter.h, unum.h</td>
- * <td>icu::number::NumberFormatter (ICU 60+) or icu::NumberFormat (older versions)</td>
+ * <td>unumberformatter.h, unum.h, usimplenumberformatter.h</td>
+ * <td>icu::number::NumberFormatter (ICU 60+) or icu::NumberFormat (older versions)<br>icu::number::SimpleNumberFormatter (ICU 73+)</td>
* </tr>
* <tr>
* <td>Number Range Formatting<br />(includes currency and unit ranges)</td>
diff --git a/thirdparty/icu4c/common/unicode/edits.h b/thirdparty/icu4c/common/unicode/edits.h
index bfa07fa676..dda9d3ca75 100644
--- a/thirdparty/icu4c/common/unicode/edits.h
+++ b/thirdparty/icu4c/common/unicode/edits.h
@@ -77,7 +77,7 @@ class UnicodeString;
*
* @stable ICU 59
*/
-class U_COMMON_API Edits U_FINAL : public UMemory {
+class U_COMMON_API Edits final : public UMemory {
public:
/**
* Constructs an empty object.
@@ -103,7 +103,7 @@ public:
* @param src source edits
* @stable ICU 60
*/
- Edits(Edits &&src) U_NOEXCEPT :
+ Edits(Edits &&src) noexcept :
array(stackArray), capacity(STACK_CAPACITY), length(src.length),
delta(src.delta), numChanges(src.numChanges),
errorCode_(src.errorCode_) {
@@ -132,13 +132,13 @@ public:
* @return *this
* @stable ICU 60
*/
- Edits &operator=(Edits &&src) U_NOEXCEPT;
+ Edits &operator=(Edits &&src) noexcept;
/**
* Resets the data but may not release memory.
* @stable ICU 59
*/
- void reset() U_NOEXCEPT;
+ void reset() noexcept;
/**
* Adds a no-change edit: a record for an unchanged segment of text.
@@ -200,7 +200,7 @@ public:
* @see getFineIterator
* @stable ICU 59
*/
- struct U_COMMON_API Iterator U_FINAL : public UMemory {
+ struct U_COMMON_API Iterator final : public UMemory {
/**
* Default constructor, empty iterator.
* @stable ICU 60
@@ -504,9 +504,9 @@ public:
Edits &mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &errorCode);
private:
- void releaseArray() U_NOEXCEPT;
+ void releaseArray() noexcept;
Edits &copyArray(const Edits &other);
- Edits &moveArray(Edits &src) U_NOEXCEPT;
+ Edits &moveArray(Edits &src) noexcept;
void setLastUnit(int32_t last) { array[length - 1] = (uint16_t)last; }
int32_t lastUnit() const { return length > 0 ? array[length - 1] : 0xffff; }
diff --git a/thirdparty/icu4c/common/unicode/icuplug.h b/thirdparty/icu4c/common/unicode/icuplug.h
index 205af360d4..c787fcd426 100644
--- a/thirdparty/icu4c/common/unicode/icuplug.h
+++ b/thirdparty/icu4c/common/unicode/icuplug.h
@@ -187,8 +187,12 @@ typedef enum {
/**
* Entrypoint for an ICU plugin.
- * @param plug the UPlugData handle.
- * @param status the plugin's extended status code.
+ * @param plug the UPlugData handle.
+ * @param reason the reason code for the entrypoint's call.
+ * @param status Standard 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 A valid plugin must return UPLUG_TOKEN
* @internal ICU 4.4 Technology Preview
*/
diff --git a/thirdparty/icu4c/common/unicode/localematcher.h b/thirdparty/icu4c/common/unicode/localematcher.h
index 0f7e04a3af..603daf7231 100644
--- a/thirdparty/icu4c/common/unicode/localematcher.h
+++ b/thirdparty/icu4c/common/unicode/localematcher.h
@@ -198,7 +198,7 @@ public:
* @param src Result to move contents from.
* @stable ICU 65
*/
- Result(Result &&src) U_NOEXCEPT;
+ Result(Result &&src) noexcept;
/**
* Destructor.
@@ -214,7 +214,7 @@ public:
* @param src Result to move contents from.
* @stable ICU 65
*/
- Result &operator=(Result &&src) U_NOEXCEPT;
+ Result &operator=(Result &&src) noexcept;
/**
* Returns the best-matching desired locale.
@@ -313,7 +313,7 @@ public:
* @param src Builder to move contents from.
* @stable ICU 65
*/
- Builder(Builder &&src) U_NOEXCEPT;
+ Builder(Builder &&src) noexcept;
/**
* Destructor.
@@ -329,7 +329,7 @@ public:
* @param src Builder to move contents from.
* @stable ICU 65
*/
- Builder &operator=(Builder &&src) U_NOEXCEPT;
+ Builder &operator=(Builder &&src) noexcept;
/**
* Parses an Accept-Language string
@@ -548,7 +548,7 @@ public:
* @param src source matcher
* @stable ICU 65
*/
- LocaleMatcher(LocaleMatcher &&src) U_NOEXCEPT;
+ LocaleMatcher(LocaleMatcher &&src) noexcept;
/**
* Destructor.
@@ -564,7 +564,7 @@ public:
* @return *this
* @stable ICU 65
*/
- LocaleMatcher &operator=(LocaleMatcher &&src) U_NOEXCEPT;
+ LocaleMatcher &operator=(LocaleMatcher &&src) noexcept;
/**
* Returns the supported locale which best matches the desired locale.
diff --git a/thirdparty/icu4c/common/unicode/localpointer.h b/thirdparty/icu4c/common/unicode/localpointer.h
index 96c659d10a..b8be3d7942 100644
--- a/thirdparty/icu4c/common/unicode/localpointer.h
+++ b/thirdparty/icu4c/common/unicode/localpointer.h
@@ -79,7 +79,7 @@ public:
* @param p simple pointer to an object that is adopted
* @stable ICU 4.4
*/
- explicit LocalPointerBase(T *p=NULL) : ptr(p) {}
+ explicit LocalPointerBase(T *p=nullptr) : ptr(p) {}
/**
* Destructor deletes the object it owns.
* Subclass must override: Base class does nothing.
@@ -87,20 +87,20 @@ public:
*/
~LocalPointerBase() { /* delete ptr; */ }
/**
- * NULL check.
- * @return true if ==NULL
+ * nullptr check.
+ * @return true if ==nullptr
* @stable ICU 4.4
*/
- UBool isNull() const { return ptr==NULL; }
+ UBool isNull() const { return ptr==nullptr; }
/**
- * NULL check.
- * @return true if !=NULL
+ * nullptr check.
+ * @return true if !=nullptr
* @stable ICU 4.4
*/
- UBool isValid() const { return ptr!=NULL; }
+ UBool isValid() const { return ptr!=nullptr; }
/**
* Comparison with a simple pointer, so that existing code
- * with ==NULL need not be changed.
+ * with ==nullptr need not be changed.
* @param other simple pointer for comparison
* @return true if this pointer value equals other
* @stable ICU 4.4
@@ -108,7 +108,7 @@ public:
bool operator==(const T *other) const { return ptr==other; }
/**
* Comparison with a simple pointer, so that existing code
- * with !=NULL need not be changed.
+ * with !=nullptr need not be changed.
* @param other simple pointer for comparison
* @return true if this pointer value differs from other
* @stable ICU 4.4
@@ -133,14 +133,14 @@ public:
*/
T *operator->() const { return ptr; }
/**
- * Gives up ownership; the internal pointer becomes NULL.
+ * Gives up ownership; the internal pointer becomes nullptr.
* @return the pointer value;
* caller becomes responsible for deleting the object
* @stable ICU 4.4
*/
T *orphan() {
T *p=ptr;
- ptr=NULL;
+ ptr=nullptr;
return p;
}
/**
@@ -197,9 +197,9 @@ public:
* @param p simple pointer to an object that is adopted
* @stable ICU 4.4
*/
- explicit LocalPointer(T *p=NULL) : LocalPointerBase<T>(p) {}
+ explicit LocalPointer(T *p=nullptr) : LocalPointerBase<T>(p) {}
/**
- * Constructor takes ownership and reports an error if NULL.
+ * Constructor takes ownership and reports an error if nullptr.
*
* This constructor is intended to be used with other-class constructors
* that may report a failure UErrorCode,
@@ -208,11 +208,11 @@ public:
*
* @param p simple pointer to an object that is adopted
* @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR
- * if p==NULL and no other failure code had been set
+ * if p==nullptr and no other failure code had been set
* @stable ICU 55
*/
LocalPointer(T *p, UErrorCode &errorCode) : LocalPointerBase<T>(p) {
- if(p==NULL && U_SUCCESS(errorCode)) {
+ if(p==nullptr && U_SUCCESS(errorCode)) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
}
}
@@ -221,8 +221,8 @@ public:
* @param src source smart pointer
* @stable ICU 56
*/
- LocalPointer(LocalPointer<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
- src.ptr=NULL;
+ LocalPointer(LocalPointer<T> &&src) noexcept : LocalPointerBase<T>(src.ptr) {
+ src.ptr=nullptr;
}
/**
@@ -252,10 +252,10 @@ public:
* @return *this
* @stable ICU 56
*/
- LocalPointer<T> &operator=(LocalPointer<T> &&src) U_NOEXCEPT {
+ LocalPointer<T> &operator=(LocalPointer<T> &&src) noexcept {
delete LocalPointerBase<T>::ptr;
LocalPointerBase<T>::ptr=src.ptr;
- src.ptr=NULL;
+ src.ptr=nullptr;
return *this;
}
@@ -267,7 +267,7 @@ public:
* @return *this
* @stable ICU 64
*/
- LocalPointer<T> &operator=(std::unique_ptr<T> &&p) U_NOEXCEPT {
+ LocalPointer<T> &operator=(std::unique_ptr<T> &&p) noexcept {
adoptInstead(p.release());
return *this;
}
@@ -277,7 +277,7 @@ public:
* @param other other smart pointer
* @stable ICU 56
*/
- void swap(LocalPointer<T> &other) U_NOEXCEPT {
+ void swap(LocalPointer<T> &other) noexcept {
T *temp=LocalPointerBase<T>::ptr;
LocalPointerBase<T>::ptr=other.ptr;
other.ptr=temp;
@@ -288,7 +288,7 @@ public:
* @param p2 will get p1's pointer
* @stable ICU 56
*/
- friend inline void swap(LocalPointer<T> &p1, LocalPointer<T> &p2) U_NOEXCEPT {
+ friend inline void swap(LocalPointer<T> &p1, LocalPointer<T> &p2) noexcept {
p1.swap(p2);
}
/**
@@ -307,20 +307,20 @@ public:
*
* If U_FAILURE(errorCode), then the current object is retained and the new one deleted.
*
- * If U_SUCCESS(errorCode) but the input pointer is NULL,
+ * If U_SUCCESS(errorCode) but the input pointer is nullptr,
* then U_MEMORY_ALLOCATION_ERROR is set,
- * the current object is deleted, and NULL is set.
+ * the current object is deleted, and nullptr is set.
*
* @param p simple pointer to an object that is adopted
* @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR
- * if p==NULL and no other failure code had been set
+ * if p==nullptr and no other failure code had been set
* @stable ICU 55
*/
void adoptInsteadAndCheckErrorCode(T *p, UErrorCode &errorCode) {
if(U_SUCCESS(errorCode)) {
delete LocalPointerBase<T>::ptr;
LocalPointerBase<T>::ptr=p;
- if(p==NULL) {
+ if(p==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
}
} else {
@@ -372,9 +372,9 @@ public:
* @param p simple pointer to an array of T objects that is adopted
* @stable ICU 4.4
*/
- explicit LocalArray(T *p=NULL) : LocalPointerBase<T>(p) {}
+ explicit LocalArray(T *p=nullptr) : LocalPointerBase<T>(p) {}
/**
- * Constructor takes ownership and reports an error if NULL.
+ * Constructor takes ownership and reports an error if nullptr.
*
* This constructor is intended to be used with other-class constructors
* that may report a failure UErrorCode,
@@ -383,11 +383,11 @@ public:
*
* @param p simple pointer to an array of T objects that is adopted
* @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR
- * if p==NULL and no other failure code had been set
+ * if p==nullptr and no other failure code had been set
* @stable ICU 56
*/
LocalArray(T *p, UErrorCode &errorCode) : LocalPointerBase<T>(p) {
- if(p==NULL && U_SUCCESS(errorCode)) {
+ if(p==nullptr && U_SUCCESS(errorCode)) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
}
}
@@ -396,8 +396,8 @@ public:
* @param src source smart pointer
* @stable ICU 56
*/
- LocalArray(LocalArray<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
- src.ptr=NULL;
+ LocalArray(LocalArray<T> &&src) noexcept : LocalPointerBase<T>(src.ptr) {
+ src.ptr=nullptr;
}
/**
@@ -427,10 +427,10 @@ public:
* @return *this
* @stable ICU 56
*/
- LocalArray<T> &operator=(LocalArray<T> &&src) U_NOEXCEPT {
+ LocalArray<T> &operator=(LocalArray<T> &&src) noexcept {
delete[] LocalPointerBase<T>::ptr;
LocalPointerBase<T>::ptr=src.ptr;
- src.ptr=NULL;
+ src.ptr=nullptr;
return *this;
}
@@ -442,7 +442,7 @@ public:
* @return *this
* @stable ICU 64
*/
- LocalArray<T> &operator=(std::unique_ptr<T[]> &&p) U_NOEXCEPT {
+ LocalArray<T> &operator=(std::unique_ptr<T[]> &&p) noexcept {
adoptInstead(p.release());
return *this;
}
@@ -452,7 +452,7 @@ public:
* @param other other smart pointer
* @stable ICU 56
*/
- void swap(LocalArray<T> &other) U_NOEXCEPT {
+ void swap(LocalArray<T> &other) noexcept {
T *temp=LocalPointerBase<T>::ptr;
LocalPointerBase<T>::ptr=other.ptr;
other.ptr=temp;
@@ -463,7 +463,7 @@ public:
* @param p2 will get p1's pointer
* @stable ICU 56
*/
- friend inline void swap(LocalArray<T> &p1, LocalArray<T> &p2) U_NOEXCEPT {
+ friend inline void swap(LocalArray<T> &p1, LocalArray<T> &p2) noexcept {
p1.swap(p2);
}
/**
@@ -482,20 +482,20 @@ public:
*
* If U_FAILURE(errorCode), then the current array is retained and the new one deleted.
*
- * If U_SUCCESS(errorCode) but the input pointer is NULL,
+ * If U_SUCCESS(errorCode) but the input pointer is nullptr,
* then U_MEMORY_ALLOCATION_ERROR is set,
- * the current array is deleted, and NULL is set.
+ * the current array is deleted, and nullptr is set.
*
* @param p simple pointer to an array of T objects that is adopted
* @param errorCode in/out UErrorCode, set to U_MEMORY_ALLOCATION_ERROR
- * if p==NULL and no other failure code had been set
+ * if p==nullptr and no other failure code had been set
* @stable ICU 56
*/
void adoptInsteadAndCheckErrorCode(T *p, UErrorCode &errorCode) {
if(U_SUCCESS(errorCode)) {
delete[] LocalPointerBase<T>::ptr;
LocalPointerBase<T>::ptr=p;
- if(p==NULL) {
+ if(p==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
}
} else {
@@ -552,19 +552,19 @@ public:
public: \
using LocalPointerBase<Type>::operator*; \
using LocalPointerBase<Type>::operator->; \
- explicit LocalPointerClassName(Type *p=NULL) : LocalPointerBase<Type>(p) {} \
- LocalPointerClassName(LocalPointerClassName &&src) U_NOEXCEPT \
+ explicit LocalPointerClassName(Type *p=nullptr) : LocalPointerBase<Type>(p) {} \
+ LocalPointerClassName(LocalPointerClassName &&src) noexcept \
: LocalPointerBase<Type>(src.ptr) { \
- src.ptr=NULL; \
+ src.ptr=nullptr; \
} \
/* TODO: Be agnostic of the deleter function signature from the user-provided std::unique_ptr? */ \
explicit LocalPointerClassName(std::unique_ptr<Type, decltype(&closeFunction)> &&p) \
: LocalPointerBase<Type>(p.release()) {} \
- ~LocalPointerClassName() { if (ptr != NULL) { closeFunction(ptr); } } \
- LocalPointerClassName &operator=(LocalPointerClassName &&src) U_NOEXCEPT { \
- if (ptr != NULL) { closeFunction(ptr); } \
+ ~LocalPointerClassName() { if (ptr != nullptr) { closeFunction(ptr); } } \
+ LocalPointerClassName &operator=(LocalPointerClassName &&src) noexcept { \
+ if (ptr != nullptr) { closeFunction(ptr); } \
LocalPointerBase<Type>::ptr=src.ptr; \
- src.ptr=NULL; \
+ src.ptr=nullptr; \
return *this; \
} \
/* TODO: Be agnostic of the deleter function signature from the user-provided std::unique_ptr? */ \
@@ -572,16 +572,16 @@ public:
adoptInstead(p.release()); \
return *this; \
} \
- void swap(LocalPointerClassName &other) U_NOEXCEPT { \
+ void swap(LocalPointerClassName &other) noexcept { \
Type *temp=LocalPointerBase<Type>::ptr; \
LocalPointerBase<Type>::ptr=other.ptr; \
other.ptr=temp; \
} \
- friend inline void swap(LocalPointerClassName &p1, LocalPointerClassName &p2) U_NOEXCEPT { \
+ friend inline void swap(LocalPointerClassName &p1, LocalPointerClassName &p2) noexcept { \
p1.swap(p2); \
} \
void adoptInstead(Type *p) { \
- if (ptr != NULL) { closeFunction(ptr); } \
+ if (ptr != nullptr) { closeFunction(ptr); } \
ptr=p; \
} \
operator std::unique_ptr<Type, decltype(&closeFunction)> () && { \
diff --git a/thirdparty/icu4c/common/unicode/locid.h b/thirdparty/icu4c/common/unicode/locid.h
index 2f2b3998a7..a6fbbb7041 100644
--- a/thirdparty/icu4c/common/unicode/locid.h
+++ b/thirdparty/icu4c/common/unicode/locid.h
@@ -258,7 +258,7 @@ public:
* @param language Lowercase two-letter or three-letter ISO-639 code.
* This parameter can instead be an ICU style C locale (e.g. "en_US"),
* but the other parameters must not be used.
- * This parameter can be NULL; if so,
+ * This parameter can be nullptr; if so,
* the locale is initialized to match the current default locale.
* (This is the same as using the default constructor.)
* Please note: The Java Locale class does NOT accept the form
@@ -294,7 +294,7 @@ public:
* @param other The Locale object being moved in.
* @stable ICU 63
*/
- Locale(Locale&& other) U_NOEXCEPT;
+ Locale(Locale&& other) noexcept;
/**
* Destructor
@@ -320,7 +320,7 @@ public:
* @return *this
* @stable ICU 63
*/
- Locale& operator=(Locale&& other) U_NOEXCEPT;
+ Locale& operator=(Locale&& other) noexcept;
/**
* Checks if two locale keys are the same.
@@ -344,7 +344,7 @@ public:
/**
* Clone this object.
* Clones can be used concurrently in multiple threads.
- * If an error occurs, then NULL is returned.
+ * If an error occurs, then nullptr is returned.
* The caller must delete the clone.
*
* @return a clone of this object
@@ -378,7 +378,7 @@ public:
* setDefault() only changes ICU's default locale ID, <strong>not</strong>
* the default locale ID of the runtime environment.
*
- * @param newLocale Locale to set to. If NULL, set to the value obtained
+ * @param newLocale Locale to set to. If nullptr, set to the value obtained
* from the runtime environment.
* @param success The error code.
* @system
@@ -453,7 +453,7 @@ public:
/**
* Creates a locale from the given string after canonicalizing
* the string according to CLDR by calling uloc_canonicalize().
- * @param name the locale ID to create from. Must not be NULL.
+ * @param name the locale ID to create from. Must not be nullptr.
* @return a new locale object corresponding to the given name
* @stable ICU 3.0
* @see uloc_canonicalize
@@ -583,7 +583,7 @@ public:
* 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 nullptr if there are no keywords.
* Client must dispose of it by calling delete.
* @see getKeywords
* @stable ICU 2.8
@@ -594,7 +594,7 @@ public:
* Gets the list of Unicode 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 nullptr if there are no keywords.
* Client must dispose of it by calling delete.
* @see getUnicodeKeywords
* @stable ICU 63
@@ -722,7 +722,7 @@ public:
*
* @param keywordName name of the keyword to be set. 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
+ * nullptr, 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.
*
@@ -743,7 +743,7 @@ public:
*
* @param keywordName name of the keyword to be set.
* @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
+ * nullptr, 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.
* @stable ICU 63
@@ -763,7 +763,7 @@ public:
*
* @param keywordName name of the keyword to be set.
* @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
+ * nullptr, 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.
* @stable ICU 63
diff --git a/thirdparty/icu4c/common/unicode/messagepattern.h b/thirdparty/icu4c/common/unicode/messagepattern.h
index 4c5be13dbc..55b09bfbd4 100644
--- a/thirdparty/icu4c/common/unicode/messagepattern.h
+++ b/thirdparty/icu4c/common/unicode/messagepattern.h
@@ -388,7 +388,7 @@ public:
* @param pattern a MessageFormat pattern string
* @param parseError Struct to receive information on the position
* of an error within the pattern.
- * Can be NULL.
+ * Can be nullptr.
* @param errorCode Standard 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
@@ -428,7 +428,7 @@ public:
* @param pattern a MessageFormat pattern string
* @param parseError Struct to receive information on the position
* of an error within the pattern.
- * Can be NULL.
+ * Can be nullptr.
* @param errorCode Standard 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
@@ -448,7 +448,7 @@ public:
* @param pattern a ChoiceFormat pattern string
* @param parseError Struct to receive information on the position
* of an error within the pattern.
- * Can be NULL.
+ * Can be nullptr.
* @param errorCode Standard 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
@@ -468,7 +468,7 @@ public:
* @param pattern a PluralFormat pattern string
* @param parseError Struct to receive information on the position
* of an error within the pattern.
- * Can be NULL.
+ * Can be nullptr.
* @param errorCode Standard 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
@@ -488,7 +488,7 @@ public:
* @param pattern a SelectFormat pattern string
* @param parseError Struct to receive information on the position
* of an error within the pattern.
- * Can be NULL.
+ * Can be nullptr.
* @param errorCode Standard 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
diff --git a/thirdparty/icu4c/common/unicode/normalizer2.h b/thirdparty/icu4c/common/unicode/normalizer2.h
index 2d355250c2..972894ec42 100644
--- a/thirdparty/icu4c/common/unicode/normalizer2.h
+++ b/thirdparty/icu4c/common/unicode/normalizer2.h
@@ -92,7 +92,7 @@ public:
/**
* Returns a Normalizer2 instance for Unicode NFC normalization.
- * Same as getInstance(NULL, "nfc", UNORM2_COMPOSE, errorCode).
+ * Same as getInstance(nullptr, "nfc", UNORM2_COMPOSE, errorCode).
* Returns an unmodifiable singleton instance. Do not delete it.
* @param errorCode Standard ICU error code. Its input value must
* pass the U_SUCCESS() test, or else the function returns
@@ -106,7 +106,7 @@ public:
/**
* Returns a Normalizer2 instance for Unicode NFD normalization.
- * Same as getInstance(NULL, "nfc", UNORM2_DECOMPOSE, errorCode).
+ * Same as getInstance(nullptr, "nfc", UNORM2_DECOMPOSE, errorCode).
* Returns an unmodifiable singleton instance. Do not delete it.
* @param errorCode Standard ICU error code. Its input value must
* pass the U_SUCCESS() test, or else the function returns
@@ -120,7 +120,7 @@ public:
/**
* Returns a Normalizer2 instance for Unicode NFKC normalization.
- * Same as getInstance(NULL, "nfkc", UNORM2_COMPOSE, errorCode).
+ * Same as getInstance(nullptr, "nfkc", UNORM2_COMPOSE, errorCode).
* Returns an unmodifiable singleton instance. Do not delete it.
* @param errorCode Standard ICU error code. Its input value must
* pass the U_SUCCESS() test, or else the function returns
@@ -134,7 +134,7 @@ public:
/**
* Returns a Normalizer2 instance for Unicode NFKD normalization.
- * Same as getInstance(NULL, "nfkc", UNORM2_DECOMPOSE, errorCode).
+ * Same as getInstance(nullptr, "nfkc", UNORM2_DECOMPOSE, errorCode).
* Returns an unmodifiable singleton instance. Do not delete it.
* @param errorCode Standard ICU error code. Its input value must
* pass the U_SUCCESS() test, or else the function returns
@@ -148,7 +148,7 @@ public:
/**
* Returns a Normalizer2 instance for Unicode NFKC_Casefold normalization.
- * Same as getInstance(NULL, "nfkc_cf", UNORM2_COMPOSE, errorCode).
+ * Same as getInstance(nullptr, "nfkc_cf", UNORM2_COMPOSE, errorCode).
* Returns an unmodifiable singleton instance. Do not delete it.
* @param errorCode Standard ICU error code. Its input value must
* pass the U_SUCCESS() test, or else the function returns
@@ -166,12 +166,12 @@ public:
* and which composes or decomposes text according to the specified mode.
* Returns an unmodifiable singleton instance. Do not delete it.
*
- * Use packageName=NULL for data files that are part of ICU's own data.
+ * Use packageName=nullptr for data files that are part of ICU's own data.
* Use name="nfc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFC/NFD.
* Use name="nfkc" and UNORM2_COMPOSE/UNORM2_DECOMPOSE for Unicode standard NFKC/NFKD.
* Use name="nfkc_cf" and UNORM2_COMPOSE for Unicode standard NFKC_CF=NFKC_Casefold.
*
- * @param packageName NULL for ICU built-in data, otherwise application data package name
+ * @param packageName nullptr for ICU built-in data, otherwise application data package name
* @param name "nfc" or "nfkc" or "nfkc_cf" or name of custom data file
* @param mode normalization mode (compose or decompose etc.)
* @param errorCode Standard ICU error code. Its input value must
@@ -533,7 +533,7 @@ public:
virtual UnicodeString &
normalize(const UnicodeString &src,
UnicodeString &dest,
- UErrorCode &errorCode) const U_OVERRIDE;
+ UErrorCode &errorCode) const override;
/**
* Normalizes a UTF-8 string and optionally records how source substrings
@@ -559,7 +559,7 @@ public:
*/
virtual void
normalizeUTF8(uint32_t options, StringPiece src, ByteSink &sink,
- Edits *edits, UErrorCode &errorCode) const U_OVERRIDE;
+ Edits *edits, UErrorCode &errorCode) const override;
/**
* Appends the normalized form of the second string to the first string
@@ -578,7 +578,7 @@ public:
virtual UnicodeString &
normalizeSecondAndAppend(UnicodeString &first,
const UnicodeString &second,
- UErrorCode &errorCode) const U_OVERRIDE;
+ UErrorCode &errorCode) const override;
/**
* Appends the second string to the first string
* (merging them at the boundary) and returns the first string.
@@ -596,7 +596,7 @@ public:
virtual UnicodeString &
append(UnicodeString &first,
const UnicodeString &second,
- UErrorCode &errorCode) const U_OVERRIDE;
+ UErrorCode &errorCode) const override;
/**
* Gets the decomposition mapping of c.
@@ -610,7 +610,7 @@ public:
* @stable ICU 4.6
*/
virtual UBool
- getDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE;
+ getDecomposition(UChar32 c, UnicodeString &decomposition) const override;
/**
* Gets the raw decomposition mapping of c.
@@ -624,7 +624,7 @@ public:
* @stable ICU 49
*/
virtual UBool
- getRawDecomposition(UChar32 c, UnicodeString &decomposition) const U_OVERRIDE;
+ getRawDecomposition(UChar32 c, UnicodeString &decomposition) const override;
/**
* Performs pairwise composition of a & b and returns the composite if there is one.
@@ -637,7 +637,7 @@ public:
* @stable ICU 49
*/
virtual UChar32
- composePair(UChar32 a, UChar32 b) const U_OVERRIDE;
+ composePair(UChar32 a, UChar32 b) const override;
/**
* Gets the combining class of c.
@@ -648,7 +648,7 @@ public:
* @stable ICU 49
*/
virtual uint8_t
- getCombiningClass(UChar32 c) const U_OVERRIDE;
+ getCombiningClass(UChar32 c) const override;
/**
* Tests if the string is normalized.
@@ -662,7 +662,7 @@ public:
* @stable ICU 4.4
*/
virtual UBool
- isNormalized(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE;
+ isNormalized(const UnicodeString &s, UErrorCode &errorCode) const override;
/**
* Tests if the UTF-8 string is normalized.
* Internally, in cases where the quickCheck() method would return "maybe"
@@ -683,7 +683,7 @@ public:
* @stable ICU 60
*/
virtual UBool
- isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const U_OVERRIDE;
+ isNormalizedUTF8(StringPiece s, UErrorCode &errorCode) const override;
/**
* Tests if the string is normalized.
* For details see the Normalizer2 base class documentation.
@@ -696,7 +696,7 @@ public:
* @stable ICU 4.4
*/
virtual UNormalizationCheckResult
- quickCheck(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE;
+ quickCheck(const UnicodeString &s, UErrorCode &errorCode) const override;
/**
* Returns the end of the normalized substring of the input string.
* For details see the Normalizer2 base class documentation.
@@ -709,7 +709,7 @@ public:
* @stable ICU 4.4
*/
virtual int32_t
- spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const U_OVERRIDE;
+ spanQuickCheckYes(const UnicodeString &s, UErrorCode &errorCode) const override;
/**
* Tests if the character always has a normalization boundary before it,
@@ -719,7 +719,7 @@ public:
* @return true if c has a normalization boundary before it
* @stable ICU 4.4
*/
- virtual UBool hasBoundaryBefore(UChar32 c) const U_OVERRIDE;
+ virtual UBool hasBoundaryBefore(UChar32 c) const override;
/**
* Tests if the character always has a normalization boundary after it,
@@ -729,7 +729,7 @@ public:
* @return true if c has a normalization boundary after it
* @stable ICU 4.4
*/
- virtual UBool hasBoundaryAfter(UChar32 c) const U_OVERRIDE;
+ virtual UBool hasBoundaryAfter(UChar32 c) const override;
/**
* Tests if the character is normalization-inert.
@@ -738,7 +738,7 @@ public:
* @return true if c is normalization-inert
* @stable ICU 4.4
*/
- virtual UBool isInert(UChar32 c) const U_OVERRIDE;
+ virtual UBool isInert(UChar32 c) const override;
private:
UnicodeString &
normalize(const UnicodeString &src,
diff --git a/thirdparty/icu4c/common/unicode/normlzr.h b/thirdparty/icu4c/common/unicode/normlzr.h
index 14b2469885..03a7aa080d 100644
--- a/thirdparty/icu4c/common/unicode/normlzr.h
+++ b/thirdparty/icu4c/common/unicode/normlzr.h
@@ -755,7 +755,7 @@ private:
// Private data
//-------------------------------------------------------------------------
- FilteredNormalizer2*fFilteredNorm2; // owned if not NULL
+ FilteredNormalizer2*fFilteredNorm2; // owned if not nullptr
const Normalizer2 *fNorm2; // not owned; may be equal to fFilteredNorm2
UNormalizationMode fUMode; // deprecated
int32_t fOptions;
diff --git a/thirdparty/icu4c/common/unicode/parsepos.h b/thirdparty/icu4c/common/unicode/parsepos.h
index 73945f5f97..d33a812ad0 100644
--- a/thirdparty/icu4c/common/unicode/parsepos.h
+++ b/thirdparty/icu4c/common/unicode/parsepos.h
@@ -112,7 +112,7 @@ public:
/**
* Clone this object.
* Clones can be used concurrently in multiple threads.
- * If an error occurs, then NULL is returned.
+ * If an error occurs, then nullptr is returned.
* The caller must delete the clone.
*
* @return a clone of this object
diff --git a/thirdparty/icu4c/common/unicode/platform.h b/thirdparty/icu4c/common/unicode/platform.h
index 1605226a79..a997843660 100644
--- a/thirdparty/icu4c/common/unicode/platform.h
+++ b/thirdparty/icu4c/common/unicode/platform.h
@@ -460,6 +460,13 @@
# define UPRV_HAS_WARNING(x) 0
#endif
+
+#if defined(__clang__)
+#define UPRV_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined")))
+#else
+#define UPRV_NO_SANITIZE_UNDEFINED
+#endif
+
/**
* \def U_MALLOC_ATTR
* Attribute to mark functions as malloc-like
@@ -509,26 +516,6 @@
# define U_CPLUSPLUS_VERSION 1
#endif
-#if (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)
-// add in std::nullptr_t
-namespace std {
- typedef decltype(nullptr) nullptr_t;
-};
-#endif
-
-/**
- * \def U_NOEXCEPT
- * "noexcept" if supported, otherwise empty.
- * Some code, especially STL containers, uses move semantics of objects only
- * if the move constructor and the move operator are declared as not throwing exceptions.
- * @internal
- */
-#ifdef U_NOEXCEPT
- /* Use the predefined value. */
-#else
-# define U_NOEXCEPT noexcept
-#endif
-
/**
* \def U_FALLTHROUGH
* Annotate intentional fall-through between switch labels.
@@ -757,7 +744,7 @@ namespace std {
* \def U_HAVE_CHAR16_T
* Defines whether the char16_t type is available for UTF-16
* and u"abc" UTF-16 string literals are supported.
- * This is a new standard type and standard string literal syntax in C++0x
+ * This is a new standard type and standard string literal syntax in C++11
* but has been available in some compilers before.
* @internal
*/
@@ -766,12 +753,6 @@ namespace std {
#else
/*
* Notes:
- * Visual Studio 2010 (_MSC_VER==1600) defines char16_t as a typedef
- * and does not support u"abc" string literals.
- * Visual Studio 2015 (_MSC_VER>=1900) and above adds support for
- * both char16_t and u"abc" string literals.
- * gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but
- * does not support u"abc" string literals.
* C++11 and C11 require support for UTF-16 literals
* TODO: Fix for plain C. Doesn't work on Mac.
*/
diff --git a/thirdparty/icu4c/common/unicode/rbbi.h b/thirdparty/icu4c/common/unicode/rbbi.h
index d878243e3f..418b52e41f 100644
--- a/thirdparty/icu4c/common/unicode/rbbi.h
+++ b/thirdparty/icu4c/common/unicode/rbbi.h
@@ -54,14 +54,14 @@ class UStack;
*
* <p>This class is not intended to be subclassed.</p>
*/
-class U_COMMON_API RuleBasedBreakIterator /*U_FINAL*/ : public BreakIterator {
+class U_COMMON_API RuleBasedBreakIterator /*final*/ : public BreakIterator {
private:
/**
* The UText through which this BreakIterator accesses the text
* @internal (private)
*/
- UText fText;
+ UText fText = UTEXT_INITIALIZER;
#ifndef U_HIDE_INTERNAL_API
public:
@@ -71,32 +71,38 @@ public:
* Not for general use; Public only for testing purposes.
* @internal
*/
- RBBIDataWrapper *fData;
+ RBBIDataWrapper *fData = nullptr;
+
private:
+ /**
+ * The saved error code associated with this break iterator.
+ * This is the value to be returned by copyErrorTo().
+ */
+ UErrorCode fErrorCode = U_ZERO_ERROR;
/**
* The current position of the iterator. Pinned, 0 < fPosition <= text.length.
* Never has the value UBRK_DONE (-1).
*/
- int32_t fPosition;
+ int32_t fPosition = 0;
/**
* TODO:
*/
- int32_t fRuleStatusIndex;
+ int32_t fRuleStatusIndex = 0;
/**
* Cache of previously determined boundary positions.
*/
class BreakCache;
- BreakCache *fBreakCache;
+ BreakCache *fBreakCache = nullptr;
/**
* Cache of boundary positions within a region of text that has been
* sub-divided by dictionary based breaking.
*/
class DictionaryCache;
- DictionaryCache *fDictionaryCache;
+ DictionaryCache *fDictionaryCache = nullptr;
/**
*
@@ -105,7 +111,7 @@ private:
* handle a given character.
* @internal (private)
*/
- UStack *fLanguageBreakEngines;
+ UStack *fLanguageBreakEngines = nullptr;
/**
*
@@ -114,43 +120,43 @@ private:
* LanguageBreakEngine.
* @internal (private)
*/
- UnhandledEngine *fUnhandledBreakEngine;
+ UnhandledEngine *fUnhandledBreakEngine = nullptr;
/**
* Counter for the number of characters encountered with the "dictionary"
* flag set.
* @internal (private)
*/
- uint32_t fDictionaryCharCount;
+ uint32_t fDictionaryCharCount = 0;
/**
* A character iterator that refers to the same text as the UText, above.
* Only included for compatibility with old API, which was based on CharacterIterators.
* Value may be adopted from outside, or one of fSCharIter or fDCharIter, below.
*/
- CharacterIterator *fCharIter;
+ CharacterIterator *fCharIter = &fSCharIter;
/**
* When the input text is provided by a UnicodeString, this will point to
* a characterIterator that wraps that data. Needed only for the
* implementation of getText(), a backwards compatibility issue.
*/
- StringCharacterIterator fSCharIter;
+ UCharCharacterIterator fSCharIter {u"", 0};
/**
* True when iteration has run off the end, and iterator functions should return UBRK_DONE.
*/
- UBool fDone;
+ bool fDone = false;
/**
* Array of look-ahead tentative results.
*/
- int32_t *fLookAheadMatches;
+ int32_t *fLookAheadMatches = nullptr;
/**
* A flag to indicate if phrase based breaking is enabled.
*/
- UBool fIsPhraseBreaking;
+ UBool fIsPhraseBreaking = false;
//=======================================================================
// constructors
@@ -188,10 +194,19 @@ private:
/** @internal */
friend class BreakIterator;
+ /**
+ * Default constructor with an error code parameter.
+ * Aside from error handling, otherwise identical to the default constructor.
+ * Internally, handles common initialization for other constructors.
+ * @internal (private)
+ */
+ RuleBasedBreakIterator(UErrorCode *status);
+
public:
/** Default constructor. Creates an empty shell of an iterator, with no
- * rules or text to iterate over. Object can subsequently be assigned to.
+ * rules or text to iterate over. Object can subsequently be assigned to,
+ * but is otherwise unusable.
* @stable ICU 2.2
*/
RuleBasedBreakIterator();
@@ -289,7 +304,9 @@ public:
* @return true if both BreakIterators are not same.
* @stable ICU 2.0
*/
- inline bool operator!=(const BreakIterator& that) const;
+ inline bool operator!=(const BreakIterator& that) const {
+ return !operator==(that);
+ }
/**
* Returns a newly-constructed RuleBasedBreakIterator with the same
@@ -335,8 +352,7 @@ public:
* </p>
* <p>
* When the break iterator is operating on text supplied via a UText,
- * this function will fail. Lacking any way to signal failures, it
- * returns an CharacterIterator containing no text.
+ * this function will fail, returning a CharacterIterator containing no text.
* The function getUText() provides similar functionality,
* is reliable, and is more efficient.
* </p>
@@ -356,7 +372,7 @@ public:
* access the text without impacting any break iterator operations,
* but the underlying text itself must not be altered.
*
- * @param fillIn A UText to be filled in. If NULL, a new UText will be
+ * @param fillIn A UText to be filled in. If nullptr, a new UText will be
* allocated to hold the result.
* @param status receives any error codes.
* @return The current UText for this break iterator. If an input
@@ -576,7 +592,7 @@ public:
* tricky. Use clone() instead.
*
* @param stackBuffer The pointer to the memory into which the cloned object
- * should be placed. If NULL, allocate heap memory
+ * should be placed. If nullptr, allocate heap memory
* for the cloned object.
* @param BufferSize The size of the buffer. If zero, return the required
* buffer size, but do not clone the object. If the
@@ -649,12 +665,6 @@ private:
// implementation
//=======================================================================
/**
- * Common initialization function, used by constructors and bufferClone.
- * @internal (private)
- */
- void init(UErrorCode &status);
-
- /**
* Iterate backwards from an arbitrary position in the input text using the
* synthesized Safe Reverse rules.
* This locates a "Safe Position" from which the forward break rules
@@ -726,16 +736,6 @@ private:
#endif /* U_HIDE_INTERNAL_API */
};
-//------------------------------------------------------------------------------
-//
-// Inline Functions Definitions ...
-//
-//------------------------------------------------------------------------------
-
-inline bool RuleBasedBreakIterator::operator!=(const BreakIterator& that) const {
- return !operator==(that);
-}
-
U_NAMESPACE_END
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
diff --git a/thirdparty/icu4c/common/unicode/rep.h b/thirdparty/icu4c/common/unicode/rep.h
index 6dd4530647..7115c97b82 100644
--- a/thirdparty/icu4c/common/unicode/rep.h
+++ b/thirdparty/icu4c/common/unicode/rep.h
@@ -192,7 +192,7 @@ public:
* Clone this object, an instance of a subclass of 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.
+ * then nullptr is returned.
* The caller must delete the clone.
*
* @return a clone of this object
diff --git a/thirdparty/icu4c/common/unicode/resbund.h b/thirdparty/icu4c/common/unicode/resbund.h
index 6e26a40591..30fc2ac0ab 100644
--- a/thirdparty/icu4c/common/unicode/resbund.h
+++ b/thirdparty/icu4c/common/unicode/resbund.h
@@ -143,7 +143,7 @@ public:
* 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.
- * NULL is used to refer to ICU data.
+ * nullptr is used to refer to ICU data.
* @param locale The locale for which to open a resource bundle.
* @param err A UErrorCode value
* @stable ICU 2.0
@@ -189,7 +189,7 @@ public:
/**
* Clone this object.
* Clones can be used concurrently in multiple threads.
- * If an error occurs, then NULL is returned.
+ * If an error occurs, then nullptr is returned.
* The caller must delete the clone.
*
* @return a clone of this object
@@ -304,7 +304,7 @@ public:
* Returns the key associated with this resource. Not all the resources have a key - only
* those that are members of a table.
*
- * @return a key associated to this resource, or NULL if it doesn't have a key
+ * @return a key associated to this resource, or nullptr if it doesn't have a key
* @stable ICU 2.0
*/
const char*
@@ -331,7 +331,7 @@ public:
getType(void) const;
/**
- * Returns the next resource in a given resource or NULL if there are no more resources
+ * Returns the next resource in a given resource or nullptr if there are no more resources
*
* @param status fills in the outgoing error code
* @return ResourceBundle object.
@@ -341,7 +341,7 @@ public:
getNext(UErrorCode& status);
/**
- * Returns the next string in a resource or NULL if there are no more resources
+ * Returns the next string in a resource or nullptr if there are no more resources
* to iterate over.
*
* @param status fills in the outgoing error code
@@ -352,7 +352,7 @@ public:
getNextString(UErrorCode& status);
/**
- * Returns the next string in a resource or NULL if there are no more resources
+ * Returns the next string in a resource or nullptr if there are no more resources
* to iterate over.
*
* @param key fill in for key associated with this string
diff --git a/thirdparty/icu4c/common/unicode/simpleformatter.h b/thirdparty/icu4c/common/unicode/simpleformatter.h
index 6d9c04ace2..7f58106fad 100644
--- a/thirdparty/icu4c/common/unicode/simpleformatter.h
+++ b/thirdparty/icu4c/common/unicode/simpleformatter.h
@@ -59,7 +59,7 @@ class SimpleModifier;
* @see UMessagePatternApostropheMode
* @stable ICU 57
*/
-class U_COMMON_API SimpleFormatter U_FINAL : public UMemory {
+class U_COMMON_API SimpleFormatter final : public UMemory {
public:
/**
* Default constructor.
@@ -217,13 +217,13 @@ public:
*
* @param values The argument values.
* An argument value must not be the same object as appendTo.
- * Can be NULL if valuesLength==getArgumentLimit()==0.
+ * Can be nullptr if valuesLength==getArgumentLimit()==0.
* @param valuesLength The length of the values array.
* Must be at least getArgumentLimit().
* @param appendTo Gets the formatted pattern and values appended.
* @param offsets offsets[i] receives the offset of where
* values[i] replaced pattern argument {i}.
- * Can be shorter or longer than values. Can be NULL if offsetsLength==0.
+ * Can be shorter or longer than values. Can be nullptr if offsetsLength==0.
* If there is no {i} in the pattern, then offsets[i] is set to -1.
* @param offsetsLength The length of the offsets array.
* @param errorCode ICU error code in/out parameter.
@@ -243,13 +243,13 @@ public:
*
* @param values The argument values.
* An argument value may be the same object as result.
- * Can be NULL if valuesLength==getArgumentLimit()==0.
+ * Can be nullptr if valuesLength==getArgumentLimit()==0.
* @param valuesLength The length of the values array.
* Must be at least getArgumentLimit().
* @param result Gets its contents replaced by the formatted pattern and values.
* @param offsets offsets[i] receives the offset of where
* values[i] replaced pattern argument {i}.
- * Can be shorter or longer than values. Can be NULL if offsetsLength==0.
+ * Can be shorter or longer than values. Can be nullptr if offsetsLength==0.
* If there is no {i} in the pattern, then offsets[i] is set to -1.
* @param offsetsLength The length of the offsets array.
* @param errorCode ICU error code in/out parameter.
diff --git a/thirdparty/icu4c/common/unicode/strenum.h b/thirdparty/icu4c/common/unicode/strenum.h
index 1d1b37940a..fba5c9b814 100644
--- a/thirdparty/icu4c/common/unicode/strenum.h
+++ b/thirdparty/icu4c/common/unicode/strenum.h
@@ -70,7 +70,7 @@ public:
* Clone this object, an instance of a subclass of StringEnumeration.
* Clones can be used concurrently in multiple threads.
* If a subclass does not implement clone(), or if an error occurs,
- * then NULL is returned.
+ * then nullptr is returned.
* The caller must delete the clone.
*
* @return a clone of this object
@@ -101,8 +101,8 @@ public:
/**
* <p>Returns the next element as a NUL-terminated char*. If there
- * are no more elements, returns NULL. If the resultLength pointer
- * is not NULL, the length of the string (not counting the
+ * are no more elements, returns nullptr. If the resultLength pointer
+ * is not nullptr, the length of the string (not counting the
* terminating NUL) is returned at that address. If an error
* status is returned, the value at resultLength is undefined.</p>
*
@@ -111,21 +111,21 @@ public:
* to next, unext, snext, reset, or the enumerator's destructor.</p>
*
* <p>If the iterator is out of sync with its service, status is set
- * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.</p>
+ * to U_ENUM_OUT_OF_SYNC_ERROR and nullptr is returned.</p>
*
* <p>If the native service string is a char16_t* string, it is
* converted to char* with the invariant converter. If the
* conversion fails (because a character cannot be converted) then
* status is set to U_INVARIANT_CONVERSION_ERROR and the return
- * value is undefined (though not NULL).</p>
+ * value is undefined (though not nullptr).</p>
*
* Starting with ICU 2.8, the default implementation calls snext()
* and handles the conversion.
* Either next() or snext() must be implemented differently by a subclass.
*
* @param status the error code.
- * @param resultLength a pointer to receive the length, can be NULL.
- * @return a pointer to the string, or NULL.
+ * @param resultLength a pointer to receive the length, can be nullptr.
+ * @return a pointer to the string, or nullptr.
*
* @stable ICU 2.4
*/
@@ -133,8 +133,8 @@ public:
/**
* <p>Returns the next element as a NUL-terminated char16_t*. If there
- * are no more elements, returns NULL. If the resultLength pointer
- * is not NULL, the length of the string (not counting the
+ * are no more elements, returns nullptr. If the resultLength pointer
+ * is not nullptr, the length of the string (not counting the
* terminating NUL) is returned at that address. If an error
* status is returned, the value at resultLength is undefined.</p>
*
@@ -143,14 +143,14 @@ public:
* to next, unext, snext, reset, or the enumerator's destructor.</p>
*
* <p>If the iterator is out of sync with its service, status is set
- * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.</p>
+ * to U_ENUM_OUT_OF_SYNC_ERROR and nullptr is returned.</p>
*
* Starting with ICU 2.8, the default implementation calls snext()
* and handles the conversion.
*
* @param status the error code.
- * @param resultLength a pointer to receive the length, can be NULL.
- * @return a pointer to the string, or NULL.
+ * @param resultLength a pointer to receive the length, can be nullptr.
+ * @return a pointer to the string, or nullptr.
*
* @stable ICU 2.4
*/
@@ -158,21 +158,21 @@ public:
/**
* <p>Returns the next element a UnicodeString*. If there are no
- * more elements, returns NULL.</p>
+ * more elements, returns nullptr.</p>
*
* <p>The returned pointer is owned by this iterator and must not be
* deleted by the caller. The pointer is valid until the next call
* to next, unext, snext, reset, or the enumerator's destructor.</p>
*
* <p>If the iterator is out of sync with its service, status is set
- * to U_ENUM_OUT_OF_SYNC_ERROR and NULL is returned.</p>
+ * to U_ENUM_OUT_OF_SYNC_ERROR and nullptr is returned.</p>
*
* Starting with ICU 2.8, the default implementation calls next()
* and handles the conversion.
* Either next() or snext() must be implemented differently by a subclass.
*
* @param status the error code.
- * @return a pointer to the string, or NULL.
+ * @return a pointer to the string, or nullptr.
*
* @stable ICU 2.4
*/
diff --git a/thirdparty/icu4c/common/unicode/stringtriebuilder.h b/thirdparty/icu4c/common/unicode/stringtriebuilder.h
index b7a9b23d22..429d7883f1 100644
--- a/thirdparty/icu4c/common/unicode/stringtriebuilder.h
+++ b/thirdparty/icu4c/common/unicode/stringtriebuilder.h
@@ -152,7 +152,7 @@ protected:
* equivalent to newNode.
* @param newNode Input node. The builder takes ownership.
* @param errorCode ICU in/out UErrorCode.
- Set to U_MEMORY_ALLOCATION_ERROR if it was success but newNode==NULL.
+ Set to U_MEMORY_ALLOCATION_ERROR if it was success but newNode==nullptr.
* @return newNode if it is the first of its kind, or
* an equivalent node if newNode is a duplicate.
* @internal
@@ -164,7 +164,7 @@ protected:
* Avoids creating a node if the value is a duplicate.
* @param value A final value.
* @param errorCode ICU in/out UErrorCode.
- Set to U_MEMORY_ALLOCATION_ERROR if it was success but newNode==NULL.
+ Set to U_MEMORY_ALLOCATION_ERROR if it was success but newNode==nullptr.
* @return A FinalValueNode with the given value.
* @internal
*/
@@ -176,11 +176,11 @@ protected:
* registerNode() and registerFinalValue() take ownership of their input nodes,
* and only return owned nodes.
* If they see a failure UErrorCode, they will delete the input node.
- * If they get a NULL pointer, they will record a U_MEMORY_ALLOCATION_ERROR.
- * If there is a failure, they return NULL.
+ * If they get a nullptr pointer, they will record a U_MEMORY_ALLOCATION_ERROR.
+ * If there is a failure, they return nullptr.
*
- * NULL Node pointers can be safely passed into other Nodes because
- * they call the static Node::hashCode() which checks for a NULL pointer first.
+ * nullptr Node pointers can be safely passed into other Nodes because
+ * they call the static Node::hashCode() which checks for a nullptr pointer first.
*
* Therefore, as long as builder functions register a new node,
* they need to check for failures only before explicitly dereferencing
@@ -201,8 +201,8 @@ protected:
public:
Node(int32_t initialHash) : hash(initialHash), offset(0) {}
inline int32_t hashCode() const { return hash; }
- // Handles node==NULL.
- static inline int32_t hashCode(const Node *node) { return node==NULL ? 0 : node->hashCode(); }
+ // Handles node==nullptr.
+ static inline int32_t hashCode(const Node *node) { return node==nullptr ? 0 : node->hashCode(); }
// Base class operator==() compares the actual class types.
virtual bool operator==(const Node &other) const;
inline bool operator!=(const Node &other) const { return !operator==(other); }
@@ -347,7 +347,7 @@ protected:
// Adds a unit with a final value.
void add(int32_t c, int32_t value) {
units[length]=(char16_t)c;
- equal[length]=NULL;
+ equal[length]=nullptr;
values[length]=value;
++length;
hash=(hash*37u+c)*37u+value;
@@ -361,7 +361,7 @@ protected:
hash=(hash*37u+c)*37u+hashCode(node);
}
protected:
- Node *equal[kMaxBranchLinearSubNodeLength]; // NULL means "has final value".
+ Node *equal[kMaxBranchLinearSubNodeLength]; // nullptr means "has final value".
int32_t length;
int32_t values[kMaxBranchLinearSubNodeLength];
char16_t units[kMaxBranchLinearSubNodeLength];
diff --git a/thirdparty/icu4c/common/unicode/symtable.h b/thirdparty/icu4c/common/unicode/symtable.h
index b64d877f97..647a3884a0 100644
--- a/thirdparty/icu4c/common/unicode/symtable.h
+++ b/thirdparty/icu4c/common/unicode/symtable.h
@@ -73,10 +73,10 @@ public:
/**
* Lookup the characters associated with this string and return it.
- * Return <tt>NULL</tt> if no such name exists. The resultant
+ * Return <tt>nullptr</tt> if no such name exists. The resultant
* string may have length zero.
* @param s the symbolic name to lookup
- * @return a string containing the name's value, or <tt>NULL</tt> if
+ * @return a string containing the name's value, or <tt>nullptr</tt> if
* there is no mapping for s.
* @stable ICU 2.8
*/
@@ -84,10 +84,10 @@ public:
/**
* Lookup the UnicodeMatcher associated with the given character, and
- * return it. Return <tt>NULL</tt> if not found.
+ * return it. Return <tt>nullptr</tt> if not found.
* @param ch a 32-bit code point from 0 to 0x10FFFF inclusive.
* @return the UnicodeMatcher object represented by the given
- * character, or NULL if there is no mapping for ch.
+ * character, or nullptr if there is no mapping for ch.
* @stable ICU 2.8
*/
virtual const UnicodeFunctor* lookupMatcher(UChar32 ch) const = 0;
diff --git a/thirdparty/icu4c/common/unicode/uchar.h b/thirdparty/icu4c/common/unicode/uchar.h
index 6bb68e62a9..4f82a9fb58 100644
--- a/thirdparty/icu4c/common/unicode/uchar.h
+++ b/thirdparty/icu4c/common/unicode/uchar.h
@@ -3836,13 +3836,10 @@ u_getPropertyValueEnum(UProperty property,
const char* alias);
/**
- * Determines if the specified character is permissible as the
- * first character in an identifier according to Unicode
- * (The Unicode Standard, Version 3.0, chapter 5.16 Identifiers).
- * True for characters with general categories "L" (letters) and "Nl" (letter numbers).
+ * Determines if the specified character is permissible as the first character in an identifier
+ * according to UAX #31 Unicode Identifier and Pattern Syntax.
*
- * Same as java.lang.Character.isUnicodeIdentifierStart().
- * Same as UCHAR_ID_START
+ * Same as Unicode ID_Start (UCHAR_ID_START).
*
* @param c the code point to be tested
* @return true if the code point may start an identifier
@@ -3856,20 +3853,13 @@ U_CAPI UBool U_EXPORT2
u_isIDStart(UChar32 c);
/**
- * Determines if the specified character is permissible
- * in an identifier according to Java.
- * True for characters with general categories "L" (letters),
- * "Nl" (letter numbers), "Nd" (decimal digits),
- * "Mc" and "Mn" (combining marks), "Pc" (connecting punctuation), and
- * u_isIDIgnorable(c).
+ * Determines if the specified character is permissible as a non-initial character of an identifier
+ * according to UAX #31 Unicode Identifier and Pattern Syntax.
*
- * Same as java.lang.Character.isUnicodeIdentifierPart().
- * Almost the same as Unicode's ID_Continue (UCHAR_ID_CONTINUE)
- * except that Unicode recommends to ignore Cf which is less than
- * u_isIDIgnorable(c).
+ * Same as Unicode ID_Continue (UCHAR_ID_CONTINUE).
*
* @param c the code point to be tested
- * @return true if the code point may occur in an identifier according to Java
+ * @return true if the code point may occur as a non-initial character of an identifier
*
* @see UCHAR_ID_CONTINUE
* @see u_isIDStart
diff --git a/thirdparty/icu4c/common/unicode/ucharstrie.h b/thirdparty/icu4c/common/unicode/ucharstrie.h
index 064244a74c..fa1b55616c 100644
--- a/thirdparty/icu4c/common/unicode/ucharstrie.h
+++ b/thirdparty/icu4c/common/unicode/ucharstrie.h
@@ -67,7 +67,7 @@ public:
* @stable ICU 4.8
*/
UCharsTrie(ConstChar16Ptr trieUChars)
- : ownedArray_(NULL), uchars_(trieUChars),
+ : ownedArray_(nullptr), uchars_(trieUChars),
pos_(uchars_), remainingMatchLength_(-1) {}
/**
@@ -83,7 +83,7 @@ public:
* @stable ICU 4.8
*/
UCharsTrie(const UCharsTrie &other)
- : ownedArray_(NULL), uchars_(other.uchars_),
+ : ownedArray_(nullptr), uchars_(other.uchars_),
pos_(other.pos_), remainingMatchLength_(other.remainingMatchLength_) {}
/**
@@ -141,7 +141,7 @@ public:
* Constructs an empty State.
* @stable ICU 4.8
*/
- State() { uchars=NULL; }
+ State() { uchars=nullptr; }
private:
friend class UCharsTrie;
@@ -175,7 +175,7 @@ public:
* @stable ICU 4.8
*/
UCharsTrie &resetToState(const State &state) {
- if(uchars_==state.uchars && uchars_!=NULL) {
+ if(uchars_==state.uchars && uchars_!=nullptr) {
pos_=state.pos;
remainingMatchLength_=state.remainingMatchLength;
}
@@ -239,7 +239,7 @@ public:
* result=next(c);
* return result;
* \endcode
- * @param s A string. Can be NULL if length is 0.
+ * @param s A string. Can be nullptr if length is 0.
* @param length The length of the string. Can be -1 if NUL-terminated.
* @return The match/value Result.
* @stable ICU 4.8
@@ -275,7 +275,7 @@ public:
inline UBool hasUniqueValue(int32_t &uniqueValue) const {
const char16_t *pos=pos_;
// Skip the rest of a pending linear-match node.
- return pos!=NULL && findUniqueValue(pos+remainingMatchLength_+1, false, uniqueValue);
+ return pos!=nullptr && findUniqueValue(pos+remainingMatchLength_+1, false, uniqueValue);
}
/**
@@ -367,7 +367,7 @@ public:
private:
UBool truncateAndStop() {
- pos_=NULL;
+ pos_=nullptr;
value_=-1; // no real value for str
return true;
}
@@ -412,7 +412,7 @@ private:
UCharsTrie &operator=(const UCharsTrie &other) = delete;
inline void stop() {
- pos_=NULL;
+ pos_=nullptr;
}
// Reads a compact 32-bit integer.
@@ -610,7 +610,7 @@ private:
// Iterator variables.
- // Pointer to next trie unit to read. NULL if no more matches.
+ // Pointer to next trie unit to read. nullptr if no more matches.
const char16_t *pos_;
// Remaining length of a linear-match node, minus 1. Negative if not in such a node.
int32_t remainingMatchLength_;
diff --git a/thirdparty/icu4c/common/unicode/uclean.h b/thirdparty/icu4c/common/unicode/uclean.h
index c2d920a16e..f5b0aa088a 100644
--- a/thirdparty/icu4c/common/unicode/uclean.h
+++ b/thirdparty/icu4c/common/unicode/uclean.h
@@ -114,7 +114,8 @@ typedef void *U_CALLCONV UMemAllocFn(const void *context, size_t size);
/**
* Pointer type for a user supplied memory re-allocation function.
* @param context user supplied value, obtained from u_setMemoryFunctions().
- * @param size The number of bytes to be allocated
+ * @param mem Pointer to the memory block to be resized.
+ * @param size The new size for the block.
* @return Pointer to the newly allocated memory, or NULL if the allocation failed.
* @stable ICU 2.8
* @system
@@ -124,8 +125,7 @@ typedef void *U_CALLCONV UMemReallocFn(const void *context, void *mem, size_t si
* Pointer type for a user supplied memory free function. Behavior should be
* similar the standard C library free().
* @param context user supplied value, obtained from u_setMemoryFunctions().
- * @param mem Pointer to the memory block to be resized
- * @param size The new size for the block
+ * @param mem Pointer to the memory block to be freed.
* @return Pointer to the resized memory block, or NULL if the resizing failed.
* @stable ICU 2.8
* @system
diff --git a/thirdparty/icu4c/common/unicode/uconfig.h b/thirdparty/icu4c/common/unicode/uconfig.h
index bbc232d1ed..3818ca02ef 100644
--- a/thirdparty/icu4c/common/unicode/uconfig.h
+++ b/thirdparty/icu4c/common/unicode/uconfig.h
@@ -323,6 +323,16 @@
# define UCONFIG_NO_NORMALIZATION 0
#endif
+/**
+ * \def UCONFIG_USE_ML_PHRASE_BREAKING
+ * This switch turns on BudouX ML phrase-based line breaking, rather than using the dictionary.
+ *
+ * @internal
+ */
+#ifndef UCONFIG_USE_ML_PHRASE_BREAKING
+# define UCONFIG_USE_ML_PHRASE_BREAKING 0
+#endif
+
#if UCONFIG_NO_NORMALIZATION
/* common library */
/* ICU 50 CJK dictionary BreakIterator uses normalization */
diff --git a/thirdparty/icu4c/common/unicode/udata.h b/thirdparty/icu4c/common/unicode/udata.h
index c5b1adc359..4cda255010 100644
--- a/thirdparty/icu4c/common/unicode/udata.h
+++ b/thirdparty/icu4c/common/unicode/udata.h
@@ -306,7 +306,7 @@ udata_getInfo(UDataMemory *pData, UDataInfo *pInfo);
* area in memory.
*
* ICU data must be at least 8-aligned, and should be 16-aligned.
- * See https://unicode-org.github.io/icu/userguide/icudata
+ * See https://unicode-org.github.io/icu/userguide/icu_data
*
* The format of this data is that of the icu common data file, as is
* generated by the pkgdata tool with mode=common or mode=dll.
@@ -353,7 +353,7 @@ udata_setCommonData(const void *data, UErrorCode *err);
* pointer.
*
* ICU data must be at least 8-aligned, and should be 16-aligned.
- * See https://unicode-org.github.io/icu/userguide/icudata
+ * See https://unicode-org.github.io/icu/userguide/icu_data
*
* The format of this data is that of the icu common data file, like 'icudt26l.dat'
* or the corresponding shared library (DLL) file.
diff --git a/thirdparty/icu4c/common/unicode/umachine.h b/thirdparty/icu4c/common/unicode/umachine.h
index 6640606272..545abef595 100644
--- a/thirdparty/icu4c/common/unicode/umachine.h
+++ b/thirdparty/icu4c/common/unicode/umachine.h
@@ -119,28 +119,6 @@
/** Obsolete/same as U_CAPI; was used to declare a function as an internal ICU C API */
#define U_INTERNAL U_CAPI
-/**
- * \def U_OVERRIDE
- * Defined to the C++11 "override" keyword if available.
- * Denotes a class or member which is an override of the base class.
- * May result in an error if it applied to something not an override.
- * @internal
- */
-#ifndef U_OVERRIDE
-#define U_OVERRIDE override
-#endif
-
-/**
- * \def U_FINAL
- * Defined to the C++11 "final" keyword if available.
- * Denotes a class or member which may not be overridden in subclasses.
- * May result in an error if subclasses attempt to override.
- * @internal
- */
-#if !defined(U_FINAL) || defined(U_IN_DOXYGEN)
-#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
@@ -348,7 +326,7 @@ typedef int8_t UBool;
/* UChar and UChar32 definitions -------------------------------------------- */
-/** Number of bytes in a UChar. @stable ICU 2.0 */
+/** Number of bytes in a UChar (always 2). @stable ICU 2.0 */
#define U_SIZEOF_UCHAR 2
/**
@@ -356,11 +334,7 @@ typedef int8_t UBool;
* If 1, then char16_t is a typedef and not a real type (yet)
* @internal
*/
-#if (U_PLATFORM == U_PF_AIX) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)
-// for AIX, uchar.h needs to be included
-# include <uchar.h>
-# define U_CHAR16_IS_TYPEDEF 1
-#elif defined(_MSC_VER) && (_MSC_VER < 1900)
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
// Versions of Visual Studio/MSVC below 2015 do not support char16_t as a real type,
// and instead use a typedef. https://msdn.microsoft.com/library/bb531344.aspx
# define U_CHAR16_IS_TYPEDEF 1
@@ -408,10 +382,10 @@ typedef int8_t UBool;
typedef char16_t UChar;
#elif defined(UCHAR_TYPE)
typedef UCHAR_TYPE UChar;
-#elif (U_CPLUSPLUS_VERSION >= 11)
- typedef char16_t UChar;
+#elif U_CPLUSPLUS_VERSION != 0
+ typedef char16_t UChar; // C++
#else
- typedef uint16_t UChar;
+ typedef uint16_t UChar; // C
#endif
/**
diff --git a/thirdparty/icu4c/common/unicode/uniset.h b/thirdparty/icu4c/common/unicode/uniset.h
index 33e35c4def..84774d9f36 100644
--- a/thirdparty/icu4c/common/unicode/uniset.h
+++ b/thirdparty/icu4c/common/unicode/uniset.h
@@ -282,7 +282,7 @@ class RuleCharacterIterator;
* @author Alan Liu
* @stable ICU 2.0
*/
-class U_COMMON_API UnicodeSet U_FINAL : public UnicodeFilter {
+class U_COMMON_API UnicodeSet final : public UnicodeFilter {
private:
/**
* Enough for sets with few ranges.
@@ -297,8 +297,8 @@ private:
int32_t len = 1; // length of list used; 1 <= len <= capacity
uint8_t fFlags = 0; // Bit flag (see constants above)
- BMPSet *bmpSet = nullptr; // The set is frozen iff either bmpSet or stringSpan is not NULL.
- UChar32* buffer = nullptr; // internal buffer, may be NULL
+ BMPSet *bmpSet = nullptr; // The set is frozen iff either bmpSet or stringSpan is not nullptr.
+ UChar32* buffer = nullptr; // internal buffer, may be nullptr
int32_t bufferCapacity = 0; // capacity of buffer
/**
@@ -430,9 +430,11 @@ public:
* description for the syntax of the pattern language.
* @param pattern a string specifying what characters are in the set
* @param options bitmask for options to apply to the pattern.
- * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
+ * Valid options are USET_IGNORE_SPACE and
+ * at most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, USET_SIMPLE_CASE_INSENSITIVE.
+ * These case options are mutually exclusive.
* @param symbols a symbol table mapping variable names to values
- * and stand-in characters to UnicodeSets; may be NULL
+ * and stand-in characters to UnicodeSets; may be nullptr
* @param status returns <code>U_ILLEGAL_ARGUMENT_ERROR</code> if the pattern
* contains a syntax error.
* @internal
@@ -450,9 +452,11 @@ public:
* @param pos on input, the position in pattern at which to start parsing.
* On output, the position after the last character parsed.
* @param options bitmask for options to apply to the pattern.
- * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
+ * Valid options are USET_IGNORE_SPACE and
+ * at most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, USET_SIMPLE_CASE_INSENSITIVE.
+ * These case options are mutually exclusive.
* @param symbols a symbol table mapping variable names to values
- * and stand-in characters to UnicodeSets; may be NULL
+ * and stand-in characters to UnicodeSets; may be nullptr
* @param status input-output error code
* @stable ICU 2.8
*/
@@ -645,9 +649,11 @@ public:
* A frozen set will not be modified.
* @param pattern a string specifying what characters are in the set
* @param options bitmask for options to apply to the pattern.
- * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
+ * Valid options are USET_IGNORE_SPACE and
+ * at most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, USET_SIMPLE_CASE_INSENSITIVE.
+ * These case options are mutually exclusive.
* @param symbols a symbol table mapping variable names to
- * values and stand-ins to UnicodeSets; may be NULL
+ * values and stand-ins to UnicodeSets; may be nullptr
* @param status returns <code>U_ILLEGAL_ARGUMENT_ERROR</code> if the pattern
* contains a syntax error.
*<em> Empties the set passed before applying the pattern.</em>
@@ -683,9 +689,11 @@ public:
* pattern.length() if the closing ']' is the last character of
* the pattern string.
* @param options bitmask for options to apply to the pattern.
- * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
+ * Valid options are USET_IGNORE_SPACE and
+ * at most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, USET_SIMPLE_CASE_INSENSITIVE.
+ * These case options are mutually exclusive.
* @param symbols a symbol table mapping variable names to
- * values and stand-ins to UnicodeSets; may be NULL
+ * values and stand-ins to UnicodeSets; may be nullptr
* @param status returns <code>U_ILLEGAL_ARGUMENT_ERROR</code> if the pattern
* contains a syntax error.
* @return a reference to this
@@ -1390,7 +1398,7 @@ public:
/**
* Close this set over the given attribute. For the attribute
- * USET_CASE, the result is to modify this set so that:
+ * USET_CASE_INSENSITIVE, the result is to modify this set so that:
*
* 1. For each character or string 'a' in this set, all strings or
* characters 'b' such that foldCase(a) == foldCase(b) are added
@@ -1408,8 +1416,10 @@ public:
* A frozen set will not be modified.
*
* @param attribute bitmask for attributes to close over.
- * Currently only the USET_CASE bit is supported. Any undefined bits
- * are ignored.
+ * Valid options:
+ * At most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, USET_SIMPLE_CASE_INSENSITIVE.
+ * These case options are mutually exclusive.
+ * Unrelated options bits are ignored.
* @return a reference to this set.
* @stable ICU 4.2
*/
@@ -1488,7 +1498,7 @@ public:
* bits followed by least significant 16 bits.
*
* @param dest pointer to buffer of destCapacity 16-bit integers.
- * May be NULL only if destCapacity is zero.
+ * May be nullptr only if destCapacity is zero.
* @param destCapacity size of dest, or zero. Must not be negative.
* @param ec error code. Will be set to U_INDEX_OUTOFBOUNDS_ERROR
* if n+2*m > 0x7FFF. Will be set to U_BUFFER_OVERFLOW_ERROR if
@@ -1579,6 +1589,9 @@ private:
int32_t depth,
UErrorCode& ec);
+ void closeOverCaseInsensitive(bool simple);
+ void closeOverAddCaseMappings();
+
//----------------------------------------------------------------
// Implementation: Utility methods
//----------------------------------------------------------------
@@ -1718,7 +1731,7 @@ inline bool UnicodeSet::operator!=(const UnicodeSet& o) const {
}
inline UBool UnicodeSet::isFrozen() const {
- return (UBool)(bmpSet!=NULL || stringSpan!=NULL);
+ return (UBool)(bmpSet!=nullptr || stringSpan!=nullptr);
}
inline UBool UnicodeSet::containsSome(UChar32 start, UChar32 end) const {
diff --git a/thirdparty/icu4c/common/unicode/unistr.h b/thirdparty/icu4c/common/unicode/unistr.h
index b3c9948107..4074e8d07b 100644
--- a/thirdparty/icu4c/common/unicode/unistr.h
+++ b/thirdparty/icu4c/common/unicode/unistr.h
@@ -253,7 +253,7 @@ class UnicodeStringAppendable; // unicode/appendable.h
* target object, e.g., calling str.append(str), an extra copy may take place
* to ensure safety.
* - If primitive string pointer values (e.g., const char16_t * or char *)
- * for input strings are NULL, then those input string parameters are treated
+ * for input strings are nullptr, then those input string parameters are treated
* as if they pointed to an empty string.
* However, this is *not* the case for char * parameters for charset names
* or other IDs.
@@ -1542,7 +1542,7 @@ public:
*
* @param start offset of first character which will be copied
* @param startLength the number of characters to extract
- * @param target the target buffer for extraction, can be NULL
+ * @param target the target buffer for extraction, can be nullptr
* if targetLength is 0
* @param targetCapacity the length of the target buffer
* @param inv Signature-distinguishing parameter, use US_INV.
@@ -1571,7 +1571,7 @@ public:
* @param startLength the number of characters to extract
* @param target the target buffer for extraction
* @param targetLength the length of the target buffer
- * If `target` is NULL, then the number of bytes required for
+ * If `target` is nullptr, then the number of bytes required for
* `target` is returned.
* @return the output string length, not including the terminating NUL
* @stable ICU 2.0
@@ -1604,7 +1604,7 @@ public:
* If `codepage` is an empty string (`""`),
* then a simple conversion is performed on the codepage-invariant
* subset ("invariant characters") of the platform encoding. See utypes.h.
- * If `target` is NULL, then the number of bytes required for
+ * If `target` is nullptr, then the number of bytes required for
* `target` is returned. It is assumed that the target is big enough
* to fit all of the characters.
* @return the output string length, not including the terminating NUL
@@ -1639,7 +1639,7 @@ public:
* If `codepage` is an empty string (`""`),
* then a simple conversion is performed on the codepage-invariant
* subset ("invariant characters") of the platform encoding. See utypes.h.
- * If `target` is NULL, then the number of bytes required for
+ * If `target` is nullptr, then the number of bytes required for
* `target` is returned.
* @return the output string length, not including the terminating NUL
* @stable ICU 2.0
@@ -1657,10 +1657,10 @@ public:
* This function avoids the overhead of opening and closing a converter if
* multiple strings are extracted.
*
- * @param dest destination string buffer, can be NULL if destCapacity==0
+ * @param dest destination string buffer, can be nullptr if destCapacity==0
* @param destCapacity the number of chars available at dest
* @param cnv the converter object to be used (ucnv_resetFromUnicode() will be called),
- * or NULL for the default converter
+ * or nullptr for the default converter
* @param errorCode normal ICU error code
* @return the length of the output string, not counting the terminating NUL;
* if the length is greater than destCapacity, then the string will not fit
@@ -1737,7 +1737,7 @@ public:
* Unpaired surrogates are replaced with U+FFFD.
* Calls u_strToUTF32WithSub().
*
- * @param utf32 destination string buffer, can be NULL if capacity==0
+ * @param utf32 destination string buffer, can be nullptr if capacity==0
* @param capacity the number of UChar32s available at utf32
* @param errorCode Standard ICU error code. Its input value must
* pass the U_SUCCESS() test, or else the function returns
@@ -1835,7 +1835,7 @@ public:
* A bogus string has no value. It is different from an empty string,
* although in both cases isEmpty() returns true and length() returns 0.
* setToBogus() and isBogus() can be used to indicate that no string value is available.
- * For a bogus string, getBuffer() and getTerminatedBuffer() return NULL, and
+ * For a bogus string, getBuffer() and getTerminatedBuffer() return nullptr, and
* length() returns 0.
*
* @return true if the string is bogus/invalid, false otherwise
@@ -1906,14 +1906,14 @@ public:
* @return *this
* @stable ICU 56
*/
- UnicodeString &operator=(UnicodeString &&src) U_NOEXCEPT;
+ UnicodeString &operator=(UnicodeString &&src) noexcept;
/**
* Swap strings.
* @param other other string
* @stable ICU 56
*/
- void swap(UnicodeString &other) U_NOEXCEPT;
+ void swap(UnicodeString &other) noexcept;
/**
* Non-member UnicodeString swap function.
@@ -1922,7 +1922,7 @@ public:
* @stable ICU 56
*/
friend inline void U_EXPORT2
- swap(UnicodeString &s1, UnicodeString &s2) U_NOEXCEPT {
+ swap(UnicodeString &s1, UnicodeString &s2) noexcept {
s1.swap(s2);
}
@@ -2072,7 +2072,7 @@ public:
*
* A bogus string has no value. It is different from an empty string.
* It can be used to indicate that no string value is available.
- * getBuffer() and getTerminatedBuffer() return NULL, and
+ * getBuffer() and getTerminatedBuffer() return nullptr, and
* length() returns 0.
*
* This utility function is used throughout the UnicodeString
@@ -2978,7 +2978,7 @@ public:
* `-DUNISTR_FROM_STRING_EXPLICIT=explicit`
* on the compiler command line or similar.
* @param text The characters to place in the UnicodeString. `text`
- * must be NULL (U+0000) terminated.
+ * must be NUL (U+0000) terminated.
* @stable ICU 2.0
*/
UNISTR_FROM_STRING_EXPLICIT UnicodeString(const char16_t *text);
@@ -3245,7 +3245,7 @@ public:
* @param src input codepage string
* @param srcLength length of the input string, can be -1 for NUL-terminated strings
* @param cnv converter object (ucnv_resetToUnicode() will be called),
- * can be NULL for the default converter
+ * can be nullptr for the default converter
* @param errorCode normal ICU error code
* @stable ICU 2.0
*/
@@ -3306,7 +3306,7 @@ public:
* @param src source string
* @stable ICU 56
*/
- UnicodeString(UnicodeString &&src) U_NOEXCEPT;
+ UnicodeString(UnicodeString &&src) noexcept;
/**
* 'Substring' constructor from tail of source string.
@@ -3329,7 +3329,7 @@ public:
* Clone this object, an instance of a subclass of 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.
+ * then nullptr is returned.
* The caller must delete the clone.
*
* @return a clone of this object
@@ -3365,7 +3365,7 @@ public:
* Illegal input is replaced with U+FFFD. Otherwise, errors result in a bogus string.
* Calls u_strFromUTF32WithSub().
*
- * @param utf32 UTF-32 input string. Must not be NULL.
+ * @param utf32 UTF-32 input string. Must not be nullptr.
* @param length Length of the input string, or -1 if NUL-terminated.
* @return A UnicodeString with equivalent UTF-16 contents.
* @see toUTF32
@@ -3489,6 +3489,19 @@ private:
*/
UBool doEquals(const UnicodeString &text, int32_t len) const;
+ inline UBool
+ doEqualsSubstring(int32_t start,
+ int32_t length,
+ const UnicodeString& srcText,
+ int32_t srcStart,
+ int32_t srcLength) const;
+
+ UBool doEqualsSubstring(int32_t start,
+ int32_t length,
+ const char16_t *srcChars,
+ int32_t srcStart,
+ int32_t srcLength) const;
+
inline int8_t
doCompare(int32_t start,
int32_t length,
@@ -3618,7 +3631,7 @@ private:
UnicodeString &copyFrom(const UnicodeString &src, UBool fastCopy=false);
// Copies just the fields without memory management.
- void copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) U_NOEXCEPT;
+ void copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) noexcept;
// Pin start and limit to acceptable values.
inline void pinIndex(int32_t& start) const;
@@ -3706,7 +3719,7 @@ private:
kEmptyHashCode=1, // hash code for empty string
// bit flag values for fLengthAndFlags
- kIsBogus=1, // this string is bogus, i.e., not valid or NULL
+ kIsBogus=1, // this string is bogus, i.e., not valid or nullptr
kUsingStackBuffer=2,// using fUnion.fStackFields instead of fUnion.fFields
kRefCounted=4, // there is a refCount field before the characters in fArray
kBufferIsReadonly=8,// do not write to this buffer
@@ -3946,6 +3959,21 @@ UnicodeString::doCompare(int32_t start,
}
}
+inline UBool
+UnicodeString::doEqualsSubstring(int32_t start,
+ int32_t thisLength,
+ const UnicodeString& srcText,
+ int32_t srcStart,
+ int32_t srcLength) const
+{
+ if(srcText.isBogus()) {
+ return isBogus();
+ } else {
+ srcText.pinIndices(srcStart, srcLength);
+ return !isBogus() && doEqualsSubstring(start, thisLength, srcText.getArrayStart(), srcStart, srcLength);
+ }
+}
+
inline bool
UnicodeString::operator== (const UnicodeString& text) const
{
@@ -4326,20 +4354,20 @@ UnicodeString::lastIndexOf(UChar32 c,
inline UBool
UnicodeString::startsWith(const UnicodeString& text) const
-{ return compare(0, text.length(), text, 0, text.length()) == 0; }
+{ return doEqualsSubstring(0, text.length(), text, 0, text.length()); }
inline UBool
UnicodeString::startsWith(const UnicodeString& srcText,
int32_t srcStart,
int32_t srcLength) const
-{ return doCompare(0, srcLength, srcText, srcStart, srcLength) == 0; }
+{ return doEqualsSubstring(0, srcLength, srcText, srcStart, srcLength); }
inline UBool
UnicodeString::startsWith(ConstChar16Ptr srcChars, int32_t srcLength) const {
if(srcLength < 0) {
srcLength = u_strlen(toUCharPtr(srcChars));
}
- return doCompare(0, srcLength, srcChars, 0, srcLength) == 0;
+ return doEqualsSubstring(0, srcLength, srcChars, 0, srcLength);
}
inline UBool
@@ -4347,21 +4375,21 @@ UnicodeString::startsWith(const char16_t *srcChars, int32_t srcStart, int32_t sr
if(srcLength < 0) {
srcLength = u_strlen(toUCharPtr(srcChars));
}
- return doCompare(0, srcLength, srcChars, srcStart, srcLength) == 0;
+ return doEqualsSubstring(0, srcLength, srcChars, srcStart, srcLength);
}
inline UBool
UnicodeString::endsWith(const UnicodeString& text) const
-{ return doCompare(length() - text.length(), text.length(),
- text, 0, text.length()) == 0; }
+{ return doEqualsSubstring(length() - text.length(), text.length(),
+ text, 0, text.length()); }
inline UBool
UnicodeString::endsWith(const UnicodeString& srcText,
int32_t srcStart,
int32_t srcLength) const {
srcText.pinIndices(srcStart, srcLength);
- return doCompare(length() - srcLength, srcLength,
- srcText, srcStart, srcLength) == 0;
+ return doEqualsSubstring(length() - srcLength, srcLength,
+ srcText, srcStart, srcLength);
}
inline UBool
@@ -4370,8 +4398,7 @@ UnicodeString::endsWith(ConstChar16Ptr srcChars,
if(srcLength < 0) {
srcLength = u_strlen(toUCharPtr(srcChars));
}
- return doCompare(length() - srcLength, srcLength,
- srcChars, 0, srcLength) == 0;
+ return doEqualsSubstring(length() - srcLength, srcLength, srcChars, 0, srcLength);
}
inline UBool
@@ -4381,8 +4408,8 @@ UnicodeString::endsWith(const char16_t *srcChars,
if(srcLength < 0) {
srcLength = u_strlen(toUCharPtr(srcChars + srcStart));
}
- return doCompare(length() - srcLength, srcLength,
- srcChars, srcStart, srcLength) == 0;
+ return doEqualsSubstring(length() - srcLength, srcLength,
+ srcChars, srcStart, srcLength);
}
//========================================
@@ -4712,18 +4739,18 @@ UnicodeString::remove(int32_t start,
// remove(guaranteed everything) of a bogus string makes the string empty and non-bogus
return remove();
}
- return doReplace(start, _length, NULL, 0, 0);
+ return doReplace(start, _length, nullptr, 0, 0);
}
inline UnicodeString&
UnicodeString::removeBetween(int32_t start,
int32_t limit)
-{ return doReplace(start, limit - start, NULL, 0, 0); }
+{ return doReplace(start, limit - start, nullptr, 0, 0); }
inline UnicodeString &
UnicodeString::retainBetween(int32_t start, int32_t limit) {
truncate(limit);
- return doReplace(0, start, NULL, 0, 0);
+ return doReplace(0, start, nullptr, 0, 0);
}
inline UBool
diff --git a/thirdparty/icu4c/common/unicode/uobject.h b/thirdparty/icu4c/common/unicode/uobject.h
index 25a8330f9a..f53ec1d111 100644
--- a/thirdparty/icu4c/common/unicode/uobject.h
+++ b/thirdparty/icu4c/common/unicode/uobject.h
@@ -32,21 +32,21 @@
/**
* \def U_NO_THROW
- * Since ICU 64, use U_NOEXCEPT instead.
+ * Since ICU 64, use noexcept instead.
*
* 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 <code>operator new</code> returns NULL the
+ * appended to them, so that the compiler adds the additional nullptr check
+ * before calling constructors. Without, if <code>operator new</code> returns nullptr 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.
+ * @stable ICU 4.2. Since ICU 64, Use noexcept instead. See ICU-20422.
*/
#ifndef U_NO_THROW
-#define U_NO_THROW U_NOEXCEPT
+#define U_NO_THROW noexcept
#endif
/*===========================================================================*/
@@ -131,14 +131,14 @@ public:
* for ICU4C C++ classes
* @stable ICU 2.4
*/
- static void * U_EXPORT2 operator new(size_t size) U_NOEXCEPT;
+ static void * U_EXPORT2 operator new(size_t size) noexcept;
/**
* Override for ICU4C C++ memory management.
* See new().
* @stable ICU 2.4
*/
- static void * U_EXPORT2 operator new[](size_t size) U_NOEXCEPT;
+ static void * U_EXPORT2 operator new[](size_t size) noexcept;
/**
* Override for ICU4C C++ memory management.
@@ -148,14 +148,14 @@ public:
* for ICU4C C++ classes
* @stable ICU 2.4
*/
- static void U_EXPORT2 operator delete(void *p) U_NOEXCEPT;
+ static void U_EXPORT2 operator delete(void *p) noexcept;
/**
* Override for ICU4C C++ memory management.
* See delete().
* @stable ICU 2.4
*/
- static void U_EXPORT2 operator delete[](void *p) U_NOEXCEPT;
+ static void U_EXPORT2 operator delete[](void *p) noexcept;
#if U_HAVE_PLACEMENT_NEW
/**
@@ -163,14 +163,14 @@ public:
* See new().
* @stable ICU 2.6
*/
- static inline void * U_EXPORT2 operator new(size_t, void *ptr) U_NOEXCEPT { return ptr; }
+ static inline void * U_EXPORT2 operator new(size_t, void *ptr) noexcept { return ptr; }
/**
* Override for ICU4C C++ memory management for STL.
* See delete().
* @stable ICU 2.6
*/
- static inline void U_EXPORT2 operator delete(void *, void *) U_NOEXCEPT {}
+ static inline void U_EXPORT2 operator delete(void *, void *) noexcept {}
#endif /* U_HAVE_PLACEMENT_NEW */
#if U_HAVE_DEBUG_LOCATION_NEW
/**
@@ -180,7 +180,7 @@ public:
* @param file The file 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;
+ static void * U_EXPORT2 operator new(size_t size, const char* file, int line) noexcept;
/**
* This method provides a matching delete for the MFC debug new
*
@@ -188,7 +188,7 @@ public:
* @param file The file 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;
+ static void U_EXPORT2 operator delete(void* p, const char* file, int line) noexcept;
#endif /* U_HAVE_DEBUG_LOCATION_NEW */
#endif /* U_OVERRIDE_CXX_ALLOCATION */
diff --git a/thirdparty/icu4c/common/unicode/urename.h b/thirdparty/icu4c/common/unicode/urename.h
index d3e23b8fa7..b35df45380 100644
--- a/thirdparty/icu4c/common/unicode/urename.h
+++ b/thirdparty/icu4c/common/unicode/urename.h
@@ -564,6 +564,7 @@
#define ucal_setTimeZone U_ICU_ENTRY_POINT_RENAME(ucal_setTimeZone)
#define ucase_addCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addCaseClosure)
#define ucase_addPropertyStarts U_ICU_ENTRY_POINT_RENAME(ucase_addPropertyStarts)
+#define ucase_addSimpleCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addSimpleCaseClosure)
#define ucase_addStringCaseClosure U_ICU_ENTRY_POINT_RENAME(ucase_addStringCaseClosure)
#define ucase_fold U_ICU_ENTRY_POINT_RENAME(ucase_fold)
#define ucase_getCaseLocale U_ICU_ENTRY_POINT_RENAME(ucase_getCaseLocale)
@@ -1748,6 +1749,20 @@
#define uset_spanBackUTF8 U_ICU_ENTRY_POINT_RENAME(uset_spanBackUTF8)
#define uset_spanUTF8 U_ICU_ENTRY_POINT_RENAME(uset_spanUTF8)
#define uset_toPattern U_ICU_ENTRY_POINT_RENAME(uset_toPattern)
+#define usnum_close U_ICU_ENTRY_POINT_RENAME(usnum_close)
+#define usnum_multiplyByPowerOfTen U_ICU_ENTRY_POINT_RENAME(usnum_multiplyByPowerOfTen)
+#define usnum_openForInt64 U_ICU_ENTRY_POINT_RENAME(usnum_openForInt64)
+#define usnum_roundTo U_ICU_ENTRY_POINT_RENAME(usnum_roundTo)
+#define usnum_setMinimumFractionDigits U_ICU_ENTRY_POINT_RENAME(usnum_setMinimumFractionDigits)
+#define usnum_setMinimumIntegerDigits U_ICU_ENTRY_POINT_RENAME(usnum_setMinimumIntegerDigits)
+#define usnum_setSign U_ICU_ENTRY_POINT_RENAME(usnum_setSign)
+#define usnum_setToInt64 U_ICU_ENTRY_POINT_RENAME(usnum_setToInt64)
+#define usnum_truncateStart U_ICU_ENTRY_POINT_RENAME(usnum_truncateStart)
+#define usnumf_close U_ICU_ENTRY_POINT_RENAME(usnumf_close)
+#define usnumf_format U_ICU_ENTRY_POINT_RENAME(usnumf_format)
+#define usnumf_formatInt64 U_ICU_ENTRY_POINT_RENAME(usnumf_formatInt64)
+#define usnumf_openForLocale U_ICU_ENTRY_POINT_RENAME(usnumf_openForLocale)
+#define usnumf_openForLocaleAndGroupingStrategy U_ICU_ENTRY_POINT_RENAME(usnumf_openForLocaleAndGroupingStrategy)
#define uspoof_areConfusable U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusable)
#define uspoof_areConfusableUTF8 U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUTF8)
#define uspoof_areConfusableUnicodeString U_ICU_ENTRY_POINT_RENAME(uspoof_areConfusableUnicodeString)
diff --git a/thirdparty/icu4c/common/unicode/ures.h b/thirdparty/icu4c/common/unicode/ures.h
index a6c43f9537..cc25b6e49c 100644
--- a/thirdparty/icu4c/common/unicode/ures.h
+++ b/thirdparty/icu4c/common/unicode/ures.h
@@ -812,7 +812,7 @@ inline UnicodeString
ures_getUnicodeString(const UResourceBundle *resB, UErrorCode* status) {
UnicodeString result;
int32_t len = 0;
- const UChar *r = ures_getString(resB, &len, status);
+ const char16_t *r = ures_getString(resB, &len, status);
if(U_SUCCESS(*status)) {
result.setTo(true, r, len);
} else {
@@ -837,7 +837,7 @@ inline UnicodeString
ures_getNextUnicodeString(UResourceBundle *resB, const char ** key, UErrorCode* status) {
UnicodeString result;
int32_t len = 0;
- const UChar* r = ures_getNextString(resB, &len, key, status);
+ const char16_t* r = ures_getNextString(resB, &len, key, status);
if(U_SUCCESS(*status)) {
result.setTo(true, r, len);
} else {
@@ -859,7 +859,7 @@ inline UnicodeString
ures_getUnicodeStringByIndex(const UResourceBundle *resB, int32_t indexS, UErrorCode* status) {
UnicodeString result;
int32_t len = 0;
- const UChar* r = ures_getStringByIndex(resB, indexS, &len, status);
+ const char16_t* r = ures_getStringByIndex(resB, indexS, &len, status);
if(U_SUCCESS(*status)) {
result.setTo(true, r, len);
} else {
@@ -882,7 +882,7 @@ inline UnicodeString
ures_getUnicodeStringByKey(const UResourceBundle *resB, const char* key, UErrorCode* status) {
UnicodeString result;
int32_t len = 0;
- const UChar* r = ures_getStringByKey(resB, key, &len, status);
+ const char16_t* r = ures_getStringByKey(resB, key, &len, status);
if(U_SUCCESS(*status)) {
result.setTo(true, r, len);
} else {
diff --git a/thirdparty/icu4c/common/unicode/uset.h b/thirdparty/icu4c/common/unicode/uset.h
index 5dd890e148..ee4e0036d2 100644
--- a/thirdparty/icu4c/common/unicode/uset.h
+++ b/thirdparty/icu4c/common/unicode/uset.h
@@ -53,6 +53,12 @@ typedef struct USet USet;
/**
* Bitmask values to be passed to uset_openPatternOptions() or
* uset_applyPattern() taking an option parameter.
+ *
+ * Use at most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, USET_SIMPLE_CASE_INSENSITIVE.
+ * These case options are mutually exclusive.
+ *
+ * Undefined options bits are ignored, and reserved for future use.
+ *
* @stable ICU 2.4
*/
enum {
@@ -60,13 +66,13 @@ 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
* will match 'a', 'A', 'b', and 'B'. "[^ab]" with this flag will
* match all except 'a', 'A', 'b', and 'B'. This performs a full
- * closure over case mappings, e.g. U+017F for s.
+ * closure over case mappings, e.g. 'ſ' (U+017F long s) for 's'.
*
* The resulting set is a superset of the input for the code points but
* not for the strings.
@@ -88,17 +94,36 @@ enum {
*
* @stable ICU 2.4
*/
- USET_CASE_INSENSITIVE = 2,
+ USET_CASE_INSENSITIVE = 2,
/**
- * Enable case insensitive matching. E.g., "[ab]" with this flag
- * will match 'a', 'A', 'b', and 'B'. "[^ab]" with this flag will
- * match all except 'a', 'A', 'b', and 'B'. This adds the lower-,
- * title-, and uppercase mappings as well as the case folding
+ * Adds all case mappings for each element in the set.
+ * This adds the full lower-, title-, and uppercase mappings as well as the full case folding
* of each existing element in the set.
+ *
+ * Unlike the “case insensitive” options, this does not perform a closure.
+ * For example, it does not add 'ſ' (U+017F long s) for 's',
+ * 'K' (U+212A Kelvin sign) for 'k', or replace set strings by their case-folded versions.
+ *
* @stable ICU 3.2
*/
- USET_ADD_CASE_MAPPINGS = 4
+ USET_ADD_CASE_MAPPINGS = 4,
+
+#ifndef U_HIDE_DRAFT_API
+ /**
+ * Enable case insensitive matching.
+ * Same as USET_CASE_INSENSITIVE but using only Simple_Case_Folding (scf) mappings,
+ * which map each code point to one code point,
+ * not full Case_Folding (cf) mappings, which map some code points to multiple code points.
+ *
+ * This is designed for case-insensitive matches, for example in certain
+ * regular expression implementations where only Simple_Case_Folding mappings are used,
+ * such as in ECMAScript (JavaScript) regular expressions.
+ *
+ * @draft ICU 73
+ */
+ USET_SIMPLE_CASE_INSENSITIVE = 6
+#endif // U_HIDE_DRAFT_API
};
/**
@@ -299,7 +324,9 @@ uset_openPattern(const UChar* pattern, int32_t patternLength,
* @param patternLength the length of the pattern, or -1 if null
* terminated
* @param options bitmask for options to apply to the pattern.
- * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
+ * Valid options are USET_IGNORE_SPACE and
+ * at most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, USET_SIMPLE_CASE_INSENSITIVE.
+ * These case options are mutually exclusive.
* @param ec the error code
* @stable ICU 2.4
*/
@@ -414,7 +441,10 @@ uset_set(USet* set,
* The character at pattern[0] must be a '['.
* @param patternLength The length of the UChar string. -1 if NUL terminated.
* @param options A bitmask for options to apply to the pattern.
- * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
+ * Valid options are USET_IGNORE_SPACE and
+ * at most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS,
+ * USET_SIMPLE_CASE_INSENSITIVE.
+ * These case options are mutually exclusive.
* @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 ']'
@@ -804,7 +834,7 @@ uset_clear(USet* set);
/**
* Close this set over the given attribute. For the attribute
- * USET_CASE, the result is to modify this set so that:
+ * USET_CASE_INSENSITIVE, the result is to modify this set so that:
*
* 1. For each character or string 'a' in this set, all strings or
* characters 'b' such that foldCase(a) == foldCase(b) are added
@@ -824,8 +854,10 @@ uset_clear(USet* set);
* @param set the set
*
* @param attributes bitmask for attributes to close over.
- * Currently only the USET_CASE bit is supported. Any undefined bits
- * are ignored.
+ * Valid options:
+ * At most one of USET_CASE_INSENSITIVE, USET_ADD_CASE_MAPPINGS, USET_SIMPLE_CASE_INSENSITIVE.
+ * These case options are mutually exclusive.
+ * Unrelated options bits are ignored.
* @stable ICU 4.2
*/
U_CAPI void U_EXPORT2
diff --git a/thirdparty/icu4c/common/unicode/usetiter.h b/thirdparty/icu4c/common/unicode/usetiter.h
index 34992d94b7..3168d3b0f6 100644
--- a/thirdparty/icu4c/common/unicode/usetiter.h
+++ b/thirdparty/icu4c/common/unicode/usetiter.h
@@ -64,7 +64,7 @@ class UnicodeString;
* @author M. Davis
* @stable ICU 2.4
*/
-class U_COMMON_API UnicodeSetIterator U_FINAL : public UObject {
+class U_COMMON_API UnicodeSetIterator final : public UObject {
/**
* Value of <tt>codepoint</tt> if the iterator points to a string.
* If <tt>codepoint == IS_STRING</tt>, then examine
diff --git a/thirdparty/icu4c/common/unicode/ustring.h b/thirdparty/icu4c/common/unicode/ustring.h
index 5452fbe09a..03c697c722 100644
--- a/thirdparty/icu4c/common/unicode/ustring.h
+++ b/thirdparty/icu4c/common/unicode/ustring.h
@@ -931,14 +931,10 @@ u_memrchr32(const UChar *s, UChar32 c, int32_t count);
# define U_STRING_DECL(var, cs, length) static const UChar *var=(const UChar *)U_DECLARE_UTF16(cs)
/**@stable ICU 2.0 */
# define U_STRING_INIT(var, cs, length)
-#elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || (U_SIZEOF_UCHAR == 2 && defined(U_WCHAR_IS_UTF16)))
+#elif U_SIZEOF_WCHAR_T==U_SIZEOF_UCHAR && (U_CHARSET_FAMILY==U_ASCII_FAMILY || defined(U_WCHAR_IS_UTF16))
# define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=L ## cs
/**@stable ICU 2.0 */
# define U_STRING_INIT(var, cs, length)
-#elif U_SIZEOF_UCHAR==1 && U_CHARSET_FAMILY==U_ASCII_FAMILY
-# define U_STRING_DECL(var, cs, length) static const UChar var[(length)+1]=cs
- /**@stable ICU 2.0 */
-# define U_STRING_INIT(var, cs, length)
#else
# define U_STRING_DECL(var, cs, length) static UChar var[(length)+1]
/**@stable ICU 2.0 */
diff --git a/thirdparty/icu4c/common/unicode/utext.h b/thirdparty/icu4c/common/unicode/utext.h
index c6d1e53a8c..423b281631 100644
--- a/thirdparty/icu4c/common/unicode/utext.h
+++ b/thirdparty/icu4c/common/unicode/utext.h
@@ -230,8 +230,8 @@ utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status);
/**
* Open a writable UText for a non-const UnicodeString.
*
- * @param ut Pointer to a UText struct. If NULL, a new UText will be created.
- * If non-NULL, must refer to an initialized UText struct, which will then
+ * @param ut Pointer to a UText struct. If nullptr, a new UText will be created.
+ * If non-nullptr, must refer to an initialized UText struct, which will then
* be reset to reference the specified input string.
* @param s A UnicodeString.
* @param status Errors are returned here.
@@ -246,8 +246,8 @@ utext_openUnicodeString(UText *ut, icu::UnicodeString *s, UErrorCode *status);
/**
* Open a UText for a const UnicodeString. The resulting UText will not be writable.
*
- * @param ut Pointer to a UText struct. If NULL, a new UText will be created.
- * If non-NULL, must refer to an initialized UText struct, which will then
+ * @param ut Pointer to a UText struct. If nullptr, a new UText will be created.
+ * If non-nullptr, must refer to an initialized UText struct, which will then
* be reset to reference the specified input string.
* @param s A const UnicodeString to be wrapped.
* @param status Errors are returned here.
@@ -261,8 +261,8 @@ utext_openConstUnicodeString(UText *ut, const icu::UnicodeString *s, UErrorCode
/**
* Open a writable UText implementation for an ICU Replaceable object.
- * @param ut Pointer to a UText struct. If NULL, a new UText will be created.
- * If non-NULL, must refer to an already existing UText, which will then
+ * @param ut Pointer to a UText struct. If nullptr, a new UText will be created.
+ * If non-nullptr, must refer to an already existing UText, which will then
* be reset to reference the specified replaceable text.
* @param rep A Replaceable text object.
* @param status Errors are returned here.
@@ -276,8 +276,8 @@ utext_openReplaceable(UText *ut, icu::Replaceable *rep, UErrorCode *status);
/**
* Open a UText implementation over an ICU CharacterIterator.
- * @param ut Pointer to a UText struct. If NULL, a new UText will be created.
- * If non-NULL, must refer to an already existing UText, which will then
+ * @param ut Pointer to a UText struct. If nullptr, a new UText will be created.
+ * If non-nullptr, must refer to an already existing UText, which will then
* be reset to reference the specified replaceable text.
* @param ci A Character Iterator.
* @param status Errors are returned here.
diff --git a/thirdparty/icu4c/common/unicode/uvernum.h b/thirdparty/icu4c/common/unicode/uvernum.h
index a93f3509ef..f0fc671b4b 100644
--- a/thirdparty/icu4c/common/unicode/uvernum.h
+++ b/thirdparty/icu4c/common/unicode/uvernum.h
@@ -53,7 +53,7 @@
* This value will change in the subsequent releases of ICU
* @stable ICU 2.4
*/
-#define U_ICU_VERSION_MAJOR_NUM 72
+#define U_ICU_VERSION_MAJOR_NUM 73
/** The current ICU minor version as an integer.
* This value will change in the subsequent releases of ICU
@@ -79,7 +79,7 @@
* This value will change in the subsequent releases of ICU
* @stable ICU 2.6
*/
-#define U_ICU_VERSION_SUFFIX _72
+#define U_ICU_VERSION_SUFFIX _73
/**
* \def U_DEF2_ICU_ENTRY_POINT_RENAME
@@ -132,7 +132,7 @@
* This value will change in the subsequent releases of ICU
* @stable ICU 2.4
*/
-#define U_ICU_VERSION "72.1"
+#define U_ICU_VERSION "73.1"
/**
* The current ICU library major version number as a string, for library name suffixes.
@@ -145,13 +145,13 @@
*
* @stable ICU 2.6
*/
-#define U_ICU_VERSION_SHORT "72"
+#define U_ICU_VERSION_SHORT "73"
#ifndef U_HIDE_INTERNAL_API
/** Data version in ICU4C.
* @internal ICU 4.4 Internal Use Only
**/
-#define U_ICU_DATA_VERSION "72.1"
+#define U_ICU_DATA_VERSION "73.1"
#endif /* U_HIDE_INTERNAL_API */
/*===========================================================================
diff --git a/thirdparty/icu4c/common/unifiedcache.cpp b/thirdparty/icu4c/common/unifiedcache.cpp
index cfb000b2c8..1284c03813 100644
--- a/thirdparty/icu4c/common/unifiedcache.cpp
+++ b/thirdparty/icu4c/common/unifiedcache.cpp
@@ -19,7 +19,7 @@
#include "uhash.h"
#include "ucln_cmn.h"
-static icu::UnifiedCache *gCache = NULL;
+static icu::UnifiedCache *gCache = nullptr;
static std::mutex *gCacheMutex = nullptr;
static std::condition_variable *gInProgressValueAddedCond;
static icu::UInitOnce gCacheInitOnce {};
@@ -68,19 +68,19 @@ CacheKeyBase::~CacheKeyBase() {
}
static void U_CALLCONV cacheInit(UErrorCode &status) {
- U_ASSERT(gCache == NULL);
+ U_ASSERT(gCache == nullptr);
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) {
+ if (gCache == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
}
if (U_FAILURE(status)) {
delete gCache;
- gCache = NULL;
+ gCache = nullptr;
return;
}
}
@@ -88,14 +88,14 @@ static void U_CALLCONV cacheInit(UErrorCode &status) {
UnifiedCache *UnifiedCache::getInstance(UErrorCode &status) {
umtx_initOnce(gCacheInitOnce, &cacheInit, status);
if (U_FAILURE(status)) {
- return NULL;
+ return nullptr;
}
- U_ASSERT(gCache != NULL);
+ U_ASSERT(gCache != nullptr);
return gCache;
}
UnifiedCache::UnifiedCache(UErrorCode &status) :
- fHashtable(NULL),
+ fHashtable(nullptr),
fEvictPos(UHASH_FIRST),
fNumValuesTotal(0),
fNumValuesInUse(0),
@@ -118,7 +118,7 @@ UnifiedCache::UnifiedCache(UErrorCode &status) :
fHashtable = uhash_open(
&ucache_hashKeys,
&ucache_compareKeys,
- NULL,
+ nullptr,
&status);
if (U_FAILURE(status)) {
return;
@@ -196,7 +196,7 @@ void UnifiedCache::_dumpContents() const {
const UHashElement *element = uhash_nextElement(fHashtable, &pos);
char buffer[256];
int32_t cnt = 0;
- for (; element != NULL; element = uhash_nextElement(fHashtable, &pos)) {
+ for (; element != nullptr; element = uhash_nextElement(fHashtable, &pos)) {
const SharedObject *sharedObject =
(const SharedObject *) element->value.pointer;
const CacheKeyBase *key =
@@ -208,7 +208,7 @@ void UnifiedCache::_dumpContents() const {
"Unified Cache: Key '%s', error %d, value %p, total refcount %d, soft refcount %d\n",
key->writeDescription(buffer, 256),
key->creationStatus,
- sharedObject == fNoValue ? NULL :sharedObject,
+ sharedObject == fNoValue ? nullptr :sharedObject,
sharedObject->getRefCount(),
sharedObject->getSoftRefCount());
}
@@ -236,7 +236,7 @@ UnifiedCache::~UnifiedCache() {
const UHashElement *
UnifiedCache::_nextElement() const {
const UHashElement *element = uhash_nextElement(fHashtable, &fEvictPos);
- if (element == NULL) {
+ if (element == nullptr) {
fEvictPos = UHASH_FIRST;
return uhash_nextElement(fHashtable, &fEvictPos);
}
@@ -305,7 +305,7 @@ void UnifiedCache::_putNew(
return;
}
CacheKeyBase *keyToAdopt = key.clone();
- if (keyToAdopt == NULL) {
+ if (keyToAdopt == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -327,11 +327,11 @@ void UnifiedCache::_putIfAbsentAndGet(
UErrorCode &status) const {
std::lock_guard<std::mutex> lock(*gCacheMutex);
const UHashElement *element = uhash_find(fHashtable, &key);
- if (element != NULL && !_inProgress(element)) {
+ if (element != nullptr && !_inProgress(element)) {
_fetch(element, value, status);
return;
}
- if (element == NULL) {
+ if (element == nullptr) {
UErrorCode putError = U_ZERO_ERROR;
// best-effort basis only.
_putNew(key, value, status, putError);
@@ -348,7 +348,7 @@ UBool UnifiedCache::_poll(
const CacheKeyBase &key,
const SharedObject *&value,
UErrorCode &status) const {
- U_ASSERT(value == NULL);
+ U_ASSERT(value == nullptr);
U_ASSERT(status == U_ZERO_ERROR);
std::unique_lock<std::mutex> lock(*gCacheMutex);
const UHashElement *element = uhash_find(fHashtable, &key);
@@ -356,14 +356,14 @@ UBool UnifiedCache::_poll(
// 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)) {
+ while (element != nullptr && _inProgress(element)) {
gInProgressValueAddedCond->wait(lock);
element = uhash_find(fHashtable, &key);
}
// If the hash table contains an entry for the key,
// fetch out the contents and return them.
- if (element != NULL) {
+ if (element != nullptr) {
_fetch(element, value, status);
return true;
}
@@ -380,7 +380,7 @@ void UnifiedCache::_get(
const SharedObject *&value,
const void *creationContext,
UErrorCode &status) const {
- U_ASSERT(value == NULL);
+ U_ASSERT(value == nullptr);
U_ASSERT(status == U_ZERO_ERROR);
if (_poll(key, value, status)) {
if (value == fNoValue) {
@@ -392,9 +392,9 @@ void UnifiedCache::_get(
return;
}
value = key.createObject(creationContext, status);
- U_ASSERT(value == NULL || value->hasHardReferences());
- U_ASSERT(value != NULL || status != U_ZERO_ERROR);
- if (value == NULL) {
+ U_ASSERT(value == nullptr || value->hasHardReferences());
+ U_ASSERT(value != nullptr || status != U_ZERO_ERROR);
+ if (value == nullptr) {
SharedObject::copyPtr(fNoValue, value);
}
_putIfAbsentAndGet(key, value, status);
@@ -451,7 +451,7 @@ void UnifiedCache::_fetch(
UBool UnifiedCache::_inProgress(const UHashElement* element) const {
UErrorCode status = U_ZERO_ERROR;
- const SharedObject * value = NULL;
+ const SharedObject * value = nullptr;
_fetch(element, value, status);
UBool result = _inProgress(value, status);
removeHardRef(value);
diff --git a/thirdparty/icu4c/common/unifiedcache.h b/thirdparty/icu4c/common/unifiedcache.h
index 4b9222124a..217031a27d 100644
--- a/thirdparty/icu4c/common/unifiedcache.h
+++ b/thirdparty/icu4c/common/unifiedcache.h
@@ -57,21 +57,21 @@ class U_COMMON_API CacheKeyBase : public UObject {
* Create a new object for this key. Called by cache on cache miss.
* createObject must add a reference to the object it returns. Note
* that getting an object from the cache and returning it without calling
- * removeRef on it satisfies this requirement. It can also return NULL
+ * removeRef on it satisfies this requirement. It can also return nullptr
* and set status to an error.
*
* @param creationContext the context in which the object is being
- * created. May be NULL.
+ * created. May be nullptr.
* @param status Implementations can return a failure here.
* In addition, implementations may return a
- * non NULL object and set a warning status.
+ * non nullptr object and set a warning status.
*/
virtual const SharedObject *createObject(
const void *creationContext, UErrorCode &status) const = 0;
/**
* Writes a description of this key to buffer and returns buffer. Written
- * description is NULL terminated.
+ * description is nullptr terminated.
*/
virtual char *writeDescription(char *buffer, int32_t bufSize) const = 0;
@@ -196,14 +196,14 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
/**
* Fetches a value from the cache by key. Equivalent to
- * get(key, NULL, ptr, status);
+ * get(key, nullptr, ptr, status);
*/
template<typename T>
void get(
const CacheKey<T>& key,
const T *&ptr,
UErrorCode &status) const {
- get(key, NULL, ptr, status);
+ get(key, nullptr, ptr, status);
}
/**
@@ -211,12 +211,12 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
*
* @param key the cache key.
* @param creationContext passed verbatim to createObject method of key
- * @param ptr On entry, ptr must be NULL or be included if
+ * @param ptr On entry, ptr must be nullptr or be included if
* the reference count of the object it points
* to. On exit, ptr points to the fetched object
* from the cache or is left unchanged on
* failure. Caller must call removeRef on ptr
- * if set to a non NULL value.
+ * if set to a non nullptr value.
* @param status Any error returned here. May be set to a
* warning value even if ptr is set.
*/
@@ -230,7 +230,7 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
return;
}
UErrorCode creationStatus = U_ZERO_ERROR;
- const SharedObject *value = NULL;
+ const SharedObject *value = nullptr;
_get(key, value, creationContext, creationStatus);
const T *tvalue = (const T *) value;
if (U_SUCCESS(creationStatus)) {
@@ -254,13 +254,13 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
/**
* Convenience method to get a value of type T from cache for a
- * particular locale with creationContext == NULL.
+ * particular locale with creationContext == nullptr.
* @param loc the locale
- * @param ptr On entry, must be NULL or included in the ref count
+ * @param ptr On entry, must be nullptr or included in the ref count
* of the object to which it points.
* On exit, fetched value stored here or is left
* unchanged on failure. Caller must call removeRef on
- * ptr if set to a non NULL value.
+ * ptr if set to a non nullptr value.
* @param status Any error returned here. May be set to a
* warning value even if ptr is set.
*/
@@ -376,14 +376,14 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
/**
* Gets value out of cache.
- * On entry. gCacheMutex must not be held. value must be NULL. status
+ * On entry. gCacheMutex must not be held. value must be nullptr. status
* must be U_ZERO_ERROR.
* On exit. value and status set to what is in cache at key or on cache
* miss the key's createObject() is called and value and status are set to
* the result of that. In this latter case, best effort is made to add the
* value and status to the cache. If createObject() fails to create a value,
- * fNoValue is stored in cache, and value is set to NULL. Caller must call
- * removeRef on value if non NULL.
+ * fNoValue is stored in cache, and value is set to nullptr. Caller must call
+ * removeRef on value if non nullptr.
*/
void _get(
const CacheKeyBase &key,
@@ -393,7 +393,7 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
/**
* Attempts to fetch value and status for key from cache.
- * On entry, gCacheMutex must not be held value must be NULL and status must
+ * On entry, gCacheMutex must not be held value must be nullptr and status must
* be U_ZERO_ERROR.
* On exit, either returns false (In this
* case caller should try to create the object) or returns true with value
@@ -478,7 +478,7 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
/**
* Store a value and creation error status in given hash entry.
* On entry, gCacheMutex must be held. Hash entry element must be in progress.
- * value must be non NULL.
+ * value must be non nullptr.
* On Exit, soft reference added to value. value and status stored in hash
* entry. Soft reference removed from previous stored value. Waiting
* threads notified.
@@ -522,7 +522,7 @@ class U_COMMON_API UnifiedCache : public UnifiedCacheBase {
/**
* Fetch value and error code from a particular hash entry.
- * On entry, gCacheMutex must be held. value must be either NULL or must be
+ * On entry, gCacheMutex must be held. value must be either nullptr or must be
* included in the ref count of the object to which it points.
* On exit, value and status set to what is in the hash entry. Caller must
* eventually call removeRef on value.
diff --git a/thirdparty/icu4c/common/uniset.cpp b/thirdparty/icu4c/common/uniset.cpp
index 4faace525c..71f57fc12d 100644
--- a/thirdparty/icu4c/common/uniset.cpp
+++ b/thirdparty/icu4c/common/uniset.cpp
@@ -226,7 +226,7 @@ UnicodeSet& UnicodeSet::copyFrom(const UnicodeSet& o, UBool asThawed) {
uprv_memcpy(list, o.list, (size_t)len*sizeof(UChar32));
if (o.bmpSet != nullptr && !asThawed) {
bmpSet = new BMPSet(*o.bmpSet, list, len);
- if (bmpSet == NULL) { // Check for memory allocation error.
+ if (bmpSet == nullptr) { // Check for memory allocation error.
setToBogus();
return *this;
}
@@ -243,7 +243,7 @@ UnicodeSet& UnicodeSet::copyFrom(const UnicodeSet& o, UBool asThawed) {
}
if (o.stringSpan != nullptr && !asThawed) {
stringSpan = new UnicodeSetStringSpan(*o.stringSpan, *strings);
- if (stringSpan == NULL) { // Check for memory allocation error.
+ if (stringSpan == nullptr) { // Check for memory allocation error.
setToBogus();
return *this;
}
@@ -294,7 +294,7 @@ bool UnicodeSet::operator==(const UnicodeSet& o) const {
* @return the hash code value for this set.
* @see Object#hashCode()
*/
-int32_t UnicodeSet::hashCode(void) const {
+int32_t UnicodeSet::hashCode() const {
uint32_t result = static_cast<uint32_t>(len);
for (int32_t i = 0; i < len; ++i) {
result *= 1000003u;
@@ -314,7 +314,7 @@ int32_t UnicodeSet::hashCode(void) const {
*
* @return the number of elements in this set (its cardinality).
*/
-int32_t UnicodeSet::size(void) const {
+int32_t UnicodeSet::size() const {
int32_t n = 0;
int32_t count = getRangeCount();
for (int32_t i = 0; i < count; ++i) {
@@ -328,7 +328,7 @@ int32_t UnicodeSet::size(void) const {
*
* @return <tt>true</tt> if this set contains no elements.
*/
-UBool UnicodeSet::isEmpty(void) const {
+UBool UnicodeSet::isEmpty() const {
return len == 1 && !hasStrings();
}
@@ -345,10 +345,10 @@ UBool UnicodeSet::contains(UChar32 c) const {
//for (;;) {
// if (c < list[++i]) break;
//}
- if (bmpSet != NULL) {
+ if (bmpSet != nullptr) {
return bmpSet->contains(c);
}
- if (stringSpan != NULL) {
+ if (stringSpan != nullptr) {
return stringSpan->contains(c);
}
if (c >= UNICODESET_HIGH) { // Don't need to check LOW bound
@@ -582,7 +582,7 @@ UMatchDegree UnicodeSet::matches(const Replaceable& text,
// firstChar is the leftmost char to match in the
// forward direction or the rightmost char to match in
// the reverse direction.
- UChar firstChar = text.charAt(offset);
+ char16_t firstChar = text.charAt(offset);
// If there are multiple strings that can match we
// return the longest match.
@@ -594,7 +594,7 @@ UMatchDegree UnicodeSet::matches(const Replaceable& text,
continue; // skip the empty string
}
- UChar c = trial.charAt(forward ? 0 : trial.length() - 1);
+ char16_t c = trial.charAt(forward ? 0 : trial.length() - 1);
// Strings are sorted, so we can optimize in the
// forward direction.
@@ -977,7 +977,7 @@ void UnicodeSet::_add(const UnicodeString& s) {
return;
}
UnicodeString* t = new UnicodeString(s);
- if (t == NULL) { // Check for memory allocation error.
+ if (t == nullptr) { // Check for memory allocation error.
setToBogus();
return;
}
@@ -1075,7 +1075,7 @@ UnicodeSet& UnicodeSet::removeAllStrings() {
*/
UnicodeSet* U_EXPORT2 UnicodeSet::createFrom(const UnicodeString& s) {
UnicodeSet *set = new UnicodeSet();
- if (set != NULL) { // Check for memory allocation error.
+ if (set != nullptr) { // Check for memory allocation error.
set->add(s);
}
return set;
@@ -1089,7 +1089,7 @@ UnicodeSet* U_EXPORT2 UnicodeSet::createFrom(const UnicodeString& s) {
*/
UnicodeSet* U_EXPORT2 UnicodeSet::createFromAll(const UnicodeString& s) {
UnicodeSet *set = new UnicodeSet();
- if (set != NULL) { // Check for memory allocation error.
+ if (set != nullptr) { // Check for memory allocation error.
set->addAll(s);
}
return set;
@@ -1218,7 +1218,7 @@ UnicodeSet& UnicodeSet::complement(UChar32 c) {
* This is equivalent to
* <code>complement(MIN_VALUE, MAX_VALUE)</code>.
*/
-UnicodeSet& UnicodeSet::complement(void) {
+UnicodeSet& UnicodeSet::complement() {
if (isFrozen() || isBogus()) {
return *this;
}
@@ -1272,12 +1272,12 @@ UnicodeSet& UnicodeSet::complement(const UnicodeString& s) {
* @see #add(char, char)
*/
UnicodeSet& UnicodeSet::addAll(const UnicodeSet& c) {
- if ( c.len>0 && c.list!=NULL ) {
+ if ( c.len>0 && c.list!=nullptr ) {
add(c.list, c.len, 0);
}
// Add strings in order
- if ( c.strings!=NULL ) {
+ if ( c.strings!=nullptr ) {
for (int32_t i=0; i<c.strings->size(); ++i) {
const UnicodeString* s = (const UnicodeString*)c.strings->elementAt(i);
if (!stringsContains(*s)) {
@@ -1361,14 +1361,14 @@ UnicodeSet& UnicodeSet::complementAll(const UnicodeSet& c) {
* Removes all of the elements from this set. This set will be
* empty after this call returns.
*/
-UnicodeSet& UnicodeSet::clear(void) {
+UnicodeSet& UnicodeSet::clear() {
if (isFrozen()) {
return *this;
}
list[0] = UNICODESET_HIGH;
len = 1;
releasePattern();
- if (strings != NULL) {
+ if (strings != nullptr) {
strings->removeAllElements();
}
// Remove bogus
@@ -1421,7 +1421,7 @@ UnicodeSet& UnicodeSet::compact() {
// Delete buffer first to defragment memory less.
if (buffer != stackList) {
uprv_free(buffer);
- buffer = NULL;
+ buffer = nullptr;
bufferCapacity = 0;
}
if (list == stackList) {
@@ -1464,7 +1464,7 @@ UnicodeSet::UnicodeSet(const uint16_t data[], int32_t dataLen, ESerialization se
}
if( (serialization != kSerialized)
- || (data==NULL)
+ || (data==nullptr)
|| (dataLen < 1)) {
ec = U_ILLEGAL_ARGUMENT_ERROR;
setToBogus();
@@ -1513,7 +1513,7 @@ int32_t UnicodeSet::serialize(uint16_t *dest, int32_t destCapacity, UErrorCode&
return 0;
}
- if (destCapacity<0 || (destCapacity>0 && dest==NULL)) {
+ if (destCapacity<0 || (destCapacity>0 && dest==nullptr)) {
ec=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -1611,13 +1611,13 @@ UBool UnicodeSet::allocateStrings(UErrorCode &status) {
}
strings = new UVector(uprv_deleteUObject,
uhash_compareUnicodeString, 1, status);
- if (strings == NULL) { // Check for memory allocation error.
+ if (strings == nullptr) { // Check for memory allocation error.
status = U_MEMORY_ALLOCATION_ERROR;
return false;
}
if (U_FAILURE(status)) {
delete strings;
- strings = NULL;
+ strings = nullptr;
return false;
}
return true;
@@ -1647,7 +1647,7 @@ bool UnicodeSet::ensureCapacity(int32_t newLen) {
}
int32_t newCapacity = nextCapacity(newLen);
UChar32* temp = (UChar32*) uprv_malloc(newCapacity * sizeof(UChar32));
- if (temp == NULL) {
+ if (temp == nullptr) {
setToBogus(); // set the object to bogus state if an OOM failure occurred.
return false;
}
@@ -1670,7 +1670,7 @@ bool UnicodeSet::ensureBufferCapacity(int32_t newLen) {
}
int32_t newCapacity = nextCapacity(newLen);
UChar32* temp = (UChar32*) uprv_malloc(newCapacity * sizeof(UChar32));
- if (temp == NULL) {
+ if (temp == nullptr) {
setToBogus();
return false;
}
@@ -1687,7 +1687,7 @@ bool UnicodeSet::ensureBufferCapacity(int32_t newLen) {
/**
* Swap list and buffer.
*/
-void UnicodeSet::swapBuffers(void) {
+void UnicodeSet::swapBuffers() {
// swap list and buffer
UChar32* temp = list;
list = buffer;
@@ -1763,7 +1763,7 @@ void UnicodeSet::exclusiveOr(const UChar32* other, int32_t otherLen, int8_t pola
// polarity = 3: ~x union ~y
void UnicodeSet::add(const UChar32* other, int32_t otherLen, int8_t polarity) {
- if (isFrozen() || isBogus() || other==NULL) {
+ if (isFrozen() || isBogus() || other==nullptr) {
return;
}
if (!ensureBufferCapacity(len + otherLen)) {
@@ -2030,7 +2030,7 @@ void UnicodeSet::_appendToPat(UnicodeString &result, UChar32 start, UChar32 end,
UnicodeString& UnicodeSet::_toPattern(UnicodeString& result,
UBool escapeUnprintable) const
{
- if (pat != NULL) {
+ if (pat != nullptr) {
int32_t i;
int32_t backslashCount = 0;
for (i=0; i<patLen; ) {
@@ -2151,7 +2151,7 @@ UnicodeString& UnicodeSet::_generatePattern(UnicodeString& result,
void UnicodeSet::releasePattern() {
if (pat) {
uprv_free(pat);
- pat = NULL;
+ pat = nullptr;
patLen = 0;
}
}
@@ -2161,7 +2161,7 @@ void UnicodeSet::releasePattern() {
*/
void UnicodeSet::setPattern(const char16_t *newPat, int32_t newPatLen) {
releasePattern();
- pat = (UChar *)uprv_malloc((newPatLen + 1) * sizeof(UChar));
+ pat = (char16_t *)uprv_malloc((newPatLen + 1) * sizeof(char16_t));
if (pat) {
patLen = newPatLen;
u_memcpy(pat, newPat, patLen);
@@ -2188,13 +2188,13 @@ UnicodeSet *UnicodeSet::freeze() {
// many relevant strings as UTF-16.
// (Thus needsStringSpanUTF8() implies needsStringSpanUTF16().)
delete stringSpan;
- stringSpan = NULL;
+ stringSpan = nullptr;
}
}
- if (stringSpan == NULL) {
+ if (stringSpan == nullptr) {
// No span-relevant strings: Optimize for code point spans.
bmpSet=new BMPSet(list, len);
- if (bmpSet == NULL) { // Check for memory allocation error.
+ if (bmpSet == nullptr) { // Check for memory allocation error.
setToBogus();
}
}
@@ -2202,8 +2202,8 @@ UnicodeSet *UnicodeSet::freeze() {
return this;
}
-int32_t UnicodeSet::span(const UChar *s, int32_t length, USetSpanCondition spanCondition) const {
- if(length>0 && bmpSet!=NULL) {
+int32_t UnicodeSet::span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const {
+ if(length>0 && bmpSet!=nullptr) {
return (int32_t)(bmpSet->span(s, s+length, spanCondition)-s);
}
if(length<0) {
@@ -2212,7 +2212,7 @@ int32_t UnicodeSet::span(const UChar *s, int32_t length, USetSpanCondition spanC
if(length==0) {
return 0;
}
- if(stringSpan!=NULL) {
+ if(stringSpan!=nullptr) {
return stringSpan->span(s, length, spanCondition);
} else if(hasStrings()) {
uint32_t which= spanCondition==USET_SPAN_NOT_CONTAINED ?
@@ -2239,8 +2239,8 @@ int32_t UnicodeSet::span(const UChar *s, int32_t length, USetSpanCondition spanC
return prev;
}
-int32_t UnicodeSet::spanBack(const UChar *s, int32_t length, USetSpanCondition spanCondition) const {
- if(length>0 && bmpSet!=NULL) {
+int32_t UnicodeSet::spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const {
+ if(length>0 && bmpSet!=nullptr) {
return (int32_t)(bmpSet->spanBack(s, s+length, spanCondition)-s);
}
if(length<0) {
@@ -2249,7 +2249,7 @@ int32_t UnicodeSet::spanBack(const UChar *s, int32_t length, USetSpanCondition s
if(length==0) {
return 0;
}
- if(stringSpan!=NULL) {
+ if(stringSpan!=nullptr) {
return stringSpan->spanBack(s, length, spanCondition);
} else if(hasStrings()) {
uint32_t which= spanCondition==USET_SPAN_NOT_CONTAINED ?
@@ -2277,7 +2277,7 @@ int32_t UnicodeSet::spanBack(const UChar *s, int32_t length, USetSpanCondition s
}
int32_t UnicodeSet::spanUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const {
- if(length>0 && bmpSet!=NULL) {
+ if(length>0 && bmpSet!=nullptr) {
const uint8_t *s0=(const uint8_t *)s;
return (int32_t)(bmpSet->spanUTF8(s0, length, spanCondition)-s0);
}
@@ -2287,7 +2287,7 @@ int32_t UnicodeSet::spanUTF8(const char *s, int32_t length, USetSpanCondition sp
if(length==0) {
return 0;
}
- if(stringSpan!=NULL) {
+ if(stringSpan!=nullptr) {
return stringSpan->spanUTF8((const uint8_t *)s, length, spanCondition);
} else if(hasStrings()) {
uint32_t which= spanCondition==USET_SPAN_NOT_CONTAINED ?
@@ -2315,7 +2315,7 @@ int32_t UnicodeSet::spanUTF8(const char *s, int32_t length, USetSpanCondition sp
}
int32_t UnicodeSet::spanBackUTF8(const char *s, int32_t length, USetSpanCondition spanCondition) const {
- if(length>0 && bmpSet!=NULL) {
+ if(length>0 && bmpSet!=nullptr) {
const uint8_t *s0=(const uint8_t *)s;
return bmpSet->spanBackUTF8(s0, length, spanCondition);
}
@@ -2325,7 +2325,7 @@ int32_t UnicodeSet::spanBackUTF8(const char *s, int32_t length, USetSpanConditio
if(length==0) {
return 0;
}
- if(stringSpan!=NULL) {
+ if(stringSpan!=nullptr) {
return stringSpan->spanBackUTF8((const uint8_t *)s, length, spanCondition);
} else if(hasStrings()) {
uint32_t which= spanCondition==USET_SPAN_NOT_CONTAINED ?
diff --git a/thirdparty/icu4c/common/uniset_closure.cpp b/thirdparty/icu4c/common/uniset_closure.cpp
index d7dab2a17b..173a5cbaae 100644
--- a/thirdparty/icu4c/common/uniset_closure.cpp
+++ b/thirdparty/icu4c/common/uniset_closure.cpp
@@ -25,9 +25,11 @@
#include "unicode/locid.h"
#include "unicode/parsepos.h"
#include "unicode/uniset.h"
+#include "unicode/utf16.h"
#include "cmemory.h"
#include "ruleiter.h"
#include "ucase.h"
+#include "uprops.h"
#include "util.h"
#include "uvector.h"
@@ -123,7 +125,7 @@ _set_addRange(USet *set, UChar32 start, UChar32 end) {
}
static void U_CALLCONV
-_set_addString(USet *set, const UChar *str, int32_t length) {
+_set_addString(USet *set, const char16_t *str, int32_t length) {
((UnicodeSet *)set)->add(UnicodeString((UBool)(length<0), str, length));
}
@@ -134,7 +136,7 @@ _set_addString(USet *set, const UChar *str, int32_t length) {
// add the result of a full case mapping to the set
// use str as a temporary string to avoid constructing one
static inline void
-addCaseMapping(UnicodeSet &set, int32_t result, const UChar *full, UnicodeString &str) {
+addCaseMapping(UnicodeSet &set, int32_t result, const char16_t *full, UnicodeString &str) {
if(result >= 0) {
if(result > UCASE_MAX_STRING_LENGTH) {
// add a single-code point case mapping
@@ -149,102 +151,208 @@ addCaseMapping(UnicodeSet &set, int32_t result, const UChar *full, UnicodeString
// see ucase.h
}
+namespace {
+
+/** For case closure on a large set, look only at code points with relevant properties. */
+const UnicodeSet &maybeOnlyCaseSensitive(const UnicodeSet &src, UnicodeSet &subset) {
+ // The subset must have been constructed with all code points,
+ // so that the retainAll() intersection effectively copies all single code points from src.
+ U_ASSERT(subset.contains(0, 0x10ffff));
+ if (src.size() < 30) {
+ return src;
+ }
+ // Return the intersection of the src code points with Case_Sensitive ones.
+ UErrorCode errorCode = U_ZERO_ERROR;
+ const UnicodeSet *sensitive =
+ CharacterProperties::getBinaryPropertySet(UCHAR_CASE_SENSITIVE, errorCode);
+ if (U_FAILURE(errorCode)) {
+ return src;
+ }
+ // Start by copying the "smaller" set.
+ // (We "copy" by intersecting all Unicode *code points* with the first set,
+ // which omits any strings.)
+ if (src.getRangeCount() > sensitive->getRangeCount()) {
+ subset.retainAll(*sensitive);
+ subset.retainAll(src);
+ } else {
+ subset.retainAll(src);
+ subset.retainAll(*sensitive);
+ }
+ return subset;
+}
+
+// Per-character scf = Simple_Case_Folding of a string.
+// (Normally when we case-fold a string we use full case foldings.)
+bool scfString(const UnicodeString &s, UnicodeString &scf) {
+ // Iterate over the raw buffer for best performance.
+ const char16_t *p = s.getBuffer();
+ int32_t length = s.length();
+ // Loop while not needing modification.
+ for (int32_t i = 0; i < length;) {
+ UChar32 c;
+ U16_NEXT(p, i, length, c); // post-increments i
+ UChar32 scfChar = u_foldCase(c, U_FOLD_CASE_DEFAULT);
+ if (scfChar != c) {
+ // Copy the characters before c.
+ scf.setTo(p, i - U16_LENGTH(c));
+ // Loop over the rest of the string and keep case-folding.
+ for (;;) {
+ scf.append(scfChar);
+ if (i == length) {
+ return true;
+ }
+ U16_NEXT(p, i, length, c); // post-increments i
+ scfChar = u_foldCase(c, U_FOLD_CASE_DEFAULT);
+ }
+ }
+ }
+ return false;
+}
+
+} // namespace
+
UnicodeSet& UnicodeSet::closeOver(int32_t attribute) {
if (isFrozen() || isBogus()) {
return *this;
}
- if (attribute & (USET_CASE_INSENSITIVE | USET_ADD_CASE_MAPPINGS)) {
- {
- UnicodeSet foldSet(*this);
- UnicodeString str;
- USetAdder sa = {
- foldSet.toUSet(),
- _set_add,
- _set_addRange,
- _set_addString,
- NULL, // don't need remove()
- NULL // don't need removeRange()
- };
-
- // start with input set to guarantee inclusion
- // USET_CASE: remove strings because the strings will actually be reduced (folded);
- // therefore, start with no strings and add only those needed
- if ((attribute & USET_CASE_INSENSITIVE) && foldSet.hasStrings()) {
- foldSet.strings->removeAllElements();
- }
+ switch (attribute & USET_CASE_MASK) {
+ case 0:
+ break;
+ case USET_CASE_INSENSITIVE:
+ closeOverCaseInsensitive(/* simple= */ false);
+ break;
+ case USET_ADD_CASE_MAPPINGS:
+ closeOverAddCaseMappings();
+ break;
+ case USET_SIMPLE_CASE_INSENSITIVE:
+ closeOverCaseInsensitive(/* simple= */ true);
+ break;
+ default:
+ // bad option (unreachable)
+ break;
+ }
+ return *this;
+}
+
+void UnicodeSet::closeOverCaseInsensitive(bool simple) {
+ // Start with input set to guarantee inclusion.
+ UnicodeSet foldSet(*this);
+ // Full case mappings closure:
+ // Remove strings because the strings will actually be reduced (folded);
+ // therefore, start with no strings and add only those needed.
+ // Do this before processing code points, because they may add strings.
+ if (!simple && foldSet.hasStrings()) {
+ foldSet.strings->removeAllElements();
+ }
+
+ USetAdder sa = {
+ foldSet.toUSet(),
+ _set_add,
+ _set_addRange,
+ _set_addString,
+ nullptr, // don't need remove()
+ nullptr // don't need removeRange()
+ };
+
+ UnicodeSet subset(0, 0x10ffff);
+ const UnicodeSet &codePoints = maybeOnlyCaseSensitive(*this, subset);
- int32_t n = getRangeCount();
- UChar32 result;
- const UChar *full;
-
- for (int32_t i=0; i<n; ++i) {
- UChar32 start = getRangeStart(i);
- UChar32 end = getRangeEnd(i);
-
- if (attribute & USET_CASE_INSENSITIVE) {
- // full case closure
- for (UChar32 cp=start; cp<=end; ++cp) {
- ucase_addCaseClosure(cp, &sa);
- }
- } else {
- // add case mappings
- // (does not add long s for regular s, or Kelvin for k, for example)
- for (UChar32 cp=start; cp<=end; ++cp) {
- result = ucase_toFullLower(cp, NULL, NULL, &full, UCASE_LOC_ROOT);
- addCaseMapping(foldSet, result, full, str);
-
- result = ucase_toFullTitle(cp, NULL, NULL, &full, UCASE_LOC_ROOT);
- addCaseMapping(foldSet, result, full, str);
-
- result = ucase_toFullUpper(cp, NULL, NULL, &full, UCASE_LOC_ROOT);
- addCaseMapping(foldSet, result, full, str);
-
- result = ucase_toFullFolding(cp, &full, 0);
- addCaseMapping(foldSet, result, full, str);
- }
+ // Iterate over the ranges of single code points. Nested loop for each code point.
+ int32_t n = codePoints.getRangeCount();
+
+ for (int32_t i=0; i<n; ++i) {
+ UChar32 start = codePoints.getRangeStart(i);
+ UChar32 end = codePoints.getRangeEnd(i);
+
+ if (simple) {
+ for (UChar32 cp=start; cp<=end; ++cp) {
+ ucase_addSimpleCaseClosure(cp, &sa);
+ }
+ } else {
+ for (UChar32 cp=start; cp<=end; ++cp) {
+ ucase_addCaseClosure(cp, &sa);
+ }
+ }
+ }
+ if (hasStrings()) {
+ UnicodeString str;
+ for (int32_t j=0; j<strings->size(); ++j) {
+ const UnicodeString *pStr = (const UnicodeString *) strings->elementAt(j);
+ if (simple) {
+ if (scfString(*pStr, str)) {
+ foldSet.remove(*pStr).add(str);
+ }
+ } else {
+ str = *pStr;
+ str.foldCase();
+ if(!ucase_addStringCaseClosure(str.getBuffer(), str.length(), &sa)) {
+ foldSet.add(str); // does not map to code points: add the folded string itself
}
}
- if (hasStrings()) {
- if (attribute & USET_CASE_INSENSITIVE) {
- for (int32_t j=0; j<strings->size(); ++j) {
- str = *(const UnicodeString *) strings->elementAt(j);
- str.foldCase();
- if(!ucase_addStringCaseClosure(str.getBuffer(), str.length(), &sa)) {
- foldSet.add(str); // does not map to code points: add the folded string itself
- }
- }
- } else {
- Locale root("");
-#if !UCONFIG_NO_BREAK_ITERATION
- UErrorCode status = U_ZERO_ERROR;
- BreakIterator *bi = BreakIterator::createWordInstance(root, status);
- if (U_SUCCESS(status)) {
-#endif
- const UnicodeString *pStr;
+ }
+ }
+ *this = foldSet;
+}
+
+void UnicodeSet::closeOverAddCaseMappings() {
+ // Start with input set to guarantee inclusion.
+ UnicodeSet foldSet(*this);
+
+ UnicodeSet subset(0, 0x10ffff);
+ const UnicodeSet &codePoints = maybeOnlyCaseSensitive(*this, subset);
- for (int32_t j=0; j<strings->size(); ++j) {
- pStr = (const UnicodeString *) strings->elementAt(j);
- (str = *pStr).toLower(root);
- foldSet.add(str);
+ // Iterate over the ranges of single code points. Nested loop for each code point.
+ int32_t n = codePoints.getRangeCount();
+ UChar32 result;
+ const char16_t *full;
+ UnicodeString str;
+
+ for (int32_t i=0; i<n; ++i) {
+ UChar32 start = codePoints.getRangeStart(i);
+ UChar32 end = codePoints.getRangeEnd(i);
+
+ // add case mappings
+ // (does not add long s for regular s, or Kelvin for k, for example)
+ for (UChar32 cp=start; cp<=end; ++cp) {
+ result = ucase_toFullLower(cp, nullptr, nullptr, &full, UCASE_LOC_ROOT);
+ addCaseMapping(foldSet, result, full, str);
+
+ result = ucase_toFullTitle(cp, nullptr, nullptr, &full, UCASE_LOC_ROOT);
+ addCaseMapping(foldSet, result, full, str);
+
+ result = ucase_toFullUpper(cp, nullptr, nullptr, &full, UCASE_LOC_ROOT);
+ addCaseMapping(foldSet, result, full, str);
+
+ result = ucase_toFullFolding(cp, &full, 0);
+ addCaseMapping(foldSet, result, full, str);
+ }
+ }
+ if (hasStrings()) {
+ Locale root("");
#if !UCONFIG_NO_BREAK_ITERATION
- (str = *pStr).toTitle(bi, root);
- foldSet.add(str);
+ UErrorCode status = U_ZERO_ERROR;
+ BreakIterator *bi = BreakIterator::createWordInstance(root, status);
+ if (U_SUCCESS(status)) {
#endif
- (str = *pStr).toUpper(root);
- foldSet.add(str);
- (str = *pStr).foldCase();
- foldSet.add(str);
- }
+ for (int32_t j=0; j<strings->size(); ++j) {
+ const UnicodeString *pStr = (const UnicodeString *) strings->elementAt(j);
+ (str = *pStr).toLower(root);
+ foldSet.add(str);
#if !UCONFIG_NO_BREAK_ITERATION
- }
- delete bi;
+ (str = *pStr).toTitle(bi, root);
+ foldSet.add(str);
#endif
- }
+ (str = *pStr).toUpper(root);
+ foldSet.add(str);
+ (str = *pStr).foldCase();
+ foldSet.add(str);
}
- *this = foldSet;
+#if !UCONFIG_NO_BREAK_ITERATION
}
+ delete bi;
+#endif
}
- return *this;
+ *this = foldSet;
}
U_NAMESPACE_END
diff --git a/thirdparty/icu4c/common/uniset_props.cpp b/thirdparty/icu4c/common/uniset_props.cpp
index 48c0a26a71..b3dbdf93c8 100644
--- a/thirdparty/icu4c/common/uniset_props.cpp
+++ b/thirdparty/icu4c/common/uniset_props.cpp
@@ -67,9 +67,9 @@ static icu::UInitOnce uni32InitOnce {};
/**
* Cleanup function for UnicodeSet
*/
-static UBool U_CALLCONV uset_cleanup(void) {
+static UBool U_CALLCONV uset_cleanup() {
delete uni32Singleton;
- uni32Singleton = NULL;
+ uni32Singleton = nullptr;
uni32InitOnce.reset();
return true;
}
@@ -82,9 +82,9 @@ namespace {
// Cache some sets for other services -------------------------------------- ***
void U_CALLCONV createUni32Set(UErrorCode &errorCode) {
- U_ASSERT(uni32Singleton == NULL);
+ U_ASSERT(uni32Singleton == nullptr);
uni32Singleton = new UnicodeSet(UNICODE_STRING_SIMPLE("[:age=3.2:]"), errorCode);
- if(uni32Singleton==NULL) {
+ if(uni32Singleton==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
} else {
uni32Singleton->freeze();
@@ -108,7 +108,7 @@ uniset_getUnicode32Instance(UErrorCode &errorCode) {
static inline UBool
isPerlOpen(const UnicodeString &pattern, int32_t pos) {
- UChar c;
+ char16_t c;
return pattern.charAt(pos)==u'\\' && ((c=pattern.charAt(pos+1))==u'p' || c==u'P');
}
@@ -162,10 +162,10 @@ UnicodeSet::UnicodeSet(const UnicodeString& pattern,
UnicodeSet& UnicodeSet::applyPattern(const UnicodeString& pattern,
UErrorCode& status) {
// Equivalent to
- // return applyPattern(pattern, USET_IGNORE_SPACE, NULL, status);
+ // return applyPattern(pattern, USET_IGNORE_SPACE, nullptr, status);
// but without dependency on closeOver().
ParsePosition pos(0);
- applyPatternIgnoreSpace(pattern, pos, NULL, status);
+ applyPatternIgnoreSpace(pattern, pos, nullptr, status);
if (U_FAILURE(status)) return *this;
int32_t i = pos.getIndex();
@@ -193,7 +193,7 @@ UnicodeSet::applyPatternIgnoreSpace(const UnicodeString& pattern,
// _applyPattern calls add() etc., which set pat to empty.
UnicodeString rebuiltPat;
RuleCharacterIterator chars(pattern, symbols, pos);
- applyPattern(chars, symbols, rebuiltPat, USET_IGNORE_SPACE, NULL, 0, status);
+ applyPattern(chars, symbols, rebuiltPat, USET_IGNORE_SPACE, nullptr, 0, status);
if (U_FAILURE(status)) return;
if (chars.inVariable()) {
// syntaxError(chars, "Extra chars in variable value");
@@ -209,7 +209,7 @@ UnicodeSet::applyPatternIgnoreSpace(const UnicodeString& pattern,
*/
UBool UnicodeSet::resemblesPattern(const UnicodeString& pattern, int32_t pos) {
return ((pos+1) < pattern.length() &&
- pattern.charAt(pos) == (UChar)91/*[*/) ||
+ pattern.charAt(pos) == (char16_t)91/*[*/) ||
resemblesPropertyPattern(pattern, pos);
}
@@ -287,7 +287,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
// lastItem: 0=none, 1=char, 2=set
int8_t lastItem = 0, mode = 0;
UChar32 lastChar = 0;
- UChar op = 0;
+ char16_t op = 0;
UBool invert = false;
@@ -356,7 +356,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
const UnicodeFunctor *m = symbols->lookupMatcher(c);
if (m != 0) {
const UnicodeSet *ms = dynamic_cast<const UnicodeSet *>(m);
- if (ms == NULL) {
+ if (ms == nullptr) {
ec = U_MALFORMED_SET;
return;
}
@@ -471,7 +471,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
case u'-':
if (op == 0) {
if (lastItem != 0) {
- op = (UChar) c;
+ op = (char16_t) c;
continue;
} else {
// Treat final trailing '-' as a literal
@@ -490,7 +490,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
return;
case u'&':
if (lastItem == 2 && op == 0) {
- op = (UChar) c;
+ op = (char16_t) c;
continue;
}
// syntaxError(chars, "'&' not after set");
@@ -561,7 +561,7 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
}
add(U_ETHER);
usePat = true;
- patLocal.append((UChar) SymbolTable::SYMBOL_REF);
+ patLocal.append((char16_t) SymbolTable::SYMBOL_REF);
patLocal.append(u']');
mode = 2;
continue;
@@ -631,11 +631,8 @@ void UnicodeSet::applyPattern(RuleCharacterIterator& chars,
* to close over case BEFORE COMPLEMENTING. This makes
* patterns like /[^abc]/i work.
*/
- if ((options & USET_CASE_INSENSITIVE) != 0) {
- (this->*caseClosure)(USET_CASE_INSENSITIVE);
- }
- else if ((options & USET_ADD_CASE_MAPPINGS) != 0) {
- (this->*caseClosure)(USET_ADD_CASE_MAPPINGS);
+ if ((options & USET_CASE_MASK) != 0) {
+ (this->*caseClosure)(options);
}
if (invert) {
complement().removeAllStrings(); // code point complement
@@ -1044,7 +1041,7 @@ UnicodeSet& UnicodeSet::applyPropertyPattern(const UnicodeString& pattern,
invert = true;
}
} else if (isPerlOpen(pattern, pos) || isNameOpen(pattern, pos)) {
- UChar c = pattern.charAt(pos+1);
+ char16_t c = pattern.charAt(pos+1);
invert = (c == u'P');
isName = (c == u'N');
pos += 2;
diff --git a/thirdparty/icu4c/common/unisetspan.cpp b/thirdparty/icu4c/common/unisetspan.cpp
index e4277c5be6..b7256d8fd1 100644
--- a/thirdparty/icu4c/common/unisetspan.cpp
+++ b/thirdparty/icu4c/common/unisetspan.cpp
@@ -70,7 +70,7 @@ public:
capacity=(int32_t)sizeof(staticList);
} else {
UBool *l=(UBool *)uprv_malloc(maxLength);
- if(l!=NULL) {
+ if(l!=nullptr) {
list=l;
capacity=maxLength;
}
@@ -165,10 +165,10 @@ private:
// Get the number of UTF-8 bytes for a UTF-16 (sub)string.
static int32_t
-getUTF8Length(const UChar *s, int32_t length) {
+getUTF8Length(const char16_t *s, int32_t length) {
UErrorCode errorCode=U_ZERO_ERROR;
int32_t length8=0;
- u_strToUTF8(NULL, 0, &length8, s, length, &errorCode);
+ u_strToUTF8(nullptr, 0, &length8, s, length, &errorCode);
if(U_SUCCESS(errorCode) || errorCode==U_BUFFER_OVERFLOW_ERROR) {
return length8;
} else {
@@ -180,7 +180,7 @@ getUTF8Length(const UChar *s, int32_t length) {
// Append the UTF-8 version of the string to t and return the appended UTF-8 length.
static int32_t
-appendUTF8(const UChar *s, int32_t length, uint8_t *t, int32_t capacity) {
+appendUTF8(const char16_t *s, int32_t length, uint8_t *t, int32_t capacity) {
UErrorCode errorCode=U_ZERO_ERROR;
int32_t length8=0;
u_strToUTF8((char *)t, capacity, &length8, s, length, &errorCode);
@@ -204,8 +204,8 @@ makeSpanLengthByte(int32_t spanLength) {
UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSet &set,
const UVector &setStrings,
uint32_t which)
- : spanSet(0, 0x10ffff), pSpanNotSet(NULL), strings(setStrings),
- utf8Lengths(NULL), spanLengths(NULL), utf8(NULL),
+ : spanSet(0, 0x10ffff), pSpanNotSet(nullptr), strings(setStrings),
+ utf8Lengths(nullptr), spanLengths(nullptr), utf8(nullptr),
utf8Length(0),
maxLength16(0), maxLength8(0),
all((UBool)(which==ALL)) {
@@ -229,7 +229,7 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSet &set,
UBool someRelevant=false;
for(i=0; i<stringsLength; ++i) {
const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i);
- const UChar *s16=string.getBuffer();
+ const char16_t *s16=string.getBuffer();
int32_t length16=string.length();
if (length16==0) {
continue; // skip the empty string
@@ -283,7 +283,7 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSet &set,
utf8Lengths=staticLengths;
} else {
utf8Lengths=(int32_t *)uprv_malloc(allocSize);
- if(utf8Lengths==NULL) {
+ if(utf8Lengths==nullptr) {
maxLength16=maxLength8=0; // Prevent usage by making needsStringSpanUTF16/8() return false.
return; // Out of memory.
}
@@ -312,7 +312,7 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSet &set,
for(i=0; i<stringsLength; ++i) {
const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i);
- const UChar *s16=string.getBuffer();
+ const char16_t *s16=string.getBuffer();
int32_t length16=string.length();
spanLength=spanSet.span(s16, length16, USET_SPAN_CONTAINED);
if(spanLength<length16 && length16>0) { // Relevant string.
@@ -395,8 +395,8 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSet &set,
// Copy constructor. Assumes which==ALL for a frozen set.
UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSetStringSpan &otherStringSpan,
const UVector &newParentSetStrings)
- : spanSet(otherStringSpan.spanSet), pSpanNotSet(NULL), strings(newParentSetStrings),
- utf8Lengths(NULL), spanLengths(NULL), utf8(NULL),
+ : spanSet(otherStringSpan.spanSet), pSpanNotSet(nullptr), strings(newParentSetStrings),
+ utf8Lengths(nullptr), spanLengths(nullptr), utf8(nullptr),
utf8Length(otherStringSpan.utf8Length),
maxLength16(otherStringSpan.maxLength16), maxLength8(otherStringSpan.maxLength8),
all(true) {
@@ -414,7 +414,7 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSetStringSpan &otherStri
utf8Lengths=staticLengths;
} else {
utf8Lengths=(int32_t *)uprv_malloc(allocSize);
- if(utf8Lengths==NULL) {
+ if(utf8Lengths==nullptr) {
maxLength16=maxLength8=0; // Prevent usage by making needsStringSpanUTF16/8() return false.
return; // Out of memory.
}
@@ -426,21 +426,21 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSetStringSpan &otherStri
}
UnicodeSetStringSpan::~UnicodeSetStringSpan() {
- if(pSpanNotSet!=NULL && pSpanNotSet!=&spanSet) {
+ if(pSpanNotSet!=nullptr && pSpanNotSet!=&spanSet) {
delete pSpanNotSet;
}
- if(utf8Lengths!=NULL && utf8Lengths!=staticLengths) {
+ if(utf8Lengths!=nullptr && utf8Lengths!=staticLengths) {
uprv_free(utf8Lengths);
}
}
void UnicodeSetStringSpan::addToSpanNotSet(UChar32 c) {
- if(pSpanNotSet==NULL || pSpanNotSet==&spanSet) {
+ if(pSpanNotSet==nullptr || pSpanNotSet==&spanSet) {
if(spanSet.contains(c)) {
return; // Nothing to do.
}
UnicodeSet *newSet=spanSet.cloneAsThawed();
- if(newSet==NULL) {
+ if(newSet==nullptr) {
return; // Out of memory.
} else {
pSpanNotSet=newSet;
@@ -451,7 +451,7 @@ void UnicodeSetStringSpan::addToSpanNotSet(UChar32 c) {
// Compare strings without any argument checks. Requires length>0.
static inline UBool
-matches16(const UChar *s, const UChar *t, int32_t length) {
+matches16(const char16_t *s, const char16_t *t, int32_t length) {
do {
if(*s++!=*t++) {
return false;
@@ -474,7 +474,7 @@ matches8(const uint8_t *s, const uint8_t *t, int32_t length) {
// at code point boundaries.
// That is, each edge of a match must not be in the middle of a surrogate pair.
static inline UBool
-matches16CPB(const UChar *s, int32_t start, int32_t limit, const UChar *t, int32_t length) {
+matches16CPB(const char16_t *s, int32_t start, int32_t limit, const char16_t *t, int32_t length) {
s+=start;
limit-=start;
return matches16(s, t, length) &&
@@ -485,8 +485,8 @@ matches16CPB(const UChar *s, int32_t start, int32_t limit, const UChar *t, int32
// Does the set contain the next code point?
// If so, return its length; otherwise return its negative length.
static inline int32_t
-spanOne(const UnicodeSet &set, const UChar *s, int32_t length) {
- UChar c=*s, c2;
+spanOne(const UnicodeSet &set, const char16_t *s, int32_t length) {
+ char16_t c=*s, c2;
if(c>=0xd800 && c<=0xdbff && length>=2 && U16_IS_TRAIL(c2=s[1])) {
return set.contains(U16_GET_SUPPLEMENTARY(c, c2)) ? 2 : -2;
}
@@ -494,8 +494,8 @@ spanOne(const UnicodeSet &set, const UChar *s, int32_t length) {
}
static inline int32_t
-spanOneBack(const UnicodeSet &set, const UChar *s, int32_t length) {
- UChar c=s[length-1], c2;
+spanOneBack(const UnicodeSet &set, const char16_t *s, int32_t length) {
+ char16_t c=s[length-1], c2;
if(c>=0xdc00 && c<=0xdfff && length>=2 && U16_IS_LEAD(c2=s[length-2])) {
return set.contains(U16_GET_SUPPLEMENTARY(c2, c)) ? 2 : -2;
}
@@ -634,7 +634,7 @@ spanOneBackUTF8(const UnicodeSet &set, const uint8_t *s, int32_t length) {
* Stop if spanLength==0, otherwise continue the loop.
*/
-int32_t UnicodeSetStringSpan::span(const UChar *s, int32_t length, USetSpanCondition spanCondition) const {
+int32_t UnicodeSetStringSpan::span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const {
if(spanCondition==USET_SPAN_NOT_CONTAINED) {
return spanNot(s, length);
}
@@ -659,7 +659,7 @@ int32_t UnicodeSetStringSpan::span(const UChar *s, int32_t length, USetSpanCondi
continue; // Irrelevant string. (Also the empty string.)
}
const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i);
- const UChar *s16=string.getBuffer();
+ const char16_t *s16=string.getBuffer();
int32_t length16=string.length();
U_ASSERT(length>0);
@@ -699,7 +699,7 @@ int32_t UnicodeSetStringSpan::span(const UChar *s, int32_t length, USetSpanCondi
// to find the match from the earliest start.
const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i);
- const UChar *s16=string.getBuffer();
+ const char16_t *s16=string.getBuffer();
int32_t length16=string.length();
if (length16==0) {
continue; // skip the empty string
@@ -798,7 +798,7 @@ int32_t UnicodeSetStringSpan::span(const UChar *s, int32_t length, USetSpanCondi
}
}
-int32_t UnicodeSetStringSpan::spanBack(const UChar *s, int32_t length, USetSpanCondition spanCondition) const {
+int32_t UnicodeSetStringSpan::spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const {
if(spanCondition==USET_SPAN_NOT_CONTAINED) {
return spanNotBack(s, length);
}
@@ -827,7 +827,7 @@ int32_t UnicodeSetStringSpan::spanBack(const UChar *s, int32_t length, USetSpanC
continue; // Irrelevant string. (Also the empty string.)
}
const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i);
- const UChar *s16=string.getBuffer();
+ const char16_t *s16=string.getBuffer();
int32_t length16=string.length();
U_ASSERT(length>0);
@@ -869,7 +869,7 @@ int32_t UnicodeSetStringSpan::spanBack(const UChar *s, int32_t length, USetSpanC
// to find the match from the latest end.
const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i);
- const UChar *s16=string.getBuffer();
+ const char16_t *s16=string.getBuffer();
int32_t length16=string.length();
if (length16==0) {
continue; // skip the empty string
@@ -1346,7 +1346,7 @@ int32_t UnicodeSetStringSpan::spanBackUTF8(const uint8_t *s, int32_t length, USe
* when there is not actually a match for such a set string.
*/
-int32_t UnicodeSetStringSpan::spanNot(const UChar *s, int32_t length) const {
+int32_t UnicodeSetStringSpan::spanNot(const char16_t *s, int32_t length) const {
int32_t pos=0, rest=length;
int32_t i, stringsLength=strings.size();
do {
@@ -1372,7 +1372,7 @@ int32_t UnicodeSetStringSpan::spanNot(const UChar *s, int32_t length) const {
continue; // Irrelevant string. (Also the empty string.)
}
const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i);
- const UChar *s16=string.getBuffer();
+ const char16_t *s16=string.getBuffer();
int32_t length16=string.length();
U_ASSERT(length>0);
if(length16<=rest && matches16CPB(s, pos, length, s16, length16)) {
@@ -1389,7 +1389,7 @@ int32_t UnicodeSetStringSpan::spanNot(const UChar *s, int32_t length) const {
return length; // Reached the end of the string.
}
-int32_t UnicodeSetStringSpan::spanNotBack(const UChar *s, int32_t length) const {
+int32_t UnicodeSetStringSpan::spanNotBack(const char16_t *s, int32_t length) const {
int32_t pos=length;
int32_t i, stringsLength=strings.size();
do {
@@ -1416,7 +1416,7 @@ int32_t UnicodeSetStringSpan::spanNotBack(const UChar *s, int32_t length) const
continue; // Irrelevant string. (Also the empty string.)
}
const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i);
- const UChar *s16=string.getBuffer();
+ const char16_t *s16=string.getBuffer();
int32_t length16=string.length();
U_ASSERT(length>0);
if(length16<=pos && matches16CPB(s, pos-length16, length, s16, length16)) {
diff --git a/thirdparty/icu4c/common/unisetspan.h b/thirdparty/icu4c/common/unisetspan.h
index 9a1307a907..f1dc8e6f74 100644
--- a/thirdparty/icu4c/common/unisetspan.h
+++ b/thirdparty/icu4c/common/unisetspan.h
@@ -74,9 +74,9 @@ public:
// For fast UnicodeSet::contains(c).
inline UBool contains(UChar32 c) const;
- int32_t span(const UChar *s, int32_t length, USetSpanCondition spanCondition) const;
+ int32_t span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const;
- int32_t spanBack(const UChar *s, int32_t length, USetSpanCondition spanCondition) const;
+ int32_t spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const;
int32_t spanUTF8(const uint8_t *s, int32_t length, USetSpanCondition spanCondition) const;
@@ -95,8 +95,8 @@ private:
// so that a character span ends before any string.
void addToSpanNotSet(UChar32 c);
- int32_t spanNot(const UChar *s, int32_t length) const;
- int32_t spanNotBack(const UChar *s, int32_t length) const;
+ int32_t spanNot(const char16_t *s, int32_t length) const;
+ int32_t spanNotBack(const char16_t *s, int32_t length) const;
int32_t spanNotUTF8(const uint8_t *s, int32_t length) const;
int32_t spanNotBackUTF8(const uint8_t *s, int32_t length) const;
diff --git a/thirdparty/icu4c/common/unistr.cpp b/thirdparty/icu4c/common/unistr.cpp
index 4125d19472..04f01cfa16 100644
--- a/thirdparty/icu4c/common/unistr.cpp
+++ b/thirdparty/icu4c/common/unistr.cpp
@@ -44,7 +44,7 @@ void
print(const UnicodeString& s,
const char *name)
{
- UChar c;
+ char16_t c;
cout << name << ":|";
for(int i = 0; i < s.length(); ++i) {
c = s[i];
@@ -57,11 +57,11 @@ print(const UnicodeString& s,
}
void
-print(const UChar *s,
+print(const char16_t *s,
int32_t len,
const char *name)
{
- UChar c;
+ char16_t c;
cout << name << ":|";
for(int i = 0; i < len; ++i) {
c = s[i];
@@ -80,17 +80,17 @@ print(const UChar *s,
// need to copy areas that may overlap
static
inline void
-us_arrayCopy(const UChar *src, int32_t srcStart,
- UChar *dst, int32_t dstStart, int32_t count)
+us_arrayCopy(const char16_t *src, int32_t srcStart,
+ char16_t *dst, int32_t dstStart, int32_t count)
{
if(count>0) {
uprv_memmove(dst+dstStart, src+srcStart, (size_t)count*sizeof(*src));
}
}
-// u_unescapeAt() callback to get a UChar from a UnicodeString
+// u_unescapeAt() callback to get a char16_t from a UnicodeString
U_CDECL_BEGIN
-static UChar U_CALLCONV
+static char16_t U_CALLCONV
UnicodeString_charAt(int32_t offset, void *context) {
return ((icu::UnicodeString*) context)->charAt(offset);
}
@@ -159,8 +159,8 @@ UnicodeString::UnicodeString(int32_t capacity, UChar32 c, int32_t count) {
capacity = length;
}
if(allocate(capacity)) {
- UChar *array = getArrayStart();
- UChar unit = (UChar)c;
+ char16_t *array = getArrayStart();
+ char16_t unit = (char16_t)c;
for(int32_t i = 0; i < length; ++i) {
array[i] = unit;
}
@@ -177,9 +177,9 @@ UnicodeString::UnicodeString(int32_t capacity, UChar32 c, int32_t count) {
capacity = length;
}
if(allocate(capacity)) {
- UChar *array = getArrayStart();
- UChar lead = U16_LEAD(c);
- UChar trail = U16_TRAIL(c);
+ char16_t *array = getArrayStart();
+ char16_t lead = U16_LEAD(c);
+ char16_t trail = U16_TRAIL(c);
for(int32_t i = 0; i < length; i += 2) {
array[i] = lead;
array[i + 1] = trail;
@@ -189,7 +189,7 @@ UnicodeString::UnicodeString(int32_t capacity, UChar32 c, int32_t count) {
}
}
-UnicodeString::UnicodeString(UChar ch) {
+UnicodeString::UnicodeString(char16_t ch) {
fUnion.fFields.fLengthAndFlags = kLength1 | kShortString;
fUnion.fStackFields.fBuffer[0] = ch;
}
@@ -206,12 +206,12 @@ UnicodeString::UnicodeString(UChar32 ch) {
}
}
-UnicodeString::UnicodeString(const UChar *text) {
+UnicodeString::UnicodeString(const char16_t *text) {
fUnion.fFields.fLengthAndFlags = kShortString;
doAppend(text, 0, -1);
}
-UnicodeString::UnicodeString(const UChar *text,
+UnicodeString::UnicodeString(const char16_t *text,
int32_t textLength) {
fUnion.fFields.fLengthAndFlags = kShortString;
doAppend(text, 0, textLength);
@@ -221,8 +221,8 @@ UnicodeString::UnicodeString(UBool isTerminated,
ConstChar16Ptr textPtr,
int32_t textLength) {
fUnion.fFields.fLengthAndFlags = kReadonlyAlias;
- const UChar *text = textPtr;
- if(text == NULL) {
+ const char16_t *text = textPtr;
+ if(text == nullptr) {
// treat as an empty string, do not alias
setToEmpty();
} else if(textLength < -1 ||
@@ -235,16 +235,16 @@ UnicodeString::UnicodeString(UBool isTerminated,
// text is terminated, or else it would have failed the above test
textLength = u_strlen(text);
}
- setArray(const_cast<UChar *>(text), textLength,
+ setArray(const_cast<char16_t *>(text), textLength,
isTerminated ? textLength + 1 : textLength);
}
}
-UnicodeString::UnicodeString(UChar *buff,
+UnicodeString::UnicodeString(char16_t *buff,
int32_t buffLength,
int32_t buffCapacity) {
fUnion.fFields.fLengthAndFlags = kWritableAlias;
- if(buff == NULL) {
+ if(buff == nullptr) {
// treat as an empty string, do not alias
setToEmpty();
} else if(buffLength < -1 || buffCapacity < 0 || buffLength > buffCapacity) {
@@ -252,7 +252,7 @@ UnicodeString::UnicodeString(UChar *buff,
} else {
if(buffLength == -1) {
// fLength = u_strlen(buff); but do not look beyond buffCapacity
- const UChar *p = buff, *limit = buff + buffCapacity;
+ const char16_t *p = buff, *limit = buff + buffCapacity;
while(p != limit && *p != 0) {
++p;
}
@@ -264,7 +264,7 @@ UnicodeString::UnicodeString(UChar *buff,
UnicodeString::UnicodeString(const char *src, int32_t length, EInvariant) {
fUnion.fFields.fLengthAndFlags = kShortString;
- if(src==NULL) {
+ if(src==nullptr) {
// treat as an empty string
} else {
if(length<0) {
@@ -308,7 +308,7 @@ UnicodeString::UnicodeString(const UnicodeString& that) {
copyFrom(that);
}
-UnicodeString::UnicodeString(UnicodeString &&src) U_NOEXCEPT {
+UnicodeString::UnicodeString(UnicodeString &&src) noexcept {
copyFieldsFrom(src, true);
}
@@ -328,7 +328,7 @@ UnicodeString::UnicodeString(const UnicodeString& that,
// Replaceable base class clone() default implementation, does not clone
Replaceable *
Replaceable::clone() const {
- return NULL;
+ return nullptr;
}
// UnicodeString overrides clone() with a real implementation
@@ -380,13 +380,13 @@ UnicodeString::allocate(int32_t capacity) {
// Round up to a multiple of 16.
numBytes = (numBytes + 15) & ~15;
int32_t *array = (int32_t *) uprv_malloc(numBytes);
- if(array != NULL) {
+ if(array != nullptr) {
// set initial refCount and point behind the refCount
*array++ = 1;
numBytes -= sizeof(int32_t);
- // have fArray point to the first UChar
- fUnion.fFields.fArray = (UChar *)array;
+ // have fArray point to the first char16_t
+ fUnion.fFields.fArray = (char16_t *)array;
fUnion.fFields.fCapacity = (int32_t)(numBytes / U_SIZEOF_UCHAR);
fUnion.fFields.fLengthAndFlags = kLongString;
return true;
@@ -460,13 +460,13 @@ UnicodeString UnicodeString::fromUTF32(const UChar32 *utf32, int32_t length) {
capacity = length + (length >> 4) + 4;
}
do {
- UChar *utf16 = result.getBuffer(capacity);
+ char16_t *utf16 = result.getBuffer(capacity);
int32_t length16;
UErrorCode errorCode = U_ZERO_ERROR;
u_strFromUTF32WithSub(utf16, result.getCapacity(), &length16,
utf32, length,
0xfffd, // Substitution character.
- NULL, // Don't care about number of substitutions.
+ nullptr, // Don't care about number of substitutions.
&errorCode);
result.releaseBuffer(length16);
if(errorCode == U_BUFFER_OVERFLOW_ERROR) {
@@ -527,7 +527,7 @@ UnicodeString::copyFrom(const UnicodeString &src, UBool fastCopy) {
case kLongString:
// src uses a refCounted string buffer, use that buffer with refCount
// src is const, use a cast - we don't actually change it
- ((UnicodeString &)src).addRef();
+ const_cast<UnicodeString &>(src).addRef();
// copy all fields, share the reference-counted buffer
fUnion.fFields.fArray = src.fUnion.fFields.fArray;
fUnion.fFields.fCapacity = src.fUnion.fFields.fCapacity;
@@ -572,7 +572,7 @@ UnicodeString::copyFrom(const UnicodeString &src, UBool fastCopy) {
return *this;
}
-UnicodeString &UnicodeString::operator=(UnicodeString &&src) U_NOEXCEPT {
+UnicodeString &UnicodeString::operator=(UnicodeString &&src) noexcept {
// No explicit check for self move assignment, consistent with standard library.
// Self move assignment causes no crash nor leak but might make the object bogus.
releaseArray();
@@ -581,7 +581,7 @@ UnicodeString &UnicodeString::operator=(UnicodeString &&src) U_NOEXCEPT {
}
// Same as move assignment except without memory management.
-void UnicodeString::copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) U_NOEXCEPT {
+void UnicodeString::copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) noexcept {
int16_t lengthAndFlags = fUnion.fFields.fLengthAndFlags = src.fUnion.fFields.fLengthAndFlags;
if(lengthAndFlags & kUsingStackBuffer) {
// Short string using the stack buffer, copy the contents.
@@ -601,13 +601,13 @@ void UnicodeString::copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) U_NO
if(setSrcToBogus) {
// Set src to bogus without releasing any memory.
src.fUnion.fFields.fLengthAndFlags = kIsBogus;
- src.fUnion.fFields.fArray = NULL;
+ src.fUnion.fFields.fArray = nullptr;
src.fUnion.fFields.fCapacity = 0;
}
}
}
-void UnicodeString::swap(UnicodeString &other) U_NOEXCEPT {
+void UnicodeString::swap(UnicodeString &other) noexcept {
UnicodeString temp; // Empty short string: Known not to need releaseArray().
// Copy fields without resetting source values in between.
temp.copyFieldsFrom(*this, false);
@@ -626,7 +626,7 @@ UnicodeString UnicodeString::unescape() const {
if (result.isBogus()) {
return result;
}
- const UChar *array = getBuffer();
+ const char16_t *array = getBuffer();
int32_t len = length();
int32_t prev = 0;
for (int32_t i=0;;) {
@@ -662,10 +662,52 @@ UnicodeString::doEquals(const UnicodeString &text, int32_t len) const {
return uprv_memcmp(getArrayStart(), text.getArrayStart(), len * U_SIZEOF_UCHAR) == 0;
}
+UBool
+UnicodeString::doEqualsSubstring( int32_t start,
+ int32_t length,
+ const char16_t *srcChars,
+ int32_t srcStart,
+ int32_t srcLength) const
+{
+ // compare illegal string values
+ if(isBogus()) {
+ return false;
+ }
+
+ // pin indices to legal values
+ pinIndices(start, length);
+
+ if(srcChars == nullptr) {
+ // treat const char16_t *srcChars==nullptr as an empty string
+ return length == 0 ? true : false;
+ }
+
+ // get the correct pointer
+ const char16_t *chars = getArrayStart();
+
+ chars += start;
+ srcChars += srcStart;
+
+ // get the srcLength if necessary
+ if(srcLength < 0) {
+ srcLength = u_strlen(srcChars + srcStart);
+ }
+
+ if (length != srcLength) {
+ return false;
+ }
+
+ if(length == 0 || chars == srcChars) {
+ return true;
+ }
+
+ return u_memcmp(chars, srcChars, srcLength) == 0;
+}
+
int8_t
UnicodeString::doCompare( int32_t start,
int32_t length,
- const UChar *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength) const
{
@@ -677,13 +719,13 @@ UnicodeString::doCompare( int32_t start,
// pin indices to legal values
pinIndices(start, length);
- if(srcChars == NULL) {
- // treat const UChar *srcChars==NULL as an empty string
+ if(srcChars == nullptr) {
+ // treat const char16_t *srcChars==nullptr as an empty string
return length == 0 ? 0 : 1;
}
// get the correct pointer
- const UChar *chars = getArrayStart();
+ const char16_t *chars = getArrayStart();
chars += start;
srcChars += srcStart;
@@ -723,12 +765,12 @@ UnicodeString::doCompare( int32_t start,
# if U_IS_BIG_ENDIAN
// big-endian: byte comparison works
- result = uprv_memcmp(chars, srcChars, minLength * sizeof(UChar));
+ result = uprv_memcmp(chars, srcChars, minLength * sizeof(char16_t));
if(result != 0) {
return (int8_t)(result >> 15 | 1);
}
# else
- // little-endian: compare UChar units
+ // little-endian: compare char16_t units
do {
result = ((int32_t)*(chars++) - (int32_t)*(srcChars++));
if(result != 0) {
@@ -744,12 +786,12 @@ UnicodeString::doCompare( int32_t start,
int8_t
UnicodeString::doCompareCodePointOrder(int32_t start,
int32_t length,
- const UChar *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength) const
{
// compare illegal string values
- // treat const UChar *srcChars==NULL as an empty string
+ // treat const char16_t *srcChars==nullptr as an empty string
if(isBogus()) {
return -1;
}
@@ -757,11 +799,11 @@ UnicodeString::doCompareCodePointOrder(int32_t start,
// pin indices to legal values
pinIndices(start, length);
- if(srcChars == NULL) {
+ if(srcChars == nullptr) {
srcStart = srcLength = 0;
}
- int32_t diff = uprv_strCompare(getArrayStart() + start, length, (srcChars!=NULL)?(srcChars + srcStart):NULL, srcLength, false, true);
+ int32_t diff = uprv_strCompare(getArrayStart() + start, length, (srcChars!=nullptr)?(srcChars + srcStart):nullptr, srcLength, false, true);
/* translate the 32-bit result into an 8-bit one */
if(diff!=0) {
return (int8_t)(diff >> 15 | 1);
@@ -775,7 +817,7 @@ UnicodeString::getLength() const {
return length();
}
-UChar
+char16_t
UnicodeString::getCharAt(int32_t offset) const {
return charAt(offset);
}
@@ -790,7 +832,7 @@ UnicodeString::char32At(int32_t offset) const
{
int32_t len = length();
if((uint32_t)offset < (uint32_t)len) {
- const UChar *array = getArrayStart();
+ const char16_t *array = getArrayStart();
UChar32 c;
U16_GET(array, 0, offset, len, c);
return c;
@@ -802,7 +844,7 @@ UnicodeString::char32At(int32_t offset) const
int32_t
UnicodeString::getChar32Start(int32_t offset) const {
if((uint32_t)offset < (uint32_t)length()) {
- const UChar *array = getArrayStart();
+ const char16_t *array = getArrayStart();
U16_SET_CP_START(array, 0, offset);
return offset;
} else {
@@ -814,7 +856,7 @@ int32_t
UnicodeString::getChar32Limit(int32_t offset) const {
int32_t len = length();
if((uint32_t)offset < (uint32_t)len) {
- const UChar *array = getArrayStart();
+ const char16_t *array = getArrayStart();
U16_SET_CP_LIMIT(array, 0, offset, len);
return offset;
} else {
@@ -825,14 +867,14 @@ UnicodeString::getChar32Limit(int32_t offset) const {
int32_t
UnicodeString::countChar32(int32_t start, int32_t length) const {
pinIndices(start, length);
- // if(isBogus()) then fArray==0 and start==0 - u_countChar32() checks for NULL
+ // if(isBogus()) then fArray==0 and start==0 - u_countChar32() checks for nullptr
return u_countChar32(getArrayStart()+start, length);
}
UBool
UnicodeString::hasMoreChar32Than(int32_t start, int32_t length, int32_t number) const {
pinIndices(start, length);
- // if(isBogus()) then fArray==0 and start==0 - u_strHasMoreChar32Than() checks for NULL
+ // if(isBogus()) then fArray==0 and start==0 - u_strHasMoreChar32Than() checks for nullptr
return u_strHasMoreChar32Than(getArrayStart()+start, length, number);
}
@@ -846,7 +888,7 @@ UnicodeString::moveIndex32(int32_t index, int32_t delta) const {
index=len;
}
- const UChar *array = getArrayStart();
+ const char16_t *array = getArrayStart();
if(delta>0) {
U16_FWD_N(array, index, len, delta);
} else {
@@ -859,14 +901,14 @@ UnicodeString::moveIndex32(int32_t index, int32_t delta) const {
void
UnicodeString::doExtract(int32_t start,
int32_t length,
- UChar *dst,
+ char16_t *dst,
int32_t dstStart) const
{
// pin indices to legal values
pinIndices(start, length);
// do not copy anything if we alias dst itself
- const UChar *array = getArrayStart();
+ const char16_t *array = getArrayStart();
if(array + start != dst + dstStart) {
us_arrayCopy(array, start, dst, dstStart, length);
}
@@ -880,7 +922,7 @@ UnicodeString::extract(Char16Ptr dest, int32_t destCapacity,
if(isBogus() || destCapacity<0 || (destCapacity>0 && dest==0)) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
} else {
- const UChar *array = getArrayStart();
+ const char16_t *array = getArrayStart();
if(len>0 && len<=destCapacity && array!=dest) {
u_memcpy(dest, array, len);
}
@@ -899,7 +941,7 @@ UnicodeString::extract(int32_t start,
enum EInvariant) const
{
// if the arguments are illegal, then do nothing
- if(targetCapacity < 0 || (targetCapacity > 0 && target == NULL)) {
+ if(targetCapacity < 0 || (targetCapacity > 0 && target == nullptr)) {
return 0;
}
@@ -916,9 +958,9 @@ UnicodeString::extract(int32_t start,
UnicodeString
UnicodeString::tempSubString(int32_t start, int32_t len) const {
pinIndices(start, len);
- const UChar *array = getBuffer(); // not getArrayStart() to check kIsBogus & kOpenGetBuffer
- if(array==NULL) {
- array=fUnion.fStackFields.fBuffer; // anything not NULL because that would make an empty string
+ const char16_t *array = getBuffer(); // not getArrayStart() to check kIsBogus & kOpenGetBuffer
+ if(array==nullptr) {
+ array=fUnion.fStackFields.fBuffer; // anything not nullptr because that would make an empty string
len=-2; // bogus result string
}
return UnicodeString(false, array + start, len);
@@ -933,7 +975,7 @@ UnicodeString::toUTF8(int32_t start, int32_t len,
u_strToUTF8WithSub(target, capacity, &length8,
getBuffer() + start, len,
0xFFFD, // Standard substitution character.
- NULL, // Don't care about number of substitutions.
+ nullptr, // Don't care about number of substitutions.
&errorCode);
return length8;
}
@@ -982,17 +1024,17 @@ UnicodeString::toUTF8(ByteSink &sink) const {
u_strToUTF8WithSub(utf8, capacity, &length8,
getBuffer(), length16,
0xFFFD, // Standard substitution character.
- NULL, // Don't care about number of substitutions.
+ nullptr, // Don't care about number of substitutions.
&errorCode);
if(errorCode == U_BUFFER_OVERFLOW_ERROR) {
utf8 = (char *)uprv_malloc(length8);
- if(utf8 != NULL) {
+ if(utf8 != nullptr) {
utf8IsOwned = true;
errorCode = U_ZERO_ERROR;
u_strToUTF8WithSub(utf8, length8, &length8,
getBuffer(), length16,
0xFFFD, // Standard substitution character.
- NULL, // Don't care about number of substitutions.
+ nullptr, // Don't care about number of substitutions.
&errorCode);
} else {
errorCode = U_MEMORY_ALLOCATION_ERROR;
@@ -1016,14 +1058,14 @@ UnicodeString::toUTF32(UChar32 *utf32, int32_t capacity, UErrorCode &errorCode)
u_strToUTF32WithSub(utf32, capacity, &length32,
getBuffer(), length(),
0xfffd, // Substitution character.
- NULL, // Don't care about number of substitutions.
+ nullptr, // Don't care about number of substitutions.
&errorCode);
}
return length32;
}
int32_t
-UnicodeString::indexOf(const UChar *srcChars,
+UnicodeString::indexOf(const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength,
int32_t start,
@@ -1042,9 +1084,9 @@ UnicodeString::indexOf(const UChar *srcChars,
pinIndices(start, length);
// find the first occurrence of the substring
- const UChar *array = getArrayStart();
- const UChar *match = u_strFindFirst(array + start, length, srcChars + srcStart, srcLength);
- if(match == NULL) {
+ const char16_t *array = getArrayStart();
+ const char16_t *match = u_strFindFirst(array + start, length, srcChars + srcStart, srcLength);
+ if(match == nullptr) {
return -1;
} else {
return (int32_t)(match - array);
@@ -1052,7 +1094,7 @@ UnicodeString::indexOf(const UChar *srcChars,
}
int32_t
-UnicodeString::doIndexOf(UChar c,
+UnicodeString::doIndexOf(char16_t c,
int32_t start,
int32_t length) const
{
@@ -1060,9 +1102,9 @@ UnicodeString::doIndexOf(UChar c,
pinIndices(start, length);
// find the first occurrence of c
- const UChar *array = getArrayStart();
- const UChar *match = u_memchr(array + start, c, length);
- if(match == NULL) {
+ const char16_t *array = getArrayStart();
+ const char16_t *match = u_memchr(array + start, c, length);
+ if(match == nullptr) {
return -1;
} else {
return (int32_t)(match - array);
@@ -1077,9 +1119,9 @@ UnicodeString::doIndexOf(UChar32 c,
pinIndices(start, length);
// find the first occurrence of c
- const UChar *array = getArrayStart();
- const UChar *match = u_memchr32(array + start, c, length);
- if(match == NULL) {
+ const char16_t *array = getArrayStart();
+ const char16_t *match = u_memchr32(array + start, c, length);
+ if(match == nullptr) {
return -1;
} else {
return (int32_t)(match - array);
@@ -1087,7 +1129,7 @@ UnicodeString::doIndexOf(UChar32 c,
}
int32_t
-UnicodeString::lastIndexOf(const UChar *srcChars,
+UnicodeString::lastIndexOf(const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength,
int32_t start,
@@ -1106,9 +1148,9 @@ UnicodeString::lastIndexOf(const UChar *srcChars,
pinIndices(start, length);
// find the last occurrence of the substring
- const UChar *array = getArrayStart();
- const UChar *match = u_strFindLast(array + start, length, srcChars + srcStart, srcLength);
- if(match == NULL) {
+ const char16_t *array = getArrayStart();
+ const char16_t *match = u_strFindLast(array + start, length, srcChars + srcStart, srcLength);
+ if(match == nullptr) {
return -1;
} else {
return (int32_t)(match - array);
@@ -1116,7 +1158,7 @@ UnicodeString::lastIndexOf(const UChar *srcChars,
}
int32_t
-UnicodeString::doLastIndexOf(UChar c,
+UnicodeString::doLastIndexOf(char16_t c,
int32_t start,
int32_t length) const
{
@@ -1128,9 +1170,9 @@ UnicodeString::doLastIndexOf(UChar c,
pinIndices(start, length);
// find the last occurrence of c
- const UChar *array = getArrayStart();
- const UChar *match = u_memrchr(array + start, c, length);
- if(match == NULL) {
+ const char16_t *array = getArrayStart();
+ const char16_t *match = u_memrchr(array + start, c, length);
+ if(match == nullptr) {
return -1;
} else {
return (int32_t)(match - array);
@@ -1145,9 +1187,9 @@ UnicodeString::doLastIndexOf(UChar32 c,
pinIndices(start, length);
// find the last occurrence of c
- const UChar *array = getArrayStart();
- const UChar *match = u_memrchr32(array + start, c, length);
- if(match == NULL) {
+ const char16_t *array = getArrayStart();
+ const char16_t *match = u_memrchr32(array + start, c, length);
+ if(match == nullptr) {
return -1;
} else {
return (int32_t)(match - array);
@@ -1220,7 +1262,7 @@ UnicodeString::getTerminatedBuffer() {
if(!isWritable()) {
return nullptr;
}
- UChar *array = getArrayStart();
+ char16_t *array = getArrayStart();
int32_t len = length();
if(len < getCapacity()) {
if(fUnion.fFields.fLengthAndFlags & kBufferIsReadonly) {
@@ -1234,7 +1276,7 @@ UnicodeString::getTerminatedBuffer() {
} else if(((fUnion.fFields.fLengthAndFlags & kRefCounted) == 0 || refCount() == 1)) {
// kRefCounted: Do not write the NUL if the buffer is shared.
// That is mostly safe, except when the length of one copy was modified
- // without copy-on-write, e.g., via truncate(newLength) or remove(void).
+ // without copy-on-write, e.g., via truncate(newLength) or remove().
// Then the NUL would be written into the middle of another copy's string.
// Otherwise, the buffer is fully writable and it is anyway safe to write the NUL.
@@ -1264,8 +1306,8 @@ UnicodeString::setTo(UBool isTerminated,
return *this;
}
- const UChar *text = textPtr;
- if(text == NULL) {
+ const char16_t *text = textPtr;
+ if(text == nullptr) {
// treat as an empty string, do not alias
releaseArray();
setToEmpty();
@@ -1287,13 +1329,13 @@ UnicodeString::setTo(UBool isTerminated,
textLength = u_strlen(text);
}
fUnion.fFields.fLengthAndFlags = kReadonlyAlias;
- setArray((UChar *)text, textLength, isTerminated ? textLength + 1 : textLength);
+ setArray((char16_t *)text, textLength, isTerminated ? textLength + 1 : textLength);
return *this;
}
// setTo() analogous to the writable-aliasing constructor with the same signature
UnicodeString &
-UnicodeString::setTo(UChar *buffer,
+UnicodeString::setTo(char16_t *buffer,
int32_t buffLength,
int32_t buffCapacity) {
if(fUnion.fFields.fLengthAndFlags & kOpenGetBuffer) {
@@ -1301,7 +1343,7 @@ UnicodeString::setTo(UChar *buffer,
return *this;
}
- if(buffer == NULL) {
+ if(buffer == nullptr) {
// treat as an empty string, do not alias
releaseArray();
setToEmpty();
@@ -1313,7 +1355,7 @@ UnicodeString::setTo(UChar *buffer,
return *this;
} else if(buffLength == -1) {
// buffLength = u_strlen(buff); but do not look beyond buffCapacity
- const UChar *p = buffer, *limit = buffer + buffCapacity;
+ const char16_t *p = buffer, *limit = buffer + buffCapacity;
while(p != limit && *p != 0) {
++p;
}
@@ -1337,13 +1379,13 @@ UnicodeString &UnicodeString::setToUTF8(StringPiece utf8) {
} else {
capacity = length + 1; // +1 for the terminating NUL.
}
- UChar *utf16 = getBuffer(capacity);
+ char16_t *utf16 = getBuffer(capacity);
int32_t length16;
UErrorCode errorCode = U_ZERO_ERROR;
u_strFromUTF8WithSub(utf16, getCapacity(), &length16,
utf8.data(), length,
0xfffd, // Substitution character.
- NULL, // Don't care about number of substitutions.
+ nullptr, // Don't care about number of substitutions.
&errorCode);
releaseBuffer(length16);
if(U_FAILURE(errorCode)) {
@@ -1354,7 +1396,7 @@ UnicodeString &UnicodeString::setToUTF8(StringPiece utf8) {
UnicodeString&
UnicodeString::setCharAt(int32_t offset,
- UChar c)
+ char16_t c)
{
int32_t len = length();
if(cloneArrayIfNeeded() && len > 0) {
@@ -1373,7 +1415,7 @@ UnicodeString&
UnicodeString::replace(int32_t start,
int32_t _length,
UChar32 srcChar) {
- UChar buffer[U16_MAX_LENGTH];
+ char16_t buffer[U16_MAX_LENGTH];
int32_t count = 0;
UBool isError = false;
U16_APPEND(buffer, count, U16_MAX_LENGTH, srcChar, isError);
@@ -1385,7 +1427,7 @@ UnicodeString::replace(int32_t start,
UnicodeString&
UnicodeString::append(UChar32 srcChar) {
- UChar buffer[U16_MAX_LENGTH];
+ char16_t buffer[U16_MAX_LENGTH];
int32_t _length = 0;
UBool isError = false;
U16_APPEND(buffer, _length, U16_MAX_LENGTH, srcChar, isError);
@@ -1412,7 +1454,7 @@ UnicodeString::doReplace( int32_t start,
UnicodeString&
UnicodeString::doReplace(int32_t start,
int32_t length,
- const UChar *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength)
{
@@ -1471,7 +1513,7 @@ UnicodeString::doReplace(int32_t start,
newLength += srcLength;
// Check for insertion into ourself
- const UChar *oldArray = getArrayStart();
+ const char16_t *oldArray = getArrayStart();
if (isBufferWritable() &&
oldArray < srcChars + srcLength &&
srcChars < oldArray + oldLength) {
@@ -1486,7 +1528,7 @@ UnicodeString::doReplace(int32_t start,
// cloneArrayIfNeeded(doCopyArray=false) may change fArray but will not copy the current contents;
// therefore we need to keep the current fArray
- UChar oldStackBuffer[US_STACKBUF_SIZE];
+ char16_t oldStackBuffer[US_STACKBUF_SIZE];
if((fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) && (newLength > US_STACKBUF_SIZE)) {
// copy the stack buffer contents because it will be overwritten with
// fUnion.fFields values
@@ -1504,7 +1546,7 @@ UnicodeString::doReplace(int32_t start,
// now do the replace
- UChar *newArray = getArrayStart();
+ char16_t *newArray = getArrayStart();
if(newArray != oldArray) {
// if fArray changed, then we need to copy everything except what will change
us_arrayCopy(oldArray, 0, newArray, 0, start);
@@ -1547,8 +1589,8 @@ UnicodeString::doAppend(const UnicodeString& src, int32_t srcStart, int32_t srcL
}
UnicodeString&
-UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLength) {
- if(!isWritable() || srcLength == 0 || srcChars == NULL) {
+UnicodeString::doAppend(const char16_t *srcChars, int32_t srcStart, int32_t srcLength) {
+ if(!isWritable() || srcLength == 0 || srcChars == nullptr) {
return *this;
}
@@ -1571,7 +1613,7 @@ UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLeng
}
// Check for append onto ourself
- const UChar* oldArray = getArrayStart();
+ const char16_t* oldArray = getArrayStart();
if (isBufferWritable() &&
oldArray < srcChars + srcLength &&
srcChars < oldArray + oldLength) {
@@ -1587,9 +1629,9 @@ UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLeng
// optimize append() onto a large-enough, owned string
if((newLength <= getCapacity() && isBufferWritable()) ||
cloneArrayIfNeeded(newLength, getGrowCapacity(newLength))) {
- UChar *newArray = getArrayStart();
+ char16_t *newArray = getArrayStart();
// Do not copy characters when
- // UChar *buffer=str.getAppendBuffer(...);
+ // char16_t *buffer=str.getAppendBuffer(...);
// is followed by
// str.append(buffer, length);
// or
@@ -1621,9 +1663,9 @@ UnicodeString::copy(int32_t start, int32_t limit, int32_t dest) {
if (limit <= start) {
return; // Nothing to do; avoid bogus malloc call
}
- UChar* text = (UChar*) uprv_malloc( sizeof(UChar) * (limit - start) );
+ char16_t* text = (char16_t*) uprv_malloc( sizeof(char16_t) * (limit - start) );
// Check to make sure text is not null.
- if (text != NULL) {
+ if (text != nullptr) {
extractBetween(start, limit, text, 0);
insert(dest, text, 0, limit - start);
uprv_free(text);
@@ -1659,9 +1701,9 @@ UnicodeString::doReverse(int32_t start, int32_t length) {
return *this;
}
- UChar *left = getArrayStart() + start;
- UChar *right = left + length - 1; // -1 for inclusive boundary (length>=2)
- UChar swap;
+ char16_t *left = getArrayStart() + start;
+ char16_t *right = left + length - 1; // -1 for inclusive boundary (length>=2)
+ char16_t swap;
UBool hasSupplementary = false;
// Before the loop we know left<right because length>=2.
@@ -1676,7 +1718,7 @@ UnicodeString::doReverse(int32_t start, int32_t length) {
/* if there are supplementary code points in the reversed range, then re-swap their surrogates */
if(hasSupplementary) {
- UChar swap2;
+ char16_t swap2;
left = getArrayStart() + start;
right = left + length - 1; // -1 so that we can look at *(left+1) if left<right
@@ -1695,14 +1737,14 @@ UnicodeString::doReverse(int32_t start, int32_t length) {
UBool
UnicodeString::padLeading(int32_t targetLength,
- UChar padChar)
+ char16_t padChar)
{
int32_t oldLength = length();
if(oldLength >= targetLength || !cloneArrayIfNeeded(targetLength)) {
return false;
} else {
// move contents up by padding width
- UChar *array = getArrayStart();
+ char16_t *array = getArrayStart();
int32_t start = targetLength - oldLength;
us_arrayCopy(array, 0, array, start, oldLength);
@@ -1717,14 +1759,14 @@ UnicodeString::padLeading(int32_t targetLength,
UBool
UnicodeString::padTrailing(int32_t targetLength,
- UChar padChar)
+ char16_t padChar)
{
int32_t oldLength = length();
if(oldLength >= targetLength || !cloneArrayIfNeeded(targetLength)) {
return false;
} else {
// fill in padding character
- UChar *array = getArrayStart();
+ char16_t *array = getArrayStart();
int32_t length = targetLength;
while(--length >= oldLength) {
array[length] = padChar;
@@ -1741,7 +1783,7 @@ int32_t
UnicodeString::doHashCode() const
{
/* Delegate hash computation to uhash. This makes UnicodeString
- * hashing consistent with UChar* hashing. */
+ * hashing consistent with char16_t* hashing. */
int32_t hashCode = ustr_hashUCharsN(getArrayStart(), length());
if (hashCode == kInvalidHashCode) {
hashCode = kEmptyHashCode;
@@ -1771,7 +1813,7 @@ UnicodeString::releaseBuffer(int32_t newLength) {
int32_t capacity=getCapacity();
if(newLength==-1) {
// the new length is the string length, capped by fCapacity
- const UChar *array=getArrayStart(), *p=array, *limit=array+capacity;
+ const char16_t *array=getArrayStart(), *p=array, *limit=array+capacity;
while(p<limit && *p!=0) {
++p;
}
@@ -1826,8 +1868,8 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity,
}
// save old values
- UChar oldStackBuffer[US_STACKBUF_SIZE];
- UChar *oldArray;
+ char16_t oldStackBuffer[US_STACKBUF_SIZE];
+ char16_t *oldArray;
int32_t oldLength = length();
int16_t flags = fUnion.fFields.fLengthAndFlags;
@@ -1839,11 +1881,11 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity,
us_arrayCopy(fUnion.fStackFields.fBuffer, 0, oldStackBuffer, 0, oldLength);
oldArray = oldStackBuffer;
} else {
- oldArray = NULL; // no need to copy from the stack buffer to itself
+ oldArray = nullptr; // no need to copy from the stack buffer to itself
}
} else {
oldArray = fUnion.fFields.fArray;
- U_ASSERT(oldArray!=NULL); /* when stack buffer is not used, oldArray must have a non-NULL reference */
+ U_ASSERT(oldArray!=nullptr); /* when stack buffer is not used, oldArray must have a non-nullptr reference */
}
// allocate a new array
@@ -1858,7 +1900,7 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity,
if(newCapacity < minLength) {
minLength = newCapacity;
}
- if(oldArray != NULL) {
+ if(oldArray != nullptr) {
us_arrayCopy(oldArray, 0, getArrayStart(), 0, minLength);
}
setLength(minLength);
@@ -1901,13 +1943,13 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity,
UnicodeStringAppendable::~UnicodeStringAppendable() {}
UBool
-UnicodeStringAppendable::appendCodeUnit(UChar c) {
+UnicodeStringAppendable::appendCodeUnit(char16_t c) {
return str.doAppend(&c, 0, 1).isWritable();
}
UBool
UnicodeStringAppendable::appendCodePoint(UChar32 c) {
- UChar buffer[U16_MAX_LENGTH];
+ char16_t buffer[U16_MAX_LENGTH];
int32_t cLength = 0;
UBool isError = false;
U16_APPEND(buffer, cLength, U16_MAX_LENGTH, c, isError);
@@ -1915,7 +1957,7 @@ UnicodeStringAppendable::appendCodePoint(UChar32 c) {
}
UBool
-UnicodeStringAppendable::appendString(const UChar *s, int32_t length) {
+UnicodeStringAppendable::appendString(const char16_t *s, int32_t length) {
return str.doAppend(s, 0, length).isWritable();
}
@@ -1924,14 +1966,14 @@ UnicodeStringAppendable::reserveAppendCapacity(int32_t appendCapacity) {
return str.cloneArrayIfNeeded(str.length() + appendCapacity);
}
-UChar *
+char16_t *
UnicodeStringAppendable::getAppendBuffer(int32_t minCapacity,
int32_t desiredCapacityHint,
- UChar *scratch, int32_t scratchCapacity,
+ char16_t *scratch, int32_t scratchCapacity,
int32_t *resultCapacity) {
if(minCapacity < 1 || scratchCapacity < minCapacity) {
*resultCapacity = 0;
- return NULL;
+ return nullptr;
}
int32_t oldLength = str.length();
if(minCapacity <= (kMaxCapacity - oldLength) &&
@@ -1951,7 +1993,7 @@ U_NAMESPACE_USE
U_CAPI int32_t U_EXPORT2
uhash_hashUnicodeString(const UElement key) {
const UnicodeString *str = (const UnicodeString*) key.pointer;
- return (str == NULL) ? 0 : str->hashCode();
+ return (str == nullptr) ? 0 : str->hashCode();
}
// Moved here from uhash_us.cpp so that using a UVector of UnicodeString*
@@ -1963,7 +2005,7 @@ uhash_compareUnicodeString(const UElement key1, const UElement key2) {
if (str1 == str2) {
return true;
}
- if (str1 == NULL || str2 == NULL) {
+ if (str1 == nullptr || str2 == nullptr) {
return false;
}
return *str1 == *str2;
@@ -1980,7 +2022,7 @@ This makes sure that static library dependencies are kept to a minimum.
#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 1100
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
-static void uprv_UnicodeStringDummy(void) {
+static void uprv_UnicodeStringDummy() {
delete [] (new UnicodeString[2]);
}
#pragma GCC diagnostic pop
diff --git a/thirdparty/icu4c/common/unistr_case.cpp b/thirdparty/icu4c/common/unistr_case.cpp
index f4c43b4889..57f307c203 100644
--- a/thirdparty/icu4c/common/unistr_case.cpp
+++ b/thirdparty/icu4c/common/unistr_case.cpp
@@ -41,13 +41,13 @@ U_NAMESPACE_BEGIN
int8_t
UnicodeString::doCaseCompare(int32_t start,
int32_t length,
- const UChar *srcChars,
+ const char16_t *srcChars,
int32_t srcStart,
int32_t srcLength,
uint32_t options) const
{
// compare illegal string values
- // treat const UChar *srcChars==NULL as an empty string
+ // treat const char16_t *srcChars==nullptr as an empty string
if(isBogus()) {
return -1;
}
@@ -55,12 +55,12 @@ UnicodeString::doCaseCompare(int32_t start,
// pin indices to legal values
pinIndices(start, length);
- if(srcChars == NULL) {
+ if(srcChars == nullptr) {
srcStart = srcLength = 0;
}
// get the correct pointer
- const UChar *chars = getArrayStart();
+ const char16_t *chars = getArrayStart();
chars += start;
if(srcStart!=0) {
@@ -98,8 +98,8 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER
return *this;
}
- UChar oldBuffer[2 * US_STACKBUF_SIZE];
- UChar *oldArray;
+ char16_t oldBuffer[2 * US_STACKBUF_SIZE];
+ char16_t *oldArray;
int32_t oldLength = length();
int32_t newLength;
UBool writable = isBufferWritable();
@@ -115,7 +115,7 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER
if (writable ? oldLength <= UPRV_LENGTHOF(oldBuffer) : oldLength < US_STACKBUF_SIZE) {
// Short string: Copy the contents into a temporary buffer and
// case-map back into the current array, or into the stack buffer.
- UChar *buffer = getArrayStart();
+ char16_t *buffer = getArrayStart();
int32_t capacity;
oldArray = oldBuffer;
u_memcpy(oldBuffer, buffer, oldLength);
@@ -138,7 +138,7 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER
#endif
newLength = stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR
buffer, capacity,
- oldArray, oldLength, NULL, errorCode);
+ oldArray, oldLength, nullptr, errorCode);
if (U_SUCCESS(errorCode)) {
setLength(newLength);
return *this;
@@ -155,7 +155,7 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER
// and often does not change its length.
oldArray = getArrayStart();
Edits edits;
- UChar replacementChars[200];
+ char16_t replacementChars[200];
#if !UCONFIG_NO_BREAK_ITERATION
if (iter != nullptr) {
oldString.setTo(false, oldArray, oldLength);
@@ -201,7 +201,7 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER
// No need to iter->setText() again: The case mapper restarts via iter->first().
newLength = stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR
getArrayStart(), getCapacity(),
- oldArray, oldLength, NULL, errorCode);
+ oldArray, oldLength, nullptr, errorCode);
if (bufferToDelete) {
uprv_free(bufferToDelete);
}
@@ -225,7 +225,7 @@ U_CAPI int32_t U_EXPORT2
uhash_hashCaselessUnicodeString(const UElement key) {
U_NAMESPACE_USE
const UnicodeString *str = (const UnicodeString*) key.pointer;
- if (str == NULL) {
+ if (str == nullptr) {
return 0;
}
// Inefficient; a better way would be to have a hash function in
@@ -243,7 +243,7 @@ uhash_compareCaselessUnicodeString(const UElement key1, const UElement key2) {
if (str1 == str2) {
return true;
}
- if (str1 == NULL || str2 == NULL) {
+ if (str1 == nullptr || str2 == nullptr) {
return false;
}
return str1->caseCompare(*str2, U_FOLD_CASE_DEFAULT) == 0;
diff --git a/thirdparty/icu4c/common/unistr_case_locale.cpp b/thirdparty/icu4c/common/unistr_case_locale.cpp
index f0f3048d06..8b6a9ca0ca 100644
--- a/thirdparty/icu4c/common/unistr_case_locale.cpp
+++ b/thirdparty/icu4c/common/unistr_case_locale.cpp
@@ -31,7 +31,7 @@ U_NAMESPACE_BEGIN
UnicodeString &
UnicodeString::toLower() {
- return caseMap(ustrcase_getCaseLocale(NULL), 0,
+ return caseMap(ustrcase_getCaseLocale(nullptr), 0,
UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToLower);
}
@@ -43,7 +43,7 @@ UnicodeString::toLower(const Locale &locale) {
UnicodeString &
UnicodeString::toUpper() {
- return caseMap(ustrcase_getCaseLocale(NULL), 0,
+ return caseMap(ustrcase_getCaseLocale(nullptr), 0,
UCASEMAP_BREAK_ITERATOR_NULL ustrcase_internalToUpper);
}
diff --git a/thirdparty/icu4c/common/unistr_cnv.cpp b/thirdparty/icu4c/common/unistr_cnv.cpp
index e1f60d4487..2d649b2d51 100644
--- a/thirdparty/icu4c/common/unistr_cnv.cpp
+++ b/thirdparty/icu4c/common/unistr_cnv.cpp
@@ -82,7 +82,7 @@ UnicodeString::UnicodeString(const char *src, int32_t srcLength,
fUnion.fFields.fLengthAndFlags = kShortString;
if(U_SUCCESS(errorCode)) {
// check arguments
- if(src==NULL) {
+ if(src==nullptr) {
// treat as an empty string, do nothing more
} else if(srcLength<-1) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
@@ -259,7 +259,7 @@ UnicodeString::doExtract(int32_t start, int32_t length,
return 0;
}
- const UChar *src=getArrayStart()+start, *srcLimit=src+length;
+ const char16_t *src=getArrayStart()+start, *srcLimit=src+length;
char *originalDest=dest;
const char *destLimit;
@@ -366,7 +366,7 @@ UnicodeString::doCodepageCreate(const char *codepageData,
// set up the conversion parameters
const char *mySource = codepageData;
const char *mySourceEnd = mySource + dataLength;
- UChar *array, *myTarget;
+ char16_t *array, *myTarget;
// estimate the size needed:
int32_t arraySize;
@@ -374,7 +374,7 @@ UnicodeString::doCodepageCreate(const char *codepageData,
// try to use the stack buffer
arraySize = US_STACKBUF_SIZE;
} else {
- // 1.25 UChar's per source byte should cover most cases
+ // 1.25 char16_t's per source byte should cover most cases
arraySize = dataLength + (dataLength >> 2);
}
@@ -404,7 +404,7 @@ UnicodeString::doCodepageCreate(const char *codepageData,
doCopyArray = true;
// estimate the new size needed, larger than before
- // try 2 UChar's per remaining source byte
+ // try 2 char16_t's per remaining source byte
arraySize = (int32_t)(length() + 2 * (mySourceEnd - mySource));
} else {
break;
diff --git a/thirdparty/icu4c/common/unistr_props.cpp b/thirdparty/icu4c/common/unistr_props.cpp
index 4006475790..3d05233bb9 100644
--- a/thirdparty/icu4c/common/unistr_props.cpp
+++ b/thirdparty/icu4c/common/unistr_props.cpp
@@ -32,7 +32,7 @@ UnicodeString::trim()
return *this;
}
- UChar *array = getArrayStart();
+ char16_t *array = getArrayStart();
UChar32 c;
int32_t oldLength = this->length();
int32_t i = oldLength, length;
diff --git a/thirdparty/icu4c/common/unistrappender.h b/thirdparty/icu4c/common/unistrappender.h
index 75fcb9e775..ac49b5f2f9 100644
--- a/thirdparty/icu4c/common/unistrappender.h
+++ b/thirdparty/icu4c/common/unistrappender.h
@@ -31,7 +31,7 @@ U_NAMESPACE_BEGIN
* {
* UnicodeStringAppender appender(astring);
* for (int32_t i = 0; i < 100; ++i) {
- * appender.append((UChar) i);
+ * appender.append((char16_t) i);
* }
* // appender flushed automatically when it goes out of scope.
* }
@@ -45,7 +45,7 @@ public:
*/
UnicodeStringAppender(UnicodeString &dest) : fDest(&dest), fIdx(0) { }
- inline void append(UChar x) {
+ inline void append(char16_t x) {
if (fIdx == UPRV_LENGTHOF(fBuffer)) {
fDest->append(fBuffer, 0, fIdx);
fIdx = 0;
@@ -80,7 +80,7 @@ public:
private:
UnicodeString *fDest;
int32_t fIdx;
- UChar fBuffer[32];
+ char16_t fBuffer[32];
UnicodeStringAppender(const UnicodeStringAppender &other);
UnicodeStringAppender &operator=(const UnicodeStringAppender &other);
};
diff --git a/thirdparty/icu4c/common/unorm.cpp b/thirdparty/icu4c/common/unorm.cpp
index cf3915c27f..f2ef7fa664 100644
--- a/thirdparty/icu4c/common/unorm.cpp
+++ b/thirdparty/icu4c/common/unorm.cpp
@@ -44,7 +44,7 @@ U_NAMESPACE_USE
/* quick check functions ---------------------------------------------------- */
U_CAPI UNormalizationCheckResult U_EXPORT2
-unorm_quickCheck(const UChar *src,
+unorm_quickCheck(const char16_t *src,
int32_t srcLength,
UNormalizationMode mode,
UErrorCode *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 char16_t *src, int32_t srcLength,
UNormalizationMode mode, int32_t options,
UErrorCode *pErrorCode) {
const Normalizer2 *n2=Normalizer2Factory::getInstance(mode, *pErrorCode);
@@ -68,7 +68,7 @@ unorm_quickCheckWithOptions(const UChar *src, int32_t srcLength,
}
U_CAPI UBool U_EXPORT2
-unorm_isNormalized(const UChar *src, int32_t srcLength,
+unorm_isNormalized(const char16_t *src, int32_t srcLength,
UNormalizationMode mode,
UErrorCode *pErrorCode) {
const Normalizer2 *n2=Normalizer2Factory::getInstance(mode, *pErrorCode);
@@ -76,7 +76,7 @@ unorm_isNormalized(const UChar *src, int32_t srcLength,
}
U_CAPI UBool U_EXPORT2
-unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength,
+unorm_isNormalizedWithOptions(const char16_t *src, int32_t srcLength,
UNormalizationMode mode, int32_t options,
UErrorCode *pErrorCode) {
const Normalizer2 *n2=Normalizer2Factory::getInstance(mode, *pErrorCode);
@@ -94,9 +94,9 @@ unorm_isNormalizedWithOptions(const UChar *src, int32_t srcLength,
/** Public API for normalizing. */
U_CAPI int32_t U_EXPORT2
-unorm_normalize(const UChar *src, int32_t srcLength,
+unorm_normalize(const char16_t *src, int32_t srcLength,
UNormalizationMode mode, int32_t options,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UErrorCode *pErrorCode) {
const Normalizer2 *n2=Normalizer2Factory::getInstance(mode, *pErrorCode);
if(options&UNORM_UNICODE_3_2) {
@@ -115,19 +115,19 @@ unorm_normalize(const UChar *src, int32_t srcLength,
static int32_t
_iterate(UCharIterator *src, UBool forward,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
const Normalizer2 *n2,
UBool doNormalize, UBool *pNeededToNormalize,
UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
return 0;
}
- if(destCapacity<0 || (dest==NULL && destCapacity>0) || src==NULL) {
+ if(destCapacity<0 || (dest==nullptr && destCapacity>0) || src==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
- if(pNeededToNormalize!=NULL) {
+ if(pNeededToNormalize!=nullptr) {
*pNeededToNormalize=false;
}
if(!(forward ? src->hasNext(src) : src->hasPrevious(src))) {
@@ -163,7 +163,7 @@ _iterate(UCharIterator *src, UBool forward,
UnicodeString destString(dest, 0, destCapacity);
if(buffer.length()>0 && doNormalize) {
n2->normalize(buffer, destString, *pErrorCode).extract(dest, destCapacity, *pErrorCode);
- if(pNeededToNormalize!=NULL && U_SUCCESS(*pErrorCode)) {
+ if(pNeededToNormalize!=nullptr && U_SUCCESS(*pErrorCode)) {
*pNeededToNormalize= destString!=buffer;
}
return destString.length();
@@ -175,7 +175,7 @@ _iterate(UCharIterator *src, UBool forward,
static int32_t
unorm_iterate(UCharIterator *src, UBool forward,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UNormalizationMode mode, int32_t options,
UBool doNormalize, UBool *pNeededToNormalize,
UErrorCode *pErrorCode) {
@@ -195,7 +195,7 @@ unorm_iterate(UCharIterator *src, UBool forward,
U_CAPI int32_t U_EXPORT2
unorm_previous(UCharIterator *src,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UNormalizationMode mode, int32_t options,
UBool doNormalize, UBool *pNeededToNormalize,
UErrorCode *pErrorCode) {
@@ -208,7 +208,7 @@ unorm_previous(UCharIterator *src,
U_CAPI int32_t U_EXPORT2
unorm_next(UCharIterator *src,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UNormalizationMode mode, int32_t options,
UBool doNormalize, UBool *pNeededToNormalize,
UErrorCode *pErrorCode) {
@@ -222,22 +222,22 @@ unorm_next(UCharIterator *src,
/* Concatenation of normalized strings -------------------------------------- */
static int32_t
-_concatenate(const UChar *left, int32_t leftLength,
- const UChar *right, int32_t rightLength,
- UChar *dest, int32_t destCapacity,
+_concatenate(const char16_t *left, int32_t leftLength,
+ const char16_t *right, int32_t rightLength,
+ char16_t *dest, int32_t destCapacity,
const Normalizer2 *n2,
UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
return 0;
}
- if(destCapacity<0 || (dest==NULL && destCapacity>0) ||
- left==NULL || leftLength<-1 || right==NULL || rightLength<-1) {
+ if(destCapacity<0 || (dest==nullptr && destCapacity>0) ||
+ left==nullptr || leftLength<-1 || right==nullptr || rightLength<-1) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
/* check for overlapping right and destination */
- if( dest!=NULL &&
+ if( dest!=nullptr &&
((right>=dest && right<(dest+destCapacity)) ||
(rightLength>0 && dest>=right && dest<(right+rightLength)))
) {
@@ -258,9 +258,9 @@ _concatenate(const UChar *left, int32_t leftLength,
}
U_CAPI int32_t U_EXPORT2
-unorm_concatenate(const UChar *left, int32_t leftLength,
- const UChar *right, int32_t rightLength,
- UChar *dest, int32_t destCapacity,
+unorm_concatenate(const char16_t *left, int32_t leftLength,
+ const char16_t *right, int32_t rightLength,
+ char16_t *dest, int32_t destCapacity,
UNormalizationMode mode, int32_t options,
UErrorCode *pErrorCode) {
const Normalizer2 *n2=Normalizer2Factory::getInstance(mode, *pErrorCode);
diff --git a/thirdparty/icu4c/common/unormcmp.cpp b/thirdparty/icu4c/common/unormcmp.cpp
index e224190972..e11e716c8d 100644
--- a/thirdparty/icu4c/common/unormcmp.cpp
+++ b/thirdparty/icu4c/common/unormcmp.cpp
@@ -128,7 +128,7 @@ U_NAMESPACE_USE
/* stack element for previous-level source/decomposition pointers */
struct CmpEquivLevel {
- const UChar *start, *s, *limit;
+ const char16_t *start, *s, *limit;
};
typedef struct CmpEquivLevel CmpEquivLevel;
@@ -140,27 +140,27 @@ typedef struct CmpEquivLevel CmpEquivLevel;
/* internal function */
static int32_t
-unorm_cmpEquivFold(const UChar *s1, int32_t length1,
- const UChar *s2, int32_t length2,
+unorm_cmpEquivFold(const char16_t *s1, int32_t length1,
+ const char16_t *s2, int32_t length2,
uint32_t options,
UErrorCode *pErrorCode) {
const Normalizer2Impl *nfcImpl;
/* current-level start/limit - s1/s2 as current */
- const UChar *start1, *start2, *limit1, *limit2;
+ const char16_t *start1, *start2, *limit1, *limit2;
/* decomposition and case folding variables */
- const UChar *p;
+ const char16_t *p;
int32_t length;
/* stacks of previous-level start/current/limit */
CmpEquivLevel stack1[2], stack2[2];
/* buffers for algorithmic decompositions */
- UChar decomp1[4], decomp2[4];
+ char16_t decomp1[4], decomp2[4];
/* case folding buffers, only use current-level start/limit */
- UChar fold1[UCASE_MAX_STRING_LENGTH+1], fold2[UCASE_MAX_STRING_LENGTH+1];
+ char16_t fold1[UCASE_MAX_STRING_LENGTH+1], fold2[UCASE_MAX_STRING_LENGTH+1];
/* track which is the current level per string */
int32_t level1, level2;
@@ -180,7 +180,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
if((options&_COMPARE_EQUIV)!=0) {
nfcImpl=Normalizer2Factory::getNFCImpl(*pErrorCode);
} else {
- nfcImpl=NULL;
+ nfcImpl=nullptr;
}
if(U_FAILURE(*pErrorCode)) {
return 0;
@@ -189,14 +189,14 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
/* initialize */
start1=s1;
if(length1==-1) {
- limit1=NULL;
+ limit1=nullptr;
} else {
limit1=s1+length1;
}
start2=s2;
if(length2==-1) {
- limit2=NULL;
+ limit2=nullptr;
} else {
limit2=s2+length2;
}
@@ -214,7 +214,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
if(c1<0) {
/* get next code unit from string 1, post-increment */
for(;;) {
- if(s1==limit1 || ((c1=*s1)==0 && (limit1==NULL || (options&_STRNCMP_STYLE)))) {
+ if(s1==limit1 || ((c1=*s1)==0 && (limit1==nullptr || (options&_STRNCMP_STYLE)))) {
if(level1==0) {
c1=-1;
break;
@@ -228,7 +228,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
do {
--level1;
start1=stack1[level1].start; /*Not uninitialized*/
- } while(start1==NULL);
+ } while(start1==nullptr);
s1=stack1[level1].s; /*Not uninitialized*/
limit1=stack1[level1].limit; /*Not uninitialized*/
}
@@ -237,7 +237,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
if(c2<0) {
/* get next code unit from string 2, post-increment */
for(;;) {
- if(s2==limit2 || ((c2=*s2)==0 && (limit2==NULL || (options&_STRNCMP_STYLE)))) {
+ if(s2==limit2 || ((c2=*s2)==0 && (limit2==nullptr || (options&_STRNCMP_STYLE)))) {
if(level2==0) {
c2=-1;
break;
@@ -251,7 +251,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
do {
--level2;
start2=stack2[level2].start; /*Not uninitialized*/
- } while(start2==NULL);
+ } while(start2==nullptr);
s2=stack2[level2].s; /*Not uninitialized*/
limit2=stack2[level2].limit; /*Not uninitialized*/
}
@@ -277,7 +277,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
/* get complete code points for c1, c2 for lookups if either is a surrogate */
cp1=c1;
if(U_IS_SURROGATE(c1)) {
- UChar c;
+ char16_t c;
if(U_IS_SURROGATE_LEAD(c1)) {
if(s1!=limit1 && U16_IS_TRAIL(c=*s1)) {
@@ -293,7 +293,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
cp2=c2;
if(U_IS_SURROGATE(c2)) {
- UChar c;
+ char16_t c;
if(U_IS_SURROGATE_LEAD(c2)) {
if(s2!=limit2 && U16_IS_TRAIL(c=*s2)) {
@@ -431,7 +431,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
/* set empty intermediate level if skipped */
if(level1<2) {
- stack1[level1++].start=NULL;
+ stack1[level1++].start=nullptr;
}
/* set next level pointers to decomposition */
@@ -472,7 +472,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
/* set empty intermediate level if skipped */
if(level2<2) {
- stack2[level2++].start=NULL;
+ stack2[level2++].start=nullptr;
}
/* set next level pointers to decomposition */
@@ -529,7 +529,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
}
static
-UBool _normalize(const Normalizer2 *n2, const UChar *s, int32_t length,
+UBool _normalize(const Normalizer2 *n2, const char16_t *s, int32_t length,
UnicodeString &normalized, UErrorCode *pErrorCode) {
UnicodeString str(length<0, s, length);
@@ -558,8 +558,8 @@ UBool _normalize(const Normalizer2 *n2, const UChar *s, int32_t length,
}
U_CAPI int32_t U_EXPORT2
-unorm_compare(const UChar *s1, int32_t length1,
- const UChar *s2, int32_t length2,
+unorm_compare(const char16_t *s1, int32_t length1,
+ const char16_t *s2, int32_t length2,
uint32_t options,
UErrorCode *pErrorCode) {
/* argument checking */
diff --git a/thirdparty/icu4c/common/unormimp.h b/thirdparty/icu4c/common/unormimp.h
index d2604adb4a..f107eac67f 100644
--- a/thirdparty/icu4c/common/unormimp.h
+++ b/thirdparty/icu4c/common/unormimp.h
@@ -388,7 +388,7 @@ enum {
*
* Strings are either stored as a single code unit or as the length
* followed by that many units.
- * const UChar *s=extraData+(index from auxTrie data bits 9..0);
+ * const char16_t *s=extraData+(index from auxTrie data bits 9..0);
* int32_t length;
* if(*s<0xff00) {
* // s points to the single-unit string
diff --git a/thirdparty/icu4c/common/uobject.cpp b/thirdparty/icu4c/common/uobject.cpp
index e222b2ce9b..c9e435ceca 100644
--- a/thirdparty/icu4c/common/uobject.cpp
+++ b/thirdparty/icu4c/common/uobject.cpp
@@ -58,32 +58,32 @@ U_NAMESPACE_BEGIN
* and replace with uprv_malloc/uprv_free.
*/
-void * U_EXPORT2 UMemory::operator new(size_t size) U_NOEXCEPT {
+void * U_EXPORT2 UMemory::operator new(size_t size) noexcept {
return uprv_malloc(size);
}
-void U_EXPORT2 UMemory::operator delete(void *p) U_NOEXCEPT {
- if(p!=NULL) {
+void U_EXPORT2 UMemory::operator delete(void *p) noexcept {
+ if(p!=nullptr) {
uprv_free(p);
}
}
-void * U_EXPORT2 UMemory::operator new[](size_t size) U_NOEXCEPT {
+void * U_EXPORT2 UMemory::operator new[](size_t size) noexcept {
return uprv_malloc(size);
}
-void U_EXPORT2 UMemory::operator delete[](void *p) U_NOEXCEPT {
- if(p!=NULL) {
+void U_EXPORT2 UMemory::operator delete[](void *p) noexcept {
+ if(p!=nullptr) {
uprv_free(p);
}
}
#if U_HAVE_DEBUG_LOCATION_NEW
-void * U_EXPORT2 UMemory::operator new(size_t size, const char* /*file*/, int /*line*/) U_NOEXCEPT {
+void * U_EXPORT2 UMemory::operator new(size_t size, const char* /*file*/, int /*line*/) noexcept {
return UMemory::operator new(size);
}
-void U_EXPORT2 UMemory::operator delete(void* p, const char* /*file*/, int /*line*/) U_NOEXCEPT {
+void U_EXPORT2 UMemory::operator delete(void* p, const char* /*file*/, int /*line*/) noexcept {
UMemory::operator delete(p);
}
#endif /* U_HAVE_DEBUG_LOCATION_NEW */
@@ -93,7 +93,7 @@ void U_EXPORT2 UMemory::operator delete(void* p, const char* /*file*/, int /*lin
UObject::~UObject() {}
-UClassID UObject::getDynamicClassID() const { return NULL; }
+UClassID UObject::getDynamicClassID() const { return nullptr; }
U_NAMESPACE_END
diff --git a/thirdparty/icu4c/common/uposixdefs.h b/thirdparty/icu4c/common/uposixdefs.h
index 23c3f6d466..826c9bb47a 100644
--- a/thirdparty/icu4c/common/uposixdefs.h
+++ b/thirdparty/icu4c/common/uposixdefs.h
@@ -48,7 +48,7 @@
#endif
/*
- * Make sure things like readlink and such functions work.
+ * Make sure things like realpath and such functions work.
* Poorly upgraded Solaris machines can't have this defined.
* Cleanly installed Solaris can use this #define.
*
diff --git a/thirdparty/icu4c/common/uprops.cpp b/thirdparty/icu4c/common/uprops.cpp
index 26e950b876..28540186c6 100644
--- a/thirdparty/icu4c/common/uprops.cpp
+++ b/thirdparty/icu4c/common/uprops.cpp
@@ -241,11 +241,11 @@ static UBool changesWhenCasefolded(const BinaryProperty &/*prop*/, UChar32 c, UP
}
if(c>=0) {
/* single code point */
- const UChar *resultString;
+ const char16_t *resultString;
return (UBool)(ucase_toFullFolding(c, &resultString, U_FOLD_CASE_DEFAULT)>=0);
} else {
/* guess some large but stack-friendly capacity */
- UChar dest[2*UCASE_MAX_STRING_LENGTH];
+ char16_t dest[2*UCASE_MAX_STRING_LENGTH];
int32_t destLength;
destLength=u_strFoldCase(dest, UPRV_LENGTHOF(dest),
nfd.getBuffer(), nfd.length(),
@@ -276,7 +276,7 @@ static UBool changesWhenNFKC_Casefolded(const BinaryProperty &/*prop*/, UChar32
ReorderingBuffer buffer(*kcf, dest);
// Small destCapacity for NFKC_CF(c).
if(buffer.init(5, errorCode)) {
- const UChar *srcArray=src.getBuffer();
+ const char16_t *srcArray=src.getBuffer();
kcf->compose(srcArray, srcArray+src.length(), false,
true, buffer, errorCode);
}
@@ -423,8 +423,21 @@ u_hasBinaryProperty(UChar32 c, UProperty which) {
}
}
+/* Checks if the Unicode character can start a Unicode identifier.*/
U_CAPI UBool U_EXPORT2
-u_stringHasBinaryProperty(const UChar *s, int32_t length, UProperty which) {
+u_isIDStart(UChar32 c) {
+ return u_hasBinaryProperty(c, UCHAR_ID_START);
+}
+
+/* Checks if the Unicode character can be a Unicode identifier part other than starting the
+ identifier.*/
+U_CAPI UBool U_EXPORT2
+u_isIDPart(UChar32 c) {
+ return u_hasBinaryProperty(c, UCHAR_ID_CONTINUE);
+}
+
+U_CAPI UBool U_EXPORT2
+u_stringHasBinaryProperty(const char16_t *s, int32_t length, UProperty which) {
if (s == nullptr && length != 0) { return false; }
if (length == 1) {
return u_hasBinaryProperty(s[0], which); // single code point
@@ -780,11 +793,11 @@ uprops_addPropertyStarts(UPropertySource src, const USetAdder *sa, UErrorCode *p
#if !UCONFIG_NO_NORMALIZATION
U_CAPI int32_t U_EXPORT2
-u_getFC_NFKC_Closure(UChar32 c, UChar *dest, int32_t destCapacity, UErrorCode *pErrorCode) {
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+u_getFC_NFKC_Closure(UChar32 c, char16_t *dest, int32_t destCapacity, UErrorCode *pErrorCode) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(destCapacity<0 || (dest==NULL && destCapacity>0)) {
+ if(destCapacity<0 || (dest==nullptr && destCapacity>0)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -800,7 +813,7 @@ u_getFC_NFKC_Closure(UChar32 c, UChar *dest, int32_t destCapacity, UErrorCode *p
}
// first: b = NFKC(Fold(a))
UnicodeString folded1String;
- const UChar *folded1;
+ const char16_t *folded1;
int32_t folded1Length=ucase_toFullFolding(c, &folded1, U_FOLD_CASE_DEFAULT);
if(folded1Length<0) {
const Normalizer2Impl *nfkcImpl=Normalizer2Factory::getImpl(nfkc);
diff --git a/thirdparty/icu4c/common/uprops.h b/thirdparty/icu4c/common/uprops.h
index 2004394db6..1e06d03519 100644
--- a/thirdparty/icu4c/common/uprops.h
+++ b/thirdparty/icu4c/common/uprops.h
@@ -441,6 +441,7 @@ class CharacterProperties {
public:
CharacterProperties() = delete;
static const UnicodeSet *getInclusionsForProperty(UProperty prop, UErrorCode &errorCode);
+ static const UnicodeSet *getBinaryPropertySet(UProperty property, UErrorCode &errorCode);
};
// implemented in uniset_props.cpp
diff --git a/thirdparty/icu4c/common/ures_cnv.cpp b/thirdparty/icu4c/common/ures_cnv.cpp
index 1aa58e753c..0a2b1e912c 100644
--- a/thirdparty/icu4c/common/ures_cnv.cpp
+++ b/thirdparty/icu4c/common/ures_cnv.cpp
@@ -27,7 +27,7 @@
#include "ustr_cnv.h"
U_CAPI UResourceBundle * U_EXPORT2
-ures_openU(const UChar *myPath,
+ures_openU(const char16_t *myPath,
const char *localeID,
UErrorCode *status)
{
@@ -35,17 +35,17 @@ ures_openU(const UChar *myPath,
int32_t length;
char *path = pathBuffer;
- if(status==NULL || U_FAILURE(*status)) {
- return NULL;
+ if(status==nullptr || U_FAILURE(*status)) {
+ return nullptr;
}
- if(myPath==NULL) {
- path = NULL;
+ if(myPath==nullptr) {
+ path = nullptr;
}
else {
length=u_strlen(myPath);
if(length>=(int32_t)sizeof(pathBuffer)) {
*status=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
} else if(uprv_isInvariantUString(myPath, length)) {
/*
* the invariant converter is sufficient for package and tree names
@@ -59,17 +59,17 @@ ures_openU(const UChar *myPath,
length=ucnv_fromUChars(cnv, path, (int32_t)sizeof(pathBuffer), myPath, length, status);
u_releaseDefaultConverter(cnv);
if(U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
if(length>=(int32_t)sizeof(pathBuffer)) {
/* not NUL-terminated - path too long */
*status=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
#else
/* the default converter is not available */
*status=U_UNSUPPORTED_ERROR;
- return NULL;
+ return nullptr;
#endif
}
}
diff --git a/thirdparty/icu4c/common/uresbund.cpp b/thirdparty/icu4c/common/uresbund.cpp
index 17c0177a05..d02bba8921 100644
--- a/thirdparty/icu4c/common/uresbund.cpp
+++ b/thirdparty/icu4c/common/uresbund.cpp
@@ -48,7 +48,7 @@ Static cache for already opened resource bundles - mostly for keeping fallback i
TODO: This cache should probably be removed when the deprecated code is
completely removed.
*/
-static UHashtable *cache = NULL;
+static UHashtable *cache = nullptr;
static icu::UInitOnce gCacheInitOnce {};
static UMutex resbMutex;
@@ -83,7 +83,7 @@ static UBool U_CALLCONV compareEntries(const UHashTok p1, const UHashTok p2) {
static UBool chopLocale(char *name) {
char *i = uprv_strrchr(name, '_');
- if(i != NULL) {
+ if(i != nullptr) {
*i = '\0';
return true;
}
@@ -93,7 +93,7 @@ static UBool chopLocale(char *name) {
static UBool hasVariant(const char* localeID) {
UErrorCode err = U_ZERO_ERROR;
- int32_t variantLength = uloc_getVariant(localeID, NULL, 0, &err);
+ int32_t variantLength = uloc_getVariant(localeID, nullptr, 0, &err);
return variantLength != 0;
}
@@ -202,7 +202,8 @@ typedef enum UResOpenType UResOpenType;
*/
static bool getParentLocaleID(char *name, const char *origName, UResOpenType openType) {
// early out if the locale ID has a variant code or ends with _
- if (name[uprv_strlen(name) - 1] == '_' || hasVariant(name)) {
+ size_t nameLen = uprv_strlen(name);
+ if (!nameLen || name[nameLen - 1] == '_' || hasVariant(name)) {
return chopLocale(name);
}
@@ -230,7 +231,7 @@ static bool getParentLocaleID(char *name, const char *origName, UResOpenType ope
// "Collation data, however, is an exception...")
if (openType == URES_OPEN_LOCALE_DEFAULT_ROOT) {
const char* parentID = performFallbackLookup(name, parentLocaleChars, parentLocaleChars, parentLocaleTable, UPRV_LENGTHOF(parentLocaleTable));
- if (parentID != NULL) {
+ if (parentID != nullptr) {
uprv_strcpy(name, parentID);
return true;
}
@@ -302,7 +303,7 @@ static UBool mayHaveParent(char *name) {
static void entryIncrease(UResourceDataEntry *entry) {
Mutex lock(&resbMutex);
entry->fCountExisting++;
- while(entry->fParent != NULL) {
+ while(entry->fParent != nullptr) {
entry = entry->fParent;
entry->fCountExisting++;
}
@@ -358,18 +359,18 @@ static void
free_entry(UResourceDataEntry *entry) {
UResourceDataEntry *alias;
res_unload(&(entry->fData));
- if(entry->fName != NULL && entry->fName != entry->fNameBuffer) {
+ if(entry->fName != nullptr && entry->fName != entry->fNameBuffer) {
uprv_free(entry->fName);
}
- if(entry->fPath != NULL) {
+ if(entry->fPath != nullptr) {
uprv_free(entry->fPath);
}
- if(entry->fPool != NULL) {
+ if(entry->fPool != nullptr) {
--entry->fPool->fCountExisting;
}
alias = entry->fAlias;
- if(alias != NULL) {
- while(alias->fAlias != NULL) {
+ if(alias != nullptr) {
+ while(alias->fAlias != nullptr) {
alias = alias->fAlias;
}
--alias->fCountExisting;
@@ -390,7 +391,7 @@ static int32_t ures_flushCache()
* return 0
*/
Mutex lock(&resbMutex);
- if (cache == NULL) {
+ if (cache == nullptr) {
return 0;
}
@@ -398,7 +399,7 @@ static int32_t ures_flushCache()
deletedMore = false;
/*creates an enumeration to iterate through every element in the table */
pos = UHASH_FIRST;
- while ((e = uhash_nextElement(cache, &pos)) != NULL)
+ while ((e = uhash_nextElement(cache, &pos)) != nullptr)
{
resB = (UResourceDataEntry *) e->value.pointer;
/* Deletes only if reference counter == 0
@@ -429,26 +430,26 @@ static int32_t ures_flushCache()
#ifdef URES_DEBUG
#include <stdio.h>
-U_CAPI UBool U_EXPORT2 ures_dumpCacheContents(void) {
+U_CAPI UBool U_EXPORT2 ures_dumpCacheContents() {
UBool cacheNotEmpty = false;
int32_t pos = UHASH_FIRST;
const UHashElement *e;
UResourceDataEntry *resB;
Mutex lock(&resbMutex);
- if (cache == NULL) {
- fprintf(stderr,"%s:%d: RB Cache is NULL.\n", __FILE__, __LINE__);
+ if (cache == nullptr) {
+ fprintf(stderr,"%s:%d: RB Cache is nullptr.\n", __FILE__, __LINE__);
return false;
}
- while ((e = uhash_nextElement(cache, &pos)) != NULL) {
+ while ((e = uhash_nextElement(cache, &pos)) != nullptr) {
cacheNotEmpty=true;
resB = (UResourceDataEntry *) e->value.pointer;
fprintf(stderr,"%s:%d: RB Cache: Entry @0x%p, refcount %d, name %s:%s. Pool 0x%p, alias 0x%p, parent 0x%p\n",
__FILE__, __LINE__,
(void*)resB, resB->fCountExisting,
- resB->fName?resB->fName:"NULL",
- resB->fPath?resB->fPath:"NULL",
+ resB->fName?resB->fName:"nullptr",
+ resB->fPath?resB->fPath:"nullptr",
(void*)resB->fPool,
(void*)resB->fAlias,
(void*)resB->fParent);
@@ -460,12 +461,12 @@ U_CAPI UBool U_EXPORT2 ures_dumpCacheContents(void) {
#endif
-static UBool U_CALLCONV ures_cleanup(void)
+static UBool U_CALLCONV ures_cleanup()
{
- if (cache != NULL) {
+ if (cache != nullptr) {
ures_flushCache();
uhash_close(cache);
- cache = NULL;
+ cache = nullptr;
}
gCacheInitOnce.reset();
return true;
@@ -473,8 +474,8 @@ static UBool U_CALLCONV ures_cleanup(void)
/** INTERNAL: Initializes the cache for resources */
static void U_CALLCONV createCache(UErrorCode &status) {
- U_ASSERT(cache == NULL);
- cache = uhash_open(hashEntry, compareEntries, NULL, &status);
+ U_ASSERT(cache == nullptr);
+ cache = uhash_open(hashEntry, compareEntries, nullptr, &status);
ucln_common_registerCleanup(UCLN_COMMON_URES, ures_cleanup);
}
@@ -486,7 +487,7 @@ static void initCache(UErrorCode *status) {
static void setEntryName(UResourceDataEntry *res, const char *name, UErrorCode *status) {
int32_t len = (int32_t)uprv_strlen(name);
- if(res->fName != NULL && res->fName != res->fNameBuffer) {
+ if(res->fName != nullptr && res->fName != res->fNameBuffer) {
uprv_free(res->fName);
}
if (len < (int32_t)sizeof(res->fNameBuffer)) {
@@ -495,7 +496,7 @@ static void setEntryName(UResourceDataEntry *res, const char *name, UErrorCode *
else {
res->fName = (char *)uprv_malloc(len+1);
}
- if(res->fName == NULL) {
+ if(res->fName == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
} else {
uprv_strcpy(res->fName, name);
@@ -510,7 +511,7 @@ getPoolEntry(const char *path, UErrorCode *status);
* CAUTION: resbMutex must be locked when calling this function.
*/
static UResourceDataEntry *init_entry(const char *localeID, const char *path, UErrorCode *status) {
- UResourceDataEntry *r = NULL;
+ UResourceDataEntry *r = nullptr;
UResourceDataEntry find;
/*int32_t hashValue;*/
const char *name;
@@ -520,11 +521,11 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE
/*UHashTok hashkey; */
if(U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
/* here we try to deduce the right locale name */
- if(localeID == NULL) { /* if localeID is NULL, we're trying to open default locale */
+ if(localeID == nullptr) { /* if localeID is nullptr, we're trying to open default locale */
name = uloc_getDefault();
} else if(*localeID == 0) { /* if localeID is "" then we try to open root locale */
name = kRootLocaleName;
@@ -541,12 +542,12 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE
/* check to see if we already have this entry */
r = (UResourceDataEntry *)uhash_get(cache, &find);
- if(r == NULL) {
+ if(r == nullptr) {
/* if the entry is not yet in the hash table, we'll try to construct a new one */
r = (UResourceDataEntry *) uprv_malloc(sizeof(UResourceDataEntry));
- if(r == NULL) {
+ if(r == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
uprv_memset(r, 0, sizeof(UResourceDataEntry));
@@ -555,15 +556,15 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE
setEntryName(r, name, status);
if (U_FAILURE(*status)) {
uprv_free(r);
- return NULL;
+ return nullptr;
}
- if(path != NULL) {
+ if(path != nullptr) {
r->fPath = (char *)uprv_strdup(path);
- if(r->fPath == NULL) {
+ if(r->fPath == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
uprv_free(r);
- return NULL;
+ return nullptr;
}
}
@@ -574,7 +575,7 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE
/* if we failed to load due to an out-of-memory error, exit early. */
if (*status == U_MEMORY_ALLOCATION_ERROR) {
uprv_free(r);
- return NULL;
+ return nullptr;
}
/* we have no such entry in dll, so it will always use fallback */
*status = U_USING_FALLBACK_WARNING;
@@ -601,8 +602,8 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE
aliasres = res_getResource(&(r->fData), "%%ALIAS");
if (aliasres != RES_BOGUS) {
// 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 */
+ const char16_t *alias = res_getStringNoTrace(&(r->fData), aliasres, &aliasLen);
+ if(alias != nullptr && 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);
}
@@ -611,15 +612,15 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE
}
{
- UResourceDataEntry *oldR = NULL;
- if((oldR = (UResourceDataEntry *)uhash_get(cache, r)) == NULL) { /* if the data is not cached */
+ UResourceDataEntry *oldR = nullptr;
+ if((oldR = (UResourceDataEntry *)uhash_get(cache, r)) == nullptr) { /* if the data is not cached */
/* just insert it in the cache */
UErrorCode cacheStatus = U_ZERO_ERROR;
uhash_put(cache, (void *)r, r, &cacheStatus);
if (U_FAILURE(cacheStatus)) {
*status = cacheStatus;
free_entry(r);
- r = NULL;
+ r = nullptr;
}
} else {
/* somebody have already inserted it while we were working, discard newly opened data */
@@ -630,9 +631,9 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE
}
}
- if(r != NULL) {
+ if(r != nullptr) {
/* return the real bundle */
- while(r->fAlias != NULL) {
+ while(r->fAlias != nullptr) {
r = r->fAlias;
}
r->fCountExisting++; /* we increase its reference count */
@@ -649,7 +650,7 @@ static UResourceDataEntry *
getPoolEntry(const char *path, UErrorCode *status) {
UResourceDataEntry *poolBundle = init_entry(kPoolBundleName, path, status);
if( U_SUCCESS(*status) &&
- (poolBundle == NULL || poolBundle->fBogus != U_ZERO_ERROR || !poolBundle->fData.isPoolBundle)
+ (poolBundle == nullptr || poolBundle->fBogus != U_ZERO_ERROR || !poolBundle->fData.isPoolBundle)
) {
*status = U_INVALID_FORMAT_ERROR;
}
@@ -661,7 +662,7 @@ getPoolEntry(const char *path, UErrorCode *status) {
static UResourceDataEntry *
findFirstExisting(const char* path, char* name, const char* defaultLocale, UResOpenType openType,
UBool *isRoot, UBool *foundParent, UBool *isDefault, UErrorCode* status) {
- UResourceDataEntry *r = NULL;
+ UResourceDataEntry *r = nullptr;
UBool hasRealData = false;
*foundParent = true; /* we're starting with a fresh name */
char origName[ULOC_FULLNAME_CAPACITY];
@@ -671,7 +672,7 @@ findFirstExisting(const char* path, char* name, const char* defaultLocale, UResO
r = init_entry(name, path, status);
/* Null pointer test */
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
*isDefault = (UBool)(uprv_strncmp(name, defaultLocale, uprv_strlen(name)) == 0);
hasRealData = (UBool)(r->fBogus == U_ZERO_ERROR);
@@ -683,7 +684,7 @@ findFirstExisting(const char* path, char* name, const char* defaultLocale, UResO
/* are not updated yet. */
r->fCountExisting--;
/*entryCloseInt(r);*/
- r = NULL;
+ r = nullptr;
*status = U_USING_FALLBACK_WARNING;
} else {
uprv_strcpy(name, r->fName); /* this is needed for supporting aliases */
@@ -744,14 +745,14 @@ loadParentsExceptRoot(UResourceDataEntry *&t1,
UBool usingUSRData, char usrDataPath[], UErrorCode *status) {
if (U_FAILURE(*status)) { return false; }
UBool checkParent = true;
- while (checkParent && t1->fParent == NULL && !t1->fData.noFallback &&
+ while (checkParent && t1->fParent == nullptr && !t1->fData.noFallback &&
res_getResource(&t1->fData,"%%ParentIsRoot") == RES_BOGUS) {
Resource parentRes = res_getResource(&t1->fData, "%%Parent");
if (parentRes != RES_BOGUS) { // An explicit parent was found.
int32_t parentLocaleLen = 0;
// No tracing: called during initial data loading
- const UChar *parentLocaleName = res_getStringNoTrace(&(t1->fData), parentRes, &parentLocaleLen);
- if(parentLocaleName != NULL && 0 < parentLocaleLen && parentLocaleLen < nameCapacity) {
+ const char16_t *parentLocaleName = res_getStringNoTrace(&(t1->fData), parentRes, &parentLocaleLen);
+ if(parentLocaleName != nullptr && 0 < parentLocaleLen && parentLocaleLen < nameCapacity) {
u_UCharsToChars(parentLocaleName, name, parentLocaleLen + 1);
if (uprv_strcmp(name, kRootLocaleName) == 0) {
return true;
@@ -765,7 +766,7 @@ loadParentsExceptRoot(UResourceDataEntry *&t1,
*status = parentStatus;
return false;
}
- UResourceDataEntry *u2 = NULL;
+ UResourceDataEntry *u2 = nullptr;
UErrorCode usrStatus = U_ZERO_ERROR;
if (usingUSRData) { // This code inserts user override data into the inheritance chain.
u2 = init_entry(name, usrDataPath, &usrStatus);
@@ -810,13 +811,13 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID,
UResOpenType openType, UErrorCode* status) {
U_ASSERT(openType != URES_OPEN_DIRECT);
UErrorCode intStatus = U_ZERO_ERROR;
- UResourceDataEntry *r = NULL;
- UResourceDataEntry *t1 = NULL;
+ UResourceDataEntry *r = nullptr;
+ UResourceDataEntry *t1 = nullptr;
UBool isDefault = false;
UBool isRoot = false;
UBool hasRealData = false;
UBool hasChopped = true;
- UBool usingUSRData = U_USE_USRDATA && ( path == NULL || uprv_strncmp(path,U_ICUDATA_NAME,8) == 0);
+ UBool usingUSRData = U_USE_USRDATA && ( path == nullptr || uprv_strncmp(path,U_ICUDATA_NAME,8) == 0);
char name[ULOC_FULLNAME_CAPACITY];
char usrDataPath[96];
@@ -824,14 +825,14 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID,
initCache(status);
if(U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
uprv_strncpy(name, localeID, sizeof(name) - 1);
name[sizeof(name) - 1] = 0;
if ( usingUSRData ) {
- if ( path == NULL ) {
+ if ( path == nullptr ) {
uprv_strcpy(usrDataPath, U_USRDATA_NAME);
} else {
uprv_strncpy(usrDataPath, path, sizeof(usrDataPath) - 1);
@@ -856,7 +857,7 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID,
goto finish;
}
- if(r != NULL) { /* if there is one real locale, we can look for parents. */
+ if(r != nullptr) { /* 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 */
@@ -867,7 +868,7 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID,
*status = intStatus;
goto finish;
}
- if ( u1 != NULL ) {
+ if ( u1 != nullptr ) {
if(u1->fBogus == U_ZERO_ERROR) {
u1->fParent = t1;
r = u1;
@@ -886,7 +887,7 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID,
/* 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) {
+ if(r==nullptr && openType == URES_OPEN_LOCALE_DEFAULT_ROOT && !isDefault && !isRoot) {
/* insert default locale */
uprv_strcpy(name, defaultLocale);
r = findFirstExisting(path, name, defaultLocale, openType, &isRoot, &hasChopped, &isDefault, &intStatus);
@@ -896,7 +897,7 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID,
goto finish;
}
intStatus = U_USING_DEFAULT_WARNING;
- if(r != NULL) { /* the default locale exists */
+ if(r != nullptr) { /* the default locale exists */
t1 = r;
hasRealData = true;
isDefault = true;
@@ -909,9 +910,9 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID,
}
}
- /* we could still have r == NULL at this point - maybe even default locale is not */
+ /* we could still have r == nullptr at this point - maybe even default locale is not */
/* present */
- if(r == NULL) {
+ if(r == nullptr) {
uprv_strcpy(name, kRootLocaleName);
r = findFirstExisting(path, name, defaultLocale, openType, &isRoot, &hasChopped, &isDefault, &intStatus);
// If we failed due to out-of-memory, report the failure and exit early.
@@ -919,7 +920,7 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID,
*status = intStatus;
goto finish;
}
- if(r != NULL) {
+ if(r != nullptr) {
t1 = r;
intStatus = U_USING_DEFAULT_WARNING;
hasRealData = true;
@@ -928,7 +929,7 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID,
goto finish;
}
} else if(!isRoot && uprv_strcmp(t1->fName, kRootLocaleName) != 0 &&
- t1->fParent == NULL && !r->fData.noFallback) {
+ t1->fParent == nullptr && !r->fData.noFallback) {
if (!insertRootBundle(t1, status)) {
goto finish;
}
@@ -938,7 +939,7 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID,
}
// TODO: Does this ever loop?
- while(r != NULL && !isRoot && t1->fParent != NULL) {
+ while(r != nullptr && !isRoot && t1->fParent != nullptr) {
t1->fParent->fCountExisting++;
t1 = t1->fParent;
}
@@ -950,7 +951,7 @@ finish:
}
return r;
} else {
- return NULL;
+ return nullptr;
}
}
@@ -964,12 +965,12 @@ static UResourceDataEntry *
entryOpenDirect(const char* path, const char* localeID, UErrorCode* status) {
initCache(status);
if(U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
// Note: We need to query the default locale *before* locking resbMutex.
- // If the localeID is NULL, then we want to use the default locale.
- if (localeID == NULL) {
+ // If the localeID is nullptr, then we want to use the default locale.
+ if (localeID == nullptr) {
localeID = uloc_getDefault();
} else if (*localeID == 0) {
// If the localeID is "", then we want to use the root locale.
@@ -983,34 +984,34 @@ entryOpenDirect(const char* path, const char* localeID, UErrorCode* status) {
if(U_SUCCESS(*status)) {
if(r->fBogus != U_ZERO_ERROR) {
r->fCountExisting--;
- r = NULL;
+ r = nullptr;
}
} else {
- r = NULL;
+ r = nullptr;
}
// Some code depends on the ures_openDirect() bundle to have a parent bundle chain,
// unless it is marked with "nofallback".
UResourceDataEntry *t1 = r;
- if(r != NULL && uprv_strcmp(localeID, kRootLocaleName) != 0 && // not root
- r->fParent == NULL && !r->fData.noFallback &&
+ if(r != nullptr && uprv_strcmp(localeID, kRootLocaleName) != 0 && // not root
+ r->fParent == nullptr && !r->fData.noFallback &&
uprv_strlen(localeID) < ULOC_FULLNAME_CAPACITY) {
char name[ULOC_FULLNAME_CAPACITY];
uprv_strcpy(name, localeID);
if(!chopLocale(name) || uprv_strcmp(name, kRootLocaleName) == 0 ||
- loadParentsExceptRoot(t1, name, UPRV_LENGTHOF(name), false, NULL, status)) {
- if(uprv_strcmp(t1->fName, kRootLocaleName) != 0 && t1->fParent == NULL) {
+ loadParentsExceptRoot(t1, name, UPRV_LENGTHOF(name), false, nullptr, status)) {
+ if(uprv_strcmp(t1->fName, kRootLocaleName) != 0 && t1->fParent == nullptr) {
insertRootBundle(t1, status);
}
}
if(U_FAILURE(*status)) {
- r = NULL;
+ r = nullptr;
}
}
- if(r != NULL) {
+ if(r != nullptr) {
// TODO: Does this ever loop?
- while(t1->fParent != NULL) {
+ while(t1->fParent != nullptr) {
t1->fParent->fCountExisting++;
t1 = t1->fParent;
}
@@ -1026,7 +1027,7 @@ entryOpenDirect(const char* path, const char* localeID, UErrorCode* status) {
static void entryCloseInt(UResourceDataEntry *resB) {
UResourceDataEntry *p = resB;
- while(resB != NULL) {
+ while(resB != nullptr) {
p = resB->fParent;
resB->fCountExisting--;
@@ -1038,10 +1039,10 @@ static void entryCloseInt(UResourceDataEntry *resB) {
if(resB->fBogus == U_ZERO_ERROR) {
res_unload(&(resB->fData));
}
- if(resB->fName != NULL) {
+ if(resB->fName != nullptr) {
uprv_free(resB->fName);
}
- if(resB->fPath != NULL) {
+ if(resB->fPath != nullptr) {
uprv_free(resB->fPath);
}
uprv_free(resB);
@@ -1063,7 +1064,7 @@ static void entryClose(UResourceDataEntry *resB) {
/*
U_CFUNC void ures_setResPath(UResourceBundle *resB, const char* toAdd) {
- if(resB->fResPath == NULL) {
+ if(resB->fResPath == nullptr) {
resB->fResPath = resB->fResBuf;
*(resB->fResPath) = 0;
}
@@ -1080,7 +1081,7 @@ U_CFUNC void ures_setResPath(UResourceBundle *resB, const char* toAdd) {
*/
static void ures_appendResPath(UResourceBundle *resB, const char* toAdd, int32_t lenToAdd, UErrorCode *status) {
int32_t resPathLenOrig = resB->fResPathLen;
- if(resB->fResPath == NULL) {
+ if(resB->fResPath == nullptr) {
resB->fResPath = resB->fResBuf;
*(resB->fResPath) = 0;
resB->fResPathLen = 0;
@@ -1090,7 +1091,7 @@ static void ures_appendResPath(UResourceBundle *resB, const char* toAdd, int32_t
if(resB->fResPath == resB->fResBuf) {
resB->fResPath = (char *)uprv_malloc((resB->fResPathLen+1)*sizeof(char));
/* Check that memory was allocated correctly. */
- if (resB->fResPath == NULL) {
+ if (resB->fResPath == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1098,7 +1099,7 @@ static void ures_appendResPath(UResourceBundle *resB, const char* toAdd, int32_t
} else {
char *temp = (char *)uprv_realloc(resB->fResPath, (resB->fResPathLen+1)*sizeof(char));
/* Check that memory was reallocated correctly. */
- if (temp == NULL) {
+ if (temp == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1112,18 +1113,18 @@ static void ures_freeResPath(UResourceBundle *resB) {
if (resB->fResPath && resB->fResPath != resB->fResBuf) {
uprv_free(resB->fResPath);
}
- resB->fResPath = NULL;
+ resB->fResPath = nullptr;
resB->fResPathLen = 0;
}
static void
ures_closeBundle(UResourceBundle* resB, UBool freeBundleObj)
{
- if(resB != NULL) {
- if(resB->fData != NULL) {
+ if(resB != nullptr) {
+ if(resB->fData != nullptr) {
entryClose(resB->fData);
}
- if(resB->fVersion != NULL) {
+ if(resB->fVersion != nullptr) {
uprv_free(resB->fVersion);
}
ures_freeResPath(resB);
@@ -1166,7 +1167,7 @@ UResourceBundle *getAliasTargetAsResourceBundle(
if (U_FAILURE(*status)) { return resB; }
U_ASSERT(RES_GET_TYPE(r) == URES_ALIAS);
int32_t len = 0;
- const UChar *alias = res_getAlias(&resData, r, &len);
+ const char16_t *alias = res_getAlias(&resData, r, &len);
if(len <= 0) {
// bad alias
*status = U_ILLEGAL_ARGUMENT_ERROR;
@@ -1386,12 +1387,12 @@ UResourceBundle *init_resb_result(
int32_t recursionDepth,
UResourceBundle *resB, UErrorCode *status) {
// TODO: When an error occurs: Should we return nullptr vs. resB?
- if(status == NULL || U_FAILURE(*status)) {
+ if(status == nullptr || U_FAILURE(*status)) {
return resB;
}
if (validLocaleDataEntry == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
if(RES_GET_TYPE(r) == URES_ALIAS) {
// This is an alias, need to exchange with real data.
@@ -1403,20 +1404,20 @@ UResourceBundle *init_resb_result(
dataEntry->fData, r, key, idx,
validLocaleDataEntry, containerResPath, recursionDepth, resB, status);
}
- if(resB == NULL) {
+ if(resB == nullptr) {
resB = (UResourceBundle *)uprv_malloc(sizeof(UResourceBundle));
- if (resB == NULL) {
+ if (resB == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
ures_setIsStackObject(resB, false);
- resB->fResPath = NULL;
+ resB->fResPath = nullptr;
resB->fResPathLen = 0;
} else {
- if(resB->fData != NULL) {
+ if(resB->fData != nullptr) {
entryClose(resB->fData);
}
- if(resB->fVersion != NULL) {
+ if(resB->fVersion != nullptr) {
uprv_free(resB->fVersion);
}
/*
@@ -1445,7 +1446,7 @@ UResourceBundle *init_resb_result(
ures_appendResPath(
resB, containerResPath, static_cast<int32_t>(uprv_strlen(containerResPath)), status);
}
- if(key != NULL) {
+ if(key != nullptr) {
ures_appendResPath(resB, key, (int32_t)uprv_strlen(key), status);
if(resB->fResPath[resB->fResPathLen-1] != RES_PATH_SEPARATOR) {
ures_appendResPath(resB, RES_PATH_SEPARATOR_S, 1, status);
@@ -1464,7 +1465,7 @@ UResourceBundle *init_resb_result(
uprv_memset(resB->fResBuf + usedLen, 0, sizeof(resB->fResBuf) - usedLen);
}
- resB->fVersion = NULL;
+ resB->fVersion = nullptr;
resB->fRes = r;
resB->fSize = res_countArrayItems(&resB->getResData(), resB->fRes);
ResourceTracer(resB).trace("get");
@@ -1488,27 +1489,27 @@ UResourceBundle *ures_copyResb(UResourceBundle *r, const UResourceBundle *origin
if(U_FAILURE(*status) || r == original) {
return r;
}
- if(original != NULL) {
- if(r == NULL) {
+ if(original != nullptr) {
+ if(r == nullptr) {
isStackObject = false;
r = (UResourceBundle *)uprv_malloc(sizeof(UResourceBundle));
- /* test for NULL */
- if (r == NULL) {
+ /* test for nullptr */
+ if (r == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
} else {
isStackObject = ures_isStackObject(r);
ures_closeBundle(r, false);
}
uprv_memcpy(r, original, sizeof(UResourceBundle));
- r->fResPath = NULL;
+ r->fResPath = nullptr;
r->fResPathLen = 0;
if(original->fResPath) {
ures_appendResPath(r, original->fResPath, original->fResPathLen, status);
}
ures_setIsStackObject(r, isStackObject);
- if(r->fData != NULL) {
+ if(r->fData != nullptr) {
entryIncrease(r->fData);
}
}
@@ -1519,45 +1520,45 @@ UResourceBundle *ures_copyResb(UResourceBundle *r, const UResourceBundle *origin
* Functions to retrieve data from resource bundles.
*/
-U_CAPI const UChar* U_EXPORT2 ures_getString(const UResourceBundle* resB, int32_t* len, UErrorCode* status) {
- const UChar *s;
- if (status==NULL || U_FAILURE(*status)) {
- return NULL;
+U_CAPI const char16_t* U_EXPORT2 ures_getString(const UResourceBundle* resB, int32_t* len, UErrorCode* status) {
+ const char16_t *s;
+ if (status==nullptr || U_FAILURE(*status)) {
+ return nullptr;
}
- if(resB == NULL) {
+ if(resB == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
s = res_getString({resB}, &resB->getResData(), resB->fRes, len);
- if (s == NULL) {
+ if (s == nullptr) {
*status = U_RESOURCE_TYPE_MISMATCH;
}
return s;
}
static const char *
-ures_toUTF8String(const UChar *s16, int32_t length16,
+ures_toUTF8String(const char16_t *s16, int32_t length16,
char *dest, int32_t *pLength,
UBool forceCopy,
UErrorCode *status) {
int32_t capacity;
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
- if (pLength != NULL) {
+ if (pLength != nullptr) {
capacity = *pLength;
} else {
capacity = 0;
}
- if (capacity < 0 || (capacity > 0 && dest == NULL)) {
+ if (capacity < 0 || (capacity > 0 && dest == nullptr)) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
if (length16 == 0) {
/* empty string, return as read-only pointer */
- if (pLength != NULL) {
+ if (pLength != nullptr) {
*pLength = 0;
}
if (forceCopy) {
@@ -1570,11 +1571,11 @@ ures_toUTF8String(const UChar *s16, int32_t length16,
/* We need to transform the string to the destination buffer. */
if (capacity < length16) {
/* No chance for the string to fit. Pure preflighting. */
- return u_strToUTF8(NULL, 0, pLength, s16, length16, status);
+ return u_strToUTF8(nullptr, 0, pLength, s16, length16, status);
}
if (!forceCopy && (length16 <= 0x2aaaaaaa)) {
/*
- * We know the string will fit into dest because each UChar turns
+ * We know the string will fit into dest because each char16_t turns
* into at most three UTF-8 bytes. Fill the latter part of dest
* so that callers do not expect to use dest as a string pointer,
* hopefully leading to more robust code for when resource bundles
@@ -1603,22 +1604,22 @@ ures_getUTF8String(const UResourceBundle *resB,
UBool forceCopy,
UErrorCode *status) {
int32_t length16;
- const UChar *s16 = ures_getString(resB, &length16, status);
+ const char16_t *s16 = ures_getString(resB, &length16, status);
return ures_toUTF8String(s16, length16, dest, pLength, forceCopy, status);
}
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)) {
- return NULL;
+ if (status==nullptr || U_FAILURE(*status)) {
+ return nullptr;
}
- if(resB == NULL) {
+ if(resB == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
p = res_getBinary({resB}, &resB->getResData(), resB->fRes, len);
- if (p == NULL) {
+ if (p == nullptr) {
*status = U_RESOURCE_TYPE_MISMATCH;
}
return p;
@@ -1627,15 +1628,15 @@ U_CAPI const uint8_t* U_EXPORT2 ures_getBinary(const UResourceBundle* resB, int3
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)) {
- return NULL;
+ if (status==nullptr || U_FAILURE(*status)) {
+ return nullptr;
}
- if(resB == NULL) {
+ if(resB == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
p = res_getIntVector({resB}, &resB->getResData(), resB->fRes, len);
- if (p == NULL) {
+ if (p == nullptr) {
*status = U_RESOURCE_TYPE_MISMATCH;
}
return p;
@@ -1644,10 +1645,10 @@ U_CAPI const int32_t* U_EXPORT2 ures_getIntVector(const UResourceBundle* resB, i
/* 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)) {
+ if (status==nullptr || U_FAILURE(*status)) {
return 0xffffffff;
}
- if(resB == NULL) {
+ if(resB == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0xffffffff;
}
@@ -1659,10 +1660,10 @@ U_CAPI int32_t U_EXPORT2 ures_getInt(const UResourceBundle* resB, UErrorCode *st
}
U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resB, UErrorCode *status) {
- if (status==NULL || U_FAILURE(*status)) {
+ if (status==nullptr || U_FAILURE(*status)) {
return 0xffffffff;
}
- if(resB == NULL) {
+ if(resB == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0xffffffff;
}
@@ -1674,7 +1675,7 @@ U_CAPI uint32_t U_EXPORT2 ures_getUInt(const UResourceBundle* resB, UErrorCode *
}
U_CAPI UResType U_EXPORT2 ures_getType(const UResourceBundle *resB) {
- if(resB == NULL) {
+ if(resB == nullptr) {
return URES_NONE;
}
return res_getPublicType(resB->fRes);
@@ -1690,24 +1691,24 @@ U_CAPI const char * U_EXPORT2 ures_getKey(const UResourceBundle *resB) {
// 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;
+ if(resB == nullptr) {
+ return nullptr;
}
return(resB->fKey);
}
U_CAPI int32_t U_EXPORT2 ures_getSize(const UResourceBundle *resB) {
- if(resB == NULL) {
+ if(resB == nullptr) {
return 0;
}
return resB->fSize;
}
-static const UChar* ures_getStringWithAlias(const UResourceBundle *resB, Resource r, int32_t sIndex, int32_t *len, UErrorCode *status) {
+static const char16_t* ures_getStringWithAlias(const UResourceBundle *resB, Resource r, int32_t sIndex, int32_t *len, UErrorCode *status) {
if(RES_GET_TYPE(r) == URES_ALIAS) {
- const UChar* result = 0;
- UResourceBundle *tempRes = ures_getByIndex(resB, sIndex, NULL, status);
+ const char16_t* result = 0;
+ UResourceBundle *tempRes = ures_getByIndex(resB, sIndex, nullptr, status);
result = ures_getString(tempRes, len, status);
ures_close(tempRes);
return result;
@@ -1717,28 +1718,28 @@ static const UChar* ures_getStringWithAlias(const UResourceBundle *resB, Resourc
}
U_CAPI void U_EXPORT2 ures_resetIterator(UResourceBundle *resB){
- if(resB == NULL) {
+ if(resB == nullptr) {
return;
}
resB->fIndex = -1;
}
U_CAPI UBool U_EXPORT2 ures_hasNext(const UResourceBundle *resB) {
- if(resB == NULL) {
+ if(resB == nullptr) {
return false;
}
return (UBool)(resB->fIndex < resB->fSize-1);
}
-U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resB, int32_t* len, const char ** key, UErrorCode *status) {
+U_CAPI const char16_t* 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;
+ if (status==nullptr || U_FAILURE(*status)) {
+ return nullptr;
}
- if(resB == NULL) {
+ if(resB == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
if(resB->fIndex == resB->fSize-1) {
@@ -1772,30 +1773,30 @@ U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resB, int32_t*
*status = U_RESOURCE_TYPE_MISMATCH;
U_FALLTHROUGH;
default:
- return NULL;
+ return nullptr;
}
}
- return NULL;
+ return nullptr;
}
U_CAPI UResourceBundle* U_EXPORT2 ures_getNextResource(UResourceBundle *resB, UResourceBundle *fillIn, UErrorCode *status) {
- const char *key = NULL;
+ const char *key = nullptr;
Resource r = RES_BOGUS;
- if (status==NULL || U_FAILURE(*status)) {
- /*return NULL;*/
+ if (status==nullptr || U_FAILURE(*status)) {
+ /*return nullptr;*/
return fillIn;
}
- if(resB == NULL) {
+ if(resB == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- /*return NULL;*/
+ /*return nullptr;*/
return fillIn;
}
if(resB->fIndex == resB->fSize-1) {
*status = U_INDEX_OUTOFBOUNDS_ERROR;
- /*return NULL;*/
+ /*return nullptr;*/
} else {
resB->fIndex++;
switch(RES_GET_TYPE(resB->fRes)) {
@@ -1821,25 +1822,25 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getNextResource(UResourceBundle *resB, UR
}
return init_resb_result(resB->fData, r, key, resB->fIndex, resB, fillIn, status);
default:
- /*return NULL;*/
+ /*return nullptr;*/
return fillIn;
}
}
- /*return NULL;*/
+ /*return nullptr;*/
return fillIn;
}
U_CAPI UResourceBundle* U_EXPORT2 ures_getByIndex(const UResourceBundle *resB, int32_t indexR, UResourceBundle *fillIn, UErrorCode *status) {
- const char* key = NULL;
+ const char* key = nullptr;
Resource r = RES_BOGUS;
- if (status==NULL || U_FAILURE(*status)) {
- /*return NULL;*/
+ if (status==nullptr || U_FAILURE(*status)) {
+ /*return nullptr;*/
return fillIn;
}
- if(resB == NULL) {
+ if(resB == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- /*return NULL;*/
+ /*return nullptr;*/
return fillIn;
}
@@ -1867,26 +1868,26 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getByIndex(const UResourceBundle *resB, i
}
return init_resb_result(resB->fData, r, key, indexR, resB, fillIn, status);
default:
- /*return NULL;*/
+ /*return nullptr;*/
return fillIn;
}
} else {
*status = U_MISSING_RESOURCE_ERROR;
}
- /*return NULL;*/
+ /*return nullptr;*/
return fillIn;
}
-U_CAPI const UChar* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resB, int32_t indexS, int32_t* len, UErrorCode *status) {
- const char* key = NULL;
+U_CAPI const char16_t* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resB, int32_t indexS, int32_t* len, UErrorCode *status) {
+ const char* key = nullptr;
Resource r = RES_BOGUS;
- if (status==NULL || U_FAILURE(*status)) {
- return NULL;
+ if (status==nullptr || U_FAILURE(*status)) {
+ return nullptr;
}
- if(resB == NULL) {
+ if(resB == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
if(indexS >= 0 && resB->fSize > indexS) {
@@ -1924,7 +1925,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByIndex(const UResourceBundle *resB,
} else {
*status = U_MISSING_RESOURCE_ERROR;
}
- return NULL;
+ return nullptr;
}
U_CAPI const char * U_EXPORT2
@@ -1934,7 +1935,7 @@ ures_getUTF8StringByIndex(const UResourceBundle *resB,
UBool forceCopy,
UErrorCode *status) {
int32_t length16;
- const UChar *s16 = ures_getStringByIndex(resB, idx, &length16, status);
+ const char16_t *s16 = ures_getStringByIndex(resB, idx, &length16, status);
return ures_toUTF8String(s16, length16, dest, pLength, forceCopy, status);
}
@@ -1945,21 +1946,21 @@ ures_getUTF8StringByIndex(const UResourceBundle *resB,
U_CAPI UResourceBundle* U_EXPORT2
ures_findResource(const char* path, UResourceBundle *fillIn, UErrorCode *status)
{
- UResourceBundle *first = NULL;
+ UResourceBundle *first = nullptr;
UResourceBundle *result = fillIn;
- char *packageName = NULL;
- char *pathToResource = NULL, *save = NULL;
- char *locale = NULL, *localeEnd = NULL;
+ char *packageName = nullptr;
+ char *pathToResource = nullptr, *save = nullptr;
+ char *locale = nullptr, *localeEnd = nullptr;
int32_t length;
- if(status == NULL || U_FAILURE(*status)) {
+ if(status == nullptr || U_FAILURE(*status)) {
return result;
}
length = (int32_t)(uprv_strlen(path)+1);
save = pathToResource = (char *)uprv_malloc(length*sizeof(char));
- /* test for NULL */
- if(pathToResource == NULL) {
+ /* test for nullptr */
+ if(pathToResource == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return result;
}
@@ -1970,7 +1971,7 @@ ures_findResource(const char* path, UResourceBundle *fillIn, UErrorCode *status)
pathToResource++;
packageName = pathToResource;
pathToResource = uprv_strchr(pathToResource, RES_PATH_SEPARATOR);
- if(pathToResource == NULL) {
+ if(pathToResource == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
} else {
*pathToResource = 0;
@@ -1979,7 +1980,7 @@ ures_findResource(const char* path, UResourceBundle *fillIn, UErrorCode *status)
}
localeEnd = uprv_strchr(locale, RES_PATH_SEPARATOR);
- if(localeEnd != NULL) {
+ if(localeEnd != nullptr) {
*localeEnd = 0;
}
@@ -2004,7 +2005,7 @@ ures_findSubResource(const UResourceBundle *resB, char* path, UResourceBundle *f
UResourceBundle *result = fillIn;
const char *key;
- if(status == NULL || U_FAILURE(*status)) {
+ if(status == nullptr || U_FAILURE(*status)) {
return result;
}
@@ -2024,28 +2025,28 @@ ures_findSubResource(const UResourceBundle *resB, char* path, UResourceBundle *f
return result;
}
-U_CAPI const UChar* U_EXPORT2
+U_CAPI const char16_t* U_EXPORT2
ures_getStringByKeyWithFallback(const UResourceBundle *resB,
const char* inKey,
int32_t* len,
UErrorCode *status) {
UResourceBundle stack;
- const UChar* retVal = NULL;
+ const char16_t* retVal = nullptr;
ures_initStackObject(&stack);
ures_getByKeyWithFallback(resB, inKey, &stack, status);
int32_t length;
retVal = ures_getString(&stack, &length, status);
ures_close(&stack);
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
if (length == 3 && retVal[0] == EMPTY_SET && retVal[1] == EMPTY_SET && retVal[2] == EMPTY_SET ) {
- retVal = NULL;
+ retVal = nullptr;
length = 0;
*status = U_MISSING_RESOURCE_ERROR;
}
- if (len != NULL) {
+ if (len != nullptr) {
*len = length;
}
return retVal;
@@ -2064,7 +2065,7 @@ static Resource getTableItemByKeyPath(const ResourceData *pResData, Resource tab
UResType type = (UResType)RES_GET_TYPE(resource); /* the current resource type */
while (*pathPart && resource != RES_BOGUS && URES_IS_CONTAINER(type)) {
char *nextPathPart = uprv_strchr(pathPart, RES_PATH_SEPARATOR);
- if (nextPathPart != NULL) {
+ if (nextPathPart != nullptr) {
*nextPathPart = 0; /* Terminating null for this part of path. */
nextPathPart++;
} else {
@@ -2161,12 +2162,12 @@ ures_getByKeyWithFallback(const UResourceBundle *resB,
UResourceBundle *fillIn,
UErrorCode *status) {
Resource res = RES_BOGUS, rootRes = RES_BOGUS;
- UResourceBundle *helper = NULL;
+ UResourceBundle *helper = nullptr;
- if (status==NULL || U_FAILURE(*status)) {
+ if (status==nullptr || U_FAILURE(*status)) {
return fillIn;
}
- if(resB == NULL) {
+ if(resB == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return fillIn;
}
@@ -2181,14 +2182,14 @@ ures_getByKeyWithFallback(const UResourceBundle *resB,
if(res == RES_BOGUS) {
UResourceDataEntry *dataEntry = resB->fData;
CharString path;
- char *myPath = NULL;
+ char *myPath = nullptr;
const char* resPath = resB->fResPath;
int32_t len = resB->fResPathLen;
- while(res == RES_BOGUS && (dataEntry->fParent != NULL || !didRootOnce)) { /* Otherwise, we'll look in parents */
- if (dataEntry->fParent != NULL) {
+ while(res == RES_BOGUS && (dataEntry->fParent != nullptr || !didRootOnce)) { /* Otherwise, we'll look in parents */
+ if (dataEntry->fParent != nullptr) {
dataEntry = dataEntry->fParent;
} else {
- // We can't just stop when we get to a bundle whose fParent is NULL. That'll work most of the time,
+ // We can't just stop when we get to a bundle whose fParent is nullptr. That'll work most of the time,
// but if the bundle that the caller passed to us was "root" (which happens in getAllItemsWithFallback(),
// this function will drop right out without doing anything if "root" doesn't contain the exact key path
// specified. In that case, we need one extra time through this loop to make sure we follow any
@@ -2209,7 +2210,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, res, NULL, -1, resB, helper, status);
+ helper = init_resb_result(dataEntry, res, nullptr, -1, resB, helper, status);
/*helper = init_resb_result(dataEntry, res, inKey, -1, resB, helper, status);*/
if(helper) {
dataEntry = helper->fData;
@@ -2288,7 +2289,7 @@ void getAllItemsWithFallback(
value.setData(bundle->getResData());
value.setValidLocaleDataEntry(bundle->fValidLocaleDataEntry);
UResourceDataEntry *parentEntry = bundle->fData->fParent;
- UBool hasParent = parentEntry != NULL && U_SUCCESS(parentEntry->fBogus);
+ UBool hasParent = parentEntry != nullptr && U_SUCCESS(parentEntry->fBogus);
value.setResource(bundle->fRes, ResourceTracer(bundle));
sink.put(bundle->fKey, value, !hasParent, errorCode);
if (hasParent) {
@@ -2315,7 +2316,7 @@ void getAllItemsWithFallback(
StackUResourceBundle containerBundle;
const UResourceBundle *rb;
UErrorCode pathErrorCode = U_ZERO_ERROR; // Ignore if parents up to root do not have this path.
- if (bundle->fResPath == NULL || *bundle->fResPath == 0) {
+ if (bundle->fResPath == nullptr || *bundle->fResPath == 0) {
rb = parentBundle.getAlias();
} else {
rb = ures_getByKeyWithFallback(parentBundle.getAlias(), bundle->fResPath,
@@ -2431,13 +2432,13 @@ ures_getAllItemsWithFallback(const UResourceBundle *bundle, const char *path,
U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, const char* inKey, UResourceBundle *fillIn, UErrorCode *status) {
Resource res = RES_BOGUS;
- UResourceDataEntry *dataEntry = NULL;
+ UResourceDataEntry *dataEntry = nullptr;
const char *key = inKey;
- if (status==NULL || U_FAILURE(*status)) {
+ if (status==nullptr || U_FAILURE(*status)) {
return fillIn;
}
- if(resB == NULL) {
+ if(resB == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return fillIn;
}
@@ -2448,7 +2449,7 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, con
res = res_getTableItemByKey(&resB->getResData(), resB->fRes, &t, &key);
if(res == RES_BOGUS) {
key = inKey;
- if(resB->fHasFallback == true) {
+ if(resB->fHasFallback) {
dataEntry = getFallbackData(resB, &key, &res, status);
if(U_SUCCESS(*status)) {
/* check if resB->fResPath gives the right name here */
@@ -2482,17 +2483,17 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, con
return fillIn;
}
-U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, const char* inKey, int32_t* len, UErrorCode *status) {
+U_CAPI const char16_t* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, const char* inKey, int32_t* len, UErrorCode *status) {
Resource res = RES_BOGUS;
- UResourceDataEntry *dataEntry = NULL;
+ UResourceDataEntry *dataEntry = nullptr;
const char* key = inKey;
- if (status==NULL || U_FAILURE(*status)) {
- return NULL;
+ if (status==nullptr || U_FAILURE(*status)) {
+ return nullptr;
}
- if(resB == NULL) {
+ if(resB == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
int32_t type = RES_GET_TYPE(resB->fRes);
@@ -2503,7 +2504,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
if(res == RES_BOGUS) {
key = inKey;
- if(resB->fHasFallback == true) {
+ if(resB->fHasFallback) {
dataEntry = getFallbackData(resB, &key, &res, status);
if(U_SUCCESS(*status)) {
switch (RES_GET_TYPE(res)) {
@@ -2512,8 +2513,8 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
return res_getString({resB, key}, &dataEntry->fData, res, len);
case URES_ALIAS:
{
- const UChar* result = 0;
- UResourceBundle *tempRes = ures_getByKey(resB, inKey, NULL, status);
+ const char16_t* result = 0;
+ UResourceBundle *tempRes = ures_getByKey(resB, inKey, nullptr, status);
result = ures_getString(tempRes, len, status);
ures_close(tempRes);
return result;
@@ -2534,8 +2535,8 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
return res_getString({resB, key}, &resB->getResData(), res, len);
case URES_ALIAS:
{
- const UChar* result = 0;
- UResourceBundle *tempRes = ures_getByKey(resB, inKey, NULL, status);
+ const char16_t* result = 0;
+ UResourceBundle *tempRes = ures_getByKey(resB, inKey, nullptr, status);
result = ures_getString(tempRes, len, status);
ures_close(tempRes);
return result;
@@ -2562,7 +2563,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
else {
*status = U_RESOURCE_TYPE_MISMATCH;
}
- return NULL;
+ return nullptr;
}
U_CAPI const char * U_EXPORT2
@@ -2572,7 +2573,7 @@ ures_getUTF8StringByKey(const UResourceBundle *resB,
UBool forceCopy,
UErrorCode *status) {
int32_t length16;
- const UChar *s16 = ures_getStringByKey(resB, key, &length16, status);
+ const char16_t *s16 = ures_getStringByKey(resB, key, &length16, status);
return ures_toUTF8String(s16, length16, dest, pLength, forceCopy, status);
}
@@ -2585,12 +2586,12 @@ ures_getUTF8StringByKey(const UResourceBundle *resB,
U_CAPI const char* U_EXPORT2
ures_getLocaleInternal(const UResourceBundle* resourceBundle, UErrorCode* status)
{
- if (status==NULL || U_FAILURE(*status)) {
- return NULL;
+ if (status==nullptr || U_FAILURE(*status)) {
+ return nullptr;
}
if (!resourceBundle) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
} else {
return resourceBundle->fData->fName;
}
@@ -2608,12 +2609,12 @@ U_CAPI const char* U_EXPORT2
ures_getLocaleByType(const UResourceBundle* resourceBundle,
ULocDataLocaleType type,
UErrorCode* status) {
- if (status==NULL || U_FAILURE(*status)) {
- return NULL;
+ if (status==nullptr || U_FAILURE(*status)) {
+ return nullptr;
}
if (!resourceBundle) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
} else {
switch(type) {
case ULOC_ACTUAL_LOCALE:
@@ -2623,14 +2624,14 @@ ures_getLocaleByType(const UResourceBundle* resourceBundle,
case ULOC_REQUESTED_LOCALE:
default:
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
}
}
U_CFUNC const char* ures_getName(const UResourceBundle* resB) {
- if(resB == NULL) {
- return NULL;
+ if(resB == nullptr) {
+ return nullptr;
}
return resB->fData->fName;
@@ -2638,8 +2639,8 @@ U_CFUNC const char* ures_getName(const UResourceBundle* resB) {
#ifdef URES_DEBUG
U_CFUNC const char* ures_getPath(const UResourceBundle* resB) {
- if(resB == NULL) {
- return NULL;
+ if(resB == nullptr) {
+ return nullptr;
}
return resB->fData->fPath;
@@ -2650,7 +2651,7 @@ static UResourceBundle*
ures_openWithType(UResourceBundle *r, const char* path, const char* localeID,
UResOpenType openType, UErrorCode* status) {
if(U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
UResourceDataEntry *entry;
@@ -2660,27 +2661,27 @@ ures_openWithType(UResourceBundle *r, const char* path, const char* localeID,
uloc_getBaseName(localeID, canonLocaleID, UPRV_LENGTHOF(canonLocaleID), status);
if(U_FAILURE(*status) || *status == U_STRING_NOT_TERMINATED_WARNING) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
entry = entryOpen(path, canonLocaleID, openType, status);
} else {
entry = entryOpenDirect(path, localeID, status);
}
if(U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
- if(entry == NULL) {
+ if(entry == nullptr) {
*status = U_MISSING_RESOURCE_ERROR;
- return NULL;
+ return nullptr;
}
UBool isStackObject;
- if(r == NULL) {
+ if(r == nullptr) {
r = (UResourceBundle *)uprv_malloc(sizeof(UResourceBundle));
- if(r == NULL) {
+ if(r == nullptr) {
entryClose(entry);
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
isStackObject = false;
} else { // fill-in
@@ -2704,12 +2705,12 @@ ures_openWithType(UResourceBundle *r, const char* path, const char* localeID,
U_CAPI UResourceBundle* U_EXPORT2
ures_open(const char* path, const char* localeID, UErrorCode* status) {
- return ures_openWithType(NULL, path, localeID, URES_OPEN_LOCALE_DEFAULT_ROOT, status);
+ return ures_openWithType(nullptr, path, localeID, URES_OPEN_LOCALE_DEFAULT_ROOT, status);
}
U_CAPI UResourceBundle* U_EXPORT2
ures_openNoDefault(const char* path, const char* localeID, UErrorCode* status) {
- return ures_openWithType(NULL, path, localeID, URES_OPEN_LOCALE_ROOT, status);
+ return ures_openWithType(nullptr, path, localeID, URES_OPEN_LOCALE_ROOT, status);
}
/**
@@ -2718,7 +2719,7 @@ ures_openNoDefault(const char* path, const char* localeID, UErrorCode* status) {
*/
U_CAPI UResourceBundle* U_EXPORT2
ures_openDirect(const char* path, const char* localeID, UErrorCode* status) {
- return ures_openWithType(NULL, path, localeID, URES_OPEN_DIRECT, status);
+ return ures_openWithType(nullptr, path, localeID, URES_OPEN_DIRECT, status);
}
/**
@@ -2731,7 +2732,7 @@ ures_openDirect(const char* path, const char* localeID, UErrorCode* status) {
U_CAPI void U_EXPORT2
ures_openFillIn(UResourceBundle *r, const char* path,
const char* localeID, UErrorCode* status) {
- if(U_SUCCESS(*status) && r == NULL) {
+ if(U_SUCCESS(*status) && r == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -2743,7 +2744,7 @@ ures_openFillIn(UResourceBundle *r, const char* path,
*/
U_CAPI void U_EXPORT2
ures_openDirectFillIn(UResourceBundle *r, const char* path, const char* localeID, UErrorCode* status) {
- if(U_SUCCESS(*status) && r == NULL) {
+ if(U_SUCCESS(*status) && r == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -2761,16 +2762,16 @@ ures_countArrayItems(const UResourceBundle* resourceBundle,
{
UResourceBundle resData;
ures_initStackObject(&resData);
- if (status==NULL || U_FAILURE(*status)) {
+ if (status==nullptr || U_FAILURE(*status)) {
return 0;
}
- if(resourceBundle == NULL) {
+ if(resourceBundle == nullptr) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
ures_getByKey(resourceBundle, resourceKey, &resData, status);
- if(resData.getResData().data != NULL) {
+ if(resData.getResData().data != nullptr) {
int32_t result = res_countArrayItems(&resData.getResData(), resData.fRes);
ures_close(&resData);
return result;
@@ -2794,9 +2795,9 @@ ures_countArrayItems(const UResourceBundle* resourceBundle,
U_CAPI const char* U_EXPORT2
ures_getVersionNumberInternal(const UResourceBundle *resourceBundle)
{
- if (!resourceBundle) return NULL;
+ if (!resourceBundle) return nullptr;
- if(resourceBundle->fVersion == NULL) {
+ if(resourceBundle->fVersion == nullptr) {
/* If the version ID has not been built yet, then do so. Retrieve */
/* the minor version from the file. */
@@ -2804,7 +2805,7 @@ ures_getVersionNumberInternal(const UResourceBundle *resourceBundle)
int32_t minor_len = 0;
int32_t len;
- const UChar* minor_version = ures_getStringByKey(resourceBundle, kVersionTag, &minor_len, &status);
+ const char16_t* 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 */
@@ -2819,8 +2820,8 @@ ures_getVersionNumberInternal(const UResourceBundle *resourceBundle)
((UResourceBundle *)resourceBundle)->fVersion = (char *)uprv_malloc(1 + len);
/* Check for null pointer. */
- if (((UResourceBundle *)resourceBundle)->fVersion == NULL) {
- return NULL;
+ if (((UResourceBundle *)resourceBundle)->fVersion == nullptr) {
+ return nullptr;
}
if(minor_len > 0) {
@@ -2885,8 +2886,8 @@ ures_loc_nextLocale(UEnumeration* en,
UErrorCode* status) {
ULocalesContext *ctx = (ULocalesContext *)en->context;
UResourceBundle *res = &(ctx->installed);
- UResourceBundle *k = NULL;
- const char *result = NULL;
+ UResourceBundle *k = nullptr;
+ const char *result = nullptr;
int32_t len = 0;
if(ures_hasNext(res) && (k = ures_getNextResource(res, &ctx->curr, status)) != 0) {
result = ures_getKey(k);
@@ -2908,8 +2909,8 @@ ures_loc_resetLocales(UEnumeration* en,
U_CDECL_END
static const UEnumeration gLocalesEnum = {
- NULL,
- NULL,
+ nullptr,
+ nullptr,
ures_loc_closeLocales,
ures_loc_countLocales,
uenum_unextDefault,
@@ -2921,12 +2922,12 @@ static const UEnumeration gLocalesEnum = {
U_CAPI UEnumeration* U_EXPORT2
ures_openAvailableLocales(const char *path, UErrorCode *status)
{
- UResourceBundle *idx = NULL;
- UEnumeration *en = NULL;
- ULocalesContext *myContext = NULL;
+ UResourceBundle *idx = nullptr;
+ UEnumeration *en = nullptr;
+ ULocalesContext *myContext = nullptr;
if(U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
myContext = static_cast<ULocalesContext *>(uprv_malloc(sizeof(ULocalesContext)));
en = (UEnumeration *)uprv_malloc(sizeof(UEnumeration));
@@ -2934,7 +2935,7 @@ ures_openAvailableLocales(const char *path, UErrorCode *status)
*status = U_MEMORY_ALLOCATION_ERROR;
uprv_free(en);
uprv_free(myContext);
- return NULL;
+ return nullptr;
}
uprv_memcpy(en, &gLocalesEnum, sizeof(UEnumeration));
@@ -2955,7 +2956,7 @@ ures_openAvailableLocales(const char *path, UErrorCode *status)
ures_close(&myContext->installed);
uprv_free(myContext);
uprv_free(en);
- en = NULL;
+ en = nullptr;
}
ures_close(idx);
@@ -2965,7 +2966,7 @@ ures_openAvailableLocales(const char *path, UErrorCode *status)
static UBool isLocaleInList(UEnumeration *locEnum, const char *locToSearch, UErrorCode *status) {
const char *loc;
- while ((loc = uenum_next(locEnum, NULL, status)) != NULL) {
+ while ((loc = uenum_next(locEnum, nullptr, status)) != nullptr) {
if (uprv_strcmp(loc, locToSearch) == 0) {
return true;
}
@@ -2986,7 +2987,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
char parent[1024] = "";
char full[1024] = "";
UResourceBundle bund1, bund2;
- UResourceBundle *res = NULL;
+ UResourceBundle *res = nullptr;
UErrorCode subStatus = U_ZERO_ERROR;
int32_t length = 0;
if(U_FAILURE(*status)) return 0;
@@ -3028,7 +3029,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
{
*isAvailable = false;
}
- isAvailable = NULL; /* only want to set this the first time around */
+ isAvailable = nullptr; /* 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));
@@ -3038,7 +3039,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
} else if(subStatus == U_ZERO_ERROR) {
ures_getByKey(res,resName,&bund1, &subStatus);
if(subStatus == U_ZERO_ERROR) {
- const UChar *defUstr;
+ const char16_t *defUstr;
int32_t defLen;
/* look for default item */
#if defined(URES_TREE_DEBUG)
@@ -3066,7 +3067,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
subStatus = U_ZERO_ERROR;
- if (res != NULL) {
+ if (res != nullptr) {
uprv_strcpy(found, ures_getLocaleByType(res, ULOC_VALID_LOCALE, &subStatus));
}
@@ -3084,7 +3085,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
if((subStatus == U_USING_FALLBACK_WARNING) && isAvailable) {
*isAvailable = false;
}
- isAvailable = NULL; /* only want to set this the first time around */
+ isAvailable = nullptr; /* only want to set this the first time around */
#if defined(URES_TREE_DEBUG)
fprintf(stderr, "%s;%s -> %s (looking for %s)\n",
@@ -3113,7 +3114,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
}
/* now, recalculate default kw if need be */
if(uprv_strlen(defLoc) > uprv_strlen(full)) {
- const UChar *defUstr;
+ const char16_t *defUstr;
int32_t defLen;
/* look for default item */
#if defined(URES_TREE_DEBUG)
@@ -3165,7 +3166,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
if((subStatus == U_USING_FALLBACK_WARNING) && isAvailable) {
*isAvailable = false;
}
- isAvailable = NULL; /* only want to set this the first time around */
+ isAvailable = nullptr; /* only want to set this the first time around */
#if defined(URES_TREE_DEBUG)
fprintf(stderr, "%s;%s -> %s (looking for default %s)\n",
@@ -3189,7 +3190,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
/* now, recalculate default kw if need be */
if(uprv_strlen(defLoc) > uprv_strlen(full)) {
- const UChar *defUstr;
+ const char16_t *defUstr;
int32_t defLen;
/* look for default item */
#if defined(URES_TREE_DEBUG)
@@ -3292,7 +3293,7 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
const char *locale;
int32_t locLen;
- UEnumeration *locs = NULL;
+ UEnumeration *locs = nullptr;
UResourceBundle item;
UResourceBundle subItem;
@@ -3304,15 +3305,15 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
if(U_FAILURE(*status)) {
ures_close(&item);
ures_close(&subItem);
- return NULL;
+ return nullptr;
}
valuesBuf[0]=0;
valuesBuf[1]=0;
while((locale = uenum_next(locs, &locLen, status)) != 0) {
- UResourceBundle *bund = NULL;
- UResourceBundle *subPtr = NULL;
+ UResourceBundle *bund = nullptr;
+ UResourceBundle *subPtr = nullptr;
UErrorCode subStatus = U_ZERO_ERROR; /* don't fail if a bundle is unopenable */
bund = ures_open(path, locale, &subStatus);
@@ -3331,7 +3332,7 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
path?path:"<ICUDATA>", keyword, locale, u_errorName(subStatus));
#endif
ures_close(bund);
- bund = NULL;
+ bund = nullptr;
continue;
}
@@ -3344,18 +3345,18 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
#if defined(URES_TREE_DEBUG)
/* fprintf(stderr, "%s | %s | %s | %s\n", path?path:"<ICUDATA>", keyword, locale, k); */
#endif
- if(k == NULL || *k == 0 ||
+ if(k == nullptr || *k == 0 ||
uprv_strcmp(k, DEFAULT_TAG) == 0 || uprv_strncmp(k, "private-", 8) == 0) {
// empty or "default" or unlisted type
continue;
}
for(i=0; i<valuesCount; i++) {
if(!uprv_strcmp(valuesList[i],k)) {
- k = NULL; /* found duplicate */
+ k = nullptr; /* found duplicate */
break;
}
}
- if(k != NULL) {
+ if(k != nullptr) {
int32_t kLen = (int32_t)uprv_strlen(k);
if((valuesCount >= (VALUES_LIST_SIZE-1)) || /* no more space in list .. */
((valuesIndex+kLen+1+1) >= VALUES_BUF_SIZE)) { /* no more space in buffer (string + 2 nulls) */
@@ -3389,10 +3390,10 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
/* This code isn't needed, and given the documentation warnings the implementation is suspect */
U_CAPI UBool U_EXPORT2
ures_equal(const UResourceBundle* res1, const UResourceBundle* res2){
- if(res1==NULL || res2==NULL){
+ if(res1==nullptr || res2==nullptr){
return res1==res2; /* pointer comparison */
}
- if(res1->fKey==NULL|| res2->fKey==NULL){
+ if(res1->fKey==nullptr|| res2->fKey==nullptr){
return (res1->fKey==res2->fKey);
}else{
if(uprv_strcmp(res1->fKey, res2->fKey)!=0){
@@ -3402,7 +3403,7 @@ ures_equal(const UResourceBundle* res1, const UResourceBundle* res2){
if(uprv_strcmp(res1->fData->fName, res2->fData->fName)!=0){
return false;
}
- if(res1->fData->fPath == NULL|| res2->fData->fPath==NULL){
+ if(res1->fData->fPath == nullptr|| res2->fData->fPath==nullptr){
return (res1->fData->fPath == res2->fData->fPath);
}else{
if(uprv_strcmp(res1->fData->fPath, res2->fData->fPath)!=0){
@@ -3425,14 +3426,14 @@ ures_equal(const UResourceBundle* res1, const UResourceBundle* res2){
}
U_CAPI UResourceBundle* U_EXPORT2
ures_clone(const UResourceBundle* res, UErrorCode* status){
- UResourceBundle* bundle = NULL;
- UResourceBundle* ret = NULL;
- if(U_FAILURE(*status) || res == NULL){
- return NULL;
+ UResourceBundle* bundle = nullptr;
+ UResourceBundle* ret = nullptr;
+ if(U_FAILURE(*status) || res == nullptr){
+ return nullptr;
}
bundle = ures_open(res->fData->fPath, res->fData->fName, status);
- if(res->fResPath!=NULL){
- ret = ures_findSubResource(bundle, res->fResPath, NULL, status);
+ if(res->fResPath!=nullptr){
+ ret = ures_findSubResource(bundle, res->fResPath, nullptr, status);
ures_close(bundle);
}else{
ret = bundle;
@@ -3441,8 +3442,8 @@ ures_clone(const UResourceBundle* res, UErrorCode* status){
}
U_CAPI const UResourceBundle* U_EXPORT2
ures_getParentBundle(const UResourceBundle* res){
- if(res==NULL){
- return NULL;
+ if(res==nullptr){
+ return nullptr;
}
return res->fParentRes;
}
@@ -3450,7 +3451,7 @@ ures_getParentBundle(const UResourceBundle* res){
U_CAPI void U_EXPORT2
ures_getVersionByKey(const UResourceBundle* res, const char *key, UVersionInfo ver, UErrorCode *status) {
- const UChar *str;
+ const char16_t *str;
int32_t len;
str = ures_getStringByKey(res, key, &len, status);
if(U_SUCCESS(*status)) {
diff --git a/thirdparty/icu4c/common/uresdata.cpp b/thirdparty/icu4c/common/uresdata.cpp
index a1222d415c..b219e40e21 100644
--- a/thirdparty/icu4c/common/uresdata.cpp
+++ b/thirdparty/icu4c/common/uresdata.cpp
@@ -62,8 +62,8 @@ static const struct {
static const struct {
int32_t length;
- UChar nul;
- UChar pad;
+ char16_t nul;
+ char16_t pad;
} gEmptyString={ 0, 0, 0 };
/*
@@ -248,7 +248,7 @@ res_read(ResourceData *pResData,
if(U_FAILURE(*errorCode)) {
return;
}
- if(!isAcceptable(formatVersion, NULL, NULL, pInfo)) {
+ if(!isAcceptable(formatVersion, nullptr, nullptr, pInfo)) {
*errorCode=U_INVALID_FORMAT_ERROR;
return;
}
@@ -274,9 +274,9 @@ res_load(ResourceData *pResData,
U_CFUNC void
res_unload(ResourceData *pResData) {
- if(pResData->data!=NULL) {
+ if(pResData->data!=nullptr) {
udata_close(pResData->data);
- pResData->data=NULL;
+ pResData->data=nullptr;
}
}
@@ -307,17 +307,17 @@ res_getPublicType(Resource res) {
return (UResType)gPublicTypes[RES_GET_TYPE(res)];
}
-U_CAPI const UChar * U_EXPORT2
+U_CAPI const char16_t * U_EXPORT2
res_getStringNoTrace(const ResourceData *pResData, Resource res, int32_t *pLength) {
- const UChar *p;
+ const char16_t *p;
uint32_t offset=RES_GET_OFFSET(res);
int32_t length;
if(RES_GET_TYPE(res)==URES_STRING_V2) {
int32_t first;
if((int32_t)offset<pResData->poolStringIndexLimit) {
- p=(const UChar *)pResData->poolBundleStrings+offset;
+ p=(const char16_t *)pResData->poolBundleStrings+offset;
} else {
- p=(const UChar *)pResData->p16BitUnits+(offset-pResData->poolStringIndexLimit);
+ p=(const char16_t *)pResData->p16BitUnits+(offset-pResData->poolStringIndexLimit);
}
first=*p;
if(!U16_IS_TRAIL(first)) {
@@ -335,9 +335,9 @@ res_getStringNoTrace(const ResourceData *pResData, Resource res, int32_t *pLengt
} else if(res==offset) /* RES_GET_TYPE(res)==URES_STRING */ {
const int32_t *p32= res==0 ? &gEmptyString.length : pResData->pRoot+res;
length=*p32++;
- p=(const UChar *)p32;
+ p=(const char16_t *)p32;
} else {
- p=NULL;
+ p=nullptr;
length=0;
}
if(pLength) {
@@ -361,14 +361,14 @@ UBool isNoInheritanceMarker(const ResourceData *pResData, Resource res) {
} else if (res == offset) {
const int32_t *p32=pResData->pRoot+res;
int32_t length=*p32;
- const UChar *p=(const UChar *)p32;
+ const char16_t *p=(const char16_t *)p32;
return length == 3 && p[2] == 0x2205 && p[3] == 0x2205 && p[4] == 0x2205;
} else if (RES_GET_TYPE(res) == URES_STRING_V2) {
- const UChar *p;
+ const char16_t *p;
if((int32_t)offset<pResData->poolStringIndexLimit) {
- p=(const UChar *)pResData->poolBundleStrings+offset;
+ p=(const char16_t *)pResData->poolBundleStrings+offset;
} else {
- p=(const UChar *)pResData->p16BitUnits+(offset-pResData->poolStringIndexLimit);
+ p=(const char16_t *)pResData->p16BitUnits+(offset-pResData->poolStringIndexLimit);
}
int32_t first=*p;
if (first == 0x2205) { // implicit length
@@ -389,7 +389,7 @@ int32_t getStringArray(const ResourceData *pResData, const icu::ResourceArray &a
if(U_FAILURE(errorCode)) {
return 0;
}
- if(dest == NULL ? capacity != 0 : capacity < 0) {
+ if(dest == nullptr ? capacity != 0 : capacity < 0) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -404,8 +404,8 @@ int32_t getStringArray(const ResourceData *pResData, const icu::ResourceArray &a
for(int32_t i = 0; i < length; ++i) {
int32_t sLength;
// No tracing: handled by the caller
- const UChar *s = res_getStringNoTrace(pResData, array.internalGetResource(pResData, i), &sLength);
- if(s == NULL) {
+ const char16_t *s = res_getStringNoTrace(pResData, array.internalGetResource(pResData, i), &sLength);
+ if(s == nullptr) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
return 0;
}
@@ -416,17 +416,17 @@ int32_t getStringArray(const ResourceData *pResData, const icu::ResourceArray &a
} // namespace
-U_CAPI const UChar * U_EXPORT2
+U_CAPI const char16_t * U_EXPORT2
res_getAlias(const ResourceData *pResData, Resource res, int32_t *pLength) {
- const UChar *p;
+ const char16_t *p;
uint32_t offset=RES_GET_OFFSET(res);
int32_t length;
if(RES_GET_TYPE(res)==URES_ALIAS) {
const int32_t *p32= offset==0 ? &gEmptyString.length : pResData->pRoot+offset;
length=*p32++;
- p=(const UChar *)p32;
+ p=(const char16_t *)p32;
} else {
- p=NULL;
+ p=nullptr;
length=0;
}
if(pLength) {
@@ -445,7 +445,7 @@ res_getBinaryNoTrace(const ResourceData *pResData, Resource res, int32_t *pLengt
length=*p32++;
p=(const uint8_t *)p32;
} else {
- p=NULL;
+ p=nullptr;
length=0;
}
if(pLength) {
@@ -464,7 +464,7 @@ res_getIntVectorNoTrace(const ResourceData *pResData, Resource res, int32_t *pLe
p= offset==0 ? (const int32_t *)&gEmpty32 : pResData->pRoot+offset;
length=*p++;
} else {
- p=NULL;
+ p=nullptr;
length=0;
}
if(pLength) {
@@ -505,23 +505,23 @@ UResType ResourceDataValue::getType() const {
return res_getPublicType(res);
}
-const UChar *ResourceDataValue::getString(int32_t &length, UErrorCode &errorCode) const {
+const char16_t *ResourceDataValue::getString(int32_t &length, UErrorCode &errorCode) const {
if(U_FAILURE(errorCode)) {
- return NULL;
+ return nullptr;
}
- const UChar *s = res_getString(fTraceInfo, &getData(), res, &length);
- if(s == NULL) {
+ const char16_t *s = res_getString(fTraceInfo, &getData(), res, &length);
+ if(s == nullptr) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
}
return s;
}
-const UChar *ResourceDataValue::getAliasString(int32_t &length, UErrorCode &errorCode) const {
+const char16_t *ResourceDataValue::getAliasString(int32_t &length, UErrorCode &errorCode) const {
if(U_FAILURE(errorCode)) {
- return NULL;
+ return nullptr;
}
- const UChar *s = res_getAlias(&getData(), res, &length);
- if(s == NULL) {
+ const char16_t *s = res_getAlias(&getData(), res, &length);
+ if(s == nullptr) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
}
return s;
@@ -549,10 +549,10 @@ uint32_t ResourceDataValue::getUInt(UErrorCode &errorCode) const {
const int32_t *ResourceDataValue::getIntVector(int32_t &length, UErrorCode &errorCode) const {
if(U_FAILURE(errorCode)) {
- return NULL;
+ return nullptr;
}
const int32_t *iv = res_getIntVector(fTraceInfo, &getData(), res, &length);
- if(iv == NULL) {
+ if(iv == nullptr) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
}
return iv;
@@ -560,10 +560,10 @@ const int32_t *ResourceDataValue::getIntVector(int32_t &length, UErrorCode &erro
const uint8_t *ResourceDataValue::getBinary(int32_t &length, UErrorCode &errorCode) const {
if(U_FAILURE(errorCode)) {
- return NULL;
+ return nullptr;
}
const uint8_t *b = res_getBinary(fTraceInfo, &getData(), res, &length);
- if(b == NULL) {
+ if(b == nullptr) {
errorCode = U_RESOURCE_TYPE_MISMATCH;
}
return b;
@@ -573,8 +573,8 @@ ResourceArray ResourceDataValue::getArray(UErrorCode &errorCode) const {
if(U_FAILURE(errorCode)) {
return ResourceArray();
}
- const uint16_t *items16 = NULL;
- const Resource *items32 = NULL;
+ const uint16_t *items16 = nullptr;
+ const Resource *items32 = nullptr;
uint32_t offset=RES_GET_OFFSET(res);
int32_t length = 0;
switch(RES_GET_TYPE(res)) {
@@ -599,10 +599,10 @@ ResourceTable ResourceDataValue::getTable(UErrorCode &errorCode) const {
if(U_FAILURE(errorCode)) {
return ResourceTable();
}
- const uint16_t *keys16 = NULL;
- const int32_t *keys32 = NULL;
- const uint16_t *items16 = NULL;
- const Resource *items32 = NULL;
+ const uint16_t *keys16 = nullptr;
+ const int32_t *keys32 = nullptr;
+ const uint16_t *items16 = nullptr;
+ const Resource *items32 = nullptr;
uint32_t offset = RES_GET_OFFSET(res);
int32_t length = 0;
switch(RES_GET_TYPE(res)) {
@@ -649,7 +649,7 @@ int32_t ResourceDataValue::getStringArrayOrStringAsArray(UnicodeString *dest, in
if(U_FAILURE(errorCode)) {
return 0;
}
- if(dest == NULL ? capacity != 0 : capacity < 0) {
+ if(dest == nullptr ? capacity != 0 : capacity < 0) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -658,8 +658,8 @@ int32_t ResourceDataValue::getStringArrayOrStringAsArray(UnicodeString *dest, in
return 1;
}
int32_t sLength;
- const UChar *s = res_getString(fTraceInfo, &getData(), res, &sLength);
- if(s != NULL) {
+ const char16_t *s = res_getString(fTraceInfo, &getData(), res, &sLength);
+ if(s != nullptr) {
dest[0].setTo(true, s, sLength);
return 1;
}
@@ -673,8 +673,8 @@ UnicodeString ResourceDataValue::getStringOrFirstOfArray(UErrorCode &errorCode)
return us;
}
int32_t sLength;
- const UChar *s = res_getString(fTraceInfo, &getData(), res, &sLength);
- if(s != NULL) {
+ const char16_t *s = res_getString(fTraceInfo, &getData(), res, &sLength);
+ if(s != nullptr) {
us.setTo(true, s, sLength);
return us;
}
@@ -685,7 +685,7 @@ UnicodeString ResourceDataValue::getStringOrFirstOfArray(UErrorCode &errorCode)
if(array.getSize() > 0) {
// 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) {
+ if(s != nullptr) {
us.setTo(true, s, sLength);
return us;
}
@@ -714,7 +714,7 @@ res_getTableItemByKey(const ResourceData *pResData, Resource table,
uint32_t offset=RES_GET_OFFSET(table);
int32_t length;
int32_t idx;
- if(key == NULL || *key == NULL) {
+ if(key == nullptr || *key == nullptr) {
return RES_BOGUS;
}
switch(RES_GET_TYPE(table)) {
@@ -771,7 +771,7 @@ res_getTableItemByIndex(const ResourceData *pResData, Resource table,
length=*p++;
if(indexR<length) {
const Resource *p32=(const Resource *)(p+length+(~length&1));
- if(key!=NULL) {
+ if(key!=nullptr) {
*key=RES_GET_KEY16(pResData, p[indexR]);
}
return p32[indexR];
@@ -783,7 +783,7 @@ res_getTableItemByIndex(const ResourceData *pResData, Resource table,
const uint16_t *p=pResData->p16BitUnits+offset;
length=*p++;
if(indexR<length) {
- if(key!=NULL) {
+ if(key!=nullptr) {
*key=RES_GET_KEY16(pResData, p[indexR]);
}
return makeResourceFrom16(pResData, p[length+indexR]);
@@ -795,7 +795,7 @@ res_getTableItemByIndex(const ResourceData *pResData, Resource table,
const int32_t *p= pResData->pRoot+offset;
length=*p++;
if(indexR<length) {
- if(key!=NULL) {
+ if(key!=nullptr) {
*key=RES_GET_KEY32(pResData, p[indexR]);
}
return (Resource)p[length+indexR];
@@ -895,7 +895,7 @@ res_getArrayItem(const ResourceData *pResData, Resource array, int32_t indexR) {
}
uint32_t icu::ResourceArray::internalGetResource(const ResourceData *pResData, int32_t i) const {
- if (items16 != NULL) {
+ if (items16 != nullptr) {
return makeResourceFrom16(pResData, items16[i]);
} else {
return items32[i];
@@ -920,7 +920,7 @@ UBool icu::ResourceArray::getValue(int32_t i, icu::ResourceValue &value) const {
U_CFUNC Resource
res_findResource(const ResourceData *pResData, Resource r, char** path, const char** key) {
char *pathP = *path, *nextSepP = *path;
- char *closeIndex = NULL;
+ char *closeIndex = nullptr;
Resource t1 = r;
Resource t2;
int32_t indexR = 0;
@@ -944,7 +944,7 @@ res_findResource(const ResourceData *pResData, Resource r, char** path, const ch
/* if there are more separators, terminate string
* and set path to the remaining part of the string
*/
- if(nextSepP != NULL) {
+ if(nextSepP != nullptr) {
if(nextSepP == pathP) {
// Empty key string.
return RES_BOGUS;
@@ -967,7 +967,7 @@ res_findResource(const ResourceData *pResData, Resource r, char** path, const ch
} else {
t2 = RES_BOGUS; /* have an array, but don't have a valid index */
}
- *key = NULL;
+ *key = nullptr;
} else { /* can't do much here, except setting t2 to bogus */
t2 = RES_BOGUS;
}
@@ -1041,7 +1041,7 @@ enum {
static const char *const gUnknownKey="";
/* resource table key for collation binaries: "%%CollationBin" */
-static const UChar gCollationBinKey[]={
+static const char16_t gCollationBinKey[]={
0x25, 0x25,
0x43, 0x6f, 0x6c, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e,
0x42, 0x69, 0x6e,
@@ -1098,7 +1098,7 @@ ures_swapResource(const UDataSwapper *ds,
count=udata_readInt32(ds, (int32_t)*p);
/* swap length */
ds->swapArray32(ds, p, 4, q, pErrorCode);
- /* swap each UChar (the terminating NUL would not change) */
+ /* swap each char16_t (the terminating NUL would not change) */
ds->swapArray16(ds, p+1, 2*count, q+1, pErrorCode);
break;
case URES_BINARY:
@@ -1109,7 +1109,7 @@ ures_swapResource(const UDataSwapper *ds,
/* swap known formats */
#if !UCONFIG_NO_COLLATION
- if( key!=NULL && /* the binary is in a table */
+ if( key!=nullptr && /* the binary is in a table */
(key!=gUnknownKey ?
/* its table key string is "%%CollationBin" */
0==ds->compareInvChars(ds, key, -1,
@@ -1139,7 +1139,7 @@ ures_swapResource(const UDataSwapper *ds,
qKey16=(uint16_t *)q;
count=ds->readUInt16(*pKey16);
- pKey32=qKey32=NULL;
+ pKey32=qKey32=nullptr;
/* swap count */
ds->swapArray16(ds, pKey16++, 2, qKey16++, pErrorCode);
@@ -1151,7 +1151,7 @@ ures_swapResource(const UDataSwapper *ds,
qKey32=(int32_t *)q;
count=udata_readInt32(ds, *pKey32);
- pKey16=qKey16=NULL;
+ pKey16=qKey16=nullptr;
/* swap count */
ds->swapArray32(ds, pKey32++, 4, qKey32++, pErrorCode);
@@ -1169,7 +1169,7 @@ ures_swapResource(const UDataSwapper *ds,
/* recurse */
for(i=0; i<count; ++i) {
const char *itemKey=gUnknownKey;
- if(pKey16!=NULL) {
+ if(pKey16!=nullptr) {
int32_t keyOffset=ds->readUInt16(pKey16[i]);
if(keyOffset<pTempTable->localKeyLimit) {
itemKey=(const char *)outBundle+keyOffset;
@@ -1191,7 +1191,7 @@ ures_swapResource(const UDataSwapper *ds,
if(pTempTable->majorFormatVersion>1 || ds->inCharset==ds->outCharset) {
/* no need to sort, just swap the offset/value arrays */
- if(pKey16!=NULL) {
+ if(pKey16!=nullptr) {
ds->swapArray16(ds, pKey16, count*2, qKey16, pErrorCode);
ds->swapArray32(ds, p, count*4, q, pErrorCode);
} else {
@@ -1209,7 +1209,7 @@ ures_swapResource(const UDataSwapper *ds,
* sorting indexes and sort that.
* Then we permutate and copy/swap the actual values.
*/
- if(pKey16!=NULL) {
+ if(pKey16!=nullptr) {
for(i=0; i<count; ++i) {
pTempTable->rows[i].keyIndex=ds->readUInt16(pKey16[i]);
pTempTable->rows[i].sortIndex=i;
@@ -1237,7 +1237,7 @@ ures_swapResource(const UDataSwapper *ds,
* before the results are copied to the outBundle.
*/
/* keys */
- if(pKey16!=NULL) {
+ if(pKey16!=nullptr) {
uint16_t *rKey16;
if(pKey16!=qKey16) {
@@ -1301,7 +1301,7 @@ ures_swapResource(const UDataSwapper *ds,
/* recurse */
for(i=0; i<count; ++i) {
item=ds->readUInt32(p[i]);
- ures_swapResource(ds, inBundle, outBundle, item, NULL, pTempTable, pErrorCode);
+ ures_swapResource(ds, inBundle, outBundle, item, nullptr, pTempTable, pErrorCode);
if(U_FAILURE(*pErrorCode)) {
udata_printError(ds, "ures_swapResource(array res=%08x)[%d].recurse(%08x) failed\n",
res, i, item);
@@ -1345,7 +1345,7 @@ ures_swap(const UDataSwapper *ds,
/* udata_swapDataHeader checks the arguments */
headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
@@ -1439,7 +1439,7 @@ ures_swap(const UDataSwapper *ds,
tempTable.resFlags=stackResFlags;
} else {
tempTable.resFlags=(uint32_t *)uprv_malloc(resFlagsLength);
- if(tempTable.resFlags==NULL) {
+ if(tempTable.resFlags==nullptr) {
udata_printError(ds, "ures_swap(): unable to allocate memory for tracking resources\n");
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return 0;
@@ -1476,7 +1476,7 @@ ures_swap(const UDataSwapper *ds,
tempTable.resort=resort;
} else {
tempTable.rows=(Row *)uprv_malloc(maxTableLength*sizeof(Row)+maxTableLength*4);
- if(tempTable.rows==NULL) {
+ if(tempTable.rows==nullptr) {
udata_printError(ds, "ures_swap(): unable to allocate memory for sorting tables (max length: %d)\n",
maxTableLength);
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
@@ -1489,7 +1489,7 @@ ures_swap(const UDataSwapper *ds,
}
/* swap the resources */
- ures_swapResource(ds, inBundle, outBundle, rootRes, NULL, &tempTable, pErrorCode);
+ ures_swapResource(ds, inBundle, outBundle, rootRes, nullptr, &tempTable, pErrorCode);
if(U_FAILURE(*pErrorCode)) {
udata_printError(ds, "ures_swapResource(root res=%08x) failed\n",
rootRes);
diff --git a/thirdparty/icu4c/common/uresdata.h b/thirdparty/icu4c/common/uresdata.h
index b8a3adba63..171189051f 100644
--- a/thirdparty/icu4c/common/uresdata.h
+++ b/thirdparty/icu4c/common/uresdata.h
@@ -482,7 +482,7 @@ U_CFUNC Resource res_findResource(const ResourceData *pResData, Resource r,
U_NAMESPACE_BEGIN
-inline const UChar* res_getString(const ResourceTracer& traceInfo,
+inline const char16_t* res_getString(const ResourceTracer& traceInfo,
const ResourceData *pResData, Resource res, int32_t *pLength) {
traceInfo.trace("string");
return res_getStringNoTrace(pResData, res, pLength);
@@ -536,8 +536,8 @@ public:
UResourceDataEntry *getValidLocaleDataEntry() const { return validLocaleDataEntry; }
Resource getResource() const { return res; }
virtual UResType getType() const override;
- virtual const UChar *getString(int32_t &length, UErrorCode &errorCode) const override;
- virtual const UChar *getAliasString(int32_t &length, UErrorCode &errorCode) const override;
+ virtual const char16_t *getString(int32_t &length, UErrorCode &errorCode) const override;
+ virtual const char16_t *getAliasString(int32_t &length, UErrorCode &errorCode) const override;
virtual int32_t getInt(UErrorCode &errorCode) const override;
virtual uint32_t getUInt(UErrorCode &errorCode) const override;
virtual const int32_t *getIntVector(int32_t &length, UErrorCode &errorCode) const override;
diff --git a/thirdparty/icu4c/common/uresimp.h b/thirdparty/icu4c/common/uresimp.h
index 4ac09bd8c4..8a1679717e 100644
--- a/thirdparty/icu4c/common/uresimp.h
+++ b/thirdparty/icu4c/common/uresimp.h
@@ -118,10 +118,10 @@ U_NAMESPACE_BEGIN
class U_COMMON_API StackUResourceBundle {
public:
// No heap allocation. Use only on the stack.
- static void* U_EXPORT2 operator new(size_t) U_NOEXCEPT = delete;
- static void* U_EXPORT2 operator new[](size_t) U_NOEXCEPT = delete;
+ static void* U_EXPORT2 operator new(size_t) noexcept = delete;
+ static void* U_EXPORT2 operator new[](size_t) noexcept = delete;
#if U_HAVE_PLACEMENT_NEW
- static void* U_EXPORT2 operator new(size_t, void*) U_NOEXCEPT = delete;
+ static void* U_EXPORT2 operator new(size_t, void*) noexcept = delete;
#endif
StackUResourceBundle();
diff --git a/thirdparty/icu4c/common/usc_impl.cpp b/thirdparty/icu4c/common/usc_impl.cpp
index a4e2fc6069..cd5a4e5b8d 100644
--- a/thirdparty/icu4c/common/usc_impl.cpp
+++ b/thirdparty/icu4c/common/usc_impl.cpp
@@ -41,7 +41,7 @@ struct ParenStackEntry
struct UScriptRun
{
int32_t textLength;
- const UChar *textArray;
+ const char16_t *textArray;
int32_t scriptStart;
int32_t scriptLimit;
@@ -189,19 +189,19 @@ sameScript(UScriptCode scriptOne, UScriptCode scriptTwo)
}
U_CAPI UScriptRun * U_EXPORT2
-uscript_openRun(const UChar *src, int32_t length, UErrorCode *pErrorCode)
+uscript_openRun(const char16_t *src, int32_t length, UErrorCode *pErrorCode)
{
- UScriptRun *result = NULL;
+ UScriptRun *result = nullptr;
- if (pErrorCode == NULL || U_FAILURE(*pErrorCode)) {
- return NULL;
+ if (pErrorCode == nullptr || U_FAILURE(*pErrorCode)) {
+ return nullptr;
}
result = (UScriptRun *)uprv_malloc(sizeof (UScriptRun));
- if (result == NULL) {
+ if (result == nullptr) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
uscript_setRunText(result, src, length, pErrorCode);
@@ -209,7 +209,7 @@ uscript_openRun(const UChar *src, int32_t length, UErrorCode *pErrorCode)
/* Release the UScriptRun if uscript_setRunText() returns an error */
if (U_FAILURE(*pErrorCode)) {
uprv_free(result);
- result = NULL;
+ result = nullptr;
}
return result;
@@ -218,7 +218,7 @@ uscript_openRun(const UChar *src, int32_t length, UErrorCode *pErrorCode)
U_CAPI void U_EXPORT2
uscript_closeRun(UScriptRun *scriptRun)
{
- if (scriptRun != NULL) {
+ if (scriptRun != nullptr) {
uprv_free(scriptRun);
}
}
@@ -226,7 +226,7 @@ uscript_closeRun(UScriptRun *scriptRun)
U_CAPI void U_EXPORT2
uscript_resetRun(UScriptRun *scriptRun)
{
- if (scriptRun != NULL) {
+ if (scriptRun != nullptr) {
scriptRun->scriptStart = 0;
scriptRun->scriptLimit = 0;
scriptRun->scriptCode = USCRIPT_INVALID_CODE;
@@ -237,13 +237,13 @@ uscript_resetRun(UScriptRun *scriptRun)
}
U_CAPI void U_EXPORT2
-uscript_setRunText(UScriptRun *scriptRun, const UChar *src, int32_t length, UErrorCode *pErrorCode)
+uscript_setRunText(UScriptRun *scriptRun, const char16_t *src, int32_t length, UErrorCode *pErrorCode)
{
- if (pErrorCode == NULL || U_FAILURE(*pErrorCode)) {
+ if (pErrorCode == nullptr || U_FAILURE(*pErrorCode)) {
return;
}
- if (scriptRun == NULL || length < 0 || ((src == NULL) != (length == 0))) {
+ if (scriptRun == nullptr || length < 0 || ((src == nullptr) != (length == 0))) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -260,7 +260,7 @@ uscript_nextRun(UScriptRun *scriptRun, int32_t *pRunStart, int32_t *pRunLimit, U
UErrorCode error = U_ZERO_ERROR;
/* if we've fallen off the end of the text, we're done */
- if (scriptRun == NULL || scriptRun->scriptLimit >= scriptRun->textLength) {
+ if (scriptRun == nullptr || scriptRun->scriptLimit >= scriptRun->textLength) {
return false;
}
@@ -268,8 +268,8 @@ uscript_nextRun(UScriptRun *scriptRun, int32_t *pRunStart, int32_t *pRunLimit, U
scriptRun->scriptCode = USCRIPT_COMMON;
for (scriptRun->scriptStart = scriptRun->scriptLimit; scriptRun->scriptLimit < scriptRun->textLength; scriptRun->scriptLimit += 1) {
- UChar high = scriptRun->textArray[scriptRun->scriptLimit];
- UChar32 ch = high;
+ char16_t high = scriptRun->textArray[scriptRun->scriptLimit];
+ UChar32 ch = high;
UScriptCode sc;
int32_t pairIndex;
@@ -278,7 +278,7 @@ uscript_nextRun(UScriptRun *scriptRun, int32_t *pRunStart, int32_t *pRunLimit, U
* in the text, see if it's followed by a low surrogate
*/
if (high >= 0xD800 && high <= 0xDBFF && scriptRun->scriptLimit < scriptRun->textLength - 1) {
- UChar low = scriptRun->textArray[scriptRun->scriptLimit + 1];
+ char16_t low = scriptRun->textArray[scriptRun->scriptLimit + 1];
/*
* if it is followed by a low surrogate,
@@ -345,15 +345,15 @@ uscript_nextRun(UScriptRun *scriptRun, int32_t *pRunStart, int32_t *pRunLimit, U
}
- if (pRunStart != NULL) {
+ if (pRunStart != nullptr) {
*pRunStart = scriptRun->scriptStart;
}
- if (pRunLimit != NULL) {
+ if (pRunLimit != nullptr) {
*pRunLimit = scriptRun->scriptLimit;
}
- if (pRunScript != NULL) {
+ if (pRunScript != nullptr) {
*pRunScript = scriptRun->scriptCode;
}
diff --git a/thirdparty/icu4c/common/uscript.cpp b/thirdparty/icu4c/common/uscript.cpp
index 1ededbb268..3cc2b6675c 100644
--- a/thirdparty/icu4c/common/uscript.cpp
+++ b/thirdparty/icu4c/common/uscript.cpp
@@ -107,14 +107,27 @@ uscript_getCode(const char* nameOrAbbrOrLocale,
if(U_FAILURE(*err)) {
return 0;
}
- if(nameOrAbbrOrLocale==NULL ||
- (fillIn == NULL ? capacity != 0 : capacity < 0)) {
+ if(nameOrAbbrOrLocale==nullptr ||
+ (fillIn == nullptr ? capacity != 0 : capacity < 0)) {
*err = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
triedCode = false;
- if(uprv_strchr(nameOrAbbrOrLocale, '-')==NULL && uprv_strchr(nameOrAbbrOrLocale, '_')==NULL ){
+ const char* lastSepPtr = uprv_strrchr(nameOrAbbrOrLocale, '-');
+ if (lastSepPtr==nullptr) {
+ lastSepPtr = uprv_strrchr(nameOrAbbrOrLocale, '_');
+ }
+ // Favor interpretation of nameOrAbbrOrLocale as a script alias if either
+ // 1. nameOrAbbrOrLocale does not contain -/_. Handles Han, Mro, Nko, etc.
+ // 2. The last instance of -/_ is at offset 3, and the portion after that is
+ // longer than 4 characters (i.e. not a script or region code). This handles
+ // Old_Hungarian, Old_Italic, etc. ("old" is a valid language code)
+ // 3. The last instance of -/_ is at offset 7, and the portion after that is
+ // 3 characters. This handles New_Tai_Lue ("new" is a valid language code).
+ if (lastSepPtr==nullptr
+ || (lastSepPtr-nameOrAbbrOrLocale == 3 && uprv_strlen(nameOrAbbrOrLocale) > 8)
+ || (lastSepPtr-nameOrAbbrOrLocale == 7 && uprv_strlen(nameOrAbbrOrLocale) == 11) ) {
/* try long and abbreviated script names first */
UScriptCode code = (UScriptCode) u_getPropertyValueEnum(UCHAR_SCRIPT, nameOrAbbrOrLocale);
if(code!=USCRIPT_INVALID_CODE) {
diff --git a/thirdparty/icu4c/common/uscript_props.cpp b/thirdparty/icu4c/common/uscript_props.cpp
index 886acfafa8..b26164408a 100644
--- a/thirdparty/icu4c/common/uscript_props.cpp
+++ b/thirdparty/icu4c/common/uscript_props.cpp
@@ -258,9 +258,9 @@ int32_t getScriptProps(UScriptCode script) {
} // namespace
U_CAPI int32_t U_EXPORT2
-uscript_getSampleString(UScriptCode script, UChar *dest, int32_t capacity, UErrorCode *pErrorCode) {
+uscript_getSampleString(UScriptCode script, char16_t *dest, int32_t capacity, UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) { return 0; }
- if(capacity < 0 || (capacity > 0 && dest == NULL)) {
+ if(capacity < 0 || (capacity > 0 && dest == nullptr)) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
diff --git a/thirdparty/icu4c/common/uset.cpp b/thirdparty/icu4c/common/uset.cpp
index 2152693560..b2d0b91d4b 100644
--- a/thirdparty/icu4c/common/uset.cpp
+++ b/thirdparty/icu4c/common/uset.cpp
@@ -87,14 +87,14 @@ uset_addRange(USet* set, UChar32 start, UChar32 end) {
}
U_CAPI void U_EXPORT2
-uset_addString(USet* set, const UChar* str, int32_t strLen) {
+uset_addString(USet* set, const char16_t* str, int32_t strLen) {
// UnicodeString handles -1 for strLen
UnicodeString s(strLen<0, str, strLen);
((UnicodeSet*) set)->UnicodeSet::add(s);
}
U_CAPI void U_EXPORT2
-uset_addAllCodePoints(USet* set, const UChar *str, int32_t strLen) {
+uset_addAllCodePoints(USet* set, const char16_t *str, int32_t strLen) {
// UnicodeString handles -1 for strLen
UnicodeString s(str, strLen);
((UnicodeSet*) set)->UnicodeSet::addAll(s);
@@ -111,13 +111,13 @@ uset_removeRange(USet* set, UChar32 start, UChar32 end) {
}
U_CAPI void U_EXPORT2
-uset_removeString(USet* set, const UChar* str, int32_t strLen) {
+uset_removeString(USet* set, const char16_t* str, int32_t strLen) {
UnicodeString s(strLen==-1, str, strLen);
((UnicodeSet*) set)->UnicodeSet::remove(s);
}
U_CAPI void U_EXPORT2
-uset_removeAllCodePoints(USet *set, const UChar *str, int32_t length) {
+uset_removeAllCodePoints(USet *set, const char16_t *str, int32_t length) {
UnicodeString s(length==-1, str, length);
((UnicodeSet*) set)->UnicodeSet::removeAll(s);
}
@@ -133,13 +133,13 @@ uset_retain(USet* set, UChar32 start, UChar32 end) {
}
U_CAPI void U_EXPORT2
-uset_retainString(USet *set, const UChar *str, int32_t length) {
+uset_retainString(USet *set, const char16_t *str, int32_t length) {
UnicodeString s(length==-1, str, length);
((UnicodeSet*) set)->UnicodeSet::retain(s);
}
U_CAPI void U_EXPORT2
-uset_retainAllCodePoints(USet *set, const UChar *str, int32_t length) {
+uset_retainAllCodePoints(USet *set, const char16_t *str, int32_t length) {
UnicodeString s(length==-1, str, length);
((UnicodeSet*) set)->UnicodeSet::retainAll(s);
}
@@ -165,13 +165,13 @@ uset_complementRange(USet *set, UChar32 start, UChar32 end) {
}
U_CAPI void U_EXPORT2
-uset_complementString(USet *set, const UChar *str, int32_t length) {
+uset_complementString(USet *set, const char16_t *str, int32_t length) {
UnicodeString s(length==-1, str, length);
((UnicodeSet*) set)->UnicodeSet::complement(s);
}
U_CAPI void U_EXPORT2
-uset_complementAllCodePoints(USet *set, const UChar *str, int32_t length) {
+uset_complementAllCodePoints(USet *set, const char16_t *str, int32_t length) {
UnicodeString s(length==-1, str, length);
((UnicodeSet*) set)->UnicodeSet::complementAll(s);
}
@@ -212,7 +212,7 @@ uset_containsRange(const USet* set, UChar32 start, UChar32 end) {
}
U_CAPI UBool U_EXPORT2
-uset_containsString(const USet* set, const UChar* str, int32_t strLen) {
+uset_containsString(const USet* set, const char16_t* str, int32_t strLen) {
UnicodeString s(strLen==-1, str, strLen);
return ((const UnicodeSet*) set)->UnicodeSet::contains(s);
}
@@ -223,7 +223,7 @@ uset_containsAll(const USet* set1, const USet* set2) {
}
U_CAPI UBool U_EXPORT2
-uset_containsAllCodePoints(const USet* set, const UChar *str, int32_t strLen) {
+uset_containsAllCodePoints(const USet* set, const char16_t *str, int32_t strLen) {
// Create a string alias, since nothing is being added to the set.
UnicodeString s(strLen==-1, str, strLen);
return ((const UnicodeSet*) set)->UnicodeSet::containsAll(s);
@@ -240,12 +240,12 @@ uset_containsSome(const USet* set1, const USet* set2) {
}
U_CAPI int32_t U_EXPORT2
-uset_span(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition) {
+uset_span(const USet *set, const char16_t *s, int32_t length, USetSpanCondition spanCondition) {
return ((UnicodeSet*) set)->UnicodeSet::span(s, length, spanCondition);
}
U_CAPI int32_t U_EXPORT2
-uset_spanBack(const USet *set, const UChar *s, int32_t length, USetSpanCondition spanCondition) {
+uset_spanBack(const USet *set, const char16_t *s, int32_t length, USetSpanCondition spanCondition) {
return ((UnicodeSet*) set)->UnicodeSet::spanBack(s, length, spanCondition);
}
@@ -315,7 +315,7 @@ uset_getItemCount(const USet* uset) {
U_CAPI int32_t U_EXPORT2
uset_getItem(const USet* uset, int32_t itemIndex,
UChar32* start, UChar32* end,
- UChar* str, int32_t strCapacity,
+ char16_t* str, int32_t strCapacity,
UErrorCode* ec) {
if (U_FAILURE(*ec)) return 0;
const UnicodeSet& set = *(const UnicodeSet*)uset;
@@ -372,7 +372,7 @@ uset_getItem(const USet* uset, int32_t itemIndex,
*/
U_CAPI int32_t U_EXPORT2
uset_serialize(const USet* set, uint16_t* dest, int32_t destCapacity, UErrorCode* ec) {
- if (ec==NULL || U_FAILURE(*ec)) {
+ if (ec==nullptr || U_FAILURE(*ec)) {
return 0;
}
@@ -383,10 +383,10 @@ U_CAPI UBool U_EXPORT2
uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcLength) {
int32_t length;
- if(fillSet==NULL) {
+ if(fillSet==nullptr) {
return false;
}
- if(src==NULL || srcLength<=0) {
+ if(src==nullptr || srcLength<=0) {
fillSet->length=fillSet->bmpLength=0;
return false;
}
@@ -415,7 +415,7 @@ uset_getSerializedSet(USerializedSet* fillSet, const uint16_t* src, int32_t srcL
U_CAPI void U_EXPORT2
uset_setSerializedToOne(USerializedSet* fillSet, UChar32 c) {
- if(fillSet==NULL || (uint32_t)c>0x10ffff) {
+ if(fillSet==nullptr || (uint32_t)c>0x10ffff) {
return;
}
@@ -450,7 +450,7 @@ U_CAPI UBool U_EXPORT2
uset_serializedContains(const USerializedSet* set, UChar32 c) {
const uint16_t* array;
- if(set==NULL || (uint32_t)c>0x10ffff) {
+ if(set==nullptr || (uint32_t)c>0x10ffff) {
return false;
}
@@ -506,7 +506,7 @@ uset_serializedContains(const USerializedSet* set, UChar32 c) {
U_CAPI int32_t U_EXPORT2
uset_getSerializedRangeCount(const USerializedSet* set) {
- if(set==NULL) {
+ if(set==nullptr) {
return 0;
}
@@ -519,7 +519,7 @@ uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex,
const uint16_t* array;
int32_t bmpLength, length;
- if(set==NULL || rangeIndex<0 || pStart==NULL || pEnd==NULL) {
+ if(set==nullptr || rangeIndex<0 || pStart==nullptr || pEnd==nullptr) {
return false;
}
@@ -590,7 +590,7 @@ uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex,
// addRemove(USet* set, UChar32 c, int32_t doRemove) {
// int32_t i, length, more;
//
-// if(set==NULL || (uint32_t)c>0x10ffff) {
+// if(set==nullptr || (uint32_t)c>0x10ffff) {
// return false;
// }
//
@@ -646,7 +646,7 @@ uset_getSerializedRange(const USerializedSet* set, int32_t rangeIndex,
// /* reallocate */
// int32_t newCapacity=set->capacity+set->capacity/2+USET_GROW_DELTA;
// UChar32* newArray=(UChar32* )uprv_malloc(newCapacity*4);
-// if(newArray==NULL) {
+// if(newArray==nullptr) {
// return false;
// }
// set->capacity=newCapacity;
diff --git a/thirdparty/icu4c/common/uset_imp.h b/thirdparty/icu4c/common/uset_imp.h
index 7233b9303c..77197aaed7 100644
--- a/thirdparty/icu4c/common/uset_imp.h
+++ b/thirdparty/icu4c/common/uset_imp.h
@@ -58,5 +58,14 @@ typedef struct USetAdder USetAdder;
U_CDECL_END
-#endif
+#ifdef __cplusplus
+
+namespace {
+
+constexpr int32_t USET_CASE_MASK = USET_CASE_INSENSITIVE | USET_ADD_CASE_MAPPINGS;
+} // namespace
+
+#endif // __cplusplus
+
+#endif
diff --git a/thirdparty/icu4c/common/uset_props.cpp b/thirdparty/icu4c/common/uset_props.cpp
index f08e760b10..6f6e0c550f 100644
--- a/thirdparty/icu4c/common/uset_props.cpp
+++ b/thirdparty/icu4c/common/uset_props.cpp
@@ -30,12 +30,12 @@
U_NAMESPACE_USE
U_CAPI USet* U_EXPORT2
-uset_openPattern(const UChar* pattern, int32_t patternLength,
+uset_openPattern(const char16_t* pattern, int32_t patternLength,
UErrorCode* ec)
{
UnicodeString pat(patternLength==-1, pattern, patternLength);
UnicodeSet* set = new UnicodeSet(pat, *ec);
- /* test for NULL */
+ /* test for nullptr */
if(set == 0) {
*ec = U_MEMORY_ALLOCATION_ERROR;
return 0;
@@ -43,19 +43,19 @@ uset_openPattern(const UChar* pattern, int32_t patternLength,
if (U_FAILURE(*ec)) {
delete set;
- set = NULL;
+ set = nullptr;
}
return (USet*) set;
}
U_CAPI USet* U_EXPORT2
-uset_openPatternOptions(const UChar* pattern, int32_t patternLength,
+uset_openPatternOptions(const char16_t* pattern, int32_t patternLength,
uint32_t options,
UErrorCode* ec)
{
UnicodeString pat(patternLength==-1, pattern, patternLength);
- UnicodeSet* set = new UnicodeSet(pat, options, NULL, *ec);
- /* test for NULL */
+ UnicodeSet* set = new UnicodeSet(pat, options, nullptr, *ec);
+ /* test for nullptr */
if(set == 0) {
*ec = U_MEMORY_ALLOCATION_ERROR;
return 0;
@@ -63,7 +63,7 @@ uset_openPatternOptions(const UChar* pattern, int32_t patternLength,
if (U_FAILURE(*ec)) {
delete set;
- set = NULL;
+ set = nullptr;
}
return (USet*) set;
}
@@ -71,20 +71,20 @@ uset_openPatternOptions(const UChar* pattern, int32_t patternLength,
U_CAPI int32_t U_EXPORT2
uset_applyPattern(USet *set,
- const UChar *pattern, int32_t patternLength,
+ const char16_t *pattern, int32_t patternLength,
uint32_t options,
UErrorCode *status){
// status code needs to be checked since we
// dereference it
- if(status == NULL || U_FAILURE(*status)){
+ if(status == nullptr || U_FAILURE(*status)){
return 0;
}
// check only the set paramenter
- // if pattern is NULL or null terminate
+ // if pattern is nullptr or NUL terminated
// UnicodeString constructor takes care of it
- if(set == NULL){
+ if(set == nullptr){
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -93,7 +93,7 @@ uset_applyPattern(USet *set,
ParsePosition pos;
- ((UnicodeSet*) set)->applyPattern(pat, pos, options, NULL, *status);
+ ((UnicodeSet*) set)->applyPattern(pat, pos, options, nullptr, *status);
return pos.getIndex();
}
@@ -106,8 +106,8 @@ uset_applyIntPropertyValue(USet* set,
U_CAPI void U_EXPORT2
uset_applyPropertyAlias(USet* set,
- const UChar *prop, int32_t propLength,
- const UChar *value, int32_t valueLength,
+ const char16_t *prop, int32_t propLength,
+ const char16_t *value, int32_t valueLength,
UErrorCode* ec) {
UnicodeString p(prop, propLength);
@@ -117,19 +117,19 @@ uset_applyPropertyAlias(USet* set,
}
U_CAPI UBool U_EXPORT2
-uset_resemblesPattern(const UChar *pattern, int32_t patternLength,
+uset_resemblesPattern(const char16_t *pattern, int32_t patternLength,
int32_t pos) {
UnicodeString pat(pattern, patternLength);
return ((pos+1) < pat.length() &&
- pat.charAt(pos) == (UChar)91/*[*/) ||
+ pat.charAt(pos) == (char16_t)91/*[*/) ||
UnicodeSet::resemblesPattern(pat, pos);
}
U_CAPI int32_t U_EXPORT2
uset_toPattern(const USet* set,
- UChar* result, int32_t resultCapacity,
+ char16_t* result, int32_t resultCapacity,
UBool escapeUnprintable,
UErrorCode* ec) {
UnicodeString pat;
diff --git a/thirdparty/icu4c/common/usetiter.cpp b/thirdparty/icu4c/common/usetiter.cpp
index 3cdece5500..d24a15ab2d 100644
--- a/thirdparty/icu4c/common/usetiter.cpp
+++ b/thirdparty/icu4c/common/usetiter.cpp
@@ -20,7 +20,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(UnicodeSetIterator)
* @param set set to iterate over
*/
UnicodeSetIterator::UnicodeSetIterator(const UnicodeSet& uSet) {
- cpString = NULL;
+ cpString = nullptr;
reset(uSet);
}
@@ -28,8 +28,8 @@ UnicodeSetIterator::UnicodeSetIterator(const UnicodeSet& uSet) {
* Create an iterator. Convenience for when the contents are to be set later.
*/
UnicodeSetIterator::UnicodeSetIterator() {
- this->set = NULL;
- cpString = NULL;
+ this->set = nullptr;
+ cpString = nullptr;
reset();
}
@@ -49,13 +49,13 @@ UnicodeSetIterator::~UnicodeSetIterator() {
UBool UnicodeSetIterator::next() {
if (nextElement <= endElement) {
codepoint = codepointEnd = nextElement++;
- string = NULL;
+ string = nullptr;
return true;
}
if (range < endRange) {
loadRange(++range);
codepoint = codepointEnd = nextElement++;
- string = NULL;
+ string = nullptr;
return true;
}
@@ -77,7 +77,7 @@ UBool UnicodeSetIterator::next() {
* <br>Note also that the codepointEnd is undefined after calling this method.
*/
UBool UnicodeSetIterator::nextRange() {
- string = NULL;
+ string = nullptr;
if (nextElement <= endElement) {
codepointEnd = endElement;
codepoint = nextElement;
@@ -110,7 +110,7 @@ void UnicodeSetIterator::reset(const UnicodeSet& uSet) {
* Resets to the start, to allow the iteration to start over again.
*/
void UnicodeSetIterator::reset() {
- if (set == NULL) {
+ if (set == nullptr) {
// Set up indices to empty iteration
endRange = -1;
stringCount = 0;
@@ -125,7 +125,7 @@ void UnicodeSetIterator::reset() {
loadRange(range);
}
nextString = 0;
- string = NULL;
+ string = nullptr;
}
void UnicodeSetIterator::loadRange(int32_t iRange) {
@@ -135,11 +135,11 @@ void UnicodeSetIterator::loadRange(int32_t iRange) {
const UnicodeString& UnicodeSetIterator::getString() {
- if (string==NULL && codepoint!=(UChar32)IS_STRING) {
- if (cpString == NULL) {
+ if (string==nullptr && codepoint!=(UChar32)IS_STRING) {
+ if (cpString == nullptr) {
cpString = new UnicodeString();
}
- if (cpString != NULL) {
+ if (cpString != nullptr) {
cpString->setTo((UChar32)codepoint);
}
string = cpString;
diff --git a/thirdparty/icu4c/common/ushape.cpp b/thirdparty/icu4c/common/ushape.cpp
index babbbe52a8..d0ac95e0b2 100644
--- a/thirdparty/icu4c/common/ushape.cpp
+++ b/thirdparty/icu4c/common/ushape.cpp
@@ -31,7 +31,7 @@
/*
* This implementation is designed for 16-bit Unicode strings.
* The main assumption is that the Arabic characters and their
- * presentation forms each fit into a single UChar.
+ * presentation forms each fit into a single char16_t.
* With UTF-8, they occupy 2 or 3 bytes, and more than the ASCII
* characters.
*/
@@ -78,7 +78,7 @@
#define DESHAPE_MODE 1
struct uShapeVariables {
- UChar tailChar;
+ char16_t tailChar;
uint32_t uShapeLamalefBegin;
uint32_t uShapeLamalefEnd;
uint32_t uShapeTashkeelBegin;
@@ -122,7 +122,7 @@ static const uint8_t tashkeelMedial[] = {
/* FE7F */ 1
};
-static const UChar yehHamzaToYeh[] =
+static const char16_t yehHamzaToYeh[] =
{
/* isolated*/ 0xFEEF,
/* final */ 0xFEF0
@@ -134,7 +134,7 @@ static const uint8_t IrrelevantPos[] = {
};
-static const UChar convertLamAlef[] =
+static const char16_t convertLamAlef[] =
{
/*FEF5*/ 0x0622,
/*FEF6*/ 0x0622,
@@ -146,7 +146,7 @@ static const UChar convertLamAlef[] =
/*FEFC*/ 0x0627
};
-static const UChar araLink[178]=
+static const char16_t araLink[178]=
{
1 + 32 + 256 * 0x11,/*0x0622*/
1 + 32 + 256 * 0x13,/*0x0623*/
@@ -294,7 +294,7 @@ static const uint8_t presBLink[]=
/*FEF*/ 1, 0, 1, 2,1 + 2, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0
};
-static const UChar convertFBto06[] =
+static const char16_t convertFBto06[] =
{
/***********0******1******2******3******4******5******6******7******8******9******A******B******C******D******E******F***/
/*FB5*/ 0x671, 0x671, 0x67B, 0x67B, 0x67B, 0x67B, 0x67E, 0x67E, 0x67E, 0x67E, 0, 0, 0, 0, 0x67A, 0x67A,
@@ -310,7 +310,7 @@ static const UChar convertFBto06[] =
/*FBF*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x6CC, 0x6CC, 0x6CC, 0x6CC
};
-static const UChar convertFEto06[] =
+static const char16_t convertFEto06[] =
{
/***********0******1******2******3******4******5******6******7******8******9******A******B******C******D******E******F***/
/*FE7*/ 0x64B, 0x64B, 0x64C, 0x64C, 0x64D, 0x64D, 0x64E, 0x64E, 0x64F, 0x64F, 0x650, 0x650, 0x651, 0x651, 0x652, 0x652,
@@ -339,11 +339,11 @@ static const uint8_t shapeTable[4][4][4]=
* we can safely just work with code units (again, at least UTF-16).
*/
static void
-_shapeToArabicDigitsWithContext(UChar *s, int32_t length,
- UChar digitBase,
+_shapeToArabicDigitsWithContext(char16_t *s, int32_t length,
+ char16_t digitBase,
UBool isLogical, UBool lastStrongWasAL) {
int32_t i;
- UChar c;
+ char16_t c;
digitBase-=0x30;
@@ -361,7 +361,7 @@ _shapeToArabicDigitsWithContext(UChar *s, int32_t length,
break;
case U_EUROPEAN_NUMBER: /* EN */
if(lastStrongWasAL && (uint32_t)(c-0x30)<10) {
- s[i]=(UChar)(digitBase+c); /* digitBase+(c-0x30) - digitBase was modified above */
+ s[i]=(char16_t)(digitBase+c); /* digitBase+(c-0x30) - digitBase was modified above */
}
break;
default :
@@ -381,7 +381,7 @@ _shapeToArabicDigitsWithContext(UChar *s, int32_t length,
break;
case U_EUROPEAN_NUMBER: /* EN */
if(lastStrongWasAL && (uint32_t)(c-0x30)<10) {
- s[i]=(UChar)(digitBase+c); /* digitBase+(c-0x30) - digitBase was modified above */
+ s[i]=(char16_t)(digitBase+c); /* digitBase+(c-0x30) - digitBase was modified above */
}
break;
default :
@@ -398,8 +398,8 @@ _shapeToArabicDigitsWithContext(UChar *s, int32_t length,
* U_SHAPE_TEXT_DIRECTION_LOGICAL
*/
static void
-invertBuffer(UChar *buffer, int32_t size, uint32_t /*options*/, int32_t lowlimit, int32_t highlimit) {
- UChar temp;
+invertBuffer(char16_t *buffer, int32_t size, uint32_t /*options*/, int32_t lowlimit, int32_t highlimit) {
+ char16_t temp;
int32_t i=0,j=0;
for(i=lowlimit,j=size-highlimit-1;i<j;i++,j--) {
temp = buffer[i];
@@ -416,8 +416,8 @@ invertBuffer(UChar *buffer, int32_t size, uint32_t /*options*/, int32_t lowlimit
* later it'll be converted into the 0xFExx LamAlefs
* in the shaping function.
*/
-static inline UChar
-changeLamAlef(UChar ch) {
+static inline char16_t
+changeLamAlef(char16_t ch) {
switch(ch) {
case 0x0622 :
return 0x065C;
@@ -437,8 +437,8 @@ changeLamAlef(UChar ch) {
* Arabic characters have four forms :
* Isolated, Initial, Middle and Final Form
*/
-static UChar
-getLink(UChar ch) {
+static char16_t
+getLink(char16_t ch) {
if(ch >= 0x0622 && ch <= 0x06D3) {
return(araLink[ch-0x0622]);
} else if(ch == 0x200D) {
@@ -460,7 +460,7 @@ getLink(UChar ch) {
* at each end of the logical buffer
*/
static void
-countSpaces(UChar *dest, int32_t size, uint32_t /*options*/, int32_t *spacesCountl, int32_t *spacesCountr) {
+countSpaces(char16_t *dest, int32_t size, uint32_t /*options*/, int32_t *spacesCountl, int32_t *spacesCountr) {
int32_t i = 0;
int32_t countl = 0,countr = 0;
while((dest[i] == SPACE_CHAR) && (countl < size)) {
@@ -482,7 +482,7 @@ countSpaces(UChar *dest, int32_t size, uint32_t /*options*/, int32_t *spacesCoun
*Function : Returns 1 for Tashkeel characters in 06 range else return 0
*/
static inline int32_t
-isTashkeelChar(UChar ch) {
+isTashkeelChar(char16_t ch) {
return (int32_t)( ch>=0x064B && ch<= 0x0652 );
}
@@ -491,7 +491,7 @@ isTashkeelChar(UChar ch) {
*Function : Returns 1 for Tashkeel characters in FE range else return 0
*/
static inline int32_t
-isTashkeelCharFE(UChar ch) {
+isTashkeelCharFE(char16_t ch) {
return (int32_t)( ch>=0xFE70 && ch<= 0xFE7F );
}
@@ -500,7 +500,7 @@ isTashkeelCharFE(UChar ch) {
*Function : Returns 1 for Alef characters else return 0
*/
static inline int32_t
-isAlefChar(UChar ch) {
+isAlefChar(char16_t ch) {
return (int32_t)( (ch==0x0622)||(ch==0x0623)||(ch==0x0625)||(ch==0x0627) );
}
@@ -509,7 +509,7 @@ isAlefChar(UChar ch) {
*Function : Returns 1 for LamAlef characters else return 0
*/
static inline int32_t
-isLamAlefChar(UChar ch) {
+isLamAlefChar(char16_t ch) {
return (int32_t)((ch>=0xFEF5)&&(ch<=0xFEFC) );
}
@@ -519,7 +519,7 @@ isLamAlefChar(UChar ch) {
*/
static inline int32_t
-isTailChar(UChar ch) {
+isTailChar(char16_t ch) {
if(ch == OLD_TAIL_CHAR || ch == NEW_TAIL_CHAR){
return 1;
}else{
@@ -534,7 +534,7 @@ isTailChar(UChar ch) {
*/
static inline int32_t
-isSeenTailFamilyChar(UChar ch) {
+isSeenTailFamilyChar(char16_t ch) {
if(ch >= 0xfeb1 && ch < 0xfebf){
return tailFamilyIsolatedFinal [ch - 0xFEB1];
}else{
@@ -548,7 +548,7 @@ isSeenTailFamilyChar(UChar ch) {
*/
static inline int32_t
-isSeenFamilyChar(UChar ch){
+isSeenFamilyChar(char16_t ch){
if(ch >= 0x633 && ch <= 0x636){
return 1;
}else {
@@ -563,7 +563,7 @@ isSeenFamilyChar(UChar ch){
* otherwise returns 0
*/
static inline int32_t
-isAlefMaksouraChar(UChar ch) {
+isAlefMaksouraChar(char16_t ch) {
return (int32_t)( (ch == 0xFEEF) || ( ch == 0xFEF0) || (ch == 0x0649));
}
@@ -573,7 +573,7 @@ isAlefMaksouraChar(UChar ch) {
* final is found otherwise returns 0
*/
static inline int32_t
-isYehHamzaChar(UChar ch) {
+isYehHamzaChar(char16_t ch) {
if((ch==0xFE89)||(ch==0xFE8A)){
return 1;
}else{
@@ -589,7 +589,7 @@ isYehHamzaChar(UChar ch) {
* returns 0
*/
static inline int32_t
-isTashkeelOnTatweelChar(UChar ch){
+isTashkeelOnTatweelChar(char16_t ch){
if(ch >= 0xfe70 && ch <= 0xfe7f && ch != NEW_TAIL_CHAR && ch != 0xFE75 && ch != SHADDA_TATWEEL_CHAR)
{
return tashkeelMedial [ch - 0xFE70];
@@ -608,7 +608,7 @@ isTashkeelOnTatweelChar(UChar ch){
* returns 2 otherwise returns 0
*/
static inline int32_t
-isIsolatedTashkeelChar(UChar ch){
+isIsolatedTashkeelChar(char16_t ch){
if(ch >= 0xfe70 && ch <= 0xfe7f && ch != NEW_TAIL_CHAR && ch != 0xFE75){
return (1 - tashkeelMedial [ch - 0xFE70]);
}else if(ch >= 0xfc5e && ch <= 0xfc63){
@@ -630,7 +630,7 @@ isIsolatedTashkeelChar(UChar ch){
*/
static int32_t
-calculateSize(const UChar *source, int32_t sourceLength,
+calculateSize(const char16_t *source, int32_t sourceLength,
int32_t destSize,uint32_t options) {
int32_t i = 0;
@@ -687,7 +687,7 @@ int32_t destSize,uint32_t options) {
*
*/
static int32_t
-handleTashkeelWithTatweel(UChar *dest, int32_t sourceLength,
+handleTashkeelWithTatweel(char16_t *dest, int32_t sourceLength,
int32_t /*destSize*/, uint32_t /*options*/,
UErrorCode * /*pErrorCode*/) {
int i;
@@ -725,14 +725,14 @@ handleTashkeelWithTatweel(UChar *dest, int32_t sourceLength,
*/
static int32_t
-handleGeneratedSpaces(UChar *dest, int32_t sourceLength,
+handleGeneratedSpaces(char16_t *dest, int32_t sourceLength,
int32_t destSize,
uint32_t options,
UErrorCode *pErrorCode,struct uShapeVariables shapeVars ) {
int32_t i = 0, j = 0;
int32_t count = 0;
- UChar *tempbuffer=NULL;
+ char16_t *tempbuffer=nullptr;
int lamAlefOption = 0;
int tashkeelOption = 0;
@@ -747,9 +747,9 @@ handleGeneratedSpaces(UChar *dest, int32_t sourceLength,
}
}
- tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR);
- /* Test for NULL */
- if(tempbuffer == NULL) {
+ tempbuffer = (char16_t *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR);
+ /* Test for nullptr */
+ if(tempbuffer == nullptr) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
return 0;
}
@@ -900,15 +900,15 @@ handleGeneratedSpaces(UChar *dest, int32_t sourceLength,
*/
static int32_t
-expandCompositCharAtBegin(UChar *dest, int32_t sourceLength, int32_t destSize,UErrorCode *pErrorCode) {
+expandCompositCharAtBegin(char16_t *dest, int32_t sourceLength, int32_t destSize,UErrorCode *pErrorCode) {
int32_t i = 0,j = 0;
int32_t countl = 0;
- UChar *tempbuffer=NULL;
+ char16_t *tempbuffer=nullptr;
- tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR);
+ tempbuffer = (char16_t *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR);
- /* Test for NULL */
- if(tempbuffer == NULL) {
+ /* Test for nullptr */
+ if(tempbuffer == nullptr) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
return 0;
}
@@ -960,17 +960,17 @@ expandCompositCharAtBegin(UChar *dest, int32_t sourceLength, int32_t destSize,UE
*/
static int32_t
-expandCompositCharAtEnd(UChar *dest, int32_t sourceLength, int32_t destSize,UErrorCode *pErrorCode) {
+expandCompositCharAtEnd(char16_t *dest, int32_t sourceLength, int32_t destSize,UErrorCode *pErrorCode) {
int32_t i = 0,j = 0;
int32_t countr = 0;
int32_t inpsize = sourceLength;
- UChar *tempbuffer=NULL;
- tempbuffer = (UChar *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR);
+ char16_t *tempbuffer=nullptr;
+ tempbuffer = (char16_t *)uprv_malloc((sourceLength+1)*U_SIZEOF_UCHAR);
- /* Test for NULL */
- if(tempbuffer == NULL) {
+ /* Test for nullptr */
+ if(tempbuffer == nullptr) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
return 0;
}
@@ -1027,12 +1027,12 @@ expandCompositCharAtEnd(UChar *dest, int32_t sourceLength, int32_t destSize,UErr
*/
static int32_t
-expandCompositCharAtNear(UChar *dest, int32_t sourceLength, int32_t destSize,UErrorCode *pErrorCode,
+expandCompositCharAtNear(char16_t *dest, int32_t sourceLength, int32_t destSize,UErrorCode *pErrorCode,
int yehHamzaOption, int seenTailOption, int lamAlefOption, struct uShapeVariables shapeVars) {
int32_t i = 0;
- UChar lamalefChar, yehhamzaChar;
+ char16_t lamalefChar, yehhamzaChar;
for(i = 0 ;i<=sourceLength-1;i++) {
if (seenTailOption && isSeenTailFamilyChar(dest[i])) {
@@ -1080,13 +1080,13 @@ expandCompositCharAtNear(UChar *dest, int32_t sourceLength, int32_t destSize,UEr
*/
static int32_t
-expandCompositChar(UChar *dest, int32_t sourceLength,
+expandCompositChar(char16_t *dest, int32_t sourceLength,
int32_t destSize,uint32_t options,
UErrorCode *pErrorCode, int shapingMode,struct uShapeVariables shapeVars) {
int32_t i = 0,j = 0;
- UChar *tempbuffer=NULL;
+ char16_t *tempbuffer=nullptr;
int yehHamzaOption = 0;
int seenTailOption = 0;
int lamAlefOption = 0;
@@ -1154,10 +1154,10 @@ expandCompositChar(UChar *dest, int32_t sourceLength,
if (shapingMode == 1){
if ( (options&U_SHAPE_LAMALEF_MASK) == U_SHAPE_LAMALEF_RESIZE){
destSize = calculateSize(dest,sourceLength,destSize,options);
- tempbuffer = (UChar *)uprv_malloc((destSize+1)*U_SIZEOF_UCHAR);
+ tempbuffer = (char16_t *)uprv_malloc((destSize+1)*U_SIZEOF_UCHAR);
- /* Test for NULL */
- if(tempbuffer == NULL) {
+ /* Test for nullptr */
+ if(tempbuffer == nullptr) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
return 0;
}
@@ -1193,7 +1193,7 @@ expandCompositChar(UChar *dest, int32_t sourceLength,
* arabic Unicode buffer in FExx Range
*/
static int32_t
-shapeUnicode(UChar *dest, int32_t sourceLength,
+shapeUnicode(char16_t *dest, int32_t sourceLength,
int32_t destSize,uint32_t options,
UErrorCode *pErrorCode,
int tashkeelFlag, struct uShapeVariables shapeVars) {
@@ -1204,8 +1204,8 @@ shapeUnicode(UChar *dest, int32_t sourceLength,
unsigned int Shape;
int32_t lamalef_found = 0;
int32_t seenfamFound = 0, yehhamzaFound =0, tashkeelFound = 0;
- UChar prevLink = 0, lastLink = 0, currLink, nextLink = 0;
- UChar wLamalef;
+ char16_t prevLink = 0, lastLink = 0, currLink, nextLink = 0;
+ char16_t wLamalef;
/*
* Converts the input buffer from FExx Range into 06xx Range
@@ -1215,9 +1215,9 @@ shapeUnicode(UChar *dest, int32_t sourceLength,
*/
if ((options & U_SHAPE_PRESERVE_PRESENTATION_MASK) == U_SHAPE_PRESERVE_PRESENTATION_NOOP) {
for (i = 0; i < sourceLength; i++) {
- UChar inputChar = dest[i];
+ char16_t inputChar = dest[i];
if ( (inputChar >= 0xFB50) && (inputChar <= 0xFBFF)) {
- UChar c = convertFBto06 [ (inputChar - 0xFB50) ];
+ char16_t c = convertFBto06 [ (inputChar - 0xFB50) ];
if (c != 0)
dest[i] = c;
} else if ( (inputChar >= 0xFE70) && (inputChar <= 0xFEFC)) {
@@ -1323,12 +1323,12 @@ shapeUnicode(UChar *dest, int32_t sourceLength,
/* to ensure the array index is within the range */
U_ASSERT(dest[i] >= 0x064Bu
&& dest[i]-0x064Bu < UPRV_LENGTHOF(IrrelevantPos));
- dest[i] = 0xFE70 + IrrelevantPos[(dest[i] - 0x064B)] + static_cast<UChar>(Shape);
+ dest[i] = 0xFE70 + IrrelevantPos[(dest[i] - 0x064B)] + static_cast<char16_t>(Shape);
}
}else if ((currLink & APRESENT) > 0) {
- dest[i] = (UChar)(0xFB50 + (currLink >> 8) + Shape);
+ dest[i] = (char16_t)(0xFB50 + (currLink >> 8) + Shape);
}else if ((currLink >> 8) > 0 && (currLink & IRRELEVANT) == 0) {
- dest[i] = (UChar)(0xFE70 + (currLink >> 8) + Shape);
+ dest[i] = (char16_t)(0xFE70 + (currLink >> 8) + Shape);
}
}
}
@@ -1365,7 +1365,7 @@ shapeUnicode(UChar *dest, int32_t sourceLength,
* arabic Unicode buffer in 06xx Range
*/
static int32_t
-deShapeUnicode(UChar *dest, int32_t sourceLength,
+deShapeUnicode(char16_t *dest, int32_t sourceLength,
int32_t destSize,uint32_t options,
UErrorCode *pErrorCode, struct uShapeVariables shapeVars) {
int32_t i = 0;
@@ -1382,9 +1382,9 @@ deShapeUnicode(UChar *dest, int32_t sourceLength,
*/
for(i = 0; i < sourceLength; i++) {
- UChar inputChar = dest[i];
+ char16_t inputChar = dest[i];
if ( (inputChar >= 0xFB50) && (inputChar <= 0xFBFF)) { /* FBxx Arabic range */
- UChar c = convertFBto06 [ (inputChar - 0xFB50) ];
+ char16_t c = convertFBto06 [ (inputChar - 0xFB50) ];
if (c != 0)
dest[i] = c;
} else if( (yehHamzaComposeEnabled == 1) && ((inputChar == HAMZA06_CHAR) || (inputChar == HAMZAFE_CHAR))
@@ -1418,8 +1418,8 @@ deShapeUnicode(UChar *dest, int32_t sourceLength,
*/
U_CAPI int32_t U_EXPORT2
-u_shapeArabic(const UChar *source, int32_t sourceLength,
- UChar *dest, int32_t destCapacity,
+u_shapeArabic(const char16_t *source, int32_t sourceLength,
+ char16_t *dest, int32_t destCapacity,
uint32_t options,
UErrorCode *pErrorCode) {
@@ -1427,12 +1427,12 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
struct uShapeVariables shapeVars = { OLD_TAIL_CHAR,U_SHAPE_LAMALEF_BEGIN,U_SHAPE_LAMALEF_END,U_SHAPE_TASHKEEL_BEGIN,U_SHAPE_TASHKEEL_END,0};
/* usual error checking */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- /* make sure that no reserved options values are used; allow dest==NULL only for preflighting */
- if( source==NULL || sourceLength<-1 || (dest==NULL && destCapacity!=0) || destCapacity<0 ||
+ /* make sure that no reserved options values are used; allow dest==nullptr only for preflighting */
+ if( source==nullptr || sourceLength<-1 || (dest==nullptr && destCapacity!=0) || destCapacity<0 ||
(((options&U_SHAPE_TASHKEEL_MASK) > 0) &&
((options&U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED) == U_SHAPE_LETTERS_SHAPE_TASHKEEL_ISOLATED) ) ||
(((options&U_SHAPE_TASHKEEL_MASK) > 0) &&
@@ -1478,7 +1478,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
}
/* check that source and destination do not overlap */
- if( dest!=NULL &&
+ if( dest!=nullptr &&
((source<=dest && dest<source+sourceLength) ||
(dest<=source && source<dest+destCapacity))) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
@@ -1493,8 +1493,8 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
}
if((options&U_SHAPE_LETTERS_MASK)!=U_SHAPE_LETTERS_NOOP) {
- UChar buffer[300];
- UChar *tempbuffer, *tempsource = NULL;
+ char16_t buffer[300];
+ char16_t *tempbuffer, *tempsource = nullptr;
int32_t outputSize, spacesCountl=0, spacesCountr=0;
if((options&U_SHAPE_AGGREGATE_TASHKEEL_MASK)>0) {
@@ -1507,11 +1507,11 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
int i=logical_order?-1:sourceLength;
int end=logical_order?sourceLength:-1;
int aggregation_possible = 1;
- UChar prev = 0;
- UChar prevLink, currLink = 0;
+ char16_t prev = 0;
+ char16_t prevLink, currLink = 0;
int newSourceLength = 0;
- tempsource = (UChar *)uprv_malloc(2*sourceLength*U_SIZEOF_UCHAR);
- if(tempsource == NULL) {
+ tempsource = (char16_t *)uprv_malloc(2*sourceLength*U_SIZEOF_UCHAR);
+ if(tempsource == nullptr) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
return 0;
}
@@ -1545,7 +1545,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
if(outputSize>destCapacity) {
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
- if (tempsource != NULL) uprv_free(tempsource);
+ if (tempsource != nullptr) uprv_free(tempsource);
return outputSize;
}
@@ -1562,17 +1562,17 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
outputSize=UPRV_LENGTHOF(buffer);
tempbuffer=buffer;
} else {
- tempbuffer = (UChar *)uprv_malloc(outputSize*U_SIZEOF_UCHAR);
+ tempbuffer = (char16_t *)uprv_malloc(outputSize*U_SIZEOF_UCHAR);
- /*Test for NULL*/
- if(tempbuffer == NULL) {
+ /*Test for nullptr*/
+ if(tempbuffer == nullptr) {
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
- if (tempsource != NULL) uprv_free(tempsource);
+ if (tempsource != nullptr) uprv_free(tempsource);
return 0;
}
}
u_memcpy(tempbuffer, source, sourceLength);
- if (tempsource != NULL){
+ if (tempsource != nullptr){
uprv_free(tempsource);
}
@@ -1670,7 +1670,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
* "shape" the digits in-place.
*/
if((options&U_SHAPE_DIGITS_MASK)!=U_SHAPE_DIGITS_NOOP) {
- UChar digitBase;
+ char16_t digitBase;
int32_t i;
/* select the requested digit group */
diff --git a/thirdparty/icu4c/common/usprep.cpp b/thirdparty/icu4c/common/usprep.cpp
index 50d16081d1..fc9d0ac208 100644
--- a/thirdparty/icu4c/common/usprep.cpp
+++ b/thirdparty/icu4c/common/usprep.cpp
@@ -44,7 +44,7 @@ U_CDECL_BEGIN
/*
Static cache for already opened StringPrep profiles
*/
-static UHashtable *SHARED_DATA_HASHTABLE = NULL;
+static UHashtable *SHARED_DATA_HASHTABLE = nullptr;
static icu::UInitOnce gSharedDataInitOnce {};
static UMutex usprepMutex;
@@ -137,8 +137,8 @@ usprep_unload(UStringPrepProfile* data){
static int32_t
usprep_internal_flushCache(UBool noRefCount){
- UStringPrepProfile *profile = NULL;
- UStringPrepKey *key = NULL;
+ UStringPrepProfile *profile = nullptr;
+ UStringPrepKey *key = nullptr;
int32_t pos = UHASH_FIRST;
int32_t deletedNum = 0;
const UHashElement *e;
@@ -148,32 +148,32 @@ usprep_internal_flushCache(UBool noRefCount){
* return 0
*/
umtx_lock(&usprepMutex);
- if (SHARED_DATA_HASHTABLE == NULL) {
+ if (SHARED_DATA_HASHTABLE == nullptr) {
umtx_unlock(&usprepMutex);
return 0;
}
/*creates an enumeration to iterate through every element in the table */
- while ((e = uhash_nextElement(SHARED_DATA_HASHTABLE, &pos)) != NULL)
+ while ((e = uhash_nextElement(SHARED_DATA_HASHTABLE, &pos)) != nullptr)
{
profile = (UStringPrepProfile *) e->value.pointer;
key = (UStringPrepKey *) e->key.pointer;
if ((noRefCount== false && profile->refCount == 0) ||
- noRefCount== true) {
+ noRefCount) {
deletedNum++;
uhash_removeElement(SHARED_DATA_HASHTABLE, e);
/* unload the data */
usprep_unload(profile);
- if(key->name != NULL) {
+ if(key->name != nullptr) {
uprv_free(key->name);
- key->name=NULL;
+ key->name=nullptr;
}
- if(key->path != NULL) {
+ if(key->path != nullptr) {
uprv_free(key->path);
- key->path=NULL;
+ key->path=nullptr;
}
uprv_free(profile);
uprv_free(key);
@@ -192,16 +192,16 @@ usprep_flushCache(){
}
*/
-static UBool U_CALLCONV usprep_cleanup(void){
- if (SHARED_DATA_HASHTABLE != NULL) {
+static UBool U_CALLCONV usprep_cleanup(){
+ if (SHARED_DATA_HASHTABLE != nullptr) {
usprep_internal_flushCache(true);
- if (SHARED_DATA_HASHTABLE != NULL && uhash_count(SHARED_DATA_HASHTABLE) == 0) {
+ if (SHARED_DATA_HASHTABLE != nullptr && uhash_count(SHARED_DATA_HASHTABLE) == 0) {
uhash_close(SHARED_DATA_HASHTABLE);
- SHARED_DATA_HASHTABLE = NULL;
+ SHARED_DATA_HASHTABLE = nullptr;
}
}
gSharedDataInitOnce.reset();
- return (SHARED_DATA_HASHTABLE == NULL);
+ return (SHARED_DATA_HASHTABLE == nullptr);
}
U_CDECL_END
@@ -209,9 +209,9 @@ U_CDECL_END
/** Initializes the cache for resources */
static void U_CALLCONV
createCache(UErrorCode &status) {
- SHARED_DATA_HASHTABLE = uhash_open(hashEntry, compareEntries, NULL, &status);
+ SHARED_DATA_HASHTABLE = uhash_open(hashEntry, compareEntries, nullptr, &status);
if (U_FAILURE(status)) {
- SHARED_DATA_HASHTABLE = NULL;
+ SHARED_DATA_HASHTABLE = nullptr;
}
ucln_common_registerCleanup(UCLN_COMMON_USPREP, usprep_cleanup);
}
@@ -230,18 +230,18 @@ loadData(UStringPrepProfile* profile,
/* load Unicode SPREP data from file */
UTrie _sprepTrie={ 0,0,0,0,0,0,0 };
UDataMemory *dataMemory;
- const int32_t *p=NULL;
+ const int32_t *p=nullptr;
const uint8_t *pb;
UVersionInfo normUnicodeVersion;
int32_t normUniVer, sprepUniVer, normCorrVer;
- if(errorCode==NULL || U_FAILURE(*errorCode)) {
+ if(errorCode==nullptr || U_FAILURE(*errorCode)) {
return 0;
}
/* open the data outside the mutex block */
//TODO: change the path
- dataMemory=udata_openChoice(path, type, name, isSPrepAcceptable, NULL, errorCode);
+ dataMemory=udata_openChoice(path, type, name, isSPrepAcceptable, nullptr, errorCode);
if(U_FAILURE(*errorCode)) {
return false;
}
@@ -259,9 +259,9 @@ loadData(UStringPrepProfile* profile,
/* in the mutex block, set the data for this process */
umtx_lock(&usprepMutex);
- if(profile->sprepData==NULL) {
+ if(profile->sprepData==nullptr) {
profile->sprepData=dataMemory;
- dataMemory=NULL;
+ dataMemory=nullptr;
uprv_memcpy(&profile->indexes, p, sizeof(profile->indexes));
uprv_memcpy(&profile->sprepTrie, &_sprepTrie, sizeof(UTrie));
} else {
@@ -293,8 +293,8 @@ loadData(UStringPrepProfile* profile,
profile->isDataLoaded = true;
/* if a different thread set it first, then close the extra data */
- if(dataMemory!=NULL) {
- udata_close(dataMemory); /* NULL if it was set correctly */
+ if(dataMemory!=nullptr) {
+ udata_close(dataMemory); /* nullptr if it was set correctly */
}
@@ -306,12 +306,12 @@ usprep_getProfile(const char* path,
const char* name,
UErrorCode *status){
- UStringPrepProfile* profile = NULL;
+ UStringPrepProfile* profile = nullptr;
initCache(status);
if(U_FAILURE(*status)){
- return NULL;
+ return nullptr;
}
UStringPrepKey stackKey;
@@ -326,22 +326,22 @@ usprep_getProfile(const char* path,
/* fetch the data from the cache */
umtx_lock(&usprepMutex);
profile = (UStringPrepProfile*) (uhash_get(SHARED_DATA_HASHTABLE,&stackKey));
- if(profile != NULL) {
+ if(profile != nullptr) {
profile->refCount++;
}
umtx_unlock(&usprepMutex);
- if(profile == NULL) {
+ if(profile == nullptr) {
/* else load the data and put the data in the cache */
LocalMemory<UStringPrepProfile> newProfile;
- if(newProfile.allocateInsteadAndReset() == NULL) {
+ if(newProfile.allocateInsteadAndReset() == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
/* load the data */
if(!loadData(newProfile.getAlias(), path, name, _SPREP_DATA_TYPE, status) || U_FAILURE(*status) ){
- return NULL;
+ return nullptr;
}
/* get the options */
@@ -351,20 +351,20 @@ usprep_getProfile(const char* path,
LocalMemory<UStringPrepKey> key;
LocalMemory<char> keyName;
LocalMemory<char> keyPath;
- if( key.allocateInsteadAndReset() == NULL ||
- keyName.allocateInsteadAndCopy(static_cast<int32_t>(uprv_strlen(name)+1)) == NULL ||
- (path != NULL &&
- keyPath.allocateInsteadAndCopy(static_cast<int32_t>(uprv_strlen(path)+1)) == NULL)
+ if( key.allocateInsteadAndReset() == nullptr ||
+ keyName.allocateInsteadAndCopy(static_cast<int32_t>(uprv_strlen(name)+1)) == nullptr ||
+ (path != nullptr &&
+ keyPath.allocateInsteadAndCopy(static_cast<int32_t>(uprv_strlen(path)+1)) == nullptr)
) {
*status = U_MEMORY_ALLOCATION_ERROR;
usprep_unload(newProfile.getAlias());
- return NULL;
+ return nullptr;
}
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) {
+ if(profile != nullptr) {
profile->refCount++;
usprep_unload(newProfile.getAlias());
}
@@ -372,7 +372,7 @@ usprep_getProfile(const char* path,
/* initialize the key members */
key->name = keyName.orphan();
uprv_strcpy(key->name, name);
- if(path != NULL){
+ if(path != nullptr){
key->path = keyPath.orphan();
uprv_strcpy(key->path, path);
}
@@ -393,8 +393,8 @@ usprep_open(const char* path,
const char* name,
UErrorCode* status){
- if(status == NULL || U_FAILURE(*status)){
- return NULL;
+ if(status == nullptr || U_FAILURE(*status)){
+ return nullptr;
}
/* initialize the profile struct members */
@@ -404,20 +404,20 @@ usprep_open(const char* path,
U_CAPI UStringPrepProfile* U_EXPORT2
usprep_openByType(UStringPrepProfileType type,
UErrorCode* status) {
- if(status == NULL || U_FAILURE(*status)){
- return NULL;
+ if(status == nullptr || U_FAILURE(*status)){
+ return nullptr;
}
int32_t index = (int32_t)type;
if (index < 0 || index >= UPRV_LENGTHOF(PROFILE_NAMES)) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
- return usprep_open(NULL, PROFILE_NAMES[index], status);
+ return usprep_open(nullptr, PROFILE_NAMES[index], status);
}
U_CAPI void U_EXPORT2
usprep_close(UStringPrepProfile* profile){
- if(profile==NULL){
+ if(profile==nullptr){
return;
}
@@ -431,11 +431,11 @@ usprep_close(UStringPrepProfile* profile){
}
U_CFUNC void
-uprv_syntaxError(const UChar* rules,
+uprv_syntaxError(const char16_t* rules,
int32_t pos,
int32_t rulesLen,
UParseError* parseError){
- if(parseError == NULL){
+ if(parseError == nullptr){
return;
}
parseError->offset = pos;
@@ -502,11 +502,11 @@ getValues(uint16_t trieWord, int16_t& value, UBool& isIndex){
return type;
}
-// TODO: change to writing to UnicodeString not UChar *
+// TODO: change to writing to UnicodeString not char16_t *
static int32_t
usprep_map( const UStringPrepProfile* profile,
- const UChar* src, int32_t srcLength,
- UChar* dest, int32_t destCapacity,
+ const char16_t* src, int32_t srcLength,
+ char16_t* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
UErrorCode* status ){
@@ -581,7 +581,7 @@ usprep_map( const UStringPrepProfile* profile,
//copy the code point into destination
if(ch <= 0xFFFF){
if(destIndex < destCapacity ){
- dest[destIndex] = (UChar)ch;
+ dest[destIndex] = (char16_t)ch;
}
destIndex++;
}else{
@@ -637,8 +637,8 @@ usprep_map( const UStringPrepProfile* profile,
*/
U_CAPI int32_t U_EXPORT2
usprep_prepare( const UStringPrepProfile* profile,
- const UChar* src, int32_t srcLength,
- UChar* dest, int32_t destCapacity,
+ const char16_t* src, int32_t srcLength,
+ char16_t* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
UErrorCode* status ){
@@ -649,9 +649,9 @@ usprep_prepare( const UStringPrepProfile* profile,
}
//check arguments
- if(profile==NULL ||
- (src==NULL ? srcLength!=0 : srcLength<-1) ||
- (dest==NULL ? destCapacity!=0 : destCapacity<0)) {
+ if(profile==nullptr ||
+ (src==nullptr ? srcLength!=0 : srcLength<-1) ||
+ (dest==nullptr ? destCapacity!=0 : destCapacity<0)) {
*status=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -662,8 +662,8 @@ usprep_prepare( const UStringPrepProfile* profile,
}
// map
UnicodeString s1;
- UChar *b1 = s1.getBuffer(srcLength);
- if(b1==NULL){
+ char16_t *b1 = s1.getBuffer(srcLength);
+ if(b1==nullptr){
*status = U_MEMORY_ALLOCATION_ERROR;
return 0;
}
@@ -675,7 +675,7 @@ usprep_prepare( const UStringPrepProfile* profile,
// redo processing of string
/* we do not have enough room so grow the buffer*/
b1 = s1.getBuffer(b1Len);
- if(b1==NULL){
+ if(b1==nullptr){
*status = U_MEMORY_ALLOCATION_ERROR;
return 0;
}
@@ -706,7 +706,7 @@ usprep_prepare( const UStringPrepProfile* profile,
}
// Prohibit and checkBiDi in one pass
- const UChar *b2 = s2.getBuffer();
+ const char16_t *b2 = s2.getBuffer();
int32_t b2Len = s2.length();
UCharDirection direction=U_CHAR_DIRECTION_COUNT, firstCharDir=U_CHAR_DIRECTION_COUNT;
UBool leftToRight=false, rightToLeft=false;
@@ -746,16 +746,16 @@ usprep_prepare( const UStringPrepProfile* profile,
}
}
}
- if(profile->checkBiDi == true){
+ if(profile->checkBiDi){
// satisfy 2
- if( leftToRight == true && rightToLeft == true){
+ if( leftToRight && rightToLeft){
*status = U_STRINGPREP_CHECK_BIDI_ERROR;
uprv_syntaxError(b2,(rtlPos>ltrPos) ? rtlPos : ltrPos, b2Len, parseError);
return 0;
}
//satisfy 3
- if( rightToLeft == true &&
+ if( rightToLeft &&
!((firstCharDir == U_RIGHT_TO_LEFT || firstCharDir == U_RIGHT_TO_LEFT_ARABIC) &&
(direction == U_RIGHT_TO_LEFT || direction == U_RIGHT_TO_LEFT_ARABIC))
){
@@ -787,7 +787,7 @@ usprep_swap(const UDataSwapper *ds,
/* udata_swapDataHeader checks the arguments */
headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
@@ -809,7 +809,7 @@ usprep_swap(const UDataSwapper *ds,
}
inBytes=(const uint8_t *)inData+headerSize;
- outBytes=(uint8_t *)outData+headerSize;
+ outBytes= (outData == nullptr ) ? nullptr : (uint8_t *)outData+headerSize;
inIndexes=(const int32_t *)inBytes;
diff --git a/thirdparty/icu4c/common/ustack.cpp b/thirdparty/icu4c/common/ustack.cpp
index 8d9e475374..5b15efcd7c 100644
--- a/thirdparty/icu4c/common/ustack.cpp
+++ b/thirdparty/icu4c/common/ustack.cpp
@@ -35,7 +35,7 @@ UStack::UStack(UObjectDeleter *d, UElementsAreEqual *c, int32_t initialCapacity,
UStack::~UStack() {}
-void* UStack::pop(void) {
+void* UStack::pop() {
int32_t n = size() - 1;
void* result = nullptr;
if (n >= 0) {
@@ -44,7 +44,7 @@ void* UStack::pop(void) {
return result;
}
-int32_t UStack::popi(void) {
+int32_t UStack::popi() {
int32_t n = size() - 1;
int32_t result = 0;
if (n >= 0) {
diff --git a/thirdparty/icu4c/common/ustr_cnv.cpp b/thirdparty/icu4c/common/ustr_cnv.cpp
index 97fbc527a3..abcc12f683 100644
--- a/thirdparty/icu4c/common/ustr_cnv.cpp
+++ b/thirdparty/icu4c/common/ustr_cnv.cpp
@@ -32,30 +32,30 @@
/* mutexed access to a shared default converter ----------------------------- */
-static UConverter *gDefaultConverter = NULL;
+static UConverter *gDefaultConverter = nullptr;
U_CAPI UConverter* U_EXPORT2
u_getDefaultConverter(UErrorCode *status)
{
- UConverter *converter = NULL;
+ UConverter *converter = nullptr;
- if (gDefaultConverter != NULL) {
- icu::umtx_lock(NULL);
+ if (gDefaultConverter != nullptr) {
+ icu::umtx_lock(nullptr);
/* need to check to make sure it wasn't taken out from under us */
- if (gDefaultConverter != NULL) {
+ if (gDefaultConverter != nullptr) {
converter = gDefaultConverter;
- gDefaultConverter = NULL;
+ gDefaultConverter = nullptr;
}
- icu::umtx_unlock(NULL);
+ icu::umtx_unlock(nullptr);
}
/* if the cache was empty, create a converter */
- if(converter == NULL) {
- converter = ucnv_open(NULL, status);
+ if(converter == nullptr) {
+ converter = ucnv_open(nullptr, status);
if(U_FAILURE(*status)) {
ucnv_close(converter);
- converter = NULL;
+ converter = nullptr;
}
}
@@ -65,20 +65,20 @@ u_getDefaultConverter(UErrorCode *status)
U_CAPI void U_EXPORT2
u_releaseDefaultConverter(UConverter *converter)
{
- if(gDefaultConverter == NULL) {
- if (converter != NULL) {
+ if(gDefaultConverter == nullptr) {
+ if (converter != nullptr) {
ucnv_reset(converter);
}
ucnv_enableCleanup();
- icu::umtx_lock(NULL);
- if(gDefaultConverter == NULL) {
+ icu::umtx_lock(nullptr);
+ if(gDefaultConverter == nullptr) {
gDefaultConverter = converter;
- converter = NULL;
+ converter = nullptr;
}
- icu::umtx_unlock(NULL);
+ icu::umtx_unlock(nullptr);
}
- if(converter != NULL) {
+ if(converter != nullptr) {
ucnv_close(converter);
}
}
@@ -86,27 +86,27 @@ u_releaseDefaultConverter(UConverter *converter)
U_CAPI void U_EXPORT2
u_flushDefaultConverter()
{
- UConverter *converter = NULL;
+ UConverter *converter = nullptr;
- if (gDefaultConverter != NULL) {
- icu::umtx_lock(NULL);
+ if (gDefaultConverter != nullptr) {
+ icu::umtx_lock(nullptr);
/* need to check to make sure it wasn't taken out from under us */
- if (gDefaultConverter != NULL) {
+ if (gDefaultConverter != nullptr) {
converter = gDefaultConverter;
- gDefaultConverter = NULL;
+ gDefaultConverter = nullptr;
}
- icu::umtx_unlock(NULL);
+ icu::umtx_unlock(nullptr);
}
/* if the cache was populated, flush it */
- if(converter != NULL) {
+ if(converter != nullptr) {
ucnv_close(converter);
}
}
-/* conversions between char* and UChar* ------------------------------------- */
+/* conversions between char* and char16_t* ------------------------------------- */
/* maximum string length for u_uastrcpy() and u_austrcpy() implementations */
#define MAX_STRLEN 0x0FFFFFFF
@@ -128,22 +128,22 @@ static int32_t u_astrnlen(const char *s1, int32_t n)
return len;
}
-U_CAPI UChar* U_EXPORT2
-u_uastrncpy(UChar *ucs1,
+U_CAPI char16_t* U_EXPORT2
+u_uastrncpy(char16_t *ucs1,
const char *s2,
int32_t n)
{
- UChar *target = ucs1;
+ char16_t *target = ucs1;
UErrorCode err = U_ZERO_ERROR;
UConverter *cnv = u_getDefaultConverter(&err);
- if(U_SUCCESS(err) && cnv != NULL) {
+ if(U_SUCCESS(err) && cnv != nullptr) {
ucnv_reset(cnv);
ucnv_toUnicode(cnv,
&target,
ucs1+n,
&s2,
s2+u_astrnlen(s2, n),
- NULL,
+ nullptr,
true,
&err);
ucnv_reset(cnv); /* be good citizens */
@@ -160,13 +160,13 @@ u_uastrncpy(UChar *ucs1,
return ucs1;
}
-U_CAPI UChar* U_EXPORT2
-u_uastrcpy(UChar *ucs1,
+U_CAPI char16_t* U_EXPORT2
+u_uastrcpy(char16_t *ucs1,
const char *s2 )
{
UErrorCode err = U_ZERO_ERROR;
UConverter *cnv = u_getDefaultConverter(&err);
- if(U_SUCCESS(err) && cnv != NULL) {
+ if(U_SUCCESS(err) && cnv != nullptr) {
ucnv_toUChars(cnv,
ucs1,
MAX_STRLEN,
@@ -186,7 +186,7 @@ u_uastrcpy(UChar *ucs1,
/*
returns the minimum of (the length of the null-terminated string) and n.
*/
-static int32_t u_ustrnlen(const UChar *ucs1, int32_t n)
+static int32_t u_ustrnlen(const char16_t *ucs1, int32_t n)
{
int32_t len = 0;
@@ -202,20 +202,20 @@ static int32_t u_ustrnlen(const UChar *ucs1, int32_t n)
U_CAPI char* U_EXPORT2
u_austrncpy(char *s1,
- const UChar *ucs2,
+ const char16_t *ucs2,
int32_t n)
{
char *target = s1;
UErrorCode err = U_ZERO_ERROR;
UConverter *cnv = u_getDefaultConverter(&err);
- if(U_SUCCESS(err) && cnv != NULL) {
+ if(U_SUCCESS(err) && cnv != nullptr) {
ucnv_reset(cnv);
ucnv_fromUnicode(cnv,
&target,
s1+n,
&ucs2,
ucs2+u_ustrnlen(ucs2, n),
- NULL,
+ nullptr,
true,
&err);
ucnv_reset(cnv); /* be good citizens */
@@ -234,11 +234,11 @@ u_austrncpy(char *s1,
U_CAPI char* U_EXPORT2
u_austrcpy(char *s1,
- const UChar *ucs2 )
+ const char16_t *ucs2 )
{
UErrorCode err = U_ZERO_ERROR;
UConverter *cnv = u_getDefaultConverter(&err);
- if(U_SUCCESS(err) && cnv != NULL) {
+ if(U_SUCCESS(err) && cnv != nullptr) {
int32_t len = ucnv_fromUChars(cnv,
s1,
MAX_STRLEN,
diff --git a/thirdparty/icu4c/common/ustr_titlecase_brkiter.cpp b/thirdparty/icu4c/common/ustr_titlecase_brkiter.cpp
index 85dfa0decb..82beaca65b 100644
--- a/thirdparty/icu4c/common/ustr_titlecase_brkiter.cpp
+++ b/thirdparty/icu4c/common/ustr_titlecase_brkiter.cpp
@@ -43,28 +43,28 @@ U_NAMESPACE_BEGIN
class WholeStringBreakIterator : public BreakIterator {
public:
WholeStringBreakIterator() : BreakIterator(), length(0) {}
- ~WholeStringBreakIterator() U_OVERRIDE;
- bool operator==(const BreakIterator&) const U_OVERRIDE;
- WholeStringBreakIterator *clone() const U_OVERRIDE;
+ ~WholeStringBreakIterator() override;
+ bool operator==(const BreakIterator&) const override;
+ WholeStringBreakIterator *clone() const override;
static UClassID U_EXPORT2 getStaticClassID();
- UClassID getDynamicClassID() const U_OVERRIDE;
- CharacterIterator &getText() const U_OVERRIDE;
- UText *getUText(UText *fillIn, UErrorCode &errorCode) const U_OVERRIDE;
- void setText(const UnicodeString &text) U_OVERRIDE;
- void setText(UText *text, UErrorCode &errorCode) U_OVERRIDE;
- void adoptText(CharacterIterator* it) U_OVERRIDE;
- int32_t first() U_OVERRIDE;
- int32_t last() U_OVERRIDE;
- int32_t previous() U_OVERRIDE;
- int32_t next() U_OVERRIDE;
- int32_t current() const U_OVERRIDE;
- int32_t following(int32_t offset) U_OVERRIDE;
- int32_t preceding(int32_t offset) U_OVERRIDE;
- UBool isBoundary(int32_t offset) U_OVERRIDE;
- int32_t next(int32_t n) U_OVERRIDE;
+ UClassID getDynamicClassID() const override;
+ CharacterIterator &getText() const override;
+ UText *getUText(UText *fillIn, UErrorCode &errorCode) const override;
+ void setText(const UnicodeString &text) override;
+ void setText(UText *text, UErrorCode &errorCode) override;
+ void adoptText(CharacterIterator* it) override;
+ int32_t first() override;
+ int32_t last() override;
+ int32_t previous() override;
+ int32_t next() override;
+ int32_t current() const override;
+ int32_t following(int32_t offset) override;
+ int32_t preceding(int32_t offset) override;
+ UBool isBoundary(int32_t offset) override;
+ int32_t next(int32_t n) override;
WholeStringBreakIterator *createBufferClone(void *stackBuffer, int32_t &BufferSize,
- UErrorCode &errorCode) U_OVERRIDE;
- WholeStringBreakIterator &refreshInputText(UText *input, UErrorCode &errorCode) U_OVERRIDE;
+ UErrorCode &errorCode) override;
+ WholeStringBreakIterator &refreshInputText(UText *input, UErrorCode &errorCode) override;
private:
int32_t length;
@@ -165,12 +165,12 @@ BreakIterator *ustrcase_getTitleBreakIterator(
int32_t CaseMap::toTitle(
const char *locale, uint32_t options, BreakIterator *iter,
- const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destCapacity, Edits *edits,
+ const char16_t *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity, Edits *edits,
UErrorCode &errorCode) {
LocalPointer<BreakIterator> ownedIter;
iter = ustrcase_getTitleBreakIterator(nullptr, locale, options, iter, ownedIter, errorCode);
- if(iter==NULL) {
+ if(iter==nullptr) {
return 0;
}
UnicodeString s(srcLength<0, src, srcLength);
@@ -187,8 +187,8 @@ U_NAMESPACE_END
U_NAMESPACE_USE
U_CAPI int32_t U_EXPORT2
-u_strToTitle(UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+u_strToTitle(char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
UBreakIterator *titleIter,
const char *locale,
UErrorCode *pErrorCode) {
@@ -210,13 +210,13 @@ u_strToTitle(UChar *dest, int32_t destCapacity,
U_CAPI int32_t U_EXPORT2
ucasemap_toTitle(UCaseMap *csm,
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
UErrorCode *pErrorCode) {
if (U_FAILURE(*pErrorCode)) {
return 0;
}
- if (csm->iter == NULL) {
+ if (csm->iter == nullptr) {
LocalPointer<BreakIterator> ownedIter;
BreakIterator *iter = ustrcase_getTitleBreakIterator(
nullptr, csm->locale, csm->options, nullptr, ownedIter, *pErrorCode);
@@ -231,7 +231,7 @@ ucasemap_toTitle(UCaseMap *csm,
csm->caseLocale, csm->options, csm->iter,
dest, destCapacity,
src, srcLength,
- ustrcase_internalToTitle, NULL, *pErrorCode);
+ ustrcase_internalToTitle, nullptr, *pErrorCode);
}
#endif // !UCONFIG_NO_BREAK_ITERATION
diff --git a/thirdparty/icu4c/common/ustr_wcs.cpp b/thirdparty/icu4c/common/ustr_wcs.cpp
index 1a6ea2375d..efbbbc2f18 100644
--- a/thirdparty/icu4c/common/ustr_wcs.cpp
+++ b/thirdparty/icu4c/common/ustr_wcs.cpp
@@ -33,7 +33,7 @@
#define _BUFFER_CAPACITY_MULTIPLIER 2
#if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
-// TODO: We should use CharString for char buffers and UnicodeString for UChar buffers.
+// TODO: We should use CharString for char buffers and UnicodeString for char16_t buffers.
// Then we could change this to work only with wchar_t buffers.
static inline UBool
u_growAnyBufferFromStatic(void *context,
@@ -42,7 +42,7 @@ u_growAnyBufferFromStatic(void *context,
// Use char* not void* to avoid the compiler's strict-aliasing assumptions
// and related warnings.
char *newBuffer=(char *)uprv_malloc(reqCapacity*size);
- if(newBuffer!=NULL) {
+ if(newBuffer!=nullptr) {
if(length>0) {
uprv_memcpy(newBuffer, *pBuffer, (size_t)length*size);
}
@@ -57,7 +57,7 @@ u_growAnyBufferFromStatic(void *context,
}
*pBuffer=newBuffer;
- return (UBool)(newBuffer!=NULL);
+ return (UBool)(newBuffer!=nullptr);
}
/* helper function */
@@ -65,7 +65,7 @@ static wchar_t*
_strToWCS(wchar_t *dest,
int32_t destCapacity,
int32_t *pDestLength,
- const UChar *src,
+ const char16_t *src,
int32_t srcLength,
UErrorCode *pErrorCode){
@@ -73,19 +73,19 @@ _strToWCS(wchar_t *dest,
char* tempBuf = stackBuffer;
int32_t tempBufCapacity = _STACK_BUFFER_CAPACITY;
char* tempBufLimit = stackBuffer + tempBufCapacity;
- UConverter* conv = NULL;
+ UConverter* conv = nullptr;
char* saveBuf = tempBuf;
- wchar_t* intTarget=NULL;
+ wchar_t* intTarget=nullptr;
int32_t intTargetCapacity=0;
int count=0,retVal=0;
- const UChar *pSrcLimit =NULL;
- const UChar *pSrc = src;
+ const char16_t *pSrcLimit =nullptr;
+ const char16_t *pSrc = src;
conv = u_getDefaultConverter(pErrorCode);
if(U_FAILURE(*pErrorCode)){
- return NULL;
+ return nullptr;
}
if(srcLength == -1){
@@ -99,7 +99,7 @@ _strToWCS(wchar_t *dest,
*pErrorCode = U_ZERO_ERROR;
/* convert to chars using default converter */
- ucnv_fromUnicode(conv,&tempBuf,tempBufLimit,&pSrc,pSrcLimit,NULL,(UBool)(pSrc==pSrcLimit),pErrorCode);
+ ucnv_fromUnicode(conv,&tempBuf,tempBufLimit,&pSrc,pSrcLimit,nullptr,(UBool)(pSrc==pSrcLimit),pErrorCode);
count =(tempBuf - saveBuf);
/* This should rarely occur */
@@ -170,7 +170,7 @@ _strToWCS(wchar_t *dest,
break;
}else if(retVal== remaining){/* should never occur */
int numWritten = (pIntTarget-intTarget);
- u_growAnyBufferFromStatic(NULL,(void**) &intTarget,
+ u_growAnyBufferFromStatic(nullptr,(void**) &intTarget,
&intTargetCapacity,
intTargetCapacity * _BUFFER_CAPACITY_MULTIPLIER,
numWritten,
@@ -232,20 +232,20 @@ U_CAPI wchar_t* U_EXPORT2
u_strToWCS(wchar_t *dest,
int32_t destCapacity,
int32_t *pDestLength,
- const UChar *src,
+ const char16_t *src,
int32_t srcLength,
UErrorCode *pErrorCode){
/* args check */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)){
- return NULL;
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)){
+ return nullptr;
}
- if( (src==NULL && srcLength!=0) || srcLength < -1 ||
- (destCapacity<0) || (dest == NULL && destCapacity > 0)
+ if( (src==nullptr && srcLength!=0) || srcLength < -1 ||
+ (destCapacity<0) || (dest == nullptr && destCapacity > 0)
) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
#ifdef U_WCHAR_IS_UTF16
@@ -254,13 +254,13 @@ u_strToWCS(wchar_t *dest,
srcLength = u_strlen(src);
}
if(0 < srcLength && srcLength <= destCapacity){
- u_memcpy((UChar *)dest, src, srcLength);
+ u_memcpy((char16_t *)dest, src, srcLength);
}
if(pDestLength){
*pDestLength = srcLength;
}
- u_terminateUChars((UChar *)dest,destCapacity,srcLength,pErrorCode);
+ u_terminateUChars((char16_t *)dest,destCapacity,srcLength,pErrorCode);
return dest;
@@ -279,8 +279,8 @@ u_strToWCS(wchar_t *dest,
#if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
/* helper function */
-static UChar*
-_strFromWCS( UChar *dest,
+static char16_t*
+_strFromWCS( char16_t *dest,
int32_t destCapacity,
int32_t *pDestLength,
const wchar_t *src,
@@ -288,12 +288,12 @@ _strFromWCS( UChar *dest,
UErrorCode *pErrorCode)
{
int32_t retVal =0, count =0 ;
- UConverter* conv = NULL;
- UChar* pTarget = NULL;
- UChar* pTargetLimit = NULL;
- UChar* target = NULL;
+ UConverter* conv = nullptr;
+ char16_t* pTarget = nullptr;
+ char16_t* pTargetLimit = nullptr;
+ char16_t* target = nullptr;
- UChar uStack [_STACK_BUFFER_CAPACITY];
+ char16_t uStack [_STACK_BUFFER_CAPACITY];
wchar_t wStack[_STACK_BUFFER_CAPACITY];
wchar_t* pWStack = wStack;
@@ -303,10 +303,10 @@ _strFromWCS( UChar *dest,
int32_t cStackCap = _STACK_BUFFER_CAPACITY;
char* pCSrc=cStack;
char* pCSave=pCSrc;
- char* pCSrcLimit=NULL;
+ char* pCSrcLimit=nullptr;
const wchar_t* pSrc = src;
- const wchar_t* pSrcLimit = NULL;
+ const wchar_t* pSrcLimit = nullptr;
if(srcLength ==-1){
/* if the wchar_t source is null terminated we can safely
@@ -390,7 +390,7 @@ _strFromWCS( UChar *dest,
/* Should rarely occur */
/* allocate new buffer buffer */
pWStack =(wchar_t*) uprv_malloc(sizeof(wchar_t) * (nulLen + 1));
- if(pWStack==NULL){
+ if(pWStack==nullptr){
*pErrorCode = U_MEMORY_ALLOCATION_ERROR;
goto cleanup;
}
@@ -436,7 +436,7 @@ _strFromWCS( UChar *dest,
conv= u_getDefaultConverter(pErrorCode);
- if(U_FAILURE(*pErrorCode)|| conv==NULL){
+ if(U_FAILURE(*pErrorCode)|| conv==nullptr){
goto cleanup;
}
@@ -445,7 +445,7 @@ _strFromWCS( UChar *dest,
*pErrorCode = U_ZERO_ERROR;
/* convert to stack buffer*/
- ucnv_toUnicode(conv,&pTarget,pTargetLimit,(const char**)&pCSrc,pCSrcLimit,NULL,(UBool)(pCSrc==pCSrcLimit),pErrorCode);
+ ucnv_toUnicode(conv,&pTarget,pTargetLimit,(const char**)&pCSrc,pCSrcLimit,nullptr,(UBool)(pCSrc==pCSrcLimit),pErrorCode);
/* increment count to number written to stack */
count+= pTarget - target;
@@ -482,8 +482,8 @@ cleanup:
}
#endif
-U_CAPI UChar* U_EXPORT2
-u_strFromWCS(UChar *dest,
+U_CAPI char16_t* U_EXPORT2
+u_strFromWCS(char16_t *dest,
int32_t destCapacity,
int32_t *pDestLength,
const wchar_t *src,
@@ -492,24 +492,24 @@ u_strFromWCS(UChar *dest,
{
/* args check */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)){
- return NULL;
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)){
+ return nullptr;
}
- if( (src==NULL && srcLength!=0) || srcLength < -1 ||
- (destCapacity<0) || (dest == NULL && destCapacity > 0)
+ if( (src==nullptr && srcLength!=0) || srcLength < -1 ||
+ (destCapacity<0) || (dest == nullptr && destCapacity > 0)
) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
#ifdef U_WCHAR_IS_UTF16
/* wchar_t is UTF-16 just do a memcpy */
if(srcLength == -1){
- srcLength = u_strlen((const UChar *)src);
+ srcLength = u_strlen((const char16_t *)src);
}
if(0 < srcLength && srcLength <= destCapacity){
- u_memcpy(dest, (const UChar *)src, srcLength);
+ u_memcpy(dest, (const char16_t *)src, srcLength);
}
if(pDestLength){
*pDestLength = srcLength;
diff --git a/thirdparty/icu4c/common/ustrcase.cpp b/thirdparty/icu4c/common/ustrcase.cpp
index 8037c09b4f..537b5ba857 100644
--- a/thirdparty/icu4c/common/ustrcase.cpp
+++ b/thirdparty/icu4c/common/ustrcase.cpp
@@ -51,7 +51,7 @@ int32_t checkOverflowAndEditsError(int32_t destIndex, int32_t destCapacity,
if (U_SUCCESS(errorCode)) {
if (destIndex > destCapacity) {
errorCode = U_BUFFER_OVERFLOW_ERROR;
- } else if (edits != NULL) {
+ } else if (edits != nullptr) {
edits->copyErrorTo(errorCode);
}
}
@@ -60,8 +60,8 @@ int32_t checkOverflowAndEditsError(int32_t destIndex, int32_t destCapacity,
/* Appends a full case mapping result, see UCASE_MAX_STRING_LENGTH. */
inline int32_t
-appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity,
- int32_t result, const UChar *s,
+appendResult(char16_t *dest, int32_t destIndex, int32_t destCapacity,
+ int32_t result, const char16_t *s,
int32_t cpLength, uint32_t options, icu::Edits *edits) {
UChar32 c;
int32_t length;
@@ -69,7 +69,7 @@ appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity,
/* decode the result */
if(result<0) {
/* (not) original code point */
- if(edits!=NULL) {
+ if(edits!=nullptr) {
edits->addUnchanged(cpLength);
}
if(options & U_OMIT_UNCHANGED_TEXT) {
@@ -77,7 +77,7 @@ appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity,
}
c=~result;
if(destIndex<destCapacity && c<=0xffff) { // BMP slightly-fastpath
- dest[destIndex++]=(UChar)c;
+ dest[destIndex++]=(char16_t)c;
return destIndex;
}
length=cpLength;
@@ -86,8 +86,8 @@ appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity,
c=U_SENTINEL;
length=result;
} else if(destIndex<destCapacity && result<=0xffff) { // BMP slightly-fastpath
- dest[destIndex++]=(UChar)result;
- if(edits!=NULL) {
+ dest[destIndex++]=(char16_t)result;
+ if(edits!=nullptr) {
edits->addReplace(cpLength, 1);
}
return destIndex;
@@ -95,7 +95,7 @@ appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity,
c=result;
length=U16_LENGTH(c);
}
- if(edits!=NULL) {
+ if(edits!=nullptr) {
edits->addReplace(cpLength, length);
}
}
@@ -133,7 +133,7 @@ appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity,
}
inline int32_t
-appendUChar(UChar *dest, int32_t destIndex, int32_t destCapacity, UChar c) {
+appendUChar(char16_t *dest, int32_t destIndex, int32_t destCapacity, char16_t c) {
if(destIndex<destCapacity) {
dest[destIndex]=c;
} else if(destIndex==INT32_MAX) {
@@ -143,9 +143,9 @@ appendUChar(UChar *dest, int32_t destIndex, int32_t destCapacity, UChar c) {
}
int32_t
-appendNonEmptyUnchanged(UChar *dest, int32_t destIndex, int32_t destCapacity,
- const UChar *s, int32_t length, uint32_t options, icu::Edits *edits) {
- if(edits!=NULL) {
+appendNonEmptyUnchanged(char16_t *dest, int32_t destIndex, int32_t destCapacity,
+ const char16_t *s, int32_t length, uint32_t options, icu::Edits *edits) {
+ if(edits!=nullptr) {
edits->addUnchanged(length);
}
if(options & U_OMIT_UNCHANGED_TEXT) {
@@ -161,8 +161,8 @@ appendNonEmptyUnchanged(UChar *dest, int32_t destIndex, int32_t destCapacity,
}
inline int32_t
-appendUnchanged(UChar *dest, int32_t destIndex, int32_t destCapacity,
- const UChar *s, int32_t length, uint32_t options, icu::Edits *edits) {
+appendUnchanged(char16_t *dest, int32_t destIndex, int32_t destCapacity,
+ const char16_t *s, int32_t length, uint32_t options, icu::Edits *edits) {
if (length <= 0) {
return destIndex;
}
@@ -189,12 +189,12 @@ utf16_caseContextIterator(void *context, int8_t dir) {
if(dir<0) {
if(csc->start<csc->index) {
- U16_PREV((const UChar *)csc->p, csc->start, csc->index, c);
+ U16_PREV((const char16_t *)csc->p, csc->start, csc->index, c);
return c;
}
} else {
if(csc->index<csc->limit) {
- U16_NEXT((const UChar *)csc->p, csc->index, csc->limit, c);
+ U16_NEXT((const char16_t *)csc->p, csc->index, csc->limit, c);
return c;
}
}
@@ -206,8 +206,8 @@ utf16_caseContextIterator(void *context, int8_t dir) {
* caseLocale < 0: Case-folds [srcStart..srcLimit[.
*/
int32_t toLower(int32_t caseLocale, uint32_t options,
- UChar *dest, int32_t destCapacity,
- const UChar *src, UCaseContext *csc, int32_t srcStart, int32_t srcLimit,
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, UCaseContext *csc, int32_t srcStart, int32_t srcLimit,
icu::Edits *edits, UErrorCode &errorCode) {
const int8_t *latinToLower;
if (caseLocale == UCASE_LOC_ROOT ||
@@ -224,7 +224,7 @@ int32_t toLower(int32_t caseLocale, uint32_t options,
int32_t srcIndex = srcStart;
for (;;) {
// fast path for simple cases
- UChar lead = 0;
+ char16_t lead = 0;
while (srcIndex < srcLimit) {
lead = src[srcIndex];
int32_t delta;
@@ -244,7 +244,7 @@ int32_t toLower(int32_t caseLocale, uint32_t options,
continue;
}
}
- lead += static_cast<UChar>(delta);
+ lead += static_cast<char16_t>(delta);
destIndex = appendUnchanged(dest, destIndex, destCapacity,
src + prev, srcIndex - 1 - prev, options, edits);
if (destIndex >= 0) {
@@ -264,7 +264,7 @@ int32_t toLower(int32_t caseLocale, uint32_t options,
}
// slow path
int32_t cpStart = srcIndex++;
- UChar trail;
+ char16_t trail;
UChar32 c;
if (U16_IS_LEAD(lead) && srcIndex < srcLimit && U16_IS_TRAIL(trail = src[srcIndex])) {
c = U16_GET_SUPPLEMENTARY(lead, trail);
@@ -272,7 +272,7 @@ int32_t toLower(int32_t caseLocale, uint32_t options,
} else {
c = lead;
}
- const UChar *s;
+ const char16_t *s;
if (caseLocale >= 0) {
csc->cpStart = cpStart;
csc->cpLimit = srcIndex;
@@ -304,8 +304,8 @@ int32_t toLower(int32_t caseLocale, uint32_t options,
}
int32_t toUpper(int32_t caseLocale, uint32_t options,
- UChar *dest, int32_t destCapacity,
- const UChar *src, UCaseContext *csc, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, UCaseContext *csc, int32_t srcLength,
icu::Edits *edits, UErrorCode &errorCode) {
const int8_t *latinToUpper;
if (caseLocale == UCASE_LOC_TURKISH) {
@@ -319,7 +319,7 @@ int32_t toUpper(int32_t caseLocale, uint32_t options,
int32_t srcIndex = 0;
for (;;) {
// fast path for simple cases
- UChar lead = 0;
+ char16_t lead = 0;
while (srcIndex < srcLength) {
lead = src[srcIndex];
int32_t delta;
@@ -339,7 +339,7 @@ int32_t toUpper(int32_t caseLocale, uint32_t options,
continue;
}
}
- lead += static_cast<UChar>(delta);
+ lead += static_cast<char16_t>(delta);
destIndex = appendUnchanged(dest, destIndex, destCapacity,
src + prev, srcIndex - 1 - prev, options, edits);
if (destIndex >= 0) {
@@ -360,7 +360,7 @@ int32_t toUpper(int32_t caseLocale, uint32_t options,
// slow path
int32_t cpStart;
csc->cpStart = cpStart = srcIndex++;
- UChar trail;
+ char16_t trail;
UChar32 c;
if (U16_IS_LEAD(lead) && srcIndex < srcLength && U16_IS_TRAIL(trail = src[srcIndex])) {
c = U16_GET_SUPPLEMENTARY(lead, trail);
@@ -369,7 +369,7 @@ int32_t toUpper(int32_t caseLocale, uint32_t options,
c = lead;
}
csc->cpLimit = srcIndex;
- const UChar *s;
+ const char16_t *s;
c = ucase_toFullUpper(c, utf16_caseContextIterator, csc, &s, caseLocale);
if (c >= 0) {
destIndex = appendUnchanged(dest, destIndex, destCapacity,
@@ -413,8 +413,8 @@ namespace {
*
* @return the src index after the titlecased sequence, or the start index if no Dutch IJ
*/
-int32_t maybeTitleDutchIJ(const UChar *src, UChar32 c, int32_t start, int32_t segmentLimit,
- UChar *dest, int32_t &destIndex, int32_t destCapacity, uint32_t options,
+int32_t maybeTitleDutchIJ(const char16_t *src, UChar32 c, int32_t start, int32_t segmentLimit,
+ char16_t *dest, int32_t &destIndex, int32_t destCapacity, uint32_t options,
icu::Edits *edits) {
U_ASSERT(start < segmentLimit);
@@ -427,7 +427,7 @@ int32_t maybeTitleDutchIJ(const UChar *src, UChar32 c, int32_t start, int32_t se
int32_t unchanged2 = 0; // after the j (0 or 1)
// next character after the first letter
- UChar c2 = src[index++];
+ char16_t c2 = src[index++];
// Is the first letter an i/I with accent?
if (c == u'I') {
@@ -492,8 +492,8 @@ int32_t maybeTitleDutchIJ(const UChar *src, UChar32 c, int32_t start, int32_t se
U_CFUNC int32_t U_CALLCONV
ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, BreakIterator *iter,
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
icu::Edits *edits,
UErrorCode &errorCode) {
if (!ustrcase_checkTitleAdjustmentOptions(options, errorCode)) {
@@ -562,7 +562,7 @@ ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, BreakIterator *it
/* titlecase c which is from [titleStart..titleLimit[ */
csc.cpStart=titleStart;
csc.cpLimit=titleLimit;
- const UChar *s;
+ const char16_t *s;
c=ucase_toFullTitle(c, utf16_caseContextIterator, &csc, &s, caseLocale);
destIndex=appendResult(dest, destIndex, destCapacity, c, s,
titleLimit-titleStart, options, edits);
@@ -592,7 +592,7 @@ ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, BreakIterator *it
destIndex+=
toLower(
caseLocale, options,
- dest+destIndex, destCapacity-destIndex,
+ (dest==nullptr) ? nullptr: dest+destIndex, destCapacity-destIndex,
src, &csc, titleLimit, index,
edits, errorCode);
if(errorCode==U_BUFFER_OVERFLOW_ERROR) {
@@ -1079,7 +1079,7 @@ uint32_t getDiacriticData(UChar32 c) {
}
}
-UBool isFollowedByCasedLetter(const UChar *s, int32_t i, int32_t length) {
+UBool isFollowedByCasedLetter(const char16_t *s, int32_t i, int32_t length) {
while (i < length) {
UChar32 c;
U16_NEXT(s, i, length, c);
@@ -1102,8 +1102,8 @@ UBool isFollowedByCasedLetter(const UChar *s, int32_t i, int32_t length) {
* TODO: Try to re-consolidate one way or another with the non-Greek function.
*/
int32_t toUpper(uint32_t options,
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
Edits *edits,
UErrorCode &errorCode) {
int32_t destIndex=0;
@@ -1198,11 +1198,11 @@ int32_t toUpper(uint32_t options,
int32_t newLength = (i2 - i) + numYpogegrammeni;
change |= oldLength != newLength;
if (change) {
- if (edits != NULL) {
+ if (edits != nullptr) {
edits->addReplace(oldLength, newLength);
}
} else {
- if (edits != NULL) {
+ if (edits != nullptr) {
edits->addUnchanged(oldLength);
}
// Write unchanged text?
@@ -1211,7 +1211,7 @@ int32_t toUpper(uint32_t options,
}
if (change) {
- destIndex=appendUChar(dest, destIndex, destCapacity, (UChar)upper);
+ destIndex=appendUChar(dest, destIndex, destCapacity, (char16_t)upper);
if (destIndex >= 0 && (data & HAS_EITHER_DIALYTIKA) != 0) {
destIndex=appendUChar(dest, destIndex, destCapacity, 0x308); // restore or add a dialytika
}
@@ -1228,8 +1228,8 @@ int32_t toUpper(uint32_t options,
}
}
} else {
- const UChar *s;
- c=ucase_toFullUpper(c, NULL, NULL, &s, UCASE_LOC_GREEK);
+ const char16_t *s;
+ c=ucase_toFullUpper(c, nullptr, nullptr, &s, UCASE_LOC_GREEK);
destIndex = appendResult(dest, destIndex, destCapacity, c, s,
nextIndex - i, options, edits);
if (destIndex < 0) {
@@ -1251,8 +1251,8 @@ U_NAMESPACE_END
U_CFUNC int32_t U_CALLCONV
ustrcase_internalToLower(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
icu::Edits *edits,
UErrorCode &errorCode) {
UCaseContext csc=UCASECONTEXT_INITIALIZER;
@@ -1268,8 +1268,8 @@ ustrcase_internalToLower(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_IT
U_CFUNC int32_t U_CALLCONV
ustrcase_internalToUpper(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
icu::Edits *edits,
UErrorCode &errorCode) {
int32_t destIndex;
@@ -1291,8 +1291,8 @@ ustrcase_internalToUpper(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_IT
U_CFUNC int32_t U_CALLCONV
ustrcase_internalFold(int32_t /* caseLocale */, uint32_t options, UCASEMAP_BREAK_ITERATOR_UNUSED
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
icu::Edits *edits,
UErrorCode &errorCode) {
int32_t destIndex = toLower(
@@ -1305,8 +1305,8 @@ ustrcase_internalFold(int32_t /* caseLocale */, uint32_t options, UCASEMAP_BREAK
U_CFUNC int32_t
ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
UStringCaseMapper *stringCaseMapper,
icu::Edits *edits,
UErrorCode &errorCode) {
@@ -1317,8 +1317,8 @@ ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
return 0;
}
if( destCapacity<0 ||
- (dest==NULL && destCapacity>0) ||
- src==NULL ||
+ (dest==nullptr && destCapacity>0) ||
+ src==nullptr ||
srcLength<-1
) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
@@ -1331,7 +1331,7 @@ ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
}
/* check for overlapping source and destination */
- if( dest!=NULL &&
+ if( dest!=nullptr &&
((src>=dest && src<(dest+destCapacity)) ||
(dest>=src && dest<(src+srcLength)))
) {
@@ -1349,12 +1349,12 @@ ustrcase_map(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
U_CFUNC int32_t
ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITERATOR_PARAM
- UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
UStringCaseMapper *stringCaseMapper,
UErrorCode &errorCode) {
- UChar buffer[300];
- UChar *temp;
+ char16_t buffer[300];
+ char16_t *temp;
int32_t destLength;
@@ -1363,8 +1363,8 @@ ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITE
return 0;
}
if( destCapacity<0 ||
- (dest==NULL && destCapacity>0) ||
- src==NULL ||
+ (dest==nullptr && destCapacity>0) ||
+ src==nullptr ||
srcLength<-1
) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
@@ -1377,7 +1377,7 @@ ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITE
}
/* check for overlapping source and destination */
- if( dest!=NULL &&
+ if( dest!=nullptr &&
((src>=dest && src<(dest+destCapacity)) ||
(dest>=src && dest<(src+srcLength)))
) {
@@ -1387,8 +1387,8 @@ ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITE
temp=buffer;
} else {
/* allocate a buffer */
- temp=(UChar *)uprv_malloc(destCapacity*U_SIZEOF_UCHAR);
- if(temp==NULL) {
+ temp=(char16_t *)uprv_malloc(destCapacity*U_SIZEOF_UCHAR);
+ if(temp==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return 0;
}
@@ -1398,7 +1398,7 @@ ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITE
}
destLength=stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR
- temp, destCapacity, src, srcLength, NULL, errorCode);
+ temp, destCapacity, src, srcLength, nullptr, errorCode);
if(temp!=dest) {
/* copy the result string to the destination buffer */
if (U_SUCCESS(errorCode) && 0 < destLength && destLength <= destCapacity) {
@@ -1415,8 +1415,8 @@ ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITE
/* public API functions */
U_CAPI int32_t U_EXPORT2
-u_strFoldCase(UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+u_strFoldCase(char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
uint32_t options,
UErrorCode *pErrorCode) {
return ustrcase_mapWithOverlap(
@@ -1430,8 +1430,8 @@ U_NAMESPACE_BEGIN
int32_t CaseMap::fold(
uint32_t options,
- const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destCapacity, Edits *edits,
+ const char16_t *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity, Edits *edits,
UErrorCode &errorCode) {
return ustrcase_map(
UCASE_LOC_ROOT, options, UCASEMAP_BREAK_ITERATOR_NULL
@@ -1455,7 +1455,7 @@ U_NAMESPACE_END
/* stack element for previous-level source/decomposition pointers */
struct CmpEquivLevel {
- const UChar *start, *s, *limit;
+ const char16_t *start, *s, *limit;
};
typedef struct CmpEquivLevel CmpEquivLevel;
@@ -1464,9 +1464,9 @@ typedef struct CmpEquivLevel CmpEquivLevel;
* This function is called from u_strcmpFold() and u_caseInsensitivePrefixMatch().
*
* @param s1 input string 1
- * @param length1 length of string 1, or -1 (NULL terminated)
+ * @param length1 length of string 1, or -1 (NUL terminated)
* @param s2 input string 2
- * @param length2 length of string 2, or -1 (NULL terminated)
+ * @param length2 length of string 2, or -1 (NUL terminated)
* @param options compare options
* @param matchLen1 (output) length of partial prefix match in s1
* @param matchLen2 (output) length of partial prefix match in s2
@@ -1474,31 +1474,31 @@ typedef struct CmpEquivLevel CmpEquivLevel;
* @return The result of comparison
*/
static int32_t _cmpFold(
- const UChar *s1, int32_t length1,
- const UChar *s2, int32_t length2,
+ const char16_t *s1, int32_t length1,
+ const char16_t *s2, int32_t length2,
uint32_t options,
int32_t *matchLen1, int32_t *matchLen2,
UErrorCode *pErrorCode) {
int32_t cmpRes = 0;
/* current-level start/limit - s1/s2 as current */
- const UChar *start1, *start2, *limit1, *limit2;
+ const char16_t *start1, *start2, *limit1, *limit2;
/* points to the original start address */
- const UChar *org1, *org2;
+ const char16_t *org1, *org2;
/* points to the end of match + 1 */
- const UChar *m1, *m2;
+ const char16_t *m1, *m2;
/* case folding variables */
- const UChar *p;
+ const char16_t *p;
int32_t length;
/* stacks of previous-level start/current/limit */
CmpEquivLevel stack1[2], stack2[2];
/* case folding buffers, only use current-level start/limit */
- UChar fold1[UCASE_MAX_STRING_LENGTH+1], fold2[UCASE_MAX_STRING_LENGTH+1];
+ char16_t fold1[UCASE_MAX_STRING_LENGTH+1], fold2[UCASE_MAX_STRING_LENGTH+1];
/* track which is the current level per string */
int32_t level1, level2;
@@ -1518,21 +1518,21 @@ static int32_t _cmpFold(
/* initialize */
if(matchLen1) {
- U_ASSERT(matchLen2 !=NULL);
+ U_ASSERT(matchLen2 !=nullptr);
*matchLen1=0;
*matchLen2=0;
}
start1=m1=org1=s1;
if(length1==-1) {
- limit1=NULL;
+ limit1=nullptr;
} else {
limit1=s1+length1;
}
start2=m2=org2=s2;
if(length2==-1) {
- limit2=NULL;
+ limit2=nullptr;
} else {
limit2=s2+length2;
}
@@ -1550,7 +1550,7 @@ static int32_t _cmpFold(
if(c1<0) {
/* get next code unit from string 1, post-increment */
for(;;) {
- if(s1==limit1 || ((c1=*s1)==0 && (limit1==NULL || (options&_STRNCMP_STYLE)))) {
+ if(s1==limit1 || ((c1=*s1)==0 && (limit1==nullptr || (options&_STRNCMP_STYLE)))) {
if(level1==0) {
c1=-1;
break;
@@ -1564,7 +1564,7 @@ static int32_t _cmpFold(
do {
--level1;
start1=stack1[level1].start; /*Not uninitialized*/
- } while(start1==NULL);
+ } while(start1==nullptr);
s1=stack1[level1].s; /*Not uninitialized*/
limit1=stack1[level1].limit; /*Not uninitialized*/
}
@@ -1573,7 +1573,7 @@ static int32_t _cmpFold(
if(c2<0) {
/* get next code unit from string 2, post-increment */
for(;;) {
- if(s2==limit2 || ((c2=*s2)==0 && (limit2==NULL || (options&_STRNCMP_STYLE)))) {
+ if(s2==limit2 || ((c2=*s2)==0 && (limit2==nullptr || (options&_STRNCMP_STYLE)))) {
if(level2==0) {
c2=-1;
break;
@@ -1587,7 +1587,7 @@ static int32_t _cmpFold(
do {
--level2;
start2=stack2[level2].start; /*Not uninitialized*/
- } while(start2==NULL);
+ } while(start2==nullptr);
s2=stack2[level2].s; /*Not uninitialized*/
limit2=stack2[level2].limit; /*Not uninitialized*/
}
@@ -1598,7 +1598,7 @@ static int32_t _cmpFold(
* either variable c1, c2 is -1 only if the corresponding string is finished
*/
if(c1==c2) {
- const UChar *next1, *next2;
+ const char16_t *next1, *next2;
if(c1<0) {
cmpRes=0; /* c1==c2==-1 indicating end of strings */
@@ -1614,7 +1614,7 @@ static int32_t _cmpFold(
* has no matching code point in s1, so this implementation returns
* 2 as the prefix match length ("Fu").
*/
- next1=next2=NULL;
+ next1=next2=nullptr;
if(level1==0) {
next1=s1;
} else if(s1==limit1) {
@@ -1629,7 +1629,7 @@ static int32_t _cmpFold(
next1=stack1[0].s;
}
- if (next1!=NULL) {
+ if (next1!=nullptr) {
if(level2==0) {
next2=s2;
} else if(s2==limit2) {
@@ -1638,7 +1638,7 @@ static int32_t _cmpFold(
/* is s2 at the end of the current stack? */
next2=stack2[0].s;
}
- if(next2!=NULL) {
+ if(next2!=nullptr) {
m1=next1;
m2=next2;
}
@@ -1657,7 +1657,7 @@ static int32_t _cmpFold(
/* get complete code points for c1, c2 for lookups if either is a surrogate */
cp1=c1;
if(U_IS_SURROGATE(c1)) {
- UChar c;
+ char16_t c;
if(U_IS_SURROGATE_LEAD(c1)) {
if(s1!=limit1 && U16_IS_TRAIL(c=*s1)) {
@@ -1673,7 +1673,7 @@ static int32_t _cmpFold(
cp2=c2;
if(U_IS_SURROGATE(c2)) {
- UChar c;
+ char16_t c;
if(U_IS_SURROGATE_LEAD(c2)) {
if(s2!=limit2 && U16_IS_TRAIL(c=*s2)) {
@@ -1837,25 +1837,25 @@ static int32_t _cmpFold(
/* internal function */
U_CFUNC int32_t
-u_strcmpFold(const UChar *s1, int32_t length1,
- const UChar *s2, int32_t length2,
+u_strcmpFold(const char16_t *s1, int32_t length1,
+ const char16_t *s2, int32_t length2,
uint32_t options,
UErrorCode *pErrorCode) {
- return _cmpFold(s1, length1, s2, length2, options, NULL, NULL, pErrorCode);
+ return _cmpFold(s1, length1, s2, length2, options, nullptr, nullptr, pErrorCode);
}
/* public API functions */
U_CAPI int32_t U_EXPORT2
-u_strCaseCompare(const UChar *s1, int32_t length1,
- const UChar *s2, int32_t length2,
+u_strCaseCompare(const char16_t *s1, int32_t length1,
+ const char16_t *s2, int32_t length2,
uint32_t options,
UErrorCode *pErrorCode) {
/* argument checking */
if(pErrorCode==0 || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(s1==NULL || length1<-1 || s2==NULL || length2<-1) {
+ if(s1==nullptr || length1<-1 || s2==nullptr || length2<-1) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -1865,7 +1865,7 @@ u_strCaseCompare(const UChar *s1, int32_t length1,
}
U_CAPI int32_t U_EXPORT2
-u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options) {
+u_strcasecmp(const char16_t *s1, const char16_t *s2, uint32_t options) {
UErrorCode errorCode=U_ZERO_ERROR;
return u_strcmpFold(s1, -1, s2, -1,
options|U_COMPARE_IGNORE_CASE,
@@ -1873,7 +1873,7 @@ u_strcasecmp(const UChar *s1, const UChar *s2, uint32_t options) {
}
U_CAPI int32_t U_EXPORT2
-u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options) {
+u_memcasecmp(const char16_t *s1, const char16_t *s2, int32_t length, uint32_t options) {
UErrorCode errorCode=U_ZERO_ERROR;
return u_strcmpFold(s1, length, s2, length,
options|U_COMPARE_IGNORE_CASE,
@@ -1881,7 +1881,7 @@ u_memcasecmp(const UChar *s1, const UChar *s2, int32_t length, uint32_t options)
}
U_CAPI int32_t U_EXPORT2
-u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options) {
+u_strncasecmp(const char16_t *s1, const char16_t *s2, int32_t n, uint32_t options) {
UErrorCode errorCode=U_ZERO_ERROR;
return u_strcmpFold(s1, n, s2, n,
options|(U_COMPARE_IGNORE_CASE|_STRNCMP_STYLE),
@@ -1890,8 +1890,8 @@ u_strncasecmp(const UChar *s1, const UChar *s2, int32_t n, uint32_t options) {
/* internal API - detect length of shared prefix */
U_CAPI void
-u_caseInsensitivePrefixMatch(const UChar *s1, int32_t length1,
- const UChar *s2, int32_t length2,
+u_caseInsensitivePrefixMatch(const char16_t *s1, int32_t length1,
+ const char16_t *s2, int32_t length2,
uint32_t options,
int32_t *matchLen1, int32_t *matchLen2,
UErrorCode *pErrorCode) {
diff --git a/thirdparty/icu4c/common/ustrcase_locale.cpp b/thirdparty/icu4c/common/ustrcase_locale.cpp
index 2ecd24f03e..176add9c51 100644
--- a/thirdparty/icu4c/common/ustrcase_locale.cpp
+++ b/thirdparty/icu4c/common/ustrcase_locale.cpp
@@ -29,7 +29,7 @@
U_CFUNC int32_t
ustrcase_getCaseLocale(const char *locale) {
- if (locale == NULL) {
+ if (locale == nullptr) {
locale = uloc_getDefault();
}
if (*locale == 0) {
@@ -42,8 +42,8 @@ ustrcase_getCaseLocale(const char *locale) {
/* public API functions */
U_CAPI int32_t U_EXPORT2
-u_strToLower(UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+u_strToLower(char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
const char *locale,
UErrorCode *pErrorCode) {
return ustrcase_mapWithOverlap(
@@ -54,8 +54,8 @@ u_strToLower(UChar *dest, int32_t destCapacity,
}
U_CAPI int32_t U_EXPORT2
-u_strToUpper(UChar *dest, int32_t destCapacity,
- const UChar *src, int32_t srcLength,
+u_strToUpper(char16_t *dest, int32_t destCapacity,
+ const char16_t *src, int32_t srcLength,
const char *locale,
UErrorCode *pErrorCode) {
return ustrcase_mapWithOverlap(
@@ -69,8 +69,8 @@ U_NAMESPACE_BEGIN
int32_t CaseMap::toLower(
const char *locale, uint32_t options,
- const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destCapacity, Edits *edits,
+ const char16_t *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity, Edits *edits,
UErrorCode &errorCode) {
return ustrcase_map(
ustrcase_getCaseLocale(locale), options, UCASEMAP_BREAK_ITERATOR_NULL
@@ -81,8 +81,8 @@ int32_t CaseMap::toLower(
int32_t CaseMap::toUpper(
const char *locale, uint32_t options,
- const UChar *src, int32_t srcLength,
- UChar *dest, int32_t destCapacity, Edits *edits,
+ const char16_t *src, int32_t srcLength,
+ char16_t *dest, int32_t destCapacity, Edits *edits,
UErrorCode &errorCode) {
return ustrcase_map(
ustrcase_getCaseLocale(locale), options, UCASEMAP_BREAK_ITERATOR_NULL
diff --git a/thirdparty/icu4c/common/ustrenum.cpp b/thirdparty/icu4c/common/ustrenum.cpp
index 08a1bf29c3..a60b2208f6 100644
--- a/thirdparty/icu4c/common/ustrenum.cpp
+++ b/thirdparty/icu4c/common/ustrenum.cpp
@@ -29,7 +29,7 @@ StringEnumeration::StringEnumeration()
}
StringEnumeration::~StringEnumeration() {
- if (chars != NULL && chars != charsBuffer) {
+ if (chars != nullptr && chars != charsBuffer) {
uprv_free(chars);
}
}
@@ -37,17 +37,17 @@ StringEnumeration::~StringEnumeration() {
// StringEnumeration base class clone() default implementation, does not clone
StringEnumeration *
StringEnumeration::clone() const {
- return NULL;
+ return nullptr;
}
const char *
StringEnumeration::next(int32_t *resultLength, UErrorCode &status) {
const UnicodeString *s=snext(status);
- if(U_SUCCESS(status) && s!=NULL) {
+ if(U_SUCCESS(status) && s!=nullptr) {
unistr=*s;
ensureCharsCapacity(unistr.length()+1, status);
if(U_SUCCESS(status)) {
- if(resultLength!=NULL) {
+ if(resultLength!=nullptr) {
*resultLength=unistr.length();
}
unistr.extract(0, INT32_MAX, chars, charsCapacity, US_INV);
@@ -55,21 +55,21 @@ StringEnumeration::next(int32_t *resultLength, UErrorCode &status) {
}
}
- return NULL;
+ return nullptr;
}
-const UChar *
+const char16_t *
StringEnumeration::unext(int32_t *resultLength, UErrorCode &status) {
const UnicodeString *s=snext(status);
- if(U_SUCCESS(status) && s!=NULL) {
+ if(U_SUCCESS(status) && s!=nullptr) {
unistr=*s;
- if(resultLength!=NULL) {
+ if(resultLength!=nullptr) {
*resultLength=unistr.length();
}
return unistr.getTerminatedBuffer();
}
- return NULL;
+ return nullptr;
}
const UnicodeString *
@@ -90,7 +90,7 @@ StringEnumeration::ensureCharsCapacity(int32_t capacity, UErrorCode &status) {
uprv_free(chars);
}
chars=(char *)uprv_malloc(capacity);
- if(chars==NULL) {
+ if(chars==nullptr) {
chars=charsBuffer;
charsCapacity=sizeof(charsBuffer);
status=U_MEMORY_ALLOCATION_ERROR;
@@ -102,13 +102,13 @@ StringEnumeration::ensureCharsCapacity(int32_t capacity, UErrorCode &status) {
UnicodeString *
StringEnumeration::setChars(const char *s, int32_t length, UErrorCode &status) {
- if(U_SUCCESS(status) && s!=NULL) {
+ if(U_SUCCESS(status) && s!=nullptr) {
if(length<0) {
length=(int32_t)uprv_strlen(s);
}
- UChar *buffer=unistr.getBuffer(length+1);
- if(buffer!=NULL) {
+ char16_t *buffer=unistr.getBuffer(length+1);
+ if(buffer!=nullptr) {
u_charsToUChars(s, buffer, length);
buffer[length]=0;
unistr.releaseBuffer(length);
@@ -118,7 +118,7 @@ StringEnumeration::setChars(const char *s, int32_t length, UErrorCode &status) {
}
}
- return NULL;
+ return nullptr;
}
bool
StringEnumeration::operator==(const StringEnumeration& that)const {
@@ -137,13 +137,13 @@ UStringEnumeration::fromUEnumeration(
UEnumeration *uenumToAdopt, UErrorCode &status) {
if (U_FAILURE(status)) {
uenum_close(uenumToAdopt);
- return NULL;
+ return nullptr;
}
UStringEnumeration *result = new UStringEnumeration(uenumToAdopt);
- if (result == NULL) {
+ if (result == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
uenum_close(uenumToAdopt);
- return NULL;
+ return nullptr;
}
return result;
}
@@ -167,7 +167,7 @@ const char *UStringEnumeration::next(int32_t *resultLength, UErrorCode &status)
const UnicodeString* UStringEnumeration::snext(UErrorCode& status) {
int32_t length;
- const UChar* str = uenum_unext(uenum, &length, &status);
+ const char16_t* str = uenum_unext(uenum, &length, &status);
if (str == 0 || U_FAILURE(status)) {
return 0;
}
@@ -209,7 +209,7 @@ ustrenum_count(UEnumeration* en,
/**
* Wrapper API to make StringEnumeration look like UEnumeration.
*/
-static const UChar* U_CALLCONV
+static const char16_t* U_CALLCONV
ustrenum_unext(UEnumeration* en,
int32_t* resultLength,
UErrorCode* ec)
@@ -243,8 +243,8 @@ ustrenum_reset(UEnumeration* en,
* The StringEnumeration pointer will be stored in 'context'.
*/
static const UEnumeration USTRENUM_VT = {
- NULL,
- NULL, // store StringEnumeration pointer here
+ nullptr,
+ nullptr, // store StringEnumeration pointer here
ustrenum_close,
ustrenum_count,
ustrenum_unext,
@@ -261,17 +261,17 @@ U_CDECL_END
*/
U_CAPI UEnumeration* U_EXPORT2
uenum_openFromStringEnumeration(icu::StringEnumeration* adopted, UErrorCode* ec) {
- UEnumeration* result = NULL;
- if (U_SUCCESS(*ec) && adopted != NULL) {
+ UEnumeration* result = nullptr;
+ if (U_SUCCESS(*ec) && adopted != nullptr) {
result = (UEnumeration*) uprv_malloc(sizeof(UEnumeration));
- if (result == NULL) {
+ if (result == nullptr) {
*ec = U_MEMORY_ALLOCATION_ERROR;
} else {
uprv_memcpy(result, &USTRENUM_VT, sizeof(USTRENUM_VT));
result->context = adopted;
}
}
- if (result == NULL) {
+ if (result == nullptr) {
delete adopted;
}
return result;
@@ -297,15 +297,15 @@ ucharstrenum_count(UEnumeration* en,
return ((UCharStringEnumeration*)en)->count;
}
-static const UChar* U_CALLCONV
+static const char16_t* U_CALLCONV
ucharstrenum_unext(UEnumeration* en,
int32_t* resultLength,
UErrorCode* /*ec*/) {
UCharStringEnumeration *e = (UCharStringEnumeration*) en;
if (e->index >= e->count) {
- return NULL;
+ return nullptr;
}
- const UChar* result = ((const UChar**)e->uenum.context)[e->index++];
+ const char16_t* result = ((const char16_t**)e->uenum.context)[e->index++];
if (resultLength) {
*resultLength = (int32_t)u_strlen(result);
}
@@ -319,7 +319,7 @@ ucharstrenum_next(UEnumeration* en,
UErrorCode* /*ec*/) {
UCharStringEnumeration *e = (UCharStringEnumeration*) en;
if (e->index >= e->count) {
- return NULL;
+ return nullptr;
}
const char* result = ((const char**)e->uenum.context)[e->index++];
if (resultLength) {
@@ -335,8 +335,8 @@ ucharstrenum_reset(UEnumeration* en,
}
static const UEnumeration UCHARSTRENUM_VT = {
- NULL,
- NULL, // store StringEnumeration pointer here
+ nullptr,
+ nullptr, // store StringEnumeration pointer here
ucharstrenum_close,
ucharstrenum_count,
uenum_unextDefault,
@@ -345,8 +345,8 @@ static const UEnumeration UCHARSTRENUM_VT = {
};
static const UEnumeration UCHARSTRENUM_U_VT = {
- NULL,
- NULL, // store StringEnumeration pointer here
+ nullptr,
+ nullptr, // store StringEnumeration pointer here
ucharstrenum_close,
ucharstrenum_count,
ucharstrenum_unext,
@@ -359,10 +359,10 @@ U_CDECL_END
U_CAPI UEnumeration* U_EXPORT2
uenum_openCharStringsEnumeration(const char* const strings[], int32_t count,
UErrorCode* ec) {
- UCharStringEnumeration* result = NULL;
+ UCharStringEnumeration* result = nullptr;
if (U_SUCCESS(*ec) && count >= 0 && (count == 0 || strings != 0)) {
result = (UCharStringEnumeration*) uprv_malloc(sizeof(UCharStringEnumeration));
- if (result == NULL) {
+ if (result == nullptr) {
*ec = U_MEMORY_ALLOCATION_ERROR;
} else {
U_ASSERT((char*)result==(char*)(&result->uenum));
@@ -376,12 +376,12 @@ uenum_openCharStringsEnumeration(const char* const strings[], int32_t count,
}
U_CAPI UEnumeration* U_EXPORT2
-uenum_openUCharStringsEnumeration(const UChar* const strings[], int32_t count,
+uenum_openUCharStringsEnumeration(const char16_t* const strings[], int32_t count,
UErrorCode* ec) {
- UCharStringEnumeration* result = NULL;
+ UCharStringEnumeration* result = nullptr;
if (U_SUCCESS(*ec) && count >= 0 && (count == 0 || strings != 0)) {
result = (UCharStringEnumeration*) uprv_malloc(sizeof(UCharStringEnumeration));
- if (result == NULL) {
+ if (result == nullptr) {
*ec = U_MEMORY_ALLOCATION_ERROR;
} else {
U_ASSERT((char*)result==(char*)(&result->uenum));
diff --git a/thirdparty/icu4c/common/ustrenum.h b/thirdparty/icu4c/common/ustrenum.h
index 3703dedb97..ff546ca0a1 100644
--- a/thirdparty/icu4c/common/ustrenum.h
+++ b/thirdparty/icu4c/common/ustrenum.h
@@ -53,9 +53,9 @@ public:
/**
* Returns the next element a UnicodeString*. If there are no
- * more elements, returns NULL.
+ * more elements, returns nullptr.
* @param status the error code.
- * @return a pointer to the string, or NULL.
+ * @return a pointer to the string, or nullptr.
*/
virtual const UnicodeString* snext(UErrorCode& status) override;
diff --git a/thirdparty/icu4c/common/ustrfmt.cpp b/thirdparty/icu4c/common/ustrfmt.cpp
index 1a9b15a59f..3db9f35821 100644
--- a/thirdparty/icu4c/common/ustrfmt.cpp
+++ b/thirdparty/icu4c/common/ustrfmt.cpp
@@ -12,11 +12,11 @@
/***
- * Fills in a UChar* string with the radix-based representation of a
+ * Fills in a char16_t* string with the radix-based representation of a
* uint32_t number padded with zeroes to minwidth. The result
* will be null terminated if there is room.
*
- * @param buffer UChar buffer to receive result
+ * @param buffer char16_t buffer to receive result
* @param capacity capacity of buffer
* @param i the unsigned number to be formatted
* @param radix the radix from 2..36
@@ -27,26 +27,26 @@
* null
*/
U_CAPI int32_t U_EXPORT2
-uprv_itou (UChar * buffer, int32_t capacity,
+uprv_itou (char16_t * buffer, int32_t capacity,
uint32_t i, uint32_t radix, int32_t minwidth)
{
int32_t length = 0;
int digit;
int32_t j;
- UChar temp;
+ char16_t temp;
do{
digit = (int)(i % radix);
- buffer[length++]=(UChar)(digit<=9?(0x0030+digit):(0x0030+digit+7));
+ buffer[length++]=(char16_t)(digit<=9?(0x0030+digit):(0x0030+digit+7));
i=i/radix;
} while(i && length<capacity);
while (length < minwidth){
- buffer[length++] = (UChar) 0x0030;/*zero padding */
+ buffer[length++] = (char16_t) 0x0030;/*zero padding */
}
/* null terminate the buffer */
if(length<capacity){
- buffer[length] = (UChar) 0x0000;
+ buffer[length] = (char16_t) 0x0000;
}
/* Reverses the string */
diff --git a/thirdparty/icu4c/common/ustring.cpp b/thirdparty/icu4c/common/ustring.cpp
index 5804976ef9..4f7443cc88 100644
--- a/thirdparty/icu4c/common/ustring.cpp
+++ b/thirdparty/icu4c/common/ustring.cpp
@@ -29,7 +29,7 @@
/* ANSI string.h - style functions ------------------------------------------ */
-/* U+ffff is the highest BMP code point, the highest one that fits into a 16-bit UChar */
+/* U+ffff is the highest BMP code point, the highest one that fits into a 16-bit char16_t */
#define U_BMP_MAX 0xffff
/* Forward binary string search functions ----------------------------------- */
@@ -37,10 +37,10 @@
/*
* Test if a substring match inside a string is at code point boundaries.
* All pointers refer to the same buffer.
- * The limit pointer may be NULL, all others must be real pointers.
+ * The limit pointer may be nullptr, all others must be real pointers.
*/
static inline UBool
-isMatchAtCPBoundary(const UChar *start, const UChar *match, const UChar *matchLimit, const UChar *limit) {
+isMatchAtCPBoundary(const char16_t *start, const char16_t *match, const char16_t *matchLimit, const char16_t *limit) {
if(U16_IS_TRAIL(*match) && start!=match && U16_IS_LEAD(*(match-1))) {
/* the leading edge of the match is in the middle of a surrogate pair */
return false;
@@ -52,17 +52,17 @@ isMatchAtCPBoundary(const UChar *start, const UChar *match, const UChar *matchLi
return true;
}
-U_CAPI UChar * U_EXPORT2
-u_strFindFirst(const UChar *s, int32_t length,
- const UChar *sub, int32_t subLength) {
- const UChar *start, *p, *q, *subLimit;
- UChar c, cs, cq;
+U_CAPI char16_t * U_EXPORT2
+u_strFindFirst(const char16_t *s, int32_t length,
+ const char16_t *sub, int32_t subLength) {
+ const char16_t *start, *p, *q, *subLimit;
+ char16_t c, cs, cq;
- if(sub==NULL || subLength<-1) {
- return (UChar *)s;
+ if(sub==nullptr || subLength<-1) {
+ return (char16_t *)s;
}
- if(s==NULL || length<-1) {
- return NULL;
+ if(s==nullptr || length<-1) {
+ return nullptr;
}
start=s;
@@ -70,7 +70,7 @@ u_strFindFirst(const UChar *s, int32_t length,
if(length<0 && subLength<0) {
/* both strings are NUL-terminated */
if((cs=*sub++)==0) {
- return (UChar *)s;
+ return (char16_t *)s;
}
if(*sub==0 && !U16_IS_SURROGATE(cs)) {
/* the substring consists of a single, non-surrogate BMP code point */
@@ -79,19 +79,19 @@ u_strFindFirst(const UChar *s, int32_t length,
while((c=*s++)!=0) {
if(c==cs) {
- /* found first substring UChar, compare rest */
+ /* found first substring char16_t, compare rest */
p=s;
q=sub;
for(;;) {
if((cq=*q)==0) {
- if(isMatchAtCPBoundary(start, s-1, p, NULL)) {
- return (UChar *)(s-1); /* well-formed match */
+ if(isMatchAtCPBoundary(start, s-1, p, nullptr)) {
+ return (char16_t *)(s-1); /* well-formed match */
} else {
break; /* no match because surrogate pair is split */
}
}
if((c=*p)==0) {
- return NULL; /* no match, and none possible after s */
+ return nullptr; /* no match, and none possible after s */
}
if(c!=cq) {
break; /* no match */
@@ -103,14 +103,14 @@ u_strFindFirst(const UChar *s, int32_t length,
}
/* not found */
- return NULL;
+ return nullptr;
}
if(subLength<0) {
subLength=u_strlen(sub);
}
if(subLength==0) {
- return (UChar *)s;
+ return (char16_t *)s;
}
/* get sub[0] to search for it fast */
@@ -127,19 +127,19 @@ u_strFindFirst(const UChar *s, int32_t length,
/* s is NUL-terminated */
while((c=*s++)!=0) {
if(c==cs) {
- /* found first substring UChar, compare rest */
+ /* found first substring char16_t, compare rest */
p=s;
q=sub;
for(;;) {
if(q==subLimit) {
- if(isMatchAtCPBoundary(start, s-1, p, NULL)) {
- return (UChar *)(s-1); /* well-formed match */
+ if(isMatchAtCPBoundary(start, s-1, p, nullptr)) {
+ return (char16_t *)(s-1); /* well-formed match */
} else {
break; /* no match because surrogate pair is split */
}
}
if((c=*p)==0) {
- return NULL; /* no match, and none possible after s */
+ return nullptr; /* no match, and none possible after s */
}
if(c!=*q) {
break; /* no match */
@@ -150,11 +150,11 @@ u_strFindFirst(const UChar *s, int32_t length,
}
}
} else {
- const UChar *limit, *preLimit;
+ const char16_t *limit, *preLimit;
/* subLength was decremented above */
if(length<=subLength) {
- return NULL; /* s is shorter than sub */
+ return nullptr; /* s is shorter than sub */
}
limit=s+length;
@@ -165,13 +165,13 @@ u_strFindFirst(const UChar *s, int32_t length,
while(s!=preLimit) {
c=*s++;
if(c==cs) {
- /* found first substring UChar, compare rest */
+ /* found first substring char16_t, compare rest */
p=s;
q=sub;
for(;;) {
if(q==subLimit) {
if(isMatchAtCPBoundary(start, s-1, p, limit)) {
- return (UChar *)(s-1); /* well-formed match */
+ return (char16_t *)(s-1); /* well-formed match */
} else {
break; /* no match because surrogate pair is split */
}
@@ -187,113 +187,113 @@ u_strFindFirst(const UChar *s, int32_t length,
}
/* not found */
- return NULL;
+ return nullptr;
}
-U_CAPI UChar * U_EXPORT2
-u_strstr(const UChar *s, const UChar *substring) {
+U_CAPI char16_t * U_EXPORT2
+u_strstr(const char16_t *s, const char16_t *substring) {
return u_strFindFirst(s, -1, substring, -1);
}
-U_CAPI UChar * U_EXPORT2
-u_strchr(const UChar *s, UChar c) {
+U_CAPI char16_t * U_EXPORT2
+u_strchr(const char16_t *s, char16_t c) {
if(U16_IS_SURROGATE(c)) {
/* make sure to not find half of a surrogate pair */
return u_strFindFirst(s, -1, &c, 1);
} else {
- UChar cs;
+ char16_t cs;
/* trivial search for a BMP code point */
for(;;) {
if((cs=*s)==c) {
- return (UChar *)s;
+ return (char16_t *)s;
}
if(cs==0) {
- return NULL;
+ return nullptr;
}
++s;
}
}
}
-U_CAPI UChar * U_EXPORT2
-u_strchr32(const UChar *s, UChar32 c) {
+U_CAPI char16_t * U_EXPORT2
+u_strchr32(const char16_t *s, UChar32 c) {
if((uint32_t)c<=U_BMP_MAX) {
/* find BMP code point */
- return u_strchr(s, (UChar)c);
+ return u_strchr(s, (char16_t)c);
} else if((uint32_t)c<=UCHAR_MAX_VALUE) {
/* find supplementary code point as surrogate pair */
- UChar cs, lead=U16_LEAD(c), trail=U16_TRAIL(c);
+ char16_t cs, lead=U16_LEAD(c), trail=U16_TRAIL(c);
while((cs=*s++)!=0) {
if(cs==lead && *s==trail) {
- return (UChar *)(s-1);
+ return (char16_t *)(s-1);
}
}
- return NULL;
+ return nullptr;
} else {
/* not a Unicode code point, not findable */
- return NULL;
+ return nullptr;
}
}
-U_CAPI UChar * U_EXPORT2
-u_memchr(const UChar *s, UChar c, int32_t count) {
+U_CAPI char16_t * U_EXPORT2
+u_memchr(const char16_t *s, char16_t c, int32_t count) {
if(count<=0) {
- return NULL; /* no string */
+ return nullptr; /* no string */
} else if(U16_IS_SURROGATE(c)) {
/* make sure to not find half of a surrogate pair */
return u_strFindFirst(s, count, &c, 1);
} else {
/* trivial search for a BMP code point */
- const UChar *limit=s+count;
+ const char16_t *limit=s+count;
do {
if(*s==c) {
- return (UChar *)s;
+ return (char16_t *)s;
}
} while(++s!=limit);
- return NULL;
+ return nullptr;
}
}
-U_CAPI UChar * U_EXPORT2
-u_memchr32(const UChar *s, UChar32 c, int32_t count) {
+U_CAPI char16_t * U_EXPORT2
+u_memchr32(const char16_t *s, UChar32 c, int32_t count) {
if((uint32_t)c<=U_BMP_MAX) {
/* find BMP code point */
- return u_memchr(s, (UChar)c, count);
+ return u_memchr(s, (char16_t)c, count);
} else if(count<2) {
/* too short for a surrogate pair */
- return NULL;
+ return nullptr;
} else if((uint32_t)c<=UCHAR_MAX_VALUE) {
/* find supplementary code point as surrogate pair */
- const UChar *limit=s+count-1; /* -1 so that we do not need a separate check for the trail unit */
- UChar lead=U16_LEAD(c), trail=U16_TRAIL(c);
+ const char16_t *limit=s+count-1; /* -1 so that we do not need a separate check for the trail unit */
+ char16_t lead=U16_LEAD(c), trail=U16_TRAIL(c);
do {
if(*s==lead && *(s+1)==trail) {
- return (UChar *)s;
+ return (char16_t *)s;
}
} while(++s!=limit);
- return NULL;
+ return nullptr;
} else {
/* not a Unicode code point, not findable */
- return NULL;
+ return nullptr;
}
}
/* Backward binary string search functions ---------------------------------- */
-U_CAPI UChar * U_EXPORT2
-u_strFindLast(const UChar *s, int32_t length,
- const UChar *sub, int32_t subLength) {
- const UChar *start, *limit, *p, *q, *subLimit;
- UChar c, cs;
+U_CAPI char16_t * U_EXPORT2
+u_strFindLast(const char16_t *s, int32_t length,
+ const char16_t *sub, int32_t subLength) {
+ const char16_t *start, *limit, *p, *q, *subLimit;
+ char16_t c, cs;
- if(sub==NULL || subLength<-1) {
- return (UChar *)s;
+ if(sub==nullptr || subLength<-1) {
+ return (char16_t *)s;
}
- if(s==NULL || length<-1) {
- return NULL;
+ if(s==nullptr || length<-1) {
+ return nullptr;
}
/*
@@ -310,7 +310,7 @@ u_strFindLast(const UChar *s, int32_t length,
subLength=u_strlen(sub);
}
if(subLength==0) {
- return (UChar *)s;
+ return (char16_t *)s;
}
/* get sub[subLength-1] to search for it fast */
@@ -329,7 +329,7 @@ u_strFindLast(const UChar *s, int32_t length,
/* subLength was decremented above */
if(length<=subLength) {
- return NULL; /* s is shorter than sub */
+ return nullptr; /* s is shorter than sub */
}
start=s;
@@ -341,13 +341,13 @@ u_strFindLast(const UChar *s, int32_t length,
while(s!=limit) {
c=*(--limit);
if(c==cs) {
- /* found last substring UChar, compare rest */
+ /* found last substring char16_t, compare rest */
p=limit;
q=subLimit;
for(;;) {
if(q==sub) {
if(isMatchAtCPBoundary(start, p, limit+1, start+length)) {
- return (UChar *)p; /* well-formed match */
+ return (char16_t *)p; /* well-formed match */
} else {
break; /* no match because surrogate pair is split */
}
@@ -360,22 +360,22 @@ u_strFindLast(const UChar *s, int32_t length,
}
/* not found */
- return NULL;
+ return nullptr;
}
-U_CAPI UChar * U_EXPORT2
-u_strrstr(const UChar *s, const UChar *substring) {
+U_CAPI char16_t * U_EXPORT2
+u_strrstr(const char16_t *s, const char16_t *substring) {
return u_strFindLast(s, -1, substring, -1);
}
-U_CAPI UChar * U_EXPORT2
-u_strrchr(const UChar *s, UChar c) {
+U_CAPI char16_t * U_EXPORT2
+u_strrchr(const char16_t *s, char16_t c) {
if(U16_IS_SURROGATE(c)) {
/* make sure to not find half of a surrogate pair */
return u_strFindLast(s, -1, &c, 1);
} else {
- const UChar *result=NULL;
- UChar cs;
+ const char16_t *result=nullptr;
+ char16_t cs;
/* trivial search for a BMP code point */
for(;;) {
@@ -383,76 +383,76 @@ u_strrchr(const UChar *s, UChar c) {
result=s;
}
if(cs==0) {
- return (UChar *)result;
+ return (char16_t *)result;
}
++s;
}
}
}
-U_CAPI UChar * U_EXPORT2
-u_strrchr32(const UChar *s, UChar32 c) {
+U_CAPI char16_t * U_EXPORT2
+u_strrchr32(const char16_t *s, UChar32 c) {
if((uint32_t)c<=U_BMP_MAX) {
/* find BMP code point */
- return u_strrchr(s, (UChar)c);
+ return u_strrchr(s, (char16_t)c);
} else if((uint32_t)c<=UCHAR_MAX_VALUE) {
/* find supplementary code point as surrogate pair */
- const UChar *result=NULL;
- UChar cs, lead=U16_LEAD(c), trail=U16_TRAIL(c);
+ const char16_t *result=nullptr;
+ char16_t cs, lead=U16_LEAD(c), trail=U16_TRAIL(c);
while((cs=*s++)!=0) {
if(cs==lead && *s==trail) {
result=s-1;
}
}
- return (UChar *)result;
+ return (char16_t *)result;
} else {
/* not a Unicode code point, not findable */
- return NULL;
+ return nullptr;
}
}
-U_CAPI UChar * U_EXPORT2
-u_memrchr(const UChar *s, UChar c, int32_t count) {
+U_CAPI char16_t * U_EXPORT2
+u_memrchr(const char16_t *s, char16_t c, int32_t count) {
if(count<=0) {
- return NULL; /* no string */
+ return nullptr; /* no string */
} else if(U16_IS_SURROGATE(c)) {
/* make sure to not find half of a surrogate pair */
return u_strFindLast(s, count, &c, 1);
} else {
/* trivial search for a BMP code point */
- const UChar *limit=s+count;
+ const char16_t *limit=s+count;
do {
if(*(--limit)==c) {
- return (UChar *)limit;
+ return (char16_t *)limit;
}
} while(s!=limit);
- return NULL;
+ return nullptr;
}
}
-U_CAPI UChar * U_EXPORT2
-u_memrchr32(const UChar *s, UChar32 c, int32_t count) {
+U_CAPI char16_t * U_EXPORT2
+u_memrchr32(const char16_t *s, UChar32 c, int32_t count) {
if((uint32_t)c<=U_BMP_MAX) {
/* find BMP code point */
- return u_memrchr(s, (UChar)c, count);
+ return u_memrchr(s, (char16_t)c, count);
} else if(count<2) {
/* too short for a surrogate pair */
- return NULL;
+ return nullptr;
} else if((uint32_t)c<=UCHAR_MAX_VALUE) {
/* find supplementary code point as surrogate pair */
- const UChar *limit=s+count-1;
- UChar lead=U16_LEAD(c), trail=U16_TRAIL(c);
+ const char16_t *limit=s+count-1;
+ char16_t lead=U16_LEAD(c), trail=U16_TRAIL(c);
do {
if(*limit==trail && *(limit-1)==lead) {
- return (UChar *)(limit-1);
+ return (char16_t *)(limit-1);
}
} while(s!=--limit);
- return NULL;
+ return nullptr;
} else {
/* not a Unicode code point, not findable */
- return NULL;
+ return nullptr;
}
}
@@ -465,10 +465,10 @@ u_memrchr32(const UChar *s, UChar32 c, int32_t count) {
* Return -(string length)-1 if there is no such code point.
*/
static int32_t
-_matchFromSet(const UChar *string, const UChar *matchSet, UBool polarity) {
+_matchFromSet(const char16_t *string, const char16_t *matchSet, UBool polarity) {
int32_t matchLen, matchBMPLen, strItr, matchItr;
UChar32 stringCh, matchCh;
- UChar c, c2;
+ char16_t c, c2;
/* first part of matchSet contains only BMP code points */
matchBMPLen = 0;
@@ -537,20 +537,20 @@ endloop:
}
/* Search for a codepoint in a string that matches one of the matchSet codepoints. */
-U_CAPI UChar * U_EXPORT2
-u_strpbrk(const UChar *string, const UChar *matchSet)
+U_CAPI char16_t * U_EXPORT2
+u_strpbrk(const char16_t *string, const char16_t *matchSet)
{
int32_t idx = _matchFromSet(string, matchSet, true);
if(idx >= 0) {
- return (UChar *)string + idx;
+ return (char16_t *)string + idx;
} else {
- return NULL;
+ return nullptr;
}
}
/* Search for a codepoint in a string that matches one of the matchSet codepoints. */
U_CAPI int32_t U_EXPORT2
-u_strcspn(const UChar *string, const UChar *matchSet)
+u_strcspn(const char16_t *string, const char16_t *matchSet)
{
int32_t idx = _matchFromSet(string, matchSet, true);
if(idx >= 0) {
@@ -562,7 +562,7 @@ u_strcspn(const UChar *string, const UChar *matchSet)
/* Search for a codepoint in a string that does not match one of the matchSet codepoints. */
U_CAPI int32_t U_EXPORT2
-u_strspn(const UChar *string, const UChar *matchSet)
+u_strspn(const char16_t *string, const char16_t *matchSet)
{
int32_t idx = _matchFromSet(string, matchSet, false);
if(idx >= 0) {
@@ -574,17 +574,17 @@ u_strspn(const UChar *string, const UChar *matchSet)
/* ----- Text manipulation functions --- */
-U_CAPI UChar* U_EXPORT2
-u_strtok_r(UChar *src,
- const UChar *delim,
- UChar **saveState)
+U_CAPI char16_t* U_EXPORT2
+u_strtok_r(char16_t *src,
+ const char16_t *delim,
+ char16_t **saveState)
{
- UChar *tokSource;
- UChar *nextToken;
+ char16_t *tokSource;
+ char16_t *nextToken;
uint32_t nonDelimIdx;
- /* If saveState is NULL, the user messed up. */
- if (src != NULL) {
+ /* If saveState is nullptr, the user messed up. */
+ if (src != nullptr) {
tokSource = src;
*saveState = src; /* Set to "src" in case there are no delimiters */
}
@@ -592,9 +592,9 @@ u_strtok_r(UChar *src,
tokSource = *saveState;
}
else {
- /* src == NULL && *saveState == NULL */
+ /* src == nullptr && *saveState == nullptr */
/* This shouldn't happen. We already finished tokenizing. */
- return NULL;
+ return nullptr;
}
/* Skip initial delimiters */
@@ -603,7 +603,7 @@ u_strtok_r(UChar *src,
if (*tokSource) {
nextToken = u_strpbrk(tokSource, delim);
- if (nextToken != NULL) {
+ if (nextToken != nullptr) {
/* Create a token */
*(nextToken++) = 0;
*saveState = nextToken;
@@ -611,24 +611,24 @@ u_strtok_r(UChar *src,
}
else if (*saveState) {
/* Return the last token */
- *saveState = NULL;
+ *saveState = nullptr;
return tokSource;
}
}
else {
/* No tokens were found. Only delimiters were left. */
- *saveState = NULL;
+ *saveState = nullptr;
}
- return NULL;
+ return nullptr;
}
/* Miscellaneous functions -------------------------------------------------- */
-U_CAPI UChar* U_EXPORT2
-u_strcat(UChar *dst,
- const UChar *src)
+U_CAPI char16_t* U_EXPORT2
+u_strcat(char16_t *dst,
+ const char16_t *src)
{
- UChar *anchor = dst; /* save a pointer to start of dst */
+ char16_t *anchor = dst; /* save a pointer to start of dst */
while(*dst != 0) { /* To end of first string */
++dst;
@@ -639,13 +639,13 @@ u_strcat(UChar *dst,
return anchor;
}
-U_CAPI UChar* U_EXPORT2
-u_strncat(UChar *dst,
- const UChar *src,
+U_CAPI char16_t* U_EXPORT2
+u_strncat(char16_t *dst,
+ const char16_t *src,
int32_t n )
{
if(n > 0) {
- UChar *anchor = dst; /* save a pointer to start of dst */
+ char16_t *anchor = dst; /* save a pointer to start of dst */
while(*dst != 0) { /* To end of first string */
++dst;
@@ -668,10 +668,10 @@ u_strncat(UChar *dst,
/* ----- Text property functions --- */
U_CAPI int32_t U_EXPORT2
-u_strcmp(const UChar *s1,
- const UChar *s2)
+u_strcmp(const char16_t *s1,
+ const char16_t *s2)
{
- UChar c1, c2;
+ char16_t c1, c2;
for(;;) {
c1=*s1++;
@@ -684,11 +684,11 @@ u_strcmp(const UChar *s1,
}
U_CFUNC int32_t U_EXPORT2
-uprv_strCompare(const UChar *s1, int32_t length1,
- const UChar *s2, int32_t length2,
+uprv_strCompare(const char16_t *s1, int32_t length1,
+ const char16_t *s2, int32_t length2,
UBool strncmpStyle, UBool codePointOrder) {
- const UChar *start1, *start2, *limit1, *limit2;
- UChar c1, c2;
+ const char16_t *start1, *start2, *limit1, *limit2;
+ char16_t c1, c2;
/* setup for fix-up */
start1=s1;
@@ -715,7 +715,7 @@ uprv_strCompare(const UChar *s1, int32_t length1,
}
/* setup for fix-up */
- limit1=limit2=NULL;
+ limit1=limit2=nullptr;
} else if(strncmpStyle) {
/* special handling for strncmp, assume length1==length2>=0 but also check for NUL */
if(s1==s2) {
@@ -830,7 +830,7 @@ u_strCompareIter(UCharIterator *iter1, UCharIterator *iter2, UBool codePointOrde
UChar32 c1, c2;
/* argument checking */
- if(iter1==NULL || iter2==NULL) {
+ if(iter1==nullptr || iter2==nullptr) {
return 0; /* bad arguments */
}
if(iter1==iter2) {
@@ -922,11 +922,11 @@ void fragment {
#endif
U_CAPI int32_t U_EXPORT2
-u_strCompare(const UChar *s1, int32_t length1,
- const UChar *s2, int32_t length2,
+u_strCompare(const char16_t *s1, int32_t length1,
+ const char16_t *s2, int32_t length2,
UBool codePointOrder) {
/* argument checking */
- if(s1==NULL || length1<-1 || s2==NULL || length2<-1) {
+ if(s1==nullptr || length1<-1 || s2==nullptr || length2<-1) {
return 0;
}
return uprv_strCompare(s1, length1, s2, length2, false, codePointOrder);
@@ -934,13 +934,13 @@ u_strCompare(const UChar *s1, int32_t length1,
/* String compare in code point order - u_strcmp() compares in code unit order. */
U_CAPI int32_t U_EXPORT2
-u_strcmpCodePointOrder(const UChar *s1, const UChar *s2) {
+u_strcmpCodePointOrder(const char16_t *s1, const char16_t *s2) {
return uprv_strCompare(s1, -1, s2, -1, false, true);
}
U_CAPI int32_t U_EXPORT2
-u_strncmp(const UChar *s1,
- const UChar *s2,
+u_strncmp(const char16_t *s1,
+ const char16_t *s2,
int32_t n)
{
if(n > 0) {
@@ -959,15 +959,15 @@ u_strncmp(const UChar *s1,
}
U_CAPI int32_t U_EXPORT2
-u_strncmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t n) {
+u_strncmpCodePointOrder(const char16_t *s1, const char16_t *s2, int32_t n) {
return uprv_strCompare(s1, n, s2, n, true, true);
}
-U_CAPI UChar* U_EXPORT2
-u_strcpy(UChar *dst,
- const UChar *src)
+U_CAPI char16_t* U_EXPORT2
+u_strcpy(char16_t *dst,
+ const char16_t *src)
{
- UChar *anchor = dst; /* save a pointer to start of dst */
+ char16_t *anchor = dst; /* save a pointer to start of dst */
while((*(dst++) = *(src++)) != 0) { /* copy string 2 over */
}
@@ -975,12 +975,12 @@ u_strcpy(UChar *dst,
return anchor;
}
-U_CAPI UChar* U_EXPORT2
-u_strncpy(UChar *dst,
- const UChar *src,
+U_CAPI char16_t* U_EXPORT2
+u_strncpy(char16_t *dst,
+ const char16_t *src,
int32_t n)
{
- UChar *anchor = dst; /* save a pointer to start of dst */
+ char16_t *anchor = dst; /* save a pointer to start of dst */
/* copy string 2 over */
while(n > 0 && (*(dst++) = *(src++)) != 0) {
@@ -991,12 +991,12 @@ u_strncpy(UChar *dst,
}
U_CAPI int32_t U_EXPORT2
-u_strlen(const UChar *s)
+u_strlen(const char16_t *s)
{
#if U_SIZEOF_WCHAR_T == U_SIZEOF_UCHAR
return (int32_t)uprv_wcslen((const wchar_t *)s);
#else
- const UChar *t = s;
+ const char16_t *t = s;
while(*t != 0) {
++t;
}
@@ -1005,10 +1005,10 @@ u_strlen(const UChar *s)
}
U_CAPI int32_t U_EXPORT2
-u_countChar32(const UChar *s, int32_t length) {
+u_countChar32(const char16_t *s, int32_t length) {
int32_t count;
- if(s==NULL || length<-1) {
+ if(s==nullptr || length<-1) {
return 0;
}
@@ -1025,7 +1025,7 @@ u_countChar32(const UChar *s, int32_t length) {
}
}
} else /* length==-1 */ {
- UChar c;
+ char16_t c;
for(;;) {
if((c=*s++)==0) {
@@ -1046,18 +1046,18 @@ u_countChar32(const UChar *s, int32_t length) {
}
U_CAPI UBool U_EXPORT2
-u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number) {
+u_strHasMoreChar32Than(const char16_t *s, int32_t length, int32_t number) {
if(number<0) {
return true;
}
- if(s==NULL || length<-1) {
+ if(s==nullptr || length<-1) {
return false;
}
if(length==-1) {
/* s is NUL-terminated */
- UChar c;
+ char16_t c;
/* count code points until they exceed */
for(;;) {
@@ -1074,7 +1074,7 @@ u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number) {
}
} else {
/* length>=0 known */
- const UChar *limit;
+ const char16_t *limit;
int32_t maxSupplementary;
/* s contains at least (length+1)/2 code points: <=2 UChars per cp */
@@ -1091,7 +1091,7 @@ u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number) {
/*
* count code points until they exceed and also check that there are
- * no more than maxSupplementary supplementary code points (UChar pairs)
+ * no more than maxSupplementary supplementary code points (char16_t pairs)
*/
limit=s+length;
for(;;) {
@@ -1113,27 +1113,27 @@ u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number) {
}
}
-U_CAPI UChar * U_EXPORT2
-u_memcpy(UChar *dest, const UChar *src, int32_t count) {
+U_CAPI char16_t * U_EXPORT2
+u_memcpy(char16_t *dest, const char16_t *src, int32_t count) {
if(count > 0) {
uprv_memcpy(dest, src, (size_t)count*U_SIZEOF_UCHAR);
}
return dest;
}
-U_CAPI UChar * U_EXPORT2
-u_memmove(UChar *dest, const UChar *src, int32_t count) {
+U_CAPI char16_t * U_EXPORT2
+u_memmove(char16_t *dest, const char16_t *src, int32_t count) {
if(count > 0) {
uprv_memmove(dest, src, (size_t)count*U_SIZEOF_UCHAR);
}
return dest;
}
-U_CAPI UChar * U_EXPORT2
-u_memset(UChar *dest, UChar c, int32_t count) {
+U_CAPI char16_t * U_EXPORT2
+u_memset(char16_t *dest, char16_t c, int32_t count) {
if(count > 0) {
- UChar *ptr = dest;
- UChar *limit = dest + count;
+ char16_t *ptr = dest;
+ char16_t *limit = dest + count;
while (ptr < limit) {
*(ptr++) = c;
@@ -1143,9 +1143,9 @@ u_memset(UChar *dest, UChar c, int32_t count) {
}
U_CAPI int32_t U_EXPORT2
-u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count) {
+u_memcmp(const char16_t *buf1, const char16_t *buf2, int32_t count) {
if(count > 0) {
- const UChar *limit = buf1 + count;
+ const char16_t *limit = buf1 + count;
int32_t result;
while (buf1 < limit) {
@@ -1161,14 +1161,14 @@ u_memcmp(const UChar *buf1, const UChar *buf2, int32_t count) {
}
U_CAPI int32_t U_EXPORT2
-u_memcmpCodePointOrder(const UChar *s1, const UChar *s2, int32_t count) {
+u_memcmpCodePointOrder(const char16_t *s1, const char16_t *s2, int32_t count) {
return uprv_strCompare(s1, count, s2, count, false, true);
}
/* u_unescape & support fns ------------------------------------------------- */
/* This map must be in ASCENDING ORDER OF THE ESCAPE CODE */
-static const UChar UNESCAPE_MAP[] = {
+static const char16_t UNESCAPE_MAP[] = {
/*" 0x22, 0x22 */
/*' 0x27, 0x27 */
/*? 0x3F, 0x3F */
@@ -1185,7 +1185,7 @@ static const UChar UNESCAPE_MAP[] = {
enum { UNESCAPE_MAP_LENGTH = UPRV_LENGTHOF(UNESCAPE_MAP) };
/* Convert one octal digit to a numeric value 0..7, or -1 on failure */
-static int32_t _digit8(UChar c) {
+static int32_t _digit8(char16_t c) {
if (c >= u'0' && c <= u'7') {
return c - u'0';
}
@@ -1193,7 +1193,7 @@ static int32_t _digit8(UChar c) {
}
/* Convert one hex digit to a numeric value 0..F, or -1 on failure */
-static int32_t _digit16(UChar c) {
+static int32_t _digit16(char16_t c) {
if (c >= u'0' && c <= u'9') {
return c - u'0';
}
@@ -1230,7 +1230,7 @@ u_unescapeAt(UNESCAPE_CHAR_AT charAt,
goto err;
}
- /* Fetch first UChar after '\\' */
+ /* Fetch first char16_t after '\\' */
c = charAt((*offset)++, context);
/* Convert hexadecimal and octal escapes */
@@ -1323,7 +1323,7 @@ u_unescapeAt(UNESCAPE_CHAR_AT charAt,
if (c == u'c' && *offset < length) {
c = charAt((*offset)++, context);
if (U16_IS_LEAD(c) && *offset < length) {
- UChar c2 = charAt(*offset, context);
+ char16_t c2 = charAt(*offset, context);
if (U16_IS_TRAIL(c2)) {
++(*offset);
c = U16_GET_SUPPLEMENTARY(c, c2);
@@ -1336,7 +1336,7 @@ u_unescapeAt(UNESCAPE_CHAR_AT charAt,
* the backslash to generically escape the next character.
* Deal with surrogate pairs. */
if (U16_IS_LEAD(c) && *offset < length) {
- UChar c2 = charAt(*offset, context);
+ char16_t c2 = charAt(*offset, context);
if (U16_IS_TRAIL(c2)) {
++(*offset);
return U16_GET_SUPPLEMENTARY(c, c2);
@@ -1350,10 +1350,10 @@ u_unescapeAt(UNESCAPE_CHAR_AT charAt,
return (UChar32)0xFFFFFFFF;
}
-/* u_unescapeAt() callback to return a UChar from a char* */
-static UChar U_CALLCONV
+/* u_unescapeAt() callback to return a char16_t from a char* */
+static char16_t U_CALLCONV
_charPtr_charAt(int32_t offset, void *context) {
- UChar c16;
+ char16_t c16;
/* It would be more efficient to access the invariant tables
* directly but there is no API for that. */
u_charsToUChars(((char*) context) + offset, &c16, 1);
@@ -1361,7 +1361,7 @@ _charPtr_charAt(int32_t offset, void *context) {
}
/* Append an escape-free segment of the text; used by u_unescape() */
-static void _appendUChars(UChar *dest, int32_t destCapacity,
+static void _appendUChars(char16_t *dest, int32_t destCapacity,
const char *src, int32_t srcLen) {
if (destCapacity < 0) {
destCapacity = 0;
@@ -1372,9 +1372,9 @@ static void _appendUChars(UChar *dest, int32_t destCapacity,
u_charsToUChars(src, dest, srcLen);
}
-/* Do an invariant conversion of char* -> UChar*, with escape parsing */
+/* Do an invariant conversion of char* -> char16_t*, with escape parsing */
U_CAPI int32_t U_EXPORT2
-u_unescape(const char *src, UChar *dest, int32_t destCapacity) {
+u_unescape(const char *src, char16_t *dest, int32_t destCapacity) {
const char *segment = src;
int32_t i = 0;
char c;
@@ -1387,7 +1387,7 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) {
int32_t lenParsed = 0;
UChar32 c32;
if (src != segment) {
- if (dest != NULL) {
+ if (dest != nullptr) {
_appendUChars(dest + i, destCapacity - i,
segment, (int32_t)(src - segment));
}
@@ -1399,7 +1399,7 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) {
goto err;
}
src += lenParsed; /* advance past escape seq. */
- if (dest != NULL && U16_LENGTH(c32) <= (destCapacity - i)) {
+ if (dest != nullptr && U16_LENGTH(c32) <= (destCapacity - i)) {
U16_APPEND_UNSAFE(dest, i, c32);
} else {
i += U16_LENGTH(c32);
@@ -1410,19 +1410,19 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) {
}
}
if (src != segment) {
- if (dest != NULL) {
+ if (dest != nullptr) {
_appendUChars(dest + i, destCapacity - i,
segment, (int32_t)(src - segment));
}
i += (int32_t)(src - segment);
}
- if (dest != NULL && i < destCapacity) {
+ if (dest != nullptr && i < destCapacity) {
dest[i] = 0;
}
return i;
err:
- if (dest != NULL && destCapacity > 0) {
+ if (dest != nullptr && destCapacity > 0) {
*dest = 0;
}
return 0;
@@ -1435,7 +1435,7 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) {
* Set warning and error codes accordingly.
*/
#define __TERMINATE_STRING(dest, destCapacity, length, pErrorCode) UPRV_BLOCK_MACRO_BEGIN { \
- if(pErrorCode!=NULL && U_SUCCESS(*pErrorCode)) { \
+ if(pErrorCode!=nullptr && U_SUCCESS(*pErrorCode)) { \
/* not a public function, so no complete argument checking */ \
\
if(length<0) { \
@@ -1457,8 +1457,8 @@ u_unescape(const char *src, UChar *dest, int32_t destCapacity) {
} \
} UPRV_BLOCK_MACRO_END
-U_CAPI UChar U_EXPORT2
-u_asciiToUpper(UChar c) {
+U_CAPI char16_t U_EXPORT2
+u_asciiToUpper(char16_t c) {
if (u'a' <= c && c <= u'z') {
c = c + u'A' - u'a';
}
@@ -1466,7 +1466,7 @@ u_asciiToUpper(UChar c) {
}
U_CAPI int32_t U_EXPORT2
-u_terminateUChars(UChar *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode) {
+u_terminateUChars(char16_t *dest, int32_t destCapacity, int32_t length, UErrorCode *pErrorCode) {
__TERMINATE_STRING(dest, destCapacity, length, pErrorCode);
return length;
}
@@ -1506,7 +1506,7 @@ u_terminateWChars(wchar_t *dest, int32_t destCapacity, int32_t length, UErrorCod
#define STRING_HASH(TYPE, STR, STRLEN, DEREF) UPRV_BLOCK_MACRO_BEGIN { \
uint32_t hash = 0; \
const TYPE *p = (const TYPE*) STR; \
- if (p != NULL) { \
+ if (p != nullptr) { \
int32_t len = (int32_t)(STRLEN); \
int32_t inc = ((len - 32) / 32) + 1; \
const TYPE *limit = p + len; \
@@ -1520,8 +1520,8 @@ u_terminateWChars(wchar_t *dest, int32_t destCapacity, int32_t length, UErrorCod
/* Used by UnicodeString to compute its hashcode - Not public API. */
U_CAPI int32_t U_EXPORT2
-ustr_hashUCharsN(const UChar *str, int32_t length) {
- STRING_HASH(UChar, str, length, *p);
+ustr_hashUCharsN(const char16_t *str, int32_t length) {
+ STRING_HASH(char16_t, str, length, *p);
}
U_CAPI int32_t U_EXPORT2
diff --git a/thirdparty/icu4c/common/ustrtrns.cpp b/thirdparty/icu4c/common/ustrtrns.cpp
index dcb9dc5878..244c111fc4 100644
--- a/thirdparty/icu4c/common/ustrtrns.cpp
+++ b/thirdparty/icu4c/common/ustrtrns.cpp
@@ -36,8 +36,8 @@
#include "ustr_imp.h"
#include "uassert.h"
-U_CAPI UChar* U_EXPORT2
-u_strFromUTF32WithSub(UChar *dest,
+U_CAPI char16_t* U_EXPORT2
+u_strFromUTF32WithSub(char16_t *dest,
int32_t destCapacity,
int32_t *pDestLength,
const UChar32 *src,
@@ -46,29 +46,29 @@ u_strFromUTF32WithSub(UChar *dest,
UErrorCode *pErrorCode) {
const UChar32 *srcLimit;
UChar32 ch;
- UChar *destLimit;
- UChar *pDest;
+ char16_t *destLimit;
+ char16_t *pDest;
int32_t reqLength;
int32_t numSubstitutions;
/* args check */
if(U_FAILURE(*pErrorCode)){
- return NULL;
+ return nullptr;
}
- if( (src==NULL && srcLength!=0) || srcLength < -1 ||
- (destCapacity<0) || (dest == NULL && destCapacity > 0) ||
+ if( (src==nullptr && srcLength!=0) || srcLength < -1 ||
+ (destCapacity<0) || (dest == nullptr && destCapacity > 0) ||
subchar > 0x10ffff || U_IS_SURROGATE(subchar)
) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
- if(pNumSubstitutions != NULL) {
+ if(pNumSubstitutions != nullptr) {
*pNumSubstitutions = 0;
}
pDest = dest;
- destLimit = (dest!=NULL)?(dest + destCapacity):NULL;
+ destLimit = (dest!=nullptr)?(dest + destCapacity):nullptr;
reqLength = 0;
numSubstitutions = 0;
@@ -78,7 +78,7 @@ u_strFromUTF32WithSub(UChar *dest,
((uint32_t)ch < 0xd800 || (0xe000 <= ch && ch <= 0xffff))) {
++src;
if(pDest < destLimit) {
- *pDest++ = (UChar)ch;
+ *pDest++ = (char16_t)ch;
} else {
++reqLength;
}
@@ -89,7 +89,7 @@ u_strFromUTF32WithSub(UChar *dest,
while(*++srcLimit != 0) {}
}
} else {
- srcLimit = (src!=NULL)?(src + srcLength):NULL;
+ srcLimit = (src!=nullptr)?(src + srcLength):nullptr;
}
/* convert with length */
@@ -99,13 +99,13 @@ u_strFromUTF32WithSub(UChar *dest,
/* usually "loops" once; twice only for writing subchar */
if((uint32_t)ch < 0xd800 || (0xe000 <= ch && ch <= 0xffff)) {
if(pDest < destLimit) {
- *pDest++ = (UChar)ch;
+ *pDest++ = (char16_t)ch;
} else {
++reqLength;
}
break;
} else if(0x10000 <= ch && ch <= 0x10ffff) {
- if(pDest!=NULL && ((pDest + 2) <= destLimit)) {
+ if(pDest!=nullptr && ((pDest + 2) <= destLimit)) {
*pDest++ = U16_LEAD(ch);
*pDest++ = U16_TRAIL(ch);
} else {
@@ -115,7 +115,7 @@ u_strFromUTF32WithSub(UChar *dest,
} else if((ch = subchar) < 0) {
/* surrogate code point, or not a Unicode code point at all */
*pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ return nullptr;
} else {
++numSubstitutions;
}
@@ -126,7 +126,7 @@ u_strFromUTF32WithSub(UChar *dest,
if(pDestLength) {
*pDestLength = reqLength;
}
- if(pNumSubstitutions != NULL) {
+ if(pNumSubstitutions != nullptr) {
*pNumSubstitutions = numSubstitutions;
}
@@ -136,8 +136,8 @@ u_strFromUTF32WithSub(UChar *dest,
return dest;
}
-U_CAPI UChar* U_EXPORT2
-u_strFromUTF32(UChar *dest,
+U_CAPI char16_t* U_EXPORT2
+u_strFromUTF32(char16_t *dest,
int32_t destCapacity,
int32_t *pDestLength,
const UChar32 *src,
@@ -146,7 +146,7 @@ u_strFromUTF32(UChar *dest,
return u_strFromUTF32WithSub(
dest, destCapacity, pDestLength,
src, srcLength,
- U_SENTINEL, NULL,
+ U_SENTINEL, nullptr,
pErrorCode);
}
@@ -154,13 +154,13 @@ U_CAPI UChar32* U_EXPORT2
u_strToUTF32WithSub(UChar32 *dest,
int32_t destCapacity,
int32_t *pDestLength,
- const UChar *src,
+ const char16_t *src,
int32_t srcLength,
UChar32 subchar, int32_t *pNumSubstitutions,
UErrorCode *pErrorCode) {
- const UChar *srcLimit;
+ const char16_t *srcLimit;
UChar32 ch;
- UChar ch2;
+ char16_t ch2;
UChar32 *destLimit;
UChar32 *pDest;
int32_t reqLength;
@@ -168,22 +168,22 @@ u_strToUTF32WithSub(UChar32 *dest,
/* args check */
if(U_FAILURE(*pErrorCode)){
- return NULL;
+ return nullptr;
}
- if( (src==NULL && srcLength!=0) || srcLength < -1 ||
- (destCapacity<0) || (dest == NULL && destCapacity > 0) ||
+ if( (src==nullptr && srcLength!=0) || srcLength < -1 ||
+ (destCapacity<0) || (dest == nullptr && destCapacity > 0) ||
subchar > 0x10ffff || U_IS_SURROGATE(subchar)
) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
- if(pNumSubstitutions != NULL) {
+ if(pNumSubstitutions != nullptr) {
*pNumSubstitutions = 0;
}
pDest = dest;
- destLimit = (dest!=NULL)?(dest + destCapacity):NULL;
+ destLimit = (dest!=nullptr)?(dest + destCapacity):nullptr;
reqLength = 0;
numSubstitutions = 0;
@@ -203,7 +203,7 @@ u_strToUTF32WithSub(UChar32 *dest,
while(*++srcLimit != 0) {}
}
} else {
- srcLimit = (src!=NULL)?(src + srcLength):NULL;
+ srcLimit = (src!=nullptr)?(src + srcLength):nullptr;
}
/* convert with length */
@@ -217,7 +217,7 @@ u_strToUTF32WithSub(UChar32 *dest,
} else if((ch = subchar) < 0) {
/* unpaired surrogate */
*pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ return nullptr;
} else {
++numSubstitutions;
}
@@ -232,7 +232,7 @@ u_strToUTF32WithSub(UChar32 *dest,
if(pDestLength) {
*pDestLength = reqLength;
}
- if(pNumSubstitutions != NULL) {
+ if(pNumSubstitutions != nullptr) {
*pNumSubstitutions = numSubstitutions;
}
@@ -246,18 +246,18 @@ U_CAPI UChar32* U_EXPORT2
u_strToUTF32(UChar32 *dest,
int32_t destCapacity,
int32_t *pDestLength,
- const UChar *src,
+ const char16_t *src,
int32_t srcLength,
UErrorCode *pErrorCode) {
return u_strToUTF32WithSub(
dest, destCapacity, pDestLength,
src, srcLength,
- U_SENTINEL, NULL,
+ U_SENTINEL, nullptr,
pErrorCode);
}
-U_CAPI UChar* U_EXPORT2
-u_strFromUTF8WithSub(UChar *dest,
+U_CAPI char16_t* U_EXPORT2
+u_strFromUTF8WithSub(char16_t *dest,
int32_t destCapacity,
int32_t *pDestLength,
const char* src,
@@ -266,21 +266,21 @@ u_strFromUTF8WithSub(UChar *dest,
UErrorCode *pErrorCode){
/* args check */
if(U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
- if( (src==NULL && srcLength!=0) || srcLength < -1 ||
- (destCapacity<0) || (dest == NULL && destCapacity > 0) ||
+ if( (src==nullptr && srcLength!=0) || srcLength < -1 ||
+ (destCapacity<0) || (dest == nullptr && destCapacity > 0) ||
subchar > 0x10ffff || U_IS_SURROGATE(subchar)
) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
- if(pNumSubstitutions!=NULL) {
+ if(pNumSubstitutions!=nullptr) {
*pNumSubstitutions=0;
}
- UChar *pDest = dest;
- UChar *pDestLimit = dest+destCapacity;
+ char16_t *pDest = dest;
+ char16_t *pDestLimit = dest+destCapacity;
int32_t reqLength = 0;
int32_t numSubstitutions=0;
@@ -309,7 +309,7 @@ u_strFromUTF8WithSub(UChar *dest,
// modified copy of U8_NEXT()
++i;
if(U8_IS_SINGLE(c)) {
- *pDest++=(UChar)c;
+ *pDest++=(char16_t)c;
} else {
uint8_t __t1, __t2;
if( /* handle U+0800..U+FFFF inline */
@@ -328,9 +328,9 @@ u_strFromUTF8WithSub(UChar *dest,
(c)=utf8_nextCharSafeBody((const uint8_t *)src, &(i), -1, c, -1);
if(c<0 && (++numSubstitutions, c = subchar) < 0) {
*pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ return nullptr;
} else if(c<=0xFFFF) {
- *(pDest++)=(UChar)c;
+ *(pDest++)=(char16_t)c;
} else {
*(pDest++)=U16_LEAD(c);
if(pDest<pDestLimit) {
@@ -368,7 +368,7 @@ u_strFromUTF8WithSub(UChar *dest,
(c)=utf8_nextCharSafeBody((const uint8_t *)src, &(i), -1, c, -1);
if(c<0 && (++numSubstitutions, c = subchar) < 0) {
*pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ return nullptr;
}
reqLength += U16_LENGTH(c);
}
@@ -381,7 +381,7 @@ u_strFromUTF8WithSub(UChar *dest,
for(;;) {
/*
* Each iteration of the inner loop progresses by at most 3 UTF-8
- * bytes and one UChar, for most characters.
+ * bytes and one char16_t, for most characters.
* For supplementary code points (4 & 2), which are rare,
* there is an additional adjustment.
*/
@@ -402,7 +402,7 @@ u_strFromUTF8WithSub(UChar *dest,
// modified copy of U8_NEXT()
c = (uint8_t)src[i++];
if(U8_IS_SINGLE(c)) {
- *pDest++=(UChar)c;
+ *pDest++=(char16_t)c;
} else {
uint8_t __t1, __t2;
if( /* handle U+0800..U+FFFF inline */
@@ -433,9 +433,9 @@ u_strFromUTF8WithSub(UChar *dest,
(c)=utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, c, -1);
if(c<0 && (++numSubstitutions, c = subchar) < 0) {
*pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ return nullptr;
} else if(c<=0xFFFF) {
- *(pDest++)=(UChar)c;
+ *(pDest++)=(char16_t)c;
} else {
*(pDest++)=U16_LEAD(c);
*(pDest++)=U16_TRAIL(c);
@@ -449,7 +449,7 @@ u_strFromUTF8WithSub(UChar *dest,
// modified copy of U8_NEXT()
c = (uint8_t)src[i++];
if(U8_IS_SINGLE(c)) {
- *pDest++=(UChar)c;
+ *pDest++=(char16_t)c;
} else {
uint8_t __t1, __t2;
if( /* handle U+0800..U+FFFF inline */
@@ -470,9 +470,9 @@ u_strFromUTF8WithSub(UChar *dest,
(c)=utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, c, -1);
if(c<0 && (++numSubstitutions, c = subchar) < 0) {
*pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ return nullptr;
} else if(c<=0xFFFF) {
- *(pDest++)=(UChar)c;
+ *(pDest++)=(char16_t)c;
} else {
*(pDest++)=U16_LEAD(c);
if(pDest<pDestLimit) {
@@ -512,7 +512,7 @@ u_strFromUTF8WithSub(UChar *dest,
(c)=utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, c, -1);
if(c<0 && (++numSubstitutions, c = subchar) < 0) {
*pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ return nullptr;
}
reqLength += U16_LENGTH(c);
}
@@ -522,7 +522,7 @@ u_strFromUTF8WithSub(UChar *dest,
reqLength+=(int32_t)(pDest - dest);
- if(pNumSubstitutions!=NULL) {
+ if(pNumSubstitutions!=nullptr) {
*pNumSubstitutions=numSubstitutions;
}
@@ -536,8 +536,8 @@ u_strFromUTF8WithSub(UChar *dest,
return dest;
}
-U_CAPI UChar* U_EXPORT2
-u_strFromUTF8(UChar *dest,
+U_CAPI char16_t* U_EXPORT2
+u_strFromUTF8(char16_t *dest,
int32_t destCapacity,
int32_t *pDestLength,
const char* src,
@@ -546,37 +546,37 @@ u_strFromUTF8(UChar *dest,
return u_strFromUTF8WithSub(
dest, destCapacity, pDestLength,
src, srcLength,
- U_SENTINEL, NULL,
+ U_SENTINEL, nullptr,
pErrorCode);
}
-U_CAPI UChar * U_EXPORT2
-u_strFromUTF8Lenient(UChar *dest,
+U_CAPI char16_t * U_EXPORT2
+u_strFromUTF8Lenient(char16_t *dest,
int32_t destCapacity,
int32_t *pDestLength,
const char *src,
int32_t srcLength,
UErrorCode *pErrorCode) {
- UChar *pDest = dest;
+ char16_t *pDest = dest;
UChar32 ch;
int32_t reqLength = 0;
uint8_t* pSrc = (uint8_t*) src;
/* args check */
if(U_FAILURE(*pErrorCode)){
- return NULL;
+ return nullptr;
}
- if( (src==NULL && srcLength!=0) || srcLength < -1 ||
- (destCapacity<0) || (dest == NULL && destCapacity > 0)
+ if( (src==nullptr && srcLength!=0) || srcLength < -1 ||
+ (destCapacity<0) || (dest == nullptr && destCapacity > 0)
) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
if(srcLength < 0) {
/* Transform a NUL-terminated string. */
- UChar *pDestLimit = (dest!=NULL)?(dest+destCapacity):NULL;
+ char16_t *pDestLimit = (dest!=nullptr)?(dest+destCapacity):nullptr;
uint8_t t1, t2, t3; /* trail bytes */
while(((ch = *pSrc) != 0) && (pDest < pDestLimit)) {
@@ -586,21 +586,21 @@ u_strFromUTF8Lenient(UChar *dest,
* a single-byte sequence for better character boundary
* resynchronization after illegal sequences.
*/
- *pDest++=(UChar)ch;
+ *pDest++=(char16_t)ch;
++pSrc;
continue;
} else if(ch < 0xe0) { /* U+0080..U+07FF */
if((t1 = pSrc[1]) != 0) {
/* 0x3080 = (0xc0 << 6) + 0x80 */
- *pDest++ = (UChar)((ch << 6) + t1 - 0x3080);
+ *pDest++ = (char16_t)((ch << 6) + t1 - 0x3080);
pSrc += 2;
continue;
}
} else if(ch < 0xf0) { /* U+0800..U+FFFF */
if((t1 = pSrc[1]) != 0 && (t2 = pSrc[2]) != 0) {
- /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */
+ /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (char16_t) */
/* 0x2080 = (0x80 << 6) + 0x80 */
- *pDest++ = (UChar)((ch << 12) + (t1 << 6) + t2 - 0x2080);
+ *pDest++ = (char16_t)((ch << 12) + (t1 << 6) + t2 - 0x2080);
pSrc += 3;
continue;
}
@@ -662,7 +662,7 @@ u_strFromUTF8Lenient(UChar *dest,
break;
}
} else /* srcLength >= 0 */ {
- const uint8_t *pSrcLimit = (pSrc!=NULL)?(pSrc + srcLength):NULL;
+ const uint8_t *pSrcLimit = (pSrc!=nullptr)?(pSrc + srcLength):nullptr;
/*
* This function requires that if srcLength is given, then it must be
@@ -670,11 +670,11 @@ u_strFromUTF8Lenient(UChar *dest,
* destination buffer overflow in the loop.
*/
if(destCapacity < srcLength) {
- if(pDestLength != NULL) {
+ if(pDestLength != nullptr) {
*pDestLength = srcLength; /* this likely overestimates the true destLength! */
}
*pErrorCode = U_BUFFER_OVERFLOW_ERROR;
- return NULL;
+ return nullptr;
}
if((pSrcLimit - pSrc) >= 4) {
@@ -689,15 +689,15 @@ u_strFromUTF8Lenient(UChar *dest,
* a single-byte sequence for better character boundary
* resynchronization after illegal sequences.
*/
- *pDest++=(UChar)ch;
+ *pDest++=(char16_t)ch;
} else if(ch < 0xe0) { /* U+0080..U+07FF */
/* 0x3080 = (0xc0 << 6) + 0x80 */
- *pDest++ = (UChar)((ch << 6) + *pSrc++ - 0x3080);
+ *pDest++ = (char16_t)((ch << 6) + *pSrc++ - 0x3080);
} else if(ch < 0xf0) { /* U+0800..U+FFFF */
- /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */
+ /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (char16_t) */
/* 0x2080 = (0x80 << 6) + 0x80 */
ch = (ch << 12) + (*pSrc++ << 6);
- *pDest++ = (UChar)(ch + *pSrc++ - 0x2080);
+ *pDest++ = (char16_t)(ch + *pSrc++ - 0x2080);
} else /* f0..f4 */ { /* U+10000..U+10FFFF */
/* 0x3c82080 = (0xf0 << 18) + (0x80 << 12) + (0x80 << 6) + 0x80 */
ch = (ch << 18) + (*pSrc++ << 12);
@@ -719,20 +719,20 @@ u_strFromUTF8Lenient(UChar *dest,
* a single-byte sequence for better character boundary
* resynchronization after illegal sequences.
*/
- *pDest++=(UChar)ch;
+ *pDest++=(char16_t)ch;
continue;
} else if(ch < 0xe0) { /* U+0080..U+07FF */
if(pSrc < pSrcLimit) {
/* 0x3080 = (0xc0 << 6) + 0x80 */
- *pDest++ = (UChar)((ch << 6) + *pSrc++ - 0x3080);
+ *pDest++ = (char16_t)((ch << 6) + *pSrc++ - 0x3080);
continue;
}
} else if(ch < 0xf0) { /* U+0800..U+FFFF */
if((pSrcLimit - pSrc) >= 2) {
- /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */
+ /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (char16_t) */
/* 0x2080 = (0x80 << 6) + 0x80 */
ch = (ch << 12) + (*pSrc++ << 6);
- *pDest++ = (UChar)(ch + *pSrc++ - 0x2080);
+ *pDest++ = (char16_t)(ch + *pSrc++ - 0x2080);
pSrc += 3;
continue;
}
@@ -793,30 +793,30 @@ U_CAPI char* U_EXPORT2
u_strToUTF8WithSub(char *dest,
int32_t destCapacity,
int32_t *pDestLength,
- const UChar *pSrc,
+ const char16_t *pSrc,
int32_t srcLength,
UChar32 subchar, int32_t *pNumSubstitutions,
UErrorCode *pErrorCode){
int32_t reqLength=0;
uint32_t ch=0,ch2=0;
uint8_t *pDest = (uint8_t *)dest;
- uint8_t *pDestLimit = (pDest!=NULL)?(pDest + destCapacity):NULL;
+ uint8_t *pDestLimit = (pDest!=nullptr)?(pDest + destCapacity):nullptr;
int32_t numSubstitutions;
/* args check */
if(U_FAILURE(*pErrorCode)){
- return NULL;
+ return nullptr;
}
- if( (pSrc==NULL && srcLength!=0) || srcLength < -1 ||
- (destCapacity<0) || (dest == NULL && destCapacity > 0) ||
+ if( (pSrc==nullptr && srcLength!=0) || srcLength < -1 ||
+ (destCapacity<0) || (dest == nullptr && destCapacity > 0) ||
subchar > 0x10ffff || U_IS_SURROGATE(subchar)
) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
- if(pNumSubstitutions!=NULL) {
+ if(pNumSubstitutions!=nullptr) {
*pNumSubstitutions=0;
}
numSubstitutions=0;
@@ -861,7 +861,7 @@ u_strToUTF8WithSub(char *dest,
} else {
/* Unicode 3.2 forbids surrogate code points in UTF-8 */
*pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ return nullptr;
}
length = U8_LENGTH(ch);
@@ -890,18 +890,18 @@ u_strToUTF8WithSub(char *dest,
} else {
/* Unicode 3.2 forbids surrogate code points in UTF-8 */
*pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ return nullptr;
}
}
} else {
- const UChar *pSrcLimit = (pSrc!=NULL)?(pSrc+srcLength):NULL;
+ const char16_t *pSrcLimit = (pSrc!=nullptr)?(pSrc+srcLength):nullptr;
int32_t count;
/* Faster loop without ongoing checking for pSrcLimit and pDestLimit. */
for(;;) {
/*
* Each iteration of the inner loop progresses by at most 3 UTF-8
- * bytes and one UChar, for most characters.
+ * bytes and one char16_t, for most characters.
* For supplementary code points (4 & 2), which are rare,
* there is an additional adjustment.
*/
@@ -955,7 +955,7 @@ u_strToUTF8WithSub(char *dest,
++numSubstitutions;
} else {
*pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ return nullptr;
}
/* convert and append*/
@@ -1003,7 +1003,7 @@ u_strToUTF8WithSub(char *dest,
} else {
/* Unicode 3.2 forbids surrogate code points in UTF-8 */
*pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ return nullptr;
}
length = U8_LENGTH(ch);
@@ -1033,14 +1033,14 @@ u_strToUTF8WithSub(char *dest,
} else {
/* Unicode 3.2 forbids surrogate code points in UTF-8 */
*pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ return nullptr;
}
}
}
reqLength+=(int32_t)(pDest - (uint8_t *)dest);
- if(pNumSubstitutions!=NULL) {
+ if(pNumSubstitutions!=nullptr) {
*pNumSubstitutions=numSubstitutions;
}
@@ -1057,19 +1057,19 @@ U_CAPI char* U_EXPORT2
u_strToUTF8(char *dest,
int32_t destCapacity,
int32_t *pDestLength,
- const UChar *pSrc,
+ const char16_t *pSrc,
int32_t srcLength,
UErrorCode *pErrorCode){
return u_strToUTF8WithSub(
dest, destCapacity, pDestLength,
pSrc, srcLength,
- U_SENTINEL, NULL,
+ U_SENTINEL, nullptr,
pErrorCode);
}
-U_CAPI UChar* U_EXPORT2
+U_CAPI char16_t* U_EXPORT2
u_strFromJavaModifiedUTF8WithSub(
- UChar *dest,
+ char16_t *dest,
int32_t destCapacity,
int32_t *pDestLength,
const char *src,
@@ -1078,21 +1078,21 @@ u_strFromJavaModifiedUTF8WithSub(
UErrorCode *pErrorCode) {
/* args check */
if(U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
- if( (src==NULL && srcLength!=0) || srcLength < -1 ||
- (dest==NULL && destCapacity!=0) || destCapacity<0 ||
+ if( (src==nullptr && srcLength!=0) || srcLength < -1 ||
+ (dest==nullptr && destCapacity!=0) || destCapacity<0 ||
subchar > 0x10ffff || U_IS_SURROGATE(subchar)
) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
- if(pNumSubstitutions!=NULL) {
+ if(pNumSubstitutions!=nullptr) {
*pNumSubstitutions=0;
}
- UChar *pDest = dest;
- UChar *pDestLimit = dest+destCapacity;
+ char16_t *pDest = dest;
+ char16_t *pDestLimit = dest+destCapacity;
int32_t reqLength = 0;
int32_t numSubstitutions=0;
@@ -1103,7 +1103,7 @@ u_strFromJavaModifiedUTF8WithSub(
*/
UChar32 c;
while(((c = (uint8_t)*src) != 0) && c <= 0x7f && (pDest < pDestLimit)) {
- *pDest++=(UChar)c;
+ *pDest++=(char16_t)c;
++src;
}
if(c == 0) {
@@ -1140,7 +1140,7 @@ u_strFromJavaModifiedUTF8WithSub(
}
/*
* Each iteration of the inner loop progresses by at most 3 UTF-8
- * bytes and one UChar.
+ * bytes and one char16_t.
*/
if(subchar > 0xFFFF) {
break;
@@ -1159,7 +1159,7 @@ u_strFromJavaModifiedUTF8WithSub(
do {
ch = (uint8_t)src[i++];
if(U8_IS_SINGLE(ch)) {
- *pDest++=(UChar)ch;
+ *pDest++=(char16_t)ch;
} else {
if(ch >= 0xe0) {
if( /* handle U+0000..U+FFFF inline */
@@ -1167,8 +1167,8 @@ u_strFromJavaModifiedUTF8WithSub(
(t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f &&
(t2 = (uint8_t)(src[i+1] - 0x80)) <= 0x3f
) {
- /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */
- *pDest++ = (UChar)((ch << 12) | (t1 << 6) | t2);
+ /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (char16_t) */
+ *pDest++ = (char16_t)((ch << 12) | (t1 << 6) | t2);
i += 2;
continue;
}
@@ -1177,7 +1177,7 @@ u_strFromJavaModifiedUTF8WithSub(
ch >= 0xc0 &&
(t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f
) {
- *pDest++ = (UChar)(((ch & 0x1f) << 6) | t1);
+ *pDest++ = (char16_t)(((ch & 0x1f) << 6) | t1);
++i;
continue;
}
@@ -1185,7 +1185,7 @@ u_strFromJavaModifiedUTF8WithSub(
if(subchar < 0) {
*pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ return nullptr;
} else if(subchar > 0xffff && --count == 0) {
/*
* We need to write two UChars, adjusted count for that,
@@ -1197,7 +1197,7 @@ u_strFromJavaModifiedUTF8WithSub(
/* function call for error cases */
utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, ch, -1);
++numSubstitutions;
- *(pDest++)=(UChar)subchar;
+ *(pDest++)=(char16_t)subchar;
}
}
} while(--count > 0);
@@ -1206,7 +1206,7 @@ u_strFromJavaModifiedUTF8WithSub(
while(i < srcLength && (pDest < pDestLimit)) {
ch = (uint8_t)src[i++];
if(U8_IS_SINGLE(ch)){
- *pDest++=(UChar)ch;
+ *pDest++=(char16_t)ch;
} else {
if(ch >= 0xe0) {
if( /* handle U+0000..U+FFFF inline */
@@ -1215,8 +1215,8 @@ u_strFromJavaModifiedUTF8WithSub(
(t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f &&
(t2 = (uint8_t)(src[i+1] - 0x80)) <= 0x3f
) {
- /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (UChar) */
- *pDest++ = (UChar)((ch << 12) | (t1 << 6) | t2);
+ /* no need for (ch & 0xf) because the upper bits are truncated after <<12 in the cast to (char16_t) */
+ *pDest++ = (char16_t)((ch << 12) | (t1 << 6) | t2);
i += 2;
continue;
}
@@ -1226,7 +1226,7 @@ u_strFromJavaModifiedUTF8WithSub(
i < srcLength &&
(t1 = (uint8_t)(src[i] - 0x80)) <= 0x3f
) {
- *pDest++ = (UChar)(((ch & 0x1f) << 6) | t1);
+ *pDest++ = (char16_t)(((ch & 0x1f) << 6) | t1);
++i;
continue;
}
@@ -1234,13 +1234,13 @@ u_strFromJavaModifiedUTF8WithSub(
if(subchar < 0) {
*pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ return nullptr;
} else {
/* function call for error cases */
utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, ch, -1);
++numSubstitutions;
if(subchar<=0xFFFF) {
- *(pDest++)=(UChar)subchar;
+ *(pDest++)=(char16_t)subchar;
} else {
*(pDest++)=U16_LEAD(subchar);
if(pDest<pDestLimit) {
@@ -1285,7 +1285,7 @@ u_strFromJavaModifiedUTF8WithSub(
if(subchar < 0) {
*pErrorCode = U_INVALID_CHAR_FOUND;
- return NULL;
+ return nullptr;
} else {
/* function call for error cases */
utf8_nextCharSafeBody((const uint8_t *)src, &(i), srcLength, ch, -1);
@@ -1295,7 +1295,7 @@ u_strFromJavaModifiedUTF8WithSub(
}
}
- if(pNumSubstitutions!=NULL) {
+ if(pNumSubstitutions!=nullptr) {
*pNumSubstitutions=numSubstitutions;
}
@@ -1314,26 +1314,26 @@ u_strToJavaModifiedUTF8(
char *dest,
int32_t destCapacity,
int32_t *pDestLength,
- const UChar *src,
+ const char16_t *src,
int32_t srcLength,
UErrorCode *pErrorCode) {
int32_t reqLength=0;
uint32_t ch=0;
- uint8_t *pDest = (uint8_t *)dest;
- uint8_t *pDestLimit = pDest + destCapacity;
- const UChar *pSrcLimit;
+ const char16_t *pSrcLimit;
int32_t count;
/* args check */
if(U_FAILURE(*pErrorCode)){
- return NULL;
+ return nullptr;
}
- if( (src==NULL && srcLength!=0) || srcLength < -1 ||
- (dest==NULL && destCapacity!=0) || destCapacity<0
+ if( (src==nullptr && srcLength!=0) || srcLength < -1 ||
+ (dest==nullptr && destCapacity!=0) || destCapacity<0
) {
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
+ uint8_t *pDest = (uint8_t *)dest;
+ uint8_t *pDestLimit = pDest + destCapacity;
if(srcLength==-1) {
/* Convert NUL-terminated ASCII, then find the string length. */
@@ -1355,13 +1355,13 @@ u_strToJavaModifiedUTF8(
}
/* Faster loop without ongoing checking for pSrcLimit and pDestLimit. */
- pSrcLimit = (src!=NULL)?(src+srcLength):NULL;
+ pSrcLimit = (src!=nullptr)?(src+srcLength):nullptr;
for(;;) {
count = (int32_t)(pDestLimit - pDest);
srcLength = (int32_t)(pSrcLimit - src);
if(count >= srcLength && srcLength > 0 && *src <= 0x7f) {
/* fast ASCII loop */
- const UChar *prevSrc = src;
+ const char16_t *prevSrc = src;
int32_t delta;
while(src < pSrcLimit && (ch = *src) <= 0x7f && ch != 0) {
*pDest++=(uint8_t)ch;
@@ -1373,7 +1373,7 @@ u_strToJavaModifiedUTF8(
}
/*
* Each iteration of the inner loop progresses by at most 3 UTF-8
- * bytes and one UChar.
+ * bytes and one char16_t.
*/
count /= 3;
if(count > srcLength) {
diff --git a/thirdparty/icu4c/common/utext.cpp b/thirdparty/icu4c/common/utext.cpp
index 548e6a60f3..eb0a6984bd 100644
--- a/thirdparty/icu4c/common/utext.cpp
+++ b/thirdparty/icu4c/common/utext.cpp
@@ -124,13 +124,13 @@ utext_setNativeIndex(UText *ut, int64_t index) {
// The convention is that the index must always be on a code point boundary.
// Adjust the index position if it is in the middle of a surrogate pair.
if (ut->chunkOffset<ut->chunkLength) {
- UChar c= ut->chunkContents[ut->chunkOffset];
+ char16_t c= ut->chunkContents[ut->chunkOffset];
if (U16_IS_TRAIL(c)) {
if (ut->chunkOffset==0) {
ut->pFuncs->access(ut, ut->chunkNativeStart, false);
}
if (ut->chunkOffset>0) {
- UChar lead = ut->chunkContents[ut->chunkOffset-1];
+ char16_t lead = ut->chunkContents[ut->chunkOffset-1];
if (U16_IS_LEAD(lead)) {
ut->chunkOffset--;
}
@@ -151,7 +151,7 @@ utext_getPreviousNativeIndex(UText *ut) {
int32_t i = ut->chunkOffset - 1;
int64_t result;
if (i >= 0) {
- UChar c = ut->chunkContents[i];
+ char16_t c = ut->chunkContents[i];
if (U16_IS_TRAIL(c) == false) {
if (i <= ut->nativeIndexingLimit) {
result = ut->chunkNativeStart + i;
@@ -218,13 +218,16 @@ utext_current32(UText *ut) {
// leading surrogate. The attempt to access the trail will fail, but
// the original position before the unpaired lead still needs to be restored.
int64_t nativePosition = ut->chunkNativeLimit;
- int32_t originalOffset = ut->chunkOffset;
if (ut->pFuncs->access(ut, nativePosition, true)) {
trail = ut->chunkContents[ut->chunkOffset];
}
UBool r = ut->pFuncs->access(ut, nativePosition, false); // reverse iteration flag loads preceding chunk
- U_ASSERT(r==true);
- ut->chunkOffset = originalOffset;
+ U_ASSERT(r);
+ // Here we need to restore chunkOffset since the access functions were called with
+ // chunkNativeLimit but that is not where we were (we were 1 code unit before the
+ // limit). Restoring was originally added in ICU-4669 but did not support access
+ // functions that changed the chunk size, the following does.
+ ut->chunkOffset = ut->chunkLength - 1;
if(!r) {
return U_SENTINEL;
}
@@ -425,7 +428,7 @@ utext_previous32From(UText *ut, int64_t index) {
U_CAPI int32_t U_EXPORT2
utext_extract(UText *ut,
int64_t start, int64_t limit,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UErrorCode *status) {
return ut->pFuncs->extract(ut, start, limit, dest, destCapacity, status);
}
@@ -434,7 +437,7 @@ utext_extract(UText *ut,
U_CAPI UBool U_EXPORT2
utext_equals(const UText *a, const UText *b) {
- if (a==NULL || b==NULL ||
+ if (a==nullptr || b==nullptr ||
a->magic != UTEXT_MAGIC ||
b->magic != UTEXT_MAGIC) {
// Null or invalid arguments don't compare equal to anything.
@@ -485,7 +488,7 @@ utext_hasMetaData(const UText *ut)
U_CAPI int32_t U_EXPORT2
utext_replace(UText *ut,
int64_t nativeStart, int64_t nativeLimit,
- const UChar *replacementText, int32_t replacementLength,
+ const char16_t *replacementText, int32_t replacementLength,
UErrorCode *status)
{
if (U_FAILURE(*status)) {
@@ -527,7 +530,7 @@ utext_clone(UText *dest, const UText *src, UBool deep, UBool readOnly, UErrorCod
if (U_FAILURE(*status)) {
return result;
}
- if (result == NULL) {
+ if (result == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return result;
}
@@ -580,16 +583,16 @@ utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) {
return ut;
}
- if (ut == NULL) {
+ if (ut == nullptr) {
// We need to heap-allocate storage for the new UText
int32_t spaceRequired = sizeof(UText);
if (extraSpace > 0) {
spaceRequired = sizeof(ExtendedUText) + extraSpace - sizeof(std::max_align_t);
}
ut = (UText *)uprv_malloc(spaceRequired);
- if (ut == NULL) {
+ if (ut == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
} else {
*ut = emptyText;
ut->flags |= UTEXT_HEAP_ALLOCATED;
@@ -607,7 +610,7 @@ utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) {
}
// If the ut is already open and there's a provider supplied close
// function, call it.
- if ((ut->flags & UTEXT_OPEN) && ut->pFuncs->close != NULL) {
+ if ((ut->flags & UTEXT_OPEN) && ut->pFuncs->close != nullptr) {
ut->pFuncs->close(ut);
}
ut->flags &= ~UTEXT_OPEN;
@@ -622,7 +625,7 @@ utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) {
ut->extraSize = 0;
}
ut->pExtra = uprv_malloc(extraSpace);
- if (ut->pExtra == NULL) {
+ if (ut->pExtra == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
} else {
ut->extraSize = extraSpace;
@@ -635,11 +638,11 @@ utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) {
// Initialize all remaining fields of the UText.
//
- ut->context = NULL;
- ut->chunkContents = NULL;
- ut->p = NULL;
- ut->q = NULL;
- ut->r = NULL;
+ ut->context = nullptr;
+ ut->chunkContents = nullptr;
+ ut->p = nullptr;
+ ut->q = nullptr;
+ ut->r = nullptr;
ut->a = 0;
ut->b = 0;
ut->c = 0;
@@ -652,8 +655,8 @@ utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) {
ut->privA = 0;
ut->privB = 0;
ut->privC = 0;
- ut->privP = NULL;
- if (ut->pExtra!=NULL && ut->extraSize>0)
+ ut->privP = nullptr;
+ if (ut->pExtra!=nullptr && ut->extraSize>0)
uprv_memset(ut->pExtra, 0, ut->extraSize);
}
@@ -663,7 +666,7 @@ utext_setup(UText *ut, int32_t extraSpace, UErrorCode *status) {
U_CAPI UText * U_EXPORT2
utext_close(UText *ut) {
- if (ut==NULL ||
+ if (ut==nullptr ||
ut->magic != UTEXT_MAGIC ||
(ut->flags & UTEXT_OPEN) == 0)
{
@@ -674,7 +677,7 @@ utext_close(UText *ut) {
// If the provider gave us a close function, call it now.
// This will clean up anything allocated specifically by the provider.
- if (ut->pFuncs->close != NULL) {
+ if (ut->pFuncs->close != nullptr) {
ut->pFuncs->close(ut);
}
ut->flags &= ~UTEXT_OPEN;
@@ -683,7 +686,7 @@ utext_close(UText *ut) {
// delete it.
if (ut->flags & UTEXT_EXTRA_HEAP_ALLOCATED) {
uprv_free(ut->pExtra);
- ut->pExtra = NULL;
+ ut->pExtra = nullptr;
ut->flags &= ~UTEXT_EXTRA_HEAP_ALLOCATED;
ut->extraSize = 0;
}
@@ -691,7 +694,7 @@ utext_close(UText *ut) {
// Zero out function table of the closed UText. This is a defensive move,
// intended to cause applications that inadvertently use a closed
// utext to crash with null pointer errors.
- ut->pFuncs = NULL;
+ ut->pFuncs = nullptr;
if (ut->flags & UTEXT_HEAP_ALLOCATED) {
// This UText was allocated by UText setup. We need to free it.
@@ -699,7 +702,7 @@ utext_close(UText *ut) {
// tries to reopen another UText using the deleted storage.
ut->magic = 0;
uprv_free(ut);
- ut = NULL;
+ ut = nullptr;
}
return ut;
}
@@ -772,7 +775,7 @@ static void adjustPointer(UText *dest, const void **destPtr, const UText *src) {
static UText * U_CALLCONV
shallowTextClone(UText * dest, const UText * src, UErrorCode * status) {
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
int32_t srcExtraSize = src->extraSize;
@@ -849,8 +852,8 @@ U_CDECL_END
//------------------------------------------------------------------------------
// Chunk size.
-// Must be less than 85 (256/3), because of byte mapping from UChar indexes to native indexes.
-// Worst case is three native bytes to one UChar. (Supplemenaries are 4 native bytes
+// Must be less than 85 (256/3), because of byte mapping from char16_t indexes to native indexes.
+// Worst case is three native bytes to one char16_t. (Supplemenaries are 4 native bytes
// to two UChars.)
// The longest illegal byte sequence treated as a single error (and converted to U+FFFD)
// is a three-byte sequence (truncated four-byte sequence).
@@ -859,7 +862,7 @@ enum { UTF8_TEXT_CHUNK_SIZE=32 };
//
// UTF8Buf Two of these structs will be set up in the UText's extra allocated space.
-// Each contains the UChar chunk buffer, the to and from native maps, and
+// Each contains the char16_t chunk buffer, the to and from native maps, and
// header info.
//
// because backwards iteration fills the buffers starting at the end and
@@ -872,7 +875,7 @@ enum { UTF8_TEXT_CHUNK_SIZE=32 };
//
struct UTF8Buf {
- int32_t bufNativeStart; // Native index of first char in UChar buf
+ int32_t bufNativeStart; // Native index of first char in char16_t buf
int32_t bufNativeLimit; // Native index following last char in buf.
int32_t bufStartIdx; // First filled position in buf.
int32_t bufLimitIdx; // Limit of filled range in buf.
@@ -882,13 +885,13 @@ struct UTF8Buf {
// Set to bufNativeStart when filling forwards.
// Set to computed value when filling backwards.
- UChar buf[UTF8_TEXT_CHUNK_SIZE+4]; // The UChar buffer. Requires one extra position beyond the
+ char16_t buf[UTF8_TEXT_CHUNK_SIZE+4]; // The char16_t buffer. Requires one extra position beyond the
// the chunk size, to allow for surrogate at the end.
// Length must be identical to mapToNative array, below,
// because of the way indexing works when the array is
// filled backwards during a reverse iteration. Thus,
// the additional extra size.
- uint8_t mapToNative[UTF8_TEXT_CHUNK_SIZE+4]; // map UChar index in buf to
+ uint8_t mapToNative[UTF8_TEXT_CHUNK_SIZE+4]; // map char16_t index in buf to
// native offset from bufNativeStart.
// Requires two extra slots,
// one for a supplementary starting in the last normal position,
@@ -941,7 +944,7 @@ utf8TextAccess(UText *ut, int64_t index, UBool forward) {
// return;
//
const uint8_t *s8=(const uint8_t *)ut->context;
- UTF8Buf *u8b = NULL;
+ UTF8Buf *u8b = nullptr;
int32_t length = ut->b; // Length of original utf-8
int32_t ix= (int32_t)index; // Requested index, trimmed to 32 bits.
int32_t mapIndex = 0;
@@ -1209,7 +1212,7 @@ fillForward:
nulTerminated = true;
}
- UChar *buf = u8b_swap->buf;
+ char16_t *buf = u8b_swap->buf;
uint8_t *mapToNative = u8b_swap->mapToNative;
uint8_t *mapToUChars = u8b_swap->mapToUChars;
int32_t destIx = 0;
@@ -1223,7 +1226,7 @@ fillForward:
if (c>0 && c<0x80) {
// Special case ASCII range for speed.
// zero is excluded to simplify bounds checking.
- buf[destIx] = (UChar)c;
+ buf[destIx] = (char16_t)c;
mapToNative[destIx] = (uint8_t)(srcIx - ix);
mapToUChars[srcIx-ix] = (uint8_t)destIx;
srcIx++;
@@ -1317,7 +1320,7 @@ fillReverse:
ut->q = ut->p;
ut->p = u8b_swap;
- UChar *buf = u8b_swap->buf;
+ char16_t *buf = u8b_swap->buf;
uint8_t *mapToNative = u8b_swap->mapToNative;
uint8_t *mapToUChars = u8b_swap->mapToUChars;
int32_t toUCharsMapStart = ix - sizeof(UTF8Buf::mapToUChars) + 1;
@@ -1349,7 +1352,7 @@ fillReverse:
c = s8[srcIx];
if (c<0x80) {
// Special case ASCII range for speed.
- buf[destIx] = (UChar)c;
+ buf[destIx] = (char16_t)c;
U_ASSERT(toUCharsMapStart <= srcIx);
mapToUChars[srcIx - toUCharsMapStart] = (uint8_t)destIx;
mapToNative[destIx] = (uint8_t)(srcIx - toUCharsMapStart);
@@ -1367,7 +1370,7 @@ fillReverse:
// Store the character in UTF-16 buffer.
if (c<0x10000) {
- buf[destIx] = (UChar)c;
+ buf[destIx] = (char16_t)c;
mapToNative[destIx] = (uint8_t)(srcIx - toUCharsMapStart);
} else {
buf[destIx] = U16_TRAIL(c);
@@ -1414,8 +1417,8 @@ fillReverse:
// Inserts a Replacement Char rather than failing on invalid UTF-8
// Removes unnecessary features.
//
-static UChar*
-utext_strFromUTF8(UChar *dest,
+static char16_t*
+utext_strFromUTF8(char16_t *dest,
int32_t destCapacity,
int32_t *pDestLength,
const char* src,
@@ -1424,8 +1427,8 @@ utext_strFromUTF8(UChar *dest,
)
{
- UChar *pDest = dest;
- UChar *pDestLimit = (dest!=NULL)?(dest+destCapacity):NULL;
+ char16_t *pDest = dest;
+ char16_t *pDestLimit = (dest!=nullptr)?(dest+destCapacity):nullptr;
UChar32 ch=0;
int32_t index = 0;
int32_t reqLength = 0;
@@ -1435,11 +1438,11 @@ utext_strFromUTF8(UChar *dest,
while((index < srcLength)&&(pDest<pDestLimit)){
ch = pSrc[index++];
if(ch <=0x7f){
- *pDest++=(UChar)ch;
+ *pDest++=(char16_t)ch;
}else{
ch=utf8_nextCharSafeBody(pSrc, &index, srcLength, ch, -3);
if(U_IS_BMP(ch)){
- *(pDest++)=(UChar)ch;
+ *(pDest++)=(char16_t)ch;
}else{
*(pDest++)=U16_LEAD(ch);
if(pDest<pDestLimit){
@@ -1479,12 +1482,12 @@ utext_strFromUTF8(UChar *dest,
static int32_t U_CALLCONV
utf8TextExtract(UText *ut,
int64_t start, int64_t limit,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
return 0;
}
- if(destCapacity<0 || (dest==NULL && destCapacity>0)) {
+ if(destCapacity<0 || (dest==nullptr && destCapacity>0)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -1579,7 +1582,7 @@ utf8TextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status)
if (deep && U_SUCCESS(*status)) {
int32_t len = (int32_t)utext_nativeLength((UText *)src);
char *copyStr = (char *)uprv_malloc(len+1);
- if (copyStr == NULL) {
+ if (copyStr == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
} else {
uprv_memcpy(copyStr, src->context, len+1);
@@ -1599,7 +1602,7 @@ utf8TextClose(UText *ut) {
if (ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_OWNS_TEXT)) {
char *s = (char *)ut->context;
uprv_free(s);
- ut->context = NULL;
+ ut->context = nullptr;
}
}
@@ -1614,14 +1617,14 @@ static const struct UTextFuncs utf8Funcs =
utf8TextLength,
utf8TextAccess,
utf8TextExtract,
- NULL, /* replace*/
- NULL, /* copy */
+ nullptr, /* replace*/
+ nullptr, /* copy */
utf8TextMapOffsetToNative,
utf8TextMapIndexToUTF16,
utf8TextClose,
- NULL, // spare 1
- NULL, // spare 2
- NULL // spare 3
+ nullptr, // spare 1
+ nullptr, // spare 2
+ nullptr // spare 3
};
@@ -1630,15 +1633,15 @@ static const char gEmptyString[] = {0};
U_CAPI UText * U_EXPORT2
utext_openUTF8(UText *ut, const char *s, int64_t length, UErrorCode *status) {
if(U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
- if(s==NULL && length==0) {
+ if(s==nullptr && length==0) {
s = gEmptyString;
}
- if(s==NULL || length<-1 || length>INT32_MAX) {
+ if(s==nullptr || length<-1 || length>INT32_MAX) {
*status=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
ut = utext_setup(ut, sizeof(UTF8Buf) * 2, status);
@@ -1688,7 +1691,7 @@ struct ReplExtra {
* Chunk UChars.
* +1 to simplify filling with surrogate pair at the end.
*/
- UChar s[REP_TEXT_CHUNK_SIZE+1];
+ char16_t s[REP_TEXT_CHUNK_SIZE+1];
};
@@ -1701,7 +1704,7 @@ repTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status) {
// For deep clones, make a copy of the Replaceable.
// The copied Replaceable storage is owned by the newly created UText clone.
- // A non-NULL pointer in UText.p is the signal to the close() function to delete
+ // A non-nullptr pointer in UText.p is the signal to the close() function to delete
// it.
//
if (deep && U_SUCCESS(*status)) {
@@ -1724,7 +1727,7 @@ repTextClose(UText *ut) {
if (ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_OWNS_TEXT)) {
Replaceable *rep = (Replaceable *)ut->context;
delete rep;
- ut->context = NULL;
+ ut->context = nullptr;
}
}
@@ -1751,7 +1754,7 @@ repTextAccess(UText *ut, int64_t index, UBool forward) {
* Compute start/limit boundaries around index, for a segment of text
* to be extracted.
* To allow for the possibility that our user gave an index to the trailing
- * half of a surrogate pair, we must request one extra preceding UChar when
+ * half of a surrogate pair, we must request one extra preceding char16_t when
* going in the forward direction. This will ensure that the buffer has the
* entire code point at the specified index.
*/
@@ -1799,7 +1802,7 @@ repTextAccess(UText *ut, int64_t index, UBool forward) {
// Figure out the bounds of the chunk to extract for reverse iteration.
// Need to worry about chunk not splitting surrogate pairs, and while still
// containing the data we need.
- // Fix by requesting a chunk that includes an extra UChar at the end.
+ // Fix by requesting a chunk that includes an extra char16_t at the end.
// If this turns out to be a lead surrogate, we can lop it off and still have
// the data we wanted.
ut->chunkNativeStart = index32 + 1 - REP_TEXT_CHUNK_SIZE;
@@ -1834,7 +1837,7 @@ repTextAccess(UText *ut, int64_t index, UBool forward) {
}
}
- // if the first UChar in the chunk could be the trailing half of a surrogate pair,
+ // if the first char16_t in the chunk could be the trailing half of a surrogate pair,
// trim it off.
if(ut->chunkNativeStart>0 && U16_IS_TRAIL(ex->s[0])) {
++(ut->chunkContents);
@@ -1857,7 +1860,7 @@ repTextAccess(UText *ut, int64_t index, UBool forward) {
static int32_t U_CALLCONV
repTextExtract(UText *ut,
int64_t start, int64_t limit,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UErrorCode *status) {
const Replaceable *rep=(const Replaceable *)ut->context;
int32_t length=rep->length();
@@ -1865,7 +1868,7 @@ repTextExtract(UText *ut,
if(U_FAILURE(*status)) {
return 0;
}
- if(destCapacity<0 || (dest==NULL && destCapacity>0)) {
+ if(destCapacity<0 || (dest==nullptr && destCapacity>0)) {
*status=U_ILLEGAL_ARGUMENT_ERROR;
}
if(start>limit) {
@@ -1900,7 +1903,7 @@ repTextExtract(UText *ut,
static int32_t U_CALLCONV
repTextReplace(UText *ut,
int64_t start, int64_t limit,
- const UChar *src, int32_t length,
+ const char16_t *src, int32_t length,
UErrorCode *status) {
Replaceable *rep=(Replaceable *)ut->context;
int32_t oldLength;
@@ -1908,7 +1911,7 @@ repTextReplace(UText *ut,
if(U_FAILURE(*status)) {
return 0;
}
- if(src==NULL && length!=0) {
+ if(src==nullptr && length!=0) {
*status=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -2025,12 +2028,12 @@ static const struct UTextFuncs repFuncs =
repTextExtract,
repTextReplace,
repTextCopy,
- NULL, // MapOffsetToNative,
- NULL, // MapIndexToUTF16,
+ nullptr, // MapOffsetToNative,
+ nullptr, // MapIndexToUTF16,
repTextClose,
- NULL, // spare 1
- NULL, // spare 2
- NULL // spare 3
+ nullptr, // spare 1
+ nullptr, // spare 2
+ nullptr // spare 3
};
@@ -2038,11 +2041,11 @@ U_CAPI UText * U_EXPORT2
utext_openReplaceable(UText *ut, Replaceable *rep, UErrorCode *status)
{
if(U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
- if(rep==NULL) {
+ if(rep==nullptr) {
*status=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
ut = utext_setup(ut, sizeof(ReplExtra), status);
if(U_FAILURE(*status)) {
@@ -2077,7 +2080,7 @@ U_CDECL_END
// Use of UText data members:
// context pointer to UnicodeString
// p pointer to UnicodeString IF this UText owns the string
-// and it must be deleted on close(). NULL otherwise.
+// and it must be deleted on close(). nullptr otherwise.
//
//------------------------------------------------------------------------------
@@ -2091,7 +2094,7 @@ unistrTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status) {
// For deep clones, make a copy of the UnicodeSring.
// The copied UnicodeString storage is owned by the newly created UText clone.
- // A non-NULL pointer in UText.p is the signal to the close() function to delete
+ // A non-nullptr pointer in UText.p is the signal to the close() function to delete
// the UText.
//
if (deep && U_SUCCESS(*status)) {
@@ -2113,7 +2116,7 @@ unistrTextClose(UText *ut) {
if (ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_OWNS_TEXT)) {
UnicodeString *str = (UnicodeString *)ut->context;
delete str;
- ut->context = NULL;
+ ut->context = nullptr;
}
}
@@ -2139,7 +2142,7 @@ unistrTextAccess(UText *ut, int64_t index, UBool forward) {
static int32_t U_CALLCONV
unistrTextExtract(UText *t,
int64_t start, int64_t limit,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UErrorCode *pErrorCode) {
const UnicodeString *us=(const UnicodeString *)t->context;
int32_t length=us->length();
@@ -2147,7 +2150,7 @@ unistrTextExtract(UText *t,
if(U_FAILURE(*pErrorCode)) {
return 0;
}
- if(destCapacity<0 || (dest==NULL && destCapacity>0)) {
+ if(destCapacity<0 || (dest==nullptr && destCapacity>0)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
}
if(start<0 || start>limit) {
@@ -2159,7 +2162,7 @@ unistrTextExtract(UText *t,
int32_t limit32 = limit<length ? us->getChar32Start((int32_t)limit) : length;
length=limit32-start32;
- if (destCapacity>0 && dest!=NULL) {
+ if (destCapacity>0 && dest!=nullptr) {
int32_t trimmedLength = length;
if(trimmedLength>destCapacity) {
trimmedLength=destCapacity;
@@ -2176,7 +2179,7 @@ unistrTextExtract(UText *t,
static int32_t U_CALLCONV
unistrTextReplace(UText *ut,
int64_t start, int64_t limit,
- const UChar *src, int32_t length,
+ const char16_t *src, int32_t length,
UErrorCode *pErrorCode) {
UnicodeString *us=(UnicodeString *)ut->context;
int32_t oldLength;
@@ -2184,7 +2187,7 @@ unistrTextReplace(UText *ut,
if(U_FAILURE(*pErrorCode)) {
return 0;
}
- if(src==NULL && length!=0) {
+ if(src==nullptr && length!=0) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
}
if(start>limit) {
@@ -2279,12 +2282,12 @@ static const struct UTextFuncs unistrFuncs =
unistrTextExtract,
unistrTextReplace,
unistrTextCopy,
- NULL, // MapOffsetToNative,
- NULL, // MapIndexToUTF16,
+ nullptr, // MapOffsetToNative,
+ nullptr, // MapIndexToUTF16,
unistrTextClose,
- NULL, // spare 1
- NULL, // spare 2
- NULL // spare 3
+ nullptr, // spare 1
+ nullptr, // spare 2
+ nullptr // spare 3
};
@@ -2308,7 +2311,7 @@ utext_openConstUnicodeString(UText *ut, const UnicodeString *s, UErrorCode *stat
if (U_SUCCESS(*status) && s->isBogus()) {
// The UnicodeString is bogus, but we still need to detach the UText
// from whatever it was hooked to before, if anything.
- utext_openUChars(ut, NULL, 0, status);
+ utext_openUChars(ut, nullptr, 0, status);
*status = U_ILLEGAL_ARGUMENT_ERROR;
return ut;
}
@@ -2331,7 +2334,7 @@ utext_openConstUnicodeString(UText *ut, const UnicodeString *s, UErrorCode *stat
//------------------------------------------------------------------------------
//
-// UText implementation for const UChar * strings
+// UText implementation for const char16_t * strings
//
// Use of UText data members:
// context pointer to UnicodeString
@@ -2351,7 +2354,7 @@ ucstrTextClone(UText *dest, const UText * src, UBool deep, UErrorCode * status)
// For deep clones, make a copy of the string.
// The copied storage is owned by the newly created clone.
- // A non-NULL pointer in UText.p is the signal to the close() function to delete
+ // A non-nullptr pointer in UText.p is the signal to the close() function to delete
// it.
//
if (deep && U_SUCCESS(*status)) {
@@ -2359,9 +2362,9 @@ ucstrTextClone(UText *dest, const UText * src, UBool deep, UErrorCode * status)
int32_t len = (int32_t)utext_nativeLength(dest);
// The cloned string IS going to be NUL terminated, whether or not the original was.
- const UChar *srcStr = (const UChar *)src->context;
- UChar *copyStr = (UChar *)uprv_malloc((len+1) * sizeof(UChar));
- if (copyStr == NULL) {
+ const char16_t *srcStr = (const char16_t *)src->context;
+ char16_t *copyStr = (char16_t *)uprv_malloc((len+1) * sizeof(char16_t));
+ if (copyStr == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
} else {
int64_t i;
@@ -2383,9 +2386,9 @@ ucstrTextClose(UText *ut) {
// All that needs to be done here is delete the string if the UText
// owns it. This occurs if the UText was created by cloning.
if (ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_OWNS_TEXT)) {
- UChar *s = (UChar *)ut->context;
+ char16_t *s = (char16_t *)ut->context;
uprv_free(s);
- ut->context = NULL;
+ ut->context = nullptr;
}
}
@@ -2397,7 +2400,7 @@ ucstrTextLength(UText *ut) {
// null terminated, we don't yet know the length. Scan for it.
// Access is not convenient for doing this
// because the current iteration position can't be changed.
- const UChar *str = (const UChar *)ut->context;
+ const char16_t *str = (const char16_t *)ut->context;
for (;;) {
if (str[ut->chunkNativeLimit] == 0) {
break;
@@ -2415,7 +2418,7 @@ ucstrTextLength(UText *ut) {
static UBool U_CALLCONV
ucstrTextAccess(UText *ut, int64_t index, UBool forward) {
- const UChar *str = (const UChar *)ut->context;
+ const char16_t *str = (const char16_t *)ut->context;
// pin the requested index to the bounds of the string,
// and set current iteration position.
@@ -2505,18 +2508,18 @@ breakout:
static int32_t U_CALLCONV
ucstrTextExtract(UText *ut,
int64_t start, int64_t limit,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UErrorCode *pErrorCode)
{
if(U_FAILURE(*pErrorCode)) {
return 0;
}
- if(destCapacity<0 || (dest==NULL && destCapacity>0) || start>limit) {
+ if(destCapacity<0 || (dest==nullptr && destCapacity>0) || start>limit) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
- //const UChar *s=(const UChar *)ut->context;
+ //const char16_t *s=(const char16_t *)ut->context;
int32_t si, di;
int32_t start32;
@@ -2526,7 +2529,7 @@ ucstrTextExtract(UText *ut,
// Pins 'start' to the length of the string, if it came in out-of-bounds.
// Snaps 'start' to the beginning of a code point.
ucstrTextAccess(ut, start, true);
- const UChar *s=ut->chunkContents;
+ const char16_t *s=ut->chunkContents;
start32 = ut->chunkOffset;
int32_t strLength=(int32_t)ut->a;
@@ -2596,31 +2599,31 @@ static const struct UTextFuncs ucstrFuncs =
ucstrTextLength,
ucstrTextAccess,
ucstrTextExtract,
- NULL, // Replace
- NULL, // Copy
- NULL, // MapOffsetToNative,
- NULL, // MapIndexToUTF16,
+ nullptr, // Replace
+ nullptr, // Copy
+ nullptr, // MapOffsetToNative,
+ nullptr, // MapIndexToUTF16,
ucstrTextClose,
- NULL, // spare 1
- NULL, // spare 2
- NULL, // spare 3
+ nullptr, // spare 1
+ nullptr, // spare 2
+ nullptr, // spare 3
};
U_CDECL_END
-static const UChar gEmptyUString[] = {0};
+static const char16_t gEmptyUString[] = {0};
U_CAPI UText * U_EXPORT2
-utext_openUChars(UText *ut, const UChar *s, int64_t length, UErrorCode *status) {
+utext_openUChars(UText *ut, const char16_t *s, int64_t length, UErrorCode *status) {
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
- if(s==NULL && length==0) {
+ if(s==nullptr && length==0) {
s = gEmptyUString;
}
- if (s==NULL || length < -1 || length>INT32_MAX) {
+ if (s==nullptr || length < -1 || length>INT32_MAX) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
ut = utext_setup(ut, 0, status);
if (U_SUCCESS(*status)) {
@@ -2667,7 +2670,7 @@ charIterTextClose(UText *ut) {
// owns it. This occurs if the UText was created by cloning.
CharacterIterator *ci = (CharacterIterator *)ut->r;
delete ci;
- ut->r = NULL;
+ ut->r = nullptr;
}
static int64_t U_CALLCONV
@@ -2697,7 +2700,7 @@ charIterTextAccess(UText *ut, int64_t index, UBool forward) {
// Find the native index of the start of the buffer containing what we want.
neededIndex -= neededIndex % CIBufSize;
- UChar *buf = NULL;
+ char16_t *buf = nullptr;
UBool needChunkSetup = true;
int i;
if (ut->chunkNativeStart == neededIndex) {
@@ -2705,17 +2708,17 @@ charIterTextAccess(UText *ut, int64_t index, UBool forward) {
needChunkSetup = false;
} else if (ut->b == neededIndex) {
// The first buffer (buffer p) has what we need.
- buf = (UChar *)ut->p;
+ buf = (char16_t *)ut->p;
} else if (ut->c == neededIndex) {
// The second buffer (buffer q) has what we need.
- buf = (UChar *)ut->q;
+ buf = (char16_t *)ut->q;
} else {
// Neither buffer already has what we need.
// Load new data from the character iterator.
// Use the buf that is not the current buffer.
- buf = (UChar *)ut->p;
+ buf = (char16_t *)ut->p;
if (ut->p == ut->chunkContents) {
- buf = (UChar *)ut->q;
+ buf = (char16_t *)ut->q;
}
ci->setIndex(neededIndex);
for (i=0; i<CIBufSize; i++) {
@@ -2748,13 +2751,13 @@ charIterTextAccess(UText *ut, int64_t index, UBool forward) {
static UText * U_CALLCONV
charIterTextClone(UText *dest, const UText *src, UBool deep, UErrorCode * status) {
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
if (deep) {
// There is no CharacterIterator API for cloning the underlying text storage.
*status = U_UNSUPPORTED_ERROR;
- return NULL;
+ return nullptr;
} else {
CharacterIterator *srcCI =(CharacterIterator *)src->context;
srcCI = srcCI->clone();
@@ -2774,13 +2777,13 @@ charIterTextClone(UText *dest, const UText *src, UBool deep, UErrorCode * status
static int32_t U_CALLCONV
charIterTextExtract(UText *ut,
int64_t start, int64_t limit,
- UChar *dest, int32_t destCapacity,
+ char16_t *dest, int32_t destCapacity,
UErrorCode *status)
{
if(U_FAILURE(*status)) {
return 0;
}
- if(destCapacity<0 || (dest==NULL && destCapacity>0) || start>limit) {
+ if(destCapacity<0 || (dest==nullptr && destCapacity>0) || start>limit) {
*status=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -2823,14 +2826,14 @@ static const struct UTextFuncs charIterFuncs =
charIterTextLength,
charIterTextAccess,
charIterTextExtract,
- NULL, // Replace
- NULL, // Copy
- NULL, // MapOffsetToNative,
- NULL, // MapIndexToUTF16,
+ nullptr, // Replace
+ nullptr, // Copy
+ nullptr, // MapOffsetToNative,
+ nullptr, // MapIndexToUTF16,
charIterTextClose,
- NULL, // spare 1
- NULL, // spare 2
- NULL // spare 3
+ nullptr, // spare 1
+ nullptr, // spare 2
+ nullptr // spare 3
};
U_CDECL_END
@@ -2838,17 +2841,17 @@ U_CDECL_END
U_CAPI UText * U_EXPORT2
utext_openCharacterIterator(UText *ut, CharacterIterator *ci, UErrorCode *status) {
if (U_FAILURE(*status)) {
- return NULL;
+ return nullptr;
}
if (ci->startIndex() > 0) {
// No support for CharacterIterators that do not start indexing from zero.
*status = U_UNSUPPORTED_ERROR;
- return NULL;
+ return nullptr;
}
// Extra space in UText for 2 buffers of CIBufSize UChars each.
- int32_t extraSpace = 2 * CIBufSize * sizeof(UChar);
+ int32_t extraSpace = 2 * CIBufSize * sizeof(char16_t);
ut = utext_setup(ut, extraSpace, status);
if (U_SUCCESS(*status)) {
ut->pFuncs = &charIterFuncs;
@@ -2857,7 +2860,7 @@ utext_openCharacterIterator(UText *ut, CharacterIterator *ci, UErrorCode *status
ut->a = ci->endIndex(); // Length of text
ut->p = ut->pExtra; // First buffer
ut->b = -1; // Native index of first buffer contents
- ut->q = (UChar*)ut->pExtra+CIBufSize; // Second buffer
+ ut->q = (char16_t*)ut->pExtra+CIBufSize; // Second buffer
ut->c = -1; // Native index of second buffer contents
// Initialize current chunk contents to be empty.
@@ -2866,7 +2869,7 @@ utext_openCharacterIterator(UText *ut, CharacterIterator *ci, UErrorCode *status
// so that getNativeIndex() will correctly compute to zero
// if no call to Access() has ever been made. They can't be both
// zero without Access() thinking that the chunk is valid.
- ut->chunkContents = (UChar *)ut->p;
+ ut->chunkContents = (char16_t *)ut->p;
ut->chunkNativeStart = -1;
ut->chunkOffset = 1;
ut->chunkNativeLimit = 0;
diff --git a/thirdparty/icu4c/common/utf_impl.cpp b/thirdparty/icu4c/common/utf_impl.cpp
index a1f9c6529a..827a82daf4 100644
--- a/thirdparty/icu4c/common/utf_impl.cpp
+++ b/thirdparty/icu4c/common/utf_impl.cpp
@@ -213,7 +213,7 @@ utf8_appendCharSafeBody(uint8_t *s, int32_t i, int32_t length, UChar32 c, UBool
}
}
/* c>0x10ffff or not enough space, write an error value */
- if(pIsError!=NULL) {
+ if(pIsError!=nullptr) {
*pIsError=true;
} else {
length-=i;
diff --git a/thirdparty/icu4c/common/util.cpp b/thirdparty/icu4c/common/util.cpp
index 3dcc05578b..f6a13aa445 100644
--- a/thirdparty/icu4c/common/util.cpp
+++ b/thirdparty/icu4c/common/util.cpp
@@ -15,16 +15,16 @@
#include "patternprops.h"
#include "util.h"
-// Define UChar constants using hex for EBCDIC compatibility
+// Define char16_t constants using hex for EBCDIC compatibility
-static const UChar BACKSLASH = 0x005C; /*\*/
-static const UChar UPPER_U = 0x0055; /*U*/
-static const UChar LOWER_U = 0x0075; /*u*/
-static const UChar APOSTROPHE = 0x0027; // '\''
-static const UChar SPACE = 0x0020; // ' '
+static const char16_t BACKSLASH = 0x005C; /*\*/
+static const char16_t UPPER_U = 0x0055; /*U*/
+static const char16_t LOWER_U = 0x0075; /*u*/
+static const char16_t APOSTROPHE = 0x0027; // '\''
+static const char16_t SPACE = 0x0020; // ' '
// "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-static const UChar DIGITS[] = {
+static const char16_t DIGITS[] = {
48,49,50,51,52,53,54,55,56,57,
65,66,67,68,69,70,71,72,73,74,
75,76,77,78,79,80,81,82,83,84,
@@ -37,12 +37,12 @@ UnicodeString& ICU_Utility::appendNumber(UnicodeString& result, int32_t n,
int32_t radix, int32_t minDigits) {
if (radix < 2 || radix > 36) {
// Bogus radix
- return result.append((UChar)63/*?*/);
+ return result.append((char16_t)63/*?*/);
}
// Handle negatives
if (n < 0) {
n = -n;
- result.append((UChar)45/*-*/);
+ result.append((char16_t)45/*-*/);
}
// First determine the number of digits
int32_t nn = n;
@@ -122,9 +122,9 @@ UnicodeString &ICU_Utility::escape(UnicodeString& result, UChar32 c) {
/*
int32_t ICU_Utility::quotedIndexOf(const UnicodeString& text,
int32_t start, int32_t limit,
- UChar charToFind) {
+ char16_t charToFind) {
for (int32_t i=start; i<limit; ++i) {
- UChar c = text.charAt(i);
+ char16_t c = text.charAt(i);
if (c == BACKSLASH) {
++i;
} else if (c == APOSTROPHE) {
@@ -149,7 +149,7 @@ int32_t ICU_Utility::quotedIndexOf(const UnicodeString& text,
int32_t ICU_Utility::skipWhitespace(const UnicodeString& str, int32_t& pos,
UBool advance) {
int32_t p = pos;
- const UChar* s = str.getBuffer();
+ const char16_t* s = str.getBuffer();
p = (int32_t)(PatternProps::skipWhiteSpace(s + p, str.length() - p) - s);
if (advance) {
pos = p;
@@ -212,7 +212,7 @@ int32_t ICU_Utility::skipWhitespace(const UnicodeString& str, int32_t& pos,
* @return true if 'ch' is seen preceded by zero or more
* whitespace characters.
*/
-UBool ICU_Utility::parseChar(const UnicodeString& id, int32_t& pos, UChar ch) {
+UBool ICU_Utility::parseChar(const UnicodeString& id, int32_t& pos, char16_t ch) {
int32_t start = pos;
skipWhitespace(id, pos, true);
if (pos == id.length() ||
@@ -292,7 +292,7 @@ int32_t ICU_Utility::parsePattern(const UnicodeString& pat,
int32_t ICU_Utility::parseAsciiInteger(const UnicodeString& str, int32_t& pos) {
int32_t result = 0;
- UChar c;
+ char16_t c;
while (pos < str.length() && (c = str.charAt(pos)) >= u'0' && c <= u'9') {
result = result * 10 + (c - u'0');
pos++;
@@ -425,7 +425,7 @@ void ICU_Utility::appendToRule(UnicodeString& rule,
const UnicodeMatcher* matcher,
UBool escapeUnprintable,
UnicodeString& quoteBuf) {
- if (matcher != NULL) {
+ if (matcher != nullptr) {
UnicodeString pat;
appendToRule(rule, matcher->toPattern(pat, escapeUnprintable),
true, escapeUnprintable, quoteBuf);
diff --git a/thirdparty/icu4c/common/util.h b/thirdparty/icu4c/common/util.h
index 4a9ae831de..cf71b9623e 100644
--- a/thirdparty/icu4c/common/util.h
+++ b/thirdparty/icu4c/common/util.h
@@ -94,7 +94,7 @@ class U_COMMON_API ICU_Utility /* not : public UObject because all methods are s
//?FOR FUTURE USE. DISABLE FOR NOW for coverage reasons.
// static int32_t quotedIndexOf(const UnicodeString& text,
// int32_t start, int32_t limit,
-// UChar c);
+// char16_t c);
/**
* Skip over a sequence of zero or more white space characters at pos.
@@ -140,7 +140,7 @@ class U_COMMON_API ICU_Utility /* not : public UObject because all methods are s
* @return true if 'ch' is seen preceded by zero or more
* whitespace characters.
*/
- static UBool parseChar(const UnicodeString& id, int32_t& pos, UChar ch);
+ static UBool parseChar(const UnicodeString& id, int32_t& pos, char16_t ch);
/**
* Parse a pattern string starting at offset pos. Keywords are
diff --git a/thirdparty/icu4c/common/util_props.cpp b/thirdparty/icu4c/common/util_props.cpp
index d6ae052214..5991769d06 100644
--- a/thirdparty/icu4c/common/util_props.cpp
+++ b/thirdparty/icu4c/common/util_props.cpp
@@ -91,8 +91,8 @@ int32_t ICU_Utility::parsePattern(const UnicodeString& rule, int32_t pos, int32_
int32_t p;
int32_t intCount = 0; // number of integers parsed
for (int32_t i=0; i<pattern.length(); ++i) {
- UChar cpat = pattern.charAt(i);
- UChar c;
+ char16_t cpat = pattern.charAt(i);
+ char16_t c;
switch (cpat) {
case 32 /*' '*/:
if (pos >= limit) {
@@ -120,7 +120,7 @@ int32_t ICU_Utility::parsePattern(const UnicodeString& rule, int32_t pos, int32_
if (pos >= limit) {
return -1;
}
- c = (UChar) u_tolower(rule.charAt(pos++));
+ c = (char16_t) u_tolower(rule.charAt(pos++));
if (c != cpat) {
return -1;
}
diff --git a/thirdparty/icu4c/common/utrace.cpp b/thirdparty/icu4c/common/utrace.cpp
index f7b8ade674..1f536d5643 100644
--- a/thirdparty/icu4c/common/utrace.cpp
+++ b/thirdparty/icu4c/common/utrace.cpp
@@ -18,10 +18,10 @@
#include "ucln_cmn.h"
-static UTraceEntry *pTraceEntryFunc = NULL;
-static UTraceExit *pTraceExitFunc = NULL;
-static UTraceData *pTraceDataFunc = NULL;
-static const void *gTraceContext = NULL;
+static UTraceEntry *pTraceEntryFunc = nullptr;
+static UTraceExit *pTraceExitFunc = nullptr;
+static UTraceData *pTraceDataFunc = nullptr;
+static const void *gTraceContext = nullptr;
/**
* \var utrace_level
@@ -32,7 +32,7 @@ utrace_level = UTRACE_ERROR;
U_CAPI void U_EXPORT2
utrace_entry(int32_t fnNumber) {
- if (pTraceEntryFunc != NULL) {
+ if (pTraceEntryFunc != nullptr) {
(*pTraceEntryFunc)(gTraceContext, fnNumber);
}
}
@@ -46,7 +46,7 @@ static const char gExitFmtPtrStatus[] = "Returns %d. Status = %p.";
U_CAPI void U_EXPORT2
utrace_exit(int32_t fnNumber, int32_t returnType, ...) {
- if (pTraceExitFunc != NULL) {
+ if (pTraceExitFunc != nullptr) {
va_list args;
const char *fmt;
@@ -80,7 +80,7 @@ utrace_exit(int32_t fnNumber, int32_t returnType, ...) {
U_CAPI void U_EXPORT2
utrace_data(int32_t fnNumber, int32_t level, const char *fmt, ...) {
- if (pTraceDataFunc != NULL) {
+ if (pTraceDataFunc != nullptr) {
va_list args;
va_start(args, fmt );
(*pTraceDataFunc)(gTraceContext, fnNumber, level, fmt, args);
@@ -117,9 +117,9 @@ static void outputChar(char c, char *outBuf, int32_t *outIx, int32_t capacity, i
outBuf[*outIx] = c;
}
if (c != 0) {
- /* Nulls only appear as end-of-string terminators. Move them to the output
+ /* NULs only appear as end-of-string terminators. Move them to the output
* buffer, but do not update the length of the buffer, so that any
- * following output will overwrite the null. */
+ * following output will overwrite the NUL. */
(*outIx)++;
}
}
@@ -157,7 +157,7 @@ static void outputPtrBytes(void *val, char *outBuf, int32_t *outIx, int32_t capa
static void outputString(const char *s, char *outBuf, int32_t *outIx, int32_t capacity, int32_t indent) {
int32_t i = 0;
char c;
- if (s==NULL) {
+ if (s==nullptr) {
s = "*NULL*";
}
do {
@@ -168,12 +168,12 @@ static void outputString(const char *s, char *outBuf, int32_t *outIx, int32_t ca
-static void outputUString(const UChar *s, int32_t len,
+static void outputUString(const char16_t *s, int32_t len,
char *outBuf, int32_t *outIx, int32_t capacity, int32_t indent) {
int32_t i = 0;
- UChar c;
- if (s==NULL) {
- outputString(NULL, outBuf, outIx, capacity, indent);
+ char16_t c;
+ if (s==nullptr) {
+ outputString(nullptr, outBuf, outIx, capacity, indent);
return;
}
@@ -205,7 +205,7 @@ utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt,
/* Literal character, not part of a %sequence. Just copy it to the output. */
outputChar(fmtC, outBuf, &outIx, capacity, indent);
if (fmtC == 0) {
- /* We hit the null that terminates the format string.
+ /* We hit the NUL that terminates the format string.
* This is the normal (and only) exit from the loop that
* interprets the format
*/
@@ -225,16 +225,16 @@ utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt,
break;
case 's':
- /* char * string, null terminated. */
+ /* char * string, NUL terminated. */
ptrArg = va_arg(args, char *);
outputString((const char *)ptrArg, outBuf, &outIx, capacity, indent);
break;
case 'S':
- /* UChar * string, with length, len==-1 for null terminated. */
+ /* char16_t * string, with length, len==-1 for NUL terminated. */
ptrArg = va_arg(args, char *); /* Ptr */
intArg =(int32_t)va_arg(args, int32_t); /* Length */
- outputUString((const UChar *)ptrArg, intArg, outBuf, &outIx, capacity, indent);
+ outputUString((const char16_t *)ptrArg, intArg, outBuf, &outIx, capacity, indent);
break;
case 'b':
@@ -269,7 +269,7 @@ utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt,
case 0:
/* Single '%' at end of fmt string. Output as literal '%'.
- * Back up index into format string so that the terminating null will be
+ * Back up index into format string so that the terminating NUL will be
* re-fetched in the outer loop, causing it to terminate.
*/
outputChar('%', outBuf, &outIx, capacity, indent);
@@ -299,7 +299,7 @@ utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt,
i64Ptr = (int64_t *)i8Ptr;
ptrPtr = (void **)i8Ptr;
vectorLen =(int32_t)va_arg(args, int32_t);
- if (ptrPtr == NULL) {
+ if (ptrPtr == nullptr) {
outputString("*NULL* ", outBuf, &outIx, capacity, indent);
} else {
for (i=0; i<vectorLen || vectorLen==-1; i++) {
@@ -323,28 +323,28 @@ utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt,
case 'p':
charsToOutput = 0;
outputPtrBytes(*ptrPtr, outBuf, &outIx, capacity);
- longArg = *ptrPtr==NULL? 0: 1; /* test for null terminated array. */
+ longArg = *ptrPtr==nullptr? 0: 1; /* test for nullptr terminated array. */
ptrPtr++;
break;
case 'c':
charsToOutput = 0;
outputChar(*i8Ptr, outBuf, &outIx, capacity, indent);
- longArg = *i8Ptr; /* for test for null terminated array. */
+ longArg = *i8Ptr; /* for test for nullptr terminated array. */
i8Ptr++;
break;
case 's':
charsToOutput = 0;
outputString((const char *)*ptrPtr, outBuf, &outIx, capacity, indent);
outputChar('\n', outBuf, &outIx, capacity, indent);
- longArg = *ptrPtr==NULL? 0: 1; /* for test for null term. array. */
+ longArg = *ptrPtr==nullptr? 0: 1; /* for test for nullptr term. array. */
ptrPtr++;
break;
case 'S':
charsToOutput = 0;
- outputUString((const UChar *)*ptrPtr, -1, outBuf, &outIx, capacity, indent);
+ outputUString((const char16_t *)*ptrPtr, -1, outBuf, &outIx, capacity, indent);
outputChar('\n', outBuf, &outIx, capacity, indent);
- longArg = *ptrPtr==NULL? 0: 1; /* for test for null term. array. */
+ longArg = *ptrPtr==nullptr? 0: 1; /* for test for nullptr term. array. */
ptrPtr++;
break;
@@ -374,8 +374,8 @@ utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt,
outputChar(fmtC, outBuf, &outIx, capacity, indent);
}
}
- outputChar(0, outBuf, &outIx, capacity, indent); /* Make sure that output is null terminated */
- return outIx + 1; /* outIx + 1 because outIx does not increment when outputting final null. */
+ outputChar(0, outBuf, &outIx, capacity, indent); /* Make sure that output is NUL terminated */
+ return outIx + 1; /* outIx + 1 because outIx does not increment when outputting final NUL. */
}
@@ -431,11 +431,11 @@ utrace_getLevel() {
U_CFUNC UBool
utrace_cleanup() {
- pTraceEntryFunc = NULL;
- pTraceExitFunc = NULL;
- pTraceDataFunc = NULL;
+ pTraceEntryFunc = nullptr;
+ pTraceExitFunc = nullptr;
+ pTraceDataFunc = nullptr;
utrace_level = UTRACE_OFF;
- gTraceContext = NULL;
+ gTraceContext = nullptr;
return true;
}
@@ -444,7 +444,7 @@ static const char * const
trFnName[] = {
"u_init",
"u_cleanup",
- NULL
+ nullptr
};
@@ -458,7 +458,7 @@ trConvNames[] = {
"ucnv_flushCache",
"ucnv_load",
"ucnv_unload",
- NULL
+ nullptr
};
@@ -473,7 +473,7 @@ trCollNames[] = {
"ucol_strcollIter",
"ucol_openFromShortString",
"ucol_strcollUTF8",
- NULL
+ nullptr
};
@@ -483,7 +483,7 @@ trResDataNames[] = {
"bundle-open",
"file-open",
"res-open",
- NULL
+ nullptr
};
diff --git a/thirdparty/icu4c/common/utrie.cpp b/thirdparty/icu4c/common/utrie.cpp
index 96f2397ca1..83be0e3407 100644
--- a/thirdparty/icu4c/common/utrie.cpp
+++ b/thirdparty/icu4c/common/utrie.cpp
@@ -56,28 +56,28 @@ utrie_open(UNewTrie *fillIn,
if( maxDataLength<UTRIE_DATA_BLOCK_LENGTH ||
(latin1Linear && maxDataLength<1024)
) {
- return NULL;
+ return nullptr;
}
- if(fillIn!=NULL) {
+ if(fillIn!=nullptr) {
trie=fillIn;
} else {
trie=(UNewTrie *)uprv_malloc(sizeof(UNewTrie));
- if(trie==NULL) {
- return NULL;
+ if(trie==nullptr) {
+ return nullptr;
}
}
uprv_memset(trie, 0, sizeof(UNewTrie));
- trie->isAllocated= (UBool)(fillIn==NULL);
+ trie->isAllocated= (UBool)(fillIn==nullptr);
- if(aliasData!=NULL) {
+ if(aliasData!=nullptr) {
trie->data=aliasData;
trie->isDataAllocated=false;
} else {
trie->data=(uint32_t *)uprv_malloc(maxDataLength*4);
- if(trie->data==NULL) {
+ if(trie->data==nullptr) {
uprv_free(trie);
- return NULL;
+ return nullptr;
}
trie->isDataAllocated=true;
}
@@ -118,18 +118,18 @@ utrie_clone(UNewTrie *fillIn, const UNewTrie *other, uint32_t *aliasData, int32_
UBool isDataAllocated;
/* do not clone if other is not valid or already compacted */
- if(other==NULL || other->data==NULL || other->isCompacted) {
- return NULL;
+ if(other==nullptr || other->data==nullptr || other->isCompacted) {
+ return nullptr;
}
/* clone data */
- if(aliasData!=NULL && aliasDataCapacity>=other->dataCapacity) {
+ if(aliasData!=nullptr && aliasDataCapacity>=other->dataCapacity) {
isDataAllocated=false;
} else {
aliasDataCapacity=other->dataCapacity;
aliasData=(uint32_t *)uprv_malloc(other->dataCapacity*4);
- if(aliasData==NULL) {
- return NULL;
+ if(aliasData==nullptr) {
+ return nullptr;
}
isDataAllocated=true;
}
@@ -137,7 +137,7 @@ utrie_clone(UNewTrie *fillIn, const UNewTrie *other, uint32_t *aliasData, int32_
trie=utrie_open(fillIn, aliasData, aliasDataCapacity,
other->data[0], other->leadUnitValue,
other->isLatin1Linear);
- if(trie==NULL) {
+ if(trie==nullptr) {
uprv_free(aliasData);
} else {
uprv_memcpy(trie->index, other->index, sizeof(trie->index));
@@ -151,10 +151,10 @@ utrie_clone(UNewTrie *fillIn, const UNewTrie *other, uint32_t *aliasData, int32_
U_CAPI void U_EXPORT2
utrie_close(UNewTrie *trie) {
- if(trie!=NULL) {
+ if(trie!=nullptr) {
if(trie->isDataAllocated) {
uprv_free(trie->data);
- trie->data=NULL;
+ trie->data=nullptr;
}
if(trie->isAllocated) {
uprv_free(trie);
@@ -164,8 +164,8 @@ utrie_close(UNewTrie *trie) {
U_CAPI uint32_t * U_EXPORT2
utrie_getData(UNewTrie *trie, int32_t *pLength) {
- if(trie==NULL || pLength==NULL) {
- return NULL;
+ if(trie==nullptr || pLength==nullptr) {
+ return nullptr;
}
*pLength=trie->dataLength;
@@ -223,7 +223,7 @@ utrie_set32(UNewTrie *trie, UChar32 c, uint32_t value) {
int32_t block;
/* valid, uncompacted trie and valid c? */
- if(trie==NULL || trie->isCompacted || (uint32_t)c>0x10ffff) {
+ if(trie==nullptr || trie->isCompacted || (uint32_t)c>0x10ffff) {
return false;
}
@@ -241,15 +241,15 @@ utrie_get32(UNewTrie *trie, UChar32 c, UBool *pInBlockZero) {
int32_t block;
/* valid, uncompacted trie and valid c? */
- if(trie==NULL || trie->isCompacted || (uint32_t)c>0x10ffff) {
- if(pInBlockZero!=NULL) {
+ if(trie==nullptr || trie->isCompacted || (uint32_t)c>0x10ffff) {
+ if(pInBlockZero!=nullptr) {
*pInBlockZero=true;
}
return 0;
}
block=trie->index[c>>UTRIE_SHIFT];
- if(pInBlockZero!=NULL) {
+ if(pInBlockZero!=nullptr) {
*pInBlockZero= (UBool)(block==0);
}
@@ -291,7 +291,7 @@ utrie_setRange32(UNewTrie *trie, UChar32 start, UChar32 limit, uint32_t value, U
int32_t block, rest, repeatBlock;
/* valid, uncompacted trie and valid indexes? */
- if( trie==NULL || trie->isCompacted ||
+ if( trie==nullptr || trie->isCompacted ||
(uint32_t)start>0x10ffff || (uint32_t)limit>0x110000 || start>limit
) {
return false;
@@ -473,7 +473,7 @@ utrie_fold(UNewTrie *trie, UNewTrieGetFoldedValue *getFoldedValue, UErrorCode *p
* set it for the lead surrogate code unit
*/
value=getFoldedValue(trie, c, block+UTRIE_SURROGATE_BLOCK_COUNT);
- if(value!=utrie_get32(trie, U16_LEAD(c), NULL)) {
+ if(value!=utrie_get32(trie, U16_LEAD(c), nullptr)) {
if(!utrie_set32(trie, U16_LEAD(c), value)) {
/* data table overflow */
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
@@ -590,12 +590,12 @@ static void
utrie_compact(UNewTrie *trie, UBool overlap, UErrorCode *pErrorCode) {
int32_t i, start, newStart, overlapStart;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return;
}
/* valid, uncompacted trie? */
- if(trie==NULL) {
+ if(trie==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -747,18 +747,18 @@ utrie_serialize(UNewTrie *trie, void *dt, int32_t capacity,
uint32_t *p;
uint16_t *dest16;
int32_t i, length;
- uint8_t* data = NULL;
+ uint8_t* data = nullptr;
/* argument check */
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(trie==NULL || capacity<0 || (capacity>0 && dt==NULL)) {
+ if(trie==nullptr || capacity<0 || (capacity>0 && dt==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
- if(getFoldedValue==NULL) {
+ if(getFoldedValue==nullptr) {
getFoldedValue=defaultGetFoldedValue;
}
@@ -859,7 +859,7 @@ utrie_unserialize(UTrie *trie, const void *data, int32_t length, UErrorCode *pEr
const uint16_t *p16;
uint32_t options;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return -1;
}
@@ -918,7 +918,7 @@ utrie_unserialize(UTrie *trie, const void *data, int32_t length, UErrorCode *pEr
}
/* the "data16" data is used via the index pointer */
- trie->data32=NULL;
+ trie->data32=nullptr;
trie->initialValue=trie->index[trie->indexLength];
length=(int32_t)sizeof(UTrieHeader)+2*trie->indexLength+2*trie->dataLength;
}
@@ -938,7 +938,7 @@ utrie_unserializeDummy(UTrie *trie,
int32_t actualLength, latin1Length, i, limit;
uint16_t block;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return -1;
}
@@ -991,7 +991,7 @@ utrie_unserializeDummy(UTrie *trie,
}
}
- trie->data32=NULL;
+ trie->data32=nullptr;
/* Latin-1 data */
p16+=trie->indexLength;
@@ -1066,10 +1066,10 @@ utrie_enum(const UTrie *trie,
int32_t l, i, j, block, prevBlock, nullBlock, offset;
/* check arguments */
- if(trie==NULL || trie->index==NULL || enumRange==NULL) {
+ if(trie==nullptr || trie->index==nullptr || enumRange==nullptr) {
return;
}
- if(enumValue==NULL) {
+ if(enumValue==nullptr) {
enumValue=enumSameValue;
}
@@ -1079,7 +1079,7 @@ utrie_enum(const UTrie *trie,
/* get the enumeration value that corresponds to an initial-value trie data entry */
initialValue=enumValue(context, trie->initialValue);
- if(data32==NULL) {
+ if(data32==nullptr) {
nullBlock=trie->indexLength;
} else {
nullBlock=0;
@@ -1120,7 +1120,7 @@ utrie_enum(const UTrie *trie,
} else {
prevBlock=block;
for(j=0; j<UTRIE_DATA_BLOCK_LENGTH; ++j) {
- value=enumValue(context, data32!=NULL ? data32[block+j] : idx[block+j]);
+ value=enumValue(context, data32!=nullptr ? data32[block+j] : idx[block+j]);
if(value!=prevValue) {
if(prev<c) {
if(!enumRange(context, prev, c, prevValue)) {
@@ -1161,7 +1161,7 @@ utrie_enum(const UTrie *trie,
continue;
}
- value= data32!=NULL ? data32[offset+(l&UTRIE_MASK)] : idx[offset+(l&UTRIE_MASK)];
+ value= data32!=nullptr ? data32[offset+(l&UTRIE_MASK)] : idx[offset+(l&UTRIE_MASK)];
/* enumerate trail surrogates for this lead surrogate */
offset=trie->getFoldingOffset(value);
@@ -1206,7 +1206,7 @@ utrie_enum(const UTrie *trie,
} else {
prevBlock=block;
for(j=0; j<UTRIE_DATA_BLOCK_LENGTH; ++j) {
- value=enumValue(context, data32!=NULL ? data32[block+j] : idx[block+j]);
+ value=enumValue(context, data32!=nullptr ? data32[block+j] : idx[block+j]);
if(value!=prevValue) {
if(prev<c) {
if(!enumRange(context, prev, c, prevValue)) {
diff --git a/thirdparty/icu4c/common/utrie2.cpp b/thirdparty/icu4c/common/utrie2.cpp
index 0fb74ba1c3..74f91bc813 100644
--- a/thirdparty/icu4c/common/utrie2.cpp
+++ b/thirdparty/icu4c/common/utrie2.cpp
@@ -59,9 +59,9 @@ get32(const UNewTrie2 *trie, UChar32 c, UBool fromLSCP) {
U_CAPI uint32_t U_EXPORT2
utrie2_get32(const UTrie2 *trie, UChar32 c) {
- if(trie->data16!=NULL) {
+ if(trie->data16!=nullptr) {
return UTRIE2_GET16(trie, c);
- } else if(trie->data32!=NULL) {
+ } else if(trie->data32!=nullptr) {
return UTRIE2_GET32(trie, c);
} else if((uint32_t)c>0x10ffff) {
return trie->errorValue;
@@ -75,9 +75,9 @@ utrie2_get32FromLeadSurrogateCodeUnit(const UTrie2 *trie, UChar32 c) {
if(!U_IS_LEAD(c)) {
return trie->errorValue;
}
- if(trie->data16!=NULL) {
+ if(trie->data16!=nullptr) {
return UTRIE2_GET16_FROM_U16_SINGLE_LEAD(trie, c);
- } else if(trie->data32!=NULL) {
+ } else if(trie->data32!=nullptr) {
return UTRIE2_GET32_FROM_U16_SINGLE_LEAD(trie, c);
} else {
return get32(trie->newTrie, c, false);
@@ -89,7 +89,7 @@ u8Index(const UTrie2 *trie, UChar32 c, int32_t i) {
int32_t idx=
_UTRIE2_INDEX_FROM_CP(
trie,
- trie->data32==NULL ? trie->indexLength : 0,
+ trie->data32==nullptr ? trie->indexLength : 0,
c);
return (idx<<3)|i;
}
@@ -193,7 +193,7 @@ utrie2_openFromSerialized(UTrie2ValueBits valueBits,
/* allocate the trie */
trie=(UTrie2 *)uprv_malloc(sizeof(UTrie2));
- if(trie==NULL) {
+ if(trie==nullptr) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return 0;
}
@@ -214,12 +214,12 @@ utrie2_openFromSerialized(UTrie2ValueBits valueBits,
switch(valueBits) {
case UTRIE2_16_VALUE_BITS:
trie->data16=p16;
- trie->data32=NULL;
+ trie->data32=nullptr;
trie->initialValue=trie->index[trie->dataNullOffset];
trie->errorValue=trie->data16[UTRIE2_BAD_UTF8_DATA_OFFSET];
break;
case UTRIE2_32_VALUE_BITS:
- trie->data16=NULL;
+ trie->data16=nullptr;
trie->data32=(const uint32_t *)p16;
trie->initialValue=trie->data32[trie->dataNullOffset];
trie->errorValue=trie->data32[UTRIE2_BAD_UTF8_DATA_OFFSET];
@@ -229,7 +229,7 @@ utrie2_openFromSerialized(UTrie2ValueBits valueBits,
return 0;
}
- if(pActualLength!=NULL) {
+ if(pActualLength!=nullptr) {
*pActualLength=actualLength;
}
return trie;
@@ -267,13 +267,13 @@ utrie2_openDummy(UTrie2ValueBits valueBits,
/* allocate the trie */
trie=(UTrie2 *)uprv_malloc(sizeof(UTrie2));
- if(trie==NULL) {
+ if(trie==nullptr) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return 0;
}
uprv_memset(trie, 0, sizeof(UTrie2));
trie->memory=uprv_malloc(length);
- if(trie->memory==NULL) {
+ if(trie->memory==nullptr) {
uprv_free(trie);
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return 0;
@@ -334,7 +334,7 @@ utrie2_openDummy(UTrie2ValueBits valueBits,
case UTRIE2_16_VALUE_BITS:
/* write 16-bit data values */
trie->data16=dest16;
- trie->data32=NULL;
+ trie->data32=nullptr;
for(i=0; i<0x80; ++i) {
*dest16++=(uint16_t)initialValue;
}
@@ -349,7 +349,7 @@ utrie2_openDummy(UTrie2ValueBits valueBits,
case UTRIE2_32_VALUE_BITS:
/* write 32-bit data values */
p=(uint32_t *)dest16;
- trie->data16=NULL;
+ trie->data16=nullptr;
trie->data32=p;
for(i=0; i<0x80; ++i) {
*p++=initialValue;
@@ -372,11 +372,11 @@ utrie2_openDummy(UTrie2ValueBits valueBits,
U_CAPI void U_EXPORT2
utrie2_close(UTrie2 *trie) {
- if(trie!=NULL) {
+ if(trie!=nullptr) {
if(trie->isMemoryOwned) {
uprv_free(trie->memory);
}
- if(trie->newTrie!=NULL) {
+ if(trie->newTrie!=nullptr) {
uprv_free(trie->newTrie->data);
#ifdef UCPTRIE_DEBUG
umutablecptrie_close(trie->newTrie->t3);
@@ -389,7 +389,7 @@ utrie2_close(UTrie2 *trie) {
U_CAPI UBool U_EXPORT2
utrie2_isFrozen(const UTrie2 *trie) {
- return (UBool)(trie->newTrie==NULL);
+ return (UBool)(trie->newTrie==nullptr);
}
U_CAPI int32_t U_EXPORT2
@@ -401,8 +401,8 @@ utrie2_serialize(const UTrie2 *trie,
return 0;
}
- if( trie==NULL || trie->memory==NULL || trie->newTrie!=NULL ||
- capacity<0 || (capacity>0 && (data==NULL || (U_POINTER_MASK_LSB(data, 3)!=0)))
+ if( trie==nullptr || trie->memory==nullptr || trie->newTrie!=nullptr ||
+ capacity<0 || (capacity>0 && (data==nullptr || (U_POINTER_MASK_LSB(data, 3)!=0)))
) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
@@ -450,26 +450,26 @@ enumEitherTrie(const UTrie2 *trie,
UChar32 c, prev, highStart;
int32_t j, i2Block, prevI2Block, index2NullOffset, block, prevBlock, nullBlock;
- if(enumRange==NULL) {
+ if(enumRange==nullptr) {
return;
}
- if(enumValue==NULL) {
+ if(enumValue==nullptr) {
enumValue=enumSameValue;
}
- if(trie->newTrie==NULL) {
+ if(trie->newTrie==nullptr) {
/* frozen trie */
idx=trie->index;
- U_ASSERT(idx!=NULL); /* the following code assumes trie->newTrie is not NULL when idx is NULL */
+ U_ASSERT(idx!=nullptr); /* the following code assumes trie->newTrie is not nullptr when idx is nullptr */
data32=trie->data32;
index2NullOffset=trie->index2NullOffset;
nullBlock=trie->dataNullOffset;
} else {
/* unfrozen, mutable trie */
- idx=NULL;
+ idx=nullptr;
data32=trie->newTrie->data;
- U_ASSERT(data32!=NULL); /* the following code assumes idx is not NULL when data32 is NULL */
+ U_ASSERT(data32!=nullptr); /* the following code assumes idx is not nullptr when data32 is nullptr */
index2NullOffset=trie->newTrie->index2NullOffset;
nullBlock=trie->newTrie->dataNullOffset;
@@ -513,7 +513,7 @@ enumEitherTrie(const UTrie2 *trie,
}
} else {
/* supplementary code points */
- if(idx!=NULL) {
+ if(idx!=nullptr) {
i2Block=idx[(UTRIE2_INDEX_1_OFFSET-UTRIE2_OMITTED_BMP_INDEX_1_LENGTH)+
(c>>UTRIE2_SHIFT_1)];
} else {
@@ -551,7 +551,7 @@ enumEitherTrie(const UTrie2 *trie,
i2Limit=UTRIE2_INDEX_2_BLOCK_LENGTH;
}
for(; i2<i2Limit; ++i2) {
- if(idx!=NULL) {
+ if(idx!=nullptr) {
block=(int32_t)idx[i2Block+i2]<<UTRIE2_INDEX_SHIFT;
} else {
block=trie->newTrie->index2[i2Block+i2];
@@ -574,7 +574,7 @@ enumEitherTrie(const UTrie2 *trie,
c+=UTRIE2_DATA_BLOCK_LENGTH;
} else {
for(j=0; j<UTRIE2_DATA_BLOCK_LENGTH; ++j) {
- value=enumValue(context, data32!=NULL ? data32[block+j] : idx[block+j]);
+ value=enumValue(context, data32!=nullptr ? data32[block+j] : idx[block+j]);
if(value!=prevValue) {
if(prev<c && !enumRange(context, prev, c-1, prevValue)) {
return;
@@ -594,9 +594,9 @@ enumEitherTrie(const UTrie2 *trie,
} else if(c<limit) {
/* c==highStart<limit */
uint32_t highValue;
- if(idx!=NULL) {
+ if(idx!=nullptr) {
highValue=
- data32!=NULL ?
+ data32!=nullptr ?
data32[trie->highValueIndex] :
idx[trie->highValueIndex];
} else {
diff --git a/thirdparty/icu4c/common/utrie2.h b/thirdparty/icu4c/common/utrie2.h
index ace52cce37..431f11568e 100644
--- a/thirdparty/icu4c/common/utrie2.h
+++ b/thirdparty/icu4c/common/utrie2.h
@@ -599,34 +599,34 @@ U_NAMESPACE_BEGIN
// Use the Forward/Backward subclasses below.
class UTrie2StringIterator : public UMemory {
public:
- UTrie2StringIterator(const UTrie2 *t, const UChar *p) :
+ UTrie2StringIterator(const UTrie2 *t, const char16_t *p) :
trie(t), codePointStart(p), codePointLimit(p), codePoint(U_SENTINEL) {}
const UTrie2 *trie;
- const UChar *codePointStart, *codePointLimit;
+ const char16_t *codePointStart, *codePointLimit;
UChar32 codePoint;
};
class BackwardUTrie2StringIterator : public UTrie2StringIterator {
public:
- BackwardUTrie2StringIterator(const UTrie2 *t, const UChar *s, const UChar *p) :
+ BackwardUTrie2StringIterator(const UTrie2 *t, const char16_t *s, const char16_t *p) :
UTrie2StringIterator(t, p), start(s) {}
uint16_t previous16();
- const UChar *start;
+ const char16_t *start;
};
class ForwardUTrie2StringIterator : public UTrie2StringIterator {
public:
- // Iteration limit l can be NULL.
+ // Iteration limit l can be nullptr.
// In that case, the caller must detect c==0 and stop.
- ForwardUTrie2StringIterator(const UTrie2 *t, const UChar *p, const UChar *l) :
+ ForwardUTrie2StringIterator(const UTrie2 *t, const char16_t *p, const char16_t *l) :
UTrie2StringIterator(t, p), limit(l) {}
uint16_t next16();
- const UChar *limit;
+ const char16_t *limit;
};
U_NAMESPACE_END
diff --git a/thirdparty/icu4c/common/utrie2_builder.cpp b/thirdparty/icu4c/common/utrie2_builder.cpp
index 2513332b80..1254e8cba6 100644
--- a/thirdparty/icu4c/common/utrie2_builder.cpp
+++ b/thirdparty/icu4c/common/utrie2_builder.cpp
@@ -120,13 +120,13 @@ utrie2_open(uint32_t initialValue, uint32_t errorValue, UErrorCode *pErrorCode)
int32_t i, j;
if(U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
trie=(UTrie2 *)uprv_malloc(sizeof(UTrie2));
newTrie=(UNewTrie2 *)uprv_malloc(sizeof(UNewTrie2));
data=(uint32_t *)uprv_malloc(UNEWTRIE2_INITIAL_DATA_LENGTH*4);
- if(trie==NULL || newTrie==NULL || data==NULL) {
+ if(trie==nullptr || newTrie==nullptr || data==nullptr) {
uprv_free(trie);
uprv_free(newTrie);
uprv_free(data);
@@ -250,14 +250,14 @@ cloneBuilder(const UNewTrie2 *other) {
UNewTrie2 *trie;
trie=(UNewTrie2 *)uprv_malloc(sizeof(UNewTrie2));
- if(trie==NULL) {
- return NULL;
+ if(trie==nullptr) {
+ return nullptr;
}
trie->data=(uint32_t *)uprv_malloc(other->dataCapacity*4);
- if(trie->data==NULL) {
+ if(trie->data==nullptr) {
uprv_free(trie);
- return NULL;
+ return nullptr;
}
#ifdef UCPTRIE_DEBUG
if(other->t3==nullptr) {
@@ -300,43 +300,43 @@ utrie2_clone(const UTrie2 *other, UErrorCode *pErrorCode) {
UTrie2 *trie;
if(U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
- if(other==NULL || (other->memory==NULL && other->newTrie==NULL)) {
+ if(other==nullptr || (other->memory==nullptr && other->newTrie==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
trie=(UTrie2 *)uprv_malloc(sizeof(UTrie2));
- if(trie==NULL) {
+ if(trie==nullptr) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
- return NULL;
+ return nullptr;
}
uprv_memcpy(trie, other, sizeof(UTrie2));
- if(other->memory!=NULL) {
+ if(other->memory!=nullptr) {
trie->memory=uprv_malloc(other->length);
- if(trie->memory!=NULL) {
+ if(trie->memory!=nullptr) {
trie->isMemoryOwned=true;
uprv_memcpy(trie->memory, other->memory, other->length);
/* make the clone's pointers point to its own memory */
trie->index=(uint16_t *)trie->memory+(other->index-(uint16_t *)other->memory);
- if(other->data16!=NULL) {
+ if(other->data16!=nullptr) {
trie->data16=(uint16_t *)trie->memory+(other->data16-(uint16_t *)other->memory);
}
- if(other->data32!=NULL) {
+ if(other->data32!=nullptr) {
trie->data32=(uint32_t *)trie->memory+(other->data32-(uint32_t *)other->memory);
}
}
- } else /* other->newTrie!=NULL */ {
+ } else /* other->newTrie!=nullptr */ {
trie->newTrie=cloneBuilder(other->newTrie);
}
- if(trie->memory==NULL && trie->newTrie==NULL) {
+ if(trie->memory==nullptr && trie->newTrie==nullptr) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
uprv_free(trie);
- trie=NULL;
+ trie=nullptr;
}
return trie;
}
@@ -386,7 +386,7 @@ static void
utrie_printLengths(const UTrie *trie) {
long indexLength=trie->indexLength;
long dataLength=(long)trie->dataLength;
- long totalLength=(long)sizeof(UTrieHeader)+indexLength*2+dataLength*(trie->data32!=NULL ? 4 : 2);
+ long totalLength=(long)sizeof(UTrieHeader)+indexLength*2+dataLength*(trie->data32!=nullptr ? 4 : 2);
printf("**UTrieLengths** index:%6ld data:%6ld serialized:%6ld\n",
indexLength, dataLength, totalLength);
}
@@ -395,7 +395,7 @@ static void
utrie2_printLengths(const UTrie2 *trie, const char *which) {
long indexLength=trie->indexLength;
long dataLength=(long)trie->dataLength;
- long totalLength=(long)sizeof(UTrie2Header)+indexLength*2+dataLength*(trie->data32!=NULL ? 4 : 2);
+ long totalLength=(long)sizeof(UTrie2Header)+indexLength*2+dataLength*(trie->data32!=nullptr ? 4 : 2);
printf("**UTrie2Lengths(%s %s)** index:%6ld data:%6ld countInitial:%6ld serialized:%6ld\n",
which, trie->name, indexLength, dataLength, countInitial(trie), totalLength);
}
@@ -404,31 +404,31 @@ utrie2_printLengths(const UTrie2 *trie, const char *which) {
U_CAPI UTrie2 * U_EXPORT2
utrie2_cloneAsThawed(const UTrie2 *other, UErrorCode *pErrorCode) {
NewTrieAndStatus context;
- UChar lead;
+ char16_t lead;
if(U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
- if(other==NULL || (other->memory==NULL && other->newTrie==NULL)) {
+ if(other==nullptr || (other->memory==nullptr && other->newTrie==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
- if(other->newTrie!=NULL && !other->newTrie->isCompacted) {
+ if(other->newTrie!=nullptr && !other->newTrie->isCompacted) {
return utrie2_clone(other, pErrorCode); /* clone an unfrozen trie */
}
/* Clone the frozen trie by enumerating it and building a new one. */
context.trie=utrie2_open(other->initialValue, other->errorValue, pErrorCode);
if(U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
context.exclusiveLimit=false;
context.errorCode=*pErrorCode;
- utrie2_enum(other, NULL, copyEnumRange, &context);
+ utrie2_enum(other, nullptr, copyEnumRange, &context);
*pErrorCode=context.errorCode;
for(lead=0xd800; lead<0xdc00; ++lead) {
uint32_t value;
- if(other->data32==NULL) {
+ if(other->data32==nullptr) {
value=UTRIE2_GET16_FROM_U16_SINGLE_LEAD(other, lead);
} else {
value=UTRIE2_GET32_FROM_U16_SINGLE_LEAD(other, lead);
@@ -439,7 +439,7 @@ utrie2_cloneAsThawed(const UTrie2 *other, UErrorCode *pErrorCode) {
}
if(U_FAILURE(*pErrorCode)) {
utrie2_close(context.trie);
- context.trie=NULL;
+ context.trie=nullptr;
}
return context.trie;
}
@@ -448,26 +448,26 @@ utrie2_cloneAsThawed(const UTrie2 *other, UErrorCode *pErrorCode) {
U_CAPI UTrie2 * U_EXPORT2
utrie2_fromUTrie(const UTrie *trie1, uint32_t errorValue, UErrorCode *pErrorCode) {
NewTrieAndStatus context;
- UChar lead;
+ char16_t lead;
if(U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
- if(trie1==NULL) {
+ if(trie1==nullptr) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
- return NULL;
+ return nullptr;
}
context.trie=utrie2_open(trie1->initialValue, errorValue, pErrorCode);
if(U_FAILURE(*pErrorCode)) {
- return NULL;
+ return nullptr;
}
context.exclusiveLimit=true;
context.errorCode=*pErrorCode;
- utrie_enum(trie1, NULL, copyEnumRange, &context);
+ utrie_enum(trie1, nullptr, copyEnumRange, &context);
*pErrorCode=context.errorCode;
for(lead=0xd800; lead<0xdc00; ++lead) {
uint32_t value;
- if(trie1->data32==NULL) {
+ if(trie1->data32==nullptr) {
value=UTRIE_GET16_FROM_LEAD(trie1, lead);
} else {
value=UTRIE_GET32_FROM_LEAD(trie1, lead);
@@ -478,7 +478,7 @@ utrie2_fromUTrie(const UTrie *trie1, uint32_t errorValue, UErrorCode *pErrorCode
}
if(U_SUCCESS(*pErrorCode)) {
utrie2_freeze(context.trie,
- trie1->data32!=NULL ? UTRIE2_32_VALUE_BITS : UTRIE2_16_VALUE_BITS,
+ trie1->data32!=nullptr ? UTRIE2_32_VALUE_BITS : UTRIE2_16_VALUE_BITS,
pErrorCode);
}
#ifdef UTRIE2_DEBUG
@@ -489,7 +489,7 @@ utrie2_fromUTrie(const UTrie *trie1, uint32_t errorValue, UErrorCode *pErrorCode
#endif
if(U_FAILURE(*pErrorCode)) {
utrie2_close(context.trie);
- context.trie=NULL;
+ context.trie=nullptr;
}
return context.trie;
}
@@ -578,7 +578,7 @@ allocDataBlock(UNewTrie2 *trie, int32_t copyBlock) {
return -1;
}
data=(uint32_t *)uprv_malloc(capacity*4);
- if(data==NULL) {
+ if(data==nullptr) {
return -1;
}
uprv_memcpy(data, trie->data, (size_t)trie->dataLength*4);
@@ -657,7 +657,7 @@ set32(UNewTrie2 *trie,
UErrorCode *pErrorCode) {
int32_t block;
- if(trie==NULL || trie->isCompacted) {
+ if(trie==nullptr || trie->isCompacted) {
*pErrorCode=U_NO_WRITE_PERMISSION;
return;
}
@@ -755,7 +755,7 @@ utrie2_setRange32(UTrie2 *trie,
return;
}
newTrie=trie->newTrie;
- if(newTrie==NULL || newTrie->isCompacted) {
+ if(newTrie==nullptr || newTrie->isCompacted) {
*pErrorCode=U_NO_WRITE_PERMISSION;
return;
}
@@ -1317,17 +1317,17 @@ utrie2_freeze(UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode) {
if(U_FAILURE(*pErrorCode)) {
return;
}
- if( trie==NULL ||
+ if( trie==nullptr ||
valueBits<0 || UTRIE2_COUNT_VALUE_BITS<=valueBits
) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
newTrie=trie->newTrie;
- if(newTrie==NULL) {
+ if(newTrie==nullptr) {
/* already frozen */
UTrie2ValueBits frozenValueBits=
- trie->data16!=NULL ? UTRIE2_16_VALUE_BITS : UTRIE2_32_VALUE_BITS;
+ trie->data16!=nullptr ? UTRIE2_16_VALUE_BITS : UTRIE2_32_VALUE_BITS;
if(valueBits!=frozenValueBits) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
}
@@ -1377,7 +1377,7 @@ utrie2_freeze(UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode) {
}
trie->memory=uprv_malloc(length);
- if(trie->memory==NULL) {
+ if(trie->memory==nullptr) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return;
}
@@ -1449,7 +1449,7 @@ utrie2_freeze(UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode) {
case UTRIE2_16_VALUE_BITS:
/* write 16-bit data values */
trie->data16=dest16;
- trie->data32=NULL;
+ trie->data32=nullptr;
p=newTrie->data;
for(i=newTrie->dataLength; i>0; --i) {
*dest16++=(uint16_t)*p++;
@@ -1457,7 +1457,7 @@ utrie2_freeze(UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode) {
break;
case UTRIE2_32_VALUE_BITS:
/* write 32-bit data values */
- trie->data16=NULL;
+ trie->data16=nullptr;
trie->data32=(uint32_t *)dest16;
uprv_memcpy(dest16, newTrie->data, (size_t)newTrie->dataLength*4);
break;
@@ -1479,5 +1479,5 @@ utrie2_freeze(UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode) {
/* Delete the UNewTrie2. */
uprv_free(newTrie->data);
uprv_free(newTrie);
- trie->newTrie=NULL;
+ trie->newTrie=nullptr;
}
diff --git a/thirdparty/icu4c/common/utrie_swap.cpp b/thirdparty/icu4c/common/utrie_swap.cpp
index b01b94601e..83d183699d 100644
--- a/thirdparty/icu4c/common/utrie_swap.cpp
+++ b/thirdparty/icu4c/common/utrie_swap.cpp
@@ -31,10 +31,10 @@ utrie_swap(const UDataSwapper *ds,
int32_t size;
UBool dataIs32;
- if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+ if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
- if(ds==NULL || inData==NULL || (length>=0 && outData==NULL)) {
+ if(ds==nullptr || inData==nullptr || (length>=0 && outData==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -105,7 +105,7 @@ utrie2_swap(const UDataSwapper *ds,
if(U_FAILURE(*pErrorCode)) {
return 0;
}
- if(ds==NULL || inData==NULL || (length>=0 && outData==NULL)) {
+ if(ds==nullptr || inData==nullptr || (length>=0 && outData==nullptr)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
diff --git a/thirdparty/icu4c/common/uts46.cpp b/thirdparty/icu4c/common/uts46.cpp
index 10a4f56597..fce2af4130 100644
--- a/thirdparty/icu4c/common/uts46.cpp
+++ b/thirdparty/icu4c/common/uts46.cpp
@@ -49,8 +49,8 @@ const uint32_t severeErrors=
static inline UBool
isASCIIString(const UnicodeString &dest) {
- const UChar *s=dest.getBuffer();
- const UChar *limit=s+dest.length();
+ const char16_t *s=dest.getBuffer();
+ const char16_t *limit=s+dest.length();
while(s<limit) {
if(*s++>0x7f) {
return false;
@@ -60,7 +60,7 @@ isASCIIString(const UnicodeString &dest) {
}
static UBool
-isASCIIOkBiDi(const UChar *s, int32_t length);
+isASCIIOkBiDi(const char16_t *s, int32_t length);
static UBool
isASCIIOkBiDi(const char *s, int32_t length);
@@ -185,13 +185,13 @@ private:
UBool toASCII, IDNAInfo &info, UErrorCode &errorCode) const;
void
- checkLabelBiDi(const UChar *label, int32_t labelLength, IDNAInfo &info) const;
+ checkLabelBiDi(const char16_t *label, int32_t labelLength, IDNAInfo &info) const;
UBool
- isLabelOkContextJ(const UChar *label, int32_t labelLength) const;
+ isLabelOkContextJ(const char16_t *label, int32_t labelLength) const;
void
- checkLabelContextO(const UChar *label, int32_t labelLength, IDNAInfo &info) const;
+ checkLabelContextO(const char16_t *label, int32_t labelLength, IDNAInfo &info) const;
const Normalizer2 &uts46Norm2; // uts46.nrm
uint32_t options;
@@ -201,22 +201,22 @@ IDNA *
IDNA::createUTS46Instance(uint32_t options, UErrorCode &errorCode) {
if(U_SUCCESS(errorCode)) {
IDNA *idna=new UTS46(options, errorCode);
- if(idna==NULL) {
+ if(idna==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
} else if(U_FAILURE(errorCode)) {
delete idna;
- idna=NULL;
+ idna=nullptr;
}
return idna;
} else {
- return NULL;
+ return nullptr;
}
}
// UTS46 implementation ---------------------------------------------------- ***
UTS46::UTS46(uint32_t opt, UErrorCode &errorCode)
- : uts46Norm2(*Normalizer2::getInstance(NULL, "uts46", UNORM2_COMPOSE, errorCode)),
+ : uts46Norm2(*Normalizer2::getInstance(nullptr, "uts46", UNORM2_COMPOSE, errorCode)),
options(opt) {}
UTS46::~UTS46() {}
@@ -310,8 +310,8 @@ UTS46::process(const UnicodeString &src,
dest.setToBogus();
return dest;
}
- const UChar *srcArray=src.getBuffer();
- if(&dest==&src || srcArray==NULL) {
+ const char16_t *srcArray=src.getBuffer();
+ if(&dest==&src || srcArray==nullptr) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
dest.setToBogus();
return dest;
@@ -324,8 +324,8 @@ UTS46::process(const UnicodeString &src,
info.errors|=UIDNA_ERROR_EMPTY_LABEL;
return dest;
}
- UChar *destArray=dest.getBuffer(srcLength);
- if(destArray==NULL) {
+ char16_t *destArray=dest.getBuffer(srcLength);
+ if(destArray==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return dest;
}
@@ -348,7 +348,7 @@ UTS46::process(const UnicodeString &src,
dest.releaseBuffer(i);
return dest;
}
- UChar c=srcArray[i];
+ char16_t c=srcArray[i];
if(c>0x7f) {
break;
}
@@ -412,7 +412,7 @@ UTS46::processUTF8(StringPiece src,
}
const char *srcArray=src.data();
int32_t srcLength=src.length();
- if(srcArray==NULL && srcLength!=0) {
+ if(srcArray==nullptr && srcLength!=0) {
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@@ -540,11 +540,11 @@ UTS46::processUnicode(const UnicodeString &src,
UBool doMapDevChars=
toASCII ? (options&UIDNA_NONTRANSITIONAL_TO_ASCII)==0 :
(options&UIDNA_NONTRANSITIONAL_TO_UNICODE)==0;
- const UChar *destArray=dest.getBuffer();
+ const char16_t *destArray=dest.getBuffer();
int32_t destLength=dest.length();
int32_t labelLimit=labelStart;
while(labelLimit<destLength) {
- UChar c=destArray[labelLimit];
+ char16_t c=destArray[labelLimit];
if(c==0x2e && !isLabel) {
int32_t labelLength=labelLimit-labelStart;
int32_t newLength=processLabel(dest, labelStart, labelLength,
@@ -604,8 +604,8 @@ UTS46::mapDevChars(UnicodeString &dest, int32_t labelStart, int32_t mappingStart
return 0;
}
int32_t length=dest.length();
- UChar *s=dest.getBuffer(dest[mappingStart]==0xdf ? length+1 : length);
- if(s==NULL) {
+ char16_t *s=dest.getBuffer(dest[mappingStart]==0xdf ? length+1 : length);
+ if(s==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return length;
}
@@ -613,7 +613,7 @@ UTS46::mapDevChars(UnicodeString &dest, int32_t labelStart, int32_t mappingStart
UBool didMapDevChars=false;
int32_t readIndex=mappingStart, writeIndex=mappingStart;
do {
- UChar c=s[readIndex++];
+ char16_t c=s[readIndex++];
switch(c) {
case 0xdf:
// Map sharp s to ss.
@@ -624,7 +624,7 @@ UTS46::mapDevChars(UnicodeString &dest, int32_t labelStart, int32_t mappingStart
if(length==capacity) {
dest.releaseBuffer(length);
s=dest.getBuffer(length+1);
- if(s==NULL) {
+ if(s==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return length;
}
@@ -708,7 +708,7 @@ UTS46::processLabel(UnicodeString &dest,
}
UnicodeString fromPunycode;
UnicodeString *labelString;
- const UChar *label=dest.getBuffer()+labelStart;
+ const char16_t *label=dest.getBuffer()+labelStart;
int32_t destLabelStart=labelStart;
int32_t destLabelLength=labelLength;
UBool wasPunycode;
@@ -725,8 +725,8 @@ UTS46::processLabel(UnicodeString &dest,
return markBadACELabel(dest, labelStart, labelLength, toASCII, info, errorCode);
}
wasPunycode=true;
- UChar *unicodeBuffer=fromPunycode.getBuffer(-1); // capacity==-1: most labels should fit
- if(unicodeBuffer==NULL) {
+ char16_t *unicodeBuffer=fromPunycode.getBuffer(-1); // capacity==-1: most labels should fit
+ if(unicodeBuffer==nullptr) {
// Should never occur if we used capacity==-1 which uses the internal buffer.
errorCode=U_MEMORY_ALLOCATION_ERROR;
return labelLength;
@@ -734,18 +734,18 @@ UTS46::processLabel(UnicodeString &dest,
UErrorCode punycodeErrorCode=U_ZERO_ERROR;
int32_t unicodeLength=u_strFromPunycode(label+4, labelLength-4,
unicodeBuffer, fromPunycode.getCapacity(),
- NULL, &punycodeErrorCode);
+ nullptr, &punycodeErrorCode);
if(punycodeErrorCode==U_BUFFER_OVERFLOW_ERROR) {
fromPunycode.releaseBuffer(0);
unicodeBuffer=fromPunycode.getBuffer(unicodeLength);
- if(unicodeBuffer==NULL) {
+ if(unicodeBuffer==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return labelLength;
}
punycodeErrorCode=U_ZERO_ERROR;
unicodeLength=u_strFromPunycode(label+4, labelLength-4,
unicodeBuffer, fromPunycode.getCapacity(),
- NULL, &punycodeErrorCode);
+ nullptr, &punycodeErrorCode);
}
fromPunycode.releaseBuffer(unicodeLength);
if(U_FAILURE(punycodeErrorCode)) {
@@ -803,13 +803,13 @@ UTS46::processLabel(UnicodeString &dest,
// in a non-Punycode label or U+FFFD itself in a Punycode label.
// We also check for dots which can come from the input to a single-label function.
// Ok to cast away const because we own the UnicodeString.
- UChar *s=(UChar *)label;
- const UChar *limit=label+labelLength;
- UChar oredChars=0;
+ char16_t *s=(char16_t *)label;
+ const char16_t *limit=label+labelLength;
+ char16_t oredChars=0;
// If we enforce STD3 rules, then ASCII characters other than LDH and dot are disallowed.
UBool disallowNonLDHDot=(options&UIDNA_USE_STD3_RULES)!=0;
do {
- UChar c=*s;
+ char16_t c=*s;
if(c<=0x7f) {
if(c==0x2e) {
info.labelErrors|=UIDNA_ERROR_LABEL_HAS_DOT;
@@ -837,7 +837,7 @@ UTS46::processLabel(UnicodeString &dest,
U16_NEXT_UNSAFE(label, cpLength, c);
if((U_GET_GC_MASK(c)&U_GC_M_MASK)!=0) {
info.labelErrors|=UIDNA_ERROR_LEADING_COMBINING_MARK;
- labelString->replace(labelStart, cpLength, (UChar)0xfffd);
+ labelString->replace(labelStart, cpLength, (char16_t)0xfffd);
label=labelString->getBuffer()+labelStart;
labelLength+=1-cpLength;
if(labelString==&dest) {
@@ -868,8 +868,8 @@ UTS46::processLabel(UnicodeString &dest,
} else if(oredChars>=0x80) {
// Contains non-ASCII characters.
UnicodeString punycode;
- UChar *buffer=punycode.getBuffer(63); // 63==maximum DNS label length
- if(buffer==NULL) {
+ char16_t *buffer=punycode.getBuffer(63); // 63==maximum DNS label length
+ if(buffer==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return destLabelLength;
}
@@ -879,18 +879,18 @@ UTS46::processLabel(UnicodeString &dest,
buffer[3]=0x2d;
int32_t punycodeLength=u_strToPunycode(label, labelLength,
buffer+4, punycode.getCapacity()-4,
- NULL, &errorCode);
+ nullptr, &errorCode);
if(errorCode==U_BUFFER_OVERFLOW_ERROR) {
errorCode=U_ZERO_ERROR;
punycode.releaseBuffer(4);
buffer=punycode.getBuffer(4+punycodeLength);
- if(buffer==NULL) {
+ if(buffer==nullptr) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return destLabelLength;
}
punycodeLength=u_strToPunycode(label, labelLength,
buffer+4, punycode.getCapacity()-4,
- NULL, &errorCode);
+ nullptr, &errorCode);
}
punycodeLength+=4;
punycode.releaseBuffer(punycodeLength);
@@ -934,12 +934,12 @@ UTS46::markBadACELabel(UnicodeString &dest,
UBool disallowNonLDHDot=(options&UIDNA_USE_STD3_RULES)!=0;
UBool isASCII=true;
UBool onlyLDH=true;
- const UChar *label=dest.getBuffer()+labelStart;
- const UChar *limit=label+labelLength;
+ const char16_t *label=dest.getBuffer()+labelStart;
+ const char16_t *limit=label+labelLength;
// Start after the initial "xn--".
// Ok to cast away const because we own the UnicodeString.
- for(UChar *s=const_cast<UChar *>(label+4); s<limit; ++s) {
- UChar c=*s;
+ for(char16_t *s=const_cast<char16_t *>(label+4); s<limit; ++s) {
+ char16_t c=*s;
if(c<=0x7f) {
if(c==0x2e) {
info.labelErrors|=UIDNA_ERROR_LABEL_HAS_DOT;
@@ -957,7 +957,7 @@ UTS46::markBadACELabel(UnicodeString &dest,
}
}
if(onlyLDH) {
- dest.insert(labelStart+labelLength, (UChar)0xfffd);
+ dest.insert(labelStart+labelLength, (char16_t)0xfffd);
if(dest.isBogus()) {
errorCode=U_MEMORY_ALLOCATION_ERROR;
return 0;
@@ -997,7 +997,7 @@ const uint32_t R_AL_AN_EN_ES_CS_ET_ON_BN_NSM_MASK=R_AL_MASK|EN_AN_MASK|ES_CS_ET_
// that a domain name is a BiDi domain name (has an RTL label) only after
// processing several earlier labels.
void
-UTS46::checkLabelBiDi(const UChar *label, int32_t labelLength, IDNAInfo &info) const {
+UTS46::checkLabelBiDi(const char16_t *label, int32_t labelLength, IDNAInfo &info) const {
// IDNA2008 BiDi rule
// Get the directionality of the first character.
UChar32 c;
@@ -1085,10 +1085,10 @@ UTS46::checkLabelBiDi(const UChar *label, int32_t labelLength, IDNAInfo &info) c
// Cannot contain uppercase A-Z.
// s[length-1] must be the trailing dot.
static UBool
-isASCIIOkBiDi(const UChar *s, int32_t length) {
+isASCIIOkBiDi(const char16_t *s, int32_t length) {
int32_t labelStart=0;
for(int32_t i=0; i<length; ++i) {
- UChar c=s[i];
+ char16_t c=s[i];
if(c==0x2e) { // dot
if(i>labelStart) {
c=s[i-1];
@@ -1146,7 +1146,7 @@ isASCIIOkBiDi(const char *s, int32_t length) {
}
UBool
-UTS46::isLabelOkContextJ(const UChar *label, int32_t labelLength) const {
+UTS46::isLabelOkContextJ(const char16_t *label, int32_t labelLength) const {
// [IDNA2008-Tables]
// 200C..200D ; CONTEXTJ # ZERO WIDTH NON-JOINER..ZERO WIDTH JOINER
for(int32_t i=0; i<labelLength; ++i) {
@@ -1215,7 +1215,7 @@ UTS46::isLabelOkContextJ(const UChar *label, int32_t labelLength) const {
}
void
-UTS46::checkLabelContextO(const UChar *label, int32_t labelLength, IDNAInfo &info) const {
+UTS46::checkLabelContextO(const char16_t *label, int32_t labelLength, IDNAInfo &info) const {
int32_t labelEnd=labelLength-1; // inclusive
int32_t arabicDigits=0; // -1 for 066x, +1 for 06Fx
for(int32_t i=0; i<=labelEnd; ++i) {
@@ -1341,13 +1341,13 @@ checkArgs(const void *label, int32_t length,
return false;
}
// sizeof(UIDNAInfo)=16 in the first API version.
- if(pInfo==NULL || pInfo->size<16) {
+ if(pInfo==nullptr || pInfo->size<16) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return false;
}
- if( (label==NULL ? length!=0 : length<-1) ||
- (dest==NULL ? capacity!=0 : capacity<0) ||
- (dest==label && label!=NULL)
+ if( (label==nullptr ? length!=0 : length<-1) ||
+ (dest==nullptr ? capacity!=0 : capacity<0) ||
+ (dest==label && label!=nullptr)
) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return false;
@@ -1365,8 +1365,8 @@ idnaInfoToStruct(IDNAInfo &info, UIDNAInfo *pInfo) {
U_CAPI int32_t U_EXPORT2
uidna_labelToASCII(const UIDNA *idna,
- const UChar *label, int32_t length,
- UChar *dest, int32_t capacity,
+ const char16_t *label, int32_t length,
+ char16_t *dest, int32_t capacity,
UIDNAInfo *pInfo, UErrorCode *pErrorCode) {
if(!checkArgs(label, length, dest, capacity, pInfo, pErrorCode)) {
return 0;
@@ -1381,8 +1381,8 @@ uidna_labelToASCII(const UIDNA *idna,
U_CAPI int32_t U_EXPORT2
uidna_labelToUnicode(const UIDNA *idna,
- const UChar *label, int32_t length,
- UChar *dest, int32_t capacity,
+ const char16_t *label, int32_t length,
+ char16_t *dest, int32_t capacity,
UIDNAInfo *pInfo, UErrorCode *pErrorCode) {
if(!checkArgs(label, length, dest, capacity, pInfo, pErrorCode)) {
return 0;
@@ -1397,8 +1397,8 @@ uidna_labelToUnicode(const UIDNA *idna,
U_CAPI int32_t U_EXPORT2
uidna_nameToASCII(const UIDNA *idna,
- const UChar *name, int32_t length,
- UChar *dest, int32_t capacity,
+ const char16_t *name, int32_t length,
+ char16_t *dest, int32_t capacity,
UIDNAInfo *pInfo, UErrorCode *pErrorCode) {
if(!checkArgs(name, length, dest, capacity, pInfo, pErrorCode)) {
return 0;
@@ -1413,8 +1413,8 @@ uidna_nameToASCII(const UIDNA *idna,
U_CAPI int32_t U_EXPORT2
uidna_nameToUnicode(const UIDNA *idna,
- const UChar *name, int32_t length,
- UChar *dest, int32_t capacity,
+ const char16_t *name, int32_t length,
+ char16_t *dest, int32_t capacity,
UIDNAInfo *pInfo, UErrorCode *pErrorCode) {
if(!checkArgs(name, length, dest, capacity, pInfo, pErrorCode)) {
return 0;
diff --git a/thirdparty/icu4c/common/uvector.cpp b/thirdparty/icu4c/common/uvector.cpp
index 729314ae95..f93d73a3c6 100644
--- a/thirdparty/icu4c/common/uvector.cpp
+++ b/thirdparty/icu4c/common/uvector.cpp
@@ -248,7 +248,7 @@ UBool UVector::removeElement(void* obj) {
return false;
}
-void UVector::removeAllElements(void) {
+void UVector::removeAllElements() {
if (deleter != nullptr) {
for (int32_t i=0; i<count; ++i) {
if (elements[i].pointer != nullptr) {
diff --git a/thirdparty/icu4c/common/uvector.h b/thirdparty/icu4c/common/uvector.h
index 1eb7d136e7..1b2a58da86 100644
--- a/thirdparty/icu4c/common/uvector.h
+++ b/thirdparty/icu4c/common/uvector.h
@@ -161,11 +161,11 @@ public:
UBool equals(const UVector &other) const;
- inline void* firstElement(void) const {return elementAt(0);}
+ inline void* firstElement() const {return elementAt(0);}
- inline void* lastElement(void) const {return elementAt(count-1);}
+ inline void* lastElement() const {return elementAt(count-1);}
- inline int32_t lastElementi(void) const {return elementAti(count-1);}
+ inline int32_t lastElementi() const {return elementAti(count-1);}
int32_t indexOf(void* obj, int32_t startIndex = 0) const;
@@ -187,9 +187,9 @@ public:
void removeAllElements();
- inline int32_t size(void) const {return count;}
+ inline int32_t size() const {return count;}
- inline UBool isEmpty(void) const {return count == 0;}
+ inline UBool isEmpty() const {return count == 0;}
UBool ensureCapacity(int32_t minimumCapacity, UErrorCode &status);
@@ -197,7 +197,7 @@ public:
* Change the size of this vector as follows: If newSize is
* smaller, then truncate the array, possibly deleting held
* elements for i >= newSize. If newSize is larger, grow the
- * array, filling in new slots with NULL.
+ * array, filling in new slots with nullptr.
*/
void setSize(int32_t newSize, UErrorCode &status);
@@ -328,20 +328,20 @@ public:
// It's okay not to have a virtual destructor (in UVector)
// because UStack has no special cleanup to do.
- inline UBool empty(void) const {return isEmpty();}
+ inline UBool empty() const {return isEmpty();}
- inline void* peek(void) const {return lastElement();}
+ inline void* peek() const {return lastElement();}
- inline int32_t peeki(void) const {return lastElementi();}
+ inline int32_t peeki() const {return lastElementi();}
/**
* Pop and return an element from the stack.
* For stacks with a deleter function, the caller takes ownership
* of the popped element.
*/
- void* pop(void);
+ void* pop();
- int32_t popi(void);
+ int32_t popi();
inline void* push(void* obj, UErrorCode &status) {
if (hasDeleter()) {
diff --git a/thirdparty/icu4c/common/uvectr32.cpp b/thirdparty/icu4c/common/uvectr32.cpp
index 952f51792b..fb554729fe 100644
--- a/thirdparty/icu4c/common/uvectr32.cpp
+++ b/thirdparty/icu4c/common/uvectr32.cpp
@@ -30,7 +30,7 @@ UVector32::UVector32(UErrorCode &status) :
count(0),
capacity(0),
maxCapacity(0),
- elements(NULL)
+ elements(nullptr)
{
_init(DEFAULT_CAPACITY, status);
}
@@ -165,7 +165,7 @@ void UVector32::removeElementAt(int32_t index) {
}
}
-void UVector32::removeAllElements(void) {
+void UVector32::removeAllElements() {
count = 0;
}
@@ -229,7 +229,7 @@ UBool UVector32::expandCapacity(int32_t minimumCapacity, UErrorCode &status) {
return false;
}
int32_t* newElems = (int32_t *)uprv_realloc(elements, sizeof(int32_t)*newCap);
- if (newElems == NULL) {
+ if (newElems == nullptr) {
// We keep the original contents on the memory failure on realloc.
status = U_MEMORY_ALLOCATION_ERROR;
return false;
@@ -257,7 +257,7 @@ void UVector32::setMaxCapacity(int32_t limit) {
// 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);
- if (newElems == NULL) {
+ if (newElems == nullptr) {
// Realloc to smaller failed.
// Just keep what we had. No need to call it a failure.
return;
@@ -273,7 +273,7 @@ void UVector32::setMaxCapacity(int32_t limit) {
* Change the size of this vector as follows: If newSize is smaller,
* then truncate the array, possibly deleting held elements for i >=
* newSize. If newSize is larger, grow the array, filling in new
- * slots with NULL.
+ * slots with nullptr.
*/
void UVector32::setSize(int32_t newSize) {
int32_t i;
diff --git a/thirdparty/icu4c/common/uvectr32.h b/thirdparty/icu4c/common/uvectr32.h
index a7fada3833..2841391f57 100644
--- a/thirdparty/icu4c/common/uvectr32.h
+++ b/thirdparty/icu4c/common/uvectr32.h
@@ -107,7 +107,7 @@ public:
UBool equals(const UVector32 &other) const;
- inline int32_t lastElementi(void) const;
+ inline int32_t lastElementi() const;
int32_t indexOf(int32_t elem, int32_t startIndex = 0) const;
@@ -123,9 +123,9 @@ public:
void removeAllElements();
- inline int32_t size(void) const;
+ inline int32_t size() const;
- inline UBool isEmpty(void) const;
+ inline UBool isEmpty() const;
// Inline. Use this one for speedy size check.
inline UBool ensureCapacity(int32_t minimumCapacity, UErrorCode &status);
@@ -197,11 +197,11 @@ private:
// In the original UVector, these were in a separate derived class, UStack.
// Here in UVector32, they are all together.
public:
- inline UBool empty(void) const; // TODO: redundant, same as empty(). Remove it?
+ inline UBool empty() const; // TODO: redundant, same as empty(). Remove it?
- inline int32_t peeki(void) const;
+ inline int32_t peeki() const;
- inline int32_t popi(void);
+ inline int32_t popi();
inline int32_t push(int32_t i, UErrorCode &status);
@@ -234,7 +234,7 @@ inline void UVector32::addElement(int32_t elem, UErrorCode &status) {
inline int32_t *UVector32::reserveBlock(int32_t size, UErrorCode &status) {
if (ensureCapacity(count+size, status) == false) {
- return NULL;
+ return nullptr;
}
int32_t *rp = elements+count;
count += size;
@@ -252,11 +252,11 @@ inline int32_t *UVector32::popFrame(int32_t size) {
-inline int32_t UVector32::size(void) const {
+inline int32_t UVector32::size() const {
return count;
}
-inline UBool UVector32::isEmpty(void) const {
+inline UBool UVector32::isEmpty() const {
return count == 0;
}
@@ -264,7 +264,7 @@ inline UBool UVector32::contains(int32_t obj) const {
return indexOf(obj) >= 0;
}
-inline int32_t UVector32::lastElementi(void) const {
+inline int32_t UVector32::lastElementi() const {
return elementAti(count-1);
}
@@ -279,11 +279,11 @@ inline int32_t *UVector32::getBuffer() const {
// UStack inlines
-inline UBool UVector32::empty(void) const {
+inline UBool UVector32::empty() const {
return isEmpty();
}
-inline int32_t UVector32::peeki(void) const {
+inline int32_t UVector32::peeki() const {
return lastElementi();
}
@@ -292,7 +292,7 @@ inline int32_t UVector32::push(int32_t i, UErrorCode &status) {
return i;
}
-inline int32_t UVector32::popi(void) {
+inline int32_t UVector32::popi() {
int32_t result = 0;
if (count > 0) {
count--;
diff --git a/thirdparty/icu4c/common/uvectr64.cpp b/thirdparty/icu4c/common/uvectr64.cpp
index 8bd5cd7839..05559dd833 100644
--- a/thirdparty/icu4c/common/uvectr64.cpp
+++ b/thirdparty/icu4c/common/uvectr64.cpp
@@ -27,7 +27,7 @@ UVector64::UVector64(UErrorCode &status) :
count(0),
capacity(0),
maxCapacity(0),
- elements(NULL)
+ elements(nullptr)
{
_init(DEFAULT_CAPACITY, status);
}
@@ -111,7 +111,7 @@ void UVector64::insertElementAt(int64_t elem, int32_t index, UErrorCode &status)
/* else index out of range */
}
-void UVector64::removeAllElements(void) {
+void UVector64::removeAllElements() {
count = 0;
}
@@ -147,7 +147,7 @@ UBool UVector64::expandCapacity(int32_t minimumCapacity, UErrorCode &status) {
return false;
}
int64_t* newElems = (int64_t *)uprv_realloc(elements, sizeof(int64_t)*newCap);
- if (newElems == NULL) {
+ if (newElems == nullptr) {
// We keep the original contents on the memory failure on realloc.
status = U_MEMORY_ALLOCATION_ERROR;
return false;
@@ -175,7 +175,7 @@ void UVector64::setMaxCapacity(int32_t limit) {
// New maximum capacity is smaller than the current size.
// Realloc the storage to the new, smaller size.
int64_t* newElems = (int64_t *)uprv_realloc(elements, sizeof(int64_t)*maxCapacity);
- if (newElems == NULL) {
+ if (newElems == nullptr) {
// Realloc to smaller failed.
// Just keep what we had. No need to call it a failure.
return;
@@ -191,7 +191,7 @@ void UVector64::setMaxCapacity(int32_t limit) {
* Change the size of this vector as follows: If newSize is smaller,
* then truncate the array, possibly deleting held elements for i >=
* newSize. If newSize is larger, grow the array, filling in new
- * slots with NULL.
+ * slots with nullptr.
*/
void UVector64::setSize(int32_t newSize) {
int32_t i;
diff --git a/thirdparty/icu4c/common/uvectr64.h b/thirdparty/icu4c/common/uvectr64.h
index 070e2dd67d..d719e6d0ff 100644
--- a/thirdparty/icu4c/common/uvectr64.h
+++ b/thirdparty/icu4c/common/uvectr64.h
@@ -106,7 +106,7 @@ public:
//UBool equals(const UVector64 &other) const;
- inline int64_t lastElementi(void) const;
+ inline int64_t lastElementi() const;
//int32_t indexOf(int64_t elem, int32_t startIndex = 0) const;
@@ -122,9 +122,9 @@ public:
void removeAllElements();
- inline int32_t size(void) const;
+ inline int32_t size() const;
- inline UBool isEmpty(void) const { return count == 0; }
+ inline UBool isEmpty() const { return count == 0; }
// Inline. Use this one for speedy size check.
inline UBool ensureCapacity(int32_t minimumCapacity, UErrorCode &status);
@@ -186,11 +186,11 @@ private:
// In the original UVector, these were in a separate derived class, UStack.
// Here in UVector64, they are all together.
public:
- //UBool empty(void) const; // TODO: redundant, same as empty(). Remove it?
+ //UBool empty() const; // TODO: redundant, same as empty(). Remove it?
- //int64_t peeki(void) const;
+ //int64_t peeki() const;
- inline int64_t popi(void);
+ inline int64_t popi();
inline int64_t push(int64_t i, UErrorCode &status);
@@ -223,7 +223,7 @@ inline void UVector64::addElement(int64_t elem, UErrorCode &status) {
inline int64_t *UVector64::reserveBlock(int32_t size, UErrorCode &status) {
if (ensureCapacity(count+size, status) == false) {
- return NULL;
+ return nullptr;
}
int64_t *rp = elements+count;
count += size;
@@ -241,11 +241,11 @@ inline int64_t *UVector64::popFrame(int32_t size) {
-inline int32_t UVector64::size(void) const {
+inline int32_t UVector64::size() const {
return count;
}
-inline int64_t UVector64::lastElementi(void) const {
+inline int64_t UVector64::lastElementi() const {
return elementAti(count-1);
}
@@ -265,7 +265,7 @@ inline int64_t UVector64::push(int64_t i, UErrorCode &status) {
return i;
}
-inline int64_t UVector64::popi(void) {
+inline int64_t UVector64::popi() {
int64_t result = 0;
if (count > 0) {
count--;
diff --git a/thirdparty/icu4c/common/wintz.cpp b/thirdparty/icu4c/common/wintz.cpp
index 1bc08ae654..ef9cd68019 100644
--- a/thirdparty/icu4c/common/wintz.cpp
+++ b/thirdparty/icu4c/common/wintz.cpp
@@ -69,7 +69,7 @@ typedef struct _REG_TZI_FORMAT {
* as this API returns a non-localized time zone name which can be then mapped to an ICU time zone.
*
* However, in some RDP/terminal services situations, this struct isn't always fully complete, and the TimeZoneKeyName
-* field of the struct might be NULL. This can happen with some 3rd party RDP clients, and also when using older versions
+* field of the struct might be nullptr. This can happen with some 3rd party RDP clients, and also when using older versions
* of the RDP protocol, which don't send the newer TimeZoneKeyNamei information and only send the StandardName and DaylightName.
*
* Since these 3rd party clients and older RDP clients only send the pre-Vista time zone information to the server, this means that we
@@ -143,14 +143,14 @@ uprv_detectWindowsTimeZone()
//
// For example, a time zone that is 3 hours ahead of UTC (UTC+03:00) would have a Bias value of -180, and the
// corresponding time zone ID would be "Etc/GMT-3". (So there is no need to negate utcOffsetMins below.)
- int ret = snprintf(gmtOffsetTz, UPRV_LENGTHOF(gmtOffsetTz), "Etc/GMT%+ld", utcOffsetMins / 60);
+ int ret = snprintf(gmtOffsetTz, sizeof(gmtOffsetTz), "Etc/GMT%+ld", utcOffsetMins / 60);
if (ret > 0 && ret < UPRV_LENGTHOF(gmtOffsetTz)) {
return uprv_strdup(gmtOffsetTz);
}
}
}
- // If DST is NOT disabled, but the TimeZoneKeyName field of the struct is NULL, then we may be dealing with a
+ // If DST is NOT disabled, but the TimeZoneKeyName field of the struct is nullptr, then we may be dealing with a
// RDP/terminal services session where the 'Time Zone Redirection' feature is enabled. However, either the RDP
// client sent the server incomplete info (some 3rd party RDP clients only send the StandardName and DaylightName,
// but do not send the important TimeZoneKeyName), or if the RDP server has not appropriately populated the struct correctly.
@@ -295,7 +295,7 @@ uprv_detectWindowsTimeZone()
int geoId = GetUserGeoID(GEOCLASS_NATION);
int regionCodeLen = GetGeoInfoW(geoId, GEO_ISO2, regionCodeW, UPRV_LENGTHOF(regionCodeW), 0);
- const UChar *icuTZ16 = nullptr;
+ const char16_t *icuTZ16 = nullptr;
int32_t tzListLen = 0;
if (regionCodeLen != 0) {