]> granicus.if.org Git - icu/commitdiff
ICU-21833 Replace NULL with nullptr in all C++ code.
authorFredrik Roubert <roubert@google.com>
Thu, 22 Dec 2022 11:22:18 +0000 (20:22 +0900)
committerFredrik Roubert <fredrik@roubert.name>
Fri, 3 Feb 2023 19:20:38 +0000 (20:20 +0100)
764 files changed:
icu4c/source/common/appendable.cpp
icu4c/source/common/bytestream.cpp
icu4c/source/common/bytestrie.cpp
icu4c/source/common/bytestriebuilder.cpp
icu4c/source/common/bytestrieiterator.cpp
icu4c/source/common/caniter.cpp
icu4c/source/common/charstr.cpp
icu4c/source/common/cmemory.cpp
icu4c/source/common/cmemory.h
icu4c/source/common/cstr.cpp
icu4c/source/common/cstring.cpp
icu4c/source/common/dictionarydata.cpp
icu4c/source/common/dictionarydata.h
icu4c/source/common/edits.cpp
icu4c/source/common/filteredbrk.cpp
icu4c/source/common/filterednormalizer2.cpp
icu4c/source/common/hash.h
icu4c/source/common/icudataver.cpp
icu4c/source/common/icuplug.cpp
icu4c/source/common/loadednormalizer2impl.cpp
icu4c/source/common/locavailable.cpp
icu4c/source/common/locbased.cpp
icu4c/source/common/locdispnames.cpp
icu4c/source/common/locdspnm.cpp
icu4c/source/common/locid.cpp
icu4c/source/common/loclikely.cpp
icu4c/source/common/locmap.cpp
icu4c/source/common/locresdata.cpp
icu4c/source/common/locutil.cpp
icu4c/source/common/messagepattern.cpp
icu4c/source/common/norm2allmodes.h
icu4c/source/common/normalizer2.cpp
icu4c/source/common/normalizer2impl.cpp
icu4c/source/common/normlzr.cpp
icu4c/source/common/pluralmap.cpp
icu4c/source/common/pluralmap.h
icu4c/source/common/propname.cpp
icu4c/source/common/propsvec.cpp
icu4c/source/common/punycode.cpp
icu4c/source/common/putil.cpp
icu4c/source/common/resbund.cpp
icu4c/source/common/resbund_cnv.cpp
icu4c/source/common/resource.h
icu4c/source/common/serv.cpp
icu4c/source/common/serv.h
icu4c/source/common/servlk.cpp
icu4c/source/common/servlkf.cpp
icu4c/source/common/servloc.h
icu4c/source/common/servls.cpp
icu4c/source/common/servnotf.cpp
icu4c/source/common/servrbf.cpp
icu4c/source/common/servslkf.cpp
icu4c/source/common/sharedobject.h
icu4c/source/common/simpleformatter.cpp
icu4c/source/common/stringpiece.cpp
icu4c/source/common/stringtriebuilder.cpp
icu4c/source/common/uarrsort.cpp
icu4c/source/common/ubidi.cpp
icu4c/source/common/ubidi_props.cpp
icu4c/source/common/ubidi_props_data.h
icu4c/source/common/ubidiln.cpp
icu4c/source/common/ubiditransform.cpp
icu4c/source/common/ubidiwrt.cpp
icu4c/source/common/ucase.cpp
icu4c/source/common/ucase_props_data.h
icu4c/source/common/ucasemap.cpp
icu4c/source/common/ucasemap_titlecase_brkiter.cpp
icu4c/source/common/ucat.cpp
icu4c/source/common/uchar.cpp
icu4c/source/common/uchar_props_data.h
icu4c/source/common/ucharstrie.cpp
icu4c/source/common/ucharstriebuilder.cpp
icu4c/source/common/ucharstrieiterator.cpp
icu4c/source/common/ucln_cmn.cpp
icu4c/source/common/ucmndata.cpp
icu4c/source/common/ucnv.cpp
icu4c/source/common/ucnv2022.cpp
icu4c/source/common/ucnv_bld.cpp
icu4c/source/common/ucnv_cb.cpp
icu4c/source/common/ucnv_cnv.cpp
icu4c/source/common/ucnv_ct.cpp
icu4c/source/common/ucnv_err.cpp
icu4c/source/common/ucnv_ext.cpp
icu4c/source/common/ucnv_io.cpp
icu4c/source/common/ucnv_lmb.cpp
icu4c/source/common/ucnv_set.cpp
icu4c/source/common/ucnv_u16.cpp
icu4c/source/common/ucnv_u32.cpp
icu4c/source/common/ucnv_u7.cpp
icu4c/source/common/ucnv_u8.cpp
icu4c/source/common/ucnvbocu.cpp
icu4c/source/common/ucnvdisp.cpp
icu4c/source/common/ucnvhz.cpp
icu4c/source/common/ucnvisci.cpp
icu4c/source/common/ucnvlat1.cpp
icu4c/source/common/ucnvmbcs.cpp
icu4c/source/common/ucnvscsu.cpp
icu4c/source/common/ucnvsel.cpp
icu4c/source/common/ucol_swp.cpp
icu4c/source/common/ucurr.cpp
icu4c/source/common/udata.cpp
icu4c/source/common/udatamem.cpp
icu4c/source/common/udataswp.cpp
icu4c/source/common/uenum.cpp
icu4c/source/common/uhash.cpp
icu4c/source/common/uidna.cpp
icu4c/source/common/uinvchar.cpp
icu4c/source/common/uiter.cpp
icu4c/source/common/ulist.cpp
icu4c/source/common/uloc.cpp
icu4c/source/common/uloc_keytype.cpp
icu4c/source/common/uloc_tag.cpp
icu4c/source/common/umapfile.cpp
icu4c/source/common/unames.cpp
icu4c/source/common/unicode/appendable.h
icu4c/source/common/unicode/brkiter.h
icu4c/source/common/unicode/bytestrie.h
icu4c/source/common/unicode/casemap.h
icu4c/source/common/unicode/localpointer.h
icu4c/source/common/unicode/locid.h
icu4c/source/common/unicode/messagepattern.h
icu4c/source/common/unicode/normalizer2.h
icu4c/source/common/unicode/normlzr.h
icu4c/source/common/unicode/parsepos.h
icu4c/source/common/unicode/rbbi.h
icu4c/source/common/unicode/rep.h
icu4c/source/common/unicode/resbund.h
icu4c/source/common/unicode/simpleformatter.h
icu4c/source/common/unicode/strenum.h
icu4c/source/common/unicode/stringtriebuilder.h
icu4c/source/common/unicode/symtable.h
icu4c/source/common/unicode/ucharstrie.h
icu4c/source/common/unicode/uniset.h
icu4c/source/common/unicode/unistr.h
icu4c/source/common/unicode/uobject.h
icu4c/source/common/unicode/utext.h
icu4c/source/common/unifiedcache.cpp
icu4c/source/common/unifiedcache.h
icu4c/source/common/uniset.cpp
icu4c/source/common/uniset_closure.cpp
icu4c/source/common/uniset_props.cpp
icu4c/source/common/unisetspan.cpp
icu4c/source/common/unistr.cpp
icu4c/source/common/unistr_case.cpp
icu4c/source/common/unistr_case_locale.cpp
icu4c/source/common/unistr_cnv.cpp
icu4c/source/common/unorm.cpp
icu4c/source/common/unormcmp.cpp
icu4c/source/common/uobject.cpp
icu4c/source/common/uprops.cpp
icu4c/source/common/ures_cnv.cpp
icu4c/source/common/uresbund.cpp
icu4c/source/common/uresdata.cpp
icu4c/source/common/usc_impl.cpp
icu4c/source/common/uscript.cpp
icu4c/source/common/uscript_props.cpp
icu4c/source/common/uset.cpp
icu4c/source/common/uset_props.cpp
icu4c/source/common/usetiter.cpp
icu4c/source/common/ushape.cpp
icu4c/source/common/usprep.cpp
icu4c/source/common/ustr_cnv.cpp
icu4c/source/common/ustr_titlecase_brkiter.cpp
icu4c/source/common/ustr_wcs.cpp
icu4c/source/common/ustrcase.cpp
icu4c/source/common/ustrcase_locale.cpp
icu4c/source/common/ustrenum.cpp
icu4c/source/common/ustrenum.h
icu4c/source/common/ustring.cpp
icu4c/source/common/ustrtrns.cpp
icu4c/source/common/utext.cpp
icu4c/source/common/utf_impl.cpp
icu4c/source/common/util.cpp
icu4c/source/common/utrace.cpp
icu4c/source/common/utrie.cpp
icu4c/source/common/utrie2.cpp
icu4c/source/common/utrie2.h
icu4c/source/common/utrie2_builder.cpp
icu4c/source/common/utrie_swap.cpp
icu4c/source/common/uts46.cpp
icu4c/source/common/uvector.h
icu4c/source/common/uvectr32.cpp
icu4c/source/common/uvectr32.h
icu4c/source/common/uvectr64.cpp
icu4c/source/common/uvectr64.h
icu4c/source/common/wintz.cpp
icu4c/source/extra/scrptrun/scrptrun.h
icu4c/source/extra/uconv/uconv.cpp
icu4c/source/i18n/alphaindex.cpp
icu4c/source/i18n/anytrans.cpp
icu4c/source/i18n/anytrans.h
icu4c/source/i18n/astro.cpp
icu4c/source/i18n/basictz.cpp
icu4c/source/i18n/brktrans.cpp
icu4c/source/i18n/calendar.cpp
icu4c/source/i18n/chnsecal.cpp
icu4c/source/i18n/choicfmt.cpp
icu4c/source/i18n/coleitr.cpp
icu4c/source/i18n/coll.cpp
icu4c/source/i18n/collationbuilder.cpp
icu4c/source/i18n/collationdata.h
icu4c/source/i18n/collationdatabuilder.cpp
icu4c/source/i18n/collationdatareader.cpp
icu4c/source/i18n/collationdatawriter.cpp
icu4c/source/i18n/collationfastlatin.cpp
icu4c/source/i18n/collationfastlatinbuilder.cpp
icu4c/source/i18n/collationiterator.cpp
icu4c/source/i18n/collationiterator.h
icu4c/source/i18n/collationkeys.cpp
icu4c/source/i18n/collationkeys.h
icu4c/source/i18n/collationroot.cpp
icu4c/source/i18n/collationruleparser.cpp
icu4c/source/i18n/collationsets.cpp
icu4c/source/i18n/collationsets.h
icu4c/source/i18n/collationsettings.cpp
icu4c/source/i18n/collationsettings.h
icu4c/source/i18n/collationtailoring.cpp
icu4c/source/i18n/collationtailoring.h
icu4c/source/i18n/collationweights.cpp
icu4c/source/i18n/cpdtrans.cpp
icu4c/source/i18n/cpdtrans.h
icu4c/source/i18n/csdetect.cpp
icu4c/source/i18n/csmatch.cpp
icu4c/source/i18n/csmatch.h
icu4c/source/i18n/currfmt.cpp
icu4c/source/i18n/dangical.cpp
icu4c/source/i18n/datefmt.cpp
icu4c/source/i18n/dayperiodrules.cpp
icu4c/source/i18n/dcfmtsym.cpp
icu4c/source/i18n/decContext.cpp
icu4c/source/i18n/decNumber.cpp
icu4c/source/i18n/decimfmt.cpp
icu4c/source/i18n/double-conversion-double-to-string.h
icu4c/source/i18n/double-conversion-string-to-double.h
icu4c/source/i18n/dtfmtsym.cpp
icu4c/source/i18n/dtptngen.cpp
icu4c/source/i18n/esctrn.cpp
icu4c/source/i18n/fmtable.cpp
icu4c/source/i18n/fphdlimp.cpp
icu4c/source/i18n/fphdlimp.h
icu4c/source/i18n/fpositer.cpp
icu4c/source/i18n/gender.cpp
icu4c/source/i18n/gregocal.cpp
icu4c/source/i18n/hebrwcal.cpp
icu4c/source/i18n/inputext.cpp
icu4c/source/i18n/islamcal.cpp
icu4c/source/i18n/japancal.cpp
icu4c/source/i18n/measfmt.cpp
icu4c/source/i18n/measunit.cpp
icu4c/source/i18n/measunit_extra.cpp
icu4c/source/i18n/measure.cpp
icu4c/source/i18n/msgfmt.cpp
icu4c/source/i18n/name2uni.cpp
icu4c/source/i18n/nfrlist.h
icu4c/source/i18n/nfrs.cpp
icu4c/source/i18n/nfrule.cpp
icu4c/source/i18n/nfsubs.cpp
icu4c/source/i18n/nortrans.cpp
icu4c/source/i18n/number_grouping.cpp
icu4c/source/i18n/number_longnames.cpp
icu4c/source/i18n/numfmt.cpp
icu4c/source/i18n/numrange_impl.cpp
icu4c/source/i18n/olsontz.cpp
icu4c/source/i18n/olsontz.h
icu4c/source/i18n/plurfmt.cpp
icu4c/source/i18n/quantityformatter.cpp
icu4c/source/i18n/quantityformatter.h
icu4c/source/i18n/rbnf.cpp
icu4c/source/i18n/rbt.cpp
icu4c/source/i18n/rbt_data.cpp
icu4c/source/i18n/rbt_data.h
icu4c/source/i18n/rbt_pars.cpp
icu4c/source/i18n/rbt_rule.cpp
icu4c/source/i18n/rbt_rule.h
icu4c/source/i18n/rbt_set.cpp
icu4c/source/i18n/rbtz.cpp
icu4c/source/i18n/regexcmp.cpp
icu4c/source/i18n/regeximp.cpp
icu4c/source/i18n/regeximp.h
icu4c/source/i18n/region.cpp
icu4c/source/i18n/reldtfmt.cpp
icu4c/source/i18n/reldtfmt.h
icu4c/source/i18n/rematch.cpp
icu4c/source/i18n/remtrans.cpp
icu4c/source/i18n/repattrn.cpp
icu4c/source/i18n/rulebasedcollator.cpp
icu4c/source/i18n/scientificnumberformatter.cpp
icu4c/source/i18n/scriptset.cpp
icu4c/source/i18n/search.cpp
icu4c/source/i18n/selfmt.cpp
icu4c/source/i18n/simpletz.cpp
icu4c/source/i18n/smpdtfmt.cpp
icu4c/source/i18n/smpdtfst.cpp
icu4c/source/i18n/sortkey.cpp
icu4c/source/i18n/strmatch.cpp
icu4c/source/i18n/strrepl.cpp
icu4c/source/i18n/stsearch.cpp
icu4c/source/i18n/timezone.cpp
icu4c/source/i18n/titletrn.cpp
icu4c/source/i18n/tmunit.cpp
icu4c/source/i18n/tmutfmt.cpp
icu4c/source/i18n/translit.cpp
icu4c/source/i18n/transreg.cpp
icu4c/source/i18n/transreg.h
icu4c/source/i18n/tridpars.cpp
icu4c/source/i18n/tzfmt.cpp
icu4c/source/i18n/tzgnames.cpp
icu4c/source/i18n/tznames.cpp
icu4c/source/i18n/tznames_impl.cpp
icu4c/source/i18n/tznames_impl.h
icu4c/source/i18n/tzrule.cpp
icu4c/source/i18n/tztrans.cpp
icu4c/source/i18n/ucln_in.cpp
icu4c/source/i18n/ucol.cpp
icu4c/source/i18n/ucol_res.cpp
icu4c/source/i18n/ucol_sit.cpp
icu4c/source/i18n/ucoleitr.cpp
icu4c/source/i18n/ucsdet.cpp
icu4c/source/i18n/udat.cpp
icu4c/source/i18n/udateintervalformat.cpp
icu4c/source/i18n/udatpg.cpp
icu4c/source/i18n/ufieldpositer.cpp
icu4c/source/i18n/ulistformatter.cpp
icu4c/source/i18n/ulocdata.cpp
icu4c/source/i18n/umsg.cpp
icu4c/source/i18n/unesctrn.cpp
icu4c/source/i18n/unesctrn.h
icu4c/source/i18n/uni2name.cpp
icu4c/source/i18n/unicode/alphaindex.h
icu4c/source/i18n/unicode/basictz.h
icu4c/source/i18n/unicode/calendar.h
icu4c/source/i18n/unicode/choicfmt.h
icu4c/source/i18n/unicode/coll.h
icu4c/source/i18n/unicode/compactdecimalformat.h
icu4c/source/i18n/unicode/curramt.h
icu4c/source/i18n/unicode/currunit.h
icu4c/source/i18n/unicode/datefmt.h
icu4c/source/i18n/unicode/decimfmt.h
icu4c/source/i18n/unicode/dtfmtsym.h
icu4c/source/i18n/unicode/dtitvfmt.h
icu4c/source/i18n/unicode/fieldpos.h
icu4c/source/i18n/unicode/fmtable.h
icu4c/source/i18n/unicode/gregocal.h
icu4c/source/i18n/unicode/measfmt.h
icu4c/source/i18n/unicode/measure.h
icu4c/source/i18n/unicode/msgfmt.h
icu4c/source/i18n/unicode/numfmt.h
icu4c/source/i18n/unicode/numsys.h
icu4c/source/i18n/unicode/plurfmt.h
icu4c/source/i18n/unicode/plurrule.h
icu4c/source/i18n/unicode/rbnf.h
icu4c/source/i18n/unicode/rbtz.h
icu4c/source/i18n/unicode/regex.h
icu4c/source/i18n/unicode/region.h
icu4c/source/i18n/unicode/reldatefmt.h
icu4c/source/i18n/unicode/search.h
icu4c/source/i18n/unicode/simpletz.h
icu4c/source/i18n/unicode/smpdtfmt.h
icu4c/source/i18n/unicode/sortkey.h
icu4c/source/i18n/unicode/stsearch.h
icu4c/source/i18n/unicode/tblcoll.h
icu4c/source/i18n/unicode/timezone.h
icu4c/source/i18n/unicode/translit.h
icu4c/source/i18n/unicode/tzfmt.h
icu4c/source/i18n/unicode/tznames.h
icu4c/source/i18n/unicode/uspoof.h
icu4c/source/i18n/unicode/vtzone.h
icu4c/source/i18n/units_data.cpp
icu4c/source/i18n/unum.cpp
icu4c/source/i18n/unumsys.cpp
icu4c/source/i18n/upluralrules.cpp
icu4c/source/i18n/uregex.cpp
icu4c/source/i18n/uregexc.cpp
icu4c/source/i18n/uspoof.cpp
icu4c/source/i18n/uspoof_build.cpp
icu4c/source/i18n/uspoof_conf.cpp
icu4c/source/i18n/uspoof_impl.cpp
icu4c/source/i18n/uspoof_impl.h
icu4c/source/i18n/utf16collationiterator.cpp
icu4c/source/i18n/utf16collationiterator.h
icu4c/source/i18n/utmscale.cpp
icu4c/source/i18n/utrans.cpp
icu4c/source/i18n/windtfmt.cpp
icu4c/source/i18n/winnmfmt.cpp
icu4c/source/i18n/wintzimpl.cpp
icu4c/source/i18n/zonemeta.cpp
icu4c/source/i18n/zonemeta.h
icu4c/source/io/locbund.cpp
icu4c/source/io/sscanf.cpp
icu4c/source/io/ucln_io.cpp
icu4c/source/io/ufile.cpp
icu4c/source/io/ufmt_cmn.cpp
icu4c/source/io/uprintf.cpp
icu4c/source/io/uprntf_p.cpp
icu4c/source/io/uscanf_p.cpp
icu4c/source/io/ustdio.cpp
icu4c/source/layoutex/ParagraphLayout.cpp
icu4c/source/layoutex/RunArrays.cpp
icu4c/source/layoutex/layout/ParagraphLayout.h
icu4c/source/layoutex/layout/RunArrays.h
icu4c/source/layoutex/playout.cpp
icu4c/source/layoutex/plruns.cpp
icu4c/source/samples/case/case.cpp
icu4c/source/samples/citer/citer.cpp
icu4c/source/samples/coll/coll.cpp
icu4c/source/samples/dtitvfmtsample/dtitvfmtsample.cpp
icu4c/source/samples/dtptngsample/dtptngsample.cpp
icu4c/source/samples/layout/FontMap.cpp
icu4c/source/samples/layout/FontTableCache.cpp
icu4c/source/samples/layout/GDIFontInstance.cpp
icu4c/source/samples/layout/GDIFontMap.cpp
icu4c/source/samples/layout/GDIGUISupport.cpp
icu4c/source/samples/layout/GnomeFontInstance.cpp
icu4c/source/samples/layout/GnomeFontMap.cpp
icu4c/source/samples/layout/GnomeGUISupport.cpp
icu4c/source/samples/layout/ScriptCompositeFontInstance.cpp
icu4c/source/samples/layout/ScriptCompositeFontInstance.h
icu4c/source/samples/layout/UnicodeReader.cpp
icu4c/source/samples/layout/cmaps.cpp
icu4c/source/samples/layout/gnomelayout.cpp
icu4c/source/samples/layout/layout.cpp
icu4c/source/samples/layout/paragraph.cpp
icu4c/source/samples/legacy/legacy.cpp
icu4c/source/samples/legacy/newcol.cpp
icu4c/source/samples/legacy/oldcol.cpp
icu4c/source/samples/numfmt/main.cpp
icu4c/source/samples/strsrch/strsrch.cpp
icu4c/source/samples/ucnv/convsamp.cpp
icu4c/source/samples/ugrep/ugrep.cpp
icu4c/source/samples/ustring/ustring.cpp
icu4c/source/test/intltest/aliastst.cpp
icu4c/source/test/intltest/aliastst.h
icu4c/source/test/intltest/allcoll.cpp
icu4c/source/test/intltest/allcoll.h
icu4c/source/test/intltest/alphaindextst.cpp
icu4c/source/test/intltest/alphaindextst.h
icu4c/source/test/intltest/apicoll.cpp
icu4c/source/test/intltest/apicoll.h
icu4c/source/test/intltest/astrotst.cpp
icu4c/source/test/intltest/bidiconf.cpp
icu4c/source/test/intltest/bytestrietest.cpp
icu4c/source/test/intltest/calcasts.cpp
icu4c/source/test/intltest/callimts.cpp
icu4c/source/test/intltest/calregts.cpp
icu4c/source/test/intltest/caltest.cpp
icu4c/source/test/intltest/canittst.cpp
icu4c/source/test/intltest/canittst.h
icu4c/source/test/intltest/citrtest.cpp
icu4c/source/test/intltest/citrtest.h
icu4c/source/test/intltest/collationtest.cpp
icu4c/source/test/intltest/colldata.cpp
icu4c/source/test/intltest/colldata.h
icu4c/source/test/intltest/compactdecimalformattest.cpp
icu4c/source/test/intltest/convtest.cpp
icu4c/source/test/intltest/cpdtrtst.cpp
icu4c/source/test/intltest/cpdtrtst.h
icu4c/source/test/intltest/csdetest.cpp
icu4c/source/test/intltest/csdetest.h
icu4c/source/test/intltest/currcoll.h
icu4c/source/test/intltest/dadrcal.cpp
icu4c/source/test/intltest/dadrcal.h
icu4c/source/test/intltest/dadrfmt.cpp
icu4c/source/test/intltest/dadrfmt.h
icu4c/source/test/intltest/datadrivennumberformattestsuite.cpp
icu4c/source/test/intltest/datadrivennumberformattestsuite.h
icu4c/source/test/intltest/dcfmapts.h
icu4c/source/test/intltest/dcfmtest.cpp
icu4c/source/test/intltest/dcfmtest.h
icu4c/source/test/intltest/decoll.cpp
icu4c/source/test/intltest/decoll.h
icu4c/source/test/intltest/dtfmapts.cpp
icu4c/source/test/intltest/dtfmapts.h
icu4c/source/test/intltest/dtfmrgts.cpp
icu4c/source/test/intltest/dtfmtrtts.cpp
icu4c/source/test/intltest/dtfmttst.cpp
icu4c/source/test/intltest/dtifmtts.cpp
icu4c/source/test/intltest/dtifmtts.h
icu4c/source/test/intltest/dtptngts.cpp
icu4c/source/test/intltest/dtptngts.h
icu4c/source/test/intltest/encoll.h
icu4c/source/test/intltest/erarulestest.cpp
icu4c/source/test/intltest/erarulestest.h
icu4c/source/test/intltest/escoll.h
icu4c/source/test/intltest/ficoll.h
icu4c/source/test/intltest/fldset.cpp
icu4c/source/test/intltest/fldset.h
icu4c/source/test/intltest/frcoll.cpp
icu4c/source/test/intltest/frcoll.h
icu4c/source/test/intltest/g7coll.h
icu4c/source/test/intltest/genderinfotest.cpp
icu4c/source/test/intltest/icusvtst.cpp
icu4c/source/test/intltest/icusvtst.h
icu4c/source/test/intltest/idnaconf.cpp
icu4c/source/test/intltest/idnaconf.h
icu4c/source/test/intltest/idnaref.cpp
icu4c/source/test/intltest/incaltst.cpp
icu4c/source/test/intltest/intltest.cpp
icu4c/source/test/intltest/intltest.h
icu4c/source/test/intltest/itercoll.cpp
icu4c/source/test/intltest/itercoll.h
icu4c/source/test/intltest/itformat.cpp
icu4c/source/test/intltest/itformat.h
icu4c/source/test/intltest/itmajor.h
icu4c/source/test/intltest/itrbbi.h
icu4c/source/test/intltest/itrbnf.cpp
icu4c/source/test/intltest/itrbnfp.cpp
icu4c/source/test/intltest/itspoof.cpp
icu4c/source/test/intltest/itspoof.h
icu4c/source/test/intltest/ittrans.h
icu4c/source/test/intltest/itutil.cpp
icu4c/source/test/intltest/itutil.h
icu4c/source/test/intltest/jacoll.cpp
icu4c/source/test/intltest/jacoll.h
icu4c/source/test/intltest/jamotest.cpp
icu4c/source/test/intltest/jamotest.h
icu4c/source/test/intltest/lcukocol.h
icu4c/source/test/intltest/localebuildertest.h
icu4c/source/test/intltest/localematchertest.cpp
icu4c/source/test/intltest/locnmtst.cpp
icu4c/source/test/intltest/locnmtst.h
icu4c/source/test/intltest/loctest.cpp
icu4c/source/test/intltest/loctest.h
icu4c/source/test/intltest/lstmbetst.cpp
icu4c/source/test/intltest/lstmbetst.h
icu4c/source/test/intltest/measfmttest.cpp
icu4c/source/test/intltest/mnkytst.cpp
icu4c/source/test/intltest/mnkytst.h
icu4c/source/test/intltest/msfmrgts.cpp
icu4c/source/test/intltest/nmfmapts.cpp
icu4c/source/test/intltest/nmfmapts.h
icu4c/source/test/intltest/nmfmtrt.cpp
icu4c/source/test/intltest/normconf.cpp
icu4c/source/test/intltest/normconf.h
icu4c/source/test/intltest/nptrans.cpp
icu4c/source/test/intltest/numbertest_api.cpp
icu4c/source/test/intltest/numfmtdatadriventest.cpp
icu4c/source/test/intltest/numfmtspectest.cpp
icu4c/source/test/intltest/numfmtst.cpp
icu4c/source/test/intltest/numrgts.cpp
icu4c/source/test/intltest/pluralmaptest.cpp
icu4c/source/test/intltest/plurfmts.cpp
icu4c/source/test/intltest/plurfmts.h
icu4c/source/test/intltest/plurults.cpp
icu4c/source/test/intltest/plurults.h
icu4c/source/test/intltest/pptest.cpp
icu4c/source/test/intltest/rbbiapts.h
icu4c/source/test/intltest/rbbimonkeytest.cpp
icu4c/source/test/intltest/rbbimonkeytest.h
icu4c/source/test/intltest/rbbitst.h
icu4c/source/test/intltest/regcoll.cpp
icu4c/source/test/intltest/regcoll.h
icu4c/source/test/intltest/regextst.cpp
icu4c/source/test/intltest/regextst.h
icu4c/source/test/intltest/regiontst.cpp
icu4c/source/test/intltest/reldatefmttest.cpp
icu4c/source/test/intltest/reptest.cpp
icu4c/source/test/intltest/reptest.h
icu4c/source/test/intltest/restest.cpp
icu4c/source/test/intltest/restest.h
icu4c/source/test/intltest/restsnew.cpp
icu4c/source/test/intltest/restsnew.h
icu4c/source/test/intltest/sdtfmtts.cpp
icu4c/source/test/intltest/sdtfmtts.h
icu4c/source/test/intltest/selfmts.cpp
icu4c/source/test/intltest/selfmts.h
icu4c/source/test/intltest/sfwdchit.cpp
icu4c/source/test/intltest/simpleformattertest.cpp
icu4c/source/test/intltest/simplethread.cpp
icu4c/source/test/intltest/srchtest.cpp
icu4c/source/test/intltest/srchtest.h
icu4c/source/test/intltest/ssearch.cpp
icu4c/source/test/intltest/ssearch.h
icu4c/source/test/intltest/strcase.cpp
icu4c/source/test/intltest/strtest.cpp
icu4c/source/test/intltest/strtest.h
icu4c/source/test/intltest/svccoll.cpp
icu4c/source/test/intltest/svccoll.h
icu4c/source/test/intltest/tchcfmt.cpp
icu4c/source/test/intltest/tchcfmt.h
icu4c/source/test/intltest/testidn.cpp
icu4c/source/test/intltest/testidna.cpp
icu4c/source/test/intltest/testidna.h
icu4c/source/test/intltest/tfsmalls.cpp
icu4c/source/test/intltest/tfsmalls.h
icu4c/source/test/intltest/thcoll.cpp
icu4c/source/test/intltest/thcoll.h
icu4c/source/test/intltest/tmsgfmt.cpp
icu4c/source/test/intltest/tmsgfmt.h
icu4c/source/test/intltest/transapi.cpp
icu4c/source/test/intltest/transapi.h
icu4c/source/test/intltest/transrt.cpp
icu4c/source/test/intltest/transrt.h
icu4c/source/test/intltest/transtst.cpp
icu4c/source/test/intltest/transtst.h
icu4c/source/test/intltest/trcoll.h
icu4c/source/test/intltest/trnserr.cpp
icu4c/source/test/intltest/trnserr.h
icu4c/source/test/intltest/tscoll.h
icu4c/source/test/intltest/tsdate.h
icu4c/source/test/intltest/tsdcfmsy.h
icu4c/source/test/intltest/tsdtfmsy.h
icu4c/source/test/intltest/tsmthred.cpp
icu4c/source/test/intltest/tsmthred.h
icu4c/source/test/intltest/tsnmfmt.h
icu4c/source/test/intltest/tstnorm.h
icu4c/source/test/intltest/tzbdtest.cpp
icu4c/source/test/intltest/tzfmttst.cpp
icu4c/source/test/intltest/tzregts.cpp
icu4c/source/test/intltest/tzrulets.cpp
icu4c/source/test/intltest/tztest.cpp
icu4c/source/test/intltest/ucaconf.cpp
icu4c/source/test/intltest/ucaconf.h
icu4c/source/test/intltest/ucdtest.cpp
icu4c/source/test/intltest/ucdtest.h
icu4c/source/test/intltest/ucharstrietest.cpp
icu4c/source/test/intltest/unifiedcachetest.cpp
icu4c/source/test/intltest/units_data_test.cpp
icu4c/source/test/intltest/units_router_test.cpp
icu4c/source/test/intltest/units_test.cpp
icu4c/source/test/intltest/uobjtest.cpp
icu4c/source/test/intltest/uobjtest.h
icu4c/source/test/intltest/usettest.cpp
icu4c/source/test/intltest/usettest.h
icu4c/source/test/intltest/ustrtest.cpp
icu4c/source/test/intltest/ustrtest.h
icu4c/source/test/intltest/uts46test.cpp
icu4c/source/test/intltest/utxttest.cpp
icu4c/source/test/intltest/utxttest.h
icu4c/source/test/intltest/uvectest.cpp
icu4c/source/test/intltest/uvectest.h
icu4c/source/test/intltest/v32test.h
icu4c/source/test/intltest/windttst.cpp
icu4c/source/test/intltest/winnmtst.cpp
icu4c/source/test/intltest/winutil.cpp
icu4c/source/test/iotest/iotest.cpp
icu4c/source/test/letest/FontObject.cpp
icu4c/source/test/letest/FontTableCache.cpp
icu4c/source/test/letest/PortableFontInstance.cpp
icu4c/source/test/letest/SimpleFontInstance.cpp
icu4c/source/test/letest/cmaps.cpp
icu4c/source/test/letest/gendata.cpp
icu4c/source/test/letest/letest.cpp
icu4c/source/test/letest/letsutil.cpp
icu4c/source/test/letest/xmlreader.cpp
icu4c/source/test/perf/DateFmtPerf/DateFmtPerf.cpp
icu4c/source/test/perf/charperf/charperf.cpp
icu4c/source/test/perf/charperf/charperf.h
icu4c/source/test/perf/collationperf/collperf.cpp
icu4c/source/test/perf/collperf/collperf.cpp
icu4c/source/test/perf/collperf2/collperf2.cpp
icu4c/source/test/perf/convperf/convperf.cpp
icu4c/source/test/perf/convperf/convperf.h
icu4c/source/test/perf/dicttrieperf/dicttrieperf.cpp
icu4c/source/test/perf/howExpensiveIs/howExpensiveIs.cpp
icu4c/source/test/perf/howExpensiveIs/sieve.cpp
icu4c/source/test/perf/leperf/FontObject.cpp
icu4c/source/test/perf/leperf/FontTableCache.cpp
icu4c/source/test/perf/leperf/PortableFontInstance.cpp
icu4c/source/test/perf/leperf/SimpleFontInstance.cpp
icu4c/source/test/perf/leperf/cmaps.cpp
icu4c/source/test/perf/leperf/leperf.cpp
icu4c/source/test/perf/leperf/letrperf.cpp
icu4c/source/test/perf/leperf/xmlreader.cpp
icu4c/source/test/perf/normperf/dtfmtrtperf.cpp
icu4c/source/test/perf/normperf/normperf.cpp
icu4c/source/test/perf/normperf/normperf.h
icu4c/source/test/perf/strsrchperf/strsrchperf.cpp
icu4c/source/test/perf/strsrchperf/strsrchperf.h
icu4c/source/test/perf/ubrkperf/ubrkperf.cpp
icu4c/source/test/perf/ubrkperf/ubrkperf.h
icu4c/source/test/perf/ubrkperf/ubrkperfold.cpp
icu4c/source/test/perf/ucnvavailperf/ucnvavailperf.cpp
icu4c/source/test/perf/unisetperf/draft/bitset.cpp
icu4c/source/test/perf/unisetperf/draft/trieset.cpp
icu4c/source/test/perf/unisetperf/unisetperf.cpp
icu4c/source/test/perf/usetperf/usetperf.cpp
icu4c/source/test/perf/ustrperf/stringperf.cpp
icu4c/source/test/perf/ustrperf/stringperf.h
icu4c/source/test/perf/utfperf/utfperf.cpp
icu4c/source/test/perf/utrie2perf/utrie2perf.cpp
icu4c/source/test/thaitest/thaitest.cpp
icu4c/source/tools/ctestfw/datamap.cpp
icu4c/source/tools/ctestfw/testdata.cpp
icu4c/source/tools/ctestfw/tstdtmod.cpp
icu4c/source/tools/ctestfw/unicode/testdata.h
icu4c/source/tools/ctestfw/unicode/tstdtmod.h
icu4c/source/tools/ctestfw/unicode/uperf.h
icu4c/source/tools/ctestfw/unicode/utimer.h
icu4c/source/tools/ctestfw/uperf.cpp
icu4c/source/tools/genbrk/genbrk.cpp
icu4c/source/tools/gencfu/gencfu.cpp
icu4c/source/tools/gencolusb/extract_unsafe_backwards.cpp
icu4c/source/tools/gencolusb/verify_uset.cpp
icu4c/source/tools/gendict/gendict.cpp
icu4c/source/tools/gennorm2/extradata.cpp
icu4c/source/tools/gennorm2/gennorm2.cpp
icu4c/source/tools/gennorm2/n2builder.cpp
icu4c/source/tools/genrb/derb.cpp
icu4c/source/tools/genrb/genrb.cpp
icu4c/source/tools/genrb/parse.cpp
icu4c/source/tools/genrb/prscmnts.cpp
icu4c/source/tools/genrb/reslist.cpp
icu4c/source/tools/genrb/reslist.h
icu4c/source/tools/genrb/wrtjava.cpp
icu4c/source/tools/genrb/wrtxml.cpp
icu4c/source/tools/icuexportdata/icuexportdata.cpp
icu4c/source/tools/icuinfo/icuinfo.cpp
icu4c/source/tools/icupkg/icupkg.cpp
icu4c/source/tools/icuswap/icuswap.cpp
icu4c/source/tools/makeconv/genmbcs.cpp
icu4c/source/tools/makeconv/makeconv.cpp
icu4c/source/tools/pkgdata/pkgdata.cpp
icu4c/source/tools/pkgdata/pkgtypes.h
icu4c/source/tools/toolutil/dbgutil.cpp
icu4c/source/tools/toolutil/filestrm.cpp
icu4c/source/tools/toolutil/filetools.cpp
icu4c/source/tools/toolutil/flagparser.cpp
icu4c/source/tools/toolutil/package.cpp
icu4c/source/tools/toolutil/pkg_genc.cpp
icu4c/source/tools/toolutil/pkg_gencmn.cpp
icu4c/source/tools/toolutil/pkg_icu.cpp
icu4c/source/tools/toolutil/pkgitems.cpp
icu4c/source/tools/toolutil/ppucd.cpp
icu4c/source/tools/toolutil/ppucd.h
icu4c/source/tools/toolutil/swapimpl.cpp
icu4c/source/tools/toolutil/toolutil.cpp
icu4c/source/tools/toolutil/ucbuf.cpp
icu4c/source/tools/toolutil/ucm.cpp
icu4c/source/tools/toolutil/ucmstate.cpp
icu4c/source/tools/toolutil/udbgutil.cpp
icu4c/source/tools/toolutil/unewdata.cpp
icu4c/source/tools/toolutil/uoptions.cpp
icu4c/source/tools/toolutil/uparse.cpp
icu4c/source/tools/toolutil/writesrc.cpp
icu4c/source/tools/toolutil/xmlparser.cpp
icu4c/source/tools/toolutil/xmlparser.h
icu4c/source/tools/tzcode/icuzdump.cpp
icu4c/source/tools/tzcode/tz2icu.cpp
tools/colprobe/colprobe.cpp
tools/colprobe/colprobeNew.cpp
tools/colprobe/line.cpp
tools/colprobe/sortedlines.cpp
tools/colprobe/uprinter.cpp
tools/multi/proj/chello/uprint.cpp
tools/multi/proj/icu4cscan/testxml.cpp
tools/multi/proj/icu4cscan/xmlout.cpp
tools/multi/proj/icu4cscan/xmlout.h
tools/multi/proj/provider/caldiff.cpp
tools/multi/proj/provider/colldiff.cpp
tools/multi/proj/provider/datediff.cpp
tools/multi/proj/provider/glue/cal_fe.cpp
tools/multi/proj/provider/glue/coll_fe.cpp
tools/multi/proj/provider/glue/date_fe.cpp
tools/multi/proj/provider/glue/include/icuglue/fe_verlist.h
tools/unicode/c/genprops/bidipropsbuilder.cpp
tools/unicode/c/genprops/casepropsbuilder.cpp
tools/unicode/c/genprops/corepropsbuilder.cpp
tools/unicode/c/genprops/genprops.cpp
tools/unicode/c/genprops/layoutpropsbuilder.cpp
tools/unicode/c/genprops/namespropsbuilder.cpp
tools/unicode/c/genprops/pnamesbuilder.cpp
tools/unicode/c/genuca/collationbasedatabuilder.cpp
tools/unicode/c/genuca/genuca.cpp
tools/unicode/c/genuts46/genuts46.cpp

index f9b20180eb7817f847ae08af3fc07c8a4647e228..8a14c1e9d9a93c1034b495fdb3ba1c1829f661c2 100644 (file)
@@ -63,7 +63,7 @@ Appendable::getAppendBuffer(int32_t minCapacity,
                             int32_t *resultCapacity) {
     if(minCapacity<1 || scratchCapacity<minCapacity) {
         *resultCapacity=0;
-        return NULL;
+        return nullptr;
     }
     *resultCapacity=scratchCapacity;
     return scratch;
index c14f206dfe43c846f7cf1d9563368fcfa86c2cc0..bd870cd3b2f4b05e344d8f7f829220955a0b7ab3 100644 (file)
@@ -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) {
index c272cc40221f8cf95abaf339e6cfc15a32f33c81..532ea9e9c0a98fcc7eab6f1d43bdc59cbc45c197 100644 (file)
@@ -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) {
index ac7d3d867e5f776a369472c2d288db36d52ae49c..a61cccf8486cc4415ebe8798e195d98abe69c854 100644 (file)
@@ -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;
     }
 }
@@ -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;
         }
index eacb7eedb0d6bd297a4682b75d0ebbea8be87300..65f54be48ae8abdb4c98b8208df2999d122e192b 100644 (file)
@@ -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;
     }
index 81f17265fbbbb7115d14c9187da67ac52d439af5..4a733f9d816c84a0976b00d8171b218770a01692 100644 (file)
@@ -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;
             }
@@ -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);
     }
@@ -432,7 +432,7 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
 Hashtable *CanonicalIterator::getEquivalents2(Hashtable *fillinResult, const UChar *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;
 }
@@ -503,7 +503,7 @@ Hashtable *CanonicalIterator::extract(Hashtable *fillinResult, UChar32 comp, con
     //if (PROGRESS) printf("%s, %i\n", UToS(Tr(segment)), segmentPos);
 
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     UnicodeString temp(comp);
@@ -511,11 +511,11 @@ 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();
     int32_t decompLen=decompString.length();
@@ -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);
index 8a0994c73742ee2d3044763cf38d9ca0aceb1e02..e6dab6317163f10f32a227402c49b112206bf896 100644 (file)
@@ -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,7 +193,7 @@ char *CharString::getAppendBuffer(int32_t minCapacity,
         return buffer.getAlias()+len;
     }
     resultCapacity=0;
-    return NULL;
+    return nullptr;
 }
 
 CharString &CharString::appendInvariantChars(const UnicodeString &s, UErrorCode &errorCode) {
@@ -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;
index 64f5034921fe64d823e8a15974c66b3f48d1b80e..57e9c48be6d0f240196ca3d5d72e4e297e29632a 100644 (file)
@@ -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;
     }
@@ -130,9 +130,9 @@ u_setMemoryFunctions(const void *context, UMemAllocFn *a, UMemReallocFn *r, UMem
 
 
 U_CFUNC UBool cmemory_cleanup(void) {
-    pContext   = NULL;
-    pAlloc     = NULL;
-    pRealloc   = NULL;
-    pFree      = NULL;
+    pContext   = nullptr;
+    pAlloc     = nullptr;
+    pRealloc   = nullptr;
+    pFree      = nullptr;
     return true;
 }
index f03b7dcce6b9abb82eee296d3310d21c2b3d7ce0..5f7897d8bd20abd4233744fed1376e46bc671d68 100644 (file)
@@ -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;
+        src.ptr=nullptr;
     }
     /**
      * Destructor deletes the memory it owns.
@@ -215,7 +215,7 @@ public:
     LocalMemory<T> &operator=(LocalMemory<T> &&src) U_NOEXCEPT {
         uprv_free(LocalPointerBase<T>::ptr);
         LocalPointerBase<T>::ptr=src.ptr;
-        src.ptr=NULL;
+        src.ptr=nullptr;
         return *this;
     }
     /**
@@ -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;
     }
 }
 
@@ -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;
         }
@@ -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));
     }
@@ -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));
     }
index 24654f8fc228970ece88cecb9217ace57a5431f4..b87597e4504b03342a4714a2344e2d701fa76d79 100644 (file)
@@ -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)) {
index 06275c4b5643a23a8842f33134e9ce10100347dd..e95816c130160d8f358c9a1441925bf7cab98f3a 100644 (file)
@@ -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;
 
index 6e2dbee5b618be3d292a2a0a5bc8677aeadf75ba..de987e02e250d9522a495556127785be79abc396 100644 (file)
@@ -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 && 
index e75716f54b9fe1238438adca89c134ec865d59d2..3c63515aa667336e948d03ab72b98c8aba6bb36c 100644 (file)
@@ -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,
index 21d7c3f0061063c23d092ca185a248acfe9d3a67..8bceb53200b6a301cc5f16f3181a1ce666c6bf3c 100644 (file)
@@ -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;
     }
index ebe8f8a262eafa77c5c057ce228c70f51decb051..7647320099f8b5ef40e7601b73830f6518b67059 100644 (file)
@@ -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);
index 63f01206e9784de04f889b2524f2449a4d028960..5eafcb6d78f64ef361ef9e4a055ad4f9727c8532 100644 (file)
@@ -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;
index c9afeaf562e186d9051ae12a59955184f72889b2..01471a8f29f409d618330c24e64d233f37c0284d 100644 (file)
@@ -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);
     }
 }
index d31441137416bee05697ce56a81d96425e019d5b..809d080512f4802aa01d7b5b7a0860c04a46e69e 100644 (file)
 #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);
         }
index 72b5d27175584181a605175b4c2b8683f8e7ce22..bde83f7e25c47ffee9f883aaae075177ab08e9ba 100644 (file)
@@ -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);
 
@@ -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;
index 24ff629f84f6f797be6e7f75f28889a6c270c61c..768564edc890952065746e143a7912c14464dab9 100644 (file)
@@ -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
index cf341e1f74c8b97f9208bc235ed614130872bc22..374f1a3b8e7482c3a5986a736f77acdb181a0a1a 100644 (file)
@@ -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 {};
 
@@ -49,7 +49,7 @@ static UBool U_CALLCONV locale_available_cleanup(void)
 
     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) {
@@ -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);
 }
index ff378b4cc78f1d171131ab80386dcaa2b94759fe..adcf2f843c0b2636e4fc1e965e33a3871a1372a3 100644 (file)
@@ -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;
     }
 }
 
index 637556cc71db722e4bae220d4f16dac7640aa9e0..38ca475e997b685c6a624630046933b56b738d87 100644 (file)
@@ -304,10 +304,10 @@ _getStringOrCopyKey(const char *path, const char *locale,
                     const char *substitute,
                     UChar *dest, int32_t destCapacity,
                     UErrorCode *pErrorCode) {
-    const UChar *s = NULL;
+    const UChar *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 {
@@ -369,14 +369,14 @@ _getDisplayNameForComponent(const char *locale,
     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);
@@ -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);
@@ -559,7 +559,7 @@ uloc_getDisplayName(const char *locale,
     {
         UChar *p0=u_strstr(separator, sub0);
         UChar *p1=u_strstr(separator, sub1);
-        if (p0==NULL || p1==NULL || p1<p0) {
+        if (p0==nullptr || p1==nullptr || p1<p0) {
             *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
             return 0;
         }
@@ -576,7 +576,7 @@ uloc_getDisplayName(const char *locale,
     } else { /* non-default pattern */
         UChar *p0=u_strstr(pattern, sub0);
         UChar *p1=u_strstr(pattern, sub1);
-        if (p0==NULL || p1==NULL) {
+        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 )
@@ -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 {
@@ -793,19 +793,19 @@ uloc_getDisplayKeyword(const char* keyword,
                        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,
@@ -826,11 +826,11 @@ uloc_getDisplayKeywordValue(   const char* locale,
 
 
     /* 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 UChar *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);
index 401f1fecbff1c0a63bbf48b19a7acd99c885a5c8..87aa19b16b8a2473bca5057a4cffcb9352979544 100644 (file)
@@ -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;
   }
 }
 
@@ -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)
 {
@@ -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) {
@@ -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) {
@@ -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
@@ -1001,7 +1001,7 @@ uldn_localeDisplayName(const ULocaleDisplayNames *ldn,
   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;
   }
@@ -1023,7 +1023,7 @@ uldn_languageDisplayName(const ULocaleDisplayNames *ldn,
   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;
   }
@@ -1041,7 +1041,7 @@ uldn_scriptDisplayName(const ULocaleDisplayNames *ldn,
   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;
   }
@@ -1068,7 +1068,7 @@ uldn_regionDisplayName(const ULocaleDisplayNames *ldn,
   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;
   }
@@ -1086,7 +1086,7 @@ uldn_variantDisplayName(const ULocaleDisplayNames *ldn,
   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;
   }
@@ -1104,7 +1104,7 @@ uldn_keyDisplayName(const ULocaleDisplayNames *ldn,
   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;
   }
@@ -1123,7 +1123,7 @@ uldn_keyValueDisplayName(const ULocaleDisplayNames *ldn,
   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;
index 5cd083866c701b062b9fcf8b294edbfcf8067b90..26ee525906709a5f98bd7b9e3ac9e2dda6f10f17 100644 (file)
@@ -63,13 +63,13 @@ 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
@@ -120,14 +120,14 @@ static UBool U_CALLCONV locale_cleanup(void)
     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;
         }
@@ -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,7 +402,7 @@ Locale::Locale( const   char * newLanguage,
 }
 
 Locale::Locale(const Locale &other)
-    : UObject(other), fullName(fullNameBuffer), baseName(NULL)
+    : UObject(other), fullName(fullNameBuffer), baseName(nullptr)
 {
     *this = other;
 }
@@ -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);
 }
 
 
@@ -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*/
 }
 
 /*
@@ -2416,11 +2416,11 @@ 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;
index ec0dca28a45a69be7f12efebdc7503029563dc34..7806952af76558bc2965625bdce4f2b6a102e5ac 100644 (file)
@@ -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 UChar* 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;
index 78cfd1ca86b62d89128480e39b8bd6fc9151124c..7a0e90e8bd93b7115bf1ed2777543a6e492d0c0c 100644 (file)
@@ -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;
         }
     }
index d1d9a4729f107be97d8ff493800b5b94eef0f2a1..018c7000404e34394efeff215ee2d1402f03f8a5 100644 (file)
@@ -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 UChar *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 UChar* fallbackLocale =  nullptr;
             *pErrorCode = errorCode;
             errorCode = U_ZERO_ERROR;
 
@@ -164,10 +164,10 @@ _uloc_getOrientationHelper(const char* localeId,
         if (!U_FAILURE(*status)) {
             const UChar* const value =
                 uloc_getTableStringWithFallback(
-                    NULL,
+                    nullptr,
                     localeBuffer,
                     "layout",
-                    NULL,
+                    nullptr,
                     key,
                     &length,
                     status);
index 6e2bd497f81eae58bba440821a025efe76b4991b..690221a003b5bae18a9e1dc19cab164a73a86571 100644 (file)
@@ -22,7 +22,7 @@
 
 // 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)
@@ -39,7 +39,7 @@ U_CDECL_BEGIN
 static UBool U_CALLCONV service_cleanup(void) {
     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
@@ -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 UChar* 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);
             }
         }
     }
index 52afab5f026fa73e911afbc9cc33b55f4195d3c9..dd4f5f8ccc97ede57d0c8400ebabdb700c602d52 100644 (file)
@@ -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;
             }
@@ -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();
     }
 }
@@ -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;
index 584835da57b6be1487a143b45fb5d34eedb02ed4..c07f6b71ae9aa41b60741e8ad8f8e5cf082497e4 100644 (file)
@@ -44,7 +44,7 @@ public:
             return dest;
         }
         const UChar *sArray=src.getBuffer();
-        if(&dest==&src || sArray==NULL) {
+        if(&dest==&src || sArray==nullptr) {
             errorCode=U_ILLEGAL_ARGUMENT_ERROR;
             dest.setToBogus();
             return dest;
@@ -83,7 +83,7 @@ public:
             return first;
         }
         const UChar *secondArray=second.getBuffer();
-        if(&first==&second || secondArray==NULL) {
+        if(&first==&second || secondArray==nullptr) {
             errorCode=U_ILLEGAL_ARGUMENT_ERROR;
             return first;
         }
@@ -111,7 +111,7 @@ public:
         UChar buffer[4];
         int32_t length;
         const UChar *d=impl.getDecomposition(c, buffer, length);
-        if(d==NULL) {
+        if(d==nullptr) {
             return false;
         }
         if(d==buffer) {
@@ -126,7 +126,7 @@ public:
         UChar buffer[30];
         int32_t length;
         const UChar *d=impl.getRawDecomposition(c, buffer, length);
-        if(d==NULL) {
+        if(d==nullptr) {
             return false;
         }
         if(d==buffer) {
@@ -153,7 +153,7 @@ public:
             return false;
         }
         const UChar *sArray=s.getBuffer();
-        if(sArray==NULL) {
+        if(sArray==nullptr) {
             errorCode=U_ILLEGAL_ARGUMENT_ERROR;
             return false;
         }
@@ -170,7 +170,7 @@ public:
             return 0;
         }
         const UChar *sArray=s.getBuffer();
-        if(sArray==NULL) {
+        if(sArray==nullptr) {
             errorCode=U_ILLEGAL_ARGUMENT_ERROR;
             return 0;
         }
@@ -230,7 +230,7 @@ private:
 
     virtual const UChar *
     spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const U_OVERRIDE {
-        return impl.decompose(src, limit, NULL, errorCode);
+        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 {
@@ -289,7 +289,7 @@ private:
             return false;
         }
         const UChar *sArray=s.getBuffer();
-        if(sArray==NULL) {
+        if(sArray==nullptr) {
             errorCode=U_ILLEGAL_ARGUMENT_ERROR;
             return false;
         }
@@ -314,7 +314,7 @@ private:
             return UNORM_MAYBE;
         }
         const UChar *sArray=s.getBuffer();
-        if(sArray==NULL) {
+        if(sArray==nullptr) {
             errorCode=U_ILLEGAL_ARGUMENT_ERROR;
             return UNORM_MAYBE;
         }
@@ -324,7 +324,7 @@ private:
     }
     virtual const UChar *
     spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &) const U_OVERRIDE {
-        return impl.composeQuickCheck(src, limit, onlyContiguous, NULL);
+        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 {
@@ -363,7 +363,7 @@ private:
     }
     virtual const UChar *
     spanQuickCheckYes(const UChar *src, const UChar *limit, UErrorCode &errorCode) const U_OVERRIDE {
-        return impl.makeFCD(src, limit, NULL, errorCode);
+        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 {
index 3617264490e2bed9d7c98b11c8ec76829d38bd59..22e1ed6711b92cb7a8d200b475b2126eba184df9 100644 (file)
@@ -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;
@@ -333,23 +333,23 @@ unorm2_normalize(const UNormalizer2 *norm2,
     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);
@@ -368,27 +368,27 @@ normalizeSecondAndAppend(const UNormalizer2 *norm2,
     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.
@@ -444,7 +444,7 @@ unorm2_getDecomposition(const UNormalizer2 *norm2,
     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;
     }
@@ -463,7 +463,7 @@ unorm2_getRawDecomposition(const UNormalizer2 *norm2,
     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;
     }
@@ -492,7 +492,7 @@ unorm2_isNormalized(const UNormalizer2 *norm2,
     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;
     }
@@ -507,7 +507,7 @@ unorm2_quickCheck(const UNormalizer2 *norm2,
     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;
     }
@@ -522,7 +522,7 @@ unorm2_spanQuickCheckYes(const UNormalizer2 *norm2,
     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;
     }
index d7e05e44d725bce298b22ea6c2272e158aa321eb..f3346e85a4cdc222af4fe516ff3e215fd18e6f3a 100644 (file)
@@ -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;
@@ -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;
@@ -540,7 +540,7 @@ Normalizer2Impl::copyLowPrefixFromNulTerminated(const UChar *src,
     // 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);
         }
     }
@@ -555,7 +555,7 @@ Normalizer2Impl::decompose(const UnicodeString &src, UnicodeString &dest,
         return dest;
     }
     const UChar *sArray=src.getBuffer();
-    if(&dest==&src || sArray==NULL) {
+    if(&dest==&src || sArray==nullptr) {
         errorCode=U_ILLEGAL_ARGUMENT_ERROR;
         dest.setToBogus();
         return dest;
@@ -569,7 +569,7 @@ Normalizer2Impl::decompose(const UChar *src, const UChar *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
+// buffer!=nullptr: normalize
+// buffer==nullptr: isNormalized/spanQuickCheckYes
 const UChar *
 Normalizer2Impl::decompose(const UChar *src, const UChar *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;
@@ -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;
             }
@@ -982,7 +982,7 @@ Normalizer2Impl::getRawDecomposition(UChar32 c, UChar buffer[30], int32_t &lengt
     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);
@@ -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);
     }
 
@@ -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)
         ) {
@@ -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.
@@ -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);
@@ -1442,9 +1442,9 @@ Normalizer2Impl::compose(const UChar *src, const UChar *limit,
                          UErrorCode &errorCode) const {
     const UChar *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;
@@ -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)
+// pQCResult==nullptr: spanQuickCheckYes
+// pQCResult!=nullptr: quickCheck (*pQCResult must be UNORM_YES)
 const UChar *
 Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit,
                                    UBool onlyContiguous,
                                    UNormalizationCheckResult *pQCResult) const {
     const UChar *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)) {
@@ -1821,7 +1821,7 @@ Normalizer2Impl::composeQuickCheck(const UChar *src, const UChar *limit,
                 }
             }
         }
-        if(pQCResult!=NULL) {
+        if(pQCResult!=nullptr) {
             *pQCResult=UNORM_NO;
         }
         return prevBoundary;
@@ -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);
@@ -2267,8 +2267,8 @@ uint16_t Normalizer2Impl::getFCD16FromNormData(UChar32 c) const {
 #endif
 
 // Dual functionality:
-// buffer!=NULL: normalize
-// buffer==NULL: isNormalized/quickCheck/spanQuickCheckYes
+// buffer!=nullptr: normalize
+// buffer==nullptr: isNormalized/quickCheck/spanQuickCheckYes
 const UChar *
 Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
                          ReorderingBuffer *buffer,
@@ -2277,7 +2277,7 @@ Normalizer2Impl::makeFCD(const UChar *src, const UChar *limit,
     // Similar to the prevBoundary in the compose() implementation.
     const UChar *prevBoundary=src;
     int32_t prevFCD16=0;
-    if(limit==NULL) {
+    if(limit==nullptr) {
         src=copyLowPrefixFromNulTerminated(src, minLcccCP, buffer, errorCode);
         if(U_FAILURE(errorCode)) {
             return src;
@@ -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) {
@@ -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 {
             /*
@@ -2436,7 +2436,7 @@ 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);
@@ -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;
     }
 
index 58de61591f8a24ef3919190ecf265a29fae0abea..52b9ffd54a3620d52d13d4dc20f0ebc12e2eaec2 100644 (file)
@@ -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;
     }
index ec87f0198e19eba994432c6524d98880d212ed7d..7e6156de89cb756d877c079aa7f82e0d169d6cf8 100644 (file)
@@ -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];
 }
 
 
index 4988fd2699f385fdc388698cc49e19c82f0d2201..11683599edd8377ce190d8cfdfdd18b1cfdf8f72 100644 (file)
@@ -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;
         }
     }
 };
index 8f0045fdac541a49cbaff91b13699c226556c05a..89ce2ff8f499b5404c8635bb02f5314ed5844024 100644 (file)
@@ -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);
 }
index e5caa4b9d2c46f0f87d2aa4a3ccf9e92ffd31c01..18cc3e8cd8e8c4551b65e0fd9bdc6f94d5c6da2e 100644 (file)
@@ -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;
 }
index f95722da27d1f0142d80c949b6be185a9894bdb7..7e2a870200d69b44c88761a4554be75b877b21bf 100644 (file)
@@ -189,11 +189,11 @@ u_strToPunycode(const UChar *src, int32_t srcLength,
     UChar 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])) {
@@ -380,11 +380,11 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
     UChar 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;
     }
@@ -423,7 +423,7 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
         if(j<destCapacity) {
             dest[j]=(UChar)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;
 
             /*
@@ -555,7 +555,7 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
                 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);
@@ -569,7 +569,7 @@ u_strFromPunycode(const UChar *src, int32_t srcLength,
                 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) {
index be24f003b52a7c1cdedc9737e47c18b6d8f78b0a..3dbecce9534c273aad2c3b37a8378f5e2629fdc9 100644 (file)
@@ -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;
@@ -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 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);
     }
 
@@ -965,16 +965,16 @@ static UBool compareBinaryFiles(const char* defaultTZFileName, const char* TZFil
 #define SKIP1 "."
 #define SKIP2 ".."
 static UBool U_CALLCONV putil_cleanup(void);
-static CharString *gSearchTZFileResult = NULL;
+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)) {
@@ -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,7 +1165,7 @@ 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.
@@ -1177,7 +1177,7 @@ uprv_tzname(int n)
             gTimeZoneBuffer[ret] = 0;
             char *  tzZoneInfoTailPtr = uprv_strstr(gTimeZoneBuffer, TZZONEINFOTAIL);
 
-            if (tzZoneInfoTailPtr != NULL
+            if (tzZoneInfoTailPtr != nullptr
                 && isValidOlsonID(tzZoneInfoTailPtr + tzZoneInfoTailLen))
             {
                 return (gTimeZoneBufferPtr = tzZoneInfoTailPtr + tzZoneInfoTailLen);
@@ -1185,26 +1185,26 @@ uprv_tzname(int n)
         } 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,13 +1261,13 @@ 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
 
@@ -1276,22 +1276,22 @@ static UBool U_CALLCONV putil_cleanup(void)
     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;
             }
         }
@@ -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,7 +1462,7 @@ static void U_CALLCONV dataDirectoryInitFn() {
         path=U_ICU_DATA_DEFAULT_DIR;
 # endif
 # if defined(ICU_DATA_DIR_PREFIX_ENV_VAR)
-        if (prefix != NULL) {
+        if (prefix != nullptr) {
             snprintf(datadir_path_buffer, sizeof(datadir_path_buffer), "%s%s", prefix, path);
             path=datadir_path_buffer;
         }
@@ -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 = "";
     }
@@ -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,18 +1541,18 @@ 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) {
+    if (prefix != nullptr) {
         snprintf(timezonefilesdir_path_buffer, sizeof(timezonefilesdir_path_buffer), "%s%s", prefix, dir);
         dir = timezonefilesdir_path_buffer;
     }
@@ -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))
@@ -1649,7 +1649,7 @@ static const char *uprv_getPOSIXIDForCategory(int category)
  */
 static const char *uprv_getPOSIXIDForDefaultLocale(void)
 {
-    static const char* posixID = NULL;
+    static const char* posixID = nullptr;
     if (posixID == 0) {
         posixID = uprv_getPOSIXIDForCategory(LC_MESSAGES);
     }
@@ -1662,7 +1662,7 @@ static const char *uprv_getPOSIXIDForDefaultLocale(void)
  */
 static const char *uprv_getPOSIXIDForDefaultCodepage(void)
 {
-    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);
@@ -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;
 
@@ -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) {
@@ -2270,7 +2270,7 @@ u_versionFromString(UVersionInfo versionArray, const char *versionString) {
 
 U_CAPI void U_EXPORT2
 u_versionFromUString(UVersionInfo versionArray, const UChar *versionString) {
-    if(versionArray!=NULL && versionString!=NULL) {
+    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
index 8591a625f9594dd88c2de5b3962d6e6525434290..0bec7bd916d9550bebb6be351d46c8145a767c94 100644 (file)
@@ -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);
     }
 }
@@ -380,14 +380,14 @@ void ResourceBundle::getVersion(UVersionInfo versionInfo) const {
 const Locale &ResourceBundle::getLocale(void) 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
index 45c0b399bfff459598d71c15bf491e9df3649d16..9c752e194a66355ad87e54732032a42abe483b63 100644 (file)
@@ -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,7 +45,7 @@ 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);
index 1483f7d6bcc6a5de87aa216a304b4823d687ff3b..3ac7c3dc61a2d12912ab70617f6992c0200167b0 100644 (file)
@@ -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,
index 9d8c04149ce1599daf69b31737883c60c50565ea..22262e06f6a1c1657d9e2f0cc01c3a2917e9c3e7 100644 (file)
@@ -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,7 +556,7 @@ outerEnd:
                 }
             }
 
-            if (actualReturn != NULL) {
+            if (actualReturn != nullptr) {
                 // strip null prefix
                 if (result->actualDescriptor.indexOf((UChar)0x2f) == 0) { // U+002f=slash (/)
                     actualReturn->remove();
@@ -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,23 +919,23 @@ 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 
@@ -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
index 3bd3d9a9b9ea61f632e1d00d060152c7ceeb6d50..65f05053922fe296dc7ea63a6dcb180abf5134b3 100644 (file)
@@ -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,
@@ -841,7 +841,7 @@ class U_COMMON_API ICUService : public ICUNotifier {
     virtual UBool isDefault(void) 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;
 
@@ -901,12 +901,12 @@ class U_COMMON_API ICUService : public ICUNotifier {
      * <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;
 
index 702180665952b406a4bb32910c6e003437d4507c..c9c8c3dcccb1d2a3ca5823696e8918d9d6742999 100644 (file)
@@ -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;
         }
     }
index 7ccb0c72aa67fef363948bc816affcc5105e8950..c4baed2df7cf6c5ba0526cd3751b1ae258d25841 100644 (file)
@@ -54,7 +54,7 @@ LocaleKeyFactory::create(const ICUServiceKey& key, const ICUService* service, UE
 
         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
index 29c50a27d1a245acc678b1b2e8d29ade1612d955..554f9959364babed3d88d1514dd2617351659af1 100644 (file)
@@ -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;
 
index 19481122efa52e1f505704537782808319ab4a07..7b1db42034cb0a5ee1277fccb594648c6cf37e30 100644 (file)
@@ -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 {
index d9fb38875202dfa33624000f477c3621dd1fb4f1..5db65edf78dce254a363e9d012680451fc184455 100644 (file)
@@ -24,7 +24,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(EventListener)
 static UMutex notifyLock;
 
 ICUNotifier::ICUNotifier(void) 
-: listeners(NULL
+: listeners(nullptr
 {
 }
 
@@ -32,7 +32,7 @@ ICUNotifier::~ICUNotifier(void) {
     {
         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;
                     }
@@ -107,7 +107,7 @@ void
 ICUNotifier::notifyChanged(void) 
 {
     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);
index 94279ab3a1513b03c69ecf4a65d37c572dfd421a..68583ef1fbb9a6b8b0f220392ef1adba69f38978 100644 (file)
@@ -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
index 09154d1b9198e7f9924b8680fe1933a8fe98a24c..9966dac0ce95d813ea48a1c5f3e6de0390d0ba9b 100644 (file)
@@ -57,7 +57,7 @@ SimpleLocaleKeyFactory::SimpleLocaleKeyFactory(UObject* objToAdopt,
 SimpleLocaleKeyFactory::~SimpleLocaleKeyFactory()
 {
   delete _obj;
-  _obj = NULL;
+  _obj = nullptr;
 }
 
 UObject*
@@ -73,7 +73,7 @@ SimpleLocaleKeyFactory::create(const ICUServiceKey& key, const ICUService* servi
             }
         }
     }
-    return NULL;
+    return nullptr;
 }
 
 //UBool
index 6298662bbaff0e7d54229195fe93d8913e316f4e..5532ec48d88628e065a0103a35ec10d34323c411 100644 (file)
@@ -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;
         }
     }
 
index 01d3024cfc34dcd06d4214e048244bf6aa81abb0..b2ed2eb67d1f0a17d88f39ca9c534e31197427a7 100644 (file)
@@ -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
@@ -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);
 }
 
@@ -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;
             }
index 99089e08ef90f1a3289dfe600de0c19c3bf8189f..eb9766c01803d603a9a4332d447f20a63273c1c0 100644 (file)
@@ -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;
index e6670d1cb7155306b7d76b7f305b93a7d2d9d411..bdd8b17695057e963da409b46ffca39c9b0da152 100644 (file)
@@ -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
@@ -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,7 +260,7 @@ 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];
     Node *lessThan[kMaxSplitBranchLevels];
@@ -278,12 +278,12 @@ 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;
@@ -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;
 }
@@ -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;
index 17b6964ffe031660cdaf713a1c59ad94a6d638ef..f9daa4b30ff766b7699bdc1b99fd0a8034887b96 100644 (file)
@@ -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;
     }
index eb40a212e17e9e4296cfc8d8ecf8672b3a44cc75..c1de0201b76b015f8e5a69e0a344a5e9e212fd85 100644 (file)
@@ -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;
@@ -301,7 +301,7 @@ ubidi_isInverse(UBiDi *pBiDi) {
  */
 U_CAPI void U_EXPORT2
 ubidi_setReorderingMode(UBiDi *pBiDi, UBiDiReorderingMode reorderingMode) {
-    if ((pBiDi!=NULL) && (reorderingMode >= UBIDI_REORDER_DEFAULT)
+    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;
@@ -344,7 +344,7 @@ int32_t length){
     UChar32 uchar;
     UCharDirection dir;
 
-    if( text==NULL || length<-1 ){
+    if( text==nullptr || length<-1 ){
         return UBIDI_NEUTRAL;
     }
 
@@ -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;
@@ -2331,8 +2331,8 @@ ubidi_setContext(UBiDi *pBiDi,
                  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;
     }
@@ -2364,7 +2364,7 @@ setParaSuccess(UBiDi *pBiDi) {
 static void
 setParaRunsOnly(UBiDi *pBiDi, const UChar *text, int32_t length,
                 UBiDiLevel paraLevel, UErrorCode *pErrorCode) {
-    int32_t *runsOnlyMemory = NULL;
+    int32_t *runsOnlyMemory = nullptr;
     int32_t *visualMap;
     UChar *visualText;
     int32_t saveLength, saveTrailingWSStart;
@@ -2381,12 +2381,12 @@ 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) {
+    if(runsOnlyMemory==nullptr) {
         *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
         goto cleanup3;
     }
@@ -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)) {
@@ -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;
@@ -2884,7 +2884,7 @@ 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);
index 3ba58f7af99cc77a8b6bb2f2ab3389818e900eee..8f3f6a65c4b399ae59a87497bd984bc64de24183 100644 (file)
@@ -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];
index 01fcc968cb874053c3aa52bf5902de1f8e33d456..5dcd1d7c781629af76371e6972defdf69f3a0706 100644 (file)
@@ -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 }
 };
index 430ece39d28e3a922d316f6b28bb23af0a5e70c8..7ad94498fcbc760eb39302ad9691b0728a01ece3 100644 (file)
@@ -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;
@@ -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;
     }
 
@@ -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[] */
@@ -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;
     }
@@ -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 */
index 24fffd9c460c054cf73e9692efc6e3303dbabbb1..fe190391bb741bf0ad06da045ab9f77522c0d669 100644 (file)
@@ -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;
 }
 
@@ -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) {
+        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);
@@ -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,7 +431,7 @@ findMatchingScheme(UBiDiLevel inLevel, UBiDiLevel outLevel,
             return pScheme;
         }
     }
-    return NULL;
+    return nullptr;
 }
 
 U_CAPI uint32_t U_EXPORT2
@@ -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;
     }
index a69c0a4b8b16f8f309b503b204cd108ce6cb9c23..ba30d46156ca5a222107fd7081b9ee7209fa1d2b 100644 (file)
@@ -312,20 +312,20 @@ ubidi_writeReverse(const UChar *src, int32_t srcLength,
                    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)))
     {
@@ -363,21 +363,21 @@ ubidi_writeReordered(UBiDi *pBiDi,
     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;
@@ -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;
@@ -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;
index 3d1750265b157ebddb8050ce00830161608bd1ca..e73b096bc590b6441cd433acef6934c078ff9070 100644 (file)
@@ -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 */
 
@@ -279,7 +279,7 @@ ucase_addCaseClosure(UChar32 c, const USetAdder *sa) {
             closure=(const UChar *)pe+1; /* behind this slot, unless there are full case mappings */
         } else {
             closureLength=0;
-            closure=NULL;
+            closure=nullptr;
         }
 
         /* add the full case folding */
@@ -353,7 +353,7 @@ U_CFUNC UBool U_EXPORT2
 ucase_addStringCaseClosure(const UChar *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) {
@@ -708,7 +708,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 +721,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 +904,7 @@ static UBool
 isFollowedByCasedLetter(UCaseContextIterator *iter, void *context, int8_t dir) {
     UChar32 c;
 
-    if(iter==NULL) {
+    if(iter==nullptr) {
         return false;
     }
 
@@ -929,7 +929,7 @@ isPrecededBySoftDotted(UCaseContextIterator *iter, void *context) {
     int32_t dotType;
     int8_t dir;
 
-    if(iter==NULL) {
+    if(iter==nullptr) {
         return false;
     }
 
@@ -986,7 +986,7 @@ isPrecededBy_I(UCaseContextIterator *iter, void *context) {
     int32_t dotType;
     int8_t dir;
 
-    if(iter==NULL) {
+    if(iter==nullptr) {
         return false;
     }
 
@@ -1010,7 +1010,7 @@ isFollowedByMoreAbove(UCaseContextIterator *iter, void *context) {
     int32_t dotType;
     int8_t dir;
 
-    if(iter==NULL) {
+    if(iter==nullptr) {
         return false;
     }
 
@@ -1033,7 +1033,7 @@ isFollowedByDotAbove(UCaseContextIterator *iter, void *context) {
     int32_t dotType;
     int8_t dir;
 
-    if(iter==NULL) {
+    if(iter==nullptr) {
         return false;
     }
 
@@ -1589,17 +1589,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;
     }
index b7797d14d73746cb782a56077d79fc1a8df6c7e5..7e6de63fb7135b3fc81787409b9ad6d14a105f44 100644 (file)
@@ -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 }
 };
index fc0439db0f69a26587d126766bd1b1b33ce500fd..1eb049e2b2b0f4829a8d3b6776eec9524a698c19 100644 (file)
@@ -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;
@@ -143,7 +143,7 @@ appendResult(int32_t cpLength, int32_t result, const UChar *s,
     /* 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) {
@@ -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?
@@ -784,7 +784,7 @@ void toUpper(uint32_t options,
             }
         } else if(c>=0) {
             const UChar *s;
-            c=ucase_toFullUpper(c, NULL, NULL, &s, UCASE_LOC_GREEK);
+            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
index c21dfb7698a8adfd2b80c69ac05291b28bb96c93..c2b44a2c7887f617efb513bdb25236dc6f859946 100644 (file)
@@ -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;
 }
index dac56eeb5ce48299c9a51a14dc67598fbf1234e0..a5d2e296d5f7127d0d97f48aef434824b5eca57f 100644 (file)
@@ -43,7 +43,7 @@ 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
@@ -54,7 +54,7 @@ u_catgets(u_nl_catd catd, int32_t set_num, int32_t msg_num,
     char key[MAX_KEY_LEN];
     const UChar* 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;
index 49564069b718b1049dcde546a05b7f400a87b497..d6f3321ddfe1456532977a4acb645de9857c3f32 100644 (file)
@@ -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;
     }
 
@@ -485,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);
     }
 }
@@ -522,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);
@@ -532,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) {
@@ -579,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;
     }
@@ -642,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 */
 
@@ -704,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);
 }
index acbeadd249b1b6568a9818ee636847aa5630893f..f4d3932574d22060ac7570fddd38775558b1124f 100644 (file)
@@ -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]={
index 24ab42577791a7d40f69b9fdfc3abd3b206ddd95..e9aead4895deb8137171e109a06b2f6cf2eb5b72 100644 (file)
@@ -31,7 +31,7 @@ UCharsTrie::~UCharsTrie() {
 UStringTrieResult
 UCharsTrie::current() const {
     const UChar *pos=pos_;
-    if(pos==NULL) {
+    if(pos==nullptr) {
         return USTRINGTRIE_NO_MATCH;
     } else {
         int32_t node;
@@ -154,7 +154,7 @@ UCharsTrie::nextImpl(const UChar *pos, int32_t uchar) {
 UStringTrieResult
 UCharsTrie::next(int32_t uchar) {
     const UChar *pos=pos_;
-    if(pos==NULL) {
+    if(pos==nullptr) {
         return USTRINGTRIE_NO_MATCH;
     }
     int32_t length=remainingMatchLength_;  // Actual remaining match length minus 1.
@@ -182,7 +182,7 @@ UCharsTrie::next(ConstChar16Ptr ptr, int32_t sLength) {
         return current();
     }
     const UChar *pos=pos_;
-    if(pos==NULL) {
+    if(pos==nullptr) {
         return USTRINGTRIE_NO_MATCH;
     }
     int32_t length=remainingMatchLength_;  // Actual remaining match length minus 1.
@@ -287,8 +287,8 @@ UCharsTrie::findUniqueValueFromBranch(const UChar *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;
         }
@@ -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;
@@ -366,7 +366,7 @@ UCharsTrie::findUniqueValue(const UChar *pos, UBool haveUniqueValue, int32_t &un
 int32_t
 UCharsTrie::getNextUChars(Appendable &out) const {
     const UChar *pos=pos_;
-    if(pos==NULL) {
+    if(pos==nullptr) {
         return 0;
     }
     if(remainingMatchLength_>=0) {
index be3260941ee91117c9f6d3ea2d942fe1856d51a7..3c6c14f75a2983313df344b930065ed5a5999166 100644 (file)
@@ -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;
     }
@@ -213,7 +213,7 @@ UCharsTrieBuilder::buildUChars(UStringTrieBuildOption buildOption, UErrorCode &e
     if(ucharsCapacity<capacity) {
         uprv_free(uchars);
         uchars=static_cast<UChar *>(uprv_malloc(capacity*2));
-        if(uchars==NULL) {
+        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;
     }
 }
@@ -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) {
@@ -330,10 +330,10 @@ UCharsTrieBuilder::ensureCapacity(int32_t length) {
             newCapacity*=2;
         } while(newCapacity<=length);
         UChar *newUChars=static_cast<UChar *>(uprv_malloc(newCapacity*2));
-        if(newUChars==NULL) {
+        if(newUChars==nullptr) {
             // unable to allocate memory
             uprv_free(uchars);
-            uchars=NULL;
+            uchars=nullptr;
             ucharsCapacity=0;
             return false;
         }
index 2ba43692ddd011a0a4800cf8c930c7934c53a295..767157ca74f62ab012b07ba74d19e170c08ad16b 100644 (file)
@@ -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,7 +95,7 @@ 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) {
@@ -103,7 +103,7 @@ UCharsTrie::Iterator::next(UErrorCode &errorCode) {
         return false;
     }
     const UChar *pos=pos_;
-    if(pos==NULL) {
+    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 {
@@ -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;
     }
index ea797d134492c9753808e2249ffbd69234a77eb5..9e7f7b1f9b5dce71ca4cd15bf8968db5a2edbf13 100644 (file)
@@ -40,8 +40,8 @@ U_CAPI void U_EXPORT2
 u_cleanup(void)
 {
     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;
     }
 }
 
@@ -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))
index 4215d66257d1c74780b233e6847e9d898006858a..69575d4e830a16d2a12eb5742b8708b8aa1c6218 100644 (file)
@@ -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 &&
index 26baa550c35e062716031c425bab930ef3366ac0..e913dead520fd0f35717983ad77e0651907e1d1b 100644 (file)
@@ -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;
 }
 
@@ -96,14 +96,14 @@ ucnv_openU (const UChar * name,
 {
     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
@@ -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)
@@ -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)
@@ -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;
@@ -1185,11 +1185,11 @@ ucnv_fromUnicode(UConverter *cnv,
     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;
     }
@@ -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);
@@ -1576,10 +1576,10 @@ ucnv_outputOverflowToUnicode(UConverter *cnv,
     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;
@@ -1631,11 +1631,11 @@ ucnv_toUnicode(UConverter *cnv,
     UChar *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;
     }
@@ -1730,13 +1730,13 @@ ucnv_fromUChars(UConverter *cnv,
     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;
@@ -1786,13 +1786,13 @@ ucnv_toUChars(UConverter *cnv,
     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;
@@ -1847,11 +1847,11 @@ ucnv_getNextUChar(UConverter *cnv,
     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;
     }
@@ -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) {
@@ -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;
@@ -2104,15 +2104,15 @@ ucnv_convertEx(UConverter *targetCnv, UConverter *sourceCnv,
         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
@@ -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;
@@ -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;
@@ -2620,11 +2620,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 +2637,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,7 +2655,7 @@ static const UAmbiguousConverter *ucnv_getAmbiguous(const UConverter *cnv)
         }
     }
 
-    return NULL;
+    return nullptr;
 }
 
 U_CAPI void  U_EXPORT2
@@ -2666,7 +2666,7 @@ ucnv_fixFileSeparator(const UConverter *cnv,
     int32_t i;
     UChar 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 +2681,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 +2702,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;
@@ -2728,11 +2728,11 @@ ucnv_getInvalidUChars (const UConverter * converter,
                        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 +2763,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 +2836,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 +2864,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 +2888,7 @@ ucnv_isFixedWidth(UConverter *cnv, UErrorCode *status){
         return false;
     }
 
-    if (cnv == NULL) {
+    if (cnv == nullptr) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return false;
     }
index ec096780e971078a2628955a2a031c1a12859e77..b6c648586d80705a13f0d48ea9e8e53b94d7d888 100644 (file)
@@ -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);
     }
 
@@ -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;
         }
@@ -2624,7 +2624,7 @@ 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;
@@ -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),
@@ -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),
@@ -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),
@@ -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),
index a0fbfe2d7f58a1d5a2f9a93e6a58c3bb550bf36a..df1dfb11f94685f0f0fdbc4941995f7c96afcb0b 100644 (file)
@@ -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();
 }
@@ -243,22 +243,22 @@ ucnv_flushAvailableConverterCache() {
 /*                Not supported API.                                          */
 static UBool U_CALLCONV ucnv_cleanup(void) {
     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
@@ -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;
     }
 
@@ -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)) {
index 7bfde828704576d586af36b62d8c24b0a1fb71a3..afd1e5eae517a58d7025a340367822be03323a46 100644 (file)
@@ -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);
 
@@ -205,7 +205,7 @@ ucnv_cbFromUWriteSub (UConverterFromUnicodeArgs *args,
         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) {
index ea71acf92c7ae74dcc2d4052e50becc1dfa5847a..93b096b437f2841e5b9e8042c6629960692f55fb 100644 (file)
@@ -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 {
@@ -102,7 +102,7 @@ ucnv_toUWriteUChars(UConverter *cnv,
     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 {
@@ -157,7 +157,7 @@ ucnv_toUWriteCodePoint(UConverter *cnv,
         }
 
         /* 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;
index c12e982b88b27ff11f246c53f81f0ec4ae51645f..3cb333dc72559b074ba56d2873f12c2591de731f 100644 (file)
@@ -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;
     }
 }
 
@@ -474,7 +474,7 @@ UConverter_toUnicode_CompoundText_OFFSETS(UConverterToUnicodeArgs *args,
     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 = {
index 4210673ef9316fce8bd488efe01c3aff1114589f..4201f3395dae84fe4d923e3204b3272bdcf861a5 100644 (file)
@@ -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;
         }
@@ -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);
@@ -210,12 +210,12 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
   int32_t valueStringLength = 0;
   int32_t i = 0;
 
-  const UChar *myValueSource = NULL;
+  const UChar *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,7 +243,7 @@ UCNV_FROM_U_CALLBACK_ESCAPE (
     *err = err2;
     return;
   } 
-  if(context==NULL)
+  if(context==nullptr)
   { 
       while (i < length)
       {
@@ -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);
@@ -426,7 +426,7 @@ UCNV_TO_U_CALLBACK_ESCAPE (
         return;
     }
 
-    if(context==NULL)
+    if(context==nullptr)
     {    
         while (i < length)
         {
index ffc3c93033a29c1b2dbfeadd78fac13f8dce0fe5..558bdce1e34a6ce91d463c1333181e983e1d8b4d 100644 (file)
@@ -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 */
     }
 
@@ -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) {
@@ -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
@@ -544,7 +544,7 @@ ucnv_extMatchFromU(const int32_t *cx,
     int32_t i, j, idx, length, matchLength;
     UChar c;
 
-    if(cx==NULL) {
+    if(cx==nullptr) {
         return 0; /* no extension data, no match */
     }
 
@@ -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);
@@ -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) {
@@ -1044,7 +1044,7 @@ ucnv_extGetUnicodeSet(const UConverterSharedData *sharedData,
     int32_t length;
 
     cx=sharedData->mbcs.extIndexes;
-    if(cx==NULL) {
+    if(cx==nullptr) {
         return;
     }
 
index c9d20cb941ba198a841ab35cf0d09bceb09b844d..5cabcbd53130cf7f052dc8e6e7c89cd1aa8ba680 100644 (file)
@@ -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 {
@@ -220,7 +220,7 @@ static UBool U_CALLCONV ucnv_io_cleanup(void)
 {
     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
@@ -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;
index 78b8e407006a1fd1282d67de7eb9ec67328a0978..03af75f032ff0bc16c35e3458fa517901d1c1302 100644 (file)
@@ -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",
@@ -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]);
         }
     }
@@ -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;
@@ -1267,7 +1267,7 @@ _LMBCSToUnicodeWithOffsets(UConverterToUnicodeArgs*    args,
    UChar 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 */
index 926cee0de810ea36848ba68ef22980fdf5e16ca6..872d8bc0662650d8e7117963858e62cd9015c741 100644 (file)
@@ -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,
index bebdede4c440ca6b25e369459f5bae8051963353..6e0b95c4809a8484ddf3ba6bb14c9c93dc0851b0 100644 (file)
@@ -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)) {
@@ -310,7 +310,7 @@ _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
                 if(U16_IS_SINGLE(c)) {
                     /* output the BMP code point */
                     *target++=c;
-                    if(offsets!=NULL) {
+                    if(offsets!=nullptr) {
                         *offsets++=-1;
                     }
                     --targetCapacity;
@@ -332,7 +332,7 @@ _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
                     *target++=c;
                     if(targetCapacity>=2) {
                         *target++=trail;
-                        if(offsets!=NULL) {
+                        if(offsets!=nullptr) {
                             *offsets++=-1;
                             *offsets++=-1;
                         }
@@ -384,7 +384,7 @@ _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
         length-=count;
         count>>=1;
         targetCapacity-=count;
-        if(offsets==NULL) {
+        if(offsets==nullptr) {
             do {
                 c=((UChar)source[0]<<8)|source[1];
                 source+=2;
@@ -452,7 +452,7 @@ _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
                     source+=2;
                     length-=2;
                     *target++=c;
-                    if(offsets!=NULL) {
+                    if(offsets!=nullptr) {
                         *offsets++=sourceIndex;
                     }
                     cnv->UCharErrorBuffer[0]=trail;
@@ -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={
@@ -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)) {
@@ -911,7 +911,7 @@ _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
                 if(U16_IS_SINGLE(c)) {
                     /* output the BMP code point */
                     *target++=c;
-                    if(offsets!=NULL) {
+                    if(offsets!=nullptr) {
                         *offsets++=-1;
                     }
                     --targetCapacity;
@@ -933,7 +933,7 @@ _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
                     *target++=c;
                     if(targetCapacity>=2) {
                         *target++=trail;
-                        if(offsets!=NULL) {
+                        if(offsets!=nullptr) {
                             *offsets++=-1;
                             *offsets++=-1;
                         }
@@ -985,7 +985,7 @@ _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
         length-=count;
         count>>=1;
         targetCapacity-=count;
-        if(offsets==NULL) {
+        if(offsets==nullptr) {
             do {
                 c=((UChar)source[1]<<8)|source[0];
                 source+=2;
@@ -1053,7 +1053,7 @@ _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
                     source+=2;
                     length-=2;
                     *target++=c;
-                    if(offsets!=NULL) {
+                    if(offsets!=nullptr) {
                         *offsets++=sourceIndex;
                     }
                     cnv->UCharErrorBuffer[0]=trail;
@@ -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 = {
index bc160b71dd6c8d29e4448ecbfe4237657952d219..6d8b579352195eb86013356b41751b8704ea4641 100644 (file)
@@ -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 */
@@ -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 */
index 8964ca01de0d898121844e8b079f24966680972d..25e40d7cb592bcbd8f2ace2b2c6a7884f6f819b3 100644 (file)
@@ -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 */ {
@@ -375,7 +375,7 @@ unicodeMode:
                         break;
                     case 2:
                         *target++=(UChar)((bits<<4)|(base64Value>>2));
-                        if(offsets!=NULL) {
+                        if(offsets!=nullptr) {
                             *offsets++=sourceIndex;
                             sourceIndex=nextSourceIndex-1;
                         }
@@ -386,7 +386,7 @@ unicodeMode:
                         break;
                     case 5:
                         *target++=(UChar)((bits<<2)|(base64Value>>4));
-                        if(offsets!=NULL) {
+                        if(offsets!=nullptr) {
                             *offsets++=sourceIndex;
                             sourceIndex=nextSourceIndex-1;
                         }
@@ -397,7 +397,7 @@ unicodeMode:
                         break;
                     case 7:
                         *target++=(UChar)((bits<<6)|base64Value);
-                        if(offsets!=NULL) {
+                        if(offsets!=nullptr) {
                             *offsets++=sourceIndex;
                             sourceIndex=nextSourceIndex;
                         }
@@ -415,7 +415,7 @@ unicodeMode:
                     if(base64Counter==-1) {
                         /* +- i.e. a minus immediately following a plus */
                         *target++=PLUS;
-                        if(offsets!=NULL) {
+                        if(offsets!=nullptr) {
                             *offsets++=sourceIndex-1;
                         }
                     } else {
@@ -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={
@@ -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 */ {
@@ -1029,7 +1029,7 @@ unicodeMode:
                             goto endloop;
                         }
                         *target++=c;
-                        if(offsets!=NULL) {
+                        if(offsets!=nullptr) {
                             *offsets++=sourceIndex;
                             sourceIndex=nextSourceIndex-1;
                         }
@@ -1047,7 +1047,7 @@ unicodeMode:
                             goto endloop;
                         }
                         *target++=c;
-                        if(offsets!=NULL) {
+                        if(offsets!=nullptr) {
                             *offsets++=sourceIndex;
                             sourceIndex=nextSourceIndex-1;
                         }
@@ -1065,7 +1065,7 @@ unicodeMode:
                             goto endloop;
                         }
                         *target++=c;
-                        if(offsets!=NULL) {
+                        if(offsets!=nullptr) {
                             *offsets++=sourceIndex;
                             sourceIndex=nextSourceIndex;
                         }
@@ -1083,7 +1083,7 @@ unicodeMode:
                     if(base64Counter==-1) {
                         /* &- i.e. a minus immediately following an ampersand */
                         *target++=AMPERSAND;
-                        if(offsets!=NULL) {
+                        if(offsets!=nullptr) {
                             *offsets++=sourceIndex-1;
                         }
                     } else {
@@ -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={
index 3c27f2e46e8bbab8e31700967f7e17fb7edc850a..bed5753fd6c8d7f3d458ed46531c4883a0c09671 100644 (file)
@@ -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,
@@ -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={
index edb49d36a9ce53d1c2c827efa4c132aa6babb476..26afcc2fabd463e37a7fc2d9280718637c16e150 100644 (file)
@@ -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) {
@@ -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) {
@@ -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={
index ac86b98597066fdd50e41ed50e87d8783d2103e1..20a5999924e37f90879d052104348f1b5a07376f 100644 (file)
@@ -43,17 +43,17 @@ ucnv_getDisplayName(const UConverter *cnv,
     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;
     }
index e0d2f0775df24e2c8c262894c1d7ef4e805ed52f..00f05c35220fbdb84f63db0faad52eb0a031520e 100644 (file)
@@ -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;
@@ -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;
     }*/
@@ -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;
     }*/
@@ -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={
index 839f7ff9c62e8b206681386e61405071822aa739..80b09923d6f765382739f7f28607813e8b5fb56b 100644 (file)
@@ -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
@@ -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;
     }
@@ -1185,14 +1185,14 @@ UConverter_toUnicode_ISCII_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, UErrorCo
     uint32_t targetUniChar = 0x0000;
     uint8_t sourceChar = 0x0000;
     UConverterDataISCII* data;
-    UChar32* toUnicodeStatus=NULL;
+    UChar32* toUnicodeStatus=nullptr;
     UChar32 tempTargetUniChar = 0x0000;
-    UChar* contextCharToUnicode= NULL;
+    UChar* 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;
     }
@@ -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={
index 05aad6a0e039b8b34034405c9ce01f3efdcccc37..3e4c38c627f4adfd9c2f83aaed13161e53cbc296 100644 (file)
@@ -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;
@@ -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++;
@@ -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
 };
 
@@ -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
 };
 
index 0e753c8ffbfb114b4672fcdecf7cc65f3c0f97fa..69b3d05eb0932644609722abed4700992c788240 100644 (file)
@@ -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
 };
 
@@ -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,
@@ -1178,7 +1178,7 @@ _extToU(UConverter *cnv, const UConverterSharedData *sharedData,
         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;
@@ -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;
@@ -2086,7 +2086,7 @@ ucnv_MBCSSingleToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
         if(MBCS_ENTRY_FINAL_IS_VALID_DIRECT_16(entry)) {
             /* output BMP code point */
             *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
-            if(offsets!=NULL) {
+            if(offsets!=nullptr) {
                 *offsets++=sourceIndex;
             }
 
@@ -2106,13 +2106,13 @@ ucnv_MBCSSingleToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
             entry=MBCS_ENTRY_FINAL_VALUE(entry);
             /* output surrogate pair */
             *target++=(UChar)(0xd800|(UChar)(entry>>10));
-            if(offsets!=NULL) {
+            if(offsets!=nullptr) {
                 *offsets++=sourceIndex;
             }
             c=(UChar)(0xdc00|(UChar)(entry&0x3ff));
             if(target<targetLimit) {
                 *target++=c;
-                if(offsets!=NULL) {
+                if(offsets!=nullptr) {
                     *offsets++=sourceIndex;
                 }
             } else {
@@ -2129,7 +2129,7 @@ ucnv_MBCSSingleToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
             if(UCNV_TO_U_USE_FALLBACK(cnv)) {
                 /* output BMP code point */
                 *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
-                if(offsets!=NULL) {
+                if(offsets!=nullptr) {
                     *offsets++=sourceIndex;
                 }
 
@@ -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++;
@@ -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++;
@@ -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)) {
@@ -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);
                             }
@@ -2626,7 +2626,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
                             /* output BMP code point */
                             ++source;
                             *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
-                            if(offsets!=NULL) {
+                            if(offsets!=nullptr) {
                                 *offsets++=sourceIndex;
                                 sourceIndex=++nextSourceIndex;
                             }
@@ -2682,7 +2682,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
             if(c<0xfffe) {
                 /* output BMP code point */
                 *target++=c;
-                if(offsets!=NULL) {
+                if(offsets!=nullptr) {
                     *offsets++=sourceIndex;
                 }
                 byteIndex=0;
@@ -2690,7 +2690,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
                 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) {
+                    if(offsets!=nullptr) {
                         *offsets++=sourceIndex;
                     }
                     byteIndex=0;
@@ -2702,7 +2702,7 @@ 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) {
+            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) {
+                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;
@@ -2754,14 +2754,14 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
             entry=MBCS_ENTRY_FINAL_VALUE(entry);
             /* output surrogate pair */
             *target++=(UChar)(0xd800|(UChar)(entry>>10));
-            if(offsets!=NULL) {
+            if(offsets!=nullptr) {
                 *offsets++=sourceIndex;
             }
             byteIndex=0;
             c=(UChar)(0xdc00|(UChar)(entry&0x3ff));
             if(target<targetLimit) {
                 *target++=c;
-                if(offsets!=NULL) {
+                if(offsets!=nullptr) {
                     *offsets++=sourceIndex;
                 }
             } else {
@@ -2794,7 +2794,7 @@ ucnv_MBCSToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
             if(UCNV_TO_U_USE_FALLBACK(cnv)) {
                 /* output BMP code point */
                 *target++=(UChar)MBCS_ENTRY_FINAL_VALUE_16(entry);
-                if(offsets!=NULL) {
+                if(offsets!=nullptr) {
                     *offsets++=sourceIndex;
                 }
                 byteIndex=0;
@@ -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);
         }
     }
@@ -3475,7 +3475,7 @@ ucnv_MBCSDoubleFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
             ++nextSourceIndex;
             if(c<=0x7f && IS_ASCII_ROUNDTRIP(c, asciiRoundtrips)) {
                 *target++=(uint8_t)c;
-                if(offsets!=NULL) {
+                if(offsets!=nullptr) {
                     *offsets++=sourceIndex;
                     sourceIndex=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;
@@ -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;
@@ -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++;
@@ -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) {
             /*
@@ -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;
@@ -4204,7 +4204,7 @@ ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
             ++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) */
@@ -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); */
     }
@@ -5262,7 +5262,7 @@ moreBytes:
                 c=_extFromU(cnv, cnv->sharedData,
                             c, &noSource, noSource,
                             &target, target+targetCapacity,
-                            NULL, -1,
+                            nullptr, -1,
                             pFromUArgs->flush,
                             pErrorCode);
 
@@ -5565,7 +5565,7 @@ unassigned:
                 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))
     ) {
index 86e850a998a5e991615290cac43c2d83c1dc6c92..7faccd35baac018c22c1d5bf5bb7b3984150c041 100644 (file)
@@ -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;
     }
 }
 
@@ -295,7 +295,7 @@ fastSingle:
                 if(b<=0x7f) {
                     /* write US-ASCII graphic character or DEL */
                     *target++=(UChar)b;
-                    if(offsets!=NULL) {
+                    if(offsets!=nullptr) {
                         *offsets++=sourceIndex;
                     }
                 } else {
@@ -303,7 +303,7 @@ fastSingle:
                     uint32_t c=scsu->toUDynamicOffsets[dynamicWindow]+(b&0x7f);
                     if(c<=0xffff) {
                         *target++=(UChar)c;
-                        if(offsets!=NULL) {
+                        if(offsets!=nullptr) {
                             *offsets++=sourceIndex;
                         }
                     } else {
@@ -311,13 +311,13 @@ fastSingle:
                         *target++=(UChar)(0xd7c0+(c>>10));
                         if(target<targetLimit) {
                             *target++=(UChar)(0xdc00|(c&0x3ff));
-                            if(offsets!=NULL) {
+                            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));
@@ -348,7 +348,7 @@ singleByteMode:
                 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) {
+                    if(offsets!=nullptr) {
                         *offsets++=sourceIndex;
                     }
                     sourceIndex=nextSourceIndex;
@@ -393,7 +393,7 @@ singleByteMode:
                 break;
             case quotePairTwo:
                 *target++=(UChar)((byteOne<<8)|b);
-                if(offsets!=NULL) {
+                if(offsets!=nullptr) {
                     *offsets++=sourceIndex;
                 }
                 sourceIndex=nextSourceIndex;
@@ -403,7 +403,7 @@ singleByteMode:
                 if(b<0x80) {
                     /* all static offsets are in the BMP */
                     *target++=(UChar)(staticOffsets[quoteWindow]+b);
-                    if(offsets!=NULL) {
+                    if(offsets!=nullptr) {
                         *offsets++=sourceIndex;
                     }
                 } else {
@@ -411,7 +411,7 @@ singleByteMode:
                     uint32_t c=scsu->toUDynamicOffsets[quoteWindow]+(b&0x7f);
                     if(c<=0xffff) {
                         *target++=(UChar)c;
-                        if(offsets!=NULL) {
+                        if(offsets!=nullptr) {
                             *offsets++=sourceIndex;
                         }
                     } else {
@@ -419,13 +419,13 @@ singleByteMode:
                         *target++=(UChar)(0xd7c0+(c>>10));
                         if(target<targetLimit) {
                             *target++=(UChar)(0xdc00|(c&0x3ff));
-                            if(offsets!=NULL) {
+                            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));
@@ -479,7 +479,7 @@ singleByteMode:
 fastUnicode:
             while(source+1<sourceLimit && target<targetLimit && (uint8_t)((b=*source)-UC0)>(Urs-UC0)) {
                 *target++=(UChar)((b<<8)|source[1]);
-                if(offsets!=NULL) {
+                if(offsets!=nullptr) {
                     *offsets++=sourceIndex;
                 }
                 sourceIndex=nextSourceIndex;
@@ -543,7 +543,7 @@ fastUnicode:
                 break;
             case quotePairTwo:
                 *target++=(UChar)((byteOne<<8)|b);
-                if(offsets!=NULL) {
+                if(offsets!=nullptr) {
                     *offsets++=sourceIndex;
                 }
                 sourceIndex=nextSourceIndex;
@@ -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,7 +1097,7 @@ 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;
@@ -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;
                     }
@@ -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;
@@ -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={
index 15ee596a23c8630e3b287115ec71a9519fd68bc4..63b7a7cc60de9161d6dc0d8c43bab64591945802 100644 (file)
@@ -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();
@@ -744,31 +744,31 @@ ucnvsel_selectForString(const UConverterSelector* sel,
                         const UChar *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) {
+  if(s!=nullptr) {
     const UChar *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) {
index 59704ff8f67ecba1d8cc9e6d032bebc730602ba7..4b1a857fcfe9c2696ff01c62339d3f7f3c18f93b 100644 (file)
 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;
     }
@@ -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;
@@ -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;
     }
 
index 928d049fb55e735a3108af33b4ea0ed5cf31dc8e..cde8ec3ba7de7f8360a10484ed69fe1a32f4568e 100644 (file)
@@ -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
@@ -233,9 +233,9 @@ static const icu::Hashtable* getCurrSymbolsEquiv();
 static UBool U_CALLCONV 
 isoCodes_cleanup(void)
 {
-    if (gIsoCodes != NULL) {
+    if (gIsoCodes != nullptr) {
         uhash_close(const_cast<UHashtable *>(gIsoCodes));
-        gIsoCodes = NULL;
+        gIsoCodes = nullptr;
     }
     gIsoCodesInitOnce.reset();
     return true;
@@ -248,7 +248,7 @@ static UBool U_CALLCONV
 currSymbolsEquiv_cleanup(void)
 {
     delete const_cast<icu::Hashtable *>(gCurrSymbolsEquiv);
-    gCurrSymbolsEquiv = NULL;
+    gCurrSymbolsEquiv = nullptr;
     gCurrSymbolsEquivInitOnce.reset();
     return true;
 }
@@ -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);
@@ -428,7 +428,7 @@ struct CReg : public icu::UMemory {
     }
 
     static const UChar* get(const char* id) {
-        const UChar* result = NULL;
+        const UChar* result = nullptr;
         umtx_lock(&gCRegLock);
         CReg* p = gCRegHead;
 
@@ -465,7 +465,7 @@ ucurr_register(const UChar* isoCode, const char* locale, UErrorCode *status)
         idForLocale(locale, id, sizeof(id), status);
         return CReg::reg(isoCode, id, status);
     }
-    return NULL;
+    return nullptr;
 }
 
 // -------------------------------------
@@ -555,7 +555,7 @@ ucurr_forLocale(const char* locale,
         idDelim[0] = 0;
     }
 
-    const UChar* s = NULL;  // Currency code from data file.
+    const UChar* 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.
@@ -641,7 +641,7 @@ static UBool fallback(char *loc) {
     }
  /*
     char *i = uprv_strrchr(loc, '_');
-    if (i == NULL) {
+    if (i == nullptr) {
         i = loc;
     }
     *i = 0;
@@ -705,7 +705,7 @@ ucurr_getName(const UChar* currency,
     /* Normalize the keyword value to uppercase */
     T_CString_toUpperCase(buf);
     
-    const UChar* s = NULL;
+    const UChar* 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;
     }
 
@@ -801,7 +801,7 @@ ucurr_getPluralName(const UChar* currency,
     char buf[ISO_CURRENCY_CODE_LENGTH+1];
     myUCharsToChars(buf, currency);
 
-    const UChar* s = NULL;
+    const UChar* 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;
     }
 
@@ -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 UChar* 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);
         }
@@ -947,7 +947,7 @@ 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;
+    UChar* dest = nullptr;
     UErrorCode ec = U_ZERO_ERROR;
     int32_t destLen = u_strToUpper(dest, 0, source, len, locale, &ec);
 
@@ -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 UChar* 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 {
@@ -1039,11 +1039,11 @@ collectCurrencyNames(const char* locale,
             (*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());
@@ -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 {
@@ -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;
@@ -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;
@@ -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,29 +2101,29 @@ 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);
 
                     // 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;
@@ -2137,7 +2137,7 @@ 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;
@@ -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)) {
@@ -2249,7 +2249,7 @@ ucurr_isAvailable(const UChar* isoCode, UDate from, UDate to, UErrorCode* eError
     }
 
     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,11 +2329,11 @@ 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;
@@ -2343,7 +2343,7 @@ ucurr_countCurrencies(const char* locale,
                 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;
@@ -2405,9 +2405,9 @@ ucurr_forLocaleAndDate(const char* locale,
 {
     int32_t resLen = 0;
        int32_t currIndex = 0;
-    const UChar* s = NULL;
+    const UChar* s = nullptr;
 
-    if (ec != NULL && U_SUCCESS(*ec))
+    if (ec != nullptr && U_SUCCESS(*ec))
     {
         // check the arguments passed
         if ((buff && buffCapacity) || !buffCapacity )
@@ -2451,12 +2451,12 @@ 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;
@@ -2466,7 +2466,7 @@ ucurr_forLocaleAndDate(const char* locale,
                     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;
             }
@@ -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);
index c5d0a9feb7b5987693c44b008f4b8cb86a037d12..b983bbd7a3e9519035dd9372275ef08f492fa03c 100644 (file)
@@ -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)
@@ -126,13 +126,13 @@ udata_cleanup(void)
 
     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 {
@@ -626,7 +626,7 @@ const char *UDataPathIterator::next(UErrorCode *pErrorCode)
     } while(path);
 
     /* fell way off the end */
-    return NULL;
+    return nullptr;
 }
 
 U_NAMESPACE_END
@@ -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) {
index 0f80de28eb8fbe4af93474f77b59597da6412c1a..02be852320d47ef144e9f97ca0273e5841cd6d6d 100644 (file)
@@ -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;
 }
index 86f302bd9c3ab938803309f92fe4296163a4b2b5..bbce1a8ecd750020a3cb970e1e86c9720f8a3ab4 100644 (file)
@@ -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;
index 11d895ebcd746392b15f16ddb889c5f9f3473fa7..7f01fe394dbb9083beecd48a39760d753f037ef7 100644 (file)
@@ -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;
@@ -90,13 +90,13 @@ uenum_unextDefault(UEnumeration* en,
             int32_t* resultLength,
             UErrorCode* status)
 {
-    UChar *ustr = NULL;
+    UChar *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) {
+        if (cstr != nullptr) {
             ustr = (UChar*) _getBuffer(en, (len+1) * sizeof(UChar));
-            if (ustr == NULL) {
+            if (ustr == nullptr) {
                 *status = U_MEMORY_ALLOCATION_ERROR;
             } else {
                 u_charsToUChars(cstr, ustr, len+1);
@@ -117,23 +117,23 @@ 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;
+        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;
     }
 }
 
@@ -143,13 +143,13 @@ uenum_unext(UEnumeration* en,
             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;
index a04f9606c572cec64164cf1dbfbd542d88763e80..d042a882190097dc6e643310fe42a829791e294f 100644 (file)
@@ -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;
 }
 
 /********************************************************************
@@ -929,19 +929,19 @@ 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));
+    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,
@@ -1007,7 +1007,7 @@ uhash_compareUChars(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) {
@@ -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)) {
index 7135a166f218dfb20312691e0452052df0ee1c3a..26cbc3fe4cc970d56b9e887973557c256696431d 100644 (file)
@@ -209,7 +209,7 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
             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;
@@ -229,7 +229,7 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
     
     if(srcLength > b1Capacity){
         b1 = (UChar*) uprv_malloc(srcLength * U_SIZEOF_UCHAR);
-        if(b1==NULL){
+        if(b1==nullptr){
             *status = U_MEMORY_ALLOCATION_ERROR;
             goto CLEANUP;
         }
@@ -257,7 +257,7 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
                 uprv_free(b1);
             }
             b1 = (UChar*) uprv_malloc(b1Len * U_SIZEOF_UCHAR);
-            if(b1==NULL){
+            if(b1==nullptr){
                 *status = U_MEMORY_ALLOCATION_ERROR;
                 goto CLEANUP;
             }
@@ -339,7 +339,7 @@ _internal_toASCII(const UChar* src, int32_t srcLength,
                 // 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){
+                if(b2 == nullptr){
                     *status = U_MEMORY_ALLOCATION_ERROR;
                     goto CLEANUP;
                 }
@@ -407,14 +407,14 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
     UChar 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;
+    UChar  *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;
@@ -459,7 +459,7 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
             // 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){
+            if(b1==nullptr){
                 *status = U_MEMORY_ALLOCATION_ERROR;
                 goto CLEANUP;
             }
@@ -499,7 +499,7 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
             // 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){
+            if(b2==nullptr){
                 *status = U_MEMORY_ALLOCATION_ERROR;
                 goto CLEANUP;
             }
@@ -517,7 +517,7 @@ _internal_toUnicode(const UChar* src, int32_t srcLength,
             // 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){
+            if(b3==nullptr){
                 *status = U_MEMORY_ALLOCATION_ERROR;
                 goto CLEANUP;
             }
@@ -614,10 +614,10 @@ uidna_toASCII(const UChar* src, int32_t srcLength,
               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;
     }
@@ -643,10 +643,10 @@ uidna_toUnicode(const UChar* src, int32_t srcLength,
                 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;
     }  
@@ -672,10 +672,10 @@ uidna_IDNToASCII(  const UChar *src, int32_t srcLength,
                    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;
     }
@@ -765,10 +765,10 @@ uidna_IDNToUnicode(  const UChar* src, int32_t srcLength,
                      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;
     }
@@ -863,7 +863,7 @@ uidna_compare(  const UChar *s1, int32_t length1,
                 int32_t options,
                 UErrorCode* status){
 
-    if(status == NULL || U_FAILURE(*status)){
+    if(status == nullptr || U_FAILURE(*status)){
         return -1;
     }
 
@@ -878,7 +878,7 @@ uidna_compare(  const UChar *s1, int32_t length1,
     if(*status == U_BUFFER_OVERFLOW_ERROR){
         // redo processing of string
         b1 = (UChar*) uprv_malloc(b1Len * U_SIZEOF_UCHAR);
-        if(b1==NULL){
+        if(b1==nullptr){
             *status = U_MEMORY_ALLOCATION_ERROR;
             goto CLEANUP;
         }
@@ -893,7 +893,7 @@ uidna_compare(  const UChar *s1, int32_t length1,
     if(*status == U_BUFFER_OVERFLOW_ERROR){
         // redo processing of string
         b2 = (UChar*) uprv_malloc(b2Len * U_SIZEOF_UCHAR);
-        if(b2==NULL){
+        if(b2==nullptr){
             *status = U_MEMORY_ALLOCATION_ERROR;
             goto CLEANUP;
         }
index ffce3ec158d3261ea9acb5c5e1be92496511ebf0..3fe92a48cd52329b8224a56524edae220d3d35c4 100644 (file)
@@ -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;
     }
@@ -463,7 +463,7 @@ uprv_compareInvAscii(const UDataSwapper *ds,
     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;
     }
 
@@ -509,7 +509,7 @@ uprv_compareInvEbcdic(const UDataSwapper *ds,
     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;
     }
 
index c4ab7d6d565860a965be22d7f53960846f1e387a..4c2f4bdf49f97094fa49d31763ef4c71f55ad392 100644 (file)
@@ -74,7 +74,7 @@ static const UCharIterator noopIterator={
     noopCurrent,
     noopCurrent,
     noopCurrent,
-    NULL,
+    nullptr,
     noopGetState,
     noopSetState
 };
@@ -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,7 +205,7 @@ static const UCharIterator stringIterator={
     stringIteratorCurrent,
     stringIteratorNext,
     stringIteratorPrevious,
-    NULL,
+    nullptr,
     stringIteratorGetState,
     stringIteratorSetState
 };
@@ -291,7 +291,7 @@ static const UCharIterator utf16BEIterator={
     utf16BEIteratorCurrent,
     utf16BEIteratorNext,
     utf16BEIteratorPrevious,
-    NULL,
+    nullptr,
     stringIteratorGetState,
     stringIteratorSetState
 };
@@ -323,9 +323,9 @@ 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;
 
@@ -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
 };
@@ -529,7 +529,7 @@ static const UCharIterator replaceableIterator={
     replaceableIteratorCurrent,
     replaceableIteratorNext,
     replaceableIteratorPrevious,
-    NULL,
+    nullptr,
     stringIteratorGetState,
     stringIteratorSetState
 };
@@ -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);
index 57344715de5fe569e8e9551b0d6e2938c9ca988b..5bdf534c84d6b48462330d5035de7fd2a6290cd4 100644 (file)
@@ -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;
index 1da2abc361daf82c2bffd59c4575fbd98bf20218..b53cd2a1a1c6e2e92983064fa8640841a06fde00 100644 (file)
@@ -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.
  *
@@ -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[] = {
@@ -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:
index 12dc3004924541a3798f89ed6a10d2b1fd896a76..83785d336bc007360ccc5f48f535c90678c4b1c5 100644 (file)
@@ -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) {
+    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;
                 }
@@ -274,14 +274,14 @@ initFromResourceBundle(UErrorCode& 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;
                                     }
@@ -315,7 +315,7 @@ initFromResourceBundle(UErrorCode& 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;
 }
 
index 01a0e0028f57eacac6306ac18718336de97a2dab..43d597549f776fd4bfa346f5193a348ce4abd99a 100644 (file)
@@ -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++;
index 145582ea97acd46d187f240ee469441a0a27582e..885006977acbd9b76aecf9be2b941ea314b3cc06 100644 (file)
@@ -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);
index b0ac991e1baeac7f73c0e075c1bbe4e902cbe4cf..69693089de7fdecf026609fbdc04c2f156a52132 100644 (file)
@@ -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 {};
 
 /*
@@ -166,10 +166,10 @@ static UBool U_CALLCONV unames_cleanup(void)
 {
     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;
     }
@@ -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;
     }
 
@@ -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;
index f77df88e39c787ca65d406b66fd7340a1c22f8e9..0e37f4562a58390f8d7553b2d019c6edea5ee026 100644 (file)
@@ -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
index 3a121cf703b3379e7bc79d85bdd0c486cd94a703..108652799e692fb6dfec1db7e88e94e77007c81c 100644 (file)
@@ -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
index 8fe66780f5157b0d1bf175f9bed7ff7bd539bb1c..1719a6bb83edc97987308e45a0a9c1be98c6f96f 100644 (file)
@@ -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_;
index 53af84fa74d65f2d095edb3e8c314b667f219e52..d7779f6d67f65b6ae2f0a0988e919573bd369290 100644 (file)
@@ -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.
index 96c659d10ad6a6af79e4b567a95c389fe22c6128..7a2ad6b598c075ced30ef31efb112c93f86db8dd 100644 (file)
@@ -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;
         }
     }
@@ -222,7 +222,7 @@ public:
      * @stable ICU 56
      */
     LocalPointer(LocalPointer<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
-        src.ptr=NULL;
+        src.ptr=nullptr;
     }
 
     /**
@@ -255,7 +255,7 @@ public:
     LocalPointer<T> &operator=(LocalPointer<T> &&src) U_NOEXCEPT {
         delete LocalPointerBase<T>::ptr;
         LocalPointerBase<T>::ptr=src.ptr;
-        src.ptr=NULL;
+        src.ptr=nullptr;
         return *this;
     }
 
@@ -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;
         }
     }
@@ -397,7 +397,7 @@ public:
      * @stable ICU 56
      */
     LocalArray(LocalArray<T> &&src) U_NOEXCEPT : LocalPointerBase<T>(src.ptr) {
-        src.ptr=NULL;
+        src.ptr=nullptr;
     }
 
     /**
@@ -430,7 +430,7 @@ public:
     LocalArray<T> &operator=(LocalArray<T> &&src) U_NOEXCEPT {
         delete[] LocalPointerBase<T>::ptr;
         LocalPointerBase<T>::ptr=src.ptr;
-        src.ptr=NULL;
+        src.ptr=nullptr;
         return *this;
     }
 
@@ -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) {} \
+        explicit LocalPointerClassName(Type *p=nullptr) : LocalPointerBase<Type>(p) {} \
         LocalPointerClassName(LocalPointerClassName &&src) U_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() { if (ptr != nullptr) { closeFunction(ptr); } } \
         LocalPointerClassName &operator=(LocalPointerClassName &&src) U_NOEXCEPT { \
-            if (ptr != NULL) { closeFunction(ptr); } \
+            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? */ \
@@ -581,7 +581,7 @@ public:
             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)> () && { \
index 2f2b3998a78c13feb1f121f53a97ea98d868c70d..62b36b9c56e5560172d231129514ae2ea15249e1 100644 (file)
@@ -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
@@ -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
index 4c5be13dbc91681adcd5629f75e3bbf5e3e28d05..55b09bfbd4b5dc2776ce1d0b3c15a2ef5e2f135d 100644 (file)
@@ -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
index 2d355250c29fde5e90d311235cda5d01306221db..174a8c70a429482f0807d45677be1c8d0fb901b3 100644 (file)
@@ -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
index 14b246988502da6cd0130fa37538c288e75f102c..03a7aa080d1a7826f8270ea35f34d15986cc1847 100644 (file)
@@ -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;
index 73945f5f97bcbde80faa14da49ec4f65b60e5a1d..d33a812ad0b4f384a2c5f6eea25e216b6797f792 100644 (file)
@@ -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
index 14d3aa213b0cfe1425965d3e9acd82acbd22fc72..b4ad51d34f950ae1dea1758bcce69b1815f53a97 100644 (file)
@@ -372,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
@@ -592,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
index 6dd4530647e628868c79e000a3cf3fcab4940f4f..7115c97b8299ff0d2b809f00c32c452d3438fc5d 100644 (file)
@@ -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
index 6e26a40591fb37f29a3a1450afe28f609f18ec53..30fc2ac0ab235e3e859c9784658100270b350fee 100644 (file)
@@ -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
index 6d9c04ace2359a6ccaf18dfaafd5edcafc1de537..e7bbf8cf2d8f69fa991b2058d5334a2321a35e71 100644 (file)
@@ -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.
index 1d1b37940a87d9518c9af4389ddc29cb443ade61..fba5c9b8147ebc56cb003c2755df3f5f57c3e655 100644 (file)
@@ -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 
      */
index b7a9b23d22bf3572b99657a039aa615d2b6a873a..429d7883f15cd84083a3cc3012d642b6b71bea40 100644 (file)
@@ -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];
index b64d877f97430fa6490b8ee1b06b766c77adfc52..647a3884a00c8c566f4bf9440eb68dd72c7435c1 100644 (file)
@@ -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;
index 064244a74c16910cfcfbe13efed7df097494f654..fa1b55616c65997e20693a9f0babaf43e6ca0aac 100644 (file)
@@ -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_;
index 33e35c4def8c80fb1d4d106f5520f0bb6abfc1de..83ebdb1319660a4c7e7e521f8c56feb4f68afa90 100644 (file)
@@ -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
 
     /**
@@ -432,7 +432,7 @@ public:
      * @param options bitmask for options to apply to the pattern.
      * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
      * @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
@@ -452,7 +452,7 @@ public:
      * @param options bitmask for options to apply to the pattern.
      * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
      * @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
      */
@@ -647,7 +647,7 @@ public:
      * @param options bitmask for options to apply to the pattern.
      * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
      * @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>
@@ -685,7 +685,7 @@ public:
      * @param options bitmask for options to apply to the pattern.
      * Valid options are USET_IGNORE_SPACE and USET_CASE_INSENSITIVE.
      * @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
@@ -1488,7 +1488,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
@@ -1718,7 +1718,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 {
index b3c994810793888d04e7e0eaa99b4947650861e4..27347bd36d40c32dffd05fcf75fd15aa65dc9446 100644 (file)
@@ -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
@@ -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
    */
@@ -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
@@ -3706,7 +3706,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
@@ -4712,18 +4712,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
index 25a8330f9ac9d5b9bdbb7e59a8a008ab5fb41b0b..58cd5f4e30b5a8f84f87e82cb33cc8e5258c75fd 100644 (file)
@@ -38,8 +38,8 @@
  *                 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.
  *
index c6d1e53a8cef1097925f484370aeab427a1ff7b9..423b281631db65a0c5d002ae7265cf1a58ccddf2 100644 (file)
@@ -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.
index cfb000b2c8e683af5392976aaafa5d8ff4323a2b..1284c03813eb85892c47f904c9348240e55ff67a 100644 (file)
@@ -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);
index 4b9222124a2ff409f8f4d444d32a9eec3e1ae68d..217031a27d216130fc2c9ce8683db802bd6807b5 100644 (file)
@@ -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.
index 4faace525c595b6495b213e459bd7303d7166167..613e9665e91f12e8dbfcecb67231303665d634e1 100644 (file)
@@ -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;
         }
@@ -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
@@ -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;
@@ -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)) {
@@ -1368,7 +1368,7 @@ UnicodeSet& UnicodeSet::clear(void) {
     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;
     }
@@ -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;
     }
 }
@@ -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();
             }
         }
@@ -2203,7 +2203,7 @@ UnicodeSet *UnicodeSet::freeze() {
 }
 
 int32_t UnicodeSet::span(const UChar *s, int32_t length, USetSpanCondition spanCondition) const {
-    if(length>0 && bmpSet!=NULL) {
+    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 ?
@@ -2240,7 +2240,7 @@ int32_t UnicodeSet::span(const UChar *s, int32_t length, USetSpanCondition spanC
 }
 
 int32_t UnicodeSet::spanBack(const UChar *s, int32_t length, USetSpanCondition spanCondition) const {
-    if(length>0 && bmpSet!=NULL) {
+    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 ?
index d7dab2a17b7e5922fe0bf3eabd701ecf9bce490b..84791e701012604ce01689cd7556d95e383ebf09 100644 (file)
@@ -162,8 +162,8 @@ UnicodeSet& UnicodeSet::closeOver(int32_t attribute) {
                 _set_add,
                 _set_addRange,
                 _set_addString,
-                NULL, // don't need remove()
-                NULL // don't need removeRange()
+                nullptr, // don't need remove()
+                nullptr // don't need removeRange()
             };
 
             // start with input set to guarantee inclusion
@@ -190,13 +190,13 @@ UnicodeSet& UnicodeSet::closeOver(int32_t attribute) {
                     // 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);
+                        result = ucase_toFullLower(cp, nullptr, nullptr, &full, UCASE_LOC_ROOT);
                         addCaseMapping(foldSet, result, full, str);
 
-                        result = ucase_toFullTitle(cp, NULL, NULL, &full, UCASE_LOC_ROOT);
+                        result = ucase_toFullTitle(cp, nullptr, nullptr, &full, UCASE_LOC_ROOT);
                         addCaseMapping(foldSet, result, full, str);
 
-                        result = ucase_toFullUpper(cp, NULL, NULL, &full, UCASE_LOC_ROOT);
+                        result = ucase_toFullUpper(cp, nullptr, nullptr, &full, UCASE_LOC_ROOT);
                         addCaseMapping(foldSet, result, full, str);
 
                         result = ucase_toFullFolding(cp, &full, 0);
index 48c0a26a710304597256adb0a58bd5eb7fe1e205..78fdbb37d7d72dad6af3061d89a29a7c7698ae5e 100644 (file)
@@ -69,7 +69,7 @@ static icu::UInitOnce uni32InitOnce {};
  */
 static UBool U_CALLCONV uset_cleanup(void) {
     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();
@@ -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");
@@ -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;
                     }
index e4277c5be606977bcf70b53b3ba5b702419b34b3..14cef120fdf6a38087a4b0aaf974a53334cb8b1f 100644 (file)
@@ -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;
             }
@@ -168,7 +168,7 @@ static int32_t
 getUTF8Length(const UChar *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 {
@@ -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)) {
@@ -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.
         }
@@ -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;
index 4125d194724d4dc1c66e8c744339073c581aa19f..62164f3bf4ecaa3517ae7d9a9864a46b7d189acd 100644 (file)
@@ -222,7 +222,7 @@ UnicodeString::UnicodeString(UBool isTerminated,
                              int32_t textLength) {
   fUnion.fFields.fLengthAndFlags = kReadonlyAlias;
   const UChar *text = textPtr;
-  if(text == NULL) {
+  if(text == nullptr) {
     // treat as an empty string, do not alias
     setToEmpty();
   } else if(textLength < -1 ||
@@ -244,7 +244,7 @@ UnicodeString::UnicodeString(UChar *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) {
@@ -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) {
@@ -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,7 +380,7 @@ 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);
@@ -466,7 +466,7 @@ UnicodeString UnicodeString::fromUTF32(const UChar32 *utf32, int32_t length) {
     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) {
@@ -601,7 +601,7 @@ 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;
     }
   }
@@ -677,8 +677,8 @@ 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 UChar *srcChars==nullptr as an empty string
     return length == 0 ? 0 : 1;
   }
 
@@ -749,7 +749,7 @@ UnicodeString::doCompareCodePointOrder(int32_t start,
                                        int32_t srcLength) const
 {
   // compare illegal string values
-  // treat const UChar *srcChars==NULL as an empty string
+  // treat const UChar *srcChars==nullptr as an empty string
   if(isBogus()) {
     return -1;
   }
@@ -757,11 +757,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);
@@ -825,14 +825,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);
 }
 
@@ -899,7 +899,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;
   }
 
@@ -917,8 +917,8 @@ 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
+  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 +933,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 +982,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,7 +1016,7 @@ 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;
@@ -1044,7 +1044,7 @@ UnicodeString::indexOf(const UChar *srcChars,
   // 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) {
+  if(match == nullptr) {
     return -1;
   } else {
     return (int32_t)(match - array);
@@ -1062,7 +1062,7 @@ UnicodeString::doIndexOf(UChar c,
   // find the first occurrence of c
   const UChar *array = getArrayStart();
   const UChar *match = u_memchr(array + start, c, length);
-  if(match == NULL) {
+  if(match == nullptr) {
     return -1;
   } else {
     return (int32_t)(match - array);
@@ -1079,7 +1079,7 @@ UnicodeString::doIndexOf(UChar32 c,
   // find the first occurrence of c
   const UChar *array = getArrayStart();
   const UChar *match = u_memchr32(array + start, c, length);
-  if(match == NULL) {
+  if(match == nullptr) {
     return -1;
   } else {
     return (int32_t)(match - array);
@@ -1108,7 +1108,7 @@ UnicodeString::lastIndexOf(const UChar *srcChars,
   // 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) {
+  if(match == nullptr) {
     return -1;
   } else {
     return (int32_t)(match - array);
@@ -1130,7 +1130,7 @@ UnicodeString::doLastIndexOf(UChar c,
   // find the last occurrence of c
   const UChar *array = getArrayStart();
   const UChar *match = u_memrchr(array + start, c, length);
-  if(match == NULL) {
+  if(match == nullptr) {
     return -1;
   } else {
     return (int32_t)(match - array);
@@ -1147,7 +1147,7 @@ UnicodeString::doLastIndexOf(UChar32 c,
   // find the last occurrence of c
   const UChar *array = getArrayStart();
   const UChar *match = u_memrchr32(array + start, c, length);
-  if(match == NULL) {
+  if(match == nullptr) {
     return -1;
   } else {
     return (int32_t)(match - array);
@@ -1265,7 +1265,7 @@ UnicodeString::setTo(UBool isTerminated,
   }
 
   const UChar *text = textPtr;
-  if(text == NULL) {
+  if(text == nullptr) {
     // treat as an empty string, do not alias
     releaseArray();
     setToEmpty();
@@ -1301,7 +1301,7 @@ UnicodeString::setTo(UChar *buffer,
     return *this;
   }
 
-  if(buffer == NULL) {
+  if(buffer == nullptr) {
     // treat as an empty string, do not alias
     releaseArray();
     setToEmpty();
@@ -1343,7 +1343,7 @@ UnicodeString &UnicodeString::setToUTF8(StringPiece utf8) {
   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)) {
@@ -1548,7 +1548,7 @@ 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) {
+  if(!isWritable() || srcLength == 0 || srcChars == nullptr) {
     return *this;
   }
 
@@ -1623,7 +1623,7 @@ UnicodeString::copy(int32_t start, int32_t limit, int32_t dest) {
     }
     UChar* text = (UChar*) uprv_malloc( sizeof(UChar) * (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);
@@ -1839,11 +1839,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 +1858,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);
@@ -1931,7 +1931,7 @@ UnicodeStringAppendable::getAppendBuffer(int32_t minCapacity,
                                          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 +1951,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 +1963,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;
index f4c43b4889f0b150de0a5288560c0d5bc95a10d0..efd956d703239b187d7fc7f8392265f3f9b7068d 100644 (file)
@@ -47,7 +47,7 @@ UnicodeString::doCaseCompare(int32_t start,
                              uint32_t options) const
 {
   // compare illegal string values
-  // treat const UChar *srcChars==NULL as an empty string
+  // treat const UChar *srcChars==nullptr as an empty string
   if(isBogus()) {
     return -1;
   }
@@ -55,7 +55,7 @@ UnicodeString::doCaseCompare(int32_t start,
   // pin indices to legal values
   pinIndices(start, length);
 
-  if(srcChars == NULL) {
+  if(srcChars == nullptr) {
     srcStart = srcLength = 0;
   }
 
@@ -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;
@@ -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;
index f0f3048d06f517a9800c1ccba8a3a8cd3aa1d5f2..8b6a9ca0ca51a3066fbe8257727dcffb24568ab9 100644 (file)
@@ -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);
 }
 
index e1f60d4487acb65ece3dd953d5a392661233f220..afaf5f085f59bb757988c9c30b9befdee4c795cf 100644 (file)
@@ -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;
index cf3915c27f3c9b0d58e76226552ef4efdabc9316..edb394c3be131c8fc76b8ecd5faada541c9fc1c3 100644 (file)
@@ -122,12 +122,12 @@ _iterate(UCharIterator *src, UBool forward,
     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();
@@ -230,14 +230,14 @@ _concatenate(const UChar *left, int32_t leftLength,
     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)))
     ) {
index e22419097255c50e96f2f2929dd39369fb9ef7ef..29eb5aa42654d1169f5130a874f0c6e3d80263a2 100644 (file)
@@ -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*/
             }
@@ -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 */
index e222b2ce9b90963013f4a9c799d09656f8792077..7a8594b803af16fe5c85b11ae060dc7b244beecb 100644 (file)
@@ -63,7 +63,7 @@ void * U_EXPORT2 UMemory::operator new(size_t size) U_NOEXCEPT {
 }
 
 void U_EXPORT2 UMemory::operator delete(void *p) U_NOEXCEPT {
-    if(p!=NULL) {
+    if(p!=nullptr) {
         uprv_free(p);
     }
 }
@@ -73,7 +73,7 @@ void * U_EXPORT2 UMemory::operator new[](size_t size) U_NOEXCEPT {
 }
 
 void U_EXPORT2 UMemory::operator delete[](void *p) U_NOEXCEPT {
-    if(p!=NULL) {
+    if(p!=nullptr) {
         uprv_free(p);
     }
 }
@@ -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
 
index 429e3a1d1ca5226ef8d1536daa18ddb2a79b8e42..2bdb22ac050ca902563ef6021f716a003805771d 100644 (file)
@@ -794,10 +794,10 @@ uprops_addPropertyStarts(UPropertySource src, const USetAdder *sa, UErrorCode *p
 
 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)) {
+    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;
     }
index 1aa58e753ceeb434288b02b988f26ba3d43a9c58..90b0a22d01a9d4eee6f6e4d4647f196cb2b44c49 100644 (file)
@@ -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
         }
     }
index b0beae76cd5603b75d05ed35d442c8a45122c59e..646c173bef972becc47f7b3e03fa96cafd4a40f8 100644 (file)
@@ -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;
 }
 
@@ -231,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;
         }
@@ -303,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++;
     }
@@ -359,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;
@@ -391,7 +391,7 @@ static int32_t ures_flushCache()
     * return 0
     */
     Mutex lock(&resbMutex);
-    if (cache == NULL) {
+    if (cache == nullptr) {
         return 0;
     }
 
@@ -399,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
@@ -437,19 +437,19 @@ U_CAPI UBool U_EXPORT2 ures_dumpCacheContents(void) {
   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);       
@@ -463,10 +463,10 @@ U_CAPI UBool U_EXPORT2 ures_dumpCacheContents(void) {
 
 static UBool U_CALLCONV ures_cleanup(void)
 {
-    if (cache != NULL) {
+    if (cache != nullptr) {
         ures_flushCache();
         uhash_close(cache);
-        cache = NULL;
+        cache = nullptr;
     }
     gCacheInitOnce.reset();
     return true;
@@ -474,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);
 }
      
@@ -487,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)) {
@@ -496,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);
@@ -511,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;
@@ -521,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;
@@ -542,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));
@@ -556,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;
             }
         }
 
@@ -575,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;
@@ -603,7 +603,7 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE
                 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 */
+                    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);
                     }
@@ -612,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 */
@@ -631,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 */
@@ -650,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;
     }
@@ -662,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];
@@ -672,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);
@@ -684,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 */
@@ -745,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) {
+            if(parentLocaleName != nullptr && 0 < parentLocaleLen && parentLocaleLen < nameCapacity) {
                 u_UCharsToChars(parentLocaleName, name, parentLocaleLen + 1);
                 if (uprv_strcmp(name, kRootLocaleName) == 0) {
                     return true;
@@ -766,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);
@@ -811,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];
@@ -825,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);
@@ -857,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 */
@@ -868,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;
@@ -887,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);
@@ -897,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;
@@ -910,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.
@@ -920,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;
@@ -929,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;
         }
@@ -939,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;
     }
@@ -951,7 +951,7 @@ finish:
         }
         return r;
     } else {
-        return NULL;
+        return nullptr;
     }
 }
 
@@ -965,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.
@@ -984,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;
         }
@@ -1027,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--;
 
@@ -1039,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);
@@ -1064,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;
   } 
@@ -1081,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;
@@ -1091,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;
             }
@@ -1099,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;
             }
@@ -1113,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);
@@ -1387,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.
@@ -1404,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);
         }
         /* 
@@ -1446,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);
@@ -1465,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");
@@ -1489,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);
         }
     }
@@ -1522,15 +1522,15 @@ UResourceBundle *ures_copyResb(UResourceBundle *r, const UResourceBundle *origin
 
 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;
+    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;
@@ -1544,21 +1544,21 @@ ures_toUTF8String(const UChar *s16, int32_t length16,
     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) {
@@ -1571,7 +1571,7 @@ 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)) {
             /*
@@ -1611,15 +1611,15 @@ ures_getUTF8String(const UResourceBundle *resB,
 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;
@@ -1628,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;
@@ -1645,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;
   }
@@ -1660,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;
   }
@@ -1675,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);
@@ -1691,14 +1691,14 @@ 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;
   }
   
@@ -1708,7 +1708,7 @@ U_CAPI int32_t U_EXPORT2 ures_getSize(const UResourceBundle *resB) {
 static const UChar* 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);
+    UResourceBundle *tempRes = ures_getByIndex(resB, sIndex, nullptr, status);
     result = ures_getString(tempRes, len, status);
     ures_close(tempRes);
     return result;
@@ -1718,14 +1718,14 @@ 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);
@@ -1734,12 +1734,12 @@ U_CAPI UBool U_EXPORT2 ures_hasNext(const UResourceBundle *resB) {
 U_CAPI const UChar* U_EXPORT2 ures_getNextString(UResourceBundle *resB, int32_t* len, const char ** key, UErrorCode *status) {
   Resource r = RES_BOGUS;
   
-  if (status==NULL || U_FAILURE(*status)) {
-    return NULL;
+  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) {
@@ -1773,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)) {
@@ -1822,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;
     }
 
@@ -1868,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;
+    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) {
@@ -1925,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
@@ -1946,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;
   }
@@ -1971,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;
@@ -1980,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;
   }
 
@@ -2005,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;
   }
 
@@ -2032,21 +2032,21 @@ ures_getStringByKeyWithFallback(const UResourceBundle *resB,
                                 UErrorCode *status) {
 
     UResourceBundle stack;
-    const UChar* retVal = NULL;
+    const UChar* 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;
@@ -2065,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 {
@@ -2162,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;
     }
@@ -2182,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
@@ -2210,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;
@@ -2289,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) {
@@ -2316,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,
@@ -2432,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;
     }
@@ -2485,15 +2485,15 @@ U_CAPI UResourceBundle* U_EXPORT2 ures_getByKey(const UResourceBundle *resB, con
 
 U_CAPI const UChar* 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);
@@ -2514,7 +2514,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
                     case URES_ALIAS:
                       {
                         const UChar* result = 0;
-                        UResourceBundle *tempRes = ures_getByKey(resB, inKey, NULL, status);
+                        UResourceBundle *tempRes = ures_getByKey(resB, inKey, nullptr, status);
                         result = ures_getString(tempRes, len, status);
                         ures_close(tempRes);
                         return result;
@@ -2536,7 +2536,7 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
             case URES_ALIAS:
               {
                 const UChar* result = 0;
-                UResourceBundle *tempRes = ures_getByKey(resB, inKey, NULL, status);
+                UResourceBundle *tempRes = ures_getByKey(resB, inKey, nullptr, status);
                 result = ures_getString(tempRes, len, status);
                 ures_close(tempRes);
                 return result;
@@ -2563,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
@@ -2586,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;
     }
@@ -2609,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:
@@ -2624,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;
@@ -2639,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;
@@ -2651,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;
@@ -2661,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
@@ -2705,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);
 }
 
 /**
@@ -2719,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);
 }
 
 /**
@@ -2732,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;
     }
@@ -2744,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;
     }
@@ -2762,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;
@@ -2795,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. */
@@ -2820,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) {
@@ -2886,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);
@@ -2909,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,
@@ -2922,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));
@@ -2935,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));
 
@@ -2956,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);
@@ -2966,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;
         }
@@ -2987,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;
@@ -3029,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));
@@ -3067,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));
         }
 
@@ -3085,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", 
@@ -3166,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",
@@ -3293,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;
@@ -3305,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);
         
@@ -3332,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;
         }
         
@@ -3345,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) */
@@ -3390,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){
@@ -3403,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){
@@ -3426,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;
@@ -3442,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;
 }
index a1222d415ce6d14198718eaf79a66e1610c0414d..30f05fbb2b19f67619425d01e2cabe108cb507bc 100644 (file)
@@ -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;
     }
 }
 
@@ -337,7 +337,7 @@ res_getStringNoTrace(const ResourceData *pResData, Resource res, int32_t *pLengt
         length=*p32++;
         p=(const UChar *)p32;
     } else {
-        p=NULL;
+        p=nullptr;
         length=0;
     }
     if(pLength) {
@@ -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;
     }
@@ -405,7 +405,7 @@ int32_t getStringArray(const ResourceData *pResData, const icu::ResourceArray &a
         int32_t sLength;
         // No tracing: handled by the caller
         const UChar *s = res_getStringNoTrace(pResData, array.internalGetResource(pResData, i), &sLength);
-        if(s == NULL) {
+        if(s == nullptr) {
             errorCode = U_RESOURCE_TYPE_MISMATCH;
             return 0;
         }
@@ -426,7 +426,7 @@ res_getAlias(const ResourceData *pResData, Resource res, int32_t *pLength) {
         length=*p32++;
         p=(const UChar *)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) {
@@ -507,10 +507,10 @@ UResType ResourceDataValue::getType() const {
 
 const UChar *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) {
+    if(s == nullptr) {
         errorCode = U_RESOURCE_TYPE_MISMATCH;
     }
     return s;
@@ -518,10 +518,10 @@ const UChar *ResourceDataValue::getString(int32_t &length, UErrorCode &errorCode
 
 const UChar *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) {
+    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;
     }
@@ -659,7 +659,7 @@ int32_t ResourceDataValue::getStringArrayOrStringAsArray(UnicodeString *dest, in
     }
     int32_t sLength;
     const UChar *s = res_getString(fTraceInfo, &getData(), res, &sLength);
-    if(s != NULL) {
+    if(s != nullptr) {
         dest[0].setTo(true, s, sLength);
         return 1;
     }
@@ -674,7 +674,7 @@ UnicodeString ResourceDataValue::getStringOrFirstOfArray(UErrorCode &errorCode)
     }
     int32_t sLength;
     const UChar *s = res_getString(fTraceInfo, &getData(), res, &sLength);
-    if(s != NULL) {
+    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;
     }
@@ -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);
index a4e2fc6069a0b2b43447cd29beed539b6eed4a29..7f15d84890a21fc0327aac1341dc01dd5c74cd37 100644 (file)
@@ -191,17 +191,17 @@ sameScript(UScriptCode scriptOne, UScriptCode scriptTwo)
 U_CAPI UScriptRun * U_EXPORT2
 uscript_openRun(const UChar *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;
@@ -239,11 +239,11 @@ uscript_resetRun(UScriptRun *scriptRun)
 U_CAPI void U_EXPORT2
 uscript_setRunText(UScriptRun *scriptRun, const UChar *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;
     }
     
@@ -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;
     }
 
index 1ededbb268ae23a19c6db1577eac490b433bc819..055d41ea91ac5a89133441317dd59775a609f21a 100644 (file)
@@ -107,14 +107,14 @@ 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 ){
+    if(uprv_strchr(nameOrAbbrOrLocale, '-')==nullptr && uprv_strchr(nameOrAbbrOrLocale, '_')==nullptr ){
         /* try long and abbreviated script names first */
         UScriptCode code = (UScriptCode) u_getPropertyValueEnum(UCHAR_SCRIPT, nameOrAbbrOrLocale);
         if(code!=USCRIPT_INVALID_CODE) {
index 886acfafa883661176360e47c7f9616993efbc58..d4ff95b21890470239f3a56f1a871571475492c6 100644 (file)
@@ -260,7 +260,7 @@ int32_t getScriptProps(UScriptCode script) {
 U_CAPI int32_t U_EXPORT2
 uscript_getSampleString(UScriptCode script, UChar *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;
     }
index 2152693560b324d43914dbe889da411ac8466962..f90a391b8ac3482799955541666e6eda077b7582 100644 (file)
@@ -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;
index f08e760b10d4e107baf059af81f5e4b2bf65029e..3b00e24f6c3d01908ce669584c06f55f9cb6c408 100644 (file)
@@ -35,7 +35,7 @@ uset_openPattern(const UChar* pattern, int32_t patternLength,
 {
     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,7 +43,7 @@ uset_openPattern(const UChar* pattern, int32_t patternLength,
 
     if (U_FAILURE(*ec)) {
         delete set;
-        set = NULL;
+        set = nullptr;
     }
     return (USet*) set;
 }
@@ -54,8 +54,8 @@ uset_openPatternOptions(const UChar* pattern, int32_t patternLength,
                  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;
 }
@@ -77,14 +77,14 @@ uset_applyPattern(USet *set,
 
     // 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();
 }
index 3cdece5500b497a1db8f61c551acb4b1774e2dc3..d24a15ab2df0fd19268329f16adef368af479bc9 100644 (file)
@@ -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;
index babbbe52a831e86fee636896fb272e36a0fa4b53..894dc983c3fb60770af24b8c980a5bea1491699a 100644 (file)
@@ -732,7 +732,7 @@ handleGeneratedSpaces(UChar *dest, int32_t sourceLength,
 
     int32_t i = 0, j = 0;
     int32_t count = 0;
-    UChar *tempbuffer=NULL;
+    UChar *tempbuffer=nullptr;
 
     int lamAlefOption = 0;
     int tashkeelOption = 0;
@@ -748,8 +748,8 @@ handleGeneratedSpaces(UChar *dest, int32_t sourceLength,
     }
 
     tempbuffer = (UChar *)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;
     }
@@ -903,12 +903,12 @@ static int32_t
 expandCompositCharAtBegin(UChar *dest, int32_t sourceLength, int32_t destSize,UErrorCode *pErrorCode) {
     int32_t      i = 0,j = 0;
     int32_t      countl = 0;
-    UChar    *tempbuffer=NULL;
+    UChar    *tempbuffer=nullptr;
 
     tempbuffer = (UChar *)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;
     }
@@ -966,11 +966,11 @@ expandCompositCharAtEnd(UChar *dest, int32_t sourceLength, int32_t destSize,UErr
     int32_t      countr = 0;
     int32_t  inpsize = sourceLength;
 
-    UChar    *tempbuffer=NULL;
+    UChar    *tempbuffer=nullptr;
     tempbuffer = (UChar *)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;
     }
@@ -1086,7 +1086,7 @@ expandCompositChar(UChar *dest, int32_t sourceLength,
 
     int32_t      i = 0,j = 0;
 
-    UChar    *tempbuffer=NULL;
+    UChar    *tempbuffer=nullptr;
     int yehHamzaOption = 0;
     int seenTailOption = 0;
     int lamAlefOption = 0;
@@ -1156,8 +1156,8 @@ expandCompositChar(UChar *dest, int32_t sourceLength,
             destSize = calculateSize(dest,sourceLength,destSize,options);
             tempbuffer = (UChar *)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;
             }
@@ -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;
@@ -1494,7 +1494,7 @@ 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;
+        UChar *tempbuffer, *tempsource = nullptr;
         int32_t outputSize, spacesCountl=0, spacesCountr=0;
 
         if((options&U_SHAPE_AGGREGATE_TASHKEEL_MASK)>0) {
@@ -1511,7 +1511,7 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
             UChar prevLink, currLink = 0;
             int newSourceLength = 0;
             tempsource = (UChar *)uprv_malloc(2*sourceLength*U_SIZEOF_UCHAR);
-            if(tempsource == NULL) {
+            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;
         }
 
@@ -1564,15 +1564,15 @@ u_shapeArabic(const UChar *source, int32_t sourceLength,
         } else {
             tempbuffer = (UChar *)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);
         }
 
index 8175dc7fa8254d8cad40e9f04b7c2c06da3586e8..da1d2861e207a71b92e85373f5bb5549aa7816d5 100644 (file)
@@ -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,13 +148,13 @@ 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;
@@ -167,13 +167,13 @@ usprep_internal_flushCache(UBool noRefCount){
             /* 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);
@@ -193,15 +193,15 @@ usprep_flushCache(){
 */
 
 static UBool U_CALLCONV usprep_cleanup(void){
-    if (SHARED_DATA_HASHTABLE != NULL) {
+    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;
     }
 
@@ -435,7 +435,7 @@ uprv_syntaxError(const UChar* rules,
                  int32_t pos,
                  int32_t rulesLen,
                  UParseError* parseError){
-    if(parseError == NULL){
+    if(parseError == nullptr){
         return;
     }
     parseError->offset = pos;
@@ -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;
     }
@@ -663,7 +663,7 @@ usprep_prepare(   const UStringPrepProfile* profile,
     // map
     UnicodeString s1;
     UChar *b1 = s1.getBuffer(srcLength);
-    if(b1==NULL){
+    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;
         }
@@ -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;
     }
 
index 97fbc527a3749c20052f97214e706262c1ae35f9..3dafd8d642320f132454014c70a2a553cb3cccae 100644 (file)
 
 /* 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,21 +86,21 @@ 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);
     }
 }
@@ -136,14 +136,14 @@ u_uastrncpy(UChar *ucs1,
   UChar *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 */
@@ -166,7 +166,7 @@ u_uastrcpy(UChar *ucs1,
 {
   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,
@@ -208,14 +208,14 @@ u_austrncpy(char *s1,
   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 */
@@ -238,7 +238,7 @@ u_austrcpy(char *s1,
 {
   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,
index 85dfa0decb427aaead45222f4d514714c5c299f6..d6722bfaa308796e193945503e819c0ffeb67ebe 100644 (file)
@@ -170,7 +170,7 @@ int32_t CaseMap::toTitle(
         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);
@@ -216,7 +216,7 @@ ucasemap_toTitle(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);
@@ -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
index 1a6ea2375d0bb626a3be60d64948449805f01457..d298615d4141e36eecc345c80d2329bd4017942e 100644 (file)
@@ -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 */
@@ -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 *pSrcLimit =nullptr;
     const UChar *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,
@@ -237,15 +237,15 @@ u_strToWCS(wchar_t *dest,
            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
@@ -288,10 +288,10 @@ _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;
+    UChar* pTarget = nullptr;
+    UChar* pTargetLimit = nullptr;
+    UChar* target = nullptr;
     
     UChar uStack [_STACK_BUFFER_CAPACITY];
 
@@ -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;
@@ -492,15 +492,15 @@ 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
index 8037c09b4f0a97a497c4ae173307145e4e7a24dc..272d416fb4dcf206d35d9245c4c1bdcb420752ce 100644 (file)
@@ -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);
         }
     }
@@ -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) {
@@ -87,7 +87,7 @@ appendResult(UChar *dest, int32_t destIndex, int32_t destCapacity,
             length=result;
         } else if(destIndex<destCapacity && result<=0xffff) {  // BMP slightly-fastpath
             dest[destIndex++]=(UChar)result;
-            if(edits!=NULL) {
+            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);
         }
     }
@@ -145,7 +145,7 @@ 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) {
+    if(edits!=nullptr) {
         edits->addUnchanged(length);
     }
     if(options & U_OMIT_UNCHANGED_TEXT) {
@@ -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?
@@ -1229,7 +1229,7 @@ int32_t toUpper(uint32_t options,
             }
         } else {
             const UChar *s;
-            c=ucase_toFullUpper(c, NULL, NULL, &s, UCASE_LOC_GREEK);
+            c=ucase_toFullUpper(c, nullptr, nullptr, &s, UCASE_LOC_GREEK);
             destIndex = appendResult(dest, destIndex, destCapacity, c, s,
                                      nextIndex - i, options, edits);
             if (destIndex < 0) {
@@ -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)))
     ) {
@@ -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)))
     ) {
@@ -1388,7 +1388,7 @@ ustrcase_mapWithOverlap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITE
         } else {
             /* allocate a buffer */
             temp=(UChar *)uprv_malloc(destCapacity*U_SIZEOF_UCHAR);
-            if(temp==NULL) {
+            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) {
@@ -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
@@ -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*/
             }
@@ -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;
                 }
@@ -1841,7 +1841,7 @@ u_strcmpFold(const UChar *s1, int32_t length1,
              const UChar *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 */
@@ -1855,7 +1855,7 @@ u_strCaseCompare(const UChar *s1, int32_t length1,
     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;
     }
index 2ecd24f03ec02ef43607187c4da5be9b7d4bd416..59e530502192a2d16b2ead7e450af8a9a0b2bfa0 100644 (file)
@@ -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) {
index 08a1bf29c3a975d9f09767cd683483f4d3e208c0..19233a9cc8d87db997c06928e0091b6aca1b7343 100644 (file)
@@ -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 *
 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) {
+        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;
 }
@@ -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;
@@ -303,7 +303,7 @@ ucharstrenum_unext(UEnumeration* en,
                   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++];
     if (resultLength) {
@@ -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));
@@ -378,10 +378,10 @@ uenum_openCharStringsEnumeration(const char* const strings[], int32_t count,
 U_CAPI UEnumeration* U_EXPORT2
 uenum_openUCharStringsEnumeration(const UChar* 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));
index 3703dedb97db121b5423d1540187f0d10af35637..ff546ca0a1b7e7d47105c6ec0583d00448ec7ec6 100644 (file)
@@ -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;
 
index 5804976ef97333ca79632652ef2df34d5ce8813e..249c55a5b02f9c616616d1abc69f8fc7ff60b4a6 100644 (file)
@@ -37,7 +37,7 @@
 /*
  * 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) {
@@ -58,11 +58,11 @@ u_strFindFirst(const UChar *s, int32_t length,
     const UChar *start, *p, *q, *subLimit;
     UChar c, cs, cq;
 
-    if(sub==NULL || subLength<-1) {
+    if(sub==nullptr || subLength<-1) {
         return (UChar *)s;
     }
-    if(s==NULL || length<-1) {
-        return NULL;
+    if(s==nullptr || length<-1) {
+        return nullptr;
     }
 
     start=s;
@@ -84,14 +84,14 @@ u_strFindFirst(const UChar *s, int32_t length,
                 q=sub;
                 for(;;) {
                     if((cq=*q)==0) {
-                        if(isMatchAtCPBoundary(start, s-1, p, NULL)) {
+                        if(isMatchAtCPBoundary(start, s-1, p, nullptr)) {
                             return (UChar *)(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,7 +103,7 @@ u_strFindFirst(const UChar *s, int32_t length,
         }
 
         /* not found */
-        return NULL;
+        return nullptr;
     }
 
     if(subLength<0) {
@@ -132,14 +132,14 @@ u_strFindFirst(const UChar *s, int32_t length,
                 q=sub;
                 for(;;) {
                     if(q==subLimit) {
-                        if(isMatchAtCPBoundary(start, s-1, p, NULL)) {
+                        if(isMatchAtCPBoundary(start, s-1, p, nullptr)) {
                             return (UChar *)(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 */
@@ -154,7 +154,7 @@ u_strFindFirst(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 */
         }
 
         limit=s+length;
@@ -187,7 +187,7 @@ u_strFindFirst(const UChar *s, int32_t length,
     }
 
     /* not found */
-    return NULL;
+    return nullptr;
 }
 
 U_CAPI UChar * U_EXPORT2
@@ -209,7 +209,7 @@ u_strchr(const UChar *s, UChar c) {
                 return (UChar *)s;
             }
             if(cs==0) {
-                return NULL;
+                return nullptr;
             }
             ++s;
         }
@@ -230,17 +230,17 @@ u_strchr32(const UChar *s, UChar32 c) {
                 return (UChar *)(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) {
     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);
@@ -252,7 +252,7 @@ u_memchr(const UChar *s, UChar c, int32_t count) {
                 return (UChar *)s;
             }
         } while(++s!=limit);
-        return NULL;
+        return nullptr;
     }
 }
 
@@ -263,7 +263,7 @@ u_memchr32(const UChar *s, UChar32 c, int32_t count) {
         return u_memchr(s, (UChar)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 */
@@ -274,10 +274,10 @@ u_memchr32(const UChar *s, UChar32 c, int32_t count) {
                 return (UChar *)s;
             }
         } while(++s!=limit);
-        return NULL;
+        return nullptr;
     } else {
         /* not a Unicode code point, not findable */
-        return NULL;
+        return nullptr;
     }
 }
 
@@ -289,11 +289,11 @@ u_strFindLast(const UChar *s, int32_t length,
     const UChar *start, *limit, *p, *q, *subLimit;
     UChar c, cs;
 
-    if(sub==NULL || subLength<-1) {
+    if(sub==nullptr || subLength<-1) {
         return (UChar *)s;
     }
-    if(s==NULL || length<-1) {
-        return NULL;
+    if(s==nullptr || length<-1) {
+        return nullptr;
     }
 
     /*
@@ -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;
@@ -360,7 +360,7 @@ u_strFindLast(const UChar *s, int32_t length,
     }
 
     /* not found */
-    return NULL;
+    return nullptr;
 }
 
 U_CAPI UChar * U_EXPORT2
@@ -374,7 +374,7 @@ u_strrchr(const UChar *s, UChar c) {
         /* make sure to not find half of a surrogate pair */
         return u_strFindLast(s, -1, &c, 1);
     } else {
-        const UChar *result=NULL;
+        const UChar *result=nullptr;
         UChar cs;
 
         /* trivial search for a BMP code point */
@@ -397,7 +397,7 @@ u_strrchr32(const UChar *s, UChar32 c) {
         return u_strrchr(s, (UChar)c);
     } else if((uint32_t)c<=UCHAR_MAX_VALUE) {
         /* find supplementary code point as surrogate pair */
-        const UChar *result=NULL;
+        const UChar *result=nullptr;
         UChar cs, lead=U16_LEAD(c), trail=U16_TRAIL(c);
 
         while((cs=*s++)!=0) {
@@ -408,14 +408,14 @@ u_strrchr32(const UChar *s, UChar32 c) {
         return (UChar *)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) {
     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);
@@ -427,7 +427,7 @@ u_memrchr(const UChar *s, UChar c, int32_t count) {
                 return (UChar *)limit;
             }
         } while(s!=limit);
-        return NULL;
+        return nullptr;
     }
 }
 
@@ -438,7 +438,7 @@ u_memrchr32(const UChar *s, UChar32 c, int32_t count) {
         return u_memrchr(s, (UChar)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;
@@ -449,10 +449,10 @@ u_memrchr32(const UChar *s, UChar32 c, int32_t count) {
                 return (UChar *)(limit-1);
             }
         } while(s!=--limit);
-        return NULL;
+        return nullptr;
     } else {
         /* not a Unicode code point, not findable */
-        return NULL;
+        return nullptr;
     }
 }
 
@@ -544,7 +544,7 @@ u_strpbrk(const UChar *string, const UChar *matchSet)
     if(idx >= 0) {
         return (UChar *)string + idx;
     } else {
-        return NULL;
+        return nullptr;
     }
 }
 
@@ -583,8 +583,8 @@ u_strtok_r(UChar    *src,
     UChar *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,15 +611,15 @@ 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 -------------------------------------------------- */
@@ -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) {
@@ -926,7 +926,7 @@ u_strCompare(const UChar *s1, int32_t length1,
              const UChar *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);
@@ -1008,7 +1008,7 @@ U_CAPI int32_t U_EXPORT2
 u_countChar32(const UChar *s, int32_t length) {
     int32_t count;
 
-    if(s==NULL || length<-1) {
+    if(s==nullptr || length<-1) {
         return 0;
     }
 
@@ -1051,7 +1051,7 @@ u_strHasMoreChar32Than(const UChar *s, int32_t length, int32_t number) {
     if(number<0) {
         return true;
     }
-    if(s==NULL || length<-1) {
+    if(s==nullptr || length<-1) {
         return false;
     }
 
@@ -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) {                                                  \
@@ -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;          \
index dcb9dc5878323b87118d4dc3a8d5d5d7cd5dbe7c..24f2090135521a3f01c9695eaa6612f6105f9014 100644 (file)
@@ -53,22 +53,22 @@ u_strFromUTF32WithSub(UChar *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;
 
@@ -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 */
@@ -105,7 +105,7 @@ u_strFromUTF32WithSub(UChar *dest,
                 }
                 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;
     }
 
@@ -146,7 +146,7 @@ u_strFromUTF32(UChar *dest,
     return u_strFromUTF32WithSub(
             dest, destCapacity, pDestLength,
             src, srcLength,
-            U_SENTINEL, NULL,
+            U_SENTINEL, nullptr,
             pErrorCode);
 }
 
@@ -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;
     }
 
@@ -252,7 +252,7 @@ u_strToUTF32(UChar32 *dest,
     return u_strToUTF32WithSub(
             dest, destCapacity, pDestLength,
             src, srcLength,
-            U_SENTINEL, NULL,
+            U_SENTINEL, nullptr,
             pErrorCode);
 }
 
@@ -266,17 +266,17 @@ 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;
@@ -328,7 +328,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;
                     } else if(c<=0xFFFF) {
                         *(pDest++)=(UChar)c;
                     } else {
@@ -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);
                 }
@@ -433,7 +433,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;
                         } else if(c<=0xFFFF) {
                             *(pDest++)=(UChar)c;
                         } else {
@@ -470,7 +470,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;
                     } else if(c<=0xFFFF) {
                         *(pDest++)=(UChar)c;
                     } else {
@@ -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;
     }
 
@@ -546,7 +546,7 @@ u_strFromUTF8(UChar *dest,
     return u_strFromUTF8WithSub(
             dest, destCapacity, pDestLength,
             src, srcLength,
-            U_SENTINEL, NULL,
+            U_SENTINEL, nullptr,
             pErrorCode);
 }
 
@@ -564,19 +564,19 @@ u_strFromUTF8Lenient(UChar *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)
     ) {
         *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     if(srcLength < 0) {
         /* Transform a NUL-terminated string. */
-        UChar *pDestLimit = (dest!=NULL)?(dest+destCapacity):NULL;
+        UChar *pDestLimit = (dest!=nullptr)?(dest+destCapacity):nullptr;
         uint8_t t1, t2, t3; /* trail bytes */
 
         while(((ch = *pSrc) != 0) && (pDest < pDestLimit)) {
@@ -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) {
@@ -800,23 +800,23 @@ u_strToUTF8WithSub(char *dest,
     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,11 +890,11 @@ 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 UChar *pSrcLimit = (pSrc!=nullptr)?(pSrc+srcLength):nullptr;
         int32_t count;
 
         /* Faster loop without ongoing checking for pSrcLimit and pDestLimit. */
@@ -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;
     }
 
@@ -1063,7 +1063,7 @@ u_strToUTF8(char *dest,
     return u_strToUTF8WithSub(
             dest, destCapacity, pDestLength,
             pSrc, srcLength,
-            U_SENTINEL, NULL,
+            U_SENTINEL, nullptr,
             pErrorCode);
 }
 
@@ -1078,17 +1078,17 @@ 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;
@@ -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,
@@ -1234,7 +1234,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);
@@ -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;
     }
 
@@ -1326,13 +1326,13 @@ u_strToJavaModifiedUTF8(
 
     /* 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;
     }
 
     if(srcLength==-1) {
@@ -1355,7 +1355,7 @@ 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);
index 89e3d669f6e60e36126257408e8b60104ca625c2..e79b06257b9ef7a19e920b6812160e1eba59f1f2 100644 (file)
@@ -434,7 +434,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.
@@ -527,7 +527,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 +580,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 +607,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 +622,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 +635,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 +652,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 +663,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 +674,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 +683,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 +691,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 +699,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 +772,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;
 
@@ -941,7 +941,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;
@@ -1425,7 +1425,7 @@ utext_strFromUTF8(UChar *dest,
 {
 
     UChar *pDest = dest;
-    UChar *pDestLimit = (dest!=NULL)?(dest+destCapacity):NULL;
+    UChar *pDestLimit = (dest!=nullptr)?(dest+destCapacity):nullptr;
     UChar32 ch=0;
     int32_t index = 0;
     int32_t reqLength = 0;
@@ -1484,7 +1484,7 @@ utf8TextExtract(UText *ut,
     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 +1579,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 +1599,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 +1614,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 +1630,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);
@@ -1701,7 +1701,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 +1724,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;
     }
 }
 
@@ -1865,7 +1865,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) {
@@ -1908,7 +1908,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 +2025,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 +2038,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 +2077,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 +2091,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 +2113,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;
     }
 }
 
@@ -2147,7 +2147,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 +2159,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;
@@ -2184,7 +2184,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 +2279,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 +2308,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;
     }
@@ -2351,7 +2351,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)) {
@@ -2361,7 +2361,7 @@ ucstrTextClone(UText *dest, const UText * src, UBool deep, UErrorCode * status)
         // 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) {
+        if (copyStr == nullptr) {
             *status = U_MEMORY_ALLOCATION_ERROR;
         } else {
             int64_t i;
@@ -2385,7 +2385,7 @@ ucstrTextClose(UText *ut) {
     if (ut->providerProperties & I32_FLAG(UTEXT_PROVIDER_OWNS_TEXT)) {
         UChar *s = (UChar *)ut->context;
         uprv_free(s);
-        ut->context = NULL;
+        ut->context = nullptr;
     }
 }
 
@@ -2511,7 +2511,7 @@ ucstrTextExtract(UText *ut,
     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;
     }
@@ -2596,14 +2596,14 @@ 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
@@ -2613,14 +2613,14 @@ static const UChar gEmptyUString[] = {0};
 U_CAPI UText * U_EXPORT2
 utext_openUChars(UText *ut, const UChar *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 +2667,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 +2697,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;
+    UChar *buf = nullptr;
     UBool  needChunkSetup = true;
     int    i;
     if (ut->chunkNativeStart == neededIndex) {
@@ -2748,13 +2748,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();
@@ -2780,7 +2780,7 @@ charIterTextExtract(UText *ut,
     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 +2823,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,13 +2838,13 @@ 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.
index a1f9c6529a7a6235f4410cbac3dbc7e352b76981..827a82daf403a371a6c425e937f962e5dc51eb03 100644 (file)
@@ -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;
index 3dcc05578b795f587e04b4e12bff27e5c79368d2..1d7ff9b115a9a0657d72a248db2fd75941f43746 100644 (file)
@@ -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);
index f7b8ade67431a69aa485b475493d601702e4cc09..a64762bdd59d665b05dd03115e3add6df80fbbc8 100644 (file)
 #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 {
@@ -172,8 +172,8 @@ static void outputUString(const UChar *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);
+    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,13 +225,13 @@ 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. */
+            /* UChar * 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);
@@ -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,20 +323,20 @@ 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;
 
@@ -344,7 +344,7 @@ utrace_vformat(char *outBuf, int32_t capacity, int32_t indent, const char *fmt,
                             charsToOutput = 0;
                             outputUString((const UChar *)*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
 };
 
                 
index 96f2397ca13a665e7f42a5aae76c9b9a0884994d..83be0e340714ecb9980f56284128834e1e2d36c6 100644 (file)
@@ -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)) {
index 0fb74ba1c3688ceedc3af60fd15df4fb1e033b27..74f91bc8139026fda99e0331590aba1e509550c2 100644 (file)
@@ -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 {
index ace52cce37bf63b76a32f874ea90754aee98aa5a..8a204008b306c721fd86ac2691c6c0f80a8fb689 100644 (file)
@@ -619,7 +619,7 @@ public:
 
 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) :
         UTrie2StringIterator(t, p), limit(l) {}
index 2513332b80a7c49f0d37234d3cb16599a4c1222d..93656b0de4fafde87d6e56da4c2ad5bf5da43cbc 100644 (file)
@@ -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);
 }
@@ -407,28 +407,28 @@ utrie2_cloneAsThawed(const UTrie2 *other, UErrorCode *pErrorCode) {
     UChar 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;
 }
@@ -451,23 +451,23 @@ utrie2_fromUTrie(const UTrie *trie1, uint32_t errorValue, UErrorCode *pErrorCode
     UChar 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;
 }
index b01b94601e4d6f5d670d2b979c9efddb296dba87..83d183699d1011fcf5f0aadc0dabc923dfba3ec1 100644 (file)
@@ -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;
     }
index 10a4f565973d733fd630cb2890446ce32812a509..f1d757b5b9aba6126b2d59df899a6c5263e161ed 100644 (file)
@@ -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() {}
@@ -311,7 +311,7 @@ UTS46::process(const UnicodeString &src,
         return dest;
     }
     const UChar *srcArray=src.getBuffer();
-    if(&dest==&src || srcArray==NULL) {
+    if(&dest==&src || srcArray==nullptr) {
         errorCode=U_ILLEGAL_ARGUMENT_ERROR;
         dest.setToBogus();
         return dest;
@@ -325,7 +325,7 @@ UTS46::process(const UnicodeString &src,
         return dest;
     }
     UChar *destArray=dest.getBuffer(srcLength);
-    if(destArray==NULL) {
+    if(destArray==nullptr) {
         errorCode=U_MEMORY_ALLOCATION_ERROR;
         return dest;
     }
@@ -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;
     }
@@ -605,7 +605,7 @@ UTS46::mapDevChars(UnicodeString &dest, int32_t labelStart, int32_t mappingStart
     }
     int32_t length=dest.length();
     UChar *s=dest.getBuffer(dest[mappingStart]==0xdf ? length+1 : length);
-    if(s==NULL) {
+    if(s==nullptr) {
         errorCode=U_MEMORY_ALLOCATION_ERROR;
         return length;
     }
@@ -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;
                     }
@@ -726,7 +726,7 @@ UTS46::processLabel(UnicodeString &dest,
         }
         wasPunycode=true;
         UChar *unicodeBuffer=fromPunycode.getBuffer(-1);  // capacity==-1: most labels should fit
-        if(unicodeBuffer==NULL) {
+        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)) {
@@ -869,7 +869,7 @@ UTS46::processLabel(UnicodeString &dest,
                 // Contains non-ASCII characters.
                 UnicodeString punycode;
                 UChar *buffer=punycode.getBuffer(63);  // 63==maximum DNS label length
-                if(buffer==NULL) {
+                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);
@@ -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;
index 1eb7d136e7ab820a4d31f757d59ce6155073b4ad..aa5fa2a5d74b86379aa20694877e25397595fadc 100644 (file)
@@ -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);
 
index 952f51792b3213ba9de1916baaec32a7a175015e..9c42e68f1f0a579b23ac06cac65c04623a4affed 100644 (file)
@@ -30,7 +30,7 @@ UVector32::UVector32(UErrorCode &status) :
     count(0),
     capacity(0),
     maxCapacity(0),
-    elements(NULL)
+    elements(nullptr)
 {
     _init(DEFAULT_CAPACITY, status);
 }
@@ -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;
index a7fada38335d2f11d62586537eef6029c5f30f88..5aa948d2d41419aff0d929d82bc47c2f3b2a299e 100644 (file)
@@ -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;
index 8bd5cd78393f9008f6faf559f538641db6a7f77e..d6be264764adfcc59cf87aa8edce505a785f02a1 100644 (file)
@@ -27,7 +27,7 @@ UVector64::UVector64(UErrorCode &status) :
     count(0),
     capacity(0),
     maxCapacity(0),
-    elements(NULL)
+    elements(nullptr)
 {
     _init(DEFAULT_CAPACITY, status);
 }
@@ -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;
index 070e2dd67d21c5a84b116eee19c1c9dbffc880a2..56ffea076c58cb0fb3cc93fc238b529573d10cf8 100644 (file)
@@ -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;
index 3ca12703c4feb0d2f9ba226b86419114cfc28b40..044ab1cc752d9ad4cb5ec408758d307c7abad328 100644 (file)
@@ -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 
@@ -150,7 +150,7 @@ uprv_detectWindowsTimeZone()
         }
     }
 
-    // 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.
index 7f033a728348c737771f9f9c53e7c6a85ef8e539..c26be4dc650bf38bd2883ca69dd88784bd28cfff 100644 (file)
@@ -103,7 +103,7 @@ private:
 
 inline ScriptRun::ScriptRun()
 {
-    reset(NULL, 0, 0);
+    reset(nullptr, 0, 0);
 }
 
 inline ScriptRun::ScriptRun(const UChar chars[], int32_t length)
index f2d2e33b05b2b94301345783d2f3c857a86b4518..4c8a864af65b0e57f60cec5fe2588158ba561235 100644 (file)
@@ -325,7 +325,7 @@ static int printConverters(const char *pname, const char *lookfor,
                             const char *standardName;
                             UBool isFirst = true;
                             UErrorCode enumError = U_ZERO_ERROR;
-                            while ((standardName = uenum_next(nameEnum, NULL, &enumError))) {
+                            while ((standardName = uenum_next(nameEnum, nullptr, &enumError))) {
                                 /* See if this alias is supported by this standard. */
                                 if (!strcmp(standardName, alias)) {
                                     if (!t) {
@@ -518,10 +518,10 @@ cnvSigType(UConverter *cnv) {
         ucnv_fromUnicode(cnv,
             &out, buffer + sizeof(buffer),
             &in, a + 1,
-            NULL, true, &err);
+            nullptr, true, &err);
         ucnv_resetFromUnicode(cnv);
 
-        if (NULL != ucnv_detectUnicodeSignature(buffer, (int32_t)(out - buffer), NULL, &err) &&
+        if (nullptr != ucnv_detectUnicodeSignature(buffer, (int32_t)(out - buffer), nullptr, &err) &&
             U_SUCCESS(err)
         ) {
             result = CNV_ADDS_FEFF;
@@ -534,7 +534,7 @@ cnvSigType(UConverter *cnv) {
 class ConvertFile {
 public:
     ConvertFile() :
-        buf(NULL), outbuf(NULL), fromoffsets(NULL),
+        buf(nullptr), outbuf(nullptr), fromoffsets(nullptr),
         bufsz(0), signature(0) {}
 
     void
@@ -650,7 +650,7 @@ ConvertFile::convertFile(const char *pname,
 #if !UCONFIG_NO_TRANSLITERATION
     // Create transliterator as needed.
 
-    if (translit != NULL && *translit) {
+    if (translit != nullptr && *translit) {
         UParseError parse;
         UnicodeString str(translit), pestr;
 
@@ -691,7 +691,7 @@ ConvertFile::convertFile(const char *pname,
 #endif
 
     // Create codepage converter. If the codepage or its aliases weren't
-    // available, it returns NULL and a failure code. We also set the
+    // available, it returns nullptr and a failure code. We also set the
     // callbacks, and return errors in the same way.
 
     convfrom = ucnv_open(fromcpage, &err);
@@ -770,7 +770,7 @@ ConvertFile::convertFile(const char *pname,
             // Use bufsz instead of u.getCapacity() for the targetLimit
             // so that we don't overflow fromoffsets[].
             ucnv_toUnicode(convfrom, &unibufp, unibuf + bufsz, &cbufp,
-                buf + rd, useOffsets ? fromoffsets : NULL, flush, &err);
+                buf + rd, useOffsets ? fromoffsets : nullptr, flush, &err);
 
             ulen = (int32_t)(unibufp - unibuf);
             u.releaseBuffer(U_SUCCESS(err) ? ulen : 0);
@@ -862,7 +862,7 @@ ConvertFile::convertFile(const char *pname,
             // while avoiding the slower keyboard mode.
             // The end-of-chunk characters are completely included in the
             // transformed string in case they are to be transformed themselves.
-            if (t != NULL) {
+            if (t != nullptr) {
                 UnicodeString out;
                 int32_t chunkLimit;
 
@@ -929,7 +929,7 @@ ConvertFile::convertFile(const char *pname,
                 ucnv_fromUnicode(convto, &bufp, outbuf + bufsz,
                                  &unibufbp,
                                  unibuf + ulen,
-                                 NULL, (UBool)(flush && fromSawEndOfBytes), &err);
+                                 nullptr, (UBool)(flush && fromSawEndOfBytes), &err);
 
                 // toSawEndOfUnicode indicates that ucnv_fromUnicode() is done
                 // converting all of the intermediate UChars.
@@ -977,7 +977,7 @@ ConvertFile::convertFile(const char *pname,
                         ferroffset = static_cast<int32_t>(infoffset + (prevbufp - buf) + fromoffset);
                         errtag = "problemCvtFromU";
                     } else {
-                        // Do not use fromoffsets if (t != NULL) because the Unicode text may
+                        // Do not use fromoffsets if (t != nullptr) because the Unicode text may
                         // be different from what the offsets refer to.
 
                         // output file offset
index 16b9d99395b4a536b43d6c07fb60637e7e72e353..b25b666cc787b3b19f4d6a7e87fa866c3da28429 100644 (file)
@@ -64,12 +64,12 @@ namespace {
 
 UnicodeString *ownedString(const UnicodeString &s, LocalPointer<UnicodeString> &owned,
                            UErrorCode &errorCode) {
-    if (U_FAILURE(errorCode)) { return NULL; }
+    if (U_FAILURE(errorCode)) { return nullptr; }
     if (owned.isValid()) {
         return owned.orphan();
     }
     UnicodeString *p = new UnicodeString(s);
-    if (p == NULL) {
+    if (p == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
     }
     return p;
@@ -158,7 +158,7 @@ public:
             }
         }
         const AlphabeticIndex::Bucket *bucket = getBucket(*bucketList_, start);
-        if (bucket->displayBucket_ != NULL) {
+        if (bucket->displayBucket_ != nullptr) {
             bucket = bucket->displayBucket_;
         }
         return bucket->displayIndex_;
@@ -198,29 +198,29 @@ AlphabeticIndex::ImmutableIndex::getBucket(int32_t index) const {
     if (0 <= index && index < buckets_->getBucketCount()) {
         return icu::getBucket(*buckets_->immutableVisibleList_, index);
     } else {
-        return NULL;
+        return nullptr;
     }
 }
 
 AlphabeticIndex::AlphabeticIndex(const Locale &locale, UErrorCode &status)
-        : inputList_(NULL),
-          labelsIterIndex_(-1), itemsIterIndex_(0), currentBucket_(NULL),
+        : inputList_(nullptr),
+          labelsIterIndex_(-1), itemsIterIndex_(0), currentBucket_(nullptr),
           maxLabelCount_(99),
-          initialLabels_(NULL), firstCharsInScripts_(NULL),
-          collator_(NULL), collatorPrimaryOnly_(NULL),
-          buckets_(NULL) {
+          initialLabels_(nullptr), firstCharsInScripts_(nullptr),
+          collator_(nullptr), collatorPrimaryOnly_(nullptr),
+          buckets_(nullptr) {
     init(&locale, status);
 }
 
 
 AlphabeticIndex::AlphabeticIndex(RuleBasedCollator *collator, UErrorCode &status)
-        : inputList_(NULL),
-          labelsIterIndex_(-1), itemsIterIndex_(0), currentBucket_(NULL),
+        : inputList_(nullptr),
+          labelsIterIndex_(-1), itemsIterIndex_(0), currentBucket_(nullptr),
           maxLabelCount_(99),
-          initialLabels_(NULL), firstCharsInScripts_(NULL),
-          collator_(collator), collatorPrimaryOnly_(NULL),
-          buckets_(NULL) {
-    init(NULL, status);
+          initialLabels_(nullptr), firstCharsInScripts_(nullptr),
+          collator_(collator), collatorPrimaryOnly_(nullptr),
+          buckets_(nullptr) {
+    init(nullptr, status);
 }
 
 
@@ -253,22 +253,22 @@ AlphabeticIndex &AlphabeticIndex::addLabels(const Locale &locale, UErrorCode &st
 
 
 AlphabeticIndex::ImmutableIndex *AlphabeticIndex::buildImmutableIndex(UErrorCode &errorCode) {
-    if (U_FAILURE(errorCode)) { return NULL; }
+    if (U_FAILURE(errorCode)) { return nullptr; }
     // In C++, the ImmutableIndex must own its copy of the BucketList,
     // even if it contains no records, for proper memory management.
-    // We could clone the buckets_ if they are not NULL,
+    // We could clone the buckets_ if they are not nullptr,
     // but that would be worth it only if this method is called multiple times,
     // or called after using the old-style bucket iterator API.
     LocalPointer<BucketList> immutableBucketList(createBucketList(errorCode));
     LocalPointer<RuleBasedCollator> coll(collatorPrimaryOnly_->clone());
     if (immutableBucketList.isNull() || coll.isNull()) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     ImmutableIndex *immIndex = new ImmutableIndex(immutableBucketList.getAlias(), coll.getAlias());
-    if (immIndex == NULL) {
+    if (immIndex == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     // The ImmutableIndex adopted its parameter objects.
     immutableBucketList.orphan();
@@ -286,7 +286,7 @@ int32_t AlphabeticIndex::getBucketCount(UErrorCode &status) {
 
 
 int32_t AlphabeticIndex::getRecordCount(UErrorCode &status) {
-    if (U_FAILURE(status) || inputList_ == NULL) {
+    if (U_FAILURE(status) || inputList_ == nullptr) {
         return 0;
     }
     return inputList_->size();
@@ -319,7 +319,7 @@ void AlphabeticIndex::initLabels(UVector &indexCharacters, UErrorCode &errorCode
             // even if the label string sorts the same when all contractions are suppressed.
             ownedItem.adoptInstead(new UnicodeString(*item, 0, itemLength - 1));
             item = ownedItem.getAlias();
-            if (item == NULL) {
+            if (item == nullptr) {
                 errorCode = U_MEMORY_ALLOCATION_ERROR;
                 return;
             }
@@ -421,7 +421,7 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const {
     UVector indexCharacters(errorCode);
     indexCharacters.setDeleter(uprv_deleteUObject);
     initLabels(indexCharacters, errorCode);
-    if (U_FAILURE(errorCode)) { return NULL; }
+    if (U_FAILURE(errorCode)) { return nullptr; }
 
     // Variables for hasMultiplePrimaryWeights().
     UVector64 ces(errorCode);
@@ -435,28 +435,28 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const {
 
     // Helper arrays for Chinese Pinyin collation.
     Bucket *asciiBuckets[26] = {
-        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-        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,
+        nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
     };
     Bucket *pinyinBuckets[26] = {
-        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-        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,
+        nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr
     };
     UBool hasPinyin = false;
 
     LocalPointer<UVector> bucketList(new UVector(errorCode), errorCode);
     if (U_FAILURE(errorCode)) {
-        return NULL;
+        return nullptr;
     }
     bucketList->setDeleter(uprv_deleteUObject);
 
     // underflow bucket
     LocalPointer<Bucket> bucket(new Bucket(getUnderflowLabel(), emptyString_, U_ALPHAINDEX_UNDERFLOW), errorCode);
     if (U_FAILURE(errorCode)) {
-        return NULL;
+        return nullptr;
     }
     bucketList->adoptElement(bucket.orphan(), errorCode);
-    if (U_FAILURE(errorCode)) { return NULL; }
+    if (U_FAILURE(errorCode)) { return nullptr; }
 
     UnicodeString temp;
 
@@ -513,7 +513,7 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const {
                     // underflow or inflow label.
                     break;
                 }
-                if (singleBucket->displayBucket_ == NULL &&
+                if (singleBucket->displayBucket_ == nullptr &&
                         !hasMultiplePrimaryWeights(*collatorPrimaryOnly_, variableTop,
                                                    singleBucket->lowerBoundary_,
                                                    ces, errorCode)) {
@@ -526,7 +526,7 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const {
                         U_ALPHAINDEX_NORMAL),
                         errorCode);
                     if (U_FAILURE(errorCode)) {
-                        return NULL;
+                        return nullptr;
                     }
                     bucket->displayBucket_ = singleBucket;
                     bucketList->adoptElement(bucket.orphan(), errorCode);
@@ -537,13 +537,13 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const {
             }
         }
     }
-    if (U_FAILURE(errorCode)) { return NULL; }
+    if (U_FAILURE(errorCode)) { return nullptr; }
     if (bucketList->size() == 1) {
         // No real labels, show only the underflow label.
         BucketList *bl = new BucketList(bucketList.getAlias(), bucketList.getAlias());
-        if (bl == NULL) {
+        if (bl == nullptr) {
             errorCode = U_MEMORY_ALLOCATION_ERROR;
-            return NULL;
+            return nullptr;
         }
         bucketList.orphan();
         return bl;
@@ -556,24 +556,24 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const {
 
     if (hasPinyin) {
         // Redirect Pinyin buckets.
-        Bucket *asciiBucket = NULL;
+        Bucket *asciiBucket = nullptr;
         for (int32_t i = 0; i < 26; ++i) {
-            if (asciiBuckets[i] != NULL) {
+            if (asciiBuckets[i] != nullptr) {
                 asciiBucket = asciiBuckets[i];
             }
-            if (pinyinBuckets[i] != NULL && asciiBucket != NULL) {
+            if (pinyinBuckets[i] != nullptr && asciiBucket != nullptr) {
                 pinyinBuckets[i]->displayBucket_ = asciiBucket;
                 hasInvisibleBuckets = true;
             }
         }
     }
 
-    if (U_FAILURE(errorCode)) { return NULL; }
+    if (U_FAILURE(errorCode)) { return nullptr; }
     if (!hasInvisibleBuckets) {
         BucketList *bl = new BucketList(bucketList.getAlias(), bucketList.getAlias());
-        if (bl == NULL) {
+        if (bl == nullptr) {
             errorCode = U_MEMORY_ALLOCATION_ERROR;
-            return NULL;
+            return nullptr;
         }
         bucketList.orphan();
         return bl;
@@ -584,7 +584,7 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const {
     Bucket *nextBucket = getBucket(*bucketList, i);
     while (--i > 0) {
         Bucket *bucket = getBucket(*bucketList, i);
-        if (bucket->displayBucket_ != NULL) {
+        if (bucket->displayBucket_ != nullptr) {
             continue;  // skip invisible buckets
         }
         if (bucket->labelType_ == U_ALPHAINDEX_INFLOW) {
@@ -598,21 +598,21 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const {
 
     LocalPointer<UVector> publicBucketList(new UVector(errorCode), errorCode);
     if (U_FAILURE(errorCode)) {
-        return NULL;
+        return nullptr;
     }
     // Do not call publicBucketList->setDeleter():
     // This vector shares its objects with the bucketList.
     for (int32_t j = 0; j < bucketList->size(); ++j) {
         Bucket *bucket = getBucket(*bucketList, j);
-        if (bucket->displayBucket_ == NULL) {
+        if (bucket->displayBucket_ == nullptr) {
             publicBucketList->addElement(bucket, errorCode);
         }
     }
-    if (U_FAILURE(errorCode)) { return NULL; }
+    if (U_FAILURE(errorCode)) { return nullptr; }
     BucketList *bl = new BucketList(bucketList.getAlias(), publicBucketList.getAlias());
-    if (bl == NULL) {
+    if (bl == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     bucketList.orphan();
     publicBucketList.orphan();
@@ -623,11 +623,11 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const {
  * Creates an index, and buckets and sorts the list of records into the index.
  */
 void AlphabeticIndex::initBuckets(UErrorCode &errorCode) {
-    if (U_FAILURE(errorCode) || buckets_ != NULL) {
+    if (U_FAILURE(errorCode) || buckets_ != nullptr) {
         return;
     }
     buckets_ = createBucketList(errorCode);
-    if (U_FAILURE(errorCode) || inputList_ == NULL || inputList_->isEmpty()) {
+    if (U_FAILURE(errorCode) || inputList_ == nullptr || inputList_->isEmpty()) {
         return;
     }
 
@@ -649,14 +649,14 @@ void AlphabeticIndex::initBuckets(UErrorCode &errorCode) {
         nextBucket = getBucket(*buckets_->bucketList_, bucketIndex++);
         upperBoundary = &nextBucket->lowerBoundary_;
     } else {
-        nextBucket = NULL;
-        upperBoundary = NULL;
+        nextBucket = nullptr;
+        upperBoundary = nullptr;
     }
     for (int32_t i = 0; i < inputList_->size(); ++i) {
         Record *r = getRecord(*inputList_, i);
         // if the current bucket isn't the right one, find the one that is
         // We have a special flag for the last bucket so that we don't look any further
-        while (upperBoundary != NULL &&
+        while (upperBoundary != nullptr &&
                 collatorPrimaryOnly_->compare(r->name_, *upperBoundary, errorCode) >= 0) {
             currentBucket = nextBucket;
             // now reset the boundary that we compare against
@@ -664,15 +664,15 @@ void AlphabeticIndex::initBuckets(UErrorCode &errorCode) {
                 nextBucket = getBucket(*buckets_->bucketList_, bucketIndex++);
                 upperBoundary = &nextBucket->lowerBoundary_;
             } else {
-                upperBoundary = NULL;
+                upperBoundary = nullptr;
             }
         }
         // now put the record into the bucket.
         Bucket *bucket = currentBucket;
-        if (bucket->displayBucket_ != NULL) {
+        if (bucket->displayBucket_ != nullptr) {
             bucket = bucket->displayBucket_;
         }
-        if (bucket->records_ == NULL) {
+        if (bucket->records_ == nullptr) {
             LocalPointer<UVector> records(new UVector(errorCode), errorCode);
             if (U_FAILURE(errorCode)) {
                 return;
@@ -684,16 +684,16 @@ void AlphabeticIndex::initBuckets(UErrorCode &errorCode) {
 }
 
 void AlphabeticIndex::clearBuckets() {
-    if (buckets_ != NULL) {
+    if (buckets_ != nullptr) {
         delete buckets_;
-        buckets_ = NULL;
+        buckets_ = nullptr;
         internalResetBucketIterator();
     }
 }
 
 void AlphabeticIndex::internalResetBucketIterator() {
     labelsIterIndex_ = -1;
-    currentBucket_ = NULL;
+    currentBucket_ = nullptr;
 }
 
 
@@ -869,13 +869,13 @@ AlphabeticIndex &AlphabeticIndex::setMaxLabelCount(int32_t maxLabelCount, UError
 
 void AlphabeticIndex::init(const Locale *locale, UErrorCode &status) {
     if (U_FAILURE(status)) { return; }
-    if (locale == NULL && collator_ == NULL) {
+    if (locale == nullptr && collator_ == nullptr) {
         status = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
 
     initialLabels_         = new UnicodeSet();
-    if (initialLabels_ == NULL) {
+    if (initialLabels_ == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -884,25 +884,25 @@ void AlphabeticIndex::init(const Locale *locale, UErrorCode &status) {
     overflowLabel_ = inflowLabel_;
     underflowLabel_ = inflowLabel_;
 
-    if (collator_ == NULL) {
+    if (collator_ == nullptr) {
         Collator *coll = Collator::createInstance(*locale, status);
         if (U_FAILURE(status)) {
             delete coll;
             return;
         }
-        if (coll == NULL) {
+        if (coll == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
         collator_ = dynamic_cast<RuleBasedCollator *>(coll);
-        if (collator_ == NULL) {
+        if (collator_ == nullptr) {
             delete coll;
             status = U_UNSUPPORTED_ERROR;
             return;
         }
     }
     collatorPrimaryOnly_ = collator_->clone();
-    if (collatorPrimaryOnly_ == NULL) {
+    if (collatorPrimaryOnly_ == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -930,7 +930,7 @@ void AlphabeticIndex::init(const Locale *locale, UErrorCode &status) {
 
     // Chinese index characters, which are specific to each of the several Chinese tailorings,
     // take precedence over the single locale data exemplar set per language.
-    if (!addChineseIndexCharacters(status) && locale != NULL) {
+    if (!addChineseIndexCharacters(status) && locale != nullptr) {
         addIndexExemplars(*locale, status);
     }
 }
@@ -947,13 +947,13 @@ collatorComparator(const void *context, const void *left, const void *right) {
     const UnicodeString *rightString = static_cast<const UnicodeString *>(rightElement->pointer);
 
     if (leftString == rightString) {
-        // Catches case where both are NULL
+        // Catches case where both are nullptr
         return 0;
     }
-    if (leftString == NULL) {
+    if (leftString == nullptr) {
         return 1;
     }
-    if (rightString == NULL) {
+    if (rightString == nullptr) {
         return -1;
     }
     const Collator *col = static_cast<const Collator *>(context);
@@ -977,11 +977,11 @@ recordCompareFn(const void *context, const void *left, const void *right) {
 
 UVector *AlphabeticIndex::firstStringsInScript(UErrorCode &status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     LocalPointer<UVector> dest(new UVector(status), status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     dest->setDeleter(uprv_deleteUObject);
     // Fetch the script-first-primary contractions which are defined in the root collator.
@@ -989,11 +989,11 @@ UVector *AlphabeticIndex::firstStringsInScript(UErrorCode &status) {
     UnicodeSet set;
     collatorPrimaryOnly_->internalAddContractions(0xFDD1, set, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     if (set.isEmpty()) {
         status = U_UNSUPPORTED_ERROR;
-        return NULL;
+        return nullptr;
     }
     UnicodeSetIterator iter(set);
     while (iter.next()) {
@@ -1059,7 +1059,7 @@ AlphabeticIndex & AlphabeticIndex::addRecord(const UnicodeString &name, const vo
     if (U_FAILURE(status)) {
         return *this;
     }
-    if (inputList_ == NULL) {
+    if (inputList_ == nullptr) {
         LocalPointer<UVector> inputList(new UVector(status), status);
         if (U_FAILURE(status)) {
             return *this;
@@ -1082,7 +1082,7 @@ AlphabeticIndex & AlphabeticIndex::addRecord(const UnicodeString &name, const vo
 
 
 AlphabeticIndex &AlphabeticIndex::clearRecords(UErrorCode &status) {
-    if (U_SUCCESS(status) && inputList_ != NULL && !inputList_->isEmpty()) {
+    if (U_SUCCESS(status) && inputList_ != nullptr && !inputList_->isEmpty()) {
         inputList_->removeAllElements();
         clearBuckets();
     }
@@ -1107,7 +1107,7 @@ UBool AlphabeticIndex::nextBucket(UErrorCode &status) {
     if (U_FAILURE(status)) {
         return false;
     }
-    if (buckets_ == NULL && currentBucket_ != NULL) {
+    if (buckets_ == nullptr && currentBucket_ != nullptr) {
         status = U_ENUM_OUT_OF_SYNC_ERROR;
         return false;
     }
@@ -1126,7 +1126,7 @@ UBool AlphabeticIndex::nextBucket(UErrorCode &status) {
 }
 
 const UnicodeString &AlphabeticIndex::getBucketLabel() const {
-    if (currentBucket_ != NULL) {
+    if (currentBucket_ != nullptr) {
         return currentBucket_->label_;
     } else {
         return emptyString_;
@@ -1135,7 +1135,7 @@ const UnicodeString &AlphabeticIndex::getBucketLabel() const {
 
 
 UAlphabeticIndexLabelType AlphabeticIndex::getBucketLabelType() const {
-    if (currentBucket_ != NULL) {
+    if (currentBucket_ != nullptr) {
         return currentBucket_->labelType_;
     } else {
         return U_ALPHAINDEX_NORMAL;
@@ -1144,7 +1144,7 @@ UAlphabeticIndexLabelType AlphabeticIndex::getBucketLabelType() const {
 
 
 int32_t AlphabeticIndex::getBucketRecordCount() const {
-    if (currentBucket_ != NULL && currentBucket_->records_ != NULL) {
+    if (currentBucket_ != nullptr && currentBucket_->records_ != nullptr) {
         return currentBucket_->records_->size();
     } else {
         return 0;
@@ -1165,17 +1165,17 @@ UBool AlphabeticIndex::nextRecord(UErrorCode &status) {
     if (U_FAILURE(status)) {
         return false;
     }
-    if (currentBucket_ == NULL) {
+    if (currentBucket_ == nullptr) {
         // We are trying to iterate over the items in a bucket, but there is no
         // current bucket from the enumeration of buckets.
         status = U_INVALID_STATE_ERROR;
         return false;
     }
-    if (buckets_ == NULL) {
+    if (buckets_ == nullptr) {
         status = U_ENUM_OUT_OF_SYNC_ERROR;
         return false;
     }
-    if (currentBucket_->records_ == NULL) {
+    if (currentBucket_->records_ == nullptr) {
         return false;
     }
     ++itemsIterIndex_;
@@ -1189,7 +1189,7 @@ UBool AlphabeticIndex::nextRecord(UErrorCode &status) {
 
 const UnicodeString &AlphabeticIndex::getRecordName() const {
     const UnicodeString *retStr = &emptyString_;
-    if (currentBucket_ != NULL && currentBucket_->records_ != NULL &&
+    if (currentBucket_ != nullptr && currentBucket_->records_ != nullptr &&
         itemsIterIndex_ >= 0 &&
         itemsIterIndex_ < currentBucket_->records_->size()) {
             Record *item = static_cast<Record *>(currentBucket_->records_->elementAt(itemsIterIndex_));
@@ -1199,8 +1199,8 @@ const UnicodeString &AlphabeticIndex::getRecordName() const {
 }
 
 const void *AlphabeticIndex::getRecordData() const {
-    const void *retPtr = NULL;
-    if (currentBucket_ != NULL && currentBucket_->records_ != NULL &&
+    const void *retPtr = nullptr;
+    if (currentBucket_ != nullptr && currentBucket_->records_ != nullptr &&
         itemsIterIndex_ >= 0 &&
         itemsIterIndex_ < currentBucket_->records_->size()) {
             Record *item = static_cast<Record *>(currentBucket_->records_->elementAt(itemsIterIndex_));
@@ -1221,8 +1221,8 @@ AlphabeticIndex::Bucket::Bucket(const UnicodeString &label,
                                 const UnicodeString &lowerBoundary,
                                 UAlphabeticIndexLabelType type)
         : label_(label), lowerBoundary_(lowerBoundary), labelType_(type),
-          displayBucket_(NULL), displayIndex_(-1),
-          records_(NULL) {
+          displayBucket_(nullptr), displayIndex_(-1),
+          records_(nullptr) {
 }
 
 
index e10ff479ddd5dcd282621700bb75239f7bc0db94..c97b69404f33bfbc067ff6f7ddd73039f02b1eca 100644 (file)
@@ -187,10 +187,10 @@ AnyTransliterator::AnyTransliterator(const UnicodeString& id,
                                      const UnicodeString& theVariant,
                                      UScriptCode theTargetScript,
                                      UErrorCode& ec) :
-    Transliterator(id, NULL),
+    Transliterator(id, nullptr),
     targetScript(theTargetScript)
 {
-    cache = uhash_openSize(uhash_hashLong, uhash_compareLong, NULL, ANY_TRANS_CACHE_INIT_SIZE, &ec);
+    cache = uhash_openSize(uhash_hashLong, uhash_compareLong, nullptr, ANY_TRANS_CACHE_INIT_SIZE, &ec);
     if (U_FAILURE(ec)) {
         return;
     }
@@ -216,7 +216,7 @@ AnyTransliterator::AnyTransliterator(const AnyTransliterator& o) :
 {
     // Don't copy the cache contents
     UErrorCode ec = U_ZERO_ERROR;
-    cache = uhash_openSize(uhash_hashLong, uhash_compareLong, NULL, ANY_TRANS_CACHE_INIT_SIZE, &ec);
+    cache = uhash_openSize(uhash_hashLong, uhash_compareLong, nullptr, ANY_TRANS_CACHE_INIT_SIZE, &ec);
     if (U_FAILURE(ec)) {
         return;
     }
@@ -248,7 +248,7 @@ void AnyTransliterator::handleTransliterate(Replaceable& text, UTransPosition& p
         // our target or target/variant
         Transliterator* t = getTransliterator(it.scriptCode);
 
-        if (t == NULL) {
+        if (t == nullptr) {
             // We have no transliterator.  Do nothing, but keep
             // pos.start up to date.
             pos.start = it.limit;
@@ -280,40 +280,40 @@ void AnyTransliterator::handleTransliterate(Replaceable& text, UTransPosition& p
 Transliterator* AnyTransliterator::getTransliterator(UScriptCode source) const {
 
     if (source == targetScript || source == USCRIPT_INVALID_CODE) {
-        return NULL;
+        return nullptr;
     }
 
-    Transliterator* t = NULL;
+    Transliterator* t = nullptr;
     {
-        Mutex m(NULL);
+        Mutex m(nullptr);
         t = (Transliterator*) uhash_iget(cache, (int32_t) source);
     }
-    if (t == NULL) {
+    if (t == nullptr) {
         UErrorCode ec = U_ZERO_ERROR;
         UnicodeString sourceName(uscript_getShortName(source), -1, US_INV);
         UnicodeString id(sourceName);
         id.append(TARGET_SEP).append(target);
 
         t = Transliterator::createInstance(id, UTRANS_FORWARD, ec);
-        if (U_FAILURE(ec) || t == NULL) {
+        if (U_FAILURE(ec) || t == nullptr) {
             delete t;
 
             // Try to pivot around Latin, our most common script
             id = sourceName;
             id.append(LATIN_PIVOT, -1).append(target);
             t = Transliterator::createInstance(id, UTRANS_FORWARD, ec);
-            if (U_FAILURE(ec) || t == NULL) {
+            if (U_FAILURE(ec) || t == nullptr) {
                 delete t;
-                t = NULL;
+                t = nullptr;
             }
         }
 
-        if (t != NULL) {
-            Transliterator *rt = NULL;
+        if (t != nullptr) {
+            Transliterator *rt = nullptr;
             {
-                Mutex m(NULL);
+                Mutex m(nullptr);
                 rt = static_cast<Transliterator *> (uhash_iget(cache, (int32_t) source));
-                if (rt == NULL) {
+                if (rt == nullptr) {
                     // Common case, no race to cache this new transliterator.
                     uhash_iput(cache, (int32_t) source, t, &ec);
                 } else {
@@ -341,7 +341,7 @@ static UScriptCode scriptNameToCode(const UnicodeString& name) {
 
     if (isInvariant) {
         name.extract(0, nameLen, buf, (int32_t)sizeof(buf), US_INV);
-        buf[127] = 0;   // Make sure that we NULL terminate the string.
+        buf[127] = 0;   // Make sure that we nullptr terminate the string.
     }
     if (!isInvariant || uscript_getCode(buf, &code, 1, &ec) != 1 || U_FAILURE(ec))
     {
index 67ebb2e7d2f2ed1dab7a1be32f36941ce14b6e7e..9aa7eef2ce7327f919b7a91eafd1fd5d71e39c23 100644 (file)
@@ -107,7 +107,7 @@ private:
 
     /**
      * Returns a transliterator from the given source to our target or
-     * target/variant.  Returns NULL if the source is the same as our
+     * target/variant.  Returns nullptr if the source is the same as our
      * target script, or if the source is USCRIPT_INVALID_CODE.
      * Caches the result and returns the same transliterator the next
      * time.  The caller does NOT own the result and must not delete
index cf9b4769ecc0f9bfee1e4d3b44eca9b753287304..40f9fe3e367a4922a4a53e5d2386f5448e4c46a6 100644 (file)
@@ -44,8 +44,8 @@ static void debug_astro_msg(const char *pat, ...)
 #include "unicode/ustring.h"
 static const char * debug_astro_date(UDate d) {
   static char gStrBuf[1024];
-  static DateFormat *df = NULL;
-  if(df == NULL) {
+  static DateFormat *df = nullptr;
+  if(df == nullptr) {
     df = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::MEDIUM, Locale::getUS());
     df->adoptTimeZone(TimeZone::getGMT()->clone());
   }
@@ -1532,13 +1532,13 @@ UnicodeString CalendarAstronomer::Horizon::toString() const
 
 void CalendarCache::createCache(CalendarCache** cache, UErrorCode& status) {
     ucln_i18n_registerCleanup(UCLN_I18N_ASTRO_CALENDAR, calendar_astro_cleanup);
-    if(cache == NULL) {
+    if(cache == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
     } else {
         *cache = new CalendarCache(32, status);
         if(U_FAILURE(status)) {
             delete *cache;
-            *cache = NULL;
+            *cache = nullptr;
         }
     }
 }
@@ -1551,7 +1551,7 @@ int32_t CalendarCache::get(CalendarCache** cache, int32_t key, UErrorCode &statu
     }
     umtx_lock(&ccLock);
 
-    if(*cache == NULL) {
+    if(*cache == nullptr) {
         createCache(cache, status);
         if(U_FAILURE(status)) {
             umtx_unlock(&ccLock);
@@ -1572,7 +1572,7 @@ void CalendarCache::put(CalendarCache** cache, int32_t key, int32_t value, UErro
     }
     umtx_lock(&ccLock);
 
-    if(*cache == NULL) {
+    if(*cache == nullptr) {
         createCache(cache, status);
         if(U_FAILURE(status)) {
             umtx_unlock(&ccLock);
@@ -1587,12 +1587,12 @@ void CalendarCache::put(CalendarCache** cache, int32_t key, int32_t value, UErro
 }
 
 CalendarCache::CalendarCache(int32_t size, UErrorCode &status) {
-    fTable = uhash_openSize(uhash_hashLong, uhash_compareLong, NULL, size, &status);
+    fTable = uhash_openSize(uhash_hashLong, uhash_compareLong, nullptr, size, &status);
     U_DEBUG_ASTRO_MSG(("%p: Opening.\n", fTable));
 }
 
 CalendarCache::~CalendarCache() {
-    if(fTable != NULL) {
+    if(fTable != nullptr) {
         U_DEBUG_ASTRO_MSG(("%p: Closing.\n", fTable));
         uhash_close(fTable);
     }
index dfc3aea6cbc41a54b6a76b7367b6131d001810bf..2490fadcc91f7acc4785e9f97e1f17f9289ce5dd 100644 (file)
@@ -131,17 +131,17 @@ BasicTimeZone::hasEquivalentTransitions(const BasicTimeZone& tz, UDate start, UD
 void
 BasicTimeZone::getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial,
         AnnualTimeZoneRule*& std, AnnualTimeZoneRule*& dst, UErrorCode& status) const {
-    initial = NULL;
-    std = NULL;
-    dst = NULL;
+    initial = nullptr;
+    std = nullptr;
+    dst = nullptr;
     if (U_FAILURE(status)) {
         return;
     }
     int32_t initialRaw, initialDst;
     UnicodeString initialName;
 
-    AnnualTimeZoneRule *ar1 = NULL;
-    AnnualTimeZoneRule *ar2 = NULL;
+    AnnualTimeZoneRule *ar1 = nullptr;
+    AnnualTimeZoneRule *ar2 = nullptr;
     UnicodeString name;
 
     UBool avail;
@@ -207,12 +207,12 @@ BasicTimeZone::getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial,
                                 || initialDst != tr.getTo()->getDSTSavings()) {
                             // We cannot use this rule as the second transition rule
                             delete ar2;
-                            ar2 = NULL;
+                            ar2 = nullptr;
                         }
                     }
                 }
             }
-            if (ar2 == NULL) {
+            if (ar2 == nullptr) {
                 // Try previous transition
                 avail = getPreviousTransition(date, true, tr);
                 if (avail) {
@@ -238,15 +238,15 @@ BasicTimeZone::getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial,
                         if (!avail || d <= nextTransitionTime) {
                             // We cannot use this rule as the second transition rule
                             delete ar2;
-                            ar2 = NULL;
+                            ar2 = nullptr;
                         }
                     }
                 }
             }
-            if (ar2 == NULL) {
+            if (ar2 == nullptr) {
                 // Cannot find a good pair of AnnualTimeZoneRule
                 delete ar1;
-                ar1 = NULL;
+                ar1 = nullptr;
             } else {
                 // The initial rule should represent the rule before the previous transition
                 ar1->getName(initialName);
@@ -274,7 +274,7 @@ BasicTimeZone::getSimpleRulesNear(UDate date, InitialTimeZoneRule*& initial,
     initial = new InitialTimeZoneRule(initialName, initialRaw, initialDst);
 
     // Set the standard and daylight saving rules
-    if (ar1 != NULL && ar2 != NULL) {
+    if (ar1 != nullptr && ar2 != nullptr) {
         if (ar1->getDSTSavings() != 0) {
             dst = ar1;
             std = ar2;
@@ -405,7 +405,7 @@ BasicTimeZone::getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial,
         }
         const TimeArrayTimeZoneRule *tar = dynamic_cast<const TimeArrayTimeZoneRule *>(toRule);
         const AnnualTimeZoneRule *ar;
-        if (tar != NULL) {
+        if (tar != nullptr) {
             // Get the previous raw offset and DST savings before the very first start time
             TimeZoneTransition tzt0;
             t = start;
@@ -472,7 +472,7 @@ BasicTimeZone::getTimeZoneRulesAfter(UDate start, InitialTimeZoneRule*& initial,
                     }
                 }
             }
-        } else if ((ar = dynamic_cast<const AnnualTimeZoneRule *>(toRule)) != NULL) {
+        } else if ((ar = dynamic_cast<const AnnualTimeZoneRule *>(toRule)) != nullptr) {
             ar->getFirstStart(tzt.getFrom()->getRawOffset(), tzt.getFrom()->getDSTSavings(), firstStart);
             if (firstStart == tzt.getTime()) {
                 // Just add the rule as is
index f0ec8407db2c05e0e594d54575edff8240e810fd..c62911e785a7f70baba5dd6f2688c08593a4243b 100644 (file)
@@ -43,7 +43,7 @@ static const UChar SPACE       = 32;  // ' '
  */
 BreakTransliterator::BreakTransliterator(UnicodeFilter* adoptedFilter) :
         Transliterator(UNICODE_STRING("Any-BreakInternal", 17), adoptedFilter),
-        cachedBI(NULL), cachedBoundaries(NULL), fInsertion(SPACE) {
+        cachedBI(nullptr), cachedBoundaries(nullptr), fInsertion(SPACE) {
     }
 
 
@@ -57,7 +57,7 @@ BreakTransliterator::~BreakTransliterator() {
  * Copy constructor.
  */
 BreakTransliterator::BreakTransliterator(const BreakTransliterator& o) :
-        Transliterator(o), cachedBI(NULL), cachedBoundaries(NULL), fInsertion(o.fInsertion) {
+        Transliterator(o), cachedBI(nullptr), cachedBoundaries(nullptr), fInsertion(o.fInsertion) {
 }
 
 
@@ -182,7 +182,7 @@ void BreakTransliterator::setInsertion(const UnicodeString &insertion) {
 UnicodeString BreakTransliterator::replaceableAsString(Replaceable &r) {
     UnicodeString s;
     UnicodeString *rs = dynamic_cast<UnicodeString *>(&r);
-    if (rs != NULL) {
+    if (rs != nullptr) {
         s = *rs;
     } else {
         r.extractBetween(0, r.length(), s);
index c67525140abb3b7f6e46b035c810f7b53c04d267..59756e3e528795217689f4133130c2fcf1586235 100644 (file)
@@ -65,7 +65,7 @@
 #include "ulocimp.h"
 
 #if !UCONFIG_NO_SERVICE
-static icu::ICULocaleService* gService = NULL;
+static icu::ICULocaleService* gService = nullptr;
 static icu::UInitOnce gServiceInitOnce {};
 
 // INTERNAL - for cleanup
@@ -74,7 +74,7 @@ static UBool calendar_cleanup(void) {
 #if !UCONFIG_NO_SERVICE
     if (gService) {
         delete gService;
-        gService = NULL;
+        gService = nullptr;
     }
     gServiceInitOnce.reset();
 #endif
@@ -176,7 +176,7 @@ static const char * const gCalTypes[] = {
     "islamic-umalqura",
     "islamic-tbla",
     "islamic-rgsa",
-    NULL
+    nullptr
 };
 
 // Must be in the order of gCalTypes above
@@ -229,7 +229,7 @@ const SharedCalendar *LocaleCacheKey<SharedCalendar>::createObject(
 }
 
 static ECalType getCalendarType(const char *s) {
-    for (int i = 0; gCalTypes[i] != NULL; i++) {
+    for (int i = 0; gCalTypes[i] != nullptr; i++) {
         if (uprv_stricmp(s, gCalTypes[i]) == 0) {
             return (ECalType)i;
         }
@@ -302,16 +302,16 @@ static ECalType getCalendarTypeForLocale(const char *locid) {
     }
 
     // Read preferred calendar values from supplementalData calendarPreference
-    UResourceBundle *rb = ures_openDirect(NULL, "supplementalData", &status);
+    UResourceBundle *rb = ures_openDirect(nullptr, "supplementalData", &status);
     ures_getByKey(rb, "calendarPreferenceData", rb, &status);
-    UResourceBundle *order = ures_getByKey(rb, region, NULL, &status);
-    if (status == U_MISSING_RESOURCE_ERROR && rb != NULL) {
+    UResourceBundle *order = ures_getByKey(rb, region, nullptr, &status);
+    if (status == U_MISSING_RESOURCE_ERROR && rb != nullptr) {
         status = U_ZERO_ERROR;
-        order = ures_getByKey(rb, "001", NULL, &status);
+        order = ures_getByKey(rb, "001", nullptr, &status);
     }
 
     calTypeBuf[0] = 0;
-    if (U_SUCCESS(status) && order != NULL) {
+    if (U_SUCCESS(status) && order != nullptr) {
         // the first calendar type is the default for the region
         int32_t len = 0;
         const UChar *uCalType = ures_getStringByIndex(order, 0, &len, &status);
@@ -431,7 +431,7 @@ protected:
     virtual void updateVisibleIDs(Hashtable& result, UErrorCode& status) const override
     {
         if (U_SUCCESS(status)) {
-            for(int32_t i=0;gCalTypes[i] != NULL;i++) {
+            for(int32_t i=0;gCalTypes[i] != nullptr;i++) {
                 UnicodeString id((UChar)0x40); /* '@' a variant character */
                 id.append(UNICODE_STRING_SIMPLE("calendar="));
                 id.append(UnicodeString(gCalTypes[i], -1, US_INV));
@@ -445,7 +445,7 @@ protected:
            return nullptr;
         }
 #ifdef U_DEBUG_CALSVC
-        if(dynamic_cast<const LocaleKey*>(&key) == NULL) {
+        if(dynamic_cast<const LocaleKey*>(&key) == nullptr) {
             fprintf(stderr, "::create - not a LocaleKey!\n");
         }
 #endif
@@ -471,7 +471,7 @@ protected:
 
             fprintf(stderr, "BasicCalendarFactory - not handling %s.[%s]\n", (const char*) curLoc.getName(), tmp );
 #endif
-            return NULL;
+            return nullptr;
         }
 
         return createStandardCalendar(getCalendarType(keyword), canLoc, status);
@@ -526,7 +526,7 @@ public:
 
     virtual UObject* cloneInstance(UObject* instance) const override {
         UnicodeString *s = dynamic_cast<UnicodeString *>(instance);
-        if(s != NULL) {
+        if(s != nullptr) {
             return s->clone();
         } else {
 #ifdef U_DEBUG_CALSVC_F
@@ -592,7 +592,7 @@ initCalendarService(UErrorCode &status)
     }
     ucln_i18n_registerCleanup(UCLN_I18N_CALENDAR, calendar_cleanup);
     gService = new CalendarService();
-    if (gService == NULL) {
+    if (gService == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
         return;
         }
@@ -612,7 +612,7 @@ initCalendarService(UErrorCode &status)
             fprintf(stderr, "err (%s) registering classes, deleting service.....\n", u_errorName(status));
 #endif
         delete gService;
-        gService = NULL;
+        gService = nullptr;
     }
         }
 
@@ -729,7 +729,7 @@ fAreFieldsVirtuallySet(false),
 fNextStamp((int32_t)kMinimumUserStamp),
 fTime(0),
 fLenient(true),
-fZone(NULL),
+fZone(nullptr),
 fRepeatedWallTime(UCAL_WALLTIME_LAST),
 fSkippedWallTime(UCAL_WALLTIME_LAST)
 {
@@ -740,10 +740,10 @@ fSkippedWallTime(UCAL_WALLTIME_LAST)
         return;
     }
     fZone = TimeZone::createDefault();
-    if (fZone == NULL) {
+    if (fZone == nullptr) {
         success = U_MEMORY_ALLOCATION_ERROR;
     }
-    setWeekData(Locale::getDefault(), NULL, success);
+    setWeekData(Locale::getDefault(), nullptr, success);
 }
 
 // -------------------------------------
@@ -757,7 +757,7 @@ fAreFieldsVirtuallySet(false),
 fNextStamp((int32_t)kMinimumUserStamp),
 fTime(0),
 fLenient(true),
-fZone(NULL),
+fZone(nullptr),
 fRepeatedWallTime(UCAL_WALLTIME_LAST),
 fSkippedWallTime(UCAL_WALLTIME_LAST)
 {
@@ -778,7 +778,7 @@ fSkippedWallTime(UCAL_WALLTIME_LAST)
 
     clear();
     fZone = zone;
-    setWeekData(aLocale, NULL, success);
+    setWeekData(aLocale, nullptr, success);
 }
 
 // -------------------------------------
@@ -792,7 +792,7 @@ fAreFieldsVirtuallySet(false),
 fNextStamp((int32_t)kMinimumUserStamp),
 fTime(0),
 fLenient(true),
-fZone(NULL),
+fZone(nullptr),
 fRepeatedWallTime(UCAL_WALLTIME_LAST),
 fSkippedWallTime(UCAL_WALLTIME_LAST)
 {
@@ -803,10 +803,10 @@ fSkippedWallTime(UCAL_WALLTIME_LAST)
     }
     clear();
     fZone = zone.clone();
-    if (fZone == NULL) {
+    if (fZone == nullptr) {
         success = U_MEMORY_ALLOCATION_ERROR;
     }
-    setWeekData(aLocale, NULL, success);
+    setWeekData(aLocale, nullptr, success);
 }
 
 // -------------------------------------
@@ -821,7 +821,7 @@ Calendar::~Calendar()
 Calendar::Calendar(const Calendar &source)
 :   UObject(source)
 {
-    fZone = NULL;
+    fZone = nullptr;
     *this = source;
 }
 
@@ -843,8 +843,8 @@ Calendar::operator=(const Calendar &right)
         fRepeatedWallTime        = right.fRepeatedWallTime;
         fSkippedWallTime         = right.fSkippedWallTime;
         delete fZone;
-        fZone = NULL;
-        if (right.fZone != NULL) {
+        fZone = nullptr;
+        if (right.fZone != nullptr) {
             fZone                = right.fZone->clone();
         }
         fFirstDayOfWeek          = right.fFirstDayOfWeek;
@@ -894,11 +894,11 @@ Calendar::createInstance(const Locale& aLocale, UErrorCode& success)
 Calendar * U_EXPORT2
 Calendar::makeInstance(const Locale& aLocale, UErrorCode& success) {
     if (U_FAILURE(success)) {
-        return NULL;
+        return nullptr;
     }
 
     Locale actualLoc;
-    UObject* u = NULL;
+    UObject* u = nullptr;
 
 #if !UCONFIG_NO_SERVICE
     if (isCalendarServiceUsed()) {
@@ -909,18 +909,18 @@ Calendar::makeInstance(const Locale& aLocale, UErrorCode& success) {
     {
         u = createStandardCalendar(getCalendarTypeForLocale(aLocale.getName()), aLocale, success);
     }
-    Calendar* c = NULL;
+    Calendar* c = nullptr;
 
     if(U_FAILURE(success) || !u) {
         if(U_SUCCESS(success)) { // Propagate some kind of err
             success = U_INTERNAL_PROGRAM_ERROR;
         }
-        return NULL;
+        return nullptr;
     }
 
 #if !UCONFIG_NO_SERVICE
     const UnicodeString* str = dynamic_cast<const UnicodeString*>(u);
-    if(str != NULL) {
+    if(str != nullptr) {
         // It's a unicode string telling us what type of calendar to load ("gregorian", etc)
         // Create a Locale over this string
         Locale l("");
@@ -932,7 +932,7 @@ Calendar::makeInstance(const Locale& aLocale, UErrorCode& success) {
 
         Locale actualLoc2;
         delete u;
-        u = NULL;
+        u = nullptr;
 
         // Don't overwrite actualLoc, since the actual loc from this call
         // may be something like "@calendar=gregorian" -- TODO investigate
@@ -943,11 +943,11 @@ Calendar::makeInstance(const Locale& aLocale, UErrorCode& success) {
             if(U_SUCCESS(success)) {
                 success = U_INTERNAL_PROGRAM_ERROR; // Propagate some err
             }
-            return NULL;
+            return nullptr;
         }
 
         str = dynamic_cast<const UnicodeString*>(c);
-        if(str != NULL) {
+        if(str != nullptr) {
             // recursed! Second lookup returned a UnicodeString.
             // Perhaps DefaultCalendar{} was set to another locale.
 #ifdef U_DEBUG_CALSVC
@@ -965,7 +965,7 @@ Calendar::makeInstance(const Locale& aLocale, UErrorCode& success) {
 #endif
             success = U_MISSING_RESOURCE_ERROR;  // requested a calendar type which could NOT be found.
             delete c;
-            return NULL;
+            return nullptr;
         }
 #ifdef U_DEBUG_CALSVC
         fprintf(stderr, "%p: setting week count data to locale %s, actual locale %s\n", c, (const char*)aLocale.getName(), (const char *)actualLoc.getName());
@@ -994,16 +994,16 @@ Calendar* U_EXPORT2
 Calendar::createInstance(TimeZone* zone, const Locale& aLocale, UErrorCode& success)
 {
     LocalPointer<TimeZone> zonePtr(zone);
-    const SharedCalendar *shared = NULL;
+    const SharedCalendar *shared = nullptr;
     UnifiedCache::getByLocale(aLocale, shared, success);
     if (U_FAILURE(success)) {
-        return NULL;
+        return nullptr;
     }
     Calendar *c = (*shared)->clone();
     shared->removeRef();
-    if (c == NULL) {
+    if (c == nullptr) {
         success = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     // Now, reset calendar to default state:
@@ -1033,7 +1033,7 @@ Calendar::getCalendarTypeFromLocale(
         char *typeBuffer,
         int32_t typeBufferSize,
         UErrorCode &success) {
-    const SharedCalendar *shared = NULL;
+    const SharedCalendar *shared = nullptr;
     UnifiedCache::getByLocale(aLocale, shared, success);
     if (U_FAILURE(success)) {
         return;
@@ -1117,7 +1117,7 @@ Calendar::getKeywordValuesForLocale(const char* key,
                                                         commonlyUsed, &status);
     if (U_FAILURE(status)) {
         uenum_close(uenum);
-        return NULL;
+        return nullptr;
     }
     UStringEnumeration* ustringenum = new UStringEnumeration(uenum);
     if (ustringenum == nullptr) {
@@ -2360,8 +2360,8 @@ int32_t Calendar::fieldDifference(UDate targetMs, UCalendarDateFields field, UEr
 void
 Calendar::adoptTimeZone(TimeZone* zone)
 {
-    // Do nothing if passed-in zone is NULL
-    if (zone == NULL) return;
+    // Do nothing if passed-in zone is nullptr
+    if (zone == nullptr) return;
 
     // fZone should always be non-null
     delete fZone;
@@ -2383,7 +2383,7 @@ Calendar::setTimeZone(const TimeZone& zone)
 const TimeZone&
 Calendar::getTimeZone() const
 {
-    U_ASSERT(fZone != NULL);
+    U_ASSERT(fZone != nullptr);
     return *fZone;
 }
 
@@ -2394,9 +2394,9 @@ Calendar::orphanTimeZone()
 {
     // we let go of the time zone; the new time zone is the system default time zone
     TimeZone *defaultZone = TimeZone::createDefault();
-    if (defaultZone == NULL) {
-        // No error handling available. Must keep fZone non-NULL, there are many unchecked uses.
-        return NULL;
+    if (defaultZone == nullptr) {
+        // No error handling available. Must keep fZone non-nullptr, there are many unchecked uses.
+        return nullptr;
     }
     TimeZone *z = fZone;
     fZone = defaultZone;
@@ -2564,7 +2564,7 @@ Calendar::isWeekend(UDate date, UErrorCode &status) const
     }
     // clone the calendar so we don't mess with the real one.
     Calendar *work = this->clone();
-    if (work == NULL) {
+    if (work == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return false;
     }
@@ -2726,7 +2726,7 @@ Calendar::getActualMinimum(UCalendarDateFields field, UErrorCode& status) const
     // clone the calendar so we don't mess with the real one, and set it to
     // accept anything for the field values
     Calendar *work = this->clone();
-    if (work == NULL) {
+    if (work == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return 0;
     }
@@ -3890,12 +3890,12 @@ Calendar::setWeekData(const Locale& desiredLocale, const char *type, UErrorCode&
 
     // Get the monthNames resource bundle for the calendar 'type'. Fallback to gregorian if the resource is not
     // found.
-    LocalUResourceBundlePointer calData(ures_open(NULL, useLocale.getBaseName(), &status));
+    LocalUResourceBundlePointer calData(ures_open(nullptr, useLocale.getBaseName(), &status));
     ures_getByKey(calData.getAlias(), gCalendar, calData.getAlias(), &status);
 
     LocalUResourceBundlePointer monthNames;
-    if (type != NULL && *type != '\0' && uprv_strcmp(type, gGregorian) != 0) {
-        monthNames.adoptInstead(ures_getByKeyWithFallback(calData.getAlias(), type, NULL, &status));
+    if (type != nullptr && *type != '\0' && uprv_strcmp(type, gGregorian) != 0) {
+        monthNames.adoptInstead(ures_getByKeyWithFallback(calData.getAlias(), type, nullptr, &status));
         ures_getByKeyWithFallback(monthNames.getAlias(), gMonthNames,
                                   monthNames.getAlias(), &status);
     }
@@ -3921,12 +3921,12 @@ Calendar::setWeekData(const Locale& desiredLocale, const char *type, UErrorCode&
     (void)ulocimp_getRegionForSupplementalData(desiredLocale.getName(), true, region, sizeof(region), &status);
 
     // Read week data values from supplementalData week data
-    UResourceBundle *rb = ures_openDirect(NULL, "supplementalData", &status);
+    UResourceBundle *rb = ures_openDirect(nullptr, "supplementalData", &status);
     ures_getByKey(rb, "weekData", rb, &status);
-    UResourceBundle *weekData = ures_getByKey(rb, region, NULL, &status);
-    if (status == U_MISSING_RESOURCE_ERROR && rb != NULL) {
+    UResourceBundle *weekData = ures_getByKey(rb, region, nullptr, &status);
+    if (status == U_MISSING_RESOURCE_ERROR && rb != nullptr) {
         status = U_ZERO_ERROR;
-        weekData = ures_getByKey(rb, "001", NULL, &status);
+        weekData = ures_getByKey(rb, "001", nullptr, &status);
     }
 
     if (U_FAILURE(status)) {
@@ -4060,13 +4060,13 @@ int32_t Calendar::internalGetMonth(int32_t defaultValue) const {
 
 BasicTimeZone*
 Calendar::getBasicTimeZone(void) const {
-    if (dynamic_cast<const OlsonTimeZone *>(fZone) != NULL
-        || dynamic_cast<const SimpleTimeZone *>(fZone) != NULL
-        || dynamic_cast<const RuleBasedTimeZone *>(fZone) != NULL
-        || dynamic_cast<const VTimeZone *>(fZone) != NULL) {
+    if (dynamic_cast<const OlsonTimeZone *>(fZone) != nullptr
+        || dynamic_cast<const SimpleTimeZone *>(fZone) != nullptr
+        || dynamic_cast<const RuleBasedTimeZone *>(fZone) != nullptr
+        || dynamic_cast<const VTimeZone *>(fZone) != nullptr) {
         return (BasicTimeZone*)fZone;
     }
-    return NULL;
+    return nullptr;
 }
 
 U_NAMESPACE_END
index 01ddbd1ee419d9a4d40a5bbc030ad973020a741c..e6604c95acaf8bf61db83ec5da2dcda7b1d2df05 100644 (file)
@@ -53,13 +53,13 @@ static void debug_chnsecal_msg(const char *pat, ...)
 
 // --- The cache --
 static icu::UMutex astroLock;
-static icu::CalendarAstronomer *gChineseCalendarAstro = NULL;
+static icu::CalendarAstronomer *gChineseCalendarAstro = nullptr;
 
 // Lazy Creation & Access synchronized by class CalendarCache with a mutex.
-static icu::CalendarCache *gChineseCalendarWinterSolsticeCache = NULL;
-static icu::CalendarCache *gChineseCalendarNewYearCache = NULL;
+static icu::CalendarCache *gChineseCalendarWinterSolsticeCache = nullptr;
+static icu::CalendarCache *gChineseCalendarNewYearCache = nullptr;
 
-static icu::TimeZone *gChineseCalendarZoneAstroCalc = NULL;
+static icu::TimeZone *gChineseCalendarZoneAstroCalc = nullptr;
 static icu::UInitOnce gChineseCalendarZoneAstroCalcInitOnce {};
 
 /**
@@ -89,19 +89,19 @@ U_CDECL_BEGIN
 static UBool calendar_chinese_cleanup(void) {
     if (gChineseCalendarAstro) {
         delete gChineseCalendarAstro;
-        gChineseCalendarAstro = NULL;
+        gChineseCalendarAstro = nullptr;
     }
     if (gChineseCalendarWinterSolsticeCache) {
         delete gChineseCalendarWinterSolsticeCache;
-        gChineseCalendarWinterSolsticeCache = NULL;
+        gChineseCalendarWinterSolsticeCache = nullptr;
     }
     if (gChineseCalendarNewYearCache) {
         delete gChineseCalendarNewYearCache;
-        gChineseCalendarNewYearCache = NULL;
+        gChineseCalendarNewYearCache = nullptr;
     }
     if (gChineseCalendarZoneAstroCalc) {
         delete gChineseCalendarZoneAstroCalc;
-        gChineseCalendarZoneAstroCalc = NULL;
+        gChineseCalendarZoneAstroCalc = nullptr;
     }
     gChineseCalendarZoneAstroCalcInitOnce.reset();
     return true;
@@ -486,7 +486,7 @@ void ChineseCalendar::roll(EDateFields field, int32_t amount, UErrorCode& status
  */
 double ChineseCalendar::daysToMillis(double days) const {
     double millis = days * (double)kOneDay;
-    if (fZoneAstroCalc != NULL) {
+    if (fZoneAstroCalc != nullptr) {
         int32_t rawOffset, dstOffset;
         UErrorCode status = U_ZERO_ERROR;
         fZoneAstroCalc->getOffset(millis, false, rawOffset, dstOffset, status);
@@ -503,7 +503,7 @@ double ChineseCalendar::daysToMillis(double days) const {
  * @return days after January 1, 1970 0:00 in the astronomical base zone
  */
 double ChineseCalendar::millisToDays(double millis) const {
-    if (fZoneAstroCalc != NULL) {
+    if (fZoneAstroCalc != nullptr) {
         int32_t rawOffset, dstOffset;
         UErrorCode status = U_ZERO_ERROR;
         fZoneAstroCalc->getOffset(millis, false, rawOffset, dstOffset, status);
@@ -540,7 +540,7 @@ int32_t ChineseCalendar::winterSolstice(int32_t gyear) const {
         double ms = daysToMillis(Grego::fieldsToDay(gyear, UCAL_DECEMBER, 1));
 
         umtx_lock(&astroLock);
-        if(gChineseCalendarAstro == NULL) {
+        if(gChineseCalendarAstro == nullptr) {
             gChineseCalendarAstro = new CalendarAstronomer();
             ucln_i18n_registerCleanup(UCLN_I18N_CHINESE_CALENDAR, calendar_chinese_cleanup);
         }
@@ -570,7 +570,7 @@ int32_t ChineseCalendar::winterSolstice(int32_t gyear) const {
 int32_t ChineseCalendar::newMoonNear(double days, UBool after) const {
     
     umtx_lock(&astroLock);
-    if(gChineseCalendarAstro == NULL) {
+    if(gChineseCalendarAstro == nullptr) {
         gChineseCalendarAstro = new CalendarAstronomer();
         ucln_i18n_registerCleanup(UCLN_I18N_CHINESE_CALENDAR, calendar_chinese_cleanup);
     }
@@ -602,7 +602,7 @@ int32_t ChineseCalendar::synodicMonthsBetween(int32_t day1, int32_t day2) const
 int32_t ChineseCalendar::majorSolarTerm(int32_t days) const {
     
     umtx_lock(&astroLock);
-    if(gChineseCalendarAstro == NULL) {
+    if(gChineseCalendarAstro == nullptr) {
         gChineseCalendarAstro = new CalendarAstronomer();
         ucln_i18n_registerCleanup(UCLN_I18N_CHINESE_CALENDAR, calendar_chinese_cleanup);
     }
index 008bb5a7a390f47e1b75fed00667e8c2df7c3736..5e8e86631583c3a9c678b33f733b155ac837a14f 100644 (file)
@@ -92,7 +92,7 @@ ChoiceFormat::ChoiceFormat(const double* limits,
 : constructorErrorCode(U_ZERO_ERROR),
   msgPattern(constructorErrorCode)
 {
-    setChoices(limits, NULL, formats, cnt, constructorErrorCode);
+    setChoices(limits, nullptr, formats, cnt, constructorErrorCode);
 }
 
 // -------------------------------------
@@ -209,7 +209,7 @@ ChoiceFormat::dtos(double value,
             while (*itrPtr) {
                 *(expPtr++)  = *(itrPtr++);
             }
-            // NULL terminate
+            // NUL terminate
             *expPtr = 0;
         }
     }
@@ -225,7 +225,7 @@ void
 ChoiceFormat::applyPattern(const UnicodeString& pattern,
                            UErrorCode& status)
 {
-    msgPattern.parseChoiceStyle(pattern, NULL, status);
+    msgPattern.parseChoiceStyle(pattern, nullptr, status);
     constructorErrorCode = status;
 }
 
@@ -257,7 +257,7 @@ ChoiceFormat::setChoices(  const double* limits,
                            int32_t cnt )
 {
     UErrorCode errorCode = U_ZERO_ERROR;
-    setChoices(limits, NULL, formats, cnt, errorCode);
+    setChoices(limits, nullptr, formats, cnt, errorCode);
 }
 
 // -------------------------------------
@@ -281,7 +281,7 @@ ChoiceFormat::setChoices(const double* limits,
     if (U_FAILURE(errorCode)) {
         return;
     }
-    if (limits == NULL || formats == NULL) {
+    if (limits == nullptr || formats == nullptr) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
@@ -301,7 +301,7 @@ ChoiceFormat::setChoices(const double* limits,
         } else {
             result += dtos(limits[i], buf);
         }
-        if (closures != NULL && closures[i]) {
+        if (closures != nullptr && closures[i]) {
             result += LESS_THAN;
         } else {
             result += LESS_EQUAL;
@@ -347,7 +347,7 @@ const double*
 ChoiceFormat::getLimits(int32_t& cnt) const 
 {
     cnt = 0;
-    return NULL;
+    return nullptr;
 }
 
 // -------------------------------------
@@ -357,7 +357,7 @@ const UBool*
 ChoiceFormat::getClosures(int32_t& cnt) const 
 {
     cnt = 0;
-    return NULL;
+    return nullptr;
 }
 
 // -------------------------------------
@@ -367,7 +367,7 @@ const UnicodeString*
 ChoiceFormat::getFormats(int32_t& cnt) const
 {
     cnt = 0;
-    return NULL;
+    return nullptr;
 }
 
 // -------------------------------------
index 05039502734a63533415fde0069c425bca4f223f..a9c6b3de1f2f10529ad5f39eb019e3876cb34495 100644 (file)
@@ -54,7 +54,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(CollationElementIterator)
 
 CollationElementIterator::CollationElementIterator(
                                          const CollationElementIterator& other) 
-        : UObject(other), iter_(NULL), rbc_(NULL), otherHalf_(0), dir_(0), offsets_(NULL) {
+        : UObject(other), iter_(nullptr), rbc_(nullptr), otherHalf_(0), dir_(0), offsets_(nullptr) {
     *this = other;
 }
 
@@ -82,7 +82,7 @@ UBool ceNeedsTwoParts(int64_t ce) {
 
 int32_t CollationElementIterator::getOffset() const
 {
-    if (dir_ < 0 && offsets_ != NULL && !offsets_->isEmpty()) {
+    if (dir_ < 0 && offsets_ != nullptr && !offsets_->isEmpty()) {
         // CollationIterator::previousCE() decrements the CEs length
         // while it pops CEs from its internal buffer.
         int32_t i = iter_->getCEsLength();
@@ -185,9 +185,9 @@ int32_t CollationElementIterator::previous(UErrorCode& status)
         status = U_INVALID_STATE_ERROR;
         return NULLORDER;
     }
-    if (offsets_ == NULL) {
+    if (offsets_ == nullptr) {
         offsets_ = new UVector32(status);
-        if (offsets_ == NULL) {
+        if (offsets_ == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return NULLORDER;
         }
@@ -286,7 +286,7 @@ void CollationElementIterator::setText(const UnicodeString& source,
     } else {
         newIter = new FCDUTF16CollationIterator(rbc_->data, numeric, s, s, s + string_.length());
     }
-    if (newIter == NULL) {
+    if (newIter == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -331,7 +331,7 @@ CollationElementIterator::CollationElementIterator(
                                                const UnicodeString &source,
                                                const RuleBasedCollator *coll,
                                                UErrorCode &status)
-        : iter_(NULL), rbc_(coll), otherHalf_(0), dir_(0), offsets_(NULL) {
+        : iter_(nullptr), rbc_(coll), otherHalf_(0), dir_(0), offsets_(nullptr) {
     setText(source, status);
 }
 
@@ -343,7 +343,7 @@ CollationElementIterator::CollationElementIterator(
                                            const CharacterIterator &source,
                                            const RuleBasedCollator *coll,
                                            UErrorCode &status)
-        : iter_(NULL), rbc_(coll), otherHalf_(0), dir_(0), offsets_(NULL) {
+        : iter_(nullptr), rbc_(coll), otherHalf_(0), dir_(0), offsets_(nullptr) {
     // We only call source.getText() which should be const anyway.
     setText(const_cast<CharacterIterator &>(source), status);
 }
@@ -360,18 +360,18 @@ const CollationElementIterator& CollationElementIterator::operator=(
     CollationIterator *newIter;
     const FCDUTF16CollationIterator *otherFCDIter =
             dynamic_cast<const FCDUTF16CollationIterator *>(other.iter_);
-    if(otherFCDIter != NULL) {
+    if(otherFCDIter != nullptr) {
         newIter = new FCDUTF16CollationIterator(*otherFCDIter, string_.getBuffer());
     } else {
         const UTF16CollationIterator *otherIter =
                 dynamic_cast<const UTF16CollationIterator *>(other.iter_);
-        if(otherIter != NULL) {
+        if(otherIter != nullptr) {
             newIter = new UTF16CollationIterator(*otherIter, string_.getBuffer());
         } else {
-            newIter = NULL;
+            newIter = nullptr;
         }
     }
-    if(newIter != NULL) {
+    if(newIter != nullptr) {
         delete iter_;
         iter_ = newIter;
         rbc_ = other.rbc_;
@@ -380,12 +380,12 @@ const CollationElementIterator& CollationElementIterator::operator=(
 
         string_ = other.string_;
     }
-    if(other.dir_ < 0 && other.offsets_ != NULL && !other.offsets_->isEmpty()) {
+    if(other.dir_ < 0 && other.offsets_ != nullptr && !other.offsets_->isEmpty()) {
         UErrorCode errorCode = U_ZERO_ERROR;
-        if(offsets_ == NULL) {
+        if(offsets_ == nullptr) {
             offsets_ = new UVector32(other.offsets_->size(), errorCode);
         }
-        if(offsets_ != NULL) {
+        if(offsets_ != nullptr) {
             offsets_->assign(*other.offsets_, errorCode);
         }
     }
@@ -435,15 +435,15 @@ MaxExpSink::~MaxExpSink() {}
 
 UHashtable *
 CollationElementIterator::computeMaxExpansions(const CollationData *data, UErrorCode &errorCode) {
-    if (U_FAILURE(errorCode)) { return NULL; }
+    if (U_FAILURE(errorCode)) { return nullptr; }
     UHashtable *maxExpansions = uhash_open(uhash_hashLong, uhash_compareLong,
                                            uhash_compareLong, &errorCode);
-    if (U_FAILURE(errorCode)) { return NULL; }
+    if (U_FAILURE(errorCode)) { return nullptr; }
     MaxExpSink sink(maxExpansions, errorCode);
-    ContractionsAndExpansions(NULL, NULL, &sink, true).forData(data, errorCode);
+    ContractionsAndExpansions(nullptr, nullptr, &sink, true).forData(data, errorCode);
     if (U_FAILURE(errorCode)) {
         uhash_close(maxExpansions);
-        return NULL;
+        return nullptr;
     }
     return maxExpansions;
 }
@@ -457,7 +457,7 @@ int32_t
 CollationElementIterator::getMaxExpansion(const UHashtable *maxExpansions, int32_t order) {
     if (order == 0) { return 1; }
     int32_t max;
-    if(maxExpansions != NULL && (max = uhash_igeti(maxExpansions, order)) != 0) {
+    if(maxExpansions != nullptr && (max = uhash_igeti(maxExpansions, order)) != 0) {
         return max;
     }
     if ((order & 0xc0) == 0xc0) {
index b22a9d5876048048d675f7439d85dff4da0c9582..e0322eda91e5c84e34a7fe5c29ccde53c34b95e0 100644 (file)
 #include "uresimp.h"
 #include "ucln_in.h"
 
-static icu::Locale* availableLocaleList = NULL;
+static icu::Locale* availableLocaleList = nullptr;
 static int32_t  availableLocaleListCount;
 #if !UCONFIG_NO_SERVICE
-static icu::ICULocaleService* gService = NULL;
+static icu::ICULocaleService* gService = nullptr;
 static icu::UInitOnce gServiceInitOnce {};
 #endif
 static icu::UInitOnce gAvailableLocaleListInitOnce {};
@@ -77,13 +77,13 @@ static UBool U_CALLCONV collator_cleanup(void) {
 #if !UCONFIG_NO_SERVICE
     if (gService) {
         delete gService;
-        gService = NULL;
+        gService = nullptr;
     }
     gServiceInitOnce.reset();
 #endif
     if (availableLocaleList) {
         delete []availableLocaleList;
-        availableLocaleList = NULL;
+        availableLocaleList = nullptr;
     }
     availableLocaleListCount = 0;
     gAvailableLocaleListInitOnce.reset();
@@ -146,7 +146,7 @@ ICUCollatorFactory::create(const ICUServiceKey& key, const ICUService* /* servic
         
         return Collator::makeInstance(loc, status);
     }
-    return NULL;
+    return nullptr;
 }
 
 // -------------------------------------
@@ -181,7 +181,7 @@ public:
     
     virtual UObject* getKey(ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const override {
         UnicodeString ar;
-        if (actualReturn == NULL) {
+        if (actualReturn == nullptr) {
             actualReturn = &ar;
         }
         return (Collator*)ICULocaleService::getKey(key, actualReturn, status);
@@ -214,7 +214,7 @@ getService(void)
 static inline UBool
 hasService(void) 
 {
-    UBool retVal = !gServiceInitOnce.isReset() && (getService() != NULL);
+    UBool retVal = !gServiceInitOnce.isReset() && (getService() != nullptr);
     return retVal;
 }
 
@@ -223,9 +223,9 @@ hasService(void)
 static void U_CALLCONV 
 initAvailableLocaleList(UErrorCode &status) {
     U_ASSERT(availableLocaleListCount == 0);
-    U_ASSERT(availableLocaleList == NULL);
+    U_ASSERT(availableLocaleList == nullptr);
     // for now, there is a hardcoded list, so just walk through that list and set it up.
-    UResourceBundle *index = NULL;
+    UResourceBundle *index = nullptr;
     StackUResourceBundle installed;
     int32_t i = 0;
     
@@ -236,11 +236,11 @@ initAvailableLocaleList(UErrorCode &status) {
         availableLocaleListCount = ures_getSize(installed.getAlias());
         availableLocaleList = new Locale[availableLocaleListCount];
         
-        if (availableLocaleList != NULL) {
+        if (availableLocaleList != nullptr) {
             ures_resetIterator(installed.getAlias());
             while(ures_hasNext(installed.getAlias())) {
-                const char *tempKey = NULL;
-                ures_getNextString(installed.getAlias(), NULL, &tempKey, &status);
+                const char *tempKey = nullptr;
+                ures_getNextString(installed.getAlias(), nullptr, &tempKey, &status);
                 availableLocaleList[i++] = Locale(tempKey);
             }
         }
@@ -434,7 +434,7 @@ Collator* U_EXPORT2 Collator::createInstance(const Locale& desiredLocale,
     if (desiredLocale.isBogus()) {
         // Locale constructed from malformed locale ID or language tag.
         status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     Collator* coll;
@@ -446,18 +446,18 @@ Collator* U_EXPORT2 Collator::createInstance(const Locale& desiredLocale,
 #endif
     {
         coll = makeInstance(desiredLocale, status);
-        // Either returns NULL with U_FAILURE(status), or non-NULL with U_SUCCESS(status)
+        // Either returns nullptr with U_FAILURE(status), or non-nullptr with U_SUCCESS(status)
     }
-    // The use of *coll in setAttributesFromKeywords can cause the NULL check to be
+    // The use of *coll in setAttributesFromKeywords can cause the nullptr check to be
     // optimized out of the delete even though setAttributesFromKeywords returns
     // immediately if U_FAILURE(status), so we add a check here.
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     setAttributesFromKeywords(desiredLocale, *coll, status);
     if (U_FAILURE(status)) {
         delete coll;
-        return NULL;
+        return nullptr;
     }
     return coll;
 }
@@ -467,7 +467,7 @@ Collator* Collator::makeInstance(const Locale&  desiredLocale, UErrorCode& statu
     const CollationCacheEntry *entry = CollationLoader::loadTailoring(desiredLocale, status);
     if (U_SUCCESS(status)) {
         Collator *result = new RuleBasedCollator(entry);
-        if (result != NULL) {
+        if (result != nullptr) {
             // Both the unified cache's get() and the RBC constructor
             // did addRef(). Undo one of them.
             entry->removeRef();
@@ -475,11 +475,11 @@ Collator* Collator::makeInstance(const Locale&  desiredLocale, UErrorCode& statu
         }
         status = U_MEMORY_ALLOCATION_ERROR;
     }
-    if (entry != NULL) {
+    if (entry != nullptr) {
         // Undo the addRef() from the cache.get().
         entry->removeRef();
     }
-    return NULL;
+    return nullptr;
 }
 
 Collator *
@@ -561,7 +561,7 @@ UBool Collator::greater(const UnicodeString& source,
 const Locale* U_EXPORT2 Collator::getAvailableLocales(int32_t& count) 
 {
     UErrorCode status = U_ZERO_ERROR;
-    Locale *result = NULL;
+    Locale *result = nullptr;
     count = 0;
     if (isAvailableLocaleListInitialized(status))
     {
@@ -594,7 +594,7 @@ UnicodeString& U_EXPORT2 Collator::getDisplayName(const Locale& objectLocale,
 /* This is useless information */
 /*void Collator::getVersion(UVersionInfo versionInfo) const
 {
-  if (versionInfo!=NULL)
+  if (versionInfo!=nullptr)
     uprv_memcpy(versionInfo, fVersion, U_MAX_VERSION_LENGTH);
 }
 */
@@ -665,7 +665,7 @@ Collator::setLocales(const Locale& /* requestedLocale */, const Locale& /* valid
 UnicodeSet *Collator::getTailoredSet(UErrorCode &status) const
 {
     if(U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     // everything can be changed
     return new UnicodeSet(0, 0x10FFFF);
@@ -684,7 +684,7 @@ Collator::registerInstance(Collator* toAdopt, const Locale& locale, UErrorCode&
         toAdopt->setLocales(locale, locale, locale);
         return getService()->registerInstance(toAdopt, locale, status);
     }
-    return NULL;
+    return nullptr;
 }
 
 // -------------------------------------
@@ -698,7 +698,7 @@ public:
     CFactory(CollatorFactory* delegate, UErrorCode& status) 
         : LocaleKeyFactory(delegate->visible() ? VISIBLE : INVISIBLE)
         , _delegate(delegate)
-        , _ids(NULL)
+        , _ids(nullptr)
     {
         if (U_SUCCESS(status)) {
             int32_t count = 0;
@@ -709,7 +709,7 @@ public:
                     _ids->put(idlist[i], (void*)this, status);
                     if (U_FAILURE(status)) {
                         delete _ids;
-                        _ids = NULL;
+                        _ids = nullptr;
                         return;
                     }
                 }
@@ -729,7 +729,7 @@ protected:
         if (U_SUCCESS(status)) {
             return _ids;
         }
-        return NULL;
+        return nullptr;
     }
     
     virtual UnicodeString&
@@ -751,7 +751,7 @@ CFactory::create(const ICUServiceKey& key, const ICUService* /* service */, UErr
         lkey.currentLocale(validLoc);
         return _delegate->createCollator(validLoc);
     }
-    return NULL;
+    return nullptr;
 }
 
 UnicodeString&
@@ -760,7 +760,7 @@ CFactory::getDisplayName(const UnicodeString& id, const Locale& locale, UnicodeS
     if ((_coverage & 0x1) == 0) {
         UErrorCode status = U_ZERO_ERROR;
         const Hashtable* ids = getSupportedIDs(status);
-        if (ids && (ids->get(id) != NULL)) {
+        if (ids && (ids->get(id) != nullptr)) {
             Locale loc;
             LocaleUtility::initLocaleFromName(id, loc);
             return _delegate->getDisplayName(loc, locale, result);
@@ -780,7 +780,7 @@ Collator::registerFactory(CollatorFactory* toAdopt, UErrorCode& status)
         }
         status = U_MEMORY_ALLOCATION_ERROR;
     }
-    return NULL;
+    return nullptr;
 }
 
 // -------------------------------------
@@ -831,14 +831,14 @@ public:
         const char* result;
         if(index < availableLocaleListCount) {
             result = availableLocaleList[index++].getName();
-            if(resultLength != NULL) {
+            if(resultLength != nullptr) {
                 *resultLength = (int32_t)uprv_strlen(result);
             }
         } else {
-            if(resultLength != NULL) {
+            if(resultLength != nullptr) {
                 *resultLength = 0;
             }
-            result = NULL;
+            result = nullptr;
         }
         return result;
     }
@@ -873,7 +873,7 @@ Collator::getAvailableLocales(void)
     if (isAvailableLocaleListInitialized(status)) {
         return new CollationLocaleListEnumeration();
     }
-    return NULL;
+    return nullptr;
 }
 
 StringEnumeration* U_EXPORT2
@@ -961,7 +961,7 @@ Collator::getEquivalentReorderCodes(int32_t reorderCode,
                                     int32_t *dest, int32_t capacity,
                                     UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return 0; }
-    if(capacity < 0 || (dest == NULL && capacity > 0)) {
+    if(capacity < 0 || (dest == nullptr && capacity > 0)) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -986,7 +986,7 @@ Collator::internalCompareUTF8(const char *left, int32_t leftLength,
                               const char *right, int32_t rightLength,
                               UErrorCode &errorCode) const {
     if(U_FAILURE(errorCode)) { return UCOL_EQUAL; }
-    if((left == NULL && leftLength != 0) || (right == NULL && rightLength != 0)) {
+    if((left == nullptr && leftLength != 0) || (right == nullptr && rightLength != 0)) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return UCOL_EQUAL;
     }
index fbf09a313d60db9672f41c71e33ab9c556d0d93d..81109c139574beb63a5c5884ea5c3cef961c6278 100644 (file)
@@ -83,72 +83,72 @@ BundleImporter::getRules(
 // most code will not have a static dependency on the builder code.
 
 RuleBasedCollator::RuleBasedCollator()
-        : data(NULL),
-          settings(NULL),
-          tailoring(NULL),
-          cacheEntry(NULL),
+        : data(nullptr),
+          settings(nullptr),
+          tailoring(nullptr),
+          cacheEntry(nullptr),
           validLocale(""),
           explicitlySetAttributes(0),
           actualLocaleIsSameAsValid(false) {
 }
 
 RuleBasedCollator::RuleBasedCollator(const UnicodeString &rules, UErrorCode &errorCode)
-        : data(NULL),
-          settings(NULL),
-          tailoring(NULL),
-          cacheEntry(NULL),
+        : data(nullptr),
+          settings(nullptr),
+          tailoring(nullptr),
+          cacheEntry(nullptr),
           validLocale(""),
           explicitlySetAttributes(0),
           actualLocaleIsSameAsValid(false) {
-    internalBuildTailoring(rules, UCOL_DEFAULT, UCOL_DEFAULT, NULL, NULL, errorCode);
+    internalBuildTailoring(rules, UCOL_DEFAULT, UCOL_DEFAULT, nullptr, nullptr, errorCode);
 }
 
 RuleBasedCollator::RuleBasedCollator(const UnicodeString &rules, ECollationStrength strength,
                                      UErrorCode &errorCode)
-        : data(NULL),
-          settings(NULL),
-          tailoring(NULL),
-          cacheEntry(NULL),
+        : data(nullptr),
+          settings(nullptr),
+          tailoring(nullptr),
+          cacheEntry(nullptr),
           validLocale(""),
           explicitlySetAttributes(0),
           actualLocaleIsSameAsValid(false) {
-    internalBuildTailoring(rules, strength, UCOL_DEFAULT, NULL, NULL, errorCode);
+    internalBuildTailoring(rules, strength, UCOL_DEFAULT, nullptr, nullptr, errorCode);
 }
 
 RuleBasedCollator::RuleBasedCollator(const UnicodeString &rules,
                                      UColAttributeValue decompositionMode,
                                      UErrorCode &errorCode)
-        : data(NULL),
-          settings(NULL),
-          tailoring(NULL),
-          cacheEntry(NULL),
+        : data(nullptr),
+          settings(nullptr),
+          tailoring(nullptr),
+          cacheEntry(nullptr),
           validLocale(""),
           explicitlySetAttributes(0),
           actualLocaleIsSameAsValid(false) {
-    internalBuildTailoring(rules, UCOL_DEFAULT, decompositionMode, NULL, NULL, errorCode);
+    internalBuildTailoring(rules, UCOL_DEFAULT, decompositionMode, nullptr, nullptr, errorCode);
 }
 
 RuleBasedCollator::RuleBasedCollator(const UnicodeString &rules,
                                      ECollationStrength strength,
                                      UColAttributeValue decompositionMode,
                                      UErrorCode &errorCode)
-        : data(NULL),
-          settings(NULL),
-          tailoring(NULL),
-          cacheEntry(NULL),
+        : data(nullptr),
+          settings(nullptr),
+          tailoring(nullptr),
+          cacheEntry(nullptr),
           validLocale(""),
           explicitlySetAttributes(0),
           actualLocaleIsSameAsValid(false) {
-    internalBuildTailoring(rules, strength, decompositionMode, NULL, NULL, errorCode);
+    internalBuildTailoring(rules, strength, decompositionMode, nullptr, nullptr, errorCode);
 }
 
 RuleBasedCollator::RuleBasedCollator(const UnicodeString &rules,
                                      UParseError &parseError, UnicodeString &reason,
                                      UErrorCode &errorCode)
-        : data(NULL),
-          settings(NULL),
-          tailoring(NULL),
-          cacheEntry(NULL),
+        : data(nullptr),
+          settings(nullptr),
+          tailoring(nullptr),
+          cacheEntry(nullptr),
           validLocale(""),
           explicitlySetAttributes(0),
           actualLocaleIsSameAsValid(false) {
@@ -163,7 +163,7 @@ RuleBasedCollator::internalBuildTailoring(const UnicodeString &rules,
                                           UErrorCode &errorCode) {
     const CollationTailoring *base = CollationRoot::getRoot(errorCode);
     if(U_FAILURE(errorCode)) { return; }
-    if(outReason != NULL) { outReason->remove(); }
+    if(outReason != nullptr) { outReason->remove(); }
     CollationBuilder builder(base, errorCode);
     UVersionInfo noVersion = { 0, 0, 0, 0 };
     BundleImporter importer;
@@ -172,7 +172,7 @@ RuleBasedCollator::internalBuildTailoring(const UnicodeString &rules,
                                                              outParseError, errorCode));
     if(U_FAILURE(errorCode)) {
         const char *reason = builder.getErrorReason();
-        if(reason != NULL && outReason != NULL) {
+        if(reason != nullptr && outReason != nullptr) {
             *outReason = UnicodeString(reason, -1, US_INV);
         }
         return;
@@ -201,7 +201,7 @@ CollationBuilder::CollationBuilder(const CollationTailoring *b, UBool icu4xMode,
           variableTop(0),
           dataBuilder(new CollationDataBuilder(icu4xMode, errorCode)), fastLatinEnabled(true),
           icu4xMode(icu4xMode),
-          errorReason(NULL),
+          errorReason(nullptr),
           cesLength(0),
           rootPrimaryIndexes(errorCode), nodes(errorCode) {
     nfcImpl.ensureCanonIterData(errorCode);
@@ -209,7 +209,7 @@ CollationBuilder::CollationBuilder(const CollationTailoring *b, UBool icu4xMode,
         errorReason = "CollationBuilder fields initialization failed";
         return;
     }
-    if(dataBuilder == NULL) {
+    if(dataBuilder == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -233,19 +233,19 @@ CollationBuilder::parseAndBuild(const UnicodeString &ruleString,
                                 CollationRuleParser::Importer *importer,
                                 UParseError *outParseError,
                                 UErrorCode &errorCode) {
-    if(U_FAILURE(errorCode)) { return NULL; }
-    if(baseData->rootElements == NULL) {
+    if(U_FAILURE(errorCode)) { return nullptr; }
+    if(baseData->rootElements == nullptr) {
         errorCode = U_MISSING_RESOURCE_ERROR;
         errorReason = "missing root elements data, tailoring not supported";
-        return NULL;
+        return nullptr;
     }
     LocalPointer<CollationTailoring> tailoring(new CollationTailoring(base->settings));
     if(tailoring.isNull() || tailoring->isBogus()) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     CollationRuleParser parser(baseData, errorCode);
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     // Note: This always bases &[last variable] and &[first regular]
     // on the root collator's maxVariable/variableTop.
     // If we wanted this to change after [maxVariable x], then we would keep
@@ -257,7 +257,7 @@ CollationBuilder::parseAndBuild(const UnicodeString &ruleString,
     CollationSettings &ownedSettings = *SharedObject::copyOnWrite(tailoring->settings);
     parser.parse(ruleString, ownedSettings, outParseError, errorCode);
     errorReason = parser.getErrorReason();
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     if(dataBuilder->hasMappings()) {
         makeTailoredCEs(errorCode);
         if (!icu4xMode) {
@@ -274,15 +274,15 @@ CollationBuilder::parseAndBuild(const UnicodeString &ruleString,
             dataBuilder->optimize(optimizeSet, errorCode);
         }
         tailoring->ensureOwnedData(errorCode);
-        if(U_FAILURE(errorCode)) { return NULL; }
+        if(U_FAILURE(errorCode)) { return nullptr; }
         if(fastLatinEnabled) { dataBuilder->enableFastLatin(); }
         dataBuilder->build(*tailoring->ownedData, errorCode);
         tailoring->builder = dataBuilder;
-        dataBuilder = NULL;
+        dataBuilder = nullptr;
     } else {
         tailoring->data = baseData;
     }
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     ownedSettings.fastLatinOptions = CollationFastLatin::getOptions(
         tailoring->data, ownedSettings,
         ownedSettings.fastLatinPrimaries, UPRV_LENGTHOF(ownedSettings.fastLatinPrimaries));
@@ -1644,21 +1644,21 @@ U_CAPI UCollator * U_EXPORT2
 ucol_openRules(const UChar *rules, int32_t rulesLength,
                UColAttributeValue normalizationMode, UCollationStrength strength,
                UParseError *parseError, UErrorCode *pErrorCode) {
-    if(U_FAILURE(*pErrorCode)) { return NULL; }
-    if(rules == NULL && rulesLength != 0) {
+    if(U_FAILURE(*pErrorCode)) { return nullptr; }
+    if(rules == nullptr && rulesLength != 0) {
         *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     RuleBasedCollator *coll = new RuleBasedCollator();
-    if(coll == NULL) {
+    if(coll == nullptr) {
         *pErrorCode = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     UnicodeString r((UBool)(rulesLength < 0), rules, rulesLength);
-    coll->internalBuildTailoring(r, strength, normalizationMode, parseError, NULL, *pErrorCode);
+    coll->internalBuildTailoring(r, strength, normalizationMode, parseError, nullptr, *pErrorCode);
     if(U_FAILURE(*pErrorCode)) {
         delete coll;
-        return NULL;
+        return nullptr;
     }
     return coll->toUCollator();
 }
@@ -1696,14 +1696,14 @@ ucol_getUnsafeSet( const UCollator *coll,
     USet *contractions = uset_open(0,0);
 
     int32_t i = 0, j = 0;
-    ucol_getContractionsAndExpansions(coll, contractions, NULL, false, status);
+    ucol_getContractionsAndExpansions(coll, contractions, nullptr, false, status);
     int32_t contsSize = uset_size(contractions);
     UChar32 c = 0;
     // Contraction set consists only of strings
     // to get unsafe code points, we need to
     // break the strings apart and add them to the unsafe set
     for(i = 0; i < contsSize; i++) {
-        len = uset_getItem(contractions, i, NULL, NULL, buffer, internalBufferSize, status);
+        len = uset_getItem(contractions, i, nullptr, nullptr, buffer, internalBufferSize, status);
         if(len > 0) {
             j = 0;
             while(j < len) {
index 71bf17abd0d4db08ac472734e21d4a89768f0fa8..69ea3d680077f2254d5b291fefd8b3065afe04d4 100644 (file)
@@ -49,17 +49,17 @@ struct U_I18N_API CollationData : public UMemory {
     static constexpr int32_t MAX_NUM_SCRIPT_RANGES = 256;
 
     CollationData(const Normalizer2Impl &nfc)
-            : trie(NULL),
-              ce32s(NULL), ces(NULL), contexts(NULL), base(NULL),
-              jamoCE32s(NULL),
+            : trie(nullptr),
+              ce32s(nullptr), ces(nullptr), contexts(nullptr), base(nullptr),
+              jamoCE32s(nullptr),
               nfcImpl(nfc),
               numericPrimary(0x12000000),
               ce32sLength(0), cesLength(0), contextsLength(0),
-              compressibleBytes(NULL),
-              unsafeBackwardSet(NULL),
-              fastLatinTable(NULL), fastLatinTableLength(0),
-              numScripts(0), scriptsIndex(NULL), scriptStarts(NULL), scriptStartsLength(0),
-              rootElements(NULL), rootElementsLength(0) {}
+              compressibleBytes(nullptr),
+              unsafeBackwardSet(nullptr),
+              fastLatinTable(nullptr), fastLatinTableLength(0),
+              numScripts(0), scriptsIndex(nullptr), scriptStarts(nullptr), scriptStartsLength(0),
+              rootElements(nullptr), rootElementsLength(0) {}
 
     uint32_t getCE32(UChar32 c) const {
         return UTRIE2_GET32(trie, c);
@@ -179,7 +179,7 @@ struct U_I18N_API CollationData : public UMemory {
     const int64_t *ces;
     /** Array of prefix and contraction-suffix matching data. */
     const UChar *contexts;
-    /** Base collation data, or NULL if this data itself is a base. */
+    /** Base collation data, or nullptr if this data itself is a base. */
     const CollationData *base;
     /**
      * Simple array of JAMO_CE32S_LENGTH=19+21+27 CE32s, one per canonical Jamo L/V/T.
@@ -238,7 +238,7 @@ struct U_I18N_API CollationData : public UMemory {
     /**
      * Collation elements in the root collator.
      * Used by the CollationRootElements class. The data structure is described there.
-     * NULL in a tailoring.
+     * nullptr in a tailoring.
      */
     const uint32_t *rootElements;
     int32_t rootElementsLength;
index e7c3da1ea5ebe3940a693272ba2d9d15815239cf..9f33550368c902e4020b6030907bbccae6b05345 100644 (file)
@@ -166,7 +166,7 @@ protected:
 DataBuilderCollationIterator::DataBuilderCollationIterator(CollationDataBuilder &b)
         : CollationIterator(&builderData, /*numeric=*/ false),
           builder(b), builderData(b.nfcImpl),
-          s(NULL), pos(0) {
+          s(nullptr), pos(0) {
     builderData.base = builder.base;
     // Set all of the jamoCE32s[] to indirection CE32s.
     for(int32_t j = 0; j < CollationData::JAMO_CE32S_LENGTH; ++j) {  // Count across Jamo types.
@@ -298,13 +298,13 @@ DataBuilderCollationIterator::getCE32FromBuilderData(uint32_t ce32, UErrorCode &
 
 CollationDataBuilder::CollationDataBuilder(UBool icu4xMode, UErrorCode &errorCode)
         : nfcImpl(*Normalizer2Factory::getNFCImpl(errorCode)),
-          base(NULL), baseSettings(NULL),
-          trie(NULL),
+          base(nullptr), baseSettings(nullptr),
+          trie(nullptr),
           ce32s(errorCode), ce64s(errorCode), conditionalCE32s(errorCode),
           modified(false),
           icu4xMode(icu4xMode),
-          fastLatinEnabled(false), fastLatinBuilder(NULL),
-          collIter(NULL) {
+          fastLatinEnabled(false), fastLatinBuilder(nullptr),
+          collIter(nullptr) {
     // Reserve the first CE32 for U+0000.
     if (!icu4xMode) {
         ce32s.addElement(0, errorCode);
@@ -321,11 +321,11 @@ CollationDataBuilder::~CollationDataBuilder() {
 void
 CollationDataBuilder::initForTailoring(const CollationData *b, UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return; }
-    if(trie != NULL) {
+    if(trie != nullptr) {
         errorCode = U_INVALID_STATE_ERROR;
         return;
     }
-    if(b == NULL) {
+    if(b == nullptr) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
@@ -566,7 +566,7 @@ CollationDataBuilder::addCE32(const UnicodeString &prefix, const UnicodeString &
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
-    if(trie == NULL || utrie2_isFrozen(trie)) {
+    if(trie == nullptr || utrie2_isFrozen(trie)) {
         errorCode = U_INVALID_STATE_ERROR;
         return;
     }
@@ -777,7 +777,7 @@ CollationDataBuilder::encodeCEs(const int64_t ces[], int32_t cesLength,
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
-    if(trie == NULL || utrie2_isFrozen(trie)) {
+    if(trie == nullptr || utrie2_isFrozen(trie)) {
         errorCode = U_INVALID_STATE_ERROR;
         return 0;
     }
@@ -1148,12 +1148,12 @@ void
 CollationDataBuilder::copyFrom(const CollationDataBuilder &src, const CEModifier &modifier,
                                UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return; }
-    if(trie == NULL || utrie2_isFrozen(trie)) {
+    if(trie == nullptr || utrie2_isFrozen(trie)) {
         errorCode = U_INVALID_STATE_ERROR;
         return;
     }
     CopyHelper helper(src, *this, modifier, errorCode);
-    utrie2_enum(src.trie, NULL, enumRangeForCopy, &helper);
+    utrie2_enum(src.trie, nullptr, enumRangeForCopy, &helper);
     errorCode = helper.errorCode;
     // Update the contextChars and the unsafeBackwardSet while copying,
     // in case a character had conditional mappings in the source builder
@@ -1205,7 +1205,7 @@ CollationDataBuilder::suppressContractions(const UnicodeSet &set, UErrorCode &er
 UBool
 CollationDataBuilder::getJamoCE32s(uint32_t jamoCE32s[], UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return false; }
-    UBool anyJamoAssigned = base == NULL;  // always set jamoCE32s in the base data
+    UBool anyJamoAssigned = base == nullptr;  // always set jamoCE32s in the base data
     UBool needToCopyFromBase = false;
     for(int32_t j = 0; j < CollationData::JAMO_CE32S_LENGTH; ++j) {  // Count across Jamo types.
         UChar32 jamo = jamoCpFromIndex(j);
@@ -1320,7 +1320,7 @@ void
 CollationDataBuilder::setLeadSurrogates(UErrorCode &errorCode) {
     for(UChar lead = 0xd800; lead < 0xdc00; ++lead) {
         int32_t value = -1;
-        utrie2_enumForLeadSurrogate(trie, lead, NULL, enumRangeLeadValue, &value);
+        utrie2_enumForLeadSurrogate(trie, lead, nullptr, enumRangeLeadValue, &value);
         utrie2_set32ForLeadSurrogateCodeUnit(
             trie, lead,
             Collation::makeCE32FromTagAndIndex(Collation::LEAD_SURROGATE_TAG, 0) | (uint32_t)value,
@@ -1331,7 +1331,7 @@ CollationDataBuilder::setLeadSurrogates(UErrorCode &errorCode) {
 void
 CollationDataBuilder::build(CollationData &data, UErrorCode &errorCode) {
     buildMappings(data, errorCode);
-    if(base != NULL) {
+    if(base != nullptr) {
         data.numericPrimary = base->numericPrimary;
         data.compressibleBytes = base->compressibleBytes;
         data.numScripts = base->numScripts;
@@ -1345,7 +1345,7 @@ CollationDataBuilder::build(CollationData &data, UErrorCode &errorCode) {
 void
 CollationDataBuilder::buildMappings(CollationData &data, UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return; }
-    if(trie == NULL || utrie2_isFrozen(trie)) {
+    if(trie == nullptr || utrie2_isFrozen(trie)) {
         errorCode = U_INVALID_STATE_ERROR;
         return;
     }
@@ -1630,25 +1630,25 @@ CollationDataBuilder::buildFastLatinTable(CollationData &data, UErrorCode &error
 
     delete fastLatinBuilder;
     fastLatinBuilder = new CollationFastLatinBuilder(errorCode);
-    if(fastLatinBuilder == NULL) {
+    if(fastLatinBuilder == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
     if(fastLatinBuilder->forData(data, errorCode)) {
         const uint16_t *table = fastLatinBuilder->getTable();
         int32_t length = fastLatinBuilder->lengthOfTable();
-        if(base != NULL && length == base->fastLatinTableLength &&
+        if(base != nullptr && length == base->fastLatinTableLength &&
                 uprv_memcmp(table, base->fastLatinTable, length * 2) == 0) {
             // Same fast Latin table as in the base, use that one instead.
             delete fastLatinBuilder;
-            fastLatinBuilder = NULL;
+            fastLatinBuilder = nullptr;
             table = base->fastLatinTable;
         }
         data.fastLatinTable = table;
         data.fastLatinTableLength = length;
     } else {
         delete fastLatinBuilder;
-        fastLatinBuilder = NULL;
+        fastLatinBuilder = nullptr;
     }
 }
 
@@ -1671,9 +1671,9 @@ CollationDataBuilder::getCEs(const UnicodeString &prefix, const UnicodeString &s
 int32_t
 CollationDataBuilder::getCEs(const UnicodeString &s, int32_t start,
                              int64_t ces[], int32_t cesLength) {
-    if(collIter == NULL) {
+    if(collIter == nullptr) {
         collIter = new DataBuilderCollationIterator(*this);
-        if(collIter == NULL) { return 0; }
+        if(collIter == nullptr) { return 0; }
     }
     return collIter->fetchCEs(s, start, ces, cesLength);
 }
index a96982cd94648ae3345ee9fe0bca76a47579b809..33a834f498c73545152be6663602d72301ec5b87 100644 (file)
@@ -47,14 +47,14 @@ void
 CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes, int32_t inLength,
                           CollationTailoring &tailoring, UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return; }
-    if(base != NULL) {
-        if(inBytes == NULL || (0 <= inLength && inLength < 24)) {
+    if(base != nullptr) {
+        if(inBytes == nullptr || (0 <= inLength && inLength < 24)) {
             errorCode = U_ILLEGAL_ARGUMENT_ERROR;
             return;
         }
         const DataHeader *header = reinterpret_cast<const DataHeader *>(inBytes);
         if(!(header->dataHeader.magic1 == 0xda && header->dataHeader.magic2 == 0x27 &&
-                isAcceptable(tailoring.version, NULL, NULL, &header->info))) {
+                isAcceptable(tailoring.version, nullptr, nullptr, &header->info))) {
             errorCode = U_INVALID_FORMAT_ERROR;
             return;
         }
@@ -69,7 +69,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
         }
     }
 
-    if(inBytes == NULL || (0 <= inLength && inLength < 8)) {
+    if(inBytes == nullptr || (0 <= inLength && inLength < 8)) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
@@ -81,7 +81,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
     }
 
     // Assume that the tailoring data is in initial state,
-    // with NULL pointers and 0 lengths.
+    // with nullptr pointers and 0 lengths.
 
     // Set pointers to non-empty data parts.
     // Do this in order of their byte offsets. (Should help porting to Java.)
@@ -102,16 +102,16 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
         return;
     }
 
-    const CollationData *baseData = base == NULL ? NULL : base->data;
-    const int32_t *reorderCodes = NULL;
+    const CollationData *baseData = base == nullptr ? nullptr : base->data;
+    const int32_t *reorderCodes = nullptr;
     int32_t reorderCodesLength = 0;
-    const uint32_t *reorderRanges = NULL;
+    const uint32_t *reorderRanges = nullptr;
     int32_t reorderRangesLength = 0;
     index = IX_REORDER_CODES_OFFSET;
     offset = getIndex(inIndexes, indexesLength, index);
     length = getIndex(inIndexes, indexesLength, index + 1) - offset;
     if(length >= 4) {
-        if(baseData == NULL) {
+        if(baseData == nullptr) {
             // We assume for collation settings that
             // the base data does not have a reordering.
             errorCode = U_INVALID_FORMAT_ERROR;
@@ -138,7 +138,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
     // There should be a reorder table only if there are reorder codes.
     // However, when there are reorder codes the reorder table may be omitted to reduce
     // the data size.
-    const uint8_t *reorderTable = NULL;
+    const uint8_t *reorderTable = nullptr;
     index = IX_REORDER_TABLE_OFFSET;
     offset = getIndex(inIndexes, indexesLength, index);
     length = getIndex(inIndexes, indexesLength, index + 1) - offset;
@@ -153,11 +153,11 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
         // when the CollationData is otherwise complete.
     }
 
-    if(baseData != NULL && baseData->numericPrimary != (inIndexes[IX_OPTIONS] & 0xff000000)) {
+    if(baseData != nullptr && baseData->numericPrimary != (inIndexes[IX_OPTIONS] & 0xff000000)) {
         errorCode = U_INVALID_FORMAT_ERROR;
         return;
     }
-    CollationData *data = NULL;  // Remains NULL if there are no mappings.
+    CollationData *data = nullptr;  // Remains nullptr if there are no mappings.
 
     index = IX_TRIE_OFFSET;
     offset = getIndex(inIndexes, indexesLength, index);
@@ -168,10 +168,10 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
         data->base = baseData;
         data->numericPrimary = inIndexes[IX_OPTIONS] & 0xff000000;
         data->trie = tailoring.trie = utrie2_openFromSerialized(
-            UTRIE2_32_VALUE_BITS, inBytes + offset, length, NULL,
+            UTRIE2_32_VALUE_BITS, inBytes + offset, length, nullptr,
             &errorCode);
         if(U_FAILURE(errorCode)) { return; }
-    } else if(baseData != NULL) {
+    } else if(baseData != nullptr) {
         // Use the base data. Only the settings are tailored.
         tailoring.data = baseData;
     } else {
@@ -183,7 +183,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
     offset = getIndex(inIndexes, indexesLength, index);
     length = getIndex(inIndexes, indexesLength, index + 1) - offset;
     if(length >= 8) {
-        if(data == NULL) {
+        if(data == nullptr) {
             errorCode = U_INVALID_FORMAT_ERROR;  // Tailored ces without tailored trie.
             return;
         }
@@ -195,7 +195,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
     offset = getIndex(inIndexes, indexesLength, index);
     length = getIndex(inIndexes, indexesLength, index + 1) - offset;
     if(length >= 4) {
-        if(data == NULL) {
+        if(data == nullptr) {
             errorCode = U_INVALID_FORMAT_ERROR;  // Tailored ce32s without tailored trie.
             return;
         }
@@ -205,14 +205,14 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
 
     int32_t jamoCE32sStart = getIndex(inIndexes, indexesLength, IX_JAMO_CE32S_START);
     if(jamoCE32sStart >= 0) {
-        if(data == NULL || data->ce32s == NULL) {
+        if(data == nullptr || data->ce32s == nullptr) {
             errorCode = U_INVALID_FORMAT_ERROR;  // Index into non-existent ce32s[].
             return;
         }
         data->jamoCE32s = data->ce32s + jamoCE32sStart;
-    } else if(data == NULL) {
+    } else if(data == nullptr) {
         // Nothing to do.
-    } else if(baseData != NULL) {
+    } else if(baseData != nullptr) {
         data->jamoCE32s = baseData->jamoCE32s;
     } else {
         errorCode = U_INVALID_FORMAT_ERROR;  // No Jamo CE32s for Hangul processing.
@@ -224,7 +224,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
     length = getIndex(inIndexes, indexesLength, index + 1) - offset;
     if(length >= 4) {
         length /= 4;
-        if(data == NULL || length <= CollationRootElements::IX_SEC_TER_BOUNDARIES) {
+        if(data == nullptr || length <= CollationRootElements::IX_SEC_TER_BOUNDARIES) {
             errorCode = U_INVALID_FORMAT_ERROR;
             return;
         }
@@ -248,7 +248,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
     offset = getIndex(inIndexes, indexesLength, index);
     length = getIndex(inIndexes, indexesLength, index + 1) - offset;
     if(length >= 2) {
-        if(data == NULL) {
+        if(data == nullptr) {
             errorCode = U_INVALID_FORMAT_ERROR;  // Tailored contexts without tailored trie.
             return;
         }
@@ -260,14 +260,14 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
     offset = getIndex(inIndexes, indexesLength, index);
     length = getIndex(inIndexes, indexesLength, index + 1) - offset;
     if(length >= 2) {
-        if(data == NULL) {
+        if(data == nullptr) {
             errorCode = U_INVALID_FORMAT_ERROR;
             return;
         }
-        if(baseData == NULL) {
+        if(baseData == nullptr) {
 #if defined(COLLUNSAFE_COLL_VERSION) && defined (COLLUNSAFE_SERIALIZE)
           tailoring.unsafeBackwardSet = new UnicodeSet(unsafe_serializedData, unsafe_serializedCount, UnicodeSet::kSerialized, errorCode);
-          if(tailoring.unsafeBackwardSet == NULL) {
+          if(tailoring.unsafeBackwardSet == nullptr) {
             errorCode = U_MEMORY_ALLOCATION_ERROR;
             return;
           } else if (U_FAILURE(errorCode)) {
@@ -286,7 +286,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
             // new UnicodeSet("[[:^lccc=0:][\\udc00-\\udfff]]").
             // It is faster and requires fewer code dependencies.
             tailoring.unsafeBackwardSet = new UnicodeSet(0xdc00, 0xdfff);  // trail surrogates
-            if(tailoring.unsafeBackwardSet == NULL) {
+            if(tailoring.unsafeBackwardSet == nullptr) {
                 errorCode = U_MEMORY_ALLOCATION_ERROR;
                 return;
             }
@@ -296,7 +296,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
             // Clone the root collator's set contents.
             tailoring.unsafeBackwardSet = static_cast<UnicodeSet *>(
                 baseData->unsafeBackwardSet->cloneAsThawed());
-            if(tailoring.unsafeBackwardSet == NULL) {
+            if(tailoring.unsafeBackwardSet == nullptr) {
                 errorCode = U_MEMORY_ALLOCATION_ERROR;
                 return;
             }
@@ -324,9 +324,9 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
         }
         tailoring.unsafeBackwardSet->freeze();
         data->unsafeBackwardSet = tailoring.unsafeBackwardSet;
-    } else if(data == NULL) {
+    } else if(data == nullptr) {
         // Nothing to do.
-    } else if(baseData != NULL) {
+    } else if(baseData != nullptr) {
         // No tailoring-specific data: Alias the root collator's set.
         data->unsafeBackwardSet = baseData->unsafeBackwardSet;
     } else {
@@ -337,8 +337,8 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
     // If the fast Latin format version is different,
     // or the version is set to 0 for "no fast Latin table",
     // then just always use the normal string comparison path.
-    if(data != NULL) {
-        data->fastLatinTable = NULL;
+    if(data != nullptr) {
+        data->fastLatinTable = nullptr;
         data->fastLatinTableLength = 0;
         if(((inIndexes[IX_OPTIONS] >> 16) & 0xff) == CollationFastLatin::VERSION) {
             index = IX_FAST_LATIN_TABLE_OFFSET;
@@ -351,7 +351,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
                     errorCode = U_INVALID_FORMAT_ERROR;  // header vs. table version mismatch
                     return;
                 }
-            } else if(baseData != NULL) {
+            } else if(baseData != nullptr) {
                 data->fastLatinTable = baseData->fastLatinTable;
                 data->fastLatinTableLength = baseData->fastLatinTableLength;
             }
@@ -362,7 +362,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
     offset = getIndex(inIndexes, indexesLength, index);
     length = getIndex(inIndexes, indexesLength, index + 1) - offset;
     if(length >= 2) {
-        if(data == NULL) {
+        if(data == nullptr) {
             errorCode = U_INVALID_FORMAT_ERROR;
             return;
         }
@@ -385,9 +385,9 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
             errorCode = U_INVALID_FORMAT_ERROR;
             return;
         }
-    } else if(data == NULL) {
+    } else if(data == nullptr) {
         // Nothing to do.
-    } else if(baseData != NULL) {
+    } else if(baseData != nullptr) {
         data->numScripts = baseData->numScripts;
         data->scriptsIndex = baseData->scriptsIndex;
         data->scriptStarts = baseData->scriptStarts;
@@ -398,14 +398,14 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
     offset = getIndex(inIndexes, indexesLength, index);
     length = getIndex(inIndexes, indexesLength, index + 1) - offset;
     if(length >= 256) {
-        if(data == NULL) {
+        if(data == nullptr) {
             errorCode = U_INVALID_FORMAT_ERROR;
             return;
         }
         data->compressibleBytes = reinterpret_cast<const UBool *>(inBytes + offset);
-    } else if(data == NULL) {
+    } else if(data == nullptr) {
         // Nothing to do.
-    } else if(baseData != NULL) {
+    } else if(baseData != nullptr) {
         data->compressibleBytes = baseData->compressibleBytes;
     } else {
         errorCode = U_INVALID_FORMAT_ERROR;  // No compressibleBytes[].
@@ -429,7 +429,7 @@ CollationDataReader::read(const CollationTailoring *base, const uint8_t *inBytes
     }
 
     CollationSettings *settings = SharedObject::copyOnWrite(tailoring.settings);
-    if(settings == NULL) {
+    if(settings == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -468,7 +468,7 @@ CollationDataReader::isAcceptable(void *context,
         pInfo->formatVersion[0] == 5
     ) {
         UVersionInfo *version = static_cast<UVersionInfo *>(context);
-        if(version != NULL) {
+        if(version != nullptr) {
             uprv_memcpy(version, pInfo->dataVersion, 4);
         }
         return true;
index b4be7df88781c95cb4c8e80cf5921ef09c3324a5..dff34f533c25beeeaa23dd81c1164131a5b8a8be 100644 (file)
@@ -33,22 +33,22 @@ U_NAMESPACE_BEGIN
 
 uint8_t *
 RuleBasedCollator::cloneRuleData(int32_t &length, UErrorCode &errorCode) const {
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     LocalMemory<uint8_t> buffer((uint8_t *)uprv_malloc(20000));
     if(buffer.isNull()) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     length = cloneBinary(buffer.getAlias(), 20000, errorCode);
     if(errorCode == U_BUFFER_OVERFLOW_ERROR) {
-        if(buffer.allocateInsteadAndCopy(length, 0) == NULL) {
+        if(buffer.allocateInsteadAndCopy(length, 0) == nullptr) {
             errorCode = U_MEMORY_ALLOCATION_ERROR;
-            return NULL;
+            return nullptr;
         }
         errorCode = U_ZERO_ERROR;
         length = cloneBinary(buffer.getAlias(), length, errorCode);
     }
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     return buffer.orphan();
 }
 
@@ -79,7 +79,7 @@ CollationDataWriter::writeBase(const CollationData &data, const CollationSetting
                                const void *rootElements, int32_t rootElementsLength,
                                int32_t indexes[], uint8_t *dest, int32_t capacity,
                                UErrorCode &errorCode) {
-    return write(true, NULL,
+    return write(true, nullptr,
                  data, settings,
                  rootElements, rootElementsLength,
                  indexes, dest, capacity, errorCode);
@@ -91,7 +91,7 @@ CollationDataWriter::writeTailoring(const CollationTailoring &t, const Collation
                                     UErrorCode &errorCode) {
     return write(false, t.version,
                  *t.data, settings,
-                 NULL, 0,
+                 nullptr, 0,
                  indexes, dest, capacity, errorCode);
 }
 
@@ -102,7 +102,7 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion,
                            int32_t indexes[], uint8_t *dest, int32_t capacity,
                            UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return 0; }
-    if(capacity < 0 || (capacity > 0 && dest == NULL)) {
+    if(capacity < 0 || (capacity > 0 && dest == nullptr)) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -117,7 +117,7 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion,
     const CollationData *baseData = data.base;
 
     int32_t fastLatinVersion;
-    if(data.fastLatinTable != NULL) {
+    if(data.fastLatinTable != nullptr) {
         fastLatinVersion = (int32_t)CollationFastLatin::VERSION << 16;
     } else {
         fastLatinVersion = 0;
@@ -132,7 +132,7 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion,
         hasMappings = true;
         unsafeBackwardSet = *data.unsafeBackwardSet;
         fastLatinTableLength = data.fastLatinTableLength;
-    } else if(baseData == NULL) {
+    } else if(baseData == nullptr) {
         hasMappings = false;
         if(settings.reorderCodesLength == 0) {
             // only options
@@ -207,7 +207,7 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion,
             dest += headerSize;
             capacity -= headerSize;
         } else {
-            dest = NULL;
+            dest = nullptr;
             capacity = 0;
         }
     }
@@ -233,7 +233,7 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion,
     totalSize += reorderCodesLength * 4;
 
     indexes[CollationDataReader::IX_REORDER_TABLE_OFFSET] = totalSize;
-    if(settings.reorderTable != NULL) {
+    if(settings.reorderTable != nullptr) {
         totalSize += 256;
     }
 
@@ -245,7 +245,7 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion,
             length = utrie2_serialize(data.trie, dest + totalSize,
                                       capacity - totalSize, &errorCode2);
         } else {
-            length = utrie2_serialize(data.trie, NULL, 0, &errorCode2);
+            length = utrie2_serialize(data.trie, nullptr, 0, &errorCode2);
         }
         if(U_FAILURE(errorCode2) && errorCode2 != U_BUFFER_OVERFLOW_ERROR) {
             errorCode = errorCode2;
@@ -287,7 +287,7 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion,
             length = unsafeBackwardSet.serialize(
                     p, (capacity - totalSize) / 2, errorCode2);
         } else {
-            length = unsafeBackwardSet.serialize(NULL, 0, errorCode2);
+            length = unsafeBackwardSet.serialize(nullptr, 0, errorCode2);
         }
         if(U_FAILURE(errorCode2) && errorCode2 != U_BUFFER_OVERFLOW_ERROR) {
             errorCode = errorCode2;
index 35cf60e815150bba26396b3f27028e1d4eecd472..1fbd27fc8ee47bb47a052f6573f099dc58cbcdf8 100644 (file)
@@ -27,7 +27,7 @@ int32_t
 CollationFastLatin::getOptions(const CollationData *data, const CollationSettings &settings,
                                uint16_t *primaries, int32_t capacity) {
     const uint16_t *table = data->fastLatinTable;
-    if(table == NULL) { return -1; }
+    if(table == nullptr) { return -1; }
     U_ASSERT(capacity == LATIN_LIMIT);
     if(capacity != LATIN_LIMIT) { return -1; }
 
@@ -154,7 +154,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie
                 leftPair &= LONG_PRIMARY_MASK;
                 break;
             } else {
-                leftPair = nextPair(table, c, leftPair, left, NULL, leftIndex, leftLength);
+                leftPair = nextPair(table, c, leftPair, left, nullptr, leftIndex, leftLength);
                 if(leftPair == BAIL_OUT) { return BAIL_OUT_RESULT; }
                 leftPair = getPrimaries(variableTop, leftPair);
             }
@@ -185,7 +185,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie
                 rightPair &= LONG_PRIMARY_MASK;
                 break;
             } else {
-                rightPair = nextPair(table, c, rightPair, right, NULL, rightIndex, rightLength);
+                rightPair = nextPair(table, c, rightPair, right, nullptr, rightIndex, rightLength);
                 if(rightPair == BAIL_OUT) { return BAIL_OUT_RESULT; }
                 rightPair = getPrimaries(variableTop, rightPair);
             }
@@ -236,7 +236,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie
                     leftPair = COMMON_SEC_PLUS_OFFSET;
                     break;
                 } else {
-                    leftPair = nextPair(table, c, leftPair, left, NULL, leftIndex, leftLength);
+                    leftPair = nextPair(table, c, leftPair, left, nullptr, leftIndex, leftLength);
                     leftPair = getSecondaries(variableTop, leftPair);
                 }
             }
@@ -261,7 +261,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie
                     rightPair = COMMON_SEC_PLUS_OFFSET;
                     break;
                 } else {
-                    rightPair = nextPair(table, c, rightPair, right, NULL, rightIndex, rightLength);
+                    rightPair = nextPair(table, c, rightPair, right, nullptr, rightIndex, rightLength);
                     rightPair = getSecondaries(variableTop, rightPair);
                 }
             }
@@ -300,7 +300,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie
                 UChar32 c = left[leftIndex++];
                 leftPair = (c <= LATIN_MAX) ? table[c] : lookup(table, c);
                 if(leftPair < MIN_LONG) {
-                    leftPair = nextPair(table, c, leftPair, left, NULL, leftIndex, leftLength);
+                    leftPair = nextPair(table, c, leftPair, left, nullptr, leftIndex, leftLength);
                 }
                 leftPair = getCases(variableTop, strengthIsPrimary, leftPair);
             }
@@ -313,7 +313,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie
                 UChar32 c = right[rightIndex++];
                 rightPair = (c <= LATIN_MAX) ? table[c] : lookup(table, c);
                 if(rightPair < MIN_LONG) {
-                    rightPair = nextPair(table, c, rightPair, right, NULL, rightIndex, rightLength);
+                    rightPair = nextPair(table, c, rightPair, right, nullptr, rightIndex, rightLength);
                 }
                 rightPair = getCases(variableTop, strengthIsPrimary, rightPair);
             }
@@ -353,7 +353,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie
             UChar32 c = left[leftIndex++];
             leftPair = (c <= LATIN_MAX) ? table[c] : lookup(table, c);
             if(leftPair < MIN_LONG) {
-                leftPair = nextPair(table, c, leftPair, left, NULL, leftIndex, leftLength);
+                leftPair = nextPair(table, c, leftPair, left, nullptr, leftIndex, leftLength);
             }
             leftPair = getTertiaries(variableTop, withCaseBits, leftPair);
         }
@@ -366,7 +366,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie
             UChar32 c = right[rightIndex++];
             rightPair = (c <= LATIN_MAX) ? table[c] : lookup(table, c);
             if(rightPair < MIN_LONG) {
-                rightPair = nextPair(table, c, rightPair, right, NULL, rightIndex, rightLength);
+                rightPair = nextPair(table, c, rightPair, right, nullptr, rightIndex, rightLength);
             }
             rightPair = getTertiaries(variableTop, withCaseBits, rightPair);
         }
@@ -409,7 +409,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie
             UChar32 c = left[leftIndex++];
             leftPair = (c <= LATIN_MAX) ? table[c] : lookup(table, c);
             if(leftPair < MIN_LONG) {
-                leftPair = nextPair(table, c, leftPair, left, NULL, leftIndex, leftLength);
+                leftPair = nextPair(table, c, leftPair, left, nullptr, leftIndex, leftLength);
             }
             leftPair = getQuaternaries(variableTop, leftPair);
         }
@@ -422,7 +422,7 @@ CollationFastLatin::compareUTF16(const uint16_t *table, const uint16_t *primarie
             UChar32 c = right[rightIndex++];
             rightPair = (c <= LATIN_MAX) ? table[c] : lookup(table, c);
             if(rightPair < MIN_LONG) {
-                rightPair = nextPair(table, c, rightPair, right, NULL, rightIndex, rightLength);
+                rightPair = nextPair(table, c, rightPair, right, nullptr, rightIndex, rightLength);
             }
             rightPair = getQuaternaries(variableTop, rightPair);
         }
@@ -499,7 +499,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries
                 leftPair &= LONG_PRIMARY_MASK;
                 break;
             } else {
-                leftPair = nextPair(table, c, leftPair, NULL, left, leftIndex, leftLength);
+                leftPair = nextPair(table, c, leftPair, nullptr, left, leftIndex, leftLength);
                 if(leftPair == BAIL_OUT) { return BAIL_OUT_RESULT; }
                 leftPair = getPrimaries(variableTop, leftPair);
             }
@@ -536,7 +536,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries
                 rightPair &= LONG_PRIMARY_MASK;
                 break;
             } else {
-                rightPair = nextPair(table, c, rightPair, NULL, right, rightIndex, rightLength);
+                rightPair = nextPair(table, c, rightPair, nullptr, right, rightIndex, rightLength);
                 if(rightPair == BAIL_OUT) { return BAIL_OUT_RESULT; }
                 rightPair = getPrimaries(variableTop, rightPair);
             }
@@ -587,7 +587,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries
                     leftPair = COMMON_SEC_PLUS_OFFSET;
                     break;
                 } else {
-                    leftPair = nextPair(table, c, leftPair, NULL, left, leftIndex, leftLength);
+                    leftPair = nextPair(table, c, leftPair, nullptr, left, leftIndex, leftLength);
                     leftPair = getSecondaries(variableTop, leftPair);
                 }
             }
@@ -612,7 +612,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries
                     rightPair = COMMON_SEC_PLUS_OFFSET;
                     break;
                 } else {
-                    rightPair = nextPair(table, c, rightPair, NULL, right, rightIndex, rightLength);
+                    rightPair = nextPair(table, c, rightPair, nullptr, right, rightIndex, rightLength);
                     rightPair = getSecondaries(variableTop, rightPair);
                 }
             }
@@ -651,7 +651,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries
                 UChar32 c = left[leftIndex++];
                 leftPair = (c <= 0x7f) ? table[c] : lookupUTF8Unsafe(table, c, left, leftIndex);
                 if(leftPair < MIN_LONG) {
-                    leftPair = nextPair(table, c, leftPair, NULL, left, leftIndex, leftLength);
+                    leftPair = nextPair(table, c, leftPair, nullptr, left, leftIndex, leftLength);
                 }
                 leftPair = getCases(variableTop, strengthIsPrimary, leftPair);
             }
@@ -664,7 +664,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries
                 UChar32 c = right[rightIndex++];
                 rightPair = (c <= 0x7f) ? table[c] : lookupUTF8Unsafe(table, c, right, rightIndex);
                 if(rightPair < MIN_LONG) {
-                    rightPair = nextPair(table, c, rightPair, NULL, right, rightIndex, rightLength);
+                    rightPair = nextPair(table, c, rightPair, nullptr, right, rightIndex, rightLength);
                 }
                 rightPair = getCases(variableTop, strengthIsPrimary, rightPair);
             }
@@ -704,7 +704,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries
             UChar32 c = left[leftIndex++];
             leftPair = (c <= 0x7f) ? table[c] : lookupUTF8Unsafe(table, c, left, leftIndex);
             if(leftPair < MIN_LONG) {
-                leftPair = nextPair(table, c, leftPair, NULL, left, leftIndex, leftLength);
+                leftPair = nextPair(table, c, leftPair, nullptr, left, leftIndex, leftLength);
             }
             leftPair = getTertiaries(variableTop, withCaseBits, leftPair);
         }
@@ -717,7 +717,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries
             UChar32 c = right[rightIndex++];
             rightPair = (c <= 0x7f) ? table[c] : lookupUTF8Unsafe(table, c, right, rightIndex);
             if(rightPair < MIN_LONG) {
-                rightPair = nextPair(table, c, rightPair, NULL, right, rightIndex, rightLength);
+                rightPair = nextPair(table, c, rightPair, nullptr, right, rightIndex, rightLength);
             }
             rightPair = getTertiaries(variableTop, withCaseBits, rightPair);
         }
@@ -760,7 +760,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries
             UChar32 c = left[leftIndex++];
             leftPair = (c <= 0x7f) ? table[c] : lookupUTF8Unsafe(table, c, left, leftIndex);
             if(leftPair < MIN_LONG) {
-                leftPair = nextPair(table, c, leftPair, NULL, left, leftIndex, leftLength);
+                leftPair = nextPair(table, c, leftPair, nullptr, left, leftIndex, leftLength);
             }
             leftPair = getQuaternaries(variableTop, leftPair);
         }
@@ -773,7 +773,7 @@ CollationFastLatin::compareUTF8(const uint16_t *table, const uint16_t *primaries
             UChar32 c = right[rightIndex++];
             rightPair = (c <= 0x7f) ? table[c] : lookupUTF8Unsafe(table, c, right, rightIndex);
             if(rightPair < MIN_LONG) {
-                rightPair = nextPair(table, c, rightPair, NULL, right, rightIndex, rightLength);
+                rightPair = nextPair(table, c, rightPair, nullptr, right, rightIndex, rightLength);
             }
             rightPair = getQuaternaries(variableTop, rightPair);
         }
@@ -872,7 +872,7 @@ CollationFastLatin::nextPair(const uint16_t *table, UChar32 c, uint32_t ce,
             // Read the next character.
             int32_t c2;
             int32_t nextIndex = sIndex;
-            if(s16 != NULL) {
+            if(s16 != nullptr) {
                 c2 = s16[nextIndex++];
                 if(c2 > LATIN_MAX) {
                     if(PUNCT_START <= c2 && c2 < PUNCT_LIMIT) {
index fc50e9df8edae099dd864ef4054476f18c41f28c..c481445ca0044ec765e597a3702b83edcf8ddc57 100644 (file)
@@ -89,7 +89,7 @@ binarySearch(const int64_t list[], int32_t limit, int64_t ce) {
 CollationFastLatinBuilder::CollationFastLatinBuilder(UErrorCode &errorCode)
         : ce0(0), ce1(0),
           contractionCEs(errorCode), uniqueCEs(errorCode),
-          miniCEs(NULL),
+          miniCEs(nullptr),
           firstDigitPrimary(0), firstLatinPrimary(0), lastLatinPrimary(0),
           firstShortPrimary(0), shortPrimaryOverflow(false),
           headerLength(0) {
@@ -431,7 +431,7 @@ CollationFastLatinBuilder::encodeUniqueCEs(UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return false; }
     uprv_free(miniCEs);
     miniCEs = (uint16_t *)uprv_malloc(uniqueCEs.size() * 2);
-    if(miniCEs == NULL) {
+    if(miniCEs == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         return false;
     }
index a47b3d86bea99a46e5b36d08444412c8ff9d0395..3a6671d5288959e8e6a6838651bc90c76877fbba 100644 (file)
@@ -46,7 +46,7 @@ CollationIterator::CEBuffer::ensureAppendCapacity(int32_t appCap, UErrorCode &er
         }
     } while(capacity < (length + appCap));
     int64_t *p = buffer.resize(capacity, length);
-    if(p == NULL) {
+    if(p == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         return false;
     }
@@ -149,7 +149,7 @@ CollationIterator::CollationIterator(const CollationIterator &other)
           trie(other.trie),
           data(other.data),
           cesIndex(other.cesIndex),
-          skipped(NULL),
+          skipped(nullptr),
           numCpFwd(other.numCpFwd),
           isNumeric(other.isNumeric) {
     UErrorCode errorCode = U_ZERO_ERROR;
@@ -191,7 +191,7 @@ CollationIterator::operator==(const CollationIterator &other) const {
 void
 CollationIterator::reset() {
     cesIndex = ceBuffer.length = 0;
-    if(skipped != NULL) { skipped->clear(); }
+    if(skipped != nullptr) { skipped->clear(); }
 }
 
 int32_t
@@ -312,7 +312,7 @@ CollationIterator::appendCEsFromCE32(const CollationData *d, UChar32 c, uint32_t
                 break;
             }
             UChar32 nextCp;
-            if(skipped == NULL && numCpFwd < 0) {
+            if(skipped == nullptr && numCpFwd < 0) {
                 // Some portion of nextCE32FromContraction() pulled out here as an ASCII fast path,
                 // avoiding the function call and the nextSkippedCodePoint() overhead.
                 nextCp = nextCodePoint(errorCode);
@@ -469,17 +469,17 @@ CollationIterator::getCE32FromPrefix(const CollationData *d, uint32_t ce32,
 
 UChar32
 CollationIterator::nextSkippedCodePoint(UErrorCode &errorCode) {
-    if(skipped != NULL && skipped->hasNext()) { return skipped->next(); }
+    if(skipped != nullptr && skipped->hasNext()) { return skipped->next(); }
     if(numCpFwd == 0) { return U_SENTINEL; }
     UChar32 c = nextCodePoint(errorCode);
-    if(skipped != NULL && !skipped->isEmpty() && c >= 0) { skipped->incBeyond(); }
+    if(skipped != nullptr && !skipped->isEmpty() && c >= 0) { skipped->incBeyond(); }
     if(numCpFwd > 0 && c >= 0) { --numCpFwd; }
     return c;
 }
 
 void
 CollationIterator::backwardNumSkipped(int32_t n, UErrorCode &errorCode) {
-    if(skipped != NULL && !skipped->isEmpty()) {
+    if(skipped != nullptr && !skipped->isEmpty()) {
         n = skipped->backwardNumCodePoints(n);
     }
     backwardNumCodePoints(n, errorCode);
@@ -501,7 +501,7 @@ CollationIterator::nextCE32FromContraction(const CollationData *d, uint32_t cont
     // and therefore need not remember the suffixes state from before a mismatch for retrying.
     // If we are already processing skipped combining marks, then we do track the state.
     UCharsTrie suffixes(p);
-    if(skipped != NULL && !skipped->isEmpty()) { skipped->saveTrieState(suffixes); }
+    if(skipped != nullptr && !skipped->isEmpty()) { skipped->saveTrieState(suffixes); }
     UStringTrieResult match = suffixes.firstForCodePoint(c);
     for(;;) {
         UChar32 nextCp;
@@ -510,7 +510,7 @@ CollationIterator::nextCE32FromContraction(const CollationData *d, uint32_t cont
             if(!USTRINGTRIE_HAS_NEXT(match) || (c = nextSkippedCodePoint(errorCode)) < 0) {
                 return ce32;
             }
-            if(skipped != NULL && !skipped->isEmpty()) { skipped->saveTrieState(suffixes); }
+            if(skipped != nullptr && !skipped->isEmpty()) { skipped->saveTrieState(suffixes); }
             sinceMatch = 1;
         } else if(match == USTRINGTRIE_NO_MATCH || (nextCp = nextSkippedCodePoint(errorCode)) < 0) {
             // No match for c, or partial match (USTRINGTRIE_NO_VALUE) and no further text.
@@ -597,10 +597,10 @@ CollationIterator::nextCE32FromDiscontiguousContraction(
     // We have read and matched (lookAhead-2) code points,
     // read non-matching c and peeked ahead at nextCp.
     // Return to the state before the mismatch and continue matching with nextCp.
-    if(skipped == NULL || skipped->isEmpty()) {
-        if(skipped == NULL) {
+    if(skipped == nullptr || skipped->isEmpty()) {
+        if(skipped == nullptr) {
             skipped = new SkippedState();
-            if(skipped == NULL) {
+            if(skipped == nullptr) {
                 errorCode = U_MEMORY_ALLOCATION_ERROR;
                 return 0;
             }
index 93c119c6b858b5fca66487653464d09ad86fbd7a..526509328980abf5c3198c2c88dd831f9e1f058a 100644 (file)
@@ -103,7 +103,7 @@ public:
             : trie(d->trie),
               data(d),
               cesIndex(0),
-              skipped(NULL),
+              skipped(nullptr),
               numCpFwd(-1),
               isNumeric(numeric) {}
 
index c7e0de618de48769dcfc942b5c17636932a21bbe..c429ac3f8f70303fbdc2efb05a6d6f02c8b5f7f3 100644 (file)
@@ -28,7 +28,7 @@ SortKeyByteSink::~SortKeyByteSink() {}
 
 void
 SortKeyByteSink::Append(const char *bytes, int32_t n) {
-    if (n <= 0 || bytes == NULL) {
+    if (n <= 0 || bytes == nullptr) {
         return;
     }
     if (ignore_ > 0) {
@@ -63,7 +63,7 @@ SortKeyByteSink::GetAppendBuffer(int32_t min_capacity,
                                  int32_t *result_capacity) {
     if (min_capacity < 1 || scratch_capacity < min_capacity) {
         *result_capacity = 0;
-        return NULL;
+        return nullptr;
     }
     if (ignore_ > 0) {
         // Do not write ignored bytes right at the end of the buffer.
@@ -192,7 +192,7 @@ UBool SortKeyLevel::ensureCapacity(int32_t appendCapacity) {
     if (newCapacity < 200) {
         newCapacity = 200;
     }
-    if(buffer.resize(newCapacity, len)==NULL) {
+    if(buffer.resize(newCapacity, len)==nullptr) {
         return ok = false;
     }
     return true;
index 8dad286dc6461a8b4ecb3833b3743c2cec625c91..d1331566128b3a06e0b271f97cab8d2c06d82f92 100644 (file)
@@ -66,14 +66,14 @@ public:
 
     UBool Overflowed() const { return appended_ > capacity_; }
     /** @return false if memory allocation failed */
-    UBool IsOk() const { return buffer_ != NULL; }
+    UBool IsOk() const { return buffer_ != nullptr; }
 
 protected:
     virtual void AppendBeyondCapacity(const char *bytes, int32_t n, int32_t length) = 0;
     virtual UBool Resize(int32_t appendCapacity, int32_t length) = 0;
 
     void SetNotOk() {
-        buffer_ = NULL;
+        buffer_ = nullptr;
         capacity_ = 0;
     }
 
index dc88c35a680095b46e12391f8a96e3bb1654cb2a..99686345f9ba8a2458ed8e34bf98fc94e5cb07f6 100644 (file)
@@ -33,7 +33,7 @@ U_NAMESPACE_BEGIN
 
 namespace {
 
-static const CollationCacheEntry *rootSingleton = NULL;
+static const CollationCacheEntry *rootSingleton = nullptr;
 static UInitOnce initOnce {};
 
 }  // namespace
@@ -51,17 +51,17 @@ U_CDECL_END
 UDataMemory*
 CollationRoot::loadFromFile(const char* ucadataPath, UErrorCode &errorCode) {
     UDataMemory dataMemory;
-    UDataMemory  *rDataMem = NULL;
+    UDataMemory  *rDataMem = nullptr;
     if (U_FAILURE(errorCode)) {
-        return NULL;
+        return nullptr;
     }
     if (uprv_mapFile(&dataMemory, ucadataPath, &errorCode)) {
         if (dataMemory.pHeader->dataHeader.magic1 == 0xda &&
             dataMemory.pHeader->dataHeader.magic2 == 0x27 &&
-            CollationDataReader::isAcceptable(NULL, "icu", "ucadata", &dataMemory.pHeader->info)) {
+            CollationDataReader::isAcceptable(nullptr, "icu", "ucadata", &dataMemory.pHeader->info)) {
             rDataMem = UDataMemory_createNewInstance(&errorCode);
             if (U_FAILURE(errorCode)) {
-                return NULL;
+                return nullptr;
             }
             rDataMem->pHeader = dataMemory.pHeader;
             rDataMem->mapAddr = dataMemory.mapAddr;
@@ -69,16 +69,16 @@ CollationRoot::loadFromFile(const char* ucadataPath, UErrorCode &errorCode) {
             return rDataMem;
         }
         errorCode = U_INVALID_FORMAT_ERROR;
-        return NULL;
+        return nullptr;
     }
     errorCode = U_MISSING_RESOURCE_ERROR;
-    return NULL;
+    return nullptr;
 }
 
 void U_CALLCONV
 CollationRoot::load(const char* ucadataPath, UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return; }
-    LocalPointer<CollationTailoring> t(new CollationTailoring(NULL));
+    LocalPointer<CollationTailoring> t(new CollationTailoring(nullptr));
     if(t.isNull() || t->isBogus()) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         return;
@@ -90,11 +90,11 @@ CollationRoot::load(const char* ucadataPath, UErrorCode &errorCode) {
                                                t->version, &errorCode);
     if(U_FAILURE(errorCode)) { return; }
     const uint8_t *inBytes = static_cast<const uint8_t *>(udata_getMemory(t->memory));
-    CollationDataReader::read(NULL, inBytes, udata_getLength(t->memory), *t, errorCode);
+    CollationDataReader::read(nullptr, inBytes, udata_getLength(t->memory), *t, errorCode);
     if(U_FAILURE(errorCode)) { return; }
     ucln_i18n_registerCleanup(UCLN_I18N_COLLATION_ROOT, uprv_collation_root_cleanup);
     CollationCacheEntry *entry = new CollationCacheEntry(Locale::getRoot(), t.getAlias());
-    if(entry != NULL) {
+    if(entry != nullptr) {
         t.orphan();  // The rootSingleton took ownership of the tailoring.
         entry->addRef();
         rootSingleton = entry;
@@ -103,29 +103,29 @@ CollationRoot::load(const char* ucadataPath, UErrorCode &errorCode) {
 
 const CollationCacheEntry *
 CollationRoot::getRootCacheEntry(UErrorCode &errorCode) {
-    umtx_initOnce(initOnce, CollationRoot::load, static_cast<const char*>(NULL), errorCode);
-    if(U_FAILURE(errorCode)) { return NULL; }
+    umtx_initOnce(initOnce, CollationRoot::load, static_cast<const char*>(nullptr), errorCode);
+    if(U_FAILURE(errorCode)) { return nullptr; }
     return rootSingleton;
 }
 
 const CollationTailoring *
 CollationRoot::getRoot(UErrorCode &errorCode) {
-    umtx_initOnce(initOnce, CollationRoot::load, static_cast<const char*>(NULL), errorCode);
-    if(U_FAILURE(errorCode)) { return NULL; }
+    umtx_initOnce(initOnce, CollationRoot::load, static_cast<const char*>(nullptr), errorCode);
+    if(U_FAILURE(errorCode)) { return nullptr; }
     return rootSingleton->tailoring;
 }
 
 const CollationData *
 CollationRoot::getData(UErrorCode &errorCode) {
     const CollationTailoring *root = getRoot(errorCode);
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     return root->data;
 }
 
 const CollationSettings *
 CollationRoot::getSettings(UErrorCode &errorCode) {
     const CollationTailoring *root = getRoot(errorCode);
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     return root->settings;
 }
 
index 7fb95c0b2b597d422f13f52c3f9596d1be6833dc..2e08cd7fd6fb09aa786c78ba261918a670ffaf7e 100644 (file)
@@ -58,9 +58,9 @@ CollationRuleParser::Importer::~Importer() {}
 CollationRuleParser::CollationRuleParser(const CollationData *base, UErrorCode &errorCode)
         : nfd(*Normalizer2::getNFDInstance(errorCode)),
           nfc(*Normalizer2::getNFCInstance(errorCode)),
-          rules(NULL), baseData(base), settings(NULL),
-          parseError(NULL), errorReason(NULL),
-          sink(NULL), importer(NULL),
+          rules(nullptr), baseData(base), settings(nullptr),
+          parseError(nullptr), errorReason(nullptr),
+          sink(nullptr), importer(nullptr),
           ruleIndex(0) {
 }
 
@@ -75,13 +75,13 @@ CollationRuleParser::parse(const UnicodeString &ruleString,
     if(U_FAILURE(errorCode)) { return; }
     settings = &outSettings;
     parseError = outParseError;
-    if(parseError != NULL) {
+    if(parseError != nullptr) {
         parseError->line = 0;
         parseError->offset = -1;
         parseError->preContext[0] = 0;
         parseError->postContext[0] = 0;
     }
-    errorReason = NULL;
+    errorReason = nullptr;
     parse(ruleString, errorCode);
 }
 
@@ -638,14 +638,14 @@ CollationRuleParser::parseSetting(UErrorCode &errorCode) {
                 setParseError("expected language tag in [import langTag]", errorCode);
                 return;
             }
-            if(importer == NULL) {
+            if(importer == nullptr) {
                 setParseError("[import langTag] is not supported", errorCode);
             } else {
                 UnicodeString importedRules;
                 importer->getRules(baseID, length > 0 ? collationType : "standard",
                                    importedRules, errorReason, errorCode);
                 if(U_FAILURE(errorCode)) {
-                    if(errorReason == NULL) {
+                    if(errorReason == nullptr) {
                         errorReason = "[import langTag] failed";
                     }
                     setErrorContext();
@@ -655,7 +655,7 @@ CollationRuleParser::parseSetting(UErrorCode &errorCode) {
                 int32_t outerRuleIndex = ruleIndex;
                 parse(importedRules, errorCode);
                 if(U_FAILURE(errorCode)) {
-                    if(parseError != NULL) {
+                    if(parseError != nullptr) {
                         parseError->offset = outerRuleIndex;
                     }
                 }
@@ -825,12 +825,12 @@ CollationRuleParser::setParseError(const char *reason, UErrorCode &errorCode) {
     // rather than U_PARSE_ERROR;
     errorCode = U_INVALID_FORMAT_ERROR;
     errorReason = reason;
-    if(parseError != NULL) { setErrorContext(); }
+    if(parseError != nullptr) { setErrorContext(); }
 }
 
 void
 CollationRuleParser::setErrorContext() {
-    if(parseError == NULL) { return; }
+    if(parseError == nullptr) { return; }
 
     // Note: This relies on the calling code maintaining the ruleIndex
     // at a position that is useful for debugging.
index b23c5e318d7c4f4a4abc607e1a9477f2516ae021..d707e7978aeea38d1ec798efde798099d3efac79 100644 (file)
@@ -48,8 +48,8 @@ TailoredSet::forData(const CollationData *d, UErrorCode &ec) {
     errorCode = ec;  // Preserve info & warning codes.
     data = d;
     baseData = d->base;
-    U_ASSERT(baseData != NULL);
-    utrie2_enum(data->trie, NULL, enumTailoredRange, this);
+    U_ASSERT(baseData != nullptr);
+    utrie2_enum(data->trie, nullptr, enumTailoredRange, this);
     ec = errorCode;
 }
 
@@ -218,20 +218,20 @@ TailoredSet::comparePrefixes(UChar32 c, const UChar *p, const UChar *q) {
     // Parallel iteration over prefixes of both tables.
     UCharsTrie::Iterator prefixes(p, 0, errorCode);
     UCharsTrie::Iterator basePrefixes(q, 0, errorCode);
-    const UnicodeString *tp = NULL;  // Tailoring prefix.
-    const UnicodeString *bp = NULL;  // Base prefix.
+    const UnicodeString *tp = nullptr;  // Tailoring prefix.
+    const UnicodeString *bp = nullptr;  // Base prefix.
     // Use a string with a U+FFFF as the limit sentinel.
     // U+FFFF is untailorable and will not occur in prefixes.
     UnicodeString none((UChar)0xffff);
     for(;;) {
-        if(tp == NULL) {
+        if(tp == nullptr) {
             if(prefixes.next(errorCode)) {
                 tp = &prefixes.getString();
             } else {
                 tp = &none;
             }
         }
-        if(bp == NULL) {
+        if(bp == nullptr) {
             if(basePrefixes.next(errorCode)) {
                 bp = &basePrefixes.getString();
             } else {
@@ -243,17 +243,17 @@ TailoredSet::comparePrefixes(UChar32 c, const UChar *p, const UChar *q) {
         if(cmp < 0) {
             // tp occurs in the tailoring but not in the base.
             addPrefix(data, *tp, c, (uint32_t)prefixes.getValue());
-            tp = NULL;
+            tp = nullptr;
         } else if(cmp > 0) {
             // bp occurs in the base but not in the tailoring.
             addPrefix(baseData, *bp, c, (uint32_t)basePrefixes.getValue());
-            bp = NULL;
+            bp = nullptr;
         } else {
             setPrefix(*tp);
             compare(c, (uint32_t)prefixes.getValue(), (uint32_t)basePrefixes.getValue());
             resetPrefix();
-            tp = NULL;
-            bp = NULL;
+            tp = nullptr;
+            bp = nullptr;
         }
     }
 }
@@ -263,22 +263,22 @@ TailoredSet::compareContractions(UChar32 c, const UChar *p, const UChar *q) {
     // Parallel iteration over suffixes of both tables.
     UCharsTrie::Iterator suffixes(p, 0, errorCode);
     UCharsTrie::Iterator baseSuffixes(q, 0, errorCode);
-    const UnicodeString *ts = NULL;  // Tailoring suffix.
-    const UnicodeString *bs = NULL;  // Base suffix.
+    const UnicodeString *ts = nullptr;  // Tailoring suffix.
+    const UnicodeString *bs = nullptr;  // Base suffix.
     // Use a string with two U+FFFF as the limit sentinel.
     // U+FFFF is untailorable and will not occur in contractions except maybe
     // as a single suffix character for a root-collator boundary contraction.
     UnicodeString none((UChar)0xffff);
     none.append((UChar)0xffff);
     for(;;) {
-        if(ts == NULL) {
+        if(ts == nullptr) {
             if(suffixes.next(errorCode)) {
                 ts = &suffixes.getString();
             } else {
                 ts = &none;
             }
         }
-        if(bs == NULL) {
+        if(bs == nullptr) {
             if(baseSuffixes.next(errorCode)) {
                 bs = &baseSuffixes.getString();
             } else {
@@ -290,17 +290,17 @@ TailoredSet::compareContractions(UChar32 c, const UChar *p, const UChar *q) {
         if(cmp < 0) {
             // ts occurs in the tailoring but not in the base.
             addSuffix(c, *ts);
-            ts = NULL;
+            ts = nullptr;
         } else if(cmp > 0) {
             // bs occurs in the base but not in the tailoring.
             addSuffix(c, *bs);
-            bs = NULL;
+            bs = nullptr;
         } else {
             suffix = ts;
             compare(c, (uint32_t)suffixes.getValue(), (uint32_t)baseSuffixes.getValue());
-            suffix = NULL;
-            ts = NULL;
-            bs = NULL;
+            suffix = nullptr;
+            ts = nullptr;
+            bs = nullptr;
         }
     }
 }
@@ -340,12 +340,12 @@ TailoredSet::addSuffix(UChar32 c, const UnicodeString &sfx) {
 
 void
 TailoredSet::add(UChar32 c) {
-    if(unreversedPrefix.isEmpty() && suffix == NULL) {
+    if(unreversedPrefix.isEmpty() && suffix == nullptr) {
         tailored->add(c);
     } else {
         UnicodeString s(unreversedPrefix);
         s.append(c);
-        if(suffix != NULL) {
+        if(suffix != nullptr) {
             s.append(*suffix);
         }
         tailored->add(s);
@@ -393,12 +393,12 @@ ContractionsAndExpansions::forData(const CollationData *d, UErrorCode &ec) {
     if(U_FAILURE(ec)) { return; }
     errorCode = ec;  // Preserve info & warning codes.
     // Add all from the data, can be tailoring or base.
-    if(d->base != NULL) {
+    if(d->base != nullptr) {
         checkTailored = -1;
     }
     data = d;
-    utrie2_enum(data->trie, NULL, enumCnERange, this);
-    if(d->base == NULL || U_FAILURE(errorCode)) {
+    utrie2_enum(data->trie, nullptr, enumCnERange, this);
+    if(d->base == nullptr || U_FAILURE(errorCode)) {
         ec = errorCode;
         return;
     }
@@ -406,7 +406,7 @@ ContractionsAndExpansions::forData(const CollationData *d, UErrorCode &ec) {
     tailored.freeze();
     checkTailored = 1;
     data = d->base;
-    utrie2_enum(data->trie, NULL, enumCnERange, this);
+    utrie2_enum(data->trie, nullptr, enumCnERange, this);
     ec = errorCode;
 }
 
@@ -429,7 +429,7 @@ ContractionsAndExpansions::handleCE32(UChar32 start, UChar32 end, uint32_t ce32)
     for(;;) {
         if((ce32 & 0xff) < Collation::SPECIAL_CE32_LOW_BYTE) {
             // !isSpecialCE32()
-            if(sink != NULL) {
+            if(sink != nullptr) {
                 sink->handleCE(Collation::ceFromSimpleCE32(ce32));
             }
             return;
@@ -443,17 +443,17 @@ ContractionsAndExpansions::handleCE32(UChar32 start, UChar32 end, uint32_t ce32)
             if(U_SUCCESS(errorCode)) { errorCode = U_INTERNAL_PROGRAM_ERROR; }
             return;
         case Collation::LONG_PRIMARY_TAG:
-            if(sink != NULL) {
+            if(sink != nullptr) {
                 sink->handleCE(Collation::ceFromLongPrimaryCE32(ce32));
             }
             return;
         case Collation::LONG_SECONDARY_TAG:
-            if(sink != NULL) {
+            if(sink != nullptr) {
                 sink->handleCE(Collation::ceFromLongSecondaryCE32(ce32));
             }
             return;
         case Collation::LATIN_EXPANSION_TAG:
-            if(sink != NULL) {
+            if(sink != nullptr) {
                 ces[0] = Collation::latinCE0FromCE32(ce32);
                 ces[1] = Collation::latinCE1FromCE32(ce32);
                 sink->handleExpansion(ces, 2);
@@ -465,7 +465,7 @@ ContractionsAndExpansions::handleCE32(UChar32 start, UChar32 end, uint32_t ce32)
             }
             return;
         case Collation::EXPANSION32_TAG:
-            if(sink != NULL) {
+            if(sink != nullptr) {
                 const uint32_t *ce32s = data->ce32s + Collation::indexFromCE32(ce32);
                 int32_t length = Collation::lengthFromCE32(ce32);
                 for(int32_t i = 0; i < length; ++i) {
@@ -480,7 +480,7 @@ ContractionsAndExpansions::handleCE32(UChar32 start, UChar32 end, uint32_t ce32)
             }
             return;
         case Collation::EXPANSION_TAG:
-            if(sink != NULL) {
+            if(sink != nullptr) {
                 int32_t length = Collation::lengthFromCE32(ce32);
                 sink->handleExpansion(data->ces + Collation::indexFromCE32(ce32), length);
             }
@@ -506,10 +506,10 @@ ContractionsAndExpansions::handleCE32(UChar32 start, UChar32 end, uint32_t ce32)
             ce32 = data->ce32s[0];
             break;
         case Collation::HANGUL_TAG:
-            if(sink != NULL) {
+            if(sink != nullptr) {
                 // TODO: This should be optimized,
                 // especially if [start..end] is the complete Hangul range. (assert that)
-                UTF16CollationIterator iter(data, false, NULL, NULL, NULL);
+                UTF16CollationIterator iter(data, false, nullptr, nullptr, nullptr);
                 UChar hangul[1] = { 0 };
                 for(UChar32 c = start; c <= end; ++c) {
                     hangul[0] = (UChar)c;
@@ -579,13 +579,13 @@ ContractionsAndExpansions::handleContractions(
         }
         handleCE32(start, end, (uint32_t)suffixes.getValue());
     }
-    suffix = NULL;
+    suffix = nullptr;
 }
 
 void
 ContractionsAndExpansions::addExpansions(UChar32 start, UChar32 end) {
-    if(unreversedPrefix.isEmpty() && suffix == NULL) {
-        if(expansions != NULL) {
+    if(unreversedPrefix.isEmpty() && suffix == nullptr) {
+        if(expansions != nullptr) {
             expansions->add(start, end);
         }
     } else {
@@ -595,11 +595,11 @@ ContractionsAndExpansions::addExpansions(UChar32 start, UChar32 end) {
 
 void
 ContractionsAndExpansions::addStrings(UChar32 start, UChar32 end, UnicodeSet *set) {
-    if(set == NULL) { return; }
+    if(set == nullptr) { return; }
     UnicodeString s(unreversedPrefix);
     do {
         s.append(start);
-        if(suffix != NULL) {
+        if(suffix != nullptr) {
             s.append(*suffix);
         }
         set->add(s);
index aed41f7ac8d11941d06d6bcc0ad385766cd426ac..f69debc5d9fc9039c8d6751b206e325e2ce1f096 100644 (file)
@@ -43,9 +43,9 @@ struct CollationData;
 class TailoredSet : public UMemory {
 public:
     TailoredSet(UnicodeSet *t)
-            : data(NULL), baseData(NULL),
+            : data(nullptr), baseData(nullptr),
               tailored(t),
-              suffix(NULL),
+              suffix(nullptr),
               errorCode(U_ZERO_ERROR) {}
 
     void forData(const CollationData *d, UErrorCode &errorCode);
@@ -94,12 +94,12 @@ public:
     };
 
     ContractionsAndExpansions(UnicodeSet *con, UnicodeSet *exp, CESink *s, UBool prefixes)
-            : data(NULL),
+            : data(nullptr),
               contractions(con), expansions(exp),
               sink(s),
               addPrefixes(prefixes),
               checkTailored(0),
-              suffix(NULL),
+              suffix(nullptr),
               errorCode(U_ZERO_ERROR) {}
 
     void forData(const CollationData *d, UErrorCode &errorCode);
index fe051880b81ff2b76ca1627e53da6f9510cd4951..1533daf38c7a33452428ef05963e37be2c23c6ba 100644 (file)
@@ -30,10 +30,10 @@ U_NAMESPACE_BEGIN
 CollationSettings::CollationSettings(const CollationSettings &other)
         : SharedObject(other),
           options(other.options), variableTop(other.variableTop),
-          reorderTable(NULL),
+          reorderTable(nullptr),
           minHighNoReorder(other.minHighNoReorder),
-          reorderRanges(NULL), reorderRangesLength(0),
-          reorderCodes(NULL), reorderCodesLength(0), reorderCodesCapacity(0),
+          reorderRanges(nullptr), reorderRangesLength(0),
+          reorderCodes(nullptr), reorderCodesLength(0), reorderCodesCapacity(0),
           fastLatinOptions(other.fastLatinOptions) {
     UErrorCode errorCode = U_ZERO_ERROR;
     copyReorderingFrom(other, errorCode);
@@ -72,10 +72,10 @@ CollationSettings::hashCode() const {
 
 void
 CollationSettings::resetReordering() {
-    // When we turn off reordering, we want to set a NULL permutation
+    // When we turn off reordering, we want to set a nullptr permutation
     // rather than a no-op permutation.
     // Keep the memory via reorderCodes and its capacity.
-    reorderTable = NULL;
+    reorderTable = nullptr;
     minHighNoReorder = 0;
     reorderRangesLength = 0;
     reorderCodesLength = 0;
@@ -86,7 +86,7 @@ CollationSettings::aliasReordering(const CollationData &data, const int32_t *cod
                                    const uint32_t *ranges, int32_t rangesLength,
                                    const uint8_t *table, UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return; }
-    if(table != NULL &&
+    if(table != nullptr &&
             (rangesLength == 0 ?
                     !reorderTableHasSplitBytes(table) :
                     rangesLength >= 2 &&
@@ -111,7 +111,7 @@ CollationSettings::aliasReordering(const CollationData &data, const int32_t *cod
         if(firstSplitByteRangeIndex == rangesLength) {
             U_ASSERT(!reorderTableHasSplitBytes(table));
             minHighNoReorder = 0;
-            reorderRanges = NULL;
+            reorderRanges = nullptr;
             reorderRangesLength = 0;
         } else {
             U_ASSERT(table[ranges[firstSplitByteRangeIndex] >> 24] == 0);
@@ -201,7 +201,7 @@ CollationSettings::setReorderArrays(const int32_t *codes, int32_t codesLength,
         // Allocate one memory block for the codes, the ranges, and the 16-aligned table.
         int32_t capacity = (totalLength + 3) & ~3;  // round up to a multiple of 4 ints
         ownedCodes = (int32_t *)uprv_malloc(capacity * 4 + 256);
-        if(ownedCodes == NULL) {
+        if(ownedCodes == nullptr) {
             resetReordering();
             errorCode = U_MEMORY_ALLOCATION_ERROR;
             return;
index 3da8f6214f64ee98cf3494a855a9da2da9766d1d..43a181211c072465bd43060b6e29b14f72b31820 100644 (file)
@@ -106,10 +106,10 @@ struct U_I18N_API CollationSettings : public SharedObject {
             : options((UCOL_DEFAULT_STRENGTH << STRENGTH_SHIFT) |
                       (MAX_VAR_PUNCT << MAX_VARIABLE_SHIFT)),
               variableTop(0),
-              reorderTable(NULL),
+              reorderTable(nullptr),
               minHighNoReorder(0),
-              reorderRanges(NULL), reorderRangesLength(0),
-              reorderCodes(NULL), reorderCodesLength(0), reorderCodesCapacity(0),
+              reorderRanges(nullptr), reorderRangesLength(0),
+              reorderCodes(nullptr), reorderCodesLength(0), reorderCodesCapacity(0),
               fastLatinOptions(-1) {}
 
     CollationSettings(const CollationSettings &other);
@@ -131,7 +131,7 @@ struct U_I18N_API CollationSettings : public SharedObject {
                        UErrorCode &errorCode);
     void copyReorderingFrom(const CollationSettings &other, UErrorCode &errorCode);
 
-    inline UBool hasReordering() const { return reorderTable != NULL; }
+    inline UBool hasReordering() const { return reorderTable != nullptr; }
     static UBool reorderTableHasSplitBytes(const uint8_t table[256]);
     inline uint32_t reorder(uint32_t p) const {
         uint8_t b = reorderTable[p >> 24];
@@ -216,7 +216,7 @@ struct U_I18N_API CollationSettings : public SharedObject {
     /** Variable-top primary weight. */
     uint32_t variableTop;
     /**
-     * 256-byte table for reordering permutation of primary lead bytes; NULL if no reordering.
+     * 256-byte table for reordering permutation of primary lead bytes; nullptr if no reordering.
      * A 0 entry at a non-zero index means that the primary lead byte is "split"
      * (there are different offsets for primaries that share that lead byte)
      * and the reordering offset must be determined via the reorderRanges.
index 440414c43365b2c552e37594b9d99d6e21e966f7..8d22cf251660446a92af7375703940501306a340 100644 (file)
 U_NAMESPACE_BEGIN
 
 CollationTailoring::CollationTailoring(const CollationSettings *baseSettings)
-        : data(NULL), settings(baseSettings),
+        : data(nullptr), settings(baseSettings),
           actualLocale(""),
-          ownedData(NULL),
-          builder(NULL), memory(NULL), bundle(NULL),
-          trie(NULL), unsafeBackwardSet(NULL),
-          maxExpansions(NULL) {
-    if(baseSettings != NULL) {
+          ownedData(nullptr),
+          builder(nullptr), memory(nullptr), bundle(nullptr),
+          trie(nullptr), unsafeBackwardSet(nullptr),
+          maxExpansions(nullptr) {
+    if(baseSettings != nullptr) {
         U_ASSERT(baseSettings->reorderCodesLength == 0);
-        U_ASSERT(baseSettings->reorderTable == NULL);
+        U_ASSERT(baseSettings->reorderTable == nullptr);
         U_ASSERT(baseSettings->minHighNoReorder == 0);
     } else {
         settings = new CollationSettings();
     }
-    if(settings != NULL) {
+    if(settings != nullptr) {
         settings->addRef();
     }
     rules.getTerminatedBuffer();  // ensure NUL-termination
@@ -69,11 +69,11 @@ CollationTailoring::~CollationTailoring() {
 UBool
 CollationTailoring::ensureOwnedData(UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return false; }
-    if(ownedData == NULL) {
+    if(ownedData == nullptr) {
         const Normalizer2Impl *nfcImpl = Normalizer2Factory::getNFCImpl(errorCode);
         if(U_FAILURE(errorCode)) { return false; }
         ownedData = new CollationData(*nfcImpl);
-        if(ownedData == NULL) {
+        if(ownedData == nullptr) {
             errorCode = U_MEMORY_ALLOCATION_ERROR;
             return false;
         }
index a6143c1c269dfb6d15c0819171f379f46fe0e870..ed7e46e3b9c47ceea6f22540aeb8f3ebb0fe59ac 100644 (file)
@@ -54,7 +54,7 @@ struct U_I18N_API CollationTailoring : public SharedObject {
     /**
      * Returns true if the constructor could not initialize properly.
      */
-    UBool isBogus() { return settings == NULL; }
+    UBool isBogus() { return settings == nullptr; }
 
     UBool ensureOwnedData(UErrorCode &errorCode);
 
@@ -97,7 +97,7 @@ private:
 struct U_I18N_API CollationCacheEntry : public SharedObject {
     CollationCacheEntry(const Locale &loc, const CollationTailoring *t)
             : validLocale(loc), tailoring(t) {
-        if(t != NULL) {
+        if(t != nullptr) {
             t->addRef();
         }
     }
index 02d0268f53b090cc3dc0f175cbb987d01d160d3c..2351484590c9fa8e0892c7e2948c602fa017ee1b 100644 (file)
@@ -409,7 +409,7 @@ CollationWeights::allocWeightsInShortRanges(int32_t n, int32_t minLength) {
                 /* sort the ranges by weight values */
                 UErrorCode errorCode=U_ZERO_ERROR;
                 uprv_sortArray(ranges, rangeCount, sizeof(WeightRange),
-                               compareRanges, NULL, false, &errorCode);
+                               compareRanges, nullptr, false, &errorCode);
                 /* ignore error code: we know that the internal sort function will not fail here */
             }
             return true;
index f2b1c36a338083c06a490d378a5195860bc35a9a..8236d4fae57dcf5d13f43974b44ee49c70a7801c 100644 (file)
@@ -110,7 +110,7 @@ CompoundTransliterator::CompoundTransliterator(const UnicodeString& newID,
 CompoundTransliterator::CompoundTransliterator(UVector& list,
                                                UParseError& /*parseError*/,
                                                UErrorCode& status) :
-    Transliterator(UnicodeString(), NULL),
+    Transliterator(UnicodeString(), nullptr),
     trans(0), numAnonymousRBTs(0)
 {
     // TODO add code for parseError...currently unused, but
@@ -123,7 +123,7 @@ CompoundTransliterator::CompoundTransliterator(UVector& list,
                                                int32_t anonymousRBTs,
                                                UParseError& /*parseError*/,
                                                UErrorCode& status) :
-    Transliterator(UnicodeString(), NULL),
+    Transliterator(UnicodeString(), nullptr),
     trans(0), numAnonymousRBTs(anonymousRBTs)
 {
     init(list, UTRANS_FORWARD, false, status);
@@ -131,7 +131,7 @@ CompoundTransliterator::CompoundTransliterator(UVector& list,
 
 /**
  * Finish constructing a transliterator: only to be called by
- * constructors.  Before calling init(), set trans and filter to NULL.
+ * constructors.  Before calling init(), set trans and filter to nullptr.
  * @param id the id containing ';'-separated entries
  * @param direction either FORWARD or REVERSE
  * @param idSplitPoint the index into id at which the
@@ -139,7 +139,7 @@ CompoundTransliterator::CompoundTransliterator(UVector& list,
  * -1 if there is none.
  * @param adoptedSplitTransliterator a transliterator to be inserted
  * before the entry at offset idSplitPoint in the id string.  May be
- * NULL to insert no entry.
+ * nullptr to insert no entry.
  * @param fixReverseID if true, then reconstruct the ID of reverse
  * entries by calling getID() of component entries.  Some constructors
  * do not require this because they apply a facade ID anyway.
@@ -156,7 +156,7 @@ void CompoundTransliterator::init(const UnicodeString& id,
     }
 
     UVector list(status);
-    UnicodeSet* compoundFilter = NULL;
+    UnicodeSet* compoundFilter = nullptr;
     UnicodeString regenID;
     if (!TransliteratorIDParser::parseCompoundID(id, direction,
                                       regenID, list, compoundFilter)) {
@@ -169,14 +169,14 @@ void CompoundTransliterator::init(const UnicodeString& id,
 
     init(list, direction, fixReverseID, status);
 
-    if (compoundFilter != NULL) {
+    if (compoundFilter != nullptr) {
         adoptFilter(compoundFilter);
     }
 }
 
 /**
  * Finish constructing a transliterator: only to be called by
- * constructors.  Before calling init(), set trans and filter to NULL.
+ * constructors.  Before calling init(), set trans and filter to nullptr.
  * @param list a vector of transliterator objects to be adopted.  It
  * should NOT be empty.  The list should be in declared order.  That
  * is, it should be in the FORWARD order; if direction is REVERSE then
@@ -197,7 +197,7 @@ void CompoundTransliterator::init(UVector& list,
     if (U_SUCCESS(status)) {
         count = list.size();
         trans = (Transliterator **)uprv_malloc(count * sizeof(Transliterator *));
-        /* test for NULL */
+        /* test for nullptr */
         if (trans == 0) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
@@ -286,23 +286,23 @@ CompoundTransliterator& CompoundTransliterator::operator=(
     Transliterator::operator=(t);
     int32_t i = 0;
     UBool failed = false;
-    if (trans != NULL) {
+    if (trans != nullptr) {
         for (i=0; i<count; ++i) {
             delete trans[i];
             trans[i] = 0;
         }
     }
     if (t.count > count) {
-        if (trans != NULL) {
+        if (trans != nullptr) {
             uprv_free(trans);
         }
         trans = (Transliterator **)uprv_malloc(t.count * sizeof(Transliterator *));
     }
     count = t.count;
-    if (trans != NULL) {
+    if (trans != nullptr) {
         for (i=0; i<count; ++i) {
             trans[i] = t.trans[i]->clone();
-            if (trans[i] == NULL) {
+            if (trans[i] == nullptr) {
                 failed = true;
                 break;
             }
@@ -314,7 +314,7 @@ CompoundTransliterator& CompoundTransliterator::operator=(
         int32_t n;
         for (n = i-1; n >= 0; n--) {
             uprv_free(trans[n]);
-            trans[n] = NULL;
+            trans[n] = nullptr;
         }
     }
     numAnonymousRBTs = t.numAnonymousRBTs;
@@ -348,14 +348,14 @@ const Transliterator& CompoundTransliterator::getTransliterator(int32_t index) c
 void CompoundTransliterator::setTransliterators(Transliterator* const transliterators[],
                                                 int32_t transCount) {
     Transliterator** a = (Transliterator **)uprv_malloc(transCount * sizeof(Transliterator *));
-    if (a == NULL) {
+    if (a == nullptr) {
         return;
     }
     int32_t i = 0;
     UBool failed = false;
     for (i=0; i<transCount; ++i) {
         a[i] = transliterators[i]->clone();
-        if (a[i] == NULL) {
+        if (a[i] == nullptr) {
             failed = true;
             break;
         }
@@ -364,7 +364,7 @@ void CompoundTransliterator::setTransliterators(Transliterator* const transliter
         int32_t n;
         for (n = i-1; n >= 0; n--) {
             uprv_free(a[n]);
-            a[n] = NULL;
+            a[n] = nullptr;
         }
         return;
     }
@@ -401,7 +401,7 @@ UnicodeString& CompoundTransliterator::toRules(UnicodeString& rulesSource,
     // compoundRBTIndex >= 0.  For the transliterator at compoundRBTIndex,
     // we do call toRules() recursively.
     rulesSource.truncate(0);
-    if (numAnonymousRBTs >= 1 && getFilter() != NULL) {
+    if (numAnonymousRBTs >= 1 && getFilter() != nullptr) {
         // If we are a compound RBT and if we have a global
         // filter, then emit it at the top.
         UnicodeString pat;
index af60cb827e3040338f1774b81181cbe715a53d40..2b8af08ea980dc8f985cb192a073f26d0059c613 100644 (file)
@@ -70,7 +70,7 @@ public:
      * @param id compound ID
      * @param dir either UTRANS_FORWARD or UTRANS_REVERSE
      * @param adoptedFilter a global filter for this compound transliterator
-     * or NULL
+     * or nullptr
      */
     CompoundTransliterator(const UnicodeString& id,
                            UTransDirection dir,
@@ -80,7 +80,7 @@ public:
 
     /**
      * Constructs a new compound transliterator in the FORWARD
-     * direction with a NULL filter.
+     * direction with a nullptr filter.
      */
     CompoundTransliterator(const UnicodeString& id,
                            UParseError& parseError,
index 0b22d4dc2ae9b7a935eb61eadc25118f7371ba77..87b31a7958d32e3b0fe55861017ac1212d52001a 100644 (file)
@@ -46,7 +46,7 @@ struct CSRecognizerInfo : public UMemory {
 
 U_NAMESPACE_END
 
-static icu::CSRecognizerInfo **fCSRecognizers = NULL;
+static icu::CSRecognizerInfo **fCSRecognizers = nullptr;
 static icu::UInitOnce gCSRecognizersInitOnce {};
 static int32_t fCSRecognizers_size = 0;
 
@@ -54,14 +54,14 @@ U_CDECL_BEGIN
 static UBool U_CALLCONV csdet_cleanup(void)
 {
     U_NAMESPACE_USE
-    if (fCSRecognizers != NULL) {
+    if (fCSRecognizers != nullptr) {
         for(int32_t r = 0; r < fCSRecognizers_size; r += 1) {
             delete fCSRecognizers[r];
-            fCSRecognizers[r] = NULL;
+            fCSRecognizers[r] = nullptr;
         }
 
         DELETE_ARRAY(fCSRecognizers);
-        fCSRecognizers = NULL;
+        fCSRecognizers = nullptr;
         fCSRecognizers_size = 0;
     }
     gCSRecognizersInitOnce.reset();
@@ -124,14 +124,14 @@ static void U_CALLCONV initRecognizers(UErrorCode &status) {
 
     fCSRecognizers = NEW_ARRAY(CSRecognizerInfo *, rCount);
 
-    if (fCSRecognizers == NULL) {
+    if (fCSRecognizers == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
     } 
     else {
         fCSRecognizers_size = rCount;
         for (int32_t r = 0; r < rCount; r += 1) {
             fCSRecognizers[r] = tempArray[r];
-            if (fCSRecognizers[r] == NULL) {
+            if (fCSRecognizers[r] == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
             }
         }
@@ -148,9 +148,9 @@ void CharsetDetector::setRecognizers(UErrorCode &status)
 }
 
 CharsetDetector::CharsetDetector(UErrorCode &status)
-  : textIn(new InputText(status)), resultArray(NULL),
+  : textIn(new InputText(status)), resultArray(nullptr),
     resultCount(0), fStripTags(false), fFreshTextSet(false),
-    fEnabledRecognizers(NULL)
+    fEnabledRecognizers(nullptr)
 {
     if (U_FAILURE(status)) {
         return;
@@ -164,7 +164,7 @@ CharsetDetector::CharsetDetector(UErrorCode &status)
 
     resultArray = (CharsetMatch **)uprv_malloc(sizeof(CharsetMatch *)*fCSRecognizers_size);
 
-    if (resultArray == NULL) {
+    if (resultArray == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -172,7 +172,7 @@ CharsetDetector::CharsetDetector(UErrorCode &status)
     for(int32_t i = 0; i < fCSRecognizers_size; i += 1) {
         resultArray[i] = new CharsetMatch();
 
-        if (resultArray[i] == NULL) {
+        if (resultArray[i] == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             break;
         }
@@ -236,7 +236,7 @@ const CharsetMatch *CharsetDetector::detect(UErrorCode &status)
     if(maxMatchesFound > 0) {
         return resultArray[0];
     } else {
-        return NULL;
+        return nullptr;
     }
 }
 
@@ -245,7 +245,7 @@ const CharsetMatch * const *CharsetDetector::detectAll(int32_t &maxMatchesFound,
     if(!textIn->isSet()) {
         status = U_MISSING_RESOURCE_ERROR;// TODO:  Need to set proper status code for input text not set
 
-        return NULL;
+        return nullptr;
     } else if (fFreshTextSet) {
         CharsetRecognizer *csr;
         int32_t            i;
@@ -263,7 +263,7 @@ const CharsetMatch * const *CharsetDetector::detectAll(int32_t &maxMatchesFound,
         }
 
         if (resultCount > 1) {
-            uprv_sortArray(resultArray, resultCount, sizeof resultArray[0], charsetMatchComparator, NULL, true, &status);
+            uprv_sortArray(resultArray, resultCount, sizeof resultArray[0], charsetMatchComparator, nullptr, true, &status);
         }
         fFreshTextSet = false;
     }
@@ -272,7 +272,7 @@ const CharsetMatch * const *CharsetDetector::detectAll(int32_t &maxMatchesFound,
 
     if (maxMatchesFound == 0) {
         status = U_INVALID_CHAR_FOUND;
-        return NULL;
+        return nullptr;
     }
 
     return resultArray;
@@ -300,10 +300,10 @@ void CharsetDetector::setDetectableCharset(const char *encoding, UBool enabled,
         return;
     }
 
-    if (fEnabledRecognizers == NULL && !isDefaultVal) {
+    if (fEnabledRecognizers == nullptr && !isDefaultVal) {
         // Create an array storing the non default setting
         fEnabledRecognizers = NEW_ARRAY(UBool, fCSRecognizers_size);
-        if (fEnabledRecognizers == NULL) {
+        if (fEnabledRecognizers == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
@@ -313,7 +313,7 @@ void CharsetDetector::setDetectableCharset(const char *encoding, UBool enabled,
         }
     }
 
-    if (fEnabledRecognizers != NULL) {
+    if (fEnabledRecognizers != nullptr) {
         fEnabledRecognizers[modIdx] = enabled;
     }
 }
@@ -342,7 +342,7 @@ typedef struct {
 
 static void U_CALLCONV
 enumClose(UEnumeration *en) {
-    if(en->context != NULL) {
+    if(en->context != nullptr) {
         DELETE_ARRAY(en->context);
     }
 
@@ -359,7 +359,7 @@ enumCount(UEnumeration *en, UErrorCode *) {
     // Otherwise, ucsdet_getDetectableCharsets - only enabled ones
     int32_t count = 0;
     UBool *enabledArray = ((Context *)en->context)->enabledRecognizers;
-    if (enabledArray != NULL) {
+    if (enabledArray != nullptr) {
         // custom set
         for (int32_t i = 0; i < fCSRecognizers_size; i++) {
             if (enabledArray[i]) {
@@ -379,7 +379,7 @@ enumCount(UEnumeration *en, UErrorCode *) {
 
 static const char* U_CALLCONV
 enumNext(UEnumeration *en, int32_t *resultLength, UErrorCode * /*status*/) {
-    const char *currName = NULL;
+    const char *currName = nullptr;
 
     if (((Context *)en->context)->currIndex < fCSRecognizers_size) {
         if (((Context *)en->context)->all) {
@@ -389,9 +389,9 @@ enumNext(UEnumeration *en, int32_t *resultLength, UErrorCode * /*status*/) {
         } else {
             // ucsdet_getDetectableCharsets
             UBool *enabledArray = ((Context *)en->context)->enabledRecognizers;
-            if (enabledArray != NULL) {
+            if (enabledArray != nullptr) {
                 // custom set
-                while (currName == NULL && ((Context *)en->context)->currIndex < fCSRecognizers_size) {
+                while (currName == nullptr && ((Context *)en->context)->currIndex < fCSRecognizers_size) {
                     if (enabledArray[((Context *)en->context)->currIndex]) {
                         currName = fCSRecognizers[((Context *)en->context)->currIndex]->recognizer->getName();
                     }
@@ -399,7 +399,7 @@ enumNext(UEnumeration *en, int32_t *resultLength, UErrorCode * /*status*/) {
                 }
             } else {
                 // default set
-                while (currName == NULL && ((Context *)en->context)->currIndex < fCSRecognizers_size) {
+                while (currName == nullptr && ((Context *)en->context)->currIndex < fCSRecognizers_size) {
                     if (fCSRecognizers[((Context *)en->context)->currIndex]->isDefaultEnabled) {
                         currName = fCSRecognizers[((Context *)en->context)->currIndex]->recognizer->getName();
                     }
@@ -409,8 +409,8 @@ enumNext(UEnumeration *en, int32_t *resultLength, UErrorCode * /*status*/) {
         }
     }
 
-    if(resultLength != NULL) {
-        *resultLength = currName == NULL ? 0 : (int32_t)uprv_strlen(currName);
+    if(resultLength != nullptr) {
+        *resultLength = currName == nullptr ? 0 : (int32_t)uprv_strlen(currName);
     }
 
     return currName;
@@ -423,8 +423,8 @@ enumReset(UEnumeration *en, UErrorCode *) {
 }
 
 static const UEnumeration gCSDetEnumeration = {
-    NULL,
-    NULL,
+    nullptr,
+    nullptr,
     enumClose,
     enumCount,
     uenum_unextDefault,
@@ -447,13 +447,13 @@ UEnumeration * CharsetDetector::getAllDetectableCharsets(UErrorCode &status)
     }
 
     UEnumeration *en = NEW_ARRAY(UEnumeration, 1);
-    if (en == NULL) {
+    if (en == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return 0;
     }
     memcpy(en, &gCSDetEnumeration, sizeof(UEnumeration));
     en->context = (void*)NEW_ARRAY(Context, 1);
-    if (en->context == NULL) {
+    if (en->context == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         DELETE_ARRAY(en);
         return 0;
@@ -470,13 +470,13 @@ UEnumeration * CharsetDetector::getDetectableCharsets(UErrorCode &status) const
     }
 
     UEnumeration *en = NEW_ARRAY(UEnumeration, 1);
-    if (en == NULL) {
+    if (en == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return 0;
     }
     memcpy(en, &gCSDetEnumeration, sizeof(UEnumeration));
     en->context = (void*)NEW_ARRAY(Context, 1);
-    if (en->context == NULL) {
+    if (en->context == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         DELETE_ARRAY(en);
         return 0;
index 83bf5316656d6bce1bc53a19203508b6a659cc21..81879c5269a098d0fcf8e12d2cb72d788fb0f8ff 100644 (file)
@@ -21,7 +21,7 @@
 U_NAMESPACE_BEGIN
 
 CharsetMatch::CharsetMatch()
-  : textIn(NULL), confidence(0), fCharsetName(NULL), fLang(NULL)
+  : textIn(nullptr), confidence(0), fCharsetName(nullptr), fLang(nullptr)
 {
     // nothing else to do.
 }
@@ -33,11 +33,11 @@ void CharsetMatch::set(InputText *input, const CharsetRecognizer *cr, int32_t co
     confidence = conf; 
     fCharsetName = csName;
     fLang = lang;
-    if (cr != NULL) {
-        if (fCharsetName == NULL) {
+    if (cr != nullptr) {
+        if (fCharsetName == nullptr) {
             fCharsetName = cr->getName();
         }
-        if (fLang == NULL) {
+        if (fLang == nullptr) {
             fLang = cr->getLanguage();
         }
     }
index fe379ceea7e2034585969e9c8c2004424172d57f..f475d39f0696a6ef052f6f1a9e56c1fc1db45b76 100644 (file)
@@ -44,14 +44,14 @@ class CharsetMatch : public UMemory
     /**
       * fully set the state of this CharsetMatch.
       * Called by the CharsetRecognizers to record match results.
-      * Default (NULL) parameters for names will be filled by calling the
+      * Default (nullptr) parameters for names will be filled by calling the
       *   corresponding getters on the recognizer.
       */
     void set(InputText               *input, 
              const CharsetRecognizer *cr, 
              int32_t                  conf, 
-             const char              *csName=NULL, 
-             const char              *lang=NULL);
+             const char              *csName=nullptr,
+             const char              *lang=nullptr);
 
     /**
       * Return the name of the charset for this Match
index 0ad0492ee7afbca9a16cda4209b1556440a795a7..b7dfc09c545e29ac4b125c9b0ada221280fc27a7 100644 (file)
@@ -50,7 +50,7 @@ void CurrencyFormat::parseObject(const UnicodeString& source,
                                  ParsePosition& pos) const
 {
     CurrencyAmount* currAmt = getCurrencyFormatInternal().parseCurrency(source, pos);
-    if (currAmt != NULL) {
+    if (currAmt != nullptr) {
         result.adoptObject(currAmt);
     }
 }
index dad7bb97e2c8b0ed932cf9679058c48632e2270d..1aac6edb9011d0c20cb8ab47f9ac9495c3c53168 100644 (file)
@@ -23,7 +23,7 @@
 #include "unicode/tzrule.h"
 
 // --- The cache --
-static icu::TimeZone *gDangiCalendarZoneAstroCalc = NULL;
+static icu::TimeZone *gDangiCalendarZoneAstroCalc = nullptr;
 static icu::UInitOnce gDangiCalendarInitOnce {};
 
 /**
@@ -36,7 +36,7 @@ U_CDECL_BEGIN
 static UBool calendar_dangi_cleanup(void) {
     if (gDangiCalendarZoneAstroCalc) {
         delete gDangiCalendarZoneAstroCalc;
-        gDangiCalendarZoneAstroCalc = NULL;
+        gDangiCalendarZoneAstroCalc = nullptr;
     }
     gDangiCalendarInitOnce.reset();
     return true;
index 2638cbf14dec12535dd7107c22fd3f266eafaace..0062b2f2931120b1f982e2a732d623bab81fef42 100644 (file)
@@ -62,7 +62,7 @@ template<>
 const DateFmtBestPattern *LocaleCacheKey<DateFmtBestPattern>::createObject(
         const void * /*creationContext*/, UErrorCode &status) const {
     status = U_UNSUPPORTED_ERROR;
-    return NULL;
+    return nullptr;
 }
 
 class DateFmtBestPatternKey : public LocaleCacheKey<DateFmtBestPattern> { 
@@ -101,7 +101,7 @@ public:
         LocalPointer<DateTimePatternGenerator> dtpg(
                     DateTimePatternGenerator::createInstance(fLoc, status));
         if (U_FAILURE(status)) {
-            return NULL;
+            return nullptr;
         }
   
         LocalPointer<DateFmtBestPattern> pattern(
@@ -109,7 +109,7 @@ public:
                         dtpg->getBestPattern(fSkeleton, status)),
                 status);
         if (U_FAILURE(status)) {
-            return NULL;
+            return nullptr;
         }
         DateFmtBestPattern *result = pattern.orphan();
         result->addRef();
@@ -149,12 +149,12 @@ DateFormat& DateFormat::operator=(const DateFormat& other)
         if(other.fCalendar) {
           fCalendar = other.fCalendar->clone();
         } else {
-          fCalendar = NULL;
+          fCalendar = nullptr;
         }
         if(other.fNumberFormat) {
           fNumberFormat = other.fNumberFormat->clone();
         } else {
-          fNumberFormat = NULL;
+          fNumberFormat = nullptr;
         }
         fBoolFlags = other.fBoolFlags;
         fCapitalizationContext = other.fCapitalizationContext;
@@ -277,10 +277,10 @@ DateFormat::format(Calendar& /* unused cal */,
 
 UnicodeString&
 DateFormat::format(UDate date, UnicodeString& appendTo, FieldPosition& fieldPosition) const {
-    if (fCalendar != NULL) {
+    if (fCalendar != nullptr) {
         // Use a clone of our calendar instance
         Calendar* calClone = fCalendar->clone();
-        if (calClone != NULL) {
+        if (calClone != nullptr) {
             UErrorCode ec = U_ZERO_ERROR;
             calClone->setTime(date, ec);
             if (U_SUCCESS(ec)) {
@@ -297,9 +297,9 @@ DateFormat::format(UDate date, UnicodeString& appendTo, FieldPosition& fieldPosi
 UnicodeString&
 DateFormat::format(UDate date, UnicodeString& appendTo, FieldPositionIterator* posIter,
                    UErrorCode& status) const {
-    if (fCalendar != NULL) {
+    if (fCalendar != nullptr) {
         Calendar* calClone = fCalendar->clone();
-        if (calClone != NULL) {
+        if (calClone != nullptr) {
             calClone->setTime(date, status);
             if (U_SUCCESS(status)) {
                format(*calClone, appendTo, posIter, status);
@@ -328,9 +328,9 @@ DateFormat::parse(const UnicodeString& text,
                   ParsePosition& pos) const
 {
     UDate d = 0; // Error return UDate is 0 (the epoch)
-    if (fCalendar != NULL) {
+    if (fCalendar != nullptr) {
         Calendar* calClone = fCalendar->clone();
-        if (calClone != NULL) {
+        if (calClone != nullptr) {
             int32_t start = pos.getIndex();
             calClone->clear();
             parse(text, *calClone, pos);
@@ -434,7 +434,7 @@ DateFormat::getBestPattern(
         return UnicodeString();
     }
     DateFmtBestPatternKey key(locale, skeleton, status);
-    const DateFmtBestPattern *patternPtr = NULL;
+    const DateFmtBestPattern *patternPtr = nullptr;
     cache->get(key, patternPtr, status);
     if (U_FAILURE(status)) {
         return UnicodeString();
@@ -452,20 +452,20 @@ DateFormat::createInstanceForSkeleton(
         UErrorCode &status) {
     LocalPointer<Calendar> calendar(calendarToAdopt);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     if (calendar.isNull()) {
         status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     Locale localeWithCalendar = locale;
     localeWithCalendar.setKeywordValue("calendar", calendar->getType(), status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     DateFormat *result = createInstanceForSkeleton(skeleton, localeWithCalendar, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     result->adoptCalendar(calendar.orphan());
     return result;
@@ -477,14 +477,14 @@ DateFormat::createInstanceForSkeleton(
         const Locale &locale,
         UErrorCode &status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     LocalPointer<DateFormat> df(
         new SimpleDateFormat(
             getBestPattern(locale, skeleton, status),
             locale, status),
         status);
-    return U_SUCCESS(status) ? df.orphan() : NULL;
+    return U_SUCCESS(status) ? df.orphan() : nullptr;
 }
 
 DateFormat* U_EXPORT2
@@ -568,7 +568,7 @@ void
 DateFormat::setCalendar(const Calendar& newCalendar)
 {
     Calendar* newCalClone = newCalendar.clone();
-    if (newCalClone != NULL) {
+    if (newCalClone != nullptr) {
         adoptCalendar(newCalClone);
     }
 }
@@ -597,7 +597,7 @@ void
 DateFormat::setNumberFormat(const NumberFormat& newNumberFormat)
 {
     NumberFormat* newNumFmtClone = newNumberFormat.clone();
-    if (newNumFmtClone != NULL) {
+    if (newNumFmtClone != nullptr) {
         adoptNumberFormat(newNumFmtClone);
     }
 }
@@ -615,7 +615,7 @@ DateFormat::getNumberFormat() const
 void
 DateFormat::adoptTimeZone(TimeZone* zone)
 {
-    if (fCalendar != NULL) {
+    if (fCalendar != nullptr) {
         fCalendar->adoptTimeZone(zone);
     }
 }
@@ -624,7 +624,7 @@ DateFormat::adoptTimeZone(TimeZone* zone)
 void
 DateFormat::setTimeZone(const TimeZone& zone)
 {
-    if (fCalendar != NULL) {
+    if (fCalendar != nullptr) {
         fCalendar->setTimeZone(zone);
     }
 }
@@ -634,7 +634,7 @@ DateFormat::setTimeZone(const TimeZone& zone)
 const TimeZone&
 DateFormat::getTimeZone() const
 {
-    if (fCalendar != NULL) {
+    if (fCalendar != nullptr) {
         return fCalendar->getTimeZone();
     }
     // If calendar doesn't exists, create default timezone.
@@ -647,7 +647,7 @@ DateFormat::getTimeZone() const
 void
 DateFormat::setLenient(UBool lenient)
 {
-    if (fCalendar != NULL) {
+    if (fCalendar != nullptr) {
         fCalendar->setLenient(lenient);
     }
     UErrorCode status = U_ZERO_ERROR;
@@ -661,7 +661,7 @@ UBool
 DateFormat::isLenient() const
 {
     UBool lenient = true;
-    if (fCalendar != NULL) {
+    if (fCalendar != nullptr) {
         lenient = fCalendar->isLenient();
     }
     UErrorCode status = U_ZERO_ERROR;
@@ -673,7 +673,7 @@ DateFormat::isLenient() const
 void
 DateFormat::setCalendarLenient(UBool lenient)
 {
-    if (fCalendar != NULL) {
+    if (fCalendar != nullptr) {
         fCalendar->setLenient(lenient);
     }
 }
@@ -683,7 +683,7 @@ DateFormat::setCalendarLenient(UBool lenient)
 UBool
 DateFormat::isCalendarLenient() const
 {
-    if (fCalendar != NULL) {
+    if (fCalendar != nullptr) {
         return fCalendar->isLenient();
     }
     // fCalendar is rarely null
index 3ef822842de46b81fc1511a4f2c28e890155612a..3d9ab5bfac54f1862603cdb67d804f4626f25eb5 100644 (file)
@@ -27,12 +27,12 @@ U_NAMESPACE_BEGIN
 namespace {
 
 struct DayPeriodRulesData : public UMemory {
-    DayPeriodRulesData() : localeToRuleSetNumMap(NULL), rules(NULL), maxRuleSetNum(0) {}
+    DayPeriodRulesData() : localeToRuleSetNumMap(nullptr), rules(nullptr), maxRuleSetNum(0) {}
 
     UHashtable *localeToRuleSetNumMap;
     DayPeriodRules *rules;
     int32_t maxRuleSetNum;
-} *data = NULL;
+} *data = nullptr;
 
 enum CutoffType {
     CUTOFF_TYPE_UNKNOWN = -1,
@@ -67,7 +67,7 @@ struct DayPeriodRulesDataSink : public ResourceSink {
             } else if (uprv_strcmp(key, "rules") == 0) {
                 // Allocate one more than needed to skip [0]. See comment in parseSetNum().
                 data->rules = new DayPeriodRules[data->maxRuleSetNum + 1];
-                if (data->rules == NULL) {
+                if (data->rules == nullptr) {
                     errorCode = U_MEMORY_ALLOCATION_ERROR;
                     return;
                 }
@@ -307,7 +307,7 @@ U_CFUNC UBool U_CALLCONV dayPeriodRulesCleanup() {
     delete[] data->rules;
     uhash_close(data->localeToRuleSetNumMap);
     delete data;
-    data = NULL;
+    data = nullptr;
     return true;
 }
 
@@ -319,8 +319,8 @@ void U_CALLCONV DayPeriodRules::load(UErrorCode &errorCode) {
     }
 
     data = new DayPeriodRulesData();
-    data->localeToRuleSetNumMap = uhash_open(uhash_hashChars, uhash_compareChars, NULL, &errorCode);
-    LocalUResourceBundlePointer rb_dayPeriods(ures_openDirect(NULL, "dayPeriods", &errorCode));
+    data->localeToRuleSetNumMap = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &errorCode);
+    LocalUResourceBundlePointer rb_dayPeriods(ures_openDirect(nullptr, "dayPeriods", &errorCode));
 
     // Get the largest rule set number (so we allocate enough objects).
     DayPeriodRulesCountSink countSink;
@@ -337,8 +337,8 @@ const DayPeriodRules *DayPeriodRules::getInstance(const Locale &locale, UErrorCo
     umtx_initOnce(initOnce, DayPeriodRules::load, errorCode);
 
     // If the entire day period rules data doesn't conform to spec (even if the part we want
-    // does), return NULL.
-    if(U_FAILURE(errorCode)) { return NULL; }
+    // does), return nullptr.
+    if(U_FAILURE(errorCode)) { return nullptr; }
 
     const char *localeCode = locale.getBaseName();
     char name[ULOC_FULLNAME_CAPACITY];
@@ -353,7 +353,7 @@ const DayPeriodRules *DayPeriodRules::getInstance(const Locale &locale, UErrorCo
         }
     } else {
         errorCode = U_BUFFER_OVERFLOW_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     int32_t ruleSetNum = 0;  // NB there is no rule set 0 and 0 is returned upon lookup failure.
@@ -375,7 +375,7 @@ const DayPeriodRules *DayPeriodRules::getInstance(const Locale &locale, UErrorCo
     if (ruleSetNum <= 0 || data->rules[ruleSetNum].getDayPeriodForHour(0) == DAYPERIOD_UNKNOWN) {
         // If day period for hour 0 is UNKNOWN then day period for all hours are UNKNOWN.
         // Data doesn't exist even with fallback.
-        return NULL;
+        return nullptr;
     } else {
         return &data->rules[ruleSetNum];
     }
index 3b2650c1e3762f4a47ddbdddae986da02ddb0150..87ab385d30dbc5624ed9c273ec4097188daf08aa 100644 (file)
@@ -66,31 +66,31 @@ static const UChar INTL_CURRENCY_SYMBOL_STR[] = {0xa4, 0xa4, 0};
 static const char *gNumberElementKeys[DecimalFormatSymbols::kFormatSymbolCount] = {
     "decimal",
     "group",
-    NULL, /* #11897: the <list> symbol is NOT the pattern separator symbol */
+    nullptr, /* #11897: the <list> symbol is NOT the pattern separator symbol */
     "percentSign",
-    NULL, /* Native zero digit is deprecated from CLDR - get it from the numbering system */
-    NULL, /* Pattern digit character is deprecated from CLDR - use # by default always */
+    nullptr, /* Native zero digit is deprecated from CLDR - get it from the numbering system */
+    nullptr, /* Pattern digit character is deprecated from CLDR - use # by default always */
     "minusSign",
     "plusSign",
-    NULL, /* currency symbol - Wait until we know the currency before loading from CLDR */
-    NULL, /* intl currency symbol - Wait until we know the currency before loading from CLDR */
+    nullptr, /* currency symbol - Wait until we know the currency before loading from CLDR */
+    nullptr, /* intl currency symbol - Wait until we know the currency before loading from CLDR */
     "currencyDecimal",
     "exponential",
     "perMille",
-    NULL, /* Escape padding character - not in CLDR */
+    nullptr, /* Escape padding character - not in CLDR */
     "infinity",
     "nan",
-    NULL, /* Significant digit symbol - not in CLDR */
+    nullptr, /* Significant digit symbol - not in CLDR */
     "currencyGroup",
-    NULL, /* one digit - get it from the numbering system */
-    NULL, /* two digit - get it from the numbering system */
-    NULL, /* three digit - get it from the numbering system */
-    NULL, /* four digit - get it from the numbering system */
-    NULL, /* five digit - get it from the numbering system */
-    NULL, /* six digit - get it from the numbering system */
-    NULL, /* seven digit - get it from the numbering system */
-    NULL, /* eight digit - get it from the numbering system */
-    NULL, /* nine digit - get it from the numbering system */
+    nullptr, /* one digit - get it from the numbering system */
+    nullptr, /* two digit - get it from the numbering system */
+    nullptr, /* three digit - get it from the numbering system */
+    nullptr, /* four digit - get it from the numbering system */
+    nullptr, /* five digit - get it from the numbering system */
+    nullptr, /* six digit - get it from the numbering system */
+    nullptr, /* seven digit - get it from the numbering system */
+    nullptr, /* eight digit - get it from the numbering system */
+    nullptr, /* nine digit - get it from the numbering system */
     "superscriptingExponent", /* Multiplication (x) symbol for exponents */
     "approximatelySign" /* Approximately sign symbol */
 };
@@ -124,9 +124,9 @@ DecimalFormatSymbols::DecimalFormatSymbols()
 
 DecimalFormatSymbols*
 DecimalFormatSymbols::createWithLastResortData(UErrorCode& status) {
-    if (U_FAILURE(status)) { return NULL; }
+    if (U_FAILURE(status)) { return nullptr; }
     DecimalFormatSymbols* sym = new DecimalFormatSymbols();
-    if (sym == NULL) {
+    if (sym == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
     }
     return sym;
@@ -238,7 +238,7 @@ struct DecFmtSymDataSink : public ResourceSink {
         if (U_FAILURE(errorCode)) { return; }
         for (int32_t j = 0; symbolsTable.getKeyAndValue(j, key, value); ++j) {
             for (int32_t i=0; i<DecimalFormatSymbols::kFormatSymbolCount; i++) {
-                if (gNumberElementKeys[i] != NULL && uprv_strcmp(key, gNumberElementKeys[i]) == 0) {
+                if (gNumberElementKeys[i] != nullptr && uprv_strcmp(key, gNumberElementKeys[i]) == 0) {
                     if (!seenSymbol[i]) {
                         seenSymbol[i] = true;
                         dfs.setSymbol(
@@ -388,9 +388,9 @@ DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status,
 
     // Open resource bundles
     const char* locStr = loc.getName();
-    LocalUResourceBundlePointer resource(ures_open(NULL, locStr, &status));
+    LocalUResourceBundlePointer resource(ures_open(nullptr, locStr, &status));
     LocalUResourceBundlePointer numberElementsRes(
-        ures_getByKeyWithFallback(resource.getAlias(), gNumberElements, NULL, &status));
+        ures_getByKeyWithFallback(resource.getAlias(), gNumberElements, nullptr, &status));
 
     if (U_FAILURE(status)) {
         if ( useLastResortData ) {
@@ -545,7 +545,7 @@ void DecimalFormatSymbols::setCurrency(const UChar* currency, UErrorCode& status
     UErrorCode localStatus = U_ZERO_ERROR;
     LocalUResourceBundlePointer rbTop(ures_open(U_ICUDATA_CURR, locale.getName(), &localStatus));
     LocalUResourceBundlePointer rb(
-        ures_getByKeyWithFallback(rbTop.getAlias(), "Currencies", NULL, &localStatus));
+        ures_getByKeyWithFallback(rbTop.getAlias(), "Currencies", nullptr, &localStatus));
     ures_getByKeyWithFallback(rb.getAlias(), cc, rb.getAlias(), &localStatus);
     if(U_SUCCESS(localStatus) && ures_getSize(rb.getAlias())>2) { // the length is 3 if more data is present
         ures_getByIndex(rb.getAlias(), 2, rb.getAlias(), &localStatus);
index 421d65b43f99d280e0c688683636ba566bc36d2d..bdc5f22fe5f7813282aa9c4443e8cdf31a894cb6 100644 (file)
@@ -219,7 +219,7 @@ U_CAPI decContext *  U_EXPORT2 uprv_decContextSetStatus(decContext *context, uIn
 /*  is raised if appropriate.                                         */
 /*                                                                    */
 /*  returns the context structure, unless the string is equal to      */
-/*    DEC_Condition_MU or is not recognized.  In these cases NULL is  */
+/*    DEC_Condition_MU or is not recognized.  In these cases nullptr is  */
 /*    returned.                                                       */
 /* ------------------------------------------------------------------ */
 U_CAPI decContext *  U_EXPORT2 uprv_decContextSetStatusFromString(decContext *context,
@@ -256,7 +256,7 @@ U_CAPI decContext *  U_EXPORT2 uprv_decContextSetStatusFromString(decContext *co
     return uprv_decContextSetStatus(context, DEC_Underflow);
   if (strcmp(string, DEC_Condition_ZE)==0)
     return context;
-  return NULL;  /* Multiple status, or unknown  */
+  return nullptr;  /* Multiple status, or unknown  */
   } /* decContextSetStatusFromString  */
 
 /* ------------------------------------------------------------------ */
@@ -270,7 +270,7 @@ U_CAPI decContext *  U_EXPORT2 uprv_decContextSetStatusFromString(decContext *co
 /*  raised.                                                           */
 /*                                                                    */
 /*  returns the context structure, unless the string is equal to      */
-/*    DEC_Condition_MU or is not recognized.  In these cases NULL is  */
+/*    DEC_Condition_MU or is not recognized.  In these cases nullptr is  */
 /*    returned.                                                       */
 /* ------------------------------------------------------------------ */
 U_CAPI decContext *  U_EXPORT2 uprv_decContextSetStatusFromStringQuiet(decContext *context,
@@ -307,7 +307,7 @@ U_CAPI decContext *  U_EXPORT2 uprv_decContextSetStatusFromStringQuiet(decContex
     return uprv_decContextSetStatusQuiet(context, DEC_Underflow);
   if (strcmp(string, DEC_Condition_ZE)==0)
     return context;
-  return NULL;  /* Multiple status, or unknown  */
+  return nullptr;  /* Multiple status, or unknown  */
   } /* decContextSetStatusFromStringQuiet  */
 
 /* ------------------------------------------------------------------ */
index 71477d8202cbeddea2c7a7e9ba2b5980db7c0809..2ad9f526e3f30010827951372be22f49eaf2f33d 100644 (file)
 /*    conversions are available in separate modules.                  */
 /*                                                                    */
 /* 7. Normally, input operands are assumed to be valid.  Set DECCHECK */
-/*    to 1 for extended operand checking (including NULL operands).   */
-/*    Results are undefined if a badly-formed structure (or a NULL    */
+/*    to 1 for extended operand checking (including nullptr operands).   */
+/*    Results are undefined if a badly-formed structure (or a nullptr    */
 /*    pointer to a structure) is provided, though with DECCHECK       */
 /*    enabled the operator routines are protected against exceptions. */
-/*    (Except if the result pointer is NULL, which is unrecoverable.) */
+/*    (Except if the result pointer is nullptr, which is unrecoverable.) */
 /*                                                                    */
 /*    However, the routines will never cause exceptions if they are   */
 /*    given well-formed operands, even if the value of the operands   */
@@ -516,11 +516,11 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char
   Unit  *res;                      /* where result will be built  */
   Unit  resbuff[SD2U(DECBUFFER+9)];/* local buffer in case need temporary  */
                                    /* [+9 allows for ln() constants]  */
-  Unit  *allocres=NULL;            /* -> allocated result, iff allocated  */
+  Unit  *allocres=nullptr;            /* -> allocated result, iff allocated  */
   Int   d=0;                       /* count of digits found in decimal part  */
-  const char *dotchar=NULL;        /* where dot was found  */
+  const char *dotchar=nullptr;        /* where dot was found  */
   const char *cfirst=chars;        /* -> first character of decimal part  */
-  const char *last=NULL;           /* -> last digit of decimal part  */
+  const char *last=nullptr;           /* -> last digit of decimal part  */
   const char *c;                   /* work  */
   Unit  *up;                       /* ..  */
   #if DECDPUN>1
@@ -541,7 +541,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char
         d++;                       /* count of real digits  */
         continue;                  /* still in decimal part  */
         }
-      if (*c=='.' && dotchar==NULL) { /* first '.'  */
+      if (*c=='.' && dotchar==nullptr) { /* first '.'  */
         dotchar=c;                 /* record offset into decimal part  */
         if (c==cfirst) cfirst++;   /* first digit must follow  */
         continue;}
@@ -558,7 +558,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char
       break;
       } /* c  */
 
-    if (last==NULL) {              /* no digits yet  */
+    if (last==nullptr) {              /* no digits yet  */
       status=DEC_Conversion_syntax;/* assume the worst  */
       if (*c=='\0') break;         /* and no more to come...  */
       #if DECSUBSET
@@ -566,7 +566,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char
       if (!set->extended) break;   /* hopeless  */
       #endif
       /* Infinities and NaNs are possible, here  */
-      if (dotchar!=NULL) break;    /* .. unless had a dot  */
+      if (dotchar!=nullptr) break;    /* .. unless had a dot  */
       uprv_decNumberZero(dn);           /* be optimistic  */
       if (decBiStr(c, "infinity", "INFINITY")
        || decBiStr(c, "inf", "INF")) {
@@ -609,7 +609,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char
       /* good; drop through to convert the integer to coefficient  */
       status=0;                    /* syntax is OK  */
       bits=dn->bits;               /* for copy-back  */
-      } /* last==NULL  */
+      } /* last==nullptr  */
 
      else if (*c!='\0') {          /* more to process...  */
       /* had some digits; exponent is only valid sequence now  */
@@ -667,7 +667,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char
       } /* at least one leading 0  */
 
     /* Handle decimal point...  */
-    if (dotchar!=NULL && dotchar<last)  /* non-trailing '.' found?  */
+    if (dotchar!=nullptr && dotchar<last)  /* non-trailing '.' found?  */
       exponent -= static_cast<int32_t>(last-dotchar);         /* adjust exponent  */
     /* [we can now ignore the .]  */
 
@@ -679,7 +679,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char
       res=resbuff;                      /* assume use local buffer  */
       if (needbytes>(Int)sizeof(resbuff)) { /* too big for local  */
         allocres=(Unit *)malloc(needbytes);
-        if (allocres==NULL) {status|=DEC_Insufficient_storage; break;}
+        if (allocres==nullptr) {status|=DEC_Insufficient_storage; break;}
         res=allocres;
         }
       }
@@ -736,7 +736,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char
     /* decNumberShow(dn);  */
     } while(0);                         /* [for break]  */
 
-  if (allocres!=NULL) free(allocres);   /* drop any storage used  */
+  if (allocres!=nullptr) free(allocres);   /* drop any storage used  */
   if (status!=0) decStatus(dn, status, set);
   return dn;
   } /* decNumberFromString */
@@ -953,9 +953,9 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareTotalMag(decNumber *res, const
   uInt status=0;                   /* accumulator  */
   uInt needbytes;                  /* for space calculations  */
   decNumber bufa[D2N(DECBUFFER+1)];/* +1 in case DECBUFFER=0  */
-  decNumber *allocbufa=NULL;       /* -> allocated bufa, iff allocated  */
+  decNumber *allocbufa=nullptr;       /* -> allocated bufa, iff allocated  */
   decNumber bufb[D2N(DECBUFFER+1)];
-  decNumber *allocbufb=NULL;       /* -> allocated bufb, iff allocated  */
+  decNumber *allocbufb=nullptr;       /* -> allocated bufb, iff allocated  */
   decNumber *a, *b;                /* temporary pointers  */
 
   #if DECCHECK
@@ -969,7 +969,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareTotalMag(decNumber *res, const
       needbytes=sizeof(decNumber)+(D2U(lhs->digits)-1)*sizeof(Unit);
       if (needbytes>sizeof(bufa)) {     /* need malloc space  */
         allocbufa=(decNumber *)malloc(needbytes);
-        if (allocbufa==NULL) {          /* hopeless -- abandon  */
+        if (allocbufa==nullptr) {          /* hopeless -- abandon  */
           status|=DEC_Insufficient_storage;
           break;}
         a=allocbufa;                    /* use the allocated space  */
@@ -983,7 +983,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareTotalMag(decNumber *res, const
       needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit);
       if (needbytes>sizeof(bufb)) {     /* need malloc space  */
         allocbufb=(decNumber *)malloc(needbytes);
-        if (allocbufb==NULL) {          /* hopeless -- abandon  */
+        if (allocbufb==nullptr) {          /* hopeless -- abandon  */
           status|=DEC_Insufficient_storage;
           break;}
         b=allocbufb;                    /* use the allocated space  */
@@ -995,8 +995,8 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberCompareTotalMag(decNumber *res, const
     decCompareOp(res, lhs, rhs, set, COMPTOTAL, &status);
     } while(0);                         /* end protected  */
 
-  if (allocbufa!=NULL) free(allocbufa); /* drop any storage used  */
-  if (allocbufb!=NULL) free(allocbufb); /* ..  */
+  if (allocbufa!=nullptr) free(allocbufa); /* drop any storage used  */
+  if (allocbufb!=nullptr) free(allocbufb); /* ..  */
   if (status!=0) decStatus(res, status, set);
   return res;
   } /* decNumberCompareTotalMag  */
@@ -1073,7 +1073,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberExp(decNumber *res, const decNumber *
                          decContext *set) {
   uInt status=0;                        /* accumulator  */
   #if DECSUBSET
-  decNumber *allocrhs=NULL;        /* non-NULL if rounded rhs allocated  */
+  decNumber *allocrhs=nullptr;        /* non-nullptr if rounded rhs allocated  */
   #endif
 
   #if DECCHECK
@@ -1090,7 +1090,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberExp(decNumber *res, const decNumber *
       /* reduce operand and set lostDigits status, as needed  */
       if (rhs->digits>set->digits) {
         allocrhs=decRoundOperand(rhs, set, &status);
-        if (allocrhs==NULL) break;
+        if (allocrhs==nullptr) break;
         rhs=allocrhs;
         }
       }
@@ -1099,7 +1099,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberExp(decNumber *res, const decNumber *
     } while(0);                         /* end protected  */
 
   #if DECSUBSET
-  if (allocrhs !=NULL) free(allocrhs);  /* drop any storage used  */
+  if (allocrhs !=nullptr) free(allocrhs);  /* drop any storage used  */
   #endif
   /* apply significant status  */
   if (status!=0) decStatus(res, status, set);
@@ -1132,7 +1132,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFMA(decNumber *res, const decNumber *
   decContext dcmul;                /* context for the multiplication  */
   uInt needbytes;                  /* for space calculations  */
   decNumber bufa[D2N(DECBUFFER*2+1)];
-  decNumber *allocbufa=NULL;       /* -> allocated bufa, iff allocated  */
+  decNumber *allocbufa=nullptr;       /* -> allocated bufa, iff allocated  */
   decNumber *acc;                  /* accumulator pointer  */
   decNumber dzero;                 /* work  */
 
@@ -1162,7 +1162,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFMA(decNumber *res, const decNumber *
     needbytes=sizeof(decNumber)+(D2U(dcmul.digits)-1)*sizeof(Unit);
     if (needbytes>sizeof(bufa)) {       /* need malloc space  */
       allocbufa=(decNumber *)malloc(needbytes);
-      if (allocbufa==NULL) {            /* hopeless -- abandon  */
+      if (allocbufa==nullptr) {            /* hopeless -- abandon  */
         status|=DEC_Insufficient_storage;
         break;}
       acc=allocbufa;                    /* use the allocated space  */
@@ -1194,7 +1194,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFMA(decNumber *res, const decNumber *
     decAddOp(res, acc, fhs, set, 0, &status);
     } while(0);                         /* end protected  */
 
-  if (allocbufa!=NULL) free(allocbufa); /* drop any storage used  */
+  if (allocbufa!=nullptr) free(allocbufa); /* drop any storage used  */
   if (status!=0) decStatus(res, status, set);
   #if DECCHECK
   decCheckInexact(res, set);
@@ -1293,7 +1293,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLn(decNumber *res, const decNumber *r
                         decContext *set) {
   uInt status=0;                   /* accumulator  */
   #if DECSUBSET
-  decNumber *allocrhs=NULL;        /* non-NULL if rounded rhs allocated  */
+  decNumber *allocrhs=nullptr;        /* non-nullptr if rounded rhs allocated  */
   #endif
 
   #if DECCHECK
@@ -1308,7 +1308,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLn(decNumber *res, const decNumber *r
       /* reduce operand and set lostDigits status, as needed  */
       if (rhs->digits>set->digits) {
         allocrhs=decRoundOperand(rhs, set, &status);
-        if (allocrhs==NULL) break;
+        if (allocrhs==nullptr) break;
         rhs=allocrhs;
         }
       /* special check in subset for rhs=0  */
@@ -1321,7 +1321,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLn(decNumber *res, const decNumber *r
     } while(0);                         /* end protected  */
 
   #if DECSUBSET
-  if (allocrhs !=NULL) free(allocrhs);  /* drop any storage used  */
+  if (allocrhs !=nullptr) free(allocrhs);  /* drop any storage used  */
   #endif
   /* apply significant status  */
   if (status!=0) decStatus(res, status, set);
@@ -1364,7 +1364,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLogB(decNumber *res, const decNumber
   #endif
 
   /* NaNs as usual; Infinities return +Infinity; 0->oops  */
-  if (decNumberIsNaN(rhs)) decNaNs(res, rhs, NULL, set, &status);
+  if (decNumberIsNaN(rhs)) decNaNs(res, rhs, nullptr, set, &status);
    else if (decNumberIsInfinite(rhs)) uprv_decNumberCopyAbs(res, rhs);
    else if (decNumberIsZero(rhs)) {
     uprv_decNumberZero(res);                 /* prepare for Infinity  */
@@ -1425,15 +1425,15 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber
   /* buffers for a and b working decimals  */
   /* (adjustment calculator, same size)  */
   decNumber bufa[D2N(DECBUFFER+2)];
-  decNumber *allocbufa=NULL;       /* -> allocated bufa, iff allocated  */
+  decNumber *allocbufa=nullptr;       /* -> allocated bufa, iff allocated  */
   decNumber *a=bufa;               /* temporary a  */
   decNumber bufb[D2N(DECBUFFER+2)];
-  decNumber *allocbufb=NULL;       /* -> allocated bufb, iff allocated  */
+  decNumber *allocbufb=nullptr;       /* -> allocated bufb, iff allocated  */
   decNumber *b=bufb;               /* temporary b  */
   decNumber bufw[D2N(10)];         /* working 2-10 digit number  */
   decNumber *w=bufw;               /* ..  */
   #if DECSUBSET
-  decNumber *allocrhs=NULL;        /* non-NULL if rounded rhs allocated  */
+  decNumber *allocrhs=nullptr;        /* non-nullptr if rounded rhs allocated  */
   #endif
 
   decContext aset;                 /* working context  */
@@ -1450,7 +1450,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber
       /* reduce operand and set lostDigits status, as needed  */
       if (rhs->digits>set->digits) {
         allocrhs=decRoundOperand(rhs, set, &status);
-        if (allocrhs==NULL) break;
+        if (allocrhs==nullptr) break;
         rhs=allocrhs;
         }
       /* special check in subset for rhs=0  */
@@ -1495,7 +1495,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber
     needbytes=sizeof(decNumber)+(D2U(p)-1)*sizeof(Unit);
     if (needbytes>sizeof(bufa)) {       /* need malloc space  */
       allocbufa=(decNumber *)malloc(needbytes);
-      if (allocbufa==NULL) {            /* hopeless -- abandon  */
+      if (allocbufa==nullptr) {            /* hopeless -- abandon  */
         status|=DEC_Insufficient_storage;
         break;}
       a=allocbufa;                      /* use the allocated space  */
@@ -1518,7 +1518,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber
     needbytes=sizeof(decNumber)+(D2U(p)-1)*sizeof(Unit);
     if (needbytes>sizeof(bufb)) {       /* need malloc space  */
       allocbufb=(decNumber *)malloc(needbytes);
-      if (allocbufb==NULL) {            /* hopeless -- abandon  */
+      if (allocbufb==nullptr) {            /* hopeless -- abandon  */
         status|=DEC_Insufficient_storage;
         break;}
       b=allocbufb;                      /* use the allocated space  */
@@ -1538,10 +1538,10 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberLog10(decNumber *res, const decNumber
     decDivideOp(res, a, b, &aset, DIVIDE, &status); /* into result  */
     } while(0);                         /* [for break]  */
 
-  if (allocbufa!=NULL) free(allocbufa); /* drop any storage used  */
-  if (allocbufb!=NULL) free(allocbufb); /* ..  */
+  if (allocbufa!=nullptr) free(allocbufa); /* drop any storage used  */
+  if (allocbufb!=nullptr) free(allocbufb); /* ..  */
   #if DECSUBSET
-  if (allocrhs !=NULL) free(allocrhs);  /* ..  */
+  if (allocrhs !=nullptr) free(allocrhs);  /* ..  */
   #endif
   /* apply significant status  */
   if (status!=0) decStatus(res, status, set);
@@ -1974,11 +1974,11 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberMultiply(decNumber *res, const decNum
 U_CAPI decNumber * U_EXPORT2 uprv_decNumberPower(decNumber *res, const decNumber *lhs,
                            const decNumber *rhs, decContext *set) {
   #if DECSUBSET
-  decNumber *alloclhs=NULL;        /* non-NULL if rounded lhs allocated  */
-  decNumber *allocrhs=NULL;        /* .., rhs  */
+  decNumber *alloclhs=nullptr;        /* non-nullptr if rounded lhs allocated  */
+  decNumber *allocrhs=nullptr;        /* .., rhs  */
   #endif
-  decNumber *allocdac=NULL;        /* -> allocated acc buffer, iff used  */
-  decNumber *allocinv=NULL;        /* -> allocated 1/x buffer, iff used  */
+  decNumber *allocdac=nullptr;        /* -> allocated acc buffer, iff used  */
+  decNumber *allocinv=nullptr;        /* -> allocated 1/x buffer, iff used  */
   Int   reqdigits=set->digits;     /* requested DIGITS  */
   Int   n;                         /* rhs in binary  */
   Flag  rhsint=0;                  /* 1 if rhs is an integer  */
@@ -2010,12 +2010,12 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberPower(decNumber *res, const decNumber
     if (!set->extended) { /* reduce operands and set status, as needed  */
       if (lhs->digits>reqdigits) {
         alloclhs=decRoundOperand(lhs, set, &status);
-        if (alloclhs==NULL) break;
+        if (alloclhs==nullptr) break;
         lhs=alloclhs;
         }
       if (rhs->digits>reqdigits) {
         allocrhs=decRoundOperand(rhs, set, &status);
-        if (allocrhs==NULL) break;
+        if (allocrhs==nullptr) break;
         rhs=allocrhs;
         }
       }
@@ -2166,7 +2166,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberPower(decNumber *res, const decNumber
     /* [needbytes also used below if 1/lhs needed]  */
     if (needbytes>sizeof(dacbuff)) {
       allocdac=(decNumber *)malloc(needbytes);
-      if (allocdac==NULL) {   /* hopeless -- abandon  */
+      if (allocdac==nullptr) {   /* hopeless -- abandon  */
         status|=DEC_Insufficient_storage;
         break;}
       dac=allocdac;           /* use the allocated space  */
@@ -2213,7 +2213,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberPower(decNumber *res, const decNumber
           /* now locate or allocate space for the inverted lhs  */
           if (needbytes>sizeof(invbuff)) {
             allocinv=(decNumber *)malloc(needbytes);
-            if (allocinv==NULL) {       /* hopeless -- abandon  */
+            if (allocinv==nullptr) {       /* hopeless -- abandon  */
               status|=DEC_Insufficient_storage;
               break;}
             inv=allocinv;               /* use the allocated space  */
@@ -2285,11 +2285,11 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberPower(decNumber *res, const decNumber
     #endif
     } while(0);                         /* end protected  */
 
-  if (allocdac!=NULL) free(allocdac);   /* drop any storage used  */
-  if (allocinv!=NULL) free(allocinv);   /* ..  */
+  if (allocdac!=nullptr) free(allocdac);   /* drop any storage used  */
+  if (allocinv!=nullptr) free(allocinv);   /* ..  */
   #if DECSUBSET
-  if (alloclhs!=NULL) free(alloclhs);   /* ..  */
-  if (allocrhs!=NULL) free(allocrhs);   /* ..  */
+  if (alloclhs!=nullptr) free(alloclhs);   /* ..  */
+  if (allocrhs!=nullptr) free(allocrhs);   /* ..  */
   #endif
   if (status!=0) decStatus(res, status, set);
   #if DECCHECK
@@ -2344,7 +2344,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberNormalize(decNumber *res, const decNu
 U_CAPI decNumber * U_EXPORT2 uprv_decNumberReduce(decNumber *res, const decNumber *rhs,
                             decContext *set) {
   #if DECSUBSET
-  decNumber *allocrhs=NULL;        /* non-NULL if rounded rhs allocated  */
+  decNumber *allocrhs=nullptr;        /* non-nullptr if rounded rhs allocated  */
   #endif
   uInt status=0;                   /* as usual  */
   Int  residue=0;                  /* as usual  */
@@ -2360,7 +2360,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberReduce(decNumber *res, const decNumbe
       /* reduce operand and set lostDigits status, as needed  */
       if (rhs->digits>set->digits) {
         allocrhs=decRoundOperand(rhs, set, &status);
-        if (allocrhs==NULL) break;
+        if (allocrhs==nullptr) break;
         rhs=allocrhs;
         }
       }
@@ -2369,7 +2369,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberReduce(decNumber *res, const decNumbe
 
     /* Infinities copy through; NaNs need usual treatment  */
     if (decNumberIsNaN(rhs)) {
-      decNaNs(res, rhs, NULL, set, &status);
+      decNaNs(res, rhs, nullptr, set, &status);
       break;
       }
 
@@ -2381,7 +2381,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberReduce(decNumber *res, const decNumbe
     } while(0);                              /* end protected  */
 
   #if DECSUBSET
-  if (allocrhs !=NULL) free(allocrhs);       /* ..  */
+  if (allocrhs !=nullptr) free(allocrhs);       /* ..  */
   #endif
   if (status!=0) decStatus(res, status, set);/* then report status  */
   return res;
@@ -2845,7 +2845,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN
   Int  dropped;                    /* ..  */
 
   #if DECSUBSET
-  decNumber *allocrhs=NULL;        /* non-NULL if rounded rhs allocated  */
+  decNumber *allocrhs=nullptr;        /* non-nullptr if rounded rhs allocated  */
   #endif
   /* buffer for f [needs +1 in case DECBUFFER 0]  */
   decNumber buff[D2N(DECBUFFER+1)];
@@ -2853,9 +2853,9 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN
   decNumber bufa[D2N(DECBUFFER+2)];
   /* buffer for temporary, b [must be same size as a]  */
   decNumber bufb[D2N(DECBUFFER+2)];
-  decNumber *allocbuff=NULL;       /* -> allocated buff, iff allocated  */
-  decNumber *allocbufa=NULL;       /* -> allocated bufa, iff allocated  */
-  decNumber *allocbufb=NULL;       /* -> allocated bufb, iff allocated  */
+  decNumber *allocbuff=nullptr;       /* -> allocated buff, iff allocated  */
+  decNumber *allocbufa=nullptr;       /* -> allocated bufa, iff allocated  */
+  decNumber *allocbufb=nullptr;       /* -> allocated bufb, iff allocated  */
   decNumber *f=buff;               /* reduced fraction  */
   decNumber *a=bufa;               /* approximation to result  */
   decNumber *b=bufb;               /* intermediate result  */
@@ -2873,7 +2873,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN
       /* reduce operand and set lostDigits status, as needed  */
       if (rhs->digits>set->digits) {
         allocrhs=decRoundOperand(rhs, set, &status);
-        if (allocrhs==NULL) break;
+        if (allocrhs==nullptr) break;
         /* [Note: 'f' allocation below could reuse this buffer if  */
         /* used, but as this is rare they are kept separate for clarity.]  */
         rhs=allocrhs;
@@ -2888,7 +2888,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN
         if (decNumberIsNegative(rhs)) status|=DEC_Invalid_operation;
          else uprv_decNumberCopy(res, rhs);        /* +Infinity  */
         }
-       else decNaNs(res, rhs, NULL, set, &status); /* a NaN  */
+       else decNaNs(res, rhs, nullptr, set, &status); /* a NaN  */
       break;
       }
 
@@ -2926,7 +2926,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN
     needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit);
     if (needbytes>(Int)sizeof(buff)) {
       allocbuff=(decNumber *)malloc(needbytes);
-      if (allocbuff==NULL) {  /* hopeless -- abandon  */
+      if (allocbuff==nullptr) {  /* hopeless -- abandon  */
         status|=DEC_Insufficient_storage;
         break;}
       f=allocbuff;            /* use the allocated space  */
@@ -2936,7 +2936,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN
     if (needbytes>(Int)sizeof(bufa)) {            /* [same applies to b]  */
       allocbufa=(decNumber *)malloc(needbytes);
       allocbufb=(decNumber *)malloc(needbytes);
-      if (allocbufa==NULL || allocbufb==NULL) {   /* hopeless  */
+      if (allocbufa==nullptr || allocbufb==nullptr) {   /* hopeless  */
         status|=DEC_Insufficient_storage;
         break;}
       a=allocbufa;            /* use the allocated spaces  */
@@ -3147,11 +3147,11 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberSquareRoot(decNumber *res, const decN
     uprv_decNumberCopy(res, a);                   /* a is now the result  */
     } while(0);                              /* end protected  */
 
-  if (allocbuff!=NULL) free(allocbuff);      /* drop any storage used  */
-  if (allocbufa!=NULL) free(allocbufa);      /* ..  */
-  if (allocbufb!=NULL) free(allocbufb);      /* ..  */
+  if (allocbuff!=nullptr) free(allocbuff);      /* drop any storage used  */
+  if (allocbufa!=nullptr) free(allocbufa);      /* ..  */
+  if (allocbufb!=nullptr) free(allocbufb);      /* ..  */
   #if DECSUBSET
-  if (allocrhs !=NULL) free(allocrhs);       /* ..  */
+  if (allocrhs !=nullptr) free(allocrhs);       /* ..  */
   #endif
   if (status!=0) decStatus(res, status, set);/* then report status  */
   #if DECCHECK
@@ -3221,7 +3221,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberToIntegralExact(decNumber *res, const
   /* handle infinities and NaNs  */
   if (SPECIALARG) {
     if (decNumberIsInfinite(rhs)) uprv_decNumberCopy(res, rhs); /* an Infinity  */
-     else decNaNs(res, rhs, NULL, set, &status); /* a NaN  */
+     else decNaNs(res, rhs, nullptr, set, &status); /* a NaN  */
     }
    else { /* finite  */
     /* have a finite number; no error possible (res must be big enough)  */
@@ -3385,7 +3385,7 @@ const char *uprv_decNumberClassToString(enum decClass eclass) {
 U_CAPI decNumber * U_EXPORT2 uprv_decNumberCopy(decNumber *dest, const decNumber *src) {
 
   #if DECCHECK
-  if (src==NULL) return uprv_decNumberZero(dest);
+  if (src==nullptr) return uprv_decNumberZero(dest);
   #endif
 
   if (dest==src) return dest;                /* no copy required  */
@@ -3837,8 +3837,8 @@ static decNumber * decAddOp(decNumber *res, const decNumber *lhs,
                             const decNumber *rhs, decContext *set,
                             uByte negate, uInt *status) {
   #if DECSUBSET
-  decNumber *alloclhs=NULL;        /* non-NULL if rounded lhs allocated  */
-  decNumber *allocrhs=NULL;        /* .., rhs  */
+  decNumber *alloclhs=nullptr;        /* non-nullptr if rounded lhs allocated  */
+  decNumber *allocrhs=nullptr;        /* .., rhs  */
   #endif
   Int   rhsshift;                  /* working shift (in Units)  */
   Int   maxdigits;                 /* longest logical length  */
@@ -3850,7 +3850,7 @@ static decNumber * decAddOp(decNumber *res, const decNumber *lhs,
   Unit  accbuff[SD2U(DECBUFFER*2+20)]; /* local buffer [*2+20 reduces many  */
                                    /* allocations when called from  */
                                    /* other operations, notable exp]  */
-  Unit  *allocacc=NULL;            /* -> allocated acc buffer, iff allocated  */
+  Unit  *allocacc=nullptr;            /* -> allocated acc buffer, iff allocated  */
   Int   reqdigits=set->digits;     /* local copy; requested DIGITS  */
   Int   padding;                   /* work  */
 
@@ -3864,12 +3864,12 @@ static decNumber * decAddOp(decNumber *res, const decNumber *lhs,
       /* reduce operands and set lostDigits status, as needed  */
       if (lhs->digits>reqdigits) {
         alloclhs=decRoundOperand(lhs, set, status);
-        if (alloclhs==NULL) break;
+        if (alloclhs==nullptr) break;
         lhs=alloclhs;
         }
       if (rhs->digits>reqdigits) {
         allocrhs=decRoundOperand(rhs, set, status);
-        if (allocrhs==NULL) break;
+        if (allocrhs==nullptr) break;
         rhs=allocrhs;
         }
       }
@@ -4075,7 +4075,7 @@ static decNumber * decAddOp(decNumber *res, const decNumber *lhs,
       if (need*sizeof(Unit)>sizeof(accbuff)) {
         /* printf("malloc add %ld %ld\n", need, sizeof(accbuff));  */
         allocacc=(Unit *)malloc(need*sizeof(Unit));
-        if (allocacc==NULL) {           /* hopeless -- abandon  */
+        if (allocacc==nullptr) {           /* hopeless -- abandon  */
           *status|=DEC_Insufficient_storage;
           break;}
         acc=allocacc;
@@ -4171,10 +4171,10 @@ static decNumber * decAddOp(decNumber *res, const decNumber *lhs,
       }
     } while(0);                              /* end protected  */
 
-  if (allocacc!=NULL) free(allocacc);        /* drop any storage used  */
+  if (allocacc!=nullptr) free(allocacc);        /* drop any storage used  */
   #if DECSUBSET
-  if (allocrhs!=NULL) free(allocrhs);        /* ..  */
-  if (alloclhs!=NULL) free(alloclhs);        /* ..  */
+  if (allocrhs!=nullptr) free(allocrhs);        /* ..  */
+  if (alloclhs!=nullptr) free(alloclhs);        /* ..  */
   #endif
   return res;
   } /* decAddOp  */
@@ -4253,12 +4253,12 @@ static decNumber * decDivideOp(decNumber *res,
                                const decNumber *lhs, const decNumber *rhs,
                                decContext *set, Flag op, uInt *status) {
   #if DECSUBSET
-  decNumber *alloclhs=NULL;        /* non-NULL if rounded lhs allocated  */
-  decNumber *allocrhs=NULL;        /* .., rhs  */
+  decNumber *alloclhs=nullptr;        /* non-nullptr if rounded lhs allocated  */
+  decNumber *allocrhs=nullptr;        /* .., rhs  */
   #endif
   Unit  accbuff[SD2U(DECBUFFER+DECDPUN+10)]; /* local buffer  */
   Unit  *acc=accbuff;              /* -> accumulator array for result  */
-  Unit  *allocacc=NULL;            /* -> allocated buffer, iff allocated  */
+  Unit  *allocacc=nullptr;            /* -> allocated buffer, iff allocated  */
   Unit  *accnext;                  /* -> where next digit will go  */
   Int   acclength;                 /* length of acc needed [Units]  */
   Int   accunits;                  /* count of units accumulated  */
@@ -4266,7 +4266,7 @@ static decNumber * decDivideOp(decNumber *res,
 
   Unit  varbuff[SD2U(DECBUFFER*2+DECDPUN)];  /* buffer for var1  */
   Unit  *var1=varbuff;             /* -> var1 array for long subtraction  */
-  Unit  *varalloc=NULL;            /* -> allocated buffer, iff used  */
+  Unit  *varalloc=nullptr;            /* -> allocated buffer, iff used  */
   Unit  *msu1;                     /* -> msu of var1  */
 
   const Unit *var2;                /* -> var2 array  */
@@ -4303,12 +4303,12 @@ static decNumber * decDivideOp(decNumber *res,
       /* reduce operands and set lostDigits status, as needed  */
       if (lhs->digits>reqdigits) {
         alloclhs=decRoundOperand(lhs, set, status);
-        if (alloclhs==NULL) break;
+        if (alloclhs==nullptr) break;
         lhs=alloclhs;
         }
       if (rhs->digits>reqdigits) {
         allocrhs=decRoundOperand(rhs, set, status);
-        if (allocrhs==NULL) break;
+        if (allocrhs==nullptr) break;
         rhs=allocrhs;
         }
       }
@@ -4440,7 +4440,7 @@ static decNumber * decDivideOp(decNumber *res,
     if (acclength*sizeof(Unit)>sizeof(accbuff)) {
       /* printf("malloc dvacc %ld units\n", acclength);  */
       allocacc=(Unit *)malloc(acclength*sizeof(Unit));
-      if (allocacc==NULL) {             /* hopeless -- abandon  */
+      if (allocacc==nullptr) {             /* hopeless -- abandon  */
         *status|=DEC_Insufficient_storage;
         break;}
       acc=allocacc;                     /* use the allocated space  */
@@ -4465,7 +4465,7 @@ static decNumber * decDivideOp(decNumber *res,
     if ((var1units+1)*sizeof(Unit)>sizeof(varbuff)) {
       /* printf("malloc dvvar %ld units\n", var1units+1);  */
       varalloc=(Unit *)malloc((var1units+1)*sizeof(Unit));
-      if (varalloc==NULL) {             /* hopeless -- abandon  */
+      if (varalloc==nullptr) {             /* hopeless -- abandon  */
         *status|=DEC_Insufficient_storage;
         break;}
       var1=varalloc;                    /* use the allocated space  */
@@ -4823,11 +4823,11 @@ static decNumber * decDivideOp(decNumber *res,
     #endif
     } while(0);                              /* end protected  */
 
-  if (varalloc!=NULL) free(varalloc);   /* drop any storage used  */
-  if (allocacc!=NULL) free(allocacc);   /* ..  */
+  if (varalloc!=nullptr) free(varalloc);   /* drop any storage used  */
+  if (allocacc!=nullptr) free(allocacc);   /* ..  */
   #if DECSUBSET
-  if (allocrhs!=NULL) free(allocrhs);   /* ..  */
-  if (alloclhs!=NULL) free(alloclhs);   /* ..  */
+  if (allocrhs!=nullptr) free(allocrhs);   /* ..  */
+  if (alloclhs!=nullptr) free(alloclhs);   /* ..  */
   #endif
   return res;
   } /* decDivideOp  */
@@ -4878,7 +4878,7 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs,
   uByte  bits;                     /* result sign  */
   Unit  *acc;                      /* -> accumulator Unit array  */
   Int    needbytes;                /* size calculator  */
-  void  *allocacc=NULL;            /* -> allocated accumulator, iff allocated  */
+  void  *allocacc=nullptr;            /* -> allocated accumulator, iff allocated  */
   Unit  accbuff[SD2U(DECBUFFER*4+1)]; /* buffer (+1 for DECBUFFER==0,  */
                                    /* *4 for calls from other operations)  */
   const Unit *mer, *mermsup;       /* work  */
@@ -4902,10 +4902,10 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs,
     /* lazy carry evaluation  */
     uInt   zlhibuff[(DECBUFFER*2+1)/8+1]; /* buffer (+1 for DECBUFFER==0)  */
     uInt  *zlhi=zlhibuff;                 /* -> lhs array  */
-    uInt  *alloclhi=NULL;                 /* -> allocated buffer, iff allocated  */
+    uInt  *alloclhi=nullptr;                 /* -> allocated buffer, iff allocated  */
     uInt   zrhibuff[(DECBUFFER*2+1)/8+1]; /* buffer (+1 for DECBUFFER==0)  */
     uInt  *zrhi=zrhibuff;                 /* -> rhs array  */
-    uInt  *allocrhi=NULL;                 /* -> allocated buffer, iff allocated  */
+    uInt  *allocrhi=nullptr;                 /* -> allocated buffer, iff allocated  */
     uLong  zaccbuff[(DECBUFFER*2+1)/4+2]; /* buffer (+1 for DECBUFFER==0)  */
     /* [allocacc is shared for both paths, as only one will run]  */
     uLong *zacc=zaccbuff;          /* -> accumulator array for exact result  */
@@ -4926,8 +4926,8 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs,
   #endif
 
   #if DECSUBSET
-    decNumber *alloclhs=NULL;      /* -> allocated buffer, iff allocated  */
-    decNumber *allocrhs=NULL;      /* -> allocated buffer, iff allocated  */
+    decNumber *alloclhs=nullptr;      /* -> allocated buffer, iff allocated  */
+    decNumber *allocrhs=nullptr;      /* -> allocated buffer, iff allocated  */
   #endif
 
   #if DECCHECK
@@ -4967,12 +4967,12 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs,
       /* reduce operands and set lostDigits status, as needed  */
       if (lhs->digits>set->digits) {
         alloclhs=decRoundOperand(lhs, set, status);
-        if (alloclhs==NULL) break;
+        if (alloclhs==nullptr) break;
         lhs=alloclhs;
         }
       if (rhs->digits>set->digits) {
         allocrhs=decRoundOperand(rhs, set, status);
-        if (allocrhs==NULL) break;
+        if (allocrhs==nullptr) break;
         rhs=allocrhs;
         }
       }
@@ -5018,7 +5018,7 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs,
       if (needbytes>(Int)sizeof(zaccbuff)) {
         allocacc=(uLong *)malloc(needbytes);
         zacc=(uLong *)allocacc;}
-      if (zlhi==NULL||zrhi==NULL||zacc==NULL) {
+      if (zlhi==nullptr||zrhi==nullptr||zacc==nullptr) {
         *status|=DEC_Insufficient_storage;
         break;}
 
@@ -5113,7 +5113,7 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs,
       needbytes=(D2U(lhs->digits)+D2U(rhs->digits))*sizeof(Unit);
       if (needbytes>(Int)sizeof(accbuff)) {
         allocacc=(Unit *)malloc(needbytes);
-        if (allocacc==NULL) {*status|=DEC_Insufficient_storage; break;}
+        if (allocacc==nullptr) {*status|=DEC_Insufficient_storage; break;}
         acc=(Unit *)allocacc;                /* use the allocated space  */
         }
 
@@ -5172,14 +5172,14 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs,
     decFinish(res, set, &residue, status);   /* final cleanup  */
     } while(0);                         /* end protected  */
 
-  if (allocacc!=NULL) free(allocacc);   /* drop any storage used  */
+  if (allocacc!=nullptr) free(allocacc);   /* drop any storage used  */
   #if DECSUBSET
-  if (allocrhs!=NULL) free(allocrhs);   /* ..  */
-  if (alloclhs!=NULL) free(alloclhs);   /* ..  */
+  if (allocrhs!=nullptr) free(allocrhs);   /* ..  */
+  if (alloclhs!=nullptr) free(alloclhs);   /* ..  */
   #endif
   #if FASTMUL
-  if (allocrhi!=NULL) free(allocrhi);   /* ..  */
-  if (alloclhi!=NULL) free(alloclhi);   /* ..  */
+  if (allocrhi!=nullptr) free(allocrhi);   /* ..  */
+  if (alloclhi!=nullptr) free(alloclhi);   /* ..  */
   #endif
   return res;
   } /* decMultiplyOp  */
@@ -5278,7 +5278,7 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs,
   /* is treated like other buffers, using DECBUFFER, +1 in case  */
   /* DECBUFFER is 0  */
   decNumber bufr[D2N(DECBUFFER*2+1)];
-  decNumber *allocrhs=NULL;        /* non-NULL if rhs buffer allocated  */
+  decNumber *allocrhs=nullptr;        /* non-nullptr if rhs buffer allocated  */
 
   /* the working precision will be no more than set->digits+8+1  */
   /* so for on-stack buffers DECBUFFER+9 is used, +1 in case DECBUFFER  */
@@ -5286,11 +5286,11 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs,
 
   /* buffer for t, term (working precision plus)  */
   decNumber buft[D2N(DECBUFFER*2+9+1)];
-  decNumber *allocbuft=NULL;       /* -> allocated buft, iff allocated  */
+  decNumber *allocbuft=nullptr;       /* -> allocated buft, iff allocated  */
   decNumber *t=buft;               /* term  */
   /* buffer for a, accumulator (working precision * 2), at least 9  */
   decNumber bufa[D2N(DECBUFFER*4+18+1)];
-  decNumber *allocbufa=NULL;       /* -> allocated bufa, iff allocated  */
+  decNumber *allocbufa=nullptr;       /* -> allocated bufa, iff allocated  */
   decNumber *a=bufa;               /* accumulator  */
   /* decNumber for the divisor term; this needs at most 9 digits  */
   /* and so can be fixed size [16 so can use standard context]  */
@@ -5310,7 +5310,7 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs,
           uprv_decNumberZero(res);
          else uprv_decNumberCopy(res, rhs);  /* +Infinity -> self  */
         }
-       else decNaNs(res, rhs, NULL, set, status); /* a NaN  */
+       else decNaNs(res, rhs, nullptr, set, status); /* a NaN  */
       break;}
 
     if (ISZERO(rhs)) {                  /* zeros -> exact 1  */
@@ -5400,7 +5400,7 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs,
         needbytes=sizeof(decNumber)+(D2U(rhs->digits)-1)*sizeof(Unit);
         if (needbytes>sizeof(bufr)) {   /* need malloc space  */
           allocrhs=(decNumber *)malloc(needbytes);
-          if (allocrhs==NULL) {         /* hopeless -- abandon  */
+          if (allocrhs==nullptr) {         /* hopeless -- abandon  */
             *status|=DEC_Insufficient_storage;
             break;}
           newrhs=allocrhs;              /* use the allocated space  */
@@ -5432,7 +5432,7 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs,
       needbytes=sizeof(decNumber)+(D2U(p*2)-1)*sizeof(Unit);
       if (needbytes>sizeof(bufa)) {     /* need malloc space  */
         allocbufa=(decNumber *)malloc(needbytes);
-        if (allocbufa==NULL) {          /* hopeless -- abandon  */
+        if (allocbufa==nullptr) {          /* hopeless -- abandon  */
           *status|=DEC_Insufficient_storage;
           break;}
         a=allocbufa;                    /* use the allocated space  */
@@ -5444,7 +5444,7 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs,
       needbytes=sizeof(decNumber)+(D2U(p+2)-1)*sizeof(Unit);
       if (needbytes>sizeof(buft)) {     /* need malloc space  */
         allocbuft=(decNumber *)malloc(needbytes);
-        if (allocbuft==NULL) {          /* hopeless -- abandon  */
+        if (allocbuft==nullptr) {          /* hopeless -- abandon  */
           *status|=DEC_Insufficient_storage;
           break;}
         t=allocbuft;                    /* use the allocated space  */
@@ -5528,9 +5528,9 @@ decNumber * decExpOp(decNumber *res, const decNumber *rhs,
     decFinish(res, set, &residue, status);       /* cleanup/set flags  */
     } while(0);                         /* end protected  */
 
-  if (allocrhs !=NULL) free(allocrhs);  /* drop any storage used  */
-  if (allocbufa!=NULL) free(allocbufa); /* ..  */
-  if (allocbuft!=NULL) free(allocbuft); /* ..  */
+  if (allocrhs !=nullptr) free(allocrhs);  /* drop any storage used  */
+  if (allocbufa!=nullptr) free(allocbufa); /* ..  */
+  if (allocbuft!=nullptr) free(allocbuft); /* ..  */
   /* [status is handled by caller]  */
   return res;
   } /* decExpOp  */
@@ -5640,10 +5640,10 @@ decNumber * decLnOp(decNumber *res, const decNumber *rhs,
   /* buffers for a (accumulator, typically precision+2) and b  */
   /* (adjustment calculator, same size)  */
   decNumber bufa[D2N(DECBUFFER+12)];
-  decNumber *allocbufa=NULL;       /* -> allocated bufa, iff allocated  */
+  decNumber *allocbufa=nullptr;       /* -> allocated bufa, iff allocated  */
   decNumber *a=bufa;               /* accumulator/work  */
   decNumber bufb[D2N(DECBUFFER*2+2)];
-  decNumber *allocbufb=NULL;       /* -> allocated bufa, iff allocated  */
+  decNumber *allocbufb=nullptr;       /* -> allocated bufa, iff allocated  */
   decNumber *b=bufb;               /* adjustment/work  */
 
   decNumber  numone;               /* constant 1  */
@@ -5662,7 +5662,7 @@ decNumber * decLnOp(decNumber *res, const decNumber *rhs,
           *status|=DEC_Invalid_operation;
          else uprv_decNumberCopy(res, rhs);  /* +Infinity -> self  */
         }
-       else decNaNs(res, rhs, NULL, set, status); /* a NaN  */
+       else decNaNs(res, rhs, nullptr, set, status); /* a NaN  */
       break;}
 
     if (ISZERO(rhs)) {                  /* +/- zeros -> -Infinity  */
@@ -5713,7 +5713,7 @@ decNumber * decLnOp(decNumber *res, const decNumber *rhs,
     needbytes=sizeof(decNumber)+(D2U(MAXI(p,16))-1)*sizeof(Unit);
     if (needbytes>sizeof(bufa)) {     /* need malloc space  */
       allocbufa=(decNumber *)malloc(needbytes);
-      if (allocbufa==NULL) {          /* hopeless -- abandon  */
+      if (allocbufa==nullptr) {          /* hopeless -- abandon  */
         *status|=DEC_Insufficient_storage;
         break;}
       a=allocbufa;                    /* use the allocated space  */
@@ -5722,7 +5722,7 @@ decNumber * decLnOp(decNumber *res, const decNumber *rhs,
     needbytes=sizeof(decNumber)+(D2U(MAXI(pp,16))-1)*sizeof(Unit);
     if (needbytes>sizeof(bufb)) {     /* need malloc space  */
       allocbufb=(decNumber *)malloc(needbytes);
-      if (allocbufb==NULL) {          /* hopeless -- abandon  */
+      if (allocbufb==nullptr) {          /* hopeless -- abandon  */
         *status|=DEC_Insufficient_storage;
         break;}
       b=allocbufb;                    /* use the allocated space  */
@@ -5843,8 +5843,8 @@ decNumber * decLnOp(decNumber *res, const decNumber *rhs,
     decFinish(res, set, &residue, status);       /* cleanup/set flags  */
     } while(0);                         /* end protected  */
 
-  if (allocbufa!=NULL) free(allocbufa); /* drop any storage used  */
-  if (allocbufb!=NULL) free(allocbufb); /* ..  */
+  if (allocbufa!=nullptr) free(allocbufa); /* drop any storage used  */
+  if (allocbufb!=nullptr) free(allocbufb); /* ..  */
   /* [status is handled by caller]  */
   return res;
   } /* decLnOp  */
@@ -5878,8 +5878,8 @@ static decNumber * decQuantizeOp(decNumber *res, const decNumber *lhs,
                                  const decNumber *rhs, decContext *set,
                                  Flag quant, uInt *status) {
   #if DECSUBSET
-  decNumber *alloclhs=NULL;        /* non-NULL if rounded lhs allocated  */
-  decNumber *allocrhs=NULL;        /* .., rhs  */
+  decNumber *alloclhs=nullptr;        /* non-nullptr if rounded lhs allocated  */
+  decNumber *allocrhs=nullptr;        /* .., rhs  */
   #endif
   const decNumber *inrhs=rhs;      /* save original rhs  */
   Int   reqdigits=set->digits;     /* requested DIGITS  */
@@ -5897,12 +5897,12 @@ static decNumber * decQuantizeOp(decNumber *res, const decNumber *lhs,
       /* reduce operands and set lostDigits status, as needed  */
       if (lhs->digits>reqdigits) {
         alloclhs=decRoundOperand(lhs, set, status);
-        if (alloclhs==NULL) break;
+        if (alloclhs==nullptr) break;
         lhs=alloclhs;
         }
       if (rhs->digits>reqdigits) { /* [this only checks lostDigits]  */
         allocrhs=decRoundOperand(rhs, set, status);
-        if (allocrhs==NULL) break;
+        if (allocrhs==nullptr) break;
         rhs=allocrhs;
         }
       }
@@ -6011,8 +6011,8 @@ static decNumber * decQuantizeOp(decNumber *res, const decNumber *lhs,
     } while(0);                         /* end protected  */
 
   #if DECSUBSET
-  if (allocrhs!=NULL) free(allocrhs);   /* drop any storage used  */
-  if (alloclhs!=NULL) free(alloclhs);   /* ..  */
+  if (allocrhs!=nullptr) free(allocrhs);   /* drop any storage used  */
+  if (alloclhs!=nullptr) free(alloclhs);   /* ..  */
   #endif
   return res;
   } /* decQuantizeOp  */
@@ -6051,8 +6051,8 @@ static decNumber * decCompareOp(decNumber *res, const decNumber *lhs,
                          const decNumber *rhs, decContext *set,
                          Flag op, uInt *status) {
   #if DECSUBSET
-  decNumber *alloclhs=NULL;        /* non-NULL if rounded lhs allocated  */
-  decNumber *allocrhs=NULL;        /* .., rhs  */
+  decNumber *alloclhs=nullptr;        /* non-nullptr if rounded lhs allocated  */
+  decNumber *allocrhs=nullptr;        /* .., rhs  */
   #endif
   Int   result=0;                  /* default result value  */
   uByte merged;                    /* work  */
@@ -6067,12 +6067,12 @@ static decNumber * decCompareOp(decNumber *res, const decNumber *lhs,
       /* reduce operands and set lostDigits status, as needed  */
       if (lhs->digits>set->digits) {
         alloclhs=decRoundOperand(lhs, set, status);
-        if (alloclhs==NULL) {result=BADINT; break;}
+        if (alloclhs==nullptr) {result=BADINT; break;}
         lhs=alloclhs;
         }
       if (rhs->digits>set->digits) {
         allocrhs=decRoundOperand(rhs, set, status);
-        if (allocrhs==NULL) {result=BADINT; break;}
+        if (allocrhs==nullptr) {result=BADINT; break;}
         rhs=allocrhs;
         }
       }
@@ -6194,8 +6194,8 @@ static decNumber * decCompareOp(decNumber *res, const decNumber *lhs,
       }
     }
   #if DECSUBSET
-  if (allocrhs!=NULL) free(allocrhs);   /* free any storage used  */
-  if (alloclhs!=NULL) free(alloclhs);   /* ..  */
+  if (allocrhs!=nullptr) free(allocrhs);   /* free any storage used  */
+  if (alloclhs!=nullptr) free(alloclhs);   /* ..  */
   #endif
   return res;
   } /* decCompareOp  */
@@ -6280,7 +6280,7 @@ static Int decUnitCompare(const Unit *a, Int alength,
                           const Unit *b, Int blength, Int exp) {
   Unit  *acc;                      /* accumulator for result  */
   Unit  accbuff[SD2U(DECBUFFER*2+1)]; /* local buffer  */
-  Unit  *allocacc=NULL;            /* -> allocated acc buffer, iff allocated  */
+  Unit  *allocacc=nullptr;            /* -> allocated acc buffer, iff allocated  */
   Int   accunits, need;            /* units in use or needed for acc  */
   const Unit *l, *r, *u;           /* work  */
   Int   expunits, exprem, result;  /* ..  */
@@ -6312,7 +6312,7 @@ static Int decUnitCompare(const Unit *a, Int alength,
   acc=accbuff;                          /* assume use local buffer  */
   if (need*sizeof(Unit)>sizeof(accbuff)) {
     allocacc=(Unit *)malloc(need*sizeof(Unit));
-    if (allocacc==NULL) return BADINT;  /* hopeless -- abandon  */
+    if (allocacc==nullptr) return BADINT;  /* hopeless -- abandon  */
     acc=allocacc;
     }
   /* Calculate units and remainder from exponent.  */
@@ -6329,7 +6329,7 @@ static Int decUnitCompare(const Unit *a, Int alength,
     result=(*u==0 ? 0 : +1);
     }
   /* clean up and return the result  */
-  if (allocacc!=NULL) free(allocacc);   /* drop any storage used  */
+  if (allocacc!=nullptr) free(allocacc);   /* drop any storage used  */
   return result;
   } /* decUnitCompare  */
 
@@ -6847,7 +6847,7 @@ static Int decShiftToLeast(Unit *uar, Int units, Int shift) {
 /* Instead, return an allocated decNumber, rounded as required.       */
 /* It is the caller's responsibility to free the allocated storage.   */
 /*                                                                    */
-/* If no storage is available then the result cannot be used, so NULL */
+/* If no storage is available then the result cannot be used, so nullptr */
 /* is returned.                                                       */
 /* ------------------------------------------------------------------ */
 static decNumber *decRoundOperand(const decNumber *dn, decContext *set,
@@ -6860,9 +6860,9 @@ static decNumber *decRoundOperand(const decNumber *dn, decContext *set,
   /* length specified by the context  */
   res=(decNumber *)malloc(sizeof(decNumber)
                           +(D2U(set->digits)-1)*sizeof(Unit));
-  if (res==NULL) {
+  if (res==nullptr) {
     *status|=DEC_Insufficient_storage;
-    return NULL;
+    return nullptr;
     }
   decCopyFit(res, dn, set, &residue, &newstatus);
   decApplyRound(res, set, residue, &newstatus);
@@ -7725,7 +7725,7 @@ static Flag decBiStr(const char *targ, const char *str1, const char *str2) {
 /*                                                                    */
 /*   res     is the result number                                     */
 /*   lhs     is the first operand                                     */
-/*   rhs     is the second operand, or NULL if none                   */
+/*   rhs     is the second operand, or nullptr if none                   */
 /*   context is used to limit payload length                          */
 /*   status  contains the current status                              */
 /*   returns res in case convenient                                   */
@@ -7741,7 +7741,7 @@ static decNumber * decNaNs(decNumber *res, const decNumber *lhs,
   /* and status updated if need be  */
   if (lhs->bits & DECSNAN)
     *status|=DEC_Invalid_operation | DEC_sNaN;
-   else if (rhs==NULL);
+   else if (rhs==nullptr);
    else if (rhs->bits & DECSNAN) {
     lhs=rhs;
     *status|=DEC_Invalid_operation | DEC_sNaN;
@@ -7862,8 +7862,8 @@ void uprv_decNumberShow(const decNumber *dn) {
   uInt u, d;                       /* ..  */
   Int cut;                         /* ..  */
   char isign='+';                  /* main sign  */
-  if (dn==NULL) {
-    printf("NULL\n");
+  if (dn==nullptr) {
+    printf("nullptr\n");
     return;}
   if (decNumberIsNegative(dn)) isign='-';
   printf(" >> %c ", isign);
@@ -7944,22 +7944,22 @@ static void decDumpAr(char name, const Unit *ar, Int len) {
 /* ------------------------------------------------------------------ */
 /* decCheckOperands -- check operand(s) to a routine                  */
 /*   res is the result structure (not checked; it will be set to      */
-/*          quiet NaN if error found (and it is not NULL))            */
+/*          quiet NaN if error found (and it is not nullptr))            */
 /*   lhs is the first operand (may be DECUNRESU)                      */
 /*   rhs is the second (may be DECUNUSED)                             */
 /*   set is the context (may be DECUNCONT)                            */
 /*   returns 0 if both operands, and the context are clean, or 1      */
 /*     otherwise (in which case the context will show an error,       */
-/*     unless NULL).  Note that res is not cleaned; caller should     */
-/*     handle this so res=NULL case is safe.                          */
+/*     unless nullptr).  Note that res is not cleaned; caller should     */
+/*     handle this so res=nullptr case is safe.                          */
 /* The caller is expected to abandon immediately if 1 is returned.    */
 /* ------------------------------------------------------------------ */
 static Flag decCheckOperands(decNumber *res, const decNumber *lhs,
                              const decNumber *rhs, decContext *set) {
   Flag bad=0;
-  if (set==NULL) {                 /* oops; hopeless  */
+  if (set==nullptr) {                 /* oops; hopeless  */
     #if DECTRACE || DECVERB
-    printf("Reference to context is NULL.\n");
+    printf("Reference to context is nullptr.\n");
     #endif
     bad=1;
     return 1;}
@@ -7972,11 +7972,11 @@ static Flag decCheckOperands(decNumber *res, const decNumber *lhs,
     #endif
     }
    else {
-    if (res==NULL) {
+    if (res==nullptr) {
       bad=1;
       #if DECTRACE
-      /* this one not DECVERB as standard tests include NULL  */
-      printf("Reference to result is NULL.\n");
+      /* this one not DECVERB as standard tests include nullptr  */
+      printf("Reference to result is nullptr.\n");
       #endif
       }
     if (!bad && lhs!=DECUNUSED) bad=(decCheckNumber(lhs));
@@ -7984,7 +7984,7 @@ static Flag decCheckOperands(decNumber *res, const decNumber *lhs,
     }
   if (bad) {
     if (set!=DECUNCONT) uprv_decContextSetStatus(set, DEC_Invalid_operation);
-    if (res!=DECUNRESU && res!=NULL) {
+    if (res!=DECUNRESU && res!=nullptr) {
       uprv_decNumberZero(res);
       res->bits=DECNAN;       /* qNaN  */
       }
@@ -8006,10 +8006,10 @@ static Flag decCheckNumber(const decNumber *dn) {
   Int ae, d, digits;          /* ..  */
   Int emin, emax;             /* ..  */
 
-  if (dn==NULL) {             /* hopeless  */
+  if (dn==nullptr) {             /* hopeless  */
     #if DECTRACE
-    /* this one not DECVERB as standard tests include NULL  */
-    printf("Reference to decNumber is NULL.\n");
+    /* this one not DECVERB as standard tests include nullptr  */
+    printf("Reference to decNumber is nullptr.\n");
     #endif
     return 1;}
 
@@ -8114,7 +8114,7 @@ static void decCheckInexact(const decNumber *dn, decContext *set) {
       }
   #else
     /* next is a noop for quiet compiler  */
-    if (dn!=NULL && dn->digits==0) set->status|=DEC_Invalid_operation;
+    if (dn!=nullptr && dn->digits==0) set->status|=DEC_Invalid_operation;
   #endif
   return;
   } /* decCheckInexact  */
@@ -8144,7 +8144,7 @@ static void *decMalloc(size_t n) {
   uInt  uiwork;                    /* for macros  */
 
   alloc=malloc(size);              /* -> allocated storage  */
-  if (alloc==NULL) return NULL;    /* out of strorage  */
+  if (alloc==nullptr) return nullptr;    /* out of strorage  */
   b0=(uByte *)alloc;               /* as bytes  */
   decAllocBytes+=n;                /* account for storage  */
   UBFROMUI(alloc, n);              /* save n  */
@@ -8171,7 +8171,7 @@ static void decFree(void *alloc) {
   uByte *b, *b0;                   /* work  */
   uInt  uiwork;                    /* for macros  */
 
-  if (alloc==NULL) return;         /* allowed; it's a nop  */
+  if (alloc==nullptr) return;         /* allowed; it's a nop  */
   b0=(uByte *)alloc;               /* as bytes  */
   b0-=8;                           /* -> true start of storage  */
   n=UBTOUI(b0);                    /* lift length  */
index bca33366792705096df0ce57a536279852cc1318..80fc248f13fe661d591be50c6c710142dc17cffd 100644 (file)
@@ -803,7 +803,7 @@ const DecimalFormatSymbols* DecimalFormat::getDecimalFormatSymbols(void) const {
 
 void DecimalFormat::adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt) {
     if (symbolsToAdopt == nullptr) {
-        return; // do not allow caller to set fields->symbols to NULL
+        return; // do not allow caller to set fields->symbols to nullptr
     }
     // we must take ownership of symbolsToAdopt, even in a failure case.
     LocalPointer<DecimalFormatSymbols> dfs(symbolsToAdopt);
index 1fae2e87715a45ab1fb14506659de8bf5e5134d2..9940052c64b25b7850d8675059c90ba98a99bf46 100644 (file)
@@ -114,7 +114,7 @@ class DoubleToStringConverter {
   //    preserved.
   //
   // Infinity symbol and nan_symbol provide the string representation for these
-  // special values. If the string is NULL and the special value is encountered
+  // special values. If the string is nullptr and the special value is encountered
   // then the conversion functions return false.
   //
   // The exponent_character is used in exponential representations. It is
@@ -429,7 +429,7 @@ class DoubleToStringConverter {
 
   // If the value is a special value (NaN or Infinity) constructs the
   // corresponding string using the configured infinity/nan-symbol.
-  // If either of them is NULL or the value is not special then the
+  // If either of them is nullptr or the value is not special then the
   // function returns false.
   bool HandleSpecialValues(double value, StringBuilder* result_builder) const;
   // Constructs an exponential representation (i.e. 1.234e56).
index 9f6f5307111ac5202a80f5e794cf2323524261c7..1d4e3dddde9ca62ba913f4ffc051c1d6210ac848 100644 (file)
@@ -158,8 +158,8 @@ class StringToDoubleConverter {
   //  flags = ALLOW_OCTAL | ALLOW_LEADING_SPACES,
   //  empty_string_value = 0.0,
   //  junk_string_value = NaN,
-  //  infinity_symbol = NULL,
-  //  nan_symbol = NULL:
+  //  infinity_symbol = nullptr,
+  //  nan_symbol = nullptr:
   //    StringToDouble("0x1234") -> NaN  // junk_string_value.
   //    StringToDouble("01234") -> 668.0.
   //    StringToDouble("") -> 0.0  // empty_string_value.
index ea3ab496700e58262f6d541fb34bd4edaf7f13b2..f79288530646a92cf05b27ab32596ecdf89c4f0b 100644 (file)
@@ -179,17 +179,17 @@ const SharedDateFormatSymbols *
     char type[256];
     Calendar::getCalendarTypeFromLocale(fLoc, type, UPRV_LENGTHOF(type), status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     SharedDateFormatSymbols *shared
             = new SharedDateFormatSymbols(fLoc, type, status);
-    if (shared == NULL) {
+    if (shared == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     if (U_FAILURE(status)) {
         delete shared;
-        return NULL;
+        return nullptr;
     }
     shared->addRef();
     return shared;
@@ -248,16 +248,16 @@ static inline UnicodeString* newUnicodeStringArray(size_t count) {
 DateFormatSymbols * U_EXPORT2
 DateFormatSymbols::createForLocale(
         const Locale& locale, UErrorCode &status) {
-    const SharedDateFormatSymbols *shared = NULL;
+    const SharedDateFormatSymbols *shared = nullptr;
     UnifiedCache::getByLocale(locale, shared, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     DateFormatSymbols *result = new DateFormatSymbols(shared->get());
     shared->removeRef();
-    if (result == NULL) {
+    if (result == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     return result;
 }
@@ -266,13 +266,13 @@ DateFormatSymbols::DateFormatSymbols(const Locale& locale,
                                      UErrorCode& status)
     : UObject()
 {
-  initializeData(locale, NULL,  status);
+  initializeData(locale, nullptr,  status);
 }
 
 DateFormatSymbols::DateFormatSymbols(UErrorCode& status)
     : UObject()
 {
-  initializeData(Locale::getDefault(), NULL, status, true);
+  initializeData(Locale::getDefault(), nullptr, status, true);
 }
 
 
@@ -316,7 +316,7 @@ DateFormatSymbols::assignArray(UnicodeString*& dstArray,
     // a subclass from creating these strings in an "unsafe" way (with respect to fastCopyFrom()).
     dstCount = srcCount;
     dstArray = newUnicodeStringArray(srcCount);
-    if(dstArray != NULL) {
+    if(dstArray != nullptr) {
         int32_t i;
         for(i=0; i<srcCount; ++i) {
             dstArray[i].fastCopyFrom(srcArray[i]);
@@ -336,11 +336,11 @@ DateFormatSymbols::createZoneStrings(const UnicodeString *const * otherStrings)
     UBool failed = false;
 
     fZoneStrings = (UnicodeString **)uprv_malloc(fZoneStringsRowCount * sizeof(UnicodeString *));
-    if (fZoneStrings != NULL) {
+    if (fZoneStrings != nullptr) {
         for (row=0; row<fZoneStringsRowCount; ++row)
         {
             fZoneStrings[row] = newUnicodeStringArray(fZoneStringsColCount);
-            if (fZoneStrings[row] == NULL) {
+            if (fZoneStrings[row] == nullptr) {
                 failed = true;
                 break;
             }
@@ -356,7 +356,7 @@ DateFormatSymbols::createZoneStrings(const UnicodeString *const * otherStrings)
             delete[] fZoneStrings[i];
         }
         uprv_free(fZoneStrings);
-        fZoneStrings = NULL;
+        fZoneStrings = nullptr;
     }
 }
 
@@ -408,38 +408,38 @@ DateFormatSymbols::copyData(const DateFormatSymbols& other) {
                 other.fStandaloneNarrowDayPeriods, other.fStandaloneNarrowDayPeriodsCount);
     assignArray(fStandaloneAbbreviatedDayPeriods, fStandaloneAbbreviatedDayPeriodsCount,
                 other.fStandaloneAbbreviatedDayPeriods, other.fStandaloneAbbreviatedDayPeriodsCount);
-    if (other.fLeapMonthPatterns != NULL) {
+    if (other.fLeapMonthPatterns != nullptr) {
         assignArray(fLeapMonthPatterns, fLeapMonthPatternsCount, other.fLeapMonthPatterns, other.fLeapMonthPatternsCount);
     } else {
-        fLeapMonthPatterns = NULL;
+        fLeapMonthPatterns = nullptr;
         fLeapMonthPatternsCount = 0;
     }
-    if (other.fShortYearNames != NULL) {
+    if (other.fShortYearNames != nullptr) {
         assignArray(fShortYearNames, fShortYearNamesCount, other.fShortYearNames, other.fShortYearNamesCount);
     } else {
-        fShortYearNames = NULL;
+        fShortYearNames = nullptr;
         fShortYearNamesCount = 0;
     }
-    if (other.fShortZodiacNames != NULL) {
+    if (other.fShortZodiacNames != nullptr) {
         assignArray(fShortZodiacNames, fShortZodiacNamesCount, other.fShortZodiacNames, other.fShortZodiacNamesCount);
     } else {
-        fShortZodiacNames = NULL;
+        fShortZodiacNames = nullptr;
         fShortZodiacNamesCount = 0;
     }
 
-    if (other.fZoneStrings != NULL) {
+    if (other.fZoneStrings != nullptr) {
         fZoneStringsColCount = other.fZoneStringsColCount;
         fZoneStringsRowCount = other.fZoneStringsRowCount;
         createZoneStrings((const UnicodeString**)other.fZoneStrings);
 
     } else {
-        fZoneStrings = NULL;
+        fZoneStrings = nullptr;
         fZoneStringsColCount = 0;
         fZoneStringsRowCount = 0;
     }
     fZSFLocale = other.fZSFLocale;
     // Other zone strings data is created on demand
-    fLocaleZoneStrings = NULL;
+    fLocaleZoneStrings = nullptr;
 
     // fastCopyFrom() - see assignArray comments
     fLocalPatternChars.fastCopyFrom(other.fLocalPatternChars);
@@ -519,8 +519,8 @@ void DateFormatSymbols::disposeZoneStrings()
         uprv_free(fLocaleZoneStrings);
     }
 
-    fZoneStrings = NULL;
-    fLocaleZoneStrings = NULL;
+    fZoneStrings = nullptr;
+    fLocaleZoneStrings = nullptr;
     fZoneStringsRowCount = 0;
     fZoneStringsColCount = 0;
 }
@@ -623,11 +623,11 @@ DateFormatSymbols::operator==(const DateFormatSymbols& other) const
                          fStandaloneWideDayPeriodsCount))
         {
             // Compare the contents of fZoneStrings
-            if (fZoneStrings == NULL && other.fZoneStrings == NULL) {
+            if (fZoneStrings == nullptr && other.fZoneStrings == nullptr) {
                 if (fZSFLocale == other.fZSFLocale) {
                     return true;
                 }
-            } else if (fZoneStrings != NULL && other.fZoneStrings != NULL) {
+            } else if (fZoneStrings != nullptr && other.fZoneStrings != nullptr) {
                 if (fZoneStringsRowCount == other.fZoneStringsRowCount
                     && fZoneStringsColCount == other.fZoneStringsColCount) {
                     bool cmpres = true;
@@ -683,7 +683,7 @@ DateFormatSymbols::getShortMonths(int32_t &count) const
 const UnicodeString*
 DateFormatSymbols::getMonths(int32_t &count, DtContextType context, DtWidthType width ) const
 {
-    UnicodeString *returnValue = NULL;
+    UnicodeString *returnValue = nullptr;
 
     switch (context) {
     case FORMAT :
@@ -747,7 +747,7 @@ DateFormatSymbols::getShortWeekdays(int32_t &count) const
 const UnicodeString*
 DateFormatSymbols::getWeekdays(int32_t &count, DtContextType context, DtWidthType width) const
 {
-    UnicodeString *returnValue = NULL;
+    UnicodeString *returnValue = nullptr;
     switch (context) {
     case FORMAT :
         switch(width) {
@@ -802,7 +802,7 @@ DateFormatSymbols::getWeekdays(int32_t &count, DtContextType context, DtWidthTyp
 const UnicodeString*
 DateFormatSymbols::getQuarters(int32_t &count, DtContextType context, DtWidthType width ) const
 {
-    UnicodeString *returnValue = NULL;
+    UnicodeString *returnValue = nullptr;
 
     switch (context) {
     case FORMAT :
@@ -1250,12 +1250,12 @@ DateFormatSymbols::setTimeSeparatorString(const UnicodeString& newTimeSeparator)
 const UnicodeString**
 DateFormatSymbols::getZoneStrings(int32_t& rowCount, int32_t& columnCount) const
 {
-    const UnicodeString **result = NULL;
+    const UnicodeString **result = nullptr;
     static UMutex LOCK;
 
     umtx_lock(&LOCK);
-    if (fZoneStrings == NULL) {
-        if (fLocaleZoneStrings == NULL) {
+    if (fZoneStrings == nullptr) {
+        if (fLocaleZoneStrings == nullptr) {
             ((DateFormatSymbols*)this)->initZoneStringsArray();
         }
         result = (const UnicodeString**)fLocaleZoneStrings;
@@ -1275,15 +1275,15 @@ DateFormatSymbols::getZoneStrings(int32_t& rowCount, int32_t& columnCount) const
 // This code must be called within a synchronized block
 void
 DateFormatSymbols::initZoneStringsArray(void) {
-    if (fZoneStrings != NULL || fLocaleZoneStrings != NULL) {
+    if (fZoneStrings != nullptr || fLocaleZoneStrings != nullptr) {
         return;
     }
 
     UErrorCode status = U_ZERO_ERROR;
 
-    StringEnumeration *tzids = NULL;
-    UnicodeString ** zarray = NULL;
-    TimeZoneNames *tzNames = NULL;
+    StringEnumeration *tzids = nullptr;
+    UnicodeString ** zarray = nullptr;
+    TimeZoneNames *tzNames = nullptr;
     int32_t rows = 0;
 
     static const UTimeZoneNameType TYPES[] = {
@@ -1294,7 +1294,7 @@ DateFormatSymbols::initZoneStringsArray(void) {
 
     do { // dummy do-while
 
-        tzids = TimeZone::createTimeZoneIDEnumeration(ZONE_SET, NULL, NULL, status);
+        tzids = TimeZone::createTimeZoneIDEnumeration(ZONE_SET, nullptr, nullptr, status);
         rows = tzids->count(status);
         if (U_FAILURE(status)) {
             break;
@@ -1303,7 +1303,7 @@ DateFormatSymbols::initZoneStringsArray(void) {
         // Allocate array
         int32_t size = rows * sizeof(UnicodeString*);
         zarray = (UnicodeString**)uprv_malloc(size);
-        if (zarray == NULL) {
+        if (zarray == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             break;
         }
@@ -1324,7 +1324,7 @@ DateFormatSymbols::initZoneStringsArray(void) {
             }
 
             zarray[i] = new UnicodeString[5];
-            if (zarray[i] == NULL) {
+            if (zarray[i] == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 break;
             }
@@ -1344,7 +1344,7 @@ DateFormatSymbols::initZoneStringsArray(void) {
                 }
             }
             uprv_free(zarray);
-            zarray = NULL;
+            zarray = nullptr;
         }
     }
 
@@ -1384,7 +1384,7 @@ DateFormatSymbols::getPatternUChars(void)
 UDateFormatField U_EXPORT2
 DateFormatSymbols::getPatternCharIndex(UChar c) {
     const UChar *p = u_strchr(gPatternChars, c);
-    if (p == NULL) {
+    if (p == nullptr) {
         return UDAT_FIELD_COUNT;
     } else {
         return static_cast<UDateFormatField>(p - gPatternChars);
@@ -1528,14 +1528,14 @@ struct CalendarDataSink : public ResourceSink {
         mapRefs(),
         aliasPathPairs(uprv_deleteUObject, uhash_compareUnicodeString, status),
         currentCalendarType(), nextCalendarType(),
-        resourcesToVisit(NULL), aliasRelativePath() {
+        resourcesToVisit(nullptr), aliasRelativePath() {
         if (U_FAILURE(status)) { return; }
     }
     virtual ~CalendarDataSink();
 
     // Configure the CalendarSink to visit all the resources
     void visitAllResources() {
-        resourcesToVisit.adoptInstead(NULL);
+        resourcesToVisit.adoptInstead(nullptr);
     }
 
     // Actions to be done before enumerating
@@ -1550,7 +1550,7 @@ struct CalendarDataSink : public ResourceSink {
         U_ASSERT(!currentCalendarType.isEmpty());
 
         // Stores the resources to visit on the next calendar.
-        LocalPointer<UVector> resourcesToVisitNext(NULL);
+        LocalPointer<UVector> resourcesToVisitNext(nullptr);
         ResourceTable calendarData = value.getTable(errorCode);
         if (U_FAILURE(errorCode)) { return; }
 
@@ -1581,7 +1581,7 @@ struct CalendarDataSink : public ResourceSink {
 
             } else if (aliasType == SAME_CALENDAR) {
                 // Register same-calendar alias
-                if (arrays.get(aliasRelativePath) == NULL && maps.get(aliasRelativePath) == NULL) {
+                if (arrays.get(aliasRelativePath) == nullptr && maps.get(aliasRelativePath) == nullptr) {
                     LocalPointer<UnicodeString> aliasRelativePathCopy(aliasRelativePath.clone(), errorCode);
                     aliasPathPairs.adoptElement(aliasRelativePathCopy.orphan(), errorCode);
                     if (U_FAILURE(errorCode)) { return; }
@@ -1601,7 +1601,7 @@ struct CalendarDataSink : public ResourceSink {
             if (uprv_strcmp(key, gAmPmMarkersTag) == 0
                 || uprv_strcmp(key, gAmPmMarkersAbbrTag) == 0
                 || uprv_strcmp(key, gAmPmMarkersNarrowTag) == 0) {
-                if (arrays.get(keyUString) == NULL) {
+                if (arrays.get(keyUString) == nullptr) {
                     ResourceArray resourceArray = value.getArray(errorCode);
                     int32_t arraySize = resourceArray.getSize();
                     LocalArray<UnicodeString> stringArray(new UnicodeString[arraySize], errorCode);
@@ -1630,9 +1630,9 @@ struct CalendarDataSink : public ResourceSink {
                 UnicodeString *alias = (UnicodeString*)aliasPathPairs[i];
                 UnicodeString *aliasArray;
                 Hashtable *aliasMap;
-                if ((aliasArray = (UnicodeString*)arrays.get(*alias)) != NULL) {
+                if ((aliasArray = (UnicodeString*)arrays.get(*alias)) != nullptr) {
                     UnicodeString *path = (UnicodeString*)aliasPathPairs[i + 1];
-                    if (arrays.get(*path) == NULL) {
+                    if (arrays.get(*path) == nullptr) {
                         // Clone the array
                         int32_t aliasArraySize = arraySizes.geti(*alias);
                         LocalArray<UnicodeString> aliasArrayCopy(new UnicodeString[aliasArraySize], errorCode);
@@ -1644,9 +1644,9 @@ struct CalendarDataSink : public ResourceSink {
                     }
                     if (U_FAILURE(errorCode)) { return; }
                     mod = true;
-                } else if ((aliasMap = (Hashtable*)maps.get(*alias)) != NULL) {
+                } else if ((aliasMap = (Hashtable*)maps.get(*alias)) != nullptr) {
                     UnicodeString *path = (UnicodeString*)aliasPathPairs[i + 1];
-                    if (maps.get(*path) == NULL) {
+                    if (maps.get(*path) == nullptr) {
                         maps.put(*path, aliasMap, errorCode);
                     }
                     if (U_FAILURE(errorCode)) { return; }
@@ -1674,7 +1674,7 @@ struct CalendarDataSink : public ResourceSink {
 
         ResourceTable table = value.getTable(errorCode);
         if (U_FAILURE(errorCode)) return;
-        Hashtable* stringMap = NULL;
+        Hashtable* stringMap = nullptr;
 
         // Iterate over all the elements of the table and add them to the map
         for (int i = 0; table.getKeyAndValue(i, key, value); i++) {
@@ -1691,7 +1691,7 @@ struct CalendarDataSink : public ResourceSink {
                 if (i == 0) {
                     // mapRefs will keep ownership of 'stringMap':
                     stringMap = mapRefs.create(false, errorCode);
-                    if (stringMap == NULL) {
+                    if (stringMap == nullptr) {
                         errorCode = U_MEMORY_ALLOCATION_ERROR;
                         return;
                     }
@@ -1699,7 +1699,7 @@ struct CalendarDataSink : public ResourceSink {
                     if (U_FAILURE(errorCode)) { return; }
                     stringMap->setValueDeleter(uprv_deleteUObject);
                 }
-                U_ASSERT(stringMap != NULL);
+                U_ASSERT(stringMap != nullptr);
                 int32_t valueStringSize;
                 const UChar *valueString = value.getString(valueStringSize, errorCode);
                 if (U_FAILURE(errorCode)) { return; }
@@ -1708,7 +1708,7 @@ struct CalendarDataSink : public ResourceSink {
                 if (U_FAILURE(errorCode)) { return; }
                 continue;
             }
-            U_ASSERT(stringMap == NULL);
+            U_ASSERT(stringMap == nullptr);
 
             // Store the current path's length and append the current key to the path.
             int32_t pathLength = path.length();
@@ -1744,7 +1744,7 @@ struct CalendarDataSink : public ResourceSink {
             }
 
             // == Handle aliases ==
-            if (arrays.get(path) != NULL || maps.get(path) != NULL) {
+            if (arrays.get(path) != nullptr || maps.get(path) != nullptr) {
                 // Drop the latest key on the path and continue
                 path.retainBetween(0, pathLength);
                 continue;
@@ -1870,7 +1870,7 @@ initField(UnicodeString **field, int32_t& length, CalendarDataSink &sink, CharSt
         UnicodeString keyUString(key.data(), -1, US_INV);
         UnicodeString* array = static_cast<UnicodeString*>(sink.arrays.get(keyUString));
 
-        if (array != NULL) {
+        if (array != nullptr) {
             length = sink.arraySizes.geti(keyUString);
             *field = array;
             // DateFormatSymbols takes ownership of the array:
@@ -1888,11 +1888,11 @@ initField(UnicodeString **field, int32_t& length, CalendarDataSink &sink, CharSt
         UnicodeString keyUString(key.data(), -1, US_INV);
         UnicodeString* array = static_cast<UnicodeString*>(sink.arrays.get(keyUString));
 
-        if (array != NULL) {
+        if (array != nullptr) {
             int32_t arrayLength = sink.arraySizes.geti(keyUString);
             length = arrayLength + arrayOffset;
             *field = new UnicodeString[length];
-            if (*field == NULL) {
+            if (*field == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 return;
             }
@@ -1910,10 +1910,10 @@ initLeapMonthPattern(UnicodeString *field, int32_t index, CalendarDataSink &sink
     if (U_SUCCESS(status)) {
         UnicodeString pathUString(path.data(), -1, US_INV);
         Hashtable *leapMonthTable = static_cast<Hashtable*>(sink.maps.get(pathUString));
-        if (leapMonthTable != NULL) {
+        if (leapMonthTable != nullptr) {
             UnicodeString leapLabel(false, kLeapTagUChar, UPRV_LENGTHOF(kLeapTagUChar));
             UnicodeString *leapMonthPattern = static_cast<UnicodeString*>(leapMonthTable->get(leapLabel));
-            if (leapMonthPattern != NULL) {
+            if (leapMonthPattern != nullptr) {
                 field[index].fastCopyFrom(*leapMonthPattern);
             } else {
                 field[index].setToBogus();
@@ -1956,7 +1956,7 @@ typedef struct {
 } ContextUsageTypeNameToEnumValue;
 
 static const ContextUsageTypeNameToEnumValue contextUsageTypeMap[] = {
-   // Entries must be sorted by usageTypeName; entry with NULL name terminates list.
+   // Entries must be sorted by usageTypeName; entry with nullptr name terminates list.
     { "day-format-except-narrow", DateFormatSymbols::kCapContextUsageDayFormat },
     { "day-narrow",     DateFormatSymbols::kCapContextUsageDayNarrow },
     { "day-standalone-except-narrow", DateFormatSymbols::kCapContextUsageDayStandalone },
@@ -1970,7 +1970,7 @@ static const ContextUsageTypeNameToEnumValue contextUsageTypeMap[] = {
     { "month-standalone-except-narrow", DateFormatSymbols::kCapContextUsageMonthStandalone },
     { "zone-long",      DateFormatSymbols::kCapContextUsageZoneLong },
     { "zone-short",     DateFormatSymbols::kCapContextUsageZoneShort },
-    { NULL, (DateFormatSymbols::ECapitalizationContextUsageType)0 },
+    { nullptr, (DateFormatSymbols::ECapitalizationContextUsageType)0 },
 };
 
 // Resource keys to look up localized strings for day periods.
@@ -1982,23 +1982,23 @@ static const char *dayPeriodKeys[] = {"midnight", "noon",
 
 UnicodeString* loadDayPeriodStrings(CalendarDataSink &sink, CharString &path,
                                     int32_t &stringCount,  UErrorCode &status) {
-    if (U_FAILURE(status)) { return NULL; }
+    if (U_FAILURE(status)) { return nullptr; }
 
     UnicodeString pathUString(path.data(), -1, US_INV);
     Hashtable* map = static_cast<Hashtable*>(sink.maps.get(pathUString));
 
     stringCount = UPRV_LENGTHOF(dayPeriodKeys);
     UnicodeString *strings = new UnicodeString[stringCount];
-    if (strings == NULL) {
+    if (strings == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
 
-    if (map != NULL) {
+    if (map != nullptr) {
         for (int32_t i = 0; i < stringCount; ++i) {
             UnicodeString dayPeriodKey(dayPeriodKeys[i], -1, US_INV);
             UnicodeString *dayPeriod = static_cast<UnicodeString*>(map->get(dayPeriodKey));
-            if (dayPeriod != NULL) {
+            if (dayPeriod != nullptr) {
                 strings[i].fastCopyFrom(*dayPeriod);
             } else {
                 strings[i].setToBogus();
@@ -2017,79 +2017,79 @@ void
 DateFormatSymbols::initializeData(const Locale& locale, const char *type, UErrorCode& status, UBool useLastResortData)
 {
     int32_t len = 0;
-    /* In case something goes wrong, initialize all of the data to NULL. */
-    fEras = NULL;
+    /* In case something goes wrong, initialize all of the data to nullptr. */
+    fEras = nullptr;
     fErasCount = 0;
-    fEraNames = NULL;
+    fEraNames = nullptr;
     fEraNamesCount = 0;
-    fNarrowEras = NULL;
+    fNarrowEras = nullptr;
     fNarrowErasCount = 0;
-    fMonths = NULL;
+    fMonths = nullptr;
     fMonthsCount=0;
-    fShortMonths = NULL;
+    fShortMonths = nullptr;
     fShortMonthsCount=0;
-    fNarrowMonths = NULL;
+    fNarrowMonths = nullptr;
     fNarrowMonthsCount=0;
-    fStandaloneMonths = NULL;
+    fStandaloneMonths = nullptr;
     fStandaloneMonthsCount=0;
-    fStandaloneShortMonths = NULL;
+    fStandaloneShortMonths = nullptr;
     fStandaloneShortMonthsCount=0;
-    fStandaloneNarrowMonths = NULL;
+    fStandaloneNarrowMonths = nullptr;
     fStandaloneNarrowMonthsCount=0;
-    fWeekdays = NULL;
+    fWeekdays = nullptr;
     fWeekdaysCount=0;
-    fShortWeekdays = NULL;
+    fShortWeekdays = nullptr;
     fShortWeekdaysCount=0;
-    fShorterWeekdays = NULL;
+    fShorterWeekdays = nullptr;
     fShorterWeekdaysCount=0;
-    fNarrowWeekdays = NULL;
+    fNarrowWeekdays = nullptr;
     fNarrowWeekdaysCount=0;
-    fStandaloneWeekdays = NULL;
+    fStandaloneWeekdays = nullptr;
     fStandaloneWeekdaysCount=0;
-    fStandaloneShortWeekdays = NULL;
+    fStandaloneShortWeekdays = nullptr;
     fStandaloneShortWeekdaysCount=0;
-    fStandaloneShorterWeekdays = NULL;
+    fStandaloneShorterWeekdays = nullptr;
     fStandaloneShorterWeekdaysCount=0;
-    fStandaloneNarrowWeekdays = NULL;
+    fStandaloneNarrowWeekdays = nullptr;
     fStandaloneNarrowWeekdaysCount=0;
-    fAmPms = NULL;
+    fAmPms = nullptr;
     fAmPmsCount=0;
-    fNarrowAmPms = NULL;
+    fNarrowAmPms = nullptr;
     fNarrowAmPmsCount=0;
     fTimeSeparator.setToBogus();
-    fQuarters = NULL;
+    fQuarters = nullptr;
     fQuartersCount = 0;
-    fShortQuarters = NULL;
+    fShortQuarters = nullptr;
     fShortQuartersCount = 0;
-    fNarrowQuarters = NULL;
+    fNarrowQuarters = nullptr;
     fNarrowQuartersCount = 0;
-    fStandaloneQuarters = NULL;
+    fStandaloneQuarters = nullptr;
     fStandaloneQuartersCount = 0;
-    fStandaloneShortQuarters = NULL;
+    fStandaloneShortQuarters = nullptr;
     fStandaloneShortQuartersCount = 0;
-    fStandaloneNarrowQuarters = NULL;
+    fStandaloneNarrowQuarters = nullptr;
     fStandaloneNarrowQuartersCount = 0;
-    fLeapMonthPatterns = NULL;
+    fLeapMonthPatterns = nullptr;
     fLeapMonthPatternsCount = 0;
-    fShortYearNames = NULL;
+    fShortYearNames = nullptr;
     fShortYearNamesCount = 0;
-    fShortZodiacNames = NULL;
+    fShortZodiacNames = nullptr;
     fShortZodiacNamesCount = 0;
     fZoneStringsRowCount = 0;
     fZoneStringsColCount = 0;
-    fZoneStrings = NULL;
-    fLocaleZoneStrings = NULL;
-    fAbbreviatedDayPeriods = NULL;
+    fZoneStrings = nullptr;
+    fLocaleZoneStrings = nullptr;
+    fAbbreviatedDayPeriods = nullptr;
     fAbbreviatedDayPeriodsCount = 0;
-    fWideDayPeriods = NULL;
+    fWideDayPeriods = nullptr;
     fWideDayPeriodsCount = 0;
-    fNarrowDayPeriods = NULL;
+    fNarrowDayPeriods = nullptr;
     fNarrowDayPeriodsCount = 0;
-    fStandaloneAbbreviatedDayPeriods = NULL;
+    fStandaloneAbbreviatedDayPeriods = nullptr;
     fStandaloneAbbreviatedDayPeriodsCount = 0;
-    fStandaloneWideDayPeriods = NULL;
+    fStandaloneWideDayPeriods = nullptr;
     fStandaloneWideDayPeriodsCount = 0;
-    fStandaloneNarrowDayPeriods = NULL;
+    fStandaloneNarrowDayPeriods = nullptr;
     fStandaloneNarrowDayPeriodsCount = 0;
     uprv_memset(fCapitalization, 0, sizeof(fCapitalization));
 
@@ -2103,13 +2103,13 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
 
     // Create a CalendarDataSink to process this data and the resource bundles
     CalendarDataSink calendarSink(status);
-    UResourceBundle *rb = ures_open(NULL, locale.getBaseName(), &status);
-    UResourceBundle *cb = ures_getByKey(rb, gCalendarTag, NULL, &status);
+    UResourceBundle *rb = ures_open(nullptr, locale.getBaseName(), &status);
+    UResourceBundle *cb = ures_getByKey(rb, gCalendarTag, nullptr, &status);
 
     if (U_FAILURE(status)) return;
 
     // Iterate over the resource bundle data following the fallbacks through different calendar types
-    UnicodeString calendarType((type != NULL && *type != '\0')? type : gGregorianTag, -1, US_INV);
+    UnicodeString calendarType((type != nullptr && *type != '\0')? type : gGregorianTag, -1, US_INV);
     while (!calendarType.isBogus()) {
         CharString calendarTypeBuffer;
         calendarTypeBuffer.appendInvariantChars(calendarType, status);
@@ -2118,7 +2118,7 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
 
         // Enumerate this calendar type. If the calendar is not found fallback to gregorian
         UErrorCode oldStatus = status;
-        UResourceBundle *ctb = ures_getByKeyWithFallback(cb, calendarTypeCArray, NULL, &status);
+        UResourceBundle *ctb = ures_getByKeyWithFallback(cb, calendarTypeCArray, nullptr, &status);
         if (status == U_MISSING_RESOURCE_ERROR) {
             ures_close(ctb);
             if (uprv_strcmp(calendarTypeCArray, gGregorianTag) != 0) {
@@ -2190,7 +2190,7 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
             fLeapMonthPatternsCount = kMonthPatternsCount;
         } else {
             delete[] fLeapMonthPatterns;
-            fLeapMonthPatterns = NULL;
+            fLeapMonthPatterns = nullptr;
         }
     }
 
@@ -2203,23 +2203,23 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
 
     // Load context transforms and capitalization
     tempStatus = U_ZERO_ERROR;
-    UResourceBundle *localeBundle = ures_open(NULL, locale.getName(), &tempStatus);
+    UResourceBundle *localeBundle = ures_open(nullptr, locale.getName(), &tempStatus);
     if (U_SUCCESS(tempStatus)) {
-        UResourceBundle *contextTransforms = ures_getByKeyWithFallback(localeBundle, gContextTransformsTag, NULL, &tempStatus);
+        UResourceBundle *contextTransforms = ures_getByKeyWithFallback(localeBundle, gContextTransformsTag, nullptr, &tempStatus);
         if (U_SUCCESS(tempStatus)) {
             UResourceBundle *contextTransformUsage;
-            while ( (contextTransformUsage = ures_getNextResource(contextTransforms, NULL, &tempStatus)) != NULL ) {
+            while ( (contextTransformUsage = ures_getNextResource(contextTransforms, nullptr, &tempStatus)) != nullptr ) {
                 const int32_t * intVector = ures_getIntVector(contextTransformUsage, &len, &status);
-                if (U_SUCCESS(tempStatus) && intVector != NULL && len >= 2) {
+                if (U_SUCCESS(tempStatus) && intVector != nullptr && len >= 2) {
                     const char* usageType = ures_getKey(contextTransformUsage);
-                    if (usageType != NULL) {
+                    if (usageType != nullptr) {
                         const ContextUsageTypeNameToEnumValue * typeMapPtr = contextUsageTypeMap;
                         int32_t compResult = 0;
                         // linear search; list is short and we cannot be sure that bsearch is available
-                        while ( typeMapPtr->usageTypeName != NULL && (compResult = uprv_strcmp(usageType, typeMapPtr->usageTypeName)) > 0 ) {
+                        while ( typeMapPtr->usageTypeName != nullptr && (compResult = uprv_strcmp(usageType, typeMapPtr->usageTypeName)) > 0 ) {
                             ++typeMapPtr;
                         }
-                        if (typeMapPtr->usageTypeName != NULL && compResult == 0) {
+                        if (typeMapPtr->usageTypeName != nullptr && compResult == 0) {
                             fCapitalization[typeMapPtr->usageTypeEnumValue][0] = static_cast<UBool>(intVector[0]);
                             fCapitalization[typeMapPtr->usageTypeEnumValue][1] = static_cast<UBool>(intVector[1]);
                         }
@@ -2235,15 +2235,15 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
         const LocalPointer<NumberingSystem> numberingSystem(
                 NumberingSystem::createInstance(locale, tempStatus), tempStatus);
         if (U_SUCCESS(tempStatus)) {
-            // These functions all fail gracefully if passed NULL pointers and
+            // These functions all fail gracefully if passed nullptr pointers and
             // do nothing unless U_SUCCESS(tempStatus), so it's only necessary
             // to check for errors once after all calls are made.
             const LocalUResourceBundlePointer numberElementsData(ures_getByKeyWithFallback(
-                    localeBundle, gNumberElementsTag, NULL, &tempStatus));
+                    localeBundle, gNumberElementsTag, nullptr, &tempStatus));
             const LocalUResourceBundlePointer nsNameData(ures_getByKeyWithFallback(
-                    numberElementsData.getAlias(), numberingSystem->getName(), NULL, &tempStatus));
+                    numberElementsData.getAlias(), numberingSystem->getName(), nullptr, &tempStatus));
             const LocalUResourceBundlePointer symbolsData(ures_getByKeyWithFallback(
-                    nsNameData.getAlias(), gSymbolsTag, NULL, &tempStatus));
+                    nsNameData.getAlias(), gSymbolsTag, nullptr, &tempStatus));
             fTimeSeparator = ures_getUnicodeStringByKey(
                     symbolsData.getAlias(), gTimeSeparatorTag, &tempStatus);
             if (U_FAILURE(tempStatus)) {
@@ -2284,19 +2284,19 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
     // Fill in for missing/bogus items (dayPeriods are a map so single items might be missing)
     if (U_SUCCESS(status)) {
         for (int32_t dpidx = 0; dpidx < fAbbreviatedDayPeriodsCount; ++dpidx) {
-            if (dpidx < fWideDayPeriodsCount && fWideDayPeriods != NULL && fWideDayPeriods[dpidx].isBogus()) {
+            if (dpidx < fWideDayPeriodsCount && fWideDayPeriods != nullptr && fWideDayPeriods[dpidx].isBogus()) {
                 fWideDayPeriods[dpidx].fastCopyFrom(fAbbreviatedDayPeriods[dpidx]);
             }
-            if (dpidx < fNarrowDayPeriodsCount && fNarrowDayPeriods != NULL && fNarrowDayPeriods[dpidx].isBogus()) {
+            if (dpidx < fNarrowDayPeriodsCount && fNarrowDayPeriods != nullptr && fNarrowDayPeriods[dpidx].isBogus()) {
                 fNarrowDayPeriods[dpidx].fastCopyFrom(fAbbreviatedDayPeriods[dpidx]);
             }
-            if (dpidx < fStandaloneAbbreviatedDayPeriodsCount && fStandaloneAbbreviatedDayPeriods != NULL && fStandaloneAbbreviatedDayPeriods[dpidx].isBogus()) {
+            if (dpidx < fStandaloneAbbreviatedDayPeriodsCount && fStandaloneAbbreviatedDayPeriods != nullptr && fStandaloneAbbreviatedDayPeriods[dpidx].isBogus()) {
                 fStandaloneAbbreviatedDayPeriods[dpidx].fastCopyFrom(fAbbreviatedDayPeriods[dpidx]);
             }
-            if (dpidx < fStandaloneWideDayPeriodsCount && fStandaloneWideDayPeriods != NULL && fStandaloneWideDayPeriods[dpidx].isBogus()) {
+            if (dpidx < fStandaloneWideDayPeriodsCount && fStandaloneWideDayPeriods != nullptr && fStandaloneWideDayPeriods[dpidx].isBogus()) {
                 fStandaloneWideDayPeriods[dpidx].fastCopyFrom(fStandaloneAbbreviatedDayPeriods[dpidx]);
             }
-            if (dpidx < fStandaloneNarrowDayPeriodsCount && fStandaloneNarrowDayPeriods != NULL && fStandaloneNarrowDayPeriods[dpidx].isBogus()) {
+            if (dpidx < fStandaloneNarrowDayPeriodsCount && fStandaloneNarrowDayPeriods != nullptr && fStandaloneNarrowDayPeriods[dpidx].isBogus()) {
                 fStandaloneNarrowDayPeriods[dpidx].fastCopyFrom(fStandaloneAbbreviatedDayPeriods[dpidx]);
             }
         }
index f4e28de91bce3fc4f3a4d4cf49bcc52d922d77b0..f8c051fdeb30edd436e68ebc3d6b42c5f4d64f86 100644 (file)
@@ -2177,10 +2177,10 @@ PatternMap::getPatternFromBasePattern(const UnicodeString& basePattern, UBool& s
 
 
 // Find the pattern from the given skeleton.
-// At least when this is called from getBestRaw & addPattern (in which case specifiedSkeletonPtr is non-NULL),
+// At least when this is called from getBestRaw & addPattern (in which case specifiedSkeletonPtr is non-nullptr),
 // the comparison should be based on skeleton.original (which is unique and tied to the distance measurement in bestRaw)
 // and not skeleton.baseOriginal (which is not unique); otherwise we may pick a different skeleton than the one with the
-// optimum distance value in getBestRaw. When this is called from public getRedundants (specifiedSkeletonPtr is NULL),
+// optimum distance value in getBestRaw. When this is called from public getRedundants (specifiedSkeletonPtr is nullptr),
 // for now it will continue to compare based on baseOriginal so as not to change the behavior unnecessarily.
 const UnicodeString *
 PatternMap::getPatternFromSkeleton(const PtnSkeleton& skeleton, const PtnSkeleton** specifiedSkeletonPtr) const { // key to search for
index 00c1304d2455d1935edaaef0fb55bfa61385e8fa..c331cda2549853cc420a1a9f13ae6df4ce8ddf91 100644 (file)
@@ -36,28 +36,28 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(EscapeTransliterator)
  */
 static Transliterator* _createEscUnicode(const UnicodeString& ID, Transliterator::Token /*context*/) {
     // Unicode: "U+10FFFF" hex, min=4, max=6
-    return new EscapeTransliterator(ID, UnicodeString(true, UNIPRE, 2), UnicodeString(), 16, 4, true, NULL);
+    return new EscapeTransliterator(ID, UnicodeString(true, UNIPRE, 2), UnicodeString(), 16, 4, true, nullptr);
 }
 static Transliterator* _createEscJava(const UnicodeString& ID, Transliterator::Token /*context*/) {
     // Java: "\\uFFFF" hex, min=4, max=4
-    return new EscapeTransliterator(ID, UnicodeString(true, BS_u, 2), UnicodeString(), 16, 4, false, NULL);
+    return new EscapeTransliterator(ID, UnicodeString(true, BS_u, 2), UnicodeString(), 16, 4, false, nullptr);
 }
 static Transliterator* _createEscC(const UnicodeString& ID, Transliterator::Token /*context*/) {
     // C: "\\uFFFF" hex, min=4, max=4; \\U0010FFFF hex, min=8, max=8
     return new EscapeTransliterator(ID, UnicodeString(true, BS_u, 2), UnicodeString(), 16, 4, true,
-             new EscapeTransliterator(UnicodeString(), UnicodeString(true, BS_U, 2), UnicodeString(), 16, 8, true, NULL));
+             new EscapeTransliterator(UnicodeString(), UnicodeString(true, BS_U, 2), UnicodeString(), 16, 8, true, nullptr));
 }
 static Transliterator* _createEscXML(const UnicodeString& ID, Transliterator::Token /*context*/) {
     // XML: "&#x10FFFF;" hex, min=1, max=6
-    return new EscapeTransliterator(ID, UnicodeString(true, XMLPRE, 3), UnicodeString(SEMI[0]), 16, 1, true, NULL);
+    return new EscapeTransliterator(ID, UnicodeString(true, XMLPRE, 3), UnicodeString(SEMI[0]), 16, 1, true, nullptr);
 }
 static Transliterator* _createEscXML10(const UnicodeString& ID, Transliterator::Token /*context*/) {
     // XML10: "&1114111;" dec, min=1, max=7 (not really "Any-Hex")
-    return new EscapeTransliterator(ID, UnicodeString(true, XML10PRE, 2), UnicodeString(SEMI[0]), 10, 1, true, NULL);
+    return new EscapeTransliterator(ID, UnicodeString(true, XML10PRE, 2), UnicodeString(SEMI[0]), 10, 1, true, nullptr);
 }
 static Transliterator* _createEscPerl(const UnicodeString& ID, Transliterator::Token /*context*/) {
     // Perl: "\\x{263A}" hex, min=1, max=6
-    return new EscapeTransliterator(ID, UnicodeString(true, PERLPRE, 3), UnicodeString(RBRACE[0]), 16, 1, true, NULL);
+    return new EscapeTransliterator(ID, UnicodeString(true, PERLPRE, 3), UnicodeString(RBRACE[0]), 16, 1, true, nullptr);
 }
 
 /**
@@ -91,7 +91,7 @@ EscapeTransliterator::EscapeTransliterator(const UnicodeString& newID,
                          int32_t _radix, int32_t _minDigits,
                          UBool _grokSupplementals,
                          EscapeTransliterator* adoptedSupplementalHandler) :
-    Transliterator(newID, NULL)
+    Transliterator(newID, nullptr)
 {
     this->prefix = _prefix;
     this->suffix = _suffix;
@@ -112,7 +112,7 @@ EscapeTransliterator::EscapeTransliterator(const EscapeTransliterator& o) :
     minDigits(o.minDigits),
     grokSupplementals(o.grokSupplementals) {
     supplementalHandler = (o.supplementalHandler != 0) ?
-        new EscapeTransliterator(*o.supplementalHandler) : NULL;
+        new EscapeTransliterator(*o.supplementalHandler) : nullptr;
 }
 
 EscapeTransliterator::~EscapeTransliterator() {
@@ -145,7 +145,7 @@ void EscapeTransliterator::handleTransliterate(Replaceable& text,
         int32_t c = grokSupplementals ? text.char32At(start) : text.charAt(start);
         int32_t charLen = grokSupplementals ? U16_LENGTH(c) : 1;
 
-        if ((c & 0xFFFF0000) != 0 && supplementalHandler != NULL) {
+        if ((c & 0xFFFF0000) != 0 && supplementalHandler != nullptr) {
             buf.truncate(0);
             buf.append(supplementalHandler->prefix);
             ICU_Utility::appendNumber(buf, c, supplementalHandler->radix,
index c3ede98328e200eebdd662990d97dbc9df60e113..25b4ce7aed1bca747a44708252cec23dfd3b961a 100644 (file)
@@ -67,7 +67,7 @@ static inline UObject* objectClone(const UObject* a) {
 
 // Return true if *a is an instance of Measure.
 static inline UBool instanceOfMeasure(const UObject* a) {
-    return dynamic_cast<const Measure*>(a) != NULL;
+    return dynamic_cast<const Measure*>(a) != nullptr;
 }
 
 /**
@@ -79,7 +79,7 @@ static inline UBool instanceOfMeasure(const UObject* a) {
  */
 static Formattable* createArrayCopy(const Formattable* array, int32_t count) {
     Formattable *result = new Formattable[count];
-    if (result != NULL) {
+    if (result != nullptr) {
         for (int32_t i=0; i<count; ++i)
             result[i] = array[i]; // Don't memcpy!
     }
@@ -104,8 +104,8 @@ static void setError(UErrorCode& ec, UErrorCode err) {
 void  Formattable::init() {
     fValue.fInt64 = 0;
     fType = kLong;
-    fDecimalStr = NULL;
-    fDecimalQuantity = NULL;
+    fDecimalStr = nullptr;
+    fDecimalQuantity = nullptr;
     fBogus.setToBogus(); 
 }
 
@@ -259,14 +259,14 @@ Formattable::operator=(const Formattable& source)
         }
 
         UErrorCode status = U_ZERO_ERROR;
-        if (source.fDecimalQuantity != NULL) {
+        if (source.fDecimalQuantity != nullptr) {
           fDecimalQuantity = new DecimalQuantity(*source.fDecimalQuantity);
         }
-        if (source.fDecimalStr != NULL) {
+        if (source.fDecimalStr != nullptr) {
             fDecimalStr = new CharString(*source.fDecimalStr, status);
             if (U_FAILURE(status)) {
                 delete fDecimalStr;
-                fDecimalStr = NULL;
+                fDecimalStr = nullptr;
             }
         }
     }
@@ -315,7 +315,7 @@ Formattable::operator==(const Formattable& that) const
         }
         break;
     case kObject:
-        if (fValue.fObject == NULL || that.fValue.fObject == NULL) {
+        if (fValue.fObject == nullptr || that.fValue.fObject == nullptr) {
             equal = false;
         } else {
             equal = objectEquals(fValue.fObject, that.fValue.fObject);
@@ -357,10 +357,10 @@ void Formattable::dispose()
     fValue.fInt64 = 0;
 
     delete fDecimalStr;
-    fDecimalStr = NULL;
+    fDecimalStr = nullptr;
 
     delete fDecimalQuantity;
-    fDecimalQuantity = NULL;
+    fDecimalQuantity = nullptr;
 }
 
 Formattable *
@@ -421,7 +421,7 @@ Formattable::getLong(UErrorCode& status) const
             return (int32_t)fValue.fDouble; // loses fraction
         }
     case Formattable::kObject:
-        if (fValue.fObject == NULL) {
+        if (fValue.fObject == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return 0;
         }
@@ -462,7 +462,7 @@ Formattable::getInt64(UErrorCode& status) const
         } else if (fValue.fDouble < (double)U_INT64_MIN) {
             status = U_INVALID_FORMAT_ERROR;
             return U_INT64_MIN;
-        } else if (fabs(fValue.fDouble) > U_DOUBLE_MAX_EXACT_INT && fDecimalQuantity != NULL) {
+        } else if (fabs(fValue.fDouble) > U_DOUBLE_MAX_EXACT_INT && fDecimalQuantity != nullptr) {
             if (fDecimalQuantity->fitsInLong(true)) {
                 return fDecimalQuantity->toLong();
             } else {
@@ -474,7 +474,7 @@ Formattable::getInt64(UErrorCode& status) const
             return (int64_t)fValue.fDouble;
         } 
     case Formattable::kObject:
-        if (fValue.fObject == NULL) {
+        if (fValue.fObject == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return 0;
         }
@@ -504,7 +504,7 @@ Formattable::getDouble(UErrorCode& status) const
     case Formattable::kDouble:
         return fValue.fDouble;
     case Formattable::kObject:
-        if (fValue.fObject == NULL) {
+        if (fValue.fObject == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return 0;
         }
@@ -522,7 +522,7 @@ Formattable::getDouble(UErrorCode& status) const
 
 const UObject*
 Formattable::getObject() const {
-    return (fType == kObject) ? fValue.fObject : NULL;
+    return (fType == kObject) ? fValue.fObject : nullptr;
 }
 
 // -------------------------------------
@@ -630,7 +630,7 @@ Formattable::getString(UnicodeString& result, UErrorCode& status) const
         setError(status, U_INVALID_FORMAT_ERROR);
         result.setToBogus();
     } else {
-        if (fValue.fString == NULL) {
+        if (fValue.fString == nullptr) {
             setError(status, U_MEMORY_ALLOCATION_ERROR);
         } else {
             result = *fValue.fString;
@@ -647,7 +647,7 @@ Formattable::getString(UErrorCode& status) const
         setError(status, U_INVALID_FORMAT_ERROR);
         return *getBogus();
     }
-    if (fValue.fString == NULL) {
+    if (fValue.fString == nullptr) {
         setError(status, U_MEMORY_ALLOCATION_ERROR);
         return *getBogus();
     }
@@ -662,7 +662,7 @@ Formattable::getString(UErrorCode& status)
         setError(status, U_INVALID_FORMAT_ERROR);
         return *getBogus();
     }
-    if (fValue.fString == NULL) {
+    if (fValue.fString == nullptr) {
        setError(status, U_MEMORY_ALLOCATION_ERROR);
        return *getBogus();
     }
@@ -676,7 +676,7 @@ Formattable::getArray(int32_t& count, UErrorCode& status) const
     if (fType != kArray) {
         setError(status, U_INVALID_FORMAT_ERROR);
         count = 0;
-        return NULL;
+        return nullptr;
     }
     count = fValue.fArrayAndCount.fCount; 
     return fValue.fArrayAndCount.fArray;
@@ -697,12 +697,12 @@ StringPiece Formattable::getDecimalNumber(UErrorCode &status) {
     if (U_FAILURE(status)) {
         return "";
     }
-    if (fDecimalStr != NULL) {
+    if (fDecimalStr != nullptr) {
       return fDecimalStr->toStringPiece();
     }
 
     CharString *decimalStr = internalGetCharString(status);
-    if(decimalStr == NULL) {
+    if(decimalStr == nullptr) {
       return ""; // getDecimalNumber returns "" for error cases
     } else {
       return decimalStr->toStringPiece();
@@ -710,8 +710,8 @@ StringPiece Formattable::getDecimalNumber(UErrorCode &status) {
 }
 
 CharString *Formattable::internalGetCharString(UErrorCode &status) {
-    if(fDecimalStr == NULL) {
-      if (fDecimalQuantity == NULL) {
+    if(fDecimalStr == nullptr) {
+      if (fDecimalQuantity == nullptr) {
         // No decimal number for the formattable yet.  Which means the value was
         // set directly by the user as an int, int64 or double.  If the value came
         // from parsing, or from the user setting a decimal number, fDecimalNum
@@ -725,9 +725,9 @@ CharString *Formattable::internalGetCharString(UErrorCode &status) {
       }
 
       fDecimalStr = new CharString();
-      if (fDecimalStr == NULL) {
+      if (fDecimalStr == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
       }
       // Older ICUs called uprv_decNumberToString here, which is not exactly the same as
       // DecimalQuantity::toScientificString(). The biggest difference is that uprv_decNumberToString does
@@ -775,11 +775,11 @@ Formattable::populateDecimalQuantity(number::impl::DecimalQuantity& output, UErr
 // ---------------------------------------
 void
 Formattable::adoptDecimalQuantity(DecimalQuantity *dq) {
-    if (fDecimalQuantity != NULL) {
+    if (fDecimalQuantity != nullptr) {
         delete fDecimalQuantity;
     }
     fDecimalQuantity = dq;
-    if (dq == NULL) { // allow adoptDigitList(NULL) to clear
+    if (dq == nullptr) { // allow adoptDigitList(nullptr) to clear
         return;
     }
 
@@ -898,11 +898,11 @@ U_NAMESPACE_USE
 U_CAPI UFormattable* U_EXPORT2
 ufmt_open(UErrorCode *status) {
   if( U_FAILURE(*status) ) {
-    return NULL;
+    return nullptr;
   }
   UFormattable *fmt = (new Formattable())->toUFormattable();
 
-  if( fmt == NULL ) {
+  if( fmt == nullptr ) {
     *status = U_MEMORY_ALLOCATION_ERROR;
   }
   return fmt;
@@ -958,7 +958,7 @@ ufmt_getObject(const UFormattable *fmt, UErrorCode *status) {
   const Formattable *obj = Formattable::fromUFormattable(fmt);
 
   const void *ret = obj->getObject();
-  if( ret==NULL &&
+  if( ret==nullptr &&
       (obj->getType() != Formattable::kObject) &&
       U_SUCCESS( *status )) {
     *status = U_INVALID_FORMAT_ERROR;
@@ -975,12 +975,12 @@ ufmt_getUChars(UFormattable *fmt, int32_t *len, UErrorCode *status) {
     if( U_SUCCESS(*status) ){
       *status = U_INVALID_FORMAT_ERROR;
     }
-    return NULL;
+    return nullptr;
   }
 
   // This should return a valid string
   UnicodeString &str = obj->getString(*status);
-  if( U_SUCCESS(*status) && len != NULL ) {
+  if( U_SUCCESS(*status) && len != nullptr ) {
     *len = str.length();
   }
   return str.getTerminatedBuffer();
@@ -1001,10 +1001,10 @@ ufmt_getArrayItemByIndex(UFormattable* fmt, int32_t n, UErrorCode *status) {
   int32_t count;
   (void)obj->getArray(count, *status);
   if(U_FAILURE(*status)) {
-    return NULL;
+    return nullptr;
   } else if(n<0 || n>=count) {
     setError(*status, U_INDEX_OUTOFBOUNDS_ERROR);
-    return NULL;
+    return nullptr;
   } else {
     return (*obj)[n].toUFormattable(); // returns non-const Formattable
   }
@@ -1020,11 +1020,11 @@ ufmt_getDecNumChars(UFormattable *fmt, int32_t *len, UErrorCode *status) {
   if(U_FAILURE(*status)) {
     return "";
   }
-  if(charString == NULL) {
+  if(charString == nullptr) {
     *status = U_MEMORY_ALLOCATION_ERROR;
     return "";
   } else {
-    if(len!=NULL) {
+    if(len!=nullptr) {
       *len = charString->length();
     }
     return charString->data();
index 4f6a98c2120560ea09cfa6fbc294180aee677263..bfa15d8d5514e1f8136d3e31e013aa57cbd8fdc9 100644 (file)
@@ -67,7 +67,7 @@ void FieldPositionOnlyHandler::setAcceptFirstOnly(UBool acceptFirstOnly) {
 
 FieldPositionIteratorHandler::FieldPositionIteratorHandler(FieldPositionIterator* posIter,
                                                            UErrorCode& _status)
-    : iter(posIter), vec(NULL), status(_status), fCategory(UFIELD_CATEGORY_UNDEFINED) {
+    : iter(posIter), vec(nullptr), status(_status), fCategory(UFIELD_CATEGORY_UNDEFINED) {
   if (iter && U_SUCCESS(status)) {
     vec = new UVector32(status);
   }
@@ -85,7 +85,7 @@ FieldPositionIteratorHandler::~FieldPositionIteratorHandler() {
     iter->setData(vec, status);
   }
   // if iter is null, we never allocated vec, so no need to free it
-  vec = NULL;
+  vec = nullptr;
 }
 
 void
index 4fb0c7b6fe686e8039300047afef574c38c97b74..20eccca5882c199fa96f017b3b55e526b33ef8e4 100644 (file)
@@ -65,7 +65,7 @@ class FieldPositionOnlyHandler : public FieldPositionHandler {
 // exported as U_I18N_API for tests
 
 class U_I18N_API FieldPositionIteratorHandler : public FieldPositionHandler {
-  FieldPositionIterator* iter; // can be NULL
+  FieldPositionIterator* iter; // can be nullptr
   UVector32* vec;
   UErrorCode status;
   UFieldCategory fCategory;
index 64bec990e3a9a7351c72629234cc344542fbf9f5..68f1edcc174a839bc8e97b0ffe73a74f9ff5681b 100644 (file)
@@ -22,16 +22,16 @@ U_NAMESPACE_BEGIN
 
 FieldPositionIterator::~FieldPositionIterator() {
   delete data;
-  data = NULL;
+  data = nullptr;
   pos = -1;
 }
 
 FieldPositionIterator::FieldPositionIterator()
-    : data(NULL), pos(-1) {
+    : data(nullptr), pos(-1) {
 }
 
 FieldPositionIterator::FieldPositionIterator(const FieldPositionIterator &rhs)
-  : UObject(rhs), data(NULL), pos(rhs.pos) {
+  : UObject(rhs), data(nullptr), pos(rhs.pos) {
 
   if (rhs.data) {
     UErrorCode status = U_ZERO_ERROR;
@@ -39,7 +39,7 @@ FieldPositionIterator::FieldPositionIterator(const FieldPositionIterator &rhs)
     data->assign(*rhs.data, status);
     if (status != U_ZERO_ERROR) {
       delete data;
-      data = NULL;
+      data = nullptr;
       pos = -1;
     }
   }
@@ -53,7 +53,7 @@ bool FieldPositionIterator::operator==(const FieldPositionIterator &rhs) const {
     return false;
   }
   if (!data) {
-    return rhs.data == NULL;
+    return rhs.data == nullptr;
   }
   return rhs.data ? data->operator==(*rhs.data) : false;
 }
@@ -64,7 +64,7 @@ void FieldPositionIterator::setData(UVector32 *adopt, UErrorCode& status) {
     if (adopt) {
       if (adopt->size() == 0) {
         delete adopt;
-        adopt = NULL;
+        adopt = nullptr;
       } else if ((adopt->size() % 4) != 0) {
         status = U_ILLEGAL_ARGUMENT_ERROR;
       } else {
@@ -87,7 +87,7 @@ void FieldPositionIterator::setData(UVector32 *adopt, UErrorCode& status) {
 
   delete data;
   data = adopt;
-  pos = adopt == NULL ? -1 : 0;
+  pos = adopt == nullptr ? -1 : 0;
 }
 
 UBool FieldPositionIterator::next(FieldPosition& fp) {
index ef64d17846786464094ee731ec373ae96b12e9b1..fada578e07b26e2adb25acd636ed030e9b201769 100644 (file)
 #include "umutex.h"
 #include "uhash.h"
 
-static UHashtable* gGenderInfoCache = NULL;
+static UHashtable* gGenderInfoCache = nullptr;
 
 static const char* gNeutralStr = "neutral";
 static const char* gMailTaintsStr = "maleTaints";
 static const char* gMixedNeutralStr = "mixedNeutral";
-static icu::GenderInfo* gObjs = NULL;
+static icu::GenderInfo* gObjs = nullptr;
 static icu::UInitOnce gGenderInitOnce {};
 
 enum GenderStyle {
@@ -49,9 +49,9 @@ enum GenderStyle {
 U_CDECL_BEGIN
 
 static UBool U_CALLCONV gender_cleanup(void) {
-  if (gGenderInfoCache != NULL) {
+  if (gGenderInfoCache != nullptr) {
     uhash_close(gGenderInfoCache);
-    gGenderInfoCache = NULL;
+    gGenderInfoCache = nullptr;
     delete [] gObjs;
   }
   gGenderInitOnce.reset();
@@ -64,19 +64,19 @@ U_NAMESPACE_BEGIN
 
 void U_CALLCONV GenderInfo_initCache(UErrorCode &status) {
   ucln_i18n_registerCleanup(UCLN_I18N_GENDERINFO, gender_cleanup);
-  U_ASSERT(gGenderInfoCache == NULL);
+  U_ASSERT(gGenderInfoCache == nullptr);
   if (U_FAILURE(status)) {
       return;
   }
   gObjs = new GenderInfo[GENDER_STYLE_LENGTH];
-  if (gObjs == NULL) {
+  if (gObjs == nullptr) {
     status = U_MEMORY_ALLOCATION_ERROR;
     return;
   }
   for (int i = 0; i < GENDER_STYLE_LENGTH; i++) {
     gObjs[i]._style = i;
   }
-  gGenderInfoCache = uhash_open(uhash_hashChars, uhash_compareChars, NULL, &status);
+  gGenderInfoCache = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &status);
   if (U_FAILURE(status)) {
     delete [] gObjs;
     return;
@@ -95,11 +95,11 @@ const GenderInfo* GenderInfo::getInstance(const Locale& locale, UErrorCode& stat
   // Make sure our cache exists.
   umtx_initOnce(gGenderInitOnce, &GenderInfo_initCache, status);
   if (U_FAILURE(status)) {
-    return NULL;
+    return nullptr;
   }
 
   static UMutex gGenderMetaLock;
-  const GenderInfo* result = NULL;
+  const GenderInfo* result = nullptr;
   const char* key = locale.getName();
   {
     Mutex lock(&gGenderMetaLock);
@@ -112,7 +112,7 @@ const GenderInfo* GenderInfo::getInstance(const Locale& locale, UErrorCode& stat
   // On cache miss, try to create GenderInfo from CLDR data
   result = loadInstance(locale, status);
   if (U_FAILURE(status)) {
-    return NULL;
+    return nullptr;
   }
 
   // Try to put our GenderInfo object in cache. If there is a race condition,
@@ -125,7 +125,7 @@ const GenderInfo* GenderInfo::getInstance(const Locale& locale, UErrorCode& stat
     } else {
       uhash_put(gGenderInfoCache, uprv_strdup(key), (void*) result, &status);
       if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
       }
     }
   }
@@ -134,30 +134,30 @@ const GenderInfo* GenderInfo::getInstance(const Locale& locale, UErrorCode& stat
 
 const GenderInfo* GenderInfo::loadInstance(const Locale& locale, UErrorCode& status) {
   LocalUResourceBundlePointer rb(
-      ures_openDirect(NULL, "genderList", &status));
+      ures_openDirect(nullptr, "genderList", &status));
   if (U_FAILURE(status)) {
-    return NULL;
+    return nullptr;
   }
-  LocalUResourceBundlePointer locRes(ures_getByKey(rb.getAlias(), "genderList", NULL, &status));
+  LocalUResourceBundlePointer locRes(ures_getByKey(rb.getAlias(), "genderList", nullptr, &status));
   if (U_FAILURE(status)) {
-    return NULL;
+    return nullptr;
   }
   int32_t resLen = 0;
   const char* curLocaleName = locale.getName();
   UErrorCode key_status = U_ZERO_ERROR;
   const UChar* s = ures_getStringByKey(locRes.getAlias(), curLocaleName, &resLen, &key_status);
-  if (s == NULL) {
+  if (s == nullptr) {
     key_status = U_ZERO_ERROR;
     char parentLocaleName[ULOC_FULLNAME_CAPACITY];
     uprv_strcpy(parentLocaleName, curLocaleName);
-    while (s == NULL && uloc_getParent(parentLocaleName, parentLocaleName, ULOC_FULLNAME_CAPACITY, &key_status) > 0) {
+    while (s == nullptr && uloc_getParent(parentLocaleName, parentLocaleName, ULOC_FULLNAME_CAPACITY, &key_status) > 0) {
       key_status = U_ZERO_ERROR;
       resLen = 0;
       s = ures_getStringByKey(locRes.getAlias(), parentLocaleName, &resLen, &key_status);
       key_status = U_ZERO_ERROR;
     }
   }
-  if (s == NULL) {
+  if (s == nullptr) {
     return &gObjs[NEUTRAL];
   }
   char type_str[256] = "";
index 481f410bad7e9bc530ea3e47992effd219e71820..d536a856ad5786eaac8fe74a8bd9ade59ec59941 100644 (file)
@@ -350,7 +350,7 @@ GregorianCalendar::setGregorianChange(UDate date, UErrorCode& status)
     // Normalize the year so BC values are represented as 0 and negative
     // values.
     GregorianCalendar *cal = new GregorianCalendar(getTimeZone(), status);
-    /* test for NULL */
+    /* test for nullptr */
     if (cal == 0) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
index a7027e07a414464d85194825ebcd4cb3dfa238b8..c8b0476143bd40bbadf3a6140de7aedb6e1bf734 100644 (file)
@@ -136,12 +136,12 @@ static const int16_t  LEAP_MONTH_START[][3] = {
     {  383,        384,        385  },          // Elul
 };
 
-static icu::CalendarCache *gCache =  NULL;
+static icu::CalendarCache *gCache =  nullptr;
 
 U_CDECL_BEGIN
 static UBool calendar_hebrew_cleanup(void) {
     delete gCache;
-    gCache = NULL;
+    gCache = nullptr;
     return true;
 }
 U_CDECL_END
index 7c78ad249a4ba69c799b223725abec4d4f1cc2e7..bce9862c0fe5c02f969135d51c152eab7e93e7e9 100644 (file)
@@ -34,7 +34,7 @@ InputText::InputText(UErrorCode &status)
       fRawInput(0),
       fRawLength(0)
 {
-    if (fInputBytes == NULL || fByteStats == NULL) {
+    if (fInputBytes == nullptr || fByteStats == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
     }
 }
@@ -70,7 +70,7 @@ void InputText::setDeclaredEncoding(const char* encoding, int32_t len)
 
 UBool InputText::isSet() const 
 {
-    return fRawInput != NULL;
+    return fRawInput != nullptr;
 }
 
 /**
index 7b4bf96c0418746e0d399d20ea00ce470bc3fb59..09e26637e088a57e95f887f0e61b4e13b712566d 100644 (file)
@@ -54,18 +54,18 @@ static void debug_islamcal_msg(const char *pat, ...)
 
 // --- The cache --
 // cache of months
-static icu::CalendarCache *gMonthCache = NULL;
-static icu::CalendarAstronomer *gIslamicCalendarAstro = NULL;
+static icu::CalendarCache *gMonthCache = nullptr;
+static icu::CalendarAstronomer *gIslamicCalendarAstro = nullptr;
 
 U_CDECL_BEGIN
 static UBool calendar_islamic_cleanup(void) {
     if (gMonthCache) {
         delete gMonthCache;
-        gMonthCache = NULL;
+        gMonthCache = nullptr;
     }
     if (gIslamicCalendarAstro) {
         delete gIslamicCalendarAstro;
-        gIslamicCalendarAstro = NULL;
+        gIslamicCalendarAstro = nullptr;
     }
     return true;
 }
@@ -405,9 +405,9 @@ double IslamicCalendar::moonAge(UDate time, UErrorCode &status)
 
     static UMutex astroLock;      // pod bay door lock
     umtx_lock(&astroLock);
-    if(gIslamicCalendarAstro == NULL) {
+    if(gIslamicCalendarAstro == nullptr) {
         gIslamicCalendarAstro = new CalendarAstronomer();
-        if (gIslamicCalendarAstro == NULL) {
+        if (gIslamicCalendarAstro == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return age;
         }
index 0af7e8bb6f4d728b1be268bd14d26f764b1c2cb4..8ce3172ec4ce669f44152eecb89689ddb5a933fc 100644 (file)
@@ -84,7 +84,7 @@ UBool JapaneseCalendar::enableTentativeEra() {
     }
 #else
     char *envVarVal = getenv(TENTATIVE_ERA_VAR_NAME);
-    if (envVarVal != NULL && uprv_stricmp(envVarVal, "true") == 0) {
+    if (envVarVal != nullptr && uprv_stricmp(envVarVal, "true") == 0) {
         includeTentativeEra = true;
     }
 #endif
index d2b4e7018dce2a2bb3d74b8ec53fb9bab9f0ee4c..98320d3f2b0f524ac97fa19693891324073db95c 100644 (file)
@@ -204,7 +204,7 @@ static UnicodeString loadNumericDateFormatterPattern(
             ures_getByKeyWithFallback(
                 resource,
                 chs.data(),
-                NULL,
+                nullptr,
                 &status));
     if (U_FAILURE(status)) {
         return result;
@@ -226,7 +226,7 @@ static NumericDateFormatters *loadNumericDateFormatters(
         const UResourceBundle *resource,
         UErrorCode &status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     NumericDateFormatters *result = new NumericDateFormatters(
         loadNumericDateFormatterPattern(resource, "hm", status),
@@ -234,7 +234,7 @@ static NumericDateFormatters *loadNumericDateFormatters(
         loadNumericDateFormatterPattern(resource, "hms", status));
     if (U_FAILURE(status)) {
         delete result;
-        return NULL;
+        return nullptr;
     }
     return result;
 }
@@ -248,12 +248,12 @@ const MeasureFormatCacheData *LocaleCacheKey<MeasureFormatCacheData>::createObje
             UNUM_CURRENCY_PLURAL, UNUM_CURRENCY_ISO, UNUM_CURRENCY};
     LocalPointer<MeasureFormatCacheData> result(new MeasureFormatCacheData(), status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     result->adoptNumericDateFormatters(loadNumericDateFormatters(
             unitsBundle.getAlias(), status));
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     for (int32_t i = 0; i < WIDTH_INDEX_COUNT; ++i) {
@@ -266,17 +266,17 @@ const MeasureFormatCacheData *LocaleCacheKey<MeasureFormatCacheData>::createObje
             status = localStatus;
         }
         if (U_FAILURE(status)) {
-            return NULL;
+            return nullptr;
         }
     }
     NumberFormat *inf = NumberFormat::createInstance(
             localeId, UNUM_DECIMAL, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     inf->setMaximumFractionDigits(0);
     DecimalFormat *decfmt = dynamic_cast<DecimalFormat *>(inf);
-    if (decfmt != NULL) {
+    if (decfmt != nullptr) {
         decfmt->setRoundingMode(DecimalFormat::kRoundDown);
     }
     result->adoptIntegerFormat(inf);
@@ -352,12 +352,12 @@ static int32_t toHMS(
 
 MeasureFormat::MeasureFormat(
         const Locale &locale, UMeasureFormatWidth w, UErrorCode &status)
-        : cache(NULL),
-          numberFormat(NULL),
-          pluralRules(NULL),
+        : cache(nullptr),
+          numberFormat(nullptr),
+          pluralRules(nullptr),
           fWidth(w),
-          listFormatter(NULL) {
-    initMeasureFormat(locale, w, NULL, status);
+          listFormatter(nullptr) {
+    initMeasureFormat(locale, w, nullptr, status);
 }
 
 MeasureFormat::MeasureFormat(
@@ -365,11 +365,11 @@ MeasureFormat::MeasureFormat(
         UMeasureFormatWidth w,
         NumberFormat *nfToAdopt,
         UErrorCode &status) 
-        : cache(NULL),
-          numberFormat(NULL),
-          pluralRules(NULL),
+        : cache(nullptr),
+          numberFormat(nullptr),
+          pluralRules(nullptr),
           fWidth(w),
-          listFormatter(NULL) {
+          listFormatter(nullptr) {
     initMeasureFormat(locale, w, nfToAdopt, status);
 }
 
@@ -379,11 +379,11 @@ MeasureFormat::MeasureFormat(const MeasureFormat &other) :
         numberFormat(other.numberFormat),
         pluralRules(other.pluralRules),
         fWidth(other.fWidth),
-        listFormatter(NULL) {
+        listFormatter(nullptr) {
     cache->addRef();
     numberFormat->addRef();
     pluralRules->addRef();
-    if (other.listFormatter != NULL) {
+    if (other.listFormatter != nullptr) {
         listFormatter = new ListFormatter(*other.listFormatter);
     }
 }
@@ -398,30 +398,30 @@ MeasureFormat &MeasureFormat::operator=(const MeasureFormat &other) {
     SharedObject::copyPtr(other.pluralRules, pluralRules);
     fWidth = other.fWidth;
     delete listFormatter;
-    if (other.listFormatter != NULL) {
+    if (other.listFormatter != nullptr) {
         listFormatter = new ListFormatter(*other.listFormatter);
     } else {
-        listFormatter = NULL;
+        listFormatter = nullptr;
     }
     return *this;
 }
 
 MeasureFormat::MeasureFormat() :
-        cache(NULL),
-        numberFormat(NULL),
-        pluralRules(NULL),
+        cache(nullptr),
+        numberFormat(nullptr),
+        pluralRules(nullptr),
         fWidth(UMEASFMT_WIDTH_SHORT),
-        listFormatter(NULL) {
+        listFormatter(nullptr) {
 }
 
 MeasureFormat::~MeasureFormat() {
-    if (cache != NULL) {
+    if (cache != nullptr) {
         cache->removeRef();
     }
-    if (numberFormat != NULL) {
+    if (numberFormat != nullptr) {
         numberFormat->removeRef();
     }
-    if (pluralRules != NULL) {
+    if (pluralRules != nullptr) {
         pluralRules->removeRef();
     }
     delete listFormatter;
@@ -476,7 +476,7 @@ UnicodeString &MeasureFormat::format(
     if (obj.getType() == Formattable::kObject) {
         const UObject* formatObj = obj.getObject();
         const Measure* amount = dynamic_cast<const Measure*>(formatObj);
-        if (amount != NULL) {
+        if (amount != nullptr) {
             return formatMeasure(
                     *amount, **numberFormat, appendTo, pos, status);
         }
@@ -547,7 +547,7 @@ UnicodeString &MeasureFormat::formatMeasures(
                 measures, measureCount, appendTo, pos, status);
     }
     UnicodeString *results = new UnicodeString[measureCount];
-    if (results == NULL) {
+    if (results == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return appendTo;
     }
@@ -635,7 +635,7 @@ void MeasureFormat::adoptNumberFormat(
         return;
     }
     SharedNumberFormat *shared = new SharedNumberFormat(nf.getAlias());
-    if (shared == NULL) {
+    if (shared == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -647,7 +647,7 @@ UBool MeasureFormat::setMeasureFormatLocale(const Locale &locale, UErrorCode &st
     if (U_FAILURE(status) || locale == getLocale(status)) {
         return false;
     }
-    initMeasureFormat(locale, fWidth, NULL, status);
+    initMeasureFormat(locale, fWidth, nullptr, status);
     return U_SUCCESS(status);
 } 
 
index f53137c48cd301fa31782b9e957c0fd416359601..ed7bf80953203f91dfd882a3edb991a45c866ddc 100644 (file)
@@ -2277,13 +2277,13 @@ StringEnumeration* MeasureUnit::getAvailableTypes(UErrorCode &errorCode) {
             gTypes, UPRV_LENGTHOF(gTypes), &errorCode);
     if (U_FAILURE(errorCode)) {
         uenum_close(uenum);
-        return NULL;
+        return nullptr;
     }
     StringEnumeration *result = new UStringEnumeration(uenum);
-    if (result == NULL) {
+    if (result == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         uenum_close(uenum);
-        return NULL;
+        return nullptr;
     }
     return result;
 }
@@ -2309,10 +2309,10 @@ bool MeasureUnit::findBySubType(StringPiece subType, MeasureUnit* output) {
 
 MeasureUnit *MeasureUnit::create(int typeId, int subTypeId, UErrorCode &status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     MeasureUnit *result = new MeasureUnit(typeId, subTypeId);
-    if (result == NULL) {
+    if (result == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
     }
     return result;
index 3d49d1d610a2bcfc36ef46fdf87d865158ab3e68..cfd9c759856c2d3eb5ac5626688a703738bd37bc 100644 (file)
@@ -148,7 +148,7 @@ const struct UnitPrefixStrings {
  *     int32_t *unitCategories[ARR_SIZE];
  *     SimpleUnitIdentifiersSink identifierSink(gSerializedUnitCategoriesTrie, unitIdentifiers,
  *                                              unitCategories, ARR_SIZE, b, kTrieValueOffset);
- *     LocalUResourceBundlePointer unitsBundle(ures_openDirect(NULL, "units", &status));
+ *     LocalUResourceBundlePointer unitsBundle(ures_openDirect(nullptr, "units", &status));
  *     ures_getAllItemsWithFallback(unitsBundle.getAlias(), "convertUnits", identifierSink, status);
  */
 class SimpleUnitIdentifiersSink : public icu::ResourceSink {
index b9c47fd401596d13fb36629eb617f20cee58bc1b..cdbd995034aacf0ac165fec79155faf21971eb70 100644 (file)
@@ -69,8 +69,8 @@ bool Measure::operator==(const UObject& other) const {
     }
     const Measure &m = static_cast<const Measure&>(other);
     return number == m.number &&
-        ((unit == NULL) == (m.unit == NULL)) &&
-        (unit == NULL || *unit == *m.unit);
+        ((unit == nullptr) == (m.unit == nullptr)) &&
+        (unit == nullptr || *unit == *m.unit);
 }
 
 U_NAMESPACE_END
index 29476f328f8077529917ef56d3d4db0b1de1cc46..95395e7dabbf67fe766182eda794a9c290b6e835 100644 (file)
@@ -90,7 +90,7 @@ static const UChar * const TYPE_IDS[] = {
     ID_SPELLOUT,
     ID_ORDINAL,
     ID_DURATION,
-    NULL,
+    nullptr,
 };
 
 static const UChar ID_EMPTY[]     = {
@@ -112,7 +112,7 @@ static const UChar * const NUMBER_STYLE_IDS[] = {
     ID_CURRENCY,
     ID_PERCENT,
     ID_INTEGER,
-    NULL,
+    nullptr,
 };
 
 static const UChar ID_SHORT[]     = {
@@ -135,7 +135,7 @@ static const UChar * const DATE_STYLE_IDS[] = {
     ID_MEDIUM,
     ID_LONG,
     ID_FULL,
-    NULL,
+    nullptr,
 };
 
 static const icu::DateFormat::EStyle DATE_STYLES[] = {
@@ -234,16 +234,16 @@ MessageFormat::MessageFormat(const UnicodeString& pattern,
                              UErrorCode& success)
 : fLocale(Locale::getDefault()),  // Uses the default locale
   msgPattern(success),
-  formatAliases(NULL),
+  formatAliases(nullptr),
   formatAliasesCapacity(0),
-  argTypes(NULL),
+  argTypes(nullptr),
   argTypeCount(0),
   argTypeCapacity(0),
   hasArgTypeConflicts(false),
-  defaultNumberFormat(NULL),
-  defaultDateFormat(NULL),
-  cachedFormatters(NULL),
-  customFormatArgStarts(NULL),
+  defaultNumberFormat(nullptr),
+  defaultDateFormat(nullptr),
+  cachedFormatters(nullptr),
+  customFormatArgStarts(nullptr),
   pluralProvider(*this, UPLURAL_TYPE_CARDINAL),
   ordinalProvider(*this, UPLURAL_TYPE_ORDINAL)
 {
@@ -256,16 +256,16 @@ MessageFormat::MessageFormat(const UnicodeString& pattern,
                              UErrorCode& success)
 : fLocale(newLocale),
   msgPattern(success),
-  formatAliases(NULL),
+  formatAliases(nullptr),
   formatAliasesCapacity(0),
-  argTypes(NULL),
+  argTypes(nullptr),
   argTypeCount(0),
   argTypeCapacity(0),
   hasArgTypeConflicts(false),
-  defaultNumberFormat(NULL),
-  defaultDateFormat(NULL),
-  cachedFormatters(NULL),
-  customFormatArgStarts(NULL),
+  defaultNumberFormat(nullptr),
+  defaultDateFormat(nullptr),
+  cachedFormatters(nullptr),
+  customFormatArgStarts(nullptr),
   pluralProvider(*this, UPLURAL_TYPE_CARDINAL),
   ordinalProvider(*this, UPLURAL_TYPE_ORDINAL)
 {
@@ -279,16 +279,16 @@ MessageFormat::MessageFormat(const UnicodeString& pattern,
                              UErrorCode& success)
 : fLocale(newLocale),
   msgPattern(success),
-  formatAliases(NULL),
+  formatAliases(nullptr),
   formatAliasesCapacity(0),
-  argTypes(NULL),
+  argTypes(nullptr),
   argTypeCount(0),
   argTypeCapacity(0),
   hasArgTypeConflicts(false),
-  defaultNumberFormat(NULL),
-  defaultDateFormat(NULL),
-  cachedFormatters(NULL),
-  customFormatArgStarts(NULL),
+  defaultNumberFormat(nullptr),
+  defaultDateFormat(nullptr),
+  cachedFormatters(nullptr),
+  customFormatArgStarts(nullptr),
   pluralProvider(*this, UPLURAL_TYPE_CARDINAL),
   ordinalProvider(*this, UPLURAL_TYPE_ORDINAL)
 {
@@ -301,20 +301,20 @@ MessageFormat::MessageFormat(const MessageFormat& that)
   Format(that),
   fLocale(that.fLocale),
   msgPattern(that.msgPattern),
-  formatAliases(NULL),
+  formatAliases(nullptr),
   formatAliasesCapacity(0),
-  argTypes(NULL),
+  argTypes(nullptr),
   argTypeCount(0),
   argTypeCapacity(0),
   hasArgTypeConflicts(that.hasArgTypeConflicts),
-  defaultNumberFormat(NULL),
-  defaultDateFormat(NULL),
-  cachedFormatters(NULL),
-  customFormatArgStarts(NULL),
+  defaultNumberFormat(nullptr),
+  defaultDateFormat(nullptr),
+  cachedFormatters(nullptr),
+  customFormatArgStarts(nullptr),
   pluralProvider(*this, UPLURAL_TYPE_CARDINAL),
   ordinalProvider(*this, UPLURAL_TYPE_ORDINAL)
 {
-    // This will take care of creating the hash tables (since they are NULL).
+    // This will take care of creating the hash tables (since they are nullptr).
     UErrorCode ec = U_ZERO_ERROR;
     copyObjects(that, ec);
     if (U_FAILURE(ec)) {
@@ -340,7 +340,7 @@ MessageFormat::~MessageFormat()
  * Allocate argTypes[] to at least the given capacity and return
  * true if successful.  If not, leave argTypes[] unchanged.
  *
- * If argTypes is NULL, allocate it.  If it is not NULL, enlarge it
+ * If argTypes is nullptr, allocate it.  If it is not nullptr, enlarge it
  * if necessary to be at least as large as specified.
  */
 UBool MessageFormat::allocateArgTypes(int32_t capacity, UErrorCode& status) {
@@ -357,7 +357,7 @@ UBool MessageFormat::allocateArgTypes(int32_t capacity, UErrorCode& status) {
     }
     Formattable::Type* a = (Formattable::Type*)
             uprv_realloc(argTypes, sizeof(*argTypes) * capacity);
-    if (a == NULL) {
+    if (a == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return false;
     }
@@ -404,10 +404,10 @@ MessageFormat::operator==(const Format& rhs) const
     }
 
     // Compare hashtables.
-    if ((customFormatArgStarts == NULL) != (that.customFormatArgStarts == NULL)) {
+    if ((customFormatArgStarts == nullptr) != (that.customFormatArgStarts == nullptr)) {
         return false;
     }
-    if (customFormatArgStarts == NULL) {
+    if (customFormatArgStarts == nullptr) {
         return true;
     }
 
@@ -450,9 +450,9 @@ MessageFormat::setLocale(const Locale& theLocale)
 {
     if (fLocale != theLocale) {
         delete defaultNumberFormat;
-        defaultNumberFormat = NULL;
+        defaultNumberFormat = nullptr;
         delete defaultDateFormat;
-        defaultDateFormat = NULL;
+        defaultDateFormat = nullptr;
         fLocale = theLocale;
         setLocaleIDs(fLocale.getName(), fLocale.getName());
         pluralProvider.reset();
@@ -500,9 +500,9 @@ MessageFormat::applyPattern(const UnicodeString& pattern,
 void MessageFormat::resetPattern() {
     msgPattern.clear();
     uhash_close(cachedFormatters);
-    cachedFormatters = NULL;
+    cachedFormatters = nullptr;
     uhash_close(customFormatArgStarts);
-    customFormatArgStarts = NULL;
+    customFormatArgStarts = nullptr;
     argTypeCount = 0;
     hasArgTypeConflicts = false;
 }
@@ -523,7 +523,7 @@ MessageFormat::applyPattern(const UnicodeString& pattern,
 
 UnicodeString&
 MessageFormat::toPattern(UnicodeString& appendTo) const {
-    if ((customFormatArgStarts != NULL && 0 != uhash_count(customFormatArgStarts)) ||
+    if ((customFormatArgStarts != nullptr && 0 != uhash_count(customFormatArgStarts)) ||
         0 == msgPattern.countParts()
     ) {
         appendTo.setToBogus();
@@ -554,7 +554,7 @@ void MessageFormat::setArgStartFormat(int32_t argStart,
         delete formatter;
         return;
     }
-    if (cachedFormatters == NULL) {
+    if (cachedFormatters == nullptr) {
         cachedFormatters=uhash_open(uhash_hashLong, uhash_compareLong,
                                     equalFormatsForHash, &status);
         if (U_FAILURE(status)) {
@@ -563,7 +563,7 @@ void MessageFormat::setArgStartFormat(int32_t argStart,
         }
         uhash_setValueDeleter(cachedFormatters, uprv_deleteUObject);
     }
-    if (formatter == NULL) {
+    if (formatter == nullptr) {
         formatter = new DummyFormat();
     }
     uhash_iput(cachedFormatters, argStart, formatter, &status);
@@ -583,23 +583,23 @@ void MessageFormat::setCustomArgStartFormat(int32_t argStart,
                                             Format* formatter,
                                             UErrorCode& status) {
     setArgStartFormat(argStart, formatter, status);
-    if (customFormatArgStarts == NULL) {
+    if (customFormatArgStarts == nullptr) {
         customFormatArgStarts=uhash_open(uhash_hashLong, uhash_compareLong,
-                                         NULL, &status);
+                                         nullptr, &status);
     }
     uhash_iputi(customFormatArgStarts, argStart, 1, &status);
 }
 
 Format* MessageFormat::getCachedFormatter(int32_t argumentNumber) const {
-    if (cachedFormatters == NULL) {
-        return NULL;
+    if (cachedFormatters == nullptr) {
+        return nullptr;
     }
     void* ptr = uhash_iget(cachedFormatters, argumentNumber);
-    if (ptr != NULL && dynamic_cast<DummyFormat*>((Format*)ptr) == NULL) {
+    if (ptr != nullptr && dynamic_cast<DummyFormat*>((Format*)ptr) == nullptr) {
         return (Format*) ptr;
     } else {
-        // Not cached, or a DummyFormat representing setFormat(NULL).
-        return NULL;
+        // Not cached, or a DummyFormat representing setFormat(nullptr).
+        return nullptr;
     }
 }
 
@@ -609,14 +609,14 @@ Format* MessageFormat::getCachedFormatter(int32_t argumentNumber) const {
 void
 MessageFormat::adoptFormats(Format** newFormats,
                             int32_t count) {
-    if (newFormats == NULL || count < 0) {
+    if (newFormats == nullptr || count < 0) {
         return;
     }
     // Throw away any cached formatters.
-    if (cachedFormatters != NULL) {
+    if (cachedFormatters != nullptr) {
         uhash_removeAll(cachedFormatters);
     }
-    if (customFormatArgStarts != NULL) {
+    if (customFormatArgStarts != nullptr) {
         uhash_removeAll(customFormatArgStarts);
     }
 
@@ -642,14 +642,14 @@ MessageFormat::adoptFormats(Format** newFormats,
 void
 MessageFormat::setFormats(const Format** newFormats,
                           int32_t count) {
-    if (newFormats == NULL || count < 0) {
+    if (newFormats == nullptr || count < 0) {
         return;
     }
     // Throw away any cached formatters.
-    if (cachedFormatters != NULL) {
+    if (cachedFormatters != nullptr) {
         uhash_removeAll(cachedFormatters);
     }
-    if (customFormatArgStarts != NULL) {
+    if (customFormatArgStarts != nullptr) {
         uhash_removeAll(customFormatArgStarts);
     }
 
@@ -657,10 +657,10 @@ MessageFormat::setFormats(const Format** newFormats,
     int32_t formatNumber = 0;
     for (int32_t partIndex = 0;
         formatNumber < count && U_SUCCESS(status) && (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) {
-      Format* newFormat = NULL;
-      if (newFormats[formatNumber] != NULL) {
+      Format* newFormat = nullptr;
+      if (newFormats[formatNumber] != nullptr) {
           newFormat = newFormats[formatNumber]->clone();
-          if (newFormat == NULL) {
+          if (newFormat == nullptr) {
               status = U_MEMORY_ALLOCATION_ERROR;
           }
       }
@@ -715,11 +715,11 @@ MessageFormat::adoptFormat(const UnicodeString& formatName,
             Format* f;
             if (p.isValid()) {
                 f = p.orphan();
-            } else if (formatToAdopt == NULL) {
-                f = NULL;
+            } else if (formatToAdopt == nullptr) {
+                f = nullptr;
             } else {
                 f = formatToAdopt->clone();
-                if (f == NULL) {
+                if (f == nullptr) {
                     status = U_MEMORY_ALLOCATION_ERROR;
                     return;
                 }
@@ -757,19 +757,19 @@ MessageFormat::setFormat(int32_t n, const Format& newFormat) {
 // Do nothing if the variable is not less than the array count.
 Format *
 MessageFormat::getFormat(const UnicodeString& formatName, UErrorCode& status) {
-    if (U_FAILURE(status) || cachedFormatters == NULL) return NULL;
+    if (U_FAILURE(status) || cachedFormatters == nullptr) return nullptr;
 
     int32_t argNumber = MessagePattern::validateArgumentName(formatName);
     if (argNumber < UMSGPAT_ARG_NAME_NOT_NUMBER) {
         status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     for (int32_t partIndex = 0; (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) {
         if (argNameMatches(partIndex + 1, formatName, argNumber)) {
             return getCachedFormatter(partIndex);
         }
     }
-    return NULL;
+    return nullptr;
 }
 
 // -------------------------------------
@@ -791,7 +791,7 @@ MessageFormat::setFormat(const UnicodeString& formatName,
     ) {
         if (argNameMatches(partIndex + 1, formatName, argNumber)) {
             Format* new_format = newFormat.clone();
-            if (new_format == NULL) {
+            if (new_format == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 return;
             }
@@ -852,7 +852,7 @@ UnicodeString MessageFormat::getArgName(int32_t partIndex) {
 
 StringEnumeration*
 MessageFormat::getFormatNames(UErrorCode& status) {
-    if (U_FAILURE(status))  return NULL;
+    if (U_FAILURE(status))  return nullptr;
 
     LocalPointer<UVector> formatNames(new UVector(status), status);
     if (U_FAILURE(status)) {
@@ -882,7 +882,7 @@ MessageFormat::format(const Formattable* source,
                       FieldPosition& ignore,
                       UErrorCode& success) const
 {
-    return format(source, NULL, cnt, appendTo, &ignore, success);
+    return format(source, nullptr, cnt, appendTo, &ignore, success);
 }
 
 // -------------------------------------
@@ -898,7 +898,7 @@ MessageFormat::format(  const UnicodeString& pattern,
                         UErrorCode& success)
 {
     MessageFormat temp(pattern, success);
-    return temp.format(arguments, NULL, cnt, appendTo, NULL, success);
+    return temp.format(arguments, nullptr, cnt, appendTo, nullptr, success);
 }
 
 // -------------------------------------
@@ -920,7 +920,7 @@ MessageFormat::format(const Formattable& source,
     }
     int32_t cnt;
     const Formattable* tmpPtr = source.getArray(cnt);
-    return format(tmpPtr, NULL, cnt, appendTo, &ignore, success);
+    return format(tmpPtr, nullptr, cnt, appendTo, &ignore, success);
 }
 
 UnicodeString&
@@ -929,7 +929,7 @@ MessageFormat::format(const UnicodeString* argumentNames,
                       int32_t count,
                       UnicodeString& appendTo,
                       UErrorCode& success) const {
-    return format(arguments, argumentNames, count, appendTo, NULL, success);
+    return format(arguments, argumentNames, count, appendTo, nullptr, success);
 }
 
 // Does linear search to find the match for an ArgName.
@@ -941,7 +941,7 @@ const Formattable* MessageFormat::getArgFromListByName(const Formattable* argume
             return arguments + i;
         }
     }
-    return NULL;
+    return nullptr;
 }
 
 
@@ -958,7 +958,7 @@ MessageFormat::format(const Formattable* arguments,
 
     UnicodeStringAppendable usapp(appendTo);
     AppendableWrapper app(usapp);
-    format(0, NULL, arguments, argumentNames, cnt, app, pos, status);
+    format(0, nullptr, arguments, argumentNames, cnt, app, pos, status);
     return appendTo;
 }
 
@@ -973,7 +973,7 @@ public:
     PluralSelectorContext(int32_t start, const UnicodeString &name,
                           const Formattable &num, double off, UErrorCode &errorCode)
             : startIndex(start), argName(name), offset(off),
-              numberArgIndex(-1), formatter(NULL), forReplaceNumber(false) {
+              numberArgIndex(-1), formatter(nullptr), forReplaceNumber(false) {
         // number needs to be set even when select() is not called.
         // Keep it as a Number/Formattable:
         // For format() methods, and to preserve information (e.g., BigDecimal).
@@ -1002,8 +1002,8 @@ public:
 
 }  // namespace
 
-// if argumentNames is NULL, this means arguments is a numeric array.
-// arguments can not be NULL.
+// if argumentNames is nullptr, this means arguments is a numeric array.
+// arguments can not be nullptr.
 // We use const void *plNumber rather than const PluralSelectorContext *pluralNumber
 // so that we need not declare the PluralSelectorContext in the public header file.
 void MessageFormat::format(int32_t msgStart, const void *plNumber,
@@ -1050,29 +1050,29 @@ void MessageFormat::format(int32_t msgStart, const void *plNumber,
         const Formattable* arg;
         UBool noArg = false;
         UnicodeString argName = msgPattern.getSubstring(*part);
-        if (argumentNames == NULL) {
+        if (argumentNames == nullptr) {
             int32_t argNumber = part->getValue();  // ARG_NUMBER
             if (0 <= argNumber && argNumber < cnt) {
                 arg = arguments + argNumber;
             } else {
-                arg = NULL;
+                arg = nullptr;
                 noArg = true;
             }
         } else {
             arg = getArgFromListByName(arguments, argumentNames, cnt, argName);
-            if (arg == NULL) {
+            if (arg == nullptr) {
                 noArg = true;
             }
         }
         ++i;
         int32_t prevDestLength = appendTo.length();
-        const Format* formatter = NULL;
+        const Format* formatter = nullptr;
         if (noArg) {
             appendTo.append(
                 UnicodeString(LEFT_CURLY_BRACE).append(argName).append(RIGHT_CURLY_BRACE));
-        } else if (arg == NULL) {
+        } else if (arg == nullptr) {
             appendTo.append(NULL_STRING, 4);
-        } else if(plNumber!=NULL &&
+        } else if(plNumber!=nullptr &&
                 static_cast<const PluralSelectorContext *>(plNumber)->numberArgIndex==(i-2)) {
             const PluralSelectorContext &pluralNumber =
                 *static_cast<const PluralSelectorContext *>(plNumber);
@@ -1099,7 +1099,7 @@ void MessageFormat::format(int32_t msgStart, const void *plNumber,
                     (subMsgString.indexOf(SINGLE_QUOTE) >= 0 && !MessageImpl::jdkAposMode(msgPattern))
                 ) {
                     MessageFormat subMsgFormat(subMsgString, fLocale, success);
-                    subMsgFormat.format(0, NULL, arguments, argumentNames, cnt, appendTo, ignore, success);
+                    subMsgFormat.format(0, nullptr, arguments, argumentNames, cnt, appendTo, ignore, success);
                 } else {
                     appendTo.append(subMsgString);
                 }
@@ -1107,7 +1107,7 @@ void MessageFormat::format(int32_t msgStart, const void *plNumber,
                 appendTo.formatAndAppend(formatter, *arg, success);
             }
         } else if (argType == UMSGPAT_ARG_TYPE_NONE || (cachedFormatters && uhash_iget(cachedFormatters, i - 2))) {
-            // We arrive here if getCachedFormatter returned NULL, but there was actually an element in the hash table.
+            // We arrive here if getCachedFormatter returned nullptr, but there was actually an element in the hash table.
             // This can only happen if the hash table contained a DummyFormat, so the if statement above is a check
             // for the hash table containing DummyFormat.
             if (arg->isNumeric()) {
@@ -1128,7 +1128,7 @@ void MessageFormat::format(int32_t msgStart, const void *plNumber,
             // because only this one converts non-double numeric types to double.
             const double number = arg->getDouble(success);
             int32_t subMsgStart = ChoiceFormat::findSubMessage(msgPattern, i, number);
-            formatComplexSubMessage(subMsgStart, NULL, arguments, argumentNames,
+            formatComplexSubMessage(subMsgStart, nullptr, arguments, argumentNames,
                                     cnt, appendTo, success);
         } else if (UMSGPAT_ARG_TYPE_HAS_PLURAL_STYLE(argType)) {
             if (!arg->isNumeric()) {
@@ -1147,7 +1147,7 @@ void MessageFormat::format(int32_t msgStart, const void *plNumber,
                                     cnt, appendTo, success);
         } else if (argType == UMSGPAT_ARG_TYPE_SELECT) {
             int32_t subMsgStart = SelectFormat::findSubMessage(msgPattern, i, arg->getString(success), success);
-            formatComplexSubMessage(subMsgStart, NULL, arguments, argumentNames,
+            formatComplexSubMessage(subMsgStart, nullptr, arguments, argumentNames,
                                     cnt, appendTo, success);
         } else {
             // This should never happen.
@@ -1173,7 +1173,7 @@ void MessageFormat::formatComplexSubMessage(int32_t msgStart,
     }
 
     if (!MessageImpl::jdkAposMode(msgPattern)) {
-        format(msgStart, plNumber, arguments, argumentNames, cnt, appendTo, NULL, success);
+        format(msgStart, plNumber, arguments, argumentNames, cnt, appendTo, nullptr, success);
         return;
     }
 
@@ -1218,8 +1218,8 @@ void MessageFormat::formatComplexSubMessage(int32_t msgStart,
     if (sb.indexOf(LEFT_CURLY_BRACE) >= 0) {
         UnicodeString emptyPattern;  // gcc 3.3.3 fails with "UnicodeString()" as the first parameter.
         MessageFormat subMsgFormat(emptyPattern, fLocale, success);
-        subMsgFormat.applyPattern(sb, UMSGPAT_APOS_DOUBLE_REQUIRED, NULL, success);
-        subMsgFormat.format(0, NULL, arguments, argumentNames, cnt, appendTo, NULL, success);
+        subMsgFormat.applyPattern(sb, UMSGPAT_APOS_DOUBLE_REQUIRED, nullptr, success);
+        subMsgFormat.format(0, nullptr, arguments, argumentNames, cnt, appendTo, nullptr, success);
     } else {
         appendTo.append(sb);
     }
@@ -1248,12 +1248,12 @@ UnicodeString MessageFormat::getLiteralStringUntilNextArgument(int32_t from) con
 FieldPosition* MessageFormat::updateMetaData(AppendableWrapper& /*dest*/, int32_t /*prevLength*/,
                              FieldPosition* /*fp*/, const Formattable* /*argId*/) const {
     // Unlike in Java, there are no field attributes defined for MessageFormat. Do nothing.
-    return NULL;
+    return nullptr;
     /*
-      if (fp != NULL && Field.ARGUMENT.equals(fp.getFieldAttribute())) {
+      if (fp != nullptr && Field.ARGUMENT.equals(fp.getFieldAttribute())) {
           fp->setBeginIndex(prevLength);
           fp->setEndIndex(dest.get_length());
-          return NULL;
+          return nullptr;
       }
       return fp;
     */
@@ -1325,14 +1325,14 @@ void MessageFormat::copyObjects(const MessageFormat& that, UErrorCode& ec) {
         }
         uprv_memcpy(argTypes, that.argTypes, argTypeCount * sizeof(argTypes[0]));
     }
-    if (cachedFormatters != NULL) {
+    if (cachedFormatters != nullptr) {
         uhash_removeAll(cachedFormatters);
     }
-    if (customFormatArgStarts != NULL) {
+    if (customFormatArgStarts != nullptr) {
         uhash_removeAll(customFormatArgStarts);
     }
     if (that.cachedFormatters) {
-        if (cachedFormatters == NULL) {
+        if (cachedFormatters == nullptr) {
             cachedFormatters=uhash_open(uhash_hashLong, uhash_compareLong,
                                         equalFormatsForHash, &ec);
             if (U_FAILURE(ec)) {
@@ -1355,9 +1355,9 @@ void MessageFormat::copyObjects(const MessageFormat& that, UErrorCode& ec) {
         }
     }
     if (that.customFormatArgStarts) {
-        if (customFormatArgStarts == NULL) {
+        if (customFormatArgStarts == nullptr) {
             customFormatArgStarts=uhash_open(uhash_hashLong, uhash_compareLong,
-                                              NULL, &ec);
+                                              nullptr, &ec);
         }
         const int32_t count = uhash_count(that.customFormatArgStarts);
         int32_t pos, idx;
@@ -1378,13 +1378,13 @@ MessageFormat::parse(int32_t msgStart,
     count = 0;
     if (U_FAILURE(ec)) {
         pos.setErrorIndex(pos.getIndex());
-        return NULL;
+        return nullptr;
     }
     // parse() does not work with named arguments.
     if (msgPattern.hasNamedArguments()) {
         ec = U_ARGUMENT_TYPE_MISMATCH;
         pos.setErrorIndex(pos.getIndex());
-        return NULL;
+        return nullptr;
     }
     LocalArray<Formattable> resultArray(new Formattable[argTypeCount ? argTypeCount : 1]);
     const UnicodeString& msgString=msgPattern.getPatternString();
@@ -1404,7 +1404,7 @@ MessageFormat::parse(int32_t msgStart,
             prevIndex += len;
         } else {
             pos.setErrorIndex(sourceOffset);
-            return NULL; // leave index as is to signal error
+            return nullptr; // leave index as is to signal error
         }
         if(type==UMSGPAT_PART_TYPE_MSG_LIMIT) {
             // Things went well! Done.
@@ -1425,22 +1425,22 @@ MessageFormat::parse(int32_t msgStart,
         int32_t argNumber = part->getValue();  // ARG_NUMBER
         UnicodeString key;
         ++i;
-        const Format* formatter = NULL;
+        const Format* formatter = nullptr;
         Formattable& argResult = resultArray[argNumber];
 
-        if(cachedFormatters!=NULL && (formatter = getCachedFormatter(i - 2))!=NULL) {
+        if(cachedFormatters!=nullptr && (formatter = getCachedFormatter(i - 2))!=nullptr) {
             // Just parse using the formatter.
             tempStatus.setIndex(sourceOffset);
             formatter->parseObject(source, argResult, tempStatus);
             if (tempStatus.getIndex() == sourceOffset) {
                 pos.setErrorIndex(sourceOffset);
-                return NULL; // leave index as is to signal error
+                return nullptr; // leave index as is to signal error
             }
             sourceOffset = tempStatus.getIndex();
             haveArgResult = true;
         } else if(
             argType==UMSGPAT_ARG_TYPE_NONE || (cachedFormatters && uhash_iget(cachedFormatters, i -2))) {
-            // We arrive here if getCachedFormatter returned NULL, but there was actually an element in the hash table.
+            // We arrive here if getCachedFormatter returned nullptr, but there was actually an element in the hash table.
             // This can only happen if the hash table contained a DummyFormat, so the if statement above is a check
             // for the hash table containing DummyFormat.
 
@@ -1457,7 +1457,7 @@ MessageFormat::parse(int32_t msgStart,
             }
             if (next < 0) {
                 pos.setErrorIndex(sourceOffset);
-                return NULL; // leave index as is to signal error
+                return nullptr; // leave index as is to signal error
             } else {
                 UnicodeString strValue(source.tempSubString(sourceOffset, next - sourceOffset));
                 UnicodeString compValue;
@@ -1475,7 +1475,7 @@ MessageFormat::parse(int32_t msgStart,
             double choiceResult = ChoiceFormat::parseArgument(msgPattern, i, source, tempStatus);
             if (tempStatus.getIndex() == sourceOffset) {
                 pos.setErrorIndex(sourceOffset);
-                return NULL; // leave index as is to signal error
+                return nullptr; // leave index as is to signal error
             }
             argResult.setDouble(choiceResult);
             haveArgResult = true;
@@ -1483,11 +1483,11 @@ MessageFormat::parse(int32_t msgStart,
         } else if(UMSGPAT_ARG_TYPE_HAS_PLURAL_STYLE(argType) || argType==UMSGPAT_ARG_TYPE_SELECT) {
             // Parsing not supported.
             ec = U_UNSUPPORTED_ERROR;
-            return NULL;
+            return nullptr;
         } else {
             // This should never happen.
             ec = U_INTERNAL_PROGRAM_ERROR;
-            return NULL;
+            return nullptr;
         }
         if (haveArgResult && count <= argNumber) {
             count = argNumber + 1;
@@ -1521,7 +1521,7 @@ MessageFormat::parse(const UnicodeString& source,
 {
     if (msgPattern.hasNamedArguments()) {
         success = U_ARGUMENT_TYPE_MISMATCH;
-        return NULL;
+        return nullptr;
     }
     ParsePosition status(0);
     // Calls the actual implementation method and starts
@@ -1530,7 +1530,7 @@ MessageFormat::parse(const UnicodeString& source,
     if (status.getIndex() == 0) {
         success = U_MESSAGE_PARSE_ERROR;
         delete[] result;
-        return NULL;
+        return nullptr;
     }
     return result;
 }
@@ -1545,7 +1545,7 @@ MessageFormat::parseObject( const UnicodeString& source,
 {
     int32_t cnt = 0;
     Formattable* tmpResult = parse(source, status, cnt);
-    if (tmpResult != NULL)
+    if (tmpResult != nullptr)
         result.adoptArray(tmpResult, cnt);
 }
 
@@ -1557,7 +1557,7 @@ MessageFormat::autoQuoteApostrophe(const UnicodeString& pattern, UErrorCode& sta
         const UChar* pat = pattern.getBuffer();
         int32_t blen = plen * 2 + 1; // space for null termination, convenience
         UChar* buf = result.getBuffer(blen);
-        if (buf == NULL) {
+        if (buf == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
         } else {
             int32_t len = umsg_autoQuoteApostrophe(pat, plen, buf, blen, &status);
@@ -1574,7 +1574,7 @@ MessageFormat::autoQuoteApostrophe(const UnicodeString& pattern, UErrorCode& sta
 
 static Format* makeRBNF(URBNFRuleSetTag tag, const Locale& locale, const UnicodeString& defaultRuleSet, UErrorCode& ec) {
     RuleBasedNumberFormat* fmt = new RuleBasedNumberFormat(tag, locale, ec);
-    if (fmt == NULL) {
+    if (fmt == nullptr) {
         ec = U_MEMORY_ALLOCATION_ERROR;
     } else if (U_SUCCESS(ec) && defaultRuleSet.length() > 0) {
         UErrorCode localStatus = U_ZERO_ERROR; // ignore unrecognized default rule set
@@ -1588,10 +1588,10 @@ void MessageFormat::cacheExplicitFormats(UErrorCode& status) {
         return;
     }
 
-    if (cachedFormatters != NULL) {
+    if (cachedFormatters != nullptr) {
         uhash_removeAll(cachedFormatters);
     }
-    if (customFormatArgStarts != NULL) {
+    if (customFormatArgStarts != nullptr) {
         uhash_removeAll(customFormatArgStarts);
     }
 
@@ -1684,9 +1684,9 @@ Format* MessageFormat::createAppropriateFormat(UnicodeString& type, UnicodeStrin
                                                Formattable::Type& formattableType, UParseError& parseError,
                                                UErrorCode& ec) {
     if (U_FAILURE(ec)) {
-        return NULL;
+        return nullptr;
     }
-    Format* fmt = NULL;
+    Format* fmt = nullptr;
     int32_t typeID, styleID;
     DateFormat::EStyle date_style;
     int32_t firstNonSpace;
@@ -1747,9 +1747,9 @@ Format* MessageFormat::createAppropriateFormat(UnicodeString& type, UnicodeStrin
                 fmt = DateFormat::createTimeInstance(date_style, fLocale);
             }
 
-            if (styleID < 0 && fmt != NULL) {
+            if (styleID < 0 && fmt != nullptr) {
                 SimpleDateFormat* sdtfmt = dynamic_cast<SimpleDateFormat*>(fmt);
-                if (sdtfmt != NULL) {
+                if (sdtfmt != nullptr) {
                     sdtfmt->applyPattern(style);
                 }
             }
@@ -1808,7 +1808,7 @@ NumberFormat*
 MessageFormat::createIntegerFormat(const Locale& locale, UErrorCode& status) const {
     NumberFormat *temp = NumberFormat::createInstance(locale, status);
     DecimalFormat *temp2;
-    if (temp != NULL && (temp2 = dynamic_cast<DecimalFormat*>(temp)) != NULL) {
+    if (temp != nullptr && (temp2 = dynamic_cast<DecimalFormat*>(temp)) != nullptr) {
         temp2->setMaximumFractionDigits(0);
         temp2->setDecimalSeparatorAlwaysShown(false);
         temp2->setParseIntegerOnly(true);
@@ -1819,19 +1819,19 @@ MessageFormat::createIntegerFormat(const Locale& locale, UErrorCode& status) con
 
 /**
  * Return the default number format.  Used to format a numeric
- * argument when subformats[i].format is NULL.  Returns NULL
+ * argument when subformats[i].format is nullptr.  Returns nullptr
  * on failure.
  *
  * Semantically const but may modify *this.
  */
 const NumberFormat* MessageFormat::getDefaultNumberFormat(UErrorCode& ec) const {
-    if (defaultNumberFormat == NULL) {
+    if (defaultNumberFormat == nullptr) {
         MessageFormat* t = (MessageFormat*) this;
         t->defaultNumberFormat = NumberFormat::createInstance(fLocale, ec);
         if (U_FAILURE(ec)) {
             delete t->defaultNumberFormat;
-            t->defaultNumberFormat = NULL;
-        } else if (t->defaultNumberFormat == NULL) {
+            t->defaultNumberFormat = nullptr;
+        } else if (t->defaultNumberFormat == nullptr) {
             ec = U_MEMORY_ALLOCATION_ERROR;
         }
     }
@@ -1840,16 +1840,16 @@ const NumberFormat* MessageFormat::getDefaultNumberFormat(UErrorCode& ec) const
 
 /**
  * Return the default date format.  Used to format a date
- * argument when subformats[i].format is NULL.  Returns NULL
+ * argument when subformats[i].format is nullptr.  Returns nullptr
  * on failure.
  *
  * Semantically const but may modify *this.
  */
 const DateFormat* MessageFormat::getDefaultDateFormat(UErrorCode& ec) const {
-    if (defaultDateFormat == NULL) {
+    if (defaultDateFormat == nullptr) {
         MessageFormat* t = (MessageFormat*) this;
         t->defaultDateFormat = DateFormat::createDateTimeInstance(DateFormat::kShort, DateFormat::kShort, fLocale);
-        if (t->defaultDateFormat == NULL) {
+        if (t->defaultDateFormat == nullptr) {
             ec = U_MEMORY_ALLOCATION_ERROR;
         }
     }
@@ -1924,7 +1924,7 @@ FormatNameEnumeration::snext(UErrorCode& status) {
     if (U_SUCCESS(status) && pos < fFormatNames->size()) {
         return (const UnicodeString*)fFormatNames->elementAt(pos++);
     }
-    return NULL;
+    return nullptr;
 }
 
 void
@@ -1934,14 +1934,14 @@ FormatNameEnumeration::reset(UErrorCode& /*status*/) {
 
 int32_t
 FormatNameEnumeration::count(UErrorCode& /*status*/) const {
-    return (fFormatNames==NULL) ? 0 : fFormatNames->size();
+    return (fFormatNames==nullptr) ? 0 : fFormatNames->size();
 }
 
 FormatNameEnumeration::~FormatNameEnumeration() {
 }
 
 MessageFormat::PluralSelectorProvider::PluralSelectorProvider(const MessageFormat &mf, UPluralType t)
-        : msgFormat(mf), rules(NULL), type(t) {
+        : msgFormat(mf), rules(nullptr), type(t) {
 }
 
 MessageFormat::PluralSelectorProvider::~PluralSelectorProvider() {
@@ -1954,7 +1954,7 @@ UnicodeString MessageFormat::PluralSelectorProvider::select(void *ctx, double nu
         return UnicodeString(false, OTHER_STRING, 5);
     }
     MessageFormat::PluralSelectorProvider* t = const_cast<MessageFormat::PluralSelectorProvider*>(this);
-    if(rules == NULL) {
+    if(rules == nullptr) {
         t->rules = PluralRules::forLocale(msgFormat.fLocale, type, ec);
         if (U_FAILURE(ec)) {
             return UnicodeString(false, OTHER_STRING, 5);
@@ -1969,11 +1969,11 @@ UnicodeString MessageFormat::PluralSelectorProvider::select(void *ctx, double nu
     PluralSelectorContext &context = *static_cast<PluralSelectorContext *>(ctx);
     int32_t otherIndex = msgFormat.findOtherSubMessage(context.startIndex);
     context.numberArgIndex = msgFormat.findFirstPluralNumberArg(otherIndex, context.argName);
-    if(context.numberArgIndex > 0 && msgFormat.cachedFormatters != NULL) {
+    if(context.numberArgIndex > 0 && msgFormat.cachedFormatters != nullptr) {
         context.formatter =
             (const Format*)uhash_iget(msgFormat.cachedFormatters, context.numberArgIndex);
     }
-    if(context.formatter == NULL) {
+    if(context.formatter == nullptr) {
         context.formatter = msgFormat.getDefaultNumberFormat(ec);
         context.forReplaceNumber = true;
     }
@@ -1983,7 +1983,7 @@ UnicodeString MessageFormat::PluralSelectorProvider::select(void *ctx, double nu
     }
     context.formatter->format(context.number, context.numberString, ec);
     auto* decFmt = dynamic_cast<const DecimalFormat *>(context.formatter);
-    if(decFmt != NULL) {
+    if(decFmt != nullptr) {
         number::impl::DecimalQuantity dq;
         decFmt->formatToDecimalQuantity(context.number, dq, ec);
         if (U_FAILURE(ec)) {
@@ -1997,7 +1997,7 @@ UnicodeString MessageFormat::PluralSelectorProvider::select(void *ctx, double nu
 
 void MessageFormat::PluralSelectorProvider::reset() {
     delete rules;
-    rules = NULL;
+    rules = nullptr;
 }
 
 
index b22c68b022af0acb959f0bf0087d36780b6d7b37..4cdac1503dc665cc9934761aa8ea8fd7e66f8a00 100644 (file)
@@ -68,10 +68,10 @@ NameUnicodeTransliterator::NameUnicodeTransliterator(UnicodeFilter* adoptedFilte
     USetAdder sa = {
         (USet *)legalPtr, // USet* == UnicodeSet*
         _set_add,
-        NULL, // Don't need _set_addRange
-        NULL, // Don't need _set_addString
-        NULL, // Don't need remove()
-        NULL
+        nullptr, // Don't need _set_addRange
+        nullptr, // Don't need _set_addString
+        nullptr, // Don't need remove()
+        nullptr
     };
     uprv_getCharNameCharacters(&sa);
 }
@@ -111,7 +111,7 @@ void NameUnicodeTransliterator::handleTransliterate(Replaceable& text, UTransPos
                                                     UBool isIncremental) const {
     // The failure mode, here and below, is to behave like Any-Null,
     // if either there is no name data (max len == 0) or there is no
-    // memory (malloc() => NULL).
+    // memory (malloc() => nullptr).
 
     int32_t maxLen = uprv_getMaxCharNameLength();
     if (maxLen == 0) {
@@ -122,7 +122,7 @@ void NameUnicodeTransliterator::handleTransliterate(Replaceable& text, UTransPos
     // Accommodate the longest possible name
     ++maxLen; // allow for temporary trailing space
     char* cbuf = (char*) uprv_malloc(maxLen);
-    if (cbuf == NULL) {
+    if (cbuf == nullptr) {
         offsets.start = offsets.limit;
         return;
     }
index 3eb1882b2f957e2253e5fcfac1f51c7801befbab..1864d4d3bd99e5a36b8b64938c7766b32ce5fa65 100644 (file)
@@ -39,7 +39,7 @@ protected:
     uint32_t fCapacity;
 public:
     NFRuleList(uint32_t capacity = 10) 
-        : fStuff(capacity ? (NFRule**)uprv_malloc(capacity * sizeof(NFRule*)) : NULL)
+        : fStuff(capacity ? (NFRule**)uprv_malloc(capacity * sizeof(NFRule*)) : nullptr)
         , fCount(0)
         , fCapacity(capacity) {}
     ~NFRuleList() {
@@ -50,10 +50,10 @@ public:
             uprv_free(fStuff);
         }
     }
-    NFRule* operator[](uint32_t index) const { return fStuff != NULL ? fStuff[index] : NULL; }
+    NFRule* operator[](uint32_t index) const { return fStuff != nullptr ? fStuff[index] : nullptr; }
     NFRule* remove(uint32_t index) {
-       if (fStuff == NULL) {
-               return NULL;
+       if (fStuff == nullptr) {
+               return nullptr;
        }
         NFRule* result = fStuff[index];
         fCount -= 1;
@@ -67,7 +67,7 @@ public:
             fCapacity += 10;
             fStuff = (NFRule**)uprv_realloc(fStuff, fCapacity * sizeof(NFRule*)); // assume success
         }
-        if (fStuff != NULL) {
+        if (fStuff != nullptr) {
                fStuff[fCount++] = thing;
         } else {
                fCapacity = 0;
@@ -75,17 +75,17 @@ public:
         }
     }
     uint32_t size() const { return fCount; }
-    NFRule* last() const { return (fCount > 0 && fStuff != NULL) ? fStuff[fCount-1] : NULL; }
+    NFRule* last() const { return (fCount > 0 && fStuff != nullptr) ? fStuff[fCount-1] : nullptr; }
     NFRule** release() {
-        add(NULL); // ensure null termination
+        add(nullptr); // ensure null termination
         NFRule** result = fStuff;
-        fStuff = NULL;
+        fStuff = nullptr;
         fCount = 0;
         fCapacity = 0;
         return result;
     }
     void deleteAll() {
-        NFRule** tmp = NULL;
+        NFRule** tmp = nullptr;
         int32_t size = fCount;
         if (size > 0) {
             tmp = release();
index 17fab139113907b840acb54950da9c67b7298c0d..709aff0328f04eebb76444a2996476806deff861 100644 (file)
@@ -143,7 +143,7 @@ NFRuleSet::NFRuleSet(RuleBasedNumberFormat *_owner, UnicodeString* descriptions,
   , fIsParseable(true)
 {
     for (int32_t i = 0; i < NON_NUMERICAL_RULE_LENGTH; ++i) {
-        nonNumericalRules[i] = NULL;
+        nonNumericalRules[i] = nullptr;
     }
 
     if (U_FAILURE(status)) {
@@ -303,7 +303,7 @@ void NFRuleSet::setBestFractionRule(int32_t originalIndex, NFRule *newRule, UBoo
         fractionRules.add(newRule);
     }
     NFRule *bestResult = nonNumericalRules[originalIndex];
-    if (bestResult == NULL) {
+    if (bestResult == nullptr) {
         nonNumericalRules[originalIndex] = newRule;
     }
     else {
@@ -535,7 +535,7 @@ NFRuleSet::findNormalRule(int64_t number) const
             }
         }
         if (hi == 0) { // bad rule set, minimum base > 0
-            return NULL; // want to throw exception here
+            return nullptr; // want to throw exception here
         }
 
         NFRule *result = rules[hi - 1];
@@ -547,7 +547,7 @@ NFRuleSet::findNormalRule(int64_t number) const
         // return
         if (result->shouldRollBack(number)) {
             if (hi == 1) { // bad rule set, no prior rule to rollback to from this base
-                return NULL;
+                return nullptr;
             }
             result = rules[hi - 2];
         }
@@ -671,7 +671,7 @@ NFRuleSet::findFractionRuleSetRule(double number) const
 static void dumpUS(FILE* f, const UnicodeString& us) {
   int len = us.length();
   char* buf = (char *)uprv_malloc((len+1)*sizeof(char)); //new char[len+1];
-  if (buf != NULL) {
+  if (buf != nullptr) {
          us.extract(0, len, buf);
          buf[len] = 0;
          fprintf(f, "%s", buf);
index 2f8383c764c03de00da7092dba54d6d60e695693..8e9040b59e3979c9d758d537a35e43dc58555248 100644 (file)
@@ -40,10 +40,10 @@ NFRule::NFRule(const RuleBasedNumberFormat* _rbnf, const UnicodeString &_ruleTex
   , exponent(0)
   , decimalPoint(0)
   , fRuleText(_ruleText)
-  , sub1(NULL)
-  , sub2(NULL)
+  , sub1(nullptr)
+  , sub2(nullptr)
   , formatter(_rbnf)
-  , rulePatternFormat(NULL)
+  , rulePatternFormat(nullptr)
 {
     if (!fRuleText.isEmpty()) {
         parseRuleDescriptor(fRuleText, status);
@@ -54,12 +54,12 @@ NFRule::~NFRule()
 {
     if (sub1 != sub2) {
         delete sub2;
-        sub2 = NULL;
+        sub2 = nullptr;
     }
     delete sub1;
-    sub1 = NULL;
+    sub1 = nullptr;
     delete rulePatternFormat;
-    rulePatternFormat = NULL;
+    rulePatternFormat = nullptr;
 }
 
 static const UChar gLeftBracket = 0x005b;
@@ -101,7 +101,7 @@ static const UChar gGreaterGreaterGreater[] =   {0x3E, 0x3E, 0x3E, 0}; /* ">>>"
 static const UChar * const RULE_PREFIXES[] = {
     gLessLess, gLessPercent, gLessHash, gLessZero,
     gGreaterGreater, gGreaterPercent,gGreaterHash, gGreaterZero,
-    gEqualPercent, gEqualHash, gEqualZero, NULL
+    gEqualPercent, gEqualHash, gEqualZero, nullptr
 };
 
 void
@@ -117,7 +117,7 @@ NFRule::makeRules(UnicodeString& description,
     // (this also strips the rule descriptor, if any, off the
     // description string)
     NFRule* rule1 = new NFRule(rbnf, description, status);
-    /* test for NULL */
+    /* test for nullptr */
     if (rule1 == 0) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
@@ -144,7 +144,7 @@ NFRule::makeRules(UnicodeString& description,
     else {
         // if the description does contain a matched pair of brackets,
         // then it's really shorthand for two rules (with one exception)
-        NFRule* rule2 = NULL;
+        NFRule* rule2 = nullptr;
         UnicodeString sbuf;
 
         // we'll actually only split the rule into two rules if its
@@ -161,7 +161,7 @@ NFRule::makeRules(UnicodeString& description,
             // increment the original rule's base value ("rule1" actually
             // goes SECOND in the rule set's rule list)
             rule2 = new NFRule(rbnf, UnicodeString(), status);
-            /* test for NULL */
+            /* test for nullptr */
             if (rule2 == 0) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 return;
@@ -217,7 +217,7 @@ NFRule::makeRules(UnicodeString& description,
         // BEFORE rule1 in the list: in all cases, rule2 OMITS the
         // material in the brackets and rule1 INCLUDES the material
         // in the brackets)
-        if (rule2 != NULL) {
+        if (rule2 != nullptr) {
             if (rule2->baseValue >= kNoBase) {
                 rules.add(rule2);
             }
@@ -420,9 +420,9 @@ NFRule::extractSubstitutions(const NFRuleSet* ruleSet,
     }
     fRuleText = ruleText;
     sub1 = extractSubstitution(ruleSet, predecessor, status);
-    if (sub1 == NULL) {
+    if (sub1 == nullptr) {
         // Small optimization. There is no need to create a redundant NullSubstitution.
-        sub2 = NULL;
+        sub2 = nullptr;
     }
     else {
         sub2 = extractSubstitution(ruleSet, predecessor, status);
@@ -469,7 +469,7 @@ NFRule::extractSubstitution(const NFRuleSet* ruleSet,
                             const NFRule* predecessor,
                             UErrorCode& status)
 {
-    NFSubstitution* result = NULL;
+    NFSubstitution* result = nullptr;
 
     // search the rule's rule text for the first two characters of
     // a substitution token
@@ -479,7 +479,7 @@ NFRule::extractSubstitution(const NFRuleSet* ruleSet,
     // if we didn't find one, create a null substitution positioned
     // at the end of the rule text
     if (subStart == -1) {
-        return NULL;
+        return nullptr;
     }
 
     // special-case the ">>>" token, since searching for the > at the
@@ -506,7 +506,7 @@ NFRule::extractSubstitution(const NFRuleSet* ruleSet,
     // unmatched token character), create a null substitution positioned
     // at the end of the rule
     if (subEnd == -1) {
-        return NULL;
+        return nullptr;
     }
 
     // if we get here, we have a real substitution token (or at least
@@ -549,10 +549,10 @@ NFRule::setBaseValue(int64_t newBaseValue, UErrorCode& status)
         // description didn't specify a base value.  This means it
         // has substitutions, and some substitutions hold on to copies
         // of the rule's divisor.  Fix their copies of the divisor.
-        if (sub1 != NULL) {
+        if (sub1 != nullptr) {
             sub1->setDivisor(radix, exponent, status);
         }
-        if (sub2 != NULL) {
+        if (sub2 != nullptr) {
             sub2->setDivisor(radix, exponent, status);
         }
 
@@ -690,7 +690,7 @@ NFRule::_appendRuleText(UnicodeString& result) const
     // if the rule text begins with a space, write an apostrophe
     // (whitespace after the rule descriptor is ignored; the
     // apostrophe is used to make the whitespace significant)
-    if (fRuleText.charAt(0) == gSpace && (sub1 == NULL || sub1->getPos() != 0)) {
+    if (fRuleText.charAt(0) == gSpace && (sub1 == nullptr || sub1->getPos() != 0)) {
         result.append(gTick);
     }
 
@@ -700,11 +700,11 @@ NFRule::_appendRuleText(UnicodeString& result) const
     ruleTextCopy.setTo(fRuleText);
 
     UnicodeString temp;
-    if (sub2 != NULL) {
+    if (sub2 != nullptr) {
         sub2->toString(temp);
         ruleTextCopy.insert(sub2->getPos(), temp);
     }
-    if (sub1 != NULL) {
+    if (sub1 != nullptr) {
         sub1->toString(temp);
         ruleTextCopy.insert(sub1->getPos(), temp);
     }
@@ -763,10 +763,10 @@ NFRule::doFormat(int64_t number, UnicodeString& toInsertInto, int32_t pos, int32
         lengthOffset = fRuleText.length() - (toInsertInto.length() - initialLength);
     }
 
-    if (sub2 != NULL) {
+    if (sub2 != nullptr) {
         sub2->doSubstitution(number, toInsertInto, pos - (sub2->getPos() > pluralRuleStart ? lengthOffset : 0), recursionCount, status);
     }
-    if (sub1 != NULL) {
+    if (sub1 != nullptr) {
         sub1->doSubstitution(number, toInsertInto, pos - (sub1->getPos() > pluralRuleStart ? lengthOffset : 0), recursionCount, status);
     }
 }
@@ -817,10 +817,10 @@ NFRule::doFormat(double number, UnicodeString& toInsertInto, int32_t pos, int32_
         lengthOffset = fRuleText.length() - (toInsertInto.length() - initialLength);
     }
 
-    if (sub2 != NULL) {
+    if (sub2 != nullptr) {
         sub2->doSubstitution(number, toInsertInto, pos - (sub2->getPos() > pluralRuleStart ? lengthOffset : 0), recursionCount, status);
     }
-    if (sub1 != NULL) {
+    if (sub1 != nullptr) {
         sub1->doSubstitution(number, toInsertInto, pos - (sub1->getPos() > pluralRuleStart ? lengthOffset : 0), recursionCount, status);
     }
 }
@@ -852,7 +852,7 @@ NFRule::shouldRollBack(int64_t number) const
     // a modulus substitution, its base value isn't an even multiple
     // of 100, and the value we're trying to format _is_ an even
     // multiple of 100.  This is called the "rollback rule."
-    if ((sub1 != NULL && sub1->isModulusSubstitution()) || (sub2 != NULL && sub2->isModulusSubstitution())) {
+    if ((sub1 != nullptr && sub1->isModulusSubstitution()) || (sub2 != nullptr && sub2->isModulusSubstitution())) {
         int64_t re = util64_pow(radix, exponent);
         return (number % re) == 0 && (baseValue % re) != 0;
     }
@@ -887,7 +887,7 @@ NFRule::shouldRollBack(int64_t number) const
 static void dumpUS(FILE* f, const UnicodeString& us) {
   int len = us.length();
   char* buf = (char *)uprv_malloc((len+1)*sizeof(char)); //new char[len+1];
-  if (buf != NULL) {
+  if (buf != nullptr) {
          us.extract(0, len, buf);
          buf[len] = 0;
          fprintf(f, "%s", buf);
@@ -908,8 +908,8 @@ NFRule::doParse(const UnicodeString& text,
     ParsePosition pp;
     UnicodeString workText(text);
 
-    int32_t sub1Pos = sub1 != NULL ? sub1->getPos() : fRuleText.length();
-    int32_t sub2Pos = sub2 != NULL ? sub2->getPos() : fRuleText.length();
+    int32_t sub1Pos = sub1 != nullptr ? sub1->getPos() : fRuleText.length();
+    int32_t sub2Pos = sub2 != nullptr ? sub2->getPos() : fRuleText.length();
 
     // check to see whether the text before the first substitution
     // matches the text at the beginning of the string being
@@ -1010,7 +1010,7 @@ NFRule::doParse(const UnicodeString& text,
         // null substitution), pp is now pointing at the first unmatched
         // character.  Take note of that, and try matchToDelimiter()
         // on the input text again
-        if (pp.getIndex() != 0 || sub1 == NULL) {
+        if (pp.getIndex() != 0 || sub1 == nullptr) {
             start = pp.getIndex();
 
             UnicodeString workText2;
@@ -1030,7 +1030,7 @@ NFRule::doParse(const UnicodeString& text,
             // if we got a successful match on this second
             // matchToDelimiter() call, update the high-water mark
             // and result (if necessary)
-            if (pp2.getIndex() != 0 || sub2 == NULL) {
+            if (pp2.getIndex() != 0 || sub2 == nullptr) {
                 if (prefixLength + pp.getIndex() + pp2.getIndex() > highWaterMark) {
                     highWaterMark = prefixLength + pp.getIndex() + pp2.getIndex();
                     result = partialResult;
@@ -1078,7 +1078,7 @@ NFRule::doParse(const UnicodeString& text,
     // we have to account for it here.  By definition, if the matching
     // rule in a fraction rule set has no substitutions, its numerator
     // is 1, and so the result is the reciprocal of its base value.
-    if (isFractionRule && highWaterMark > 0 && sub1 == NULL) {
+    if (isFractionRule && highWaterMark > 0 && sub1 == nullptr) {
         result = 1 / result;
     }
 
@@ -1235,7 +1235,7 @@ NFRule::matchToDelimiter(const UnicodeString& text,
         // for "delimiter".  Instead, just use "sub" to parse as much of
         // "text" as possible.
     }
-    else if (sub == NULL) {
+    else if (sub == nullptr) {
         return _baseValue;
     }
     else {
@@ -1309,7 +1309,7 @@ NFRule::prefixLength(const UnicodeString& str, const UnicodeString& prefix, UErr
         // the CollationElementIterator protocol.  Hopefully, this
         // will change someday.)
         const RuleBasedCollator* collator = formatter->getCollator();
-        if (collator == NULL) {
+        if (collator == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return 0;
         }
@@ -1588,7 +1588,7 @@ NFRule::allIgnorable(const UnicodeString& str, UErrorCode& status) const
     // element is 0 (ignorable) at the primary level
     if (formatter->isLenient()) {
         const RuleBasedCollator* collator = formatter->getCollator();
-        if (collator == NULL) {
+        if (collator == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return false;
         }
@@ -1618,10 +1618,10 @@ NFRule::allIgnorable(const UnicodeString& str, UErrorCode& status) const
 
 void
 NFRule::setDecimalFormatSymbols(const DecimalFormatSymbols& newSymbols, UErrorCode& status) {
-    if (sub1 != NULL) {
+    if (sub1 != nullptr) {
         sub1->setDecimalFormatSymbols(newSymbols, status);
     }
-    if (sub2 != NULL) {
+    if (sub2 != nullptr) {
         sub2->setDecimalFormatSymbols(newSymbols, status);
     }
 }
index 9dba77b1e30823fbe988ed562131785db55e9efa..113bb529ee6471955ae73fa6be9f6245dfdad0d9 100644 (file)
@@ -324,7 +324,7 @@ NFSubstitution::makeSubstitution(int32_t pos,
 {
     // if the description is empty, return a NullSubstitution
     if (description.length() == 0) {
-        return NULL;
+        return nullptr;
     }
 
     switch (description.charAt(0)) {
@@ -335,7 +335,7 @@ NFSubstitution::makeSubstitution(int32_t pos,
         if (rule->getBaseValue() == NFRule::kNegativeNumberRule) {
             // throw new IllegalArgumentException("<< not allowed in negative-number rule");
             status = U_PARSE_ERROR;
-            return NULL;
+            return nullptr;
         }
 
         // if the rule is a fraction rule, return an
@@ -380,7 +380,7 @@ NFSubstitution::makeSubstitution(int32_t pos,
         else if (ruleSet->isFractionRuleSet()) {
             // throw new IllegalArgumentException(">> not allowed in fraction rule set");
             status = U_PARSE_ERROR;
-            return NULL;
+            return nullptr;
         }
 
         // otherwise, return a ModulusSubstitution
@@ -399,14 +399,14 @@ NFSubstitution::makeSubstitution(int32_t pos,
         // throw new IllegalArgumentException("Illegal substitution character");
         status = U_PARSE_ERROR;
     }
-    return NULL;
+    return nullptr;
 }
 
 NFSubstitution::NFSubstitution(int32_t _pos,
                                const NFRuleSet* _ruleSet,
                                const UnicodeString& description,
                                UErrorCode& status)
-                               : pos(_pos), ruleSet(NULL), numberFormat(NULL)
+                               : pos(_pos), ruleSet(nullptr), numberFormat(nullptr)
 {
     // the description should begin and end with the same character.
     // If it doesn't that's a syntax error.  Otherwise,
@@ -448,7 +448,7 @@ NFSubstitution::NFSubstitution(int32_t _pos,
             return;
         }
         DecimalFormat *tempNumberFormat = new DecimalFormat(workingDescription, *sym, status);
-        /* test for NULL */
+        /* test for nullptr */
         if (!tempNumberFormat) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
@@ -467,9 +467,9 @@ NFSubstitution::NFSubstitution(int32_t _pos,
         // a number even when it's 0)
 
         // this causes problems when >>> is used in a frationalPartSubstitution
-        // this->ruleSet = NULL;
+        // this->ruleSet = nullptr;
         this->ruleSet = _ruleSet;
-        this->numberFormat = NULL;
+        this->numberFormat = nullptr;
     }
     else {
         // and of the description is none of these things, it's a syntax error
@@ -482,7 +482,7 @@ NFSubstitution::NFSubstitution(int32_t _pos,
 NFSubstitution::~NFSubstitution()
 {
     delete numberFormat;
-    numberFormat = NULL;
+    numberFormat = nullptr;
 }
 
 /**
@@ -499,7 +499,7 @@ NFSubstitution::setDivisor(int32_t /*radix*/, int16_t /*exponent*/, UErrorCode&
 
 void
 NFSubstitution::setDecimalFormatSymbols(const DecimalFormatSymbols &newSymbols, UErrorCode& /*status*/) {
-    if (numberFormat != NULL) {
+    if (numberFormat != nullptr) {
         numberFormat->setDecimalFormatSymbols(newSymbols);
     }
 }
@@ -523,10 +523,10 @@ NFSubstitution::operator==(const NFSubstitution& rhs) const
   // this should be called by subclasses before their own equality tests
   return typeid(*this) == typeid(rhs)
   && pos == rhs.pos
-  && (ruleSet == NULL) == (rhs.ruleSet == NULL)
+  && (ruleSet == nullptr) == (rhs.ruleSet == nullptr)
   // && ruleSet == rhs.ruleSet causes circularity, other checks to make instead?
-  && (numberFormat == NULL
-      ? (rhs.numberFormat == NULL)
+  && (numberFormat == nullptr
+      ? (rhs.numberFormat == nullptr)
       : (*numberFormat == *rhs.numberFormat));
 }
 
@@ -547,9 +547,9 @@ NFSubstitution::toString(UnicodeString& text) const
   text.append(tokenChar());
 
   UnicodeString temp;
-  if (ruleSet != NULL) {
+  if (ruleSet != nullptr) {
     ruleSet->getName(temp);
-  } else if (numberFormat != NULL) {
+  } else if (numberFormat != nullptr) {
     numberFormat->toPattern(temp);
   }
   text.append(temp);
@@ -573,12 +573,12 @@ NFSubstitution::toString(UnicodeString& text) const
 void
 NFSubstitution::doSubstitution(int64_t number, UnicodeString& toInsertInto, int32_t _pos, int32_t recursionCount, UErrorCode& status) const
 {
-    if (ruleSet != NULL) {
+    if (ruleSet != nullptr) {
         // Perform a transformation on the number that is dependent
         // on the type of substitution this is, then just call its
         // rule set's format() method to format the result
         ruleSet->format(transformNumber(number), toInsertInto, _pos + this->pos, recursionCount, status);
-    } else if (numberFormat != NULL) {
+    } else if (numberFormat != nullptr) {
         if (number <= MAX_INT64_IN_DOUBLE) {
             // or perform the transformation on the number (preserving
             // the result's fractional part if the formatter it set
@@ -634,16 +634,16 @@ NFSubstitution::doSubstitution(double number, UnicodeString& toInsertInto, int32
 
     // if the result is an integer, from here on out we work in integer
     // space (saving time and memory and preserving accuracy)
-    if (numberToFormat == uprv_floor(numberToFormat) && ruleSet != NULL) {
+    if (numberToFormat == uprv_floor(numberToFormat) && ruleSet != nullptr) {
         ruleSet->format(util64_fromDouble(numberToFormat), toInsertInto, _pos + this->pos, recursionCount, status);
 
         // if the result isn't an integer, then call either our rule set's
         // format() method or our DecimalFormat's format() method to
         // format the result
     } else {
-        if (ruleSet != NULL) {
+        if (ruleSet != nullptr) {
             ruleSet->format(numberToFormat, toInsertInto, _pos + this->pos, recursionCount, status);
-        } else if (numberFormat != NULL) {
+        } else if (numberFormat != nullptr) {
             UnicodeString temp;
             numberFormat->format(numberToFormat, temp);
             toInsertInto.insert(_pos + this->pos, temp);
@@ -715,7 +715,7 @@ NFSubstitution::doParse(const UnicodeString& text,
     // be false even when the formatter's lenient-parse mode is
     // on), then also try parsing the text using a default-
     // constructed NumberFormat
-    if (ruleSet != NULL) {
+    if (ruleSet != nullptr) {
         ruleSet->parse(text, parsePosition, upperBound, nonNumericalExecutedRuleMask, result);
         if (lenientParse && !ruleSet->isFractionRuleSet() && parsePosition.getIndex() == 0) {
             UErrorCode status = U_ZERO_ERROR;
@@ -727,7 +727,7 @@ NFSubstitution::doParse(const UnicodeString& text,
         }
 
         // ...or use our DecimalFormat to parse the text
-    } else if (numberFormat != NULL) {
+    } else if (numberFormat != nullptr) {
         numberFormat->parse(text, result, parsePosition);
     }
 
@@ -834,7 +834,7 @@ ModulusSubstitution::ModulusSubstitution(int32_t _pos,
                                          UErrorCode& status)
  : NFSubstitution(_pos, _ruleSet, description, status)
  , divisor(rule->getDivisor())
- , ruleToUse(NULL)
+ , ruleToUse(nullptr)
 {
   // the owning rule's divisor controls the behavior of this
   // substitution: rather than keeping a backpointer to the rule,
@@ -882,7 +882,7 @@ ModulusSubstitution::doSubstitution(int64_t number, UnicodeString& toInsertInto,
     // if this isn't a >>> substitution, just use the inherited version
     // of this function (which uses either a rule set or a DecimalFormat
     // to format its substitution value)
-    if (ruleToUse == NULL) {
+    if (ruleToUse == nullptr) {
         NFSubstitution::doSubstitution(number, toInsertInto, _pos, recursionCount, status);
 
         // a >>> substitution goes straight to a particular rule to
@@ -907,7 +907,7 @@ ModulusSubstitution::doSubstitution(double number, UnicodeString& toInsertInto,
     // if this isn't a >>> substitution, just use the inherited version
     // of this function (which uses either a rule set or a DecimalFormat
     // to format its substitution value)
-    if (ruleToUse == NULL) {
+    if (ruleToUse == nullptr) {
         NFSubstitution::doSubstitution(number, toInsertInto, _pos, recursionCount, status);
 
         // a >>> substitution goes straight to a particular rule to
@@ -943,7 +943,7 @@ ModulusSubstitution::doParse(const UnicodeString& text,
 {
     // if this isn't a >>> substitution, we can just use the
     // inherited parse() routine to do the parsing
-    if (ruleToUse == NULL) {
+    if (ruleToUse == nullptr) {
         return NFSubstitution::doParse(text, parsePosition, baseValue, upperBound, lenientParse, nonNumericalExecutedRuleMask, result);
 
         // but if it IS a >>> substitution, we have to do it here: we
@@ -976,7 +976,7 @@ ModulusSubstitution::toString(UnicodeString& text) const
   // either the name of the rule set it uses, or the pattern of
   // the DecimalFormat it uses
 
-  if ( ruleToUse != NULL ) { // Must have been a >>> substitution.
+  if ( ruleToUse != nullptr ) { // Must have been a >>> substitution.
       text.remove();
       text.append(tokenChar());
       text.append(tokenChar());
@@ -1146,7 +1146,7 @@ FractionalPartSubstitution::doParse(const UnicodeString& text,
 
         DecimalQuantity dl;
         int32_t totalDigits = 0;
-        NumberFormat* fmt = NULL;
+        NumberFormat* fmt = nullptr;
         while (workText.length() > 0 && workPos.getIndex() != 0) {
             workPos.setIndex(0);
             Formattable temp;
@@ -1163,7 +1163,7 @@ FractionalPartSubstitution::doParse(const UnicodeString& text,
                     fmt = NumberFormat::createInstance(status);
                     if (U_FAILURE(status)) {
                         delete fmt;
-                        fmt = NULL;
+                        fmt = nullptr;
                     }
                 }
                 if (fmt) {
@@ -1224,7 +1224,7 @@ NumeratorSubstitution::doSubstitution(double number, UnicodeString& toInsertInto
     int64_t longNF = util64_fromDouble(numberToFormat);
 
     const NFRuleSet* aruleSet = getRuleSet();
-    if (withZeros && aruleSet != NULL) {
+    if (withZeros && aruleSet != nullptr) {
         // if there are leading zeros in the decimal expansion then emit them
         int64_t nf =longNF;
         int32_t len = toInsertInto.length();
@@ -1237,14 +1237,14 @@ NumeratorSubstitution::doSubstitution(double number, UnicodeString& toInsertInto
 
     // if the result is an integer, from here on out we work in integer
     // space (saving time and memory and preserving accuracy)
-    if (numberToFormat == longNF && aruleSet != NULL) {
+    if (numberToFormat == longNF && aruleSet != nullptr) {
         aruleSet->format(longNF, toInsertInto, apos + getPos(), recursionCount, status);
 
         // if the result isn't an integer, then call either our rule set's
         // format() method or our DecimalFormat's format() method to
         // format the result
     } else {
-        if (aruleSet != NULL) {
+        if (aruleSet != nullptr) {
             aruleSet->format(numberToFormat, toInsertInto, apos + getPos(), recursionCount, status);
         } else {
             UnicodeString temp;
index b1809daebd058a219967e0e7dd1eeb2d4950ba11..d793433b3d24964d7039149f95f2c2844e0e2b59 100644 (file)
@@ -62,11 +62,11 @@ Transliterator* NormalizationTransliterator::_create(const UnicodeString& ID,
     const char *name = (const char *)context.pointer;
     UNormalization2Mode mode = (UNormalization2Mode)uprv_strchr(name, 0)[1];
     UErrorCode errorCode = U_ZERO_ERROR;
-    const Normalizer2 *norm2 = Normalizer2::getInstance(NULL, name, mode, errorCode);
+    const Normalizer2 *norm2 = Normalizer2::getInstance(nullptr, name, mode, errorCode);
     if(U_SUCCESS(errorCode)) {
         return new NormalizationTransliterator(ID, *norm2);
     } else {
-        return NULL;
+        return nullptr;
     }
 }
 
index 9ba639e67e2257b99d57cfeb8a38f2549be78946..54aeffee811de308c35dc1b1776f34d2a34aa343 100644 (file)
@@ -18,7 +18,7 @@ namespace {
 int16_t getMinGroupingForLocale(const Locale& locale) {
     // TODO: Cache this?
     UErrorCode localStatus = U_ZERO_ERROR;
-    LocalUResourceBundlePointer bundle(ures_open(NULL, locale.getName(), &localStatus));
+    LocalUResourceBundlePointer bundle(ures_open(nullptr, locale.getName(), &localStatus));
     int32_t resultLen = 0;
     const char16_t* result = ures_getStringByKeyWithFallback(
         bundle.getAlias(),
index be0320cecf236a4da7e1a285d51fb68078b0230b..237abdde311317021d672a5470ca84db40d64852 100644 (file)
@@ -606,7 +606,7 @@ class DerivedComponents {
      */
     DerivedComponents(const Locale &locale, const char *feature, const char *structure) {
         StackUResourceBundle derivationsBundle, stackBundle;
-        ures_openDirectFillIn(derivationsBundle.getAlias(), NULL, "grammaticalFeatures", &status);
+        ures_openDirectFillIn(derivationsBundle.getAlias(), nullptr, "grammaticalFeatures", &status);
         ures_getByKey(derivationsBundle.getAlias(), "grammaticalData", derivationsBundle.getAlias(),
                       &status);
         ures_getByKey(derivationsBundle.getAlias(), "derivations", derivationsBundle.getAlias(),
@@ -695,7 +695,7 @@ class DerivedComponents {
 UnicodeString
 getDeriveCompoundRule(Locale locale, const char *feature, const char *structure, UErrorCode &status) {
     StackUResourceBundle derivationsBundle, stackBundle;
-    ures_openDirectFillIn(derivationsBundle.getAlias(), NULL, "grammaticalFeatures", &status);
+    ures_openDirectFillIn(derivationsBundle.getAlias(), nullptr, "grammaticalFeatures", &status);
     ures_getByKey(derivationsBundle.getAlias(), "grammaticalData", derivationsBundle.getAlias(),
                   &status);
     ures_getByKey(derivationsBundle.getAlias(), "derivations", derivationsBundle.getAlias(), &status);
@@ -1529,7 +1529,7 @@ void LongNameHandler::multiSimpleFormatsToModifiers(const UnicodeString *leadFor
 
 void LongNameHandler::processQuantity(DecimalQuantity &quantity, MicroProps &micros,
                                       UErrorCode &status) const {
-    if (parent != NULL) {
+    if (parent != nullptr) {
         parent->processQuantity(quantity, micros, status);
     }
     StandardPlural::Form pluralForm = utils::getPluralSafe(micros.rounder, rules, quantity, status);
@@ -1726,12 +1726,12 @@ LongNameMultiplexer *LongNameMultiplexer::forMeasureUnits(const Locale &loc,
         result->fMeasureUnits[i] = unit;
         if (unit.getComplexity(status) == UMEASURE_UNIT_MIXED) {
             MixedUnitLongNameHandler *mlnh = result->fMixedUnitHandlers.createAndCheckErrorCode(status);
-            MixedUnitLongNameHandler::forMeasureUnit(loc, unit, width, unitDisplayCase, rules, NULL,
+            MixedUnitLongNameHandler::forMeasureUnit(loc, unit, width, unitDisplayCase, rules, nullptr,
                                                      mlnh, status);
             result->fHandlers[i] = mlnh;
         } else {
             LongNameHandler *lnh = result->fLongNameHandlers.createAndCheckErrorCode(status);
-            LongNameHandler::forMeasureUnit(loc, unit, width, unitDisplayCase, rules, NULL, lnh, status);
+            LongNameHandler::forMeasureUnit(loc, unit, width, unitDisplayCase, rules, nullptr, lnh, status);
             result->fHandlers[i] = lnh;
         }
         if (U_FAILURE(status)) {
index 9e841da74a44fa8ea255de7679c94cd7fe21e025..fd8788317990bcc63c826289d1810362ac8ee00f 100644 (file)
@@ -109,38 +109,38 @@ const int32_t icu::NumberFormat::gDefaultMaxIntegerDigits = 2000000000;
 const int32_t icu::NumberFormat::gDefaultMinIntegerDigits = 127;
 
 static const UChar * const gLastResortNumberPatterns[UNUM_FORMAT_STYLE_COUNT] = {
-    NULL,  // UNUM_PATTERN_DECIMAL
+    nullptr,  // UNUM_PATTERN_DECIMAL
     gLastResortDecimalPat,  // UNUM_DECIMAL
     gLastResortCurrencyPat,  // UNUM_CURRENCY
     gLastResortPercentPat,  // UNUM_PERCENT
     gLastResortScientificPat,  // UNUM_SCIENTIFIC
-    NULL,  // UNUM_SPELLOUT
-    NULL,  // UNUM_ORDINAL
-    NULL,  // UNUM_DURATION
+    nullptr,  // UNUM_SPELLOUT
+    nullptr,  // UNUM_ORDINAL
+    nullptr,  // UNUM_DURATION
     gLastResortDecimalPat,  // UNUM_NUMBERING_SYSTEM
-    NULL,  // UNUM_PATTERN_RULEBASED
+    nullptr,  // UNUM_PATTERN_RULEBASED
     gLastResortIsoCurrencyPat,  // UNUM_CURRENCY_ISO
     gLastResortPluralCurrencyPat,  // UNUM_CURRENCY_PLURAL
     gLastResortAccountingCurrencyPat, // UNUM_CURRENCY_ACCOUNTING
     gLastResortCurrencyPat,  // UNUM_CASH_CURRENCY 
-    NULL,  // UNUM_DECIMAL_COMPACT_SHORT
-    NULL,  // UNUM_DECIMAL_COMPACT_LONG
+    nullptr,  // UNUM_DECIMAL_COMPACT_SHORT
+    nullptr,  // UNUM_DECIMAL_COMPACT_LONG
     gLastResortCurrencyPat,  // UNUM_CURRENCY_STANDARD
 };
 
 // Keys used for accessing resource bundles
 
 static const icu::number::impl::CldrPatternStyle gFormatCldrStyles[UNUM_FORMAT_STYLE_COUNT] = {
-    /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT,  // UNUM_PATTERN_DECIMAL
+    /* nullptr */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT,  // UNUM_PATTERN_DECIMAL
     icu::number::impl::CLDR_PATTERN_STYLE_DECIMAL,  // UNUM_DECIMAL
     icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY,  // UNUM_CURRENCY
     icu::number::impl::CLDR_PATTERN_STYLE_PERCENT,  // UNUM_PERCENT
     icu::number::impl::CLDR_PATTERN_STYLE_SCIENTIFIC,  // UNUM_SCIENTIFIC
-    /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT,  // UNUM_SPELLOUT
-    /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT,  // UNUM_ORDINAL
-    /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT,  // UNUM_DURATION
-    /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT,  // UNUM_NUMBERING_SYSTEM
-    /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT,  // UNUM_PATTERN_RULEBASED
+    /* nullptr */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT,  // UNUM_SPELLOUT
+    /* nullptr */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT,  // UNUM_ORDINAL
+    /* nullptr */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT,  // UNUM_DURATION
+    /* nullptr */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT,  // UNUM_NUMBERING_SYSTEM
+    /* nullptr */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT,  // UNUM_PATTERN_RULEBASED
     // For UNUM_CURRENCY_ISO and UNUM_CURRENCY_PLURAL,
     // the pattern is the same as the pattern of UNUM_CURRENCY
     // except for replacing the single currency sign with
@@ -149,17 +149,17 @@ static const icu::number::impl::CldrPatternStyle gFormatCldrStyles[UNUM_FORMAT_S
     icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY,  // UNUM_CURRENCY_PLURAL
     icu::number::impl::CLDR_PATTERN_STYLE_ACCOUNTING,  // UNUM_CURRENCY_ACCOUNTING
     icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY,  // UNUM_CASH_CURRENCY
-    /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT,  // UNUM_DECIMAL_COMPACT_SHORT
-    /* NULL */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT,  // UNUM_DECIMAL_COMPACT_LONG
+    /* nullptr */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT,  // UNUM_DECIMAL_COMPACT_SHORT
+    /* nullptr */ icu::number::impl::CLDR_PATTERN_STYLE_COUNT,  // UNUM_DECIMAL_COMPACT_LONG
     icu::number::impl::CLDR_PATTERN_STYLE_CURRENCY,  // UNUM_CURRENCY_STANDARD
 };
 
 // Static hashtable cache of NumberingSystem objects used by NumberFormat
-static UHashtable * NumberingSystem_cache = NULL;
+static UHashtable * NumberingSystem_cache = nullptr;
 static icu::UInitOnce gNSCacheInitOnce {};
 
 #if !UCONFIG_NO_SERVICE
-static icu::ICULocaleService* gService = NULL;
+static icu::ICULocaleService* gService = nullptr;
 static icu::UInitOnce gServiceInitOnce {};
 #endif
 
@@ -177,14 +177,14 @@ static UBool U_CALLCONV numfmt_cleanup(void) {
     gServiceInitOnce.reset();
     if (gService) {
         delete gService;
-        gService = NULL;
+        gService = nullptr;
     }
 #endif
     gNSCacheInitOnce.reset();
     if (NumberingSystem_cache) {
         // delete NumberingSystem_cache;
         uhash_close(NumberingSystem_cache);
-        NumberingSystem_cache = NULL;
+        NumberingSystem_cache = nullptr;
     }
     return true;
 }
@@ -222,7 +222,7 @@ SimpleNumberFormatFactory::getSupportedIDs(int32_t &count, UErrorCode& status) c
         return &_id;
     }
     count = 0;
-    return NULL;
+    return nullptr;
 }
 #endif /* #if !UCONFIG_NO_SERVICE */
 
@@ -504,9 +504,9 @@ ArgExtractor::iso(void) const {
 ArgExtractor::ArgExtractor(const NumberFormat& /*nf*/, const Formattable& obj, UErrorCode& /*status*/)
   : num(&obj), fWasCurrency(false) {
 
-    const UObject* o = obj.getObject(); // most commonly o==NULL
+    const UObject* o = obj.getObject(); // most commonly o==nullptr
     const CurrencyAmount* amt;
-    if (o != NULL && (amt = dynamic_cast<const CurrencyAmount*>(o)) != NULL) {
+    if (o != nullptr && (amt = dynamic_cast<const CurrencyAmount*>(o)) != nullptr) {
         // getISOCurrency() returns a pointer to internal storage, so we
         // copy it to retain it across the call to setCurrency().
         //const UChar* curr = amt->getISOCurrency();
@@ -575,7 +575,7 @@ NumberFormat::format(const Formattable& obj,
       return cloneFmt->format(*n, appendTo, pos, status);
     }
 
-    if (n->isNumeric() && n->getDecimalQuantity() != NULL) {
+    if (n->isNumeric() && n->getDecimalQuantity() != nullptr) {
         // Decimal Number.  We will have a DigitList available if the value was
         //   set to a decimal number, or if the value originated with a parse.
         //
@@ -630,7 +630,7 @@ NumberFormat::format(const Formattable& obj,
       return cloneFmt->format(*n, appendTo, posIter, status);
     }
 
-    if (n->isNumeric() && n->getDecimalQuantity() != NULL) {
+    if (n->isNumeric() && n->getDecimalQuantity() != nullptr) {
         // Decimal Number
         format(*n->getDecimalQuantity(), appendTo, posIter, status);
     } else {
@@ -745,7 +745,7 @@ CurrencyAmount* NumberFormat::parseCurrency(const UnicodeString& text,
             }
         }
     }
-    return NULL;
+    return nullptr;
 }
 
 // -------------------------------------
@@ -878,7 +878,7 @@ public:
     NFFactory(NumberFormatFactory* delegate)
         : LocaleKeyFactory(delegate->visible() ? VISIBLE : INVISIBLE)
         , _delegate(delegate)
-        , _ids(NULL)
+        , _ids(nullptr)
     {
     }
 
@@ -893,12 +893,12 @@ public:
             int32_t kind = lkey.kind();
 
             UObject* result = _delegate->createFormat(loc, (UNumberFormatStyle)kind);
-            if (result == NULL) {
-                result = service->getKey((ICUServiceKey&)key /* cast away const */, NULL, this, status);
+            if (result == nullptr) {
+                result = service->getKey((ICUServiceKey&)key /* cast away const */, nullptr, this, status);
             }
             return result;
         }
-        return NULL;
+        return nullptr;
     }
 
 protected:
@@ -922,7 +922,7 @@ protected:
             }
             return _ids;
         }
-        return NULL;
+        return nullptr;
     }
 };
 
@@ -965,7 +965,7 @@ ICUNumberFormatService::~ICUNumberFormatService() {}
 // -------------------------------------
 
 static void U_CALLCONV initNumberFormatService() {
-    U_ASSERT(gService == NULL);
+    U_ASSERT(gService == nullptr);
     ucln_i18n_registerCleanup(UCLN_I18N_NUMFMT, numfmt_cleanup);
     gService = new ICUNumberFormatService();
 }
@@ -978,7 +978,7 @@ getNumberFormatService(void)
 }
 
 static UBool haveService() {
-    return !gServiceInitOnce.isReset() && (getNumberFormatService() != NULL);
+    return !gServiceInitOnce.isReset() && (getNumberFormatService() != nullptr);
 }
 
 // -------------------------------------
@@ -993,12 +993,12 @@ NumberFormat::registerFactory(NumberFormatFactory* toAdopt, UErrorCode& status)
     ICULocaleService *service = getNumberFormatService();
     if (service) {
         NFFactory *tempnnf = new NFFactory(toAdopt);
-        if (tempnnf != NULL) {
+        if (tempnnf != nullptr) {
             return service->registerFactory(tempnnf, status);
         }
     }
     status = U_MEMORY_ALLOCATION_ERROR;
-    return NULL;
+    return nullptr;
 }
 
 // -------------------------------------
@@ -1025,7 +1025,7 @@ NumberFormat::getAvailableLocales(void)
   if (service) {
       return service->getAvailableLocales();
   }
-  return NULL; // no way to return error condition
+  return nullptr; // no way to return error condition
 }
 #endif /* UCONFIG_NO_SERVICE */
 // -------------------------------------
@@ -1057,11 +1057,11 @@ NumberFormat::createInstance(const Locale& loc, UNumberFormatStyle kind, UErrorC
     }
     const SharedNumberFormat *shared = createSharedInstance(loc, kind, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     NumberFormat *result = (*shared)->clone();
     shared->removeRef();
-    if (result == NULL) {
+    if (result == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
     }
     return result;
@@ -1200,7 +1200,7 @@ void NumberFormat::getEffectiveCurrency(UChar* result, UErrorCode& ec) const {
         result[3] = 0;
     } else {
         const char* loc = getLocaleID(ULOC_VALID_LOCALE, ec);
-        if (loc == NULL) {
+        if (loc == nullptr) {
             loc = uloc_getDefault();
         }
         ucurr_forLocale(loc, result, 4, &ec);
@@ -1239,16 +1239,16 @@ UDisplayContext NumberFormat::getContext(UDisplayContextType type, UErrorCode& s
 // or percent) for the desired locale.
 
 static void U_CALLCONV nscacheInit() {
-    U_ASSERT(NumberingSystem_cache == NULL);
+    U_ASSERT(NumberingSystem_cache == nullptr);
     ucln_i18n_registerCleanup(UCLN_I18N_NUMFMT, numfmt_cleanup);
     UErrorCode status = U_ZERO_ERROR;
     NumberingSystem_cache = uhash_open(uhash_hashLong,
                                        uhash_compareLong,
-                                       NULL,
+                                       nullptr,
                                        &status);
     if (U_FAILURE(status)) {
         // Number Format code will run with no cache if creation fails.
-        NumberingSystem_cache = NULL;
+        NumberingSystem_cache = nullptr;
         return;
     }
     uhash_setValueDeleter(NumberingSystem_cache, deleteNumberingSystem);
@@ -1261,13 +1261,13 @@ const SharedNumberFormat *LocaleCacheKey<SharedNumberFormat>::createObject(
     NumberFormat *nf = NumberFormat::internalCreateInstance(
             localeId, UNUM_DECIMAL, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     SharedNumberFormat *result = new SharedNumberFormat(nf);
-    if (result == NULL) {
+    if (result == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         delete nf;
-        return NULL;
+        return nullptr;
     }
     result->addRef();
     return result;
@@ -1276,20 +1276,20 @@ const SharedNumberFormat *LocaleCacheKey<SharedNumberFormat>::createObject(
 const SharedNumberFormat* U_EXPORT2
 NumberFormat::createSharedInstance(const Locale& loc, UNumberFormatStyle kind, UErrorCode& status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     if (kind != UNUM_DECIMAL) {
         status = U_UNSUPPORTED_ERROR;
-        return NULL;
+        return nullptr;
     }
-    const SharedNumberFormat *result = NULL;
+    const SharedNumberFormat *result = nullptr;
     UnifiedCache::getByLocale(loc, result, status);
     return result;
 }
 
 UBool
 NumberFormat::isStyleSupported(UNumberFormatStyle style) {
-    return gLastResortNumberPatterns[style] != NULL;
+    return gLastResortNumberPatterns[style] != nullptr;
 }
 
 NumberFormat*
@@ -1304,11 +1304,11 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
                            UNumberFormatStyle style,
                            UBool mustBeDecimalFormat,
                            UErrorCode& status) {
-    if (U_FAILURE(status)) return NULL;
+    if (U_FAILURE(status)) return nullptr;
 
     if (style < 0 || style >= UNUM_FORMAT_STYLE_COUNT) {
         status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     
     // For the purposes of general number formatting, UNUM_NUMBERING_SYSTEM should behave the same
@@ -1327,7 +1327,7 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
     // because this method does not take a pattern string.
     if (!isStyleSupported(style)) {
         status = U_UNSUPPORTED_ERROR;
-        return NULL;
+        return nullptr;
     }
 
 #if U_PLATFORM_USES_ONLY_WIN32_API
@@ -1369,15 +1369,15 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
 
     // Get cached numbering system
     LocalPointer<NumberingSystem> ownedNs;
-    NumberingSystem *ns = NULL;
-    if (NumberingSystem_cache != NULL) {
+    NumberingSystem *ns = nullptr;
+    if (NumberingSystem_cache != nullptr) {
         // TODO: Bad hash key usage, see ticket #8504.
         int32_t hashKey = desiredLocale.hashCode();
 
         static UMutex nscacheMutex;
         Mutex lock(&nscacheMutex);
         ns = (NumberingSystem *)uhash_iget(NumberingSystem_cache, hashKey);
-        if (ns == NULL) {
+        if (ns == nullptr) {
             ns = NumberingSystem::createInstance(desiredLocale,status);
             uhash_iput(NumberingSystem_cache, hashKey, (void*)ns, &status);
         }
@@ -1388,25 +1388,25 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
 
     // check results of getting a numbering system
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     if (mustBeDecimalFormat && ns->isAlgorithmic()) {
         status = U_UNSUPPORTED_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     LocalPointer<DecimalFormatSymbols> symbolsToAdopt;
     UnicodeString pattern;
-    LocalUResourceBundlePointer ownedResource(ures_open(NULL, desiredLocale.getName(), &status));
+    LocalUResourceBundlePointer ownedResource(ures_open(nullptr, desiredLocale.getName(), &status));
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     else {
         // Loads the decimal symbols of the desired locale.
         symbolsToAdopt.adoptInsteadAndCheckErrorCode(new DecimalFormatSymbols(desiredLocale, status), status);
         if (U_FAILURE(status)) {
-            return NULL;
+            return nullptr;
         }
 
         // Load the pattern from data using the common library function
@@ -1418,12 +1418,12 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
         pattern = UnicodeString(true, patternPtr, -1);
     }
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     if(style==UNUM_CURRENCY || style == UNUM_CURRENCY_ISO || style == UNUM_CURRENCY_ACCOUNTING 
         || style == UNUM_CASH_CURRENCY || style == UNUM_CURRENCY_STANDARD){
         const UChar* currPattern = symbolsToAdopt->getCurrencyPattern();
-        if(currPattern!=NULL){
+        if(currPattern!=nullptr){
             pattern.setTo(currPattern, u_strlen(currPattern));
         }
     }
@@ -1458,9 +1458,9 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
         }
 
         RuleBasedNumberFormat *r = new RuleBasedNumberFormat(desiredRulesType,nsLoc,status);
-        if (r == NULL) {
+        if (r == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
-            return NULL;
+            return nullptr;
         }
         r->setDefaultRuleSet(nsRuleSetName,status);
         f.adoptInstead(r);
@@ -1504,7 +1504,7 @@ NumberFormat::makeInstance(const Locale& desiredLocale,
     f->setLocaleIDs(ures_getLocaleByType(ownedResource.getAlias(), ULOC_VALID_LOCALE, &status),
                     ures_getLocaleByType(ownedResource.getAlias(), ULOC_ACTUAL_LOCALE, &status));
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     return f.orphan();
 }
index ffee174dcca532ae2b8b8e2bd5c3751d4f754815..19453ea3a3f427912d7e219c0dba4436725293ea 100644 (file)
@@ -92,7 +92,7 @@ class NumberRangeDataSink : public ResourceSink {
 
 void getNumberRangeData(const char* localeName, const char* nsName, NumberRangeData& data, UErrorCode& status) {
     if (U_FAILURE(status)) { return; }
-    LocalUResourceBundlePointer rb(ures_open(NULL, localeName, &status));
+    LocalUResourceBundlePointer rb(ures_open(nullptr, localeName, &status));
     if (U_FAILURE(status)) { return; }
     NumberRangeDataSink sink(data);
 
index e5c60f8cbe0ae8c8694d449eb4ab1cf996a6f134..b651115595143a23baf5705938c78f5dc72b0cc1 100644 (file)
@@ -52,10 +52,10 @@ static void debug_tz_msg(const char *pat, ...)
 #endif
 
 static UBool arrayEqual(const void *a1, const void *a2, int32_t size) {
-    if (a1 == NULL && a2 == NULL) {
+    if (a1 == nullptr && a2 == nullptr) {
         return true;
     }
-    if ((a1 != NULL && a2 == NULL) || (a1 == NULL && a2 != NULL)) {
+    if ((a1 != nullptr && a2 == nullptr) || (a1 == nullptr && a2 != nullptr)) {
         return false;
     }
     if (a1 == a2) {
@@ -97,17 +97,17 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(OlsonTimeZone)
  * constructor fails so the resultant object is well-behaved.
  */
 void OlsonTimeZone::constructEmpty() {
-    canonicalID = NULL;
+    canonicalID = nullptr;
 
     transitionCountPre32 = transitionCount32 = transitionCountPost32 = 0;
-    transitionTimesPre32 = transitionTimes32 = transitionTimesPost32 = NULL;
+    transitionTimesPre32 = transitionTimes32 = transitionTimesPost32 = nullptr;
 
-    typeMapData = NULL;
+    typeMapData = nullptr;
 
     typeCount = 1;
     typeOffsets = ZEROS;
 
-    finalZone = NULL;
+    finalZone = nullptr;
 }
 
 /**
@@ -121,11 +121,11 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
                              const UResourceBundle* res,
                              const UnicodeString& tzid,
                              UErrorCode& ec) :
-  BasicTimeZone(tzid), finalZone(NULL)
+  BasicTimeZone(tzid), finalZone(nullptr)
 {
     clearTransitionRules();
     U_DEBUG_TZ_MSG(("OlsonTimeZone(%s)\n", ures_getKey((UResourceBundle*)res)));
-    if ((top == NULL || res == NULL) && U_SUCCESS(ec)) {
+    if ((top == nullptr || res == nullptr) && U_SUCCESS(ec)) {
         ec = U_ILLEGAL_ARGUMENT_ERROR;
     }
     if (U_SUCCESS(ec)) {
@@ -142,7 +142,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
         transitionCountPre32 = static_cast<int16_t>(len >> 1);
         if (ec == U_MISSING_RESOURCE_ERROR) {
             // No pre-32bit transitions
-            transitionTimesPre32 = NULL;
+            transitionTimesPre32 = nullptr;
             transitionCountPre32 = 0;
             ec = U_ZERO_ERROR;
         } else if (U_SUCCESS(ec) && (len < 0 || len > 0x7FFF || (len & 1) != 0) /* len must be even */) {
@@ -155,7 +155,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
         transitionCount32 = static_cast<int16_t>(len);
         if (ec == U_MISSING_RESOURCE_ERROR) {
             // No 32bit transitions
-            transitionTimes32 = NULL;
+            transitionTimes32 = nullptr;
             transitionCount32 = 0;
             ec = U_ZERO_ERROR;
         } else if (U_SUCCESS(ec) && (len < 0 || len > 0x7FFF)) {
@@ -168,7 +168,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
         transitionCountPost32 = static_cast<int16_t>(len >> 1);
         if (ec == U_MISSING_RESOURCE_ERROR) {
             // No pre-32bit transitions
-            transitionTimesPost32 = NULL;
+            transitionTimesPost32 = nullptr;
             transitionCountPost32 = 0;
             ec = U_ZERO_ERROR;
         } else if (U_SUCCESS(ec) && (len < 0 || len > 0x7FFF || (len & 1) != 0) /* len must be even */) {
@@ -184,7 +184,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
         typeCount = (int16_t) len >> 1;
 
         // Type map data must be of the same size as the transition count
-        typeMapData =  NULL;
+        typeMapData =  nullptr;
         if (transitionCount() > 0) {
             ures_getByKey(res, kTYPEMAP, r.getAlias(), &ec);
             typeMapData = ures_getBinary(r.getAlias(), &len, &ec);
@@ -205,7 +205,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
             int32_t ruleYear = ures_getInt(r.getAlias(), &ec);
             if (U_SUCCESS(ec)) {
                 UnicodeString ruleID(true, ruleIdUStr, len);
-                UResourceBundle *rule = TimeZone::loadRule(top, ruleID, NULL, ec);
+                UResourceBundle *rule = TimeZone::loadRule(top, ruleID, nullptr, ec);
                 const int32_t *ruleData = ures_getIntVector(rule, &len, &ec); 
                 if (U_SUCCESS(ec) && len == 11) {
                     UnicodeString emptyStr;
@@ -219,7 +219,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
                         ruleData[8] * U_MILLIS_PER_SECOND,
                         (SimpleTimeZone::TimeMode) ruleData[9],
                         ruleData[10] * U_MILLIS_PER_SECOND, ec);
-                    if (finalZone == NULL) {
+                    if (finalZone == nullptr) {
                         ec = U_MEMORY_ALLOCATION_ERROR;
                     } else {
                         finalStartYear = ruleYear;
@@ -373,7 +373,7 @@ int32_t OlsonTimeZone::getOffset(uint8_t era, int32_t year, int32_t month,
         year = -year;
     }
 
-    if (finalZone != NULL && year >= finalStartYear) {
+    if (finalZone != nullptr && year >= finalStartYear) {
         return finalZone->getOffset(era, year, month, dom, dow,
                                     millis, monthLength, ec);
     }
@@ -393,7 +393,7 @@ void OlsonTimeZone::getOffset(UDate date, UBool local, int32_t& rawoff,
     if (U_FAILURE(ec)) {
         return;
     }
-    if (finalZone != NULL && date >= finalStartMillis) {
+    if (finalZone != nullptr && date >= finalStartMillis) {
         finalZone->getOffset(date, local, rawoff, dstoff, ec);
     } else {
         getHistoricalOffset(date, local, kFormer, kLatter, rawoff, dstoff);
@@ -406,7 +406,7 @@ void OlsonTimeZone::getOffsetFromLocal(UDate date, UTimeZoneLocalOption nonExist
     if (U_FAILURE(ec)) {
         return;
     }
-    if (finalZone != NULL && date >= finalStartMillis) {
+    if (finalZone != nullptr && date >= finalStartMillis) {
         finalZone->getOffsetFromLocal(date, nonExistingTimeOpt, duplicatedTimeOpt, rawoff, dstoff, ec);
     } else {
         getHistoricalOffset(date, true, nonExistingTimeOpt, duplicatedTimeOpt, rawoff, dstoff);
@@ -564,7 +564,7 @@ UBool OlsonTimeZone::useDaylightTime() const {
     // and returns true if so.
 
     UDate current = uprv_getUTCtime();
-    if (finalZone != NULL && current >= finalStartMillis) {
+    if (finalZone != nullptr && current >= finalStartMillis) {
         return finalZone->useDaylightTime();
     }
 
@@ -591,7 +591,7 @@ UBool OlsonTimeZone::useDaylightTime() const {
 }
 int32_t 
 OlsonTimeZone::getDSTSavings() const{
-    if (finalZone != NULL){
+    if (finalZone != nullptr){
         return finalZone->getDSTSavings();
     }
     return TimeZone::getDSTSavings();
@@ -611,7 +611,7 @@ OlsonTimeZone::hasSameRules(const TimeZone &other) const {
         return true;
     }
     const OlsonTimeZone* z = dynamic_cast<const OlsonTimeZone*>(&other);
-    if (z == NULL) {
+    if (z == nullptr) {
         return false;
     }
 
@@ -624,13 +624,13 @@ OlsonTimeZone::hasSameRules(const TimeZone &other) const {
     
     // If the pointers are not equal, the zones may still
     // be equal if their rules and transitions are equal
-    if ((finalZone == NULL && z->finalZone != NULL)
-        || (finalZone != NULL && z->finalZone == NULL)
-        || (finalZone != NULL && z->finalZone != NULL && *finalZone != *z->finalZone)) {
+    if ((finalZone == nullptr && z->finalZone != nullptr)
+        || (finalZone != nullptr && z->finalZone == nullptr)
+        || (finalZone != nullptr && z->finalZone != nullptr && *finalZone != *z->finalZone)) {
         return false;
     }
 
-    if (finalZone != NULL) {
+    if (finalZone != nullptr) {
         if (finalStartYear != z->finalStartYear || finalStartMillis != z->finalStartMillis) {
             return false;
         }
@@ -652,33 +652,33 @@ OlsonTimeZone::hasSameRules(const TimeZone &other) const {
 
 void
 OlsonTimeZone::clearTransitionRules(void) {
-    initialRule = NULL;
-    firstTZTransition = NULL;
-    firstFinalTZTransition = NULL;
-    historicRules = NULL;
+    initialRule = nullptr;
+    firstTZTransition = nullptr;
+    firstFinalTZTransition = nullptr;
+    historicRules = nullptr;
     historicRuleCount = 0;
-    finalZoneWithStartYear = NULL;
+    finalZoneWithStartYear = nullptr;
     firstTZTransitionIdx = 0;
     transitionRulesInitOnce.reset();
 }
 
 void
 OlsonTimeZone::deleteTransitionRules(void) {
-    if (initialRule != NULL) {
+    if (initialRule != nullptr) {
         delete initialRule;
     }
-    if (firstTZTransition != NULL) {
+    if (firstTZTransition != nullptr) {
         delete firstTZTransition;
     }
-    if (firstFinalTZTransition != NULL) {
+    if (firstFinalTZTransition != nullptr) {
         delete firstFinalTZTransition;
     }
-    if (finalZoneWithStartYear != NULL) {
+    if (finalZoneWithStartYear != nullptr) {
         delete finalZoneWithStartYear;
     }
-    if (historicRules != NULL) {
+    if (historicRules != nullptr) {
         for (int i = 0; i < historicRuleCount; i++) {
-            if (historicRules[i] != NULL) {
+            if (historicRules[i] != nullptr) {
                 delete historicRules[i];
             }
         }
@@ -720,7 +720,7 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) {
     dst = initialDstOffset() * U_MILLIS_PER_SECOND;
     initialRule = new InitialTimeZoneRule((dst == 0 ? stdName : dstName), raw, dst);
     // Check to make sure initialRule was created
-    if (initialRule == NULL) {
+    if (initialRule == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         deleteTransitionRules();
         return;
@@ -745,7 +745,7 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) {
         } else {
             // Build historic rule array
             UDate* times = (UDate*)uprv_malloc(sizeof(UDate)*transCount); /* large enough to store all transition times */
-            if (times == NULL) {
+            if (times == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 deleteTransitionRules();
                 return;
@@ -756,7 +756,7 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) {
                 for (transitionIdx = firstTZTransitionIdx; transitionIdx < transCount; transitionIdx++) {
                     if (typeIdx == (int16_t)typeMapData[transitionIdx]) {
                         UDate tt = (UDate)transitionTime(transitionIdx);
-                        if (finalZone == NULL || tt <= finalStartMillis) {
+                        if (finalZone == nullptr || tt <= finalStartMillis) {
                             // Exclude transitions after finalMillis
                             times[nTimes++] = tt;
                         }
@@ -766,24 +766,24 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) {
                     // Create a TimeArrayTimeZoneRule
                     raw = typeOffsets[typeIdx << 1] * U_MILLIS_PER_SECOND;
                     dst = typeOffsets[(typeIdx << 1) + 1] * U_MILLIS_PER_SECOND;
-                    if (historicRules == NULL) {
+                    if (historicRules == nullptr) {
                         historicRuleCount = typeCount;
                         historicRules = (TimeArrayTimeZoneRule**)uprv_malloc(sizeof(TimeArrayTimeZoneRule*)*historicRuleCount);
-                        if (historicRules == NULL) {
+                        if (historicRules == nullptr) {
                             status = U_MEMORY_ALLOCATION_ERROR;
                             deleteTransitionRules();
                             uprv_free(times);
                             return;
                         }
                         for (int i = 0; i < historicRuleCount; i++) {
-                            // Initialize TimeArrayTimeZoneRule pointers as NULL
-                            historicRules[i] = NULL;
+                            // Initialize TimeArrayTimeZoneRule pointers as nullptr
+                            historicRules[i] = nullptr;
                         }
                     }
                     historicRules[typeIdx] = new TimeArrayTimeZoneRule((dst == 0 ? stdName : dstName),
                         raw, dst, times, nTimes, DateTimeRule::UTC_TIME);
                     // Check for memory allocation error
-                    if (historicRules[typeIdx] == NULL) {
+                    if (historicRules[typeIdx] == nullptr) {
                         status = U_MEMORY_ALLOCATION_ERROR;
                         deleteTransitionRules();
                         return;
@@ -797,17 +797,17 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) {
             firstTZTransition = new TimeZoneTransition((UDate)transitionTime(firstTZTransitionIdx),
                     *initialRule, *historicRules[typeIdx]);
             // Check to make sure firstTZTransition was created.
-            if (firstTZTransition == NULL) {
+            if (firstTZTransition == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 deleteTransitionRules();
                 return;
             }
         }
     }
-    if (finalZone != NULL) {
+    if (finalZone != nullptr) {
         // Get the first occurrence of final rule starts
         UDate startTime = (UDate)finalStartMillis;
-        TimeZoneRule *firstFinalRule = NULL;
+        TimeZoneRule *firstFinalRule = nullptr;
 
         if (finalZone->useDaylightTime()) {
             /*
@@ -819,7 +819,7 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) {
              */
             finalZoneWithStartYear = finalZone->clone();
             // Check to make sure finalZone was actually cloned.
-            if (finalZoneWithStartYear == NULL) {
+            if (finalZoneWithStartYear == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 deleteTransitionRules();
                 return;
@@ -830,7 +830,7 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) {
             finalZoneWithStartYear->getNextTransition(startTime, false, tzt);
             firstFinalRule  = tzt.getTo()->clone();
             // Check to make sure firstFinalRule received proper clone.
-            if (firstFinalRule == NULL) {
+            if (firstFinalRule == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 deleteTransitionRules();
                 return;
@@ -840,7 +840,7 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) {
             // final rule with no transitions
             finalZoneWithStartYear = finalZone->clone();
             // Check to make sure finalZone was actually cloned.
-            if (finalZoneWithStartYear == NULL) {
+            if (finalZoneWithStartYear == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 deleteTransitionRules();
                 return;
@@ -849,23 +849,23 @@ OlsonTimeZone::initTransitionRules(UErrorCode& status) {
             firstFinalRule = new TimeArrayTimeZoneRule(tzid,
                 finalZone->getRawOffset(), 0, &startTime, 1, DateTimeRule::UTC_TIME);
             // Check firstFinalRule was properly created.
-            if (firstFinalRule == NULL) {
+            if (firstFinalRule == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 deleteTransitionRules();
                 return;
             }
         }
-        TimeZoneRule *prevRule = NULL;
+        TimeZoneRule *prevRule = nullptr;
         if (transCount > 0) {
             prevRule = historicRules[typeMapData[transCount - 1]];
         }
-        if (prevRule == NULL) {
+        if (prevRule == nullptr) {
             // No historic transitions, but only finalZone available
             prevRule = initialRule;
         }
         firstFinalTZTransition = new TimeZoneTransition();
         // Check to make sure firstFinalTZTransition was created before dereferencing
-        if (firstFinalTZTransition == NULL) {
+        if (firstFinalTZTransition == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             deleteTransitionRules();
             return;
@@ -884,7 +884,7 @@ OlsonTimeZone::getNextTransition(UDate base, UBool inclusive, TimeZoneTransition
         return false;
     }
 
-    if (finalZone != NULL) {
+    if (finalZone != nullptr) {
         if (inclusive && base == firstFinalTZTransition->getTime()) {
             result = *firstFinalTZTransition;
             return true;
@@ -898,7 +898,7 @@ OlsonTimeZone::getNextTransition(UDate base, UBool inclusive, TimeZoneTransition
             }
         }
     }
-    if (historicRules != NULL) {
+    if (historicRules != nullptr) {
         // Find a historical transition
         int16_t transCount = transitionCount();
         int16_t ttidx = transCount - 1;
@@ -909,7 +909,7 @@ OlsonTimeZone::getNextTransition(UDate base, UBool inclusive, TimeZoneTransition
             }
         }
         if (ttidx == transCount - 1)  {
-            if (firstFinalTZTransition != NULL) {
+            if (firstFinalTZTransition != nullptr) {
                 result = *firstFinalTZTransition;
                 return true;
             } else {
@@ -949,7 +949,7 @@ OlsonTimeZone::getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransi
         return false;
     }
 
-    if (finalZone != NULL) {
+    if (finalZone != nullptr) {
         if (inclusive && base == firstFinalTZTransition->getTime()) {
             result = *firstFinalTZTransition;
             return true;
@@ -964,7 +964,7 @@ OlsonTimeZone::getPreviousTransition(UDate base, UBool inclusive, TimeZoneTransi
         }
     }
 
-    if (historicRules != NULL) {
+    if (historicRules != nullptr) {
         // Find a historical transition
         int16_t ttidx = transitionCount() - 1;
         for (; ttidx >= firstTZTransitionIdx; ttidx--) {
@@ -1013,16 +1013,16 @@ OlsonTimeZone::countTransitionRules(UErrorCode& status) const {
     }
 
     int32_t count = 0;
-    if (historicRules != NULL) {
+    if (historicRules != nullptr) {
         // historicRules may contain null entries when original zoneinfo data
         // includes non transition data.
         for (int32_t i = 0; i < historicRuleCount; i++) {
-            if (historicRules[i] != NULL) {
+            if (historicRules[i] != nullptr) {
                 count++;
             }
         }
     }
-    if (finalZone != NULL) {
+    if (finalZone != nullptr) {
         if (finalZone->useDaylightTime()) {
             count += 2;
         } else {
@@ -1050,11 +1050,11 @@ OlsonTimeZone::getTimeZoneRules(const InitialTimeZoneRule*& initial,
 
     // Transition rules
     int32_t cnt = 0;
-    if (historicRules != NULL && trscount > cnt) {
+    if (historicRules != nullptr && trscount > cnt) {
         // historicRules may contain null entries when original zoneinfo data
         // includes non transition data.
         for (int32_t i = 0; i < historicRuleCount; i++) {
-            if (historicRules[i] != NULL) {
+            if (historicRules[i] != nullptr) {
                 trsrules[cnt++] = historicRules[i];
                 if (cnt >= trscount) {
                     break;
@@ -1062,7 +1062,7 @@ OlsonTimeZone::getTimeZoneRules(const InitialTimeZoneRule*& initial,
             }
         }
     }
-    if (finalZoneWithStartYear != NULL && trscount > cnt) {
+    if (finalZoneWithStartYear != nullptr && trscount > cnt) {
         const InitialTimeZoneRule *tmpini;
         int32_t tmpcnt = trscount - cnt;
         finalZoneWithStartYear->getTimeZoneRules(tmpini, &trsrules[cnt], tmpcnt, status);
index 525bbd2b129ccd382bd0b4983399e78e839ff0d8..728f94460efed50ca4b799ec99e88cc783e49c8c 100644 (file)
@@ -263,7 +263,7 @@ class U_I18N_API OlsonTimeZone: public BasicTimeZone {
     /**
      * Gets the <code>InitialTimeZoneRule</code> and the set of <code>TimeZoneRule</code>
      * which represent time transitions for this time zone.  On successful return,
-     * the argument initial points to non-NULL <code>InitialTimeZoneRule</code> and
+     * the argument initial points to non-nullptr <code>InitialTimeZoneRule</code> and
      * the array trsrules is filled with 0 or multiple <code>TimeZoneRule</code>
      * instances up to the size specified by trscount.  The results are referencing the
      * rule instance held by this time zone instance.  Therefore, after this time zone
@@ -328,20 +328,20 @@ private:
     /**
      * Time of each transition in seconds from 1970 epoch before 32bit second range (<= 1900).
      * Each transition in this range is represented by a pair of int32_t.
-     * Length is transitionCount int32_t's.  NULL if no transitions in this range.
+     * Length is transitionCount int32_t's.  nullptr if no transitions in this range.
      */
     const int32_t *transitionTimesPre32; // alias into res; do not delete
 
     /**
      * Time of each transition in seconds from 1970 epoch in 32bit second range.
-     * Length is transitionCount int32_t's.  NULL if no transitions in this range.
+     * Length is transitionCount int32_t's.  nullptr if no transitions in this range.
      */
     const int32_t *transitionTimes32; // alias into res; do not delete
 
     /**
      * Time of each transition in seconds from 1970 epoch after 32bit second range (>= 2038).
      * Each transition in this range is represented by a pair of int32_t.
-     * Length is transitionCount int32_t's.  NULL if no transitions in this range.
+     * Length is transitionCount int32_t's.  nullptr if no transitions in this range.
      */
     const int32_t *transitionTimesPost32; // alias into res; do not delete
 
@@ -360,14 +360,14 @@ private:
     /**
      * Type description data, consisting of transitionCount uint8_t
      * type indices (from 0..typeCount-1).
-     * Length is transitionCount int16_t's.  NULL if no transitions.
+     * Length is transitionCount int16_t's.  nullptr if no transitions.
      */
     const uint8_t *typeMapData; // alias into res; do not delete
 
     /**
      * A SimpleTimeZone that governs the behavior for date >= finalMillis.
      */
-    SimpleTimeZone *finalZone; // owned, may be NULL
+    SimpleTimeZone *finalZone; // owned, may be nullptr
 
     /**
      * For date >= finalMillis, the finalZone will be used.
index 3b8f3a660e575c7d3e45311466a4a3629e9c7da6..5ce4d8b1b4f64badf96c27120f05e865a0e3b2e0 100644 (file)
@@ -40,23 +40,23 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(PluralFormat)
 PluralFormat::PluralFormat(UErrorCode& status)
         : locale(Locale::getDefault()),
           msgPattern(status),
-          numberFormat(NULL),
+          numberFormat(nullptr),
           offset(0) {
-    init(NULL, UPLURAL_TYPE_CARDINAL, status);
+    init(nullptr, UPLURAL_TYPE_CARDINAL, status);
 }
 
 PluralFormat::PluralFormat(const Locale& loc, UErrorCode& status)
         : locale(loc),
           msgPattern(status),
-          numberFormat(NULL),
+          numberFormat(nullptr),
           offset(0) {
-    init(NULL, UPLURAL_TYPE_CARDINAL, status);
+    init(nullptr, UPLURAL_TYPE_CARDINAL, status);
 }
 
 PluralFormat::PluralFormat(const PluralRules& rules, UErrorCode& status)
         : locale(Locale::getDefault()),
           msgPattern(status),
-          numberFormat(NULL),
+          numberFormat(nullptr),
           offset(0) {
     init(&rules, UPLURAL_TYPE_COUNT, status);
 }
@@ -66,7 +66,7 @@ PluralFormat::PluralFormat(const Locale& loc,
                            UErrorCode& status)
         : locale(loc),
           msgPattern(status),
-          numberFormat(NULL),
+          numberFormat(nullptr),
           offset(0) {
     init(&rules, UPLURAL_TYPE_COUNT, status);
 }
@@ -76,18 +76,18 @@ PluralFormat::PluralFormat(const Locale& loc,
                            UErrorCode& status)
         : locale(loc),
           msgPattern(status),
-          numberFormat(NULL),
+          numberFormat(nullptr),
           offset(0) {
-    init(NULL, type, status);
+    init(nullptr, type, status);
 }
 
 PluralFormat::PluralFormat(const UnicodeString& pat,
                            UErrorCode& status)
         : locale(Locale::getDefault()),
           msgPattern(status),
-          numberFormat(NULL),
+          numberFormat(nullptr),
           offset(0) {
-    init(NULL, UPLURAL_TYPE_CARDINAL, status);
+    init(nullptr, UPLURAL_TYPE_CARDINAL, status);
     applyPattern(pat, status);
 }
 
@@ -96,9 +96,9 @@ PluralFormat::PluralFormat(const Locale& loc,
                            UErrorCode& status)
         : locale(loc),
           msgPattern(status),
-          numberFormat(NULL),
+          numberFormat(nullptr),
           offset(0) {
-    init(NULL, UPLURAL_TYPE_CARDINAL, status);
+    init(nullptr, UPLURAL_TYPE_CARDINAL, status);
     applyPattern(pat, status);
 }
 
@@ -107,7 +107,7 @@ PluralFormat::PluralFormat(const PluralRules& rules,
                            UErrorCode& status)
         : locale(Locale::getDefault()),
           msgPattern(status),
-          numberFormat(NULL),
+          numberFormat(nullptr),
           offset(0) {
     init(&rules, UPLURAL_TYPE_COUNT, status);
     applyPattern(pat, status);
@@ -119,7 +119,7 @@ PluralFormat::PluralFormat(const Locale& loc,
                            UErrorCode& status)
         : locale(loc),
           msgPattern(status),
-          numberFormat(NULL),
+          numberFormat(nullptr),
           offset(0) {
     init(&rules, UPLURAL_TYPE_COUNT, status);
     applyPattern(pat, status);
@@ -131,9 +131,9 @@ PluralFormat::PluralFormat(const Locale& loc,
                            UErrorCode& status)
         : locale(loc),
           msgPattern(status),
-          numberFormat(NULL),
+          numberFormat(nullptr),
           offset(0) {
-    init(NULL, type, status);
+    init(nullptr, type, status);
     applyPattern(pat, status);
 }
 
@@ -141,7 +141,7 @@ PluralFormat::PluralFormat(const PluralFormat& other)
         : Format(other),
           locale(other.locale),
           msgPattern(other.msgPattern),
-          numberFormat(NULL),
+          numberFormat(nullptr),
           offset(other.offset) {
     copyObjects(other);
 }
@@ -149,19 +149,19 @@ PluralFormat::PluralFormat(const PluralFormat& other)
 void
 PluralFormat::copyObjects(const PluralFormat& other) {
     UErrorCode status = U_ZERO_ERROR;
-    if (numberFormat != NULL) {
+    if (numberFormat != nullptr) {
         delete numberFormat;
     }
-    if (pluralRulesWrapper.pluralRules != NULL) {
+    if (pluralRulesWrapper.pluralRules != nullptr) {
         delete pluralRulesWrapper.pluralRules;
     }
 
-    if (other.numberFormat == NULL) {
+    if (other.numberFormat == nullptr) {
         numberFormat = NumberFormat::createInstance(locale, status);
     } else {
         numberFormat = other.numberFormat->clone();
     }
-    if (other.pluralRulesWrapper.pluralRules == NULL) {
+    if (other.pluralRulesWrapper.pluralRules == nullptr) {
         pluralRulesWrapper.pluralRules = PluralRules::forLocale(locale, status);
     } else {
         pluralRulesWrapper.pluralRules = other.pluralRulesWrapper.pluralRules->clone();
@@ -179,11 +179,11 @@ PluralFormat::init(const PluralRules* rules, UPluralType type, UErrorCode& statu
         return;
     }
 
-    if (rules==NULL) {
+    if (rules==nullptr) {
         pluralRulesWrapper.pluralRules = PluralRules::forLocale(locale, type, status);
     } else {
         pluralRulesWrapper.pluralRules = rules->clone();
-        if (pluralRulesWrapper.pluralRules == NULL) {
+        if (pluralRulesWrapper.pluralRules == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
@@ -194,7 +194,7 @@ PluralFormat::init(const PluralRules* rules, UPluralType type, UErrorCode& statu
 
 void
 PluralFormat::applyPattern(const UnicodeString& newPattern, UErrorCode& status) {
-    msgPattern.parsePluralStyle(newPattern, NULL, status);
+    msgPattern.parsePluralStyle(newPattern, nullptr, status);
     if (U_FAILURE(status)) {
         msgPattern.clear();
         offset = 0;
@@ -343,9 +343,9 @@ PluralFormat::setLocale(const Locale& loc, UErrorCode& status) {
     msgPattern.clear();
     delete numberFormat;
     offset = 0;
-    numberFormat = NULL;
+    numberFormat = nullptr;
     pluralRulesWrapper.reset();
-    init(NULL, UPLURAL_TYPE_CARDINAL, status);
+    init(nullptr, UPLURAL_TYPE_CARDINAL, status);
 }
 
 void
@@ -354,7 +354,7 @@ PluralFormat::setNumberFormat(const NumberFormat* format, UErrorCode& status) {
         return;
     }
     NumberFormat* nf = format->clone();
-    if (nf != NULL) {
+    if (nf != nullptr) {
         delete numberFormat;
         numberFormat = nf;
     } else {
@@ -393,10 +393,10 @@ PluralFormat::operator==(const Format& other) const {
     return
         locale == o.locale &&
         msgPattern == o.msgPattern &&  // implies same offset
-        (numberFormat == NULL) == (o.numberFormat == NULL) &&
-        (numberFormat == NULL || *numberFormat == *o.numberFormat) &&
-        (pluralRulesWrapper.pluralRules == NULL) == (o.pluralRulesWrapper.pluralRules == NULL) &&
-        (pluralRulesWrapper.pluralRules == NULL ||
+        (numberFormat == nullptr) == (o.numberFormat == nullptr) &&
+        (numberFormat == nullptr || *numberFormat == *o.numberFormat) &&
+        (pluralRulesWrapper.pluralRules == nullptr) == (o.pluralRulesWrapper.pluralRules == nullptr) &&
+        (pluralRulesWrapper.pluralRules == nullptr ||
             *pluralRulesWrapper.pluralRules == *o.pluralRulesWrapper.pluralRules);
 }
 
@@ -548,7 +548,7 @@ void PluralFormat::parseType(const UnicodeString& source, const NFRule *rbnfLeni
         }
 
         UnicodeString currArg = pattern.tempSubString(partStart->getLimit(), partLimit->getIndex() - partStart->getLimit());
-        if (rbnfLenientScanner != NULL) {
+        if (rbnfLenientScanner != nullptr) {
             // Check if non-lenient rule finds the text before call lenient parsing
             int32_t tempIndex = source.indexOf(currArg, startingAt);
             if (tempIndex >= 0) {
@@ -595,7 +595,7 @@ UnicodeString PluralFormat::PluralSelectorAdapter::select(void *context, double
 
 void PluralFormat::PluralSelectorAdapter::reset() {
     delete pluralRules;
-    pluralRules = NULL;
+    pluralRules = nullptr;
 }
 
 
index 7b4d51e803f045020159877d8e036fd33cc2b126..0a1982e3d4c86d658d3200a90670ab32be74ade0 100644 (file)
@@ -32,14 +32,14 @@ U_NAMESPACE_BEGIN
 
 QuantityFormatter::QuantityFormatter() {
     for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) {
-        formatters[i] = NULL;
+        formatters[i] = nullptr;
     }
 }
 
 QuantityFormatter::QuantityFormatter(const QuantityFormatter &other) {
     for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) {
-        if (other.formatters[i] == NULL) {
-            formatters[i] = NULL;
+        if (other.formatters[i] == nullptr) {
+            formatters[i] = nullptr;
         } else {
             formatters[i] = new SimpleFormatter(*other.formatters[i]);
         }
@@ -53,8 +53,8 @@ QuantityFormatter &QuantityFormatter::operator=(
     }
     for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) {
         delete formatters[i];
-        if (other.formatters[i] == NULL) {
-            formatters[i] = NULL;
+        if (other.formatters[i] == nullptr) {
+            formatters[i] = nullptr;
         } else {
             formatters[i] = new SimpleFormatter(*other.formatters[i]);
         }
@@ -71,7 +71,7 @@ QuantityFormatter::~QuantityFormatter() {
 void QuantityFormatter::reset() {
     for (int32_t i = 0; i < UPRV_LENGTHOF(formatters); ++i) {
         delete formatters[i];
-        formatters[i] = NULL;
+        formatters[i] = nullptr;
     }
 }
 
@@ -83,11 +83,11 @@ UBool QuantityFormatter::addIfAbsent(
     if (U_FAILURE(status)) {
         return false;
     }
-    if (formatters[pluralIndex] != NULL) {
+    if (formatters[pluralIndex] != nullptr) {
         return true;
     }
     SimpleFormatter *newFmt = new SimpleFormatter(rawPattern, 0, 1, status);
-    if (newFmt == NULL) {
+    if (newFmt == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return false;
     }
@@ -100,7 +100,7 @@ UBool QuantityFormatter::addIfAbsent(
 }
 
 UBool QuantityFormatter::isValid() const {
-    return formatters[StandardPlural::OTHER] != NULL;
+    return formatters[StandardPlural::OTHER] != nullptr;
 }
 
 const SimpleFormatter *QuantityFormatter::getByVariant(
@@ -108,7 +108,7 @@ const SimpleFormatter *QuantityFormatter::getByVariant(
     U_ASSERT(isValid());
     int32_t pluralIndex = StandardPlural::indexOrOtherIndexFromString(variant);
     const SimpleFormatter *pattern = formatters[pluralIndex];
-    if (pattern == NULL) {
+    if (pattern == nullptr) {
         pattern = formatters[StandardPlural::OTHER];
     }
     return pattern;
@@ -127,9 +127,9 @@ UnicodeString &QuantityFormatter::format(
         return appendTo;
     }
     const SimpleFormatter *pattern = formatters[p];
-    if (pattern == NULL) {
+    if (pattern == nullptr) {
         pattern = formatters[StandardPlural::OTHER];
-        if (pattern == NULL) {
+        if (pattern == nullptr) {
             status = U_INVALID_STATE_ERROR;
             return appendTo;
         }
@@ -152,7 +152,7 @@ StandardPlural::Form QuantityFormatter::selectPlural(
     }
     UnicodeString pluralKeyword;
     const DecimalFormat *decFmt = dynamic_cast<const DecimalFormat *>(&fmt);
-    if (decFmt != NULL) {
+    if (decFmt != nullptr) {
         number::impl::DecimalQuantity dq;
         decFmt->formatToDecimalQuantity(number, dq, status);
         if (U_FAILURE(status)) {
index 841798cf8892550d99417f75816571e2b4fede0c..ca0c0ee37119e1880e141da670343b3e2913007c 100644 (file)
@@ -86,7 +86,7 @@ public:
     /**
      * Gets the pattern formatter that would be used for a particular variant.
      * If isValid() returns true, this method is guaranteed to return a
-     * non-NULL value.
+     * non-nullptr value.
      */
     const SimpleFormatter *getByVariant(const char *variant) const;
 
index 3d0da00bdb83174e0b79c8ee635da56e76a03adb..ea503a0e4b8b3f02fd4a52b5745feae6d379905b 100644 (file)
@@ -96,7 +96,7 @@ public:
         if (refcount && --refcount == 0) {
             delete this;
         }
-        return NULL;
+        return nullptr;
     }
     
     virtual bool operator==(const LocalizationInfo* rhs) const;
@@ -119,7 +119,7 @@ LocalizationInfo::~LocalizationInfo() {}
 
 //UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(LocalizationInfo)
 
-// if both strings are NULL, this returns true
+// if both strings are nullptr, this returns true
 static UBool 
 streq(const UChar* lhs, const UChar* rhs) {
     if (rhs == lhs) {
@@ -198,9 +198,9 @@ class VArray {
     int32_t size;
     Fn_Deleter deleter;
 public:
-    VArray() : buf(NULL), cap(0), size(0), deleter(NULL) {}
+    VArray() : buf(nullptr), cap(0), size(0), deleter(nullptr) {}
     
-    VArray(Fn_Deleter del) : buf(NULL), cap(0), size(0), deleter(del) {}
+    VArray(Fn_Deleter del) : buf(nullptr), cap(0), size(0), deleter(del) {}
     
     ~VArray() {
         if (deleter) {
@@ -225,12 +225,12 @@ public:
                 } else {
                     cap += 256;
                 }
-                if (buf == NULL) {
+                if (buf == nullptr) {
                     buf = (void**)uprv_malloc(cap * sizeof(void*));
                 } else {
                     buf = (void**)uprv_realloc(buf, cap * sizeof(void*));
                 }
-                if (buf == NULL) {
+                if (buf == nullptr) {
                     // if we couldn't realloc, we leak the memory we've already allocated, but we're in deep trouble anyway
                     status = U_MEMORY_ALLOCATION_ERROR;
                     return;
@@ -245,7 +245,7 @@ public:
     
     void** release(void) {
         void** result = buf;
-        buf = NULL;
+        buf = nullptr;
         cap = 0;
         size = 0;
         return result;
@@ -307,12 +307,12 @@ class LocDataParser {
     
 public:
     LocDataParser(UParseError& parseError, UErrorCode& status) 
-        : data(NULL), e(NULL), p(NULL), ch(0xffff), pe(parseError), ec(status) {}
+        : data(nullptr), e(nullptr), p(nullptr), ch(0xffff), pe(parseError), ec(status) {}
     ~LocDataParser() {}
     
     /*
     * On a successful parse, return a StringLocalizationInfo*, otherwise delete locData, set perror and status,
-    * and return NULL.  The StringLocalizationInfo will adopt locData if it is created.
+    * and return nullptr.  The StringLocalizationInfo will adopt locData if it is created.
     */
     StringLocalizationInfo* parse(UChar* data, int32_t len);
     
@@ -357,13 +357,13 @@ private:
 #ifdef RBNF_DEBUG
 #define ERROR(msg) UPRV_BLOCK_MACRO_BEGIN { \
     parseError(msg); \
-    return NULL; \
+    return nullptr; \
 } UPRV_BLOCK_MACRO_END
 #define EXPLANATION_ARG explanationArg
 #else
 #define ERROR(msg) UPRV_BLOCK_MACRO_BEGIN { \
-    parseError(NULL); \
-    return NULL; \
+    parseError(nullptr); \
+    return nullptr; \
 } UPRV_BLOCK_MACRO_END
 #define EXPLANATION_ARG
 #endif
@@ -390,7 +390,7 @@ StringLocalizationInfo*
 LocDataParser::parse(UChar* _data, int32_t len) {
     if (U_FAILURE(ec)) {
         if (_data) uprv_free(_data);
-        return NULL;
+        return nullptr;
     }
 
     pe.line = 0;
@@ -398,15 +398,15 @@ LocDataParser::parse(UChar* _data, int32_t len) {
     pe.postContext[0] = 0;
     pe.preContext[0] = 0;
 
-    if (_data == NULL) {
+    if (_data == nullptr) {
         ec = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     if (len <= 0) {
         ec = U_ILLEGAL_ARGUMENT_ERROR;
         uprv_free(_data);
-        return NULL;
+        return nullptr;
     }
 
     data = _data;
@@ -457,12 +457,12 @@ LocDataParser::doParse(void) {
             ERROR("Extra text after close of localization data");
         }
 
-        array.add(NULL, ec);
+        array.add(nullptr, ec);
         if (U_SUCCESS(ec)) {
-            int32_t numLocs = array.length() - 2; // subtract first, NULL
+            int32_t numLocs = array.length() - 2; // subtract first, nullptr
             UChar*** result = (UChar***)array.release();
             
-            return new StringLocalizationInfo(data, result, requiredLength-2, numLocs); // subtract first, NULL
+            return new StringLocalizationInfo(data, result, requiredLength-2, numLocs); // subtract first, nullptr
         }
     }
   
@@ -472,7 +472,7 @@ LocDataParser::doParse(void) {
 UChar**
 LocDataParser::nextArray(int32_t& requiredLength) {
     if (U_FAILURE(ec)) {
-        return NULL;
+        return nullptr;
     }
     
     skipWhitespace();
@@ -506,7 +506,7 @@ LocDataParser::nextArray(int32_t& requiredLength) {
         }
     }
 
-    array.add(NULL, ec);
+    array.add(nullptr, ec);
     if (U_SUCCESS(ec)) {
         if (requiredLength == -1) {
             requiredLength = array.length() + 1;
@@ -522,7 +522,7 @@ LocDataParser::nextArray(int32_t& requiredLength) {
 
 UChar*
 LocDataParser::nextString() {
-    UChar* result = NULL;
+    UChar* result = nullptr;
     
     skipWhitespace();
     if (p < e) {
@@ -610,9 +610,9 @@ void LocDataParser::parseError(const char* EXPLANATION_ARG)
 #endif
     
     uprv_free(data);
-    data = NULL;
-    p = NULL;
-    e = NULL;
+    data = nullptr;
+    p = nullptr;
+    e = nullptr;
     
     if (U_SUCCESS(ec)) {
         ec = U_PARSE_ERROR;
@@ -624,18 +624,18 @@ void LocDataParser::parseError(const char* EXPLANATION_ARG)
 StringLocalizationInfo* 
 StringLocalizationInfo::create(const UnicodeString& info, UParseError& perror, UErrorCode& status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     
     int32_t len = info.length();
     if (len == 0) {
-        return NULL; // no error;
+        return nullptr; // no error;
     }
     
     UChar* p = (UChar*)uprv_malloc(len * sizeof(UChar));
     if (!p) {
         status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     info.extract(p, len, status);
     if (!U_FAILURE(status)) {
@@ -661,7 +661,7 @@ StringLocalizationInfo::getRuleSetName(int32_t index) const {
     if (index >= 0 && index < getNumberOfRuleSets()) {
         return data[0][index];
     }
-    return NULL;
+    return nullptr;
 }
 
 const UChar*
@@ -669,7 +669,7 @@ StringLocalizationInfo::getLocaleName(int32_t index) const {
     if (index >= 0 && index < getNumberOfDisplayLocales()) {
         return data[index+1][0];
     }
-    return NULL;
+    return nullptr;
 }
 
 const UChar*
@@ -678,7 +678,7 @@ StringLocalizationInfo::getDisplayName(int32_t localeIndex, int32_t ruleIndex) c
         ruleIndex >= 0 && ruleIndex < getNumberOfRuleSets()) {
         return data[localeIndex+1][ruleIndex+1];
     }
-    return NULL;
+    return nullptr;
 }
 
 // ----------
@@ -686,23 +686,23 @@ StringLocalizationInfo::getDisplayName(int32_t localeIndex, int32_t ruleIndex) c
 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, 
                                              const UnicodeString& locs,
                                              const Locale& alocale, UParseError& perror, UErrorCode& status)
-  : fRuleSets(NULL)
-  , ruleSetDescriptions(NULL)
+  : fRuleSets(nullptr)
+  , ruleSetDescriptions(nullptr)
   , numRuleSets(0)
-  , defaultRuleSet(NULL)
+  , defaultRuleSet(nullptr)
   , locale(alocale)
-  , collator(NULL)
-  , decimalFormatSymbols(NULL)
-  , defaultInfinityRule(NULL)
-  , defaultNaNRule(NULL)
+  , collator(nullptr)
+  , decimalFormatSymbols(nullptr)
+  , defaultInfinityRule(nullptr)
+  , defaultNaNRule(nullptr)
   , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
   , lenient(false)
-  , lenientParseRules(NULL)
-  , localizations(NULL)
+  , lenientParseRules(nullptr)
+  , localizations(nullptr)
   , capitalizationInfoSet(false)
   , capitalizationForUIListMenu(false)
   , capitalizationForStandAlone(false)
-  , capitalizationBrkIter(NULL)
+  , capitalizationBrkIter(nullptr)
 {
   LocalizationInfo* locinfo = StringLocalizationInfo::create(locs, perror, status);
   init(description, locinfo, perror, status);
@@ -711,23 +711,23 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, 
                                              const UnicodeString& locs,
                                              UParseError& perror, UErrorCode& status)
-  : fRuleSets(NULL)
-  , ruleSetDescriptions(NULL)
+  : fRuleSets(nullptr)
+  , ruleSetDescriptions(nullptr)
   , numRuleSets(0)
-  , defaultRuleSet(NULL)
+  , defaultRuleSet(nullptr)
   , locale(Locale::getDefault())
-  , collator(NULL)
-  , decimalFormatSymbols(NULL)
-  , defaultInfinityRule(NULL)
-  , defaultNaNRule(NULL)
+  , collator(nullptr)
+  , decimalFormatSymbols(nullptr)
+  , defaultInfinityRule(nullptr)
+  , defaultNaNRule(nullptr)
   , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
   , lenient(false)
-  , lenientParseRules(NULL)
-  , localizations(NULL)
+  , lenientParseRules(nullptr)
+  , localizations(nullptr)
   , capitalizationInfoSet(false)
   , capitalizationForUIListMenu(false)
   , capitalizationForStandAlone(false)
-  , capitalizationBrkIter(NULL)
+  , capitalizationBrkIter(nullptr)
 {
   LocalizationInfo* locinfo = StringLocalizationInfo::create(locs, perror, status);
   init(description, locinfo, perror, status);
@@ -736,23 +736,23 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, 
                                              LocalizationInfo* info,
                                              const Locale& alocale, UParseError& perror, UErrorCode& status)
-  : fRuleSets(NULL)
-  , ruleSetDescriptions(NULL)
+  : fRuleSets(nullptr)
+  , ruleSetDescriptions(nullptr)
   , numRuleSets(0)
-  , defaultRuleSet(NULL)
+  , defaultRuleSet(nullptr)
   , locale(alocale)
-  , collator(NULL)
-  , decimalFormatSymbols(NULL)
-  , defaultInfinityRule(NULL)
-  , defaultNaNRule(NULL)
+  , collator(nullptr)
+  , decimalFormatSymbols(nullptr)
+  , defaultInfinityRule(nullptr)
+  , defaultNaNRule(nullptr)
   , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
   , lenient(false)
-  , lenientParseRules(NULL)
-  , localizations(NULL)
+  , lenientParseRules(nullptr)
+  , localizations(nullptr)
   , capitalizationInfoSet(false)
   , capitalizationForUIListMenu(false)
   , capitalizationForStandAlone(false)
-  , capitalizationBrkIter(NULL)
+  , capitalizationBrkIter(nullptr)
 {
   init(description, info, perror, status);
 }
@@ -760,70 +760,70 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, 
                          UParseError& perror, 
                          UErrorCode& status) 
-  : fRuleSets(NULL)
-  , ruleSetDescriptions(NULL)
+  : fRuleSets(nullptr)
+  , ruleSetDescriptions(nullptr)
   , numRuleSets(0)
-  , defaultRuleSet(NULL)
+  , defaultRuleSet(nullptr)
   , locale(Locale::getDefault())
-  , collator(NULL)
-  , decimalFormatSymbols(NULL)
-  , defaultInfinityRule(NULL)
-  , defaultNaNRule(NULL)
+  , collator(nullptr)
+  , decimalFormatSymbols(nullptr)
+  , defaultInfinityRule(nullptr)
+  , defaultNaNRule(nullptr)
   , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
   , lenient(false)
-  , lenientParseRules(NULL)
-  , localizations(NULL)
+  , lenientParseRules(nullptr)
+  , localizations(nullptr)
   , capitalizationInfoSet(false)
   , capitalizationForUIListMenu(false)
   , capitalizationForStandAlone(false)
-  , capitalizationBrkIter(NULL)
+  , capitalizationBrkIter(nullptr)
 {
-    init(description, NULL, perror, status);
+    init(description, nullptr, perror, status);
 }
 
 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, 
                          const Locale& aLocale,
                          UParseError& perror, 
                          UErrorCode& status) 
-  : fRuleSets(NULL)
-  , ruleSetDescriptions(NULL)
+  : fRuleSets(nullptr)
+  , ruleSetDescriptions(nullptr)
   , numRuleSets(0)
-  , defaultRuleSet(NULL)
+  , defaultRuleSet(nullptr)
   , locale(aLocale)
-  , collator(NULL)
-  , decimalFormatSymbols(NULL)
-  , defaultInfinityRule(NULL)
-  , defaultNaNRule(NULL)
+  , collator(nullptr)
+  , decimalFormatSymbols(nullptr)
+  , defaultInfinityRule(nullptr)
+  , defaultNaNRule(nullptr)
   , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
   , lenient(false)
-  , lenientParseRules(NULL)
-  , localizations(NULL)
+  , lenientParseRules(nullptr)
+  , localizations(nullptr)
   , capitalizationInfoSet(false)
   , capitalizationForUIListMenu(false)
   , capitalizationForStandAlone(false)
-  , capitalizationBrkIter(NULL)
+  , capitalizationBrkIter(nullptr)
 {
-    init(description, NULL, perror, status);
+    init(description, nullptr, perror, status);
 }
 
 RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale& alocale, UErrorCode& status)
-  : fRuleSets(NULL)
-  , ruleSetDescriptions(NULL)
+  : fRuleSets(nullptr)
+  , ruleSetDescriptions(nullptr)
   , numRuleSets(0)
-  , defaultRuleSet(NULL)
+  , defaultRuleSet(nullptr)
   , locale(alocale)
-  , collator(NULL)
-  , decimalFormatSymbols(NULL)
-  , defaultInfinityRule(NULL)
-  , defaultNaNRule(NULL)
+  , collator(nullptr)
+  , decimalFormatSymbols(nullptr)
+  , defaultInfinityRule(nullptr)
+  , defaultNaNRule(nullptr)
   , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
   , lenient(false)
-  , lenientParseRules(NULL)
-  , localizations(NULL)
+  , lenientParseRules(nullptr)
+  , localizations(nullptr)
   , capitalizationInfoSet(false)
   , capitalizationForUIListMenu(false)
   , capitalizationForStandAlone(false)
-  , capitalizationBrkIter(NULL)
+  , capitalizationBrkIter(nullptr)
 {
     if (U_FAILURE(status)) {
         return;
@@ -840,18 +840,18 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale&
     }
 
     // TODO: read localization info from resource
-    LocalizationInfo* locinfo = NULL;
+    LocalizationInfo* locinfo = nullptr;
 
     UResourceBundle* nfrb = ures_open(U_ICUDATA_RBNF, locale.getName(), &status);
     if (U_SUCCESS(status)) {
         setLocaleIDs(ures_getLocaleByType(nfrb, ULOC_VALID_LOCALE, &status),
                      ures_getLocaleByType(nfrb, ULOC_ACTUAL_LOCALE, &status));
 
-        UResourceBundle* rbnfRules = ures_getByKeyWithFallback(nfrb, rules_tag, NULL, &status);
+        UResourceBundle* rbnfRules = ures_getByKeyWithFallback(nfrb, rules_tag, nullptr, &status);
         if (U_FAILURE(status)) {
             ures_close(nfrb);
         }
-        UResourceBundle* ruleSets = ures_getByKeyWithFallback(rbnfRules, fmt_tag, NULL, &status);
+        UResourceBundle* ruleSets = ures_getByKeyWithFallback(rbnfRules, fmt_tag, nullptr, &status);
         if (U_FAILURE(status)) {
             ures_close(rbnfRules);
             ures_close(nfrb);
@@ -860,7 +860,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale&
 
         UnicodeString desc;
         while (ures_hasNext(ruleSets)) {
-           desc.append(ures_getNextUnicodeString(ruleSets,NULL,&status));
+           desc.append(ures_getNextUnicodeString(ruleSets,nullptr,&status));
         }
         UParseError perror;
 
@@ -874,23 +874,23 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale&
 
 RuleBasedNumberFormat::RuleBasedNumberFormat(const RuleBasedNumberFormat& rhs)
   : NumberFormat(rhs)
-  , fRuleSets(NULL)
-  , ruleSetDescriptions(NULL)
+  , fRuleSets(nullptr)
+  , ruleSetDescriptions(nullptr)
   , numRuleSets(0)
-  , defaultRuleSet(NULL)
+  , defaultRuleSet(nullptr)
   , locale(rhs.locale)
-  , collator(NULL)
-  , decimalFormatSymbols(NULL)
-  , defaultInfinityRule(NULL)
-  , defaultNaNRule(NULL)
+  , collator(nullptr)
+  , decimalFormatSymbols(nullptr)
+  , defaultInfinityRule(nullptr)
+  , defaultNaNRule(nullptr)
   , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
   , lenient(false)
-  , lenientParseRules(NULL)
-  , localizations(NULL)
+  , lenientParseRules(nullptr)
+  , localizations(nullptr)
   , capitalizationInfoSet(false)
   , capitalizationForUIListMenu(false)
   , capitalizationForStandAlone(false)
-  , capitalizationBrkIter(NULL)
+  , capitalizationBrkIter(nullptr)
 {
     this->operator=(rhs);
 }
@@ -911,7 +911,7 @@ RuleBasedNumberFormat::operator=(const RuleBasedNumberFormat& rhs)
 
     UParseError perror;
     setDecimalFormatSymbols(*rhs.getDecimalFormatSymbols());
-    init(rhs.originalDescription, rhs.localizations ? rhs.localizations->ref() : NULL, perror, status);
+    init(rhs.originalDescription, rhs.localizations ? rhs.localizations->ref() : nullptr, perror, status);
     setDefaultRuleSet(rhs.getDefaultRuleSetName(), status);
     setRoundingMode(rhs.getRoundingMode());
 
@@ -919,7 +919,7 @@ RuleBasedNumberFormat::operator=(const RuleBasedNumberFormat& rhs)
     capitalizationForUIListMenu = rhs.capitalizationForUIListMenu;
     capitalizationForStandAlone = rhs.capitalizationForStandAlone;
 #if !UCONFIG_NO_BREAK_ITERATION
-    capitalizationBrkIter = (rhs.capitalizationBrkIter!=NULL)? rhs.capitalizationBrkIter->clone(): NULL;
+    capitalizationBrkIter = (rhs.capitalizationBrkIter!=nullptr)? rhs.capitalizationBrkIter->clone(): nullptr;
 #endif
 
     return *this;
@@ -950,24 +950,24 @@ RuleBasedNumberFormat::operator==(const Format& other) const
         // the info here is just derived from that.
         if (locale == rhs.locale &&
             lenient == rhs.lenient &&
-            (localizations == NULL 
-                ? rhs.localizations == NULL 
-                : (rhs.localizations == NULL 
+            (localizations == nullptr 
+                ? rhs.localizations == nullptr 
+                : (rhs.localizations == nullptr 
                     ? false
                     : *localizations == rhs.localizations))) {
 
             NFRuleSet** p = fRuleSets;
             NFRuleSet** q = rhs.fRuleSets;
-            if (p == NULL) {
-                return q == NULL;
-            } else if (q == NULL) {
+            if (p == nullptr) {
+                return q == nullptr;
+            } else if (q == nullptr) {
                 return false;
             }
             while (*p && *q && (**p == **q)) {
                 ++p;
                 ++q;
             }
-            return *q == NULL && *p == NULL;
+            return *q == nullptr && *p == nullptr;
         }
     }
 
@@ -978,7 +978,7 @@ UnicodeString
 RuleBasedNumberFormat::getRules() const
 {
     UnicodeString result;
-    if (fRuleSets != NULL) {
+    if (fRuleSets != nullptr) {
         for (NFRuleSet** p = fRuleSets; *p; ++p) {
             (*p)->appendRules(result);
         }
@@ -1046,7 +1046,7 @@ RuleBasedNumberFormat::getRuleSetDisplayNameLocale(int32_t index, UErrorCode& st
         char* bp = buffer;
         if (cap > 64) {
             bp = (char *)uprv_malloc(cap);
-            if (bp == NULL) {
+            if (bp == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 return Locale("");
             }
@@ -1113,7 +1113,7 @@ RuleBasedNumberFormat::findRuleSet(const UnicodeString& name, UErrorCode& status
         }
         status = U_ILLEGAL_ARGUMENT_ERROR;
     }
-    return NULL;
+    return nullptr;
 }
 
 UnicodeString&
@@ -1326,7 +1326,7 @@ RuleBasedNumberFormat::adjustForCapitalizationContext(int32_t startPos,
     if (capitalizationContext != UDISPCTX_CAPITALIZATION_NONE && startPos == 0 && currentResult.length() > 0) {
         // capitalize currentResult according to context
         UChar32 ch = currentResult.char32At(0);
-        if (u_islower(ch) && U_SUCCESS(status) && capitalizationBrkIter != NULL &&
+        if (u_islower(ch) && U_SUCCESS(status) && capitalizationBrkIter != nullptr &&
               ( capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
                 (capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForUIListMenu) ||
                 (capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone)) ) {
@@ -1402,7 +1402,7 @@ RuleBasedNumberFormat::setLenient(UBool enabled)
     lenient = enabled;
     if (!enabled && collator) {
         delete collator;
-        collator = NULL;
+        collator = nullptr;
     }
 }
 
@@ -1422,7 +1422,7 @@ RuleBasedNumberFormat::setDefaultRuleSet(const UnicodeString& ruleSetName, UErro
             status = U_ILLEGAL_ARGUMENT_ERROR;
         } else {
             NFRuleSet* result = findRuleSet(ruleSetName, status);
-            if (result != NULL) {
+            if (result != nullptr) {
                 defaultRuleSet = result;
             }
         }
@@ -1443,7 +1443,7 @@ RuleBasedNumberFormat::getDefaultRuleSetName() const {
 void 
 RuleBasedNumberFormat::initDefaultRuleSet()
 {
-    defaultRuleSet = NULL;
+    defaultRuleSet = nullptr;
     if (!fRuleSets) {
         return;
     }
@@ -1480,7 +1480,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
 {
     // TODO: implement UParseError
     uprv_memset(&pErr, 0, sizeof(UParseError));
-    // Note: this can leave ruleSets == NULL, so remaining code should check
+    // Note: this can leave ruleSets == nullptr, so remaining code should check
     if (U_FAILURE(status)) {
         return;
     }
@@ -1492,7 +1492,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
         return;
     }
 
-    this->localizations = localizationInfos == NULL ? NULL : localizationInfos->ref();
+    this->localizations = localizationInfos == nullptr ? nullptr : localizationInfos->ref();
 
     UnicodeString description(rules);
     if (!description.length()) {
@@ -1533,7 +1533,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
             // copy out the lenient-parse rules and delete them
             // from the description
             lenientParseRules = new UnicodeString();
-            /* test for NULL */
+            /* test for nullptr */
             if (lenientParseRules == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 return;
@@ -1556,14 +1556,14 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
 
     // our rule list is an array of the appropriate size
     fRuleSets = (NFRuleSet **)uprv_malloc((numRuleSets + 1) * sizeof(NFRuleSet *));
-    /* test for NULL */
+    /* test for nullptr */
     if (fRuleSets == 0) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
 
     for (int i = 0; i <= numRuleSets; ++i) {
-        fRuleSets[i] = NULL;
+        fRuleSets[i] = nullptr;
     }
 
     // divide up the descriptions into individual rule-set descriptions
@@ -1638,7 +1638,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
         for (int32_t i = 0; i < localizationInfos->getNumberOfRuleSets(); ++i) {
             UnicodeString name(true, localizationInfos->getRuleSetName(i), -1);
             NFRuleSet* rs = findRuleSet(name, status);
-            if (rs == NULL) {
+            if (rs == nullptr) {
                 break; // error
             }
             if (i == 0) {
@@ -1664,14 +1664,14 @@ RuleBasedNumberFormat::setContext(UDisplayContext value, UErrorCode& status)
            capitalizationInfoSet = true;
         }
 #if !UCONFIG_NO_BREAK_ITERATION
-        if ( capitalizationBrkIter == NULL && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
+        if ( capitalizationBrkIter == nullptr && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
                 (value==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForUIListMenu) ||
                 (value==UDISPCTX_CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone)) ) {
             status = U_ZERO_ERROR;
             capitalizationBrkIter = BreakIterator::createSentenceInstance(locale, status);
             if (U_FAILURE(status)) {
                 delete capitalizationBrkIter;
-                capitalizationBrkIter = NULL;
+                capitalizationBrkIter = nullptr;
             }
         }
 #endif
@@ -1682,15 +1682,15 @@ void
 RuleBasedNumberFormat::initCapitalizationContextInfo(const Locale& thelocale)
 {
 #if !UCONFIG_NO_BREAK_ITERATION
-    const char * localeID = (thelocale != NULL)? thelocale.getBaseName(): NULL;
+    const char * localeID = (thelocale != nullptr)? thelocale.getBaseName(): nullptr;
     UErrorCode status = U_ZERO_ERROR;
-    UResourceBundle *rb = ures_open(NULL, localeID, &status);
+    UResourceBundle *rb = ures_open(nullptr, localeID, &status);
     rb = ures_getByKeyWithFallback(rb, "contextTransforms", rb, &status);
     rb = ures_getByKeyWithFallback(rb, "number-spellout", rb, &status);
-    if (U_SUCCESS(status) && rb != NULL) {
+    if (U_SUCCESS(status) && rb != nullptr) {
         int32_t len = 0;
         const int32_t * intVector = ures_getIntVector(rb, &len, &status);
-        if (U_SUCCESS(status) && intVector != NULL && len >= 2) {
+        if (U_SUCCESS(status) && intVector != nullptr && len >= 2) {
             capitalizationForUIListMenu = static_cast<UBool>(intVector[0]);
             capitalizationForStandAlone = static_cast<UBool>(intVector[1]);
         }
@@ -1748,34 +1748,34 @@ RuleBasedNumberFormat::dispose()
             delete *p;
         }
         uprv_free(fRuleSets);
-        fRuleSets = NULL;
+        fRuleSets = nullptr;
     }
 
     if (ruleSetDescriptions) {
         delete [] ruleSetDescriptions;
-        ruleSetDescriptions = NULL;
+        ruleSetDescriptions = nullptr;
     }
 
 #if !UCONFIG_NO_COLLATION
     delete collator;
 #endif
-    collator = NULL;
+    collator = nullptr;
 
     delete decimalFormatSymbols;
-    decimalFormatSymbols = NULL;
+    decimalFormatSymbols = nullptr;
 
     delete defaultInfinityRule;
-    defaultInfinityRule = NULL;
+    defaultInfinityRule = nullptr;
 
     delete defaultNaNRule;
-    defaultNaNRule = NULL;
+    defaultNaNRule = nullptr;
 
     delete lenientParseRules;
-    lenientParseRules = NULL;
+    lenientParseRules = nullptr;
 
 #if !UCONFIG_NO_BREAK_ITERATION
     delete capitalizationBrkIter;
-    capitalizationBrkIter = NULL;
+    capitalizationBrkIter = nullptr;
 #endif
 
     if (localizations) {
@@ -1799,11 +1799,11 @@ RuleBasedNumberFormat::getCollator() const
 {
 #if !UCONFIG_NO_COLLATION
     if (!fRuleSets) {
-        return NULL;
+        return nullptr;
     }
 
     // lazy-evaluate the collator
-    if (collator == NULL && lenient) {
+    if (collator == nullptr && lenient) {
         // create a default collator based on the formatter's locale,
         // then pull out that collator's rules, append any additional
         // rules specified in the description, and create a _new_
@@ -1813,18 +1813,18 @@ RuleBasedNumberFormat::getCollator() const
 
         Collator* temp = Collator::createInstance(locale, status);
         RuleBasedCollator* newCollator;
-        if (U_SUCCESS(status) && (newCollator = dynamic_cast<RuleBasedCollator*>(temp)) != NULL) {
+        if (U_SUCCESS(status) && (newCollator = dynamic_cast<RuleBasedCollator*>(temp)) != nullptr) {
             if (lenientParseRules) {
                 UnicodeString rules(newCollator->getRules());
                 rules.append(*lenientParseRules);
 
                 newCollator = new RuleBasedCollator(rules, status);
                 // Exit if newCollator could not be created.
-                if (newCollator == NULL) {
-                    return NULL;
+                if (newCollator == nullptr) {
+                    return nullptr;
                 }
             } else {
-                temp = NULL;
+                temp = nullptr;
             }
             if (U_SUCCESS(status)) {
                 newCollator->setAttribute(UCOL_DECOMPOSITION_MODE, UCOL_ON, status);
@@ -1875,7 +1875,7 @@ RuleBasedNumberFormat::initializeDefaultInfinityRule(UErrorCode &status)
     if (U_FAILURE(status)) {
         return nullptr;
     }
-    if (defaultInfinityRule == NULL) {
+    if (defaultInfinityRule == nullptr) {
         UnicodeString rule(UNICODE_STRING_SIMPLE("Inf: "));
         rule.append(getDecimalFormatSymbols()->getSymbol(DecimalFormatSymbols::kInfinitySymbol));
         LocalPointer<NFRule> temp(new NFRule(this, rule, status), status);
@@ -1919,11 +1919,11 @@ RuleBasedNumberFormat::getDefaultNaNRule() const
 void
 RuleBasedNumberFormat::adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsToAdopt)
 {
-    if (symbolsToAdopt == NULL) {
-        return; // do not allow caller to set decimalFormatSymbols to NULL
+    if (symbolsToAdopt == nullptr) {
+        return; // do not allow caller to set decimalFormatSymbols to nullptr
     }
 
-    if (decimalFormatSymbols != NULL) {
+    if (decimalFormatSymbols != nullptr) {
         delete decimalFormatSymbols;
     }
 
@@ -1934,11 +1934,11 @@ RuleBasedNumberFormat::adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsTo
         UErrorCode status = U_ZERO_ERROR;
 
         delete defaultInfinityRule;
-        defaultInfinityRule = NULL;
+        defaultInfinityRule = nullptr;
         initializeDefaultInfinityRule(status); // Reset with the new DecimalFormatSymbols
 
         delete defaultNaNRule;
-        defaultNaNRule = NULL;
+        defaultNaNRule = nullptr;
         initializeDefaultNaNRule(status); // Reset with the new DecimalFormatSymbols
 
         if (fRuleSets) {
index 86d6cbd8bda5f0fb0dd2f4582099bb724a156c3d..2176e89fddc94986dc7118e5455e39994629fd56 100644 (file)
@@ -27,7 +27,7 @@ U_NAMESPACE_BEGIN
 
 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RuleBasedTransliterator)
 
-static Replaceable *gLockedText = NULL;
+static Replaceable *gLockedText = nullptr;
 
 void RuleBasedTransliterator::_construct(const UnicodeString& rules,
                                          UTransDirection direction,
@@ -46,7 +46,7 @@ void RuleBasedTransliterator::_construct(const UnicodeString& rules,
     }
 
     if (parser.idBlockVector.size() != 0 ||
-        parser.compoundFilter != NULL ||
+        parser.compoundFilter != nullptr ||
         parser.dataVector.size() == 0) {
         status = U_INVALID_RBT_SYNTAX; // ::ID blocks disallowed in RBT
         return;
@@ -267,7 +267,7 @@ RuleBasedTransliterator::handleTransliterate(Replaceable& text, UTransPosition&
     }
     
     // Check to make sure we don't dereference a null pointer.
-    if (fData != NULL) {
+    if (fData != nullptr) {
            while (index.start < index.limit &&
                   loopCount <= loopLimit &&
                   fData->ruleSet.transliterate(text, index, isIncremental)) {
@@ -277,7 +277,7 @@ RuleBasedTransliterator::handleTransliterate(Replaceable& text, UTransPosition&
     if (lockedMutexAtThisLevel) {
         {
             Mutex m;
-            gLockedText = NULL;
+            gLockedText = nullptr;
         }
         umtx_unlock(&transliteratorDataMutex);
     }
index 866f0c2bfa1c4bc420ae076eb2bcd6779230ed6b..f4212848cb5555e8c4e7a092014e07db51a4762b 100644 (file)
@@ -50,7 +50,7 @@ TransliterationRuleData::TransliterationRuleData(const TransliterationRuleData&
         UnicodeString* value =
             new UnicodeString(*(const UnicodeString*)e->value.pointer);
         // Exit out if value could not be created.
-        if (value == NULL) {
+        if (value == nullptr) {
                return;
         }
         variableNames.put(*(UnicodeString*)e->key.pointer, value, status);
@@ -59,14 +59,14 @@ TransliterationRuleData::TransliterationRuleData(const TransliterationRuleData&
     variables = 0;
     if (other.variables != 0) {
         variables = (UnicodeFunctor **)uprv_malloc(variablesLength * sizeof(UnicodeFunctor *));
-        /* test for NULL */
+        /* test for nullptr */
         if (variables == 0) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
         for (i=0; i<variablesLength; ++i) {
             variables[i] = other.variables[i]->clone();
-            if (variables[i] == NULL) {
+            if (variables[i] == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 break;
             }
@@ -78,7 +78,7 @@ TransliterationRuleData::TransliterationRuleData(const TransliterationRuleData&
             delete variables[n];
         }
         uprv_free(variables);
-        variables = NULL;
+        variables = nullptr;
         return;
     }
 
index 52a961dde010d3798ce7d182a7191cdbf2b1c369..39fea53d0dc25b698931745c22e31197540faa65 100644 (file)
@@ -118,7 +118,7 @@ public:
 
     /**
      * Given a stand-in character, return the UnicodeFunctor that it
-     * represents, or NULL if it doesn't represent anything.
+     * represents, or nullptr if it doesn't represent anything.
      * @param standIn    the given stand-in character.
      * @return           the UnicodeFunctor that 'standIn' represents
      */
@@ -126,7 +126,7 @@ public:
 
     /**
      * Given a stand-in character, return the UnicodeMatcher that it
-     * represents, or NULL if it doesn't represent anything or if it
+     * represents, or nullptr if it doesn't represent anything or if it
      * represents something that is not a matcher.
      * @param standIn    the given stand-in character.
      * @return           return the UnicodeMatcher that 'standIn' represents
@@ -135,7 +135,7 @@ public:
 
     /**
      * Given a stand-in character, return the UnicodeReplacer that it
-     * represents, or NULL if it doesn't represent anything or if it
+     * represents, or nullptr if it doesn't represent anything or if it
      * represents something that is not a replacer.
      * @param standIn    the given stand-in character.
      * @return           return the UnicodeReplacer that 'standIn' represents
index f13bf1c227a16bb6a4e9de9e5d35f5d39769861b..9933043bbae9f40e04cc51a5976efffee8dab70e 100644 (file)
@@ -191,7 +191,7 @@ const UnicodeString* ParseData::lookup(const UnicodeString& name) const {
 const UnicodeFunctor* ParseData::lookupMatcher(UChar32 ch) const {
     // Note that we cannot use data.lookupSet() because the
     // set array has not been constructed yet.
-    const UnicodeFunctor* set = NULL;
+    const UnicodeFunctor* set = nullptr;
     int32_t i = ch - data->variablesBase;
     if (i >= 0 && i < variablesVector->size()) {
         int32_t j = ch - data->variablesBase;
@@ -231,7 +231,7 @@ UBool ParseData::isMatcher(UChar32 ch) {
     int32_t i = ch - data->variablesBase;
     if (i >= 0 && i < variablesVector->size()) {
         UnicodeFunctor *f = (UnicodeFunctor*) variablesVector->elementAt(i);
-        return f != NULL && f->toMatcher() != NULL;
+        return f != nullptr && f->toMatcher() != nullptr;
     }
     return true;
 }
@@ -246,7 +246,7 @@ UBool ParseData::isReplacer(UChar32 ch) {
     int i = ch - data->variablesBase;
     if (i >= 0 && i < variablesVector->size()) {
         UnicodeFunctor *f = (UnicodeFunctor*) variablesVector->elementAt(i);
-        return f != NULL && f->toReplacer() != NULL;
+        return f != nullptr && f->toReplacer() != nullptr;
     }
     return true;
 }
@@ -420,7 +420,7 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
             // whitespace likely to be seen in code.
             continue;
         }
-        if (u_strchr(HALF_ENDERS, c) != NULL) {
+        if (u_strchr(HALF_ENDERS, c) != nullptr) {
             if (isSegment) {
                 // Unclosed segment
                 return syntaxError(U_UNCLOSED_SEGMENT, rule, start, status);
@@ -538,7 +538,7 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
                 StringMatcher* m =
                     new StringMatcher(buf, bufSegStart, buf.length(),
                                       segmentNumber, *parser.curData);
-                if (m == NULL) {
+                if (m == nullptr) {
                     return syntaxError(U_MEMORY_ALLOCATION_ERROR, rule, start, status);
                 }
                 
@@ -555,14 +555,14 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
                 TransliteratorIDParser::SingleID* single =
                     TransliteratorIDParser::parseFilterID(rule, iref);
                 // The next character MUST be a segment open
-                if (single == NULL ||
+                if (single == nullptr ||
                     !ICU_Utility::parseChar(rule, iref, SEGMENT_OPEN)) {
                     return syntaxError(U_INVALID_FUNCTION, rule, start, status);
                 }
                 
                 Transliterator *t = single->createInstance();
                 delete single;
-                if (t == NULL) {
+                if (t == nullptr) {
                     return syntaxError(U_INVALID_FUNCTION, rule, start, status);
                 }
                 
@@ -579,7 +579,7 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
                 buf.extractBetween(bufSegStart, buf.length(), output);
                 FunctionReplacer *r =
                     new FunctionReplacer(t, new StringReplacer(output, parser.curData));
-                if (r == NULL) {
+                if (r == nullptr) {
                     return syntaxError(U_MEMORY_ALLOCATION_ERROR, rule, start, status);
                 }
                 
@@ -673,7 +673,7 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
 
                 UnicodeFunctor *m =
                     new StringMatcher(buf, qstart, qlimit, 0, *parser.curData);
-                if (m == NULL) {
+                if (m == nullptr) {
                     return syntaxError(U_MEMORY_ALLOCATION_ERROR, rule, start, status);
                 }
                 int32_t min = 0;
@@ -690,7 +690,7 @@ int32_t RuleHalf::parseSection(const UnicodeString& rule, int32_t pos, int32_t l
                 //    do nothing -- min, max already set
                 }
                 m = new Quantifier(m, min, max);
-                if (m == NULL) {
+                if (m == nullptr) {
                     return syntaxError(U_MEMORY_ALLOCATION_ERROR, rule, start, status);
                 }
                 buf.truncate(qstart);
@@ -833,9 +833,9 @@ variablesVector(statusReturn),
 segmentObjects(statusReturn)
 {
     idBlockVector.setDeleter(uprv_deleteUObject);
-    curData = NULL;
-    compoundFilter = NULL;
-    parseData = NULL;
+    curData = nullptr;
+    compoundFilter = nullptr;
+    parseData = nullptr;
     variableNames.setValueDeleter(uprv_deleteUObject);
 }
 
@@ -867,7 +867,7 @@ TransliteratorParser::parse(const UnicodeString& rules,
  */ 
 UnicodeSet* TransliteratorParser::orphanCompoundFilter() {
     UnicodeSet* f = compoundFilter;
-    compoundFilter = NULL;
+    compoundFilter = nullptr;
     return f;
 }
 
@@ -902,26 +902,26 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
     }
 
     idBlockVector.removeAllElements();
-    curData = NULL;
+    curData = nullptr;
     direction = theDirection;
     ruleCount = 0;
 
     delete compoundFilter;
-    compoundFilter = NULL;
+    compoundFilter = nullptr;
 
     while (!variablesVector.isEmpty()) {
         delete (UnicodeFunctor*)variablesVector.orphanElementAt(0);
     }
     variableNames.removeAll();
     parseData = new ParseData(0, &variablesVector, &variableNames);
-    if (parseData == NULL) {
+    if (parseData == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
 
     dotStandIn = (UChar) -1;
 
-    UnicodeString *tempstr = NULL; // used for memory allocation error checking
+    UnicodeString *tempstr = nullptr; // used for memory allocation error checking
     UnicodeString str; // scratch
     UnicodeString idBlockResult;
     int32_t pos = 0;
@@ -932,7 +932,7 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
     // and it is the offset to the _start_ of the compound filter
     // pattern.  Otherwise it is the offset to the _limit_ of the
     // compound filter pattern within idBlockResult.
-    compoundFilter = NULL;
+    compoundFilter = nullptr;
     int32_t compoundFilterOffset = -1;
 
     while (pos < limit && U_SUCCESS(status)) {
@@ -974,7 +974,7 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
             int32_t p = pos;
             
             if (!parsingIDs) {
-                if (curData != NULL) {
+                if (curData != nullptr) {
                     U_ASSERT(!dataVector.hasDeleter());
                     if (direction == UTRANS_FORWARD)
                         dataVector.addElement(curData, status);
@@ -983,7 +983,7 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
                     if (U_FAILURE(status)) {
                         delete curData;
                     }
-                    curData = NULL;
+                    curData = nullptr;
                 }
                 parsingIDs = true;
             }
@@ -1003,12 +1003,12 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
             } else {
                 // Couldn't parse an ID.  Try to parse a global filter
                 int32_t withParens = -1;
-                UnicodeSet* f = TransliteratorIDParser::parseGlobalFilter(rule, p, direction, withParens, NULL);
-                if (f != NULL) {
+                UnicodeSet* f = TransliteratorIDParser::parseGlobalFilter(rule, p, direction, withParens, nullptr);
+                if (f != nullptr) {
                     if (ICU_Utility::parseChar(rule, p, END_OF_RULE)
                         && (direction == UTRANS_FORWARD) == (withParens == 0))
                     {
-                        if (compoundFilter != NULL) {
+                        if (compoundFilter != nullptr) {
                             // Multiple compound filters
                             syntaxError(U_MULTIPLE_COMPOUND_FILTERS, rule, pos, status);
                             delete f;
@@ -1030,8 +1030,8 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
         } else {
             if (parsingIDs) {
                 tempstr = new UnicodeString(idBlockResult);
-                // NULL pointer check
-                if (tempstr == NULL) {
+                // nullptr pointer check
+                if (tempstr == nullptr) {
                     status = U_MEMORY_ALLOCATION_ERROR;
                     return;
                 }
@@ -1046,8 +1046,8 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
                 idBlockResult.remove();
                 parsingIDs = false;
                 curData = new TransliterationRuleData(status);
-                // NULL pointer check
-                if (curData == NULL) {
+                // nullptr pointer check
+                if (curData == nullptr) {
                     status = U_MEMORY_ALLOCATION_ERROR;
                     return;
                 }
@@ -1075,8 +1075,8 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
 
     if (parsingIDs && idBlockResult.length() > 0) {
         tempstr = new UnicodeString(idBlockResult);
-        // NULL pointer check
-        if (tempstr == NULL) {
+        // nullptr pointer check
+        if (tempstr == nullptr) {
             // TODO: Testing, forcing this path, shows many memory leaks. ICU-21701
             //       intltest translit/TransliteratorTest/TestInstantiation
             status = U_MEMORY_ALLOCATION_ERROR;
@@ -1090,7 +1090,7 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
             return;
         }
     }
-    else if (!parsingIDs && curData != NULL) {
+    else if (!parsingIDs && curData != nullptr) {
         if (direction == UTRANS_FORWARD) {
             dataVector.addElement(curData, status);
         } else {
@@ -1112,8 +1112,8 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
                 data->variables = 0;
             } else {
                 data->variables = (UnicodeFunctor**)uprv_malloc(data->variablesLength * sizeof(UnicodeFunctor*));
-                // NULL pointer check
-                if (data->variables == NULL) {
+                // nullptr pointer check
+                if (data->variables == nullptr) {
                     status = U_MEMORY_ALLOCATION_ERROR;
                     return;
                 }
@@ -1128,9 +1128,9 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
             data->variableNames.removeAll();
             int32_t p = UHASH_FIRST;
             const UHashElement* he = variableNames.nextElement(p);
-            while (he != NULL) {
+            while (he != nullptr) {
                 UnicodeString* tempus = ((UnicodeString*)(he->value.pointer))->clone();
-                if (tempus == NULL) {
+                if (tempus == nullptr) {
                     status = U_MEMORY_ALLOCATION_ERROR;
                     return;
                 }
@@ -1142,7 +1142,7 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
         variablesVector.removeAllElements();   // keeps them from getting deleted when we succeed
 
         // Index the rules
-        if (compoundFilter != NULL) {
+        if (compoundFilter != nullptr) {
             if ((direction == UTRANS_FORWARD && compoundFilterOffset != 1) ||
                 (direction == UTRANS_REVERSE && compoundFilterOffset != ruleCount)) {
                 status = U_MISPLACED_COMPOUND_FILTER;
@@ -1218,7 +1218,7 @@ static const UChar PRAGMA_NFC_RULES[] = {0x7E,0x6E,0x66,0x63,0x20,0x72,0x75,0x6C
  */
 UBool TransliteratorParser::resemblesPragma(const UnicodeString& rule, int32_t pos, int32_t limit) {
     // Must start with /use\s/i
-    return ICU_Utility::parsePattern(rule, pos, limit, UnicodeString(true, PRAGMA_USE, 4), NULL) >= 0;
+    return ICU_Utility::parsePattern(rule, pos, limit, UnicodeString(true, PRAGMA_USE, 4), nullptr) >= 0;
 }
 
 /**
@@ -1255,13 +1255,13 @@ int32_t TransliteratorParser::parsePragma(const UnicodeString& rule, int32_t pos
         return p;
     }
     
-    p = ICU_Utility::parsePattern(rule, pos, limit, UnicodeString(true, PRAGMA_NFD_RULES, -1), NULL);
+    p = ICU_Utility::parsePattern(rule, pos, limit, UnicodeString(true, PRAGMA_NFD_RULES, -1), nullptr);
     if (p >= 0) {
         pragmaNormalizeRules(UNORM_NFD);
         return p;
     }
     
-    p = ICU_Utility::parsePattern(rule, pos, limit, UnicodeString(true, PRAGMA_NFC_RULES, -1), NULL);
+    p = ICU_Utility::parsePattern(rule, pos, limit, UnicodeString(true, PRAGMA_NFC_RULES, -1), nullptr);
     if (p >= 0) {
         pragmaNormalizeRules(UNORM_NFC);
         return p;
@@ -1305,7 +1305,7 @@ int32_t TransliteratorParser::parseRule(const UnicodeString& rule, int32_t pos,
         return start;
     }
 
-    if (pos == limit || u_strchr(gOPERATORS, (op = rule.charAt(--pos))) == NULL) {
+    if (pos == limit || u_strchr(gOPERATORS, (op = rule.charAt(--pos))) == nullptr) {
         return syntaxError(U_MISSING_OPERATOR, rule, start, status);
     }
     ++pos;
@@ -1366,8 +1366,8 @@ int32_t TransliteratorParser::parseRule(const UnicodeString& rule, int32_t pos,
         } 
         // We allow anything on the right, including an empty string.
         UnicodeString* value = new UnicodeString(right->text);
-        // NULL pointer check
-        if (value == NULL) {
+        // nullptr pointer check
+        if (value == nullptr) {
             return syntaxError(U_MEMORY_ALLOCATION_ERROR, rule, start, status);
         }
         variableNames.put(undefinedVariableName, value, status);
@@ -1393,7 +1393,7 @@ int32_t TransliteratorParser::parseRule(const UnicodeString& rule, int32_t pos,
         }
     }
     for (i=0; i<segmentObjects.size(); ++i) {
-        if (segmentObjects.elementAt(i) == NULL) {
+        if (segmentObjects.elementAt(i) == nullptr) {
             syntaxError(U_INTERNAL_TRANSLITERATOR_ERROR, rule, start, status); // will never happen
         }
     }
@@ -1451,11 +1451,11 @@ int32_t TransliteratorParser::parseRule(const UnicodeString& rule, int32_t pos,
     }
 
     // Flatten segment objects vector to an array
-    UnicodeFunctor** segmentsArray = NULL;
+    UnicodeFunctor** segmentsArray = nullptr;
     if (segmentObjects.size() > 0) {
         segmentsArray = (UnicodeFunctor **)uprv_malloc(segmentObjects.size() * sizeof(UnicodeFunctor *));
         // Null pointer check
-        if (segmentsArray == NULL) {
+        if (segmentsArray == nullptr) {
             return syntaxError(U_MEMORY_ALLOCATION_ERROR, rule, start, status);
         }
         segmentObjects.toArray((void**) segmentsArray);
@@ -1469,7 +1469,7 @@ int32_t TransliteratorParser::parseRule(const UnicodeString& rule, int32_t pos,
             curData,
             status);
     //Null pointer check
-    if (temptr == NULL) {
+    if (temptr == nullptr) {
         uprv_free(segmentsArray);
         return syntaxError(U_MEMORY_ALLOCATION_ERROR, rule, start, status);
     }
@@ -1527,7 +1527,7 @@ UChar TransliteratorParser::parseSet(const UnicodeString& rule,
                                           UErrorCode& status) {
     UnicodeSet* set = new UnicodeSet(rule, pos, USET_IGNORE_SPACE, parseData, status);
     // Null pointer check
-    if (set == NULL) {
+    if (set == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return (UChar)0x0000; // Return empty character with error.
     }
@@ -1582,7 +1582,7 @@ UChar TransliteratorParser::getSegmentStandin(int32_t seg, UErrorCode& status) {
         // Set a placeholder in the primary variables vector that will be
         // filled in later by setSegmentObject().  We know that we will get
         // called first because setSegmentObject() will call us.
-        variablesVector.addElement((void*) NULL, status);
+        variablesVector.addElement((void*) nullptr, status);
         segmentStandins.setCharAt(seg-1, c);
     }
     return c;
@@ -1603,8 +1603,8 @@ void TransliteratorParser::setSegmentObject(int32_t seg, StringMatcher* adopted,
         return;
     }
     int32_t index = getSegmentStandin(seg, status) - curData->variablesBase;
-    if (segmentObjects.elementAt(seg-1) != NULL ||
-        variablesVector.elementAt(index) != NULL) {
+    if (segmentObjects.elementAt(seg-1) != nullptr ||
+        variablesVector.elementAt(index) != nullptr) {
         // should never happen
         if (U_SUCCESS(status)) {status = U_INTERNAL_TRANSLITERATOR_ERROR;}
         return;
@@ -1622,7 +1622,7 @@ UChar TransliteratorParser::getDotStandIn(UErrorCode& status) {
     if (dotStandIn == (UChar) -1) {
         UnicodeSet* tempus = new UnicodeSet(UnicodeString(true, DOT_SET, -1), status);
         // Null pointer check.
-        if (tempus == NULL) {
+        if (tempus == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return (UChar)0x0000;
         }
@@ -1639,7 +1639,7 @@ void TransliteratorParser::appendVariableDef(const UnicodeString& name,
                                                   UnicodeString& buf,
                                                   UErrorCode& status) {
     const UnicodeString* s = (const UnicodeString*) variableNames.get(name);
-    if (s == NULL) {
+    if (s == nullptr) {
         // We allow one undefined variable so that variable definition
         // statements work.  For the first undefined variable we return
         // the special placeholder variableLimit-1, and save the variable
index ee0d938ca95aa76a3fa080c4825565bd7ad05aba..27cdf9dd8e742f9f3262a59a7391e406d2985c7d 100644 (file)
@@ -116,22 +116,22 @@ TransliterationRule::TransliterationRule(const UnicodeString& input,
         flags |= ANCHOR_END;
     }
 
-    anteContext = NULL;
+    anteContext = nullptr;
     if (anteContextLength > 0) {
         anteContext = new StringMatcher(pattern, 0, anteContextLength,
                                         false, *data);
-        /* test for NULL */
+        /* test for nullptr */
         if (anteContext == 0) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
     }
     
-    key = NULL;
+    key = nullptr;
     if (keyLength > 0) {
         key = new StringMatcher(pattern, anteContextLength, anteContextLength + keyLength,
                                 false, *data);
-        /* test for NULL */
+        /* test for nullptr */
         if (key == 0) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
@@ -139,11 +139,11 @@ TransliterationRule::TransliterationRule(const UnicodeString& input,
     }
     
     int32_t postContextLength = pattern.length() - keyLength - anteContextLength;
-    postContext = NULL;
+    postContext = nullptr;
     if (postContextLength > 0) {
         postContext = new StringMatcher(pattern, anteContextLength + keyLength, pattern.length(),
                                         false, *data);
-        /* test for NULL */
+        /* test for nullptr */
         if (postContext == 0) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
@@ -151,7 +151,7 @@ TransliterationRule::TransliterationRule(const UnicodeString& input,
     }
 
     this->output = new StringReplacer(outputStr, cursorPosition + cursorOffset, data);
-    /* test for NULL */
+    /* test for nullptr */
     if (this->output == 0) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
@@ -163,29 +163,29 @@ TransliterationRule::TransliterationRule(const UnicodeString& input,
  */
 TransliterationRule::TransliterationRule(TransliterationRule& other) :
     UMemory(other),
-    anteContext(NULL),
-    key(NULL),
-    postContext(NULL),
+    anteContext(nullptr),
+    key(nullptr),
+    postContext(nullptr),
     pattern(other.pattern),
     anteContextLength(other.anteContextLength),
     keyLength(other.keyLength),
     flags(other.flags),
     data(other.data) {
 
-    segments = NULL;
+    segments = nullptr;
     segmentsCount = 0;
     if (other.segmentsCount > 0) {
         segments = (UnicodeFunctor **)uprv_malloc(other.segmentsCount * sizeof(UnicodeFunctor *));
         uprv_memcpy(segments, other.segments, (size_t)other.segmentsCount*sizeof(segments[0]));
     }
 
-    if (other.anteContext != NULL) {
+    if (other.anteContext != nullptr) {
         anteContext = other.anteContext->clone();
     }
-    if (other.key != NULL) {
+    if (other.key != nullptr) {
         key = other.key->clone();
     }
-    if (other.postContext != NULL) {
+    if (other.postContext != nullptr) {
         postContext = other.postContext->clone();
     }
     output = other.output->clone();
@@ -225,7 +225,7 @@ int16_t TransliterationRule::getIndexValue() const {
         return -1;
     }
     UChar32 c = pattern.char32At(anteContextLength);
-    return (int16_t)(data->lookupMatcher(c) == NULL ? (c & 0xFF) : -1);
+    return (int16_t)(data->lookupMatcher(c) == nullptr ? (c & 0xFF) : -1);
 }
 
 /**
@@ -241,8 +241,8 @@ int16_t TransliterationRule::getIndexValue() const {
 UBool TransliterationRule::matchesIndexValue(uint8_t v) const {
     // Delegate to the key, or if there is none, to the postContext.
     // If there is neither then we match any key; return true.
-    UnicodeMatcher *m = (key != NULL) ? key : postContext;
-    return (m != NULL) ? m->matchesIndexValue(v) : true;
+    UnicodeMatcher *m = (key != nullptr) ? key : postContext;
+    return (m != nullptr) ? m->matchesIndexValue(v) : true;
 }
 
 /**
@@ -361,7 +361,7 @@ UMatchDegree TransliterationRule::matchAndReplace(Replaceable& text,
     // ============================ MATCH ===========================
 
     // Reset segment match data
-    if (segments != NULL) {
+    if (segments != nullptr) {
         for (int32_t i=0; i<segmentsCount; ++i) {
             ((StringMatcher*) segments[i])->resetMatch();
         }
@@ -391,7 +391,7 @@ UMatchDegree TransliterationRule::matchAndReplace(Replaceable& text,
     // Start reverse match at char before pos.start
     oText = posBefore(text, pos.start);
 
-    if (anteContext != NULL) {
+    if (anteContext != nullptr) {
         match = anteContext->matches(text, oText, anteLimit, false);
         if (match != U_MATCH) {
             return U_MISMATCH;
@@ -410,7 +410,7 @@ UMatchDegree TransliterationRule::matchAndReplace(Replaceable& text,
     
     oText = pos.start;
 
-    if (key != NULL) {
+    if (key != nullptr) {
         match = key->matches(text, oText, pos.limit, incremental);
         if (match != U_MATCH) {
             return match;
@@ -419,7 +419,7 @@ UMatchDegree TransliterationRule::matchAndReplace(Replaceable& text,
 
     keyLimit = oText;
 
-    if (postContext != NULL) {
+    if (postContext != nullptr) {
         if (incremental && keyLimit == pos.limit) {
             // The key matches just before pos.limit, and there is
             // a postContext.  Since we are in incremental mode,
@@ -477,7 +477,7 @@ UnicodeString& TransliterationRule::toRule(UnicodeString& rule,
     // Do not emit the braces '{' '}' around the pattern if there
     // is neither anteContext nor postContext.
     UBool emitBraces =
-        (anteContext != NULL) || (postContext != NULL);
+        (anteContext != nullptr) || (postContext != nullptr);
 
     // Emit start anchor
     if ((flags & ANCHOR_START) != 0) {
@@ -518,10 +518,10 @@ UnicodeString& TransliterationRule::toRule(UnicodeString& rule,
 
 void TransliterationRule::setData(const TransliterationRuleData* d) {
     data = d;
-    if (anteContext != NULL) anteContext->setData(d);
-    if (postContext != NULL) postContext->setData(d);
-    if (key != NULL) key->setData(d);
-    // assert(output != NULL);
+    if (anteContext != nullptr) anteContext->setData(d);
+    if (postContext != nullptr) postContext->setData(d);
+    if (key != nullptr) key->setData(d);
+    // assert(output != nullptr);
     output->setData(d);
     // Don't have to do segments since they are in the context or key
 }
@@ -536,7 +536,7 @@ void TransliterationRule::addSourceSetTo(UnicodeSet& toUnionTo) const {
         UChar32 ch = pattern.char32At(i);
         i += U16_LENGTH(ch);
         const UnicodeMatcher* matcher = data->lookupMatcher(ch);
-        if (matcher == NULL) {
+        if (matcher == nullptr) {
             toUnionTo.add(ch);
         } else {
             matcher->addMatchSetTo(toUnionTo);
index b927f5d6c05c110d281719bdf73fbc942dabd7c9..7ea39f7a3531be66f04c5dac9db2e2ae668c530b 100644 (file)
@@ -108,7 +108,7 @@ private:
     UnicodeFunctor** segments;
 
     /**
-     * The number of elements in segments[] or zero if segments is NULL.
+     * The number of elements in segments[] or zero if segments is nullptr.
      */
     int32_t segmentsCount;
 
index c517467436158411af39b854ec826c68f5bf8ed2..29dde8a9bbadaddf16d77b6071b89ec1c1d1a8fd 100644 (file)
@@ -296,7 +296,7 @@ void TransliterationRuleSet::freeze(UParseError& parseError,UErrorCode& status)
      * Be careful not to call malloc(0).
      */
     int16_t* indexValue = (int16_t*) uprv_malloc( sizeof(int16_t) * (n > 0 ? n : 1) );
-    /* test for NULL */
+    /* test for nullptr */
     if (indexValue == 0) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
@@ -336,11 +336,11 @@ void TransliterationRuleSet::freeze(UParseError& parseError,UErrorCode& status)
 
     /* You can't do malloc(0)! */
     if (v.size() == 0) {
-        rules = NULL;
+        rules = nullptr;
         return;
     }
     rules = (TransliterationRule **)uprv_malloc(v.size() * sizeof(TransliterationRule *));
-    /* test for NULL */
+    /* test for nullptr */
     if (rules == 0) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
@@ -417,7 +417,7 @@ UBool TransliterationRuleSet::transliterate(Replaceable& text,
     }
     // No match or partial match from any rule
     pos.start += U16_LENGTH(text.char32At(pos.start));
-    _debugOut("no match", NULL, text, pos);
+    _debugOut("no match", nullptr, text, pos);
     return true;
 }
 
index 0e174bab38a0151d3125257a787341d80399db06..fe4a0425ec748a8c4a410c2e89de5c641047a11f 100644 (file)
@@ -39,9 +39,9 @@ deleteTransition(void* obj) {
 U_CDECL_END
 
 static UBool compareRules(UVector* rules1, UVector* rules2) {
-    if (rules1 == NULL && rules2 == NULL) {
+    if (rules1 == nullptr && rules2 == nullptr) {
         return true;
-    } else if (rules1 == NULL || rules2 == NULL) {
+    } else if (rules1 == nullptr || rules2 == nullptr) {
         return false;
     }
     int32_t size = rules1->size();
@@ -61,13 +61,13 @@ static UBool compareRules(UVector* rules1, UVector* rules2) {
 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RuleBasedTimeZone)
 
 RuleBasedTimeZone::RuleBasedTimeZone(const UnicodeString& id, InitialTimeZoneRule* initialRule)
-: BasicTimeZone(id), fInitialRule(initialRule), fHistoricRules(NULL), fFinalRules(NULL),
-  fHistoricTransitions(NULL), fUpToDate(false) {
+: BasicTimeZone(id), fInitialRule(initialRule), fHistoricRules(nullptr), fFinalRules(nullptr),
+  fHistoricTransitions(nullptr), fUpToDate(false) {
 }
 
 RuleBasedTimeZone::RuleBasedTimeZone(const RuleBasedTimeZone& source)
 : BasicTimeZone(source), fInitialRule(source.fInitialRule->clone()),
-  fHistoricTransitions(NULL), fUpToDate(false) {
+  fHistoricTransitions(nullptr), fUpToDate(false) {
     fHistoricRules = copyRules(source.fHistoricRules);
     fFinalRules = copyRules(source.fFinalRules);
     if (source.fUpToDate) {
@@ -180,23 +180,23 @@ RuleBasedTimeZone::complete(UErrorCode& status) {
     }
     // Make sure either no final rules or a pair of AnnualTimeZoneRules
     // are available.
-    if (fFinalRules != NULL && fFinalRules->size() != 2) {
+    if (fFinalRules != nullptr && fFinalRules->size() != 2) {
         status = U_INVALID_STATE_ERROR;
         return;
     }
 
     // Create a TimezoneTransition and add to the list
-    if (fHistoricRules != NULL || fFinalRules != NULL) {
+    if (fHistoricRules != nullptr || fFinalRules != nullptr) {
         TimeZoneRule *curRule = fInitialRule;
         UDate lastTransitionTime = MIN_MILLIS;
 
         // Build the transition array which represents historical time zone
         // transitions.
-        if (fHistoricRules != NULL && fHistoricRules->size() > 0) {
+        if (fHistoricRules != nullptr && fHistoricRules->size() > 0) {
             int32_t i;
             int32_t historicCount = fHistoricRules->size();
             LocalMemory<bool> done((bool *)uprv_malloc(sizeof(bool) * historicCount));
-            if (done == NULL) {
+            if (done == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 goto cleanup;
             }
@@ -207,8 +207,8 @@ RuleBasedTimeZone::complete(UErrorCode& status) {
                 int32_t curStdOffset = curRule->getRawOffset();
                 int32_t curDstSavings = curRule->getDSTSavings();
                 UDate nextTransitionTime = MAX_MILLIS;
-                TimeZoneRule *nextRule = NULL;
-                TimeZoneRule *r = NULL;
+                TimeZoneRule *nextRule = nullptr;
+                TimeZoneRule *r = nullptr;
                 UBool avail;
                 UDate tt;
                 UnicodeString curName, name;
@@ -237,7 +237,7 @@ RuleBasedTimeZone::complete(UErrorCode& status) {
                     }
                 }
 
-                if (nextRule ==  NULL) {
+                if (nextRule ==  nullptr) {
                     // Check if all historic rules are done
                     UBool bDoneAll = true;
                     for (int32_t j = 0; j < historicCount; j++) {
@@ -251,7 +251,7 @@ RuleBasedTimeZone::complete(UErrorCode& status) {
                     }
                 }
 
-                if (fFinalRules != NULL) {
+                if (fFinalRules != nullptr) {
                     // Check if one of final rules has earlier transition date
                     for (i = 0; i < 2 /* fFinalRules->size() */; i++) {
                         TimeZoneRule *fr = (TimeZoneRule*)fFinalRules->elementAt(i);
@@ -269,12 +269,12 @@ RuleBasedTimeZone::complete(UErrorCode& status) {
                     }
                 }
 
-                if (nextRule == NULL) {
+                if (nextRule == nullptr) {
                     // Nothing more
                     break;
                 }
 
-                if (fHistoricTransitions == NULL) {
+                if (fHistoricTransitions == nullptr) {
                     LocalPointer<UVector> lpHistoricTransitions(
                         new UVector(deleteTransition, nullptr, status), status);
                     if (U_FAILURE(status)) {
@@ -297,8 +297,8 @@ RuleBasedTimeZone::complete(UErrorCode& status) {
                 curRule = nextRule;
             }
         }
-        if (fFinalRules != NULL) {
-            if (fHistoricTransitions == NULL) {
+        if (fFinalRules != nullptr) {
+            if (fHistoricTransitions == nullptr) {
                 LocalPointer<UVector> lpHistoricTransitions(
                     new UVector(deleteTransition, nullptr, status), status);
                 if (U_FAILURE(status)) {
@@ -427,8 +427,8 @@ RuleBasedTimeZone::getOffsetInternal(UDate date, UBool local,
         status = U_INVALID_STATE_ERROR;
         return;
     }
-    const TimeZoneRule *rule = NULL;
-    if (fHistoricTransitions == NULL) {
+    const TimeZoneRule *rule = nullptr;
+    if (fHistoricTransitions == nullptr) {
         rule = fInitialRule;
     } else {
         UDate tstart = getTransitionTime((Transition*)fHistoricTransitions->elementAt(0),
@@ -440,10 +440,10 @@ RuleBasedTimeZone::getOffsetInternal(UDate date, UBool local,
             UDate tend = getTransitionTime((Transition*)fHistoricTransitions->elementAt(idx),
                 local, NonExistingTimeOpt, DuplicatedTimeOpt);
             if (date > tend) {
-                if (fFinalRules != NULL) {
+                if (fFinalRules != nullptr) {
                     rule = findRuleInFinal(date, local, NonExistingTimeOpt, DuplicatedTimeOpt);
                 }
-                if (rule == NULL) {
+                if (rule == nullptr) {
                     // no final rules or the given time is before the first transition
                     // specified by the final rules -> use the last rule 
                     rule = ((Transition*)fHistoricTransitions->elementAt(idx))->to;
@@ -461,7 +461,7 @@ RuleBasedTimeZone::getOffsetInternal(UDate date, UBool local,
             }
         }
     }
-    if (rule != NULL) {
+    if (rule != nullptr) {
         rawOffset = rule->getRawOffset();
         dstOffset = rule->getDSTSavings();
     }
@@ -578,10 +578,10 @@ RuleBasedTimeZone::getPreviousTransition(UDate base, UBool inclusive, TimeZoneTr
 int32_t
 RuleBasedTimeZone::countTransitionRules(UErrorCode& /*status*/) const {
     int32_t count = 0;
-    if (fHistoricRules != NULL) {
+    if (fHistoricRules != nullptr) {
         count += fHistoricRules->size();
     }
-    if (fFinalRules != NULL) {
+    if (fFinalRules != nullptr) {
         count += fFinalRules->size();
     }
     return count;
@@ -601,14 +601,14 @@ RuleBasedTimeZone::getTimeZoneRules(const InitialTimeZoneRule*& initial,
     // Transition rules
     int32_t cnt = 0;
     int32_t idx;
-    if (fHistoricRules != NULL && cnt < trscount) {
+    if (fHistoricRules != nullptr && cnt < trscount) {
         int32_t historicCount = fHistoricRules->size();
         idx = 0;
         while (cnt < trscount && idx < historicCount) {
             trsrules[cnt++] = (const TimeZoneRule*)fHistoricRules->elementAt(idx++);
         }
     }
-    if (fFinalRules != NULL && cnt < trscount) {
+    if (fFinalRules != nullptr && cnt < trscount) {
         int32_t finalCount = fFinalRules->size();
         idx = 0;
         while (cnt < trscount && idx < finalCount) {
@@ -622,23 +622,23 @@ RuleBasedTimeZone::getTimeZoneRules(const InitialTimeZoneRule*& initial,
 void
 RuleBasedTimeZone::deleteRules(void) {
     delete fInitialRule;
-    fInitialRule = NULL;
-    if (fHistoricRules != NULL) {
+    fInitialRule = nullptr;
+    if (fHistoricRules != nullptr) {
         delete fHistoricRules;
-        fHistoricRules = NULL;
+        fHistoricRules = nullptr;
     }
-    if (fFinalRules != NULL) {
+    if (fFinalRules != nullptr) {
         delete fFinalRules;
-        fFinalRules = NULL;
+        fFinalRules = nullptr;
     }
 }
 
 void
 RuleBasedTimeZone::deleteTransitions(void) {
-    if (fHistoricTransitions != NULL) {
+    if (fHistoricTransitions != nullptr) {
         delete fHistoricTransitions;
     }
-    fHistoricTransitions = NULL;
+    fHistoricTransitions = nullptr;
 }
 
 UVector*
@@ -666,14 +666,14 @@ RuleBasedTimeZone::copyRules(UVector* source) {
 TimeZoneRule*
 RuleBasedTimeZone::findRuleInFinal(UDate date, UBool local,
                                    int32_t NonExistingTimeOpt, int32_t DuplicatedTimeOpt) const {
-    if (fFinalRules == NULL) {
-        return NULL;
+    if (fFinalRules == nullptr) {
+        return nullptr;
     }
 
     AnnualTimeZoneRule* fr0 = (AnnualTimeZoneRule*)fFinalRules->elementAt(0);
     AnnualTimeZoneRule* fr1 = (AnnualTimeZoneRule*)fFinalRules->elementAt(1);
-    if (fr0 == NULL || fr1 == NULL) {
-        return NULL;
+    if (fr0 == nullptr || fr1 == nullptr) {
+        return nullptr;
     }
 
     UDate start0, start1;
@@ -705,7 +705,7 @@ RuleBasedTimeZone::findRuleInFinal(UDate date, UBool local,
             return fr1;
         }
         // Both rules take effect after the given time
-        return NULL;
+        return nullptr;
     }
 
     return (start0 > start1) ? fr0 : fr1;
@@ -714,7 +714,7 @@ RuleBasedTimeZone::findRuleInFinal(UDate date, UBool local,
 UBool
 RuleBasedTimeZone::findNext(UDate base, UBool inclusive, UDate& transitionTime,
                             TimeZoneRule*& fromRule, TimeZoneRule*& toRule) const {
-    if (fHistoricTransitions == NULL) {
+    if (fHistoricTransitions == nullptr) {
         return false;
     }
     UBool isFinal = false;
@@ -733,7 +733,7 @@ RuleBasedTimeZone::findNext(UDate base, UBool inclusive, UDate& transitionTime,
             result = *tzt;
             found = true;
         } else if (tt <= base) {
-            if (fFinalRules != NULL) {
+            if (fFinalRules != nullptr) {
                 // Find a transion time with finalRules
                 TimeZoneRule *r0 = (TimeZoneRule*)fFinalRules->elementAt(0);
                 TimeZoneRule *r1 = (TimeZoneRule*)fFinalRules->elementAt(1);
@@ -798,7 +798,7 @@ RuleBasedTimeZone::findNext(UDate base, UBool inclusive, UDate& transitionTime,
 UBool
 RuleBasedTimeZone::findPrev(UDate base, UBool inclusive, UDate& transitionTime,
                             TimeZoneRule*& fromRule, TimeZoneRule*& toRule) const {
-    if (fHistoricTransitions == NULL) {
+    if (fHistoricTransitions == nullptr) {
         return false;
     }
     UBool found = false;
@@ -816,7 +816,7 @@ RuleBasedTimeZone::findPrev(UDate base, UBool inclusive, UDate& transitionTime,
             result = *tzt;
             found = true;
         } else if (tt < base) {
-            if (fFinalRules != NULL) {
+            if (fFinalRules != nullptr) {
                 // Find a transion time with finalRules
                 TimeZoneRule *r0 = (TimeZoneRule*)fFinalRules->elementAt(0);
                 TimeZoneRule *r1 = (TimeZoneRule*)fFinalRules->elementAt(1);
index adc8f700c7ff4be641e6c1fc22b359312944cdeb..df315174ca878da04e9ab0e85bfb33c608d5f7d7 100644 (file)
@@ -73,7 +73,7 @@ RegexCompile::RegexCompile(RegexPattern *rxp, UErrorCode &status) :
 
     fMatchOpenParen   = -1;
     fMatchCloseParen  = -1;
-    fCaptureName      = NULL;
+    fCaptureName      = nullptr;
     fLastSetLiteral   = U_SENTINEL;
 
     if (U_SUCCESS(status) && U_FAILURE(rxp->fDeferredStatus)) {
@@ -91,7 +91,7 @@ static const UChar      chDash      = 0x2d;      // '-'
 //
 //------------------------------------------------------------------------------
 RegexCompile::~RegexCompile() {
-    delete fCaptureName;         // Normally will be NULL, but can exist if pattern
+    delete fCaptureName;         // Normally will be nullptr, but can exist if pattern
                                  //   compilation stops with a syntax error.
 }
 
@@ -141,7 +141,7 @@ void    RegexCompile::compile(
     }
 
     // There should be no pattern stuff in the RegexPattern object.  They can not be reused.
-    U_ASSERT(fRXPat->fPattern == NULL || utext_nativeLength(fRXPat->fPattern) == 0);
+    U_ASSERT(fRXPat->fPattern == nullptr || utext_nativeLength(fRXPat->fPattern) == 0);
 
     // Prepare the RegexPattern object to receive the compiled pattern.
     fRXPat->fPattern        = utext_clone(fRXPat->fPattern, pat, false, true, fStatus);
@@ -317,7 +317,7 @@ void    RegexCompile::compile(
     int32_t numSets = fRXPat->fSets->size();
     fRXPat->fSets8 = new Regex8BitSet[numSets];
     // Null pointer check.
-    if (fRXPat->fSets8 == NULL) {
+    if (fRXPat->fSets8 == nullptr) {
         e = *fStatus = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -430,7 +430,7 @@ UBool RegexCompile::doParseActions(int32_t action)
         // Scanning (?<letter.
         //   The first letter of the name will come through again under doConinueNamedCapture.
         fCaptureName = new UnicodeString();
-        if (fCaptureName == NULL) {
+        if (fCaptureName == nullptr) {
             error(U_MEMORY_ALLOCATION_ERROR);
         }
         break;
@@ -481,7 +481,7 @@ UBool RegexCompile::doParseActions(int32_t action)
             fRXPat->fGroupMap->addElement(varsLoc, *fStatus);
 
             // If this is a named capture group, add the name->group number mapping.
-            if (fCaptureName != NULL) {
+            if (fCaptureName != nullptr) {
                 if (!fRXPat->initNamedCaptureMap()) {
                     if (U_SUCCESS(*fStatus)) {
                         error(fRXPat->fDeferredStatus);
@@ -490,7 +490,7 @@ UBool RegexCompile::doParseActions(int32_t action)
                 }
                 int32_t groupNumber = fRXPat->fGroupMap->size();
                 int32_t previousMapping = uhash_puti(fRXPat->fNamedCaptureMap, fCaptureName, groupNumber, fStatus);
-                fCaptureName = NULL;    // hash table takes ownership of the name (key) string.
+                fCaptureName = nullptr;    // hash table takes ownership of the name (key) string.
                 if (previousMapping > 0 && U_SUCCESS(*fStatus)) {
                     error(U_REGEX_INVALID_CAPTURE_GROUP_NAME);
                 }
@@ -1333,9 +1333,9 @@ UBool RegexCompile::doParseActions(int32_t action)
         break;
 
     case doBeginNamedBackRef:
-        U_ASSERT(fCaptureName == NULL);
+        U_ASSERT(fCaptureName == nullptr);
         fCaptureName = new UnicodeString;
-        if (fCaptureName == NULL) {
+        if (fCaptureName == nullptr) {
             error(U_MEMORY_ALLOCATION_ERROR);
         }
         break;
@@ -1364,7 +1364,7 @@ UBool RegexCompile::doParseActions(int32_t action)
             }
         }
         delete fCaptureName;
-        fCaptureName = NULL;
+        fCaptureName = nullptr;
         break;
         }
        
@@ -1820,7 +1820,7 @@ UBool RegexCompile::doParseActions(int32_t action)
     case doSetPosixProp:
         {
             UnicodeSet *s = scanPosixProp();
-            if (s != NULL) {
+            if (s != nullptr) {
                 UnicodeSet *tos = (UnicodeSet *)fSetStack.peek();
                 tos->addAll(*s);
                 delete s;
@@ -1832,7 +1832,7 @@ UBool RegexCompile::doParseActions(int32_t action)
         //  Scanned a \p \P within [brackets].
         {
             UnicodeSet *s = scanProp();
-            if (s != NULL) {
+            if (s != nullptr) {
                 UnicodeSet *tos = (UnicodeSet *)fSetStack.peek();
                 tos->addAll(*s);
                 delete s;
@@ -2390,7 +2390,7 @@ void  RegexCompile::handleCloseParen() {
 //------------------------------------------------------------------------------
 void        RegexCompile::compileSet(UnicodeSet *theSet)
 {
-    if (theSet == NULL) {
+    if (theSet == nullptr) {
         return;
     }
     //  Remove any strings from the set.
@@ -4249,14 +4249,14 @@ UChar32  RegexCompile::scanNamedChar() {
 //             the scan position should be just after the '}'
 //
 //             Return a UnicodeSet, constructed from the \P pattern,
-//             or NULL if the pattern is invalid.
+//             or nullptr if the pattern is invalid.
 //
 //------------------------------------------------------------------------------
 UnicodeSet *RegexCompile::scanProp() {
-    UnicodeSet    *uset = NULL;
+    UnicodeSet    *uset = nullptr;
 
     if (U_FAILURE(*fStatus)) {
-        return NULL;
+        return nullptr;
     }
     (void)chLowerP;   // Suppress compiler unused variable warning.
     U_ASSERT(fC.fChar == chLowerP || fC.fChar == chP);
@@ -4266,7 +4266,7 @@ UnicodeSet *RegexCompile::scanProp() {
     nextChar(fC);
     if (fC.fChar != chLBrace) {
         error(U_REGEX_PROPERTY_SYNTAX);
-        return NULL;
+        return nullptr;
     }
     for (;;) {
         nextChar(fC);
@@ -4276,7 +4276,7 @@ UnicodeSet *RegexCompile::scanProp() {
         if (fC.fChar == -1) {
             // Hit the end of the input string without finding the closing '}'
             error(U_REGEX_PROPERTY_SYNTAX);
-            return NULL;
+            return nullptr;
         }
         propertyName.append(fC.fChar);
     }
@@ -4294,7 +4294,7 @@ UnicodeSet *RegexCompile::scanProp() {
 //             the scan position must be on the closing ']'
 //
 //             Return a UnicodeSet constructed from the pattern,
-//             or NULL if this is not a valid POSIX-style set expression.
+//             or nullptr if this is not a valid POSIX-style set expression.
 //             If not a property expression, restore the initial scan position
 //                (to the opening ':')
 //
@@ -4305,10 +4305,10 @@ UnicodeSet *RegexCompile::scanProp() {
 //
 //------------------------------------------------------------------------------
 UnicodeSet *RegexCompile::scanPosixProp() {
-    UnicodeSet    *uset = NULL;
+    UnicodeSet    *uset = nullptr;
 
     if (U_FAILURE(*fStatus)) {
-        return NULL;
+        return nullptr;
     }
 
     U_ASSERT(fC.fChar == chColon);
@@ -4412,7 +4412,7 @@ UnicodeSet *RegexCompile::createSetForProperty(const UnicodeString &propName, UB
         if (fModeFlags & UREGEX_CASE_INSENSITIVE) {
             usetFlags |= USET_CASE_INSENSITIVE;
         }
-        set.adoptInsteadAndCheckErrorCode(new UnicodeSet(setExpr, usetFlags, NULL, status), status);
+        set.adoptInsteadAndCheckErrorCode(new UnicodeSet(setExpr, usetFlags, nullptr, status), status);
         if (U_SUCCESS(status) || status == U_MEMORY_ALLOCATION_ERROR) {
             break;
         }
@@ -4610,8 +4610,8 @@ UnicodeSet *RegexCompile::createSetForProperty(const UnicodeString &propName, UB
 //            in the expression.
 //
 void RegexCompile::setEval(int32_t nextOp) {
-    UnicodeSet *rightOperand = NULL;
-    UnicodeSet *leftOperand  = NULL;
+    UnicodeSet *rightOperand = nullptr;
+    UnicodeSet *leftOperand  = nullptr;
     for (;;) {
         U_ASSERT(fSetOpStack.empty()==false);
         int32_t pendingSetOperation = fSetOpStack.peeki();
index d55566962587e426fb3f6c44776dad9460f4373a..764a6afc0eb2bcf6157ad72a39c6c170672d7129 100644 (file)
@@ -19,7 +19,7 @@
 U_NAMESPACE_BEGIN
 
 CaseFoldingUTextIterator::CaseFoldingUTextIterator(UText &text) :
-   fUText(text), fFoldChars(NULL), fFoldLength(0) {
+   fUText(text), fFoldChars(nullptr), fFoldLength(0) {
 }
 
 CaseFoldingUTextIterator::~CaseFoldingUTextIterator() {}
@@ -27,7 +27,7 @@ CaseFoldingUTextIterator::~CaseFoldingUTextIterator() {}
 UChar32 CaseFoldingUTextIterator::next() {
     UChar32  foldedC;
     UChar32  originalC;
-    if (fFoldChars == NULL) {
+    if (fFoldChars == nullptr) {
         // We are not in a string folding of an earlier character.
         // Start handling the next char from the input UText.
         originalC = UTEXT_NEXT32(&fUText);
@@ -42,7 +42,7 @@ UChar32 CaseFoldingUTextIterator::next() {
                 fFoldLength = ~fFoldLength;
             }
             foldedC = (UChar32)fFoldLength;
-            fFoldChars = NULL;
+            fFoldChars = nullptr;
             return foldedC;
         }
         // String foldings fall through here.
@@ -51,20 +51,20 @@ UChar32 CaseFoldingUTextIterator::next() {
 
     U16_NEXT(fFoldChars, fFoldIndex, fFoldLength, foldedC);
     if (fFoldIndex >= fFoldLength) {
-        fFoldChars = NULL;
+        fFoldChars = nullptr;
     }
     return foldedC;
 }
     
 
 UBool CaseFoldingUTextIterator::inExpansion() {
-    return fFoldChars != NULL;
+    return fFoldChars != nullptr;
 }
 
 
 
 CaseFoldingUCharIterator::CaseFoldingUCharIterator(const UChar *chars, int64_t start, int64_t limit) :
-   fChars(chars), fIndex(start), fLimit(limit), fFoldChars(NULL), fFoldLength(0) {
+   fChars(chars), fIndex(start), fLimit(limit), fFoldChars(nullptr), fFoldLength(0) {
 }
 
 
@@ -74,7 +74,7 @@ CaseFoldingUCharIterator::~CaseFoldingUCharIterator() {}
 UChar32 CaseFoldingUCharIterator::next() {
     UChar32  foldedC;
     UChar32  originalC;
-    if (fFoldChars == NULL) {
+    if (fFoldChars == nullptr) {
         // We are not in a string folding of an earlier character.
         // Start handling the next char from the input UText.
         if (fIndex >= fLimit) {
@@ -90,7 +90,7 @@ UChar32 CaseFoldingUCharIterator::next() {
                 fFoldLength = ~fFoldLength;
             }
             foldedC = (UChar32)fFoldLength;
-            fFoldChars = NULL;
+            fFoldChars = nullptr;
             return foldedC;
         }
         // String foldings fall through here.
@@ -99,14 +99,14 @@ UChar32 CaseFoldingUCharIterator::next() {
 
     U16_NEXT(fFoldChars, fFoldIndex, fFoldLength, foldedC);
     if (fFoldIndex >= fFoldLength) {
-        fFoldChars = NULL;
+        fFoldChars = nullptr;
     }
     return foldedC;
 }
     
 
 UBool CaseFoldingUCharIterator::inExpansion() {
-    return fFoldChars != NULL;
+    return fFoldChars != nullptr;
 }
 
 int64_t CaseFoldingUCharIterator::getIndex() {
index bb0e1e838de6516f43cbc5b0ed8c1b86e3343262..a076b5ad04b34eaec0c7c6d77455df0768ad1c9e 100644 (file)
@@ -343,7 +343,7 @@ inline void  Regex8BitSet::add(UChar32 c) {
 }
 
 inline void Regex8BitSet::init(const UnicodeSet *s) {
-    if (s != NULL) {
+    if (s != nullptr) {
         for (int32_t i=0; i<=255; i++) {
             if (s->contains(i)) {
                 this->add(i);
index 6a0c05fc78f2974f4b62b88c2a2d4b87d4f2b77a..f422861320207224d0fac9cba42a903d2ce4a8d0 100644 (file)
@@ -56,10 +56,10 @@ U_NAMESPACE_BEGIN
 static UInitOnce gRegionDataInitOnce {};
 static UVector* availableRegions[URGN_LIMIT];
 
-static UHashtable *regionAliases = NULL;
-static UHashtable *regionIDMap = NULL;
-static UHashtable *numericCodeMap = NULL;
-static UVector *allRegions = NULL;
+static UHashtable *regionAliases = nullptr;
+static UHashtable *regionIDMap = nullptr;
+static UHashtable *numericCodeMap = nullptr;
+static UVector *allRegions = nullptr;
 
 static const UChar UNKNOWN_REGION_ID [] = { 0x5A, 0x5A, 0 };  /* "ZZ" */
 static const UChar OUTLYING_OCEANIA_REGION_ID [] = { 0x51, 0x4F, 0 };  /* "QO" */
@@ -79,31 +79,31 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RegionNameEnumeration)
 void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
 
     // Construct service objs first
-    LocalUHashtablePointer newRegionIDMap(uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, &status));
-    LocalUHashtablePointer newNumericCodeMap(uhash_open(uhash_hashLong,uhash_compareLong,NULL,&status));
-    LocalUHashtablePointer newRegionAliases(uhash_open(uhash_hashUnicodeString,uhash_compareUnicodeString,NULL,&status));
+    LocalUHashtablePointer newRegionIDMap(uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, nullptr, &status));
+    LocalUHashtablePointer newNumericCodeMap(uhash_open(uhash_hashLong,uhash_compareLong,nullptr,&status));
+    LocalUHashtablePointer newRegionAliases(uhash_open(uhash_hashUnicodeString,uhash_compareUnicodeString,nullptr,&status));
 
     LocalPointer<UVector> continents(new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status);
     LocalPointer<UVector> groupings(new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status);
     LocalPointer<UVector> lpAllRegions(new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status);
     allRegions = lpAllRegions.orphan();
 
-    LocalUResourceBundlePointer metadata(ures_openDirect(NULL,"metadata",&status));
-    LocalUResourceBundlePointer metadataAlias(ures_getByKey(metadata.getAlias(),"alias",NULL,&status));
-    LocalUResourceBundlePointer territoryAlias(ures_getByKey(metadataAlias.getAlias(),"territory",NULL,&status));
+    LocalUResourceBundlePointer metadata(ures_openDirect(nullptr,"metadata",&status));
+    LocalUResourceBundlePointer metadataAlias(ures_getByKey(metadata.getAlias(),"alias",nullptr,&status));
+    LocalUResourceBundlePointer territoryAlias(ures_getByKey(metadataAlias.getAlias(),"territory",nullptr,&status));
 
-    LocalUResourceBundlePointer supplementalData(ures_openDirect(NULL,"supplementalData",&status));
-    LocalUResourceBundlePointer codeMappings(ures_getByKey(supplementalData.getAlias(),"codeMappings",NULL,&status));
+    LocalUResourceBundlePointer supplementalData(ures_openDirect(nullptr,"supplementalData",&status));
+    LocalUResourceBundlePointer codeMappings(ures_getByKey(supplementalData.getAlias(),"codeMappings",nullptr,&status));
 
-    LocalUResourceBundlePointer idValidity(ures_getByKey(supplementalData.getAlias(),"idValidity",NULL,&status));
-    LocalUResourceBundlePointer regionList(ures_getByKey(idValidity.getAlias(),"region",NULL,&status));
-    LocalUResourceBundlePointer regionRegular(ures_getByKey(regionList.getAlias(),"regular",NULL,&status));
-    LocalUResourceBundlePointer regionMacro(ures_getByKey(regionList.getAlias(),"macroregion",NULL,&status));
-    LocalUResourceBundlePointer regionUnknown(ures_getByKey(regionList.getAlias(),"unknown",NULL,&status));
+    LocalUResourceBundlePointer idValidity(ures_getByKey(supplementalData.getAlias(),"idValidity",nullptr,&status));
+    LocalUResourceBundlePointer regionList(ures_getByKey(idValidity.getAlias(),"region",nullptr,&status));
+    LocalUResourceBundlePointer regionRegular(ures_getByKey(regionList.getAlias(),"regular",nullptr,&status));
+    LocalUResourceBundlePointer regionMacro(ures_getByKey(regionList.getAlias(),"macroregion",nullptr,&status));
+    LocalUResourceBundlePointer regionUnknown(ures_getByKey(regionList.getAlias(),"unknown",nullptr,&status));
 
-    LocalUResourceBundlePointer territoryContainment(ures_getByKey(supplementalData.getAlias(),"territoryContainment",NULL,&status));
-    LocalUResourceBundlePointer worldContainment(ures_getByKey(territoryContainment.getAlias(),"001",NULL,&status));
-    LocalUResourceBundlePointer groupingContainment(ures_getByKey(territoryContainment.getAlias(),"grouping",NULL,&status));
+    LocalUResourceBundlePointer territoryContainment(ures_getByKey(supplementalData.getAlias(),"territoryContainment",nullptr,&status));
+    LocalUResourceBundlePointer worldContainment(ures_getByKey(territoryContainment.getAlias(),"001",nullptr,&status));
+    LocalUResourceBundlePointer groupingContainment(ures_getByKey(territoryContainment.getAlias(),"grouping",nullptr,&status));
 
     ucln_i18n_registerCleanup(UCLN_I18N_REGION, region_cleanup);
     if (U_FAILURE(status)) {
@@ -116,7 +116,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
 
 
     while (U_SUCCESS(status) && ures_hasNext(regionRegular.getAlias())) {
-        UnicodeString regionName = ures_getNextUnicodeString(regionRegular.getAlias(),NULL,&status);
+        UnicodeString regionName = ures_getNextUnicodeString(regionRegular.getAlias(),nullptr,&status);
         int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER);
         UChar buf[6];
         regionName.extract(buf,6,status);
@@ -135,7 +135,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
     }
 
     while (U_SUCCESS(status) && ures_hasNext(regionMacro.getAlias())) {
-        UnicodeString regionName = ures_getNextUnicodeString(regionMacro.getAlias(),NULL,&status);
+        UnicodeString regionName = ures_getNextUnicodeString(regionMacro.getAlias(),nullptr,&status);
         int32_t rangeMarkerLocation = regionName.indexOf(RANGE_MARKER);
         UChar buf[6];
         regionName.extract(buf,6,status);
@@ -160,7 +160,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
     }
 
     while (U_SUCCESS(status) && ures_hasNext(worldContainment.getAlias())) {
-        UnicodeString *continentName = new UnicodeString(ures_getNextUnicodeString(worldContainment.getAlias(),NULL,&status));
+        UnicodeString *continentName = new UnicodeString(ures_getNextUnicodeString(worldContainment.getAlias(),nullptr,&status));
         continents->adoptElement(continentName,status);
     }
     if (U_FAILURE(status)) {
@@ -204,11 +204,11 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
             break;
         }
         Region *grouping = (Region *) uhash_get(newRegionIDMap.getAlias(), groupingName);
-        if (grouping != NULL) {
+        if (grouping != nullptr) {
             for (int32_t i = 0; i < ures_getSize(groupingBundle) && U_SUCCESS(status); i++) {
                 UnicodeString child = ures_getUnicodeStringByIndex(groupingBundle, i, &status);
                 if (U_SUCCESS(status)) {
-                    if (grouping->containedRegions == NULL) {
+                    if (grouping->containedRegions == nullptr) {
                         LocalPointer<UVector> lpContainedRegions(
                             new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status);
                         grouping->containedRegions = lpContainedRegions.orphan();
@@ -226,19 +226,19 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
     
     // Process the territory aliases
     while (U_SUCCESS(status) && ures_hasNext(territoryAlias.getAlias())) {
-        LocalUResourceBundlePointer res(ures_getNextResource(territoryAlias.getAlias(),NULL,&status));
+        LocalUResourceBundlePointer res(ures_getNextResource(territoryAlias.getAlias(),nullptr,&status));
         const char *aliasFrom = ures_getKey(res.getAlias());
         LocalPointer<UnicodeString> aliasFromStr(new UnicodeString(aliasFrom, -1, US_INV), status);
         UnicodeString aliasTo = ures_getUnicodeStringByKey(res.getAlias(),"replacement",&status);
-        res.adoptInstead(NULL);
+        res.adoptInstead(nullptr);
 
         const Region *aliasToRegion = (Region *) uhash_get(newRegionIDMap.getAlias(),&aliasTo);
         Region *aliasFromRegion = (Region *)uhash_get(newRegionIDMap.getAlias(),aliasFromStr.getAlias());
 
-        if ( aliasToRegion != NULL && aliasFromRegion == NULL ) { // This is just an alias from some string to a region
+        if ( aliasToRegion != nullptr && aliasFromRegion == nullptr ) { // This is just an alias from some string to a region
             uhash_put(newRegionAliases.getAlias(),(void *)aliasFromStr.orphan(), (void *)aliasToRegion,&status);
         } else {
-            if ( aliasFromRegion == NULL ) { // Deprecated region code not in the primary codes list - so need to create a deprecated region for it.
+            if ( aliasFromRegion == nullptr ) { // Deprecated region code not in the primary codes list - so need to create a deprecated region for it.
                 LocalPointer<Region> newRgn(new Region, status); 
                 if ( U_SUCCESS(status) ) {
                     aliasFromRegion = newRgn.orphan();
@@ -288,7 +288,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
 
     // Process the code mappings - This will allow us to assign numeric codes to most of the territories.
     while (U_SUCCESS(status) && ures_hasNext(codeMappings.getAlias())) {
-        UResourceBundle *mapping = ures_getNextResource(codeMappings.getAlias(),NULL,&status);
+        UResourceBundle *mapping = ures_getNextResource(codeMappings.getAlias(),nullptr,&status);
         if (U_SUCCESS(status) && ures_getType(mapping) == URES_ARRAY && ures_getSize(mapping) == 3) {
             UnicodeString codeMappingID = ures_getUnicodeStringByIndex(mapping,0,&status);
             UnicodeString codeMappingNumber = ures_getUnicodeStringByIndex(mapping,1,&status);
@@ -348,7 +348,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
 
     // Load territory containment info from the supplemental data.
     while ( ures_hasNext(territoryContainment.getAlias()) ) {
-        LocalUResourceBundlePointer mapping(ures_getNextResource(territoryContainment.getAlias(),NULL,&status));
+        LocalUResourceBundlePointer mapping(ures_getNextResource(territoryContainment.getAlias(),nullptr,&status));
         if( U_FAILURE(status) ) {
             return;  // error out
         }
@@ -363,10 +363,10 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
         for ( int j = 0 ; j < ures_getSize(mapping.getAlias()); j++ ) {
             UnicodeString child = ures_getUnicodeStringByIndex(mapping.getAlias(),j,&status);
             Region *childRegion = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)&child);
-            if ( parentRegion != NULL && childRegion != NULL ) {
+            if ( parentRegion != nullptr && childRegion != nullptr ) {
 
                 // Add the child region to the set of regions contained by the parent
-                if (parentRegion->containedRegions == NULL) {
+                if (parentRegion->containedRegions == nullptr) {
                     LocalPointer<UVector> lpContainedRegions(
                         new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status);
                     parentRegion->containedRegions = lpContainedRegions.orphan();
@@ -399,7 +399,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
     int32_t pos = UHASH_FIRST;
     while ( const UHashElement* element = uhash_nextElement(newRegionIDMap.getAlias(),&pos)) {
         Region *ar = (Region *)element->value.pointer;
-        if ( availableRegions[ar->fType] == NULL ) {
+        if ( availableRegions[ar->fType] == nullptr ) {
             LocalPointer<UVector> newAr(new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status);
             availableRegions[ar->fType] = newAr.orphan();
         }
@@ -437,10 +437,10 @@ void Region::cleanupRegionData() {
     }
     if (allRegions) {
         delete allRegions;
-        allRegions = NULL;
+        allRegions = nullptr;
     }
 
-    regionAliases = numericCodeMap = regionIDMap = NULL;
+    regionAliases = numericCodeMap = regionIDMap = nullptr;
 
     gRegionDataInitOnce.reset();
 }
@@ -448,9 +448,9 @@ void Region::cleanupRegionData() {
 Region::Region ()
         : code(-1),
           fType(URGN_UNKNOWN),
-          containingRegion(NULL),
-          containedRegions(NULL),
-          preferredValues(NULL) {
+          containingRegion(nullptr),
+          containedRegions(nullptr),
+          preferredValues(nullptr) {
     id[0] = 0;
 }
 
@@ -485,19 +485,19 @@ Region::operator!=(const Region &that) const {
  * Returns a pointer to a Region using the given region code.  The region code can be either 2-letter ISO code,
  * 3-letter ISO code,  UNM.49 numeric code, or other valid Unicode Region Code as defined by the LDML specification.
  * The identifier will be canonicalized internally using the supplemental metadata as defined in the CLDR.
- * If the region code is NULL or not recognized, the appropriate error code will be set ( U_ILLEGAL_ARGUMENT_ERROR )
+ * If the region code is nullptr or not recognized, the appropriate error code will be set ( U_ILLEGAL_ARGUMENT_ERROR )
  */
 const Region* U_EXPORT2
 Region::getInstance(const char *region_code, UErrorCode &status) {
 
     umtx_initOnce(gRegionDataInitOnce, &loadRegionData, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     if ( !region_code ) {
         status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     UnicodeString regionCodeString = UnicodeString(region_code, -1, US_INV);
@@ -509,7 +509,7 @@ Region::getInstance(const char *region_code, UErrorCode &status) {
 
     if ( !r ) { // Unknown region code
         status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     if ( r->fType == URGN_DEPRECATED && r->preferredValues->size() == 1) {
@@ -533,7 +533,7 @@ Region::getInstance (int32_t code, UErrorCode &status) {
 
     umtx_initOnce(gRegionDataInitOnce, &loadRegionData, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     Region *r = (Region *)uhash_iget(numericCodeMap,code);
@@ -545,12 +545,12 @@ Region::getInstance (int32_t code, UErrorCode &status) {
     }
 
     if( U_FAILURE(status) ) {
-        return NULL;
+        return nullptr;
     }
 
     if ( !r ) {
         status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     if ( r->fType == URGN_DEPRECATED && r->preferredValues->size() == 1) {
@@ -572,13 +572,13 @@ StringEnumeration* U_EXPORT2
 Region::getAvailable(URegionType type, UErrorCode &status) {
     umtx_initOnce(gRegionDataInitOnce, &loadRegionData, status); // returns immediately if U_FAILURE(status)
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     return new RegionNameEnumeration(availableRegions[type],status);
 }
 
 /**
- * Returns a pointer to the region that contains this region.  Returns NULL if this region is code "001" (World)
+ * Returns a pointer to the region that contains this region.  Returns nullptr if this region is code "001" (World)
  * or "ZZ" (Unknown region). For example, calling this method with region "IT" (Italy) returns the
  * region "039" (Southern Europe).
  */
@@ -591,17 +591,17 @@ Region::getContainingRegion() const {
 
 /**
  * Return a pointer to the region that geographically contains this region and matches the given type,
- * moving multiple steps up the containment chain if necessary.  Returns NULL if no containing region can be found
+ * moving multiple steps up the containment chain if necessary.  Returns nullptr if no containing region can be found
  * that matches the given type. Note: The URegionTypes = "URGN_GROUPING", "URGN_DEPRECATED", or "URGN_UNKNOWN"
- * are not appropriate for use in this API. NULL will be returned in this case. For example, calling this method
+ * are not appropriate for use in this API. nullptr will be returned in this case. For example, calling this method
  * with region "IT" (Italy) for type "URGN_CONTINENT" returns the region "150" ( Europe ).
  */
 const Region*
 Region::getContainingRegion(URegionType type) const {
     UErrorCode status = U_ZERO_ERROR;
     umtx_initOnce(gRegionDataInitOnce, &loadRegionData, status);
-    if ( containingRegion == NULL ) {
-        return NULL;
+    if ( containingRegion == nullptr ) {
+        return nullptr;
     }
 
     return ( containingRegion->fType == type)? containingRegion: containingRegion->getContainingRegion(type);
@@ -610,7 +610,7 @@ Region::getContainingRegion(URegionType type) const {
 /**
  * Return an enumeration over the IDs of all the regions that are immediate children of this region in the
  * region hierarchy. These returned regions could be either macro regions, territories, or a mixture of the two,
- * depending on the containment data as defined in CLDR.  This API may return NULL if this region doesn't have
+ * depending on the containment data as defined in CLDR.  This API may return nullptr if this region doesn't have
  * any sub-regions. For example, calling this method with region "150" (Europe) returns an enumeration containing
  * the various sub regions of Europe - "039" (Southern Europe) - "151" (Eastern Europe) - "154" (Northern Europe)
  * and "155" (Western Europe).
@@ -619,7 +619,7 @@ StringEnumeration*
 Region::getContainedRegions(UErrorCode &status) const {
     umtx_initOnce(gRegionDataInitOnce, &loadRegionData, status); // returns immediately if U_FAILURE(status)
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     return new RegionNameEnumeration(containedRegions,status);
 }
@@ -687,14 +687,14 @@ Region::contains(const Region &other) const {
 
 /**
  * For deprecated regions, return an enumeration over the IDs of the regions that are the preferred replacement
- * regions for this region.  Returns NULL for a non-deprecated region.  For example, calling this method with region
+ * regions for this region.  Returns nullptr for a non-deprecated region.  For example, calling this method with region
  * "SU" (Soviet Union) would return a list of the regions containing "RU" (Russia), "AM" (Armenia), "AZ" (Azerbaijan), etc...
  */
 StringEnumeration*
 Region::getPreferredValues(UErrorCode &status) const {
     umtx_initOnce(gRegionDataInitOnce, &loadRegionData, status); // returns immediately if U_FAILURE(status)
     if (U_FAILURE(status) || fType != URGN_DEPRECATED) {
-        return NULL;
+        return nullptr;
     }
     return new RegionNameEnumeration(preferredValues,status);
 }
@@ -741,11 +741,11 @@ RegionNameEnumeration::RegionNameEnumeration(UVector *nameList, UErrorCode& stat
 
 const UnicodeString*
 RegionNameEnumeration::snext(UErrorCode& status) {
-  if (U_FAILURE(status) || (fRegionNames==NULL)) {
-    return NULL;
+  if (U_FAILURE(status) || (fRegionNames==nullptr)) {
+    return nullptr;
   }
   const UnicodeString* nextStr = (const UnicodeString *)fRegionNames->elementAt(pos);
-  if (nextStr!=NULL) {
+  if (nextStr!=nullptr) {
     pos++;
   }
   return nextStr;
@@ -758,7 +758,7 @@ RegionNameEnumeration::reset(UErrorCode& /*status*/) {
 
 int32_t
 RegionNameEnumeration::count(UErrorCode& /*status*/) const {
-    return (fRegionNames==NULL) ? 0 : fRegionNames->size();
+    return (fRegionNames==nullptr) ? 0 : fRegionNames->size();
 }
 
 RegionNameEnumeration::~RegionNameEnumeration() {
index f381bf8981a93b7256a4d846951c2e6aa079e880..62c884ded7b547f96d0f3392be4c38c3017b90fc 100644 (file)
@@ -34,26 +34,26 @@ U_NAMESPACE_BEGIN
 struct URelativeString {
     int32_t offset;         /** offset of this item, such as, the relative date **/
     int32_t len;            /** length of the string **/
-    const UChar* string;    /** string, or NULL if not set **/
+    const UChar* string;    /** string, or nullptr if not set **/
 };
 
 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(RelativeDateFormat)
 
 RelativeDateFormat::RelativeDateFormat(const RelativeDateFormat& other) :
- DateFormat(other), fDateTimeFormatter(NULL), fDatePattern(other.fDatePattern),
- fTimePattern(other.fTimePattern), fCombinedFormat(NULL),
+ DateFormat(other), fDateTimeFormatter(nullptr), fDatePattern(other.fDatePattern),
+ fTimePattern(other.fTimePattern), fCombinedFormat(nullptr),
  fDateStyle(other.fDateStyle), fLocale(other.fLocale),
- fDatesLen(other.fDatesLen), fDates(NULL),
+ fDatesLen(other.fDatesLen), fDates(nullptr),
  fCombinedHasDateAtStart(other.fCombinedHasDateAtStart),
  fCapitalizationInfoSet(other.fCapitalizationInfoSet),
  fCapitalizationOfRelativeUnitsForUIListMenu(other.fCapitalizationOfRelativeUnitsForUIListMenu),
  fCapitalizationOfRelativeUnitsForStandAlone(other.fCapitalizationOfRelativeUnitsForStandAlone),
- fCapitalizationBrkIter(NULL)
+ fCapitalizationBrkIter(nullptr)
 {
-    if(other.fDateTimeFormatter != NULL) {
+    if(other.fDateTimeFormatter != nullptr) {
         fDateTimeFormatter = other.fDateTimeFormatter->clone();
     }
-    if(other.fCombinedFormat != NULL) {
+    if(other.fCombinedFormat != nullptr) {
         fCombinedFormat = new SimpleFormatter(*other.fCombinedFormat);
     }
     if (fDatesLen > 0) {
@@ -61,7 +61,7 @@ RelativeDateFormat::RelativeDateFormat(const RelativeDateFormat& other) :
         uprv_memcpy(fDates, other.fDates, sizeof(fDates[0])*(size_t)fDatesLen);
     }
 #if !UCONFIG_NO_BREAK_ITERATION
-    if (other.fCapitalizationBrkIter != NULL) {
+    if (other.fCapitalizationBrkIter != nullptr) {
         fCapitalizationBrkIter = (other.fCapitalizationBrkIter)->clone();
     }
 #endif
@@ -69,11 +69,11 @@ RelativeDateFormat::RelativeDateFormat(const RelativeDateFormat& other) :
 
 RelativeDateFormat::RelativeDateFormat( UDateFormatStyle timeStyle, UDateFormatStyle dateStyle,
                                         const Locale& locale, UErrorCode& status) :
- DateFormat(), fDateTimeFormatter(NULL), fDatePattern(), fTimePattern(), fCombinedFormat(NULL),
- fDateStyle(dateStyle), fLocale(locale), fDatesLen(0), fDates(NULL),
+ DateFormat(), fDateTimeFormatter(nullptr), fDatePattern(), fTimePattern(), fCombinedFormat(nullptr),
+ fDateStyle(dateStyle), fLocale(locale), fDatesLen(0), fDates(nullptr),
  fCombinedHasDateAtStart(false), fCapitalizationInfoSet(false),
  fCapitalizationOfRelativeUnitsForUIListMenu(false), fCapitalizationOfRelativeUnitsForStandAlone(false),
- fCapitalizationBrkIter(NULL)
+ fCapitalizationBrkIter(nullptr)
 {
     if(U_FAILURE(status) ) {
         return;
@@ -91,7 +91,7 @@ RelativeDateFormat::RelativeDateFormat( UDateFormatStyle timeStyle, UDateFormatS
     if (baseDateStyle != UDAT_NONE) {
         df = createDateInstance((EStyle)baseDateStyle, locale);
         fDateTimeFormatter=dynamic_cast<SimpleDateFormat *>(df);
-        if (fDateTimeFormatter == NULL) {
+        if (fDateTimeFormatter == nullptr) {
             status = U_UNSUPPORTED_ERROR;
              return;
         }
@@ -99,7 +99,7 @@ RelativeDateFormat::RelativeDateFormat( UDateFormatStyle timeStyle, UDateFormatS
         if (timeStyle != UDAT_NONE) {
             df = createTimeInstance((EStyle)timeStyle, locale);
             SimpleDateFormat *sdf = dynamic_cast<SimpleDateFormat *>(df);
-            if (sdf != NULL) {
+            if (sdf != nullptr) {
                 sdf->toPattern(fTimePattern);
                 delete sdf;
             }
@@ -108,7 +108,7 @@ RelativeDateFormat::RelativeDateFormat( UDateFormatStyle timeStyle, UDateFormatS
         // does not matter whether timeStyle is UDAT_NONE, we need something for fDateTimeFormatter
         df = createTimeInstance((EStyle)timeStyle, locale);
         fDateTimeFormatter=dynamic_cast<SimpleDateFormat *>(df);
-        if (fDateTimeFormatter == NULL) {
+        if (fDateTimeFormatter == nullptr) {
             status = U_UNSUPPORTED_ERROR;
             delete df;
             return;
@@ -117,7 +117,7 @@ RelativeDateFormat::RelativeDateFormat( UDateFormatStyle timeStyle, UDateFormatS
     }
 
     // Initialize the parent fCalendar, so that parse() works correctly.
-    initializeCalendar(NULL, locale, status);
+    initializeCalendar(nullptr, locale, status);
     loadDates(status);
 }
 
@@ -165,16 +165,16 @@ UnicodeString& RelativeDateFormat::format(  Calendar& cal,
     // look up string
     int32_t len = 0;
     const UChar *theString = getStringForDay(dayDiff, len, status);
-    if(U_SUCCESS(status) && (theString!=NULL)) {
+    if(U_SUCCESS(status) && (theString!=nullptr)) {
         // found a relative string
         relativeDayString.setTo(theString, len);
     }
 
     if ( relativeDayString.length() > 0 && !fDatePattern.isEmpty() && 
-         (fTimePattern.isEmpty() || fCombinedFormat == NULL || fCombinedHasDateAtStart)) {
+         (fTimePattern.isEmpty() || fCombinedFormat == nullptr || fCombinedHasDateAtStart)) {
 #if !UCONFIG_NO_BREAK_ITERATION
         // capitalize relativeDayString according to context for relative, set formatter no context
-        if ( u_islower(relativeDayString.char32At(0)) && fCapitalizationBrkIter!= NULL &&
+        if ( u_islower(relativeDayString.char32At(0)) && fCapitalizationBrkIter!= nullptr &&
              ( capitalizationContext==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
                (capitalizationContext==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU && fCapitalizationOfRelativeUnitsForUIListMenu) ||
                (capitalizationContext==UDISPCTX_CAPITALIZATION_FOR_STANDALONE && fCapitalizationOfRelativeUnitsForStandAlone) ) ) {
@@ -191,7 +191,7 @@ UnicodeString& RelativeDateFormat::format(  Calendar& cal,
     if (fDatePattern.isEmpty()) {
         fDateTimeFormatter->applyPattern(fTimePattern);
         fDateTimeFormatter->format(cal,appendTo,pos);
-    } else if (fTimePattern.isEmpty() || fCombinedFormat == NULL) {
+    } else if (fTimePattern.isEmpty() || fCombinedFormat == nullptr) {
         if (relativeDayString.length() > 0) {
             appendTo.append(relativeDayString);
         } else {
@@ -243,12 +243,12 @@ void RelativeDateFormat::parse( const UnicodeString& text,
         // no date pattern, try parsing as time
         fDateTimeFormatter->applyPattern(fTimePattern);
         fDateTimeFormatter->parse(text,cal,pos);
-    } else if (fTimePattern.isEmpty() || fCombinedFormat == NULL) {
+    } else if (fTimePattern.isEmpty() || fCombinedFormat == nullptr) {
         // no time pattern or way to combine, try parsing as date
         // first check whether text matches a relativeDayString
         UBool matchedRelative = false;
         for (int n=0; n < fDatesLen && !matchedRelative; n++) {
-            if (fDates[n].string != NULL &&
+            if (fDates[n].string != nullptr &&
                     text.compare(startIndex, fDates[n].len, fDates[n].string) == 0) {
                 // it matched, handle the relative day string
                 UErrorCode status = U_ZERO_ERROR;
@@ -280,7 +280,7 @@ void RelativeDateFormat::parse( const UnicodeString& text,
         UErrorCode status = U_ZERO_ERROR;
         for (int n=0; n < fDatesLen; n++) {
             int32_t relativeStringOffset;
-            if (fDates[n].string != NULL &&
+            if (fDates[n].string != nullptr &&
                     (relativeStringOffset = modifiedText.indexOf(fDates[n].string, fDates[n].len, startIndex)) >= startIndex) {
                 // it matched, replace the relative date with a real one for parsing
                 UnicodeString dateString;
@@ -349,18 +349,18 @@ RelativeDateFormat::parse(const UnicodeString& text, UErrorCode& status) const
 
 const UChar *RelativeDateFormat::getStringForDay(int32_t day, int32_t &len, UErrorCode &status) const {
     if(U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     // Is it inside the resource bundle's range?
     int n = day + UDAT_DIRECTION_THIS;
     if (n >= 0 && n < fDatesLen) {
-        if (fDates[n].offset == day && fDates[n].string != NULL) {
+        if (fDates[n].offset == day && fDates[n].string != nullptr) {
             len = fDates[n].len;
             return fDates[n].string;
         }
     }
-    return NULL;  // not found.
+    return nullptr;  // not found.
 }
 
 UnicodeString&
@@ -370,7 +370,7 @@ RelativeDateFormat::toPattern(UnicodeString& result, UErrorCode& status) const
         result.remove();
         if (fDatePattern.isEmpty()) {
             result.setTo(fTimePattern);
-        } else if (fTimePattern.isEmpty() || fCombinedFormat == NULL) {
+        } else if (fTimePattern.isEmpty() || fCombinedFormat == nullptr) {
             result.setTo(fDatePattern);
         } else {
             fCombinedFormat->format(fTimePattern, fDatePattern, result, status);
@@ -427,14 +427,14 @@ RelativeDateFormat::setContext(UDisplayContext value, UErrorCode& status)
             fCapitalizationInfoSet = true;
         }
 #if !UCONFIG_NO_BREAK_ITERATION
-        if ( fCapitalizationBrkIter == NULL && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
+        if ( fCapitalizationBrkIter == nullptr && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
                 (value==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU && fCapitalizationOfRelativeUnitsForUIListMenu) ||
                 (value==UDISPCTX_CAPITALIZATION_FOR_STANDALONE && fCapitalizationOfRelativeUnitsForStandAlone)) ) {
             status = U_ZERO_ERROR;
             fCapitalizationBrkIter = BreakIterator::createSentenceInstance(fLocale, status);
             if (U_FAILURE(status)) {
                 delete fCapitalizationBrkIter;
-                fCapitalizationBrkIter = NULL;
+                fCapitalizationBrkIter = nullptr;
             }
         }
 #endif
@@ -445,17 +445,17 @@ void
 RelativeDateFormat::initCapitalizationContextInfo(const Locale& thelocale)
 {
 #if !UCONFIG_NO_BREAK_ITERATION
-    const char * localeID = (thelocale != NULL)? thelocale.getBaseName(): NULL;
+    const char * localeID = (thelocale != nullptr)? thelocale.getBaseName(): nullptr;
     UErrorCode status = U_ZERO_ERROR;
-    LocalUResourceBundlePointer rb(ures_open(NULL, localeID, &status));
+    LocalUResourceBundlePointer rb(ures_open(nullptr, localeID, &status));
     ures_getByKeyWithFallback(rb.getAlias(),
                               "contextTransforms/relative",
                                rb.getAlias(), &status);
-    if (U_SUCCESS(status) && rb != NULL) {
+    if (U_SUCCESS(status) && rb != nullptr) {
         int32_t len = 0;
         const int32_t * intVector = ures_getIntVector(rb.getAlias(),
                                                       &len, &status);
-        if (U_SUCCESS(status) && intVector != NULL && len >= 2) {
+        if (U_SUCCESS(status) && intVector != nullptr && len >= 2) {
             fCapitalizationOfRelativeUnitsForUIListMenu = static_cast<UBool>(intVector[0]);
             fCapitalizationOfRelativeUnitsForStandAlone = static_cast<UBool>(intVector[1]);
         }
@@ -477,7 +477,7 @@ struct RelDateFmtDataSink : public ResourceSink {
   RelDateFmtDataSink(URelativeString* fDates, int32_t len) : fDatesPtr(fDates), fDatesLen(len) {
     for (int32_t i = 0; i < fDatesLen; ++i) {
       fDatesPtr[i].offset = 0;
-      fDatesPtr[i].string = NULL;
+      fDatesPtr[i].string = nullptr;
       fDatesPtr[i].len = -1;
     }
   }
@@ -495,7 +495,7 @@ struct RelDateFmtDataSink : public ResourceSink {
 
         // Put in the proper spot, but don't override existing data.
         n = offset + UDAT_DIRECTION_THIS; // Converts to index in UDAT_R
-        if (n < fDatesLen && fDatesPtr[n].string == NULL) {
+        if (n < fDatesLen && fDatesPtr[n].string == nullptr) {
           // Not found and n is an empty slot.
           fDatesPtr[n].offset = offset;
           fDatesPtr[n].string = value.getString(len, errorCode);
@@ -516,11 +516,11 @@ static const UChar patItem1[] = {0x7B,0x31,0x7D}; // "{1}"
 static const int32_t patItem1Len = 3;
 
 void RelativeDateFormat::loadDates(UErrorCode &status) {
-    UResourceBundle *rb = ures_open(NULL, fLocale.getBaseName(), &status);
+    UResourceBundle *rb = ures_open(nullptr, fLocale.getBaseName(), &status);
     LocalUResourceBundlePointer dateTimePatterns(
         ures_getByKeyWithFallback(rb,
                                   "calendar/gregorian/DateTimePatterns",
-                                  (UResourceBundle*)NULL, &status));
+                                  (UResourceBundle*)nullptr, &status));
     if(U_SUCCESS(status)) {
         int32_t patternsSize = ures_getSize(dateTimePatterns.getAlias());
         if (patternsSize > kDateTime) {
@@ -567,7 +567,7 @@ RelativeDateFormat::initializeCalendar(TimeZone* adoptZone, const Locale& locale
     if(!U_FAILURE(status)) {
         fCalendar = Calendar::createInstance(adoptZone?adoptZone:TimeZone::createDefault(), locale, status);
     }
-    if (U_SUCCESS(status) && fCalendar == NULL) {
+    if (U_SUCCESS(status) && fCalendar == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
     }
     return fCalendar;
index 98b333a02be205e5e94c0febe61fcf6d49723c2b..63ae8eb23810a34fd2a59051431c12bea35f5d02 100644 (file)
@@ -273,7 +273,7 @@ private:
      * Get the string at a specific offset.
      * @param day day offset ( -1, 0, 1, etc.. )
      * @param len on output, length of string.
-     * @return the string, or NULL if none at that location.
+     * @return the string, or nullptr if none at that location.
      */
     const UChar *getStringForDay(int32_t day, int32_t &len, UErrorCode &status) const;
 
@@ -294,7 +294,7 @@ private:
 
     /**
      * initializes fCalendar from parameters.  Returns fCalendar as a convenience.
-     * @param adoptZone  Zone to be adopted, or NULL for TimeZone::createDefault().
+     * @param adoptZone  Zone to be adopted, or nullptr for TimeZone::createDefault().
      * @param locale Locale of the calendar
      * @param status Error code
      * @return the newly constructed fCalendar
index e74ca3a659f4fdfa8377976923e9182d5c4a3acb..2e558a2457458432dc5ab4850d8005ab6ce19e44 100644 (file)
@@ -73,7 +73,7 @@ RegexMatcher::RegexMatcher(const RegexPattern *pat)  {
     if (U_FAILURE(fDeferredStatus)) {
         return;
     }
-    if (pat==NULL) {
+    if (pat==nullptr) {
         fDeferredStatus = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
@@ -157,12 +157,12 @@ RegexMatcher::~RegexMatcher() {
     delete fStack;
     if (fData != fSmallData) {
         uprv_free(fData);
-        fData = NULL;
+        fData = nullptr;
     }
     if (fPatternOwned) {
         delete fPatternOwned;
-        fPatternOwned = NULL;
-        fPattern = NULL;
+        fPatternOwned = nullptr;
+        fPattern = nullptr;
     }
 
     if (fInput) {
@@ -189,8 +189,8 @@ RegexMatcher::~RegexMatcher() {
 //            to run safely.
 //
 void RegexMatcher::init(UErrorCode &status) {
-    fPattern           = NULL;
-    fPatternOwned      = NULL;
+    fPattern           = nullptr;
+    fPatternOwned      = nullptr;
     fFrameSize         = 0;
     fRegionStart       = 0;
     fRegionLimit       = 0;
@@ -209,26 +209,26 @@ void RegexMatcher::init(UErrorCode &status) {
     fAppendPosition    = 0;
     fHitEnd            = false;
     fRequireEnd        = false;
-    fStack             = NULL;
-    fFrame             = NULL;
+    fStack             = nullptr;
+    fFrame             = nullptr;
     fTimeLimit         = 0;
     fTime              = 0;
     fTickCounter       = 0;
     fStackLimit        = DEFAULT_BACKTRACK_STACK_CAPACITY;
-    fCallbackFn        = NULL;
-    fCallbackContext   = NULL;
-    fFindProgressCallbackFn      = NULL;
-    fFindProgressCallbackContext = NULL;
+    fCallbackFn        = nullptr;
+    fCallbackContext   = nullptr;
+    fFindProgressCallbackFn      = nullptr;
+    fFindProgressCallbackContext = nullptr;
     fTraceDebug        = false;
     fDeferredStatus    = status;
     fData              = fSmallData;
-    fWordBreakItr      = NULL;
-    fGCBreakItr        = NULL;
+    fWordBreakItr      = nullptr;
+    fGCBreakItr        = nullptr;
 
-    fStack             = NULL;
-    fInputText         = NULL;
-    fAltInputText      = NULL;
-    fInput             = NULL;
+    fStack             = nullptr;
+    fInputText         = nullptr;
+    fAltInputText      = nullptr;
+    fInput             = nullptr;
     fInputLength       = 0;
     fInputUniStrMaybeMutable = false;
 }
@@ -245,14 +245,14 @@ void RegexMatcher::init2(UText *input, UErrorCode &status) {
 
     if (fPattern->fDataSize > UPRV_LENGTHOF(fSmallData)) {
         fData = (int64_t *)uprv_malloc(fPattern->fDataSize * sizeof(int64_t));
-        if (fData == NULL) {
+        if (fData == nullptr) {
             status = fDeferredStatus = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
     }
 
     fStack = new UVector64(status);
-    if (fStack == NULL) {
+    if (fStack == nullptr) {
         status = fDeferredStatus = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -326,10 +326,10 @@ RegexMatcher &RegexMatcher::appendReplacement(UText *dest,
                 len16 = (int32_t)(fMatchStart-fAppendPosition);
             } else {
                 UErrorCode lengthStatus = U_ZERO_ERROR;
-                len16 = utext_extract(fInputText, fAppendPosition, fMatchStart, NULL, 0, &lengthStatus);
+                len16 = utext_extract(fInputText, fAppendPosition, fMatchStart, nullptr, 0, &lengthStatus);
             }
             UChar *inputChars = (UChar *)uprv_malloc(sizeof(UChar)*(len16+1));
-            if (inputChars == NULL) {
+            if (inputChars == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 return *this;
             }
@@ -524,12 +524,12 @@ UText *RegexMatcher::appendTail(UText *dest, UErrorCode &status) {
             if (UTEXT_USES_U16(fInputText)) {
                 len16 = (int32_t)(fInputLength-fAppendPosition);
             } else {
-                len16 = utext_extract(fInputText, fAppendPosition, fInputLength, NULL, 0, &status);
+                len16 = utext_extract(fInputText, fAppendPosition, fInputLength, nullptr, 0, &status);
                 status = U_ZERO_ERROR; // buffer overflow
             }
 
             UChar *inputChars = (UChar *)uprv_malloc(sizeof(UChar)*(len16));
-            if (inputChars == NULL) {
+            if (inputChars == nullptr) {
                 fDeferredStatus = U_MEMORY_ALLOCATION_ERROR;
             } else {
                 utext_extract(fInputText, fAppendPosition, fInputLength, inputChars, len16, &status); // unterminated
@@ -1220,14 +1220,14 @@ UnicodeString RegexMatcher::group(int32_t groupNum, UErrorCode &status) const {
 
     // Get the group length using a utext_extract preflight.
     //    UText is actually pretty efficient at this when underlying encoding is UTF-16.
-    int32_t length = utext_extract(fInputText, groupStart, groupEnd, NULL, 0, &status);
+    int32_t length = utext_extract(fInputText, groupStart, groupEnd, nullptr, 0, &status);
     if (status != U_BUFFER_OVERFLOW_ERROR) {
         return result;
     }
 
     status = U_ZERO_ERROR;
     UChar *buf = result.getBuffer(length);
-    if (buf == NULL) {
+    if (buf == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
     } else {
         int32_t extractLength = utext_extract(fInputText, groupStart, groupEnd, buf, length, &status);
@@ -1257,11 +1257,11 @@ int64_t RegexMatcher::appendGroup(int32_t groupNum, UText *dest, UErrorCode &sta
 
     if (fMatch == false) {
         status = U_REGEX_INVALID_STATE;
-        return utext_replace(dest, destLen, destLen, NULL, 0, &status);
+        return utext_replace(dest, destLen, destLen, nullptr, 0, &status);
     }
     if (groupNum < 0 || groupNum > fPattern->fGroupMap->size()) {
         status = U_INDEX_OUTOFBOUNDS_ERROR;
-        return utext_replace(dest, destLen, destLen, NULL, 0, &status);
+        return utext_replace(dest, destLen, destLen, nullptr, 0, &status);
     }
 
     int64_t s, e;
@@ -1278,7 +1278,7 @@ int64_t RegexMatcher::appendGroup(int32_t groupNum, UText *dest, UErrorCode &sta
 
     if (s < 0) {
         // A capture group wasn't part of the match
-        return utext_replace(dest, destLen, destLen, NULL, 0, &status);
+        return utext_replace(dest, destLen, destLen, nullptr, 0, &status);
     }
     U_ASSERT(s <= e);
 
@@ -1292,10 +1292,10 @@ int64_t RegexMatcher::appendGroup(int32_t groupNum, UText *dest, UErrorCode &sta
             len16 = (int32_t)(e-s);
         } else {
             UErrorCode lengthStatus = U_ZERO_ERROR;
-            len16 = utext_extract(fInputText, s, e, NULL, 0, &lengthStatus);
+            len16 = utext_extract(fInputText, s, e, nullptr, 0, &lengthStatus);
         }
         UChar *groupChars = (UChar *)uprv_malloc(sizeof(UChar)*(len16+1));
-        if (groupChars == NULL) {
+        if (groupChars == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return 0;
         }
@@ -1361,7 +1361,7 @@ const UnicodeString &RegexMatcher::input() const {
         if (UTEXT_USES_U16(fInputText)) {
             len16 = (int32_t)fInputLength;
         } else {
-            len16 = utext_extract(fInputText, 0, fInputLength, NULL, 0, &status);
+            len16 = utext_extract(fInputText, 0, fInputLength, nullptr, 0, &status);
             status = U_ZERO_ERROR; // overflow, length status
         }
         UnicodeString *result = new UnicodeString(len16, 0, 0);
@@ -1409,10 +1409,10 @@ UText *RegexMatcher::getInput (UText *dest, UErrorCode &status) const {
                 input16Len = (int32_t)fInputLength;
             } else {
                 UErrorCode lengthStatus = U_ZERO_ERROR;
-                input16Len = utext_extract(fInputText, 0, fInputLength, NULL, 0, &lengthStatus); // buffer overflow error
+                input16Len = utext_extract(fInputText, 0, fInputLength, nullptr, 0, &lengthStatus); // buffer overflow error
             }
             UChar *inputChars = (UChar *)uprv_malloc(sizeof(UChar)*(input16Len));
-            if (inputChars == NULL) {
+            if (inputChars == nullptr) {
                 return dest;
             }
 
@@ -1425,7 +1425,7 @@ UText *RegexMatcher::getInput (UText *dest, UErrorCode &status) const {
         }
         return dest;
     } else {
-        return utext_clone(NULL, fInputText, false, true, &status);
+        return utext_clone(nullptr, fInputText, false, true, &status);
     }
 }
 
@@ -1726,12 +1726,12 @@ UText *RegexMatcher::replaceAll(UText *replacement, UText *dest, UErrorCode &sta
         return dest;
     }
 
-    if (dest == NULL) {
+    if (dest == nullptr) {
         UnicodeString emptyString;
         UText empty = UTEXT_INITIALIZER;
 
         utext_openUnicodeString(&empty, &emptyString, &status);
-        dest = utext_clone(NULL, &empty, true, false, &status);
+        dest = utext_clone(nullptr, &empty, true, false, &status);
         utext_close(&empty);
     }
 
@@ -1788,12 +1788,12 @@ UText *RegexMatcher::replaceFirst(UText *replacement, UText *dest, UErrorCode &s
         return getInput(dest, status);
     }
 
-    if (dest == NULL) {
+    if (dest == nullptr) {
         UnicodeString emptyString;
         UText empty = UTEXT_INITIALIZER;
 
         utext_openUnicodeString(&empty, &emptyString, &status);
-        dest = utext_clone(NULL, &empty, true, false, &status);
+        dest = utext_clone(nullptr, &empty, true, false, &status);
         utext_close(&empty);
     }
 
@@ -1860,7 +1860,7 @@ RegexMatcher &RegexMatcher::reset(const UnicodeString &input) {
 
     reset();
     delete fInput;
-    fInput = NULL;
+    fInput = nullptr;
 
     //  Do the following for any UnicodeString.
     //  This is for compatibility for those clients who modify the input string "live" during regex operations.
@@ -1889,7 +1889,7 @@ RegexMatcher &RegexMatcher::reset(UText *input) {
         fInputLength = utext_nativeLength(fInputText);
 
         delete fInput;
-        fInput = NULL;
+        fInput = nullptr;
 
 #if UCONFIG_NO_BREAK_ITERATION==0
         if (fWordBreakItr) {
@@ -1935,7 +1935,7 @@ RegexMatcher &RegexMatcher::refreshInputText(UText *input, UErrorCode &status) {
     if (U_FAILURE(status)) {
         return *this;
     }
-    if (input == NULL) {
+    if (input == nullptr) {
         status = U_ILLEGAL_ARGUMENT_ERROR;
         return *this;
     }
@@ -1951,7 +1951,7 @@ RegexMatcher &RegexMatcher::refreshInputText(UText *input, UErrorCode &status) {
     }
     utext_setNativeIndex(fInputText, pos);
 
-    if (fAltInputText != NULL) {
+    if (fAltInputText != nullptr) {
         pos = utext_getNativeIndex(fAltInputText);
         fAltInputText = utext_clone(fAltInputText, input, false, true, &status);
         if (U_FAILURE(status)) {
@@ -1980,7 +1980,7 @@ void RegexMatcher::setTrace(UBool state) {
   *
   *     @param src    The source UText
   *     @param dest   The destination UText. Must be writable.
-  *                   May be NULL, in which case a new UText will be allocated.
+  *                   May be nullptr, in which case a new UText will be allocated.
   *     @param start  Start index of source substring.
   *     @param limit  Limit index of source substring.
   *     @param status An error code.
@@ -1991,13 +1991,13 @@ static UText *utext_extract_replace(UText *src, UText *dest, int64_t start, int6
     }
     if (start == limit) {
         if (dest) {
-            utext_replace(dest, 0, utext_nativeLength(dest), NULL, 0, status);
+            utext_replace(dest, 0, utext_nativeLength(dest), nullptr, 0, status);
             return dest;
         } else {
-            return utext_openUChars(NULL, NULL, 0, status);
+            return utext_openUChars(nullptr, nullptr, 0, status);
         }
     }
-    int32_t length = utext_extract(src, start, limit, NULL, 0, status);
+    int32_t length = utext_extract(src, start, limit, nullptr, 0, status);
     if (*status != U_BUFFER_OVERFLOW_ERROR && U_FAILURE(*status)) {
         return dest;
     }
@@ -2005,7 +2005,7 @@ static UText *utext_extract_replace(UText *src, UText *dest, int64_t start, int6
     MaybeStackArray<UChar, 40> buffer;
     if (length >= buffer.getCapacity()) {
         UChar *newBuf = buffer.resize(length+1);   // Leave space for terminating Nul.
-        if (newBuf == NULL) {
+        if (newBuf == nullptr) {
             *status = U_MEMORY_ALLOCATION_ERROR;
         }
     }
@@ -2018,18 +2018,18 @@ static UText *utext_extract_replace(UText *src, UText *dest, int64_t start, int6
     // Caller did not provide a preexisting UText.
     // Open a new one, and have it adopt the text buffer storage.
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
     int32_t ownedLength = 0;
     UChar *ownedBuf = buffer.orphanOrClone(length+1, ownedLength);
-    if (ownedBuf == NULL) {
+    if (ownedBuf == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
-    UText *result = utext_openUChars(NULL, ownedBuf, length, status);
+    UText *result = utext_openUChars(nullptr, ownedBuf, length, status);
     if (U_FAILURE(*status)) {
         uprv_free(ownedBuf);
-        return NULL;
+        return nullptr;
     }
     result->providerProperties |= (1 << UTEXT_PROVIDER_OWNS_TEXT);
     return result;
@@ -2053,13 +2053,13 @@ int32_t  RegexMatcher::split(const UnicodeString &input,
     }
 
     UText **destText = (UText **)uprv_malloc(sizeof(UText*)*destCapacity);
-    if (destText == NULL) {
+    if (destText == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return 0;
     }
     int32_t i;
     for (i = 0; i < destCapacity; i++) {
-        destText[i] = utext_openUnicodeString(NULL, &dest[i], &status);
+        destText[i] = utext_openUnicodeString(nullptr, &dest[i], &status);
     }
 
     int32_t fieldCount = split(&inputText, destText, destCapacity, status);
@@ -2126,15 +2126,15 @@ int32_t  RegexMatcher::split(UText *input,
                         UText remainingText = UTEXT_INITIALIZER;
                         utext_openUChars(&remainingText, input->chunkContents+nextOutputStringStart,
                                          fActiveLimit-nextOutputStringStart, &status);
-                        dest[i] = utext_clone(NULL, &remainingText, true, false, &status);
+                        dest[i] = utext_clone(nullptr, &remainingText, true, false, &status);
                         utext_close(&remainingText);
                     }
                 } else {
                     UErrorCode lengthStatus = U_ZERO_ERROR;
                     int32_t remaining16Length =
-                        utext_extract(input, nextOutputStringStart, fActiveLimit, NULL, 0, &lengthStatus);
+                        utext_extract(input, nextOutputStringStart, fActiveLimit, nullptr, 0, &lengthStatus);
                     UChar *remainingChars = (UChar *)uprv_malloc(sizeof(UChar)*(remaining16Length+1));
-                    if (remainingChars == NULL) {
+                    if (remainingChars == nullptr) {
                         status = U_MEMORY_ALLOCATION_ERROR;
                         break;
                     }
@@ -2145,7 +2145,7 @@ int32_t  RegexMatcher::split(UText *input,
                     } else {
                         UText remainingText = UTEXT_INITIALIZER;
                         utext_openUChars(&remainingText, remainingChars, remaining16Length, &status);
-                        dest[i] = utext_clone(NULL, &remainingText, true, false, &status);
+                        dest[i] = utext_clone(nullptr, &remainingText, true, false, &status);
                         utext_close(&remainingText);
                     }
 
@@ -2166,14 +2166,14 @@ int32_t  RegexMatcher::split(UText *input,
                     UText remainingText = UTEXT_INITIALIZER;
                     utext_openUChars(&remainingText, input->chunkContents+nextOutputStringStart,
                                       fMatchStart-nextOutputStringStart, &status);
-                    dest[i] = utext_clone(NULL, &remainingText, true, false, &status);
+                    dest[i] = utext_clone(nullptr, &remainingText, true, false, &status);
                     utext_close(&remainingText);
                 }
             } else {
                 UErrorCode lengthStatus = U_ZERO_ERROR;
-                int32_t remaining16Length = utext_extract(input, nextOutputStringStart, fMatchStart, NULL, 0, &lengthStatus);
+                int32_t remaining16Length = utext_extract(input, nextOutputStringStart, fMatchStart, nullptr, 0, &lengthStatus);
                 UChar *remainingChars = (UChar *)uprv_malloc(sizeof(UChar)*(remaining16Length+1));
-                if (remainingChars == NULL) {
+                if (remainingChars == nullptr) {
                     status = U_MEMORY_ALLOCATION_ERROR;
                     break;
                 }
@@ -2183,7 +2183,7 @@ int32_t  RegexMatcher::split(UText *input,
                 } else {
                     UText remainingText = UTEXT_INITIALIZER;
                     utext_openUChars(&remainingText, remainingChars, remaining16Length, &status);
-                    dest[i] = utext_clone(NULL, &remainingText, true, false, &status);
+                    dest[i] = utext_clone(nullptr, &remainingText, true, false, &status);
                     utext_close(&remainingText);
                 }
 
@@ -2212,8 +2212,8 @@ int32_t  RegexMatcher::split(UText *input,
                 //   the delimiter at the end of input.
                 if (i+1 < destCapacity) {
                     ++i;
-                    if (dest[i] == NULL) {
-                        dest[i] = utext_openUChars(NULL, NULL, 0, &status);
+                    if (dest[i] == nullptr) {
+                        dest[i] = utext_openUChars(nullptr, nullptr, 0, &status);
                     } else {
                         static const UChar emptyString[] = {(UChar)0};
                         utext_replace(dest[i], 0, utext_nativeLength(dest[i]), emptyString, 0, &status);
@@ -2236,14 +2236,14 @@ int32_t  RegexMatcher::split(UText *input,
                     UText remainingText = UTEXT_INITIALIZER;
                     utext_openUChars(&remainingText, input->chunkContents+nextOutputStringStart,
                                      fActiveLimit-nextOutputStringStart, &status);
-                    dest[i] = utext_clone(NULL, &remainingText, true, false, &status);
+                    dest[i] = utext_clone(nullptr, &remainingText, true, false, &status);
                     utext_close(&remainingText);
                 }
             } else {
                 UErrorCode lengthStatus = U_ZERO_ERROR;
-                int32_t remaining16Length = utext_extract(input, nextOutputStringStart, fActiveLimit, NULL, 0, &lengthStatus);
+                int32_t remaining16Length = utext_extract(input, nextOutputStringStart, fActiveLimit, nullptr, 0, &lengthStatus);
                 UChar *remainingChars = (UChar *)uprv_malloc(sizeof(UChar)*(remaining16Length+1));
-                if (remainingChars == NULL) {
+                if (remainingChars == nullptr) {
                     status = U_MEMORY_ALLOCATION_ERROR;
                     break;
                 }
@@ -2254,7 +2254,7 @@ int32_t  RegexMatcher::split(UText *input,
                 } else {
                     UText remainingText = UTEXT_INITIALIZER;
                     utext_openUChars(&remainingText, remainingChars, remaining16Length, &status);
-                    dest[i] = utext_clone(NULL, &remainingText, true, false, &status);
+                    dest[i] = utext_clone(nullptr, &remainingText, true, false, &status);
                     utext_close(&remainingText);
                 }
 
@@ -2516,7 +2516,7 @@ REStackFrame *RegexMatcher::resetStack() {
 
     REStackFrame *iFrame = (REStackFrame *)fStack->reserveBlock(fPattern->fFrameSize, fDeferredStatus);
     if(U_FAILURE(fDeferredStatus)) {
-        return NULL;
+        return nullptr;
     }
 
     int32_t i;
@@ -2696,7 +2696,7 @@ int64_t RegexMatcher::followingGCBoundary(int64_t pos, UErrorCode &status) {
 void RegexMatcher::IncrementTime(UErrorCode &status) {
     fTickCounter = TIMER_INITIAL_VALUE;
     fTime++;
-    if (fCallbackFn != NULL) {
+    if (fCallbackFn != nullptr) {
         if ((*fCallbackFn)(fCallbackContext, fTime) == false) {
             status = U_REGEX_STOPPED_BY_CALLER;
             return;
index 957ac480fbff5792b72288285b3861044ec1bae3..1dea638d8c6e5ea5e8dcb3f7fa43a576f24a60ad 100644 (file)
@@ -50,7 +50,7 @@ RemoveTransliterator::~RemoveTransliterator() {}
 
 RemoveTransliterator* RemoveTransliterator::clone() const {
     RemoveTransliterator* result = new RemoveTransliterator();
-    if (result != NULL && getFilter() != 0) {
+    if (result != nullptr && getFilter() != 0) {
         result->adoptFilter(getFilter()->clone());
     }
     return result;
index 0ef85bdf6ce833b449ab5a17af9428da38246496..587a4d8b9c958e75b00dd02cdd34ac03cc10d318 100644 (file)
@@ -77,15 +77,15 @@ RegexPattern &RegexPattern::operator = (const RegexPattern &other) {
         return *this;
     }
 
-    if (other.fPatternString == NULL) {
-        fPatternString = NULL;
+    if (other.fPatternString == nullptr) {
+        fPatternString = nullptr;
         fPattern = utext_clone(fPattern, other.fPattern, false, true, &fDeferredStatus);
     } else {
         fPatternString = new UnicodeString(*(other.fPatternString));
-        if (fPatternString == NULL) {
+        if (fPatternString == nullptr) {
             fDeferredStatus = U_MEMORY_ALLOCATION_ERROR;
         } else {
-            fPattern = utext_openConstUnicodeString(NULL, fPatternString, &fDeferredStatus);
+            fPattern = utext_openConstUnicodeString(nullptr, fPatternString, &fDeferredStatus);
         }
     }
     if (U_FAILURE(fDeferredStatus)) {
@@ -117,7 +117,7 @@ RegexPattern &RegexPattern::operator = (const RegexPattern &other) {
     int32_t i;
     int32_t  numSets = other.fSets->size();
     fSets8 = new Regex8BitSet[numSets];
-    if (fSets8 == NULL) {
+    if (fSets8 == nullptr) {
        fDeferredStatus = U_MEMORY_ALLOCATION_ERROR;
        return *this;
     }
@@ -127,7 +127,7 @@ RegexPattern &RegexPattern::operator = (const RegexPattern &other) {
         }
         UnicodeSet *sourceSet = (UnicodeSet *)other.fSets->elementAt(i);
         UnicodeSet *newSet    = new UnicodeSet(*sourceSet);
-        if (newSet == NULL) {
+        if (newSet == nullptr) {
             fDeferredStatus = U_MEMORY_ALLOCATION_ERROR;
             break;
         }
@@ -145,7 +145,7 @@ RegexPattern &RegexPattern::operator = (const RegexPattern &other) {
             const UnicodeString *name = (const UnicodeString *)hashEl->key.pointer;
             UnicodeString *key = new UnicodeString(*name);
             int32_t val = hashEl->value.integer;
-            if (key == NULL) {
+            if (key == nullptr) {
                 fDeferredStatus = U_MEMORY_ALLOCATION_ERROR;
             } else {
                 uhash_puti(fNamedCaptureMap, key, val, &fDeferredStatus);
@@ -166,24 +166,24 @@ void RegexPattern::init() {
     fFlags            = 0;
     fCompiledPat      = 0;
     fLiteralText.remove();
-    fSets             = NULL;
-    fSets8            = NULL;
+    fSets             = nullptr;
+    fSets8            = nullptr;
     fDeferredStatus   = U_ZERO_ERROR;
     fMinMatchLen      = 0;
     fFrameSize        = 0;
     fDataSize         = 0;
-    fGroupMap         = NULL;
+    fGroupMap         = nullptr;
     fStartType        = START_NO_INFO;
     fInitialStringIdx = 0;
     fInitialStringLen = 0;
-    fInitialChars     = NULL;
+    fInitialChars     = nullptr;
     fInitialChar      = 0;
-    fInitialChars8    = NULL;
+    fInitialChars8    = nullptr;
     fNeedsAltInput    = false;
-    fNamedCaptureMap  = NULL;
+    fNamedCaptureMap  = nullptr;
 
-    fPattern          = NULL; // will be set later
-    fPatternString    = NULL; // may be set later
+    fPattern          = nullptr; // will be set later
+    fPatternString    = nullptr; // may be set later
     fCompiledPat      = new UVector64(fDeferredStatus);
     fGroupMap         = new UVector32(fDeferredStatus);
     fSets             = new UVector(fDeferredStatus);
@@ -192,8 +192,8 @@ void RegexPattern::init() {
     if (U_FAILURE(fDeferredStatus)) {
         return;
     }
-    if (fCompiledPat == NULL  || fGroupMap == NULL || fSets == NULL ||
-            fInitialChars == NULL || fInitialChars8 == NULL) {
+    if (fCompiledPat == nullptr  || fGroupMap == nullptr || fSets == nullptr ||
+            fInitialChars == nullptr || fInitialChars8 == nullptr) {
         fDeferredStatus = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -228,36 +228,36 @@ bool RegexPattern::initNamedCaptureMap() {
 //--------------------------------------------------------------------------
 void RegexPattern::zap() {
     delete fCompiledPat;
-    fCompiledPat = NULL;
+    fCompiledPat = nullptr;
     int i;
     for (i=1; i<fSets->size(); i++) {
         UnicodeSet *s;
         s = (UnicodeSet *)fSets->elementAt(i);
-        if (s != NULL) {
+        if (s != nullptr) {
             delete s;
         }
     }
     delete fSets;
-    fSets = NULL;
+    fSets = nullptr;
     delete[] fSets8;
-    fSets8 = NULL;
+    fSets8 = nullptr;
     delete fGroupMap;
-    fGroupMap = NULL;
+    fGroupMap = nullptr;
     delete fInitialChars;
-    fInitialChars = NULL;
+    fInitialChars = nullptr;
     delete fInitialChars8;
-    fInitialChars8 = NULL;
-    if (fPattern != NULL) {
+    fInitialChars8 = nullptr;
+    if (fPattern != nullptr) {
         utext_close(fPattern);
-        fPattern = NULL;
+        fPattern = nullptr;
     }
-    if (fPatternString != NULL) {
+    if (fPatternString != nullptr) {
         delete fPatternString;
-        fPatternString = NULL;
+        fPatternString = nullptr;
     }
-    if (fNamedCaptureMap != NULL) {
+    if (fNamedCaptureMap != nullptr) {
         uhash_close(fNamedCaptureMap);
-        fNamedCaptureMap = NULL;
+        fNamedCaptureMap = nullptr;
     }
 }
 
@@ -293,13 +293,13 @@ RegexPattern  *RegexPattern::clone() const {
 //--------------------------------------------------------------------------
 bool    RegexPattern::operator ==(const RegexPattern &other) const {
     if (this->fFlags == other.fFlags && this->fDeferredStatus == other.fDeferredStatus) {
-        if (this->fPatternString != NULL && other.fPatternString != NULL) {
+        if (this->fPatternString != nullptr && other.fPatternString != nullptr) {
             return *(this->fPatternString) == *(other.fPatternString);
-        } else if (this->fPattern == NULL) {
-            if (other.fPattern == NULL) {
+        } else if (this->fPattern == nullptr) {
+            if (other.fPattern == nullptr) {
                 return true;
             }
-        } else if (other.fPattern != NULL) {
+        } else if (other.fPattern != nullptr) {
             UTEXT_SETNATIVEINDEX(this->fPattern, 0);
             UTEXT_SETNATIVEINDEX(other.fPattern, 0);
             return utext_equals(this->fPattern, other.fPattern);
@@ -320,7 +320,7 @@ RegexPattern::compile(const UnicodeString &regex,
                       UErrorCode           &status)
 {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     const uint32_t allFlags = UREGEX_CANON_EQ | UREGEX_CASE_INSENSITIVE | UREGEX_COMMENTS |
@@ -329,23 +329,23 @@ RegexPattern::compile(const UnicodeString &regex,
 
     if ((flags & ~allFlags) != 0) {
         status = U_REGEX_INVALID_FLAG;
-        return NULL;
+        return nullptr;
     }
 
     if ((flags & UREGEX_CANON_EQ) != 0) {
         status = U_REGEX_UNIMPLEMENTED;
-        return NULL;
+        return nullptr;
     }
 
     RegexPattern *This = new RegexPattern;
-    if (This == NULL) {
+    if (This == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     if (U_FAILURE(This->fDeferredStatus)) {
         status = This->fDeferredStatus;
         delete This;
-        return NULL;
+        return nullptr;
     }
     This->fFlags = flags;
 
@@ -354,7 +354,7 @@ RegexPattern::compile(const UnicodeString &regex,
 
     if (U_FAILURE(status)) {
         delete This;
-        This = NULL;
+        This = nullptr;
     }
 
     return This;
@@ -371,7 +371,7 @@ RegexPattern::compile(UText                *regex,
                       UErrorCode           &status)
 {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     const uint32_t allFlags = UREGEX_CANON_EQ | UREGEX_CASE_INSENSITIVE | UREGEX_COMMENTS |
@@ -380,23 +380,23 @@ RegexPattern::compile(UText                *regex,
 
     if ((flags & ~allFlags) != 0) {
         status = U_REGEX_INVALID_FLAG;
-        return NULL;
+        return nullptr;
     }
 
     if ((flags & UREGEX_CANON_EQ) != 0) {
         status = U_REGEX_UNIMPLEMENTED;
-        return NULL;
+        return nullptr;
     }
 
     RegexPattern *This = new RegexPattern;
-    if (This == NULL) {
+    if (This == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     if (U_FAILURE(This->fDeferredStatus)) {
         status = This->fDeferredStatus;
         delete This;
-        return NULL;
+        return nullptr;
     }
     This->fFlags = flags;
 
@@ -405,7 +405,7 @@ RegexPattern::compile(UText                *regex,
 
     if (U_FAILURE(status)) {
         delete This;
-        This = NULL;
+        This = nullptr;
     }
 
     return This;
@@ -479,7 +479,7 @@ uint32_t RegexPattern::flags() const {
 RegexMatcher *RegexPattern::matcher(const UnicodeString &input,
                                     UErrorCode          &status)  const {
     RegexMatcher    *retMatcher = matcher(status);
-    if (retMatcher != NULL) {
+    if (retMatcher != nullptr) {
         retMatcher->fDeferredStatus = status;
         retMatcher->reset(input);
     }
@@ -493,20 +493,20 @@ RegexMatcher *RegexPattern::matcher(const UnicodeString &input,
 //
 //---------------------------------------------------------------------
 RegexMatcher *RegexPattern::matcher(UErrorCode &status)  const {
-    RegexMatcher    *retMatcher = NULL;
+    RegexMatcher    *retMatcher = nullptr;
 
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     if (U_FAILURE(fDeferredStatus)) {
         status = fDeferredStatus;
-        return NULL;
+        return nullptr;
     }
 
     retMatcher = new RegexMatcher(this);
-    if (retMatcher == NULL) {
+    if (retMatcher == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     return retMatcher;
 }
@@ -527,8 +527,8 @@ UBool U_EXPORT2 RegexPattern::matches(const UnicodeString   &regex,
     if (U_FAILURE(status)) {return false;}
 
     UBool         retVal;
-    RegexPattern *pat     = NULL;
-    RegexMatcher *matcher = NULL;
+    RegexPattern *pat     = nullptr;
+    RegexMatcher *matcher = nullptr;
 
     pat     = RegexPattern::compile(regex, 0, pe, status);
     matcher = pat->matcher(input, status);
@@ -551,8 +551,8 @@ UBool U_EXPORT2 RegexPattern::matches(UText                *regex,
     if (U_FAILURE(status)) {return false;}
 
     UBool         retVal  = false;
-    RegexPattern *pat     = NULL;
-    RegexMatcher *matcher = NULL;
+    RegexPattern *pat     = nullptr;
+    RegexMatcher *matcher = nullptr;
 
     pat     = RegexPattern::compile(regex, 0, pe, status);
     matcher = pat->matcher(status);
@@ -576,14 +576,14 @@ UBool U_EXPORT2 RegexPattern::matches(UText                *regex,
 //
 //---------------------------------------------------------------------
 UnicodeString RegexPattern::pattern() const {
-    if (fPatternString != NULL) {
+    if (fPatternString != nullptr) {
         return *fPatternString;
-    } else if (fPattern == NULL) {
+    } else if (fPattern == nullptr) {
         return UnicodeString();
     } else {
         UErrorCode status = U_ZERO_ERROR;
         int64_t nativeLen = utext_nativeLength(fPattern);
-        int32_t len16 = utext_extract(fPattern, 0, nativeLen, NULL, 0, &status); // buffer overflow error
+        int32_t len16 = utext_extract(fPattern, 0, nativeLen, nullptr, 0, &status); // buffer overflow error
         UnicodeString result;
 
         status = U_ZERO_ERROR;
@@ -604,10 +604,10 @@ UnicodeString RegexPattern::pattern() const {
 //
 //---------------------------------------------------------------------
 UText *RegexPattern::patternText(UErrorCode      &status) const {
-    if (U_FAILURE(status)) {return NULL;}
+    if (U_FAILURE(status)) {return nullptr;}
     status = U_ZERO_ERROR;
 
-    if (fPattern != NULL) {
+    if (fPattern != nullptr) {
         return fPattern;
     } else {
         RegexStaticSets::initGlobals(&status);
@@ -850,7 +850,7 @@ void RegexPattern::dumpPattern() const {
         printf("   None\n");
     } else {
         int32_t pos = UHASH_FIRST;
-        const UHashElement *el = NULL;
+        const UHashElement *el = nullptr;
         while ((el = uhash_nextElement(fNamedCaptureMap, &pos))) {
             const UnicodeString *name = (const UnicodeString *)el->key.pointer;
             int32_t number = el->value.integer;
index a240295b679eaa12ad10cc2c415f0e56ff1b475c..319d30db5b3d54c6119f65b919ebe3728e3b3f47 100644 (file)
@@ -74,7 +74,7 @@ FixedSortKeyByteSink::~FixedSortKeyByteSink() {}
 
 void
 FixedSortKeyByteSink::AppendBeyondCapacity(const char *bytes, int32_t /*n*/, int32_t length) {
-    // buffer_ != NULL && bytes != NULL && n > 0 && appended_ > capacity_
+    // buffer_ != nullptr && bytes != nullptr && n > 0 && appended_ > capacity_
     // Fill the buffer completely.
     int32_t available = capacity_ - length;
     if (available > 0) {
@@ -108,7 +108,7 @@ CollationKeyByteSink::~CollationKeyByteSink() {}
 
 void
 CollationKeyByteSink::AppendBeyondCapacity(const char *bytes, int32_t n, int32_t length) {
-    // buffer_ != NULL && bytes != NULL && n > 0 && appended_ > capacity_
+    // buffer_ != nullptr && bytes != nullptr && n > 0 && appended_ > capacity_
     if (Resize(n, length)) {
         uprv_memcpy(buffer_ + length, bytes, n);
     }
@@ -116,7 +116,7 @@ CollationKeyByteSink::AppendBeyondCapacity(const char *bytes, int32_t n, int32_t
 
 UBool
 CollationKeyByteSink::Resize(int32_t appendCapacity, int32_t length) {
-    if (buffer_ == NULL) {
+    if (buffer_ == nullptr) {
         return false;  // allocation failed before already
     }
     int32_t newCapacity = 2 * capacity_;
@@ -128,7 +128,7 @@ CollationKeyByteSink::Resize(int32_t appendCapacity, int32_t length) {
         newCapacity = 200;
     }
     uint8_t *newBuffer = key_.reallocate(newCapacity, length);
-    if (newBuffer == NULL) {
+    if (newBuffer == nullptr) {
         SetNotOk();
         return false;
     }
@@ -152,15 +152,15 @@ RuleBasedCollator::RuleBasedCollator(const RuleBasedCollator &other)
 
 RuleBasedCollator::RuleBasedCollator(const uint8_t *bin, int32_t length,
                                      const RuleBasedCollator *base, UErrorCode &errorCode)
-        : data(NULL),
-          settings(NULL),
-          tailoring(NULL),
-          cacheEntry(NULL),
+        : data(nullptr),
+          settings(nullptr),
+          tailoring(nullptr),
+          cacheEntry(nullptr),
           validLocale(""),
           explicitlySetAttributes(0),
           actualLocaleIsSameAsValid(false) {
     if(U_FAILURE(errorCode)) { return; }
-    if(bin == NULL || length == 0 || base == NULL) {
+    if(bin == nullptr || length == 0 || base == nullptr) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
@@ -204,9 +204,9 @@ RuleBasedCollator::adoptTailoring(CollationTailoring *t, UErrorCode &errorCode)
         t->deleteIfZeroRefCount();
         return;
     }
-    U_ASSERT(settings == NULL && data == NULL && tailoring == NULL && cacheEntry == NULL);
+    U_ASSERT(settings == nullptr && data == nullptr && tailoring == nullptr && cacheEntry == nullptr);
     cacheEntry = new CollationCacheEntry(t->actualLocale, t);
-    if(cacheEntry == NULL) {
+    if(cacheEntry == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         t->deleteIfZeroRefCount();
         return;
@@ -246,8 +246,8 @@ RuleBasedCollator::operator==(const Collator& other) const {
     const RuleBasedCollator &o = static_cast<const RuleBasedCollator &>(other);
     if(*settings != *o.settings) { return false; }
     if(data == o.data) { return true; }
-    UBool thisIsRoot = data->base == NULL;
-    UBool otherIsRoot = o.data->base == NULL;
+    UBool thisIsRoot = data->base == nullptr;
+    UBool otherIsRoot = o.data->base == nullptr;
     U_ASSERT(!thisIsRoot || !otherIsRoot);  // otherwise their data pointers should be ==
     if(thisIsRoot != otherIsRoot) { return false; }
     if((thisIsRoot || !tailoring->rules.isEmpty()) &&
@@ -274,7 +274,7 @@ RuleBasedCollator::operator==(const Collator& other) const {
 int32_t
 RuleBasedCollator::hashCode() const {
     int32_t h = settings->hashCode();
-    if(data->base == NULL) { return h; }  // root collator
+    if(data->base == nullptr) { return h; }  // root collator
     // Do not rely on the rule string, see comments in operator==().
     UErrorCode errorCode = U_ZERO_ERROR;
     LocalPointer<UnicodeSet> set(getTailoredSet(errorCode));
@@ -321,7 +321,7 @@ RuleBasedCollator::getLocale(ULocDataLocaleType type, UErrorCode& errorCode) con
 const char *
 RuleBasedCollator::internalGetLocaleID(ULocDataLocaleType type, UErrorCode &errorCode) const {
     if(U_FAILURE(errorCode)) {
-        return NULL;
+        return nullptr;
     }
     const Locale *result;
     switch(type) {
@@ -334,9 +334,9 @@ RuleBasedCollator::internalGetLocaleID(ULocDataLocaleType type, UErrorCode &erro
     case ULOC_REQUESTED_LOCALE:
     default:
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
-    if(result->isBogus()) { return NULL; }
+    if(result->isBogus()) { return nullptr; }
     const char *id = result->getName();
     return id[0] == 0 ? "root" : id;
 }
@@ -366,17 +366,17 @@ RuleBasedCollator::getVersion(UVersionInfo version) const {
 
 UnicodeSet *
 RuleBasedCollator::getTailoredSet(UErrorCode &errorCode) const {
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     UnicodeSet *tailored = new UnicodeSet();
-    if(tailored == NULL) {
+    if(tailored == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
-    if(data->base != NULL) {
+    if(data->base != nullptr) {
         TailoredSet(tailored).forData(data, errorCode);
         if(U_FAILURE(errorCode)) {
             delete tailored;
-            return NULL;
+            return nullptr;
         }
     }
     return tailored;
@@ -387,19 +387,19 @@ RuleBasedCollator::internalGetContractionsAndExpansions(
         UnicodeSet *contractions, UnicodeSet *expansions,
         UBool addPrefixes, UErrorCode &errorCode) const {
     if(U_FAILURE(errorCode)) { return; }
-    if(contractions != NULL) {
+    if(contractions != nullptr) {
         contractions->clear();
     }
-    if(expansions != NULL) {
+    if(expansions != nullptr) {
         expansions->clear();
     }
-    ContractionsAndExpansions(contractions, expansions, NULL, addPrefixes).forData(data, errorCode);
+    ContractionsAndExpansions(contractions, expansions, nullptr, addPrefixes).forData(data, errorCode);
 }
 
 void
 RuleBasedCollator::internalAddContractions(UChar32 c, UnicodeSet &set, UErrorCode &errorCode) const {
     if(U_FAILURE(errorCode)) { return; }
-    ContractionsAndExpansions(&set, NULL, NULL, false).forCodePoint(data, c, errorCode);
+    ContractionsAndExpansions(&set, nullptr, nullptr, false).forCodePoint(data, c, errorCode);
 }
 
 const CollationSettings &
@@ -457,7 +457,7 @@ RuleBasedCollator::setAttribute(UColAttribute attr, UColAttributeValue value,
         }
     }
     CollationSettings *ownedSettings = SharedObject::copyOnWrite(settings);
-    if(ownedSettings == NULL) {
+    if(ownedSettings == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -532,7 +532,7 @@ RuleBasedCollator::setMaxVariable(UColReorderCode group, UErrorCode &errorCode)
         }
     }
     CollationSettings *ownedSettings = SharedObject::copyOnWrite(settings);
-    if(ownedSettings == NULL) {
+    if(ownedSettings == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         return *this;
     }
@@ -568,7 +568,7 @@ RuleBasedCollator::getVariableTop(UErrorCode & /*errorCode*/) const {
 uint32_t
 RuleBasedCollator::setVariableTop(const UChar *varTop, int32_t len, UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return 0; }
-    if(varTop == NULL && len !=0) {
+    if(varTop == nullptr && len !=0) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -617,7 +617,7 @@ RuleBasedCollator::setVariableTop(uint32_t varTop, UErrorCode &errorCode) {
         varTop = v;
         if(varTop != settings->variableTop) {
             CollationSettings *ownedSettings = SharedObject::copyOnWrite(settings);
-            if(ownedSettings == NULL) {
+            if(ownedSettings == nullptr) {
                 errorCode = U_MEMORY_ALLOCATION_ERROR;
                 return;
             }
@@ -639,7 +639,7 @@ int32_t
 RuleBasedCollator::getReorderCodes(int32_t *dest, int32_t capacity,
                                    UErrorCode &errorCode) const {
     if(U_FAILURE(errorCode)) { return 0; }
-    if(capacity < 0 || (dest == NULL && capacity > 0)) {
+    if(capacity < 0 || (dest == nullptr && capacity > 0)) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -657,7 +657,7 @@ void
 RuleBasedCollator::setReorderCodes(const int32_t *reorderCodes, int32_t length,
                                    UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return; }
-    if(length < 0 || (reorderCodes == NULL && length > 0)) {
+    if(length < 0 || (reorderCodes == nullptr && length > 0)) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
@@ -672,7 +672,7 @@ RuleBasedCollator::setReorderCodes(const int32_t *reorderCodes, int32_t length,
     if(length == 1 && reorderCodes[0] == UCOL_REORDER_CODE_DEFAULT) {
         if(settings != &defaultSettings) {
             CollationSettings *ownedSettings = SharedObject::copyOnWrite(settings);
-            if(ownedSettings == NULL) {
+            if(ownedSettings == nullptr) {
                 errorCode = U_MEMORY_ALLOCATION_ERROR;
                 return;
             }
@@ -682,7 +682,7 @@ RuleBasedCollator::setReorderCodes(const int32_t *reorderCodes, int32_t length,
         return;
     }
     CollationSettings *ownedSettings = SharedObject::copyOnWrite(settings);
-    if(ownedSettings == NULL) {
+    if(ownedSettings == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -726,7 +726,7 @@ RuleBasedCollator::compare(const UChar *left, int32_t leftLength,
                            const UChar *right, int32_t rightLength,
                            UErrorCode &errorCode) const {
     if(U_FAILURE(errorCode)) { return UCOL_EQUAL; }
-    if((left == NULL && leftLength != 0) || (right == NULL && rightLength != 0)) {
+    if((left == nullptr && leftLength != 0) || (right == nullptr && rightLength != 0)) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return UCOL_EQUAL;
     }
@@ -746,7 +746,7 @@ RuleBasedCollator::compareUTF8(const StringPiece &left, const StringPiece &right
     if(U_FAILURE(errorCode)) { return UCOL_EQUAL; }
     const uint8_t *leftBytes = reinterpret_cast<const uint8_t *>(left.data());
     const uint8_t *rightBytes = reinterpret_cast<const uint8_t *>(right.data());
-    if((leftBytes == NULL && !left.empty()) || (rightBytes == NULL && !right.empty())) {
+    if((leftBytes == nullptr && !left.empty()) || (rightBytes == nullptr && !right.empty())) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return UCOL_EQUAL;
     }
@@ -758,7 +758,7 @@ RuleBasedCollator::internalCompareUTF8(const char *left, int32_t leftLength,
                                        const char *right, int32_t rightLength,
                                        UErrorCode &errorCode) const {
     if(U_FAILURE(errorCode)) { return UCOL_EQUAL; }
-    if((left == NULL && leftLength != 0) || (right == NULL && rightLength != 0)) {
+    if((left == nullptr && leftLength != 0) || (right == nullptr && rightLength != 0)) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return UCOL_EQUAL;
     }
@@ -809,7 +809,7 @@ public:
     UChar32 nextDecomposedCodePoint(const Normalizer2Impl &nfcImpl, UChar32 c) {
         if(index >= 0) { return c; }
         decomp = nfcImpl.getDecomposition(c, buffer, length);
-        if(decomp == NULL) { return c; }
+        if(decomp == nullptr) { return c; }
         index = 0;
         U16_NEXT_UNSAFE(decomp, index, c);
         return c;
@@ -834,8 +834,8 @@ protected:
     virtual UChar32 nextRawCodePoint() override {
         if(s == limit) { return U_SENTINEL; }
         UChar32 c = *s++;
-        if(limit == NULL && c == 0) {
-            s = NULL;
+        if(limit == nullptr && c == 0) {
+            s = nullptr;
             return U_SENTINEL;
         }
         UChar trail;
@@ -853,11 +853,11 @@ protected:
 class FCDUTF16NFDIterator : public UTF16NFDIterator {
 public:
     FCDUTF16NFDIterator(const Normalizer2Impl &nfcImpl, const UChar *text, const UChar *textLimit)
-            : UTF16NFDIterator(NULL, NULL) {
+            : UTF16NFDIterator(nullptr, nullptr) {
         UErrorCode errorCode = U_ZERO_ERROR;
-        const UChar *spanLimit = nfcImpl.makeFCD(text, textLimit, NULL, errorCode);
+        const UChar *spanLimit = nfcImpl.makeFCD(text, textLimit, nullptr, errorCode);
         if(U_FAILURE(errorCode)) { return; }
-        if(spanLimit == textLimit || (textLimit == NULL && *spanLimit == 0)) {
+        if(spanLimit == textLimit || (textLimit == nullptr && *spanLimit == 0)) {
             s = text;
             limit = spanLimit;
         } else {
@@ -979,8 +979,8 @@ RuleBasedCollator::doCompare(const UChar *left, int32_t leftLength,
     const UChar *rightLimit;
     int32_t equalPrefixLength = 0;
     if(leftLength < 0) {
-        leftLimit = NULL;
-        rightLimit = NULL;
+        leftLimit = nullptr;
+        rightLimit = nullptr;
         UChar c;
         while((c = left[equalPrefixLength]) == right[equalPrefixLength]) {
             if(c == 0) { return UCOL_EQUAL; }
@@ -1288,7 +1288,7 @@ RuleBasedCollator::getCollationKey(const UChar *s, int32_t length, CollationKey&
     if(U_FAILURE(errorCode)) {
         return key.setToBogus();
     }
-    if(s == NULL && length != 0) {
+    if(s == nullptr && length != 0) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return key.setToBogus();
     }
@@ -1314,11 +1314,11 @@ RuleBasedCollator::getSortKey(const UnicodeString &s,
 int32_t
 RuleBasedCollator::getSortKey(const UChar *s, int32_t length,
                               uint8_t *dest, int32_t capacity) const {
-    if((s == NULL && length != 0) || capacity < 0 || (dest == NULL && capacity > 0)) {
+    if((s == nullptr && length != 0) || capacity < 0 || (dest == nullptr && capacity > 0)) {
         return 0;
     }
     uint8_t noDest[1] = { 0 };
-    if(dest == NULL) {
+    if(dest == nullptr) {
         // Distinguish pure preflighting from an allocation error.
         dest = noDest;
         capacity = 0;
@@ -1333,7 +1333,7 @@ void
 RuleBasedCollator::writeSortKey(const UChar *s, int32_t length,
                                 SortKeyByteSink &sink, UErrorCode &errorCode) const {
     if(U_FAILURE(errorCode)) { return; }
-    const UChar *limit = (length >= 0) ? s + length : NULL;
+    const UChar *limit = (length >= 0) ? s + length : nullptr;
     UBool numeric = settings->isNumeric();
     CollationKeys::LevelCallback callback;
     if(settings->dontCheckFCD()) {
@@ -1358,7 +1358,7 @@ void
 RuleBasedCollator::writeIdenticalLevel(const UChar *s, const UChar *limit,
                                        SortKeyByteSink &sink, UErrorCode &errorCode) const {
     // NFD quick check
-    const UChar *nfdQCYesLimit = data->nfcImpl.decompose(s, limit, NULL, errorCode);
+    const UChar *nfdQCYesLimit = data->nfcImpl.decompose(s, limit, nullptr, errorCode);
     if(U_FAILURE(errorCode)) { return; }
     sink.Append(Collation::LEVEL_SEPARATOR_BYTE);
     UChar32 prev = 0;
@@ -1367,7 +1367,7 @@ RuleBasedCollator::writeIdenticalLevel(const UChar *s, const UChar *limit,
     }
     // Is there non-NFD text?
     int32_t destLengthEstimate;
-    if(limit != NULL) {
+    if(limit != nullptr) {
         if(nfdQCYesLimit == limit) { return; }
         destLengthEstimate = (int32_t)(limit - nfdQCYesLimit);
     } else {
@@ -1424,7 +1424,7 @@ int32_t
 RuleBasedCollator::internalNextSortKeyPart(UCharIterator *iter, uint32_t state[2],
                                            uint8_t *dest, int32_t count, UErrorCode &errorCode) const {
     if(U_FAILURE(errorCode)) { return 0; }
-    if(iter == NULL || state == NULL || count < 0 || (count > 0 && dest == NULL)) {
+    if(iter == nullptr || state == nullptr || count < 0 || (count > 0 && dest == nullptr)) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -1542,18 +1542,18 @@ RuleBasedCollator::internalGetShortDefinitionString(const char *locale,
                                                     char *buffer, int32_t capacity,
                                                     UErrorCode &errorCode) const {
     if(U_FAILURE(errorCode)) { return 0; }
-    if(buffer == NULL ? capacity != 0 : capacity < 0) {
+    if(buffer == nullptr ? capacity != 0 : capacity < 0) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
-    if(locale == NULL) {
+    if(locale == nullptr) {
         locale = internalGetLocaleID(ULOC_VALID_LOCALE, errorCode);
     }
 
     char resultLocale[ULOC_FULLNAME_CAPACITY + 1];
     int32_t length = ucol_getFunctionalEquivalent(resultLocale, ULOC_FULLNAME_CAPACITY,
                                                   "collation", locale,
-                                                  NULL, &errorCode);
+                                                  nullptr, &errorCode);
     if(U_FAILURE(errorCode)) { return 0; }
     resultLocale[length] = 0;
 
@@ -1623,11 +1623,11 @@ RuleBasedCollator::initMaxExpansions(UErrorCode &errorCode) const {
 CollationElementIterator *
 RuleBasedCollator::createCollationElementIterator(const UnicodeString& source) const {
     UErrorCode errorCode = U_ZERO_ERROR;
-    if(!initMaxExpansions(errorCode)) { return NULL; }
+    if(!initMaxExpansions(errorCode)) { return nullptr; }
     CollationElementIterator *cei = new CollationElementIterator(source, this, errorCode);
     if(U_FAILURE(errorCode)) {
         delete cei;
-        return NULL;
+        return nullptr;
     }
     return cei;
 }
@@ -1635,11 +1635,11 @@ RuleBasedCollator::createCollationElementIterator(const UnicodeString& source) c
 CollationElementIterator *
 RuleBasedCollator::createCollationElementIterator(const CharacterIterator& source) const {
     UErrorCode errorCode = U_ZERO_ERROR;
-    if(!initMaxExpansions(errorCode)) { return NULL; }
+    if(!initMaxExpansions(errorCode)) { return nullptr; }
     CollationElementIterator *cei = new CollationElementIterator(source, this, errorCode);
     if(U_FAILURE(errorCode)) {
         delete cei;
-        return NULL;
+        return nullptr;
     }
     return cei;
 }
index 99b990708ab6761cda9b048ab8b139a953ad8d75..a9a3105bdb2d5b874265a04cfd691cbac9792439 100644 (file)
@@ -101,22 +101,22 @@ ScientificNumberFormatter *ScientificNumberFormatter::createInstance(
     LocalPointer<DecimalFormat> fmt(fmtToAdopt);
     LocalPointer<Style> style(styleToAdopt);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     ScientificNumberFormatter *result =
             new ScientificNumberFormatter(
                     fmt.getAlias(),
                     style.getAlias(),
                     status);
-    if (result == NULL) {
+    if (result == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     fmt.orphan();
     style.orphan();
     if (U_FAILURE(status)) {
         delete result;
-        return NULL;
+        return nullptr;
     }
     return result;
 }
@@ -246,12 +246,12 @@ ScientificNumberFormatter::ScientificNumberFormatter(
     if (U_FAILURE(status)) {
         return;
     }
-    if (fDecimalFormat == NULL || fStyle == NULL) {
+    if (fDecimalFormat == nullptr || fStyle == nullptr) {
         status = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
     const DecimalFormatSymbols *sym = fDecimalFormat->getDecimalFormatSymbols();
-    if (sym == NULL) {
+    if (sym == nullptr) {
         status = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
@@ -262,8 +262,8 @@ ScientificNumberFormatter::ScientificNumberFormatter(
         const ScientificNumberFormatter &other)
         : UObject(other),
           fPreExponent(other.fPreExponent),
-          fDecimalFormat(NULL),
-          fStyle(NULL) {
+          fDecimalFormat(nullptr),
+          fStyle(nullptr) {
     fDecimalFormat = static_cast<DecimalFormat *>(
             other.fDecimalFormat->clone());
     fStyle = other.fStyle->clone();
index 236bf9d37f19199ca9324650e54bafaa203f566d..bf26ccdf43eefc0e0379097f032ca1aa823bb0a6 100644 (file)
@@ -253,7 +253,7 @@ void ScriptSet::setScriptExtensions(UChar32 codePoint, UErrorCode& status) {
             codePoint, scripts.getAlias(), scripts.getCapacity(), &internalStatus);
         if (internalStatus == U_BUFFER_OVERFLOW_ERROR) {
             // Need to allocate more space
-            if (scripts.resize(script_count) == NULL) {
+            if (scripts.resize(script_count) == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 return;
             }
index d55902bfa7b0de029cbe80e44b0079a2eb6c9d8c..629c5f1529b9f5579fa370577d4ed65a0fdbd90b 100644 (file)
@@ -40,7 +40,7 @@ SearchIterator::SearchIterator(const SearchIterator &other)
 
 SearchIterator::~SearchIterator()
 {
-    if (m_search_ != NULL) {
+    if (m_search_ != nullptr) {
         uprv_free(m_search_);
     }
 }
@@ -125,7 +125,7 @@ void SearchIterator::setBreakIterator(BreakIterator *breakiter,
 {
     if (U_SUCCESS(status)) {
 #if 0
-        m_search_->breakIter = NULL;
+        m_search_->breakIter = nullptr;
         // the c++ breakiterator may not make use of ubreakiterator.
         // so we'll have to keep track of it ourselves.
 #else
@@ -344,7 +344,7 @@ void SearchIterator::reset()
 SearchIterator::SearchIterator()
 {
     m_search_                     = (USearch *)uprv_malloc(sizeof(USearch));
-    m_search_->breakIter          = NULL;
+    m_search_->breakIter          = nullptr;
     m_search_->isOverlap          = false;
     m_search_->isCanonicalMatch   = false;
     m_search_->elementComparisonType = 0;
@@ -352,9 +352,9 @@ SearchIterator::SearchIterator()
     m_search_->reset              = true;
     m_search_->matchedIndex       = USEARCH_DONE;
     m_search_->matchedLength      = 0;
-    m_search_->text               = NULL;
+    m_search_->text               = nullptr;
     m_search_->textLength         = 0;
-    m_breakiterator_              = NULL;
+    m_breakiterator_              = nullptr;
 }
 
 SearchIterator::SearchIterator(const UnicodeString &text, 
@@ -363,7 +363,7 @@ SearchIterator::SearchIterator(const UnicodeString &text,
                                      m_text_(text)
 {
     m_search_                     = (USearch *)uprv_malloc(sizeof(USearch));
-    m_search_->breakIter          = NULL;
+    m_search_->breakIter          = nullptr;
     m_search_->isOverlap          = false;
     m_search_->isCanonicalMatch   = false;
     m_search_->elementComparisonType = 0;
@@ -380,7 +380,7 @@ SearchIterator::SearchIterator(CharacterIterator &text,
                                m_breakiterator_(breakiter)
 {
     m_search_                     = (USearch *)uprv_malloc(sizeof(USearch));
-    m_search_->breakIter          = NULL;
+    m_search_->breakIter          = nullptr;
     m_search_->isOverlap          = false;
     m_search_->isCanonicalMatch   = false;
     m_search_->elementComparisonType = 0;
index 9928d284c9fc2dfc40bfcd577b3646061a41c72b..27acee5ce2ba5d5382cd22988b89beb91156f65a 100644 (file)
@@ -61,7 +61,7 @@ SelectFormat::applyPattern(const UnicodeString& newPattern, UErrorCode& status)
       return;
     }
 
-    msgPattern.parseSelectStyle(newPattern, NULL, status);
+    msgPattern.parseSelectStyle(newPattern, nullptr, status);
     if (U_FAILURE(status)) {
         msgPattern.clear();
     }
index 77403e480741f56ae36fd3699bef2e9fc71fa2dd..7f71adebca3406406f97bf1192bb6500c6585d6c 100644 (file)
@@ -725,7 +725,7 @@ UBool SimpleTimeZone::inDaylightTime(UDate date, UErrorCode& status) const
     // and provided only for Java compatibility as of 8/6/97 [LIU].
     if (U_FAILURE(status)) return false;
     GregorianCalendar *gc = new GregorianCalendar(*this, status);
-    /* test for NULL */
+    /* test for nullptr */
     if (gc == 0) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return false;
@@ -1040,25 +1040,25 @@ SimpleTimeZone::getPreviousTransition(UDate base, UBool inclusive, TimeZoneTrans
 
 void
 SimpleTimeZone::clearTransitionRules(void) {
-    initialRule = NULL;
-    firstTransition = NULL;
-    stdRule = NULL;
-    dstRule = NULL;
+    initialRule = nullptr;
+    firstTransition = nullptr;
+    stdRule = nullptr;
+    dstRule = nullptr;
     transitionRulesInitialized = false;
 }
 
 void
 SimpleTimeZone::deleteTransitionRules(void) {
-    if (initialRule != NULL) {
+    if (initialRule != nullptr) {
         delete initialRule;
     }
-    if (firstTransition != NULL) {
+    if (firstTransition != nullptr) {
         delete firstTransition;
     }
-    if (stdRule != NULL) {
+    if (stdRule != nullptr) {
         delete stdRule;
     }
-    if (dstRule != NULL) {
+    if (dstRule != nullptr) {
         delete dstRule;
     }
     clearTransitionRules();
@@ -1131,7 +1131,7 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) {
             return;
         }
         // Check for Null pointer
-        if (dtRule == NULL) {
+        if (dtRule == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
@@ -1140,7 +1140,7 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) {
             dtRule, startYear, AnnualTimeZoneRule::MAX_YEAR);
         
         // Check for Null pointer
-        if (dstRule == NULL) {
+        if (dstRule == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             deleteTransitionRules();
             return;
@@ -1168,7 +1168,7 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) {
         }
         
         // Check for Null pointer
-        if (dtRule == NULL) {
+        if (dtRule == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             deleteTransitionRules();
             return;
@@ -1178,7 +1178,7 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) {
             dtRule, startYear, AnnualTimeZoneRule::MAX_YEAR);
         
         //Check for Null pointer
-        if (stdRule == NULL) {
+        if (stdRule == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             deleteTransitionRules();
             return;
@@ -1190,7 +1190,7 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) {
         // Create a TimeZoneRule for initial time
         if (firstStdStart < firstDstStart) {
             initialRule = new InitialTimeZoneRule(tzid+UnicodeString(DST_STR), getRawOffset(), dstRule->getDSTSavings());
-            if (initialRule == NULL) {
+            if (initialRule == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 deleteTransitionRules();
                 return;
@@ -1198,14 +1198,14 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) {
             firstTransition = new TimeZoneTransition(firstStdStart, *initialRule, *stdRule);
         } else {
             initialRule = new InitialTimeZoneRule(tzid+UnicodeString(STD_STR), getRawOffset(), 0);
-            if (initialRule == NULL) {
+            if (initialRule == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 deleteTransitionRules();
                 return;
             }
             firstTransition = new TimeZoneTransition(firstDstStart, *initialRule, *dstRule);
         }
-        if (firstTransition == NULL) {
+        if (firstTransition == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             deleteTransitionRules();
             return;
@@ -1215,7 +1215,7 @@ SimpleTimeZone::initTransitionRules(UErrorCode& status) {
         // Create a TimeZoneRule for initial time
         initialRule = new InitialTimeZoneRule(tzid, getRawOffset(), 0);
         // Check for null pointer.
-        if (initialRule == NULL) {
+        if (initialRule == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             deleteTransitionRules();
             return;
@@ -1244,7 +1244,7 @@ SimpleTimeZone::getTimeZoneRules(const InitialTimeZoneRule*& initial,
     }
     initial = initialRule;
     int32_t cnt = 0;
-    if (stdRule != NULL) {
+    if (stdRule != nullptr) {
         if (cnt < trscount) {
             trsrules[cnt++] = stdRule;
         }
index eef3d7766bbe19a718632d48cbb9ffc94008946a..afb035c585f068e078481b5345e7343b8d0ba837 100644 (file)
@@ -245,7 +245,7 @@ static UMutex LOCK;
 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(SimpleDateFormat)
 
 SimpleDateFormat::NSOverride::~NSOverride() {
-    if (snf != NULL) {
+    if (snf != nullptr) {
         snf->removeRef();
     }
 }
@@ -266,7 +266,7 @@ void SimpleDateFormat::NSOverride::free() {
 static void fixNumberFormatForDates(NumberFormat &nf) {
     nf.setGroupingUsed(false);
     DecimalFormat* decfmt = dynamic_cast<DecimalFormat*>(&nf);
-    if (decfmt != NULL) {
+    if (decfmt != nullptr) {
         decfmt->setDecimalSeparatorAlwaysShown(false);
     }
     nf.setParseIntegerOnly(true);
@@ -277,7 +277,7 @@ static const SharedNumberFormat *createSharedNumberFormat(
         NumberFormat *nfToAdopt) {
     fixNumberFormatForDates(*nfToAdopt);
     const SharedNumberFormat *result = new SharedNumberFormat(nfToAdopt);
-    if (result == NULL) {
+    if (result == nullptr) {
         delete nfToAdopt;
     }
     return result;
@@ -287,10 +287,10 @@ static const SharedNumberFormat *createSharedNumberFormat(
         const Locale &loc, UErrorCode &status) {
     NumberFormat *nf = NumberFormat::createInstance(loc, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     const SharedNumberFormat *result = createSharedNumberFormat(nf);
-    if (result == NULL) {
+    if (result == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
     }
     return result;
@@ -299,11 +299,11 @@ static const SharedNumberFormat *createSharedNumberFormat(
 static const SharedNumberFormat **allocSharedNumberFormatters() {
     const SharedNumberFormat **result = (const SharedNumberFormat**)
             uprv_malloc(UDAT_FIELD_COUNT * sizeof(const SharedNumberFormat*));
-    if (result == NULL) {
-        return NULL;
+    if (result == nullptr) {
+        return nullptr;
     }
     for (int32_t i = 0; i < UDAT_FIELD_COUNT; ++i) {
-        result[i] = NULL;
+        result[i] = nullptr;
     }
     return result;
 }
@@ -317,8 +317,8 @@ static void freeSharedNumberFormatters(const SharedNumberFormat ** list) {
 
 const NumberFormat *SimpleDateFormat::getNumberFormatByIndex(
         UDateFormatField index) const {
-    if (fSharedNumberFormatters == NULL ||
-        fSharedNumberFormatters[index] == NULL) {
+    if (fSharedNumberFormatters == nullptr ||
+        fSharedNumberFormatters[index] == nullptr) {
         return fNumberFormat;
     }
     return &(**fSharedNumberFormatters[index]);
@@ -362,7 +362,7 @@ SimpleDateFormat::SimpleDateFormat(const UnicodeString& pattern,
     fDateOverride.setToBogus();
     fTimeOverride.setToBogus();
     initializeBooleanAttributes();
-    initializeCalendar(NULL,fLocale,status);
+    initializeCalendar(nullptr,fLocale,status);
     fSymbols = DateFormatSymbols::createForLocale(fLocale, status);
     initialize(fLocale, status);
     initializeDefaultCentury();
@@ -379,7 +379,7 @@ SimpleDateFormat::SimpleDateFormat(const UnicodeString& pattern,
     fDateOverride.setTo(override);
     fTimeOverride.setToBogus();
     initializeBooleanAttributes();
-    initializeCalendar(NULL,fLocale,status);
+    initializeCalendar(nullptr,fLocale,status);
     fSymbols = DateFormatSymbols::createForLocale(fLocale, status);
     initialize(fLocale, status);
     initializeDefaultCentury();
@@ -401,7 +401,7 @@ SimpleDateFormat::SimpleDateFormat(const UnicodeString& pattern,
     fTimeOverride.setToBogus();
     initializeBooleanAttributes();
 
-    initializeCalendar(NULL,fLocale,status);
+    initializeCalendar(nullptr,fLocale,status);
     fSymbols = DateFormatSymbols::createForLocale(fLocale, status);
     initialize(fLocale, status);
     initializeDefaultCentury();
@@ -421,7 +421,7 @@ SimpleDateFormat::SimpleDateFormat(const UnicodeString& pattern,
     fTimeOverride.setToBogus();
     initializeBooleanAttributes();
 
-    initializeCalendar(NULL,fLocale,status);
+    initializeCalendar(nullptr,fLocale,status);
     fSymbols = DateFormatSymbols::createForLocale(fLocale, status);
     initialize(fLocale, status);
     initializeDefaultCentury();
@@ -444,7 +444,7 @@ SimpleDateFormat::SimpleDateFormat(const UnicodeString& pattern,
     fTimeOverride.setToBogus();
     initializeBooleanAttributes();
 
-    initializeCalendar(NULL,fLocale,status);
+    initializeCalendar(nullptr,fLocale,status);
     initialize(fLocale, status);
     initializeDefaultCentury();
 }
@@ -463,7 +463,7 @@ SimpleDateFormat::SimpleDateFormat(const UnicodeString& pattern,
     fTimeOverride.setToBogus();
     initializeBooleanAttributes();
 
-    initializeCalendar(NULL, fLocale, status);
+    initializeCalendar(nullptr, fLocale, status);
     initialize(fLocale, status);
     initializeDefaultCentury();
 }
@@ -498,7 +498,7 @@ SimpleDateFormat::SimpleDateFormat(const Locale& locale,
 {
     if (U_FAILURE(status)) return;
     initializeBooleanAttributes();
-    initializeCalendar(NULL, fLocale, status);
+    initializeCalendar(nullptr, fLocale, status);
     fSymbols = DateFormatSymbols::createForLocale(fLocale, status);
     if (U_FAILURE(status))
     {
@@ -506,7 +506,7 @@ SimpleDateFormat::SimpleDateFormat(const Locale& locale,
         delete fSymbols;
         // This constructor doesn't fail; it uses last resort data
         fSymbols = new DateFormatSymbols(status);
-        /* test for NULL */
+        /* test for nullptr */
         if (fSymbols == 0) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
@@ -550,7 +550,7 @@ SimpleDateFormat& SimpleDateFormat::operator=(const SimpleDateFormat& other)
     fTimeOverride = other.fTimeOverride;
 
     delete fSymbols;
-    fSymbols = NULL;
+    fSymbols = nullptr;
 
     if (other.fSymbols)
         fSymbols = new DateFormatSymbols(*other.fSymbols);
@@ -566,7 +566,7 @@ SimpleDateFormat& SimpleDateFormat::operator=(const SimpleDateFormat& other)
     fLocale = other.fLocale;
 
     // TimeZoneFormat can now be set independently via setter.
-    // If it is NULL, it will be lazily initialized from locale.
+    // If it is nullptr, it will be lazily initialized from locale.
     delete fTimeZoneFormat;
     fTimeZoneFormat = nullptr;
     TimeZoneFormat *otherTZFormat;
@@ -592,16 +592,16 @@ SimpleDateFormat& SimpleDateFormat::operator=(const SimpleDateFormat& other)
     }
 
 #if !UCONFIG_NO_BREAK_ITERATION
-    if (other.fCapitalizationBrkIter != NULL) {
+    if (other.fCapitalizationBrkIter != nullptr) {
         fCapitalizationBrkIter = (other.fCapitalizationBrkIter)->clone();
     }
 #endif
 
-    if (fSharedNumberFormatters != NULL) {
+    if (fSharedNumberFormatters != nullptr) {
         freeSharedNumberFormatters(fSharedNumberFormatters);
-        fSharedNumberFormatters = NULL;
+        fSharedNumberFormatters = nullptr;
     }
-    if (other.fSharedNumberFormatters != NULL) {
+    if (other.fSharedNumberFormatters != nullptr) {
         fSharedNumberFormatters = allocSharedNumberFormatters();
         if (fSharedNumberFormatters) {
             for (int32_t i = 0; i < UDAT_FIELD_COUNT; ++i) {
@@ -639,8 +639,8 @@ SimpleDateFormat::operator==(const Format& other) const
         // DateFormat::operator== guarantees following cast is safe
         SimpleDateFormat* that = (SimpleDateFormat*)&other;
         return (fPattern             == that->fPattern &&
-                fSymbols             != NULL && // Check for pathological object
-                that->fSymbols       != NULL && // Check for pathological object
+                fSymbols             != nullptr && // Check for pathological object
+                that->fSymbols       != nullptr && // Check for pathological object
                 *fSymbols            == *that->fSymbols &&
                 fHaveDefaultCentury  == that->fHaveDefaultCentury &&
                 fDefaultCenturyStart == that->fDefaultCenturyStart);
@@ -665,22 +665,22 @@ void SimpleDateFormat::construct(EStyle timeStyle,
     if (U_FAILURE(status)) return;
 
     // We will need the calendar to know what type of symbols to load.
-    initializeCalendar(NULL, locale, status);
+    initializeCalendar(nullptr, locale, status);
     if (U_FAILURE(status)) return;
 
     // Load date time patterns directly from resources.
-    const char* cType = fCalendar ? fCalendar->getType() : NULL;
-    LocalUResourceBundlePointer bundle(ures_open(NULL, locale.getBaseName(), &status));
+    const char* cType = fCalendar ? fCalendar->getType() : nullptr;
+    LocalUResourceBundlePointer bundle(ures_open(nullptr, locale.getBaseName(), &status));
     if (U_FAILURE(status)) return;
 
     UBool cTypeIsGregorian = true;
     LocalUResourceBundlePointer dateTimePatterns;
-    if (cType != NULL && uprv_strcmp(cType, "gregorian") != 0) {
+    if (cType != nullptr && uprv_strcmp(cType, "gregorian") != 0) {
         CharString resourcePath("calendar/", status);
         resourcePath.append(cType, status).append("/DateTimePatterns", status);
         dateTimePatterns.adoptInstead(
             ures_getByKeyWithFallback(bundle.getAlias(), resourcePath.data(),
-                                      (UResourceBundle*)NULL, &status));
+                                      (UResourceBundle*)nullptr, &status));
         cTypeIsGregorian = false;
     }
 
@@ -690,7 +690,7 @@ void SimpleDateFormat::construct(EStyle timeStyle,
         dateTimePatterns.adoptInstead(
             ures_getByKeyWithFallback(bundle.getAlias(),
                                       "calendar/gregorian/DateTimePatterns",
-                                      (UResourceBundle*)NULL, &status));
+                                      (UResourceBundle*)nullptr, &status));
     }
     if (U_FAILURE(status)) return;
 
@@ -708,7 +708,7 @@ void SimpleDateFormat::construct(EStyle timeStyle,
     // create a symbols object from the locale
     fSymbols = DateFormatSymbols::createForLocale(locale, status);
     if (U_FAILURE(status)) return;
-    /* test for NULL */
+    /* test for nullptr */
     if (fSymbols == 0) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
@@ -764,7 +764,7 @@ void SimpleDateFormat::construct(EStyle timeStyle,
         UnicodeString tempus1(timePattern);
         if (tempus1.length() == 0) {
             currentBundle.adoptInstead(
-                    ures_getByIndex(dateTimePatterns.getAlias(), (int32_t)timeStyle, NULL, &status));
+                    ures_getByIndex(dateTimePatterns.getAlias(), (int32_t)timeStyle, nullptr, &status));
             if (U_FAILURE(status)) {
                status = U_INVALID_FORMAT_ERROR;
                return;
@@ -790,7 +790,7 @@ void SimpleDateFormat::construct(EStyle timeStyle,
         }
 
         currentBundle.adoptInstead(
-                ures_getByIndex(dateTimePatterns.getAlias(), (int32_t)dateStyle, NULL, &status));
+                ures_getByIndex(dateTimePatterns.getAlias(), (int32_t)dateStyle, nullptr, &status));
         if (U_FAILURE(status)) {
            status = U_INVALID_FORMAT_ERROR;
            return;
@@ -855,7 +855,7 @@ void SimpleDateFormat::construct(EStyle timeStyle,
         fPattern.setTo(timePattern);
         if (fPattern.length() == 0) {
             currentBundle.adoptInstead(
-                    ures_getByIndex(dateTimePatterns.getAlias(), (int32_t)timeStyle, NULL, &status));
+                    ures_getByIndex(dateTimePatterns.getAlias(), (int32_t)timeStyle, nullptr, &status));
             if (U_FAILURE(status)) {
                status = U_INVALID_FORMAT_ERROR;
                return;
@@ -881,7 +881,7 @@ void SimpleDateFormat::construct(EStyle timeStyle,
     }
     else if (dateStyle != kNone) {
         currentBundle.adoptInstead(
-                ures_getByIndex(dateTimePatterns.getAlias(), (int32_t)dateStyle, NULL, &status));
+                ures_getByIndex(dateTimePatterns.getAlias(), (int32_t)dateStyle, nullptr, &status));
         if (U_FAILURE(status)) {
            status = U_INVALID_FORMAT_ERROR;
            return;
@@ -945,7 +945,7 @@ SimpleDateFormat::initialize(const Locale& locale,
     // We don't need to check that the row count is >= 1, since all 2d arrays have at
     // least one row
     fNumberFormat = NumberFormat::createInstance(locale, status);
-    if (fNumberFormat != NULL && U_SUCCESS(status))
+    if (fNumberFormat != nullptr && U_SUCCESS(status))
     {
         fixNumberFormatForDates(*fNumberFormat);
         //fNumberFormat->setLenient(true); // Java uses a custom DateNumberFormat to format/parse
@@ -1041,13 +1041,13 @@ SimpleDateFormat::_format(Calendar& cal, UnicodeString& appendTo,
        return appendTo;
     }
     Calendar* workCal = &cal;
-    Calendar* calClone = NULL;
+    Calendar* calClone = nullptr;
     if (&cal != fCalendar && uprv_strcmp(cal.getType(), fCalendar->getType()) != 0) {
         // Different calendar type
         // We use the time and time zone from the input calendar, but
         // do not use the input calendar for field calculation.
         calClone = fCalendar->clone();
-        if (calClone != NULL) {
+        if (calClone != nullptr) {
             UDate t = cal.getTime(status);
             calClone->setTime(t, status);
             calClone->setTimeZone(cal.getTimeZone());
@@ -1103,7 +1103,7 @@ SimpleDateFormat::_format(Calendar& cal, UnicodeString& appendTo,
                   prevCh, handler, *workCal, status);
     }
 
-    if (calClone != NULL) {
+    if (calClone != nullptr) {
         delete calClone;
     }
 
@@ -1286,7 +1286,7 @@ _appendSymbolWithMonthPattern(UnicodeString& dst, int32_t value, const UnicodeSt
               const UnicodeString* monthPattern, UErrorCode& status) {
     U_ASSERT(0 <= value && value < symbolsCount);
     if (0 <= value && value < symbolsCount) {
-        if (monthPattern == NULL) {
+        if (monthPattern == nullptr) {
             dst += symbols[value];
         } else {
             SimpleFormatter(*monthPattern, 1, 1, status).format(symbols[value], dst, status);
@@ -1328,9 +1328,9 @@ SimpleDateFormat::initNumberFormatters(const Locale &locale,UErrorCode &status)
         return;
     }
     umtx_lock(&LOCK);
-    if (fSharedNumberFormatters == NULL) {
+    if (fSharedNumberFormatters == nullptr) {
         fSharedNumberFormatters = allocSharedNumberFormatters();
-        if (fSharedNumberFormatters == NULL) {
+        if (fSharedNumberFormatters == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
         }
     }
@@ -1355,7 +1355,7 @@ SimpleDateFormat::processOverrideString(const Locale &locale, const UnicodeStrin
     UnicodeString nsName;
     UnicodeString ovrField;
     UBool moreToProcess = true;
-    NSOverride *overrideList = NULL;
+    NSOverride *overrideList = nullptr;
 
     while (moreToProcess) {
         int32_t delimiterPosition = str.indexOf((UChar)ULOC_KEYWORD_ITEM_SEPARATOR_UNICODE,start);
@@ -1378,7 +1378,7 @@ SimpleDateFormat::processOverrideString(const Locale &locale, const UnicodeStrin
         int32_t nsNameHash = nsName.hashCode();
         // See if the numbering system is in the override list, if not, then add it.
         NSOverride *curr = overrideList;
-        const SharedNumberFormat *snf = NULL;
+        const SharedNumberFormat *snf = nullptr;
         UBool found = false;
         while ( curr && !found ) {
             if ( curr->hash == nsNameHash ) {
@@ -1507,7 +1507,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
     }
 
     currentNumberFormat = getNumberFormatByIndex(patternCharIndex);
-    if (currentNumberFormat == NULL) {
+    if (currentNumberFormat == nullptr) {
         status = U_INTERNAL_PROGRAM_ERROR;
         return;
     }
@@ -1535,7 +1535,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
         break;
 
      case UDAT_YEAR_NAME_FIELD:
-        if (fSymbols->fShortYearNames != NULL && value <= fSymbols->fShortYearNamesCount) {
+        if (fSymbols->fShortYearNames != nullptr && value <= fSymbols->fShortYearNamesCount) {
             // the Calendar YEAR field runs 1 through 60 for cyclic years
             _appendSymbol(appendTo, value - 1, fSymbols->fShortYearNames, fSymbols->fShortYearNamesCount);
             break;
@@ -1576,43 +1576,43 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
                value--; // Adjust the month number down 1 in Hebrew non-leap years, i.e. Adar is 6, not 7.
         }
         {
-            int32_t isLeapMonth = (fSymbols->fLeapMonthPatterns != NULL && fSymbols->fLeapMonthPatternsCount >= DateFormatSymbols::kMonthPatternsCount)?
+            int32_t isLeapMonth = (fSymbols->fLeapMonthPatterns != nullptr && fSymbols->fLeapMonthPatternsCount >= DateFormatSymbols::kMonthPatternsCount)?
                         cal.get(UCAL_IS_LEAP_MONTH, status): 0;
             // should consolidate the next section by using arrays of pointers & counts for the right symbols...
             if (count == 5) {
                 if (patternCharIndex == UDAT_MONTH_FIELD) {
                     _appendSymbolWithMonthPattern(appendTo, value, fSymbols->fNarrowMonths, fSymbols->fNarrowMonthsCount,
-                            (isLeapMonth!=0)? &(fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternFormatNarrow]): NULL, status);
+                            (isLeapMonth!=0)? &(fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternFormatNarrow]): nullptr, status);
                 } else {
                     _appendSymbolWithMonthPattern(appendTo, value, fSymbols->fStandaloneNarrowMonths, fSymbols->fStandaloneNarrowMonthsCount,
-                            (isLeapMonth!=0)? &(fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternStandaloneNarrow]): NULL, status);
+                            (isLeapMonth!=0)? &(fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternStandaloneNarrow]): nullptr, status);
                 }
                 capContextUsageType = DateFormatSymbols::kCapContextUsageMonthNarrow;
             } else if (count == 4) {
                 if (patternCharIndex == UDAT_MONTH_FIELD) {
                     _appendSymbolWithMonthPattern(appendTo, value, fSymbols->fMonths, fSymbols->fMonthsCount,
-                            (isLeapMonth!=0)? &(fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternFormatWide]): NULL, status);
+                            (isLeapMonth!=0)? &(fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternFormatWide]): nullptr, status);
                     capContextUsageType = DateFormatSymbols::kCapContextUsageMonthFormat;
                 } else {
                     _appendSymbolWithMonthPattern(appendTo, value, fSymbols->fStandaloneMonths, fSymbols->fStandaloneMonthsCount,
-                            (isLeapMonth!=0)? &(fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternStandaloneWide]): NULL, status);
+                            (isLeapMonth!=0)? &(fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternStandaloneWide]): nullptr, status);
                     capContextUsageType = DateFormatSymbols::kCapContextUsageMonthStandalone;
                 }
             } else if (count == 3) {
                 if (patternCharIndex == UDAT_MONTH_FIELD) {
                     _appendSymbolWithMonthPattern(appendTo, value, fSymbols->fShortMonths, fSymbols->fShortMonthsCount,
-                            (isLeapMonth!=0)? &(fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternFormatAbbrev]): NULL, status);
+                            (isLeapMonth!=0)? &(fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternFormatAbbrev]): nullptr, status);
                     capContextUsageType = DateFormatSymbols::kCapContextUsageMonthFormat;
                 } else {
                     _appendSymbolWithMonthPattern(appendTo, value, fSymbols->fStandaloneShortMonths, fSymbols->fStandaloneShortMonthsCount,
-                            (isLeapMonth!=0)? &(fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternStandaloneAbbrev]): NULL, status);
+                            (isLeapMonth!=0)? &(fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternStandaloneAbbrev]): nullptr, status);
                     capContextUsageType = DateFormatSymbols::kCapContextUsageMonthStandalone;
                 }
             } else {
                 UnicodeString monthNumber;
                 zeroPaddingNumber(currentNumberFormat,monthNumber, value + 1, count, maxIntCount);
                 _appendSymbolWithMonthPattern(appendTo, 0, &monthNumber, 1,
-                        (isLeapMonth!=0)? &(fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternNumeric]): NULL, status);
+                        (isLeapMonth!=0)? &(fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternNumeric]): nullptr, status);
             }
         }
         break;
@@ -1889,7 +1889,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
 
     case UDAT_AM_PM_MIDNIGHT_NOON_FIELD:
     {
-        const UnicodeString *toAppend = NULL;
+        const UnicodeString *toAppend = nullptr;
         int32_t hour = cal.get(UCAL_HOUR_OF_DAY, status);
 
         // Note: "midnight" can be ambiguous as to whether it refers to beginning of day or end of day.
@@ -1915,10 +1915,10 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
             }
         }
 
-        // toAppend is NULL if time isn't exactly midnight or noon (as displayed).
+        // toAppend is nullptr if time isn't exactly midnight or noon (as displayed).
         // toAppend is bogus if time is midnight or noon, but no localized string exists.
         // In either case, fall back to am/pm.
-        if (toAppend == NULL || toAppend->isBogus()) {
+        if (toAppend == nullptr || toAppend->isBogus()) {
             // Reformat with identical arguments except ch, now changed to 'a'.
             // We are passing a different fieldToOutput because we want to add
             // 'b' to field position. This makes this fallback stable when
@@ -1941,7 +1941,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
             // Data doesn't conform to spec, therefore loading failed.
             break;
         }
-        if (ruleSet == NULL) {
+        if (ruleSet == nullptr) {
             // Data doesn't exist for the locale we're looking for.
             // Falling back to am/pm.
             // We are passing a different fieldToOutput because we want to add
@@ -1975,7 +1975,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
         // Rule set exists, therefore periodType can't be UNKNOWN.
         // Get localized string.
         U_ASSERT(periodType != DayPeriodRules::DAYPERIOD_UNKNOWN);
-        UnicodeString *toAppend = NULL;
+        UnicodeString *toAppend = nullptr;
         int32_t index;
 
         // Note: "midnight" can be ambiguous as to whether it refers to beginning of day or end of day.
@@ -1998,7 +1998,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
         // Midnight/Noon -> General Periods -> AM/PM.
 
         // Midnight/Noon -> General Periods.
-        if ((toAppend == NULL || toAppend->isBogus()) &&
+        if ((toAppend == nullptr || toAppend->isBogus()) &&
                 (periodType == DayPeriodRules::DAYPERIOD_MIDNIGHT ||
                  periodType == DayPeriodRules::DAYPERIOD_NOON)) {
             periodType = ruleSet->getDayPeriodForHour(hour);
@@ -2038,7 +2038,7 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
     }
 #if !UCONFIG_NO_BREAK_ITERATION
     // if first field, check to see whether we need to and are able to titlecase it
-    if (fieldNum == 0 && fCapitalizationBrkIter != NULL && appendTo.length() > beginOffset &&
+    if (fieldNum == 0 && fCapitalizationBrkIter != nullptr && appendTo.length() > beginOffset &&
             u_islower(appendTo.char32At(beginOffset))) {
         UBool titlecase = false;
         switch (capitalizationContext) {
@@ -2084,7 +2084,7 @@ void SimpleDateFormat::adoptNumberFormat(NumberFormat *formatToAdopt) {
     // (can't fail).
     if (fSharedNumberFormatters) {
         freeSharedNumberFormatters(fSharedNumberFormatters);
-        fSharedNumberFormatters = NULL;
+        fSharedNumberFormatters = nullptr;
     }
 
     // Recompute fSimpleNumberFormatter if necessary
@@ -2100,15 +2100,15 @@ void SimpleDateFormat::adoptNumberFormat(const UnicodeString& fields, NumberForm
     }
 
     // We must ensure fSharedNumberFormatters is allocated.
-    if (fSharedNumberFormatters == NULL) {
+    if (fSharedNumberFormatters == nullptr) {
         fSharedNumberFormatters = allocSharedNumberFormatters();
-        if (fSharedNumberFormatters == NULL) {
+        if (fSharedNumberFormatters == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
     }
     const SharedNumberFormat *newFormat = createSharedNumberFormat(fmt.orphan());
-    if (newFormat == NULL) {
+    if (newFormat == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -2133,7 +2133,7 @@ const NumberFormat *
 SimpleDateFormat::getNumberFormatForField(UChar field) const {
     UDateFormatField index = DateFormatSymbols::getPatternCharIndex(field);
     if (index == UDAT_FIELD_COUNT) {
-        return NULL;
+        return nullptr;
     }
     return getNumberFormatByIndex(index);
 }
@@ -2253,16 +2253,16 @@ SimpleDateFormat::parse(const UnicodeString& text, Calendar& cal, ParsePosition&
     int32_t abutPass = 0;
     UBool inQuote = false;
 
-    MessageFormat * numericLeapMonthFormatter = NULL;
+    MessageFormat * numericLeapMonthFormatter = nullptr;
 
-    Calendar* calClone = NULL;
+    Calendar* calClone = nullptr;
     Calendar *workCal = &cal;
     if (&cal != fCalendar && uprv_strcmp(cal.getType(), fCalendar->getType()) != 0) {
         // Different calendar type
         // We use the time/zone from the input calendar, but
         // do not use the input calendar for field calculation.
         calClone = fCalendar->clone();
-        if (calClone != NULL) {
+        if (calClone != nullptr) {
             calClone->setTime(cal.getTime(status),status);
             if (U_FAILURE(status)) {
                 goto ExitParse;
@@ -2275,9 +2275,9 @@ SimpleDateFormat::parse(const UnicodeString& text, Calendar& cal, ParsePosition&
         }
     }
 
-    if (fSymbols->fLeapMonthPatterns != NULL && fSymbols->fLeapMonthPatternsCount >= DateFormatSymbols::kMonthPatternsCount) {
+    if (fSymbols->fLeapMonthPatterns != nullptr && fSymbols->fLeapMonthPatternsCount >= DateFormatSymbols::kMonthPatternsCount) {
         numericLeapMonthFormatter = new MessageFormat(fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternNumeric], fLocale, status);
-        if (numericLeapMonthFormatter == NULL) {
+        if (numericLeapMonthFormatter == nullptr) {
              status = U_MEMORY_ALLOCATION_ERROR;
              goto ExitParse;
         } else if (U_FAILURE(status)) {
@@ -2510,7 +2510,7 @@ SimpleDateFormat::parse(const UnicodeString& text, Calendar& cal, ParsePosition&
         if (ambiguousYear[0]) {
             copy = cal.clone();
             // Check for failed cloning.
-            if (copy == NULL) {
+            if (copy == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 goto ExitParse;
             }
@@ -2526,17 +2526,17 @@ SimpleDateFormat::parse(const UnicodeString& text, Calendar& cal, ParsePosition&
         if (tzTimeType != UTZFMT_TIME_TYPE_UNKNOWN) {
             copy = cal.clone();
             // Check for failed cloning.
-            if (copy == NULL) {
+            if (copy == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 goto ExitParse;
             }
             const TimeZone & tz = cal.getTimeZone();
-            BasicTimeZone *btz = NULL;
+            BasicTimeZone *btz = nullptr;
 
-            if (dynamic_cast<const OlsonTimeZone *>(&tz) != NULL
-                || dynamic_cast<const SimpleTimeZone *>(&tz) != NULL
-                || dynamic_cast<const RuleBasedTimeZone *>(&tz) != NULL
-                || dynamic_cast<const VTimeZone *>(&tz) != NULL) {
+            if (dynamic_cast<const OlsonTimeZone *>(&tz) != nullptr
+                || dynamic_cast<const SimpleTimeZone *>(&tz) != nullptr
+                || dynamic_cast<const RuleBasedTimeZone *>(&tz) != nullptr
+                || dynamic_cast<const VTimeZone *>(&tz) != nullptr) {
                 btz = (BasicTimeZone*)&tz;
             }
 
@@ -2548,7 +2548,7 @@ SimpleDateFormat::parse(const UnicodeString& text, Calendar& cal, ParsePosition&
             // Make sure parsed time zone type (Standard or Daylight)
             // matches the rule used by the parsed time zone.
             int32_t raw, dst;
-            if (btz != NULL) {
+            if (btz != nullptr) {
                 if (tzTimeType == UTZFMT_TIME_TYPE_STANDARD) {
                     btz->getOffsetFromLocal(localMillis,
                         UCAL_TZ_LOCAL_STANDARD_FORMER, UCAL_TZ_LOCAL_STANDARD_LATTER, raw, dst, status);
@@ -2571,7 +2571,7 @@ SimpleDateFormat::parse(const UnicodeString& text, Calendar& cal, ParsePosition&
                 }
             } else { // tztype == TZTYPE_DST
                 if (dst == 0) {
-                    if (btz != NULL) {
+                    if (btz != nullptr) {
                         // This implementation resolves daylight saving time offset
                         // closest rule after the given time.
                         UDate baseTime = localMillis + raw;
@@ -2636,10 +2636,10 @@ ExitParse:
         cal.setTime(workCal->getTime(status), status);
     }
 
-    if (numericLeapMonthFormatter != NULL) {
+    if (numericLeapMonthFormatter != nullptr) {
         delete numericLeapMonthFormatter;
     }
-    if (calClone != NULL) {
+    if (calClone != nullptr) {
         delete calClone;
     }
 
@@ -2838,7 +2838,7 @@ UBool SimpleDateFormat::matchLiterals(const UnicodeString &pattern,
     if (p <= 0) {
         // no match. Pretend it matched a run of whitespace
         // and ignorables in the text.
-        const  UnicodeSet *ignorables = NULL;
+        const  UnicodeSet *ignorables = nullptr;
         UDateFormatField patternCharIndex = DateFormatSymbols::getPatternCharIndex(pattern.charAt(i));
         if (patternCharIndex != UDAT_FIELD_COUNT) {
             ignorables = SimpleDateFormatStaticSets::getIgnorables(patternCharIndex);
@@ -2847,7 +2847,7 @@ UBool SimpleDateFormat::matchLiterals(const UnicodeString &pattern,
         for (t = textOffset; t < text.length(); t += 1) {
             UChar ch = text.charAt(t);
 
-            if (ignorables == NULL || !ignorables->contains(ch)) {
+            if (ignorables == nullptr || !ignorables->contains(ch)) {
                 break;
             }
         }
@@ -2935,7 +2935,7 @@ int32_t SimpleDateFormat::matchString(const UnicodeString& text,
             bestMatchLength = matchLen;
         }
 
-        if (monthPattern != NULL) {
+        if (monthPattern != nullptr) {
             UErrorCode status = U_ZERO_ERROR;
             UnicodeString leapMonthName;
             SimpleFormatter(*monthPattern, 1, 1, status).format(data[i], leapMonthName, status);
@@ -2960,7 +2960,7 @@ int32_t SimpleDateFormat::matchString(const UnicodeString& text,
                 }
                 cal.set(field, bestMatch);
             }
-            if (monthPattern != NULL) {
+            if (monthPattern != nullptr) {
                 cal.set(UCAL_IS_LEAP_MONTH, isLeapMonth);
             }
         }
@@ -3032,13 +3032,13 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
     }
 
     currentNumberFormat = getNumberFormatByIndex(patternCharIndex);
-    if (currentNumberFormat == NULL) {
+    if (currentNumberFormat == nullptr) {
         return -start;
     }
     UCalendarDateFields field = fgPatternIndexToCalendarField[patternCharIndex]; // UCAL_FIELD_COUNT if irrelevant
     UnicodeString hebr("hebr", 4, US_INV);
 
-    if (numericLeapMonthFormatter != NULL) {
+    if (numericLeapMonthFormatter != nullptr) {
         numericLeapMonthFormatter->setFormats((const Format **)&currentNumberFormat, 1);
     }
     UBool isChineseCalendar = (uprv_strcmp(cal.getType(),"chinese") == 0 || uprv_strcmp(cal.getType(),"dangi") == 0);
@@ -3083,10 +3083,10 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
         const UnicodeString* src;
 
         UBool parsedNumericLeapMonth = false;
-        if (numericLeapMonthFormatter != NULL && (patternCharIndex == UDAT_MONTH_FIELD || patternCharIndex == UDAT_STANDALONE_MONTH_FIELD)) {
+        if (numericLeapMonthFormatter != nullptr && (patternCharIndex == UDAT_MONTH_FIELD || patternCharIndex == UDAT_STANDALONE_MONTH_FIELD)) {
             int32_t argCount;
             Formattable * args = numericLeapMonthFormatter->parse(text, pos, argCount);
-            if (args != NULL && argCount == 1 && pos.getIndex() > parseStart && args[0].isNumeric()) {
+            if (args != nullptr && argCount == 1 && pos.getIndex() > parseStart && args[0].isNumeric()) {
                 parsedNumericLeapMonth = true;
                 number.setLong(args[0].getLong());
                 cal.set(UCAL_IS_LEAP_MONTH, 1);
@@ -3181,11 +3181,11 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
             return pos.getIndex();
         }
         if (count == 5) {
-            ps = matchString(text, start, UCAL_ERA, fSymbols->fNarrowEras, fSymbols->fNarrowErasCount, NULL, cal);
+            ps = matchString(text, start, UCAL_ERA, fSymbols->fNarrowEras, fSymbols->fNarrowErasCount, nullptr, cal);
         } else if (count == 4) {
-            ps = matchString(text, start, UCAL_ERA, fSymbols->fEraNames, fSymbols->fEraNamesCount, NULL, cal);
+            ps = matchString(text, start, UCAL_ERA, fSymbols->fEraNames, fSymbols->fEraNamesCount, nullptr, cal);
         } else {
-            ps = matchString(text, start, UCAL_ERA, fSymbols->fEras, fSymbols->fErasCount, NULL, cal);
+            ps = matchString(text, start, UCAL_ERA, fSymbols->fEras, fSymbols->fErasCount, nullptr, cal);
         }
 
         // check return position, if it equals -start, then matchString error
@@ -3259,8 +3259,8 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
         return pos.getIndex();
 
     case UDAT_YEAR_NAME_FIELD:
-        if (fSymbols->fShortYearNames != NULL) {
-            int32_t newStart = matchString(text, start, UCAL_YEAR, fSymbols->fShortYearNames, fSymbols->fShortYearNamesCount, NULL, cal);
+        if (fSymbols->fShortYearNames != nullptr) {
+            int32_t newStart = matchString(text, start, UCAL_YEAR, fSymbols->fShortYearNames, fSymbols->fShortYearNamesCount, nullptr, cal);
             if (newStart > 0) {
                 return newStart;
             }
@@ -3301,9 +3301,9 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
             // count >= 3 // i.e., MMM/MMMM, LLL/LLLL
             // Want to be able to parse both short and long forms.
             // Try count == 4 first:
-            UnicodeString * wideMonthPat = NULL;
-            UnicodeString * shortMonthPat = NULL;
-            if (fSymbols->fLeapMonthPatterns != NULL && fSymbols->fLeapMonthPatternsCount >= DateFormatSymbols::kMonthPatternsCount) {
+            UnicodeString * wideMonthPat = nullptr;
+            UnicodeString * shortMonthPat = nullptr;
+            if (fSymbols->fLeapMonthPatterns != nullptr && fSymbols->fLeapMonthPatternsCount >= DateFormatSymbols::kMonthPatternsCount) {
                 if (patternCharIndex==UDAT_MONTH_FIELD) {
                     wideMonthPat = &fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternFormatWide];
                     shortMonthPat = &fSymbols->fLeapMonthPatterns[DateFormatSymbols::kLeapMonthPatternFormatAbbrev];
@@ -3403,25 +3403,25 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
             int32_t newStart = 0;
             if(getBooleanAttribute(UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH, status) || count == 4) {
                 if ((newStart = matchString(text, start, UCAL_DAY_OF_WEEK,
-                                          fSymbols->fWeekdays, fSymbols->fWeekdaysCount, NULL, cal)) > 0)
+                                          fSymbols->fWeekdays, fSymbols->fWeekdaysCount, nullptr, cal)) > 0)
                     return newStart;
             }
             // EEEE wide failed, now try EEE abbreviated
             if(getBooleanAttribute(UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH, status) || count == 3) {
                 if ((newStart = matchString(text, start, UCAL_DAY_OF_WEEK,
-                                       fSymbols->fShortWeekdays, fSymbols->fShortWeekdaysCount, NULL, cal)) > 0)
+                                       fSymbols->fShortWeekdays, fSymbols->fShortWeekdaysCount, nullptr, cal)) > 0)
                     return newStart;
             }
             // EEE abbreviated failed, now try EEEEEE short
             if(getBooleanAttribute(UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH, status) || count == 6) {
                 if ((newStart = matchString(text, start, UCAL_DAY_OF_WEEK,
-                                       fSymbols->fShorterWeekdays, fSymbols->fShorterWeekdaysCount, NULL, cal)) > 0)
+                                       fSymbols->fShorterWeekdays, fSymbols->fShorterWeekdaysCount, nullptr, cal)) > 0)
                     return newStart;
             }
             // EEEEEE short failed, now try EEEEE narrow
             if(getBooleanAttribute(UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH, status) || count == 5) {
                 if ((newStart = matchString(text, start, UCAL_DAY_OF_WEEK,
-                                       fSymbols->fNarrowWeekdays, fSymbols->fNarrowWeekdaysCount, NULL, cal)) > 0)
+                                       fSymbols->fNarrowWeekdays, fSymbols->fNarrowWeekdaysCount, nullptr, cal)) > 0)
                     return newStart;
             }
             if (!getBooleanAttribute(UDAT_PARSE_ALLOW_NUMERIC, status) || patternCharIndex == UDAT_DAY_OF_WEEK_FIELD)
@@ -3443,17 +3443,17 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
             int32_t newStart = 0;
             if(getBooleanAttribute(UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH, status) || count == 4) {
                 if ((newStart = matchString(text, start, UCAL_DAY_OF_WEEK,
-                                      fSymbols->fStandaloneWeekdays, fSymbols->fStandaloneWeekdaysCount, NULL, cal)) > 0)
+                                      fSymbols->fStandaloneWeekdays, fSymbols->fStandaloneWeekdaysCount, nullptr, cal)) > 0)
                     return newStart;
             }
             if(getBooleanAttribute(UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH, status) || count == 3) {
                 if ((newStart = matchString(text, start, UCAL_DAY_OF_WEEK,
-                                          fSymbols->fStandaloneShortWeekdays, fSymbols->fStandaloneShortWeekdaysCount, NULL, cal)) > 0)
+                                          fSymbols->fStandaloneShortWeekdays, fSymbols->fStandaloneShortWeekdaysCount, nullptr, cal)) > 0)
                     return newStart;
             }
             if(getBooleanAttribute(UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH, status) || count == 6) {
                 if ((newStart = matchString(text, start, UCAL_DAY_OF_WEEK,
-                                          fSymbols->fStandaloneShorterWeekdays, fSymbols->fStandaloneShorterWeekdaysCount, NULL, cal)) > 0)
+                                          fSymbols->fStandaloneShorterWeekdays, fSymbols->fStandaloneShorterWeekdaysCount, nullptr, cal)) > 0)
                     return newStart;
             }
             if (!getBooleanAttribute(UDAT_PARSE_ALLOW_NUMERIC, status))
@@ -3468,13 +3468,13 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
             int32_t newStart = 0;
             // try wide/abbrev
             if( getBooleanAttribute(UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH, status) || count < 5 ) {
-                if ((newStart = matchString(text, start, UCAL_AM_PM, fSymbols->fAmPms, fSymbols->fAmPmsCount, NULL, cal)) > 0) {
+                if ((newStart = matchString(text, start, UCAL_AM_PM, fSymbols->fAmPms, fSymbols->fAmPmsCount, nullptr, cal)) > 0) {
                     return newStart;
                 }
             }
             // try narrow
             if( getBooleanAttribute(UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH, status) || count >= 5 ) {
-                if ((newStart = matchString(text, start, UCAL_AM_PM, fSymbols->fNarrowAmPms, fSymbols->fNarrowAmPmsCount, NULL, cal)) > 0) {
+                if ((newStart = matchString(text, start, UCAL_AM_PM, fSymbols->fNarrowAmPms, fSymbols->fNarrowAmPmsCount, nullptr, cal)) > 0) {
                     return newStart;
                 }
             }
@@ -3573,7 +3573,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
             const TimeZoneFormat *tzfmt = tzFormat(status);
             if (U_SUCCESS(status)) {
                 TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
-                if (tz != NULL) {
+                if (tz != nullptr) {
                     cal.adoptTimeZone(tz);
                     return pos.getIndex();
                 }
@@ -3588,7 +3588,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
             const TimeZoneFormat *tzfmt = tzFormat(status);
             if (U_SUCCESS(status)) {
                 TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
-                if (tz != NULL) {
+                if (tz != nullptr) {
                     cal.adoptTimeZone(tz);
                     return pos.getIndex();
                 }
@@ -3601,7 +3601,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
             const TimeZoneFormat *tzfmt = tzFormat(status);
             if (U_SUCCESS(status)) {
                 TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
-                if (tz != NULL) {
+                if (tz != nullptr) {
                     cal.adoptTimeZone(tz);
                     return pos.getIndex();
                 }
@@ -3628,7 +3628,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
             const TimeZoneFormat *tzfmt = tzFormat(status);
             if (U_SUCCESS(status)) {
                 TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
-                if (tz != NULL) {
+                if (tz != nullptr) {
                     cal.adoptTimeZone(tz);
                     return pos.getIndex();
                 }
@@ -3641,7 +3641,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
             const TimeZoneFormat *tzfmt = tzFormat(status);
             if (U_SUCCESS(status)) {
                 TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
-                if (tz != NULL) {
+                if (tz != nullptr) {
                     cal.adoptTimeZone(tz);
                     return pos.getIndex();
                 }
@@ -3671,7 +3671,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
             const TimeZoneFormat *tzfmt = tzFormat(status);
             if (U_SUCCESS(status)) {
                 TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
-                if (tz != NULL) {
+                if (tz != nullptr) {
                     cal.adoptTimeZone(tz);
                     return pos.getIndex();
                 }
@@ -3701,7 +3701,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
             const TimeZoneFormat *tzfmt = tzFormat(status);
             if (U_SUCCESS(status)) {
                 TimeZone *tz = tzfmt->parse(style, text, pos, tzTimeType);
-                if (tz != NULL) {
+                if (tz != nullptr) {
                     cal.adoptTimeZone(tz);
                     return pos.getIndex();
                 }
@@ -3730,12 +3730,12 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
                 data[count_sep++].setTo(alt_sep);
             }
 
-            return matchString(text, start, UCAL_FIELD_COUNT /* => nothing to set */, data, count_sep, NULL, cal);
+            return matchString(text, start, UCAL_FIELD_COUNT /* => nothing to set */, data, count_sep, nullptr, cal);
         }
 
     case UDAT_AM_PM_MIDNIGHT_NOON_FIELD:
     {
-        U_ASSERT(dayPeriod != NULL);
+        U_ASSERT(dayPeriod != nullptr);
         int32_t ampmStart = subParse(text, start, 0x61, count,
                            obeyCount, allowNegative, ambiguousYear, saveHebrewMonth, cal,
                            patLoc, numericLeapMonthFormatter, tzTimeType);
@@ -3772,7 +3772,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
 
     case UDAT_FLEXIBLE_DAY_PERIOD_FIELD:
     {
-        U_ASSERT(dayPeriod != NULL);
+        U_ASSERT(dayPeriod != nullptr);
         int32_t newStart = 0;
 
         if (getBooleanAttribute(UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH, status) || count == 3) {
@@ -4030,18 +4030,18 @@ SimpleDateFormat::applyPattern(const UnicodeString& pattern)
             // use procedure from adoptNumberFormat to clear overrides
             if (fSharedNumberFormatters) {
                 freeSharedNumberFormatters(fSharedNumberFormatters);
-                fSharedNumberFormatters = NULL;
+                fSharedNumberFormatters = nullptr;
             }
             fDateOverride.setToBogus(); // record status
         } else if (fDateOverride.isBogus() && fHasHanYearChar) {
             // No current override (=> no Gannen numbering) but new pattern needs it;
             // use procedures from initNUmberFormatters / adoptNumberFormat
             umtx_lock(&LOCK);
-            if (fSharedNumberFormatters == NULL) {
+            if (fSharedNumberFormatters == nullptr) {
                 fSharedNumberFormatters = allocSharedNumberFormatters();
             }
             umtx_unlock(&LOCK);
-            if (fSharedNumberFormatters != NULL) {
+            if (fSharedNumberFormatters != nullptr) {
                 Locale ovrLoc(fLocale.getLanguage(),fLocale.getCountry(),fLocale.getVariant(),"numbers=jpanyear");
                 UErrorCode status = U_ZERO_ERROR;
                 const SharedNumberFormat *snf = createSharedNumberFormat(ovrLoc, status);
@@ -4154,13 +4154,13 @@ SimpleDateFormat::setContext(UDisplayContext value, UErrorCode& status)
     DateFormat::setContext(value, status);
 #if !UCONFIG_NO_BREAK_ITERATION
     if (U_SUCCESS(status)) {
-        if ( fCapitalizationBrkIter == NULL && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
+        if ( fCapitalizationBrkIter == nullptr && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
                 value==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU || value==UDISPCTX_CAPITALIZATION_FOR_STANDALONE) ) {
             status = U_ZERO_ERROR;
             fCapitalizationBrkIter = BreakIterator::createSentenceInstance(fLocale, status);
             if (U_FAILURE(status)) {
                 delete fCapitalizationBrkIter;
-                fCapitalizationBrkIter = NULL;
+                fCapitalizationBrkIter = nullptr;
             }
         }
     }
@@ -4248,7 +4248,7 @@ SimpleDateFormat::checkIntSuffix(const UnicodeString& text, int32_t start,
 
     // get the suffix
     DecimalFormat* decfmt = dynamic_cast<DecimalFormat*>(fNumberFormat);
-    if (decfmt != NULL) {
+    if (decfmt != nullptr) {
         if (isNegative) {
             suf = decfmt->getNegativeSuffix(suf);
         }
index bbf6e9eddf9ca3bcd96f05e5ec0f6cb7b62f7f5c..331321bbd6a4e1fc19147ce5edaa836d9daad054 100644 (file)
 
 U_NAMESPACE_BEGIN
 
-SimpleDateFormatStaticSets *gStaticSets = NULL;
+SimpleDateFormatStaticSets *gStaticSets = nullptr;
 UInitOnce gSimpleDateFormatStaticSetsInitOnce {};
 
 SimpleDateFormatStaticSets::SimpleDateFormatStaticSets(UErrorCode &status)
-: fDateIgnorables(NULL),
-  fTimeIgnorables(NULL),
-  fOtherIgnorables(NULL)
+: fDateIgnorables(nullptr),
+  fTimeIgnorables(nullptr),
+  fOtherIgnorables(nullptr)
 {
     fDateIgnorables  = new UnicodeSet(UNICODE_STRING("[-,./[:whitespace:]]", 20), status);
     fTimeIgnorables  = new UnicodeSet(UNICODE_STRING("[-.:[:whitespace:]]", 19),  status);
     fOtherIgnorables = new UnicodeSet(UNICODE_STRING("[:whitespace:]", 14),       status);
 
     // Check for null pointers
-    if (fDateIgnorables == NULL || fTimeIgnorables == NULL || fOtherIgnorables == NULL) {
+    if (fDateIgnorables == nullptr || fTimeIgnorables == nullptr || fOtherIgnorables == nullptr) {
         goto ExitConstrDeleteAll;
     }
 
@@ -54,18 +54,18 @@ SimpleDateFormatStaticSets::SimpleDateFormatStaticSets(UErrorCode &status)
     return; // If we reached this point, everything is fine so just exit
 
 ExitConstrDeleteAll: // Remove all sets and return error
-    delete fDateIgnorables;  fDateIgnorables = NULL;
-    delete fTimeIgnorables;  fTimeIgnorables = NULL;
-    delete fOtherIgnorables; fOtherIgnorables = NULL;
+    delete fDateIgnorables;  fDateIgnorables = nullptr;
+    delete fTimeIgnorables;  fTimeIgnorables = nullptr;
+    delete fOtherIgnorables; fOtherIgnorables = nullptr;
 
     status = U_MEMORY_ALLOCATION_ERROR;
 }
 
 
 SimpleDateFormatStaticSets::~SimpleDateFormatStaticSets() {
-    delete fDateIgnorables;  fDateIgnorables = NULL;
-    delete fTimeIgnorables;  fTimeIgnorables = NULL;
-    delete fOtherIgnorables; fOtherIgnorables = NULL;
+    delete fDateIgnorables;  fDateIgnorables = nullptr;
+    delete fTimeIgnorables;  fTimeIgnorables = nullptr;
+    delete fOtherIgnorables; fOtherIgnorables = nullptr;
 }
 
 
@@ -79,7 +79,7 @@ UBool
 SimpleDateFormatStaticSets::cleanup(void)
 {
     delete gStaticSets;
-    gStaticSets = NULL;
+    gStaticSets = nullptr;
     gSimpleDateFormatStaticSetsInitOnce.reset();
     return true;
 }
@@ -93,9 +93,9 @@ smpdtfmt_cleanup(void)
 
 static void U_CALLCONV smpdtfmt_initSets(UErrorCode &status) {
     ucln_i18n_registerCleanup(UCLN_I18N_SMPDTFMT, smpdtfmt_cleanup);
-    U_ASSERT(gStaticSets == NULL);
+    U_ASSERT(gStaticSets == nullptr);
     gStaticSets = new SimpleDateFormatStaticSets(status);
-    if (gStaticSets == NULL) {
+    if (gStaticSets == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -108,7 +108,7 @@ UnicodeSet *SimpleDateFormatStaticSets::getIgnorables(UDateFormatField fieldInde
     UErrorCode status = U_ZERO_ERROR;
     umtx_initOnce(gSimpleDateFormatStaticSetsInitOnce, &smpdtfmt_initSets, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     
     switch (fieldIndex) {
index 441d15d42635bdb4ebf5ffe5a30fe92617e4c542..1fd066cc203ffd9d21613b663aea60429e93344a 100644 (file)
@@ -61,8 +61,8 @@ CollationKey::CollationKey(const uint8_t* newValues, int32_t count)
     : UObject(), fFlagAndLength(count),
       fHashCode(kInvalidHashCode)
 {
-    if (count < 0 || (newValues == NULL && count != 0) ||
-            (count > getCapacity() && reallocate(count, 0) == NULL)) {
+    if (count < 0 || (newValues == nullptr && count != 0) ||
+            (count > getCapacity() && reallocate(count, 0) == nullptr)) {
         setToBogus();
         return;
     }
@@ -83,7 +83,7 @@ CollationKey::CollationKey(const CollationKey& other)
     }
 
     int32_t length = fFlagAndLength;
-    if (length > getCapacity() && reallocate(length, 0) == NULL) {
+    if (length > getCapacity() && reallocate(length, 0) == nullptr) {
         setToBogus();
         return;
     }
@@ -100,7 +100,7 @@ CollationKey::~CollationKey()
 
 uint8_t *CollationKey::reallocate(int32_t newCapacity, int32_t length) {
     uint8_t *newBytes = static_cast<uint8_t *>(uprv_malloc(newCapacity));
-    if(newBytes == NULL) { return NULL; }
+    if(newBytes == nullptr) { return nullptr; }
     if(length > 0) {
         uprv_memcpy(newBytes, getBytes(), length);
     }
@@ -156,7 +156,7 @@ CollationKey::operator=(const CollationKey& other)
         }
 
         int32_t length = other.getLength();
-        if (length > getCapacity() && reallocate(length, 0) == NULL) {
+        if (length > getCapacity() && reallocate(length, 0) == nullptr) {
             return setToBogus();
         }
         if (length > 0) {
@@ -227,7 +227,7 @@ CollationKey::toByteArray(int32_t& count) const
 {
     uint8_t *result = (uint8_t*) uprv_malloc( sizeof(uint8_t) * fCount );
 
-    if (result == NULL)
+    if (result == nullptr)
     {
         count = 0;
     }
@@ -247,7 +247,7 @@ static int32_t
 computeHashCode(const uint8_t *key, int32_t  length) {
     const char *s = reinterpret_cast<const char *>(key);
     int32_t hash;
-    if (s == NULL || length == 0) {
+    if (s == nullptr || length == 0) {
         hash = kEmptyHashCode;
     } else {
         hash = ustr_hashCharsN(s, length);
index 93febc708d51e7151127587266d8730cdf3e1178..91973ace1fdc8a17361f9de34e6e6f3020d17900 100644 (file)
@@ -206,7 +206,7 @@ void StringMatcher::addMatchSetTo(UnicodeSet& toUnionTo) const {
     for (int32_t i=0; i<pattern.length(); i+=U16_LENGTH(ch)) {
         ch = pattern.char32At(i);
         const UnicodeMatcher* matcher = data->lookupMatcher(ch);
-        if (matcher == NULL) {
+        if (matcher == nullptr) {
             toUnionTo.add(ch);
         } else {
             matcher->addMatchSetTo(toUnionTo);
@@ -282,7 +282,7 @@ void StringMatcher::setData(const TransliterationRuleData* d) {
     while (i<pattern.length()) {
         UChar32 c = pattern.char32At(i);
         UnicodeFunctor* f = data->lookup(c);
-        if (f != NULL) {
+        if (f != nullptr) {
             f->setData(data);
         }
         i += U16_LENGTH(c);
index 23dab55430ba947cc77a2e53af2178c712cba23e..82a0c69f57a6c6c01f8885d154f8f475d59458e6 100644 (file)
@@ -162,7 +162,7 @@ int32_t StringReplacer::replace(Replaceable& text,
             }
             UChar32 c = output.char32At(oOutput);
             UnicodeReplacer* r = data->lookupReplacer(c);
-            if (r == NULL) {
+            if (r == nullptr) {
                 // Accumulate straight (non-segment) text.
                 buf.append(c);
             } else {
@@ -261,7 +261,7 @@ UnicodeString& StringReplacer::toReplacerPattern(UnicodeString& rule,
         UChar c = output.charAt(i); // Ok to use 16-bits here
 
         UnicodeReplacer* r = data->lookupReplacer(c);
-        if (r == NULL) {
+        if (r == nullptr) {
             ICU_Utility::appendToRule(rule, c, false, escapeUnprintable, quoteBuf);
         } else {
             UnicodeString buf;
@@ -298,7 +298,7 @@ void StringReplacer::addReplacementSetTo(UnicodeSet& toUnionTo) const {
     for (int32_t i=0; i<output.length(); i+=U16_LENGTH(ch)) {
     ch = output.char32At(i);
     UnicodeReplacer* r = data->lookupReplacer(ch);
-    if (r == NULL) {
+    if (r == nullptr) {
         toUnionTo.add(ch);
     } else {
         r->addReplacementSetTo(toUnionTo);
@@ -315,7 +315,7 @@ void StringReplacer::setData(const TransliterationRuleData* d) {
     while (i<output.length()) {
         UChar32 c = output.char32At(i);
         UnicodeFunctor* f = data->lookup(c);
-        if (f != NULL) {
+        if (f != nullptr) {
             f->setData(data);
         }
         i += U16_LENGTH(c);
index 1bade8fbd1108b033924b4ac93148ad97fb23d0e..da59150d9c9dc7f7c820df287fe81e0ed7b222f2 100644 (file)
@@ -32,7 +32,7 @@ StringSearch::StringSearch(const UnicodeString &pattern,
                            m_pattern_(pattern)
 {
     if (U_FAILURE(status)) {
-        m_strsrch_ = NULL;
+        m_strsrch_ = nullptr;
         return;
     }
 
@@ -41,7 +41,7 @@ StringSearch::StringSearch(const UnicodeString &pattern,
                               locale.getName(), (UBreakIterator *)breakiter,
                               &status);
     uprv_free(m_search_);
-    m_search_ = NULL;
+    m_search_ = nullptr;
 
     if (U_SUCCESS(status)) {
         // m_search_ has been created by the base SearchIterator class
@@ -58,12 +58,12 @@ StringSearch::StringSearch(const UnicodeString     &pattern,
                            m_pattern_(pattern)
 {
     if (U_FAILURE(status)) {
-        m_strsrch_ = NULL;
+        m_strsrch_ = nullptr;
         return;
     }
-    if (coll == NULL) {
+    if (coll == nullptr) {
         status     = U_ILLEGAL_ARGUMENT_ERROR;
-        m_strsrch_ = NULL;
+        m_strsrch_ = nullptr;
         return;
     }
     m_strsrch_ = usearch_openFromCollator(m_pattern_.getBuffer(),
@@ -73,7 +73,7 @@ StringSearch::StringSearch(const UnicodeString     &pattern,
                                           (UBreakIterator *)breakiter,
                                           &status);
     uprv_free(m_search_);
-    m_search_ = NULL;
+    m_search_ = nullptr;
 
     if (U_SUCCESS(status)) {
         // m_search_ has been created by the base SearchIterator class
@@ -90,7 +90,7 @@ StringSearch::StringSearch(const UnicodeString     &pattern,
                            m_pattern_(pattern)
 {
     if (U_FAILURE(status)) {
-        m_strsrch_ = NULL;
+        m_strsrch_ = nullptr;
         return;
     }
     m_strsrch_ = usearch_open(m_pattern_.getBuffer(), m_pattern_.length(),
@@ -98,7 +98,7 @@ StringSearch::StringSearch(const UnicodeString     &pattern,
                               locale.getName(), (UBreakIterator *)breakiter,
                               &status);
     uprv_free(m_search_);
-    m_search_ = NULL;
+    m_search_ = nullptr;
 
     if (U_SUCCESS(status)) {
         // m_search_ has been created by the base SearchIterator class
@@ -115,12 +115,12 @@ StringSearch::StringSearch(const UnicodeString     &pattern,
                            m_pattern_(pattern)
 {
     if (U_FAILURE(status)) {
-        m_strsrch_ = NULL;
+        m_strsrch_ = nullptr;
         return;
     }
-    if (coll == NULL) {
+    if (coll == nullptr) {
         status     = U_ILLEGAL_ARGUMENT_ERROR;
-        m_strsrch_ = NULL;
+        m_strsrch_ = nullptr;
         return;
     }
     m_strsrch_ = usearch_openFromCollator(m_pattern_.getBuffer(),
@@ -130,7 +130,7 @@ StringSearch::StringSearch(const UnicodeString     &pattern,
                                           (UBreakIterator *)breakiter,
                                           &status);
     uprv_free(m_search_);
-    m_search_ = NULL;
+    m_search_ = nullptr;
 
     if (U_SUCCESS(status)) {
         // m_search_ has been created by the base SearchIterator class
@@ -146,11 +146,11 @@ StringSearch::StringSearch(const StringSearch &that) :
 
     // Free m_search_ from the superclass
     uprv_free(m_search_);
-    m_search_ = NULL;
+    m_search_ = nullptr;
 
-    if (that.m_strsrch_ == NULL) {
+    if (that.m_strsrch_ == nullptr) {
         // This was not a good copy
-        m_strsrch_ = NULL;
+        m_strsrch_ = nullptr;
     }
     else {
         // Make a deep copy
@@ -170,9 +170,9 @@ StringSearch::StringSearch(const StringSearch &that) :
 
 StringSearch::~StringSearch()
 {
-    if (m_strsrch_ != NULL) {
+    if (m_strsrch_ != nullptr) {
         usearch_close(m_strsrch_);
-        m_search_ = NULL;
+        m_search_ = nullptr;
     }
 }
 
@@ -196,9 +196,9 @@ StringSearch & StringSearch::operator=(const StringSearch &that)
                                               m_text_.getBuffer(),
                                               m_text_.length(),
                                               that.m_strsrch_->collator,
-                                              NULL, &status);
+                                              nullptr, &status);
         // Check null pointer
-        if (m_strsrch_ != NULL) {
+        if (m_strsrch_ != nullptr) {
             m_search_ = m_strsrch_->search;
         }
     }
@@ -289,7 +289,7 @@ StringSearch * StringSearch::safeClone() const
                                             getCollator(),
                                             m_breakiterator_,
                                             status);
-    /* test for NULL */
+    /* test for nullptr */
     if (result == 0) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return 0;
@@ -298,7 +298,7 @@ StringSearch * StringSearch::safeClone() const
     result->setMatchStart(m_strsrch_->search->matchedIndex);
     result->setMatchLength(m_strsrch_->search->matchedLength);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     return result;
 }
@@ -355,7 +355,7 @@ int32_t StringSearch::handleNext(int32_t position, UErrorCode &status)
                 if (U_FAILURE(status)) {
                     return USEARCH_DONE;
                 }
-                if (m_breakiterator_ == NULL
+                if (m_breakiterator_ == nullptr
 #if !UCONFIG_NO_BREAK_ITERATION
                     ||
                     m_search_->matchedIndex == USEARCH_DONE ||
@@ -443,7 +443,7 @@ int32_t StringSearch::handlePrev(int32_t position, UErrorCode &status)
                 if (U_FAILURE(status)) {
                     return USEARCH_DONE;
                 }
-                if (m_breakiterator_ == NULL
+                if (m_breakiterator_ == nullptr
 #if !UCONFIG_NO_BREAK_ITERATION
                     ||
                     m_search_->matchedIndex == USEARCH_DONE ||
index 00b44bfe9027fc41ff257d913ee68a10a2077a4c..684beba36a2440bc5735d53415fa3196cc41774d 100644 (file)
@@ -112,7 +112,7 @@ static const UChar         UNKNOWN_ZONE_ID[] = {0x45, 0x74, 0x63, 0x2F, 0x55, 0x
 static const int32_t       GMT_ID_LENGTH = 3;
 static const int32_t       UNKNOWN_ZONE_ID_LENGTH = 11;
 
-static icu::TimeZone* DEFAULT_ZONE = NULL;
+static icu::TimeZone* DEFAULT_ZONE = nullptr;
 static icu::UInitOnce gDefaultZoneInitOnce {};
 
 alignas(icu::SimpleTimeZone)
@@ -127,9 +127,9 @@ static UBool gStaticZonesInitialized = false; // Whether the static zones are in
 static char TZDATA_VERSION[16];
 static icu::UInitOnce gTZDataVersionInitOnce {};
 
-static int32_t* MAP_SYSTEM_ZONES = NULL;
-static int32_t* MAP_CANONICAL_SYSTEM_ZONES = NULL;
-static int32_t* MAP_CANONICAL_SYSTEM_LOCATION_ZONES = NULL;
+static int32_t* MAP_SYSTEM_ZONES = nullptr;
+static int32_t* MAP_CANONICAL_SYSTEM_ZONES = nullptr;
+static int32_t* MAP_CANONICAL_SYSTEM_LOCATION_ZONES = nullptr;
 
 static int32_t LEN_SYSTEM_ZONES = 0;
 static int32_t LEN_CANONICAL_SYSTEM_ZONES = 0;
@@ -144,7 +144,7 @@ static UBool U_CALLCONV timeZone_cleanup(void)
 {
     U_NAMESPACE_USE
     delete DEFAULT_ZONE;
-    DEFAULT_ZONE = NULL;
+    DEFAULT_ZONE = nullptr;
     gDefaultZoneInitOnce.reset();
 
     if (gStaticZonesInitialized) {
@@ -223,12 +223,12 @@ static int32_t findInStringArray(UResourceBundle* array, const UnicodeString& id
  * Fetch a specific zone by name.  Replaces the getByKey call.
  * @param top Top timezone resource
  * @param id Time zone ID
- * @param oldbundle Bundle for reuse (or NULL).   see 'ures_open()'
+ * @param oldbundle Bundle for reuse (or nullptr).   see 'ures_open()'
  * @return the zone's bundle if found, or undefined if error.  Reuses oldbundle.
  */
 static UResourceBundle* getZoneByName(const UResourceBundle* top, const UnicodeString& id, UResourceBundle *oldbundle, UErrorCode& status) {
     // load the Rules object
-    UResourceBundle *tmp = ures_getByKey(top, kNAMES, NULL, &status);
+    UResourceBundle *tmp = ures_getByKey(top, kNAMES, nullptr, &status);
 
     // search for the string
     int32_t idx = findInStringArray(tmp, id, status);
@@ -237,7 +237,7 @@ static UResourceBundle* getZoneByName(const UResourceBundle* top, const UnicodeS
         // not found
         status = U_MISSING_RESOURCE_ERROR;
         //ures_close(oldbundle);
-        //oldbundle = NULL;
+        //oldbundle = nullptr;
     } else {
         U_DEBUG_TZ_MSG(("gzbn: oldbundle= size %d, type %d, %s\n", ures_getSize(tmp), ures_getType(tmp), u_errorName(status)));
         tmp = ures_getByKey(top, kZONES, tmp, &status); // get Zones object from top
@@ -248,7 +248,7 @@ static UResourceBundle* getZoneByName(const UResourceBundle* top, const UnicodeS
     ures_close(tmp);
     if(U_FAILURE(status)) {
         //ures_close(oldbundle);
-        return NULL;
+        return nullptr;
     } else {
         return oldbundle;
     }
@@ -291,7 +291,7 @@ static UResourceBundle* openOlsonResource(const UnicodeString& id,
     if (ures_getType(&res) == URES_INT) {
         int32_t deref = ures_getInt(&res, &ec) + 0;
         U_DEBUG_TZ_MSG(("getInt: %s - type is %d\n", u_errorName(ec), ures_getType(&res)));
-        UResourceBundle *ares = ures_getByKey(top, kZONES, NULL, &ec); // dereference Zones section
+        UResourceBundle *ares = ures_getByKey(top, kZONES, nullptr, &ec); // dereference Zones section
         ures_getByIndex(ares, deref, &res, &ec);
         ures_close(ares);
         U_DEBUG_TZ_MSG(("alias to #%d (%s) - %s\n", deref, "??", u_errorName(ec)));
@@ -389,7 +389,7 @@ namespace {
 TimeZone*
 createSystemTimeZone(const UnicodeString& id, UErrorCode& ec) {
     if (U_FAILURE(ec)) {
-        return NULL;
+        return nullptr;
     }
     TimeZone* z = 0;
     StackUResourceBundle res;
@@ -398,7 +398,7 @@ createSystemTimeZone(const UnicodeString& id, UErrorCode& ec) {
     U_DEBUG_TZ_MSG(("post-err=%s\n", u_errorName(ec)));
     if (U_SUCCESS(ec)) {
         z = new OlsonTimeZone(top, res.getAlias(), id, ec);
-        if (z == NULL) {
+        if (z == nullptr) {
             ec = U_MEMORY_ALLOCATION_ERROR;
             U_DEBUG_TZ_MSG(("cstz: olson time zone failed to initialize - err %s\n", u_errorName(ec)));
         }
@@ -407,7 +407,7 @@ createSystemTimeZone(const UnicodeString& id, UErrorCode& ec) {
     if (U_FAILURE(ec)) {
         U_DEBUG_TZ_MSG(("cstz: failed to create, err %s\n", u_errorName(ec)));
         delete z;
-        z = NULL;
+        z = nullptr;
     }
     return z;
 }
@@ -433,16 +433,16 @@ TimeZone::createTimeZone(const UnicodeString& ID)
      * all else fails, we return GMT, which is probably not what the
      * user wants, but at least is a functioning TimeZone object.
      *
-     * We cannot return NULL, because that would break compatibility
+     * We cannot return nullptr, because that would break compatibility
      * with the JDK.
      */
     TimeZone* result = createSystemTimeZone(ID);
 
-    if (result == NULL) {
+    if (result == nullptr) {
         U_DEBUG_TZ_MSG(("failed to load system time zone with id - falling to custom"));
         result = createCustomTimeZone(ID);
     }
-    if (result == NULL) {
+    if (result == nullptr) {
         U_DEBUG_TZ_MSG(("failed to load time zone with id - falling to Etc/Unknown(GMT)"));
         const TimeZone& unknown = getUnknown();
         // Unknown zone uses statically allocated memory, so creation of it can never fail due to OOM.
@@ -477,7 +477,7 @@ TimeZone::detectHostTimeZone()
     // Invert sign because UNIX semantics are backwards
     rawOffset = uprv_timezone() * -U_MILLIS_PER_SECOND;
 
-    TimeZone* hostZone = NULL;
+    TimeZone* hostZone = nullptr;
 
     UnicodeString hostStrID(hostID, -1, US_INV);
 
@@ -496,18 +496,18 @@ TimeZone::detectHostTimeZone()
 #endif
 
     int32_t hostIDLen = hostStrID.length();
-    if (hostZone != NULL && rawOffset != hostZone->getRawOffset()
+    if (hostZone != nullptr && rawOffset != hostZone->getRawOffset()
         && (3 <= hostIDLen && hostIDLen <= 4))
     {
         // Uh oh. This probably wasn't a good id.
         // It was probably an ambiguous abbreviation
         delete hostZone;
-        hostZone = NULL;
+        hostZone = nullptr;
     }
 
     // Construct a fixed standard zone with the host's ID
     // and raw offset.
-    if (hostZone == NULL && hostDetectionSucceeded) {
+    if (hostZone == nullptr && hostDetectionSucceeded) {
         hostZone = new SimpleTimeZone(rawOffset, hostStrID);
     }
 
@@ -516,7 +516,7 @@ TimeZone::detectHostTimeZone()
     // Note: This is extremely unlikely situation. If
     // new SimpleTimeZone(...) above fails, the following
     // code may also fail.
-    if (hostZone == NULL) {
+    if (hostZone == nullptr) {
         // Unknown zone uses static allocated memory, so it must always exist.
         // However, clone() allocates memory and can fail.
         hostZone = TimeZone::getUnknown().clone();
@@ -531,8 +531,8 @@ static UMutex gDefaultZoneMutex;
 
 /**
  * Initialize DEFAULT_ZONE from the system default time zone.  
- * Upon return, DEFAULT_ZONE will not be NULL, unless operator new()
- * returns NULL.
+ * Upon return, DEFAULT_ZONE will not be nullptr, unless operator new()
+ * returns nullptr.
  */
 static void U_CALLCONV initDefault()
 {
@@ -541,7 +541,7 @@ static void U_CALLCONV initDefault()
     Mutex lock(&gDefaultZoneMutex);
     // If setDefault() has already been called we can skip getting the
     // default zone information from the system.
-    if (DEFAULT_ZONE != NULL) {
+    if (DEFAULT_ZONE != nullptr) {
         return;
     }
     
@@ -560,7 +560,7 @@ static void U_CALLCONV initDefault()
 
     TimeZone *default_zone = TimeZone::detectHostTimeZone();
 
-    U_ASSERT(DEFAULT_ZONE == NULL);
+    U_ASSERT(DEFAULT_ZONE == nullptr);
 
     DEFAULT_ZONE = default_zone;
 }
@@ -573,7 +573,7 @@ TimeZone::createDefault()
     umtx_initOnce(gDefaultZoneInitOnce, initDefault);
     {
         Mutex lock(&gDefaultZoneMutex);
-        return (DEFAULT_ZONE != NULL) ? DEFAULT_ZONE->clone() : NULL;
+        return (DEFAULT_ZONE != nullptr) ? DEFAULT_ZONE->clone() : nullptr;
     }
 }
 
@@ -600,7 +600,7 @@ TimeZone::forLocaleOrDefault(const Locale& locale)
 void U_EXPORT2
 TimeZone::adoptDefault(TimeZone* zone)
 {
-    if (zone != NULL)
+    if (zone != nullptr)
     {
         {
             Mutex lock(&gDefaultZoneMutex);
@@ -630,7 +630,7 @@ static void U_CALLCONV initMap(USystemTimeZoneType type, UErrorCode& ec) {
     if (U_SUCCESS(ec)) {
         int32_t size = ures_getSize(res);
         int32_t *m = (int32_t *)uprv_malloc(size * sizeof(int32_t));
-        if (m == NULL) {
+        if (m == nullptr) {
             ec = U_MEMORY_ALLOCATION_ERROR;
         } else {
             int32_t numEntries = 0;
@@ -669,7 +669,7 @@ static void U_CALLCONV initMap(USystemTimeZoneType type, UErrorCode& ec) {
             if (U_SUCCESS(ec)) {
                 int32_t *tmp = m;
                 m = (int32_t *)uprv_realloc(tmp, numEntries * sizeof(int32_t));
-                if (m == NULL) {
+                if (m == nullptr) {
                     // realloc failed.. use the original one even it has unused
                     // area at the end
                     m = tmp;
@@ -677,17 +677,17 @@ static void U_CALLCONV initMap(USystemTimeZoneType type, UErrorCode& ec) {
 
                 switch(type) {
                 case UCAL_ZONE_TYPE_ANY:
-                    U_ASSERT(MAP_SYSTEM_ZONES == NULL);
+                    U_ASSERT(MAP_SYSTEM_ZONES == nullptr);
                     MAP_SYSTEM_ZONES = m;
                     LEN_SYSTEM_ZONES = numEntries;
                     break;
                 case UCAL_ZONE_TYPE_CANONICAL:
-                    U_ASSERT(MAP_CANONICAL_SYSTEM_ZONES == NULL);
+                    U_ASSERT(MAP_CANONICAL_SYSTEM_ZONES == nullptr);
                     MAP_CANONICAL_SYSTEM_ZONES = m;
                     LEN_CANONICAL_SYSTEM_ZONES = numEntries;
                     break;
                 case UCAL_ZONE_TYPE_CANONICAL_LOCATION:
-                    U_ASSERT(MAP_CANONICAL_SYSTEM_LOCATION_ZONES == NULL);
+                    U_ASSERT(MAP_CANONICAL_SYSTEM_LOCATION_ZONES == nullptr);
                     MAP_CANONICAL_SYSTEM_LOCATION_ZONES = m;
                     LEN_CANONICAL_SYSTEM_LOCATION_ZONES = numEntries;
                     break;
@@ -756,7 +756,7 @@ class TZEnumeration : public StringEnumeration {
 private:
 
     // Map into to zones.  Our results are zone[map[i]] for
-    // i=0..len-1, where zone[i] is the i-th Olson zone.  If map==NULL
+    // i=0..len-1, where zone[i] is the i-th Olson zone.  If map==nullptr
     // then our results are zone[i] for i=0..len-1.  Len will be zero
     // if the zone data could not be loaded.
     int32_t* map;
@@ -766,13 +766,13 @@ private:
 
     TZEnumeration(int32_t* mapData, int32_t mapLen, UBool adoptMapData) : pos(0) {
         map = mapData;
-        localMap = adoptMapData ? mapData : NULL;
+        localMap = adoptMapData ? mapData : nullptr;
         len = mapLen;
     }
 
     UBool getID(int32_t i, UErrorCode& ec) {
         int32_t idLen = 0;
-        const UChar* id = NULL;
+        const UChar* id = nullptr;
         UResourceBundle *top = ures_openDirect(0, kZONEINFO, &ec);
         top = ures_getByKey(top, kNAMES, top, &ec); // dereference Zones section
         id = ures_getStringByIndex(top, i, &idLen, &ec);
@@ -789,9 +789,9 @@ private:
     static int32_t* getMap(USystemTimeZoneType type, int32_t& len, UErrorCode& ec) {
         len = 0;
         if (U_FAILURE(ec)) {
-            return NULL;
+            return nullptr;
         }
-        int32_t* m = NULL;
+        int32_t* m = nullptr;
         switch (type) {
         case UCAL_ZONE_TYPE_ANY:
             umtx_initOnce(gSystemZonesInitOnce, &initMap, type, ec);
@@ -810,7 +810,7 @@ private:
             break;
         default:
             ec = U_ILLEGAL_ARGUMENT_ERROR;
-            m = NULL;
+            m = nullptr;
             len = 0;
             break;
         }
@@ -824,28 +824,28 @@ public:
 
     static TZEnumeration* create(USystemTimeZoneType type, const char* region, const int32_t* rawOffset, UErrorCode& ec) {
         if (U_FAILURE(ec)) {
-            return NULL;
+            return nullptr;
         }
 
         int32_t baseLen;
         int32_t *baseMap = getMap(type, baseLen, ec);
 
         if (U_FAILURE(ec)) {
-            return NULL;
+            return nullptr;
         }
 
         // If any additional conditions are available,
         // create instance local map filtered by the conditions.
 
-        int32_t *filteredMap = NULL;
+        int32_t *filteredMap = nullptr;
         int32_t numEntries = 0;
 
-        if (region != NULL || rawOffset != NULL) {
+        if (region != nullptr || rawOffset != nullptr) {
             int32_t filteredMapSize = DEFAULT_FILTERED_MAP_SIZE;
             filteredMap = (int32_t *)uprv_malloc(filteredMapSize * sizeof(int32_t));
-            if (filteredMap == NULL) {
+            if (filteredMap == nullptr) {
                 ec = U_MEMORY_ALLOCATION_ERROR;
-                return NULL;
+                return nullptr;
             }
 
             // Walk through the base map
@@ -857,7 +857,7 @@ public:
                 if (U_FAILURE(ec)) {
                     break;
                 }
-                if (region != NULL) {
+                if (region != nullptr) {
                     // Filter by region
                     char tzregion[4]; // max 3 letters + null term
                     TimeZone::getRegion(id, tzregion, sizeof(tzregion), ec);
@@ -869,7 +869,7 @@ public:
                         continue;
                     }
                 }
-                if (rawOffset != NULL) {
+                if (rawOffset != nullptr) {
                     // Filter by raw offset
                     // Note: This is VERY inefficient
                     TimeZone *z = createSystemTimeZone(id, ec);
@@ -887,7 +887,7 @@ public:
                 if (filteredMapSize <= numEntries) {
                     filteredMapSize += MAP_INCREMENT_SIZE;
                     int32_t *tmp = (int32_t *)uprv_realloc(filteredMap, filteredMapSize * sizeof(int32_t));
-                    if (tmp == NULL) {
+                    if (tmp == nullptr) {
                         ec = U_MEMORY_ALLOCATION_ERROR;
                         break;
                     } else {
@@ -900,37 +900,37 @@ public:
 
             if (U_FAILURE(ec)) {
                 uprv_free(filteredMap);
-                filteredMap = NULL;
+                filteredMap = nullptr;
             }
 
             ures_close(res);
         }
 
-        TZEnumeration *result = NULL;
+        TZEnumeration *result = nullptr;
         if (U_SUCCESS(ec)) {
             // Finally, create a new enumeration instance
-            if (filteredMap == NULL) {
+            if (filteredMap == nullptr) {
                 result = new TZEnumeration(baseMap, baseLen, false);
             } else {
                 result = new TZEnumeration(filteredMap, numEntries, true);
-                filteredMap = NULL;
+                filteredMap = nullptr;
             }
-            if (result == NULL) {
+            if (result == nullptr) {
                 ec = U_MEMORY_ALLOCATION_ERROR;
             }
         }
 
-        if (filteredMap != NULL) {
+        if (filteredMap != nullptr) {
             uprv_free(filteredMap);
         }
 
         return result;
     }
 
-    TZEnumeration(const TZEnumeration &other) : StringEnumeration(), map(NULL), localMap(NULL), len(0), pos(0) {
-        if (other.localMap != NULL) {
+    TZEnumeration(const TZEnumeration &other) : StringEnumeration(), map(nullptr), localMap(nullptr), len(0), pos(0) {
+        if (other.localMap != nullptr) {
             localMap = (int32_t *)uprv_malloc(other.len * sizeof(int32_t));
-            if (localMap != NULL) {
+            if (localMap != nullptr) {
                 len = other.len;
                 uprv_memcpy(localMap, other.localMap, len * sizeof(int32_t));
                 pos = other.pos;
@@ -938,11 +938,11 @@ public:
             } else {
                 len = 0;
                 pos = 0;
-                map = NULL;
+                map = nullptr;
             }
         } else {
             map = other.map;
-            localMap = NULL;
+            localMap = nullptr;
             len = other.len;
             pos = other.pos;
         }
@@ -959,7 +959,7 @@ public:
     }
 
     virtual const UnicodeString* snext(UErrorCode& status) override {
-        if (U_SUCCESS(status) && map != NULL && pos < len) {
+        if (U_SUCCESS(status) && map != nullptr && pos < len) {
             getID(map[pos], status);
             ++pos;
             return &unistr;
@@ -977,7 +977,7 @@ public:
 };
 
 TZEnumeration::~TZEnumeration() {
-    if (localMap != NULL) {
+    if (localMap != nullptr) {
         uprv_free(localMap);
     }
 }
@@ -995,17 +995,17 @@ TimeZone::createTimeZoneIDEnumeration(
 
 StringEnumeration* U_EXPORT2
 TimeZone::createEnumeration(UErrorCode& status) {
-    return TZEnumeration::create(UCAL_ZONE_TYPE_ANY, NULL, NULL, status);
+    return TZEnumeration::create(UCAL_ZONE_TYPE_ANY, nullptr, nullptr, status);
 }
 
 StringEnumeration* U_EXPORT2
 TimeZone::createEnumerationForRawOffset(int32_t rawOffset, UErrorCode& status) {
-    return TZEnumeration::create(UCAL_ZONE_TYPE_ANY, NULL, &rawOffset, status);
+    return TZEnumeration::create(UCAL_ZONE_TYPE_ANY, nullptr, &rawOffset, status);
 }
 
 StringEnumeration* U_EXPORT2
 TimeZone::createEnumerationForRegion(const char* region, UErrorCode& status) {
-    return TZEnumeration::create(UCAL_ZONE_TYPE_ANY, region, NULL, status);
+    return TZEnumeration::create(UCAL_ZONE_TYPE_ANY, region, nullptr, status);
 }
 
 //
@@ -1070,7 +1070,7 @@ TimeZone::getEquivalentID(const UnicodeString& id, int32_t index) {
         }
     }
     if (zone >= 0) {
-        UResourceBundle *ares = ures_getByKey(top, kNAMES, NULL, &ec); // dereference Zones section
+        UResourceBundle *ares = ures_getByKey(top, kNAMES, nullptr, &ec); // dereference Zones section
         if (U_SUCCESS(ec)) {
             int32_t idLen = 0;
             const UChar* id2 = ures_getStringByIndex(ares, zone, &idLen, &ec);
@@ -1094,16 +1094,16 @@ TimeZone::getEquivalentID(const UnicodeString& id, int32_t index) {
 
 const UChar*
 TimeZone::findID(const UnicodeString& id) {
-    const UChar *result = NULL;
+    const UChar *result = nullptr;
     UErrorCode ec = U_ZERO_ERROR;
-    UResourceBundle *rb = ures_openDirect(NULL, kZONEINFO, &ec);
+    UResourceBundle *rb = ures_openDirect(nullptr, kZONEINFO, &ec);
 
     // resolve zone index by name
-    UResourceBundle *names = ures_getByKey(rb, kNAMES, NULL, &ec);
+    UResourceBundle *names = ures_getByKey(rb, kNAMES, nullptr, &ec);
     int32_t idx = findInStringArray(names, id, ec);
-    result = ures_getStringByIndex(names, idx, NULL, &ec);
+    result = ures_getStringByIndex(names, idx, nullptr, &ec);
     if (U_FAILURE(ec)) {
-        result = NULL;
+        result = nullptr;
     }
     ures_close(names);
     ures_close(rb);
@@ -1113,14 +1113,14 @@ TimeZone::findID(const UnicodeString& id) {
 
 const UChar*
 TimeZone::dereferOlsonLink(const UnicodeString& id) {
-    const UChar *result = NULL;
+    const UChar *result = nullptr;
     UErrorCode ec = U_ZERO_ERROR;
-    UResourceBundle *rb = ures_openDirect(NULL, kZONEINFO, &ec);
+    UResourceBundle *rb = ures_openDirect(nullptr, kZONEINFO, &ec);
 
     // resolve zone index by name
-    UResourceBundle *names = ures_getByKey(rb, kNAMES, NULL, &ec);
+    UResourceBundle *names = ures_getByKey(rb, kNAMES, nullptr, &ec);
     int32_t idx = findInStringArray(names, id, ec);
-    result = ures_getStringByIndex(names, idx, NULL, &ec);
+    result = ures_getStringByIndex(names, idx, nullptr, &ec);
 
     // open the zone bundle by index
     ures_getByKey(rb, kZONES, rb, &ec);
@@ -1130,7 +1130,7 @@ TimeZone::dereferOlsonLink(const UnicodeString& id) {
         if (ures_getType(rb) == URES_INT) {
             // this is a link - dereference the link
             int32_t deref = ures_getInt(rb, &ec);
-            const UChar* tmp = ures_getStringByIndex(names, deref, NULL, &ec);
+            const UChar* tmp = ures_getStringByIndex(names, deref, nullptr, &ec);
             if (U_SUCCESS(ec)) {
                 result = tmp;
             }
@@ -1152,18 +1152,18 @@ TimeZone::getRegion(const UnicodeString& id) {
 const UChar*
 TimeZone::getRegion(const UnicodeString& id, UErrorCode& status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
-    const UChar *result = NULL;
-    UResourceBundle *rb = ures_openDirect(NULL, kZONEINFO, &status);
+    const UChar *result = nullptr;
+    UResourceBundle *rb = ures_openDirect(nullptr, kZONEINFO, &status);
 
     // resolve zone index by name
-    UResourceBundle *res = ures_getByKey(rb, kNAMES, NULL, &status);
+    UResourceBundle *res = ures_getByKey(rb, kNAMES, nullptr, &status);
     int32_t idx = findInStringArray(res, id, status);
 
     // get region mapping
     ures_getByKey(rb, kREGIONS, res, &status);
-    const UChar *tmp = ures_getStringByIndex(res, idx, NULL, &status);
+    const UChar *tmp = ures_getStringByIndex(res, idx, nullptr, &status);
     if (U_SUCCESS(status)) {
         result = tmp;
     }
@@ -1185,13 +1185,13 @@ TimeZone::getRegion(const UnicodeString& id, char *region, int32_t capacity, UEr
         return 0;
     }
 
-    const UChar *uregion = NULL;
+    const UChar *uregion = nullptr;
     // "Etc/Unknown" is not a system zone ID,
     // but in the zone data
     if (id.compare(UNKNOWN_ZONE_ID, UNKNOWN_ZONE_ID_LENGTH) != 0) {
         uregion = getRegion(id);
     }
-    if (uregion == NULL) {
+    if (uregion == nullptr) {
         status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -1348,7 +1348,7 @@ TimeZone::createCustomTimeZone(const UnicodeString& id)
         int32_t offset = sign * ((hour * 60 + min) * 60 + sec) * 1000;
         return new SimpleTimeZone(offset, customID);
     }
-    return NULL;
+    return nullptr;
 }
 
 UnicodeString&
@@ -1539,7 +1539,7 @@ static void U_CALLCONV initTZDataVersion(UErrorCode &status) {
     ucln_i18n_registerCleanup(UCLN_I18N_TIMEZONE, timeZone_cleanup);
     int32_t len = 0;
     StackUResourceBundle bundle;
-    ures_openDirectFillIn(bundle.getAlias(), NULL, kZONEINFO, &status);
+    ures_openDirectFillIn(bundle.getAlias(), nullptr, kZONEINFO, &status);
     const UChar *tzver = ures_getStringByKey(bundle.getAlias(), kTZVERSION, &len, &status);
 
     if (U_SUCCESS(status)) {
@@ -1613,14 +1613,14 @@ TimeZone::getWindowsID(const UnicodeString& id, UnicodeString& winid, UErrorCode
         return winid;
     }
 
-    UResourceBundle *mapTimezones = ures_openDirect(NULL, "windowsZones", &status);
+    UResourceBundle *mapTimezones = ures_openDirect(nullptr, "windowsZones", &status);
     ures_getByKey(mapTimezones, "mapTimezones", mapTimezones, &status);
 
     if (U_FAILURE(status)) {
         return winid;
     }
 
-    UResourceBundle *winzone = NULL;
+    UResourceBundle *winzone = nullptr;
     UBool found = false;
     while (ures_hasNext(mapTimezones) && !found) {
         winzone = ures_getNextResource(mapTimezones, winzone, &status);
@@ -1630,7 +1630,7 @@ TimeZone::getWindowsID(const UnicodeString& id, UnicodeString& winid, UErrorCode
         if (ures_getType(winzone) != URES_TABLE) {
             continue;
         }
-        UResourceBundle *regionalData = NULL;
+        UResourceBundle *regionalData = nullptr;
         while (ures_hasNext(winzone) && !found) {
             regionalData = ures_getNextResource(winzone, regionalData, &status);
             if (U_FAILURE(status)) {
@@ -1649,7 +1649,7 @@ TimeZone::getWindowsID(const UnicodeString& id, UnicodeString& winid, UErrorCode
             UBool hasNext = true;
             while (hasNext) {
                 const UChar *end = u_strchr(start, (UChar)0x20);
-                if (end == NULL) {
+                if (end == nullptr) {
                     end = tzids + len;
                     hasNext = false;
                 }
@@ -1678,7 +1678,7 @@ TimeZone::getIDForWindowsID(const UnicodeString& winid, const char* region, Unic
         return id;
     }
 
-    UResourceBundle *zones = ures_openDirect(NULL, "windowsZones", &status);
+    UResourceBundle *zones = ures_openDirect(nullptr, "windowsZones", &status);
     ures_getByKey(zones, "mapTimezones", zones, &status);
     if (U_FAILURE(status)) {
         ures_close(zones);
@@ -1702,7 +1702,7 @@ TimeZone::getIDForWindowsID(const UnicodeString& winid, const char* region, Unic
         return id;
     }
 
-    const UChar *tzid = NULL;
+    const UChar *tzid = nullptr;
     int32_t len = 0;
     UBool gotID = false;
     if (region) {
@@ -1711,7 +1711,7 @@ TimeZone::getIDForWindowsID(const UnicodeString& winid, const char* region, Unic
         if (U_SUCCESS(tmperr)) {
             // first ID delimited by space is the default one
             const UChar *end = u_strchr(tzids, (UChar)0x20);
-            if (end == NULL) {
+            if (end == nullptr) {
                 id.setTo(tzids, -1);
             } else {
                 id.setTo(tzids, static_cast<int32_t>(end - tzids));
index 62e41f920cb7c2992067c428843151e136fdd967..5a2f2487c8e9fbd84fd45eba6165a34053dd4ec9 100644 (file)
@@ -28,7 +28,7 @@ U_NAMESPACE_BEGIN
 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TitlecaseTransliterator)
 
 TitlecaseTransliterator::TitlecaseTransliterator() :
-    CaseMapTransliterator(UNICODE_STRING("Any-Title", 9), NULL)
+    CaseMapTransliterator(UNICODE_STRING("Any-Title", 9), nullptr)
 {
     // Need to look back 2 characters in the case of "can't"
     setMaximumContextLength(2);
index 361aecb92eda3322713d0f20f97522ad925c2838..ffa67eddeb3a493a3b07b40f5652aba3afb551fb 100644 (file)
@@ -59,11 +59,11 @@ TimeUnit* U_EXPORT2
 TimeUnit::createInstance(TimeUnit::UTimeUnitFields timeUnitField, 
                          UErrorCode& status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     if (timeUnitField < 0 || timeUnitField >= UTIMEUNIT_FIELD_COUNT) {
         status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     return new TimeUnit(timeUnitField);
 }
index 37e56b26a10a98f849d95cd8311b717f37fcc293..a6416688345ff118a6b443c4a49b2c304ef66fff 100644 (file)
@@ -81,13 +81,13 @@ static const UChar PLURAL_COUNT_ONE[] = {LOW_O, LOW_N, LOW_E, 0};
 static const UChar PLURAL_COUNT_TWO[] = {LOW_T, LOW_W, LOW_O, 0};
 
 TimeUnitFormat::TimeUnitFormat(UErrorCode& status) {
-    initMeasureFormat(Locale::getDefault(), UMEASFMT_WIDTH_WIDE, NULL, status);
+    initMeasureFormat(Locale::getDefault(), UMEASFMT_WIDTH_WIDE, nullptr, status);
     create(UTMUTFMT_FULL_STYLE, status);
 }
 
 
 TimeUnitFormat::TimeUnitFormat(const Locale& locale, UErrorCode& status) {
-    initMeasureFormat(locale, UMEASFMT_WIDTH_WIDE, NULL, status);
+    initMeasureFormat(locale, UMEASFMT_WIDTH_WIDE, nullptr, status);
     create(UTMUTFMT_FULL_STYLE, status);
 }
 
@@ -95,13 +95,13 @@ TimeUnitFormat::TimeUnitFormat(const Locale& locale, UErrorCode& status) {
 TimeUnitFormat::TimeUnitFormat(const Locale& locale, UTimeUnitFormatStyle style, UErrorCode& status) {
     switch (style) {
     case UTMUTFMT_FULL_STYLE:
-        initMeasureFormat(locale, UMEASFMT_WIDTH_WIDE, NULL, status);
+        initMeasureFormat(locale, UMEASFMT_WIDTH_WIDE, nullptr, status);
         break;
     case UTMUTFMT_ABBREVIATED_STYLE:
-        initMeasureFormat(locale, UMEASFMT_WIDTH_SHORT, NULL, status);
+        initMeasureFormat(locale, UMEASFMT_WIDTH_SHORT, nullptr, status);
         break;
     default:
-        initMeasureFormat(locale, UMEASFMT_WIDTH_WIDE, NULL, status);
+        initMeasureFormat(locale, UMEASFMT_WIDTH_WIDE, nullptr, status);
         break;
     }
     create(style, status);
@@ -120,7 +120,7 @@ TimeUnitFormat::TimeUnitFormat(const TimeUnitFormat& other)
             copyHash(other.fTimeUnitToCountToPatterns[i], fTimeUnitToCountToPatterns[i], status);
         } else {
             delete fTimeUnitToCountToPatterns[i];
-            fTimeUnitToCountToPatterns[i] = NULL;
+            fTimeUnitToCountToPatterns[i] = nullptr;
         }
     }
 }
@@ -131,7 +131,7 @@ TimeUnitFormat::~TimeUnitFormat() {
          i < TimeUnit::UTIMEUNIT_FIELD_COUNT;
          i = (TimeUnit::UTimeUnitFields)(i+1)) {
         deleteHash(fTimeUnitToCountToPatterns[i]);
-        fTimeUnitToCountToPatterns[i] = NULL;
+        fTimeUnitToCountToPatterns[i] = nullptr;
     }
 }
 
@@ -152,7 +152,7 @@ TimeUnitFormat::operator=(const TimeUnitFormat& other) {
          i < TimeUnit::UTIMEUNIT_FIELD_COUNT;
          i = (TimeUnit::UTimeUnitFields)(i+1)) {
         deleteHash(fTimeUnitToCountToPatterns[i]);
-        fTimeUnitToCountToPatterns[i] = NULL;
+        fTimeUnitToCountToPatterns[i] = nullptr;
     }
     for (TimeUnit::UTimeUnitFields i = TimeUnit::UTIMEUNIT_YEAR;
          i < TimeUnit::UTIMEUNIT_FIELD_COUNT;
@@ -163,7 +163,7 @@ TimeUnitFormat::operator=(const TimeUnitFormat& other) {
             copyHash(other.fTimeUnitToCountToPatterns[i], fTimeUnitToCountToPatterns[i], status);
         } else {
             delete fTimeUnitToCountToPatterns[i];
-            fTimeUnitToCountToPatterns[i] = NULL;
+            fTimeUnitToCountToPatterns[i] = nullptr;
         }
     }
     fStyle = other.fStyle;
@@ -180,7 +180,7 @@ TimeUnitFormat::parseObject(const UnicodeString& source,
     int32_t oldPos = pos.getIndex();
     int32_t newPos = -1;
     int32_t longestParseDistance = 0;
-    UnicodeString* countOfLongestMatch = NULL;
+    UnicodeString* countOfLongestMatch = nullptr;
 #ifdef TMUTFMT_DEBUG
     char res[1000];
     source.extract(0, source.length(), res, "UTF-8");
@@ -193,8 +193,8 @@ TimeUnitFormat::parseObject(const UnicodeString& source,
          i = (TimeUnit::UTimeUnitFields)(i+1)) {
         Hashtable* countToPatterns = fTimeUnitToCountToPatterns[i];
         int32_t elemPos = UHASH_FIRST;
-        const UHashElement* elem = NULL;
-        while ((elem = countToPatterns->nextElement(elemPos)) != NULL){
+        const UHashElement* elem = nullptr;
+        while ((elem = countToPatterns->nextElement(elemPos)) != nullptr){
             const UHashTok keyTok = elem->key;
             UnicodeString* count = (UnicodeString*)keyTok.pointer;
 #ifdef TMUTFMT_DEBUG
@@ -288,12 +288,12 @@ TimeUnitFormat::parseObject(const UnicodeString& source,
 
 void
 TimeUnitFormat::create(UTimeUnitFormatStyle style, UErrorCode& status) {
-    // fTimeUnitToCountToPatterns[] must have its elements initialized to NULL first
+    // fTimeUnitToCountToPatterns[] must have its elements initialized to nullptr first
     // before checking for failure status.
     for (TimeUnit::UTimeUnitFields i = TimeUnit::UTIMEUNIT_YEAR;
          i < TimeUnit::UTIMEUNIT_FIELD_COUNT;
          i = (TimeUnit::UTimeUnitFields)(i+1)) {
-        fTimeUnitToCountToPatterns[i] = NULL;
+        fTimeUnitToCountToPatterns[i] = nullptr;
     }
 
     if (U_FAILURE(status)) {
@@ -326,7 +326,7 @@ TimeUnitFormat::setup(UErrorCode& err) {
         return;
     }
     UnicodeString* pluralCount;
-    while ((pluralCount = const_cast<UnicodeString*>(keywords->snext(err))) != NULL) {
+    while ((pluralCount = const_cast<UnicodeString*>(keywords->snext(err))) != nullptr) {
       pluralCounts.addElement(pluralCount, err);
     }
     readFromCurrentLocale(UTMUTFMT_FULL_STYLE, gUnitsTag, pluralCounts, err);
@@ -345,7 +345,7 @@ TimeUnitFormat::initDataMembers(UErrorCode& err){
          i < TimeUnit::UTIMEUNIT_FIELD_COUNT;
          i = (TimeUnit::UTimeUnitFields)(i+1)) {
         deleteHash(fTimeUnitToCountToPatterns[i]);
-        fTimeUnitToCountToPatterns[i] = NULL;
+        fTimeUnitToCountToPatterns[i] = nullptr;
     }
 }
 
@@ -375,7 +375,7 @@ struct TimeUnitFormatReadSink : public ResourceSink {
 
         for (int32_t i = 0; units.getKeyAndValue(i, key, value); ++i) {
             const char* timeUnitName = key;
-            if (timeUnitName == NULL) {
+            if (timeUnitName == nullptr) {
                 continue;
             }
 
@@ -400,7 +400,7 @@ struct TimeUnitFormatReadSink : public ResourceSink {
             LocalPointer<Hashtable> localCountToPatterns;
             Hashtable *countToPatterns =
                 timeUnitFormatObj->fTimeUnitToCountToPatterns[timeUnitField];
-            if (countToPatterns == NULL) {
+            if (countToPatterns == nullptr) {
                 localCountToPatterns.adoptInsteadAndCheckErrorCode(
                     timeUnitFormatObj->initHash(errorCode), errorCode);
                 countToPatterns = localCountToPatterns.getAlias();
@@ -430,15 +430,15 @@ struct TimeUnitFormatReadSink : public ResourceSink {
                 }
                 MessageFormat** formatters =
                     (MessageFormat**)countToPatterns->get(pluralCountUniStr);
-                if (formatters == NULL) {
+                if (formatters == nullptr) {
                     LocalMemory<MessageFormat *> localFormatters(
                         (MessageFormat **)uprv_malloc(UTMUTFMT_FORMAT_STYLE_COUNT*sizeof(MessageFormat*)));
                     if (localFormatters.isNull()) {
                         errorCode = U_MEMORY_ALLOCATION_ERROR;
                         return;
                     }
-                    localFormatters[UTMUTFMT_FULL_STYLE] = NULL;
-                    localFormatters[UTMUTFMT_ABBREVIATED_STYLE] = NULL;
+                    localFormatters[UTMUTFMT_FULL_STYLE] = nullptr;
+                    localFormatters[UTMUTFMT_ABBREVIATED_STYLE] = nullptr;
                     countToPatterns->put(pluralCountUniStr, localFormatters.getAlias(), errorCode);
                     if (U_FAILURE(errorCode)) {
                         return;
@@ -448,7 +448,7 @@ struct TimeUnitFormatReadSink : public ResourceSink {
                 formatters[style] = messageFormat.orphan();
             }
 
-            if (timeUnitFormatObj->fTimeUnitToCountToPatterns[timeUnitField] == NULL) {
+            if (timeUnitFormatObj->fTimeUnitToCountToPatterns[timeUnitField] == nullptr) {
                 timeUnitFormatObj->fTimeUnitToCountToPatterns[timeUnitField] = localCountToPatterns.orphan();
             }
         }
@@ -471,7 +471,7 @@ TimeUnitFormat::readFromCurrentLocale(UTimeUnitFormatStyle style, const char* ke
     UErrorCode status = U_ZERO_ERROR;
     LocalUResourceBundlePointer rb(ures_open(U_ICUDATA_UNIT, getLocaleID(status), &status));
 
-    LocalUResourceBundlePointer unitsRes(ures_getByKey(rb.getAlias(), key, NULL, &status));
+    LocalUResourceBundlePointer unitsRes(ures_getByKey(rb.getAlias(), key, nullptr, &status));
     ures_getByKey(unitsRes.getAlias(), "duration", unitsRes.getAlias(), &status);
     if (U_FAILURE(status)) {
         return;
@@ -507,19 +507,19 @@ TimeUnitFormat::checkConsistency(UTimeUnitFormatStyle style, const char* key, UE
     LocalPointer<StringEnumeration> keywords(
             getPluralRules().getKeywords(err), err);
     const UnicodeString* pluralCount;
-    while (U_SUCCESS(err) && (pluralCount = keywords->snext(err)) != NULL) {
+    while (U_SUCCESS(err) && (pluralCount = keywords->snext(err)) != nullptr) {
         for (int32_t i = 0; i < TimeUnit::UTIMEUNIT_FIELD_COUNT; ++i) {
             // for each time unit,
             // get all the patterns for each plural rule in this locale.
             Hashtable* countToPatterns = fTimeUnitToCountToPatterns[i];
-            if ( countToPatterns == NULL ) {
+            if ( countToPatterns == nullptr ) {
                 fTimeUnitToCountToPatterns[i] = countToPatterns = initHash(err);
                 if (U_FAILURE(err)) {
                     return;
                 }
             }
             MessageFormat** formatters = (MessageFormat**)countToPatterns->get(*pluralCount);
-            if( formatters == NULL || formatters[style] == NULL ) {
+            if( formatters == nullptr || formatters[style] == nullptr ) {
                 // look through parents
                 const char* localeName = getLocaleID(err);
                 CharString pluralCountChars;
@@ -559,14 +559,14 @@ TimeUnitFormat::searchInLocaleChain(UTimeUnitFormatStyle style, const char* key,
     char parentLocale[ULOC_FULLNAME_CAPACITY];
     uprv_strcpy(parentLocale, localeName);
     int32_t locNameLen;
-    U_ASSERT(countToPatterns != NULL);
+    U_ASSERT(countToPatterns != nullptr);
     while ((locNameLen = uloc_getParent(parentLocale, parentLocale,
                                         ULOC_FULLNAME_CAPACITY, &status)) >= 0){
         // look for pattern for srcPluralCount in locale tree
         LocalUResourceBundlePointer rb(ures_open(U_ICUDATA_UNIT, parentLocale, &status));
-        LocalUResourceBundlePointer unitsRes(ures_getByKey(rb.getAlias(), key, NULL, &status));
+        LocalUResourceBundlePointer unitsRes(ures_getByKey(rb.getAlias(), key, nullptr, &status));
         const char* timeUnitName = getTimeUnitName(srcTimeUnitField, status);
-        LocalUResourceBundlePointer countsToPatternRB(ures_getByKey(unitsRes.getAlias(), timeUnitName, NULL, &status));
+        LocalUResourceBundlePointer countsToPatternRB(ures_getByKey(unitsRes.getAlias(), timeUnitName, nullptr, &status));
         const UChar* pattern;
         int32_t      ptLength;
         pattern = ures_getStringByKeyWithFallback(countsToPatternRB.getAlias(), searchPluralCount, &ptLength, &status);
@@ -578,12 +578,12 @@ TimeUnitFormat::searchInLocaleChain(UTimeUnitFormatStyle style, const char* key,
                 return;
             }
             MessageFormat** formatters = (MessageFormat**)countToPatterns->get(srcPluralCount);
-            if (formatters == NULL) {
+            if (formatters == nullptr) {
                 LocalMemory<MessageFormat *> localFormatters(
                         (MessageFormat**)uprv_malloc(UTMUTFMT_FORMAT_STYLE_COUNT*sizeof(MessageFormat*)));
                 formatters = localFormatters.getAlias();
-                localFormatters[UTMUTFMT_FULL_STYLE] = NULL;
-                localFormatters[UTMUTFMT_ABBREVIATED_STYLE] = NULL;
+                localFormatters[UTMUTFMT_FULL_STYLE] = nullptr;
+                localFormatters[UTMUTFMT_ABBREVIATED_STYLE] = nullptr;
                 countToPatterns->put(srcPluralCount, localFormatters.orphan(), err);
                 if (U_FAILURE(err)) {
                     return;
@@ -615,7 +615,7 @@ TimeUnitFormat::searchInLocaleChain(UTimeUnitFormatStyle style, const char* key,
             return;
         }
         MessageFormat** formatters = (MessageFormat**)countToPatterns->get(srcPluralCount);
-        if (formatters != NULL && formatters[style] != NULL) {
+        if (formatters != nullptr && formatters[style] != nullptr) {
             return;
         }
     }
@@ -625,7 +625,7 @@ TimeUnitFormat::searchInLocaleChain(UTimeUnitFormatStyle style, const char* key,
     if ( uprv_strcmp(searchPluralCount, gPluralCountOther) == 0 ) {
         // set default fall back the same as the resource in root
         LocalPointer<MessageFormat> messageFormat;
-        const UChar *pattern = NULL;
+        const UChar *pattern = nullptr;
         if ( srcTimeUnitField == TimeUnit::UTIMEUNIT_SECOND ) {
             pattern = DEFAULT_PATTERN_FOR_SECOND;
         } else if ( srcTimeUnitField == TimeUnit::UTIMEUNIT_MINUTE ) {
@@ -641,7 +641,7 @@ TimeUnitFormat::searchInLocaleChain(UTimeUnitFormatStyle style, const char* key,
         } else if ( srcTimeUnitField == TimeUnit::UTIMEUNIT_YEAR ) {
             pattern = DEFAULT_PATTERN_FOR_YEAR;
         }
-        if (pattern != NULL) {
+        if (pattern != nullptr) {
             messageFormat.adoptInsteadAndCheckErrorCode(
                      new MessageFormat(UnicodeString(true, pattern, -1), getLocale(err), err), err);
         }
@@ -649,7 +649,7 @@ TimeUnitFormat::searchInLocaleChain(UTimeUnitFormatStyle style, const char* key,
             return;
         }
         MessageFormat** formatters = (MessageFormat**)countToPatterns->get(srcPluralCount);
-        if (formatters == NULL) {
+        if (formatters == nullptr) {
             LocalMemory<MessageFormat *> localFormatters (
                     (MessageFormat**)uprv_malloc(UTMUTFMT_FORMAT_STYLE_COUNT*sizeof(MessageFormat*)));
             if (localFormatters.isNull()) {
@@ -657,8 +657,8 @@ TimeUnitFormat::searchInLocaleChain(UTimeUnitFormatStyle style, const char* key,
                 return;
             }
             formatters = localFormatters.getAlias();
-            formatters[UTMUTFMT_FULL_STYLE] = NULL;
-            formatters[UTMUTFMT_ABBREVIATED_STYLE] = NULL;
+            formatters[UTMUTFMT_FULL_STYLE] = nullptr;
+            formatters[UTMUTFMT_ABBREVIATED_STYLE] = nullptr;
             countToPatterns->put(srcPluralCount, localFormatters.orphan(), err);
         }
         if (U_SUCCESS(err)) {
@@ -692,9 +692,9 @@ TimeUnitFormat::setNumberFormat(const NumberFormat& format, UErrorCode& status){
 void
 TimeUnitFormat::deleteHash(Hashtable* htable) {
     int32_t pos = UHASH_FIRST;
-    const UHashElement* element = NULL;
+    const UHashElement* element = nullptr;
     if ( htable ) {
-        while ( (element = htable->nextElement(pos)) != NULL ) {
+        while ( (element = htable->nextElement(pos)) != nullptr ) {
             const UHashTok valueTok = element->value;
             const MessageFormat** value = (const MessageFormat**)valueTok.pointer;
             delete value[UTMUTFMT_FULL_STYLE];
@@ -713,9 +713,9 @@ TimeUnitFormat::copyHash(const Hashtable* source, Hashtable* target, UErrorCode&
         return;
     }
     int32_t pos = UHASH_FIRST;
-    const UHashElement* element = NULL;
+    const UHashElement* element = nullptr;
     if ( source ) {
-        while ( (element = source->nextElement(pos)) != NULL ) {
+        while ( (element = source->nextElement(pos)) != nullptr ) {
             const UHashTok keyTok = element->key;
             const UnicodeString* key = (UnicodeString*)keyTok.pointer;
             const UHashTok valueTok = element->value;
@@ -758,16 +758,16 @@ U_CDECL_END
 Hashtable*
 TimeUnitFormat::initHash(UErrorCode& status) {
     if ( U_FAILURE(status) ) {
-        return NULL;
+        return nullptr;
     }
     Hashtable* hTable;
-    if ( (hTable = new Hashtable(true, status)) == NULL ) {
+    if ( (hTable = new Hashtable(true, status)) == nullptr ) {
         status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     if ( U_FAILURE(status) ) {
         delete hTable;
-        return NULL;
+        return nullptr;
     }
     hTable->setValueComparator(tmutfmtHashTableValueComparator);
     return hTable;
@@ -778,7 +778,7 @@ const char*
 TimeUnitFormat::getTimeUnitName(TimeUnit::UTimeUnitFields unitField,
                                 UErrorCode& status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     switch (unitField) {
       case TimeUnit::UTIMEUNIT_YEAR:
@@ -797,7 +797,7 @@ TimeUnitFormat::getTimeUnitName(TimeUnit::UTimeUnitFields unitField,
         return gTimeUnitSecond;
       default:
         status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 }
 
index 4d74d0b6128f5a800236336e0f6ee78dc40f31cd..2bca2dbbed5d88a0fcd17240a5ab782592c8c366 100644 (file)
@@ -163,7 +163,7 @@ Transliterator::Transliterator(const Transliterator& other) :
 }
 
 Transliterator* Transliterator::clone() const {
-    return NULL;
+    return nullptr;
 }
 
 /**
@@ -474,7 +474,7 @@ void Transliterator::filteredTransliterate(Replaceable& text,
     
     for (;;) {
 
-        if (filter != NULL) {
+        if (filter != nullptr) {
             // Narrow the range to be transliterated to the first segment
             // of unfiltered characters at or after index.start.
 
@@ -666,7 +666,7 @@ void Transliterator::filteredTransliterate(Replaceable& text,
             globalLimit += delta;
         }
 
-        if (filter == NULL || isIncrementalRun) {
+        if (filter == nullptr || isIncrementalRun) {
             break;
         }
 
@@ -840,13 +840,13 @@ const UnicodeFilter* Transliterator::getFilter(void) const {
 
 /**
  * Returns the filter used by this transliterator, or
- * <tt>NULL</tt> if this transliterator uses no filter.  The
+ * <tt>nullptr</tt> if this transliterator uses no filter.  The
  * caller must eventually delete the result.  After this call,
- * this transliterator's filter is set to <tt>NULL</tt>.
+ * this transliterator's filter is set to <tt>nullptr</tt>.
  */
 UnicodeFilter* Transliterator::orphanFilter(void) {
     UnicodeFilter *result = filter;
-    filter = NULL;
+    filter = nullptr;
     return result;
 }
 
@@ -921,7 +921,7 @@ Transliterator::createInstance(const UnicodeString& ID,
     UnicodeString canonID;
     UVector list(status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     UnicodeSet* globalFilter = nullptr;
@@ -930,17 +930,17 @@ Transliterator::createInstance(const UnicodeString& ID,
     if (!TransliteratorIDParser::parseCompoundID(ID, dir, canonID, list, globalFilter)) {
         status = U_INVALID_ID;
         delete globalFilter;
-        return NULL;
+        return nullptr;
     }
     LocalPointer<UnicodeSet> lpGlobalFilter(globalFilter);
     
     TransliteratorIDParser::instantiateList(list, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     
     U_ASSERT(list.size() > 0);
-    Transliterator* t = NULL;
+    Transliterator* t = nullptr;
     
     if (list.size() > 1 || canonID.indexOf(ID_DELIM) >= 0) {
         // [NOTE: If it's a compoundID, we instantiate a CompoundTransliterator even if it only
@@ -954,7 +954,7 @@ Transliterator::createInstance(const UnicodeString& ID,
         t = (Transliterator*)list.elementAt(0);
     }
     // Check null pointer
-    if (t != NULL) {
+    if (t != nullptr) {
         t->setID(canonID);
         if (lpGlobalFilter.isValid()) {
             t->adoptFilter(lpGlobalFilter.orphan());
@@ -1029,12 +1029,12 @@ Transliterator* Transliterator::createBasicInstance(const UnicodeString& id,
         if (U_FAILURE(ec)) {
             delete t;
             delete alias;
-            t = NULL;
+            t = nullptr;
             break;
         }
     }
 
-    if (t != NULL && canon != NULL) {
+    if (t != nullptr && canon != nullptr) {
         t->setID(*canon);
     }
 
@@ -1056,7 +1056,7 @@ Transliterator::createFromRules(const UnicodeString& ID,
                                 UParseError& parseError,
                                 UErrorCode& status)
 {
-    Transliterator* t = NULL;
+    Transliterator* t = nullptr;
 
     TransliteratorParser parser(status);
     parser.parse(rules, dir, parseError, status);
@@ -1077,7 +1077,7 @@ Transliterator::createFromRules(const UnicodeString& ID,
         // been munged from reverse into forward mode, if
         // necessary, so instantiate the ID in the forward
         // direction.
-        if (parser.compoundFilter != NULL) {
+        if (parser.compoundFilter != nullptr) {
             UnicodeString filterPattern;
             parser.compoundFilter->toPattern(filterPattern, false);
             t = createInstance(filterPattern + UnicodeString(ID_DELIM)
@@ -1087,7 +1087,7 @@ Transliterator::createFromRules(const UnicodeString& ID,
             t = createInstance(*((UnicodeString*)parser.idBlockVector.elementAt(0)), UTRANS_FORWARD, parseError, status);
 
 
-        if (t != NULL) {
+        if (t != nullptr) {
             t->setID(ID);
         }
     }
@@ -1110,7 +1110,7 @@ Transliterator::createFromRules(const UnicodeString& ID,
                         delete temp;
                         return nullptr;
                     }
-                    if (temp != NULL && typeid(*temp) != typeid(NullTransliterator)) {
+                    if (temp != nullptr && typeid(*temp) != typeid(NullTransliterator)) {
                         transliterators.addElement(temp, status);
                         if (U_FAILURE(status)) {
                             delete temp;
@@ -1126,8 +1126,8 @@ Transliterator::createFromRules(const UnicodeString& ID,
                 // TODO: Should passNumber be turned into a decimal-string representation (1 -> "1")?
                 RuleBasedTransliterator* temprbt = new RuleBasedTransliterator(UnicodeString(CompoundTransliterator::PASS_STRING) + UnicodeString(passNumber++),
                         data, true);
-                // Check if NULL before adding it to transliterators to avoid future usage of NULL pointer.
-                if (temprbt == NULL) {
+                // Check if nullptr before adding it to transliterators to avoid future usage of nullptr pointer.
+                if (temprbt == nullptr) {
                     if (U_SUCCESS(status)) {
                         status = U_MEMORY_ALLOCATION_ERROR;
                     }
@@ -1146,12 +1146,12 @@ Transliterator::createFromRules(const UnicodeString& ID,
 
         t = new CompoundTransliterator(transliterators, passNumber - 1, parseError, status);
         // Null pointer check
-        if (t != NULL) {
+        if (t != nullptr) {
             t->setID(ID);
             t->adoptFilter(parser.orphanCompoundFilter());
         }
     }
-    if (U_SUCCESS(status) && t == NULL) {
+    if (U_SUCCESS(status) && t == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
     }
     return t;
@@ -1182,7 +1182,7 @@ UnicodeString& Transliterator::toRules(UnicodeString& rulesSource,
 
 int32_t Transliterator::countElements() const {
     const CompoundTransliterator* ct = dynamic_cast<const CompoundTransliterator*>(this);
-    return ct != NULL ? ct->getCount() : 0;
+    return ct != nullptr ? ct->getCount() : 0;
 }
 
 const Transliterator& Transliterator::getElement(int32_t index, UErrorCode& ec) const {
@@ -1190,7 +1190,7 @@ const Transliterator& Transliterator::getElement(int32_t index, UErrorCode& ec)
         return *this;
     }
     const CompoundTransliterator* cpd = dynamic_cast<const CompoundTransliterator*>(this);
-    int32_t n = (cpd == NULL) ? 1 : cpd->getCount();
+    int32_t n = (cpd == nullptr) ? 1 : cpd->getCount();
     if (index < 0 || index >= n) {
         ec = U_INDEX_OUTOFBOUNDS_ERROR;
         return *this;
@@ -1201,15 +1201,15 @@ const Transliterator& Transliterator::getElement(int32_t index, UErrorCode& ec)
 
 UnicodeSet& Transliterator::getSourceSet(UnicodeSet& result) const {
     handleGetSourceSet(result);
-    if (filter != NULL) {
+    if (filter != nullptr) {
         UnicodeSet* filterSet = dynamic_cast<UnicodeSet*>(filter);
         UBool deleteFilterSet = false;
         // Most, but not all filters will be UnicodeSets.  Optimize for
         // the high-runner case.
-        if (filterSet == NULL) {
+        if (filterSet == nullptr) {
             filterSet = new UnicodeSet();
             // Check null pointer
-            if (filterSet == NULL) {
+            if (filterSet == nullptr) {
                 return result;
             }
             deleteFilterSet = true;
@@ -1340,26 +1340,26 @@ int32_t U_EXPORT2 Transliterator::countAvailableIDs(void) {
  * range, the result of getAvailableID(0) is returned.
  */
 const UnicodeString& U_EXPORT2 Transliterator::getAvailableID(int32_t index) {
-    const UnicodeString* result = NULL;
+    const UnicodeString* result = nullptr;
     umtx_lock(&registryMutex);
     UErrorCode ec = U_ZERO_ERROR;
     if (HAVE_REGISTRY(ec)) {
         result = &registry->getAvailableID(index);
     }
     umtx_unlock(&registryMutex);
-    U_ASSERT(result != NULL); // fail if no registry
+    U_ASSERT(result != nullptr); // fail if no registry
     return *result;
 }
 
 StringEnumeration* U_EXPORT2 Transliterator::getAvailableIDs(UErrorCode& ec) {
-    if (U_FAILURE(ec)) return NULL;
-    StringEnumeration* result = NULL;
+    if (U_FAILURE(ec)) return nullptr;
+    StringEnumeration* result = nullptr;
     umtx_lock(&registryMutex);
     if (HAVE_REGISTRY(ec)) {
         result = registry->getAvailableIDs();
     }
     umtx_unlock(&registryMutex);
-    if (result == NULL) {
+    if (result == nullptr) {
         ec = U_INTERNAL_TRANSLITERATOR_ERROR;
     }
     return result;
@@ -1525,7 +1525,7 @@ UBool Transliterator::initializeRegistry(UErrorCode &status) {
 
     UErrorCode lstatus = U_ZERO_ERROR;
     UResourceBundle *bundle, *transIDs, *colBund;
-    bundle = ures_open(U_ICUDATA_TRANSLIT, NULL/*open default locale*/, &lstatus);
+    bundle = ures_open(U_ICUDATA_TRANSLIT, nullptr/*open default locale*/, &lstatus);
     transIDs = ures_getByKey(bundle, RB_RULE_BASED_IDS, 0, &lstatus);
     const UnicodeString T_PART = UNICODE_STRING_SIMPLE("-t-");
 
@@ -1546,7 +1546,7 @@ UBool Transliterator::initializeRegistry(UErrorCode &status) {
                     ures_close(colBund);
                     continue;
                 }
-                UResourceBundle* res = ures_getNextResource(colBund, NULL, &lstatus);
+                UResourceBundle* res = ures_getNextResource(colBund, nullptr, &lstatus);
                 const char* typeStr = ures_getKey(res);
                 UChar type;
                 u_charsToUChars(typeStr, &type, 1);
@@ -1602,12 +1602,12 @@ UBool Transliterator::initializeRegistry(UErrorCode &status) {
      BreakTransliterator* tempBreakTranslit         = new BreakTransliterator();
 #endif
     // Check for null pointers
-    if (tempNullTranslit == NULL || tempLowercaseTranslit == NULL || tempUppercaseTranslit == NULL ||
-        tempTitlecaseTranslit == NULL || tempUnicodeTranslit == NULL || 
+    if (tempNullTranslit == nullptr || tempLowercaseTranslit == nullptr || tempUppercaseTranslit == nullptr ||
+        tempTitlecaseTranslit == nullptr || tempUnicodeTranslit == nullptr || 
 #if !UCONFIG_NO_BREAK_ITERATION
-        tempBreakTranslit == NULL ||
+        tempBreakTranslit == nullptr ||
 #endif
-        tempNameUnicodeTranslit == NULL )
+        tempNameUnicodeTranslit == nullptr )
     {
         delete tempNullTranslit;
         delete tempLowercaseTranslit;
@@ -1620,7 +1620,7 @@ UBool Transliterator::initializeRegistry(UErrorCode &status) {
 #endif
         // Since there was an error, remove registry
         delete registry;
-        registry = NULL;
+        registry = nullptr;
 
         status = U_MEMORY_ALLOCATION_ERROR;
         return 0;
@@ -1668,7 +1668,7 @@ U_CFUNC UBool utrans_transliterator_cleanup(void) {
     TransliteratorIDParser::cleanup();
     if (registry) {
         delete registry;
-        registry = NULL;
+        registry = nullptr;
     }
     return true;
 }
index 32040c63a644f89ecba0a058b814ecdb2bfbbf14..7979c6546f96856cc5457756959922f21c43a393 100644 (file)
@@ -123,7 +123,7 @@ Transliterator* TransliteratorAlias::create(UParseError& pe,
     if (U_FAILURE(ec)) {
         return 0;
     }
-    Transliterator *t = NULL;
+    Transliterator *t = nullptr;
     switch (type) {
     case SIMPLE:
         t = Transliterator::createInstance(aliasesOrRules, UTRANS_FORWARD, pe, ec);
@@ -259,7 +259,7 @@ TransliteratorSpec::TransliteratorSpec(const UnicodeString& theSpec)
     LocaleUtility::initLocaleFromName(theSpec, topLoc);
     if (!topLoc.isBogus()) {
         res = new ResourceBundle(U_ICUDATA_TRANSLIT, topLoc, status);
-        /* test for NULL */
+        /* test for nullptr */
         if (res == 0) {
             return;
         }
@@ -359,10 +359,10 @@ ResourceBundle& TransliteratorSpec::getBundle() const {
 #ifdef DEBUG_MEM
 
 // Vector of Entry pointers currently in use
-static UVector* DEBUG_entries = NULL;
+static UVector* DEBUG_entries = nullptr;
 
 static void DEBUG_setup() {
-    if (DEBUG_entries == NULL) {
+    if (DEBUG_entries == nullptr) {
         UErrorCode ec = U_ZERO_ERROR;
         DEBUG_entries = new UVector(ec);
     }
@@ -404,7 +404,7 @@ static void DEBUG_delEntry(TransliteratorEntry* e) {
 
 // Track object usage
 static void DEBUG_useEntry(TransliteratorEntry* e) {
-    if (e == NULL) return;
+    if (e == nullptr) return;
     DEBUG_setup();
     int i = DEBUG_findEntry(e);
     if (i < 0) {
@@ -474,7 +474,7 @@ private:
 
 TransliteratorEntry::TransliteratorEntry() {
     u.prototype = 0;
-    compoundFilter = NULL;
+    compoundFilter = nullptr;
     entryType = NONE;
     DEBUG_newEntry(this);
 }
@@ -490,7 +490,7 @@ TransliteratorEntry::~TransliteratorEntry() {
         // invalidates any RBTs that the user has instantiated.
         delete u.data;
     } else if (entryType == COMPOUND_RBT) {
-        while (u.dataVector != NULL && !u.dataVector->isEmpty())
+        while (u.dataVector != nullptr && !u.dataVector->isEmpty())
             delete (TransliterationRuleData*)u.dataVector->orphanElementAt(0);
         delete u.dataVector;
     }
@@ -537,7 +537,7 @@ TransliteratorRegistry::TransliteratorRegistry(UErrorCode& status) :
     variantList.setDeleter(uprv_deleteUObject);
     variantList.setComparer(uhash_compareCaselessUnicodeString);
     UnicodeString *emptyString = new UnicodeString();
-    if (emptyString != NULL) {
+    if (emptyString != nullptr) {
         variantList.adoptElement(emptyString, status);
     }
     availableIDs.setDeleter(uprv_deleteUObject);
@@ -552,7 +552,7 @@ TransliteratorRegistry::~TransliteratorRegistry() {
 Transliterator* TransliteratorRegistry::get(const UnicodeString& ID,
                                             TransliteratorAlias*& aliasReturn,
                                             UErrorCode& status) {
-    U_ASSERT(aliasReturn == NULL);
+    U_ASSERT(aliasReturn == nullptr);
     TransliteratorEntry *entry = find(ID);
     return (entry == 0) ? 0
         : instantiateEntry(ID, entry, aliasReturn, status);
@@ -562,7 +562,7 @@ Transliterator* TransliteratorRegistry::reget(const UnicodeString& ID,
                                               TransliteratorParser& parser,
                                               TransliteratorAlias*& aliasReturn,
                                               UErrorCode& status) {
-    U_ASSERT(aliasReturn == NULL);
+    U_ASSERT(aliasReturn == nullptr);
     TransliteratorEntry *entry = find(ID);
 
     if (entry == 0) {
@@ -591,7 +591,7 @@ Transliterator* TransliteratorRegistry::reget(const UnicodeString& ID,
         if (parser.idBlockVector.isEmpty() && parser.dataVector.isEmpty()) {
             entry->u.data = 0;
             entry->entryType = TransliteratorEntry::ALIAS;
-            entry->stringArg = UNICODE_STRING_SIMPLE("Any-NULL");
+            entry->stringArg = UNICODE_STRING_SIMPLE("Any-nullptr");
         }
         else if (parser.idBlockVector.isEmpty() && parser.dataVector.size() == 1) {
             entry->u.data = (TransliterationRuleData*)parser.dataVector.orphanElementAt(0);
@@ -642,7 +642,7 @@ void TransliteratorRegistry::put(Transliterator* adoptedProto,
                                  UErrorCode& ec)
 {
     TransliteratorEntry *entry = new TransliteratorEntry();
-    if (entry == NULL) {
+    if (entry == nullptr) {
         ec = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -656,7 +656,7 @@ void TransliteratorRegistry::put(const UnicodeString& ID,
                                  UBool visible,
                                  UErrorCode& ec) {
     TransliteratorEntry *entry = new TransliteratorEntry();
-    if (entry == NULL) {
+    if (entry == nullptr) {
         ec = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -671,7 +671,7 @@ void TransliteratorRegistry::put(const UnicodeString& ID,
                                  UBool visible,
                                  UErrorCode& ec) {
     TransliteratorEntry *entry = new TransliteratorEntry();
-    if (entry == NULL) {
+    if (entry == nullptr) {
         ec = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -693,7 +693,7 @@ void TransliteratorRegistry::put(const UnicodeString& ID,
                                  UErrorCode& /*ec*/) {
     TransliteratorEntry *entry = new TransliteratorEntry();
     // Null pointer check
-    if (entry != NULL) {
+    if (entry != nullptr) {
         entry->entryType = TransliteratorEntry::ALIAS;
         if (readonlyAliasAlias) {
             entry->stringArg.setTo(true, alias.getBuffer(), -1);
@@ -832,7 +832,7 @@ UnicodeString& TransliteratorRegistry::getAvailableVariant(int32_t index,
         if (varMask & 1) {
             if (varCount == index) {
                 UnicodeString *v = (UnicodeString*) variantList.elementAt(varListIndex);
-                if (v != NULL) {
+                if (v != nullptr) {
                     result = *v;
                     return result;
                 }
@@ -873,7 +873,7 @@ const UnicodeString* TransliteratorRegistry::Enumeration::snext(UErrorCode& stat
     // doing as long as there is some possibility of removing this code in favor
     // of some new code based on Doug's service framework.
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     int32_t n = reg.availableIDs.size();
     if (index > n) {
@@ -885,7 +885,7 @@ const UnicodeString* TransliteratorRegistry::Enumeration::snext(UErrorCode& stat
         unistr = *(const UnicodeString*)reg.availableIDs[index++];
         return &unistr;
     } else {
-        return NULL;
+        return nullptr;
     }
 }
 
@@ -948,7 +948,7 @@ void TransliteratorRegistry::registerEntry(const UnicodeString& ID,
         if (!availableIDs.contains((void*) &ID)) {
             UnicodeString *newID = ID.clone();
             // Check to make sure newID was created.
-            if (newID != NULL) {
+            if (newID != nullptr) {
                 // NUL-terminate the ID string
                 newID->getTerminatedBuffer();
                 availableIDs.adoptElement(newID, status);
@@ -979,7 +979,7 @@ void TransliteratorRegistry::registerSTV(const UnicodeString& source,
             size = LAT_TARGETS_INIT_SIZE;
         }
         targets = new Hashtable(true, size, status);
-        if (U_FAILURE(status) || targets == NULL) {
+        if (U_FAILURE(status) || targets == nullptr) {
             return;
         }
         specDAG.put(source, targets, status);
@@ -991,7 +991,7 @@ void TransliteratorRegistry::registerSTV(const UnicodeString& source,
             return;
         }
         UnicodeString *variantEntry = new UnicodeString(variant);
-        if (variantEntry != NULL) {
+        if (variantEntry != nullptr) {
             variantList.adoptElement(variantEntry, status);
             if (U_SUCCESS(status)) {
                 variantListIndex = variantList.size() - 1;
@@ -1016,7 +1016,7 @@ void TransliteratorRegistry::removeSTV(const UnicodeString& source,
     // assert(target.length() > 0);
     UErrorCode status = U_ZERO_ERROR;
     Hashtable *targets = (Hashtable*) specDAG.get(source);
-    if (targets == NULL) {
+    if (targets == nullptr) {
         return; // should never happen for valid s-t/v
     }
     uint32_t varMask = targets->geti(target);
@@ -1158,7 +1158,7 @@ TransliteratorEntry* TransliteratorRegistry::findInBundle(const TransliteratorSp
 
     if (pass==2) {
         // Failed
-        return NULL;
+        return nullptr;
     }
 
     // We have succeeded in loading a string from the locale
@@ -1322,9 +1322,9 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID
         {
             UVector* rbts = new UVector(uprv_deleteUObject, nullptr, entry->u.dataVector->size(), status);
             // Check for null pointer
-            if (rbts == NULL) {
+            if (rbts == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
-                return NULL;
+                return nullptr;
             }
             int32_t passNumber = 1;
             for (int32_t i = 0; U_SUCCESS(status) && i < entry->u.dataVector->size(); i++) {
index 686e62ae33cd332db8b797d2c3cc9cc2483a8d3b..3fd06935a1dc015ad1edabc97e01c5ce44ebe024 100644 (file)
@@ -163,13 +163,13 @@ class TransliteratorRegistry : public UMemory {
      * compound) attempt to instantiate it from the registry.  Return
      * 0 on failure.
      *
-     * Return a non-NULL aliasReturn value if the ID points to an alias.
+     * Return a non-nullptr aliasReturn value if the ID points to an alias.
      * We cannot instantiate it ourselves because the alias may contain
      * filters or compounds, which we do not understand.  Caller should
-     * make aliasReturn NULL before calling.
+     * make aliasReturn nullptr before calling.
      * @param ID          the given ID
      * @param aliasReturn output param to receive TransliteratorAlias;
-     *                    should be NULL on entry
+     *                    should be nullptr on entry
      * @param parseError  Struct to receive information on position
      *                    of error if an error is encountered
      * @param status      Output param set to success/failure code.
@@ -191,7 +191,7 @@ class TransliteratorRegistry : public UMemory {
      * from within the TransliteratorRegistry mutex.
      *
      * @param aliasReturn output param to receive TransliteratorAlias;
-     *                    should be NULL on entry
+     *                    should be nullptr on entry
      */
     Transliterator* reget(const UnicodeString& ID,
                           TransliteratorParser& parser,
index a52f928759cf754b1a34d309029df8ddfc3c704b..0c6602c13d6ccd36715c0919e3aa26b4e1d04344 100644 (file)
@@ -44,7 +44,7 @@ static const UChar ANY_NULL[]  = {65,110,121,45,78,117,108,108,0}; // "Any-Null"
 static const int32_t FORWARD = UTRANS_FORWARD;
 static const int32_t REVERSE = UTRANS_REVERSE;
 
-static Hashtable* SPECIAL_INVERSES = NULL;
+static Hashtable* SPECIAL_INVERSES = nullptr;
 static UInitOnce gSpecialInversesInitOnce {};
 
 /**
@@ -81,7 +81,7 @@ Transliterator* TransliteratorIDParser::SingleID::createInstance() {
     } else {
         t = createBasicInstance(basicID, &canonID);
     }
-    if (t != NULL) {
+    if (t != nullptr) {
         if (filter.length() != 0) {
             UErrorCode ec = U_ZERO_ERROR;
             UnicodeSet *set = new UnicodeSet(filter, ec);
@@ -106,7 +106,7 @@ Transliterator* TransliteratorIDParser::SingleID::createInstance() {
  * the last character parsed.
  * @param dir the direction.  If the direction is REVERSE then the
  * SingleID is constructed for the reverse direction.
- * @return a SingleID object or NULL
+ * @return a SingleID object or nullptr
  */
 TransliteratorIDParser::SingleID*
 TransliteratorIDParser::parseSingleID(const UnicodeString& id, int32_t& pos,
@@ -116,8 +116,8 @@ TransliteratorIDParser::parseSingleID(const UnicodeString& id, int32_t& pos,
 
     // The ID will be of the form A, A(), A(B), or (B), where
     // A and B are filter IDs.
-    Specs* specsA = NULL;
-    Specs* specsB = NULL;
+    Specs* specsA = nullptr;
+    Specs* specsB = nullptr;
     UBool sawParen = false;
 
     // On the first pass, look for (B) or ().  If this fails, then
@@ -125,9 +125,9 @@ TransliteratorIDParser::parseSingleID(const UnicodeString& id, int32_t& pos,
     for (int32_t pass=1; pass<=2; ++pass) {
         if (pass == 2) {
             specsA = parseFilterID(id, pos, true);
-            if (specsA == NULL) {
+            if (specsA == nullptr) {
                 pos = start;
-                return NULL;
+                return nullptr;
             }
         }
         if (ICU_Utility::parseChar(id, pos, OPEN_REV)) {
@@ -135,10 +135,10 @@ TransliteratorIDParser::parseSingleID(const UnicodeString& id, int32_t& pos,
             if (!ICU_Utility::parseChar(id, pos, CLOSE_REV)) {
                 specsB = parseFilterID(id, pos, true);
                 // Must close with a ')'
-                if (specsB == NULL || !ICU_Utility::parseChar(id, pos, CLOSE_REV)) {
+                if (specsB == nullptr || !ICU_Utility::parseChar(id, pos, CLOSE_REV)) {
                     delete specsA;
                     pos = start;
-                    return NULL;
+                    return nullptr;
                 }
             }
             break;
@@ -152,15 +152,15 @@ TransliteratorIDParser::parseSingleID(const UnicodeString& id, int32_t& pos,
             SingleID* b = specsToID(specsB, FORWARD);
             single = specsToID(specsA, FORWARD);
             // Null pointers check
-            if (b == NULL || single == NULL) {
+            if (b == nullptr || single == nullptr) {
                delete b;
                delete single;
                status = U_MEMORY_ALLOCATION_ERROR;
-               return NULL;
+               return nullptr;
             }
             single->canonID.append(OPEN_REV)
                 .append(b->canonID).append(CLOSE_REV);
-            if (specsA != NULL) {
+            if (specsA != nullptr) {
                 single->filter = specsA->filter;
             }
             delete b;
@@ -168,33 +168,33 @@ TransliteratorIDParser::parseSingleID(const UnicodeString& id, int32_t& pos,
             SingleID* a = specsToID(specsA, FORWARD);
             single = specsToID(specsB, FORWARD);
             // Check for null pointer.
-            if (a == NULL || single == NULL) {
+            if (a == nullptr || single == nullptr) {
                delete a;
                delete single;
                status = U_MEMORY_ALLOCATION_ERROR;
-               return NULL;
+               return nullptr;
             }
             single->canonID.append(OPEN_REV)
                 .append(a->canonID).append(CLOSE_REV);
-            if (specsB != NULL) {
+            if (specsB != nullptr) {
                 single->filter = specsB->filter;
             }
             delete a;
         }
     } else {
-        // assert(specsA != NULL);
+        // assert(specsA != nullptr);
         if (dir == FORWARD) {
             single = specsToID(specsA, FORWARD);
         } else {
             single = specsToSpecialInverse(*specsA, status);
-            if (single == NULL) {
+            if (single == nullptr) {
                 single = specsToID(specsA, REVERSE);
             }
         }
-        // Check for NULL pointer
-        if (single == NULL) {
+        // Check for nullptr pointer
+        if (single == nullptr) {
                status = U_MEMORY_ALLOCATION_ERROR;
-               return NULL;
+               return nullptr;
         }
         single->filter = specsA->filter;
     }
@@ -220,14 +220,14 @@ TransliteratorIDParser::parseFilterID(const UnicodeString& id, int32_t& pos) {
     int32_t start = pos;
 
     Specs* specs = parseFilterID(id, pos, true);
-    if (specs == NULL) {
+    if (specs == nullptr) {
         pos = start;
-        return NULL;
+        return nullptr;
     }
 
     // Assemble return results
     SingleID* single = specsToID(specs, FORWARD);
-    if (single != NULL) {
+    if (single != nullptr) {
         single->filter = specs->filter;
     }
     delete specs;
@@ -250,8 +250,8 @@ TransliteratorIDParser::parseFilterID(const UnicodeString& id, int32_t& pos) {
  * added to the canonID, either at the end, if dir is FORWARD, or
  * at the start, if dir is REVERSE.  The pattern will be enclosed
  * in parentheses if appropriate, and will be suffixed with an
- * ID_DELIM character.  May be NULL.
- * @return a UnicodeSet object or NULL.  A non-NULL results
+ * ID_DELIM character.  May be nullptr.
+ * @return a UnicodeSet object or nullptr.  A non-nullptr results
  * indicates a successful parse, regardless of whether the filter
  * applies to the given direction.  The caller should discard it
  * if withParens != (dir == REVERSE).
@@ -260,7 +260,7 @@ UnicodeSet* TransliteratorIDParser::parseGlobalFilter(const UnicodeString& id, i
                                                       int32_t dir,
                                                       int32_t& withParens,
                                                       UnicodeString* canonID) {
-    UnicodeSet* filter = NULL;
+    UnicodeSet* filter = nullptr;
     int32_t start = pos;
 
     if (withParens == -1) {
@@ -268,7 +268,7 @@ UnicodeSet* TransliteratorIDParser::parseGlobalFilter(const UnicodeString& id, i
     } else if (withParens == 1) {
         if (!ICU_Utility::parseChar(id, pos, OPEN_REV)) {
             pos = start;
-            return NULL;
+            return nullptr;
         }
     }
 
@@ -277,8 +277,8 @@ UnicodeSet* TransliteratorIDParser::parseGlobalFilter(const UnicodeString& id, i
     if (UnicodeSet::resemblesPattern(id, pos)) {
         ParsePosition ppos(pos);
         UErrorCode ec = U_ZERO_ERROR;
-        filter = new UnicodeSet(id, ppos, USET_IGNORE_SPACE, NULL, ec);
-        /* test for NULL */
+        filter = new UnicodeSet(id, ppos, USET_IGNORE_SPACE, nullptr, ec);
+        /* test for nullptr */
         if (filter == 0) {
             pos = start;
             return 0;
@@ -286,7 +286,7 @@ UnicodeSet* TransliteratorIDParser::parseGlobalFilter(const UnicodeString& id, i
         if (U_FAILURE(ec)) {
             delete filter;
             pos = start;
-            return NULL;
+            return nullptr;
         }
 
         UnicodeString pattern;
@@ -296,13 +296,13 @@ UnicodeSet* TransliteratorIDParser::parseGlobalFilter(const UnicodeString& id, i
         if (withParens == 1 && !ICU_Utility::parseChar(id, pos, CLOSE_REV)) {
             delete filter;
             pos = start;
-            return NULL;
+            return nullptr;
         }
 
         // In the forward direction, append the pattern to the
         // canonID.  In the reverse, insert it at zero, and invert
         // the presence of parens ("A" <-> "(A)").
-        if (canonID != NULL) {
+        if (canonID != nullptr) {
             if (dir == FORWARD) {
                 if (withParens == 1) {
                     pattern.insert(0, OPEN_REV);
@@ -351,7 +351,7 @@ U_CDECL_END
  * discarded.
  * @param globalFilter OUTPUT parameter that receives a pointer to
  * a newly created global filter for this ID in this direction, or
- * NULL if there is none.
+ * nullptr if there is none.
  * @return true if the parse succeeds, that is, if the entire
  * id is consumed without syntax error.
  */
@@ -367,13 +367,13 @@ UBool TransliteratorIDParser::parseCompoundID(const UnicodeString& id, int32_t d
     UObjectDeleter *save = list.setDeleter(_deleteSingleID);
 
     UnicodeSet* filter;
-    globalFilter = NULL;
+    globalFilter = nullptr;
     canonID.truncate(0);
 
     // Parse leading global filter, if any
     withParens = 0; // parens disallowed
     filter = parseGlobalFilter(id, pos, dir, withParens, &canonID);
-    if (filter != NULL) {
+    if (filter != nullptr) {
         if (!ICU_Utility::parseChar(id, pos, ID_DELIM)) {
             // Not a global filter; backup and resume
             canonID.truncate(0);
@@ -384,13 +384,13 @@ UBool TransliteratorIDParser::parseCompoundID(const UnicodeString& id, int32_t d
         } else {
             delete filter;
         }
-        filter = NULL;
+        filter = nullptr;
     }
 
     UBool sawDelimiter = true;
     for (;;) {
         SingleID* single = parseSingleID(id, pos, dir, ec);
-        if (single == NULL) {
+        if (single == nullptr) {
             break;
         }
         if (dir == FORWARD) {
@@ -425,7 +425,7 @@ UBool TransliteratorIDParser::parseCompoundID(const UnicodeString& id, int32_t d
     if (sawDelimiter) {
         withParens = 1; // parens required
         filter = parseGlobalFilter(id, pos, dir, withParens, &canonID);
-        if (filter != NULL) {
+        if (filter != nullptr) {
             // Don't require trailing ';', but parse it if present
             ICU_Utility::parseChar(id, pos, ID_DELIM);
 
@@ -434,7 +434,7 @@ UBool TransliteratorIDParser::parseCompoundID(const UnicodeString& id, int32_t d
             } else {
                 delete filter;
             }
-            filter = NULL;
+            filter = nullptr;
         }
     }
 
@@ -451,7 +451,7 @@ UBool TransliteratorIDParser::parseCompoundID(const UnicodeString& id, int32_t d
     list.removeAllElements();
     list.setDeleter(save);
     delete globalFilter;
-    globalFilter = NULL;
+    globalFilter = nullptr;
     return false;
 }
 
@@ -459,7 +459,7 @@ UBool TransliteratorIDParser::parseCompoundID(const UnicodeString& id, int32_t d
  * Convert the elements of the 'list' vector, which are SingleID
  * objects, into actual Transliterator objects.  In the course of
  * this, some (or all) entries may be removed.  If all entries
- * are removed, the NULL transliterator will be added.
+ * are removed, the nullptr transliterator will be added.
  *
  * Delete entries with empty basicIDs; these are generated by
  * elements like "(A)" in the forward direction, or "A()" in
@@ -492,7 +492,7 @@ void TransliteratorIDParser::instantiateList(UVector& list,
         SingleID* single = (SingleID*) list.elementAt(i);
         if (single->basicID.length() != 0) {
             t = single->createInstance();
-            if (t == NULL) {
+            if (t == nullptr) {
                 ec = U_INVALID_ID;
                 goto RETURN;
             }
@@ -503,10 +503,10 @@ void TransliteratorIDParser::instantiateList(UVector& list,
         }
     }
 
-    // An empty list is equivalent to a NULL transliterator.
+    // An empty list is equivalent to a nullptr transliterator.
     if (tlist.size() == 0) {
-        t = createBasicInstance(UnicodeString(true, ANY_NULL, 8), NULL);
-        if (t == NULL) {
+        t = createBasicInstance(UnicodeString(true, ANY_NULL, 8), nullptr);
+        if (t == nullptr) {
             // Should never happen
             ec = U_INTERNAL_TRANSLITERATOR_ERROR;
         }
@@ -541,8 +541,8 @@ void TransliteratorIDParser::instantiateList(UVector& list,
  * @param id the id string, in any of several forms
  * @return an array of 4 strings: source, target, variant, and
  * isSourcePresent.  If the source is not present, ANY will be
- * given as the source, and isSourcePresent will be NULL.  Otherwise
- * isSourcePresent will be non-NULL.  The target may be empty if the
+ * given as the source, and isSourcePresent will be nullptr.  Otherwise
+ * isSourcePresent will be non-nullptr.  The target may be empty if the
  * id is not well-formed.  The variant may be empty.
  */
 void TransliteratorIDParser::IDtoSTV(const UnicodeString& id,
@@ -660,14 +660,14 @@ void TransliteratorIDParser::registerSpecialInverse(const UnicodeString& target,
     Mutex lock(&LOCK);
 
     UnicodeString *tempus = new UnicodeString(inverseTarget);  // Used for null pointer check before usage.
-    if (tempus == NULL) {
+    if (tempus == nullptr) {
        status = U_MEMORY_ALLOCATION_ERROR;
        return;
     }
     SPECIAL_INVERSES->put(target, tempus, status);
     if (bidirectional) {
        tempus = new UnicodeString(target);
-       if (tempus == NULL) {
+       if (tempus == nullptr) {
                status = U_MEMORY_ALLOCATION_ERROR;
                return;
        }
@@ -691,12 +691,12 @@ void TransliteratorIDParser::registerSpecialInverse(const UnicodeString& target,
  * @param allowFilter2 if true, a UnicodeSet pattern is allowed
  * at any location between specs or delimiters, and is returned
  * as the fifth string in the array.
- * @return a Specs object, or NULL if the parse failed.  If
+ * @return a Specs object, or nullptr if the parse failed.  If
  * neither source nor target was seen in the parsed id, then the
  * parse fails.  If allowFilter is true, then the parsed filter
  * pattern is returned in the Specs object, otherwise the returned
- * filter reference is NULL.  If the parse fails for any reason
- * NULL is returned.
+ * filter reference is nullptr.  If the parse fails for any reason
+ * nullptr is returned.
  */
 TransliteratorIDParser::Specs*
 TransliteratorIDParser::parseFilterID(const UnicodeString& id, int32_t& pos,
@@ -725,10 +725,10 @@ TransliteratorIDParser::parseFilterID(const UnicodeString& id, int32_t& pos,
 
             ParsePosition ppos(pos);
             UErrorCode ec = U_ZERO_ERROR;
-            UnicodeSet set(id, ppos, USET_IGNORE_SPACE, NULL, ec);
+            UnicodeSet set(id, ppos, USET_IGNORE_SPACE, nullptr, ec);
             if (U_FAILURE(ec)) {
                 pos = start;
-                return NULL;
+                return nullptr;
             }
             id.extractBetween(pos, ppos.getIndex(), filter);
             pos = ppos.getIndex();
@@ -788,7 +788,7 @@ TransliteratorIDParser::parseFilterID(const UnicodeString& id, int32_t& pos,
     // Must have either source or target
     if (source.length() == 0 && target.length() == 0) {
         pos = start;
-        return NULL;
+        return nullptr;
     }
 
     // Empty source or target defaults to ANY
@@ -808,15 +808,15 @@ TransliteratorIDParser::parseFilterID(const UnicodeString& id, int32_t& pos,
  * Givens a Spec object, convert it to a SingleID object.  The
  * Spec object is a more unprocessed parse result.  The SingleID
  * object contains information about canonical and basic IDs.
- * @return a SingleID; never returns NULL.  Returned object always
- * has 'filter' field of NULL.
+ * @return a SingleID; never returns nullptr.  Returned object always
+ * has 'filter' field of nullptr.
  */
 TransliteratorIDParser::SingleID*
 TransliteratorIDParser::specsToID(const Specs* specs, int32_t dir) {
     UnicodeString canonID;
     UnicodeString basicID;
     UnicodeString basicPrefix;
-    if (specs != NULL) {
+    if (specs != nullptr) {
         UnicodeString buf;
         if (dir == FORWARD) {
             if (specs->sawSource) {
@@ -845,18 +845,18 @@ TransliteratorIDParser::specsToID(const Specs* specs, int32_t dir) {
 /**
  * Given a Specs object, return a SingleID representing the
  * special inverse of that ID.  If there is no special inverse
- * then return NULL.
- * @return a SingleID or NULL.  Returned object always has
- * 'filter' field of NULL.
+ * then return nullptr.
+ * @return a SingleID or nullptr.  Returned object always has
+ * 'filter' field of nullptr.
  */
 TransliteratorIDParser::SingleID*
 TransliteratorIDParser::specsToSpecialInverse(const Specs& specs, UErrorCode &status) {
     if (0!=specs.source.caseCompare(ANY, 3, U_FOLD_CASE_DEFAULT)) {
-        return NULL;
+        return nullptr;
     }
     umtx_initOnce(gSpecialInversesInitOnce, init, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     UnicodeString* inverseTarget;
@@ -865,7 +865,7 @@ TransliteratorIDParser::specsToSpecialInverse(const Specs& specs, UErrorCode &st
     inverseTarget = (UnicodeString*) SPECIAL_INVERSES->get(specs.target);
     umtx_unlock(&LOCK);
 
-    if (inverseTarget != NULL) {
+    if (inverseTarget != nullptr) {
         // If the original ID contained "Any-" then make the
         // special inverse "Any-Foo"; otherwise make it "Foo".
         // So "Any-NFC" => "Any-NFD" but "NFC" => "NFD".
@@ -887,7 +887,7 @@ TransliteratorIDParser::specsToSpecialInverse(const Specs& specs, UErrorCode &st
         }
         return new SingleID(buf, basicID);
     }
-    return NULL;
+    return nullptr;
 }
 
 /**
@@ -903,11 +903,11 @@ Transliterator* TransliteratorIDParser::createBasicInstance(const UnicodeString&
  * Initialize static memory. Called through umtx_initOnce only.
  */
 void U_CALLCONV TransliteratorIDParser::init(UErrorCode &status) {
-    U_ASSERT(SPECIAL_INVERSES == NULL);
+    U_ASSERT(SPECIAL_INVERSES == nullptr);
     ucln_i18n_registerCleanup(UCLN_I18N_TRANSLITERATOR, utrans_transliterator_cleanup);
 
     SPECIAL_INVERSES = new Hashtable(true, status);
-    if (SPECIAL_INVERSES == NULL) {
+    if (SPECIAL_INVERSES == nullptr) {
        status = U_MEMORY_ALLOCATION_ERROR;
        return;
     }
@@ -920,7 +920,7 @@ void U_CALLCONV TransliteratorIDParser::init(UErrorCode &status) {
 void TransliteratorIDParser::cleanup() {
     if (SPECIAL_INVERSES) {
         delete SPECIAL_INVERSES;
-        SPECIAL_INVERSES = NULL;
+        SPECIAL_INVERSES = nullptr;
     }
     gSpecialInversesInitOnce.reset();
 }
index 2199986f615e99acbd7277f7282d2fcdb94c0a37..256437a91821c21e5bbe557ae1cd4b35b80888e5 100644 (file)
@@ -144,10 +144,10 @@ static const int32_t ALL_GENERIC_NAME_TYPES = UTZGNM_LOCATION | UTZGNM_LONG | UT
 #define MAX_OFFSET_DIGITS 6
 
 // Time Zone ID/Short ID trie
-static TextTrieMap *gZoneIdTrie = NULL;
+static TextTrieMap *gZoneIdTrie = nullptr;
 static icu::UInitOnce gZoneIdTrieInitOnce {};
 
-static TextTrieMap *gShortZoneIdTrie = NULL;
+static TextTrieMap *gShortZoneIdTrie = nullptr;
 static icu::UInitOnce gShortZoneIdTrieInitOnce {};
 
 static UMutex gLock;
@@ -158,16 +158,16 @@ U_CDECL_BEGIN
  */
 static UBool U_CALLCONV tzfmt_cleanup(void)
 {
-    if (gZoneIdTrie != NULL) {
+    if (gZoneIdTrie != nullptr) {
         delete gZoneIdTrie;
     }
-    gZoneIdTrie = NULL;
+    gZoneIdTrie = nullptr;
     gZoneIdTrieInitOnce.reset();
 
-    if (gShortZoneIdTrie != NULL) {
+    if (gShortZoneIdTrie != nullptr) {
         delete gShortZoneIdTrie;
     }
-    gShortZoneIdTrie = NULL;
+    gShortZoneIdTrie = nullptr;
     gShortZoneIdTrieInitOnce.reset();
 
     return true;
@@ -209,7 +209,7 @@ private:
 };
 
 GMTOffsetField::GMTOffsetField()
-: fText(NULL), fType(TEXT), fWidth(0) {
+: fText(nullptr), fType(TEXT), fWidth(0) {
 }
 
 GMTOffsetField::~GMTOffsetField() {
@@ -221,20 +221,20 @@ GMTOffsetField::~GMTOffsetField() {
 GMTOffsetField*
 GMTOffsetField::createText(const UnicodeString& text, UErrorCode& status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     GMTOffsetField* result = new GMTOffsetField();
-    if (result == NULL) {
+    if (result == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     int32_t len = text.length();
     result->fText = (UChar*)uprv_malloc((len + 1) * sizeof(UChar));
-    if (result->fText == NULL) {
+    if (result->fText == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         delete result;
-        return NULL;
+        return nullptr;
     }
     u_strncpy(result->fText, text.getBuffer(), len);
     result->fText[len] = 0;
@@ -247,12 +247,12 @@ GMTOffsetField*
 GMTOffsetField::createTimeField(FieldType type, uint8_t width, UErrorCode& status) {
     U_ASSERT(type != TEXT);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     GMTOffsetField* result = new GMTOffsetField();
-    if (result == NULL) {
+    if (result == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     result->fType = type;
@@ -317,11 +317,11 @@ U_CDECL_END
 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TimeZoneFormat)
 
 TimeZoneFormat::TimeZoneFormat(const Locale& locale, UErrorCode& status) 
-: fLocale(locale), fTimeZoneNames(NULL), fTimeZoneGenericNames(NULL),
-  fDefParseOptionFlags(0), fTZDBTimeZoneNames(NULL) {
+: fLocale(locale), fTimeZoneNames(nullptr), fTimeZoneGenericNames(nullptr),
+  fDefParseOptionFlags(0), fTZDBTimeZoneNames(nullptr) {
 
     for (int32_t i = 0; i < UTZFMT_PAT_COUNT; i++) {
-        fGMTOffsetPatternItems[i] = NULL;
+        fGMTOffsetPatternItems[i] = nullptr;
     }
 
     const char* region = fLocale.getCountry();
@@ -351,11 +351,11 @@ TimeZoneFormat::TimeZoneFormat(const Locale& locale, UErrorCode& status)
         return;
     }
 
-    const UChar* gmtPattern = NULL;
-    const UChar* hourFormats = NULL;
+    const UChar* gmtPattern = nullptr;
+    const UChar* hourFormats = nullptr;
 
     UResourceBundle *zoneBundle = ures_open(U_ICUDATA_ZONE, locale.getName(), &status);
-    UResourceBundle *zoneStringsArray = ures_getByKeyWithFallback(zoneBundle, gZoneStringsTag, NULL, &status);
+    UResourceBundle *zoneStringsArray = ures_getByKeyWithFallback(zoneBundle, gZoneStringsTag, nullptr, &status);
     if (U_SUCCESS(status)) {
         const UChar* resStr;
         int32_t len;
@@ -375,7 +375,7 @@ TimeZoneFormat::TimeZoneFormat(const Locale& locale, UErrorCode& status)
         ures_close(zoneBundle);
     }
 
-    if (gmtPattern == NULL) {
+    if (gmtPattern == nullptr) {
         gmtPattern = DEFAULT_GMT_PATTERN;
     }
     initGMTPattern(UnicodeString(true, gmtPattern, -1), status);
@@ -383,7 +383,7 @@ TimeZoneFormat::TimeZoneFormat(const Locale& locale, UErrorCode& status)
     UBool useDefaultOffsetPatterns = true;
     if (hourFormats) {
         UChar *sep = u_strchr(hourFormats, (UChar)0x003B /* ';' */);
-        if (sep != NULL) {
+        if (sep != nullptr) {
             UErrorCode tmpStatus = U_ZERO_ERROR;
             fGMTOffsetPatterns[UTZFMT_PAT_POSITIVE_HM].setTo(false, hourFormats, (int32_t)(sep - hourFormats));
             fGMTOffsetPatterns[UTZFMT_PAT_NEGATIVE_HM].setTo(true, sep + 1, -1);
@@ -419,11 +419,11 @@ TimeZoneFormat::TimeZoneFormat(const Locale& locale, UErrorCode& status)
 }
 
 TimeZoneFormat::TimeZoneFormat(const TimeZoneFormat& other)
-: Format(other), fTimeZoneNames(NULL), fTimeZoneGenericNames(NULL),
-  fTZDBTimeZoneNames(NULL) {
+: Format(other), fTimeZoneNames(nullptr), fTimeZoneGenericNames(nullptr),
+  fTZDBTimeZoneNames(nullptr) {
 
     for (int32_t i = 0; i < UTZFMT_PAT_COUNT; i++) {
-        fGMTOffsetPatternItems[i] = NULL;
+        fGMTOffsetPatternItems[i] = nullptr;
     }
     *this = other;
 }
@@ -446,9 +446,9 @@ TimeZoneFormat::operator=(const TimeZoneFormat& other) {
 
     delete fTimeZoneNames;
     delete fTimeZoneGenericNames;
-    fTimeZoneGenericNames = NULL;
+    fTimeZoneGenericNames = nullptr;
     delete fTZDBTimeZoneNames;
-    fTZDBTimeZoneNames = NULL;
+    fTZDBTimeZoneNames = nullptr;
 
     fLocale = other.fLocale;
     uprv_memcpy(fTargetRegion, other.fTargetRegion, sizeof(fTargetRegion));
@@ -467,7 +467,7 @@ TimeZoneFormat::operator=(const TimeZoneFormat& other) {
     for (int32_t i = 0; i < UTZFMT_PAT_COUNT; i++) {
         fGMTOffsetPatterns[i] = other.fGMTOffsetPatterns[i];
         delete fGMTOffsetPatternItems[i];
-        fGMTOffsetPatternItems[i] = NULL;
+        fGMTOffsetPatternItems[i] = nullptr;
     }
     initGMTOffsetPatterns(status);
     U_ASSERT(U_SUCCESS(status));
@@ -517,7 +517,7 @@ TimeZoneFormat::createInstance(const Locale& locale, UErrorCode& status) {
         return tzfmt;
     }
     delete tzfmt;
-    return NULL;
+    return nullptr;
 }
 
 // ------------------------------------------------------------------
@@ -599,7 +599,7 @@ TimeZoneFormat::setGMTOffsetPattern(UTimeZoneFormatGMTOffsetPatternType type, co
     }
 
     UVector* patternItems = parseOffsetPattern(pattern, required, status);
-    if (patternItems == NULL) {
+    if (patternItems == nullptr) {
         return;
     }
 
@@ -652,7 +652,7 @@ TimeZoneFormat::setGMTZeroFormat(const UnicodeString& gmtZeroFormat, UErrorCode&
 
 UnicodeString&
 TimeZoneFormat::format(UTimeZoneFormatStyle style, const TimeZone& tz, UDate date,
-        UnicodeString& name, UTimeZoneFormatTimeType* timeType /* = NULL */) const {
+        UnicodeString& name, UTimeZoneFormatTimeType* timeType /* = nullptr */) const {
     if (timeType) {
         *timeType = UTZFMT_TIME_TYPE_UNKNOWN;
     }
@@ -683,7 +683,7 @@ TimeZoneFormat::format(UTimeZoneFormatStyle style, const TimeZone& tz, UDate dat
     case UTZFMT_STYLE_ZONE_ID_SHORT:
         {
             const UChar* shortID = ZoneMeta::getShortID(tz);
-            if (shortID == NULL) {
+            if (shortID == nullptr) {
                 shortID = UNKNOWN_SHORT_ZONE_ID;
             }
             name.setTo(shortID, -1);
@@ -785,14 +785,14 @@ TimeZoneFormat::format(const Formattable& obj, UnicodeString& appendTo,
     if (obj.getType() == Formattable::kObject) {
         const UObject* formatObj = obj.getObject();
         const TimeZone* tz = dynamic_cast<const TimeZone*>(formatObj);
-        if (tz == NULL) {
+        if (tz == nullptr) {
             const Calendar* cal = dynamic_cast<const Calendar*>(formatObj);
-            if (cal != NULL) {
+            if (cal != nullptr) {
                 tz = &cal->getTimeZone();
                 date = cal->getTime(status);
             }
         }
-        if (tz != NULL) {
+        if (tz != nullptr) {
             int32_t rawOffset, dstOffset;
             tz->getOffset(date, false, rawOffset, dstOffset, status);
             UChar buf[ZONE_NAME_U16_MAX];
@@ -812,13 +812,13 @@ TimeZoneFormat::format(const Formattable& obj, UnicodeString& appendTo,
 
 TimeZone*
 TimeZoneFormat::parse(UTimeZoneFormatStyle style, const UnicodeString& text, ParsePosition& pos,
-        UTimeZoneFormatTimeType* timeType /*= NULL*/) const {
+        UTimeZoneFormatTimeType* timeType /*= nullptr*/) const {
     return parse(style, text, pos, getDefaultParseOptions(), timeType);
 }
 
 TimeZone*
 TimeZoneFormat::parse(UTimeZoneFormatStyle style, const UnicodeString& text, ParsePosition& pos,
-        int32_t parseOptions, UTimeZoneFormatTimeType* timeType /* = NULL */) const {
+        int32_t parseOptions, UTimeZoneFormatTimeType* timeType /* = nullptr */) const {
     if (timeType) {
         *timeType = UTZFMT_TIME_TYPE_UNKNOWN;
     }
@@ -955,7 +955,7 @@ TimeZoneFormat::parse(UTimeZoneFormatStyle style, const UnicodeString& text, Par
             LocalPointer<TimeZoneNames::MatchInfoCollection> specificMatches(fTimeZoneNames->find(text, startIdx, nameTypes, status));
             if (U_FAILURE(status)) {
                 pos.setErrorIndex(startIdx);
-                return NULL;
+                return nullptr;
             }
             if (!specificMatches.isNull()) {
                 int32_t matchIdx = -1;
@@ -988,7 +988,7 @@ TimeZoneFormat::parse(UTimeZoneFormatStyle style, const UnicodeString& text, Par
                         tzdbTimeZoneNames->find(text, startIdx, nameTypes, status));
                     if (U_FAILURE(status)) {
                         pos.setErrorIndex(startIdx);
-                        return NULL;
+                        return nullptr;
                     }
                     if (!tzdbNameMatches.isNull()) {
                         int32_t matchIdx = -1;
@@ -1044,7 +1044,7 @@ TimeZoneFormat::parse(UTimeZoneFormatStyle style, const UnicodeString& text, Par
             }
             if (U_FAILURE(status)) {
                 pos.setErrorIndex(startIdx);
-                return NULL;
+                return nullptr;
             }
             if (len > 0) {
                 // Found a match
@@ -1205,7 +1205,7 @@ TimeZoneFormat::parse(UTimeZoneFormatStyle style, const UnicodeString& text, Par
             LocalPointer<TimeZoneNames::MatchInfoCollection> specificMatches(fTimeZoneNames->find(text, startIdx, ALL_SIMPLE_NAME_TYPES, status));
             if (U_FAILURE(status)) {
                 pos.setErrorIndex(startIdx);
-                return NULL;
+                return nullptr;
             }
             int32_t specificMatchIdx = -1;
             int32_t matchPos = -1;
@@ -1232,7 +1232,7 @@ TimeZoneFormat::parse(UTimeZoneFormatStyle style, const UnicodeString& text, Par
                     tzdbTimeZoneNames->find(text, startIdx, ALL_SIMPLE_NAME_TYPES, status));
                 if (U_FAILURE(status)) {
                     pos.setErrorIndex(startIdx);
-                    return NULL;
+                    return nullptr;
                 }
                 int32_t tzdbNameMatchIdx = -1;
                 int32_t matchPos = -1;
@@ -1264,7 +1264,7 @@ TimeZoneFormat::parse(UTimeZoneFormatStyle style, const UnicodeString& text, Par
             }
             if (U_FAILURE(status)) {
                 pos.setErrorIndex(startIdx);
-                return NULL;
+                return nullptr;
             }
 
             if (genMatchLen > 0 && parsedPos < startIdx + genMatchLen) {
@@ -1320,7 +1320,7 @@ TimeZoneFormat::parse(UTimeZoneFormatStyle style, const UnicodeString& text, Par
     }
 
     pos.setErrorIndex(startIdx);
-    return NULL;
+    return nullptr;
 }
 
 void
@@ -1344,7 +1344,7 @@ TimeZoneFormat::formatGeneric(const TimeZone& tz, int32_t genType, UDate date, U
 
     if (genType == UTZGNM_LOCATION) {
         const UChar* canonicalID = ZoneMeta::getCanonicalCLDRID(tz);
-        if (canonicalID == NULL) {
+        if (canonicalID == nullptr) {
             name.setToBogus();
             return name;
         }
@@ -1356,7 +1356,7 @@ TimeZoneFormat::formatGeneric(const TimeZone& tz, int32_t genType, UDate date, U
 UnicodeString&
 TimeZoneFormat::formatSpecific(const TimeZone& tz, UTimeZoneNameType stdType, UTimeZoneNameType dstType,
         UDate date, UnicodeString& name, UTimeZoneFormatTimeType *timeType) const {
-    if (fTimeZoneNames == NULL) {
+    if (fTimeZoneNames == nullptr) {
         name.setToBogus();
         return name;
     }
@@ -1365,7 +1365,7 @@ TimeZoneFormat::formatSpecific(const TimeZone& tz, UTimeZoneNameType stdType, UT
     UBool isDaylight = tz.inDaylightTime(date, status);
     const UChar* canonicalID = ZoneMeta::getCanonicalCLDRID(tz);
 
-    if (U_FAILURE(status) || canonicalID == NULL) {
+    if (U_FAILURE(status) || canonicalID == nullptr) {
         name.setToBogus();
         return name;
     }
@@ -1385,11 +1385,11 @@ TimeZoneFormat::formatSpecific(const TimeZone& tz, UTimeZoneNameType stdType, UT
 const TimeZoneGenericNames*
 TimeZoneFormat::getTimeZoneGenericNames(UErrorCode& status) const {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     umtx_lock(&gLock);
-    if (fTimeZoneGenericNames == NULL) {
+    if (fTimeZoneGenericNames == nullptr) {
         TimeZoneFormat *nonConstThis = const_cast<TimeZoneFormat *>(this);
         nonConstThis->fTimeZoneGenericNames = TimeZoneGenericNames::createInstance(fLocale, status);
     }
@@ -1401,13 +1401,13 @@ TimeZoneFormat::getTimeZoneGenericNames(UErrorCode& status) const {
 const TZDBTimeZoneNames*
 TimeZoneFormat::getTZDBTimeZoneNames(UErrorCode& status) const {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     umtx_lock(&gLock);
-    if (fTZDBTimeZoneNames == NULL) {
+    if (fTZDBTimeZoneNames == nullptr) {
         TZDBTimeZoneNames *tzdbNames = new TZDBTimeZoneNames(fLocale);
-        if (tzdbNames == NULL) {
+        if (tzdbNames == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
         } else {
             TimeZoneFormat *nonConstThis = const_cast<TimeZoneFormat *>(this);
@@ -1476,12 +1476,12 @@ TimeZoneFormat::parseOffsetISO8601(const UnicodeString& text, ParsePosition& pos
 
 int32_t
 TimeZoneFormat::parseOffsetLocalizedGMT(const UnicodeString& text, ParsePosition& pos) const {
-    return parseOffsetLocalizedGMT(text, pos, false, NULL);
+    return parseOffsetLocalizedGMT(text, pos, false, nullptr);
 }
 
 int32_t
 TimeZoneFormat::parseOffsetShortLocalizedGMT(const UnicodeString& text, ParsePosition& pos) const {
-    return parseOffsetLocalizedGMT(text, pos, true, NULL);
+    return parseOffsetLocalizedGMT(text, pos, true, nullptr);
 }
 
 // ------------------------------------------------------------------
@@ -1586,7 +1586,7 @@ TimeZoneFormat::formatOffsetLocalizedGMT(int32_t offset, UBool isShort, UnicodeS
 
     U_ASSERT(offsetH <= MAX_OFFSET_HOUR && offsetM <= MAX_OFFSET_MINUTE && offsetS <= MAX_OFFSET_SECOND);
 
-    const UVector* offsetPatternItems = NULL;
+    const UVector* offsetPatternItems = nullptr;
     if (positive) {
         if (offsetS != 0) {
             offsetPatternItems = fGMTOffsetPatternItems[UTZFMT_PAT_POSITIVE_HMS];
@@ -1605,7 +1605,7 @@ TimeZoneFormat::formatOffsetLocalizedGMT(int32_t offset, UBool isShort, UnicodeS
         }
     }
 
-    U_ASSERT(offsetPatternItems != NULL);
+    U_ASSERT(offsetPatternItems != nullptr);
 
     // Building the GMT format string
     result.setTo(fGMTPatternPrefix);
@@ -1638,7 +1638,7 @@ TimeZoneFormat::formatOffsetLocalizedGMT(int32_t offset, UBool isShort, UnicodeS
 }
 
 int32_t
-TimeZoneFormat::parseOffsetISO8601(const UnicodeString& text, ParsePosition& pos, UBool extendedOnly, UBool* hasDigitOffset /* = NULL */) const {
+TimeZoneFormat::parseOffsetISO8601(const UnicodeString& text, ParsePosition& pos, UBool extendedOnly, UBool* hasDigitOffset /* = nullptr */) const {
     if (hasDigitOffset) {
         *hasDigitOffset = false;
     }
@@ -1802,7 +1802,7 @@ TimeZoneFormat::parseOffsetFields(const UnicodeString& text, int32_t start, UBoo
     for (int32_t patidx = 0; PARSE_GMT_OFFSET_TYPES[patidx] >= 0; patidx++) {
         int32_t gmtPatType = PARSE_GMT_OFFSET_TYPES[patidx];
         UVector* items = fGMTOffsetPatternItems[gmtPatType];
-        U_ASSERT(items != NULL);
+        U_ASSERT(items != nullptr);
 
         outLen = parseOffsetFieldsWithPattern(text, start, items, false, offsetH, offsetM, offsetS);
         if (outLen > 0) {
@@ -1826,7 +1826,7 @@ TimeZoneFormat::parseOffsetFields(const UnicodeString& text, int32_t start, UBoo
         for (int32_t patidx = 0; PARSE_GMT_OFFSET_TYPES[patidx] >= 0; patidx++) {
             int32_t gmtPatType = PARSE_GMT_OFFSET_TYPES[patidx];
             UVector* items = fGMTOffsetPatternItems[gmtPatType];
-            U_ASSERT(items != NULL);
+            U_ASSERT(items != nullptr);
 
             // forcing parse to use single hour digit
             tmpLen = parseOffsetFieldsWithPattern(text, start, items, true, tmpH, tmpM, tmpS);
@@ -2432,12 +2432,12 @@ TimeZoneFormat::unquote(const UnicodeString& pattern, UnicodeString& result) {
 UVector*
 TimeZoneFormat::parseOffsetPattern(const UnicodeString& pattern, OffsetFields required, UErrorCode& status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
-    UVector* result = new UVector(deleteGMTOffsetField, NULL, status);
-    if (result == NULL) {
+    UVector* result = new UVector(deleteGMTOffsetField, nullptr, status);
+    if (result == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     int32_t checkBits = 0;
@@ -2566,7 +2566,7 @@ TimeZoneFormat::parseOffsetPattern(const UnicodeString& pattern, OffsetFields re
 
     // error
     delete result;
-    return NULL;
+    return nullptr;
 }
 
 UnicodeString&
@@ -2738,7 +2738,7 @@ private:
 };
 
 ZoneIdMatchHandler::ZoneIdMatchHandler() 
-: fLen(0), fID(NULL) {
+: fLen(0), fID(nullptr) {
 }
 
 ZoneIdMatchHandler::~ZoneIdMatchHandler() {
@@ -2751,7 +2751,7 @@ ZoneIdMatchHandler::handleMatch(int32_t matchLength, const CharacterNode *node,
     }
     if (node->hasValues()) {
         const UChar* id = (const UChar*)node->getValue(0);
-        if (id != NULL) {
+        if (id != nullptr) {
             if (fLen < matchLength) {
                 fID = id;
                 fLen = matchLength;
@@ -2773,17 +2773,17 @@ ZoneIdMatchHandler::getMatchLen() {
 
 
 static void U_CALLCONV initZoneIdTrie(UErrorCode &status) {
-    U_ASSERT(gZoneIdTrie == NULL);
+    U_ASSERT(gZoneIdTrie == nullptr);
     ucln_i18n_registerCleanup(UCLN_I18N_TIMEZONEFORMAT, tzfmt_cleanup);
-    gZoneIdTrie = new TextTrieMap(true, NULL);    // No deleter, because values are pooled by ZoneMeta
-    if (gZoneIdTrie == NULL) {
+    gZoneIdTrie = new TextTrieMap(true, nullptr);    // No deleter, because values are pooled by ZoneMeta
+    if (gZoneIdTrie == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
     StringEnumeration *tzenum = TimeZone::createEnumeration(status);
     if (U_SUCCESS(status)) {
         const UnicodeString *id;
-        while ((id = tzenum->snext(status)) != NULL) {
+        while ((id = tzenum->snext(status)) != nullptr) {
             const UChar* uid = ZoneMeta::findTimeZoneID(*id);
             if (uid) {
                 gZoneIdTrie->put(uid, const_cast<UChar *>(uid), status);
@@ -2822,16 +2822,16 @@ TimeZoneFormat::parseZoneID(const UnicodeString& text, ParsePosition& pos, Unico
 }
 
 static void U_CALLCONV initShortZoneIdTrie(UErrorCode &status) {
-    U_ASSERT(gShortZoneIdTrie == NULL);
+    U_ASSERT(gShortZoneIdTrie == nullptr);
     ucln_i18n_registerCleanup(UCLN_I18N_TIMEZONEFORMAT, tzfmt_cleanup);
-    StringEnumeration *tzenum = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL, NULL, NULL, status);
+    StringEnumeration *tzenum = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL, nullptr, nullptr, status);
     if (U_SUCCESS(status)) {
-        gShortZoneIdTrie = new TextTrieMap(true, NULL);    // No deleter, because values are pooled by ZoneMeta
-        if (gShortZoneIdTrie == NULL) {
+        gShortZoneIdTrie = new TextTrieMap(true, nullptr);    // No deleter, because values are pooled by ZoneMeta
+        if (gShortZoneIdTrie == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
         } else {
             const UnicodeString *id;
-            while ((id = tzenum->snext(status)) != NULL) {
+            while ((id = tzenum->snext(status)) != nullptr) {
                 const UChar* uID = ZoneMeta::findTimeZoneID(*id);
                 const UChar* shortID = ZoneMeta::getShortID(*id);
                 if (shortID && uID) {
index e96dfd2b2f29ca9de25a4a003f6ac2ed544cbfc2..9cbe5e15c1bae1cd6f5bd7e1a611179c3b4c23c2 100644 (file)
@@ -89,7 +89,7 @@ comparePartialLocationKey(const UHashTok key1, const UHashTok key2) {
     if (p1 == p2) {
         return true;
     }
-    if (p1 == NULL || p2 == NULL) {
+    if (p1 == nullptr || p2 == nullptr) {
         return false;
     }
     // We just check identity of tzID/mzID
@@ -145,14 +145,14 @@ TimeZoneGenericNameMatchInfo::TimeZoneGenericNameMatchInfo(UVector* matches)
 }
 
 TimeZoneGenericNameMatchInfo::~TimeZoneGenericNameMatchInfo() {
-    if (fMatches != NULL) {
+    if (fMatches != nullptr) {
         delete fMatches;
     }
 }
 
 int32_t
 TimeZoneGenericNameMatchInfo::size() const {
-    if (fMatches == NULL) {
+    if (fMatches == nullptr) {
         return 0;
     }
     return fMatches->size();
@@ -161,7 +161,7 @@ TimeZoneGenericNameMatchInfo::size() const {
 UTimeZoneGenericNameType
 TimeZoneGenericNameMatchInfo::getGenericNameType(int32_t index) const {
     GMatchInfo *minfo = (GMatchInfo *)fMatches->elementAt(index);
-    if (minfo != NULL) {
+    if (minfo != nullptr) {
         return static_cast<UTimeZoneGenericNameType>(minfo->gnameInfo->type);
     }
     return UTZGNM_UNKNOWN;
@@ -170,7 +170,7 @@ TimeZoneGenericNameMatchInfo::getGenericNameType(int32_t index) const {
 int32_t
 TimeZoneGenericNameMatchInfo::getMatchLength(int32_t index) const {
     ZMatchInfo *minfo = (ZMatchInfo *)fMatches->elementAt(index);
-    if (minfo != NULL) {
+    if (minfo != nullptr) {
         return minfo->matchLength;
     }
     return -1;
@@ -179,7 +179,7 @@ TimeZoneGenericNameMatchInfo::getMatchLength(int32_t index) const {
 UnicodeString&
 TimeZoneGenericNameMatchInfo::getTimeZoneID(int32_t index, UnicodeString& tzID) const {
     GMatchInfo *minfo = (GMatchInfo *)fMatches->elementAt(index);
-    if (minfo != NULL && minfo->gnameInfo->tzID != NULL) {
+    if (minfo != nullptr && minfo->gnameInfo->tzID != nullptr) {
         tzID.setTo(true, minfo->gnameInfo->tzID, -1);
     } else {
         tzID.setToBogus();
@@ -205,11 +205,11 @@ private:
 };
 
 GNameSearchHandler::GNameSearchHandler(uint32_t types)
-: fTypes(types), fResults(NULL), fMaxMatchLen(0) {
+: fTypes(types), fResults(nullptr), fMaxMatchLen(0) {
 }
 
 GNameSearchHandler::~GNameSearchHandler() {
-    if (fResults != NULL) {
+    if (fResults != nullptr) {
         delete fResults;
     }
 }
@@ -223,20 +223,20 @@ GNameSearchHandler::handleMatch(int32_t matchLength, const CharacterNode *node,
         int32_t valuesCount = node->countValues();
         for (int32_t i = 0; i < valuesCount; i++) {
             GNameInfo *nameinfo = (ZNameInfo *)node->getValue(i);
-            if (nameinfo == NULL) {
+            if (nameinfo == nullptr) {
                 break;
             }
             if ((nameinfo->type & fTypes) != 0) {
                 // matches a requested type
-                if (fResults == NULL) {
-                    LocalPointer<UVector> lpResults(new UVector(uprv_free, NULL, status), status);
+                if (fResults == nullptr) {
+                    LocalPointer<UVector> lpResults(new UVector(uprv_free, nullptr, status), status);
                     if (U_FAILURE(status)) {
                         return false;
                     }
                     fResults = lpResults.orphan();
                 }
                 GMatchInfo *gmatch = (GMatchInfo *)uprv_malloc(sizeof(GMatchInfo));
-                if (gmatch == NULL) {
+                if (gmatch == nullptr) {
                     status = U_MEMORY_ALLOCATION_ERROR;
                     return false;
                 }
@@ -264,7 +264,7 @@ GNameSearchHandler::getMatches(int32_t& maxMatchLen) {
     maxMatchLen = fMaxMatchLen;
 
     // reset
-    fResults = NULL;
+    fResults = nullptr;
     fMaxMatchLen = 0;
     return results;
 }
@@ -333,10 +333,10 @@ private:
 // ---------------------------------------------------
 TZGNCore::TZGNCore(const Locale& locale, UErrorCode& status)
 : fLocale(locale),
-  fTimeZoneNames(NULL),
-  fLocationNamesMap(NULL),
-  fPartialLocationNamesMap(NULL),
-  fLocaleDisplayNames(NULL),
+  fTimeZoneNames(nullptr),
+  fLocationNamesMap(nullptr),
+  fPartialLocationNamesMap(nullptr),
+  fLocaleDisplayNames(nullptr),
   fStringPool(status),
   fGNamesTrie(true, deleteGNameInfo),
   fGNamesTrieFullyLoaded(false) {
@@ -368,12 +368,12 @@ TZGNCore::initialize(const Locale& locale, UErrorCode& status) {
     zoneStrings = ures_getByKeyWithFallback(zoneStrings, gZoneStrings, zoneStrings, &tmpsts);
 
     if (U_SUCCESS(tmpsts)) {
-        const UChar *regionPattern = ures_getStringByKeyWithFallback(zoneStrings, gRegionFormatTag, NULL, &tmpsts);
+        const UChar *regionPattern = ures_getStringByKeyWithFallback(zoneStrings, gRegionFormatTag, nullptr, &tmpsts);
         if (U_SUCCESS(tmpsts) && u_strlen(regionPattern) > 0) {
             rpat.setTo(regionPattern, -1);
         }
         tmpsts = U_ZERO_ERROR;
-        const UChar *fallbackPattern = ures_getStringByKeyWithFallback(zoneStrings, gFallbackFormatTag, NULL, &tmpsts);
+        const UChar *fallbackPattern = ures_getStringByKeyWithFallback(zoneStrings, gFallbackFormatTag, nullptr, &tmpsts);
         if (U_SUCCESS(tmpsts) && u_strlen(fallbackPattern) > 0) {
             fpat.setTo(fallbackPattern, -1);
         }
@@ -391,13 +391,13 @@ TZGNCore::initialize(const Locale& locale, UErrorCode& status) {
     fLocaleDisplayNames = LocaleDisplayNames::createInstance(locale);
 
     // hash table for names - no key/value deleters
-    fLocationNamesMap = uhash_open(uhash_hashUChars, uhash_compareUChars, NULL, &status);
+    fLocationNamesMap = uhash_open(uhash_hashUChars, uhash_compareUChars, nullptr, &status);
     if (U_FAILURE(status)) {
         cleanup();
         return;
     }
 
-    fPartialLocationNamesMap = uhash_open(hashPartialLocationKey, comparePartialLocationKey, NULL, &status);
+    fPartialLocationNamesMap = uhash_open(hashPartialLocationKey, comparePartialLocationKey, nullptr, &status);
     if (U_FAILURE(status)) {
         cleanup();
         return;
@@ -431,7 +431,7 @@ TZGNCore::initialize(const Locale& locale, UErrorCode& status) {
     // preload generic names for the default zone
     TimeZone *tz = TimeZone::createDefault();
     const UChar *tzID = ZoneMeta::getCanonicalCLDRID(*tz);
-    if (tzID != NULL) {
+    if (tzID != nullptr) {
         loadStrings(UnicodeString(true, tzID, -1));
     }
     delete tz;
@@ -439,10 +439,10 @@ TZGNCore::initialize(const Locale& locale, UErrorCode& status) {
 
 void
 TZGNCore::cleanup() {
-    if (fLocaleDisplayNames != NULL) {
+    if (fLocaleDisplayNames != nullptr) {
         delete fLocaleDisplayNames;
     }
-    if (fTimeZoneNames != NULL) {
+    if (fTimeZoneNames != nullptr) {
         delete fTimeZoneNames;
     }
 
@@ -458,7 +458,7 @@ TZGNCore::getDisplayName(const TimeZone& tz, UTimeZoneGenericNameType type, UDat
     case UTZGNM_LOCATION:
         {
             const UChar* tzCanonicalID = ZoneMeta::getCanonicalCLDRID(tz);
-            if (tzCanonicalID != NULL) {
+            if (tzCanonicalID != nullptr) {
                 getGenericLocationName(UnicodeString(true, tzCanonicalID, -1), name);
             }
         }
@@ -468,7 +468,7 @@ TZGNCore::getDisplayName(const TimeZone& tz, UTimeZoneGenericNameType type, UDat
         formatGenericNonLocationName(tz, type, date, name);
         if (name.isEmpty()) {
             const UChar* tzCanonicalID = ZoneMeta::getCanonicalCLDRID(tz);
-            if (tzCanonicalID != NULL) {
+            if (tzCanonicalID != nullptr) {
                 getGenericLocationName(UnicodeString(true, tzCanonicalID, -1), name);
             }
         }
@@ -486,7 +486,7 @@ TZGNCore::getGenericLocationName(const UnicodeString& tzCanonicalID, UnicodeStri
         return name;
     }
 
-    const UChar *locname = NULL;
+    const UChar *locname = nullptr;
     TZGNCore *nonConstThis = const_cast<TZGNCore *>(this);
     umtx_lock(&gLock);
     {
@@ -494,7 +494,7 @@ TZGNCore::getGenericLocationName(const UnicodeString& tzCanonicalID, UnicodeStri
     }
     umtx_unlock(&gLock);
 
-    if (locname == NULL) {
+    if (locname == nullptr) {
         name.setToBogus();
     } else {
         name.setTo(locname, u_strlen(locname));
@@ -510,7 +510,7 @@ const UChar*
 TZGNCore::getGenericLocationName(const UnicodeString& tzCanonicalID) {
     U_ASSERT(!tzCanonicalID.isEmpty());
     if (tzCanonicalID.length() > ZID_KEY_MAX) {
-        return NULL;
+        return nullptr;
     }
 
     UErrorCode status = U_ZERO_ERROR;
@@ -521,10 +521,10 @@ TZGNCore::getGenericLocationName(const UnicodeString& tzCanonicalID) {
 
     const UChar *locname = (const UChar *)uhash_get(fLocationNamesMap, tzIDKey);
 
-    if (locname != NULL) {
+    if (locname != nullptr) {
         // gEmpty indicate the name is not available
         if (locname == gEmpty) {
-            return NULL;
+            return nullptr;
         }
         return locname;
     }
@@ -559,26 +559,26 @@ TZGNCore::getGenericLocationName(const UnicodeString& tzCanonicalID) {
             fRegionFormat.format(city, name, status);
         }
         if (U_FAILURE(status)) {
-            return NULL;
+            return nullptr;
         }
     }
 
-    locname = name.isEmpty() ? NULL : fStringPool.get(name, status);
+    locname = name.isEmpty() ? nullptr : fStringPool.get(name, status);
     if (U_SUCCESS(status)) {
         // Cache the result
         const UChar* cacheID = ZoneMeta::findTimeZoneID(tzCanonicalID);
-        U_ASSERT(cacheID != NULL);
-        if (locname == NULL) {
+        U_ASSERT(cacheID != nullptr);
+        if (locname == nullptr) {
             // gEmpty to indicate - no location name available
             uhash_put(fLocationNamesMap, (void *)cacheID, (void *)gEmpty, &status);
         } else {
             uhash_put(fLocationNamesMap, (void *)cacheID, (void *)locname, &status);
             if (U_FAILURE(status)) {
-                locname = NULL;
+                locname = nullptr;
             } else {
                 // put the name info into the trie
                 GNameInfo *nameinfo = (ZNameInfo *)uprv_malloc(sizeof(GNameInfo));
-                if (nameinfo != NULL) {
+                if (nameinfo != nullptr) {
                     nameinfo->type = UTZGNM_LOCATION;
                     nameinfo->tzID = cacheID;
                     fGNamesTrie.put(locname, nameinfo, status);
@@ -596,7 +596,7 @@ TZGNCore::formatGenericNonLocationName(const TimeZone& tz, UTimeZoneGenericNameT
     name.setToBogus();
 
     const UChar* uID = ZoneMeta::getCanonicalCLDRID(tz);
-    if (uID == NULL) {
+    if (uID == nullptr) {
         return name;
     }
 
@@ -630,15 +630,15 @@ TZGNCore::formatGenericNonLocationName(const TimeZone& tz, UTimeZoneGenericNameT
 
             TimeZone *tmptz = tz.clone();
             // Check if the zone actually uses daylight saving time around the time
-            BasicTimeZone *btz = NULL;
-            if (dynamic_cast<OlsonTimeZone *>(tmptz) != NULL
-                || dynamic_cast<SimpleTimeZone *>(tmptz) != NULL
-                || dynamic_cast<RuleBasedTimeZone *>(tmptz) != NULL
-                || dynamic_cast<VTimeZone *>(tmptz) != NULL) {
+            BasicTimeZone *btz = nullptr;
+            if (dynamic_cast<OlsonTimeZone *>(tmptz) != nullptr
+                || dynamic_cast<SimpleTimeZone *>(tmptz) != nullptr
+                || dynamic_cast<RuleBasedTimeZone *>(tmptz) != nullptr
+                || dynamic_cast<VTimeZone *>(tmptz) != nullptr) {
                 btz = (BasicTimeZone*)tmptz;
             }
 
-            if (btz != NULL) {
+            if (btz != nullptr) {
                 TimeZoneTransition before;
                 UBool beforTrs = btz->getPreviousTransition(date, true, before);
                 if (beforTrs
@@ -741,7 +741,7 @@ TZGNCore::getPartialLocationName(const UnicodeString& tzCanonicalID,
         return name;
     }
 
-    const UChar *uplname = NULL;
+    const UChar *uplname = nullptr;
     TZGNCore *nonConstThis = const_cast<TZGNCore *>(this);
     umtx_lock(&gLock);
     {
@@ -749,7 +749,7 @@ TZGNCore::getPartialLocationName(const UnicodeString& tzCanonicalID,
     }
     umtx_unlock(&gLock);
 
-    if (uplname == NULL) {
+    if (uplname == nullptr) {
         name.setToBogus();
     } else {
         name.setTo(true, uplname, -1);
@@ -771,10 +771,10 @@ TZGNCore::getPartialLocationName(const UnicodeString& tzCanonicalID,
     key.tzID = ZoneMeta::findTimeZoneID(tzCanonicalID);
     key.mzID = ZoneMeta::findMetaZoneID(mzID);
     key.isLong = isLong;
-    U_ASSERT(key.tzID != NULL && key.mzID != NULL);
+    U_ASSERT(key.tzID != nullptr && key.mzID != nullptr);
 
     const UChar* uplname = (const UChar*)uhash_get(fPartialLocationNamesMap, (void *)&key);
-    if (uplname != NULL) {
+    if (uplname != nullptr) {
         return uplname;
     }
 
@@ -810,14 +810,14 @@ TZGNCore::getPartialLocationName(const UnicodeString& tzCanonicalID,
     UnicodeString name;
     fFallbackFormat.format(location, mzDisplayName, name, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     uplname = fStringPool.get(name, status);
     if (U_SUCCESS(status)) {
         // Add the name to cache
         PartialLocationKey* cacheKey = (PartialLocationKey *)uprv_malloc(sizeof(PartialLocationKey));
-        if (cacheKey != NULL) {
+        if (cacheKey != nullptr) {
             cacheKey->tzID = key.tzID;
             cacheKey->mzID = key.mzID;
             cacheKey->isLong = key.isLong;
@@ -827,7 +827,7 @@ TZGNCore::getPartialLocationName(const UnicodeString& tzCanonicalID,
             } else {
                 // put the name to the local trie as well
                 GNameInfo *nameinfo = (ZNameInfo *)uprv_malloc(sizeof(GNameInfo));
-                if (nameinfo != NULL) {
+                if (nameinfo != nullptr) {
                     nameinfo->type = isLong ? UTZGNM_LONG : UTZGNM_SHORT;
                     nameinfo->tzID = key.tzID;
                     fGNamesTrie.put(uplname, nameinfo, status);
@@ -859,7 +859,7 @@ TZGNCore::loadStrings(const UnicodeString& tzCanonicalID) {
     };
 
     StringEnumeration *mzIDs = fTimeZoneNames->getAvailableMetaZoneIDs(tzCanonicalID, status);
-    while ((mzID = mzIDs->snext(status)) != NULL) {
+    while ((mzID = mzIDs->snext(status)) != nullptr) {
         if (U_FAILURE(status)) {
             break;
         }
@@ -878,7 +878,7 @@ TZGNCore::loadStrings(const UnicodeString& tzCanonicalID) {
             }
         }
     }
-    if (mzIDs != NULL) {
+    if (mzIDs != nullptr) {
         delete mzIDs;
     }
 }
@@ -905,7 +905,7 @@ TZGNCore::findBestMatch(const UnicodeString& text, int32_t start, uint32_t types
     // UBool isLongStandard = false;   // workaround - see the comments below
     UBool isStandard = false;       // TODO: Temporary hack (on hack) for short standard name/location name conflict (found in zh_Hant), should be removed after CLDR 21m1 integration
 
-    if (tznamesMatches != NULL) {
+    if (tznamesMatches != nullptr) {
         UnicodeString mzID;
         for (int32_t i = 0; i < tznamesMatches->size(); i++) {
             int32_t len = tznamesMatches->getMatchLengthAt(i);
@@ -979,7 +979,7 @@ TZGNCore::findBestMatch(const UnicodeString& text, int32_t start, uint32_t types
     if (U_FAILURE(status)) {
         return 0;
     }
-    if (localMatches != NULL) {
+    if (localMatches != nullptr) {
         for (int32_t i = 0; i < localMatches->size(); i++) {
             int32_t len = localMatches->getMatchLength(i);
 
@@ -1017,25 +1017,25 @@ TZGNCore::findLocal(const UnicodeString& text, int32_t start, uint32_t types, UE
     umtx_unlock(&gLock);
 
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
-    TimeZoneGenericNameMatchInfo *gmatchInfo = NULL;
+    TimeZoneGenericNameMatchInfo *gmatchInfo = nullptr;
 
     int32_t maxLen = 0;
     UVector *results = handler.getMatches(maxLen);
-    if (results != NULL && ((maxLen == (text.length() - start)) || fGNamesTrieFullyLoaded)) {
+    if (results != nullptr && ((maxLen == (text.length() - start)) || fGNamesTrieFullyLoaded)) {
         // perfect match
         gmatchInfo = new TimeZoneGenericNameMatchInfo(results);
-        if (gmatchInfo == NULL) {
+        if (gmatchInfo == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             delete results;
-            return NULL;
+            return nullptr;
         }
         return gmatchInfo;
     }
 
-    if (results != NULL) {
+    if (results != nullptr) {
         delete results;
     }
 
@@ -1044,17 +1044,17 @@ TZGNCore::findLocal(const UnicodeString& text, int32_t start, uint32_t types, UE
     umtx_lock(&gLock);
     {
         if (!fGNamesTrieFullyLoaded) {
-            StringEnumeration *tzIDs = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL, NULL, NULL, status);
+            StringEnumeration *tzIDs = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL, nullptr, nullptr, status);
             if (U_SUCCESS(status)) {
                 const UnicodeString *tzID;
-                while ((tzID = tzIDs->snext(status)) != NULL) {
+                while ((tzID = tzIDs->snext(status)) != nullptr) {
                     if (U_FAILURE(status)) {
                         break;
                     }
                     nonConstThis->loadStrings(*tzID);
                 }
             }
-            if (tzIDs != NULL) {
+            if (tzIDs != nullptr) {
                 delete tzIDs;
             }
 
@@ -1066,7 +1066,7 @@ TZGNCore::findLocal(const UnicodeString& text, int32_t start, uint32_t types, UE
     umtx_unlock(&gLock);
 
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     umtx_lock(&gLock);
@@ -1077,12 +1077,12 @@ TZGNCore::findLocal(const UnicodeString& text, int32_t start, uint32_t types, UE
     umtx_unlock(&gLock);
 
     results = handler.getMatches(maxLen);
-    if (results != NULL && maxLen > 0) {
+    if (results != nullptr && maxLen > 0) {
         gmatchInfo = new TimeZoneGenericNameMatchInfo(results);
-        if (gmatchInfo == NULL) {
+        if (gmatchInfo == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             delete results;
-            return NULL;
+            return nullptr;
         }
     }
 
@@ -1105,7 +1105,7 @@ TZGNCore::findTimeZoneNames(const UnicodeString& text, int32_t start, uint32_t t
         return fTimeZoneNames->find(text, start, nameTypes, status);
     }
 
-    return NULL;
+    return nullptr;
 }
 
 typedef struct TZGNCoreRef {
@@ -1116,7 +1116,7 @@ typedef struct TZGNCoreRef {
 
 // TZGNCore object cache handling
 static UMutex gTZGNLock;
-static UHashtable *gTZGNCoreCache = NULL;
+static UHashtable *gTZGNCoreCache = nullptr;
 static UBool gTZGNCoreCacheInitialized = false;
 
 // Access count - incremented every time up to SWEEP_INTERVAL,
@@ -1138,9 +1138,9 @@ U_CDECL_BEGIN
  */
 static UBool U_CALLCONV tzgnCore_cleanup(void)
 {
-    if (gTZGNCoreCache != NULL) {
+    if (gTZGNCoreCache != nullptr) {
         uhash_close(gTZGNCoreCache);
-        gTZGNCoreCache = NULL;
+        gTZGNCoreCache = nullptr;
     }
     gTZGNCoreCacheInitialized = false;
     return true;
@@ -1167,7 +1167,7 @@ static void sweepCache() {
     const UHashElement* elem;
     double now = (double)uprv_getUTCtime();
 
-    while ((elem = uhash_nextElement(gTZGNCoreCache, &pos)) != NULL) {
+    while ((elem = uhash_nextElement(gTZGNCoreCache, &pos)) != nullptr) {
         TZGNCoreRef *entry = (TZGNCoreRef *)elem->value.pointer;
         if (entry->refCount <= 0 && (now - entry->lastAccess) > CACHE_EXPIRATION) {
             // delete this entry
@@ -1193,21 +1193,21 @@ TimeZoneGenericNames::~TimeZoneGenericNames() {
 TimeZoneGenericNames*
 TimeZoneGenericNames::createInstance(const Locale& locale, UErrorCode& status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     TimeZoneGenericNames* instance = new TimeZoneGenericNames();
-    if (instance == NULL) {
+    if (instance == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
 
-    TZGNCoreRef *cacheEntry = NULL;
+    TZGNCoreRef *cacheEntry = nullptr;
     {
         Mutex lock(&gTZGNLock);
 
         if (!gTZGNCoreCacheInitialized) {
             // Create empty hashtable
-            gTZGNCoreCache = uhash_open(uhash_hashChars, uhash_compareChars, NULL, &status);
+            gTZGNCoreCache = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &status);
             if (U_SUCCESS(status)) {
                 uhash_setKeyDeleter(gTZGNCoreCache, uprv_free);
                 uhash_setValueDeleter(gTZGNCoreCache, deleteTZGNCoreRef);
@@ -1216,23 +1216,23 @@ TimeZoneGenericNames::createInstance(const Locale& locale, UErrorCode& status) {
             }
         }
         if (U_FAILURE(status)) {
-            return NULL;
+            return nullptr;
         }
 
         // Check the cache, if not available, create new one and cache
         const char *key = locale.getName();
         cacheEntry = (TZGNCoreRef *)uhash_get(gTZGNCoreCache, key);
-        if (cacheEntry == NULL) {
-            TZGNCore *tzgnCore = NULL;
-            char *newKey = NULL;
+        if (cacheEntry == nullptr) {
+            TZGNCore *tzgnCore = nullptr;
+            char *newKey = nullptr;
 
             tzgnCore = new TZGNCore(locale, status);
-            if (tzgnCore == NULL) {
+            if (tzgnCore == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
             }
             if (U_SUCCESS(status)) {
                 newKey = (char *)uprv_malloc(uprv_strlen(key) + 1);
-                if (newKey == NULL) {
+                if (newKey == nullptr) {
                     status = U_MEMORY_ALLOCATION_ERROR;
                 } else {
                     uprv_strcpy(newKey, key);
@@ -1240,7 +1240,7 @@ TimeZoneGenericNames::createInstance(const Locale& locale, UErrorCode& status) {
             }
             if (U_SUCCESS(status)) {
                 cacheEntry = (TZGNCoreRef *)uprv_malloc(sizeof(TZGNCoreRef));
-                if (cacheEntry == NULL) {
+                if (cacheEntry == nullptr) {
                     status = U_MEMORY_ALLOCATION_ERROR;
                 } else {
                     cacheEntry->obj = tzgnCore;
@@ -1251,16 +1251,16 @@ TimeZoneGenericNames::createInstance(const Locale& locale, UErrorCode& status) {
                 }
             }
             if (U_FAILURE(status)) {
-                if (tzgnCore != NULL) {
+                if (tzgnCore != nullptr) {
                     delete tzgnCore;
                 }
-                if (newKey != NULL) {
+                if (newKey != nullptr) {
                     uprv_free(newKey);
                 }
-                if (cacheEntry != NULL) {
+                if (cacheEntry != nullptr) {
                     uprv_free(cacheEntry);
                 }
-                cacheEntry = NULL;
+                cacheEntry = nullptr;
             }
         } else {
             // Update the reference count
@@ -1275,9 +1275,9 @@ TimeZoneGenericNames::createInstance(const Locale& locale, UErrorCode& status) {
         }
     }  // End of mutex locked block
 
-    if (cacheEntry == NULL) {
+    if (cacheEntry == nullptr) {
         delete instance;
-        return NULL;
+        return nullptr;
     }
 
     instance->fRef = cacheEntry;
index ef4266718e00b6a83ed07a6441406c2e3fb8c016..b07d6ad94d1b450d5047ed7e340fa8a42772c453 100644 (file)
@@ -30,7 +30,7 @@ U_NAMESPACE_BEGIN
 
 // TimeZoneNames object cache handling
 static UMutex gTimeZoneNamesLock;
-static UHashtable *gTimeZoneNamesCache = NULL;
+static UHashtable *gTimeZoneNamesCache = nullptr;
 static UBool gTimeZoneNamesCacheInitialized = false;
 
 // Access count - incremented every time up to SWEEP_INTERVAL,
@@ -58,9 +58,9 @@ U_CDECL_BEGIN
  */
 static UBool U_CALLCONV timeZoneNames_cleanup(void)
 {
-    if (gTimeZoneNamesCache != NULL) {
+    if (gTimeZoneNamesCache != nullptr) {
         uhash_close(gTimeZoneNamesCache);
-        gTimeZoneNamesCache = NULL;
+        gTimeZoneNamesCache = nullptr;
     }
     gTimeZoneNamesCacheInitialized = false;
     return true;
@@ -135,7 +135,7 @@ TimeZoneNamesDelegate::TimeZoneNamesDelegate(const Locale& locale, UErrorCode& s
     Mutex lock(&gTimeZoneNamesLock);
     if (!gTimeZoneNamesCacheInitialized) {
         // Create empty hashtable if it is not already initialized.
-        gTimeZoneNamesCache = uhash_open(uhash_hashChars, uhash_compareChars, NULL, &status);
+        gTimeZoneNamesCache = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &status);
         if (U_SUCCESS(status)) {
             uhash_setKeyDeleter(gTimeZoneNamesCache, uprv_free);
             uhash_setValueDeleter(gTimeZoneNamesCache, deleteTimeZoneNamesCacheEntry);
@@ -149,21 +149,21 @@ TimeZoneNamesDelegate::TimeZoneNamesDelegate(const Locale& locale, UErrorCode& s
     }
 
     // Check the cache, if not available, create new one and cache
-    TimeZoneNamesCacheEntry *cacheEntry = NULL;
+    TimeZoneNamesCacheEntry *cacheEntry = nullptr;
 
     const char *key = locale.getName();
     cacheEntry = (TimeZoneNamesCacheEntry *)uhash_get(gTimeZoneNamesCache, key);
-    if (cacheEntry == NULL) {
-        TimeZoneNames *tznames = NULL;
-        char *newKey = NULL;
+    if (cacheEntry == nullptr) {
+        TimeZoneNames *tznames = nullptr;
+        char *newKey = nullptr;
 
         tznames = new TimeZoneNamesImpl(locale, status);
-        if (tznames == NULL) {
+        if (tznames == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
         }
         if (U_SUCCESS(status)) {
             newKey = (char *)uprv_malloc(uprv_strlen(key) + 1);
-            if (newKey == NULL) {
+            if (newKey == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
             } else {
                 uprv_strcpy(newKey, key);
@@ -171,7 +171,7 @@ TimeZoneNamesDelegate::TimeZoneNamesDelegate(const Locale& locale, UErrorCode& s
         }
         if (U_SUCCESS(status)) {
             cacheEntry = (TimeZoneNamesCacheEntry *)uprv_malloc(sizeof(TimeZoneNamesCacheEntry));
-            if (cacheEntry == NULL) {
+            if (cacheEntry == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
             } else {
                 cacheEntry->names = tznames;
@@ -182,16 +182,16 @@ TimeZoneNamesDelegate::TimeZoneNamesDelegate(const Locale& locale, UErrorCode& s
             }
         }
         if (U_FAILURE(status)) {
-            if (tznames != NULL) {
+            if (tznames != nullptr) {
                 delete tznames;
             }
-            if (newKey != NULL) {
+            if (newKey != nullptr) {
                 uprv_free(newKey);
             }
-            if (cacheEntry != NULL) {
+            if (cacheEntry != nullptr) {
                 uprv_free(cacheEntry);
             }
-            cacheEntry = NULL;
+            cacheEntry = nullptr;
         }
     } else {
         // Update the reference count
@@ -236,7 +236,7 @@ TimeZoneNamesDelegate::operator==(const TimeZoneNames& other) const {
 TimeZoneNamesDelegate*
 TimeZoneNamesDelegate::clone() const {
     TimeZoneNamesDelegate* other = new TimeZoneNamesDelegate();
-    if (other != NULL) {
+    if (other != nullptr) {
         umtx_lock(&gTimeZoneNamesLock);
         {
             // Just increment the reference count
@@ -306,10 +306,10 @@ TimeZoneNames::~TimeZoneNames() {
 
 TimeZoneNames*
 TimeZoneNames::createInstance(const Locale& locale, UErrorCode& status) {
-    TimeZoneNames *instance = NULL;
+    TimeZoneNames *instance = nullptr;
     if (U_SUCCESS(status)) {
         instance = new TimeZoneNamesDelegate(locale, status);
-        if (instance == NULL && U_SUCCESS(status)) {
+        if (instance == nullptr && U_SUCCESS(status)) {
             status = U_MEMORY_ALLOCATION_ERROR;
         }
     }
@@ -318,10 +318,10 @@ TimeZoneNames::createInstance(const Locale& locale, UErrorCode& status) {
 
 TimeZoneNames*
 TimeZoneNames::createTZDBInstance(const Locale& locale, UErrorCode& status) {
-    TimeZoneNames *instance = NULL;
+    TimeZoneNames *instance = nullptr;
     if (U_SUCCESS(status)) {
         instance = new TZDBTimeZoneNames(locale);
-        if (instance == NULL && U_SUCCESS(status)) {
+        if (instance == nullptr && U_SUCCESS(status)) {
             status = U_MEMORY_ALLOCATION_ERROR;
         }
     }
@@ -378,7 +378,7 @@ struct MatchInfo : UMemory {
     MatchInfo(UTimeZoneNameType nameType, int32_t matchLength, const UnicodeString* tzID, const UnicodeString* mzID) {
         this->nameType = nameType;
         this->matchLength = matchLength;
-        if (tzID != NULL) {
+        if (tzID != nullptr) {
             this->id.setTo(*tzID);
             this->isTZID = true;
         } else {
@@ -399,11 +399,11 @@ U_CDECL_END
 // MatchInfoCollection class
 // ---------------------------------------------------
 TimeZoneNames::MatchInfoCollection::MatchInfoCollection()
-: fMatches(NULL) {
+: fMatches(nullptr) {
 }
 
 TimeZoneNames::MatchInfoCollection::~MatchInfoCollection() {
-    if (fMatches != NULL) {
+    if (fMatches != nullptr) {
         delete fMatches;
     }
 }
@@ -414,7 +414,7 @@ TimeZoneNames::MatchInfoCollection::addZone(UTimeZoneNameType nameType, int32_t
     if (U_FAILURE(status)) {
         return;
     }
-    LocalPointer <MatchInfo> matchInfo(new MatchInfo(nameType, matchLength, &tzID, NULL), status);
+    LocalPointer <MatchInfo> matchInfo(new MatchInfo(nameType, matchLength, &tzID, nullptr), status);
     UVector *matchesVec = matches(status);
     if (U_FAILURE(status)) {
         return;
@@ -428,7 +428,7 @@ TimeZoneNames::MatchInfoCollection::addMetaZone(UTimeZoneNameType nameType, int3
     if (U_FAILURE(status)) {
         return;
     }
-    LocalPointer<MatchInfo> matchInfo(new MatchInfo(nameType, matchLength, NULL, &mzID), status);
+    LocalPointer<MatchInfo> matchInfo(new MatchInfo(nameType, matchLength, nullptr, &mzID), status);
     UVector *matchesVec = matches(status);
     if (U_FAILURE(status)) {
         return;
@@ -438,7 +438,7 @@ TimeZoneNames::MatchInfoCollection::addMetaZone(UTimeZoneNameType nameType, int3
 
 int32_t
 TimeZoneNames::MatchInfoCollection::size() const {
-    if (fMatches == NULL) {
+    if (fMatches == nullptr) {
         return 0;
     }
     return fMatches->size();
@@ -487,17 +487,17 @@ TimeZoneNames::MatchInfoCollection::getMetaZoneIDAt(int32_t idx, UnicodeString&
 UVector*
 TimeZoneNames::MatchInfoCollection::matches(UErrorCode& status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
-    if (fMatches != NULL) {
+    if (fMatches != nullptr) {
         return fMatches;
     }
-    fMatches = new UVector(deleteMatchInfo, NULL, status);
-    if (fMatches == NULL) {
+    fMatches = new UVector(deleteMatchInfo, nullptr, status);
+    if (fMatches == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
     } else if (U_FAILURE(status)) {
         delete fMatches;
-        fMatches = NULL;
+        fMatches = nullptr;
     }
     return fMatches;
 }
index 2005c07ba8150073ece5ea567aeab5ea0485c819..a2b6c6d4a99f7432159ac7eb7ce79dc66a69f3df 100644 (file)
@@ -54,10 +54,10 @@ static const int32_t TZDBNAMES_KEYS_SIZE = UPRV_LENGTHOF(TZDBNAMES_KEYS);
 
 static UMutex gDataMutex;
 
-static UHashtable* gTZDBNamesMap = NULL;
+static UHashtable* gTZDBNamesMap = nullptr;
 static icu::UInitOnce gTZDBNamesMapInitOnce {};
 
-static TextTrieMap* gTZDBNamesTrie = NULL;
+static TextTrieMap* gTZDBNamesTrie = nullptr;
 static icu::UInitOnce gTZDBNamesTrieInitOnce {};
 
 // The order in which strings are stored may be different than the order in the public enum.
@@ -76,15 +76,15 @@ static const UChar* const EMPTY_NAMES[UTZNM_INDEX_COUNT] = {0,0,0,0,0,0,0};
 
 U_CDECL_BEGIN
 static UBool U_CALLCONV tzdbTimeZoneNames_cleanup(void) {
-    if (gTZDBNamesMap != NULL) {
+    if (gTZDBNamesMap != nullptr) {
         uhash_close(gTZDBNamesMap);
-        gTZDBNamesMap = NULL;
+        gTZDBNamesMap = nullptr;
     }
     gTZDBNamesMapInitOnce.reset();
 
-    if (gTZDBNamesTrie != NULL) {
+    if (gTZDBNamesTrie != nullptr) {
         delete gTZDBNamesTrie;
-        gTZDBNamesTrie = NULL;
+        gTZDBNamesTrie = nullptr;
     }
     gTZDBNamesTrieInitOnce.reset();
 
@@ -122,7 +122,7 @@ void CharacterNode::clear() {
 }
 
 void CharacterNode::deleteValues(UObjectDeleter *valueDeleter) {
-    if (fValues == NULL) {
+    if (fValues == nullptr) {
         // Do nothing.
     } else if (!fHasValuesVector) {
         if (valueDeleter) {
@@ -141,7 +141,7 @@ CharacterNode::addValue(void *value, UObjectDeleter *valueDeleter, UErrorCode &s
         }
         return;
     }
-    if (fValues == NULL) {
+    if (fValues == nullptr) {
         fValues = value;
     } else {
         // At least one value already.
@@ -149,7 +149,7 @@ CharacterNode::addValue(void *value, UObjectDeleter *valueDeleter, UErrorCode &s
             // There is only one value so far, and not in a vector yet.
             // Create a vector and add the old value.
             LocalPointer<UVector> values(
-                new UVector(valueDeleter, NULL, DEFAULT_CHARACTERNODE_CAPACITY, status), status);
+                new UVector(valueDeleter, nullptr, DEFAULT_CHARACTERNODE_CAPACITY, status), status);
             if (U_FAILURE(status)) {
                 if (valueDeleter) {
                     valueDeleter(value);
@@ -184,8 +184,8 @@ TextTrieMapSearchResultHandler::~TextTrieMapSearchResultHandler(){
 // TextTrieMap class implementation
 // ---------------------------------------------------
 TextTrieMap::TextTrieMap(UBool ignoreCase, UObjectDeleter *valueDeleter)
-: fIgnoreCase(ignoreCase), fNodes(NULL), fNodesCapacity(0), fNodesCount(0), 
-  fLazyContents(NULL), fIsEmpty(true), fValueDeleter(valueDeleter) {
+: fIgnoreCase(ignoreCase), fNodes(nullptr), fNodesCapacity(0), fNodesCount(0), 
+  fLazyContents(nullptr), fIsEmpty(true), fValueDeleter(valueDeleter) {
 }
 
 TextTrieMap::~TextTrieMap() {
@@ -194,7 +194,7 @@ TextTrieMap::~TextTrieMap() {
         fNodes[index].deleteValues(fValueDeleter);
     }
     uprv_free(fNodes);
-    if (fLazyContents != NULL) {
+    if (fLazyContents != nullptr) {
         for (int32_t i=0; i<fLazyContents->size(); i+=2) {
             if (fValueDeleter) {
                 fValueDeleter(fLazyContents->elementAt(i+1));
@@ -228,7 +228,7 @@ TextTrieMap::put(const UnicodeString &key, void *value, ZNStringPool &sp, UError
 void
 TextTrieMap::put(const UChar *key, void *value, UErrorCode &status) {
     fIsEmpty = false;
-    if (fLazyContents == NULL) {
+    if (fLazyContents == nullptr) {
         LocalPointer<UVector> lpLazyContents(new UVector(status), status);
         fLazyContents = lpLazyContents.orphan();
     }
@@ -238,7 +238,7 @@ TextTrieMap::put(const UChar *key, void *value, UErrorCode &status) {
         }
         return;
     }
-    U_ASSERT(fLazyContents != NULL);
+    U_ASSERT(fLazyContents != nullptr);
 
     UChar *s = const_cast<UChar *>(key);
     fLazyContents->addElement(s, status);
@@ -254,10 +254,10 @@ TextTrieMap::put(const UChar *key, void *value, UErrorCode &status) {
 
 void
 TextTrieMap::putImpl(const UnicodeString &key, void *value, UErrorCode &status) {
-    if (fNodes == NULL) {
+    if (fNodes == nullptr) {
         fNodesCapacity = 512;
         fNodes = (CharacterNode *)uprv_malloc(fNodesCapacity * sizeof(CharacterNode));
-        if (fNodes == NULL) {
+        if (fNodes == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
@@ -296,7 +296,7 @@ TextTrieMap::growNodes() {
         newCapacity = 0xffff;
     }
     CharacterNode *newNodes = (CharacterNode *)uprv_malloc(newCapacity * sizeof(CharacterNode));
-    if (newNodes == NULL) {
+    if (newNodes == nullptr) {
         return false;
     }
     uprv_memcpy(newNodes, fNodes, fNodesCount * sizeof(CharacterNode));
@@ -309,7 +309,7 @@ TextTrieMap::growNodes() {
 CharacterNode*
 TextTrieMap::addChildNode(CharacterNode *parent, UChar c, UErrorCode &status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     // Linear search of the sorted list of children.
     uint16_t prevIndex = 0;
@@ -331,7 +331,7 @@ TextTrieMap::addChildNode(CharacterNode *parent, UChar c, UErrorCode &status) {
         int32_t parentIndex = (int32_t)(parent - fNodes);
         if (!growNodes()) {
             status = U_MEMORY_ALLOCATION_ERROR;
-            return NULL;
+            return nullptr;
         }
         parent = fNodes + parentIndex;
     }
@@ -364,7 +364,7 @@ TextTrieMap::getChildNode(CharacterNode *parent, UChar c) const {
         }
         nodeIndex = current->fNextSibling;
     }
-    return NULL;
+    return nullptr;
 }
 
 
@@ -373,7 +373,7 @@ TextTrieMap::getChildNode(CharacterNode *parent, UChar c) const {
 //               needed for parsing operations, which are less common than formatting,
 //               and the Trie is big, which is why its creation is deferred until first use.
 void TextTrieMap::buildTrie(UErrorCode &status) {
-    if (fLazyContents != NULL) {
+    if (fLazyContents != nullptr) {
         for (int32_t i=0; i<fLazyContents->size(); i+=2) {
             const UChar *key = (UChar *)fLazyContents->elementAt(i);
             void  *val = fLazyContents->elementAt(i+1);
@@ -381,7 +381,7 @@ void TextTrieMap::buildTrie(UErrorCode &status) {
             putImpl(keyString, val, status);
         }
         delete fLazyContents;
-        fLazyContents = NULL
+        fLazyContents = nullptr
     }
 }
 
@@ -399,12 +399,12 @@ TextTrieMap::search(const UnicodeString &text, int32_t start,
         static UMutex TextTrieMutex;
 
         Mutex lock(&TextTrieMutex);
-        if (fLazyContents != NULL) {
+        if (fLazyContents != nullptr) {
             TextTrieMap *nonConstThis = const_cast<TextTrieMap *>(this);
             nonConstThis->buildTrie(status);
         }
     }
-    if (fNodes == NULL) {
+    if (fNodes == nullptr) {
         return;
     }
     search(fNodes, text, start, start, handler, status);
@@ -436,7 +436,7 @@ TextTrieMap::search(CharacterNode *node, const UnicodeString &text, int32_t star
         while (tmpidx < tmp.length()) {
             UChar c = tmp.charAt(tmpidx++);
             node = getChildNode(node, c);
-            if (node == NULL) {
+            if (node == nullptr) {
                 break;
             }
         }
@@ -445,7 +445,7 @@ TextTrieMap::search(CharacterNode *node, const UnicodeString &text, int32_t star
         UChar c = text.charAt(index++);
         node = getChildNode(node, c);
     }
-    if (node != NULL) {
+    if (node != nullptr) {
         search(node, text, start, index, handler, status);
     }
 }
@@ -462,18 +462,18 @@ struct ZNStringPoolChunk: public UMemory {
 };
 
 ZNStringPoolChunk::ZNStringPoolChunk() {
-    fNext = NULL;
+    fNext = nullptr;
     fLimit = 0;
 }
 
 ZNStringPool::ZNStringPool(UErrorCode &status) {
-    fChunks = NULL;
-    fHash   = NULL;
+    fChunks = nullptr;
+    fHash   = nullptr;
     if (U_FAILURE(status)) {
         return;
     }
     fChunks = new ZNStringPoolChunk;
-    if (fChunks == NULL) {
+    if (fChunks == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -488,12 +488,12 @@ ZNStringPool::ZNStringPool(UErrorCode &status) {
 }
 
 ZNStringPool::~ZNStringPool() {
-    if (fHash != NULL) {
+    if (fHash != nullptr) {
         uhash_close(fHash);
-        fHash = NULL;
+        fHash = nullptr;
     }
 
-    while (fChunks != NULL) {
+    while (fChunks != nullptr) {
         ZNStringPoolChunk *nextChunk = fChunks->fNext;
         delete fChunks;
         fChunks = nextChunk;
@@ -509,7 +509,7 @@ const UChar *ZNStringPool::get(const UChar *s, UErrorCode &status) {
     }
 
     pooledString = static_cast<UChar *>(uhash_get(fHash, s));
-    if (pooledString != NULL) {
+    if (pooledString != nullptr) {
         return pooledString;
     }
 
@@ -523,7 +523,7 @@ const UChar *ZNStringPool::get(const UChar *s, UErrorCode &status) {
         }
         ZNStringPoolChunk *oldChunk = fChunks;
         fChunks = new ZNStringPoolChunk;
-        if (fChunks == NULL) {
+        if (fChunks == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return &EmptyString;
         }
@@ -548,9 +548,9 @@ const UChar *ZNStringPool::adopt(const UChar * s, UErrorCode &status) {
     if (U_FAILURE(status)) {
         return &EmptyString;
     }
-    if (s != NULL) {
+    if (s != nullptr) {
         pooledString = static_cast<UChar *>(uhash_get(fHash, s));
-        if (pooledString == NULL) {
+        if (pooledString == nullptr) {
             UChar *ncs = const_cast<UChar *>(s);
             uhash_put(fHash, ncs, ncs, &status);
         }
@@ -573,7 +573,7 @@ const UChar *ZNStringPool::get(const UnicodeString &s, UErrorCode &status) {
  */
 void ZNStringPool::freeze() {
     uhash_close(fHash);
-    fHash = NULL;
+    fHash = nullptr;
 }
 
 
@@ -619,7 +619,7 @@ private:
     ZNames(const UChar* names[], const UChar* locationName)
             : fDidAddIntoTrie(false) {
         uprv_memcpy(fNames, names, sizeof(fNames));
-        if (locationName != NULL) {
+        if (locationName != nullptr) {
             fOwnsLocationName = true;
             fNames[UTZNM_INDEX_EXEMPLAR_LOCATION] = locationName;
         } else {
@@ -631,7 +631,7 @@ public:
     ~ZNames() {
         if (fOwnsLocationName) {
             const UChar* locationName = fNames[UTZNM_INDEX_EXEMPLAR_LOCATION];
-            U_ASSERT(locationName != NULL);
+            U_ASSERT(locationName != nullptr);
             uprv_free((void*) locationName);
         }
     }
@@ -639,8 +639,8 @@ public:
 private:
     static void* createMetaZoneAndPutInCache(UHashtable* cache, const UChar* names[],
             const UnicodeString& mzID, UErrorCode& status) {
-        if (U_FAILURE(status)) { return NULL; }
-        U_ASSERT(names != NULL);
+        if (U_FAILURE(status)) { return nullptr; }
+        U_ASSERT(names != nullptr);
 
         // Use the persistent ID as the resource key, so we can
         // avoid duplications.
@@ -650,10 +650,10 @@ private:
         if (uprv_memcmp(names, EMPTY_NAMES, sizeof(EMPTY_NAMES)) == 0) {
             value = (void*) EMPTY;
         } else {
-            value = (void*) (new ZNames(names, NULL));
-            if (value == NULL) {
+            value = (void*) (new ZNames(names, nullptr));
+            if (value == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
-                return NULL;
+                return nullptr;
             }
         }
         uhash_put(cache, key, value, &status);
@@ -662,12 +662,12 @@ private:
 
     static void* createTimeZoneAndPutInCache(UHashtable* cache, const UChar* names[],
             const UnicodeString& tzID, UErrorCode& status) {
-        if (U_FAILURE(status)) { return NULL; }
-        U_ASSERT(names != NULL);
+        if (U_FAILURE(status)) { return nullptr; }
+        U_ASSERT(names != nullptr);
 
         // If necessary, compute the location name from the time zone name.
-        UChar* locationName = NULL;
-        if (names[UTZNM_INDEX_EXEMPLAR_LOCATION] == NULL) {
+        UChar* locationName = nullptr;
+        if (names[UTZNM_INDEX_EXEMPLAR_LOCATION] == nullptr) {
             UnicodeString locationNameUniStr;
             TimeZoneNamesImpl::getDefaultExemplarLocationName(tzID, locationNameUniStr);
 
@@ -676,9 +676,9 @@ private:
                 const UChar* buff = locationNameUniStr.getTerminatedBuffer();
                 int32_t len = sizeof(UChar) * (locationNameUniStr.length() + 1);
                 locationName = (UChar*) uprv_malloc(len);
-                if (locationName == NULL) {
+                if (locationName == nullptr) {
                     status = U_MEMORY_ALLOCATION_ERROR;
-                    return NULL;
+                    return nullptr;
                 }
                 uprv_memcpy(locationName, buff, len);
             }
@@ -689,9 +689,9 @@ private:
         // TODO: Is there a more efficient way, like intern() in Java?
         void* key = (void*) ZoneMeta::findTimeZoneID(tzID);
         void* value = (void*) (new ZNames(names, locationName));
-        if (value == NULL) {
+        if (value == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
-            return NULL;
+            return nullptr;
         }
         uhash_put(cache, key, value, &status);
         return value;
@@ -699,14 +699,14 @@ private:
 
     const UChar* getName(UTimeZoneNameType type) const {
         UTimeZoneNameTypeIndex index = getTZNameTypeIndex(type);
-        return index >= 0 ? fNames[index] : NULL;
+        return index >= 0 ? fNames[index] : nullptr;
     }
 
     void addAsMetaZoneIntoTrie(const UChar* mzID, TextTrieMap& trie, UErrorCode& status) {
-        addNamesIntoTrie(mzID, NULL, trie, status);
+        addNamesIntoTrie(mzID, nullptr, trie, status);
     }
     void addAsTimeZoneIntoTrie(const UChar* tzID, TextTrieMap& trie, UErrorCode& status) {
-        addNamesIntoTrie(NULL, tzID, trie, status);
+        addNamesIntoTrie(nullptr, tzID, trie, status);
     }
 
     void addNamesIntoTrie(const UChar* mzID, const UChar* tzID, TextTrieMap& trie,
@@ -717,9 +717,9 @@ private:
 
         for (int32_t i = 0; i < UTZNM_INDEX_COUNT; i++) {
             const UChar* name = fNames[i];
-            if (name != NULL) {
+            if (name != nullptr) {
                 ZNameInfo *nameinfo = (ZNameInfo *)uprv_malloc(sizeof(ZNameInfo));
-                if (nameinfo == NULL) {
+                if (nameinfo == nullptr) {
                     status = U_MEMORY_ALLOCATION_ERROR;
                     return;
                 }
@@ -776,8 +776,8 @@ struct ZNames::ZNamesLoader : public ResourceSink {
     }
 
     void loadNames(const UResourceBundle* zoneStrings, const char* key, UErrorCode& errorCode) {
-        U_ASSERT(zoneStrings != NULL);
-        U_ASSERT(key != NULL);
+        U_ASSERT(zoneStrings != nullptr);
+        U_ASSERT(key != nullptr);
         U_ASSERT(key[0] != '\0');
 
         UErrorCode localStatus = U_ZERO_ERROR;
@@ -793,11 +793,11 @@ struct ZNames::ZNamesLoader : public ResourceSink {
     void setNameIfEmpty(const char* key, const ResourceValue* value, UErrorCode& errorCode) {
         UTimeZoneNameTypeIndex type = nameTypeFromKey(key);
         if (type == UTZNM_INDEX_UNKNOWN) { return; }
-        if (names[type] == NULL) {
+        if (names[type] == nullptr) {
             int32_t length;
             // 'NO_NAME' indicates internally that this field should remain empty.  It will be
-            // replaced by 'NULL' in getNames()
-            names[type] = (value == NULL) ? NO_NAME : value->getString(length, errorCode);
+            // replaced by 'nullptr' in getNames()
+            names[type] = (value == nullptr) ? NO_NAME : value->getString(length, errorCode);
         }
     }
 
@@ -807,7 +807,7 @@ struct ZNames::ZNamesLoader : public ResourceSink {
         if (U_FAILURE(errorCode)) { return; }
         for (int32_t i = 0; namesTable.getKeyAndValue(i, key, value); ++i) {
             if (value.isNoInheritanceMarker()) {
-                setNameIfEmpty(key, NULL, errorCode);
+                setNameIfEmpty(key, nullptr, errorCode);
             } else {
                 setNameIfEmpty(key, &value, errorCode);
             }
@@ -842,10 +842,10 @@ struct ZNames::ZNamesLoader : public ResourceSink {
     * may be returned.
     */
     const UChar** getNames() {
-        // Remove 'NO_NAME' references in the array and replace with 'NULL'
+        // Remove 'NO_NAME' references in the array and replace with 'nullptr'
         for (int32_t i = 0; i < UTZNM_INDEX_COUNT; ++i) {
             if (names[i] == NO_NAME) {
-                names[i] = NULL;
+                names[i] = nullptr;
             }
         }
         return names;
@@ -879,11 +879,11 @@ private:
 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(MetaZoneIDsEnumeration)
 
 MetaZoneIDsEnumeration::MetaZoneIDsEnumeration() 
-: fLen(0), fPos(0), fMetaZoneIDs(NULL), fLocalVector(NULL) {
+: fLen(0), fPos(0), fMetaZoneIDs(nullptr), fLocalVector(nullptr) {
 }
 
 MetaZoneIDsEnumeration::MetaZoneIDsEnumeration(const UVector& mzIDs) 
-: fPos(0), fMetaZoneIDs(&mzIDs), fLocalVector(NULL) {
+: fPos(0), fMetaZoneIDs(&mzIDs), fLocalVector(nullptr) {
     fLen = fMetaZoneIDs->size();
 }
 
@@ -897,11 +897,11 @@ MetaZoneIDsEnumeration::MetaZoneIDsEnumeration(LocalPointer<UVector> mzIDs)
 
 const UnicodeString*
 MetaZoneIDsEnumeration::snext(UErrorCode& status) {
-    if (U_SUCCESS(status) && fMetaZoneIDs != NULL && fPos < fLen) {
+    if (U_SUCCESS(status) && fMetaZoneIDs != nullptr && fPos < fLen) {
         unistr.setTo((const UChar*)fMetaZoneIDs->elementAt(fPos++), -1);
         return &unistr;
     }
-    return NULL;
+    return nullptr;
 }
 
 void
@@ -936,11 +936,11 @@ private:
 };
 
 ZNameSearchHandler::ZNameSearchHandler(uint32_t types) 
-: fTypes(types), fMaxMatchLen(0), fResults(NULL) {
+: fTypes(types), fMaxMatchLen(0), fResults(nullptr) {
 }
 
 ZNameSearchHandler::~ZNameSearchHandler() {
-    if (fResults != NULL) {
+    if (fResults != nullptr) {
         delete fResults;
     }
 }
@@ -954,19 +954,19 @@ ZNameSearchHandler::handleMatch(int32_t matchLength, const CharacterNode *node,
         int32_t valuesCount = node->countValues();
         for (int32_t i = 0; i < valuesCount; i++) {
             ZNameInfo *nameinfo = (ZNameInfo *)node->getValue(i);
-            if (nameinfo == NULL) {
+            if (nameinfo == nullptr) {
                 continue;
             }
             if ((nameinfo->type & fTypes) != 0) {
                 // matches a requested type
-                if (fResults == NULL) {
+                if (fResults == nullptr) {
                     fResults = new TimeZoneNames::MatchInfoCollection();
-                    if (fResults == NULL) {
+                    if (fResults == nullptr) {
                         status = U_MEMORY_ALLOCATION_ERROR;
                     }
                 }
                 if (U_SUCCESS(status)) {
-                    U_ASSERT(fResults != NULL);
+                    U_ASSERT(fResults != nullptr);
                     if (nameinfo->tzID) {
                         fResults->addZone(nameinfo->type, matchLength, UnicodeString(nameinfo->tzID, -1), status);
                     } else {
@@ -990,7 +990,7 @@ ZNameSearchHandler::getMatches(int32_t& maxMatchLen) {
     maxMatchLen = fMaxMatchLen;
 
     // reset
-    fResults = NULL;
+    fResults = nullptr;
     fMaxMatchLen = 0;
     return results;
 }
@@ -1025,9 +1025,9 @@ U_CDECL_END
 
 TimeZoneNamesImpl::TimeZoneNamesImpl(const Locale& locale, UErrorCode& status)
 : fLocale(locale),
-  fZoneStrings(NULL),
-  fTZNamesMap(NULL),
-  fMZNamesMap(NULL),
+  fZoneStrings(nullptr),
+  fTZNamesMap(nullptr),
+  fMZNamesMap(nullptr),
   fNamesTrieFullyLoaded(false),
   fNamesFullyLoaded(false),
   fNamesTrie(true, deleteZNameInfo) {
@@ -1051,8 +1051,8 @@ TimeZoneNamesImpl::initialize(const Locale& locale, UErrorCode& status) {
     }
 
     // Initialize hashtables holding time zone/meta zone names
-    fMZNamesMap = uhash_open(uhash_hashUChars, uhash_compareUChars, NULL, &status);
-    fTZNamesMap = uhash_open(uhash_hashUChars, uhash_compareUChars, NULL, &status);
+    fMZNamesMap = uhash_open(uhash_hashUChars, uhash_compareUChars, nullptr, &status);
+    fTZNamesMap = uhash_open(uhash_hashUChars, uhash_compareUChars, nullptr, &status);
     if (U_FAILURE(status)) {
         cleanup();
         return;
@@ -1065,7 +1065,7 @@ TimeZoneNamesImpl::initialize(const Locale& locale, UErrorCode& status) {
     // preload zone strings for the default zone
     TimeZone *tz = TimeZone::createDefault();
     const UChar *tzID = ZoneMeta::getCanonicalCLDRID(*tz);
-    if (tzID != NULL) {
+    if (tzID != nullptr) {
         loadStrings(UnicodeString(tzID), status);
     }
     delete tz;
@@ -1085,7 +1085,7 @@ TimeZoneNamesImpl::loadStrings(const UnicodeString& tzCanonicalID, UErrorCode& s
     U_ASSERT(!mzIDs.isNull());
 
     const UnicodeString *mzID;
-    while (((mzID = mzIDs->snext(status)) != NULL) && U_SUCCESS(status)) {
+    while (((mzID = mzIDs->snext(status)) != nullptr) && U_SUCCESS(status)) {
         loadMetaZoneNames(*mzID, status);
     }
 }
@@ -1096,17 +1096,17 @@ TimeZoneNamesImpl::~TimeZoneNamesImpl() {
 
 void
 TimeZoneNamesImpl::cleanup() {
-    if (fZoneStrings != NULL) {
+    if (fZoneStrings != nullptr) {
         ures_close(fZoneStrings);
-        fZoneStrings = NULL;
+        fZoneStrings = nullptr;
     }
-    if (fMZNamesMap != NULL) {
+    if (fMZNamesMap != nullptr) {
         uhash_close(fMZNamesMap);
-        fMZNamesMap = NULL;
+        fMZNamesMap = nullptr;
     }
-    if (fTZNamesMap != NULL) {
+    if (fTZNamesMap != nullptr) {
         uhash_close(fTZNamesMap);
-        fTZNamesMap = NULL;
+        fTZNamesMap = nullptr;
     }
 }
 
@@ -1134,10 +1134,10 @@ TimeZoneNamesImpl::getAvailableMetaZoneIDs(UErrorCode& status) const {
 StringEnumeration*
 TimeZoneNamesImpl::_getAvailableMetaZoneIDs(UErrorCode& status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     const UVector* mzIDs = ZoneMeta::getAvailableMetazoneIDs();
-    if (mzIDs == NULL) {
+    if (mzIDs == nullptr) {
         return new MetaZoneIDsEnumeration();
     }
     return new MetaZoneIDsEnumeration(*mzIDs);
@@ -1152,15 +1152,15 @@ TimeZoneNamesImpl::getAvailableMetaZoneIDs(const UnicodeString& tzID, UErrorCode
 StringEnumeration*
 TimeZoneNamesImpl::_getAvailableMetaZoneIDs(const UnicodeString& tzID, UErrorCode& status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     const UVector* mappings = ZoneMeta::getMetazoneMappings(tzID);
-    if (mappings == NULL) {
+    if (mappings == nullptr) {
         return new MetaZoneIDsEnumeration();
     }
 
     LocalPointer<MetaZoneIDsEnumeration> senum;
-    LocalPointer<UVector> mzIDs(new UVector(NULL, uhash_compareUChars, status), status);
+    LocalPointer<UVector> mzIDs(new UVector(nullptr, uhash_compareUChars, status), status);
     if (U_SUCCESS(status)) {
         U_ASSERT(mzIDs.isValid());
         for (int32_t i = 0; U_SUCCESS(status) && i < mappings->size(); i++) {
@@ -1211,7 +1211,7 @@ TimeZoneNamesImpl::getMetaZoneDisplayName(const UnicodeString& mzID,
         return name;
     }
 
-    ZNames *znames = NULL;
+    ZNames *znames = nullptr;
     TimeZoneNamesImpl *nonConstThis = const_cast<TimeZoneNamesImpl *>(this);
 
     {
@@ -1221,9 +1221,9 @@ TimeZoneNamesImpl::getMetaZoneDisplayName(const UnicodeString& mzID,
         if (U_FAILURE(status)) { return name; }
     }
 
-    if (znames != NULL) {
+    if (znames != nullptr) {
         const UChar* s = znames->getName(type);
-        if (s != NULL) {
+        if (s != nullptr) {
             name.setTo(true, s, -1);
         }
     }
@@ -1237,7 +1237,7 @@ TimeZoneNamesImpl::getTimeZoneDisplayName(const UnicodeString& tzID, UTimeZoneNa
         return name;
     }
 
-    ZNames *tznames = NULL;
+    ZNames *tznames = nullptr;
     TimeZoneNamesImpl *nonConstThis = const_cast<TimeZoneNamesImpl *>(this);
 
     {
@@ -1247,9 +1247,9 @@ TimeZoneNamesImpl::getTimeZoneDisplayName(const UnicodeString& tzID, UTimeZoneNa
         if (U_FAILURE(status)) { return name; }
     }
 
-    if (tznames != NULL) {
+    if (tznames != nullptr) {
         const UChar *s = tznames->getName(type);
-        if (s != NULL) {
+        if (s != nullptr) {
             name.setTo(true, s, -1);
         }
     }
@@ -1259,8 +1259,8 @@ TimeZoneNamesImpl::getTimeZoneDisplayName(const UnicodeString& tzID, UTimeZoneNa
 UnicodeString&
 TimeZoneNamesImpl::getExemplarLocationName(const UnicodeString& tzID, UnicodeString& name) const {
     name.setToBogus();  // cleanup result.
-    const UChar* locName = NULL;
-    ZNames *tznames = NULL;
+    const UChar* locName = nullptr;
+    ZNames *tznames = nullptr;
     TimeZoneNamesImpl *nonConstThis = const_cast<TimeZoneNamesImpl *>(this);
 
     {
@@ -1270,10 +1270,10 @@ TimeZoneNamesImpl::getExemplarLocationName(const UnicodeString& tzID, UnicodeStr
         if (U_FAILURE(status)) { return name; }
     }
 
-    if (tznames != NULL) {
+    if (tznames != nullptr) {
         locName = tznames->getName(UTZNM_EXEMPLAR_LOCATION);
     }
-    if (locName != NULL) {
+    if (locName != nullptr) {
         name.setTo(true, locName, -1);
     }
 
@@ -1302,7 +1302,7 @@ static void mergeTimeZoneKey(const UnicodeString& mzID, char* result) {
  */
 ZNames*
 TimeZoneNamesImpl::loadMetaZoneNames(const UnicodeString& mzID, UErrorCode& status) {
-    if (U_FAILURE(status)) { return NULL; }
+    if (U_FAILURE(status)) { return nullptr; }
     U_ASSERT(mzID.length() <= ZID_KEY_MAX - MZ_PREFIX_LEN);
 
     UChar mzIDKey[ZID_KEY_MAX + 1];
@@ -1311,17 +1311,17 @@ TimeZoneNamesImpl::loadMetaZoneNames(const UnicodeString& mzID, UErrorCode& stat
     mzIDKey[mzID.length()] = 0;
 
     void* mznames = uhash_get(fMZNamesMap, mzIDKey);
-    if (mznames == NULL) {
+    if (mznames == nullptr) {
         ZNames::ZNamesLoader loader;
         loader.loadMetaZone(fZoneStrings, mzID, status);
         mznames = ZNames::createMetaZoneAndPutInCache(fMZNamesMap, loader.getNames(), mzID, status);
-        if (U_FAILURE(status)) { return NULL; }
+        if (U_FAILURE(status)) { return nullptr; }
     }
 
     if (mznames != EMPTY) {
         return (ZNames*)mznames;
     } else {
-        return NULL;
+        return nullptr;
     }
 }
 
@@ -1330,7 +1330,7 @@ TimeZoneNamesImpl::loadMetaZoneNames(const UnicodeString& mzID, UErrorCode& stat
  */
 ZNames*
 TimeZoneNamesImpl::loadTimeZoneNames(const UnicodeString& tzID, UErrorCode& status) {
-    if (U_FAILURE(status)) { return NULL; }
+    if (U_FAILURE(status)) { return nullptr; }
     U_ASSERT(tzID.length() <= ZID_KEY_MAX);
 
     UChar tzIDKey[ZID_KEY_MAX + 1];
@@ -1339,11 +1339,11 @@ TimeZoneNamesImpl::loadTimeZoneNames(const UnicodeString& tzID, UErrorCode& stat
     tzIDKey[tzIDKeyLen] = 0;
 
     void *tznames = uhash_get(fTZNamesMap, tzIDKey);
-    if (tznames == NULL) {
+    if (tznames == nullptr) {
         ZNames::ZNamesLoader loader;
         loader.loadTimeZone(fZoneStrings, tzID, status);
         tznames = ZNames::createTimeZoneAndPutInCache(fTZNamesMap, loader.getNames(), tzID, status);
-        if (U_FAILURE(status)) { return NULL; }
+        if (U_FAILURE(status)) { return nullptr; }
     }
 
     // tznames is never EMPTY
@@ -1363,8 +1363,8 @@ TimeZoneNamesImpl::find(const UnicodeString& text, int32_t start, uint32_t types
 
         // First try of lookup.
         matches = doFind(handler, text, start, status);
-        if (U_FAILURE(status)) { return NULL; }
-        if (matches != NULL) {
+        if (U_FAILURE(status)) { return nullptr; }
+        if (matches != nullptr) {
             return matches;
         }
 
@@ -1376,8 +1376,8 @@ TimeZoneNamesImpl::find(const UnicodeString& text, int32_t start, uint32_t types
 
         // Second try of lookup.
         matches = doFind(handler, text, start, status);
-        if (U_FAILURE(status)) { return NULL; }
-        if (matches != NULL) {
+        if (U_FAILURE(status)) { return nullptr; }
+        if (matches != nullptr) {
             return matches;
         }
 
@@ -1386,7 +1386,7 @@ TimeZoneNamesImpl::find(const UnicodeString& text, int32_t start, uint32_t types
         nonConstThis->internalLoadAllDisplayNames(status);
         nonConstThis->addAllNamesIntoTrie(status);
         nonConstThis->fNamesTrieFullyLoaded = true;
-        if (U_FAILURE(status)) { return NULL; }
+        if (U_FAILURE(status)) { return nullptr; }
 
         // Third try: we must return this one.
         return doFind(handler, text, start, status);
@@ -1398,16 +1398,16 @@ TimeZoneNamesImpl::doFind(ZNameSearchHandler& handler,
         const UnicodeString& text, int32_t start, UErrorCode& status) const {
 
     fNamesTrie.search(text, start, (TextTrieMapSearchResultHandler *)&handler, status);
-    if (U_FAILURE(status)) { return NULL; }
+    if (U_FAILURE(status)) { return nullptr; }
 
     int32_t maxLen = 0;
     TimeZoneNames::MatchInfoCollection* matches = handler.getMatches(maxLen);
-    if (matches != NULL && ((maxLen == (text.length() - start)) || fNamesTrieFullyLoaded)) {
+    if (matches != nullptr && ((maxLen == (text.length() - start)) || fNamesTrieFullyLoaded)) {
         // perfect match, or no more names available
         return matches;
     }
     delete matches;
-    return NULL;
+    return nullptr;
 }
 
 // Caller must synchronize.
@@ -1417,7 +1417,7 @@ void TimeZoneNamesImpl::addAllNamesIntoTrie(UErrorCode& status) {
     const UHashElement* element;
 
     pos = UHASH_FIRST;
-    while ((element = uhash_nextElement(fMZNamesMap, &pos)) != NULL) {
+    while ((element = uhash_nextElement(fMZNamesMap, &pos)) != nullptr) {
         if (element->value.pointer == EMPTY) { continue; }
         UChar* mzID = (UChar*) element->key.pointer;
         ZNames* znames = (ZNames*) element->value.pointer;
@@ -1426,7 +1426,7 @@ void TimeZoneNamesImpl::addAllNamesIntoTrie(UErrorCode& status) {
     }
 
     pos = UHASH_FIRST;
-    while ((element = uhash_nextElement(fTZNamesMap, &pos)) != NULL) {
+    while ((element = uhash_nextElement(fTZNamesMap, &pos)) != nullptr) {
         if (element->value.pointer == EMPTY) { continue; }
         UChar* tzID = (UChar*) element->key.pointer;
         ZNames* znames = (ZNames*) element->value.pointer;
@@ -1450,7 +1450,7 @@ struct TimeZoneNamesImpl::ZoneStringsLoader : public ResourceSink {
 
     ZoneStringsLoader(TimeZoneNamesImpl& _tzn, UErrorCode& status)
             : tzn(_tzn) {
-        keyToLoader = uhash_open(uhash_hashChars, uhash_compareChars, NULL, &status);
+        keyToLoader = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &status);
         if (U_FAILURE(status)) { return; }
         uhash_setKeyDeleter(keyToLoader, uprv_free);
         uhash_setValueDeleter(keyToLoader, deleteZNamesLoader);
@@ -1460,9 +1460,9 @@ struct TimeZoneNamesImpl::ZoneStringsLoader : public ResourceSink {
     void* createKey(const char* key, UErrorCode& status) {
         int32_t len = sizeof(char) * (static_cast<int32_t>(uprv_strlen(key)) + 1);
         char* newKey = (char*) uprv_malloc(len);
-        if (newKey == NULL) {
+        if (newKey == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
-            return NULL;
+            return nullptr;
         }
         uprv_memcpy(newKey, key, len);
         newKey[len-1] = '\0';
@@ -1494,7 +1494,7 @@ struct TimeZoneNamesImpl::ZoneStringsLoader : public ResourceSink {
 
         int32_t pos = UHASH_FIRST;
         const UHashElement* element;
-        while ((element = uhash_nextElement(keyToLoader, &pos)) != NULL) {
+        while ((element = uhash_nextElement(keyToLoader, &pos)) != nullptr) {
             if (element->value.pointer == DUMMY_LOADER) { continue; }
             ZNames::ZNamesLoader* loader = (ZNames::ZNamesLoader*) element->value.pointer;
             char* key = (char*) element->key.pointer;
@@ -1515,16 +1515,16 @@ struct TimeZoneNamesImpl::ZoneStringsLoader : public ResourceSink {
         if (U_FAILURE(status)) { return; }
 
         void* loader = uhash_get(keyToLoader, key);
-        if (loader == NULL) {
+        if (loader == nullptr) {
             if (isMetaZone(key)) {
                 UnicodeString mzID = mzIDFromKey(key);
                 void* cacheVal = uhash_get(tzn.fMZNamesMap, mzID.getTerminatedBuffer());
-                if (cacheVal != NULL) {
+                if (cacheVal != nullptr) {
                     // We have already loaded the names for this meta zone.
                     loader = (void*) DUMMY_LOADER;
                 } else {
                     loader = (void*) new ZNames::ZNamesLoader();
-                    if (loader == NULL) {
+                    if (loader == nullptr) {
                         status = U_MEMORY_ALLOCATION_ERROR;
                         return;
                     }
@@ -1532,12 +1532,12 @@ struct TimeZoneNamesImpl::ZoneStringsLoader : public ResourceSink {
             } else {
                 UnicodeString tzID = tzIDFromKey(key);
                 void* cacheVal = uhash_get(tzn.fTZNamesMap, tzID.getTerminatedBuffer());
-                if (cacheVal != NULL) {
+                if (cacheVal != nullptr) {
                     // We have already loaded the names for this time zone.
                     loader = (void*) DUMMY_LOADER;
                 } else {
                     loader = (void*) new ZNames::ZNamesLoader();
-                    if (loader == NULL) {
+                    if (loader == nullptr) {
                         status = U_MEMORY_ALLOCATION_ERROR;
                         return;
                     }
@@ -1597,8 +1597,8 @@ void TimeZoneNamesImpl::getDisplayNames(const UnicodeString& tzID,
     if (U_FAILURE(status)) return;
 
     if (tzID.isEmpty()) { return; }
-    void* tznames = NULL;
-    void* mznames = NULL;
+    void* tznames = nullptr;
+    void* mznames = nullptr;
     TimeZoneNamesImpl *nonConstThis = const_cast<TimeZoneNamesImpl*>(this);
 
     // Load the time zone strings
@@ -1607,14 +1607,14 @@ void TimeZoneNamesImpl::getDisplayNames(const UnicodeString& tzID,
         tznames = (void*) nonConstThis->loadTimeZoneNames(tzID, status);
         if (U_FAILURE(status)) { return; }
     }
-    U_ASSERT(tznames != NULL);
+    U_ASSERT(tznames != nullptr);
 
     // Load the values into the dest array
     for (int i = 0; i < numTypes; i++) {
         UTimeZoneNameType type = types[i];
         const UChar* name = ((ZNames*)tznames)->getName(type);
-        if (name == NULL) {
-            if (mznames == NULL) {
+        if (name == nullptr) {
+            if (mznames == nullptr) {
                 // Load the meta zone name
                 UnicodeString mzID;
                 getMetaZoneID(tzID, date, mzID);
@@ -1627,18 +1627,18 @@ void TimeZoneNamesImpl::getDisplayNames(const UnicodeString& tzID,
                     mznames = (void*) nonConstThis->loadMetaZoneNames(mzID, status);
                     if (U_FAILURE(status)) { return; }
                     // Note: when the metazone doesn't exist, in Java, loadMetaZoneNames returns
-                    // a dummy object instead of NULL.
-                    if (mznames == NULL) {
+                    // a dummy object instead of nullptr.
+                    if (mznames == nullptr) {
                         mznames = (void*) EMPTY;
                     }
                 }
             }
-            U_ASSERT(mznames != NULL);
+            U_ASSERT(mznames != nullptr);
             if (mznames != EMPTY) {
                 name = ((ZNames*)mznames)->getName(type);
             }
         }
-        if (name != NULL) {
+        if (name != nullptr) {
             dest[i].setTo(true, name, -1);
         } else {
             dest[i].setToBogus();
@@ -1659,21 +1659,21 @@ void TimeZoneNamesImpl::internalLoadAllDisplayNames(UErrorCode& status) {
 
         // load strings for all zones
         StringEnumeration *tzIDs = TimeZone::createTimeZoneIDEnumeration(
-            UCAL_ZONE_TYPE_CANONICAL, NULL, NULL, status);
+            UCAL_ZONE_TYPE_CANONICAL, nullptr, nullptr, status);
         if (U_SUCCESS(status)) {
-            while ((id = tzIDs->snext(status)) != NULL) {
+            while ((id = tzIDs->snext(status)) != nullptr) {
                 if (U_FAILURE(status)) {
                     break;
                 }
                 UnicodeString copy(*id);
                 void* value = uhash_get(fTZNamesMap, copy.getTerminatedBuffer());
-                if (value == NULL) {
+                if (value == nullptr) {
                     // loadStrings also loads related metazone strings
                     loadStrings(*id, status);
                 }
             }
         }
-        if (tzIDs != NULL) {
+        if (tzIDs != nullptr) {
             delete tzIDs;
         }
     }
@@ -1738,10 +1738,10 @@ TZDBNames::TZDBNames(const UChar** names, char** regions, int32_t numRegions)
 }
 
 TZDBNames::~TZDBNames() {
-    if (fNames != NULL) {
+    if (fNames != nullptr) {
         uprv_free(fNames);
     }
-    if (fRegions != NULL) {
+    if (fRegions != nullptr) {
         char **p = fRegions;
         for (int32_t i = 0; i < fNumRegions; p++, i++) {
             uprv_free(*p);
@@ -1752,32 +1752,32 @@ TZDBNames::~TZDBNames() {
 
 TZDBNames*
 TZDBNames::createInstance(UResourceBundle* rb, const char* key) {
-    if (rb == NULL || key == NULL || *key == 0) {
-        return NULL;
+    if (rb == nullptr || key == nullptr || *key == 0) {
+        return nullptr;
     }
 
     UErrorCode status = U_ZERO_ERROR;
 
-    const UChar **names = NULL;
-    char** regions = NULL;
+    const UChar **names = nullptr;
+    char** regions = nullptr;
     int32_t numRegions = 0;
 
     int32_t len = 0;
 
-    UResourceBundle* rbTable = NULL;
+    UResourceBundle* rbTable = nullptr;
     rbTable = ures_getByKey(rb, key, rbTable, &status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     names = (const UChar **)uprv_malloc(sizeof(const UChar*) * TZDBNAMES_KEYS_SIZE);
     UBool isEmpty = true;
-    if (names != NULL) {
+    if (names != nullptr) {
         for (int32_t i = 0; i < TZDBNAMES_KEYS_SIZE; i++) {
             status = U_ZERO_ERROR;
             const UChar *value = ures_getStringByKey(rbTable, TZDBNAMES_KEYS[i], &len, &status);
             if (U_FAILURE(status) || len == 0) {
-                names[i] = NULL;
+                names[i] = nullptr;
             } else {
                 names[i] = value;
                 isEmpty = false;
@@ -1786,22 +1786,22 @@ TZDBNames::createInstance(UResourceBundle* rb, const char* key) {
     }
 
     if (isEmpty) {
-        if (names != NULL) {
+        if (names != nullptr) {
             uprv_free(names);
         }
-        return NULL;
+        return nullptr;
     }
 
-    UResourceBundle *regionsRes = ures_getByKey(rbTable, "parseRegions", NULL, &status);
+    UResourceBundle *regionsRes = ures_getByKey(rbTable, "parseRegions", nullptr, &status);
     UBool regionError = false;
     if (U_SUCCESS(status)) {
         numRegions = ures_getSize(regionsRes);
         if (numRegions > 0) {
             regions = (char**)uprv_malloc(sizeof(char*) * numRegions);
-            if (regions != NULL) {
+            if (regions != nullptr) {
                 char **pRegion = regions;
                 for (int32_t i = 0; i < numRegions; i++, pRegion++) {
-                    *pRegion = NULL;
+                    *pRegion = nullptr;
                 }
                 // filling regions
                 pRegion = regions;
@@ -1813,7 +1813,7 @@ TZDBNames::createInstance(UResourceBundle* rb, const char* key) {
                         break;
                     }
                     *pRegion = (char*)uprv_malloc(sizeof(char) * (len + 1));
-                    if (*pRegion == NULL) {
+                    if (*pRegion == nullptr) {
                         regionError = true;
                         break;
                     }
@@ -1827,17 +1827,17 @@ TZDBNames::createInstance(UResourceBundle* rb, const char* key) {
     ures_close(rbTable);
 
     if (regionError) {
-        if (names != NULL) {
+        if (names != nullptr) {
             uprv_free(names);
         }
-        if (regions != NULL) {
+        if (regions != nullptr) {
             char **p = regions;
             for (int32_t i = 0; i < numRegions; p++, i++) {
                 uprv_free(*p);
             }
             uprv_free(regions);
         }
-        return NULL;
+        return nullptr;
     }
 
     return new TZDBNames(names, regions, numRegions);
@@ -1845,10 +1845,10 @@ TZDBNames::createInstance(UResourceBundle* rb, const char* key) {
 
 const UChar*
 TZDBNames::getName(UTimeZoneNameType type) const {
-    if (fNames == NULL) {
-        return NULL;
+    if (fNames == nullptr) {
+        return nullptr;
     }
-    const UChar *name = NULL;
+    const UChar *name = nullptr;
     switch(type) {
     case UTZNM_SHORT_STANDARD:
         name = fNames[0];
@@ -1857,14 +1857,14 @@ TZDBNames::getName(UTimeZoneNameType type) const {
         name = fNames[1];
         break;
     default:
-        name = NULL;
+        name = nullptr;
     }
     return name;
 }
 
 const char**
 TZDBNames::getParseRegions(int32_t& numRegions) const {
-    if (fRegions == NULL) {
+    if (fRegions == nullptr) {
         numRegions = 0;
     } else {
         numRegions = fNumRegions;
@@ -1903,11 +1903,11 @@ private:
 };
 
 TZDBNameSearchHandler::TZDBNameSearchHandler(uint32_t types, const char* region) 
-: fTypes(types), fMaxMatchLen(0), fResults(NULL), fRegion(region) {
+: fTypes(types), fMaxMatchLen(0), fResults(nullptr), fRegion(region) {
 }
 
 TZDBNameSearchHandler::~TZDBNameSearchHandler() {
-    if (fResults != NULL) {
+    if (fResults != nullptr) {
         delete fResults;
     }
 }
@@ -1918,14 +1918,14 @@ TZDBNameSearchHandler::handleMatch(int32_t matchLength, const CharacterNode *nod
         return false;
     }
 
-    TZDBNameInfo *match = NULL;
-    TZDBNameInfo *defaultRegionMatch = NULL;
+    TZDBNameInfo *match = nullptr;
+    TZDBNameInfo *defaultRegionMatch = nullptr;
 
     if (node->hasValues()) {
         int32_t valuesCount = node->countValues();
         for (int32_t i = 0; i < valuesCount; i++) {
             TZDBNameInfo *ninfo = (TZDBNameInfo *)node->getValue(i);
-            if (ninfo == NULL) {
+            if (ninfo == nullptr) {
                 continue;
             }
             if ((ninfo->type & fTypes) != 0) {
@@ -1936,10 +1936,10 @@ TZDBNameSearchHandler::handleMatch(int32_t matchLength, const CharacterNode *nod
                 // multiple results returned for the same time zone type.
                 // For this reason, this implementation resolve one among same
                 // zone type with a same name at this level.
-                if (ninfo->parseRegions == NULL) {
+                if (ninfo->parseRegions == nullptr) {
                     // parseRegions == null means this is the default metazone
                     // mapping for the abbreviation.
-                    if (defaultRegionMatch == NULL) {
+                    if (defaultRegionMatch == nullptr) {
                         match = defaultRegionMatch = ninfo;
                     }
                 } else {
@@ -1960,14 +1960,14 @@ TZDBNameSearchHandler::handleMatch(int32_t matchLength, const CharacterNode *nod
                     if (matchRegion) {
                         break;
                     }
-                    if (match == NULL) {
+                    if (match == nullptr) {
                         match = ninfo;
                     }
                 }
             }
         }
 
-        if (match != NULL) {
+        if (match != nullptr) {
             UTimeZoneNameType ntype = match->type;
             // Note: Workaround for duplicated standard/daylight names
             // The tz database contains a few zones sharing a
@@ -1988,15 +1988,15 @@ TZDBNameSearchHandler::handleMatch(int32_t matchLength, const CharacterNode *nod
                 ntype = UTZNM_SHORT_GENERIC;
             }
 
-            if (fResults == NULL) {
+            if (fResults == nullptr) {
                 fResults = new TimeZoneNames::MatchInfoCollection();
-                if (fResults == NULL) {
+                if (fResults == nullptr) {
                     status = U_MEMORY_ALLOCATION_ERROR;
                 }
             }
             if (U_SUCCESS(status)) {
-                U_ASSERT(fResults != NULL);
-                U_ASSERT(match->mzID != NULL);
+                U_ASSERT(fResults != nullptr);
+                U_ASSERT(match->mzID != nullptr);
                 fResults->addMetaZone(ntype, matchLength, UnicodeString(match->mzID, -1), status);
                 if (U_SUCCESS(status) && matchLength > fMaxMatchLen) {
                     fMaxMatchLen = matchLength;
@@ -2014,7 +2014,7 @@ TZDBNameSearchHandler::getMatches(int32_t& maxMatchLen) {
     maxMatchLen = fMaxMatchLen;
 
     // reset
-    fResults = NULL;
+    fResults = nullptr;
     fMaxMatchLen = 0;
     return results;
 }
@@ -2031,9 +2031,9 @@ deleteTZDBNames(void *obj) {
 }
 
 static void U_CALLCONV initTZDBNamesMap(UErrorCode &status) {
-    gTZDBNamesMap = uhash_open(uhash_hashUChars, uhash_compareUChars, NULL, &status);
+    gTZDBNamesMap = uhash_open(uhash_hashUChars, uhash_compareUChars, nullptr, &status);
     if (U_FAILURE(status)) {
-        gTZDBNamesMap = NULL;
+        gTZDBNamesMap = nullptr;
         return;
     }
     // no key deleters for tzdb name maps
@@ -2046,7 +2046,7 @@ static void U_CALLCONV initTZDBNamesMap(UErrorCode &status) {
  */
 static void U_CALLCONV
 deleteTZDBNameInfo(void *obj) {
-    if (obj != NULL) {
+    if (obj != nullptr) {
         uprv_free(obj);
     }
 }
@@ -2056,7 +2056,7 @@ static void U_CALLCONV prepareFind(UErrorCode &status) {
         return;
     }
     gTZDBNamesTrie = new TextTrieMap(true, deleteTZDBNameInfo);
-    if (gTZDBNamesTrie == NULL) {
+    if (gTZDBNamesTrie == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -2069,12 +2069,12 @@ static void U_CALLCONV prepareFind(UErrorCode &status) {
             if (U_FAILURE(status)) {
                 break;
             }
-            if (names == NULL) {
+            if (names == nullptr) {
                 continue;
             }
             const UChar *std = names->getName(UTZNM_SHORT_STANDARD);
             const UChar *dst = names->getName(UTZNM_SHORT_DAYLIGHT);
-            if (std == NULL && dst == NULL) {
+            if (std == nullptr && dst == nullptr) {
                 continue;
             }
             int32_t numRegions = 0;
@@ -2085,12 +2085,12 @@ static void U_CALLCONV prepareFind(UErrorCode &status) {
             // time. For example, Australia/Sydney observes DST,
             // but "EST" is used for both standard and daylight.
             // we need to store the information for later processing.
-            UBool ambiguousType = (std != NULL && dst != NULL && u_strcmp(std, dst) == 0);
+            UBool ambiguousType = (std != nullptr && dst != nullptr && u_strcmp(std, dst) == 0);
 
             const UChar *uMzID = ZoneMeta::findMetaZoneID(*mzID);
-            if (std != NULL) {
+            if (std != nullptr) {
                 TZDBNameInfo *stdInf = (TZDBNameInfo *)uprv_malloc(sizeof(TZDBNameInfo));
-                if (stdInf == NULL) {
+                if (stdInf == nullptr) {
                     status = U_MEMORY_ALLOCATION_ERROR;
                     break;
                 }
@@ -2101,9 +2101,9 @@ static void U_CALLCONV prepareFind(UErrorCode &status) {
                 stdInf->nRegions = numRegions;
                 gTZDBNamesTrie->put(std, stdInf, status);
             }
-            if (U_SUCCESS(status) && dst != NULL) {
+            if (U_SUCCESS(status) && dst != nullptr) {
                 TZDBNameInfo *dstInf = (TZDBNameInfo *)uprv_malloc(sizeof(TZDBNameInfo));
-                if (dstInf == NULL) {
+                if (dstInf == nullptr) {
                     status = U_MEMORY_ALLOCATION_ERROR;
                     break;
                 }
@@ -2120,7 +2120,7 @@ static void U_CALLCONV prepareFind(UErrorCode &status) {
 
     if (U_FAILURE(status)) {
         delete gTZDBNamesTrie;
-        gTZDBNamesTrie = NULL;
+        gTZDBNamesTrie = nullptr;
         return;
     }
 
@@ -2203,9 +2203,9 @@ TZDBTimeZoneNames::getMetaZoneDisplayName(const UnicodeString& mzID,
     UErrorCode status = U_ZERO_ERROR;
     const TZDBNames *tzdbNames = TZDBTimeZoneNames::getMetaZoneNames(mzID, status);
     if (U_SUCCESS(status)) {
-        if (tzdbNames != NULL) {
+        if (tzdbNames != nullptr) {
             const UChar *s = tzdbNames->getName(type);
-            if (s != NULL) {
+            if (s != nullptr) {
                 name.setTo(true, s, -1);
             }
         }
@@ -2225,13 +2225,13 @@ TZDBTimeZoneNames::MatchInfoCollection*
 TZDBTimeZoneNames::find(const UnicodeString& text, int32_t start, uint32_t types, UErrorCode& status) const {
     umtx_initOnce(gTZDBNamesTrieInitOnce, &prepareFind, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     TZDBNameSearchHandler handler(types, fRegion);
     gTZDBNamesTrie->search(text, start, (TextTrieMapSearchResultHandler *)&handler, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     int32_t maxLen = 0;
     return handler.getMatches(maxLen);
@@ -2241,10 +2241,10 @@ const TZDBNames*
 TZDBTimeZoneNames::getMetaZoneNames(const UnicodeString& mzID, UErrorCode& status) {
     umtx_initOnce(gTZDBNamesMapInitOnce, &initTZDBNamesMap, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
-    TZDBNames* tzdbNames = NULL;
+    TZDBNames* tzdbNames = nullptr;
 
     UChar mzIDKey[ZID_KEY_MAX + 1];
     mzID.extract(mzIDKey, ZID_KEY_MAX + 1, status);
@@ -2255,7 +2255,7 @@ TZDBTimeZoneNames::getMetaZoneNames(const UnicodeString& mzID, UErrorCode& statu
     umtx_lock(&gTZDBNamesMapLock);
     {
         void *cacheVal = uhash_get(gTZDBNamesMap, mzIDKey);
-        if (cacheVal == NULL) {
+        if (cacheVal == nullptr) {
             UResourceBundle *zoneStringsRes = ures_openDirect(U_ICUDATA_ZONE, "tzdbNames", &status);
             zoneStringsRes = ures_getByKey(zoneStringsRes, gZoneStrings, zoneStringsRes, &status);
             if (U_SUCCESS(status)) {
@@ -2263,7 +2263,7 @@ TZDBTimeZoneNames::getMetaZoneNames(const UnicodeString& mzID, UErrorCode& statu
                 mergeTimeZoneKey(mzID, key);
                 tzdbNames = TZDBNames::createInstance(zoneStringsRes, key);
 
-                if (tzdbNames == NULL) {
+                if (tzdbNames == nullptr) {
                     cacheVal = (void *)EMPTY;
                 } else {
                     cacheVal = tzdbNames;
@@ -2272,21 +2272,21 @@ TZDBTimeZoneNames::getMetaZoneNames(const UnicodeString& mzID, UErrorCode& statu
                 // avoid duplications.
                 // TODO: Is there a more efficient way, like intern() in Java?
                 void* newKey = (void*) ZoneMeta::findMetaZoneID(mzID);
-                if (newKey != NULL) {
+                if (newKey != nullptr) {
                     uhash_put(gTZDBNamesMap, newKey, cacheVal, &status);
                     if (U_FAILURE(status)) {
-                        if (tzdbNames != NULL) {
+                        if (tzdbNames != nullptr) {
                             delete tzdbNames;
-                            tzdbNames = NULL;
+                            tzdbNames = nullptr;
                         }
                     }
                 } else {
                     // Should never happen with a valid input
-                    if (tzdbNames != NULL) {
+                    if (tzdbNames != nullptr) {
                         // It's not possible that we get a valid tzdbNames with unknown ID.
                         // But just in case..
                         delete tzdbNames;
-                        tzdbNames = NULL;
+                        tzdbNames = nullptr;
                     }
                 }
             }
index d047fa3541870ebf553b0eb27dd327541414c634..159402d71bed157cdd1c79a732e067020a2ef9a4 100644 (file)
@@ -92,18 +92,18 @@ struct CharacterNode {
     UBool    fHasValuesVector;
     UBool    fPadding;
 
-    // No value:   fValues == NULL               and  fHasValuesVector == false
+    // No value:   fValues == nullptr            and  fHasValuesVector == false
     // One value:  fValues == value              and  fHasValuesVector == false
     // >=2 values: fValues == UVector of values  and  fHasValuesVector == true
 };
 
 inline UBool CharacterNode::hasValues() const {
-    return (UBool)(fValues != NULL);
+    return (UBool)(fValues != nullptr);
 }
 
 inline int32_t CharacterNode::countValues() const {
     return
-        fValues == NULL ? 0 :
+        fValues == nullptr ? 0 :
         !fHasValuesVector ? 1 :
         ((const UVector *)fValues)->size();
 }
@@ -249,7 +249,7 @@ public:
 
     TimeZoneNames::MatchInfoCollection* find(const UnicodeString& text, int32_t start, uint32_t types, UErrorCode& status) const override;
 
-    // When TZDBNames for the metazone is not available, this method returns NULL,
+    // When TZDBNames for the metazone is not available, this method returns nullptr,
     // but does NOT set U_MISSING_RESOURCE_ERROR to status.
     static const TZDBNames* getMetaZoneNames(const UnicodeString& mzId, UErrorCode& status);
 
index a98ecc8086baa432034a104a7fa6333ea7fecf17..f4cd4de3d9bd1d437b4aebd443ecd109ac8aa986 100644 (file)
@@ -406,7 +406,7 @@ TimeArrayTimeZoneRule::TimeArrayTimeZoneRule(const UnicodeString& name,
                                              int32_t numStartTimes,
                                              DateTimeRule::TimeRuleType timeRuleType)
 : TimeZoneRule(name, rawOffset, dstSavings), fTimeRuleType(timeRuleType),
-  fStartTimes(NULL) {
+  fStartTimes(nullptr) {
     UErrorCode status = U_ZERO_ERROR;
     initStartTimes(startTimes, numStartTimes, status);
     //TODO - status?
@@ -414,7 +414,7 @@ TimeArrayTimeZoneRule::TimeArrayTimeZoneRule(const UnicodeString& name,
 
 
 TimeArrayTimeZoneRule::TimeArrayTimeZoneRule(const TimeArrayTimeZoneRule& source)
-: TimeZoneRule(source), fTimeRuleType(source.fTimeRuleType), fStartTimes(NULL) {
+: TimeZoneRule(source), fTimeRuleType(source.fTimeRuleType), fStartTimes(nullptr) {
     UErrorCode status = U_ZERO_ERROR;
     initStartTimes(source.fStartTimes, source.fNumStartTimes, status);
     //TODO - status?
@@ -422,7 +422,7 @@ TimeArrayTimeZoneRule::TimeArrayTimeZoneRule(const TimeArrayTimeZoneRule& source
 
 
 TimeArrayTimeZoneRule::~TimeArrayTimeZoneRule() {
-    if (fStartTimes != NULL && fStartTimes != fLocalStartTimes) {
+    if (fStartTimes != nullptr && fStartTimes != fLocalStartTimes) {
         uprv_free(fStartTimes);
     }
 }
@@ -521,7 +521,7 @@ UBool
 TimeArrayTimeZoneRule::getFirstStart(int32_t prevRawOffset,
                                              int32_t prevDSTSavings,
                                              UDate& result) const {
-    if (fNumStartTimes <= 0 || fStartTimes == NULL) {
+    if (fNumStartTimes <= 0 || fStartTimes == nullptr) {
         return false;
     }
     result = getUTC(fStartTimes[0], prevRawOffset, prevDSTSavings);
@@ -532,7 +532,7 @@ UBool
 TimeArrayTimeZoneRule::getFinalStart(int32_t prevRawOffset,
                                      int32_t prevDSTSavings,
                                      UDate& result) const {
-    if (fNumStartTimes <= 0 || fStartTimes == NULL) {
+    if (fNumStartTimes <= 0 || fStartTimes == nullptr) {
         return false;
     }
     result = getUTC(fStartTimes[fNumStartTimes - 1], prevRawOffset, prevDSTSavings);
@@ -582,13 +582,13 @@ TimeArrayTimeZoneRule::getPreviousStart(UDate base,
 UBool
 TimeArrayTimeZoneRule::initStartTimes(const UDate source[], int32_t size, UErrorCode& status) {
     // Free old array
-    if (fStartTimes != NULL && fStartTimes != fLocalStartTimes) {
+    if (fStartTimes != nullptr && fStartTimes != fLocalStartTimes) {
         uprv_free(fStartTimes);
     }
     // Allocate new one if needed
     if (size > TIMEARRAY_STACK_BUFFER_SIZE) {
         fStartTimes = (UDate*)uprv_malloc(sizeof(UDate)*size);
-        if (fStartTimes == NULL) {
+        if (fStartTimes == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             fNumStartTimes = 0;
             return false;
@@ -599,9 +599,9 @@ TimeArrayTimeZoneRule::initStartTimes(const UDate source[], int32_t size, UError
     uprv_memcpy(fStartTimes, source, sizeof(UDate)*size);
     fNumStartTimes = size;
     // Sort dates
-    uprv_sortArray(fStartTimes, fNumStartTimes, (int32_t)sizeof(UDate), compareDates, NULL, true, &status);
+    uprv_sortArray(fStartTimes, fNumStartTimes, (int32_t)sizeof(UDate), compareDates, nullptr, true, &status);
     if (U_FAILURE(status)) {
-        if (fStartTimes != NULL && fStartTimes != fLocalStartTimes) {
+        if (fStartTimes != nullptr && fStartTimes != fLocalStartTimes) {
             uprv_free(fStartTimes);
         }
         fNumStartTimes = 0;
index 900e4be5408e1b7cc266448c17b4a52343445f30..de6142deb6bb68c05af209f258c0fa850eed97ef 100644 (file)
@@ -25,25 +25,25 @@ TimeZoneTransition::TimeZoneTransition(UDate time, const TimeZoneRule& from, con
 }
 
 TimeZoneTransition::TimeZoneTransition()
-: UObject(), fTime(0), fFrom(NULL), fTo(NULL) {
+: UObject(), fTime(0), fFrom(nullptr), fTo(nullptr) {
 }
 
 TimeZoneTransition::TimeZoneTransition(const TimeZoneTransition& source)
-: UObject(), fTime(source.fTime), fFrom(NULL), fTo(NULL) {
-      if (source.fFrom != NULL) {
+: UObject(), fTime(source.fTime), fFrom(nullptr), fTo(nullptr) {
+      if (source.fFrom != nullptr) {
           fFrom = source.fFrom->clone();
       }
 
-      if (source.fTo != NULL) {
+      if (source.fTo != nullptr) {
           fTo = source.fTo->clone();
       }
 }
 
 TimeZoneTransition::~TimeZoneTransition() {
-    if (fFrom != NULL) {
+    if (fFrom != nullptr) {
         delete fFrom;
     }
-    if (fTo != NULL) {
+    if (fTo != nullptr) {
         delete fTo;
     }
 }
@@ -74,10 +74,10 @@ TimeZoneTransition::operator==(const TimeZoneTransition& that) const {
     if (fTime != that.fTime) {
         return false;
     }
-    if ((fFrom == NULL && that.fFrom == NULL)
-        || (fFrom != NULL && that.fFrom != NULL && *fFrom == *(that.fFrom))) {
-        if ((fTo == NULL && that.fTo == NULL)
-            || (fTo != NULL && that.fTo != NULL && *fTo == *(that.fTo))) {
+    if ((fFrom == nullptr && that.fFrom == nullptr)
+        || (fFrom != nullptr && that.fFrom != nullptr && *fFrom == *(that.fFrom))) {
+        if ((fTo == nullptr && that.fTo == nullptr)
+            || (fTo != nullptr && that.fTo != nullptr && *fTo == *(that.fTo))) {
             return true;
         }
     }
@@ -96,7 +96,7 @@ TimeZoneTransition::setTime(UDate time) {
 
 void
 TimeZoneTransition::setFrom(const TimeZoneRule& from) {
-    if (fFrom != NULL) {
+    if (fFrom != nullptr) {
         delete fFrom;
     }
     fFrom = from.clone();
@@ -104,7 +104,7 @@ TimeZoneTransition::setFrom(const TimeZoneRule& from) {
 
 void
 TimeZoneTransition::adoptFrom(TimeZoneRule* from) {
-    if (fFrom != NULL) {
+    if (fFrom != nullptr) {
         delete fFrom;
     }
     fFrom = from;
@@ -112,7 +112,7 @@ TimeZoneTransition::adoptFrom(TimeZoneRule* from) {
 
 void
 TimeZoneTransition::setTo(const TimeZoneRule& to) {
-    if (fTo != NULL) {
+    if (fTo != nullptr) {
         delete fTo;
     }
     fTo = to.clone();
@@ -120,7 +120,7 @@ TimeZoneTransition::setTo(const TimeZoneRule& to) {
 
 void
 TimeZoneTransition::adoptTo(TimeZoneRule* to) {
-    if (fTo != NULL) {
+    if (fTo != nullptr) {
         delete fTo;
     }
     fTo = to;
index cdbd16a65e50d43c16defcdf0a26186fba1c21a5..dc8db1f78b595671050a8d061064b539ba2dacd7 100644 (file)
@@ -39,7 +39,7 @@ static UBool U_CALLCONV i18n_cleanup(void)
         if (gCleanupFunctions[libType])
         {
             gCleanupFunctions[libType]();
-            gCleanupFunctions[libType] = NULL;
+            gCleanupFunctions[libType] = nullptr;
         }
     }
 #if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
index 8e1df8d5577bebb9e4881450200894ee590c29dc..7585b77bb43e2fae2ddca7e334241a53f6fecae0 100644 (file)
@@ -43,18 +43,18 @@ ucol_openBinary(const uint8_t *bin, int32_t length,
                 const UCollator *base,
                 UErrorCode *status)
 {
-    if(U_FAILURE(*status)) { return NULL; }
+    if(U_FAILURE(*status)) { return nullptr; }
     RuleBasedCollator *coll = new RuleBasedCollator(
             bin, length,
             RuleBasedCollator::rbcFromUCollator(base),
             *status);
-    if(coll == NULL) {
+    if(coll == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     if(U_FAILURE(*status)) {
         delete coll;
-        return NULL;
+        return nullptr;
     }
     return coll->toUCollator();
 }
@@ -68,7 +68,7 @@ ucol_cloneBinary(const UCollator *coll,
         return 0;
     }
     const RuleBasedCollator *rbc = RuleBasedCollator::rbcFromUCollator(coll);
-    if(rbc == NULL && coll != NULL) {
+    if(rbc == nullptr && coll != nullptr) {
         *status = U_UNSUPPORTED_ERROR;
         return 0;
     }
@@ -78,25 +78,25 @@ ucol_cloneBinary(const UCollator *coll,
 U_CAPI UCollator* U_EXPORT2
 ucol_safeClone(const UCollator *coll, void * /*stackBuffer*/, int32_t * pBufferSize, UErrorCode *status)
 {
-    if (status == NULL || U_FAILURE(*status)){
-        return NULL;
+    if (status == nullptr || U_FAILURE(*status)){
+        return nullptr;
     }
-    if (coll == NULL) {
+    if (coll == 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
         }
     }
     Collator *newColl = Collator::fromUCollator(coll)->clone();
-    if (newColl == NULL) {
+    if (newColl == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
         return nullptr;
-    } else if (pBufferSize != NULL) {
+    } else if (pBufferSize != nullptr) {
         *status = U_SAFECLONE_ALLOCATED_WARNING;
     }
     return newColl->toUCollator();
@@ -113,7 +113,7 @@ ucol_close(UCollator *coll)
 {
     UTRACE_ENTRY_OC(UTRACE_UCOL_CLOSE);
     UTRACE_DATA1(UTRACE_INFO, "coll = %p", coll);
-    if(coll != NULL) {
+    if(coll != nullptr) {
         delete Collator::fromUCollator(coll);
     }
     UTRACE_EXIT();
@@ -124,12 +124,12 @@ ucol_mergeSortkeys(const uint8_t *src1, int32_t src1Length,
                    const uint8_t *src2, int32_t src2Length,
                    uint8_t *dest, int32_t destCapacity) {
     /* check arguments */
-    if( src1==NULL || src1Length<-1 || src1Length==0 || (src1Length>0 && src1[src1Length-1]!=0) ||
-        src2==NULL || src2Length<-1 || src2Length==0 || (src2Length>0 && src2[src2Length-1]!=0) ||
-        destCapacity<0 || (destCapacity>0 && dest==NULL)
+    if( src1==nullptr || src1Length<-1 || src1Length==0 || (src1Length>0 && src1[src1Length-1]!=0) ||
+        src2==nullptr || src2Length<-1 || src2Length==0 || (src2Length>0 && src2[src2Length-1]!=0) ||
+        destCapacity<0 || (destCapacity>0 && dest==nullptr)
     ) {
         /* error, attempt to write a zero byte and return 0 */
-        if(dest!=NULL && destCapacity>0) {
+        if(dest!=nullptr && destCapacity>0) {
             *dest=0;
         }
         return 0;
@@ -204,7 +204,7 @@ ucol_getSortKey(const    UCollator    *coll,
     UTRACE_ENTRY(UTRACE_UCOL_GET_SORTKEY);
     if (UTRACE_LEVEL(UTRACE_VERBOSE)) {
         UTRACE_DATA3(UTRACE_VERBOSE, "coll=%p, source string = %vh ", coll, source,
-            ((sourceLength==-1 && source!=NULL) ? u_strlen(source) : sourceLength));
+            ((sourceLength==-1 && source!=nullptr) ? u_strlen(source) : sourceLength));
     }
 
     int32_t keySize = Collator::fromUCollator(coll)->
@@ -223,7 +223,7 @@ ucol_nextSortKeyPart(const UCollator *coll,
                      UErrorCode *status)
 {
     /* error checking */
-    if(status==NULL || U_FAILURE(*status)) {
+    if(status==nullptr || U_FAILURE(*status)) {
         return 0;
     }
     UTRACE_ENTRY(UTRACE_UCOL_NEXTSORTKEYPART);
@@ -253,10 +253,10 @@ ucol_getBound(const uint8_t       *source,
         UErrorCode          *status)
 {
     // consistency checks
-    if(status == NULL || U_FAILURE(*status)) {
+    if(status == nullptr || U_FAILURE(*status)) {
         return 0;
     }
-    if(source == NULL) {
+    if(source == nullptr) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -281,7 +281,7 @@ ucol_getBound(const uint8_t       *source,
     // enum will not changes. They are set so that the enum value
     // corresponds to the number of extra bytes each bound type
     // needs.
-    if(result != NULL && resultLength >= sourceIndex+boundType) {
+    if(result != nullptr && resultLength >= sourceIndex+boundType) {
         uprv_memcpy(result, source, sourceIndex);
         switch(boundType) {
             // Lower bound just gets terminated. No extra bytes
@@ -321,14 +321,14 @@ ucol_getMaxVariable(const UCollator *coll) {
 
 U_CAPI uint32_t  U_EXPORT2
 ucol_setVariableTop(UCollator *coll, const UChar *varTop, int32_t len, UErrorCode *status) {
-    if(U_FAILURE(*status) || coll == NULL) {
+    if(U_FAILURE(*status) || coll == nullptr) {
         return 0;
     }
     return Collator::fromUCollator(coll)->setVariableTop(varTop, len, *status);
 }
 
 U_CAPI uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode *status) {
-    if(U_FAILURE(*status) || coll == NULL) {
+    if(U_FAILURE(*status) || coll == nullptr) {
         return 0;
     }
     return Collator::fromUCollator(coll)->getVariableTop(*status);
@@ -336,7 +336,7 @@ U_CAPI uint32_t U_EXPORT2 ucol_getVariableTop(const UCollator *coll, UErrorCode
 
 U_CAPI void  U_EXPORT2
 ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *status) {
-    if(U_FAILURE(*status) || coll == NULL) {
+    if(U_FAILURE(*status) || coll == nullptr) {
         return;
     }
     Collator::fromUCollator(coll)->setVariableTop(varTop, *status);
@@ -344,7 +344,7 @@ ucol_restoreVariableTop(UCollator *coll, const uint32_t varTop, UErrorCode *stat
 
 U_CAPI void  U_EXPORT2
 ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status) {
-    if(U_FAILURE(*status) || coll == NULL) {
+    if(U_FAILURE(*status) || coll == nullptr) {
       return;
     }
 
@@ -353,7 +353,7 @@ ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value,
 
 U_CAPI UColAttributeValue  U_EXPORT2
 ucol_getAttribute(const UCollator *coll, UColAttribute attr, UErrorCode *status) {
-    if(U_FAILURE(*status) || coll == NULL) {
+    if(U_FAILURE(*status) || coll == nullptr) {
       return UCOL_DEFAULT;
     }
 
@@ -427,7 +427,7 @@ ucol_strcollIter( const UCollator    *coll,
     UTRACE_ENTRY(UTRACE_UCOL_STRCOLLITER);
     UTRACE_DATA3(UTRACE_VERBOSE, "coll=%p, sIter=%p, tIter=%p", coll, sIter, tIter);
 
-    if(sIter == NULL || tIter == NULL || coll == NULL) {
+    if(sIter == nullptr || tIter == nullptr || coll == nullptr) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         UTRACE_EXIT_VALUE_STATUS(UCOL_EQUAL, *status);
         return UCOL_EQUAL;
@@ -532,7 +532,7 @@ ucol_equal(        const    UCollator        *coll,
 U_CAPI void U_EXPORT2
 ucol_getUCAVersion(const UCollator* coll, UVersionInfo info) {
     const Collator *c = Collator::fromUCollator(coll);
-    if(c != NULL) {
+    if(c != nullptr) {
         UVersionInfo v;
         c->getVersion(v);
         // Note: This is tied to how the current implementation encodes the UCA version
@@ -551,8 +551,8 @@ ucol_getUCAVersion(const UCollator* coll, UVersionInfo info) {
 U_CAPI const UChar * U_EXPORT2
 ucol_getRules(const UCollator *coll, int32_t *length) {
     const RuleBasedCollator *rbc = RuleBasedCollator::rbcFromUCollator(coll);
-    // OK to crash if coll==NULL: We do not want to check "this" pointers.
-    if(rbc != NULL || coll == NULL) {
+    // OK to crash if coll==nullptr: We do not want to check "this" pointers.
+    if(rbc != nullptr || coll == nullptr) {
         const UnicodeString &rules = rbc->getRules();
         U_ASSERT(rules.getBuffer()[rules.length()] == 0);
         *length = rules.length();
@@ -567,10 +567,10 @@ U_CAPI int32_t U_EXPORT2
 ucol_getRulesEx(const UCollator *coll, UColRuleOption delta, UChar *buffer, int32_t bufferLen) {
     UnicodeString rules;
     const RuleBasedCollator *rbc = RuleBasedCollator::rbcFromUCollator(coll);
-    if(rbc != NULL || coll == NULL) {
+    if(rbc != nullptr || coll == nullptr) {
         rbc->getRules(delta, rules);
     }
-    if(buffer != NULL && bufferLen > 0) {
+    if(buffer != nullptr && bufferLen > 0) {
         UErrorCode errorCode = U_ZERO_ERROR;
         return rules.extract(buffer, bufferLen, errorCode);
     } else {
@@ -586,16 +586,16 @@ ucol_getLocale(const UCollator *coll, ULocDataLocaleType type, UErrorCode *statu
 U_CAPI const char * U_EXPORT2
 ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode *status) {
     if(U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
     UTRACE_ENTRY(UTRACE_UCOL_GETLOCALE);
     UTRACE_DATA1(UTRACE_INFO, "coll=%p", coll);
 
     const char *result;
     const RuleBasedCollator *rbc = RuleBasedCollator::rbcFromUCollator(coll);
-    if(rbc == NULL && coll != NULL) {
+    if(rbc == nullptr && coll != nullptr) {
         *status = U_UNSUPPORTED_ERROR;
-        result = NULL;
+        result = nullptr;
     } else {
         result = rbc->internalGetLocaleID(type, *status);
     }
@@ -608,12 +608,12 @@ ucol_getLocaleByType(const UCollator *coll, ULocDataLocaleType type, UErrorCode
 U_CAPI USet * U_EXPORT2
 ucol_getTailoredSet(const UCollator *coll, UErrorCode *status) {
     if(U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
     UnicodeSet *set = Collator::fromUCollator(coll)->getTailoredSet(*status);
     if(U_FAILURE(*status)) {
         delete set;
-        return NULL;
+        return nullptr;
     }
     return set->toUSet();
 }
index 8308d99c2907c71c2272913ee27bc42561c52d12..4356849370f6bf4953a2d0433aab1ff28ffef92f 100644 (file)
@@ -59,9 +59,9 @@ U_NAMESPACE_BEGIN
 
 namespace {
 
-static const UChar *rootRules = NULL;
+static const UChar *rootRules = nullptr;
 static int32_t rootRulesLength = 0;
-static UResourceBundle *rootBundle = NULL;
+static UResourceBundle *rootBundle = nullptr;
 static UInitOnce gInitOnceUcolRes {};
 
 }  // namespace
@@ -70,10 +70,10 @@ U_CDECL_BEGIN
 
 static UBool U_CALLCONV
 ucol_res_cleanup() {
-    rootRules = NULL;
+    rootRules = nullptr;
     rootRulesLength = 0;
     ures_close(rootBundle);
-    rootBundle = NULL;
+    rootBundle = nullptr;
     gInitOnceUcolRes.reset();
     return true;
 }
@@ -86,7 +86,7 @@ CollationLoader::loadRootRules(UErrorCode &errorCode) {
     rootRules = ures_getStringByKey(rootBundle, "UCARules", &rootRulesLength, &errorCode);
     if(U_FAILURE(errorCode)) {
         ures_close(rootBundle);
-        rootBundle = NULL;
+        rootBundle = nullptr;
         return;
     }
     ucln_i18n_registerCleanup(UCLN_I18N_UCOL_RES, ucol_res_cleanup);
@@ -107,7 +107,7 @@ void
 CollationLoader::loadRules(const char *localeID, const char *collationType,
                            UnicodeString &rules, UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return; }
-    U_ASSERT(collationType != NULL && *collationType != 0);
+    U_ASSERT(collationType != nullptr && *collationType != 0);
     // Copy the type for lowercasing.
     char type[16];
     int32_t typeLength = static_cast<int32_t>(uprv_strlen(collationType));
@@ -120,9 +120,9 @@ CollationLoader::loadRules(const char *localeID, const char *collationType,
 
     LocalUResourceBundlePointer bundle(ures_open(U_ICUDATA_COLL, localeID, &errorCode));
     LocalUResourceBundlePointer collations(
-            ures_getByKey(bundle.getAlias(), "collations", NULL, &errorCode));
+            ures_getByKey(bundle.getAlias(), "collations", nullptr, &errorCode));
     LocalUResourceBundlePointer data(
-            ures_getByKeyWithFallback(collations.getAlias(), type, NULL, &errorCode));
+            ures_getByKeyWithFallback(collations.getAlias(), type, nullptr, &errorCode));
     int32_t length;
     const UChar *s =  ures_getStringByKey(data.getAlias(), "Sequence", &length, &errorCode);
     if(U_FAILURE(errorCode)) { return; }
@@ -147,7 +147,7 @@ LocaleCacheKey<CollationCacheEntry>::createObject(const void *creationContext,
 const CollationCacheEntry *
 CollationLoader::loadTailoring(const Locale &locale, UErrorCode &errorCode) {
     const CollationCacheEntry *rootEntry = CollationRoot::getRootCacheEntry(errorCode);
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     const char *name = locale.getName();
     if(*name == 0 || uprv_strcmp(name, "root") == 0) {
 
@@ -169,7 +169,7 @@ CollationLoader::CollationLoader(const CollationCacheEntry *re, const Locale &re
         : cache(UnifiedCache::getInstance(errorCode)), rootEntry(re),
           validLocale(re->validLocale), locale(requested),
           typesTried(0), typeFallback(false),
-          bundle(NULL), collations(NULL), data(NULL) {
+          bundle(nullptr), collations(nullptr), data(nullptr) {
     type[0] = 0;
     defaultType[0] = 0;
     if(U_FAILURE(errorCode)) { return; }
@@ -213,11 +213,11 @@ CollationLoader::createCacheEntry(UErrorCode &errorCode) {
     // In a cache miss, cache.get() calls CacheKey::createObject(),
     // which means that we progress via recursion.
     // loadFromCollations() will recurse to itself as well for collation type fallback.
-    if(bundle == NULL) {
+    if(bundle == nullptr) {
         return loadFromLocale(errorCode);
-    } else if(collations == NULL) {
+    } else if(collations == nullptr) {
         return loadFromBundle(errorCode);
-    } else if(data == NULL) {
+    } else if(data == nullptr) {
         return loadFromCollations(errorCode);
     } else {
         return loadFromData(errorCode);
@@ -226,8 +226,8 @@ CollationLoader::createCacheEntry(UErrorCode &errorCode) {
 
 const CollationCacheEntry *
 CollationLoader::loadFromLocale(UErrorCode &errorCode) {
-    if(U_FAILURE(errorCode)) { return NULL; }
-    U_ASSERT(bundle == NULL);
+    if(U_FAILURE(errorCode)) { return nullptr; }
+    U_ASSERT(bundle == nullptr);
     bundle = ures_openNoDefault(U_ICUDATA_COLL, locale.getBaseName(), &errorCode);
     if(errorCode == U_MISSING_RESOURCE_ERROR) {
         errorCode = U_USING_DEFAULT_WARNING;
@@ -238,7 +238,7 @@ CollationLoader::loadFromLocale(UErrorCode &errorCode) {
     }
     Locale requestedLocale(locale);
     const char *vLocale = ures_getLocaleByType(bundle, ULOC_ACTUAL_LOCALE, &errorCode);
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     locale = validLocale = Locale(vLocale);  // no type until loadFromCollations()
     if(type[0] != 0) {
         locale.setKeywordValue("collation", type, errorCode);
@@ -252,22 +252,22 @@ CollationLoader::loadFromLocale(UErrorCode &errorCode) {
 
 const CollationCacheEntry *
 CollationLoader::loadFromBundle(UErrorCode &errorCode) {
-    if(U_FAILURE(errorCode)) { return NULL; }
-    U_ASSERT(collations == NULL);
+    if(U_FAILURE(errorCode)) { return nullptr; }
+    U_ASSERT(collations == nullptr);
     // There are zero or more tailorings in the collations table.
-    collations = ures_getByKey(bundle, "collations", NULL, &errorCode);
+    collations = ures_getByKey(bundle, "collations", nullptr, &errorCode);
     if(errorCode == U_MISSING_RESOURCE_ERROR) {
         errorCode = U_USING_DEFAULT_WARNING;
         // Return the root tailoring with the validLocale, without collation type.
         return makeCacheEntryFromRoot(validLocale, errorCode);
     }
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
 
     // Fetch the default type from the data.
     {
         UErrorCode internalErrorCode = U_ZERO_ERROR;
         LocalUResourceBundlePointer def(
-                ures_getByKeyWithFallback(collations, "default", NULL, &internalErrorCode));
+                ures_getByKeyWithFallback(collations, "default", nullptr, &internalErrorCode));
         int32_t length;
         const UChar *s = ures_getString(def.getAlias(), &length, &internalErrorCode);
         if(U_SUCCESS(internalErrorCode) && 0 < length && length < UPRV_LENGTHOF(defaultType)) {
@@ -313,11 +313,11 @@ CollationLoader::loadFromBundle(UErrorCode &errorCode) {
 
 const CollationCacheEntry *
 CollationLoader::loadFromCollations(UErrorCode &errorCode) {
-    if(U_FAILURE(errorCode)) { return NULL; }
-    U_ASSERT(data == NULL);
+    if(U_FAILURE(errorCode)) { return nullptr; }
+    U_ASSERT(data == nullptr);
     // Load the collations/type tailoring, with type fallback.
     LocalUResourceBundlePointer localData(
-            ures_getByKeyWithFallback(collations, type, NULL, &errorCode));
+            ures_getByKeyWithFallback(collations, type, nullptr, &errorCode));
     int32_t typeLength = static_cast<int32_t>(uprv_strlen(type));
     if(errorCode == U_MISSING_RESOURCE_ERROR) {
         errorCode = U_USING_DEFAULT_WARNING;
@@ -342,11 +342,11 @@ CollationLoader::loadFromCollations(UErrorCode &errorCode) {
         locale.setKeywordValue("collation", type, errorCode);
         return getCacheEntry(errorCode);
     }
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
 
     data = localData.orphan();
     const char *actualLocale = ures_getLocaleByType(data, ULOC_ACTUAL_LOCALE, &errorCode);
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     const char *vLocale = validLocale.getBaseName();
     UBool actualAndValidLocalesAreDifferent = Locale(actualLocale) != Locale(vLocale);
 
@@ -355,7 +355,7 @@ CollationLoader::loadFromCollations(UErrorCode &errorCode) {
     // For the valid locale, suppress the default type.
     if(uprv_strcmp(type, defaultType) != 0) {
         validLocale.setKeywordValue("collation", type, errorCode);
-        if(U_FAILURE(errorCode)) { return NULL; }
+        if(U_FAILURE(errorCode)) { return nullptr; }
     }
 
     // Is this the same as the root collator? If so, then use that instead.
@@ -379,15 +379,15 @@ CollationLoader::loadFromCollations(UErrorCode &errorCode) {
 
 const CollationCacheEntry *
 CollationLoader::loadFromData(UErrorCode &errorCode) {
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     LocalPointer<CollationTailoring> t(new CollationTailoring(rootEntry->tailoring->settings));
     if(t.isNull() || t->isBogus()) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     // deserialize
-    LocalUResourceBundlePointer binary(ures_getByKey(data, "%%CollationBin", NULL, &errorCode));
+    LocalUResourceBundlePointer binary(ures_getByKey(data, "%%CollationBin", nullptr, &errorCode));
     // Note: U_MISSING_RESOURCE_ERROR --> The old code built from rules if available
     // but that created undesirable dependencies.
     int32_t length;
@@ -395,7 +395,7 @@ CollationLoader::loadFromData(UErrorCode &errorCode) {
     CollationDataReader::read(rootEntry->tailoring, inBytes, length, *t, errorCode);
     // Note: U_COLLATOR_VERSION_MISMATCH --> The old code built from rules if available
     // but that created undesirable dependencies.
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
 
     // Try to fetch the optional rules string.
     {
@@ -421,10 +421,10 @@ CollationLoader::loadFromData(UErrorCode &errorCode) {
         // Opening a bundle for the actual locale should always succeed.
         LocalUResourceBundlePointer actualBundle(
                 ures_open(U_ICUDATA_COLL, actualLocale, &errorCode));
-        if(U_FAILURE(errorCode)) { return NULL; }
+        if(U_FAILURE(errorCode)) { return nullptr; }
         UErrorCode internalErrorCode = U_ZERO_ERROR;
         LocalUResourceBundlePointer def(
-                ures_getByKeyWithFallback(actualBundle.getAlias(), "collations/default", NULL,
+                ures_getByKeyWithFallback(actualBundle.getAlias(), "collations/default", nullptr,
                                           &internalErrorCode));
         int32_t len;
         const UChar *s = ures_getString(def.getAlias(), &len, &internalErrorCode);
@@ -439,17 +439,17 @@ CollationLoader::loadFromData(UErrorCode &errorCode) {
         t->actualLocale.setKeywordValue("collation", type, errorCode);
     } else if(uprv_strcmp(locale.getName(), locale.getBaseName()) != 0) {
         // Remove the collation keyword if it was set.
-        t->actualLocale.setKeywordValue("collation", NULL, errorCode);
+        t->actualLocale.setKeywordValue("collation", nullptr, errorCode);
     }
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
 
     if(typeFallback) {
         errorCode = U_USING_DEFAULT_WARNING;
     }
     t->bundle = bundle;
-    bundle = NULL;
+    bundle = nullptr;
     const CollationCacheEntry *entry = new CollationCacheEntry(validLocale, t.getAlias());
-    if(entry == NULL) {
+    if(entry == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         return nullptr;
     } else {
@@ -463,7 +463,7 @@ CollationLoader::loadFromData(UErrorCode &errorCode) {
 const CollationCacheEntry *
 CollationLoader::getCacheEntry(UErrorCode &errorCode) {
     LocaleCacheKey<CollationCacheEntry> key(locale);
-    const CollationCacheEntry *entry = NULL;
+    const CollationCacheEntry *entry = nullptr;
     cache->get(key, this, entry, errorCode);
     return entry;
 }
@@ -473,7 +473,7 @@ CollationLoader::makeCacheEntryFromRoot(
         const Locale &/*loc*/,
         UErrorCode &errorCode) const {
     if (U_FAILURE(errorCode)) {
-        return NULL;
+        return nullptr;
     }
     rootEntry->addRef();
     return makeCacheEntry(validLocale, rootEntry, errorCode);
@@ -488,10 +488,10 @@ CollationLoader::makeCacheEntry(
         return entryFromCache;
     }
     CollationCacheEntry *entry = new CollationCacheEntry(loc, entryFromCache->tailoring);
-    if(entry == NULL) {
+    if(entry == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         entryFromCache->removeRef();
-        return NULL;
+        return nullptr;
     }
     entry->addRef();
     entryFromCache->removeRef();
@@ -508,7 +508,7 @@ ucol_open(const char *loc,
 {
     UTRACE_ENTRY_OC(UTRACE_UCOL_OPEN);
     UTRACE_DATA1(UTRACE_INFO, "locale = \"%s\"", loc);
-    UCollator *result = NULL;
+    UCollator *result = nullptr;
 
     Collator *coll = Collator::createInstance(loc, *status);
     if(U_SUCCESS(*status)) {
@@ -528,8 +528,8 @@ ucol_getDisplayName(    const    char        *objLoc,
 {
     if(U_FAILURE(*status)) return -1;
     UnicodeString dst;
-    if(!(result==NULL && resultLength==0)) {
-        // NULL destination for pure preflighting: empty dummy string
+    if(!(result==nullptr && resultLength==0)) {
+        // nullptr destination for pure preflighting: empty dummy string
         // otherwise, alias the destination buffer
         dst.setTo(result, 0, resultLength);
     }
@@ -542,10 +542,10 @@ ucol_getAvailable(int32_t index)
 {
     int32_t count = 0;
     const Locale *loc = Collator::getAvailableLocales(count);
-    if (loc != NULL && index < count) {
+    if (loc != nullptr && index < count) {
         return loc[index].getName();
     }
-    return NULL;
+    return nullptr;
 }
 
 U_CAPI int32_t U_EXPORT2
@@ -561,12 +561,12 @@ U_CAPI UEnumeration* U_EXPORT2
 ucol_openAvailableLocales(UErrorCode *status) {
     // This is a wrapper over Collator::getAvailableLocales()
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
     StringEnumeration *s = icu::Collator::getAvailableLocales();
-    if (s == NULL) {
+    if (s == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     return uenum_openFromStringEnumeration(s, status);
 }
@@ -582,7 +582,7 @@ static const char* const KEYWORDS[] = { "collation" };
 
 U_CAPI UEnumeration* U_EXPORT2
 ucol_getKeywords(UErrorCode *status) {
-    UEnumeration *result = NULL;
+    UEnumeration *result = nullptr;
     if (U_SUCCESS(*status)) {
         return uenum_openCharStringsEnumeration(KEYWORDS, KEYWORD_COUNT, status);
     }
@@ -592,21 +592,21 @@ ucol_getKeywords(UErrorCode *status) {
 U_CAPI UEnumeration* U_EXPORT2
 ucol_getKeywordValues(const char *keyword, UErrorCode *status) {
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
     // hard-coded to accept exactly one collation keyword
     // modify if additional collation keyword is added later
-    if (keyword==NULL || uprv_strcmp(keyword, KEYWORDS[0])!=0)
+    if (keyword==nullptr || uprv_strcmp(keyword, KEYWORDS[0])!=0)
     {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     return ures_getKeywordValues(U_ICUDATA_COLL, RESOURCE_NAME, status);
 }
 
 static const UEnumeration defaultKeywordValues = {
-    NULL,
-    NULL,
+    nullptr,
+    nullptr,
     ulist_close_keyword_values_iterator,
     ulist_count_keyword_values,
     uenum_unextDefault,
@@ -634,7 +634,7 @@ public:
                     defcoll.appendInvariantChars(value.getUnicodeString(errorCode), errorCode);
                     if (U_SUCCESS(errorCode) && !defcoll.isEmpty()) {
                         char *ownedDefault = uprv_strdup(defcoll.data());
-                        if (ownedDefault == NULL) {
+                        if (ownedDefault == nullptr) {
                             errorCode = U_MEMORY_ALLOCATION_ERROR;
                             return;
                         }
@@ -673,17 +673,17 @@ ucol_getKeywordValuesForLocale(const char* /*key*/, const char* locale,
     LocalUResourceBundlePointer bundle(ures_open(U_ICUDATA_COLL, locale, status));
     KeywordsSink sink(*status);
     ures_getAllItemsWithFallback(bundle.getAlias(), RESOURCE_NAME, sink, *status);
-    if (U_FAILURE(*status)) { return NULL; }
+    if (U_FAILURE(*status)) { return nullptr; }
 
     UEnumeration *en = (UEnumeration *)uprv_malloc(sizeof(UEnumeration));
-    if (en == NULL) {
+    if (en == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     memcpy(en, &defaultKeywordValues, sizeof(UEnumeration));
     ulist_resetList(sink.values);  // Initialize the iterator.
     en->context = sink.values;
-    sink.values = NULL;  // Avoid deletion in the sink destructor.
+    sink.values = nullptr;  // Avoid deletion in the sink destructor.
     return en;
 }
 
index 19281e43522d7703d781a2eac2e2d4e7ba5cdee2..30a183d91106d958bc1e9583315b4bbc12daf923 100644 (file)
@@ -189,7 +189,7 @@ _processRFC3066Locale(CollatorSpec *spec, uint32_t, const char* string,
     char terminator = *string;
     string++;
     const char *end = uprv_strchr(string+1, terminator);
-    if(end == NULL || end - string >= loc3066Capacity) {
+    if(end == nullptr || end - string >= loc3066Capacity) {
         *status = U_BUFFER_OVERFLOW_ERROR;
         return string;
     } else {
@@ -456,8 +456,8 @@ ucol_prepareShortStringOpen( const char *definition,
 
     UResourceBundle *b = ures_open(U_ICUDATA_COLL, buffer, status);
     /* we try to find stuff from keyword */
-    UResourceBundle *collations = ures_getByKey(b, "collations", NULL, status);
-    UResourceBundle *collElem = NULL;
+    UResourceBundle *collations = ures_getByKey(b, "collations", nullptr, status);
+    UResourceBundle *collElem = nullptr;
     char keyBuffer[256];
     // if there is a keyword, we pick it up and try to get elements
     int32_t keyLen = uloc_getKeywordValue(buffer, "collation", keyBuffer, sizeof(keyBuffer), status);
@@ -469,7 +469,7 @@ ucol_prepareShortStringOpen( const char *definition,
     if(keyLen == 0) {
       // no keyword
       // we try to find the default setting, which will give us the keyword value
-      UResourceBundle *defaultColl = ures_getByKeyWithFallback(collations, "default", NULL, status);
+      UResourceBundle *defaultColl = ures_getByKeyWithFallback(collations, "default", nullptr, status);
       if(U_SUCCESS(*status)) {
         int32_t defaultKeyLen = 0;
         const UChar *defaultKey = ures_getString(defaultColl, &defaultKeyLen, status);
@@ -539,7 +539,7 @@ ucol_openFromShortString( const char *definition,
             if(U_FAILURE(*status)) {
                 parseError->offset = (int32_t)(string - definition);
                 ucol_close(result);
-                return NULL;
+                return nullptr;
             }
 
         }
@@ -555,7 +555,7 @@ ucol_openFromShortString( const char *definition,
 
     if(U_FAILURE(*status)) { // here it can only be a bogus value
         ucol_close(result);
-        result = NULL;
+        result = nullptr;
     }
 
     UTRACE_EXIT_PTR_STATUS(result, *status);
@@ -571,7 +571,7 @@ ucol_getShortDefinitionString(const UCollator *coll,
                               UErrorCode *status)
 {
     if(U_FAILURE(*status)) return 0;
-    if(coll == NULL) {
+    if(coll == nullptr) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -618,7 +618,7 @@ ucol_getContractions( const UCollator *coll,
                   USet *contractions,
                   UErrorCode *status)
 {
-  ucol_getContractionsAndExpansions(coll, contractions, NULL, false, status);
+  ucol_getContractionsAndExpansions(coll, contractions, nullptr, false, status);
   return uset_getItemCount(contractions);
 }
 
@@ -642,12 +642,12 @@ ucol_getContractionsAndExpansions( const UCollator *coll,
     if(U_FAILURE(*status)) {
         return;
     }
-    if(coll == NULL) {
+    if(coll == nullptr) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
     const icu::RuleBasedCollator *rbc = icu::RuleBasedCollator::rbcFromUCollator(coll);
-    if(rbc == NULL) {
+    if(rbc == nullptr) {
         *status = U_UNSUPPORTED_ERROR;
         return;
     }
index 53649c01bc1fb33128d1bd5fb4589f76e9d7fce8..e9ad2efdfe68fcd449bbcee26262e997c48977f6 100644 (file)
@@ -92,7 +92,7 @@ void RCEBuffer::put(uint32_t ce, int32_t ixLow, int32_t ixHigh, UErrorCode &erro
     }
     if (bufferIndex >= bufferSize) {
         RCEI *newBuffer = NEW_ARRAY(RCEI, bufferSize + BUFFER_GROW);
-        if (newBuffer == NULL) {
+        if (newBuffer == nullptr) {
             errorCode = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
@@ -120,7 +120,7 @@ const RCEI *RCEBuffer::get()
      return &buffer[--bufferIndex];
     }
 
-    return NULL;
+    return nullptr;
 }
 
 PCEBuffer::PCEBuffer()
@@ -154,7 +154,7 @@ void PCEBuffer::put(uint64_t ce, int32_t ixLow, int32_t ixHigh, UErrorCode &erro
     }
     if (bufferIndex >= bufferSize) {
         PCEI *newBuffer = NEW_ARRAY(PCEI, bufferSize + BUFFER_GROW);
-        if (newBuffer == NULL) {
+        if (newBuffer == nullptr) {
             errorCode = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
@@ -182,7 +182,7 @@ const PCEI *PCEBuffer::get()
      return &buffer[--bufferIndex];
     }
 
-    return NULL;
+    return nullptr;
 }
 
 UCollationPCE::UCollationPCE(UCollationElements *elems) { init(elems); }
@@ -277,23 +277,23 @@ ucol_openElements(const UCollator  *coll,
                         UErrorCode *status)
 {
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
-    if (coll == NULL || (text == NULL && textLength != 0)) {
+    if (coll == nullptr || (text == nullptr && textLength != 0)) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     const RuleBasedCollator *rbc = RuleBasedCollator::rbcFromUCollator(coll);
-    if (rbc == NULL) {
+    if (rbc == nullptr) {
         *status = U_UNSUPPORTED_ERROR;  // coll is a Collator but not a RuleBasedCollator
-        return NULL;
+        return nullptr;
     }
 
     UnicodeString s((UBool)(textLength < 0), text, textLength);
     CollationElementIterator *cei = rbc->createCollationElementIterator(s);
-    if (cei == NULL) {
+    if (cei == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     return cei->toUCollationElements();
@@ -353,11 +353,11 @@ UCollationPCE::nextProcessed(
         result = processCE((uint32_t)ce);
     } while (result == UCOL_IGNORABLE);
 
-    if (ixLow != NULL) {
+    if (ixLow != nullptr) {
         *ixLow = low;
     }
 
-    if (ixHigh != NULL) {
+    if (ixHigh != nullptr) {
         *ixHigh = high;
     }
 
@@ -433,11 +433,11 @@ UCollationPCE::previousProcessed(
 finish:
     if (pceBuffer.isEmpty()) {
         // **** Is -1 the right value for ixLow, ixHigh? ****
-       if (ixLow != NULL) {
+       if (ixLow != nullptr) {
                *ixLow = -1;
        }
        
-       if (ixHigh != NULL) {
+       if (ixHigh != nullptr) {
                *ixHigh = -1
                ;
        }
@@ -446,11 +446,11 @@ finish:
 
     const PCEI *pcei = pceBuffer.get();
 
-    if (ixLow != NULL) {
+    if (ixLow != nullptr) {
         *ixLow = pcei->low;
     }
 
-    if (ixHigh != NULL) {
+    if (ixHigh != nullptr) {
         *ixHigh = pcei->high;
     }
 
@@ -484,7 +484,7 @@ ucol_setText(      UCollationElements *elems,
         return;
     }
 
-    if ((text == NULL && textLength != 0)) {
+    if ((text == nullptr && textLength != 0)) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
index 8de10d101f3b669ce9da69f76e406d097d16504e..ca224dbe059cd3d2ad81cef256cf2f483b0ccf7e 100644 (file)
@@ -39,7 +39,7 @@ ucsdet_open(UErrorCode   *status)
 
     if (U_FAILURE(*status)) {
         delete csd;
-        csd = NULL;
+        csd = nullptr;
     }
 
     return (UCharsetDetector *) csd;
@@ -66,7 +66,7 @@ U_CAPI const char * U_EXPORT2
 ucsdet_getName(const UCharsetMatch *ucsm, UErrorCode *status)
 {
     if(U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
 
     return ((CharsetMatch *) ucsm)->getName();
@@ -86,7 +86,7 @@ U_CAPI const char * U_EXPORT2
 ucsdet_getLanguage(const UCharsetMatch *ucsm, UErrorCode *status)
 {
     if(U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
 
     return ((CharsetMatch *) ucsm)->getLanguage();
@@ -96,7 +96,7 @@ U_CAPI const UCharsetMatch * U_EXPORT2
 ucsdet_detect(UCharsetDetector *ucsd, UErrorCode *status)
 {
     if(U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
 
     return (const UCharsetMatch *) ((CharsetDetector *) ucsd)->detect(*status);
@@ -117,7 +117,7 @@ ucsdet_detectAll(UCharsetDetector *ucsd,
                  int32_t *maxMatchesFound, UErrorCode *status)
 {
     if(U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
 
     CharsetDetector *csd = (CharsetDetector *) ucsd;
@@ -147,7 +147,7 @@ U_CAPI  UBool U_EXPORT2
 ucsdet_isInputFilterEnabled(const UCharsetDetector *ucsd)
 {
     // todo: could use an error return...
-    if (ucsd == NULL) {
+    if (ucsd == nullptr) {
         return false;
     }
 
@@ -158,7 +158,7 @@ U_CAPI  UBool U_EXPORT2
 ucsdet_enableInputFilter(UCharsetDetector *ucsd, UBool filter)
 {
     // todo: could use an error return...
-    if (ucsd == NULL) {
+    if (ucsd == nullptr) {
         return false;
     }
 
index 426eb7ebf2a06415e67eddef9c941c8d449d7e20..4e08bd466478b66b97b08d2c56abef4f8aacf428 100644 (file)
@@ -34,11 +34,11 @@ U_NAMESPACE_USE
 /**
  * Verify that fmt is a SimpleDateFormat. Invalid error if not.
  * @param fmt the UDateFormat, definitely a DateFormat, maybe something else
- * @param status error code, will be set to failure if there is a failure or the fmt is NULL.
+ * @param status error code, will be set to failure if there is a failure or the fmt is nullptr.
  */
 static void verifyIsSimpleDateFormat(const UDateFormat* fmt, UErrorCode *status) {
    if(U_SUCCESS(*status) &&
-       dynamic_cast<const SimpleDateFormat*>(reinterpret_cast<const DateFormat*>(fmt))==NULL) {
+       dynamic_cast<const SimpleDateFormat*>(reinterpret_cast<const DateFormat*>(fmt))==nullptr) {
        *status = U_ILLEGAL_ARGUMENT_ERROR;
    }
 }
@@ -97,34 +97,34 @@ udat_toCalendarDateField(UDateFormatField field) {
 }
 
 /* For now- one opener. */
-static UDateFormatOpener gOpener = NULL;
+static UDateFormatOpener gOpener = nullptr;
 
 U_CAPI void U_EXPORT2
 udat_registerOpener(UDateFormatOpener opener, UErrorCode *status)
 {
   if(U_FAILURE(*status)) return;
-  umtx_lock(NULL);
-  if(gOpener==NULL) {
+  umtx_lock(nullptr);
+  if(gOpener==nullptr) {
     gOpener = opener;
   } else {
     *status = U_ILLEGAL_ARGUMENT_ERROR;
   }
-  umtx_unlock(NULL);
+  umtx_unlock(nullptr);
 }
 
 U_CAPI UDateFormatOpener U_EXPORT2
 udat_unregisterOpener(UDateFormatOpener opener, UErrorCode *status)
 {
-  if(U_FAILURE(*status)) return NULL;
-  UDateFormatOpener oldOpener = NULL;
-  umtx_lock(NULL);
-  if(gOpener==NULL || gOpener!=opener) {
+  if(U_FAILURE(*status)) return nullptr;
+  UDateFormatOpener oldOpener = nullptr;
+  umtx_lock(nullptr);
+  if(gOpener==nullptr || gOpener!=opener) {
     *status = U_ILLEGAL_ARGUMENT_ERROR;
   } else {
     oldOpener=gOpener;
-    gOpener=NULL;
+    gOpener=nullptr;
   }
-  umtx_unlock(NULL);
+  umtx_unlock(nullptr);
   return oldOpener;
 }
 
@@ -144,9 +144,9 @@ udat_open(UDateFormatStyle  timeStyle,
     if(U_FAILURE(*status)) {
         return 0;
     }
-    if(gOpener!=NULL) { // if it's registered
+    if(gOpener!=nullptr) { // if it's registered
       fmt = (DateFormat*) (*gOpener)(timeStyle,dateStyle,locale,tzID,tzIDLength,pattern,patternLength,status);
-      if(fmt!=NULL) {
+      if(fmt!=nullptr) {
         return (UDateFormat*)fmt;
       } // else fall through.
     }
@@ -228,14 +228,14 @@ udat_format(    const    UDateFormat*    format,
     if(U_FAILURE(*status)) {
         return -1;
     }
-    if (result == NULL ? resultLength != 0 : resultLength < 0) {
+    if (result == nullptr ? resultLength != 0 : resultLength < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return -1;
     }
 
     UnicodeString res;
-    if (result != NULL) {
-        // NULL destination for pure preflighting: empty dummy string
+    if (result != nullptr) {
+        // nullptr destination for pure preflighting: empty dummy string
         // otherwise, alias the destination buffer
         res.setTo(result, 0, resultLength);
     }
@@ -266,14 +266,14 @@ udat_formatCalendar(const UDateFormat*  format,
     if(U_FAILURE(*status)) {
         return -1;
     }
-    if (result == NULL ? resultLength != 0 : resultLength < 0) {
+    if (result == nullptr ? resultLength != 0 : resultLength < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return -1;
     }
 
     UnicodeString res;
-    if (result != NULL) {
-        // NULL destination for pure preflighting: empty dummy string
+    if (result != nullptr) {
+        // nullptr destination for pure preflighting: empty dummy string
         // otherwise, alias the destination buffer
         res.setTo(result, 0, resultLength);
     }
@@ -304,14 +304,14 @@ udat_formatForFields(    const    UDateFormat*    format,
     if(U_FAILURE(*status)) {
         return -1;
     }
-    if (result == NULL ? resultLength != 0 : resultLength < 0) {
+    if (result == nullptr ? resultLength != 0 : resultLength < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return -1;
     }
 
     UnicodeString res;
-    if (result != NULL) {
-        // NULL destination for pure preflighting: empty dummy string
+    if (result != nullptr) {
+        // nullptr destination for pure preflighting: empty dummy string
         // otherwise, alias the destination buffer
         res.setTo(result, 0, resultLength);
     }
@@ -332,14 +332,14 @@ udat_formatCalendarForFields(const UDateFormat*  format,
     if(U_FAILURE(*status)) {
         return -1;
     }
-    if (result == NULL ? resultLength != 0 : resultLength < 0) {
+    if (result == nullptr ? resultLength != 0 : resultLength < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return -1;
     }
 
     UnicodeString res;
-    if (result != NULL) {
-        // NULL destination for pure preflighting: empty dummy string
+    if (result != nullptr) {
+        // nullptr destination for pure preflighting: empty dummy string
         // otherwise, alias the destination buffer
         res.setTo(result, 0, resultLength);
     }
@@ -363,7 +363,7 @@ udat_parse(    const    UDateFormat*        format,
     int32_t stackParsePos = 0;
     UDate res;
 
-    if(parsePos == NULL) {
+    if(parsePos == nullptr) {
         parsePos = &stackParsePos;
     }
 
@@ -395,7 +395,7 @@ udat_parseCalendar(const    UDateFormat*    format,
     ParsePosition pp;
     int32_t stackParsePos = 0;
 
-    if(parsePos == NULL) {
+    if(parsePos == nullptr) {
         parsePos = &stackParsePos;
     }
 
@@ -481,7 +481,7 @@ udat_adoptNumberFormatForFields(           UDateFormat*    fmt,
     verifyIsSimpleDateFormat(fmt, status);
     if (U_FAILURE(*status)) return;
     
-    if (fields!=NULL) {
+    if (fields!=nullptr) {
         UnicodeString overrideFields(fields);
         ((SimpleDateFormat*)fmt)->adoptNumberFormat(overrideFields, (NumberFormat*)numberFormatToSet, *status);
     }
@@ -542,14 +542,14 @@ udat_toPattern(    const   UDateFormat     *fmt,
     if(U_FAILURE(*status)) {
         return -1;
     }
-    if (result == NULL ? resultLength != 0 : resultLength < 0) {
+    if (result == nullptr ? resultLength != 0 : resultLength < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return -1;
     }
 
     UnicodeString res;
-    if (result != NULL) {
-        // NULL destination for pure preflighting: empty dummy string
+    if (result != nullptr) {
+        // nullptr destination for pure preflighting: empty dummy string
         // otherwise, alias the destination buffer
         res.setTo(result, 0, resultLength);
     }
@@ -557,12 +557,12 @@ udat_toPattern(    const   UDateFormat     *fmt,
     const DateFormat *df=reinterpret_cast<const DateFormat *>(fmt);
     const SimpleDateFormat *sdtfmt=dynamic_cast<const SimpleDateFormat *>(df);
     const RelativeDateFormat *reldtfmt;
-    if (sdtfmt!=NULL) {
+    if (sdtfmt!=nullptr) {
         if(localized)
             sdtfmt->toLocalizedPattern(res, *status);
         else
             sdtfmt->toPattern(res);
-    } else if (!localized && (reldtfmt=dynamic_cast<const RelativeDateFormat *>(df))!=NULL) {
+    } else if (!localized && (reldtfmt=dynamic_cast<const RelativeDateFormat *>(df))!=nullptr) {
         reldtfmt->toPattern(res, *status);
     } else {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
@@ -605,15 +605,15 @@ udat_getSymbols(const   UDateFormat     *fmt,
     const DateFormatSymbols *syms;
     const SimpleDateFormat* sdtfmt;
     const RelativeDateFormat* rdtfmt;
-    if ((sdtfmt = dynamic_cast<const SimpleDateFormat*>(reinterpret_cast<const DateFormat*>(fmt))) != NULL) {
+    if ((sdtfmt = dynamic_cast<const SimpleDateFormat*>(reinterpret_cast<const DateFormat*>(fmt))) != nullptr) {
         syms = sdtfmt->getDateFormatSymbols();
-    } else if ((rdtfmt = dynamic_cast<const RelativeDateFormat*>(reinterpret_cast<const DateFormat*>(fmt))) != NULL) {
+    } else if ((rdtfmt = dynamic_cast<const RelativeDateFormat*>(reinterpret_cast<const DateFormat*>(fmt))) != nullptr) {
         syms = rdtfmt->getDateFormatSymbols();
     } else {
         return -1;
     }
     int32_t count = 0;
-    const UnicodeString *res = NULL;
+    const UnicodeString *res = nullptr;
 
     switch(type) {
     case UDAT_ERAS:
@@ -647,8 +647,8 @@ udat_getSymbols(const   UDateFormat     *fmt,
     case UDAT_LOCALIZED_CHARS:
         {
             UnicodeString res1;
-            if(!(result==NULL && resultLength==0)) {
-                // NULL destination for pure preflighting: empty dummy string
+            if(!(result==nullptr && resultLength==0)) {
+                // nullptr destination for pure preflighting: empty dummy string
                 // otherwise, alias the destination buffer
                 res1.setTo(result, 0, resultLength);
             }
@@ -760,9 +760,9 @@ udat_countSymbols(    const    UDateFormat                *fmt,
     const DateFormatSymbols *syms;
     const SimpleDateFormat* sdtfmt;
     const RelativeDateFormat* rdtfmt;
-    if ((sdtfmt = dynamic_cast<const SimpleDateFormat*>(reinterpret_cast<const DateFormat*>(fmt))) != NULL) {
+    if ((sdtfmt = dynamic_cast<const SimpleDateFormat*>(reinterpret_cast<const DateFormat*>(fmt))) != nullptr) {
         syms = sdtfmt->getDateFormatSymbols();
-    } else if ((rdtfmt = dynamic_cast<const RelativeDateFormat*>(reinterpret_cast<const DateFormat*>(fmt))) != NULL) {
+    } else if ((rdtfmt = dynamic_cast<const RelativeDateFormat*>(reinterpret_cast<const DateFormat*>(fmt))) != nullptr) {
         syms = rdtfmt->getDateFormatSymbols();
     } else {
         return 0;
@@ -927,10 +927,10 @@ public:
         setSymbol(UnicodeString *array, int32_t count, int32_t index,
         const UChar *value, int32_t valueLength, UErrorCode &errorCode)
     {
-        if(array!=NULL) {
+        if(array!=nullptr) {
             if(index>=count) {
                 errorCode=U_INDEX_OUTOFBOUNDS_ERROR;
-            } else if(value==NULL) {
+            } else if(value==nullptr) {
                 errorCode=U_ILLEGAL_ARGUMENT_ERROR;
             } else {
                 array[index].setTo(value, valueLength);
@@ -1253,11 +1253,11 @@ udat_getLocaleByType(const UDateFormat *fmt,
                      ULocDataLocaleType type,
                      UErrorCode* status)
 {
-    if (fmt == NULL) {
+    if (fmt == nullptr) {
         if (U_SUCCESS(*status)) {
             *status = U_ILLEGAL_ARGUMENT_ERROR;
         }
-        return NULL;
+        return nullptr;
     }
     return ((Format*)fmt)->getLocaleID(type, *status);
 }
@@ -1285,11 +1285,11 @@ udat_getContext(const UDateFormat* fmt, UDisplayContextType type, UErrorCode* st
 /**
  * Verify that fmt is a RelativeDateFormat. Invalid error if not.
  * @param fmt the UDateFormat, definitely a DateFormat, maybe something else
- * @param status error code, will be set to failure if there is a failure or the fmt is NULL.
+ * @param status error code, will be set to failure if there is a failure or the fmt is nullptr.
  */
 static void verifyIsRelativeDateFormat(const UDateFormat* fmt, UErrorCode *status) {
    if(U_SUCCESS(*status) &&
-       dynamic_cast<const RelativeDateFormat*>(reinterpret_cast<const DateFormat*>(fmt))==NULL) {
+       dynamic_cast<const RelativeDateFormat*>(reinterpret_cast<const DateFormat*>(fmt))==nullptr) {
        *status = U_ILLEGAL_ARGUMENT_ERROR;
    }
 }
@@ -1305,14 +1305,14 @@ udat_toPatternRelativeDate(const UDateFormat *fmt,
     if(U_FAILURE(*status)) {
         return -1;
     }
-    if (result == NULL ? resultLength != 0 : resultLength < 0) {
+    if (result == nullptr ? resultLength != 0 : resultLength < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return -1;
     }
 
     UnicodeString datePattern;
-    if (result != NULL) {
-        // NULL destination for pure preflighting: empty dummy string
+    if (result != nullptr) {
+        // nullptr destination for pure preflighting: empty dummy string
         // otherwise, alias the destination buffer
         datePattern.setTo(result, 0, resultLength);
     }
@@ -1330,14 +1330,14 @@ udat_toPatternRelativeTime(const UDateFormat *fmt,
     if(U_FAILURE(*status)) {
         return -1;
     }
-    if (result == NULL ? resultLength != 0 : resultLength < 0) {
+    if (result == nullptr ? resultLength != 0 : resultLength < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return -1;
     }
 
     UnicodeString timePattern;
-    if (result != NULL) {
-        // NULL destination for pure preflighting: empty dummy string
+    if (result != nullptr) {
+        // nullptr destination for pure preflighting: empty dummy string
         // otherwise, alias the destination buffer
         timePattern.setTo(result, 0, resultLength);
     }
index 355744346a39d729c5b279a6fccd062e22e2d4fe..c8094ff4c2415c3037556e48d06360e36956a9b5 100644 (file)
@@ -43,25 +43,25 @@ udtitvfmt_open(const char*  locale,
                UErrorCode*  status)
 {
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
-    if ((skeleton == NULL ? skeletonLength != 0 : skeletonLength < -1) ||
-        (tzID == NULL ? tzIDLength != 0 : tzIDLength < -1)
+    if ((skeleton == nullptr ? skeletonLength != 0 : skeletonLength < -1) ||
+        (tzID == nullptr ? tzIDLength != 0 : tzIDLength < -1)
     ) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     UnicodeString skel((UBool)(skeletonLength == -1), skeleton, skeletonLength);
     LocalPointer<DateIntervalFormat> formatter(
             DateIntervalFormat::createInstance(skel, Locale(locale), *status));
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
     if(tzID != 0) {
         TimeZone *zone = TimeZone::createTimeZone(UnicodeString((UBool)(tzIDLength == -1), tzID, tzIDLength));
-        if(zone == NULL) {
+        if(zone == nullptr) {
             *status = U_MEMORY_ALLOCATION_ERROR;
-            return NULL;
+            return nullptr;
         }
         formatter->adoptTimeZone(zone);
     }
@@ -88,13 +88,13 @@ udtitvfmt_format(const UDateIntervalFormat* formatter,
     if (U_FAILURE(*status)) {
         return -1;
     }
-    if (result == NULL ? resultCapacity != 0 : resultCapacity < 0) {
+    if (result == nullptr ? resultCapacity != 0 : resultCapacity < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
     UnicodeString res;
-    if (result != NULL) {
-        // NULL destination for pure preflighting: empty dummy string
+    if (result != nullptr) {
+        // nullptr destination for pure preflighting: empty dummy string
         // otherwise, alias the destination buffer (copied from udat_format)
         res.setTo(result, 0, resultCapacity);
     }
index 9e61a12076803ad746e8635ab3778499c09cf870..92f0a3994c86c8b69f36a205f6cfd1c507ac0324 100644 (file)
@@ -30,7 +30,7 @@ U_NAMESPACE_USE
 
 U_CAPI UDateTimePatternGenerator * U_EXPORT2
 udatpg_open(const char *locale, UErrorCode *pErrorCode) {
-    if(locale==NULL) {
+    if(locale==nullptr) {
         return (UDateTimePatternGenerator *)DateTimePatternGenerator::createInstance(*pErrorCode);
     } else {
         return (UDateTimePatternGenerator *)DateTimePatternGenerator::createInstance(Locale(locale), *pErrorCode);
@@ -50,7 +50,7 @@ udatpg_close(UDateTimePatternGenerator *dtpg) {
 U_CAPI UDateTimePatternGenerator * U_EXPORT2
 udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode) {
     if(U_FAILURE(*pErrorCode)) {
-        return NULL;
+        return nullptr;
     }
     return (UDateTimePatternGenerator *)(((const DateTimePatternGenerator *)dtpg)->clone());
 }
@@ -74,7 +74,7 @@ udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg,
     if(U_FAILURE(*pErrorCode)) {
         return 0;
     }
-    if(skeleton==NULL && length!=0) {
+    if(skeleton==nullptr && length!=0) {
         *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -91,7 +91,7 @@ udatpg_getSkeleton(UDateTimePatternGenerator * /* dtpg */,
     if(U_FAILURE(*pErrorCode)) {
         return 0;
     }
-    if(pattern==NULL && length!=0) {
+    if(pattern==nullptr && length!=0) {
         *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -109,7 +109,7 @@ udatpg_getBaseSkeleton(UDateTimePatternGenerator * /* dtpg */,
     if(U_FAILURE(*pErrorCode)) {
         return 0;
     }
-    if(pattern==NULL && length!=0) {
+    if(pattern==nullptr && length!=0) {
         *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -128,7 +128,7 @@ udatpg_addPattern(UDateTimePatternGenerator *dtpg,
     if(U_FAILURE(*pErrorCode)) {
         return UDATPG_NO_CONFLICT;
     }
-    if(pattern==NULL && patternLength!=0) {
+    if(pattern==nullptr && patternLength!=0) {
         *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
         return UDATPG_NO_CONFLICT;
     }
@@ -137,7 +137,7 @@ udatpg_addPattern(UDateTimePatternGenerator *dtpg,
     UDateTimePatternConflict result=((DateTimePatternGenerator *)dtpg)->
             addPattern(patternString, override, conflictingPatternString, *pErrorCode);
     int32_t length=conflictingPatternString.extract(conflictingPattern, capacity, *pErrorCode);
-    if(pLength!=NULL) {
+    if(pLength!=nullptr) {
         *pLength=length;
     }
     return result;
@@ -156,7 +156,7 @@ udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg,
                            UDateTimePatternField field,
                            int32_t *pLength) {
     const UnicodeString &result=((const DateTimePatternGenerator *)dtpg)->getAppendItemFormat(field);
-    if(pLength!=NULL) {
+    if(pLength!=nullptr) {
         *pLength=result.length();
     }
     return result.getBuffer();
@@ -175,7 +175,7 @@ udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
                          UDateTimePatternField field,
                          int32_t *pLength) {
     const UnicodeString &result=((const DateTimePatternGenerator *)dtpg)->getAppendItemName(field);
-    if(pLength!=NULL) {
+    if(pLength!=nullptr) {
         *pLength=result.length();
     }
     return result.getBuffer();
@@ -189,12 +189,12 @@ udatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg,
                            UErrorCode *pErrorCode) {
     if (U_FAILURE(*pErrorCode))
         return -1;
-    if (fieldName == NULL ? capacity != 0 : capacity < 0) {
+    if (fieldName == nullptr ? capacity != 0 : capacity < 0) {
         *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return -1;
     }
     UnicodeString result = ((const DateTimePatternGenerator *)dtpg)->getFieldDisplayName(field,width);
-    if (fieldName == NULL) {
+    if (fieldName == nullptr) {
         return result.length();
     }
     return result.extract(fieldName, capacity, *pErrorCode);
@@ -263,7 +263,7 @@ U_CAPI const UChar * U_EXPORT2
 udatpg_getDecimal(const UDateTimePatternGenerator *dtpg,
                   int32_t *pLength) {
     const UnicodeString &result=((const DateTimePatternGenerator *)dtpg)->getDecimal();
-    if(pLength!=NULL) {
+    if(pLength!=nullptr) {
         *pLength=result.length();
     }
     return result.getBuffer();
@@ -290,7 +290,7 @@ udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg,
     if(U_FAILURE(*pErrorCode)) {
         return 0;
     }
-    if((pattern==NULL && patternLength!=0) || (skeleton==NULL && skeletonLength!=0)) {
+    if((pattern==nullptr && patternLength!=0) || (skeleton==nullptr && skeletonLength!=0)) {
         *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -320,7 +320,7 @@ udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
                              int32_t *pLength) {
     UnicodeString skeletonString((UBool)(skeletonLength<0), skeleton, skeletonLength);
     const UnicodeString &result=((const DateTimePatternGenerator *)dtpg)->getPatternForSkeleton(skeletonString);
-    if(pLength!=NULL) {
+    if(pLength!=nullptr) {
         *pLength=result.length();
     }
     return result.getBuffer();
index 64de856c30867eea9c074c7aa5ec0b9256a1224b..f28e1aa20eeba098170cd32329da3e2c825456de 100644 (file)
@@ -22,10 +22,10 @@ U_CAPI UFieldPositionIterator* U_EXPORT2
 ufieldpositer_open(UErrorCode* status)
 {
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
     FieldPositionIterator* fpositer = new FieldPositionIterator();
-    if (fpositer == NULL) {
+    if (fpositer == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
     }
     return (UFieldPositionIterator*)fpositer;
index 7e8b385c96bac4f84751ce4379261d15d161ccce..b781ca0dfc3342d4809ca278b353f054a284781b 100644 (file)
@@ -24,11 +24,11 @@ ulistfmt_open(const char*  locale,
               UErrorCode*  status)
 {
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
     LocalPointer<ListFormatter> listfmt(ListFormatter::createInstance(Locale(locale), *status));
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
     return (UListFormatter*)listfmt.orphan();
 }
@@ -39,11 +39,11 @@ ulistfmt_openForType(const char*  locale, UListFormatterType type,
                     UListFormatterWidth width, UErrorCode* status)
 {
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
     LocalPointer<ListFormatter> listfmt(ListFormatter::createInstance(Locale(locale), type, width, *status));
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
     return (UListFormatter*)listfmt.orphan();
 }
@@ -74,7 +74,7 @@ static UnicodeString* getUnicodeStrings(
         LocalArray<UnicodeString>& maybeOwner,
         UErrorCode& status) {
     U_ASSERT(U_SUCCESS(status));
-    if (stringCount < 0 || (strings == NULL && stringCount > 0)) {
+    if (stringCount < 0 || (strings == nullptr && stringCount > 0)) {
         status = U_ILLEGAL_ARGUMENT_ERROR;
         return nullptr;
     }
@@ -86,7 +86,7 @@ static UnicodeString* getUnicodeStrings(
         }
         ustrings = maybeOwner.getAlias();
     }
-    if (stringLengths == NULL) {
+    if (stringLengths == nullptr) {
         for (int32_t stringIndex = 0; stringIndex < stringCount; stringIndex++) {
             ustrings[stringIndex].setTo(true, strings[stringIndex], -1);
         }
@@ -111,7 +111,7 @@ ulistfmt_format(const UListFormatter* listfmt,
     if (U_FAILURE(*status)) {
         return -1;
     }
-    if ((result == NULL) ? resultCapacity != 0 : resultCapacity < 0) {
+    if ((result == nullptr) ? resultCapacity != 0 : resultCapacity < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return -1;
     }
@@ -123,8 +123,8 @@ ulistfmt_format(const UListFormatter* listfmt,
         return -1;
     }
     UnicodeString res;
-    if (result != NULL) {
-        // NULL destination for pure preflighting: empty dummy string
+    if (result != nullptr) {
+        // nullptr destination for pure preflighting: empty dummy string
         // otherwise, alias the destination buffer (copied from udat_format)
         res.setTo(result, 0, resultCapacity);
     }
index 48efe9d55ad5e0e67e301668877a839fa6e5c33f..ce06406abc08f2fc5bc009ba997f86ff21ad7862 100644 (file)
@@ -55,24 +55,24 @@ ulocdata_open(const char *localeID, UErrorCode *status)
    ULocaleData *uld;
 
    if (U_FAILURE(*status)) {
-       return NULL;
+       return nullptr;
    }
 
    uld = (ULocaleData *)uprv_malloc(sizeof(ULocaleData));
-   if (uld == NULL) {
+   if (uld == nullptr) {
       *status = U_MEMORY_ALLOCATION_ERROR;
-      return(NULL);
+      return(nullptr);
    }
 
-   uld->langBundle = NULL;
+   uld->langBundle = nullptr;
 
    uld->noSubstitute = false;
-   uld->bundle = ures_open(NULL, localeID, status);
+   uld->bundle = ures_open(nullptr, localeID, status);
    uld->langBundle = ures_open(U_ICUDATA_LANG, localeID, status);
 
    if (U_FAILURE(*status)) {
       uprv_free(uld);
-      return NULL;
+      return nullptr;
    }
 
    return uld;
@@ -81,7 +81,7 @@ ulocdata_open(const char *localeID, UErrorCode *status)
 U_CAPI void U_EXPORT2
 ulocdata_close(ULocaleData *uld)
 {
-    if ( uld != NULL ) {
+    if ( uld != nullptr ) {
        ures_close(uld->langBundle);
        ures_close(uld->bundle);
        uprv_free(uld);
@@ -108,12 +108,12 @@ ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn,
                                                     "AuxExemplarCharacters", 
                                                     "ExemplarCharactersIndex",
                                                     "ExemplarCharactersPunctuation"};
-    const UChar *exemplarChars = NULL;
+    const UChar *exemplarChars = nullptr;
     int32_t len = 0;
     UErrorCode localStatus = U_ZERO_ERROR;
 
     if (U_FAILURE(*status))
-        return NULL;
+        return nullptr;
 
     exemplarChars = ures_getStringByKey(uld->bundle, exemplarSetTypes[extype], &len, &localStatus);
     if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
@@ -125,9 +125,9 @@ ulocdata_getExemplarSet(ULocaleData *uld, USet *fillIn,
     }
 
     if (U_FAILURE(*status))
-        return NULL;
+        return nullptr;
 
-    if(fillIn != NULL)
+    if(fillIn != nullptr)
         uset_applyPattern(fillIn, exemplarChars, len,
                           USET_IGNORE_SPACE | options, status);
     else
@@ -151,13 +151,13 @@ ulocdata_getDelimiter(ULocaleData *uld, ULocaleDataDelimiterType type,
 
     UResourceBundle *delimiterBundle;
     int32_t len = 0;
-    const UChar *delimiter = NULL;
+    const UChar *delimiter = nullptr;
     UErrorCode localStatus = U_ZERO_ERROR;
 
     if (U_FAILURE(*status))
         return 0;
 
-    delimiterBundle = ures_getByKey(uld->bundle, "delimiters", NULL, &localStatus);
+    delimiterBundle = ures_getByKey(uld->bundle, "delimiters", nullptr, &localStatus);
 
     if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
         localStatus = U_MISSING_RESOURCE_ERROR;
@@ -194,24 +194,24 @@ ulocdata_getDelimiter(ULocaleData *uld, ULocaleDataDelimiterType type,
 static UResourceBundle * measurementTypeBundleForLocale(const char *localeID, const char *measurementType, UErrorCode *status){
     char region[ULOC_COUNTRY_CAPACITY];
     UResourceBundle *rb;
-    UResourceBundle *measTypeBundle = NULL;
+    UResourceBundle *measTypeBundle = nullptr;
     
     ulocimp_getRegionForSupplementalData(localeID, true, region, ULOC_COUNTRY_CAPACITY, status);
     
-    rb = ures_openDirect(NULL, "supplementalData", status);
+    rb = ures_openDirect(nullptr, "supplementalData", status);
     ures_getByKey(rb, "measurementData", rb, status);
-    if (rb != NULL) {
-        UResourceBundle *measDataBundle = ures_getByKey(rb, region, NULL, status);
+    if (rb != nullptr) {
+        UResourceBundle *measDataBundle = ures_getByKey(rb, region, nullptr, status);
         if (U_SUCCESS(*status)) {
-               measTypeBundle = ures_getByKey(measDataBundle, measurementType, NULL, status);
+               measTypeBundle = ures_getByKey(measDataBundle, measurementType, nullptr, status);
         }
         if (*status == U_MISSING_RESOURCE_ERROR) {
             *status = U_ZERO_ERROR;
-            if (measDataBundle != NULL) {
+            if (measDataBundle != nullptr) {
                 ures_close(measDataBundle);
             }
-            measDataBundle = ures_getByKey(rb, "001", NULL, status);
-            measTypeBundle = ures_getByKey(measDataBundle, measurementType, NULL, status);
+            measDataBundle = ures_getByKey(rb, "001", nullptr, status);
+            measTypeBundle = ures_getByKey(measDataBundle, measurementType, nullptr, status);
         }
         ures_close(measDataBundle);
     }
@@ -222,10 +222,10 @@ static UResourceBundle * measurementTypeBundleForLocale(const char *localeID, co
 U_CAPI UMeasurementSystem U_EXPORT2
 ulocdata_getMeasurementSystem(const char *localeID, UErrorCode *status){
 
-    UResourceBundle* measurement=NULL;
+    UResourceBundle* measurement=nullptr;
     UMeasurementSystem system = UMS_LIMIT;
 
-    if(status == NULL || U_FAILURE(*status)){
+    if(status == nullptr || U_FAILURE(*status)){
         return system;
     }
 
@@ -243,11 +243,11 @@ ulocdata_getMeasurementSystem(const char *localeID, UErrorCode *status){
 
 U_CAPI void U_EXPORT2
 ulocdata_getPaperSize(const char* localeID, int32_t *height, int32_t *width, UErrorCode *status){
-    UResourceBundle* paperSizeBundle = NULL;
-    const int32_t* paperSize=NULL;
+    UResourceBundle* paperSizeBundle = nullptr;
+    const int32_t* paperSize=nullptr;
     int32_t len = 0;
 
-    if(status == NULL || U_FAILURE(*status)){
+    if(status == nullptr || U_FAILURE(*status)){
         return;
     }
 
@@ -269,8 +269,8 @@ ulocdata_getPaperSize(const char* localeID, int32_t *height, int32_t *width, UEr
 
 U_CAPI void U_EXPORT2
 ulocdata_getCLDRVersion(UVersionInfo versionArray, UErrorCode *status) {
-    UResourceBundle *rb = NULL;
-    rb = ures_openDirect(NULL, "supplementalData", status);
+    UResourceBundle *rb = nullptr;
+    rb = ures_openDirect(nullptr, "supplementalData", status);
     ures_getVersionByKey(rb, "cldrVersion", versionArray, status);
     ures_close(rb);
 }
@@ -282,13 +282,13 @@ ulocdata_getLocaleDisplayPattern(ULocaleData *uld,
                                  UErrorCode *status) {
     UResourceBundle *patternBundle;
     int32_t len = 0;
-    const UChar *pattern = NULL;
+    const UChar *pattern = nullptr;
     UErrorCode localStatus = U_ZERO_ERROR;
 
     if (U_FAILURE(*status))
         return 0;
 
-    patternBundle = ures_getByKey(uld->langBundle, "localeDisplayPattern", NULL, &localStatus);
+    patternBundle = ures_getByKey(uld->langBundle, "localeDisplayPattern", nullptr, &localStatus);
 
     if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
         localStatus = U_MISSING_RESOURCE_ERROR;
@@ -330,7 +330,7 @@ ulocdata_getLocaleSeparator(ULocaleData *uld,
                             UErrorCode *status)  {
     UResourceBundle *separatorBundle;
     int32_t len = 0;
-    const UChar *separator = NULL;
+    const UChar *separator = nullptr;
     UErrorCode localStatus = U_ZERO_ERROR;
     UChar *p0, *p1;
     static const UChar sub0[4] = { 0x007b, 0x0030, 0x007d , 0x0000 }; /* {0} */
@@ -340,7 +340,7 @@ ulocdata_getLocaleSeparator(ULocaleData *uld,
     if (U_FAILURE(*status))
         return 0;
 
-    separatorBundle = ures_getByKey(uld->langBundle, "localeDisplayPattern", NULL, &localStatus);
+    separatorBundle = ures_getByKey(uld->langBundle, "localeDisplayPattern", nullptr, &localStatus);
 
     if ( (localStatus == U_USING_DEFAULT_WARNING) && uld->noSubstitute ) {
         localStatus = U_MISSING_RESOURCE_ERROR;
@@ -373,7 +373,7 @@ ulocdata_getLocaleSeparator(ULocaleData *uld,
     /* For backwards compatibility, if we have a pattern, return the portion between {0} and {1} */
     p0=u_strstr(separator, sub0);
     p1=u_strstr(separator, sub1);
-    if (p0!=NULL && p1!=NULL && p0<=p1) {
+    if (p0!=nullptr && p1!=nullptr && p0<=p1) {
         separator = (const UChar *)p0 + subLen;
         len = static_cast<int32_t>(p1 - separator);
         /* Desired separator is no longer zero-terminated; handle that if necessary */
index c2d5a9a1f5a75725b850cc7e0437d3106a35212e..28d2c84505deadae66b8107273cf44427fc9be92 100644 (file)
@@ -90,7 +90,7 @@ u_vformatMessage(   const char  *locale,
 
 {
     //argument checking deferred to subsequent method calls
-    UMessageFormat *fmt = umsg_open(pattern,patternLength,locale,NULL,status);
+    UMessageFormat *fmt = umsg_open(pattern,patternLength,locale,nullptr,status);
     int32_t retVal = umsg_vformat(fmt,result,resultLength,ap,status);
     umsg_close(fmt);
     return retVal;
@@ -172,7 +172,7 @@ u_vparseMessage(const char  *locale,
                 UErrorCode  *status)
 {
     //argument checking deferred to subsequent method calls
-    UMessageFormat *fmt = umsg_open(pattern,patternLength,locale,NULL,status);
+    UMessageFormat *fmt = umsg_open(pattern,patternLength,locale,nullptr,status);
     int32_t count = 0;
     umsg_vparse(fmt,source,sourceLength,&count,ap,status);
     umsg_close(fmt);
@@ -230,17 +230,17 @@ umsg_open(  const UChar     *pattern,
             UErrorCode      *status)
 {
     //check arguments
-    if(status==NULL || U_FAILURE(*status))
+    if(status==nullptr || U_FAILURE(*status))
     {
       return 0;
     }
-    if(pattern==NULL||patternLength<-1){
+    if(pattern==nullptr||patternLength<-1){
         *status=U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
 
     UParseError tErr;
-    if(parseError==NULL)
+    if(parseError==nullptr)
     {
         parseError = &tErr;
     }
@@ -249,9 +249,9 @@ umsg_open(  const UChar     *pattern,
     UnicodeString patString(patternLength == -1, pattern, len);
 
     MessageFormat* retVal = new MessageFormat(patString,Locale(locale),*parseError,*status);
-    if(retVal == NULL) {
+    if(retVal == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     if (U_SUCCESS(*status) && MessageFormatAdapter::hasArgTypeConflicts(*retVal)) {
         *status = U_ARGUMENT_TYPE_MISMATCH;
@@ -263,7 +263,7 @@ U_CAPI void U_EXPORT2
 umsg_close(UMessageFormat* format)
 {
     //check arguments
-    if(format==NULL){
+    if(format==nullptr){
         return;
     }
     delete (MessageFormat*) format;
@@ -274,12 +274,12 @@ umsg_clone(const UMessageFormat *fmt,
            UErrorCode *status)
 {
     //check arguments
-    if(status==NULL || U_FAILURE(*status)){
-        return NULL;
+    if(status==nullptr || U_FAILURE(*status)){
+        return nullptr;
     }
-    if(fmt==NULL){
+    if(fmt==nullptr){
         *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     UMessageFormat retVal = (UMessageFormat)((MessageFormat*)fmt)->clone();
     if(retVal == 0) {
@@ -293,7 +293,7 @@ U_CAPI void  U_EXPORT2
 umsg_setLocale(UMessageFormat *fmt, const char* locale)
 {
     //check arguments
-    if(fmt==NULL){
+    if(fmt==nullptr){
         return;
     }
     ((MessageFormat*)fmt)->setLocale(Locale(locale));   
@@ -303,7 +303,7 @@ U_CAPI const char*  U_EXPORT2
 umsg_getLocale(const UMessageFormat *fmt)
 {
     //check arguments
-    if(fmt==NULL){
+    if(fmt==nullptr){
         return "";
     }
     return ((const MessageFormat*)fmt)->getLocale().getName();
@@ -318,15 +318,15 @@ umsg_applyPattern(UMessageFormat *fmt,
 {
     //check arguments
     UParseError tErr;
-    if(status ==NULL||U_FAILURE(*status)){
+    if(status ==nullptr||U_FAILURE(*status)){
         return ;
     }
-    if(fmt==NULL || (pattern==NULL && patternLength!=0) || patternLength<-1) {
+    if(fmt==nullptr || (pattern==nullptr && patternLength!=0) || patternLength<-1) {
         *status=U_ILLEGAL_ARGUMENT_ERROR;
         return ;
     }
 
-    if(parseError==NULL){
+    if(parseError==nullptr){
       parseError = &tErr;
     }
 
@@ -341,18 +341,18 @@ umsg_toPattern(const UMessageFormat *fmt,
                UErrorCode* status)
 {
     //check arguments
-    if(status ==NULL||U_FAILURE(*status)){
+    if(status ==nullptr||U_FAILURE(*status)){
         return -1;
     }
-    if(fmt==NULL||resultLength<0 || (resultLength>0 && result==0)){
+    if(fmt==nullptr||resultLength<0 || (resultLength>0 && result==0)){
         *status=U_ILLEGAL_ARGUMENT_ERROR;
         return -1;
     }
 
 
     UnicodeString res;
-    if(!(result==NULL && resultLength==0)) {
-        // NULL destination for pure preflighting: empty dummy string
+    if(!(result==nullptr && resultLength==0)) {
+        // nullptr destination for pure preflighting: empty dummy string
         // otherwise, alias the destination buffer
         res.setTo(result, 0, resultLength);
     }
@@ -397,7 +397,7 @@ umsg_vformat(   const UMessageFormat *fmt,
     {
         return -1;
     }
-    if(fmt==NULL||resultLength<0 || (resultLength>0 && result==0)) {
+    if(fmt==nullptr||resultLength<0 || (resultLength>0 && result==0)) {
         *status=U_ILLEGAL_ARGUMENT_ERROR;
         return -1;
     }
@@ -512,11 +512,11 @@ umsg_vparse(const UMessageFormat *fmt,
             UErrorCode     *status)
 {
     //check arguments
-    if(status==NULL||U_FAILURE(*status))
+    if(status==nullptr||U_FAILURE(*status))
     {
         return;
     }
-    if(fmt==NULL||source==NULL || sourceLength<-1 || count==NULL){
+    if(fmt==nullptr||source==nullptr || sourceLength<-1 || count==nullptr){
         *status=U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
@@ -623,11 +623,11 @@ int32_t umsg_autoQuoteApostrophe(const UChar* pattern,
     int32_t braceCount = 0;
     int32_t len = 0;
 
-    if (ec == NULL || U_FAILURE(*ec)) {
+    if (ec == nullptr || U_FAILURE(*ec)) {
         return -1;
     }
 
-    if (pattern == NULL || patternLength < -1 || (dest == NULL && destCapacity > 0)) {
+    if (pattern == nullptr || patternLength < -1 || (dest == nullptr && destCapacity > 0)) {
         *ec = U_ILLEGAL_ARGUMENT_ERROR;
         return -1;
     }
index fb431ffa2e806c086fb83e45c64c9baae49cbec7..33edbaee01b91c6fdbfc5357c78aae4c096687df 100644 (file)
@@ -86,7 +86,7 @@ static UChar* copySpec(const UChar* spec) {
     ++len;
     UChar *result = (UChar *)uprv_malloc(len*sizeof(UChar));
     // Check for memory allocation error. 
-    if (result != NULL) {
+    if (result != nullptr) {
        uprv_memcpy(result, spec, (size_t)len*sizeof(result[0]));
     }
     return result;
@@ -144,7 +144,7 @@ void UnescapeTransliterator::registerIDs() {
  */
 UnescapeTransliterator::UnescapeTransliterator(const UnicodeString& newID,
                                                const UChar *newSpec) :
-    Transliterator(newID, NULL)
+    Transliterator(newID, nullptr)
 {
     this->spec = copySpec(newSpec);
 }
index e905c5bc5f5c6c063fb55dcce29316eba1f26773..fdfe21c1b6072d585c80418495aba39077735d99 100644 (file)
@@ -46,7 +46,7 @@ class UnescapeTransliterator : public Transliterator {
      * and suffix.  The end is marked by a header of length one
      * consisting of the character END.
      */
-    UChar* spec; // owned; may not be NULL
+    UChar* spec; // owned; may not be nullptr
 
  public:
 
index 97df92b0971864af791b4d143617117afb4b2de3..188ca29031e569f63b565450db698df4818831c8 100644 (file)
@@ -73,7 +73,7 @@ void UnicodeNameTransliterator::handleTransliterate(Replaceable& text, UTransPos
                                                     UBool /*isIncremental*/) const {
     // The failure mode, here and below, is to behave like Any-Null,
     // if either there is no name data (max len == 0) or there is no
-    // memory (malloc() => NULL).
+    // memory (malloc() => nullptr).
 
     int32_t maxLen = uprv_getMaxCharNameLength();
     if (maxLen == 0) {
@@ -83,7 +83,7 @@ void UnicodeNameTransliterator::handleTransliterate(Replaceable& text, UTransPos
 
     // Accommodate the longest possible name plus padding
     char* buf = (char*) uprv_malloc(maxLen);
-    if (buf == NULL) {
+    if (buf == nullptr) {
         offsets.start = offsets.limit;
         return;
     }
index ec50822d58986161590683dc8b80c64cd6210d69..cbce21271767561f93131956bc792db24c149b18 100644 (file)
@@ -277,7 +277,7 @@ public:
         int32_t getBucketIndex(const UnicodeString &name, UErrorCode &errorCode) const;
 
         /**
-         * Returns the index-th bucket. Returns NULL if the index is out of range.
+         * Returns the index-th bucket. Returns nullptr if the index is out of range.
          *
          * @param index bucket number
          * @return the index-th bucket
@@ -627,7 +627,7 @@ public:
 
     /**
      * Return the data pointer of the Record currently being iterated over.
-     * Return NULL if the current iteration position before the first item in this Bucket,
+     * Return nullptr if the current iteration position before the first item in this Bucket,
      * or after the last.
      *
      *  @return The current Record's data pointer.
@@ -731,7 +731,7 @@ private:
     int32_t  itemsIterIndex_;
     Bucket   *currentBucket_;         // While an iteration of the index in underway,
                                       //   point to the bucket for the current label.
-                                      // NULL when no iteration underway.
+                                      // nullptr when no iteration underway.
 
     int32_t    maxLabelCount_;        // Limit on # of labels permitted in the index.
 
index a1c94e523ab1a163b9cf3a22594ff1205722f9b2..4f8e4cacb1423c65e591dde09b434be41646a947 100644 (file)
@@ -107,7 +107,7 @@ public:
     /**
      * Gets the <code>InitialTimeZoneRule</code> and the set of <code>TimeZoneRule</code>
      * which represent time transitions for this time zone.  On successful return,
-     * the argument initial points to non-NULL <code>InitialTimeZoneRule</code> and
+     * the argument initial points to non-nullptr <code>InitialTimeZoneRule</code> and
      * the array trsrules is filled with 0 or multiple <code>TimeZoneRule</code>
      * instances up to the size specified by trscount.  The results are referencing the
      * rule instance held by this time zone instance.  Therefore, after this time zone
@@ -139,13 +139,13 @@ public:
      * The time zone rule objects returned by this method is owned by the caller, so the caller is
      * responsible for deleting them after use.
      * @param date      The date used for extracting time zone rules.
-     * @param initial   Receives the <code>InitialTimeZone</code>, always not NULL.
+     * @param initial   Receives the <code>InitialTimeZone</code>, always not nullptr.
      * @param std       Receives the <code>AnnualTimeZoneRule</code> for standard time transitions.
      *                  When this time time zone does not observe daylight saving times around the
-     *                  specified date, NULL is set.
+     *                  specified date, nullptr is set.
      * @param dst       Receives the <code>AnnualTimeZoneRule</code> for daylight saving time
      *                  transitions.  When this time zone does not observer daylight saving times
-     *                  around the specified date, NULL is set.
+     *                  around the specified date, nullptr is set.
      * @param status    Receives error status code.
      * @stable ICU 3.8
      */
index ec754a75149987bc8614b928789de8f0fdc05720..828962e7f87eb190f3cebec050948c0df6702618 100644 (file)
@@ -302,7 +302,7 @@ public:
      *                 with U_ZERO_ERROR if created successfully, set to a failure result
      *                 otherwise. U_MISSING_RESOURCE_ERROR will be returned if the resource data
      *                 requests a calendar type which has not been installed.
-     * @return         A Calendar if created successfully. NULL otherwise.
+     * @return         A Calendar if created successfully. nullptr otherwise.
      * @stable ICU 2.0
      */
     static Calendar* U_EXPORT2 createInstance(UErrorCode& success);
@@ -316,7 +316,7 @@ public:
      * @param success      Indicates the success/failure of Calendar creation. Filled in
      *                     with U_ZERO_ERROR if created successfully, set to a failure result
      *                     otherwise.
-     * @return             A Calendar if created successfully. NULL otherwise.
+     * @return             A Calendar if created successfully. nullptr otherwise.
      * @stable ICU 2.0
      */
     static Calendar* U_EXPORT2 createInstance(TimeZone* zoneToAdopt, UErrorCode& success);
@@ -329,7 +329,7 @@ public:
      * @param success      Indicates the success/failure of Calendar creation. Filled in
      *                     with U_ZERO_ERROR if created successfully, set to a failure result
      *                     otherwise.
-     * @return             A Calendar if created successfully. NULL otherwise.
+     * @return             A Calendar if created successfully. nullptr otherwise.
      * @stable ICU 2.0
      */
     static Calendar* U_EXPORT2 createInstance(const TimeZone& zone, UErrorCode& success);
@@ -341,7 +341,7 @@ public:
      * @param success  Indicates the success/failure of Calendar creation. Filled in
      *                 with U_ZERO_ERROR if created successfully, set to a failure result
      *                 otherwise.
-     * @return         A Calendar if created successfully. NULL otherwise.
+     * @return         A Calendar if created successfully. nullptr otherwise.
      * @stable ICU 2.0
      */
     static Calendar* U_EXPORT2 createInstance(const Locale& aLocale, UErrorCode& success);
@@ -356,7 +356,7 @@ public:
      * @param success      Indicates the success/failure of Calendar creation. Filled in
      *                     with U_ZERO_ERROR if created successfully, set to a failure result
      *                     otherwise.
-     * @return             A Calendar if created successfully. NULL otherwise.
+     * @return             A Calendar if created successfully. nullptr otherwise.
      * @stable ICU 2.0
      */
     static Calendar* U_EXPORT2 createInstance(TimeZone* zoneToAdopt, const Locale& aLocale, UErrorCode& success);
@@ -370,7 +370,7 @@ public:
      * @param success      Indicates the success/failure of Calendar creation. Filled in
      *                     with U_ZERO_ERROR if created successfully, set to a failure result
      *                     otherwise.
-     * @return             A Calendar if created successfully. NULL otherwise.
+     * @return             A Calendar if created successfully. nullptr otherwise.
      * @stable ICU 2.0
      */
     static Calendar* U_EXPORT2 createInstance(const TimeZone& zone, const Locale& aLocale, UErrorCode& success);
@@ -826,7 +826,7 @@ public:
     /**
      * Sets the calendar's time zone to be the one passed in. The Calendar takes ownership
      * of the TimeZone; the caller is no longer responsible for deleting it.  If the
-     * given time zone is NULL, this function has no effect.
+     * given time zone is nullptr, this function has no effect.
      *
      * @param value  The given time zone.
      * @stable ICU 2.0
@@ -2183,7 +2183,7 @@ private:
 
     /**
      * Time zone affects the time calculation done by Calendar. Calendar subclasses use
-     * the time zone data to produce the local time. Always set; never NULL.
+     * the time zone data to produce the local time. Always set; never nullptr.
      */
     TimeZone*   fZone;
 
@@ -2465,7 +2465,7 @@ private:
 
 private:
     /**
-     * Cast TimeZone used by this object to BasicTimeZone, or NULL if the TimeZone
+     * Cast TimeZone used by this object to BasicTimeZone, or nullptr if the TimeZone
      * is not an instance of BasicTimeZone.
      */
     BasicTimeZone* getBasicTimeZone() const;
index 66f437e52f0b131e9f60ff7910bd86e9a138c7d5..429fa0cebd82c307a2ddb15b2020a99ebf77530a 100644 (file)
@@ -330,31 +330,31 @@ public:
                             int32_t count);
 
     /**
-     * Returns NULL and 0.
+     * Returns nullptr and 0.
      * Before ICU 4.8, this used to return the choice limits array.
      *
      * @param count Will be set to 0.
-     * @return NULL
+     * @return nullptr
      * @deprecated ICU 4.8 Use the MessagePattern class to analyze a ChoiceFormat pattern.
      */
     virtual const double* getLimits(int32_t& count) const;
 
     /**
-     * Returns NULL and 0.
+     * Returns nullptr and 0.
      * Before ICU 4.8, this used to return the limit booleans array.
      *
      * @param count Will be set to 0.
-     * @return NULL
+     * @return nullptr
      * @deprecated ICU 4.8 Use the MessagePattern class to analyze a ChoiceFormat pattern.
      */
     virtual const UBool* getClosures(int32_t& count) const;
 
     /**
-     * Returns NULL and 0.
+     * Returns nullptr and 0.
      * Before ICU 4.8, this used to return the array of choice strings.
      *
      * @param count Will be set to 0.
-     * @return NULL
+     * @return nullptr
      * @deprecated ICU 4.8 Use the MessagePattern class to analyze a ChoiceFormat pattern.
      */
     virtual const UnicodeString* getFormats(int32_t& count) const;
index 6aa35bb5b748b51a4d7f8dc3951c730c228a5142..fc5af953495529b015600dada5534b9a732f3a5f 100644 (file)
@@ -625,7 +625,7 @@ public:
     /**
      * Retrieves the reordering codes for this collator.
      * @param dest The array to fill with the script ordering.
-     * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function
+     * @param destCapacity The length of dest. If it is 0, then dest may be nullptr and the function
      *  will only return the length of the result without writing any codes (pre-flighting).
      * @param status A reference to an error code value, which must not indicate
      * a failure before the function call.
@@ -645,7 +645,7 @@ public:
      * Sets the ordering of scripts for this collator.
      *
      * <p>The reordering codes are a combination of script codes and reorder codes.
-     * @param reorderCodes An array of script codes in the new order. This can be NULL if the
+     * @param reorderCodes An array of script codes in the new order. This can be nullptr if the
      * length is also set to 0. An empty array will clear any reordering codes on the collator.
      * @param reorderCodesLength The length of reorderCodes.
      * @param status error code
@@ -668,7 +668,7 @@ public:
      *
      * @param reorderCode The reorder code to determine equivalence for.
      * @param dest The array to fill with the script equivalence reordering codes.
-     * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the
+     * @param destCapacity The length of dest. If it is 0, then dest may be nullptr and the
      * function will only return the length of the result without writing any codes (pre-flighting).
      * @param status A reference to an error code value, which must not indicate
      * a failure before the function call.
@@ -750,7 +750,7 @@ public:
      * ucol_getKeywords. If any other keyword is passed in, status is set
      * to U_ILLEGAL_ARGUMENT_ERROR.
      * @param status input-output error code
-     * @return a string enumeration over collation keyword values, or NULL
+     * @return a string enumeration over collation keyword values, or nullptr
      * upon error. The caller is responsible for deleting the result.
      * @stable ICU 3.0
      */
@@ -1008,7 +1008,7 @@ public:
      * For more details, see the ICU User Guide.
      *
      * @param source string to be processed.
-     * @param result buffer to store result in. If NULL, number of bytes needed
+     * @param result buffer to store result in. If nullptr, number of bytes needed
      *        will be returned.
      * @param resultLength length of the result buffer. If if not enough the
      *        buffer will be filled to capacity.
@@ -1031,7 +1031,7 @@ public:
      * @param sourceLength length of string to be processed.
      *        If -1, the string is 0 terminated and length will be decided by the
      *        function.
-     * @param result buffer to store result in. If NULL, number of bytes needed
+     * @param result buffer to store result in. If nullptr, number of bytes needed
      *        will be returned.
      * @param resultLength length of the result buffer. If if not enough the
      *        buffer will be filled to capacity.
@@ -1145,7 +1145,7 @@ public:
      *  This is internal, and intended to be used with delegate converters.
      *
      *  @param locale a locale that will appear as a collators locale in the resulting
-     *                short string definition. If NULL, the locale will be harvested
+     *                short string definition. If nullptr, the locale will be harvested
      *                from the collator.
      *  @param buffer space to hold the resulting string
      *  @param capacity capacity of the buffer
@@ -1249,9 +1249,9 @@ public:
 
     /**
      * Return a collator for the provided locale.  If the locale
-     * is not supported, return NULL.
+     * is not supported, return nullptr.
      * @param loc the locale identifying the collator to be created.
-     * @return a new collator if the locale is supported, otherwise NULL.
+     * @return a new collator if the locale is supported, otherwise nullptr.
      * @stable ICU 2.6
      */
     virtual Collator* createCollator(const Locale& loc) = 0;
index 9c1e20099692790657ab20e9a9e1ef5cc971ca7d..02b0cb22fb35586a57e009d1f95b551be75fa350 100644 (file)
@@ -141,7 +141,7 @@ public:
      * This method will fail if this format is not a currency format,
      * that is, if it does not contain the currency pattern symbol
      * (U+00A4) in its prefix or suffix. This implementation always returns
-     * NULL.
+     * nullptr.
      *
      * @param text the string to parse
      * @param pos  input-output position; on input, the position within text
@@ -150,7 +150,7 @@ public:
      *             If the parse fails, the position in unchanged upon output.
      * @return     if parse succeeds, a pointer to a newly-created CurrencyAmount
      *             object (owned by the caller) containing information about
-     *             the parsed currency; if parse fails, this is NULL.
+     *             the parsed currency; if parse fails, this is nullptr.
      * @internal
      */
     CurrencyAmount* parseCurrency(const UnicodeString& text, ParsePosition& pos) const U_OVERRIDE;
index 818b11ae5bd8e5f4b17b0b9b283d31d65c021b13..bbf99b53eedbb0e46079ba5aa4140205ddd85a90 100644 (file)
@@ -43,7 +43,7 @@ class U_I18N_API CurrencyAmount: public Measure {
      * ISO currency code.
      * @param amount a numeric object; amount.isNumeric() must be true
      * @param isoCode the 3-letter ISO 4217 currency code; must not be
-     * NULL and must have length 3
+     * nullptr and must have length 3
      * @param ec input-output error code. If the amount or the isoCode
      * is invalid, then this will be set to a failing value.
      * @stable ICU 3.0
@@ -56,7 +56,7 @@ class U_I18N_API CurrencyAmount: public Measure {
      * ISO currency code.
      * @param amount the amount of the given currency
      * @param isoCode the 3-letter ISO 4217 currency code; must not be
-     * NULL and must have length 3
+     * nullptr and must have length 3
      * @param ec input-output error code. If the isoCode is invalid,
      * then this will be set to a failing value.
      * @stable ICU 3.0
index 8da3f1ffd8711aff6b3d32b2ba4f6d54bc84b7db..3b367b052bd2372b9841256ec1f80bb266d98da3 100644 (file)
@@ -48,7 +48,7 @@ class U_I18N_API CurrencyUnit: public MeasureUnit {
      * Construct an object with the given ISO currency code.
      *
      * @param isoCode the 3-letter ISO 4217 currency code; must have
-     * length 3 and need not be NUL-terminated. If NULL, the currency
+     * length 3 and need not be NUL-terminated. If nullptr, the currency
      * is initialized to the unknown currency XXX.
      * @param ec input-output error code. If the isoCode is invalid,
      * then this will be set to a failing value.
index 027fb1712f4164e21e9b59ae99bbb62a87934cad..27240a4e1c6dd21462a23796cecb564acfb35ebd 100644 (file)
@@ -269,7 +269,7 @@ public:
      *                  Result is appended to existing contents.
      * @param posIter   On return, can be used to iterate over positions
      *                  of fields generated by this format call.  Field values
-     *                  are defined in UDateFormatField.  Can be NULL.
+     *                  are defined in UDateFormatField.  Can be nullptr.
      * @param status    Output param filled with success/failure status.
      * @return          Reference to 'appendTo' parameter.
      * @stable ICU 4.4
@@ -328,7 +328,7 @@ public:
      *                  Result is appended to existing contents.
      * @param posIter   On return, can be used to iterate over positions
      *                  of fields generated by this format call.  Field values
-     *                  are defined in UDateFormatField.  Can be NULL.
+     *                  are defined in UDateFormatField.  Can be nullptr.
      * @param status    error status.
      * @return          Reference to 'appendTo' parameter.
      * @stable ICU 4.4
@@ -376,7 +376,7 @@ public:
      *                  Result is appended to existing contents.
      * @param posIter   On return, can be used to iterate over positions
      *                  of fields generated by this format call.  Field values
-     *                  are defined in UDateFormatField.  Can be NULL.
+     *                  are defined in UDateFormatField.  Can be nullptr.
      * @param status    error status.
      * @return          Reference to 'appendTo' parameter.
      * @stable ICU 4.4
index ab6cd14e187ec35cf54c69196ccfac83236d84be..dffedab48d01cbd185963bbdf54f29bf6660c272 100644 (file)
@@ -952,7 +952,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
      *                  Result is appended to existing contents.
      * @param posIter   On return, can be used to iterate over positions
      *                  of fields generated by this format call.
-     *                  Can be NULL.
+     *                  Can be nullptr.
      * @param status    Output param filled with success/failure status.
      * @return          Reference to 'appendTo' parameter.
      * @stable ICU 4.4
@@ -998,7 +998,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
      *                  Result is appended to existing contents.
      * @param posIter   On return, can be used to iterate over positions
      *                  of fields generated by this format call.
-     *                  Can be NULL.
+     *                  Can be nullptr.
      * @param status    Output param filled with success/failure status.
      * @return          Reference to 'appendTo' parameter.
      * @stable ICU 4.4
@@ -1044,7 +1044,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
      *                  Result is appended to existing contents.
      * @param posIter   On return, can be used to iterate over positions
      *                  of fields generated by this format call.
-     *                  Can be NULL.
+     *                  Can be nullptr.
      * @param status    Output param filled with success/failure status.
      * @return          Reference to 'appendTo' parameter.
      * @stable ICU 4.4
@@ -1063,7 +1063,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
      *                  Result is appended to existing contents.
      * @param posIter   On return, can be used to iterate over positions
      *                  of fields generated by this format call.
-     *                  Can be NULL.
+     *                  Can be nullptr.
      * @param status    Output param filled with success/failure status.
      * @return          Reference to 'appendTo' parameter.
      * @stable ICU 4.4
@@ -1116,7 +1116,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
     /**
      * Parse the given string using this object's choices. The method
      * does string comparisons to try to find an optimal match.
-     * If no object can be parsed, index is unchanged, and NULL is
+     * If no object can be parsed, index is unchanged, and nullptr is
      * returned.  The result is returned as the most parsimonious
      * type of Formattable that will accommodate all of the
      * necessary precision.  For example, if the result is exactly 12,
@@ -1151,7 +1151,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
      *             If the parse fails, the position in unchanged upon output.
      * @return     if parse succeeds, a pointer to a newly-created CurrencyAmount
      *             object (owned by the caller) containing information about
-     *             the parsed currency; if parse fails, this is NULL.
+     *             the parsed currency; if parse fails, this is nullptr.
      * @stable ICU 49
      */
     CurrencyAmount* parseCurrency(const UnicodeString& text, ParsePosition& pos) const U_OVERRIDE;
@@ -2014,7 +2014,7 @@ class U_I18N_API DecimalFormat : public NumberFormat {
      * currency format through the application of a new pattern.
      * @param theCurrency a 3-letter ISO code indicating new currency
      * to use.  It need not be null-terminated.  May be the empty
-     * string or NULL to indicate no currency.
+     * string or nullptr to indicate no currency.
      * @param ec input-output error code
      * @stable ICU 3.0
      */
index 9dbd7288375646b2f55ac8dfe40bb47ed479a889..65a231c845863b4e365ccb50cef6b00a565dfd8e 100644 (file)
@@ -74,7 +74,7 @@ class Hashtable;
  * DateFormatSymbols are not expected to be subclassed. Data for a calendar is
  * loaded out of resource bundles.  The 'type' parameter indicates the type of
  * calendar, for example, "gregorian" or "japanese".  If the type is not gregorian
- * (or NULL, or an empty string) then the type is appended to the resource name,
+ * (or nullptr, or an empty string) then the type is appended to the resource name,
  * for example,  'Eras_japanese' instead of 'Eras'.   If the resource 'Eras_japanese' did
  * not exist (even in root), then this class will fall back to just 'Eras', that is,
  * Gregorian data.  Therefore, the calendar implementor MUST ensure that the root
@@ -122,7 +122,7 @@ public:
      *
      * @param type      Type of calendar (as returned by Calendar::getType).
      *                  Will be used to access the correct set of strings.
-     *                  (NULL or empty string defaults to "gregorian".)
+     *                  (nullptr or empty string defaults to "gregorian".)
      * @param status    Status code.  Failure
      *                  results if the resources for the default cannot be
      *                  found or cannot be loaded
@@ -137,7 +137,7 @@ public:
      * @param locale    Locale to load format data from.
      * @param type      Type of calendar (as returned by Calendar::getType).
      *                  Will be used to access the correct set of strings.
-     *                  (NULL or empty string defaults to "gregorian".)
+     *                  (nullptr or empty string defaults to "gregorian".)
      * @param status    Status code.  Failure
      *                  results if the resources for the locale cannot be
      *                  found or cannot be loaded
@@ -524,14 +524,14 @@ public:
 
     /**
      * Somewhat temporary function for getting complete set of leap month patterns for all
-     * contexts & widths, indexed by EMonthPatternType values. Returns NULL if calendar
+     * contexts & widths, indexed by EMonthPatternType values. Returns nullptr if calendar
      * does not have leap month patterns. Note, there is currently no setter for this.
      * Eventually we will add full support for different month pattern types (needed for
      * other calendars such as Hindu) at which point this approach will be replaced by a
      * more complete approach.
      * @param count        Filled in with length of the array (may be 0).
      * @return             The leap month patterns (DateFormatSymbols retains ownership).
-     *                     May be NULL if there are no leap month patterns for this calendar.
+     *                     May be nullptr if there are no leap month patterns for this calendar.
      * @internal
      */
     const UnicodeString* getLeapMonthPatterns(int32_t& count) const;
index 85a1b365d83f4ab84df9aac12ff16653b2d60b42..1d1b7d73c37aaed879ec5abce0bbec78d34a7e85 100644 (file)
@@ -588,7 +588,7 @@ public:
      *                  If parse fails, return contents are undefined.
      * @param parse_pos The position to start parsing at. Since no parsing
      *                  is supported, upon return this param is unchanged.
-     * @return          A newly created Formattable* object, or NULL
+     * @return          A newly created Formattable* object, or nullptr
      *                  on failure.  The caller owns this and should
      *                  delete it when done.
      * @internal ICU 4.0
@@ -995,8 +995,8 @@ private:
                              const UnicodeString* skeleton,
                              const UnicodeString* bestSkeleton,
                              int8_t differenceInfo,
-                             UnicodeString* extendedSkeleton = NULL,
-                             UnicodeString* extendedBestSkeleton = NULL);
+                             UnicodeString* extendedSkeleton = nullptr,
+                             UnicodeString* extendedBestSkeleton = nullptr);
 
     /**
      * Adjust field width in best match interval pattern to match
index b985f3b2f76db46146b8f8ed64066cd161014511..0c092a00522935ab7672dbf5efb0cd13cbf4c714 100644 (file)
@@ -177,7 +177,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
index e1c6dec35e4a5c5ba5be4212039586973df6c98a..6bda3576042143abd308305e128301e2e9fedeab 100644 (file)
@@ -202,7 +202,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
@@ -446,7 +446,7 @@ public:
     /**
      * Gets the array value and count of this object. If the type is
      * not an array, status is set to U_INVALID_FORMAT_ERROR, count is
-     * set to 0, and the result is NULL.
+     * set to 0, and the result is nullptr.
      * @param count    fill-in with the count of this object.
      * @param status the error code.
      * @return         the array value of this object.
@@ -466,15 +466,15 @@ public:
 
     /**
      * Returns a pointer to the UObject contained within this
-     * formattable, or NULL if this object does not contain a UObject.
-     * @return a UObject pointer, or NULL
+     * formattable, or nullptr if this object does not contain a UObject.
+     * @return a UObject pointer, or nullptr
      * @stable ICU 3.0
      */
     const UObject*  getObject() const;
 
     /**
      * Returns a numeric string representation of the number contained within this
-     * formattable, or NULL if this object does not contain numeric type.
+     * formattable, or nullptr if this object does not contain numeric type.
      * For values obtained by parsing, the returned decimal number retains
      * the full precision and range of the original input, unconstrained by
      * the limits of a double floating point or a 64 bit int.
index abd0debec68abb997f1344f29846d520529656a6..b85deb5ecfbb962db29cecfa680b232d15045826 100644 (file)
@@ -88,7 +88,7 @@ U_NAMESPACE_BEGIN
  *     cout << "Current Time" << endl;
  *
  *     // create a Pacific Standard Time time zone
- *     SimpleTimeZone* pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids->unext(NULL, success)));
+ *     SimpleTimeZone* pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids->unext(nullptr, success)));
  *
  *     // set up rules for daylight savings time
  *     pdt->setStartRule(UCAL_MARCH, 1, UCAL_SUNDAY, 2 * 60 * 60 * 1000);
index 893076145f5f313b033f73bc3f78bb5ecf994ae5..59bf546a9052946e1a7ac5d95f7660d1fe4441bf 100644 (file)
@@ -244,7 +244,7 @@ class U_I18N_API MeasureFormat : public Format {
      * {@link icu::number::NumberFormatter} instead of NumberFormat.
      * @param locale desired locale
      * @param ec input-output error code
-     * @return a formatter object, or NULL upon error
+     * @return a formatter object, or nullptr upon error
      * @stable ICU 3.0
      */
     static MeasureFormat* U_EXPORT2 createCurrencyFormat(const Locale& locale,
@@ -257,7 +257,7 @@ class U_I18N_API MeasureFormat : public Format {
      * <strong>NOTE:</strong> New users are strongly encouraged to use
      * {@link icu::number::NumberFormatter} instead of NumberFormat.
      * @param ec input-output error code
-     * @return a formatter object, or NULL upon error
+     * @return a formatter object, or nullptr upon error
      * @stable ICU 3.0
      */
     static MeasureFormat* U_EXPORT2 createCurrencyFormat(UErrorCode& ec);
index 7b118acfcfaf5afd74653eedfee4ae9c220c0b5c..31f931d7d4a9e6efa5c7a60a651be5c397ad4ebf 100644 (file)
@@ -49,7 +49,7 @@ class U_I18N_API Measure: public UObject {
      * unit.  After this call, the caller must not delete the given
      * unit object.
      * @param number a numeric object; amount.isNumeric() must be true
-     * @param adoptedUnit the unit object, which must not be NULL
+     * @param adoptedUnit the unit object, which must not be nullptr
      * @param ec input-output error code. If the amount or the unit
      * is invalid, then this will be set to a failing value.
      * @stable ICU 3.0
index 76e1ab788e22e12219f75384dc5ef994c61ccca1..a8a61f90e3f6a970a40b330c33372de170e2ccde 100644 (file)
@@ -483,7 +483,7 @@ public:
      * @param aposMode   The new apostrophe mode.
      * @param parseError Struct to receive information on the position
      *                   of an error within the pattern.
-     *                   Can be NULL.
+     *                   Can be nullptr.
      * @param status    Input/output error code.  If the
      *                  pattern cannot be parsed, set to failure code.
      * @stable ICU 4.8
@@ -637,8 +637,8 @@ public:
      * about format numbering.
      *
      * @param count output parameter to receive the size of the array
-     * @return an array of count Format* objects, or NULL if out of
-     * memory.  Any or all of the array elements may be NULL.
+     * @return an array of count Format* objects, or nullptr if out of
+     * memory.  Any or all of the array elements may be nullptr.
      * @stable ICU 2.0
      */
     virtual const Format** getFormats(int32_t& count) const;
@@ -768,7 +768,7 @@ public:
      * @param status    Input/output error code.  If the
      *                  pattern cannot be parsed, set to failure code.
      * @return an array of parsed arguments.  The caller owns both
-     * the array and its contents. Returns NULL if status is not U_ZERO_ERROR.
+     * the array and its contents. Returns nullptr if status is not U_ZERO_ERROR.
      *
      * @stable ICU 2.0
      */
@@ -870,8 +870,8 @@ public:
      * Compares two Format objects. This is used for constructing the hash
      * tables.
      *
-     * @param left pointer to a Format object. Must not be NULL.
-     * @param right pointer to a Format object. Must not be NULL.
+     * @param left pointer to a Format object. Must not be nullptr.
+     * @param right pointer to a Format object. Must not be nullptr.
      *
      * @return whether the two objects are the same
      * @internal
@@ -946,7 +946,7 @@ private:
     PluralSelectorProvider ordinalProvider;
 
     /**
-     * Method to retrieve default formats (or NULL on failure).
+     * Method to retrieve default formats (or nullptr on failure).
      * These are semantically const, but may modify *this.
      */
     const NumberFormat* getDefaultNumberFormat(UErrorCode&) const;
@@ -978,13 +978,13 @@ private:
      * AppendableWrapper, updates the field position.
      *
      * @param msgStart      Index to msgPattern part to start formatting from.
-     * @param plNumber      NULL except when formatting a plural argument sub-message
+     * @param plNumber      nullptr except when formatting a plural argument sub-message
      *                      where a '#' is replaced by the format string for this number.
-     * @param arguments     The formattable objects array. (Must not be NULL.)
-     * @param argumentNames NULL if numbered values are used. Otherwise the same
+     * @param arguments     The formattable objects array. (Must not be nullptr.)
+     * @param argumentNames nullptr if numbered values are used. Otherwise the same
      *                      length as "arguments", and each entry is the name of the
      *                      corresponding argument in "arguments".
-     * @param cnt           The length of arguments (and of argumentNames if that is not NULL).
+     * @param cnt           The length of arguments (and of argumentNames if that is not nullptr).
      * @param appendTo      Output parameter to receive the result.
      *                      The result string is appended to existing contents.
      * @param pos           Field position status.
@@ -1081,8 +1081,8 @@ private:
     void resetPattern();
 
     /**
-     * A DummyFormatter that we use solely to store a NULL value. UHash does
-     * not support storing NULL values.
+     * A DummyFormatter that we use solely to store a nullptr value. UHash does
+     * not support storing nullptr values.
      */
     class U_I18N_API DummyFormat : public Format {
     public:
index 135fe5b66093a984b013a090c99548da0fbfe58d..0e9e6cb5c1ff128658eac3270be187624ba70778 100644 (file)
@@ -141,7 +141,7 @@ class StringEnumeration;
  * format or parsing, or want to give your users more control, you can
  * try dynamic_casting the \c NumberFormat you get from the factory methods to a
  * \c DecimalFormat. This will work for the vast majority of
- * countries; just remember to test for NULL in case you
+ * countries; just remember to test for nullptr in case you
  * encounter an unusual one.
  * <P>
  * You can also use forms of the parse and format methods with
@@ -310,7 +310,7 @@ public:
      *                  Result is appended to existing contents.
      * @param posIter   On return, can be used to iterate over positions
      *                  of fields generated by this format call.  Can be
-     *                  NULL.
+     *                  nullptr.
      * @param status    Output param filled with success/failure status.
      * @return          Reference to 'appendTo' parameter.
      * @stable ICU 4.4
@@ -343,7 +343,7 @@ public:
      *                  last character successfully parsed. If the
      *                  source is not parsed successfully, this param
      *                  will remain unchanged.
-     * @return          A newly created Formattable* object, or NULL
+     * @return          A newly created Formattable* object, or nullptr
      *                  on failure.  The caller owns this and should
      *                  delete it when done.
      * @stable ICU 2.0
@@ -433,7 +433,7 @@ public:
      *                  Result is appended to existing contents.
      * @param posIter   On return, can be used to iterate over positions
      *                  of fields generated by this format call.
-     *                  Can be NULL.
+     *                  Can be nullptr.
      * @param status    Output param filled with success/failure status.
      * @return          Reference to 'appendTo' parameter.
      * @stable ICU 4.4
@@ -485,7 +485,7 @@ public:
      *                  Result is appended to existing contents.
      * @param posIter   On return, can be used to iterate over positions
      *                  of fields generated by this format call.
-     *                  Can be NULL.
+     *                  Can be nullptr.
      * @param status    Output param filled with success/failure status.
      * @return          Reference to 'appendTo' parameter.
      * @stable ICU 4.4
@@ -538,7 +538,7 @@ public:
      *                  Result is appended to existing contents.
      * @param posIter   On return, can be used to iterate over positions
      *                  of fields generated by this format call.
-     *                  Can be NULL.
+     *                  Can be nullptr.
      * @param status    Output param filled with success/failure status.
      * @return          Reference to 'appendTo' parameter.
      * @stable ICU 4.4
@@ -559,7 +559,7 @@ public:
      *                  Result is appended to existing contents.
      * @param posIter   On return, can be used to iterate over positions
      *                  of fields generated by this format call.
-     *                  Can be NULL.
+     *                  Can be nullptr.
      * @param status    Output param filled with success/failure status.
      * @return          Reference to 'appendTo' parameter.
      * @stable ICU 4.4
@@ -621,7 +621,7 @@ public:
     * IntegerOnly is set, will stop at a decimal point (or equivalent;
     * e.g. for rational numbers "1 2/3", will stop after the 1).
     * <P>
-    * If no object can be parsed, index is unchanged, and NULL is
+    * If no object can be parsed, index is unchanged, and nullptr is
     * returned.
     * <P>
     * This is a pure virtual which concrete subclasses must implement.
@@ -673,7 +673,7 @@ public:
      *             If the parse fails, the position in unchanged upon output.
      * @return     if parse succeeds, a pointer to a newly-created CurrencyAmount
      *             object (owned by the caller) containing information about
-     *             the parsed currency; if parse fails, this is NULL.
+     *             the parsed currency; if parse fails, this is nullptr.
      * @stable ICU 49
      */
     virtual CurrencyAmount* parseCurrency(const UnicodeString& text,
@@ -1001,7 +1001,7 @@ public:
      * currency format.
      * @param theCurrency a 3-letter ISO code indicating new currency
      * to use.  It need not be null-terminated.  May be the empty
-     * string or NULL to indicate no currency.
+     * string or nullptr to indicate no currency.
      * @param ec input-output error code
      * @stable ICU 3.0
      */
@@ -1113,7 +1113,7 @@ protected:
     /**
      * Creates the specified number format style of the desired locale.
      * If mustBeDecimalFormat is true, then the returned pointer is
-     * either a DecimalFormat or it is NULL.
+     * either a DecimalFormat or it is nullptr.
      * @internal
      */
     static NumberFormat* makeInstance(const Locale& desiredLocale,
index 358dc533a51848593995540e5410e2e41cb336c6..51a6e147b10792d353490fe0f9fdc1723cf17d58 100644 (file)
@@ -148,7 +148,7 @@ public:
 
     /**
      * Returns the name of this numbering system if it was created using one of the predefined names
-     * known to ICU.  Otherwise, returns NULL.
+     * known to ICU.  Otherwise, returns nullptr.
      * The predefined names are identical to the numbering system names as defined by
      * the BCP47 definition in Unicode CLDR.
      * See also, http://www.unicode.org/repos/cldr/tags/latest/common/bcp47/number.xml
index 1bdc3693413509727d0aef44782c4ac7c8c7583a..8e6cbb445405917250b662d59313174ae5fa1e09 100644 (file)
@@ -543,7 +543,7 @@ private:
 
     class U_I18N_API PluralSelectorAdapter : public PluralSelector {
       public:
-        PluralSelectorAdapter() : pluralRules(NULL) {
+        PluralSelectorAdapter() : pluralRules(nullptr) {
         }
 
         virtual ~PluralSelectorAdapter();
index b4298de63f9c75cea8d309486830b8632fe4b77d..b7d95175f558c03941ac0ec8a37a156c989a704a 100644 (file)
@@ -247,12 +247,12 @@ public:
 
     /**
      * Creates a PluralRules from a description if it is parsable, otherwise
-     * returns NULL.
+     * returns nullptr.
      *
      * @param description rule description
      * @param status      Output param set to success/failure code on exit, which
      *                    must not indicate a failure before the function call.
-     * @return            new PluralRules pointer. NULL if there is an error.
+     * @return            new PluralRules pointer. nullptr if there is an error.
      * @stable ICU 4.0
      */
     static PluralRules* U_EXPORT2 createRules(const UnicodeString& description,
@@ -263,7 +263,7 @@ public:
      *
      * @param status  Output param set to success/failure code on exit, which
      *                must not indicate a failure before the function call.
-     * @return        new PluralRules pointer. NULL if there is an error.
+     * @return        new PluralRules pointer. nullptr if there is an error.
      * @stable ICU 4.0
      */
     static PluralRules* U_EXPORT2 createDefaultRules(UErrorCode& status);
@@ -437,7 +437,7 @@ public:
      *
      * @param keyword      The keyword.
      * @param dest         Array into which to put the returned values.  May
-     *                     be NULL if destCapacity is 0.
+     *                     be nullptr if destCapacity is 0.
      * @param destCapacity The capacity of the array, must be at least 0.
      * @param status       The error code. Deprecated function, always sets U_UNSUPPORTED_ERROR.
      * @return             The count of values available, or -1.  This count
@@ -458,7 +458,7 @@ public:
      *
      * @param keyword      The keyword.
      * @param dest         Array into which to put the returned values.  May
-     *                     be NULL if destCapacity is 0.
+     *                     be nullptr if destCapacity is 0.
      * @param destCapacity The capacity of the array, must be at least 0.
      * @param status       The error code.
      * @return             The count of values written.
@@ -483,7 +483,7 @@ public:
      *
      * @param keyword      The keyword.
      * @param dest         Array into which to put the returned values.  May
-     *                     be NULL if destCapacity is 0.
+     *                     be nullptr if destCapacity is 0.
      * @param destCapacity The capacity of the array, must be at least 0.
      * @param status       The error code.
      * @return             The count of values written.
index 70d92dd549d890b8cf4d382627065492767f8f65..0336ac1f81e99a18c1a850b40e2c9dd95a523de0 100644 (file)
@@ -609,7 +609,7 @@ public:
      * rule sets.  Each of these is one longer than the initial array,
      * with the first String being the ULocale ID, and the remaining
      * Strings being the localizations of the rule set names, in the
-     * same order as the initial array.  Arrays are NULL-terminated.
+     * same order as the initial array.  Arrays are nullptr-terminated.
      * @param rules A description of the formatter's desired behavior.
      * See the class documentation for a complete explanation of the description
      * syntax.
@@ -653,7 +653,7 @@ public:
      * rule sets.  Each of these is one longer than the initial array,
      * with the first String being the ULocale ID, and the remaining
      * Strings being the localizations of the rule set names, in the
-     * same order as the initial array.  Arrays are NULL-terminated.
+     * same order as the initial array.  Arrays are nullptr-terminated.
      * @param rules A description of the formatter's desired behavior.
      * See the class documentation for a complete explanation of the description
      * syntax.
@@ -1063,7 +1063,7 @@ public:
 private:
     RuleBasedNumberFormat() = delete; // default constructor not implemented
 
-    // this will ref the localizations if they are not NULL
+    // this will ref the localizations if they are not nullptr
     // caller must deref to get adoption
     RuleBasedNumberFormat(const UnicodeString& description, LocalizationInfo* localizations,
               const Locale& locale, UParseError& perror, UErrorCode& status);
index 4fbf330cef1c7b924721ceab1773927417bd057d..1cc3483ebf219167a973c1f8b25466e642682d6c 100644 (file)
@@ -287,7 +287,7 @@ public:
     /**
      * Gets the <code>InitialTimeZoneRule</code> and the set of <code>TimeZoneRule</code>
      * which represent time transitions for this time zone.  On successful return,
-     * the argument initial points to non-NULL <code>InitialTimeZoneRule</code> and
+     * the argument initial points to non-nullptr <code>InitialTimeZoneRule</code> and
      * the array trsrules is filled with 0 or multiple <code>TimeZoneRule</code>
      * instances up to the size specified by trscount.  The results are referencing the
      * rule instance held by this time zone instance.  Therefore, after this time zone
index 39b97441a49d758dd25b089db8c394c51314b4a5..6980b947825d04959910551ca885da94cfa4c308 100644 (file)
@@ -545,7 +545,7 @@ public:
      * @param input   The string to be split into fields.  The field delimiters
      *                match the pattern (in the "this" object)
      * @param dest    An array of mutable UText structs to receive the results of the split.
-     *                If a field is NULL, a new UText is allocated to contain the results for
+     *                If a field is nullptr, a new UText is allocated to contain the results for
      *                that field. This new UText is not guaranteed to be mutable.
      * @param destCapacity  The number of elements in the destination array.
      *                If the number of fields found is less than destCapacity, the
@@ -901,13 +901,13 @@ public:
     *   Returns a shallow clone of the entire live input string with the UText current native index
     *   set to the beginning of the requested group.
     *
-    *   @param   dest        The UText into which the input should be cloned, or NULL to create a new UText
+    *   @param   dest        The UText into which the input should be cloned, or nullptr to create a new UText
     *   @param   group_len   A reference to receive the length of the desired capture group
     *   @param   status      A reference to a UErrorCode to receive any errors.
     *                        Possible errors are  U_REGEX_INVALID_STATE if no match
     *                        has been attempted or the last match failed and
     *                        U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number.
-    *   @return dest if non-NULL, a shallow copy of the input text otherwise
+    *   @return dest if non-nullptr, a shallow copy of the input text otherwise
     *
     *   @stable ICU 4.6
     */
@@ -923,13 +923,13 @@ public:
     *   which returns -1 for non-participating groups.
     *
     *   @param   groupNum   The capture group number.
-    *   @param   dest        The UText into which the input should be cloned, or NULL to create a new UText.
+    *   @param   dest        The UText into which the input should be cloned, or nullptr to create a new UText.
     *   @param   group_len   A reference to receive the length of the desired capture group
     *   @param   status      A reference to a UErrorCode to receive any errors.
     *                        Possible errors are  U_REGEX_INVALID_STATE if no match
     *                        has been attempted or the last match failed and
     *                        U_INDEX_OUTOFBOUNDS_ERROR for a bad capture group number.
-    *   @return dest if non-NULL, a shallow copy of the input text otherwise
+    *   @return dest if non-nullptr, a shallow copy of the input text otherwise
     *
     *   @stable ICU 4.6
     */
@@ -1183,9 +1183,9 @@ public:
     *   Returns the input string being matched, either by copying it into the provided
     *   UText parameter or by returning a shallow clone of the live input. Note that copying
     *   the entire input may cause significant performance and memory issues.
-    *   @param dest The UText into which the input should be copied, or NULL to create a new UText
+    *   @param dest The UText into which the input should be copied, or nullptr to create a new UText
     *   @param status error code
-    *   @return dest if non-NULL, a shallow copy of the input text otherwise
+    *   @return dest if non-nullptr, a shallow copy of the input text otherwise
     *
     *   @stable ICU 4.6
     */
@@ -1388,7 +1388,7 @@ public:
     *
     *    @param   replacement a string containing the replacement text.
     *    @param   dest        a mutable UText in which the results are placed.
-    *                          If NULL, a new UText will be created (which may not be mutable).
+    *                          If nullptr, a new UText will be created (which may not be mutable).
     *    @param   status      a reference to a UErrorCode to receive any errors.
     *    @return              a string containing the results of the find and replace.
     *                          If a pre-allocated UText was provided, it will always be used and returned.
@@ -1438,7 +1438,7 @@ public:
     *
     *    @param   replacement a string containing the replacement text.
     *    @param   dest        a mutable UText in which the results are placed.
-    *                          If NULL, a new UText will be created (which may not be mutable).
+    *                          If nullptr, a new UText will be created (which may not be mutable).
     *    @param   status      a reference to a UErrorCode to receive any errors.
     *    @return              a string containing the results of the find and replace.
     *                          If a pre-allocated UText was provided, it will always be used and returned.
@@ -1492,7 +1492,7 @@ public:
     *   operations, see replaceFirst() or replaceAll().
     *
     *   @param   dest        A mutable UText to which the results of the find-and-replace are appended.
-    *                         Must not be NULL.
+    *                         Must not be nullptr.
     *   @param   replacement A UText that provides the text to be substituted for
     *                        the input text that matched the regexp pattern.  The replacement
     *                        text may contain references to captured text from the input.
@@ -1530,7 +1530,7 @@ public:
     * or more invocations of the `RegexMatcher::appendReplacement()`.
     *
     *  @param dest A mutable UText to which the results of the find-and-replace are appended.
-    *               Must not be NULL.
+    *               Must not be nullptr.
     *  @param status error cod
     *  @return  the destination string.
     *
@@ -1578,7 +1578,7 @@ public:
      *                match the pattern (in the "this" object).  This matcher
      *                will be reset to this input string.
      * @param dest    An array of mutable UText structs to receive the results of the split.
-     *                If a field is NULL, a new UText is allocated to contain the results for
+     *                If a field is nullptr, a new UText is allocated to contain the results for
      *                that field. This new UText is not guaranteed to be mutable.
      * @param destCapacity  The number of elements in the destination array.
      *                If the number of fields found is less than destCapacity, the
@@ -1791,11 +1791,11 @@ private:
     UBool                isChunkWordBoundary(int32_t pos);
 
     const RegexPattern  *fPattern;
-    RegexPattern        *fPatternOwned;    // Non-NULL if this matcher owns the pattern, and
+    RegexPattern        *fPatternOwned;    // Non-nullptr if this matcher owns the pattern, and
                                            //   should delete it when through.
 
     const UnicodeString *fInput;           // The string being matched. Only used for input()
-    UText               *fInputText;       // The text being matched. Is never NULL.
+    UText               *fInputText;       // The text being matched. Is never nullptr.
     UText               *fAltInputText;    // A shallow copy of the text being matched.
                                            //   Only created if the pattern contains backreferences.
     int64_t              fInputLength;     // Full length of the input text.
@@ -1855,11 +1855,11 @@ private:
                                            //   stack, in bytes.  Zero for unlimited.
 
     URegexMatchCallback *fCallbackFn;       // Pointer to match progress callback funct.
-                                           //   NULL if there is no callback.
+                                           //   nullptr if there is no callback.
     const void         *fCallbackContext;  // User Context ptr for callback function.
 
     URegexFindProgressCallback  *fFindProgressCallbackFn;  // Pointer to match progress callback funct.
-                                                           //   NULL if there is no callback.
+                                                           //   nullptr if there is no callback.
     const void         *fFindProgressCallbackContext;      // User Context ptr for callback function.
 
 
index ba4a650f4f9ca6e93134b969d35341f19bde32ad..1e19d66f4a5b1e11598e6f94f7c7e8f821e1d7ef 100644 (file)
@@ -93,7 +93,7 @@ public:
      * Returns a pointer to a Region using the given region code.  The region code can be either 2-letter ISO code,
      * 3-letter ISO code,  UNM.49 numeric code, or other valid Unicode Region Code as defined by the LDML specification.
      * The identifier will be canonicalized internally using the supplemental metadata as defined in the CLDR.
-     * If the region code is NULL or not recognized, the appropriate error code will be set ( U_ILLEGAL_ARGUMENT_ERROR )
+     * If the region code is nullptr or not recognized, the appropriate error code will be set ( U_ILLEGAL_ARGUMENT_ERROR )
      * @stable ICU 51 
      */
     static const Region* U_EXPORT2 getInstance(const char *region_code, UErrorCode &status);
@@ -112,7 +112,7 @@ public:
     static StringEnumeration* U_EXPORT2 getAvailable(URegionType type, UErrorCode &status);
    
     /**
-     * Returns a pointer to the region that contains this region.  Returns NULL if this region is code "001" (World)
+     * Returns a pointer to the region that contains this region.  Returns nullptr if this region is code "001" (World)
      * or "ZZ" (Unknown region). For example, calling this method with region "IT" (Italy) returns the
      * region "039" (Southern Europe).
      * @stable ICU 51 
@@ -121,9 +121,9 @@ public:
 
     /**
      * Return a pointer to the region that geographically contains this region and matches the given type,
-     * moving multiple steps up the containment chain if necessary.  Returns NULL if no containing region can be found
+     * moving multiple steps up the containment chain if necessary.  Returns nullptr if no containing region can be found
      * that matches the given type. Note: The URegionTypes = "URGN_GROUPING", "URGN_DEPRECATED", or "URGN_UNKNOWN"
-     * are not appropriate for use in this API. NULL will be returned in this case. For example, calling this method
+     * are not appropriate for use in this API. nullptr will be returned in this case. For example, calling this method
      * with region "IT" (Italy) for type "URGN_CONTINENT" returns the region "150" ( Europe ).
      * @stable ICU 51 
      */
@@ -132,7 +132,7 @@ public:
     /**
      * Return an enumeration over the IDs of all the regions that are immediate children of this region in the
      * region hierarchy. These returned regions could be either macro regions, territories, or a mixture of the two,
-     * depending on the containment data as defined in CLDR.  This API may return NULL if this region doesn't have
+     * depending on the containment data as defined in CLDR.  This API may return nullptr if this region doesn't have
      * any sub-regions. For example, calling this method with region "150" (Europe) returns an enumeration containing
      * the various sub regions of Europe - "039" (Southern Europe) - "151" (Eastern Europe) - "154" (Northern Europe)
      * and "155" (Western Europe).
index 2a3742fd63c392f4eb81b5a9b42e15e8d40952ef..82a4eb77833fa15e013e67e93738117120a650dc 100644 (file)
@@ -428,7 +428,7 @@ public:
      * @param locale the locale
      * @param nfToAdopt Constructed object takes ownership of this pointer.
      *   It is an error for caller to delete this pointer or change its
-     *   contents after calling this constructor. Caller may pass NULL for
+     *   contents after calling this constructor. Caller may pass nullptr for
      *   this argument if they want default number format behavior.
      * @param style the format style. The UDAT_RELATIVE bit field has no effect.
      * @param capitalizationContext A value from UDisplayContext that pertains to
index 295a3ce67e9cf5b931a38a66a80962988314024c..a8004efc43116e95751ee6bdd7a5a0aba3b006a7 100644 (file)
@@ -206,7 +206,7 @@ public:
      *                found, but the match's start or end index is not a 
      *                boundary as determined by the <tt>BreakIterator</tt>, 
      *                the match will be rejected and another will be searched 
-     *                for. If this parameter is <tt>NULL</tt>, no break
+     *                for. If this parameter is <tt>nullptr</tt>, no break
      *                detection is attempted.
      * @param status for errors if it occurs
      * @see BreakIterator
@@ -218,7 +218,7 @@ public:
      * Returns the BreakIterator that is used to restrict the points at 
      * which matches are detected.  This will be the same object that was 
      * passed to the constructor or to <tt>setBreakIterator</tt>.
-     * Note that <tt>NULL</tt> is a legal value; it means that break
+     * Note that <tt>nullptr</tt> is a legal value; it means that break
      * detection should not be attempted.
      * @return BreakIterator used to restrict matchings.
      * @see #setBreakIterator
@@ -452,13 +452,13 @@ protected:
      *                boundary as determined by the <tt>BreakIterator</tt>, 
      *                the match is rejected and <tt>handleNext</tt> or 
      *                <tt>handlePrev</tt> is called again. If this parameter 
-     *                is <tt>NULL</tt>, no break detection is attempted.  
+     *                is <tt>nullptr</tt>, no break detection is attempted.
      * @see #handleNext
      * @see #handlePrev
      * @stable ICU 2.0
      */
     SearchIterator(const UnicodeString &text, 
-                         BreakIterator *breakiter = NULL);
+                         BreakIterator *breakiter = nullptr);
 
     /**
      * Constructor for use by subclasses.
@@ -474,12 +474,12 @@ protected:
      *                boundary as determined by the <tt>BreakIterator</tt>, 
      *                the match is rejected and <tt>handleNext</tt> or 
      *                <tt>handlePrev</tt> is called again. If this parameter 
-     *                is <tt>NULL</tt>, no break detection is attempted.
+     *                is <tt>nullptr</tt>, no break detection is attempted.
      * @see #handleNext
      * @see #handlePrev
      * @stable ICU 2.0
      */
-    SearchIterator(CharacterIterator &text, BreakIterator *breakiter = NULL);
+    SearchIterator(CharacterIterator &text, BreakIterator *breakiter = nullptr);
 
     // protected methods --------------------------------------------------
 
index cbdba7aff6eec4a69d39ba821d91af47f118b6ef..9005c9ccbaf6ecb82d1bd93c0f171dbc8314afb2 100644 (file)
@@ -744,7 +744,7 @@ public:
     /**
      * Gets the <code>InitialTimeZoneRule</code> and the set of <code>TimeZoneRule</code>
      * which represent time transitions for this time zone.  On successful return,
-     * the argument initial points to non-NULL <code>InitialTimeZoneRule</code> and
+     * the argument initial points to non-nullptr <code>InitialTimeZoneRule</code> and
      * the array trsrules is filled with 0 or multiple <code>TimeZoneRule</code>
      * instances up to the size specified by trscount.  The results are referencing the
      * rule instance held by this time zone instance.  Therefore, after this time zone
index 6143bfcb9dbf60bef6573cd38140d30f4b63b679..4343bfbca53aa95f2965c2450fbfc3f7ad26804d 100644 (file)
@@ -1317,7 +1317,7 @@ private:
 
     /**
      * initializes fCalendar from parameters.  Returns fCalendar as a convenience.
-     * @param adoptZone  Zone to be adopted, or NULL for TimeZone::createDefault().
+     * @param adoptZone  Zone to be adopted, or nullptr for TimeZone::createDefault().
      * @param locale Locale of the calendar
      * @param status Error code
      * @return the newly constructed fCalendar
@@ -1350,7 +1350,7 @@ private:
      * @param field the date field being parsed.
      * @param stringArray the string array to parsed.
      * @param stringArrayCount the size of the array.
-     * @param monthPattern pointer to leap month pattern, or NULL if none.
+     * @param monthPattern pointer to leap month pattern, or nullptr if none.
      * @param cal a Calendar set to the date and time to be formatted
      *            into a date/time string.
      * @return the new start position if matching succeeded; a negative number
@@ -1433,14 +1433,14 @@ private:
      * @param patLoc
      * @param numericLeapMonthFormatter If non-null, used to parse numeric leap months.
      * @param tzTimeType the type of parsed time zone - standard, daylight or unknown (output).
-     *      This parameter can be NULL if caller does not need the information.
+     *      This parameter can be nullptr if caller does not need the information.
      * @return the new start position if matching succeeded; a negative number
      * indicating matching failure, otherwise.
      */
     int32_t subParse(const UnicodeString& text, int32_t& start, char16_t ch, int32_t count,
                      UBool obeyCount, UBool allowNegative, UBool ambiguousYear[], int32_t& saveHebrewMonth, Calendar& cal,
                      int32_t patLoc, MessageFormat * numericLeapMonthFormatter, UTimeZoneFormatTimeType *tzTimeType,
-                     int32_t *dayPeriod=NULL) const;
+                     int32_t *dayPeriod=nullptr) const;
 
     void parseInt(const UnicodeString& text,
                   Formattable& number,
@@ -1631,13 +1631,13 @@ private:
         int32_t hash;
         NSOverride *next;
         void free();
-        NSOverride() : snf(NULL), hash(0), next(NULL) {
+        NSOverride() : snf(nullptr), hash(0), next(nullptr) {
         }
         ~NSOverride();
     };
 
     /**
-     * The number format in use for each date field. NULL means fall back
+     * The number format in use for each date field. nullptr means fall back
      * to fNumberFormat in DateFormat.
      */
     const SharedNumberFormat    **fSharedNumberFormatters = nullptr;
index b1231f18b784022282e9142076f0c170a576b8fe..401b5abad0a14c8c55869e064d46d7812f087a9b 100644 (file)
@@ -249,7 +249,7 @@ private:
     /**
      * Replaces the current bytes buffer with a new one of newCapacity
      * and copies length bytes from the old buffer to the new one.
-     * @return the new buffer, or NULL if the allocation failed
+     * @return the new buffer, or nullptr if the allocation failed
      */
     uint8_t *reallocate(int32_t newCapacity, int32_t length);
     /**
index b8a919f6147f341c74e4536254edecc8f32f28be..6f80194e644d2fa5dd20fb3dbb8cf2b706dcf2db 100644 (file)
@@ -116,7 +116,7 @@ U_NAMESPACE_BEGIN
  * UnicodeString pattern("fox");
  *
  * UErrorCode      error = U_ZERO_ERROR;
- * StringSearch iter(pattern, target, Locale::getUS(), NULL, status);
+ * StringSearch iter(pattern, target, Locale::getUS(), nullptr, status);
  * for (int pos = iter.first(error);
  *      pos != USEARCH_DONE; 
  *      pos = iter.next(error))
@@ -153,8 +153,8 @@ public:
      *                indices in the target text are not boundaries as 
      *                determined by the <tt>BreakIterator</tt> are 
      *                ignored. If this behavior is not desired, 
-     *                <tt>NULL</tt> can be passed in instead.
-     * @param status  for errors if any. If pattern or text is NULL, or if
+     *                <tt>nullptr</tt> can be passed in instead.
+     * @param status  for errors if any. If pattern or text is nullptr, or if
      *               either the length of pattern or text is 0 then an 
      *               U_ILLEGAL_ARGUMENT_ERROR is returned.
      * @stable ICU 2.0
@@ -180,7 +180,7 @@ public:
      *                indices in the target text are not boundaries as 
      *                determined by the <tt>BreakIterator</tt> are 
      *                ignored. If this behavior is not desired, 
-     *                <tt>NULL</tt> can be passed in instead.
+     *                <tt>nullptr</tt> can be passed in instead.
      * @param status for errors if any. If either the length of pattern or 
      *               text is 0 then an U_ILLEGAL_ARGUMENT_ERROR is returned.
      * @stable ICU 2.0
@@ -211,7 +211,7 @@ public:
      *                indices in the target text are not boundaries as 
      *                determined by the <tt>BreakIterator</tt> are 
      *                ignored. If this behavior is not desired, 
-     *                <tt>NULL</tt> can be passed in instead.
+     *                <tt>nullptr</tt> can be passed in instead.
      * @param status for errors if any. If either the length of pattern or 
      *               text is 0 then an U_ILLEGAL_ARGUMENT_ERROR is returned.
      * @stable ICU 2.0
@@ -241,7 +241,7 @@ public:
      *                indices in the target text are not boundaries as 
      *                determined by the <tt>BreakIterator</tt> are 
      *                ignored. If this behavior is not desired, 
-     *                <tt>NULL</tt> can be passed in instead.
+     *                <tt>nullptr</tt> can be passed in instead.
      * @param status for errors if any. If either the length of pattern or 
      *               text is 0 then an U_ILLEGAL_ARGUMENT_ERROR is returned.
      * @stable ICU 2.0
@@ -269,7 +269,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
index 2de1af85392fc8c22904240f5b54093a24e2ebe5..3fac5ef766e9c475c32d712e35e804c3787a3e93 100644 (file)
@@ -193,7 +193,7 @@ public:
     *  @param length size of the image. If negative, the API will try to
     *                figure out the length of the image
     *  @param base Base collator, for lookup of untailored characters.
-    *              Must be the root collator, must not be NULL.
+    *              Must be the root collator, must not be nullptr.
     *              The base is required to be present through the lifetime of the collator.
     *  @param status for catching errors
     *  @return newly created collator
@@ -626,7 +626,7 @@ public:
      * For more details, see the ICU User Guide.
      *
      * @param source string to be processed.
-     * @param result buffer to store result in. If NULL, number of bytes needed
+     * @param result buffer to store result in. If nullptr, number of bytes needed
      *        will be returned.
      * @param resultLength length of the result buffer. If if not enough the
      *        buffer will be filled to capacity.
@@ -645,7 +645,7 @@ public:
      * @param source string to be processed.
      * @param sourceLength length of string to be processed. If -1, the string
      *        is 0 terminated and length will be decided by the function.
-     * @param result buffer to store result in. If NULL, number of bytes needed
+     * @param result buffer to store result in. If nullptr, number of bytes needed
      *        will be returned.
      * @param resultLength length of the result buffer. If if not enough the
      *        buffer will be filled to capacity.
@@ -658,7 +658,7 @@ public:
     /**
      * Retrieves the reordering codes for this collator.
      * @param dest The array to fill with the script ordering.
-     * @param destCapacity The length of dest. If it is 0, then dest may be NULL and the function
+     * @param destCapacity The length of dest. If it is 0, then dest may be nullptr and the function
      *  will only return the length of the result without writing any codes (pre-flighting).
      * @param status A reference to an error code value, which must not indicate
      * a failure before the function call.
@@ -674,7 +674,7 @@ public:
 
     /**
      * Sets the ordering of scripts for this collator.
-     * @param reorderCodes An array of script codes in the new order. This can be NULL if the
+     * @param reorderCodes An array of script codes in the new order. This can be nullptr if the
      * length is also set to 0. An empty array will clear any reordering codes on the collator.
      * @param reorderCodesLength The length of reorderCodes.
      * @param status error code
@@ -708,7 +708,7 @@ public:
      *  This is internal, and intended to be used with delegate converters.
      *
      *  @param locale a locale that will appear as a collators locale in the resulting
-     *                short string definition. If NULL, the locale will be harvested
+     *                short string definition. If nullptr, the locale will be harvested
      *                from the collator.
      *  @param buffer space to hold the resulting string
      *  @param capacity capacity of the buffer
@@ -754,8 +754,8 @@ public:
      * characters and strings that map to multiple collation elements (expansions).
      * If addPrefixes is true, then contractions that are expressed as
      * prefix/pre-context rules are included.
-     * @param contractions if not NULL, the set to hold the contractions
-     * @param expansions if not NULL, the set to hold the expansions
+     * @param contractions if not nullptr, the set to hold the contractions
+     * @param expansions if not nullptr, the set to hold the expansions
      * @param addPrefixes include prefix contextual mappings
      * @param errorCode in/out ICU error code
      * @internal
index 382ad97d5bf381acce33600d18cad7a2dc8c8ae8..a2c0552c18971545a8943a68dd7001b49c8b6d29 100644 (file)
@@ -171,7 +171,7 @@ public:
      * or a custom ID such as "GMT-8:00".
      * @return the specified <code>TimeZone</code>, or a mutable clone of getUnknown()
      * if the given ID cannot be understood or if the given ID is "Etc/Unknown".
-     * The return result is guaranteed to be non-NULL.
+     * The return result is guaranteed to be non-nullptr.
      * If you require that the specific zone asked for be returned,
      * compare the result with getUnknown() or check the ID of the return result.
      * @stable ICU 2.0
@@ -183,11 +183,11 @@ public:
      * filter conditions.
      * @param zoneType      The system time zone type.
      * @param region        The ISO 3166 two-letter country code or UN M.49
-     *                      three-digit area code. When NULL, no filtering
+     *                      three-digit area code. When nullptr, no filtering
      *                      done by region. 
      * @param rawOffset     An offset from GMT in milliseconds, ignoring
      *                      the effect of daylight savings time, if any.
-     *                      When NULL, no filtering done by zone offset. 
+     *                      When nullptr, no filtering done by zone offset.
      * @param ec            Output param to filled in with a success or
      *                      an error.
      * @return an enumeration object, owned by the caller.
@@ -267,7 +267,7 @@ public:
      * given region.  Some zones are affiliated with no region
      * (e.g., "UTC"); these may also be retrieved, as a group.
      *
-     * @param region The ISO 3166 two-letter country code, or NULL to
+     * @param region The ISO 3166 two-letter country code, or nullptr to
      * retrieve zones not affiliated with any region.
      * @return an enumeration object, owned by the caller
      * @deprecated ICU 70 Use createEnumerationForRegion(const char*,UErrorCode&) instead.
@@ -280,7 +280,7 @@ public:
      * given region.  Some zones are affiliated with no region
      * (e.g., "UTC"); these may also be retrieved, as a group.
      *
-     * @param region The ISO 3166 two-letter country code, or NULL to
+     * @param region The ISO 3166 two-letter country code, or nullptr to
      * retrieve zones not affiliated with any region.
      * @param status Receives the status.
      * @return an enumeration object, owned by the caller
@@ -381,7 +381,7 @@ public:
 
     /**
      * Sets the default time zone (i.e., what's returned by createDefault()) to be the
-     * specified time zone.  If NULL is specified for the time zone, the default time
+     * specified time zone.  If nullptr is specified for the time zone, the default time
      * zone is set to the default host time zone.  This call adopts the TimeZone object
      * passed in; the client is no longer responsible for deleting it.
      *
@@ -486,7 +486,7 @@ public:
     * Updating the Time Zone Data</a>.
     *
     * @param winid     A Windows time zone ID.
-    * @param region    A null-terminated region code, or <code>NULL</code> if no regional preference.
+    * @param region    A NUL-terminated region code, or <code>nullptr</code> if no regional preference.
     * @param id        Receives a system time zone ID. When the input Windows time zone ID is unknown
     *                  or unmappable to a system time zone ID, then an empty string is set on return.
     * @param status    Receives the status.
@@ -912,7 +912,7 @@ protected:
      * Utility function. For internally loading rule data.
      * @param top Top resource bundle for tz data
      * @param ruleid ID of rule to load
-     * @param oldbundle Old bundle to reuse or NULL
+     * @param oldbundle Old bundle to reuse or nullptr
      * @param status Status parameter
      * @return either a new bundle or *oldbundle
      * @internal
@@ -932,7 +932,7 @@ private:
      * for ICU internal implementation and useful for building hashtable using a time zone
      * ID as a key.
      * @param id zone id string
-     * @return the pointer of the ID resource, or NULL.
+     * @return the pointer of the ID resource, or nullptr.
      */
     static const char16_t* findID(const UnicodeString& id);
 
@@ -940,15 +940,15 @@ private:
      * Resolve a link in Olson tzdata.  When the given id is known and it's not a link,
      * the id itself is returned.  When the given id is known and it is a link, then
      * dereferenced zone id is returned.  When the given id is unknown, then it returns
-     * NULL.
+     * nullptr.
      * @param id zone id string
-     * @return the dereferenced zone or NULL
+     * @return the dereferenced zone or nullptr
      */
     static const char16_t* dereferOlsonLink(const UnicodeString& id);
 
     /**
      * Returns the region code associated with the given zone,
-     * or NULL if the zone is not known.
+     * or nullptr if the zone is not known.
      * @param id zone id string
      * @return the region associated with the given zone
      */
@@ -958,7 +958,7 @@ private:
 #ifndef U_HIDE_INTERNAL_API
     /**
      * Returns the region code associated with the given zone,
-     * or NULL if the zone is not known.
+     * or nullptr if the zone is not known.
      * @param id zone id string
      * @param status Status parameter
      * @return the region associated with the given zone
index 56eb6448ca45891d85608241248c848c049ae622..9ae32967fc45dcc60f6f5433e585a028adcc7078 100644 (file)
@@ -590,7 +590,7 @@ protected:
      * variant.
      * @param id a basic ID of the form S-T or S-T/V.
      * @param canon canonical ID to assign to the object, or
-     * NULL to leave the ID unchanged
+     * nullptr to leave the ID unchanged
      * @return a newly created Transliterator or null if the ID is
      * invalid.
      * @stable ICU 2.4
@@ -1002,20 +1002,20 @@ public:
                                          UnicodeString& result);
 
     /**
-     * Returns the filter used by this transliterator, or <tt>NULL</tt>
+     * Returns the filter used by this transliterator, or <tt>nullptr</tt>
      * if this transliterator uses no filter.
-     * @return the filter used by this transliterator, or <tt>NULL</tt>
+     * @return the filter used by this transliterator, or <tt>nullptr</tt>
      *         if this transliterator uses no filter.
      * @stable ICU 2.0
      */
     const UnicodeFilter* getFilter(void) const;
 
     /**
-     * Returns the filter used by this transliterator, or <tt>NULL</tt> if this
+     * Returns the filter used by this transliterator, or <tt>nullptr</tt> if this
      * transliterator uses no filter.  The caller must eventually delete the
      * result.  After this call, this transliterator's filter is set to
-     * <tt>NULL</tt>.
-     * @return the filter used by this transliterator, or <tt>NULL</tt> if this
+     * <tt>nullptr</tt>.
+     * @return the filter used by this transliterator, or <tt>nullptr</tt> if this
      *         transliterator uses no filter.
      * @stable ICU 2.4
      */
index 6db8477026a931b03defba33d0923d606b4806e7..4bd80e0e343ea1665f55e583c18b685dca3589b3 100644 (file)
@@ -530,14 +530,14 @@ public:
      * @param date The date.
      * @param name Receives the display name.
      * @param timeType the output argument for receiving the time type (standard/daylight/unknown)
-     * used for the display name, or NULL if the information is not necessary.
+     * used for the display name, or nullptr if the information is not necessary.
      * @return A reference to the result
      * @see #UTimeZoneFormatStyle
      * @see #UTimeZoneFormatTimeType
      * @stable ICU 50
      */
     virtual UnicodeString& format(UTimeZoneFormatStyle style, const TimeZone& tz, UDate date,
-        UnicodeString& name, UTimeZoneFormatTimeType* timeType = NULL) const;
+        UnicodeString& name, UTimeZoneFormatTimeType* timeType = nullptr) const;
 
     /**
      * Returns offset from GMT(UTC) in milliseconds for the given ISO 8601
@@ -592,7 +592,7 @@ public:
      * @param pos The position.
      * @param parseOptions The parse options represented by bitwise flags of UTimeZoneFormatParseOption.
      * @param timeType The output argument for receiving the time type (standard/daylight/unknown),
-     * or NULL if the information is not necessary.
+     * or nullptr if the information is not necessary.
      * @return A <code>TimeZone</code>, or null if the input could not be parsed.
      * @see UTimeZoneFormatStyle
      * @see UTimeZoneFormatParseOption
@@ -600,7 +600,7 @@ public:
      * @stable ICU 50
      */
     virtual TimeZone* parse(UTimeZoneFormatStyle style, const UnicodeString& text, ParsePosition& pos,
-        int32_t parseOptions, UTimeZoneFormatTimeType* timeType = NULL) const;
+        int32_t parseOptions, UTimeZoneFormatTimeType* timeType = nullptr) const;
 
     /**
      * Returns a <code>TimeZone</code> by parsing the time zone string according to
@@ -610,7 +610,7 @@ public:
      * @param style The format style
      * @param pos The position.
      * @param timeType The output argument for receiving the time type (standard/daylight/unknown),
-     * or NULL if the information is not necessary.
+     * or nullptr if the information is not necessary.
      * @return A <code>TimeZone</code>, or null if the input could not be parsed.
      * @see UTimeZoneFormatStyle
      * @see UTimeZoneFormatParseOption
@@ -618,7 +618,7 @@ public:
      * @stable ICU 50
      */
     TimeZone* parse(UTimeZoneFormatStyle style, const UnicodeString& text, ParsePosition& pos,
-        UTimeZoneFormatTimeType* timeType = NULL) const;
+        UTimeZoneFormatTimeType* timeType = nullptr) const;
 
     /* ----------------------------------------------
      * Format APIs
@@ -646,7 +646,7 @@ public:
      * @param parse_pos The position to start parsing at. Upon return this param is set to the position after the
      *                  last character successfully parsed. If the source is not parsed successfully, this param
      *                  will remain unchanged.
-     * @return A newly created Formattable* object, or NULL on failure.  The caller owns this and should
+     * @return A newly created Formattable* object, or nullptr on failure.  The caller owns this and should
      *                 delete it when done.
      * @stable ICU 50
      */
@@ -783,7 +783,7 @@ private:
      * @param required the required set of fields, such as FIELDS_HM
      * @param status U_ILLEGAL_ARGUMENT is set when the specified pattern does not contain
      *               pattern letters for the required fields.
-     * @return A list of GMTOffsetField objects, or NULL on error.
+     * @return A list of GMTOffsetField objects, or nullptr on error.
      */
     static UVector* parseOffsetPattern(const UnicodeString& pattern, OffsetFields required, UErrorCode& status);
 
@@ -856,7 +856,7 @@ private:
      *      time zone string.
      */
     int32_t parseOffsetISO8601(const UnicodeString& text, ParsePosition& pos, UBool extendedOnly,
-        UBool* hasDigitOffset = NULL) const;
+        UBool* hasDigitOffset = nullptr) const;
 
     /**
      * Appends localized digits to the buffer.
index b32e9562d5e66330dbcf099e4970c620dcb92a31..2b494734b739aa5284753dc0a5733a7732fbc07e 100644 (file)
@@ -402,7 +402,7 @@ public:
      * @param types The set of name types represented by bitwise flags of UTimeZoneNameType enums,
      *              or UTZNM_UNKNOWN for all name types.
      * @param status Receives the status.
-     * @return A collection of matches (owned by the caller), or NULL if no matches are found.
+     * @return A collection of matches (owned by the caller), or nullptr if no matches are found.
      * @see UTimeZoneNameType
      * @see MatchInfoCollection
      * @internal
index 0aa887b70661bbf087c1bb48d70ae78ffdbe2369..442655bb54bdb06ebe9080370cf3238049879dca 100644 (file)
@@ -1433,7 +1433,7 @@ uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status);
  * @param position  Deprecated in ICU 51.  Always returns zero.
  *                Originally, an out parameter for the index of the first
  *                string position that failed a check.
- *                This parameter may be NULL.
+ *                This parameter may be nullptr.
  * @param status  The error code, set if an error occurred while attempting to
  *                perform the check.
  *                Spoofing or security issues detected with the input string are
@@ -1460,7 +1460,7 @@ uspoof_checkUnicodeString(const USpoofChecker *sc,
  * @param sc      The USpoofChecker
  * @param id      A identifier to be checked for possible security issues.
  * @param checkResult  An instance of USpoofCheckResult to be filled with
- *                details about the identifier.  Can be NULL.
+ *                details about the identifier.  Can be nullptr.
  * @param status  The error code, set if an error occurred while attempting to
  *                perform the check.
  *                Spoofing or security issues detected with the input string are
index 487810dd5aea6a248da5992d49d0002000afaa0f..93f4ecb93958fb12a011b53735d90ffbdc87b370 100644 (file)
@@ -88,7 +88,7 @@ public:
      * Create a <code>VTimeZone</code> instance by the time zone ID.
      * @param ID The time zone ID, such as America/New_York
      * @return A <code>VTimeZone</code> object initialized by the time zone ID,
-     * or NULL when the ID is unknown.
+     * or nullptr when the ID is unknown.
      * @stable ICU 3.8
      */
     static VTimeZone* createVTimeZoneByID(const UnicodeString& ID);
@@ -109,7 +109,7 @@ public:
      * @param vtzdata The string including VTIMEZONE data block
      * @param status Output param to filled in with a success or an error.
      * @return A <code>VTimeZone</code> initialized by the VTIMEZONE data or
-     * NULL if failed to load the rule from the VTIMEZONE data.
+     * nullptr if failed to load the rule from the VTIMEZONE data.
      * @stable ICU 3.8
      */
     static VTimeZone* createVTimeZone(const UnicodeString& vtzdata, UErrorCode& status);
@@ -359,7 +359,7 @@ public:
     /**
      * Gets the <code>InitialTimeZoneRule</code> and the set of <code>TimeZoneRule</code>
      * which represent time transitions for this time zone.  On successful return,
-     * the argument initial points to non-NULL <code>InitialTimeZoneRule</code> and
+     * the argument initial points to non-nullptr <code>InitialTimeZoneRule</code> and
      * the array trsrules is filled with 0 or multiple <code>TimeZoneRule</code>
      * instances up to the size specified by trscount.  The results are referencing the
      * rule instance held by this time zone instance.  Therefore, after this time zone
index 1456af4d0533a2ae28fc821b777182484a53e6b5..eacfa03fbf7e80ce727f50b7448640aefdc29178 100644 (file)
@@ -368,7 +368,7 @@ int32_t UnitPreferenceMetadata::compareTo(const UnitPreferenceMetadata &other, b
 
 // TODO: this may be unnecessary. Fold into ConversionRates class? Or move to anonymous namespace?
 void U_I18N_API getAllConversionRates(MaybeStackVector<ConversionRateInfo> &result, UErrorCode &status) {
-    LocalUResourceBundlePointer unitsBundle(ures_openDirect(NULL, "units", &status));
+    LocalUResourceBundlePointer unitsBundle(ures_openDirect(nullptr, "units", &status));
     ConversionRateDataSink sink(&result);
     ures_getAllItemsWithFallback(unitsBundle.getAlias(), "convertUnits", sink, status);
 }
@@ -384,7 +384,7 @@ const ConversionRateInfo *ConversionRates::extractConversionInfo(StringPiece sou
 }
 
 U_I18N_API UnitPreferences::UnitPreferences(UErrorCode &status) {
-    LocalUResourceBundlePointer unitsBundle(ures_openDirect(NULL, "units", &status));
+    LocalUResourceBundlePointer unitsBundle(ures_openDirect(nullptr, "units", &status));
     UnitPreferencesSink sink(&unitPrefs_, &metadata_);
     ures_getAllItemsWithFallback(unitsBundle.getAlias(), "unitPreferenceData", sink, status);
 }
index d2ba7ae3a2d6e093e823e1fd60dba72aa9665f8a..77c12088c9a9b1a758d68853041ea67cf99738b7 100644 (file)
@@ -45,10 +45,10 @@ unum_open(  UNumberFormatStyle    style,
             UParseError*       parseErr,
             UErrorCode*        status) {
     if(U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
 
-    NumberFormat *retVal = NULL;
+    NumberFormat *retVal = nullptr;
 
     switch(style) {
     case UNUM_DECIMAL:
@@ -69,22 +69,22 @@ unum_open(  UNumberFormatStyle    style,
         /* UnicodeString can handle the case when patternLength = -1. */
         const UnicodeString pat(pattern, patternLength);
 
-        if(parseErr==NULL){
+        if(parseErr==nullptr){
             parseErr = &tErr;
         }
 
         DecimalFormatSymbols *syms = new DecimalFormatSymbols(Locale(locale), *status);
-        if(syms == NULL) {
+        if(syms == nullptr) {
             *status = U_MEMORY_ALLOCATION_ERROR;
-            return NULL;
+            return nullptr;
         }
         if (U_FAILURE(*status)) {
             delete syms;
-            return NULL;
+            return nullptr;
         }
 
         retVal = new DecimalFormat(pat, syms, *parseErr, *status);
-        if(retVal == NULL) {
+        if(retVal == nullptr) {
             delete syms;
         }
     } break;
@@ -95,7 +95,7 @@ unum_open(  UNumberFormatStyle    style,
         /* UnicodeString can handle the case when patternLength = -1. */
         const UnicodeString pat(pattern, patternLength);
         
-        if(parseErr==NULL){
+        if(parseErr==nullptr){
             parseErr = &tErr;
         }
         
@@ -125,16 +125,16 @@ unum_open(  UNumberFormatStyle    style,
 
     default:
         *status = U_UNSUPPORTED_ERROR;
-        return NULL;
+        return nullptr;
     }
 
-    if(retVal == NULL && U_SUCCESS(*status)) {
+    if(retVal == nullptr && U_SUCCESS(*status)) {
         *status = U_MEMORY_ALLOCATION_ERROR;
     }
 
-    if (U_FAILURE(*status) && retVal != NULL) {
+    if (U_FAILURE(*status) && retVal != nullptr) {
         delete retVal;
-        retVal = NULL;
+        retVal = nullptr;
     }
 
     return reinterpret_cast<UNumberFormat *>(retVal);
@@ -156,11 +156,11 @@ unum_clone(const UNumberFormat *fmt,
     Format *res = 0;
     const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt);
     const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(nf);
-    if (df != NULL) {
+    if (df != nullptr) {
         res = df->clone();
     } else {
         const RuleBasedNumberFormat* rbnf = dynamic_cast<const RuleBasedNumberFormat*>(nf);
-        U_ASSERT(rbnf != NULL);
+        U_ASSERT(rbnf != nullptr);
         res = rbnf->clone();
     }
 
@@ -195,8 +195,8 @@ unum_formatInt64(const UNumberFormat* fmt,
         return -1;
     
     UnicodeString res;
-    if(!(result==NULL && resultLength==0)) {
-        // NULL destination for pure preflighting: empty dummy string
+    if(!(result==nullptr && resultLength==0)) {
+        // nullptr destination for pure preflighting: empty dummy string
         // otherwise, alias the destination buffer
         res.setTo(result, 0, resultLength);
     }
@@ -228,8 +228,8 @@ unum_formatDouble(    const    UNumberFormat*  fmt,
   if(U_FAILURE(*status)) return -1;
 
   UnicodeString res;
-  if(!(result==NULL && resultLength==0)) {
-    // NULL destination for pure preflighting: empty dummy string
+  if(!(result==nullptr && resultLength==0)) {
+    // nullptr destination for pure preflighting: empty dummy string
     // otherwise, alias the destination buffer
     res.setTo(result, 0, resultLength);
   }
@@ -260,14 +260,14 @@ unum_formatDoubleForFields(const UNumberFormat* format,
     if (U_FAILURE(*status))
         return -1;
 
-    if (result == NULL ? resultLength != 0 : resultLength < 0) {
+    if (result == nullptr ? resultLength != 0 : resultLength < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return -1;
     }
 
     UnicodeString res;
-    if (result != NULL) {
-        // NULL destination for pure preflighting: empty dummy string
+    if (result != nullptr) {
+        // nullptr destination for pure preflighting: empty dummy string
         // otherwise, alias the destination buffer
         res.setTo(result, 0, resultLength);
     }
@@ -289,7 +289,7 @@ unum_formatDecimal(const    UNumberFormat*  fmt,
     if(U_FAILURE(*status)) {
         return -1;
     }
-    if ((result == NULL && resultLength != 0) || resultLength < 0) {
+    if ((result == nullptr && resultLength != 0) || resultLength < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return -1;
     }
@@ -332,8 +332,8 @@ unum_formatDoubleCurrency(const UNumberFormat* fmt,
     if (U_FAILURE(*status)) return -1;
 
     UnicodeString res;
-    if (!(result==NULL && resultLength==0)) {
-        // NULL destination for pure preflighting: empty dummy string
+    if (!(result==nullptr && resultLength==0)) {
+        // nullptr destination for pure preflighting: empty dummy string
         // otherwise, alias the destination buffer
         res.setTo(result, 0, resultLength);
     }
@@ -344,7 +344,7 @@ unum_formatDoubleCurrency(const UNumberFormat* fmt,
     }
     CurrencyAmount *tempCurrAmnt = new CurrencyAmount(number, currency, *status);
     // Check for null pointer.
-    if (tempCurrAmnt == NULL) {
+    if (tempCurrAmnt == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
         return -1;
     }
@@ -436,7 +436,7 @@ unum_parseDecimal(const UNumberFormat*  fmt,
     if (U_FAILURE(*status)) {
         return -1;
     }
-    if ((outBuf == NULL && outBufLength != 0) || outBufLength < 0) {
+    if ((outBuf == nullptr && outBufLength != 0) || outBufLength < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return -1;
     }
@@ -471,17 +471,17 @@ unum_parseDoubleCurrency(const UNumberFormat* fmt,
     }
     const UnicodeString src((UBool)(textLength == -1), text, textLength);
     ParsePosition pp;
-    if (parsePos != NULL) {
+    if (parsePos != nullptr) {
         pp.setIndex(*parsePos);
     }
     *status = U_PARSE_ERROR; // assume failure, reset if succeed
     LocalPointer<CurrencyAmount> currAmt(((const NumberFormat*)fmt)->parseCurrency(src, pp));
     if (pp.getErrorIndex() != -1) {
-        if (parsePos != NULL) {
+        if (parsePos != nullptr) {
             *parsePos = pp.getErrorIndex();
         }
     } else {
-        if (parsePos != NULL) {
+        if (parsePos != nullptr) {
             *parsePos = pp.getIndex();
         }
         if (pp.getIndex() > 0) {
@@ -510,7 +510,7 @@ unum_hasAttribute(const UNumberFormat*          fmt,
           UNumberFormatAttribute  attr)
 {
     const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt);
-    bool isDecimalFormat = dynamic_cast<const DecimalFormat*>(nf) != NULL;
+    bool isDecimalFormat = dynamic_cast<const DecimalFormat*>(nf) != nullptr;
     
     switch (attr) {
         case UNUM_LENIENT_PARSE:
@@ -562,7 +562,7 @@ unum_getAttribute(const UNumberFormat*          fmt,
 
     // The remaining attributes are only supported for DecimalFormat
     const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(nf);
-    if (df != NULL) {
+    if (df != nullptr) {
         UErrorCode ignoredStatus = U_ZERO_ERROR;
         return df->getAttribute(attr, ignoredStatus);
     }
@@ -607,7 +607,7 @@ unum_setAttribute(    UNumberFormat*          fmt,
 
     // The remaining attributes are only supported for DecimalFormat
     DecimalFormat* df = dynamic_cast<DecimalFormat*>(nf);
-    if (df != NULL) {
+    if (df != nullptr) {
         UErrorCode ignoredStatus = U_ZERO_ERROR;
         df->setAttribute(attr, newValue, ignoredStatus);
     }
@@ -619,7 +619,7 @@ unum_getDoubleAttribute(const UNumberFormat*          fmt,
 {
     const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt);
     const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(nf);
-    if (df != NULL &&  attr == UNUM_ROUNDING_INCREMENT) {
+    if (df != nullptr &&  attr == UNUM_ROUNDING_INCREMENT) {
         return df->getRoundingIncrement();
     } else {
         return -1.0;
@@ -633,7 +633,7 @@ unum_setDoubleAttribute(    UNumberFormat*          fmt,
 {
     NumberFormat* nf = reinterpret_cast<NumberFormat*>(fmt);
     DecimalFormat* df = dynamic_cast<DecimalFormat*>(nf);
-    if (df != NULL && attr == UNUM_ROUNDING_INCREMENT) {   
+    if (df != nullptr && attr == UNUM_ROUNDING_INCREMENT) {   
         df->setRoundingIncrement(newValue);
     }
 }
@@ -649,15 +649,15 @@ unum_getTextAttribute(const UNumberFormat*  fmt,
         return -1;
 
     UnicodeString res;
-    if(!(result==NULL && resultLength==0)) {
-        // NULL destination for pure preflighting: empty dummy string
+    if(!(result==nullptr && resultLength==0)) {
+        // nullptr destination for pure preflighting: empty dummy string
         // otherwise, alias the destination buffer
         res.setTo(result, 0, resultLength);
     }
 
     const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt);
     const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(nf);
-    if (df != NULL) {
+    if (df != nullptr) {
         switch(tag) {
         case UNUM_POSITIVE_PREFIX:
             df->getPositivePrefix(res);
@@ -689,7 +689,7 @@ unum_getTextAttribute(const UNumberFormat*  fmt,
         }
     } else {
         const RuleBasedNumberFormat* rbnf = dynamic_cast<const RuleBasedNumberFormat*>(nf);
-        U_ASSERT(rbnf != NULL);
+        U_ASSERT(rbnf != nullptr);
         if (tag == UNUM_DEFAULT_RULESET) {
             res = rbnf->getDefaultRuleSetName();
         } else if (tag == UNUM_PUBLIC_RULESETS) {
@@ -720,7 +720,7 @@ unum_setTextAttribute(    UNumberFormat*                    fmt,
     UnicodeString val(newValue, newValueLength);
     NumberFormat* nf = reinterpret_cast<NumberFormat*>(fmt);
     DecimalFormat* df = dynamic_cast<DecimalFormat*>(nf);
-    if (df != NULL) {
+    if (df != nullptr) {
       switch(tag) {
       case UNUM_POSITIVE_PREFIX:
         df->setPositivePrefix(val);
@@ -752,7 +752,7 @@ unum_setTextAttribute(    UNumberFormat*                    fmt,
       }
     } else {
       RuleBasedNumberFormat* rbnf = dynamic_cast<RuleBasedNumberFormat*>(nf);
-      U_ASSERT(rbnf != NULL);
+      U_ASSERT(rbnf != nullptr);
       if (tag == UNUM_DEFAULT_RULESET) {
         rbnf->setDefaultRuleSet(val, *status);
       } else {
@@ -772,22 +772,22 @@ unum_toPattern(    const    UNumberFormat*          fmt,
         return -1;
     
     UnicodeString pat;
-    if(!(result==NULL && resultLength==0)) {
-        // NULL destination for pure preflighting: empty dummy string
+    if(!(result==nullptr && resultLength==0)) {
+        // nullptr destination for pure preflighting: empty dummy string
         // otherwise, alias the destination buffer
         pat.setTo(result, 0, resultLength);
     }
 
     const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt);
     const DecimalFormat* df = dynamic_cast<const DecimalFormat*>(nf);
-    if (df != NULL) {
+    if (df != nullptr) {
       if(isPatternLocalized)
         df->toLocalizedPattern(pat);
       else
         df->toPattern(pat);
     } else {
       const RuleBasedNumberFormat* rbnf = dynamic_cast<const RuleBasedNumberFormat*>(nf);
-      U_ASSERT(rbnf != NULL);
+      U_ASSERT(rbnf != nullptr);
       pat = rbnf->getRules();
     }
     return pat.extract(result, resultLength, *status);
@@ -800,16 +800,16 @@ unum_getSymbol(const UNumberFormat *fmt,
                int32_t size,
                UErrorCode *status)
 {
-    if(status==NULL || U_FAILURE(*status)) {
+    if(status==nullptr || U_FAILURE(*status)) {
         return 0;
     }
-    if(fmt==NULL || symbol< 0 || symbol>=UNUM_FORMAT_SYMBOL_COUNT) {
+    if(fmt==nullptr || symbol< 0 || symbol>=UNUM_FORMAT_SYMBOL_COUNT) {
         *status=U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
     const NumberFormat *nf = reinterpret_cast<const NumberFormat *>(fmt);
     const DecimalFormat *dcf = dynamic_cast<const DecimalFormat *>(nf);
-    if (dcf == NULL) {
+    if (dcf == nullptr) {
       *status = U_UNSUPPORTED_ERROR;
       return 0;
     }
@@ -827,16 +827,16 @@ unum_setSymbol(UNumberFormat *fmt,
                int32_t length,
                UErrorCode *status)
 {
-    if(status==NULL || U_FAILURE(*status)) {
+    if(status==nullptr || U_FAILURE(*status)) {
         return;
     }
-    if(fmt==NULL || symbol< 0 || symbol>=UNUM_FORMAT_SYMBOL_COUNT || value==NULL || length<-1) {
+    if(fmt==nullptr || symbol< 0 || symbol>=UNUM_FORMAT_SYMBOL_COUNT || value==nullptr || length<-1) {
         *status=U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
     NumberFormat *nf = reinterpret_cast<NumberFormat *>(fmt);
     DecimalFormat *dcf = dynamic_cast<DecimalFormat *>(nf);
-    if (dcf == NULL) {
+    if (dcf == nullptr) {
       *status = U_UNSUPPORTED_ERROR;
       return;
     }
@@ -858,11 +858,11 @@ unum_applyPattern(  UNumberFormat  *fmt,
     UErrorCode tStatus = U_ZERO_ERROR;
     UParseError tParseError;
     
-    if(parseError == NULL){
+    if(parseError == nullptr){
         parseError = &tParseError;
     }
     
-    if(status==NULL){
+    if(status==nullptr){
         status = &tStatus;
     }
     
@@ -872,7 +872,7 @@ unum_applyPattern(  UNumberFormat  *fmt,
     // Verify if the object passed is a DecimalFormat object
     NumberFormat* nf = reinterpret_cast<NumberFormat*>(fmt);
     DecimalFormat* df = dynamic_cast<DecimalFormat*>(nf);
-    if (df != NULL) {
+    if (df != nullptr) {
       if(localized) {
         df->applyLocalizedPattern(pat,*parseError, *status);
       } else {
@@ -889,11 +889,11 @@ unum_getLocaleByType(const UNumberFormat *fmt,
                      ULocDataLocaleType type,
                      UErrorCode* status)
 {
-    if (fmt == NULL) {
+    if (fmt == nullptr) {
         if (U_SUCCESS(*status)) {
             *status = U_ILLEGAL_ARGUMENT_ERROR;
         }
-        return NULL;
+        return nullptr;
     }
     return ((const Format*)fmt)->getLocaleID(type, *status);
 }
@@ -924,19 +924,19 @@ unum_parseToUFormattable(const UNumberFormat* fmt,
                          int32_t textLength,
                          int32_t* parsePos, /* 0 = start */
                          UErrorCode* status) {
-  UFormattable *newFormattable = NULL;
+  UFormattable *newFormattable = nullptr;
   if (U_FAILURE(*status)) return result;
-  if (fmt == NULL || (text==NULL && textLength!=0)) {
+  if (fmt == nullptr || (text==nullptr && textLength!=0)) {
     *status = U_ILLEGAL_ARGUMENT_ERROR;
     return result;
   }
-  if (result == NULL) { // allocate if not allocated.
+  if (result == nullptr) { // allocate if not allocated.
     newFormattable = result = ufmt_open(status);
   }
   parseRes(*(Formattable::fromUFormattable(result)), fmt, text, textLength, parsePos, status);
-  if (U_FAILURE(*status) && newFormattable != NULL) {
+  if (U_FAILURE(*status) && newFormattable != nullptr) {
     ufmt_close(newFormattable);
-    result = NULL; // deallocate if there was a parse error
+    result = nullptr; // deallocate if there was a parse error
   }
   return result;
 }
@@ -951,8 +951,8 @@ unum_formatUFormattable(const UNumberFormat* fmt,
     if (U_FAILURE(*status)) {
       return 0;
     }
-    if (fmt == NULL || number==NULL ||
-        (result==NULL ? resultLength!=0 : resultLength<0)) {
+    if (fmt == nullptr || number==nullptr ||
+        (result==nullptr ? resultLength!=0 : resultLength<0)) {
       *status = U_ILLEGAL_ARGUMENT_ERROR;
       return 0;
     }
index 4a0d0fa3b6f3473339926fe3790cdcc831da17b6..21898c23cd75544d126a0aabe432b119da314390 100644 (file)
@@ -31,7 +31,7 @@ unumsys_openByName(const char *name, UErrorCode *status)
 {
     // createInstanceByName does NOT return immediately if status indicates error
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
     return (UNumberingSystem*)NumberingSystem::createInstanceByName(name, *status);
 }
index 73e59a75c4d016593439edc8cd212596b2a76f37..270fd6ccab08dc213cb3c23917f0d7ce462a1599 100644 (file)
@@ -41,7 +41,7 @@ namespace {
 UnicodeString select(const PluralRules &rules, const Formattable& obj, const NumberFormat& fmt, UErrorCode& status) {
     if (U_SUCCESS(status)) {
         const DecimalFormat *decFmt = dynamic_cast<const DecimalFormat *>(&fmt);
-        if (decFmt != NULL) {
+        if (decFmt != nullptr) {
             number::impl::DecimalQuantity dq;
             decFmt->formatToDecimalQuantity(obj, dq, status);
             if (U_SUCCESS(status)) {
@@ -86,7 +86,7 @@ uplrules_select(const UPluralRules *uplrules,
     if (U_FAILURE(*status)) {
         return 0;
     }
-    if (keyword == NULL ? capacity != 0 : capacity < 0) {
+    if (keyword == nullptr ? capacity != 0 : capacity < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -103,7 +103,7 @@ uplrules_selectFormatted(const UPluralRules *uplrules,
     if (U_FAILURE(*status)) {
         return 0;
     }
-    if (keyword == NULL ? capacity != 0 : capacity < 0) {
+    if (keyword == nullptr ? capacity != 0 : capacity < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -125,7 +125,7 @@ uplrules_selectForRange(const UPluralRules *uplrules,
     if (U_FAILURE(*status)) {
         return 0;
     }
-    if (keyword == NULL ? capacity != 0 : capacity < 0) {
+    if (keyword == nullptr ? capacity != 0 : capacity < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -147,7 +147,7 @@ uplrules_selectWithFormat(const UPluralRules *uplrules,
     }
     const PluralRules* plrules = reinterpret_cast<const PluralRules*>(uplrules);
     const NumberFormat* nf = reinterpret_cast<const NumberFormat*>(fmt);
-    if (plrules == NULL || nf == NULL || ((keyword == NULL)? capacity != 0 : capacity < 0)) {
+    if (plrules == nullptr || nf == nullptr || ((keyword == nullptr)? capacity != 0 : capacity < 0)) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -161,20 +161,20 @@ uplrules_getKeywords(const UPluralRules *uplrules,
                      UErrorCode *status)
 {
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
     const PluralRules* plrules = reinterpret_cast<const PluralRules*>(uplrules);
-    if (plrules == NULL) {
+    if (plrules == nullptr) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     StringEnumeration *senum = plrules->getKeywords(*status);
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
-    if (senum == NULL) {
+    if (senum == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     return uenum_openFromStringEnumeration(senum, status);
 }
index dd2ad2a81e864a98286b420d197dd127c2dae46c..6a8cab9c86a0f9259be5f132b8ae7e88000a3306 100644 (file)
@@ -51,25 +51,25 @@ static const int32_t REXP_MAGIC = 0x72657870; // "rexp" in ASCII
 
 RegularExpression::RegularExpression() {
     fMagic        = REXP_MAGIC;
-    fPat          = NULL;
-    fPatRefCount  = NULL;
-    fPatString    = NULL;
+    fPat          = nullptr;
+    fPatRefCount  = nullptr;
+    fPatString    = nullptr;
     fPatStringLen = 0;
-    fMatcher      = NULL;
-    fText         = NULL;
+    fMatcher      = nullptr;
+    fText         = nullptr;
     fTextLength   = 0;
     fOwnsText     = false;
 }
 
 RegularExpression::~RegularExpression() {
     delete fMatcher;
-    fMatcher = NULL;
-    if (fPatRefCount!=NULL && umtx_atomic_dec(fPatRefCount)==0) {
+    fMatcher = nullptr;
+    if (fPatRefCount!=nullptr && umtx_atomic_dec(fPatRefCount)==0) {
         delete fPat;
         uprv_free(fPatString);
         uprv_free((void *)fPatRefCount);
     }
-    if (fOwnsText && fText!=NULL) {
+    if (fOwnsText && fText!=nullptr) {
         uprv_free((void *)fText);
     }
     fMagic = 0;
@@ -88,12 +88,12 @@ static UBool validateRE(const RegularExpression *re, UBool requiresText, UErrorC
     if (U_FAILURE(*status)) {
         return false;
     }
-    if (re == NULL || re->fMagic != REXP_MAGIC) {
+    if (re == nullptr || re->fMagic != REXP_MAGIC) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return false;
     }
     // !!! Not sure how to update this with the new UText backing, which is stored in re->fMatcher anyway
-    if (requiresText && re->fText == NULL && !re->fOwnsText) {
+    if (requiresText && re->fText == nullptr && !re->fOwnsText) {
         *status = U_REGEX_INVALID_STATE;
         return false;
     }
@@ -113,11 +113,11 @@ uregex_open( const  UChar          *pattern,
                     UErrorCode     *status) {
 
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
-    if (pattern == NULL || patternLength < -1 || patternLength == 0) {
+    if (pattern == nullptr || patternLength < -1 || patternLength == 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     int32_t actualPatLen = patternLength;
     if (actualPatLen == -1) {
@@ -127,12 +127,12 @@ uregex_open( const  UChar          *pattern,
     RegularExpression  *re     = new RegularExpression;
     u_atomic_int32_t   *refC   = (u_atomic_int32_t *)uprv_malloc(sizeof(int32_t));
     UChar              *patBuf = (UChar *)uprv_malloc(sizeof(UChar)*(actualPatLen+1));
-    if (re == NULL || refC == NULL || patBuf == NULL) {
+    if (re == nullptr || refC == nullptr || patBuf == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
         delete re;
         uprv_free((void *)refC);
         uprv_free(patBuf);
-        return NULL;
+        return nullptr;
     }
     re->fPatRefCount = refC;
     *re->fPatRefCount = 1;
@@ -153,7 +153,7 @@ uregex_open( const  UChar          *pattern,
     //
     // Compile the pattern
     //
-    if (pe != NULL) {
+    if (pe != nullptr) {
         re->fPat = RegexPattern::compile(&patText, flags, *pe, *status);
     } else {
         re->fPat = RegexPattern::compile(&patText, flags, *status);
@@ -174,7 +174,7 @@ uregex_open( const  UChar          *pattern,
 
 ErrorExit:
     delete re;
-    return NULL;
+    return nullptr;
 
 }
 
@@ -190,33 +190,33 @@ uregex_openUText(UText          *pattern,
                  UErrorCode     *status) {
 
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
-    if (pattern == NULL) {
+    if (pattern == nullptr) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     int64_t patternNativeLength = utext_nativeLength(pattern);
 
     if (patternNativeLength == 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     RegularExpression *re     = new RegularExpression;
 
     UErrorCode lengthStatus = U_ZERO_ERROR;
-    int32_t pattern16Length = utext_extract(pattern, 0, patternNativeLength, NULL, 0, &lengthStatus);
+    int32_t pattern16Length = utext_extract(pattern, 0, patternNativeLength, nullptr, 0, &lengthStatus);
 
     u_atomic_int32_t   *refC   = (u_atomic_int32_t *)uprv_malloc(sizeof(int32_t));
     UChar              *patBuf = (UChar *)uprv_malloc(sizeof(UChar)*(pattern16Length+1));
-    if (re == NULL || refC == NULL || patBuf == NULL) {
+    if (re == nullptr || refC == nullptr || patBuf == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
         delete re;
         uprv_free((void *)refC);
         uprv_free(patBuf);
-        return NULL;
+        return nullptr;
     }
     re->fPatRefCount = refC;
     *re->fPatRefCount = 1;
@@ -236,7 +236,7 @@ uregex_openUText(UText          *pattern,
     //
     // Compile the pattern
     //
-    if (pe != NULL) {
+    if (pe != nullptr) {
         re->fPat = RegexPattern::compile(&patText, flags, *pe, *status);
     } else {
         re->fPat = RegexPattern::compile(&patText, flags, *status);
@@ -257,7 +257,7 @@ uregex_openUText(UText          *pattern,
 
 ErrorExit:
     delete re;
-    return NULL;
+    return nullptr;
 
 }
 
@@ -286,19 +286,19 @@ U_CAPI URegularExpression * U_EXPORT2
 uregex_clone(const URegularExpression *source2, UErrorCode *status)  {
     RegularExpression *source = (RegularExpression*)source2;
     if (validateRE(source, false, status) == false) {
-        return NULL;
+        return nullptr;
     }
 
     RegularExpression *clone = new RegularExpression;
-    if (clone == NULL) {
+    if (clone == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     clone->fMatcher = source->fPat->matcher(*status);
     if (U_FAILURE(*status)) {
         delete clone;
-        return NULL;
+        return nullptr;
     }
 
     clone->fPat          = source->fPat;
@@ -326,9 +326,9 @@ uregex_pattern(const  URegularExpression *regexp2,
     RegularExpression *regexp = (RegularExpression*)regexp2;
 
     if (validateRE(regexp, false, status) == false) {
-        return NULL;
+        return nullptr;
     }
-    if (patLength != NULL) {
+    if (patLength != nullptr) {
         *patLength = regexp->fPatStringLen;
     }
     return regexp->fPatString;
@@ -378,12 +378,12 @@ uregex_setText(URegularExpression *regexp2,
     if (validateRE(regexp, false, status) == false) {
         return;
     }
-    if (text == NULL || textLength < -1) {
+    if (text == nullptr || textLength < -1) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
 
-    if (regexp->fOwnsText && regexp->fText != NULL) {
+    if (regexp->fOwnsText && regexp->fText != nullptr) {
         uprv_free((void *)regexp->fText);
     }
 
@@ -411,16 +411,16 @@ uregex_setUText(URegularExpression *regexp2,
     if (validateRE(regexp, false, status) == false) {
         return;
     }
-    if (text == NULL) {
+    if (text == nullptr) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
 
-    if (regexp->fOwnsText && regexp->fText != NULL) {
+    if (regexp->fOwnsText && regexp->fText != nullptr) {
         uprv_free((void *)regexp->fText);
     }
 
-    regexp->fText       = NULL; // only fill it in on request
+    regexp->fText       = nullptr; // only fill it in on request
     regexp->fTextLength = -1;
     regexp->fOwnsText   = true;
     regexp->fMatcher->reset(text);
@@ -439,10 +439,10 @@ uregex_getText(URegularExpression *regexp2,
                UErrorCode         *status)  {
     RegularExpression *regexp = (RegularExpression*)regexp2;
     if (validateRE(regexp, false, status) == false) {
-        return NULL;
+        return nullptr;
     }
 
-    if (regexp->fText == NULL) {
+    if (regexp->fText == nullptr) {
         // need to fill in the text
         UText *inputText = regexp->fMatcher->inputText();
         int64_t inputNativeLength = utext_nativeLength(inputText);
@@ -452,7 +452,7 @@ uregex_getText(URegularExpression *regexp2,
             regexp->fOwnsText = false; // because the UText owns it
         } else {
             UErrorCode lengthStatus = U_ZERO_ERROR;
-            regexp->fTextLength = utext_extract(inputText, 0, inputNativeLength, NULL, 0, &lengthStatus); // buffer overflow error
+            regexp->fTextLength = utext_extract(inputText, 0, inputNativeLength, nullptr, 0, &lengthStatus); // buffer overflow error
             UChar *inputChars = (UChar *)uprv_malloc(sizeof(UChar)*(regexp->fTextLength+1));
 
             utext_extract(inputText, 0, inputNativeLength, inputChars, regexp->fTextLength+1, status);
@@ -461,7 +461,7 @@ uregex_getText(URegularExpression *regexp2,
         }
     }
 
-    if (textLength != NULL) {
+    if (textLength != nullptr) {
         *textLength = regexp->fTextLength;
     }
     return regexp->fText;
@@ -672,12 +672,12 @@ uregex_group(URegularExpression *regexp2,
     if (validateRE(regexp, true, status) == false) {
         return 0;
     }
-    if (destCapacity < 0 || (destCapacity > 0 && dest == NULL)) {
+    if (destCapacity < 0 || (destCapacity > 0 && dest == nullptr)) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
 
-    if (destCapacity == 0 || regexp->fText != NULL) {
+    if (destCapacity == 0 || regexp->fText != nullptr) {
         // If preflighting or if we already have the text as UChars,
         // this is a little cheaper than extracting from the UText
 
@@ -741,7 +741,7 @@ uregex_groupUText(URegularExpression *regexp2,
     RegularExpression *regexp = (RegularExpression*)regexp2;
     if (validateRE(regexp, true, status) == false) {
         UErrorCode emptyTextStatus = U_ZERO_ERROR;
-        return (dest ? dest : utext_openUChars(NULL, NULL, 0, &emptyTextStatus));
+        return (dest ? dest : utext_openUChars(nullptr, nullptr, 0, &emptyTextStatus));
     }
 
     return regexp->fMatcher->group(groupNum, dest, *groupLength, *status);
@@ -1158,8 +1158,8 @@ uregex_replaceAll(URegularExpression    *regexp2,
     if (validateRE(regexp, true, status) == false) {
         return 0;
     }
-    if (replacementText == NULL || replacementLength < -1 ||
-        (destBuf == NULL && destCapacity > 0) ||
+    if (replacementText == nullptr || replacementLength < -1 ||
+        (destBuf == nullptr && destCapacity > 0) ||
         destCapacity < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
@@ -1206,7 +1206,7 @@ uregex_replaceAllUText(URegularExpression    *regexp2,
     if (validateRE(regexp, true, status) == false) {
         return 0;
     }
-    if (replacementText == NULL) {
+    if (replacementText == nullptr) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -1232,8 +1232,8 @@ uregex_replaceFirst(URegularExpression  *regexp2,
     if (validateRE(regexp, true, status) == false) {
         return 0;
     }
-    if (replacementText == NULL || replacementLength < -1 ||
-        (destBuf == NULL && destCapacity > 0) ||
+    if (replacementText == nullptr || replacementLength < -1 ||
+        (destBuf == nullptr && destCapacity > 0) ||
         destCapacity < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
@@ -1267,7 +1267,7 @@ uregex_replaceFirstUText(URegularExpression  *regexp2,
     if (validateRE(regexp, true, status) == false) {
         return 0;
     }
-    if (replacementText == NULL) {
+    if (replacementText == nullptr) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -1347,7 +1347,7 @@ int32_t RegexCImpl::appendReplacement(RegularExpression    *regexp,
     //  A series of appendReplacements, appendTail need to correctly preflight
     //  the buffer size when an overflow happens somewhere in the middle.
     UBool pendingBufferOverflow = false;
-    if (*status == U_BUFFER_OVERFLOW_ERROR && destCapacity != NULL && *destCapacity == 0) {
+    if (*status == U_BUFFER_OVERFLOW_ERROR && destCapacity != nullptr && *destCapacity == 0) {
         pendingBufferOverflow = true;
         *status = U_ZERO_ERROR;
     }
@@ -1358,9 +1358,9 @@ int32_t RegexCImpl::appendReplacement(RegularExpression    *regexp,
     if (validateRE(regexp, true, status) == false) {
         return 0;
     }
-    if (replacementText == NULL || replacementLength < -1 ||
-        destCapacity == NULL || destBuf == NULL ||
-        (*destBuf == NULL && *destCapacity > 0) ||
+    if (replacementText == nullptr || replacementLength < -1 ||
+        destCapacity == nullptr || destBuf == nullptr ||
+        (*destBuf == nullptr && *destCapacity > 0) ||
         *destCapacity < 0) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
@@ -1385,7 +1385,7 @@ int32_t RegexCImpl::appendReplacement(RegularExpression    *regexp,
     }
 
     // Copy input string from the end of previous match to start of current match
-    if (regexp->fText != NULL) {
+    if (regexp->fText != nullptr) {
         int32_t matchStart;
         int32_t lastMatchEnd;
         if (UTEXT_USES_U16(m->fInputText)) {
@@ -1394,9 +1394,9 @@ int32_t RegexCImpl::appendReplacement(RegularExpression    *regexp,
         } else {
             // !!!: Would like a better way to do this!
             UErrorCode tempStatus = U_ZERO_ERROR;
-            lastMatchEnd = utext_extract(m->fInputText, 0, m->fLastMatchEnd, NULL, 0, &tempStatus);
+            lastMatchEnd = utext_extract(m->fInputText, 0, m->fLastMatchEnd, nullptr, 0, &tempStatus);
             tempStatus = U_ZERO_ERROR;
-            matchStart = lastMatchEnd + utext_extract(m->fInputText, m->fLastMatchEnd, m->fMatchStart, NULL, 0, &tempStatus);
+            matchStart = lastMatchEnd + utext_extract(m->fInputText, m->fLastMatchEnd, m->fMatchStart, nullptr, 0, &tempStatus);
         }
         for (i=lastMatchEnd; i<matchStart; i++) {
             appendToBuf(regexp->fText[i], &destIdx, dest, capacity);
@@ -1404,7 +1404,7 @@ int32_t RegexCImpl::appendReplacement(RegularExpression    *regexp,
     } else {
         UErrorCode possibleOverflowError = U_ZERO_ERROR; // ignore
         destIdx += utext_extract(m->fInputText, m->fLastMatchEnd, m->fMatchStart,
-                                 dest==NULL?NULL:&dest[destIdx], REMAINING_CAPACITY(destIdx, capacity),
+                                 dest==nullptr?nullptr:&dest[destIdx], REMAINING_CAPACITY(destIdx, capacity),
                                  &possibleOverflowError);
     }
     U_ASSERT(destIdx >= 0);
@@ -1528,7 +1528,7 @@ int32_t RegexCImpl::appendReplacement(RegularExpression    *regexp,
         // Finally, append the capture group data to the destination.
         if (U_SUCCESS(*status)) {
             destIdx += uregex_group((URegularExpression*)regexp, groupNum,
-                                    dest==NULL?NULL:&dest[destIdx], REMAINING_CAPACITY(destIdx, capacity), status);
+                                    dest==nullptr?nullptr:&dest[destIdx], REMAINING_CAPACITY(destIdx, capacity), status);
             if (*status == U_BUFFER_OVERFLOW_ERROR) {
                 // Ignore buffer overflow when extracting the group.  We need to
                 //   continue on to get full size of the untruncated result.  We will
@@ -1624,7 +1624,7 @@ int32_t RegexCImpl::appendTail(RegularExpression    *regexp,
     //  A series of appendReplacements, appendTail need to correctly preflight
     //  the buffer size when an overflow happens somewhere in the middle.
     UBool pendingBufferOverflow = false;
-    if (*status == U_BUFFER_OVERFLOW_ERROR && destCapacity != NULL && *destCapacity == 0) {
+    if (*status == U_BUFFER_OVERFLOW_ERROR && destCapacity != nullptr && *destCapacity == 0) {
         pendingBufferOverflow = true;
         *status = U_ZERO_ERROR;
     }
@@ -1633,8 +1633,8 @@ int32_t RegexCImpl::appendTail(RegularExpression    *regexp,
         return 0;
     }
 
-    if (destCapacity == NULL || destBuf == NULL ||
-        (*destBuf == NULL && *destCapacity > 0) ||
+    if (destCapacity == nullptr || destBuf == nullptr ||
+        (*destBuf == nullptr && *destCapacity > 0) ||
         *destCapacity < 0)
     {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
@@ -1647,7 +1647,7 @@ int32_t RegexCImpl::appendTail(RegularExpression    *regexp,
     int32_t  destCap     = *destCapacity;
     UChar    *dest       = *destBuf;
 
-    if (regexp->fText != NULL) {
+    if (regexp->fText != nullptr) {
         int32_t srcIdx;
         int64_t nativeIdx = (m->fMatch ? m->fMatchEnd : m->fLastMatchEnd);
         if (nativeIdx == -1) {
@@ -1656,7 +1656,7 @@ int32_t RegexCImpl::appendTail(RegularExpression    *regexp,
             srcIdx = (int32_t)nativeIdx;
         } else {
             UErrorCode newStatus = U_ZERO_ERROR;
-            srcIdx = utext_extract(m->fInputText, 0, nativeIdx, NULL, 0, &newStatus);
+            srcIdx = utext_extract(m->fInputText, 0, nativeIdx, nullptr, 0, &newStatus);
         }
 
         for (;;) {
@@ -1723,7 +1723,7 @@ int32_t RegexCImpl::appendTail(RegularExpression    *regexp,
     if (destIdx < destCap) {
         *destBuf      += destIdx;
         *destCapacity -= destIdx;
-    } else if (*destBuf != NULL) {
+    } else if (*destBuf != nullptr) {
         *destBuf      += destCap;
         *destCapacity  = 0;
     }
@@ -1924,10 +1924,10 @@ int32_t RegexCImpl::split(RegularExpression     *regexp,
     // Zero out any unused portion of the destFields array
     int j;
     for (j=i+1; j<destFieldsCapacity; j++) {
-        destFields[j] = NULL;
+        destFields[j] = nullptr;
     }
 
-    if (requiredCapacity != NULL) {
+    if (requiredCapacity != nullptr) {
         *requiredCapacity = destIdx;
     }
     if (destIdx > destCapacity) {
@@ -1951,9 +1951,9 @@ uregex_split(URegularExpression      *regexp2,
     if (validateRE(regexp, true, status) == false) {
         return 0;
     }
-    if ((destBuf == NULL && destCapacity > 0) ||
+    if ((destBuf == nullptr && destCapacity > 0) ||
         destCapacity < 0 ||
-        destFields == NULL ||
+        destFields == nullptr ||
         destFieldsCapacity < 1 ) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
index c7d3bcd2c743fb1865cb7a177c5e12cda6ee12f4..8bdac191147518a06a17103d1b061c36679fffaa 100644 (file)
@@ -29,11 +29,11 @@ uregex_openC( const char           *pattern,
                     UParseError    *pe,
                     UErrorCode     *status) {
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
-    if (pattern == NULL) {
+    if (pattern == nullptr) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     UnicodeString patString(pattern);
index f894dc44cacd7503e0522e42c8d806cbc64a6c0a..c7df63ad902cad014f5b3b646f8d88de061fc760 100644 (file)
@@ -38,9 +38,9 @@ U_NAMESPACE_USE
 //
 // Static Objects used by the spoof impl, their thread safe initialization and their cleanup.
 //
-static UnicodeSet *gInclusionSet = NULL;
-static UnicodeSet *gRecommendedSet = NULL;
-static const Normalizer2 *gNfdNormalizer = NULL;
+static UnicodeSet *gInclusionSet = nullptr;
+static UnicodeSet *gRecommendedSet = nullptr;
+static const Normalizer2 *gNfdNormalizer = nullptr;
 static UInitOnce gSpoofInitStaticsOnce {};
 
 namespace {
@@ -48,10 +48,10 @@ namespace {
 UBool U_CALLCONV
 uspoof_cleanup(void) {
     delete gInclusionSet;
-    gInclusionSet = NULL;
+    gInclusionSet = nullptr;
     delete gRecommendedSet;
-    gRecommendedSet = NULL;
-    gNfdNormalizer = NULL;
+    gRecommendedSet = nullptr;
+    gNfdNormalizer = nullptr;
     gSpoofInitStaticsOnce.reset();
     return true;
 }
@@ -61,7 +61,7 @@ void U_CALLCONV initializeStatics(UErrorCode &status) {
         u"['\\-.\\:\\u00B7\\u0375\\u058A\\u05F3\\u05F4\\u06FD\\u06FE\\u0F0B\\u2010"
         u"\\u2019\\u2027\\u30A0\\u30FB]";
     gInclusionSet = new UnicodeSet(UnicodeString(inclusionPat), status);
-    if (gInclusionSet == NULL) {
+    if (gInclusionSet == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -145,7 +145,7 @@ void U_CALLCONV initializeStatics(UErrorCode &status) {
         u"\\U0003134A\\U00031350-\\U000323AF]";
 
     gRecommendedSet = new UnicodeSet(UnicodeString(recommendedPat), status);
-    if (gRecommendedSet == NULL) {
+    if (gRecommendedSet == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         delete gInclusionSet;
         return;
@@ -165,16 +165,16 @@ U_CAPI USpoofChecker * U_EXPORT2
 uspoof_open(UErrorCode *status) {
     umtx_initOnce(gSpoofInitStaticsOnce, &initializeStatics, *status);
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
     SpoofImpl *si = new SpoofImpl(*status);
-    if (si == NULL) {
+    if (si == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     if (U_FAILURE(*status)) {
         delete si;
-        return NULL;
+        return nullptr;
     }
     return si->asUSpoofChecker();
 }
@@ -184,44 +184,44 @@ U_CAPI USpoofChecker * U_EXPORT2
 uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLength,
                           UErrorCode *status) {
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
 
-    if (data == NULL) {
+    if (data == nullptr) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     umtx_initOnce(gSpoofInitStaticsOnce, &initializeStatics, *status);
     if (U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
 
     SpoofData *sd = new SpoofData(data, length, *status);
-    if (sd == NULL) {
+    if (sd == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     if (U_FAILURE(*status)) {
         delete sd;
-        return NULL;
+        return nullptr;
     }
 
     SpoofImpl *si = new SpoofImpl(sd, *status);
-    if (si == NULL) {
+    if (si == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
         delete sd; // explicit delete as the destructor for si won't be called.
-        return NULL;
+        return nullptr;
     }
 
     if (U_FAILURE(*status)) {
         delete si; // no delete for sd, as the si destructor will delete it.
-        return NULL;
+        return nullptr;
     }
 
-    if (pActualLength != NULL) {
+    if (pActualLength != nullptr) {
         *pActualLength = sd->size();
     }
     return si->asUSpoofChecker();
@@ -231,17 +231,17 @@ uspoof_openFromSerialized(const void *data, int32_t length, int32_t *pActualLeng
 U_CAPI USpoofChecker * U_EXPORT2
 uspoof_clone(const USpoofChecker *sc, UErrorCode *status) {
     const SpoofImpl *src = SpoofImpl::validateThis(sc, *status);
-    if (src == NULL) {
-        return NULL;
+    if (src == nullptr) {
+        return nullptr;
     }
     SpoofImpl *result = new SpoofImpl(*src, *status);   // copy constructor
-    if (result == NULL) {
+    if (result == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     if (U_FAILURE(*status)) {
         delete result;
-        result = NULL;
+        result = nullptr;
     }
     return result->asUSpoofChecker();
 }
@@ -258,7 +258,7 @@ uspoof_close(USpoofChecker *sc) {
 U_CAPI void U_EXPORT2
 uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status) {
     SpoofImpl *This = SpoofImpl::validateThis(sc, *status);
-    if (This == NULL) {
+    if (This == nullptr) {
         return;
     }
 
@@ -276,7 +276,7 @@ uspoof_setChecks(USpoofChecker *sc, int32_t checks, UErrorCode *status) {
 U_CAPI int32_t U_EXPORT2
 uspoof_getChecks(const USpoofChecker *sc, UErrorCode *status) {
     const SpoofImpl *This = SpoofImpl::validateThis(sc, *status);
-    if (This == NULL) {
+    if (This == nullptr) {
         return 0;
     }
     return This->fChecks;
@@ -286,7 +286,7 @@ U_CAPI void U_EXPORT2
 uspoof_setRestrictionLevel(USpoofChecker *sc, URestrictionLevel restrictionLevel) {
     UErrorCode status = U_ZERO_ERROR;
     SpoofImpl *This = SpoofImpl::validateThis(sc, status);
-    if (This != NULL) {
+    if (This != nullptr) {
         This->fRestrictionLevel = restrictionLevel;
         This->fChecks |= USPOOF_RESTRICTION_LEVEL;
     }
@@ -296,7 +296,7 @@ U_CAPI URestrictionLevel U_EXPORT2
 uspoof_getRestrictionLevel(const USpoofChecker *sc) {
     UErrorCode status = U_ZERO_ERROR;
     const SpoofImpl *This = SpoofImpl::validateThis(sc, status);
-    if (This == NULL) {
+    if (This == nullptr) {
         return USPOOF_UNRESTRICTIVE;
     }
     return This->fRestrictionLevel;
@@ -305,7 +305,7 @@ uspoof_getRestrictionLevel(const USpoofChecker *sc) {
 U_CAPI void U_EXPORT2
 uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode *status) {
     SpoofImpl *This = SpoofImpl::validateThis(sc, *status);
-    if (This == NULL) {
+    if (This == nullptr) {
         return;
     }
     This->setAllowedLocales(localesList, *status);
@@ -314,8 +314,8 @@ uspoof_setAllowedLocales(USpoofChecker *sc, const char *localesList, UErrorCode
 U_CAPI const char * U_EXPORT2
 uspoof_getAllowedLocales(USpoofChecker *sc, UErrorCode *status) {
     SpoofImpl *This = SpoofImpl::validateThis(sc, *status);
-    if (This == NULL) {
-        return NULL;
+    if (This == nullptr) {
+        return nullptr;
     }
     return This->getAllowedLocales(*status);
 }
@@ -330,8 +330,8 @@ uspoof_getAllowedChars(const USpoofChecker *sc, UErrorCode *status) {
 U_CAPI const UnicodeSet * U_EXPORT2
 uspoof_getAllowedUnicodeSet(const USpoofChecker *sc, UErrorCode *status) {
     const SpoofImpl *This = SpoofImpl::validateThis(sc, *status);
-    if (This == NULL) {
-        return NULL;
+    if (This == nullptr) {
+        return nullptr;
     }
     return This->fAllowedCharsSet;
 }
@@ -347,7 +347,7 @@ uspoof_setAllowedChars(USpoofChecker *sc, const USet *chars, UErrorCode *status)
 U_CAPI void U_EXPORT2
 uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const UnicodeSet *chars, UErrorCode *status) {
     SpoofImpl *This = SpoofImpl::validateThis(sc, *status);
-    if (This == NULL) {
+    if (This == nullptr) {
         return;
     }
     if (chars->isBogus()) {
@@ -355,7 +355,7 @@ uspoof_setAllowedUnicodeSet(USpoofChecker *sc, const UnicodeSet *chars, UErrorCo
         return;
     }
     UnicodeSet *clonedSet = chars->clone();
-    if (clonedSet == NULL || clonedSet->isBogus()) {
+    if (clonedSet == nullptr || clonedSet->isBogus()) {
         *status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -373,12 +373,12 @@ uspoof_check(const USpoofChecker *sc,
              UErrorCode *status) {
 
     // Backwards compatibility:
-    if (position != NULL) {
+    if (position != nullptr) {
         *position = 0;
     }
 
     // Delegate to uspoof_check2
-    return uspoof_check2(sc, id, length, NULL, status);
+    return uspoof_check2(sc, id, length, nullptr, status);
 }
 
 
@@ -389,7 +389,7 @@ uspoof_check2(const USpoofChecker *sc,
     UErrorCode *status) {
 
     const SpoofImpl *This = SpoofImpl::validateThis(sc, *status);
-    if (This == NULL) {
+    if (This == nullptr) {
         return 0;
     }
     if (length < -1) {
@@ -409,12 +409,12 @@ uspoof_checkUTF8(const USpoofChecker *sc,
                  UErrorCode *status) {
 
     // Backwards compatibility:
-    if (position != NULL) {
+    if (position != nullptr) {
         *position = 0;
     }
 
     // Delegate to uspoof_check2
-    return uspoof_check2UTF8(sc, id, length, NULL, status);
+    return uspoof_check2UTF8(sc, id, length, nullptr, status);
 }
 
 
@@ -546,19 +546,19 @@ uspoof_checkUnicodeString(const USpoofChecker *sc,
                           UErrorCode *status) {
 
     // Backwards compatibility:
-    if (position != NULL) {
+    if (position != nullptr) {
         *position = 0;
     }
 
     // Delegate to uspoof_check2
-    return uspoof_check2UnicodeString(sc, id, NULL, status);
+    return uspoof_check2UnicodeString(sc, id, nullptr, status);
 }
 
 namespace {
 
 int32_t checkImpl(const SpoofImpl* This, const UnicodeString& id, CheckResult* checkResult, UErrorCode* status) {
-    U_ASSERT(This != NULL);
-    U_ASSERT(checkResult != NULL);
+    U_ASSERT(This != nullptr);
+    U_ASSERT(checkResult != nullptr);
     checkResult->clear();
     int32_t result = 0;
 
@@ -656,13 +656,13 @@ uspoof_check2UnicodeString(const USpoofChecker *sc,
                           USpoofCheckResult* checkResult,
                           UErrorCode *status) {
     const SpoofImpl *This = SpoofImpl::validateThis(sc, *status);
-    if (This == NULL) {
+    if (This == nullptr) {
         return false;
     }
 
-    if (checkResult != NULL) {
+    if (checkResult != nullptr) {
         CheckResult* ThisCheckResult = CheckResult::validateThis(checkResult, *status);
-        if (ThisCheckResult == NULL) {
+        if (ThisCheckResult == nullptr) {
             return false;
         }
         return checkImpl(This, id, ThisCheckResult, status);
@@ -685,7 +685,7 @@ uspoof_getSkeleton(const USpoofChecker *sc,
     if (U_FAILURE(*status)) {
         return 0;
     }
-    if (length<-1 || destCapacity<0 || (destCapacity==0 && dest!=NULL)) {
+    if (length<-1 || destCapacity<0 || (destCapacity==0 && dest!=nullptr)) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -739,7 +739,7 @@ uspoof_getSkeletonUTF8(const USpoofChecker *sc,
     if (U_FAILURE(*status)) {
         return 0;
     }
-    if (length<-1 || destCapacity<0 || (destCapacity==0 && dest!=NULL)) {
+    if (length<-1 || destCapacity<0 || (destCapacity==0 && dest!=nullptr)) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -761,7 +761,7 @@ uspoof_getSkeletonUTF8(const USpoofChecker *sc,
 U_CAPI int32_t U_EXPORT2
 uspoof_serialize(USpoofChecker *sc,void *buf, int32_t capacity, UErrorCode *status) {
     SpoofImpl *This = SpoofImpl::validateThis(sc, *status);
-    if (This == NULL) {
+    if (This == nullptr) {
         U_ASSERT(U_FAILURE(*status));
         return 0;
     }
@@ -800,9 +800,9 @@ uspoof_getRecommendedUnicodeSet(UErrorCode *status) {
 U_CAPI USpoofCheckResult* U_EXPORT2
 uspoof_openCheckResult(UErrorCode *status) {
     CheckResult* checkResult = new CheckResult();
-    if (checkResult == NULL) {
+    if (checkResult == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
     return checkResult->asUSpoofCheckResult();
 }
@@ -831,7 +831,7 @@ uspoof_getCheckResultRestrictionLevel(const USpoofCheckResult *checkResult, UErr
 U_CAPI const USet* U_EXPORT2
 uspoof_getCheckResultNumerics(const USpoofCheckResult *checkResult, UErrorCode *status) {
     const CheckResult* This = CheckResult::validateThis(checkResult, *status);
-    if (U_FAILURE(*status)) { return NULL; }
+    if (U_FAILURE(*status)) { return nullptr; }
     return This->fNumerics.toUSet();
 }
 
index 192fb9a6885e8ef96a25ee5a04cc376360dd2955..098d272e1962324bcfdf261cf06b1155686a4336 100644 (file)
@@ -53,16 +53,16 @@ uspoof_openFromSource(const char *confusables,  int32_t confusablesLen,
                       int32_t *errorType, UParseError *pe, UErrorCode *status) {
     uspoof_internalInitStatics(status);
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
 #if UCONFIG_NO_REGULAR_EXPRESSIONS 
     *status = U_UNSUPPORTED_ERROR;      
-    return NULL;
+    return nullptr;
 #else
-    if (errorType!=NULL) {
+    if (errorType!=nullptr) {
         *errorType = 0;
     }
-    if (pe != NULL) {
+    if (pe != nullptr) {
         pe->line = 0;
         pe->offset = 0;
         pe->preContext[0] = 0;
@@ -72,26 +72,26 @@ uspoof_openFromSource(const char *confusables,  int32_t confusablesLen,
     // Set up a shell of a spoof detector, with empty data.
     SpoofData *newSpoofData = new SpoofData(*status);
 
-    if (newSpoofData == NULL) {
+    if (newSpoofData == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     if (U_FAILURE(*status)) {
         delete newSpoofData;
-        return NULL;
+        return nullptr;
     }
     SpoofImpl *This = new SpoofImpl(newSpoofData, *status);
 
-    if (This == NULL) {
+    if (This == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
         delete newSpoofData; // explicit delete as the destructor for SpoofImpl won't be called.
-        return NULL;
+        return nullptr;
     }
 
     if (U_FAILURE(*status)) {
         delete This; // no delete for newSpoofData, as the SpoofImpl destructor will delete it.
-        return NULL;
+        return nullptr;
     }
 
     // Compile the binary data from the source (text) format.
@@ -99,7 +99,7 @@ uspoof_openFromSource(const char *confusables,  int32_t confusablesLen,
     
     if (U_FAILURE(*status)) {
         delete This;
-        This = NULL;
+        This = nullptr;
     }
     return (USpoofChecker *)This;
 #endif // UCONFIG_NO_REGULAR_EXPRESSIONS 
index 376ac64e3ce2e1ea783f9c8af2311d571537ecd9..e45d065cad0a8d0771bcbaaa201bfda98c1f6c65 100644 (file)
@@ -83,7 +83,7 @@ SPUStringPool::SPUStringPool(UErrorCode &status) : fVec(nullptr), fHash(nullptr)
     fVec = vec.orphan();
     fHash = uhash_open(uhash_hashUnicodeString,           // key hash function
                        uhash_compareUnicodeString,        // Key Comparator
-                       NULL,                              // Value Comparator
+                       nullptr,                              // Value Comparator
                        &status);
 }
 
@@ -153,43 +153,43 @@ SPUString *SPUStringPool::addString(UnicodeString *src, UErrorCode &status) {
 
 ConfusabledataBuilder::ConfusabledataBuilder(SpoofImpl *spImpl, UErrorCode &status) :
     fSpoofImpl(spImpl),
-    fInput(NULL),
-    fTable(NULL),
-    fKeySet(NULL),
-    fKeyVec(NULL),
-    fValueVec(NULL),
-    fStringTable(NULL),
-    stringPool(NULL),
-    fParseLine(NULL),
-    fParseHexNum(NULL),
+    fInput(nullptr),
+    fTable(nullptr),
+    fKeySet(nullptr),
+    fKeyVec(nullptr),
+    fValueVec(nullptr),
+    fStringTable(nullptr),
+    stringPool(nullptr),
+    fParseLine(nullptr),
+    fParseHexNum(nullptr),
     fLineNum(0)
 {
     if (U_FAILURE(status)) {
         return;
     }
 
-    fTable = uhash_open(uhash_hashLong, uhash_compareLong, NULL, &status);
+    fTable = uhash_open(uhash_hashLong, uhash_compareLong, nullptr, &status);
 
     fKeySet = new UnicodeSet();
-    if (fKeySet == NULL) {
+    if (fKeySet == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
 
     fKeyVec = new UVector(status);
-    if (fKeyVec == NULL) {
+    if (fKeyVec == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
 
     fValueVec = new UVector(status);
-    if (fValueVec == NULL) {
+    if (fValueVec == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
 
     stringPool = new SPUStringPool(status);
-    if (stringPool == NULL) {
+    if (stringPool == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -217,7 +217,7 @@ void ConfusabledataBuilder::buildConfusableData(SpoofImpl * spImpl, const char *
     }
     ConfusabledataBuilder builder(spImpl, status);
     builder.build(confusables, confusablesLen, status);
-    if (U_FAILURE(status) && errorType != NULL) {
+    if (U_FAILURE(status) && errorType != nullptr) {
         *errorType = USPOOF_SINGLE_SCRIPT_CONFUSABLE;
         pe->line = builder.fLineNum;
     }
@@ -232,17 +232,17 @@ void ConfusabledataBuilder::build(const char * confusables, int32_t confusablesL
     if (U_FAILURE(status)) {
         return;
     }
-    u_strFromUTF8(NULL, 0, &inputLen, confusables, confusablesLen, &status);
+    u_strFromUTF8(nullptr, 0, &inputLen, confusables, confusablesLen, &status);
     if (status != U_BUFFER_OVERFLOW_ERROR) {
         return;
     }
     status = U_ZERO_ERROR;
     fInput = static_cast<UChar *>(uprv_malloc((inputLen+1) * sizeof(UChar)));
-    if (fInput == NULL) {
+    if (fInput == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
-    u_strFromUTF8(fInput, inputLen+1, NULL, confusables, confusablesLen, &status);
+    u_strFromUTF8(fInput, inputLen+1, nullptr, confusables, confusablesLen, &status);
 
 
     // Regular Expression to parse a line from Confusables.txt.  The expression will match
@@ -263,12 +263,12 @@ void ConfusabledataBuilder::build(const char * confusables, int32_t confusablesL
         "|^([ \\t]*(?:#.*?)?)$"       // OR match empty lines or lines with only a #comment
         "|^(.*?)$", -1, US_INV);      // OR match any line, which catches illegal lines.
     // TODO: Why are we using the regex C API here? C++ would just take UnicodeString...
-    fParseLine = uregex_open(pattern.getBuffer(), pattern.length(), 0, NULL, &status);
+    fParseLine = uregex_open(pattern.getBuffer(), pattern.length(), 0, nullptr, &status);
 
     // Regular expression for parsing a hex number out of a space-separated list of them.
     //   Capture group 1 gets the number, with spaces removed.
     pattern = UNICODE_STRING_SIMPLE("\\s*([0-9A-F]+)");
-    fParseHexNum = uregex_open(pattern.getBuffer(), pattern.length(), 0, NULL, &status);
+    fParseHexNum = uregex_open(pattern.getBuffer(), pattern.length(), 0, nullptr, &status);
 
     // Zap any Byte Order Mark at the start of input.  Changing it to a space is benign
     //   given the syntax of the input.
@@ -300,7 +300,7 @@ void ConfusabledataBuilder::build(const char * confusables, int32_t confusablesL
         uregex_setText(fParseHexNum, &fInput[mapStringStart], mapStringLength, &status);
 
         UnicodeString  *mapString = new UnicodeString();
-        if (mapString == NULL) {
+        if (mapString == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
@@ -370,7 +370,7 @@ void ConfusabledataBuilder::build(const char * confusables, int32_t confusablesL
         for (UChar32 keyChar=fKeySet->getRangeStart(range);
                 keyChar <= fKeySet->getRangeEnd(range); keyChar++) {
             SPUString *targetMapping = static_cast<SPUString *>(uhash_iget(fTable, keyChar));
-            U_ASSERT(targetMapping != NULL);
+            U_ASSERT(targetMapping != nullptr);
 
             // Set an error code if trying to consume a long string.  Otherwise,
             // codePointAndLengthToKey will abort on a U_ASSERT.
index e50344c4696e6bd9d1f95349894d25e14e8a769f..95ce225f5bbfcffd7f4ccebdb3db454cf5366916 100644 (file)
@@ -53,9 +53,9 @@ SpoofImpl::SpoofImpl() {
 
 void SpoofImpl::construct(UErrorCode& status) {
     fChecks = USPOOF_ALL_CHECKS;
-    fSpoofData = NULL;
-    fAllowedCharsSet = NULL;
-    fAllowedLocales = NULL;
+    fSpoofData = nullptr;
+    fAllowedCharsSet = nullptr;
+    fAllowedLocales = nullptr;
     fRestrictionLevel = USPOOF_HIGHLY_RESTRICTIVE;
 
     if (U_FAILURE(status)) { return; }
@@ -63,7 +63,7 @@ void SpoofImpl::construct(UErrorCode& status) {
     UnicodeSet *allowedCharsSet = new UnicodeSet(0, 0x10ffff);
     fAllowedCharsSet = allowedCharsSet;
     fAllowedLocales  = uprv_strdup("");
-    if (fAllowedCharsSet == NULL || fAllowedLocales == NULL) {
+    if (fAllowedCharsSet == nullptr || fAllowedLocales == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -73,25 +73,25 @@ void SpoofImpl::construct(UErrorCode& status) {
 
 // Copy Constructor, used by the user level clone() function.
 SpoofImpl::SpoofImpl(const SpoofImpl &src, UErrorCode &status)  :
-        fChecks(USPOOF_ALL_CHECKS), fSpoofData(NULL), fAllowedCharsSet(NULL) , 
-        fAllowedLocales(NULL) {
+        fChecks(USPOOF_ALL_CHECKS), fSpoofData(nullptr), fAllowedCharsSet(nullptr) , 
+        fAllowedLocales(nullptr) {
     if (U_FAILURE(status)) {
         return;
     }
     fChecks = src.fChecks;
-    if (src.fSpoofData != NULL) {
+    if (src.fSpoofData != nullptr) {
         fSpoofData = src.fSpoofData->addReference();
     }
     fAllowedCharsSet = src.fAllowedCharsSet->clone();
     fAllowedLocales = uprv_strdup(src.fAllowedLocales);
-    if (fAllowedCharsSet == NULL || fAllowedLocales == NULL) {
+    if (fAllowedCharsSet == nullptr || fAllowedLocales == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
     }
     fRestrictionLevel = src.fRestrictionLevel;
 }
 
 SpoofImpl::~SpoofImpl() {
-    if (fSpoofData != NULL) {
+    if (fSpoofData != nullptr) {
         fSpoofData->removeReference();   // Will delete if refCount goes to zero.
     }
     delete fAllowedCharsSet;
@@ -110,10 +110,10 @@ USpoofChecker *SpoofImpl::asUSpoofChecker() {
 const SpoofImpl *SpoofImpl::validateThis(const USpoofChecker *sc, UErrorCode &status) {
     auto* This = validate(sc, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
-    if (This->fSpoofData != NULL && !This->fSpoofData->validateDataVersion(status)) {
-        return NULL;
+    if (This->fSpoofData != nullptr && !This->fSpoofData->validateDataVersion(status)) {
+        return nullptr;
     }
     return This;
 }
@@ -126,16 +126,16 @@ SpoofImpl *SpoofImpl::validateThis(USpoofChecker *sc, UErrorCode &status) {
 
 void SpoofImpl::setAllowedLocales(const char *localesList, UErrorCode &status) {
     UnicodeSet    allowedChars;
-    UnicodeSet    *tmpSet = NULL;
+    UnicodeSet    *tmpSet = nullptr;
     const char    *locStart = localesList;
-    const char    *locEnd = NULL;
+    const char    *locEnd = nullptr;
     const char    *localesListEnd = localesList + uprv_strlen(localesList);
     int32_t        localeListCount = 0;   // Number of locales provided by caller.
 
     // Loop runs once per locale from the localesList, a comma separated list of locales.
     do {
         locEnd = uprv_strchr(locStart, ',');
-        if (locEnd == NULL) {
+        if (locEnd == nullptr) {
             locEnd = localesListEnd;
         }
         while (*locStart == ' ') {
@@ -167,7 +167,7 @@ void SpoofImpl::setAllowedLocales(const char *localesList, UErrorCode &status) {
         uprv_free((void *)fAllowedLocales);
         fAllowedLocales = uprv_strdup("");
         tmpSet = new UnicodeSet(0, 0x10ffff);
-        if (fAllowedLocales == NULL || tmpSet == NULL) {
+        if (fAllowedLocales == nullptr || tmpSet == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
         } 
@@ -195,7 +195,7 @@ void SpoofImpl::setAllowedLocales(const char *localesList, UErrorCode &status) {
     // Store the updated spoof checker state.
     tmpSet = allowedChars.clone();
     const char *tmpLocalesList = uprv_strdup(localesList);
-    if (tmpSet == NULL || tmpLocalesList == NULL) {
+    if (tmpSet == nullptr || tmpLocalesList == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -488,7 +488,7 @@ CheckResult::~CheckResult() {
 
 UBool SpoofData::validateDataVersion(UErrorCode &status) const {
     if (U_FAILURE(status) ||
-        fRawData == NULL ||
+        fRawData == nullptr ||
         fRawData->fMagic != USPOOF_MAGIC ||
         fRawData->fFormatVersion[0] != USPOOF_CONFUSABLE_DATA_FORMAT_VERSION ||
         fRawData->fFormatVersion[1] != 0 ||
@@ -515,7 +515,7 @@ spoofDataIsAcceptable(void *context,
         pInfo->formatVersion[0] == USPOOF_CONFUSABLE_DATA_FORMAT_VERSION
     ) {
         UVersionInfo *version = static_cast<UVersionInfo *>(context);
-        if(version != NULL) {
+        if(version != nullptr) {
             uprv_memcpy(version, pInfo->dataVersion, 4);
         }
         return true;
@@ -573,7 +573,7 @@ static void U_CALLCONV uspoof_loadDefaultData(UErrorCode& status) {
 
 SpoofData* SpoofData::getDefault(UErrorCode& status) {
     umtx_initOnce(gSpoofInitDefaultOnce, &uspoof_loadDefaultData, status);
-    if (U_FAILURE(status)) { return NULL; }
+    if (U_FAILURE(status)) { return nullptr; }
     gDefaultSpoofData->addReference();
     return gDefaultSpoofData;
 }
@@ -605,7 +605,7 @@ SpoofData::SpoofData(const void *data, int32_t length, UErrorCode &status)
         status = U_INVALID_FORMAT_ERROR;
         return;
     }
-    if (data == NULL) {
+    if (data == nullptr) {
         status = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
@@ -636,7 +636,7 @@ SpoofData::SpoofData(UErrorCode &status) {
     
     fRawData = static_cast<SpoofDataHeader *>(uprv_malloc(initialSize));
     fMemLimit = initialSize;
-    if (fRawData == NULL) {
+    if (fRawData == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -654,14 +654,14 @@ SpoofData::SpoofData(UErrorCode &status) {
 //           Should be updated if any new fields are added.
 //           Called by constructors to put things in a known initial state.
 void SpoofData::reset() {
-   fRawData = NULL;
+   fRawData = nullptr;
    fDataOwned = false;
-   fUDM      = NULL;
+   fUDM      = nullptr;
    fMemLimit = 0;
    fRefCount = 1;
-   fCFUKeys = NULL;
-   fCFUValues = NULL;
-   fCFUStrings = NULL;
+   fCFUKeys = nullptr;
+   fCFUValues = nullptr;
+   fCFUStrings = nullptr;
 }
 
 
@@ -673,7 +673,7 @@ void SpoofData::reset() {
 //            during the opening of a Spoof Checker from prebuilt data.
 //
 //            The pointers for non-existent data sections (identified by an offset of 0)
-//            are set to NULL.
+//            are set to nullptr.
 //
 //            Note:  During building the data, adding each new data section
 //            reallocs the raw data area, which likely relocates it, which
@@ -681,9 +681,9 @@ void SpoofData::reset() {
 //            multiple calls to this function during building.
 //
 void SpoofData::initPtrs(UErrorCode &status) {
-    fCFUKeys = NULL;
-    fCFUValues = NULL;
-    fCFUStrings = NULL;
+    fCFUKeys = nullptr;
+    fCFUValues = nullptr;
+    fCFUStrings = nullptr;
     if (U_FAILURE(status)) {
         return;
     }
@@ -703,11 +703,11 @@ SpoofData::~SpoofData() {
     if (fDataOwned) {
         uprv_free(fRawData);
     }
-    fRawData = NULL;
-    if (fUDM != NULL) {
+    fRawData = nullptr;
+    if (fUDM != nullptr) {
         udata_close(fUDM);
     }
-    fUDM = NULL;
+    fUDM = nullptr;
 }
 
 
@@ -726,7 +726,7 @@ SpoofData *SpoofData::addReference() {
 
 void *SpoofData::reserveSpace(int32_t numBytes,  UErrorCode &status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     if (!fDataOwned) {
         UPRV_UNREACHABLE_EXIT;
@@ -828,10 +828,10 @@ U_CAPI int32_t U_EXPORT2
 uspoof_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;
     }
index 68d7bedae1b5d0f90de98ffac01c0b5d3cc86e0d..8602a4ca3195ce3a10203149697b8b95a3ef53aa 100644 (file)
@@ -277,7 +277,7 @@ class SpoofData: public UMemory {
     SpoofDataHeader             *fRawData;          // Ptr to the raw memory-mapped data
     UBool                       fDataOwned;         // True if the raw data is owned, and needs
                                                     //  to be deleted when refcount goes to zero.
-    UDataMemory                 *fUDM;              // If not NULL, our data came from a
+    UDataMemory                 *fUDM;              // If not nullptr, our data came from a
                                                     //   UDataMemory, which we must close when
                                                     //   we are done.
 
index 912163a0a34071a0308762185384e5773c2d3f2e..335714fe9b3be0864c4bd5eef9128ea128f3ef36 100644 (file)
@@ -32,7 +32,7 @@ UTF16CollationIterator::UTF16CollationIterator(const UTF16CollationIterator &oth
         : CollationIterator(other),
           start(newText),
           pos(newText + (other.pos - other.start)),
-          limit(other.limit == NULL ? NULL : newText + (other.limit - other.start)) {
+          limit(other.limit == nullptr ? nullptr : newText + (other.limit - other.start)) {
 }
 
 UTF16CollationIterator::~UTF16CollationIterator() {}
@@ -76,7 +76,7 @@ UTF16CollationIterator::handleGetTrailSurrogate() {
 
 UBool
 UTF16CollationIterator::foundNULTerminator() {
-    if(limit == NULL) {
+    if(limit == nullptr) {
         limit = --pos;
         return true;
     } else {
@@ -90,7 +90,7 @@ UTF16CollationIterator::nextCodePoint(UErrorCode & /*errorCode*/) {
         return U_SENTINEL;
     }
     UChar32 c = *pos;
-    if(c == 0 && limit == NULL) {
+    if(c == 0 && limit == nullptr) {
         limit = pos;
         return U_SENTINEL;
     }
@@ -123,7 +123,7 @@ void
 UTF16CollationIterator::forwardNumCodePoints(int32_t num, UErrorCode & /*errorCode*/) {
     while(num > 0 && pos != limit) {
         UChar32 c = *pos;
-        if(c == 0 && limit == NULL) {
+        if(c == 0 && limit == nullptr) {
             limit = pos;
             break;
         }
@@ -153,15 +153,15 @@ FCDUTF16CollationIterator::FCDUTF16CollationIterator(const FCDUTF16CollationIter
         : UTF16CollationIterator(other),
           rawStart(newText),
           segmentStart(newText + (other.segmentStart - other.rawStart)),
-          segmentLimit(other.segmentLimit == NULL ? NULL : newText + (other.segmentLimit - other.rawStart)),
-          rawLimit(other.rawLimit == NULL ? NULL : newText + (other.rawLimit - other.rawStart)),
+          segmentLimit(other.segmentLimit == nullptr ? nullptr : newText + (other.segmentLimit - other.rawStart)),
+          rawLimit(other.rawLimit == nullptr ? nullptr : newText + (other.rawLimit - other.rawStart)),
           nfcImpl(other.nfcImpl),
           normalized(other.normalized),
           checkDir(other.checkDir) {
     if(checkDir != 0 || other.start == other.segmentStart) {
         start = newText + (other.start - other.rawStart);
         pos = newText + (other.pos - other.rawStart);
-        limit = other.limit == NULL ? NULL : newText + (other.limit - other.rawStart);
+        limit = other.limit == nullptr ? nullptr : newText + (other.limit - other.rawStart);
     } else {
         start = normalized.getBuffer();
         pos = start + (other.pos - other.start);
@@ -239,7 +239,7 @@ FCDUTF16CollationIterator::handleNextCE32(UChar32 &c, UErrorCode &errorCode) {
 
 UBool
 FCDUTF16CollationIterator::foundNULTerminator() {
-    if(limit == NULL) {
+    if(limit == nullptr) {
         limit = rawLimit = --pos;
         return true;
     } else {
@@ -265,7 +265,7 @@ FCDUTF16CollationIterator::nextCodePoint(UErrorCode &errorCode) {
                     }
                     c = *pos++;
                 }
-            } else if(c == 0 && limit == NULL) {
+            } else if(c == 0 && limit == nullptr) {
                 limit = rawLimit = --pos;
                 return U_SENTINEL;
             }
index 6db70511b0d54adee0e10daef24c80d923c71988..c02f1981d275d50e0caa0c5332abff739ded6485 100644 (file)
@@ -62,7 +62,7 @@ protected:
     // Copy constructor only for subclasses which set the pointers.
     UTF16CollationIterator(const UTF16CollationIterator &other)
             : CollationIterator(other),
-              start(NULL), pos(NULL), limit(NULL) {}
+              start(nullptr), pos(nullptr), limit(nullptr) {}
 
     virtual uint32_t handleNextCE32(UChar32 &c, UErrorCode &errorCode) override;
 
@@ -75,7 +75,7 @@ protected:
     virtual void backwardNumCodePoints(int32_t num, UErrorCode &errorCode) override;
 
     // UTF-16 string pointers.
-    // limit can be NULL for NUL-terminated strings.
+    // limit can be nullptr for NUL-terminated strings.
     const UChar *start, *pos, *limit;
 };
 
@@ -87,7 +87,7 @@ public:
     FCDUTF16CollationIterator(const CollationData *data, UBool numeric,
                               const UChar *s, const UChar *p, const UChar *lim)
             : UTF16CollationIterator(data, numeric, s, p, lim),
-              rawStart(s), segmentStart(p), segmentLimit(NULL), rawLimit(lim),
+              rawStart(s), segmentStart(p), segmentLimit(nullptr), rawLimit(lim),
               nfcImpl(data->nfcImpl),
               checkDir(1) {}
 
@@ -146,7 +146,7 @@ private:
     UBool normalize(const UChar *from, const UChar *to, UErrorCode &errorCode);
 
     // Text pointers: The input text is [rawStart, rawLimit[
-    // where rawLimit can be NULL for NUL-terminated text.
+    // where rawLimit can be nullptr for NUL-terminated text.
     //
     // checkDir > 0:
     //
@@ -171,7 +171,7 @@ private:
     const UChar *rawStart;
     const UChar *segmentStart;
     const UChar *segmentLimit;
-    // rawLimit==NULL for a NUL-terminated string.
+    // rawLimit==nullptr for a NUL-terminated string.
     const UChar *rawLimit;
 
     const Normalizer2Impl &nfcImpl;
index 7bf6eec331a13a230986ea4d677460645c0e61c7..8016fb7ec48fd2e09560b5a3cbc6a7848f078b5d 100644 (file)
@@ -39,7 +39,7 @@ static const int64_t timeScaleTable[UDTS_MAX_SCALE][UTSV_MAX_SCALE_VALUE] = {
 U_CAPI int64_t U_EXPORT2
 utmscale_getTimeScaleValue(UDateTimeScale timeScale, UTimeScaleValue value, UErrorCode *status)
 {
-    if (status == NULL || U_FAILURE(*status)) {
+    if (status == nullptr || U_FAILURE(*status)) {
         return 0;
     }
 
@@ -58,7 +58,7 @@ utmscale_fromInt64(int64_t otherTime, UDateTimeScale timeScale, UErrorCode *stat
 {
     const int64_t *data;
     
-    if (status == NULL || U_FAILURE(*status)) {
+    if (status == nullptr || U_FAILURE(*status)) {
         return 0;
     }
 
@@ -82,7 +82,7 @@ utmscale_toInt64(int64_t universalTime, UDateTimeScale timeScale, UErrorCode *st
 {
     const int64_t *data;
     
-    if (status == NULL || U_FAILURE(*status)) {
+    if (status == nullptr || U_FAILURE(*status)) {
         return 0;
     }
 
index 1cbba81d658265a1ff2045328f65e01432d9d7d4..44835e260dd3061faf6f3374341a0b40e1fbf8ee 100644 (file)
@@ -28,7 +28,7 @@
 #include "rbt.h"
 
 // Following macro is to be followed by <return value>';' or just ';'
-#define utrans_ENTRY(s) if ((s)==NULL || U_FAILURE(*(s))) return
+#define utrans_ENTRY(s) if ((s)==nullptr || U_FAILURE(*(s))) return
 
 /********************************************************************
  * Replaceable-UReplaceableCallbacks glue
@@ -60,7 +60,7 @@ public:
 
     virtual void copy(int32_t start, int32_t limit, int32_t dest) override;
 
-    // virtual Replaceable *clone() const { return NULL; } same as default
+    // virtual Replaceable *clone() const { return nullptr; } same as default
 
     /**
      * ICU "poor man's RTTI", returns a UClassID for the actual class.
@@ -139,29 +139,29 @@ utrans_openU(const UChar *id,
              int32_t rulesLength,
              UParseError *parseError,
              UErrorCode *status) {
-    if(status==NULL || U_FAILURE(*status)) {
-        return NULL;
+    if(status==nullptr || U_FAILURE(*status)) {
+        return nullptr;
     }
-    if (id == NULL) {
+    if (id == nullptr) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     UParseError temp;
     
-    if(parseError == NULL){
+    if(parseError == nullptr){
         parseError = &temp;
     }
     
     UnicodeString ID(idLength<0, id, idLength); // r-o alias
 
-    if(rules==NULL){
+    if(rules==nullptr){
 
-        Transliterator *trans = NULL;
+        Transliterator *trans = nullptr;
 
         trans = Transliterator::createInstance(ID, dir, *parseError, *status);
         
         if(U_FAILURE(*status)){
-            return NULL;
+            return nullptr;
         }
         return (UTransliterator*) trans;
     }else{
@@ -169,10 +169,10 @@ utrans_openU(const UChar *id,
                               rules,
                               rulesLength); // r-o alias
 
-        Transliterator *trans = NULL;
+        Transliterator *trans = nullptr;
         trans = Transliterator::createFromRules(ID, ruleStr, dir, *parseError, *status); 
         if(U_FAILURE(*status)) { 
-            return NULL;
+            return nullptr;
         }
 
         return (UTransliterator*) trans;
@@ -196,7 +196,7 @@ U_CAPI UTransliterator* U_EXPORT2
 utrans_openInverse(const UTransliterator* trans,
                    UErrorCode* status) {
 
-    utrans_ENTRY(status) NULL;
+    utrans_ENTRY(status) nullptr;
 
     UTransliterator* result =
         (UTransliterator*) ((Transliterator*) trans)->createInverse(*status);
@@ -208,15 +208,15 @@ U_CAPI UTransliterator* U_EXPORT2
 utrans_clone(const UTransliterator* trans,
              UErrorCode* status) {
 
-    utrans_ENTRY(status) NULL;
+    utrans_ENTRY(status) nullptr;
 
-    if (trans == NULL) {
+    if (trans == nullptr) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     Transliterator *t = ((Transliterator*) trans)->clone();
-    if (t == NULL) {
+    if (t == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
     }
     return (UTransliterator*) t;
@@ -232,7 +232,7 @@ utrans_getUnicodeID(const UTransliterator *trans,
                     int32_t *resultLength) {
     // Transliterator keeps its ID NUL-terminated
     const UnicodeString &ID=((Transliterator*) trans)->getID();
-    if(resultLength!=NULL) {
+    if(resultLength!=nullptr) {
         *resultLength=ID.length();
     }
     return ID.getBuffer();
@@ -272,19 +272,19 @@ utrans_setFilter(UTransliterator* trans,
                  UErrorCode* status) {
 
     utrans_ENTRY(status);
-    UnicodeFilter* filter = NULL;
-    if (filterPattern != NULL && *filterPattern != 0) {
+    UnicodeFilter* filter = nullptr;
+    if (filterPattern != nullptr && *filterPattern != 0) {
         // Create read only alias of filterPattern:
         UnicodeString pat(filterPatternLen < 0, filterPattern, filterPatternLen);
         filter = new UnicodeSet(pat, *status);
-        /* test for NULL */
-        if (filter == NULL) {
+        /* test for nullptr */
+        if (filter == nullptr) {
             *status = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
         if (U_FAILURE(*status)) {
             delete filter;
-            filter = NULL;
+            filter = nullptr;
         }
     }
     ((Transliterator*) trans)->adoptFilter(filter);
@@ -297,7 +297,7 @@ utrans_countAvailableIDs(void) {
 
 U_CAPI int32_t U_EXPORT2
 utrans_getAvailableID(int32_t index,
-                      char* buf, // may be NULL
+                      char* buf, // may be nullptr
                       int32_t bufCapacity) {
     return Transliterator::getAvailableID(index).extract(0, 0x7fffffff, buf, bufCapacity, US_INV);
 }
@@ -312,7 +312,7 @@ typedef struct UTransEnumeration {
 U_CDECL_BEGIN
 static int32_t U_CALLCONV
 utrans_enum_count(UEnumeration *uenum, UErrorCode *pErrorCode) {
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+    if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
         return 0;
     }
     return ((UTransEnumeration *)uenum)->count;
@@ -322,7 +322,7 @@ static const UChar* U_CALLCONV
 utrans_enum_unext(UEnumeration *uenum,
                   int32_t* resultLength,
                   UErrorCode *pErrorCode) {
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+    if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
         return 0;
     }
 
@@ -331,22 +331,22 @@ utrans_enum_unext(UEnumeration *uenum,
     if(index<ute->count) {
         const UnicodeString &ID=Transliterator::getAvailableID(index);
         ute->index=index+1;
-        if(resultLength!=NULL) {
+        if(resultLength!=nullptr) {
             *resultLength=ID.length();
         }
         // Transliterator keeps its ID NUL-terminated
         return ID.getBuffer();
     }
 
-    if(resultLength!=NULL) {
+    if(resultLength!=nullptr) {
         *resultLength=0;
     }
-    return NULL;
+    return nullptr;
 }
 
 static void U_CALLCONV
 utrans_enum_reset(UEnumeration *uenum, UErrorCode *pErrorCode) {
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+    if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
         return;
     }
 
@@ -362,8 +362,8 @@ utrans_enum_close(UEnumeration *uenum) {
 U_CDECL_END
 
 static const UEnumeration utransEnumeration={
-    NULL,
-    NULL,
+    nullptr,
+    nullptr,
     utrans_enum_close,
     utrans_enum_count,
     utrans_enum_unext,
@@ -375,14 +375,14 @@ U_CAPI UEnumeration * U_EXPORT2
 utrans_openIDs(UErrorCode *pErrorCode) {
     UTransEnumeration *ute;
 
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
-        return NULL;
+    if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
+        return nullptr;
     }
 
     ute=(UTransEnumeration *)uprv_malloc(sizeof(UTransEnumeration));
-    if(ute==NULL) {
+    if(ute==nullptr) {
         *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     ute->uenum=utransEnumeration;
@@ -450,7 +450,7 @@ utrans_transUChars(const UTransliterator* trans,
         return;
     }
  
-    int32_t textLen = (textLength == NULL || *textLength < 0)
+    int32_t textLen = (textLength == nullptr || *textLength < 0)
         ? u_strlen(text) : *textLength;
     // writeable alias: for this ct, len CANNOT be -1 (why?)
     UnicodeString str(text, textLen, textCapacity);
@@ -458,9 +458,9 @@ utrans_transUChars(const UTransliterator* trans,
     *limit = ((Transliterator*) trans)->transliterate(str, start, *limit);
 
     // Copy the string buffer back to text (only if necessary)
-    // and fill in *neededCapacity (if neededCapacity != NULL).
+    // and fill in *neededCapacity (if neededCapacity != nullptr).
     textLen = str.extract(text, textCapacity, *status);
-    if(textLength != NULL) {
+    if(textLength != nullptr) {
         *textLength = textLen;
     }
 }
@@ -480,7 +480,7 @@ utrans_transIncrementalUChars(const UTransliterator* trans,
         return;
     }
 
-    int32_t textLen = (textLength == NULL || *textLength < 0)
+    int32_t textLen = (textLength == nullptr || *textLength < 0)
         ? u_strlen(text) : *textLength;
     // writeable alias: for this ct, len CANNOT be -1 (why?)
     UnicodeString str(text, textLen, textCapacity);
@@ -488,9 +488,9 @@ utrans_transIncrementalUChars(const UTransliterator* trans,
     ((Transliterator*) trans)->transliterate(str, *pos, *status);
 
     // Copy the string buffer back to text (only if necessary)
-    // and fill in *neededCapacity (if neededCapacity != NULL).
+    // and fill in *neededCapacity (if neededCapacity != nullptr).
     textLen = str.extract(text, textCapacity, *status);
-    if(textLength != NULL) {
+    if(textLength != nullptr) {
         *textLength = textLen;
     }
 }
@@ -501,7 +501,7 @@ utrans_toRules(     const UTransliterator* trans,
                     UChar* result, int32_t resultLength,
                     UErrorCode* status) {
     utrans_ENTRY(status) 0;
-    if ( (result==NULL)? resultLength!=0: resultLength<0 ) {
+    if ( (result==nullptr)? resultLength!=0: resultLength<0 ) {
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -519,7 +519,7 @@ utrans_getSourceSet(const UTransliterator* trans,
                     UErrorCode* status) {
     utrans_ENTRY(status) fillIn;
 
-    if (fillIn == NULL) {
+    if (fillIn == nullptr) {
         fillIn = uset_openEmpty();
     }
     if (ignoreFilter) {
index 4676fd0aa1c584cb07a0b5c9b2effba49e6fda3f..ee8c75581c9fd20a153534b52cd3f0f3d4574ab0 100644 (file)
@@ -56,13 +56,13 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(Win32DateFormat)
 
 UnicodeString* Win32DateFormat::getTimeDateFormat(const Calendar *cal, const Locale *locale, UErrorCode &status) const
 {
-    UnicodeString *result = NULL;
+    UnicodeString *result = nullptr;
     const char *type = cal->getType();
     const char *base = locale->getBaseName();
     UResourceBundle *topBundle = ures_open((char *) 0, base, &status);
-    UResourceBundle *calBundle = ures_getByKey(topBundle, "calendar", NULL, &status);
-    UResourceBundle *typBundle = ures_getByKeyWithFallback(calBundle, type, NULL, &status);
-    UResourceBundle *patBundle = ures_getByKeyWithFallback(typBundle, "DateTimePatterns", NULL, &status);
+    UResourceBundle *calBundle = ures_getByKey(topBundle, "calendar", nullptr, &status);
+    UResourceBundle *typBundle = ures_getByKeyWithFallback(calBundle, type, nullptr, &status);
+    UResourceBundle *patBundle = ures_getByKeyWithFallback(typBundle, "DateTimePatterns", nullptr, &status);
 
     if (status == U_MISSING_RESOURCE_ERROR) {
         status = U_ZERO_ERROR;
@@ -160,7 +160,7 @@ static UErrorCode GetEquivalentWindowsLocaleName(const Locale& locale, UnicodeSt
 
 // TODO: Range-check timeStyle, dateStyle
 Win32DateFormat::Win32DateFormat(DateFormat::EStyle timeStyle, DateFormat::EStyle dateStyle, const Locale &locale, UErrorCode &status)
-  : DateFormat(), fDateTimeMsg(NULL), fTimeStyle(timeStyle), fDateStyle(dateStyle), fLocale(locale), fZoneID(), fWindowsLocaleName(nullptr)
+  : DateFormat(), fDateTimeMsg(nullptr), fTimeStyle(timeStyle), fDateStyle(dateStyle), fLocale(locale), fZoneID(), fWindowsLocaleName(nullptr)
 {
     if (U_SUCCESS(status)) {
         GetEquivalentWindowsLocaleName(locale, &fWindowsLocaleName);
@@ -199,7 +199,7 @@ Win32DateFormat &Win32DateFormat::operator=(const Win32DateFormat &other)
 
 //    delete fCalendar;
 
-    this->fDateTimeMsg = other.fDateTimeMsg == NULL ? NULL : new UnicodeString(*other.fDateTimeMsg);
+    this->fDateTimeMsg = other.fDateTimeMsg == nullptr ? nullptr : new UnicodeString(*other.fDateTimeMsg);
     this->fTimeStyle   = other.fTimeStyle;
     this->fDateStyle   = other.fDateStyle;
     this->fLocale      = other.fLocale;
@@ -209,7 +209,7 @@ Win32DateFormat &Win32DateFormat::operator=(const Win32DateFormat &other)
     this->fTZI = NEW_ARRAY(TIME_ZONE_INFORMATION, 1);
     *this->fTZI = *other.fTZI;
 
-    this->fWindowsLocaleName = other.fWindowsLocaleName == NULL ? NULL : new UnicodeString(*other.fWindowsLocaleName);
+    this->fWindowsLocaleName = other.fWindowsLocaleName == nullptr ? nullptr : new UnicodeString(*other.fWindowsLocaleName);
 
     return *this;
 }
@@ -271,7 +271,7 @@ void Win32DateFormat::parse(const UnicodeString& /* text */, Calendar& /* cal */
 
 void Win32DateFormat::adoptCalendar(Calendar *newCalendar)
 {
-    if (fCalendar == NULL || strcmp(fCalendar->getType(), newCalendar->getType()) != 0) {
+    if (fCalendar == nullptr || strcmp(fCalendar->getType(), newCalendar->getType()) != 0) {
         UErrorCode status = U_ZERO_ERROR;
 
         if (fDateStyle != DateFormat::kNone && fTimeStyle != DateFormat::kNone) {
@@ -317,15 +317,15 @@ void Win32DateFormat::formatDate(const SYSTEMTIME *st, UnicodeString &appendTo)
         localeName = reinterpret_cast<const wchar_t*>(toOldUCharPtr(fWindowsLocaleName->getTerminatedBuffer()));
     }
 
-    result = GetDateFormatEx(localeName, dfFlags[fDateStyle - kDateOffset], st, NULL, buffer, STACK_BUFFER_SIZE, NULL);
+    result = GetDateFormatEx(localeName, dfFlags[fDateStyle - kDateOffset], st, nullptr, buffer, STACK_BUFFER_SIZE, nullptr);
 
     if (result == 0) {
         if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-            int newLength = GetDateFormatEx(localeName, dfFlags[fDateStyle - kDateOffset], st, NULL, NULL, 0, NULL);
+            int newLength = GetDateFormatEx(localeName, dfFlags[fDateStyle - kDateOffset], st, nullptr, nullptr, 0, nullptr);
 
             buffer = NEW_ARRAY(wchar_t, newLength);
 
-            GetDateFormatEx(localeName, dfFlags[fDateStyle - kDateOffset], st, NULL, buffer, newLength, NULL);
+            GetDateFormatEx(localeName, dfFlags[fDateStyle - kDateOffset], st, nullptr, buffer, newLength, nullptr);
         }
     }
 
@@ -350,15 +350,15 @@ void Win32DateFormat::formatTime(const SYSTEMTIME *st, UnicodeString &appendTo)
         localeName = reinterpret_cast<const wchar_t*>(toOldUCharPtr(fWindowsLocaleName->getTerminatedBuffer()));
     }
 
-    result = GetTimeFormatEx(localeName, tfFlags[fTimeStyle], st, NULL, buffer, STACK_BUFFER_SIZE);
+    result = GetTimeFormatEx(localeName, tfFlags[fTimeStyle], st, nullptr, buffer, STACK_BUFFER_SIZE);
 
     if (result == 0) {
         if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-            int newLength = GetTimeFormatEx(localeName, tfFlags[fTimeStyle], st, NULL, NULL, 0);
+            int newLength = GetTimeFormatEx(localeName, tfFlags[fTimeStyle], st, nullptr, nullptr, 0);
 
             buffer = NEW_ARRAY(wchar_t, newLength);
 
-            GetTimeFormatEx(localeName, tfFlags[fTimeStyle], st, NULL, buffer, newLength);
+            GetTimeFormatEx(localeName, tfFlags[fTimeStyle], st, nullptr, buffer, newLength);
         }
     }
 
index 377d1af9bd2f10a5329ff9eea46e268ef5c3763b..05c95e9740a3b43f135d031dc52829a80542e1cf 100644 (file)
@@ -101,7 +101,7 @@ static void getNumberFormat(NUMBERFMTW *fmt, const wchar_t *windowsLocaleName)
 
 static void freeNumberFormat(NUMBERFMTW *fmt)
 {
-    if (fmt != NULL) {
+    if (fmt != nullptr) {
         DELETE_ARRAY(fmt->lpThousandSep);
         DELETE_ARRAY(fmt->lpDecimalSep);
     }
@@ -132,7 +132,7 @@ static void getCurrencyFormat(CURRENCYFMTW *fmt, const wchar_t *windowsLocaleNam
 
 static void freeCurrencyFormat(CURRENCYFMTW *fmt)
 {
-    if (fmt != NULL) {
+    if (fmt != nullptr) {
         DELETE_ARRAY(fmt->lpCurrencySymbol);
         DELETE_ARRAY(fmt->lpThousandSep);
         DELETE_ARRAY(fmt->lpDecimalSep);
@@ -204,7 +204,7 @@ static UErrorCode GetEquivalentWindowsLocaleName(const Locale& locale, UnicodeSt
 }
 
 Win32NumberFormat::Win32NumberFormat(const Locale &locale, UBool currency, UErrorCode &status)
-  : NumberFormat(), fCurrency(currency), fFormatInfo(NULL), fFractionDigitsSet(false), fWindowsLocaleName(nullptr)
+  : NumberFormat(), fCurrency(currency), fFormatInfo(nullptr), fFractionDigitsSet(false), fWindowsLocaleName(nullptr)
 {
     if (!U_FAILURE(status)) {
         fLCID = locale.getLCID();
@@ -246,7 +246,7 @@ Win32NumberFormat::Win32NumberFormat(const Locale &locale, UBool currency, UErro
 Win32NumberFormat::Win32NumberFormat(const Win32NumberFormat &other)
   : NumberFormat(other), fFormatInfo((FormatInfo*)uprv_malloc(sizeof(FormatInfo)))
 {
-    if (fFormatInfo != NULL) {
+    if (fFormatInfo != nullptr) {
         uprv_memset(fFormatInfo, 0, sizeof(*fFormatInfo));
     }
     *this = other;
@@ -254,7 +254,7 @@ Win32NumberFormat::Win32NumberFormat(const Win32NumberFormat &other)
 
 Win32NumberFormat::~Win32NumberFormat()
 {
-    if (fFormatInfo != NULL) {
+    if (fFormatInfo != nullptr) {
         if (fCurrency) {
             freeCurrencyFormat(&fFormatInfo->currency);
         } else {
@@ -275,7 +275,7 @@ Win32NumberFormat &Win32NumberFormat::operator=(const Win32NumberFormat &other)
     this->fLocale            = other.fLocale;
     this->fLCID              = other.fLCID;
     this->fFractionDigitsSet = other.fFractionDigitsSet;
-    this->fWindowsLocaleName = other.fWindowsLocaleName == NULL ? NULL : new UnicodeString(*other.fWindowsLocaleName);
+    this->fWindowsLocaleName = other.fWindowsLocaleName == nullptr ? nullptr : new UnicodeString(*other.fWindowsLocaleName);
     
     const wchar_t *localeName = nullptr;
 
@@ -344,7 +344,7 @@ UnicodeString &Win32NumberFormat::format(int32_t numDigits, UnicodeString &appen
 
     nBuffer[0] = 0x0000;
 
-    /* Due to the arguments causing a result to be <= 23 characters (+2 for NULL and minus),
+    /* Due to the arguments causing a result to be <= 23 characters (+2 for nullptr and minus),
     we don't need to reallocate the buffer. */
     va_start(args, fmt);
     result = _vsnwprintf(nBuffer, STACK_BUFFER_SIZE, fmt, args);
@@ -412,7 +412,7 @@ UnicodeString &Win32NumberFormat::format(int32_t numDigits, UnicodeString &appen
             DWORD lastError = GetLastError();
 
             if (lastError == ERROR_INSUFFICIENT_BUFFER) {
-                int newLength = GetCurrencyFormatEx(localeName, 0, nBuffer, &formatInfo.currency, NULL, 0);
+                int newLength = GetCurrencyFormatEx(localeName, 0, nBuffer, &formatInfo.currency, nullptr, 0);
 
                 buffer = NEW_ARRAY(wchar_t, newLength);
                 buffer[0] = 0x0000;
@@ -432,7 +432,7 @@ UnicodeString &Win32NumberFormat::format(int32_t numDigits, UnicodeString &appen
 
         if (result == 0) {
             if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
-                int newLength = GetNumberFormatEx(localeName, 0, nBuffer, &formatInfo.number, NULL, 0);
+                int newLength = GetNumberFormatEx(localeName, 0, nBuffer, &formatInfo.number, nullptr, 0);
 
                 buffer = NEW_ARRAY(wchar_t, newLength);
                 buffer[0] = 0x0000;
index 5f70d091becad4d0e91fc20bb1741f0b15a2ae5e..6de0e3584fc699ca9eaa19ceb18387e6817d9dee 100644 (file)
@@ -41,12 +41,12 @@ static UBool getSystemTimeInformation(TimeZone *tz, SYSTEMTIME &daylightDate, SY
     UErrorCode status = U_ZERO_ERROR;
     UBool result = true;
     BasicTimeZone *btz = (BasicTimeZone*)tz; // we should check type
-    InitialTimeZoneRule *initial = NULL;
-    AnnualTimeZoneRule *std = NULL, *dst = NULL;
+    InitialTimeZoneRule *initial = nullptr;
+    AnnualTimeZoneRule *std = nullptr, *dst = nullptr;
 
     btz->getSimpleRulesNear(uprv_getUTCtime(), initial, std, dst, status);
     if (U_SUCCESS(status)) {
-        if (std == NULL || dst == NULL) {
+        if (std == nullptr || dst == nullptr) {
             bias = -1 * (initial->getRawOffset()/60000);
             standardBias = 0;
             daylightBias = 0;
@@ -122,7 +122,7 @@ static UBool getWindowsTimeZoneInfo(TIME_ZONE_INFORMATION *zoneInfo, const UChar
     UnicodeString id = UnicodeString(icuid, length);
     TimeZone *tz = TimeZone::createTimeZone(id);
     
-    if (tz != NULL) {
+    if (tz != nullptr) {
         int32_t bias;
         int32_t daylightBias;
         int32_t standardBias;
index 7cf3a5e1312f039577c972aeb7a285ce7a7866ba..d3b89b70a5cf97bae0062d8d400f17ac2b26a217 100644 (file)
 static icu::UMutex gZoneMetaLock;
 
 // CLDR Canonical ID mapping table
-static UHashtable *gCanonicalIDCache = NULL;
+static UHashtable *gCanonicalIDCache = nullptr;
 static icu::UInitOnce gCanonicalIDCacheInitOnce {};
 
 // Metazone mapping table
-static UHashtable *gOlsonToMeta = NULL;
+static UHashtable *gOlsonToMeta = nullptr;
 static icu::UInitOnce gOlsonToMetaInitOnce {};
 
 // Available metazone IDs vector and table
-static icu::UVector *gMetaZoneIDs = NULL;
-static UHashtable *gMetaZoneIDTable = NULL;
+static icu::UVector *gMetaZoneIDs = nullptr;
+static UHashtable *gMetaZoneIDTable = nullptr;
 static icu::UInitOnce gMetaZoneIDsInitOnce {};
 
 // Country info vectors
-static icu::UVector *gSingleZoneCountries = NULL;
-static icu::UVector *gMultiZonesCountries = NULL;
+static icu::UVector *gSingleZoneCountries = nullptr;
+static icu::UVector *gMultiZonesCountries = nullptr;
 static icu::UInitOnce gCountryInfoVectorsInitOnce {};
 
 U_CDECL_BEGIN
@@ -57,32 +57,32 @@ U_CDECL_BEGIN
  */
 static UBool U_CALLCONV zoneMeta_cleanup(void)
 {
-    if (gCanonicalIDCache != NULL) {
+    if (gCanonicalIDCache != nullptr) {
         uhash_close(gCanonicalIDCache);
-        gCanonicalIDCache = NULL;
+        gCanonicalIDCache = nullptr;
     }
     gCanonicalIDCacheInitOnce.reset();
 
-    if (gOlsonToMeta != NULL) {
+    if (gOlsonToMeta != nullptr) {
         uhash_close(gOlsonToMeta);
-        gOlsonToMeta = NULL;
+        gOlsonToMeta = nullptr;
     }
     gOlsonToMetaInitOnce.reset();
 
-    if (gMetaZoneIDTable != NULL) {
+    if (gMetaZoneIDTable != nullptr) {
         uhash_close(gMetaZoneIDTable);
-        gMetaZoneIDTable = NULL;
+        gMetaZoneIDTable = nullptr;
     }
     // delete after closing gMetaZoneIDTable, because it holds
     // value objects held by the hashtable
     delete gMetaZoneIDs;
-    gMetaZoneIDs = NULL;
+    gMetaZoneIDs = nullptr;
     gMetaZoneIDsInitOnce.reset();
 
     delete gSingleZoneCountries;
-    gSingleZoneCountries = NULL;
+    gSingleZoneCountries = nullptr;
     delete gMultiZonesCountries;
-    gMultiZonesCountries = NULL;
+    gMultiZonesCountries = nullptr;
     gCountryInfoVectorsInitOnce.reset();
 
     return true;
@@ -212,12 +212,12 @@ parseDate (const UChar *text, UErrorCode &status) {
 }
 
 static void U_CALLCONV initCanonicalIDCache(UErrorCode &status) {
-    gCanonicalIDCache = uhash_open(uhash_hashUChars, uhash_compareUChars, NULL, &status);
-    if (gCanonicalIDCache == NULL) {
+    gCanonicalIDCache = uhash_open(uhash_hashUChars, uhash_compareUChars, nullptr, &status);
+    if (gCanonicalIDCache == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
     }
     if (U_FAILURE(status)) {
-        gCanonicalIDCache = NULL;
+        gCanonicalIDCache = nullptr;
     }
     // No key/value deleters - keys/values are from a resource bundle
     ucln_i18n_registerCleanup(UCLN_I18N_ZONEMETA, zoneMeta_cleanup);
@@ -227,21 +227,21 @@ static void U_CALLCONV initCanonicalIDCache(UErrorCode &status) {
 const UChar* U_EXPORT2
 ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     if (tzid.isBogus() || tzid.length() > ZID_KEY_MAX) {
         status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     // Checking the cached results
     umtx_initOnce(gCanonicalIDCacheInitOnce, &initCanonicalIDCache, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
-    const UChar *canonicalID = NULL;
+    const UChar *canonicalID = nullptr;
 
     UErrorCode tmpStatus = U_ZERO_ERROR;
     UChar utzid[ZID_KEY_MAX + 1];
@@ -251,7 +251,7 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
     if (!uprv_isInvariantUString(utzid, -1)) {
         // All of known tz IDs are only containing ASCII invariant characters.
         status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     // Check if it was already cached
@@ -261,7 +261,7 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
     }
     umtx_unlock(&gZoneMetaLock);
 
-    if (canonicalID != NULL) {
+    if (canonicalID != nullptr) {
         return canonicalID;
     }
 
@@ -278,8 +278,8 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
         }
     }
 
-    UResourceBundle *top = ures_openDirect(NULL, gKeyTypeData, &tmpStatus);
-    UResourceBundle *rb = ures_getByKey(top, gTypeMapTag, NULL, &tmpStatus);
+    UResourceBundle *top = ures_openDirect(nullptr, gKeyTypeData, &tmpStatus);
+    UResourceBundle *rb = ures_getByKey(top, gTypeMapTag, nullptr, &tmpStatus);
     ures_getByKey(rb, gTimezoneTag, rb, &tmpStatus);
     ures_getByKey(rb, id, rb, &tmpStatus);
     if (U_SUCCESS(tmpStatus)) {
@@ -289,21 +289,21 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
         isInputCanonical = true;
     }
 
-    if (canonicalID == NULL) {
+    if (canonicalID == nullptr) {
         // If a map element not found, then look for an alias
         tmpStatus = U_ZERO_ERROR;
         ures_getByKey(top, gTypeAliasTag, rb, &tmpStatus);
         ures_getByKey(rb, gTimezoneTag, rb, &tmpStatus);
-        const UChar *canonical = ures_getStringByKey(rb,id,NULL,&tmpStatus);
+        const UChar *canonical = ures_getStringByKey(rb,id,nullptr,&tmpStatus);
         if (U_SUCCESS(tmpStatus)) {
             // canonical map found
             canonicalID = canonical;
         }
 
-        if (canonicalID == NULL) {
+        if (canonicalID == nullptr) {
             // Dereference the input ID using the tz data
             const UChar *derefer = TimeZone::dereferOlsonLink(tzid);
-            if (derefer == NULL) {
+            if (derefer == nullptr) {
                 status = U_ILLEGAL_ARGUMENT_ERROR;
             } else {
                 int32_t len = u_strlen(derefer);
@@ -322,7 +322,7 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
                 // rb still points to the alias table, so we don't have to go looking
                 // for it.
                 tmpStatus = U_ZERO_ERROR;
-                canonical = ures_getStringByKey(rb,id,NULL,&tmpStatus);
+                canonical = ures_getStringByKey(rb,id,nullptr,&tmpStatus);
                 if (U_SUCCESS(tmpStatus)) {
                     // canonical map for the dereferenced ID found
                     canonicalID = canonical;
@@ -337,26 +337,26 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
     ures_close(top);
 
     if (U_SUCCESS(status)) {
-        U_ASSERT(canonicalID != NULL);  // canocanilD must be non-NULL here
+        U_ASSERT(canonicalID != nullptr);  // canocanilD must be non-nullptr here
 
         // Put the resolved canonical ID to the cache
         umtx_lock(&gZoneMetaLock);
         {
             const UChar* idInCache = (const UChar *)uhash_get(gCanonicalIDCache, utzid);
-            if (idInCache == NULL) {
+            if (idInCache == nullptr) {
                 const UChar* key = ZoneMeta::findTimeZoneID(tzid);
-                U_ASSERT(key != NULL);
-                if (key != NULL) {
+                U_ASSERT(key != nullptr);
+                if (key != nullptr) {
                     idInCache = (const UChar *)uhash_put(gCanonicalIDCache, (void *)key, (void *)canonicalID, &status);
-                    U_ASSERT(idInCache == NULL);
+                    U_ASSERT(idInCache == nullptr);
                 }
             }
             if (U_SUCCESS(status) && isInputCanonical) {
                 // Also put canonical ID itself into the cache if not exist
                 const UChar *canonicalInCache = (const UChar*)uhash_get(gCanonicalIDCache, canonicalID);
-                if (canonicalInCache == NULL) {
+                if (canonicalInCache == nullptr) {
                     canonicalInCache = (const UChar *)uhash_put(gCanonicalIDCache, (void *)canonicalID, (void *)canonicalID, &status);
-                    U_ASSERT(canonicalInCache == NULL);
+                    U_ASSERT(canonicalInCache == nullptr);
                 }
             }
         }
@@ -369,7 +369,7 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
 UnicodeString& U_EXPORT2
 ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UnicodeString &systemID, UErrorCode& status) {
     const UChar *canonicalID = getCanonicalCLDRID(tzid, status);
-    if (U_FAILURE(status) || canonicalID == NULL) {
+    if (U_FAILURE(status) || canonicalID == nullptr) {
         systemID.setToBogus();
         return systemID;
     }
@@ -379,7 +379,7 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UnicodeString &systemID,
 
 const UChar* U_EXPORT2
 ZoneMeta::getCanonicalCLDRID(const TimeZone& tz) {
-    if (dynamic_cast<const OlsonTimeZone *>(&tz) != NULL) {
+    if (dynamic_cast<const OlsonTimeZone *>(&tz) != nullptr) {
         // short cut for OlsonTimeZone
         const OlsonTimeZone *otz = (const OlsonTimeZone*)&tz;
         return otz->getCanonicalID();
@@ -392,40 +392,40 @@ ZoneMeta::getCanonicalCLDRID(const TimeZone& tz) {
 static void U_CALLCONV countryInfoVectorsInit(UErrorCode &status) {
     // Create empty vectors
     // No deleters for these UVectors, it's a reference to a resource bundle string.
-    gSingleZoneCountries = new UVector(NULL, uhash_compareUChars, status);
-    if (gSingleZoneCountries == NULL) {
+    gSingleZoneCountries = new UVector(nullptr, uhash_compareUChars, status);
+    if (gSingleZoneCountries == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
     }
-    gMultiZonesCountries = new UVector(NULL, uhash_compareUChars, status);
-    if (gMultiZonesCountries == NULL) {
+    gMultiZonesCountries = new UVector(nullptr, uhash_compareUChars, status);
+    if (gMultiZonesCountries == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
     }
 
     if (U_FAILURE(status)) {
         delete gSingleZoneCountries;
         delete gMultiZonesCountries;
-        gSingleZoneCountries = NULL;
-        gMultiZonesCountries  = NULL;
+        gSingleZoneCountries = nullptr;
+        gMultiZonesCountries  = nullptr;
     }
     ucln_i18n_registerCleanup(UCLN_I18N_ZONEMETA, zoneMeta_cleanup);
 }
 
 
 UnicodeString& U_EXPORT2
-ZoneMeta::getCanonicalCountry(const UnicodeString &tzid, UnicodeString &country, UBool *isPrimary /* = NULL */) {
-    if (isPrimary != NULL) {
+ZoneMeta::getCanonicalCountry(const UnicodeString &tzid, UnicodeString &country, UBool *isPrimary /* = nullptr */) {
+    if (isPrimary != nullptr) {
         *isPrimary = false;
     }
 
     const UChar *region = TimeZone::getRegion(tzid);
-    if (region != NULL && u_strcmp(gWorld, region) != 0) {
+    if (region != nullptr && u_strcmp(gWorld, region) != 0) {
         country.setTo(region, -1);
     } else {
         country.setToBogus();
         return country;
     }
 
-    if (isPrimary != NULL) {
+    if (isPrimary != nullptr) {
         char regionBuf[] = {0, 0, 0};
 
         // Checking the cached results
@@ -455,7 +455,7 @@ ZoneMeta::getCanonicalCountry(const UnicodeString &tzid, UnicodeString &country,
 
             u_UCharsToChars(region, regionBuf, 2);
 
-            StringEnumeration *ids = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL_LOCATION, regionBuf, NULL, status);
+            StringEnumeration *ids = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL_LOCATION, regionBuf, nullptr, status);
             int32_t idsLen = ids->count(status);
             if (U_SUCCESS(status) && idsLen == 1) {
                 // only the single zone is available for the region
@@ -492,7 +492,7 @@ ZoneMeta::getCanonicalCountry(const UnicodeString &tzid, UnicodeString &country,
                 u_UCharsToChars(region, regionBuf, 2);
             }
 
-            UResourceBundle *rb = ures_openDirect(NULL, gMetaZones, &status);
+            UResourceBundle *rb = ures_openDirect(nullptr, gMetaZones, &status);
             ures_getByKey(rb, gPrimaryZonesTag, rb, &status);
             const UChar *primaryZone = ures_getStringByKey(rb, regionBuf, &idLen, &status);
             if (U_SUCCESS(status)) {
@@ -518,7 +518,7 @@ UnicodeString& U_EXPORT2
 ZoneMeta::getMetazoneID(const UnicodeString &tzid, UDate date, UnicodeString &result) {
     UBool isSet = false;
     const UVector *mappings = getMetazoneMappings(tzid);
-    if (mappings != NULL) {
+    if (mappings != nullptr) {
         for (int32_t i = 0; i < mappings->size(); i++) {
             OlsonToMetaMappingEntry *mzm = (OlsonToMetaMappingEntry*)mappings->elementAt(i);
             if (mzm->from <= date && mzm->to > date) {
@@ -535,11 +535,11 @@ ZoneMeta::getMetazoneID(const UnicodeString &tzid, UDate date, UnicodeString &re
 }
 
 static void U_CALLCONV olsonToMetaInit(UErrorCode &status) {
-    U_ASSERT(gOlsonToMeta == NULL);
+    U_ASSERT(gOlsonToMeta == nullptr);
     ucln_i18n_registerCleanup(UCLN_I18N_ZONEMETA, zoneMeta_cleanup);
-    gOlsonToMeta = uhash_open(uhash_hashUChars, uhash_compareUChars, NULL, &status);
+    gOlsonToMeta = uhash_open(uhash_hashUChars, uhash_compareUChars, nullptr, &status);
     if (U_FAILURE(status)) {
-        gOlsonToMeta = NULL;
+        gOlsonToMeta = nullptr;
     } else {
         uhash_setKeyDeleter(gOlsonToMeta, deleteUCharString);
         uhash_setValueDeleter(gOlsonToMeta, uprv_deleteUObject);
@@ -553,16 +553,16 @@ ZoneMeta::getMetazoneMappings(const UnicodeString &tzid) {
     UChar tzidUChars[ZID_KEY_MAX + 1];
     tzid.extract(tzidUChars, ZID_KEY_MAX + 1, status);
     if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING) {
-        return NULL;
+        return nullptr;
     }
 
     umtx_initOnce(gOlsonToMetaInitOnce, &olsonToMetaInit, status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     // get the mapping from cache
-    const UVector *result = NULL;
+    const UVector *result = nullptr;
 
     umtx_lock(&gZoneMetaLock);
     {
@@ -570,15 +570,15 @@ ZoneMeta::getMetazoneMappings(const UnicodeString &tzid) {
     }
     umtx_unlock(&gZoneMetaLock);
 
-    if (result != NULL) {
+    if (result != nullptr) {
         return result;
     }
 
     // miss the cache - create new one
     UVector *tmpResult = createMetazoneMappings(tzid);
-    if (tmpResult == NULL) {
+    if (tmpResult == nullptr) {
         // not available
-        return NULL;
+        return nullptr;
     }
 
     // put the new one into the cache
@@ -586,20 +586,20 @@ ZoneMeta::getMetazoneMappings(const UnicodeString &tzid) {
     {
         // make sure it's already created
         result = (UVector*) uhash_get(gOlsonToMeta, tzidUChars);
-        if (result == NULL) {
+        if (result == nullptr) {
             // add the one just created
             int32_t tzidLen = tzid.length() + 1;
             UChar *key = (UChar*)uprv_malloc(tzidLen * sizeof(UChar));
-            if (key == NULL) {
-                // memory allocation error..  just return NULL
-                result = NULL;
+            if (key == nullptr) {
+                // memory allocation error..  just return nullptr
+                result = nullptr;
                 delete tmpResult;
             } else {
                 tzid.extract(key, tzidLen, status);
                 uhash_put(gOlsonToMeta, key, tmpResult, &status);
                 if (U_FAILURE(status)) {
                     // delete the mapping
-                    result = NULL;
+                    result = nullptr;
                     delete tmpResult;
                 } else {
                     result = tmpResult;
@@ -621,7 +621,7 @@ ZoneMeta::createMetazoneMappings(const UnicodeString &tzid) {
     UErrorCode status = U_ZERO_ERROR;
 
     UnicodeString canonicalID;
-    UResourceBundle *rb = ures_openDirect(NULL, gMetaZones, &status);
+    UResourceBundle *rb = ures_openDirect(nullptr, gMetaZones, &status);
     ures_getByKey(rb, gMetazoneInfo, rb, &status);
     getCanonicalCLDRID(tzid, canonicalID, status);
 
@@ -642,17 +642,17 @@ ZoneMeta::createMetazoneMappings(const UnicodeString &tzid) {
         ures_getByKey(rb, tzKey, rb, &status);
 
         if (U_SUCCESS(status)) {
-            UResourceBundle *mz = NULL;
+            UResourceBundle *mz = nullptr;
             while (ures_hasNext(rb)) {
                 mz = ures_getNextResource(rb, mz, &status);
 
-                const UChar *mz_name = ures_getStringByIndex(mz, 0, NULL, &status);
+                const UChar *mz_name = ures_getStringByIndex(mz, 0, nullptr, &status);
                 const UChar *mz_from = gDefaultFrom;
                 const UChar *mz_to = gDefaultTo;
 
                 if (ures_getSize(mz) == 3) {
-                    mz_from = ures_getStringByIndex(mz, 1, NULL, &status);
-                    mz_to   = ures_getStringByIndex(mz, 2, NULL, &status);
+                    mz_from = ures_getStringByIndex(mz, 1, nullptr, &status);
+                    mz_to   = ures_getStringByIndex(mz, 2, nullptr, &status);
                 }
 
                 if(U_FAILURE(status)){
@@ -700,7 +700,7 @@ ZoneMeta::createMetazoneMappings(const UnicodeString &tzid) {
 UnicodeString& U_EXPORT2
 ZoneMeta::getZoneIdByMetazone(const UnicodeString &mzid, const UnicodeString &region, UnicodeString &result) {
     UErrorCode status = U_ZERO_ERROR;
-    const UChar *tzid = NULL;
+    const UChar *tzid = nullptr;
     int32_t tzidLen = 0;
     char keyBuf[ZID_KEY_MAX + 1];
     int32_t keyLen = 0;
@@ -713,7 +713,7 @@ ZoneMeta::getZoneIdByMetazone(const UnicodeString &mzid, const UnicodeString &re
     keyLen = mzid.extract(0, mzid.length(), keyBuf, ZID_KEY_MAX + 1, US_INV);
     keyBuf[keyLen] = 0;
 
-    UResourceBundle *rb = ures_openDirect(NULL, gMetaZones, &status);
+    UResourceBundle *rb = ures_openDirect(nullptr, gMetaZones, &status);
     ures_getByKey(rb, gMapTimezonesTag, rb, &status);
     ures_getByKey(rb, keyBuf, rb, &status);
 
@@ -727,14 +727,14 @@ ZoneMeta::getZoneIdByMetazone(const UnicodeString &mzid, const UnicodeString &re
                 status = U_ZERO_ERROR;
             }
         }
-        if (U_SUCCESS(status) && tzid == NULL) {
+        if (U_SUCCESS(status) && tzid == nullptr) {
             // try "001"
             tzid = ures_getStringByKey(rb, gWorldTag, &tzidLen, &status);
         }
     }
     ures_close(rb);
 
-    if (tzid == NULL) {
+    if (tzid == nullptr) {
         result.setToBogus();
     } else {
         result.setTo(tzid, tzidLen);
@@ -744,30 +744,30 @@ ZoneMeta::getZoneIdByMetazone(const UnicodeString &mzid, const UnicodeString &re
 }
 
 static void U_CALLCONV initAvailableMetaZoneIDs () {
-    U_ASSERT(gMetaZoneIDs == NULL);
-    U_ASSERT(gMetaZoneIDTable == NULL);
+    U_ASSERT(gMetaZoneIDs == nullptr);
+    U_ASSERT(gMetaZoneIDTable == nullptr);
     ucln_i18n_registerCleanup(UCLN_I18N_ZONEMETA, zoneMeta_cleanup);
 
     UErrorCode status = U_ZERO_ERROR;
-    gMetaZoneIDTable = uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, NULL, &status);
-    if (U_FAILURE(status) || gMetaZoneIDTable == NULL) {
-        gMetaZoneIDTable = NULL;
+    gMetaZoneIDTable = uhash_open(uhash_hashUnicodeString, uhash_compareUnicodeString, nullptr, &status);
+    if (U_FAILURE(status) || gMetaZoneIDTable == nullptr) {
+        gMetaZoneIDTable = nullptr;
         return;
     }
     uhash_setKeyDeleter(gMetaZoneIDTable, uprv_deleteUObject);
     // No valueDeleter, because the vector maintain the value objects
-    gMetaZoneIDs = new UVector(NULL, uhash_compareUChars, status);
-    if (U_FAILURE(status) || gMetaZoneIDs == NULL) {
+    gMetaZoneIDs = new UVector(nullptr, uhash_compareUChars, status);
+    if (U_FAILURE(status) || gMetaZoneIDs == nullptr) {
         delete gMetaZoneIDs;
-        gMetaZoneIDs = NULL;
+        gMetaZoneIDs = nullptr;
         uhash_close(gMetaZoneIDTable);
-        gMetaZoneIDTable = NULL;
+        gMetaZoneIDTable = nullptr;
         return;
     }
     gMetaZoneIDs->setDeleter(uprv_free);
 
-    UResourceBundle *rb = ures_openDirect(NULL, gMetaZones, &status);
-    UResourceBundle *bundle = ures_getByKey(rb, gMapTimezonesTag, NULL, &status);
+    UResourceBundle *rb = ures_openDirect(nullptr, gMetaZones, &status);
+    UResourceBundle *bundle = ures_getByKey(rb, gMapTimezonesTag, nullptr, &status);
     StackUResourceBundle res;
     while (U_SUCCESS(status) && ures_hasNext(bundle)) {
         ures_getNextResource(bundle, res.getAlias(), &status);
@@ -787,7 +787,7 @@ static void U_CALLCONV initAvailableMetaZoneIDs () {
         if (U_FAILURE(status)) {
             break;
         }
-        if (uhash_get(gMetaZoneIDTable, usMzID.getAlias()) == NULL) {
+        if (uhash_get(gMetaZoneIDTable, usMzID.getAlias()) == nullptr) {
             // Note: gMetaZoneIDTable adopts its keys, but not its values.
             //       gMetaZoneIDs adopts its values.
             uhash_put(gMetaZoneIDTable, usMzID.orphan(), uMzID.getAlias(), &status);
@@ -800,8 +800,8 @@ static void U_CALLCONV initAvailableMetaZoneIDs () {
     if (U_FAILURE(status)) {
         uhash_close(gMetaZoneIDTable);
         delete gMetaZoneIDs;
-        gMetaZoneIDTable = NULL;
-        gMetaZoneIDs = NULL;
+        gMetaZoneIDTable = nullptr;
+        gMetaZoneIDs = nullptr;
     }
 }
 
@@ -814,8 +814,8 @@ ZoneMeta::getAvailableMetazoneIDs() {
 const UChar*
 ZoneMeta::findMetaZoneID(const UnicodeString& mzid) {
     umtx_initOnce(gMetaZoneIDsInitOnce, &initAvailableMetaZoneIDs);
-    if (gMetaZoneIDTable == NULL) {
-        return NULL;
+    if (gMetaZoneIDTable == nullptr) {
+        return nullptr;
     }
     return (const UChar*)uhash_get(gMetaZoneIDTable, &mzid);
 }
@@ -874,14 +874,14 @@ ZoneMeta::formatCustomID(uint8_t hour, uint8_t min, uint8_t sec, UBool negative,
 
 const UChar*
 ZoneMeta::getShortID(const TimeZone& tz) {
-    const UChar* canonicalID = NULL;
-    if (dynamic_cast<const OlsonTimeZone *>(&tz) != NULL) {
+    const UChar* canonicalID = nullptr;
+    if (dynamic_cast<const OlsonTimeZone *>(&tz) != nullptr) {
         // short cut for OlsonTimeZone
         const OlsonTimeZone *otz = (const OlsonTimeZone*)&tz;
         canonicalID = otz->getCanonicalID();
     }
-    if (canonicalID == NULL) {
-        return NULL;
+    if (canonicalID == nullptr) {
+        return nullptr;
     }
     return getShortIDFromCanonical(canonicalID);
 }
@@ -890,15 +890,15 @@ const UChar*
 ZoneMeta::getShortID(const UnicodeString& id) {
     UErrorCode status = U_ZERO_ERROR;
     const UChar* canonicalID = ZoneMeta::getCanonicalCLDRID(id, status);
-    if (U_FAILURE(status) || canonicalID == NULL) {
-        return NULL;
+    if (U_FAILURE(status) || canonicalID == nullptr) {
+        return nullptr;
     }
     return ZoneMeta::getShortIDFromCanonical(canonicalID);
 }
 
 const UChar*
 ZoneMeta::getShortIDFromCanonical(const UChar* canonicalID) {
-    const UChar* shortID = NULL;
+    const UChar* shortID = nullptr;
     int32_t len = u_strlen(canonicalID);
     char tzidKey[ZID_KEY_MAX + 1];
 
@@ -914,10 +914,10 @@ ZoneMeta::getShortIDFromCanonical(const UChar* canonicalID) {
     }
 
     UErrorCode status = U_ZERO_ERROR;
-    UResourceBundle *rb = ures_openDirect(NULL, gKeyTypeData, &status);
+    UResourceBundle *rb = ures_openDirect(nullptr, gKeyTypeData, &status);
     ures_getByKey(rb, gTypeMapTag, rb, &status);
     ures_getByKey(rb, gTimezoneTag, rb, &status);
-    shortID = ures_getStringByKey(rb, tzidKey, NULL, &status);
+    shortID = ures_getStringByKey(rb, tzidKey, nullptr, &status);
     ures_close(rb);
 
     return shortID;
index 97c0e6057d7c64c2e1d3ee57f0675ecc530df8f8..dad867ce1ea0a8c1109101dd1173f47bf196e5ef 100644 (file)
@@ -62,7 +62,7 @@ public:
      * @param isPrimary [output] true if the zone is the primary zone for the country
      * @return A reference to the result country
      */
-    static UnicodeString& U_EXPORT2 getCanonicalCountry(const UnicodeString &tzid, UnicodeString &country, UBool *isPrimary = NULL);
+    static UnicodeString& U_EXPORT2 getCanonicalCountry(const UnicodeString &tzid, UnicodeString &country, UBool *isPrimary = nullptr);
 
     /**
      * Returns a CLDR metazone ID for the given Olson tzid and time.
@@ -78,13 +78,13 @@ public:
     static const UVector* U_EXPORT2 getAvailableMetazoneIDs();
 
     /**
-     * Returns the pointer to the persistent time zone ID string, or NULL if the given tzid is not in the
+     * Returns the pointer to the persistent time zone ID string, or nullptr if the given tzid is not in the
      * tz database. This method is useful when you maintain persistent zone IDs without duplication.
      */
     static const UChar* U_EXPORT2 findTimeZoneID(const UnicodeString& tzid);
 
     /**
-     * Returns the pointer to the persistent meta zone ID string, or NULL if the given mzid is not available.
+     * Returns the pointer to the persistent meta zone ID string, or nullptr if the given mzid is not available.
      * This method is useful when you maintain persistent meta zone IDs without duplication.
      */
     static const UChar* U_EXPORT2 findMetaZoneID(const UnicodeString& mzid);
index 6c79b61018033044afb0e4c4d9ef770903dc0680..3832b917d634c1bc66142da6dae630fe4bf39454 100644 (file)
@@ -39,7 +39,7 @@ static UBool U_CALLCONV locbund_cleanup(void) {
     int32_t style;
     for (style = 0; style < ULOCALEBUNDLE_NUMBERFORMAT_COUNT; style++) {
         unum_close(gPosixNumberFormat[style]);
-        gPosixNumberFormat[style] = NULL;
+        gPosixNumberFormat[style] = nullptr;
     }
     return true;
 }
@@ -49,17 +49,17 @@ static inline UNumberFormat * copyInvariantFormatter(ULocaleBundle *result, UNum
     U_NAMESPACE_USE
     static UMutex gLock;
     Mutex lock(&gLock);
-    if (result->fNumberFormat[style-1] == NULL) {
-        if (gPosixNumberFormat[style-1] == NULL) {
+    if (result->fNumberFormat[style-1] == nullptr) {
+        if (gPosixNumberFormat[style-1] == nullptr) {
             UErrorCode status = U_ZERO_ERROR;
-            UNumberFormat *formatAlias = unum_open(style, NULL, 0, "en_US_POSIX", NULL, &status);
+            UNumberFormat *formatAlias = unum_open(style, nullptr, 0, "en_US_POSIX", nullptr, &status);
             if (U_SUCCESS(status)) {
                 gPosixNumberFormat[style-1] = formatAlias;
                 ucln_io_registerCleanup(UCLN_IO_LOCBUND, locbund_cleanup);
             }
         }
         /* Copy the needed formatter. */
-        if (gPosixNumberFormat[style-1] != NULL) {
+        if (gPosixNumberFormat[style-1] != nullptr) {
             UErrorCode status = U_ZERO_ERROR;
             result->fNumberFormat[style-1] = unum_clone(gPosixNumberFormat[style-1], &status);
         }
@@ -75,7 +75,7 @@ u_locbund_init(ULocaleBundle *result, const char *loc)
     if(result == 0)
         return 0;
 
-    if (loc == NULL) {
+    if (loc == nullptr) {
         loc = uloc_getDefault();
     }
 
@@ -124,11 +124,11 @@ u_locbund_clone(const ULocaleBundle *bundle)
         if (result->fNumberFormat[styleIdx]) {
             result->fNumberFormat[styleIdx] = unum_clone(bundle->fNumberFormat[styleIdx], &status);
             if (U_FAILURE(status)) {
-                result->fNumberFormat[styleIdx] = NULL;
+                result->fNumberFormat[styleIdx] = nullptr;
             }
         }
         else {
-            result->fNumberFormat[styleIdx] = NULL;
+            result->fNumberFormat[styleIdx] = nullptr;
         }
     }
     result->fDateFormat         = (bundle->fDateFormat == 0 ? 0 :
@@ -159,19 +159,19 @@ u_locbund_close(ULocaleBundle *bundle)
 U_CAPI UNumberFormat *
 u_locbund_getNumberFormat(ULocaleBundle *bundle, UNumberFormatStyle style)
 {
-    UNumberFormat *formatAlias = NULL;
+    UNumberFormat *formatAlias = nullptr;
     if (style > UNUM_IGNORE) {
         formatAlias = bundle->fNumberFormat[style-1];
-        if (formatAlias == NULL) {
+        if (formatAlias == nullptr) {
             if (bundle->isInvariantLocale) {
                 formatAlias = copyInvariantFormatter(bundle, style);
             }
             else {
                 UErrorCode status = U_ZERO_ERROR;
-                formatAlias = unum_open(style, NULL, 0, bundle->fLocale, NULL, &status);
+                formatAlias = unum_open(style, nullptr, 0, bundle->fLocale, nullptr, &status);
                 if (U_FAILURE(status)) {
                     unum_close(formatAlias);
-                    formatAlias = NULL;
+                    formatAlias = nullptr;
                 }
                 else {
                     bundle->fNumberFormat[style-1] = formatAlias;
index 03c747c861451ebd582881c42876ff757a8ea3b8..aeb5abed53c9bd3577ac84a36d862c55b8c9cfcb 100644 (file)
@@ -103,11 +103,11 @@ u_vsscanf_u(const UChar *buffer,
     int32_t         converted;
     UFILE           inStr;
 
-    inStr.fConverter = NULL;
-    inStr.fFile = NULL;
+    inStr.fConverter = nullptr;
+    inStr.fFile = nullptr;
     inStr.fOwnFile = false;
 #if !UCONFIG_NO_TRANSLITERATION
-    inStr.fTranslit = NULL;
+    inStr.fTranslit = nullptr;
 #endif
     inStr.fUCBuffer[0] = 0;
     inStr.str.fBuffer = (UChar *)buffer;
index cf7d88be4c832457ec66ce5a524cbec1240f747d..28c42d315760cdd824894d6a11e45ce3ce7b3e70 100644 (file)
@@ -45,7 +45,7 @@ static UBool U_CALLCONV io_cleanup(void)
         if (gCleanupFunctions[libType])
         {
             gCleanupFunctions[libType]();
-            gCleanupFunctions[libType] = NULL;
+            gCleanupFunctions[libType] = nullptr;
         }
     }
 #if !UCLN_NO_AUTO_CLEANUP && (defined(UCLN_AUTO_ATEXIT) || defined(UCLN_AUTO_LOCAL))
index afd672faa0b59946dd5a72da24f12ce01ab4344a..37786ebbf4f5395168732cb3d6fb5db53ab0af49 100644 (file)
@@ -68,11 +68,11 @@ finit_owner(FILE         *f,
 {
     UErrorCode status = U_ZERO_ERROR;
     UFILE     *result;
-    if(f == NULL) {
+    if(f == nullptr) {
         return 0;
     }
     result = (UFILE*) uprv_malloc(sizeof(UFILE));
-    if(result == NULL) {
+    if(result == nullptr) {
         return 0;
     }
 
@@ -94,10 +94,10 @@ finit_owner(FILE         *f,
 #endif
 
     /* If the codepage is not "" use the ucnv_open default behavior */
-    if(codepage == NULL || *codepage != '\0') {
+    if(codepage == nullptr || *codepage != '\0') {
         result->fConverter = ucnv_open(codepage, &status);
     }
-    /* else result->fConverter is already memset'd to NULL. */
+    /* else result->fConverter is already memset'd to nullptr. */
 
     if(U_SUCCESS(status)) {
         result->fOwnFile = takeOwnership;
@@ -108,7 +108,7 @@ finit_owner(FILE         *f,
 #endif
         /* DO NOT fclose here!!!!!! */
         uprv_free(result);
-        result = NULL;
+        result = nullptr;
     }
 
     return result;
@@ -196,14 +196,14 @@ u_fopen_u(const UChar   *filename,
         wchar_t wperm[40] = {};
         size_t  retVal;
         mbstowcs_s(&retVal, wperm, UPRV_LENGTHOF(wperm), perm, _TRUNCATE);
-        FILE *systemFile = _wfopen(reinterpret_cast<const wchar_t *>(filename), wperm); // may return NULL for long filename
+        FILE *systemFile = _wfopen(reinterpret_cast<const wchar_t *>(filename), wperm); // may return nullptr for long filename
         if (systemFile) {
             result = finit_owner(systemFile, locale, codepage, true);
         }
         if (!result && systemFile) {
             /* Something bad happened.
                Maybe the converter couldn't be opened.
-               Bu do not fclose(systemFile) if systemFile is NULL. */
+               Bu do not fclose(systemFile) if systemFile is nullptr. */
             fclose(systemFile);
         }
     }
@@ -223,13 +223,13 @@ u_fstropen(UChar *stringBuf,
     UFILE *result;
 
     if (capacity < 0) {
-        return NULL;
+        return nullptr;
     }
 
     result = (UFILE*) uprv_malloc(sizeof(UFILE));
     /* Null pointer test */
-    if (result == NULL) {
-        return NULL; /* Just get out. */
+    if (result == nullptr) {
+        return nullptr; /* Just get out. */
     }
     uprv_memset(result, 0, sizeof(UFILE));
     result->str.fBuffer = stringBuf;
@@ -252,11 +252,11 @@ U_CAPI UBool U_EXPORT2
 u_feof(UFILE  *f)
 {
     UBool endOfBuffer;
-    if (f == NULL) {
+    if (f == nullptr) {
         return true;
     }
     endOfBuffer = (UBool)(f->str.fPos >= f->str.fLimit);
-    if (f->fFile != NULL) {
+    if (f->fFile != nullptr) {
         return endOfBuffer && feof(f->fFile);
     }
     return endOfBuffer;
@@ -339,7 +339,7 @@ U_CAPI const char* U_EXPORT2 /* U_CAPI ... U_EXPORT2 added by Peter Kirk 17 Nov
 u_fgetcodepage(UFILE        *file)
 {
     UErrorCode     status = U_ZERO_ERROR;
-    const char     *codepage = NULL;
+    const char     *codepage = nullptr;
 
     if (file->fConverter) {
         codepage = ucnv_getName(file->fConverter, &status);
index 9c7bedf2be880e64b2c2ef71269e69e231f2cd91..410df1ec54411c11a5264ab3a2e74509c92f056e 100644 (file)
@@ -178,7 +178,7 @@ ufmt_utop(const UChar     *buffer,
     /* initialize variables */
     count      = 0;
     offset     = 0;
-    result.ptr = NULL;
+    result.ptr = nullptr;
 
     /* Skip the leading zeros */
     while(buffer[count] == DIGIT_0 || u_isspace(buffer[count])) {
@@ -243,7 +243,7 @@ ufmt_defaultCPToUnicode(const char *s, int32_t sSize,
         
         alias = target;
         ucnv_toUnicode(defConverter, &alias, alias + tSize, &s, s + sSize - 1, 
-            NULL, true, &status);
+            nullptr, true, &status);
         
         
         /* add the null terminator */
index 5bbe59ed50e91abb12d270aecb5a018a5360657a..73c2b66979144c53898c7338dfd33e497ad5b80a 100644 (file)
 
 U_NAMESPACE_USE
 
-static UFILE *gStdOut = NULL;
+static UFILE *gStdOut = nullptr;
 static UInitOnce gStdOutInitOnce {};
 
 static UBool U_CALLCONV uprintf_cleanup(void)
 {
-    if (gStdOut != NULL) {
+    if (gStdOut != nullptr) {
         u_fclose(gStdOut);
-        gStdOut = NULL;
+        gStdOut = nullptr;
     }
     gStdOutInitOnce.reset();
     return true;
 }
 
 static void U_CALLCONV u_stdout_init() {
-    U_ASSERT(gStdOut ==  NULL);
-    gStdOut = u_finit(stdout, NULL, NULL);
+    U_ASSERT(gStdOut ==  nullptr);
+    gStdOut = u_finit(stdout, nullptr, nullptr);
     ucln_io_registerCleanup(UCLN_IO_PRINTF, &uprintf_cleanup);
 }
 
@@ -209,7 +209,7 @@ u_vfprintf_u(    UFILE        *f,
     int32_t          written = 0;   /* haven't written anything yet */
 
     /* parse and print the whole format string */
-    u_printf_parse(&g_stream_handler, patternSpecification, f, NULL, &f->str.fBundle, &written, ap);
+    u_printf_parse(&g_stream_handler, patternSpecification, f, nullptr, &f->str.fBundle, &written, ap);
 
     /* return # of UChars written */
     return written;
index ba30fbcaf4867bfdcf6e06484a498c0ed7d8a9e2..2b6743d9fd91143cac474fa84004a4cdb52c62ce 100644 (file)
@@ -71,7 +71,7 @@
 #define UFMT_USTRING        {ufmt_ustring, u_printf_ustring_handler}
 
 
-#define UFMT_EMPTY {ufmt_empty, NULL}
+#define UFMT_EMPTY {ufmt_empty, nullptr}
 
 /**
  * A u_printf handler function.  
@@ -215,7 +215,7 @@ u_printf_string_handler(const u_printf_stream_handler  *handler,
             s = ufmt_defaultCPToUnicode(arg, argSize,
                     (UChar *)uprv_malloc(MAX_UCHAR_BUFFER_NEEDED(argSize)),
                     MAX_UCHAR_BUFFER_NEEDED(argSize));
-            if(s == NULL) {
+            if(s == nullptr) {
                 return 0;
             }
         }
@@ -764,7 +764,7 @@ u_printf_ustring_handler(const u_printf_stream_handler  *handler,
     const UChar *arg = (const UChar*)(args[0].ptrValue);
 
     /* allocate enough space for the buffer */
-    if (arg == NULL) {
+    if (arg == nullptr) {
         arg = gNullStr;
     }
     len = u_strlen(arg);
@@ -840,7 +840,7 @@ u_printf_scidbl_handler(const u_printf_stream_handler  *handler,
     else {
         format = u_locbund_getNumberFormat(formatBundle, UNUM_DECIMAL);
         /* Check for null pointer */
-        if (format == NULL) {
+        if (format == nullptr) {
             return 0;
         }
         maxSigDecimalDigits = unum_getAttribute(format, UNUM_MAX_SIGNIFICANT_DIGITS);
@@ -1059,9 +1059,9 @@ static const u_printf_info g_u_printf_infos[UPRINTF_NUM_FMT_HANDLERS] = {
             (s) == MOD_L
 /* Returns an array of the parsed argument type given in the format string. */
 static ufmt_args* parseArguments(const UChar *alias, va_list ap, UErrorCode *status) {
-    ufmt_args *arglist = NULL;
-    ufmt_type_info *typelist = NULL;
-    UBool *islonglong = NULL;
+    ufmt_args *arglist = nullptr;
+    ufmt_type_info *typelist = nullptr;
+    UBool *islonglong = nullptr;
     int32_t size = 0;
     int32_t pos = 0;
     UChar type;
@@ -1096,10 +1096,10 @@ static ufmt_args* parseArguments(const UChar *alias, va_list ap, UErrorCode *sta
 
             /* if there is no '$', don't read anything */
             if(*alias != SPEC_DOLLARSIGN) {
-                return NULL;
+                return nullptr;
             }
         } else {
-            return NULL;
+            return nullptr;
         }
 
         if (pos > size) {
@@ -1112,7 +1112,7 @@ static ufmt_args* parseArguments(const UChar *alias, va_list ap, UErrorCode *sta
     islonglong = (UBool*)uprv_malloc(sizeof(UBool) * size);
     arglist = (ufmt_args*)uprv_malloc(sizeof(ufmt_args) * size);
 
-    /* If malloc failed, return NULL */
+    /* If malloc failed, return nullptr */
     if (!typelist || !islonglong || !arglist) {
         if (typelist) {
             uprv_free(typelist);
@@ -1127,7 +1127,7 @@ static ufmt_args* parseArguments(const UChar *alias, va_list ap, UErrorCode *sta
         }
 
         *status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     /* reset alias back to the beginning */
@@ -1206,7 +1206,7 @@ static ufmt_args* parseArguments(const UChar *alias, va_list ap, UErrorCode *sta
             break;
         default:
             /* else args is ignored */
-            arglist[pos].ptrValue = NULL;
+            arglist[pos].ptrValue = nullptr;
             break;
         }
     }
@@ -1239,7 +1239,7 @@ u_printf_parse(const u_printf_stream_handler *streamHandler,
     const UChar *lastAlias;
     const UChar *orgAlias = fmt;
     /* parsed argument list */
-    ufmt_args *arglist = NULL; /* initialized it to avoid compiler warnings */
+    ufmt_args *arglist = nullptr; /* initialized it to avoid compiler warnings */
     UErrorCode status = U_ZERO_ERROR;
     if (!locStringContext || locStringContext->available >= 0) {
         /* get the parsed list of argument types */
@@ -1542,7 +1542,7 @@ u_printf_parse(const u_printf_stream_handler *streamHandler,
                     break;
                 default:
                     /* else args is ignored */
-                    args.ptrValue = NULL;
+                    args.ptrValue = nullptr;
                     break;
                 }
             } else { /* no positional argument specified */
@@ -1575,7 +1575,7 @@ u_printf_parse(const u_printf_stream_handler *streamHandler,
                     break;
                 default:
                     /* else args is ignored */
-                    args.ptrValue = NULL;
+                    args.ptrValue = nullptr;
                     break;
                 }
             }
@@ -1596,7 +1596,7 @@ u_printf_parse(const u_printf_stream_handler *streamHandler,
         }
     }
     /* delete parsed argument list */
-    if (arglist != NULL) {
+    if (arglist != nullptr) {
         uprv_free(arglist);
     }
     /* return # of characters in this format that have been parsed. */
index 26a790dd9b6368fcc68fa214a81ca2cd2c69b181..ef17548d5a64797dbc3e466243e54727b9730ace 100644 (file)
@@ -92,7 +92,7 @@ typedef struct u_scanf_spec_info {
     UBool   fIsShort;       /* h flag  */
     UBool   fIsLong;        /* l flag  */
     UBool   fIsLongLong;    /* ll flag  */
-    UBool   fIsString;      /* true if this is a NULL-terminated string. */
+    UBool   fIsString;      /* true if this is a NUL-terminated string. */
 } u_scanf_spec_info;
 
 
@@ -277,7 +277,7 @@ u_scanf_parse_spec (const UChar     *fmt,
 #define UFMT_USTRING        {ufmt_ustring, u_scanf_ustring_handler}
 
 
-#define UFMT_EMPTY {ufmt_empty, NULL}
+#define UFMT_EMPTY {ufmt_empty, nullptr}
 
 /**
  * A u_scanf handler function.  
@@ -885,7 +885,7 @@ u_scanf_string_handler(UFILE        *input,
 
             /* convert the character to the default codepage */
             ucnv_fromUnicode(conv, &alias, limit, &source, source + 1,
-                NULL, true, &status);
+                nullptr, true, &status);
 
             if(U_FAILURE(status)) {
                 /* clean up */
@@ -1402,7 +1402,7 @@ u_scanf_parse(UFILE     *f,
                 break;
             }
             else if(spec.fInfo.fSkipArg) {
-                args.ptrValue = NULL;
+                args.ptrValue = nullptr;
             }
             else {
                 switch(info) {
@@ -1423,7 +1423,7 @@ u_scanf_parse(UFILE     *f,
 
                 default:
                     /* else args is ignored */
-                    args.ptrValue = NULL;
+                    args.ptrValue = nullptr;
                     break;
                 }
             }
index 502a7dc2105dc611c1efd19de2240bfb324719a4..648f40af0a9a8ba183e22fd557c9a7f0f0bc1435 100644 (file)
@@ -67,7 +67,7 @@ U_CAPI UTransliterator* U_EXPORT2
 u_fsettransliterator(UFILE *file, UFileDirection direction,
                      UTransliterator *adopt, UErrorCode *status)
 {
-    UTransliterator *old = NULL;
+    UTransliterator *old = nullptr;
 
     if(U_FAILURE(*status))
     {
@@ -87,21 +87,21 @@ u_fsettransliterator(UFILE *file, UFileDirection direction,
         return adopt;
     }
 
-    if(adopt == NULL) /* they are clearing it */
+    if(adopt == nullptr) /* they are clearing it */
     {
-        if(file->fTranslit != NULL)
+        if(file->fTranslit != nullptr)
         {
             /* TODO: Check side */
             old = file->fTranslit->translit;
             uprv_free(file->fTranslit->buffer);
-            file->fTranslit->buffer=NULL;
+            file->fTranslit->buffer=nullptr;
             uprv_free(file->fTranslit);
-            file->fTranslit=NULL;
+            file->fTranslit=nullptr;
         }
     }
     else
     {
-        if(file->fTranslit == NULL)
+        if(file->fTranslit == nullptr)
         {
             file->fTranslit = (UFILETranslitBuffer*) uprv_malloc(sizeof(UFILETranslitBuffer));
             if(!file->fTranslit)
@@ -112,7 +112,7 @@ u_fsettransliterator(UFILE *file, UFileDirection direction,
             file->fTranslit->capacity = 0;
             file->fTranslit->length = 0;
             file->fTranslit->pos = 0;
-            file->fTranslit->buffer = NULL;
+            file->fTranslit->buffer = nullptr;
         }
         else
         {
@@ -135,7 +135,7 @@ static const UChar * u_file_translit(UFILE *f, const UChar *src, int32_t *count,
     UTransPosition pos;
     UErrorCode status = U_ZERO_ERROR;
 
-    if(count == NULL)
+    if(count == nullptr)
     {
         count = &junkCount;
     }
@@ -160,7 +160,7 @@ static const UChar * u_file_translit(UFILE *f, const UChar *src, int32_t *count,
 
     if(newlen > f->fTranslit->capacity)
     {
-        if(f->fTranslit->buffer == NULL)
+        if(f->fTranslit->buffer == nullptr)
         {
             f->fTranslit->buffer = (UChar*)uprv_malloc(newlen * sizeof(UChar));
         }
@@ -169,8 +169,8 @@ static const UChar * u_file_translit(UFILE *f, const UChar *src, int32_t *count,
             f->fTranslit->buffer = (UChar*)uprv_realloc(f->fTranslit->buffer, newlen * sizeof(UChar));
         }
         /* Check for malloc/realloc failure. */
-        if (f->fTranslit->buffer == NULL) {
-               return NULL;
+        if (f->fTranslit->buffer == nullptr) {
+               return nullptr;
         }
         f->fTranslit->capacity = newlen;
     }
@@ -239,7 +239,7 @@ ufile_flush_translit(UFILE *f)
         return;
 #endif
 
-    u_file_write_flush(NULL, 0, f, false, true);
+    u_file_write_flush(nullptr, 0, f, false, true);
 }
 
 
@@ -250,7 +250,7 @@ ufile_flush_io(UFILE *f)
     return; /* skip if no file */
   }
 
-  u_file_write_flush(NULL, 0, f, true, false);
+  u_file_write_flush(nullptr, 0, f, true, false);
 }
 
 
@@ -274,7 +274,7 @@ ufile_close_translit(UFILE *f)
     }
 
     uprv_free(f->fTranslit);
-    f->fTranslit = NULL;
+    f->fTranslit = nullptr;
 #endif
 }
 
@@ -353,13 +353,13 @@ u_file_write_flush(const UChar *chars,
     do {
         mySourceBegin = mySource; /* beginning location for this loop */
         status     = U_ZERO_ERROR;
-        if(f->fConverter != NULL) { /* We have a valid converter */
+        if(f->fConverter != nullptr) { /* We have a valid converter */
             ucnv_fromUnicode(f->fConverter,
                 &myTarget,
                 charBuffer + UFILE_CHARBUFFER_SIZE,
                 &mySource,
                 mySourceEnd,
-                NULL,
+                nullptr,
                 flushIO,
                 &status);
         } else { /*weiv: do the invariant conversion */
@@ -416,7 +416,7 @@ ufile_fill_uchar_buffer(UFILE *f)
     char        charBuffer[UFILE_CHARBUFFER_SIZE];
     u_localized_string *str;
 
-    if (f->fFile == NULL) {
+    if (f->fFile == nullptr) {
         /* There is nothing to do. It's a string. */
         return;
     }
@@ -438,8 +438,8 @@ ufile_fill_uchar_buffer(UFILE *f)
     availLength = UFILE_UCHARBUFFER_SIZE - dataSize;
 
     /* Determine the # of codepage bytes needed to fill our UChar buffer */
-    /* weiv: if converter is NULL, we use invariant converter with charwidth = 1)*/
-    maxCPBytes = availLength / (f->fConverter!=NULL?(2*ucnv_getMinCharSize(f->fConverter)):1);
+    /* weiv: if converter is nullptr, we use invariant converter with charwidth = 1)*/
+    maxCPBytes = availLength / (f->fConverter!=nullptr?(2*ucnv_getMinCharSize(f->fConverter)):1);
 
     /* Read in the data to convert */
     if (f->fFileno == 0) {
@@ -462,14 +462,14 @@ ufile_fill_uchar_buffer(UFILE *f)
     myTarget    = f->fUCBuffer + dataSize;
     bufferSize  = UFILE_UCHARBUFFER_SIZE;
 
-    if(f->fConverter != NULL) { /* We have a valid converter */
+    if(f->fConverter != nullptr) { /* We have a valid converter */
         /* Perform the conversion */
         ucnv_toUnicode(f->fConverter,
             &myTarget,
             f->fUCBuffer + bufferSize,
             &mySource,
             mySourceEnd,
-            NULL,
+            nullptr,
             (UBool)(feof(f->fFile) != 0),
             &status);
 
@@ -498,7 +498,7 @@ u_fgets(UChar        *s,
 
     if (n <= 0) {
         /* Caller screwed up. We need to write the null terminatior. */
-        return NULL;
+        return nullptr;
     }
 
     /* fill the buffer if needed */
@@ -515,7 +515,7 @@ u_fgets(UChar        *s,
 
     /* if 0 characters were left, return 0 */
     if (dataSize == 0)
-        return NULL;
+        return nullptr;
 
     /* otherwise, iteratively fill the buffer and copy */
     count = 0;
index 112575066997eeea2936f939aad8c956dd04788c..1788b68e1d0ae4bc3cb918dfcc0d7f6b7dbe6f4f 100644 (file)
@@ -53,7 +53,7 @@ private:
 };
 
 StyleRuns::StyleRuns(const RunArray *styleRunArrays[], le_int32 styleCount)
-    : fStyleCount(styleCount), fRunCount(0), fRunLimits(NULL), fStyleIndices(NULL)
+    : fStyleCount(styleCount), fRunCount(0), fRunLimits(nullptr), fStyleIndices(nullptr)
 {
     le_int32 maxRunCount = 0;
     le_int32 style, run, runStyle;
@@ -112,19 +112,19 @@ StyleRuns::~StyleRuns()
     fRunCount = 0;
 
     LE_DELETE_ARRAY(fStyleIndices);
-    fStyleIndices = NULL;
+    fStyleIndices = nullptr;
 
     LE_DELETE_ARRAY(fRunLimits);
-    fRunLimits = NULL;
+    fRunLimits = nullptr;
 }
 
 le_int32 StyleRuns::getRuns(le_int32 runLimits[], le_int32 styleIndices[])
 {
-    if (runLimits != NULL) {
+    if (runLimits != nullptr) {
         LE_ARRAY_COPY(runLimits, fRunLimits, fRunCount);
     }
 
-    if (styleIndices != NULL) {
+    if (styleIndices != nullptr) {
         LE_ARRAY_COPY(styleIndices, fStyleIndices, fRunCount * fStyleCount);
     }
 
@@ -318,14 +318,14 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count,
                                  UBiDiLevel paragraphLevel, le_bool vertical,
                                  LEErrorCode &status)
                                  : fChars(chars), fCharCount(count),
-                                   fFontRuns(NULL), fLevelRuns(levelRuns), fScriptRuns(scriptRuns), fLocaleRuns(localeRuns),
-                                   fVertical(vertical), fClientLevels(true), fClientScripts(true), fClientLocales(true), fEmbeddingLevels(NULL),
+                                   fFontRuns(nullptr), fLevelRuns(levelRuns), fScriptRuns(scriptRuns), fLocaleRuns(localeRuns),
+                                   fVertical(vertical), fClientLevels(true), fClientScripts(true), fClientLocales(true), fEmbeddingLevels(nullptr),
                                    fAscent(0), fDescent(0), fLeading(0),
-                                   fGlyphToCharMap(NULL), fCharToMinGlyphMap(NULL), fCharToMaxGlyphMap(NULL), fGlyphWidths(NULL), fGlyphCount(0),
-                                   fParaBidi(NULL), fLineBidi(NULL),
-                                   fStyleRunLimits(NULL), fStyleIndices(NULL), fStyleRunCount(0),
-                                   fBreakIterator(NULL), fLineStart(-1), fLineEnd(0),
-                                 /*fVisualRuns(NULL), fStyleRunInfo(NULL), fVisualRunCount(-1),
+                                   fGlyphToCharMap(nullptr), fCharToMinGlyphMap(nullptr), fCharToMaxGlyphMap(nullptr), fGlyphWidths(nullptr), fGlyphCount(0),
+                                   fParaBidi(nullptr), fLineBidi(nullptr),
+                                   fStyleRunLimits(nullptr), fStyleIndices(nullptr), fStyleRunCount(0),
+                                   fBreakIterator(nullptr), fLineStart(-1), fLineEnd(0),
+                                 /*fVisualRuns(nullptr), fStyleRunInfo(nullptr), fVisualRunCount(-1),
                                    fFirstVisualRun(-1), fLastVisualRun(-1),*/ fVisualRunLastX(0), fVisualRunLastY(0)
 {
 
@@ -341,11 +341,11 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count,
 
     computeLevels(paragraphLevel);
 
-    if (scriptRuns == NULL) {
+    if (scriptRuns == nullptr) {
         computeScripts();
     }
 
-    if (localeRuns == NULL) {
+    if (localeRuns == nullptr) {
         computeLocales();
     }
 
@@ -363,11 +363,11 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count,
     StyleRuns styleRuns(styleRunArrays, styleCount);
     LEErrorCode layoutStatus = LE_NO_ERROR;
 
-    fStyleRunCount = styleRuns.getRuns(NULL, NULL);
+    fStyleRunCount = styleRuns.getRuns(nullptr, nullptr);
 
     fStyleRunLimits = LE_NEW_ARRAY(le_int32, fStyleRunCount);
     fStyleIndices   = LE_NEW_ARRAY(le_int32, fStyleRunCount * styleCount);
-    if ((fStyleRunLimits == NULL) || (fStyleIndices == NULL)) {
+    if ((fStyleRunLimits == nullptr) || (fStyleIndices == nullptr)) {
         status = LE_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -379,24 +379,24 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count,
     le_int32 run, runStart;
 
     fStyleRunInfo = LE_NEW_ARRAY(StyleRunInfo, fStyleRunCount);
-    if (fStyleRunInfo == NULL) {
+    if (fStyleRunInfo == nullptr) {
         status = LE_MEMORY_ALLOCATION_ERROR;
         return;
     }
     else {
         // initialize
         for (run = 0; run < fStyleRunCount; run += 1) {
-            fStyleRunInfo[run].font = NULL;
+            fStyleRunInfo[run].font = nullptr;
             fStyleRunInfo[run].runBase = 0;
             fStyleRunInfo[run].runLimit = 0;
             fStyleRunInfo[run].script = (UScriptCode)0;
-            fStyleRunInfo[run].locale = NULL;
+            fStyleRunInfo[run].locale = nullptr;
             fStyleRunInfo[run].level = 0;
             fStyleRunInfo[run].glyphBase = 0;
-            fStyleRunInfo[run].engine = NULL;
+            fStyleRunInfo[run].engine = nullptr;
             fStyleRunInfo[run].glyphCount = 0;
-            fStyleRunInfo[run].glyphs = NULL;
-            fStyleRunInfo[run].positions = NULL;
+            fStyleRunInfo[run].glyphs = nullptr;
+            fStyleRunInfo[run].positions = nullptr;
         }
     }
 
@@ -440,8 +440,8 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count,
     fGlyphToCharMap    = LE_NEW_ARRAY(le_int32, fGlyphCount + 1);
     fCharToMinGlyphMap = LE_NEW_ARRAY(le_int32, fCharCount + 1);
     fCharToMaxGlyphMap = LE_NEW_ARRAY(le_int32, fCharCount + 1);
-    if ((fGlyphWidths == NULL) || (fGlyphToCharMap == NULL) ||
-        (fCharToMinGlyphMap == NULL) || (fCharToMaxGlyphMap == NULL)) {
+    if ((fGlyphWidths == nullptr) || (fGlyphToCharMap == nullptr) ||
+        (fCharToMinGlyphMap == nullptr) || (fCharToMaxGlyphMap == nullptr)) {
         status = LE_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -455,8 +455,8 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count,
 
         fStyleRunInfo[run].glyphs = LE_NEW_ARRAY(LEGlyphID, glyphCount);
         fStyleRunInfo[run].positions = LE_NEW_ARRAY(float, glyphCount * 2 + 2);
-        if ((fStyleRunInfo[run].glyphs == NULL) ||
-            (fStyleRunInfo[run].positions == NULL)) {
+        if ((fStyleRunInfo[run].glyphs == nullptr) ||
+            (fStyleRunInfo[run].positions == nullptr)) {
             status = LE_MEMORY_ALLOCATION_ERROR;
             return;
         }
@@ -491,7 +491,7 @@ ParagraphLayout::ParagraphLayout(const LEUnicode chars[], le_int32 count,
         runStart = fStyleRunLimits[run];
 
         delete engine;
-        fStyleRunInfo[run].engine = NULL;
+        fStyleRunInfo[run].engine = nullptr;
     }
 
     fGlyphToCharMap[fGlyphCount] = fCharCount;
@@ -531,58 +531,58 @@ ParagraphLayout::~ParagraphLayout()
 
     if (! fClientLevels) {
         delete (ValueRuns *) fLevelRuns;
-        fLevelRuns = NULL;
+        fLevelRuns = nullptr;
 
         fClientLevels = true;
     }
 
     if (! fClientScripts) {
         delete (ValueRuns *) fScriptRuns;
-        fScriptRuns = NULL;
+        fScriptRuns = nullptr;
 
         fClientScripts = true;
     }
 
     if (! fClientLocales) {
         delete (LocaleRuns *) fLocaleRuns;
-        fLocaleRuns = NULL;
+        fLocaleRuns = nullptr;
 
         fClientLocales = true;
     }
 
-    if (fEmbeddingLevels != NULL) {
+    if (fEmbeddingLevels != nullptr) {
         LE_DELETE_ARRAY(fEmbeddingLevels);
-        fEmbeddingLevels = NULL;
+        fEmbeddingLevels = nullptr;
     }
 
-    if (fGlyphToCharMap != NULL) {
+    if (fGlyphToCharMap != nullptr) {
         LE_DELETE_ARRAY(fGlyphToCharMap);
-        fGlyphToCharMap = NULL;
+        fGlyphToCharMap = nullptr;
     }
 
-    if (fCharToMinGlyphMap != NULL) {
+    if (fCharToMinGlyphMap != nullptr) {
         LE_DELETE_ARRAY(fCharToMinGlyphMap);
-        fCharToMinGlyphMap = NULL;
+        fCharToMinGlyphMap = nullptr;
     }
 
-    if (fCharToMaxGlyphMap != NULL) {
+    if (fCharToMaxGlyphMap != nullptr) {
         LE_DELETE_ARRAY(fCharToMaxGlyphMap);
-        fCharToMaxGlyphMap = NULL;
+        fCharToMaxGlyphMap = nullptr;
     }
 
-    if (fGlyphWidths != NULL) {
+    if (fGlyphWidths != nullptr) {
         LE_DELETE_ARRAY(fGlyphWidths);
-        fGlyphWidths = NULL;
+        fGlyphWidths = nullptr;
     }
 
-    if (fParaBidi != NULL) {
+    if (fParaBidi != nullptr) {
         ubidi_close(fParaBidi);
-        fParaBidi = NULL;
+        fParaBidi = nullptr;
     }
 
-    if (fLineBidi != NULL) {
+    if (fLineBidi != nullptr) {
         ubidi_close(fLineBidi);
-        fLineBidi = NULL;
+        fLineBidi = nullptr;
     }
 
     if (fStyleRunCount > 0) {
@@ -595,21 +595,21 @@ ParagraphLayout::~ParagraphLayout()
             LE_DELETE_ARRAY(fStyleRunInfo[run].glyphs);
             LE_DELETE_ARRAY(fStyleRunInfo[run].positions);
 
-            fStyleRunInfo[run].glyphs    = NULL;
-            fStyleRunInfo[run].positions = NULL;
+            fStyleRunInfo[run].glyphs    = nullptr;
+            fStyleRunInfo[run].positions = nullptr;
         }
 
         LE_DELETE_ARRAY(fStyleRunInfo);
 
-        fStyleRunLimits = NULL;
-        fStyleIndices   = NULL;
-        fStyleRunInfo        = NULL;
+        fStyleRunLimits = nullptr;
+        fStyleIndices   = nullptr;
+        fStyleRunInfo        = nullptr;
         fStyleRunCount  = 0;
     }
 
-    if (fBreakIterator != NULL) {
+    if (fBreakIterator != nullptr) {
         delete fBreakIterator;
-        fBreakIterator = NULL;
+        fBreakIterator = nullptr;
     }
 }
 
@@ -621,7 +621,7 @@ le_bool ParagraphLayout::isComplex(const LEUnicode chars[], le_int32 count)
     UScriptRun *sr = uscript_openRun(chars, count, &scriptStatus);
     le_bool result = false;
 
-    while (uscript_nextRun(sr, NULL, NULL, &scriptCode)) {
+    while (uscript_nextRun(sr, nullptr, nullptr, &scriptCode)) {
         if (isComplex(scriptCode)) {
             result = true;
             break;
@@ -667,7 +667,7 @@ le_bool ParagraphLayout::isDone() const
 ParagraphLayout::Line *ParagraphLayout::nextLine(float width)
 {
     if (isDone()) {
-        return NULL;
+        return nullptr;
     }
 
     fLineStart = fLineEnd;
@@ -710,7 +710,7 @@ void ParagraphLayout::computeLevels(UBiDiLevel paragraphLevel)
 {
     UErrorCode bidiStatus = U_ZERO_ERROR;
 
-    if (fLevelRuns != NULL) {
+    if (fLevelRuns != nullptr) {
         le_int32 ch;
         le_int32 run;
 
@@ -729,7 +729,7 @@ void ParagraphLayout::computeLevels(UBiDiLevel paragraphLevel)
     fParaBidi = ubidi_openSized(fCharCount, 0, &bidiStatus);
     ubidi_setPara(fParaBidi, fChars, fCharCount, paragraphLevel, fEmbeddingLevels, &bidiStatus);
 
-    if (fLevelRuns == NULL) {
+    if (fLevelRuns == nullptr) {
         le_int32 levelRunCount = ubidi_countRuns(fParaBidi, &bidiStatus);
         ValueRuns *levelRuns = new ValueRuns(levelRunCount);
 
@@ -757,7 +757,7 @@ void ParagraphLayout::computeScripts()
     le_int32 limit;
     UScriptCode script;
 
-    while (uscript_nextRun(sr, NULL, &limit, &script)) {
+    while (uscript_nextRun(sr, nullptr, &limit, &script)) {
         scriptRuns->add(script, limit);
     }
 
@@ -787,7 +787,7 @@ void ParagraphLayout::computeSubFonts(const FontRuns *fontRuns, LEErrorCode &sta
     const RunArray *styleRunArrays[] = {fontRuns, fScriptRuns};
     le_int32 styleCount = sizeof styleRunArrays / sizeof styleRunArrays[0];
     StyleRuns styleRuns(styleRunArrays, styleCount);
-    le_int32 styleRunCount = styleRuns.getRuns(NULL, NULL);
+    le_int32 styleRunCount = styleRuns.getRuns(nullptr, nullptr);
     le_int32 *styleRunLimits = LE_NEW_ARRAY(le_int32, styleRunCount);
     le_int32 *styleIndices = LE_NEW_ARRAY(le_int32, styleRunCount * styleCount);
     FontRuns *subFontRuns  = new FontRuns(0);
@@ -950,7 +950,7 @@ le_int32 ParagraphLayout::getLanguageCode(const Locale *locale)
 
     uprv_strcat(code, language);
 
-    if ((uprv_strcmp(language, "zho") == 0) && country != NULL) {
+    if ((uprv_strcmp(language, "zho") == 0) && country != nullptr) {
         uprv_strcat(code, "_");
         uprv_strcat(code, country);
     }
@@ -992,7 +992,7 @@ le_int32 ParagraphLayout::previousBreak(le_int32 charIndex)
     }
 
     // Create the BreakIterator if we don't already have one
-    if (fBreakIterator == NULL) {
+    if (fBreakIterator == nullptr) {
         Locale thai("th");
         UCharCharacterIterator *iter = new UCharCharacterIterator(fChars, fCharCount);
         UErrorCode status = U_ZERO_ERROR;
@@ -1018,7 +1018,7 @@ ParagraphLayout::Line *ParagraphLayout::computeVisualRuns()
     fFirstVisualRun = getCharRun(fLineStart);
     fLastVisualRun  = getCharRun(fLineEnd - 1);
 
-    if (fLineBidi == NULL) {
+    if (fLineBidi == nullptr) {
         fLineBidi = ubidi_openSized(fCharCount, 0, &bidiStatus);
     }
 
@@ -1201,7 +1201,7 @@ le_int32 ParagraphLayout::Line::getWidth() const
 {
     const VisualRun *lastRun = getVisualRun(fRunCount - 1);
 
-    if (lastRun == NULL) {
+    if (lastRun == nullptr) {
         return 0;
     }
 
@@ -1214,7 +1214,7 @@ le_int32 ParagraphLayout::Line::getWidth() const
 const ParagraphLayout::VisualRun *ParagraphLayout::Line::getVisualRun(le_int32 runIndex) const
 {
     if (runIndex < 0 || runIndex >= fRunCount) {
-        return NULL;
+        return nullptr;
     }
 
     return fRuns[runIndex];
index 20d020c4f0185c01385b1a4fcc023e6b382a64d0..30b40e530087b79fcd66fb8f3ea5ee7eed000719 100644 (file)
@@ -19,7 +19,7 @@ U_NAMESPACE_BEGIN
 const char RunArray::fgClassID = 0;
 
 RunArray::RunArray(le_int32 initialCapacity)
-    : fClientArrays(false), fLimits(NULL), fCount(0), fCapacity(initialCapacity)
+    : fClientArrays(false), fLimits(nullptr), fCount(0), fCapacity(initialCapacity)
 {
     if (initialCapacity > 0) {
         fLimits = LE_NEW_ARRAY(le_int32, fCapacity);
@@ -30,7 +30,7 @@ RunArray::~RunArray()
 {
     if (! fClientArrays) {
         LE_DELETE_ARRAY(fLimits);
-        fLimits = NULL;
+        fLimits = nullptr;
     }
 }
 
@@ -76,7 +76,7 @@ le_int32 RunArray::add(le_int32 limit)
 const char FontRuns::fgClassID = 0;
 
 FontRuns::FontRuns(le_int32 initialCapacity)
-    : RunArray(initialCapacity), fFonts(NULL)
+    : RunArray(initialCapacity), fFonts(nullptr)
 {
     if (initialCapacity > 0) {
         fFonts = LE_NEW_ARRAY(const LEFontInstance *, initialCapacity);
@@ -87,7 +87,7 @@ FontRuns::~FontRuns()
 {
     if (! fClientArrays) {
         LE_DELETE_ARRAY(fFonts);
-        fFonts = NULL;
+        fFonts = nullptr;
     }
 }
 
@@ -119,7 +119,7 @@ le_int32 FontRuns::add(const LEFontInstance *font, le_int32 limit)
 const LEFontInstance *FontRuns::getFont(le_int32 run) const
 {
     if (run < 0 || run >= getCount()) {
-        return NULL;
+        return nullptr;
     }
 
     return fFonts[run];
@@ -128,7 +128,7 @@ const LEFontInstance *FontRuns::getFont(le_int32 run) const
 const char LocaleRuns::fgClassID = 0;
 
 LocaleRuns::LocaleRuns(le_int32 initialCapacity)
-    : RunArray(initialCapacity), fLocales(NULL)
+    : RunArray(initialCapacity), fLocales(nullptr)
 {
     if (initialCapacity > 0) {
         fLocales = LE_NEW_ARRAY(const Locale *, initialCapacity);
@@ -139,7 +139,7 @@ LocaleRuns::~LocaleRuns()
 {
     if (! fClientArrays) {
         LE_DELETE_ARRAY(fLocales);
-        fLocales = NULL;
+        fLocales = nullptr;
     }
 }
 
@@ -171,7 +171,7 @@ le_int32 LocaleRuns::add(const Locale *locale, le_int32 limit)
 const Locale *LocaleRuns::getLocale(le_int32 run) const
 {
     if (run < 0 || run >= getCount()) {
-        return NULL;
+        return nullptr;
     }
 
     return fLocales[run];
@@ -180,7 +180,7 @@ const Locale *LocaleRuns::getLocale(le_int32 run) const
 const char ValueRuns::fgClassID = 0;
 
 ValueRuns::ValueRuns(le_int32 initialCapacity)
-    : RunArray(initialCapacity), fValues(NULL)
+    : RunArray(initialCapacity), fValues(nullptr)
 {
     if (initialCapacity > 0) {
         fValues = LE_NEW_ARRAY(le_int32, initialCapacity);
@@ -191,7 +191,7 @@ ValueRuns::~ValueRuns()
 {
     if (! fClientArrays) {
         LE_DELETE_ARRAY(fValues);
-        fValues = NULL;
+        fValues = nullptr;
     }
 }
 
index b8a7aa3c17d9b0aa5c9a06b1d1e5e8675b15f376..f6167ae3292e569c6f1ac4000f30e4fa0317cf61 100644 (file)
@@ -369,16 +369,16 @@ public:
      * @param fontRuns a pointer to a <code>FontRuns</code> object representing the font runs.
      *
      * @param levelRuns is a pointer to a <code>ValueRuns</code> object representing the directional levels.
-     *        If this pointer in <code>NULL</code> the levels will be determined by running the Unicode
+     *        If this pointer in <code>nullptr</code> the levels will be determined by running the Unicode
      *        Bidi algorithm.
      *
      * @param scriptRuns is a pointer to a <code>ValueRuns</code> object representing script runs.
-     *        If this pointer in <code>NULL</code> the script runs will be determined using the
+     *        If this pointer in <code>nullptr</code> the script runs will be determined using the
      *        Unicode code points.
      *
      * @param localeRuns is a pointer to a <code>LocaleRuns</code> object representing locale runs.
      *        The <code>Locale</code> objects are used to determine the language of the text. If this
-     *        pointer is <code>NULL</code> the default locale will be used for all of the text. 
+     *        pointer is <code>nullptr</code> the default locale will be used for all of the text.
      *
      * @param paragraphLevel is the directionality of the paragraph, as in the UBiDi object.
      *
@@ -529,7 +529,7 @@ public:
      *              rest of the paragraph will be returned.
      *
      * @return a <code>ParagraphLayout::Line</code> object which represents the line. The caller
-     *         is responsible for deleting the object. Returns <code>NULL</code> if there are no
+     *         is responsible for deleting the object. Returns <code>nullptr</code> if there are no
      *         more lines in the paragraph.
      *
      * @see ParagraphLayout::Line
@@ -661,13 +661,13 @@ inline void ParagraphLayout::reflow()
 }
 
 inline ParagraphLayout::Line::Line()
-    : UObject(), fAscent(0), fDescent(0), fLeading(0), fRunCount(0), fRunCapacity(0), fRuns(NULL)
+    : UObject(), fAscent(0), fDescent(0), fLeading(0), fRunCount(0), fRunCapacity(0), fRuns(nullptr)
 {
     // nothing else to do
 }
 
 inline ParagraphLayout::Line::Line(const Line & /*other*/)
-    : UObject(), fAscent(0), fDescent(0), fLeading(0), fRunCount(0), fRunCapacity(0), fRuns(NULL)
+    : UObject(), fAscent(0), fDescent(0), fLeading(0), fRunCount(0), fRunCapacity(0), fRuns(nullptr)
 {
     // nothing else to do
 }
@@ -723,13 +723,13 @@ inline le_int32 ParagraphLayout::VisualRun::getLeading() const
 }
 
 inline ParagraphLayout::VisualRun::VisualRun()
-    : UObject(), fFont(NULL), fDirection(UBIDI_LTR), fGlyphCount(0), fGlyphs(NULL), fPositions(NULL), fGlyphToCharMap(NULL)
+    : UObject(), fFont(nullptr), fDirection(UBIDI_LTR), fGlyphCount(0), fGlyphs(nullptr), fPositions(nullptr), fGlyphToCharMap(nullptr)
 {
     // nothing
 }
 
 inline ParagraphLayout::VisualRun::VisualRun(const VisualRun &/*other*/)
-    : UObject(), fFont(NULL), fDirection(UBIDI_LTR), fGlyphCount(0), fGlyphs(NULL), fPositions(NULL), fGlyphToCharMap(NULL)
+    : UObject(), fFont(nullptr), fDirection(UBIDI_LTR), fGlyphCount(0), fGlyphs(nullptr), fPositions(nullptr), fGlyphToCharMap(nullptr)
 {
     // nothing
 }
index 92dfc386a52705f7ec3ce24e53c3cbe9c317c65b..08e328266425db1e1a824c8b348e3d3b396fdcd2 100644 (file)
@@ -222,13 +222,13 @@ private:
 };
 
 inline RunArray::RunArray()
-    : UObject(), fClientArrays(false), fLimits(NULL), fCount(0), fCapacity(0)
+    : UObject(), fClientArrays(false), fLimits(nullptr), fCount(0), fCapacity(0)
 {
     // nothing else to do...
 }
 
 inline RunArray::RunArray(const RunArray & /*other*/)
-    : UObject(), fClientArrays(false), fLimits(NULL), fCount(0), fCapacity(0)
+    : UObject(), fClientArrays(false), fLimits(nullptr), fCount(0), fCapacity(0)
 {
     // nothing else to do...
 }
@@ -383,13 +383,13 @@ private:
 };
 
 inline FontRuns::FontRuns()
-    : RunArray(0), fFonts(NULL)
+    : RunArray(0), fFonts(nullptr)
 {
     // nothing else to do...
 }
 
 inline FontRuns::FontRuns(const FontRuns & /*other*/)
-    : RunArray(0), fFonts(NULL)
+    : RunArray(0), fFonts(nullptr)
 {
     // nothing else to do...
 }
@@ -523,13 +523,13 @@ private:
 };
 
 inline LocaleRuns::LocaleRuns()
-    : RunArray(0), fLocales(NULL)
+    : RunArray(0), fLocales(nullptr)
 {
     // nothing else to do...
 }
 
 inline LocaleRuns::LocaleRuns(const LocaleRuns & /*other*/)
-    : RunArray(0), fLocales(NULL)
+    : RunArray(0), fLocales(nullptr)
 {
     // nothing else to do...
 }
@@ -657,13 +657,13 @@ private:
 };
 
 inline ValueRuns::ValueRuns()
-    : RunArray(0), fValues(NULL)
+    : RunArray(0), fValues(nullptr)
 {
     // nothing else to do...
 }
 
 inline ValueRuns::ValueRuns(const ValueRuns & /*other*/)
-    : RunArray(0), fValues(NULL)
+    : RunArray(0), fValues(nullptr)
 {
     // nothing else to do...
 }
index cebd4bb4add3bb6395e1ea9511fdf8a7e4f3edd9..08dac2623011de4ad540f3d6063b758c3699e76f 100644 (file)
@@ -62,7 +62,7 @@ pl_getParagraphLevel(pl_paragraph *paragraph)
 {
     ParagraphLayout *pl = (ParagraphLayout *) paragraph;
 
-    if (pl == NULL) {
+    if (pl == nullptr) {
         return 0;
     }
 
@@ -74,7 +74,7 @@ pl_getTextDirection(pl_paragraph *paragraph)
 {
     ParagraphLayout *pl = (ParagraphLayout *) paragraph;
 
-    if (pl == NULL) {
+    if (pl == nullptr) {
         return UBIDI_LTR;
     }
 
@@ -86,7 +86,7 @@ pl_getAscent(const pl_paragraph *paragraph)
 {
     ParagraphLayout *pl = (ParagraphLayout *) paragraph;
 
-    if (pl == NULL) {
+    if (pl == nullptr) {
         return 0;
     }
 
@@ -98,7 +98,7 @@ pl_getDescent(const pl_paragraph *paragraph)
 {
     ParagraphLayout *pl = (ParagraphLayout *) paragraph;
 
-    if (pl == NULL) {
+    if (pl == nullptr) {
         return 0;
     }
 
@@ -110,7 +110,7 @@ pl_getLeading(const pl_paragraph *paragraph)
 {
     ParagraphLayout *pl = (ParagraphLayout *) paragraph;
 
-    if (pl == NULL) {
+    if (pl == nullptr) {
         return 0;
     }
 
@@ -122,7 +122,7 @@ pl_reflow(pl_paragraph *paragraph)
 {
     ParagraphLayout *pl = (ParagraphLayout *) paragraph;
 
-    if (pl == NULL) {
+    if (pl == nullptr) {
         return;
     }
 
@@ -134,8 +134,8 @@ pl_nextLine(pl_paragraph *paragraph, float width)
 {
     ParagraphLayout *pl = (ParagraphLayout *) paragraph;
 
-    if (pl == NULL) {
-        return NULL;
+    if (pl == nullptr) {
+        return nullptr;
     }
 
     return (pl_line *) pl->nextLine(width);
@@ -154,7 +154,7 @@ pl_countLineRuns(const pl_line *line)
 {
     ParagraphLayout::Line *ll = (ParagraphLayout::Line *) line;
 
-    if (ll == NULL) {
+    if (ll == nullptr) {
         return 0;
     }
 
@@ -166,7 +166,7 @@ pl_getLineAscent(const pl_line *line)
 {
     ParagraphLayout::Line *ll = (ParagraphLayout::Line *) line;
 
-    if (ll == NULL) {
+    if (ll == nullptr) {
         return 0;
     }
 
@@ -178,7 +178,7 @@ pl_getLineDescent(const pl_line *line)
 {
     ParagraphLayout::Line *ll = (ParagraphLayout::Line *) line;
 
-    if (ll == NULL) {
+    if (ll == nullptr) {
         return 0;
     }
 
@@ -190,7 +190,7 @@ pl_getLineLeading(const pl_line *line)
 {
     ParagraphLayout::Line *ll = (ParagraphLayout::Line *) line;
 
-    if (ll == NULL) {
+    if (ll == nullptr) {
         return 0;
     }
 
@@ -202,7 +202,7 @@ pl_getLineWidth(const pl_line *line)
 {
     ParagraphLayout::Line *ll = (ParagraphLayout::Line *) line;
 
-    if (ll == NULL) {
+    if (ll == nullptr) {
         return 0;
     }
 
@@ -214,7 +214,7 @@ pl_getLineVisualRun(const pl_line *line, le_int32 runIndex)
 {
     ParagraphLayout::Line *ll = (ParagraphLayout::Line *) line;
 
-    if (ll == NULL) {
+    if (ll == nullptr) {
         return 0;
     }
 
@@ -226,8 +226,8 @@ pl_getVisualRunFont(const pl_visualRun *run)
 {
     ParagraphLayout::VisualRun *vr = (ParagraphLayout::VisualRun *) run;
 
-    if (vr == NULL) {
-        return NULL;
+    if (vr == nullptr) {
+        return nullptr;
     }
 
     return (const le_font *) vr->getFont();
@@ -238,7 +238,7 @@ pl_getVisualRunDirection(const pl_visualRun *run)
 {
     ParagraphLayout::VisualRun *vr = (ParagraphLayout::VisualRun *) run;
 
-    if (vr == NULL) {
+    if (vr == nullptr) {
         return UBIDI_LTR;
     }
 
@@ -250,7 +250,7 @@ pl_getVisualRunGlyphCount(const pl_visualRun *run)
 {
     ParagraphLayout::VisualRun *vr = (ParagraphLayout::VisualRun *) run;
 
-    if (vr == NULL) {
+    if (vr == nullptr) {
         return -1;
     }
 
@@ -262,8 +262,8 @@ pl_getVisualRunGlyphs(const pl_visualRun *run)
 {
     ParagraphLayout::VisualRun *vr = (ParagraphLayout::VisualRun *) run;
 
-    if (vr == NULL) {
-        return NULL;
+    if (vr == nullptr) {
+        return nullptr;
     }
 
     return vr->getGlyphs();
@@ -274,8 +274,8 @@ pl_getVisualRunPositions(const pl_visualRun *run)
 {
     ParagraphLayout::VisualRun *vr = (ParagraphLayout::VisualRun *) run;
 
-    if (vr == NULL) {
-        return NULL;
+    if (vr == nullptr) {
+        return nullptr;
     }
 
     return vr->getPositions();
@@ -286,8 +286,8 @@ pl_getVisualRunGlyphToCharMap(const pl_visualRun *run)
 {
     ParagraphLayout::VisualRun *vr = (ParagraphLayout::VisualRun *) run;
 
-    if (vr == NULL) {
-        return NULL;
+    if (vr == nullptr) {
+        return nullptr;
     }
 
     return vr->getGlyphToCharMap();
@@ -298,7 +298,7 @@ pl_getVisualRunAscent(const pl_visualRun *run)
 {
     ParagraphLayout::VisualRun *vr = (ParagraphLayout::VisualRun *) run;
 
-    if (vr == NULL) {
+    if (vr == nullptr) {
         return 0;
     }
 
@@ -310,7 +310,7 @@ pl_getVisualRunDescent(const pl_visualRun *run)
 {
     ParagraphLayout::VisualRun *vr = (ParagraphLayout::VisualRun *) run;
 
-    if (vr == NULL) {
+    if (vr == nullptr) {
         return 0;
     }
 
@@ -322,7 +322,7 @@ pl_getVisualRunLeading(const pl_visualRun *run)
 {
     ParagraphLayout::VisualRun *vr = (ParagraphLayout::VisualRun *) run;
 
-    if (vr == NULL) {
+    if (vr == nullptr) {
         return 0;
     }
 
index 282602364b8ec13431e500187aa4a9e51024e727..e2796ad24d2e2e500a763a10ea7cce3874c83dfe 100644 (file)
@@ -44,7 +44,7 @@ pl_getFontRunCount(const pl_fontRuns *fontRuns)
 {
     const FontRuns *fr = (const FontRuns *) fontRuns;
 
-    if (fr == NULL) {
+    if (fr == nullptr) {
         return -1;
     }
 
@@ -56,7 +56,7 @@ pl_resetFontRuns(pl_fontRuns *fontRuns)
 {
     FontRuns *fr = (FontRuns *) fontRuns;
 
-    if (fr != NULL) {
+    if (fr != nullptr) {
         fr->reset();
     }
 }
@@ -66,7 +66,7 @@ pl_getFontRunLastLimit(const pl_fontRuns *fontRuns)
 {
     const FontRuns *fr = (const FontRuns *) fontRuns;
 
-    if (fr == NULL) {
+    if (fr == nullptr) {
         return -1;
     }
 
@@ -79,7 +79,7 @@ pl_getFontRunLimit(const pl_fontRuns *fontRuns,
 {
     const FontRuns *fr = (const FontRuns *) fontRuns;
 
-    if (fr == NULL) {
+    if (fr == nullptr) {
         return -1;
     }
 
@@ -92,8 +92,8 @@ pl_getFontRunFont(const pl_fontRuns *fontRuns,
 {
     const FontRuns *fr = (const FontRuns *) fontRuns;
 
-    if (fr == NULL) {
-        return NULL;
+    if (fr == nullptr) {
+        return nullptr;
     }
 
     return (const le_font *) fr->getFont(run);
@@ -106,7 +106,7 @@ pl_addFontRun(pl_fontRuns *fontRuns,
 {
     FontRuns *fr = (FontRuns *) fontRuns;
 
-    if (fr == NULL) {
+    if (fr == nullptr) {
         return -1;
     }
 
@@ -140,7 +140,7 @@ pl_getValueRunCount(const pl_valueRuns *valueRuns)
 {
     const ValueRuns *vr = (const ValueRuns *) valueRuns;
 
-    if (vr == NULL) {
+    if (vr == nullptr) {
         return -1;
     }
 
@@ -152,7 +152,7 @@ pl_resetValueRuns(pl_valueRuns *valueRuns)
 {
     ValueRuns *vr = (ValueRuns *) valueRuns;
 
-    if (vr != NULL) {
+    if (vr != nullptr) {
         vr->reset();
     }
 }
@@ -162,7 +162,7 @@ pl_getValueRunLastLimit(const pl_valueRuns *valueRuns)
 {
     const ValueRuns *vr = (const ValueRuns *) valueRuns;
 
-    if (vr == NULL) {
+    if (vr == nullptr) {
         return -1;
     }
 
@@ -175,7 +175,7 @@ pl_getValueRunLimit(const pl_valueRuns *valueRuns,
 {
     const ValueRuns *vr = (const ValueRuns *) valueRuns;
 
-    if (vr == NULL) {
+    if (vr == nullptr) {
         return -1;
     }
 
@@ -188,7 +188,7 @@ pl_getValueRunValue(const pl_valueRuns *valueRuns,
 {
     const ValueRuns *vr = (const ValueRuns *) valueRuns;
 
-    if (vr == NULL) {
+    if (vr == nullptr) {
         return -1;
     }
 
@@ -202,7 +202,7 @@ pl_addValueRun(pl_valueRuns *valueRuns,
 {
     ValueRuns *vr = (ValueRuns *) valueRuns;
 
-    if (vr == NULL) {
+    if (vr == nullptr) {
         return -1;
     }
 
@@ -316,13 +316,13 @@ private:
 };
 
 inline ULocRuns::ULocRuns()
-    : LocaleRuns(0), fLocaleNames(NULL)
+    : LocaleRuns(0), fLocaleNames(nullptr)
 {
     // nothing else to do...
 }
 
 inline ULocRuns::ULocRuns(const ULocRuns & /*other*/)
-    : LocaleRuns(0), fLocaleNames(NULL)
+    : LocaleRuns(0), fLocaleNames(nullptr)
 {
     // nothing else to do...
 }
@@ -345,7 +345,7 @@ ULocRuns::ULocRuns(const char **locales, const le_int32 *limits, le_int32 count)
 }
 
 ULocRuns::ULocRuns(le_int32 initialCapacity)
-    : LocaleRuns(initialCapacity), fLocaleNames(NULL)
+    : LocaleRuns(initialCapacity), fLocaleNames(nullptr)
 {
     if(initialCapacity > 0) {
         fLocaleNames = LE_NEW_ARRAY(const char *, initialCapacity);
@@ -362,10 +362,10 @@ ULocRuns::~ULocRuns()
 
     if (fClientArrays) {
         LE_DELETE_ARRAY(fLocales);
-        fLocales = NULL;
+        fLocales = nullptr;
     } else {
         LE_DELETE_ARRAY(fLocaleNames);
-        fLocaleNames = NULL;
+        fLocaleNames = nullptr;
     }
 }
 
@@ -398,7 +398,7 @@ le_int32 ULocRuns::add(const char *locale, le_int32 limit)
 const char *ULocRuns::getLocaleName(le_int32 run) const
 {
     if (run < 0 || run >= getCount()) {
-        return NULL;
+        return nullptr;
     }
 
     return fLocaleNames[run];
@@ -433,7 +433,7 @@ pl_getLocaleRunCount(const pl_localeRuns *localeRuns)
 {
     const ULocRuns *lr = (const ULocRuns *) localeRuns;
 
-    if (lr == NULL) {
+    if (lr == nullptr) {
         return -1;
     }
 
@@ -445,7 +445,7 @@ pl_resetLocaleRuns(pl_localeRuns *localeRuns)
 {
     ULocRuns *lr = (ULocRuns *) localeRuns;
 
-    if (lr != NULL) {
+    if (lr != nullptr) {
         lr->reset();
     }
 }
@@ -455,7 +455,7 @@ pl_getLocaleRunLastLimit(const pl_localeRuns *localeRuns)
 {
     const ULocRuns *lr = (const ULocRuns *) localeRuns;
 
-    if (lr == NULL) {
+    if (lr == nullptr) {
         return -1;
     }
 
@@ -468,7 +468,7 @@ pl_getLocaleRunLimit(const pl_localeRuns *localeRuns,
 {
     const ULocRuns *lr = (const ULocRuns *) localeRuns;
 
-    if (lr == NULL) {
+    if (lr == nullptr) {
         return -1;
     }
 
@@ -481,8 +481,8 @@ pl_getLocaleRunLocale(const pl_localeRuns *localeRuns,
 {
     const ULocRuns *lr = (const ULocRuns *) localeRuns;
 
-    if (lr == NULL) {
-        return NULL;
+    if (lr == nullptr) {
+        return nullptr;
     }
 
     return lr->getLocaleName(run);
@@ -495,7 +495,7 @@ pl_addLocaleRun(pl_localeRuns *localeRuns,
 {
     ULocRuns *lr = (ULocRuns *) localeRuns;
 
-    if (lr == NULL) {
+    if (lr == nullptr) {
         return -1;
     }
 
index 0f8baff2f16384a59361722c8e025a10b53164b7..30e2e0715eb4ce5590d5125c9c787e91856acb2d 100644 (file)
@@ -32,13 +32,13 @@ int main( void )
 {
     UFILE *out;
     UErrorCode status  = U_ZERO_ERROR;
-    out = u_finit(stdout, NULL, NULL);
+    out = u_finit(stdout, nullptr, nullptr);
     if(!out) {
         fprintf(stderr, "Could not initialize (finit()) over stdout! \n");
         return 1;
     }
     ucnv_setFromUCallBack(u_fgetConverter(out), UCNV_FROM_U_CALLBACK_ESCAPE,
-        NULL, NULL, NULL, &status);
+        nullptr, nullptr, nullptr, &status);
     if(U_FAILURE(status)) {
         u_fprintf(out, "Warning- couldn't set the substitute callback - err %s\n", u_errorName(status));
     }
index f8193707144d8aa60fbf50034176df2266d615cb..b5ed7de83c5c854ff4b8443063ecd280cec90bbe 100644 (file)
@@ -184,7 +184,7 @@ int main( void )
 {
     UErrorCode status = U_ZERO_ERROR;
 
-    out = u_finit(stdout, NULL, NULL);
+    out = u_finit(stdout, nullptr, nullptr);
 
     u_fprintf(out, "ICU Iteration Sample Program (C++)\n\n");
 
index 909412f5b67fc93ec7356ed65a1e17b021f35db7..b58ac877cca650cd7d5694114a2f05d4c2a0a27e 100644 (file)
@@ -168,7 +168,7 @@ UBool processCollator()
     if (opt_rules != 0) {
                u_unescape(opt_rules, rules, 100);
         collator = ucol_openRules(rules, -1, UCOL_OFF, UCOL_TERTIARY, 
-                                         NULL, &status);
+                                         nullptr, &status);
     }
     else {
         collator = ucol_open(opt_locale, &status);
index 3644fe01687510eeb43ce4fc89c622ecb3e2c1d8..912a849ce75b48fc657a04edcebed588bca28926 100644 (file)
@@ -24,7 +24,7 @@ static void dtitvfmtPreDefined() {
     u_printf("===============================================================================\n");
 
     //! [dtitvfmtPreDefined]
-    UFILE *out = u_finit(stdout, NULL, "UTF-8");
+    UFILE *out = u_finit(stdout, nullptr, "UTF-8");
     UErrorCode status =U_ZERO_ERROR;
     // create 3 Date Intervals
     UnicodeString data[] = {
@@ -86,7 +86,7 @@ static void dtitvfmtCustomized() {
     u_printf("\n");
     u_printf("================================================================================\n");
     //! [dtitvfmtCustomized]
-    UFILE *out = u_finit(stdout, NULL, "UTF-8");
+    UFILE *out = u_finit(stdout, nullptr, "UTF-8");
     UErrorCode status =U_ZERO_ERROR;
     UnicodeString data[] = {
         UnicodeString("2007-9-10 10:10:10"),
index 1c39f9794f9007193f917340fb7e9a9dcbd829cb..b55f31c50d813ad7e3db1cc4e84d0007b4d9cd37 100644 (file)
@@ -41,7 +41,7 @@ static void getBestPatternExample() {
 
     const char* filename = "sample.txt";
     /* open a UTF-8 file for writing */
-    UFILE* f = u_fopen(filename, "w", NULL,"UTF-8");
+    UFILE* f = u_fopen(filename, "w", nullptr,"UTF-8");
     UnicodeString dateReturned;
     UErrorCode status =U_ZERO_ERROR;
     Calendar *cal = Calendar::createInstance(status);
@@ -121,7 +121,7 @@ static void replaceFieldTypesExample() {
        u_printf(" Use replaceFieldTypes API to replace zone 'zzzz' with 'vvvv'\n");
        u_printf("========================================================================\n");
        //! [replaceFieldTypesExample]
-        UFILE *out = u_finit(stdout, NULL, "UTF-8");
+        UFILE *out = u_finit(stdout, nullptr, "UTF-8");
         UErrorCode status =U_ZERO_ERROR;
         UnicodeString pattern,dateReturned;
         Locale locale =Locale::getFrance();
index 5bb32649c518be94441adfb90e8e6602542853bb..37ceb7eb1e1194ad7be1e212b5c26dcf8c4919d4 100644 (file)
@@ -32,8 +32,8 @@ FontMap::FontMap(const char *fileName, le_int16 pointSize, GUISupport *guiSuppor
 /**/
     for (i = 0; i < scriptCodeCount; i += 1) {
         fFontIndices[i] = -1;
-        fFontNames[i] = NULL;
-        fFontInstances[i] = NULL;
+        fFontNames[i] = nullptr;
+        fFontInstances[i] = nullptr;
     }
  /**/
 
@@ -46,14 +46,14 @@ FontMap::FontMap(const char *fileName, le_int16 pointSize, GUISupport *guiSuppor
 
     file = fopen(fileName, "r");
 
-    if (file == NULL) {
+    if (file == nullptr) {
         sprintf(errorMessage, "Could not open the font map file: %s.", fileName);
         fGUISupport->postErrorMessage(errorMessage, "Font Map Error");
         status = LE_FONT_FILE_NOT_FOUND_ERROR;
         return;
     }
 
-    while (fgets(buffer, BUFFER_SIZE, file) != NULL) {
+    while (fgets(buffer, BUFFER_SIZE, file) != nullptr) {
         UScriptCode scriptCode;
         UErrorCode scriptStatus = U_ZERO_ERROR;
 
@@ -116,13 +116,13 @@ FontMap::~FontMap()
     le_int32 font;
 
     for (font = 0; font < fFontCount; font += 1) {
-        if (fFontNames[font] != NULL) {
+        if (fFontNames[font] != nullptr) {
             delete[] (char *) fFontNames[font];
         }
     }
 
     for (font = 0; font < fFontCount; font += 1) {
-        if (fFontInstances[font] != NULL) {
+        if (fFontInstances[font] != nullptr) {
             delete fFontInstances[font];
         }
     }
@@ -199,12 +199,12 @@ char *FontMap::strip(char *s)
 const LEFontInstance *FontMap::getScriptFont(le_int32 scriptCode, LEErrorCode &status)
 {
     if (LE_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     if (scriptCode <= -1 || scriptCode >= scriptCodeCount) {
         status = LE_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
 
@@ -214,16 +214,16 @@ const LEFontInstance *FontMap::getScriptFont(le_int32 scriptCode, LEErrorCode &s
         sprintf(errorMessage, "No font was set for script %s", uscript_getName((UScriptCode) scriptCode));
         fGUISupport->postErrorMessage(errorMessage, "Font Map Error");
         status = LE_FONT_FILE_NOT_FOUND_ERROR;
-        return NULL;
+        return nullptr;
     }
 
-    if (fFontInstances[fontIndex] == NULL) {
+    if (fFontInstances[fontIndex] == nullptr) {
         fFontInstances[fontIndex] = openFont(fFontNames[fontIndex], fPointSize, status);
 
         if (LE_FAILURE(status)) {
             sprintf(errorMessage, "Could not open font file %s", fFontNames[fontIndex]);
             fGUISupport->postErrorMessage(errorMessage, "Font Map Error");
-            return NULL;
+            return nullptr;
         }
     }
 
@@ -263,7 +263,7 @@ void FontMap::getMaxMetrics()
         LEErrorCode status = LE_NO_ERROR;
         le_int32 ascent, descent, leading;
 
-        if (fFontInstances[i] == NULL) {
+        if (fFontInstances[i] == nullptr) {
             fFontInstances[i] = openFont(fFontNames[i], fPointSize, status);
 
             if (LE_FAILURE(status)) {
index fcf9fe892fbbb255b1e9d0ac15aa0da4f7a3a598..5429304137b3ad6b76babdb7bc6cfdd1e379b8a2 100644 (file)
@@ -27,14 +27,14 @@ FontTableCache::FontTableCache()
 {
     fTableCache = LE_NEW_ARRAY(FontTableCacheEntry, fTableCacheSize);
 
-    if (fTableCache == NULL) {
+    if (fTableCache == nullptr) {
         fTableCacheSize = 0;
         return;
     }
 
     for (int i = 0; i < fTableCacheSize; i += 1) {
         fTableCache[i].tag   = 0;
-        fTableCache[i].table = NULL;
+        fTableCache[i].table = nullptr;
     }
 }
 
@@ -44,13 +44,13 @@ FontTableCache::~FontTableCache()
         freeFontTable(fTableCache[i].table);
 
         fTableCache[i].tag   = 0;
-        fTableCache[i].table = NULL;
+        fTableCache[i].table = nullptr;
     }
 
     fTableCacheCurr = 0;
 
     LE_DELETE_ARRAY(fTableCache);
-    fTableCache = NULL;
+    fTableCache = nullptr;
 }
 
 void FontTableCache::freeFontTable(const void *table) const
@@ -82,7 +82,7 @@ void FontTableCache::add(LETag tableTag, const void *table)
 
         for (le_int32 i = fTableCacheSize; i < newSize; i += 1) {
             fTableCache[i].tag   = 0;
-            fTableCache[i].table = NULL;
+            fTableCache[i].table = nullptr;
         }
 
         fTableCacheSize = newSize;
index 8bd917730b8738a96732cd25c7fc49b08235d494..97d3c6e78d313c209029b94103d34d3a3c66495d 100644 (file)
@@ -28,7 +28,7 @@
 #include "cmaps.h"
 
 GDISurface::GDISurface(HDC theHDC)
-    : fHdc(theHDC), fCurrentFont(NULL)
+    : fHdc(theHDC), fCurrentFont(nullptr)
 {
     // nothing else to do
 }
@@ -41,7 +41,7 @@ GDISurface::~GDISurface()
 void GDISurface::setHDC(HDC theHDC)
 {
     fHdc         = theHDC;
-    fCurrentFont = NULL;
+    fCurrentFont = nullptr;
 }
 
 void GDISurface::setFont(const GDIFontInstance *font)
@@ -108,9 +108,9 @@ void GDISurface::drawGlyphs(const LEFontInstance *font, const LEGlyphID *glyphs,
 }
 
 GDIFontInstance::GDIFontInstance(GDISurface *surface, TCHAR *faceName, le_int16 pointSize, LEErrorCode &status)
-    : FontTableCache(), fSurface(surface), fFont(NULL),
+    : FontTableCache(), fSurface(surface), fFont(nullptr),
       fPointSize(pointSize), fUnitsPerEM(0), fAscent(0), fDescent(0), fLeading(0),
-      fDeviceScaleX(1), fDeviceScaleY(1), fMapper(NULL)
+      fDeviceScaleX(1), fDeviceScaleY(1), fMapper(nullptr)
 {
     LOGFONT lf;
     FLOAT dpiX, dpiY;
@@ -125,9 +125,9 @@ GDIFontInstance::GDIFontInstance(GDISurface *surface, TCHAR *faceName, le_int16
     SaveDC(hdc);
 
     SetGraphicsMode(hdc, GM_ADVANCED);
-    ModifyWorldTransform(hdc, NULL, MWT_IDENTITY);
-    SetViewportOrgEx(hdc, 0, 0, NULL);
-    SetWindowOrgEx(hdc, 0, 0, NULL);
+    ModifyWorldTransform(hdc, nullptr, MWT_IDENTITY);
+    SetViewportOrgEx(hdc, 0, 0, nullptr);
+    SetWindowOrgEx(hdc, 0, 0, nullptr);
 
     dpiX = (FLOAT) GetDeviceCaps(hdc, LOGPIXELSX);
     dpiY = (FLOAT) GetDeviceCaps(hdc, LOGPIXELSY);
@@ -159,7 +159,7 @@ GDIFontInstance::GDIFontInstance(GDISurface *surface, TCHAR *faceName, le_int16
 
     fFont = CreateFontIndirect(&lf);
 
-    if (fFont == NULL) {
+    if (fFont == nullptr) {
         status = LE_FONT_FILE_NOT_FOUND_ERROR;
         return;
     }
@@ -193,9 +193,9 @@ restore:
 }
 
 GDIFontInstance::GDIFontInstance(GDISurface *surface, const char *faceName, le_int16 pointSize, LEErrorCode &status)
-    : FontTableCache(), fSurface(surface), fFont(NULL),
+    : FontTableCache(), fSurface(surface), fFont(nullptr),
       fPointSize(pointSize), fUnitsPerEM(0), fAscent(0), fDescent(0), fLeading(0),
-      fDeviceScaleX(1), fDeviceScaleY(1), fMapper(NULL)
+      fDeviceScaleX(1), fDeviceScaleY(1), fMapper(nullptr)
 {
     LOGFONTA lf;
     FLOAT dpiX, dpiY;
@@ -210,9 +210,9 @@ GDIFontInstance::GDIFontInstance(GDISurface *surface, const char *faceName, le_i
     SaveDC(hdc);
 
     SetGraphicsMode(hdc, GM_ADVANCED);
-    ModifyWorldTransform(hdc, NULL, MWT_IDENTITY);
-    SetViewportOrgEx(hdc, 0, 0, NULL);
-    SetWindowOrgEx(hdc, 0, 0, NULL);
+    ModifyWorldTransform(hdc, nullptr, MWT_IDENTITY);
+    SetViewportOrgEx(hdc, 0, 0, nullptr);
+    SetWindowOrgEx(hdc, 0, 0, nullptr);
 
     dpiX = (FLOAT) GetDeviceCaps(hdc, LOGPIXELSX);
     dpiY = (FLOAT) GetDeviceCaps(hdc, LOGPIXELSY);
@@ -247,7 +247,7 @@ GDIFontInstance::GDIFontInstance(GDISurface *surface, const char *faceName, le_i
 
     fFont = CreateFontIndirectA(&lf);
 
-    if (fFont == NULL) {
+    if (fFont == nullptr) {
         status = LE_FONT_FILE_NOT_FOUND_ERROR;
         return;
     }
@@ -262,13 +262,13 @@ GDIFontInstance::GDIFontInstance(GDISurface *surface, const char *faceName, le_i
         fDescent = otm.otmTextMetrics.tmDescent;
         fLeading = otm.otmTextMetrics.tmExternalLeading;
     } else {
-        const HEADTable *headTable = NULL;
-        const HHEATable *hheaTable = NULL;
+        const HEADTable *headTable = nullptr;
+        const HHEATable *hheaTable = nullptr;
 
         // read unitsPerEm from 'head' table
         headTable = (const HEADTable *) readFontTable(LE_HEAD_TABLE_TAG);
 
-        if (headTable == NULL) {
+        if (headTable == nullptr) {
             status = LE_MISSING_FONT_TABLE_ERROR;
             goto restore;
         }
@@ -278,7 +278,7 @@ GDIFontInstance::GDIFontInstance(GDISurface *surface, const char *faceName, le_i
 
         hheaTable = (HHEATable *) readFontTable(LE_HHEA_TABLE_TAG);
 
-        if (hheaTable == NULL) {
+        if (hheaTable == nullptr) {
             status = LE_MISSING_FONT_TABLE_ERROR;
             goto restore;
         }
@@ -311,13 +311,13 @@ GDIFontInstance::~GDIFontInstance()
     delete[] fTableCache;
 #endif
 
-    if (fFont != NULL) {
+    if (fFont != nullptr) {
         // FIXME: call RemoveObject first?
         DeleteObject(fFont);
     }
 
     delete fMapper;
-    fMapper = NULL;
+    fMapper = nullptr;
 }
 
 LEErrorCode GDIFontInstance::initMapper()
@@ -325,13 +325,13 @@ LEErrorCode GDIFontInstance::initMapper()
     LETag cmapTag = LE_CMAP_TABLE_TAG;
     const CMAPTable *cmap = (const CMAPTable *) readFontTable(cmapTag);
 
-    if (cmap == NULL) {
+    if (cmap == nullptr) {
         return LE_MISSING_FONT_TABLE_ERROR;
     }
 
     fMapper = CMAPMapper::createUnicodeMapper(cmap);
 
-    if (fMapper == NULL) {
+    if (fMapper == nullptr) {
         return LE_MISSING_FONT_TABLE_ERROR;
     }
 
@@ -349,8 +349,8 @@ const void *GDIFontInstance::readFontTable(LETag tableTag) const
 
     HDC   hdc    = fSurface->getHDC();
     DWORD stag   = SWAPL(tableTag);
-    DWORD len    = GetFontData(hdc, stag, 0, NULL, 0);
-    void *result = NULL;
+    DWORD len    = GetFontData(hdc, stag, 0, nullptr, 0);
+    void *result = nullptr;
 
     if (len != GDI_ERROR) {
         result = LE_NEW_ARRAY(char, len);
@@ -377,7 +377,7 @@ void GDIFontInstance::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const
 
     fSurface->setFont(this);
 
-    result = GetGlyphOutline(hdc, glyph, GGO_GLYPH_INDEX | GGO_METRICS, &metrics, 0, NULL, &identity);
+    result = GetGlyphOutline(hdc, glyph, GGO_GLYPH_INDEX | GGO_METRICS, &metrics, 0, nullptr, &identity);
 
     if (result == GDI_ERROR) {
         return;
index 19213b22b5b1d72b2f50132840c2eef07e116158..3ecc9a66219564ad9fe75e87997a0671df46c9c1 100644 (file)
@@ -36,7 +36,7 @@ const LEFontInstance *GDIFontMap::openFont(const char *fontName, le_int16 pointS
 
        if (LE_FAILURE(status)) {
                delete result;
-               result = NULL;
+               result = nullptr;
        }
 
     return result;
index e314b8ae7fad29e3c46a74dcfe0f58dfb8c8c1c1..a0ad38466288de86ee878e8401cc5d973cc4c309 100644 (file)
@@ -23,6 +23,6 @@
 
 void GDIGUISupport::postErrorMessage(const char *message, const char *title)
 {
-    MessageBoxA(NULL, message, title, MB_ICONERROR);
+    MessageBoxA(nullptr, message, title, MB_ICONERROR);
 }
 
index 6f6a59ff3af0eeb1ae53e22ef5b79ec8ba3395d9..b8af64a47144004030a023f43de5cfcedae00a86 100644 (file)
@@ -54,12 +54,12 @@ void GnomeSurface::drawGlyphs(const LEFontInstance *font, const LEGlyphID *glyph
 
 GnomeFontInstance::GnomeFontInstance(FT_Library engine, const char *fontPathName, le_int16 pointSize, LEErrorCode &status)
     : FontTableCache(), fPointSize(pointSize), fUnitsPerEM(0), fAscent(0), fDescent(0), fLeading(0),
-      fDeviceScaleX(1), fDeviceScaleY(1), fMapper(NULL)
+      fDeviceScaleX(1), fDeviceScaleY(1), fMapper(nullptr)
 {
     FT_Error error;
 
-    fFace      = NULL;
-    fCairoFace = NULL;
+    fFace      = nullptr;
+    fCairoFace = nullptr;
 
     error = FT_New_Face(engine, fontPathName, 0, &fFace);
 
@@ -97,7 +97,7 @@ GnomeFontInstance::~GnomeFontInstance()
 {
     cairo_font_face_destroy(fCairoFace);
     
-    if (fFace != NULL) {
+    if (fFace != nullptr) {
         FT_Done_Face(fFace);
     }
 }
@@ -107,13 +107,13 @@ LEErrorCode GnomeFontInstance::initMapper()
     LETag cmapTag = LE_CMAP_TABLE_TAG;
     const CMAPTable *cmap = (const CMAPTable *) readFontTable(cmapTag);
 
-    if (cmap == NULL) {
+    if (cmap == nullptr) {
         return LE_MISSING_FONT_TABLE_ERROR;
     }
 
     fMapper = CMAPMapper::createUnicodeMapper(cmap);
 
-    if (fMapper == NULL) {
+    if (fMapper == nullptr) {
         return LE_MISSING_FONT_TABLE_ERROR;
     }
 
@@ -128,9 +128,9 @@ const void *GnomeFontInstance::getFontTable(LETag tableTag) const
 const void *GnomeFontInstance::readFontTable(LETag tableTag) const
 {
     FT_ULong len = 0;
-    FT_Byte *result = NULL;
+    FT_Byte *result = nullptr;
 
-    FT_Load_Sfnt_Table(fFace, tableTag, 0, NULL, &len);
+    FT_Load_Sfnt_Table(fFace, tableTag, 0, nullptr, &len);
 
     if (len > 0) {
         result = LE_NEW_ARRAY(FT_Byte, len);
index d85f28b9742fbdb3085584e62e8c463e89fec2ef..e7634b982fb0a8a0e56491454880fb2cb9bf282a 100644 (file)
@@ -38,7 +38,7 @@ const LEFontInstance *GnomeFontMap::openFont(const char *fontName, le_int16 poin
 
     if (LE_FAILURE(status)) {
       delete result;
-      result = NULL;
+      result = nullptr;
     }
 
     return result;
index 21eb6fb6d2f8db9251404baff4ccc373fd9b6c10..e008d05c926fbf51db3e6ce5ab6e09e2b55dfec3 100644 (file)
@@ -31,7 +31,7 @@ void GnomeGUISupport::postErrorMessage(const char *message, const char *title)
   gchar *s;
   GtkWidget *error;
 
-  s = g_strconcat(title, ":\n", message, NULL);
+  s = g_strconcat(title, ":\n", message, nullptr);
   error = gnome_error_dialog(s);
   gtk_widget_show(error);
   g_free(s);
index d511d1324a2cc6d9a2121ee2edb4f9b6bd93b04b..bdeb2e420eb492fb1720542bc7cc743eb83cb7aa 100644 (file)
@@ -36,7 +36,7 @@ ScriptCompositeFontInstance::ScriptCompositeFontInstance(FontMap *fontMap)
 ScriptCompositeFontInstance::~ScriptCompositeFontInstance()
 {
     delete fFontMap;
-    fFontMap = NULL;
+    fFontMap = nullptr;
 }
 
 void ScriptCompositeFontInstance::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const
@@ -69,18 +69,18 @@ le_bool ScriptCompositeFontInstance::getGlyphPoint(LEGlyphID glyph, le_int32 poi
 const LEFontInstance *ScriptCompositeFontInstance::getSubFont(const LEUnicode chars[], le_int32 *offset, le_int32 limit, le_int32 script, LEErrorCode &success) const
 {
     if (LE_FAILURE(success)) {
-        return NULL;
+        return nullptr;
     }
 
-    if (chars == NULL || *offset < 0 || limit < 0 || *offset >= limit || script < 0 || script >= scriptCodeCount) {
+    if (chars == nullptr || *offset < 0 || limit < 0 || *offset >= limit || script < 0 || script >= scriptCodeCount) {
         success = LE_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     const LEFontInstance *result = fFontMap->getScriptFont(script, success);
 
     if (LE_FAILURE(success)) {
-        return NULL;
+        return nullptr;
     }
 
     *offset = limit;
index 5b287a12afdbb24956d6a76b07a1f7e2bab4ab7c..9e636cb3db576a72bf24aa67dd9673e446021115 100644 (file)
@@ -71,7 +71,7 @@ public:
      *                  was returned cannot render all of the text.
      *
      * @return an <code>LEFontInstance</code> for the sub font which can render the characters, or
-     *         <code>NULL</code> if there is an error.
+     *         <code>nullptr</code> if there is an error.
      *
      * @see LEScripts.h
      */
@@ -133,7 +133,7 @@ private:
 
 inline const void *ScriptCompositeFontInstance::getFontTable(LETag /*tableTag*/) const
 {
-    return NULL;
+    return nullptr;
 }
 
 // Can't get units per EM without knowing which sub-font, so
index a7caa01fec6fa403e23cc10f882701e631c04eb2..caff022ac2f45c80a52f1fee0b5712804718e263 100644 (file)
@@ -41,7 +41,7 @@ const UChar *UnicodeReader::readFile(const char *fileName, GUISupport *guiSuppor
     
     f = fopen(fileName, "rb");
     
-    if( f == NULL ) {
+    if( f == nullptr ) {
         sprintf(errorMessage,"Couldn't open %s: %s \n", fileName, strerror(errno));
         guiSupport->postErrorMessage(errorMessage, "Text File Error");
         return 0;
@@ -116,7 +116,7 @@ const UChar *UnicodeReader::readFile(const char *fileName, GUISupport *guiSuppor
     }
     
     myText.extract(0, myText.length(), charBuffer);
-    charBuffer[charCount] = 0;    // NULL terminate for easier reading in the debugger
+    charBuffer[charCount] = 0;    // NUL terminate for easier reading in the debugger
     
     return charBuffer;
 }
index d6f71ed7085868f20b800a25679843047307e86e..7f2576f82e712eed7191379775a4c33300193e32 100644 (file)
@@ -66,7 +66,7 @@ CMAPMapper *CMAPMapper::createUnicodeMapper(const CMAPTable *cmap)
 {
     le_uint16 i;
     le_uint16 nSubtables = SWAPW(cmap->numberSubtables);
-    const CMAPEncodingSubtable *subtable = NULL;
+    const CMAPEncodingSubtable *subtable = nullptr;
     le_uint32 offset1 = 0, offset10 = 0;
 
     for (i = 0; i < nSubtables; i += 1) {
@@ -92,7 +92,7 @@ CMAPMapper *CMAPMapper::createUnicodeMapper(const CMAPTable *cmap)
     } else if (offset1 != 0) {
         subtable = (const CMAPEncodingSubtable *) ((const char *) cmap + offset1);
     } else {
-        return NULL;
+        return nullptr;
     }
 
     switch (SWAPW(subtable->format)) {
@@ -110,7 +110,7 @@ CMAPMapper *CMAPMapper::createUnicodeMapper(const CMAPTable *cmap)
         break;
     }
 
-    return NULL;
+    return nullptr;
 }
 
 CMAPFormat4Mapper::CMAPFormat4Mapper(const CMAPTable *cmap, const CMAPFormat4Encoding *header)
index 9944d3d40930c2b0b182c8a357f75ddc5c2d6a9c..ea1e0d6529a92afea7889e130b83b1d0d5b78ef1 100644 (file)
@@ -48,7 +48,7 @@ static GnomeGUISupport *guiSupport;
 static GnomeFontMap *fontMap;
 static ScriptCompositeFontInstance *font;
 
-static GSList *appList = NULL;
+static GSList *appList = nullptr;
 
 GtkWidget *newSample(const gchar *fileName);
 void       closeSample(GtkWidget *sample);
@@ -56,10 +56,10 @@ void       closeSample(GtkWidget *sample);
 void showabout(GtkWidget */*widget*/, gpointer /*data*/)
 {
     GtkWidget *aboutBox;
-    const gchar *documentedBy[] = {NULL};
+    const gchar *documentedBy[] = {nullptr};
     const gchar *writtenBy[] = {
         "Eric Mader",
-        NULL
+        nullptr
     };
 
     aboutBox = gnome_about_new("Gnome Layout Sample",
@@ -69,7 +69,7 @@ void showabout(GtkWidget */*widget*/, gpointer /*data*/)
                                writtenBy,
                                documentedBy,
                                "",
-                               NULL);
+                               nullptr);
 
     gtk_widget_show(aboutBox);
 }
@@ -82,7 +82,7 @@ void notimpl(GtkObject */*object*/, gpointer /*data*/)
 gchar *prettyTitle(const gchar *path)
 {
   const gchar *name  = g_basename(path);
-  gchar *title = g_strconcat("Gnome Layout Sample - ", name, NULL);
+  gchar *title = g_strconcat("Gnome Layout Sample - ", name, nullptr);
 
   return title;
 }
@@ -99,11 +99,11 @@ void openOK(GtkObject */*object*/, gpointer data)
 
   newPara = Paragraph::paragraphFactory(fileName, font, guiSupport);
 
-  if (newPara != NULL) {
+  if (newPara != nullptr) {
     gchar *title = prettyTitle(fileName);
     GtkWidget *area = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(app), "area"));
 
-    if (context->paragraph != NULL) {
+    if (context->paragraph != nullptr) {
       delete context->paragraph;
     }
 
@@ -139,7 +139,7 @@ void openfile(GtkObject */*object*/, gpointer data)
     GTK_FILE_SELECTION(fileselection)->cancel_button;
 
   gtk_signal_connect(GTK_OBJECT(fileselection), "destroy",
-                    GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
+                    GTK_SIGNAL_FUNC(gtk_main_quit), nullptr);
 
   gtk_signal_connect(GTK_OBJECT(okButton), "clicked",
                     GTK_SIGNAL_FUNC(openOK), fileselection);
@@ -175,19 +175,19 @@ GnomeUIInfo fileMenu[] =
 {
   GNOMEUIINFO_MENU_NEW_ITEM((gchar *) "_New Sample",
                            (gchar *) "Create a new Gnome Layout Sample",
-                           newapp, NULL),
+                           newapp, nullptr),
 
-  GNOMEUIINFO_MENU_OPEN_ITEM(openfile, NULL),
+  GNOMEUIINFO_MENU_OPEN_ITEM(openfile, nullptr),
   GNOMEUIINFO_SEPARATOR,
-  GNOMEUIINFO_MENU_CLOSE_ITEM(closeapp, NULL),
-  GNOMEUIINFO_MENU_EXIT_ITEM(shutdown, NULL),
+  GNOMEUIINFO_MENU_CLOSE_ITEM(closeapp, nullptr),
+  GNOMEUIINFO_MENU_EXIT_ITEM(shutdown, nullptr),
   GNOMEUIINFO_END
 };
 
 GnomeUIInfo helpMenu[] =
 {
     // GNOMEUIINFO_HELP("gnomelayout"),
-    GNOMEUIINFO_MENU_ABOUT_ITEM(showabout, NULL),
+    GNOMEUIINFO_MENU_ABOUT_ITEM(showabout, nullptr),
     GNOMEUIINFO_END
 };
 
@@ -208,7 +208,7 @@ gint eventDelete(GtkWidget *widget, GdkEvent */*event*/, gpointer /*data*/)
 
 gint eventConfigure(GtkWidget */*widget*/, GdkEventConfigure *event, Context *context)
 {
-  if (context->paragraph != NULL) {
+  if (context->paragraph != nullptr) {
     context->width  = event->width;
     context->height = event->height;
 
@@ -222,7 +222,7 @@ gint eventConfigure(GtkWidget */*widget*/, GdkEventConfigure *event, Context *co
 
 gint eventExpose(GtkWidget *widget, GdkEvent */*event*/, Context *context)
 {
-  if (context->paragraph != NULL) {
+  if (context->paragraph != nullptr) {
     gint maxLines = context->paragraph->getLineCount() - 1;
     gint firstLine = 0, lastLine = context->height / context->paragraph->getLineHeight();
     GnomeSurface surface(widget);
@@ -251,7 +251,7 @@ GtkWidget *newSample(const gchar *fileName)
   gnome_app_create_menus_with_data(GNOME_APP(app), mainMenu, app);
 
   gtk_signal_connect(GTK_OBJECT(app), "delete_event",
-                    GTK_SIGNAL_FUNC(eventDelete), NULL);
+                    GTK_SIGNAL_FUNC(eventDelete), nullptr);
 
   GtkWidget *area = gtk_drawing_area_new();
   gtk_object_set_data(GTK_OBJECT(app), "area", area);
@@ -287,7 +287,7 @@ void closeSample(GtkWidget *app)
 {
   Context *context = (Context *) gtk_object_get_data(GTK_OBJECT(app), "context");
 
-  if (context->paragraph != NULL) {
+  if (context->paragraph != nullptr) {
     delete context->paragraph;
   }
 
@@ -297,7 +297,7 @@ void closeSample(GtkWidget *app)
 
   gtk_widget_destroy(app);
 
-  if (appList == NULL) {
+  if (appList == nullptr) {
     gtk_main_quit();
   }
 }
@@ -310,7 +310,7 @@ int main (int argc, char *argv[])
 
     FT_Init_FreeType(&engine);
 
-    gnome_init_with_popt_table("gnomelayout", "0.1", argc, argv, NULL, 0, &ptctx);
+    gnome_init_with_popt_table("gnomelayout", "0.1", argc, argv, nullptr, 0, &ptctx);
 
     guiSupport = new GnomeGUISupport();
     fontMap    = new GnomeFontMap(engine, "FontMap.Gnome", 24, guiSupport, fontStatus);
@@ -321,14 +321,14 @@ int main (int argc, char *argv[])
         return 1;
     }
 
-    const char  *defaultArgs[] = {"Sample.txt", NULL};
+    const char  *defaultArgs[] = {"Sample.txt", nullptr};
     const char **args = poptGetArgs(ptctx);
     
-    if (args == NULL) {
+    if (args == nullptr) {
         args = defaultArgs;
     }
 
-    for (int i = 0; args[i] != NULL; i += 1) {
+    for (int i = 0; args[i] != nullptr; i += 1) {
        app = newSample(args[i]);
            
        gtk_widget_show_all(app);
index da83630c2f57b3e8f9e4d792798d6a77f961ee2e..fd576937971a896167034a43e7dc21907dc630d5 100644 (file)
@@ -57,7 +57,7 @@ void InitParagraph(HWND hwnd, Context *context)
 {
     SCROLLINFO si;
 
-    if (context->paragraph != NULL) {
+    if (context->paragraph != nullptr) {
         // FIXME: does it matter what we put in the ScrollInfo
         // if the window's been minimized?
         if (context->width > 0 && context->height > 0) {
@@ -86,30 +86,30 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine,
     wndclass.cbClsExtra    = 0;
     wndclass.cbWndExtra    = sizeof(LONG);
     wndclass.hInstance     = hInstance;
-    wndclass.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
-    wndclass.hCursor       = LoadCursor(NULL, IDC_ARROW);
+    wndclass.hIcon         = LoadIcon(nullptr, IDI_APPLICATION);
+    wndclass.hCursor       = LoadCursor(nullptr, IDC_ARROW);
     wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
     wndclass.lpszMenuName  = szAppName;
     wndclass.lpszClassName = szAppName;
 
     if (!RegisterClass(&wndclass)) {
-        MessageBox(NULL, TEXT("This demo only runs on Windows 2000!"), szAppName, MB_ICONERROR);
+        MessageBox(nullptr, TEXT("This demo only runs on Windows 2000!"), szAppName, MB_ICONERROR);
 
         return 0;
     }
 
     hAccel = LoadAccelerators(hInstance, szAppName);
 
-    hwnd = CreateWindow(szAppName, NULL,
+    hwnd = CreateWindow(szAppName, nullptr,
                         WS_OVERLAPPEDWINDOW | WS_VSCROLL,
                         CW_USEDEFAULT, CW_USEDEFAULT,
                         600, 400,
-                        NULL, NULL, hInstance, NULL);
+                        nullptr, nullptr, hInstance, nullptr);
 
     ShowWindow(hwnd, iCmdShow);
     UpdateWindow(hwnd);
 
-    while (GetMessage(&msg, NULL, 0, 0)) {
+    while (GetMessage(&msg, nullptr, 0, 0)) {
         if (!TranslateAccelerator(hwnd, hAccel, &msg)) {
             TranslateMessage(&msg);
             DispatchMessage(&msg);
@@ -125,10 +125,10 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
     HDC hdc;
     Context *context;
     static le_int32 windowCount = 0;
-    static GDIFontMap *fontMap = NULL;
-    static GDISurface *surface = NULL;
+    static GDIFontMap *fontMap = nullptr;
+    static GDISurface *surface = nullptr;
     static GDIGUISupport *guiSupport = new GDIGUISupport();
-    static ScriptCompositeFontInstance *font = NULL;
+    static ScriptCompositeFontInstance *font = nullptr;
 
     switch (message) {
     case WM_CREATE:
@@ -222,8 +222,8 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
         context = (Context *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
 
-        if (context->paragraph != NULL && si.nPos != vertPos) {
-            ScrollWindow(hwnd, 0, context->paragraph->getLineHeight() * (vertPos - si.nPos), NULL, NULL);
+        if (context->paragraph != nullptr && si.nPos != vertPos) {
+            ScrollWindow(hwnd, 0, context->paragraph->getLineHeight() * (vertPos - si.nPos), nullptr, nullptr);
             UpdateWindow(hwnd);
         }
 
@@ -247,7 +247,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
         context = (Context *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
 
-        if (context->paragraph != NULL) {
+        if (context->paragraph != nullptr) {
             surface->setHDC(hdc);
 
             // NOTE: si.nPos + si.nPage may include a partial line at the bottom
@@ -273,24 +273,24 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
             ofn.lStructSize       = sizeof (OPENFILENAMEA);
             ofn.hwndOwner         = hwnd;
-            ofn.hInstance         = NULL;
+            ofn.hInstance         = nullptr;
             ofn.lpstrFilter       = szFilter;
-            ofn.lpstrCustomFilter = NULL;
+            ofn.lpstrCustomFilter = nullptr;
             ofn.nMaxCustFilter    = 0;
             ofn.nFilterIndex      = 0;
             ofn.lpstrFile         = szFileName;
             ofn.nMaxFile          = MAX_PATH;
             ofn.lpstrFileTitle    = szTitleName;
             ofn.nMaxFileTitle     = MAX_PATH;
-            ofn.lpstrInitialDir   = NULL;
-            ofn.lpstrTitle        = NULL;
+            ofn.lpstrInitialDir   = nullptr;
+            ofn.lpstrTitle        = nullptr;
             ofn.Flags             = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
             ofn.nFileOffset       = 0;
             ofn.nFileExtension    = 0;
             ofn.lpstrDefExt       = "txt";
             ofn.lCustData         = 0L;
-            ofn.lpfnHook          = NULL;
-            ofn.lpTemplateName    = NULL;
+            ofn.lpfnHook          = nullptr;
+            ofn.lpTemplateName    = nullptr;
 
             szFileName[0] = '\0';
 
@@ -300,17 +300,17 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 
                 Paragraph *newParagraph = Paragraph::paragraphFactory(szFileName, font, guiSupport);
 
-                if (newParagraph != NULL) {
+                if (newParagraph != nullptr) {
                     context = (Context *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
 
-                    if (context->paragraph != NULL) {
+                    if (context->paragraph != nullptr) {
                         delete context->paragraph;
                     }
 
                     context->paragraph = newParagraph;
                     InitParagraph(hwnd, context);
                     PrettyTitle(hwnd, szTitleName);
-                    InvalidateRect(hwnd, NULL, true);
+                    InvalidateRect(hwnd, nullptr, true);
 
                 }
             }
@@ -340,7 +340,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
     {
         context = (Context *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
 
-        if (context != NULL && context->paragraph != NULL) {
+        if (context != nullptr && context->paragraph != nullptr) {
             delete context->paragraph;
         }
 
index 0559d246d2d505fe66582cd5692db0f740ab153d..4364a4a66250bbf70030f2a55bcb436790f55fc0 100644 (file)
@@ -80,8 +80,8 @@ static void subsetFontRuns(const FontRuns *fontRuns, le_int32 start, le_int32 li
 }
 
 Paragraph::Paragraph(const LEUnicode chars[], int32_t charCount, const FontRuns *fontRuns, LEErrorCode &status)
-  : fParagraphLayout(NULL), fParagraphCount(0), fParagraphMax(PARA_GROW), fParagraphGrow(PARA_GROW),
-    fLineCount(0), fLinesMax(LINE_GROW), fLinesGrow(LINE_GROW), fLines(NULL), fChars(NULL),
+  : fParagraphLayout(nullptr), fParagraphCount(0), fParagraphMax(PARA_GROW), fParagraphGrow(PARA_GROW),
+    fLineCount(0), fLinesMax(LINE_GROW), fLinesGrow(LINE_GROW), fLines(nullptr), fChars(nullptr),
     fLineHeight(-1), fAscent(-1), fWidth(-1), fHeight(-1), fParagraphLevel(UBIDI_DEFAULT_LTR)
 {
     static const LEUnicode separators[] = {CH_LF, CH_CR, CH_LSEP, CH_PSEP, 0x0000};
@@ -94,7 +94,7 @@ Paragraph::Paragraph(const LEUnicode chars[], int32_t charCount, const FontRuns
     le_int32 descent = 0;
     le_int32 leading = 0;
 
-       LocaleRuns *locales = NULL;
+       LocaleRuns *locales = nullptr;
     FontRuns fr(0);
 
     fLines = LE_NEW_ARRAY(const ParagraphLayout::Line *, fLinesMax);
@@ -109,16 +109,16 @@ Paragraph::Paragraph(const LEUnicode chars[], int32_t charCount, const FontRuns
     while (*pStart != 0) {
         LEUnicode *pEnd = u_strpbrk(pStart, separators);
         le_int32 pAscent, pDescent, pLeading;
-        ParagraphLayout *paragraphLayout = NULL;
+        ParagraphLayout *paragraphLayout = nullptr;
 
-        if (pEnd == NULL) {
+        if (pEnd == nullptr) {
             pEnd = &fChars[charCount];
         }
 
         if (pEnd != pStart) {
             subsetFontRuns(fontRuns, pStart - fChars, pEnd - fChars, &fr);
 
-            paragraphLayout = new ParagraphLayout(pStart, pEnd - pStart, &fr, NULL, NULL, locales, fParagraphLevel, false, status);
+            paragraphLayout = new ParagraphLayout(pStart, pEnd - pStart, &fr, nullptr, nullptr, locales, fParagraphLevel, false, status);
 
             if (LE_FAILURE(status)) {
                 delete paragraphLayout;
@@ -213,13 +213,13 @@ void Paragraph::breakLines(le_int32 width, le_int32 height)
     for (le_int32 p = 0; p < fParagraphCount; p += 1) {
         ParagraphLayout *paragraphLayout = fParagraphLayout[p];
 
-        if (paragraphLayout != NULL) {
+        if (paragraphLayout != nullptr) {
             paragraphLayout->reflow();
-            while ((line = paragraphLayout->nextLine(lineWidth)) != NULL) {
+            while ((line = paragraphLayout->nextLine(lineWidth)) != nullptr) {
                 addLine(line);
             }
         } else {
-            addLine(NULL);
+            addLine(nullptr);
         }
     }
 }
@@ -234,7 +234,7 @@ void Paragraph::draw(RenderingSurface *surface, le_int32 firstLine, le_int32 las
     for (li = firstLine; li <= lastLine; li += 1) {
         const ParagraphLayout::Line *line = fLines[li];
 
-        if (line != NULL) {
+        if (line != nullptr) {
             le_int32 runCount = line->countRuns();
             le_int32 run;
 
@@ -265,10 +265,10 @@ Paragraph *Paragraph::paragraphFactory(const char *fileName, const LEFontInstanc
     LEErrorCode status  = LE_NO_ERROR;
     le_int32 charCount;
     const UChar *text = UnicodeReader::readFile(fileName, guiSupport, charCount);
-    Paragraph *result = NULL;
+    Paragraph *result = nullptr;
 
-    if (text == NULL) {
-        return NULL;
+    if (text == nullptr) {
+        return nullptr;
     }
 
     FontRuns  fontRuns(0);
@@ -279,7 +279,7 @@ Paragraph *Paragraph::paragraphFactory(const char *fileName, const LEFontInstanc
 
        if (LE_FAILURE(status)) {
                delete result;
-               result = NULL;
+               result = nullptr;
        }
 
     LE_DELETE_ARRAY(text);
index 679a18390dcf8d9c4ca52a582721a64eee6fc827..21858dfb983b1f13a893d07a36eeee01d27c09b4 100644 (file)
@@ -54,7 +54,7 @@ void printArray(const char* const comment, const UChar UArray[][5], int32_t arra
 
 void printKeys(const char *comment, uint8_t keys[][32], int32_t keySize) {
   int32_t i = 0;
-  uint8_t *currentKey = NULL;
+  uint8_t *currentKey = nullptr;
   fprintf(stdout, "%s\n", comment);
   for(i = 0; i<keySize; i++) {
     currentKey = keys[i];
index 221348fd1cc6ac3903eb700c3824f7c73470a6f7..4eded7cbdf6d29beff7a26b84688746c7025edf4 100644 (file)
@@ -43,10 +43,10 @@ int32_t getSortKey_current(const char *locale, const UChar *string, int32_t sLen
 
 // This one can be used for passing to qsort function
 // Not thread safe or anything
-static UCollator *compareCollator = NULL;
+static UCollator *compareCollator = nullptr;
 
 int compare_current(const void *string1, const void *string2) {
-  if(compareCollator != NULL) {
+  if(compareCollator != nullptr) {
     UCollationResult res = ucol_strcoll(compareCollator, (UChar *) string1, -1, (UChar *) string2, -1);
     if(res == UCOL_LESS) {
       return -1;
@@ -67,7 +67,7 @@ void initCollator_current(const char *locale) {
 
 void closeCollator_current(void) {
   ucol_close(compareCollator);
-  compareCollator = NULL;
+  compareCollator = nullptr;
 }
 
 
index cd3f731510e614743517a14d27d1c1231acb8686..ba3e3b1e32279f028b255e5e3aac8be3c051f6cb 100644 (file)
@@ -44,10 +44,10 @@ int32_t getSortKey_legacy(const char *locale, const UChar *string, int32_t sLen,
 
 // This one can be used for passing to qsort function
 // Not thread safe or anything
-static UCollator *compareCollator = NULL;
+static UCollator *compareCollator = nullptr;
 
 int compare_legacy(const void *string1, const void *string2) {
-  if(compareCollator != NULL) {
+  if(compareCollator != nullptr) {
     UCollationResult res = ucol_strcoll(compareCollator, (UChar *) string1, -1, (UChar *) string2, -1);
     if(res == UCOL_LESS) {
       return -1;
@@ -75,15 +75,15 @@ void initCollator_legacy(const char *locale) {
 }
 
 void closeCollator_legacy(void) {
-  if(compareCollator != NULL)
+  if(compareCollator != nullptr)
   {
     ucol_close(compareCollator);
   }
   else
   {
-    fprintf(stderr, "closeCollator_legacy(): collator was already NULL!\n");
+    fprintf(stderr, "closeCollator_legacy(): collator was already nullptr!\n");
   }
-  compareCollator = NULL;
+  compareCollator = nullptr;
 }
 
 
index 2534a9c0388bd04142a9f8901d52667f647981ac..059a011460e13a6c1f652576f42520f892eb5097 100644 (file)
@@ -107,7 +107,7 @@ setNumberFormatCurrency_2_4(NumberFormat &nf, const char *currency, UErrorCode &
     if(U_FAILURE(errorCode)) {
         return;
     }
-    if(currency==NULL || strlen(currency)!=3) {
+    if(currency==nullptr || strlen(currency)!=3) {
         errorCode=U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
@@ -116,7 +116,7 @@ setNumberFormatCurrency_2_4(NumberFormat &nf, const char *currency, UErrorCode &
     // necessary because we will cast to the DecimalFormat subclass to set
     // the currency symbol
     DecimalFormat *dnf=dynamic_cast<DecimalFormat *>(&nf);
-    if(dnf==NULL) {
+    if(dnf==nullptr) {
         errorCode=U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
@@ -195,7 +195,7 @@ setNumberFormatCurrency_2_6(NumberFormat &nf, const char *currency, UErrorCode &
     if(U_FAILURE(errorCode)) {
         return;
     }
-    if(currency==NULL || strlen(currency)!=3) {
+    if(currency==nullptr || strlen(currency)!=3) {
         errorCode=U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
index c275fef66f9836f83faa7edc4b8617bbf086ce4f..483b5bff983be6554e15d27abf94550d4d1a9e52 100644 (file)
@@ -158,7 +158,7 @@ UBool processCollator()
     if (opt_rules != 0) {
                u_unescape(opt_rules, rules, 100);
         collator = ucol_openRules(rules, -1, UCOL_OFF, UCOL_TERTIARY, 
-                                         NULL, &status);
+                                         nullptr, &status);
     }
     else {
         collator = ucol_open(opt_locale, &status);
@@ -236,7 +236,7 @@ UBool processStringSearch()
        u_unescape(opt_source, source, 100);
        u_unescape(opt_pattern, pattern, 100);
        UErrorCode status = U_ZERO_ERROR;
-       search = usearch_openFromCollator(pattern, -1, source, -1, collator, NULL
+       search = usearch_openFromCollator(pattern, -1, source, -1, collator, nullptr
                                              &status);
        if (U_FAILURE(status)) {
                return false;
index 7347d054aec4a8ec9a6a9a232f28c480aa9da4f5..543b9482da2807f4d48b96abf7b9a29b530debc1 100644 (file)
@@ -325,7 +325,7 @@ UErrorCode convsample_05()
   printf("input bytes %d / min chars %d = %d UChars\n",
          BUFFERSIZE, ucnv_getMinCharSize(conv), uBufSize);
   uBuf = (UChar*)malloc(uBufSize * sizeof(UChar));
-  assert(uBuf!=NULL);
+  assert(uBuf!=nullptr);
 
   // grab another buffer's worth
   while((!feof(f)) && 
@@ -341,7 +341,7 @@ UErrorCode convsample_05()
         targetLimit = uBuf + uBufSize;
         
         ucnv_toUnicode(conv, &target, targetLimit, 
-                       &source, sourceLimit, NULL,
+                       &source, sourceLimit, nullptr,
                        feof(f)?true:false,         /* pass 'flush' when eof */
                                    /* is true (when no more data will come) */
                        &status);
@@ -575,7 +575,7 @@ UErrorCode convsample_13()
   const char *source, *sourceLimit;
   UChar32 target;
   UErrorCode status = U_ZERO_ERROR;
-  UConverter *conv = NULL;
+  UConverter *conv = nullptr;
   int32_t srcCount=0;
   int32_t dstCount=0;
   
@@ -622,12 +622,12 @@ UBool convsample_20_didSubstitute(const char *source)
 {
   UChar uchars[100];
   char bytes[100];
-  UConverter *conv = NULL;
+  UConverter *conv = nullptr;
   UErrorCode status = U_ZERO_ERROR;
   uint32_t len, len2;
   UBool  flagVal;
   
-  FromUFLAGContext * context = NULL;
+  FromUFLAGContext * context = nullptr;
 
   printf("\n\n==============================================\n"
          "Sample 20: C: Test for substitution using callbacks\n");
@@ -716,18 +716,18 @@ UBool convsample_21_didSubstitute(const char *source)
 {
   UChar uchars[100];
   char bytes[100];
-  UConverter *conv = NULL, *cloneCnv = NULL;
+  UConverter *conv = nullptr, *cloneCnv = nullptr;
   UErrorCode status = U_ZERO_ERROR;
   uint32_t len, len2;
   UBool  flagVal = false;
   UConverterFromUCallback junkCB;
   
-  FromUFLAGContext *flagCtx = NULL
-                   *cloneFlagCtx = NULL;
+  FromUFLAGContext *flagCtx = nullptr
+                   *cloneFlagCtx = nullptr;
 
-  debugCBContext   *debugCtx1 = NULL,
-                   *debugCtx2 = NULL,
-                   *cloneDebugCtx = NULL;
+  debugCBContext   *debugCtx1 = nullptr,
+                   *debugCtx2 = nullptr,
+                   *cloneDebugCtx = nullptr;
 
   printf("\n\n==============================================\n"
          "Sample 21: C: Test for substitution w/ callbacks & clones \n");
@@ -775,7 +775,7 @@ UBool convsample_21_didSubstitute(const char *source)
   flagCtx->subContext    =  debugCtx2;
 
   debugCtx2->subCallback =  UCNV_FROM_U_CALLBACK_SUBSTITUTE;
-  debugCtx2->subContext  = NULL;
+  debugCtx2->subContext  = nullptr;
 
   /* Set our special callback */
 
@@ -794,7 +794,7 @@ UBool convsample_21_didSubstitute(const char *source)
          debugCtx1->subContext, flagCtx, debugCtx2, debugCtx2->subCallback);
 #endif
 
-  cloneCnv = ucnv_safeClone(conv, NULL, NULL, &status);
+  cloneCnv = ucnv_safeClone(conv, nullptr, nullptr, &status);
 
   U_ASSERT(status);
 
@@ -810,21 +810,21 @@ UBool convsample_21_didSubstitute(const char *source)
 
   U_ASSERT(status);
   /* Now, we have to extract the context */
-  cloneDebugCtx = NULL;
-  cloneFlagCtx  = NULL;
+  cloneDebugCtx = nullptr;
+  cloneFlagCtx  = nullptr;
 
   ucnv_getFromUCallBack(cloneCnv, &junkCB, (const void **)&cloneDebugCtx);
-  if(cloneDebugCtx != NULL) {
+  if(cloneDebugCtx != nullptr) {
       cloneFlagCtx = (FromUFLAGContext*) cloneDebugCtx -> subContext;
   }
 
   printf("Cloned converter chain: %p -> %p[debug1] -> %p[flag] -> %p[debug2] -> substitute\n",
-         cloneCnv, cloneDebugCtx, cloneFlagCtx, cloneFlagCtx?cloneFlagCtx->subContext:NULL );
+         cloneCnv, cloneDebugCtx, cloneFlagCtx, cloneFlagCtx?cloneFlagCtx->subContext:nullptr );
 
   len2 = ucnv_fromUChars(cloneCnv, bytes, 100, uchars, len, &status);
   U_ASSERT(status);
 
-  if(cloneFlagCtx != NULL) {
+  if(cloneFlagCtx != nullptr) {
       flagVal = cloneFlagCtx->flag;  /* it's about to go away when we close the cnv */
   } else {
       printf("** Warning, couldn't get the subcallback \n");
@@ -884,7 +884,7 @@ UErrorCode convsample_40()
   UChar *target;
   UChar *targetLimit;
   int32_t uBufSize = 0;
-  UConverter *conv = NULL;
+  UConverter *conv = nullptr;
   UErrorCode status = U_ZERO_ERROR;
   uint32_t inbytes=0, total=0;
 
@@ -911,7 +911,7 @@ UErrorCode convsample_40()
   printf("input bytes %d / min chars %d = %d UChars\n",
          BUFFERSIZE, ucnv_getMinCharSize(conv), uBufSize);
   uBuf = (UChar*)malloc(uBufSize * sizeof(UChar));
-  assert(uBuf!=NULL);
+  assert(uBuf!=nullptr);
 
   // grab another buffer's worth
   while((!feof(f)) && 
@@ -929,7 +929,7 @@ UErrorCode convsample_40()
         targetLimit = uBuf + uBufSize;
         
         ucnv_toUnicode( conv, &target, targetLimit, 
-                       &source, sourceLimit, NULL,
+                       &source, sourceLimit, nullptr,
                        feof(f)?true:false,         /* pass 'flush' when eof */
                                    /* is true (when no more data will come) */
                          &status);
@@ -989,7 +989,7 @@ UErrorCode convsample_46()
   char *targetLimit;
 
   int32_t bufSize = 0;
-  UConverter *conv = NULL;
+  UConverter *conv = nullptr;
   UErrorCode status = U_ZERO_ERROR;
   uint32_t inchars=0, total=0;
 
@@ -1016,7 +1016,7 @@ UErrorCode convsample_46()
   printf("input UChars[16] %d * max charsize %d = %d bytes output buffer\n",
          BUFFERSIZE, ucnv_getMaxCharSize(conv), bufSize);
   buf = (char*)malloc(bufSize * sizeof(char));
-  assert(buf!=NULL);
+  assert(buf!=nullptr);
 
   // grab another buffer's worth
   while((!feof(f)) && 
@@ -1034,7 +1034,7 @@ UErrorCode convsample_46()
         targetLimit = buf + bufSize;
         
         ucnv_fromUnicode( conv, &target, targetLimit, 
-                       &source, sourceLimit, NULL,
+                       &source, sourceLimit, nullptr,
                        feof(f)?true:false,         /* pass 'flush' when eof */
                                    /* is true (when no more data will come) */
                          &status);
@@ -1083,18 +1083,18 @@ void convsample_50() {
   char input[] = { '\xEF','\xBB', '\xBF','\x41','\x42','\x43' };
   int32_t signatureLength = 0;
   const char *encoding = ucnv_detectUnicodeSignature(input,sizeof(input),&signatureLength,&err);
-  UConverter *conv = NULL;
+  UConverter *conv = nullptr;
   UChar output[100];
   UChar *target = output, *out;
   const char *source = input;
-  if(encoding!=NULL && U_SUCCESS(err)){
+  if(encoding!=nullptr && U_SUCCESS(err)){
     // should signature be discarded ?
     conv = ucnv_open(encoding, &err);
     // do the conversion
     ucnv_toUnicode(conv,
                    &target, output + UPRV_LENGTHOF(output),
                    &source, input + sizeof(input),
-                   NULL, true, &err);
+                   nullptr, true, &err);
     out = output;
     if (discardSignature){
       ++out; // ignore initial U+FEFF
index 6d7fce04924a2dc4735765c1a62fe369d1a29bc2..b19534395b5e4a0b488b613d9bbc16ccd98017a8 100644 (file)
@@ -40,7 +40,7 @@ using namespace icu;
 //
 //  The following variables contain parameters that may be set from the command line.
 //
-const char *pattern = NULL;     // The regular expression
+const char *pattern = nullptr;     // The regular expression
 int        firstFileNum;        //  argv index of the first file name
 UBool      displayFileName = false;
 UBool      displayLineNum  = false;
@@ -313,7 +313,7 @@ void readFile(const char *name) {
             u_errorName(status));
         return;
     }
-    if(encoding!=NULL ){
+    if(encoding!=nullptr ){
         charDataStart  += signatureLength;
         rawFileLen     -= signatureLength;
     }
@@ -333,7 +333,7 @@ void readFile(const char *name) {
     //  Preflight first to determine required buffer size.
     //
     uint32_t destCap = ucnv_toUChars(conv,
-                       NULL,           //  dest,
+                       nullptr,           //  dest,
                        0,              //  destCapacity,
                        charDataStart,
                        rawFileLen,
@@ -426,7 +426,7 @@ void printMatch() {
 
     // If we haven't already created a converter for output, do it now.
     if (outConverter == 0) {
-        outConverter = ucnv_open(NULL, &status);
+        outConverter = ucnv_open(nullptr, &status);
         if (U_FAILURE(status)) {
             fprintf(stderr, "ugrep:  Error opening default converter: \"%s\"\n",
                 u_errorName(status));
index 35a8ec1bec6a5d21a8c1aac81a39f4688ce6f4f0..e4dd124ce5794cc6a3adc7af11227cc5b8732419 100644 (file)
@@ -43,7 +43,7 @@ using namespace icu;
 // helper functions -------------------------------------------------------- ***
 
 // default converter for the platform encoding
-static UConverter *cnv=NULL;
+static UConverter *cnv=nullptr;
 
 static void
 printUString(const char *announce, const UChar *s, int32_t length) {
@@ -289,7 +289,7 @@ static void demoCaseMapInC() {
      * has bit flag options instead, by design of the Unicode SpecialCasing.txt UCD file.
      *
      * Also, string titlecasing requires a BreakIterator to find starts of words.
-     * The sample code here passes in a NULL pointer; u_strToTitle() will open and close a default
+     * The sample code here passes in a nullptr pointer; u_strToTitle() will open and close a default
      * titlecasing BreakIterator automatically.
      * For production code where many strings are titlecased it would be more efficient
      * to open a BreakIterator externally and pass it in.
@@ -330,7 +330,7 @@ static void demoCaseMapInC() {
     }
     /* titlecase/English */
     errorCode=U_ZERO_ERROR;
-    length=u_strToTitle(buffer, UPRV_LENGTHOF(buffer), input, -1, NULL, "en", &errorCode);
+    length=u_strToTitle(buffer, UPRV_LENGTHOF(buffer), input, -1, nullptr, "en", &errorCode);
     if(U_SUCCESS(errorCode)) {
         printUString("full-titlecased/en: ", buffer, length);
     } else {
@@ -338,7 +338,7 @@ static void demoCaseMapInC() {
     }
     /* titlecase/Turkish */
     errorCode=U_ZERO_ERROR;
-    length=u_strToTitle(buffer, UPRV_LENGTHOF(buffer), input, -1, NULL, "tr", &errorCode);
+    length=u_strToTitle(buffer, UPRV_LENGTHOF(buffer), input, -1, nullptr, "tr", &errorCode);
     if(U_SUCCESS(errorCode)) {
         printUString("full-titlecased/tr: ", buffer, length);
     } else {
@@ -402,9 +402,9 @@ static void demoCaseMapInCPlusPlus() {
     /* uppercase/Turkish */
     printUnicodeString("full-uppercased/tr: ", (t=s).toUpper(tr));
     /* titlecase/English */
-    printUnicodeString("full-titlecased/en: ", (t=s).toTitle(NULL, en));
+    printUnicodeString("full-titlecased/en: ", (t=s).toTitle(nullptr, en));
     /* titlecase/Turkish */
-    printUnicodeString("full-titlecased/tr: ", (t=s).toTitle(NULL, tr));
+    printUnicodeString("full-titlecased/tr: ", (t=s).toTitle(nullptr, tr));
     /* case-folde/default */
     printUnicodeString("full-case-folded/default: ", (t=s).foldCase(U_FOLD_CASE_DEFAULT));
     /* case-folde/Turkic */
@@ -597,13 +597,13 @@ main(int argc, const char *argv[]) {
     // This will currently affect only the printUString() function, see the code above.
     // printUnicodeString() could use this, too, by changing to an extract() overload
     // that takes a UConverter argument.
-    cnv=ucnv_open(NULL, &errorCode);
+    cnv=ucnv_open(nullptr, &errorCode);
     if(U_FAILURE(errorCode)) {
         fprintf(stderr, "error %s opening the default converter\n", u_errorName(errorCode));
         return errorCode;
     }
 
-    ucnv_setFromUCallBack(cnv, UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_C, NULL, NULL, &errorCode);
+    ucnv_setFromUCallBack(cnv, UCNV_FROM_U_CALLBACK_ESCAPE, UCNV_ESCAPE_C, nullptr, nullptr, &errorCode);
     if(U_FAILURE(errorCode)) {
         fprintf(stderr, "error %s setting the escape callback in the default converter\n", u_errorName(errorCode));
         ucnv_close(cnv);
index 34ec09aff1fa6f1bb31458fd963fcbbd8646f2ed..6a055ebbbe776c9b63c66d006d10a709c1dc9499 100644 (file)
@@ -177,10 +177,10 @@ void LocaleAliasTest::TestULocale() {
 }
 LocaleAliasTest::LocaleAliasTest(){
     UErrorCode status = U_ZERO_ERROR;
-    resIndex = ures_open(NULL,"res_index", &status);
+    resIndex = ures_open(nullptr,"res_index", &status);
     if(U_FAILURE(status)){
         errln("Could not open res_index.res. Exiting. Error: %s\n", u_errorName(status));
-        resIndex=NULL;
+        resIndex=nullptr;
     }
     defLocale = Locale::getDefault();
     Locale::setDefault(Locale::getUS(), status); 
@@ -195,7 +195,7 @@ LocaleAliasTest::~LocaleAliasTest(){
     }
 }
 UBool LocaleAliasTest::isLocaleAvailable(const char* loc){
-    if(resIndex==NULL){
+    if(resIndex==nullptr){
         return false;
     }
     UErrorCode status = U_ZERO_ERROR;
@@ -250,13 +250,13 @@ void LocaleAliasTest::TestUResourceBundle() {
         }
         logln("\nold locale:%s   new locale:%s",oldLoc.getName(),newLoc.getName());
 
-        ResourceBundle* rb1 = NULL;
-        ResourceBundle* rb2 = NULL;
+        ResourceBundle* rb1 = nullptr;
+        ResourceBundle* rb2 = nullptr;
 
         const char* testdatapath=loadTestData(status);
 
-        UnicodeString us1("NULL");
-        UnicodeString us2("NULL");
+        UnicodeString us1("nullptr");
+        UnicodeString us2("nullptr");
         rb1 = new ResourceBundle(testdatapath, oldLoc, status);
         if (U_FAILURE(U_ZERO_ERROR)) {
 
@@ -278,10 +278,10 @@ void LocaleAliasTest::TestUResourceBundle() {
         log("   new:");
         logln(us2);
 
-        if (rb1!=NULL) {
+        if (rb1!=nullptr) {
             delete rb1;
         }
-        if (rb2!=NULL) {
+        if (rb2!=nullptr) {
             delete rb2;
         }
     }
index 62eedd212fae1c760e92e850c9a6b755f1d421a4..100c5bbce45d3c079cce636e0b412f96cb86a20a 100644 (file)
@@ -20,7 +20,7 @@ public:
     void TestULocale();
     void TestUResourceBundle();
     void TestDisplayName(); 
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
     LocaleAliasTest();
     virtual ~LocaleAliasTest();
 private:
index 85041d11eab3e2978a400142b0af098538e0db78..c070a60c3fcb2279a21fbc6d84dfea5f4dc2b5eb 100644 (file)
@@ -32,7 +32,7 @@ CollationDummyTest::CollationDummyTest()
 
     UErrorCode status = U_ZERO_ERROR;
     UnicodeString ruleset("& C < ch, cH, Ch, CH & Five, 5 & Four, 4 & one, 1 & Ampersand; '&' & Two, 2 ");
-    if (myCollation != NULL)
+    if (myCollation != nullptr)
     {
       delete myCollation;
     }
index a5ae4b920b301bb2df5c60442b16a71cbc3cfa29..ce200178992eed92c77e3e9cc5b6dbd41a0fffcc 100644 (file)
@@ -30,7 +30,7 @@ public:
 
     CollationDummyTest();
     virtual ~CollationDummyTest();
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par = NULL */) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par = nullptr */) override;
 
     // perform test with strength PRIMARY
     void TestPrimary(/* char* par */);
index a5886f18b25f14e4b6ada185632ba11981fb9e85..db14de4bec4e09c931a4406ea25d440126d82431 100644 (file)
@@ -34,7 +34,7 @@ namespace {
 UnicodeString joinLabelsAndAppend(AlphabeticIndex::ImmutableIndex &index, UnicodeString &dest) {
     int32_t oldLength = dest.length();
     const AlphabeticIndex::Bucket *bucket;
-    for (int32_t i = 0; (bucket = index.getBucket(i)) != NULL; ++i) {
+    for (int32_t i = 0; (bucket = index.getBucket(i)) != nullptr; ++i) {
         if (dest.length() > oldLength) {
             dest.append((UChar)0x3A);  // ':'
         }
@@ -233,10 +233,10 @@ void AlphabeticIndexTest::APITest() {
         TEST_CHECK_STATUS;
     }
 
-    index->addRecord(adam, NULL, status);
-    index->addRecord(baker, NULL, status);
-    index->addRecord(charlie, NULL, status);
-    index->addRecord(chad, NULL, status);
+    index->addRecord(adam, nullptr, status);
+    index->addRecord(baker, nullptr, status);
+    index->addRecord(charlie, nullptr, status);
+    index->addRecord(chad, nullptr, status);
     TEST_CHECK_STATUS;
     int itemCount = 0;
     index->resetBucketIterator(status);
@@ -386,7 +386,7 @@ void AlphabeticIndexTest::ManyLocalesTest() {
             // std::string ss;
             // std::cout << ":" << label.toUTF8String(ss);
             const AlphabeticIndex::Bucket *bucket = immIndex->getBucket(bucketIndex);
-            TEST_ASSERT(bucket != NULL);
+            TEST_ASSERT(bucket != nullptr);
             assertEquals("bucket label vs. immutable: locale=" + UnicodeString(localeName) +
                          " index=" + bucketIndex,
                          label, bucket->getLabel());
@@ -398,8 +398,8 @@ void AlphabeticIndexTest::ManyLocalesTest() {
         // std::cout << ":" << std::endl;
 
         TEST_ASSERT(immIndex->getBucketCount() == bucketIndex);
-        TEST_ASSERT(immIndex->getBucket(-1) == NULL);
-        TEST_ASSERT(immIndex->getBucket(bucketIndex) == NULL);
+        TEST_ASSERT(immIndex->getBucket(-1) == nullptr);
+        TEST_ASSERT(immIndex->getBucket(bucketIndex) == nullptr);
     }
 }
 
@@ -432,7 +432,7 @@ static const char *pinyinTestData[] = {
         "x", "\\u5915", "\\u5438", "\\u6bbe", //
         "y", "\\u4e2b", "\\u82bd", "\\u8574", //
         "z", "\\u5e00", "\\u707d", "\\u5c0a",
-        NULL
+        nullptr
     };
 
 void AlphabeticIndexTest::HackPinyinTest() {
@@ -442,7 +442,7 @@ void AlphabeticIndexTest::HackPinyinTest() {
 
     UnicodeString names[UPRV_LENGTHOF(pinyinTestData)];
     int32_t  nameCount;
-    for (nameCount=0; pinyinTestData[nameCount] != NULL; nameCount++) {
+    for (nameCount=0; pinyinTestData[nameCount] != nullptr; nameCount++) {
         names[nameCount] = UnicodeString(pinyinTestData[nameCount], -1, UnicodeString::kInvariant).unescape();
         aindex.addRecord(names[nameCount], &names[nameCount], status);
         TEST_CHECK_STATUS; 
@@ -663,9 +663,9 @@ void AlphabeticIndexTest::TestNoLabels() {
     TEST_CHECK_STATUS;
     AlphabeticIndex index(coll.orphan(), status);
     TEST_CHECK_STATUS;
-    index.addRecord(UnicodeString((UChar)0x897f), NULL, status);
-    index.addRecord("i", NULL, status);
-    index.addRecord(UnicodeString((UChar)0x03B1), NULL, status);
+    index.addRecord(UnicodeString((UChar)0x897f), nullptr, status);
+    index.addRecord("i", nullptr, status);
+    index.addRecord(UnicodeString((UChar)0x03B1), nullptr, status);
     assertEquals("getBucketCount()", 1, index.getBucketCount(status));  // ...
     TEST_ASSERT(index.nextBucket(status));
     assertEquals("underflow label type", (int32_t)U_ALPHAINDEX_UNDERFLOW, index.getBucketLabelType());
@@ -675,7 +675,7 @@ void AlphabeticIndexTest::TestNoLabels() {
 void AlphabeticIndexTest::TestChineseZhuyin() {
     UErrorCode status = U_ZERO_ERROR;
     char loc[100];
-    uloc_forLanguageTag("zh-u-co-zhuyin", loc, UPRV_LENGTHOF(loc), NULL, &status);
+    uloc_forLanguageTag("zh-u-co-zhuyin", loc, UPRV_LENGTHOF(loc), nullptr, &status);
     AlphabeticIndex index(loc, status);
     LocalPointer<AlphabeticIndex::ImmutableIndex> immIndex(index.buildImmutableIndex(status));
     TEST_CHECK_STATUS; 
index 66c7087b2ad330c52fddb08ba50326d42efd1f19..3bd230fdd549ff9d49c79495babfaab9ca7ee7d7 100644 (file)
@@ -21,7 +21,7 @@ public:
     AlphabeticIndexTest();
     virtual ~AlphabeticIndexTest();
 
-    virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     virtual void APITest();
     virtual void ManyLocalesTest();
index 6d8f5429e0a67d7c4765745881136d7a1c5b14bd..b97580327c0b0098880581670eaea9eede8369b9 100644 (file)
@@ -240,7 +240,7 @@ void CollationAPITest::TestKeywordValues() {
     assertTrue("expect at least one collation tailoring for English", kwEnum->count(errorCode) > 0);
     const char *kw;
     UBool hasStandard = false;
-    while ((kw = kwEnum->next(NULL, errorCode)) != NULL) {
+    while ((kw = kwEnum->next(nullptr, errorCode)) != nullptr) {
         if (strcmp(kw, "standard") == 0) {
             hasStandard = true;
         }
@@ -522,7 +522,7 @@ CollationAPITest::TestCollationKey(/* char* par */)
     doAssert(!sortkNone.isBogus() && length == 0,
              "Default-constructed collation key should be empty");
     CollationKey sortkEmpty;
-    col->getCollationKey(NULL, 0, sortkEmpty, key1Status);
+    col->getCollationKey(nullptr, 0, sortkEmpty, key1Status);
     // key gets reset here
     const uint8_t* byteArrayEmpty = sortkEmpty.getByteArray(length);
     doAssert(sortkEmpty.isBogus() == false && length == 3 &&
@@ -545,7 +545,7 @@ CollationAPITest::TestCollationKey(/* char* par */)
 
     // bogus key returned here
     key1Status = U_ILLEGAL_ARGUMENT_ERROR;
-    col->getCollationKey(NULL, 0, sortk1, key1Status);
+    col->getCollationKey(nullptr, 0, sortk1, key1Status);
     doAssert(sortk1.isBogus() && (sortk1.getByteArray(length), length) == 0,
         "Error code should return bogus collation key");
 
@@ -792,7 +792,7 @@ CollationAPITest::TestElemIter(/* char* par */)
 
     //test error values
     success=U_UNSUPPORTED_ERROR;
-    Collator *colerror=NULL;
+    Collator *colerror=nullptr;
     colerror=Collator::createInstance(Locale::getEnglish(), success);
     if (colerror != 0 || success == U_ZERO_ERROR){
         errln("Error: createInstance(UErrorCode != U_ZERO_ERROR) should just return and not create an instance\n");
@@ -1030,7 +1030,7 @@ CollationAPITest::TestGetAll(/* char* par */)
             + UnicodeString(list[i].getDisplayName(dispName)));
     }
 
-    if (count1 == 0 || list == NULL) {
+    if (count1 == 0 || list == nullptr) {
         dataerrln("getAvailableLocales(int&) returned an empty list");
     }
 
@@ -1040,12 +1040,12 @@ CollationAPITest::TestGetAll(/* char* par */)
     const char *locCStr;
     count2 = 0;
 
-    if (localeEnum == NULL) {
-        dataerrln("getAvailableLocales() returned NULL");
+    if (localeEnum == nullptr) {
+        dataerrln("getAvailableLocales() returned nullptr");
         return;
     }
 
-    while ((locStr = localeEnum->snext(status)) != NULL)
+    while ((locStr = localeEnum->snext(status)) != nullptr)
     {
         logln(UnicodeString("Locale name is: ") + *locStr);
         count2++;
@@ -1058,7 +1058,7 @@ CollationAPITest::TestGetAll(/* char* par */)
     count1 = 0;
     StringEnumeration* localeEnum2 = localeEnum->clone();
     localeEnum2->reset(status);
-    while ((locCStr = localeEnum2->next(NULL, status)) != NULL)
+    while ((locCStr = localeEnum2->next(nullptr, status)) != nullptr)
     {
         logln(UnicodeString("Locale name is: ") + UnicodeString(locCStr));
         count1++;
@@ -1748,7 +1748,7 @@ void CollationAPITest::TestGetLocale() {
 
 
 
-  /* collator instantiated from rules should have all three locales NULL */
+  /* collator instantiated from rules should have all three locales nullptr */
   coll = new RuleBasedCollator(rlz, status);
   locale = coll->getLocale(ULOC_REQUESTED_LOCALE, status);
   if(U_SUCCESS(status) && !locale.isBogus()) {
@@ -1932,7 +1932,7 @@ void CollationAPITest::TestGetTailoredSet()
   UErrorCode status = U_ZERO_ERROR;
 
   UnicodeString buff; 
-  UnicodeSet *set = NULL;
+  UnicodeSet *set = nullptr;
 
   for(i = 0; i < UPRV_LENGTHOF(setTest); i++) {
     buff = UnicodeString(setTest[i].rules, -1, US_INV).unescape();
@@ -2110,7 +2110,7 @@ CollationKey& TestCollator::getCollationKey(const UnicodeString& source,
 {
     char temp[100];
     int length = 100;
-    length = source.extract(temp, length, NULL, status);
+    length = source.extract(temp, length, nullptr, status);
     temp[length] = 0;
     CollationKey tempkey((uint8_t*)temp, length);
     key = tempkey;
@@ -2131,7 +2131,7 @@ int32_t TestCollator::getSortKey(const UnicodeString& source, uint8_t* result,
                                  int32_t resultLength) const
 {
     UErrorCode status = U_ZERO_ERROR;
-    int32_t length = source.extract((char *)result, resultLength, NULL
+    int32_t length = source.extract((char *)result, resultLength, nullptr
                                     status);
     result[length] = 0;
     return length;
@@ -2155,7 +2155,7 @@ Locale TestCollator::getLocale(ULocDataLocaleType type, UErrorCode& status) cons
     if (U_FAILURE(status)) {
         (void)type;
     }
-    return NULL;
+    return nullptr;
 }
 
 Collator::ECollationStrength TestCollator::getStrength() const
@@ -2263,7 +2263,7 @@ void CollationAPITest::TestSubclass()
     col1.getCollationKey(abc, key, status);
     int32_t length = 0;
     const char* bytes = (const char *)key.getByteArray(length);
-    UnicodeString keyarray(bytes, length, NULL, status);
+    UnicodeString keyarray(bytes, length, nullptr, status);
     if (abc != keyarray) {
         errln("TestCollator collationkey API is returning wrong values");
     }
@@ -2299,7 +2299,7 @@ void CollationAPITest::TestSubclass()
     }
 }
 
-void CollationAPITest::TestNULLCharTailoring()
+void CollationAPITest::TestNullptrCharTailoring()
 {
     UErrorCode status = U_ZERO_ERROR;
     UChar buf[256] = {0};
@@ -2314,7 +2314,7 @@ void CollationAPITest::TestNULLCharTailoring()
     }
     UCollationResult res = coll->compare(first, second, status);
     if(res != UCOL_LESS) {
-        errln("a should be less then NULL after tailoring");
+        errln("a should be less then nullptr after tailoring");
     }
     delete coll;
 }
@@ -2376,7 +2376,7 @@ void CollationAPITest::TestCloneBinary() {
     }
     RuleBasedCollator *rbRoot = dynamic_cast<RuleBasedCollator *>(root.getAlias());
     RuleBasedCollator *rbc = dynamic_cast<RuleBasedCollator *>(coll.getAlias());
-    if(rbRoot == NULL || rbc == NULL) {
+    if(rbRoot == nullptr || rbc == nullptr) {
         infoln("root or de@collation=phonebook is not a RuleBasedCollator");
         return;
     }
@@ -2554,7 +2554,7 @@ void CollationAPITest::runIndexedTest( int32_t index, UBool exec, const char* &n
     TESTCASE_AUTO(TestGetTailoredSet);
     TESTCASE_AUTO(TestUClassID);
     TESTCASE_AUTO(TestSubclass);
-    TESTCASE_AUTO(TestNULLCharTailoring);
+    TESTCASE_AUTO(TestNullptrCharTailoring);
     TESTCASE_AUTO(TestClone);
     TESTCASE_AUTO(TestCloneBinary);
     TESTCASE_AUTO(TestIterNumeric);
index c97c49056f266bcc9391f4440999e92d12d8463d..36796c830924881f6162343912a231460a4a5afc 100644 (file)
@@ -23,7 +23,7 @@
 
 class CollationAPITest: public IntlTestCollator {
 public:
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par = NULL */) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par = nullptr */) override;
     void doAssert(UBool condition, const char *message);
 
     /**
@@ -165,9 +165,9 @@ public:
     void TestUClassID();
 
     /**
-    * Test NULL
+    * Test nullptr
     */
-    void TestNULLCharTailoring();
+    void TestNullptrCharTailoring();
 
     void TestClone();
     void TestCloneBinary();
index 88406d082b0e8227ac6ab6c99b557989e0ddcd91..5a52c136aafe484dead9a5e911661cbc2d9cfc5a 100644 (file)
@@ -23,7 +23,7 @@
 
 #define CASE(id,test) case id: name = #test; if (exec) { logln(#test "---"); logln((UnicodeString)""); test(); } break
 
-AstroTest::AstroTest(): astro(NULL), gc(NULL) {
+AstroTest::AstroTest(): astro(nullptr), gc(nullptr) {
 }
 
 void AstroTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
@@ -55,7 +55,7 @@ void AstroTest::runIndexedTest( int32_t index, UBool exec, const char* &name, ch
 void AstroTest::initAstro(UErrorCode &status) {
   if(U_FAILURE(status)) return;
 
-  if((astro != NULL) || (gc != NULL)) {
+  if((astro != nullptr) || (gc != nullptr)) {
     dataerrln("Err: initAstro() called twice!");
     closeAstro(status);
     if(U_SUCCESS(status)) {
@@ -70,13 +70,13 @@ void AstroTest::initAstro(UErrorCode &status) {
 }
 
 void AstroTest::closeAstro(UErrorCode &/*status*/) {
-  if(astro != NULL) {
+  if(astro != nullptr) {
     delete astro;
-    astro = NULL;
+    astro = nullptr;
   }
-  if(gc != NULL) {
+  if(gc != nullptr) {
     delete gc;
-    gc = NULL;
+    gc = nullptr;
   }
 }
 
index aee85d7f8886aecd8d30208542f7ec210e28aaed..0d616f7381517b1c3e93a435e1529d5b2f29b79f 100644 (file)
@@ -36,7 +36,7 @@ public:
         directionBits(0), lineNumber(0), levelsCount(0), orderingCount(0),
         errorCount(0) {}
 
-    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=nullptr) override;
 
     void TestBidiTest();
     void TestBidiCharacterTest();
@@ -273,8 +273,8 @@ void BiDiConformanceTest::TestBidiTest() {
         return;
     }
     LocalUBiDiPointer ubidi(ubidi_open());
-    ubidi_setClassCallback(ubidi.getAlias(), biDiConfUBiDiClassCallback, NULL,
-                           NULL, NULL, errorCode);
+    ubidi_setClassCallback(ubidi.getAlias(), biDiConfUBiDiClassCallback, nullptr,
+                           nullptr, nullptr, errorCode);
     if(errorCode.errIfFailureAndReset("ubidi_setClassCallback()")) {
         return;
     }
@@ -284,11 +284,11 @@ void BiDiConformanceTest::TestBidiTest() {
     errorCount=0;
     // paraLevelName must be initialized in case the first non-comment line is in error
     paraLevelName="N/A";
-    while(errorCount<10 && fgets(line, (int)sizeof(line), bidiTestFile.getAlias())!=NULL) {
+    while(errorCount<10 && fgets(line, (int)sizeof(line), bidiTestFile.getAlias())!=nullptr) {
         ++lineNumber;
         // Remove trailing comments and whitespace.
         char *commentStart=strchr(line, '#');
-        if(commentStart!=NULL) {
+        if(commentStart!=nullptr) {
             *commentStart=0;
         }
         u_rtrim(line);
@@ -331,7 +331,7 @@ void BiDiConformanceTest::TestBidiTest() {
             for(int i=0; i<=3; ++i) {
                 if(bitset&(1<<i)) {
                     ubidi_setPara(ubidi.getAlias(), inputString.getBuffer(), inputString.length(),
-                                  paraLevels[i], NULL, errorCode);
+                                  paraLevels[i], nullptr, errorCode);
                     const UBiDiLevel *actualLevels=ubidi_getLevels(ubidi.getAlias(), errorCode);
                     if(errorCode.errIfFailureAndReset("ubidi_setPara() or ubidi_getLevels()")) {
                         errln("Input line %d: %s", (int)lineNumber, line);
@@ -446,13 +446,13 @@ void BiDiConformanceTest::TestBidiCharacterTest() {
     levelsCount=0;
     orderingCount=0;
     errorCount=0;
-    while(errorCount<20 && fgets(line, (int)sizeof(line), bidiTestFile.getAlias())!=NULL) {
+    while(errorCount<20 && fgets(line, (int)sizeof(line), bidiTestFile.getAlias())!=nullptr) {
         ++lineNumber;
         paraLevelName="N/A";
         inputString="N/A";
         // Remove trailing comments and whitespace.
         char *commentStart=strchr(line, '#');
-        if(commentStart!=NULL) {
+        if(commentStart!=nullptr) {
             *commentStart=0;
         }
         u_rtrim(line);
@@ -462,7 +462,7 @@ void BiDiConformanceTest::TestBidiCharacterTest() {
         }
         // Parse the code point string in field 0.
         UChar *buffer=inputString.getBuffer(200);
-        int32_t length=u_parseString(start, buffer, inputString.getCapacity(), NULL, errorCode);
+        int32_t length=u_parseString(start, buffer, inputString.getCapacity(), nullptr, errorCode);
         if(errorCode.errIfFailureAndReset("Invalid string in field 0")) {
             errln("Input line %d: %s", (int)lineNumber, line);
             inputString.remove();
@@ -470,7 +470,7 @@ void BiDiConformanceTest::TestBidiCharacterTest() {
         }
         inputString.releaseBuffer(length);
         start=strchr(start, ';');
-        if(start==NULL) {
+        if(start==nullptr) {
             errorCount++;
             errln("\nError on line %d: Missing ; separator on line: %s", (int)lineNumber, line);
             continue;
@@ -540,7 +540,7 @@ void BiDiConformanceTest::TestBidiCharacterTest() {
             orderingCount=-1;
 
         ubidi_setPara(ubidi.getAlias(), inputString.getBuffer(), inputString.length(),
-                      paraLevel, NULL, errorCode);
+                      paraLevel, nullptr, errorCode);
         const UBiDiLevel *actualLevels=ubidi_getLevels(ubidi.getAlias(), errorCode);
         if(errorCode.errIfFailureAndReset("ubidi_setPara() or ubidi_getLevels()")) {
             errln("Input line %d: %s", (int)lineNumber, line);
index 44f916a34e891d487bde253b8e2ad795be9b090c..f60af6160f08c7869c5876ee62dd7c6d7f035e05 100644 (file)
@@ -34,7 +34,7 @@ public:
     BytesTrieTest();
     virtual ~BytesTrieTest();
 
-    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=nullptr) override;
     void TestBuilder();
     void TestEmpty();
     void Test_a();
@@ -78,7 +78,7 @@ extern IntlTest *createBytesTrieTest() {
     return new BytesTrieTest();
 }
 
-BytesTrieTest::BytesTrieTest() : builder_(NULL) {
+BytesTrieTest::BytesTrieTest() : builder_(nullptr) {
     IcuTestErrorCode errorCode(*this, "BytesTrieTest()");
     builder_=new BytesTrieBuilder(errorCode);
 }
@@ -594,7 +594,7 @@ void BytesTrieTest::TestIteratorFromBytes() {
 
 void BytesTrieTest::TestFailedIterator() {
     UErrorCode failure = U_ILLEGAL_ARGUMENT_ERROR;
-    BytesTrie::Iterator iter(NULL, 0, failure);
+    BytesTrie::Iterator iter(nullptr, 0, failure);
     StringPiece sp = iter.getString();
     if (!sp.empty()) {
         errln("failed iterator returned garbage data");
@@ -696,7 +696,7 @@ BytesTrie *BytesTrieTest::buildTrie(const StringAndValue data[], int32_t dataLen
         errln("builder.buildStringPiece() before & after build() returned same array");
     }
     if(errorCode.isFailure()) {
-        return NULL;
+        return nullptr;
     }
     // Tries from either build() method should be identical but
     // BytesTrie does not implement equals().
index 7bb9521cd939f35fb3f2f376f9882511269c7328..0b9ce900d14aee295fbed9ffbce03d439d0acbe5 100644 (file)
@@ -176,7 +176,7 @@ void CalendarCaseTest::IslamicCivil()
      };
     UnicodeString result;
     DateFormat *fmt = DateFormat::createDateInstance(DateFormat::kFull, Locale("ar_JO@calendar=islamic-civil"));
-    if (fmt == NULL) {
+    if (fmt == nullptr) {
         dataerrln("Error calling DateFormat::createDateInstance");
         delete c;
         return;
index 3c1f1da3be8a5cb329599fa660f0d57309e1a5b8..bd2ff9c1728f27622fda224b3595ae5d9615f71b 100644 (file)
@@ -301,7 +301,7 @@ CalendarLimitTest::doTheoreticalLimitsTest(Calendar& cal, UBool leapMonth) {
 void
 CalendarLimitTest::doLimitsTest(Calendar& cal, UDate startDate, int32_t endTime) {
     int32_t testTime = quick ? ( endTime / 40 ) : endTime;
-    doLimitsTest(cal, NULL /*default fields*/, startDate, testTime);
+    doLimitsTest(cal, nullptr /*default fields*/, startDate, testTime);
 }
 
 void
@@ -347,7 +347,7 @@ CalendarLimitTest::doLimitsTest(Calendar& cal,
     }
     logln((UnicodeString)"Start: " + startDate);
 
-    if (fieldsToTest == NULL) {
+    if (fieldsToTest == nullptr) {
         fieldsToTest = FIELDS;
     }
 
index 6acf7a4b95f8fcf2f17974ef86e40f6f90de6a2d..d73cc1f6b8eae4d4a04e7e1ae56722a714a2610f 100644 (file)
@@ -2407,7 +2407,7 @@ void CalendarRegressionTest::TestT5555()
     UErrorCode ec = U_ZERO_ERROR;
     Calendar *cal = Calendar::createInstance(ec);
 
-    if (cal == NULL || U_FAILURE(ec)) {
+    if (cal == nullptr || U_FAILURE(ec)) {
         dataerrln("FAIL: Calendar::createInstance(): %s", u_errorName(ec));
         delete cal;
         return;
@@ -2474,13 +2474,13 @@ typedef struct {
 static const CoptEthCalLocale copEthCalLocales[] = {
     { "en@calendar=coptic",   0    },
     { "en@calendar=ethiopic", 276  },
-    { NULL,                   0    } // terminator
+    { nullptr,                0    } // terminator
 };
 
 void CalendarRegressionTest::TestT6745()
 {
     const CoptEthCalLocale * testLocalePtr;
-    for ( testLocalePtr = copEthCalLocales; testLocalePtr->locale != NULL; ++testLocalePtr) {
+    for ( testLocalePtr = copEthCalLocales; testLocalePtr->locale != nullptr; ++testLocalePtr) {
         UErrorCode status = U_ZERO_ERROR;
         Calendar *cal = Calendar::createInstance(Locale(testLocalePtr->locale), status);
         if ( U_FAILURE(status) ) {
@@ -2519,7 +2519,7 @@ void CalendarRegressionTest::TestT6745()
 void CalendarRegressionTest::TestLeapFieldDifference() {
     UErrorCode ec = U_ZERO_ERROR;
     Calendar* cal = Calendar::createInstance(ec);
-    if (cal == NULL || U_FAILURE(ec)) {
+    if (cal == nullptr || U_FAILURE(ec)) {
         dataerrln("FAIL: Calendar::createInstance(): %s", u_errorName(ec));
         delete cal;
         return;
@@ -2699,21 +2699,21 @@ void CalendarRegressionTest::TestTimeZoneTransitionAdd() {
     UnicodeString buf1, buf2;
 
     const UChar* id;
-    while ((id = tz->unext(NULL, ec)) != NULL && U_SUCCESS(ec)) {
+    while ((id = tz->unext(nullptr, ec)) != nullptr && U_SUCCESS(ec)) {
         if (U_FAILURE(ec)) {
             errln("FAIL: StringEnumeration::unext");
             break;
         }
 
         TimeZone *t = TimeZone::createTimeZone(id);
-        if (t == NULL) {
+        if (t == nullptr) {
             errln("FAIL: TimeZone::createTimeZone");
             break;
         }
         dateFormat.setTimeZone(*t);
 
         Calendar *cal = Calendar::createInstance(t, locale, ec);
-        if (cal == NULL || U_FAILURE(ec)) {
+        if (cal == nullptr || U_FAILURE(ec)) {
             errln("FAIL: Calendar::createTimeZone");
             delete cal;
             break;
index d718ca536f3ca392559ac2ad0713818456c2b4c4..754aebd6dff9e55a260e58a1394475a6746ecf45 100644 (file)
@@ -450,7 +450,7 @@ CalendarTest::TestGenericAPI()
         ((Calendar *)cal)->roll(UCAL_HOUR, (int32_t)100, status);
         ((Calendar *)cal)->clear(UCAL_HOUR);
 #if !UCONFIG_NO_SERVICE
-        URegistryKey key = cal->registerFactory(NULL, status);
+        URegistryKey key = cal->registerFactory(nullptr, status);
         cal->unregister(key, status);
 #endif
     }
@@ -472,7 +472,7 @@ CalendarTest::TestGenericAPI()
         UBool containsHebrew = false;
         const char *charValue;
         int32_t valueLength;
-        while ((charValue = values->next(&valueLength, status)) != NULL) {
+        while ((charValue = values->next(&valueLength, status)) != nullptr) {
             if (valueLength == 6 && uprv_strcmp(charValue, "hebrew") == 0) {
                 containsHebrew = true;
             }
@@ -485,7 +485,7 @@ CalendarTest::TestGenericAPI()
         containsHebrew = false;
         UnicodeString hebrew = UNICODE_STRING_SIMPLE("hebrew");
         const UChar *ucharValue;
-        while ((ucharValue = values->unext(&valueLength, status)) != NULL) {
+        while ((ucharValue = values->unext(&valueLength, status)) != nullptr) {
             UnicodeString value(false, ucharValue, valueLength);
             if (value == hebrew) {
                 containsHebrew = true;
@@ -498,7 +498,7 @@ CalendarTest::TestGenericAPI()
         values->reset(status);
         containsHebrew = false;
         const UnicodeString *stringValue;
-        while ((stringValue = values->snext(status)) != NULL) {
+        while ((stringValue = values->snext(status)) != nullptr) {
             if (*stringValue == hebrew) {
                 containsHebrew = true;
             }
@@ -1970,11 +1970,11 @@ void CalendarTest::TestDebug()
                 logln("Testing count+1:");
             }
                   const char *name = udbg_enumName((UDebugEnumType)t,i);
-                  if(name==NULL) {
+                  if(name==nullptr) {
                           if(i==count || t>UDBG_HIGHEST_CONTIGUOUS_ENUM  ) {
                                 logln(" null name - expected.\n");
                           } else {
-                                errln("FAIL: udbg_enumName(%d,%d) returned NULL", t, i);
+                                errln("FAIL: udbg_enumName(%d,%d) returned nullptr", t, i);
                           }
                           name = "(null)";
                   }
@@ -2012,7 +2012,7 @@ const char *CalendarTest::testLocaleID(int32_t i)
   case 12: return "hu_HU@calendar=buddhist";
   case 13: return "hu_HU@calendar=islamic";
   case 14: return "en_US@calendar=japanese";
-  default: return NULL;
+  default: return nullptr;
   }
 }
 
@@ -2021,7 +2021,7 @@ int32_t CalendarTest::testLocaleCount()
   static int32_t gLocaleCount = -1;
   if(gLocaleCount < 0) {
     int32_t i;
-    for(i=0;testLocaleID(i) != NULL;i++) {
+    for(i=0;testLocaleID(i) != nullptr;i++) {
       // do nothing
     }
     gLocaleCount = i;
@@ -2035,7 +2035,7 @@ static UDate doMinDateOfCalendar(Calendar* adopt, UBool &isGregorian, UErrorCode
   adopt->clear();
   adopt->set(UCAL_EXTENDED_YEAR, adopt->getActualMinimum(UCAL_EXTENDED_YEAR, status));
   UDate ret = adopt->getTime(status);
-  isGregorian = dynamic_cast<GregorianCalendar*>(adopt) != NULL;
+  isGregorian = dynamic_cast<GregorianCalendar*>(adopt) != nullptr;
   delete adopt;
   return ret;
 }
@@ -2083,7 +2083,7 @@ void CalendarTest::Test3785()
     UnicodeString exp2 = UNICODE_STRING_SIMPLE("Mon 1 Rajab 1433 AH, 01:47:04");
 
     LocalUDateFormatPointer df(udat_open(UDAT_NONE, UDAT_NONE, "en@calendar=islamic", uzone.getTerminatedBuffer(),
-                                         uzone.length(), NULL, 0, &status));
+                                         uzone.length(), nullptr, 0, &status));
     if (df.isNull() || U_FAILURE(status)) return;
 
     UChar upattern[64];
@@ -2094,7 +2094,7 @@ void CalendarTest::Test3785()
     UDate ud0 = 1337557623000.0;
 
     status = U_ZERO_ERROR;
-    udat_format(df.getAlias(), ud0, ubuffer, 1024, NULL, &status);
+    udat_format(df.getAlias(), ud0, ubuffer, 1024, nullptr, &status);
     if (U_FAILURE(status)) {
         errln("Error formatting date 1\n");
         return;
@@ -2108,7 +2108,7 @@ void CalendarTest::Test3785()
     ud0 += 1000.0; // add one second
 
     status = U_ZERO_ERROR;
-    udat_format(df.getAlias(), ud0, ubuffer, 1024, NULL, &status);
+    udat_format(df.getAlias(), ud0, ubuffer, 1024, nullptr, &status);
     if (U_FAILURE(status)) {
         errln("Error formatting date 2\n");
         return;
@@ -2200,7 +2200,7 @@ void CalendarTest::TestISO8601() {
         "en_US@calendar=Iso8601",
         "th_TH@calendar=iso8601",
         "ar_EG@calendar=iso8601",
-        NULL
+        nullptr
     };
 
     int32_t TEST_DATA[][3] = {
@@ -2214,7 +2214,7 @@ void CalendarTest::TestISO8601() {
         {0, 0, 0},
     };
 
-    for (int i = 0; TEST_LOCALES[i] != NULL; i++) {
+    for (int i = 0; TEST_LOCALES[i] != nullptr; i++) {
         UErrorCode status = U_ZERO_ERROR;
         Calendar *cal = Calendar::createInstance(TEST_LOCALES[i], status);
         if (U_FAILURE(status)) {
@@ -2402,7 +2402,7 @@ static const RepeatedWallTimeTestData RPDATA[] =
     {"Australia/Lord_Howe", CalFields(2011,4,3,2,0,0),      CalFields(2011,4,2,15,30,0),    CalFields(2011,4,2,15,30,0)},
     {"Australia/Lord_Howe", CalFields(2011,4,3,2,0,1),      CalFields(2011,4,2,15,30,1),    CalFields(2011,4,2,15,30,1)},
 
-    {NULL,                  CalFields(0,0,0,0,0,0),         CalFields(0,0,0,0,0,0),          CalFields(0,0,0,0,0,0)}
+    {nullptr,                  CalFields(0,0,0,0,0,0),         CalFields(0,0,0,0,0,0),          CalFields(0,0,0,0,0,0)}
 };
 
 void CalendarTest::TestRepeatedWallTime(void) {
@@ -2420,7 +2420,7 @@ void CalendarTest::TestRepeatedWallTime(void) {
     calLast.setRepeatedWallTimeOption(UCAL_WALLTIME_LAST);
     calFirst.setRepeatedWallTimeOption(UCAL_WALLTIME_FIRST);
 
-    for (int32_t i = 0; RPDATA[i].tzid != NULL; i++) {
+    for (int32_t i = 0; RPDATA[i].tzid != nullptr; i++) {
         char buf[32];
         TimeZone *tz = TimeZone::createTimeZone(RPDATA[i].tzid);
 
@@ -2500,7 +2500,7 @@ static SkippedWallTimeTestData SKDATA[] =
     {"Pacific/Apia",        CalFields(2011,12,30,23,59,59), false,  CalFields(2011,12,31,9,59,59),  CalFields(2011,12,30,9,59,59),  CalFields(2011,12,30,10,0,0)},
     {"Pacific/Apia",        CalFields(2011,12,31,0,0,0),    true,   CalFields(2011,12,30,10,0,0),   CalFields(2011,12,30,10,0,0),   CalFields(2011,12,30,10,0,0)},
 
-    {NULL,                  CalFields(0,0,0,0,0,0),         true,   CalFields(0,0,0,0,0,0),         CalFields(0,0,0,0,0,0),         CalFields(0,0,0,0,0,0)}
+    {nullptr,                  CalFields(0,0,0,0,0,0),         true,   CalFields(0,0,0,0,0,0),         CalFields(0,0,0,0,0,0),         CalFields(0,0,0,0,0,0)}
 };
 
 
@@ -2521,7 +2521,7 @@ void CalendarTest::TestSkippedWallTime(void) {
     calFirst.setSkippedWallTimeOption(UCAL_WALLTIME_FIRST);
     calNextAvail.setSkippedWallTimeOption(UCAL_WALLTIME_NEXT_VALID);
 
-    for (int32_t i = 0; SKDATA[i].tzid != NULL; i++) {
+    for (int32_t i = 0; SKDATA[i].tzid != nullptr; i++) {
         UDate d;
         char buf[32];
         TimeZone *tz = TimeZone::createTimeZone(SKDATA[i].tzid);
@@ -3783,7 +3783,7 @@ static const TestAddAcrossZoneTransitionData AAZTDATA[] =
     {"Australia/Lord_Howe",     CalFields(2013,10,5,2,15,0,0),      1,      UCAL_WALLTIME_NEXT_VALID,
                                 CalFields(2013,10,6,2,30,0,0)},
 
-    {NULL, CalFields(0,0,0,0,0,0,0), 0, UCAL_WALLTIME_LAST, CalFields(0,0,0,0,0,0,0)}
+    {nullptr, CalFields(0,0,0,0,0,0,0), 0, UCAL_WALLTIME_LAST, CalFields(0,0,0,0,0,0,0)}
 };
 
 void CalendarTest::TestAddAcrossZoneTransition() {
index 20f63774ec7ba35be7930f4aa7f323030de93b7a..fc10d180b0a4d4f2622c5bcfb0a371ab84d85c05 100644 (file)
@@ -53,17 +53,17 @@ static UnicodeString str(const char *input)
 
 
 CanonicalIteratorTest::CanonicalIteratorTest() :
-nameTrans(NULL), hexTrans(NULL)
+nameTrans(nullptr), hexTrans(nullptr)
 {
 }
 
 CanonicalIteratorTest::~CanonicalIteratorTest()
 {
 #if !UCONFIG_NO_TRANSLITERATION
-  if(nameTrans != NULL) {
+  if(nameTrans != nullptr) {
     delete(nameTrans);
   }
-  if(hexTrans != NULL) {
+  if(hexTrans != nullptr) {
     delete(hexTrans);
   }
 #endif
@@ -224,14 +224,14 @@ UnicodeString CanonicalIteratorTest::getReadable(const UnicodeString &s) {
     // set up for readable display
 #if !UCONFIG_NO_TRANSLITERATION
     if(verbose) {
-      if (nameTrans == NULL)
+      if (nameTrans == nullptr)
           nameTrans = Transliterator::createInstance("[^\\ -\\u007F] name", UTRANS_FORWARD, status);
       UnicodeString sName = s;
       nameTrans->transliterate(sName);
       result += sName;
       result += ";";
     }
-    if (hexTrans == NULL)
+    if (hexTrans == nullptr)
         hexTrans = Transliterator::createInstance("[^\\ -\\u007F] hex", UTRANS_FORWARD, status);
 #endif
     UnicodeString sHex = s;
@@ -263,12 +263,12 @@ UnicodeString CanonicalIteratorTest::collectionToString(Hashtable *col) {
     UnicodeString **resArray = new UnicodeString*[col->count()];
     int32_t i = 0;
 
-    const UHashElement *ne = NULL;
+    const UHashElement *ne = nullptr;
     int32_t el = UHASH_FIRST;
     //Iterator it = basic.iterator();
     ne = col->nextElement(el);
     //while (it.hasNext()) 
-    while (ne != NULL) {
+    while (ne != nullptr) {
       //String item = (String) it.next();
       UnicodeString *item = (UnicodeString *)(ne->value.pointer);
       resArray[i++] = item;
index a8b893e5b6b920988efc0ed676e56645408b5584..078e273ae66db2a117f9e8284a533b23b0465064 100644 (file)
@@ -38,7 +38,7 @@ public:
     CanonicalIteratorTest();
     virtual ~CanonicalIteratorTest();
 
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     void TestCanonicalIterator(void);
     void TestExhaustive(void);
index 0ae4fce71b75f4d69213aff8ac11381834ecbdb4..addf1fa1a7e0b6533a4fdc0ce7ec65ec237100b1 100644 (file)
@@ -58,7 +58,7 @@ public:
     }
 
     virtual SCharacterIterator* clone(void) const override {
-        return NULL;
+        return nullptr;
     }
     virtual int32_t hashCode(void) const override {
         return DONE;
@@ -947,13 +947,13 @@ void CharIterTest::TestUCharIterator() {
 
     /* Testing function coverage on bad input */
     UErrorCode status = U_ZERO_ERROR;
-    uiter_setString(&sIter, NULL, 1);
+    uiter_setString(&sIter, nullptr, 1);
     uiter_setState(&sIter, 1, &status);
     if (status != U_UNSUPPORTED_ERROR) {
         errln("error: uiter_setState returned %s instead of U_UNSUPPORTED_ERROR", u_errorName(status));
     }
     status = U_ZERO_ERROR;
-    uiter_setState(NULL, 1, &status);
+    uiter_setState(nullptr, 1, &status);
     if (status != U_ILLEGAL_ARGUMENT_ERROR) {
         errln("error: uiter_setState returned %s instead of U_ILLEGAL_ARGUMENT_ERROR", u_errorName(status));
     }
@@ -1093,7 +1093,7 @@ public:
     }
 
     virtual CharacterIterator *clone() const override {
-        return NULL;
+        return nullptr;
     }
 
     virtual UChar last() override {
index 9c4f3bf23d7536bcf36648bb51469bf568dc9a48..b0474c8fa17addc569e9961b2b2814573d6dded6 100644 (file)
@@ -19,7 +19,7 @@ class CharIterTest: public IntlTest {
 public:
     CharIterTest();
     
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     /**
      * Test Constructors and operators ==, != and a few other methods
index 671086e8ac42a79444c980128395ffc0df5e4e5d..38f8dd1173245bf6050781fd3a008e2cea6a8eae 100644 (file)
@@ -58,15 +58,15 @@ class CodePointIterator;
 class CollationTest : public IntlTest {
 public:
     CollationTest()
-            : fcd(NULL), nfd(NULL),
+            : fcd(nullptr), nfd(nullptr),
               fileLineNumber(0),
-              coll(NULL) {}
+              coll(nullptr) {}
 
     ~CollationTest() {
         delete coll;
     }
 
-    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=nullptr) override;
 
     void TestMinMax();
     void TestImplicits();
@@ -164,7 +164,7 @@ void CollationTest::TestMinMax() {
         return;
     }
     RuleBasedCollator *rbc = dynamic_cast<RuleBasedCollator *>(coll);
-    if(rbc == NULL) {
+    if(rbc == nullptr) {
         errln("the root collator is not a RuleBasedCollator");
         return;
     }
@@ -231,7 +231,7 @@ void CollationTest::TestImplicits() {
     const UnicodeSet *sets[] = { &coreHan, &otherHan, &unassigned };
     UChar32 prev = 0;
     uint32_t prevPrimary = 0;
-    UTF16CollationIterator ci(cd, false, NULL, NULL, NULL);
+    UTF16CollationIterator ci(cd, false, nullptr, nullptr, nullptr);
     for(int32_t i = 0; i < UPRV_LENGTHOF(sets); ++i) {
         LocalPointer<UnicodeSetIterator> iter(new UnicodeSetIterator(*sets[i]));
         while(iter->next()) {
@@ -273,7 +273,7 @@ void CollationTest::TestNulTerminated() {
     static const UChar s[] = { 0x61, 0x62, 0x61, 0x62, 0 };
 
     UTF16CollationIterator ci1(data, false, s, s, s + 2);
-    UTF16CollationIterator ci2(data, false, s + 2, s + 2, NULL);
+    UTF16CollationIterator ci2(data, false, s + 2, s + 2, nullptr);
     for(int32_t i = 0;; ++i) {
         int64_t ce1 = ci1.nextCE(errorCode);
         int64_t ce2 = ci2.nextCE(errorCode);
@@ -477,7 +477,7 @@ void CollationTest::TestFCD() {
         0x4e00, 0xf71, 0xf80
     };
 
-    FCDUTF16CollationIterator u16ci(data, false, s, s, NULL);
+    FCDUTF16CollationIterator u16ci(data, false, s, s, nullptr);
     if(errorCode.errIfFailureAndReset("FCDUTF16CollationIterator constructor")) {
         return;
     }
@@ -872,7 +872,7 @@ void CollationTest::TestTailoredElements() {
     }
     CollationRootElements rootElements(root->rootElements, root->rootElementsLength);
 
-    UHashtable *prevLocales = uhash_open(uhash_hashChars, uhash_compareChars, NULL, errorCode);
+    UHashtable *prevLocales = uhash_open(uhash_hashChars, uhash_compareChars, nullptr, errorCode);
     if(errorCode.errIfFailureAndReset("failed to create a hash table")) {
         return;
     }
@@ -892,7 +892,7 @@ void CollationTest::TestTailoredElements() {
                 Collator::getKeywordValuesForLocale("collation", locale, false, errorCode));
         errorCode.assertSuccess();
         const char *type;  // first: default type
-        while((type = types->next(NULL, errorCode)) != NULL) {
+        while((type = types->next(nullptr, errorCode)) != nullptr) {
             if(strncmp(type, "private-", 8) == 0) {
                 errln("Collator::getKeywordValuesForLocale(%s) returns private collation keyword: %s",
                         localeID, type);
@@ -914,7 +914,7 @@ void CollationTest::TestTailoredElements() {
             logln("TestTailoredElements(): requested %s -> actual %s",
                   localeWithType.getName(), actual.getName());
             RuleBasedCollator *rbc = dynamic_cast<RuleBasedCollator *>(coll.getAlias());
-            if(rbc == NULL) {
+            if(rbc == nullptr) {
                 continue;
             }
             // Note: It would be better to get tailored strings such that we can
@@ -943,7 +943,7 @@ void CollationTest::TestTailoredElements() {
                 }
             }
         }
-    } while((localeID = locales->next(NULL, errorCode)) != NULL);
+    } while((localeID = locales->next(nullptr, errorCode)) != nullptr);
     uhash_close(prevLocales);
 }
 
@@ -973,14 +973,14 @@ UBool CollationTest::readNonEmptyLine(UCHARBUF *f, IcuTestErrorCode &errorCode)
     for(;;) {
         int32_t lineLength;
         const UChar *line = ucbuf_readline(f, &lineLength, errorCode);
-        if(line == NULL || errorCode.isFailure()) {
+        if(line == nullptr || errorCode.isFailure()) {
             fileLine.remove();
             return false;
         }
         ++fileLineNumber;
         // Strip trailing CR/LF, comments, and spaces.
         const UChar *comment = u_memchr(line, 0x23, lineLength);  // '#'
-        if(comment != NULL) {
+        if(comment != nullptr) {
             lineLength = (int32_t)(comment - line);
         } else {
             while(lineLength > 0 && isCROrLF(line[lineLength - 1])) { --lineLength; }
@@ -1148,7 +1148,7 @@ void CollationTest::parseAndSetAttribute(IcuTestErrorCode &errorCode) {
             errorCode.set(U_PARSE_ERROR);
             return;
         }
-        if(coll != NULL) {
+        if(coll != nullptr) {
             coll->setMaxVariable(max, errorCode);
             if(errorCode.isFailure()) {
                 errln("setMaxVariable() failed on line %d: %s",
@@ -1189,7 +1189,7 @@ void CollationTest::parseAndSetAttribute(IcuTestErrorCode &errorCode) {
         }
     }
 
-    if(coll != NULL) {
+    if(coll != nullptr) {
         coll->setAttribute(attr, value, errorCode);
         if(errorCode.isFailure()) {
             errln("illegal attribute=value combination on line %d: %s",
@@ -1223,7 +1223,7 @@ void CollationTest::parseAndSetReorderCodes(int32_t start, IcuTestErrorCode &err
         reorderCodes.addElement(code, errorCode);
         start = limit;
     }
-    if(coll != NULL) {
+    if(coll != nullptr) {
         coll->setReorderCodes(reorderCodes.getBuffer(), reorderCodes.size(), errorCode);
         if(errorCode.isFailure()) {
             errln("setReorderCodes() failed on line %d: %s",
@@ -1247,7 +1247,7 @@ void CollationTest::buildTailoring(UCHARBUF *f, IcuTestErrorCode &errorCode) {
     UnicodeString reason;
     delete coll;
     coll = new RuleBasedCollator(rules, parseError, reason, errorCode);
-    if(coll == NULL) {
+    if(coll == nullptr) {
         errln("unable to allocate a new collator");
         errorCode.set(U_MEMORY_ALLOCATION_ERROR);
         return;
@@ -1261,7 +1261,7 @@ void CollationTest::buildTailoring(UCHARBUF *f, IcuTestErrorCode &errorCode) {
                 parseError.preContext + "(!)" + parseError.postContext + "...");
         }
         delete coll;
-        coll = NULL;
+        coll = nullptr;
         errorCode.reset();
     } else {
         assertEquals("no error reason when RuleBasedCollator(rules) succeeds",
@@ -1282,7 +1282,7 @@ void CollationTest::setRootCollator(IcuTestErrorCode &errorCode) {
 void CollationTest::setLocaleCollator(IcuTestErrorCode &errorCode) {
     if(errorCode.isFailure()) { return; }
     delete coll;
-    coll = NULL;
+    coll = nullptr;
     int32_t at = fileLine.indexOf((UChar)0x40, 9);  // @ is not invariant
     if(at >= 0) {
         fileLine.setCharAt(at, (UChar)0x2a);  // *
@@ -1307,7 +1307,7 @@ void CollationTest::setLocaleCollator(IcuTestErrorCode &errorCode) {
                   locale.getName(), (int)fileLineNumber);
         infoln(fileLine);
         delete coll;
-        coll = NULL;
+        coll = nullptr;
         errorCode.reset();
     }
 }
@@ -1475,7 +1475,7 @@ UBool CollationTest::getMergedCollationKey(const UChar *s, int32_t length,
             }
             dest = mergedKey.allocateInsteadAndReset(mergedKeyCapacity);
         }
-        U_ASSERT(dest != NULL || mergedKeyCapacity == 0);
+        U_ASSERT(dest != nullptr || mergedKeyCapacity == 0);
         if(key1Length == 0) {
             // key2 is the sort key for the first segment.
             uprv_memcpy(dest, key2Bytes, key2Length);
@@ -1770,7 +1770,7 @@ void CollationTest::checkCompareStrings(UCHARBUF *f, IcuTestErrorCode &errorCode
             errorCode.reset();
             break;
         }
-        if(coll == NULL) {
+        if(coll == nullptr) {
             // We were unable to create the Collator but continue with tests.
             // Ignore test data for this Collator.
             // The next Collator creation might work.
index 3841e7b3ed16c40e7023bf69079bc3601ebee56b..753d8c926b5991ce49370820ca86cfb77f1f7406 100644 (file)
@@ -40,7 +40,7 @@
 #define ARRAY_COPY(dst, src, count) uprv_memcpy((void *) (dst), (void *) (src), (size_t)(count) * sizeof (src)[0])
 
 CEList::CEList(UCollator *coll, const UnicodeString &string, UErrorCode &status)
-    : ces(NULL), listMax(CELIST_BUFFER_SIZE), listSize(0)
+    : ces(nullptr), listMax(CELIST_BUFFER_SIZE), listSize(0)
 {
     UCollationElements *elems = ucol_openElements(coll, string.getBuffer(), string.length(), &status);
     UCollationStrength strength = ucol_getStrength(coll);
@@ -114,7 +114,7 @@ void CEList::add(uint32_t ce, UErrorCode &status)
         int32_t newMax = listMax + CELIST_BUFFER_SIZE;
         uint32_t *newCEs = NEW_ARRAY(uint32_t, newMax);
 
-        if (newCEs == NULL) {
+        if (newCEs == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
@@ -148,7 +148,7 @@ uint32_t &CEList::operator[](int32_t index) const
 
 UBool CEList::matchesAt(int32_t offset, const CEList *other) const
 {
-    if (other == NULL || listSize - offset < other->size()) {
+    if (other == nullptr || listSize - offset < other->size()) {
         return false;
     }
 
@@ -167,7 +167,7 @@ int32_t CEList::size() const
 }
 
 StringList::StringList(UErrorCode &status)
-    : strings(NULL), listMax(STRING_LIST_BUFFER_SIZE), listSize(0)
+    : strings(nullptr), listMax(STRING_LIST_BUFFER_SIZE), listSize(0)
 {
     if (U_FAILURE(status)) {
         return;
@@ -175,7 +175,7 @@ StringList::StringList(UErrorCode &status)
 
     strings = new UnicodeString [listMax];
 
-    if (strings == NULL) {
+    if (strings == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -194,7 +194,7 @@ void StringList::add(const UnicodeString *string, UErrorCode &status)
     if (listSize >= listMax) {
         int32_t newMax = listMax + STRING_LIST_BUFFER_SIZE;
         UnicodeString *newStrings = new UnicodeString[newMax];
-        if (newStrings == NULL) {
+        if (newStrings == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
@@ -225,7 +225,7 @@ const UnicodeString *StringList::get(int32_t index) const
         return &strings[index];
     }
 
-    return NULL;
+    return nullptr;
 }
 
 int32_t StringList::size() const
@@ -259,7 +259,7 @@ private:
 };
 
 CEToStringsMap::CEToStringsMap(UErrorCode &status)
-    : map(NULL)
+    : map(nullptr)
 {
     if (U_FAILURE(status)) {
         return;
@@ -285,10 +285,10 @@ void CEToStringsMap::put(uint32_t ce, UnicodeString *string, UErrorCode &status)
 {
     StringList *strings = getStringList(ce);
 
-    if (strings == NULL) {
+    if (strings == nullptr) {
         strings = new StringList(status);
 
-        if (strings == NULL || U_FAILURE(status)) {
+        if (strings == nullptr || U_FAILURE(status)) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
@@ -312,7 +312,7 @@ void CEToStringsMap::putStringList(uint32_t ce, StringList *stringList, UErrorCo
 #define CLONE_COLLATOR
 
 CollData::CollData(UCollator *collator, UErrorCode &status)
-    : coll(NULL), ceToCharsStartingWith(NULL)
+    : coll(nullptr), ceToCharsStartingWith(nullptr)
 {
     // [:c:] == [[:cn:][:cc:][:co:][:cf:][:cs:]]
     // i.e. other, control, private use, format, surrogate
@@ -341,7 +341,7 @@ CollData::CollData(UCollator *collator, UErrorCode &status)
     }
 
 #ifdef CLONE_COLLATOR
-    coll = ucol_safeClone(collator, NULL, NULL, &status);
+    coll = ucol_safeClone(collator, nullptr, nullptr, &status);
 
     if (U_FAILURE(status)) {
         goto bail;
@@ -367,7 +367,7 @@ CollData::CollData(UCollator *collator, UErrorCode &status)
             for (UChar32 ch = start; ch <= end; ch += 1) {
                 UnicodeString *st = new UnicodeString(ch);
 
-                if (st == NULL) {
+                if (st == nullptr) {
                     status = U_MEMORY_ALLOCATION_ERROR;
                     break;
                 }
@@ -382,7 +382,7 @@ CollData::CollData(UCollator *collator, UErrorCode &status)
         } else if (len > 0) {
             UnicodeString *st = new UnicodeString(buffer, len);
 
-            if (st == NULL) {
+            if (st == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 break;
             }
@@ -491,7 +491,7 @@ const CEList *CollData::getCEList(const UnicodeString *string) const
 
     if (U_FAILURE(status)) {
         delete list;
-        list = NULL;
+        list = nullptr;
     }
 
     return list;
@@ -516,7 +516,7 @@ int32_t CollData::minLengthInChars(const CEList *ceList, int32_t offset, int32_t
     int32_t shortestLength = INT32_MAX;
     const StringList *strings = ceToCharsStartingWith->getStringList(ce);
 
-    if (strings != NULL) {
+    if (strings != nullptr) {
         int32_t stringCount = strings->size();
 
         for (int32_t s = 0; s < stringCount; s += 1) {
@@ -526,11 +526,11 @@ int32_t CollData::minLengthInChars(const CEList *ceList, int32_t offset, int32_t
 
             if (U_FAILURE(status)) {
                 delete ceList2;
-                ceList2 = NULL;
+                ceList2 = nullptr;
             }
 
             if (ceList->matchesAt(offset, ceList2)) {
-                U_ASSERT(ceList2 != NULL);
+                U_ASSERT(ceList2 != nullptr);
                 int32_t clength = ceList2->size();
                 int32_t slength = string->length();
                 int32_t roffset = offset + clength;
index c31fa436587b6e221a352b35c6fce465cde95dee..77bd58230dbeb8c4d5726bd63c17b9ad911eb442 100644 (file)
@@ -165,7 +165,7 @@ public:
      *
      * @param index - the index of the string
      *
-     * @return a pointer to the <code>UnicodeString</code> or <code>NULL</code> 
+     * @return a pointer to the <code>UnicodeString</code> or <code>nullptr</code>
      *         if <code>index</code> is out of bounds.
      */
     const UnicodeString *get(int32_t index) const;
@@ -236,7 +236,7 @@ public:
      * @param ce - the CE
      *
      * return a <code>StringList</code> object containing all
-     *        the strings, or <code>NULL</code> if there are
+     *        the strings, or <code>nullptr</code> if there are
      *        no such strings.
      */
     const StringList *getStringList(int32_t ce) const;
index f2ffb608efdb60afcb3d1924b9d66384994440dd..3939e698d600b5e7c55ef7b7d5a8a297c25a2a10 100644 (file)
@@ -555,7 +555,7 @@ CompactDecimalFormat*
 CompactDecimalFormatTest::createCDFInstance(const Locale& locale, UNumberCompactStyle style, UErrorCode& status) {
   CompactDecimalFormat* result = CompactDecimalFormat::createInstance(locale, style, status);
   if (U_FAILURE(status)) {
-    return NULL;
+    return nullptr;
   }
   // All tests are written for two significant digits, so we explicitly set here
   // in case default significant digits change.
index 5ca063485a2445fbb70bda076a910c97237e2f05..669514d0d7fdfc464d5c678d14152422997a3c59 100644 (file)
@@ -56,7 +56,7 @@ enum {
 ConversionTest::ConversionTest() {
     UErrorCode errorCode=U_ZERO_ERROR;
     utf8Cnv=ucnv_open("UTF-8", &errorCode);
-    ucnv_setToUCallBack(utf8Cnv, UCNV_TO_U_CALLBACK_STOP, NULL, NULL, NULL, &errorCode);
+    ucnv_setToUCallBack(utf8Cnv, UCNV_TO_U_CALLBACK_STOP, nullptr, nullptr, nullptr, &errorCode);
     if(U_FAILURE(errorCode)) {
         errln("unable to open UTF-8 converter");
     }
@@ -126,7 +126,7 @@ ConversionTest::TestToUnicode() {
                 offsetsLength=0;
                 cc.offsets=testCase->getIntVector(offsetsLength, "offsets", errorCode);
                 if(offsetsLength==0) {
-                    cc.offsets=NULL;
+                    cc.offsets=nullptr;
                 } else if(offsetsLength!=unicode.length()) {
                     errln("toUnicode[%d] unicode[%d] and offsets[%d] must have the same length",
                             i, unicode.length(), offsetsLength);
@@ -168,12 +168,12 @@ ConversionTest::TestToUnicode() {
                     callback=UCNV_TO_U_CALLBACK_ESCAPE;
                     break;
                 default:
-                    callback=NULL;
+                    callback=nullptr;
                     break;
                 }
-                option=callback==NULL ? cbopt : cbopt+1;
+                option=callback==nullptr ? cbopt : cbopt+1;
                 if(*option==0) {
-                    option=NULL;
+                    option=nullptr;
                 }
 
                 cc.invalidChars=testCase->getBinary(cc.invalidLength, "invalidChars", errorCode);
@@ -239,7 +239,7 @@ ConversionTest::TestFromUnicode() {
                 offsetsLength=0;
                 cc.offsets=testCase->getIntVector(offsetsLength, "offsets", errorCode);
                 if(offsetsLength==0) {
-                    cc.offsets=NULL;
+                    cc.offsets=nullptr;
                 } else if(offsetsLength!=cc.bytesLength) {
                     errln("fromUnicode[%d] bytes[%d] and offsets[%d] must have the same length",
                             i, cc.bytesLength, offsetsLength);
@@ -319,12 +319,12 @@ ConversionTest::TestFromUnicode() {
                     callback=UCNV_FROM_U_CALLBACK_ESCAPE;
                     break;
                 default:
-                    callback=NULL;
+                    callback=nullptr;
                     break;
                 }
-                option=callback==NULL ? cbopt : cbopt+1;
+                option=callback==nullptr ? cbopt : cbopt+1;
                 if(*option==0) {
-                    option=NULL;
+                    option=nullptr;
                 }
 
                 invalidUChars=testCase->getString("invalidUChars", errorCode);
@@ -401,7 +401,7 @@ ConversionTest::TestGetUnicodeSet() {
                 mapnotSet.clear();
 
                 pos.setIndex(0);
-                mapSet.applyPattern(map, pos, 0, NULL, errorCode);
+                mapSet.applyPattern(map, pos, 0, nullptr, errorCode);
                 if(U_FAILURE(errorCode) || pos.getIndex()!=map.length()) {
                     errln("error creating the map set for conversion/getUnicodeSet test case %d - %s\n"
                           "    error index %d  index %d  U+%04x",
@@ -411,7 +411,7 @@ ConversionTest::TestGetUnicodeSet() {
                 }
 
                 pos.setIndex(0);
-                mapnotSet.applyPattern(mapnot, pos, 0, NULL, errorCode);
+                mapnotSet.applyPattern(mapnot, pos, 0, nullptr, errorCode);
                 if(U_FAILURE(errorCode) || pos.getIndex()!=mapnot.length()) {
                     errln("error creating the mapnot set for conversion/getUnicodeSet test case %d - %s\n"
                           "    error index %d  index %d  U+%04x",
@@ -501,7 +501,7 @@ ConversionTest::TestGetUnicodeSet2() {
         s0Length=0x10000+0x200000;  // BMP + surrogate pairs
     }
     UChar *s0=new UChar[s0Length];
-    if(s0==NULL) {
+    if(s0==nullptr) {
         return;
     }
     UChar *s=s0;
@@ -562,7 +562,7 @@ ConversionTest::TestGetUnicodeSet2() {
             continue;
         }
         UnicodeSet expected;
-        ucnv_setFromUCallBack(cnv.getAlias(), getUnicodeSetCallback, &expected, NULL, NULL, &errorCode);
+        ucnv_setFromUCallBack(cnv.getAlias(), getUnicodeSetCallback, &expected, nullptr, nullptr, &errorCode);
         if(U_FAILURE(errorCode)) {
             errln("failed to set the callback on converter %s - %s", cnvNames[i], u_errorName(errorCode));
             continue;
@@ -578,7 +578,7 @@ ConversionTest::TestGetUnicodeSet2() {
             do {
                 char *t=buffer;
                 flush=(UBool)(s==s0+s0Length);
-                ucnv_fromUnicode(cnv.getAlias(), &t, buffer+sizeof(buffer), (const UChar **)&s, s0+s0Length, NULL, flush, &errorCode);
+                ucnv_fromUnicode(cnv.getAlias(), &t, buffer+sizeof(buffer), (const UChar **)&s, s0+s0Length, nullptr, flush, &errorCode);
                 if(U_FAILURE(errorCode)) {
                     if(errorCode==U_BUFFER_OVERFLOW_ERROR) {
                         errorCode=U_ZERO_ERROR;
@@ -679,7 +679,7 @@ ConversionTest::TestDefaultIgnorableCallback() {
     }
 
     // set callback for the converter 
-    ucnv_setFromUCallBack(cnv.getAlias(), UCNV_FROM_U_CALLBACK_SUBSTITUTE, NULL, NULL, NULL, &status);
+    ucnv_setFromUCallBack(cnv.getAlias(), UCNV_FROM_U_CALLBACK_SUBSTITUTE, nullptr, nullptr, nullptr, &status);
 
     UChar32 input[1];
     char output[10];
@@ -902,11 +902,11 @@ ConversionTest::TestUTF8ToUTF8Streaming() {
 
 UConverter *
 ConversionTest::cnv_open(const char *name, UErrorCode &errorCode) {
-    if(name!=NULL && *name=='+') {
+    if(name!=nullptr && *name=='+') {
         // Converter names that start with '+' are ignored in ICU4J tests.
         ++name;
     }
-    if(name!=NULL && *name=='*') {
+    if(name!=nullptr && *name=='*') {
         /* loadTestData(): set the data directory */
         return ucnv_openPackage(loadTestData(errorCode), name+1, &errorCode);
     } else {
@@ -973,7 +973,7 @@ static char *
 printOffsets(const int32_t *offsets, int32_t length, char *out) {
     int32_t i, o, d;
 
-    if(offsets==NULL) {
+    if(offsets==nullptr) {
         length=0;
     }
 
@@ -1037,7 +1037,7 @@ stepToUnicode(ConversionCase &cc, UConverter *cnv,
             flush=false;
 
             // output offsets only for bulk conversion
-            resultOffsets=NULL;
+            resultOffsets=nullptr;
         }
 
         for(;;) {
@@ -1158,7 +1158,7 @@ stepToUnicode(ConversionCase &cc, UConverter *cnv,
                 ucnv_toUnicode(cnv,
                     &target, targetLimit,
                     &source, sourceLimit,
-                    NULL, (UBool)(sourceLimit==bytesLimit), pErrorCode);
+                    nullptr, (UBool)(sourceLimit==bytesLimit), pErrorCode);
 
                 // check pointers and errors
                 if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR) {
@@ -1208,8 +1208,8 @@ ConversionTest::ToUnicodeCase(ConversionCase &cc, UConverterToUCallback callback
     }
 
     // set the callback
-    if(callback!=NULL) {
-        ucnv_setToUCallBack(cnv.getAlias(), callback, option, NULL, NULL, errorCode);
+    if(callback!=nullptr) {
+        ucnv_setToUCallBack(cnv.getAlias(), callback, option, nullptr, nullptr, errorCode);
         if(U_FAILURE(errorCode)) {
             errln("toUnicode[%d](%s cb=\"%s\" fb=%d flush=%d) ucnv_setToUCallBack() failed - %s",
                     cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, u_errorName(errorCode));
@@ -1250,7 +1250,7 @@ ConversionTest::ToUnicodeCase(ConversionCase &cc, UConverterToUCallback callback
         }
         if(step!=0) {
             // bulk test is first, then offsets are not checked any more
-            cc.offsets=NULL;
+            cc.offsets=nullptr;
         }
         else {
             for (int32_t i = 0; i < UPRV_LENGTHOF(resultOffsets); i++) {
@@ -1263,19 +1263,19 @@ ConversionTest::ToUnicodeCase(ConversionCase &cc, UConverterToUCallback callback
         errorCode.reset();
         resultLength=stepToUnicode(cc, cnv.getAlias(),
                                 result, UPRV_LENGTHOF(result),
-                                step==0 ? resultOffsets : NULL,
+                                step==0 ? resultOffsets : nullptr,
                                 step, errorCode);
         ok=checkToUnicode(
                 cc, cnv.getAlias(), steps[i].name,
                 result, resultLength,
-                cc.offsets!=NULL ? resultOffsets : NULL,
+                cc.offsets!=nullptr ? resultOffsets : nullptr,
                 errorCode);
         if(errorCode.isFailure() || !cc.finalFlush) {
             // reset if an error occurred or we did not flush
             // otherwise do nothing to make sure that flushing resets
             ucnv_resetToUnicode(cnv.getAlias());
         }
-        if (cc.offsets != NULL && resultOffsets[resultLength] != -1) {
+        if (cc.offsets != nullptr && resultOffsets[resultLength] != -1) {
             errln("toUnicode[%d](%s) Conversion wrote too much to offsets at index %d",
                 cc.caseNr, cc.charset, resultLength);
         }
@@ -1298,7 +1298,7 @@ ConversionTest::ToUnicodeCase(ConversionCase &cc, UConverterToUCallback callback
         ok=checkToUnicode(
                 cc, cnv.getAlias(), "toUChars",
                 result, resultLength,
-                NULL,
+                nullptr,
                 errorCode);
         if(!ok) {
             break;
@@ -1308,7 +1308,7 @@ ConversionTest::ToUnicodeCase(ConversionCase &cc, UConverterToUCallback callback
         // keep the correct result for simple checking
         errorCode.reset();
         resultLength=ucnv_toUChars(cnv.getAlias(),
-                        NULL, 0,
+                        nullptr, 0,
                         (const char *)cc.bytes, cc.bytesLength,
                         errorCode);
         if(errorCode.get()==U_STRING_NOT_TERMINATED_WARNING || errorCode.get()==U_BUFFER_OVERFLOW_ERROR) {
@@ -1317,7 +1317,7 @@ ConversionTest::ToUnicodeCase(ConversionCase &cc, UConverterToUCallback callback
         ok=checkToUnicode(
                 cc, cnv.getAlias(), "preflight toUChars",
                 result, resultLength,
-                NULL,
+                nullptr,
                 errorCode);
         break;
     }
@@ -1337,8 +1337,8 @@ ConversionTest::checkToUnicode(ConversionCase &cc, UConverter *cnv, const char *
 
     const char *msg;
 
-    // reset the message; NULL will mean "ok"
-    msg=NULL;
+    // reset the message; nullptr will mean "ok"
+    msg=nullptr;
 
     errorCode=U_ZERO_ERROR;
     resultInvalidLength=sizeof(resultInvalidChars);
@@ -1354,7 +1354,7 @@ ConversionTest::checkToUnicode(ConversionCase &cc, UConverter *cnv, const char *
         msg="wrong result length";
     } else if(0!=u_memcmp(cc.unicode, result, cc.unicodeLength)) {
         msg="wrong result string";
-    } else if(cc.offsets!=NULL && 0!=memcmp(cc.offsets, resultOffsets, cc.unicodeLength*sizeof(*cc.offsets))) {
+    } else if(cc.offsets!=nullptr && 0!=memcmp(cc.offsets, resultOffsets, cc.unicodeLength*sizeof(*cc.offsets))) {
         msg="wrong offsets";
     } else if(cc.outErrorCode!=resultErrorCode) {
         msg="wrong error code";
@@ -1364,7 +1364,7 @@ ConversionTest::checkToUnicode(ConversionCase &cc, UConverter *cnv, const char *
         msg="wrong last invalid input";
     }
 
-    if(msg==NULL) {
+    if(msg==nullptr) {
         return true;
     } else {
         char buffer[2000]; // one buffer for all strings
@@ -1548,7 +1548,7 @@ stepFromUnicode(ConversionCase &cc, UConverter *cnv,
         flush=false;
 
         // output offsets only for bulk conversion
-        resultOffsets=NULL;
+        resultOffsets=nullptr;
     }
 
     for(;;) {
@@ -1619,8 +1619,8 @@ ConversionTest::FromUnicodeCase(ConversionCase &cc, UConverterFromUCallback call
     ucnv_resetToUnicode(utf8Cnv);
 
     // set the callback
-    if(callback!=NULL) {
-        ucnv_setFromUCallBack(cnv, callback, option, NULL, NULL, &errorCode);
+    if(callback!=nullptr) {
+        ucnv_setFromUCallBack(cnv, callback, option, nullptr, nullptr, &errorCode);
         if(U_FAILURE(errorCode)) {
             errln("fromUnicode[%d](%s cb=\"%s\" fb=%d flush=%d) ucnv_setFromUCallBack() failed - %s",
                     cc.caseNr, cc.charset, cc.cbopt, cc.fallbacks, cc.finalFlush, u_errorName(errorCode));
@@ -1696,12 +1696,12 @@ ConversionTest::FromUnicodeCase(ConversionCase &cc, UConverterFromUCallback call
         errorCode=U_ZERO_ERROR;
         resultLength=stepFromUnicode(cc, cnv,
                                 result, UPRV_LENGTHOF(result),
-                                step==0 ? resultOffsets : NULL,
+                                step==0 ? resultOffsets : nullptr,
                                 step, &errorCode);
         ok=checkFromUnicode(
                 cc, cnv, steps[i].name,
                 (uint8_t *)result, resultLength,
-                cc.offsets!=NULL ? resultOffsets : NULL,
+                cc.offsets!=nullptr ? resultOffsets : nullptr,
                 errorCode);
         if(U_FAILURE(errorCode) || !cc.finalFlush) {
             // reset if an error occurred or we did not flush
@@ -1718,7 +1718,7 @@ ConversionTest::FromUnicodeCase(ConversionCase &cc, UConverterFromUCallback call
         }
 
         // bulk test is first, then offsets are not checked any more
-        cc.offsets=NULL;
+        cc.offsets=nullptr;
 
         // test direct conversion from UTF-8
         if(cc.utf8Length>=0) {
@@ -1729,7 +1729,7 @@ ConversionTest::FromUnicodeCase(ConversionCase &cc, UConverterFromUCallback call
             ok=checkFromUnicode(
                     cc, cnv, steps[i].utf8Name,
                     (uint8_t *)result, resultLength,
-                    NULL,
+                    nullptr,
                     errorCode);
             if(U_FAILURE(errorCode) || !cc.finalFlush) {
                 // reset if an error occurred or we did not flush
@@ -1753,7 +1753,7 @@ ConversionTest::FromUnicodeCase(ConversionCase &cc, UConverterFromUCallback call
         ok=checkFromUnicode(
                 cc, cnv, "fromUChars",
                 (uint8_t *)result, resultLength,
-                NULL,
+                nullptr,
                 errorCode);
         if(!ok) {
             break;
@@ -1763,7 +1763,7 @@ ConversionTest::FromUnicodeCase(ConversionCase &cc, UConverterFromUCallback call
         // keep the correct result for simple checking
         errorCode=U_ZERO_ERROR;
         resultLength=ucnv_fromUChars(cnv,
-                        NULL, 0,
+                        nullptr, 0,
                         cc.unicode, cc.unicodeLength,
                         &errorCode);
         if(errorCode==U_STRING_NOT_TERMINATED_WARNING || errorCode==U_BUFFER_OVERFLOW_ERROR) {
@@ -1772,7 +1772,7 @@ ConversionTest::FromUnicodeCase(ConversionCase &cc, UConverterFromUCallback call
         ok=checkFromUnicode(
                 cc, cnv, "preflight fromUChars",
                 (uint8_t *)result, resultLength,
-                NULL,
+                nullptr,
                 errorCode);
         break;
     }
@@ -1792,8 +1792,8 @@ ConversionTest::checkFromUnicode(ConversionCase &cc, UConverter *cnv, const char
 
     const char *msg;
 
-    // reset the message; NULL will mean "ok"
-    msg=NULL;
+    // reset the message; nullptr will mean "ok"
+    msg=nullptr;
 
     errorCode=U_ZERO_ERROR;
     resultInvalidLength=UPRV_LENGTHOF(resultInvalidUChars);
@@ -1809,7 +1809,7 @@ ConversionTest::checkFromUnicode(ConversionCase &cc, UConverter *cnv, const char
         msg="wrong result length";
     } else if(0!=memcmp(cc.bytes, result, cc.bytesLength)) {
         msg="wrong result string";
-    } else if(cc.offsets!=NULL && 0!=memcmp(cc.offsets, resultOffsets, cc.bytesLength*sizeof(*cc.offsets))) {
+    } else if(cc.offsets!=nullptr && 0!=memcmp(cc.offsets, resultOffsets, cc.bytesLength*sizeof(*cc.offsets))) {
         msg="wrong offsets";
     } else if(cc.outErrorCode!=resultErrorCode) {
         msg="wrong error code";
@@ -1819,7 +1819,7 @@ ConversionTest::checkFromUnicode(ConversionCase &cc, UConverter *cnv, const char
         msg="wrong last invalid input";
     }
 
-    if(msg==NULL) {
+    if(msg==nullptr) {
         return true;
     } else {
         char buffer[2000]; // one buffer for all strings
index d0d7bd62a046ba1d1fb3ae28d3c64d3eb256bd78..62cf2b9af02803b78dfeeeac49500e0b92ff4131 100644 (file)
@@ -100,10 +100,10 @@ void CompoundTransliteratorTest::TestConstruction(){
    {
     /*Test Jitterbug 914 */
     UErrorCode err = U_ZERO_ERROR;
-    CompoundTransliterator  cpdTrans(UnicodeString("Latin-Hangul"),UTRANS_REVERSE,NULL,parseError,err);
+    CompoundTransliterator  cpdTrans(UnicodeString("Latin-Hangul"),UTRANS_REVERSE,nullptr,parseError,err);
     UnicodeString newID =cpdTrans.getID();
     if(newID!=UnicodeString("Hangul-Latin")){
-        errln(UnicodeString("Test for Jitterbug 914 for cpdTrans(UnicodeString(\"Latin-Hangul\"),UTRANS_REVERSE,NULL,err) failed"));
+        errln(UnicodeString("Test for Jitterbug 914 for cpdTrans(UnicodeString(\"Latin-Hangul\"),UTRANS_REVERSE,nullptr,err) failed"));
     }
    }
    delete t1;
@@ -216,7 +216,7 @@ void CompoundTransliteratorTest::TestGetCount(){
 
     /* Quick test getTargetSet(), only test that it doesn't die.  TODO:  a better test. */
     UnicodeSet ts;
-    UnicodeSet *retUS = NULL;
+    UnicodeSet *retUS = nullptr;
     retUS = &ct1->getTargetSet(ts);
     if (retUS != &ts || ts.size() == 0) {
         errln("CompoundTransliterator::getTargetSet() failed.\n");
@@ -224,7 +224,7 @@ void CompoundTransliteratorTest::TestGetCount(){
 
     /* Quick test getSourceSet(), only test that it doesn't die.  TODO:  a better test. */
     UnicodeSet ss;
-    retUS = NULL;
+    retUS = nullptr;
     retUS = &ct1->getSourceSet(ss);
     if (retUS != &ss || ss.size() == 0) {
         errln("CompoundTransliterator::getSourceSet() failed.\n");
index dd0a0a0fd63a2c7edcfe609cf17e51aa78a7223e..3518f2f447d78bb07f4ab2d4b61aec9a3ec75be8 100644 (file)
@@ -29,7 +29,7 @@
  */
 class CompoundTransliteratorTest : public IntlTest {
 public:
-    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=nullptr) override;
 
     /*Tests the constructors */
     void TestConstruction(void);
index dc5e7a8699b1851d4d6ebb7891100d5c1aa32d5c..878225546ec87996efa01444cb18e69ee56a6962 100644 (file)
@@ -146,9 +146,9 @@ static UnicodeString *split(const UnicodeString &src, UChar ch, int32_t &splits)
 static char *extractBytes(const UnicodeString &source, const char *codepage, int32_t &length)
 {
     int32_t sLength = source.length();
-    char *bytes = NULL;
+    char *bytes = nullptr;
 
-    length = source.extract(0, sLength, NULL, codepage);
+    length = source.extract(0, sLength, nullptr, codepage);
 
     if (length > 0) {
         bytes = new char[length + 1];
@@ -190,7 +190,7 @@ void CharsetDetectionTest::checkEncoding(const UnicodeString &testString, const
 
     UnicodeString name(ucsdet_getName(matches[0], &status));
     UnicodeString lang(ucsdet_getLanguage(matches[0], &status));
-    UChar *decoded = NULL;
+    UChar *decoded = nullptr;
     int32_t dLength = 0;
 
     if (matchCount == 0) {
@@ -244,7 +244,7 @@ const char *CharsetDetectionTest::getPath(char buffer[2048], const char *filenam
 
     if (U_FAILURE(status)) {
         errln("ERROR: getPath() failed - %s", u_errorName(status));
-        return NULL;
+        return nullptr;
     }
 
     strcpy(buffer, testDataDirectory);
@@ -267,7 +267,7 @@ void CharsetDetectionTest::ConstructionTest()
         int32_t length;
         const char *name = uenum_next(e.getAlias(), &length, status);
 
-        if(name == NULL || length <= 0) {
+        if(name == nullptr || length <= 0) {
             errln("ucsdet_getAllDetectableCharsets() returned a null or empty name!");
         }
 
@@ -283,15 +283,15 @@ void CharsetDetectionTest::ConstructionTest()
     };
 
     LocalUEnumerationPointer eActive(ucsdet_getDetectableCharsets(csd.getAlias(), status));
-    const char *activeName = NULL;
+    const char *activeName = nullptr;
 
-    while ((activeName = uenum_next(eActive.getAlias(), NULL, status))) {
+    while ((activeName = uenum_next(eActive.getAlias(), nullptr, status))) {
         // the charset must be included in all list
         UBool found = false;
 
-        const char *name = NULL;
+        const char *name = nullptr;
         uenum_reset(e.getAlias(), status);
-        while ((name = uenum_next(e.getAlias(), NULL, status))) {
+        while ((name = uenum_next(e.getAlias(), nullptr, status))) {
             if (strcmp(activeName, name) == 0) {
                 found = true;
                 break;
@@ -333,7 +333,7 @@ void CharsetDetectionTest::UTF8Test()
     ucsdet_setText(csd, bytes, byteLength, &status);
     match = ucsdet_detect(csd, &status);
 
-    if (match == NULL) {
+    if (match == nullptr) {
         errln("Detection failure for UTF-8: got no matches.");
         goto bail;
     }
@@ -374,7 +374,7 @@ void CharsetDetectionTest::UTF16Test()
     ucsdet_setText(csd.getAlias(), beBytes.get(), beLength, &status);
     match = ucsdet_detect(csd.getAlias(), &status);
 
-    if (match == NULL) {
+    if (match == nullptr) {
         errln("Encoding detection failure for UTF-16BE: got no matches.");
     } else {
 
@@ -391,7 +391,7 @@ void CharsetDetectionTest::UTF16Test()
     ucsdet_setText(csd.getAlias(), leBytes.get(), leLength, &status);
     match = ucsdet_detect(csd.getAlias(), &status);
 
-    if (match == NULL) {
+    if (match == nullptr) {
         errln("Encoding detection failure for UTF-16LE: got no matches.");
         return;
     }
@@ -429,19 +429,19 @@ void CharsetDetectionTest::InputFilterTest()
     ucsdet_setText(csd, bytes, byteLength, &status);
     match = ucsdet_detect(csd, &status);
 
-    if (match == NULL) {
+    if (match == nullptr) {
         errln("Turning on the input filter resulted in no matches.");
         goto turn_off;
     }
 
     name = ucsdet_getName(match, &status);
 
-    if (name == NULL || strcmp(name, "ISO-8859-1") != 0) {
+    if (name == nullptr || strcmp(name, "ISO-8859-1") != 0) {
         errln("Turning on the input filter resulted in %s rather than ISO-8859-1.", name);
     } else {
         lang = ucsdet_getLanguage(match, &status);
 
-        if (lang == NULL || strcmp(lang, "fr") != 0) {
+        if (lang == nullptr || strcmp(lang, "fr") != 0) {
             errln("Input filter did not strip markup!");
         }
     }
@@ -451,19 +451,19 @@ turn_off:
     ucsdet_setText(csd, bytes, byteLength, &status);
     match = ucsdet_detect(csd, &status);
 
-    if (match == NULL) {
+    if (match == nullptr) {
         errln("Turning off the input filter resulted in no matches.");
         goto bail;
     }
 
     name = ucsdet_getName(match, &status);
 
-    if (name == NULL || strcmp(name, "ISO-8859-1") != 0) {
+    if (name == nullptr || strcmp(name, "ISO-8859-1") != 0) {
         errln("Turning off the input filter resulted in %s rather than ISO-8859-1.", name);
     } else {
         lang = ucsdet_getLanguage(match, &status);
 
-        if (lang == NULL || strcmp(lang, "en") != 0) {
+        if (lang == nullptr || strcmp(lang, "en") != 0) {
             errln("Unfiltered input did not detect as English!");
         }
     }
@@ -490,7 +490,7 @@ void CharsetDetectionTest::C1BytesTest()
     ucsdet_setText(csd, bWindows, lWindows, &status);
     match = ucsdet_detect(csd, &status);
 
-    if (match == NULL) {
+    if (match == nullptr) {
         errcheckln(status, "English test with C1 bytes got no matches. - %s", u_errorName(status));
         goto bail;
     }
@@ -504,7 +504,7 @@ void CharsetDetectionTest::C1BytesTest()
     ucsdet_setText(csd, bISO, lISO, &status);
     match = ucsdet_detect(csd, &status);
 
-    if (match == NULL) {
+    if (match == nullptr) {
         errln("English text without C1 bytes got no matches.");
         goto bail;
     }
@@ -530,7 +530,7 @@ void CharsetDetectionTest::DetectionTest()
     char path[2048];
     const char *testFilePath = getPath(path, "csdetest.xml");
 
-    if (testFilePath == NULL) {
+    if (testFilePath == nullptr) {
         return; /* Couldn't get path: error message already output. */
     }
 
@@ -550,7 +550,7 @@ void CharsetDetectionTest::DetectionTest()
     const UXMLElement *testCase;
     int32_t tc = 0;
 
-    while((testCase = root->nextChildElement(tc)) != NULL) {
+    while((testCase = root->nextChildElement(tc)) != nullptr) {
         if (testCase->getTagName().compare(test_case) == 0) {
             const UnicodeString *id = testCase->getAttribute(id_attr);
             const UnicodeString *encodings = testCase->getAttribute(enc_attr);
@@ -639,7 +639,7 @@ void CharsetDetectionTest::IBM424Test()
     ucsdet_setText(csd, bytes, bLength, &status);
     match = ucsdet_detect(csd, &status);
 
-    if (match == NULL) {
+    if (match == nullptr) {
         errcheckln(status, "Encoding detection failure for IBM424_rtl: got no matches. - %s", u_errorName(status));
         goto bail;
     }
@@ -652,7 +652,7 @@ void CharsetDetectionTest::IBM424Test()
     ucsdet_setText(csd, bytes_r, brLength, &status);
     match = ucsdet_detect(csd, &status);
 
-    if (match == NULL) {
+    if (match == nullptr) {
         errln("Encoding detection failure for IBM424_ltr: got no matches.");
         goto bail;
     }
@@ -729,7 +729,7 @@ void CharsetDetectionTest::IBM420Test()
     ucsdet_setText(csd, bytes, bLength, &status);
     match = ucsdet_detect(csd, &status);
 
-    if (match == NULL) {
+    if (match == nullptr) {
         errcheckln(status, "Encoding detection failure for IBM420_rtl: got no matches. - %s", u_errorName(status));
         goto bail;
     }
@@ -742,7 +742,7 @@ void CharsetDetectionTest::IBM420Test()
     ucsdet_setText(csd, bytes_r, brLength, &status);
     match = ucsdet_detect(csd, &status);
 
-    if (match == NULL) {
+    if (match == nullptr) {
         errln("Encoding detection failure for IBM420_ltr: got no matches.\n");
         goto bail;
     }
@@ -856,7 +856,7 @@ void CharsetDetectionTest::Ticket21823Test() {
     ucsdet_setText(csd, str.data(), str.length(), &status);
     const UCharsetMatch* match = ucsdet_detect(csd, &status);
 
-    if (match == NULL) {
+    if (match == nullptr) {
         TEST_ASSERT(U_FAILURE(status));
     }
 
index 8893b88e5916613ab8954f6868ae7214dc71b91d..c831dc0549145091fd7ed7db1a666c49f359925d 100644 (file)
@@ -21,7 +21,7 @@ public:
     CharsetDetectionTest();
     virtual ~CharsetDetectionTest();
 
-    virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     virtual void ConstructionTest();
     virtual void UTF8Test();
index 3527e939f0bd1b86c068cf86e6c6cec2d13983de..505bc2ea98a8baff05770aa30bbc3a60f5a599ca 100644 (file)
@@ -31,7 +31,7 @@ public:
 
     CollationCurrencyTest();
     virtual ~CollationCurrencyTest();
-    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = nullptr) override;
 
     void currencyTest(/*char *par*/);
 };
index f78be4fa0d5cb0545456314201137b8f0f81ffb0..89482d5d70d3e90f9287493761a56a45d602cef5 100644 (file)
@@ -40,11 +40,11 @@ DataDrivenCalendarTest::~DataDrivenCalendarTest() {
 
 void DataDrivenCalendarTest::runIndexedTest(int32_t index, UBool exec,
         const char* &name, char* /*par */) {
-    if (driver != NULL) {
+    if (driver != nullptr) {
         if (exec) {
             //  logln("Begin ");
         }
-        const DataMap *info= NULL;
+        const DataMap *info= nullptr;
         UErrorCode status= U_ZERO_ERROR;
         TestData *testData = driver->createTestData(index, status);
         if (U_SUCCESS(status)) {
@@ -78,7 +78,7 @@ void DataDrivenCalendarTest::testOps(TestData *testData,
     UDate fromDate = 0; // TODO
     UDate toDate = 0;
     
-    const DataMap *currentCase= NULL;
+    const DataMap *currentCase= nullptr;
     char toCalLoc[256] = "";
 
     // TODO: static strings?
@@ -98,8 +98,8 @@ void DataDrivenCalendarTest::testOps(TestData *testData,
     int n = 0;
     while (testData->nextCase(currentCase, status)) {
         ++n;
-        Calendar *toCalendar= NULL;
-        Calendar *fromCalendar= NULL;
+        Calendar *toCalendar= nullptr;
+        Calendar *fromCalendar= nullptr;
 
         // load parameters
         char theCase[200];
@@ -367,7 +367,7 @@ void DataDrivenCalendarTest::testConvert(TestData *testData,
         const DataMap *settings, UBool forward) {
     UErrorCode status = U_ZERO_ERROR;
     LocalPointer<Calendar> toCalendar;
-    const DataMap *currentCase= NULL;
+    const DataMap *currentCase= nullptr;
     char toCalLoc[256] = "";
     char fromCalLoc[256] = "";
     // build to calendar
@@ -445,12 +445,12 @@ void DataDrivenCalendarTest::testConvert(TestData *testData,
 }
 
 void DataDrivenCalendarTest::processTest(TestData *testData) {
-    //Calendar *cal= NULL;
-    //const UChar *arguments= NULL;
+    //Calendar *cal= nullptr;
+    //const UChar *arguments= nullptr;
     //int32_t argLen = 0;
     char testType[256] = "";
-    const DataMap *settings= NULL;
-    //const UChar *type= NULL;
+    const DataMap *settings= nullptr;
+    //const UChar *type= nullptr;
     UErrorCode status = U_ZERO_ERROR;
     UnicodeString testSetting;
     int n = 0;
index 5589603a657e104dc6ee770847c58f903ea732ce..d8b83c0082339f421f68b6e02f36da2bfa1d9a57 100644 (file)
@@ -31,7 +31,7 @@ class CalendarFieldsSet;
 
 class DataDrivenCalendarTest : public IntlTest {
        void runIndexedTest(int32_t index, UBool exec, const char* &name,
-                       char* par = NULL) override;
+                       char* par = nullptr) override;
 public:
        DataDrivenCalendarTest();
        virtual ~DataDrivenCalendarTest();
index dd14909123cd412dae40adafeff957a7532dcc8f..14d8fa7abaab5d88a41119f404796a654d58d4b2 100644 (file)
@@ -42,11 +42,11 @@ DataDrivenFormatTest::~DataDrivenFormatTest() {
 
 void DataDrivenFormatTest::runIndexedTest(int32_t index, UBool exec,
         const char* &name, char* /*par */) {
-    if (driver != NULL) {
+    if (driver != nullptr) {
         if (exec) {
             //  logln("Begin ");
         }
-        const DataMap *info= NULL;
+        const DataMap *info= nullptr;
         UErrorCode status= U_ZERO_ERROR;
         TestData *testData = driver->createTestData(index, status);
         if (U_SUCCESS(status)) {
@@ -108,7 +108,7 @@ void DataDrivenFormatTest::testConvertDate(TestData *testData,
         return;
     }
 
-    const DataMap *currentCase= NULL;
+    const DataMap *currentCase= nullptr;
     // Start the processing
     int n = 0;
     while (testData->nextCase(currentCase, status)) {
@@ -156,7 +156,7 @@ void DataDrivenFormatTest::testConvertDate(TestData *testData,
             continue;
         }
                 
-        DateFormat *format = NULL;
+        DateFormat *format = nullptr;
         
         // Process: 'locale'
         locale.extract(0, locale.length(), calLoc, (const char*)0); // default codepage.  Invariant codepage doesn't have '@'!
@@ -175,7 +175,7 @@ void DataDrivenFormatTest::testConvertDate(TestData *testData,
                 continue;
             }
             format = DateFormat::createDateTimeInstance((DateFormat::EStyle)styleSet.getDateStyle(), (DateFormat::EStyle)styleSet.getTimeStyle(), loc);
-            if(format == NULL ) {
+            if(format == nullptr ) {
                 errln("case %d: could not create SimpleDateFormat from styles.", n);
                 continue;
             }
@@ -327,12 +327,12 @@ void DataDrivenFormatTest::testConvertDate(TestData *testData,
 }
 
 void DataDrivenFormatTest::processTest(TestData *testData) {
-    //Format *cal= NULL;
-    //const UChar *arguments= NULL;
+    //Format *cal= nullptr;
+    //const UChar *arguments= nullptr;
     //int32_t argLen = 0;
     char testType[256] = "";
-    const DataMap *settings= NULL;
-    //const UChar *type= NULL;
+    const DataMap *settings= nullptr;
+    //const UChar *type= nullptr;
     UErrorCode status = U_ZERO_ERROR;
     UnicodeString testSetting;
     int n = 0;
index 7d3fc1909eabb86c4ae0517249b9c05f099d30d2..e8d8cfd00f99a93d2f90cfdd38bd5b573a855b0d 100644 (file)
@@ -31,7 +31,7 @@ class DataMap;
 
 class DataDrivenFormatTest : public IntlTest {
     void runIndexedTest(int32_t index, UBool exec, const char* &name,
-            char* par = NULL) override;
+            char* par = nullptr) override;
 public:
     DataDrivenFormatTest();
     virtual ~DataDrivenFormatTest();
index 25e351eacdee6ab271ceea6ea4281db5b9319b7a..57f4a21d504111a899a28cbf24e7047d14428b0e 100644 (file)
@@ -188,7 +188,7 @@ UBool DataDrivenNumberFormatTestSuite::readLine(
         UCHARBUF *f, UErrorCode &status) {
     int32_t lineLength;
     const UChar *line = ucbuf_readline(f, &lineLength, &status);
-    if(line == NULL || U_FAILURE(status)) {
+    if(line == nullptr || U_FAILURE(status)) {
         if (U_FAILURE(status)) {
             errln("Error reading line from file.");
         }
@@ -269,7 +269,7 @@ UBool DataDrivenNumberFormatTestSuite::isFormatPass(
 
 UObject *DataDrivenNumberFormatTestSuite::newFormatter(
         UErrorCode & /*status*/) {
-    return NULL;
+    return nullptr;
 }
 
 UBool DataDrivenNumberFormatTestSuite::isToPatternPass(
index b2b1281932ee32f03e7d781a490b491a8b01f662..4dc0c2628e24735ec3a7befe20eca3f80b23da93 100644 (file)
@@ -30,7 +30,7 @@ class DataDrivenNumberFormatTestSuite : public IntlTest {
  public:
      DataDrivenNumberFormatTestSuite() {
          for (int32_t i = 0; i < UPRV_LENGTHOF(fPreviousFormatters); ++i) {
-             fPreviousFormatters[i] = NULL;
+             fPreviousFormatters[i] = nullptr;
          }
      }
 
index 71595ed4ee1564d45282a328f5b33a4e2c7ee18c..634cad7d5c0722cda83e66208bb82284f19aeba4 100644 (file)
@@ -19,7 +19,7 @@
 
 
 class IntlTestDecimalFormatAPI: public IntlTest {
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
 public:
     /**
index 9c114240395ef09109b30a53bc531be59bd2df9d..ed8e3802411e759042741c2dcaa55a05dcf0da6b 100644 (file)
@@ -213,7 +213,7 @@ void DecimalFormatTest::DataDrivenTests() {
     //  Open and read the test data file.
     //
     srcPath=getPath(tdd, "dcfmtest.txt");
-    if(srcPath==NULL) {
+    if(srcPath==nullptr) {
         return; /* something went wrong, error already output */
     }
 
@@ -451,12 +451,12 @@ void DecimalFormatTest::execFormatTest(int32_t lineNum,
             typeStr = "Formattable";
             Formattable fmtbl;
             fmtbl.setDecimalNumber(spInput, status);
-            fmtr.format(fmtbl, result, NULL, status);
+            fmtr.format(fmtbl, result, nullptr, status);
         }
         break;
     case kStringPiece:
         typeStr = "StringPiece";
-        fmtr.format(spInput, result, NULL, status);
+        fmtr.format(spInput, result, nullptr, status);
         break;
     }
 
index 60d57a30aeeefbb40a75aa3c78a043528085bcea..be19251f22a5518a5ec4a45d1716174eaf7cb213 100644 (file)
@@ -29,7 +29,7 @@ public:
     DecimalFormatTest();
     virtual ~DecimalFormatTest();
 
-    virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     // The following are test functions that are visible from the intltest test framework.
     virtual void DataDrivenTests();
index b76eb77fb740e6e9f5175fbb56e660aedb6dfc4f..8d48c203a81cd2812f90bbbf7994b865d964ea18 100644 (file)
@@ -43,7 +43,7 @@ CollationGermanTest::CollationGermanTest()
         errcheckln(status, __FILE__ "failed to create! err " + UnicodeString(u_errorName(status)));
         /* if it wasn't already: */
         delete myCollation;
-        myCollation = NULL;
+        myCollation = nullptr;
     }
 }
 
@@ -104,7 +104,7 @@ const Collator::EComparisonResult CollationGermanTest::results[][2] =
 
 void CollationGermanTest::TestTertiary(/* char* par */)
 {
-    if(myCollation == NULL ) {
+    if(myCollation == nullptr ) {
         dataerrln("decoll: cannot start test, collator is null\n");
         return;
     }
@@ -120,7 +120,7 @@ void CollationGermanTest::TestTertiary(/* char* par */)
 }
 void CollationGermanTest::TestPrimary(/* char* par */)
 {
-    if(myCollation == NULL ) {
+    if(myCollation == nullptr ) {
         dataerrln("decoll: cannot start test, collator is null\n");
         return;
     }
index ee7e2afae054709be4497d4b91958851b2a15817..8b3a625850e9f1d492a2111d82946d58c46d0e81 100644 (file)
@@ -28,7 +28,7 @@ public:
 
     CollationGermanTest();
     virtual ~CollationGermanTest();
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     // perform test with strength PRIMARY
     void TestPrimary(/* char* par */);
index 361c35c5baedf2c370f02a43ab9aa477fba42ca0..cb2d2f51a503173e32f941e98d007f1c20d5880d 100644 (file)
@@ -81,7 +81,7 @@ void IntlTestDateFormatAPI::TestCoverage(void)
 
     for (int32_t i = 0; i < numOfLocales; i++) {
         DateFormat *df = DateFormat::createDateTimeInstance(DateFormat::kMedium, DateFormat::kMedium, Locale(LOCALES[i]));
-        if (df == NULL){
+        if (df == nullptr){
             dataerrln("Error creating DateFormat instances.");
             return;
         }
@@ -100,7 +100,7 @@ void IntlTestDateFormatAPI::TestEquals(void)
     while (Calendar::getNow() == start) ; // Wait for time to change
     DateFormat *b = DateFormat::createInstance();
 
-    if (a == NULL || b == NULL){
+    if (a == nullptr || b == nullptr){
         dataerrln("Error calling DateFormat::createInstance()");
         delete a;
         delete b;
@@ -111,7 +111,7 @@ void IntlTestDateFormatAPI::TestEquals(void)
         errln("FAIL: DateFormat objects created at different times are unequal.");
 
     SimpleDateFormat *sdtfmt = dynamic_cast<SimpleDateFormat *>(b);
-    if (sdtfmt != NULL)
+    if (sdtfmt != nullptr)
     {
         double ONE_YEAR = 365*24*60*60*1000.0;
         sdtfmt->set2DigitYearStart(start + 50*ONE_YEAR, status);
@@ -141,12 +141,12 @@ void IntlTestDateFormatAPI::testAPI(/* char* par */)
     DateFormat *it = DateFormat::createDateInstance(DateFormat::MEDIUM, Locale::getItalian());
     DateFormat *de = DateFormat::createDateTimeInstance(DateFormat::LONG, DateFormat::LONG, Locale::getGerman());
 
-    if (def == NULL || fr == NULL || it == NULL || de == NULL){
+    if (def == nullptr || fr == nullptr || it == nullptr || de == nullptr){
         dataerrln("Error creating DateFormat instances.");
     }
 
 // ======= Test equality
-if (fr != NULL && def != NULL)
+if (fr != nullptr && def != nullptr)
 {
     logln("Testing equality operator");
     
@@ -156,7 +156,7 @@ if (fr != NULL && def != NULL)
 }
 
 // ======= Test various format() methods
-if (fr != NULL && it != NULL && de != NULL)
+if (fr != nullptr && it != nullptr && de != nullptr)
 {
     logln("Testing various format() methods");
 
@@ -181,7 +181,7 @@ if (fr != NULL && it != NULL && de != NULL)
 }
 
 // ======= Test parse()
-if (def != NULL)
+if (def != nullptr)
 {
     logln("Testing parse()");
 
@@ -208,7 +208,7 @@ if (def != NULL)
 }
 
 // ======= Test getters and setters
-if (fr != NULL && it != NULL && de != NULL)
+if (fr != nullptr && it != nullptr && de != nullptr)
 {
     logln("Testing getters and setters");
 
index 3ded5df2ff39980cee9473c34bd590d739f7fd3d..6497c93255c97713a1fd8bae3ae716e0c391cbad 100644 (file)
@@ -22,7 +22,7 @@
  * verifies that it works on a basic level.
  */
 class IntlTestDateFormatAPI: public IntlTest {
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
 private:
     /**
index 70e7a94d20f1100ec1a43b7c265ffa1dfa5668ec..fb3504e7fc08779af0e8a28f5b064ff679868e71 100644 (file)
@@ -85,7 +85,7 @@ void DateFormatRegressionTest::Test4029195(void)
         return;
     }
     UnicodeString pat;
-    if(sdf == NULL){
+    if(sdf == nullptr){
         dataerrln("Error calling DateFormat::createDateTimeInstance");
         return;
     }
@@ -134,7 +134,7 @@ void DateFormatRegressionTest::Test4052408(void)
 
     DateFormat *fmt = DateFormat::createDateTimeInstance(DateFormat::SHORT,
                                                 DateFormat::SHORT, Locale::getUS());
-    if (fmt == NULL) {
+    if (fmt == nullptr) {
         dataerrln("Error calling DateFormat::createDateTimeInstance");
         return;
     }
@@ -440,13 +440,13 @@ void DateFormatRegressionTest::Test4065240(void)
         TimeZone::adoptDefault(TimeZone::createTimeZone("EST"));
         curDate = date(98, 0, 1);
         shortdate = DateFormat::createDateInstance(DateFormat::SHORT);
-        if (shortdate == NULL){
+        if (shortdate == nullptr){
             dataerrln("Error calling DateFormat::createDateInstance");
             return;
         }
 
         fulldate = DateFormat::createDateTimeInstance(DateFormat::LONG, DateFormat::LONG);
-        if (fulldate == NULL){
+        if (fulldate == nullptr){
             dataerrln("Error calling DateFormat::createDateTimeInstance");
             return;
         }
@@ -466,7 +466,7 @@ void DateFormatRegressionTest::Test4065240(void)
 
         // Check to see if the resource is present; if not, we can't test
         ResourceBundle *bundle = new ResourceBundle(
-            NULL, *curLocale, status);
+            nullptr, *curLocale, status);
         failure(status, "new ResourceBundle");
             //(UnicodeString) "java.text.resources.DateFormatZoneData", curLocale);
 
@@ -510,7 +510,7 @@ void DateFormatRegressionTest::Test4071441(void)
     DateFormat *fmtA = DateFormat::createInstance();
     DateFormat *fmtB = DateFormat::createInstance();
 
-    if (fmtA == NULL || fmtB == NULL){
+    if (fmtA == nullptr || fmtB == nullptr){
         dataerrln("Error calling DateFormat::createInstance");
         delete fmtA;
         delete fmtB;
@@ -1223,7 +1223,7 @@ void DateFormatRegressionTest::Test714(void)
     DateFormat *fmt = DateFormat::createDateTimeInstance(DateFormat::NONE,
                                                          DateFormat::MEDIUM,
                                                          Locale::getUS());
-    if (fmt == NULL) {
+    if (fmt == nullptr) {
         dataerrln("Error calling DateFormat::createDateTimeInstance");
         return;
     }
@@ -1274,7 +1274,7 @@ public:
     wom(xwom),
     dow(xdow),
     data(xdata,""),
-    normalized((xnormalized==NULL)?xdata:xnormalized,"")
+    normalized((xnormalized==nullptr)?xdata:xnormalized,"")
   { }
 };
 
@@ -1288,21 +1288,21 @@ void DateFormatRegressionTest::Test1684(void)
   // 22 23 24 25 26 27 28  19 20 21 22 23 24 25  20 21 22 23 24 25 26
   // 29 30 31              26 27 28 29 30 31     27 28 29 30 31      
   Test1684Data *tests[] = {
-    new Test1684Data(2001, 8,  6,  2001,8,2,UCAL_MONDAY,    "2001 08 02 Mon", NULL),
-    new Test1684Data(2001, 8,  7,  2001,8,2,UCAL_TUESDAY,   "2001 08 02 Tue", NULL),
-    new Test1684Data(2001, 8,  5,/*12,*/ 2001,8,2,UCAL_SUNDAY,    "2001 08 02 Sun", NULL),
+    new Test1684Data(2001, 8,  6,  2001,8,2,UCAL_MONDAY,    "2001 08 02 Mon", nullptr),
+    new Test1684Data(2001, 8,  7,  2001,8,2,UCAL_TUESDAY,   "2001 08 02 Tue", nullptr),
+    new Test1684Data(2001, 8,  5,/*12,*/ 2001,8,2,UCAL_SUNDAY,    "2001 08 02 Sun", nullptr),
     new Test1684Data(2001, 8,6, /*7,  30,*/ 2001,7,6,UCAL_MONDAY,    "2001 07 06 Mon", "2001 08 02 Mon"),
     new Test1684Data(2001, 8,7, /*7,  31,*/ 2001,7,6,UCAL_TUESDAY,   "2001 07 06 Tue", "2001 08 02 Tue"),
     new Test1684Data(2001, 8,  5,  2001,7,6,UCAL_SUNDAY,    "2001 07 06 Sun", "2001 08 02 Sun"),
     new Test1684Data(2001, 7,  30, 2001,8,1,UCAL_MONDAY,    "2001 08 01 Mon", "2001 07 05 Mon"),
     new Test1684Data(2001, 7,  31, 2001,8,1,UCAL_TUESDAY,   "2001 08 01 Tue", "2001 07 05 Tue"),
     new Test1684Data(2001, 7,29, /*8,  5,*/  2001,8,1,UCAL_SUNDAY,    "2001 08 01 Sun", "2001 07 05 Sun"),
-    new Test1684Data(2001, 12, 31, 2001,12,6,UCAL_MONDAY,   "2001 12 06 Mon", NULL),
-    new Test1684Data(2002, 1,  1,  2002,1,1,UCAL_TUESDAY,   "2002 01 01 Tue", NULL),
-    new Test1684Data(2002, 1,  2,  2002,1,1,UCAL_WEDNESDAY, "2002 01 01 Wed", NULL),
-    new Test1684Data(2002, 1,  3,  2002,1,1,UCAL_THURSDAY,  "2002 01 01 Thu", NULL),
-    new Test1684Data(2002, 1,  4,  2002,1,1,UCAL_FRIDAY,    "2002 01 01 Fri", NULL),
-    new Test1684Data(2002, 1,  5,  2002,1,1,UCAL_SATURDAY,  "2002 01 01 Sat", NULL),
+    new Test1684Data(2001, 12, 31, 2001,12,6,UCAL_MONDAY,   "2001 12 06 Mon", nullptr),
+    new Test1684Data(2002, 1,  1,  2002,1,1,UCAL_TUESDAY,   "2002 01 01 Tue", nullptr),
+    new Test1684Data(2002, 1,  2,  2002,1,1,UCAL_WEDNESDAY, "2002 01 01 Wed", nullptr),
+    new Test1684Data(2002, 1,  3,  2002,1,1,UCAL_THURSDAY,  "2002 01 01 Thu", nullptr),
+    new Test1684Data(2002, 1,  4,  2002,1,1,UCAL_FRIDAY,    "2002 01 01 Fri", nullptr),
+    new Test1684Data(2002, 1,  5,  2002,1,1,UCAL_SATURDAY,  "2002 01 01 Sat", nullptr),
     new Test1684Data(2001,12,30, /*2002, 1,  6,*/  2002,1,1,UCAL_SUNDAY,    "2002 01 01 Sun", "2001 12 06 Sun")
   };
 
@@ -1493,7 +1493,7 @@ void DateFormatRegressionTest::TestParsing(void) {
     }
 
     Calendar *cal = new GregorianCalendar(status);
-    if (cal == NULL || U_FAILURE(status)) {
+    if (cal == nullptr || U_FAILURE(status)) {
         errln("Unable to create calendar - %s", u_errorName(status));
         return;
     }
@@ -1641,7 +1641,7 @@ void DateFormatRegressionTest::TestT10619(void) {
         { "en",     true,       UnicodeString("6 Jan 08 2008"), UnicodeString("eee MMM dd yyyy"),   UnicodeString("Sat Jan 08 2008") },
         { "en",     false,      UnicodeString("6 Jan 09 2008"), UnicodeString("eee MMM dd yyyy"),   UnicodeString("") },
         // terminator
-        { NULL,     true,       UnicodeString(""),              UnicodeString(""),                  UnicodeString("") }                
+        { nullptr,     true,       UnicodeString(""),              UnicodeString(""),                  UnicodeString("") }                
     };
     UErrorCode status = U_ZERO_ERROR;
     Calendar* cal = Calendar::createInstance(status);
@@ -1650,7 +1650,7 @@ void DateFormatRegressionTest::TestT10619(void) {
     } else {
         cal->setTime(july022008, status);
         const TestDateFormatLeniencyItem * itemPtr;
-        for (itemPtr = items; itemPtr->locale != NULL; itemPtr++ ) {
+        for (itemPtr = items; itemPtr->locale != nullptr; itemPtr++ ) {
                                             
             Locale locale = Locale::createFromName(itemPtr->locale);
             status = U_ZERO_ERROR;
index 8fe7b17c3053e8e9d1eb8834cf063131e0f68e1e..cbad61a6ef8203365f98f9ce2c3bf714f19450bb 100644 (file)
@@ -238,7 +238,7 @@ void DateFormatRoundTripTest::test(const Locale& loc)
         if(TEST_TABLE[itable++]) {
             logln("Testing style " + UnicodeString(styleName((DateFormat::EStyle)style)));
             DateFormat *df = DateFormat::createDateInstance((DateFormat::EStyle)style, loc);
-            if(df == NULL) {
+            if(df == nullptr) {
               errln(UnicodeString("Could not DF::createDateInstance ") + UnicodeString(styleName((DateFormat::EStyle)style)) +      " Locale: " + loc.getDisplayName(temp));
             } else {
               test(df, loc);
@@ -251,7 +251,7 @@ void DateFormatRoundTripTest::test(const Locale& loc)
         if (TEST_TABLE[itable++]) {
             logln("Testing style " + UnicodeString(styleName((DateFormat::EStyle)style)));
             DateFormat *df = DateFormat::createTimeInstance((DateFormat::EStyle)style, loc);
-            if(df == NULL) {
+            if(df == nullptr) {
               errln(UnicodeString("Could not DF::createTimeInstance ") + UnicodeString(styleName((DateFormat::EStyle)style)) + " Locale: " + loc.getDisplayName(temp));
             } else {
               test(df, loc, true);
@@ -265,7 +265,7 @@ void DateFormatRoundTripTest::test(const Locale& loc)
             if(TEST_TABLE[itable++]) {
                 logln("Testing dstyle" + UnicodeString(styleName((DateFormat::EStyle)dstyle)) + ", tstyle" + UnicodeString(styleName((DateFormat::EStyle)tstyle)) );
                 DateFormat *df = DateFormat::createDateTimeInstance((DateFormat::EStyle)dstyle, (DateFormat::EStyle)tstyle, loc);
-                if(df == NULL) {
+                if(df == nullptr) {
                     dataerrln(UnicodeString("Could not DF::createDateTimeInstance ") + UnicodeString(styleName((DateFormat::EStyle)dstyle)) + ", tstyle" + UnicodeString(styleName((DateFormat::EStyle)tstyle))    + "Locale: " + loc.getDisplayName(temp));
                 } else {
                     test(df, loc);
@@ -286,7 +286,7 @@ void DateFormatRoundTripTest::test(DateFormat *fmt, const Locale &origLocale, UB
     
     UBool isGregorian = false;
     UErrorCode minStatus = U_ZERO_ERROR;
-    if(fmt->getCalendar() == NULL) {
+    if(fmt->getCalendar() == nullptr) {
       errln((UnicodeString)"DateFormatRoundTripTest::test, DateFormat getCalendar() returns null for " + origLocale.getName());
       return;
     } 
index 4f0d8245216353842bcd962a480d59384548e909..6afd92330b4ff384985592a970f4a7943af787e5 100644 (file)
@@ -268,7 +268,7 @@ void DateFormatTest::TestWallyWedel()
     StringEnumeration* ids = TimeZone::createEnumeration(status);
     if (U_FAILURE(status)) {
         dataerrln("Unable to create TimeZone enumeration.");
-        if (sdf != NULL) {
+        if (sdf != nullptr) {
             delete sdf;
         }
         return;
@@ -362,7 +362,7 @@ DateFormatTest::TestEquals()
 {
     DateFormat* fmtA = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::FULL);
     DateFormat* fmtB = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::FULL);
-    if ( fmtA == NULL || fmtB == NULL){
+    if ( fmtA == nullptr || fmtB == nullptr){
         dataerrln("Error calling DateFormat::createDateTimeInstance");
         delete fmtA;
         delete fmtB;
@@ -600,7 +600,7 @@ void DateFormatTest::TestFieldPosition() {
         DateFormat* df = dateFormats[j];
         df->setTimeZone(*PT);
         SimpleDateFormat* sdtfmt = dynamic_cast<SimpleDateFormat*>(df);
-        if (sdtfmt != NULL) {
+        if (sdtfmt != nullptr) {
             logln(" Pattern = " + sdtfmt->toPattern(buf.remove()));
         } else {
             logln(" Pattern = ? (not a SimpleDateFormat)");
@@ -642,7 +642,7 @@ void DateFormatTest::TestFieldPosition() {
     // test null posIter
     buf.remove();
     UErrorCode status = U_ZERO_ERROR;
-    dateFormats[0]->format(aug13, buf, NULL, status);
+    dateFormats[0]->format(aug13, buf, nullptr, status);
     // if we didn't crash, we succeeded.
 
     for (i=0; i<COUNT; ++i) {
@@ -829,7 +829,7 @@ DateFormatTest::TestCzechMonths459()
 {
     UErrorCode status = U_ZERO_ERROR;
     DateFormat* fmt = DateFormat::createDateInstance(DateFormat::FULL, Locale("cs", "", ""));
-    if (fmt == NULL){
+    if (fmt == nullptr){
         dataerrln("Error calling DateFormat::createDateInstance()");
         return;
     }
@@ -912,7 +912,7 @@ DateFormatTest::TestDayOfYearPattern195()
     UDate expected = date(year, month, day);
     logln((UnicodeString)"Test Date: " + dateToString(today));
     SimpleDateFormat* sdf = (SimpleDateFormat*)DateFormat::createDateInstance();
-    if (sdf == NULL){
+    if (sdf == nullptr){
         dataerrln("Error calling DateFormat::createDateInstance()");
         return;
     }
@@ -989,7 +989,7 @@ DateFormatTest::TestBadInput135()
     };
     int32_t strings_length = UPRV_LENGTHOF(strings);
     DateFormat *longFmt = DateFormat::createDateTimeInstance(DateFormat::LONG, DateFormat::MEDIUM, Locale::getEnglish());
-    if(longFmt==NULL) {
+    if(longFmt==nullptr) {
       dataerrln("could not create date time instance");
       return;
     }
@@ -1001,7 +1001,7 @@ DateFormatTest::TestBadInput135()
             for (int32_t k = 0; k < looks_length;++k) {
                 DateFormat::EStyle timeLook = looks[k];
                 DateFormat *df = DateFormat::createDateTimeInstance(dateLook, timeLook);
-                if (df == NULL){
+                if (df == nullptr){
                     dataerrln("Error calling DateFormat::createDateTimeInstance()");
                     continue;
                 }
@@ -1017,7 +1017,7 @@ DateFormatTest::TestBadInput135()
                         UnicodeString format;
                         UnicodeString pattern;
                         SimpleDateFormat* sdtfmt = dynamic_cast<SimpleDateFormat*>(df);
-                        if (sdtfmt != NULL) {
+                        if (sdtfmt != nullptr) {
                             sdtfmt->toPattern(pattern);
                         }
                         longFmt->format(when, format);
@@ -1335,7 +1335,7 @@ DateFormatTest::TestLocaleDateFormat() // Bug 495
     UnicodeString expectedUS ( u"Monday, September 15, 1997 at 12:00:00\u202FAM Pacific Daylight Time", -1 );
     logln((UnicodeString)"Date set to : " + dateToString(testDate));
     UnicodeString out;
-    if (dfUS == NULL || dfFrench == NULL){
+    if (dfUS == nullptr || dfFrench == nullptr){
         dataerrln("Error calling DateFormat::createDateTimeInstance)");
         delete dfUS;
         delete dfFrench;
@@ -1369,7 +1369,7 @@ DateFormatTest::TestFormattingLocaleTimeSeparator()
             DateFormat::SHORT, Locale("ar", "EG")));
 
     const LocalPointer<DateFormat> dfLatn(DateFormat::createTimeInstance(
-            DateFormat::SHORT, Locale("ar", "EG", NULL, "numbers=latn")));
+            DateFormat::SHORT, Locale("ar", "EG", nullptr, "numbers=latn")));
 
     if (dfLatn.isNull() || dfArab.isNull()) {
         dataerrln("Error calling DateFormat::createTimeInstance()");
@@ -1408,14 +1408,14 @@ void DateFormatTest::TestDateFormatCalendar() {
 
     /* Create a formatter for date fields. */
     date = DateFormat::createDateInstance(DateFormat::kShort, Locale::getUS());
-    if (date == NULL) {
+    if (date == nullptr) {
         dataerrln("FAIL: createDateInstance failed");
         goto FAIL;
     }
 
     /* Create a formatter for time fields. */
     time = DateFormat::createTimeInstance(DateFormat::kShort, Locale::getUS());
-    if (time == NULL) {
+    if (time == nullptr) {
         errln("FAIL: createTimeInstance failed");
         goto FAIL;
     }
@@ -1423,14 +1423,14 @@ void DateFormatTest::TestDateFormatCalendar() {
     /* Create a full format for output */
     full = DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull,
                                               Locale::getUS());
-    if (full == NULL) {
+    if (full == nullptr) {
         errln("FAIL: createInstance failed");
         goto FAIL;
     }
 
     /* Create a calendar */
     cal = Calendar::createInstance(Locale::getUS(), ec);
-    if (cal == NULL || U_FAILURE(ec)) {
+    if (cal == nullptr || U_FAILURE(ec)) {
         errln((UnicodeString)"FAIL: Calendar::createInstance failed with " +
               u_errorName(ec));
         goto FAIL;
@@ -1486,38 +1486,38 @@ void DateFormatTest::TestSpaceParsing() {
     const char* DATA[] = {
         "yyyy MM dd HH:mm:ss",
 
-        // pattern, input, expected parse or NULL if expect parse failure
+        // pattern, input, expected parse or nullptr if expect parse failure
         "MMMM d yy", " 04 05 06",  "2006 04 05 00:00:00",
-        NULL,        "04 05 06",   "2006 04 05 00:00:00",
+        nullptr,        "04 05 06",   "2006 04 05 00:00:00",
 
         "MM d yy",   " 04 05 06",    "2006 04 05 00:00:00",
-        NULL,        "04 05 06",     "2006 04 05 00:00:00",
-        NULL,        "04/05/06",     "2006 04 05 00:00:00",
-        NULL,        "04-05-06",     "2006 04 05 00:00:00",
-        NULL,        "04.05.06",     "2006 04 05 00:00:00",
-        NULL,        "04 / 05 / 06", "2006 04 05 00:00:00",
-        NULL,        "Apr / 05/ 06", "2006 04 05 00:00:00",
-        NULL,        "Apr-05-06",    "2006 04 05 00:00:00",
-        NULL,        "Apr 05, 2006", "2006 04 05 00:00:00",
+        nullptr,        "04 05 06",     "2006 04 05 00:00:00",
+        nullptr,        "04/05/06",     "2006 04 05 00:00:00",
+        nullptr,        "04-05-06",     "2006 04 05 00:00:00",
+        nullptr,        "04.05.06",     "2006 04 05 00:00:00",
+        nullptr,        "04 / 05 / 06", "2006 04 05 00:00:00",
+        nullptr,        "Apr / 05/ 06", "2006 04 05 00:00:00",
+        nullptr,        "Apr-05-06",    "2006 04 05 00:00:00",
+        nullptr,        "Apr 05, 2006", "2006 04 05 00:00:00",
 
         "MMMM d yy", " Apr 05 06", "2006 04 05 00:00:00",
-        NULL,        "Apr 05 06",  "2006 04 05 00:00:00",
-        NULL,        "Apr05 06",   "2006 04 05 00:00:00",
+        nullptr,        "Apr 05 06",  "2006 04 05 00:00:00",
+        nullptr,        "Apr05 06",   "2006 04 05 00:00:00",
 
         "hh:mm:ss a", "12:34:56 PM", "1970 01 01 12:34:56",
-        NULL,         "12:34:56PM",  "1970 01 01 12:34:56",
-        NULL,         "12.34.56PM",  "1970 01 01 12:34:56",
-        NULL,         "12 : 34 : 56  PM", "1970 01 01 12:34:56",
+        nullptr,         "12:34:56PM",  "1970 01 01 12:34:56",
+        nullptr,         "12.34.56PM",  "1970 01 01 12:34:56",
+        nullptr,         "12 : 34 : 56  PM", "1970 01 01 12:34:56",
 
         "MM d yy 'at' hh:mm:ss a", "04/05/06 12:34:56 PM", "2006 04 05 12:34:56",
 
         "MMMM dd yyyy hh:mm a", "September 27, 1964 21:56 PM", "1964 09 28 09:56:00",
-        NULL,                   "November 4, 2008 0:13 AM",    "2008 11 04 00:13:00",
+        nullptr,                   "November 4, 2008 0:13 AM",    "2008 11 04 00:13:00",
 
         "HH'h'mm'min'ss's'", "12h34min56s", "1970 01 01 12:34:56",
-        NULL,                "12h34mi56s",  "1970 01 01 12:34:56",
-        NULL,                "12h34m56s",   "1970 01 01 12:34:56",
-        NULL,                "12:34:56",    "1970 01 01 12:34:56"
+        nullptr,                "12h34mi56s",  "1970 01 01 12:34:56",
+        nullptr,                "12h34m56s",   "1970 01 01 12:34:56",
+        nullptr,                "12:34:56",    "1970 01 01 12:34:56"
     };
     const int32_t DATA_len = UPRV_LENGTHOF(DATA);
 
@@ -1531,13 +1531,13 @@ void DateFormatTest::TestExactCountFormat() {
     const char* DATA[] = {
         "yyyy MM dd HH:mm:ss",
 
-        // pattern, input, expected parse or NULL if expect parse failure
+        // pattern, input, expected parse or nullptr if expect parse failure
         "HHmmss", "123456", "1970 01 01 12:34:56",
-        NULL,     "12345",  "1970 01 01 01:23:45",
-        NULL,     "1234",   NULL,
-        NULL,     "00-05",  NULL,
-        NULL,     "12-34",  NULL,
-        NULL,     "00+05",  NULL,
+        nullptr,     "12345",  "1970 01 01 01:23:45",
+        nullptr,     "1234",   nullptr,
+        nullptr,     "00-05",  nullptr,
+        nullptr,     "12-34",  nullptr,
+        nullptr,     "00+05",  nullptr,
         "ahhmm",  "PM730",  "1970 01 01 19:30:00",
     };
     const int32_t DATA_len = UPRV_LENGTHOF(DATA);
@@ -1556,7 +1556,7 @@ void DateFormatTest::TestWhiteSpaceParsing() {
 
         // Pattern space run should parse input text space run
         "MM   d yy",   " 04 01 03",    "2003 04 01",
-        NULL,          " 04  01   03 ", "2003 04 01",
+        nullptr,          " 04  01   03 ", "2003 04 01",
     };
     const int32_t DATA_len = UPRV_LENGTHOF(DATA);
 
@@ -1931,11 +1931,11 @@ void DateFormatTest::TestQuarters()
  *
  * followed by test cases, each of which is 3 array elements:
  *
- * [i]   = pattern, or NULL to reuse prior pattern
+ * [i]   = pattern, or nullptr to reuse prior pattern
  * [i+1] = input string
  * [i+2] = expected parse result (parsed with pattern [0])
  *
- * If expect parse failure, then [i+2] should be NULL.
+ * If expect parse failure, then [i+2] should be nullptr.
  */
 void DateFormatTest::expectParse(const char** data, int32_t data_length,
                                  const Locale& loc) {
@@ -1952,14 +1952,14 @@ void DateFormatTest::expectParse(const char** data, int32_t data_length,
         return;
     }
 
-    const char* currentPat = NULL;
+    const char* currentPat = nullptr;
     while (i<data_length) {
         const char* pattern  = data[i++];
         const char* input    = data[i++];
         const char* expected = data[i++];
 
         ec = U_ZERO_ERROR;
-        if (pattern != NULL) {
+        if (pattern != nullptr) {
             fmt.applyPattern(pattern);
             currentPat = pattern;
         }
@@ -1975,7 +1975,7 @@ void DateFormatTest::expectParse(const char** data, int32_t data_length,
         UErrorCode ec2 = U_ZERO_ERROR;
         UDate exp = FAIL;
         UnicodeString expstr(FAIL_STR);
-        if (expected != NULL) {
+        if (expected != nullptr) {
             expstr = expected;
             exp = ref.parse(expstr, ec2);
             if (U_FAILURE(ec2)) {
@@ -2039,7 +2039,7 @@ void DateFormatTest::expect(const char** data, int32_t data_length,
     UnicodeString currentPat;
     while (i<data_length) {
         const char* pattern  = data[i++];
-        if (pattern != NULL) {
+        if (pattern != nullptr) {
             fmt.applyPattern(pattern);
             currentPat = pattern;
         }
@@ -2144,7 +2144,7 @@ void DateFormatTest::expectFormat(const char** data, int32_t data_length,
 
     while (i<data_length) {
         const char* pattern  = data[i++];
-        if (pattern != NULL) {
+        if (pattern != nullptr) {
             fmt.applyPattern(pattern);
             currentPat = pattern;
         }
@@ -2411,29 +2411,29 @@ void DateFormatTest::TestRelative(int daysdelta,
     Locale en("en");
     DateFormat *fullrelative = DateFormat::createDateInstance(DateFormat::kFullRelative, loc);
 
-    if (fullrelative == NULL) {
-        dataerrln("DateFormat::createDateInstance(DateFormat::kFullRelative, %s) returned NULL", loc.getName());
+    if (fullrelative == nullptr) {
+        dataerrln("DateFormat::createDateInstance(DateFormat::kFullRelative, %s) returned nullptr", loc.getName());
         return;
     }
 
     DateFormat *full         = DateFormat::createDateInstance(DateFormat::kFull        , loc);
 
-    if (full == NULL) {
-        errln("DateFormat::createDateInstance(DateFormat::kFull, %s) returned NULL", loc.getName());
+    if (full == nullptr) {
+        errln("DateFormat::createDateInstance(DateFormat::kFull, %s) returned nullptr", loc.getName());
         return;
     }
 
     DateFormat *en_full =         DateFormat::createDateInstance(DateFormat::kFull,         en);
 
-    if (en_full == NULL) {
-        errln("DateFormat::createDateInstance(DateFormat::kFull, en) returned NULL");
+    if (en_full == nullptr) {
+        errln("DateFormat::createDateInstance(DateFormat::kFull, en) returned nullptr");
         return;
     }
 
     DateFormat *en_fulltime =         DateFormat::createDateTimeInstance(DateFormat::kFull,DateFormat::kFull,en);
 
-    if (en_fulltime == NULL) {
-        errln("DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, en) returned NULL");
+    if (en_fulltime == nullptr) {
+        errln("DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, en) returned nullptr");
         return;
     }
 
@@ -2452,7 +2452,7 @@ void DateFormatTest::TestRelative(int daysdelta,
     ASSERT_OK(status);
 
     // calculate the expected string
-    if(expectChars != NULL) {
+    if(expectChars != nullptr) {
         expect = expectChars;
     } else {
         full->format(*c, expect, pos); // expected = normal full
@@ -2498,12 +2498,12 @@ void DateFormatTest::TestRelative(void)
     TestRelative( 0, en, "today");
     TestRelative(-1, en, "yesterday");
     TestRelative( 1, en, "tomorrow");
-    TestRelative( 2, en, NULL);
-    TestRelative( -2, en, NULL);
-    TestRelative( 3, en, NULL);
-    TestRelative( -3, en, NULL);
-    TestRelative( 300, en, NULL);
-    TestRelative( -300, en, NULL);
+    TestRelative( 2, en, nullptr);
+    TestRelative( -2, en, nullptr);
+    TestRelative( 3, en, nullptr);
+    TestRelative( -3, en, nullptr);
+    TestRelative( 300, en, nullptr);
+    TestRelative( -300, en, nullptr);
 }
 
 void DateFormatTest::TestRelativeClone(void)
@@ -2516,7 +2516,7 @@ void DateFormatTest::TestRelativeClone(void)
     Locale loc("en");
     UDate now = Calendar::getNow();
     DateFormat *full = DateFormat::createDateInstance(DateFormat::kFullRelative, loc);
-    if (full == NULL) {
+    if (full == nullptr) {
         dataerrln("FAIL: Can't create Relative date instance");
         return;
     }
@@ -2524,7 +2524,7 @@ void DateFormatTest::TestRelativeClone(void)
     full->format(now, result1, status);
     Format *fullClone = full->clone();
     delete full;
-    full = NULL;
+    full = nullptr;
 
     UnicodeString result2;
     fullClone->format(now, result2, status);
@@ -2546,7 +2546,7 @@ void DateFormatTest::TestHostClone(void)
     Locale loc("en_US@compat=host");
     UDate now = Calendar::getNow();
     DateFormat *full = DateFormat::createDateInstance(DateFormat::kFull, loc);
-    if (full == NULL) {
+    if (full == nullptr) {
         dataerrln("FAIL: Can't create host date instance");
         return;
     }
@@ -2554,7 +2554,7 @@ void DateFormatTest::TestHostClone(void)
     full->format(now, result1, status);
     Format *fullClone = full->clone();
     delete full;
-    full = NULL;
+    full = nullptr;
 
     UnicodeString result2;
     fullClone->format(now, result2, status);
@@ -2585,7 +2585,7 @@ void DateFormatTest::TestHebrewClone(void)
     LocalPointer<Format> fmtClone(fmt->clone());
 
     // free fmt to be sure that fmtClone is independent of fmt.
-    fmt.adoptInstead(NULL);
+    fmt.adoptInstead(nullptr);
 
     UnicodeString result2;
     fmtClone->format(now, result2, status);
@@ -2598,11 +2598,11 @@ void DateFormatTest::TestHebrewClone(void)
 static UBool getActualAndValidLocales(
         const Format &fmt, Locale &valid, Locale &actual) {
     const SimpleDateFormat* dat = dynamic_cast<const SimpleDateFormat*>(&fmt);
-    if (dat == NULL) {
+    if (dat == nullptr) {
         return false;
     }
     const DateFormatSymbols *sym = dat->getDateFormatSymbols();
-    if (sym == NULL) {
+    if (sym == nullptr) {
         return false;
     }
     UErrorCode status = U_ZERO_ERROR;
@@ -2633,7 +2633,7 @@ void DateFormatTest::TestDateFormatSymbolsClone(void)
     LocalPointer<Format> fmtClone(fmt->clone());
 
     // Free fmt to be sure that fmtClone is really independent of fmt.
-    fmt.adoptInstead(NULL);
+    fmt.adoptInstead(nullptr);
     Locale valid2;
     Locale actual2;
     if (!getActualAndValidLocales(*fmtClone, valid2, actual2)) {
@@ -3417,7 +3417,7 @@ void DateFormatTest::TestTimeZoneDisplayName()
         { "en_HK", "Europe/Paris", "2004-01-15T00:00:00Z", "z", "GMT+1", "+1:00"},
         { "en_HK", "Europe/Paris", "2004-07-15T00:00:00Z", "z", "GMT+2", "+2:00"},
 
-        { NULL, NULL, NULL, NULL, NULL, NULL },
+        { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr },
     };
 
     UErrorCode status = U_ZERO_ERROR;
@@ -3545,11 +3545,11 @@ void DateFormatTest::TestRoundtripWithCalendar(void) {
 //        Calendar::createInstance(*tz, Locale("und@calendar=hebrew"), status),
         Calendar::createInstance(*tz, Locale("und@calendar=islamic"), status),
         Calendar::createInstance(*tz, Locale("und@calendar=japanese"), status),
-        NULL
+        nullptr
     };
     if (U_FAILURE(status)) {
         dataerrln("Failed to initialize calendars: %s", u_errorName(status));
-        for (int i = 0; calendars[i] != NULL; i++) {
+        for (int i = 0; calendars[i] != nullptr; i++) {
             delete calendars[i];
         }
         return;
@@ -3565,7 +3565,7 @@ void DateFormatTest::TestRoundtripWithCalendar(void) {
 //        DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale("he_IL@calendar=hebrew")),
         DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale("ar_EG@calendar=islamic")),
 //        DateFormat::createDateTimeInstance(DateFormat::kFull, DateFormat::kFull, Locale("ja_JP@calendar=japanese")),
-        NULL
+        nullptr
     };
 
     UDate d = Calendar::getNow();
@@ -3573,7 +3573,7 @@ void DateFormatTest::TestRoundtripWithCalendar(void) {
     FieldPosition fpos;
     ParsePosition ppos;
 
-    for (int i = 0; formatters[i] != NULL; i++) {
+    for (int i = 0; formatters[i] != nullptr; i++) {
         buf.remove();
         fpos.setBeginIndex(0);
         fpos.setEndIndex(0);
@@ -3584,7 +3584,7 @@ void DateFormatTest::TestRoundtripWithCalendar(void) {
         formatters[i]->format(*calendars[i], buf, fpos);
         UnicodeString refStr(buf);
 
-        for (int j = 0; calendars[j] != NULL; j++) {
+        for (int j = 0; calendars[j] != nullptr; j++) {
             if (j == i) {
                 continue;
             }
@@ -3614,7 +3614,7 @@ void DateFormatTest::TestRoundtripWithCalendar(void) {
         // used by the formatter
         formatters[i]->parse(refStr, *calendars[i], ppos);
 
-        for (int j = 0; calendars[j] != NULL; j++) {
+        for (int j = 0; calendars[j] != nullptr; j++) {
             if (j == i) {
                 continue;
             }
@@ -3647,10 +3647,10 @@ void DateFormatTest::TestRoundtripWithCalendar(void) {
 
     delete tz;
     delete gmt;
-    for (int i = 0; calendars[i] != NULL; i++) {
+    for (int i = 0; calendars[i] != nullptr; i++) {
         delete calendars[i];
     }
-    for (int i = 0; formatters[i] != NULL; i++) {
+    for (int i = 0; formatters[i] != nullptr; i++) {
         delete formatters[i];
     }
 }
@@ -3662,7 +3662,7 @@ void DateFormatTest::TestRelativeError(void)
     Locale en("en");
 
     DateFormat *en_reltime_reldate =         DateFormat::createDateTimeInstance(DateFormat::kFullRelative,DateFormat::kFullRelative,en);
-    if(en_reltime_reldate == NULL) {
+    if(en_reltime_reldate == nullptr) {
         logln("PASS: rel date/rel time failed");
     } else {
         errln("FAIL: rel date/rel time created, should have failed.");
@@ -3785,9 +3785,9 @@ void DateFormatTest::Test6726(void)
     DateFormat* fmtl = DateFormat::createDateTimeInstance(DateFormat::LONG, DateFormat::FULL, loc);
     DateFormat* fmtm = DateFormat::createDateTimeInstance(DateFormat::MEDIUM, DateFormat::FULL, loc);
     DateFormat* fmts = DateFormat::createDateTimeInstance(DateFormat::SHORT, DateFormat::FULL, loc);
-    if (fmtf == NULL || fmtl == NULL || fmtm == NULL || fmts == NULL) {
-        dataerrln("Unable to create DateFormat. got NULL.");
-        /* It may not be true that if one is NULL all is NULL.  Just to be safe. */
+    if (fmtf == nullptr || fmtl == nullptr || fmtm == nullptr || fmts == nullptr) {
+        dataerrln("Unable to create DateFormat. got nullptr.");
+        /* It may not be true that if one is nullptr all is nullptr.  Just to be safe. */
         delete fmtf;
         delete fmtl;
         delete fmtm;
@@ -3877,8 +3877,8 @@ void DateFormatTest::Test6880() {
     }
 
     DateFormat *fmt = DateFormat::createTimeInstance(DateFormat::kFull, Locale("zh"));
-    if (fmt == NULL) {
-        dataerrln("Unable to create DateFormat. Got NULL.");
+    if (fmt == nullptr) {
+        dataerrln("Unable to create DateFormat. Got nullptr.");
         return;
     }
     fmt->adoptTimeZone(tz);
@@ -3937,10 +3937,10 @@ void DateFormatTest::TestNumberAsStringParsing()
         { "ko", true,  false, CharsToUnicodeString("y\\uB144 M\\uC6D4 d\\uC77C"), CharsToUnicodeString("2009\\uB144 7\\uC6D4 14\\uC77C") },
         { "ko", false, false, CharsToUnicodeString("y\\uB144 MMM d\\uC77C"),      CharsToUnicodeString("2009\\uB144 7\\uC6D4 14\\uC77C") },
         { "ko", true,  false, CharsToUnicodeString("y\\uB144 MMM d\\uC77C"),      CharsToUnicodeString("2009\\uB144 7\\uC6D4 14\\uC77C") }, // #8820 fixes test failure
-        { NULL, false, false, UnicodeString(""),                                  UnicodeString("")                   }
+        { nullptr, false, false, UnicodeString(""),                                  UnicodeString("")                   }
     };
     const NumAsStringItem * itemPtr;
-    for (itemPtr = items; itemPtr->localeStr != NULL; itemPtr++ ) {
+    for (itemPtr = items; itemPtr->localeStr != nullptr; itemPtr++ ) {
         Locale locale = Locale::createFromName(itemPtr->localeStr);
         UErrorCode status = U_ZERO_ERROR;
         SimpleDateFormat formatter(itemPtr->datePattern, locale, status);
@@ -3989,7 +3989,7 @@ void DateFormatTest::TestISOEra() {
     SimpleDateFormat *fmt1 = new SimpleDateFormat(UnicodeString("GGG yyyy-MM-dd'T'HH:mm:ss'Z"), status);
     failure(status, "new SimpleDateFormat", true);
     if (status == U_MISSING_RESOURCE_ERROR) {
-        if (fmt1 != NULL) {
+        if (fmt1 != nullptr) {
             delete fmt1;
         }
         return;
@@ -4187,7 +4187,7 @@ void DateFormatTest::TestMonthPatterns()
                                                             CharsToUnicodeString("29. 4. 2."),
                                                             CharsToUnicodeString("29. 5. 1.") } },
         // terminator
-        { NULL,                       0,                  { UnicodeString(""), UnicodeString(""), UnicodeString("") } }
+        { nullptr,                       0,                  { UnicodeString(""), UnicodeString(""), UnicodeString("") } }
     };
 
     //.                               style: -1        -2            -3       -4
@@ -4198,12 +4198,12 @@ void DateFormatTest::TestMonthPatterns()
     Calendar * rootChineseCalendar = Calendar::createInstance(rootChineseCalLocale, status);
     if (U_SUCCESS(status)) {
         const MonthPatternItem * itemPtr;
-        for (itemPtr = items; itemPtr->locale != NULL; itemPtr++ ) {
+        for (itemPtr = items; itemPtr->locale != nullptr; itemPtr++ ) {
             Locale locale = Locale::createFromName(itemPtr->locale);
             DateFormat * dmft = (itemPtr->style >= 0)?
                     DateFormat::createDateInstance((DateFormat::EStyle)itemPtr->style, locale):
                     new SimpleDateFormat(customPatterns[-itemPtr->style - 1], locale, status);
-            if ( dmft != NULL ) {
+            if ( dmft != nullptr ) {
                 if (U_SUCCESS(status)) {
                     const ChineseCalTestDate * datePtr = dates;
                     int32_t idate;
@@ -4280,7 +4280,7 @@ void DateFormatTest::TestContext()
         { "cs", UnicodeString("LLLL y"), UDISPCTX_CAPITALIZATION_FOR_STANDALONE,            CharsToUnicodeString("\\u010Dervenec 2008") },
 #endif
         // terminator
-        { NULL, UnicodeString(""),       (UDisplayContext)0, UnicodeString("") }
+        { nullptr, UnicodeString(""),       (UDisplayContext)0, UnicodeString("") }
     };
     UErrorCode status = U_ZERO_ERROR;
     Calendar* cal = Calendar::createInstance(status);
@@ -4289,7 +4289,7 @@ void DateFormatTest::TestContext()
     } else {
         cal->setTime(july022008, status);
         const TestContextItem * itemPtr;
-        for (itemPtr = items; itemPtr->locale != NULL; itemPtr++ ) {
+        for (itemPtr = items; itemPtr->locale != nullptr; itemPtr++ ) {
            Locale locale = Locale::createFromName(itemPtr->locale);
            status = U_ZERO_ERROR;
            SimpleDateFormat * sdmft = new SimpleDateFormat(itemPtr->pattern, locale, status);
@@ -4381,10 +4381,10 @@ void DateFormatTest::TestNonGregoFmtParse()
         { "ja@calendar=japanese", DateFormat::kNone, CharsToUnicodeString("r(Gy)\\u5E74M\\u6708d\\u65E5"), cafti_ja_japanese_custGy },
         { "ja@calendar=japanese", DateFormat::kNone, CharsToUnicodeString("r\\u5E74M\\u6708d\\u65E5"),     cafti_ja_japanese_custNoGy },
         { "en@calendar=islamic",  DateFormat::kNone, UnicodeString("d MMM y G, r"),     cafti_en_islamic_cust },
-        { NULL, DateFormat::kNone, UnicodeString(""), NULL } // terminator
+        { nullptr, DateFormat::kNone, UnicodeString(""), nullptr } // terminator
     };
     const TestNonGregoItem * itemPtr;
-    for (itemPtr = items; itemPtr->locale != NULL; itemPtr++) {
+    for (itemPtr = items; itemPtr->locale != nullptr; itemPtr++) {
         Locale locale = Locale::createFromName(itemPtr->locale);
         LocalPointer<DateFormat> dfmt;
         UErrorCode status = U_ZERO_ERROR;
@@ -4457,10 +4457,10 @@ void DateFormatTest::TestFormatsWithNumberSystems()
         { "zh@calendar=chinese",      DateFormat::kLong, CharsToUnicodeString("rU\\u5E74MMMd"), CharsToUnicodeString("2015\\u4E59\\u672A\\u5E74\\u5341\\u4E00\\u6708\\u5EFF\\u4E00") },
         { "zh_Hant@calendar=chinese", DateFormat::kLong, CharsToUnicodeString("rU\\u5E74MMMd"), CharsToUnicodeString("2015\\u4E59\\u672A\\u5E74\\u51AC\\u6708\\u5EFF\\u4E00") },
         { "ja@calendar=chinese", DateFormat::kLong, CharsToUnicodeString("U\\u5E74MMMd\\u65E5"), CharsToUnicodeString("\\u4E59\\u672A\\u5E74\\u5341\\u4E00\\u6708\\u4E8C\\u4E00\\u65E5") },
-        { NULL, DateFormat::kNone, UnicodeString(""), UnicodeString("") },
+        { nullptr, DateFormat::kNone, UnicodeString(""), UnicodeString("") },
     };
     const TestFmtWithNumSysItem * itemPtr;
-    for (itemPtr = items; itemPtr->localeID != NULL; itemPtr++) {
+    for (itemPtr = items; itemPtr->localeID != nullptr; itemPtr++) {
         char bExpected[kBBufMax];
         char bResult[kBBufMax];
         UErrorCode status = U_ZERO_ERROR;
@@ -4481,7 +4481,7 @@ void DateFormatTest::TestFormatsWithNumberSystems()
             continue;
         }
         UnicodeString getFormat;
-        sdfmt->format(*(cal.getAlias()), getFormat, NULL, status);
+        sdfmt->format(*(cal.getAlias()), getFormat, nullptr, status);
         if (U_FAILURE(status)) {
             errln("DateFormat::format fails for locale %s, status %s", itemPtr->localeID, u_errorName(status));
             continue;
@@ -4589,7 +4589,7 @@ void DateFormatTest::TestDateFormatLeniency() {
         { "en",     true,       UnicodeString("2008-Jan--02"),  UnicodeString("yyyy-MMM' -- 'dd"),  UnicodeString("2008-Jan -- 02") },
         { "en",     false,      UnicodeString("2008-Jan--02"),  UnicodeString("yyyy-MMM' -- 'dd"),  UnicodeString("") },
         // terminator
-        { NULL,     true,       UnicodeString(""),              UnicodeString(""),                  UnicodeString("") }
+        { nullptr,     true,       UnicodeString(""),              UnicodeString(""),                  UnicodeString("") }
     };
     UErrorCode status = U_ZERO_ERROR;
     LocalPointer<Calendar> cal(Calendar::createInstance(status));
@@ -4600,7 +4600,7 @@ void DateFormatTest::TestDateFormatLeniency() {
     cal->setTime(july022008, status);
     const TestDateFormatLeniencyItem * itemPtr;
     LocalPointer<SimpleDateFormat> sdmft;
-    for (itemPtr = items; itemPtr->locale != NULL; itemPtr++ ) {
+    for (itemPtr = items; itemPtr->locale != nullptr; itemPtr++ ) {
 
        Locale locale = Locale::createFromName(itemPtr->locale);
        status = U_ZERO_ERROR;
@@ -4698,7 +4698,7 @@ void DateFormatTest::TestParseMultiPatternMatch() {
     }
     const TestMultiPatternMatchItem * itemPtr;
     DateFormat* sdmft = DateFormat::createDateInstance();
-    if (sdmft == NULL) {
+    if (sdmft == nullptr) {
         dataerrln(UnicodeString("FAIL: Unable to create DateFormat"));
         return;
     }
@@ -4743,7 +4743,7 @@ void DateFormatTest::TestParseLeniencyAPIs() {
     UErrorCode status = U_ZERO_ERROR;
     LocalPointer<DateFormat> dateFormat(DateFormat::createDateInstance());
     DateFormat *fmt = dateFormat.getAlias();
-    if (fmt == NULL) {
+    if (fmt == nullptr) {
         dataerrln("Failed calling dateFormat.getAlias()");
         return;
     }
index 1e4f1d75af7d81b52619ecbd920ec93a5f3aa4cd..278f878b5587a2a79ceeb96c1fe1f8f191727d77 100644 (file)
@@ -1782,9 +1782,9 @@ void DateIntervalFormatTest::testTicket11985() {
 // Ticket 11669 - thread safety of DateIntervalFormat::format(). This test failed before
 //                the implementation was fixed.
 
-static const DateIntervalFormat *gIntervalFormatter = NULL;      // The Formatter to be used concurrently by test threads.
-static const DateInterval *gInterval = NULL;                     // The date interval to be formatted concurrently.
-static const UnicodeString *gExpectedResult = NULL;
+static const DateIntervalFormat *gIntervalFormatter = nullptr;      // The Formatter to be used concurrently by test threads.
+static const DateInterval *gInterval = nullptr;                     // The date interval to be formatted concurrently.
+static const UnicodeString *gExpectedResult = nullptr;
 
 void DateIntervalFormatTest::threadFunc11669(int32_t threadNum) {
     (void)threadNum;
@@ -1834,9 +1834,9 @@ void DateIntervalFormatTest::testTicket11669() {
     threads.start();
     threads.join();
 
-    gInterval = NULL;             // Don't leave dangling pointers lying around. Not strictly necessary.
-    gIntervalFormatter = NULL;
-    gExpectedResult = NULL;
+    gInterval = nullptr;             // Don't leave dangling pointers lying around. Not strictly necessary.
+    gIntervalFormatter = nullptr;
+    gExpectedResult = nullptr;
 }
 
 
index bced7292ed09bd5c804b2f5eeab61b25165b11d3..12ee7b4e227be627d99e5f6721b36f10293b0dd0 100644 (file)
@@ -25,7 +25,7 @@ U_NAMESPACE_END
  * Test basic functionality of various API functions
  **/
 class DateIntervalFormatTest: public IntlTestWithFieldPosition {
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
 public:
     /**
index 6c5acef2348ee228701b6efcb5548af48f17bc46..cad25502d63e5e44e949d3cf3c56aa4f57bc8cb3 100644 (file)
@@ -506,7 +506,7 @@ void IntlTestDateTimePatternGeneratorAPI::testAPI(/*char *par*/)
         return;
     }
     TimeZone *zone = TimeZone::createTimeZone(UnicodeString("ECT"));
-    if (zone==NULL) {
+    if (zone==nullptr) {
         dataerrln("ERROR: Could not create TimeZone ECT");
         delete gen;
         delete format;
@@ -746,7 +746,7 @@ void IntlTestDateTimePatternGeneratorAPI::testAPI(/*char *par*/)
             return;
         }
         TimeZone *enZone = TimeZone::createTimeZone(UnicodeString("ECT/GMT"));
-        if (enZone==NULL) {
+        if (enZone==nullptr) {
             dataerrln("ERROR: Could not create TimeZone ECT");
             delete patGen;
             return;
@@ -824,13 +824,13 @@ void IntlTestDateTimePatternGeneratorAPI::testAPI(/*char *par*/)
     testPattern=test->getBestPattern(UnicodeString("MMMMdd"), status);
     conflictingStatus = test->addPattern(UnicodeString("HH:mm"), true, conflictingPattern, status);
     conflictingStatus = test->addPattern(UnicodeString("MMMMMdd"), true, conflictingPattern, status); //duplicate pattern
-    StringEnumeration *output=NULL;
+    StringEnumeration *output=nullptr;
     output = test->getRedundants(status);
     expectedResult=UnicodeString("MMMMd");
-    if (output != NULL) {
+    if (output != nullptr) {
         output->reset(status);
         const UnicodeString *dupPattern=output->snext(status);
-        if ( (dupPattern==NULL) || (*dupPattern != expectedResult) ) {
+        if ( (dupPattern==nullptr) || (*dupPattern != expectedResult) ) {
             errln("ERROR: Fail in getRedundants !\n");
         }
     }
@@ -1018,7 +1018,7 @@ void IntlTestDateTimePatternGeneratorAPI::testAllFieldPatterns(/*char *par*/)
         "en",
         "en@calendar=japanese",
         "en@calendar=chinese",
-        NULL // terminator
+        nullptr // terminator
     };
     AllFieldsTestItem testData[] = {
         //pat   fieldLengths    generated pattern must
@@ -1077,7 +1077,7 @@ void IntlTestDateTimePatternGeneratorAPI::testAllFieldPatterns(/*char *par*/)
 
     const char ** localeNamesPtr = localeNames;
     const char * localeName;
-    while ( (localeName = *localeNamesPtr++) != NULL) {
+    while ( (localeName = *localeNamesPtr++) != nullptr) {
         UErrorCode status = U_ZERO_ERROR;
         Locale locale = Locale::createFromName(localeName);
         DateTimePatternGenerator * dtpg = DateTimePatternGenerator::createInstance(locale, status);
@@ -1188,7 +1188,7 @@ void IntlTestDateTimePatternGeneratorAPI::testC() {
     for (int32_t i = 0; i < numTests; ++i) {
         DateTimePatternGenerator *gen = DateTimePatternGenerator::createInstance(
                 Locale::forLanguageTag(tests[i][0], status), status);
-        if (gen == NULL) {
+        if (gen == nullptr) {
             dataerrln("FAIL: DateTimePatternGenerator::createInstance failed for %s", tests[i][0]);
             return;
         }
@@ -1373,7 +1373,7 @@ void IntlTestDateTimePatternGeneratorAPI::testJjMapping() {
             continue;
         }
         const SimpleDateFormat* sdfmt;
-        if ((sdfmt = dynamic_cast<const SimpleDateFormat*>(reinterpret_cast<const DateFormat*>(dfmt.getAlias()))) == NULL) {
+        if ((sdfmt = dynamic_cast<const SimpleDateFormat*>(reinterpret_cast<const DateFormat*>(dfmt.getAlias()))) == nullptr) {
             continue;
         }
         UnicodeString shortPattern;
@@ -1615,7 +1615,7 @@ void IntlTestDateTimePatternGeneratorAPI::testBestPattern() {
             LocalPointer<DateFormat> df(DateFormat::createDateInstance(DateFormat::kFull, testCases[i].localeID));
             SimpleDateFormat* sdf = dynamic_cast<SimpleDateFormat*>(df.getAlias());
             
-            if (sdf != NULL) {
+            if (sdf != nullptr) {
                 sdf->toPattern(actualPattern);
             }
         }
index 30083f1b8b50b523cf08857929b69da2a83901e3..61699865ed8708bdd72f245a38bcb13aa774e88f 100644 (file)
@@ -21,7 +21,7 @@
  * Test basic functionality of various API functions
  **/
 class IntlTestDateTimePatternGeneratorAPI : public IntlTest {
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
 private:
     /**
index 0b4d3f495ae0489f14d5a7a1cd3187dfc74a0555..9ad96c1035db02b233a580cde058b639de60ab14 100644 (file)
@@ -30,7 +30,7 @@ public:
 
     CollationEnglishTest();
     virtual ~CollationEnglishTest();
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     // performs test with strength PRIMARY
     void TestPrimary(/* char* par */);
index 1cd4d719659199e8b339f75efd23c1399ebf66a1..6bed403342995a3c9b800a34c646260661d3f4ec 100644 (file)
@@ -44,10 +44,10 @@ void EraRulesTest::testAPIs() {
         "persian",
         "roc",
         //"unknown",
-        NULL
+        nullptr
     };
 
-    for (int32_t i = 0; calTypes[i] != NULL; i++) {
+    for (int32_t i = 0; calTypes[i] != nullptr; i++) {
         UErrorCode status = U_ZERO_ERROR;
         const char *calId = calTypes[i];
 
index f8eb7c24277f9a6e3df8f6457a0944133b0fe433..05436883b476ff0eefc43fadf5d78f845746602c 100644 (file)
@@ -12,7 +12,7 @@
 
 class EraRulesTest : public IntlTest {
 public:
-    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = nullptr) override;
 
 private:
     void testAPIs();
index b2885636aa9786f35d6c4431dc21d3c7fec29ffb..d4b79b0ba8f285684dcd739709306b6eb649efa7 100644 (file)
@@ -30,7 +30,7 @@ public:
 
     CollationSpanishTest();
     virtual ~CollationSpanishTest();
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     // performs tests with strength PRIMARY
     void TestPrimary(/* char* par */);
index 1346e45b21bdc73337bf6a589ae325ed34015d7d..2f8c0a6fe6a87b99b61667d19c9f182e631ae797 100644 (file)
@@ -29,7 +29,7 @@ public:
 
     CollationFinnishTest();
     virtual ~CollationFinnishTest();
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     // perform tests with strength PRIMARY
     void TestPrimary(/* char* par */);
index 4486e3a1f1a06a71e1271d1499af1d134a48dc1d..5415531e0e880c911401ca89f2c0afb06b4b7877 100644 (file)
@@ -210,7 +210,7 @@ void FieldsSet::parseValueDefault(const FieldsSet* inheritFrom, int32_t field, c
     int32_t value = -1;
     if(substr.length()==0) { // inherit requested
         // inherit
-        if((inheritFrom == NULL) || !inheritFrom->isSet((UCalendarDateFields)field)) {
+        if((inheritFrom == nullptr) || !inheritFrom->isSet((UCalendarDateFields)field)) {
             // couldn't inherit from field 
             it_errln(UnicodeString("Parse Failed: Couldn't inherit field ") + field + UnicodeString(" [") + UnicodeString(udbg_enumName(fEnum, field)) + UnicodeString("]"));
             status = U_ILLEGAL_ARGUMENT_ERROR;
index 49d14791b3afd2aad937f076e99d380c655c26c1..1cdddb76ba394826d6ea41490710d60f60e4fb6e 100644 (file)
@@ -66,7 +66,7 @@ class FieldsSet {
        * @return the number of valid parsed fields on success, or a negative number on failure.
        */
       int32_t parseFrom(const U_NAMESPACE_QUALIFIER UnicodeString& str, UErrorCode& status) {
-          return parseFrom(str,NULL,status);
+          return parseFrom(str,nullptr,status);
       }
 
       /**
index d427d191c5519ca3f2817d8d880a90a2437d02ea..e9bf31e316e3b4185d56a2e4051453202882ba4e 100644 (file)
@@ -35,7 +35,7 @@ CollationFrenchTest::CollationFrenchTest()
         errcheckln(status, __FILE__ "failed to create! err " + UnicodeString(u_errorName(status)));
         /* if it wasn't already: */
         delete myCollation;
-        myCollation = NULL;
+        myCollation = nullptr;
     }
 }
 
index 3299b99135310521901a21a5b87749bdaa167384..70ca87d1f0ccc46db80dce19bd8fff0b5cceac63 100644 (file)
@@ -28,7 +28,7 @@ public:
 
     CollationFrenchTest();
     virtual ~CollationFrenchTest();
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     // perform tests with strength SECONDARY
     void TestSecondary(/* char* par */);
index ade87247aee19c35a1e6a69fbd91f849b9465b96..b45a455e7aa9f2ec8ee4db419fa47160762180d5 100644 (file)
@@ -52,7 +52,7 @@ public:
 
     G7CollationTest() {}
     virtual ~G7CollationTest();
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
 
     // perform test for G7 locales
index d62debbead2c199650a9554613077a383676f1f5..8178fdefa0322e9f23152f18f409b89f87dedc07 100644 (file)
@@ -55,7 +55,7 @@ void GenderInfoTest::runIndexedTest(int32_t index, UBool exec, const char *&name
 }
 
 void GenderInfoTest::TestGetListGender() {
-    check(UGENDER_OTHER, UGENDER_OTHER, UGENDER_OTHER, NULL, 0);
+    check(UGENDER_OTHER, UGENDER_OTHER, UGENDER_OTHER, nullptr, 0);
     check(UGENDER_FEMALE, UGENDER_FEMALE, UGENDER_FEMALE, kSingleFemale, UPRV_LENGTHOF(kSingleFemale));
     check(UGENDER_MALE, UGENDER_MALE, UGENDER_MALE, kSingleMale, UPRV_LENGTHOF(kSingleMale));
     check(UGENDER_OTHER, UGENDER_OTHER, UGENDER_OTHER, kSingleOther, UPRV_LENGTHOF(kSingleOther));
index 89069e8835eb45c5e1e4333f1aeb467991b76e1e..6e35dabd386ecde0b28f053902d2876caf261d9e 100644 (file)
@@ -114,20 +114,20 @@ const char Integer::fgClassID = '\0';
 class TestIntegerService : public ICUService {
     public:
     ICUServiceKey* createKey(const UnicodeString* id, UErrorCode& status) const override {
-        return LocaleKey::createWithCanonicalFallback(id, NULL, status); // no fallback locale
+        return LocaleKey::createWithCanonicalFallback(id, nullptr, status); // no fallback locale
     }
 
     virtual ICUServiceFactory* createSimpleFactory(UObject* obj, const UnicodeString& id, UBool visible, UErrorCode& status) override
     {
         Integer* i;
-        if (U_SUCCESS(status) && obj && (i = dynamic_cast<Integer*>(obj)) != NULL) {
+        if (U_SUCCESS(status) && obj && (i = dynamic_cast<Integer*>(obj)) != nullptr) {
             return new SimpleFactory(i, id, visible);
         }
-        return NULL;
+        return nullptr;
     }
 
     virtual UObject* cloneInstance(UObject* instance) const override {
-        return instance ? new Integer(*(Integer*)instance) : NULL;
+        return instance ? new Integer(*(Integer*)instance) : nullptr;
     }
 };
 
@@ -157,17 +157,17 @@ char* /*par*/)
 UnicodeString append(UnicodeString& result, const UObject* obj) 
 {
     char buffer[128];
-    if (obj == NULL) {
-        result.append("NULL");
+    if (obj == nullptr) {
+        result.append("nullptr");
     } else {
         const UnicodeString* s;
         const Locale* loc;
         const Integer* i;
-        if ((s = dynamic_cast<const UnicodeString*>(obj)) != NULL) {
+        if ((s = dynamic_cast<const UnicodeString*>(obj)) != nullptr) {
             result.append(*s);
-        } else if ((loc = dynamic_cast<const Locale*>(obj)) != NULL) {
+        } else if ((loc = dynamic_cast<const Locale*>(obj)) != nullptr) {
             result.append(loc->getName());
-        } else if ((i = dynamic_cast<const Integer*>(obj)) != NULL) {
+        } else if ((i = dynamic_cast<const Integer*>(obj)) != nullptr) {
             snprintf(buffer, sizeof(buffer), "%d", (int)i->_val);
             result.append(buffer);
         } else {
@@ -203,9 +203,9 @@ ICUServiceTest::confirmBoolean(const UnicodeString& message, UBool val)
 void
 ICUServiceTest::confirmEqual(const UnicodeString& message, const UObject* lhs, const UObject* rhs) 
 {
-    UBool equ = (lhs == NULL)
-        ? (rhs == NULL)
-        : (rhs != NULL && lhs->operator==(*rhs));
+    UBool equ = (lhs == nullptr)
+        ? (rhs == nullptr)
+        : (rhs != nullptr && lhs->operator==(*rhs));
 
     UnicodeString temp;
     lrmsg(temp, message, lhs, rhs);
@@ -220,9 +220,9 @@ ICUServiceTest::confirmEqual(const UnicodeString& message, const UObject* lhs, c
 void
 ICUServiceTest::confirmEqual(const UnicodeString& message, const Integer* lhs, const Integer* rhs) 
 {
-    UBool equ = (lhs == NULL)
-        ? (rhs == NULL)
-        : (rhs != NULL && lhs->operator==(*rhs));
+    UBool equ = (lhs == nullptr)
+        ? (rhs == nullptr)
+        : (rhs != nullptr && lhs->operator==(*rhs));
 
     UnicodeString temp;
     lrmsg(temp, message, lhs, rhs);
@@ -237,9 +237,9 @@ ICUServiceTest::confirmEqual(const UnicodeString& message, const Integer* lhs, c
 void
 ICUServiceTest::confirmEqual(const UnicodeString& message, const UnicodeString* lhs, const UnicodeString* rhs) 
 {
-    UBool equ = (lhs == NULL)
-        ? (rhs == NULL)
-        : (rhs != NULL && lhs->operator==(*rhs));
+    UBool equ = (lhs == nullptr)
+        ? (rhs == nullptr)
+        : (rhs != nullptr && lhs->operator==(*rhs));
 
     UnicodeString temp;
     lrmsg(temp, message, lhs, rhs);
@@ -254,9 +254,9 @@ ICUServiceTest::confirmEqual(const UnicodeString& message, const UnicodeString*
 void
 ICUServiceTest::confirmEqual(const UnicodeString& message, const Locale* lhs, const Locale* rhs) 
 {
-    UBool equ = (lhs == NULL)
-        ? (rhs == NULL)
-        : (rhs != NULL && lhs->operator==(*rhs));
+    UBool equ = (lhs == nullptr)
+        ? (rhs == nullptr)
+        : (rhs != nullptr && lhs->operator==(*rhs));
 
     UnicodeString temp;
     lrmsg(temp, message, lhs, rhs);
@@ -319,7 +319,7 @@ ICUServiceTest::msgstr(const UnicodeString& message, UObject* obj, UBool err)
         logln(message + *str);
         delete str;
     } else if (err) {
-        errln("Error " + message + "string is NULL");
+        errln("Error " + message + "string is nullptr");
     }
 }
 
@@ -420,7 +420,7 @@ ICUServiceTest::testAPI_One()
     {
         UErrorCode status = U_ZERO_ERROR;
         Integer* result = (Integer*)service.get("foo", status);
-        confirmIdentical("13) foo -> null", result, NULL);
+        confirmIdentical("13) foo -> null", result, nullptr);
         delete result;
     }
 
@@ -484,34 +484,34 @@ public:
                 // have to implement cloneInstance.  Otherwise we could just tell the service
                 // what the object type is when we create it, and the default implementation
                 // could handle everything for us.  Phooey.
-        if (obj && dynamic_cast<UnicodeString*>(obj) != NULL) {
+        if (obj && dynamic_cast<UnicodeString*>(obj) != nullptr) {
                         return ICUService::createSimpleFactory(obj, id, visible, status);
         }
-        return NULL;
+        return nullptr;
     }
 
     virtual UObject* cloneInstance(UObject* instance) const override {
-        return instance ? new UnicodeString(*(UnicodeString*)instance) : NULL;
+        return instance ? new UnicodeString(*(UnicodeString*)instance) : nullptr;
     }
 };
 
 class TestStringService : public ICUService {
     public:
     ICUServiceKey* createKey(const UnicodeString* id, UErrorCode& status) const override {
-        return LocaleKey::createWithCanonicalFallback(id, NULL, status); // no fallback locale
+        return LocaleKey::createWithCanonicalFallback(id, nullptr, status); // no fallback locale
     }
 
   virtual ICUServiceFactory* createSimpleFactory(UObject* obj, const UnicodeString& id, UBool visible, UErrorCode& /* status */) override
     {
         UnicodeString* s;
-        if (obj && (s = dynamic_cast<UnicodeString*>(obj)) != NULL) {
+        if (obj && (s = dynamic_cast<UnicodeString*>(obj)) != nullptr) {
             return new SimpleFactory(s, id, visible);
         }
-        return NULL;
+        return nullptr;
     }
 
     virtual UObject* cloneInstance(UObject* instance) const override {
-        return instance ? new UnicodeString(*(UnicodeString*)instance) : NULL;
+        return instance ? new UnicodeString(*(UnicodeString*)instance) : nullptr;
     }
 };
 
@@ -567,7 +567,7 @@ class TestMultipleKeyStringFactory : public ICUServiceFactory {
 
     UObject* create(const ICUServiceKey& key, const ICUService* /* service */, UErrorCode& status) const override {
         if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
         }
         UnicodeString temp;
         key.currentID(temp);
@@ -578,7 +578,7 @@ class TestMultipleKeyStringFactory : public ICUServiceFactory {
         } else {
         status = _status;
     }
-        return NULL;
+        return nullptr;
     }
 
     void updateVisibleIDs(Hashtable& result, UErrorCode& status) const override {
@@ -593,7 +593,7 @@ class TestMultipleKeyStringFactory : public ICUServiceFactory {
         if (U_SUCCESS(_status) && _ids.contains((void*)&id)) {
             char buffer[128];
             UErrorCode status = U_ZERO_ERROR;
-            int32_t len = id.extract(buffer, sizeof(buffer), NULL, status);
+            int32_t len = id.extract(buffer, sizeof(buffer), nullptr, status);
             if (U_SUCCESS(status)) {
                 if (len == sizeof(buffer)) {
                     --len;
@@ -663,7 +663,7 @@ ICUServiceTest::testAPI_Two()
     {
         UErrorCode status = U_ZERO_ERROR;
         UnicodeString* result = (UnicodeString*)service.get("en_US", status);
-        confirmIdentical("24) empty", result, NULL);
+        confirmIdentical("24) empty", result, nullptr);
     }
 
     // create a custom multiple key factory
@@ -758,7 +758,7 @@ ICUServiceTest::testAPI_Two()
         UnicodeString actualID;
         UnicodeString id = "en_us_surfer_gal";
         UnicodeString* gal = (UnicodeString*)service.get(id, &actualID, status);
-        if (gal != NULL) {
+        if (gal != nullptr) {
             UnicodeString displayName;
             logln("actual id: " + actualID);
             service.getDisplayName(actualID, displayName, Locale::getEnglish());
@@ -781,7 +781,7 @@ ICUServiceTest::testAPI_Two()
         UnicodeString actualID;
         UnicodeString id = "en_US_SURFER_BOZO";
         UnicodeString* bozo = (UnicodeString*)service.get(id, &actualID, status);
-        if (bozo != NULL) {
+        if (bozo != nullptr) {
             UnicodeString displayName;
             service.getDisplayName(actualID, displayName, Locale::getEnglish());
             logln("found actual: " + *bozo + " with display name: " + displayName);
@@ -826,16 +826,16 @@ class CalifornioLanguageFactory : public ICUResourceBundleFactory
     static const char* valley; // = californio ## "_VALLEY";
     static const char* surfer; // = californio ## "_SURFER";
     static const char* geek; // = californio ## "_GEEK";
-    static Hashtable* supportedIDs; // = NULL;
+    static Hashtable* supportedIDs; // = nullptr;
 
     static void cleanup(void) {
       delete supportedIDs;
-      supportedIDs = NULL;
+      supportedIDs = nullptr;
     }
 
     const Hashtable* getSupportedIDs(UErrorCode& status) const override
     {
-        if (supportedIDs == NULL) {
+        if (supportedIDs == nullptr) {
             Hashtable* table = new Hashtable();
             table->put(UnicodeString(californio), (void*)table, status);
             table->put(UnicodeString(valley), (void*)table, status);
@@ -887,7 +887,7 @@ const char* CalifornioLanguageFactory::californio = "en_US_CA";
 const char* CalifornioLanguageFactory::valley = "en_US_CA_VALLEY";
 const char* CalifornioLanguageFactory::surfer = "en_US_CA_SURFER";
 const char* CalifornioLanguageFactory::geek = "en_US_CA_GEEK";
-Hashtable* CalifornioLanguageFactory::supportedIDs = NULL;
+Hashtable* CalifornioLanguageFactory::supportedIDs = nullptr;
 
 void
 ICUServiceTest::testRBF()
@@ -1031,7 +1031,7 @@ public void serviceChanged(ICUService s) {
 class TestStringLocaleService : public ICULocaleService {
     public:
     virtual UObject* cloneInstance(UObject* instance) const override {
-        return instance ? new UnicodeString(*(UnicodeString*)instance) : NULL;
+        return instance ? new UnicodeString(*(UnicodeString*)instance) : nullptr;
     }
 };
 
@@ -1130,7 +1130,7 @@ void ICUServiceTest::testLocale() {
         UnicodeString english = "en";
         Locale localeResult;
         UnicodeString result;
-        LocaleKey* lkey = LocaleKey::createWithCanonicalFallback(&english, NULL, 1234, status);
+        LocaleKey* lkey = LocaleKey::createWithCanonicalFallback(&english, nullptr, 1234, status);
         logln("lkey prefix: " + lkey->prefix(result));
         result.remove();
         logln("lkey descriptor: " + lkey->currentDescriptor(result));
@@ -1202,7 +1202,7 @@ void ICUServiceTest::testLocale() {
             logln("locales: ");
             {
                 const char* p;
-                while ((p = locales->next(NULL, status))) {
+                while ((p = locales->next(nullptr, status))) {
                     logln(p);
                 }
             }
@@ -1217,7 +1217,7 @@ void ICUServiceTest::testLocale() {
 class WrapFactory : public ICUServiceFactory {
     public:
     static const UnicodeString& getGreetingID() {
-      if (greetingID == NULL) {
+      if (greetingID == nullptr) {
     greetingID = new UnicodeString("greeting");
       }
       return *greetingID;
@@ -1225,14 +1225,14 @@ class WrapFactory : public ICUServiceFactory {
 
   static void cleanup() {
     delete greetingID;
-    greetingID = NULL;
+    greetingID = nullptr;
   }
 
     UObject* create(const ICUServiceKey& key, const ICUService* service, UErrorCode& status) const override {
         if (U_SUCCESS(status)) {
             UnicodeString temp;
             if (key.currentID(temp).compare(getGreetingID()) == 0) {
-                UnicodeString* previous = (UnicodeString*)service->getKey((ICUServiceKey&)key, NULL, this, status);
+                UnicodeString* previous = (UnicodeString*)service->getKey((ICUServiceKey&)key, nullptr, this, status);
                 if (previous) {
                     previous->insert(0, "A different greeting: \"");
                     previous->append("\"");
@@ -1240,7 +1240,7 @@ class WrapFactory : public ICUServiceFactory {
                 }
             }
         }
-        return NULL;
+        return nullptr;
     }
 
     void updateVisibleIDs(Hashtable& result, UErrorCode& status) const override {
@@ -1272,7 +1272,7 @@ class WrapFactory : public ICUServiceFactory {
     static UnicodeString* greetingID;
 };
 
-UnicodeString* WrapFactory::greetingID = NULL;
+UnicodeString* WrapFactory::greetingID = nullptr;
 const char WrapFactory::fgClassID = '\0';
 
 void 
@@ -1416,7 +1416,7 @@ void ICUServiceTest::testCoverage()
     LKFSubclass lkf(true); // empty
     Hashtable table;
 
-    UObject *obj = lkf.create(*key, NULL, status);
+    UObject *obj = lkf.create(*key, nullptr, status);
     logln("obj: " + UnicodeString(obj ? "obj" : "null"));
     logln(lkf.getDisplayName("en_US", Locale::getDefault(), result));
     lkf.updateVisibleIDs(table, status);
@@ -1426,7 +1426,7 @@ void ICUServiceTest::testCoverage()
     }
 
     LKFSubclass invisibleLKF(false);
-    obj = lkf.create(*key, NULL, status);
+    obj = lkf.create(*key, nullptr, status);
     logln("obj: " + UnicodeString(obj ? "obj" : "null"));
     logln(invisibleLKF.getDisplayName("en_US", Locale::getDefault(), result.remove()));
     invisibleLKF.updateVisibleIDs(table, status);
@@ -1459,8 +1459,8 @@ void ICUServiceTest::testCoverage()
         // ResourceBundleFactory
     key = LocaleKey::createWithCanonicalFallback(&primary, &fallback, status);
         ICUResourceBundleFactory rbf;
-        UObject* icurb = rbf.create(*key, NULL, status);
-        if (icurb != NULL) {
+        UObject* icurb = rbf.create(*key, nullptr, status);
+        if (icurb != nullptr) {
                 logln("got resource bundle for key");
                 delete icurb;
         }
index 09c46484cbbe86b452d33c799c80fe3268e477f8..2ba51e8b348305c2a7752c593ae54b3494730de4 100644 (file)
@@ -26,7 +26,7 @@ class ICUServiceTest : public IntlTest
   ICUServiceTest();
   virtual ~ICUServiceTest();
 
-  void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL) override;
+  void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = nullptr) override;
 
   void testAPI_One(void);
   void testAPI_Two(void);
index 69c6cb4cf895443660d91d29458221a3aefeba4f..e3a8485f6227bab1e199dd4f917dfa399b15bb70 100644 (file)
@@ -43,7 +43,7 @@ static const UChar C_USESTD3ASCIIRULES[] = {0x55, 0x73, 0x65, 0x53, 0x54, 0x44,
        0x33, 0x41, 0x53, 0x43, 0x49, 0x49, 0x52, 0x75, 0x6C, 0x65, 0x73, 0}; // UseSTD3ASCIIRules
 
 IdnaConfTest::IdnaConfTest(){
-    base = NULL;
+    base = nullptr;
     len = 0;
     curOffset = 0;
 
@@ -116,7 +116,7 @@ UBool IdnaConfTest::ReadOneLine(UnicodeString& buf){
  * and, of course, will shift tail elements.
  */
 void IdnaConfTest::ExplainCodePointTag(UnicodeString& buf){
-    buf.append((UChar)0);    // add a terminal NULL
+    buf.append((UChar)0);    // add a terminal NUL
     UChar* bufBase = buf.getBuffer(buf.length());
     UChar* p = bufBase;
     while (*p != 0){
@@ -158,13 +158,13 @@ void IdnaConfTest::Call(){
         const int p_len = namebase.length();
 
         if (type == 0 && option == 0){
-            uidna_IDNToASCII(p, p_len, result, 200, UIDNA_USE_STD3_RULES, NULL, &status);
+            uidna_IDNToASCII(p, p_len, result, 200, UIDNA_USE_STD3_RULES, nullptr, &status);
         } else if (type == 0 && option == 1){
-            uidna_IDNToASCII(p, p_len, result, 200, UIDNA_ALLOW_UNASSIGNED, NULL, &status);
+            uidna_IDNToASCII(p, p_len, result, 200, UIDNA_ALLOW_UNASSIGNED, nullptr, &status);
         } else if (type == 1 && option == 0){
-            uidna_IDNToUnicode(p, p_len, result, 200, UIDNA_USE_STD3_RULES, NULL, &status);
+            uidna_IDNToUnicode(p, p_len, result, 200, UIDNA_USE_STD3_RULES, nullptr, &status);
         } else if (type == 1 && option == 1){
-            uidna_IDNToUnicode(p, p_len, result, 200, UIDNA_ALLOW_UNASSIGNED, NULL, &status);
+            uidna_IDNToUnicode(p, p_len, result, 200, UIDNA_ALLOW_UNASSIGNED, nullptr, &status);
         }
         if (passfail == 0){
             if (U_FAILURE(status)){
index 3c940ac1c521448198684ac18f52846f542371a8..80330c7b3fda7c540db491e0bf3c6523166eb066 100644 (file)
@@ -21,7 +21,7 @@
 
 class IdnaConfTest: public IntlTest {
 public:
-    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=nullptr) override;
     IdnaConfTest();
     virtual ~IdnaConfTest();
 private:
index c06a0ee24001ab49fcc4aadef80820108e36d914..74c24c0a922bd903790db334fa7e39231b6c945c 100644 (file)
@@ -138,14 +138,14 @@ static int32_t convertToPuny(const UChar* src, int32_t srcLength,
     char* b2 = b2Stack;
     int32_t b2Len =MAX_LABEL_BUFFER_SIZE ;
     punycode_status error;
-    unsigned char* caseFlags = NULL;
+    unsigned char* caseFlags = nullptr;
 
     u_strToUTF32((UChar32*)b1,b1Capacity,&b1Len,src,srcLength,&status);
     if(status == U_BUFFER_OVERFLOW_ERROR){
         // redo processing of string
         /* we do not have enough room so grow the buffer*/
         b1 =  (uint32_t*) uprv_malloc(b1Len * sizeof(uint32_t));
-        if(b1==NULL){
+        if(b1==nullptr){
             status = U_MEMORY_ALLOCATION_ERROR;
             goto CLEANUP;
         }
@@ -166,7 +166,7 @@ static int32_t convertToPuny(const UChar* src, int32_t srcLength,
     if(status == U_BUFFER_OVERFLOW_ERROR){
         /* we do not have enough room so grow the buffer*/
         b2 = (char*) uprv_malloc( b2Len * sizeof(char));
-        if(b2==NULL){
+        if(b2==nullptr){
             status = U_MEMORY_ALLOCATION_ERROR;
             goto CLEANUP;
         }
@@ -221,12 +221,12 @@ static int32_t convertFromPuny(  const UChar* src, int32_t srcLength,
     uint32_t b2Stack[MAX_LABEL_BUFFER_SIZE];
     uint32_t* b2 = b2Stack;
     int32_t b2Len =MAX_LABEL_BUFFER_SIZE;
-    unsigned char* caseFlags = NULL; //(unsigned char*) uprv_malloc(srcLength * sizeof(unsigned char*));
+    unsigned char* caseFlags = nullptr; //(unsigned char*) uprv_malloc(srcLength * sizeof(unsigned char*));
     punycode_status error = punycode_decode(srcLength,b1,(uint32_t*)&b2Len,b2,caseFlags);
     status = getError(error);
     if(status == U_BUFFER_OVERFLOW_ERROR){
         b2 =  (uint32_t*) uprv_malloc(b2Len * sizeof(uint32_t));
-        if(b2 == NULL){
+        if(b2 == nullptr){
             status = U_MEMORY_ALLOCATION_ERROR;
             goto CLEANUP;
         }
@@ -260,10 +260,10 @@ idnaref_toASCII(const UChar* src, int32_t srcLength,
               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;
     }
@@ -279,7 +279,7 @@ idnaref_toASCII(const UChar* src, int32_t srcLength,
     UBool allowUnassigned   = (UBool)((options & IDNAREF_ALLOW_UNASSIGNED) != 0);
     UBool useSTD3ASCIIRules = (UBool)((options & IDNAREF_USE_STD3_RULES) != 0);
 
-    UBool* caseFlags = NULL;
+    UBool* caseFlags = nullptr;
 
     // assume the source contains all ascii codepoints
     UBool srcIsASCII  = true;
@@ -312,7 +312,7 @@ idnaref_toASCII(const UChar* src, int32_t srcLength,
             // 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){
+            if(b1==nullptr){
                 *status = U_MEMORY_ALLOCATION_ERROR;
                 goto CLEANUP;
             }
@@ -371,7 +371,7 @@ idnaref_toASCII(const UChar* src, int32_t srcLength,
                 // 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){
+                if(b2 == nullptr){
                     *status = U_MEMORY_ALLOCATION_ERROR;
                     goto CLEANUP;
                 }
@@ -429,10 +429,10 @@ idnaref_toUnicode(const UChar* src, int32_t srcLength,
                 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;
     }
@@ -442,7 +442,7 @@ idnaref_toUnicode(const UChar* src, int32_t srcLength,
     UChar 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;
+    UChar  *b1 = b1Stack, *b2 = b2Stack, *b1Prime=nullptr, *b3=b3Stack;
     int32_t b1Len, b2Len, b1PrimeLen, b3Len,
             b1Capacity = MAX_LABEL_BUFFER_SIZE,
             b2Capacity = MAX_LABEL_BUFFER_SIZE,
@@ -452,7 +452,7 @@ idnaref_toUnicode(const UChar* src, int32_t srcLength,
 
     NamePrepTransform* prep = getInstance(*status);
     b1Len = 0;
-    UBool* caseFlags = NULL;
+    UBool* caseFlags = nullptr;
 
     //get the options
     UBool allowUnassigned   = (UBool)((options & IDNAREF_ALLOW_UNASSIGNED) != 0);
@@ -501,7 +501,7 @@ idnaref_toUnicode(const UChar* src, int32_t srcLength,
             // 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){
+            if(b1==nullptr){
                 *status = U_MEMORY_ALLOCATION_ERROR;
                 goto CLEANUP;
             }
@@ -522,7 +522,7 @@ idnaref_toUnicode(const UChar* src, int32_t srcLength,
         }else{
             /* we do not have enough room so grow the buffer*/
             b1 = (UChar*) uprv_malloc(srcLength * U_SIZEOF_UCHAR);
-            if(b1==NULL){
+            if(b1==nullptr){
                 *status = U_MEMORY_ALLOCATION_ERROR;
                 goto CLEANUP;
             }
@@ -545,7 +545,7 @@ idnaref_toUnicode(const UChar* src, int32_t srcLength,
             // 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){
+            if(b2==nullptr){
                 *status = U_MEMORY_ALLOCATION_ERROR;
                 goto CLEANUP;
             }
@@ -564,7 +564,7 @@ idnaref_toUnicode(const UChar* src, int32_t srcLength,
             // 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){
+            if(b3==nullptr){
                 *status = U_MEMORY_ALLOCATION_ERROR;
                 goto CLEANUP;
             }
@@ -694,10 +694,10 @@ idnaref_IDNToASCII(  const UChar* src, int32_t srcLength,
                    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;
     }
@@ -744,7 +744,7 @@ idnaref_IDNToASCII(  const UChar* src, int32_t srcLength,
                     // 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){
+                    if(b1==nullptr){
                         *status = U_MEMORY_ALLOCATION_ERROR;
                         goto CLEANUP;
                     }
@@ -794,7 +794,7 @@ idnaref_IDNToASCII(  const UChar* src, int32_t srcLength,
                 // 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){
+                if(b1==nullptr){
                     *status = U_MEMORY_ALLOCATION_ERROR;
                     goto CLEANUP;
                 }
@@ -849,10 +849,10 @@ idnaref_IDNToUnicode(  const UChar* src, int32_t srcLength,
                      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;
     }
@@ -899,7 +899,7 @@ idnaref_IDNToUnicode(  const UChar* src, int32_t srcLength,
                 // 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){
+                if(b1==nullptr){
                     *status = U_MEMORY_ALLOCATION_ERROR;
                     goto CLEANUP;
                 }
@@ -951,7 +951,7 @@ idnaref_IDNToUnicode(  const UChar* src, int32_t srcLength,
                 // 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){
+                if(b1==nullptr){
                     *status = U_MEMORY_ALLOCATION_ERROR;
                     goto CLEANUP;
                 }
@@ -1004,7 +1004,7 @@ idnaref_compare(  const UChar *s1, int32_t length1,
                 int32_t options,
                 UErrorCode* status){
 
-    if(status == NULL || U_FAILURE(*status)){
+    if(status == nullptr || U_FAILURE(*status)){
         return -1;
     }
 
@@ -1020,7 +1020,7 @@ idnaref_compare(  const UChar *s1, int32_t length1,
         // 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){
+        if(b1==nullptr){
             *status = U_MEMORY_ALLOCATION_ERROR;
             goto CLEANUP;
         }
@@ -1036,7 +1036,7 @@ idnaref_compare(  const UChar *s1, int32_t length1,
         // 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){
+        if(b2==nullptr){
             *status = U_MEMORY_ALLOCATION_ERROR;
             goto CLEANUP;
         }
index 1ae2a4f94be7d9e51ac09934cd1f9058d9bd8e37..86bdf2fc8fd2f7db552983116ea0796df62ce94e 100644 (file)
@@ -119,7 +119,7 @@ void IntlCalendarTest::runIndexedTest( int32_t index, UBool exec, const char* &n
 void
 IntlCalendarTest::TestTypes()
 {
-  Calendar *c = NULL;
+  Calendar *c = nullptr;
   UErrorCode status = U_ZERO_ERROR;
   int j;
   const char *locs [40] = { "en_US_VALLEYGIRL",     
@@ -134,7 +134,7 @@ IntlCalendarTest::TestTypes()
                             "th",       // th's default region is TH and buddhist is used as default for TH
                             "en_TH",    // Default calendar for any locales with region TH is buddhist
                             "en-TH-u-ca-gregory",
-                            NULL };
+                            nullptr };
   const char *types[40] = { "gregorian", 
                             "japanese",
                             "gregorian",
@@ -147,7 +147,7 @@ IntlCalendarTest::TestTypes()
                             "buddhist",           
                             "buddhist",           
                             "gregorian",
-                            NULL };
+                            nullptr };
 
   for(j=0;locs[j];j++) {
     logln(UnicodeString("Creating calendar of locale ")  + locs[j]);
index eca14f403cacd14534f16e9057d5c59cef25c7ed..81416b02aee55951fc6acfa87c2f0ab13d4acb55 100644 (file)
 #endif
 
 
-static char* _testDataPath=NULL;
+static char* _testDataPath=nullptr;
 
 // Static list of errors found
 static UnicodeString errorList;
-static void *knownList = NULL; // known issues
+static void *knownList = nullptr; // known issues
 static UBool noKnownIssues = false; // if true, don't emit known issues
 
 //-----------------------------------------------------------------------------
@@ -203,7 +203,7 @@ UnicodeString _toString(const Formattable& f) {
         break;
     case Formattable::kObject: {
         const CurrencyAmount* c = dynamic_cast<const CurrencyAmount*>(f.getObject());
-        if (c != NULL) {
+        if (c != nullptr) {
             s = _toString(c->getNumber()) + " " + UnicodeString(c->getISOCurrency());
         } else {
             s = UnicodeString("Unknown UObject");
@@ -426,7 +426,7 @@ IntlTest::prettify(const UnicodeString &source, UBool parseBackslash)
 void IntlTest::setICU_DATA() {
     const char *original_ICU_DATA = getenv("ICU_DATA");
 
-    if (original_ICU_DATA != NULL && *original_ICU_DATA != 0) {
+    if (original_ICU_DATA != nullptr && *original_ICU_DATA != 0) {
         /*  If the user set ICU_DATA, don't second-guess the person. */
         return;
     }
@@ -466,12 +466,12 @@ void IntlTest::setICU_DATA() {
         /*   Only Windows should end up here, so looking for '\' is safe.   */
         for (i=1; i<=3; i++) {
             pBackSlash = strrchr(p, U_FILE_SEP_CHAR);
-            if (pBackSlash != NULL) {
+            if (pBackSlash != nullptr) {
                 *pBackSlash = 0;        /* Truncate the string at the '\'   */
             }
         }
 
-        if (pBackSlash != NULL) {
+        if (pBackSlash != nullptr) {
             /* We found and truncated three names from the path.
              *  Now append "source\data" and set the environment
              */
@@ -498,7 +498,7 @@ void IntlTest::setICU_DATA() {
 static const int32_t indentLevel_offset = 3;
 static const char delim = '/';
 
-IntlTest* IntlTest::gTest = NULL;
+IntlTest* IntlTest::gTest = nullptr;
 
 static int32_t execCount = 0;
 
@@ -570,8 +570,8 @@ void it_dataerrln( UnicodeString message )
 
 IntlTest::IntlTest()
 {
-    caller = NULL;
-    testPath = NULL;
+    caller = nullptr;
+    testPath = nullptr;
     LL_linestart = true;
     errorCount = 0;
     dataErrorCount = 0;
@@ -692,11 +692,11 @@ int32_t IntlTest::getDataErrors( void )
 UBool IntlTest::runTest( char* name, char* par, char *baseName )
 {
     UBool rval;
-    char* pos = NULL;
+    char* pos = nullptr;
 
-    char* baseNameBuffer = NULL;
+    char* baseNameBuffer = nullptr;
 
-    if(baseName == NULL) {
+    if(baseName == nullptr) {
       baseNameBuffer = (char*)malloc(1024);
       baseName=baseNameBuffer;
       strcpy(baseName, "/");
@@ -708,11 +708,11 @@ UBool IntlTest::runTest( char* name, char* par, char *baseName )
         testPath = pos+1;   // store subpath for calling subtest
         *pos = 0;       // split into two strings
     }else{
-        testPath = NULL;
+        testPath = nullptr;
     }
 
     if (!name || (name[0] == 0) || (strcmp(name, "*") == 0)) {
-      rval = runTestLoop( NULL, par, baseName );
+      rval = runTestLoop( nullptr, par, baseName );
 
     }else if (strcmp( name, "LIST" ) == 0) {
         this->usage();
@@ -724,7 +724,7 @@ UBool IntlTest::runTest( char* name, char* par, char *baseName )
 
     if (pos)
         *pos = delim;  // restore original value at pos
-    if(baseNameBuffer!=NULL) {
+    if(baseNameBuffer!=nullptr) {
       free(baseNameBuffer);
     }
     return rval;
@@ -754,7 +754,7 @@ UBool IntlTest::runTestLoop( char* testname, char* par, char *baseName )
     UBool  rval = false;
     UBool   lastTestFailed;
 
-    if(baseName == NULL) {
+    if(baseName == nullptr) {
       printf("ERROR: baseName can't be null.\n");
       return false;
     } else {
@@ -807,7 +807,7 @@ UBool IntlTest::runTestLoop( char* testname, char* par, char *baseName )
             strcpy(saveBaseLoc,name);
 
 
-            ctest_xml_testcase(baseName, name, secs, (lastErrorCount!=errorCount)?"err":NULL);
+            ctest_xml_testcase(baseName, name, secs, (lastErrorCount!=errorCount)?"err":nullptr);
             
 
             saveBaseLoc[0]=0; /* reset path */
@@ -978,7 +978,7 @@ void IntlTest::log(const char *fmt, ...)
     vsnprintf(buffer, sizeof(buffer), fmt, ap);
     va_end(ap);
     if( verbose ) {
-        log(UnicodeString(buffer, (const char *)NULL));
+        log(UnicodeString(buffer, (const char *)nullptr));
     }
 }
 
@@ -992,7 +992,7 @@ void IntlTest::logln(const char *fmt, ...)
     vsnprintf(buffer, sizeof(buffer), fmt, ap);
     va_end(ap);
     if( verbose ) {
-        logln(UnicodeString(buffer, (const char *)NULL));
+        logln(UnicodeString(buffer, (const char *)nullptr));
     }
 }
 
@@ -1005,7 +1005,7 @@ UBool IntlTest::logKnownIssue(const char *ticket, const char *fmt, ...)
     /* snprintf it just to make sure that the information is valid */
     vsnprintf(buffer, sizeof(buffer), fmt, ap);
     va_end(ap);
-    return logKnownIssue(ticket, UnicodeString(buffer, (const char *)NULL));
+    return logKnownIssue(ticket, UnicodeString(buffer, (const char *)nullptr));
 }
 
 UBool IntlTest::logKnownIssue(const char *ticket) {
@@ -1043,7 +1043,7 @@ void IntlTest::info(const char *fmt, ...)
     /* snprintf it just to make sure that the information is valid */
     vsnprintf(buffer, sizeof(buffer), fmt, ap);
     va_end(ap);
-    info(UnicodeString(buffer, (const char *)NULL));
+    info(UnicodeString(buffer, (const char *)nullptr));
 }
 
 void IntlTest::infoln(const char *fmt, ...)
@@ -1055,7 +1055,7 @@ void IntlTest::infoln(const char *fmt, ...)
     /* snprintf it just to make sure that the information is valid */
     vsnprintf(buffer, sizeof(buffer), fmt, ap);
     va_end(ap);
-    infoln(UnicodeString(buffer, (const char *)NULL));
+    infoln(UnicodeString(buffer, (const char *)nullptr));
 }
 
 void IntlTest::err(const char *fmt, ...)
@@ -1066,7 +1066,7 @@ void IntlTest::err(const char *fmt, ...)
     va_start(ap, fmt);
     vsnprintf(buffer, sizeof(buffer), fmt, ap);
     va_end(ap);
-    err(UnicodeString(buffer, (const char *)NULL));
+    err(UnicodeString(buffer, (const char *)nullptr));
 }
 
 void IntlTest::errln(const char *fmt, ...)
@@ -1077,7 +1077,7 @@ void IntlTest::errln(const char *fmt, ...)
     va_start(ap, fmt);
     vsnprintf(buffer, sizeof(buffer), fmt, ap);
     va_end(ap);
-    errln(UnicodeString(buffer, (const char *)NULL));
+    errln(UnicodeString(buffer, (const char *)nullptr));
 }
 
 void IntlTest::dataerrln(const char *fmt, ...)
@@ -1088,7 +1088,7 @@ void IntlTest::dataerrln(const char *fmt, ...)
     va_start(ap, fmt);
     vsnprintf(buffer, sizeof(buffer), fmt, ap);
     va_end(ap);
-    dataerrln(UnicodeString(buffer, (const char *)NULL));
+    dataerrln(UnicodeString(buffer, (const char *)nullptr));
 }
 
 void IntlTest::errcheckln(UErrorCode status, const char *fmt, ...)
@@ -1101,9 +1101,9 @@ void IntlTest::errcheckln(UErrorCode status, const char *fmt, ...)
     va_end(ap);
     
     if (status == U_FILE_ACCESS_ERROR || status == U_MISSING_RESOURCE_ERROR) {
-        dataerrln(UnicodeString(buffer, (const char *)NULL));
+        dataerrln(UnicodeString(buffer, (const char *)nullptr));
     } else {
-        errln(UnicodeString(buffer, (const char *)NULL));
+        errln(UnicodeString(buffer, (const char *)nullptr));
     }
 }
 
@@ -1114,7 +1114,7 @@ void IntlTest::printErrors()
 
 UBool IntlTest::printKnownIssues()
 {
-  if(knownList != NULL) {
+  if(knownList != nullptr) {
     udbg_knownIssue_print(knownList);
     udbg_knownIssue_close(knownList);
     return true;
@@ -1190,7 +1190,7 @@ void IntlTest::usage( void )
     logln("-----------");
 
     int32_t index = 0;
-    const char* name = NULL;
+    const char* name = nullptr;
     do{
         this->runIndexedTest( index, false, name );
         if (!name) break;
@@ -1236,13 +1236,13 @@ main(int argc, char* argv[])
     UBool name = false;
     UBool leaks = false;
     UBool utf8 = false;
-    const char *summary_file = NULL;
+    const char *summary_file = nullptr;
     UBool warnOnMissingData = false;
     UBool writeGoldenData = false;
     UBool defaultDataFound = false;
     int32_t threadCount = 12;
     UErrorCode errorCode = U_ZERO_ERROR;
-    UConverter *cnv = NULL;
+    UConverter *cnv = nullptr;
     const char *warnOrErr = "Failure";
     UDate startTime, endTime;
     int32_t diffTime;
@@ -1500,7 +1500,7 @@ main(int argc, char* argv[])
     if (all) {
         major.runTest();
         if (leaks) {
-            major.run_phase2( NULL, NULL );
+            major.run_phase2( nullptr, nullptr );
         }
     }else{
         for (int i = 1; i < argc; ++i) {
@@ -1562,9 +1562,9 @@ main(int argc, char* argv[])
         fprintf(stdout, "Errors in total: %ld.\n", (long)major.getErrors());
         major.printErrors();
 
-        if(summary_file != NULL) {
+        if(summary_file != nullptr) {
           FILE *summf = fopen(summary_file, "w");
-          if( summf != NULL) {
+          if( summf != nullptr) {
             char buf[10000];
             int32_t length = errorList.extract(0, errorList.length(), buf, sizeof(buf));
             fwrite(buf, sizeof(*buf), length, (FILE*)summf);
@@ -1609,10 +1609,10 @@ main(int argc, char* argv[])
 }
 
 const char* IntlTest::loadTestData(UErrorCode& err){
-    if ( _testDataPath == NULL){
-        const char*      directory=NULL;
-        UResourceBundle* test =NULL;
-        char* tdpath=NULL;
+    if ( _testDataPath == nullptr){
+        const char*      directory=nullptr;
+        UResourceBundle* test =nullptr;
+        char* tdpath=nullptr;
         const char* tdrelativepath;
 
 #if defined (U_TOPBUILDDIR)
@@ -1625,7 +1625,7 @@ const char* IntlTest::loadTestData(UErrorCode& err){
 
         tdpath = (char*) malloc(sizeof(char) *(( strlen(directory) * strlen(tdrelativepath)) + 100));
 
-        if (tdpath == NULL) {
+        if (tdpath == nullptr) {
             err = U_MEMORY_ALLOCATION_ERROR;
             it_dataerrln((UnicodeString) "Could not allocate memory for _testDataPath " + u_errorName(err));
             return "";
@@ -1661,7 +1661,7 @@ const char* IntlTest::getTestDataPath(UErrorCode& err) {
  * Note: this function is parallel with C loadSourceTestData in cintltst.c
  */
 const char *IntlTest::getSourceTestData(UErrorCode& /*err*/) {
-    const char *srcDataDir = NULL;
+    const char *srcDataDir = nullptr;
 #ifdef U_TOPSRCDIR
     srcDataDir = U_TOPSRCDIR U_FILE_SEP_STRING"test" U_FILE_SEP_STRING "testdata" U_FILE_SEP_STRING;
 #else
@@ -1687,7 +1687,7 @@ char *IntlTest::getUnidataPath(char path[]) {
     strcpy(path, pathToDataDirectory());
     strcat(path, "unidata" U_FILE_SEP_STRING "UnicodeData.txt");
     FILE *f = fopen(path, "r");
-    if(f != NULL) {
+    if(f != nullptr) {
         fclose(f);
         *(strchr(path, 0) - kUnicodeDataTxtLength) = 0;  // Remove the basename.
         return path;
@@ -1704,7 +1704,7 @@ char *IntlTest::getUnidataPath(char path[]) {
             it_errln(UnicodeString(
                         "unable to find path to source/data/unidata/ and loadTestData() failed: ") +
                     u_errorName(errorCode));
-            return NULL;
+            return nullptr;
         }
         strcpy(path, testDataPath);
         strcat(path, U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".."
@@ -1714,21 +1714,21 @@ char *IntlTest::getUnidataPath(char path[]) {
     strcat(path, U_FILE_SEP_STRING);
     strcat(path, "unidata" U_FILE_SEP_STRING "UnicodeData.txt");
     f = fopen(path, "r");
-    if(f != NULL) {
+    if(f != nullptr) {
         fclose(f);
         *(strchr(path, 0) - kUnicodeDataTxtLength) = 0;  // Remove the basename.
         return path;
     }
-    return NULL;
+    return nullptr;
 }
 
-const char* IntlTest::fgDataDir = NULL;
+const char* IntlTest::fgDataDir = nullptr;
 
 /* returns the path to icu/source/data */
 const char *  IntlTest::pathToDataDirectory()
 {
 
-    if(fgDataDir != NULL) {
+    if(fgDataDir != nullptr) {
         return fgDataDir;
     }
 
@@ -1760,12 +1760,12 @@ const char *  IntlTest::pathToDataDirectory()
         /*   Only Windows should end up here, so looking for '\' is safe.   */
         for (i=1; i<=3; i++) {
             pBackSlash = strrchr(p, U_FILE_SEP_CHAR);
-            if (pBackSlash != NULL) {
+            if (pBackSlash != nullptr) {
                 *pBackSlash = 0;        /* Truncate the string at the '\'   */
             }
         }
 
-        if (pBackSlash != NULL) {
+        if (pBackSlash != nullptr) {
             /* We found and truncated three names from the path.
             *  Now append "source\data" and set the environment
             */
@@ -1904,7 +1904,7 @@ static UnicodeString& escape(const UnicodeString& s, UnicodeString& result) {
 #define VERBOSE_ASSERTIONS
 
 UBool IntlTest::assertTrue(const char* message, UBool condition, UBool quiet, UBool possibleDataError, const char *file, int line) {
-    if (file != NULL) {
+    if (file != nullptr) {
         if (!condition) {
             if (possibleDataError) {
                 dataerrln("%s:%d: FAIL: assertTrue() failed: %s", file, line, message);
@@ -1943,7 +1943,7 @@ UBool IntlTest::assertFalse(const char* message, UBool condition, UBool quiet, U
 }
 
 UBool IntlTest::assertSuccess(const char* message, UErrorCode ec, UBool possibleDataError, const char *file, int line) {
-    if( file==NULL ) {
+    if( file==nullptr ) {
       file = ""; // prevent failure if no file given
     }
     if (U_FAILURE(ec)) {
@@ -2314,7 +2314,7 @@ void IntlTest::setProperty(const char* propline) {
 }
 
 const char* IntlTest::getProperty(const char* prop) {
-    const char* val = NULL;
+    const char* val = nullptr;
     for (int32_t i = 0; i < numProps; i++) {
         int32_t plen = static_cast<int32_t>(uprv_strlen(prop));
         if ((int32_t)uprv_strlen(proplines[i]) > plen + 1
@@ -2338,7 +2338,7 @@ const char* IntlTest::getProperty(const char* prop) {
 //          ulen        an out parameter, receives the actual length (in UChars) of the file data.
 //          encoding    The file encoding.  If the file contains a BOM, that will override the encoding
 //                      specified here.  The BOM, if it exists, will be stripped from the returned data.
-//                      Pass NULL for the system default encoding.
+//                      Pass nullptr for the system default encoding.
 //          status
 //    returns:
 //                      The file data, converted to UChar.
@@ -2348,10 +2348,10 @@ const char* IntlTest::getProperty(const char* prop) {
 //
 //--------------------------------------------------------------------------------
 UChar *IntlTest::ReadAndConvertFile(const char *fileName, int &ulen, const char *encoding, UErrorCode &status) {
-    UChar       *retPtr  = NULL;
-    char        *fileBuf = NULL;
-    UConverter* conv     = NULL;
-    FILE        *f       = NULL;
+    UChar       *retPtr  = nullptr;
+    char        *fileBuf = nullptr;
+    UConverter* conv     = nullptr;
+    FILE        *f       = nullptr;
 
     ulen = 0;
     if (U_FAILURE(status)) {
@@ -2365,7 +2365,7 @@ UChar *IntlTest::ReadAndConvertFile(const char *fileName, int &ulen, const char
     if (f == 0) {
         dataerrln("Error opening test data file %s\n", fileName);
         status = U_FILE_ACCESS_ERROR;
-        return NULL;
+        return nullptr;
     }
     //
     //  Read it in
@@ -2393,7 +2393,7 @@ UChar *IntlTest::ReadAndConvertFile(const char *fileName, int &ulen, const char
     fileBufC = fileBuf;
     bomEncoding = ucnv_detectUnicodeSignature(
         fileBuf, fileSize, &signatureLength, &status);
-    if(bomEncoding!=NULL ){
+    if(bomEncoding!=nullptr ){
         fileBufC  += signatureLength;
         fileSize  -= signatureLength;
         encoding = bomEncoding;
@@ -2412,7 +2412,7 @@ UChar *IntlTest::ReadAndConvertFile(const char *fileName, int &ulen, const char
     //  Preflight first to determine required buffer size.
     //
     ulen = ucnv_toUChars(conv,
-        NULL,           //  dest,
+        nullptr,           //  dest,
         0,              //  destCapacity,
         fileBufC,
         fileSize,
index 31bbe1f13d80d8e36fc6689fee5d264aa175d4ba..60d3635a083a3c64ac2d3227dc19a1c260563998 100644 (file)
@@ -142,7 +142,7 @@ public:
     IntlTest();
     // TestLog has a virtual destructor.
 
-    virtual UBool runTest( char* name = NULL, char* par = NULL, char *baseName = NULL); // not to be overridden
+    virtual UBool runTest( char* name = nullptr, char* par = nullptr, char *baseName = nullptr); // not to be overridden
 
     virtual UBool setVerbose( UBool verbose = true );
     virtual UBool setNoErrMsg( UBool no_err_msg = true );
@@ -287,13 +287,13 @@ public:
     virtual const char* getProperty(const char* prop);
 
     /* JUnit-like assertions. Each returns true if it succeeds. */
-    UBool assertTrue(const char* message, UBool condition, UBool quiet=false, UBool possibleDataError=false, const char *file=NULL, int line=0);
+    UBool assertTrue(const char* message, UBool condition, UBool quiet=false, UBool possibleDataError=false, const char *file=nullptr, int line=0);
     UBool assertFalse(const char* message, UBool condition, UBool quiet=false, UBool possibleDataError=false);
     /**
      * @param possibleDataError - if true, use dataerrln instead of errcheckln on failure
      * @return true on success, false on failure.
      */
-    UBool assertSuccess(const char* message, UErrorCode ec, UBool possibleDataError=false, const char *file=NULL, int line=0);
+    UBool assertSuccess(const char* message, UErrorCode ec, UBool possibleDataError=false, const char *file=nullptr, int line=0);
     UBool assertEquals(const char* message, const UnicodeString& expected,
                        const UnicodeString& actual, UBool possibleDataError=false);
     UBool assertEquals(const char* message, const char* expected, const char* actual);
@@ -357,7 +357,7 @@ public:
         const std::vector<std::string>& expected, const std::vector<std::string>& actual);
     UBool assertNotEquals(const UnicodeString& message, int32_t expectedNot, int32_t actual);
 
-    virtual void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ); // override !
+    virtual void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ); // override !
 
     virtual UBool runTestLoop( char* testname, char* par, char *baseName );
 
index 207be63ac2795ef9e652cb8d24288657a7ecb326..90eb6841c396ac99817e5facec68bd5b9fdeecf8 100644 (file)
@@ -92,11 +92,11 @@ void CollationIteratorTest::TestPrevious(/* char* par */)
 
     // Test with a contracting character sequence
     UnicodeString source;
-    RuleBasedCollator *c1 = NULL;
+    RuleBasedCollator *c1 = nullptr;
     c1 = new RuleBasedCollator(
         (UnicodeString)"&a,A < b,B < c,C, d,D < z,Z < ch,cH,Ch,CH", status);
 
-    if (c1 == NULL || U_FAILURE(status))
+    if (c1 == nullptr || U_FAILURE(status))
     {
         errln("Couldn't create a RuleBasedCollator with a contracting sequence.");
         delete c1;
@@ -110,10 +110,10 @@ void CollationIteratorTest::TestPrevious(/* char* par */)
     delete c1;
 
     // Test with an expanding character sequence
-    RuleBasedCollator *c2 = NULL;
+    RuleBasedCollator *c2 = nullptr;
     c2 = new RuleBasedCollator((UnicodeString)"&a < b < c/abd < d", status);
 
-    if (c2 == NULL || U_FAILURE(status))
+    if (c2 == nullptr || U_FAILURE(status))
     {
         errln("Couldn't create a RuleBasedCollator with an expanding sequence.");
         delete c2;
@@ -127,10 +127,10 @@ void CollationIteratorTest::TestPrevious(/* char* par */)
     delete c2;
 
     // Now try both
-    RuleBasedCollator *c3 = NULL;
+    RuleBasedCollator *c3 = nullptr;
     c3 = new RuleBasedCollator((UnicodeString)"&a < b < c/aba < d < z < ch", status);
 
-    if (c3 == NULL || U_FAILURE(status))
+    if (c3 == nullptr || U_FAILURE(status))
     {
         errln("Couldn't create a RuleBasedCollator with both an expanding and a contracting sequence.");
         delete c3;
@@ -392,7 +392,7 @@ void CollationIteratorTest::TestClearBuffers(/* char* par */)
     UErrorCode status = U_ZERO_ERROR;
     RuleBasedCollator *c = new RuleBasedCollator((UnicodeString)"&a < b < c & ab = d", status);
 
-    if (c == NULL || U_FAILURE(status))
+    if (c == nullptr || U_FAILURE(status))
     {
         errln("Couldn't create a RuleBasedCollator.");
         delete c;
@@ -461,7 +461,7 @@ void CollationIteratorTest::TestAssignment()
     RuleBasedCollator *coll = 
         (RuleBasedCollator *)Collator::createInstance(status);
 
-    if (coll == NULL || U_FAILURE(status))
+    if (coll == nullptr || U_FAILURE(status))
     {
         errln("Couldn't create a default collator.");
         return;
@@ -540,7 +540,7 @@ void CollationIteratorTest::TestConstructors()
     UErrorCode status = U_ZERO_ERROR;
     RuleBasedCollator *coll = 
         (RuleBasedCollator *)Collator::createInstance(status);
-    if (coll == NULL || U_FAILURE(status))
+    if (coll == nullptr || U_FAILURE(status))
     {
         errln("Couldn't create a default collator.");
         return;
@@ -597,7 +597,7 @@ void CollationIteratorTest::TestStrengthOrder()
     UErrorCode status = U_ZERO_ERROR;
     RuleBasedCollator *coll = 
         (RuleBasedCollator *)Collator::createInstance(status);
-    if (coll == NULL || U_FAILURE(status))
+    if (coll == nullptr || U_FAILURE(status))
     {
         errln("Couldn't create a default collator.");
         return;
@@ -607,7 +607,7 @@ void CollationIteratorTest::TestStrengthOrder()
     CollationElementIterator *iter = 
         coll->createCollationElementIterator(test1);
 
-    if (iter == NULL) {
+    if (iter == nullptr) {
         errln("Couldn't create a collation element iterator from default collator");
         return;
     }
index fc28c72e7dc27bc84aba7f45e7a9e36854939f5f..95cc791dac7a717778defd306c636254200ede36 100644 (file)
@@ -33,7 +33,7 @@ public:
     CollationIteratorTest();
     virtual ~CollationIteratorTest();
 
-    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = nullptr) override;
 
     /**
     * Test that results from CollationElementIterator.next is equivalent to
index 08f725adc1424e34bb1a74fa1f997500f68ce05f..5c67d189beadf4153d48d7ed13aacd6b3b14fa44 100644 (file)
@@ -94,7 +94,7 @@ extern IntlTest *createDisplayOptionsTest();
 void IntlTestFormat::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par )
 {
     // for all format tests, always set default Locale and TimeZone to ENGLISH and PST.
-    TimeZone* saveDefaultTimeZone = NULL;
+    TimeZone* saveDefaultTimeZone = nullptr;
     Locale  saveDefaultLocale = Locale::getDefault();
     if (exec) {
         saveDefaultTimeZone = TimeZone::createDefault();
index 49056d38fb91cf366eca9be8b1ad01c8654dc48b..2c7a65a26334456983250679cf5adbe3626478ae 100644 (file)
@@ -22,7 +22,7 @@
 
 
 class IntlTestFormat: public IntlTest {
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 };
 
 
index f712e27738412dae7024ba550da96ce0e68556c6..2c34b84b83de769ddea1610529aa8c87ea91abd3 100644 (file)
 
 
 class MajorTestLevel: public IntlTest {
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 };
 
 class IntlTestNormalize: public IntlTest {
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 };
 
 #endif
index a7ae7de8ff115c6cb94e4e732708b0f22e7d2662..6a79f0ee8df694bb83791827dc708298d1e2fc2b 100644 (file)
@@ -25,7 +25,7 @@
 
 class IntlTestRBBI: public IntlTest {
 public:
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 };
 
 #endif /* #if !UCONFIG_NO_BREAK_ITERATION && !UCONFIG_NO_REGULAR_EXPRESSIONS */
index 3db1350ae0cee847626f623c734edc5675422f96..f376107ba7e525ab3c04ab5680f5a0e1a10b8764 100644 (file)
@@ -169,7 +169,7 @@ IntlTestRBNF::TestAPI() {
   {
     logln("Testing Clone");
     RuleBasedNumberFormat* rbnfClone = formatter->clone();
-    if(rbnfClone != NULL) {
+    if(rbnfClone != nullptr) {
       if(!(*rbnfClone == *formatter)) {
         errln("Clone should be semantically equivalent to the original!");
       }
@@ -198,18 +198,18 @@ IntlTestRBNF::TestAPI() {
     } else {
       int32_t ruleLen = 0;
       int32_t len = 0;
-      LocalUResourceBundlePointer rbnfRules(ures_getByKey(en.getAlias(), "RBNFRules", NULL, &status));
-      LocalUResourceBundlePointer ruleSets(ures_getByKey(rbnfRules.getAlias(), "SpelloutRules", NULL, &status));
+      LocalUResourceBundlePointer rbnfRules(ures_getByKey(en.getAlias(), "RBNFRules", nullptr, &status));
+      LocalUResourceBundlePointer ruleSets(ures_getByKey(rbnfRules.getAlias(), "SpelloutRules", nullptr, &status));
       UnicodeString desc;
       while (ures_hasNext(ruleSets.getAlias())) {
-           const UChar* currentString = ures_getNextString(ruleSets.getAlias(), &len, NULL, &status);
+           const UChar* currentString = ures_getNextString(ruleSets.getAlias(), &len, nullptr, &status);
            ruleLen += len;
            desc.append(currentString);
       }
 
       const UChar *spelloutRules = desc.getTerminatedBuffer();
 
-      if(U_FAILURE(status) || ruleLen == 0 || spelloutRules == NULL) {
+      if(U_FAILURE(status) || ruleLen == 0 || spelloutRules == nullptr) {
         errln("Unable to access the rules string!");
       } else {
         UParseError perror;
@@ -415,7 +415,7 @@ void IntlTestRBNF::TestMultiplePluralRules() {
         { "2.2", "two plurality two tenth" },
         { "0.01", "one 1hundredth" },
         { "0.02", "two hundredth" },
-        { NULL, NULL }
+        { nullptr, nullptr }
     };
     doTest(&formatter, testData, true);
 }
@@ -503,7 +503,7 @@ void IntlTestRBNF::TestFractionalRuleSet()
             { ".4444", "4/9" },
             { ".5555", "5/9" },
             { "1.2856", "1 2/7" },
-            { NULL, NULL }
+            { nullptr, nullptr }
         };
         doTest(&formatter, testData, false); // exact values aren't parsable from fractions
     }
@@ -1168,7 +1168,7 @@ IntlTestRBNF::TestEnglishSpellout()
             { "2,345,678", "two million three hundred forty-five thousand six hundred seventy-eight" },
             { "-36", "minus thirty-six" },
             { "234.567", "two hundred thirty-four point five six seven" },
-            { NULL, NULL}
+            { nullptr, nullptr}
         };
 
         doTest(formatter, testData, true);
@@ -1182,7 +1182,7 @@ IntlTestRBNF::TestEnglishSpellout()
             { "2 thousand six    HUNDRED fifty-7", "2,657" },
             { "fifteen hundred and zero", "1,500" },
             { "FOurhundred     thiRTY six", "436" },
-            { NULL, NULL}
+            { nullptr, nullptr}
         };
         doLenientParseTest(formatter, lpTestData);
 #endif
@@ -1218,7 +1218,7 @@ IntlTestRBNF::TestOrdinalAbbreviations()
             { "102", "102nd" },
             { "312", "312th" },
             { "12,345", "12,345th" },
-            { NULL, NULL}
+            { nullptr, nullptr}
         };
         
         doTest(formatter, testData, false);
@@ -1248,7 +1248,7 @@ IntlTestRBNF::TestDurations()
             //            { "3,600", "1:00:00" },
             { "3,740", "1:02:20" },
             { "10,293", "2:51:33" },
-            { NULL, NULL}
+            { nullptr, nullptr}
         };
         
         doTest(formatter, testData, true);
@@ -1257,7 +1257,7 @@ IntlTestRBNF::TestDurations()
         formatter->setLenient(true);
         static const char* lpTestData[][2] = {
             { "2-51-33", "10,293" },
-            { NULL, NULL}
+            { nullptr, nullptr}
         };
         doLenientParseTest(formatter, lpTestData);
 #endif
@@ -1297,7 +1297,7 @@ IntlTestRBNF::TestSpanishSpellout()
             { "2,345,678", "dos millones trescientos cuarenta y cinco mil seiscientos setenta y ocho"},
             { "-36", "menos treinta y seis" },
             { "234.567", "doscientos treinta y cuatro coma cinco seis siete" },
-            { NULL, NULL}
+            { nullptr, nullptr}
         };
         
         doTest(formatter, testData, true);
@@ -1342,7 +1342,7 @@ IntlTestRBNF::TestFrenchSpellout()
             { "2,345,678", "deux millions trois cent quarante-cinq mille six cent soixante-dix-huit" },
             { "-36", "moins trente-six" },
             { "234.567", "deux cent trente-quatre virgule cinq six sept" },
-            { NULL, NULL}
+            { nullptr, nullptr}
         };
         
         doTest(formatter, testData, true);
@@ -1352,7 +1352,7 @@ IntlTestRBNF::TestFrenchSpellout()
         static const char* lpTestData[][2] = {
             { "trente-et-un", "31" },
             { "un cent quatre vingt dix huit", "198" },
-            { NULL, NULL}
+            { nullptr, nullptr}
         };
         doLenientParseTest(formatter, lpTestData);
 #endif
@@ -1387,7 +1387,7 @@ static const char* const swissFrenchTestData[][2] = {
     { "2,345,678", "deux millions trois cent quarante-cinq mille six cent septante-huit" },
     { "-36", "moins trente-six" },
     { "234.567", "deux cent trente-quatre virgule cinq six sept" },
-    { NULL, NULL}
+    { nullptr, nullptr}
 };
 
 void 
@@ -1435,7 +1435,7 @@ static const char* const belgianFrenchTestData[][2] = {
     { "2,345,678", "deux millions trois cent quarante-cinq mille six cent septante-huit" },
     { "-36", "moins trente-six" },
     { "234.567", "deux cent trente-quatre virgule cinq six sept" },
-    { NULL, NULL}
+    { nullptr, nullptr}
 };
 
 
@@ -1489,7 +1489,7 @@ IntlTestRBNF::TestItalianSpellout()
             { "15,943", "quindici\\u00ADmila\\u00ADnove\\u00ADcento\\u00ADquaranta\\u00ADtr\\u00E9" },
             { "-36", "meno trenta\\u00ADsei" },
             { "234.567", "due\\u00ADcento\\u00ADtrenta\\u00ADquattro virgola cinque sei sette" },
-            { NULL, NULL}
+            { nullptr, nullptr}
         };
         
         doTest(formatter, testData, true);
@@ -1528,7 +1528,7 @@ IntlTestRBNF::TestPortugueseSpellout()
             { "15,943", "quinze mil novecentos e quarenta e tr\\u00EAs" },
             { "-36", "menos trinta e seis" },
             { "234.567", "duzentos e trinta e quatro v\\u00EDrgula cinco seis sete" },
-            { NULL, NULL}
+            { nullptr, nullptr}
         };
         
         doTest(formatter, testData, true);
@@ -1563,7 +1563,7 @@ IntlTestRBNF::TestGermanSpellout()
             { "4,567", "vier\\u00ADtausend\\u00ADf\\u00fcnf\\u00ADhundert\\u00ADsieben\\u00ADund\\u00ADsechzig" },
             { "15,943", "f\\u00fcnfzehn\\u00ADtausend\\u00ADneun\\u00ADhundert\\u00ADdrei\\u00ADund\\u00ADvierzig" },
             { "2,345,678", "zwei Millionen drei\\u00ADhundert\\u00ADf\\u00fcnf\\u00ADund\\u00ADvierzig\\u00ADtausend\\u00ADsechs\\u00ADhundert\\u00ADacht\\u00ADund\\u00ADsiebzig" },
-            { NULL, NULL}
+            { nullptr, nullptr}
         };
         
         doTest(formatter, testData, true);
@@ -1572,7 +1572,7 @@ IntlTestRBNF::TestGermanSpellout()
         formatter->setLenient(true);
         static const char* lpTestData[][2] = {
             { "ein Tausend sechs Hundert fuenfunddreissig", "1,635" },
-            { NULL, NULL}
+            { nullptr, nullptr}
         };
         doLenientParseTest(formatter, lpTestData);
 #endif
@@ -1598,7 +1598,7 @@ IntlTestRBNF::TestThaiSpellout()
             { "21", "\\u0e22\\u0e35\\u0e48\\u200b\\u0e2a\\u0e34\\u0e1a\\u200b\\u0e40\\u0e2d\\u0e47\\u0e14" },
             { "101", "\\u0e2b\\u0e19\\u0e36\\u0e48\\u0e07\\u200b\\u0e23\\u0e49\\u0e2d\\u0e22\\u200b\\u0e2b\\u0e19\\u0e36\\u0e48\\u0e07" },
             { "1.234", "\\u0e2b\\u0e19\\u0e36\\u0e48\\u0e07\\u200b\\u0e08\\u0e38\\u0e14\\u200b\\u0e2a\\u0e2d\\u0e07\\u0e2a\\u0e32\\u0e21\\u0e2a\\u0e35\\u0e48" },
-            { NULL, NULL}
+            { nullptr, nullptr}
         };
         
         doTest(formatter, testData, true);
@@ -1629,7 +1629,7 @@ IntlTestRBNF::TestNorwegianSpellout()
             { "1,100", "tusen hundre" },
             { "6.789", "seks komma sju \\u00E5tte ni" },
             { "-5.678", "minus fem komma seks sju \\u00E5tte" },
-            { NULL, NULL }
+            { nullptr, nullptr }
         };
         doTest(noFormatter, testDataDefault, true);
         doTest(nbFormatter, testDataDefault, true);
@@ -1668,7 +1668,7 @@ IntlTestRBNF::TestSwedishSpellout()
             { "12,345,678", "tolv miljoner tre\\u00adhundra\\u00adfyrtio\\u00adfem\\u00adtusen sex\\u00adhundra\\u00adsjuttio\\u00ad\\u00e5tta" },
             { "123,456.789", "ett\\u00adhundra\\u00adtjugo\\u00adtre\\u00adtusen fyra\\u00adhundra\\u00adfemtio\\u00adsex komma sju \\u00e5tta nio" },
             { "-12,345.678", "minus tolv\\u00adtusen tre\\u00adhundra\\u00adfyrtio\\u00adfem komma sex sju \\u00e5tta" },
-            { NULL, NULL }
+            { nullptr, nullptr }
         };
         doTest(formatter, testDataDefault, true);
 
@@ -1678,7 +1678,7 @@ IntlTestRBNF::TestSwedishSpellout()
               { "1,101", "et\\u00adtusen ett\\u00adhundra\\u00adett" },
               { "10,001", "tio\\u00adtusen ett" },
               { "21,001", "tjugo\\u00adet\\u00adtusen ett" },
-              { NULL, NULL }
+              { nullptr, nullptr }
           };
   
           formatter->setDefaultRuleSet("%spellout-cardinal-neuter", status);
@@ -1699,7 +1699,7 @@ IntlTestRBNF::TestSwedishSpellout()
             { "1,234", "tolv\\u00adhundra\\u00adtrettio\\u00adfyra" },
             { "2,001", "tjugo\\u00adhundra\\u00adett" },
             { "10,001", "tio\\u00adtusen ett" },
-            { NULL, NULL }
+            { nullptr, nullptr }
         };
 
         status = U_ZERO_ERROR;
@@ -1758,7 +1758,7 @@ IntlTestRBNF::TestSmallValues()
         { "123.321", "one hundred twenty-three point three two one" },
         { "0.0000000011754944", "zero point zero zero zero zero zero zero zero zero one one seven five four nine four four" },
         { "0.000001175494351", "zero point zero zero zero zero zero one one seven five four nine four three five one" },
-        { NULL, NULL }
+        { nullptr, nullptr }
         };
 
         doTest(formatter, testDataDefault, true);
@@ -1786,7 +1786,7 @@ IntlTestRBNF::TestLocalizations(void)
                 { "5", "yah, some" },
                 { "423", "plenty" },
                 { "12345", "more'n you'll ever need" },
-                { NULL, NULL }
+                { nullptr, nullptr }
             };
             doTest(&formatter, testData, false);
         }
@@ -1798,7 +1798,7 @@ IntlTestRBNF::TestLocalizations(void)
                 { "5", "some" },
                 { "423", "a lot" },
                 { "12345", "tons" },
-                { NULL, NULL }
+                { nullptr, nullptr }
             };
             RuleBasedNumberFormat formatter0(rules, loc, perror, status);
             if (U_FAILURE(status)) {
@@ -2091,7 +2091,7 @@ void IntlTestRBNF::TestPluralRules() {
             { "22", "22nd" },
             { "23", "23rd" },
             { "24", "24th" },
-            { NULL, NULL }
+            { nullptr, nullptr }
     };
 
     doTest(&enFormatter, enTestData, true);
@@ -2152,7 +2152,7 @@ void IntlTestRBNF::TestPluralRules() {
             { "21,000", "twenty-one thousand" },
             { "22,000", "twenty-two thousands" },
             { "25,001", "twenty-five thousandss one" },
-            { NULL, NULL }
+            { nullptr, nullptr }
     };
 
     if (U_FAILURE(status)) {
@@ -2184,7 +2184,7 @@ void IntlTestRBNF::TestInfinityNaN() {
             {"\\u221E", "infinite"},
             {"-\\u221E", "minus infinite"},
             {"NaN", "not a number"},
-            { NULL, NULL }
+            { nullptr, nullptr }
     };
     if (U_FAILURE(status)) {
         dataerrln("Unable to create RuleBasedNumberFormat - " + UnicodeString(u_errorName(status)));
@@ -2207,7 +2207,7 @@ void IntlTestRBNF::TestInfinityNaN() {
             {"\\u221E", "\\u221E"},
             {"-\\u221E", "-\\u221E"},
             {"NaN", "NaN"},
-            { NULL, NULL }
+            { nullptr, nullptr }
     };
 
     doTest(&enFormatter2, enDefaultTestData, true);
@@ -2237,7 +2237,7 @@ void IntlTestRBNF::TestVariableDecimalPoint() {
             {"1.1", "one point one"},
             {"1.23", "one point two three"},
             {"0.4", "xpoint four"},
-            { NULL, NULL }
+            { nullptr, nullptr }
     };
     if (U_FAILURE(status)) {
         dataerrln("Unable to create RuleBasedNumberFormat - " + UnicodeString(u_errorName(status)));
@@ -2252,7 +2252,7 @@ void IntlTestRBNF::TestVariableDecimalPoint() {
             {"1.1", "one comma one"},
             {"1.23", "one comma two three"},
             {"0.4", "xcomma four"},
-            { NULL, NULL }
+            { nullptr, nullptr }
     };
     doTest(&enFormatter, enTestCommaData, true);
 }
@@ -2280,7 +2280,7 @@ void IntlTestRBNF::TestLargeNumbers() {
             {"9223372036854775806", "9,223,372,036,854,775,806"}, // Maximum 64-bit precision - 1
             {"9223372036854775807", "9,223,372,036,854,775,807"}, // Maximum 64-bit precision
             {"9223372036854775808", "9,223,372,036,854,775,808"}, // We've gone beyond 64-bit precision. This can only be represented with BigDecimal.
-            { NULL, NULL }
+            { nullptr, nullptr }
     };
     doTest(&rbnf, enTestFullData, false);
 }
@@ -2315,7 +2315,7 @@ void IntlTestRBNF::TestCompactDecimalFormatStyle() {
             {"10000000000000000", "10.00 Q"},  // Number doesn't precisely fit into a double
             {"9223372036854775807", "9223.00 Q"}, // Maximum 64-bit precision
             {"9223372036854775808", "9,223,372,036,854,775,808"}, // We've gone beyond 64-bit precision. This can only be represented with BigDecimal.
-            { NULL, NULL }
+            { nullptr, nullptr }
     };
     doTest(&rbnf, enTestFullData, false);
 }
index 62e97fa8bffb10fe86a4bbe5cb6138810b3581fa..2ad9c406613ead36562e9bfb6863440eee9aca68 100644 (file)
@@ -98,7 +98,7 @@ IntlTestRBNFParse::TestParse() {
     "===",
     "=foo=",
 
-    NULL,
+    nullptr,
   };
 
   // these rules would throw exceptions when formatting, if we could throw exceptions
@@ -107,14 +107,14 @@ IntlTestRBNFParse::TestParse() {
     "11: << x", // formatting a multiple of 10 causes rollback rule to fail
     "%%foo: 0 foo; 10: =%%bar=; %%bar: 0: bar; 10: =%%foo=;",
 
-    NULL,
+    nullptr,
   };
 
   // none of these rules should crash the formatter
   const char** allrules[] = {
     okrules,
     exceptrules,
-    NULL,
+    nullptr,
   };
 
   for (int j = 0; allrules[j]; ++j) {
index 9a74723f4f33fb7ba250e31dfbc02e2fd1130a4d..9abd6ed9f444bcb9b709d48eef0bb77a83833207 100644 (file)
@@ -341,7 +341,7 @@ U_DEFINE_LOCAL_OPEN_POINTER(LocalStdioFilePointer, FILE, fclose);
 //
 void IntlTestSpoof::testConfData() {
     char buffer[2000];
-    if (getUnidataPath(buffer) == NULL) {
+    if (getUnidataPath(buffer) == nullptr) {
         errln("Skipping test spoof/testConfData. Unable to find path to source/data/unidata/.");
         return;
     }
@@ -596,7 +596,7 @@ void IntlTestSpoof::testRestrictionLevel() {
             uspoof_setAllowedChars(sc, allowedChars.toUSet(), &status);
             uspoof_setRestrictionLevel(sc, levelSetInSpoofChecker);
             uspoof_setChecks(sc, USPOOF_RESTRICTION_LEVEL, &status);
-            int32_t actualValue = uspoof_checkUnicodeString(sc, testString, NULL, &status);
+            int32_t actualValue = uspoof_checkUnicodeString(sc, testString, nullptr, &status);
             
             // we want to fail if the text is (say) MODERATE and the testLevel is ASCII
             int32_t expectedValue = 0;
@@ -613,7 +613,7 @@ void IntlTestSpoof::testRestrictionLevel() {
             uspoof_setAllowedChars(sc, allowedChars.toUSet(), &status);
             uspoof_setRestrictionLevel(sc, levelSetInSpoofChecker);
             uspoof_setChecks(sc, USPOOF_AUX_INFO | USPOOF_RESTRICTION_LEVEL, &status);
-            int32_t result = uspoof_checkUnicodeString(sc, testString, NULL, &status);
+            int32_t result = uspoof_checkUnicodeString(sc, testString, nullptr, &status);
             TEST_ASSERT_SUCCESS(status);
             if (U_SUCCESS(status)) {
                 TEST_ASSERT_EQ(expectedLevel, result & USPOOF_RESTRICTION_LEVEL_MASK);
@@ -692,7 +692,7 @@ void IntlTestSpoof::testBug12825() {
     TEST_ASSERT_SUCCESS(status);
     uspoof_setChecks(sc.getAlias(), USPOOF_ALL_CHECKS | USPOOF_AUX_INFO, &status);
     TEST_ASSERT_SUCCESS(status);
-    uspoof_checkUnicodeString(sc.getAlias(), UnicodeString("\\u30FB").unescape(), NULL, &status);
+    uspoof_checkUnicodeString(sc.getAlias(), UnicodeString("\\u30FB").unescape(), nullptr, &status);
     TEST_ASSERT_SUCCESS(status);
 }
 
index 7eca31bb729899cdda591519127bf91733d59295..b03527de87e15ad07c2f07956766703716db0122 100644 (file)
@@ -22,7 +22,7 @@
 
 class IntlTestSpoof: public IntlTest {
 public:
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
     
     // Test the USpoofDetector API functions that require C++
     // The pure C part of the API, which is most of it, is tested in cintltst
index 0f9aeaa8e5fed90506294ebe0150c992bc56f307..08aeab23cc9ab7829003d78669ca6c60ba33ce4f 100644 (file)
@@ -25,7 +25,7 @@
 
 class IntlTestTransliterator: public IntlTest {
 public:
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 };
 
 #endif /* #if !UCONFIG_NO_TRANSLITERATION */
index 641abf194a3d1578a295daeef526e8600da3d0c7..b9106d8410f0eb014c1e57222b3fbdcaa5d4d53a 100644 (file)
@@ -312,7 +312,7 @@ class LocalPointerTest : public IntlTest {
 public:
     LocalPointerTest() {}
 
-    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=nullptr) override;
 
     void TestLocalPointer();
     void TestLocalPointerMoveSwap();
@@ -353,8 +353,8 @@ void LocalPointerTest::TestLocalPointer() {
     // constructor
     LocalPointer<UnicodeString> s(new UnicodeString((UChar32)0x50005));
     // isNULL(), isValid(), operator==(), operator!=()
-    if(s.isNull() || !s.isValid() || s==NULL || !(s!=NULL)) {
-        errln("LocalPointer constructor or NULL test failure");
+    if(s.isNull() || !s.isValid() || s==nullptr || !(s!=nullptr)) {
+        errln("LocalPointer constructor or nullptr test failure");
         return;
     }
     // getAlias(), operator->, operator*
@@ -367,7 +367,7 @@ void LocalPointerTest::TestLocalPointer() {
         errln("LocalPointer adoptInstead(U+FFFC) failure");
     }
     UnicodeString *orphan=s.orphan();
-    if(orphan==NULL || orphan->length()!=1 || s.isValid() || s!=NULL) {
+    if(orphan==nullptr || orphan->length()!=1 || s.isValid() || s!=nullptr) {
         errln("LocalPointer orphan() failure");
     }
     delete orphan;
@@ -376,7 +376,7 @@ void LocalPointerTest::TestLocalPointer() {
         errln("LocalPointer adoptInstead(empty) failure");
     }
 
-    // LocalPointer(p, errorCode) sets U_MEMORY_ALLOCATION_ERROR if p==NULL.
+    // LocalPointer(p, errorCode) sets U_MEMORY_ALLOCATION_ERROR if p==nullptr.
     UErrorCode errorCode = U_ZERO_ERROR;
     LocalPointer<CharString> csx(new CharString("some chars", errorCode), errorCode);
     if(csx.isNull() && U_SUCCESS(errorCode)) {
@@ -397,19 +397,19 @@ void LocalPointerTest::TestLocalPointer() {
         return;
     }
     errorCode = U_ZERO_ERROR;
-    csx.adoptInsteadAndCheckErrorCode(NULL, errorCode);
+    csx.adoptInsteadAndCheckErrorCode(nullptr, errorCode);
     if(errorCode != U_MEMORY_ALLOCATION_ERROR) {
-        errln("adoptInsteadAndCheckErrorCode(NULL, errorCode) did not set U_MEMORY_ALLOCATION_ERROR");
+        errln("adoptInsteadAndCheckErrorCode(nullptr, errorCode) did not set U_MEMORY_ALLOCATION_ERROR");
         return;
     }
     if(csx.isValid()) {
-        errln("adoptInsteadAndCheckErrorCode(NULL, errorCode) kept the object");
+        errln("adoptInsteadAndCheckErrorCode(nullptr, errorCode) kept the object");
         return;
     }
     errorCode = U_ZERO_ERROR;
-    LocalPointer<CharString> null(NULL, errorCode);
+    LocalPointer<CharString> null(nullptr, errorCode);
     if(errorCode != U_MEMORY_ALLOCATION_ERROR) {
-        errln("LocalPointer(NULL, errorCode) did not set U_MEMORY_ALLOCATION_ERROR");
+        errln("LocalPointer(nullptr, errorCode) did not set U_MEMORY_ALLOCATION_ERROR");
         return;
     }
 
@@ -487,7 +487,7 @@ void LocalPointerTest::TestLocalArray() {
         errln("LocalArray adoptInstead() failure");
     }
 
-    // LocalArray(p, errorCode) sets U_MEMORY_ALLOCATION_ERROR if p==NULL.
+    // LocalArray(p, errorCode) sets U_MEMORY_ALLOCATION_ERROR if p==nullptr.
     UErrorCode errorCode = U_ZERO_ERROR;
     LocalArray<UnicodeString> ua(new UnicodeString[3], errorCode);
     if(ua.isNull() && U_SUCCESS(errorCode)) {
@@ -509,19 +509,19 @@ void LocalPointerTest::TestLocalArray() {
         return;
     }
     errorCode = U_ZERO_ERROR;
-    ua.adoptInsteadAndCheckErrorCode(NULL, errorCode);
+    ua.adoptInsteadAndCheckErrorCode(nullptr, errorCode);
     if(errorCode != U_MEMORY_ALLOCATION_ERROR) {
-        errln("adoptInsteadAndCheckErrorCode(NULL, errorCode) did not set U_MEMORY_ALLOCATION_ERROR");
+        errln("adoptInsteadAndCheckErrorCode(nullptr, errorCode) did not set U_MEMORY_ALLOCATION_ERROR");
         return;
     }
     if(ua.isValid()) {
-        errln("adoptInsteadAndCheckErrorCode(NULL, errorCode) kept the array");
+        errln("adoptInsteadAndCheckErrorCode(nullptr, errorCode) kept the array");
         return;
     }
     errorCode = U_ZERO_ERROR;
-    LocalArray<UnicodeString> null(NULL, errorCode);
+    LocalArray<UnicodeString> null(nullptr, errorCode);
     if(errorCode != U_MEMORY_ALLOCATION_ERROR) {
-        errln("LocalArray(NULL, errorCode) did not set U_MEMORY_ALLOCATION_ERROR");
+        errln("LocalArray(nullptr, errorCode) did not set U_MEMORY_ALLOCATION_ERROR");
         return;
     }
 
@@ -593,7 +593,7 @@ void LocalPointerTest::TestLocalXyzPointer() {
 
     static const char *const encoding="ISO-8859-1";
     LocalUConverterSelectorPointer sel(
-        ucnvsel_open(&encoding, 1, NULL, UCNV_ROUNDTRIP_SET, errorCode));
+        ucnvsel_open(&encoding, 1, nullptr, UCNV_ROUNDTRIP_SET, errorCode));
     if(errorCode.errIfFailureAndReset("ucnvsel_open()")) {
         return;
     }
@@ -603,7 +603,7 @@ void LocalPointerTest::TestLocalXyzPointer() {
     }
 
 #if !UCONFIG_NO_FORMATTING
-    LocalUCalendarPointer cal(ucal_open(NULL, 0, "root", UCAL_GREGORIAN, errorCode));
+    LocalUCalendarPointer cal(ucal_open(nullptr, 0, "root", UCAL_GREGORIAN, errorCode));
     if(errorCode.errDataIfFailureAndReset("ucal_open()")) {
         return;
     }
@@ -632,7 +632,7 @@ void LocalPointerTest::TestLocalXyzPointer() {
 
     UnicodeString hello=UNICODE_STRING_SIMPLE("Hello {0}!");
     LocalUMessageFormatPointer msg(
-        umsg_open(hello.getBuffer(), hello.length(), "root", NULL, errorCode));
+        umsg_open(hello.getBuffer(), hello.length(), "root", nullptr, errorCode));
     if(errorCode.errIfFailureAndReset("umsg_open()")) {
         return;
     }
@@ -669,7 +669,7 @@ void LocalPointerTest::TestLocalXyzPointer() {
 #if !UCONFIG_NO_REGULAR_EXPRESSIONS
     UnicodeString pattern=UNICODE_STRING_SIMPLE("abc|xy+z");
     LocalURegularExpressionPointer regex(
-        uregex_open(pattern.getBuffer(), pattern.length(), 0, NULL, errorCode));
+        uregex_open(pattern.getBuffer(), pattern.length(), 0, nullptr, errorCode));
     if(errorCode.errIfFailureAndReset("uregex_open()")) {
         return;
     }
@@ -682,7 +682,7 @@ void LocalPointerTest::TestLocalXyzPointer() {
 #if !UCONFIG_NO_TRANSLITERATION
     UnicodeString id=UNICODE_STRING_SIMPLE("Grek-Latn");
     LocalUTransliteratorPointer trans(
-        utrans_openU(id.getBuffer(), id.length(), UTRANS_FORWARD, NULL, 0, NULL, errorCode));
+        utrans_openU(id.getBuffer(), id.length(), UTRANS_FORWARD, nullptr, 0, nullptr, errorCode));
     if(errorCode.errIfFailureAndReset("utrans_open()")) {
         return;
     }
@@ -745,38 +745,38 @@ void LocalPointerTest::TestLocalXyzPointerMoveSwap() {
 #endif /* !UCONFIG_NO_NORMALIZATION */
 }
 
-// Try LocalXyzPointer types with NULL pointers.
+// Try LocalXyzPointer types with nullptr pointers.
 void LocalPointerTest::TestLocalXyzPointerNull() {
     {
         IcuTestErrorCode errorCode(*this, "TestLocalXyzPointerNull/LocalUConverterSelectorPointer");
         static const char *const encoding="ISO-8859-1";
         LocalUConverterSelectorPointer null;
         LocalUConverterSelectorPointer sel(
-            ucnvsel_open(&encoding, 1, NULL, UCNV_ROUNDTRIP_SET, errorCode));
-        sel.adoptInstead(NULL);
+            ucnvsel_open(&encoding, 1, nullptr, UCNV_ROUNDTRIP_SET, errorCode));
+        sel.adoptInstead(nullptr);
     }
 #if !UCONFIG_NO_FORMATTING
     {
         IcuTestErrorCode errorCode(*this, "TestLocalXyzPointerNull/LocalUCalendarPointer");
         LocalUCalendarPointer null;
-        LocalUCalendarPointer cal(ucal_open(NULL, 0, "root", UCAL_GREGORIAN, errorCode));
+        LocalUCalendarPointer cal(ucal_open(nullptr, 0, "root", UCAL_GREGORIAN, errorCode));
         if(!errorCode.errDataIfFailureAndReset("ucal_open()")) {
-            cal.adoptInstead(NULL);
+            cal.adoptInstead(nullptr);
         }
     }
     {
         IcuTestErrorCode errorCode(*this, "TestLocalXyzPointerNull/LocalUDateTimePatternGeneratorPointer");
         LocalUDateTimePatternGeneratorPointer null;
         LocalUDateTimePatternGeneratorPointer patgen(udatpg_open("root", errorCode));
-        patgen.adoptInstead(NULL);
+        patgen.adoptInstead(nullptr);
     }
     {
         IcuTestErrorCode errorCode(*this, "TestLocalXyzPointerNull/LocalUMessageFormatPointer");
         UnicodeString hello=UNICODE_STRING_SIMPLE("Hello {0}!");
         LocalUMessageFormatPointer null;
         LocalUMessageFormatPointer msg(
-            umsg_open(hello.getBuffer(), hello.length(), "root", NULL, errorCode));
-        msg.adoptInstead(NULL);
+            umsg_open(hello.getBuffer(), hello.length(), "root", nullptr, errorCode));
+        msg.adoptInstead(nullptr);
     }
 #endif /* !UCONFIG_NO_FORMATTING */
 
@@ -786,9 +786,9 @@ void LocalPointerTest::TestLocalXyzPointerNull() {
         UnicodeString pattern=UNICODE_STRING_SIMPLE("abc|xy+z");
         LocalURegularExpressionPointer null;
         LocalURegularExpressionPointer regex(
-            uregex_open(pattern.getBuffer(), pattern.length(), 0, NULL, errorCode));
+            uregex_open(pattern.getBuffer(), pattern.length(), 0, nullptr, errorCode));
         if(!errorCode.errDataIfFailureAndReset("urege_open()")) {
-            regex.adoptInstead(NULL);
+            regex.adoptInstead(nullptr);
         }
     }
 #endif /* !UCONFIG_NO_REGULAR_EXPRESSIONS */
@@ -799,9 +799,9 @@ void LocalPointerTest::TestLocalXyzPointerNull() {
         UnicodeString id=UNICODE_STRING_SIMPLE("Grek-Latn");
         LocalUTransliteratorPointer null;
         LocalUTransliteratorPointer trans(
-            utrans_openU(id.getBuffer(), id.length(), UTRANS_FORWARD, NULL, 0, NULL, errorCode));
+            utrans_openU(id.getBuffer(), id.length(), UTRANS_FORWARD, nullptr, 0, nullptr, errorCode));
         if(!errorCode.errDataIfFailureAndReset("utrans_openU()")) {
-            trans.adoptInstead(NULL);
+            trans.adoptInstead(nullptr);
         }
     }
 #endif /* !UCONFIG_NO_TRANSLITERATION */
@@ -831,7 +831,7 @@ void LocalPointerTest::TestLocalXyzStdUniquePtr() {
 class EnumSetTest : public IntlTest {
 public:
   EnumSetTest() {}
-  virtual void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=NULL) override;
+  virtual void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=nullptr) override;
   void TestEnumSet();
 };
 
index 3968a140ac79c2f5fa404de4a4b4bdbdbecc5f8d..86c5615c907ba2aff37c2f0de6eaffd0d4171670 100644 (file)
 
 class IntlTestUtilities: public IntlTest {
 public:
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 };
 
 class ErrorCodeTest: public IntlTest {
 public:
-    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = nullptr) override;
     void TestErrorCode();
     void TestSubclass();
     void TestIcuTestErrorCode();
index a701aeda4f8600e3483b63f335c4bc456d99ce42..f2b614c09b5d1a3a50ceabedfad91cb6c9607d29 100644 (file)
@@ -27,7 +27,7 @@ CollationKanaTest::CollationKanaTest()
         errcheckln(status, __FILE__ "failed to create! err " + UnicodeString(u_errorName(status)));
         /* if it wasn't already: */
         delete myCollation;
-        myCollation = NULL;
+        myCollation = nullptr;
         return;
     }
 }
index e1aca114f5c94195b01452515d025eb943704b68..98e144ea21e155b43252aa144c0b25d8439ff130 100644 (file)
@@ -29,7 +29,7 @@ public:
 
     CollationKanaTest();
     virtual ~CollationKanaTest();
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     // performs test with strength TERIARY
     void TestTertiary(/* char* par */);
index 63925ab31439c68f17fb2d2367f5b7d3a98bb1ac..69d04537540366b31d879f8a4c3074b0dd49f924 100644 (file)
@@ -34,7 +34,7 @@ JamoTest::JamoTest()
 
     if (U_FAILURE(status)) {
         delete NAME_JAMO;
-        NAME_JAMO = NULL;
+        NAME_JAMO = nullptr;
     }
     status = U_ZERO_ERROR;
     JAMO_NAME = Transliterator::createFromRules("Jamo-Name",
@@ -42,7 +42,7 @@ JamoTest::JamoTest()
                                             UTRANS_REVERSE, parseError, status);
     if (U_FAILURE(status)) {
         delete JAMO_NAME;
-        JAMO_NAME = NULL;
+        JAMO_NAME = nullptr;
     }
 }
 
@@ -90,40 +90,40 @@ JamoTest::TestJamo() {
         // Jamo-Latin to yield output L2.
         
         // Column 3 is expected value of L2.  If the expected
-        // value of L2 is L1, then L2 is NULL.
+        // value of L2 is L1, then L2 is nullptr.
 
                 // add tests for the update to fix problems where it didn't follow the standard
                 // see also http://www.unicode.org/cldr/data/charts/transforms/Latin-Hangul.html
-                "gach", "(Gi)(A)(Cf)", NULL,
-                "geumhui", "(Gi)(EU)(Mf)(Hi)(YI)", NULL,
-                "choe", "(Ci)(OE)", NULL,
-                "wo", "(IEUNG)(WEO)", NULL,
+                "gach", "(Gi)(A)(Cf)", nullptr,
+                "geumhui", "(Gi)(EU)(Mf)(Hi)(YI)", nullptr,
+                "choe", "(Ci)(OE)", nullptr,
+                "wo", "(IEUNG)(WEO)", nullptr,
                 "Wonpil", "(IEUNG)(WEO)(Nf)(Pi)(I)(L)", "wonpil",
                 "GIPPEUM", "(Gi)(I)(BB)(EU)(Mf)", "gippeum",
                 "EUTTEUM", "(IEUNG)(EU)(DD)(EU)(Mf)", "eutteum",
                 "KKOTNAE", "(GGi)(O)(Tf)(Ni)(AE)", "kkotnae",
-                "gaga", "(Gi)(A)(Gi)(A)", NULL,
-                "gag-a", "(Gi)(A)(Gf)(IEUNG)(A)", NULL,
-                "gak-ka", "(Gi)(A)(Kf)(Ki)(A)", NULL,
-                "gakka", "(Gi)(A)(GGi)(A)", NULL,
-                "gakk-a", "(Gi)(A)(GGf)(IEUNG)(A)", NULL,
-                "gakkka", "(Gi)(A)(GGf)(Ki)(A)", NULL,
-                "gak-kka", "(Gi)(A)(Kf)(GGi)(A)", NULL,
-
-        "bab", "(Bi)(A)(Bf)", NULL,
+                "gaga", "(Gi)(A)(Gi)(A)", nullptr,
+                "gag-a", "(Gi)(A)(Gf)(IEUNG)(A)", nullptr,
+                "gak-ka", "(Gi)(A)(Kf)(Ki)(A)", nullptr,
+                "gakka", "(Gi)(A)(GGi)(A)", nullptr,
+                "gakk-a", "(Gi)(A)(GGf)(IEUNG)(A)", nullptr,
+                "gakkka", "(Gi)(A)(GGf)(Ki)(A)", nullptr,
+                "gak-kka", "(Gi)(A)(Kf)(GGi)(A)", nullptr,
+
+        "bab", "(Bi)(A)(Bf)", nullptr,
         "babb", "(Bi)(A)(Bf)(Bi)(EU)", "babbeu",
         "babbba", "(Bi)(A)(Bf)(Bi)(EU)(Bi)(A)", "babbeuba",
         "bagg", "(Bi)(A)(Gf)(Gi)(EU)", "baggeu",
         "baggga", "(Bi)(A)(Gf)(Gi)(EU)(Gi)(A)", "baggeuga",
         //"bag" SEP "gga", "(Bi)(A)(Gf)" SEP "(Gi)(EU)(Gi)(A)", "bag" SEP "geuga",
-        "kabsa", "(Ki)(A)(Bf)(Si)(A)", NULL,
-        "kabska", "(Ki)(A)(BS)(Ki)(A)", NULL,
+        "kabsa", "(Ki)(A)(Bf)(Si)(A)", nullptr,
+        "kabska", "(Ki)(A)(BS)(Ki)(A)", nullptr,
         "gabsbka", "(Gi)(A)(BS)(Bi)(EU)(Ki)(A)", "gabsbeuka", // not (Kf)
         "gga", "(Gi)(EU)(Gi)(A)", "geuga",
         "bsa", "(Bi)(EU)(Si)(A)", "beusa",
         "agg", "(IEUNG)(A)(Gf)(Gi)(EU)", "aggeu",
-        "agga", "(IEUNG)(A)(Gf)(Gi)(A)", NULL,
-        "la", "(R)(A)", NULL,
+        "agga", "(IEUNG)(A)(Gf)(Gi)(A)", nullptr,
+        "la", "(R)(A)", nullptr,
         "bs", "(Bi)(EU)(Sf)", "beus",
         "kalgga", "(Ki)(A)(L)(Gi)(EU)(Gi)(A)", "kalgeuga",
         
@@ -136,7 +136,7 @@ JamoTest::TestJamo() {
     int32_t i;
     for (i=0; i<CASE_length; i+=3) {
         UnicodeString jamo = nameToJamo(CASE[i+1]);
-        if (CASE[i+2] == NULL) {
+        if (CASE[i+2] == nullptr) {
             expect(*latinJamo, CASE[i], jamo, *jamoLatin);
         } else {
             // Handle case where round-trip is expected to fail
@@ -159,7 +159,7 @@ void JamoTest::TestPiecemeal(void) {
     UnicodeString latin("mic");
     UnicodeString latin2("mich");
 
-    Transliterator *t = NULL;
+    Transliterator *t = nullptr;
     UErrorCode status = U_ZERO_ERROR;
 
     t = Transliterator::createInstance("NFD", UTRANS_FORWARD, status); // was Hangul-Jamo
@@ -379,13 +379,13 @@ JamoTest::TestRealText() {
     if (latinJamo == 0 || jamoHangul == 0 || U_FAILURE(status)) {
         delete latinJamo;
         delete jamoHangul;
-        dataerrln("FAIL: createInstance returned NULL - %s", u_errorName(status));
+        dataerrln("FAIL: createInstance returned nullptr - %s", u_errorName(status));
         return;
     }
     Transliterator* jamoLatin = latinJamo->createInverse(status);
     Transliterator* hangulJamo = jamoHangul->createInverse(status);
     if (jamoLatin == 0 || hangulJamo == 0) {
-        errln("FAIL: createInverse returned NULL");
+        errln("FAIL: createInverse returned nullptr");
         delete latinJamo;
         delete jamoLatin;
         delete jamoHangul;
index 5fab2d125b162c558310d597ec2166f729b4b898..b0e7df354fd587eb8b65a96ae804b72c67c9b24c 100644 (file)
@@ -31,7 +31,7 @@ public:
     virtual ~JamoTest();
 private:
     void runIndexedTest(int32_t index, UBool exec, const char* &name,
-                        char* par=NULL) override;
+                        char* par=nullptr) override;
 
     void TestJamo(void);
     
index 658c1eea55db34cbbaccd9e0a85ddbc572132999..952b17fd416a091d0d8e3b97fc2e0907640b3a07 100644 (file)
@@ -24,7 +24,7 @@ public:
 
     LotusCollationKoreanTest();
     virtual ~LotusCollationKoreanTest();
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     // performs test with strength TERIARY
     void TestTertiary(/* char* par */);
index b8f0b9951bde9095cd282667acb8c4009a7fd462..43d930e2e431dc9663a5328edf72876feb880a57 100644 (file)
@@ -13,7 +13,7 @@ class LocaleBuilderTest: public IntlTest {
     LocaleBuilderTest();
     virtual ~LocaleBuilderTest();
 
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     void TestAddRemoveUnicodeLocaleAttribute(void);
     void TestAddRemoveUnicodeLocaleAttributeWellFormed(void);
index 07382efbf0ba4e1276ab6e0a103e9e6c28e65524..44fee4eddb73f5f7c3ef37c0478e1363ca698c5c 100644 (file)
@@ -51,7 +51,7 @@ class LocaleMatcherTest : public IntlTest {
 public:
     LocaleMatcherTest() {}
 
-    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=nullptr) override;
 
     void testEmpty();
     void testCopyErrorTo();
index 811988b5ac56186719666cdc4d2b610e94d5096d..47dd10b2ff75bea28a61c0cdaed0e1a8de95df6c 100644 (file)
@@ -170,11 +170,11 @@ void LocaleDisplayNamesTest::TestUldnOpen() {
   UnicodeString str(result, len, kMaxResultSize);
   test_assert_equal("Deutsch (Deutschland)", str);
 
-  // make sure that NULL gives us the default locale as usual
-  ldn = uldn_open(NULL, ULDN_STANDARD_NAMES, &status);
+  // make sure that nullptr gives us the default locale as usual
+  ldn = uldn_open(nullptr, ULDN_STANDARD_NAMES, &status);
   const char *locale = uldn_getLocale(ldn);
   if(0 != uprv_strcmp(uloc_getDefault(), locale)) {
-    errln("uldn_getLocale(uldn_open(NULL))=%s != default locale %s\n", locale, uloc_getDefault());
+    errln("uldn_getLocale(uldn_open(nullptr))=%s != default locale %s\n", locale, uloc_getDefault());
   }
   uldn_close(ldn);
   test_assert(U_SUCCESS(status));
@@ -363,12 +363,12 @@ static const LocNameDispContextItem ctxtItems[] = {
     { "es", UDISPCTX_DIALECT_NAMES,  UDISPCTX_CAPITALIZATION_FOR_STANDALONE,            UDISPCTX_LENGTH_FULL,   en_GB, esFor_en_GB_DT },
     { "ru", UDISPCTX_STANDARD_NAMES, UDISPCTX_CAPITALIZATION_FOR_STANDALONE,            UDISPCTX_LENGTH_FULL,   uz_Latn, ruFor_uz_Latn_T },
  #endif /* #if !UCONFIG_NO_BREAK_ITERATION */
-    { NULL, (UDisplayContext)0,      (UDisplayContext)0,                                (UDisplayContext)0,     NULL,  NULL }
+    { nullptr, (UDisplayContext)0,      (UDisplayContext)0,                                (UDisplayContext)0,     nullptr,  nullptr }
 };
 
 void LocaleDisplayNamesTest::TestUldnDisplayContext() {
     const LocNameDispContextItem * ctxtItemPtr;
-    for (ctxtItemPtr = ctxtItems; ctxtItemPtr->displayLocale != NULL; ctxtItemPtr++) {
+    for (ctxtItemPtr = ctxtItems; ctxtItemPtr->displayLocale != nullptr; ctxtItemPtr++) {
         UDisplayContext contexts[3] = {ctxtItemPtr->dialectHandling, ctxtItemPtr->capitalization, ctxtItemPtr->displayLength};
         UErrorCode status = U_ZERO_ERROR;
         ULocaleDisplayNames * uldn = uldn_openForContext(ctxtItemPtr->displayLocale, contexts, 3, &status);
index f8cefb6e37ac8e056904b691415b8cc76d334351..0679638407cd0a6c300daa327018717c6f4ff91b 100644 (file)
@@ -17,7 +17,7 @@ public:
     LocaleDisplayNamesTest();
     virtual ~LocaleDisplayNamesTest();
 
-    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = nullptr) override;
 
 #if !UCONFIG_NO_FORMATTING
     /**
index cf9b76c5ddaaa266a476084639d1f7701b74561e..0e12f03eed4963983fe9e0168ed6b816efdc2eaa 100644 (file)
@@ -180,7 +180,7 @@ static const char* const rawData[33][8] = {
 } UPRV_BLOCK_MACRO_END
 
 LocaleTest::LocaleTest()
-: dataTable(NULL)
+: dataTable(nullptr)
 {
     setUpDataTable();
 }
@@ -371,8 +371,8 @@ void LocaleTest::TestBasicGetters() {
     if (temp != UnicodeString("") )
         errln("Variant code mismatch: " + temp + "  versus \"\"");
 
-    if (Locale::getDefault() != Locale::createFromName(NULL))
-        errln("Locale::getDefault() == Locale::createFromName(NULL)");
+    if (Locale::getDefault() != Locale::createFromName(nullptr))
+        errln("Locale::getDefault() == Locale::createFromName(nullptr)");
 
     /*----------*/
     // NOTE: There used to be a special test for locale names that had language or
@@ -1250,7 +1250,7 @@ LocaleTest::TestEuroSupport()
                             "nl_BE",
                             "nl_NL",
                             "pt_PT",
-                            NULL
+                            nullptr
                         };
     const char** locales = localeArr;
 
@@ -1258,7 +1258,7 @@ LocaleTest::TestEuroSupport()
 
     UnicodeString temp;
 
-    for (;*locales!=NULL;locales++) {
+    for (;*locales!=nullptr;locales++) {
         Locale loc (*locales);
         UnicodeString temp;
         NumberFormat *nf = NumberFormat::createCurrencyInstance(loc, status);
@@ -1313,7 +1313,7 @@ LocaleTest::TestEuroSupport()
     }
     int32_t invalidLen = ucurr_forLocale("en_QQ", tmp, 4, &status);
     if (invalidLen || U_SUCCESS(status)) {
-        errln("Fail: en_QQ didn't return NULL");
+        errln("Fail: en_QQ didn't return nullptr");
     }
 
     // The currency keyword value is as long as the destination buffer.
@@ -1471,7 +1471,7 @@ LocaleTest::Test4147315()
     const char *result = locale.getISO3Country();
 
     // Change to conform to C api usage
-    if((result==NULL)||(result[0] != 0))
+    if((result==nullptr)||(result[0] != 0))
       errln("ERROR: getISO3Country() returns: " + UnicodeString(result,"") +
                 " for locale '" + (temp=locale.getName()) + "' rather than exception" );
 }
@@ -1492,7 +1492,7 @@ LocaleTest::Test4147317()
     const char *result = locale.getISO3Language();
 
     // Change to conform to C api usage
-    if((result==NULL)||(result[0] != 0))
+    if((result==nullptr)||(result[0] != 0))
       errln("ERROR: getISO3Language() returns: " + UnicodeString(result,"") +
                 " for locale '" + (temp=locale.getName()) + "' rather than exception" );
 }
@@ -3897,10 +3897,10 @@ LocaleTest::TestKeywordVariants(void) {
     UErrorCode status = U_ZERO_ERROR;
 
     int32_t i = 0, j = 0;
-    const char *result = NULL;
+    const char *result = nullptr;
     StringEnumeration *keywords;
     int32_t keyCount = 0;
-    const char *keyword = NULL;
+    const char *keyword = nullptr;
     const UnicodeString *keywordString;
     int32_t keywordLen = 0;
 
@@ -3921,14 +3921,14 @@ LocaleTest::TestKeywordVariants(void) {
             if(keyCount) {
                 for(j = 0;;) {
                     if((j&1)==0) {
-                        if((keyword = keywords->next(&keywordLen, status)) == NULL) {
+                        if((keyword = keywords->next(&keywordLen, status)) == nullptr) {
                             break;
                         }
                         if(strcmp(keyword, testCases[i].expectedKeywords[j]) != 0) {
                             err("Expected to get keyword value %s, got %s\n", testCases[i].expectedKeywords[j], keyword);
                         }
                     } else {
-                        if((keywordString = keywords->snext(status)) == NULL) {
+                        if((keywordString = keywords->snext(status)) == nullptr) {
                             break;
                         }
                         if(*keywordString != UnicodeString(testCases[i].expectedKeywords[j], "")) {
@@ -3940,7 +3940,7 @@ LocaleTest::TestKeywordVariants(void) {
                     if(j == keyCount / 2) {
                         // replace keywords with a clone of itself
                         StringEnumeration *k2 = keywords->clone();
-                        if(k2 == NULL || keyCount != k2->count(status)) {
+                        if(k2 == nullptr || keyCount != k2->count(status)) {
                             errln("KeywordEnumeration.clone() failed");
                         } else {
                             delete keywords;
@@ -3950,7 +3950,7 @@ LocaleTest::TestKeywordVariants(void) {
                 }
                 keywords->reset(status); // Make sure that reset works.
                 for(j = 0;;) {
-                    if((keyword = keywords->next(&keywordLen, status)) == NULL) {
+                    if((keyword = keywords->next(&keywordLen, status)) == nullptr) {
                         break;
                     }
                     if(strcmp(keyword, testCases[i].expectedKeywords[j]) != 0) {
@@ -4431,7 +4431,7 @@ void LocaleTest::TestGetLocale(void) {
             dataerrln("FAIL: NumberFormat::createInstance failed - %s", u_errorName(ec));
         } else {
             DecimalFormat* dec = dynamic_cast<DecimalFormat*>(nf);
-            if (dec == NULL) {
+            if (dec == nullptr) {
                 errln("FAIL: NumberFormat::createInstance does not return a DecimalFormat");
                 return;
             }
@@ -4444,8 +4444,8 @@ void LocaleTest::TestGetLocale(void) {
             }
 
             const DecimalFormatSymbols* sym = dec->getDecimalFormatSymbols();
-            if (sym == NULL) {
-                errln("FAIL: getDecimalFormatSymbols returned NULL");
+            if (sym == nullptr) {
+                errln("FAIL: getDecimalFormatSymbols returned nullptr");
                 return;
             }
             valid = sym->getLocale(ULOC_VALID_LOCALE, ec);
@@ -4472,7 +4472,7 @@ void LocaleTest::TestGetLocale(void) {
             dataerrln("Error calling DateFormat::createDateInstance()");
         } else {
             SimpleDateFormat* dat = dynamic_cast<SimpleDateFormat*>(df);
-            if (dat == NULL) {
+            if (dat == nullptr) {
                 errln("FAIL: DateFormat::createInstance does not return a SimpleDateFormat");
                 return;
             }
@@ -4485,8 +4485,8 @@ void LocaleTest::TestGetLocale(void) {
             }
     
             const DateFormatSymbols* sym = dat->getDateFormatSymbols();
-            if (sym == NULL) {
-                errln("FAIL: getDateFormatSymbols returned NULL");
+            if (sym == nullptr) {
+                errln("FAIL: getDateFormatSymbols returned nullptr");
                 return;
             }
             valid = sym->getLocale(ULOC_VALID_LOCALE, ec);
@@ -4571,7 +4571,7 @@ void LocaleTest::TestGetLocale(void) {
     {
         UErrorCode ec = U_ZERO_ERROR;  // give each resource type its own error code
 
-        checkRegisteredCollators(NULL); // Don't expect any extras
+        checkRegisteredCollators(nullptr); // Don't expect any extras
 
         req = "hi_IN_BHOPAL";
         reqLoc = Locale::createFromName(req);
@@ -4634,7 +4634,7 @@ void LocaleTest::TestGetLocale(void) {
         }
         delete coll;
 
-        checkRegisteredCollators(NULL); // extra should be gone again
+        checkRegisteredCollators(nullptr); // extra should be gone again
     }
 #endif
 #endif
@@ -4645,9 +4645,9 @@ void LocaleTest::TestGetLocale(void) {
  * Compare Collator::getAvailableLocales(int) [ "old", returning an array ]
  *   with  Collator::getAvailableLocales()    [ "new", returning a StringEnumeration ]
  * These should be identical (check their API docs) EXCEPT that
- * if expectExtra is non-NULL, it will be in the "new" array but not "old".
+ * if expectExtra is non-nullptr, it will be in the "new" array but not "old".
  * Does not return any status but calls errln on error.
- * @param expectExtra an extra locale, will be in "new" but not "old". Or NULL.
+ * @param expectExtra an extra locale, will be in "new" but not "old". Or nullptr.
  */
 void LocaleTest::checkRegisteredCollators(const char *expectExtra) {
     UErrorCode status = U_ZERO_ERROR;
@@ -4660,15 +4660,15 @@ void LocaleTest::checkRegisteredCollators(const char *expectExtra) {
 
     // the 'old' list (non enumeration)
     const Locale*  oldList = Collator::getAvailableLocales(count1);
-    if(oldList == NULL) {
-        dataerrln("Error: Collator::getAvailableLocales(count) returned NULL");
+    if(oldList == nullptr) {
+        dataerrln("Error: Collator::getAvailableLocales(count) returned nullptr");
         return;
     }
 
     // the 'new' list (enumeration)
     LocalPointer<StringEnumeration> newEnum(Collator::getAvailableLocales());
     if(newEnum.isNull()) {
-       errln("Error: collator::getAvailableLocales() returned NULL");
+       errln("Error: collator::getAvailableLocales() returned nullptr");
        return;
     }
 
@@ -4685,7 +4685,7 @@ void LocaleTest::checkRegisteredCollators(const char *expectExtra) {
                 oldList[i].getName());
             return;
         }
-        if(expectExtra != NULL && !strcmp(expectExtra, oldList[i].getName())) {
+        if(expectExtra != nullptr && !strcmp(expectExtra, oldList[i].getName())) {
             errln("Inexplicably, Collator::getAvailableCollators(count) had registered collator %s. This shouldn't happen, so I am going to consider it an error.\n", expectExtra);
         }
     }
@@ -4696,14 +4696,14 @@ void LocaleTest::checkRegisteredCollators(const char *expectExtra) {
     while((locStr = newEnum->snext(status)) && U_SUCCESS(status)) {
         count2++;
 
-        if(expectExtra != NULL && expectStr == *locStr) {
+        if(expectExtra != nullptr && expectStr == *locStr) {
             foundExpected = true;
             logln(UnicodeString("Found expected registered collator: ","") + expectStr);
         }
         (void)foundExpected;    // Hush unused variable compiler warning.
 
         if( oldHash.geti(*locStr) == 0 ) {
-            if(expectExtra != NULL && expectStr==*locStr) {
+            if(expectExtra != nullptr && expectStr==*locStr) {
                 logln(UnicodeString("As expected, Collator::getAvailableLocales(count) is missing registered collator ") + expectStr);
             } else {
                 errln(UnicodeString("Error: Collator::getAvailableLocales(count) is missing: ","")
@@ -4724,7 +4724,7 @@ void LocaleTest::checkRegisteredCollators(const char *expectExtra) {
     }
 
     int32_t expectCount2 = count1;
-    if(expectExtra != NULL) {
+    if(expectExtra != nullptr) {
         expectCount2 ++; // if an extra item registered, bump the expect count
     }
 
@@ -5072,7 +5072,7 @@ void LocaleTest::TestCurrencyByDate(void)
        }
     resLen = ucurr_forLocaleAndDate("eo_AM", date, index, TMP, 4, &status);
     if (resLen != 0) {
-               errcheckln(status, "FAIL: eo_AM didn't return NULL - %s", u_errorName(status));
+               errcheckln(status, "FAIL: eo_AM didn't return nullptr - %s", u_errorName(status));
     }
     status = U_ZERO_ERROR;
 
@@ -5213,20 +5213,20 @@ void LocaleTest::TestCurrencyByDate(void)
        }
     resLen = ucurr_forLocaleAndDate("eo_UA", date, index, TMP, 4, &status);
     if (resLen != 0) {
-               errcheckln(status, "FAIL: eo_UA didn't return NULL - %s", u_errorName(status));
+               errcheckln(status, "FAIL: eo_UA didn't return nullptr - %s", u_errorName(status));
     }
     status = U_ZERO_ERROR;
 
        // Test index bounds
     resLen = ucurr_forLocaleAndDate("eo_UA", date, 100, TMP, 4, &status);
     if (resLen != 0) {
-               errcheckln(status, "FAIL: eo_UA didn't return NULL - %s", u_errorName(status));
+               errcheckln(status, "FAIL: eo_UA didn't return nullptr - %s", u_errorName(status));
     }
     status = U_ZERO_ERROR;
 
     resLen = ucurr_forLocaleAndDate("eo_UA", date, 0, TMP, 4, &status);
     if (resLen != 0) {
-               errcheckln(status, "FAIL: eo_UA didn't return NULL - %s", u_errorName(status));
+               errcheckln(status, "FAIL: eo_UA didn't return nullptr - %s", u_errorName(status));
     }
     status = U_ZERO_ERROR;
 
@@ -5239,12 +5239,12 @@ void LocaleTest::TestCurrencyByDate(void)
     status = U_ZERO_ERROR;
     resLen = ucurr_forLocaleAndDate("eo_QQ", date, 1, TMP, 4, &status);
     if (resLen != 0) {
-               errcheckln(status, "FAIL: eo_QQ didn't return NULL - %s", u_errorName(status));
+               errcheckln(status, "FAIL: eo_QQ didn't return nullptr - %s", u_errorName(status));
     }
     status = U_ZERO_ERROR;
     resLen = ucurr_forLocaleAndDate("eo_QQ", date, 0, TMP, 4, &status);
     if (resLen != 0) {
-               errcheckln(status, "FAIL: eo_QQ didn't return NULL - %s", u_errorName(status));
+               errcheckln(status, "FAIL: eo_QQ didn't return nullptr - %s", u_errorName(status));
     }
     status = U_ZERO_ERROR;
 
@@ -5321,7 +5321,7 @@ void LocaleTest::TestCurrencyByDate(void)
        }
     resLen = ucurr_forLocaleAndDate("eo_AO", date, 1, TMP, 4, &status);
     if (resLen != 0) {
-               errcheckln(status, "FAIL: eo_AO didn't return NULL - %s", u_errorName(status));
+               errcheckln(status, "FAIL: eo_AO didn't return nullptr - %s", u_errorName(status));
     }
     status = U_ZERO_ERROR;
 
@@ -5510,7 +5510,7 @@ void LocaleTest::TestLocaleCanonicalizationFromFile()
     }
     // Format:
     // <source locale identifier>      ;       <expected canonicalized locale identifier>
-    while (fgets(line, (int)sizeof(line), testFile.getAlias())!=NULL) {
+    while (fgets(line, (int)sizeof(line), testFile.getAlias())!=nullptr) {
         if (line[0] == '#') {
             // ignore any lines start with #
             continue;
@@ -5687,7 +5687,7 @@ void LocaleTest::TestForLanguageTagLegacyTagBug21676() {
       "i-enochian-1nochian-129-515VNTR-64863775-X3il6-110Y101-29-515VNTR-"
       "64863775-153zu-u-Y4-H0-t6-X3-u6-110Y101-X");
   std::string input(tag);
-  input += "EXTRA MEMORY AFTER NON-NULL TERMINATED STRING";
+  input += "EXTRA MEMORY AFTER NON-nullptr TERMINATED STRING";
   StringPiece stringp(input.c_str(), tag.length());
   std::string name = Locale::forLanguageTag(stringp, status).getName();
   std::string expected(
index 2a8ed56760d2b13e5db44954fdbc39a7ed8cef83..e9eb2113c710c92bed451b314f32310498e05ac7 100644 (file)
@@ -17,7 +17,7 @@ public:
     LocaleTest();
     virtual ~LocaleTest();
     
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     /**
      * Test methods to set and get data fields
@@ -234,6 +234,6 @@ private:
      * Check on registered collators.
      * @param expectExtra if non-null, the locale ID of an 'extra' locale that is registered.
      */
-    void checkRegisteredCollators(const char *expectExtra = NULL);
+    void checkRegisteredCollators(const char *expectExtra = nullptr);
 #endif
 };
index 39bc6174b8bc18296f44d45edde1e384acdf08db..072c4693fb0d52eff53d87f7400e15bc3bd0ec06 100644 (file)
@@ -42,7 +42,7 @@ void LSTMBETest::runIndexedTest( int32_t index, UBool exec, const char* &name, c
 //--------------------------------------------------------------------------------------
 
 LSTMBETest::LSTMBETest() {
-    fTestParams = NULL;
+    fTestParams = nullptr;
 }
 
 
index dd675ceae682a3570c9e59516c9ab6c89bdad9d9..a5da3c9e83bc8ee1bd1c66db8453320fafbe4bc1 100644 (file)
@@ -30,7 +30,7 @@ public:
     LSTMBETest();
     virtual ~LSTMBETest();
 
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     void TestThaiGraphclust();
     void TestThaiCodepoints();
index 9f8b5b0203a18e09ed9a839a6fa23b175ca41a7f..40a05b19a15816a1fbb67ee7923a86373fd60c3b 100644 (file)
@@ -3486,7 +3486,7 @@ void MeasureFormatTest::TestBasic() {
 }
 
 void MeasureFormatTest::TestGetAvailable() {
-    MeasureUnit *units = NULL;
+    MeasureUnit *units = nullptr;
     UErrorCode status = U_ZERO_ERROR;
     int32_t totalCount = MeasureUnit::getAvailable(units, 0, status);
     while (status == U_BUFFER_OVERFLOW_ERROR) {
@@ -3513,13 +3513,13 @@ void MeasureFormatTest::TestGetAvailable() {
     if (types->count(status) < 10) {
         errln("Expect at least 10 distinct unit types.");
     }
-    units = NULL;
+    units = nullptr;
     int32_t unitCapacity = 0;
     int32_t unitCountSum = 0;
     for (
-            const char* type = types->next(NULL, status);
-            type != NULL;
-            type = types->next(NULL, status)) {
+            const char* type = types->next(nullptr, status);
+            type != nullptr;
+            type = types->next(nullptr, status)) {
         int32_t unitCount = MeasureUnit::getAvailable(type, units, unitCapacity, status);
         while (status == U_BUFFER_OVERFLOW_ERROR) {
             status = U_ZERO_ERROR;
@@ -4086,7 +4086,7 @@ void MeasureFormatTest::TestFormatSingleArg() {
 void MeasureFormatTest::TestFormatMeasuresZeroArg() {
     UErrorCode status = U_ZERO_ERROR;
     MeasureFormat fmt("en", UMEASFMT_WIDTH_WIDE, status);
-    verifyFormat("TestFormatMeasuresZeroArg", fmt, NULL, 0, "");
+    verifyFormat("TestFormatMeasuresZeroArg", fmt, nullptr, 0, "");
 }
 
 void MeasureFormatTest::TestSimplePer() {
index 9c47aa3d843178a29b41047cfca04bd76802f913..55dea60812ea5a8cf721a29e6a7c2e1ec147987b 100644 (file)
@@ -78,7 +78,7 @@ void CollationMonkeyTest::TestCollationKey(/* char* par */)
         return;
     }
 
-    srand( (unsigned)time( NULL ) );
+    srand( (unsigned)time( nullptr ) );
     int32_t s = checkValue(rand() % source.length());
     int32_t t = checkValue(rand() % source.length());
     int32_t slen = checkValue((rand() - source.length()) % source.length());
@@ -153,7 +153,7 @@ CollationMonkeyTest::TestCompare(/* char* par */)
     /* Seed the random-number generator with current time so that
      * the numbers will be different every time we run.
      */
-    srand( (unsigned)time( NULL ) );
+    srand( (unsigned)time( nullptr ) );
     int32_t s = checkValue(rand() % source.length());
     int32_t t = checkValue(rand() % source.length());
     int32_t slen = checkValue((rand() - source.length()) % source.length());
index 2730bce0010a1fc5ecd32a322010ced2a110629d..2eb5e04464057fac156e7496d72b1fb4ff751539 100644 (file)
@@ -30,7 +30,7 @@ public:
 
     CollationMonkeyTest();
     virtual ~CollationMonkeyTest();
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     // utility function used in tests, returns absolute value
     int32_t checkValue(int32_t value);
index 067c1238228a273f86e6e091929b0f0ed6d6e717..7b217c07b71512d92b676510aee3a96c7ce05aee 100644 (file)
@@ -114,15 +114,15 @@ void MessageFormatRegressionTest::Test4074764() {
         failure(status, "messageFormatter->applyPattern");
 
         // {sfb} how much does this apply in C++?
-        // do we want to verify that the Formattable* array is not NULL,
+        // do we want to verify that the Formattable* array is not nullptr,
         // or is that the user's responsibility?
         // additionally, what should be the item count?
         // for bug testing purposes, assume that something was set to
-        // NULL by mistake, and that the length should be non-zero
+        // nullptr by mistake, and that the length should be non-zero
 
-        //tempBuffer = messageFormatter->format(NULL, 1, tempBuffer, FieldPosition(FieldPosition::DONT_CARE), status);
+        //tempBuffer = messageFormatter->format(nullptr, 1, tempBuffer, FieldPosition(FieldPosition::DONT_CARE), status);
         tempBuffer.remove();
-        tempBuffer = messageFormatter->format(NULL, 0, tempBuffer, pos, status);
+        tempBuffer = messageFormatter->format(nullptr, 0, tempBuffer, pos, status);
 
         if( tempBuffer != "Message without param" || failure(status, "messageFormat->format"))
             errln("MessageFormat with no param test failed.");
@@ -205,7 +205,7 @@ void MessageFormatRegressionTest::Test4031438()
         ParsePosition pp(0);
         int32_t count = 0;
         Formattable *objs = messageFormatter->parse(tempBuffer, pp, count);
-        //if(objs[7/*params.length*/] != NULL)
+        //if(objs[7/*params.length*/] != nullptr)
         //    errln("Parse failed with more than expected arguments");
 
         NumberFormat *fmt = 0;
@@ -243,7 +243,7 @@ void MessageFormatRegressionTest::Test4031438()
                 }
             }
 
-            //if (objs[i] != NULL && objs[i].getString(temp1) != params[i].getString(temp2)) {
+            //if (objs[i] != nullptr && objs[i].getString(temp1) != params[i].getString(temp2)) {
             if (temp != temp1) {
                 errln("Parse failed on object " + objs[i].getString(temp1) + " at index : " + i);
             }
@@ -344,7 +344,7 @@ void MessageFormatRegressionTest::Test4104976()
     failure(status, "new ChoiceFormat");
     //try {
         log("Compares to null is always false, returned : ");
-        logln(cf == NULL ? "true" : "false");
+        logln(cf == nullptr ? "true" : "false");
     /*} catch (Exception foo) {
         errln("ChoiceFormat.equals(null) throws exception.");
     }*/
@@ -368,7 +368,7 @@ void MessageFormatRegressionTest::Test4106659()
     UnicodeString formats [] = {
         "one", "two"
     };
-    ChoiceFormat *cf = NULL;
+    ChoiceFormat *cf = nullptr;
     //try {
     //    cf = new ChoiceFormat(limits, formats, 3);
     //} catch (Exception foo) {
@@ -496,7 +496,7 @@ void MessageFormatRegressionTest::Test4116444()
         Formattable *array = mf->parse(UnicodeString(""), pp, count);
             logln("pattern: \"" + pattern + "\"");
             log(" parsedObjects: ");
-            if (array != NULL) {
+            if (array != nullptr) {
                 log("{");
                 for (int j = 0; j < count; j++) {
                     //if (array[j] != null)
@@ -533,9 +533,9 @@ void MessageFormatRegressionTest::Test4114739()
     MessageFormat *mf = new MessageFormat("<{0}>", status);
     failure(status, "new MessageFormat");
 
-    Formattable *objs1 = NULL;
+    Formattable *objs1 = nullptr;
     //Formattable objs2 [] = {};
-    //Formattable *objs3 [] = {NULL};
+    //Formattable *objs3 [] = {nullptr};
     //try {
     UnicodeString pat;
     UnicodeString res;
@@ -717,7 +717,7 @@ void MessageFormatRegressionTest::Test4118592()
         UnicodeString pat;
         logln(UnicodeString("") + i + ". pattern :\"" + mf->toPattern(pat) + "\"");
         log(" \"" + formatted + "\" parsed as ");
-        if (objs == NULL)
+        if (objs == nullptr)
             logln("  null");
         else {
             UnicodeString temp;
@@ -771,7 +771,7 @@ void MessageFormatRegressionTest::Test4118594()
     pp.setIndex(0);
     Formattable *newobjs = mf->parse(result, pp, count1);
     // newobjs now equals {new Double(3.1)}
-    if (newobjs == NULL) {
+    if (newobjs == nullptr) {
         dataerrln("Error calling MessageFormat::parse");
     } else {
         if (newobjs[0].getDouble() != 3.1)
@@ -844,7 +844,7 @@ void MessageFormatRegressionTest::Test4120552()
         int32_t count = 0;
         Formattable *objs = mf->parse(texts[i], pp, count);
         log("  text for parsing: \"" + texts[i] + "\"");
-        if (objs == NULL) {
+        if (objs == nullptr) {
             logln("  (incorrectly formatted string)");
             if (pp.getErrorIndex() == -1)
                 errln(UnicodeString("Incorrect error index: ") + pp.getErrorIndex());
@@ -977,7 +977,7 @@ void MessageFormatRegressionTest::Test4112104()
     failure(status, "new MessageFormat");
     //try {
         // This should NOT throw an exception
-        if (format == NULL) {
+        if (format == nullptr) {
             // It also should return false
             errln("MessageFormat.equals(null) returns false");
         }
index a8b8f649e7f17dbaf9732f913fc9c0e86a3fd092..41dcabb6b272bf9165ad37c4e51b8fd9fcde46ef 100644 (file)
@@ -102,7 +102,7 @@ void IntlTestNumberFormatAPI::testAPI(/* char* par */)
     }
 
 // ======= Test equality
-if (per_fr != NULL && cur_fr != NULL)
+if (per_fr != nullptr && cur_fr != nullptr)
 {
     logln("Testing equality operator");
     
@@ -112,7 +112,7 @@ if (per_fr != NULL && cur_fr != NULL)
 }
 
 // ======= Test various format() methods
-if (cur_fr != NULL)
+if (cur_fr != nullptr)
 {
     logln("Testing various format() methods");
 
@@ -152,7 +152,7 @@ if (cur_fr != NULL)
 }
 
 // ======= Test parse()
-if (fr != NULL)
+if (fr != nullptr)
 {
     logln("Testing parse()");
 
@@ -184,7 +184,7 @@ if (fr != NULL)
 }
 
 // ======= Test getters and setters
-if (fr != NULL && def != NULL)
+if (fr != nullptr && def != nullptr)
 {
     logln("Testing getters and setters");
 
@@ -276,7 +276,7 @@ public:
         if (formatType == UNUM_CURRENCY) {
             return currencyStyle->clone();
         }
-        return NULL;
+        return nullptr;
     }
 
    virtual inline UClassID getDynamicClassID() const override
@@ -312,8 +312,8 @@ IntlTestNumberFormatAPI::testRegistration()
 
     LocalPointer<StringEnumeration> locs(NumberFormat::getAvailableLocales());
 
-    LocalUNumberFormatPointer uf3(unum_open(UNUM_CURRENCY, NULL, 0, SRC_LOC.getName(), NULL, &status));
-    LocalUNumberFormatPointer uf4(unum_open(UNUM_DEFAULT, NULL, 0, SRC_LOC.getName(), NULL, &status));
+    LocalUNumberFormatPointer uf3(unum_open(UNUM_CURRENCY, nullptr, 0, SRC_LOC.getName(), nullptr, &status));
+    LocalUNumberFormatPointer uf4(unum_open(UNUM_DEFAULT, nullptr, 0, SRC_LOC.getName(), nullptr, &status));
 
     const UnicodeString* res;
     for (res = locs->snext(status); res; res = locs->snext(status)) {
@@ -322,7 +322,7 @@ IntlTestNumberFormatAPI::testRegistration()
 
     NumberFormat::unregister(key, status); // restore for other tests
     LocalPointer<NumberFormat> f5(NumberFormat::createCurrencyInstance(SRC_LOC, status));
-    LocalUNumberFormatPointer uf5(unum_open(UNUM_CURRENCY, NULL, 0, SRC_LOC.getName(), NULL, &status));
+    LocalUNumberFormatPointer uf5(unum_open(UNUM_CURRENCY, nullptr, 0, SRC_LOC.getName(), nullptr, &status));
 
     if (U_FAILURE(status)) {
         dataerrln("Error creating instances.");
@@ -341,9 +341,9 @@ IntlTestNumberFormatAPI::testRegistration()
         f4->format(n, res4);
         f5->format(n, res5);
 
-        unum_formatDouble(uf3.getAlias(), n, ures3, 50, NULL, &status);
-        unum_formatDouble(uf4.getAlias(), n, ures4, 50, NULL, &status);
-        unum_formatDouble(uf5.getAlias(), n, ures5, 50, NULL, &status);
+        unum_formatDouble(uf3.getAlias(), n, ures3, 50, nullptr, &status);
+        unum_formatDouble(uf4.getAlias(), n, ures4, 50, nullptr, &status);
+        unum_formatDouble(uf5.getAlias(), n, ures5, 50, nullptr, &status);
 
         logln((UnicodeString)"f0 swap int: " + res0);
         logln((UnicodeString)"f1 src int: " + res1);
index be0f051b3d9b4734707a4804a5b658cb28960275..5928427cd03da4641be98e6dfb2ee48750c0c18d 100644 (file)
@@ -20,7 +20,7 @@
  *  This test executes basic functionality checks of various API functions
  **/
 class IntlTestNumberFormatAPI: public IntlTest {
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
 private:
     /**
index 0b0f312e1511eb1159afefc44f6fb67f13b1c128..6111ad25e2584ef82fbd13acb3ac8716842e4680 100644 (file)
@@ -92,7 +92,7 @@ NumberFormatRoundTripTest::start()
 
     UErrorCode status = U_ZERO_ERROR;
 
-    NumberFormat *fmt = NULL;
+    NumberFormat *fmt = nullptr;
 
     logln("Default Locale");
 
@@ -186,7 +186,7 @@ NumberFormatRoundTripTest::test(NumberFormat *fmt)
         // the double will stay in range.
         //if(fmt->getMultipler() == 1)
         DecimalFormat *df = dynamic_cast<DecimalFormat *>(fmt);
-        if(df != NULL)
+        if(df != nullptr)
         {
 #if !(U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400)
             /* DBL_MAX/2 is here because randomDouble does a *2 in the math */
@@ -234,7 +234,7 @@ NumberFormatRoundTripTest::test(NumberFormat *fmt, const Formattable& value)
 {
     fmt->setMaximumFractionDigits(999);
     DecimalFormat *df = dynamic_cast<DecimalFormat *>(fmt);
-    if(df != NULL) {
+    if(df != nullptr) {
         df->setRoundingIncrement(0.0);
     }
     UErrorCode status = U_ZERO_ERROR;
index a0697d81925ed5bb213a7c17f855fa828f9557f9..e29fae9f058c55912d6a3695edde1908f145c3db 100644 (file)
@@ -75,12 +75,12 @@ NormalizerConformanceTest::openNormalizationTestFile(const char *filename) {
 
     // look inside ICU_DATA first
     folder=pathToDataDirectory();
-    if(folder!=NULL) {
+    if(folder!=nullptr) {
         strcpy(unidataPath, folder);
         strcat(unidataPath, "unidata" U_FILE_SEP_STRING);
         strcat(unidataPath, filename);
         input=T_FileStream_open(unidataPath, "rb");
-        if(input!=NULL) {
+        if(input!=nullptr) {
             return input;
         }
     }
@@ -95,7 +95,7 @@ NormalizerConformanceTest::openNormalizationTestFile(const char *filename) {
                      U_FILE_SEP_STRING "data" U_FILE_SEP_STRING "unidata" U_FILE_SEP_STRING);
         strcat(unidataPath, filename);
         input=T_FileStream_open(unidataPath, "rb");
-        if(input!=NULL) {
+        if(input!=nullptr) {
             return input;
         }
     }
@@ -108,7 +108,7 @@ NormalizerConformanceTest::openNormalizationTestFile(const char *filename) {
         strcat(unidataPath, U_FILE_SEP_STRING);
         strcat(unidataPath, filename);
         input=T_FileStream_open(unidataPath, "rb");
-        if(input!=NULL) {
+        if(input!=nullptr) {
             return input;
         }
     }
@@ -121,7 +121,7 @@ NormalizerConformanceTest::openNormalizationTestFile(const char *filename) {
         strcat(unidataPath, U_FILE_SEP_STRING ".." U_FILE_SEP_STRING ".." U_FILE_SEP_STRING);
         strcat(unidataPath, filename);
         input=T_FileStream_open(unidataPath, "rb");
-        if(input!=NULL) {
+        if(input!=nullptr) {
             return input;
         }
     }
@@ -131,20 +131,20 @@ NormalizerConformanceTest::openNormalizationTestFile(const char *filename) {
     strcpy(unidataPath, U_TOPSRCDIR U_FILE_SEP_STRING "data" U_FILE_SEP_STRING "unidata" U_FILE_SEP_STRING);
     strcat(unidataPath, filename);
     input=T_FileStream_open(unidataPath, "rb");
-    if(input!=NULL) {
+    if(input!=nullptr) {
         return input;
     }
 
     strcpy(unidataPath, U_TOPSRCDIR U_FILE_SEP_STRING "test" U_FILE_SEP_STRING "testdata" U_FILE_SEP_STRING);
     strcat(unidataPath, filename);
     input=T_FileStream_open(unidataPath, "rb");
-    if(input!=NULL) {
+    if(input!=nullptr) {
         return input;
     }
 #endif
 
     dataerrln("Failed to open %s", filename);
-    return NULL;
+    return nullptr;
 }
 
 /**
@@ -168,7 +168,7 @@ void NormalizerConformanceTest::TestConformance(FileStream *input, int32_t optio
     int32_t failCount = 0;
     UChar32 c;
 
-    if(input==NULL) {
+    if(input==nullptr) {
         return;
     }
 
@@ -598,7 +598,7 @@ UBool NormalizerConformanceTest::assertEqual(const char *op, const char *op2,
 UBool NormalizerConformanceTest::hexsplit(const char *s, char delimiter,
                                           UnicodeString output[], int32_t outputLength) {
     const char *t = s;
-    char *end = NULL;
+    char *end = nullptr;
     UChar32 c;
     int32_t i;
     for (i=0; i<outputLength; ++i) {
index 8fc12909e2582070faca8f0110001cac83e244c6..b027783bf6e080bfcb3ac413db66000961515f5e 100644 (file)
@@ -28,7 +28,7 @@ class NormalizerConformanceTest : public IntlTest {
     NormalizerConformanceTest();
     virtual ~NormalizerConformanceTest();
 
-    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=nullptr) override;
 
     /**
      * Test the conformance of Normalizer to
index ac158f25c2632af9e474cf8cf18cc1ffaaff065b..d94ceba49fdfa541553eeedf44cc05346c4adacb 100644 (file)
@@ -40,7 +40,7 @@ NamePrepTransform* NamePrepTransform::createInstance(UParseError& parseError, UE
     NamePrepTransform* transform = new NamePrepTransform(parseError, status);
     if(U_FAILURE(status)){
         delete transform;
-        return NULL;
+        return nullptr;
     }
     return transform;
 }
@@ -127,11 +127,11 @@ UBool NamePrepTransform::isProhibited(UChar32 ch){
 
 NamePrepTransform::~NamePrepTransform(){
     delete mapping;
-    mapping = NULL;
+    mapping = nullptr;
     
     //close the bundle
     ures_close(bundle);
-    bundle = NULL;
+    bundle = nullptr;
 }
 
 
@@ -145,7 +145,7 @@ int32_t NamePrepTransform::map(const UChar* src, int32_t srcLength,
         return 0;
     }
     //check arguments
-    if(src==NULL || srcLength<-1 || (dest==NULL && destCapacity!=0)) {
+    if(src==nullptr || srcLength<-1 || (dest==nullptr && destCapacity!=0)) {
         status=U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -191,7 +191,7 @@ int32_t NamePrepTransform::process( const UChar* src, int32_t srcLength,
     }
     
     //check arguments
-    if(src==NULL || srcLength<-1 || (dest==NULL && destCapacity!=0)) {
+    if(src==nullptr || srcLength<-1 || (dest==nullptr && destCapacity!=0)) {
         status=U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
index 18ceb194f39df6cca1d2531cd1f32c86873ebf32..dc2af235e46dbc34e9082c91e60beda583bd1526 100644 (file)
@@ -6003,7 +6003,7 @@ void NumberFormatterApiTest::microPropsInternals() {
     MicroProps copyConstructed(mp);
     MicroProps copyAssigned;
     int64_t *resizeResult = mp.mixedMeasures.resize(4, 4);
-    assertTrue("Resize success", resizeResult != NULL);
+    assertTrue("Resize success", resizeResult != nullptr);
     copyAssigned = mp;
 
     assertTrue("MicroProps success status", U_SUCCESS(mp.mixedMeasures.status));
index e520c28cc33ef16579125dcf82c7071aa0a8f459..e205fadb39df7f0601995d995cb93ee399f37947 100644 (file)
@@ -194,12 +194,12 @@ static void adjustDecimalFormat(const NumberFormatTestTuple& tuple, DecimalForma
 static DecimalFormat*
 newDecimalFormat(const Locale& locale, const UnicodeString& pattern, UErrorCode& status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     LocalPointer<DecimalFormatSymbols> symbols(
             new DecimalFormatSymbols(locale, status), status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     UParseError perror;
     LocalPointer<DecimalFormat> result(
@@ -209,14 +209,14 @@ newDecimalFormat(const Locale& locale, const UnicodeString& pattern, UErrorCode&
         symbols.orphan();
     }
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     return result.orphan();
 }
 
 static DecimalFormat* newDecimalFormat(const NumberFormatTestTuple& tuple, UErrorCode& status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     Locale en("en");
     return newDecimalFormat(NFTT_GET_FIELD(tuple, locale, en),
index 12fd9c09af18ec8ae453532cf5c5c4b23ff5ac76..a53e2c09af62a102ac2b76c180f1cc800a4d6bb1 100644 (file)
@@ -39,7 +39,7 @@ static NumberFormat *nfWithPattern(const char *pattern) {
     DecimalFormat *result = new DecimalFormat(
             upattern, new DecimalFormatSymbols("fr", status), status);
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
     return result;
@@ -101,7 +101,7 @@ void NumberFormatSpecificationTest::TestBasicPatterns() {
 
 void NumberFormatSpecificationTest::TestNfSetters() {
     LocalPointer<NumberFormat> nf(nfWithPattern("#,##0.##"));
-    if (nf == NULL) {
+    if (nf == nullptr) {
         dataerrln("Error creating NumberFormat");
         return;
     }
index 2e18592d308cbe339bb2d63d2a09a78548857384..35a4e222b701bd4332015f4ee78559efac0ac94a 100644 (file)
@@ -268,7 +268,7 @@ NumberFormatTest::TestAPI(void)
   if(U_FAILURE(status)) {
     dataerrln("unable to create format object - %s", u_errorName(status));
   }
-  if(test != NULL) {
+  if(test != nullptr) {
     test->setMinimumIntegerDigits(10);
     test->setMaximumIntegerDigits(1);
 
@@ -333,7 +333,7 @@ public:
         static char classID = 0;
         return (UClassID)&classID;
     }
-    virtual StubNumberFormat* clone() const override {return NULL;}
+    virtual StubNumberFormat* clone() const override {return nullptr;}
 };
 
 void
@@ -1144,7 +1144,7 @@ NumberFormatTest::TestLenientParse(void)
     DecimalFormat *format = new DecimalFormat("(#,##0)", status);
     Formattable n;
 
-    if (format == NULL || U_FAILURE(status)) {
+    if (format == nullptr || U_FAILURE(status)) {
         dataerrln("Unable to create DecimalFormat (#,##0) - %s", u_errorName(status));
     } else {
         format->setLenient(true);
@@ -1169,7 +1169,7 @@ NumberFormatTest::TestLenientParse(void)
 
     NumberFormat *mFormat = NumberFormat::createInstance(sv_SE, UNUM_DECIMAL, status);
 
-    if (mFormat == NULL || U_FAILURE(status)) {
+    if (mFormat == nullptr || U_FAILURE(status)) {
         dataerrln("Unable to create NumberFormat (sv_SE, UNUM_DECIMAL) - %s", u_errorName(status));
     } else {
         mFormat->setLenient(true);
@@ -1190,7 +1190,7 @@ NumberFormatTest::TestLenientParse(void)
 
     mFormat = NumberFormat::createInstance(en_US, UNUM_DECIMAL, status);
 
-    if (mFormat == NULL || U_FAILURE(status)) {
+    if (mFormat == nullptr || U_FAILURE(status)) {
         dataerrln("Unable to create NumberFormat (en_US, UNUM_DECIMAL) - %s", u_errorName(status));
     } else {
         mFormat->setLenient(true);
@@ -1211,7 +1211,7 @@ NumberFormatTest::TestLenientParse(void)
 
     NumberFormat *cFormat = NumberFormat::createInstance(en_US, UNUM_CURRENCY, status);
 
-    if (cFormat == NULL || U_FAILURE(status)) {
+    if (cFormat == nullptr || U_FAILURE(status)) {
         dataerrln("Unable to create NumberFormat (en_US, UNUM_CURRENCY) - %s", u_errorName(status));
     } else {
         cFormat->setLenient(true);
@@ -1248,7 +1248,7 @@ NumberFormatTest::TestLenientParse(void)
 
     NumberFormat *pFormat = NumberFormat::createPercentInstance(en_US, status);
 
-    if (pFormat == NULL || U_FAILURE(status)) {
+    if (pFormat == nullptr || U_FAILURE(status)) {
         dataerrln("Unable to create NumberFormat::createPercentInstance (en_US) - %s", u_errorName(status));
     } else {
         pFormat->setLenient(true);
@@ -1289,7 +1289,7 @@ NumberFormatTest::TestLenientParse(void)
    // lenient parse.
    NumberFormat *nFormat = NumberFormat::createInstance(en_US, status);
 
-   if (nFormat == NULL || U_FAILURE(status)) {
+   if (nFormat == nullptr || U_FAILURE(status)) {
        dataerrln("Unable to create NumberFormat (en_US) - %s", u_errorName(status));
    } else {
        // first, make sure that they fail with a strict parse
@@ -1935,7 +1935,7 @@ void NumberFormatTest::TestCurrencyPatterns(void) {
 
             // Make sure EURO currency formats have exactly 2 fraction digits
             DecimalFormat* df = dynamic_cast<DecimalFormat*>(nf);
-            if (df != NULL) {
+            if (df != nullptr) {
                 if (u_strcmp(EUR, df->getCurrency()) == 0) {
                     if (min != 2 || max != 2) {
                         UnicodeString a;
@@ -2710,7 +2710,7 @@ void NumberFormatTest::TestCases() {
                     if (!tokens.next(tok, ec)) goto error;
                     continue;
                 }
-            } else if (mfmt == NULL) {
+            } else if (mfmt == nullptr) {
                 errln("FAIL: " + where + "Loc \"" + mloc + "\": skip case using previous locale, no valid MeasureFormat");
                 if (!tokens.next(tok, ec)) goto error;
                 if (!tokens.next(tok, ec)) goto error;
@@ -2855,7 +2855,7 @@ void NumberFormatTest::expect2(NumberFormat& fmt, const Formattable& n, const Un
 void NumberFormatTest::expect2(NumberFormat* fmt, const Formattable& n,
                                const UnicodeString& exp,
                                UErrorCode status) {
-    if (fmt == NULL || U_FAILURE(status)) {
+    if (fmt == nullptr || U_FAILURE(status)) {
         dataerrln("FAIL: NumberFormat constructor");
     } else {
         expect2(*fmt, n, exp);
@@ -2978,7 +2978,7 @@ void NumberFormatTest::expect(NumberFormat& fmt, const Formattable& n,
 void NumberFormatTest::expect(NumberFormat* fmt, const Formattable& n,
                               const UnicodeString& exp, UBool rt,
                               UErrorCode status) {
-    if (fmt == NULL || U_FAILURE(status)) {
+    if (fmt == nullptr || U_FAILURE(status)) {
         dataerrln("FAIL: NumberFormat constructor");
     } else {
         expect(*fmt, n, exp, rt);
@@ -3212,7 +3212,7 @@ void NumberFormatTest::TestHostClone()
     Locale loc("en_US@compat=host");
     UDate now = Calendar::getNow();
     NumberFormat *full = NumberFormat::createInstance(loc, status);
-    if (full == NULL || U_FAILURE(status)) {
+    if (full == nullptr || U_FAILURE(status)) {
         dataerrln("FAIL: Can't create NumberFormat date instance - %s", u_errorName(status));
         return;
     }
@@ -3220,7 +3220,7 @@ void NumberFormatTest::TestHostClone()
     full->format(now, result1, status);
     Format *fullClone = full->clone();
     delete full;
-    full = NULL;
+    full = nullptr;
 
     UnicodeString result2;
     fullClone->format(now, result2, status);
@@ -3256,7 +3256,7 @@ void NumberFormatTest::TestCurrencyFormat()
         return;
     }
     cloneObj = measureObj->clone();
-    if (cloneObj == NULL) {
+    if (cloneObj == nullptr) {
         errln("Clone doesn't work");
         return;
     }
@@ -3286,8 +3286,8 @@ void NumberFormatTest::TestCurrencyFormat()
     delete cloneObj;
 
     status = U_USELESS_COLLATOR_ERROR;
-    if (MeasureFormat::createCurrencyFormat(status) != NULL) {
-        errln("createCurrencyFormat should have returned NULL.");
+    if (MeasureFormat::createCurrencyFormat(status) != nullptr) {
+        errln("createCurrencyFormat should have returned nullptr.");
     }
 }
 
@@ -3550,13 +3550,13 @@ void NumberFormatTest::TestNumberingSystems() {
         { "zh_TW@numbers=native", 1234.567, false, "\\u4e00,\\u4e8c\\u4e09\\u56db.\\u4e94\\u516d\\u4e03" },
         { "zh_TW@numbers=traditional", 1234.567, true, "\\u4E00\\u5343\\u4E8C\\u767E\\u4E09\\u5341\\u56DB\\u9EDE\\u4E94\\u516D\\u4E03" },
         { "zh_TW@numbers=finance", 1234.567, true, "\\u58F9\\u4EDF\\u8CB3\\u4F70\\u53C3\\u62FE\\u8086\\u9EDE\\u4F0D\\u9678\\u67D2" },
-        { NULL, 0, false, NULL }
+        { nullptr, 0, false, nullptr }
     };
 
     UErrorCode ec;
 
     const TestNumberingSystemItem *item;
-    for (item = DATA; item->localeName != NULL; item++) {
+    for (item = DATA; item->localeName != nullptr; item++) {
         ec = U_ZERO_ERROR;
         Locale loc = Locale::createFromName(item->localeName);
 
@@ -3594,16 +3594,16 @@ void NumberFormatTest::TestNumberingSystems() {
         dataerrln("FAIL: NumberingSystem::createInstance(ec); - %s", u_errorName(ec));
     }
 
-    if ( ns != NULL ) {
+    if ( ns != nullptr ) {
         ns->getDynamicClassID();
         ns->getStaticClassID();
     } else {
-        errln("FAIL: getInstance() returned NULL.");
+        errln("FAIL: getInstance() returned nullptr.");
     }
 
     NumberingSystem *ns1 = new NumberingSystem(*ns);
-    if (ns1 == NULL) {
-        errln("FAIL: NumberSystem copy constructor returned NULL.");
+    if (ns1 == nullptr) {
+        errln("FAIL: NumberSystem copy constructor returned nullptr.");
     }
 
     delete ns1;
@@ -3717,7 +3717,7 @@ NumberFormatTest::TestCurrencyFormatForMixParsing() {
         "US dollars1,234.56",
         // "1,234.56 US dollars" // Fails in 62 because currency format is not compatible with pattern.
     };
-    const CurrencyAmount* curramt = NULL;
+    const CurrencyAmount* curramt = nullptr;
     for (uint32_t i = 0; i < UPRV_LENGTHOF(formats); ++i) {
         UnicodeString stringToBeParsed = ctou(formats[i]);
         logln(UnicodeString("stringToBeParsed: ") + stringToBeParsed);
@@ -3727,7 +3727,7 @@ NumberFormatTest::TestCurrencyFormatForMixParsing() {
         if (U_FAILURE(status)) {
           errln("FAIL: measure format parsing: '%s' ec: %s", formats[i], u_errorName(status));
         } else if (result.getType() != Formattable::kObject ||
-            (curramt = dynamic_cast<const CurrencyAmount*>(result.getObject())) == NULL ||
+            (curramt = dynamic_cast<const CurrencyAmount*>(result.getObject())) == nullptr ||
             curramt->getNumber().getDouble() != 1234.56 ||
             UnicodeString(curramt->getISOCurrency()).compare(ISO_CURRENCY_USD)
         ) {
@@ -6619,7 +6619,7 @@ NumberFormatTest::TestParseCurrencyInUCurr() {
       UnicodeString formatted = ctou(WRONG_DATA[i]);
       UErrorCode status = U_ZERO_ERROR;
       NumberFormat* numFmt = NumberFormat::createInstance(locale, UNUM_CURRENCY, status);
-      if (numFmt != NULL && U_SUCCESS(status)) {
+      if (numFmt != nullptr && U_SUCCESS(status)) {
           ParsePosition parsePos;
           LocalPointer<CurrencyAmount> currAmt(numFmt->parseCurrency(formatted, parsePos));
           if (parsePos.getIndex() > 0) {
@@ -6727,7 +6727,7 @@ void NumberFormatTest::TestFieldPositionIterator() {
 
   // should format ok with no iterator
   str2.remove();
-  decFmt->format(num, str2, NULL, status);
+  decFmt->format(num, str2, nullptr, status);
   assertEquals("null fpiter", str1, str2);
 
   delete decFmt;
@@ -6892,12 +6892,12 @@ void NumberFormatTest::TestDecimal() {
     {
         UErrorCode status = U_ZERO_ERROR;
         NumberFormat *fmtr = NumberFormat::createInstance(Locale::getUS(), UNUM_DECIMAL, status);
-        if (U_FAILURE(status) || fmtr == NULL) {
+        if (U_FAILURE(status) || fmtr == nullptr) {
             dataerrln("Unable to create NumberFormat");
         } else {
             UnicodeString formattedResult;
             StringPiece num("244444444444444444444444444444444444446.4");
-            fmtr->format(num, formattedResult, NULL, status);
+            fmtr->format(num, formattedResult, nullptr, status);
             ASSERT_SUCCESS(status);
             ASSERT_EQUALS("244,444,444,444,444,444,444,444,444,444,444,444,446.4", formattedResult);
             //std::string ss; std::cout << formattedResult.toUTF8String(ss);
@@ -6910,7 +6910,7 @@ void NumberFormatTest::TestDecimal() {
         // a critical interface that must work.
         UErrorCode status = U_ZERO_ERROR;
         NumberFormat *fmtr = NumberFormat::createInstance(Locale::getUS(), UNUM_DECIMAL, status);
-        if (U_FAILURE(status) || fmtr == NULL) {
+        if (U_FAILURE(status) || fmtr == nullptr) {
             dataerrln("Unable to create NumberFormat");
         } else {
             UnicodeString formattedResult;
@@ -6918,7 +6918,7 @@ void NumberFormatTest::TestDecimal() {
             StringPiece num("123.4566666666666666666666666666666666621E+40");
             dl.setToDecNumber(num, status);
             ASSERT_SUCCESS(status);
-            fmtr->format(dl, formattedResult, NULL, status);
+            fmtr->format(dl, formattedResult, nullptr, status);
             ASSERT_SUCCESS(status);
             ASSERT_EQUALS("1,234,566,666,666,666,666,666,666,666,666,666,666,621,000", formattedResult);
 
@@ -6941,7 +6941,7 @@ void NumberFormatTest::TestDecimal() {
         // Check a parse with a formatter with a multiplier.
         UErrorCode status = U_ZERO_ERROR;
         NumberFormat *fmtr = NumberFormat::createInstance(Locale::getUS(), UNUM_PERCENT, status);
-        if (U_FAILURE(status) || fmtr == NULL) {
+        if (U_FAILURE(status) || fmtr == nullptr) {
             dataerrln("Unable to create NumberFormat");
         } else {
             UnicodeString input = "1.84%";
@@ -6963,7 +6963,7 @@ void NumberFormatTest::TestDecimal() {
         // Check that a parse returns a decimal number with full accuracy
         UErrorCode status = U_ZERO_ERROR;
         NumberFormat *fmtr = NumberFormat::createInstance(Locale::getUS(), UNUM_DECIMAL, status);
-        if (U_FAILURE(status) || fmtr == NULL) {
+        if (U_FAILURE(status) || fmtr == nullptr) {
             dataerrln("Unable to create NumberFormat");
         } else {
             UnicodeString input = "1.002200044400088880000070000";
@@ -6987,7 +6987,7 @@ void NumberFormatTest::TestCurrencyFractionDigits() {
 
     // Create currenct instance
     NumberFormat* fmt = NumberFormat::createCurrencyInstance("ja_JP", status);
-    if (U_FAILURE(status) || fmt == NULL) {
+    if (U_FAILURE(status) || fmt == nullptr) {
         dataerrln("Unable to create NumberFormat");
     } else {
         fmt->format(value, text1);
@@ -7142,7 +7142,7 @@ NumberFormatTest::Test9087(void)
 
     UChar outputbuf[50] = {0};
     UErrorCode status = U_ZERO_ERROR;
-    UNumberFormat* fmt = unum_open(UNUM_PATTERN_DECIMAL,pattern,1,NULL,NULL,&status);
+    UNumberFormat* fmt = unum_open(UNUM_PATTERN_DECIMAL,pattern,1,nullptr,nullptr,&status);
     if ( U_FAILURE(status) ) {
         dataerrln("FAIL: error in unum_open() - %s", u_errorName(status));
         return;
@@ -7302,8 +7302,8 @@ UBool NumberFormatTest::testFormattableAsUFormattable(const char *file, int line
 
   UFormattable *u = f.toUFormattable();
   logln();
-  if (u == NULL) {
-    errln("%s:%d: Error: f.toUFormattable() retuned NULL.");
+  if (u == nullptr) {
+    errln("%s:%d: Error: f.toUFormattable() retuned nullptr.");
     return false;
   }
   logln("%s:%d: comparing Formattable with UFormattable", file, line);
@@ -7341,7 +7341,7 @@ UBool NumberFormatTest::testFormattableAsUFormattable(const char *file, int line
       const UChar* uch = ufmt_getUChars(u, &len, &valueStatus);
       if(U_SUCCESS(valueStatus)) {
         UnicodeString str2(uch, len);
-        assertTrue("UChar* NULL-terminated", uch[len]==0);
+        assertTrue("UChar* NUL-terminated", uch[len]==0);
         exactMatch = (str == str2);
       }
       triedExact = true;
@@ -7795,11 +7795,11 @@ void NumberFormatTest::TestParseSignsAndMarks() {
         { "ps",                 true,   CharsToUnicodeString("-\\u200E\\u06F6\\u06F7"),                 -67 },
         { "ps",                 true,   CharsToUnicodeString("-\\u200E \\u06F6\\u06F7"),                -67 },
         // terminator
-        { NULL,                 0,      UnicodeString(""),                                                0 },
+        { nullptr,                 0,      UnicodeString(""),                                                0 },
     };
 
     const SignsAndMarksItem * itemPtr;
-    for (itemPtr = items; itemPtr->locale != NULL; itemPtr++ ) {
+    for (itemPtr = items; itemPtr->locale != nullptr; itemPtr++ ) {
         UErrorCode status = U_ZERO_ERROR;
         NumberFormat *numfmt = NumberFormat::createInstance(Locale(itemPtr->locale), status);
         if (U_SUCCESS(status)) {
@@ -8463,7 +8463,7 @@ void NumberFormatTest::TestFormatCurrencyPlural() {
         return;
     }
    UnicodeString formattedNum;
-   fmt->format(11234.567, formattedNum, NULL, status);
+   fmt->format(11234.567, formattedNum, nullptr, status);
    assertEquals("", "11,234.57 US dollars", formattedNum);
    delete fmt;
 }
@@ -9718,7 +9718,7 @@ void NumberFormatTest::Test20348_CurrencyPrefixOverride() {
     assertEquals("Initial suffix",
         u"-¤", fmt->getNegativePrefix(result.remove()));
     assertEquals("Initial format",
-        u"\u00A4100.00", fmt->format(100, result.remove(), NULL, status));
+        u"\u00A4100.00", fmt->format(100, result.remove(), nullptr, status));
 
     fmt->setPositivePrefix(u"$");
     assertEquals("Set positive prefix pattern",
@@ -9728,7 +9728,7 @@ void NumberFormatTest::Test20348_CurrencyPrefixOverride() {
     assertEquals("Set positive prefix suffix",
         u"-¤", fmt->getNegativePrefix(result.remove()));
     assertEquals("Set positive prefix format",
-        u"$100.00", fmt->format(100, result.remove(), NULL, status));
+        u"$100.00", fmt->format(100, result.remove(), nullptr, status));
 
     fmt->setNegativePrefix(u"-$");
     assertEquals("Set negative prefix pattern",
@@ -9738,7 +9738,7 @@ void NumberFormatTest::Test20348_CurrencyPrefixOverride() {
     assertEquals("Set negative prefix suffix",
         u"-$", fmt->getNegativePrefix(result.remove()));
     assertEquals("Set negative prefix format",
-        u"$100.00", fmt->format(100, result.remove(), NULL, status));
+        u"$100.00", fmt->format(100, result.remove(), nullptr, status));
 }
 
 void NumberFormatTest::Test20956_MonetarySymbolGetters() {
@@ -9784,7 +9784,7 @@ void NumberFormatTest::Test20358_GroupingInPattern() {
     assertTrue("Initial grouping",
         fmt->isGroupingUsed());
     assertEquals("Initial format",
-        u"54,321", fmt->format(54321, result.remove(), NULL, status));
+        u"54,321", fmt->format(54321, result.remove(), nullptr, status));
 
     fmt->setGroupingUsed(false);
     assertEquals("Set grouping false",
@@ -9792,7 +9792,7 @@ void NumberFormatTest::Test20358_GroupingInPattern() {
     assertFalse("Set grouping false grouping",
         fmt->isGroupingUsed());
     assertEquals("Set grouping false format",
-        u"54321", fmt->format(54321, result.remove(), NULL, status));
+        u"54321", fmt->format(54321, result.remove(), nullptr, status));
 
     fmt->setGroupingUsed(true);
     assertEquals("Set grouping true",
@@ -9800,7 +9800,7 @@ void NumberFormatTest::Test20358_GroupingInPattern() {
     assertTrue("Set grouping true grouping",
         fmt->isGroupingUsed());
     assertEquals("Set grouping true format",
-        u"54,321", fmt->format(54321, result.remove(), NULL, status));
+        u"54,321", fmt->format(54321, result.remove(), nullptr, status));
 }
 
 void NumberFormatTest::Test13731_DefaultCurrency() {
index c29eff56726a866dfa95524af43dddbbb70d5855..0adc7ffcce40bd55ecdc5ef3c40711727fd6ff98 100644 (file)
@@ -79,7 +79,7 @@ public:
         NumberFormat::parse(text, result, status);
     }
     virtual MyNumberFormatTest* clone() const override
-    { return NULL; }
+    { return nullptr; }
 
     virtual UnicodeString& format(int32_t, 
                 UnicodeString& foo, 
@@ -251,7 +251,7 @@ void NumberFormatRegressionTest::Test4075713(void)
 {
     //try {
         MyNumberFormatTest *tmp = new MyNumberFormatTest();
-        if(tmp != NULL)
+        if(tmp != nullptr)
             logln("NumberFormat.equals passed");
     /*} catch (NullPointerException e) {
         errln("(new MyNumberFormatTest()).equals(null) throws unexpected exception");
@@ -468,7 +468,7 @@ void NumberFormatRegressionTest::Test4083018 (void)
     DecimalFormatSymbols *dfs = new DecimalFormatSymbols(status);
     failure(status, "new DecimalFormatSymbols", Locale::getUS());
     //try {
-        if (dfs != NULL)
+        if (dfs != nullptr)
             logln("Test Passed!");
         else
             errln("Test for bug 4083018 failed");
@@ -523,7 +523,7 @@ void NumberFormatRegressionTest::Test4086575(void)
 
     // C++ workaround to make sure cast works
     DecimalFormat *nf = dynamic_cast<DecimalFormat *>(nf1);
-    if(nf == NULL) {
+    if(nf == nullptr) {
         errln("NumberFormat::createInstance returned incorrect type.");
         return;
     }
@@ -859,7 +859,7 @@ void NumberFormatRegressionTest::Test4087244 (void) {
         return;
     }
     DecimalFormat *df = dynamic_cast<DecimalFormat *>(nf.getAlias());
-    if(df == NULL) {
+    if(df == nullptr) {
         errln("expected DecimalFormat!");
         return;
     }
@@ -1658,7 +1658,7 @@ void NumberFormatRegressionTest::Test4122840(void)
     for (int i = 0; i < count; i++) {
         UErrorCode status = U_ZERO_ERROR;
         ResourceBundle *rb = new ResourceBundle(
-            NULL/*"java.text.resources.LocaleElements"*/, 
+            nullptr/*"java.text.resources.LocaleElements"*/, 
             locales[i], status);
         failure(status, "new ResourceBundle");
         ResourceBundle numPat = rb->getWithFallback("NumberElements", status);
@@ -1942,7 +1942,7 @@ void NumberFormatRegressionTest::Test4145457() {
         return;
     }
     DecimalFormat *nf = dynamic_cast<DecimalFormat *>(nff);
-    if(nf == NULL) {
+    if(nf == nullptr) {
         errln("DecimalFormat needed to continue");
         return;
     }
@@ -2759,7 +2759,7 @@ void NumberFormatRegressionTest::TestJ691(void) {
 void NumberFormatRegressionTest::Test8199(void) {
     UErrorCode status = U_ZERO_ERROR;
     NumberFormat *nf = NumberFormat::createInstance(Locale::getEnglish(), status);
-    if (nf == NULL) {
+    if (nf == nullptr) {
         dataerrln("Fail: NumberFormat::createInstance(Locale::getEnglish(), status)");
         return;
     }
@@ -2910,7 +2910,7 @@ void NumberFormatRegressionTest::Test9780(void) {
         return;
     }
     DecimalFormat *df = dynamic_cast<DecimalFormat *>(nf);
-    if(df == NULL) {
+    if(df == nullptr) {
         errln("DecimalFormat needed to continue");
         return;
     }
@@ -2950,20 +2950,20 @@ void NumberFormatRegressionTest::Test9677(void) {
   static const UChar text2[] = { 0x6E, 0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0 }; // n123456789
   
   UErrorCode status = U_ZERO_ERROR;
-  LocalUNumberFormatPointer f(unum_open(UNUM_DEFAULT, NULL, 0, "en_US", NULL, &status));
+  LocalUNumberFormatPointer f(unum_open(UNUM_DEFAULT, nullptr, 0, "en_US", nullptr, &status));
   if (U_FAILURE(status)) {
       dataerrln("Failure opening unum_open");
       return;
   }
 
   if (U_SUCCESS(status)) {
-    unum_applyPattern(f.getAlias(), false, pattern, -1, NULL, &status);
+    unum_applyPattern(f.getAlias(), false, pattern, -1, nullptr, &status);
     unum_setTextAttribute(f.getAlias(), UNUM_POSITIVE_PREFIX, positivePrefix, -1, &status);
     assertSuccess("setting attributes", status);
   }
 
   if(U_SUCCESS(status)) {
-    int32_t n = unum_parse(f.getAlias(), text, -1, NULL, &status);
+    int32_t n = unum_parse(f.getAlias(), text, -1, nullptr, &status);
     logln("unum_parse status %s, result %d\n", u_errorName(status), n);
 
     if(U_FAILURE(status)) {
@@ -2975,13 +2975,13 @@ void NumberFormatRegressionTest::Test9677(void) {
   }
 
   if (U_SUCCESS(status)) {
-    unum_setTextAttribute(f.getAlias(), UNUM_POSITIVE_PREFIX, NULL, 0, &status);
+    unum_setTextAttribute(f.getAlias(), UNUM_POSITIVE_PREFIX, nullptr, 0, &status);
     assertSuccess("setting attributes", status);
     logln("removed positive prefix");
   }
 
   if(U_SUCCESS(status)) {
-    int32_t n = unum_parse(f.getAlias(), text, -1, NULL, &status);
+    int32_t n = unum_parse(f.getAlias(), text, -1, nullptr, &status);
     logln("unum_parse status %s, result %d\n", u_errorName(status), n);
 
     if(U_FAILURE(status)) {
@@ -2997,7 +2997,7 @@ void NumberFormatRegressionTest::Test9677(void) {
   }
 
   if(U_SUCCESS(status)) {
-    int32_t n = unum_parse(f.getAlias(), text2, -1, NULL, &status);
+    int32_t n = unum_parse(f.getAlias(), text2, -1, nullptr, &status);
     logln("unum_parse status %s, result %d\n", u_errorName(status), n);
 
     if(U_FAILURE(status)) {
@@ -3015,7 +3015,7 @@ void NumberFormatRegressionTest::Test9677(void) {
   }
 
   if(U_SUCCESS(status)) {
-    int32_t n = unum_parse(f.getAlias(), text2, -1, NULL, &status);
+    int32_t n = unum_parse(f.getAlias(), text2, -1, nullptr, &status);
     logln("unum_parse status %s, result %d\n", u_errorName(status), n);
 
     if(U_FAILURE(status)) {
index d1d2b5ef2b4279720f8a16cce6ee1ef875d9ce05..91bdc00f848e5787140d711eee4c61ee8640b86a 100644 (file)
@@ -78,8 +78,8 @@ void PluralMapTest::TestToCategory() {
 }
 
 void PluralMapTest::TestGetCategoryName() {
-    assertTrue("", PluralMapBase::getCategoryName(PluralMapBase::NONE) == NULL);
-    assertTrue("", PluralMapBase::getCategoryName(PluralMapBase::CATEGORY_COUNT) == NULL);
+    assertTrue("", PluralMapBase::getCategoryName(PluralMapBase::NONE) == nullptr);
+    assertTrue("", PluralMapBase::getCategoryName(PluralMapBase::CATEGORY_COUNT) == nullptr);
     assertEquals("", "other", PluralMapBase::getCategoryName(PluralMapBase::OTHER));
     assertEquals("", "zero", PluralMapBase::getCategoryName(PluralMapBase::ZERO));
     assertEquals("", "one", PluralMapBase::getCategoryName(PluralMapBase::ONE));
@@ -126,7 +126,7 @@ void PluralMapTest::TestIterate() {
     assertEquals("", (int32_t)PluralMapBase::FEW, index);
     current = map.next(index);
     assertEquals("", (int32_t)PluralMapBase::CATEGORY_COUNT, index);
-    assertTrue("", current == NULL);
+    assertTrue("", current == nullptr);
 
     PluralMapForPluralMapTest map2;
     index = PluralMapBase::NONE;
@@ -135,7 +135,7 @@ void PluralMapTest::TestIterate() {
     assertEquals("", (int32_t)PluralMapBase::OTHER, index);
     current = map2.next(index);
     assertEquals("", (int32_t)PluralMapBase::CATEGORY_COUNT, index);
-    assertTrue("", current == NULL);
+    assertTrue("", current == nullptr);
 }
 
 void PluralMapTest::TestEqual() {
@@ -169,7 +169,7 @@ void PluralMapTest::TestCopyAndAssign() {
     addVariant(PluralMapBase::FEW, "picklefew", control);
     {
         PluralMapForPluralMapTest *rhs = new PluralMapForPluralMapTest();
-        if (rhs == NULL) {
+        if (rhs == nullptr) {
             errln("Memory allocation error.");
             return;
         }
@@ -182,7 +182,7 @@ void PluralMapTest::TestCopyAndAssign() {
     }
     {
         PluralMapForPluralMapTest *rhs = new PluralMapForPluralMapTest();
-        if (rhs == NULL) {
+        if (rhs == nullptr) {
             errln("Memory allocation error.");
             return;
         }
index 6124c2f4c5e0d55d8ac7245daf7a76a522095489..48525cf96e574b1482e25722409457af44a18984 100644 (file)
@@ -82,8 +82,8 @@ void PluralFormatTest::pluralFormatBasicTest(/*char *par*/)
     
     for (int32_t i=0; i< 8; ++i) {
         if (U_SUCCESS(status[i])) {
-            numberFormatTest(plFmt[i], numFmt, 1, 12, NULL, NULL, false, &message);
-            numberFormatTest(plFmt[i], numFmt, 100, 112, NULL, NULL, false, &message);
+            numberFormatTest(plFmt[i], numFmt, 1, 12, nullptr, nullptr, false, &message);
+            numberFormatTest(plFmt[i], numFmt, 100, 112, nullptr, nullptr, false, &message);
         }
         else {
             dataerrln("ERROR: PluralFormat constructor failed!");
@@ -98,7 +98,7 @@ void PluralFormatTest::pluralFormatBasicTest(/*char *par*/)
     plFmt[1]= new PluralFormat(locale, status[1]);
     if ( U_SUCCESS(status[0]) && U_SUCCESS(status[1]) ) {
         *plFmt[1] = *plFmt[0];
-        if (plFmt[1]!=NULL) {
+        if (plFmt[1]!=nullptr) {
             if ( *plFmt[1] != *plFmt[0] ) {
                 errln("ERROR:  clone plural format test failed!");
             }
@@ -113,7 +113,7 @@ void PluralFormatTest::pluralFormatBasicTest(/*char *par*/)
     plFmt[0]= new PluralFormat(locale, status[0]);
     if ( U_SUCCESS(status[0]) ) {
         *plFmt[1] = *plFmt[0];
-        if (plFmt[1]!=NULL) {
+        if (plFmt[1]!=nullptr) {
             if ( *plFmt[1] != *plFmt[0] ) {
                 errln("ERROR:  assignment operator test failed!");
             }
@@ -126,7 +126,7 @@ void PluralFormatTest::pluralFormatBasicTest(/*char *par*/)
     if ( U_SUCCESS(status[1]) ) {
         plFmt[2] = plFmt[1]->clone();
 
-        if (plFmt[1]!=NULL) {
+        if (plFmt[1]!=nullptr) {
             if ( *plFmt[1] != *plFmt[2] ) {
                 errln("ERROR:  clone function test failed!");
             }
@@ -266,7 +266,7 @@ void PluralFormatTest::pluralFormatUnitTest(/*char *par*/)
     if (U_FAILURE(status)) {
         dataerrln("ERROR: Could not create NumberFormat instance with English locale ");
     }
-    numberFormatTest(&pluralFmt, numFmt.getAlias(), 5, 5, NULL, NULL, false, &message);
+    numberFormatTest(&pluralFmt, numFmt.getAlias(), 5, 5, nullptr, nullptr, false, &message);
     pluralFmt.applyPattern(UNICODE_STRING_SIMPLE("odd__{odd} other{even}"), status);
     if (pluralFmt.format((int32_t)1, status) != UNICODE_STRING_SIMPLE("even")) {
         errln("SetLocale should reset rules but did not.");
@@ -689,7 +689,7 @@ PluralFormatTest::numberFormatTest(PluralFormat* plFmt,
                                    UnicodeString *message) {
     UErrorCode status = U_ZERO_ERROR;
     
-    if ( (plFmt==NULL) || (numFmt==NULL) ) {
+    if ( (plFmt==nullptr) || (numFmt==nullptr) ) {
         dataerrln("ERROR: Could not create PluralFormat or NumberFormat - exiting");
         return;
     }
@@ -699,7 +699,7 @@ PluralFormatTest::numberFormatTest(PluralFormat* plFmt,
         numResult.remove();
         numResult = numFmt->format(i, numResult);
         plResult = plFmt->format(i, status);
-        if ((numOddAppendStr!= NULL)&&(numEvenAppendStr!=NULL)) {
+        if ((numOddAppendStr!= nullptr)&&(numEvenAppendStr!=nullptr)) {
             if (overwrite) {
                 if (i&1) {
                     numResult = *numOddAppendStr;
@@ -721,7 +721,7 @@ PluralFormatTest::numberFormatTest(PluralFormat* plFmt,
             assertSuccess(*message + " in numberFormatTest", status);
         }
         if (numResult!=plResult) {
-            if ( message == NULL ) {
+            if ( message == nullptr ) {
                 errln("ERROR: Unexpected plural format - got:"+plResult+ UnicodeString("  expecting:")+numResult);
             }
             else {
index 38c52579cbfefefcb104f5079fd7e8a97c3091a1..bb2a11a66aa1871f68de75142ab9d42d536060c3 100644 (file)
@@ -22,7 +22,7 @@
  * Test basic functionality of various API functions
  **/
 class PluralFormatTest : public IntlTest {
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
 private:
     /**
index bc566e484dcde42d9d42737541d38eee250432e1..664b27f4bb73be51d31adb82fb741c919c8f3d3a 100644 (file)
@@ -80,7 +80,7 @@ class US {
     char *buf;
   public:
     US(const UnicodeString &us) {
-       int32_t bufLen = us.extract((int32_t)0, us.length(), (char *)NULL, (uint32_t)0) + 1;
+       int32_t bufLen = us.extract((int32_t)0, us.length(), (char *)nullptr, (uint32_t)0) + 1;
        buf = (char *)uprv_malloc(bufLen);
        us.extract(0, us.length(), buf, bufLen); }
     const char *cstr() {return buf;}
@@ -158,7 +158,7 @@ void PluralRulesTest::testAPI(/*char *par*/)
 
     // ======= Test clone, assignment operator && == operator.
     LocalPointer<PluralRules> dupRule(defRule.clone());
-    if (dupRule==NULL) {
+    if (dupRule==nullptr) {
         errln("ERROR: clone plural rules test failed!");
         return;
     } else {
@@ -167,7 +167,7 @@ void PluralRulesTest::testAPI(/*char *par*/)
         }
     }
     *dupRule = *newEnPlural;
-    if (dupRule!=NULL) {
+    if (dupRule!=nullptr) {
         if ( *dupRule != *newEnPlural ) {
             errln("ERROR:  clone plural rules test failed!");
         }
@@ -334,7 +334,7 @@ UBool testEquality(const PluralRules &test) {
         PluralRules* rules[MAX_EQ_COL];
 
         for (int32_t j=0; j<MAX_EQ_COL; ++j) {
-            rules[j]=NULL;
+            rules[j]=nullptr;
         }
         int32_t totalRules=0;
         while((totalRules<MAX_EQ_COL) && (testEquRules[i][totalRules].length()>0) ) {
@@ -354,7 +354,7 @@ UBool testEquality(const PluralRules &test) {
 
         }
         for (int32_t j=0; j<MAX_EQ_COL; ++j) {
-            if (rules[j]!=NULL) {
+            if (rules[j]!=nullptr) {
                 delete rules[j];
             }
         }
@@ -425,7 +425,7 @@ void PluralRulesTest::testGetSamples() {
             break;
         }
         const UnicodeString* keyword;
-        while (NULL != (keyword = keywords->snext(status))) {
+        while (nullptr != (keyword = keywords->snext(status))) {
             int32_t count = rules->getSamples(*keyword, values, UPRV_LENGTHOF(values), status);
             if (U_FAILURE(status)) {
                 errln(UnicodeString(u"getSamples() failed for locale ") +
@@ -489,7 +489,7 @@ void PluralRulesTest::testGetDecimalQuantitySamples() {
             break;
         }
         const UnicodeString* keyword;
-        while (NULL != (keyword = keywords->snext(status))) {
+        while (nullptr != (keyword = keywords->snext(status))) {
             int32_t count = rules->getSamples(*keyword, values, UPRV_LENGTHOF(values), status);
             if (U_FAILURE(status)) {
                 errln(UnicodeString(u"getSamples() failed for locale ") +
@@ -777,10 +777,10 @@ PluralRulesTest::testGetAllKeywordValues() {
         "a: n mod 3 is 0 and n within 0..5", "a: 0,3",
         "a: n mod 3 is 0 and n within 0..6", "a: null", // similarly with mod, we don't catch...
         "a: n mod 3 is 0 and n in 3..12", "a: 3,6,9,12",
-        NULL
+        nullptr
     };
 
-    for (int i = 0; data[i] != NULL; i += 2) {
+    for (int i = 0; data[i] != nullptr; i += 2) {
         UErrorCode status = U_ZERO_ERROR;
         UnicodeString ruleDescription(data[i], -1, US_INV);
         const char* result = data[i+1];
@@ -788,7 +788,7 @@ PluralRulesTest::testGetAllKeywordValues() {
         logln("[%d] %s", i >> 1, data[i]);
 
         PluralRules *p = PluralRules::createRules(ruleDescription, status);
-        if (p == NULL || U_FAILURE(status)) {
+        if (p == nullptr || U_FAILURE(status)) {
             errln("file %s, line %d: could not create rules from '%s'\n"
                   "  ErrorCode: %s\n", 
                   __FILE__, __LINE__, data[i], u_errorName(status));
@@ -1157,8 +1157,8 @@ void PluralRulesTest::checkSelect(const LocalPointer<PluralRules> &rules, UError
         return;
     }
 
-    if (rules == NULL) {
-        errln("file %s, line %d: rules pointer is NULL", __FILE__, line);
+    if (rules == nullptr) {
+        errln("file %s, line %d: rules pointer is nullptr", __FILE__, line);
         return;
     }
         
@@ -1180,7 +1180,7 @@ void PluralRulesTest::checkSelect(const LocalPointer<PluralRules> &rules, UError
         }
         double numDbl = dl.toDouble();
         const char *decimalPoint = strchr(num, '.');
-        int fractionDigitCount = decimalPoint == NULL ? 0 : static_cast<int>((num + strlen(num) - 1) - decimalPoint);
+        int fractionDigitCount = decimalPoint == nullptr ? 0 : static_cast<int>((num + strlen(num) - 1) - decimalPoint);
         int fractionDigits = fractionDigitCount == 0 ? 0 : atoi(decimalPoint + 1);
         FixedDecimal ni(numDbl, fractionDigitCount, fractionDigits);
         
@@ -1433,12 +1433,12 @@ void PluralRulesTest::testAvailableLocales() {
     StringEnumeration *localesEnum = PluralRules::getAvailableLocales(status);
     int localeCount = 0;
     for (;;) {
-        const char *locale = localesEnum->next(NULL, status);
+        const char *locale = localesEnum->next(nullptr, status);
         if (U_FAILURE(status)) {
             dataerrln("file %s,  line %d: Error status = %s", __FILE__, __LINE__, u_errorName(status));
             return;
         }
-        if (locale == NULL) {
+        if (locale == nullptr) {
             break;
         }
         localeCount++;
@@ -1451,7 +1451,7 @@ void PluralRulesTest::testAvailableLocales() {
     // Reset the iterator, verify that we get the same count.
     localesEnum->reset(status);
     int32_t localeCount2 = 0;
-    while (localesEnum->next(NULL, status) != NULL) {
+    while (localesEnum->next(nullptr, status) != nullptr) {
         if (U_FAILURE(status)) {
             errln("file %s,  line %d: Error status = %s", __FILE__, __LINE__, u_errorName(status));
             break;
@@ -1467,13 +1467,13 @@ void PluralRulesTest::testAvailableLocales() {
     localesEnum->reset(status);
     for (;;) {
         status = U_ZERO_ERROR;
-        const char *localeName = localesEnum->next(NULL, status);
+        const char *localeName = localesEnum->next(nullptr, status);
         if (U_FAILURE(status)) {
             errln("file %s,  line %d: Error status = %s, locale = %s",
                 __FILE__, __LINE__, u_errorName(status), localeName);
             return;
         }
-        if (localeName == NULL) {
+        if (localeName == nullptr) {
             break;
         }
         Locale locale = Locale::createFromName(localeName);
@@ -1483,7 +1483,7 @@ void PluralRulesTest::testAvailableLocales() {
                 __FILE__, __LINE__, u_errorName(status), localeName);
             continue;
         }
-        if (pr == NULL) {
+        if (pr == nullptr) {
             errln("file %s, line %d: Null plural rules for locale %s", __FILE__, __LINE__, localeName);
             continue;
         }
@@ -1532,8 +1532,8 @@ void PluralRulesTest::testParseErrors() {
         if (U_SUCCESS(status)) {
             errln("file %s, line %d, expected failure with \"%s\".", __FILE__, __LINE__, rules);
         }
-        if (pr != NULL) {
-            errln("file %s, line %d, expected NULL. Rules: \"%s\"", __FILE__, __LINE__, rules);
+        if (pr != nullptr) {
+            errln("file %s, line %d, expected nullptr. Rules: \"%s\"", __FILE__, __LINE__, rules);
         }
     }
     return;
index f02a484ccd31c6e46d50723b8d7b01bdbf3e1ee2..98ea9574bea7c371803b7850805604b82c3fe749 100644 (file)
@@ -22,7 +22,7 @@
  * Test basic functionality of various API functions
  **/
 class PluralRulesTest : public IntlTest {
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
 private:
     /**
index a085f1bcbf139fd8cc929512a18fd39b3d0a95fc..53a7b6b237a5765cf9261ea4cbad7614fd61fc27 100644 (file)
@@ -185,7 +185,7 @@ void ParsePositionTest::TestFieldPosition_example()
     }
 
     DecimalFormat *fmt = dynamic_cast<DecimalFormat *>(nf);
-    if(fmt == NULL) {
+    if(fmt == nullptr) {
         errln("NumberFormat::createInstance returned unexpected class type");
         return;
     }
index 27cacca8fde59cc335420279bcc1cf65d704272a..d6f7dec65a88038f564ba1c0db690552f8230268 100644 (file)
@@ -29,7 +29,7 @@ class RBBIAPITest: public IntlTest {
 public:
    
     
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
     /**
      * Tests Constructor behaviour of RuleBasedBreakIterator
      **/
index c5648442977ea5614dc438d0738b27e075d220bd..78e40f2841896cb6baf9f2d002f179e493ce80b6 100644 (file)
@@ -61,7 +61,7 @@ BreakRules::BreakRules(RBBIMonkeyImpl *monkeyImpl, UErrorCode &status)  :
         fMonkeyImpl(monkeyImpl), fBreakRules(status), fType(UBRK_COUNT) {
     fCharClasses.adoptInstead(uhash_open(uhash_hashUnicodeString,
                                          uhash_compareUnicodeString,
-                                         NULL,      // value comparator.
+                                         nullptr,      // value comparator.
                                          &status));
     if (U_FAILURE(status)) {
         return;
@@ -135,7 +135,7 @@ CharClass *BreakRules::addCharClass(const UnicodeString &name, const UnicodeStri
         printf("epandedDef: %s\n", CStr(expandedDef)());
     }
 
-    LocalPointer<UnicodeSet> s(new UnicodeSet(expandedDef, USET_IGNORE_SPACE, NULL, status), status);
+    LocalPointer<UnicodeSet> s(new UnicodeSet(expandedDef, USET_IGNORE_SPACE, nullptr, status), status);
     if (U_FAILURE(status)) {
         IntlTest::gTest->errln("%s:%d: error %s creating UnicodeSet %s\n    Expanded set definition: %s",
                                __FILE__, __LINE__, u_errorName(status), CStr(name)(), CStr(expandedDef)());
@@ -147,7 +147,7 @@ CharClass *BreakRules::addCharClass(const UnicodeString &name, const UnicodeStri
                                                         cclass,                    // Value, owned by hash table.
                                                         &status));
 
-    if (previousClass != NULL) {
+    if (previousClass != nullptr) {
         // Duplicate class def.
         // These are legitimate, they are adjustments of an existing class.
         // TODO: will need to keep the old around when we handle tailorings.
@@ -256,9 +256,9 @@ bool BreakRules::setKeywordParameter(const UnicodeString &keyword, const Unicode
 
 RuleBasedBreakIterator *BreakRules::createICUBreakIterator(UErrorCode &status) {
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
-    RuleBasedBreakIterator *bi = NULL;
+    RuleBasedBreakIterator *bi = nullptr;
     switch(fType) {
         case UBRK_CHARACTER:
             bi = dynamic_cast<RuleBasedBreakIterator *>(BreakIterator::createCharacterInstance(fLocale, status));
@@ -292,7 +292,7 @@ void BreakRules::compileRules(UCHARBUF *rules, UErrorCode &status) {
         }
         int32_t lineLength = 0;
         const UChar *lineBuf = ucbuf_readline(rules, &lineLength, &status);
-        if (lineBuf == NULL) {
+        if (lineBuf == nullptr) {
             break;
         }
         UnicodeString line(lineBuf, lineLength);
@@ -345,8 +345,8 @@ void BreakRules::compileRules(UCHARBUF *rules, UErrorCode &status) {
 
     UnicodeSet otherSet((UChar32)0, 0x10ffff);
     int32_t pos = UHASH_FIRST;
-    const UHashElement *el = NULL;
-    while ((el = uhash_nextElement(fCharClasses.getAlias(), &pos)) != NULL) {
+    const UHashElement *el = nullptr;
+    while ((el = uhash_nextElement(fCharClasses.getAlias(), &pos)) != nullptr) {
         const UnicodeString *ccName = static_cast<const UnicodeString *>(el->key.pointer);
         CharClass *cclass = static_cast<CharClass *>(el->value.pointer);
         // printf("    Adding %s\n", CStr(*ccName)());
@@ -383,7 +383,7 @@ const CharClass *BreakRules::getClassForChar(UChar32 c, int32_t *iter) const {
            return cc;
        }
     }
-    return NULL;
+    return nullptr;
 }
 
 //---------------------------------------------------------------------------------------
@@ -453,7 +453,7 @@ void MonkeyTestData::set(BreakRules *rules, IntlTest::icu_rand &rand, UErrorCode
     bool    initialMatch = true;             // True at start of text, and immediately after each boundary,
                                              // for control over rule chaining.
     while (strIdx < fString.length()) {
-        BreakRule *matchingRule = NULL;
+        BreakRule *matchingRule = nullptr;
         UBool      hasBreak = false;
         int32_t ruleNum = 0;
         int32_t matchStart = 0;
@@ -482,7 +482,7 @@ void MonkeyTestData::set(BreakRules *rules, IntlTest::icu_rand &rand, UErrorCode
                 }
             }
         }
-        if (matchingRule == NULL) {
+        if (matchingRule == nullptr) {
             // No reference rule matched. This is an error in the rules that should never happen.
             IntlTest::gTest->errln("%s:%d Trouble with monkey test reference rules at position %d. ",
                  __FILE__, __LINE__, strIdx);
@@ -908,11 +908,11 @@ void RBBIMonkeyTest::testMonkey() {
 
     const char *tests[] = {"grapheme.txt", "word.txt", "line.txt", "line_cj.txt", "sentence.txt", "line_normal.txt",
                            "line_normal_cj.txt", "line_loose.txt", "line_loose_cj.txt", "word_POSIX.txt",
-                           NULL };
+                           nullptr };
     CharString testNameFromParams;
     if (getStringParam("rules", params, testNameFromParams, status)) {
         tests[0] = testNameFromParams.data();
-        tests[1] = NULL;
+        tests[1] = nullptr;
     }
 
     int64_t loopCount = quick? 100 : 5000;
@@ -945,7 +945,7 @@ void RBBIMonkeyTest::testMonkey() {
     // Each set of break rules to be tested is run in a separate thread.
     // Each thread/set of rules gets a separate RBBIMonkeyImpl object.
     int32_t i;
-    for (i=0; tests[i] != NULL; ++i) {
+    for (i=0; tests[i] != nullptr; ++i) {
         logln("beginning testing of %s", tests[i]);
         LocalPointer<RBBIMonkeyImpl> test(new RBBIMonkeyImpl(status));
         if (U_FAILURE(status)) {
@@ -984,7 +984,7 @@ UBool  RBBIMonkeyTest::getIntParam(UnicodeString name, UnicodeString &params, in
         // The param exists.  Convert the string to an int.
         CharString str;
         str.append(CStr(m.group(1, status))(), -1, status);
-        val = strtol(str.data(),  NULL, 10);
+        val = strtol(str.data(),  nullptr, 10);
 
         // Delete this parameter from the params string.
         m.reset();
index 1f2609018c92d090e946eb5208ff24a6f4582d6c..837c0ca71eb1f1960b8050944bfc8a36fb749426 100644 (file)
@@ -56,7 +56,7 @@ class RBBIMonkeyTest: public IntlTest {
     RBBIMonkeyTest();
     virtual ~RBBIMonkeyTest();
 
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
     void testMonkey();
 
 
@@ -116,7 +116,7 @@ class BreakRules: public UObject {
 
     void compileRules(UCHARBUF *rules, UErrorCode &status);
 
-    const CharClass *getClassForChar(UChar32 c, int32_t *iter=NULL) const;
+    const CharClass *getClassForChar(UChar32 c, int32_t *iter=nullptr) const;
 
 
     RBBIMonkeyImpl    *fMonkeyImpl;        // Pointer back to the owning MonkeyImpl instance.
index 436fd8325b6c1d466a4ea9d84704214908a0136c..c8785f723439692d10cffda82dae1155fbb60093 100644 (file)
@@ -42,7 +42,7 @@ public:
     RBBITest();
     virtual ~RBBITest();
 
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     void TestGetAvailableLocales();
     void TestGetDisplayName();
index 9bd47d229f302cad40529879c2c871a20b9ba6da..b094e4f553d329f22a17612ef903f981a8878db1 100644 (file)
@@ -51,7 +51,7 @@ void CollationRegressionTest::Test4048446(/* char* par */)
     CollationElementIterator *i2 = en_us->createCollationElementIterator(test1);
     UErrorCode status = U_ZERO_ERROR;
 
-    if (i1 == NULL|| i2 == NULL)
+    if (i1 == nullptr|| i2 == nullptr)
     {
         errln("Could not create CollationElementIterator's");
         delete i1;
@@ -236,11 +236,11 @@ void CollationRegressionTest::Test4058613(/* char* par */)
         return;
     }
 
-    Collator *c = NULL;
+    Collator *c = nullptr;
 
     c = Collator::createInstance("en_US", status);
 
-    if (c == NULL || U_FAILURE(status))
+    if (c == nullptr || U_FAILURE(status))
     {
         errln("Could not create a Korean collator");
         Locale::setDefault(oldDefault, status);
@@ -269,12 +269,12 @@ void CollationRegressionTest::Test4059820(/* char* par */)
 {
     UErrorCode status = U_ZERO_ERROR;
 
-    RuleBasedCollator *c = NULL;
+    RuleBasedCollator *c = nullptr;
     UnicodeString rules = "&9 < a < b , c/a < d < z";
 
     c = new RuleBasedCollator(rules, status);
 
-    if (c == NULL || U_FAILURE(status))
+    if (c == nullptr || U_FAILURE(status))
     {
         errln("Failure building a collator.");
         delete c;
@@ -305,11 +305,11 @@ void CollationRegressionTest::Test4060154(/* char* par */)
     rules += (UChar)0x0130;
     rules += ", i, I";
 
-    RuleBasedCollator *c = NULL;
+    RuleBasedCollator *c = nullptr;
 
     c = new RuleBasedCollator(rules, status);
 
-    if (c == NULL || U_FAILURE(status))
+    if (c == nullptr || U_FAILURE(status))
     {
         errln("failure building collator.");
         delete c;
@@ -368,11 +368,11 @@ void CollationRegressionTest::Test4062418(/* char* par */)
 {
     UErrorCode status = U_ZERO_ERROR;
 
-    RuleBasedCollator *c = NULL;
+    RuleBasedCollator *c = nullptr;
 
     c = (RuleBasedCollator *) Collator::createInstance(Locale::getCanadaFrench(), status);
 
-    if (c == NULL || U_FAILURE(status))
+    if (c == nullptr || U_FAILURE(status))
     {
         errln("Failed to create collator for Locale::getCanadaFrench()");
         delete c;
@@ -448,11 +448,11 @@ void CollationRegressionTest::Test4066189(/* char* par */)
 void CollationRegressionTest::Test4066696(/* char* par */)
 {
     UErrorCode status = U_ZERO_ERROR;
-    RuleBasedCollator *c = NULL;
+    RuleBasedCollator *c = nullptr;
 
     c = (RuleBasedCollator *)Collator::createInstance(Locale::getCanadaFrench(), status);
 
-    if (c == NULL || U_FAILURE(status))
+    if (c == nullptr || U_FAILURE(status))
     {
         errln("Failure creating collator for Locale::getCanadaFrench()");
         delete c;
@@ -508,18 +508,18 @@ void CollationRegressionTest::Test4076676(/* char* par */)
 
 // @bug 4079231
 //
-// RuleBasedCollator::operator==(NULL) throws NullPointerException
+// RuleBasedCollator::operator==(nullptr) throws NullPointerException
 //
 void CollationRegressionTest::Test4079231(/* char* par */)
 {
     // I don't think there's any way to write this test
     // in C++. The following is equivalent to the Java,
-    // but doesn't compile 'cause NULL can't be converted
+    // but doesn't compile 'cause nullptr can't be converted
     // to Collator&
     //
-    // if (en_us->operator==(NULL))
+    // if (en_us->operator==(nullptr))
     // {
-    //     errln("en_us->operator==(NULL) returned true");
+    //     errln("en_us->operator==(nullptr) returned true");
     // }
 
  /*
@@ -543,7 +543,7 @@ void CollationRegressionTest::Test4078588(/* char *par */)
     UErrorCode status = U_ZERO_ERROR;
     RuleBasedCollator *rbc = new RuleBasedCollator("&9 < a < bb", status);
 
-    if (rbc == NULL || U_FAILURE(status))
+    if (rbc == nullptr || U_FAILURE(status))
     {
         errln("Failed to create RuleBasedCollator.");
         delete rbc;
@@ -597,11 +597,11 @@ void CollationRegressionTest::Test4087241(/* char* par */)
 {
     UErrorCode status = U_ZERO_ERROR;
     Locale da_DK("da", "DK");
-    RuleBasedCollator *c = NULL;
+    RuleBasedCollator *c = nullptr;
 
     c = (RuleBasedCollator *) Collator::createInstance(da_DK, status);
 
-    if (c == NULL || U_FAILURE(status))
+    if (c == nullptr || U_FAILURE(status))
     {
         errln("Failed to create collator for da_DK locale");
         delete c;
@@ -650,11 +650,11 @@ void CollationRegressionTest::Test4092260(/* char* par */)
 {
     UErrorCode status = U_ZERO_ERROR;
     Locale el("el", "");
-    Collator *c = NULL;
+    Collator *c = nullptr;
 
     c = Collator::createInstance(el, status);
 
-    if (c == NULL || U_FAILURE(status))
+    if (c == nullptr || U_FAILURE(status))
     {
         errln("Failed to create collator for el locale.");
         delete c;
@@ -682,7 +682,7 @@ void CollationRegressionTest::Test4095316(/* char* par */)
     Locale el_GR("el", "GR");
     Collator *c = Collator::createInstance(el_GR, status);
 
-    if (c == NULL || U_FAILURE(status))
+    if (c == nullptr || U_FAILURE(status))
     {
         errln("Failed to create collator for el_GR locale");
         delete c;
@@ -707,13 +707,13 @@ void CollationRegressionTest::Test4095316(/* char* par */)
 void CollationRegressionTest::Test4101940(/* char* par */)
 {
     UErrorCode status = U_ZERO_ERROR;
-    RuleBasedCollator *c = NULL;
+    RuleBasedCollator *c = nullptr;
     UnicodeString rules = "&9 < a < b";
     UnicodeString nothing = "";
 
     c = new RuleBasedCollator(rules, status);
 
-    if (c == NULL || U_FAILURE(status))
+    if (c == nullptr || U_FAILURE(status))
     {
         errln("Failed to create RuleBasedCollator");
         delete c;
@@ -803,11 +803,11 @@ void CollationRegressionTest::Test4114076(/* char* par */)
 void CollationRegressionTest::Test4124632(/* char* par */)
 {
     UErrorCode status = U_ZERO_ERROR;
-    Collator *coll = NULL;
+    Collator *coll = nullptr;
 
     coll = Collator::createInstance(Locale::getJapan(), status);
 
-    if (coll == NULL || U_FAILURE(status))
+    if (coll == nullptr || U_FAILURE(status))
     {
         errln("Failed to create collator for Locale::JAPAN");
         delete coll;
@@ -835,12 +835,12 @@ void CollationRegressionTest::Test4132736(/* char* par */)
 {
     UErrorCode status = U_ZERO_ERROR;
 
-    Collator *c = NULL;
+    Collator *c = nullptr;
 
     c = Collator::createInstance(Locale::getCanadaFrench(), status);
     c->setStrength(Collator::TERTIARY);
 
-    if (c == NULL || U_FAILURE(status))
+    if (c == nullptr || U_FAILURE(status))
     {
         errln("Failed to create a collator for Locale::getCanadaFrench()");
         delete c;
@@ -928,12 +928,12 @@ void CollationRegressionTest::Test4141640(/* char* par */)
 
     for (i = 0; i < localeCount; i += 1)
     {
-        Collator *c = NULL;
+        Collator *c = nullptr;
 
         status = U_ZERO_ERROR;
         c = Collator::createInstance(locales[i], status);
 
-        if (c == NULL || U_FAILURE(status))
+        if (c == nullptr || U_FAILURE(status))
         {
             UnicodeString msg, localeName;
 
@@ -961,11 +961,11 @@ void CollationRegressionTest::Test4139572(/* char* par */)
     // create spanish locale and collator
     UErrorCode status = U_ZERO_ERROR;
     Locale l("es", "es");
-    Collator *col = NULL;
+    Collator *col = nullptr;
 
     col = Collator::createInstance(l, status);
 
-    if (col == NULL || U_FAILURE(status))
+    if (col == nullptr || U_FAILURE(status))
     {
         errln("Failed to create a collator for es_es locale.");
         delete col;
@@ -1131,7 +1131,7 @@ void CollationRegressionTest::TestT7189() {
     };
 
     // Open the collator
-    coll = ucol_openFromShortString("EO_S1", false, NULL, &status);
+    coll = ucol_openFromShortString("EO_S1", false, nullptr, &status);
     if (U_FAILURE(status)) {
         errln("Failed to create a collator for short string EO_S1");
         return;
@@ -1346,7 +1346,7 @@ void CollationRegressionTest::runIndexedTest(int32_t index, UBool exec, const ch
         logln("Collation Regression Tests: ");
     }
 
-    if(en_us == NULL) {
+    if(en_us == nullptr) {
         dataerrln("Class collator not instantiated");
         name = "";
         return;
index 85226a9e62a545571756e3a4bc1432140451fc61..d9bcb4ff8600587fcae1a825e844f0695535b8ed 100644 (file)
@@ -32,7 +32,7 @@ public:
     CollationRegressionTest();
     virtual ~CollationRegressionTest();
 
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     // @bug 4048446
     //
index c60108888c44cb18c86fc88a69cb3f0b6224dc22..9491b676e0d6e60ef7b3dc1c4ee2857b6ce2eff2 100644 (file)
@@ -328,7 +328,7 @@ static UText* regextst_openUTF8FromInvariant(UText *ut, const char *inv, int64_t
     fprintf(stderr, "%s:%d Error: INV_BUFSIZ #defined to be %d but needs to be at least %d.\n",
             __FILE__, __LINE__, INV_BUFSIZ, (inv_next+length+1));
     *status = U_MEMORY_ALLOCATION_ERROR;
-    return NULL;
+    return nullptr;
   }
 
   unsigned char *buf = (unsigned char*)inv_buf+inv_next;
@@ -368,8 +368,8 @@ UBool RegexTest::doRegexLMTest(const char *pat, const char *text, UBool looking,
     const UnicodeString inputText(text, -1, US_INV);
     UErrorCode          status  = U_ZERO_ERROR;
     UParseError         pe;
-    RegexPattern        *REPattern = NULL;
-    RegexMatcher        *REMatcher = NULL;
+    RegexPattern        *REPattern = nullptr;
+    RegexMatcher        *REMatcher = nullptr;
     UBool               retVal     = true;
 
     UnicodeString patString(pat, -1, US_INV);
@@ -427,12 +427,12 @@ UBool RegexTest::doRegexLMTest(const char *pat, const char *text, UBool looking,
 UBool RegexTest::doRegexLMTestUTF8(const char *pat, const char *text, UBool looking, UBool match, int32_t line) {
     UText               pattern    = UTEXT_INITIALIZER;
     int32_t             inputUTF8Length;
-    char                *textChars = NULL;
+    char                *textChars = nullptr;
     UText               inputText  = UTEXT_INITIALIZER;
     UErrorCode          status     = U_ZERO_ERROR;
     UParseError         pe;
-    RegexPattern        *REPattern = NULL;
-    RegexMatcher        *REMatcher = NULL;
+    RegexPattern        *REPattern = nullptr;
+    RegexMatcher        *REMatcher = nullptr;
     UBool               retVal     = true;
 
     regextst_openUTF8FromInvariant(&pattern, pat, -1, &status);
@@ -446,9 +446,9 @@ UBool RegexTest::doRegexLMTestUTF8(const char *pat, const char *text, UBool look
     UnicodeString inputString(text, -1, US_INV);
     UnicodeString unEscapedInput = inputString.unescape();
     LocalUConverterPointer UTF8Converter(ucnv_open("UTF8", &status));
-    ucnv_setFromUCallBack(UTF8Converter.getAlias(), UCNV_FROM_U_CALLBACK_STOP, NULL, NULL, NULL, &status);
+    ucnv_setFromUCallBack(UTF8Converter.getAlias(), UCNV_FROM_U_CALLBACK_STOP, nullptr, nullptr, nullptr, &status);
 
-    inputUTF8Length = unEscapedInput.extract(NULL, 0, UTF8Converter.getAlias(), status);
+    inputUTF8Length = unEscapedInput.extract(nullptr, 0, UTF8Converter.getAlias(), status);
     if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR) {
         // UTF-8 does not allow unpaired surrogates, so this could actually happen
         logln("RegexTest unable to convert input to UTF8 at line %d.  Status = %s\n", line, u_errorName(status));
@@ -521,7 +521,7 @@ void RegexTest::regex_err(const char *pat, int32_t errLine, int32_t errCol,
 
     UErrorCode          status         = U_ZERO_ERROR;
     UParseError         pe;
-    RegexPattern        *callerPattern = NULL;
+    RegexPattern        *callerPattern = nullptr;
 
     //
     //  Compile the caller's pattern
@@ -1802,12 +1802,12 @@ void RegexTest::API_Pattern() {
     pat1 = RegexPattern::compile("(Hello, world)*",  pe, status);
     REGEX_CHECK_STATUS;
     REGEX_ASSERT(pat1->getDynamicClassID() == RegexPattern::getStaticClassID());
-    REGEX_ASSERT(pat1->getDynamicClassID() != NULL);
+    REGEX_ASSERT(pat1->getDynamicClassID() != nullptr);
     UnicodeString Hello("Hello, world.");
     RegexMatcher *m = pat1->matcher(Hello, status);
     REGEX_ASSERT(pat1->getDynamicClassID() != m->getDynamicClassID());
     REGEX_ASSERT(m->getDynamicClassID() == RegexMatcher::getStaticClassID());
-    REGEX_ASSERT(m->getDynamicClassID() != NULL);
+    REGEX_ASSERT(m->getDynamicClassID() != nullptr);
     delete m;
     delete pat1;
 
@@ -1852,7 +1852,7 @@ void RegexTest::API_Match_UTF8() {
         REGEX_VERBOSE_TEXT(&input1);
         regextst_openUTF8FromInvariant(&input2, "not abc", -1, &status);
         REGEX_VERBOSE_TEXT(&input2);
-        utext_openUChars(&empty, NULL, 0, &status);
+        utext_openUChars(&empty, nullptr, 0, &status);
 
         int32_t input1Len = static_cast<int32_t>(strlen("abcdef this is a test")); /* TODO: why not nativelen (input1) ? */
         int32_t input2Len = static_cast<int32_t>(strlen("not abc"));
@@ -2030,7 +2030,7 @@ void RegexTest::API_Match_UTF8() {
         //const char str_0123456789[] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x00 }; /* 0123456789 */
         //  Test shallow-clone API
         int64_t   group_len;
-        result = matcher->group((UText *)NULL, group_len, status);
+        result = matcher->group((UText *)nullptr, group_len, status);
         REGEX_CHECK_STATUS;
         REGEX_ASSERT_UTEXT_UTF8(str_0123456789, result);
         utext_close(result);
@@ -2043,7 +2043,7 @@ void RegexTest::API_Match_UTF8() {
         utext_openUnicodeString(&destText, &dest, &status);
 
         int64_t length;
-        result = matcher->group(0, NULL, length, status);
+        result = matcher->group(0, nullptr, length, status);
         REGEX_CHECK_STATUS;
         REGEX_ASSERT_UTEXT_UTF8(str_0123456789, result);
         utext_close(result);
@@ -2055,7 +2055,7 @@ void RegexTest::API_Match_UTF8() {
         REGEX_ASSERT_UTEXT_INVARIANT("0123456789", result);
 
         // Capture Group 1 == "234567"
-        result = matcher->group(1, NULL, length, status);
+        result = matcher->group(1, nullptr, length, status);
         REGEX_CHECK_STATUS;
         REGEX_ASSERT(utext_getNativeIndex(result) == 2);
         REGEX_ASSERT(length == 6);
@@ -2071,7 +2071,7 @@ void RegexTest::API_Match_UTF8() {
         utext_close(result);
 
         // Capture Group 2 == "45"
-        result = matcher->group(2, NULL, length, status);
+        result = matcher->group(2, nullptr, length, status);
         REGEX_CHECK_STATUS;
         REGEX_ASSERT(utext_getNativeIndex(result) == 4);
         REGEX_ASSERT(length == 2);
@@ -2087,7 +2087,7 @@ void RegexTest::API_Match_UTF8() {
         utext_close(result);
 
         // Capture Group 3 == "89"
-        result = matcher->group(3, NULL, length, status);
+        result = matcher->group(3, nullptr, length, status);
         REGEX_CHECK_STATUS;
         REGEX_ASSERT(utext_getNativeIndex(result) == 8);
         REGEX_ASSERT(length == 2);
@@ -2450,7 +2450,7 @@ void RegexTest::API_Replace_UTF8() {
     const char str_yz[] = { 0x79, 0x7a, 0x00 }; /* yz */
     utext_openUTF8(&replText, str_yz, -1, &status);
     REGEX_VERBOSE_TEXT(&replText);
-    result = matcher->replaceFirst(&replText, NULL, status);
+    result = matcher->replaceFirst(&replText, nullptr, status);
     REGEX_CHECK_STATUS;
     const char str_yzabcabc[] = { 0x2e, 0x79, 0x7a, 0x2e, 0x2e, 0x61, 0x62, 0x63, 0x2e, 0x2e, 0x2e, 0x61, 0x62, 0x63, 0x2e, 0x2e, 0x00 }; /* .yz..abc...abc.. */
     REGEX_ASSERT_UTEXT_UTF8(str_yzabcabc, result);
@@ -2460,13 +2460,13 @@ void RegexTest::API_Replace_UTF8() {
     REGEX_ASSERT(result == &destText);
     REGEX_ASSERT_UTEXT_UTF8(str_yzabcabc, result);
 
-    result = matcher->replaceAll(&replText, NULL, status);
+    result = matcher->replaceAll(&replText, nullptr, status);
     REGEX_CHECK_STATUS;
     const char str_yzyzyz[] = { 0x2e, 0x79, 0x7a, 0x2e, 0x2e, 0x79, 0x7a, 0x2e, 0x2e, 0x2e, 0x79, 0x7a, 0x2e, 0x2e, 0x00 }; /* .yz..yz...yz.. */
     REGEX_ASSERT_UTEXT_UTF8(str_yzyzyz, result);
     utext_close(result);
 
-    utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status);
+    utext_replace(&destText, 0, utext_nativeLength(&destText), nullptr, 0, &status);
     result = matcher->replaceAll(&replText, &destText, status);
     REGEX_CHECK_STATUS;
     REGEX_ASSERT(result == &destText);
@@ -2479,7 +2479,7 @@ void RegexTest::API_Replace_UTF8() {
     utext_openUTF8(&dataText, str_abxabxabx, -1, &status);
     matcher->reset(&dataText);
 
-    result = matcher->replaceFirst(&replText, NULL, status);
+    result = matcher->replaceFirst(&replText, nullptr, status);
     REGEX_CHECK_STATUS;
     REGEX_ASSERT_UTEXT_UTF8(str_abxabxabx, result);
     utext_close(result);
@@ -2488,11 +2488,11 @@ void RegexTest::API_Replace_UTF8() {
     REGEX_ASSERT(result == &destText);
     REGEX_ASSERT_UTEXT_UTF8(str_abxabxabx, result);
 
-    result = matcher->replaceAll(&replText, NULL, status);
+    result = matcher->replaceAll(&replText, nullptr, status);
     REGEX_CHECK_STATUS;
     REGEX_ASSERT_UTEXT_UTF8(str_abxabxabx, result);
     utext_close(result);
-    utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status);
+    utext_replace(&destText, 0, utext_nativeLength(&destText), nullptr, 0, &status);
     result = matcher->replaceAll(&replText, &destText, status);
     REGEX_CHECK_STATUS;
     REGEX_ASSERT(result == &destText);
@@ -2501,10 +2501,10 @@ void RegexTest::API_Replace_UTF8() {
     //
     // Empty source string
     //
-    utext_openUTF8(&dataText, NULL, 0, &status);
+    utext_openUTF8(&dataText, nullptr, 0, &status);
     matcher->reset(&dataText);
 
-    result = matcher->replaceFirst(&replText, NULL, status);
+    result = matcher->replaceFirst(&replText, nullptr, status);
     REGEX_CHECK_STATUS;
     REGEX_ASSERT_UTEXT_UTF8("", result);
     utext_close(result);
@@ -2513,7 +2513,7 @@ void RegexTest::API_Replace_UTF8() {
     REGEX_ASSERT(result == &destText);
     REGEX_ASSERT_UTEXT_UTF8("", result);
 
-    result = matcher->replaceAll(&replText, NULL, status);
+    result = matcher->replaceAll(&replText, nullptr, status);
     REGEX_CHECK_STATUS;
     REGEX_ASSERT_UTEXT_UTF8("", result);
     utext_close(result);
@@ -2528,8 +2528,8 @@ void RegexTest::API_Replace_UTF8() {
     utext_openUTF8(&dataText, data, -1, &status); // ".abc..abc...abc.."
     matcher->reset(&dataText);
 
-    utext_openUTF8(&replText, NULL, 0, &status);
-    result = matcher->replaceFirst(&replText, NULL, status);
+    utext_openUTF8(&replText, nullptr, 0, &status);
+    result = matcher->replaceFirst(&replText, nullptr, status);
     REGEX_CHECK_STATUS;
     const char str_abcabc[] = { 0x2e, 0x2e, 0x2e, 0x61, 0x62, 0x63, 0x2e, 0x2e, 0x2e, 0x61, 0x62, 0x63, 0x2e, 0x2e, 0x00 }; /* ...abc...abc.. */
     REGEX_ASSERT_UTEXT_UTF8(str_abcabc, result);
@@ -2539,12 +2539,12 @@ void RegexTest::API_Replace_UTF8() {
     REGEX_ASSERT(result == &destText);
     REGEX_ASSERT_UTEXT_UTF8(str_abcabc, result);
 
-    result = matcher->replaceAll(&replText, NULL, status);
+    result = matcher->replaceAll(&replText, nullptr, status);
     REGEX_CHECK_STATUS;
     const char str_dots[] = { 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x2e, 0x00 }; /* ........ */
     REGEX_ASSERT_UTEXT_UTF8(str_dots, result);
     utext_close(result);
-    utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status);
+    utext_replace(&destText, 0, utext_nativeLength(&destText), nullptr, 0, &status);
     result = matcher->replaceAll(&replText, &destText, status);
     REGEX_CHECK_STATUS;
     REGEX_ASSERT(result == &destText);
@@ -2559,21 +2559,21 @@ void RegexTest::API_Replace_UTF8() {
 
     const char str_xyz[] = { 0x78, 0x79, 0x7a, 0x00 }; /* xyz */
     utext_openUTF8(&replText, str_xyz, -1, &status);
-    result = matcher->replaceFirst(&replText, NULL, status);
+    result = matcher->replaceFirst(&replText, nullptr, status);
     REGEX_CHECK_STATUS;
     REGEX_ASSERT_UTEXT_UTF8(str_xyz, result);
     utext_close(result);
-    utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status);
+    utext_replace(&destText, 0, utext_nativeLength(&destText), nullptr, 0, &status);
     result = matcher->replaceFirst(&replText, &destText, status);
     REGEX_CHECK_STATUS;
     REGEX_ASSERT(result == &destText);
     REGEX_ASSERT_UTEXT_UTF8(str_xyz, result);
 
-    result = matcher->replaceAll(&replText, NULL, status);
+    result = matcher->replaceAll(&replText, nullptr, status);
     REGEX_CHECK_STATUS;
     REGEX_ASSERT_UTEXT_UTF8(str_xyz, result);
     utext_close(result);
-    utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status);
+    utext_replace(&destText, 0, utext_nativeLength(&destText), nullptr, 0, &status);
     result = matcher->replaceAll(&replText, &destText, status);
     REGEX_CHECK_STATUS;
     REGEX_ASSERT(result == &destText);
@@ -2594,12 +2594,12 @@ void RegexTest::API_Replace_UTF8() {
 
     const char str_11[] = { 0x24, 0x31, 0x24, 0x31, 0x00 }; /* $1$1 */
     utext_openUTF8(&replText, str_11, -1, &status);
-    result = matcher2->replaceFirst(&replText, NULL, status);
+    result = matcher2->replaceFirst(&replText, nullptr, status);
     REGEX_CHECK_STATUS;
     const char str_bcbcdefg[] = { 0x62, 0x63, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x00 }; /* bcbcdefg */
     REGEX_ASSERT_UTEXT_UTF8(str_bcbcdefg, result);
     utext_close(result);
-    utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status);
+    utext_replace(&destText, 0, utext_nativeLength(&destText), nullptr, 0, &status);
     result = matcher2->replaceFirst(&replText, &destText, status);
     REGEX_CHECK_STATUS;
     REGEX_ASSERT(result == &destText);
@@ -2608,12 +2608,12 @@ void RegexTest::API_Replace_UTF8() {
     const char str_v[24] = { 0x54, 0x68, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x5c, 0x24, 0x31, 0x20, 0x69, 0x73, 0x20, 0x24, 0x31, 0x2e, 0x00 }; /* The value of \$1 is $1. */
     utext_openUTF8(&replText, str_v, -1, &status);
     REGEX_VERBOSE_TEXT(&replText);
-    result = matcher2->replaceFirst(&replText, NULL, status);
+    result = matcher2->replaceFirst(&replText, nullptr, status);
     REGEX_CHECK_STATUS;
     const char str_Thevalueof1isbcdefg[] = { 0x54, 0x68, 0x65, 0x20, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x6f, 0x66, 0x20, 0x24, 0x31, 0x20, 0x69, 0x73, 0x20, 0x62, 0x63, 0x2e, 0x64, 0x65, 0x66, 0x67, 0x00 }; /* The value of $1 is bc.defg */
     REGEX_ASSERT_UTEXT_UTF8(str_Thevalueof1isbcdefg, result);
     utext_close(result);
-    utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status);
+    utext_replace(&destText, 0, utext_nativeLength(&destText), nullptr, 0, &status);
     result = matcher2->replaceFirst(&replText, &destText, status);
     REGEX_CHECK_STATUS;
     REGEX_ASSERT(result == &destText);
@@ -2623,12 +2623,12 @@ void RegexTest::API_Replace_UTF8() {
                0x66, 0x2c, 0x20, 0x6e, 0x6f, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x6e, 0x75, 0x6d, 0x62,
                0x65, 0x72, 0x20, 0x5c, 0x24, 0x5c, 0x24, 0x5c, 0x24, 0x00 }; /* \$ by itself, no group number \$\$\$ */
     utext_openUTF8(&replText, str_byitselfnogroupnumber, -1, &status);
-    result = matcher2->replaceFirst(&replText, NULL, status);
+    result = matcher2->replaceFirst(&replText, nullptr, status);
     REGEX_CHECK_STATUS;
     const char str_byitselfnogroupnumberdefg[] = { 0x24, 0x20, 0x62, 0x79, 0x20, 0x69, 0x74, 0x73, 0x65, 0x6c, 0x66, 0x2c, 0x20, 0x6e, 0x6f, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x24, 0x24, 0x24, 0x64, 0x65, 0x66, 0x67, 0x00 }; /* $ by itself, no group number $$$defg */
     REGEX_ASSERT_UTEXT_UTF8(str_byitselfnogroupnumberdefg, result);
     utext_close(result);
-    utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status);
+    utext_replace(&destText, 0, utext_nativeLength(&destText), nullptr, 0, &status);
     result = matcher2->replaceFirst(&replText, &destText, status);
     REGEX_CHECK_STATUS;
     REGEX_ASSERT(result == &destText);
@@ -2643,22 +2643,22 @@ void RegexTest::API_Replace_UTF8() {
     supplDigitChars[25] = 0x8F;
     utext_openUTF8(&replText, (char *)supplDigitChars, -1, &status);
 
-    result = matcher2->replaceFirst(&replText, NULL, status);
+    result = matcher2->replaceFirst(&replText, nullptr, status);
     REGEX_CHECK_STATUS;
     const char str_SupplementalDigit1bcdefg[] = { 0x53, 0x75, 0x70, 0x70, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x6c, 0x20, 0x44, 0x69, 0x67, 0x69, 0x74, 0x20, 0x31, 0x20, 0x62, 0x63, 0x2e, 0x64, 0x65, 0x66, 0x67, 0x00 }; /* Supplemental Digit 1 bc.defg */
     REGEX_ASSERT_UTEXT_UTF8(str_SupplementalDigit1bcdefg, result);
     utext_close(result);
-    utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status);
+    utext_replace(&destText, 0, utext_nativeLength(&destText), nullptr, 0, &status);
     result = matcher2->replaceFirst(&replText, &destText, status);
     REGEX_CHECK_STATUS;
     REGEX_ASSERT(result == &destText);
     REGEX_ASSERT_UTEXT_UTF8(str_SupplementalDigit1bcdefg, result);
     const char str_badcapturegroupnumber5[] = { 0x62, 0x61, 0x64, 0x20, 0x63, 0x61, 0x70, 0x74, 0x75, 0x72, 0x65, 0x20, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x24, 0x35, 0x2e, 0x2e, 0x2e,  0x00 }; /* bad capture group number $5..." */
     utext_openUTF8(&replText, str_badcapturegroupnumber5, -1, &status);
-    REGEX_ASSERT_FAIL((result = matcher2->replaceFirst(&replText, NULL, status)), U_INDEX_OUTOFBOUNDS_ERROR);
+    REGEX_ASSERT_FAIL((result = matcher2->replaceFirst(&replText, nullptr, status)), U_INDEX_OUTOFBOUNDS_ERROR);
 //    REGEX_ASSERT_UTEXT_UTF8("abcdefg", result);
     utext_close(result);
-    utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status);
+    utext_replace(&destText, 0, utext_nativeLength(&destText), nullptr, 0, &status);
     REGEX_ASSERT_FAIL((result = matcher2->replaceFirst(&replText, &destText, status)), U_INDEX_OUTOFBOUNDS_ERROR);
     REGEX_ASSERT(result == &destText);
 //    REGEX_ASSERT_UTEXT_UTF8("abcdefg", result);
@@ -2673,12 +2673,12 @@ void RegexTest::API_Replace_UTF8() {
         utext_openUTF8(&replText, str_u0043, -1, &status);
         matcher->reset(&dataText);
 
-        result = matcher->replaceAll(&replText, NULL, status);
+        result = matcher->replaceAll(&replText, nullptr, status);
         REGEX_CHECK_STATUS;
         const char str_C1C2C3[] = { 0x2d, 0x2d, 0x43, 0x2d, 0x2d, 0x20, 0x31, 0x20, 0x2d, 0x2d, 0x43, 0x2d, 0x2d, 0x20, 0x32, 0x20, 0x2d, 0x2d, 0x43, 0x2d, 0x2d, 0x20, 0x33, 0x00 }; /* --C-- 1 --C-- 2 --C-- 3 */
         REGEX_ASSERT_UTEXT_UTF8(str_C1C2C3, result);
         utext_close(result);
-        utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status);
+        utext_replace(&destText, 0, utext_nativeLength(&destText), nullptr, 0, &status);
         result = matcher->replaceAll(&replText, &destText, status);
         REGEX_CHECK_STATUS;
         REGEX_ASSERT(result == &destText);
@@ -2698,11 +2698,11 @@ void RegexTest::API_Replace_UTF8() {
         expected[4] = 0x80;
         expected[5] = 0x80;
 
-        result = matcher->replaceAll(&replText, NULL, status);
+        result = matcher->replaceAll(&replText, nullptr, status);
         REGEX_CHECK_STATUS;
         REGEX_ASSERT_UTEXT_UTF8((char *)expected, result);
         utext_close(result);
-        utext_replace(&destText, 0, utext_nativeLength(&destText), NULL, 0, &status);
+        utext_replace(&destText, 0, utext_nativeLength(&destText), nullptr, 0, &status);
         result = matcher->replaceAll(&replText, &destText, status);
         REGEX_CHECK_STATUS;
         REGEX_ASSERT(result == &destText);
@@ -3094,10 +3094,10 @@ void RegexTest::API_Pattern_UTF8() {
         status = U_ZERO_ERROR;
         RegexMatcher matcher(UnicodeString("(:)"), 0, status);
         UnicodeString stringToSplit("first:second:third");
-        UText *textToSplit = utext_openUnicodeString(NULL, &stringToSplit, &status);
+        UText *textToSplit = utext_openUnicodeString(nullptr, &stringToSplit, &status);
         REGEX_CHECK_STATUS;
 
-        UText *splits[10] = {NULL};
+        UText *splits[10] = {nullptr};
         int32_t numFields = matcher.split(textToSplit, splits, UPRV_LENGTHOF(splits), status);
         REGEX_CHECK_STATUS;
         REGEX_ASSERT(numFields == 5);
@@ -3106,12 +3106,12 @@ void RegexTest::API_Pattern_UTF8() {
         REGEX_ASSERT_UTEXT_INVARIANT("second", splits[2]);
         REGEX_ASSERT_UTEXT_INVARIANT(":", splits[3]);
         REGEX_ASSERT_UTEXT_INVARIANT("third", splits[4]);
-        REGEX_ASSERT(splits[5] == NULL);
+        REGEX_ASSERT(splits[5] == nullptr);
 
         for (int i=0; i<UPRV_LENGTHOF(splits); i++) {
             if (splits[i]) {
                 utext_close(splits[i]);
-                splits[i] = NULL;
+                splits[i] = nullptr;
             }
         }
         utext_close(textToSplit);
@@ -3152,7 +3152,7 @@ RegexTest::getPath(char buffer[2048], const char *filename) {
     const char *testDataDirectory = IntlTest::getSourceTestData(status);
     if (U_FAILURE(status)) {
         errln("ERROR: loadTestData() failed - %s", u_errorName(status));
-        return NULL;
+        return nullptr;
     }
 
     strcpy(buffer, testDataDirectory);
@@ -3170,7 +3170,7 @@ void RegexTest::Extended() {
     //  Open and read the test data file.
     //
     srcPath=getPath(tdd, "regextst.txt");
-    if(srcPath==NULL) {
+    if(srcPath==nullptr) {
         return; /* something went wrong, error already output */
     }
 
@@ -3347,17 +3347,17 @@ void RegexTest::regex_find(const UnicodeString &pattern,
     UnicodeString       deTaggedInput;
 
     int32_t             patternUTF8Length,      inputUTF8Length;
-    char                *patternChars  = NULL, *inputChars = NULL;
+    char                *patternChars  = nullptr, *inputChars = nullptr;
     UText               patternText    = UTEXT_INITIALIZER;
     UText               inputText      = UTEXT_INITIALIZER;
-    UConverter          *UTF8Converter = NULL;
+    UConverter          *UTF8Converter = nullptr;
 
     UErrorCode          status         = U_ZERO_ERROR;
     UParseError         pe;
-    RegexPattern        *parsePat      = NULL;
-    RegexMatcher        *parseMatcher  = NULL;
-    RegexPattern        *callerPattern = NULL, *UTF8Pattern = NULL;
-    RegexMatcher        *matcher       = NULL, *UTF8Matcher = NULL;
+    RegexPattern        *parsePat      = nullptr;
+    RegexMatcher        *parseMatcher  = nullptr;
+    RegexPattern        *callerPattern = nullptr, *UTF8Pattern = nullptr;
+    RegexMatcher        *matcher       = nullptr, *UTF8Matcher = nullptr;
     UVector             groupStarts(status);
     UVector             groupEnds(status);
     UVector             groupStartsUTF8(status);
@@ -3425,9 +3425,9 @@ void RegexTest::regex_find(const UnicodeString &pattern,
     }
 
     UTF8Converter = ucnv_open("UTF8", &status);
-    ucnv_setFromUCallBack(UTF8Converter, UCNV_FROM_U_CALLBACK_STOP, NULL, NULL, NULL, &status);
+    ucnv_setFromUCallBack(UTF8Converter, UCNV_FROM_U_CALLBACK_STOP, nullptr, nullptr, nullptr, &status);
 
-    patternUTF8Length = pattern.extract(NULL, 0, UTF8Converter, status);
+    patternUTF8Length = pattern.extract(nullptr, 0, UTF8Converter, status);
     status = U_ZERO_ERROR; // buffer overflow
     patternChars = new char[patternUTF8Length+1];
     pattern.extract(patternChars, patternUTF8Length+1, UTF8Converter, status);
@@ -3458,7 +3458,7 @@ void RegexTest::regex_find(const UnicodeString &pattern,
         }
     }
 
-    if (UTF8Pattern == NULL) {
+    if (UTF8Pattern == nullptr) {
         // UTF-8 does not allow unpaired surrogates, so this could actually happen without being a failure of the engine
         logln("Unable to create UTF-8 pattern, skipping UTF-8 tests for %s:%d", srcPath, line);
         status = U_ZERO_ERROR;
@@ -3552,8 +3552,8 @@ void RegexTest::regex_find(const UnicodeString &pattern,
         matcher->setTrace(true);
     }
 
-    if (UTF8Pattern != NULL) {
-        inputUTF8Length = deTaggedInput.extract(NULL, 0, UTF8Converter, status);
+    if (UTF8Pattern != nullptr) {
+        inputUTF8Length = deTaggedInput.extract(nullptr, 0, UTF8Converter, status);
         status = U_ZERO_ERROR; // buffer overflow
         inputChars = new char[inputUTF8Length+1];
         deTaggedInput.extract(inputChars, inputUTF8Length+1, UTF8Converter, status);
@@ -3564,7 +3564,7 @@ void RegexTest::regex_find(const UnicodeString &pattern,
             REGEX_CHECK_STATUS_L(line);
         }
 
-        if (UTF8Matcher == NULL) {
+        if (UTF8Matcher == nullptr) {
             // UTF-8 does not allow unpaired surrogates, so this could actually happen without being a failure of the engine
             logln("Unable to create UTF-8 matcher, skipping UTF-8 tests for %s:%d", srcPath, line);
             status = U_ZERO_ERROR;
@@ -3574,7 +3574,7 @@ void RegexTest::regex_find(const UnicodeString &pattern,
     //
     //  Generate native indices for UTF8 versions of region and capture group info
     //
-    if (UTF8Matcher != NULL) {
+    if (UTF8Matcher != nullptr) {
         if (flags.indexOf((UChar)0x74) >= 0) {   //  't' trace flag
             UTF8Matcher->setTrace(true);
         }
@@ -3613,20 +3613,20 @@ void RegexTest::regex_find(const UnicodeString &pattern,
     if (regionStart>=0) {
        matcher->region(regionStart, regionEnd, status);
        REGEX_CHECK_STATUS_L(line);
-       if (UTF8Matcher != NULL) {
+       if (UTF8Matcher != nullptr) {
            UTF8Matcher->region(regionStartUTF8, regionEndUTF8, status);
            REGEX_CHECK_STATUS_L(line);
        }
     }
     if (flags.indexOf((UChar)0x61) >= 0) {   //  'a' anchoring bounds flag
         matcher->useAnchoringBounds(false);
-        if (UTF8Matcher != NULL) {
+        if (UTF8Matcher != nullptr) {
             UTF8Matcher->useAnchoringBounds(false);
         }
     }
     if (flags.indexOf((UChar)0x62) >= 0) {   //  'b' transparent bounds flag
         matcher->useTransparentBounds(true);
-        if (UTF8Matcher != NULL) {
+        if (UTF8Matcher != nullptr) {
             UTF8Matcher->useTransparentBounds(true);
         }
     }
@@ -3641,17 +3641,17 @@ void RegexTest::regex_find(const UnicodeString &pattern,
     for (i=0; i<numFinds; i++) {
         if (useMatchesFunc) {
             isMatch = matcher->matches(status);
-            if (UTF8Matcher != NULL) {
+            if (UTF8Matcher != nullptr) {
                isUTF8Match = UTF8Matcher->matches(status);
             }
         } else  if (useLookingAtFunc) {
             isMatch = matcher->lookingAt(status);
-            if (UTF8Matcher != NULL) {
+            if (UTF8Matcher != nullptr) {
                 isUTF8Match = UTF8Matcher->lookingAt(status);
             }
         } else {
             isMatch = matcher->find();
-            if (UTF8Matcher != NULL) {
+            if (UTF8Matcher != nullptr) {
                 isUTF8Match = UTF8Matcher->find();
             }
         }
@@ -3676,7 +3676,7 @@ void RegexTest::regex_find(const UnicodeString &pattern,
         dataerrln("Error at line %d:  Match expected, but none found.", line);
         failed = true;
         goto cleanupAndReturn;
-    } else if (UTF8Matcher != NULL && isUTF8Match == false && groupStarts.size() != 0) {
+    } else if (UTF8Matcher != nullptr && isUTF8Match == false && groupStarts.size() != 0) {
         errln("Error at line %d:  Match expected, but none found. (UTF8)", line);
         failed = true;
         goto cleanupAndReturn;
@@ -3704,7 +3704,7 @@ void RegexTest::regex_find(const UnicodeString &pattern,
                 line, i, expectedStart, matcher->start(i, status));
             failed = true;
             goto cleanupAndReturn;  // Good chance of subsequent bogus errors.  Stop now.
-        } else if (UTF8Matcher != NULL && UTF8Matcher->start(i, status) != expectedStartUTF8) {
+        } else if (UTF8Matcher != nullptr && UTF8Matcher->start(i, status) != expectedStartUTF8) {
             errln("Error at line %d: incorrect start position for group %d.  Expected %d, got %d (UTF8)",
                   line, i, expectedStartUTF8, UTF8Matcher->start(i, status));
             failed = true;
@@ -3719,7 +3719,7 @@ void RegexTest::regex_find(const UnicodeString &pattern,
             failed = true;
             // Error on end position;  keep going; real error is probably yet to come as group
             //   end positions work from end of the input data towards the front.
-        } else if (UTF8Matcher != NULL && UTF8Matcher->end(i, status) != expectedEndUTF8) {
+        } else if (UTF8Matcher != nullptr && UTF8Matcher->end(i, status) != expectedEndUTF8) {
             errln("Error at line %d: incorrect end position for group %d.  Expected %d, got %d (UTF8)",
                   line, i, expectedEndUTF8, UTF8Matcher->end(i, status));
             failed = true;
@@ -3732,7 +3732,7 @@ void RegexTest::regex_find(const UnicodeString &pattern,
             line, groupStarts.size()-1, matcher->groupCount());
         failed = true;
         }
-    else if (UTF8Matcher != NULL && UTF8Matcher->groupCount()+1 < groupStarts.size()) {
+    else if (UTF8Matcher != nullptr && UTF8Matcher->groupCount()+1 < groupStarts.size()) {
         errln("Error at line %d: Expected %d capture groups, found %d. (UTF8)",
               line, groupStarts.size()-1, UTF8Matcher->groupCount());
         failed = true;
@@ -3742,7 +3742,7 @@ void RegexTest::regex_find(const UnicodeString &pattern,
         matcher->requireEnd() == true) {
         errln("Error at line %d: requireEnd() returned true.  Expected false", line);
         failed = true;
-    } else if (UTF8Matcher != NULL && (flags.indexOf((UChar)0x59) >= 0) &&   //  'Y' flag:  RequireEnd() == false
+    } else if (UTF8Matcher != nullptr && (flags.indexOf((UChar)0x59) >= 0) &&   //  'Y' flag:  RequireEnd() == false
         UTF8Matcher->requireEnd() == true) {
         errln("Error at line %d: requireEnd() returned true.  Expected false (UTF8)", line);
         failed = true;
@@ -3752,7 +3752,7 @@ void RegexTest::regex_find(const UnicodeString &pattern,
         matcher->requireEnd() == false) {
         errln("Error at line %d: requireEnd() returned false.  Expected true", line);
         failed = true;
-    } else if (UTF8Matcher != NULL && (flags.indexOf((UChar)0x79) >= 0) &&   //  'Y' flag:  RequireEnd() == false
+    } else if (UTF8Matcher != nullptr && (flags.indexOf((UChar)0x79) >= 0) &&   //  'Y' flag:  RequireEnd() == false
         UTF8Matcher->requireEnd() == false) {
         errln("Error at line %d: requireEnd() returned false.  Expected true (UTF8)", line);
         failed = true;
@@ -3762,7 +3762,7 @@ void RegexTest::regex_find(const UnicodeString &pattern,
         matcher->hitEnd() == true) {
         errln("Error at line %d: hitEnd() returned true.  Expected false", line);
         failed = true;
-    } else if (UTF8Matcher != NULL && (flags.indexOf((UChar)0x5A) >= 0) &&   //  'Z' flag:  hitEnd() == false
+    } else if (UTF8Matcher != nullptr && (flags.indexOf((UChar)0x5A) >= 0) &&   //  'Z' flag:  hitEnd() == false
                UTF8Matcher->hitEnd() == true) {
         errln("Error at line %d: hitEnd() returned true.  Expected false (UTF8)", line);
         failed = true;
@@ -3772,7 +3772,7 @@ void RegexTest::regex_find(const UnicodeString &pattern,
         matcher->hitEnd() == false) {
         errln("Error at line %d: hitEnd() returned false.  Expected true", line);
         failed = true;
-    } else if (UTF8Matcher != NULL && (flags.indexOf((UChar)0x7A) >= 0) &&   //  'z' flag:  hitEnd() == true
+    } else if (UTF8Matcher != nullptr && (flags.indexOf((UChar)0x7A) >= 0) &&   //  'z' flag:  hitEnd() == true
                UTF8Matcher->hitEnd() == false) {
         errln("Error at line %d: hitEnd() returned false.  Expected true (UTF8)", line);
         failed = true;
@@ -3919,7 +3919,7 @@ void RegexTest::PerlTests() {
     //  Open and read the test data file.
     //
     srcPath=getPath(tdd, "re_tests.txt");
-    if(srcPath==NULL) {
+    if(srcPath==nullptr) {
         return; /* something went wrong, error already output */
     }
 
@@ -4276,21 +4276,21 @@ void RegexTest::PerlTestsUTF8() {
     UParseError pe;
     LocalUConverterPointer UTF8Converter(ucnv_open("UTF-8", &status));
     UText       patternText = UTEXT_INITIALIZER;
-    char       *patternChars = NULL;
+    char       *patternChars = nullptr;
     int32_t     patternLength;
     int32_t     patternCapacity = 0;
     UText       inputText = UTEXT_INITIALIZER;
-    char       *inputChars = NULL;
+    char       *inputChars = nullptr;
     int32_t     inputLength;
     int32_t     inputCapacity = 0;
 
-    ucnv_setFromUCallBack(UTF8Converter.getAlias(), UCNV_FROM_U_CALLBACK_STOP, NULL, NULL, NULL, &status);
+    ucnv_setFromUCallBack(UTF8Converter.getAlias(), UCNV_FROM_U_CALLBACK_STOP, nullptr, nullptr, nullptr, &status);
 
     //
     //  Open and read the test data file.
     //
     srcPath=getPath(tdd, "re_tests.txt");
-    if(srcPath==NULL) {
+    if(srcPath==nullptr) {
         return; /* something went wrong, error already output */
     }
 
@@ -4721,8 +4721,8 @@ void RegexTest::Callbacks() {
         REGEX_CHECK_STATUS;
         matcher.getMatchCallback(returnedFn, returnedContext, status);
         REGEX_CHECK_STATUS;
-        REGEX_ASSERT(returnedFn == NULL);
-        REGEX_ASSERT(returnedContext == NULL);
+        REGEX_ASSERT(returnedFn == nullptr);
+        REGEX_ASSERT(returnedContext == nullptr);
     }
 
    {
@@ -4825,8 +4825,8 @@ void RegexTest::FindProgressCallbacks() {
         REGEX_CHECK_STATUS;
         matcher.getFindProgressCallback(returnedFn, returnedContext, status);
         REGEX_CHECK_STATUS;
-        REGEX_ASSERT(returnedFn == NULL);
-        REGEX_ASSERT(returnedContext == NULL);
+        REGEX_ASSERT(returnedFn == nullptr);
+        REGEX_ASSERT(returnedContext == nullptr);
     }
 
    {
@@ -4926,7 +4926,7 @@ void RegexTest::PreAllocatedUTextCAPI () {
         utext_openUChars(&text2, text2Chars, -1, &status);
 
         regextst_openUTF8FromInvariant(&patternText, "abc*d", -1, &status);
-        re = uregex_openUText(&patternText, 0, NULL, &status);
+        re = uregex_openUText(&patternText, 0, nullptr, &status);
 
         /* First set a UText */
         uregex_setUText(re, &text1, &status);
@@ -4972,7 +4972,7 @@ void RegexTest::PreAllocatedUTextCAPI () {
         //                  0         1         2         3         4
 
         status = U_ZERO_ERROR;
-        re = uregex_openC("abc(.*?)def", 0, NULL, &status);
+        re = uregex_openC("abc(.*?)def", 0, nullptr, &status);
         REGEX_CHECK_STATUS;
 
         uregex_setText(re, text1, -1, &status);
@@ -5022,13 +5022,13 @@ void RegexTest::PreAllocatedUTextCAPI () {
         u_uastrncpy(text2, "No match here.",  UPRV_LENGTHOF(text2)/2);
         regextst_openUTF8FromInvariant(&replText, "<$1>", -1, &status);
 
-        re = uregex_openC("x(.*?)x", 0, NULL, &status);
+        re = uregex_openC("x(.*?)x", 0, nullptr, &status);
         REGEX_CHECK_STATUS;
 
         /*  Normal case, with match */
         uregex_setText(re, text1, -1, &status);
         REGEX_CHECK_STATUS;
-        utext_replace(&bufferText, 0, utext_nativeLength(&bufferText), NULL, 0, &status);
+        utext_replace(&bufferText, 0, utext_nativeLength(&bufferText), nullptr, 0, &status);
         REGEX_CHECK_STATUS;
         result = uregex_replaceFirstUText(re, &replText, &bufferText, &status);
         REGEX_CHECK_STATUS;
@@ -5037,7 +5037,7 @@ void RegexTest::PreAllocatedUTextCAPI () {
 
         /* No match.  Text should copy to output with no changes.  */
         uregex_setText(re, text2, -1, &status);
-        utext_replace(&bufferText, 0, utext_nativeLength(&bufferText), NULL, 0, &status);
+        utext_replace(&bufferText, 0, utext_nativeLength(&bufferText), nullptr, 0, &status);
         result = uregex_replaceFirstUText(re, &replText, &bufferText, &status);
         REGEX_CHECK_STATUS;
         REGEX_ASSERT(result == &bufferText);
@@ -5046,7 +5046,7 @@ void RegexTest::PreAllocatedUTextCAPI () {
         /* Unicode escapes */
         uregex_setText(re, text1, -1, &status);
         regextst_openUTF8FromInvariant(&replText, "\\\\\\u0041$1\\U00000042\\$\\a", -1, &status);
-        utext_replace(&bufferText, 0, utext_nativeLength(&bufferText), NULL, 0, &status);
+        utext_replace(&bufferText, 0, utext_nativeLength(&bufferText), nullptr, 0, &status);
         result = uregex_replaceFirstUText(re, &replText, &bufferText, &status);
         REGEX_CHECK_STATUS;
         REGEX_ASSERT(result == &bufferText);
@@ -5071,12 +5071,12 @@ void RegexTest::PreAllocatedUTextCAPI () {
         u_uastrncpy(text2, "No match here.",  sizeof(text2)/2);
         regextst_openUTF8FromInvariant(&replText, "<$1>", -1, &status);
 
-        re = uregex_openC("x(.*?)x", 0, NULL, &status);
+        re = uregex_openC("x(.*?)x", 0, nullptr, &status);
         REGEX_CHECK_STATUS;
 
         /*  Normal case, with match */
         uregex_setText(re, text1, -1, &status);
-        utext_replace(&bufferText, 0, utext_nativeLength(&bufferText), NULL, 0, &status);
+        utext_replace(&bufferText, 0, utext_nativeLength(&bufferText), nullptr, 0, &status);
         result = uregex_replaceAllUText(re, &replText, &bufferText, &status);
         REGEX_CHECK_STATUS;
         REGEX_ASSERT(result == &bufferText);
@@ -5084,7 +5084,7 @@ void RegexTest::PreAllocatedUTextCAPI () {
 
         /* No match.  Text should copy to output with no changes.  */
         uregex_setText(re, text2, -1, &status);
-        utext_replace(&bufferText, 0, utext_nativeLength(&bufferText), NULL, 0, &status);
+        utext_replace(&bufferText, 0, utext_nativeLength(&bufferText), nullptr, 0, &status);
         result = uregex_replaceAllUText(re, &replText, &bufferText, &status);
         REGEX_CHECK_STATUS;
         REGEX_ASSERT(result == &bufferText);
@@ -5136,7 +5136,7 @@ void RegexTest::NamedCapture() {
     // After copying a pattern, named capture should still work in the copy.
     RegexPattern *copiedPat = new RegexPattern(*pat);
     REGEX_ASSERT(*copiedPat == *pat);
-    delete pat; pat = NULL;  // Delete original, copy should have no references back to it.
+    delete pat; pat = nullptr;  // Delete original, copy should have no references back to it.
 
     group = copiedPat->groupNumberFromName("five", -1, status);
     REGEX_CHECK_STATUS;
@@ -5234,7 +5234,7 @@ void RegexTest::NamedCapture() {
     //  TODO: factor out the test data.
 
     status = U_ZERO_ERROR;
-    URegularExpression *re = uregex_openC("..(?<one>m)(.)(.)", 0, NULL, &status);
+    URegularExpression *re = uregex_openC("..(?<one>m)(.)(.)", 0, nullptr, &status);
     REGEX_CHECK_STATUS;
     text = UnicodeString("abcmxyz");
     uregex_setText(re, text.getBuffer(), text.length(), &status);
@@ -5385,8 +5385,8 @@ void RegexTest::Bug7651() {
     //  It will cause a segfault if RegexMatcher tries to use fSmallData instead of malloc'ing the memory needed (see init2) for the pattern operator stack allocation.
     UnicodeString pattern2("((https?\\:\\/\\/|www\\.)\\S+(?<![\\!\\),\\.:;\\]\\u0080-\\uFFFF])|(?<![A-Za-z0-9_])[\\@\\uff20][A-Za-z0-9_]+(?:\\/[\\w\\-]+)?|(?<![A-Za-z0-9])[\\#\\uff03][A-Za-z0-9_][A-Za-z0-9_\\u00c0-\\u00d6\\u00c8-\\u00f6\\u00f8-\\u00ff]*|\\$[A-Za-z]+)");
     UnicodeString s("#ff @abcd This is test");
-    RegexPattern  *REPattern = NULL;
-    RegexMatcher  *REMatcher = NULL;
+    RegexPattern  *REPattern = nullptr;
+    RegexMatcher  *REMatcher = nullptr;
     UErrorCode status = U_ZERO_ERROR;
     UParseError pe;
 
@@ -5505,12 +5505,12 @@ void RegexTest::Bug10459() {
     UnicodeString patternString("(txt)");
     UnicodeString txtString("txt");
 
-    UText *utext_pat = utext_openUnicodeString(NULL, &patternString, &status);
+    UText *utext_pat = utext_openUnicodeString(nullptr, &patternString, &status);
     REGEX_CHECK_STATUS;
-    UText *utext_txt = utext_openUnicodeString(NULL, &txtString, &status);
+    UText *utext_txt = utext_openUnicodeString(nullptr, &txtString, &status);
     REGEX_CHECK_STATUS;
 
-    URegularExpression *icu_re = uregex_openUText(utext_pat, 0, NULL, &status);
+    URegularExpression *icu_re = uregex_openUText(utext_pat, 0, nullptr, &status);
     REGEX_CHECK_STATUS;
 
     uregex_setUText(icu_re, utext_txt, &status);
@@ -5588,7 +5588,7 @@ void RegexTest::TestCase11049(const char *pattern, const char *data, UBool expec
     UnicodeString dataString = UnicodeString(data).unescape();
     UChar *exactBuffer = new UChar[dataString.length()];
     dataString.extract(exactBuffer, dataString.length(), status);
-    UText *ut = utext_openUChars(NULL, exactBuffer, dataString.length(), &status);
+    UText *ut = utext_openUChars(nullptr, exactBuffer, dataString.length(), &status);
 
     LocalPointer<RegexMatcher> matcher(compiledPat->matcher(status));
     REGEX_CHECK_STATUS;
@@ -5604,7 +5604,7 @@ void RegexTest::TestCase11049(const char *pattern, const char *data, UBool expec
     //   Size of the original char * data (invariant charset) will be <= than the equivalent UTF-8
     //   because string.unescape() will only shrink it.
     char * utf8Buffer = new char[uprv_strlen(data)+1];
-    u_strToUTF8(utf8Buffer, static_cast<int32_t>(uprv_strlen(data)+1), NULL, dataString.getBuffer(), dataString.length(), &status);
+    u_strToUTF8(utf8Buffer, static_cast<int32_t>(uprv_strlen(data)+1), nullptr, dataString.getBuffer(), dataString.length(), &status);
     REGEX_CHECK_STATUS;
     ut = utext_openUTF8(ut, utf8Buffer, -1, &status);
     REGEX_CHECK_STATUS;
@@ -5671,7 +5671,7 @@ void RegexTest::TestBug11480() {
     //         indistinguishable from a group with a zero length match.)
 
     UErrorCode status = U_ZERO_ERROR;
-    URegularExpression *re = uregex_openC("(A)|(B)", 0, NULL, &status);
+    URegularExpression *re = uregex_openC("(A)|(B)", 0, nullptr, &status);
     REGEX_CHECK_STATUS;
     UnicodeString text = UNICODE_STRING_SIMPLE("A");
     uregex_setText(re, text.getBuffer(), text.length(), &status);
@@ -5734,7 +5734,7 @@ void RegexTest::TestBug12884() {
                           "carácter, sin importar la plataforma, sin importar el programa,"
                           "sin importar el idioma.");
     status = U_ZERO_ERROR;
-    LocalUTextPointer ut(utext_openUTF8(NULL, text8.data(), text8.length(), &status));
+    LocalUTextPointer ut(utext_openUTF8(nullptr, text8.data(), text8.length(), &status));
     REGEX_CHECK_STATUS;
     m.reset(ut.getAlias());
     m.find(status);
index d11e447b62b29489ba70d221f3ab130e68bb59e8..5cb38cfb123d7e523bf52d411fbac18c03378c5b 100644 (file)
@@ -24,7 +24,7 @@ public:
     RegexTest();
     virtual ~RegexTest();
 
-    virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     // The following are test functions that are visible from the intltest test framework.
     virtual void API_Match();
index bfb5810e7e355b6a5d9aa7db4ad4276a8f7bcfea..ab257ad6aa49f4c7d87f1f79f5b5d4c5b9b5c2df 100644 (file)
@@ -30,18 +30,18 @@ typedef struct KnownRegion {
 static KnownRegion knownRegions[] = {
     // Code, Num, Parent, Type,             Containing Continent
     { "TP" , 626, "035", URGN_TERRITORY, "142" },
-    { "001", 1,  NULL ,  URGN_WORLD,        NULL },
-    { "002", 2,  "001",  URGN_CONTINENT,    NULL },
-    { "003", 3,  NULL,   URGN_GROUPING,     NULL },
+    { "001", 1,  nullptr ,  URGN_WORLD,        nullptr },
+    { "002", 2,  "001",  URGN_CONTINENT,    nullptr },
+    { "003", 3,  nullptr,   URGN_GROUPING,     nullptr },
     { "005", 5,  "019",  URGN_SUBCONTINENT, "019" },
-    { "009", 9,  "001",  URGN_CONTINENT,    NULL},
+    { "009", 9,  "001",  URGN_CONTINENT,    nullptr},
     { "011", 11, "002",  URGN_SUBCONTINENT, "002" },
     { "013", 13, "019",  URGN_SUBCONTINENT, "019" },
     { "014", 14, "002",  URGN_SUBCONTINENT, "002" },
     { "015", 15, "002",  URGN_SUBCONTINENT, "002" },
     { "017", 17, "002",  URGN_SUBCONTINENT, "002" },
     { "018", 18, "002",  URGN_SUBCONTINENT, "002" },
-    { "019", 19, "001",  URGN_CONTINENT, NULL },
+    { "019", 19, "001",  URGN_CONTINENT, nullptr },
     { "021", 21, "019",  URGN_SUBCONTINENT, "019" },
     { "029", 29, "019",  URGN_SUBCONTINENT, "019" },
     { "030", 30, "142",  URGN_SUBCONTINENT, "142" },
@@ -52,14 +52,14 @@ static KnownRegion knownRegions[] = {
     { "054", 54, "009",  URGN_SUBCONTINENT, "009" },
     { "057", 57, "009",  URGN_SUBCONTINENT, "009" },
     { "061", 61, "009",  URGN_SUBCONTINENT, "009" },
-    { "142", 142, "001", URGN_CONTINENT, NULL },
+    { "142", 142, "001", URGN_CONTINENT, nullptr },
     { "143", 143, "142", URGN_SUBCONTINENT, "142" },
     { "145", 145, "142", URGN_SUBCONTINENT, "142" },
-    { "150", 150, "001", URGN_CONTINENT, NULL },
+    { "150", 150, "001", URGN_CONTINENT, nullptr },
     { "151", 151, "150", URGN_SUBCONTINENT, "150" },
     { "154", 154, "150", URGN_SUBCONTINENT, "150" },
     { "155", 155, "150", URGN_SUBCONTINENT, "150" },
-    { "419", 419, NULL,  URGN_GROUPING , NULL},
+    { "419", 419, nullptr,  URGN_GROUPING , nullptr},
     { "AC" ,  -1, "QO" , URGN_TERRITORY, "009" },
     { "AD" ,  20, "039", URGN_TERRITORY, "150" },
     { "AE" , 784, "145", URGN_TERRITORY, "142" },
@@ -68,7 +68,7 @@ static KnownRegion knownRegions[] = {
     { "AI" , 660, "029", URGN_TERRITORY, "019" },
     { "AL" ,   8, "039", URGN_TERRITORY, "150" },
     { "AM" ,  51, "145", URGN_TERRITORY, "142" },
-    { "AN" , 530, NULL,  URGN_DEPRECATED, NULL },
+    { "AN" , 530, nullptr,  URGN_DEPRECATED, nullptr },
     { "AO" ,  24, "017", URGN_TERRITORY, "002" },
     { "AQ" ,  10, "QO" , URGN_TERRITORY, "009" },
     { "AR" ,  32, "005", URGN_TERRITORY, "019" },
@@ -136,7 +136,7 @@ static KnownRegion knownRegions[] = {
     { "ER" , 232, "014", URGN_TERRITORY, "002" },
     { "ES" , 724, "039", URGN_TERRITORY, "150" },
     { "ET" , 231, "014", URGN_TERRITORY, "002" },
-    { "EU" , 967, NULL,  URGN_GROUPING, NULL },
+    { "EU" , 967, nullptr,  URGN_GROUPING, nullptr },
     { "FI" , 246, "154", URGN_TERRITORY, "150" },
     { "FJ" , 242, "054", URGN_TERRITORY, "009" },
     { "FK" , 238, "005", URGN_TERRITORY, "019" },
@@ -239,7 +239,7 @@ static KnownRegion knownRegions[] = {
     { "NO" , 578, "154", URGN_TERRITORY, "150" },
     { "NP" , 524, "034", URGN_TERRITORY, "142" },
     { "NR" , 520, "057", URGN_TERRITORY, "009" },
-    { "NT" , 536, NULL , URGN_DEPRECATED, NULL },
+    { "NT" , 536, nullptr , URGN_DEPRECATED, nullptr },
     { "NU" , 570, "061", URGN_TERRITORY, "009" },
     { "NZ" , 554, "053", URGN_TERRITORY, "009" },
     { "OM" , 512, "145", URGN_TERRITORY, "142" },
@@ -259,7 +259,7 @@ static KnownRegion knownRegions[] = {
     { "PY" , 600, "005", URGN_TERRITORY, "019" },
     { "QA" , 634, "145", URGN_TERRITORY, "142" },
     { "QO" , 961, "009", URGN_SUBCONTINENT, "009" },
-    { "QU" , 967, NULL,  URGN_GROUPING, NULL },
+    { "QU" , 967, nullptr,  URGN_GROUPING, nullptr },
     { "RE" , 638, "014", URGN_TERRITORY, "002" },
     { "RO" , 642, "151", URGN_TERRITORY, "150" },
     { "RS" , 688, "039", URGN_TERRITORY, "150" },
@@ -282,7 +282,7 @@ static KnownRegion knownRegions[] = {
     { "SR" , 740, "005", URGN_TERRITORY, "019" },
     { "SS" , 728, "014", URGN_TERRITORY, "002" },
     { "ST" , 678, "017", URGN_TERRITORY, "002" },
-    { "SU" , 810, NULL , URGN_DEPRECATED , NULL},
+    { "SU" , 810, nullptr , URGN_DEPRECATED , nullptr},
     { "SV" , 222, "013", URGN_TERRITORY, "019" },
     { "SX" , 534, "029", URGN_TERRITORY, "019" },
     { "SY" , 760, "145", URGN_TERRITORY, "142" },
@@ -327,7 +327,7 @@ static KnownRegion knownRegions[] = {
     { "ZM" , 894, "014", URGN_TERRITORY, "002" },
     { "ZR" , 180, "017", URGN_TERRITORY, "002" },
     { "ZW" , 716, "014", URGN_TERRITORY, "002" },
-    { "ZZ" , 999, NULL , URGN_UNKNOWN, NULL }
+    { "ZZ" , 999, nullptr , URGN_UNKNOWN, nullptr }
     };
 
 // *****************************************************************************
@@ -414,9 +414,9 @@ void RegionTest::TestGetInstanceString() {
 
 
     UErrorCode status = U_ZERO_ERROR;
-    const Region *r = Region::getInstance((const char *)NULL,status);
+    const Region *r = Region::getInstance((const char *)nullptr,status);
     if ( status != U_ILLEGAL_ARGUMENT_ERROR ) {
-        errcheckln(status, "Calling Region::getInstance(NULL) should have triggered an U_ILLEGAL_ARGUMENT_ERROR, but didn't. - %s", u_errorName(status));
+        errcheckln(status, "Calling Region::getInstance(nullptr) should have triggered an U_ILLEGAL_ARGUMENT_ERROR, but didn't. - %s", u_errorName(status));
     }
 
     status = U_ZERO_ERROR;
@@ -436,7 +436,7 @@ void RegionTest::TestGetInstanceString() {
             id = r->getRegionCode();
             type = r->getType();
         } else {
-            id = "NULL";
+            id = "nullptr";
             type = URGN_UNKNOWN;
         }
         if ( uprv_strcmp(id,data.expectedID)) {
@@ -480,7 +480,7 @@ void RegionTest::TestGetInstanceInt() {
             id = r->getRegionCode();
             type = r->getType();
         } else {
-            id = "NULL";
+            id = "nullptr";
             type = URGN_UNKNOWN;
         }
         if ( uprv_strcmp(data.expectedID,id)) {
@@ -508,12 +508,12 @@ void RegionTest::TestGetContainedRegions() {
               continue;
             }
             for ( int32_t i = 0 ; i < containedRegions->count(status); i++ ) {
-                const char *crID = containedRegions->next(NULL,status);
+                const char *crID = containedRegions->next(nullptr,status);
                 const Region *cr = Region::getInstance(crID,status);
-                const Region *containingRegion = cr ? cr->getContainingRegion() : NULL;
+                const Region *containingRegion = cr ? cr->getContainingRegion() : nullptr;
                 if ( !containingRegion || *containingRegion != *r ) {
                     errln("Region: %s contains region %s. Expected containing region of this region to be the original region, but got %s",
-                        r->getRegionCode(),cr->getRegionCode(),containingRegion?containingRegion->getRegionCode():"NULL"); 
+                        r->getRegionCode(),cr->getRegionCode(),containingRegion?containingRegion->getRegionCode():"nullptr"); 
                 }
             }
             delete containedRegions;
@@ -539,12 +539,12 @@ void RegionTest::TestGetContainedRegionsWithType() {
               continue;
             }
             for ( int32_t j = 0 ; j < containedRegions->count(status); j++ ) {
-                const char *crID = containedRegions->next(NULL,status);
+                const char *crID = containedRegions->next(nullptr,status);
                 const Region *cr = Region::getInstance(crID,status);
-                const Region *containingRegion = cr ? cr->getContainingRegion(URGN_CONTINENT) : NULL;
+                const Region *containingRegion = cr ? cr->getContainingRegion(URGN_CONTINENT) : nullptr;
                 if ( !containingRegion || *containingRegion != *r ) {
                     errln("Continent: %s contains territory %s. Expected containing continent of this region to be the original region, but got %s",
-                        r->getRegionCode(),cr->getRegionCode(),containingRegion?containingRegion->getRegionCode():"NULL"); 
+                        r->getRegionCode(),cr->getRegionCode(),containingRegion?containingRegion->getRegionCode():"nullptr"); 
                 }
             }
             delete containedRegions;
@@ -561,15 +561,15 @@ void RegionTest::TestGetContainingRegion() {
         const Region *r = Region::getInstance(rd.code,status);
         if (r) {
             const Region *c = r->getContainingRegion();
-            if (rd.parent == NULL) {                   
+            if (rd.parent == nullptr) {                   
                 if ( c ) {
-                    errln("Containing region for %s should have been NULL.  Got: %s",r->getRegionCode(),c->getRegionCode());
+                    errln("Containing region for %s should have been nullptr.  Got: %s",r->getRegionCode(),c->getRegionCode());
                 }
             } else {
                 const Region *p = Region::getInstance(rd.parent,status);                   
                 if ( !c || *p != *c ) {
                     errln("Expected containing continent of region %s to be %s. Got: %s",
-                        r->getRegionCode(),p?p->getRegionCode():"NULL",c?c->getRegionCode():"NULL" );
+                        r->getRegionCode(),p?p->getRegionCode():"nullptr",c?c->getRegionCode():"nullptr" );
                 }
             }
         } else {
@@ -586,15 +586,15 @@ void RegionTest::TestGetContainingRegionWithType() {
         const Region *r = Region::getInstance(rd.code,status);
         if (r) {
             const Region *c = r->getContainingRegion(URGN_CONTINENT);
-            if (rd.containingContinent == NULL) {
-                 if ( c != NULL) {
-                     errln("Containing continent for %s should have been NULL.  Got: %s",r->getRegionCode(), c->getRegionCode());
+            if (rd.containingContinent == nullptr) {
+                 if ( c != nullptr) {
+                     errln("Containing continent for %s should have been nullptr.  Got: %s",r->getRegionCode(), c->getRegionCode());
                  }
             } else {
                 const Region *p = Region::getInstance(rd.containingContinent,status);                   
                 if ( *p != *c ) {
                     errln("Expected containing continent of region %s to be %s. Got: %s",
-                        r->getRegionCode(),p?p->getRegionCode():"NULL",c?c->getRegionCode():"NULL" );
+                        r->getRegionCode(),p?p->getRegionCode():"nullptr",c?c->getRegionCode():"nullptr" );
                 }
             }
         } else {
@@ -606,12 +606,12 @@ void RegionTest::TestGetContainingRegionWithType() {
 void RegionTest::TestGetPreferredValues() {
     static const char *testData[6][17] = {
         //  Input ID, Expected Preferred Values...
-        { "AN", "CW", "SX", "BQ", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }, // Netherlands Antilles
-        { "CS", "RS", "ME", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL },     // Serbia & Montenegro
-        { "FQ", "AQ", "TF", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL },     // French Southern and Antarctic Territories
-        { "NT", "IQ", "SA", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL },     // Neutral Zone
-        { "PC", "FM", "MH", "MP", "PW", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, }, // Pacific Islands Trust Territory
-        { "SU", "RU", "AM", "AZ", "BY", "EE", "GE", "KZ", "KG", "LV", "LT", "MD", "TJ", "TM", "UA", "UZ" , NULL}, // Soviet Union
+        { "AN", "CW", "SX", "BQ", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }, // Netherlands Antilles
+        { "CS", "RS", "ME", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr },     // Serbia & Montenegro
+        { "FQ", "AQ", "TF", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr },     // French Southern and Antarctic Territories
+        { "NT", "IQ", "SA", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr },     // Neutral Zone
+        { "PC", "FM", "MH", "MP", "PW", nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, }, // Pacific Islands Trust Territory
+        { "SU", "RU", "AM", "AZ", "BY", "EE", "GE", "KZ", "KG", "LV", "LT", "MD", "TJ", "TM", "UA", "UZ" , nullptr}, // Soviet Union
     };
 
     for ( int32_t i = 0 ; i < 6 ; i++ ) {
@@ -627,7 +627,7 @@ void RegionTest::TestGetPreferredValues() {
             for ( int i = 1 ; data[i] ; i++ ) {
                 UBool found = false;
                 preferredValues->reset(status);
-                while ( const char *check = preferredValues->next(NULL,status) ) {
+                while ( const char *check = preferredValues->next(nullptr,status) ) {
                     if ( !uprv_strcmp(check,data[i]) ) {
                         found = true;
                         break;
@@ -691,20 +691,20 @@ void RegionTest::TestAvailableTerritories() {
                 if ( i > 0 ) {
                     uprv_strcat(availableTerritoriesString," ");
                 }
-                uprv_strcat(availableTerritoriesString,availableTerritories->next(NULL,status));
+                uprv_strcat(availableTerritoriesString,availableTerritories->next(nullptr,status));
             }
         } else {
-            uprv_strcpy(availableTerritoriesString,"NULL");
+            uprv_strcpy(availableTerritoriesString,"nullptr");
         }
         if ( containedInWorld ) {
             for (int32_t i = 0 ; i < containedInWorld->count(status) ; i++ ) {
                 if ( i > 0 ) {
                     uprv_strcat(containedInWorldString," ");
                 }
-                uprv_strcat(containedInWorldString,containedInWorld->next(NULL,status));
+                uprv_strcat(containedInWorldString,containedInWorld->next(nullptr,status));
             }
         } else {
-            uprv_strcpy(containedInWorldString,"NULL");
+            uprv_strcpy(containedInWorldString,"nullptr");
         }
         errln("Available territories and all territories contained in world should be the same set.\nAvailable          = %s\nContained in World = %s",
             availableTerritoriesString,containedInWorldString);
@@ -716,7 +716,7 @@ void RegionTest::TestAvailableTerritories() {
 void RegionTest::TestNoContainedRegions(void) {
   UErrorCode status = U_ZERO_ERROR;
   const Region *region = Region::getInstance("BM",status);
-  if (U_FAILURE(status) || region == NULL) {
+  if (U_FAILURE(status) || region == nullptr) {
       dataerrln("Fail called to Region::getInstance(\"BM\", status) - %s", u_errorName(status));
       return;
   }
@@ -725,8 +725,8 @@ void RegionTest::TestNoContainedRegions(void) {
       errln("%s->getContainedRegions(status) failed: %s", region->getRegionCode(), u_errorName(status));
       return;
   }
-  const char *emptyStr = containedRegions->next(NULL, status);
-  if (U_FAILURE(status)||(emptyStr!=NULL)) {
+  const char *emptyStr = containedRegions->next(nullptr, status);
+  if (U_FAILURE(status)||(emptyStr!=nullptr)) {
     errln("Error, 'BM' should have no subregions, but returned str=%p, err=%s\n", emptyStr, u_errorName(status));
   } else {
     logln("Success - BM has no subregions\n");
@@ -753,11 +753,11 @@ void RegionTest::TestGroupingChildren(void) {
                 int32_t numActualChildren = actualChildren->count(err);
                 int32_t numExpectedChildren = 0;
                 const char* expectedChildStart = expectedChildren;
-                const char* expectedChildEnd = NULL;
-                const char* actualChild = NULL;
-                while ((actualChild = actualChildren->next(NULL, err)) != NULL && *expectedChildStart != '\0') {
+                const char* expectedChildEnd = nullptr;
+                const char* actualChild = nullptr;
+                while ((actualChild = actualChildren->next(nullptr, err)) != nullptr && *expectedChildStart != '\0') {
                     expectedChildEnd = uprv_strchr(expectedChildStart, ',');
-                    if (expectedChildEnd == NULL) {
+                    if (expectedChildEnd == nullptr) {
                         expectedChildEnd = expectedChildStart + uprv_strlen(expectedChildStart);
                     }
                     if (uprv_strlen(actualChild) != size_t(expectedChildEnd - expectedChildStart) || uprv_strncmp(actualChild, expectedChildStart, expectedChildEnd - expectedChildStart) != 0) {
@@ -766,7 +766,7 @@ void RegionTest::TestGroupingChildren(void) {
                     expectedChildStart = (*expectedChildEnd != '\0') ? expectedChildEnd + 1 : expectedChildEnd;
                     ++numExpectedChildren;
                 }
-                while (expectedChildEnd != NULL && *expectedChildEnd != '\0') {
+                while (expectedChildEnd != nullptr && *expectedChildEnd != '\0') {
                     expectedChildEnd = uprv_strchr(expectedChildEnd + 1, ',');
                     ++numExpectedChildren;
                 }
index 3da6eda3960f9225102d6472d7890de855c62e5b..a255785a562b1e57dda5aff52a14fa57a268af98 100644 (file)
@@ -961,12 +961,12 @@ void RelativeDateTimeFormatterTest::TestEnglishCaps() {
     UErrorCode status = U_ZERO_ERROR;
     RelativeDateTimeFormatter fmt(
             "en",
-            NULL,
+            nullptr,
             UDAT_STYLE_LONG,
             UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE,
             status);
     if (U_FAILURE(status)) {
-        dataerrln("Failed call to RelativeDateTimeFormatter(\"en\", NULL, UDAT_STYLE_LONG, UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, status); : %s", u_errorName(status));
+        dataerrln("Failed call to RelativeDateTimeFormatter(\"en\", nullptr, UDAT_STYLE_LONG, UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE, status); : %s", u_errorName(status));
         return;
     }
     RelativeDateTimeFormatter fmt3(status);
@@ -1002,7 +1002,7 @@ void RelativeDateTimeFormatterTest::TestEnglishNoQuantityCaps() {
     UErrorCode status = U_ZERO_ERROR;
     RelativeDateTimeFormatter fmt(
             "en",
-            NULL,
+            nullptr,
             UDAT_STYLE_LONG,
             UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE,
             status);
@@ -1095,12 +1095,12 @@ void RelativeDateTimeFormatterTest::TestGetters() {
     UErrorCode status = U_ZERO_ERROR;
     RelativeDateTimeFormatter fmt(
             "en",
-            NULL,
+            nullptr,
             UDAT_STYLE_NARROW,
             UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE,
             status);
     if (U_FAILURE(status)) {
-        dataerrln("Failed call to RelativeDateTimeFormatter(\"en\", NULL, UDAT_STYLE_NARROW, UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE, status);) : %s", u_errorName(status));
+        dataerrln("Failed call to RelativeDateTimeFormatter(\"en\", nullptr, UDAT_STYLE_NARROW, UDISPCTX_CAPITALIZATION_FOR_MIDDLE_OF_SENTENCE, status);) : %s", u_errorName(status));
         return;
     }
     RelativeDateTimeFormatter fmt3(status);
@@ -1138,7 +1138,7 @@ void RelativeDateTimeFormatterTest::TestCombineDateAndTime() {
 void RelativeDateTimeFormatterTest::TestBadDisplayContext() {
     UErrorCode status = U_ZERO_ERROR;
     RelativeDateTimeFormatter fmt(
-            "en", NULL, UDAT_STYLE_LONG, UDISPCTX_STANDARD_NAMES, status);
+            "en", nullptr, UDAT_STYLE_LONG, UDISPCTX_STANDARD_NAMES, status);
     if (status != U_ILLEGAL_ARGUMENT_ERROR) {
         errln("Expected U_ILLEGAL_ARGUMENT_ERROR, got %s", u_errorName(status));
     }
@@ -1181,7 +1181,7 @@ void RelativeDateTimeFormatterTest::RunTest(
         int32_t expectedResultLength) {
     UErrorCode status = U_ZERO_ERROR;
     RelativeDateTimeFormatter fmt(
-            locale, NULL, style, UDISPCTX_CAPITALIZATION_NONE, status);
+            locale, nullptr, style, UDISPCTX_CAPITALIZATION_NONE, status);
     if (U_FAILURE(status)) {
         dataerrln("Unable to create format object - %s", u_errorName(status));
         return;
@@ -1209,7 +1209,7 @@ void RelativeDateTimeFormatterTest::RunTest(
         int32_t expectedResultLength) {
     UErrorCode status = U_ZERO_ERROR;
     RelativeDateTimeFormatter fmt(
-            locale, NULL, style, UDISPCTX_CAPITALIZATION_NONE, status);
+            locale, nullptr, style, UDISPCTX_CAPITALIZATION_NONE, status);
     if (U_FAILURE(status)) {
         dataerrln("Unable to create format object - %s", u_errorName(status));
         return;
@@ -1354,7 +1354,7 @@ void RelativeDateTimeFormatterTest::TestSidewaysDataLoading(void) {
     UnicodeString expected;
     Locale enGbLocale("en_GB");
 
-    RelativeDateTimeFormatter fmt(enGbLocale, NULL, UDAT_STYLE_NARROW,
+    RelativeDateTimeFormatter fmt(enGbLocale, nullptr, UDAT_STYLE_NARROW,
                                   UDISPCTX_CAPITALIZATION_NONE, status);
     if (U_FAILURE(status)) {
         dataerrln("Unable to create RelativeDateTimeFormatter - %s", u_errorName(status));
@@ -1380,7 +1380,7 @@ void RelativeDateTimeFormatterTest::TestSidewaysDataLoading(void) {
     assertEquals("next year: ", expected, actual);
 
     // Testing the SHORT style
-    RelativeDateTimeFormatter fmtshort(enGbLocale, NULL, UDAT_STYLE_SHORT,
+    RelativeDateTimeFormatter fmtshort(enGbLocale, nullptr, UDAT_STYLE_SHORT,
                                   UDISPCTX_CAPITALIZATION_NONE, status);
     expected = "now";
     fmtshort.format(0.0, UDAT_DIRECTION_NEXT, UDAT_RELATIVE_SECONDS, actual.remove(), status);
index 4b3ab481aac64d5deff42fef8f3bf3475a8ab39b..dac370fca31a0f3dc3fa6b6b7523881dd22b4feb 100644 (file)
@@ -244,8 +244,8 @@ void ReplaceableTest::TestReplaceableClass(void) {
     // improve API/code coverage
     NoopReplaceable noop;
     Replaceable *p;
-    if((p=noop.clone())!=NULL) {
-        errln("Replaceable::clone() does not return NULL");
+    if((p=noop.clone())!=nullptr) {
+        errln("Replaceable::clone() does not return nullptr");
         delete p;
     }
 
@@ -257,16 +257,16 @@ void ReplaceableTest::TestReplaceableClass(void) {
     // UMemory/UObject/Replaceable assignment operators
     NoopReplaceable noop2;
     noop2=noop;
-    if((p=noop2.clone())!=NULL) {
-        errln("noop2.Replaceable::clone() does not return NULL");
+    if((p=noop2.clone())!=nullptr) {
+        errln("noop2.Replaceable::clone() does not return nullptr");
         delete p;
     }
 
     // try to call the compiler-provided
     // UMemory/UObject/Replaceable copy constructors
     NoopReplaceable noop3(noop);
-    if((p=noop3.clone())!=NULL) {
-        errln("noop3.Replaceable::clone() does not return NULL");
+    if((p=noop3.clone())!=nullptr) {
+        errln("noop3.Replaceable::clone() does not return nullptr");
         delete p;
     }
 }
@@ -290,7 +290,7 @@ void ReplaceableTest::check(const UnicodeString& transliteratorName,
 
         // test clone()
         TestReplaceable *tr2 = tr->clone();
-        if(tr2 != NULL) {
+        if(tr2 != nullptr) {
             delete tr;
             tr = tr2;
         }
index 097eaaa402fc18c0cc125414bbc41c19e42555ba..c0c38ea11b016e162da9b2df3051a54cee481af5 100644 (file)
@@ -30,7 +30,7 @@
  */
 class ReplaceableTest : public IntlTest {
 public:
-    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=nullptr) override;
 
     /*Tests the Replaceable class according to the API documentation. */
     void TestReplaceableClass(void);
index f11015b71c885a99374ab767b20feb7125021189..2891e7963cfd18cd1d3a47634e72000cca8d98eb 100644 (file)
@@ -126,12 +126,12 @@ param[] =
     // "IN" means inherits
     // "NE" or "ne" means "does not exist"
 
-    { "root",       NULL,   U_ZERO_ERROR,             e_Root,      { true, false, false }, { true, false, false } },
-    { "te",         NULL,   U_ZERO_ERROR,             e_te,        { false, true, false }, { true, true, false } },
-    { "te_IN",      NULL,   U_ZERO_ERROR,             e_te_IN,     { false, false, true }, { true, true, true } },
-    { "te_NE",      NULL,   U_USING_FALLBACK_WARNING, e_te,        { false, true, false }, { true, true, false } },
-    { "te_IN_NE",   NULL,   U_USING_FALLBACK_WARNING, e_te_IN,     { false, false, true }, { true, true, true } },
-    { "ne",         NULL,   U_USING_DEFAULT_WARNING,  e_Root,      { true, false, false }, { true, false, false } }
+    { "root",       nullptr,   U_ZERO_ERROR,             e_Root,      { true, false, false }, { true, false, false } },
+    { "te",         nullptr,   U_ZERO_ERROR,             e_te,        { false, true, false }, { true, true, false } },
+    { "te_IN",      nullptr,   U_ZERO_ERROR,             e_te_IN,     { false, false, true }, { true, true, true } },
+    { "te_NE",      nullptr,   U_USING_FALLBACK_WARNING, e_te,        { false, true, false }, { true, true, false } },
+    { "te_IN_NE",   nullptr,   U_USING_FALLBACK_WARNING, e_te_IN,     { false, false, true }, { true, true, true } },
+    { "ne",         nullptr,   U_USING_DEFAULT_WARNING,  e_Root,      { true, false, false }, { true, false, false } }
 };
 
 static const int32_t bundles_count = UPRV_LENGTHOF(param);
@@ -148,7 +148,7 @@ randul()
     static UBool initialized = false;
     if (!initialized)
     {
-        srand((unsigned)time(NULL));
+        srand((unsigned)time(nullptr));
         initialized = true;
     }
     // Assume rand has at least 12 bits of precision
@@ -184,7 +184,7 @@ ResourceBundleTest::ResourceBundleTest()
 : pass(0),
   fail(0)
 {
-    if (param[5].locale == NULL) {
+    if (param[5].locale == nullptr) {
         param[0].locale = new Locale("root");
         param[1].locale = new Locale("te");
         param[2].locale = new Locale("te", "IN");
@@ -200,7 +200,7 @@ ResourceBundleTest::~ResourceBundleTest()
         int idx;
         for (idx = 0; idx < UPRV_LENGTHOF(param); idx++) {
             delete param[idx].locale;
-            param[idx].locale = NULL;
+            param[idx].locale = nullptr;
         }
     }
 }
@@ -520,7 +520,7 @@ ResourceBundleTest::TestExemplar(){
     UErrorCode status = U_ZERO_ERROR;
     for(;locIndex<locCount;locIndex++){
         const char* locale = uloc_getAvailable(locIndex);
-        UResourceBundle *resb =ures_open(NULL,locale,&status);
+        UResourceBundle *resb =ures_open(nullptr,locale,&status);
         if(U_SUCCESS(status) && status!=U_USING_FALLBACK_WARNING && status!=U_USING_DEFAULT_WARNING){
             int32_t len=0;
             const UChar* strSet = ures_getStringByKey(resb,"ExemplarCharacters",&len,&status);
index b6f5934fa9ed0bbf014b5a4b2ab7b439d34b0e33..d3c7109469d08eefa1e615643356faa6324921ec 100644 (file)
@@ -19,7 +19,7 @@ public:
     ResourceBundleTest();
     virtual ~ResourceBundleTest();
     
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     /** 
      * Perform several extensive tests using the subtest routine testTag
index b85e291786e27383c45b98e88884ff1d81c42b28..fe7f1e3719995e45a6f6148e8becbe1dec6cb153 100644 (file)
@@ -186,7 +186,7 @@ randul()
     static UBool initialized = false;
     if (!initialized)
     {
-        srand((unsigned)time(NULL));
+        srand((unsigned)time(nullptr));
         initialized = true;
     }
     // Assume rand has at least 12 bits of precision
@@ -222,7 +222,7 @@ NewResourceBundleTest::NewResourceBundleTest()
 : pass(0),
   fail(0)
 {
-    if (param[5].locale == NULL) {
+    if (param[5].locale == nullptr) {
         param[0].locale = new Locale("root");
         param[1].locale = new Locale("te");
         param[2].locale = new Locale("te", "IN");
@@ -238,7 +238,7 @@ NewResourceBundleTest::~NewResourceBundleTest()
         int idx;
         for (idx = 0; idx < UPRV_LENGTHOF(param); idx++) {
             delete param[idx].locale;
-            param[idx].locale = NULL;
+            param[idx].locale = nullptr;
         }
     }
 }
@@ -513,7 +513,7 @@ NewResourceBundleTest::TestOtherAPI(){
 
     logln("Testing ResourceBundle(UErrorCode)\n");
     ResourceBundle defaultresource(err);
-    ResourceBundle explicitdefaultresource(NULL, Locale::getDefault(), err);
+    ResourceBundle explicitdefaultresource(nullptr, Locale::getDefault(), err);
     if(U_FAILURE(err)){
         errcheckln(err, "Construction of default resourcebundle failed - %s", u_errorName(err));
         return;
@@ -567,7 +567,7 @@ NewResourceBundleTest::TestOtherAPI(){
 
     logln("Testing C like UnicodeString APIs\n");
 
-    UResourceBundle *testCAPI = NULL, *bundle = NULL, *rowbundle = NULL, *temp = NULL;
+    UResourceBundle *testCAPI = nullptr, *bundle = nullptr, *rowbundle = nullptr, *temp = nullptr;
     err = U_ZERO_ERROR;
     const char* data[]={
         "string_in_Root_te_te_IN",   "1",
@@ -598,7 +598,7 @@ NewResourceBundleTest::TestOtherAPI(){
             err=U_ZERO_ERROR;
             bundle = ures_getByKey(testCAPI, data[i], bundle, &err); 
             if(!U_FAILURE(err)){
-                const char* key = NULL;
+                const char* key = nullptr;
                 action = "te_IN";
                 action +=".getKey()";
 
@@ -654,7 +654,7 @@ NewResourceBundleTest::TestOtherAPI(){
         assertTrue("ures_getUnicodeString(failure).isBogus()",
                    ures_getUnicodeString(testCAPI, &failure).isBogus());
         assertTrue("ures_getNextUnicodeString(failure).isBogus()",
-                   ures_getNextUnicodeString(testCAPI, NULL, &failure).isBogus());
+                   ures_getNextUnicodeString(testCAPI, nullptr, &failure).isBogus());
         assertTrue("ures_getUnicodeStringByIndex(failure).isBogus()",
                    ures_getUnicodeStringByIndex(testCAPI, 999, &failure).isBogus());
         assertTrue("ures_getUnicodeStringByKey(failure).isBogus()",
@@ -986,7 +986,7 @@ NewResourceBundleTest::testTag(const char* frag,
 
             for(index=0; index <tag_count; index++){
                 ResourceBundle tagelement=tags.get(index, status);
-                const char *tkey=NULL;
+                const char *tkey=nullptr;
                 UnicodeString value=tagelement.getNextString(&tkey, status);
                 UnicodeString key(tkey);
                 logln("tag = " + key + ", value = " + value );
@@ -1072,7 +1072,7 @@ NewResourceBundleTest::TestNewTypes() {
     char action[256];
     const char* testdatapath;
     UErrorCode status = U_ZERO_ERROR;
-    uint8_t *binResult = NULL;
+    uint8_t *binResult = nullptr;
     int32_t len = 0;
     int32_t i = 0;
     int32_t intResult = 0;
@@ -1222,7 +1222,7 @@ void
 NewResourceBundleTest::TestGetByFallback() {
     UErrorCode status = U_ZERO_ERROR;
 
-    ResourceBundle heRes(NULL, "he", status);
+    ResourceBundle heRes(nullptr, "he", status);
 
     heRes.getWithFallback("calendar", status).getWithFallback("islamic-civil", status).getWithFallback("DateTime", status);
     if(U_SUCCESS(status)) {
@@ -1236,7 +1236,7 @@ NewResourceBundleTest::TestGetByFallback() {
     }
     status = U_ZERO_ERROR;
 
-    ResourceBundle rootRes(NULL, "root", status);
+    ResourceBundle rootRes(nullptr, "root", status);
     rootRes.getWithFallback("calendar", status).getWithFallback("islamic-civil", status).getWithFallback("DateTime", status);
     if(U_SUCCESS(status)) {
         errln("Root's Islamic-civil's DateTime resource exists. How did it get here?\n");
@@ -1430,7 +1430,7 @@ void NewResourceBundleTest::TestIntervalAliasFallbacks() {
 
     for (int lidx = 0; lidx < UPRV_LENGTHOF(locales); lidx++) {
         UErrorCode status = U_ZERO_ERROR;
-        UResourceBundle *rb = ures_open(NULL, locales[lidx], &status);
+        UResourceBundle *rb = ures_open(nullptr, locales[lidx], &status);
         if (U_FAILURE(status)) {
             errln("Cannot open bundle for locale %s", locales[lidx]);
             break;
index e4eed1971b8edb55f8d976c7ee608b2233f17a62..a43300a33423db180945ddc79c94c75cd63fdf75 100644 (file)
@@ -19,7 +19,7 @@ public:
     NewResourceBundleTest();
     virtual ~NewResourceBundleTest();
     
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     /** 
      * Perform several extensive tests using the subtest routine testTag
index d7d61e2d87b91d95be454cd950837d0a7a21cc49..eda12f6b9dc42a1f3c3913c53c2f4c503efd56c3 100644 (file)
@@ -273,9 +273,9 @@ void IntlTestSimpleDateFormatAPI::testAPI(/*char *par*/)
     }
 
 // ====== Test ticket 11295 getNumberFormatForField returns wild pointer
-    if (object.getNumberFormatForField('N') != NULL) {
+    if (object.getNumberFormatForField('N') != nullptr) {
         errln("N is not a valid field, "
-              "getNumberFormatForField should return NULL");
+              "getNumberFormatForField should return nullptr");
     }
 }
 
index 6a6533bae8f4002364aa9287c3ad3c9545dc37ce..65cdacebb364a8e25c695bee232b79fc52555d9b 100644 (file)
@@ -19,7 +19,7 @@
  * Test basic functionality of various API functions
  **/
 class IntlTestSimpleDateFormatAPI : public IntlTest {
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
 private:
     /**
index c14ca83acd404c7a949e89e6a12ca1fed98a6eb3..c0a1283d911a50466ce20425fde1188b4cd36286 100644 (file)
@@ -130,7 +130,7 @@ void SelectFormatTest::selectFormatUnitTest(/*char *par*/)
     assertEquals("should use first occurrence of the 'other' keyword", "bar", format_result);
 
     delete selFmt;
-    selFmt = NULL;
+    selFmt = nullptr;
 
     logln("SelectFormat Unit Test : Creating format object for Testing applying various patterns");
     status = U_ZERO_ERROR;
@@ -185,7 +185,7 @@ void SelectFormatTest::selectFormatUnitTest(/*char *par*/)
     };
 
     delete selFmt;
-    selFmt = NULL;
+    selFmt = nullptr;
 
     selFmt = new SelectFormat( SIMPLE_PATTERN , status); 
     for (int32_t i = 0; i < UPRV_LENGTHOF(keywords); i++ ){
@@ -209,7 +209,7 @@ void SelectFormatTest::selectFormatAPITest(/*char *par*/)
   const UnicodeString SIMPLE_PATTERN(SIMPLE_PATTERN_STRING); /* Don't static init this! */
     int numOfConstructors =3;
     UErrorCode status[3];
-    SelectFormat* selFmt[3] = { NULL, NULL, NULL };
+    SelectFormat* selFmt[3] = { nullptr, nullptr, nullptr };
 
     // ========= Test constructors
     logln("SelectFormat API test: Testing SelectFormat constructors ...");
@@ -236,12 +236,12 @@ void SelectFormatTest::selectFormatAPITest(/*char *par*/)
     logln("SelectFormat API test: Testing clone and == operator ...");
     if ( U_SUCCESS(status[0])  ) {
         selFmt[1] = selFmt[0]->clone();
-        if (selFmt[1]!=NULL) {
+        if (selFmt[1]!=nullptr) {
             if ( *selFmt[1] != *selFmt[0] ) {
                 errln("ERROR: SelectFormat API test clone test failed!");
             }
         } else {
-          errln("ERROR: SelectFormat API test clone test failed with NULL!");
+          errln("ERROR: SelectFormat API test clone test failed with nullptr!");
           return;
         }
     } else {
@@ -254,7 +254,7 @@ void SelectFormatTest::selectFormatAPITest(/*char *par*/)
     selFmt[2]= new SelectFormat(SIMPLE_PATTERN, status[2]);
     if ( U_SUCCESS(status[2]) ) {
         *selFmt[1] = *selFmt[2];
-        if (selFmt[1]!=NULL) {
+        if (selFmt[1]!=nullptr) {
             if ( (*selFmt[1] != *selFmt[2]) ) {
                 errln("ERROR: SelectFormat API test assignment operator test failed!");
             }
index 9ad94c6d99aab3e438fbea1bd0c4c6d4f27d897e..a4086aff96c996150c1329f175ffae49bf4a7cee 100644 (file)
@@ -22,7 +22,7 @@
  * Test basic functionality of various API functions
  **/
 class SelectFormatTest : public IntlTest {
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
 private:
     /**
index 22975b4826cbcbc35719d9e116538672f96deb2d..b215302673526e98c34b510e3293369e4765c253 100644 (file)
@@ -29,7 +29,7 @@ SimpleFwdCharIterator::SimpleFwdCharIterator(const UnicodeString& s) {
     fHashCode = kInvalidHashCode;
     fLen = s.length();
     fStart = new UChar[fLen];
-    if(fStart == NULL) {
+    if(fStart == nullptr) {
         fBogus = true;
     } else {
         fEnd = fStart+fLen;
@@ -49,7 +49,7 @@ SimpleFwdCharIterator::SimpleFwdCharIterator(UChar *s, int32_t len, UBool adopt)
 
     if(adopt == false) {
         fStart = new UChar[fLen];
-        if(fStart == NULL) {
+        if(fStart == nullptr) {
             fBogus = true;
         } else {
             uprv_memcpy(fStart, s, fLen);
@@ -102,7 +102,7 @@ int32_t SimpleFwdCharIterator::hashCode(void) const {
 }
         
 UClassID SimpleFwdCharIterator::getDynamicClassID(void) const {
-    return NULL;
+    return nullptr;
 }
 
 UChar SimpleFwdCharIterator::nextPostInc(void) {
index 32f453cba8196aa87b821c1bc95c65c7a7d99fbe..6e14887e946c58f9db4bf951c4ebbc80f6353ff2 100644 (file)
@@ -78,12 +78,12 @@ void SimpleFormatterTest::TestNoArguments() {
     assertEquals(
             "formatAndAppend",
             "This doesn't have templates {0}", 
-            fmt.formatAndAppend(NULL, 0, appendTo, offsets, 1, status));
+            fmt.formatAndAppend(nullptr, 0, appendTo, offsets, 1, status));
     assertEquals("formatAndAppend offsets[0]", -1, offsets[0]);
     assertEquals(
             "formatAndReplace",
             "This doesn't have templates {0}", 
-            fmt.formatAndReplace(NULL, 0, appendTo, NULL, 0, status));
+            fmt.formatAndReplace(nullptr, 0, appendTo, nullptr, 0, status));
     assertSuccess("Status", status);
 }
 
@@ -138,12 +138,12 @@ void SimpleFormatterTest::TestBigArgument() {
     assertEquals("{20} count", 21, fmt.getArgumentLimit());
     UnicodeString b("b");
     UnicodeString *values[] = {
-        NULL, NULL, NULL, NULL, NULL, NULL, NULL, 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, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
         &b
     };
     UnicodeString result;
-    assertEquals("{20}=b", "abc", fmt.formatAndAppend(values, 21, result, NULL, 0, status));
+    assertEquals("{20}=b", "abc", fmt.formatAndAppend(values, 21, result, nullptr, 0, status));
     assertSuccess("Status", status);
 }
 
@@ -203,7 +203,7 @@ void SimpleFormatterTest::TestManyArguments() {
                     params,
                     UPRV_LENGTHOF(params),
                     appendTo,
-                    NULL,
+                    nullptr,
                     0,
                     status));
 
@@ -217,7 +217,7 @@ void SimpleFormatterTest::TestManyArguments() {
                     params,
                     UPRV_LENGTHOF(params),
                     appendTo,
-                    NULL,
+                    nullptr,
                     0,
                     status));
     r.applyPattern("{0} meter", status);
@@ -259,14 +259,14 @@ void SimpleFormatterTest::TestTooFewArgumentValues() {
 
     status = U_ZERO_ERROR;
     fmt.formatAndAppend(
-            params, UPRV_LENGTHOF(params), appendTo, NULL, 0, status);
+            params, UPRV_LENGTHOF(params), appendTo, nullptr, 0, status);
     if (status != U_ILLEGAL_ARGUMENT_ERROR) {
         errln("Expected U_ILLEGAL_ARGUMENT_ERROR");
     }
 
     status = U_ZERO_ERROR;
     fmt.formatAndReplace(
-            params, UPRV_LENGTHOF(params), appendTo, NULL, 0, status);
+            params, UPRV_LENGTHOF(params), appendTo, nullptr, 0, status);
     if (status != U_ILLEGAL_ARGUMENT_ERROR) {
         errln("Expected U_ILLEGAL_ARGUMENT_ERROR");
     }
@@ -279,25 +279,25 @@ void SimpleFormatterTest::TestBadArguments() {
 
     // These succeed
     fmt.formatAndAppend(
-            NULL, 0, appendTo, NULL, 0, status);
+            nullptr, 0, appendTo, nullptr, 0, status);
     fmt.formatAndReplace(
-            NULL, 0, appendTo, NULL, 0, status);
+            nullptr, 0, appendTo, nullptr, 0, status);
     assertSuccess("", status);
     status = U_ZERO_ERROR;
 
     // fails
     fmt.formatAndAppend(
-            NULL, 1, appendTo, NULL, 0, status);
+            nullptr, 1, appendTo, nullptr, 0, status);
     if (status != U_ILLEGAL_ARGUMENT_ERROR) {
-        errln("Expected U_ILLEGAL_ARGUMENT_ERROR: formatAndAppend() values=NULL but length=1");
+        errln("Expected U_ILLEGAL_ARGUMENT_ERROR: formatAndAppend() values=nullptr but length=1");
     }
     status = U_ZERO_ERROR;
    
     // fails
     fmt.formatAndAppend(
-            NULL, 0, appendTo, NULL, 1, status);
+            nullptr, 0, appendTo, nullptr, 1, status);
     if (status != U_ILLEGAL_ARGUMENT_ERROR) {
-        errln("Expected U_ILLEGAL_ARGUMENT_ERROR: formatAndAppend() offsets=NULL but length=1");
+        errln("Expected U_ILLEGAL_ARGUMENT_ERROR: formatAndAppend() offsets=nullptr but length=1");
     }
     status = U_ZERO_ERROR;
 
@@ -305,7 +305,7 @@ void SimpleFormatterTest::TestBadArguments() {
     SimpleFormatter fmt2("Arguments {0} and {1}", status);
     UnicodeString frog("frog");
     const UnicodeString *params[] = { &appendTo, &frog };
-    fmt2.formatAndAppend(params, 2, appendTo, NULL, 0, status);
+    fmt2.formatAndAppend(params, 2, appendTo, nullptr, 0, status);
     if (status != U_ILLEGAL_ARGUMENT_ERROR) {
         errln("Expected U_ILLEGAL_ARGUMENT_ERROR: formatAndAppend() value=appendTo");
     }
@@ -314,17 +314,17 @@ void SimpleFormatterTest::TestBadArguments() {
    
     // fails
     fmt.formatAndReplace(
-            NULL, 1, appendTo, NULL, 0, status);
+            nullptr, 1, appendTo, nullptr, 0, status);
     if (status != U_ILLEGAL_ARGUMENT_ERROR) {
-        errln("Expected U_ILLEGAL_ARGUMENT_ERROR: formatAndReplace() values=NULL but length=1");
+        errln("Expected U_ILLEGAL_ARGUMENT_ERROR: formatAndReplace() values=nullptr but length=1");
     }
     status = U_ZERO_ERROR;
    
     // fails
     fmt.formatAndReplace(
-            NULL, 0, appendTo, NULL, 1, status);
+            nullptr, 0, appendTo, nullptr, 1, status);
     if (status != U_ILLEGAL_ARGUMENT_ERROR) {
-        errln("Expected U_ILLEGAL_ARGUMENT_ERROR: formatAndReplace() offsets=NULL but length=1");
+        errln("Expected U_ILLEGAL_ARGUMENT_ERROR: formatAndReplace() offsets=nullptr but length=1");
     }
 }
 
@@ -485,7 +485,7 @@ void SimpleFormatterTest::TestFormatReplaceOptimizationNoOffsets() {
                     params,
                     UPRV_LENGTHOF(params),
                     result,
-                    NULL,
+                    nullptr,
                     0,
                     status));
     assertSuccess("Status", status);
@@ -504,7 +504,7 @@ void SimpleFormatterTest::TestFormatReplaceNoOptimizationNoOffsets() {
                     params,
                     UPRV_LENGTHOF(params),
                     result,
-                    NULL,
+                    nullptr,
                     0,
                     status));
     assertSuccess("Status", status);
index 8f7c48aca3574ed67e932a903f00fc91a5539916..ff04276a3103431510090f5da1fc1a72dfea50ef 100644 (file)
@@ -44,16 +44,16 @@ class ThreadPoolThread: public SimpleThread {
 
 
 ThreadPoolBase::ThreadPoolBase(IntlTest *test, int32_t howMany) :
-        fIntlTest(test), fNumThreads(howMany), fThreads(NULL) {
+        fIntlTest(test), fNumThreads(howMany), fThreads(nullptr) {
     fThreads = new SimpleThread *[fNumThreads];
-    if (fThreads == NULL) {
+    if (fThreads == nullptr) {
         fIntlTest->errln("%s:%d memory allocation failure.", __FILE__, __LINE__);
         return;
     }
 
     for (int i=0; i<fNumThreads; i++) {
         fThreads[i] = new ThreadPoolThread(this, i);
-        if (fThreads[i] == NULL) {
+        if (fThreads[i] == nullptr) {
             fIntlTest->errln("%s:%d memory allocation failure.", __FILE__, __LINE__);
         }
     }
@@ -79,9 +79,9 @@ ThreadPoolBase::~ThreadPoolBase() {
     if (fThreads) {
         for (int i=0; i<fNumThreads; i++) {
             delete fThreads[i];
-            fThreads[i] = NULL;
+            fThreads[i] = nullptr;
         }
         delete[] fThreads;
-        fThreads = NULL;
+        fThreads = nullptr;
     }
 }
index c0551109b3114266a0ca4895f905d4b3ea5c1647..b1cc884cb1cf482435d11028e7307f145758edc6 100644 (file)
@@ -42,7 +42,7 @@
 StringSearchTest::StringSearchTest() 
 #if !UCONFIG_NO_BREAK_ITERATION
 :
-    m_en_wordbreaker_(NULL), m_en_characterbreaker_(NULL)
+    m_en_wordbreaker_(nullptr), m_en_characterbreaker_(nullptr)
 #endif
 {
 #if !UCONFIG_NO_BREAK_ITERATION
@@ -112,9 +112,9 @@ void StringSearchTest::runIndexedTest(int32_t index, UBool exec,
 {
 #if !UCONFIG_NO_BREAK_ITERATION
     UBool areBroken = false;
-    if (m_en_us_ == NULL && m_fr_fr_ == NULL && m_de_ == NULL &&
-        m_es_ == NULL && m_en_wordbreaker_ == NULL &&
-        m_en_characterbreaker_ == NULL && exec) {
+    if (m_en_us_ == nullptr && m_fr_fr_ == nullptr && m_de_ == nullptr &&
+        m_es_ == nullptr && m_en_wordbreaker_ == nullptr &&
+        m_en_characterbreaker_ == nullptr && exec) {
         areBroken = true;
     }
 
@@ -182,7 +182,7 @@ void StringSearchTest::runIndexedTest(int32_t index, UBool exec,
 
 RuleBasedCollator * StringSearchTest::getCollator(const char *collator)
 {
-    if (collator == NULL) {
+    if (collator == nullptr) {
         return m_en_us_;
     }
     if (strcmp(collator, "fr") == 0) {
@@ -202,10 +202,10 @@ RuleBasedCollator * StringSearchTest::getCollator(const char *collator)
 BreakIterator * StringSearchTest::getBreakIterator(const char *breaker)
 {
 #if UCONFIG_NO_BREAK_ITERATION
-    return NULL;
+    return nullptr;
 #else
-    if (breaker == NULL) {
-        return NULL;
+    if (breaker == nullptr) {
+        return nullptr;
     }
     if (strcmp(breaker, "wordbreaker") == 0) {
         return m_en_wordbreaker_;
@@ -482,7 +482,7 @@ UBool StringSearchTest::assertEqual(const SearchData *search)
     pattern.setTo(temp);
 
 #if !UCONFIG_NO_BREAK_ITERATION
-    if (breaker != NULL) {
+    if (breaker != nullptr) {
         breaker->setText(text);
     }
 #endif
@@ -541,7 +541,7 @@ UBool StringSearchTest::assertCanonicalEqual(const SearchData *search)
     pattern.setTo(temp);
 
 #if !UCONFIG_NO_BREAK_ITERATION
-    if (breaker != NULL) {
+    if (breaker != nullptr) {
         breaker->setText(text);
     }
 #endif
@@ -594,7 +594,7 @@ UBool StringSearchTest::assertEqualWithAttribute(const SearchData *search,
     pattern.setTo(temp);
 
 #if !UCONFIG_NO_BREAK_ITERATION
-    if (breaker != NULL) {
+    if (breaker != nullptr) {
         breaker->setText(text);
     }
 #endif
@@ -630,23 +630,23 @@ void StringSearchTest::TestOpenClose()
     StringCharacterIterator  chariter(text);
 
     /* testing null arguments */
-    result = new StringSearch(pattern, text, NULL, NULL, status);
+    result = new StringSearch(pattern, text, nullptr, nullptr, status);
     if (U_SUCCESS(status)) {
-        errln("Error: NULL arguments should produce an error");
+        errln("Error: nullptr arguments should produce an error");
     }
     delete result;
 
     chariter.setText(text);
     status = U_ZERO_ERROR;
-    result = new StringSearch(pattern, chariter, NULL, NULL, status);
+    result = new StringSearch(pattern, chariter, nullptr, nullptr, status);
     if (U_SUCCESS(status)) {
-        errln("Error: NULL arguments should produce an error");
+        errln("Error: nullptr arguments should produce an error");
     }
     delete result;
 
     // No-op: text.append(0, 0x1); -- what was intended here?
     status = U_ZERO_ERROR;
-    result = new StringSearch(pattern, text, NULL, NULL, status);
+    result = new StringSearch(pattern, text, nullptr, nullptr, status);
     if (U_SUCCESS(status)) {
         errln("Error: Empty pattern should produce an error");
     }
@@ -654,7 +654,7 @@ void StringSearchTest::TestOpenClose()
 
     chariter.setText(text);
     status = U_ZERO_ERROR;
-    result = new StringSearch(pattern, chariter, NULL, NULL, status);
+    result = new StringSearch(pattern, chariter, nullptr, nullptr, status);
     if (U_SUCCESS(status)) {
         errln("Error: Empty pattern should produce an error");
     }
@@ -663,7 +663,7 @@ void StringSearchTest::TestOpenClose()
     text.remove();
     pattern.append(temp);
     status = U_ZERO_ERROR;
-    result = new StringSearch(pattern, text, NULL, NULL, status);
+    result = new StringSearch(pattern, text, nullptr, nullptr, status);
     if (U_SUCCESS(status)) {
         errln("Error: Empty text should produce an error");
     }
@@ -671,7 +671,7 @@ void StringSearchTest::TestOpenClose()
 
     chariter.setText(text);
     status = U_ZERO_ERROR;
-    result = new StringSearch(pattern, chariter, NULL, NULL, status);
+    result = new StringSearch(pattern, chariter, nullptr, nullptr, status);
     if (U_SUCCESS(status)) {
         errln("Error: Empty text should produce an error");
     }
@@ -679,45 +679,45 @@ void StringSearchTest::TestOpenClose()
 
     text.append(temp);
     status = U_ZERO_ERROR;
-    result = new StringSearch(pattern, text, NULL, NULL, status);
+    result = new StringSearch(pattern, text, nullptr, nullptr, status);
     if (U_SUCCESS(status)) {
-        errln("Error: NULL arguments should produce an error");
+        errln("Error: nullptr arguments should produce an error");
     }
     delete result;
 
     chariter.setText(text);
     status = U_ZERO_ERROR;
-    result = new StringSearch(pattern, chariter, NULL, NULL, status);
+    result = new StringSearch(pattern, chariter, nullptr, nullptr, status);
     if (U_SUCCESS(status)) {
-        errln("Error: NULL arguments should produce an error");
+        errln("Error: nullptr arguments should produce an error");
     }
     delete result;
 
     status = U_ZERO_ERROR;
-    result = new StringSearch(pattern, text, m_en_us_, NULL, status);
+    result = new StringSearch(pattern, text, m_en_us_, nullptr, status);
     if (U_FAILURE(status)) {
-        errln("Error: NULL break iterator is valid for opening search");
+        errln("Error: nullptr break iterator is valid for opening search");
     }
     delete result;
 
     status = U_ZERO_ERROR;
-    result = new StringSearch(pattern, chariter, m_en_us_, NULL, status);
+    result = new StringSearch(pattern, chariter, m_en_us_, nullptr, status);
     if (U_FAILURE(status)) {
-        errln("Error: NULL break iterator is valid for opening search");
+        errln("Error: nullptr break iterator is valid for opening search");
     }
     delete result;
 
     status = U_ZERO_ERROR;
-    result = new StringSearch(pattern, text, Locale::getEnglish(), NULL, status);
-    if (U_FAILURE(status) || result == NULL) {
-        errln("Error: NULL break iterator is valid for opening search");
+    result = new StringSearch(pattern, text, Locale::getEnglish(), nullptr, status);
+    if (U_FAILURE(status) || result == nullptr) {
+        errln("Error: nullptr break iterator is valid for opening search");
     }
     delete result;
 
     status = U_ZERO_ERROR;
-    result = new StringSearch(pattern, chariter, Locale::getEnglish(), NULL, status);
+    result = new StringSearch(pattern, chariter, Locale::getEnglish(), nullptr, status);
     if (U_FAILURE(status)) {
-        errln("Error: NULL break iterator is valid for opening search");
+        errln("Error: nullptr break iterator is valid for opening search");
     }
     delete result;
 
@@ -729,7 +729,7 @@ void StringSearchTest::TestOpenClose()
     delete result;
 
     status = U_ZERO_ERROR;
-    result = new StringSearch(pattern, chariter, m_en_us_, NULL, status);
+    result = new StringSearch(pattern, chariter, m_en_us_, nullptr, status);
     if (U_FAILURE(status)) {
         errln("Error: Break iterator is valid for opening search");
     }
@@ -751,7 +751,7 @@ void StringSearchTest::TestInitialization()
     text.append(temp);
     text.append(temp);
     text.append(temp);
-    result = new StringSearch(pattern, text, m_en_us_, NULL, status);
+    result = new StringSearch(pattern, text, m_en_us_, nullptr, status);
     if (U_FAILURE(status)) {
         errln("Error opening search %s", u_errorName(status));
     }
@@ -786,7 +786,7 @@ void StringSearchTest::TestInitialization()
     for (count = 0; count < 512; count ++) {
         pattern.append(temp);
     }
-    result = new StringSearch(pattern, text, m_en_us_, NULL, status);
+    result = new StringSearch(pattern, text, m_en_us_, nullptr, status);
     if (*result != *result) {
         errln("Error: string search object expected to match itself");
     }
@@ -814,7 +814,7 @@ void StringSearchTest::TestInitialization()
 void StringSearchTest::TestBasic()
 {
     int count = 0;
-    while (BASIC[count].text != NULL) {
+    while (BASIC[count].text != nullptr) {
         //printf("count %d", count);
         if (!assertEqual(&BASIC[count])) {
             infoln("Error at test number %d", count);
@@ -832,14 +832,14 @@ void StringSearchTest::TestNormExact()
         errln("Error setting collation normalization %s", 
               u_errorName(status));
     }
-    while (BASIC[count].text != NULL) {
+    while (BASIC[count].text != nullptr) {
         if (!assertEqual(&BASIC[count])) {
             infoln("Error at test number %d", count);
         }
         count ++;
     }
     count = 0;
-    while (NORMEXACT[count].text != NULL) {
+    while (NORMEXACT[count].text != nullptr) {
         if (!assertEqual(&NORMEXACT[count])) {
             infoln("Error at test number %d", count);
         }
@@ -847,7 +847,7 @@ void StringSearchTest::TestNormExact()
     }
     m_en_us_->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_OFF, status);
     count = 0;
-    while (NONNORMEXACT[count].text != NULL) {
+    while (NONNORMEXACT[count].text != nullptr) {
         if (!assertEqual(&NONNORMEXACT[count])) {
             infoln("Error at test number %d", count);
         }
@@ -858,7 +858,7 @@ void StringSearchTest::TestNormExact()
 void StringSearchTest::TestStrength()
 {
     int count = 0;
-    while (STRENGTH[count].text != NULL) {
+    while (STRENGTH[count].text != nullptr) {
         if (!assertEqual(&STRENGTH[count])) {
             infoln("Error at test number %d", count);
         }
@@ -879,14 +879,14 @@ void StringSearchTest::TestBreakIterator()
     pattern.setTo(temp, u_strlen(temp));
 
     UErrorCode status = U_ZERO_ERROR;
-    StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, NULL
+    StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, nullptr
                                              status);
     if (U_FAILURE(status)) {
         errln("Error opening string search %s", u_errorName(status));
     }
     
-    strsrch->setBreakIterator(NULL, status);
-    if (U_FAILURE(status) || strsrch->getBreakIterator() != NULL) {
+    strsrch->setBreakIterator(nullptr, status);
+    if (U_FAILURE(status) || strsrch->getBreakIterator() != nullptr) {
         errln("Error usearch_getBreakIterator returned wrong object");
     }
 
@@ -916,7 +916,7 @@ void StringSearchTest::TestBreakIterator()
         text.setTo(temp, u_strlen(temp));
         u_unescape(search->pattern, temp, 128);
         pattern.setTo(temp, u_strlen(temp));
-        if (breaker != NULL) {
+        if (breaker != nullptr) {
             breaker->setText(text);
         }
         collator->setStrength(getECollationStrength(search->strength));
@@ -925,7 +925,7 @@ void StringSearchTest::TestBreakIterator()
         if (U_FAILURE(status) || 
             strsrch->getBreakIterator() != breaker) {
             errln("Error setting break iterator");
-            if (strsrch != NULL) {
+            if (strsrch != nullptr) {
                 delete strsrch;
             }
         }
@@ -935,7 +935,7 @@ void StringSearchTest::TestBreakIterator()
         }
         search   = &(BREAKITERATOREXACT[count + 1]);
         breaker  = getBreakIterator(search->breaker);
-        if (breaker != NULL) {
+        if (breaker != nullptr) {
             breaker->setText(text);
         }
         strsrch->setBreakIterator(breaker, status);
@@ -952,7 +952,7 @@ void StringSearchTest::TestBreakIterator()
         count += 2;
     }
     count = 0;
-    while (BREAKITERATOREXACT[count].text != NULL) {
+    while (BREAKITERATOREXACT[count].text != nullptr) {
          if (!assertEqual(&BREAKITERATOREXACT[count])) {
              infoln("Error at test number %d", count);
          }
@@ -971,7 +971,7 @@ void StringSearchTest::TestVariable()
         errln("Error setting collation alternate attribute %s", 
               u_errorName(status));
     }
-    while (VARIABLE[count].text != NULL) {
+    while (VARIABLE[count].text != nullptr) {
         logln("variable %d", count);
         if (!assertEqual(&VARIABLE[count])) {
             infoln("Error at test number %d", count);
@@ -985,7 +985,7 @@ void StringSearchTest::TestVariable()
 void StringSearchTest::TestOverlap()
 {
     int count = 0;
-    while (OVERLAP[count].text != NULL) {
+    while (OVERLAP[count].text != nullptr) {
         if (!assertEqualWithAttribute(&OVERLAP[count], USEARCH_OFF, 
                                       USEARCH_ON)) {
             errln("Error at overlap test number %d", count);
@@ -993,7 +993,7 @@ void StringSearchTest::TestOverlap()
         count ++;
     }    
     count = 0;
-    while (NONOVERLAP[count].text != NULL) {
+    while (NONOVERLAP[count].text != nullptr) {
         if (!assertEqual(&NONOVERLAP[count])) {
             errln("Error at non overlap test number %d", count);
         }
@@ -1014,7 +1014,7 @@ void StringSearchTest::TestOverlap()
         RuleBasedCollator *collator = getCollator(search->collator);
         UErrorCode         status   = U_ZERO_ERROR;
         StringSearch      *strsrch  = new StringSearch(pattern, text, 
-                                                       collator, NULL
+                                                       collator, nullptr
                                                        status);
 
         strsrch->setAttribute(USEARCH_OVERLAP, USEARCH_ON, status);
@@ -1056,7 +1056,7 @@ void StringSearchTest::TestCollator()
     pattern.setTo(temp, u_strlen(temp));
 
     UErrorCode    status = U_ZERO_ERROR;
-    StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, NULL
+    StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, nullptr
                                              status);    
     if (U_FAILURE(status)) {
         errln("Error opening string search %s", u_errorName(status));
@@ -1122,13 +1122,13 @@ void StringSearchTest::TestPattern()
 
     m_en_us_->setStrength(getECollationStrength(PATTERN[0].strength));
     UErrorCode    status = U_ZERO_ERROR;
-    StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, NULL
+    StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, nullptr
                                              status);
 
     if (U_FAILURE(status)) {
         errln("Error opening string search %s", u_errorName(status));
         m_en_us_->setStrength(getECollationStrength(UCOL_TERTIARY));
-        if (strsrch != NULL) {
+        if (strsrch != nullptr) {
             delete strsrch;
         }
         return;
@@ -1138,7 +1138,7 @@ void StringSearchTest::TestPattern()
     }
     if (!assertEqualWithStringSearch(strsrch, &PATTERN[0])) {
         m_en_us_->setStrength(getECollationStrength(UCOL_TERTIARY));
-        if (strsrch != NULL) {
+        if (strsrch != nullptr) {
             delete strsrch;
         }
         return;
@@ -1150,7 +1150,7 @@ void StringSearchTest::TestPattern()
     if (pattern != strsrch->getPattern()) {
         errln("Error setting pattern");
         m_en_us_->setStrength(getECollationStrength(UCOL_TERTIARY));
-        if (strsrch != NULL) {
+        if (strsrch != nullptr) {
             delete strsrch;
         }
         return;
@@ -1161,7 +1161,7 @@ void StringSearchTest::TestPattern()
     }
     if (!assertEqualWithStringSearch(strsrch, &PATTERN[1])) {
         m_en_us_->setStrength(getECollationStrength(UCOL_TERTIARY));
-        if (strsrch != NULL) {
+        if (strsrch != nullptr) {
             delete strsrch;
         }
         return;
@@ -1173,7 +1173,7 @@ void StringSearchTest::TestPattern()
     if (pattern != strsrch->getPattern()) {
         errln("Error setting pattern");
         m_en_us_->setStrength(getECollationStrength(UCOL_TERTIARY));
-        if (strsrch != NULL) {
+        if (strsrch != nullptr) {
             delete strsrch;
         }
         return;
@@ -1184,7 +1184,7 @@ void StringSearchTest::TestPattern()
     }
     if (!assertEqualWithStringSearch(strsrch, &PATTERN[0])) {
         m_en_us_->setStrength(getECollationStrength(UCOL_TERTIARY));
-        if (strsrch != NULL) {
+        if (strsrch != nullptr) {
             delete strsrch;
         }
         return;
@@ -1200,7 +1200,7 @@ void StringSearchTest::TestPattern()
         errln("Error setting pattern with size 512, %s", u_errorName(status));
     }
     m_en_us_->setStrength(getECollationStrength(UCOL_TERTIARY));
-    if (strsrch != NULL) {
+    if (strsrch != nullptr) {
         delete strsrch;
     }
 }
@@ -1216,7 +1216,7 @@ void StringSearchTest::TestText()
     pattern.setTo(temp, u_strlen(temp));
 
     UErrorCode status = U_ZERO_ERROR;
-    StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, NULL
+    StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, nullptr
                                              status);
     if (U_FAILURE(status)) {
         errln("Error opening string search %s", u_errorName(status));
@@ -1267,7 +1267,7 @@ void StringSearchTest::TestText()
 void StringSearchTest::TestCompositeBoundaries()
 {
     int count = 0;
-    while (COMPOSITEBOUNDARIES[count].text != NULL) { 
+    while (COMPOSITEBOUNDARIES[count].text != nullptr) { 
         logln("composite %d", count);
         if (!assertEqual(&COMPOSITEBOUNDARIES[count])) {
             errln("Error at test number %d", count);
@@ -1282,7 +1282,7 @@ void StringSearchTest::TestGetSetOffset()
     UnicodeString  pattern("1234567890123456");
     UnicodeString  text("12345678901234567890123456789012");
     StringSearch  *strsrch = new StringSearch(pattern, text, m_en_us_, 
-                                              NULL, status);
+                                              nullptr, status);
     /* testing out of bounds error */
     strsrch->setOffset(-1, status);
     if (U_SUCCESS(status)) {
@@ -1293,7 +1293,7 @@ void StringSearchTest::TestGetSetOffset()
         errln("Error expecting set offset error");
     }
     int index   = 0;
-    while (BASIC[index].text != NULL) {
+    while (BASIC[index].text != nullptr) {
         UErrorCode  status      = U_ZERO_ERROR;
         SearchData  search      = BASIC[index ++];
         UChar       temp[128];
@@ -1358,7 +1358,7 @@ void StringSearchTest::TestGetSetAttribute()
     UErrorCode     status    = U_ZERO_ERROR;
     UnicodeString  pattern("pattern");
     UnicodeString  text("text");
-    StringSearch  *strsrch = new StringSearch(pattern, text, m_en_us_, NULL
+    StringSearch  *strsrch = new StringSearch(pattern, text, m_en_us_, nullptr
                                               status);
     if (U_FAILURE(status)) {
         errln("Error opening search %s", u_errorName(status));
@@ -1427,11 +1427,11 @@ void StringSearchTest::TestGetMatch()
     pattern.setTo(temp, u_strlen(temp));
 
     UErrorCode    status  = U_ZERO_ERROR;
-    StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, NULL
+    StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, nullptr
                                              status);
     if (U_FAILURE(status)) {
         errln("Error opening string search %s", u_errorName(status));
-        if (strsrch != NULL) {
+        if (strsrch != nullptr) {
             delete strsrch;
         }
         return;
@@ -1479,7 +1479,7 @@ void StringSearchTest::TestGetMatch()
 void StringSearchTest::TestSetMatch()
 {
     int count = 0;
-    while (MATCH[count].text != NULL) {
+    while (MATCH[count].text != nullptr) {
         SearchData     search = MATCH[count];
         UChar          temp[128];
         UErrorCode status = U_ZERO_ERROR;
@@ -1491,10 +1491,10 @@ void StringSearchTest::TestSetMatch()
         pattern.setTo(temp, u_strlen(temp));
 
         StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, 
-                                                 NULL, status);
+                                                 nullptr, status);
         if (U_FAILURE(status)) {
             errln("Error opening string search %s", u_errorName(status));
-            if (strsrch != NULL) {
+            if (strsrch != nullptr) {
                 delete strsrch;
             }
             return;
@@ -1550,11 +1550,11 @@ void StringSearchTest::TestReset()
     UErrorCode     status  = U_ZERO_ERROR;
     UnicodeString  text("fish fish");
     UnicodeString  pattern("s");
-    StringSearch  *strsrch = new StringSearch(pattern, text, m_en_us_, NULL
+    StringSearch  *strsrch = new StringSearch(pattern, text, m_en_us_, nullptr
                                               status);
     if (U_FAILURE(status)) {
         errln("Error opening string search %s", u_errorName(status));
-        if (strsrch != NULL) {
+        if (strsrch != nullptr) {
             delete strsrch;
         }
         return;
@@ -1585,7 +1585,7 @@ void StringSearchTest::TestReset()
 void StringSearchTest::TestSupplementary()
 {
     int count = 0;
-    while (SUPPLEMENTARY[count].text != NULL) {
+    while (SUPPLEMENTARY[count].text != nullptr) {
         if (!assertEqual(&SUPPLEMENTARY[count])) {
             errln("Error at test number %d", count);
         }
@@ -1608,14 +1608,14 @@ void StringSearchTest::TestContraction()
     }
     UnicodeString text("text");
     UnicodeString pattern("pattern");
-    StringSearch *strsrch = new StringSearch(pattern, text, collator, NULL
+    StringSearch *strsrch = new StringSearch(pattern, text, collator, nullptr
                                              status);
     if (U_FAILURE(status)) {
         errln("Error opening string search %s", u_errorName(status));
     }   
     
     int count = 0;
-    while (CONTRACTION[count].text != NULL) {
+    while (CONTRACTION[count].text != nullptr) {
         u_unescape(CONTRACTION[count].text, temp, 128);
         text.setTo(temp, u_strlen(temp));
         u_unescape(CONTRACTION[count].pattern, temp, 128);
@@ -1648,7 +1648,7 @@ void StringSearchTest::TestIgnorable()
     }
     UnicodeString pattern("pattern");
     UnicodeString text("text");
-    StringSearch *strsrch = new StringSearch(pattern, text, collator, NULL
+    StringSearch *strsrch = new StringSearch(pattern, text, collator, nullptr
                                              status);
     if (U_FAILURE(status)) {
         errln("Error opening string search %s", u_errorName(status));
@@ -1656,7 +1656,7 @@ void StringSearchTest::TestIgnorable()
         return;
     }   
     
-    while (IGNORABLE[count].text != NULL) {
+    while (IGNORABLE[count].text != nullptr) {
         u_unescape(IGNORABLE[count].text, temp, 128);
         text.setTo(temp, u_strlen(temp));
         u_unescape(IGNORABLE[count].pattern, temp, 128);
@@ -1677,8 +1677,8 @@ void StringSearchTest::TestDiacriticMatch()
        UChar temp[128];
     UErrorCode status = U_ZERO_ERROR;
     int        count  = 0;
-    RuleBasedCollator* coll = NULL;
-    StringSearch *strsrch = NULL;
+    RuleBasedCollator* coll = nullptr;
+    StringSearch *strsrch = nullptr;
 
     UnicodeString pattern("pattern");
     UnicodeString text("text");
@@ -1686,7 +1686,7 @@ void StringSearchTest::TestDiacriticMatch()
     const SearchData *search; 
     
     search = &(DIACRITICMATCH[count]);
-    while (search->text != NULL) {
+    while (search->text != nullptr) {
                coll = getCollator(search->collator);
        coll->setStrength(getECollationStrength(search->strength));
        strsrch = new StringSearch(pattern, text, coll, getBreakIterator(search->breaker), status);
@@ -1712,7 +1712,7 @@ void StringSearchTest::TestDiacriticMatch()
 void StringSearchTest::TestCanonical()
 {
     int count = 0;
-    while (BASICCANONICAL[count].text != NULL) {
+    while (BASICCANONICAL[count].text != nullptr) {
         if (!assertCanonicalEqual(&BASICCANONICAL[count])) {
             errln("Error at test number %d", count);
         }
@@ -1725,7 +1725,7 @@ void StringSearchTest::TestNormCanonical()
     UErrorCode status = U_ZERO_ERROR;
     m_en_us_->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
     int count = 0;
-    while (NORMCANONICAL[count].text != NULL) {
+    while (NORMCANONICAL[count].text != nullptr) {
         if (!assertCanonicalEqual(&NORMCANONICAL[count])) {
             errln("Error at test number %d", count);
         }
@@ -1737,7 +1737,7 @@ void StringSearchTest::TestNormCanonical()
 void StringSearchTest::TestStrengthCanonical()
 {
     int count = 0;
-    while (STRENGTHCANONICAL[count].text != NULL) {
+    while (STRENGTHCANONICAL[count].text != nullptr) {
         if (!assertCanonicalEqual(&STRENGTHCANONICAL[count])) {
             errln("Error at test number %d", count);
         }
@@ -1787,7 +1787,7 @@ void StringSearchTest::TestBreakIteratorCanonical()
         }
         search  = &(BREAKITERATOREXACT[count + 1]);
         breaker = getBreakIterator(search->breaker);
-        if (breaker == NULL) {
+        if (breaker == nullptr) {
             errln("Error creating BreakIterator");
             return;
         }
@@ -1808,7 +1808,7 @@ void StringSearchTest::TestBreakIteratorCanonical()
         count += 2;
     }
     count = 0;
-    while (BREAKITERATORCANONICAL[count].text != NULL) {
+    while (BREAKITERATORCANONICAL[count].text != nullptr) {
          if (!assertEqual(&BREAKITERATORCANONICAL[count])) {
              errln("Error at test number %d", count);
              return;
@@ -1828,7 +1828,7 @@ void StringSearchTest::TestVariableCanonical()
         errln("Error setting collation alternate attribute %s", 
               u_errorName(status));
     }
-    while (VARIABLE[count].text != NULL) {
+    while (VARIABLE[count].text != nullptr) {
         logln("variable %d", count);
         if (!assertCanonicalEqual(&VARIABLE[count])) {
             errln("Error at test number %d", count);
@@ -1842,7 +1842,7 @@ void StringSearchTest::TestVariableCanonical()
 void StringSearchTest::TestOverlapCanonical()
 {
     int count = 0;
-    while (OVERLAPCANONICAL[count].text != NULL) {
+    while (OVERLAPCANONICAL[count].text != nullptr) {
         if (!assertEqualWithAttribute(&OVERLAPCANONICAL[count], USEARCH_ON, 
                                       USEARCH_ON)) {
             errln("Error at overlap test number %d", count);
@@ -1850,7 +1850,7 @@ void StringSearchTest::TestOverlapCanonical()
         count ++;
     }    
     count = 0;
-    while (NONOVERLAP[count].text != NULL) {
+    while (NONOVERLAP[count].text != nullptr) {
         if (!assertCanonicalEqual(&NONOVERLAPCANONICAL[count])) {
             errln("Error at non overlap test number %d", count);
         }
@@ -1871,7 +1871,7 @@ void StringSearchTest::TestOverlapCanonical()
         pattern.setTo(temp, u_strlen(temp));
         RuleBasedCollator *collator = getCollator(search->collator);
         StringSearch *strsrch = new StringSearch(pattern, text, collator, 
-                                                 NULL, status);
+                                                 nullptr, status);
         strsrch->setAttribute(USEARCH_CANONICAL_MATCH, USEARCH_ON, status);
         strsrch->setAttribute(USEARCH_OVERLAP, USEARCH_ON, status);
         if (U_FAILURE(status) ||
@@ -1912,7 +1912,7 @@ void StringSearchTest::TestCollatorCanonical()
 
     UErrorCode    status  = U_ZERO_ERROR;
     StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, 
-                                             NULL, status);
+                                             nullptr, status);
     strsrch->setAttribute(USEARCH_CANONICAL_MATCH, USEARCH_ON, status);
     if (U_FAILURE(status)) {
         errln("Error opening string search %s", u_errorName(status));
@@ -1941,7 +1941,7 @@ void StringSearchTest::TestCollatorCanonical()
     strsrch->setAttribute(USEARCH_CANONICAL_MATCH, USEARCH_ON, status);
     if (!assertEqualWithStringSearch(strsrch, &COLLATORCANONICAL[1])) {
         delete strsrch;
-        if (tailored != NULL) {
+        if (tailored != nullptr) {
             delete tailored;
         }
 
@@ -1956,7 +1956,7 @@ void StringSearchTest::TestCollatorCanonical()
     if (!assertEqualWithStringSearch(strsrch, &COLLATORCANONICAL[0])) {
     }
     delete strsrch;
-    if (tailored != NULL) {
+    if (tailored != nullptr) {
         delete tailored;
     }
 }
@@ -1977,7 +1977,7 @@ void StringSearchTest::TestPatternCanonical()
                       getECollationStrength(PATTERNCANONICAL[0].strength));
 
     UErrorCode    status  = U_ZERO_ERROR;
-    StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, NULL
+    StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, nullptr
                                              status);
     strsrch->setAttribute(USEARCH_CANONICAL_MATCH, USEARCH_ON, status);
     if (U_FAILURE(status)) {
@@ -2024,7 +2024,7 @@ void StringSearchTest::TestPatternCanonical()
     }
 ENDTESTPATTERN:
     m_en_us_->setStrength(getECollationStrength(UCOL_TERTIARY));
-    if (strsrch != NULL) {
+    if (strsrch != nullptr) {
         delete strsrch;
     }
 }
@@ -2040,7 +2040,7 @@ void StringSearchTest::TestTextCanonical()
     pattern.setTo(temp, u_strlen(temp));
 
     UErrorCode    status  = U_ZERO_ERROR;
-    StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, NULL
+    StringSearch *strsrch = new StringSearch(pattern, text, m_en_us_, nullptr
                                              status);
     strsrch->setAttribute(USEARCH_CANONICAL_MATCH, USEARCH_ON, status);
 
@@ -2083,7 +2083,7 @@ void StringSearchTest::TestTextCanonical()
         goto ENDTESTPATTERN;
     }
 ENDTESTPATTERN:
-    if (strsrch != NULL) {
+    if (strsrch != nullptr) {
         delete strsrch;
     }
 }
@@ -2091,7 +2091,7 @@ ENDTESTPATTERN:
 void StringSearchTest::TestCompositeBoundariesCanonical()
 {
     int count = 0;
-    while (COMPOSITEBOUNDARIESCANONICAL[count].text != NULL) { 
+    while (COMPOSITEBOUNDARIESCANONICAL[count].text != nullptr) { 
         logln("composite %d", count);
         if (!assertCanonicalEqual(&COMPOSITEBOUNDARIESCANONICAL[count])) {
             errln("Error at test number %d", count);
@@ -2106,7 +2106,7 @@ void StringSearchTest::TestGetSetOffsetCanonical()
     UErrorCode     status  = U_ZERO_ERROR;
     UnicodeString  text("text");
     UnicodeString  pattern("pattern");
-    StringSearch  *strsrch = new StringSearch(pattern, text, m_en_us_, NULL
+    StringSearch  *strsrch = new StringSearch(pattern, text, m_en_us_, nullptr
                                               status);
     Collator *collator = strsrch->getCollator();
 
@@ -2124,9 +2124,9 @@ void StringSearchTest::TestGetSetOffsetCanonical()
     }
     int   index   = 0;
     UChar temp[128];
-    while (BASICCANONICAL[index].text != NULL) {
+    while (BASICCANONICAL[index].text != nullptr) {
         SearchData  search      = BASICCANONICAL[index ++];
-        if (BASICCANONICAL[index].text == NULL) {
+        if (BASICCANONICAL[index].text == nullptr) {
             /* skip the last one */
             break;
         }
@@ -2189,7 +2189,7 @@ bail:
 void StringSearchTest::TestSupplementaryCanonical()
 {
     int count = 0;
-    while (SUPPLEMENTARYCANONICAL[count].text != NULL) {
+    while (SUPPLEMENTARYCANONICAL[count].text != nullptr) {
         if (!assertCanonicalEqual(&SUPPLEMENTARYCANONICAL[count])) {
             errln("Error at test number %d", count);
         }
@@ -2213,7 +2213,7 @@ void StringSearchTest::TestContractionCanonical()
     }
     UnicodeString text("text");
     UnicodeString pattern("pattern");
-    StringSearch *strsrch = new StringSearch(pattern, text, collator, NULL
+    StringSearch *strsrch = new StringSearch(pattern, text, collator, nullptr
                                              status);
     strsrch->setAttribute(USEARCH_CANONICAL_MATCH, USEARCH_ON, status);
     if (U_FAILURE(status)) {
@@ -2221,7 +2221,7 @@ void StringSearchTest::TestContractionCanonical()
     }   
     
     int count = 0;
-    while (CONTRACTIONCANONICAL[count].text != NULL) {
+    while (CONTRACTIONCANONICAL[count].text != nullptr) {
         u_unescape(CONTRACTIONCANONICAL[count].text, temp, 128);
         text.setTo(temp, u_strlen(temp));
         u_unescape(CONTRACTIONCANONICAL[count].pattern, temp, 128);
@@ -2247,7 +2247,7 @@ void StringSearchTest::TestUClassID()
     UErrorCode     status    = U_ZERO_ERROR;
     UnicodeString  text("text");
     UnicodeString  pattern("pattern");
-    StringSearch  *strsrch = new StringSearch(pattern, text, m_en_us_, NULL
+    StringSearch  *strsrch = new StringSearch(pattern, text, m_en_us_, nullptr
                                               status);
     id = *((char *)strsrch->getDynamicClassID());
     if (id != 0) {
@@ -2405,7 +2405,7 @@ void StringSearchTest::TestSubclass()
 {
     UnicodeString text("abc abcd abc");
     UnicodeString pattern("abc");
-    TestSearch search(text, NULL, pattern);
+    TestSearch search(text, nullptr, pattern);
     TestSearch search2(search);
     int expected[] = {0, 4, 9};
     UErrorCode status = U_ZERO_ERROR; 
@@ -2454,7 +2454,7 @@ public:
     StubSearchIterator(){}
     virtual void setOffset(int32_t , UErrorCode &) override {}
     virtual int32_t getOffset(void) const override {return 0;}
-    virtual SearchIterator* safeClone(void) const override {return NULL;}
+    virtual SearchIterator* safeClone(void) const override {return nullptr;}
     virtual int32_t handleNext(int32_t , UErrorCode &) override {return 0;}
     virtual int32_t handlePrev(int32_t , UErrorCode &) override {return 0;}
     virtual UClassID getDynamicClassID() const override {
index 6a14e004cd1984028d200babfffccf7c311a63d8..504b22106351cd0601fa9a18ebb0ede36c4d49eb 100644 (file)
@@ -28,7 +28,7 @@ public:
     virtual ~StringSearchTest();
 
     void runIndexedTest(int32_t index, UBool exec, const char* &name, 
-                        char* par = NULL) override;
+                        char* par = nullptr) override;
 #if !UCONFIG_NO_BREAK_ITERATION
 private:
     RuleBasedCollator *m_en_us_; 
index d95d245fecf0ae25d4ef6e6eb49fa981d22800e4..58aa83246a76dd32de9488c938c11f82a7932b78 100644 (file)
@@ -112,7 +112,7 @@ const char *SSearchTest::getPath(char buffer[2048], const char *filename) {
 
     if (U_FAILURE(status) || strlen(testDataDirectory) + strlen(filename) + 1 >= PATH_BUFFER_SIZE) {
         errln("ERROR: getPath() failed - %s", u_errorName(status));
-        return NULL;
+        return nullptr;
     }
 
     strcpy(buffer, testDataDirectory);
@@ -128,7 +128,7 @@ void SSearchTest::searchTest()
     char path[PATH_BUFFER_SIZE];
     const char *testFilePath = getPath(path, "ssearch.xml");
 
-    if (testFilePath == NULL) {
+    if (testFilePath == nullptr) {
         return; /* Couldn't get path: error message already output. */
     }
 
@@ -141,7 +141,7 @@ void SSearchTest::searchTest()
     }
 
     const UnicodeString *debugTestCase = root->getAttribute("debug");
-    if (debugTestCase != NULL) {
+    if (debugTestCase != nullptr) {
 //       setenv("USEARCH_DEBUG", "1", 1);
     }
 
@@ -149,7 +149,7 @@ void SSearchTest::searchTest()
     const UXMLElement *testCase;
     int32_t tc = 0;
 
-    while((testCase = root->nextChildElement(tc)) != NULL) {
+    while((testCase = root->nextChildElement(tc)) != nullptr) {
 
         if (testCase->getTagName().compare("test-case") != 0) {
             errln("ssearch, unrecognized XML Element in test file");
@@ -157,12 +157,12 @@ void SSearchTest::searchTest()
         }
         const UnicodeString *id       = testCase->getAttribute("id");
         *testId = 0;
-        if (id != NULL) {
+        if (id != nullptr) {
             id->extract(0, id->length(), testId,  sizeof(testId), US_INV);
         }
 
         // If debugging test case has been specified and this is not it, skip to next.
-        if (id!=NULL && debugTestCase!=NULL && *id != *debugTestCase) {
+        if (id!=nullptr && debugTestCase!=nullptr && *id != *debugTestCase) {
             continue;
         }
         //
@@ -171,7 +171,7 @@ void SSearchTest::searchTest()
         //
         const UnicodeString *strength = testCase->getAttribute("strength");
         UColAttributeValue collatorStrength = UCOL_PRIMARY;
-        if      (strength==NULL)          { collatorStrength = UCOL_TERTIARY;}
+        if      (strength==nullptr)          { collatorStrength = UCOL_TERTIARY;}
         else if (*strength=="PRIMARY")    { collatorStrength = UCOL_PRIMARY;}
         else if (*strength=="SECONDARY")  { collatorStrength = UCOL_SECONDARY;}
         else if (*strength=="TERTIARY")   { collatorStrength = UCOL_TERTIARY;}
@@ -191,8 +191,8 @@ void SSearchTest::searchTest()
         //
         UColAttributeValue normalize = UCOL_OFF;
         const UnicodeString *norm = testCase->getAttribute("norm");
-        TEST_ASSERT (norm==NULL || *norm=="ON" || *norm=="OFF");
-        if (norm!=NULL && *norm=="ON") {
+        TEST_ASSERT (norm==nullptr || *norm=="ON" || *norm=="OFF");
+        if (norm!=nullptr && *norm=="ON") {
             normalize = UCOL_ON;
         }
 
@@ -201,18 +201,18 @@ void SSearchTest::searchTest()
         //
         UColAttributeValue alternateHandling = UCOL_NON_IGNORABLE;
         const UnicodeString *alt = testCase->getAttribute("alternate_handling");
-        TEST_ASSERT (alt == NULL || *alt == "SHIFTED" || *alt == "NON_IGNORABLE");
-        if (alt != NULL && *alt == "SHIFTED") {
+        TEST_ASSERT (alt == nullptr || *alt == "SHIFTED" || *alt == "NON_IGNORABLE");
+        if (alt != nullptr && *alt == "SHIFTED") {
             alternateHandling = UCOL_SHIFTED;
         }
 
         const UnicodeString defLocale("en");
         char  clocale[100];
         const UnicodeString *locale   = testCase->getAttribute("locale");
-        if (locale == NULL || locale->length()==0) {
+        if (locale == nullptr || locale->length()==0) {
             locale = &defLocale;
         }
-        locale->extract(0, locale->length(), clocale, sizeof(clocale), NULL);
+        locale->extract(0, locale->length(), clocale, sizeof(clocale), nullptr);
 
 
         UnicodeString  text;
@@ -224,8 +224,8 @@ void SSearchTest::searchTest()
         int32_t                nodeCount = 0;
 
         n = testCase->getChildElement("pattern");
-        TEST_ASSERT(n != NULL);
-        if (n==NULL) {
+        TEST_ASSERT(n != nullptr);
+        if (n==nullptr) {
             continue;
         }
         text = n->getText(false);
@@ -234,7 +234,7 @@ void SSearchTest::searchTest()
         nodeCount++;
 
         n = testCase->getChildElement("pre");
-        if (n!=NULL) {
+        if (n!=nullptr) {
             text = n->getText(false);
             text = text.unescape();
             target.append(text);
@@ -242,7 +242,7 @@ void SSearchTest::searchTest()
         }
 
         n = testCase->getChildElement("m");
-        if (n!=NULL) {
+        if (n!=nullptr) {
             expectedMatchStart = target.length();
             text = n->getText(false);
             text = text.unescape();
@@ -252,7 +252,7 @@ void SSearchTest::searchTest()
         }
 
         n = testCase->getChildElement("post");
-        if (n!=NULL) {
+        if (n!=nullptr) {
             text = n->getText(false);
             text = text.unescape();
             target.append(text);
@@ -273,7 +273,7 @@ void SSearchTest::searchTest()
         LocalUStringSearchPointer uss(usearch_openFromCollator(pattern.getBuffer(), pattern.length(),
                                                                target.getBuffer(), target.length(),
                                                                collator.getAlias(),
-                                                               NULL,     // the break iterator
+                                                               nullptr,     // the break iterator
                                                                &status));
 
         TEST_ASSERT_SUCCESS(status);
@@ -311,7 +311,7 @@ void SSearchTest::searchTest()
         uss.adoptInstead(usearch_openFromCollator(pattern.getBuffer(), pattern.length(),
             target.getBuffer(), target.length(),
             collator.getAlias(),
-            NULL,
+            nullptr,
             &status));
 
         //
@@ -362,13 +362,13 @@ private:
 };
 
 OrderList::OrderList()
-  : list(NULL),  listMax(16), listSize(0)
+  : list(nullptr),  listMax(16), listSize(0)
 {
     list = new Order[listMax];
 }
 
 OrderList::OrderList(UCollator *coll, const UnicodeString &string, int32_t stringOffset)
-    : list(NULL), listMax(16), listSize(0)
+    : list(nullptr), listMax(16), listSize(0)
 {
     UErrorCode status = U_ZERO_ERROR;
     UCollationElements *elems = ucol_openElements(coll, string.getBuffer(), string.length(), &status);
@@ -435,7 +435,7 @@ void OrderList::add(int32_t order, int32_t low, int32_t high)
 const Order *OrderList::get(int32_t index) const
 {
     if (index >= listSize) {
-        return NULL;
+        return nullptr;
     }
 
     return &list[index];
@@ -445,7 +445,7 @@ int32_t OrderList::getLowOffset(int32_t index) const
 {
     const Order *order = get(index);
 
-    if (order != NULL) {
+    if (order != nullptr) {
         return order->lowOffset;
     }
 
@@ -456,7 +456,7 @@ int32_t OrderList::getHighOffset(int32_t index) const
 {
     const Order *order = get(index);
 
-    if (order != NULL) {
+    if (order != nullptr) {
         return order->highOffset;
     }
 
@@ -467,7 +467,7 @@ int32_t OrderList::getOrder(int32_t index) const
 {
     const Order *order = get(index);
 
-    if (order != NULL) {
+    if (order != nullptr) {
         return order->order;
     }
 
@@ -731,7 +731,7 @@ static UnicodeString &escape(const UnicodeString &string, UnicodeString &buffer)
 void SSearchTest::sharpSTest()
 {
     UErrorCode status = U_ZERO_ERROR;
-    UCollator *coll = NULL;
+    UCollator *coll = nullptr;
     UnicodeString lp  = "fuss";
     UnicodeString sp = "fu\\u00DF";
     UnicodeString targets[]  = {"fu\\u00DF", "fu\\u00DFball", "1fu\\u00DFball", "12fu\\u00DFball", "123fu\\u00DFball", "1234fu\\u00DFball",
@@ -739,7 +739,7 @@ void SSearchTest::sharpSTest()
                                 "fuss", "ffuss", "fufuss", "fusfuss", "1fuss", "12fuss", "123fuss", "1234fuss", "fu\\u00DF", "1fu\\u00DF", "12fu\\u00DF", "123fu\\u00DF", "1234fu\\u00DF"};
     int32_t start = -1, end = -1;
 
-    coll = ucol_openFromShortString("LEN_S1", false, NULL, &status);
+    coll = ucol_openFromShortString("LEN_S1", false, nullptr, &status);
     TEST_ASSERT_SUCCESS(status);
 
     UnicodeString lpUnescaped = lp.unescape();
@@ -748,13 +748,13 @@ void SSearchTest::sharpSTest()
     LocalUStringSearchPointer ussLong(usearch_openFromCollator(lpUnescaped.getBuffer(), lpUnescaped.length(),
                                                            lpUnescaped.getBuffer(), lpUnescaped.length(),   // actual test data will be set later
                                                            coll,
-                                                           NULL,     // the break iterator
+                                                           nullptr,     // the break iterator
                                                            &status));
 
     LocalUStringSearchPointer ussShort(usearch_openFromCollator(spUnescaped.getBuffer(), spUnescaped.length(),
                                                            spUnescaped.getBuffer(), spUnescaped.length(),   // actual test data will be set later
                                                            coll,
-                                                           NULL,     // the break iterator
+                                                           nullptr,     // the break iterator
                                                            &status));
     TEST_ASSERT_SUCCESS(status);
 
@@ -788,19 +788,19 @@ void SSearchTest::sharpSTest()
 void SSearchTest::goodSuffixTest()
 {
     UErrorCode status = U_ZERO_ERROR;
-    UCollator *coll = NULL;
+    UCollator *coll = nullptr;
     UnicodeString pat = /*"gcagagag"*/ "fxeld";
     UnicodeString target = /*"gcatcgcagagagtatacagtacg"*/ "cloveldfxeld";
     int32_t start = -1, end = -1;
     UBool bFound;
 
-    coll = ucol_open(NULL, &status);
+    coll = ucol_open(nullptr, &status);
     TEST_ASSERT_SUCCESS(status);
 
     LocalUStringSearchPointer ss(usearch_openFromCollator(pat.getBuffer(), pat.length(),
                                                           target.getBuffer(), target.length(),
                                                           coll,
-                                                          NULL,     // the break iterator
+                                                          nullptr,     // the break iterator
                                                           &status));
     TEST_ASSERT_SUCCESS(status);
 
@@ -934,7 +934,7 @@ const char *cPattern = "maketh houndes ete hem";
     LocalUStringSearchPointer uss(usearch_openFromCollator(uPattern.getBuffer(), uPattern.length(),
                                                            target.getBuffer(), target.length(),
                                                            collator.getAlias(),
-                                                           NULL,     // the break iterator
+                                                           nullptr,     // the break iterator
                                                            &status));
     TEST_ASSERT_SUCCESS(status);
 
@@ -944,7 +944,7 @@ const char *cPattern = "maketh houndes ete hem";
 
     // Find the match position usgin strstr
     const char *pm = strstr(longishText, cPattern);
-    TEST_ASSERT_M(pm!=NULL, "No pattern match with strstr");
+    TEST_ASSERT_M(pm!=nullptr, "No pattern match with strstr");
     int32_t  refMatchPos = (int32_t)(pm - longishText);
     int32_t  icuMatchPos;
     int32_t  icuMatchEnd;
@@ -1117,7 +1117,7 @@ UnicodeString &StringSetMonkey::generateAlternative(const UnicodeString &testCas
         int32_t ce = ceList.get(offset);
         const StringList *strings = collData->getStringList(ce);
 
-        if (strings == NULL) {
+        if (strings == nullptr) {
             return alternate.append(testCase);
         }
 
@@ -1125,8 +1125,8 @@ UnicodeString &StringSetMonkey::generateAlternative(const UnicodeString &testCas
         int32_t tries = 0;
 
         // find random string that generates the same CEList
-        const CEList *ceList2 = NULL;
-        const UnicodeString *string = NULL;
+        const CEList *ceList2 = nullptr;
+        const UnicodeString *string = nullptr;
               UBool matches = false;
 
         do {
@@ -1294,7 +1294,7 @@ static int32_t  getIntParam(UnicodeString name, UnicodeString &params, int32_t d
         }
 
         params.extract(m.start(1, status), paramLength, valString, sizeof(valString));
-        val = uprv_strtol(valString,  NULL, 10);
+        val = uprv_strtol(valString,  nullptr, 10);
 
         // Delete this parameter from the params string.
         m.reset();
@@ -1322,7 +1322,7 @@ int32_t SSearchTest::monkeyTestCase(UCollator *coll, const UnicodeString &testCa
     LocalUStringSearchPointer uss(usearch_openFromCollator(pattern.getBuffer(), pattern.length(),
                                                            testCase.getBuffer(), testCase.length(),
                                                            coll,
-                                                           NULL,     // the break iterator
+                                                           nullptr,     // the break iterator
                                                            &status));
 
     // **** TODO: find *all* matches, not just first one ****
@@ -1365,8 +1365,8 @@ void SSearchTest::monkeyTest(char *params)
 {
     // ook!
     UErrorCode status = U_ZERO_ERROR;
-  //UCollator *coll = ucol_open(NULL, &status);
-    UCollator *coll = ucol_openFromShortString("S1", false, NULL, &status);
+  //UCollator *coll = ucol_open(nullptr, &status);
+    UCollator *coll = ucol_openFromShortString("S1", false, nullptr, &status);
 
     if (U_FAILURE(status)) {
         errcheckln(status, "Failed to create collator in MonkeyTest! - %s", u_errorName(status));
@@ -1412,7 +1412,7 @@ void SSearchTest::monkeyTest(char *params)
     int32_t firstStrength = 0;
     int32_t lastStrength  = strengthCount - 1; //*/ 0;
 
-    if (params != NULL) {
+    if (params != nullptr) {
 #if !UCONFIG_NO_REGULAR_EXPRESSIONS
         UnicodeString p(params);
 
@@ -1438,7 +1438,7 @@ void SSearchTest::monkeyTest(char *params)
             // Each option is stripped out of the option string as it is processed.
             // All options have been checked.  The option string should have been completely emptied..
             char buf[100];
-            p.extract(buf, sizeof(buf), NULL, status);
+            p.extract(buf, sizeof(buf), nullptr, status);
             buf[sizeof(buf)-1] = 0;
             errln("Unrecognized or extra parameter:  %s\n", buf);
             return;
index bb252915805708cd979969c73a8e39be02a7aa7f..9a9390824b8cc8ed2cb44bbdec2f50e7cca58cc6 100644 (file)
@@ -29,7 +29,7 @@ public:
     SSearchTest();
     virtual ~SSearchTest();
 
-    virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* params = NULL ) override;
+    virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* params = nullptr ) override;
 #if !UCONFIG_NO_BREAK_ITERATION
 
     virtual void searchTest();
index a8f2caf99d7bfab719e722f961c389f7122050c0..930e27268dc8d1edf98d64c915ee9b4ffe62db32 100644 (file)
@@ -473,9 +473,9 @@ StringCaseTest::TestCasingImpl(const UnicodeString &input,
     IcuTestErrorCode errorCode(*this, "TestCasingImpl");
     LocalUCaseMapPointer csm(ucasemap_open(localeID, options, errorCode));
 #if !UCONFIG_NO_BREAK_ITERATION
-    if(iter!=NULL) {
+    if(iter!=nullptr) {
         // Clone the break iterator so that the UCaseMap can safely adopt it.
-        UBreakIterator *clone=ubrk_safeClone((UBreakIterator *)iter, NULL, NULL, errorCode);
+        UBreakIterator *clone=ubrk_safeClone((UBreakIterator *)iter, nullptr, nullptr, errorCode);
         ucasemap_setBreakIterator(csm.getAlias(), clone, errorCode);
     }
 #endif
@@ -549,7 +549,7 @@ StringCaseTest::TestCasing() {
                 errln("TestCasing failed to createTestData(%s) - %s", dataNames[whichCase], u_errorName(status));
                 break;
             }
-            const DataMap *myCase = NULL;
+            const DataMap *myCase = nullptr;
             while(casingTest->nextCase(myCase, status)) {
                 input = myCase->getString("Input", status);
                 output = myCase->getString("Output", status);
@@ -563,13 +563,13 @@ StringCaseTest::TestCasing() {
                 if(whichCase==TEST_TITLE) {
                     type = myCase->getInt("Type", status);
                     if(type>=0) {
-                        iter.adoptInstead(ubrk_open((UBreakIteratorType)type, cLocaleID, NULL, 0, &status));
+                        iter.adoptInstead(ubrk_open((UBreakIteratorType)type, cLocaleID, nullptr, 0, &status));
                     } else if(type==-2) {
                         // Open a trivial break iterator that only delivers { 0, length }
                         // or even just { 0 } as boundaries.
                         static const UChar rules[] = { 0x2e, 0x2a, 0x3b };  // ".*;"
                         UParseError parseError;
-                        iter.adoptInstead(ubrk_openRules(rules, UPRV_LENGTHOF(rules), NULL, 0, &parseError, &status));
+                        iter.adoptInstead(ubrk_openRules(rules, UPRV_LENGTHOF(rules), nullptr, 0, &parseError, &status));
                     }
                 }
 #endif
@@ -598,7 +598,7 @@ StringCaseTest::TestCasing() {
                 }
 
 #if !UCONFIG_NO_BREAK_ITERATION
-                iter.adoptInstead(NULL);
+                iter.adoptInstead(nullptr);
 #endif
             }
         }
@@ -608,9 +608,9 @@ StringCaseTest::TestCasing() {
     // more tests for API coverage
     status=U_ZERO_ERROR;
     input=UNICODE_STRING_SIMPLE("sTrA\\u00dfE").unescape();
-    (result=input).toTitle(NULL);
+    (result=input).toTitle(nullptr);
     if(result!=UNICODE_STRING_SIMPLE("Stra\\u00dfe").unescape()) {
-        dataerrln("UnicodeString::toTitle(NULL) failed.");
+        dataerrln("UnicodeString::toTitle(nullptr) failed.");
     }
 #endif
 }
@@ -952,7 +952,7 @@ StringCaseTest::TestLongUpper() {
     UnicodeString s(length, (UChar32)0x390, length);
     UnicodeString result;
     UChar *dest = result.getBuffer(length + 1);
-    if (s.isBogus() || dest == NULL) {
+    if (s.isBogus() || dest == nullptr) {
         logln("Out of memory, unable to run this test on this machine.");
         return;
     }
@@ -1023,7 +1023,7 @@ void StringCaseTest::TestBufferOverflow() {
     UnicodeString data("hello world");
     int32_t result;
 #if !UCONFIG_NO_BREAK_ITERATION
-    result = ucasemap_toTitle(csm.getAlias(), NULL, 0, data.getBuffer(), data.length(), errorCode);
+    result = ucasemap_toTitle(csm.getAlias(), nullptr, 0, data.getBuffer(), data.length(), errorCode);
     if (errorCode.get() != U_BUFFER_OVERFLOW_ERROR || result != data.length()) {
         errln("%s:%d ucasemap_toTitle(\"hello world\") failed: "
               "expected (U_BUFFER_OVERFLOW_ERROR, %d), got (%s, %d)",
@@ -1035,7 +1035,7 @@ void StringCaseTest::TestBufferOverflow() {
     std::string data_utf8;
     data.toUTF8String(data_utf8);
 #if !UCONFIG_NO_BREAK_ITERATION
-    result = ucasemap_utf8ToTitle(csm.getAlias(), NULL, 0, data_utf8.c_str(), static_cast<int32_t>(data_utf8.length()), errorCode);
+    result = ucasemap_utf8ToTitle(csm.getAlias(), nullptr, 0, data_utf8.c_str(), static_cast<int32_t>(data_utf8.length()), errorCode);
     if (errorCode.get() != U_BUFFER_OVERFLOW_ERROR || result != (int32_t)data_utf8.length()) {
         errln("%s:%d ucasemap_toTitle(\"hello world\") failed: "
               "expected (U_BUFFER_OVERFLOW_ERROR, %d), got (%s, %d)",
index 91d0d4d967ce9811190da61f2ed53b0847a0c134..47acf7911480a8ca28ba0737d173cca216ce4d12 100644 (file)
@@ -265,13 +265,13 @@ void
 StringTest::TestStringPiece() {
     // Default constructor.
     StringPiece empty;
-    if(!empty.empty() || empty.data()!=NULL || empty.length()!=0 || empty.size()!=0) {
+    if(!empty.empty() || empty.data()!=nullptr || empty.length()!=0 || empty.size()!=0) {
         errln("StringPiece() failed");
     }
-    // Construct from NULL const char * pointer.
+    // Construct from nullptr const char * pointer.
     StringPiece null((const char *)nullptr);
-    if(!null.empty() || null.data()!=NULL || null.length()!=0 || null.size()!=0) {
-        errln("StringPiece(NULL) failed");
+    if(!null.empty() || null.data()!=nullptr || null.length()!=0 || null.size()!=0) {
+        errln("StringPiece(nullptr) failed");
     }
     // Construct from const char * pointer.
     static const char *abc_chars="abc";
@@ -359,7 +359,7 @@ StringTest::TestStringPiece() {
     // clear()
     sp=abcd;
     sp.clear();
-    if(!sp.empty() || sp.data()!=NULL || sp.length()!=0 || sp.size()!=0) {
+    if(!sp.empty() || sp.data()!=nullptr || sp.length()!=0 || sp.size()!=0) {
         errln("abcd.clear() failed");
     }
     // remove_prefix()
@@ -604,13 +604,13 @@ StringTest::TestByteSink() {
     char scratch[20];
     int32_t capacity = -1;
     char *dest = sink.GetAppendBuffer(0, 50, scratch, (int32_t)sizeof(scratch), &capacity);
-    if(dest != NULL || capacity != 0) {
-        errln("ByteSink.GetAppendBuffer(min_capacity<1) did not properly return NULL[0]");
+    if(dest != nullptr || capacity != 0) {
+        errln("ByteSink.GetAppendBuffer(min_capacity<1) did not properly return nullptr[0]");
         return;
     }
     dest = sink.GetAppendBuffer(10, 50, scratch, 9, &capacity);
-    if(dest != NULL || capacity != 0) {
-        errln("ByteSink.GetAppendBuffer(scratch_capacity<min_capacity) did not properly return NULL[0]");
+    if(dest != nullptr || capacity != 0) {
+        errln("ByteSink.GetAppendBuffer(scratch_capacity<min_capacity) did not properly return nullptr[0]");
         return;
     }
     dest = sink.GetAppendBuffer(5, 50, scratch, (int32_t)sizeof(scratch), &capacity);
@@ -635,13 +635,13 @@ StringTest::TestCheckedArrayByteSink() {
     char scratch[10];
     int32_t capacity = -1;
     char *dest = sink.GetAppendBuffer(0, 50, scratch, (int32_t)sizeof(scratch), &capacity);
-    if(dest != NULL || capacity != 0) {
-        errln("CheckedArrayByteSink.GetAppendBuffer(min_capacity<1) did not properly return NULL[0]");
+    if(dest != nullptr || capacity != 0) {
+        errln("CheckedArrayByteSink.GetAppendBuffer(min_capacity<1) did not properly return nullptr[0]");
         return;
     }
     dest = sink.GetAppendBuffer(10, 50, scratch, 9, &capacity);
-    if(dest != NULL || capacity != 0) {
-        errln("CheckedArrayByteSink.GetAppendBuffer(scratch_capacity<min_capacity) did not properly return NULL[0]");
+    if(dest != nullptr || capacity != 0) {
+        errln("CheckedArrayByteSink.GetAppendBuffer(scratch_capacity<min_capacity) did not properly return nullptr[0]");
         return;
     }
     dest = sink.GetAppendBuffer(10, 50, scratch, (int32_t)sizeof(scratch), &capacity);
index fa0222680106efded4a7f6d3c2f52b8ebe29d9fb..05fc9cf66d3bf534f6a50e8d29c0a771d10d62e6 100644 (file)
@@ -30,7 +30,7 @@ public:
     StringTest() {}
     virtual ~StringTest();
 
-    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=nullptr) override;
 
 private:
     void TestEndian();
index c0e145722738741eef22e097f4e5ed5c808e1b90..0d7f6bb525c168510e57f1ff60c0a8da2f251fbc 100644 (file)
@@ -54,7 +54,7 @@ void CollationServiceTest::TestRegister()
         Collator *clone = frcol->clone();
         URegistryKey key = Collator::registerInstance(frcol, US, status);
         // frcol has been adopted. We must not use it any more, nor rely on its attributes.
-        frcol = NULL;
+        frcol = nullptr;
 
         Collator* ncol = Collator::createInstance(US_FOO, status);
         if (*clone != *ncol) {
@@ -77,7 +77,7 @@ void CollationServiceTest::TestRegister()
         if (loc != US) {
             errln(UnicodeString("actual locale for en_US_FOO is not en_US but ") + loc.getName());
         }
-        delete ncol; ncol = NULL;
+        delete ncol; ncol = nullptr;
 
         if (!Collator::unregister(key, status)) {
             errln("failed to unregister french collator");
@@ -87,7 +87,7 @@ void CollationServiceTest::TestRegister()
         if (*uscol != *ncol) {
             errln("collator after unregister does not match original");
         }
-        delete ncol; ncol = NULL;
+        delete ncol; ncol = nullptr;
     }
 
     // recreate frcol
@@ -102,7 +102,7 @@ void CollationServiceTest::TestRegister()
         Collator* fucol = Collator::createInstance(fu_FU, status);
         Collator *clone = frcol->clone();
         URegistryKey key = Collator::registerInstance(frcol, fu_FU, status);
-        frcol = NULL;  // frcol has been adopted.
+        frcol = nullptr;  // frcol has been adopted.
         Collator* ncol = Collator::createInstance(fu_FU_FOO, status);
         if (*clone != *ncol) {
             errln("register of fr collator for fu_FU failed");
@@ -114,7 +114,7 @@ void CollationServiceTest::TestRegister()
         UBool found = false;
         const UnicodeString* locStr, *ls2;
         for (locStr = localeEnum->snext(status);
-        !found && locStr != NULL;
+        !found && locStr != nullptr;
         locStr = localeEnum->snext(status)) {
             //
             if (locName == *locStr) {
@@ -122,14 +122,14 @@ void CollationServiceTest::TestRegister()
             }
         }
 
-        StringEnumeration *le2 = NULL;
+        StringEnumeration *le2 = nullptr;
         localeEnum->reset(status);
         int32_t i, count;
         count = localeEnum->count(status);
         for(i = 0; i < count; ++i) {
             if(i == count / 2) {
                 le2 = localeEnum->clone();
-                if(le2 == NULL || count != le2->count(status)) {
+                if(le2 == nullptr || count != le2->count(status)) {
                     errln("ServiceEnumeration.clone() failed");
                     break;
                 }
@@ -192,7 +192,7 @@ void CollationServiceTest::TestRegister()
         if (nloc != fu_FU) {
             errln(UnicodeString("asked for nloc valid locale after close and got") + nloc.getName());
         }
-        delete ncol; ncol = NULL;
+        delete ncol; ncol = nullptr;
 
         if (fufu.isValid()) {
             const char* nlocstr = ucol_getLocaleByType(fufu.getAlias(), ULOC_VALID_LOCALE, &status);
@@ -205,9 +205,9 @@ void CollationServiceTest::TestRegister()
         if (*fucol != *ncol) {
             errln("collator after unregister does not match original fu_FU");
         }
-        delete uscol; uscol = NULL;
-        delete ncol; ncol = NULL;
-        delete fucol; fucol = NULL;
+        delete uscol; uscol = nullptr;
+        delete ncol; ncol = nullptr;
+        delete fucol; fucol = nullptr;
     }
 #endif
 }
@@ -264,14 +264,14 @@ class TestFactory : public CollatorFactory {
         return *p;
       }
     }
-    return NULL;
+    return nullptr;
   }
 
 public:
   TestFactory(CollatorInfo** _info)
     : info(_info)
     , count(0)
-    , ids(NULL)
+    , ids(nullptr)
   {
     CollatorInfo** p;
     for (p = info; *p; ++p) {}
@@ -291,7 +291,7 @@ public:
     if (ci) {
       return ci->collator->clone();
     }
-    return NULL;
+    return nullptr;
   }
 
   virtual UnicodeString& getDisplayName(const Locale& objectLocale,
@@ -314,7 +314,7 @@ public:
         if (!ids) {
           status = U_MEMORY_ALLOCATION_ERROR;
           _count = 0;
-          return NULL;
+          return nullptr;
         }
 
         for (int i = 0; i < count; ++i) {
@@ -325,7 +325,7 @@ public:
       _count = count;
       return ids;
     }
-    return NULL;
+    return nullptr;
   }
 
   virtual inline UClassID getDynamicClassID() const override {
@@ -381,10 +381,10 @@ void CollationServiceTest::TestRegisterFactory(void)
         return;
     }
 
-    info[0] = new CollatorInfo(Locale::getUS(), frcol, NULL);
-    info[1] = new CollatorInfo(Locale::getFrance(), gecol, NULL);
+    info[0] = new CollatorInfo(Locale::getUS(), frcol, nullptr);
+    info[1] = new CollatorInfo(Locale::getFrance(), gecol, nullptr);
     info[2] = new CollatorInfo(fu_FU, jpcol, fuFUNames);
-    info[3] = NULL;
+    info[3] = nullptr;
 
     TestFactory* factory = new TestFactory(info);
     if (!factory) {
@@ -407,7 +407,7 @@ void CollationServiceTest::TestRegisterFactory(void)
         if (*frcol != *ncol) {
             errln("frcoll for en_US failed");
         }
-        delete ncol; ncol = NULL;
+        delete ncol; ncol = nullptr;
 
         ncol = Collator::createInstance(fu_FU_FOO, status);
         if (*jpcol != *ncol) {
@@ -425,14 +425,14 @@ void CollationServiceTest::TestRegisterFactory(void)
         if (loc != fu_FU) {
             errln(UnicodeString("valid locale for fu_FU_FOO is not fu_FU but ") + loc.getName());
         }
-        delete ncol; ncol = NULL;
+        delete ncol; ncol = nullptr;
 
         UnicodeString locName = fu_FU.getName();
         StringEnumeration* localeEnum = Collator::getAvailableLocales();
         UBool found = false;
         const UnicodeString* locStr;
         for (locStr = localeEnum->snext(status);
-            !found && locStr != NULL;
+            !found && locStr != nullptr;
             locStr = localeEnum->snext(status))
         {
             if (locName == *locStr) {
@@ -479,7 +479,7 @@ void CollationServiceTest::TestRegisterFactory(void)
 /**
  * Iterate through the given iterator, checking to see that all the strings
  * in the expected array are present.
- * @param expected array of strings we expect to see, or NULL
+ * @param expected array of strings we expect to see, or nullptr
  * @param expectedCount number of elements of expected, or 0
  */
 int32_t CollationServiceTest::checkStringEnumeration(const char* msg,
@@ -494,7 +494,7 @@ int32_t CollationServiceTest::checkStringEnumeration(const char* msg,
     int32_t seenMask = 0;
     for (;; ++i) {
         const UnicodeString* s = iter.snext(ec);
-        if (!assertSuccess("snext", ec) || s == NULL)
+        if (!assertSuccess("snext", ec) || s == nullptr)
             break;
         if (i != 0)
             buf.append(UNICODE_STRING_SIMPLE(", "));
@@ -502,7 +502,7 @@ int32_t CollationServiceTest::checkStringEnumeration(const char* msg,
         // check expected list
         for (int32_t j=0, bit=1; j<expectedCount; ++j, bit<<=1) {
             if ((seenMask&bit)==0) {
-                UnicodeString exp(expected[j], (char*)NULL);
+                UnicodeString exp(expected[j], (char*)nullptr);
                 if (*s == exp) {
                     seenMask |= bit;
                     logln((UnicodeString)"Ok: \"" + exp + "\" seen");
@@ -519,8 +519,8 @@ int32_t CollationServiceTest::checkStringEnumeration(const char* msg,
     assertTrue("count verified", i==n);
     iter.reset(ec);
     for (;; ++idxAfterReset) {
-        const UChar *s = iter.unext(NULL, ec);
-        if (!assertSuccess("unext", ec) || s == NULL)
+        const UChar *s = iter.unext(nullptr, ec);
+        if (!assertSuccess("unext", ec) || s == nullptr)
             break;
         if (idxAfterReset != 0)
             buffAfterReset.append(UNICODE_STRING_SIMPLE(", "));
@@ -546,8 +546,8 @@ int32_t CollationServiceTest::checkStringEnumeration(const char* msg,
 #if !UCONFIG_NO_SERVICE
 int32_t CollationServiceTest::checkAvailable(const char* msg) {
     StringEnumeration *iter = Collator::getAvailableLocales();
-    if (!assertTrue("getAvailableLocales != NULL", iter!=NULL)) return -1;
-    int32_t n = checkStringEnumeration(msg, *iter, NULL, 0);
+    if (!assertTrue("getAvailableLocales != nullptr", iter!=nullptr)) return -1;
+    int32_t n = checkStringEnumeration(msg, *iter, nullptr, 0);
     delete iter;
     return n;
 }
@@ -569,13 +569,13 @@ static const int32_t KWVAL_COUNT = UPRV_LENGTHOF(KWVAL);
 void CollationServiceTest::TestSeparateTree() {
     UErrorCode ec = U_ZERO_ERROR;
     StringEnumeration *iter = Collator::getKeywords(ec);
-    if (!assertTrue("getKeywords != NULL", iter!=NULL)) return;
+    if (!assertTrue("getKeywords != nullptr", iter!=nullptr)) return;
     if (!assertSuccess("getKeywords", ec)) return;
     checkStringEnumeration("getKeywords", *iter, KW, KW_COUNT);
     delete iter;
 
     iter = Collator::getKeywordValues(KW[0], ec);
-    if (!assertTrue("getKeywordValues != NULL", iter!=NULL, false, true)) return;
+    if (!assertTrue("getKeywordValues != nullptr", iter!=nullptr, false, true)) return;
     if (!assertSuccess("getKeywordValues", ec)) return;
     checkStringEnumeration("getKeywordValues", *iter, KWVAL, KWVAL_COUNT);
     delete iter;
index 893cff9985286b82df87595cacc61b0056bc82c1..8692807aa8f6839e5e10f88f9915c11119884263 100644 (file)
@@ -24,7 +24,7 @@ class StringEnumeration;
 
 class CollationServiceTest: public IntlTest {
 public:
-    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* /*par = NULL */) override;
+    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* /*par = nullptr */) override;
 
     void TestRegister(void);
     void TestRegisterFactory(void);
index b0ca3583b22dcb16cec0483ea3d80b1912ce183f..a6fbf927d9bb76abc491dc40b763e646fa4c547b 100644 (file)
@@ -32,7 +32,7 @@ void TestChoiceFormat::runIndexedTest(int32_t index, UBool exec,
     }
 }
 
-static UBool chkstatus( UErrorCode &status, const char* msg = NULL )
+static UBool chkstatus( UErrorCode &status, const char* msg = nullptr )
 {
     UBool ok = U_SUCCESS(status);
     if (!ok) it_errln( msg );
@@ -86,15 +86,15 @@ TestChoiceFormat::TestSimpleExample( void )
     int32_t count=0;
     const double *gotLimits=form->getLimits(count);
 #if 1  // ICU 4.8 deprecates and disables the ChoiceFormat getters.
-    if(count != 0 || gotLimits != NULL) {
+    if(count != 0 || gotLimits != nullptr) {
         errln("getLimits() returns something, should be disabled");
     }
     const UnicodeString *gotFormats=form->getFormats(count);
-    if(count != 0 || gotFormats != NULL) {
+    if(count != 0 || gotFormats != nullptr) {
         errln("getFormats() returns something, should be disabled");
     }
     const UBool *gotClosures=form->getClosures(count);
-    if(count != 0 || gotClosures != NULL) {
+    if(count != 0 || gotClosures != nullptr) {
         errln("getClosures() returns something, should be disabled");
     }
 #else
@@ -148,7 +148,7 @@ TestChoiceFormat::TestComplexExample( void )
         return;
     }
 
-    //const Format* testFormats[] = { fileform, NULL, filenumform };
+    //const Format* testFormats[] = { fileform, nullptr, filenumform };
     //pattform->setFormats( testFormats, 3 );
 
     MessageFormat* pattform = new MessageFormat("There {0} on {1}", status );
index 775b22b47c977cae051f2cdca3c5c6b9c3768094..dee1fdbc6af7a37e3b45befbd8e093aabed58177 100644 (file)
@@ -52,7 +52,7 @@ class TestChoiceFormat: public IntlTest {
     /** 
      *    runs tests in local functions:
      **/
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 };
 
 #endif /* #if !UCONFIG_NO_FORMATTING */
index db90db8c357e3233608aa2c177528b7eafa11bb1..7e3f2c84b64e358c07b44a9bc720d8798dcd1cdb 100644 (file)
@@ -61,14 +61,14 @@ compareFlagsForRange(uint32_t start, uint32_t end,UStringPrepType option);
 static void
 testAllCodepoints(TestIDNA& test);
 
-static TestIDNA* pTestIDNA =NULL;
+static TestIDNA* pTestIDNA =nullptr;
 
 static const char* fileNames[] = {
                                     "rfc3491.txt"
                                  };
-static const UTrie *idnTrie              = NULL;
-static const int32_t *indexes            = NULL;
-static const uint16_t *mappingData       = NULL;
+static const UTrie *idnTrie              = nullptr;
+static const int32_t *indexes            = nullptr;
+static const uint16_t *mappingData       = nullptr;
 /* -------------------------------------------------------------------------- */
 
 /* file definitions */
@@ -78,9 +78,9 @@ static const uint16_t *mappingData       = NULL;
 
 extern int
 testData(TestIDNA& test) {
-    char *basename=NULL;
+    char *basename=nullptr;
     UErrorCode errorCode=U_ZERO_ERROR;
-    char *saveBasename =NULL;
+    char *saveBasename =nullptr;
 
     LocalUStringPrepProfilePointer profile(usprep_openByType(USPREP_RFC3491_NAMEPREP, &errorCode));
     if(U_FAILURE(errorCode)){
@@ -100,7 +100,7 @@ testData(TestIDNA& test) {
     pTestIDNA = &test;
     
     /* prepare the filename beginning with the source dir */
-    if(uprv_strchr(srcDir,U_FILE_SEP_CHAR) == NULL){
+    if(uprv_strchr(srcDir,U_FILE_SEP_CHAR) == nullptr){
         filename[0] = 0x2E;
         filename[1] = U_FILE_SEP_CHAR;
         uprv_strcpy(filename+2,srcDir);
@@ -135,7 +135,7 @@ testData(TestIDNA& test) {
 
     testAllCodepoints(test);
 
-    pTestIDNA = NULL;
+    pTestIDNA = nullptr;
     free(filename);
     return errorCode;
 }
@@ -168,21 +168,21 @@ strprepProfileLineFn(void * /*context*/,
     typeName = fields[2][0];
     map = fields[1][0];
    
-    if(uprv_strstr(typeName, usprepTypeNames[USPREP_UNASSIGNED])!=NULL){
+    if(uprv_strstr(typeName, usprepTypeNames[USPREP_UNASSIGNED])!=nullptr){
 
         u_parseCodePointRange(s, &rangeStart,&rangeEnd, pErrorCode);
 
         /* store the range */
         compareFlagsForRange(rangeStart,rangeEnd,USPREP_UNASSIGNED);
 
-    }else if(uprv_strstr(typeName, usprepTypeNames[USPREP_PROHIBITED])!=NULL){
+    }else if(uprv_strstr(typeName, usprepTypeNames[USPREP_PROHIBITED])!=nullptr){
 
         u_parseCodePointRange(s, &rangeStart,&rangeEnd, pErrorCode);
 
         /* store the range */
         compareFlagsForRange(rangeStart,rangeEnd,USPREP_PROHIBITED);
 
-    }else if(uprv_strstr(typeName, usprepTypeNames[USPREP_MAP])!=NULL){
+    }else if(uprv_strstr(typeName, usprepTypeNames[USPREP_MAP])!=nullptr){
         /* get the character code, field 0 */
         code=(uint32_t)uprv_strtoul(s, &end, 16);
 
@@ -204,7 +204,7 @@ static void
 parseMappings(const char *filename,UBool reportError, TestIDNA& test, UErrorCode *pErrorCode) {
     char *fields[3][2];
 
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+    if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
         return;
     }
 
@@ -277,7 +277,7 @@ testAllCodepoints(TestIDNA& test){
         punycode_status error;
         u_strToUTF32((UChar32*)in,19,&inLength,str,19,&status);
 
-        error= punycode_encode(inLength, in, NULL, (uint32_t*)&outLength, output);
+        error= punycode_encode(inLength, in, nullptr, (uint32_t*)&outLength, output);
         printf(output);
 
     }
index 882e3e6f159992bf50c2a8428d7668a229c2f9a6..758e43217cd8a9eabffa1b6858c90152dd9f8839 100644 (file)
@@ -405,7 +405,7 @@ static const struct ErrorCases{
     },
     { 
       {0},
-      NULL,
+      nullptr,
       U_ILLEGAL_ARGUMENT_ERROR,
       true, true, false
     }
@@ -423,7 +423,7 @@ void TestIDNA::debug(const UChar* src, int32_t srcLength, int32_t options){
     NamePrepTransform* trans = NamePrepTransform::createInstance(parseError,transStatus);
     int32_t prepOptions = (((options & UIDNA_ALLOW_UNASSIGNED) != 0) ? USPREP_ALLOW_UNASSIGNED: 0);
     LocalUStringPrepProfilePointer prep(usprep_openByType(USPREP_RFC3491_NAMEPREP,&prepStatus));
-    UChar *transOut=NULL, *prepOut=NULL;
+    UChar *transOut=nullptr, *prepOut=nullptr;
     int32_t transOutLength=0, prepOutLength=0;
     
     
@@ -458,21 +458,21 @@ void TestIDNA::testAPI(const UChar* src, const UChar* expected, const char* test
     UErrorCode status = U_ZERO_ERROR;
     UChar destStack[MAX_DEST_SIZE];
     int32_t destLen = 0;
-    UChar* dest = NULL;
-    int32_t expectedLen = (expected != NULL) ? u_strlen(expected) : 0;
+    UChar* dest = nullptr;
+    int32_t expectedLen = (expected != nullptr) ? u_strlen(expected) : 0;
     int32_t options = (useSTD3ASCIIRules == true) ? UIDNA_USE_STD3_RULES : UIDNA_DEFAULT;
     UParseError parseError;
     int32_t tSrcLen = 0; 
-    UChar* tSrc = NULL
+    UChar* tSrc = nullptr
 
-    if(src != NULL){
+    if(src != nullptr){
         tSrcLen = u_strlen(src);
         tSrc  =(UChar*) malloc( U_SIZEOF_UCHAR * tSrcLen );
         memcpy(tSrc,src,tSrcLen * U_SIZEOF_UCHAR);
     }
 
     // test null-terminated source and return value of number of UChars required
-    destLen = func(src,-1,NULL,0,options, &parseError , &status);
+    destLen = func(src,-1,nullptr,0,options, &parseError , &status);
     if (status == U_FILE_ACCESS_ERROR) {
         dataerrln("U_FILE_ACCESS_ERROR. Skipping the remainder of this test.");
         return;
@@ -506,7 +506,7 @@ void TestIDNA::testAPI(const UChar* src, const UChar* expected, const char* test
     } 
     if(testUnassigned ){
         status = U_ZERO_ERROR;
-        destLen = func(src,-1,NULL,0,options | UIDNA_ALLOW_UNASSIGNED, &parseError, &status);
+        destLen = func(src,-1,nullptr,0,options | UIDNA_ALLOW_UNASSIGNED, &parseError, &status);
         if(status == U_BUFFER_OVERFLOW_ERROR){
             status = U_ZERO_ERROR; // reset error code
             if(destLen+1 < MAX_DEST_SIZE){
@@ -541,7 +541,7 @@ void TestIDNA::testAPI(const UChar* src, const UChar* expected, const char* test
     status = U_ZERO_ERROR;
 
     // test source with lengthand return value of number of UChars required
-    destLen = func(tSrc, tSrcLen, NULL,0,options, &parseError, &status);
+    destLen = func(tSrc, tSrcLen, nullptr,0,options, &parseError, &status);
     if(status == U_BUFFER_OVERFLOW_ERROR){
         status = U_ZERO_ERROR; // reset error code
         if(destLen+1 < MAX_DEST_SIZE){
@@ -567,7 +567,7 @@ void TestIDNA::testAPI(const UChar* src, const UChar* expected, const char* test
     if(testUnassigned){
         status = U_ZERO_ERROR;
 
-        destLen = func(tSrc,tSrcLen,NULL,0,options | UIDNA_ALLOW_UNASSIGNED, &parseError, &status);
+        destLen = func(tSrc,tSrcLen,nullptr,0,options | UIDNA_ALLOW_UNASSIGNED, &parseError, &status);
 
         if(status == U_BUFFER_OVERFLOW_ERROR){
             status = U_ZERO_ERROR; // reset error code
@@ -595,7 +595,7 @@ void TestIDNA::testAPI(const UChar* src, const UChar* expected, const char* test
 
     status = U_ZERO_ERROR;
     if(testSTD3ASCIIRules==true){
-        destLen = func(src,-1,NULL,0,options | UIDNA_USE_STD3_RULES, &parseError, &status);
+        destLen = func(src,-1,nullptr,0,options | UIDNA_USE_STD3_RULES, &parseError, &status);
         if(status == U_BUFFER_OVERFLOW_ERROR){
             status = U_ZERO_ERROR; // reset error code
             if(destLen+1 < MAX_DEST_SIZE){
@@ -623,7 +623,7 @@ void TestIDNA::testAPI(const UChar* src, const UChar* expected, const char* test
 
         status = U_ZERO_ERROR;
 
-        destLen = func(tSrc,tSrcLen,NULL,0,options | UIDNA_USE_STD3_RULES, &parseError, &status);
+        destLen = func(tSrc,tSrcLen,nullptr,0,options | UIDNA_USE_STD3_RULES, &parseError, &status);
 
         if(status == U_BUFFER_OVERFLOW_ERROR){
             status = U_ZERO_ERROR; // reset error code
@@ -910,8 +910,8 @@ void TestIDNA::testErrorCases(const char* IDNToASCIIName, TestFunc IDNToASCII,
 
     for(int32_t i=0;i< UPRV_LENGTHOF(errorCases);i++){
         ErrorCases errorCase = errorCases[i];
-        UChar* src =NULL;
-        if(errorCase.ascii != NULL){
+        UChar* src =nullptr;
+        if(errorCase.ascii != nullptr){
             bufLen =  (int32_t)strlen(errorCase.ascii);
             u_charsToUChars(errorCase.ascii,buf, bufLen+1);
         }else{
@@ -932,7 +932,7 @@ void TestIDNA::testErrorCases(const char* IDNToASCIIName, TestFunc IDNToASCII,
                 errorCase.expected, false,true, IDNToASCII);
         }
         if(errorCase.testToUnicode ==true){
-            testAPI((src==NULL)? NULL : buf,src,
+            testAPI((src==nullptr)? nullptr : buf,src,
                     IDNToUnicodeName, errorCase.useSTD3ASCIIRules,
                     errorCase.expected, true, true, IDNToUnicode);   
         }
@@ -953,7 +953,7 @@ void TestIDNA::testConformance(const char* toASCIIName, TestFunc toASCII,
         const char* utf8Chars1 = conformanceTestCases[i].in;
         int32_t utf8Chars1Len = (int32_t)strlen(utf8Chars1);
         const char* utf8Chars2 = conformanceTestCases[i].out;
-        int32_t utf8Chars2Len = (utf8Chars2 == NULL) ? 0 : (int32_t)strlen(utf8Chars2);
+        int32_t utf8Chars2Len = (utf8Chars2 == nullptr) ? 0 : (int32_t)strlen(utf8Chars2);
 
         UErrorCode status = U_ZERO_ERROR;
         u_strFromUTF8(src,MAX_DEST_SIZE,&srcLen,utf8Chars1,utf8Chars1Len,&status);
@@ -961,7 +961,7 @@ void TestIDNA::testConformance(const char* toASCIIName, TestFunc toASCII,
             errln(UnicodeString("Conversion of UTF8 source in conformanceTestCases[") + i +UnicodeString( "].in ( ")+prettify(utf8Chars1) +UnicodeString(" ) failed. Error: ")+ UnicodeString(u_errorName(status)));
             continue;
         }
-        if(utf8Chars2 != NULL){
+        if(utf8Chars2 != nullptr){
             u_strFromUTF8(expected,MAX_DEST_SIZE,&expectedLen,utf8Chars2,utf8Chars2Len, &status);
             if(U_FAILURE(status)){
                 errln(UnicodeString("Conversion of UTF8 source in conformanceTestCases[") + i +UnicodeString( "].in ( ")+prettify(utf8Chars1) +UnicodeString(" ) failed. Error: ")+ UnicodeString(u_errorName(status)));
@@ -1335,7 +1335,7 @@ randul()
     static UBool initialized = false;
     if (!initialized)
     {
-        srand((unsigned)time(NULL));
+        srand((unsigned)time(nullptr));
         initialized = true;
     }
     // Assume rand has at least 12 bits of precision
@@ -1600,16 +1600,16 @@ void TestIDNA::TestDataFile(){
 
 TestIDNA::~TestIDNA(){
     delete gPrep;
-    gPrep = NULL;
+    gPrep = nullptr;
 }
 
 NamePrepTransform* TestIDNA::getInstance(UErrorCode& status){
-    if(gPrep == NULL){
+    if(gPrep == nullptr){
         UParseError parseError;
         gPrep = NamePrepTransform::createInstance(parseError, status);
-        if(gPrep == NULL){
+        if(gPrep == nullptr){
            //status = U_MEMORY_ALLOCATION_ERROR;
-           return NULL;
+           return nullptr;
         }
     }
     return gPrep;
index 91e7c0bf99c4dc325d3e972cd0fdd02a28b68ab7..202283714ce4a1026b69d736c6a7eb609625d8bd 100644 (file)
@@ -52,7 +52,7 @@ class NamePrepTransform;
  */
 class TestIDNA : public IntlTest {
 public:
-    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=nullptr) override;
     void TestDataFile();
     void TestToASCII();
     void TestToUnicode();
index 6401d90be78c376a99d2225b258efa69c046738c..e57fa7251b1df5b24b82e27d1ea95ab207a2ea68 100644 (file)
@@ -21,7 +21,7 @@
 #include "unicode/fieldpos.h"
 #include "unicode/fmtable.h"
 
-/*static UBool chkstatus( UErrorCode &status, char* msg = NULL )
+/*static UBool chkstatus( UErrorCode &status, char* msg = nullptr )
 {
     UBool ok = (status == U_ZERO_ERROR);
     if (!ok) it_errln( msg );
@@ -294,7 +294,7 @@ void test_Formattable( void )
     
     res_array = fta.getArray(res_cnt, status = U_ZERO_ERROR);
     if (status == U_INVALID_FORMAT_ERROR){
-        if (res_cnt == 0 && res_array == NULL){
+        if (res_cnt == 0 && res_array == nullptr){
             it_logln("FT getArray with status tested on non array");
         } else {
             it_errln("*** FT getArray with status return values are not consistent");
index 518c684bab50eff2186c7eea352419a0357c3570..a93ffcacc0b748f007b6e25c1a3d0dba390e55e1 100644 (file)
@@ -23,7 +23,7 @@ class TestFormatSmallClasses: public IntlTest {
      *    FieldPosition in test_FieldPosition(),
      *    Formattable in test_Formattable().
      **/    
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 };
 
 #endif
index dd02e59d20ec260bb97481c52c37a89f0c3d61a7..3e462b067fe81be502858040fe49851754a9ecb2 100644 (file)
@@ -340,7 +340,7 @@ UnicodeString& CollationThaiTest::parseChars(UnicodeString& result,
     return result = CharsToUnicodeString(chars);
 }
 
-UCollator *thaiColl = NULL;
+UCollator *thaiColl = nullptr;
 
 U_CDECL_BEGIN
 static int U_CALLCONV
index aaba12a9b57849cbe3843d1a7c384295c3dd6f44..7866ec15ca1b210f56eea743c9bddd725deca170 100644 (file)
@@ -27,7 +27,7 @@ public:
     CollationThaiTest();
     virtual ~CollationThaiTest();
 
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
     
 private:
 
index 569d5f4818bfb0e9753525521821d2f57e7d4745..28450816c3ca182db9643eef740c4765de3e157c 100644 (file)
@@ -1229,13 +1229,13 @@ void TestMessageFormat::testAdopt()
     for (i = 0; i < count; i++) {
         a = formats[i];
         b = formatsCmp[i];
-        if ((a != NULL) && (b != NULL)) {
+        if ((a != nullptr) && (b != nullptr)) {
             if (*a != *b) {
                 errln("a != b");
                 return;
             }
-        }else if ((a != NULL) || (b != NULL)) {
-            errln("(a != NULL) || (b != NULL)");
+        }else if ((a != nullptr) || (b != nullptr)) {
+            errln("(a != nullptr) || (b != nullptr)");
             return;
         }
     }
@@ -1253,7 +1253,7 @@ void TestMessageFormat::testAdopt()
     for (i = 0; i < count; i++) {
         a = formatsChg[i];
         b = formatsCmp[i];
-        if ((a != NULL) && (b != NULL)) {
+        if ((a != nullptr) && (b != nullptr)) {
             if (*a == *b) {
                 logln("formatsChg == formatsCmp at index %d", i);
                 diff = false;
@@ -1286,14 +1286,14 @@ void TestMessageFormat::testAdopt()
     for (i = 0; i < countAct; i++) {
         a = formatsAct[i];
         b = formatsCmp[i];
-        if ((a != NULL) && (b != NULL)) {
+        if ((a != nullptr) && (b != nullptr)) {
             if (*a != *b) {
                 logln("formatsAct != formatsCmp at index %d", i);
                 errln("a != b");
                 return;
             }
-        }else if ((a != NULL) || (b != NULL)) {
-            errln("(a != NULL) || (b != NULL)");
+        }else if ((a != nullptr) || (b != nullptr)) {
+            errln("(a != nullptr) || (b != nullptr)");
             return;
         }
     }
@@ -1310,8 +1310,8 @@ void TestMessageFormat::testAdopt()
     }
 
     for (i = 0; i < countCmp; i++) {
-        if (formatsCmp[i] == NULL) {
-            formatsToAdopt[i] = NULL;
+        if (formatsCmp[i] == nullptr) {
+            formatsToAdopt[i] = nullptr;
         }else{
             formatsToAdopt[i] = formatsCmp[i]->clone();
             if (!formatsToAdopt[i]) {
@@ -1336,13 +1336,13 @@ void TestMessageFormat::testAdopt()
     for (i = 0; i < countAct; i++) {
         a = formatsAct[i];
         b = formatsCmp[i];
-        if ((a != NULL) && (b != NULL)) {
+        if ((a != nullptr) && (b != nullptr)) {
             if (*a != *b) {
                 errln("a != b");
                 return;
             }
-        }else if ((a != NULL) || (b != NULL)) {
-            errln("(a != NULL) || (b != NULL)");
+        }else if ((a != nullptr) || (b != nullptr)) {
+            errln("(a != nullptr) || (b != nullptr)");
             return;
         }
     }
@@ -1359,8 +1359,8 @@ void TestMessageFormat::testAdopt()
     }
 
     for (i = 0; i < countCmp; i++) {
-        if (formatsCmp[i] == NULL) {
-            formatsToAdopt[i] = NULL;
+        if (formatsCmp[i] == nullptr) {
+            formatsToAdopt[i] = nullptr;
         }else{
             formatsToAdopt[i] = formatsCmp[i]->clone();
             if (!formatsToAdopt[i]) {
@@ -1388,13 +1388,13 @@ void TestMessageFormat::testAdopt()
     for (i = 0; i < countAct; i++) {
         a = formatsAct[i];
         b = formatsCmp[i];
-        if ((a != NULL) && (b != NULL)) {
+        if ((a != nullptr) && (b != nullptr)) {
             if (*a != *b) {
                 errln("a != b");
                 return;
             }
-        }else if ((a != NULL) || (b != NULL)) {
-            errln("(a != NULL) || (b != NULL)");
+        }else if ((a != nullptr) || (b != nullptr)) {
+            errln("(a != nullptr) || (b != nullptr)");
             return;
         }
     }
@@ -1418,32 +1418,32 @@ static void _testCopyConstructor2()
     const Formattable fargs( d, Formattable::kIsDate );
 
     MessageFormat* fmt1 = new MessageFormat( formatStr, status );
-    MessageFormat* fmt2 = NULL;
-    MessageFormat* fmt3 = NULL;
-    MessageFormat* fmt4 = NULL;
+    MessageFormat* fmt2 = nullptr;
+    MessageFormat* fmt3 = nullptr;
+    MessageFormat* fmt4 = nullptr;
 
-    if (fmt1 == NULL) {
-        it_err("testCopyConstructor2: (fmt1 != NULL)");
+    if (fmt1 == nullptr) {
+        it_err("testCopyConstructor2: (fmt1 != nullptr)");
         goto cleanup;
     }
 
     fmt2 = new MessageFormat( *fmt1 );
     result = fmt1->format( &fargs, 1, resultStr, fp, status );
 
-    if (fmt2 == NULL) {
-        it_err("testCopyConstructor2: (fmt2 != NULL)");
+    if (fmt2 == nullptr) {
+        it_err("testCopyConstructor2: (fmt2 != nullptr)");
         goto cleanup;
     }
 
     fmt3 = fmt1->clone();
     fmt4 = fmt2->clone();
 
-    if (fmt3 == NULL) {
-        it_err("testCopyConstructor2: (fmt3 != NULL)");
+    if (fmt3 == nullptr) {
+        it_err("testCopyConstructor2: (fmt3 != nullptr)");
         goto cleanup;
     }
-    if (fmt4 == NULL) {
-        it_err("testCopyConstructor2: (fmt4 != NULL)");
+    if (fmt4 == nullptr) {
+        it_err("testCopyConstructor2: (fmt4 != nullptr)");
         goto cleanup;
     }
 
@@ -1621,10 +1621,10 @@ void TestMessageFormat::TestApostropheMode() {
       UErrorCode status = U_ZERO_ERROR;
       assertEquals("DOUBLE_OPTIONAL failure",
                    desired,
-                   GetPatternAndSkipSyntax(ado_mp->parse(ado_pattern, NULL, status)));
+                   GetPatternAndSkipSyntax(ado_mp->parse(ado_pattern, nullptr, status)));
       UnicodeString& adr_pattern = tuples[i + 2].isEmpty() ? ado_pattern : tuples[i + 2];
       assertEquals("DOUBLE_REQUIRED failure", desired,
-          GetPatternAndSkipSyntax(adr_mp->parse(adr_pattern, NULL, status)));
+          GetPatternAndSkipSyntax(adr_mp->parse(adr_pattern, nullptr, status)));
     }
     delete adr_mp;
     delete ado_mp;
@@ -1639,13 +1639,13 @@ void TestMessageFormat::TestCompatibleApostrophe() {
 
     UErrorCode ec = U_ZERO_ERROR;
     MessageFormat compMsg("", Locale::getUS(), ec);
-    compMsg.applyPattern(pattern, UMSGPAT_APOS_DOUBLE_REQUIRED, NULL, ec);
+    compMsg.applyPattern(pattern, UMSGPAT_APOS_DOUBLE_REQUIRED, nullptr, ec);
     if (compMsg.getApostropheMode() != UMSGPAT_APOS_DOUBLE_REQUIRED) {
         errln("wrong value from  compMsg.getApostropheMode().");
     }
 
     MessageFormat icuMsg("", Locale::getUS(), ec);
-    icuMsg.applyPattern(pattern, UMSGPAT_APOS_DOUBLE_OPTIONAL, NULL, ec);
+    icuMsg.applyPattern(pattern, UMSGPAT_APOS_DOUBLE_OPTIONAL, nullptr, ec);
     if (icuMsg.getApostropheMode() != UMSGPAT_APOS_DOUBLE_OPTIONAL) {
         errln("wrong value from  icuMsg.getApostropheMode().");
     }
@@ -1734,7 +1734,7 @@ void TestMessageFormat::testCoverage(void) {
     UErrorCode status = U_ZERO_ERROR;
     UnicodeString testformat("{argument, plural, one{C''est # fichier} other {Ce sont # fichiers}} dans la liste.");
     MessageFormat *msgfmt = new MessageFormat(testformat, Locale("fr"), status);
-    if (msgfmt == NULL || U_FAILURE(status)) {
+    if (msgfmt == nullptr || U_FAILURE(status)) {
         dataerrln("FAIL: Unable to create MessageFormat.: %s", u_errorName(status));
         return;
     }
@@ -1750,7 +1750,7 @@ void TestMessageFormat::testCoverage(void) {
     msgfmt->setFormat("set", cf, status);
 
     StringEnumeration *en = msgfmt->getFormatNames(status);
-    if (en == NULL || U_FAILURE(status)) {
+    if (en == nullptr || U_FAILURE(status)) {
         errln("FAIL: Unable to get format names enumeration.");
     } else {
         int32_t count = 0;
@@ -1778,7 +1778,7 @@ void TestMessageFormat::testCoverage(void) {
     delete msgfmt;
 
     msgfmt = new MessageFormat("'", status);
-    if (msgfmt == NULL || U_FAILURE(status)) {
+    if (msgfmt == nullptr || U_FAILURE(status)) {
         errln("FAIL: Unable to create MessageFormat.");
         return;
     }
@@ -1814,7 +1814,7 @@ void TestMessageFormat::testGetFormatNames() {
     }
     const UnicodeString *name;
     name = names->snext(errorCode);
-    if (name == NULL || errorCode.isFailure()) {
+    if (name == nullptr || errorCode.isFailure()) {
         errln("msgfmt.getFormatNames()[0] failed: %s", errorCode.errorName());
         errorCode.reset();
         return;
@@ -1823,7 +1823,7 @@ void TestMessageFormat::testGetFormatNames() {
         return;
     }
     name = names->snext(errorCode);
-    if (name == NULL || errorCode.isFailure()) {
+    if (name == nullptr || errorCode.isFailure()) {
         errln("msgfmt.getFormatNames()[1] failed: %s", errorCode.errorName());
         errorCode.reset();
         return;
@@ -1832,7 +1832,7 @@ void TestMessageFormat::testGetFormatNames() {
         return;
     }
     name = names->snext(errorCode);
-    if (name == NULL || errorCode.isFailure()) {
+    if (name == nullptr || errorCode.isFailure()) {
         errln("msgfmt.getFormatNames()[2] failed: %s", errorCode.errorName());
         errorCode.reset();
         return;
@@ -1841,8 +1841,8 @@ void TestMessageFormat::testGetFormatNames() {
         return;
     }
     name = names->snext(errorCode);
-    if (name != NULL) {
-        errln(UnicodeString("msgfmt.getFormatNames()[3] should be NULL but is: ") + *name);
+    if (name != nullptr) {
+        errln(UnicodeString("msgfmt.getFormatNames()[3] should be nullptr but is: ") + *name);
         return;
     }
 }
index 500560c5c2abf8df4114218419198a07d2e7ede1..f753705a725469529e1c6c4bbb6878141ce40958 100644 (file)
@@ -22,7 +22,7 @@
  */
 class TestMessageFormat: public IntlTest {
 public:
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     /**
      * regression test for a specific bug regarding ChoiceFormat boundaries
index 828b774b3ecbaaf14d5998f8ecde91af7c70fd4f..e33bbd19ebd08b8ab28a5a3cf6b6247897ec929d 100644 (file)
@@ -358,7 +358,7 @@ void TransliteratorAPITest::TestTransliterate2(){
         status = U_ZERO_ERROR;
         callEverything(t, __LINE__);
         delete t;
-        t = NULL;
+        t = nullptr;
     }
 
     status = U_ZERO_ERROR;
@@ -653,13 +653,13 @@ void TransliteratorAPITest::TestRegisterUnregister(){
    
    UErrorCode status=U_ZERO_ERROR;
     /* Make sure it doesn't exist */
-   if (Transliterator::createInstance("TestA-TestB", UTRANS_FORWARD, status) != NULL) {
+   if (Transliterator::createInstance("TestA-TestB", UTRANS_FORWARD, status) != nullptr) {
       errln("FAIL: TestA-TestB already registered\n");
       return;
    }
    /* Check inverse too 
    if (Transliterator::createInstance("TestA-TestB",
-                                      (UTransDirection)UTRANS_REVERSE) != NULL) {
+                                      (UTransDirection)UTRANS_REVERSE) != nullptr) {
       errln("FAIL: TestA-TestB inverse already registered\n");
       return;
    }
@@ -677,7 +677,7 @@ void TransliteratorAPITest::TestRegisterUnregister(){
 
    /* Now check again -- should exist now*/
    Transliterator *s = Transliterator::createInstance("TestA-TestB", UTRANS_FORWARD, status);
-   if (s == NULL) {
+   if (s == nullptr) {
       errln("FAIL: TestA-TestB not registered\n");
       return;
    }
@@ -688,7 +688,7 @@ void TransliteratorAPITest::TestRegisterUnregister(){
    /* Check inverse too
    s = Transliterator::createInstance("TestA-TestB",
                                       (UTransDirection)UTRANS_REVERSE);
-   if (s == NULL) {
+   if (s == nullptr) {
       errln("FAIL: TestA-TestB inverse not registered\n");
       return;
    }
@@ -698,7 +698,7 @@ void TransliteratorAPITest::TestRegisterUnregister(){
    /*unregister the instance*/
    Transliterator::unregister("TestA-TestB");
    /* now Make sure it doesn't exist */
-   if (Transliterator::createInstance("TestA-TestB", UTRANS_FORWARD, status) != NULL) {
+   if (Transliterator::createInstance("TestA-TestB", UTRANS_FORWARD, status) != nullptr) {
       errln("FAIL: TestA-TestB isn't unregistered\n");
       return;
    }
@@ -788,7 +788,7 @@ void TransliteratorAPITest::TestGetAdoptFilter(){
         return;
     }
     const UnicodeFilter *u=t->getFilter();
-    if(u != NULL){
+    if(u != nullptr){
         errln("FAIL: getFilter failed. Didn't return null when the transliterator used no filtering");
         delete t;
         return;
@@ -808,7 +808,7 @@ void TransliteratorAPITest::TestGetAdoptFilter(){
          
     logln("Testing round trip");
     t->adoptFilter((UnicodeFilter*)u);
-    if(t->getFilter() == NULL)
+    if(t->getFilter() == nullptr)
        logln("OK: adoptFilter and getFilter round trip worked");
     else
        errln("FAIL: adoptFilter or getFilter round trip failed");  
@@ -927,7 +927,7 @@ void TransliteratorAPITest::doTest(const UnicodeString& message, const UnicodeSt
 
 void TransliteratorAPITest::callEverything(const Transliterator *tr, int line) {
     Transliterator *clonedTR = tr->clone();
-    CEASSERT(clonedTR != NULL);
+    CEASSERT(clonedTR != nullptr);
 
     int32_t  maxcl = tr->getMaximumContextLength();
     CEASSERT(clonedTR->getMaximumContextLength() == maxcl);
@@ -940,8 +940,8 @@ void TransliteratorAPITest::callEverything(const Transliterator *tr, int line) {
 
     const UnicodeFilter *filter = tr->getFilter();
     const UnicodeFilter *clonedFilter = clonedTR->getFilter();
-    if (filter == NULL || clonedFilter == NULL) {
-        // If one filter is NULL they better both be NULL.
+    if (filter == nullptr || clonedFilter == nullptr) {
+        // If one filter is nullptr they better both be nullptr.
         CEASSERT(filter == clonedFilter);
     } else {
         CEASSERT(filter != clonedFilter);
@@ -975,7 +975,7 @@ void TransliteratorAPITest::callEverything(const Transliterator *tr, int line) {
 static const int MyUnicodeFunctorTestClassID = 0;
 class MyUnicodeFunctorTestClass : public UnicodeFunctor {
 public:
-    virtual UnicodeFunctor* clone() const override {return NULL;}
+    virtual UnicodeFunctor* clone() const override {return nullptr;}
     static UClassID getStaticClassID(void) {return (UClassID)&MyUnicodeFunctorTestClassID;}
     virtual UClassID getDynamicClassID(void) const override {return getStaticClassID();}
     virtual void setData(const TransliterationRuleData*) override {}
@@ -983,11 +983,11 @@ public:
 
 void TransliteratorAPITest::TestUnicodeFunctor() {
     MyUnicodeFunctorTestClass myClass;
-    if (myClass.toMatcher() != NULL) {
-        errln("FAIL: UnicodeFunctor::toMatcher did not return NULL");
+    if (myClass.toMatcher() != nullptr) {
+        errln("FAIL: UnicodeFunctor::toMatcher did not return nullptr");
     }
-    if (myClass.toReplacer() != NULL) {
-        errln("FAIL: UnicodeFunctor::toReplacer did not return NULL");
+    if (myClass.toReplacer() != nullptr) {
+        errln("FAIL: UnicodeFunctor::toReplacer did not return nullptr");
     }
 }
 
index 9d8ff97496da2f1d773f26cd980aaec00cca6fe9..1f03a0a17bab3995d94ff927edb23a6e888dafba 100644 (file)
@@ -26,7 +26,7 @@
  */
 class TransliteratorAPITest : public IntlTest {
 public:
-    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=nullptr) override;
 
     /*Tests the function getDisplayName() */
     void TestGetDisplayName(void);
index 8b6766cf9d6149a9bbaa66eaa7dc0331327d4513..d376b026ee1415ebdbb72405978fdde3812a4c20 100644 (file)
@@ -494,7 +494,7 @@ void RTTest::test(const UnicodeString& sourceRangeVal,
     this->toTarget.addAll(okAnyway);
 
     this->roundtripExclusionsSet.clear();
-    if (roundtripExclusions != NULL && strlen(roundtripExclusions) > 0) {
+    if (roundtripExclusions != nullptr && strlen(roundtripExclusions) > 0) {
         this->roundtripExclusionsSet.applyPattern(UnicodeString(roundtripExclusions, -1, US_INV), status);
         if (U_FAILURE(status)) {
             parent->errln("FAIL: UnicodeSet::applyPattern(%s)", roundtripExclusions);
@@ -513,12 +513,12 @@ void RTTest::test(const UnicodeString& sourceRangeVal,
 
     if (errorCount > 0) {
         char str[100];
-        int32_t length = transliteratorID.extract(str, 100, NULL, status);
+        int32_t length = transliteratorID.extract(str, 100, nullptr, status);
         str[length] = 0;
         parent->errln("FAIL: %s errors: %d %s", str, errorCount, (errorCount > errorLimit ? " (at least!)" : " ")); // + ", see " + logFileName);
     } else {
         char str[100];
-        int32_t length = transliteratorID.extract(str, 100, NULL, status);
+        int32_t length = transliteratorID.extract(str, 100, nullptr, status);
         str[length] = 0;
         parent->logln("%s ok", str);
     }
@@ -544,18 +544,18 @@ void RTTest::test2(UBool quickRt, int32_t density) {
     TransliteratorPointer sourceToTarget(
         Transliterator::createInstance(transliteratorID, UTRANS_FORWARD, parseError,
                                        status));
-    if ((Transliterator *)sourceToTarget == NULL) {
+    if ((Transliterator *)sourceToTarget == nullptr) {
         parent->dataerrln("FAIL: createInstance(" + transliteratorID +
-                   ") returned NULL. Error: " + u_errorName(status)
+                   ") returned nullptr. Error: " + u_errorName(status)
                    + "\n\tpreContext : " + prettify(parseError.preContext) 
                    + "\n\tpostContext : " + prettify(parseError.postContext));
         
                 return;
     }
     TransliteratorPointer targetToSource(sourceToTarget->createInverse(status));
-    if ((Transliterator *)targetToSource == NULL) {
+    if ((Transliterator *)targetToSource == nullptr) {
         parent->errln("FAIL: " + transliteratorID +
-                   ".createInverse() returned NULL. Error:" + u_errorName(status)          
+                   ".createInverse() returned nullptr. Error:" + u_errorName(status)          
                    + "\n\tpreContext : " + prettify(parseError.preContext) 
                    + "\n\tpostContext : " + prettify(parseError.postContext));
         return;
@@ -994,7 +994,7 @@ void TransliteratorRoundTripTest::TestJamo() {
     t.test(UnicodeString("[a-zA-Z]", ""), 
            UnicodeString("[\\u1100-\\u1112 \\u1161-\\u1175 \\u11A8-\\u11C2]", 
                          ""), 
-           NULL, this, quick, legal);
+           nullptr, this, quick, legal);
     delete legal;
 }
 
@@ -1004,7 +1004,7 @@ void TransliteratorRoundTripTest::TestHangul() {
     if (quick) t.setPairLimit(1000);
     t.test(UnicodeString("[a-zA-Z]", ""), 
            UnicodeString("[\\uAC00-\\uD7A4]", ""), 
-           NULL, this, quick, legal, 1);
+           nullptr, this, quick, legal, 1);
     delete legal;
 }
 
@@ -1247,7 +1247,7 @@ void TransliteratorRoundTripTest::TestCyrillic() {
     Legal *legal = new Legal();
 
     test.test(UnicodeString("[a-zA-Z\\u0110\\u0111\\u02BA\\u02B9]", ""), 
-              UnicodeString("[[\\u0400-\\u045F] & [:Age=3.2:]]", ""), NULL, this, quick, 
+              UnicodeString("[[\\u0400-\\u045F] & [:Age=3.2:]]", ""), nullptr, this, quick, 
               legal);
 
     delete legal;
@@ -1332,7 +1332,7 @@ void TransliteratorRoundTripTest::TestDevanagariLatin() {
         UErrorCode status = U_ZERO_ERROR;
         UParseError parseError;
         TransliteratorPointer t1(Transliterator::createInstance("[\\u0964-\\u0965\\u0981-\\u0983\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC\\u09BE-\\u09C4\\u09C7-\\u09C8\\u09CB-\\u09CD\\u09D7\\u09DC-\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09FA];NFD;Bengali-InterIndic;InterIndic-Gujarati;NFC;",UTRANS_FORWARD, parseError, status));
-        if((Transliterator *)t1 != NULL){
+        if((Transliterator *)t1 != nullptr){
             TransliteratorPointer t2(t1->createInverse(status));
             if(U_FAILURE(status)){
                 errln("FAIL: could not create the Inverse:-( \n");
@@ -1590,13 +1590,13 @@ static const char * const interIndicArray[] = {
     "[\\u0BF0\\u0BF1\\u0BF2]" /*roundtrip exclusions*/,
 
     "Latin-Telugu",latinForIndic, "[:Telugu:]", 
-    NULL /*roundtrip exclusions*/,
+    nullptr /*roundtrip exclusions*/,
 
     "Latin-Kannada",latinForIndic, "[:Kannada:]", 
-    NULL /*roundtrip exclusions*/,
+    nullptr /*roundtrip exclusions*/,
 
     "Latin-Malayalam",latinForIndic, "[:Malayalam:]", 
-    NULL /*roundtrip exclusions*/  
+    nullptr /*roundtrip exclusions*/  
 };
 
 void TransliteratorRoundTripTest::TestDebug(const char* name,const char fromSet[],
index 26444c0d5bcb2aa1d3ef9f1f9fff5b33a4ea6300..9376bbad3490d9e608af731c99be142e13b8b654 100644 (file)
@@ -26,7 +26,7 @@
 class TransliteratorRoundTripTest : public IntlTest {
 
     void runIndexedTest(int32_t index, UBool exec, const char* &name,
-                        char* par=NULL) override;
+                        char* par=nullptr) override;
 
     void TestKana(void);
     void TestHiragana(void);
index 98c76e9201b08c76bd30845731aa00b6eb6bc28a..1c4d8b1f2c7f7939e8df09aec2a29cf2a335e380 100644 (file)
@@ -212,7 +212,7 @@ void TransliteratorTest::TestInstantiation() {
     UErrorCode ec = U_ZERO_ERROR;
     StringEnumeration* avail = Transliterator::getAvailableIDs(ec);
     assertSuccess("getAvailableIDs()", ec);
-    assertTrue("getAvailableIDs()!=NULL", avail!=NULL);
+    assertTrue("getAvailableIDs()!=nullptr", avail!=nullptr);
     int32_t n = Transliterator::countAvailableIDs();
     assertTrue("getAvailableIDs().count()==countAvailableIDs()",
                avail->count(ec) == n);
@@ -221,7 +221,7 @@ void TransliteratorTest::TestInstantiation() {
     for (int32_t i=0; i<n; ++i) {
         const UnicodeString& id = *avail->snext(ec);
         if (!assertSuccess("snext()", ec) ||
-            !assertTrue("snext()!=NULL", (&id)!=NULL, true)) {
+            !assertTrue("snext()!=nullptr", (&id)!=nullptr, true)) {
             break;
         }
         UnicodeString id2 = Transliterator::getAvailableID(i);
@@ -284,7 +284,7 @@ void TransliteratorTest::TestInstantiation() {
             delete t;
         }
     }
-    assertTrue("snext()==NULL", avail->snext(ec)==NULL);
+    assertTrue("snext()==nullptr", avail->snext(ec)==nullptr);
     assertSuccess("snext()", ec);
     delete avail;
 
@@ -700,7 +700,7 @@ void TransliteratorTest::TestFiltering(void) {
     
     // ICU4C ONLY. Do not find Transliterator.orphanFilter() in ICU4J.
     UnicodeFilter *f = hex->orphanFilter();
-    if (f == NULL){
+    if (f == nullptr){
         errln("FAIL: orphanFilter() should get a UnicodeFilter");
     } else {
         delete f;
@@ -770,8 +770,8 @@ void TransliteratorTest::TestJ277(void) {
     UErrorCode status = U_ZERO_ERROR;
     UParseError parseError;
     Transliterator *gl = Transliterator::createInstance("Greek-Latin; NFD; [:M:]Remove; NFC", UTRANS_FORWARD, parseError, status);
-    if (gl == NULL) {
-        dataerrln("FAIL: createInstance(Greek-Latin) returned NULL - %s", u_errorName(status));
+    if (gl == nullptr) {
+        dataerrln("FAIL: createInstance(Greek-Latin) returned nullptr - %s", u_errorName(status));
         return;
     }
 
@@ -812,7 +812,7 @@ void TransliteratorTest::TestJ277(void) {
     expect(*mini, syn, "syn");
     expect(*mini, sayn, "saun");
     delete mini;
-    mini = NULL;
+    mini = nullptr;
 
 #if !UCONFIG_NO_FORMATTING
     // Transliterate the Greek locale data
@@ -1158,7 +1158,7 @@ void TransliteratorTest::TestInterIndic(void) {
     UParseError parseError;
     Transliterator* dg = Transliterator::createInstance(ID, UTRANS_FORWARD, parseError, status);
     if (dg == 0) {
-        dataerrln("FAIL: createInstance(" + ID + ") returned NULL - " + u_errorName(status));
+        dataerrln("FAIL: createInstance(" + ID + ") returned nullptr - " + u_errorName(status));
         return;
     }
     UnicodeString id = dg->getID();
@@ -1204,7 +1204,7 @@ void TransliteratorTest::TestFilterIDs(void) {
         UErrorCode status = U_ZERO_ERROR;
         Transliterator *t = Transliterator::createInstance(ID, UTRANS_FORWARD, parseError, status);
         if (t == 0) {
-            errln("FAIL: createInstance(" + ID + ") returned NULL");
+            errln("FAIL: createInstance(" + ID + ") returned nullptr");
             return;
         }
         expect(*t, data2, data3);
@@ -1218,7 +1218,7 @@ void TransliteratorTest::TestFilterIDs(void) {
         // Check the inverse
         Transliterator *u = t->createInverse(status);
         if (u == 0) {
-            errln("FAIL: " + ID + ".createInverse() returned NULL");
+            errln("FAIL: " + ID + ".createInverse() returned nullptr");
         } else if (u->getID() != uID) {
             errln("FAIL: " + ID + ".createInverse().getID() => " +
                   u->getID() + ", expected " + uID);
@@ -1242,7 +1242,7 @@ void TransliteratorTest::TestCaseMap(void) {
     Transliterator* toTitle =
         Transliterator::createInstance("Any-Title[^xyzXYZ]", UTRANS_FORWARD, parseError, status);
     if (toUpper==0 || toLower==0 || toTitle==0) {
-        errln("FAIL: createInstance returned NULL");
+        errln("FAIL: createInstance returned nullptr");
         delete toUpper;
         delete toLower;
         delete toTitle;
@@ -1272,7 +1272,7 @@ void TransliteratorTest::TestNameMap(void) {
     Transliterator* name2uni =
         Transliterator::createInstance("Name-Any", UTRANS_FORWARD, parseError, status);
     if (uni2name==0 || name2uni==0) {
-        errln("FAIL: createInstance returned NULL");
+        errln("FAIL: createInstance returned nullptr");
         delete uni2name;
         delete name2uni;
         return;
@@ -1291,7 +1291,7 @@ void TransliteratorTest::TestNameMap(void) {
     Transliterator* t =
         Transliterator::createInstance("Any-Name;Name-Any", UTRANS_FORWARD, parseError, status);
     if (t==0) {
-        errln("FAIL: createInstance returned NULL");
+        errln("FAIL: createInstance returned nullptr");
         delete t;
         return;
     }
@@ -1306,16 +1306,16 @@ void TransliteratorTest::TestNameMap(void) {
  * Test liberalized ID syntax.  1006c
  */
 void TransliteratorTest::TestLiberalizedID(void) {
-    // Some test cases have an expected getID() value of NULL.  This
+    // Some test cases have an expected getID() value of nullptr.  This
     // means I have disabled the test case for now.  This stuff is
     // still under development, and I haven't decided whether to make
     // getID() return canonical case yet.  It will all get rewritten
     // with the move to Source-Target/Variant IDs anyway. [aliu]
     const char* DATA[] = {
-        "latin-greek", NULL /*"Latin-Greek"*/, "case insensitivity",
+        "latin-greek", nullptr /*"Latin-Greek"*/, "case insensitivity",
         "  Null  ", "Null", "whitespace",
         " Latin[a-z]-Greek  ", "[a-z]Latin-Greek", "inline filter",
-        "  null  ; latin-greek  ", NULL /*"Null;Latin-Greek"*/, "compound whitespace",
+        "  null  ; latin-greek  ", nullptr /*"Null;Latin-Greek"*/, "compound whitespace",
     };
     const int32_t DATA_length = UPRV_LENGTHOF(DATA);
     UParseError parseError;
@@ -1331,7 +1331,7 @@ void TransliteratorTest::TestLiberalizedID(void) {
                 exp = UnicodeString(DATA[i+1], "");
             }
             // Don't worry about getID() if the expected char*
-            // is NULL -- see above.
+            // is nullptr -- see above.
             if (exp.length() == 0 || exp == t->getID()) {
                 logln(UnicodeString("Ok: ") + DATA[i+2] +
                       " create ID \"" + DATA[i] + "\" => \"" +
@@ -1364,7 +1364,7 @@ void TransliteratorTest::TestCreateInstance(){
         "InvalidSource-InvalidTarget;Hex-Any", FORWARD, "",
         "InvalidSource-InvalidTarget;Hex-Any", REVERSE, "",
 
-        NULL
+        nullptr
     };
 
     for (int32_t i=0; DATA[i]; i+=3) {
@@ -2090,7 +2090,7 @@ void TransliteratorTest::TestSTV(void) {
     // Test registration
     const char* IDS[] = { "Fieruwer", "Seoridf-Sweorie", "Oewoir-Oweri/Vsie" };
     const char* FULL_IDS[] = { "Any-Fieruwer", "Seoridf-Sweorie", "Oewoir-Oweri/Vsie" };
-    const char* SOURCES[] = { NULL, "Seoridf", "Oewoir" };
+    const char* SOURCES[] = { nullptr, "Seoridf", "Oewoir" };
     for (i=0; i<3; ++i) {
         Transliterator *t = new TestTrans(IDS[i]);
         if (t == 0) {
@@ -2105,7 +2105,7 @@ void TransliteratorTest::TestSTV(void) {
         Transliterator::registerInstance(t);
         UErrorCode status = U_ZERO_ERROR;
         t = Transliterator::createInstance(IDS[i], UTRANS_FORWARD, status);
-        if (t == NULL) {
+        if (t == nullptr) {
             errln((UnicodeString)"FAIL: Registration/creation failed for ID " +
                   IDS[i]);
         } else {
@@ -2115,7 +2115,7 @@ void TransliteratorTest::TestSTV(void) {
         }
         Transliterator::unregister(IDS[i]);
         t = Transliterator::createInstance(IDS[i], UTRANS_FORWARD, status);
-        if (t != NULL) {
+        if (t != nullptr) {
             errln((UnicodeString)"FAIL: Unregistration failed for ID " +
                   IDS[i]);
             delete t;
@@ -2145,7 +2145,7 @@ void TransliteratorTest::TestSTV(void) {
         UnicodeString s;
         Transliterator::getAvailableSource(i, s);
         for (j=0; j<3; ++j) {
-            if (SOURCES[j] == NULL) continue;
+            if (SOURCES[j] == nullptr) continue;
             if (s.caseCompare(SOURCES[j],0)==0) {
                 errln((UnicodeString)"FAIL: unregister(" + s + "-*) failed");
             }
@@ -2185,7 +2185,7 @@ void TransliteratorTest::TestNFDChainRBT() {
     Transliterator* t = Transliterator::createFromRules(
                                "TEST", "::NFD; aa > Q; a > q;",
                                UTRANS_FORWARD, pe, ec);
-    if (t == NULL || U_FAILURE(ec)) {
+    if (t == nullptr || U_FAILURE(ec)) {
         dataerrln("FAIL: Transliterator::createFromRules failed with %s", u_errorName(ec));
         return;
     }
@@ -2399,26 +2399,26 @@ void TransliteratorTest::TestCompoundFilterID(void) {
         // Col. 3 = source string
         // Col. 4 = exp result
 
-        "[abc]; [abc]", NULL, NULL, NULL, // multiple filters
-        "Latin-Greek; [abc];", NULL, NULL, NULL, // misplaced filter
+        "[abc]; [abc]", nullptr, nullptr, nullptr, // multiple filters
+        "Latin-Greek; [abc];", nullptr, nullptr, nullptr, // misplaced filter
         "[b]; Latin-Greek; Upper; ([xyz])", "F", "abc", "a\\u0392c",
         "[b]; (Lower); Latin-Greek; Upper(); ([\\u0392])", "R", "\\u0391\\u0392\\u0393", "\\u0391b\\u0393",
         "#\n::[b]; ::Latin-Greek; ::Upper; ::([xyz]);", "F", "abc", "a\\u0392c",
         "#\n::[b]; ::(Lower); ::Latin-Greek; ::Upper(); ::([\\u0392]);", "R", "\\u0391\\u0392\\u0393", "\\u0391b\\u0393",
-        NULL,
+        nullptr,
     };
 
     for (int32_t i=0; DATA[i]; i+=4) {
         UnicodeString id = CharsToUnicodeString(DATA[i]);
-        UTransDirection direction = (DATA[i+1] != NULL && DATA[i+1][0] == 'R') ?
+        UTransDirection direction = (DATA[i+1] != nullptr && DATA[i+1][0] == 'R') ?
             UTRANS_REVERSE : UTRANS_FORWARD;
         UnicodeString source;
         UnicodeString exp;
-        if (DATA[i+2] != NULL) {
+        if (DATA[i+2] != nullptr) {
             source = CharsToUnicodeString(DATA[i+2]);
             exp = CharsToUnicodeString(DATA[i+3]);
         }
-        UBool expOk = (DATA[i+1] != NULL);
+        UBool expOk = (DATA[i+1] != nullptr);
         LocalPointer<Transliterator> t;
         UParseError pe;
         UErrorCode ec = U_ZERO_ERROR;
@@ -2433,7 +2433,7 @@ void TransliteratorTest::TestCompoundFilterID(void) {
             transID = t->getID();
         }
         else {
-            transID = UnicodeString("NULL", "");
+            transID = UnicodeString("nullptr", "");
         }
         if (ok == expOk) {
             logln((UnicodeString)"Ok: " + id + " => " + transID + ", " +
@@ -3134,24 +3134,24 @@ void TransliteratorTest::TestInvalidPostContext() {
  */
 void TransliteratorTest::TestIDForms() {
     const char* DATA[] = {
-        "NFC", NULL, "NFD",
-        "nfd", NULL, "NFC", // make sure case is ignored
-        "Any-NFKD", NULL, "Any-NFKC",
-        "Null", NULL, "Null",
+        "NFC", nullptr, "NFD",
+        "nfd", nullptr, "NFC", // make sure case is ignored
+        "Any-NFKD", nullptr, "Any-NFKC",
+        "Null", nullptr, "Null",
         "-nfkc", "nfkc", "NFKD",
         "-nfkc/", "nfkc", "NFKD",
-        "Latin-Greek/UNGEGN", NULL, "Greek-Latin/UNGEGN",
+        "Latin-Greek/UNGEGN", nullptr, "Greek-Latin/UNGEGN",
         "Greek/UNGEGN-Latin", "Greek-Latin/UNGEGN", "Latin-Greek/UNGEGN",
         "Bengali-Devanagari/", "Bengali-Devanagari", "Devanagari-Bengali",
-        "Source-", NULL, NULL,
-        "Source/Variant-", NULL, NULL,
-        "Source-/Variant", NULL, NULL,
-        "/Variant", NULL, NULL,
-        "/Variant-", NULL, NULL,
-        "-/Variant", NULL, NULL,
-        "-/", NULL, NULL,
-        "-", NULL, NULL,
-        "/", NULL, NULL,
+        "Source-", nullptr, nullptr,
+        "Source/Variant-", nullptr, nullptr,
+        "Source-/Variant", nullptr, nullptr,
+        "/Variant", nullptr, nullptr,
+        "/Variant-", nullptr, nullptr,
+        "-/Variant", nullptr, nullptr,
+        "-/", nullptr, nullptr,
+        "-", nullptr, nullptr,
+        "/", nullptr, nullptr,
     };
     const int32_t DATA_length = UPRV_LENGTHOF(DATA);
     
@@ -3159,8 +3159,8 @@ void TransliteratorTest::TestIDForms() {
         const char* ID = DATA[i];
         const char* expID = DATA[i+1];
         const char* expInvID = DATA[i+2];
-        UBool expValid = (expInvID != NULL);
-        if (expID == NULL) {
+        UBool expValid = (expInvID != nullptr);
+        if (expID == nullptr) {
             expID = ID;
         }
         UParseError pe;
@@ -3552,13 +3552,13 @@ void TransliteratorTest::TestSurrogateCasing (void) {
     UnicodeString DEEDEETest = DESERET_DEE + DESERET_DEE;
     UErrorCode status= U_ZERO_ERROR;
 
-    u_strToUpper(buffer2, 20, deeDEETest.getBuffer(), deeDEETest.length(), NULL, &status);
+    u_strToUpper(buffer2, 20, deeDEETest.getBuffer(), deeDEETest.length(), nullptr, &status);
     if (U_FAILURE(status) || (UnicodeString(buffer2)!= DEEDEETest)) {
         errln("Fails: Can't uppercase surrogates.");
     }
         
     status= U_ZERO_ERROR;
-    u_strToLower(buffer2, 20, deeDEETest.getBuffer(), deeDEETest.length(), NULL, &status);
+    u_strToLower(buffer2, 20, deeDEETest.getBuffer(), deeDEETest.length(), nullptr, &status);
     if (U_FAILURE(status) || (UnicodeString(buffer2)!= deedeeTest)) {
         errln("Fails: Can't lowercase surrogates.");
     }
@@ -3746,7 +3746,7 @@ void TransliteratorTest::TestFunction() {
     UParseError pe;
     UErrorCode ec = U_ZERO_ERROR;
     Transliterator *t = Transliterator::createFromRules("Test", rule, UTRANS_FORWARD, pe, ec);
-    if (t == NULL) {
+    if (t == nullptr) {
         dataerrln("FAIL: createFromRules failed - %s", u_errorName(ec));
         return;
     }
@@ -3774,13 +3774,13 @@ void TransliteratorTest::TestInvalidBackRef(void) {
     Transliterator *t = Transliterator::createFromRules("Test", rule, UTRANS_FORWARD, pe, ec);
     Transliterator *t2 = Transliterator::createFromRules("Test2", rule2, UTRANS_FORWARD, pe, ec);
 
-    if (t != NULL) {
-        errln("FAIL: createFromRules should have returned NULL");
+    if (t != nullptr) {
+        errln("FAIL: createFromRules should have returned nullptr");
         delete t;
     }
 
-    if (t2 != NULL) {
-        errln("FAIL: createFromRules should have returned NULL");
+    if (t2 != nullptr) {
+        errln("FAIL: createFromRules should have returned nullptr");
         delete t2;
     }
 
@@ -3803,7 +3803,7 @@ void TransliteratorTest::TestMulticharStringSet() {
     UParseError pe;
     UErrorCode ec = U_ZERO_ERROR;
     Transliterator* t = Transliterator::createFromRules("Test", rule, UTRANS_FORWARD, pe, ec);
-    if (t == NULL || U_FAILURE(ec)) {
+    if (t == nullptr || U_FAILURE(ec)) {
         delete t;
         errln("FAIL: createFromRules failed");
         return;
@@ -3822,7 +3822,7 @@ void TransliteratorTest::TestMulticharStringSet() {
         " q [t {st} {rst}] { e > p;" ;
         
     t = Transliterator::createFromRules("Test", rule, UTRANS_FORWARD, pe, ec);
-    if (t == NULL || U_FAILURE(ec)) {
+    if (t == nullptr || U_FAILURE(ec)) {
         delete t;
         errln("FAIL: createFromRules failed");
         return;
@@ -3851,7 +3851,7 @@ static void _TUFReg(const UnicodeString& ID, Transliterator* t, int32_t n) {
 }
 
 static void _TUFUnreg(int32_t n) {
-    if (_TUFF[n] != NULL) {
+    if (_TUFF[n] != nullptr) {
         Transliterator::unregister(*_TUFID[n]);
         delete _TUFF[n];
         delete _TUFID[n];
@@ -3874,14 +3874,14 @@ void TransliteratorTest::TestUserFunction() {
     // Setup our factory
     int32_t i;
     for (i=0; i<4; ++i) {
-        _TUFF[i] = NULL;
+        _TUFF[i] = nullptr;
     }
 
     // There's no need to register inverses if we don't use them
     t = Transliterator::createFromRules("gif",
                                         UNICODE_STRING_SIMPLE("'\\'u(..)(..) > '<img src=\"http://www.unicode.org/gifs/24/' $1 '/U' $1$2 '.gif\">';"),
                                         UTRANS_FORWARD, pe, ec);
-    if (t == NULL || U_FAILURE(ec)) {
+    if (t == nullptr || U_FAILURE(ec)) {
         dataerrln((UnicodeString)"FAIL: createFromRules gif " + u_errorName(ec));
         return;
     }
@@ -3890,7 +3890,7 @@ void TransliteratorTest::TestUserFunction() {
     t = Transliterator::createFromRules("RemoveCurly",
                                         UNICODE_STRING_SIMPLE("[\\{\\}] > ; '\\N' > ;"),
                                         UTRANS_FORWARD, pe, ec);
-    if (t == NULL || U_FAILURE(ec)) {
+    if (t == nullptr || U_FAILURE(ec)) {
         errln((UnicodeString)"FAIL: createFromRules RemoveCurly " + u_errorName(ec));
         goto FAIL;
     }
@@ -3901,14 +3901,14 @@ void TransliteratorTest::TestUserFunction() {
     t = Transliterator::createFromRules("hex2",
                                         "(.) > &hex($1);",
                                         UTRANS_FORWARD, pe, ec);
-    if (t == NULL || U_FAILURE(ec)) {
+    if (t == nullptr || U_FAILURE(ec)) {
         errln("FAIL: createFromRules");
         goto FAIL;
     }
     logln("Registering");
     _TUFReg("Any-hex2", t, 2);
     t = Transliterator::createInstance("Any-hex2", UTRANS_FORWARD, ec);
-    if (t == NULL || U_FAILURE(ec)) {
+    if (t == nullptr || U_FAILURE(ec)) {
         errln((UnicodeString)"FAIL: createInstance Any-hex2 " + u_errorName(ec));
         goto FAIL;
     }
@@ -3919,14 +3919,14 @@ void TransliteratorTest::TestUserFunction() {
     t = Transliterator::createFromRules("gif2",
                                         "(.) > &Gif(&Hex2($1));",
                                         UTRANS_FORWARD, pe, ec);
-    if (t == NULL || U_FAILURE(ec)) {
+    if (t == nullptr || U_FAILURE(ec)) {
         errln((UnicodeString)"FAIL: createFromRules gif2 " + u_errorName(ec));
         goto FAIL;
     }
     logln("Registering");
     _TUFReg("Any-gif2", t, 3);
     t = Transliterator::createInstance("Any-gif2", UTRANS_FORWARD, ec);
-    if (t == NULL || U_FAILURE(ec)) {
+    if (t == nullptr || U_FAILURE(ec)) {
         errln((UnicodeString)"FAIL: createInstance Any-gif2 " + u_errorName(ec));
         goto FAIL;
     }
@@ -3938,7 +3938,7 @@ void TransliteratorTest::TestUserFunction() {
     t = Transliterator::createFromRules("test",
                                         "(.) > &Hex($1) ' ' &RemoveCurly(&Name($1)) ' ';",
                                         UTRANS_FORWARD, pe, ec);
-    if (t == NULL || U_FAILURE(ec)) {
+    if (t == nullptr || U_FAILURE(ec)) {
         errln((UnicodeString)"FAIL: createFromRules test " + u_errorName(ec));
         goto FAIL;
     }
@@ -3961,7 +3961,7 @@ void TransliteratorTest::TestAnyX(void) {
     Transliterator* anyLatin =
         Transliterator::createInstance("Any-Latin", UTRANS_FORWARD, parseError, status);
     if (anyLatin==0) {
-        dataerrln("FAIL: createInstance returned NULL - %s", u_errorName(status));
+        dataerrln("FAIL: createInstance returned nullptr - %s", u_errorName(status));
         delete anyLatin;
         return;
     }
@@ -3990,7 +3990,7 @@ void TransliteratorTest::TestAny(void) {
     UnicodeString testString;
     for (int32_t i = 0; i < USCRIPT_CODE_LIMIT; i++) {
         const char *scriptName = uscript_getShortName((UScriptCode)i);
-        if (scriptName == NULL) {
+        if (scriptName == nullptr) {
             errln("Failure: file %s, line %d: Script Code %d is invalid, ", __FILE__, __LINE__, i);
             return;
         }
@@ -4125,7 +4125,7 @@ void TransliteratorTest::TestAllCodepoints(){
         }
         const char* myId = uscript_getName(code);
         if(!myId) {
-          dataerrln("Valid script code returned NULL name. Check your data!");
+          dataerrln("Valid script code returned nullptr name. Check your data!");
           return;
         }
         uprv_strcpy(id,myId);
@@ -4141,14 +4141,14 @@ void TransliteratorTest::TestAllCodepoints(){
 
         if(uprv_strcmp(newId,oldId)!=0){
             Transliterator* t = Transliterator::createInstance(newId,UTRANS_FORWARD,pe,status);
-            if(t==NULL || U_FAILURE(status)){
+            if(t==nullptr || U_FAILURE(status)){
                 dataerrln((UnicodeString)"FAIL: Could not create " + id + " - " + u_errorName(status));
             }
             delete t;
         }
         if(uprv_strcmp(newAbbrId,oldAbbrId)!=0){
             Transliterator* t = Transliterator::createInstance(newAbbrId,UTRANS_FORWARD,pe,status);
-            if(t==NULL || U_FAILURE(status)){
+            if(t==nullptr || U_FAILURE(status)){
                 dataerrln((UnicodeString)"FAIL: Could not create " + id + " - " + u_errorName(status));
             }
             delete t;
index 2f35e4b0cdaffae91c241a6768aa5d47c0db33e3..df7934ab54b27bac44cb9b5a3d0b3e2c9e9fce1f 100644 (file)
@@ -31,7 +31,7 @@ public:
 
 private:
     void runIndexedTest(int32_t index, UBool exec, const char* &name,
-                        char* par=NULL) override;
+                        char* par=nullptr) override;
 
     void TestInstantiation(void);
     
index 594f8510f403ac10590a9b40ead5a8633f4d95a3..9b6857aee513b293c481458f1184357712492127 100644 (file)
@@ -29,7 +29,7 @@ public:
 
     CollationTurkishTest();
     virtual ~CollationTurkishTest();
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     // perform tests for turkish locale with strength PRIMARY
     void TestPrimary(/* char* par */);
index 50cd8662dddf2795eda2bcc7c20990464c2a8575..d3bf770b0eb3c726673e85d36d2856a5f063ae8b 100644 (file)
@@ -153,7 +153,7 @@ void TransliteratorErrorTest::TestTransliteratorErrors() {
     }
     status = U_ZERO_ERROR;
     Transliterator* t4 = Transliterator::createFromRules(newID, bogusRules, UTRANS_FORWARD, parseError, status);
-    if (t4 != NULL || U_SUCCESS(status)) {
+    if (t4 != nullptr || U_SUCCESS(status)) {
         errln("FAIL: The rules is malformed but error was not reported.");
         if (parseError.offset != -1) {
             errln("FAIL: The parse error offset isn't set correctly when fails.");
@@ -189,14 +189,14 @@ void TransliteratorErrorTest::TestUnicodeSetErrors() {
 
 //void TransliteratorErrorTest::TestUniToHexErrors() {
 //    UErrorCode status = U_ZERO_ERROR;
-//    Transliterator *t = new UnicodeToHexTransliterator("", true, NULL, status);
+//    Transliterator *t = new UnicodeToHexTransliterator("", true, nullptr, status);
 //    if (U_SUCCESS(status)) {
 //        errln("FAIL: Created a UnicodeToHexTransliterator with an empty pattern.");
 //    }
 //    delete t;
 //
 //    status = U_ZERO_ERROR;
-//    t = new UnicodeToHexTransliterator("\\x", true, NULL, status);
+//    t = new UnicodeToHexTransliterator("\\x", true, nullptr, status);
 //    if (U_SUCCESS(status)) {
 //        errln("FAIL: Created a UnicodeToHexTransliterator with a bad pattern.");
 //    }
@@ -241,13 +241,13 @@ void TransliteratorErrorTest::TestRBTErrors() {
 
 //void TransliteratorErrorTest::TestHexToUniErrors() {
 //    UErrorCode status = U_ZERO_ERROR;
-//    Transliterator *t = new HexToUnicodeTransliterator("", NULL, status);
+//    Transliterator *t = new HexToUnicodeTransliterator("", nullptr, status);
 //    if (U_FAILURE(status)) {
 //        errln("FAIL: Could not create a HexToUnicodeTransliterator with an empty pattern.");
 //    }
 //    delete t;
 //    status = U_ZERO_ERROR;
-//    t = new HexToUnicodeTransliterator("\\x", NULL, status);
+//    t = new HexToUnicodeTransliterator("\\x", nullptr, status);
 //    if (U_SUCCESS(status)) {
 //        errln("FAIL: Created a HexToUnicodeTransliterator with a bad pattern.");
 //    }
@@ -277,8 +277,8 @@ public:
 void TransliteratorErrorTest::TestCoverage() {
     StubTransliterator stub;
 
-    if (stub.clone() != NULL){
-        errln("FAIL: default Transliterator::clone() should return NULL");
+    if (stub.clone() != nullptr){
+        errln("FAIL: default Transliterator::clone() should return nullptr");
     }
 }
 
index eade7503bcc564140ad4890e6a893e3cd04d006a..a3113c2f9d4ef4eb8a741e2c3372a8abbaed527f 100644 (file)
@@ -32,7 +32,7 @@
  */
 class TransliteratorErrorTest : public IntlTest {
 public:
-    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=nullptr) override;
 
     /*Tests the returned error codes on all the APIs according to the API documentation. */
     void TestTransliteratorErrors(void);
index fe883194c72b6a0783c6674cf47d4b955aaf6e2a..85b67de586212d5d90f6d713cedd206e4aca07c3 100644 (file)
@@ -23,7 +23,7 @@
 
 
 class IntlTestCollator: public IntlTest {
-    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 protected:
     struct Order
     {
index 350d1cd93459d9a2fada4fde85487edb890cf930..cb149d2f1039953b44b9f0d1f7726f4fd9dd96ab 100644 (file)
@@ -21,7 +21,7 @@
  *  Performs some tests in many variations on DateFormat
  **/
 class IntlTestDateFormat: public IntlTest {
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
     
 private:
 
index 79eccfc0f36e676669265194381270eafd209a5f..71753baf7b5dd612a95bcad1d09cce6a14056098 100644 (file)
@@ -20,7 +20,7 @@
  * Tests for DecimalFormatSymbols
  **/
 class IntlTestDecimalFormatSymbols: public IntlTest {
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
 private:
     /**
index 2be4e33ec0bd6135439f44ac31d7e634a3fa1da1..f37df0d3f03e119d4a9d1c6f68b73b68248d04e3 100644 (file)
@@ -19,7 +19,7 @@
  * Tests for DateFormatSymbols
  **/
 class IntlTestDateFormatSymbols: public IntlTest {
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
 private:
     /**
index 7cff70051b96c2885b6c542229c6deee92938936..ba202930bf8a2529526d699635737c7a76c043a2 100644 (file)
@@ -337,7 +337,7 @@ class ThreadSafeFormatSharedData {
     UnicodeString  fBBDStr;
 };
 
-const ThreadSafeFormatSharedData *gSharedData = NULL;
+const ThreadSafeFormatSharedData *gSharedData = nullptr;
 
 ThreadSafeFormatSharedData::ThreadSafeFormatSharedData(UErrorCode &status) {
     fFormat.adoptInstead(NumberFormat::createCurrencyInstance(Locale::getUS(), status));
@@ -348,13 +348,13 @@ ThreadSafeFormatSharedData::ThreadSafeFormatSharedData(UErrorCode &status) {
     if (U_FAILURE(status)) {
         return;
     }
-    fFormat->format(fYDDThing, fYDDStr, NULL, status);
-    fFormat->format(fBBDThing, fBBDStr, NULL, status);
+    fFormat->format(fYDDThing, fYDDStr, nullptr, status);
+    fFormat->format(fBBDThing, fBBDStr, nullptr, status);
     gSharedData = this;
 }
 
 ThreadSafeFormatSharedData::~ThreadSafeFormatSharedData() {
-    gSharedData = NULL;
+    gSharedData = nullptr;
 }
 
 /**
@@ -401,16 +401,16 @@ UBool ThreadSafeFormat::doStuff(int32_t offset, UnicodeString &appendErr, UError
     okay = false;
   }
   UnicodeString str;
-  const UnicodeString *o=NULL;
+  const UnicodeString *o=nullptr;
   Formattable f;
-  const NumberFormat *nf = NULL; // only operate on it as const.
+  const NumberFormat *nf = nullptr; // only operate on it as const.
   switch(offset%4) {
   case 0:  f = gSharedData->fYDDThing;  o = &gSharedData->fYDDStr;  nf = gSharedData->fFormat.getAlias();  break;
   case 1:  f = gSharedData->fBBDThing;  o = &gSharedData->fBBDStr;  nf = gSharedData->fFormat.getAlias();  break;
   case 2:  f = gSharedData->fYDDThing;  o = &gSharedData->fYDDStr;  nf = fFormat.getAlias();  break;
   case 3:  f = gSharedData->fBBDThing;  o = &gSharedData->fBBDStr;  nf = fFormat.getAlias();  break;
   }
-  nf->format(f, str, NULL, status);
+  nf->format(f, str, nullptr, status);
 
   if(*o != str) {
     appendErr.append(showDifference(*o, str));
@@ -423,7 +423,7 @@ UBool U_CALLCONV isAcceptable(void *, const char *, const char *, const UDataInf
     return true;
 }
 
-//static UMTX debugMutex = NULL;
+//static UMTX debugMutex = nullptr;
 //static UMTX gDebugMutex;
 
 
@@ -439,7 +439,7 @@ public:
         : SimpleThread(),
         fNum(0),
         fTraceInfo(0),
-        fTSF(NULL),
+        fTSF(nullptr),
         fOffset(0)
         // the locale to use
     {
@@ -478,8 +478,8 @@ public:
         int m;
         for (m=0; m<4000; m++) {
             status         = U_ZERO_ERROR;
-            UResourceBundle *res   = NULL;
-            const char *localeName = NULL;
+            UResourceBundle *res   = nullptr;
+            const char *localeName = nullptr;
 
             Locale  loc = Locale::getEnglish();
 
@@ -488,7 +488,7 @@ public:
 
             // ResourceBundle bund = ResourceBundle(0, loc, status);
             //umtx_lock(&gDebugMutex);
-            res = ures_open(NULL, localeName, &status);
+            res = ures_open(nullptr, localeName, &status);
             //umtx_unlock(&gDebugMutex);
 
             //umtx_lock(&gDebugMutex);
@@ -726,8 +726,8 @@ private:
     UBool isAtLeastUCA62;
 public:
     CollatorThreadTest()  : SimpleThread(),
-        coll(NULL),
-        lines(NULL),
+        coll(nullptr),
+        lines(nullptr),
         noLines(0),
         isAtLeastUCA62(true)
     {
@@ -741,7 +741,7 @@ public:
     }
     virtual void run() override {
         uint8_t sk1[1024], sk2[1024];
-        uint8_t *oldSk = NULL, *newSk = sk1;
+        uint8_t *oldSk = nullptr, *newSk = sk1;
         int32_t oldLen = 0;
         int32_t prev = 0;
         int32_t i = 0;
@@ -751,7 +751,7 @@ public:
 
             int32_t resLen = coll->getSortKey(lines[i].buff, lines[i].buflen, newSk, 1024);
 
-            if(oldSk != NULL) {
+            if(oldSk != nullptr) {
                 int32_t skres = strcmp((char *)oldSk, (char *)newSk);
                 int32_t cmpres = coll->compare(lines[prev].buff, lines[prev].buflen, lines[i].buff, lines[i].buflen);
                 int32_t cmpres2 = coll->compare(lines[i].buff, lines[i].buflen, lines[prev].buff, lines[prev].buflen);
@@ -795,7 +795,7 @@ void MultithreadTest::TestCollators()
 {
 
     UErrorCode status = U_ZERO_ERROR;
-    FILE *testFile = NULL;
+    FILE *testFile = nullptr;
     char testDataPath[1024];
     strcpy(testDataPath, IntlTest::getSourceTestData(status));
     if (U_FAILURE(status)) {
@@ -856,7 +856,7 @@ void MultithreadTest::TestCollators()
     UChar bufferU[1024];
     uint32_t first = 0;
 
-    while (fgets(buffer, 1024, testFile) != NULL) {
+    while (fgets(buffer, 1024, testFile) != nullptr) {
         if(*buffer == 0 || buffer[0] == '#') {
             // Store empty and comment lines so that errors are reported
             // for the real test file lines.
@@ -970,7 +970,7 @@ public:
 
 };
 
-const UnicodeString *StringThreadTest2::gSharedString = NULL;
+const UnicodeString *StringThreadTest2::gSharedString = nullptr;
 
 // ** The actual test function.
 
@@ -998,7 +998,7 @@ void MultithreadTest::TestString()
     }
 
     delete StringThreadTest2::gSharedString;
-    StringThreadTest2::gSharedString = NULL;
+    StringThreadTest2::gSharedString = nullptr;
 }
 
 
@@ -1010,7 +1010,7 @@ void MultithreadTest::TestString()
 //
 
 #if !UCONFIG_NO_TRANSLITERATION
-Transliterator *gSharedTranslit = NULL;
+Transliterator *gSharedTranslit = nullptr;
 class TxThread: public SimpleThread {
   public:
     TxThread() {}
@@ -1043,7 +1043,7 @@ void MultithreadTest::TestAnyTranslit() {
     for (i=0; i<UPRV_LENGTHOF(threads); i++) {
         threads[i].join();
     }
-    gSharedTranslit = NULL;
+    gSharedTranslit = nullptr;
 #endif  // !UCONFIG_NO_TRANSLITERATION
 }
 
@@ -1072,7 +1072,7 @@ static const int32_t CACHE_LOAD = 3;
 class UCTMultiThreadItem : public SharedObject {
   public:
     char *value;
-    UCTMultiThreadItem(const char *x) : value(NULL) {
+    UCTMultiThreadItem(const char *x) : value(nullptr) {
         value = uprv_strdup(x);
     }
     virtual ~UCTMultiThreadItem() {
@@ -1091,8 +1091,8 @@ const UCTMultiThreadItem *LocaleCacheKey<UCTMultiThreadItem>::createObject(
     const UnifiedCache *cacheContext = (const UnifiedCache *) context;
 
     if (uprv_strcmp(fLoc.getLanguage(), fLoc.getName()) != 0) {
-        const UCTMultiThreadItem *result = NULL;
-        if (cacheContext == NULL) {
+        const UCTMultiThreadItem *result = nullptr;
+        if (cacheContext == nullptr) {
             UnifiedCache::getByLocale(fLoc.getLanguage(), result, status);
             return result;
         }
@@ -1120,7 +1120,7 @@ const UCTMultiThreadItem *LocaleCacheKey<UCTMultiThreadItem>::createObject(
 
     const UCTMultiThreadItem *result =
         new UCTMultiThreadItem(fLoc.getLanguage());
-    if (result == NULL) {
+    if (result == nullptr) {
         status = U_MEMORY_ALLOCATION_ERROR;
     } else {
         result->addRef();
@@ -1157,7 +1157,7 @@ class UnifiedCacheThread: public SimpleThread {
 
 void UnifiedCacheThread::exerciseByLocale(const Locale &locale) {
     UErrorCode status = U_ZERO_ERROR;
-    const UCTMultiThreadItem *origItem = NULL;
+    const UCTMultiThreadItem *origItem = nullptr;
     fCache->get(
             LocaleCacheKey<UCTMultiThreadItem>(locale), fCache, origItem, status);
     U_ASSERT(U_SUCCESS(status));
@@ -1166,11 +1166,11 @@ void UnifiedCacheThread::exerciseByLocale(const Locale &locale) {
     // Fetch the same item again many times. We should always get the same
     // pointer since this client is already holding onto it
     for (int32_t i = 0; i < 1000; ++i) {
-        const UCTMultiThreadItem *item = NULL;
+        const UCTMultiThreadItem *item = nullptr;
         fCache->get(
                 LocaleCacheKey<UCTMultiThreadItem>(locale), fCache, item, status);
         IntlTest::gTest->assertTrue(WHERE, item == origItem);
-        if (item != NULL) {
+        if (item != nullptr) {
             item->removeRef();
         }
     }
@@ -1299,8 +1299,8 @@ void MultithreadTest::TestBreakTranslit() {
     }
 
     delete gSharedTransliterator;
-    gTranslitInput = NULL;
-    gTranslitExpected = NULL;
+    gTranslitInput = nullptr;
+    gTranslitExpected = nullptr;
 }
 
 
index 7ac502a0389fdc4724c1129a6e9e74c6268b0fe1..7b8a986fd8237b9d9a46a35fe0d3ff3c2a604ef7 100644 (file)
@@ -24,7 +24,7 @@ public:
     MultithreadTest();
     virtual ~MultithreadTest();
     
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     /**
      * test that threads even work
index 6b567b4a08d9c9f9a558d4ae317105ed53b50350..f545cfdb6a0801f19e8179d1793e204a902a75fc 100644 (file)
@@ -24,7 +24,7 @@
  * NumberFormat.
  */
 class IntlTestNumberFormat: public IntlTest {
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
 private:
 
index a35ccd289200a816c1a790efbedf4d30fe9e3096..e295355b82ba8f72a78991d81671ba9f571831b8 100644 (file)
@@ -25,7 +25,7 @@ public:
     BasicNormalizerTest();
     virtual ~BasicNormalizerTest();
 
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     void TestHangulCompose(void);
     void TestHangulDecomp(void);
index bce8ff4ab9fb426b35241b562542d1022123bcc1..0e5636375b83ac13c9968641da9a545a333aba68 100644 (file)
@@ -300,7 +300,7 @@ TimeZoneBoundaryTest::TestBoundaries()
     TimeZone* save = TimeZone::createDefault();
     TimeZone::setDefault(*pst);
    
-    if (tempcal != NULL) { 
+    if (tempcal != nullptr) { 
         // DST changeover for PST is 4/6/1997 at 2 hours past midnight
         // at 238978.0 epoch hours.
         tempcal->clear();
index 2fd11b1562e1d82f822307db75b5e12d1b5a5af7..9d161196f54b94966a24b3556b28433780bdbcb8 100644 (file)
@@ -365,18 +365,18 @@ static UBool isSpecialTimeRoundTripCase(const char* loc,
         const char* pattern;
         UDate time;
     } EXCLUSIONS[] = {
-        {NULL, "Asia/Chita", "zzzz", 1414252800000.0},
-        {NULL, "Asia/Chita", "vvvv", 1414252800000.0},
-        {NULL, "Asia/Srednekolymsk", "zzzz", 1414241999999.0},
-        {NULL, "Asia/Srednekolymsk", "vvvv", 1414241999999.0},
-        {NULL, NULL, NULL, U_DATE_MIN}
+        {nullptr, "Asia/Chita", "zzzz", 1414252800000.0},
+        {nullptr, "Asia/Chita", "vvvv", 1414252800000.0},
+        {nullptr, "Asia/Srednekolymsk", "zzzz", 1414241999999.0},
+        {nullptr, "Asia/Srednekolymsk", "vvvv", 1414241999999.0},
+        {nullptr, nullptr, nullptr, U_DATE_MIN}
     };
 
     UBool isExcluded = false;
-    for (int32_t i = 0; EXCLUSIONS[i].id != NULL; i++) {
-        if (EXCLUSIONS[i].loc == NULL || uprv_strcmp(loc, EXCLUSIONS[i].loc) == 0) {
+    for (int32_t i = 0; EXCLUSIONS[i].id != nullptr; i++) {
+        if (EXCLUSIONS[i].loc == nullptr || uprv_strcmp(loc, EXCLUSIONS[i].loc) == 0) {
             if (id.compare(EXCLUSIONS[i].id) == 0) {
-                if (EXCLUSIONS[i].pattern == NULL || uprv_strcmp(pattern, EXCLUSIONS[i].pattern) == 0) {
+                if (EXCLUSIONS[i].pattern == nullptr || uprv_strcmp(pattern, EXCLUSIONS[i].pattern) == 0) {
                     if (EXCLUSIONS[i].time == U_DATE_MIN || EXCLUSIONS[i].time == time) {
                         isExcluded = true;
                     }
@@ -410,7 +410,7 @@ struct LocaleData {
     UDate END_TIME;
     int32_t numDone;
 
-    LocaleData() : localeIndex(0), patternIndex(0), testCounts(0), locales(NULL),
+    LocaleData() : localeIndex(0), patternIndex(0), testCounts(0), locales(nullptr),
                    nLocales(0), START_TIME(0), END_TIME(0), numDone(0) {
         for (int i=0; i<UPRV_LENGTHOF(times); i++) {
             times[i] = 0;
@@ -446,7 +446,7 @@ struct LocaleData {
     }
 };
 
-static LocaleData *gLocaleData = NULL;
+static LocaleData *gLocaleData = nullptr;
 
 void
 TimeZoneFormatTest::TestTimeRoundTrip(void) {
@@ -552,7 +552,7 @@ void TimeZoneFormatTest::RunTimeRoundTripTests(int32_t threadNumber) {
     UBool expectedRoundTrip[4];
     int32_t testLen = 0;
 
-    StringEnumeration *tzids = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL, NULL, NULL, status);
+    StringEnumeration *tzids = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL, nullptr, nullptr, status);
     if (U_FAILURE(status)) {
         if (status == U_MISSING_RESOURCE_ERROR) {
             // This error is generally caused by data not being present.
@@ -594,7 +594,7 @@ void TimeZoneFormatTest::RunTimeRoundTripTests(int32_t threadNumber) {
                 // The time roundtrip will fail for such zones with pattern "V" (short zone ID).
                 // This is expected behavior.
                 const UChar* shortZoneID = ZoneMeta::getShortID(*tzid);
-                if (shortZoneID == NULL) {
+                if (shortZoneID == nullptr) {
                     continue;
                 }
             } else if (uprv_strcmp(PATTERNS[patidx], "VVV") == 0) {
@@ -821,7 +821,7 @@ TimeZoneFormatTest::TestParse(void) {
                 UTZFMT_PARSE_OPTION_NONE,           "America/New_York", 3,      UTZFMT_TIME_TYPE_DAYLIGHT},
 
             {"EST",             0,      "en_US",    UTZFMT_STYLE_SPECIFIC_LONG,
-                UTZFMT_PARSE_OPTION_NONE,           NULL,               0,      UTZFMT_TIME_TYPE_UNKNOWN},
+                UTZFMT_PARSE_OPTION_NONE,           nullptr,               0,      UTZFMT_TIME_TYPE_UNKNOWN},
 
             {"EST",             0,      "en_US",    UTZFMT_STYLE_SPECIFIC_LONG,
                 UTZFMT_PARSE_OPTION_ALL_STYLES,     "America/New_York", 3,      UTZFMT_TIME_TYPE_STANDARD},
@@ -833,7 +833,7 @@ TimeZoneFormatTest::TestParse(void) {
                 UTZFMT_PARSE_OPTION_NONE,           "America/Chicago",  3,      UTZFMT_TIME_TYPE_STANDARD},
 
             {"CST",             0,      "en_GB",    UTZFMT_STYLE_SPECIFIC_SHORT,
-                UTZFMT_PARSE_OPTION_NONE,           NULL,               0,      UTZFMT_TIME_TYPE_UNKNOWN},
+                UTZFMT_PARSE_OPTION_NONE,           nullptr,               0,      UTZFMT_TIME_TYPE_UNKNOWN},
 
             {"CST",             0,      "en_GB",    UTZFMT_STYLE_SPECIFIC_SHORT,
                 UTZFMT_PARSE_OPTION_TZ_DATABASE_ABBREVIATIONS,  "America/Chicago",  3,  UTZFMT_TIME_TYPE_STANDARD},
@@ -851,16 +851,16 @@ TimeZoneFormatTest::TestParse(void) {
                 UTZFMT_PARSE_OPTION_TZ_DATABASE_ABBREVIATIONS,  "Asia/Riyadh",      3,  UTZFMT_TIME_TYPE_STANDARD},
 
             {"AQTST",           0,      "en",       UTZFMT_STYLE_SPECIFIC_LONG,
-                UTZFMT_PARSE_OPTION_NONE,           NULL,               0,      UTZFMT_TIME_TYPE_UNKNOWN},
+                UTZFMT_PARSE_OPTION_NONE,           nullptr,               0,      UTZFMT_TIME_TYPE_UNKNOWN},
 
             {"AQTST",           0,      "en",       UTZFMT_STYLE_SPECIFIC_LONG,
-                UTZFMT_PARSE_OPTION_ALL_STYLES,     NULL,               0,      UTZFMT_TIME_TYPE_UNKNOWN},
+                UTZFMT_PARSE_OPTION_ALL_STYLES,     nullptr,               0,      UTZFMT_TIME_TYPE_UNKNOWN},
 
             {"AQTST",           0,      "en",       UTZFMT_STYLE_SPECIFIC_LONG,
                 UTZFMT_PARSE_OPTION_ALL_STYLES | UTZFMT_PARSE_OPTION_TZ_DATABASE_ABBREVIATIONS, "Asia/Aqtobe",  5,  UTZFMT_TIME_TYPE_DAYLIGHT},
 
-            {NULL,              0,      NULL,       UTZFMT_STYLE_GENERIC_LOCATION,
-                UTZFMT_PARSE_OPTION_NONE,           NULL,               0,      UTZFMT_TIME_TYPE_UNKNOWN}
+            {nullptr,              0,      nullptr,       UTZFMT_STYLE_GENERIC_LOCATION,
+                UTZFMT_PARSE_OPTION_NONE,           nullptr,               0,      UTZFMT_TIME_TYPE_UNKNOWN}
     };
 
     for (int32_t i = 0; DATA[i].text; i++) {
@@ -1035,7 +1035,7 @@ TimeZoneFormatTest::TestISOFormat(void) {
         dataerrln("Fail new Calendar: %s", u_errorName(status));
         return;
     }
-    for (int32_t i = 0; ISO_STR[i][0] != NULL; i++) {
+    for (int32_t i = 0; ISO_STR[i][0] != nullptr; i++) {
         for (int32_t j = 0; PATTERN[j] != 0; j++) {
             if (ISO_STR[i][j] == 0) {
                 continue;
@@ -1300,7 +1300,7 @@ TimeZoneFormatTest::TestFormatCustomZone(void) {
         UnicodeString tzstr;
         UnicodeString expected = UnicodeString(TESTDATA[i].expected, -1, US_INV).unescape();
 
-        tzfmt->format(UTZFMT_STYLE_SPECIFIC_LONG, tz, now, tzstr, NULL);
+        tzfmt->format(UTZFMT_STYLE_SPECIFIC_LONG, tz, now, tzstr, nullptr);
         assertEquals(UnicodeString("Format result for ") + tzid, expected, tzstr);
     }
 }
index 745bc265c9db3864d3fecd953f62d4ac08039302..14183c93db90692ec042db0de97e593f85889a9a 100644 (file)
@@ -1159,7 +1159,7 @@ TimeZoneRegressionTest::TestJDK12API()
  * SimpleTimeZone allows invalid DOM values.
  */
 void TimeZoneRegressionTest::Test4184229() {
-    SimpleTimeZone* zone = NULL;
+    SimpleTimeZone* zone = nullptr;
     UErrorCode status = U_ZERO_ERROR;
     zone = new SimpleTimeZone(0, "A", 0, -1, 0, 0, 0, 0, 0, 0, status);
     if(U_SUCCESS(status)){
index d539dbb916200f0222bdc5617385f0bf2e9f1120..1dd1d458d9c296bee1ca72ad615dd554191a0d3f 100644 (file)
@@ -86,31 +86,31 @@ TestZIDEnumeration::TestZIDEnumeration(UBool all)
         tzenum = TimeZone::createEnumeration(status);
         len = tzenum->count(status);
     } else {
-        tzenum = NULL;
+        tzenum = nullptr;
         len = UPRV_LENGTHOF(TESTZIDS);
     }
 }
 
 TestZIDEnumeration::~TestZIDEnumeration() {
-    if (tzenum != NULL) {
+    if (tzenum != nullptr) {
         delete tzenum;
     }
 }
 
 const UnicodeString*
 TestZIDEnumeration::snext(UErrorCode& status) {
-    if (tzenum != NULL) {
+    if (tzenum != nullptr) {
         return tzenum->snext(status);
     } else if (U_SUCCESS(status) && idx < len) {
         unistr = UnicodeString(TESTZIDS[idx++], "");
         return &unistr;
     }
-    return NULL;
+    return nullptr;
 }
 
 void
 TestZIDEnumeration::reset(UErrorCode& status) {
-    if (tzenum != NULL) {
+    if (tzenum != nullptr) {
         tzenum->reset(status);
     } else {
         idx = 0;
@@ -610,7 +610,7 @@ TimeZoneRuleTest::TestOlsonTransition(void) {
     TestZIDEnumeration tzenum(!quick);
     while (true) {
         const UnicodeString *tzid = tzenum.snext(status);
-        if (tzid == NULL) {
+        if (tzid == nullptr) {
             break;
         }
         if (U_FAILURE(status)) {
@@ -645,7 +645,7 @@ TimeZoneRuleTest::TestRBTZTransition(void) {
     TestZIDEnumeration tzenum(!quick);
     while (true) {
         const UnicodeString *tzid = tzenum.snext(status);
-        if (tzid == NULL) {
+        if (tzid == nullptr) {
             break;
         }
         if (U_FAILURE(status)) {
@@ -782,7 +782,7 @@ TimeZoneRuleTest::TestVTimeZoneRoundTrip(void) {
     TestZIDEnumeration tzenum(!quick);
     while (true) {
         const UnicodeString *tzid = tzenum.snext(status);
-        if (tzid == NULL) {
+        if (tzid == nullptr) {
             break;
         }
         if (U_FAILURE(status)) {
@@ -793,7 +793,7 @@ TimeZoneRuleTest::TestVTimeZoneRoundTrip(void) {
         VTimeZone *vtz_org = VTimeZone::createVTimeZoneByID(*tzid);
         vtz_org->setTZURL("http://source.icu-project.org/timezone");
         vtz_org->setLastModified(Calendar::getNow());
-        VTimeZone *vtz_new = NULL;
+        VTimeZone *vtz_new = nullptr;
         UnicodeString vtzdata;
         // Write out VTIMEZONE data
         vtz_org->write(vtzdata, status);
@@ -854,9 +854,9 @@ TimeZoneRuleTest::TestVTimeZoneRoundTrip(void) {
                     }
                 }
             }
-            if (vtz_new != NULL) {
+            if (vtz_new != nullptr) {
                 delete vtz_new;
-                vtz_new = NULL;
+                vtz_new = nullptr;
             }
         }
         delete tz;
@@ -882,7 +882,7 @@ TimeZoneRuleTest::TestVTimeZoneRoundTripPartial(void) {
     TestZIDEnumeration tzenum(!quick);
     while (true) {
         const UnicodeString *tzid = tzenum.snext(status);
-        if (tzid == NULL) {
+        if (tzid == nullptr) {
             break;
         }
         if (U_FAILURE(status)) {
@@ -891,7 +891,7 @@ TimeZoneRuleTest::TestVTimeZoneRoundTripPartial(void) {
         }
         BasicTimeZone *tz = (BasicTimeZone*)TimeZone::createTimeZone(*tzid);
         VTimeZone *vtz_org = VTimeZone::createVTimeZoneByID(*tzid);
-        VTimeZone *vtz_new = NULL;
+        VTimeZone *vtz_new = nullptr;
         UnicodeString vtzdata;
 
         for (int32_t i = 0; STARTYEARS[i] != 0; i++) {
@@ -946,9 +946,9 @@ TimeZoneRuleTest::TestVTimeZoneRoundTripPartial(void) {
                     }
                 }
             }
-            if (vtz_new != NULL) {
+            if (vtz_new != nullptr) {
                 delete vtz_new;
-                vtz_new = NULL;
+                vtz_new = nullptr;
             }
         }
         delete tz;
@@ -978,7 +978,7 @@ TimeZoneRuleTest::TestVTimeZoneSimpleWrite(void) {
     TestZIDEnumeration tzenum(!quick);
     while (true) {
         const UnicodeString *tzid = tzenum.snext(status);
-        if (tzid == NULL) {
+        if (tzid == nullptr) {
             break;
         }
         if (U_FAILURE(status)) {
@@ -986,7 +986,7 @@ TimeZoneRuleTest::TestVTimeZoneSimpleWrite(void) {
             break;
         }
         VTimeZone *vtz_org = VTimeZone::createVTimeZoneByID(*tzid);
-        VTimeZone *vtz_new = NULL;
+        VTimeZone *vtz_new = nullptr;
         UnicodeString vtzdata;
 
         for (int32_t i = 0; TESTDATES[i][0] != 0; i++) {
@@ -1018,9 +1018,9 @@ TimeZoneRuleTest::TestVTimeZoneSimpleWrite(void) {
                     }
                 }
             }
-            if (vtz_new != NULL) {
+            if (vtz_new != nullptr) {
                 delete vtz_new;
-                vtz_new = NULL;
+                vtz_new = nullptr;
             }
         }
         delete vtz_org;
@@ -1047,7 +1047,7 @@ TimeZoneRuleTest::TestVTimeZoneHeaderProps(void) {
     // Roundtrip conversion
     UnicodeString vtzdata;
     vtz->write(vtzdata, status);
-    VTimeZone *newvtz1 = NULL;
+    VTimeZone *newvtz1 = nullptr;
     if (U_FAILURE(status)) {
         errln("FAIL: error returned while writing VTIMEZONE data 1");
         return;
@@ -1118,7 +1118,7 @@ TimeZoneRuleTest::TestGetSimpleRules(void) {
     for (int32_t i = 0; i < numTimes ; i++) {
         while (true) {
             const UnicodeString *tzid = tzenum.snext(status);
-            if (tzid == NULL) {
+            if (tzid == nullptr) {
                 break;
             }
             if (U_FAILURE(status)) {
@@ -1126,21 +1126,21 @@ TimeZoneRuleTest::TestGetSimpleRules(void) {
                 break;
             }
             BasicTimeZone *tz = (BasicTimeZone*)TimeZone::createTimeZone(*tzid);
-            initial = NULL;
-            std = dst = NULL;
+            initial = nullptr;
+            std = dst = nullptr;
             tz->getSimpleRulesNear(testTimes[i], initial, std, dst, status);
             if (U_FAILURE(status)) {
                 errln("FAIL: getSimpleRules failed.");
                 break;
             }
-            if (initial == NULL) {
-                errln("FAIL: initial rule must not be NULL");
+            if (initial == nullptr) {
+                errln("FAIL: initial rule must not be nullptr");
                 break;
-            } else if (!((std == NULL && dst == NULL) || (std != NULL && dst != NULL))) {
+            } else if (!((std == nullptr && dst == nullptr) || (std != nullptr && dst != nullptr))) {
                 errln("FAIL: invalid std/dst pair.");
                 break;
             }
-            if (std != NULL) {
+            if (std != nullptr) {
                 const DateTimeRule *dtr = std->getRule();
                 if (dtr->getDateRuleType() != DateTimeRule::DOW) {
                     errln("FAIL: simple std rull must use DateTimeRule::DOW as date rule.");
@@ -1162,7 +1162,7 @@ TimeZoneRuleTest::TestGetSimpleRules(void) {
             }
             // Create an RBTZ from the rules and compare the offsets at the date
             RuleBasedTimeZone *rbtz = new RuleBasedTimeZone(*tzid, initial);
-            if (std != NULL) {
+            if (std != nullptr) {
                 rbtz->addTransitionRule(std, status);
                 if (U_FAILURE(status)) {
                     errln("FAIL: couldn't add std rule.");
@@ -1518,7 +1518,7 @@ TimeZoneRuleTest::TestSimpleTimeZoneCoverage(void) {
     UBool avail1, avail2;
     UErrorCode status = U_ZERO_ERROR;
     const TimeZoneRule *trrules[2];
-    const InitialTimeZoneRule *ir = NULL;
+    const InitialTimeZoneRule *ir = nullptr;
     int32_t numTzRules;
 
     // BasicTimeZone API implementation in SimpleTimeZone
@@ -1548,7 +1548,7 @@ TimeZoneRuleTest::TestSimpleTimeZoneCoverage(void) {
     if (numTzRules != 0) {
         errln("FAIL: Incorrect transition rule count");
     }
-    if (ir == NULL || ir->getRawOffset() != stz1->getRawOffset()) {
+    if (ir == nullptr || ir->getRawOffset() != stz1->getRawOffset()) {
         errln("FAIL: Bad initial time zone rule");
     }
 
@@ -1577,8 +1577,8 @@ TimeZoneRuleTest::TestSimpleTimeZoneCoverage(void) {
     }
 
     numTzRules = 2;
-    trrules[0] = NULL;
-    trrules[1] = NULL;
+    trrules[0] = nullptr;
+    trrules[1] = nullptr;
     stz1->getTimeZoneRules(ir, trrules, numTzRules, status);
     if (U_FAILURE(status)) {
         errln("FAIL: getTimeZoneRules failed");
@@ -1586,13 +1586,13 @@ TimeZoneRuleTest::TestSimpleTimeZoneCoverage(void) {
     if (numTzRules != 2) {
         errln("FAIL: Incorrect transition rule count");
     }
-    if (ir == NULL || ir->getRawOffset() != stz1->getRawOffset()) {
+    if (ir == nullptr || ir->getRawOffset() != stz1->getRawOffset()) {
         errln("FAIL: Bad initial time zone rule");
     }
-    if (trrules[0] == NULL || trrules[0]->getRawOffset() != stz1->getRawOffset()) {
+    if (trrules[0] == nullptr || trrules[0]->getRawOffset() != stz1->getRawOffset()) {
         errln("FAIL: Bad transition rule 0");
     }
-    if (trrules[1] == NULL || trrules[1]->getRawOffset() != stz1->getRawOffset()) {
+    if (trrules[1] == nullptr || trrules[1]->getRawOffset() != stz1->getRawOffset()) {
         errln("FAIL: Bad transition rule 1");
     }
 
@@ -1771,7 +1771,7 @@ TimeZoneRuleTest::TestVTimeZoneCoverage(void) {
     // Creation from BasicTimeZone
     //
     status = U_ZERO_ERROR;
-    VTimeZone *vtzFromBasic = NULL;
+    VTimeZone *vtzFromBasic = nullptr;
     SimpleTimeZone *simpleTZ = new SimpleTimeZone(28800000, "Asia/Singapore");
     simpleTZ->setStartYear(1970);
     simpleTZ->setStartRule(0,  // month
@@ -1784,7 +1784,7 @@ TimeZoneRuleTest::TestVTimeZoneCoverage(void) {
         goto end_basic_tz_test;
     }
     vtzFromBasic = VTimeZone::createVTimeZoneFromBasicTimeZone(*simpleTZ, status);
-    if (U_FAILURE(status) || vtzFromBasic == NULL) {
+    if (U_FAILURE(status) || vtzFromBasic == nullptr) {
         dataerrln("File %s, line %d, failed with status = %s", __FILE__, __LINE__, u_errorName(status));
         goto end_basic_tz_test;
     }
@@ -1828,7 +1828,7 @@ TimeZoneRuleTest::TestVTimeZoneParse(void) {
     // Trying to create VTimeZone from empty data
     UnicodeString emptyData;
     VTimeZone *empty = VTimeZone::createVTimeZone(emptyData, status);
-    if (U_SUCCESS(status) || empty != NULL) {
+    if (U_SUCCESS(status) || empty != nullptr) {
         delete empty;
         errln("FAIL: Non-null VTimeZone is returned for empty VTIMEZONE data");
     }
@@ -1862,7 +1862,7 @@ TimeZoneRuleTest::TestVTimeZoneParse(void) {
         0
     };
     VTimeZone *tokyo = VTimeZone::createVTimeZone(asiaTokyo, status);
-    if (U_FAILURE(status) || tokyo == NULL) {
+    if (U_FAILURE(status) || tokyo == nullptr) {
         errln("FAIL: Failed to create a VTimeZone tokyo");
     } else {
         // Check ID
@@ -1927,7 +1927,7 @@ TimeZoneRuleTest::TestVTimeZoneParse(void) {
     };
 
     VTimeZone *foo = VTimeZone::createVTimeZone(fooData, status);
-    if (U_FAILURE(status) || foo == NULL) {
+    if (U_FAILURE(status) || foo == nullptr) {
         errln("FAIL: Failed to create a VTimeZone foo");
     } else {
         // Write VTIMEZONE data
@@ -2183,7 +2183,7 @@ TimeZoneRuleTest::TestVTimeZoneWrapper(void) {
 #if 0
     // local variables
     UBool b;
-    UChar * data = NULL;
+    UChar * data = nullptr;
     int32_t length = 0;
     int32_t i;
     UDate result;
index 55738021db314375df42fdd8bce792cc77f0f8b5..dc0f65fe7b557fab3c1755c2db9d318b2f521882 100644 (file)
@@ -433,7 +433,7 @@ TimeZoneTest::TestGetAvailableIDs913()
     int32_t s_length;
     StringEnumeration* s = TimeZone::createEnumeration(ec);
     LocalPointer<StringEnumeration> tmp1(TimeZone::createEnumeration(), ec);
-    if (U_FAILURE(ec) || s == NULL) {
+    if (U_FAILURE(ec) || s == nullptr) {
         dataerrln("Unable to create TimeZone enumeration");
         return;
     }
@@ -446,13 +446,13 @@ TimeZoneTest::TestGetAvailableIDs913()
         if ((i & 1) == 0) {
             buf += *s->snext(ec);
         } else {
-            buf += UnicodeString(s->next(NULL, ec), "");
+            buf += UnicodeString(s->next(nullptr, ec), "");
         }
 
         if((i % 5) == 4) {
             // replace s with a clone of itself
             StringEnumeration *s2 = s->clone();
-            if(s2 == NULL || s_length != s2->count(ec)) {
+            if(s2 == nullptr || s_length != s2->count(ec)) {
                 errln("TimezoneEnumeration.clone() failed");
             } else {
                 delete s;
@@ -566,46 +566,46 @@ TimeZoneTest::TestGetAvailableIDsNew()
     char region[4] = {0};
     int32_t zoneCount;
 
-    any = canonical = canonicalLoc = any_US = canonical_US = canonicalLoc_US = any_W5 = any_CA_W5 = any_US_E14 = NULL;
+    any = canonical = canonicalLoc = any_US = canonical_US = canonicalLoc_US = any_W5 = any_CA_W5 = any_US_E14 = nullptr;
     
-    any = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_ANY, NULL, NULL, ec);
+    any = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_ANY, nullptr, nullptr, ec);
     if (U_FAILURE(ec)) {
         dataerrln("Failed to create enumeration for ANY");
         goto cleanup;
     }
 
-    canonical = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL, NULL, NULL, ec);
+    canonical = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL, nullptr, nullptr, ec);
     if (U_FAILURE(ec)) {
         errln("Failed to create enumeration for CANONICAL");
         goto cleanup;
     }
 
-    canonicalLoc = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL_LOCATION, NULL, NULL, ec);
+    canonicalLoc = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL_LOCATION, nullptr, nullptr, ec);
     if (U_FAILURE(ec)) {
         errln("Failed to create enumeration for CANONICALLOC");
         goto cleanup;
     }
 
-    any_US = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_ANY, "US", NULL, ec);
+    any_US = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_ANY, "US", nullptr, ec);
     if (U_FAILURE(ec)) {
         errln("Failed to create enumeration for ANY_US");
         goto cleanup;
     }
 
-    canonical_US = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL, "US", NULL, ec);
+    canonical_US = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL, "US", nullptr, ec);
     if (U_FAILURE(ec)) {
         errln("Failed to create enumeration for CANONICAL_US");
         goto cleanup;
     }
 
-    canonicalLoc_US = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL_LOCATION, "US", NULL, ec);
+    canonicalLoc_US = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL_LOCATION, "US", nullptr, ec);
     if (U_FAILURE(ec)) {
         errln("Failed to create enumeration for CANONICALLOC_US");
         goto cleanup;
     }
 
     rawOffset = (-5)*60*60*1000;
-    any_W5 = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_ANY, NULL, &rawOffset, ec);
+    any_W5 = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_ANY, nullptr, &rawOffset, ec);
     if (U_FAILURE(ec)) {
         errln("Failed to create enumeration for ANY_W5");
         goto cleanup;
@@ -639,10 +639,10 @@ TimeZoneTest::TestGetAvailableIDsNew()
 
     // And ID in any set, but not in canonical set must not be a canonical ID
     any->reset(ec);
-    while ((id1 = any->snext(ec)) != NULL) {
+    while ((id1 = any->snext(ec)) != nullptr) {
         UBool found = false;
         canonical->reset(ec);
-        while ((id2 = canonical->snext(ec)) != NULL) {
+        while ((id2 = canonical->snext(ec)) != nullptr) {
             if (*id1 == *id2) {
                 found = true;
                 break;
@@ -671,7 +671,7 @@ TimeZoneTest::TestGetAvailableIDsNew()
 
     // canonical set must contains only canonical IDs
     canonical->reset(ec);
-    while ((id1 = canonical->snext(ec)) != NULL) {
+    while ((id1 = canonical->snext(ec)) != nullptr) {
         TimeZone::getCanonicalID(*id1, canonicalID, isSystemID, ec);
         if (U_FAILURE(ec)) {
             break;
@@ -690,7 +690,7 @@ TimeZoneTest::TestGetAvailableIDsNew()
 
     // canonicalLoc set must contain only canonical location IDs
     canonicalLoc->reset(ec);
-    while ((id1 = canonicalLoc->snext(ec)) != NULL) {
+    while ((id1 = canonicalLoc->snext(ec)) != nullptr) {
         TimeZone::getRegion(*id1, region, sizeof(region), ec);
         if (U_FAILURE(ec)) {
             break;
@@ -706,7 +706,7 @@ TimeZoneTest::TestGetAvailableIDsNew()
 
     // any_US must contain only US zones
     any_US->reset(ec);
-    while ((id1 = any_US->snext(ec)) != NULL) {
+    while ((id1 = any_US->snext(ec)) != nullptr) {
         TimeZone::getRegion(*id1, region, sizeof(region), ec);
         if (U_FAILURE(ec)) {
             break;
@@ -722,7 +722,7 @@ TimeZoneTest::TestGetAvailableIDsNew()
 
     // any_W5 must contain only GMT-05:00 zones
     any_W5->reset(ec);
-    while ((id1 = any_W5->snext(ec)) != NULL) {
+    while ((id1 = any_W5->snext(ec)) != nullptr) {
         TimeZone *tz = TimeZone::createTimeZone(*id1);
         if (tz->getRawOffset() != (-5)*60*60*1000) {
             errln((UnicodeString)"FAIL: ANY_W5 contains a zone whose offset is not -05:00: " + *id1);
@@ -764,10 +764,10 @@ TimeZoneTest::checkContainsAll(StringEnumeration *s1, const char *name1,
 
     s2->reset(ec);
 
-    while ((id2 = s2->snext(ec)) != NULL) {
+    while ((id2 = s2->snext(ec)) != nullptr) {
         UBool found = false;
         s1->reset(ec);
-        while ((id1 = s1->snext(ec)) != NULL) {
+        while ((id1 = s1->snext(ec)) != nullptr) {
             if (*id1 == *id2) {
                 found = true;
                 break;
@@ -1382,7 +1382,7 @@ TimeZoneTest::TestAliasedNames()
 
     int32_t i, j, k, loc;
     UnicodeString fromName, toName;
-    TimeZone *from = NULL, *to = NULL;
+    TimeZone *from = nullptr, *to = nullptr;
     for(i = 0; i < UPRV_LENGTHOF(kData); i++) {
         from = TimeZone::createTimeZone(kData[i].from);
         to = TimeZone::createTimeZone(kData[i].to);
@@ -1538,12 +1538,12 @@ TimeZoneTest::TestDisplayName()
     // *** REVISIT SRL how in the world do I check this? looks java specific.
     // Now be smart -- check to see if zh resource is even present.
     // If not, we expect the en fallback behavior.
-    ResourceBundle enRB(NULL,
+    ResourceBundle enRB(nullptr,
                             Locale::getEnglish(), status);
     if(U_FAILURE(status))
         dataerrln("Couldn't get ResourceBundle for en - %s", u_errorName(status));
 
-    ResourceBundle mtRB(NULL,
+    ResourceBundle mtRB(nullptr,
                          mt_MT, status);
     //if(U_FAILURE(status))
     //    errln("Couldn't get ResourceBundle for mt_MT");
@@ -1804,13 +1804,13 @@ void TimeZoneTest::TestCountries() {
     }
     for(i=0;i<n;++i){
         const UnicodeString* id1 = s1->snext(ec);
-        if(id1==NULL || U_FAILURE(ec)){
+        if(id1==nullptr || U_FAILURE(ec)){
             errln("Failed to fetch next from TimeZone enumeration. Length returned : %i Current Index: %i", n,i);
         }
         TimeZone* tz1 = TimeZone::createTimeZone(*id1);
         for(int j=0; j<n;++j){
             const UnicodeString* id2 = s2->snext(ec);
-            if(id2==NULL || U_FAILURE(ec)){
+            if(id2==nullptr || U_FAILURE(ec)){
                 errln("Failed to fetch next from TimeZone enumeration. Length returned : %i Current Index: %i", n,i);
             }
             TimeZone* tz2 = TimeZone::createTimeZone(*id2);
@@ -2357,7 +2357,7 @@ static struct   {
       {"Europe/London",       "en", true, TimeZone::SHORT, "GMT+1" /*"BST"*/},
       {"Europe/London",       "en", true, TimeZone::LONG,  "British Summer Time"},
 
-      {NULL, NULL, false, TimeZone::SHORT, NULL}   // NULL values terminate list
+      {nullptr, nullptr, false, TimeZone::SHORT, nullptr}   // nullptr values terminate list
     };
 
 void TimeZoneTest::TestDisplayNamesMeta() {
@@ -2366,7 +2366,7 @@ void TimeZoneTest::TestDisplayNamesMeta() {
     if (failure(status, "GregorianCalendar", true)) return;
 
     UBool sawAnError = false;
-    for (int testNum   = 0; zoneDisplayTestData[testNum].zoneName != NULL; testNum++) {
+    for (int testNum   = 0; zoneDisplayTestData[testNum].zoneName != nullptr; testNum++) {
         Locale locale  = Locale::createFromName(zoneDisplayTestData[testNum].localeName);
         TimeZone *zone = TimeZone::createTimeZone(zoneDisplayTestData[testNum].zoneName);
         UnicodeString displayName;
@@ -2377,7 +2377,7 @@ void TimeZoneTest::TestDisplayNamesMeta() {
         if (displayName != zoneDisplayTestData[testNum].expectedDisplayName) {
             char  name[100];
             UErrorCode status = U_ZERO_ERROR;
-            displayName.extract(name, 100, NULL, status);
+            displayName.extract(name, 100, nullptr, status);
             if (isDevelopmentBuild) {
                 sawAnError = true;
                 dataerrln("Incorrect time zone display name.  zone = \"%s\",\n"
index 331079585bf891a1f05b63ff648f2486569a8fa1..f821557f39b9c5d00af64f3ab41409702e3038d7 100644 (file)
@@ -25,8 +25,8 @@
 #include "uparse.h"
 
 UCAConformanceTest::UCAConformanceTest() :
-rbUCA(NULL),
-testFile(NULL),
+rbUCA(nullptr),
+testFile(nullptr),
 status(U_ZERO_ERROR)
 {
     UCA = (RuleBasedCollator *)Collator::createInstance(Locale::getRoot(), status);
@@ -184,24 +184,24 @@ void UCAConformanceTest::testConformance(const Collator *coll)
     }
 
     logln("-prop:ucaconfnosortkeys=1 turns off getSortKey() in UCAConformanceTest");
-    UBool withSortKeys = getProperty("ucaconfnosortkeys") == NULL;
+    UBool withSortKeys = getProperty("ucaconfnosortkeys") == nullptr;
 
     int32_t line = 0;
 
     UChar b1[1024], b2[1024];
-    UChar *buffer = b1, *oldB = NULL;
+    UChar *buffer = b1, *oldB = nullptr;
 
     char lineB1[1024], lineB2[1024];
     char *lineB = lineB1, *oldLineB = lineB2;
 
     uint8_t sk1[1024], sk2[1024];
-    uint8_t *oldSk = NULL, *newSk = sk1;
+    uint8_t *oldSk = nullptr, *newSk = sk1;
 
     int32_t oldLen = 0;
     int32_t oldBlen = 0;
     uint32_t first = 0;
 
-    while (fgets(lineB, 1024, testFile) != NULL) {
+    while (fgets(lineB, 1024, testFile) != nullptr) {
         // remove trailing whitespace
         u_rtrim(lineB);
 
@@ -224,7 +224,7 @@ void UCAConformanceTest::testConformance(const Collator *coll)
 
         int32_t resLen = withSortKeys ? coll->getSortKey(buffer, buflen, newSk, 1024) : 0;
 
-        if(oldSk != NULL) {
+        if(oldSk != nullptr) {
             UBool ok=true;
             int32_t skres = withSortKeys ? strcmp((char *)oldSk, (char *)newSk) : 0;
             int32_t cmpres = coll->compare(oldB, oldBlen, buffer, buflen, status);
index 0b45bca28e647b8b5f7694a8fda8439d995ede10..96e666d99ca9feb4821a97ec30283a6f75af15a7 100644 (file)
@@ -29,7 +29,7 @@ public:
   UCAConformanceTest();
   virtual ~UCAConformanceTest();
 
-  void runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par = NULL */) override;
+  void runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par = nullptr */) override;
 
   void TestTableNonIgnorable(/* par */);
   void TestTableShifted(/* par */);     
index a02011b77d9c8188491e281201c98f96f6e1bf55..d98812cda2a7fb47c996f9d8b58d7590b1be2b0c 100644 (file)
@@ -39,7 +39,7 @@ UnicodeTest::UnicodeTest()
     unknownPropertyNames=new U_NAMESPACE_QUALIFIER Hashtable(errorCode);
     if(U_FAILURE(errorCode)) {
         delete unknownPropertyNames;
-        unknownPropertyNames=NULL;
+        unknownPropertyNames=nullptr;
     }
     // Ignore some property names altogether.
     for(int32_t i=0; i<UPRV_LENGTHOF(ignorePropNames); ++i) {
@@ -93,7 +93,7 @@ getTokenIndex(const char *const tokens[], int32_t countTokens, const char *s) {
     s=u_skipWhitespace(s);
     for(i=0; i<countTokens; ++i) {
         t=tokens[i];
-        if(t!=NULL) {
+        if(t!=nullptr) {
             for(j=0;; ++j) {
                 if(t[j]!=0) {
                     if(s[j]!=t[j]) {
@@ -187,7 +187,7 @@ derivedPropsLineFn(void *context,
     if(i<0) {
         UnicodeString propName(fields[1][0], (int32_t)(fields[1][1]-fields[1][0]));
         propName.trim();
-        if(me->unknownPropertyNames->find(propName)==NULL) {
+        if(me->unknownPropertyNames->find(propName)==nullptr) {
             UErrorCode errorCode=U_ZERO_ERROR;
             me->unknownPropertyNames->puti(propName, 1, errorCode);
             me->errln("UnicodeTest warning: unknown property name '%s' in DerivedCoreProperties.txt or DerivedNormalizationProps.txt\n", fields[1][0]);
@@ -212,7 +212,7 @@ void UnicodeTest::TestAdditionalProperties() {
     }
 
     char path[500];
-    if(getUnidataPath(path) == NULL) {
+    if(getUnidataPath(path) == nullptr) {
         errln("unable to find path to source/data/unidata/");
         return;
     }
index 18ae255ae2ec241e4a02a0bfee6f2edbc2baeba7..8a5930643e9f867f352627926bbb5bd9c851df78 100644 (file)
@@ -32,7 +32,7 @@ public:
     UnicodeTest();
     virtual ~UnicodeTest();
     
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     void TestAdditionalProperties();
     void TestBinaryValues();
index c026c0204aeca5845ab890b08fea2114c25b4f71..d863688ec4bb06f4165f6c7ec71e970fa117451d 100644 (file)
@@ -37,7 +37,7 @@ public:
     UCharsTrieTest();
     virtual ~UCharsTrieTest();
 
-    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=nullptr) override;
     void TestBuilder();
     void TestEmpty();
     void Test_a();
@@ -84,7 +84,7 @@ extern IntlTest *createUCharsTrieTest() {
     return new UCharsTrieTest();
 }
 
-UCharsTrieTest::UCharsTrieTest() : builder_(NULL) {
+UCharsTrieTest::UCharsTrieTest() : builder_(nullptr) {
     IcuTestErrorCode errorCode(*this, "UCharsTrieTest()");
     builder_=new UCharsTrieBuilder(errorCode);
 }
@@ -807,7 +807,7 @@ UCharsTrie *UCharsTrieTest::buildTrie(const StringAndValue data[], int32_t dataL
         errln("builder.buildUnicodeString() before & after build() returned same array");
     }
     if(errorCode.isFailure()) {
-        return NULL;
+        return nullptr;
     }
     // Tries from either build() method should be identical but
     // UCharsTrie does not implement equals().
index cb98a66bba9709109d029148e42efb5d3791e4e3..f3164ac4328f868ae3d1259c982450bf4a2e7e58 100644 (file)
@@ -18,7 +18,7 @@
 class UCTItem : public SharedObject {
   public:
     char *value;
-    UCTItem(const char *x) : value(NULL) { 
+    UCTItem(const char *x) : value(nullptr) { 
         value = uprv_strdup(x);
     }
     virtual ~UCTItem() {
@@ -37,17 +37,17 @@ const UCTItem *LocaleCacheKey<UCTItem>::createObject(
     const UnifiedCache *cacheContext = (const UnifiedCache *) context;
     if (uprv_strcmp(fLoc.getName(), "zh") == 0) {
         status = U_MISSING_RESOURCE_ERROR;
-        return NULL;
+        return nullptr;
     }
     if (uprv_strcmp(fLoc.getLanguage(), fLoc.getName()) != 0) {
-        const UCTItem *item = NULL;
-        if (cacheContext == NULL) {
+        const UCTItem *item = nullptr;
+        if (cacheContext == nullptr) {
             UnifiedCache::getByLocale(fLoc.getLanguage(), item, status);
         } else {
             cacheContext->get(LocaleCacheKey<UCTItem>(fLoc.getLanguage()), item, status);
         }
         if (U_FAILURE(status)) {
-            return NULL;
+            return nullptr;
         }
         return item;
     }
@@ -59,7 +59,7 @@ const UCTItem *LocaleCacheKey<UCTItem>::createObject(
 template<> U_EXPORT
 const UCTItem2 *LocaleCacheKey<UCTItem2>::createObject(
         const void * /*unused*/, UErrorCode & /*status*/) const {
-    return NULL;
+    return nullptr;
 }
 
 U_NAMESPACE_END
@@ -129,8 +129,8 @@ void UnifiedCacheTest::TestEvictionPolicy() {
             "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
             "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"};
 
-    const UCTItem *usedReferences[] = {NULL, NULL, NULL, NULL, NULL};
-    const UCTItem *unusedReference = NULL;
+    const UCTItem *usedReferences[] = {nullptr, nullptr, nullptr, nullptr, nullptr};
+    const UCTItem *unusedReference = nullptr;
 
     // Add 5 in-use entries
     for (int32_t i = 0; i < UPRV_LENGTHOF(usedReferences); i++) {
@@ -195,11 +195,11 @@ void UnifiedCacheTest::TestBounded() {
     // We first add 5 key-value pairs with two distinct values, "en" and "fr"
     // keeping all those references.
 
-    const UCTItem *en = NULL;
-    const UCTItem *enGb = NULL;
-    const UCTItem *enUs = NULL;
-    const UCTItem *fr = NULL;
-    const UCTItem *frFr = NULL;
+    const UCTItem *en = nullptr;
+    const UCTItem *enGb = nullptr;
+    const UCTItem *enUs = nullptr;
+    const UCTItem *fr = nullptr;
+    const UCTItem *frFr = nullptr;
     cache.get(LocaleCacheKey<UCTItem>("en_US"), &cache, enUs, status);
     cache.get(LocaleCacheKey<UCTItem>("en"), &cache, en, status);
     assertEquals("T1", 1, cache.unusedCount());
@@ -216,7 +216,7 @@ void UnifiedCacheTest::TestBounded() {
     // the last one. At the end of this, we will hold references to one
     // additional distinct value, so we will have references to 3 distinct
     // values.
-    const UCTItem *throwAway = NULL;
+    const UCTItem *throwAway = nullptr;
     cache.get(LocaleCacheKey<UCTItem>("zn_AA"), &cache, throwAway, status);
     cache.get(LocaleCacheKey<UCTItem>("sr_AA"), &cache, throwAway, status);
     cache.get(LocaleCacheKey<UCTItem>("de_AU"), &cache, throwAway, status);
@@ -264,8 +264,8 @@ void UnifiedCacheTest::TestBounded() {
 
     // Now we hold a references to two more distinct values. Cache size 
     // should grow to 8.
-    const UCTItem *es = NULL;
-    const UCTItem *ru = NULL;
+    const UCTItem *es = nullptr;
+    const UCTItem *ru = nullptr;
     cache.get(LocaleCacheKey<UCTItem>("es"), &cache, es, status);
     cache.get(LocaleCacheKey<UCTItem>("ru"), &cache, ru, status);
     assertEquals("T14", 3, cache.unusedCount());
@@ -300,12 +300,12 @@ void UnifiedCacheTest::TestBasic() {
     assertSuccess("", status);
     cache->flush();
     int32_t baseCount = cache->keyCount();
-    const UCTItem *en = NULL;
-    const UCTItem *enGb = NULL;
-    const UCTItem *enGb2 = NULL;
-    const UCTItem *enUs = NULL;
-    const UCTItem *fr = NULL;
-    const UCTItem *frFr = NULL;
+    const UCTItem *en = nullptr;
+    const UCTItem *enGb = nullptr;
+    const UCTItem *enGb2 = nullptr;
+    const UCTItem *enUs = nullptr;
+    const UCTItem *fr = nullptr;
+    const UCTItem *frFr = nullptr;
     cache->get(LocaleCacheKey<UCTItem>("en"), en, status);
     cache->get(LocaleCacheKey<UCTItem>("en_US"), enUs, status);
     cache->get(LocaleCacheKey<UCTItem>("en_GB"), enGb, status);
@@ -355,9 +355,9 @@ void UnifiedCacheTest::TestError() {
     assertSuccess("", status);
     cache->flush();
     int32_t baseCount = cache->keyCount();
-    const UCTItem *zh = NULL;
-    const UCTItem *zhTw = NULL;
-    const UCTItem *zhHk = NULL;
+    const UCTItem *zh = nullptr;
+    const UCTItem *zhTw = nullptr;
+    const UCTItem *zhHk = nullptr;
 
     status = U_ZERO_ERROR;
     cache->get(LocaleCacheKey<UCTItem>("zh"), zh, status);
index 19deda84fa7fbf40f02f862d96686ed633a0f5c0..6b785865a79e312cdd7e50a2f738f5b21a86e73f 100644 (file)
@@ -19,7 +19,7 @@ class UnitsDataTest : public IntlTest {
   public:
     UnitsDataTest() {}
 
-    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par = NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par = nullptr) override;
 
     void testGetUnitCategory();
     // This is a sanity check that only exists in ICU4C.
index 6cffc2d6ce41971c32d0b451154a9fc4b5517360..43b63db3c99fe98a5e6d6dbbb2617de713b7dcf5 100644 (file)
@@ -14,7 +14,7 @@ class UnitsRouterTest : public IntlTest {
   public:
     UnitsRouterTest() {}
 
-    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par = NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par = nullptr) override;
 
     void testBasic();
 };
index 931453c0561860c8761cd1b00c15ebf32c2d57fa..56f56f95d4e9f9010fa1704cf718d2d841b3ef42 100644 (file)
@@ -41,7 +41,7 @@ class UnitsTest : public IntlTest {
   public:
     UnitsTest() {}
 
-    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par = NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par = nullptr) override;
 
     void testUnitConstantFreshness();
     void testExtractConvertibility();
@@ -75,13 +75,13 @@ void UnitsTest::runIndexedTest(int32_t index, UBool exec, const char *&name, cha
 // units.txt.
 void UnitsTest::testUnitConstantFreshness() {
     IcuTestErrorCode status(*this, "testUnitConstantFreshness");
-    LocalUResourceBundlePointer unitsBundle(ures_openDirect(NULL, "units", status));
+    LocalUResourceBundlePointer unitsBundle(ures_openDirect(nullptr, "units", status));
     LocalUResourceBundlePointer unitConstants(
-        ures_getByKey(unitsBundle.getAlias(), "unitConstants", NULL, status));
+        ures_getByKey(unitsBundle.getAlias(), "unitConstants", nullptr, status));
 
     while (ures_hasNext(unitConstants.getAlias())) {
         int32_t len;
-        const char *constant = NULL;
+        const char *constant = nullptr;
         ures_getNextString(unitConstants.getAlias(), &len, &constant, status);
 
         Factor factor;
@@ -450,7 +450,7 @@ void unitsTestDataLineFn(void *context, char *fields[][2], int32_t fieldCount, U
     StringPiece commentConversionFormula = trimField(fields[3]);
     StringPiece utf8Expected = trimField(fields[4]);
 
-    UNumberFormat *nf = unum_open(UNUM_DEFAULT, NULL, -1, "en_US", NULL, status);
+    UNumberFormat *nf = unum_open(UNUM_DEFAULT, nullptr, -1, "en_US", nullptr, status);
     if (status.errIfFailureAndReset("unum_open failed")) {
         return;
     }
@@ -1028,23 +1028,23 @@ void parsePreferencesTests(const char *filename, char delimiter, char *fields[][
         return;
     }
 
-    if (fields == NULL || lineFn == NULL || maxFieldCount <= 0) {
+    if (fields == nullptr || lineFn == nullptr || maxFieldCount <= 0) {
         *pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
 
-    if (filename == NULL || *filename == 0 || (*filename == '-' && filename[1] == 0)) {
-        filename = NULL;
+    if (filename == nullptr || *filename == 0 || (*filename == '-' && filename[1] == 0)) {
+        filename = nullptr;
         file = T_FileStream_stdin();
     } else {
         file = T_FileStream_open(filename, "r");
     }
-    if (file == NULL) {
+    if (file == nullptr) {
         *pErrorCode = U_FILE_ACCESS_ERROR;
         return;
     }
 
-    while (T_FileStream_readLine(file, line, sizeof(line)) != NULL) {
+    while (T_FileStream_readLine(file, line, sizeof(line)) != nullptr) {
         /* remove trailing newline characters */
         u_rtrim(line);
 
@@ -1058,7 +1058,7 @@ void parsePreferencesTests(const char *filename, char delimiter, char *fields[][
 
         /* remove in-line comments */
         limit = uprv_strchr(start, '#');
-        if (limit != NULL) {
+        if (limit != nullptr) {
             /* get white space before the pound sign */
             while (limit > start && U_IS_INV_WHITESPACE(*(limit - 1))) {
                 --limit;
@@ -1105,7 +1105,7 @@ void parsePreferencesTests(const char *filename, char delimiter, char *fields[][
         }
     }
 
-    if (filename != NULL) {
+    if (filename != nullptr) {
         T_FileStream_close(file);
     }
 }
index 3d43e82c0f099c9ada80b98d0d86cc83da2170b0..e58612a1b7c599956856e59b6013456433ef3c88 100644 (file)
 #define TESTCLASSID_DEFAULT(c) \
     delete testClass(new c, #c, "new " #c , c::getStaticClassID())
 #define TESTCLASSID_ABSTRACT(c) \
-    testClass(NULL, #c, NULL, c::getStaticClassID())
+    testClass(nullptr, #c, nullptr, c::getStaticClassID())
 #define TESTCLASSID_FACTORY_HIDDEN(c, f) UPRV_BLOCK_MACRO_BEGIN { \
     UObject *objVar = f; \
-    delete testClass(objVar, #c, #f, objVar!=NULL? objVar->getDynamicClassID(): NULL); \
+    delete testClass(objVar, #c, #f, objVar!=nullptr? objVar->getDynamicClassID(): nullptr); \
     if(U_FAILURE(status)) { \
         dataerrln(UnicodeString(#c " - " #f " - got err status ")  + UnicodeString(u_errorName(status))); \
         status = U_ZERO_ERROR; \
@@ -109,7 +109,7 @@ UObject *UObjectTest::testClass(UObject *obj,
 {
     uint32_t i;
     UnicodeString what = UnicodeString(className) + " * x= " + UnicodeString(factory?factory:" ABSTRACT ") + "; ";
-    UClassID dynamicID = NULL;
+    UClassID dynamicID = nullptr;
 
     if(ids_count >= MAX_CLASS_ID) {
         char count[100];
@@ -128,18 +128,18 @@ UObject *UObjectTest::testClass(UObject *obj,
         logln(what + tmp);
     }
 
-    if(staticID == NULL) {
-        dataerrln("FAIL: staticID == NULL! " + what);
+    if(staticID == nullptr) {
+        dataerrln("FAIL: staticID == nullptr! " + what);
     }
 
-    if(factory != NULL) {  /* NULL factory means: abstract */
+    if(factory != nullptr) {  /* nullptr factory means: abstract */
         if(!obj) {
-            dataerrln( "FAIL: ==NULL! " + what);
+            dataerrln( "FAIL: ==nullptr! " + what);
             return obj;
         }
 
-        if(dynamicID == NULL) {
-            errln("FAIL: dynamicID == NULL!" + what);
+        if(dynamicID == nullptr) {
+            errln("FAIL: dynamicID == nullptr!" + what);
         }
 
         if(dynamicID != staticID) {
@@ -148,7 +148,7 @@ UObject *UObjectTest::testClass(UObject *obj,
     }
 
     // Bail out if static ID is null. Error message was already printed.
-    if(staticID == NULL) {
+    if(staticID == nullptr) {
         return obj;
     }
 
@@ -175,7 +175,7 @@ UObject *UObjectTest::testClass(UObject *obj,
 UObject *UObjectTest::testClassNoClassID(UObject *obj, const char *className, const char *factory)
 {
     if (!obj) {
-        return NULL;
+        return nullptr;
     }
     UnicodeString what = UnicodeString(className) + " * x= " + UnicodeString(factory?factory:" ABSTRACT ") + "; ";
     UClassID dynamicID = obj->getDynamicClassID();
@@ -186,14 +186,14 @@ UObject *UObjectTest::testClassNoClassID(UObject *obj, const char *className, co
         logln(what + tmp);
     }
 
-    if(factory != NULL) {  /* NULL factory means: abstract */
+    if(factory != nullptr) {  /* nullptr factory means: abstract */
         if(!obj) {
-            dataerrln( "FAIL: ==NULL! " + what);
+            dataerrln( "FAIL: ==nullptr! " + what);
             return obj;
         }
 
-        if(dynamicID != NULL) {
-            errln("FAIL: dynamicID != NULL! for non-poor-man's-RTTI " + what);
+        if(dynamicID != nullptr) {
+            errln("FAIL: dynamicID != nullptr! for non-poor-man's-RTTI " + what);
         }
     }
 
@@ -338,7 +338,7 @@ void UObjectTest::testIDs()
 #if !UCONFIG_NO_NORMALIZATION
     UnicodeString emptyString;
     TESTCLASSID_CTOR(Normalizer, (emptyString, UNORM_NONE));
-    const Normalizer2 *noNormalizer2 = NULL;
+    const Normalizer2 *noNormalizer2 = nullptr;
     UnicodeSet emptySet;
     TESTCLASSID_NONE_CTOR(FilteredNormalizer2, (*noNormalizer2, emptySet));
     TESTCLASSID_FACTORY(CanonicalIterator, new CanonicalIterator(UnicodeString("abc"), status));
@@ -425,8 +425,8 @@ void UObjectTest::testIDs()
     TESTCLASSID_FACTORY_HIDDEN(TransliteratorRegistry::Enumeration, Transliterator::getAvailableIDs(status));
 
 #if UOBJTEST_TEST_INTERNALS
-    TESTCLASSID_CTOR(Quantifier, (NULL, 0, 0));
-    TESTCLASSID_CTOR(FunctionReplacer, (NULL,NULL));
+    TESTCLASSID_CTOR(Quantifier, (nullptr, 0, 0));
+    TESTCLASSID_CTOR(FunctionReplacer, (nullptr,nullptr));
     TESTCLASSID_CTOR(StringMatcher, (UnicodeString("x"), 0,0,0,TransliterationRuleData(status)));
     TESTCLASSID_CTOR(StringReplacer,(UnicodeString(),new TransliterationRuleData(status)));
 #endif
@@ -475,14 +475,14 @@ void UObjectTest::testIDs()
     TESTCLASSID_CTOR(UVector32, (status));
 
 #if !UCONFIG_NO_SERVICE
-    TESTCLASSID_CTOR(SimpleFactory, (NULL, UnicodeString("foo")));
+    TESTCLASSID_CTOR(SimpleFactory, (nullptr, UnicodeString("foo")));
     TESTCLASSID_DEFAULT(EventListener);
     TESTCLASSID_DEFAULT(ICUResourceBundleFactory);
     //TESTCLASSID_DEFAULT(Key); // does not exist?
     UnicodeString baz("baz");
     UnicodeString bat("bat");
     TESTCLASSID_FACTORY(LocaleKey, LocaleKey::createWithCanonicalFallback(&baz, &bat, LocaleKey::KIND_ANY, status));
-    TESTCLASSID_CTOR(SimpleLocaleKeyFactory, (NULL, UnicodeString("bar"), 8, 12) );
+    TESTCLASSID_CTOR(SimpleLocaleKeyFactory, (nullptr, UnicodeString("bar"), 8, 12) );
     TESTCLASSID_CTOR(TestLocaleKeyFactory, (42));   // Test replacement for LocaleKeyFactory
 //#if UOBJTEST_TEST_INTERNALS
 //    TESTCLASSID_CTOR(LocaleKeyFactory, (42));
@@ -588,11 +588,11 @@ void UObjectTest::TestCompilerRTTI() {
         dataerrln("NumberFormat::createInstance(de) failed - %s", u_errorName(errorCode));
         return;
     }
-    if (dynamic_cast<DecimalFormat *>(nf) == NULL || dynamic_cast<ChoiceFormat *>(nf) != NULL) {
+    if (dynamic_cast<DecimalFormat *>(nf) == nullptr || dynamic_cast<ChoiceFormat *>(nf) != nullptr) {
         errln("dynamic_cast<>(NumberFormat) failed");
     }
     UnicodeSet emptySet;
-    if (&typeid(*nf) == NULL || typeid(*nf) == typeid(UObject) || typeid(*nf) == typeid(Format) ||
+    if (&typeid(*nf) == nullptr || typeid(*nf) == typeid(UObject) || typeid(*nf) == typeid(Format) ||
         typeid(*nf) != typeid(DecimalFormat) || typeid(*nf) == typeid(ChoiceFormat) ||
         typeid(*nf) == typeid(emptySet)
     ) {
index b9863393d69417b34786e0a9a2ccd33a3a8d5aad..4c9589b68a7102f6922b12d01b037c10dd913d41 100644 (file)
@@ -30,7 +30,7 @@ private:
     /**
      * @param obj The UObject to be tested
      * @param className The name of the class being tested 
-     * @param factory String version of obj, for exanple   "new UFoo(1,3,4)". NULL if object is abstract.
+     * @param factory String version of obj, for exanple   "new UFoo(1,3,4)". nullptr if object is abstract.
      * @param staticID The result of class :: getStaticClassID
      * @return Returns obj, suitable for deletion
      */
index 7ee7c300c746f24e67d351111c2b382b7cb22d7c..2598855e2adcc6581c5fb31869a0b2943cfae0f8 100644 (file)
@@ -48,11 +48,11 @@ UnicodeString operator+(const UnicodeString& left, const UnicodeSet& set) {
     return left + UnicodeSetTest::escape(pat);
 }
 
-UnicodeSetTest::UnicodeSetTest() : utf8Cnv(NULL) {
+UnicodeSetTest::UnicodeSetTest() : utf8Cnv(nullptr) {
 }
 
 UConverter *UnicodeSetTest::openUTF8Converter() {
-    if(utf8Cnv==NULL) {
+    if(utf8Cnv==nullptr) {
         UErrorCode errorCode=U_ZERO_ERROR;
         utf8Cnv=ucnv_open("UTF-8", &errorCode);
     }
@@ -131,10 +131,10 @@ void UnicodeSetTest::TestToPattern() {
             "[[:latin:]&[:greek:]]", 
             "[[:latin:]-[:greek:]]",
             "[:nonspacing mark:]",
-            NULL
+            nullptr
         };
 
-        for (int32_t j=0; OTHER_TOPATTERN_TESTS[j]!=NULL; ++j) {
+        for (int32_t j=0; OTHER_TOPATTERN_TESTS[j]!=nullptr; ++j) {
             ec = U_ZERO_ERROR;
             UnicodeSet s(OTHER_TOPATTERN_TESTS[j], ec);
             if (U_FAILURE(ec)) {
@@ -171,32 +171,32 @@ void UnicodeSetTest::TestToPattern() {
         // statements (except for the last) to goto's.
         for (;;) {
             if (U_FAILURE(ec)) break;
-            const char* exp1[] = {"aa", "ab", NOT, "ac", NULL};
+            const char* exp1[] = {"aa", "ab", NOT, "ac", nullptr};
             expectToPattern(*s, "[a-z{aa}{ab}]", exp1);
 
             s->add("ac");
-            const char* exp2[] = {"aa", "ab", "ac", NOT, "xy", NULL};
+            const char* exp2[] = {"aa", "ab", "ac", NOT, "xy", nullptr};
             expectToPattern(*s, "[a-z{aa}{ab}{ac}]", exp2);
 
             s->applyPattern(u"[a-z {\\{l} {r\\}}]", ec);
             if (U_FAILURE(ec)) break;
-            const char* exp3[] = {"{l", "r}", NOT, "xy", NULL};
+            const char* exp3[] = {"{l", "r}", NOT, "xy", nullptr};
             expectToPattern(*s, u"[a-z{r\\}}{\\{l}]", exp3);
 
             s->add("[]");
-            const char* exp4[] = {"{l", "r}", "[]", NOT, "xy", NULL};
+            const char* exp4[] = {"{l", "r}", "[]", NOT, "xy", nullptr};
             expectToPattern(*s, u"[a-z{\\[\\]}{r\\}}{\\{l}]", exp4);
 
             s->applyPattern(u"[a-z {\\u4E01\\u4E02}{\\n\\r}]", ec);
             if (U_FAILURE(ec)) break;
-            const char* exp5[] = {"\\u4E01\\u4E02", "\n\r", NULL};
+            const char* exp5[] = {"\\u4E01\\u4E02", "\n\r", nullptr};
             expectToPattern(*s, u"[a-z{\\u000A\\u000D}{\\u4E01\\u4E02}]", exp5);
 
             // j2189
             s->clear();
             s->add(UnicodeString("abc", ""));
             s->add(UnicodeString("abc", ""));
-            const char* exp6[] = {"abc", NOT, "ab", NULL};
+            const char* exp6[] = {"abc", NOT, "ab", nullptr};
             expectToPattern(*s, "[{abc}]", exp6);
 
             break;
@@ -209,7 +209,7 @@ void UnicodeSetTest::TestToPattern() {
     // JB#3400: For 2 character ranges prefer [ab] to [a-b]
     UnicodeSet s;
     s.add(u'a', u'b');
-    expectToPattern(s, "[ab]", NULL);
+    expectToPattern(s, "[ab]", nullptr);
 }
     
 UBool UnicodeSetTest::toPatternAux(UChar32 start, UChar32 end) {
@@ -878,7 +878,7 @@ void UnicodeSetTest::TestStrings() {
         &((new UnicodeSet('a','z'))->add('A', 'Z').retain('M','m').complement('X')), 
         new UnicodeSet("[[a-zA-Z]&[M-m]-[X]]", ec),
 
-        NULL
+        nullptr
     };
 
     if (U_FAILURE(ec)) {
@@ -887,7 +887,7 @@ void UnicodeSetTest::TestStrings() {
     assertFalse("[a-c].hasStrings()", testList[0]->hasStrings());
     assertTrue("[{ll}{ch}a-z].hasStrings()", testList[2]->hasStrings());
 
-    for (int32_t i = 0; testList[i] != NULL; i+=2) {
+    for (int32_t i = 0; testList[i] != nullptr; i+=2) {
         if (U_SUCCESS(ec)) {
             UnicodeString pat0, pat1;
             testList[i]->toPattern(pat0, true);
@@ -1316,13 +1316,13 @@ void UnicodeSetTest::TestCloseOver() {
         "[a-z]",
         "[A-Za-z]",
 
-        NULL
+        nullptr
     };
 
     UnicodeSet s;
     UnicodeSet t;
     UnicodeString buf;
-    for (int32_t i=0; DATA[i]!=NULL; i+=3) {
+    for (int32_t i=0; DATA[i]!=nullptr; i+=3) {
         int32_t selector = DATA[i][0];
         UnicodeString pat(DATA[i+1], -1, US_INV);
         UnicodeString exp(DATA[i+2], -1, US_INV);
@@ -1403,19 +1403,19 @@ void UnicodeSetTest::TestCloseOver() {
 #endif
 
     // Test the pattern API
-    s.applyPattern("[abc]", USET_CASE_INSENSITIVE, NULL, ec);
+    s.applyPattern("[abc]", USET_CASE_INSENSITIVE, nullptr, ec);
     if (U_FAILURE(ec)) {
         errln("FAIL: applyPattern failed");
     } else {
         expectContainment(s, "abcABC", "defDEF");
     }
-    UnicodeSet v("[^abc]", USET_CASE_INSENSITIVE, NULL, ec);
+    UnicodeSet v("[^abc]", USET_CASE_INSENSITIVE, nullptr, ec);
     if (U_FAILURE(ec)) {
         errln("FAIL: constructor failed");
     } else {
         expectContainment(v, "defDEF", "abcABC");
     }
-    UnicodeSet cm("[abck]", USET_ADD_CASE_MAPPINGS, NULL, ec);
+    UnicodeSet cm("[abck]", USET_ADD_CASE_MAPPINGS, nullptr, ec);
     if (U_FAILURE(ec)) {
         errln("FAIL: construct w/case mappings failed");
     } else {
@@ -1642,7 +1642,7 @@ public:
      * SymbolTable API
      */
     virtual const UnicodeFunctor* lookupMatcher(UChar32 /*ch*/) const override {
-        return NULL;
+        return nullptr;
     }
 
     /**
@@ -1674,13 +1674,13 @@ void UnicodeSetTest::TestSymbolTable() {
     // is terminated by null:
     // var, value, var, value,..., input pat., exp. output pat., null
     const char* DATA[] = {
-        "us", "a-z", "[0-1$us]", "[0-1a-z]", NULL,
-        "us", "[a-z]", "[0-1$us]", "[0-1[a-z]]", NULL,
-        "us", "\\[a\\-z\\]", "[0-1$us]", "[-01\\[\\]az]", NULL,
-        NULL
+        "us", "a-z", "[0-1$us]", "[0-1a-z]", nullptr,
+        "us", "[a-z]", "[0-1$us]", "[0-1[a-z]]", nullptr,
+        "us", "\\[a\\-z\\]", "[0-1$us]", "[-01\\[\\]az]", nullptr,
+        nullptr
     };
 
-    for (int32_t i=0; DATA[i]!=NULL; ++i) {
+    for (int32_t i=0; DATA[i]!=nullptr; ++i) {
         UErrorCode ec = U_ZERO_ERROR;
         TokenSymbolTable sym(ec);
         if (U_FAILURE(ec)) {
@@ -1689,7 +1689,7 @@ void UnicodeSetTest::TestSymbolTable() {
         }
 
         // Set up variables
-        while (DATA[i+2] != NULL) {
+        while (DATA[i+2] != nullptr) {
             sym.add(UnicodeString(DATA[i], -1, US_INV), UnicodeString(DATA[i+1], -1, US_INV), ec);
             if (U_FAILURE(ec)) {
                 errln("FAIL: couldn't add to TokenSymbolTable");
@@ -2182,11 +2182,11 @@ void UnicodeSetTest::expectToPattern(const UnicodeSet& set,
         errln((UnicodeString)"FAIL: toPattern() => \"" + pat + "\", expected \"" + expPat + "\"");
         return;
     }
-    if (expStrings == NULL) {
+    if (expStrings == nullptr) {
         return;
     }
     UBool in = true;
-    for (int32_t i=0; expStrings[i] != NULL; ++i) {
+    for (int32_t i=0; expStrings[i] != nullptr; ++i) {
         if (expStrings[i] == NOT) { // sic; pointer comparison
             in = false;
             continue;
@@ -2334,8 +2334,8 @@ void UnicodeSetTest::TestFreezable() {
     ParsePosition pos;
     frozen.
         applyPattern(wsPattern, errorCode).
-        applyPattern(wsPattern, USET_IGNORE_SPACE, NULL, errorCode).
-        applyPattern(wsPattern, pos, USET_IGNORE_SPACE, NULL, errorCode).
+        applyPattern(wsPattern, USET_IGNORE_SPACE, nullptr, errorCode).
+        applyPattern(wsPattern, pos, USET_IGNORE_SPACE, nullptr, errorCode).
         applyIntPropertyValue(UCHAR_CANONICAL_COMBINING_CLASS, 230, errorCode).
         applyPropertyAlias(u"Assigned", UnicodeString(), errorCode);
     if(frozen!=idSet || !(frozen==idSet)) {
@@ -2474,7 +2474,7 @@ public:
         if(nextStringIndex<fSet.stringsLength) {
             return fSet.strings[nextStringIndex++];
         } else {
-            return NULL;
+            return nullptr;
         }
     }
 
@@ -2486,7 +2486,7 @@ public:
             return s8;
         } else {
             length=0;
-            return NULL;
+            return nullptr;
         }
     }
 
@@ -2538,7 +2538,7 @@ static int32_t containsSpanUTF16(const UnicodeSetWithStrings &set, const UChar *
             }
             const UnicodeString *str;
             iter.reset();
-            while((str=iter.nextString())!=NULL) {
+            while((str=iter.nextString())!=nullptr) {
                 if(str->length()<=(length-start) && matches16CPB(s, start, length, *str)) {
                     // spanNeedsStrings=true;
                     return start;
@@ -2558,7 +2558,7 @@ static int32_t containsSpanUTF16(const UnicodeSetWithStrings &set, const UChar *
             }
             const UnicodeString *str;
             iter.reset();
-            while((str=iter.nextString())!=NULL) {
+            while((str=iter.nextString())!=nullptr) {
                 if(str->length()<=(length-start) && matches16CPB(s, start, length, *str)) {
                     // spanNeedsStrings=true;
                     int32_t matchLimit=start+str->length();
@@ -2639,7 +2639,7 @@ static int32_t containsSpanBackUTF16(const UnicodeSetWithStrings &set, const UCh
             }
             const UnicodeString *str;
             iter.reset();
-            while((str=iter.nextString())!=NULL) {
+            while((str=iter.nextString())!=nullptr) {
                 if(str->length()<=prev && matches16CPB(s, prev-str->length(), length0, *str)) {
                     // spanNeedsStrings=true;
                     return prev;
@@ -2658,7 +2658,7 @@ static int32_t containsSpanBackUTF16(const UnicodeSetWithStrings &set, const UCh
             }
             const UnicodeString *str;
             iter.reset();
-            while((str=iter.nextString())!=NULL) {
+            while((str=iter.nextString())!=nullptr) {
                 if(str->length()<=prev && matches16CPB(s, prev-str->length(), length0, *str)) {
                     // spanNeedsStrings=true;
                     int32_t matchStart=prev-str->length();
@@ -2736,7 +2736,7 @@ static int32_t containsSpanUTF8(const UnicodeSetWithStrings &set, const char *s,
             const char *s8;
             int32_t length8;
             iter.reset();
-            while((s8=iter.nextUTF8(length8))!=NULL) {
+            while((s8=iter.nextUTF8(length8))!=nullptr) {
                 if(length8!=0 && length8<=(length-start) && 0==memcmp(s+start, s8, length8)) {
                     // spanNeedsStrings=true;
                     return start;
@@ -2757,7 +2757,7 @@ static int32_t containsSpanUTF8(const UnicodeSetWithStrings &set, const char *s,
             const char *s8;
             int32_t length8;
             iter.reset();
-            while((s8=iter.nextUTF8(length8))!=NULL) {
+            while((s8=iter.nextUTF8(length8))!=nullptr) {
                 if(length8!=0 && length8<=(length-start) && 0==memcmp(s+start, s8, length8)) {
                     // spanNeedsStrings=true;
                     int32_t matchLimit=start+length8;
@@ -2839,7 +2839,7 @@ static int32_t containsSpanBackUTF8(const UnicodeSetWithStrings &set, const char
             const char *s8;
             int32_t length8;
             iter.reset();
-            while((s8=iter.nextUTF8(length8))!=NULL) {
+            while((s8=iter.nextUTF8(length8))!=nullptr) {
                 if(length8!=0 && length8<=prev && 0==memcmp(s+prev-length8, s8, length8)) {
                     // spanNeedsStrings=true;
                     return prev;
@@ -2859,7 +2859,7 @@ static int32_t containsSpanBackUTF8(const UnicodeSetWithStrings &set, const char
             const char *s8;
             int32_t length8;
             iter.reset();
-            while((s8=iter.nextUTF8(length8))!=NULL) {
+            while((s8=iter.nextUTF8(length8))!=nullptr) {
                 if(length8!=0 && length8<=prev && 0==memcmp(s+prev-length8, s8, length8)) {
                     // spanNeedsStrings=true;
                     int32_t matchStart=prev-length8;
@@ -3702,8 +3702,8 @@ void UnicodeSetTest::TestSpan() {
     uint32_t whichSpans[96]={ SPAN_ALL };
     int32_t whichSpansCount=1;
 
-    UnicodeSet *sets[SET_COUNT]={ NULL };
-    const UnicodeSetWithStrings *sets_with_str[SET_COUNT]={ NULL };
+    UnicodeSet *sets[SET_COUNT]={ nullptr };
+    const UnicodeSetWithStrings *sets_with_str[SET_COUNT]={ nullptr };
 
     char testName[1024];
     char *testNameLimit=testName;
index d5f1f37208b230ed75d7a96f29d8d035b368a35f..b559642a45cfe7ff97ff0a8b691491a079c7c288 100644 (file)
@@ -34,7 +34,7 @@ public:
     ~UnicodeSetTest();
 
 private:
-    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=nullptr) override;
 
     void Testj2268();
 
index a4da8e046657127c52dd399ceb00b0de4cf0e443..d7bfff5cc113943de79735a7966d56e414203a53 100644 (file)
@@ -495,8 +495,8 @@ UnicodeStringTest::TestExtract()
     // convert test4 back to Unicode for comparison
     UnicodeString test4b(test4, 12);
 
-    if (test1.extract(11, 12, (char *)NULL) != 12) {
-        errln("UnicodeString.extract(NULL) failed to return the correct size of destination buffer.");
+    if (test1.extract(11, 12, (char *)nullptr) != 12) {
+        errln("UnicodeString.extract(nullptr) failed to return the correct size of destination buffer.");
     }
     if (test1.extract(11, -1, test6) != 0) {
         errln("UnicodeString.extract(-1) failed to stop reading the string.");
@@ -522,8 +522,8 @@ UnicodeStringTest::TestExtract()
     }
 
     // test preflighting and overflows with invariant conversion
-    if (test1.extract(0, 10, (char *)NULL, "") != 10) {
-        errln("UnicodeString.extract(0, 10, (char *)NULL, \"\") != 10");
+    if (test1.extract(0, 10, (char *)nullptr, "") != 10) {
+        errln("UnicodeString.extract(0, 10, (char *)nullptr, \"\") != 10");
     }
 
     test4[2] = (char)0xff;
@@ -545,9 +545,9 @@ UnicodeStringTest::TestExtract()
         int32_t length;
 
         errorCode=U_ZERO_ERROR;
-        length=s.extract((UChar *)NULL, 0, errorCode);
+        length=s.extract((UChar *)nullptr, 0, errorCode);
         if(errorCode!=U_BUFFER_OVERFLOW_ERROR || length!=s.length()) {
-            errln("UnicodeString.extract(NULL, 0)==%d (%s) expected %d (U_BUFFER_OVERFLOW_ERROR)", length, s.length(), u_errorName(errorCode));
+            errln("UnicodeString.extract(nullptr, 0)==%d (%s) expected %d (U_BUFFER_OVERFLOW_ERROR)", length, s.length(), u_errorName(errorCode));
         }
 
         errorCode=U_ZERO_ERROR;
@@ -594,10 +594,10 @@ UnicodeStringTest::TestExtract()
 
         if(U_SUCCESS(errorCode)) {
             // test preflighting
-            if( (length=s.extract(NULL, 0, cnv, errorCode))!=13 ||
+            if( (length=s.extract(nullptr, 0, cnv, errorCode))!=13 ||
                 errorCode!=U_BUFFER_OVERFLOW_ERROR
             ) {
-                errln("UnicodeString::extract(NULL, UConverter) preflighting failed (length=%ld, %s)",
+                errln("UnicodeString::extract(nullptr, UConverter) preflighting failed (length=%ld, %s)",
                       length, u_errorName(errorCode));
             }
             errorCode=U_ZERO_ERROR;
@@ -610,11 +610,11 @@ UnicodeStringTest::TestExtract()
 
             // try error cases
             errorCode=U_ZERO_ERROR;
-            if( s.extract(NULL, 2, cnv, errorCode)==13 || U_SUCCESS(errorCode)) {
+            if( s.extract(nullptr, 2, cnv, errorCode)==13 || U_SUCCESS(errorCode)) {
                 errln("UnicodeString::extract(UConverter) succeeded with an illegal destination");
             }
             errorCode=U_ILLEGAL_ARGUMENT_ERROR;
-            if( s.extract(NULL, 0, cnv, errorCode)==13 || U_SUCCESS(errorCode)) {
+            if( s.extract(nullptr, 0, cnv, errorCode)==13 || U_SUCCESS(errorCode)) {
                 errln("UnicodeString::extract(UConverter) succeeded with a previous error code");
             }
             errorCode=U_ZERO_ERROR;
@@ -1403,7 +1403,7 @@ UnicodeStringTest::TestCountChar32(void) {
         }
 
         // test u_countChar32() with bad input
-        if(u_countChar32(NULL, 5)!=0 || u_countChar32(buffer, -2)!=0) {
+        if(u_countChar32(nullptr, 5)!=0 || u_countChar32(buffer, -2)!=0) {
             errln("u_countChar32(bad input) failed (returned non-zero counts)");
         }
     }
@@ -1457,7 +1457,7 @@ UnicodeStringTest::TestBogus() {
         errln("A string returned true for isBogus()!");
     }
 
-    // NULL pointers are treated like empty strings
+    // nullptr pointers are treated like empty strings
     // use other illegal arguments to make a bogus string
     test3.setTo(false, test1.getBuffer(), -2);
     if(!test3.isBogus()) {
@@ -1620,7 +1620,7 @@ UnicodeStringTest::TestBogus() {
         errln("normal=bogus failed to make the left string bogus");
     }
 
-    // test that NULL primitive input string values are treated like
+    // test that nullptr primitive input string values are treated like
     // empty strings, not errors (bogus)
     test2.setTo((UChar32)0x10005);
     if(test2.insert(1, nullptr, 1).length()!=2) {
@@ -1629,19 +1629,19 @@ UnicodeStringTest::TestBogus() {
 
     UErrorCode errorCode=U_ZERO_ERROR;
     UnicodeString
-        test4((const UChar *)NULL),
-        test5(true, (const UChar *)NULL, 1),
-        test6((UChar *)NULL, 5, 5),
-        test7((const char *)NULL, 3, NULL, errorCode);
+        test4((const UChar *)nullptr),
+        test5(true, (const UChar *)nullptr, 1),
+        test6((UChar *)nullptr, 5, 5),
+        test7((const char *)nullptr, 3, nullptr, errorCode);
     if(test4.isBogus() || test5.isBogus() || test6.isBogus() || test7.isBogus()) {
-        errln("a constructor set to bogus for a NULL input string, should be empty");
+        errln("a constructor set to bogus for a nullptr input string, should be empty");
     }
 
-    test4.setTo(NULL, 3);
-    test5.setTo(true, (const UChar *)NULL, 1);
-    test6.setTo((UChar *)NULL, 5, 5);
+    test4.setTo(nullptr, 3);
+    test5.setTo(true, (const UChar *)nullptr, 1);
+    test6.setTo((UChar *)nullptr, 5, 5);
     if(test4.isBogus() || test5.isBogus() || test6.isBogus()) {
-        errln("a setTo() set to bogus for a NULL input string, should be empty");
+        errln("a setTo() set to bogus for a nullptr input string, should be empty");
     }
 
     // test that bogus==bogus<any
@@ -1692,7 +1692,7 @@ public:
             return &unistr;
         }
 
-        return NULL;
+        return nullptr;
     }
 
     virtual void reset(UErrorCode& /*status*/) override {
@@ -1729,13 +1729,13 @@ UnicodeStringTest::TestStringEnumeration() {
         status=U_ZERO_ERROR;
         pc=ten.next(&length, status);
         s=UnicodeString(testEnumStrings[i], "");
-        if(U_FAILURE(status) || pc==NULL || length!=s.length() || UnicodeString(pc, length, "")!=s) {
+        if(U_FAILURE(status) || pc==nullptr || length!=s.length() || UnicodeString(pc, length, "")!=s) {
             errln("StringEnumeration.next(%d) failed", i);
         }
     }
     status=U_ZERO_ERROR;
-    if(ten.next(&length, status)!=NULL) {
-        errln("StringEnumeration.next(done)!=NULL");
+    if(ten.next(&length, status)!=nullptr) {
+        errln("StringEnumeration.next(done)!=nullptr");
     }
 
     // test the unext() default implementation
@@ -1744,18 +1744,18 @@ UnicodeStringTest::TestStringEnumeration() {
         status=U_ZERO_ERROR;
         pu=ten.unext(&length, status);
         s=UnicodeString(testEnumStrings[i], "");
-        if(U_FAILURE(status) || pu==NULL || length!=s.length() || UnicodeString(true, pu, length)!=s) {
+        if(U_FAILURE(status) || pu==nullptr || length!=s.length() || UnicodeString(true, pu, length)!=s) {
             errln("StringEnumeration.unext(%d) failed", i);
         }
     }
     status=U_ZERO_ERROR;
-    if(ten.unext(&length, status)!=NULL) {
-        errln("StringEnumeration.unext(done)!=NULL");
+    if(ten.unext(&length, status)!=nullptr) {
+        errln("StringEnumeration.unext(done)!=nullptr");
     }
 
-    // test that the default clone() implementation works, and returns NULL
-    if(ten.clone()!=NULL) {
-        errln("StringEnumeration.clone()!=NULL");
+    // test that the default clone() implementation works, and returns nullptr
+    if(ten.clone()!=nullptr) {
+        errln("StringEnumeration.clone()!=nullptr");
     }
 
     // test that uenum_openFromStringEnumeration() works
@@ -1763,7 +1763,7 @@ UnicodeStringTest::TestStringEnumeration() {
     StringEnumeration *newTen = new TestEnumeration;
     status=U_ZERO_ERROR;
     UEnumeration *uten = uenum_openFromStringEnumeration(newTen, &status);
-    if (uten==NULL || U_FAILURE(status)) {
+    if (uten==nullptr || U_FAILURE(status)) {
         errln("fail at file %s, line %d, UErrorCode is %s\n", __FILE__, __LINE__, u_errorName(status));
         return;
     }
@@ -1772,13 +1772,13 @@ UnicodeStringTest::TestStringEnumeration() {
     for(i=0; i<UPRV_LENGTHOF(testEnumStrings); ++i) {
         status=U_ZERO_ERROR;
         pc=uenum_next(uten, &length, &status);
-        if(U_FAILURE(status) || pc==NULL || strcmp(pc, testEnumStrings[i]) != 0) {
+        if(U_FAILURE(status) || pc==nullptr || strcmp(pc, testEnumStrings[i]) != 0) {
             errln("File %s, line %d, StringEnumeration.next(%d) failed", __FILE__, __LINE__, i);
         }
     }
     status=U_ZERO_ERROR;
-    if(uenum_next(uten, &length, &status)!=NULL) {
-        errln("File %s, line %d, uenum_next(done)!=NULL");
+    if(uenum_next(uten, &length, &status)!=nullptr) {
+        errln("File %s, line %d, uenum_next(done)!=nullptr");
     }
 
     // test the uenum_unext()
@@ -1787,13 +1787,13 @@ UnicodeStringTest::TestStringEnumeration() {
         status=U_ZERO_ERROR;
         pu=uenum_unext(uten, &length, &status);
         s=UnicodeString(testEnumStrings[i], "");
-        if(U_FAILURE(status) || pu==NULL || length!=s.length() || UnicodeString(true, pu, length)!=s) {
+        if(U_FAILURE(status) || pu==nullptr || length!=s.length() || UnicodeString(true, pu, length)!=s) {
             errln("File %s, Line %d, uenum_unext(%d) failed", __FILE__, __LINE__, i);
         }
     }
     status=U_ZERO_ERROR;
-    if(uenum_unext(uten, &length, &status)!=NULL) {
-        errln("File %s, Line %d, uenum_unext(done)!=NULL" __FILE__, __LINE__);
+    if(uenum_unext(uten, &length, &status)!=nullptr) {
+        errln("File %s, Line %d, uenum_unext(done)!=nullptr" __FILE__, __LINE__);
     }
 
     uenum_close(uten);
@@ -2079,12 +2079,12 @@ UnicodeStringTest::doTestAppendable(UnicodeString &dest, Appendable &app) {
         errln("Appendable.append(...) failed");
     }
     buffer=app.getAppendBuffer(0, 3, scratch, 3, &capacity);
-    if(buffer!=NULL || capacity!=0) {
+    if(buffer!=nullptr || capacity!=0) {
         errln("Appendable.getAppendBuffer(min=0) failed");
     }
     capacity=1;
     buffer=app.getAppendBuffer(3, 3, scratch, 2, &capacity);
-    if(buffer!=NULL || capacity!=0) {
+    if(buffer!=nullptr || capacity!=0) {
         errln("Appendable.getAppendBuffer(scratch<min) failed");
     }
 }
index 34cdeac4fd71f31becd7b3fe2cdc4514ed1a77ac..f438c910a582f80bddb1fdce2bc1146423ae91b2 100644 (file)
@@ -27,7 +27,7 @@ public:
     UnicodeStringTest() {}
     virtual ~UnicodeStringTest();
     
-    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     /**
      * Test some basic methods (insert, remove, replace, ...)
index 555ef453127b59c0cfaa1ba129680fab0beae579..6df2579c969dada9e510ff8f7746a7de376cffb5 100644 (file)
 
 class UTS46Test : public IntlTest {
 public:
-    UTS46Test() : trans(NULL), nontrans(NULL) {}
+    UTS46Test() : trans(nullptr), nontrans(nullptr) {}
     virtual ~UTS46Test();
 
-    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=nullptr) override;
     void TestAPI();
     void TestNotSTD3();
     void TestInvalidPunycodeDigits();
@@ -67,7 +67,7 @@ UTS46Test::~UTS46Test() {
 void UTS46Test::runIndexedTest(int32_t index, UBool exec, const char *&name, char * /*par*/) {
     if(exec) {
         logln("TestSuite UTS46Test: ");
-        if(trans==NULL) {
+        if(trans==nullptr) {
             IcuTestErrorCode errorCode(*this, "init/createUTS46Instance()");
             uint32_t commonOptions=
                 UIDNA_USE_STD3_RULES|UIDNA_CHECK_BIDI|
@@ -167,9 +167,9 @@ void UTS46Test::TestAPI() {
     char buffer[100];
     TestCheckedArrayByteSink sink(buffer, UPRV_LENGTHOF(buffer));
     errorCode=U_ZERO_ERROR;
-    nontrans->labelToUnicodeUTF8(StringPiece((const char *)NULL, 5), sink, info, errorCode);
+    nontrans->labelToUnicodeUTF8(StringPiece((const char *)nullptr, 5), sink, info, errorCode);
     if(errorCode!=U_ILLEGAL_ARGUMENT_ERROR || sink.NumberOfBytesWritten()!=0) {
-        errln("N.labelToUnicodeUTF8(StringPiece(NULL, 5)) did not set illegal-argument-error ",
+        errln("N.labelToUnicodeUTF8(StringPiece(nullptr, 5)) did not set illegal-argument-error ",
               "or did output something - %s",
               u_errorName(errorCode));
     }
index d0e5ffb571da80b1e566576853653eb3c127972c..cd570269f687315fb143471574d938832ed87ca9 100644 (file)
@@ -167,7 +167,7 @@ void UTextTest::TestString(const UnicodeString &s) {
     UChar32       c;
     int32_t       cpCount = 0;
     UErrorCode    status  = U_ZERO_ERROR;
-    UText        *ut      = NULL;
+    UText        *ut      = nullptr;
     int32_t       saLen;
 
     UnicodeString sa = s.unescape();
@@ -193,7 +193,7 @@ void UTextTest::TestString(const UnicodeString &s) {
     UChar *buf = new UChar[saLen+1];
     sa.extract(buf, saLen+1, status);
     TEST_SUCCESS(status);
-    ut = utext_openUChars(NULL, buf, -1, &status);
+    ut = utext_openUChars(nullptr, buf, -1, &status);
     TEST_SUCCESS(status);
     TestAccess(sa, ut, cpCount, cpMap);
     utext_close(ut);
@@ -204,7 +204,7 @@ void UTextTest::TestString(const UnicodeString &s) {
     buf = new UChar[saLen+1];
     sa.extract(buf, saLen+1, status);
     TEST_SUCCESS(status);
-    ut = utext_openUChars(NULL, buf, saLen, &status);
+    ut = utext_openUChars(nullptr, buf, saLen, &status);
     TEST_SUCCESS(status);
     TestAccess(sa, ut, cpCount, cpMap);
     utext_close(ut);
@@ -213,7 +213,7 @@ void UTextTest::TestString(const UnicodeString &s) {
 
     // UnicodeString test
     status = U_ZERO_ERROR;
-    ut = utext_openUnicodeString(NULL, &sa, &status);
+    ut = utext_openUnicodeString(nullptr, &sa, &status);
     TEST_SUCCESS(status);
     TestAccess(sa, ut, cpCount, cpMap);
     TestCMR(sa, ut, cpCount, cpMap, cpMap);
@@ -222,7 +222,7 @@ void UTextTest::TestString(const UnicodeString &s) {
 
     // Const UnicodeString test
     status = U_ZERO_ERROR;
-    ut = utext_openConstUnicodeString(NULL, &sa, &status);
+    ut = utext_openConstUnicodeString(nullptr, &sa, &status);
     TEST_SUCCESS(status);
     TestAccess(sa, ut, cpCount, cpMap);
     utext_close(ut);
@@ -230,7 +230,7 @@ void UTextTest::TestString(const UnicodeString &s) {
 
     // Replaceable test.  (UnicodeString inherits Replaceable)
     status = U_ZERO_ERROR;
-    ut = utext_openReplaceable(NULL, &sa, &status);
+    ut = utext_openReplaceable(nullptr, &sa, &status);
     TEST_SUCCESS(status);
     TestAccess(sa, ut, cpCount, cpMap);
     TestCMR(sa, ut, cpCount, cpMap, cpMap);
@@ -241,7 +241,7 @@ void UTextTest::TestString(const UnicodeString &s) {
     const UChar *cbuf = sa.getBuffer();
     CharacterIterator *ci = new UCharCharacterIterator(cbuf, saLen, status);
     TEST_SUCCESS(status);
-    ut = utext_openCharacterIterator(NULL, ci, &status);
+    ut = utext_openCharacterIterator(nullptr, ci, &status);
     TEST_SUCCESS(status);
     TestAccess(sa, ut, cpCount, cpMap);
     utext_close(ut);
@@ -251,7 +251,7 @@ void UTextTest::TestString(const UnicodeString &s) {
     // Fragmented UnicodeString  (Chunk size of one)
     //
     status = U_ZERO_ERROR;
-    ut = openFragmentedUnicodeString(NULL, &sa, &status);
+    ut = openFragmentedUnicodeString(nullptr, &sa, &status);
     TEST_SUCCESS(status);
     TestAccess(sa, ut, cpCount, cpMap);
     utext_close(ut);
@@ -261,7 +261,7 @@ void UTextTest::TestString(const UnicodeString &s) {
     //
 
     // Convert the test string from UnicodeString to (char *) in utf-8 format
-    int32_t u8Len = sa.extract(0, sa.length(), NULL, 0, "utf-8");
+    int32_t u8Len = sa.extract(0, sa.length(), nullptr, 0, "utf-8");
     char *u8String = new char[u8Len + 1];
     sa.extract(0, sa.length(), u8String, u8Len+1, "utf-8");
 
@@ -277,7 +277,7 @@ void UTextTest::TestString(const UnicodeString &s) {
 
     // Do the test itself
     status = U_ZERO_ERROR;
-    ut = utext_openUTF8(NULL, u8String, -1, &status);
+    ut = utext_openUTF8(nullptr, u8String, -1, &status);
     TEST_SUCCESS(status);
     TestAccess(sa, ut, cpCount, u8Map);
     utext_close(ut);
@@ -411,7 +411,7 @@ void UTextTest::TestCopyMove(const UnicodeString &us, UText *ut, UBool move,
                     int32_t u16Start, int32_t u16Limit, int32_t u16Dest)
 {
     UErrorCode      status   = U_ZERO_ERROR;
-    UText          *targetUT = NULL;
+    UText          *targetUT = nullptr;
     gTestNum++;
     gFailed = false;
 
@@ -419,7 +419,7 @@ void UTextTest::TestCopyMove(const UnicodeString &us, UText *ut, UBool move,
     //  clone the UText.  The test will be run in the cloned copy
     //  so that we don't alter the original.
     //
-    targetUT = utext_clone(NULL, ut, true, false, &status);
+    targetUT = utext_clone(nullptr, ut, true, false, &status);
     TEST_SUCCESS(status);
     UnicodeString targetUS(us);    // And copy the reference string.
 
@@ -489,7 +489,7 @@ void UTextTest::TestReplace(
             const UnicodeString &repStr)      // The replacement string
 {
     UErrorCode      status   = U_ZERO_ERROR;
-    UText          *targetUT = NULL;
+    UText          *targetUT = nullptr;
     gTestNum++;
     gFailed = false;
 
@@ -497,7 +497,7 @@ void UTextTest::TestReplace(
     //  clone the target UText.  The test will be run in the cloned copy
     //  so that we don't alter the original.
     //
-    targetUT = utext_clone(NULL, ut, true, false, &status);
+    targetUT = utext_clone(nullptr, ut, true, false, &status);
     TEST_SUCCESS(status);
     UnicodeString targetUS(us);    // And copy the reference string.
 
@@ -560,7 +560,7 @@ void UTextTest::TestAccess(const UnicodeString &us, UText *ut, int cpCount, m *c
     // Re-run tests on a shallow clone.
     utext_setNativeIndex(ut, 0);
     UErrorCode status = U_ZERO_ERROR;
-    UText *shallowClone = utext_clone(NULL, ut, false /*deep*/, false /*readOnly*/, &status);
+    UText *shallowClone = utext_clone(nullptr, ut, false /*deep*/, false /*readOnly*/, &status);
     TEST_SUCCESS(status);
     TestAccessNoClone(us, shallowClone, cpCount, cpMap);
 
@@ -571,7 +571,7 @@ void UTextTest::TestAccess(const UnicodeString &us, UText *ut, int cpCount, m *c
     //
     status = U_ZERO_ERROR;
     utext_setNativeIndex(shallowClone, 0);
-    UText *deepClone = utext_clone(NULL, shallowClone, true, false, &status);
+    UText *deepClone = utext_clone(nullptr, shallowClone, true, false, &status);
     utext_close(shallowClone);
     if (status != U_UNSUPPORTED_ERROR) {
         TEST_SUCCESS(status);
@@ -809,7 +809,7 @@ void UTextTest::TestAccessNoClone(const UnicodeString &us, UText *ut, int cpCoun
     TEST_ASSERT(compareResult == 0);
 
     status = U_ZERO_ERROR;
-    len = utext_extract(ut, 0, utlen, NULL, 0, &status);
+    len = utext_extract(ut, 0, utlen, nullptr, 0, &status);
     if (utlen == 0) {
         TEST_ASSERT(status == U_STRING_NOT_TERMINATED_WARNING);
     } else {
@@ -851,7 +851,7 @@ void UTextTest::ErrorTest()
         UText  ut;
         memset(&ut, 0, sizeof(UText));
         utext_close(&ut);
-        utext_close(NULL);
+        utext_close(nullptr);
     }
 
     // Double-close of a UText.  Shouldn't blow up.  UText should still be usable.
@@ -914,19 +914,19 @@ void UTextTest::ErrorTest()
         UErrorCode status = U_ZERO_ERROR;
         UText ut = UTEXT_INITIALIZER;
 
-        utext_openUChars(&ut, NULL, 5, &status);
+        utext_openUChars(&ut, nullptr, 5, &status);
         TEST_ASSERT(status == U_ILLEGAL_ARGUMENT_ERROR);
 
         status = U_ZERO_ERROR;
-        utext_openUChars(&ut, NULL, -1, &status);
+        utext_openUChars(&ut, nullptr, -1, &status);
         TEST_ASSERT(status == U_ILLEGAL_ARGUMENT_ERROR);
 
         status = U_ZERO_ERROR;
-        utext_openUTF8(&ut, NULL, 4, &status);
+        utext_openUTF8(&ut, nullptr, 4, &status);
         TEST_ASSERT(status == U_ILLEGAL_ARGUMENT_ERROR);
 
         status = U_ZERO_ERROR;
-        utext_openUTF8(&ut, NULL, -1, &status);
+        utext_openUTF8(&ut, nullptr, -1, &status);
         TEST_ASSERT(status == U_ILLEGAL_ARGUMENT_ERROR);
     }
 
@@ -936,11 +936,11 @@ void UTextTest::ErrorTest()
     //
     {
         UErrorCode status = U_ZERO_ERROR;
-        UText *ut = NULL;
+        UText *ut = nullptr;
         const char *badUTF8 = "\x41\x81\x42\xf0\x81\x81\x43";
         UChar32  c;
 
-        ut = utext_openUTF8(NULL, badUTF8, -1, &status);
+        ut = utext_openUTF8(nullptr, badUTF8, -1, &status);
         TEST_SUCCESS(status);
         c = utext_char32At(ut, 1);
         TEST_ASSERT(c == 0xfffd);
@@ -979,13 +979,13 @@ void UTextTest::ErrorTest()
         memset(sb, 0x20, sizeof(sb));
         sb[99] = 0;
 
-        UText *uta = utext_openUnicodeString(NULL, &sa, &status);
+        UText *uta = utext_openUnicodeString(nullptr, &sa, &status);
         TEST_SUCCESS(status);
         isExpensive = utext_isLengthExpensive(uta);
         TEST_ASSERT(isExpensive == false);
         utext_close(uta);
 
-        UText *utb = utext_openUChars(NULL, sb, -1, &status);
+        UText *utb = utext_openUChars(nullptr, sb, -1, &status);
         TEST_SUCCESS(status);
         isExpensive = utext_isLengthExpensive(utb);
         TEST_ASSERT(isExpensive == true);
@@ -1013,7 +1013,7 @@ void UTextTest::ErrorTest()
 
 
         UErrorCode status = U_ZERO_ERROR;
-        UText *ut = utext_openUTF8(NULL, u8str, -1, &status);
+        UText *ut = utext_openUTF8(nullptr, u8str, -1, &status);
         TEST_SUCCESS(status);
 
         // Check setIndex
@@ -1086,7 +1086,7 @@ void UTextTest::ErrorTest()
 
         u16str = u16str.unescape();
         UErrorCode status = U_ZERO_ERROR;
-        UText *ut = utext_openUnicodeString(NULL, &u16str, &status);
+        UText *ut = utext_openUnicodeString(nullptr, &u16str, &status);
         TEST_SUCCESS(status);
 
         int32_t startMapLimit = UPRV_LENGTHOF(startMap);
@@ -1154,7 +1154,7 @@ void UTextTest::ErrorTest()
 
         u16str = u16str.unescape();
         UErrorCode status = U_ZERO_ERROR;
-        UText *ut = utext_openReplaceable(NULL, &u16str, &status);
+        UText *ut = utext_openReplaceable(nullptr, &u16str, &status);
         TEST_SUCCESS(status);
 
         int32_t startMapLimit = UPRV_LENGTHOF(startMap);
@@ -1220,8 +1220,8 @@ void UTextTest::FreezeTest() {
     const UChar u16str[] = {(UChar)0x31, (UChar)0x32, (UChar)0x44, 0};
 
     UErrorCode status = U_ZERO_ERROR;
-    UText  *ut        = NULL;
-    UText  *ut2       = NULL;
+    UText  *ut        = nullptr;
+    UText  *ut2       = nullptr;
 
     ut = utext_openUTF8(ut, u8str, -1, &status);
     TEST_SUCCESS(status);
@@ -1356,11 +1356,11 @@ static UTextFuncs  fragmentFuncs;
 UText *
 cloneFragmentedUnicodeString(UText *dest, const UText *src, UBool deep, UErrorCode *status) {
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
     if (deep) {
         *status = U_UNSUPPORTED_ERROR;
-        return NULL;
+        return nullptr;
     }
     dest = utext_openUnicodeString(dest, (UnicodeString *)src->context, status);
     utext_setNativeIndex(dest, utext_getNativeIndex(src));
@@ -1440,7 +1440,7 @@ void UTextTest::Ticket6847() {
     s[STRLEN] = 0;
 
     UErrorCode status = U_ZERO_ERROR;
-    UText *ut = utext_openUChars(NULL, s, -1, &status);
+    UText *ut = utext_openUChars(nullptr, s, -1, &status);
 
     utext_setNativeIndex(ut, 0);
     int32_t count = 0;
@@ -1469,11 +1469,11 @@ void UTextTest::Ticket10562() {
     UErrorCode status = U_ZERO_ERROR;
 
     const char *utf8_string = "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41";
-    UText *utf8Text = utext_openUTF8(NULL, utf8_string, -1, &status);
+    UText *utf8Text = utext_openUTF8(nullptr, utf8_string, -1, &status);
     TEST_SUCCESS(status);
-    UText *deepClone = utext_clone(NULL, utf8Text, true, false, &status);
+    UText *deepClone = utext_clone(nullptr, utf8Text, true, false, &status);
     TEST_SUCCESS(status);
-    UText *shallowClone = utext_clone(NULL, deepClone, false, false, &status);
+    UText *shallowClone = utext_clone(nullptr, deepClone, false, false, &status);
     TEST_SUCCESS(status);
     utext_close(shallowClone);
     utext_close(deepClone);
@@ -1481,11 +1481,11 @@ void UTextTest::Ticket10562() {
 
     status = U_ZERO_ERROR;
     UnicodeString usString("Hello, World.");
-    UText *usText = utext_openUnicodeString(NULL, &usString, &status);
+    UText *usText = utext_openUnicodeString(nullptr, &usString, &status);
     TEST_SUCCESS(status);
-    UText *usDeepClone = utext_clone(NULL, usText, true, false, &status);
+    UText *usDeepClone = utext_clone(nullptr, usText, true, false, &status);
     TEST_SUCCESS(status);
-    UText *usShallowClone = utext_clone(NULL, usDeepClone, false, false, &status);
+    UText *usShallowClone = utext_clone(nullptr, usDeepClone, false, false, &status);
     TEST_SUCCESS(status);
     utext_close(usShallowClone);
     utext_close(usDeepClone);
@@ -1498,12 +1498,12 @@ void UTextTest::Ticket10983() {
 
     UErrorCode status = U_ZERO_ERROR;
     UnicodeString s("Hello, World");
-    UText *ut = utext_openConstUnicodeString(NULL, &s, &status);
+    UText *ut = utext_openConstUnicodeString(nullptr, &s, &status);
     TEST_SUCCESS(status);
 
     status = U_INVALID_STATE_ERROR;
-    UText *cloned = utext_clone(NULL, ut, true, true, &status);
-    TEST_ASSERT(cloned == NULL);
+    UText *cloned = utext_clone(nullptr, ut, true, true, &status);
+    TEST_ASSERT(cloned == nullptr);
     TEST_ASSERT(status == U_INVALID_STATE_ERROR);
 
     utext_close(ut);
@@ -1591,7 +1591,7 @@ void UTextTest::Ticket12130() {
 void UTextTest::Ticket13344() {
     UErrorCode status = U_ZERO_ERROR;
     const char16_t *str = u"abc\U0010abcd xyz";
-    LocalUTextPointer ut(utext_openUChars(NULL, str, -1, &status));
+    LocalUTextPointer ut(utext_openUChars(nullptr, str, -1, &status));
 
     assertSuccess("UTextTest::Ticket13344-status", status);
     UTEXT_SETNATIVEINDEX(ut.getAlias(), 3);
index 710cd6fab11ad5e349272c1472fec805d50a520d..b52ce3ddb39358897b8cfb2b368667cc0ac12a8e 100644 (file)
@@ -29,7 +29,7 @@ public:
     UTextTest();
     virtual ~UTextTest();
 
-    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=NULL) override;
+    void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par=nullptr) override;
     void TextTest();
     void ErrorTest();
     void FreezeTest();
index 058da1808eb941e137e08de176c9ee2d811d352a..abefbf538f5d7380a71f0af00e8dba731bc7fb00 100644 (file)
@@ -155,12 +155,12 @@ void UVectorTest::UStack_API() {
     delete a;
 
     status = U_ZERO_ERROR;
-    a = new UStack(NULL, NULL, 2000, status);
+    a = new UStack(nullptr, nullptr, 2000, status);
     TEST_CHECK_STATUS(status);
     delete a;
 
     status = U_ZERO_ERROR;
-    a = new UStack(NULL, UVectorTest_compareCstrings, status);
+    a = new UStack(nullptr, UVectorTest_compareCstrings, status);
     TEST_ASSERT(a->empty());
     a->push((void*)"abc", status);
     TEST_ASSERT(!a->empty());
@@ -190,12 +190,12 @@ void UVectorTest::Hashtable_API() {
     UErrorCode status = U_ZERO_ERROR;
     Hashtable *a = new Hashtable(status);
     TEST_ASSERT((a->puti("a", 1, status) == 0));
-    TEST_ASSERT((a->find("a") != NULL));
-    TEST_ASSERT((a->find("b") == NULL));
+    TEST_ASSERT((a->find("a") != nullptr));
+    TEST_ASSERT((a->find("b") == nullptr));
     TEST_ASSERT((a->puti("b", 2, status) == 0));
-    TEST_ASSERT((a->find("b") != NULL));
+    TEST_ASSERT((a->find("b") != nullptr));
     TEST_ASSERT((a->removei("a") == 1));
-    TEST_ASSERT((a->find("a") == NULL));
+    TEST_ASSERT((a->find("a") == nullptr));
 
     /* verify that setValueComparator works */
     Hashtable b(status);
@@ -210,9 +210,9 @@ void UVectorTest::Hashtable_API() {
 
     /* verify that setKeyComparator works */
     TEST_ASSERT((a->puti("a", 1, status) == 0));
-    TEST_ASSERT((a->find("a") != NULL));
+    TEST_ASSERT((a->find("a") != nullptr));
     a->setKeyComparator(neverTRUE);
-    TEST_ASSERT((a->find("a") == NULL));
+    TEST_ASSERT((a->find("a") == nullptr));
 
     delete a;
 }
index 9ca81358d2adb940bebdbf274cb217d70416582a..80c7ec61cb8684eec17da54f100a4cdac9944678 100644 (file)
@@ -24,7 +24,7 @@ public:
     UVectorTest();
     virtual ~UVectorTest();
 
-    virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     // The following are test functions that are visible from the intltest test framework.
     void UVector_API();
index 44226fa8cf4ac4319ff1e7d471ccf056b27f8ee8..6de44f63ccb476e70765468b1b589a58f77d54f1 100644 (file)
@@ -24,7 +24,7 @@ public:
     UVector32Test();
     virtual ~UVector32Test();
 
-    virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL ) override;
+    virtual void runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = nullptr ) override;
 
     // The following are test functions that are visible from the intltest test framework.
     virtual void UVector32_API();
index b6ab7fc9f45153f51345e62f1a8fa20ecf347d09..c64314e20ee7bb29716327770303e5b8378a83a5 100644 (file)
@@ -119,8 +119,8 @@ void Win32DateTimeTest::testLocales(DateFormatTest *log)
         DWORD value = 0;
         int32_t calType = 0;
 
-        // NULL localeID means ICU didn't recognize this locale
-        if (lcidRecords[i].localeID == NULL) {
+        // nullptr localeID means ICU didn't recognize this locale
+        if (lcidRecords[i].localeID == nullptr) {
             continue;
         }
 
@@ -153,8 +153,8 @@ void Win32DateTimeTest::testLocales(DateFormatTest *log)
         Locale ulocale(localeID);
         int32_t wdLength, wtLength;
 
-        wdLength = GetDateFormatW(lcidRecords[i].lcid, DATE_LONGDATE, &winNow, NULL, wdBuffer, UPRV_LENGTHOF(wdBuffer));
-        wtLength = GetTimeFormatW(lcidRecords[i].lcid, 0, &winNow, NULL, wtBuffer, UPRV_LENGTHOF(wtBuffer));
+        wdLength = GetDateFormatW(lcidRecords[i].lcid, DATE_LONGDATE, &winNow, nullptr, wdBuffer, UPRV_LENGTHOF(wdBuffer));
+        wtLength = GetTimeFormatW(lcidRecords[i].lcid, 0, &winNow, nullptr, wtBuffer, UPRV_LENGTHOF(wtBuffer));
 
         if (uprv_strchr(localeID, '@')) {
             uprv_strcat(localeID, ";");
index bf6a86afae395ad2e7d211347835445be1d58ed2..2ad25e7d13c32deccbe2e2cdc10407d8a838d8e5 100644 (file)
@@ -68,7 +68,7 @@ static uint64_t randomInt64(void)
     int32_t i;
 
     if (!initialized) {
-        srand((unsigned)time(NULL));
+        srand((unsigned)time(nullptr));
         initialized = true;
     }
 
@@ -88,7 +88,7 @@ static double randomDouble(void)
     double ran = 0;
 
     if (!initialized) {
-        srand((unsigned)time(NULL));
+        srand((unsigned)time(nullptr));
         initialized = true;
     }
 #if 0
@@ -122,7 +122,7 @@ static uint32_t randomInt32(void)
     int32_t i;
 
     if (!initialized) {
-        srand((unsigned)time(NULL));
+        srand((unsigned)time(nullptr));
         initialized = true;
     }
 
@@ -143,7 +143,7 @@ static UnicodeString &getWindowsFormat(int32_t lcid, UBool currency, UnicodeStri
 
     nBuffer[0] = 0x0000;
 
-    /* Due to the arguments causing a result to be <= 23 characters (+2 for NULL and minus),
+    /* Due to the arguments causing a result to be <= 23 characters (+2 for nullptr and minus),
     we don't need to reallocate the buffer. */
     va_start(args, fmt);
     result = _vsnwprintf(nBuffer, STACK_BUFFER_SIZE, fmt, args);
@@ -189,31 +189,31 @@ static UnicodeString &getWindowsFormat(int32_t lcid, UBool currency, UnicodeStri
     buffer[0] = 0x0000;
 
     if (currency) {
-        result = GetCurrencyFormatW(lcid, 0, nBuffer, NULL, buffer, STACK_BUFFER_SIZE);
+        result = GetCurrencyFormatW(lcid, 0, nBuffer, nullptr, buffer, STACK_BUFFER_SIZE);
 
         if (result == 0) {
             DWORD lastError = GetLastError();
 
             if (lastError == ERROR_INSUFFICIENT_BUFFER) {
-                int newLength = GetCurrencyFormatW(lcid, 0, nBuffer, NULL, NULL, 0);
+                int newLength = GetCurrencyFormatW(lcid, 0, nBuffer, nullptr, nullptr, 0);
 
                 buffer = NEW_ARRAY(wchar_t, newLength);
                 buffer[0] = 0x0000;
-                GetCurrencyFormatW(lcid, 0, nBuffer, NULL, buffer, newLength);
+                GetCurrencyFormatW(lcid, 0, nBuffer, nullptr, buffer, newLength);
             }
         }
     } else {
-        result = GetNumberFormatW(lcid, 0, nBuffer, NULL, buffer, STACK_BUFFER_SIZE);
+        result = GetNumberFormatW(lcid, 0, nBuffer, nullptr, buffer, STACK_BUFFER_SIZE);
 
         if (result == 0) {
             DWORD lastError = GetLastError();
 
             if (lastError == ERROR_INSUFFICIENT_BUFFER) {
-                int newLength = GetNumberFormatW(lcid, 0, nBuffer, NULL, NULL, 0);
+                int newLength = GetNumberFormatW(lcid, 0, nBuffer, nullptr, nullptr, 0);
 
                 buffer = NEW_ARRAY(wchar_t, newLength);
                 buffer[0] = 0x0000;
-                GetNumberFormatW(lcid, 0, nBuffer, NULL, buffer, newLength);
+                GetNumberFormatW(lcid, 0, nBuffer, nullptr, buffer, newLength);
             }
         }
     }
@@ -281,8 +281,8 @@ void Win32NumberTest::testLocales(NumberFormatTest *log)
         UErrorCode status = U_ZERO_ERROR;
         char localeID[128];
 
-        // NULL localeID means ICU didn't recognize the lcid
-        if (lcidRecords[i].localeID == NULL) {
+        // nullptr localeID means ICU didn't recognize the lcid
+        if (lcidRecords[i].localeID == nullptr) {
             continue;
         }
 
@@ -319,7 +319,7 @@ void Win32NumberTest::testLocales(NumberFormatTest *log)
         testLocale(lcidRecords[i].localeID, lcidRecords[i].lcid, wcf, true,  log);
 
 #if 0
-        char *old_locale = strdup(setlocale(LC_ALL, NULL));
+        char *old_locale = strdup(setlocale(LC_ALL, nullptr));
         
         setlocale(LC_ALL, "German");
 
index c3e9135b308b0c8629669944ac897b6ce8afc523..41a7b9006d66bf7f07919cbbfb81086062a87852 100644 (file)
@@ -32,7 +32,7 @@
 #   include <stdio.h>
 #   include <string.h>
 
-static Win32Utilities::LCIDRecord *lcidRecords = NULL;
+static Win32Utilities::LCIDRecord *lcidRecords = nullptr;
 static int32_t lcidCount  = 0;
 static int32_t lcidMax = 0;
 
@@ -63,7 +63,7 @@ BOOL CALLBACK EnumLocalesProc(LPSTR lpLocaleString)
         memcpy(lcidRecords[lcidCount].localeID, localeID, localeIDLen);
         lcidRecords[lcidCount].localeID[localeIDLen] = 0;
     } else {
-        lcidRecords[lcidCount].localeID = NULL;
+        lcidRecords[lcidCount].localeID = nullptr;
     }
 
     lcidCount += 1;
@@ -82,7 +82,7 @@ Win32Utilities::LCIDRecord *Win32Utilities::getLocales(int32_t &localeCount)
     result      = lcidRecords;
 
     lcidCount = lcidMax = 0;
-    lcidRecords = NULL;
+    lcidRecords = nullptr;
 
     return result;
 }
index 5ee56fc9ada0afd784af625c8432705332d86df5..eddffd7a2d648279e95830caf32e9f442b871829 100644 (file)
@@ -39,34 +39,34 @@ public:
     static void cleanUp() {
         if (fgTestDataPath) {
             free(fgTestDataPath);
-            fgTestDataPath = NULL;
+            fgTestDataPath = nullptr;
         }
     }
     virtual void errln( const UnicodeString &message ) override {
         char buffer[4000];
         message.extract(0, message.length(), buffer, sizeof(buffer));
-        buffer[3999] = 0; /* NULL terminate */
+        buffer[3999] = 0; /* NUL terminate */
         log_err(buffer);
     }
 
     virtual void logln( const UnicodeString &message ) override {
         char buffer[4000];
         message.extract(0, message.length(), buffer, sizeof(buffer));
-        buffer[3999] = 0; /* NULL terminate */
+        buffer[3999] = 0; /* NUL terminate */
         log_info(buffer);
     }
 
     virtual void dataerrln( const UnicodeString &message ) override {
         char buffer[4000];
         message.extract(0, message.length(), buffer, sizeof(buffer));
-        buffer[3999] = 0; /* NULL terminate */
+        buffer[3999] = 0; /* NUL terminate */
         log_data_err(buffer);
     }
 
     static const char * pathToDataDirectory(void)
     {
 
-        if(fgDataDir != NULL) {
+        if(fgDataDir != nullptr) {
             return fgDataDir;
         }
 
@@ -98,12 +98,12 @@ public:
             /*   Only Windows should end up here, so looking for '\' is safe.   */
             for (i=1; i<=3; i++) {
                 pBackSlash = strrchr(p, U_FILE_SEP_CHAR);
-                if (pBackSlash != NULL) {
+                if (pBackSlash != nullptr) {
                     *pBackSlash = 0;        /* Truncate the string at the '\'   */
                 }
             }
 
-            if (pBackSlash != NULL) {
+            if (pBackSlash != nullptr) {
                 /* We found and truncated three names from the path.
                 *  Now append "source\data" and set the environment
                 */
@@ -129,10 +129,10 @@ public:
     }
 
     static const char* loadTestData(UErrorCode& err){
-        if( fgTestDataPath == NULL){
-            const char*      directory=NULL;
-            UResourceBundle* test =NULL;
-            char* tdpath=NULL;
+        if( fgTestDataPath == nullptr){
+            const char*      directory=nullptr;
+            UResourceBundle* test =nullptr;
+            char* tdpath=nullptr;
             const char* tdrelativepath;
 
 #if defined (U_TOPBUILDDIR)
@@ -171,8 +171,8 @@ public:
     }
 };
 
-const char* DataDrivenLogger::fgDataDir = NULL;
-char* DataDrivenLogger::fgTestDataPath = NULL;
+const char* DataDrivenLogger::fgDataDir = nullptr;
+char* DataDrivenLogger::fgTestDataPath = nullptr;
 
 #if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_FILE_IO
 static int64_t
@@ -742,7 +742,7 @@ static void addAllTests(TestNode** root) {
 /* returns the path to icu/source/data/out */
 static const char *ctest_dataOutDir()
 {
-    static const char *dataOutDir = NULL;
+    static const char *dataOutDir = nullptr;
 
     if(dataOutDir) {
         return dataOutDir;
@@ -776,12 +776,12 @@ static const char *ctest_dataOutDir()
         /*   Only Windows should end up here, so looking for '\' is safe.   */
         for (i=1; i<=3; i++) {
             pBackSlash = strrchr(p, U_FILE_SEP_CHAR);
-            if (pBackSlash != NULL) {
+            if (pBackSlash != nullptr) {
                 *pBackSlash = 0;        /* Truncate the string at the '\'   */
             }
         }
 
-        if (pBackSlash != NULL) {
+        if (pBackSlash != nullptr) {
             /* We found and truncated three names from the path.
              *  Now append "source\data" and set the environment
              */
@@ -819,7 +819,7 @@ static void ctest_setICU_DATA() {
     /* No location for the data dir was identifiable.
      *   Add other fallbacks for the test data location here if the need arises
      */
-    if (getenv("ICU_DATA") == NULL) {
+    if (getenv("ICU_DATA") == nullptr) {
         /* If ICU_DATA isn't set, set it to the usual location */
         u_setDataDirectory(ctest_dataOutDir());
     }
@@ -847,7 +847,7 @@ U_CDECL_END
 int main(int argc, char* argv[])
 {
     int32_t nerrors = 0;
-    TestNode *root = NULL;
+    TestNode *root = nullptr;
     UErrorCode errorCode = U_ZERO_ERROR;
     UDate startTime, endTime;
     int32_t diffTime;
index 459a1a33caa535dceabefb6bb53627923cf04e28..54dabf856dc96df357d023ce1c1d507472ba4a90 100644 (file)
 #include "LESwaps.h"
 
 FontObject::FontObject(char *fileName)
-  : directory(NULL), numTables(0), searchRange(0),entrySelector(0),
-    cmapTable(NULL), cmSegCount(0), cmSearchRange(0), cmEntrySelector(0),
-    cmEndCodes(NULL), cmStartCodes(NULL), cmIdDelta(0), cmIdRangeOffset(0),
-    headTable(NULL), hmtxTable(NULL), numGlyphs(0), numOfLongHorMetrics(0), file(NULL)
+  : directory(nullptr), numTables(0), searchRange(0),entrySelector(0),
+    cmapTable(nullptr), cmSegCount(0), cmSearchRange(0), cmEntrySelector(0),
+    cmEndCodes(nullptr), cmStartCodes(nullptr), cmIdDelta(0), cmIdRangeOffset(0),
+    headTable(nullptr), hmtxTable(nullptr), numGlyphs(0), numOfLongHorMetrics(0), file(nullptr)
 {
     file = fopen(fileName, "rb");
 
-    if (file == NULL) {
+    if (file == nullptr) {
         printf("?? Couldn't open %s", fileName);
         return;
     }
@@ -80,16 +80,16 @@ DirectoryEntry *FontObject::findTable(LETag tag)
         return &directory->tableDirectory[table];
     }
 
-    return NULL;
+    return nullptr;
 }
 
 void *FontObject::readTable(LETag tag, le_uint32 *length)
 {
     DirectoryEntry *entry = findTable(tag);
 
-    if (entry == NULL) {
+    if (entry == nullptr) {
         *length = 0;
-        return NULL;
+        return nullptr;
     }
 
     *length = SWAPL(entry->length);
@@ -106,13 +106,13 @@ CMAPEncodingSubtable *FontObject::findCMAP(le_uint16 platformID, le_uint16 platf
 {
     LETag cmapTag = 0x636D6170; // 'cmap'
 
-    if (cmapTable == NULL) {
+    if (cmapTable == nullptr) {
         le_uint32 length;
 
         cmapTable = (CMAPTable *) readTable(cmapTag, &length);
     }
 
-    if (cmapTable != NULL) {
+    if (cmapTable != nullptr) {
         le_uint16 i;
         le_uint16 nSubtables = SWAPW(cmapTable->numberSubtables);
 
@@ -127,7 +127,7 @@ CMAPEncodingSubtable *FontObject::findCMAP(le_uint16 platformID, le_uint16 platf
         }
     }
 
-    return NULL;
+    return nullptr;
 }
 
 void FontObject::initUnicodeCMAP()
@@ -196,7 +196,7 @@ LEGlyphID FontObject::unicodeToGlyph(LEUnicode32 unicode32)
 
 le_uint16 FontObject::getUnitsPerEM()
 {
-    if (headTable == NULL) {
+    if (headTable == nullptr) {
         LETag headTag = 0x68656164; // 'head'
         le_uint32 length;
 
@@ -208,7 +208,7 @@ le_uint16 FontObject::getUnitsPerEM()
 
 le_uint16 FontObject::getGlyphAdvance(LEGlyphID glyph)
 {
-    if (hmtxTable == NULL) {
+    if (hmtxTable == nullptr) {
         LETag maxpTag = 0x6D617870; // 'maxp'
         LETag hheaTag = 0x68686561; // 'hhea'
         LETag hmtxTag = 0x686D7478; // 'hmtx'
index 03c273f3b87679a046f3f245a1f91e7a5c3be689..ddd054a086a406bd4cb970d3b5f6a8adc34dd405 100644 (file)
@@ -27,14 +27,14 @@ FontTableCache::FontTableCache()
 {
     fTableCache = LE_NEW_ARRAY(FontTableCacheEntry, fTableCacheSize);
 
-    if (fTableCache == NULL) {
+    if (fTableCache == nullptr) {
         fTableCacheSize = 0;
         return;
     }
 
     for (int i = 0; i < fTableCacheSize; i += 1) {
         fTableCache[i].tag   = 0;
-        fTableCache[i].table = NULL;
+        fTableCache[i].table = nullptr;
         fTableCache[i].length = 0;
     }
 }
@@ -45,7 +45,7 @@ FontTableCache::~FontTableCache()
       LE_DELETE_ARRAY(fTableCache[i].table);
 
         fTableCache[i].tag   = 0;
-        fTableCache[i].table = NULL;
+        fTableCache[i].table = nullptr;
         fTableCache[i].length = 0;
     }
 
@@ -84,7 +84,7 @@ void FontTableCache::add(LETag tableTag, const void *table, size_t length)
 
         for (le_int32 i = fTableCacheSize; i < newSize; i += 1) {
             fTableCache[i].tag   = 0;
-            fTableCache[i].table = NULL;
+            fTableCache[i].table = nullptr;
             fTableCache[i].length = 0;
         }
 
index 7743fd68c6ca32c989658608903b2c4379995346..e5faad7238dad4b23c3efea6d42d9829772e6f16 100644 (file)
@@ -79,8 +79,8 @@ le_int8 PortableFontInstance::highBit(le_int32 value)
 }
 
 PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize, LEErrorCode &status)
-    : fFile(NULL), fPointSize(pointSize), fUnitsPerEM(0), fFontChecksum(0), fAscent(0), fDescent(0), fLeading(0),
-      fDirectory(NULL), fNAMETable(NULL), fNameCount(0), fNameStringOffset(0), fCMAPMapper(NULL), fHMTXTable(NULL), fNumGlyphs(0), fNumLongHorMetrics(0)
+    : fFile(nullptr), fPointSize(pointSize), fUnitsPerEM(0), fFontChecksum(0), fAscent(0), fDescent(0), fLeading(0),
+      fDirectory(nullptr), fNAMETable(nullptr), fNameCount(0), fNameStringOffset(0), fCMAPMapper(nullptr), fHMTXTable(nullptr), fNumGlyphs(0), fNumLongHorMetrics(0)
 {
     if (LE_FAILURE(status)) {
         return;
@@ -90,7 +90,7 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
     fFile = fopen(fileName, "rb");
     //printf("Open Font: %s\n", fileName);
 
-    if (fFile == NULL) {
+    if (fFile == nullptr) {
         printf("%s:%d: %s: FNF\n", __FILE__, __LINE__, fileName);
         status = LE_FONT_FILE_NOT_FOUND_ERROR;
         return;
@@ -105,14 +105,14 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
     le_int32 dirSize = sizeof tempDir + ((SWAPW(tempDir.numTables) - ANY_NUMBER) * sizeof(DirectoryEntry));
     const LETag headTag = LE_HEAD_TABLE_TAG;
     const LETag hheaTag = LE_HHEA_TABLE_TAG;
-    const HEADTable *headTable = NULL;
-    const HHEATable *hheaTable = NULL;
-//  const NAMETable *nameTable = NULL;
+    const HEADTable *headTable = nullptr;
+    const HHEATable *hheaTable = nullptr;
+//  const NAMETable *nameTable = nullptr;
     le_uint16 numTables = 0;
 
     fDirectory = (const SFNTDirectory *) LE_NEW_ARRAY(char, dirSize);
 
-    if (fDirectory == NULL) {
+    if (fDirectory == nullptr) {
         printf("%s:%d: %s: malloc err\n", __FILE__, __LINE__, fileName);
         status = LE_MEMORY_ALLOCATION_ERROR;
         goto error_exit;
@@ -132,7 +132,7 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
     // read unitsPerEm from 'head' table
     headTable = (const HEADTable *) readFontTable(headTag);
 
-    if (headTable == NULL) {
+    if (headTable == nullptr) {
         status = LE_MISSING_FONT_TABLE_ERROR;
         printf("%s:%d: %s: missing head table\n", __FILE__, __LINE__, fileName);
         goto error_exit;
@@ -144,14 +144,14 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
 
     //nameTable = (NAMETable *) readFontTable(nameTag);
 
-    //if (nameTable == NULL) {
+    //if (nameTable == nullptr) {
     //    status = LE_MISSING_FONT_TABLE_ERROR;
     //    goto error_exit;
     //}
 
     //fFontVersionString = findName(nameTable, NAME_VERSION_STRING, PLATFORM_MACINTOSH, MACINTOSH_ROMAN, MACINTOSH_ENGLISH);
 
-    //if (fFontVersionString == NULL) {
+    //if (fFontVersionString == nullptr) {
     //    status = LE_MISSING_FONT_TABLE_ERROR;
     //    goto error_exit;
     //}
@@ -160,7 +160,7 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
 
     hheaTable = (HHEATable *) readFontTable(hheaTag);
 
-    if (hheaTable == NULL) {
+    if (hheaTable == nullptr) {
         printf("%s:%d: %s: missing hhea table\n", __FILE__, __LINE__, fileName);
         status = LE_MISSING_FONT_TABLE_ERROR;
         goto error_exit;
@@ -176,7 +176,7 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
 
     fCMAPMapper = findUnicodeMapper();
 
-    if (fCMAPMapper == NULL) {
+    if (fCMAPMapper == nullptr) {
         printf("%s:%d: %s: can't load cmap\n", __FILE__, __LINE__, fileName);
         status = LE_MISSING_FONT_TABLE_ERROR;
         goto error_exit;
@@ -186,13 +186,13 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
 
 error_exit:
     fclose(fFile);
-    fFile = NULL;
+    fFile = nullptr;
     return;
 }
 
 PortableFontInstance::~PortableFontInstance()
 {
-    if (fFile != NULL) {
+    if (fFile != nullptr) {
         fclose(fFile);
 
         freeFontTable(fHMTXTable);
@@ -206,7 +206,7 @@ PortableFontInstance::~PortableFontInstance()
 
 const DirectoryEntry *PortableFontInstance::findTable(LETag tag) const
 {
-    if (fDirectory != NULL) {
+    if (fDirectory != nullptr) {
         le_uint16 table = 0;
         le_uint16 probe = fDirPower;
 
@@ -227,23 +227,23 @@ const DirectoryEntry *PortableFontInstance::findTable(LETag tag) const
         }
     }
 
-    return NULL;
+    return nullptr;
 }
 
 const void *PortableFontInstance::readTable(LETag tag, le_uint32 *length) const
 {
     const DirectoryEntry *entry = findTable(tag);
 
-    if (entry == NULL) {
+    if (entry == nullptr) {
         *length = 0;
-        return NULL;
+        return nullptr;
     }
 
     *length = SWAPL(entry->length);
 
     void *table = LE_NEW_ARRAY(char, *length);
 
-    if (table != NULL) {
+    if (table != nullptr) {
         fseek(fFile, SWAPL(entry->offset), SEEK_SET);
         size_t numRead = fread(table, sizeof(char), *length, fFile);
         (void)numRead;
@@ -273,8 +273,8 @@ CMAPMapper *PortableFontInstance::findUnicodeMapper()
     LETag cmapTag = LE_CMAP_TABLE_TAG;
     const CMAPTable *cmap = (CMAPTable *) readFontTable(cmapTag);
 
-    if (cmap == NULL) {
-        return NULL;
+    if (cmap == nullptr) {
+        return nullptr;
     }
 
     return CMAPMapper::createUnicodeMapper(cmap);
@@ -282,13 +282,13 @@ CMAPMapper *PortableFontInstance::findUnicodeMapper()
 
 const char *PortableFontInstance::getNameString(le_uint16 nameID, le_uint16 platformID, le_uint16 encodingID, le_uint16 languageID) const
 {
-    if (fNAMETable == NULL) {
+    if (fNAMETable == nullptr) {
         LETag nameTag = LE_NAME_TABLE_TAG;
         PortableFontInstance *realThis = (PortableFontInstance *) this;
 
         realThis->fNAMETable = (const NAMETable *) readFontTable(nameTag);
 
-        if (realThis->fNAMETable != NULL) {
+        if (realThis->fNAMETable != nullptr) {
             realThis->fNameCount        = SWAPW(realThis->fNAMETable->count);
             realThis->fNameStringOffset = SWAPW(realThis->fNAMETable->stringOffset);
         }
@@ -310,18 +310,18 @@ const char *PortableFontInstance::getNameString(le_uint16 nameID, le_uint16 plat
         }
     }
 
-    return NULL;
+    return nullptr;
 }
 
 const LEUnicode16 *PortableFontInstance::getUnicodeNameString(le_uint16 nameID, le_uint16 platformID, le_uint16 encodingID, le_uint16 languageID) const
 {
-    if (fNAMETable == NULL) {
+    if (fNAMETable == nullptr) {
         LETag nameTag = LE_NAME_TABLE_TAG;
         PortableFontInstance *realThis = (PortableFontInstance *) this;
 
         realThis->fNAMETable = (const NAMETable *) readFontTable(nameTag);
 
-        if (realThis->fNAMETable != NULL) {
+        if (realThis->fNAMETable != nullptr) {
             realThis->fNameCount        = SWAPW(realThis->fNAMETable->count);
             realThis->fNameStringOffset = SWAPW(realThis->fNAMETable->stringOffset);
         }
@@ -346,7 +346,7 @@ const LEUnicode16 *PortableFontInstance::getUnicodeNameString(le_uint16 nameID,
         }
     }
 
-    return NULL;
+    return nullptr;
 }
 
 void PortableFontInstance::deleteNameString(const char *name) const
@@ -363,13 +363,13 @@ void PortableFontInstance::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) co
 {
     TTGlyphID ttGlyph = (TTGlyphID) LE_GET_GLYPH(glyph);
 
-    if (fHMTXTable == NULL) {
+    if (fHMTXTable == nullptr) {
         LETag maxpTag = LE_MAXP_TABLE_TAG;
         LETag hmtxTag = LE_HMTX_TABLE_TAG;
         const MAXPTable *maxpTable = (MAXPTable *) readFontTable(maxpTag);
         PortableFontInstance *realThis = (PortableFontInstance *) this;
 
-        if (maxpTable != NULL) {
+        if (maxpTable != nullptr) {
             realThis->fNumGlyphs = SWAPW(maxpTable->numGlyphs);
             freeFontTable(maxpTable);
         }
@@ -379,7 +379,7 @@ void PortableFontInstance::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) co
 
     le_uint16 index = ttGlyph;
 
-    if (ttGlyph >= fNumGlyphs || fHMTXTable == NULL) {
+    if (ttGlyph >= fNumGlyphs || fHMTXTable == nullptr) {
         advance.fX = advance.fY = 0;
         return;
     }
index e387b083dc435192ec8134bc25d5279551f6d190..e707e5809d837e57a9fd192b1ce4476f4edcdc14 100644 (file)
@@ -55,7 +55,7 @@ const void *SimpleFontInstance::getFontTable(LETag tableTag, size_t &length) con
         return CanonShaping::glyphDefinitionTable;
     }
 #endif
-    return NULL;
+    return nullptr;
 }
 
 void SimpleFontInstance::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const
index cb385042f8fb85567232720613b54b6b60baa19d..3c7ecfabd571cd437542dcb67395351b5fa34d4b 100644 (file)
@@ -57,7 +57,7 @@ CMAPMapper *CMAPMapper::createUnicodeMapper(const CMAPTable *cmap)
 {
     le_uint16 i;
     le_uint16 nSubtables = SWAPW(cmap->numberSubtables);
-    const CMAPEncodingSubtable *subtable = NULL;
+    const CMAPEncodingSubtable *subtable = nullptr;
     le_bool found = false;
     le_uint16 foundPlatformID = 0xFFFF;
     le_uint16 foundPlatformSpecificID = 0xFFFF;
@@ -128,7 +128,7 @@ CMAPMapper *CMAPMapper::createUnicodeMapper(const CMAPTable *cmap)
       (void)foundPlatformSpecificID;
     } else {
       printf("%s:%d: could not find subtable.\n", __FILE__, __LINE__);
-      return NULL;
+      return nullptr;
     }
 
     le_uint16 tableFormat = SWAPW(subtable->format);
@@ -150,7 +150,7 @@ CMAPMapper *CMAPMapper::createUnicodeMapper(const CMAPTable *cmap)
     }
 
     printf("%s:%d: Unknown format %x.\n", __FILE__, __LINE__, (SWAPW(subtable->format)));
-    return NULL;
+    return nullptr;
 }
 
 CMAPFormat4Mapper::CMAPFormat4Mapper(const CMAPTable *cmap, const CMAPFormat4Encoding *header)
index 401c88e296462861244568c60492db72f451be08..bd170aea847b44ac41633607dee1c045370cb5e1 100644 (file)
@@ -49,14 +49,14 @@ struct TestInput
 
 /* Returns the path to icu/source/test/testdata/ */
 const char *getSourceTestData() {
-    const char *srcDataDir = NULL;
+    const char *srcDataDir = nullptr;
 #ifdef U_TOPSRCDIR
     srcDataDir =  U_TOPSRCDIR  U_FILE_SEP_STRING "test" U_FILE_SEP_STRING "testdata" U_FILE_SEP_STRING;
 #else
     srcDataDir = ".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING"test"U_FILE_SEP_STRING"testdata"U_FILE_SEP_STRING;
     FILE *f = fopen(".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING"test"U_FILE_SEP_STRING"testdata"U_FILE_SEP_STRING"rbbitst.txt", "r");
 
-    if (f != NULL) {
+    if (f != nullptr) {
         /* We're in icu/source/test/letest/ */
         fclose(f);
     } else {
@@ -151,7 +151,7 @@ int main(int argc, char *argv[])
     if(argc>2) {
       gendataFile = argv[2];
     }
-    time_t now = time(NULL);
+    time_t now = time(nullptr);
     struct tm *local = localtime(&now);
     const char *tmFormat = "%m/%d/%Y %I:%M:%S %p %Z";
     char  tmString[64];
@@ -162,7 +162,7 @@ int main(int argc, char *argv[])
     UXMLParser  *parser = UXMLParser::createParser(status);
     UXMLElement *root   = parser->parseFile(gendataFile, status);
 
-    if (root == NULL) {
+    if (root == nullptr) {
       printf("Error: Could not open %s\n", gendataFile);
         delete parser;
         return -1;
@@ -188,14 +188,14 @@ int main(int argc, char *argv[])
     const UXMLElement *testCase;
     int32_t tc = 0;
 
-    while((testCase = root->nextChildElement(tc)) != NULL) {
+    while((testCase = root->nextChildElement(tc)) != nullptr) {
         if (testCase->getTagName().compare(test_case) == 0) {
             char *id = getCString(testCase->getAttribute(id_attr));
             char *script = getCString(testCase->getAttribute(script_attr));
             char *lang   = getCString(testCase->getAttribute(lang_attr));
             ++count;
             printf("\n ID %s\n", id);
-            LEFontInstance *font = NULL;
+            LEFontInstance *font = nullptr;
             const UXMLElement *element;
             int32_t ec = 0;
             int32_t charCount = 0;
@@ -205,10 +205,10 @@ int main(int argc, char *argv[])
             UnicodeString text;
             int32_t glyphCount = 0;
             LEErrorCode leStatus = LE_NO_ERROR;
-            LayoutEngine *engine = NULL;
-            LEGlyphID *glyphs    = NULL;
-            le_int32  *indices   = NULL;
-            float     *positions = NULL;
+            LayoutEngine *engine = nullptr;
+            LEGlyphID *glyphs    = nullptr;
+            le_int32  *indices   = nullptr;
+            float     *positions = nullptr;
 
             uscript_getCode(script, &scriptCode, 1, &status);
             if (LE_FAILURE(status)) {
@@ -216,7 +216,7 @@ int main(int argc, char *argv[])
                 goto free_c_strings;
             }
 
-            if (lang != NULL) {
+            if (lang != nullptr) {
                 languageCode = getLanguageCode(lang);
 
                 if (languageCode < 0) {
@@ -229,13 +229,13 @@ int main(int argc, char *argv[])
                 fprintf(outputFile, "    <test-case id=\"%s\" script=\"%s\">\n", id, script);
             }
 
-            while((element = testCase->nextChildElement(ec)) != NULL) {
+            while((element = testCase->nextChildElement(ec)) != nullptr) {
                 UnicodeString tag = element->getTagName();
 
                 // TODO: make sure that each element is only used once.
                 if (tag.compare(test_font) == 0) {
                     char *fontName  = getCString(element->getAttribute(name_attr));
-                    const char *version = NULL;
+                    const char *version = nullptr;
                     char buf[2048];
                     PortableFontInstance *pfi = new PortableFontInstance(getPath(buf,fontName), 12, leStatus);
                     
@@ -251,13 +251,13 @@ int main(int argc, char *argv[])
 
                     // The standard recommends that the Macintosh Roman/English name string be present, but
                     // if it's not, try the Microsoft Unicode/English string.
-                    if (version == NULL) {
+                    if (version == nullptr) {
                         const LEUnicode16 *uversion = pfi->getUnicodeNameString(NAME_VERSION_STRING, PLATFORM_MICROSOFT, MICROSOFT_UNICODE_BMP, MICROSOFT_ENGLISH);
 
-                        if (uversion != NULL) {
+                        if (uversion != nullptr) {
                           char uversion_utf8[300];
                           UErrorCode status2 = U_ZERO_ERROR;
-                          u_strToUTF8(uversion_utf8, 300, NULL, uversion, -1, &status2);
+                          u_strToUTF8(uversion_utf8, 300, nullptr, uversion, -1, &status2);
                           if(U_FAILURE(status2)) {
                             uversion_utf8[0]=0;
                           }
@@ -281,7 +281,7 @@ int main(int argc, char *argv[])
 
                     font = pfi;
                 } else if (tag.compare(test_text) == 0) {
-                    char *utf8 = NULL;
+                    char *utf8 = nullptr;
 
                     text = element->getText(true);
                     charCount = text.length();
@@ -299,7 +299,7 @@ int main(int argc, char *argv[])
                 }
             }
 
-            if (font == NULL) {
+            if (font == nullptr) {
                 LEErrorCode fontStatus = LE_NO_ERROR;
 
                 font = new SimpleFontInstance(12, fontStatus);
index d8b780ea55a6e7119c88533894c8eb7e4615a505..8144ec79fdbd6f869ee9d493b53baee5d34e0866 100644 (file)
@@ -58,9 +58,9 @@ static void U_CALLCONV ParamTest(void)
     LEErrorCode status = LE_NO_ERROR;
     SimpleFontInstance *font = new SimpleFontInstance(12, status);
     LayoutEngine *engine = LayoutEngine::layoutEngineFactory(font, arabScriptCode, -1, status);
-    LEGlyphID *glyphs    = NULL;
-    le_int32  *indices   = NULL;
-    float     *positions = NULL;
+    LEGlyphID *glyphs    = nullptr;
+    le_int32  *indices   = nullptr;
+    float     *positions = nullptr;
     le_int32   glyphCount = 0;
 
     glyphCount = engine->getGlyphCount();
@@ -72,10 +72,10 @@ static void U_CALLCONV ParamTest(void)
     indices   = NEW_ARRAY(le_int32, glyphCount + 10);
     positions = NEW_ARRAY(float, glyphCount + 10);
 
-    engine->getGlyphs(NULL, status);
+    engine->getGlyphs(nullptr, status);
 
     if (status != LE_ILLEGAL_ARGUMENT_ERROR) {
-        log_err("Calling getGlyphs(NULL, status) did not return LE_ILLEGAL_ARGUMENT_ERROR.\n");
+        log_err("Calling getGlyphs(nullptr, status) did not return LE_ILLEGAL_ARGUMENT_ERROR.\n");
     }
 
     status = LE_NO_ERROR;
@@ -86,10 +86,10 @@ static void U_CALLCONV ParamTest(void)
     }
 
     status = LE_NO_ERROR;
-    engine->getGlyphs(NULL, 0xFF000000L, status);
+    engine->getGlyphs(nullptr, 0xFF000000L, status);
 
     if (status != LE_ILLEGAL_ARGUMENT_ERROR) {
-        log_err("Calling getGlyphs(NULL, 0xFF000000L, status) did not return LE_ILLEGAL_ARGUMENT_ERROR.\n");
+        log_err("Calling getGlyphs(nullptr, 0xFF000000L, status) did not return LE_ILLEGAL_ARGUMENT_ERROR.\n");
     }
 
     status = LE_NO_ERROR;
@@ -100,10 +100,10 @@ static void U_CALLCONV ParamTest(void)
     }
 
     status = LE_NO_ERROR;
-    engine->getCharIndices(NULL, status);
+    engine->getCharIndices(nullptr, status);
 
     if (status != LE_ILLEGAL_ARGUMENT_ERROR) {
-        log_err("Calling getCharIndices(NULL, status) did not return LE_ILLEGAL_ARGUMENT_ERROR.\n");
+        log_err("Calling getCharIndices(nullptr, status) did not return LE_ILLEGAL_ARGUMENT_ERROR.\n");
     }
 
     status = LE_NO_ERROR;
@@ -114,10 +114,10 @@ static void U_CALLCONV ParamTest(void)
     }
 
     status = LE_NO_ERROR;
-    engine->getCharIndices(NULL, 1024, status);
+    engine->getCharIndices(nullptr, 1024, status);
 
     if (status != LE_ILLEGAL_ARGUMENT_ERROR) {
-        log_err("Calling getCharIndices(NULL, 1024, status) did not return LE_ILLEGAL_ARGUMENT_ERROR.\n");
+        log_err("Calling getCharIndices(nullptr, 1024, status) did not return LE_ILLEGAL_ARGUMENT_ERROR.\n");
     }
 
     status = LE_NO_ERROR;
@@ -128,10 +128,10 @@ static void U_CALLCONV ParamTest(void)
     }
 
     status = LE_NO_ERROR;
-    engine->getGlyphPositions(NULL, status);
+    engine->getGlyphPositions(nullptr, status);
 
     if (status != LE_ILLEGAL_ARGUMENT_ERROR) {
-        log_err("Calling getGlyphPositions(NULL, status) did not return LE_ILLEGAL_ARGUMENT_ERROR.\n");
+        log_err("Calling getGlyphPositions(nullptr, status) did not return LE_ILLEGAL_ARGUMENT_ERROR.\n");
     }
 
     status = LE_NO_ERROR;
@@ -146,10 +146,10 @@ static void U_CALLCONV ParamTest(void)
     DELETE_ARRAY(glyphs);
 
     status = LE_NO_ERROR;
-    glyphCount = engine->layoutChars(NULL, 0, 0, 0, false, 0.0, 0.0, status);
+    glyphCount = engine->layoutChars(nullptr, 0, 0, 0, false, 0.0, 0.0, status);
 
     if (status != LE_ILLEGAL_ARGUMENT_ERROR) {
-        log_err("Calling layoutChars(NULL, 0, 0, 0, false, 0.0, 0.0, status) did not fail w/ LE_ILLEGAL_ARGUMENT_ERROR.\n");
+        log_err("Calling layoutChars(nullptr, 0, 0, 0, false, 0.0, 0.0, status) did not fail w/ LE_ILLEGAL_ARGUMENT_ERROR.\n");
     }
 
     LEUnicode chars[] = {
@@ -220,7 +220,7 @@ static void U_CALLCONV FactoryTest(void)
 {
     LEErrorCode status = LE_NO_ERROR;
     SimpleFontInstance *font = new SimpleFontInstance(12, status);
-    LayoutEngine *engine = NULL;
+    LayoutEngine *engine = nullptr;
 
     for(le_int32 scriptCode = 0; scriptCode < scriptCodeCount; scriptCode += 1) {
         status = LE_NO_ERROR;
@@ -387,18 +387,18 @@ static void checkFontVersion(PortableFontInstance *fontInstance, const char *tes
     if (fontChecksum != testChecksum) {
         const char *fontVersionString = fontInstance->getNameString(NAME_VERSION_STRING,
             PLATFORM_MACINTOSH, MACINTOSH_ROMAN, MACINTOSH_ENGLISH);
-        const LEUnicode *uFontVersionString = NULL;
+        const LEUnicode *uFontVersionString = nullptr;
 
             // The standard recommends that the Macintosh Roman/English name string be present, but
             // if it's not, try the Microsoft Unicode/English string.
-            if (fontVersionString == NULL) {
+            if (fontVersionString == nullptr) {
                 uFontVersionString = fontInstance->getUnicodeNameString(NAME_VERSION_STRING,
                     PLATFORM_MICROSOFT, MICROSOFT_UNICODE_BMP, MICROSOFT_ENGLISH);
             }
 
         log_info("Test %s: this may not be the same font used to generate the test data.\n", testID);
 
-        if (uFontVersionString != NULL) {
+        if (uFontVersionString != nullptr) {
             log_info("Your font's version string is \"%S\"\n", uFontVersionString);
             fontInstance->deleteNameString(uFontVersionString);
         } else {
@@ -413,14 +413,14 @@ static void checkFontVersion(PortableFontInstance *fontInstance, const char *tes
 
 /* Returns the path to icu/source/test/testdata/ */
 const char *getSourceTestData() {
-    const char *srcDataDir = NULL;
+    const char *srcDataDir = nullptr;
 #ifdef U_TOPSRCDIR
     srcDataDir = U_TOPSRCDIR U_FILE_SEP_STRING "test" U_FILE_SEP_STRING "testdata" U_FILE_SEP_STRING;
 #else
     srcDataDir = ".." U_FILE_SEP_STRING ".." U_FILE_SEP_STRING "test" U_FILE_SEP_STRING "testdata" U_FILE_SEP_STRING;
     FILE *f = fopen(".." U_FILE_SEP_STRING ".." U_FILE_SEP_STRING "test" U_FILE_SEP_STRING "testdata" U_FILE_SEP_STRING "rbbitst.txt", "r");
 
-    if (f != NULL) {
+    if (f != nullptr) {
         /* We're in icu/source/test/letest/ */
         fclose(f);
     } else {
@@ -550,7 +550,7 @@ LEFontInstance *openFont(const char *fontName, const char *checksum, const char
     if (LE_FAILURE(fontStatus)) {
         log_info("Test %s: can't open font %s - test skipped.\n", testID, fontName);
         delete font;
-        return NULL;
+        return nullptr;
     } else {
         le_uint32 cksum = 0;
 
@@ -573,7 +573,7 @@ static void U_CALLCONV DataDrivenTest(void)
     UXMLParser  *parser = UXMLParser::createParser(status);
     UXMLElement *root   = parser->parseFile(testFilePath, status);
 
-    if (root == NULL) {
+    if (root == nullptr) {
         log_err("Could not open the test data file: %s\n", testFilePath);
         delete parser;
         return;
@@ -599,12 +599,12 @@ static void U_CALLCONV DataDrivenTest(void)
     const UXMLElement *testCase;
     int32_t tc = 0;
 
-    while((testCase = root->nextChildElement(tc)) != NULL) {
+    while((testCase = root->nextChildElement(tc)) != nullptr) {
         if (testCase->getTagName().compare(test_case) == 0) {
             char *id = getCString(testCase->getAttribute(id_attr));
             char *script = getCString(testCase->getAttribute(script_attr));
             char *lang   = getCString(testCase->getAttribute(lang_attr));
-            LEFontInstance *font = NULL;
+            LEFontInstance *font = nullptr;
             const UXMLElement *element;
             int32_t ec = 0;
             int32_t charCount = 0;
@@ -613,10 +613,10 @@ static void U_CALLCONV DataDrivenTest(void)
             le_int32 languageCode = -1;
             UnicodeString text, glyphs, indices, positions;
             int32_t glyphCount = 0, indexCount = 0, positionCount = 0;
-            TestResult expected = {0, NULL, NULL, NULL};
-            TestResult actual   = {0, NULL, NULL, NULL};
+            TestResult expected = {0, nullptr, nullptr, nullptr};
+            TestResult actual   = {0, nullptr, nullptr, nullptr};
             LEErrorCode success = LE_NO_ERROR;
-            LayoutEngine *engine = NULL;
+            LayoutEngine *engine = nullptr;
 
             uscript_getCode(script, &scriptCode, 1, &status);
             if (LE_FAILURE(status)) {
@@ -624,7 +624,7 @@ static void U_CALLCONV DataDrivenTest(void)
                 goto free_c_strings;
             }
 
-            if (lang != NULL) {
+            if (lang != nullptr) {
                 languageCode = getLanguageCode(lang);
 
                 if (languageCode < 0) {
@@ -633,7 +633,7 @@ static void U_CALLCONV DataDrivenTest(void)
                 }
             }
 
-            while((element = testCase->nextChildElement(ec)) != NULL) {
+            while((element = testCase->nextChildElement(ec)) != nullptr) {
                 UnicodeString tag = element->getTagName();
 
                 // TODO: make sure that each element is only used once.
@@ -647,7 +647,7 @@ static void U_CALLCONV DataDrivenTest(void)
                     freeCString(fontVer);
                     freeCString(fontName);
 
-                    if (font == NULL) {
+                    if (font == nullptr) {
                         // warning message already displayed...
                         goto free_c_strings;
                     }
@@ -671,7 +671,7 @@ static void U_CALLCONV DataDrivenTest(void)
 
             // TODO: make sure that the font, test-text, result-glyphs, result-indices and result-positions
             // have all been provided
-            if (font == NULL) {
+            if (font == nullptr) {
                 LEErrorCode fontStatus = LE_NO_ERROR;
 
                 font = new SimpleFontInstance(12, fontStatus);
@@ -885,14 +885,14 @@ static void U_CALLCONV GlyphToCharTest(void)
 
     fontRuns.add(font, charCount);
 
-    paragraphLayout = new ParagraphLayout(chars, charCount, &fontRuns, NULL, NULL, NULL, 0, false, status);
+    paragraphLayout = new ParagraphLayout(chars, charCount, &fontRuns, nullptr, nullptr, nullptr, 0, false, status);
 
     if (LE_FAILURE(status)) {
         goto close_font;
     }
 
     paragraphLayout->reflow();
-    while ((line = paragraphLayout->nextLine(lineWidth)) != NULL) {
+    while ((line = paragraphLayout->nextLine(lineWidth)) != nullptr) {
         le_int32 runCount = line->countRuns();
 
         for(le_int32 run = 0; run < runCount; run += 1) {
@@ -983,7 +983,7 @@ static void addAllTests(TestNode **root)
 /* returns the path to icu/source/data/out */
 static const char *ctest_dataOutDir()
 {
-    static const char *dataOutDir = NULL;
+    static const char *dataOutDir = nullptr;
 
     if(dataOutDir) {
         return dataOutDir;
@@ -1017,12 +1017,12 @@ static const char *ctest_dataOutDir()
         /*   Only Windows should end up here, so looking for '\' is safe.   */
         for (i=1; i<=3; i++) {
             pBackSlash = strrchr(p, U_FILE_SEP_CHAR);
-            if (pBackSlash != NULL) {
+            if (pBackSlash != nullptr) {
                 *pBackSlash = 0;        /* Truncate the string at the '\'   */
             }
         }
 
-        if (pBackSlash != NULL) {
+        if (pBackSlash != nullptr) {
             /* We found and truncated three names from the path.
              *  Now append "source\data" and set the environment
              */
@@ -1060,7 +1060,7 @@ static void ctest_setICU_DATA() {
     /* No location for the data dir was identifiable.
      *   Add other fallbacks for the test data location here if the need arises
      */
-    if (getenv("ICU_DATA") == NULL) {
+    if (getenv("ICU_DATA") == nullptr) {
         /* If ICU_DATA isn't set, set it to the usual location */
         u_setDataDirectory(ctest_dataOutDir());
     }
@@ -1069,14 +1069,14 @@ static void ctest_setICU_DATA() {
 int main(int argc, char* argv[])
 {
     int32_t nerrors = 0;
-    TestNode *root = NULL;
+    TestNode *root = nullptr;
     UErrorCode errorCode = U_ZERO_ERROR;
     UDate startTime, endTime;
     int32_t diffTime;
 
     startTime = uprv_getUTCtime();
 
-    if (!initArgs(argc, argv, NULL, NULL)) {
+    if (!initArgs(argc, argv, nullptr, nullptr)) {
         /* Error already displayed. */
         return -1;
     }
@@ -1099,7 +1099,7 @@ int main(int argc, char* argv[])
     u_cleanup();
     errorCode = U_ZERO_ERROR;
 
-    if (!initArgs(argc, argv, NULL, NULL)) {
+    if (!initArgs(argc, argv, nullptr, nullptr)) {
         /* Error already displayed. */
         return -1;
     }
index 1726b4e5770c3683f8a16f069b621960dbc37428..2f6fbc4adde7659152682cdcdc49a6e7e2e78677 100644 (file)
@@ -33,12 +33,12 @@ U_NAMESPACE_USE
 
 char *getCString(const UnicodeString *uString)
 {
-    if (uString == NULL) {
-        return NULL;
+    if (uString == nullptr) {
+        return nullptr;
     }
 
     le_int32 uLength = uString->length();
-    le_int32 cLength = uString->extract(0, uLength, NULL, 0, US_INV);
+    le_int32 cLength = uString->extract(0, uLength, nullptr, 0, US_INV);
     char *cString = NEW_ARRAY(char, cLength + 1);
 
     uString->extract(0, uLength, cString, cLength, US_INV);
@@ -49,8 +49,8 @@ char *getCString(const UnicodeString *uString)
 
 char *getCString(const LEUnicode16 *uChars)
 {
-    if (uChars == NULL) {
-        return NULL;
+    if (uChars == nullptr) {
+        return nullptr;
     }
 
     const UnicodeString ustring(uChars);
@@ -60,12 +60,12 @@ char *getCString(const LEUnicode16 *uChars)
 
 char *getUTF8String(const UnicodeString *uString)
 {
-    if (uString == NULL) {
-        return NULL;
+    if (uString == nullptr) {
+        return nullptr;
     }
 
     le_int32 uLength = uString->length();
-    le_int32 cLength = uString->extract(0, uLength, NULL, 0, "UTF-8");
+    le_int32 cLength = uString->extract(0, uLength, nullptr, 0, "UTF-8");
     char *cString = NEW_ARRAY(char, cLength + 1);
 
     uString->extract(0, uLength, cString, cLength, "UTF-8");
@@ -88,7 +88,7 @@ le_bool getRTL(const UnicodeString &text)
     le_int32 limit = -1;
     UBiDi *ubidi = ubidi_openSized(charCount, 0, &status);
 
-    ubidi_setPara(ubidi, text.getBuffer(), charCount, UBIDI_DEFAULT_LTR, NULL, &status);
+    ubidi_setPara(ubidi, text.getBuffer(), charCount, UBIDI_DEFAULT_LTR, nullptr, &status);
 
     // TODO: Should check that there's only a single logical run...
     ubidi_getLogicalRun(ubidi, 0, &limit, &level);
index eb469792a46cf014443ce658a9df469161110288..5d4acc8c2f08dd507b28155ced7328277b031d8a 100644 (file)
@@ -139,7 +139,7 @@ void readTestFile(const char *testFilePath, TestCaseCallback callback)
     UXMLParser  *parser = UXMLParser::createParser(status);
     UXMLElement *root   = parser->parseFile(testFilePath, status);
 
-    if (root == NULL) {
+    if (root == nullptr) {
         log_err("Could not open the test data file: %s\n", testFilePath);
         delete parser;
         return;
@@ -165,14 +165,14 @@ void readTestFile(const char *testFilePath, TestCaseCallback callback)
     const UXMLElement *testCase;
     int32_t tc = 0;
 
-    while((testCase = root->nextChildElement(tc)) != NULL) {
+    while((testCase = root->nextChildElement(tc)) != nullptr) {
         if (testCase->getTagName().compare(test_case) == 0) {
             char *id = getCString(testCase->getAttribute(id_attr));
             char *script    = getCString(testCase->getAttribute(script_attr));
             char *lang      = getCString(testCase->getAttribute(lang_attr));
-            char *fontName  = NULL;
-                       char *fontVer   = NULL;
-                       char *fontCksum = NULL;
+            char *fontName  = nullptr;
+                       char *fontVer   = nullptr;
+                       char *fontCksum = nullptr;
             const UXMLElement *element;
             int32_t ec = 0;
             int32_t charCount = 0;
@@ -181,7 +181,7 @@ void readTestFile(const char *testFilePath, TestCaseCallback callback)
             le_int32 languageCode = -1;
             UnicodeString text, glyphs, indices, positions;
             int32_t glyphCount = 0, indexCount = 0, positionCount = 0;
-            TestResult expected = {0, NULL, NULL, NULL};
+            TestResult expected = {0, nullptr, nullptr, nullptr};
 
             uscript_getCode(script, &scriptCode, 1, &status);
             if (LE_FAILURE(status)) {
@@ -189,7 +189,7 @@ void readTestFile(const char *testFilePath, TestCaseCallback callback)
                 goto free_c_strings;
             }
 
-            if (lang != NULL) {
+            if (lang != nullptr) {
                 languageCode = getLanguageCode(lang);
 
                 if (languageCode < 0) {
@@ -198,7 +198,7 @@ void readTestFile(const char *testFilePath, TestCaseCallback callback)
                 }
             }
 
-            while((element = testCase->nextChildElement(ec)) != NULL) {
+            while((element = testCase->nextChildElement(ec)) != nullptr) {
                 UnicodeString tag = element->getTagName();
 
                 // TODO: make sure that each element is only used once.
index 9385b84210a62e4494fa6c19e06add77d7529198..ffd8c0d06359dda428ee191b35f5374b5b2bfca2 100644 (file)
@@ -21,7 +21,7 @@ using namespace std;
 DateFormatPerfTest::DateFormatPerfTest(int32_t argc, const char* argv[], UErrorCode& status)
 : UPerfTest(argc,argv,status) {
 
-    if (locale == NULL){
+    if (locale == nullptr){
         locale = "en_US";   // set default locale
     }
 }
@@ -64,9 +64,9 @@ UPerfFunction* DateFormatPerfTest::runIndexedTest(int32_t index, UBool exec,cons
 
         default: 
             name = ""; 
-            return NULL;
+            return nullptr;
     }
-    return NULL;
+    return nullptr;
 }
 
 
index 78231d890ad4a81329848b47c1483cedb5006268..aa10aa3fc5a381159939e79f19761cfa8e7cb8f0 100644 (file)
@@ -122,9 +122,9 @@ UPerfFunction* CharPerformanceTest::runIndexedTest(int32_t index, UBool exec,
         TESTCASE(21, TestStdLibIsWhiteSpace);
         default: 
             name = ""; 
-            return NULL;
+            return nullptr;
     }
-    return NULL;
+    return nullptr;
 }
 
 UPerfFunction* CharPerformanceTest::TestIsAlpha()
index bb93c072ab28b96ee36a167bce984644c2c30648..d9d652a7a09fd0001de53bee29b1a0725a9bc861 100644 (file)
@@ -91,7 +91,7 @@ public:
     ~CharPerformanceTest();
     virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec,
         const char *&name, 
-        char *par = NULL);     
+        char *par = nullptr);
     UPerfFunction* TestIsAlpha();
     UPerfFunction* TestIsUpper();
     UPerfFunction* TestIsLower();
index 50ec95403940d981a2a8d7b23e87b682f1efb086..0dc574af894c057fc7be79f2f77e7f117730e213 100644 (file)
@@ -836,7 +836,7 @@ void doForwardIterTest(UBool haslen) {
     printf("performance test on strings from file -----------\n");
 
     UChar dummytext[] = {0, 0};
-    UCollationElements *iter = ucol_openElements(gCol, NULL, 0, &error);
+    UCollationElements *iter = ucol_openElements(gCol, nullptr, 0, &error);
     ucol_setText(iter, dummytext, 1, &error);
     
     gCount = 0;
@@ -998,7 +998,7 @@ void doBackwardIterTest(UBool haslen) {
     
     printf("performance test on strings from file -----------\n");
 
-    UCollationElements *iter = ucol_openElements(gCol, NULL, 0, &error);
+    UCollationElements *iter = ucol_openElements(gCol, nullptr, 0, &error);
     UChar dummytext[] = {0, 0};
     ucol_setText(iter, dummytext, 1, &error);
 
@@ -1234,7 +1234,7 @@ UCharFile::UCharFile(const char * fileName) {
     fName                = fileName;
     fFile                = fopen(fName, "rb");
     fPending2ndSurrogate = 0;
-    if (fFile == NULL) {
+    if (fFile == nullptr) {
         fprintf(stderr, "Can not open file \"%s\"\n", opt_fName);
         fError = true;
         return;
@@ -1396,7 +1396,7 @@ UCollator *openRulesCollator() {
             tmp = buf;
             bufLen += 10000;
             buf = (UChar *)realloc(buf, bufLen);
-            if (buf == NULL) {
+            if (buf == nullptr) {
                 free(tmp);
                 return 0;
             }
@@ -1406,7 +1406,7 @@ UCollator *openRulesCollator() {
 
     UErrorCode    status = U_ZERO_ERROR;
     UCollator *coll = ucol_openRules(buf, u_strlen(buf), UCOL_OFF,
-                                         UCOL_DEFAULT_STRENGTH, NULL, &status);
+                                         UCOL_DEFAULT_STRENGTH, nullptr, &status);
     if (U_FAILURE(status)) {
         fprintf(stderr, "ICU ucol_openRules() open failed.: %d\n", status);
         return 0;
index ae8e00c1bfb2b2ead7d8d95857e8d9838baf1e7c..f27b8324bc2f2ad79fdc3491d64cf11e49a46a99 100644 (file)
@@ -40,11 +40,11 @@ struct CompactArrays{\
     UNIT    * data; /*the real space to hold strings*/ \
     \
     ~CompactArrays(){free(index);free(data);} \
-    CompactArrays():data(NULL), index(NULL), count(0){ \
+    CompactArrays():data(nullptr), index(nullptr), count(0){ \
     index = (int32_t *) realloc(index, sizeof(int32_t)); \
     index[0] = 0; \
     } \
-    void append_one(int32_t theLen){ /*include terminal NULL*/ \
+    void append_one(int32_t theLen){ /*include terminal NUL*/ \
     count++; \
     index = (int32_t *) realloc(index, sizeof(int32_t) * (count + 1)); \
     index[count] = index[count - 1] + theLen; \
@@ -52,7 +52,7 @@ struct CompactArrays{\
     } \
     UNIT * last(){return data + index[count - 1];} \
     UNIT * dataOf(int32_t i){return data + index[i];} \
-    int32_t lengthOf(int i){return index[i+1] - index[i] - 1; }        /*exclude terminating NULL*/  \
+    int32_t lengthOf(int i){return index[i+1] - index[i] - 1; }        /*exclude terminating NUL*/  \
 };
 
 //typedef CompactArrays<UChar> CA_uchar;
@@ -148,7 +148,7 @@ public:
         :count(count), data(data), fn(fn){
             exec_count = 0;
             UChar dummytext[] = {0, 0};
-            iter = ucol_openElements(col, NULL, 0, &status);
+            iter = ucol_openElements(col, nullptr, 0, &status);
             ucol_setText(iter, dummytext, 1, &status);
         }
         ~CmdIter(){
@@ -539,25 +539,25 @@ public:
     }
 
     CollPerfTest(int32_t argc, const char* argv[], UErrorCode& status):UPerfTest(argc, argv, status){
-        col = NULL;
-        icu_data_all = NULL;
-        icu_data = NULL;
-        icu_key = NULL;
-        posix_data = NULL;
-        posix_key = NULL;
-        win_data =NULL;
-        win_key = NULL;
-
-        rnd_index = NULL;
-        ord_win_data= NULL;
-        ord_win_key= NULL;
-        ord_posix_data= NULL;
-        ord_posix_key= NULL;
-        ord_icu_data= NULL;
-        ord_icu_key= NULL;
-        ord_win_wcscmp = NULL;
-        ord_icu_strcmp = NULL;
-        ord_icu_cmpcpo = NULL;
+        col = nullptr;
+        icu_data_all = nullptr;
+        icu_data = nullptr;
+        icu_key = nullptr;
+        posix_data = nullptr;
+        posix_key = nullptr;
+        win_data =nullptr;
+        win_key = nullptr;
+
+        rnd_index = nullptr;
+        ord_win_data= nullptr;
+        ord_win_key= nullptr;
+        ord_posix_data= nullptr;
+        ord_posix_key= nullptr;
+        ord_icu_data= nullptr;
+        ord_icu_key= nullptr;
+        ord_win_wcscmp = nullptr;
+        ord_icu_strcmp = nullptr;
+        ord_icu_cmpcpo = nullptr;
 
         if (U_FAILURE(status)){
             return;
@@ -588,7 +588,7 @@ public:
             return;
         }
 
-        if (locale == NULL){
+        if (locale == nullptr){
             locale = "en_US";   // set default locale
         }
 
@@ -673,18 +673,18 @@ public:
     UPerfFunction * t = new classname(status,arg1, arg2, arg3, arg4, arg5, arg6);\
     if (U_FAILURE(status)) {\
     delete t;\
-    return NULL;\
+    return nullptr;\
     } else {\
     return t;\
     }\
     } else {\
-    return NULL;\
+    return nullptr;\
     }\
     }\
     temp++\
 
 
-    virtual UPerfFunction* runIndexedTest( /*[in]*/int32_t index, /*[in]*/UBool exec, /*[out]*/const char* &name, /*[in]*/ char* par = NULL ){
+    virtual UPerfFunction* runIndexedTest( /*[in]*/int32_t index, /*[in]*/UBool exec, /*[out]*/const char* &name, /*[in]*/ char* par = nullptr ){
         int temp = 0;
 
 #define TEST_KEYGEN(testname, func)\
@@ -741,7 +741,7 @@ public:
         TEST_BIN(TestWin_BinarySearch_wcscmp, win_wcscmp);
 
         name="";
-        return NULL;
+        return nullptr;
     }
 
 
@@ -753,11 +753,11 @@ public:
         icu_data = new CA_uchar();
 
         // Following code is borrowed from UPerfTest::getLines();
-        const UChar*    line=NULL;
+        const UChar*    line=nullptr;
         int32_t         len =0;
         for (;;) {
             line = ucbuf_readline(ucharBuf,&len,&status);
-            if(line == NULL || U_FAILURE(status)){break;}
+            if(line == nullptr || U_FAILURE(status)){break;}
 
             // Refer to the source code of ucbuf_readline()
             // 1. 'len' includs the line terminal symbols
@@ -769,7 +769,7 @@ public:
             } else {
                 icu_data->append_one(len);
                 memcpy(icu_data->last(), line, len * sizeof(UChar));
-                icu_data->last()[len -1] = NULL;
+                icu_data->last()[len -1] = nullptr;
             }
         }
         if(U_FAILURE(status)) return;
@@ -780,11 +780,11 @@ public:
 
         count = icu_data->count;
 
-        icu_data_all_len =  icu_data->index[count]; // includes all NULLs
-        icu_data_all_len -= count;  // excludes all NULLs
-        icu_data_all_len += 1;      // the terminal NULL
+        icu_data_all_len =  icu_data->index[count]; // includes all NULs
+        icu_data_all_len -= count;  // excludes all NULs
+        icu_data_all_len += 1;      // the terminal NUL
         icu_data_all = new UChar[icu_data_all_len];
-        icu_data_all[icu_data_all_len - 1] = 0; //the terminal NULL
+        icu_data_all[icu_data_all_len - 1] = 0; //the terminal NUL
 
         icu_key  = new CA_uint8;
         win_data = new CA_win_wchar;
@@ -808,26 +808,26 @@ public:
             // ICU data
 
             // ICU key
-            s = ucol_getSortKey(col, icu_data->dataOf(i), -1,NULL, 0);
+            s = ucol_getSortKey(col, icu_data->dataOf(i), -1,nullptr, 0);
             icu_key->append_one(s);
             t = ucol_getSortKey(col, icu_data->dataOf(i), -1,icu_key->last(), s);
             if (t != s) {status = U_INVALID_FORMAT_ERROR;return;}
 
             // POSIX data
-            s = ucnv_fromUChars(conv,NULL, 0, icu_data->dataOf(i), icu_data->lengthOf(i), &status);
+            s = ucnv_fromUChars(conv,nullptr, 0, icu_data->dataOf(i), icu_data->lengthOf(i), &status);
             if (status == U_BUFFER_OVERFLOW_ERROR || status == U_ZERO_ERROR){
                 status = U_ZERO_ERROR;
             } else {
                 return;
             }
-            posix_data->append_one(s + 1); // plus terminal NULL
+            posix_data->append_one(s + 1); // plus terminal NUL
             t = ucnv_fromUChars(conv,posix_data->last(), s, icu_data->dataOf(i), icu_data->lengthOf(i), &status);
             if (U_FAILURE(status)) return;
             if ( t != s){status = U_INVALID_FORMAT_ERROR;return;}
             posix_data->last()[s] = 0;
 
             // POSIX key
-            s = strxfrm(NULL, posix_data->dataOf(i), 0);
+            s = strxfrm(nullptr, posix_data->dataOf(i), 0);
             if (s == INT_MAX){status = U_INVALID_FORMAT_ERROR;return;}
             posix_key->append_one(s);
             t = strxfrm(posix_key->last(), posix_data->dataOf(i), s);
@@ -835,12 +835,12 @@ public:
 
 #if U_PLATFORM_HAS_WIN32_API
             // Win data
-            s = icu_data->lengthOf(i) + 1; // plus terminal NULL
+            s = icu_data->lengthOf(i) + 1; // plus terminal NUL
             win_data->append_one(s);
             memcpy(win_data->last(), icu_data->dataOf(i), sizeof(WCHAR) * s);
 
             // Win key
-            s = LCMapStringW(win_langid, LCMAP_SORTKEY, win_data->dataOf(i), win_data->lengthOf(i), NULL,0);
+            s = LCMapStringW(win_langid, LCMAP_SORTKEY, win_data->dataOf(i), win_data->lengthOf(i), nullptr,0);
             if (s == 0) {status = U_INVALID_FORMAT_ERROR;return;}
             win_key->append_one(s);
             t = LCMapStringW(win_langid, LCMAP_SORTKEY, win_data->dataOf(i), win_data->lengthOf(i), (WCHAR *)(win_key->last()),s);
index 1f80b3716138a5b7b9097b16a8c1a03b2e41c3d5..2bc33f734c1b7597ef0aede63e6079034497aa21 100644 (file)
@@ -30,11 +30,11 @@ struct CompactArrays{\
     UNIT    * data; /*the real space to hold strings*/ \
     \
     ~CompactArrays(){free(index);free(data);} \
-    CompactArrays() : count(0), index(NULL), data(NULL) { \
+    CompactArrays() : count(0), index(nullptr), data(nullptr) { \
         index = (int32_t *) realloc(index, sizeof(int32_t)); \
         index[0] = 0; \
     } \
-    void append_one(int32_t theLen){ /*include terminal NULL*/ \
+    void append_one(int32_t theLen){ /*include terminal NUL*/ \
         count++; \
         index = (int32_t *) realloc(index, sizeof(int32_t) * (count + 1)); \
         index[count] = index[count - 1] + theLen; \
@@ -42,7 +42,7 @@ struct CompactArrays{\
     } \
     UNIT * last(){return data + index[count - 1];} \
     const UNIT * dataOf(int32_t i) const {return data + index[i];} \
-    int32_t lengthOf(int i) const {return index[i+1] - index[i] - 1; } /*exclude terminating NULL*/  \
+    int32_t lengthOf(int i) const {return index[i+1] - index[i] - 1; } /*exclude terminating NUL*/  \
 };
 
 COMPACT_ARRAY(CA_uchar, UChar)
@@ -746,7 +746,7 @@ long CppGetCollationKey::getOperationsPerIteration() {
 namespace {
 
 struct CollatorAndCounter {
-    CollatorAndCounter(const Collator& coll) : coll(coll), ucoll(NULL), counter(0) {}
+    CollatorAndCounter(const Collator& coll) : coll(coll), ucoll(nullptr), counter(0) {}
     CollatorAndCounter(const Collator& coll, const UCollator *ucoll)
             : coll(coll), ucoll(ucoll), counter(0) {}
     const Collator& coll;
@@ -1046,7 +1046,7 @@ public:
     CollPerf2Test(int32_t argc, const char *argv[], UErrorCode &status);
     ~CollPerf2Test();
     virtual UPerfFunction* runIndexedTest(
-        int32_t index, UBool exec, const char *&name, char *par = NULL);
+        int32_t index, UBool exec, const char *&name, char *par = nullptr);
 
 private:
     UCollator* coll;
@@ -1130,23 +1130,23 @@ private:
 
 CollPerf2Test::CollPerf2Test(int32_t argc, const char *argv[], UErrorCode &status) :
     UPerfTest(argc, argv, status),
-    coll(NULL),
-    collObj(NULL),
+    coll(nullptr),
+    collObj(nullptr),
     count(0),
-    data16(NULL),
-    data8(NULL),
-    modData16(NULL),
-    modData8(NULL),
-    sortedData16(NULL),
-    sortedData8(NULL),
-    randomData16(NULL),
-    randomData8(NULL)
+    data16(nullptr),
+    data8(nullptr),
+    modData16(nullptr),
+    modData8(nullptr),
+    sortedData16(nullptr),
+    sortedData8(nullptr),
+    randomData16(nullptr),
+    randomData8(nullptr)
 {
     if (U_FAILURE(status)) {
         return;
     }
 
-    if (locale == NULL){
+    if (locale == nullptr){
         locale = "root";
     }
 
@@ -1175,17 +1175,17 @@ CollPerf2Test::~CollPerf2Test()
 
 const CA_uchar* CollPerf2Test::getData16(UErrorCode &status)
 {
-    if (U_FAILURE(status)) return NULL;
+    if (U_FAILURE(status)) return nullptr;
     if (data16) return data16;
 
     CA_uchar* d16 = new CA_uchar();
-    const UChar *line = NULL;
+    const UChar *line = nullptr;
     int32_t len = 0;
     int32_t numData = 0;
 
     for (;;) {
         line = ucbuf_readline(ucharBuf, &len, &status);
-        if (line == NULL || U_FAILURE(status)) break;
+        if (line == nullptr || U_FAILURE(status)) break;
 
         // Refer to the source code of ucbuf_readline()
         // 1. 'len' includes the line terminal symbols
@@ -1216,24 +1216,24 @@ const CA_uchar* CollPerf2Test::getData16(UErrorCode &status)
 
 const CA_char* CollPerf2Test::getData8(UErrorCode &status)
 {
-    if (U_FAILURE(status)) return NULL;
+    if (U_FAILURE(status)) return nullptr;
     if (data8) return data8;
     return data8 = getData8FromData16(getData16(status), status);
 }
 
 const CA_uchar* CollPerf2Test::getModData16(UErrorCode &status)
 {
-    if (U_FAILURE(status)) return NULL;
+    if (U_FAILURE(status)) return nullptr;
     if (modData16) return modData16;
 
     const CA_uchar* d16 = getData16(status);
-    if (U_FAILURE(status)) return NULL;
+    if (U_FAILURE(status)) return nullptr;
 
     CA_uchar* modData16 = new CA_uchar();
 
     for (int32_t i = 0; i < d16->count; i++) {
         const UChar *s = d16->dataOf(i);
-        int32_t len = d16->lengthOf(i) + 1; // including NULL terminator
+        int32_t len = d16->lengthOf(i) + 1; // including NUL terminator
 
         modData16->append_one(len);
         u_memcpy(modData16->last(), s, len);
@@ -1258,7 +1258,7 @@ const CA_uchar* CollPerf2Test::getModData16(UErrorCode &status)
 
 const CA_char* CollPerf2Test::getModData8(UErrorCode &status)
 {
-    if (U_FAILURE(status)) return NULL;
+    if (U_FAILURE(status)) return nullptr;
     if (modData8) return modData8;
     return modData8 = getData8FromData16(getModData16(status), status);
 }
@@ -1296,7 +1296,7 @@ U16HashComparator(const void* context, const void* left, const void* right) {
 }  // namespace
 
 const CA_uchar* CollPerf2Test::getSortedData16(UErrorCode &status) {
-    if (U_FAILURE(status)) return NULL;
+    if (U_FAILURE(status)) return nullptr;
     if (sortedData16) return sortedData16;
 
     ArrayAndColl ac(getData16(status), *collObj);
@@ -1304,13 +1304,13 @@ const CA_uchar* CollPerf2Test::getSortedData16(UErrorCode &status) {
 }
 
 const CA_char* CollPerf2Test::getSortedData8(UErrorCode &status) {
-    if (U_FAILURE(status)) return NULL;
+    if (U_FAILURE(status)) return nullptr;
     if (sortedData8) return sortedData8;
     return sortedData8 = getData8FromData16(getSortedData16(status), status);
 }
 
 const CA_uchar* CollPerf2Test::getRandomData16(UErrorCode &status) {
-    if (U_FAILURE(status)) return NULL;
+    if (U_FAILURE(status)) return nullptr;
     if (randomData16) return randomData16;
 
     // Sort the strings by their hash codes, which should be a reasonably pseudo-random order.
@@ -1319,7 +1319,7 @@ const CA_uchar* CollPerf2Test::getRandomData16(UErrorCode &status) {
 }
 
 const CA_char* CollPerf2Test::getRandomData8(UErrorCode &status) {
-    if (U_FAILURE(status)) return NULL;
+    if (U_FAILURE(status)) return nullptr;
     if (randomData8) return randomData8;
     return randomData8 = getData8FromData16(getRandomData16(status), status);
 }
@@ -1327,14 +1327,14 @@ const CA_char* CollPerf2Test::getRandomData8(UErrorCode &status) {
 CA_uchar* CollPerf2Test::sortData16(const CA_uchar* d16,
                                     UComparator *cmp, const void *context,
                                     UErrorCode &status) {
-    if (U_FAILURE(status)) return NULL;
+    if (U_FAILURE(status)) return nullptr;
 
     LocalArray<int32_t> indexes(new int32_t[d16->count]);
     for (int32_t i = 0; i < d16->count; ++i) {
         indexes[i] = i;
     }
     uprv_sortArray(indexes.getAlias(), d16->count, 4, cmp, context, true, &status);
-    if (U_FAILURE(status)) return NULL;
+    if (U_FAILURE(status)) return nullptr;
 
     // Copy the strings in sorted order into a new array.
     LocalPointer<CA_uchar> newD16(new CA_uchar());
@@ -1342,7 +1342,7 @@ CA_uchar* CollPerf2Test::sortData16(const CA_uchar* d16,
         int32_t j = indexes[i];
         const UChar* s = d16->dataOf(j);
         int32_t len = d16->lengthOf(j);
-        int32_t capacity = len + 1;  // including NULL terminator
+        int32_t capacity = len + 1;  // including NUL terminator
         newD16->append_one(capacity);
         u_memcpy(newD16->last(), s, capacity);
     }
@@ -1350,12 +1350,12 @@ CA_uchar* CollPerf2Test::sortData16(const CA_uchar* d16,
     if (U_SUCCESS(status)) {
         return newD16.orphan();
     } else {
-        return NULL;
+        return nullptr;
     }
 }
 
 CA_char* CollPerf2Test::getData8FromData16(const CA_uchar* d16, UErrorCode &status) {
-    if (U_FAILURE(status)) return NULL;
+    if (U_FAILURE(status)) return nullptr;
 
     // UTF-16 -> UTF-8 conversion
     LocalPointer<CA_char> d8(new CA_char());
@@ -1365,29 +1365,29 @@ CA_char* CollPerf2Test::getData8FromData16(const CA_uchar* d16, UErrorCode &stat
 
         // get length in UTF-8
         int32_t length8;
-        u_strToUTF8(NULL, 0, &length8, s16, length16, &status);
+        u_strToUTF8(nullptr, 0, &length8, s16, length16, &status);
         if (status == U_BUFFER_OVERFLOW_ERROR || status == U_ZERO_ERROR){
             status = U_ZERO_ERROR;
         } else {
             break;
         }
-        int32_t capacity8 = length8 + 1;  // plus terminal NULL
+        int32_t capacity8 = length8 + 1;  // plus terminal NUL
         d8->append_one(capacity8);
 
         // convert to UTF-8
-        u_strToUTF8(d8->last(), capacity8, NULL, s16, length16, &status);
+        u_strToUTF8(d8->last(), capacity8, nullptr, s16, length16, &status);
         if (U_FAILURE(status)) break;
     }
 
     if (U_SUCCESS(status)) {
         return d8.orphan();
     } else {
-        return NULL;
+        return nullptr;
     }
 }
 
 UPerfFunction*
-CollPerf2Test::runIndexedTest(int32_t index, UBool exec, const char *&name, char *par /*= NULL*/)
+CollPerf2Test::runIndexedTest(int32_t index, UBool exec, const char *&name, char *par /*= nullptr*/)
 {
     (void)par;
     TESTCASE_AUTO_BEGIN;
@@ -1435,7 +1435,7 @@ CollPerf2Test::runIndexedTest(int32_t index, UBool exec, const char *&name, char
     TESTCASE_AUTO(TestStringPieceBinSearchC);
 
     TESTCASE_AUTO_END;
-    return NULL;
+    return nullptr;
 }
 
 
@@ -1446,7 +1446,7 @@ UPerfFunction* CollPerf2Test::TestStrcoll()
     Strcoll *testCase = new Strcoll(coll, getData16(status), true /* useLen */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1457,7 +1457,7 @@ UPerfFunction* CollPerf2Test::TestStrcollNull()
     Strcoll *testCase = new Strcoll(coll, getData16(status), false /* useLen */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1468,7 +1468,7 @@ UPerfFunction* CollPerf2Test::TestStrcollSimilar()
     Strcoll_2 *testCase = new Strcoll_2(coll, getData16(status), getModData16(status), true /* useLen */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1479,7 +1479,7 @@ UPerfFunction* CollPerf2Test::TestStrcollUTF8()
     StrcollUTF8 *testCase = new StrcollUTF8(coll, getData8(status), true /* useLen */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1490,7 +1490,7 @@ UPerfFunction* CollPerf2Test::TestStrcollUTF8Null()
     StrcollUTF8 *testCase = new StrcollUTF8(coll, getData8(status),false /* useLen */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1501,7 +1501,7 @@ UPerfFunction* CollPerf2Test::TestStrcollUTF8Similar()
     StrcollUTF8_2 *testCase = new StrcollUTF8_2(coll, getData8(status), getModData8(status), true /* useLen */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1512,7 +1512,7 @@ UPerfFunction* CollPerf2Test::TestGetSortKey()
     GetSortKey *testCase = new GetSortKey(coll, getData16(status), true /* useLen */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1523,7 +1523,7 @@ UPerfFunction* CollPerf2Test::TestGetSortKeyNull()
     GetSortKey *testCase = new GetSortKey(coll, getData16(status), false /* useLen */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1534,7 +1534,7 @@ UPerfFunction* CollPerf2Test::TestNextSortKeyPart_4All()
     NextSortKeyPart *testCase = new NextSortKeyPart(coll, getData16(status), 4 /* bufSize */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1545,7 +1545,7 @@ UPerfFunction* CollPerf2Test::TestNextSortKeyPart_4x4()
     NextSortKeyPart *testCase = new NextSortKeyPart(coll, getData16(status), 4 /* bufSize */, 4 /* maxIteration */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1556,7 +1556,7 @@ UPerfFunction* CollPerf2Test::TestNextSortKeyPart_4x8()
     NextSortKeyPart *testCase = new NextSortKeyPart(coll, getData16(status), 4 /* bufSize */, 8 /* maxIteration */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1567,7 +1567,7 @@ UPerfFunction* CollPerf2Test::TestNextSortKeyPart_32All()
     NextSortKeyPart *testCase = new NextSortKeyPart(coll, getData16(status), 32 /* bufSize */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1578,7 +1578,7 @@ UPerfFunction* CollPerf2Test::TestNextSortKeyPart_32x2()
     NextSortKeyPart *testCase = new NextSortKeyPart(coll, getData16(status), 32 /* bufSize */, 2 /* maxIteration */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1589,7 +1589,7 @@ UPerfFunction* CollPerf2Test::TestNextSortKeyPartUTF8_4All()
     NextSortKeyPartUTF8 *testCase = new NextSortKeyPartUTF8(coll, getData8(status), 4 /* bufSize */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1600,7 +1600,7 @@ UPerfFunction* CollPerf2Test::TestNextSortKeyPartUTF8_4x4()
     NextSortKeyPartUTF8 *testCase = new NextSortKeyPartUTF8(coll, getData8(status), 4 /* bufSize */, 4 /* maxIteration */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1611,7 +1611,7 @@ UPerfFunction* CollPerf2Test::TestNextSortKeyPartUTF8_4x8()
     NextSortKeyPartUTF8 *testCase = new NextSortKeyPartUTF8(coll, getData8(status), 4 /* bufSize */, 8 /* maxIteration */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1622,7 +1622,7 @@ UPerfFunction* CollPerf2Test::TestNextSortKeyPartUTF8_32All()
     NextSortKeyPartUTF8 *testCase = new NextSortKeyPartUTF8(coll, getData8(status), 32 /* bufSize */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1633,7 +1633,7 @@ UPerfFunction* CollPerf2Test::TestNextSortKeyPartUTF8_32x2()
     NextSortKeyPartUTF8 *testCase = new NextSortKeyPartUTF8(coll, getData8(status), 32 /* bufSize */, 2 /* maxIteration */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1644,7 +1644,7 @@ UPerfFunction* CollPerf2Test::TestCppCompare()
     CppCompare *testCase = new CppCompare(collObj, getData16(status), true /* useLen */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1655,7 +1655,7 @@ UPerfFunction* CollPerf2Test::TestCppCompareNull()
     CppCompare *testCase = new CppCompare(collObj, getData16(status), false /* useLen */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1666,7 +1666,7 @@ UPerfFunction* CollPerf2Test::TestCppCompareSimilar()
     CppCompare_2 *testCase = new CppCompare_2(collObj, getData16(status), getModData16(status), true /* useLen */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1677,7 +1677,7 @@ UPerfFunction* CollPerf2Test::TestCppCompareUTF8()
     CppCompareUTF8 *testCase = new CppCompareUTF8(collObj, getData8(status), true /* useLen */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1688,7 +1688,7 @@ UPerfFunction* CollPerf2Test::TestCppCompareUTF8Null()
     CppCompareUTF8 *testCase = new CppCompareUTF8(collObj, getData8(status), false /* useLen */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1699,7 +1699,7 @@ UPerfFunction* CollPerf2Test::TestCppCompareUTF8Similar()
     CppCompareUTF8_2 *testCase = new CppCompareUTF8_2(collObj, getData8(status), getModData8(status), true /* useLen */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1710,7 +1710,7 @@ UPerfFunction* CollPerf2Test::TestCppGetCollationKey()
     CppGetCollationKey *testCase = new CppGetCollationKey(collObj, getData16(status), true /* useLen */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1721,7 +1721,7 @@ UPerfFunction* CollPerf2Test::TestCppGetCollationKeyNull()
     CppGetCollationKey *testCase = new CppGetCollationKey(collObj, getData16(status), false /* useLen */);
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1731,7 +1731,7 @@ UPerfFunction* CollPerf2Test::TestUniStrSort() {
     UPerfFunction *testCase = new UniStrSort(*collObj, coll, getRandomData16(status));
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1741,7 +1741,7 @@ UPerfFunction* CollPerf2Test::TestStringPieceSortCpp() {
     UPerfFunction *testCase = new StringPieceSortCpp(*collObj, coll, getRandomData8(status));
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1751,7 +1751,7 @@ UPerfFunction* CollPerf2Test::TestStringPieceSortC() {
     UPerfFunction *testCase = new StringPieceSortC(*collObj, coll, getRandomData8(status));
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1761,7 +1761,7 @@ UPerfFunction* CollPerf2Test::TestUniStrBinSearch() {
     UPerfFunction *testCase = new UniStrBinSearch(*collObj, coll, getSortedData16(status));
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1771,7 +1771,7 @@ UPerfFunction* CollPerf2Test::TestStringPieceBinSearchCpp() {
     UPerfFunction *testCase = new StringPieceBinSearchCpp(*collObj, coll, getSortedData8(status));
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
@@ -1781,7 +1781,7 @@ UPerfFunction* CollPerf2Test::TestStringPieceBinSearchC() {
     UPerfFunction *testCase = new StringPieceBinSearchC(*collObj, coll, getSortedData8(status));
     if (U_FAILURE(status)) {
         delete testCase;
-        return NULL;
+        return nullptr;
     }
     return testCase;
 }
index d6790f304c19b3c895520662da9f620654df5894..5a583bc047b616b54171274b65a692f30cb71a20 100644 (file)
@@ -118,9 +118,9 @@ UPerfFunction* ConverterPerformanceTest::runIndexedTest(int32_t index, UBool exe
 
         default: 
             name = ""; 
-            return NULL;
+            return nullptr;
     }
-    return NULL;
+    return nullptr;
 
 }
 
@@ -128,7 +128,7 @@ UPerfFunction* ConverterPerformanceTest::TestICU_CleanOpenAllConverters() {
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new ICUOpenAllConvertersFunction(true, status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -137,7 +137,7 @@ UPerfFunction* ConverterPerformanceTest::TestICU_OpenAllConverters() {
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new ICUOpenAllConvertersFunction(false, status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -146,7 +146,7 @@ UPerfFunction* ConverterPerformanceTest::TestICU_UTF8_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("utf-8", (UChar *)utf8_uniSource, UPRV_LENGTHOF(utf8_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -155,7 +155,7 @@ UPerfFunction*  ConverterPerformanceTest::TestICU_UTF8_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new ICUToUnicodePerfFunction("utf-8",(char*)utf8_encSource, UPRV_LENGTHOF(utf8_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -165,7 +165,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinIML2_UTF8_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("utf-8",utf8_uniSource, UPRV_LENGTHOF(utf8_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -174,7 +174,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinIML2_UTF8_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("utf-8",(char*)utf8_encSource, UPRV_LENGTHOF(utf8_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -183,7 +183,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinANSI_UTF8_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("utf-8",utf8_uniSource, UPRV_LENGTHOF(utf8_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -192,7 +192,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinANSI_UTF8_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIToUnicodePerfFunction("utf-8",(char*)utf8_encSource, UPRV_LENGTHOF(utf8_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -203,7 +203,7 @@ UPerfFunction* ConverterPerformanceTest::TestICU_Latin1_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("iso-8859-1", (UChar *)latin1_uniSource, UPRV_LENGTHOF(latin1_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -212,7 +212,7 @@ UPerfFunction*  ConverterPerformanceTest::TestICU_Latin1_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new ICUToUnicodePerfFunction("iso-8859-1",(char*)latin1_encSource, UPRV_LENGTHOF(latin1_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -222,7 +222,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinIML2_Latin1_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("iso-8859-1",latin1_uniSource, UPRV_LENGTHOF(latin1_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -231,7 +231,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinIML2_Latin1_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("iso-8859-1",(char*)latin1_encSource, UPRV_LENGTHOF(latin1_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -240,7 +240,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinANSI_Latin1_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("iso-8859-1",latin1_uniSource, UPRV_LENGTHOF(latin1_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -249,7 +249,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinANSI_Latin1_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIToUnicodePerfFunction("iso-8859-1",(char*)latin1_encSource, UPRV_LENGTHOF(latin1_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -260,7 +260,7 @@ UPerfFunction* ConverterPerformanceTest::TestICU_Latin8_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("iso-8859-8", (UChar *)latin8_uniSource, UPRV_LENGTHOF(latin8_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -269,7 +269,7 @@ UPerfFunction*  ConverterPerformanceTest::TestICU_Latin8_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new ICUToUnicodePerfFunction("iso-8859-8",(char*)latin8_encSource, UPRV_LENGTHOF(latin8_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -279,7 +279,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinIML2_Latin8_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("iso-8859-8",latin8_uniSource, UPRV_LENGTHOF(latin8_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -288,7 +288,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinIML2_Latin8_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("iso-8859-8",(char*)latin8_encSource, UPRV_LENGTHOF(latin8_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -296,7 +296,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinANSI_Latin8_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("iso-8859-8",latin8_uniSource, UPRV_LENGTHOF(latin8_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -305,7 +305,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinANSI_Latin8_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIToUnicodePerfFunction("iso-8859-8",(char*)latin8_encSource, UPRV_LENGTHOF(latin8_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -317,7 +317,7 @@ UPerfFunction* ConverterPerformanceTest::TestICU_EBCDIC_Arabic_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("x-EBCDIC-Arabic", (UChar *)ebcdic_arabic_uniSource, UPRV_LENGTHOF(ebcdic_arabic_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -326,7 +326,7 @@ UPerfFunction*  ConverterPerformanceTest::TestICU_EBCDIC_Arabic_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new ICUToUnicodePerfFunction("x-EBCDIC-Arabic",(char*)ebcdic_arabic_encSource, UPRV_LENGTHOF(ebcdic_arabic_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -336,7 +336,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinIML2_EBCDIC_Arabic_FromUnicode()
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("x-EBCDIC-Arabic",ebcdic_arabic_uniSource, UPRV_LENGTHOF(ebcdic_arabic_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -345,7 +345,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinIML2_EBCDIC_Arabic_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("x-EBCDIC-Arabic",(char*)ebcdic_arabic_encSource, UPRV_LENGTHOF(ebcdic_arabic_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -354,7 +354,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinANSI_EBCDIC_Arabic_FromUnicode()
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("x-EBCDIC-Arabic",ebcdic_arabic_uniSource, UPRV_LENGTHOF(ebcdic_arabic_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -363,7 +363,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinANSI_EBCDIC_Arabic_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIToUnicodePerfFunction("x-EBCDIC-Arabic",(char*)ebcdic_arabic_encSource, UPRV_LENGTHOF(ebcdic_arabic_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -374,7 +374,7 @@ UPerfFunction* ConverterPerformanceTest::TestICU_SJIS_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("sjis", (UChar *)sjis_uniSource, UPRV_LENGTHOF(sjis_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -383,7 +383,7 @@ UPerfFunction*  ConverterPerformanceTest::TestICU_SJIS_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new ICUToUnicodePerfFunction("sjis",(char*)sjis_encSource, UPRV_LENGTHOF(sjis_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -393,7 +393,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinIML2_SJIS_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("sjis",sjis_uniSource, UPRV_LENGTHOF(sjis_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -402,7 +402,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinIML2_SJIS_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("sjis",(char*)sjis_encSource, UPRV_LENGTHOF(sjis_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -411,7 +411,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinANSI_SJIS_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("sjis",sjis_uniSource, UPRV_LENGTHOF(sjis_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -420,7 +420,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinANSI_SJIS_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIToUnicodePerfFunction("sjis",(char*)sjis_encSource, UPRV_LENGTHOF(sjis_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -433,7 +433,7 @@ UPerfFunction* ConverterPerformanceTest::TestICU_EUCJP_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("euc-jp", (UChar *)eucjp_uniSource, UPRV_LENGTHOF(eucjp_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -442,7 +442,7 @@ UPerfFunction*  ConverterPerformanceTest::TestICU_EUCJP_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new ICUToUnicodePerfFunction("euc-jp",(char*)eucjp_encSource, UPRV_LENGTHOF(eucjp_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -452,7 +452,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinIML2_EUCJP_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("euc-jp",eucjp_uniSource, UPRV_LENGTHOF(eucjp_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -461,7 +461,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinIML2_EUCJP_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("euc-jp",(char*)eucjp_encSource, UPRV_LENGTHOF(eucjp_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -470,7 +470,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinANSI_EUCJP_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("euc-jp",eucjp_uniSource, UPRV_LENGTHOF(eucjp_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -479,7 +479,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinANSI_EUCJP_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIToUnicodePerfFunction("euc-jp",(char*)eucjp_encSource, UPRV_LENGTHOF(eucjp_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -492,7 +492,7 @@ UPerfFunction* ConverterPerformanceTest::TestICU_GB2312_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("gb2312", (UChar *)gb2312_uniSource, UPRV_LENGTHOF(gb2312_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -501,7 +501,7 @@ UPerfFunction*  ConverterPerformanceTest::TestICU_GB2312_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new ICUToUnicodePerfFunction("gb2312",(char*)gb2312_encSource, UPRV_LENGTHOF(gb2312_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -511,7 +511,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinIML2_GB2312_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("gb2312",gb2312_uniSource, UPRV_LENGTHOF(gb2312_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -520,7 +520,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinIML2_GB2312_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("gb2312",(char*)gb2312_encSource, UPRV_LENGTHOF(gb2312_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -529,7 +529,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinANSI_GB2312_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("gb2312",gb2312_uniSource, UPRV_LENGTHOF(gb2312_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -538,7 +538,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinANSI_GB2312_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIToUnicodePerfFunction("gb2312",(char*)gb2312_encSource, UPRV_LENGTHOF(gb2312_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -550,7 +550,7 @@ UPerfFunction* ConverterPerformanceTest::TestICU_ISO2022KR_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("iso-2022-kr", (UChar *)iso2022kr_uniSource, UPRV_LENGTHOF(iso2022kr_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -559,7 +559,7 @@ UPerfFunction*  ConverterPerformanceTest::TestICU_ISO2022KR_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new ICUToUnicodePerfFunction("iso-2022-kr",(char*)iso2022kr_encSource, UPRV_LENGTHOF(iso2022kr_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -569,7 +569,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinIML2_ISO2022KR_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("iso-2022-kr",iso2022kr_uniSource, UPRV_LENGTHOF(iso2022kr_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -578,7 +578,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinIML2_ISO2022KR_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("iso-2022-kr",(char*)iso2022kr_encSource, UPRV_LENGTHOF(iso2022kr_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -587,7 +587,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinANSI_ISO2022KR_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("iso-2022-kr",iso2022kr_uniSource, UPRV_LENGTHOF(iso2022kr_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -596,7 +596,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinANSI_ISO2022KR_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIToUnicodePerfFunction("iso-2022-kr",(char*)iso2022kr_encSource, UPRV_LENGTHOF(iso2022kr_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -607,7 +607,7 @@ UPerfFunction* ConverterPerformanceTest::TestICU_ISO2022JP_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     ICUFromUnicodePerfFunction* pf = new ICUFromUnicodePerfFunction("iso-2022-jp", (UChar *)iso2022jp_uniSource, UPRV_LENGTHOF(iso2022jp_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -616,7 +616,7 @@ UPerfFunction*  ConverterPerformanceTest::TestICU_ISO2022JP_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new ICUToUnicodePerfFunction("iso-2022-jp",(char*)iso2022jp_encSource, UPRV_LENGTHOF(iso2022jp_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -626,7 +626,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinIML2_ISO2022JP_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2FromUnicodePerfFunction("iso-2022-jp",iso2022jp_uniSource, UPRV_LENGTHOF(iso2022jp_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -635,7 +635,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinIML2_ISO2022JP_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinIMultiLanguage2ToUnicodePerfFunction("iso-2022-jp",(char*)iso2022jp_encSource, UPRV_LENGTHOF(iso2022jp_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -644,7 +644,7 @@ UPerfFunction* ConverterPerformanceTest::TestWinANSI_ISO2022JP_FromUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIFromUnicodePerfFunction("iso-2022-jp",iso2022jp_uniSource, UPRV_LENGTHOF(iso2022jp_uniSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
@@ -653,7 +653,7 @@ UPerfFunction*  ConverterPerformanceTest::TestWinANSI_ISO2022JP_ToUnicode(){
     UErrorCode status = U_ZERO_ERROR;
     UPerfFunction* pf = new WinANSIToUnicodePerfFunction("iso-2022-jp",(char*)iso2022jp_encSource, UPRV_LENGTHOF(iso2022jp_encSource), status);
     if(U_FAILURE(status)){
-        return NULL;
+        return nullptr;
     }
     return pf;
 }
index c5de6d80031df41378aae2074fbc0ceda8734d5d..aef9b633a111fb5bae8da1e3030d48100c453b49 100644 (file)
@@ -39,18 +39,18 @@ public:
         src = source;
         srcLen = sourceLen;
         if(U_FAILURE(status)){
-            conv = NULL;
+            conv = nullptr;
             return;
         }
-        target = NULL;
-        targetLimit = NULL;
+        target = nullptr;
+        targetLimit = nullptr;
         int32_t reqdLen = ucnv_toUChars(conv,   target, 0,
                                         source, srcLen, &status);
         if(status==U_BUFFER_OVERFLOW_ERROR) {
             status=U_ZERO_ERROR;
             target=(UChar*)malloc((reqdLen) * U_SIZEOF_UCHAR*2);
             targetLimit = target + reqdLen;
-            if(target == NULL){
+            if(target == nullptr){
                 status = U_MEMORY_ALLOCATION_ERROR;
                 return;
             }
@@ -60,7 +60,7 @@ public:
         const char* mySrc = src;
         const char* sourceLimit = src + srcLen;
         UChar* myTarget = target;
-        ucnv_toUnicode(conv, &myTarget, targetLimit, &mySrc, sourceLimit, NULL, true, status);
+        ucnv_toUnicode(conv, &myTarget, targetLimit, &mySrc, sourceLimit, nullptr, true, status);
     }
     virtual long getOperationsPerIteration(void){
         return srcLen;
@@ -85,18 +85,18 @@ public:
         src = source;
         srcLen = sourceLen;
         if(U_FAILURE(status)){
-            conv = NULL;
+            conv = nullptr;
             return;
         }
-        target = NULL;
-        targetLimit = NULL;
+        target = nullptr;
+        targetLimit = nullptr;
         int32_t reqdLen = ucnv_fromUChars(conv,   target, 0,
                                           source, srcLen, &status);
         if(status==U_BUFFER_OVERFLOW_ERROR) {
             status=U_ZERO_ERROR;
             target=(char*)malloc((reqdLen*2));
             targetLimit = target + reqdLen;
-            if(target == NULL){
+            if(target == nullptr){
                 status = U_MEMORY_ALLOCATION_ERROR;
                 return;
             }
@@ -106,7 +106,7 @@ public:
         const UChar* mySrc = src;
         const UChar* sourceLimit = src + srcLen;
         char* myTarget = target;
-        ucnv_fromUnicode(conv,&myTarget, targetLimit, &mySrc, sourceLimit, NULL, true, status);
+        ucnv_fromUnicode(conv,&myTarget, targetLimit, &mySrc, sourceLimit, nullptr, true, status);
     }
     virtual long getOperationsPerIteration(void){
         return srcLen;
@@ -172,12 +172,12 @@ public:
         }
         LPMULTILANGUAGE2 pMulti;
         
-        CoInitialize(NULL);
+        CoInitialize(nullptr);
 
         /* create instance of converter object*/
         CoCreateInstance(
                           __uuidof(CMultiLanguage),
-                          NULL,
+                          nullptr,
                           CLSCTX_SERVER,
                           __uuidof(IMultiLanguage2),
                           (void**)&pMulti
@@ -227,12 +227,12 @@ public:
         }
         LPMULTILANGUAGE2 pMulti;
         
-        CoInitialize(NULL);
+        CoInitialize(nullptr);
 
         /* create instance of converter object*/
         CoCreateInstance(
                           __uuidof(CMultiLanguage),
-                          NULL,
+                          nullptr,
                           CLSCTX_SERVER,
                           __uuidof(IMultiLanguage2),
                           (void**)&pMulti
@@ -248,8 +248,8 @@ public:
         uiCodePage = (mimeInfo.uiInternetEncoding==0)?mimeInfo.uiCodePage:mimeInfo.uiInternetEncoding;
     }
     virtual void call(UErrorCode* status){
-        BOOL* pUsedDefaultChar =(uiCodePage==CP_UTF8)?NULL:&lpUsedDefaultChar;
-        int winSize = WideCharToMultiByte(uiCodePage,CONVERSION_FLAGS,src,srcLen,dest,dstLen,NULL, pUsedDefaultChar);
+        BOOL* pUsedDefaultChar =(uiCodePage==CP_UTF8)?nullptr:&lpUsedDefaultChar;
+        int winSize = WideCharToMultiByte(uiCodePage,CONVERSION_FLAGS,src,srcLen,dest,dstLen,nullptr, pUsedDefaultChar);
     }
     virtual long getOperationsPerIteration(void){
         return srcLen;
@@ -283,12 +283,12 @@ private:
 public:
     WinIMultiLanguageToUnicodePerfFunction(const char* name,char* source, UINT sourceLen, UErrorCode& status){
              
-        CoInitialize(NULL);
+        CoInitialize(nullptr);
 
         /* create instance of converter object*/
         CoCreateInstance(
                           __uuidof(CMultiLanguage),
-                          NULL,
+                          nullptr,
                           CLSCTX_SERVER,
                           __uuidof(IMultiLanguage2),
                           (void**)&pMulti
@@ -339,12 +339,12 @@ private:
 public:
     WinIMultiLanguageFromUnicodePerfFunction(const char* name,WCHAR* source, UINT sourceLen, UErrorCode& status){
              
-        CoInitialize(NULL);
+        CoInitialize(nullptr);
 
         /* create instance of converter object*/
         CoCreateInstance(
                           __uuidof(CMultiLanguage),
-                          NULL,
+                          nullptr,
                           CLSCTX_SERVER,
                           __uuidof(IMultiLanguage2),
                           (void**)&pMulti
@@ -395,12 +395,12 @@ private:
 public:
     WinIMultiLanguage2ToUnicodePerfFunction(const char* name,char* source, UINT sourceLen, UErrorCode& status){
              
-        CoInitialize(NULL);
+        CoInitialize(nullptr);
 
         /* create instance of converter object*/
         CoCreateInstance(
                           __uuidof(CMultiLanguage),
-                          NULL,
+                          nullptr,
                           CLSCTX_SERVER,
                           __uuidof(IMultiLanguage2),
                           (void**)&pMulti
@@ -449,12 +449,12 @@ private:
 public:
     WinIMultiLanguage2FromUnicodePerfFunction(const char* name,WCHAR* source, UINT sourceLen, UErrorCode& status){
              
-        CoInitialize(NULL);
+        CoInitialize(nullptr);
 
         /* create instance of converter object*/
         CoCreateInstance(
                           __uuidof(CMultiLanguage),
-                          NULL,
+                          nullptr,
                           CLSCTX_SERVER,
                           __uuidof(IMultiLanguage2),
                           (void**)&pMulti
@@ -496,7 +496,7 @@ public:
 
     ConverterPerformanceTest(int32_t argc, const char* argv[], UErrorCode& status);
     ~ConverterPerformanceTest();
-    virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec,const char* &name, char* par = NULL);    
+    virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec,const char* &name, char* par = nullptr);
     
     UPerfFunction* TestICU_CleanOpenAllConverters();
     UPerfFunction* TestICU_OpenAllConverters();
index a38885c6bc32a00ceb7b5a3eee2ba1ecdebc4bef..fedc4dc06b095965be04cb23cc6660a465f7ed48 100644 (file)
@@ -47,7 +47,7 @@
 class DictionaryTriePerfTest : public UPerfTest {
 public:
     DictionaryTriePerfTest(int32_t argc, const char *argv[], UErrorCode &status)
-            : UPerfTest(argc, argv, NULL, 0, "", status), numTextLines(0) {
+            : UPerfTest(argc, argv, nullptr, 0, "", status), numTextLines(0) {
         if(hasFile()) {
             getLines(status);
             for(int32_t i=0; i<numLines; ++i) {
@@ -66,11 +66,11 @@ public:
         }
     }
 
-    virtual UPerfFunction *runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=NULL);
+    virtual UPerfFunction *runIndexedTest(int32_t index, UBool exec, const char *&name, char *par=nullptr);
 
     const char *getSourceDir() const { return sourceDir; }
 
-    UBool hasFile() const { return ucharBuf!=NULL; }
+    UBool hasFile() const { return ucharBuf!=nullptr; }
     const ULine *getCachedLines() const { return lines; }
     int32_t getNumLines() const { return numLines; }
     int32_t numTextLines;  // excluding comment lines
@@ -406,7 +406,7 @@ ucharsTrieMatches(UCharsTrie &trie,
 class UCharsTrieDictLookup : public DictLookup {
 public:
     UCharsTrieDictLookup(const DictionaryTriePerfTest &perfTest)
-            : DictLookup(perfTest), trie(NULL) {
+            : DictLookup(perfTest), trie(nullptr) {
         IcuToolErrorCode errorCode("UCharsTrieDictLookup()");
         builder=new UCharsTrieBuilder(errorCode);
         const ULine *lines=perf.getCachedLines();
@@ -508,7 +508,7 @@ static UBool thaiWordToBytes(const UChar *s, int32_t length,
 class BytesTrieDictLookup : public DictLookup {
 public:
     BytesTrieDictLookup(const DictionaryTriePerfTest &perfTest)
-            : DictLookup(perfTest), trie(NULL), noDict(false) {
+            : DictLookup(perfTest), trie(nullptr), noDict(false) {
         IcuToolErrorCode errorCode("BytesTrieDictLookup()");
         builder=new BytesTrieBuilder(errorCode);
         CharString str;
@@ -703,7 +703,7 @@ UPerfFunction *DictionaryTriePerfTest::runIndexedTest(int32_t index, UBool exec,
             break;
         }
     }
-    return NULL;
+    return nullptr;
 }
 
 int main(int argc, const char *argv[]) {
index 7fe13cbeeb65e991cf2900bf6a39a18b78c78668..3553f2fd75b920c43e15de877c78435208fa1da7 100644 (file)
@@ -38,17 +38,17 @@ void runTests(void);
 #define TEST_LOCALE "en_US"
 #endif
 
-FILE *out = NULL;
+FILE *out = nullptr;
 UErrorCode setupStatus = U_ZERO_ERROR;
-const char *outName = NULL;
+const char *outName = nullptr;
 int listmode = 0;
-const char *testName = NULL;
-const char *progname = NULL;
+const char *testName = nullptr;
+const char *progname = nullptr;
 int errflg = 0;
 int testhit = 0;
 
 int testMatch(const char *aName) {
-  if(testName==NULL) return 1;
+  if(testName==nullptr) return 1;
   int len = strlen(testName);
   if(testName[len-1]=='*') {
     return strncmp(testName,aName,len-1);
@@ -101,16 +101,16 @@ int main(int argc, char * const * argv){
   }
 #endif
 
-    if(listmode && outName != NULL ) {
+    if(listmode && outName != nullptr ) {
       fprintf(stderr, "Warning: no output when list mode\n");
-      outName=NULL;
+      outName=nullptr;
     }
 
-  if(outName != NULL) {
+  if(outName != nullptr) {
 
 
     out=fopen(outName,"w");
-    if(out==NULL) {
+    if(out==nullptr) {
       fprintf(stderr,"Err: can't open %s for writing.\n", outName);
       return 1;
     } else {
@@ -123,7 +123,7 @@ int main(int argc, char * const * argv){
     fprintf(stderr, "# (no output)\n");
   }
 
-  if(listmode && testName!=NULL) {
+  if(listmode && testName!=nullptr) {
     fprintf(stderr, "ERR: no -l mode when specific test with -t\n");
     usage(progname);
     return 1;
@@ -133,7 +133,7 @@ int main(int argc, char * const * argv){
   runTests();
 
 
-  if(out!=NULL) {
+  if(out!=nullptr) {
 #ifndef SKIP_INFO
     udbg_writeIcuInfo(out);
 #endif
@@ -197,7 +197,7 @@ public:
 void runTestOn(HowExpensiveTest &t) {
   if(U_FAILURE(setupStatus)) return; // silently
   const char *tn = t.getName();
-  if(testName!=NULL && testMatch(tn)) return; // skipped.
+  if(testName!=nullptr && testMatch(tn)) return; // skipped.
   if(listmode) {
     fprintf(stderr, "%s:%d:\t%s\n", t.fFile, t.fLine, t.getName());
     testhit++;
@@ -206,7 +206,7 @@ void runTestOn(HowExpensiveTest &t) {
     fprintf(stderr, "%s:%d: Running: %s\n", t.fFile, t.fLine, t.getName());
     testhit++;
   }
-  double sieveTime = uprv_getSieveTime(NULL);
+  double sieveTime = uprv_getSieveTime(nullptr);
   double st;
   double me;
 
@@ -224,7 +224,7 @@ void runTestOn(HowExpensiveTest &t) {
 
   printf("%s\t%.9f\t%.9f +/- %.9f,  @ %d iter\n", t.getName(),stn,st,me,iter);
 
-  if(out!=NULL) {
+  if(out!=nullptr) {
     fprintf(out, "   <test name=\"%s\" standardizedTime=\"%f\" realDuration=\"%f\" marginOfError=\"%f\" iterations=\"%d\" />\n",
             tn,stn,st,me,iter);
     fflush(out);
@@ -239,7 +239,7 @@ public:
   SieveTest():HowExpensiveTest("SieveTest",__FILE__,__LINE__){}
   virtual int32_t run(){return 0;} // dummy
   int32_t runTest(double *subTime) {
-    *subTime = uprv_getSieveTime(NULL);
+    *subTime = uprv_getSieveTime(nullptr);
     return U_LOTS_OF_TIMES;
   }
   virtual int32_t runTests(double *subTime, double *marginOfError) {
@@ -305,7 +305,7 @@ public:
   void warmup() {
     fFmt = initFmt();
     if(U_SUCCESS(setupStatus)) {
-      double trial = unum_parseDouble(fFmt,fStr,fLen, NULL, &setupStatus);
+      double trial = unum_parseDouble(fFmt,fStr,fLen, nullptr, &setupStatus);
       if(U_SUCCESS(setupStatus) && trial!=fExpect) {
         setupStatus = U_INTERNAL_PROGRAM_ERROR;
         printf("%s:%d: warmup() %s got %.8f expected %.8f\n",
@@ -317,7 +317,7 @@ public:
     double trial=0.0;
     int i;
     for(i=0;i<U_LOTS_OF_TIMES;i++){
-      trial = unum_parse(fFmt,fStr,fLen, NULL, &setupStatus);
+      trial = unum_parse(fFmt,fStr,fLen, nullptr, &setupStatus);
     }
     return i;
   }
@@ -434,13 +434,13 @@ public:
     fFmt = initFmt();
     UChar buf[100];
     if(U_SUCCESS(setupStatus)) {
-      int32_t trial = unum_formatDouble(fFmt,fExpect, buf, 100, NULL, &setupStatus);
+      int32_t trial = unum_formatDouble(fFmt,fExpect, buf, 100, nullptr, &setupStatus);
       if(!U_SUCCESS(setupStatus)
          || trial!=fLen
          ||trial<=0
          || u_strncmp(fStr,buf,trial)  ) {
         char strBuf[200];
-        u_strToUTF8(strBuf,200,NULL,buf,trial+1,&setupStatus);
+        u_strToUTF8(strBuf,200,nullptr,buf,trial+1,&setupStatus);
         printf("%s:%d: warmup() %s got %s expected %s, err %s\n",
                fFile,fLine,getName(),strBuf,fCStr, u_errorName(setupStatus));
         setupStatus = U_INTERNAL_PROGRAM_ERROR;
@@ -453,7 +453,7 @@ public:
     UChar buf[100];
     if(U_SUCCESS(setupStatus)) {
       for(i=0;i<U_LOTS_OF_TIMES;i++){
-        trial = unum_formatDouble(fFmt,fExpect, buf, 100, NULL, &setupStatus);
+        trial = unum_formatDouble(fFmt,fExpect, buf, 100, nullptr, &setupStatus);
       }
     }
     return i;
@@ -499,8 +499,8 @@ protected:
       return unum_open(UNUM_PATTERN_DECIMAL, fPat.getTerminatedBuffer(), -1, TEST_LOCALE, 0, &setupStatus);
     case kApplyPattern:
       {
-        UNumberFormat *fmt = unum_open(UNUM_DECIMAL, NULL, -1, TEST_LOCALE, 0, &setupStatus);
-        unum_applyPattern(fmt, false, fPat.getTerminatedBuffer(), -1, NULL, &setupStatus);
+        UNumberFormat *fmt = unum_open(UNUM_DECIMAL, nullptr, -1, TEST_LOCALE, 0, &setupStatus);
+        unum_applyPattern(fmt, false, fPat.getTerminatedBuffer(), -1, nullptr, &setupStatus);
         return fmt;
       }
     case kGroupOff:
@@ -511,14 +511,14 @@ protected:
       }
     case kApplyGroupOff:
       {
-        UNumberFormat *fmt = unum_open(UNUM_DECIMAL, NULL, -1, TEST_LOCALE, 0, &setupStatus);
-        unum_applyPattern(fmt, false, fPat.getTerminatedBuffer(), -1, NULL, &setupStatus);
+        UNumberFormat *fmt = unum_open(UNUM_DECIMAL, nullptr, -1, TEST_LOCALE, 0, &setupStatus);
+        unum_applyPattern(fmt, false, fPat.getTerminatedBuffer(), -1, nullptr, &setupStatus);
         unum_setAttribute(fmt, UNUM_GROUPING_USED, UNUM_NO);
         return fmt;
       }
     default:
     case kDefault:
-      return unum_open(UNUM_DEFAULT, NULL, -1, TEST_LOCALE, 0, &setupStatus);
+      return unum_open(UNUM_DEFAULT, nullptr, -1, TEST_LOCALE, 0, &setupStatus);
     }
   }
   virtual const char *getClassName() {
@@ -558,13 +558,13 @@ public:
     fFmt = initFmt();
     UChar buf[100];
     if(U_SUCCESS(setupStatus)) {
-      int32_t trial = unum_formatInt64(fFmt,fExpect, buf, 100, NULL, &setupStatus);
+      int32_t trial = unum_formatInt64(fFmt,fExpect, buf, 100, nullptr, &setupStatus);
       if(!U_SUCCESS(setupStatus)
          || trial!=fLen
          ||trial<=0
          || u_strncmp(fStr,buf,trial)  ) {
         char strBuf[200];
-        u_strToUTF8(strBuf,200,NULL,buf,trial+1,&setupStatus);
+        u_strToUTF8(strBuf,200,nullptr,buf,trial+1,&setupStatus);
         printf("%s:%d: warmup() %s got %s (len %d) expected %s (len %d), err %s\n",
                fFile,fLine,getName(),strBuf,trial,fCStr,fLen, u_errorName(setupStatus));
         setupStatus = U_INTERNAL_PROGRAM_ERROR;
@@ -577,7 +577,7 @@ public:
     UChar buf[100];
     if(U_SUCCESS(setupStatus)) {
       for(i=0;i<U_LOTS_OF_TIMES;i++){
-        trial = unum_formatInt64(fFmt,fExpect, buf, 100, NULL, &setupStatus);
+        trial = unum_formatInt64(fFmt,fExpect, buf, 100, nullptr, &setupStatus);
       }
     }
     return i;
@@ -650,12 +650,12 @@ public:
     UnicodeString buf;
     if(U_SUCCESS(setupStatus)) {
       buf.remove();
-      ((const DecimalFormat*)fFmt)->format(fExpect, buf, NULL, setupStatus);
+      ((const DecimalFormat*)fFmt)->format(fExpect, buf, nullptr, setupStatus);
       if(!U_SUCCESS(setupStatus)
          || fString!=buf
          ) {
         char strBuf[200];
-        u_strToUTF8(strBuf,200,NULL,buf.getTerminatedBuffer(),buf.length()+1,&setupStatus);
+        u_strToUTF8(strBuf,200,nullptr,buf.getTerminatedBuffer(),buf.length()+1,&setupStatus);
         printf("%s:%d: warmup() %s got %s (len %d) expected %s (len %d), err %s\n",
                fFile,fLine,getName(),strBuf,buf.length(),fCStr,fLen, u_errorName(setupStatus));
         setupStatus = U_INTERNAL_PROGRAM_ERROR;
@@ -672,7 +672,7 @@ public:
     if(U_SUCCESS(setupStatus)) {
       for(i=0;i<U_LOTS_OF_TIMES;i++){
         buf.remove();
-        ((const DecimalFormat*)fFmt)->format(fExpect, buf, NULL, setupStatus);
+        ((const DecimalFormat*)fFmt)->format(fExpect, buf, nullptr, setupStatus);
       }
     }
     return i;
@@ -692,15 +692,15 @@ static UChar strbeng[] = {0x09E8,0x09E8,0x09E8,0x09E8, 0 };
 UNumberFormat *NumParseTest_fmt;
 
 // TODO: de-uglify.
-QuickTest(NumParseTest,{    static UChar pattern[] = { 0x23 };    NumParseTest_fmt = unum_open(UNUM_PATTERN_DECIMAL,         pattern,                    1,                    TEST_LOCALE,                    0,                    &setupStatus);  },{    int32_t i;    static UChar str[] = { 0x31 };double val;    for(i=0;i<U_LOTS_OF_TIMES;i++) {      val=unum_parse(NumParseTest_fmt,str,1,NULL,&setupStatus);    }    return i;  },{unum_close(NumParseTest_fmt);})
+QuickTest(NumParseTest,{    static UChar pattern[] = { 0x23 };    NumParseTest_fmt = unum_open(UNUM_PATTERN_DECIMAL,         pattern,                    1,                    TEST_LOCALE,                    0,                    &setupStatus);  },{    int32_t i;    static UChar str[] = { 0x31 };double val;    for(i=0;i<U_LOTS_OF_TIMES;i++) {      val=unum_parse(NumParseTest_fmt,str,1,nullptr,&setupStatus);    }    return i;  },{unum_close(NumParseTest_fmt);})
 
-QuickTest(NumParseTestdot,{    static UChar pattern[] = { 0x23 };    NumParseTest_fmt = unum_open(UNUM_PATTERN_DECIMAL,         pattern,                    1,                    TEST_LOCALE,                    0,                    &setupStatus);  },{    int32_t i;  double val;    for(i=0;i<U_LOTS_OF_TIMES;i++) {      val=unum_parse(NumParseTest_fmt,strdot,1,NULL,&setupStatus);    }    return i;  },{unum_close(NumParseTest_fmt);})
-QuickTest(NumParseTestspc,{    static UChar pattern[] = { 0x23 };    NumParseTest_fmt = unum_open(UNUM_PATTERN_DECIMAL,         pattern,                    1,                    TEST_LOCALE,                    0,                    &setupStatus);  },{    int32_t i;    double val;    for(i=0;i<U_LOTS_OF_TIMES;i++) {      val=unum_parse(NumParseTest_fmt,strspc,1,NULL,&setupStatus);    }    return i;  },{unum_close(NumParseTest_fmt);})
-QuickTest(NumParseTestgrp,{    static UChar pattern[] = { 0x23 };    NumParseTest_fmt = unum_open(UNUM_PATTERN_DECIMAL,         pattern,                    1,                    TEST_LOCALE,                    0,                    &setupStatus);  },{    int32_t i;    double val;    for(i=0;i<U_LOTS_OF_TIMES;i++) {      val=unum_parse(NumParseTest_fmt,strgrp,-1,NULL,&setupStatus);    }    return i;  },{unum_close(NumParseTest_fmt);})
+QuickTest(NumParseTestdot,{    static UChar pattern[] = { 0x23 };    NumParseTest_fmt = unum_open(UNUM_PATTERN_DECIMAL,         pattern,                    1,                    TEST_LOCALE,                    0,                    &setupStatus);  },{    int32_t i;  double val;    for(i=0;i<U_LOTS_OF_TIMES;i++) {      val=unum_parse(NumParseTest_fmt,strdot,1,nullptr,&setupStatus);    }    return i;  },{unum_close(NumParseTest_fmt);})
+QuickTest(NumParseTestspc,{    static UChar pattern[] = { 0x23 };    NumParseTest_fmt = unum_open(UNUM_PATTERN_DECIMAL,         pattern,                    1,                    TEST_LOCALE,                    0,                    &setupStatus);  },{    int32_t i;    double val;    for(i=0;i<U_LOTS_OF_TIMES;i++) {      val=unum_parse(NumParseTest_fmt,strspc,1,nullptr,&setupStatus);    }    return i;  },{unum_close(NumParseTest_fmt);})
+QuickTest(NumParseTestgrp,{    static UChar pattern[] = { 0x23 };    NumParseTest_fmt = unum_open(UNUM_PATTERN_DECIMAL,         pattern,                    1,                    TEST_LOCALE,                    0,                    &setupStatus);  },{    int32_t i;    double val;    for(i=0;i<U_LOTS_OF_TIMES;i++) {      val=unum_parse(NumParseTest_fmt,strgrp,-1,nullptr,&setupStatus);    }    return i;  },{unum_close(NumParseTest_fmt);})
 
-QuickTest(NumParseTestbeng,{    static UChar pattern[] = { 0x23 };    NumParseTest_fmt = unum_open(UNUM_PATTERN_DECIMAL,         pattern,                    1,                    TEST_LOCALE,                    0,                    &setupStatus);  },{    int32_t i;    double val;    for(i=0;i<U_LOTS_OF_TIMES;i++) {      val=unum_parse(NumParseTest_fmt,strbeng,-1,NULL,&setupStatus);    }    return i;  },{unum_close(NumParseTest_fmt);})
+QuickTest(NumParseTestbeng,{    static UChar pattern[] = { 0x23 };    NumParseTest_fmt = unum_open(UNUM_PATTERN_DECIMAL,         pattern,                    1,                    TEST_LOCALE,                    0,                    &setupStatus);  },{    int32_t i;    double val;    for(i=0;i<U_LOTS_OF_TIMES;i++) {      val=unum_parse(NumParseTest_fmt,strbeng,-1,nullptr,&setupStatus);    }    return i;  },{unum_close(NumParseTest_fmt);})
 
-UDateFormat *DateFormatTest_fmt = NULL;
+UDateFormat *DateFormatTest_fmt = nullptr;
 UDate sometime = 100000000.0;
 UChar onekbuf[1024];
 const int32_t onekbuf_len = UPRV_LENGTHOF(onekbuf);
@@ -708,13 +708,13 @@ const int32_t onekbuf_len = UPRV_LENGTHOF(onekbuf);
 
 QuickTest(DateFormatTestBasic, \
           { \
-            DateFormatTest_fmt = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, NULL, NULL, -1, NULL, -1, &setupStatus); \
+            DateFormatTest_fmt = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, nullptr, nullptr, -1, nullptr, -1, &setupStatus); \
           }, \
           { \
             int i; \
             for(i=0;i<U_LOTS_OF_TIMES;i++)  \
             { \
-              udat_format(DateFormatTest_fmt, sometime, onekbuf, onekbuf_len, NULL, &setupStatus); \
+              udat_format(DateFormatTest_fmt, sometime, onekbuf, onekbuf_len, nullptr, &setupStatus); \
             } \
             return i; \
           }, \
@@ -729,17 +729,17 @@ QuickTest(NullTest,{},{int j=U_LOTS_OF_TIMES;while(--j);return U_LOTS_OF_TIMES;}
 #if 0
 #include <time.h>
 
-QuickTest(RandomTest,{},{timespec ts; ts.tv_sec=rand()%4; int j=U_LOTS_OF_TIMES;while(--j) { ts.tv_nsec=100000+(rand()%10000)*1000000; nanosleep(&ts,NULL); return j;} return U_LOTS_OF_TIMES;},{})
+QuickTest(RandomTest,{},{timespec ts; ts.tv_sec=rand()%4; int j=U_LOTS_OF_TIMES;while(--j) { ts.tv_nsec=100000+(rand()%10000)*1000000; nanosleep(&ts,nullptr); return j;} return U_LOTS_OF_TIMES;},{})
 #endif
 
 OpenCloseTest(pattern,unum,open,{},(UNUM_PATTERN_DECIMAL,pattern,1,TEST_LOCALE,0,&setupStatus),{})
-OpenCloseTest(default,unum,open,{},(UNUM_DEFAULT,NULL,-1,TEST_LOCALE,0,&setupStatus),{})
+OpenCloseTest(default,unum,open,{},(UNUM_DEFAULT,nullptr,-1,TEST_LOCALE,0,&setupStatus),{})
 #if !UCONFIG_NO_CONVERSION
 #include "unicode/ucnv.h"
 OpenCloseTest(gb18030,ucnv,open,{},("gb18030",&setupStatus),{})
 #endif
 #include "unicode/ures.h"
-OpenCloseTest(root,ures,open,{},(NULL,"root",&setupStatus),{})
+OpenCloseTest(root,ures,open,{},(nullptr,"root",&setupStatus),{})
 
 void runTests() {
   {
index 331f946eecbd59b1eb85d7c5324f2b5a019cfd6a..c82fa9cafef8d8b98f44eea56131ffaaeefa08dd 100644 (file)
@@ -210,7 +210,7 @@ U_CAPI double uprv_getSieveTime(double *marginOfError) {
     meanSieveTime = uprv_getMeanTime(times, &samples,&meanSieveME);
     calcSieveTime=true;
   }
-  if(marginOfError!=NULL) {
+  if(marginOfError!=nullptr) {
     *marginOfError = meanSieveME;
   }
   return meanSieveTime;
index 96b8773e3b433db7471ccf8a251fbd73273bbfb7..0b5d0a11c4b216aae936e1813ea703e34d3949c2 100644 (file)
 #include "LESwaps.h"
 
 FontObject::FontObject(char *fileName)
-  : directory(NULL), numTables(0), searchRange(0),entrySelector(0),
-    cmapTable(NULL), cmSegCount(0), cmSearchRange(0), cmEntrySelector(0),
-    cmEndCodes(NULL), cmStartCodes(NULL), cmIdDelta(0), cmIdRangeOffset(0),
-    headTable(NULL), hmtxTable(NULL), numGlyphs(0), numOfLongHorMetrics(0), file(NULL)
+  : directory(nullptr), numTables(0), searchRange(0),entrySelector(0),
+    cmapTable(nullptr), cmSegCount(0), cmSearchRange(0), cmEntrySelector(0),
+    cmEndCodes(nullptr), cmStartCodes(nullptr), cmIdDelta(0), cmIdRangeOffset(0),
+    headTable(nullptr), hmtxTable(nullptr), numGlyphs(0), numOfLongHorMetrics(0), file(nullptr)
 {
     file = fopen(fileName, "rb");
 
-    if (file == NULL) {
+    if (file == nullptr) {
         printf("?? Couldn't open %s", fileName);
         return;
     }
@@ -84,16 +84,16 @@ DirectoryEntry *FontObject::findTable(LETag tag)
         return &directory->tableDirectory[table];
     }
 
-    return NULL;
+    return nullptr;
 }
 
 void *FontObject::readTable(LETag tag, le_uint32 *length)
 {
     DirectoryEntry *entry = findTable(tag);
 
-    if (entry == NULL) {
+    if (entry == nullptr) {
         *length = 0;
-        return NULL;
+        return nullptr;
     }
 
     *length = SWAPL(entry->length);
@@ -110,13 +110,13 @@ CMAPEncodingSubtable *FontObject::findCMAP(le_uint16 platformID, le_uint16 platf
 {
     LETag cmapTag = 0x636D6170; // 'cmap'
 
-    if (cmapTable == NULL) {
+    if (cmapTable == nullptr) {
         le_uint32 length;
 
         cmapTable = (CMAPTable *) readTable(cmapTag, &length);
     }
 
-    if (cmapTable != NULL) {
+    if (cmapTable != nullptr) {
         le_uint16 i;
         le_uint16 nSubtables = SWAPW(cmapTable->numberSubtables);
 
@@ -131,7 +131,7 @@ CMAPEncodingSubtable *FontObject::findCMAP(le_uint16 platformID, le_uint16 platf
         }
     }
 
-    return NULL;
+    return nullptr;
 }
 
 void FontObject::initUnicodeCMAP()
@@ -200,7 +200,7 @@ LEGlyphID FontObject::unicodeToGlyph(LEUnicode32 unicode32)
 
 le_uint16 FontObject::getUnitsPerEM()
 {
-    if (headTable == NULL) {
+    if (headTable == nullptr) {
         LETag headTag = 0x68656164; // 'head'
         le_uint32 length;
 
@@ -212,7 +212,7 @@ le_uint16 FontObject::getUnitsPerEM()
 
 le_uint16 FontObject::getGlyphAdvance(LEGlyphID glyph)
 {
-    if (hmtxTable == NULL) {
+    if (hmtxTable == nullptr) {
         LETag maxpTag = 0x6D617870; // 'maxp'
         LETag hheaTag = 0x68686561; // 'hhea'
         LETag hmtxTag = 0x686D7478; // 'hmtx'
index a687068b0276a22708f2bde535b99dc0b26120a1..4bd5b81f369b20fcda6f5aa5741a96ddcd0151ea 100644 (file)
@@ -29,14 +29,14 @@ FontTableCache::FontTableCache()
 {
     fTableCache = LE_NEW_ARRAY(FontTableCacheEntry, fTableCacheSize);
 
-    if (fTableCache == NULL) {
+    if (fTableCache == nullptr) {
         fTableCacheSize = 0;
         return;
     }
 
     for (int i = 0; i < fTableCacheSize; i += 1) {
         fTableCache[i].tag   = 0;
-        fTableCache[i].table = NULL;
+        fTableCache[i].table = nullptr;
         fTableCache[i].length = 0;
     }
 }
@@ -47,7 +47,7 @@ FontTableCache::~FontTableCache()
       LE_DELETE_ARRAY(fTableCache[i].table);
 
         fTableCache[i].tag   = 0;
-        fTableCache[i].table = NULL;
+        fTableCache[i].table = nullptr;
         fTableCache[i].length = 0;
     }
 
@@ -86,7 +86,7 @@ void FontTableCache::add(LETag tableTag, const void *table, size_t length)
 
         for (le_int32 i = fTableCacheSize; i < newSize; i += 1) {
             fTableCache[i].tag   = 0;
-            fTableCache[i].table = NULL;
+            fTableCache[i].table = nullptr;
             fTableCache[i].length = 0;
         }
 
index a71a239e7f4347cc6cc5bb0dcd8519e441157cab..b8fdd8c5a37c8612c2f27d95f8161e12da03b89b 100644 (file)
@@ -83,8 +83,8 @@ le_int8 PortableFontInstance::highBit(le_int32 value)
 }
 
 PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize, LEErrorCode &status)
-    : fFile(NULL), fPointSize(pointSize), fUnitsPerEM(0), fFontChecksum(0), fAscent(0), fDescent(0), fLeading(0),
-      fDirectory(NULL), fNAMETable(NULL), fNameCount(0), fNameStringOffset(0), fCMAPMapper(NULL), fHMTXTable(NULL), fNumGlyphs(0), fNumLongHorMetrics(0)
+    : fFile(nullptr), fPointSize(pointSize), fUnitsPerEM(0), fFontChecksum(0), fAscent(0), fDescent(0), fLeading(0),
+      fDirectory(nullptr), fNAMETable(nullptr), fNameCount(0), fNameStringOffset(0), fCMAPMapper(nullptr), fHMTXTable(nullptr), fNumGlyphs(0), fNumLongHorMetrics(0)
 {
     if (LE_FAILURE(status)) {
         return;
@@ -94,7 +94,7 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
     fFile = fopen(fileName, "rb");
     //printf("Open Font: %s\n", fileName);
 
-    if (fFile == NULL) {
+    if (fFile == nullptr) {
         printf("%s:%d: %s: FNF\n", __FILE__, __LINE__, fileName);
         status = LE_FONT_FILE_NOT_FOUND_ERROR;
         return;
@@ -108,14 +108,14 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
     le_int32 dirSize = sizeof tempDir + ((SWAPW(tempDir.numTables) - ANY_NUMBER) * sizeof(DirectoryEntry));
     const LETag headTag = LE_HEAD_TABLE_TAG;
     const LETag hheaTag = LE_HHEA_TABLE_TAG;
-    const HEADTable *headTable = NULL;
-    const HHEATable *hheaTable = NULL;
-//  const NAMETable *nameTable = NULL;
+    const HEADTable *headTable = nullptr;
+    const HHEATable *hheaTable = nullptr;
+//  const NAMETable *nameTable = nullptr;
     le_uint16 numTables = 0;
 
     fDirectory = (const SFNTDirectory *) LE_NEW_ARRAY(char, dirSize);
 
-    if (fDirectory == NULL) {
+    if (fDirectory == nullptr) {
         printf("%s:%d: %s: malloc err\n", __FILE__, __LINE__, fileName);
         status = LE_MEMORY_ALLOCATION_ERROR;
         goto error_exit;
@@ -135,7 +135,7 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
     // read unitsPerEm from 'head' table
     headTable = (const HEADTable *) readFontTable(headTag);
 
-    if (headTable == NULL) {
+    if (headTable == nullptr) {
         status = LE_MISSING_FONT_TABLE_ERROR;
         printf("%s:%d: %s: missing head table\n", __FILE__, __LINE__, fileName);
         goto error_exit;
@@ -147,14 +147,14 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
 
     //nameTable = (NAMETable *) readFontTable(nameTag);
 
-    //if (nameTable == NULL) {
+    //if (nameTable == nullptr) {
     //    status = LE_MISSING_FONT_TABLE_ERROR;
     //    goto error_exit;
     //}
 
     //fFontVersionString = findName(nameTable, NAME_VERSION_STRING, PLATFORM_MACINTOSH, MACINTOSH_ROMAN, MACINTOSH_ENGLISH);
 
-    //if (fFontVersionString == NULL) {
+    //if (fFontVersionString == nullptr) {
     //    status = LE_MISSING_FONT_TABLE_ERROR;
     //    goto error_exit;
     //}
@@ -163,7 +163,7 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
 
     hheaTable = (HHEATable *) readFontTable(hheaTag);
 
-    if (hheaTable == NULL) {
+    if (hheaTable == nullptr) {
         printf("%s:%d: %s: missing hhea table\n", __FILE__, __LINE__, fileName);
         status = LE_MISSING_FONT_TABLE_ERROR;
         goto error_exit;
@@ -179,7 +179,7 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
 
     fCMAPMapper = findUnicodeMapper();
 
-    if (fCMAPMapper == NULL) {
+    if (fCMAPMapper == nullptr) {
         printf("%s:%d: %s: can't load cmap\n", __FILE__, __LINE__, fileName);
         status = LE_MISSING_FONT_TABLE_ERROR;
         goto error_exit;
@@ -189,13 +189,13 @@ PortableFontInstance::PortableFontInstance(const char *fileName, float pointSize
 
 error_exit:
     fclose(fFile);
-    fFile = NULL;
+    fFile = nullptr;
     return;
 }
 
 PortableFontInstance::~PortableFontInstance()
 {
-    if (fFile != NULL) {
+    if (fFile != nullptr) {
         fclose(fFile);
 
         freeFontTable(fHMTXTable);
@@ -209,7 +209,7 @@ PortableFontInstance::~PortableFontInstance()
 
 const DirectoryEntry *PortableFontInstance::findTable(LETag tag) const
 {
-    if (fDirectory != NULL) {
+    if (fDirectory != nullptr) {
         le_uint16 table = 0;
         le_uint16 probe = fDirPower;
 
@@ -230,23 +230,23 @@ const DirectoryEntry *PortableFontInstance::findTable(LETag tag) const
         }
     }
 
-    return NULL;
+    return nullptr;
 }
 
 const void *PortableFontInstance::readTable(LETag tag, le_uint32 *length) const
 {
     const DirectoryEntry *entry = findTable(tag);
 
-    if (entry == NULL) {
+    if (entry == nullptr) {
         *length = 0;
-        return NULL;
+        return nullptr;
     }
 
     *length = SWAPL(entry->length);
 
     void *table = LE_NEW_ARRAY(char, *length);
 
-    if (table != NULL) {
+    if (table != nullptr) {
         fseek(fFile, SWAPL(entry->offset), SEEK_SET);
         fread(table, sizeof(char), *length, fFile);
     }
@@ -281,8 +281,8 @@ CMAPMapper *PortableFontInstance::findUnicodeMapper()
     LETag cmapTag = LE_CMAP_TABLE_TAG;
     const CMAPTable *cmap = (CMAPTable *) readFontTable(cmapTag);
 
-    if (cmap == NULL) {
-        return NULL;
+    if (cmap == nullptr) {
+        return nullptr;
     }
 
     return CMAPMapper::createUnicodeMapper(cmap);
@@ -290,13 +290,13 @@ CMAPMapper *PortableFontInstance::findUnicodeMapper()
 
 const char *PortableFontInstance::getNameString(le_uint16 nameID, le_uint16 platformID, le_uint16 encodingID, le_uint16 languageID) const
 {
-    if (fNAMETable == NULL) {
+    if (fNAMETable == nullptr) {
         LETag nameTag = LE_NAME_TABLE_TAG;
         PortableFontInstance *realThis = (PortableFontInstance *) this;
 
         realThis->fNAMETable = (const NAMETable *) readFontTable(nameTag);
 
-        if (realThis->fNAMETable != NULL) {
+        if (realThis->fNAMETable != nullptr) {
             realThis->fNameCount        = SWAPW(realThis->fNAMETable->count);
             realThis->fNameStringOffset = SWAPW(realThis->fNAMETable->stringOffset);
         }
@@ -318,18 +318,18 @@ const char *PortableFontInstance::getNameString(le_uint16 nameID, le_uint16 plat
         }
     }
 
-    return NULL;
+    return nullptr;
 }
 
 const LEUnicode16 *PortableFontInstance::getUnicodeNameString(le_uint16 nameID, le_uint16 platformID, le_uint16 encodingID, le_uint16 languageID) const
 {
-    if (fNAMETable == NULL) {
+    if (fNAMETable == nullptr) {
         LETag nameTag = LE_NAME_TABLE_TAG;
         PortableFontInstance *realThis = (PortableFontInstance *) this;
 
         realThis->fNAMETable = (const NAMETable *) readFontTable(nameTag);
 
-        if (realThis->fNAMETable != NULL) {
+        if (realThis->fNAMETable != nullptr) {
             realThis->fNameCount        = SWAPW(realThis->fNAMETable->count);
             realThis->fNameStringOffset = SWAPW(realThis->fNAMETable->stringOffset);
         }
@@ -354,7 +354,7 @@ const LEUnicode16 *PortableFontInstance::getUnicodeNameString(le_uint16 nameID,
         }
     }
 
-    return NULL;
+    return nullptr;
 }
 
 void PortableFontInstance::deleteNameString(const char *name) const
@@ -371,13 +371,13 @@ void PortableFontInstance::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) co
 {
     TTGlyphID ttGlyph = (TTGlyphID) LE_GET_GLYPH(glyph);
 
-    if (fHMTXTable == NULL) {
+    if (fHMTXTable == nullptr) {
         LETag maxpTag = LE_MAXP_TABLE_TAG;
         LETag hmtxTag = LE_HMTX_TABLE_TAG;
         const MAXPTable *maxpTable = (MAXPTable *) readFontTable(maxpTag);
         PortableFontInstance *realThis = (PortableFontInstance *) this;
 
-        if (maxpTable != NULL) {
+        if (maxpTable != nullptr) {
             realThis->fNumGlyphs = SWAPW(maxpTable->numGlyphs);
             freeFontTable(maxpTable);
         }
@@ -387,7 +387,7 @@ void PortableFontInstance::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) co
 
     le_uint16 index = ttGlyph;
 
-    if (ttGlyph >= fNumGlyphs || fHMTXTable == NULL) {
+    if (ttGlyph >= fNumGlyphs || fHMTXTable == nullptr) {
         advance.fX = advance.fY = 0;
         return;
     }
index b6d29b16779eb65cde1499c23ee016668cdd3598..a562f488baf0fae9c51c00bb963be4da3a4fed20 100644 (file)
@@ -54,7 +54,7 @@ const void *SimpleFontInstance::getFontTable(LETag tableTag) const
         return CanonShaping::glyphDefinitionTable;
     }
 
-    return NULL;
+    return nullptr;
 }
 
 void SimpleFontInstance::getGlyphAdvance(LEGlyphID glyph, LEPoint &advance) const
index e4cd5fd1b3c665fc11cb69087190a6de34e34754..2824b24708f471dd5d618cd461c8605e74f2953e 100644 (file)
@@ -61,7 +61,7 @@ CMAPMapper *CMAPMapper::createUnicodeMapper(const CMAPTable *cmap)
 {
     le_uint16 i;
     le_uint16 nSubtables = SWAPW(cmap->numberSubtables);
-    const CMAPEncodingSubtable *subtable = NULL;
+    const CMAPEncodingSubtable *subtable = nullptr;
     le_bool found = false;
     le_uint16 foundPlatformID = 0xFFFF;
     le_uint16 foundPlatformSpecificID = 0xFFFF;
@@ -129,7 +129,7 @@ CMAPMapper *CMAPMapper::createUnicodeMapper(const CMAPTable *cmap)
       //printf("%s:%d: using subtable #%d/%d type %d:%d\n", __FILE__, __LINE__, foundTable, nSubtables, foundPlatformID, foundPlatformSpecificID);
     } else {
       printf("%s:%d: could not find subtable.\n", __FILE__, __LINE__);
-      return NULL;
+      return nullptr;
     }
 
     le_uint16 tableFormat = SWAPW(subtable->format);
@@ -151,7 +151,7 @@ CMAPMapper *CMAPMapper::createUnicodeMapper(const CMAPTable *cmap)
     }
 
     printf("%s:%d: Unknown format %x.\n", __FILE__, __LINE__, (SWAPW(subtable->format)));
-    return NULL;
+    return nullptr;
 }
 
 CMAPFormat4Mapper::CMAPFormat4Mapper(const CMAPTable *cmap, const CMAPFormat4Encoding *header)
index 3183abc8b1c20b338b6d2cc607f3d03d16eca53b..3bfc6d6eae8a116c71298a2898b291092aa79b50 100644 (file)
@@ -40,9 +40,9 @@ void iterate(void * p) {
     LEErrorCode status = LE_NO_ERROR;
     LEFontInstance *font = params->font;
     LayoutEngine *engine = LayoutEngine::layoutEngineFactory(font, params->script, -1, status);
-    LEGlyphID *glyphs    = NULL;
-    le_int32  *indices   = NULL;
-    float     *positions = NULL;
+    LEGlyphID *glyphs    = nullptr;
+    le_int32  *indices   = nullptr;
+    float     *positions = nullptr;
     le_int32   glyphCount = 0;
     LEUnicode *chars = params->chars;
     glyphCount = engine->layoutChars(chars, 0, params->charLen, params->charLen, true, 0.0, 0.0, status);
index 75f3a551436a83ebc693bf2774b8b8b1b4256e42..baed01169a0cfeb70d214735f5c0bd10f4d19f0d 100644 (file)
@@ -160,22 +160,22 @@ int main() {
   {
     double oldTime = runTime;
     runTime = 0.25;
-    showTime(time_null, NULL); 
-    showTime(time_null, NULL); 
-    showTime(time_null, NULL); 
-    showTime(time_null, NULL); 
+    showTime(time_null, nullptr); 
+    showTime(time_null, nullptr); 
+    showTime(time_null, nullptr); 
+    showTime(time_null, nullptr); 
     runTime = oldTime;
   }
   puts("-- ready to start --");
 
 
-  showTime(time_null, NULL); 
+  showTime(time_null, nullptr); 
   showTime(time_obj, (void*)oo);
   showTime(time_obj2, (void*)oo);
   showTime(time_letr1, (void*)oo2);
   showTime(time_letr2, (void*)oo2);
   showTime(time_letr3, (void*)oo2);
-  showTime(time_null, NULL);
+  showTime(time_null, nullptr);
   
   delete [] items;
   delete oo;
index a0981a6864a4588f63c0f7e2ec598800eed98434..52036ab01027a3a47c3d202ae2064da2351eb712 100644 (file)
@@ -143,7 +143,7 @@ void readTestFile(const char *testFilePath, TestCaseCallback callback)
     UXMLParser  *parser = UXMLParser::createParser(status);
     UXMLElement *root   = parser->parseFile(testFilePath, status);
 
-    if (root == NULL) {
+    if (root == nullptr) {
         log_err("Could not open the test data file: %s\n", testFilePath);
         delete parser;
         return;
@@ -169,14 +169,14 @@ void readTestFile(const char *testFilePath, TestCaseCallback callback)
     const UXMLElement *testCase;
     int32_t tc = 0;
 
-    while((testCase = root->nextChildElement(tc)) != NULL) {
+    while((testCase = root->nextChildElement(tc)) != nullptr) {
         if (testCase->getTagName().compare(test_case) == 0) {
             char *id = getCString(testCase->getAttribute(id_attr));
             char *script    = getCString(testCase->getAttribute(script_attr));
             char *lang      = getCString(testCase->getAttribute(lang_attr));
-            char *fontName  = NULL;
-                       char *fontVer   = NULL;
-                       char *fontCksum = NULL;
+            char *fontName  = nullptr;
+                       char *fontVer   = nullptr;
+                       char *fontCksum = nullptr;
             const UXMLElement *element;
             int32_t ec = 0;
             int32_t charCount = 0;
@@ -185,7 +185,7 @@ void readTestFile(const char *testFilePath, TestCaseCallback callback)
             le_int32 languageCode = -1;
             UnicodeString text, glyphs, indices, positions;
             int32_t glyphCount = 0, indexCount = 0, positionCount = 0;
-            TestResult expected = {0, NULL, NULL, NULL};
+            TestResult expected = {0, nullptr, nullptr, nullptr};
 
             uscript_getCode(script, &scriptCode, 1, &status);
             if (LE_FAILURE(status)) {
@@ -193,7 +193,7 @@ void readTestFile(const char *testFilePath, TestCaseCallback callback)
                 goto free_c_strings;
             }
 
-            if (lang != NULL) {
+            if (lang != nullptr) {
                 languageCode = getLanguageCode(lang);
 
                 if (languageCode < 0) {
@@ -202,7 +202,7 @@ void readTestFile(const char *testFilePath, TestCaseCallback callback)
                 }
             }
 
-            while((element = testCase->nextChildElement(ec)) != NULL) {
+            while((element = testCase->nextChildElement(ec)) != nullptr) {
                 UnicodeString tag = element->getTagName();
 
                 // TODO: make sure that each element is only used once.
index 102183f1c6f29bed10c808b5a3912eb6c18b73d0..b13ec372291196bb451893d5cd4ddac0e322a89a 100644 (file)
@@ -32,9 +32,9 @@ UPerfFunction* DateTimeRoundTripPerfTest::runIndexedTest(int32_t index, UBool ex
         TESTCASE(3,RoundTripLocale21);    // 21 locales w/ reverse order
         default: 
             name = ""; 
-            return NULL;
+            return nullptr;
     }
-    return NULL;
+    return nullptr;
 
 }
 
index be2e7fb96ce113cc5401bf9c4e0d3ef601ec6a6c..832f2d0c82c2678f0b87917dffdf277e24633b39 100644 (file)
@@ -68,9 +68,9 @@ UPerfFunction* NormalizerPerformanceTest::runIndexedTest(int32_t index, UBool ex
 
         default: 
             name = ""; 
-            return NULL;
+            return nullptr;
     }
-    return NULL;
+    return nullptr;
 
 }
 
@@ -79,7 +79,7 @@ void NormalizerPerformanceTest::normalizeInput(ULine* dest,const UChar* src ,int
     UErrorCode status = U_ZERO_ERROR;
     for(;;){
         /* pure pre-flight */
-        reqLen=unorm_normalize(src,srcLen,mode, options,NULL,0,&status);
+        reqLen=unorm_normalize(src,srcLen,mode, options,nullptr,0,&status);
         if(status==U_BUFFER_OVERFLOW_ERROR){
             status=U_ZERO_ERROR;
             dest->name = new UChar[reqLen+1];
@@ -94,10 +94,10 @@ void NormalizerPerformanceTest::normalizeInput(ULine* dest,const UChar* src ,int
 UChar* NormalizerPerformanceTest::normalizeInput(int32_t& len, const UChar* src ,int32_t srcLen,UNormalizationMode mode, int32_t options){
     int32_t reqLen = 0;
     UErrorCode status = U_ZERO_ERROR;
-    UChar* dest = NULL;
+    UChar* dest = nullptr;
     for(;;){
         /* pure pre-flight */
-        reqLen=unorm_normalize(src,srcLen,mode, options,NULL,0,&status);
+        reqLen=unorm_normalize(src,srcLen,mode, options,nullptr,0,&status);
         if(status==U_BUFFER_OVERFLOW_ERROR){
             status=U_ZERO_ERROR;
             dest = new UChar[reqLen+1];
@@ -106,7 +106,7 @@ UChar* NormalizerPerformanceTest::normalizeInput(int32_t& len, const UChar* src
             break;
         }else if(U_FAILURE(status)){
             printf("Could not normalize input. Error: %s", u_errorName(status));
-            return NULL;
+            return nullptr;
         }
     }
     return dest;
@@ -118,12 +118,12 @@ static UOption cmdLineOptions[]={
 
 NormalizerPerformanceTest::NormalizerPerformanceTest(int32_t argc, const char* argv[], UErrorCode& status)
 : UPerfTest(argc,argv,status), options(0) {
-    NFDBuffer = NULL;
-    NFCBuffer = NULL;
+    NFDBuffer = nullptr;
+    NFCBuffer = nullptr;
     NFDBufferLen = 0;
     NFCBufferLen = 0;
-    NFDFileLines = NULL;
-    NFCFileLines = NULL;
+    NFDFileLines = nullptr;
+    NFCFileLines = nullptr;
 
     if(status== U_ILLEGAL_ARGUMENT_ERROR){
        fprintf(stderr,gUsageString, "normperf");
@@ -136,8 +136,8 @@ NormalizerPerformanceTest::NormalizerPerformanceTest(int32_t argc, const char* a
     }
 
     _remainingArgc = u_parseArgs(_remainingArgc, (char **)argv, UPRV_LENGTHOF(cmdLineOptions), cmdLineOptions);
-    if(cmdLineOptions[0].doesOccur && cmdLineOptions[0].value!=NULL) {
-        options=(int32_t)strtol(cmdLineOptions[0].value, NULL, 16);
+    if(cmdLineOptions[0].doesOccur && cmdLineOptions[0].value!=nullptr) {
+        options=(int32_t)strtol(cmdLineOptions[0].value, nullptr, 16);
     }
 
     if(line_mode){
index 8b384bfebeb167c3cf7ed32e25a78d2625b92037..769e83ac76268b647100d3aa5b12dc86d44f7cd2 100644 (file)
@@ -84,13 +84,13 @@ public:
         numLines = srcNumLines;
         uselen = _uselen;
         mode = _mode;
-        src = NULL;
+        src = nullptr;
         srcLen = 0;
         line_mode = true;
     }
     QuickCheckPerfFunction(QuickCheckFn func, const UChar* source,int32_t sourceLen, UNormalizationMode _mode, int32_t opts, UBool _uselen) : options(opts) {
         fn = func;
-        lines = NULL;
+        lines = nullptr;
         numLines = 0;
         uselen = _uselen;
         mode = _mode;
@@ -154,13 +154,13 @@ public:
         uselen = _uselen;
         destLen = DEST_BUFFER_CAPACITY;
         pDest = dest;
-        src = NULL;
+        src = nullptr;
         srcLen = 0;
         line_mode = true;
     }
     NormPerfFunction(NormFn func, int32_t opts, const UChar* source,int32_t sourceLen,UBool _uselen) : options(opts) {
         fn = func;
-        lines = NULL;
+        lines = nullptr;
         numLines = 0;
         uselen = _uselen;
         destLen = sourceLen*3;
@@ -197,7 +197,7 @@ public:
 
     NormalizerPerformanceTest(int32_t argc, const char* argv[], UErrorCode& status);
     ~NormalizerPerformanceTest();
-    virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec,const char* &name, char* par = NULL);     
+    virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec,const char* &name, char* par = nullptr);
     /* NFC performance */
     UPerfFunction* TestICU_NFC_NFD_Text();
     UPerfFunction* TestICU_NFC_NFC_Text();
index e138864bf321ee0eba456e2cdf381fa0cf4a4c4c..15ffdeec9a044242aea0409e00d60286fc65e653 100644 (file)
@@ -19,8 +19,8 @@
 StringSearchPerformanceTest::StringSearchPerformanceTest(int32_t argc, const char *argv[], UErrorCode &status)
 :UPerfTest(argc,argv,status){
     int32_t start, end;
-    srch = NULL;
-    pttrn = NULL;
+    srch = nullptr;
+    pttrn = nullptr;
     if(status== U_ILLEGAL_ARGUMENT_ERROR || line_mode){
        fprintf(stderr,gUsageString, "strsrchperf");
        return;
@@ -65,7 +65,7 @@ StringSearchPerformanceTest::StringSearchPerformanceTest(int32_t argc, const cha
 #endif
     
     /* Create the StringSearch object to be use in performance test. */
-    srch = usearch_open(pttrn, pttrnLen, src, srcLen, locale, NULL, &status);
+    srch = usearch_open(pttrn, pttrnLen, src, srcLen, locale, nullptr, &status);
 
     if(U_FAILURE(status)){
         fprintf(stderr, "FAILED to create UPerfTest object. Error: %s\n", u_errorName(status));
@@ -75,10 +75,10 @@ StringSearchPerformanceTest::StringSearchPerformanceTest(int32_t argc, const cha
 }
 
 StringSearchPerformanceTest::~StringSearchPerformanceTest() {
-    if (pttrn != NULL) {
+    if (pttrn != nullptr) {
         free(pttrn);
     }
-    if (srch != NULL) {
+    if (srch != nullptr) {
         usearch_close(srch);
     }
 }
@@ -90,9 +90,9 @@ UPerfFunction* StringSearchPerformanceTest::runIndexedTest(int32_t index, UBool
 
         default: 
             name = ""; 
-            return NULL;
+            return nullptr;
     }
-    return NULL;
+    return nullptr;
 }
 
 UPerfFunction* StringSearchPerformanceTest::Test_ICU_Forward_Search(){
index 04ee4033f8a6986972d18bdbc6c990953538d337..5ea66b6309259ed800e88b64027465c29d1f0efa 100644 (file)
@@ -57,7 +57,7 @@ private:
 public:
     StringSearchPerformanceTest(int32_t argc, const char *argv[], UErrorCode &status);
     ~StringSearchPerformanceTest();
-    virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec, const char *&name, char *par = NULL);
+    virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec, const char *&name, char *par = nullptr);
     UPerfFunction* Test_ICU_Forward_Search();
     UPerfFunction* Test_ICU_Backward_Search();
 };
index 7d092bc6383acd2329fc0cd7301fa1ad08ad7fa5..f0a3cc898a0de7775aeef6bea79c778e6af09bea 100644 (file)
@@ -162,12 +162,12 @@ UPerfFunction* BreakIteratorPerformanceTest::TestICUIsBound()
 
 UPerfFunction* BreakIteratorPerformanceTest::TestDarwinForward()
 {
-  return NULL;
+  return nullptr;
 }
 
 UPerfFunction* BreakIteratorPerformanceTest::TestDarwinIsBound()
 {
-  return NULL;
+  return nullptr;
 }
 
 UPerfFunction* BreakIteratorPerformanceTest::runIndexedTest(int32_t index, UBool exec,
@@ -181,9 +181,9 @@ UPerfFunction* BreakIteratorPerformanceTest::runIndexedTest(int32_t index, UBool
                TESTCASE(3, TestDarwinIsBound);
         default: 
             name = ""; 
-            return NULL;
+            return nullptr;
     }
-    return NULL;
+    return nullptr;
 }
 
 UOption options[]={
@@ -193,8 +193,8 @@ UOption options[]={
 
 BreakIteratorPerformanceTest::BreakIteratorPerformanceTest(int32_t argc, const char* argv[], UErrorCode& status)
 : UPerfTest(argc,argv,status),
-m_mode_(NULL),
-m_file_(NULL),
+m_mode_(nullptr),
+m_file_(nullptr),
 m_fileLen_(0)
 {
 
index 651228f8bdbecb33795d65f80fddfa46539578d3..95581162fab180c5a520c36140d81998abc8feb6 100644 (file)
@@ -25,7 +25,7 @@ protected:
   UErrorCode m_status_;
 public:
   ICUBreakFunction(const char *locale, const char *mode, const UChar *file, int32_t file_len) :
-      m_brkIt_(NULL),
+      m_brkIt_(nullptr),
       m_file_(file),
       m_fileLen_(file_len),
       m_noBreaks_(-1),
@@ -123,7 +123,7 @@ public:
   ~BreakIteratorPerformanceTest();
 
   virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec,
-    const char* &name, char* par = NULL);     
+    const char* &name, char* par = nullptr);
 
   UPerfFunction* TestICUForward();
   UPerfFunction* TestICUIsBound();
index 973f069acd6ebe22e1ce507f1d031d9549ec068d..2122fb417f4e4448b28f8a2254edd1a097bf5568 100644 (file)
@@ -164,8 +164,8 @@ OptSpec opts[] = {
 //---------------------------------------------------------------------------
 
 //DWORD          gWinLCID;
-BreakIterator *brkit = NULL;
-UChar *text = NULL;
+BreakIterator *brkit = nullptr;
+UChar *text = nullptr;
 int32_t textSize = 0;
 
 
@@ -507,7 +507,7 @@ UCharFile::UCharFile(const char * fileName) {
     }
     fFile                = fopen(fName, "rb");
     fPending2ndSurrogate = 0;
-    if (fFile == NULL) {
+    if (fFile == nullptr) {
         fprintf(stderr, "Can not open file \"%s\"\n", opt_fName);
         fError = true;
         return;
@@ -699,7 +699,7 @@ int main(int argc, const char** argv) {
       text = (UChar *)malloc(STARTSIZE*sizeof(UChar));
       bufSize = STARTSIZE;
     }
-    if(text == NULL) {
+    if(text == nullptr) {
       fprintf(stderr, "Allocating buffer failed\n");
       exit(-1);
     }
@@ -721,7 +721,7 @@ int main(int argc, const char** argv) {
         text[charCount++] = c;
         if(charCount == bufSize) {
           text = (UChar *)realloc(text, 2*bufSize*sizeof(UChar));
-          if(text == NULL) {
+          if(text == nullptr) {
             fprintf(stderr, "Reallocating buffer failed\n");
             exit(-1);
           }
@@ -765,10 +765,10 @@ int main(int argc, const char** argv) {
       }
     }
 
-  if(text != NULL) {
+  if(text != nullptr) {
     free(text);
   }
-    if(brkit != NULL) {
+    if(brkit != nullptr) {
       delete brkit;
     }
 
index f16db53b205f7b99db27549fd3b0f15d46407017..aa318ee328da02bc9ff71431cbe40371fc023898 100644 (file)
@@ -57,18 +57,18 @@ U_CDECL_BEGIN
 void *U_CALLCONV
 my_alloc(const void *context, size_t size) {
     size_t *p = (size_t *)malloc(size + sizeof(size_t));
-    if (p != NULL) {
+    if (p != nullptr) {
         icuMemUsage += size;
         *p = size;
         return p + 1;
     } else {
-        return NULL;
+        return nullptr;
     }
 }
 
 void U_CALLCONV
 my_free(const void *context, void *mem) {
-    if (mem != NULL) {
+    if (mem != nullptr) {
         const size_t *p = (const size_t *)mem - 1;
         icuMemUsage -= *p;
         free((void *)p);
@@ -79,7 +79,7 @@ my_free(const void *context, void *mem) {
 void *U_CALLCONV
 my_realloc(const void *context, void *mem, size_t size) {
     my_free(context, mem);
-    return NULL;
+    return nullptr;
 }
 
 U_CDECL_END
@@ -89,7 +89,7 @@ int main(int argc, const char *argv[]) {
 
     // Hook in our own memory allocation functions so that we can measure
     // the memory usage.
-    u_setMemoryFunctions(NULL, my_alloc, my_realloc, my_free, &errorCode);
+    u_setMemoryFunctions(nullptr, my_alloc, my_realloc, my_free, &errorCode);
     if(U_FAILURE(errorCode)) {
         fprintf(stderr,
                 "u_setMemoryFunctions() failed - %s\n",
index 59746bc46b022a44163aee24b0b08054e4e21305..974c1891d2ef0cc67c0581c4984861b71647ce07 100644 (file)
@@ -93,7 +93,7 @@ public:
             return;
         }
         BMPBitHash *bitHash=new BMPBitHash;
-        if(bitHash==NULL || restSet==NULL) {
+        if(bitHash==nullptr || restSet==nullptr) {
             errorCode=U_MEMORY_ALLOCATION_ERROR;
             return;
         }
@@ -154,7 +154,7 @@ public:
         if(bitHash->countKeys()>UPRV_LENGTHOF(shortBits)) {
             bits=(int64_t *)uprv_malloc(bitHash->countKeys()*8);
         }
-        if(bits!=NULL) {
+        if(bits!=nullptr) {
             bitHash->invert(bits);
         } else {
             bits=shortBits;
index 7d6269e208a6526e299d8f7cc76def475c78eb4a..8d2f8134c5bf5995d56e7fab7ccd88de8cbd1221 100644 (file)
 class TrieSet : public UObject, public UnicodeContainable {
 public:
     TrieSet(const UnicodeSet &set, UErrorCode &errorCode)
-            : trieData(NULL), latin1(NULL), restSet(set.clone()) {
+            : trieData(nullptr), latin1(nullptr), restSet(set.clone()) {
         if(U_FAILURE(errorCode)) {
             return;
         }
-        if(restSet==NULL) {
+        if(restSet==nullptr) {
             errorCode=U_MEMORY_ALLOCATION_ERROR;
             return;
         }
 
-        UNewTrie *newTrie=utrie_open(NULL, NULL, 0x11000, 0, 0, true);
+        UNewTrie *newTrie=utrie_open(nullptr, nullptr, 0x11000, 0, 0, true);
         UChar32 start, end;
 
         UnicodeSetIterator iter(set);
@@ -65,19 +65,19 @@ public:
         }
 
         // Preflight the trie length.
-        int32_t length=utrie_serialize(newTrie, NULL, 0, NULL, 8, &errorCode);
+        int32_t length=utrie_serialize(newTrie, nullptr, 0, nullptr, 8, &errorCode);
         if(errorCode!=U_BUFFER_OVERFLOW_ERROR) {
             return;
         }
 
         trieData=(uint32_t *)uprv_malloc(length);
-        if(trieData==NULL) {
+        if(trieData==nullptr) {
             errorCode=U_MEMORY_ALLOCATION_ERROR;
             return;
         }
 
         errorCode=U_ZERO_ERROR;
-        utrie_serialize(newTrie, trieData, length, NULL, 8, &errorCode);
+        utrie_serialize(newTrie, trieData, length, nullptr, 8, &errorCode);
         utrie_unserialize(&trie, trieData, length, &errorCode);  // TODO: Implement for 8-bit UTrie!
 
         if(U_SUCCESS(errorCode)) {
index e85d4492e25cbc2c037a98ece250a574f45f9fe8..86a451765c5d91f52b1ac7755249aea5bdbf5253 100644 (file)
@@ -50,7 +50,7 @@ class UnicodeSetPerformanceTest : public UPerfTest {
 public:
     UnicodeSetPerformanceTest(int32_t argc, const char *argv[], UErrorCode &status)
             : UPerfTest(argc, argv, options, UPRV_LENGTHOF(options), unisetperf_usage, status),
-              utf8(NULL), utf8Length(0), countInputCodePoints(0), spanCount(0) {
+              utf8(nullptr), utf8Length(0), countInputCodePoints(0), spanCount(0) {
         if (U_SUCCESS(status)) {
             UnicodeString pattern=UnicodeString(options[SET_PATTERN].value, -1, US_INV).unescape();
             set.applyPattern(pattern, status);
@@ -67,12 +67,12 @@ public:
                 countSpans();
 
                 // Preflight the UTF-8 length and allocate utf8.
-                u_strToUTF8(NULL, 0, &utf8Length, buffer, bufferLen, &status);
+                u_strToUTF8(nullptr, 0, &utf8Length, buffer, bufferLen, &status);
                 if(status==U_BUFFER_OVERFLOW_ERROR) {
                     utf8=(char *)malloc(utf8Length);
-                    if(utf8!=NULL) {
+                    if(utf8!=nullptr) {
                         status=U_ZERO_ERROR;
-                        u_strToUTF8(utf8, utf8Length, NULL, buffer, bufferLen, &status);
+                        u_strToUTF8(utf8, utf8Length, nullptr, buffer, bufferLen, &status);
                     } else {
                         status=U_MEMORY_ALLOCATION_ERROR;
                     }
@@ -89,7 +89,7 @@ public:
         }
     }
 
-    virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL);
+    virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = nullptr);
 
     // Count spans of characters that are in the set,
     // and spans of characters that are not in the set.
@@ -416,7 +416,7 @@ UPerfFunction* UnicodeSetPerformanceTest::runIndexedTest(int32_t index, UBool ex
         case 4: name = "SpanBackUTF8"; if (exec) return SpanBackUTF8::get(*this); break;
         default: name = ""; break;
     }
-    return NULL;
+    return nullptr;
 }
 
 int main(int argc, const char *argv[])
index ac5bc984a1d56bc4b857656993368683c04e244d..a834cfd38836a735b6dd09d13f24a9b00bdf8aed 100644 (file)
@@ -101,7 +101,7 @@ public:
     UsetPerformanceTest(int32_t argc, const char *argv[], UErrorCode &status) :UPerfTest(argc,argv,status){
     }
 
-    virtual UPerfFunction* runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ){
+    virtual UPerfFunction* runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ){
         switch (index) {
             case 0: name = "titlecase_letter_add"; 
                 if (exec) return new CmdOp(U_TITLECASE_LETTER, &CmdOp::add) ; break;
@@ -123,7 +123,7 @@ public:
                 if (exec) return new CmdPattern(PAT[2])  ; break;
             default: name = ""; break;
         }
-        return NULL;
+        return nullptr;
     }
 };
 
index 8dfc72c2e3e0b72ede114e8685938f153bebd5d5..13f52e22892ebb2a5634717a7c5a2dc999f14919 100644 (file)
@@ -69,8 +69,8 @@ StringPerformanceTest::StringPerformanceTest(int32_t argc, const char *argv[],
                                              UErrorCode &status)
                                              : UPerfTest(argc, argv, status)
 {
-    filelines_=NULL;
-    StrBuffer=NULL;
+    filelines_=nullptr;
+    StrBuffer=nullptr;
     StrBufferLen=0;
 
     int32_t len =0;
@@ -155,9 +155,9 @@ UPerfFunction* StringPerformanceTest::runIndexedTest(int32_t index, UBool exec,
 
         default: 
             name = ""; 
-            return NULL;
+            return nullptr;
     }
-    return NULL;
+    return nullptr;
 }
 
 UPerfFunction* StringPerformanceTest::TestCtor()
index 8021d8e43498df3e4296bdeedc3b4e7b5b994736..ee353774016ff397e3b0920e8a68ec612eeb7e2b 100644 (file)
@@ -141,13 +141,13 @@ public:
 
         fn1_ = func;
         lines_=srcLines;
-        wlines_=NULL;
+        wlines_=nullptr;
         numLines_=srcNumLines;
         uselen_=uselen;
         line_mode_=true;
-        src_ = NULL;
+        src_ = nullptr;
         srcLen_ = 0;
-        wsrc_ = NULL;
+        wsrc_ = nullptr;
         wsrcLen_ = 0;
         fnType_ = Fn_ICU;
 
@@ -155,9 +155,9 @@ public:
         for(int32_t i=0; i<numLines_; i++) {
             uS0_[i]=UnicodeString(lines_[i].name, lines_[i].len);
         }
-        sS0_=NULL;
-        ubulk_=NULL;
-        sbulk_=NULL;
+        sS0_=nullptr;
+        ubulk_=nullptr;
+        sbulk_=nullptr;
     }
 
     StringPerfFunction(StdStringPerfFn func, ULine* srcLines, int32_t srcNumLines, UBool uselen)
@@ -165,19 +165,19 @@ public:
 
         fn2_ = func;
         lines_=srcLines;
-        wlines_=NULL;
+        wlines_=nullptr;
         numLines_=srcNumLines;
         uselen_=uselen;
         line_mode_=true;
-        src_ = NULL;
+        src_ = nullptr;
         srcLen_ = 0;
-        wsrc_ = NULL;
+        wsrc_ = nullptr;
         wsrcLen_ = 0;
         fnType_ = Fn_STD;
 
-        uS0_=NULL;
-        ubulk_=NULL;
-        sbulk_=NULL;
+        uS0_=nullptr;
+        ubulk_=nullptr;
+        sbulk_=nullptr;
 
         //fillin wlines_[], sS0_[]
         prepareLinesForStd();
@@ -187,30 +187,30 @@ public:
     {
 
         fn1_ = func;
-        lines_=NULL;
-        wlines_=NULL;
+        lines_=nullptr;
+        wlines_=nullptr;
         numLines_=0;
         uselen_=uselen;
         line_mode_=false;
         src_ = new UChar[sourceLen];
         memcpy(src_, source, sourceLen * U_SIZEOF_UCHAR);
         srcLen_ = sourceLen;
-        wsrc_ = NULL;
+        wsrc_ = nullptr;
         wsrcLen_ = 0;
         fnType_ = Fn_ICU;
 
-        uS0_=NULL;
-        sS0_=NULL;     
+        uS0_=nullptr;
+        sS0_=nullptr;
         ubulk_=new UnicodeString(src_,srcLen_);
-        sbulk_=NULL;
+        sbulk_=nullptr;
     }
 
     StringPerfFunction(StdStringPerfFn func, UChar* source, int32_t sourceLen, UBool uselen)
     {
 
         fn2_ = func;
-        lines_=NULL;
-        wlines_=NULL;
+        lines_=nullptr;
+        wlines_=nullptr;
         numLines_=0;
         uselen_=uselen;
         line_mode_=false;
@@ -219,9 +219,9 @@ public:
         srcLen_ = sourceLen;
         fnType_ = Fn_STD;
 
-        uS0_=NULL;
-        sS0_=NULL;
-        ubulk_=NULL;
+        uS0_=nullptr;
+        sS0_=nullptr;
+        ubulk_=nullptr;
 
         //fillin wsrc_, sbulk_
         prepareBulkForStd();
@@ -278,7 +278,7 @@ private:
 
         const UChar* uSrc = src_;
         int32_t uSrcLen = srcLen_;
-        wchar_t* wDest = NULL;
+        wchar_t* wDest = nullptr;
         int32_t wDestLen = 0;
         int32_t reqLen= 0 ;
 
@@ -352,7 +352,7 @@ public:
     ~StringPerformanceTest();
     virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec,
                                           const char *&name,
-                                          char *par = NULL);
+                                          char *par = nullptr);
     UPerfFunction* TestCtor();
     UPerfFunction* TestCtor1();
     UPerfFunction* TestCtor2();
index 60d2f78b0046966b4081bf10fb1d2a9dbfa48e95..d4adacf84fe66aa4d26f77f67cb3a3f4790597e0 100644 (file)
@@ -93,7 +93,7 @@ public:
         }
     }
 
-    virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL);
+    virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = nullptr);
 
     const UChar *getBuffer() const { return buffer; }
     int32_t getBufferLen() const { return bufferLen; }
@@ -130,7 +130,7 @@ protected:
         if (U_FAILURE(errorCode)) {
             fprintf(stderr, "error opening converter for \"%s\" - %s\n", testcase.charset, u_errorName(errorCode));
         }
-        ucnv_setFromUCallBack(cnv, fromUCallback, NULL, NULL, NULL, &errorCode);
+        ucnv_setFromUCallBack(cnv, fromUCallback, nullptr, nullptr, nullptr, &errorCode);
     }
 public:
     virtual ~Command(){
@@ -161,7 +161,7 @@ public:
             return t;
         } else {
             delete t;
-            return NULL;
+            return nullptr;
         }
     }
     virtual void call(UErrorCode* pErrorCode){
@@ -188,7 +188,7 @@ public:
         do {
             /* convert a block of [pIn..pInLimit[ to the encoding in intermediate[] */
             pInter=intermediate;
-            ucnv_fromUnicode(cnv, &pInter, pInterLimit, &pIn, pInLimit, NULL, true, pErrorCode);
+            ucnv_fromUnicode(cnv, &pInter, pInterLimit, &pIn, pInLimit, nullptr, true, pErrorCode);
             encodedLength+=(int32_t)(pInter-intermediate);
 
             if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR) {
@@ -202,7 +202,7 @@ public:
 
             /* convert the block [intermediate..pInter[ back to UTF-16 */
             p=intermediate;
-            ucnv_toUnicode(cnv, &pOut, pOutLimit,&p, pInter,NULL, flush,pErrorCode);
+            ucnv_toUnicode(cnv, &pOut, pOutLimit,&p, pInter,nullptr, flush,pErrorCode);
             if(U_FAILURE(*pErrorCode)) {
                 return;
             }
@@ -228,7 +228,7 @@ public:
             return t;
         } else {
             delete t;
-            return NULL;
+            return nullptr;
         }
     }
     virtual void call(UErrorCode* pErrorCode){
@@ -247,7 +247,7 @@ public:
 
         for(;;) {
             pInter=intermediate;
-            ucnv_fromUnicode(cnv, &pInter, pInterLimit, &pIn, pInLimit, NULL, true, pErrorCode);
+            ucnv_fromUnicode(cnv, &pInter, pInterLimit, &pIn, pInLimit, nullptr, true, pErrorCode);
             encodedLength+=(int32_t)(pInter-intermediate);
 
             if(*pErrorCode==U_BUFFER_OVERFLOW_ERROR) {
@@ -267,7 +267,7 @@ class FromUTF8 : public Command {
 protected:
     FromUTF8(const UtfPerformanceTest &testcase)
             : Command(testcase),
-              utf8Cnv(NULL),
+              utf8Cnv(nullptr),
               input8(utf8), input8Length(utf8Length) {
         utf8Cnv=ucnv_open("UTF-8", &errorCode);
     }
@@ -278,7 +278,7 @@ public:
             return t;
         } else {
             delete t;
-            return NULL;
+            return nullptr;
         }
     }
     ~FromUTF8() {
@@ -335,7 +335,7 @@ UPerfFunction* UtfPerformanceTest::runIndexedTest(int32_t index, UBool exec, con
         case 2: name = "FromUTF8";      if (exec) return FromUTF8::get(*this); break;
         default: name = ""; break;
     }
-    return NULL;
+    return nullptr;
 }
 
 int main(int argc, const char *argv[])
index cfbc341e2080c50f881df669808c5833a92e2e31..30f9fea1086ce214d8d351fcc6609cbc0f00b95a 100644 (file)
@@ -47,8 +47,8 @@ U_NAMESPACE_END
 class UTrie2PerfTest : public UPerfTest {
 public:
     UTrie2PerfTest(int32_t argc, const char *argv[], UErrorCode &status)
-            : UPerfTest(argc, argv, NULL, 0, "", status),
-              utf8(NULL), utf8Length(0), countInputCodePoints(0) {
+            : UPerfTest(argc, argv, nullptr, 0, "", status),
+              utf8(nullptr), utf8Length(0), countInputCodePoints(0) {
         if (U_SUCCESS(status)) {
 #if 0       // See comment at unorm_initUTrie2() forward declaration.
             unorm_initUTrie2(&status);
@@ -60,12 +60,12 @@ public:
                 countInputCodePoints = u_countChar32(buffer, bufferLen);
 
                 // Preflight the UTF-8 length and allocate utf8.
-                u_strToUTF8(NULL, 0, &utf8Length, buffer, bufferLen, &status);
+                u_strToUTF8(nullptr, 0, &utf8Length, buffer, bufferLen, &status);
                 if(status==U_BUFFER_OVERFLOW_ERROR) {
                     utf8=(char *)malloc(utf8Length);
-                    if(utf8!=NULL) {
+                    if(utf8!=nullptr) {
                         status=U_ZERO_ERROR;
-                        u_strToUTF8(utf8, utf8Length, NULL, buffer, bufferLen, &status);
+                        u_strToUTF8(utf8, utf8Length, nullptr, buffer, bufferLen, &status);
                     } else {
                         status=U_MEMORY_ALLOCATION_ERROR;
                     }
@@ -81,7 +81,7 @@ public:
         }
     }
 
-    virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = NULL);
+    virtual UPerfFunction* runIndexedTest(int32_t index, UBool exec, const char* &name, char* par = nullptr);
 
     const UChar *getBuffer() const { return buffer; }
     int32_t getBufferLen() const { return bufferLen; }
@@ -163,7 +163,7 @@ public:
         return new CheckFCDUTF8(testcase);
     }
     virtual void call(UErrorCode* pErrorCode) {
-        UBool isFCD=unorm_checkFCDUTF8((const uint8_t *)testcase.utf8, testcase.utf8Length, NULL);
+        UBool isFCD=unorm_checkFCDUTF8((const uint8_t *)testcase.utf8, testcase.utf8Length, nullptr);
         if(isFCD>1) {
             fprintf(stderr, "error: bogus result from unorm_checkFCDUTF8()\n");
         }
@@ -178,7 +178,7 @@ protected:
         UErrorCode errorCode=U_ZERO_ERROR;
         destCapacity=unorm_normalize(testcase.getBuffer(), testcase.getBufferLen(),
                                      UNORM_NFC, 0,
-                                     NULL, 0,
+                                     nullptr, 0,
                                      &errorCode);
         dest=new UChar[destCapacity];
     }
@@ -240,7 +240,7 @@ UPerfFunction* UTrie2PerfTest::runIndexedTest(int32_t index, UBool exec, const c
 #endif
         default: name = ""; break;
     }
-    return NULL;
+    return nullptr;
 }
 
 int main(int argc, const char *argv[]) {
index ec35c03e555c459b580fcd3a45d02fdb075cc215..de5d1f8865e4d539ab58ae1779945c7b1c954867 100644 (file)
@@ -314,7 +314,7 @@ const UChar *ThaiWordbreakTest::readFile(char *fileName, int32_t &charCount)
     
     f = fopen(fileName, "rb");
     
-    if( f == NULL ) {
+    if( f == nullptr ) {
         fprintf(stderr,"Couldn't open %s reason: %s \n", fileName, strerror(errno));
         return 0;
     }
@@ -353,7 +353,7 @@ const UChar *ThaiWordbreakTest::readFile(char *fileName, int32_t &charCount)
     
     myText.extract(1, myText.length(), buffer);
     charCount--;  // skip the BOM
-    buffer[charCount] = 0;    // NULL terminate for easier reading in the debugger
+    buffer[charCount] = 0;    // NUL terminate for easier reading in the debugger
     
     return buffer;
 }
index d0ab0742a1049c134fb20c69f0378adbcd783902..6ab715eefb2b85c98bc7e65b850c740858bbaece 100644 (file)
@@ -72,7 +72,7 @@ RBDataMap::RBDataMap(UResourceBundle *headers, UResourceBundle *data, UErrorCode
 void RBDataMap::init(UResourceBundle *data, UErrorCode &status) {
   int32_t i = 0;
   fData->removeAll();
-  UResourceBundle *t = NULL;
+  UResourceBundle *t = nullptr;
   for(i = 0; i < ures_getSize(data); i++) {
     t = ures_getByIndex(data, i, t, &status);
     fData->put(UnicodeString(ures_getKey(t), -1, US_INV), new ResourceBundle(t, status), status);
@@ -84,8 +84,8 @@ void RBDataMap::init(UResourceBundle *headers, UResourceBundle *data, UErrorCode
 {
   int32_t i = 0;
   fData->removeAll();
-  UResourceBundle *t = NULL;
-  const UChar *key = NULL;
+  UResourceBundle *t = nullptr;
+  const UChar *key = nullptr;
   int32_t keyLen = 0;
   if(ures_getSize(headers) == ures_getSize(data)) {
     for(i = 0; i < ures_getSize(data); i++) {
@@ -103,16 +103,16 @@ void RBDataMap::init(UResourceBundle *headers, UResourceBundle *data, UErrorCode
 const ResourceBundle *RBDataMap::getItem(const char* key, UErrorCode &status) const
 {
   if(U_FAILURE(status)) {
-    return NULL;
+    return nullptr;
   }
 
   UnicodeString hashKey(key, -1, US_INV);
   const ResourceBundle *r = (ResourceBundle *)fData->get(hashKey);
-  if(r != NULL) {
+  if(r != nullptr) {
     return r;
   } else {
     status = U_MISSING_RESOURCE_ERROR;
-    return NULL;
+    return nullptr;
   }
 }
 
@@ -154,7 +154,7 @@ RBDataMap::getIntVector(int32_t &length, const char *key, UErrorCode &status) co
   if(U_SUCCESS(status)) {
     return r->getIntVector(length, status);
   } else {
-    return NULL;
+    return nullptr;
   }
 }
 
@@ -164,7 +164,7 @@ RBDataMap::getBinary(int32_t &length, const char *key, UErrorCode &status) const
   if(U_SUCCESS(status)) {
     return r->getBinary(length, status);
   } else {
-    return NULL;
+    return nullptr;
   }
 }
 
@@ -186,7 +186,7 @@ const UnicodeString* RBDataMap::getStringArray(int32_t& count, const char* key,
 
     count = r->getSize();
     if(count <= 0) {
-      return NULL;
+      return nullptr;
     }
 
     UnicodeString *result = new UnicodeString[count];
@@ -195,7 +195,7 @@ const UnicodeString* RBDataMap::getStringArray(int32_t& count, const char* key,
     }
     return result;
   } else {
-    return NULL;
+    return nullptr;
   }
 }
 
@@ -207,7 +207,7 @@ const int32_t* RBDataMap::getIntArray(int32_t& count, const char* key, UErrorCod
 
     count = r->getSize();
     if(count <= 0) {
-      return NULL;
+      return nullptr;
     }
 
     int32_t *result = new int32_t[count];
@@ -218,7 +218,7 @@ const int32_t* RBDataMap::getIntArray(int32_t& count, const char* key, UErrorCod
     }
     return result;
   } else {
-    return NULL;
+    return nullptr;
   }
 }
 
index fe894352616c1b7b51b0452bdfcd4b57878a8a30..2fb93381dc060a0886b457c590f9daf64a49cdc3 100644 (file)
@@ -13,9 +13,9 @@
 
 TestData::TestData(const char* testName)
 : name(testName),
-fInfo(NULL),
-fCurrSettings(NULL),
-fCurrCase(NULL),
+fInfo(nullptr),
+fCurrSettings(nullptr),
+fCurrCase(nullptr),
 fSettingsSize(0),
 fCasesSize(0),
 fCurrentSettings(0),
@@ -25,13 +25,13 @@ fCurrentCase(0)
 }
 
 TestData::~TestData() {
-  if(fInfo != NULL) {
+  if(fInfo != nullptr) {
     delete fInfo;
   }
-  if(fCurrSettings != NULL) {
+  if(fCurrSettings != nullptr) {
     delete fCurrSettings;
   }
-  if(fCurrCase != NULL) {
+  if(fCurrCase != nullptr) {
     delete fCurrCase;
   }
 }
@@ -45,10 +45,10 @@ const char * TestData::getName() const
 
 RBTestData::RBTestData(const char* testName)
 : TestData(testName),
-fData(NULL),
-fHeaders(NULL),
-fSettings(NULL),
-fCases(NULL)
+fData(nullptr),
+fHeaders(nullptr),
+fSettings(nullptr),
+fCases(nullptr)
 {
 }
 
@@ -56,26 +56,26 @@ RBTestData::RBTestData(UResourceBundle *data, UResourceBundle *headers, UErrorCo
 : TestData(ures_getKey(data)),
 fData(data),
 fHeaders(headers),
-fSettings(NULL),
-fCases(NULL)
+fSettings(nullptr),
+fCases(nullptr)
 {
   UErrorCode intStatus = U_ZERO_ERROR;
-  UResourceBundle *currHeaders = ures_getByKey(data, "Headers", NULL, &intStatus);
+  UResourceBundle *currHeaders = ures_getByKey(data, "Headers", nullptr, &intStatus);
   if(intStatus == U_ZERO_ERROR) {
     ures_close(fHeaders);
     fHeaders = currHeaders;
   } else {
     intStatus = U_ZERO_ERROR;
   }
-  fSettings = ures_getByKey(data, "Settings", NULL, &intStatus);
+  fSettings = ures_getByKey(data, "Settings", nullptr, &intStatus);
   fSettingsSize = ures_getSize(fSettings);
-  UResourceBundle *info = ures_getByKey(data, "Info", NULL, &intStatus);
+  UResourceBundle *info = ures_getByKey(data, "Info", nullptr, &intStatus);
   if(U_SUCCESS(intStatus)) {
     fInfo = new RBDataMap(info, status);
   } else {
     intStatus = U_ZERO_ERROR;
   }
-  fCases = ures_getByKey(data, "Cases", NULL, &status);
+  fCases = ures_getByKey(data, "Cases", nullptr, &status);
   fCasesSize = ures_getSize(fCases);
 
   ures_close(info);
@@ -96,7 +96,7 @@ UBool RBTestData::getInfo(const DataMap *& info, UErrorCode &/*status*/) const
     info = fInfo;
     return true;
   } else {
-    info = NULL;
+    info = nullptr;
     return false;
   }
 }
@@ -104,11 +104,11 @@ UBool RBTestData::getInfo(const DataMap *& info, UErrorCode &/*status*/) const
 UBool RBTestData::nextSettings(const DataMap *& settings, UErrorCode &status)
 {
   UErrorCode intStatus = U_ZERO_ERROR;
-  UResourceBundle *data = ures_getByIndex(fSettings, fCurrentSettings++, NULL, &intStatus);
+  UResourceBundle *data = ures_getByIndex(fSettings, fCurrentSettings++, nullptr, &intStatus);
   if(U_SUCCESS(intStatus)) {
     // reset the cases iterator
     fCurrentCase = 0;
-    if(fCurrSettings == NULL) {
+    if(fCurrSettings == nullptr) {
       fCurrSettings = new RBDataMap(data, status);
     } else {
       ((RBDataMap *)fCurrSettings)->init(data, status);
@@ -117,7 +117,7 @@ UBool RBTestData::nextSettings(const DataMap *& settings, UErrorCode &status)
     settings = fCurrSettings;
     return true;
   } else {
-    settings = NULL;
+    settings = nullptr;
     return false;
   }
 }
@@ -125,9 +125,9 @@ UBool RBTestData::nextSettings(const DataMap *& settings, UErrorCode &status)
 UBool RBTestData::nextCase(const DataMap *& nextCase, UErrorCode &status)
 {
   UErrorCode intStatus = U_ZERO_ERROR;
-  UResourceBundle *currCase = ures_getByIndex(fCases, fCurrentCase++, NULL, &intStatus);
+  UResourceBundle *currCase = ures_getByIndex(fCases, fCurrentCase++, nullptr, &intStatus);
   if(U_SUCCESS(intStatus)) {
-    if(fCurrCase == NULL) {
+    if(fCurrCase == nullptr) {
       fCurrCase = new RBDataMap(fHeaders, currCase, status);
     } else {
       ((RBDataMap *)fCurrCase)->init(fHeaders, currCase, status);
@@ -136,7 +136,7 @@ UBool RBTestData::nextCase(const DataMap *& nextCase, UErrorCode &status)
     nextCase = fCurrCase;
     return true;
   } else {
-    nextCase = NULL;
+    nextCase = nullptr;
     return false;
   }
 }
index bd9a15ba3bb79f333e6c17bb03ebe219c143d267..3ebe22466ecb7476f51911745ad43247d84f85c7 100644 (file)
@@ -137,9 +137,9 @@ void IcuTestErrorCode::errlog(UBool dataErr, const UnicodeString& mainMessage, c
 TestDataModule *TestDataModule::getTestDataModule(const char* name, TestLog& log, UErrorCode &status)
 {
   if(U_FAILURE(status)) {
-    return NULL;
+    return nullptr;
   }
-  TestDataModule *result = NULL;
+  TestDataModule *result = nullptr;
 
   // TODO: probe for resource bundle and then for XML.
   // According to that, construct an appropriate driver object
@@ -149,19 +149,19 @@ TestDataModule *TestDataModule::getTestDataModule(const char* name, TestLog& log
     return result;
   } else {
     delete result;
-    return NULL;
+    return nullptr;
   }
 }
 
 TestDataModule::TestDataModule(const char* name, TestLog& log, UErrorCode& /*status*/)
 : testName(name),
-fInfo(NULL),
+fInfo(nullptr),
 fLog(log)
 {
 }
 
 TestDataModule::~TestDataModule() {
-  if(fInfo != NULL) {
+  if(fInfo != nullptr) {
     delete fInfo;
   }
 }
@@ -183,18 +183,18 @@ RBTestDataModule::~RBTestDataModule()
 
 RBTestDataModule::RBTestDataModule(const char* name, TestLog& log, UErrorCode& status) 
 : TestDataModule(name, log, status),
-  fModuleBundle(NULL),
-  fTestData(NULL),
-  fInfoRB(NULL),
-  tdpath(NULL)
+  fModuleBundle(nullptr),
+  fTestData(nullptr),
+  fInfoRB(nullptr),
+  tdpath(nullptr)
 {
   fNumberOfTests = 0;
   fDataTestValid = true;
   fModuleBundle = getTestBundle(name, status);
   if(fDataTestValid) {
-    fTestData = ures_getByKey(fModuleBundle, "TestData", NULL, &status);
+    fTestData = ures_getByKey(fModuleBundle, "TestData", nullptr, &status);
     fNumberOfTests = ures_getSize(fTestData);
-    fInfoRB = ures_getByKey(fModuleBundle, "Info", NULL, &status);
+    fInfoRB = ures_getByKey(fModuleBundle, "Info", nullptr, &status);
     if(status != U_ZERO_ERROR) {
       log.errln(UNICODE_STRING_SIMPLE("Unable to initialize test data - missing mandatory description resources!"));
       fDataTestValid = false;
@@ -216,13 +216,13 @@ UBool RBTestDataModule::getInfo(const DataMap *& info, UErrorCode &/*status*/) c
 
 TestData* RBTestDataModule::createTestData(int32_t index, UErrorCode &status) const 
 {
-  TestData *result = NULL;
+  TestData *result = nullptr;
   UErrorCode intStatus = U_ZERO_ERROR;
 
   if(fDataTestValid == true) {
     // Both of these resources get adopted by a TestData object.
-    UResourceBundle *DataFillIn = ures_getByIndex(fTestData, index, NULL, &status); 
-    UResourceBundle *headers = ures_getByKey(fInfoRB, "Headers", NULL, &intStatus);
+    UResourceBundle *DataFillIn = ures_getByIndex(fTestData, index, nullptr, &status); 
+    UResourceBundle *headers = ures_getByKey(fInfoRB, "Headers", nullptr, &intStatus);
   
     if(U_SUCCESS(status)) {
       result = new RBTestData(DataFillIn, headers, status);
@@ -239,18 +239,18 @@ TestData* RBTestDataModule::createTestData(int32_t index, UErrorCode &status) co
   } else {
     status = U_MISSING_RESOURCE_ERROR;
   }
-  return NULL;
+  return nullptr;
 }
 
 TestData* RBTestDataModule::createTestData(const char* name, UErrorCode &status) const
 {
-  TestData *result = NULL;
+  TestData *result = nullptr;
   UErrorCode intStatus = U_ZERO_ERROR;
 
   if(fDataTestValid == true) {
     // Both of these resources get adopted by a TestData object.
-    UResourceBundle *DataFillIn = ures_getByKey(fTestData, name, NULL, &status); 
-    UResourceBundle *headers = ures_getByKey(fInfoRB, "Headers", NULL, &intStatus);
+    UResourceBundle *DataFillIn = ures_getByKey(fTestData, name, nullptr, &status); 
+    UResourceBundle *headers = ures_getByKey(fInfoRB, "Headers", nullptr, &intStatus);
    
     if(U_SUCCESS(status)) {
       result = new RBTestData(DataFillIn, headers, status);
@@ -266,7 +266,7 @@ TestData* RBTestDataModule::createTestData(const char* name, UErrorCode &status)
   } else {
     status = U_MISSING_RESOURCE_ERROR;
   }
-  return NULL;
+  return nullptr;
 }
 
 
@@ -276,9 +276,9 @@ UResourceBundle*
 RBTestDataModule::getTestBundle(const char* bundleName, UErrorCode &status) 
 {
   if(U_SUCCESS(status)) {
-    UResourceBundle *testBundle = NULL;
+    UResourceBundle *testBundle = nullptr;
     const char* icu_data = fLog.getTestDataPath(status);
-    if (testBundle == NULL) {
+    if (testBundle == nullptr) {
         testBundle = ures_openDirect(icu_data, bundleName, &status);
         if (status != U_ZERO_ERROR) {
             fLog.dataerrln(UNICODE_STRING_SIMPLE("Could not load test data from resourcebundle: ") + UnicodeString(bundleName, -1, US_INV));
@@ -287,7 +287,7 @@ RBTestDataModule::getTestBundle(const char* bundleName, UErrorCode &status)
     }
     return testBundle;
   } else {
-    return NULL;
+    return nullptr;
   }
 }
 
index ab0bc9558667b1b88f751e69e042031b805f2e17..77db9ceaf11c5767a83fd79541b1b63d2079e71e 100644 (file)
@@ -27,8 +27,8 @@
   *  the TestDataModule info section. The default headers will be overridden
   *  by per-test headers. 
   *  Example:                                             
-  *  DataMap *settings = NULL;                            
-  *  DataMap *cases = NULL;                               
+  *  DataMap *settings = nullptr;
+  *  DataMap *cases = nullptr;
   *  while(nextSettings(settings, status)) {              
   *    // set settings for the subtest                    
   *    while(nextCase(cases, status) {                    
@@ -59,13 +59,13 @@ public:
   /** Get a pointer to an object owned DataMap that contains more information on this
    *  TestData object.
    *  Usual fields is "Description".                                   
-   *  @param info pass in a const DataMap pointer. If no info, it will be set to NULL
+   *  @param info pass in a const DataMap pointer. If no info, it will be set to nullptr
    */
   virtual UBool getInfo(const DataMap *& info, UErrorCode &status) const = 0;
 
   /** Gets the next set of settings for the test. Resets the cases iterator. 
    *  DataMap is owned by the object and should not be deleted. 
-   *  @param settings a DataMap pointer provided by the user. Will be NULL if 
+   *  @param settings a DataMap pointer provided by the user. Will be nullptr if
    *                  no more settings are available.
    *  @param status for reporting unexpected errors.
    *  @return A boolean, true if there are settings, false if there is no more 
@@ -75,7 +75,7 @@ public:
 
   /** Gets the next test case. 
    *  DataMap is owned by the object and should not be deleted. 
-   *  @param data a DataMap pointer provided by the user. Will be NULL if 
+   *  @param data a DataMap pointer provided by the user. Will be nullptr if 
    *                  no more cases are available.
    *  @param status for reporting unexpected errors.
    *  @return A boolean, true if there are cases, false if there is no more 
index 683a26c3398abb644f21889a30e8efa393291c73..fb2f19631df9b0cc3354a03ab555d61e8295c538 100644 (file)
@@ -64,7 +64,7 @@ public:
    *  Usual fields are "Description", "LongDescription", "Settings". Also, if containing a   
    *  field "Headers" these will be used as the default headers, so that you don't have to   
    *  to specify per test headers.                                                           
-   *  @param info pass in a const DataMap pointer. If no info, it will be set to NULL
+   *  @param info pass in a const DataMap pointer. If no info, it will be set to nullptr
    */
   virtual UBool getInfo(const DataMap *& info, UErrorCode &status) const = 0;
 
index ea9ec1f255bee8e8fb798d596c22a01e28986e3a..e7e0479769f9633843467a9630ddd8836ba0f32f 100644 (file)
@@ -37,7 +37,7 @@ U_NAMESPACE_USE
 //|             name = "";
 //|             break;
 //|     }
-//|     return NULL;
+//|     return nullptr;
 //| }
 #define TESTCASE(id,test)                       \
     case id:                                    \
@@ -57,7 +57,7 @@ U_NAMESPACE_USE
 //|     TESTCASE_AUTO(TestSomethingElse);
 //|     TESTCASE_AUTO(TestAnotherThing);
 //|     TESTCASE_AUTO_END;
-//|     return NULL;
+//|     return nullptr;
 //| }
 #define TESTCASE_AUTO_BEGIN \
     for(;;) { \
@@ -133,7 +133,7 @@ public:
 class T_CTEST_EXPORT_API UPerfTest {
 public:
     UBool run();
-    UBool runTest( char* name = NULL, char* par = NULL ); // not to be overridden
+    UBool runTest( char* name = nullptr, char* par = nullptr ); // not to be overridden
         
     virtual void usage( void ) ;
     
@@ -158,7 +158,7 @@ protected:
     void init(UOption addOptions[], int32_t addOptionsCount,
               UErrorCode& status);
 
-    virtual UPerfFunction* runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ); // override !
+    virtual UPerfFunction* runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = nullptr ); // override !
 
     virtual UBool runTestLoop( char* testname, char* par );
 
index e12485d9d375adb12269227a365a19916c2f54c5..ab7bcb8fb4084952a658221b22f25922d81f03c9 100644 (file)
@@ -68,7 +68,7 @@
  *          int  line;
  *          int  loops;
  *          UErrorCode error = U_ZERO_ERROR;
- *          UChar* dest=NULL;
+ *          UChar* dest=nullptr;
  *          int32_t destCapacity=0;
  *          int len =-1;
  *          double elapsedTime = 0; 
index 45811ddd0302c37765a57771343811725143ea97..7a75dfbe035450deb84d200034e843ded5a06083 100644 (file)
@@ -22,7 +22,7 @@ UPerfFunction::~UPerfFunction() {}
 
 static const char delim = '/';
 static int32_t execCount = 0;
-UPerfTest* UPerfTest::gTest = NULL;
+UPerfTest* UPerfTest::gTest = nullptr;
 static const int MAXLINES = 40000;
 const char UPerfTest::gUsageString[] =
     "Usage: %s [OPTIONS] [FILES]\n"
@@ -81,16 +81,16 @@ static UOption options[OPTIONS_COUNT+20]={
 };
 
 UPerfTest::UPerfTest(int32_t argc, const char* argv[], UErrorCode& status)
-        : _argc(argc), _argv(argv), _addUsage(NULL),
-          ucharBuf(NULL), encoding(""),
+        : _argc(argc), _argv(argv), _addUsage(nullptr),
+          ucharBuf(nullptr), encoding(""),
           uselen(false),
-          fileName(NULL), sourceDir("."),
-          lines(NULL), numLines(0), line_mode(true),
-          buffer(NULL), bufferLen(0),
+          fileName(nullptr), sourceDir("."),
+          lines(nullptr), numLines(0), line_mode(true),
+          buffer(nullptr), bufferLen(0),
           verbose(false), bulk_mode(false),
           passes(1), iterations(0), time(0),
-          locale(NULL) {
-    init(NULL, 0, status);
+          locale(nullptr) {
+    init(nullptr, 0, status);
 }
 
 UPerfTest::UPerfTest(int32_t argc, const char* argv[],
@@ -98,14 +98,14 @@ UPerfTest::UPerfTest(int32_t argc, const char* argv[],
                      const char *addUsage,
                      UErrorCode& status)
         : _argc(argc), _argv(argv), _addUsage(addUsage),
-          ucharBuf(NULL), encoding(""),
+          ucharBuf(nullptr), encoding(""),
           uselen(false),
-          fileName(NULL), sourceDir("."),
-          lines(NULL), numLines(0), line_mode(true),
-          buffer(NULL), bufferLen(0),
+          fileName(nullptr), sourceDir("."),
+          lines(nullptr), numLines(0), line_mode(true),
+          buffer(nullptr), bufferLen(0),
           verbose(false), bulk_mode(false),
           passes(1), iterations(0), time(0),
-          locale(NULL) {
+          locale(nullptr) {
     init(addOptions, addOptionsCount, status);
 }
 
@@ -114,7 +114,7 @@ void UPerfTest::init(UOption addOptions[], int32_t addOptionsCount,
     //initialize the argument list
     U_MAIN_INIT_ARGS(_argc, _argv);
 
-    resolvedFileName = NULL;
+    resolvedFileName = nullptr;
 
     // add specific options
     int32_t optionsCount = OPTIONS_COUNT;
@@ -187,11 +187,11 @@ void UPerfTest::init(UOption addOptions[], int32_t addOptionsCount,
     }
 
     int32_t len = 0;
-    if(fileName!=NULL){
+    if(fileName!=nullptr){
         //pre-flight
-        ucbuf_resolveFileName(sourceDir, fileName, NULL, &len, &status);
+        ucbuf_resolveFileName(sourceDir, fileName, nullptr, &len, &status);
         resolvedFileName = (char*) uprv_malloc(len);
-        if(resolvedFileName==NULL){
+        if(resolvedFileName==nullptr){
             status= U_MEMORY_ALLOCATION_ERROR;
             return;
         }
@@ -210,19 +210,19 @@ void UPerfTest::init(UOption addOptions[], int32_t addOptionsCount,
 
 ULine* UPerfTest::getLines(UErrorCode& status){
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
-    if (lines != NULL) {
+    if (lines != nullptr) {
         return lines;  // don't do it again
     }
     lines     = new ULine[MAXLINES];
     int maxLines = MAXLINES;
     numLines=0;
-    const UChar* line=NULL;
+    const UChar* line=nullptr;
     int32_t len =0;
     for (;;) {
         line = ucbuf_readline(ucharBuf,&len,&status);
-        if(line == NULL || U_FAILURE(status)){
+        if(line == nullptr || U_FAILURE(status)){
             break;
         }
         lines[numLines].name  = new UChar[len];
@@ -234,11 +234,11 @@ ULine* UPerfTest::getLines(UErrorCode& status){
         if (numLines >= maxLines) {
             maxLines += MAXLINES;
             ULine *newLines = new ULine[maxLines];
-            if(newLines == NULL) {
+            if(newLines == nullptr) {
                 fprintf(stderr, "Out of memory reading line %d.\n", (int)numLines);
                 status= U_MEMORY_ALLOCATION_ERROR;
                 delete []lines;
-                return NULL;
+                return nullptr;
             }
 
             memcpy(newLines, lines, numLines*sizeof(ULine));
@@ -250,7 +250,7 @@ ULine* UPerfTest::getLines(UErrorCode& status){
 }
 const UChar* UPerfTest::getBuffer(int32_t& len, UErrorCode& status){
     if (U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
     len = ucbuf_size(ucharBuf);
     buffer =  (UChar*) uprv_malloc(U_SIZEOF_UCHAR * (len+1));
@@ -290,7 +290,7 @@ UBool UPerfTest::run(){
 }
 UBool UPerfTest::runTest(char* name, char* par ){
     UBool rval;
-    char* pos = NULL;
+    char* pos = nullptr;
 
     if (name)
         pos = strchr( name, delim ); // check if name contains path (by looking for '/')
@@ -298,11 +298,11 @@ UBool UPerfTest::runTest(char* name, char* par ){
         path = pos+1;   // store subpath for calling subtest
         *pos = 0;       // split into two strings
     }else{
-        path = NULL;
+        path = nullptr;
     }
 
     if (!name || (name[0] == 0) || (strcmp(name, "*") == 0)) {
-        rval = runTestLoop( NULL, NULL );
+        rval = runTestLoop( nullptr, nullptr );
 
     }else if (strcmp( name, "LIST" ) == 0) {
         this->usage();
@@ -335,7 +335,7 @@ UPerfFunction* UPerfTest::runIndexedTest( int32_t /*index*/, UBool /*exec*/, con
     }
     */
     fprintf(stderr,"*** runIndexedTest needs to be overridden! ***");
-    return NULL;
+    return nullptr;
 }
 
 
@@ -365,8 +365,8 @@ UBool UPerfTest::runTestLoop( char* testname, char* par )
             UPerfFunction* testFunction = this->runIndexedTest( index, true, name, par );
             execCount++;
             rval=true;
-            if(testFunction==NULL){
-                fprintf(stderr,"%s function returned NULL", name);
+            if(testFunction==nullptr){
+                fprintf(stderr,"%s function returned nullptr", name);
                 return false;
             }
             ops = testFunction->getOperationsPerIteration();
@@ -478,7 +478,7 @@ UBool UPerfTest::runTestLoop( char* testname, char* par )
 void UPerfTest::usage( void )
 {
     puts(gUsageString);
-    if (_addUsage != NULL) {
+    if (_addUsage != nullptr) {
         puts(_addUsage);
     }
 
@@ -488,7 +488,7 @@ void UPerfTest::usage( void )
     fprintf(stdout,"-----------\n");
 
     int32_t index = 0;
-    const char* name = NULL;
+    const char* name = nullptr;
     do{
         this->runIndexedTest( index, false, name );
         if (!name)
@@ -518,13 +518,13 @@ UBool UPerfTest::callTest( UPerfTest& testToBeCalled, char* par )
 }
 
 UPerfTest::~UPerfTest(){
-    if(lines!=NULL){
+    if(lines!=nullptr){
         delete[] lines;
     }
-    if(buffer!=NULL){
+    if(buffer!=nullptr){
         uprv_free(buffer);
     }
-    if(resolvedFileName!=NULL){
+    if(resolvedFileName!=nullptr){
         uprv_free(resolvedFileName);
     }
     ucbuf_close(ucharBuf);
index a2ee006fd82f14c22c2792d3e4ff04f255301831..a83d782b411f2ba10c08ef59208e860f08050c4c 100644 (file)
@@ -53,8 +53,8 @@ static UOption options[]={
     UOPTION_HELP_H,             /* 0 */
     UOPTION_HELP_QUESTION_MARK, /* 1 */
     UOPTION_VERBOSE,            /* 2 */
-    { "rules", NULL, NULL, NULL, 'r', UOPT_REQUIRES_ARG, 0 },   /* 3 */
-    { "out",   NULL, NULL, NULL, 'o', UOPT_REQUIRES_ARG, 0 },   /* 4 */
+    { "rules", nullptr, nullptr, nullptr, 'r', UOPT_REQUIRES_ARG, 0 },   /* 3 */
+    { "out",   nullptr, nullptr, nullptr, 'o', UOPT_REQUIRES_ARG, 0 },   /* 4 */
     UOPTION_ICUDATADIR,         /* 5 */
     UOPTION_DESTDIR,            /* 6 */
     UOPTION_COPYRIGHT,          /* 7 */
@@ -131,8 +131,8 @@ int  main(int argc, char **argv) {
     UErrorCode  status = U_ZERO_ERROR;
     const char *ruleFileName;
     const char *outFileName;
-    const char *outDir = NULL;
-    const char *copyright = NULL;
+    const char *outDir = nullptr;
+    const char *copyright = nullptr;
 
     //
     // Pick up and check the command line arguments,
@@ -183,7 +183,7 @@ int  main(int argc, char **argv) {
     fprintf(stderr, "%s\n", msg);
 
     /* write the dummy data file */
-    pData = udata_create(outDir, NULL, outFileName, &dummyDataInfo, NULL, &status);
+    pData = udata_create(outDir, nullptr, outFileName, &dummyDataInfo, nullptr, &status);
     udata_writeBlock(pData, msg, strlen(msg));
     udata_finish(pData, &status);
     return (int)status;
@@ -234,7 +234,7 @@ int  main(int argc, char **argv) {
     if (U_FAILURE(status)) {
         exit(status);
     }
-    if(encoding!=NULL ){
+    if(encoding!=nullptr ){
         ruleSourceC  += signatureLength;
         ruleFileSize -= signatureLength;
     }
@@ -254,7 +254,7 @@ int  main(int argc, char **argv) {
     //  Preflight first to determine required buffer size.
     //
     uint32_t destCap = ucnv_toUChars(conv,
-                       NULL,           //  dest,
+                       nullptr,           //  dest,
                        0,              //  destCapacity,
                        ruleSourceC,
                        ruleFileSize,
@@ -314,7 +314,7 @@ int  main(int argc, char **argv) {
     //
     size_t bytesWritten;
     UNewDataMemory *pData;
-    pData = udata_create(outDir, NULL, outFileName, &(dh.info), copyright, &status);
+    pData = udata_create(outDir, nullptr, outFileName, &(dh.info), copyright, &status);
     if(U_FAILURE(status)) {
         fprintf(stderr, "genbrk: Could not open output file \"%s\", \"%s\"\n", 
                          outFileName, u_errorName(status));
index 3365efc3268efdb2675089b8587b72165270f637..543cd76afa5d3a25fd06dbf850452be9ff4b031c 100644 (file)
@@ -55,9 +55,9 @@ static UOption options[]={
     UOPTION_HELP_H,             /* 0 */
     UOPTION_HELP_QUESTION_MARK, /* 1 */
     UOPTION_VERBOSE,            /* 2 */
-    { "rules", NULL, NULL, NULL, 'r', UOPT_REQUIRES_ARG, 0 },   /* 3 */
-    { "wsrules", NULL, NULL, NULL, 'w', UOPT_REQUIRES_ARG, 0},  /* 4 */  // deprecated
-    { "out",   NULL, NULL, NULL, 'o', UOPT_REQUIRES_ARG, 0 },   /* 5 */
+    { "rules", nullptr, nullptr, nullptr, 'r', UOPT_REQUIRES_ARG, 0 },   /* 3 */
+    { "wsrules", nullptr, nullptr, nullptr, 'w', UOPT_REQUIRES_ARG, 0},  /* 4 */  // deprecated
+    { "out",   nullptr, nullptr, nullptr, 'o', UOPT_REQUIRES_ARG, 0 },   /* 5 */
     UOPTION_ICUDATADIR,         /* 6 */
     UOPTION_DESTDIR,            /* 7 */
     UOPTION_COPYRIGHT,          /* 8 */
@@ -137,8 +137,8 @@ int  main(int argc, char **argv) {
     UErrorCode  status = U_ZERO_ERROR;
     const char *confFileName;
     const char *outFileName;
-    const char *outDir = NULL;
-    const char *copyright = NULL;
+    const char *outDir = nullptr;
+    const char *copyright = nullptr;
 
     //
     // Pick up and check the command line arguments,
@@ -197,7 +197,7 @@ int  main(int argc, char **argv) {
     fprintf(stderr, "%s\n", msg);
 
     /* write the dummy data file */
-    pData = udata_create(outDir, NULL, outFileName, &dummyDataInfo, NULL, &status);
+    pData = udata_create(outDir, nullptr, outFileName, &dummyDataInfo, nullptr, &status);
     udata_writeBlock(pData, msg, strlen(msg));
     udata_finish(pData, &status);
     return (int)status;
@@ -216,7 +216,7 @@ int  main(int argc, char **argv) {
 
     int32_t      confusablesLen = 0;
     const char  *confusables = readFile(confFileName, &confusablesLen);
-    if (confusables == NULL) {
+    if (confusables == nullptr) {
         printf("gencfu: error reading file  \"%s\"\n", confFileName);
         exit(-1);
     }
@@ -230,7 +230,7 @@ int  main(int argc, char **argv) {
     parseError.offset = 0;
     int32_t errType;
     USpoofChecker *sc = uspoof_openFromSource(confusables, confusablesLen,
-                                              NULL, 0,
+                                              nullptr, 0,
                                               &errType, &parseError, &status);
     if (U_FAILURE(status)) {
         fprintf(stderr, "gencfu: uspoof_openFromSource error \"%s\"  at file %s, line %d, column %d\n",
@@ -244,7 +244,7 @@ int  main(int argc, char **argv) {
     //
     uint32_t        outDataSize;
     uint8_t        *outData;
-    outDataSize = uspoof_serialize(sc, NULL, 0, &status);
+    outDataSize = uspoof_serialize(sc, nullptr, 0, &status);
     if (status != U_BUFFER_OVERFLOW_ERROR) {
         fprintf(stderr, "gencfu: uspoof_serialize() returned %s\n", u_errorName(status));
         exit(status);
@@ -264,7 +264,7 @@ int  main(int argc, char **argv) {
     //
     size_t bytesWritten;
     UNewDataMemory *pData;
-    pData = udata_create(outDir, NULL, outFileName, &(dh.info), copyright, &status);
+    pData = udata_create(outDir, nullptr, outFileName, &(dh.info), copyright, &status);
     if(U_FAILURE(status)) {
         fprintf(stderr, "gencfu: Could not open output file \"%s\", \"%s\"\n", 
                          outFileName, u_errorName(status));
@@ -308,22 +308,22 @@ int  main(int argc, char **argv) {
 
     file = fopen(fileName, "rb");
     if( file == 0 ) {
-        return NULL;
+        return nullptr;
     }
     fseek(file, 0, SEEK_END);
     fileSize = ftell(file);
     fseek(file, 0, SEEK_SET);
     result = new char[fileSize+10];
-    if (result==NULL) {
+    if (result==nullptr) {
         fclose(file);
-        return NULL;
+        return nullptr;
     }
 
     long t = static_cast<long>(fread(result, 1, fileSize, file));
     if (t != fileSize)  {
         delete [] result;
         fclose(file);
-        return NULL;
+        return nullptr;
     }
     result[fileSize]=0;
     *len = static_cast<int32_t>(fileSize);
index 0a0830169f14f43ee01bda8c0f038f8f15416a42..f4ddb62b6717364c976f434621ecab59632eb755 100644 (file)
@@ -43,7 +43,7 @@ int main(int argc, const char *argv[]) {
     
     UErrorCode preflightCode = U_ZERO_ERROR;
     // preflight
-    int32_t serializedCount = unsafeBackwardSet->serialize(NULL,0,preflightCode);
+    int32_t serializedCount = unsafeBackwardSet->serialize(nullptr,0,preflightCode);
     if(U_FAILURE(preflightCode) && preflightCode != U_BUFFER_OVERFLOW_ERROR) {
       fprintf(stderr, "Err: %s preflighting unicode set\n", u_errorName(preflightCode));
       return 1;
index fe2093c056ace57463a39ac4b8c170c21ae18726..03a493048945028c774e81cb43a91a930338769d 100644 (file)
@@ -53,7 +53,7 @@ int main(int argc, const char *argv[]) {
     printf("Finished deserialize with %d ranges\n", u.getRangeCount());
   }
 #endif
-// if(tailoring.unsafeBackwardSet == NULL) {
+// if(tailoring.unsafeBackwardSet == nullptr) {
   //   errorCode = U_MEMORY_ALLOCATION_ERROR;
   //   fprintf(stderr, "\n%s:%d: err %s\n", __FILE__, __LINE__, u_errorName(errorCode));
   // }
index cf061328d86f748ae1011e0a0cc02517dd5edfc1..f7e09b35fb135f3c8e53a02bb15932f147311253 100644 (file)
@@ -55,9 +55,9 @@ static UOption options[]={
     UOPTION_VERBOSE,            /* 2 */
     UOPTION_ICUDATADIR,         /* 4 */
     UOPTION_COPYRIGHT,          /* 5 */
-    { "uchars", NULL, NULL, NULL, '\1', UOPT_NO_ARG, 0}, /* 6 */
-    { "bytes", NULL, NULL, NULL, '\1', UOPT_NO_ARG, 0}, /* 7 */
-    { "transform", NULL, NULL, NULL, '\1', UOPT_REQUIRES_ARG, 0}, /* 8 */
+    { "uchars", nullptr, nullptr, nullptr, '\1', UOPT_NO_ARG, 0}, /* 6 */
+    { "bytes", nullptr, nullptr, nullptr, '\1', UOPT_NO_ARG, 0}, /* 7 */
+    { "transform", nullptr, nullptr, nullptr, '\1', UOPT_REQUIRES_ARG, 0}, /* 8 */
     UOPTION_QUIET,              /* 9 */
 };
 
@@ -127,7 +127,7 @@ public:
     // it will be returned in status
     // isBytesTrie != 0 will produce a BytesTrieBuilder,
     // isBytesTrie == 0 will produce a UCharsTrieBuilder
-    DataDict(UBool isBytesTrie, UErrorCode &status) : bt(NULL), ut(NULL), 
+    DataDict(UBool isBytesTrie, UErrorCode &status) : bt(nullptr), ut(nullptr), 
         transformConstant(0), transformType(DictionaryData::TRANSFORM_NONE) {
         if (isBytesTrie) {
             bt = new BytesTrieBuilder(status);
@@ -223,10 +223,10 @@ static const UChar CARRIAGE_RETURN_CHARACTER = 0x000D;
 static UBool readLine(UCHARBUF *f, UnicodeString &fileLine, IcuToolErrorCode &errorCode) {
     int32_t lineLength;
     const UChar *line = ucbuf_readline(f, &lineLength, errorCode);
-    if(line == NULL || errorCode.isFailure()) { return false; }
+    if(line == nullptr || errorCode.isFailure()) { return false; }
     // Strip trailing CR/LF, comments, and spaces.
     const UChar *comment = u_memchr(line, 0x23, lineLength);  // '#'
-    if(comment != NULL) {
+    if(comment != nullptr) {
         lineLength = (int32_t)(comment - line);
     } else {
         while(lineLength > 0 && (line[lineLength - 1] == CARRIAGE_RETURN_CHARACTER || line[lineLength - 1] == LINEFEED_CHARACTER)) { --lineLength; }
@@ -276,7 +276,7 @@ int  main(int argc, char **argv) {
         u_setDataDirectory(options[ARG_ICUDATADIR].value);
     }
 
-    const char *copyright = NULL;
+    const char *copyright = nullptr;
     if (options[ARG_COPYRIGHT].doesOccur) {
         copyright = U_COPYRIGHT_STRING;
     }
@@ -294,7 +294,7 @@ int  main(int argc, char **argv) {
     IcuToolErrorCode status("gendict/main()");
 
 #if UCONFIG_NO_BREAK_ITERATION || UCONFIG_NO_FILE_IO
-    const char* outDir=NULL;
+    const char* outDir=nullptr;
 
     UNewDataMemory *pData;
     char msg[1024];
@@ -305,7 +305,7 @@ int  main(int argc, char **argv) {
     fprintf(stderr, "%s\n", msg);
 
     /* write the dummy data file */
-    pData = udata_create(outDir, NULL, outFileName, &dataInfo, NULL, &tempstatus);
+    pData = udata_create(outDir, nullptr, outFileName, &dataInfo, nullptr, &tempstatus);
     udata_writeBlock(pData, msg, strlen(msg));
     udata_finish(pData, &tempstatus);
     return (int)tempstatus;
@@ -417,7 +417,7 @@ int  main(int argc, char **argv) {
         exit(status.reset());
     }
     if (verbose) { puts("Opening output file..."); }
-    UNewDataMemory *pData = udata_create(NULL, NULL, outFileName, &dataInfo, copyright, status);
+    UNewDataMemory *pData = udata_create(nullptr, nullptr, outFileName, &dataInfo, copyright, status);
     if (status.isFailure()) {
         fprintf(stderr, "gendict: could not open output file \"%s\", \"%s\"\n", outFileName, status.errorName());
         exit(status.reset());
index 8c6d023acbba1f3d0f380189611cad05d88c535b..c833d484c97ce8b14bab11c5ea8b88eb0294c7c1 100644 (file)
@@ -43,7 +43,7 @@ int32_t ExtraData::writeMapping(UChar32 c, const Norm &norm, UnicodeString &data
     // Write the mapping & raw mapping extraData.
     int32_t firstUnit=length|(norm.trailCC<<8);
     int32_t preMappingLength=0;
-    if(norm.rawMapping!=NULL) {
+    if(norm.rawMapping!=nullptr) {
         UnicodeString &rm=*norm.rawMapping;
         int32_t rmLength=rm.length();
         if(rmLength>Normalizer2Impl::MAPPING_LENGTH_MASK) {
@@ -138,7 +138,7 @@ void ExtraData::writeCompositions(UChar32 c, const Norm &norm, UnicodeString &da
         const CompositionPair &pair=pairs[i];
         // 22 bits for the composite character and whether it combines forward.
         UChar32 compositeAndFwd=pair.composite<<1;
-        if(norms.getNormRef(pair.composite).compositions!=NULL) {
+        if(norms.getNormRef(pair.composite).compositions!=nullptr) {
             compositeAndFwd|=1;  // The composite character also combines-forward.
         }
         // Encode most pairs in two units and some in three.
index 84461f281d24d00a4be5efd94398526b815e4987..247a710702367fdb93e56a68afa9a2cac60e2602 100644 (file)
@@ -146,7 +146,7 @@ main(int argc, char* argv[]) {
         "gennorm2 writes a dummy binary data file "
         "because UCONFIG_NO_NORMALIZATION is set, \n"
         "see icu/source/common/unicode/uconfig.h\n");
-    udata_createDummy(NULL, NULL, options[OUTPUT_FILENAME].value, errorCode);
+    udata_createDummy(nullptr, nullptr, options[OUTPUT_FILENAME].value, errorCode);
     // Should not return an error since this is the expected behaviour if UCONFIG_NO_NORMALIZATION is on.
     // return U_UNSUPPORTED_ERROR;
     return 0;
@@ -244,7 +244,7 @@ void parseFile(std::ifstream &f, Normalizer2DataBuilder &builder) {
         char *line = &lineString.at(0);
 #endif
         char *comment=(char *)strchr(line, '#');
-        if(comment!=NULL) {
+        if(comment!=nullptr) {
             *comment=0;
         }
         u_rtrim(line);
@@ -297,7 +297,7 @@ void parseFile(std::ifstream &f, Normalizer2DataBuilder &builder) {
         }
         if(*delimiter=='=' || *delimiter=='>') {
             UChar uchars[Normalizer2Impl::MAPPING_LENGTH_MASK];
-            int32_t length=u_parseString(delimiter+1, uchars, UPRV_LENGTHOF(uchars), NULL, errorCode);
+            int32_t length=u_parseString(delimiter+1, uchars, UPRV_LENGTHOF(uchars), nullptr, errorCode);
             if(errorCode.isFailure()) {
                 fprintf(stderr, "gennorm2 error: parsing mapping string from %s\n", line);
                 exit(errorCode.reset());
index 7f913daeec7321d0cd35332720c5dfff17cfe998..8790f8c28c7d81d2ff85e351e636c06ed26ed190 100644 (file)
@@ -76,7 +76,7 @@ public:
         if(rangeIndex<UPRV_LENGTHOF(ranges)) {
             return ranges+rangeIndex++;
         } else {
-            return NULL;
+            return nullptr;
         }
     }
 private:
@@ -123,7 +123,7 @@ Normalizer2DataBuilder::setUnicodeVersion(const char *v) {
 }
 
 Norm *Normalizer2DataBuilder::checkNormForMapping(Norm *p, UChar32 c) {
-    if(p!=NULL) {
+    if(p!=nullptr) {
         if(p->mappingType!=Norm::NONE) {
             if( overrideHandling==OVERRIDE_NONE ||
                 (overrideHandling==OVERRIDE_PREVIOUS && p->mappingPhase==phase)
@@ -135,7 +135,7 @@ Norm *Normalizer2DataBuilder::checkNormForMapping(Norm *p, UChar32 c) {
                 exit(U_INVALID_FORMAT_ERROR);
             }
             delete p->mapping;
-            p->mapping=NULL;
+            p->mapping=nullptr;
         }
         p->mappingPhase=phase;
     }
@@ -154,7 +154,7 @@ void Normalizer2DataBuilder::setCC(UChar32 c, uint8_t cc) {
 
 static UBool isWellFormed(const UnicodeString &s) {
     UErrorCode errorCode=U_ZERO_ERROR;
-    u_strToUTF8(NULL, 0, NULL, toUCharPtr(s.getBuffer()), s.length(), &errorCode);
+    u_strToUTF8(nullptr, 0, nullptr, toUCharPtr(s.getBuffer()), s.length(), &errorCode);
     return U_SUCCESS(errorCode) || errorCode==U_BUFFER_OVERFLOW_ERROR;
 }
 
@@ -360,13 +360,13 @@ void Normalizer2DataBuilder::postProcess(Norm &norm) {
         if(norm.combinesBack) {
             norm.error="combines-back and decomposes, not possible in Unicode normalization";
         } else if(norm.mappingType==Norm::ROUND_TRIP) {
-            if(norm.compositions!=NULL) {
+            if(norm.compositions!=nullptr) {
                 norm.type=Norm::YES_NO_COMBINES_FWD;
             } else {
                 norm.type=Norm::YES_NO_MAPPING_ONLY;
             }
         } else {  // one-way mapping
-            if(norm.compositions!=NULL) {
+            if(norm.compositions!=nullptr) {
                 norm.error="combines-forward and has a one-way mapping, "
                            "not possible in Unicode normalization";
             } else if(buffer.isEmpty()) {
@@ -509,7 +509,7 @@ void Normalizer2DataBuilder::setHangulData(UMutableCPTrie *norm16Trie) {
     HangulIterator hi;
     const HangulIterator::Range *range;
     // Check that none of the Hangul/Jamo code points have data.
-    while((range=hi.nextRange())!=NULL) {
+    while((range=hi.nextRange())!=nullptr) {
         for(UChar32 c=range->start; c<=range->end; ++c) {
             if(umutablecptrie_get(norm16Trie, c)>Normalizer2Impl::INERT) {
                 fprintf(stderr,
@@ -780,8 +780,8 @@ void Normalizer2DataBuilder::writeBinaryFile(const char *filename) {
 
     IcuToolErrorCode errorCode("gennorm2/writeBinaryFile()");
     UNewDataMemory *pData=
-        udata_create(NULL, NULL, filename, &dataInfo,
-                     haveCopyright ? U_COPYRIGHT_STRING : NULL, errorCode);
+        udata_create(nullptr, nullptr, filename, &dataInfo,
+                     haveCopyright ? U_COPYRIGHT_STRING : nullptr, errorCode);
     if(errorCode.isFailure()) {
         fprintf(stderr, "gennorm2 error: unable to create the output file %s - %s\n",
                 filename, errorCode.errorName());
@@ -813,14 +813,14 @@ Normalizer2DataBuilder::writeCSourceFile(const char *filename) {
     CharString path(filename, (int32_t)(basename-filename), errorCode);
     CharString dataName(basename, errorCode);
     const char *extension=strrchr(basename, '.');
-    if(extension!=NULL) {
+    if(extension!=nullptr) {
         dataName.truncate((int32_t)(extension-basename));
     }
     const char *name=dataName.data();
     errorCode.assertSuccess();
 
     FILE *f=usrc_create(path.data(), basename, 2016, "icu/source/tools/gennorm2/n2builder.cpp");
-    if(f==NULL) {
+    if(f==nullptr) {
         fprintf(stderr, "gennorm2/writeCSourceFile() error: unable to create the output file %s\n",
                 filename);
         exit(U_FILE_ACCESS_ERROR);
index b8b26989f79e2460eca9c1808bb49f30f944124d..0454670ac5fe37fa1554b980e81a21e239af5e40 100644 (file)
@@ -55,32 +55,32 @@ static UOption options[]={
     UOPTION_HELP_H,
     UOPTION_HELP_QUESTION_MARK,
 /* 2 */    UOPTION_ENCODING,
-/* 3 */    { "to-stdout", NULL, NULL, NULL, 'c', UOPT_NO_ARG, 0 } ,
-/* 4 */    { "truncate", NULL, NULL, NULL, 't', UOPT_OPTIONAL_ARG, 0 },
+/* 3 */    { "to-stdout", nullptr, nullptr, nullptr, 'c', UOPT_NO_ARG, 0 } ,
+/* 4 */    { "truncate", nullptr, nullptr, nullptr, 't', UOPT_OPTIONAL_ARG, 0 },
 /* 5 */    UOPTION_VERBOSE,
 /* 6 */    UOPTION_DESTDIR,
 /* 7 */    UOPTION_SOURCEDIR,
-/* 8 */    { "bom", NULL, NULL, NULL, 0, UOPT_NO_ARG, 0 },
+/* 8 */    { "bom", nullptr, nullptr, nullptr, 0, UOPT_NO_ARG, 0 },
 /* 9 */    UOPTION_ICUDATADIR,
 /* 10 */   UOPTION_VERSION,
-/* 11 */   { "suppressAliases", NULL, NULL, NULL, 'A', UOPT_NO_ARG, 0 },
+/* 11 */   { "suppressAliases", nullptr, nullptr, nullptr, 'A', UOPT_NO_ARG, 0 },
 };
 
 static UBool verbose = false;
 static UBool suppressAliases = false;
-static UFILE *ustderr = NULL;
+static UFILE *ustderr = nullptr;
 
 extern int
 main(int argc, char* argv[]) {
-    const char *encoding = NULL;
-    const char *outputDir = NULL; /* NULL = no output directory, use current */
+    const char *encoding = nullptr;
+    const char *outputDir = nullptr; /* nullptr = no output directory, use current */
     const char *inputDir  = ".";
     int tostdout = 0;
     int prbom = 0;
 
     const char *pname;
 
-    UResourceBundle *bundle = NULL;
+    UResourceBundle *bundle = nullptr;
     int32_t i = 0;
 
     const char* arg;
@@ -141,7 +141,7 @@ main(int argc, char* argv[]) {
 
     if(options[4].doesOccur) {
         opt_truncate = true;
-        if(options[4].value != NULL) {
+        if(options[4].value != nullptr) {
             truncsize = atoi(options[4].value); /* user defined printable size */
         } else {
             truncsize = DERB_DEFAULT_TRUNC; /* we'll use default omitting size */
@@ -175,7 +175,7 @@ main(int argc, char* argv[]) {
     }
 
     fflush(stderr); // use ustderr now.
-    ustderr = u_finit(stderr, NULL, NULL);
+    ustderr = u_finit(stderr, nullptr, nullptr);
 
     for (i = 1; i < argc; ++i) {
         static const UChar sp[] = { 0x0020 }; /* " " */
@@ -191,7 +191,7 @@ main(int argc, char* argv[]) {
         {
             const char *p = findBasename(arg);
             const char *q = uprv_strrchr(p, '.');
-            if (q == NULL) {
+            if (q == nullptr) {
                 locale.append(p, status);
             } else {
                 locale.append(p, (int32_t)(q - p), status);
@@ -202,7 +202,7 @@ main(int argc, char* argv[]) {
         }
 
         icu::CharString infile;
-        const char *thename = NULL;
+        const char *thename = nullptr;
         UBool fromICUData = !uprv_strcmp(inputDir, "-");
         if (!fromICUData) {
             UBool absfilename = *arg == U_FILE_SEP_CHAR;
@@ -217,12 +217,12 @@ main(int argc, char* argv[]) {
             } else {
                 const char *q = uprv_strrchr(arg, U_FILE_SEP_CHAR);
 #if U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR
-                if (q == NULL) {
+                if (q == nullptr) {
                     q = uprv_strrchr(arg, U_FILE_ALT_SEP_CHAR);
                 }
 #endif
                 infile.append(inputDir, status);
-                if(q != NULL) {
+                if(q != nullptr) {
                     infile.appendPathPart(icu::StringPiece(arg, (int32_t)(q - arg)), status);
                 }
                 if (U_FAILURE(status)) {
@@ -237,7 +237,7 @@ main(int argc, char* argv[]) {
             bundle = ures_open(fromICUData ? 0 : inputDir, locale.data(), &status);
         }
         if (U_SUCCESS(status)) {
-            UFILE *out = NULL;
+            UFILE *out = nullptr;
 
             const char *filename = 0;
             const char *ext = 0;
@@ -266,7 +266,7 @@ main(int argc, char* argv[]) {
                     return status;
                 }
 
-                out = u_fopen(thefile.data(), "w", NULL, encoding);
+                out = u_fopen(thefile.data(), "w", nullptr, encoding);
                 if (!out) {
                   u_fprintf(ustderr, "%s: couldn't create %s\n", pname, thefile.data());
                   u_fclose(ustderr);
@@ -400,7 +400,7 @@ static void printOutAlias(UFILE *out,  UResourceBundle *parent, Resource r, cons
         static const UChar openStr[] = { 0x003A, 0x0061, 0x006C, 0x0069, 0x0061, 0x0073, 0x0020, 0x007B, 0x0020, 0x0022 }; /* ":alias { \"" */
         static const UChar closeStr[] = { 0x0022, 0x0020, 0x007D, 0x0020 }; /* "\" } " */
         printIndent(out, indent);
-        if(key != NULL) {
+        if(key != nullptr) {
             printCString(out, key, -1);
         }
         printString(out, openStr, UPRV_LENGTHOF(openStr));
@@ -441,7 +441,7 @@ static void printOutBundle(UFILE *out, UResourceBundle *resource, int32_t indent
                 len = truncsize/2;
             }
             printIndent(out, indent);
-            if(key != NULL) {
+            if(key != nullptr) {
                 static const UChar openStr[] = { 0x0020, 0x007B, 0x0020, 0x0022 }; /* " { \"" */
                 static const UChar closeStr[] = { 0x0022, 0x0020, 0x007D }; /* "\" }" */
                 printCString(out, key, (int32_t)uprv_strlen(key));
@@ -473,7 +473,7 @@ static void printOutBundle(UFILE *out, UResourceBundle *resource, int32_t indent
             UChar num[20];
 
             printIndent(out, indent);
-            if(key != NULL) {
+            if(key != nullptr) {
                 printCString(out, key, -1);
             }
             printString(out, openStr, UPRV_LENGTHOF(openStr));
@@ -503,7 +503,7 @@ static void printOutBundle(UFILE *out, UResourceBundle *resource, int32_t indent
                 static const UChar openStr[] = { 0x003A, 0x0062, 0x0069, 0x006E, 0x0061, 0x0072, 0x0079, 0x0020, 0x007B, 0x0020 }; /* ":binary { " */
                 static const UChar closeStr[] = { 0x0020, 0x007D, 0x0020 }; /* " } " */
                 printIndent(out, indent);
-                if(key != NULL) {
+                if(key != nullptr) {
                     printCString(out, key, -1);
                 }
                 printString(out, openStr, UPRV_LENGTHOF(openStr));
@@ -530,7 +530,7 @@ static void printOutBundle(UFILE *out, UResourceBundle *resource, int32_t indent
                 UChar num[20];
 
                 printIndent(out, indent);
-                if(key != NULL) {
+                if(key != nullptr) {
                     printCString(out, key, -1);
                 }
                 printString(out, openStr, UPRV_LENGTHOF(openStr));
@@ -561,10 +561,10 @@ static void printOutBundle(UFILE *out, UResourceBundle *resource, int32_t indent
             static const UChar openStr[] = { 0x007B }; /* "{" */
             static const UChar closeStr[] = { 0x007D, '\n' }; /* "}\n" */
 
-            UResourceBundle *t = NULL;
+            UResourceBundle *t = nullptr;
             ures_resetIterator(resource);
             printIndent(out, indent);
-            if(key != NULL) {
+            if(key != nullptr) {
                 printCString(out, key, -1);
             }
             printString(out, openStr, UPRV_LENGTHOF(openStr));
index 9deca097e94c32c996ff5332e265b5bf6e30d5c7..cbc9d7f13e4a22ff14790cdfdeedb148ad9f2396 100644 (file)
@@ -49,16 +49,16 @@ static char *make_res_filename(const char *filename, const char *outputDir,
 #define RES_SUFFIX ".res"
 #define COL_SUFFIX ".col"
 
-const char *gCurrentFileName = NULL;
+const char *gCurrentFileName = nullptr;
 #ifdef XP_MAC_CONSOLE
 #include <console.h>
 #endif
 
 void ResFile::close() {
     delete[] fBytes;
-    fBytes = NULL;
+    fBytes = nullptr;
     delete fStrings;
-    fStrings = NULL;
+    fStrings = nullptr;
 }
 
 enum
@@ -125,17 +125,17 @@ static     const char* outputEnc ="";
 static ResFile poolBundle;
 
 /*added by Jing*/
-static     const char* language = NULL;
-static     const char* xliffOutputFileName = NULL;
+static     const char* language = nullptr;
+static     const char* xliffOutputFileName = nullptr;
 int
 main(int argc,
      char* argv[])
 {
     UErrorCode  status    = U_ZERO_ERROR;
-    const char *arg       = NULL;
-    const char *outputDir = NULL; /* NULL = no output directory, use current */
-    const char *inputDir  = NULL;
-    const char *filterDir = NULL;
+    const char *arg       = nullptr;
+    const char *outputDir = nullptr; /* nullptr = no output directory, use current */
+    const char *inputDir  = nullptr;
+    const char *filterDir = nullptr;
     const char *encoding  = "";
     int         i;
     UBool illegalArg = false;
@@ -306,7 +306,7 @@ main(int argc,
 
     if(options[WRITE_XLIFF].doesOccur) {
         write_xliff = true;
-        if(options[WRITE_XLIFF].value != NULL){
+        if(options[WRITE_XLIFF].value != nullptr){
             xliffOutputFileName = options[WRITE_XLIFF].value;
         }
     }
@@ -329,14 +329,14 @@ main(int argc,
 
     LocalPointer<SRBRoot> newPoolBundle;
     if(options[WRITE_POOL_BUNDLE].doesOccur) {
-        newPoolBundle.adoptInsteadAndCheckErrorCode(new SRBRoot(NULL, true, status), status);
+        newPoolBundle.adoptInsteadAndCheckErrorCode(new SRBRoot(nullptr, true, status), status);
         if(U_FAILURE(status)) {
             fprintf(stderr, "unable to create an empty bundle for the pool keys: %s\n", u_errorName(status));
             return status;
         } else {
             const char *poolResName = "pool.res";
             char *nameWithoutSuffix = static_cast<char *>(uprv_malloc(uprv_strlen(poolResName) + 1));
-            if (nameWithoutSuffix == NULL) {
+            if (nameWithoutSuffix == nullptr) {
                 fprintf(stderr, "out of memory error\n");
                 return U_MEMORY_ALLOCATION_ERROR;
             }
@@ -360,7 +360,7 @@ main(int argc,
          * Also, make_res_filename() seems to be unused. Review and remove.
          */
         CharString poolFileName;
-        if (options[USE_POOL_BUNDLE].value!=NULL) {
+        if (options[USE_POOL_BUNDLE].value!=nullptr) {
             poolFileName.append(options[USE_POOL_BUNDLE].value, status);
         } else if (inputDir) {
             poolFileName.append(inputDir, status);
@@ -370,7 +370,7 @@ main(int argc,
             return status;
         }
         poolFile = T_FileStream_open(poolFileName.data(), "rb");
-        if (poolFile == NULL) {
+        if (poolFile == nullptr) {
             fprintf(stderr, "unable to open pool bundle file %s\n", poolFileName.data());
             return 1;
         }
@@ -380,7 +380,7 @@ main(int argc,
             return 1;
         }
         poolBundle.fBytes = new uint8_t[(poolFileSize + 15) & ~15];
-        if (poolFileSize > 0 && poolBundle.fBytes == NULL) {
+        if (poolFileSize > 0 && poolBundle.fBytes == nullptr) {
             fprintf(stderr, "unable to allocate memory for the pool bundle file %s\n", poolFileName.data());
             return U_MEMORY_ALLOCATION_ERROR;
         }
@@ -441,8 +441,8 @@ main(int argc,
         // an explicit string length that exceeds the number of remaining 16-bit units.
         int32_t stringUnitsLength = (poolBundle.fIndexes[URES_INDEX_16BIT_TOP] - keysTop) * 2;
         if (stringUnitsLength >= 2 && getFormatVersion() >= 3) {
-            poolBundle.fStrings = new PseudoListResource(NULL, status);
-            if (poolBundle.fStrings == NULL) {
+            poolBundle.fStrings = new PseudoListResource(nullptr, status);
+            if (poolBundle.fStrings == nullptr) {
                 fprintf(stderr, "unable to allocate memory for the pool bundle strings %s\n",
                         poolFileName.data());
                 return U_MEMORY_ALLOCATION_ERROR;
@@ -492,7 +492,7 @@ main(int argc,
                     StringResource *sr =
                             new StringResource(poolStringIndex, numCharsForLength,
                                                p, length, status);
-                    if (sr == NULL) {
+                    if (sr == nullptr) {
                         fprintf(stderr, "unable to allocate memory for a pool bundle string %s\n",
                                 poolFileName.data());
                         return U_MEMORY_ALLOCATION_ERROR;
@@ -507,13 +507,13 @@ main(int argc,
             } while (remaining > 0);
             if (poolBundle.fStrings->fCount == 0) {
                 delete poolBundle.fStrings;
-                poolBundle.fStrings = NULL;
+                poolBundle.fStrings = nullptr;
             }
         }
 
         T_FileStream_close(poolFile);
         setUsePoolBundle(true);
-        if (isVerbose() && poolBundle.fStrings != NULL) {
+        if (isVerbose() && poolBundle.fStrings != nullptr) {
             printf("number of shared strings: %d\n", (int)poolBundle.fStrings->fCount);
             int32_t length = poolBundle.fStringIndexLimit + 1;  // incl. last NUL
             printf("16-bit units for strings: %6d = %6d bytes\n",
@@ -522,7 +522,7 @@ main(int argc,
     }
 
     if(!options[FORMAT_VERSION].doesOccur && getFormatVersion() == 3 &&
-            poolBundle.fStrings == NULL &&
+            poolBundle.fStrings == nullptr &&
             !options[WRITE_POOL_BUNDLE].doesOccur) {
         // If we just default to formatVersion 3
         // but there are no pool bundle strings to share
@@ -559,7 +559,7 @@ main(int argc,
         if (isVerbose()) {
             printf("Processing file \"%s\"\n", theCurrentFileName.data());
         }
-        processFile(arg, encoding, inputDir, outputDir, filterDir, NULL,
+        processFile(arg, encoding, inputDir, outputDir, filterDir, nullptr,
                     newPoolBundle.getAlias(),
                     options[NO_BINARY_COLLATION].doesOccur, status);
     }
@@ -568,13 +568,13 @@ main(int argc,
 
     if(U_SUCCESS(status) && options[WRITE_POOL_BUNDLE].doesOccur) {
         const char* writePoolDir;
-        if (options[WRITE_POOL_BUNDLE].value!=NULL) {
+        if (options[WRITE_POOL_BUNDLE].value!=nullptr) {
             writePoolDir = options[WRITE_POOL_BUNDLE].value;
         } else {
             writePoolDir = outputDir;
         }
         char outputFileName[256];
-        newPoolBundle->write(writePoolDir, NULL, outputFileName, sizeof(outputFileName), status);
+        newPoolBundle->write(writePoolDir, nullptr, outputFileName, sizeof(outputFileName), status);
         if(U_FAILURE(status)) {
             fprintf(stderr, "unable to write the pool bundle: %s\n", u_errorName(status));
         }
@@ -608,14 +608,14 @@ processFile(const char *filename, const char *cp,
     if (U_FAILURE(status)) {
         return;
     }
-    if(filename==NULL){
+    if(filename==nullptr){
         status=U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
 
-    if(inputDir == NULL) {
+    if(inputDir == nullptr) {
         const char *filenameBegin = uprv_strrchr(filename, U_FILE_SEP_CHAR);
-        if (filenameBegin != NULL) {
+        if (filenameBegin != nullptr) {
             /*
              * When a filename ../../../data/root.txt is specified,
              * we presume that the input directory is ../../../data
@@ -669,7 +669,7 @@ processFile(const char *filename, const char *cp,
         return;
     }
     /* auto detected popular encodings? */
-    if (cp!=NULL && isVerbose()) {
+    if (cp!=nullptr && isVerbose()) {
         printf("autodetected encoding %s\n", cp);
     }
     /* Parse the data into an SRBRoot */
@@ -782,7 +782,7 @@ make_res_filename(const char *filename,
         return 0;
     }
 
-    if(packageName != NULL)
+    if(packageName != nullptr)
     {
         pkgLen = (int32_t)(1 + uprv_strlen(packageName));
     }
@@ -807,7 +807,7 @@ make_res_filename(const char *filename,
 
     get_dirname(dirname, filename);
 
-    if (outputDir == NULL) {
+    if (outputDir == nullptr) {
         /* output in same dir as .txt */
         resName = (char*) uprv_malloc(sizeof(char) * (uprv_strlen(dirname)
                                       + pkgLen
@@ -820,7 +820,7 @@ make_res_filename(const char *filename,
 
         uprv_strcpy(resName, dirname);
 
-        if(packageName != NULL)
+        if(packageName != nullptr)
         {
             uprv_strcat(resName, packageName);
             uprv_strcat(resName, "_");
@@ -834,7 +834,7 @@ make_res_filename(const char *filename,
 
         resName = (char*) uprv_malloc(sizeof(char) * (dirlen + pkgLen + basenamelen + 8));
 
-        if (resName == NULL) {
+        if (resName == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             goto finish;
         }
@@ -846,7 +846,7 @@ make_res_filename(const char *filename,
             resName[dirlen + 1] = '\0';
         }
 
-        if(packageName != NULL)
+        if(packageName != nullptr)
         {
             uprv_strcat(resName, packageName);
             uprv_strcat(resName, "_");
index 96fd81afb53909e0e599f743227cb492a5f76528..4ea2f2dfce979c5b4f12cdd58f7e392282e0539a 100644 (file)
@@ -144,8 +144,8 @@ static struct SResource *parseResource(ParseState* state, char *tag, const struc
 
    UString *value;
 
-   getToken(&value, NULL, status);
-   getToken(NULL,   NULL, status);       bad - value is now a different string
+   getToken(&value, nullptr, status);
+   getToken(nullptr,   nullptr, status);       bad - value is now a different string
 */
 static void
 initLookahead(ParseState* state, UCHARBUF *buf, UErrorCode *status)
@@ -195,17 +195,17 @@ getToken(ParseState* state, struct UString **tokenValue, struct UString* comment
 
     result = state->lookahead[state->lookaheadPosition].type;
 
-    if (tokenValue != NULL)
+    if (tokenValue != nullptr)
     {
         *tokenValue = &state->lookahead[state->lookaheadPosition].value;
     }
 
-    if (linenumber != NULL)
+    if (linenumber != nullptr)
     {
         *linenumber = state->lookahead[state->lookaheadPosition].line;
     }
 
-    if (comment != NULL)
+    if (comment != nullptr)
     {
         ustr_cpy(comment, &(state->lookahead[state->lookaheadPosition].comment), status);
     }
@@ -237,17 +237,17 @@ peekToken(ParseState* state, uint32_t lookaheadCount, struct UString **tokenValu
         return TOK_ERROR;
     }
 
-    if (tokenValue != NULL)
+    if (tokenValue != nullptr)
     {
         *tokenValue = &state->lookahead[i].value;
     }
 
-    if (linenumber != NULL)
+    if (linenumber != nullptr)
     {
         *linenumber = state->lookahead[i].line;
     }
 
-    if(comment != NULL){
+    if(comment != nullptr){
         ustr_cpy(comment, &(state->lookahead[state->lookaheadPosition].comment), status);
     }
 
@@ -261,7 +261,7 @@ expect(ParseState* state, enum ETokenType expectedToken, struct UString **tokenV
 
     enum ETokenType token = getToken(state, tokenValue, comment, &line, status);
 
-    if (linenumber != NULL)
+    if (linenumber != nullptr)
     {
         *linenumber = line;
     }
@@ -292,21 +292,21 @@ static char *getInvariantString(ParseState* state, uint32_t *line, struct UStrin
 
     if (U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
 
     if(!uprv_isInvariantUString(tokenValue->fChars, tokenValue->fLength)) {
         *status = U_INVALID_FORMAT_ERROR;
         error(*line, "invariant characters required for table keys, binary data, etc.");
-        return NULL;
+        return nullptr;
     }
 
     result = static_cast<char *>(uprv_malloc(tokenValue->fLength+1));
 
-    if (result == NULL)
+    if (result == nullptr)
     {
         *status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     u_UCharsToChars(tokenValue->fChars, result, tokenValue->fLength+1);
@@ -317,33 +317,33 @@ static char *getInvariantString(ParseState* state, uint32_t *line, struct UStrin
 static struct SResource *
 parseUCARules(ParseState* state, char *tag, uint32_t startline, const struct UString* /*comment*/, UErrorCode *status)
 {
-    struct SResource *result = NULL;
+    struct SResource *result = nullptr;
     struct UString   *tokenValue;
-    FileStream       *file          = NULL;
+    FileStream       *file          = nullptr;
     char              filename[256] = { '\0' };
     char              cs[128]       = { '\0' };
     uint32_t          line;
     UBool quoted = false;
-    UCHARBUF *ucbuf=NULL;
+    UCHARBUF *ucbuf=nullptr;
     UChar32   c     = 0;
-    const char* cp  = NULL;
-    UChar *pTarget     = NULL;
-    UChar *target      = NULL;
-    UChar *targetLimit = NULL;
+    const char* cp  = nullptr;
+    UChar *pTarget     = nullptr;
+    UChar *target      = nullptr;
+    UChar *targetLimit = nullptr;
     int32_t size = 0;
 
-    expect(state, TOK_STRING, &tokenValue, NULL, &line, status);
+    expect(state, TOK_STRING, &tokenValue, nullptr, &line, status);
 
     if(isVerbose()){
-        printf(" %s at line %i \n",  (tag == NULL) ? "(null)" : tag, (int)startline);
+        printf(" %s at line %i \n",  (tag == nullptr) ? "(null)" : tag, (int)startline);
     }
 
     if (U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
     /* make the filename including the directory */
-    if (state->inputdir != NULL)
+    if (state->inputdir != nullptr)
     {
         uprv_strcat(filename, state->inputdir);
 
@@ -355,11 +355,11 @@ parseUCARules(ParseState* state, char *tag, uint32_t startline, const struct USt
 
     u_UCharsToChars(tokenValue->fChars, cs, tokenValue->fLength);
 
-    expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
+    expect(state, TOK_CLOSE_BRACE, nullptr, nullptr, nullptr, status);
 
     if (U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
     uprv_strcat(filename, cs);
 
@@ -371,7 +371,7 @@ parseUCARules(ParseState* state, char *tag, uint32_t startline, const struct USt
 
     if (U_FAILURE(*status)) {
         error(line, "An error occurred while opening the input file %s\n", filename);
-        return NULL;
+        return nullptr;
     }
 
     /* We allocate more space than actually required
@@ -421,7 +421,7 @@ parseUCARules(ParseState* state, char *tag, uint32_t startline, const struct USt
             {
                 uprv_free(pTarget);
                 T_FileStream_close(file);
-                return NULL;
+                return nullptr;
             }
         }
         else if (!quoted && (c == SPACE || c == TAB || c == CR || c == LF))
@@ -448,7 +448,7 @@ parseUCARules(ParseState* state, char *tag, uint32_t startline, const struct USt
         *target = 0x0000;
     }
 
-    result = string_open(state->bundle, tag, pTarget, (int32_t)(target - pTarget), NULL, status);
+    result = string_open(state->bundle, tag, pTarget, (int32_t)(target - pTarget), nullptr, status);
 
 
     ucbuf_close(ucbuf);
@@ -461,30 +461,30 @@ parseUCARules(ParseState* state, char *tag, uint32_t startline, const struct USt
 static struct SResource *
 parseTransliterator(ParseState* state, char *tag, uint32_t startline, const struct UString* /*comment*/, UErrorCode *status)
 {
-    struct SResource *result = NULL;
+    struct SResource *result = nullptr;
     struct UString   *tokenValue;
-    FileStream       *file          = NULL;
+    FileStream       *file          = nullptr;
     char              filename[256] = { '\0' };
     char              cs[128]       = { '\0' };
     uint32_t          line;
-    UCHARBUF *ucbuf=NULL;
-    const char* cp  = NULL;
-    UChar *pTarget     = NULL;
-    const UChar *pSource     = NULL;
+    UCHARBUF *ucbuf=nullptr;
+    const char* cp  = nullptr;
+    UChar *pTarget     = nullptr;
+    const UChar *pSource     = nullptr;
     int32_t size = 0;
 
-    expect(state, TOK_STRING, &tokenValue, NULL, &line, status);
+    expect(state, TOK_STRING, &tokenValue, nullptr, &line, status);
 
     if(isVerbose()){
-        printf(" %s at line %i \n",  (tag == NULL) ? "(null)" : tag, (int)startline);
+        printf(" %s at line %i \n",  (tag == nullptr) ? "(null)" : tag, (int)startline);
     }
 
     if (U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
     /* make the filename including the directory */
-    if (state->inputdir != NULL)
+    if (state->inputdir != nullptr)
     {
         uprv_strcat(filename, state->inputdir);
 
@@ -496,11 +496,11 @@ parseTransliterator(ParseState* state, char *tag, uint32_t startline, const stru
 
     u_UCharsToChars(tokenValue->fChars, cs, tokenValue->fLength);
 
-    expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
+    expect(state, TOK_CLOSE_BRACE, nullptr, nullptr, nullptr, status);
 
     if (U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
     uprv_strcat(filename, cs);
 
@@ -509,7 +509,7 @@ parseTransliterator(ParseState* state, char *tag, uint32_t startline, const stru
 
     if (U_FAILURE(*status)) {
         error(line, "An error occurred while opening the input file %s\n", filename);
-        return NULL;
+        return nullptr;
     }
 
     /* We allocate more space than actually required
@@ -526,7 +526,7 @@ parseTransliterator(ParseState* state, char *tag, uint32_t startline, const stru
     size = 0;
     fprintf(stderr, " Warning: writing empty transliteration data ( UCONFIG_NO_TRANSLITERATION ) \n");
 #endif
-    result = string_open(state->bundle, tag, pTarget, size, NULL, status);
+    result = string_open(state->bundle, tag, pTarget, size, nullptr, status);
 
     ucbuf_close(ucbuf);
     uprv_free(pTarget);
@@ -534,30 +534,30 @@ parseTransliterator(ParseState* state, char *tag, uint32_t startline, const stru
 
     return result;
 }
-static ArrayResource* dependencyArray = NULL;
+static ArrayResource* dependencyArray = nullptr;
 
 static struct SResource *
 parseDependency(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status)
 {
-    struct SResource *result = NULL;
-    struct SResource *elem = NULL;
+    struct SResource *result = nullptr;
+    struct SResource *elem = nullptr;
     struct UString   *tokenValue;
     uint32_t          line;
     char              filename[256] = { '\0' };
     char              cs[128]       = { '\0' };
 
-    expect(state, TOK_STRING, &tokenValue, NULL, &line, status);
+    expect(state, TOK_STRING, &tokenValue, nullptr, &line, status);
 
     if(isVerbose()){
-        printf(" %s at line %i \n",  (tag == NULL) ? "(null)" : tag, (int)startline);
+        printf(" %s at line %i \n",  (tag == nullptr) ? "(null)" : tag, (int)startline);
     }
 
     if (U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
     /* make the filename including the directory */
-    if (state->outputdir != NULL)
+    if (state->outputdir != nullptr)
     {
         uprv_strcat(filename, state->outputdir);
 
@@ -571,7 +571,7 @@ parseDependency(ParseState* state, char *tag, uint32_t startline, const struct U
 
     if (U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
     uprv_strcat(filename, cs);
     if(!T_FileStream_file_exists(filename)){
@@ -581,37 +581,37 @@ parseDependency(ParseState* state, char *tag, uint32_t startline, const struct U
             warning(line, "The dependency file %s does not exist. Please make sure it exists.\n",filename);
         }
     }
-    if(dependencyArray==NULL){
-        dependencyArray = array_open(state->bundle, "%%DEPENDENCY", NULL, status);
+    if(dependencyArray==nullptr){
+        dependencyArray = array_open(state->bundle, "%%DEPENDENCY", nullptr, status);
     }
-    if(tag!=NULL){
+    if(tag!=nullptr){
         result = string_open(state->bundle, tag, tokenValue->fChars, tokenValue->fLength, comment, status);
     }
-    elem = string_open(state->bundle, NULL, tokenValue->fChars, tokenValue->fLength, comment, status);
+    elem = string_open(state->bundle, nullptr, tokenValue->fChars, tokenValue->fLength, comment, status);
 
     dependencyArray->add(elem);
 
     if (U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
-    expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
+    expect(state, TOK_CLOSE_BRACE, nullptr, nullptr, nullptr, status);
     return result;
 }
 static struct SResource *
 parseString(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status)
 {
     struct UString   *tokenValue;
-    struct SResource *result = NULL;
+    struct SResource *result = nullptr;
 
-/*    if (tag != NULL && uprv_strcmp(tag, "%%UCARULES") == 0)
+/*    if (tag != nullptr && uprv_strcmp(tag, "%%UCARULES") == 0)
     {
         return parseUCARules(tag, startline, status);
     }*/
     if(isVerbose()){
-        printf(" string %s at line %i \n",  (tag == NULL) ? "(null)" : tag, (int)startline);
+        printf(" string %s at line %i \n",  (tag == nullptr) ? "(null)" : tag, (int)startline);
     }
-    expect(state, TOK_STRING, &tokenValue, NULL, NULL, status);
+    expect(state, TOK_STRING, &tokenValue, nullptr, nullptr, status);
 
     if (U_SUCCESS(*status))
     {
@@ -620,12 +620,12 @@ parseString(ParseState* state, char *tag, uint32_t startline, const struct UStri
 
         result = string_open(state->bundle, tag, tokenValue->fChars, tokenValue->fLength, comment, status);
         if(U_SUCCESS(*status) && result) {
-            expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
+            expect(state, TOK_CLOSE_BRACE, nullptr, nullptr, nullptr, status);
 
             if (U_FAILURE(*status))
             {
                 res_close(result);
-                return NULL;
+                return nullptr;
             }
         }
     }
@@ -637,12 +637,12 @@ static struct SResource *
 parseAlias(ParseState* state, char *tag, uint32_t startline, const struct UString *comment, UErrorCode *status)
 {
     struct UString   *tokenValue;
-    struct SResource *result  = NULL;
+    struct SResource *result  = nullptr;
 
-    expect(state, TOK_STRING, &tokenValue, NULL, NULL, status);
+    expect(state, TOK_STRING, &tokenValue, nullptr, nullptr, status);
 
     if(isVerbose()){
-        printf(" alias %s at line %i \n",  (tag == NULL) ? "(null)" : tag, (int)startline);
+        printf(" alias %s at line %i \n",  (tag == nullptr) ? "(null)" : tag, (int)startline);
     }
 
     if (U_SUCCESS(*status))
@@ -652,12 +652,12 @@ parseAlias(ParseState* state, char *tag, uint32_t startline, const struct UStrin
 
         result = alias_open(state->bundle, tag, tokenValue->fChars, tokenValue->fLength, comment, status);
 
-        expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
+        expect(state, TOK_CLOSE_BRACE, nullptr, nullptr, nullptr, status);
 
         if (U_FAILURE(*status))
         {
             res_close(result);
-            return NULL;
+            return nullptr;
         }
     }
 
@@ -670,18 +670,18 @@ namespace {
 
 static struct SResource* resLookup(struct SResource* res, const char* key){
     if (res == res_none() || !res->isTable()) {
-        return NULL;
+        return nullptr;
     }
 
     TableResource *list = static_cast<TableResource *>(res);
     SResource *current = list->fFirst;
-    while (current != NULL) {
+    while (current != nullptr) {
         if (uprv_strcmp(((list->fRoot->fKeys) + (current->fKey)), key) == 0) {
             return current;
         }
         current = current->fNext;
     }
-    return NULL;
+    return nullptr;
 }
 
 class GenrbImporter : public icu::CollationRuleParser::Importer {
@@ -717,9 +717,9 @@ GenrbImporter::getRules(
     }
     CharString inputDirBuf;
     CharString openFileName;
-    if(inputDir == NULL) {
+    if(inputDir == nullptr) {
         const char *filenameBegin = uprv_strrchr(filename.data(), U_FILE_SEP_CHAR);
-        if (filenameBegin != NULL) {
+        if (filenameBegin != nullptr) {
             /*
              * When a filename ../../../data/root.txt is specified,
              * we presume that the input directory is ../../../data
@@ -779,11 +779,11 @@ GenrbImporter::getRules(
 
     struct SResource *root = data->fRoot;
     struct SResource *collations = resLookup(root, "collations");
-    if (collations != NULL) {
+    if (collations != nullptr) {
       struct SResource *collation = resLookup(collations, collationType);
-      if (collation != NULL) {
+      if (collation != nullptr) {
         struct SResource *sequence = resLookup(collation, "Sequence");
-        if (sequence != NULL && sequence->isString()) {
+        if (sequence != nullptr && sequence->isString()) {
           // No string pointer aliasing so that we need not hold onto the resource bundle.
           StringResource *sr = static_cast<StringResource *>(sequence);
           rules = sr->fString;
@@ -831,13 +831,13 @@ openTOML(const char* outputdir, const char* name, const char* collationType, con
     outFileName.append(baseName, *status);
     outFileName.append(".toml", *status);
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
 
     FILE* f = fopen(outFileName.data(), "w");
     if (!f) {
         *status = U_FILE_ACCESS_ERROR;
-        return NULL;
+        return nullptr;
     }
     usrc_writeFileNameGeneratedBy(f, "#", baseName.data(), "genrb -X");
 
@@ -972,7 +972,7 @@ writeCollationDataTOML(const char* outputdir, const char* name, const char* coll
     uint32_t trieDefault = root ? icu::Collation::UNASSIGNED_CE32 : icu::Collation::FALLBACK_CE32;
     icu::LocalUMutableCPTriePointer builder(umutablecptrie_open(trieDefault, trieDefault, status));
 
-    utrie2_enum(data->trie, NULL, &convertTrie, builder.getAlias());
+    utrie2_enum(data->trie, nullptr, &convertTrie, builder.getAlias());
 
     // If the diacritic table was cut short, copy CE32s between the lowered
     // limit and the max limit from the root to the tailoring. As of June 2022,
@@ -1149,7 +1149,7 @@ addCollation(ParseState* state, TableResource  *result, const char *collationTyp
              uint32_t startline, UErrorCode *status)
 {
     // TODO: Use LocalPointer for result, or make caller close it when there is a failure.
-    struct SResource  *member = NULL;
+    struct SResource  *member = nullptr;
     struct UString    *tokenValue;
     struct UString     comment;
     enum   ETokenType  token;
@@ -1186,7 +1186,7 @@ addCollation(ParseState* state, TableResource  *result, const char *collationTyp
                 error(line, "Unexpected token %s", tokenNames[token]);
             }
 
-            return NULL;
+            return nullptr;
         }
 
         u_UCharsToChars(tokenValue->fChars, subtag, u_strlen(tokenValue->fChars) + 1);
@@ -1194,17 +1194,17 @@ addCollation(ParseState* state, TableResource  *result, const char *collationTyp
         if (U_FAILURE(*status))
         {
             res_close(result);
-            return NULL;
+            return nullptr;
         }
 
-        member = parseResource(state, subtag, NULL, status);
+        member = parseResource(state, subtag, nullptr, status);
 
         if (U_FAILURE(*status))
         {
             res_close(result);
-            return NULL;
+            return nullptr;
         }
-        if (result == NULL)
+        if (result == nullptr)
         {
             // Ignore the parsed resources, continue parsing.
         }
@@ -1223,7 +1223,7 @@ addCollation(ParseState* state, TableResource  *result, const char *collationTyp
             u_versionFromString(version, ver);
 
             result->add(member, line, *status);
-            member = NULL;
+            member = nullptr;
         }
         else if(uprv_strcmp(subtag, "%%CollationBin")==0)
         {
@@ -1240,19 +1240,19 @@ addCollation(ParseState* state, TableResource  *result, const char *collationTyp
             /* to omit collation rules */
             if(!state->omitCollationRules) {
                 result->add(member, line, *status);
-                member = NULL;
+                member = nullptr;
             }
         }
         else  // Just copy non-special items.
         {
             result->add(member, line, *status);
-            member = NULL;
+            member = nullptr;
         }
         res_close(member);  // TODO: use LocalPointer
         if (U_FAILURE(*status))
         {
             res_close(result);
-            return NULL;
+            return nullptr;
         }
     }
 
@@ -1285,7 +1285,7 @@ addCollation(ParseState* state, TableResource  *result, const char *collationTyp
     if(U_FAILURE(intStatus)) {
         error(line, "failed to load root collator (ucadata.icu) - %s", u_errorName(intStatus));
         res_close(result);
-        return NULL;  // TODO: use LocalUResourceBundlePointer for result
+        return nullptr;  // TODO: use LocalUResourceBundlePointer for result
     }
     icu::CollationBuilder builder(base, state->icu4xMode, intStatus);
     if(state->icu4xMode || (uprv_strncmp(collationType, "search", 6) == 0)) {
@@ -1295,7 +1295,7 @@ addCollation(ParseState* state, TableResource  *result, const char *collationTyp
             builder.parseAndBuild(rules, version, &importer, &parseError, intStatus));
     if(U_FAILURE(intStatus)) {
         const char *reason = builder.getErrorReason();
-        if(reason == NULL) { reason = ""; }
+        if(reason == nullptr) { reason = ""; }
         error(line, "CollationBuilder failed at %s~%s/Sequence rule offset %ld: %s  %s",
                 state->filename, collationType,
                 (long)parseError.offset, u_errorName(intStatus), reason);
@@ -1309,15 +1309,15 @@ addCollation(ParseState* state, TableResource  *result, const char *collationTyp
         if(isStrict() || t.isNull()) {
             *status = intStatus;
             res_close(result);
-            return NULL;
+            return nullptr;
         }
     }
     if (state->icu4xMode) {
         char *nameWithoutSuffix = static_cast<char *>(uprv_malloc(uprv_strlen(state->filename) + 1));
-        if (nameWithoutSuffix == NULL) {
+        if (nameWithoutSuffix == nullptr) {
             *status = U_MEMORY_ALLOCATION_ERROR;
             res_close(result);
-            return NULL;
+            return nullptr;
         }
         uprv_strcpy(nameWithoutSuffix, state->filename);
         *uprv_strrchr(nameWithoutSuffix, '.') = 0;
@@ -1328,12 +1328,12 @@ addCollation(ParseState* state, TableResource  *result, const char *collationTyp
     icu::LocalMemory<uint8_t> buffer;
     int32_t capacity = 100000;
     uint8_t *dest = buffer.allocateInsteadAndCopy(capacity);
-    if(dest == NULL) {
+    if(dest == nullptr) {
         fprintf(stderr, "memory allocation (%ld bytes) for file contents failed\n",
                 (long)capacity);
         *status = U_MEMORY_ALLOCATION_ERROR;
         res_close(result);
-        return NULL;
+        return nullptr;
     }
     int32_t indexes[icu::CollationDataReader::IX_TOTAL_SIZE + 1];
     int32_t totalSize = icu::CollationDataWriter::writeTailoring(
@@ -1342,12 +1342,12 @@ addCollation(ParseState* state, TableResource  *result, const char *collationTyp
         intStatus = U_ZERO_ERROR;
         capacity = totalSize;
         dest = buffer.allocateInsteadAndCopy(capacity);
-        if(dest == NULL) {
+        if(dest == nullptr) {
             fprintf(stderr, "memory allocation (%ld bytes) for file contents failed\n",
                     (long)capacity);
             *status = U_MEMORY_ALLOCATION_ERROR;
             res_close(result);
-            return NULL;
+            return nullptr;
         }
         totalSize = icu::CollationDataWriter::writeTailoring(
                 *t, *t->settings, indexes, dest, capacity, intStatus);
@@ -1356,7 +1356,7 @@ addCollation(ParseState* state, TableResource  *result, const char *collationTyp
         fprintf(stderr, "CollationDataWriter::writeTailoring() failed: %s\n",
                 u_errorName(intStatus));
         res_close(result);
-        return NULL;
+        return nullptr;
     }
     if(isVerbose()) {
         printf("%s~%s collation tailoring part sizes:\n", state->filename, collationType);
@@ -1372,11 +1372,11 @@ addCollation(ParseState* state, TableResource  *result, const char *collationTyp
         icu::CollationInfo::printSizes(totalSize, indexes);
 #endif
     }
-    struct SResource *collationBin = bin_open(state->bundle, "%%CollationBin", totalSize, dest, NULL, NULL, status);
+    struct SResource *collationBin = bin_open(state->bundle, "%%CollationBin", totalSize, dest, nullptr, nullptr, status);
     result->add(collationBin, line, *status);
     if (U_FAILURE(*status)) {
         res_close(result);
-        return NULL;
+        return nullptr;
     }
 #endif
     return result;
@@ -1390,22 +1390,22 @@ keepCollationType(const char * /*type*/) {
 static struct SResource *
 parseCollationElements(ParseState* state, char *tag, uint32_t startline, UBool newCollation, UErrorCode *status)
 {
-    TableResource  *result = NULL;
-    struct SResource  *member = NULL;
+    TableResource  *result = nullptr;
+    struct SResource  *member = nullptr;
     struct UString    *tokenValue;
     struct UString     comment;
     enum   ETokenType  token;
     char               subtag[1024], typeKeyword[1024];
     uint32_t           line;
 
-    result = table_open(state->bundle, tag, NULL, status);
+    result = table_open(state->bundle, tag, nullptr, status);
 
-    if (result == NULL || U_FAILURE(*status))
+    if (result == nullptr || U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
     if(isVerbose()){
-        printf(" collation elements %s at line %i \n",  (tag == NULL) ? "(null)" : tag, (int)startline);
+        printf(" collation elements %s at line %i \n",  (tag == nullptr) ? "(null)" : tag, (int)startline);
     }
     if(!newCollation) {
         return addCollation(state, result, "(no type)", startline, status);
@@ -1434,7 +1434,7 @@ parseCollationElements(ParseState* state, char *tag, uint32_t startline, UBool n
                     error(line, "Unexpected token %s", tokenNames[token]);
                 }
 
-                return NULL;
+                return nullptr;
             }
 
             u_UCharsToChars(tokenValue->fChars, subtag, u_strlen(tokenValue->fChars) + 1);
@@ -1442,17 +1442,17 @@ parseCollationElements(ParseState* state, char *tag, uint32_t startline, UBool n
             if (U_FAILURE(*status))
             {
                 res_close(result);
-                return NULL;
+                return nullptr;
             }
 
             if (uprv_strcmp(subtag, "default") == 0)
             {
-                member = parseResource(state, subtag, NULL, status);
+                member = parseResource(state, subtag, nullptr, status);
 
                 if (U_FAILURE(*status))
                 {
                     res_close(result);
-                    return NULL;
+                    return nullptr;
                 }
 
                 result->add(member, line, *status);
@@ -1467,13 +1467,13 @@ parseCollationElements(ParseState* state, char *tag, uint32_t startline, UBool n
                     token = getToken(state, &tokenValue, &comment, &line, status);
                     TableResource *collationRes;
                     if (keepCollationType(subtag)) {
-                        collationRes = table_open(state->bundle, subtag, NULL, status);
+                        collationRes = table_open(state->bundle, subtag, nullptr, status);
                     } else {
-                        collationRes = NULL;
+                        collationRes = nullptr;
                     }
                     // need to parse the collation data regardless
                     collationRes = addCollation(state, collationRes, subtag, startline, status);
-                    if (collationRes != NULL) {
+                    if (collationRes != nullptr) {
                         result->add(collationRes, startline, *status);
                     }
                 } else if(token == TOK_COLON) { /* right now, we'll just try to see if we have aliases */
@@ -1481,34 +1481,34 @@ parseCollationElements(ParseState* state, char *tag, uint32_t startline, UBool n
                     token = peekToken(state, 1, &tokenValue, &line, &comment, status);
                     u_UCharsToChars(tokenValue->fChars, typeKeyword, u_strlen(tokenValue->fChars) + 1);
                     if(uprv_strcmp(typeKeyword, "alias") == 0) {
-                        member = parseResource(state, subtag, NULL, status);
+                        member = parseResource(state, subtag, nullptr, status);
                         if (U_FAILURE(*status))
                         {
                             res_close(result);
-                            return NULL;
+                            return nullptr;
                         }
 
                         result->add(member, line, *status);
                     } else {
                         res_close(result);
                         *status = U_INVALID_FORMAT_ERROR;
-                        return NULL;
+                        return nullptr;
                     }
                 } else {
                     res_close(result);
                     *status = U_INVALID_FORMAT_ERROR;
-                    return NULL;
+                    return nullptr;
                 }
             }
 
             /*member = string_open(bundle, subtag, tokenValue->fChars, tokenValue->fLength, status);*/
 
-            /*expect(TOK_CLOSE_BRACE, NULL, NULL, status);*/
+            /*expect(TOK_CLOSE_BRACE, nullptr, nullptr, status);*/
 
             if (U_FAILURE(*status))
             {
                 res_close(result);
-                return NULL;
+                return nullptr;
             }
         }
     }
@@ -1519,8 +1519,8 @@ parseCollationElements(ParseState* state, char *tag, uint32_t startline, UBool n
 static struct SResource *
 realParseTable(ParseState* state, TableResource *table, char *tag, uint32_t startline, UErrorCode *status)
 {
-    struct SResource  *member = NULL;
-    struct UString    *tokenValue=NULL;
+    struct SResource  *member = nullptr;
+    struct UString    *tokenValue=nullptr;
     struct UString    comment;
     enum   ETokenType token;
     char              subtag[1024];
@@ -1530,7 +1530,7 @@ realParseTable(ParseState* state, TableResource *table, char *tag, uint32_t star
     /* '{' . (name resource)* '}' */
 
     if(isVerbose()){
-        printf(" parsing table %s at line %i \n", (tag == NULL) ? "(null)" : tag, (int)startline);
+        printf(" parsing table %s at line %i \n", (tag == nullptr) ? "(null)" : tag, (int)startline);
     }
     for (;;)
     {
@@ -1558,7 +1558,7 @@ realParseTable(ParseState* state, TableResource *table, char *tag, uint32_t star
                 error(line, "unexpected token %s", tokenNames[token]);
             }
 
-            return NULL;
+            return nullptr;
         }
 
         if(uprv_isInvariantUString(tokenValue->fChars, -1)) {
@@ -1566,21 +1566,21 @@ realParseTable(ParseState* state, TableResource *table, char *tag, uint32_t star
         } else {
             *status = U_INVALID_FORMAT_ERROR;
             error(line, "invariant characters required for table keys");
-            return NULL;
+            return nullptr;
         }
 
         if (U_FAILURE(*status))
         {
             error(line, "parse error. Stopped parsing tokens with %s", u_errorName(*status));
-            return NULL;
+            return nullptr;
         }
 
         member = parseResource(state, subtag, &comment, status);
 
-        if (member == NULL || U_FAILURE(*status))
+        if (member == nullptr || U_FAILURE(*status))
         {
             error(line, "parse error. Stopped parsing resource with %s", u_errorName(*status));
-            return NULL;
+            return nullptr;
         }
 
         table->add(member, line, *status);
@@ -1588,7 +1588,7 @@ realParseTable(ParseState* state, TableResource *table, char *tag, uint32_t star
         if (U_FAILURE(*status))
         {
             error(line, "parse error. Stopped parsing table with %s", u_errorName(*status));
-            return NULL;
+            return nullptr;
         }
         readToken = true;
         ustr_deinit(&comment);
@@ -1597,29 +1597,29 @@ realParseTable(ParseState* state, TableResource *table, char *tag, uint32_t star
     /* not reached */
     /* A compiler warning will appear if all paths don't contain a return statement. */
 /*     *status = U_INTERNAL_PROGRAM_ERROR;
-     return NULL;*/
+     return nullptr;*/
 }
 
 static struct SResource *
 parseTable(ParseState* state, char *tag, uint32_t startline, const struct UString *comment, UErrorCode *status)
 {
-    if (tag != NULL && uprv_strcmp(tag, "CollationElements") == 0)
+    if (tag != nullptr && uprv_strcmp(tag, "CollationElements") == 0)
     {
         return parseCollationElements(state, tag, startline, false, status);
     }
-    if (tag != NULL && uprv_strcmp(tag, "collations") == 0)
+    if (tag != nullptr && uprv_strcmp(tag, "collations") == 0)
     {
         return parseCollationElements(state, tag, startline, true, status);
     }
     if(isVerbose()){
-        printf(" table %s at line %i \n",  (tag == NULL) ? "(null)" : tag, (int)startline);
+        printf(" table %s at line %i \n",  (tag == nullptr) ? "(null)" : tag, (int)startline);
     }
 
     TableResource *result = table_open(state->bundle, tag, comment, status);
 
-    if (result == NULL || U_FAILURE(*status))
+    if (result == nullptr || U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
     return realParseTable(state, result, tag, startline,  status);
 }
@@ -1627,7 +1627,7 @@ parseTable(ParseState* state, char *tag, uint32_t startline, const struct UStrin
 static struct SResource *
 parseArray(ParseState* state, char *tag, uint32_t startline, const struct UString *comment, UErrorCode *status)
 {
-    struct SResource  *member = NULL;
+    struct SResource  *member = nullptr;
     struct UString    *tokenValue;
     struct UString    memberComments;
     enum   ETokenType token;
@@ -1635,12 +1635,12 @@ parseArray(ParseState* state, char *tag, uint32_t startline, const struct UStrin
 
     ArrayResource  *result = array_open(state->bundle, tag, comment, status);
 
-    if (result == NULL || U_FAILURE(*status))
+    if (result == nullptr || U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
     if(isVerbose()){
-        printf(" array %s at line %i \n",  (tag == NULL) ? "(null)" : tag, (int)startline);
+        printf(" array %s at line %i \n",  (tag == nullptr) ? "(null)" : tag, (int)startline);
     }
 
     ustr_init(&memberComments);
@@ -1652,12 +1652,12 @@ parseArray(ParseState* state, char *tag, uint32_t startline, const struct UStrin
         ustr_setlen(&memberComments, 0, status);
 
         /* check for end of array, but don't consume next token unless it really is the end */
-        token = peekToken(state, 0, &tokenValue, NULL, &memberComments, status);
+        token = peekToken(state, 0, &tokenValue, nullptr, &memberComments, status);
 
 
         if (token == TOK_CLOSE_BRACE)
         {
-            getToken(state, NULL, NULL, NULL, status);
+            getToken(state, nullptr, nullptr, nullptr, status);
             if (!readToken) {
                 warning(startline, "Encountered empty array");
             }
@@ -1669,40 +1669,40 @@ parseArray(ParseState* state, char *tag, uint32_t startline, const struct UStrin
             res_close(result);
             *status = U_INVALID_FORMAT_ERROR;
             error(startline, "unterminated array");
-            return NULL;
+            return nullptr;
         }
 
         /* string arrays are a special case */
         if (token == TOK_STRING)
         {
-            getToken(state, &tokenValue, &memberComments, NULL, status);
-            member = string_open(state->bundle, NULL, tokenValue->fChars, tokenValue->fLength, &memberComments, status);
+            getToken(state, &tokenValue, &memberComments, nullptr, status);
+            member = string_open(state->bundle, nullptr, tokenValue->fChars, tokenValue->fLength, &memberComments, status);
         }
         else
         {
-            member = parseResource(state, NULL, &memberComments, status);
+            member = parseResource(state, nullptr, &memberComments, status);
         }
 
-        if (member == NULL || U_FAILURE(*status))
+        if (member == nullptr || U_FAILURE(*status))
         {
             res_close(result);
-            return NULL;
+            return nullptr;
         }
 
         result->add(member);
 
         /* eat optional comma if present */
-        token = peekToken(state, 0, NULL, NULL, NULL, status);
+        token = peekToken(state, 0, nullptr, nullptr, nullptr, status);
 
         if (token == TOK_COMMA)
         {
-            getToken(state, NULL, NULL, NULL, status);
+            getToken(state, nullptr, nullptr, nullptr, status);
         }
 
         if (U_FAILURE(*status))
         {
             res_close(result);
-            return NULL;
+            return nullptr;
         }
         readToken = true;
     }
@@ -1723,13 +1723,13 @@ parseIntVector(ParseState* state, char *tag, uint32_t startline, const struct US
 
     IntVectorResource *result = intvector_open(state->bundle, tag, comment, status);
 
-    if (result == NULL || U_FAILURE(*status))
+    if (result == nullptr || U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
 
     if(isVerbose()){
-        printf(" vector %s at line %i \n",  (tag == NULL) ? "(null)" : tag, (int)startline);
+        printf(" vector %s at line %i \n",  (tag == nullptr) ? "(null)" : tag, (int)startline);
     }
     ustr_init(&memberComments);
     /* '{' . string [','] '}' */
@@ -1738,12 +1738,12 @@ parseIntVector(ParseState* state, char *tag, uint32_t startline, const struct US
         ustr_setlen(&memberComments, 0, status);
 
         /* check for end of array, but don't consume next token unless it really is the end */
-        token = peekToken(state, 0, NULL, NULL,&memberComments, status);
+        token = peekToken(state, 0, nullptr, nullptr,&memberComments, status);
 
         if (token == TOK_CLOSE_BRACE)
         {
             /* it's the end, consume the close brace */
-            getToken(state, NULL, NULL, NULL, status);
+            getToken(state, nullptr, nullptr, nullptr, status);
             if (!readToken) {
                 warning(startline, "Encountered empty int vector");
             }
@@ -1752,12 +1752,12 @@ parseIntVector(ParseState* state, char *tag, uint32_t startline, const struct US
         }
 
         int32_t stringLength;
-        string = getInvariantString(state, NULL, NULL, stringLength, status);
+        string = getInvariantString(state, nullptr, nullptr, stringLength, status);
 
         if (U_FAILURE(*status))
         {
             res_close(result);
-            return NULL;
+            return nullptr;
         }
 
         /* For handling illegal char in the Intvector */
@@ -1768,7 +1768,7 @@ parseIntVector(ParseState* state, char *tag, uint32_t startline, const struct US
         {
             result->add(value, *status);
             uprv_free(string);
-            token = peekToken(state, 0, NULL, NULL, NULL, status);
+            token = peekToken(state, 0, nullptr, nullptr, nullptr, status);
         }
         else
         {
@@ -1779,14 +1779,14 @@ parseIntVector(ParseState* state, char *tag, uint32_t startline, const struct US
         if (U_FAILURE(*status))
         {
             res_close(result);
-            return NULL;
+            return nullptr;
         }
 
         /* the comma is optional (even though it is required to prevent the reader from concatenating
         consecutive entries) so that a missing comma on the last entry isn't an error */
         if (token == TOK_COMMA)
         {
-            getToken(state, NULL, NULL, NULL, status);
+            getToken(state, nullptr, nullptr, nullptr, status);
         }
         readToken = true;
     }
@@ -1795,7 +1795,7 @@ parseIntVector(ParseState* state, char *tag, uint32_t startline, const struct US
     /* A compiler warning will appear if all paths don't contain a return statement. */
 /*    intvector_close(result, status);
     *status = U_INTERNAL_PROGRAM_ERROR;
-    return NULL;*/
+    return nullptr;*/
 }
 
 static struct SResource *
@@ -1803,28 +1803,28 @@ parseBinary(ParseState* state, char *tag, uint32_t startline, const struct UStri
 {
     uint32_t line;
     int32_t stringLength;
-    LocalMemory<char> string(getInvariantString(state, &line, NULL, stringLength, status));
+    LocalMemory<char> string(getInvariantString(state, &line, nullptr, stringLength, status));
     if (string.isNull() || U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
 
-    expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
+    expect(state, TOK_CLOSE_BRACE, nullptr, nullptr, nullptr, status);
     if (U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
 
     if(isVerbose()){
-        printf(" binary %s at line %i \n",  (tag == NULL) ? "(null)" : tag, (int)startline);
+        printf(" binary %s at line %i \n",  (tag == nullptr) ? "(null)" : tag, (int)startline);
     }
 
     LocalMemory<uint8_t> value;
     int32_t count = 0;
-    if (stringLength > 0 && value.allocateInsteadAndCopy(stringLength) == NULL)
+    if (stringLength > 0 && value.allocateInsteadAndCopy(stringLength) == nullptr)
     {
         *status = U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     char toConv[3] = {'\0', '\0', '\0'};
@@ -1836,7 +1836,7 @@ parseBinary(ParseState* state, char *tag, uint32_t startline, const struct UStri
         if (i == stringLength) {
             *status=U_INVALID_CHAR_FOUND;
             error(line, "Encountered invalid binary value (odd number of hex digits)");
-            return NULL;
+            return nullptr;
         }
         toConv[0] = c0;
         toConv[1] = string[i++];
@@ -1849,44 +1849,44 @@ parseBinary(ParseState* state, char *tag, uint32_t startline, const struct UStri
         {
             *status=U_INVALID_CHAR_FOUND;
             error(line, "Encountered invalid binary value (not all pairs of hex digits)");
-            return NULL;
+            return nullptr;
         }
     }
 
     if (count == 0) {
         warning(startline, "Encountered empty binary value");
-        return bin_open(state->bundle, tag, 0, NULL, "", comment, status);
+        return bin_open(state->bundle, tag, 0, nullptr, "", comment, status);
     } else {
-        return bin_open(state->bundle, tag, count, value.getAlias(), NULL, comment, status);
+        return bin_open(state->bundle, tag, count, value.getAlias(), nullptr, comment, status);
     }
 }
 
 static struct SResource *
 parseInteger(ParseState* state, char *tag, uint32_t startline, const struct UString *comment, UErrorCode *status)
 {
-    struct SResource *result = NULL;
+    struct SResource *result = nullptr;
     int32_t           value;
     char             *string;
     char             *stopstring;
 
     int32_t stringLength;
-    string = getInvariantString(state, NULL, NULL, stringLength, status);
+    string = getInvariantString(state, nullptr, nullptr, stringLength, status);
 
-    if (string == NULL || U_FAILURE(*status))
+    if (string == nullptr || U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
 
-    expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
+    expect(state, TOK_CLOSE_BRACE, nullptr, nullptr, nullptr, status);
 
     if (U_FAILURE(*status))
     {
         uprv_free(string);
-        return NULL;
+        return nullptr;
     }
 
     if(isVerbose()){
-        printf(" integer %s at line %i \n",  (tag == NULL) ? "(null)" : tag, (int)startline);
+        printf(" integer %s at line %i \n",  (tag == nullptr) ? "(null)" : tag, (int)startline);
     }
 
     if (stringLength == 0)
@@ -1916,48 +1916,48 @@ parseImport(ParseState* state, char *tag, uint32_t startline, const struct UStri
 {
     uint32_t          line;
     int32_t stringLength;
-    LocalMemory<char> filename(getInvariantString(state, &line, NULL, stringLength, status));
+    LocalMemory<char> filename(getInvariantString(state, &line, nullptr, stringLength, status));
     if (U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
 
-    expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
+    expect(state, TOK_CLOSE_BRACE, nullptr, nullptr, nullptr, status);
 
     if (U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
 
     if(isVerbose()){
-        printf(" import %s at line %i \n",  (tag == NULL) ? "(null)" : tag, (int)startline);
+        printf(" import %s at line %i \n",  (tag == nullptr) ? "(null)" : tag, (int)startline);
     }
 
     /* Open the input file for reading */
     CharString fullname;
-    if (state->inputdir != NULL) {
+    if (state->inputdir != nullptr) {
         fullname.append(state->inputdir, *status);
     }
     fullname.appendPathPart(filename.getAlias(), *status);
     if (U_FAILURE(*status)) {
-        return NULL;
+        return nullptr;
     }
 
     FileStream *file = T_FileStream_open(fullname.data(), "rb");
-    if (file == NULL)
+    if (file == nullptr)
     {
         error(line, "couldn't open input file %s", filename.getAlias());
         *status = U_FILE_ACCESS_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     int32_t len  = T_FileStream_size(file);
     LocalMemory<uint8_t> data;
-    if(data.allocateInsteadAndCopy(len) == NULL)
+    if(data.allocateInsteadAndCopy(len) == nullptr)
     {
         *status = U_MEMORY_ALLOCATION_ERROR;
         T_FileStream_close (file);
-        return NULL;
+        return nullptr;
     }
 
     /* int32_t numRead = */ T_FileStream_read(file, data.getAlias(), len);
@@ -1973,43 +1973,43 @@ parseInclude(ParseState* state, char *tag, uint32_t startline, const struct UStr
     int32_t           len=0;
     char             *filename;
     uint32_t          line;
-    UChar *pTarget     = NULL;
+    UChar *pTarget     = nullptr;
 
     UCHARBUF *ucbuf;
-    char     *fullname = NULL;
-    const char* cp = NULL;
-    const UChar* uBuffer = NULL;
+    char     *fullname = nullptr;
+    const char* cp = nullptr;
+    const UChar* uBuffer = nullptr;
 
     int32_t stringLength;
-    filename = getInvariantString(state, &line, NULL, stringLength, status);
+    filename = getInvariantString(state, &line, nullptr, stringLength, status);
 
     if (U_FAILURE(*status))
     {
-        return NULL;
+        return nullptr;
     }
 
-    expect(state, TOK_CLOSE_BRACE, NULL, NULL, NULL, status);
+    expect(state, TOK_CLOSE_BRACE, nullptr, nullptr, nullptr, status);
 
     if (U_FAILURE(*status))
     {
         uprv_free(filename);
-        return NULL;
+        return nullptr;
     }
 
     if(isVerbose()){
-        printf(" include %s at line %i \n",  (tag == NULL) ? "(null)" : tag, (int)startline);
+        printf(" include %s at line %i \n",  (tag == nullptr) ? "(null)" : tag, (int)startline);
     }
 
     fullname = (char *) uprv_malloc(state->inputdirLength + stringLength + 2);
-    /* test for NULL */
-    if(fullname == NULL)
+    /* test for nullptr */
+    if(fullname == nullptr)
     {
         *status = U_MEMORY_ALLOCATION_ERROR;
         uprv_free(filename);
-        return NULL;
+        return nullptr;
     }
 
-    if(state->inputdir!=NULL){
+    if(state->inputdir!=nullptr){
         if (state->inputdir[state->inputdirLength - 1] != U_FILE_SEP_CHAR)
         {
 
@@ -2033,7 +2033,7 @@ parseInclude(ParseState* state, char *tag, uint32_t startline, const struct UStr
 
     if (U_FAILURE(*status)) {
         error(line, "couldn't open input file %s\n", filename);
-        return NULL;
+        return nullptr;
     }
 
     uBuffer = ucbuf_getBuffer(ucbuf,&len,status);
@@ -2097,11 +2097,11 @@ static struct {
     const UChar *nameUChars;
     ParseResourceFunction *parseFunction;
 } gResourceTypes[] = {
-    {"Unknown", NULL, NULL},
+    {"Unknown", nullptr, nullptr},
     {"string", k_type_string, parseString},
     {"binary", k_type_binary, parseBinary},
     {"table", k_type_table, parseTable},
-    {"table(nofallback)", k_type_table_no_fallback, NULL}, /* parseFunction will never be called */
+    {"table(nofallback)", k_type_table_no_fallback, nullptr}, /* parseFunction will never be called */
     {"integer", k_type_integer, parseInteger},
     {"array", k_type_array, parseArray},
     {"alias", k_type_alias, parseAlias},
@@ -2109,10 +2109,10 @@ static struct {
     {"import", k_type_import, parseImport},
     {"include", k_type_include, parseInclude},
     {"process(uca_rules)", k_type_plugin_uca_rules, parseUCARules},
-    {"process(collation)", k_type_plugin_collation, NULL /* not implemented yet */},
+    {"process(collation)", k_type_plugin_collation, nullptr /* not implemented yet */},
     {"process(transliterator)", k_type_plugin_transliterator, parseTransliterator},
     {"process(dependency)", k_type_plugin_dependency, parseDependency},
-    {"reserved", NULL, NULL}
+    {"reserved", nullptr, nullptr}
 };
 
 void initParser()
@@ -2188,16 +2188,16 @@ parseResource(ParseState* state, char *tag, const struct UString *comment, UErro
 {
     enum   ETokenType      token;
     enum   EResourceType  resType = RESTYPE_UNKNOWN;
-    ParseResourceFunction *parseFunction = NULL;
+    ParseResourceFunction *parseFunction = nullptr;
     struct UString        *tokenValue;
     uint32_t                 startline;
     uint32_t                 line;
 
 
-    token = getToken(state, &tokenValue, NULL, &startline, status);
+    token = getToken(state, &tokenValue, nullptr, &startline, status);
 
     if(isVerbose()){
-        printf(" resource %s at line %i \n",  (tag == NULL) ? "(null)" : tag, (int)startline);
+        printf(" resource %s at line %i \n",  (tag == nullptr) ? "(null)" : tag, (int)startline);
     }
 
     /* name . [ ':' type ] '{' resource '}' */
@@ -2209,19 +2209,19 @@ parseResource(ParseState* state, char *tag, const struct UString *comment, UErro
     case TOK_EOF:
         *status = U_INVALID_FORMAT_ERROR;
         error(startline, "Unexpected EOF encountered");
-        return NULL;
+        return nullptr;
 
     case TOK_ERROR:
         *status = U_INVALID_FORMAT_ERROR;
-        return NULL;
+        return nullptr;
 
     case TOK_COLON:
         resType = parseResourceType(state, status);
-        expect(state, TOK_OPEN_BRACE, &tokenValue, NULL, &startline, status);
+        expect(state, TOK_OPEN_BRACE, &tokenValue, nullptr, &startline, status);
 
         if (U_FAILURE(*status))
         {
-            return NULL;
+            return nullptr;
         }
 
         break;
@@ -2232,7 +2232,7 @@ parseResource(ParseState* state, char *tag, const struct UString *comment, UErro
     default:
         *status = U_INVALID_FORMAT_ERROR;
         error(startline, "syntax error while reading a resource, expected '{' or ':'");
-        return NULL;
+        return nullptr;
     }
 
 
@@ -2250,11 +2250,11 @@ parseResource(ParseState* state, char *tag, const struct UString *comment, UErro
         { string }      => string
         */
 
-        token = peekToken(state, 0, NULL, &line, NULL,status);
+        token = peekToken(state, 0, nullptr, &line, nullptr,status);
 
         if (U_FAILURE(*status))
         {
-            return NULL;
+            return nullptr;
         }
 
         if (token == TOK_OPEN_BRACE || token == TOK_COLON ||token ==TOK_CLOSE_BRACE )
@@ -2263,11 +2263,11 @@ parseResource(ParseState* state, char *tag, const struct UString *comment, UErro
         }
         else if (token == TOK_STRING)
         {
-            token = peekToken(state, 1, NULL, &line, NULL, status);
+            token = peekToken(state, 1, nullptr, &line, nullptr, status);
 
             if (U_FAILURE(*status))
             {
-                return NULL;
+                return nullptr;
             }
 
             switch (token)
@@ -2279,28 +2279,28 @@ parseResource(ParseState* state, char *tag, const struct UString *comment, UErro
             default:
                 *status = U_INVALID_FORMAT_ERROR;
                 error(line, "Unexpected token after string, expected ',', '{' or '}'");
-                return NULL;
+                return nullptr;
             }
         }
         else
         {
             *status = U_INVALID_FORMAT_ERROR;
             error(line, "Unexpected token after '{'");
-            return NULL;
+            return nullptr;
         }
 
         /* printf("Type guessed as %s\n", resourceNames[resType]); */
     } else if(resType == RESTYPE_TABLE_NO_FALLBACK) {
         *status = U_INVALID_FORMAT_ERROR;
         error(startline, "error: %s resource type not valid except on top bundle level", gResourceTypes[resType].nameChars);
-        return NULL;
+        return nullptr;
     }
 
 
     /* We should now know what we need to parse next, so call the appropriate parser
     function and return. */
     parseFunction = gResourceTypes[resType].parseFunction;
-    if (parseFunction != NULL) {
+    if (parseFunction != nullptr) {
         return parseFunction(state, tag, startline, comment, status);
     }
     else {
@@ -2308,7 +2308,7 @@ parseResource(ParseState* state, char *tag, const struct UString *comment, UErro
         error(startline, "internal error: %s resource type found and not handled", gResourceTypes[resType].nameChars);
     }
 
-    return NULL;
+    return nullptr;
 }
 
 /* parse the top-level resource */
@@ -2334,38 +2334,38 @@ parse(UCHARBUF *buf, const char *inputDir, const char *outputDir, const char *fi
     initLookahead(&state, buf, status);
 
     state.inputdir       = inputDir;
-    state.inputdirLength = (state.inputdir != NULL) ? (uint32_t)uprv_strlen(state.inputdir) : 0;
+    state.inputdirLength = (state.inputdir != nullptr) ? (uint32_t)uprv_strlen(state.inputdir) : 0;
     state.outputdir       = outputDir;
-    state.outputdirLength = (state.outputdir != NULL) ? (uint32_t)uprv_strlen(state.outputdir) : 0;
+    state.outputdirLength = (state.outputdir != nullptr) ? (uint32_t)uprv_strlen(state.outputdir) : 0;
     state.filename = filename;
     state.makeBinaryCollation = makeBinaryCollation;
     state.omitCollationRules = omitCollationRules;
     state.icu4xMode = icu4xMode;
 
     ustr_init(&comment);
-    expect(&state, TOK_STRING, &tokenValue, &comment, NULL, status);
+    expect(&state, TOK_STRING, &tokenValue, &comment, nullptr, status);
 
     state.bundle = new SRBRoot(&comment, false, *status);
 
-    if (state.bundle == NULL || U_FAILURE(*status))
+    if (state.bundle == nullptr || U_FAILURE(*status))
     {
         delete state.bundle;
 
-        return NULL;
+        return nullptr;
     }
 
 
     state.bundle->setLocale(tokenValue->fChars, *status);
 
     /* The following code is to make Empty bundle work no matter with :table specifer or not */
-    token = getToken(&state, NULL, NULL, &line, status);
+    token = getToken(&state, nullptr, nullptr, &line, status);
     if(token==TOK_COLON) {
         *status=U_ZERO_ERROR;
         bundleType=parseResourceType(&state, status);
 
         if(isTable(bundleType))
         {
-            expect(&state, TOK_OPEN_BRACE, NULL, NULL, &line, status);
+            expect(&state, TOK_OPEN_BRACE, nullptr, nullptr, &line, status);
         }
         else
         {
@@ -2393,7 +2393,7 @@ parse(UCHARBUF *buf, const char *inputDir, const char *outputDir, const char *fi
     if (U_FAILURE(*status))
     {
         delete state.bundle;
-        return NULL;
+        return nullptr;
     }
 
     if(bundleType==RESTYPE_TABLE_NO_FALLBACK) {
@@ -2408,24 +2408,24 @@ parse(UCHARBUF *buf, const char *inputDir, const char *outputDir, const char *fi
     assert(!state.bundle->fIsPoolBundle);
     assert(state.bundle->fRoot->fType == URES_TABLE);
     TableResource *rootTable = static_cast<TableResource *>(state.bundle->fRoot);
-    realParseTable(&state, rootTable, NULL, line, status);
-    if(dependencyArray!=NULL){
+    realParseTable(&state, rootTable, nullptr, line, status);
+    if(dependencyArray!=nullptr){
         rootTable->add(dependencyArray, 0, *status);
-        dependencyArray = NULL;
+        dependencyArray = nullptr;
     }
    if (U_FAILURE(*status))
     {
         delete state.bundle;
         res_close(dependencyArray);
-        return NULL;
+        return nullptr;
     }
 
-    if (getToken(&state, NULL, NULL, &line, status) != TOK_EOF)
+    if (getToken(&state, nullptr, nullptr, &line, status) != TOK_EOF)
     {
         warning(line, "extraneous text after resource bundle (perhaps unmatched braces)");
         if(isStrict()){
             *status = U_INVALID_FORMAT_ERROR;
-            return NULL;
+            return nullptr;
         }
     }
 
index cb835cb8c33ddc7f29b5ec5e92944f19b689a4d4..b963493dbed8c04274ad163b14e874d6a93ba602 100644 (file)
@@ -48,7 +48,7 @@ removeText(UChar *source, int32_t srcLen,
            UnicodeString patString,uint32_t options,  
            UnicodeString replaceText, UErrorCode *status){
 
-    if(status == NULL || U_FAILURE(*status)){
+    if(status == nullptr || U_FAILURE(*status)){
         return 0;
     }
 
@@ -89,7 +89,7 @@ getText(const UChar* source, int32_t srcLen,
         UnicodeString patternString, 
         UErrorCode* status){
     
-    if(status == NULL || U_FAILURE(*status)){
+    if(status == nullptr || U_FAILURE(*status)){
         return 0;
     }
 
@@ -124,7 +124,7 @@ U_CFUNC int32_t
 getDescription( const UChar* source, int32_t srcLen,
                 UChar** dest, int32_t destCapacity,
                 UErrorCode* status){
-    if(status == NULL || U_FAILURE(*status)){
+    if(status == nullptr || U_FAILURE(*status)){
         return 0;
     }
 
@@ -148,7 +148,7 @@ U_CFUNC int32_t
 getCount(const UChar* source, int32_t srcLen, 
          UParseCommentsOption option, UErrorCode *status){
     
-    if(status == NULL || U_FAILURE(*status)){
+    if(status == nullptr || U_FAILURE(*status)){
         return 0;
     }
 
@@ -188,7 +188,7 @@ getAt(const UChar* source, int32_t srcLen,
         UParseCommentsOption option,
         UErrorCode* status){
 
-    if(status == NULL || U_FAILURE(*status)){
+    if(status == nullptr || U_FAILURE(*status)){
         return 0;
     }
 
index 4c854bd55b1b0f5556bc65d7bcbc0c311025d0e6..366a126041edb1e8b0287f1442241334145c618d 100644 (file)
@@ -89,7 +89,7 @@ static const ResFile kNoPoolBundle;
 /*
  * res_none() returns the address of kNoResource,
  * for use in non-error cases when no resource is to be added to the bundle.
- * (NULL is used in error cases.)
+ * (nullptr is used in error cases.)
  */
 static SResource kNoResource;  // TODO: const
 
@@ -150,17 +150,17 @@ struct SResource* res_none() {
 
 SResource::SResource()
         : fType(URES_NONE), fWritten(false), fRes(RES_BOGUS), fRes16(-1), fKey(-1), fKey16(-1),
-          line(0), fNext(NULL) {
+          line(0), fNext(nullptr) {
     ustr_init(&fComment);
 }
 
 SResource::SResource(SRBRoot *bundle, const char *tag, int8_t type, const UString* comment,
                      UErrorCode &errorCode)
         : fType(type), fWritten(false), fRes(RES_BOGUS), fRes16(-1),
-          fKey(bundle != NULL ? bundle->addTag(tag, errorCode) : -1), fKey16(-1),
-          line(0), fNext(NULL) {
+          fKey(bundle != nullptr ? bundle->addTag(tag, errorCode) : -1), fKey16(-1),
+          line(0), fNext(nullptr) {
     ustr_init(&fComment);
-    if(comment != NULL) {
+    if(comment != nullptr) {
         ustr_cpy(&fComment, comment, &errorCode);
     }
 }
@@ -171,7 +171,7 @@ SResource::~SResource() {
 
 ContainerResource::~ContainerResource() {
     SResource *current = fFirst;
-    while (current != NULL) {
+    while (current != nullptr) {
         SResource *next = current->fNext;
         delete current;
         current = next;
@@ -182,7 +182,7 @@ TableResource::~TableResource() {}
 
 // TODO: clarify that containers adopt new items, even in error cases; use LocalPointer
 void TableResource::add(SResource *res, int linenumber, UErrorCode &errorCode) {
-    if (U_FAILURE(errorCode) || res == NULL || res == &kNoResource) {
+    if (U_FAILURE(errorCode) || res == nullptr || res == &kNoResource) {
         return;
     }
 
@@ -193,9 +193,9 @@ void TableResource::add(SResource *res, int linenumber, UErrorCode &errorCode) {
     ++fCount;
 
     /* is the list still empty? */
-    if (fFirst == NULL) {
+    if (fFirst == nullptr) {
         fFirst = res;
-        res->fNext = NULL;
+        res->fNext = nullptr;
         return;
     }
 
@@ -203,8 +203,8 @@ void TableResource::add(SResource *res, int linenumber, UErrorCode &errorCode) {
 
     SResource *current = fFirst;
 
-    SResource *prev = NULL;
-    while (current != NULL) {
+    SResource *prev = nullptr;
+    while (current != nullptr) {
         const char *currentKeyString = fRoot->fKeys + current->fKey;
         int diff;
         /*
@@ -221,7 +221,7 @@ void TableResource::add(SResource *res, int linenumber, UErrorCode &errorCode) {
             current = current->fNext;
         } else if (diff > 0) {
             /* we're either in front of the list, or in the middle */
-            if (prev == NULL) {
+            if (prev == nullptr) {
                 /* front of the list */
                 fFirst = res;
             } else {
@@ -241,14 +241,14 @@ void TableResource::add(SResource *res, int linenumber, UErrorCode &errorCode) {
 
     /* end of list */
     prev->fNext = res;
-    res->fNext  = NULL;
+    res->fNext  = nullptr;
 }
 
 ArrayResource::~ArrayResource() {}
 
 void ArrayResource::add(SResource *res) {
-    if (res != NULL && res != &kNoResource) {
-        if (fFirst == NULL) {
+    if (res != nullptr && res != &kNoResource) {
+        if (fFirst == nullptr) {
             fFirst = res;
         } else {
             fLast->fNext = res;
@@ -261,7 +261,7 @@ void ArrayResource::add(SResource *res) {
 PseudoListResource::~PseudoListResource() {}
 
 void PseudoListResource::add(SResource *res) {
-    if (res != NULL && res != &kNoResource) {
+    if (res != nullptr && res != &kNoResource) {
         res->fNext = fFirst;
         fFirst = res;
         ++fCount;
@@ -287,7 +287,7 @@ StringBaseResource::StringBaseResource(SRBRoot *bundle, const char *tag, int8_t
 
 StringBaseResource::StringBaseResource(SRBRoot *bundle, int8_t type,
                                        const icu::UnicodeString &value, UErrorCode &errorCode)
-        : SResource(bundle, NULL, type, NULL, errorCode), fString(value) {
+        : SResource(bundle, nullptr, type, nullptr, errorCode), fString(value) {
     if (value.isEmpty() && gFormatVersion > 1) {
         fRes = URES_MAKE_EMPTY_RESOURCE(type);
         fWritten = true;
@@ -303,7 +303,7 @@ StringBaseResource::StringBaseResource(SRBRoot *bundle, int8_t type,
 // Pool bundle string, alias the buffer. Guaranteed NUL-terminated and not empty.
 StringBaseResource::StringBaseResource(int8_t type, const UChar *value, int32_t len,
                                        UErrorCode &errorCode)
-        : SResource(NULL, NULL, type, NULL, errorCode), fString(true, value, len) {
+        : SResource(nullptr, nullptr, type, nullptr, errorCode), fString(true, value, len) {
     assert(len > 0);
     assert(!fString.isBogus());
 }
@@ -342,7 +342,7 @@ IntVectorResource::IntVectorResource(SRBRoot *bundle, const char *tag,
         : SResource(bundle, tag, URES_INT_VECTOR, comment, errorCode),
           fCount(0), fSize(RESLIST_INT_VECTOR_INIT_SIZE),
           fArray(new uint32_t[fSize]) {
-    if (fArray == NULL) {
+    if (fArray == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -373,13 +373,13 @@ BinaryResource::BinaryResource(SRBRoot *bundle, const char *tag,
                                uint32_t length, uint8_t *data, const char* fileName,
                                const UString* comment, UErrorCode &errorCode)
         : SResource(bundle, tag, URES_BINARY, comment, errorCode),
-          fLength(length), fData(NULL), fFileName(NULL) {
+          fLength(length), fData(nullptr), fFileName(nullptr) {
     if (U_FAILURE(errorCode)) {
         return;
     }
-    if (fileName != NULL && *fileName != 0){
+    if (fileName != nullptr && *fileName != 0){
         fFileName = new char[uprv_strlen(fileName)+1];
-        if (fFileName == NULL) {
+        if (fFileName == nullptr) {
             errorCode = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
@@ -387,7 +387,7 @@ BinaryResource::BinaryResource(SRBRoot *bundle, const char *tag,
     }
     if (length > 0) {
         fData = new uint8_t[length];
-        if (fData == NULL) {
+        if (fData == nullptr) {
             errorCode = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
@@ -410,9 +410,9 @@ BinaryResource::~BinaryResource() {
 void
 StringResource::handlePreflightStrings(SRBRoot *bundle, UHashtable *stringSet,
                                        UErrorCode &errorCode) {
-    assert(fSame == NULL);
+    assert(fSame == nullptr);
     fSame = static_cast<StringResource *>(uhash_get(stringSet, this));
-    if (fSame != NULL) {
+    if (fSame != nullptr) {
         // This is a duplicate of a pool bundle string or of an earlier-visited string.
         if (++fSame->fNumCopies == 1) {
             assert(fSame->fWritten);
@@ -450,7 +450,7 @@ StringResource::handlePreflightStrings(SRBRoot *bundle, UHashtable *stringSet,
 void
 ContainerResource::handlePreflightStrings(SRBRoot *bundle, UHashtable *stringSet,
                                           UErrorCode &errorCode) {
-    for (SResource *current = fFirst; current != NULL; current = current->fNext) {
+    for (SResource *current = fFirst; current != nullptr; current = current->fNext) {
         current->preflightStrings(bundle, stringSet, errorCode);
     }
 }
@@ -503,7 +503,7 @@ SRBRoot::makeRes16(uint32_t resWord) const {
 int32_t
 SRBRoot::mapKey(int32_t oldpos) const {
     const KeyMapEntry *map = fKeyMap;
-    if (map == NULL) {
+    if (map == nullptr) {
         return oldpos;
     }
     int32_t i, start, limit;
@@ -531,7 +531,7 @@ SRBRoot::mapKey(int32_t oldpos) const {
 void
 StringResource::handleWrite16(SRBRoot * /*bundle*/) {
     SResource *same;
-    if ((same = fSame) != NULL) {
+    if ((same = fSame) != nullptr) {
         /* This is a duplicate. */
         assert(same->fRes != RES_BOGUS && same->fWritten);
         fRes = same->fRes;
@@ -541,7 +541,7 @@ StringResource::handleWrite16(SRBRoot * /*bundle*/) {
 
 void
 ContainerResource::writeAllRes16(SRBRoot *bundle) {
-    for (SResource *current = fFirst; current != NULL; current = current->fNext) {
+    for (SResource *current = fFirst; current != nullptr; current = current->fNext) {
         bundle->f16BitUnits.append((UChar)current->fRes16);
     }
     fWritten = true;
@@ -556,7 +556,7 @@ ArrayResource::handleWrite16(SRBRoot *bundle) {
     }
 
     int32_t res16 = 0;
-    for (SResource *current = fFirst; current != NULL; current = current->fNext) {
+    for (SResource *current = fFirst; current != nullptr; current = current->fNext) {
         current->write16(bundle);
         res16 |= current->fRes16;
     }
@@ -577,7 +577,7 @@ TableResource::handleWrite16(SRBRoot *bundle) {
     /* Find the smallest table type that fits the data. */
     int32_t key16 = 0;
     int32_t res16 = 0;
-    for (SResource *current = fFirst; current != NULL; current = current->fNext) {
+    for (SResource *current = fFirst; current != nullptr; current = current->fNext) {
         current->write16(bundle);
         key16 |= current->fKey16;
         res16 |= current->fRes16;
@@ -590,7 +590,7 @@ TableResource::handleWrite16(SRBRoot *bundle) {
             /* 16-bit count, key offsets and values */
             fRes = URES_MAKE_RESOURCE(URES_TABLE16, bundle->f16BitUnits.length());
             bundle->f16BitUnits.append((UChar)fCount);
-            for (SResource *current = fFirst; current != NULL; current = current->fNext) {
+            for (SResource *current = fFirst; current != nullptr; current = current->fNext) {
                 bundle->f16BitUnits.append((UChar)current->fKey16);
             }
             writeAllRes16(bundle);
@@ -691,7 +691,7 @@ BinaryResource::handlePreWrite(uint32_t *byteOffset) {
 
 void
 ContainerResource::preWriteAllRes(uint32_t *byteOffset) {
-    for (SResource *current = fFirst; current != NULL; current = current->fNext) {
+    for (SResource *current = fFirst; current != nullptr; current = current->fNext) {
         current->preWrite(byteOffset);
     }
 }
@@ -754,7 +754,7 @@ StringBaseResource::handleWrite(UNewDataMemory *mem, uint32_t *byteOffset) {
 void
 ContainerResource::writeAllRes(UNewDataMemory *mem, uint32_t *byteOffset) {
     uint32_t i = 0;
-    for (SResource *current = fFirst; current != NULL; ++i, current = current->fNext) {
+    for (SResource *current = fFirst; current != nullptr; ++i, current = current->fNext) {
         current->write(mem, byteOffset);
     }
     assert(i == fCount);
@@ -762,7 +762,7 @@ ContainerResource::writeAllRes(UNewDataMemory *mem, uint32_t *byteOffset) {
 
 void
 ContainerResource::writeAllRes32(UNewDataMemory *mem, uint32_t *byteOffset) {
-    for (SResource *current = fFirst; current != NULL; current = current->fNext) {
+    for (SResource *current = fFirst; current != nullptr; current = current->fNext) {
         udata_write32(mem, current->fRes);
     }
     *byteOffset += fCount * 4;
@@ -808,7 +808,7 @@ TableResource::handleWrite(UNewDataMemory *mem, uint32_t *byteOffset) {
     writeAllRes(mem, byteOffset);
     if(fTableType == URES_TABLE) {
         udata_write16(mem, (uint16_t)fCount);
-        for (SResource *current = fFirst; current != NULL; current = current->fNext) {
+        for (SResource *current = fFirst; current != nullptr; current = current->fNext) {
             udata_write16(mem, current->fKey16);
         }
         *byteOffset += (1 + fCount)* 2;
@@ -819,7 +819,7 @@ TableResource::handleWrite(UNewDataMemory *mem, uint32_t *byteOffset) {
         }
     } else /* URES_TABLE32 */ {
         udata_write32(mem, fCount);
-        for (SResource *current = fFirst; current != NULL; current = current->fNext) {
+        for (SResource *current = fFirst; current != nullptr; current = current->fNext) {
             udata_write32(mem, (uint32_t)current->fKey);
         }
         *byteOffset += (1 + fCount)* 4;
@@ -850,7 +850,7 @@ SResource::handleWrite(UNewDataMemory * /*mem*/, uint32_t * /*byteOffset*/) {
 void SRBRoot::write(const char *outputDir, const char *outputPkg,
                     char *writtenFilename, int writtenFilenameLen,
                     UErrorCode &errorCode) {
-    UNewDataMemory *mem        = NULL;
+    UNewDataMemory *mem        = nullptr;
     uint32_t        byteOffset = 0;
     uint32_t        top, size;
     char            dataName[1024];
@@ -886,9 +886,9 @@ void SRBRoot::write(const char *outputDir, const char *outputPkg,
     if (gFormatVersion > 1) {
         stringSet = uhash_open(string_hash, string_comp, string_comp, &errorCode);
         if (U_SUCCESS(errorCode) &&
-                fUsePoolBundle != NULL && fUsePoolBundle->fStrings != NULL) {
+                fUsePoolBundle != nullptr && fUsePoolBundle->fStrings != nullptr) {
             for (SResource *current = fUsePoolBundle->fStrings->fFirst;
-                    current != NULL;
+                    current != nullptr;
                     current = current->fNext) {
                 StringResource *sr = static_cast<StringResource *>(current);
                 sr->fNumCopies = 0;
@@ -898,7 +898,7 @@ void SRBRoot::write(const char *outputDir, const char *outputPkg,
         }
         fRoot->preflightStrings(this, stringSet, errorCode);
     } else {
-        stringSet = NULL;
+        stringSet = nullptr;
     }
     if (fStringsForm == STRINGS_UTF16_V2 && f16BitStringsLength > 0) {
         compactStringsV2(stringSet, errorCode);
@@ -961,7 +961,7 @@ void SRBRoot::write(const char *outputDir, const char *outputPkg,
            writtenFilename[off] = U_FILE_SEP_CHAR;
            if (--writtenFilenameLen) {
                ++off;
-               if(outputPkg != NULL)
+               if(outputPkg != nullptr)
                {
                    uprv_strcpy(writtenFilename+off, outputPkg);
                    off += (int32_t)uprv_strlen(outputPkg);
@@ -996,7 +996,7 @@ void SRBRoot::write(const char *outputDir, const char *outputPkg,
     uprv_memcpy(dataInfo.formatVersion, gFormatVersions + formatVersion, sizeof(UVersionInfo));
 
     mem = udata_create(outputDir, "res", dataName,
-                       &dataInfo, (gIncludeCopyright==true)? U_COPYRIGHT_STRING:NULL, &errorCode);
+                       &dataInfo, (gIncludeCopyright==true)? U_COPYRIGHT_STRING:nullptr, &errorCode);
     if(U_FAILURE(errorCode)){
         return;
     }
@@ -1095,53 +1095,53 @@ void SRBRoot::write(const char *outputDir, const char *outputPkg,
 
 TableResource* table_open(struct SRBRoot *bundle, const char *tag, const struct UString* comment, UErrorCode *status) {
     LocalPointer<TableResource> res(new TableResource(bundle, tag, comment, *status), *status);
-    return U_SUCCESS(*status) ? res.orphan() : NULL;
+    return U_SUCCESS(*status) ? res.orphan() : nullptr;
 }
 
 ArrayResource* array_open(struct SRBRoot *bundle, const char *tag, const struct UString* comment, UErrorCode *status) {
     LocalPointer<ArrayResource> res(new ArrayResource(bundle, tag, comment, *status), *status);
-    return U_SUCCESS(*status) ? res.orphan() : NULL;
+    return U_SUCCESS(*status) ? res.orphan() : nullptr;
 }
 
 struct SResource *string_open(struct SRBRoot *bundle, const char *tag, const UChar *value, int32_t len, const struct UString* comment, UErrorCode *status) {
     LocalPointer<SResource> res(
             new StringResource(bundle, tag, value, len, comment, *status), *status);
-    return U_SUCCESS(*status) ? res.orphan() : NULL;
+    return U_SUCCESS(*status) ? res.orphan() : nullptr;
 }
 
 struct SResource *alias_open(struct SRBRoot *bundle, const char *tag, UChar *value, int32_t len, const struct UString* comment, UErrorCode *status) {
     LocalPointer<SResource> res(
             new AliasResource(bundle, tag, value, len, comment, *status), *status);
-    return U_SUCCESS(*status) ? res.orphan() : NULL;
+    return U_SUCCESS(*status) ? res.orphan() : nullptr;
 }
 
 IntVectorResource *intvector_open(struct SRBRoot *bundle, const char *tag, const struct UString* comment, UErrorCode *status) {
     LocalPointer<IntVectorResource> res(
             new IntVectorResource(bundle, tag, comment, *status), *status);
-    return U_SUCCESS(*status) ? res.orphan() : NULL;
+    return U_SUCCESS(*status) ? res.orphan() : nullptr;
 }
 
 struct SResource *int_open(struct SRBRoot *bundle, const char *tag, int32_t value, const struct UString* comment, UErrorCode *status) {
     LocalPointer<SResource> res(new IntResource(bundle, tag, value, comment, *status), *status);
-    return U_SUCCESS(*status) ? res.orphan() : NULL;
+    return U_SUCCESS(*status) ? res.orphan() : nullptr;
 }
 
 struct SResource *bin_open(struct SRBRoot *bundle, const char *tag, uint32_t length, uint8_t *data, const char* fileName, const struct UString* comment, UErrorCode *status) {
     LocalPointer<SResource> res(
             new BinaryResource(bundle, tag, length, data, fileName, comment, *status), *status);
-    return U_SUCCESS(*status) ? res.orphan() : NULL;
+    return U_SUCCESS(*status) ? res.orphan() : nullptr;
 }
 
 SRBRoot::SRBRoot(const UString *comment, UBool isPoolBundle, UErrorCode &errorCode)
-        : fRoot(NULL), fLocale(NULL), fIndexLength(0), fMaxTableLength(0), fNoFallback(false),
+        : fRoot(nullptr), fLocale(nullptr), fIndexLength(0), fMaxTableLength(0), fNoFallback(false),
           fStringsForm(STRINGS_UTF16_V1), fIsPoolBundle(isPoolBundle),
-          fKeys(NULL), fKeyMap(NULL),
+          fKeys(nullptr), fKeyMap(nullptr),
           fKeysBottom(0), fKeysTop(0), fKeysCapacity(0),
           fKeysCount(0), fLocalKeyLimit(0),
           f16BitUnits(), f16BitStringsLength(0),
           fUsePoolBundle(&kNoPoolBundle),
           fPoolStringIndexLimit(0), fPoolStringIndex16Limit(0), fLocalStringIndexLimit(0),
-          fWritePoolBundle(NULL) {
+          fWritePoolBundle(nullptr) {
     if (U_FAILURE(errorCode)) {
         return;
     }
@@ -1156,9 +1156,9 @@ SRBRoot::SRBRoot(const UString *comment, UBool isPoolBundle, UErrorCode &errorCo
     if (isPoolBundle) {
         fRoot = new PseudoListResource(this, errorCode);
     } else {
-        fRoot = new TableResource(this, NULL, comment, errorCode);
+        fRoot = new TableResource(this, nullptr, comment, errorCode);
     }
-    if (fKeys == NULL || fRoot == NULL || U_FAILURE(errorCode)) {
+    if (fKeys == nullptr || fRoot == nullptr || U_FAILURE(errorCode)) {
         if (U_SUCCESS(errorCode)) {
             errorCode = U_MEMORY_ALLOCATION_ERROR;
         }
@@ -1207,7 +1207,7 @@ void SRBRoot::setLocale(UChar *locale, UErrorCode &errorCode) {
 
     uprv_free(fLocale);
     fLocale = (char*) uprv_malloc(sizeof(char) * (u_strlen(locale)+1));
-    if(fLocale == NULL) {
+    if(fLocale == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -1227,7 +1227,7 @@ SRBRoot::getKeyString(int32_t key) const {
 const char *
 SResource::getKeyString(const SRBRoot *bundle) const {
     if (fKey == -1) {
-        return NULL;
+        return nullptr;
     }
     return bundle->getKeyString(fKey);
 }
@@ -1248,7 +1248,7 @@ SRBRoot::addKeyBytes(const char *keyBytes, int32_t length, UErrorCode &errorCode
     if (U_FAILURE(errorCode)) {
         return -1;
     }
-    if (length < 0 || (keyBytes == NULL && length != 0)) {
+    if (length < 0 || (keyBytes == nullptr && length != 0)) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return -1;
     }
@@ -1262,7 +1262,7 @@ SRBRoot::addKeyBytes(const char *keyBytes, int32_t length, UErrorCode &errorCode
         /* overflow - resize the keys buffer */
         fKeysCapacity += KEY_SPACE_SIZE;
         fKeys = static_cast<char *>(uprv_realloc(fKeys, fKeysCapacity));
-        if(fKeys == NULL) {
+        if(fKeys == nullptr) {
             errorCode = U_MEMORY_ALLOCATION_ERROR;
             return -1;
         }
@@ -1281,7 +1281,7 @@ SRBRoot::addTag(const char *tag, UErrorCode &errorCode) {
         return -1;
     }
 
-    if (tag == NULL) {
+    if (tag == nullptr) {
         /* no error: the root table and array items have no keys */
         return -1;
     }
@@ -1352,7 +1352,7 @@ void SResource::collectKeys(std::function<void(int32_t)> collector) const {
 
 void ContainerResource::collectKeys(std::function<void(int32_t)> collector) const {
     collector(fKey);
-    for (SResource* curr = fFirst; curr != NULL; curr = curr->fNext) {
+    for (SResource* curr = fFirst; curr != nullptr; curr = curr->fNext) {
         curr->collectKeys(collector);
     }
 }
@@ -1376,11 +1376,11 @@ SRBRoot::compactKeys(UErrorCode &errorCode) {
     }
 
     int32_t keysCount = fUsePoolBundle->fKeysCount + fKeysCount;
-    if (U_FAILURE(errorCode) || fKeyMap != NULL) {
+    if (U_FAILURE(errorCode) || fKeyMap != nullptr) {
         return;
     }
     map = (KeyMapEntry *)uprv_malloc(keysCount * sizeof(KeyMapEntry));
-    if (map == NULL) {
+    if (map == nullptr) {
         errorCode = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -1466,7 +1466,7 @@ SRBRoot::compactKeys(UErrorCode &errorCode) {
          * to squeeze out unused bytes, and readjust the newpos offsets.
          */
         uprv_sortArray(map, keysCount, (int32_t)sizeof(KeyMapEntry),
-                       compareKeyNewpos, NULL, false, &errorCode);
+                       compareKeyNewpos, nullptr, false, &errorCode);
         if (U_SUCCESS(errorCode)) {
             int32_t oldpos, newpos, limit;
             oldpos = newpos = fKeysBottom;
@@ -1491,11 +1491,11 @@ SRBRoot::compactKeys(UErrorCode &errorCode) {
             fKeysTop = newpos;
             /* Re-sort once more, by old offsets for binary searching. */
             uprv_sortArray(map, keysCount, (int32_t)sizeof(KeyMapEntry),
-                           compareKeyOldpos, NULL, false, &errorCode);
+                           compareKeyOldpos, nullptr, false, &errorCode);
             if (U_SUCCESS(errorCode)) {
                 /* key size reduction by limit - newpos */
                 fKeyMap = map;
-                map = NULL;
+                map = nullptr;
             }
         }
     }
@@ -1528,7 +1528,7 @@ compareStringLengths(const void * /*context*/, const void *l, const void *r) {
     const StringResource *right = *((const StringResource **)r);
     int32_t diff;
     /* Make "is suffix of another string" compare greater than a non-suffix. */
-    diff = (int)(left->fSame != NULL) - (int)(right->fSame != NULL);
+    diff = (int)(left->fSame != nullptr) - (int)(right->fSame != nullptr);
     if (diff != 0) {
         return diff;
     }
@@ -1591,7 +1591,7 @@ SRBRoot::compactStringsV2(UHashtable *stringSet, UErrorCode &errorCode) {
     }
     /* Sort the strings so that each one is immediately followed by all of its suffixes. */
     uprv_sortArray(array.getAlias(), count, (int32_t)sizeof(struct SResource **),
-                   compareStringSuffixes, NULL, false, &errorCode);
+                   compareStringSuffixes, nullptr, false, &errorCode);
     if (U_FAILURE(errorCode)) {
         return;
     }
@@ -1649,7 +1649,7 @@ SRBRoot::compactStringsV2(UHashtable *stringSet, UErrorCode &errorCode) {
      * Keep as many as possible within reach of 16-bit offsets.
      */
     uprv_sortArray(array.getAlias(), count, (int32_t)sizeof(struct SResource **),
-                   compareStringLengths, NULL, false, &errorCode);
+                   compareStringLengths, nullptr, false, &errorCode);
     if (U_FAILURE(errorCode)) {
         return;
     }
@@ -1691,7 +1691,7 @@ SRBRoot::compactStringsV2(UHashtable *stringSet, UErrorCode &errorCode) {
         assert(fPoolStringIndexLimit <= fUsePoolBundle->fStringIndexLimit);
         /* Write the non-suffix strings. */
         int32_t i;
-        for (i = 0; i < count && array[i]->fSame == NULL; ++i) {
+        for (i = 0; i < count && array[i]->fSame == nullptr; ++i) {
             StringResource *res = array[i];
             if (!res->fWritten) {
                 int32_t localStringIndex = f16BitUnits.length();
@@ -1705,14 +1705,14 @@ SRBRoot::compactStringsV2(UHashtable *stringSet, UErrorCode &errorCode) {
             errorCode = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
-        if (fWritePoolBundle != NULL && gFormatVersion >= 3) {
+        if (fWritePoolBundle != nullptr && gFormatVersion >= 3) {
             PseudoListResource *poolStrings =
                     static_cast<PseudoListResource *>(fWritePoolBundle->fRoot);
-            for (i = 0; i < count && array[i]->fSame == NULL; ++i) {
+            for (i = 0; i < count && array[i]->fSame == nullptr; ++i) {
                 assert(!array[i]->fString.isEmpty());
                 StringResource *poolString =
                         new StringResource(fWritePoolBundle, array[i]->fString, errorCode);
-                if (poolString == NULL) {
+                if (poolString == nullptr) {
                     errorCode = U_MEMORY_ALLOCATION_ERROR;
                     break;
                 }
index c9731880ea669e45cca4111157c13151cc3129a0..a7d1f5d3cbb6a6cbe215996b7bc238a2cb2aed77 100644 (file)
@@ -44,9 +44,9 @@ class ResKeyPath;
 
 struct ResFile {
     ResFile()
-            : fBytes(NULL), fIndexes(NULL),
-              fKeys(NULL), fKeysLength(0), fKeysCount(0),
-              fStrings(NULL), fStringIndexLimit(0),
+            : fBytes(nullptr), fIndexes(nullptr),
+              fKeys(nullptr), fKeysLength(0), fKeysCount(0),
+              fStrings(nullptr), fStringIndexLimit(0),
               fChecksum(0) {}
     ~ResFile() { close(); }
 
@@ -137,7 +137,7 @@ void bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char*
 /*
  * Return a unique pointer to a dummy object,
  * for use in non-error cases when no resource is to be added to the bundle.
- * (NULL is used in error cases.)
+ * (nullptr is used in error cases.)
  */
 struct SResource* res_none(void);
 
@@ -245,7 +245,7 @@ public:
     ContainerResource(SRBRoot *bundle, const char *tag, int8_t type,
                       const UString* comment, UErrorCode &errorCode)
             : SResource(bundle, tag, type, comment, errorCode),
-              fCount(0), fFirst(NULL) {}
+              fCount(0), fFirst(nullptr) {}
     virtual ~ContainerResource();
 
     void handlePreflightStrings(SRBRoot *bundle, UHashtable *stringSet, UErrorCode &errorCode) override;
@@ -289,7 +289,7 @@ public:
     ArrayResource(SRBRoot *bundle, const char *tag,
                   const UString* comment, UErrorCode &errorCode)
             : ContainerResource(bundle, tag, URES_ARRAY, comment, errorCode),
-              fLast(NULL) {}
+              fLast(nullptr) {}
     virtual ~ArrayResource();
 
     void add(SResource *res);
@@ -308,7 +308,7 @@ public:
 class PseudoListResource : public ContainerResource {
 public:
     PseudoListResource(SRBRoot *bundle, UErrorCode &errorCode)
-            : ContainerResource(bundle, NULL, URES_TABLE, NULL, errorCode) {}
+            : ContainerResource(bundle, nullptr, URES_TABLE, nullptr, errorCode) {}
     virtual ~PseudoListResource();
 
     void add(SResource *res);
@@ -341,17 +341,17 @@ public:
     StringResource(SRBRoot *bundle, const char *tag, const UChar *value, int32_t len,
                    const UString* comment, UErrorCode &errorCode)
             : StringBaseResource(bundle, tag, URES_STRING, value, len, comment, errorCode),
-              fSame(NULL), fSuffixOffset(0),
+              fSame(nullptr), fSuffixOffset(0),
               fNumCopies(0), fNumUnitsSaved(0), fNumCharsForLength(0) {}
     StringResource(SRBRoot *bundle, const icu::UnicodeString &value, UErrorCode &errorCode)
             : StringBaseResource(bundle, URES_STRING, value, errorCode),
-              fSame(NULL), fSuffixOffset(0),
+              fSame(nullptr), fSuffixOffset(0),
               fNumCopies(0), fNumUnitsSaved(0), fNumCharsForLength(0) {}
     StringResource(int32_t poolStringIndex, int8_t numCharsForLength,
                    const UChar *value, int32_t length,
                    UErrorCode &errorCode)
             : StringBaseResource(URES_STRING, value, length, errorCode),
-              fSame(NULL), fSuffixOffset(0),
+              fSame(nullptr), fSuffixOffset(0),
               fNumCopies(0), fNumUnitsSaved(0), fNumCharsForLength(numCharsForLength) {
         // v3 pool string encoded as string-v2 with low offset
         fRes = URES_MAKE_RESOURCE(URES_STRING_V2, poolStringIndex);
index bcab1136fbd9820ad5e3bf8437346b4a1d2e0e8a..d471a01931aca93bb600e7f45bb8530da67d2785 100644 (file)
@@ -84,12 +84,12 @@ static const char* javaClass1=  " extends ListResourceBundle {\n\n"
                                  "    static final Object[][] data = new Object[][] { \n";*/
 static int tabCount = 3;
 
-static FileStream* out=NULL;
+static FileStream* out=nullptr;
 static struct SRBRoot* srBundle ;
-/*static const char* outDir = NULL;*/
+/*static const char* outDir = nullptr;*/
 
-static const char* bName=NULL;
-static const char* pName=NULL;
+static const char* bName=nullptr;
+static const char* pName=nullptr;
 
 static void write_tabs(FileStream* os){
     int i=0;
@@ -101,7 +101,7 @@ static void write_tabs(FileStream* os){
 #define ZERO 0x30
 
 static const char* enc ="";
-static UConverter* conv = NULL;
+static UConverter* conv = nullptr;
 
 static int32_t
 uCharsToChars(char *target, int32_t targetLen, const UChar *source, int32_t sourceLen, UErrorCode *status) {
@@ -236,7 +236,7 @@ str_write_java(const UChar *src, int32_t srcLen, UBool printEndLine, UErrorCode
     uint32_t columnCount;
     char* buf = (char*) malloc(sizeof(char)*length);
 
-    if(buf == NULL) {
+    if(buf == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
@@ -332,7 +332,7 @@ array_write_java(const ArrayResource *res, UErrorCode *status) {
 
     uint32_t  i         = 0;
     const char* arr ="new String[] { \n";
-    struct SResource *current = NULL;
+    struct SResource *current = nullptr;
     UBool allStrings    = true;
 
     if (U_FAILURE(*status)) {
@@ -343,7 +343,7 @@ array_write_java(const ArrayResource *res, UErrorCode *status) {
 
         current = res->fFirst;
         i = 0;
-        while(current != NULL){
+        while(current != nullptr){
             if(!current->isString()){
                 allStrings = false;
                 break;
@@ -362,7 +362,7 @@ array_write_java(const ArrayResource *res, UErrorCode *status) {
             T_FileStream_write(out, arr, (int32_t)uprv_strlen(arr));
             tabCount++;
         }
-        while (current != NULL) {
+        while (current != nullptr) {
             /*if(current->isString()){
                 write_tabs(out);
             }*/
@@ -399,7 +399,7 @@ intvector_write_java(const IntVectorResource *res, UErrorCode * /*status*/) {
     buf[0]=0;
     write_tabs(out);
 
-    if(resname != NULL && uprv_strcmp(resname,"DateTimeElements")==0){
+    if(resname != nullptr && uprv_strcmp(resname,"DateTimeElements")==0){
         T_FileStream_write(out, stringArr, (int32_t)uprv_strlen(stringArr));
         tabCount++;
         for(i = 0; i<res->fCount; i++) {
@@ -449,7 +449,7 @@ bytes_write_java(const BinaryResource *res, UErrorCode * /*status*/) {
        const char* type  = "new byte[] {";
        const char* byteDecl = "%i, ";
     char byteBuffer[100] = { 0 };
-       uint8_t*  byteArray = NULL;
+       uint8_t*  byteArray = nullptr;
     int byteIterator = 0;
     int32_t srcLen=res->fLength;
     if(srcLen>0 )
@@ -511,7 +511,7 @@ static UBool start = true;
 static void
 table_write_java(const TableResource *res, UErrorCode *status) {
     uint32_t  i         = 0;
-    struct SResource *current = NULL;
+    struct SResource *current = nullptr;
     const char* obj = "new Object[][]{\n";
 
     if (U_FAILURE(*status)) {
@@ -529,7 +529,7 @@ table_write_java(const TableResource *res, UErrorCode *status) {
         i       = 0;
 
 
-        while (current != NULL) {
+        while (current != nullptr) {
             const char *currentKeyString = current->getKeyString(srBundle);
 
             assert(i < res->fCount);
@@ -541,7 +541,7 @@ table_write_java(const TableResource *res, UErrorCode *status) {
             tabCount++;
 
             write_tabs(out);
-            if(currentKeyString != NULL) {
+            if(currentKeyString != nullptr) {
                 T_FileStream_write(out, "\"", 1);
                 T_FileStream_write(out, currentKeyString,
                                    (int32_t)uprv_strlen(currentKeyString));
@@ -583,7 +583,7 @@ res_write_java(struct SResource *res,UErrorCode *status) {
         return ;
     }
 
-    if (res != NULL) {
+    if (res != nullptr) {
         switch (res->fType) {
         case URES_STRING:
              string_write_java    (static_cast<const StringResource *>(res), status);
@@ -629,8 +629,8 @@ bundle_write_java(struct SRBRoot *bundle, const char *outputDir,const char* outp
 
     start = true;                        /* Reset the start indicator*/
 
-    bName = (bundleName==NULL) ? "LocaleElements" : bundleName;
-    pName = (packageName==NULL)? "com.ibm.icu.impl.data" : packageName;
+    bName = (bundleName==nullptr) ? "LocaleElements" : bundleName;
+    pName = (packageName==nullptr)? "com.ibm.icu.impl.data" : packageName;
 
     uprv_strcpy(className, bName);
     srBundle = bundle;
@@ -660,7 +660,7 @@ bundle_write_java(struct SRBRoot *bundle, const char *outputDir,const char* outp
 
     out= T_FileStream_open(fileName,"w");
 
-    if(out==NULL){
+    if(out==nullptr){
         *status = U_FILE_ACCESS_ERROR;
         return;
     }
index 069f091656775a360abd6b0305e3087c87b1d92a..2eebddd992c552159c8dd1022fd4d99bf7ad086a 100644 (file)
@@ -53,11 +53,11 @@ U_NAMESPACE_USE
 
 static int tabCount = 0;
 
-static FileStream* out=NULL;
+static FileStream* out=nullptr;
 static struct SRBRoot* srBundle ;
-static const char* outDir = NULL;
+static const char* outDir = nullptr;
 static const char* enc ="";
-static UConverter* conv = NULL;
+static UConverter* conv = nullptr;
 
 const char* const* ISOLanguages;
 const char* const* ISOCountries;
@@ -70,7 +70,7 @@ static int32_t write_utf8_file(FileStream* fileStream, UnicodeString outString)
     int32_t len = 0;
 
     // preflight to get the destination buffer size
-    u_strToUTF8(NULL,
+    u_strToUTF8(nullptr,
                 0,
                 &len,
                 toUCharPtr(outString.getBuffer()),
@@ -105,7 +105,7 @@ static void write_tabs(FileStream* os){
 
 /*get ID for each element. ID is globally unique.*/
 static char* getID(const char* id, const char* curKey, char* result) {
-    if(curKey == NULL) {
+    if(curKey == nullptr) {
         result = (char *)uprv_malloc(sizeof(char)*uprv_strlen(id) + 1);
         uprv_memset(result, 0, sizeof(char)*uprv_strlen(id) + 1);
         uprv_strcpy(result, id);
@@ -190,13 +190,13 @@ static char* parseFilename(const char* id, char* /*lang*/) {
     char* localeID = (char*) uprv_malloc(idLen);
     int pos = 0;
     int canonCapacity = 0;
-    char* canon = NULL;
+    char* canon = nullptr;
     int canonLen = 0;
     /*int i;*/
     UErrorCode status = U_ZERO_ERROR;
     const char *ext = uprv_strchr(id, '.');
 
-    if(ext != NULL){
+    if(ext != nullptr){
         pos = (int) (ext - id);
     } else {
         pos = idLen;
@@ -235,21 +235,21 @@ void res_write_xml(struct SResource *res, const char* id, const char* language,
 static char* convertAndEscape(char** pDest, int32_t destCap, int32_t* destLength,
                               const UChar* src, int32_t srcLen, UErrorCode* status){
     int32_t srcIndex=0;
-    char* dest=NULL;
-    char* temp=NULL;
+    char* dest=nullptr;
+    char* temp=nullptr;
     int32_t destLen=0;
     UChar32 c = 0;
 
-    if(status==NULL || U_FAILURE(*status) || pDest==NULL  || srcLen==0 || src == NULL){
-        return NULL;
+    if(status==nullptr || U_FAILURE(*status) || pDest==nullptr  || srcLen==0 || src == nullptr){
+        return nullptr;
     }
     dest =*pDest;
-    if(dest==NULL || destCap <=0){
+    if(dest==nullptr || destCap <=0){
         destCap = srcLen * 8;
         dest = (char*) uprv_malloc(sizeof(char) * destCap);
-        if(dest==NULL){
+        if(dest==nullptr){
             *status=U_MEMORY_ALLOCATION_ERROR;
-            return NULL;
+            return nullptr;
         }
     }
 
@@ -262,7 +262,7 @@ static char* convertAndEscape(char** pDest, int32_t destCap, int32_t* destLength
             *status = U_ILLEGAL_CHAR_FOUND;
             fprintf(stderr, "Illegal Surrogate! \n");
             uprv_free(dest);
-            return NULL;
+            return nullptr;
         }
 
         if((destLen+U8_LENGTH(c)) < destCap){
@@ -327,7 +327,7 @@ static char* convertAndEscape(char** pDest, int32_t destCap, int32_t* destLength
                     *status = U_ILLEGAL_CHAR_FOUND;
                     fprintf(stderr, "Illegal Character \\u%04X!\n",(int)c);
                     uprv_free(dest);
-                    return NULL;
+                    return nullptr;
                 default:
                     dest[destLen++]=(char)c;
                 }
@@ -338,23 +338,23 @@ static char* convertAndEscape(char** pDest, int32_t destCap, int32_t* destLength
                     *status = U_ILLEGAL_CHAR_FOUND;
                     fprintf(stderr, "Illegal Character \\U%08X!\n",(int)c);
                     uprv_free(dest);
-                    return NULL;
+                    return nullptr;
                 }
             }
         }else{
             destCap += destLen;
 
             temp = (char*) uprv_malloc(sizeof(char)*destCap);
-            if(temp==NULL){
+            if(temp==nullptr){
                 *status=U_MEMORY_ALLOCATION_ERROR;
                 uprv_free(dest);
-                return NULL;
+                return nullptr;
             }
             uprv_memmove(temp,dest,destLen);
             destLen=0;
             uprv_free(dest);
             dest=temp;
-            temp=NULL;
+            temp=nullptr;
         }
 
     }
@@ -372,9 +372,9 @@ static char* convertAndEscape(char** pDest, int32_t destCap, int32_t* destLength
 static void
 trim(char **src, int32_t *len){
 
-    char *s = NULL;
+    char *s = nullptr;
     int32_t i = 0;
-    if(src == NULL || *src == NULL){
+    if(src == nullptr || *src == nullptr){
         return;
     }
     s = *src;
@@ -399,7 +399,7 @@ trim(char **src, int32_t *len){
 static void
 print(UChar* src, int32_t srcLen,const char *tagStart,const char *tagEnd,  UErrorCode *status){
     int32_t bufCapacity   = srcLen*4;
-    char *buf       = NULL;
+    char *buf       = nullptr;
     int32_t bufLen = 0;
 
     if(U_FAILURE(*status)){
@@ -429,11 +429,11 @@ printNoteElements(const UString *src, UErrorCode *status){
 #if UCONFIG_NO_REGULAR_EXPRESSIONS==0 /* donot compile when no RegularExpressions are available */
 
     int32_t capacity = 0;
-    UChar* note = NULL;
+    UChar* note = nullptr;
     int32_t noteLen = 0;
     int32_t count = 0,i;
 
-    if(src == NULL){
+    if(src == nullptr){
         return;
     }
 
@@ -490,18 +490,18 @@ printComments(struct UString *src, const char *resName, UBool printTranslate, UE
 
 #if UCONFIG_NO_REGULAR_EXPRESSIONS==0 /* donot compile when no RegularExpressions are available */
 
-    if(status==NULL || U_FAILURE(*status)){
+    if(status==nullptr || U_FAILURE(*status)){
         return;
     }
 
     int32_t capacity = src->fLength + 1;
-    char* buf = NULL;
+    char* buf = nullptr;
     int32_t bufLen = 0;
     UChar* desc  = (UChar*) uprv_malloc(U_SIZEOF_UCHAR * capacity);
     UChar* trans = (UChar*) uprv_malloc(U_SIZEOF_UCHAR * capacity);
 
     int32_t descLen = 0, transLen=0;
-    if(desc==NULL || trans==NULL){
+    if(desc==nullptr || trans==nullptr){
         *status = U_MEMORY_ALLOCATION_ERROR;
         uprv_free(desc);
         uprv_free(trans);
@@ -553,31 +553,31 @@ printComments(struct UString *src, const char *resName, UBool printTranslate, UE
  */
 static char *printContainer(SResource *res, const char *container, const char *restype, const char *mimetype, const char *id, UErrorCode *status)
 {
-    const char *resname = NULL;
-    char *sid = NULL;
+    const char *resname = nullptr;
+    char *sid = nullptr;
 
     write_tabs(out);
 
     resname = res->getKeyString(srBundle);
-    if (resname != NULL && *resname != 0) {
+    if (resname != nullptr && *resname != 0) {
         sid = getID(id, resname, sid);
     } else {
-        sid = getID(id, NULL, sid);
+        sid = getID(id, nullptr, sid);
     }
 
     write_utf8_file(out, UnicodeString("<"));
     write_utf8_file(out, UnicodeString(container));
     printAttribute("id", sid, (int32_t) uprv_strlen(sid));
 
-    if (resname != NULL) {
+    if (resname != nullptr) {
         printAttribute("resname", resname, (int32_t) uprv_strlen(resname));
     }
 
-    if (mimetype != NULL) {
+    if (mimetype != nullptr) {
         printAttribute("mime-type", mimetype, (int32_t) uprv_strlen(mimetype));
     }
 
-    if (restype != NULL) {
+    if (restype != nullptr) {
         printAttribute("restype", restype, (int32_t) uprv_strlen(restype));
     }
 
@@ -622,15 +622,15 @@ static const char *table_restype     = "x-icu-table";
 static void
 string_write_xml(StringResource *res, const char* id, const char* /*language*/, UErrorCode *status) {
 
-    char *sid = NULL;
-    char* buf = NULL;
+    char *sid = nullptr;
+    char* buf = nullptr;
     int32_t bufLen = 0;
 
-    if(status==NULL || U_FAILURE(*status)){
+    if(status==nullptr || U_FAILURE(*status)){
         return;
     }
 
-    sid = printContainer(res, trans_unit, NULL, NULL, id, status);
+    sid = printContainer(res, trans_unit, nullptr, nullptr, id, status);
 
     write_tabs(out);
 
@@ -658,11 +658,11 @@ string_write_xml(StringResource *res, const char* id, const char* /*language*/,
 
 static void
 alias_write_xml(AliasResource *res, const char* id, const char* /*language*/, UErrorCode *status) {
-    char *sid = NULL;
-    char* buf = NULL;
+    char *sid = nullptr;
+    char* buf = nullptr;
     int32_t bufLen=0;
 
-    sid = printContainer(res, trans_unit, alias_restype, NULL, id, status);
+    sid = printContainer(res, trans_unit, alias_restype, nullptr, id, status);
 
     write_tabs(out);
 
@@ -689,18 +689,18 @@ alias_write_xml(AliasResource *res, const char* id, const char* /*language*/, UE
 
 static void
 array_write_xml(ArrayResource *res, const char* id, const char* language, UErrorCode *status) {
-    char* sid = NULL;
+    char* sid = nullptr;
     int index = 0;
 
-    struct SResource *current = NULL;
+    struct SResource *current = nullptr;
 
-    sid = printContainer(res, group, array_restype, NULL, id, status);
+    sid = printContainer(res, group, array_restype, nullptr, id, status);
 
     current = res->fFirst;
 
-    while (current != NULL) {
+    while (current != nullptr) {
         char c[256] = {0};
-        char* subId = NULL;
+        char* subId = nullptr;
 
         itostr(c, index, 10, 0);
         index += 1;
@@ -708,7 +708,7 @@ array_write_xml(ArrayResource *res, const char* id, const char* language, UError
 
         res_write_xml(current, subId, language, false, status);
         uprv_free(subId);
-        subId = NULL;
+        subId = nullptr;
 
         if(U_FAILURE(*status)){
             return;
@@ -726,13 +726,13 @@ array_write_xml(ArrayResource *res, const char* id, const char* language, UError
 
 static void
 intvector_write_xml(IntVectorResource *res, const char* id, const char* /*language*/, UErrorCode *status) {
-    char* sid = NULL;
-    char* ivd = NULL;
+    char* sid = nullptr;
+    char* ivd = nullptr;
     uint32_t i=0;
     uint32_t len=0;
     char buf[256] = {'0'};
 
-    sid = printContainer(res, group, intvector_restype, NULL, id, status);
+    sid = printContainer(res, group, intvector_restype, nullptr, id, status);
 
     for(i = 0; i < res->fCount; i += 1) {
         char c[256] = {0};
@@ -762,7 +762,7 @@ intvector_write_xml(IntVectorResource *res, const char* id, const char* /*langua
         write_utf8_file(out, UnicodeString(close_trans_unit));
 
         uprv_free(ivd);
-        ivd = NULL;
+        ivd = nullptr;
     }
 
     tabCount -= 1;
@@ -770,16 +770,16 @@ intvector_write_xml(IntVectorResource *res, const char* id, const char* /*langua
 
     write_utf8_file(out, UnicodeString(close_group));
     uprv_free(sid);
-    sid = NULL;
+    sid = nullptr;
 }
 
 static void
 int_write_xml(IntResource *res, const char* id, const char* /*language*/, UErrorCode *status) {
-    char* sid = NULL;
+    char* sid = nullptr;
     char buf[256] = {0};
     uint32_t len = 0;
 
-    sid = printContainer(res, trans_unit, integer_restype, NULL, id, status);
+    sid = printContainer(res, trans_unit, integer_restype, nullptr, id, status);
 
     write_tabs(out);
 
@@ -798,31 +798,31 @@ int_write_xml(IntResource *res, const char* id, const char* /*language*/, UError
     write_utf8_file(out, UnicodeString(close_trans_unit));
 
     uprv_free(sid);
-    sid = NULL;
+    sid = nullptr;
 }
 
 static void
 bin_write_xml(BinaryResource *res, const char* id, const char* /*language*/, UErrorCode *status) {
     const char* m_type = application_mimetype;
-    char* sid = NULL;
+    char* sid = nullptr;
     uint32_t crc = 0xFFFFFFFF;
 
     char fileName[1024] ={0};
-    int32_t tLen = ( outDir == NULL) ? 0 :(int32_t)uprv_strlen(outDir);
+    int32_t tLen = ( outDir == nullptr) ? 0 :(int32_t)uprv_strlen(outDir);
     char* fn =  (char*) uprv_malloc(sizeof(char) * (tLen+1024 +
-                                                    (res->fFileName !=NULL ?
+                                                    (res->fFileName !=nullptr ?
                                                     uprv_strlen(res->fFileName) :0)));
-    const char* ext = NULL;
+    const char* ext = nullptr;
 
-    char* f = NULL;
+    char* f = nullptr;
 
     fn[0]=0;
 
-    if(res->fFileName != NULL){
+    if(res->fFileName != nullptr){
         uprv_strcpy(fileName, res->fFileName);
         f = uprv_strrchr(fileName, '\\');
 
-        if (f != NULL) {
+        if (f != nullptr) {
             f++;
         } else {
             f = fileName;
@@ -830,7 +830,7 @@ bin_write_xml(BinaryResource *res, const char* id, const char* /*language*/, UEr
 
         ext = uprv_strrchr(fileName, '.');
 
-        if (ext == NULL) {
+        if (ext == nullptr) {
             fprintf(stderr, "Error: %s is an unknown binary filename type.\n", fileName);
             exit(U_ILLEGAL_ARGUMENT_ERROR);
         }
@@ -913,7 +913,7 @@ bin_write_xml(BinaryResource *res, const char* id, const char* /*language*/, UEr
         write_utf8_file(out, UnicodeString(close_bin_unit));
 
         uprv_free(sid);
-        sid = NULL;
+        sid = nullptr;
     }
 
     uprv_free(fn);
@@ -924,14 +924,14 @@ bin_write_xml(BinaryResource *res, const char* id, const char* /*language*/, UEr
 static void
 table_write_xml(TableResource *res, const char* id, const char* language, UBool isTopLevel, UErrorCode *status) {
 
-    struct SResource *current = NULL;
-    char* sid = NULL;
+    struct SResource *current = nullptr;
+    char* sid = nullptr;
 
     if (U_FAILURE(*status)) {
         return ;
     }
 
-    sid = printContainer(res, group, table_restype, NULL, id, status);
+    sid = printContainer(res, group, table_restype, nullptr, id, status);
 
     if(isTopLevel) {
         sid[0] = '\0';
@@ -939,7 +939,7 @@ table_write_xml(TableResource *res, const char* id, const char* language, UBool
 
     current = res->fFirst;
 
-    while (current != NULL) {
+    while (current != nullptr) {
         res_write_xml(current, sid, language, false, status);
 
         if(U_FAILURE(*status)){
@@ -955,7 +955,7 @@ table_write_xml(TableResource *res, const char* id, const char* language, UBool
     write_utf8_file(out, UnicodeString(close_group));
 
     uprv_free(sid);
-    sid = NULL;
+    sid = nullptr;
 }
 
 void
@@ -965,7 +965,7 @@ res_write_xml(struct SResource *res, const char* id,  const char* language, UBoo
         return ;
     }
 
-    if (res != NULL) {
+    if (res != nullptr) {
         switch (res->fType) {
         case URES_STRING:
              string_write_xml    (static_cast<StringResource *>(res), id, language, status);
@@ -1008,9 +1008,9 @@ bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char* outpu
                   char *writtenFilename, int writtenFilenameLen,
                   const char* language, const char* outFileName, UErrorCode *status) {
 
-    char* xmlfileName = NULL;
-    char* outputFileName = NULL;
-    char* originalFileName = NULL;
+    char* xmlfileName = nullptr;
+    char* outputFileName = nullptr;
+    char* originalFileName = nullptr;
     const char* fileStart = "<file xml:space = \"preserve\" source-language = \"";
     const char* file1 = "\" datatype = \"x-icu-resource-bundle\" ";
     const char* file2 = "original = \"";
@@ -1025,9 +1025,9 @@ bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char* outpu
     const char *tool_id = "genrb-" GENRB_VERSION "-icu-" U_ICU_VERSION;
     const char *tool_name = "genrb";
 
-    char* temp = NULL;
-    char* lang = NULL;
-    const char* pos = NULL;
+    char* temp = nullptr;
+    char* lang = nullptr;
+    const char* pos = nullptr;
     int32_t first, index;
     time_t currTime;
     char timeBuf[128];
@@ -1037,7 +1037,7 @@ bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char* outpu
     srBundle = bundle;
 
     pos = uprv_strrchr(filename, '\\');
-    if(pos != NULL) {
+    if(pos != nullptr) {
         first = (int32_t)(pos - filename + 1);
     } else {
         first = 0;
@@ -1057,12 +1057,12 @@ bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char* outpu
     uprv_strcat(originalFileName, temp);
     uprv_strcat(originalFileName, textExt);
     uprv_free(temp);
-    temp = NULL;
+    temp = nullptr;
 
 
-    if (language == NULL) {
+    if (language == nullptr) {
 /*        lang = parseFilename(filename, lang);
-        if (lang == NULL) {*/
+        if (lang == nullptr) {*/
             /* now check if locale name is valid or not
              * this is to cater for situation where
              * pegasusServer.txt contains
@@ -1082,7 +1082,7 @@ bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char* outpu
               *     ....
               * }
               */
-             if(lang==NULL){
+             if(lang==nullptr){
                  fprintf(stderr, "Error: The file name and table name do not contain a valid language code. Please use -l option to specify it.\n");
                  exit(U_ILLEGAL_ARGUMENT_ERROR);
              }
@@ -1130,7 +1130,7 @@ bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char* outpu
 
     out= T_FileStream_open(xmlfileName,"w");
 
-    if(out==NULL){
+    if(out==nullptr){
         *status = U_FILE_ACCESS_ERROR;
         goto cleanup_bundle_write_xml;
     }
@@ -1148,7 +1148,7 @@ bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char* outpu
     write_tabs(out);
     write_utf8_file(out, UnicodeString(fileStart));
     /* check if lang and language are the same */
-    if(language != NULL && uprv_strcmp(lang, srBundle->fLocale)!=0){
+    if(language != nullptr && uprv_strcmp(lang, srBundle->fLocale)!=0){
         fprintf(stderr,"Warning: The top level tag in the resource and language specified are not the same. Please check the input.\n");
     }
     write_utf8_file(out, UnicodeString(lang));
@@ -1204,10 +1204,10 @@ bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char* outpu
 cleanup_bundle_write_xml:
     uprv_free(originalFileName);
     uprv_free(lang);
-    if(xmlfileName != NULL) {
+    if(xmlfileName != nullptr) {
         uprv_free(xmlfileName);
     }
-    if(outputFileName != NULL){
+    if(outputFileName != nullptr){
         uprv_free(outputFileName);
     }
 }
index cafdfb8847c9355afd761027deddb884c3b772f5..283003e5fdd17414977542ae79d0c03fb26a60c8 100644 (file)
@@ -547,14 +547,14 @@ void computeDecompositions(const char* basename,
     const Normalizer2* mainNormalizer;
     const Normalizer2* nfdNormalizer = Normalizer2::getNFDInstance(status);
     const Normalizer2* nfcNormalizer = Normalizer2::getNFCInstance(status);
-    FILE* f = NULL;
+    FILE* f = nullptr;
     std::vector<uint32_t> nonRecursive32;
     LocalUMutableCPTriePointer nonRecursiveBuilder(umutablecptrie_open(0, 0, status));
 
     if (uprv_strcmp(basename, "nfkd") == 0) {
         mainNormalizer = Normalizer2::getNFKDInstance(status);
     } else if (uprv_strcmp(basename, "uts46d") == 0) {
-        mainNormalizer = Normalizer2::getInstance(NULL, "uts46", UNORM2_COMPOSE, status);
+        mainNormalizer = Normalizer2::getInstance(nullptr, "uts46", UNORM2_COMPOSE, status);
     } else {
         mainNormalizer = nfdNormalizer;
         f = prepareOutputFile("decompositionex");
@@ -1019,13 +1019,13 @@ int exportUprops(int argc, char* argv[]) {
             }
             UProperty uprop = static_cast<UProperty>(i);
             const char* propName = u_getPropertyName(uprop, U_SHORT_PROPERTY_NAME);
-            if (propName == NULL) {
+            if (propName == nullptr) {
                 propName = u_getPropertyName(uprop, U_LONG_PROPERTY_NAME);
-                if (propName != NULL && VERBOSE) {
+                if (propName != nullptr && VERBOSE) {
                     std::cerr << "Note: falling back to long name for: " << propName << std::endl;
                 }
             }
-            if (propName != NULL) {
+            if (propName != nullptr) {
                 propNames.push_back(propName);
             } else {
                 std::cerr << "Warning: Could not find name for: " << uprop << std::endl;
@@ -1149,7 +1149,7 @@ int exportCase(int argc, char* argv[]) {
     const UTrie2* caseTrie = &caseProps->trie;
 
     AddRangeHelper helper = { builder.getAlias() };
-    utrie2_enum(caseTrie, NULL, addRangeToUCPTrie, &helper);
+    utrie2_enum(caseTrie, nullptr, addRangeToUCPTrie, &helper);
 
     UCPTrieValueWidth width = UCPTRIE_VALUE_BITS_16;
     LocalUCPTriePointer utrie(umutablecptrie_buildImmutable(
index a3c1f5513d869f4c7c7e051d407fa2b90d65d84b..39dc6ab890dc486849549250163b569e8377c611 100644 (file)
@@ -168,26 +168,26 @@ void cmd_listplugins() {
     printf(    " >>>   Error          | Explanation \n");
     printf(    "-----------------------------------\n");
         
-    for(i=0;(plug=uplug_getPlugInternal(i))!=NULL;i++) {
+    for(i=0;(plug=uplug_getPlugInternal(i))!=nullptr;i++) {
         UErrorCode libStatus = U_ZERO_ERROR;
         const char *name = uplug_getPlugName(plug);
         const char *sym = uplug_getSymbolName(plug);
         const char *lib = uplug_getLibraryName(plug, &libStatus);
         const char *config = uplug_getConfiguration(plug);
         UErrorCode loadStatus = uplug_getPlugLoadStatus(plug);
-        const char *message = NULL;
+        const char *message = nullptr;
         
         printf("\n#%d  %-6s %s \n",
             i+1,
             udbg_enumName(UDBG_UPlugLevel,(int32_t)uplug_getPlugLevel(plug)),
-            name!=NULL?(*name?name:"this plugin did not call uplug_setPlugName()"):"(null)"
+            name!=nullptr?(*name?name:"this plugin did not call uplug_setPlugName()"):"(null)"
         );
         printf("    plugin| %10s:%-10s\n",
-            (U_SUCCESS(libStatus)?(lib!=NULL?lib:"(null)"):u_errorName(libStatus)),
-            sym!=NULL?sym:"(null)"
+            (U_SUCCESS(libStatus)?(lib!=nullptr?lib:"(null)"):u_errorName(libStatus)),
+            sym!=nullptr?sym:"(null)"
         );
         
-        if(config!=NULL&&*config) {
+        if(config!=nullptr&&*config) {
             printf("    config| %s\n", config);
         }
         
@@ -205,7 +205,7 @@ void cmd_listplugins() {
                 break;
                 
             case U_ZERO_ERROR: 
-                message = NULL; /* no message */
+                message = nullptr; /* no message */
                 break;
             default:
                 if(U_FAILURE(loadStatus)) {
@@ -215,7 +215,7 @@ void cmd_listplugins() {
                 }            
         }
         
-        if(message!=NULL) {
+        if(message!=nullptr) {
             printf("\\\\\\ status| %s\n"
                    "/// %s\n", u_errorName(loadStatus), message);
         }
@@ -281,7 +281,7 @@ main(int argc, char* argv[]) {
 
     if(options[7].doesOccur) {  /* 2nd part of version: cleanup */
       FILE *out = fopen(options[7].value, "w");
-      if(out==NULL) {
+      if(out==nullptr) {
         fprintf(stderr,"ERR: can't write to XML file %s\n", options[7].value);
         return 1;
       }
index a12e956d1996eb5417a9c6d83e09ed103dfd7d5a..392ed5889912709364609278547a6deedd21da23 100644 (file)
@@ -283,7 +283,7 @@ main(int argc, char *argv[]) {
     }
 
     pkg=new Package;
-    if(pkg==NULL) {
+    if(pkg==nullptr) {
         fprintf(stderr, "icupkg: not enough memory\n");
         return U_MEMORY_ALLOCATION_ERROR;
     }
@@ -312,13 +312,13 @@ main(int argc, char *argv[]) {
         sourcePath=options[OPT_SOURCEDIR].value;
     } else {
         // work relative to the current working directory
-        sourcePath=NULL;
+        sourcePath=nullptr;
     }
     if(options[OPT_DESTDIR].doesOccur) {
         destPath=options[OPT_DESTDIR].value;
     } else {
         // work relative to the current working directory
-        destPath=NULL;
+        destPath=nullptr;
     }
 
     if(0==strcmp(argv[1], "new")) {
@@ -327,7 +327,7 @@ main(int argc, char *argv[]) {
             printUsage(pname, false);
             return U_ILLEGAL_ARGUMENT_ERROR;
         }
-        inFilename=NULL;
+        inFilename=nullptr;
         isPackage=true;
     } else {
         inFilename=argv[1];
@@ -347,7 +347,7 @@ main(int argc, char *argv[]) {
             isModified=true;
         }
     } else if(isPackage) {
-        outFilename=NULL;
+        outFilename=nullptr;
     } else /* !isPackage */ {
         outFilename=inFilename;
         isModified=(UBool)(sourcePath!=destPath);
@@ -420,7 +420,7 @@ main(int argc, char *argv[]) {
     } else if(options[OPT_COPYRIGHT].doesOccur) {
         outComment=U_COPYRIGHT_STRING;
     } else {
-        outComment=NULL;
+        outComment=nullptr;
     }
 
     if(options[OPT_MATCHMODE].doesOccur) {
@@ -435,11 +435,11 @@ main(int argc, char *argv[]) {
     /* remove items */
     if(options[OPT_REMOVE_LIST].doesOccur) {
         listPkg=new Package();
-        if(listPkg==NULL) {
+        if(listPkg==nullptr) {
             fprintf(stderr, "icupkg: not enough memory\n");
             exit(U_MEMORY_ALLOCATION_ERROR);
         }
-        if(readList(NULL, options[OPT_REMOVE_LIST].value, false, listPkg)) {
+        if(readList(nullptr, options[OPT_REMOVE_LIST].value, false, listPkg)) {
             pkg->removeItems(*listPkg);
             delete listPkg;
             isModified=true;
@@ -454,10 +454,10 @@ main(int argc, char *argv[]) {
      * use a separate Package so that its memory and items stay around
      * as long as the main Package
      */
-    addListPkg=NULL;
+    addListPkg=nullptr;
     if(options[OPT_ADD_LIST].doesOccur) {
         addListPkg=new Package();
-        if(addListPkg==NULL) {
+        if(addListPkg==nullptr) {
             fprintf(stderr, "icupkg: not enough memory\n");
             exit(U_MEMORY_ALLOCATION_ERROR);
         }
@@ -474,11 +474,11 @@ main(int argc, char *argv[]) {
     /* extract items */
     if(options[OPT_EXTRACT_LIST].doesOccur) {
         listPkg=new Package();
-        if(listPkg==NULL) {
+        if(listPkg==nullptr) {
             fprintf(stderr, "icupkg: not enough memory\n");
             exit(U_MEMORY_ALLOCATION_ERROR);
         }
-        if(readList(NULL, options[OPT_EXTRACT_LIST].value, false, listPkg)) {
+        if(readList(nullptr, options[OPT_EXTRACT_LIST].value, false, listPkg)) {
             pkg->extractItems(destPath, *listPkg, outType);
             delete listPkg;
         } else {
@@ -493,7 +493,7 @@ main(int argc, char *argv[]) {
         if (options[OPT_LIST_FILE].doesOccur) {
             FileStream *out;
             out = T_FileStream_open(options[OPT_LIST_FILE].value, "w");
-            if (out != NULL) {
+            if (out != nullptr) {
                 for(i=0; i<pkg->getItemCount(); ++i) {
                     T_FileStream_writeLine(out, pkg->getItem(i)->name);
                     T_FileStream_writeLine(out, "\n");
@@ -519,8 +519,8 @@ main(int argc, char *argv[]) {
     if(isModified) {
         char outFilenameBuffer[1024]; // for auto-generated output filename, if necessary
 
-        if(outFilename==NULL || outFilename[0]==0) {
-            if(inFilename==NULL || inFilename[0]==0) {
+        if(outFilename==nullptr || outFilename[0]==0) {
+            if(inFilename==nullptr || inFilename[0]==0) {
                 fprintf(stderr, "icupkg: unable to auto-generate an output filename if there is no input filename\n");
                 exit(U_ILLEGAL_ARGUMENT_ERROR);
             }
@@ -545,7 +545,7 @@ main(int argc, char *argv[]) {
         if(options[OPT_TOC_PREFIX].doesOccur) {
             pkg->setPrefix(options[OPT_TOC_PREFIX].value);
         }
-        result = writePackageDatFile(outFilename, outComment, NULL, NULL, pkg, outType);
+        result = writePackageDatFile(outFilename, outComment, nullptr, nullptr, pkg, outType);
     }
 
     delete addListPkg;
index 92c2d603d248af422c4a9c3c2e26f32fcf81a2db..db1eafc02527ce6c37207ef94be43beb76ff3a9d 100644 (file)
@@ -122,10 +122,10 @@ main(int argc, char *argv[]) {
 
     /* get the program basename */
     pname=strrchr(argv[0], U_FILE_SEP_CHAR);
-    if(pname==NULL) {
+    if(pname==nullptr) {
         pname=strrchr(argv[0], '/');
     }
-    if(pname!=NULL) {
+    if(pname!=nullptr) {
         ++pname;
     } else {
         pname=argv[0];
@@ -160,12 +160,12 @@ main(int argc, char *argv[]) {
         return printUsage(pname, false);
     }
 
-    in=out=NULL;
-    data=NULL;
+    in=out=nullptr;
+    data=nullptr;
 
     /* open the input file, get its length, allocate memory for it, read the file */
     in=fopen(argv[1], "rb");
-    if(in==NULL) {
+    if(in==nullptr) {
         fprintf(stderr, "%s: unable to open input file \"%s\"\n", pname, argv[1]);
         rc=2;
         goto done;
@@ -185,7 +185,7 @@ main(int argc, char *argv[]) {
      * additional padding bytes
      */
     data=(char *)malloc(length+DEFAULT_PADDING_LENGTH);
-    if(data==NULL) {
+    if(data==nullptr) {
         fprintf(stderr, "%s: error allocating memory for \"%s\"\n", pname, argv[1]);
         rc=2;
         goto done;
@@ -201,7 +201,7 @@ main(int argc, char *argv[]) {
     }
 
     fclose(in);
-    in=NULL;
+    in=nullptr;
 
     /* swap the data in-place */
     errorCode=U_ZERO_ERROR;
@@ -253,7 +253,7 @@ main(int argc, char *argv[]) {
     }
 
     out=fopen(argv[2], "wb");
-    if(out==NULL) {
+    if(out==nullptr) {
         fprintf(stderr, "%s: unable to open output file \"%s\"\n", pname, argv[2]);
         rc=5;
         goto done;
@@ -266,19 +266,19 @@ main(int argc, char *argv[]) {
     }
 
     fclose(out);
-    out=NULL;
+    out=nullptr;
 
     /* all done */
     rc=0;
 
 done:
-    if(in!=NULL) {
+    if(in!=nullptr) {
         fclose(in);
     }
-    if(out!=NULL) {
+    if(out!=nullptr) {
         fclose(out);
     }
-    if(data!=NULL) {
+    if(data!=nullptr) {
         free(data);
     }
     return rc;
@@ -356,7 +356,7 @@ udata_swapPackage(const char *inFilename, const char *outFilename,
 
     /* 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;
     }
 
@@ -419,7 +419,7 @@ udata_swapPackage(const char *inFilename, const char *outFilename,
 
         /* read the last item's offset and preflight it */
         offset=ds->readUInt32(inEntries[itemCount-1].dataOffset);
-        itemLength=udata_swap(ds, inBytes+offset, -1, NULL, pErrorCode);
+        itemLength=udata_swap(ds, inBytes+offset, -1, nullptr, pErrorCode);
 
         if(U_SUCCESS(*pErrorCode)) {
             return headerSize+offset+(uint32_t)itemLength;
@@ -522,7 +522,7 @@ udata_swapPackage(const char *inFilename, const char *outFilename,
         if(inData==outData) {
             /* +15: prepare for extra padding of a newly-last item */
             table=(ToCEntry *)uprv_malloc(itemCount*sizeof(ToCEntry)+length+DEFAULT_PADDING_LENGTH);
-            if(table!=NULL) {
+            if(table!=nullptr) {
                 outBytes=(uint8_t *)(table+itemCount);
 
                 /* copy the item count and the swapped strings */
@@ -532,7 +532,7 @@ udata_swapPackage(const char *inFilename, const char *outFilename,
         } else {
             table=(ToCEntry *)uprv_malloc(itemCount*sizeof(ToCEntry));
         }
-        if(table==NULL) {
+        if(table==nullptr) {
             udata_printError(ds, "udata_swapPackage(): out of memory allocating %d bytes\n",
                              inData==outData ?
                                  itemCount*sizeof(ToCEntry)+length+DEFAULT_PADDING_LENGTH :
index 138d254d291f832ecc6a8dede8164af8ac280206..43b96d814fb7e3952e455da97238acfc97c5ebc4 100644 (file)
@@ -167,7 +167,7 @@ MBCSInit(MBCSData *mbcsData, UCMFile *ucm) {
 U_CFUNC NewConverter *
 MBCSOpen(UCMFile *ucm) {
     MBCSData *mbcsData=(MBCSData *)uprv_malloc(sizeof(MBCSData));
-    if(mbcsData==NULL) {
+    if(mbcsData==nullptr) {
         printf("out of memory\n");
         exit(U_MEMORY_ALLOCATION_ERROR);
     }
@@ -186,7 +186,7 @@ U_CDECL_BEGIN
 static void
 MBCSClose(NewConverter *cnvData) {
     MBCSData *mbcsData=(MBCSData *)cnvData;
-    if(mbcsData!=NULL) {
+    if(mbcsData!=nullptr) {
         MBCSDestruct(mbcsData);
         uprv_free(mbcsData);
     }
@@ -209,7 +209,7 @@ MBCSStartMappings(MBCSData *mbcsData) {
 
     if(sum>0) {
         mbcsData->unicodeCodeUnits=(uint16_t *)uprv_malloc(sum*sizeof(uint16_t));
-        if(mbcsData->unicodeCodeUnits==NULL) {
+        if(mbcsData->unicodeCodeUnits==nullptr) {
             fprintf(stderr, "error: out of memory allocating %ld 16-bit code units\n",
                 (long)sum);
             return false;
@@ -231,7 +231,7 @@ MBCSStartMappings(MBCSData *mbcsData) {
         sum=0x100000*maxCharLength;
     }
     mbcsData->fromUBytes=(uint8_t *)uprv_malloc(sum);
-    if(mbcsData->fromUBytes==NULL) {
+    if(mbcsData->fromUBytes==nullptr) {
         fprintf(stderr, "error: out of memory allocating %ld B for target mappings\n", (long)sum);
         return false;
     }
index f007b80c7dbb6153e537e2aaf056cdcd91f95e43..59c1eb66705d1e6f46fa7f102cce05e6fa605ce4 100644 (file)
@@ -56,17 +56,17 @@ initConvData(ConvData *data) {
 
 static void
 cleanupConvData(ConvData *data) {
-    if(data!=NULL) {
-        if(data->cnvData!=NULL) {
+    if(data!=nullptr) {
+        if(data->cnvData!=nullptr) {
             data->cnvData->close(data->cnvData);
-            data->cnvData=NULL;
+            data->cnvData=nullptr;
         }
-        if(data->extData!=NULL) {
+        if(data->extData!=nullptr) {
             data->extData->close(data->extData);
-            data->extData=NULL;
+            data->extData=nullptr;
         }
         ucm_close(data->ucm);
-        data->ucm=NULL;
+        data->ucm=nullptr;
     }
 }
 
@@ -111,7 +111,7 @@ static UDataInfo dataInfo={
 static void
 writeConverterData(ConvData *data, const char *cnvName, const char *cnvDir, UErrorCode *status)
 {
-    UNewDataMemory *mem = NULL;
+    UNewDataMemory *mem = nullptr;
     uint32_t sz2;
     uint32_t size = 0;
     int32_t tableType;
@@ -122,14 +122,14 @@ writeConverterData(ConvData *data, const char *cnvName, const char *cnvDir, UErr
       }
 
     tableType=TABLE_NONE;
-    if(data->cnvData!=NULL) {
+    if(data->cnvData!=nullptr) {
         tableType|=TABLE_BASE;
     }
-    if(data->extData!=NULL) {
+    if(data->extData!=nullptr) {
         tableType|=TABLE_EXT;
     }
 
-    mem = udata_create(cnvDir, "cnv", cnvName, &dataInfo, haveCopyright ? U_COPYRIGHT_STRING : NULL, status);
+    mem = udata_create(cnvDir, "cnv", cnvName, &dataInfo, haveCopyright ? U_COPYRIGHT_STRING : nullptr, status);
 
     if(U_FAILURE(*status))
       {
@@ -191,8 +191,8 @@ static UOption options[]={
     UOPTION_VERSION,
     UOPTION_DESTDIR,
     UOPTION_VERBOSE,
-    { "small", NULL, NULL, NULL, '\1', UOPT_NO_ARG, 0 },
-    { "ignore-siso-check", NULL, NULL, NULL, '\1', UOPT_NO_ARG, 0 },
+    { "small", nullptr, nullptr, nullptr, '\1', UOPT_NO_ARG, 0 },
+    { "ignore-siso-check", nullptr, nullptr, nullptr, '\1', UOPT_NO_ARG, 0 },
     UOPTION_QUIET,
     UOPTION_SOURCEDIR,
 };
@@ -264,7 +264,7 @@ int main(int argc, char* argv[])
 
     icu::CharString outFileName;
     UErrorCode err = U_ZERO_ERROR;
-    if (destdir != NULL && *destdir != 0) {
+    if (destdir != nullptr && *destdir != 0) {
         outFileName.append(destdir, err).ensureEndsWithFileSeparator(err);
         if (U_FAILURE(err)) {
             return err;
@@ -292,7 +292,7 @@ int main(int argc, char* argv[])
         const char *arg = getLongPathname(*argv);
 
         const char* sourcedir = options[OPT_SOURCEDIR].value;
-        if (sourcedir != NULL && *sourcedir != 0 && uprv_strcmp(sourcedir, ".") != 0) {
+        if (sourcedir != nullptr && *sourcedir != 0 && uprv_strcmp(sourcedir, ".") != 0) {
             pathBuf.clear();
             pathBuf.appendPathPart(sourcedir, localError);
             pathBuf.appendPathPart(arg, localError);
@@ -358,10 +358,10 @@ int main(int argc, char* argv[])
             char *p;
             p = strrchr(cnvName, U_FILE_SEP_CHAR); /* Find last file separator */
 
-            if(p == NULL)            /* OK, try alternate */
+            if(p == nullptr)            /* OK, try alternate */
             {
                 p = strrchr(cnvName, U_FILE_ALT_SEP_CHAR);
-                if(p == NULL)
+                if(p == nullptr)
                 {
                     p=cnvName; /* If no separators, no problem */
                 }
@@ -426,7 +426,7 @@ getPlatformAndCCSIDFromName(const char *name, int8_t *pPlatform, int32_t *pCCSID
             ++name;
         }
         *pPlatform=UCNV_IBM;
-        *pCCSID=(int32_t)uprv_strtoul(name, NULL, 10);
+        *pCCSID=(int32_t)uprv_strtoul(name, nullptr, 10);
     } else {
         *pPlatform=UCNV_UNKNOWN;
         *pCCSID=0;
@@ -516,7 +516,7 @@ readHeader(ConvData *data,
      */
     if(data->ucm->baseName[0]==0) {
         prototype=ucnv_converterStaticData[staticData->conversionType];
-        if(prototype!=NULL) {
+        if(prototype!=nullptr) {
             if(staticData->name[0]==0) {
                 uprv_strcpy((char *)staticData->name, prototype->name);
             }
@@ -578,7 +578,7 @@ readFile(ConvData *data, const char* converterName,
     data->ucm=ucm_open();
 
     convFile=T_FileStream_open(converterName, "r");
-    if(convFile==NULL) {
+    if(convFile==nullptr) {
         *pErrorCode=U_FILE_ACCESS_ERROR;
         return false;
     }
@@ -594,7 +594,7 @@ readFile(ConvData *data, const char* converterName,
         ucm_processStates(baseStates, IGNORE_SISO_CHECK);
     } else {
         dataIsBase=false;
-        baseStates=NULL;
+        baseStates=nullptr;
     }
 
     /* read the base table */
@@ -663,7 +663,7 @@ createConverter(ConvData *data, const char *converterName, UErrorCode *pErrorCod
          * and an optional extension table.
          */
         data->cnvData=MBCSOpen(data->ucm);
-        if(data->cnvData==NULL) {
+        if(data->cnvData==nullptr) {
             *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
 
         } else if(!data->cnvData->isValid(data->cnvData,
@@ -710,7 +710,7 @@ createConverter(ConvData *data, const char *converterName, UErrorCode *pErrorCod
                 if(data->ucm->ext->mappingsLength>0) {
                     /* prepare the extension table, if there is one */
                     data->extData=CnvExtOpen(data->ucm);
-                    if(data->extData==NULL) {
+                    if(data->extData==nullptr) {
                         *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
                     } else if(
                         !data->extData->addTable(data->extData, data->ucm->ext, &data->staticData)
@@ -743,7 +743,7 @@ createConverter(ConvData *data, const char *converterName, UErrorCode *pErrorCod
         } else {
             /* prepare the extension table */
             data->extData=CnvExtOpen(data->ucm);
-            if(data->extData==NULL) {
+            if(data->extData==nullptr) {
                 *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
             } else {
                 /* fill in gaps in extension file header fields */
index 542a2f3db78c0834dafdb42e21e84f04e224c642..c2ac112f6efcc417a3b663aa2d0f51e525205afe 100644 (file)
@@ -91,7 +91,7 @@ static void pkg_destroyOptMatchArch(char *optMatchArch);
 #endif
 
 static int32_t pkg_createWithAssemblyCode(const char *targetDir, const char mode, const char *gencFilePath);
-static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, const char *objectFile, char *command = NULL, UBool specialHandling=false);
+static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, const char *objectFile, char *command = nullptr, UBool specialHandling=false);
 static int32_t pkg_archiveLibrary(const char *targetDir, const char *version, UBool reverseExt);
 static void createFileNames(UPKGOptions *o, const char mode, const char *version_major, const char *version, const char *libName, const UBool reverseExt, UBool noVersion);
 static int32_t initializePkgDataFlags(UPKGOptions *o);
@@ -215,7 +215,7 @@ static const char* FLAG_NAMES[PKGDATA_FLAGS_SIZE] = {
         "RANLIB",
         "INSTALL_CMD"
 };
-static char **pkgDataFlags = NULL;
+static char **pkgDataFlags = nullptr;
 
 enum {
     LIB_FILE,
@@ -423,7 +423,7 @@ main(int argc, char* argv[]) {
     if (options[BLDOPT].doesOccur) {
         o.options   = options[BLDOPT].value;
     } else {
-        o.options = NULL;
+        o.options = nullptr;
     }
 #endif
     if(options[COPYRIGHT].doesOccur) {
@@ -449,7 +449,7 @@ main(int argc, char* argv[]) {
     if( options[INSTALL].doesOccur ) {
         o.install  = options[INSTALL].value;
     } else {
-        o.install = NULL;
+        o.install = nullptr;
     }
 
     if( options[SOURCEDIR].doesOccur ) {
@@ -479,7 +479,7 @@ main(int argc, char* argv[]) {
     }
 
     /* OK options are set up. Now the file lists. */
-    tail = NULL;
+    tail = nullptr;
     for( n=1; n<argc; n++) {
         o.fileListFiles = pkg_appendToList(o.fileListFiles, &tail, uprv_strdup(argv[n]));
     }
@@ -493,32 +493,32 @@ main(int argc, char* argv[]) {
 
     result = pkg_executeOptions(&o);
 
-    if (pkgDataFlags != NULL) {
+    if (pkgDataFlags != nullptr) {
         for (n = 0; n < PKGDATA_FLAGS_SIZE; n++) {
-            if (pkgDataFlags[n] != NULL) {
+            if (pkgDataFlags[n] != nullptr) {
                 uprv_free(pkgDataFlags[n]);
             }
         }
         uprv_free(pkgDataFlags);
     }
 
-    if (o.cShortName != NULL) {
+    if (o.cShortName != nullptr) {
         uprv_free((char *)o.cShortName);
     }
-    if (o.fileListFiles != NULL) {
+    if (o.fileListFiles != nullptr) {
         pkg_deleteList(o.fileListFiles);
     }
-    if (o.filePaths != NULL) {
+    if (o.filePaths != nullptr) {
         pkg_deleteList(o.filePaths);
     }
-    if (o.files != NULL) {
+    if (o.files != nullptr) {
         pkg_deleteList(o.files);
     }
     return result;
 }
 
 static int runCommand(const char* command, UBool specialHandling) {
-    char *cmd = NULL;
+    char *cmd = nullptr;
     char cmdBuffer[SMALL_BUFFER_MAX_SIZE];
     int32_t len = static_cast<int32_t>(strlen(command));
 
@@ -583,9 +583,9 @@ static int32_t pkg_executeOptions(UPKGOptions *o) {
 
     if (IN_FILES_MODE(mode)) {
         /* Copy the raw data to the installation directory. */
-        if (o->install != NULL) {
+        if (o->install != nullptr) {
             uprv_strcpy(targetDir, o->install);
-            if (o->shortName != NULL) {
+            if (o->shortName != nullptr) {
                 uprv_strcat(targetDir, PKGDATA_FILE_SEP_STRING);
                 uprv_strcat(targetDir, o->shortName);
             }
@@ -615,7 +615,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) {
         if(o->verbose) {
           fprintf(stdout, "# Writing package file %s ..\n", datFileNamePath);
         }
-        result = writePackageDatFile(datFileNamePath, o->comment, o->srcDir, o->fileListFiles->str, NULL, U_CHARSET_FAMILY ? 'e' :  U_IS_BIG_ENDIAN ? 'b' : 'l');
+        result = writePackageDatFile(datFileNamePath, o->comment, o->srcDir, o->fileListFiles->str, nullptr, U_CHARSET_FAMILY ? 'e' :  U_IS_BIG_ENDIAN ? 'b' : 'l');
         if (result != 0) {
             fprintf(stderr,"Error writing package dat file.\n");
             return result;
@@ -652,7 +652,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) {
                 }
             }
 
-            if (o->install != NULL) {
+            if (o->install != nullptr) {
                 result = pkg_installCommonMode(o->install, targetFileNamePath);
             }
 
@@ -664,7 +664,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) {
 
 #if !defined(WINDOWS_WITH_MSVC) || defined(USING_CYGWIN)
             /* Get the version major number. */
-            if (o->version != NULL) {
+            if (o->version != nullptr) {
                 for (uint32_t i = 0;i < sizeof(version_major);i++) {
                     if (o->version[i] == '.') {
                         version_major[i] = 0;
@@ -688,14 +688,14 @@ static int32_t pkg_executeOptions(UPKGOptions *o) {
             }
 #endif
             /* Using the base libName and version number, generate the library file names. */
-            createFileNames(o, mode, version_major, o->version == NULL ? "" : o->version, o->libName, reverseExt, noVersion);
+            createFileNames(o, mode, version_major, o->version == nullptr ? "" : o->version, o->libName, reverseExt, noVersion);
 
-            if ((o->version!=NULL || IN_STATIC_MODE(mode)) && o->rebuild == false && o->pdsbuild == false) {
+            if ((o->version!=nullptr || IN_STATIC_MODE(mode)) && o->rebuild == false && o->pdsbuild == false) {
                 /* Check to see if a previous built data library file exists and check if it is the latest. */
                 snprintf(checkLibFile, sizeof(checkLibFile), "%s%s", targetDir, libFileNames[LIB_FILE_VERSION]);
                 if (T_FileStream_file_exists(checkLibFile)) {
                     if (isFileModTimeLater(checkLibFile, o->srcDir, true) && isFileModTimeLater(checkLibFile, o->options)) {
-                        if (o->install != NULL) {
+                        if (o->install != nullptr) {
                           if(o->verbose) {
                             fprintf(stdout, "# Installing already-built library into %s\n", o->install);
                           }
@@ -706,15 +706,15 @@ static int32_t pkg_executeOptions(UPKGOptions *o) {
                           }
                         }
                         return result;
-                    } else if (o->verbose && (o->install!=NULL)) {
+                    } else if (o->verbose && (o->install!=nullptr)) {
                       fprintf(stdout, "# Not installing up-to-date library %s into %s\n", checkLibFile, o->install);
                     }
-                } else if(o->verbose && (o->install!=NULL)) {
+                } else if(o->verbose && (o->install!=nullptr)) {
                   fprintf(stdout, "# Not installing missing %s into %s\n", checkLibFile, o->install);
                 }
             }
 
-            if (pkg_checkFlag(o) == NULL) {
+            if (pkg_checkFlag(o) == nullptr) {
                 /* Error occurred. */
                 return result;
             }
@@ -735,7 +735,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) {
                         datFileNamePath,
                         o->tmpDir,
                         o->entryName,
-                        NULL,
+                        nullptr,
                         gencFilePath,
                         sizeof(gencFilePath));
 
@@ -744,7 +744,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) {
                         fprintf(stderr, "Error generating assembly code for data.\n");
                         return result;
                     } else if (IN_STATIC_MODE(mode)) {
-                      if(o->install != NULL) {
+                      if(o->install != nullptr) {
                         if(o->verbose) {
                           fprintf(stdout, "# Installing static library into %s\n", o->install);
                         }
@@ -769,15 +769,15 @@ static int32_t pkg_executeOptions(UPKGOptions *o) {
 #endif
                 } else {
 #ifdef CAN_WRITE_OBJ_CODE
-                    /* Try to detect the arch type, use NULL if unsuccessful */
+                    /* Try to detect the arch type, use nullptr if unsuccessful */
                     char optMatchArch[10] = { 0 };
                     pkg_createOptMatchArch(optMatchArch);
                     writeObjectCode(
                         datFileNamePath,
                         o->tmpDir,
                         o->entryName,
-                        (optMatchArch[0] == 0 ? NULL : optMatchArch),
-                        NULL,
+                        (optMatchArch[0] == 0 ? nullptr : optMatchArch),
+                        nullptr,
                         gencFilePath,
                         sizeof(gencFilePath),
                         true);
@@ -830,7 +830,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) {
 
 #if !U_PLATFORM_USES_ONLY_WIN32_API
             /* Install the libraries if option was set. */
-            if (o->install != NULL) {
+            if (o->install != nullptr) {
                 if(o->verbose) {
                   fprintf(stdout, "# Installing library file to %s ..\n", o->install);
                 }
@@ -860,16 +860,16 @@ static int32_t initializePkgDataFlags(UPKGOptions *o) {
 #if !defined(WINDOWS_WITH_MSVC) || defined(USING_CYGWIN)
     do {
 #endif
-        if (pkgDataFlags != NULL) {
+        if (pkgDataFlags != nullptr) {
             for (int32_t i = 0; i < PKGDATA_FLAGS_SIZE; i++) {
                 pkgDataFlags[i] = (char*)uprv_malloc(sizeof(char) * currentBufferSize);
-                if (pkgDataFlags[i] != NULL) {
+                if (pkgDataFlags[i] != nullptr) {
                     pkgDataFlags[i][0] = 0;
                 } else {
                     fprintf(stderr,"Error allocating memory for pkgDataFlags.\n");
-                    /* If an error occurs, ensure that the rest of the array is NULL */
+                    /* If an error occurs, ensure that the rest of the array is nullptr */
                     for (int32_t n = i + 1; n < PKGDATA_FLAGS_SIZE; n++) {
-                        pkgDataFlags[n] = NULL;
+                        pkgDataFlags[n] = nullptr;
                     }
                     return -1;
                 }
@@ -879,7 +879,7 @@ static int32_t initializePkgDataFlags(UPKGOptions *o) {
             return -1;
         }
 
-        if (o->options == NULL) {
+        if (o->options == nullptr) {
             return result;
         }
 
@@ -894,7 +894,7 @@ static int32_t initializePkgDataFlags(UPKGOptions *o) {
             for (int32_t i = 0; i < PKGDATA_FLAGS_SIZE; i++) {
                 if (pkgDataFlags[i]) {
                     uprv_free(pkgDataFlags[i]);
-                    pkgDataFlags[i] = NULL;
+                    pkgDataFlags[i] = nullptr;
                 }
             }
             currentBufferSize = tmpResult;
@@ -1253,9 +1253,9 @@ static int32_t pkg_installFileMode(const char *installDir, const char *srcDir, c
     int32_t bufferLength = 0;
 
     FileStream *f = T_FileStream_open(fileListName, "r");
-    if (f != NULL) {
+    if (f != nullptr) {
         for(;;) {
-            if (T_FileStream_readLine(f, buffer, SMALL_BUFFER_MAX_SIZE) != NULL) {
+            if (T_FileStream_readLine(f, buffer, SMALL_BUFFER_MAX_SIZE) != nullptr) {
                 bufferLength = static_cast<int32_t>(uprv_strlen(buffer));
                 /* Remove new line character. */
                 if (bufferLength > 0) {
@@ -1367,7 +1367,7 @@ static int32_t pkg_archiveLibrary(const char *targetDir, const char *version, UB
  */
 static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, const char *objectFile, char *command, UBool specialHandling) {
     int32_t result = 0;
-    char *cmd = NULL;
+    char *cmd = nullptr;
     UBool freeCmd = false;
     int32_t length = 0;
 
@@ -1378,15 +1378,15 @@ static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c
      * containing many object files and so the calling function should supply a command buffer that is large
      * enough to handle this. Otherwise, use the default size.
      */
-    if (command != NULL) {
+    if (command != nullptr) {
         cmd = command;
     }
 
     if (IN_STATIC_MODE(mode)) {
-        if (cmd == NULL) {
+        if (cmd == nullptr) {
             length = static_cast<int32_t>(uprv_strlen(pkgDataFlags[AR]) + uprv_strlen(pkgDataFlags[ARFLAGS]) + uprv_strlen(targetDir) +
                      uprv_strlen(libFileNames[LIB_FILE_VERSION]) + uprv_strlen(objectFile) + uprv_strlen(pkgDataFlags[RANLIB]) + BUFFER_PADDING_SIZE);
-            if ((cmd = (char *)uprv_malloc(sizeof(char) * length)) == NULL) {
+            if ((cmd = (char *)uprv_malloc(sizeof(char) * length)) == nullptr) {
                 fprintf(stderr, "Unable to allocate memory for command.\n");
                 return -1;
             }
@@ -1409,7 +1409,7 @@ static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c
             result = runCommand(cmd);
         }
     } else /* if (IN_DLL_MODE(mode)) */ {
-        if (cmd == NULL) {
+        if (cmd == nullptr) {
             length = static_cast<int32_t>(uprv_strlen(pkgDataFlags[GENLIB]) + uprv_strlen(pkgDataFlags[LDICUDTFLAGS]) +
                      ((uprv_strlen(targetDir) + uprv_strlen(libFileNames[LIB_FILE_VERSION_TMP])) * 2) +
                      uprv_strlen(objectFile) + uprv_strlen(pkgDataFlags[LD_SONAME]) +
@@ -1420,7 +1420,7 @@ static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c
 #elif U_PLATFORM == U_PF_MINGW
             length += static_cast<int32_t>(uprv_strlen(targetDir) + uprv_strlen(libFileNames[LIB_FILE_MINGW]));
 #endif
-            if ((cmd = (char *)uprv_malloc(sizeof(char) * length)) == NULL) {
+            if ((cmd = (char *)uprv_malloc(sizeof(char) * length)) == nullptr) {
                 fprintf(stderr, "Unable to allocate memory for command.\n");
                 return -1;
             }
@@ -1615,7 +1615,7 @@ static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD
     char tempObjectFile[SMALL_BUFFER_MAX_SIZE] = "";
 #ifdef USE_SINGLE_CCODE_FILE
     char icudtAll[SMALL_BUFFER_MAX_SIZE] = "";
-    FileStream *icudtAllFile = NULL;
+    FileStream *icudtAllFile = nullptr;
     
     snprintf(icudtAll, sizeof(icudtAll), "%s%s%sall.c",
             o->tmpDir,
@@ -1627,23 +1627,23 @@ static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD
         return result;
     }
 
-    if((icudtAllFile = T_FileStream_open(icudtAll, "w"))==NULL) {
+    if((icudtAllFile = T_FileStream_open(icudtAll, "w"))==nullptr) {
         fprintf(stderr, "Unable to write to icudtall file: %s\n", icudtAll);
         return result;
     }
 #endif
 
-    if (list == NULL || listNames == NULL) {
-        /* list and listNames should never be NULL since we are looping through the CharList with
+    if (list == nullptr || listNames == nullptr) {
+        /* list and listNames should never be nullptr since we are looping through the CharList with
          * the given size.
          */
         return -1;
     }
 
-    if ((cmd = (char *)uprv_malloc((listSize + 2) * SMALL_BUFFER_MAX_SIZE)) == NULL) {
+    if ((cmd = (char *)uprv_malloc((listSize + 2) * SMALL_BUFFER_MAX_SIZE)) == nullptr) {
         fprintf(stderr, "Unable to allocate memory for cmd.\n");
         return -1;
-    } else if ((buffer = (char *)uprv_malloc((listSize + 1) * SMALL_BUFFER_MAX_SIZE)) == NULL) {
+    } else if ((buffer = (char *)uprv_malloc((listSize + 1) * SMALL_BUFFER_MAX_SIZE)) == nullptr) {
         fprintf(stderr, "Unable to allocate memory for buffer.\n");
         uprv_free(cmd);
         return -1;
@@ -1655,7 +1655,7 @@ static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD
 
         if (i == 0) {
             /* The first iteration calls the gencmn function and initializes the buffer. */
-            createCommonDataFile(o->tmpDir, o->shortName, o->entryName, NULL, o->srcDir, o->comment, o->fileListFiles->str, 0, true, o->verbose, gencmnFile);
+            createCommonDataFile(o->tmpDir, o->shortName, o->entryName, nullptr, o->srcDir, o->comment, o->fileListFiles->str, 0, true, o->verbose, gencmnFile);
             buffer[0] = 0;
 #ifdef USE_SINGLE_CCODE_FILE
             uprv_strcpy(tempObjectFile, gencmnFile);
@@ -1688,7 +1688,7 @@ static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD
                 sprintf(dataDirName, "%s%s", DATA_PREFIX[n], PKGDATA_FILE_SEP_STRING);
                 /* If the name contains a prefix (indicating directory), alter the new name accordingly. */
                 pSubstring = uprv_strstr(name, dataDirName);
-                if (pSubstring != NULL) {
+                if (pSubstring != nullptr) {
                     char newNameTmp[SMALL_BUFFER_MAX_SIZE] = "";
                     const char *p = name + uprv_strlen(dataDirName);
                     for (int32_t i = 0;;i++) {
@@ -1728,9 +1728,9 @@ static int32_t pkg_createWithoutAssemblyCode(UPKGOptions *o, const char *targetD
             writeCCode(
                 file,
                 o->tmpDir,
-                NULL,
+                nullptr,
                 dataName[0] != 0 ? dataName : o->shortName,
-                newName[0] != 0 ? newName : NULL,
+                newName[0] != 0 ? newName : nullptr,
                 gencmnFile,
                 sizeof(gencmnFile));
 
@@ -1931,11 +1931,11 @@ static int32_t pkg_createWindowsDLL(const char mode, const char *gencFilePath, U
 static UPKGOptions *pkg_checkFlag(UPKGOptions *o) {
 #if U_PLATFORM == U_PF_AIX
     /* AIX needs a map file. */
-    char *flag = NULL;
+    char *flag = nullptr;
     int32_t length = 0;
     char tmpbuffer[SMALL_BUFFER_MAX_SIZE];
     const char MAP_FILE_EXT[] = ".map";
-    FileStream *f = NULL;
+    FileStream *f = nullptr;
     char mapFile[SMALL_BUFFER_MAX_SIZE] = "";
     int32_t start = -1;
     uint32_t count = 0;
@@ -1946,16 +1946,16 @@ static UPKGOptions *pkg_checkFlag(UPKGOptions *o) {
     /* This portion of the code removes 'rm -f all' in the GENLIB.
      * Only occurs in AIX.
      */
-    if (uprv_strstr(flag, rm_cmd) != NULL) {
-        char *tmpGenlibFlagBuffer = NULL;
+    if (uprv_strstr(flag, rm_cmd) != nullptr) {
+        char *tmpGenlibFlagBuffer = nullptr;
         int32_t i, offset;
 
         length = static_cast<int32_t>(uprv_strlen(flag) + 1);
         tmpGenlibFlagBuffer = (char *)uprv_malloc(length);
-        if (tmpGenlibFlagBuffer == NULL) {
+        if (tmpGenlibFlagBuffer == nullptr) {
             /* Memory allocation error */
             fprintf(stderr,"Unable to allocate buffer of size: %d.\n", length);
-            return NULL;
+            return nullptr;
         }
 
         uprv_strcpy(tmpGenlibFlagBuffer, flag);
@@ -2016,9 +2016,9 @@ static UPKGOptions *pkg_checkFlag(UPKGOptions *o) {
         uprv_strcat(mapFile, MAP_FILE_EXT);
 
         f = T_FileStream_open(mapFile, "w");
-        if (f == NULL) {
+        if (f == nullptr) {
             fprintf(stderr,"Unable to create map file: %s.\n", mapFile);
-            return NULL;
+            return nullptr;
         } else {
             snprintf(tmpbuffer, sizeof(tmpbuffer), "%s%s ", o->entryName, UDATA_CMN_INTERMEDIATE_SUFFIX);
     
@@ -2029,7 +2029,7 @@ static UPKGOptions *pkg_checkFlag(UPKGOptions *o) {
     }
 #elif U_PLATFORM == U_PF_CYGWIN || U_PLATFORM == U_PF_MINGW
     /* Cygwin needs to change flag options. */
-    char *flag = NULL;
+    char *flag = nullptr;
     int32_t length = 0;
 
     flag = pkgDataFlags[GENLIB];
@@ -2047,7 +2047,7 @@ static UPKGOptions *pkg_checkFlag(UPKGOptions *o) {
     uprv_memset(flag + position, 0, length - position);
 #elif U_PLATFORM == U_PF_OS400
     /* OS/400 needs to fix the ld options (swap single quote with double quote) */
-    char *flag = NULL;
+    char *flag = nullptr;
     int32_t length = 0;
 
     flag = pkgDataFlags[GENLIB];
@@ -2068,7 +2068,7 @@ static UPKGOptions *pkg_checkFlag(UPKGOptions *o) {
 
 static void loadLists(UPKGOptions *o, UErrorCode *status)
 {
-    CharList   *l, *tail = NULL, *tail2 = NULL;
+    CharList   *l, *tail = nullptr, *tail2 = nullptr;
     FileStream *in;
     char        line[16384];
     char       *linePtr, *lineNext;
@@ -2091,7 +2091,7 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
             return;
         }
 
-        while(T_FileStream_readLine(in, line, sizeof(line))!=NULL) { /* for each line */
+        while(T_FileStream_readLine(in, line, sizeof(line))!=nullptr) { /* for each line */
             ln++;
             if(uprv_strlen(line)>lineMax) {
                 fprintf(stderr, "%s:%d - line too long (over %d chars)\n", l->str, (int)ln, (int)lineMax);
@@ -2119,7 +2119,7 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
             }
 
             /* Now, process the line */
-            lineNext = NULL;
+            lineNext = nullptr;
 
             while(linePtr && *linePtr) { /* process space-separated items */
                 while(*linePtr == ' ') {
@@ -2129,7 +2129,7 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
                 if(linePtr[0] == '"')
                 {
                     lineNext = uprv_strchr(linePtr+1, '"');
-                    if(lineNext == NULL) {
+                    if(lineNext == nullptr) {
                         fprintf(stderr, "%s:%d - missing trailing double quote (\")\n",
                             l->str, (int)ln);
                         exit(1);
@@ -2164,7 +2164,7 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
                 }
                 /* The +5 is to add a little extra space for, among other things, PKGDATA_FILE_SEP_STRING */
                 tmpLength = static_cast<int32_t>(uprv_strlen(o->srcDir) + uprv_strlen(s) + 5);
-                if((tmp = (char *)uprv_malloc(tmpLength)) == NULL) {
+                if((tmp = (char *)uprv_malloc(tmpLength)) == nullptr) {
                     fprintf(stderr, "pkgdata: Error: Unable to allocate tmp buffer size: %d\n", tmpLength);
                     exit(U_MEMORY_ALLOCATION_ERROR);
                 }
@@ -2257,10 +2257,10 @@ static void pkg_createOptMatchArch(char *optMatchArch) {
     const char* code = "void oma(){}";
     const char* source = "oma.c";
     const char* obj = "oma.obj";
-    FileStream* stream = NULL;
+    FileStream* stream = nullptr;
 
     stream = T_FileStream_open(source,"w");
-    if (stream != NULL) {
+    if (stream != nullptr) {
         T_FileStream_writeLine(stream, code);
         T_FileStream_close(stream);
 
index 8ae1ec45a2b0a85d1133553d9e6ec9fe30eef6de..51c11e0a14d7517a89c81b7bd5e4195b0e18a6a3 100644 (file)
@@ -36,7 +36,7 @@ typedef struct _CharList
 
 
 /*
- * write CharList 'l' into stream 's' using delimiter 'delim' (delim can be NULL). quoted: -1 remove, 0 as is, 1 add quotes
+ * write CharList 'l' into stream 's' using delimiter 'delim' (delim can be nullptr). quoted: -1 remove, 0 as is, 1 add quotes
  */
 const char *pkg_writeCharList(FileStream *s, CharList *l, const char *delim, int32_t quoted);
 
@@ -68,7 +68,7 @@ CharList *pkg_appendToList(CharList *l, CharList** end, const char *str);
  * will search strAlias for the directory name (with strrchr). Then, it will
  * determine if that directory is already in list l.  If not, it will add it
  * with strdup(strAlias).
- * @param l list to append to , or NULL
+ * @param l list to append to , or nullptr
  * @param end end pointer-to-pointer.  Can point to null, or be null.
  * @param strAlias alias to full path string
  * @return new list
@@ -121,7 +121,7 @@ typedef struct UPKGOptions_
   const char *mode;        /* Mode of building */
   const char *version;     /* Library version */
   const char *comment;     /* comment string */
-  const char *install;     /* Where to install to (NULL = don't install) */
+  const char *install;     /* Where to install to (nullptr = don't install) */
   const char *icuroot;     /* where does ICU lives */
   const char *libName;     /* name for library (default: shortName) */
   UBool      rebuild;
index 7b72d4248502d23a9d5f856a30003550bd970929..0a2833ed566ab610d0faa36c529a278ba32a7b19 100644 (file)
 
 U_NAMESPACE_USE
 
-static UnicodeString **strs = NULL;
+static UnicodeString **strs = nullptr;
 
 static const UnicodeString&  _fieldString(UDebugEnumType type, int32_t field, UnicodeString& fillin) {
     const char *str = udbg_enumName(type, field);
-    if(str == NULL) {
+    if(str == nullptr) {
         return fillin.remove();
     } else {
         return fillin = UnicodeString(str, -1, US_INV);
@@ -35,12 +35,12 @@ static const UnicodeString&  _fieldString(UDebugEnumType type, int32_t field, Un
 
 U_CDECL_BEGIN
 static void udbg_cleanup(void) {
-    if(strs != NULL) {
+    if(strs != nullptr) {
         for(int t=0;t<=UDBG_ENUM_COUNT;t++) {
             delete [] strs[t];
         }
         delete[] strs;
-        strs = NULL;
+        strs = nullptr;
     }
 }
 
@@ -56,7 +56,7 @@ static void udbg_register_cleanup(void) {
 U_CDECL_END
 
 static void udbg_setup(void) {
-    if(strs == NULL) {
+    if(strs == nullptr) {
         udbg_register_cleanup();
         //fprintf(stderr,"Initializing string cache..\n");
         //fflush(stderr);
@@ -77,7 +77,7 @@ static void udbg_setup(void) {
 
 
 U_TOOLUTIL_API const UnicodeString& U_EXPORT2 udbg_enumString(UDebugEnumType type, int32_t field) {
-    if(strs == NULL ) {
+    if(strs == nullptr ) {
         udbg_setup();
     }
     if(type<0||type>=UDBG_ENUM_COUNT) {
index d4bb448a7990458d25e9659ce31fad67704ac7a1..83572353fc72cd8ef1f1b1477ed914914d030fc6 100644 (file)
 U_CAPI FileStream* U_EXPORT2
 T_FileStream_open(const char* filename, const char* mode)
 {
-    if(filename != NULL && *filename != 0 && mode != NULL && *mode != 0) {
+    if(filename != nullptr && *filename != 0 && mode != nullptr && *mode != 0) {
         FILE *file = fopen(filename, mode);
         return (FileStream*)file;
     } else {
-        return NULL;
+        return nullptr;
     }
 }
 
@@ -54,12 +54,12 @@ T_FileStream_wopen(const wchar_t* filename, const wchar_t* mode)
     FILE *result;
 
     // convert from wchar_t to char 
-    fnMbsSize = wcstombs(NULL, filename, ((size_t)-1) >> 1);
+    fnMbsSize = wcstombs(nullptr, filename, ((size_t)-1) >> 1);
     fn = (char*)uprv_malloc(fnMbsSize+2);
     wcstombs(fn, filename, fnMbsSize);
     fn[fnMbsSize] = 0;
 
-    mdMbsSize = wcstombs(NULL, mode, ((size_t)-1) >> 1);
+    mdMbsSize = wcstombs(nullptr, mode, ((size_t)-1) >> 1);
     md = (char*)uprv_malloc(mdMbsSize+2);
     wcstombs(md, mode, mdMbsSize);
     md[mdMbsSize] = 0;
index 08bb9a4aef72f7cb318f5f3712f3bf0760897113..994d8e31f00e3bed48dfd286810b1d142bdda2f8 100644 (file)
@@ -45,18 +45,18 @@ U_CAPI UBool U_EXPORT2
 isFileModTimeLater(const char *filePath, const char *checkAgainst, UBool isDir) {
     UBool isLatest = true;
 
-    if (filePath == NULL || checkAgainst == NULL) {
+    if (filePath == nullptr || checkAgainst == nullptr) {
         return false;
     }
 
     if (isDir == true) {
 #if U_HAVE_DIRENT_H
-        DIR *pDir = NULL;
-        if ((pDir= opendir(checkAgainst)) != NULL) {
-            DIR *subDirp = NULL;
-            DIRENT *dirEntry = NULL;
+        DIR *pDir = nullptr;
+        if ((pDir= opendir(checkAgainst)) != nullptr) {
+            DIR *subDirp = nullptr;
+            DIRENT *dirEntry = nullptr;
 
-            while ((dirEntry = readdir(pDir)) != NULL) {
+            while ((dirEntry = readdir(pDir)) != nullptr) {
                 if (uprv_strcmp(dirEntry->d_name, SKIP1) != 0 && uprv_strcmp(dirEntry->d_name, SKIP2) != 0) {
                     UErrorCode status = U_ZERO_ERROR;
                     icu::CharString newpath(checkAgainst, -1, status);
@@ -67,7 +67,7 @@ isFileModTimeLater(const char *filePath, const char *checkAgainst, UBool isDir)
                         return false;
                     }
 
-                    if ((subDirp = opendir(newpath.data())) != NULL) {
+                    if ((subDirp = opendir(newpath.data())) != nullptr) {
                         /* If this new path is a directory, make a recursive call with the newpath. */
                         closedir(subDirp);
                         isLatest = isFileModTimeLater(filePath, newpath.data(), isDir);
index 3fca179db47b1758e3081287b2d721e38500fe1d..8bbceb4f73e1afbe6c2b86eff2ab1189c6f517e1 100644 (file)
@@ -23,14 +23,14 @@ static int32_t getFlagOffset(const char *buffer, int32_t bufferSize);
  */
 U_CAPI int32_t U_EXPORT2
 parseFlagsFile(const char *fileName, char **flagBuffer, int32_t flagBufferSize, const char ** flagNames, int32_t numOfFlags, UErrorCode *status) {
-    char* buffer = NULL;
-    char* tmpFlagBuffer = NULL;
+    char* buffer = nullptr;
+    char* tmpFlagBuffer = nullptr;
     UBool allocateMoreSpace = false;
     int32_t idx, i;
     int32_t result = 0;
 
     FileStream *f = T_FileStream_open(fileName, "r");
-    if (f == NULL) {
+    if (f == nullptr) {
         *status = U_FILE_ACCESS_ERROR;
         goto parseFlagsFile_cleanup;
     }
@@ -38,7 +38,7 @@ parseFlagsFile(const char *fileName, char **flagBuffer, int32_t flagBufferSize,
     buffer = (char *)uprv_malloc(sizeof(char) * currentBufferSize);
     tmpFlagBuffer = (char *)uprv_malloc(sizeof(char) * flagBufferSize);
 
-    if (buffer == NULL || tmpFlagBuffer == NULL) {
+    if (buffer == nullptr || tmpFlagBuffer == nullptr) {
         *status = U_MEMORY_ALLOCATION_ERROR;
         goto parseFlagsFile_cleanup;
     }
@@ -49,13 +49,13 @@ parseFlagsFile(const char *fileName, char **flagBuffer, int32_t flagBufferSize,
             currentBufferSize *= 2;
             uprv_free(buffer);
             buffer = (char *)uprv_malloc(sizeof(char) * currentBufferSize);
-            if (buffer == NULL) {
+            if (buffer == nullptr) {
                 *status = U_MEMORY_ALLOCATION_ERROR;
                 goto parseFlagsFile_cleanup;
             }
         }
         for (i = 0; i < numOfFlags;) {
-            if (T_FileStream_readLine(f, buffer, currentBufferSize) == NULL) {
+            if (T_FileStream_readLine(f, buffer, currentBufferSize) == nullptr) {
                 /* End of file reached. */
                 break;
             }
@@ -78,7 +78,7 @@ parseFlagsFile(const char *fileName, char **flagBuffer, int32_t flagBufferSize,
                     }
                     break;
                 } else {
-                    if (flagNames != NULL) {
+                    if (flagNames != nullptr) {
                         if (idx >= 0) {
                             uprv_strcpy(flagBuffer[idx], tmpFlagBuffer);
                         } else {
@@ -146,7 +146,7 @@ static int32_t extractFlag(char* buffer, int32_t bufferSize, char* flag, int32_t
         flag[0] = 0;
     }
 
-    if (flagNames != NULL && offset>0) {
+    if (flagNames != nullptr && offset>0) {
         offset--;  /* Move offset back 1 because of '='*/
         for (i = 0; i < numOfFlags; i++) {
             if (uprv_strncmp(buffer, flagNames[i], offset) == 0) {
index 2e8b5037c03f0ea47ca98a73907d028ad8742cf3..58aaeea81cd6b0310ce73059808d877e8f1c9ffa 100644 (file)
@@ -115,14 +115,14 @@ getDataInfo(const uint8_t *data, int32_t length,
     const DataHeader *pHeader;
     const UDataInfo *pInfo;
 
-    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))
     ) {
         *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     pHeader=(const DataHeader *)data;
@@ -133,7 +133,7 @@ getDataInfo(const uint8_t *data, int32_t length,
         pInfo->sizeofUChar!=2
     ) {
         *pErrorCode=U_UNSUPPORTED_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     if(pInfo->isBigEndian==U_IS_BIG_ENDIAN) {
@@ -150,7 +150,7 @@ getDataInfo(const uint8_t *data, int32_t length,
         (length>=0 && length<headerLength)
     ) {
         *pErrorCode=U_UNSUPPORTED_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     return pInfo;
@@ -164,7 +164,7 @@ getTypeEnumForInputData(const uint8_t *data, int32_t length,
 
     /* getDataInfo() checks for illegal arguments */
     pInfo=getDataInfo(data, length, infoLength, headerLength, pErrorCode);
-    if(pInfo==NULL) {
+    if(pInfo==nullptr) {
         return -1;
     }
 
@@ -252,8 +252,8 @@ makeFullFilename(const char *path, const char *name,
                  char *filename, int32_t capacity) {
     char *s;
 
-    // prepend the path unless NULL or empty
-    if(path!=NULL && path[0]!=0) {
+    // prepend the path unless nullptr or empty
+    if(path!=nullptr && path[0]!=0) {
         if((int32_t)(strlen(path)+1)>=capacity) {
             fprintf(stderr, "pathname too long: \"%s\"\n", path);
             exit(U_BUFFER_OVERFLOW_ERROR);
@@ -289,7 +289,7 @@ makeFullFilenameAndDirs(const char *path, const char *name,
     // make tree directories
     errorCode=U_ZERO_ERROR;
     sep=strchr(filename, 0)-strlen(name);
-    while((sep=strchr(sep, U_FILE_SEP_CHAR))!=NULL) {
+    while((sep=strchr(sep, U_FILE_SEP_CHAR))!=nullptr) {
         if(sep!=filename) {
             *sep=0;                 // truncate temporarily
             uprv_mkdir(filename, &errorCode);
@@ -313,7 +313,7 @@ readFile(const char *path, const char *name, int32_t &length, char &type) {
 
     /* open the input file, get its length, allocate memory for it, read the file */
     file=fopen(filename, "rb");
-    if(file==NULL) {
+    if(file==nullptr) {
         fprintf(stderr, "icupkg: unable to open input file \"%s\"\n", filename);
         exit(U_FILE_ACCESS_ERROR);
     }
@@ -385,19 +385,19 @@ Package::Package()
         : doAutoPrefix(false), prefixEndsWithType(false) {
     inPkgName[0]=0;
     pkgPrefix[0]=0;
-    inData=NULL;
+    inData=nullptr;
     inLength=0;
     inCharset=U_CHARSET_FAMILY;
     inIsBigEndian=U_IS_BIG_ENDIAN;
 
     itemCount=0;
     itemMax=0;
-    items=NULL;
+    items=nullptr;
 
     inStringTop=outStringTop=0;
 
     matchMode=0;
-    findPrefix=findSuffix=NULL;
+    findPrefix=findSuffix=nullptr;
     findPrefixLength=findSuffixLength=0;
     findNextIndex=-1;
 
@@ -457,7 +457,7 @@ Package::readPackage(const char *filename) {
     extractPackageName(filename, inPkgName, (int32_t)sizeof(inPkgName));
 
     /* read the file */
-    inData=readFile(NULL, filename, inLength, type);
+    inData=readFile(nullptr, filename, inLength, type);
     length=inLength;
 
     /*
@@ -583,7 +583,7 @@ Package::readPackage(const char *filename) {
         if(doAutoPrefix) {
             // Use the first entry's prefix. Must be a new-style package.
             const char *prefixLimit=strchr(s, U_TREE_ENTRY_SEP_CHAR);
-            if(prefixLimit==NULL) {
+            if(prefixLimit==nullptr) {
                 fprintf(stderr,
                         "icupkg: --auto_toc_prefix[_with_type] but "
                         "the first entry \"%s\" does not contain a '%c'\n",
@@ -698,7 +698,7 @@ Package::writePackage(const char *filename, char outType, const char *comment) {
     extractPackageName(filename, prefix, MAX_PKG_NAME_LENGTH);
 
     // if there is an explicit comment, then use it, else use what's in the current header
-    if(comment!=NULL) {
+    if(comment!=nullptr) {
         /* get the header size minus the current comment */
         DataHeader *pHeader;
         int32_t length;
@@ -728,16 +728,16 @@ Package::writePackage(const char *filename, char outType, const char *comment) {
     // one type (TYPE_LE) is bogus
     errorCode=U_ZERO_ERROR;
     i=makeTypeEnum(outType);
-    ds[TYPE_B]= i==TYPE_B ? NULL : udata_openSwapper(true, U_ASCII_FAMILY, outIsBigEndian, outCharset, &errorCode);
-    ds[TYPE_L]= i==TYPE_L ? NULL : udata_openSwapper(false, U_ASCII_FAMILY, outIsBigEndian, outCharset, &errorCode);
-    ds[TYPE_LE]=NULL;
-    ds[TYPE_E]= i==TYPE_E ? NULL : udata_openSwapper(true, U_EBCDIC_FAMILY, outIsBigEndian, outCharset, &errorCode);
+    ds[TYPE_B]= i==TYPE_B ? nullptr : udata_openSwapper(true, U_ASCII_FAMILY, outIsBigEndian, outCharset, &errorCode);
+    ds[TYPE_L]= i==TYPE_L ? nullptr : udata_openSwapper(false, U_ASCII_FAMILY, outIsBigEndian, outCharset, &errorCode);
+    ds[TYPE_LE]=nullptr;
+    ds[TYPE_E]= i==TYPE_E ? nullptr : udata_openSwapper(true, U_EBCDIC_FAMILY, outIsBigEndian, outCharset, &errorCode);
     if(U_FAILURE(errorCode)) {
         fprintf(stderr, "icupkg: udata_openSwapper() failed - %s\n", u_errorName(errorCode));
         exit(errorCode);
     }
     for(i=0; i<TYPE_COUNT; ++i) {
-        if(ds[i]!=NULL) {
+        if(ds[i]!=nullptr) {
             ds[i]->printError=printPackageError;
             ds[i]->printErrorContext=stderr;
         }
@@ -747,13 +747,13 @@ Package::writePackage(const char *filename, char outType, const char *comment) {
 
     // create the file and write its contents
     file=fopen(filename, "wb");
-    if(file==NULL) {
+    if(file==nullptr) {
         fprintf(stderr, "icupkg: unable to create file \"%s\"\n", filename);
         exit(U_FILE_ACCESS_ERROR);
     }
 
     // swap and write the header
-    if(dsLocalToOut!=NULL) {
+    if(dsLocalToOut!=nullptr) {
         udata_swapDataHeader(dsLocalToOut, header, headerLength, header, &errorCode);
         if(U_FAILURE(errorCode)) {
             fprintf(stderr, "icupkg: udata_swapDataHeader(local to out) failed - %s\n", u_errorName(errorCode));
@@ -779,7 +779,7 @@ Package::writePackage(const char *filename, char outType, const char *comment) {
     }
     prefix[prefixLength++]=U_TREE_ENTRY_SEP_CHAR;
     prefix[prefixLength]=0;
-    if(dsLocalToOut!=NULL) {
+    if(dsLocalToOut!=nullptr) {
         dsLocalToOut->swapInvChars(dsLocalToOut, prefix, prefixLength, prefix, &errorCode);
         if(U_FAILURE(errorCode)) {
             fprintf(stderr, "icupkg: swapInvChars(output package name) failed - %s\n", u_errorName(errorCode));
@@ -817,7 +817,7 @@ Package::writePackage(const char *filename, char outType, const char *comment) {
     // write the table of contents
     // first the itemCount
     outInt32=itemCount;
-    if(dsLocalToOut!=NULL) {
+    if(dsLocalToOut!=nullptr) {
         dsLocalToOut->swapArray32(dsLocalToOut, &outInt32, 4, &outInt32, &errorCode);
         if(U_FAILURE(errorCode)) {
             fprintf(stderr, "icupkg: swapArray32(item count) failed - %s\n", u_errorName(errorCode));
@@ -835,7 +835,7 @@ Package::writePackage(const char *filename, char outType, const char *comment) {
     for(i=0; i<itemCount; ++i) {
         entry.nameOffset=(uint32_t)(basenameOffset+(items[i].name-outStrings));
         entry.dataOffset=(uint32_t)offset;
-        if(dsLocalToOut!=NULL) {
+        if(dsLocalToOut!=nullptr) {
             dsLocalToOut->swapArray32(dsLocalToOut, &entry, 8, &entry, &errorCode);
             if(U_FAILURE(errorCode)) {
                 fprintf(stderr, "icupkg: swapArray32(item entry %ld) failed - %s\n", (long)i, u_errorName(errorCode));
@@ -865,7 +865,7 @@ Package::writePackage(const char *filename, char outType, const char *comment) {
     // write the items
     for(pItem=items, i=0; i<itemCount; ++pItem, ++i) {
         int32_t type=makeTypeEnum(pItem->type);
-        if(ds[type]!=NULL) {
+        if(ds[type]!=nullptr) {
             // swap each item from its platform properties to the desired ones
             udata_swap(
                 ds[type],
@@ -936,17 +936,17 @@ void
 Package::findItems(const char *pattern) {
     const char *wild;
 
-    if(pattern==NULL || *pattern==0) {
+    if(pattern==nullptr || *pattern==0) {
         findNextIndex=-1;
         return;
     }
 
     findPrefix=pattern;
-    findSuffix=NULL;
+    findSuffix=nullptr;
     findSuffixLength=0;
 
     wild=strchr(pattern, '*');
-    if(wild==NULL) {
+    if(wild==nullptr) {
         // no wildcard
         findPrefixLength=(int32_t)strlen(pattern);
     } else {
@@ -954,7 +954,7 @@ Package::findItems(const char *pattern) {
         findPrefixLength=(int32_t)(wild-pattern);
         findSuffix=wild+1;
         findSuffixLength=(int32_t)strlen(findSuffix);
-        if(NULL!=strchr(findSuffix, '*')) {
+        if(nullptr!=strchr(findSuffix, '*')) {
             // two or more wildcards
             fprintf(stderr, "icupkg: syntax error (more than one '*') in item pattern \"%s\"\n", pattern);
             exit(U_PARSE_ERROR);
@@ -999,7 +999,7 @@ Package::findNextItem() {
 
         if(matchMode&MATCH_NOSLASH) {
             treeSep=strchr(middle, U_TREE_ENTRY_SEP_CHAR);
-            if(treeSep!=NULL && (treeSep-middle)<middleLength) {
+            if(treeSep!=nullptr && (treeSep-middle)<middleLength) {
                 // the middle (matching the * wildcard) contains a tree separator /
                 continue;
             }
@@ -1021,7 +1021,7 @@ Package::setMatchMode(uint32_t mode) {
 
 void
 Package::addItem(const char *name) {
-    addItem(name, NULL, 0, false, U_ICUDATA_TYPE_LETTER[0]);
+    addItem(name, nullptr, 0, false, U_ICUDATA_TYPE_LETTER[0]);
 }
 
 void
@@ -1168,7 +1168,7 @@ Package::extractItem(const char *filesPath, const char *outName, int32_t idx, ch
     // create the file and write its contents
     makeFullFilenameAndDirs(filesPath, outName, filename, (int32_t)sizeof(filename));
     file=fopen(filename, "wb");
-    if(file==NULL) {
+    if(file==nullptr) {
         fprintf(stderr, "icupkg: unable to create file \"%s\"\n", filename);
         exit(U_FILE_ACCESS_ERROR);
     }
@@ -1216,7 +1216,7 @@ Package::getItem(int32_t idx) const {
     if (0 <= idx && idx < itemCount) {
         return &items[idx];
     }
-    return NULL;
+    return nullptr;
 }
 
 void
@@ -1274,7 +1274,7 @@ Package::allocString(UBool in, int32_t length) {
 void
 Package::sortItems() {
     UErrorCode errorCode=U_ZERO_ERROR;
-    uprv_sortArray(items, itemCount, (int32_t)sizeof(Item), compareItems, NULL, false, &errorCode);
+    uprv_sortArray(items, itemCount, (int32_t)sizeof(Item), compareItems, nullptr, false, &errorCode);
     if(U_FAILURE(errorCode)) {
         fprintf(stderr, "icupkg: sorting item names failed - %s\n", u_errorName(errorCode));
         exit(errorCode);
@@ -1288,7 +1288,7 @@ void Package::setItemCapacity(int32_t max)
   }
   Item *newItems = (Item*)uprv_malloc(max * sizeof(items[0]));
   Item *oldItems = items;
-  if(newItems == NULL) {
+  if(newItems == nullptr) {
     fprintf(stderr, "icupkg: Out of memory trying to allocate %lu bytes for %d items\n",
         (unsigned long)(max*sizeof(items[0])), max);
     exit(U_MEMORY_ALLOCATION_ERROR);
index 752c55f1085db874e70821b81266b02f4d6fa733..f41938b5365607c8dedfd3c5356f9d89adaf6f88 100644 (file)
@@ -289,7 +289,7 @@ writeAssemblyCode(
     size_t i, length, count;
 
     in=T_FileStream_open(filename, "rb");
-    if(in==NULL) {
+    if(in==nullptr) {
         fprintf(stderr, "genccode: unable to open input file %s\n", filename);
         exit(U_FILE_ACCESS_ERROR);
     }
@@ -304,12 +304,12 @@ writeAssemblyCode(
         ".S",
         optFilename);
     out=T_FileStream_open(buffer.chars, "w");
-    if(out==NULL) {
+    if(out==nullptr) {
         fprintf(stderr, "genccode: unable to open output file %s\n", buffer.chars);
         exit(U_FILE_ACCESS_ERROR);
     }
 
-    if (outFilePath != NULL) {
+    if (outFilePath != nullptr) {
         if (uprv_strlen(buffer.chars) >= outFilePathCapacity) {
             fprintf(stderr, "genccode: filename too long\n");
             exit(U_ILLEGAL_ARGUMENT_ERROR);
@@ -321,7 +321,7 @@ writeAssemblyCode(
 #endif
     }
 
-    if(optEntryPoint != NULL) {
+    if(optEntryPoint != nullptr) {
         uprv_strcpy(entry, optEntryPoint);
         uprv_strcat(entry, "_dat");
     }
@@ -400,12 +400,12 @@ writeCCode(
     size_t i, length, count;
 
     in=T_FileStream_open(filename, "rb");
-    if(in==NULL) {
+    if(in==nullptr) {
         fprintf(stderr, "genccode: unable to open input file %s\n", filename);
         exit(U_FILE_ACCESS_ERROR);
     }
 
-    if(optName != NULL) { /* prepend  'icudt28_' */
+    if(optName != nullptr) { /* prepend  'icudt28_' */
         // +2 includes the _ and the NUL
         if (uprv_strlen(optName) + 2 > sizeof(entry)) {
             fprintf(stderr, "genccode: entry name too long (long filename?)\n");
@@ -427,7 +427,7 @@ writeCCode(
         ".c",
         optFilename);
 
-    if (outFilePath != NULL) {
+    if (outFilePath != nullptr) {
         if (uprv_strlen(buffer) >= outFilePathCapacity) {
             fprintf(stderr, "genccode: filename too long\n");
             exit(U_ILLEGAL_ARGUMENT_ERROR);
@@ -440,12 +440,12 @@ writeCCode(
     }
 
     out=T_FileStream_open(buffer, "w");
-    if(out==NULL) {
+    if(out==nullptr) {
         fprintf(stderr, "genccode: unable to open output file %s\n", buffer);
         exit(U_FILE_ACCESS_ERROR);
     }
 
-    if(optEntryPoint != NULL) {
+    if(optEntryPoint != nullptr) {
         uprv_strcpy(entry, optEntryPoint);
         uprv_strcat(entry, "_dat");
     }
@@ -687,7 +687,7 @@ getOutFilename(
     icu::ErrorCode status;
 
     /* copy path */
-    if(destdir!=NULL && *destdir!=0) {
+    if(destdir!=nullptr && *destdir!=0) {
         outFilenameBuilder.append(destdir, status);
         outFilenameBuilder.ensureEndsWithFileSeparator(status);
     } else {
@@ -695,10 +695,10 @@ getOutFilename(
     }
     inFilename=basename;
 
-    if(suffix==NULL) {
+    if(suffix==nullptr) {
         /* the filename does not have a suffix */
         entryNameBuilder.append(inFilename, status);
-        if(optFilename != NULL) {
+        if(optFilename != nullptr) {
             outFilenameBuilder.append(optFilename, status);
         } else {
             outFilenameBuilder.append(inFilename, status);
@@ -724,7 +724,7 @@ getOutFilename(
         outFilenameBuilder.append(inFilename, status);
         entryNameBuilder.append(inFilename, status);
 
-        if(optFilename != NULL) {
+        if(optFilename != nullptr) {
             outFilenameBuilder.truncate(saveOutFilenameLength);
             outFilenameBuilder.append(optFilename, status);
         }
@@ -776,7 +776,7 @@ getArchitecture(uint16_t *pCPU, uint16_t *pBits, UBool *pIsBigEndian, const char
 #   error "Unknown platform for CAN_GENERATE_OBJECTS."
 #endif
 
-    if(optMatchArch != NULL) {
+    if(optMatchArch != nullptr) {
         filename=optMatchArch;
     } else {
         /* set defaults */
@@ -817,7 +817,7 @@ getArchitecture(uint16_t *pCPU, uint16_t *pBits, UBool *pIsBigEndian, const char
     }
 
     in=T_FileStream_open(filename, "rb");
-    if(in==NULL) {
+    if(in==nullptr) {
         fprintf(stderr, "genccode: unable to open match-arch file %s\n", filename);
         exit(U_FILE_ACCESS_ERROR);
     }
@@ -1171,7 +1171,7 @@ writeObjectCode(
 #endif
 
     in=T_FileStream_open(filename, "rb");
-    if(in==NULL) {
+    if(in==nullptr) {
         fprintf(stderr, "genccode: unable to open input file %s\n", filename);
         exit(U_FILE_ACCESS_ERROR);
     }
@@ -1187,7 +1187,7 @@ writeObjectCode(
         newSuffix,
         optFilename);
 
-    if (outFilePath != NULL) {
+    if (outFilePath != nullptr) {
         if (uprv_strlen(buffer) >= outFilePathCapacity) {
             fprintf(stderr, "genccode: filename too long\n");
             exit(U_ILLEGAL_ARGUMENT_ERROR);
@@ -1195,7 +1195,7 @@ writeObjectCode(
         uprv_strcpy(outFilePath, buffer);
     }
 
-    if(optEntryPoint != NULL) {
+    if(optEntryPoint != nullptr) {
         uprv_strcpy(entry+entryOffset, optEntryPoint);
         uprv_strcat(entry+entryOffset, "_dat");
     }
@@ -1209,7 +1209,7 @@ writeObjectCode(
 
     /* open the output file */
     out=T_FileStream_open(buffer, "wb");
-    if(out==NULL) {
+    if(out==nullptr) {
         fprintf(stderr, "genccode: unable to open output file %s\n", buffer);
         exit(U_FILE_ACCESS_ERROR);
     }
@@ -1284,7 +1284,7 @@ writeObjectCode(
     /* set the file header */
     objHeader.fileHeader.Machine=cpu;
     objHeader.fileHeader.NumberOfSections=2;
-    objHeader.fileHeader.TimeDateStamp=(DWORD)time(NULL);
+    objHeader.fileHeader.TimeDateStamp=(DWORD)time(nullptr);
     objHeader.fileHeader.PointerToSymbolTable=IMAGE_SIZEOF_FILE_HEADER+2*IMAGE_SIZEOF_SECTION_HEADER+length+size; /* start of symbol table */
     objHeader.fileHeader.NumberOfSymbols=1;
 
index c109973d8a25e0ba497f93073498f0301c9e470a..64b58dc7b13c78d2a51a2ea91e56d395f6f75285 100644 (file)
@@ -87,12 +87,12 @@ typedef struct {
 } File;
 
 #define CHUNK_FILE_COUNT 256
-static File *files = NULL;
+static File *files = nullptr;
 static uint32_t fileCount=0;
 static uint32_t fileMax = 0;
 
 
-static char *symPrefix = NULL;
+static char *symPrefix = nullptr;
 
 #define LINE_BUFFER_SIZE 512
 /* prototypes --------------------------------------------------------------- */
@@ -122,13 +122,13 @@ createCommonDataFile(const char *destDir, const char *name, const char *entrypoi
     static char buffer[4096];
     char *line;
     char *linePtr;
-    char *s = NULL;
+    char *s = nullptr;
     UErrorCode errorCode=U_ZERO_ERROR;
     uint32_t i, fileOffset, basenameOffset, length, nread;
     FileStream *in, *file;
 
     line = (char *)uprv_malloc(sizeof(char) * LINE_BUFFER_SIZE);
-    if (line == NULL) {
+    if (line == nullptr) {
         fprintf(stderr, "gencmn: unable to allocate memory for line buffer of size %d\n", LINE_BUFFER_SIZE);
         exit(U_MEMORY_ALLOCATION_ERROR);
     }
@@ -137,24 +137,24 @@ createCommonDataFile(const char *destDir, const char *name, const char *entrypoi
 
     maxSize = max_size;
 
-    if (destDir == NULL) {
+    if (destDir == nullptr) {
         destDir = u_getDataDirectory();
     }
-    if (name == NULL) {
+    if (name == nullptr) {
         name = COMMON_DATA_NAME;
     }
-    if (type == NULL) {
+    if (type == nullptr) {
         type = DATA_TYPE;
     }
-    if (source == NULL) {
+    if (source == nullptr) {
         source = ".";
     }
 
-    if (dataFile == NULL) {
+    if (dataFile == nullptr) {
         in = T_FileStream_stdin();
     } else {
         in = T_FileStream_open(dataFile, "r");
-        if(in == NULL) {
+        if(in == nullptr) {
             fprintf(stderr, "gencmn: unable to open input file %s\n", dataFile);
             exit(U_FILE_ACCESS_ERROR);
         }
@@ -169,10 +169,10 @@ createCommonDataFile(const char *destDir, const char *name, const char *entrypoi
     }
 
     /* read the list of files and get their lengths */
-    while((s != NULL && *s != 0) || (s=T_FileStream_readLine(in, (line=linePtr),
-                                                             LINE_BUFFER_SIZE))!=NULL) {
+    while((s != nullptr && *s != 0) || (s=T_FileStream_readLine(in, (line=linePtr),
+                                                             LINE_BUFFER_SIZE))!=nullptr) {
         /* remove trailing newline characters and parse space separated items */
-        if (s != NULL && *s != 0) {
+        if (s != nullptr && *s != 0) {
             line=s;
         } else {
             s=line;
@@ -214,7 +214,7 @@ createCommonDataFile(const char *destDir, const char *name, const char *entrypoi
     }
 
     if(fileCount==0) {
-        fprintf(stderr, "gencmn: no files listed in %s\n", dataFile == NULL ? "<stdin>" : dataFile);
+        fprintf(stderr, "gencmn: no files listed in %s\n", dataFile == nullptr ? "<stdin>" : dataFile);
         return;
     }
 
@@ -237,7 +237,7 @@ createCommonDataFile(const char *destDir, const char *name, const char *entrypoi
         /* create the output file */
         out=udata_create(destDir, type, name,
                          &dataInfo,
-                         copyRight == NULL ? U_COPYRIGHT_STRING : copyRight,
+                         copyRight == nullptr ? U_COPYRIGHT_STRING : copyRight,
                          &errorCode);
         if(U_FAILURE(errorCode)) {
             fprintf(stderr, "gencmn: udata_create(-d %s -n %s -t %s) failed - %s\n",
@@ -273,7 +273,7 @@ createCommonDataFile(const char *destDir, const char *name, const char *entrypoi
 
             /* copy the next file */
             file=T_FileStream_open(files[i].pathname, "rb");
-            if(file==NULL) {
+            if(file==nullptr) {
                 fprintf(stderr, "gencmn: unable to open listed file %s\n", files[i].pathname);
                 exit(U_FILE_ACCESS_ERROR);
             }
@@ -329,10 +329,10 @@ createCommonDataFile(const char *destDir, const char *name, const char *entrypoi
 
         /* open the output file */
         out=T_FileStream_open(filename, "w");
-        if (gencmnFileName != NULL) {
+        if (gencmnFileName != nullptr) {
             uprv_strcpy(gencmnFileName, filename);
         }
-        if(out==NULL) {
+        if(out==nullptr) {
             fprintf(stderr, "gencmn: unable to open .c output file %s\n", filename);
             exit(U_FILE_ACCESS_ERROR);
         }
@@ -408,12 +408,12 @@ static void
 addFile(const char *filename, const char *name, const char *source, UBool sourceTOC, UBool verbose) {
     char *s;
     uint32_t length;
-    char *fullPath = NULL;
+    char *fullPath = nullptr;
 
     if(fileCount==fileMax) {
       fileMax += CHUNK_FILE_COUNT;
       files = (File *)uprv_realloc(files, fileMax*sizeof(files[0])); /* note: never freed. */
-      if(files==NULL) {
+      if(files==nullptr) {
         fprintf(stderr, "pkgdata/gencmn: Could not allocate %u bytes for %d files\n", (unsigned int)(fileMax*sizeof(files[0])), fileCount);
         exit(U_MEMORY_ALLOCATION_ERROR);
       }
@@ -445,7 +445,7 @@ addFile(const char *filename, const char *name, const char *source, UBool source
 
         /* try to open the file */
         file=T_FileStream_open(fullPath, "rb");
-        if(file==NULL) {
+        if(file==nullptr) {
             fprintf(stderr, "gencmn: unable to open listed file %s\n", fullPath);
             exit(U_FILE_ACCESS_ERROR);
         }
@@ -518,7 +518,7 @@ pathToFullPath(const char *path, const char *source) {
     length = (uint32_t)(uprv_strlen(path) + 1);
     newLength = (length + 1 + (int32_t)uprv_strlen(source));
     fullPath = (char *)uprv_malloc(newLength);
-    if(source != NULL) {
+    if(source != nullptr) {
         uprv_strcpy(fullPath, source);
         uprv_strcat(fullPath, U_FILE_SEP_STRING);
     } else {
index 06ddbb89b89b19e806278805cf50bfef1d28f382..d9c6717ecd1dd9bc2e8d302a5831f3e6907e328e 100644 (file)
@@ -61,14 +61,14 @@ readList(const char *filesPath, const char *listname, UBool readContents, Packag
     FILE *file;
     const char *listNameEnd;
 
-    if(listname==NULL || listname[0]==0) {
+    if(listname==nullptr || listname[0]==0) {
         fprintf(stderr, "missing list file\n");
-        return NULL;
+        return nullptr;
     }
 
-    if (listPkg == NULL) {
+    if (listPkg == nullptr) {
         listPkg=new Package();
-        if(listPkg==NULL) {
+        if(listPkg==nullptr) {
             fprintf(stderr, "icupkg: not enough memory\n");
             exit(U_MEMORY_ALLOCATION_ERROR);
         }
@@ -82,7 +82,7 @@ readList(const char *filesPath, const char *listname, UBool readContents, Packag
         const char *start;
 
         file=fopen(listname, "r");
-        if(file==NULL) {
+        if(file==nullptr) {
             fprintf(stderr, "icupkg: unable to open list file \"%s\"\n", listname);
             delete listPkg;
             exit(U_FILE_ACCESS_ERROR);
@@ -91,7 +91,7 @@ readList(const char *filesPath, const char *listname, UBool readContents, Packag
         while(fgets(line, sizeof(line), file)) {
             // remove comments
             end=strchr(line, '#');
-            if(end!=NULL) {
+            if(end!=nullptr) {
                 *end=0;
             } else {
                 // remove trailing CR LF
@@ -105,7 +105,7 @@ readList(const char *filesPath, const char *listname, UBool readContents, Packag
             // skip empty lines and
             // skip lines starting with reserved characters
             start=u_skipWhitespace(line);
-            if(*start==0 || NULL!=strchr(U_PKG_RESERVED_CHARS, *start)) {
+            if(*start==0 || nullptr!=strchr(U_PKG_RESERVED_CHARS, *start)) {
                 continue;
             }
 
@@ -115,7 +115,7 @@ readList(const char *filesPath, const char *listname, UBool readContents, Packag
                 for(end=(char *)start; *end!=0 && *end!=' ' && *end!='\t'; ++end) {}
                 if(*end==0) {
                     // this item is the last one on the line
-                    end=NULL;
+                    end=nullptr;
                 } else {
                     // the item is terminated by whitespace, terminate it with NUL
                     *end=0;
@@ -127,7 +127,7 @@ readList(const char *filesPath, const char *listname, UBool readContents, Packag
                 }
 
                 // find the start of the next item or exit the loop
-                if(end==NULL || *(start=u_skipWhitespace(end+1))==0) {
+                if(end==nullptr || *(start=u_skipWhitespace(end+1))==0) {
                     break;
                 }
             }
@@ -155,7 +155,7 @@ writePackageDatFile(const char *outFilename, const char *outComment, const char
     LocalPointer<Package> ownedPkg;
     LocalPointer<Package> addListPkg;
 
-    if (pkg == NULL) {
+    if (pkg == nullptr) {
         ownedPkg.adoptInstead(new Package);
         if(ownedPkg.isNull()) {
             fprintf(stderr, "icupkg: not enough memory\n");
@@ -163,7 +163,7 @@ writePackageDatFile(const char *outFilename, const char *outComment, const char
         }
         pkg = ownedPkg.getAlias();
 
-        addListPkg.adoptInstead(readList(sourcePath, addList, true, NULL));
+        addListPkg.adoptInstead(readList(sourcePath, addList, true, nullptr));
         if(addListPkg.isValid()) {
             pkg->addItems(*addListPkg);
         } else {
index 79e076c0c233505cce33b01575a6a68d15e0be5b..06f24c4617a3474769eea772ca13bdba28c916b9 100644 (file)
@@ -60,8 +60,8 @@ U_NAMESPACE_BEGIN
 
 class NativeItem {
 public:
-    NativeItem() : pItem(NULL), pInfo(NULL), bytes(NULL), swapped(NULL), length(0) {}
-    NativeItem(const Item *item, UDataSwapFn *swap) : swapped(NULL) {
+    NativeItem() : pItem(nullptr), pInfo(nullptr), bytes(nullptr), swapped(nullptr), length(0) {}
+    NativeItem(const Item *item, UDataSwapFn *swap) : swapped(nullptr) {
         setItem(item, swap);
     }
     ~NativeItem() {
@@ -101,7 +101,7 @@ public:
             ds->printErrorContext=stderr;
 
             swapped=new uint8_t[pItem->length];
-            if(swapped==NULL) {
+            if(swapped==nullptr) {
                 fprintf(stderr, "icupkg: unable to allocate memory for swapping \"%s\"\n", pItem->name);
                 exit(U_MEMORY_ALLOCATION_ERROR);
             }
@@ -135,7 +135,7 @@ makeTargetName(const char *itemName, const char *id, int32_t idLength, const cha
 
     // get the item basename
     itemID=strrchr(itemName, '/');
-    if(itemID!=NULL) {
+    if(itemID!=nullptr) {
         ++itemID;
     } else {
         itemID=itemName;
@@ -180,7 +180,7 @@ checkParent(const char *itemName, CheckDependency check, void *context,
 
     // get the item basename
     itemID=strrchr(itemName, '/');
-    if(itemID!=NULL) {
+    if(itemID!=nullptr) {
         ++itemID;
     } else {
         itemID=itemName;
@@ -188,7 +188,7 @@ checkParent(const char *itemName, CheckDependency check, void *context,
 
     // get the item suffix
     suffix=strrchr(itemID, '.');
-    if(suffix==NULL) {
+    if(suffix==nullptr) {
         // empty suffix, point to the end of the string
         suffix=strrchr(itemID, 0);
     }
@@ -287,7 +287,7 @@ ures_enumDependencies(const char *itemName,
     UBool doCheckParent = true;  // always remains true if depth>1
     switch(res_getPublicType(res)) {
     case URES_STRING:
-        if(depth==1 && inKey!=NULL &&
+        if(depth==1 && inKey!=nullptr &&
                 (0==strcmp(inKey, "%%ALIAS") || 0==strcmp(inKey, "%%Parent"))) {
             // Top-level %%ALIAS string:
             //   The alias resource bundle will be used instead of this one.
@@ -301,7 +301,7 @@ ures_enumDependencies(const char *itemName,
             checkAlias(itemName, res, alias, length, /*useResSuffix=*/ true,
                        check, context, pErrorCode);
             // If there is a %%ALIAS, then there should be nothing else in this resource bundle.
-        } else if(depth==2 && parentKey!=NULL && 0==strcmp(parentKey, "%%DEPENDENCY")) {
+        } else if(depth==2 && parentKey!=nullptr && 0==strcmp(parentKey, "%%DEPENDENCY")) {
             // Second-level %%DEPENDENCY string:
             // Explicit declaration of a dependency of this item on that one.
             // No tracing: build tool
@@ -351,7 +351,7 @@ ures_enumDependencies(const char *itemName,
                 Resource item=res_getArrayItem(pResData, res, i);
                 ures_enumDependencies(
                         itemName, pResData,
-                        item, NULL,
+                        item, nullptr,
                         inKey, depth+1,
                         check, context,
                         pkg,
@@ -427,7 +427,7 @@ ures_enumDependencies(const char *itemName, const UDataInfo *pInfo,
 
     UBool doCheckParent = ures_enumDependencies(
         itemName, &resData,
-        resData.rootRes, NULL, NULL, 0,
+        resData.rootRes, nullptr, nullptr, 0,
         check, context,
         pkg,
         pErrorCode);
index b31755947d0cdf3ed5970c612706dbc58b41b7f7..d10568fedb414270d58d50f5800217b3cb5b6620 100644 (file)
@@ -51,8 +51,8 @@ UniProps::UniProps()
         : start(U_SENTINEL), end(U_SENTINEL),
           bmg(U_SENTINEL), bpb(U_SENTINEL),
           scf(U_SENTINEL), slc(U_SENTINEL), stc(U_SENTINEL), suc(U_SENTINEL),
-          digitValue(-1), numericValue(NULL),
-          name(NULL), nameAlias(NULL) {
+          digitValue(-1), numericValue(nullptr),
+          name(nullptr), nameAlias(nullptr) {
     memset(binProps, 0, sizeof(binProps));
     memset(intProps, 0, sizeof(intProps));
     memset(age, 0, 4);
@@ -64,20 +64,20 @@ const int32_t PreparsedUCD::kNumLineBuffers;
 
 PreparsedUCD::PreparsedUCD(const char *filename, UErrorCode &errorCode)
         : pnames(nullptr),
-          file(NULL),
+          file(nullptr),
           defaultLineIndex(-1), blockLineIndex(-1), lineIndex(0),
           lineNumber(0),
           lineType(NO_LINE),
-          fieldLimit(NULL), lineLimit(NULL) {
+          fieldLimit(nullptr), lineLimit(nullptr) {
     if(U_FAILURE(errorCode)) { return; }
 
-    if(filename==NULL || *filename==0 || (*filename=='-' && filename[1]==0)) {
-        filename=NULL;
+    if(filename==nullptr || *filename==0 || (*filename=='-' && filename[1]==0)) {
+        filename=nullptr;
         file=stdin;
     } else {
         file=fopen(filename, "r");
     }
-    if(file==NULL) {
+    if(file==nullptr) {
         perror("error opening preparsed UCD");
         fprintf(stderr, "error opening preparsed UCD file %s\n", filename ? filename : "\"no file name given\"");
         errorCode=U_FILE_ACCESS_ERROR;
@@ -96,8 +96,8 @@ PreparsedUCD::~PreparsedUCD() {
 
 // Same order as the LineType values.
 static const char *lineTypeStrings[]={
-    NULL,
-    NULL,
+    nullptr,
+    nullptr,
     "ucd",
     "property",
     "binary",
@@ -124,7 +124,7 @@ PreparsedUCD::readLine(UErrorCode &errorCode) {
     lineLimit=fieldLimit=line;
     lineType=NO_LINE;
     char *result=fgets(line, sizeof(lines[0]), file);
-    if(result==NULL) {
+    if(result==nullptr) {
         if(ferror(file)) {
             perror("error reading preparsed UCD");
             fprintf(stderr, "error reading preparsed UCD before line %ld\n", (long)lineNumber);
@@ -151,7 +151,7 @@ PreparsedUCD::readLine(UErrorCode &errorCode) {
     }
     // Split by ';'.
     char *semi=line;
-    while((semi=strchr(semi, ';'))!=NULL) { *semi++=0; }
+    while((semi=strchr(semi, ';'))!=nullptr) { *semi++=0; }
     fieldLimit=strchr(line, 0);
     // Determine the line type.
     int32_t type;
@@ -183,7 +183,7 @@ PreparsedUCD::firstField() {
 
 const char *
 PreparsedUCD::nextField() {
-    if(fieldLimit==lineLimit) { return NULL; }
+    if(fieldLimit==lineLimit) { return nullptr; }
     char *field=fieldLimit+1;
     fieldLimit=strchr(field, 0);
     return field;
@@ -191,25 +191,25 @@ PreparsedUCD::nextField() {
 
 const UniProps *
 PreparsedUCD::getProps(UnicodeSet &newValues, UErrorCode &errorCode) {
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     newValues.clear();
     if(!lineHasPropertyValues()) {
         errorCode=U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     firstField();
     const char *field=nextField();
-    if(field==NULL) {
+    if(field==nullptr) {
         // No range field after the type.
         fprintf(stderr,
                 "error in preparsed UCD: missing default/block/cp range field "
                 "(no second field) on line %ld\n",
                 (long)lineNumber);
         errorCode=U_PARSE_ERROR;
-        return NULL;
+        return nullptr;
     }
     UChar32 start, end;
-    if(!parseCodePointRange(field, start, end, errorCode)) { return NULL; }
+    if(!parseCodePointRange(field, start, end, errorCode)) { return nullptr; }
     UniProps *props;
     UBool insideBlock=false;  // true if cp or unassigned range inside the block range.
     switch(lineType) {
@@ -220,21 +220,21 @@ PreparsedUCD::getProps(UnicodeSet &newValues, UErrorCode &errorCode) {
                     "error in preparsed UCD: default line %ld after one or more block lines\n",
                     (long)lineNumber);
             errorCode=U_PARSE_ERROR;
-            return NULL;
+            return nullptr;
         }
         if(defaultLineIndex>=0) {
             fprintf(stderr,
                     "error in preparsed UCD: second line with default properties on line %ld\n",
                     (long)lineNumber);
             errorCode=U_PARSE_ERROR;
-            return NULL;
+            return nullptr;
         }
         if(start!=0 || end!=0x10ffff) {
             fprintf(stderr,
                     "error in preparsed UCD: default range must be 0..10FFFF, not '%s' on line %ld\n",
                     field, (long)lineNumber);
             errorCode=U_PARSE_ERROR;
-            return NULL;
+            return nullptr;
         }
         props=&defaultProps;
         defaultLineIndex=lineIndex;
@@ -271,19 +271,19 @@ PreparsedUCD::getProps(UnicodeSet &newValues, UErrorCode &errorCode) {
                     "partially overlaps with block range %04lX..%04lX\n",
                     field, (long)lineNumber, (long)blockProps.start, (long)blockProps.end);
             errorCode=U_PARSE_ERROR;
-            return NULL;
+            return nullptr;
         }
         props=&cpProps;
         break;
     default:
         // Will not occur because of the range check above.
         errorCode=U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     props->start=start;
     props->end=end;
-    while((field=nextField())!=NULL) {
-        if(!parseProperty(*props, field, newValues, errorCode)) { return NULL; }
+    while((field=nextField())!=nullptr) {
+        if(!parseProperty(*props, field, newValues, errorCode)) { return nullptr; }
     }
     if(lineType==BLOCK_LINE) {
         blockValues=newValues;
@@ -322,7 +322,7 @@ PreparsedUCD::parseProperty(UniProps &props, const char *field, UnicodeSet &newV
     const char *v=strchr(p, '=');
     int binaryValue;
     if(*p=='-') {
-        if(v!=NULL) {
+        if(v!=nullptr) {
             fprintf(stderr,
                     "error in preparsed UCD: mix of binary-property-no and "
                     "enum-property syntax '%s' on line %ld\n",
@@ -332,7 +332,7 @@ PreparsedUCD::parseProperty(UniProps &props, const char *field, UnicodeSet &newV
         }
         binaryValue=0;
         ++p;
-    } else if(v==NULL) {
+    } else if(v==nullptr) {
         binaryValue=1;
     } else {
         binaryValue=-1;
@@ -518,7 +518,7 @@ PreparsedUCD::getRangeForAlgNames(UChar32 &start, UChar32 &end, UErrorCode &erro
     }
     firstField();
     const char *field=nextField();
-    if(field==NULL) {
+    if(field==nullptr) {
         // No range field after the type.
         fprintf(stderr,
                 "error in preparsed UCD: missing algnamesrange range field "
@@ -562,12 +562,12 @@ PreparsedUCD::parseCodePointRange(const char *s, UChar32 &start, UChar32 &end, U
 void
 PreparsedUCD::parseString(const char *s, UnicodeString &uni, UErrorCode &errorCode) {
     UChar *buffer=toUCharPtr(uni.getBuffer(-1));
-    int32_t length=u_parseString(s, buffer, uni.getCapacity(), NULL, &errorCode);
+    int32_t length=u_parseString(s, buffer, uni.getCapacity(), nullptr, &errorCode);
     if(errorCode==U_BUFFER_OVERFLOW_ERROR) {
         errorCode=U_ZERO_ERROR;
         uni.releaseBuffer(0);
         buffer=toUCharPtr(uni.getBuffer(length));
-        length=u_parseString(s, buffer, uni.getCapacity(), NULL, &errorCode);
+        length=u_parseString(s, buffer, uni.getCapacity(), nullptr, &errorCode);
     }
     uni.releaseBuffer(length);
     if(U_FAILURE(errorCode)) {
@@ -585,7 +585,7 @@ PreparsedUCD::parseScriptExtensions(const char *s, UnicodeSet &scx, UErrorCode &
     for(;;) {
         const char *scs;
         const char *scLimit=strchr(s, ' ');
-        if(scLimit!=NULL) {
+        if(scLimit!=nullptr) {
             scs=scString.clear().append(s, (int32_t)(scLimit-s), errorCode).data();
             if(U_FAILURE(errorCode)) { return; }
         } else {
@@ -607,7 +607,7 @@ PreparsedUCD::parseScriptExtensions(const char *s, UnicodeSet &scx, UErrorCode &
         } else {
             scx.add(script);
         }
-        if(scLimit!=NULL) {
+        if(scLimit!=nullptr) {
             s=scLimit+1;
         } else {
             break;
index bf455d0e142409232a5ab3c4aed81705172c016b..d5c63fab4974200c3c063e255e170c4f5e2c803e 100644 (file)
@@ -114,7 +114,7 @@ public:
     /** Returns the number of the line read by readLine(). */
     int32_t getLineNumber() const { return lineNumber; }
 
-    /** Returns the line's next field, or NULL. */
+    /** Returns the line's next field, or nullptr. */
     const char *nextField();
 
     /** Returns the Unicode version when or after the UNICODE_VERSION_LINE has been read. */
@@ -129,7 +129,7 @@ public:
      * Parses properties from the current line.
      * Clears newValues and sets UProperty codes for property values mentioned
      * on the current line (as opposed to being inherited).
-     * Returns a pointer to the filled-in UniProps, or NULL if something went wrong.
+     * Returns a pointer to the filled-in UniProps, or nullptr if something went wrong.
      * The returned UniProps are usable until the next line of the same type is read.
      */
     const UniProps *getProps(UnicodeSet &newValues, UErrorCode &errorCode);
index 8d669a93187b1c4fee11fde4d91164b15bc071fd..fd6f830f372d2278dc1c216faf1146b599b25f95 100644 (file)
@@ -80,7 +80,7 @@ upname_swap(const UDataSwapper *ds,
             UErrorCode *pErrorCode) {
     /* udata_swapDataHeader checks the arguments */
     int32_t headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+    if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
         return 0;
     }
 
@@ -171,7 +171,7 @@ uprops_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;
     }
 
@@ -324,7 +324,7 @@ ucase_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;
     }
 
@@ -426,7 +426,7 @@ ubidi_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;
     }
 
@@ -536,7 +536,7 @@ unorm_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;
     }
 
@@ -866,8 +866,8 @@ test_swap(const UDataSwapper *ds,
 
     /* udata_swapDataHeader checks the arguments */
     headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
-        udata_printError(ds, "test_swap(): data header swap failed %s\n", pErrorCode != NULL ? u_errorName(*pErrorCode) : "pErrorCode is NULL");
+    if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
+        udata_printError(ds, "test_swap(): data header swap failed %s\n", pErrorCode != nullptr ? u_errorName(*pErrorCode) : "pErrorCode is nullptr");
         return 0;
     }
 
@@ -972,7 +972,7 @@ udata_swap(const UDataSwapper *ds,
     const UDataInfo *pInfo;
     int32_t i, swappedLength;
 
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+    if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
         return 0;
     }
 
@@ -983,7 +983,7 @@ udata_swap(const UDataSwapper *ds,
      * information. Otherwise we would have to pass some of the information
      * and not be able to use the UDataSwapFn signature.
      */
-    udata_swapDataHeader(ds, inData, -1, NULL, pErrorCode);
+    udata_swapDataHeader(ds, inData, -1, nullptr, pErrorCode);
 
     /*
      * If we wanted udata_swap() to also handle non-loadable data like a UTrie,
index 070c6034afa898a1fd0c43a0d0f10374a8bf4f9c..7e7bdc78a127fc94641a16308c14724c087a5fec 100644 (file)
@@ -121,8 +121,8 @@ getLongPathname(const char *pathname) {
 
 U_CAPI const char * U_EXPORT2
 findDirname(const char *path, char *buffer, int32_t bufLen, UErrorCode* status) {
-  if(U_FAILURE(*status)) return NULL;
-  const char *resultPtr = NULL;
+  if(U_FAILURE(*status)) return nullptr;
+  const char *resultPtr = nullptr;
   int32_t resultLen = 0;
 
   const char *basename=uprv_strrchr(path, U_FILE_SEP_CHAR);
@@ -150,7 +150,7 @@ findDirname(const char *path, char *buffer, int32_t bufLen, UErrorCode* status)
     return buffer;
   } else {
     *status = U_BUFFER_OVERFLOW_ERROR;
-    return NULL;
+    return nullptr;
   }
 }
 
@@ -167,7 +167,7 @@ findBasename(const char *filename) {
     }
 #endif
 
-    if(basename!=NULL) {
+    if(basename!=nullptr) {
         return basename+1;
     } else {
         return filename;
@@ -279,7 +279,7 @@ utm_open(const char *name, int32_t initialCapacity, int32_t maxCapacity, int32_t
     }
 
     mem=(UToolMemory *)uprv_malloc(sizeof(UToolMemory)+initialCapacity*size);
-    if(mem==NULL) {
+    if(mem==nullptr) {
         fprintf(stderr, "error: %s - out of memory\n", name);
         exit(U_MEMORY_ALLOCATION_ERROR);
     }
@@ -295,7 +295,7 @@ utm_open(const char *name, int32_t initialCapacity, int32_t maxCapacity, int32_t
 
 U_CAPI void U_EXPORT2
 utm_close(UToolMemory *mem) {
-    if(mem!=NULL) {
+    if(mem!=nullptr) {
         if(mem->array!=mem->staticArray) {
             uprv_free(mem->array);
         }
@@ -337,14 +337,14 @@ utm_hasCapacity(UToolMemory *mem, int32_t capacity) {
 
         if(mem->array==mem->staticArray) {
             mem->array=uprv_malloc(newCapacity*mem->size);
-            if(mem->array!=NULL) {
+            if(mem->array!=nullptr) {
                 uprv_memcpy(mem->array, mem->staticArray, (size_t)mem->idx*mem->size);
             }
         } else {
             mem->array=uprv_realloc(mem->array, newCapacity*mem->size);
         }
 
-        if(mem->array==NULL) {
+        if(mem->array==nullptr) {
             fprintf(stderr, "error: %s - out of memory\n", mem->name);
             exit(U_MEMORY_ALLOCATION_ERROR);
         }
@@ -356,7 +356,7 @@ utm_hasCapacity(UToolMemory *mem, int32_t capacity) {
 
 U_CAPI void * U_EXPORT2
 utm_alloc(UToolMemory *mem) {
-    char *p=NULL;
+    char *p=nullptr;
     int32_t oldIndex=mem->idx;
     int32_t newIndex=oldIndex+1;
     if(utm_hasCapacity(mem, newIndex)) {
@@ -369,7 +369,7 @@ utm_alloc(UToolMemory *mem) {
 
 U_CAPI void * U_EXPORT2
 utm_allocN(UToolMemory *mem, int32_t n) {
-    char *p=NULL;
+    char *p=nullptr;
     int32_t oldIndex=mem->idx;
     int32_t newIndex=oldIndex+n;
     if(utm_hasCapacity(mem, newIndex)) {
index f269748205ee0612a948c39ea25743f380dcc466..9d33481d91aaf5733c57c1a96d9a570ec5d2f24c 100644 (file)
@@ -71,8 +71,8 @@ ucbuf_autodetect_fs(FileStream* in, const char** cp, UConverter** conv, int32_t*
         T_FileStream_read(in, start, *signatureLength);
     }
 
-    if(*cp==NULL){
-        *conv =NULL;
+    if(*cp==nullptr){
+        *conv =nullptr;
         return false;
     }
 
@@ -82,7 +82,7 @@ ucbuf_autodetect_fs(FileStream* in, const char** cp, UConverter** conv, int32_t*
     /* convert and ignore initial U+FEFF, and the buffer overflow */
     pTarget = target;
     pStart = start;
-    ucnv_toUnicode(*conv, &pTarget, target+1, &pStart, start+*signatureLength, NULL, false, error);
+    ucnv_toUnicode(*conv, &pTarget, target+1, &pStart, start+*signatureLength, nullptr, false, error);
     *signatureLength = (int32_t)(pStart - start);
     if(*error==U_BUFFER_OVERFLOW_ERROR) {
         *error=U_ZERO_ERROR;
@@ -132,44 +132,44 @@ static UBool ucbuf_isCPKnown(const char* cp){
 
 U_CAPI FileStream * U_EXPORT2
 ucbuf_autodetect(const char* fileName, const char** cp,UConverter** conv, int32_t* signatureLength,UErrorCode* error){
-    FileStream* in=NULL;
-    if(error==NULL || U_FAILURE(*error)){
-        return NULL;
+    FileStream* in=nullptr;
+    if(error==nullptr || U_FAILURE(*error)){
+        return nullptr;
     }
-    if(conv==NULL || cp==NULL || fileName==NULL){
+    if(conv==nullptr || cp==nullptr || fileName==nullptr){
         *error = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     /* open the file */
     in= T_FileStream_open(fileName,"rb");
     
-    if(in == NULL){
+    if(in == nullptr){
         *error=U_FILE_ACCESS_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     if(ucbuf_autodetect_fs(in,cp,conv,signatureLength,error)) {
         return in;
     } else {
         ucnv_close(*conv);
-        *conv=NULL;
+        *conv=nullptr;
         T_FileStream_close(in);
-        return NULL;
+        return nullptr;
     }
 }
 
 /* fill the uchar buffer */
 static UCHARBUF*
 ucbuf_fillucbuf( UCHARBUF* buf,UErrorCode* error){
-    UChar* pTarget=NULL;
-    UChar* target=NULL;
-    const char* source=NULL;
+    UChar* pTarget=nullptr;
+    UChar* target=nullptr;
+    const char* source=nullptr;
     char  carr[MAX_IN_BUF] = {'\0'};
     char* cbuf =  carr;
     int32_t inputRead=0;
     int32_t outputWritten=0;
     int32_t offset=0;
-    const char* sourceLimit =NULL;
+    const char* sourceLimit =nullptr;
     int32_t cbufSize=0;
     pTarget = buf->buffer;
     /* check if we arrived here without exhausting the buffer*/
@@ -190,9 +190,9 @@ ucbuf_fillucbuf( UCHARBUF* buf,UErrorCode* error){
     }else{
         cbufSize = T_FileStream_size(buf->in);
         cbuf = (char*)uprv_malloc(cbufSize);
-        if (cbuf == NULL) {
+        if (cbuf == nullptr) {
                *error = U_MEMORY_ALLOCATION_ERROR;
-               return NULL;
+               return nullptr;
         }
         inputRead= T_FileStream_read(buf->in,cbuf,cbufSize);
         buf->remaining-=inputRead;
@@ -208,7 +208,7 @@ ucbuf_fillucbuf( UCHARBUF* buf,UErrorCode* error){
         /* set the callback to stop */
         UConverterToUCallback toUOldAction ;
         void* toUOldContext;
-        void* toUNewContext=NULL;
+        void* toUNewContext=nullptr;
         ucnv_setToUCallBack(buf->conv,
            UCNV_TO_U_CALLBACK_STOP,
            toUNewContext,
@@ -220,7 +220,7 @@ ucbuf_fillucbuf( UCHARBUF* buf,UErrorCode* error){
         source = cbuf;
         sourceLimit = source + inputRead;
         ucnv_toUnicode(buf->conv,&target,target+(buf->bufCapacity-offset),
-                        &source,sourceLimit,NULL,
+                        &source,sourceLimit,nullptr,
                         (UBool)(buf->remaining==0),error);
 
         if(U_FAILURE(*error)){
@@ -289,7 +289,7 @@ ucbuf_fillucbuf( UCHARBUF* buf,UErrorCode* error){
 
             /* re convert */
             ucnv_toUnicode(buf->conv,&target,target+(buf->bufCapacity-offset),
-                            &source,sourceLimit,NULL,
+                            &source,sourceLimit,nullptr,
                             (UBool)(buf->remaining==0),&error1);
 
         }
@@ -323,7 +323,7 @@ ucbuf_fillucbuf( UCHARBUF* buf,UErrorCode* error){
 /* get a UChar from the stream*/
 U_CAPI int32_t U_EXPORT2
 ucbuf_getc(UCHARBUF* buf,UErrorCode* error){
-    if(error==NULL || U_FAILURE(*error)){
+    if(error==nullptr || U_FAILURE(*error)){
         return false;
     }
     if(buf->currentPos>=buf->bufLimit){
@@ -343,7 +343,7 @@ ucbuf_getc(UCHARBUF* buf,UErrorCode* error){
 U_CAPI int32_t U_EXPORT2
 ucbuf_getc32(UCHARBUF* buf,UErrorCode* error){
     int32_t retVal = (int32_t)U_EOF;
-    if(error==NULL || U_FAILURE(*error)){
+    if(error==nullptr || U_FAILURE(*error)){
         return false;
     }
     if(buf->currentPos+1>=buf->bufLimit){
@@ -376,7 +376,7 @@ ucbuf_getcx32(UCHARBUF* buf,UErrorCode* error) {
     int32_t length;
     int32_t offset;
     UChar32 c32,c1,c2;
-    if(error==NULL || U_FAILURE(*error)){
+    if(error==nullptr || U_FAILURE(*error)){
         return false;
     }
     /* Fill the buffer if it is empty */
@@ -449,15 +449,15 @@ ucbuf_getcx32(UCHARBUF* buf,UErrorCode* error) {
 U_CAPI UCHARBUF* U_EXPORT2
 ucbuf_open(const char* fileName,const char** cp,UBool showWarning, UBool buffered, UErrorCode* error){
 
-    FileStream* in = NULL
+    FileStream* in = nullptr
     int32_t fileSize=0;
     const char* knownCp;
-    if(error==NULL || U_FAILURE(*error)){
-        return NULL;
+    if(error==nullptr || U_FAILURE(*error)){
+        return nullptr;
     }
-    if(cp==NULL || fileName==NULL){
+    if(cp==nullptr || fileName==nullptr){
         *error = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     if (!uprv_strcmp(fileName, "-")) {
         in = T_FileStream_stdin();
@@ -465,37 +465,37 @@ ucbuf_open(const char* fileName,const char** cp,UBool showWarning, UBool buffere
         in = T_FileStream_open(fileName, "rb");
     }
     
-    if(in!=NULL){
+    if(in!=nullptr){
         UCHARBUF* buf =(UCHARBUF*) uprv_malloc(sizeof(UCHARBUF));
         fileSize = T_FileStream_size(in);
-        if(buf == NULL){
+        if(buf == nullptr){
             *error = U_MEMORY_ALLOCATION_ERROR;
             T_FileStream_close(in);
-            return NULL;
+            return nullptr;
         }
         buf->in=in;
-        buf->conv=NULL;
+        buf->conv=nullptr;
         buf->showWarning = showWarning;
         buf->isBuffered = buffered;
         buf->signatureLength=0;
-        if(*cp==NULL || **cp=='\0'){
+        if(*cp==nullptr || **cp=='\0'){
             /* don't have code page name... try to autodetect */
             ucbuf_autodetect_fs(in,cp,&buf->conv,&buf->signatureLength,error);
         }else if(ucbuf_isCPKnown(*cp)){
             /* discard BOM */
             ucbuf_autodetect_fs(in,&knownCp,&buf->conv,&buf->signatureLength,error);
         }
-        if(U_SUCCESS(*error) && buf->conv==NULL) {
+        if(U_SUCCESS(*error) && buf->conv==nullptr) {
             buf->conv=ucnv_open(*cp,error);
         }
         if(U_FAILURE(*error)){
             ucnv_close(buf->conv);
             uprv_free(buf);
             T_FileStream_close(in);
-            return NULL;
+            return nullptr;
         }
         
-        if((buf->conv==NULL) && (buf->showWarning==true)){
+        if((buf->conv==nullptr) && (buf->showWarning==true)){
             fprintf(stderr,"###WARNING: No converter defined. Using codepage of system.\n");
         }
         buf->remaining=fileSize-buf->signatureLength;
@@ -505,27 +505,27 @@ ucbuf_open(const char* fileName,const char** cp,UBool showWarning, UBool buffere
             buf->bufCapacity=buf->remaining+buf->signatureLength+1/*for terminating nul*/;               
         }
         buf->buffer=(UChar*) uprv_malloc(U_SIZEOF_UCHAR * buf->bufCapacity );
-        if (buf->buffer == NULL) {
+        if (buf->buffer == nullptr) {
             *error = U_MEMORY_ALLOCATION_ERROR;
             ucbuf_close(buf);
-            return NULL;
+            return nullptr;
         }
         buf->currentPos=buf->buffer;
         buf->bufLimit=buf->buffer;
         if(U_FAILURE(*error)){
             fprintf(stderr, "Could not open codepage [%s]: %s\n", *cp, u_errorName(*error));
             ucbuf_close(buf);
-            return NULL;
+            return nullptr;
         }
         ucbuf_fillucbuf(buf,error);
         if(U_FAILURE(*error)){
             ucbuf_close(buf);
-            return NULL;
+            return nullptr;
         }
         return buf;
     }
     *error =U_FILE_ACCESS_ERROR;
-    return NULL;
+    return nullptr;
 }
 
 
@@ -555,13 +555,13 @@ ucbuf_ungetc(int32_t c,UCHARBUF* buf){
 static void
 ucbuf_closebuf(UCHARBUF* buf){
     uprv_free(buf->buffer);
-    buf->buffer = NULL;
+    buf->buffer = nullptr;
 }
 
 /* close the buf and release resources*/
 U_CAPI void U_EXPORT2
 ucbuf_close(UCHARBUF* buf){
-    if(buf!=NULL){
+    if(buf!=nullptr){
         if(buf->conv){
             ucnv_close(buf->conv);
         }
@@ -574,7 +574,7 @@ ucbuf_close(UCHARBUF* buf){
 /* rewind the buf and file stream */
 U_CAPI void U_EXPORT2
 ucbuf_rewind(UCHARBUF* buf,UErrorCode* error){
-    if(error==NULL || U_FAILURE(*error)){
+    if(error==nullptr || U_FAILURE(*error)){
         return;
     }
     if(buf){
@@ -597,7 +597,7 @@ ucbuf_rewind(UCHARBUF* buf,UErrorCode* error){
             /* convert and ignore initial U+FEFF, and the buffer overflow */
             pTarget = target;
             pStart = start;
-            ucnv_toUnicode(buf->conv, &pTarget, target+1, &pStart, start+numRead, NULL, false, error);
+            ucnv_toUnicode(buf->conv, &pTarget, target+1, &pStart, start+numRead, nullptr, false, error);
             if(*error==U_BUFFER_OVERFLOW_ERROR) {
                 *error=U_ZERO_ERROR;
             }
@@ -625,12 +625,12 @@ ucbuf_size(UCHARBUF* buf){
 
 U_CAPI const UChar* U_EXPORT2
 ucbuf_getBuffer(UCHARBUF* buf,int32_t* len,UErrorCode* error){
-    if(error==NULL || U_FAILURE(*error)){
-        return NULL;
+    if(error==nullptr || U_FAILURE(*error)){
+        return nullptr;
     }
-    if(buf==NULL || len==NULL){
+    if(buf==nullptr || len==nullptr){
         *error = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
     *len = (int32_t)(buf->bufLimit - buf->buffer);
     return buf->buffer;
@@ -641,13 +641,13 @@ ucbuf_resolveFileName(const char* inputDir, const char* fileName, char* target,
     int32_t requiredLen = 0;
     int32_t dirlen =  0;
     int32_t filelen = 0;
-    if(status==NULL || U_FAILURE(*status)){
-        return NULL;
+    if(status==nullptr || U_FAILURE(*status)){
+        return nullptr;
     }
 
-    if(inputDir == NULL || fileName == NULL || len==NULL || (target==NULL && *len>0)){
+    if(inputDir == nullptr || fileName == nullptr || len==nullptr || (target==nullptr && *len>0)){
         *status = U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
 
@@ -655,10 +655,10 @@ ucbuf_resolveFileName(const char* inputDir, const char* fileName, char* target,
     filelen = (int32_t)uprv_strlen(fileName);
     if(inputDir[dirlen-1] != U_FILE_SEP_CHAR) {
         requiredLen = dirlen + filelen + 2;
-        if((*len < requiredLen) || target==NULL){
+        if((*len < requiredLen) || target==nullptr){
             *len = requiredLen;
             *status = U_BUFFER_OVERFLOW_ERROR;
-            return NULL;
+            return nullptr;
         }
 
         target[0] = '\0';
@@ -680,10 +680,10 @@ ucbuf_resolveFileName(const char* inputDir, const char* fileName, char* target,
         target[dirlen + 1] = '\0';
     } else {
         requiredLen = dirlen + filelen + 1;
-        if((*len < requiredLen) || target==NULL){
+        if((*len < requiredLen) || target==nullptr){
             *len = requiredLen;
             *status = U_BUFFER_OVERFLOW_ERROR;
-            return NULL;
+            return nullptr;
         }
         
         uprv_strcpy(target, inputDir);
@@ -715,7 +715,7 @@ static UBool ucbuf_isCharNewLine(UChar c){
 U_CAPI const UChar* U_EXPORT2
 ucbuf_readline(UCHARBUF* buf,int32_t* len,UErrorCode* err){
     UChar* temp = buf->currentPos;
-    UChar* savePos =NULL;
+    UChar* savePos =nullptr;
     UChar c=0x0000;
     if(buf->isBuffered){
         /* The input is buffered we have to do more
@@ -724,15 +724,15 @@ ucbuf_readline(UCHARBUF* buf,int32_t* len,UErrorCode* err){
         for(;;){
             c = *temp++;
             if(buf->remaining==0){
-                return NULL; /* end of file is reached return NULL */
+                return nullptr; /* end of file is reached return nullptr */
             }
             if(temp>=buf->bufLimit && buf->currentPos == buf->buffer){
                 *err= U_TRUNCATED_CHAR_FOUND;
-                return NULL;
+                return nullptr;
             }else{
                 ucbuf_fillucbuf(buf,err);
                 if(U_FAILURE(*err)){
-                    return NULL
+                    return nullptr
                 }
             }
             /*
@@ -763,7 +763,7 @@ ucbuf_readline(UCHARBUF* buf,int32_t* len,UErrorCode* err){
             c = *temp++;
             
             if(buf->currentPos==buf->bufLimit){
-                return NULL; /* end of file is reached return NULL */
+                return nullptr; /* end of file is reached return nullptr */
             }
             /* Windows CR LF */
             if(c ==0x0d && temp <= buf->bufLimit && *temp == 0x0a ){
@@ -783,6 +783,6 @@ ucbuf_readline(UCHARBUF* buf,int32_t* len,UErrorCode* err){
     }
     /* not reached */
     /* A compiler warning will appear if all paths don't contain a return statement. */
-/*    return NULL;*/
+/*    return nullptr;*/
 }
 #endif
index f2f3a66e70ea8298e37590110d224216a349a1c9..272570e72f4e649748ecbf701dcc6c999a498ff6 100644 (file)
@@ -236,7 +236,7 @@ ucm_sortTable(UCMTable *t) {
                    false, &errorCode);
 
     /* build the reverseMap */
-    if(t->reverseMap==NULL) {
+    if(t->reverseMap==nullptr) {
         /*
          * allocate mappingsCapacity instead of mappingsLength so that
          * if mappings are added, the reverseMap need not be
@@ -244,7 +244,7 @@ ucm_sortTable(UCMTable *t) {
          * (see ucm_moveMappings() and ucm_addMapping())
          */
         t->reverseMap=(int32_t *)uprv_malloc(t->mappingsCapacity*sizeof(int32_t));
-        if(t->reverseMap==NULL) {
+        if(t->reverseMap==nullptr) {
             fprintf(stderr, "ucm error: unable to allocate reverseMap\n");
             exit(U_MEMORY_ALLOCATION_ERROR);
         }
@@ -285,7 +285,7 @@ ucm_moveMappings(UCMTable *base, UCMTable *ext) {
             /* reset the move flag */
             mb->moveFlag=0;
 
-            if(ext!=NULL && (flag&UCM_MOVE_TO_EXT)) {
+            if(ext!=nullptr && (flag&UCM_MOVE_TO_EXT)) {
                 /* add the mapping to the extension table */
                 ucm_addMapping(ext, mb, UCM_GET_CODE_POINTS(base, mb), UCM_GET_BYTES(base, mb));
             }
@@ -575,19 +575,19 @@ ucm_checkBaseExt(UCMStates *baseStates,
 
     /* check */
     result=
-        checkBaseExtUnicode(baseStates, base, ext, (UBool)(moveTarget!=NULL), intersectBase)|
-        checkBaseExtBytes(baseStates, base, ext, (UBool)(moveTarget!=NULL), intersectBase);
+        checkBaseExtUnicode(baseStates, base, ext, (UBool)(moveTarget!=nullptr), intersectBase)|
+        checkBaseExtBytes(baseStates, base, ext, (UBool)(moveTarget!=nullptr), intersectBase);
 
     if(result&HAS_ERRORS) {
         return false;
     }
 
     if(result&NEEDS_MOVE) {
-        ucm_moveMappings(ext, NULL);
+        ucm_moveMappings(ext, nullptr);
         ucm_moveMappings(base, moveTarget);
         ucm_sortTable(base);
         ucm_sortTable(ext);
-        if(moveTarget!=NULL) {
+        if(moveTarget!=nullptr) {
             ucm_sortTable(moveTarget);
         }
     }
@@ -832,7 +832,7 @@ ucm_parseMappingLine(UCMapping *m,
         m->u=codePoints[0];
     } else {
         UErrorCode errorCode=U_ZERO_ERROR;
-        u_strFromUTF32(NULL, 0, &u16Length, codePoints, uLen, &errorCode);
+        u_strFromUTF32(nullptr, 0, &u16Length, codePoints, uLen, &errorCode);
         if( (U_FAILURE(errorCode) && errorCode!=U_BUFFER_OVERFLOW_ERROR) ||
             u16Length>UCNV_EXT_MAX_UCHARS
         ) {
@@ -882,7 +882,7 @@ ucm_parseMappingLine(UCMapping *m,
 U_CAPI UCMTable * U_EXPORT2
 ucm_openTable() {
     UCMTable *table=(UCMTable *)uprv_malloc(sizeof(UCMTable));
-    if(table==NULL) {
+    if(table==nullptr) {
         fprintf(stderr, "ucm error: unable to allocate a UCMTable\n");
         exit(U_MEMORY_ALLOCATION_ERROR);
     }
@@ -893,7 +893,7 @@ ucm_openTable() {
 
 U_CAPI void U_EXPORT2
 ucm_closeTable(UCMTable *table) {
-    if(table!=NULL) {
+    if(table!=nullptr) {
         uprv_free(table->mappings);
         uprv_free(table->codePoints);
         uprv_free(table->bytes);
@@ -904,7 +904,7 @@ ucm_closeTable(UCMTable *table) {
 
 U_CAPI void U_EXPORT2
 ucm_resetTable(UCMTable *table) {
-    if(table!=NULL) {
+    if(table!=nullptr) {
         table->mappingsLength=0;
         table->flagsType=0;
         table->unicodeMask=0;
@@ -931,23 +931,23 @@ ucm_addMapping(UCMTable *table,
         }
         table->mappings=(UCMapping *)uprv_realloc(table->mappings,
                                              table->mappingsCapacity*sizeof(UCMapping));
-        if(table->mappings==NULL) {
+        if(table->mappings==nullptr) {
             fprintf(stderr, "ucm error: unable to allocate %d UCMappings\n",
                             (int)table->mappingsCapacity);
             exit(U_MEMORY_ALLOCATION_ERROR);
         }
 
-        if(table->reverseMap!=NULL) {
+        if(table->reverseMap!=nullptr) {
             /* the reverseMap must be reallocated in a new sort */
             uprv_free(table->reverseMap);
-            table->reverseMap=NULL;
+            table->reverseMap=nullptr;
         }
     }
 
     if(m->uLen>1 && table->codePointsCapacity==0) {
         table->codePointsCapacity=10000;
         table->codePoints=(UChar32 *)uprv_malloc(table->codePointsCapacity*4);
-        if(table->codePoints==NULL) {
+        if(table->codePoints==nullptr) {
             fprintf(stderr, "ucm error: unable to allocate %d UChar32s\n",
                             (int)table->codePointsCapacity);
             exit(U_MEMORY_ALLOCATION_ERROR);
@@ -957,7 +957,7 @@ ucm_addMapping(UCMTable *table,
     if(m->bLen>4 && table->bytesCapacity==0) {
         table->bytesCapacity=10000;
         table->bytes=(uint8_t *)uprv_malloc(table->bytesCapacity);
-        if(table->bytes==NULL) {
+        if(table->bytes==nullptr) {
             fprintf(stderr, "ucm error: unable to allocate %d bytes\n",
                             (int)table->bytesCapacity);
             exit(U_MEMORY_ALLOCATION_ERROR);
@@ -1014,7 +1014,7 @@ ucm_addMapping(UCMTable *table,
 U_CAPI UCMFile * U_EXPORT2
 ucm_open() {
     UCMFile *ucm=(UCMFile *)uprv_malloc(sizeof(UCMFile));
-    if(ucm==NULL) {
+    if(ucm==nullptr) {
         fprintf(stderr, "ucm error: unable to allocate a UCMFile\n");
         exit(U_MEMORY_ALLOCATION_ERROR);
     }
@@ -1034,7 +1034,7 @@ ucm_open() {
 
 U_CAPI void U_EXPORT2
 ucm_close(UCMFile *ucm) {
-    if(ucm!=NULL) {
+    if(ucm!=nullptr) {
         ucm_closeTable(ucm->base);
         ucm_closeTable(ucm->ext);
         uprv_free(ucm);
@@ -1102,7 +1102,7 @@ ucm_addMappingAuto(UCMFile *ucm, UBool forBase, UCMStates *baseStates,
         return false;
     }
 
-    if(baseStates!=NULL) {
+    if(baseStates!=nullptr) {
         /* check validity of the bytes and count the characters in them */
         type=ucm_mappingType(baseStates, m, codePoints, bytes);
         if(type<0) {
index d46b73ed30c6905361f0d2b4ab602b81daf7a8c0..08782f68d110bc996adf2ced9e88a9f805ce5c9f 100644 (file)
@@ -77,7 +77,7 @@ parseState(const char *s, int32_t state[256], uint32_t *pFlags) {
         }
     } else if(*s==0) {
         /* empty state row: all-illegal */
-        return NULL;
+        return nullptr;
     }
 
     for(;;) {
@@ -179,7 +179,7 @@ parseState(const char *s, int32_t state[256], uint32_t *pFlags) {
         if(*s==',') {
             ++s;
         } else {
-            return *s==0 ? NULL : s;
+            return *s==0 ? nullptr : s;
         }
     }
 }
@@ -195,7 +195,7 @@ ucm_addState(UCMStates *states, const char *s) {
 
     error=parseState(s, states->stateTable[states->countStates],
                        &states->stateFlags[states->countStates]);
-    if(error!=NULL) {
+    if(error!=nullptr) {
         fprintf(stderr, "ucm error: parse error in state definition at '%s'\n", error);
         exit(U_INVALID_TABLE_FORMAT);
     }
@@ -704,7 +704,7 @@ compactToUnicode2(UCMStates *states,
 
     /* make a copy of the state table */
     oldStateTable=(int32_t (*)[256])uprv_malloc(states->countStates*1024);
-    if(oldStateTable==NULL) {
+    if(oldStateTable==nullptr) {
         fprintf(stderr, "cannot compact toUnicode: out of memory\n");
         return;
     }
@@ -747,15 +747,15 @@ compactToUnicode2(UCMStates *states,
     /* allocate a new, smaller code units array */
     oldUnicodeCodeUnits=*pUnicodeCodeUnits;
     if(sum==0) {
-        *pUnicodeCodeUnits=NULL;
-        if(oldUnicodeCodeUnits!=NULL) {
+        *pUnicodeCodeUnits=nullptr;
+        if(oldUnicodeCodeUnits!=nullptr) {
             uprv_free(oldUnicodeCodeUnits);
         }
         uprv_free(oldStateTable);
         return;
     }
     *pUnicodeCodeUnits=(uint16_t *)uprv_malloc(sum*sizeof(uint16_t));
-    if(*pUnicodeCodeUnits==NULL) {
+    if(*pUnicodeCodeUnits==nullptr) {
         fprintf(stderr, "cannot compact toUnicode: out of memory allocating %ld 16-bit code units\n",
             (long)sum);
         /* revert to the old state table */
@@ -968,7 +968,7 @@ ucm_optimizeStates(UCMStates *states,
         errorCode=U_ZERO_ERROR; /* nothing bad will happen... */
         uprv_sortArray(toUFallbacks, countToUFallbacks,
                        sizeof(_MBCSToUFallback),
-                       compareFallbacks, NULL, false, &errorCode);
+                       compareFallbacks, nullptr, false, &errorCode);
     }
 }
 
index c92c6e7d0013b93eb33ee44b0dc1bfb3e159ee5a..17a0be604ff7f2954dcf2d4eeee7683adfce953e 100644 (file)
@@ -236,7 +236,7 @@ static const Field names_UDebugEnumType[] =
 #define COUNT_FAIL_CASE(x) case UDBG_##x: return -1;
 
 #define FIELD_CASE(x)  case UDBG_##x: return names_##x;
-#define FIELD_FAIL_CASE(x) case UDBG_##x: return NULL;
+#define FIELD_FAIL_CASE(x) case UDBG_##x: return nullptr;
 
 // low level
 
@@ -284,7 +284,7 @@ static const Field* _udbg_enumFields(UDebugEnumType type) {
         FIELD_CASE(UColAttributeValue)
 #endif
        default:
-               return NULL;
+               return nullptr;
        }
 }
 
@@ -301,11 +301,11 @@ int32_t  udbg_enumExpectedCount(UDebugEnumType type) {
 const char *  udbg_enumName(UDebugEnumType type, int32_t field) {
        if(field<0 ||
                                field>=_udbg_enumCount(type,false)) { // also will catch unsupported items
-               return NULL;
+               return nullptr;
        } else {
                const Field *fields = _udbg_enumFields(type);
-               if(fields == NULL) {
-                       return NULL;
+               if(fields == nullptr) {
+                       return nullptr;
                } else {
                        return fields[field].str + fields[field].prefix;
                }
@@ -318,7 +318,7 @@ int32_t  udbg_enumArrayValue(UDebugEnumType type, int32_t field) {
                return -1;
        } else {
                const Field *fields = _udbg_enumFields(type);
-               if(fields == NULL) {
+               if(fields == nullptr) {
                        return -1;
                } else {
                        return fields[field].num;
@@ -331,7 +331,7 @@ int32_t udbg_enumByName(UDebugEnumType type, const char *value) {
         return -1; // type out of range
     }
        const Field *fields = _udbg_enumFields(type);
-    if (fields != NULL) {
+    if (fields != nullptr) {
         for(int32_t field = 0;field<_udbg_enumCount(type, false);field++) {
             if(!strcmp(value, fields[field].str + fields[field].prefix)) {
                 return fields[field].num;
@@ -401,10 +401,10 @@ paramEmpty(const USystemParams * /* param */, char *target, int32_t targetCapaci
 
 U_CAPI  int32_t
 paramStatic(const USystemParams *param, char *target, int32_t targetCapacity, UErrorCode *status) {
-  if(param->paramStr==NULL) return paramEmpty(param,target,targetCapacity,status);
+  if(param->paramStr==nullptr) return paramEmpty(param,target,targetCapacity,status);
   if(U_FAILURE(*status))return 0;
   int32_t len = static_cast<int32_t>(uprv_strlen(param->paramStr));
-  if(target!=NULL) {
+  if(target!=nullptr) {
     uprv_strncpy(target,param->paramStr,uprv_min(len,targetCapacity));
   }
   return u_terminateChars(target, targetCapacity, len, status);
@@ -413,17 +413,17 @@ paramStatic(const USystemParams *param, char *target, int32_t targetCapacity, UE
 static const char *nullString = "(null)";
 
 static int32_t stringToStringBuffer(char *target, int32_t targetCapacity, const char *str, UErrorCode *status) {
-  if(str==NULL) str=nullString;
+  if(str==nullptr) str=nullString;
 
   int32_t len = static_cast<int32_t>(uprv_strlen(str));
   if (U_SUCCESS(*status)) {
-    if(target!=NULL) {
+    if(target!=nullptr) {
       uprv_strncpy(target,str,uprv_min(len,targetCapacity));
     }
   } else {
     const char *s = u_errorName(*status);
     len = static_cast<int32_t>(uprv_strlen(s));
-    if(target!=NULL) {
+    if(target!=nullptr) {
       uprv_strncpy(target,s,uprv_min(len,targetCapacity));
     }
   }
@@ -440,7 +440,7 @@ static int32_t integerToStringBuffer(char *target, int32_t targetCapacity, int32
 U_CAPI  int32_t
 paramInteger(const USystemParams *param, char *target, int32_t targetCapacity, UErrorCode *status) {
   if(U_FAILURE(*status))return 0;
-  if(param->paramStr==NULL || param->paramStr[0]=='d') {
+  if(param->paramStr==nullptr || param->paramStr[0]=='d') {
     return integerToStringBuffer(target,targetCapacity,param->paramInt, 10,status);
   } else if(param->paramStr[0]=='x') {
     return integerToStringBuffer(target,targetCapacity,param->paramInt, 16,status);
@@ -520,20 +520,20 @@ static const USystemParams systemParams[] = {
   { "version",      paramStatic, U_ICU_VERSION,0 },
   { "version.unicode", paramStatic, U_UNICODE_VERSION,0 },
   { "platform.number", paramInteger, "d",U_PLATFORM},
-  { "platform.type", paramPlatform, NULL ,0},
-  { "locale.default", paramLocaleDefault, NULL, 0},
-  { "locale.default.bcp47", paramLocaleDefaultBcp47, NULL, 0},
+  { "platform.type", paramPlatform, nullptr ,0},
+  { "locale.default", paramLocaleDefault, nullptr, 0},
+  { "locale.default.bcp47", paramLocaleDefaultBcp47, nullptr, 0},
 #if !UCONFIG_NO_CONVERSION
-  { "converter.default", paramConverterDefault, NULL, 0},
+  { "converter.default", paramConverterDefault, nullptr, 0},
 #endif
   { "icudata.name", paramStatic, U_ICUDATA_NAME, 0},
-  { "icudata.path", paramIcudataPath, NULL, 0},
+  { "icudata.path", paramIcudataPath, nullptr, 0},
 
-  { "cldr.version", paramCldrVersion, NULL, 0},
+  { "cldr.version", paramCldrVersion, nullptr, 0},
 
 #if !UCONFIG_NO_FORMATTING
-  { "tz.version", paramTimezoneVersion, NULL, 0},
-  { "tz.default", paramTimezoneDefault, NULL, 0},
+  { "tz.version", paramTimezoneVersion, nullptr, 0},
+  { "tz.default", paramTimezoneDefault, nullptr, 0},
 #endif
 
   { "cpu.bits",       paramInteger, "d", (sizeof(void*))*8},
@@ -567,7 +567,7 @@ U_CAPI const char *udbg_getSystemParameterNameByIndex(int32_t i) {
   if(i>=0 && i < (int32_t)U_SYSPARAM_COUNT) {
     return systemParams[i].paramName;
   } else {
-    return NULL;
+    return nullptr;
   }
 }
 
@@ -585,7 +585,7 @@ U_CAPI void udbg_writeIcuInfo(FILE *out) {
   /* todo: API for writing DTD? */
   fprintf(out, " <icuSystemParams type=\"icu4c\">\n");
   const char *paramName;
-  for(int32_t i=0;(paramName=udbg_getSystemParameterNameByIndex(i))!=NULL;i++) {
+  for(int32_t i=0;(paramName=udbg_getSystemParameterNameByIndex(i))!=nullptr;i++) {
     UErrorCode status2 = U_ZERO_ERROR;
     udbg_getSystemParameterValueByIndex(i, str,2000,&status2);
     if(U_SUCCESS(status2)) {
@@ -653,20 +653,20 @@ void KnownIssues::add(const char *ticketStr, const char *where, const UChar *msg
 {
   const std::string ticket = mapTicketId(ticketStr);
   if(fTable.find(ticket) == fTable.end()) {
-    if(firstForTicket!=NULL) *firstForTicket = true;
+    if(firstForTicket!=nullptr) *firstForTicket = true;
     fTable[ticket] = std::map < std::string, std::set < std::string > >();
   } else {
-    if(firstForTicket!=NULL) *firstForTicket = false;
+    if(firstForTicket!=nullptr) *firstForTicket = false;
   }
-  if(where==NULL) return;
+  if(where==nullptr) return;
 
   if(fTable[ticket].find(where) == fTable[ticket].end()) {
-    if(firstForWhere!=NULL) *firstForWhere = true;
+    if(firstForWhere!=nullptr) *firstForWhere = true;
     fTable[ticket][where] = std::set < std::string >();
   } else {
-    if(firstForWhere!=NULL) *firstForWhere = false;
+    if(firstForWhere!=nullptr) *firstForWhere = false;
   }
-  if(msg==NULL || !*msg) return;
+  if(msg==nullptr || !*msg) return;
 
   const icu::UnicodeString ustr(msg);
 
@@ -677,20 +677,20 @@ void KnownIssues::add(const char *ticketStr, const char *where, const char *msg,
 {
   const std::string ticket = mapTicketId(ticketStr);
   if(fTable.find(ticket) == fTable.end()) {
-    if(firstForTicket!=NULL) *firstForTicket = true;
+    if(firstForTicket!=nullptr) *firstForTicket = true;
     fTable[ticket] = std::map < std::string, std::set < std::string > >();
   } else {
-    if(firstForTicket!=NULL) *firstForTicket = false;
+    if(firstForTicket!=nullptr) *firstForTicket = false;
   }
-  if(where==NULL) return;
+  if(where==nullptr) return;
 
   if(fTable[ticket].find(where) == fTable[ticket].end()) {
-    if(firstForWhere!=NULL) *firstForWhere = true;
+    if(firstForWhere!=nullptr) *firstForWhere = true;
     fTable[ticket][where] = std::set < std::string >();
   } else {
-    if(firstForWhere!=NULL) *firstForWhere = false;
+    if(firstForWhere!=nullptr) *firstForWhere = false;
   }
-  if(msg==NULL || !*msg) return;
+  if(msg==nullptr || !*msg) return;
 
   std::string str(msg);
   fTable[ticket][where].insert(str);
@@ -732,7 +732,7 @@ UBool KnownIssues::print()
 U_CAPI void *udbg_knownIssue_openU(void *ptr, const char *ticket, char *where, const UChar *msg, UBool *firstForTicket,
                                    UBool *firstForWhere) {
   KnownIssues *t = static_cast<KnownIssues*>(ptr);
-  if(t==NULL) {
+  if(t==nullptr) {
     t = new KnownIssues();
   }
 
@@ -744,7 +744,7 @@ U_CAPI void *udbg_knownIssue_openU(void *ptr, const char *ticket, char *where, c
 U_CAPI void *udbg_knownIssue_open(void *ptr, const char *ticket, char *where, const char *msg, UBool *firstForTicket,
                                    UBool *firstForWhere) {
   KnownIssues *t = static_cast<KnownIssues*>(ptr);
-  if(t==NULL) {
+  if(t==nullptr) {
     t = new KnownIssues();
   }
 
@@ -755,7 +755,7 @@ U_CAPI void *udbg_knownIssue_open(void *ptr, const char *ticket, char *where, co
 
 U_CAPI UBool udbg_knownIssue_print(void *ptr) {
   KnownIssues *t = static_cast<KnownIssues*>(ptr);
-  if(t==NULL) {
+  if(t==nullptr) {
     return false;
   } else {
     t->print();
index 43ff16b6eec8c5b7c3dd37196ec66397c646a9e4..03d729fe8580b636fda3a90e81855a03af7a0bf7 100644 (file)
@@ -43,18 +43,18 @@ udata_create(const char *dir, const char *type, const char *name,
     uint8_t bytes[16];
     int32_t length;
 
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
-        return NULL;
-    } else if(name==NULL || *name==0 || pInfo==NULL) {
+    if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
+        return nullptr;
+    } else if(name==nullptr || *name==0 || pInfo==nullptr) {
         *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     /* allocate the data structure */
     pData=(UNewDataMemory *)uprv_malloc(sizeof(UNewDataMemory));
-    if(pData==NULL) {
+    if(pData==nullptr) {
         *pErrorCode=U_MEMORY_ALLOCATION_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     char dirSepChar = U_FILE_SEP_CHAR;
@@ -69,7 +69,7 @@ udata_create(const char *dir, const char *type, const char *name,
 
     /* Check that the full path won't be too long */
     length = 0;                                        /* Start with nothing */
-    if(dir != NULL  && *dir !=0)       /* Add directory length if one was given */
+    if(dir != nullptr  && *dir !=0)    /* Add directory length if one was given */
     {
        length += static_cast<int32_t>(strlen(dir));
 
@@ -80,7 +80,7 @@ udata_create(const char *dir, const char *type, const char *name,
        }
     length += static_cast<int32_t>(strlen(name));              /* Add the filename length */
 
-    if(type != NULL  && *type !=0) { /* Add directory length if  given */
+    if(type != nullptr  && *type !=0) { /* Add directory length if  given */
         length += static_cast<int32_t>(strlen(type));
     }
 
@@ -90,11 +90,11 @@ udata_create(const char *dir, const char *type, const char *name,
     {
            *pErrorCode = U_BUFFER_OVERFLOW_ERROR;
            uprv_free(pData);
-           return NULL;
+           return nullptr;
     }
 
     /* open the output file */
-    if(dir!=NULL && *dir!=0) { /* if dir has a value, we prepend it to the filename */
+    if(dir!=nullptr && *dir!=0) { /* if dir has a value, we prepend it to the filename */
         char *p=filename+strlen(dir);
         uprv_strcpy(filename, dir);
         if (*(p-1)!=dirSepChar) {
@@ -105,20 +105,20 @@ udata_create(const char *dir, const char *type, const char *name,
         filename[0]=0;
     }
     uprv_strcat(filename, name);
-    if(type!=NULL && *type!=0) {
+    if(type!=nullptr && *type!=0) {
         uprv_strcat(filename, ".");
         uprv_strcat(filename, type);
     }
     pData->file=T_FileStream_open(filename, "wb");
-    if(pData->file==NULL) {
+    if(pData->file==nullptr) {
         uprv_free(pData);
         *pErrorCode=U_FILE_ACCESS_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     /* write the header information */
     headerSize=(uint16_t)(pInfo->size+4);
-    if(comment!=NULL && *comment!=0) {
+    if(comment!=nullptr && *comment!=0) {
         commentLength=(uint16_t)(uprv_strlen(comment)+1);
         headerSize+=commentLength;
     } else {
@@ -154,12 +154,12 @@ U_CAPI uint32_t U_EXPORT2
 udata_finish(UNewDataMemory *pData, UErrorCode *pErrorCode) {
     uint32_t fileLength=0;
 
-    if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
+    if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
         return 0;
     }
 
-    if(pData!=NULL) {
-        if(pData->file!=NULL) {
+    if(pData!=nullptr) {
+        if(pData->file!=nullptr) {
             /* fflush(pData->file);*/
             fileLength=T_FileStream_size(pData->file);
             if(T_FileStream_error(pData->file)) {
@@ -193,7 +193,7 @@ static const UDataInfo dummyDataInfo = {
 U_CAPI void U_EXPORT2
 udata_createDummy(const char *dir, const char *type, const char *name, UErrorCode *pErrorCode) {
     if(U_SUCCESS(*pErrorCode)) {
-        udata_finish(udata_create(dir, type, name, &dummyDataInfo, NULL, pErrorCode), pErrorCode);
+        udata_finish(udata_create(dir, type, name, &dummyDataInfo, nullptr, pErrorCode), pErrorCode);
         if(U_FAILURE(*pErrorCode)) {
             fprintf(stderr, "error %s writing dummy data file %s" U_FILE_SEP_STRING "%s.%s\n",
                     u_errorName(*pErrorCode), dir, name, type);
@@ -204,28 +204,28 @@ udata_createDummy(const char *dir, const char *type, const char *name, UErrorCod
 
 U_CAPI void U_EXPORT2
 udata_write8(UNewDataMemory *pData, uint8_t byte) {
-    if(pData!=NULL && pData->file!=NULL) {
+    if(pData!=nullptr && pData->file!=nullptr) {
         T_FileStream_write(pData->file, &byte, 1);
     }
 }
 
 U_CAPI void U_EXPORT2
 udata_write16(UNewDataMemory *pData, uint16_t word) {
-    if(pData!=NULL && pData->file!=NULL) {
+    if(pData!=nullptr && pData->file!=nullptr) {
         T_FileStream_write(pData->file, &word, 2);
     }
 }
 
 U_CAPI void U_EXPORT2
 udata_write32(UNewDataMemory *pData, uint32_t wyde) {
-    if(pData!=NULL && pData->file!=NULL) {
+    if(pData!=nullptr && pData->file!=nullptr) {
         T_FileStream_write(pData->file, &wyde, 4);
     }
 }
 
 U_CAPI void U_EXPORT2
 udata_writeBlock(UNewDataMemory *pData, const void *s, int32_t length) {
-    if(pData!=NULL && pData->file!=NULL) {
+    if(pData!=nullptr && pData->file!=nullptr) {
         if(length>0) {
             T_FileStream_write(pData->file, s, length);
         }
@@ -240,7 +240,7 @@ udata_writePadding(UNewDataMemory *pData, int32_t length) {
         0xaa, 0xaa, 0xaa, 0xaa,
         0xaa, 0xaa, 0xaa, 0xaa
     };
-    if(pData!=NULL && pData->file!=NULL) {
+    if(pData!=nullptr && pData->file!=nullptr) {
         while(length>=16) {
             T_FileStream_write(pData->file, padding, 16);
             length-=16;
@@ -253,7 +253,7 @@ udata_writePadding(UNewDataMemory *pData, int32_t length) {
 
 U_CAPI void U_EXPORT2
 udata_writeString(UNewDataMemory *pData, const char *s, int32_t length) {
-    if(pData!=NULL && pData->file!=NULL) {
+    if(pData!=nullptr && pData->file!=nullptr) {
         if(length==-1) {
             length=(int32_t)uprv_strlen(s);
         }
@@ -265,7 +265,7 @@ udata_writeString(UNewDataMemory *pData, const char *s, int32_t length) {
 
 U_CAPI void U_EXPORT2
 udata_writeUString(UNewDataMemory *pData, const UChar *s, int32_t length) {
-    if(pData!=NULL && pData->file!=NULL) {
+    if(pData!=nullptr && pData->file!=nullptr) {
         if(length==-1) {
             length=u_strlen(s);
         }
index 53a77bcc4cc7628dfaea7e7f32f0c9475fd55c30..808164ae4db6f368eb53b52e0f2627fb63544d9b 100644 (file)
@@ -33,7 +33,7 @@ u_parseArgs(int argc, char* argv[],
         arg=argv[i];
         if(!stopOptions && *arg=='-' && (c=arg[1])!=0) {
             /* process an option */
-            UOption *option=NULL;
+            UOption *option=nullptr;
             arg+=2;
             if(c=='-') {
                 /* process a long option */
@@ -49,7 +49,7 @@ u_parseArgs(int argc, char* argv[],
                             break;
                         }
                     }
-                    if(option==NULL) {
+                    if(option==nullptr) {
                         /* no option matches */
                         return -i;
                     }
@@ -67,7 +67,7 @@ u_parseArgs(int argc, char* argv[],
                         }
                     }
 
-                    if(option->optionFn!=NULL && option->optionFn(option->context, option)<0) {
+                    if(option->optionFn!=nullptr && option->optionFn(option->context, option)<0) {
                         /* the option function was called and returned an error */
                         option->doesOccur=0;
                         return -i;
@@ -84,7 +84,7 @@ u_parseArgs(int argc, char* argv[],
                             break;
                         }
                     }
-                    if(option==NULL) {
+                    if(option==nullptr) {
                         /* no option matches */
                         return -i;
                     }
@@ -109,14 +109,14 @@ u_parseArgs(int argc, char* argv[],
                         }
                     }
 
-                    if(option->optionFn!=NULL && option->optionFn(option->context, option)<0) {
+                    if(option->optionFn!=nullptr && option->optionFn(option->context, option)<0) {
                         /* the option function was called and returned an error */
                         option->doesOccur=0;
                         return -i;
                     }
 
                     /* get the next option letter */
-                    option=NULL;
+                    option=nullptr;
                     c=*arg++;
                 } while(c!=0);
             }
index 486fcc9a98530ec8cb2d3c38957cd5624d55b07c..76bd2629f9a13e83747e05e9749d7028f80eab95 100644 (file)
@@ -85,23 +85,23 @@ u_parseDelimitedFile(const char *filename, char delimiter,
         return;
     }
 
-    if(fields==NULL || lineFn==NULL || fieldCount<=0) {
+    if(fields==nullptr || lineFn==nullptr || fieldCount<=0) {
         *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
         return;
     }
 
-    if(filename==NULL || *filename==0 || (*filename=='-' && filename[1]==0)) {
-        filename=NULL;
+    if(filename==nullptr || *filename==0 || (*filename=='-' && filename[1]==0)) {
+        filename=nullptr;
         file=T_FileStream_stdin();
     } else {
         file=T_FileStream_open(filename, "r");
     }
-    if(file==NULL) {
+    if(file==nullptr) {
         *pErrorCode=U_FILE_ACCESS_ERROR;
         return;
     }
 
-    while(T_FileStream_readLine(file, line, sizeof(line))!=NULL) {
+    while(T_FileStream_readLine(file, line, sizeof(line))!=nullptr) {
         /* remove trailing newline characters */
         length=(int32_t)(u_rtrim(line)-line);
 
@@ -124,7 +124,7 @@ u_parseDelimitedFile(const char *filename, char delimiter,
 
         /* remove in-line comments */
         limit=uprv_strchr(start, '#');
-        if(limit!=NULL) {
+        if(limit!=nullptr) {
             /* get white space before the pound sign */
             while(limit>start && U_IS_INV_WHITESPACE(*(limit-1))) {
                 --limit;
@@ -175,7 +175,7 @@ u_parseDelimitedFile(const char *filename, char delimiter,
         }
     }
 
-    if(filename!=NULL) {
+    if(filename!=nullptr) {
         T_FileStream_close(file);
     }
 }
@@ -196,7 +196,7 @@ u_parseCodePoints(const char *s,
     if(U_FAILURE(*pErrorCode)) {
         return 0;
     }
-    if(s==NULL || destCapacity<0 || (destCapacity>0 && dest==NULL)) {
+    if(s==nullptr || destCapacity<0 || (destCapacity>0 && dest==nullptr)) {
         *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
@@ -245,12 +245,12 @@ u_parseString(const char *s,
     if(U_FAILURE(*pErrorCode)) {
         return 0;
     }
-    if(s==NULL || destCapacity<0 || (destCapacity>0 && dest==NULL)) {
+    if(s==nullptr || destCapacity<0 || (destCapacity>0 && dest==nullptr)) {
         *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
 
-    if(pFirst!=NULL) {
+    if(pFirst!=nullptr) {
         *pFirst=0xffffffff;
     }
 
@@ -276,9 +276,9 @@ u_parseString(const char *s,
         }
 
         /* store the first code point */
-        if(pFirst!=NULL) {
+        if(pFirst!=nullptr) {
             *pFirst=value;
-            pFirst=NULL;
+            pFirst=nullptr;
         }
 
         /* append it to the destination array */
@@ -305,7 +305,7 @@ u_parseCodePointRangeAnyTerminator(const char *s,
     if(U_FAILURE(*pErrorCode)) {
         return 0;
     }
-    if(s==NULL || pStart==NULL || pEnd==NULL) {
+    if(s==nullptr || pStart==nullptr || pEnd==nullptr) {
         *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
index faf808c2c50bee19b9d9f1ae8473c56eaeb4a3e0..9355957590c0849e1cac349e9cec6650a4312e78 100644 (file)
@@ -58,7 +58,7 @@ usrc_createWithoutHeader(const char *path, const char *filename) {
     FILE *f;
     char c;
 
-    if(path==NULL) {
+    if(path==nullptr) {
         p=filename;
     } else {
         /* concatenate path and filename, with U_FILE_SEP_CHAR in between if necessary */
@@ -72,11 +72,11 @@ usrc_createWithoutHeader(const char *path, const char *filename) {
     }
 
     f=fopen(p, "w");
-    if (f==NULL) {
+    if (f==nullptr) {
         fprintf(
             stderr,
             "usrc_create(%s, %s): unable to create file\n",
-            path!=NULL ? path : "", filename);
+            path!=nullptr ? path : "", filename);
     }
     return f;
 }
@@ -84,7 +84,7 @@ usrc_createWithoutHeader(const char *path, const char *filename) {
 U_CAPI FILE * U_EXPORT2
 usrc_create(const char *path, const char *filename, int32_t copyrightYear, const char *generator) {
     FILE *f = usrc_createWithoutHeader(path, filename);
-    if (f == NULL) {
+    if (f == nullptr) {
         return f;
     }
     usrc_writeCopyrightHeader(f, "//", copyrightYear);
@@ -95,7 +95,7 @@ usrc_create(const char *path, const char *filename, int32_t copyrightYear, const
 U_CAPI FILE * U_EXPORT2
 usrc_createTextData(const char *path, const char *filename, int32_t copyrightYear, const char *generator) {
     FILE *f = usrc_createWithoutHeader(path, filename);
-    if (f == NULL) {
+    if (f == nullptr) {
         return f;
     }
     usrc_writeCopyrightHeader(f, "#", copyrightYear);
@@ -136,7 +136,7 @@ usrc_writeFileNameGeneratedBy(
 
     time(&t);
     lt=localtime(&t);
-    if(generator==NULL) {
+    if(generator==nullptr) {
         strftime(buffer, sizeof(buffer), "%Y-%m-%d", lt);
         fprintf(f, pattern, prefix, prefix, filename, prefix, prefix, buffer);
     } else {
@@ -157,10 +157,10 @@ usrc_writeArray(FILE *f,
     int64_t value; // Signed due to TOML!
     int32_t i, col;
 
-    p8=NULL;
-    p16=NULL;
-    p32=NULL;
-    p64=NULL;
+    p8=nullptr;
+    p16=nullptr;
+    p32=nullptr;
+    p64=nullptr;
     switch(width) {
     case 8:
         p8=(const uint8_t *)p;
@@ -178,7 +178,7 @@ usrc_writeArray(FILE *f,
         fprintf(stderr, "usrc_writeArray(width=%ld) unrecognized width\n", (long)width);
         return;
     }
-    if(prefix!=NULL) {
+    if(prefix!=nullptr) {
         fprintf(f, prefix, (long)length);
     }
     for(i=col=0; i<length; ++i, ++col) {
@@ -210,7 +210,7 @@ usrc_writeArray(FILE *f,
         }
         fprintf(f, value<=9 ? "%" PRId64 : "0x%" PRIx64, value);
     }
-    if(postfix!=NULL) {
+    if(postfix!=nullptr) {
         fputs(postfix, f);
     }
 }
@@ -220,7 +220,7 @@ usrc_writeUTrie2Arrays(FILE *f,
                        const char *indexPrefix, const char *data32Prefix,
                        const UTrie2 *pTrie,
                        const char *postfix) {
-    if(pTrie->data32==NULL) {
+    if(pTrie->data32==nullptr) {
         /* 16-bit trie */
         usrc_writeArray(f, indexPrefix, pTrie->index, 16, pTrie->indexLength+pTrie->dataLength, "", postfix);
     } else {
@@ -236,16 +236,16 @@ usrc_writeUTrie2Struct(FILE *f,
                        const UTrie2 *pTrie,
                        const char *indexName, const char *data32Name,
                        const char *postfix) {
-    if(prefix!=NULL) {
+    if(prefix!=nullptr) {
         fputs(prefix, f);
     }
-    if(pTrie->data32==NULL) {
+    if(pTrie->data32==nullptr) {
         /* 16-bit trie */
         fprintf(
             f,
             "    %s,\n"         /* index */
             "    %s+%ld,\n"     /* data16 */
-            "    NULL,\n",      /* data32 */
+            "    nullptr,\n",      /* data32 */
             indexName,
             indexName, 
             (long)pTrie->indexLength);
@@ -254,7 +254,7 @@ usrc_writeUTrie2Struct(FILE *f,
         fprintf(
             f,
             "    %s,\n"         /* index */
-            "    NULL,\n"       /* data16 */
+            "    nullptr,\n"       /* data16 */
             "    %s,\n",        /* data32 */
             indexName,
             data32Name);
@@ -269,12 +269,12 @@ usrc_writeUTrie2Struct(FILE *f,
         "    0x%lx,\n"          /* errorValue */
         "    0x%lx,\n"          /* highStart */
         "    0x%lx,\n"          /* highValueIndex */
-        "    NULL, 0, false, false, 0, NULL\n",
+        "    nullptr, 0, false, false, 0, nullptr\n",
         (long)pTrie->indexLength, (long)pTrie->dataLength,
         (short)pTrie->index2NullOffset, (short)pTrie->dataNullOffset,
         (long)pTrie->initialValue, (long)pTrie->errorValue,
         (long)pTrie->highStart, (long)pTrie->highValueIndex);
-    if(postfix!=NULL) {
+    if(postfix!=nullptr) {
         fputs(postfix, f);
     }
 }
@@ -301,7 +301,7 @@ usrc_writeUCPTrieStruct(FILE *f,
                         const char *indexName, const char *dataName,
                         const char *postfix,
                         UTargetSyntax syntax) {
-    if(prefix!=NULL) {
+    if(prefix!=nullptr) {
         fputs(prefix, f);
     }
     if (syntax == UPRV_TARGET_SYNTAX_CCODE) {
@@ -339,7 +339,7 @@ usrc_writeUCPTrieStruct(FILE *f,
         pTrie->type, pTrie->valueWidth,
         pTrie->index3NullOffset, (long)pTrie->dataNullOffset,
         (long)pTrie->nullValue);
-    if(postfix!=NULL) {
+    if(postfix!=nullptr) {
         fputs(postfix, f);
     }
 }
@@ -456,7 +456,7 @@ usrc_writeArrayOfMostlyInvChars(FILE *f,
     int32_t i, col;
     int prev2, prev, c;
 
-    if(prefix!=NULL) {
+    if(prefix!=nullptr) {
         fprintf(f, prefix, (long)length);
     }
     prev2=prev=-1;
@@ -482,7 +482,7 @@ usrc_writeArrayOfMostlyInvChars(FILE *f,
         prev2=prev;
         prev=c;
     }
-    if(postfix!=NULL) {
+    if(postfix!=nullptr) {
         fputs(postfix, f);
     }
 }
index 104a99c93e7976971eaccf7057b44c838232f0e4..c61c89643f2cb7634e593309b8989b83645c5fa2 100644 (file)
@@ -153,7 +153,7 @@ UXMLParser::UXMLParser(UErrorCode &status) :
 UXMLParser *
 UXMLParser::createParser(UErrorCode &errorCode) {
     if (U_FAILURE(errorCode)) {
-        return NULL;
+        return nullptr;
     } else {
         return new UXMLParser(errorCode);
     }
@@ -173,13 +173,13 @@ UXMLParser::parseFile(const char *filename, UErrorCode &errorCode) {
     UBool flush;
 
     if(U_FAILURE(errorCode)) {
-        return NULL;
+        return nullptr;
     }
 
     f=T_FileStream_open(filename, "rb");
-    if(f==NULL) {
+    if(f==nullptr) {
         errorCode=U_FILE_ACCESS_ERROR;
-        return NULL;
+        return nullptr;
     }
 
     bytesLength=T_FileStream_read(f, bytes, (int32_t)sizeof(bytes));
@@ -197,8 +197,8 @@ UXMLParser::parseFile(const char *filename, UErrorCode &errorCode) {
      * 2. treat as ISO-8859-1 and read XML encoding="charser"
      * 3. default to UTF-8
      */
-    charset=ucnv_detectUnicodeSignature(bytes, bytesLength, NULL, &errorCode);
-    if(U_SUCCESS(errorCode) && charset!=NULL) {
+    charset=ucnv_detectUnicodeSignature(bytes, bytesLength, nullptr, &errorCode);
+    if(U_SUCCESS(errorCode) && charset!=nullptr) {
         // open converter according to Unicode signature
         cnv=ucnv_open(charset, &errorCode);
     } else {
@@ -210,7 +210,7 @@ UXMLParser::parseFile(const char *filename, UErrorCode &errorCode) {
         }
 
         buffer=toUCharPtr(src.getBuffer(bytesLength));
-        if(buffer==NULL) {
+        if(buffer==nullptr) {
             // unexpected failure to reserve some string capacity
             errorCode=U_MEMORY_ALLOCATION_ERROR;
             goto exit;
@@ -221,10 +221,10 @@ UXMLParser::parseFile(const char *filename, UErrorCode &errorCode) {
             cnv,
             &pu, buffer+src.getCapacity(),
             &pb, bytes+bytesLength,
-            NULL, true, &errorCode);
+            nullptr, true, &errorCode);
         src.releaseBuffer(U_SUCCESS(errorCode) ? (int32_t)(pu-buffer) : 0);
         ucnv_close(cnv);
-        cnv=NULL;
+        cnv=nullptr;
         if(U_FAILURE(errorCode)) {
             // unexpected error in conversion from Latin-1
             src.remove();
@@ -255,7 +255,7 @@ UXMLParser::parseFile(const char *filename, UErrorCode &errorCode) {
                 pos = mAttrValue.end(2, errorCode);
             }
 
-            if(charset==NULL) {
+            if(charset==nullptr) {
                 // default to UTF-8
                 charset="UTF-8";
             }
@@ -279,7 +279,7 @@ UXMLParser::parseFile(const char *filename, UErrorCode &errorCode) {
         for(;;) {
             length=src.length();
             buffer=toUCharPtr(src.getBuffer(capacity));
-            if(buffer==NULL) {
+            if(buffer==nullptr) {
                 // unexpected failure to reserve some string capacity
                 errorCode=U_MEMORY_ALLOCATION_ERROR;
                 goto exit;
@@ -289,7 +289,7 @@ UXMLParser::parseFile(const char *filename, UErrorCode &errorCode) {
             ucnv_toUnicode(
                 cnv, &pu, buffer+src.getCapacity(),
                 &pb, bytes+bytesLength,
-                NULL, false, &errorCode);
+                nullptr, false, &errorCode);
             src.releaseBuffer(U_SUCCESS(errorCode) ? (int32_t)(pu-buffer) : 0);
             if(errorCode==U_BUFFER_OVERFLOW_ERROR) {
                 errorCode=U_ZERO_ERROR;
@@ -322,17 +322,17 @@ exit:
     if(U_SUCCESS(errorCode)) {
         return parse(src, errorCode);
     } else {
-        return NULL;
+        return nullptr;
     }
 }
 
 UXMLElement *
 UXMLParser::parse(const UnicodeString &src, UErrorCode &status) {
     if(U_FAILURE(status)) {
-        return NULL;
+        return nullptr;
     }
 
-    UXMLElement   *root = NULL;
+    UXMLElement   *root = nullptr;
     fPos = 0; // TODO use just a local pos variable and pass it into functions
               // where necessary?
 
@@ -435,7 +435,7 @@ UXMLParser::parse(const UnicodeString &src, UErrorCode &status) {
                 }
                 if (fElementStack.empty()) {
                     // Close of the root element.  We're done with the doc.
-                    el = NULL;
+                    el = nullptr;
                     break;
                 }
                 el = (UXMLElement *)fElementStack.pop();
@@ -455,7 +455,7 @@ UXMLParser::parse(const UnicodeString &src, UErrorCode &status) {
             break;
         }
 
-        if (el != NULL || !fElementStack.empty()) {
+        if (el != nullptr || !fElementStack.empty()) {
             // We bailed out early, for some reason.
             error("Root element not closed.", status);
             goto errorExit;
@@ -477,7 +477,7 @@ UXMLParser::parse(const UnicodeString &src, UErrorCode &status) {
 
 errorExit:
     delete root;
-    return NULL;
+    return nullptr;
 }
 
 //
@@ -653,7 +653,7 @@ UXMLParser::error(const char *message, UErrorCode &status) {
 const UnicodeString *
 UXMLParser::intern(const UnicodeString &s, UErrorCode &errorCode) {
     const UHashElement *he=fNames.find(s);
-    if(he!=NULL) {
+    if(he!=nullptr) {
         // already a known name, return its hashed key pointer
         return (const UnicodeString *)he->key.pointer;
     } else {
@@ -667,12 +667,12 @@ UXMLParser::intern(const UnicodeString &s, UErrorCode &errorCode) {
 const UnicodeString *
 UXMLParser::findName(const UnicodeString &s) const {
     const UHashElement *he=fNames.find(s);
-    if(he!=NULL) {
+    if(he!=nullptr) {
         // a known name, return its hashed key pointer
         return (const UnicodeString *)he->key.pointer;
     } else {
         // unknown name
-        return NULL;
+        return nullptr;
     }
 }
 
@@ -684,7 +684,7 @@ UXMLElement::UXMLElement(const UXMLParser *parser, const UnicodeString *name, UE
    fAttNames(errorCode),
    fAttValues(errorCode),
    fChildren(errorCode),
-   fParent(NULL)
+   fParent(nullptr)
 {
 }
 
@@ -718,7 +718,7 @@ UXMLElement::appendText(UnicodeString &text, UBool recurse) const {
     for(i=0; i<count; ++i) {
         node=(const UObject *)fChildren.elementAt(i);
         const UnicodeString *s=dynamic_cast<const UnicodeString *>(node);
-        if(s!=NULL) {
+        if(s!=nullptr) {
             text.append(*s);
         } else if(recurse) /* must be a UXMLElement */ {
             ((const UXMLElement *)node)->appendText(text, recurse);
@@ -738,7 +738,7 @@ UXMLElement::getAttribute(int32_t i, UnicodeString &name, UnicodeString &value)
         value.setTo(*(const UnicodeString *)fAttValues.elementAt(i));
         return &value; // or return (UnicodeString *)fAttValues.elementAt(i);
     } else {
-        return NULL;
+        return nullptr;
     }
 }
 
@@ -747,8 +747,8 @@ UXMLElement::getAttribute(const UnicodeString &name) const {
     // search for the attribute name by comparing the interned pointer,
     // not the string contents
     const UnicodeString *p=fParser->findName(name);
-    if(p==NULL) {
-        return NULL; // no such attribute seen by the parser at all
+    if(p==nullptr) {
+        return nullptr; // no such attribute seen by the parser at all
     }
 
     int32_t i, count=fAttNames.size();
@@ -757,7 +757,7 @@ UXMLElement::getAttribute(const UnicodeString &name) const {
             return (const UnicodeString *)fAttValues.elementAt(i);
         }
     }
-    return NULL;
+    return nullptr;
 }
 
 int32_t
@@ -769,21 +769,21 @@ const UObject *
 UXMLElement::getChild(int32_t i, UXMLNodeType &type) const {
     if(0<=i && i<fChildren.size()) {
         const UObject *node=(const UObject *)fChildren.elementAt(i);
-        if(dynamic_cast<const UXMLElement *>(node)!=NULL) {
+        if(dynamic_cast<const UXMLElement *>(node)!=nullptr) {
             type=UXML_NODE_TYPE_ELEMENT;
         } else {
             type=UXML_NODE_TYPE_STRING;
         }
         return node;
     } else {
-        return NULL;
+        return nullptr;
     }
 }
 
 const UXMLElement *
 UXMLElement::nextChildElement(int32_t &i) const {
     if(i<0) {
-        return NULL;
+        return nullptr;
     }
 
     const UObject *node;
@@ -791,11 +791,11 @@ UXMLElement::nextChildElement(int32_t &i) const {
     while(i<count) {
         node=(const UObject *)fChildren.elementAt(i++);
         const UXMLElement *elem=dynamic_cast<const UXMLElement *>(node);
-        if(elem!=NULL) {
+        if(elem!=nullptr) {
             return elem;
         }
     }
-    return NULL;
+    return nullptr;
 }
 
 const UXMLElement *
@@ -803,8 +803,8 @@ UXMLElement::getChildElement(const UnicodeString &name) const {
     // search for the element name by comparing the interned pointer,
     // not the string contents
     const UnicodeString *p=fParser->findName(name);
-    if(p==NULL) {
-        return NULL; // no such element seen by the parser at all
+    if(p==nullptr) {
+        return nullptr; // no such element seen by the parser at all
     }
 
     const UObject *node;
@@ -812,13 +812,13 @@ UXMLElement::getChildElement(const UnicodeString &name) const {
     for(i=0; i<count; ++i) {
         node=(const UObject *)fChildren.elementAt(i);
         const UXMLElement *elem=dynamic_cast<const UXMLElement *>(node);
-        if(elem!=NULL) {
+        if(elem!=nullptr) {
             if(p==elem->fName) {
                 return elem;
             }
         }
     }
-    return NULL;
+    return nullptr;
 }
 
 U_NAMESPACE_END
index 7f798f66f77010ae5d408d8655fb2a0c808d8540..d0dcd9a48a2a044af285ae196332a6845ce63516 100644 (file)
@@ -76,13 +76,13 @@ public:
      * @param name Output parameter, receives the attribute name.
      * @param value Output parameter, receives the attribute value.
      * @return A pointer to the attribute value (may be &value or a pointer to an
-     *         internal string object), or NULL if i is out of bounds.
+     *         internal string object), or nullptr if i is out of bounds.
      */
     const UnicodeString *getAttribute(int32_t i, UnicodeString &name, UnicodeString &value) const;
     /**
      * Get the value of the attribute with the given name.
      * @param name Attribute name to be looked up.
-     * @return A pointer to the attribute value, or NULL if this element
+     * @return A pointer to the attribute value, or nullptr if this element
      * does not have this attribute.
      */
     const UnicodeString *getAttribute(const UnicodeString &name) const;
@@ -94,13 +94,13 @@ public:
      * Get the i-th child node.
      * @param i Index of the child node.
      * @param type The child node type.
-     * @return A pointer to the child node object, or NULL if i is out of bounds.
+     * @return A pointer to the child node object, or nullptr if i is out of bounds.
      */
     const UObject *getChild(int32_t i, UXMLNodeType &type) const;
     /**
      * Get the next child element node, skipping non-element child nodes.
      * @param i Enumeration index; initialize to 0 before getting the first child element.
-     * @return A pointer to the next child element, or NULL if there is none.
+     * @return A pointer to the next child element, or nullptr if there is none.
      */
     const UXMLElement *nextChildElement(int32_t &i) const;
     /**
@@ -108,7 +108,7 @@ public:
      * If there are multiple child elements with this name, then return
      * the first one.
      * @param name Element name to be looked up.
-     * @return A pointer to the element node, or NULL if this element
+     * @return A pointer to the element node, or nullptr if this element
      * does not have this immediate child element.
      */
     const UXMLElement *getChildElement(const UnicodeString &name) const;
index 78d84ff445adca81dc6caac5708cd62c55ea8aaa..c82fc4337320756a5b5e20a195026f89ab65629f 100644 (file)
@@ -98,7 +98,7 @@ public:
         loyear = 1902;
         hiyear = 2050;
         tick = 1000;
-        linesep = NULL;
+        linesep = nullptr;
     }
 
     ~ICUZDump() {
@@ -176,7 +176,7 @@ public:
                 str.remove();
                 formatter->format(hit, newRawOffset + newDstOffset, (newDstOffset == 0 ? false : true), str);
                 out << str;
-                if (linesep != NULL) {
+                if (linesep != nullptr) {
                     out << linesep;
                 } else {
                     out << endl;
@@ -218,38 +218,38 @@ public:
             // TODO: Add error case handling later.
         }
         else {
-            zenum = NULL;
-            zids = NULL;
+            zenum = nullptr;
+            zids = nullptr;
             idx = 0;
             numids = 1;
         }
     }
 
     ZoneIterator(const char** ids, int32_t num) {
-        zenum = NULL;
+        zenum = nullptr;
         zids = ids;
         idx = 0;
         numids = num;
     }
 
     ~ZoneIterator() {
-        if (zenum != NULL) {
+        if (zenum != nullptr) {
             delete zenum;
         }
     }
 
     TimeZone* next() {
-        TimeZone* tz = NULL;
-        if (zenum != NULL) {
+        TimeZone* tz = nullptr;
+        if (zenum != nullptr) {
             UErrorCode status = U_ZERO_ERROR;
             const UnicodeString* zid = zenum->snext(status);
-            if (zid != NULL) {
+            if (zid != nullptr) {
                 tz = TimeZone::createTimeZone(*zid);
             }
         }
         else {
             if (idx < numids) {
-                if (zids != NULL) {
+                if (zids != nullptr) {
                     tz = TimeZone::createTimeZone((const UnicodeString&)zids[idx]);
                 }
                 else {
@@ -291,8 +291,8 @@ main(int argc, char *argv[]) {
     int32_t low = 1902;
     int32_t high = 2038;
     UBool bAll = false;
-    const char *dir = NULL;
-    const char *linesep = NULL;
+    const char *dir = nullptr;
+    const char *linesep = nullptr;
 
     U_MAIN_INIT_ARGS(argc, argv);
     argc = u_parseArgs(argc, argv, UPRV_LENGTHOF(options), options);
@@ -338,7 +338,7 @@ main(int argc, char *argv[]) {
 
     if (options[kOptCutover].doesOccur) {
         char* comma = (char*)strchr(options[kOptCutover].value, ',');
-        if (comma == NULL) {
+        if (comma == nullptr) {
             high = atoi(options[kOptCutover].value);
         } else {
             *comma = 0;
@@ -350,7 +350,7 @@ main(int argc, char *argv[]) {
     ICUZDump dumper;
     dumper.setLowYear(low);
     dumper.setHighYear(high);
-    if (dir != NULL && linesep != NULL) {
+    if (dir != nullptr && linesep != nullptr) {
         // use the specified line separator only for file output
         dumper.setLineSeparator((const char*)linesep);
     }
@@ -367,16 +367,16 @@ main(int argc, char *argv[]) {
     }
 
     UnicodeString id;
-    if (dir != NULL) {
+    if (dir != nullptr) {
         // file output
         ostringstream path;
         ios::openmode mode = ios::out;
-        if (linesep != NULL) {
+        if (linesep != nullptr) {
             mode |= ios::binary;
         }
         for (;;) {
             TimeZone* tz = zit->next();
-            if (tz == NULL) {
+            if (tz == nullptr) {
                 break;
             }
             dumper.setTimeZone(tz);
@@ -407,7 +407,7 @@ main(int argc, char *argv[]) {
         UBool bFirst = true;
         for (;;) {
             TimeZone* tz = zit->next();
-            if (tz == NULL) {
+            if (tz == nullptr) {
                 break;
             }
             dumper.setTimeZone(tz);
index fada95d79ac8955ff880bd5dfef053ebc50e8983..0adb1bdeb344006b031e7658ec7d2fb42bf98716 100644 (file)
@@ -650,7 +650,7 @@ void scandir(string dir, string prefix="") {
     vector<string> subdirs;
     vector<string> subfiles;
 
-    if ((dp = opendir(dir.c_str())) == NULL) {
+    if ((dp = opendir(dir.c_str())) == nullptr) {
         cerr << "Error: Invalid directory: " << dir << endl;
         exit(1);
     }
@@ -659,7 +659,7 @@ void scandir(string dir, string prefix="") {
         exit(1);
     }
     chdir(dir.c_str());
-    while ((dir_entry = readdir(dp)) != NULL) {
+    while ((dir_entry = readdir(dp)) != nullptr) {
         string name = dir_entry->d_name;
         string path = dir + "/" + name;
         lstat(dir_entry->d_name,&stat_info);
index 635ef748221c0bc2eb91c5dd64ae27ffc5ca39bd..2d55efd623f5448c7448fb58e89e4e5758cc871d 100644 (file)
@@ -86,13 +86,13 @@ CompareFn gComparer;
 
 const UChar separatorChar = 0x0030;
 
-UFILE *out = NULL;
-UFILE *err = NULL;
-UFILE *log = NULL
+UFILE *out = nullptr;
+UFILE *err = nullptr;
+UFILE *log = nullptr
 
 const char *progName = "colprobe";
 
-const char *gLocale = NULL;
+const char *gLocale = nullptr;
 //char platform[256];
 int32_t platformIndex = -1;
 int32_t gPlatformNo = 0;
@@ -236,7 +236,7 @@ void processArgs(int argc, char* argv[], UErrorCode &status)
       usage(progName);
       status = U_ILLEGAL_ARGUMENT_ERROR;
     }
-    if(options[i].value == NULL) {
+    if(options[i].value == nullptr) {
       u_fprintf(err, "Option %s needs an argument!\n", options[i].longName);
       usage(progName);
       status = U_ILLEGAL_ARGUMENT_ERROR;
@@ -357,9 +357,9 @@ int32_t
 setArray(Line **array, Hashtable *table = &gElements) {
   int32_t size = table->count();
   int32_t hashIndex = -1;
-  const UHashElement *hashElement = NULL;
+  const UHashElement *hashElement = nullptr;
   int32_t count = 0;
-  while((hashElement = table->nextElement(hashIndex)) != NULL) {
+  while((hashElement = table->nextElement(hashIndex)) != nullptr) {
     array[count++] = (Line *)hashElement->value.pointer;
   }
   return size;
@@ -529,7 +529,7 @@ void printOrdering(Line **lines, int32_t size, UFILE *file, UBool useLinks = fal
   //printLine(*lines);
   //escapeALine(*lines); // Print first line
 
-  Line *line = NULL;
+  Line *line = nullptr;
   Line *previous = *lines;
   if(previous->isReset) {
     u_fprintf(file, "\n& ");
@@ -585,7 +585,7 @@ noteExpansion(Line **gLines, Line *line, int32_t size, CompareFn comparer) {
   UnicodeString key(line->name, line->len);
   //Line *toInsert = (Line *)gElements.get(key);
   Line *toInsert = (Line *)gExpansions.get(key);
-  if(toInsert != NULL) {
+  if(toInsert != nullptr) {
     toInsert->isExpansion = true;
     u_strcpy(toInsert->expansionString, line->expansionString);
     toInsert->expLen = line->expLen;
@@ -625,8 +625,8 @@ noteExpansion(Line **gLines, Line *line, int32_t size, CompareFn comparer) {
 void
 positionExpansions(Line **gLines, int32_t size, CompareFn comparer) {
   int result = 0;
-  Line *line = NULL;
-  Line *toMove = NULL;
+  Line *line = nullptr;
+  Line *toMove = nullptr;
   int32_t i = 0, j = 0;
   Line **sortedExpansions = new Line*[gExpansions.count()];
   int32_t sortedExpansionsSize = setArray(sortedExpansions, &gExpansions);
@@ -740,7 +740,7 @@ noteExpansion(Line *line) {
   UErrorCode status = U_ZERO_ERROR;
   UnicodeString key(line->name, line->len);
   Line *el = (Line *)gElements.get(key);
-  if(el != NULL) {
+  if(el != nullptr) {
     el->isExpansion = true;
     u_strcpy(el->expansionString, line->expansionString);
     el->expLen = line->expLen;
@@ -800,8 +800,8 @@ analyzeContractions(Line** lines, int32_t size, CompareFn comparer) {
   UColAttributeValue strength = UCOL_OFF;
   UColAttributeValue currStrength = UCOL_OFF;
   Line **prevLine = lines;
-  Line **currLine = NULL;
-  Line **backupLine = NULL;
+  Line **currLine = nullptr;
+  Line **backupLine = nullptr;
   UBool prevIsContraction = false, currIsContraction = false;
   // Problem here is detecting a contraction that is at the very end of the sorted list
   for(i = 1; i < size; i++) {
@@ -899,7 +899,7 @@ detectContractions(Line **gLines, Line *lines, int32_t size, CompareFn comparer)
   Line::copyArray(backupLines, lines, size); 
   // detect contractions
 
-  Line **gLinesBackup = NULL; //new Line*[size]; 
+  Line **gLinesBackup = nullptr; //new Line*[size]; 
 
   for(i = 0; i < size; i++) {
     // preserve index and previous
@@ -911,7 +911,7 @@ detectContractions(Line **gLines, Line *lines, int32_t size, CompareFn comparer)
     }
 
     if((noContractions += analyzeContractions(gLines, size, comparer)) && gDebug) {
-      if(gLinesBackup == NULL) {
+      if(gLinesBackup == nullptr) {
         gLinesBackup = new Line*[size];
       }
       // Show the sorted doubles, for debugging
@@ -946,7 +946,7 @@ detectExpansions(Line **gLines, int32_t size, CompareFn comparer) {
     strength = UCOL_OFF, previousStrength = UCOL_OFF;
   Line start, end, src;
   Line *startP = &start, *endP = &end, *srcP = &src;
-  Line *current = NULL;
+  Line *current = nullptr;
   memset(startP, 0, sizeof(Line));
   memset(endP, 0, sizeof(Line));
   memset(srcP, 0, sizeof(Line));
@@ -1020,15 +1020,15 @@ detectExpansions(Line **gLines, int32_t size, CompareFn comparer) {
   }
   // now we have identified possible expansions. We need to find out how do they expand. 
   // Let's iterate over expansions cache - it's easier.
-  const UHashElement *el = NULL;
+  const UHashElement *el = nullptr;
   int32_t hashIndex = -1;
   Line *doubles = new Line[size*10]; 
   Line **sorter = new Line*[size*10];
   int32_t currSize = 0;
   int32_t newSize = 0;
-  Line *prev = NULL;
-  Line *next = NULL;
-  Line *origin = NULL;
+  Line *prev = nullptr;
+  Line *next = nullptr;
+  Line *origin = nullptr;
   int result = 0;
   // Make a list of things in the vincinity of expansion candidate
   // in expansionPrefixes and expansionAfter we have stored the
@@ -1048,7 +1048,7 @@ detectExpansions(Line **gLines, int32_t size, CompareFn comparer) {
   // AD < \u00E4/ = ae <<< aE <<< Ae
   // we choose 'e'.
 
-  while((el = gExpansions.nextElement(hashIndex)) != NULL) {
+  while((el = gExpansions.nextElement(hashIndex)) != nullptr) {
     newSize = 0;
     current = (Line *)el->value.pointer;
     currSize = size*current->expansionPrefixesSize;
@@ -1153,7 +1153,7 @@ void
 reduceUntailored(Line **gLines, int32_t size){
   UErrorCode status = U_ZERO_ERROR;
   Line *current = *(gLines);
-  Line *previous = NULL;
+  Line *previous = nullptr;
   while(current) {
     // if the current line is not tailored according to the UCA
     if(!isTailored(current, status)) {
@@ -1415,7 +1415,7 @@ void addUtilityChars(UnicodeSet &exemplarUSet, UErrorCode &status) {
 void
 getExemplars(const char *locale, UnicodeSet &exemplars, UErrorCode &status) {
   // first we fill out structures with exemplar characters.
-  UResourceBundle *res = ures_open(NULL, locale, &status);
+  UResourceBundle *res = ures_open(nullptr, locale, &status);
   int32_t exemplarLength = 0;
   UnicodeString exemplarString = ures_getUnicodeStringByKey(res, "ExemplarCharacters", &status);
   exemplars.clear();
@@ -1622,9 +1622,9 @@ UBool
 hasCollationElements(const char *locName) {
 
   UErrorCode status = U_ZERO_ERROR;
-  UResourceBundle *ColEl = NULL;
+  UResourceBundle *ColEl = nullptr;
 
-  UResourceBundle *loc = ures_open(NULL, locName, &status);;
+  UResourceBundle *loc = ures_open(nullptr, locName, &status);;
 
   if(U_SUCCESS(status)) {
     status = U_ZERO_ERROR;
@@ -1659,7 +1659,7 @@ main(int argc,
   u_fflush(log);
 */
 
-  UTransliterator *anyHex = utrans_open("[^\\u000a\\u0020-\\u007f] Any-Hex/Java", UTRANS_FORWARD, NULL, 0, NULL, &status);
+  UTransliterator *anyHex = utrans_open("[^\\u000a\\u0020-\\u007f] Any-Hex/Java", UTRANS_FORWARD, nullptr, 0, nullptr, &status);
   u_fsettransliterator(log, U_WRITE, anyHex, &status);
 
   processArgs(argc, argv, status);
@@ -1709,7 +1709,7 @@ main(int argc,
       }
     } else { // do the loop through all the locales
       int32_t noOfLoc = uloc_countAvailable();
-      const char *locName = NULL;
+      const char *locName = nullptr;
       for(i = 0; i<noOfLoc; i++) {
         status = U_ZERO_ERROR;
         locName = uloc_getAvailable(i);
index 3905a0916c97e66a3362da9241438e67d2826359..27070d347366ba62a10c55ef4183f5ca30193d4a 100644 (file)
@@ -130,7 +130,7 @@ FILE     *fDefaultDump;
 
 const char *progName = "colprobe";
 
-const char *gLocale = NULL;
+const char *gLocale = nullptr;
 int32_t platformIndex = -1;
 int32_t gPlatformNo = 0;
 int32_t gPlatformIndexes[10];
@@ -482,7 +482,7 @@ checkCaseOrdering(void) {
 void
 getExemplars(const char *locale, UnicodeSet &exemplars, UErrorCode &status) {
   // first we fill out structures with exemplar characters.
-  UResourceBundle *res = ures_open(NULL, locale, &status);
+  UResourceBundle *res = ures_open(nullptr, locale, &status);
   UnicodeString exemplarString = ures_getUnicodeStringByKey(res, "ExemplarCharacters", &status);
   exemplars.clear();
   exemplars.applyPattern(exemplarString, status);
@@ -545,7 +545,7 @@ setFiles(const char *name, UErrorCode &status) {
   getFileNames(name, tailoringName, tailoringDumpName, defaultName, defaultDumpName, diffName);
   if(options[PLATFORM].doesOccur && !options[DIFF].doesOccur) {  
     if(createDir(platforms[gPlatformIndexes[0]].name) == 0) {
-      tailoringBundle = new UPrinter(tailoringName, "en", "utf-8", NULL, false);
+      tailoringBundle = new UPrinter(tailoringName, "en", "utf-8", nullptr, false);
       fTailoringDump = fopen(tailoringDumpName, "wb");
     } else {
       status = U_FILE_ACCESS_ERROR;
@@ -555,7 +555,7 @@ setFiles(const char *name, UErrorCode &status) {
 
   if(options[REFERENCE].doesOccur && !options[DIFF].doesOccur) {
     if(createDir(platforms[gRefNum].name) == 0) {
-      referenceBundle = new UPrinter(defaultName, "en", "utf-8", NULL, false);
+      referenceBundle = new UPrinter(defaultName, "en", "utf-8", nullptr, false);
       fDefaultDump = fopen(defaultDumpName, "wb");
     } else {
       status = U_FILE_ACCESS_ERROR;
@@ -565,7 +565,7 @@ setFiles(const char *name, UErrorCode &status) {
 
   if((options[PLATFORM].doesOccur && options[REFERENCE].doesOccur) || options[DIFF].doesOccur) {
     if(createDir(platforms[gPlatformIndexes[0]].name) == 0) {
-      bundle = new UPrinter(diffName, "en", "utf-8", NULL, false);
+      bundle = new UPrinter(diffName, "en", "utf-8", nullptr, false);
     }
   }
   if(options[DIFF].doesOccur) {
@@ -648,7 +648,7 @@ processCollator(UCollator *col, UErrorCode &status) {
   int32_t ruleStringLength = ucol_getRulesEx(gCol, UCOL_TAILORING_ONLY, ruleString, 16384);
   logger->log(UnicodeString(ruleString, ruleStringLength), true);
   const char *locale = ucol_getLocale(gCol, ULOC_REQUESTED_LOCALE, &status);
-  if(locale == NULL) {
+  if(locale == nullptr) {
     locale = "en";
   }
   strcpy(myLoc, locale);
@@ -710,7 +710,7 @@ processCollator(UCollator *col, UErrorCode &status) {
     debug->log("\n*** Final order\n\n");
     debug->log(lines.toPrettyString(true, true), true);
     lines.toFile(fTailoringDump, true, status);
-    tailoringBundle->log(lines.toOutput(outputFormat, myLoc, platforms[gPlatformIndexes[0]].name, NULL, true, true, hanAppears), true);
+    tailoringBundle->log(lines.toOutput(outputFormat, myLoc, platforms[gPlatformIndexes[0]].name, nullptr, true, true, hanAppears), true);
     //debug->off();
 
     if(options[REFERENCE].doesOccur) {
@@ -725,7 +725,7 @@ processCollator(UCollator *col, UErrorCode &status) {
       logger->log("\n*** Detecting ordering for reference\n\n");
       SortedLines RefLines(exemplarUSet, gExcludeSet, RefProbe, logger, debug);
       RefLines.analyse(status);
-      referenceBundle->log(RefLines.toOutput(outputFormat, myLoc, platforms[gRefNum].name, NULL, true, true, false), true);
+      referenceBundle->log(RefLines.toOutput(outputFormat, myLoc, platforms[gRefNum].name, nullptr, true, true, false), true);
       RefLines.toFile(fDefaultDump, true, status);
 
       lines.reduceDifference(RefLines);
@@ -740,7 +740,7 @@ processCollator(UCollator *col, UErrorCode &status) {
     SortedLines RefLines(exemplarUSet, gExcludeSet, RefProbe, logger, debug);
     RefLines.analyse(status);
     logger->log(RefLines.toPrettyString(true), true);
-    referenceBundle->log(RefLines.toOutput(outputFormat, myLoc, platforms[gRefNum].name, NULL, true, true, false), true);
+    referenceBundle->log(RefLines.toOutput(outputFormat, myLoc, platforms[gRefNum].name, nullptr, true, true, false), true);
   }
   if(hanAppears) {
     // there are Han characters. This is a huge block. The best we can do is to just sort it, compare to empty
@@ -756,8 +756,8 @@ processCollator(UCollator *col, UErrorCode &status) {
     han.classifyRepertoire();
     han.getBounds(status);
     tailoringBundle->log("Han ordering:<br>\n");
-    tailoringBundle->log(han.toOutput(outputFormat, myLoc, platforms[gPlatformIndexes[0]].name, NULL, true, false, false), true);
-    bundle->log(han.toOutput(outputFormat, myLoc, platforms[gPlatformIndexes[0]].name, NULL, true, false, false), true);
+    tailoringBundle->log(han.toOutput(outputFormat, myLoc, platforms[gPlatformIndexes[0]].name, nullptr, true, false, false), true);
+    bundle->log(han.toOutput(outputFormat, myLoc, platforms[gPlatformIndexes[0]].name, nullptr, true, false, false), true);
   }
   ucol_close(gCol);
 }
@@ -770,13 +770,13 @@ processLocale(const char *locale, UErrorCode &status) {
     return;
   }
 
-  debug->log("Locale %s (LCID:%06X, unix:%s)\n", locale, gWinLCID, setlocale(LC_COLLATE, NULL));
+  debug->log("Locale %s (LCID:%06X, unix:%s)\n", locale, gWinLCID, setlocale(LC_COLLATE, nullptr));
   tailoringBundle->log("// Ordering for locale %s (LCID:%06X, unix:%s), platform %s reference %s<br>\n", 
-    locale, gWinLCID, setlocale(LC_COLLATE, NULL), 
+    locale, gWinLCID, setlocale(LC_COLLATE, nullptr), 
     platforms[gPlatformIndexes[0]].name, platforms[gRefNum].name);
   if(options[REFERENCE].doesOccur) {
     referenceBundle->log("// Reference for locale %s (LCID:%06X, unix:%s), platform %s reference %s<br>\n", 
-      locale, gWinLCID, setlocale(LC_COLLATE, NULL), 
+      locale, gWinLCID, setlocale(LC_COLLATE, nullptr), 
       platforms[gPlatformIndexes[0]].name, platforms[gRefNum].name);
   }
 
@@ -790,9 +790,9 @@ UBool
 hasCollationElements(const char *locName) {
 
   UErrorCode status = U_ZERO_ERROR;
-  UResourceBundle *ColEl = NULL;
+  UResourceBundle *ColEl = nullptr;
 
-  UResourceBundle *loc = ures_open(NULL, locName, &status);;
+  UResourceBundle *loc = ures_open(nullptr, locName, &status);;
 
   if(U_SUCCESS(status)) {
     status = U_ZERO_ERROR;
@@ -893,7 +893,7 @@ main(int argc,
         }
       } else { // do the loop through all the locales
         int32_t noOfLoc = uloc_countAvailable();
-        const char *locName = NULL;
+        const char *locName = nullptr;
         for(i = 0; i<noOfLoc; i++) {
           status = U_ZERO_ERROR;
           locName = uloc_getAvailable(i);
index da335ef4ee4c1138bfef4ffc3b9ff057be7b9397..82d512d37bcf4eb1dc2d7b458fba644470f7aa5e 100644 (file)
@@ -20,7 +20,7 @@
 #include "line.h"
 #include <stdio.h>
 
-UnicodeSet * Line::needsQuoting = NULL;
+UnicodeSet * Line::needsQuoting = nullptr;
 
 void
 Line::init()
@@ -31,10 +31,10 @@ Line::init()
         strengthFromEmpty = UCOL_OFF;
         cumulativeStrength = UCOL_OFF;
         expStrength = UCOL_OFF;
-        previous = NULL;
-        next = NULL;
-        left = NULL;
-        right = NULL;
+        previous = nullptr;
+        next = nullptr;
+        left = nullptr;
+        right = nullptr;
         isContraction = false;
         isExpansion = false;
         isRemoved = false;
@@ -42,7 +42,7 @@ Line::init()
         expIndex = 0;
         firstCC = 0;
         lastCC = 0;
-        sortKey = NULL;
+        sortKey = nullptr;
 }
 
 Line::Line()
@@ -83,19 +83,19 @@ Line::Line(const UnicodeString &string)
 }
 
 Line::Line(const char *buff, int32_t buffLen, UErrorCode &status) :
-previous(NULL),
-next(NULL),
-left(NULL),
-right(NULL)
+previous(nullptr),
+next(nullptr),
+left(nullptr),
+right(nullptr)
 {
   initFromString(buff, buffLen, status);
 }
 
 Line::Line(const Line &other) :
-  previous(NULL),
-  next(NULL),
-left(NULL),
-right(NULL)
+  previous(nullptr),
+  next(nullptr),
+left(nullptr),
+right(nullptr)
 {
   *this = other;
 }
index ffbb70e60faf55cecf37583f4fbbd158683105a8..b93d4c5676d9f5020d30a2be51939bce26c4f34c 100644 (file)
@@ -8,25 +8,25 @@ static int codePointCmp(const void *a, const void *b) {
 
 SortedLines::SortedLines(const UnicodeSet &set, const UnicodeSet &excludeBounds, const StrengthProbe &probe, 
                          UPrinter *logger, UPrinter *debug) :
-toSort(NULL),
+toSort(nullptr),
 toSortCapacity(0),
-lines(NULL),
+lines(nullptr),
 size(0),
 capacity(0),
 repertoire(set),
 excludeBounds(excludeBounds),
 probe(probe),
-first(NULL),
-last(NULL),
+first(nullptr),
+last(nullptr),
 logger(logger),
 debug(debug),
-contractionsTable(NULL),
-duplicators(NULL),
+contractionsTable(nullptr),
+duplicators(nullptr),
 maxExpansionPrefixSize(0),
 wordSort(false),
 frenchSecondary(false),
 upperFirst(false),
-sortkeys(NULL),
+sortkeys(nullptr),
 sortkeyOffset(0)
 {
   memset(UB, 0, sizeof(UB));
@@ -110,7 +110,7 @@ SortedLines::getBounds(UErrorCode &status) {
   if(j == size) {
     debug->log("Oi! I'm hallucinating. Will use the first upper bound");
     delete duplicators;
-    duplicators = NULL;
+    duplicators = nullptr;
     j = 1;
   }
 /*
@@ -268,9 +268,9 @@ int32_t
 SortedLines::setSortingArray(Line **sortingArray, Hashtable *table) {
   int32_t size = table->count();
   int32_t hashIndex = -1;
-  const UHashElement *hashElement = NULL;
+  const UHashElement *hashElement = nullptr;
   int32_t count = 0;
-  while((hashElement = table->nextElement(hashIndex)) != NULL) {
+  while((hashElement = table->nextElement(hashIndex)) != nullptr) {
     sortingArray[count++] = (Line *)hashElement->value.pointer;
   }
   return size;
@@ -333,7 +333,7 @@ SortedLines::sort(UBool setStrengths, UBool link) {
   setSortingArray(toSort, lines, size);
   sort(toSort, size, setStrengths, link);
 
-  first = last = NULL;
+  first = last = nullptr;
 
   if(link) { // do the linking
     first = *toSort;
@@ -516,7 +516,7 @@ int32_t SortedLines::detectContractions(Line **firstRep, int32_t firstSize,
        {
           continue;
         }
-       if(duplicators && duplicators->get(UnicodeString(secondRep[j]->name, secondRep[j]->len)) != NULL) {
+       if(duplicators && duplicators->get(UnicodeString(secondRep[j]->name, secondRep[j]->len)) != nullptr) {
           debug->log("Skipping duplicator ");
           debug->log(secondRep[j]->toString(), true);
                  continue;
@@ -643,7 +643,7 @@ int32_t SortedLines::detectContractions(Line **firstRep, int32_t firstSize,
                }
                while(!toAddIsContraction && k>=0) {
                  xyp.setToConcat(firstRep[i], secondRep[k]);
-                 if(contractionsTable->get(UnicodeString(xyp.name, xyp.len)) != NULL) {
+                 if(contractionsTable->get(UnicodeString(xyp.name, xyp.len)) != nullptr) {
                    k--;
                    continue;
                  }
@@ -656,7 +656,7 @@ int32_t SortedLines::detectContractions(Line **firstRep, int32_t firstSize,
                  }
                }
           // first let's see if xym has moved beyond
-          if(contractionsTable->get(UnicodeString(xym.name, xym.len)) == NULL) {
+          if(contractionsTable->get(UnicodeString(xym.name, xym.len)) == nullptr) {
             k = j+1;
             // ignore weaker strengths
             while(k < secondSize && secondRep[k]->strength > secondRep[j]->strength) {
@@ -691,7 +691,7 @@ int32_t SortedLines::detectContractions(Line **firstRep, int32_t firstSize,
             }
              } else { // only the strength has changed
             // check whether the previous is contraction and if not, add the current
-            if(contractionsTable->get(UnicodeString(xym.name, xym.len)) == NULL) {
+            if(contractionsTable->get(UnicodeString(xym.name, xym.len)) == nullptr) {
               noteContraction("!5", toAddTo, toAddToSize, firstRep[i], secondRep[j], noConts, status);
             }                  
              }
@@ -775,7 +775,7 @@ SortedLines::noteContraction(const char* msg, Line *toAddTo, int32_t &toAddToSiz
     }
   }
 #endif
-  if(contractionsTable->get(UnicodeString(toAdd.name, toAdd.len)) == NULL) {
+  if(contractionsTable->get(UnicodeString(toAdd.name, toAdd.len)) == nullptr) {
     if(probe.distanceFromEmptyString(toAdd) <= UCOL_TERTIARY) {
       toAddTo[toAddToSize++] = toAdd;
       contractionsTable->put(UnicodeString(toAdd.name, toAdd.len), &toAdd, status);
@@ -884,7 +884,7 @@ SortedLines::getExpansionLine(const Line &expansion, const Line &previous, const
             // however, ch is a contraction and therefore we cannot use
             // it properly. If we have hit on a contraction, we'll just try
             // to continue. Probably need more logic here.
-            if(contractionsTable->get(UnicodeString(trial.name, trial.len)) == NULL) {
+            if(contractionsTable->get(UnicodeString(trial.name, trial.len)) == nullptr) {
               expansionLine.append(*toSort[i-1]);
               expIndexes[expIndexSize++] = i-1;
               break;
@@ -1150,7 +1150,7 @@ SortedLines::detectExpansions()
               // however, ch is a contraction and therefore we cannot use
               // it properly. If we have hit on a contraction, we'll just try
               // to continue. Probably need more logic here.
-              if(contractionsTable->get(UnicodeString(trial.name, trial.len)) == NULL) {
+              if(contractionsTable->get(UnicodeString(trial.name, trial.len)) == nullptr) {
                 expansionLine.append(*toSort[prevK]);
                 expIndexes[expIndexSize++] = prevK;
                 break;
@@ -1193,7 +1193,7 @@ SortedLines::detectExpansions()
         if(expansionLine.name[0] == 0x73 && expansionLine.name[1] == 0x7a) {
           int32_t putBreakpointhere = 0;
         }
-        UBool isExpansionLineAContraction = (contractionsTable->get(UnicodeString(expansionLine.name, expansionLine.len)) != NULL);
+        UBool isExpansionLineAContraction = (contractionsTable->get(UnicodeString(expansionLine.name, expansionLine.len)) != nullptr);
         // we have an expansion line and an expansion. There could be some expansions where 
         // the difference between expansion line and the end of expansion sequence is less or 
         // equal than the expansion strength. These should probably be removed.
@@ -1308,20 +1308,20 @@ SortedLines::add(Line *line, UBool linkIn) {
   Line *toAdd = &lines[size];
   if(linkIn && first) {
     Line *current = first;
-    while(current != NULL && probe.comparer(&current, &toAdd) < 0) {
+    while(current != nullptr && probe.comparer(&current, &toAdd) < 0) {
       current = current->next;
     }
-    if(current == NULL) {
+    if(current == nullptr) {
       toAdd->previous = last;
-      toAdd->next = NULL;
-      if(last != NULL) {
+      toAdd->next = nullptr;
+      if(last != nullptr) {
         last->next = toAdd;
       }
       last = toAdd;
-      if(first == NULL) {
+      if(first == nullptr) {
         first = toAdd;
       }
-    } else { // current != NULL
+    } else { // current != nullptr
       toAdd->next = current;
       toAdd->previous = current->previous;
       if(current->previous) {
@@ -1338,7 +1338,7 @@ SortedLines::add(Line *line, UBool linkIn) {
 Line *
 SortedLines::getNext()
 {
-  if(current != NULL) {
+  if(current != nullptr) {
     current=current->next;
   }
   return current;
@@ -1347,7 +1347,7 @@ SortedLines::getNext()
 Line *
 SortedLines::getPrevious()
 {
-  if(current != NULL) {
+  if(current != nullptr) {
     current=current->previous;
   }
   return current;
@@ -1359,7 +1359,7 @@ SortedLines::operator[](int32_t index)
   int32_t i = 0;
   Line *c = first;
   for(i = 0; i < index; i++) {
-    if(c != NULL) {
+    if(c != nullptr) {
       c = c->next;
     }
   }
@@ -1371,7 +1371,7 @@ SortedLines::arrayToString(Line** sortedLines, int32_t linesSize, UBool pretty,
   UnicodeString result;
   int32_t i = 0;
 
-  Line *line = NULL;
+  Line *line = nullptr;
   Line *previous = sortedLines[0];
   if(printSortKeys && !sortkeys) {
     printSortKeys = false;
@@ -1424,22 +1424,22 @@ SortedLines::arrayToString(Line** sortedLines, int32_t linesSize, UBool pretty,
 }
 
 SortedLines::SortedLines(FILE *file, UPrinter *logger, UPrinter *debug, UErrorCode &status) :
-toSort(NULL),
+toSort(nullptr),
 toSortCapacity(0),
-lines(NULL),
+lines(nullptr),
 size(0),
 capacity(0),
-first(NULL),
-last(NULL),
+first(nullptr),
+last(nullptr),
 logger(logger),
 debug(debug),
-contractionsTable(NULL),
-duplicators(NULL),
+contractionsTable(nullptr),
+duplicators(nullptr),
 maxExpansionPrefixSize(0),
 wordSort(false),
 frenchSecondary(false),
 upperFirst(false),
-sortkeys(NULL),
+sortkeys(nullptr),
 sortkeyOffset(0)
 {
   debug->log("*** loading a dump\n");
@@ -1484,7 +1484,7 @@ SortedLines::toFile(FILE *file, UBool useLinks, UErrorCode &status)
   fprintf(file, "%i,%i,%i\n", size, frenchSecondary, upperFirst);
   int32_t i = 1;
   Line *previous = toSort[0];
-  Line *line = NULL;
+  Line *line = nullptr;
   char buff[256];
   previous->write(buff, 256, status);
   fprintf(file, "%s\n", buff);
@@ -1511,7 +1511,7 @@ SortedLines::toStringFromEmpty() {
   UnicodeString result;
   int32_t i = 0;
 
-  Line *line = NULL;
+  Line *line = nullptr;
   Line *previous = toSort[0];
   if(previous->isReset) {
     result.append(" & ");
@@ -1808,7 +1808,7 @@ SortedLines::reduceDifference(SortedLines& reference) {
       myLine = myLine->next;
       refLatestEqual = refLine;
       refLine = refLine->next;
-      if(refLine == NULL && myLine == NULL) {
+      if(refLine == nullptr && myLine == nullptr) {
         finished = true;
       }
     }
@@ -1866,11 +1866,11 @@ SortedLines::reduceDifference(SortedLines& reference) {
           }
         }
       }
-      if(refLine == NULL) { // ran out of reference
+      if(refLine == nullptr) { // ran out of reference
         // this is the tail of tailoring - the last insertion
-        myLine  = NULL;
+        myLine  = nullptr;
         found = true;
-      } else if(tailoringMove == lookForward || myLine == NULL) { // run over treshold or out of tailoring
+      } else if(tailoringMove == lookForward || myLine == nullptr) { // run over treshold or out of tailoring
         tailoringMove = 0;
         // we didn't find insertion after all
         // we will try substitution next
@@ -1904,8 +1904,8 @@ SortedLines::reduceDifference(SortedLines& reference) {
         found = true;
       }
       if(found) {
-        if(myLatestEqual->next != myLine || refLine == NULL) {
-          Line *myStart = NULL;
+        if(myLatestEqual->next != myLine || refLine == nullptr) {
+          Line *myStart = nullptr;
           // this is a reset and a sequence
           // myLatestEqual points at the last point that was the same
           // This point will be a reset
@@ -1923,7 +1923,7 @@ SortedLines::reduceDifference(SortedLines& reference) {
           // <<<S<<\u0161<<<\u0160<<\u017F<t
           // Result:
           // &S<<\u017F<\u0161<<<\u0160
-          // we have a sequence that spans from myLatestEqual to myLine (that one could be NULL
+          // we have a sequence that spans from myLatestEqual to myLine (that one could be nullptr
           // so we have to go down from myLatestEqual. 
           // Basically, for every element, we want to see the strongest cumulative difference 
           // from the reset point. If the cumulative difference is the same in both the reference and
@@ -1978,7 +1978,7 @@ SortedLines::transferCumulativeStrength(Line *previous, Line *that) {
 
 void
 SortedLines::calculateCumulativeStrengths(Line *start, Line *end) {
-  // start is a reset - end may be NULL
+  // start is a reset - end may be nullptr
   start = start->next;
   UColAttributeValue cumulativeStrength = UCOL_OFF;
   while(start && start != end) {
index ce46f1952063e56fa6815080b87957d328ec107c..d95e25df06553558af0125692d7082cba4c9a41f 100644 (file)
@@ -25,7 +25,7 @@ UPrinter::UPrinter(FILE *file, const char *locale, const char *encoding, UBool t
   strcpy(_locale, locale);
   if(transliterateNonPrintable) {
     UErrorCode status = U_ZERO_ERROR;
-    UTransliterator *anyHex = utrans_open("[^\\u000d\\u000a\\u0009\\u0020-\\u007f] Any-Hex/Java", UTRANS_FORWARD, NULL, 0, NULL, &status);
+    UTransliterator *anyHex = utrans_open("[^\\u000d\\u000a\\u0009\\u0020-\\u007f] Any-Hex/Java", UTRANS_FORWARD, nullptr, 0, nullptr, &status);
     u_fsettransliterator(out, U_WRITE, anyHex, &status);
   }
 };
@@ -37,8 +37,8 @@ UPrinter::UPrinter(const char *name, const char *locale, const char *encoding, U
   strcpy(_locale, locale);
   if(transliterateNonPrintable) {
     UErrorCode status = U_ZERO_ERROR;
-    if(trans == NULL) {
-      UTransliterator *anyHex = utrans_open("[^\\u000d\\u000a\\u0009\\u0020-\\u007f] Any-Hex/Java", UTRANS_FORWARD, NULL, 0, NULL, &status);
+    if(trans == nullptr) {
+      UTransliterator *anyHex = utrans_open("[^\\u000d\\u000a\\u0009\\u0020-\\u007f] Any-Hex/Java", UTRANS_FORWARD, nullptr, 0, nullptr, &status);
       u_fsettransliterator(out, U_WRITE, anyHex, &status);
     } else {
       u_fsettransliterator(out, U_WRITE, trans, &status);
index e26ff37993613d4fe6e9a3f083677684108ea190..ef3b59c9ca7a1120a7b8ffa40bc999cb0bd55f43 100644 (file)
@@ -59,7 +59,7 @@ uprint(const UChar *s,
 
        /* perform the conversion */
        ucnv_fromUnicode(converter, &myTarget,  myTarget + arraySize,
-                        &mySource, mySourceEnd, NULL,
+                        &mySource, mySourceEnd, nullptr,
                         true, status);
 
        /* Write the converted data to the FILE* */
index 9b9ab21dba66c1529e5bf55f0a09192a85fc2c34..1a70f763028f46b7161bb983f905861e7cc1f867 100644 (file)
@@ -54,11 +54,11 @@ void usageAndDie(int retCode) {
 
 /*U_CAPI void U_EXPORT2*/
 static void _versionFromUString(UVersionInfo versionArray, const UChar *versionString) {
-    if(versionArray==NULL) {
+    if(versionArray==nullptr) {
         return;
     }
 
-    if(versionString!=NULL) {
+    if(versionString!=nullptr) {
         char verchars[U_MAX_VERSION_LENGTH+1];
         u_UCharsToChars(versionString, verchars, U_MAX_VERSION_LENGTH);
         u_versionFromString(versionArray, verchars);
@@ -68,7 +68,7 @@ static void _versionFromUString(UVersionInfo versionArray, const UChar *versionS
 /*U_CAPI void U_EXPORT2*/
 static void _getCLDRVersionDirect(UVersionInfo versionArray, UErrorCode *status) {
     UResourceBundle *resindx;
-    resindx = ures_openDirect(NULL, "supplementalData", status);
+    resindx = ures_openDirect(nullptr, "supplementalData", status);
     if(!U_FAILURE(*status)) {
 //        fprintf(stderr, "Err: could not open res_index, %s\n", u_errorName(status));
 //        fflush(stderr);
@@ -94,7 +94,7 @@ static void _getCLDRVersionDirect(UVersionInfo versionArray, UErrorCode *status)
 /*U_CAPI void U_EXPORT2*/
 static void _getCLDRVersionOld(UVersionInfo versionArray, UErrorCode *status) {
     UResourceBundle *resindx;
-    resindx = ures_openDirect(NULL, "res_index", status);
+    resindx = ures_openDirect(nullptr, "res_index", status);
     if(!U_FAILURE(*status)) {
 //        fprintf(stderr, "Err: could not open res_index, %s\n", u_errorName(status));
 //        fflush(stderr);
@@ -119,9 +119,9 @@ static void _getCLDRVersionOld(UVersionInfo versionArray, UErrorCode *status) {
 
 int could_open(const char *locale, char *comments) {
     char tmp[200];
-    UResourceBundle *rb = NULL;
+    UResourceBundle *rb = nullptr;
     UErrorCode status = U_ZERO_ERROR;
-    rb = ures_open(NULL, locale, &status);
+    rb = ures_open(nullptr, locale, &status);
     if(U_FAILURE(status)) {
         sprintf(tmp, " open:%s", u_errorName(status));
         strcat(comments, tmp);
@@ -135,7 +135,7 @@ int could_open(const char *locale, char *comments) {
 }
 int col_could_open(const char *locale, char *comments) {
     char tmp[200];
-    UCollator *rb = NULL;
+    UCollator *rb = nullptr;
     UErrorCode status = U_ZERO_ERROR;
     rb = ucol_open(locale, &status);
     if(U_FAILURE(status)) {
@@ -217,13 +217,13 @@ UDateFormatSymbolType scanArray[] = {
 //    UDAT_NARROW_MONTHS,
 };
 
-int *starts = NULL;
+int *starts = nullptr;
 
-UChar ***rootdata = NULL;
+UChar ***rootdata = nullptr;
 
 void initroot(UErrorCode *status) {
   UDateFormat *fmt;
-  fmt = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, "root", NULL, -1,NULL,0, status);
+  fmt = udat_open(UDAT_DEFAULT, UDAT_DEFAULT, "root", nullptr, -1,nullptr,0, status);
   rootdata = (UChar***)malloc((sizeof(scanArray)/sizeof(scanArray[0]))*sizeof(rootdata[0]));
   starts = (int*)malloc((sizeof(scanArray)/sizeof(scanArray[0]))*sizeof(starts[0]));
   for(int i=0;U_SUCCESS(*status)&&i<sizeof(scanArray)/sizeof(scanArray[0]);i++) {
@@ -269,8 +269,8 @@ date(const UChar *tz,
   int tf=0; // total found
   int tl = 0;
 
-  fmt = udat_open(style, style, locale, tz, -1,NULL,0, status);
-  if ( format != NULL ) {
+  fmt = udat_open(style, style, locale, tz, -1,nullptr,0, status);
+  if ( format != nullptr ) {
      u_charsToUChars(format,uFormat,strlen(format)),
      udat_applyPattern(fmt,false,uFormat,strlen(format));
   }
@@ -344,12 +344,12 @@ static void writeOkComments(XMLFile &xf, int ok, const char *comments, const cha
 
 int could_fmt_dow(const char *locale, char *comments) {
     char tmp[200];
-//    UResourceBundle *rb = NULL;
+//    UResourceBundle *rb = nullptr;
     UErrorCode status = U_ZERO_ERROR;
         
-    date(NULL,
+    date(nullptr,
          UDAT_LONG,
-     NULL,
+     nullptr,
      locale, comments,
      &status);
 
@@ -420,7 +420,7 @@ int main (int argc, char **  argv) {
 #if (U_ICU_VERSION_MAJOR_NUM > 2) || ((U_ICU_VERSION_MAJOR_NUM>1)&&(U_ICU_VERSION_MINOR_NUM>5))
                u_init(&status);
 #else
-               ures_open(NULL, "en_US", &status);
+               ures_open(nullptr, "en_US", &status);
 #endif
                fprintf(stderr, " Init: %s\n", u_errorName(status));
 
index cbe914ce7310bb3923a0dd7234dd537aa5a1ac95..1d538db73ab9c1795d6803fa8eda51f37eda7fcf 100644 (file)
@@ -49,7 +49,7 @@ void XMLFile::writeIndent() {
 
 XMLElement::XMLElement(XMLFile &f, const char *name, const char *attribs, bool single) : file(f), name(name), single(single) {
     char outs[200];
-    if(attribs!=NULL) {
+    if(attribs!=nullptr) {
         sprintf(outs,"<%s %s", name, attribs);
     } else {
         sprintf(outs, "<%s", name);
index e5932660057aef12bbcfc179cba3b2983af805da..a969ac5ca8141b6173a7e9bf3a78f5bcffd124a7 100644 (file)
@@ -35,7 +35,7 @@ class XMLFile {
 
 class XMLElement {
     public:
-        XMLElement(XMLFile &f, const char *name, const char *attribs  = NULL, bool single=false);
+        XMLElement(XMLFile &f, const char *name, const char *attribs  = nullptr, bool single=false);
         ~XMLElement();
         
         const char *name;
index 6cee785e598b7b2b340821a9e8d37b048b714737..ac1ec25ebd047e7ef651242d9132fcb80f4f7efb 100644 (file)
@@ -82,11 +82,11 @@ int main(int /* argc*/ , const char * /*argv*/ []) {
             continue;
           }
           
-          // int32_t len = udat_format(dat, stuff, outchars, 200, NULL, &subStatus); 
+          // int32_t len = udat_format(dat, stuff, outchars, 200, nullptr, &subStatus); 
           
           // //printf("\n");
           //char utf8[200];
-          // u_strToUTF8(utf8, 200, NULL, outchars, len, &subStatus);
+          // u_strToUTF8(utf8, 200, nullptr, outchars, len, &subStatus);
           
           sprintf(outchars, " cal: mindays=%d firstday=%d ", (int)cal->getMinimalDaysInFirstWeek(), (int)cal->getFirstDayOfWeek());
           int32_t len = strlen(outchars);
index e8f791e3fd78df650940f8c080d3455859593980..3bec20dfee7ea35f2d78eb1259b73e72ee555c43 100644 (file)
@@ -83,7 +83,7 @@ int main(int /* argc*/ , const char * /*argv*/ []) {
             strcat(xbuf2,locID);
             strcat(xbuf2,"/");
             //printf(" -> %s\n", xbuf2);
-            UCollator *col = ucol_openFromShortString(xbuf2, false,NULL, &subStatus);
+            UCollator *col = ucol_openFromShortString(xbuf2, false,nullptr, &subStatus);
 #else
             UCollator *col = ucol_open(locID, &subStatus);
 #endif
@@ -95,7 +95,7 @@ int main(int /* argc*/ , const char * /*argv*/ []) {
 
             char xbuf3[200];
             {
-              int32_t def = ucol_getShortDefinitionString(col,locID/*NULL*/,xbuf3,200,&subStatus);
+              int32_t def = ucol_getShortDefinitionString(col,locID/*nullptr*/,xbuf3,200,&subStatus);
               if(U_FAILURE(subStatus)) {
                 printf("Err getting short string name: %s\n", u_errorName(subStatus));
               } else {
@@ -122,12 +122,12 @@ int main(int /* argc*/ , const char * /*argv*/ []) {
             printf("\n");
 
             char xbuf4[200];
-            UCollator *col2 = ucol_openFromShortString(xbuf3, false, NULL, &subStatus);
+            UCollator *col2 = ucol_openFromShortString(xbuf3, false, nullptr, &subStatus);
             if(U_FAILURE(subStatus)) {
               printf("Err opening from new short string : %s\n", u_errorName(subStatus));
               continue;
             } else {
-              int32_t def4 = ucol_getShortDefinitionString(col,locID/*NULL*/,xbuf4,200,&subStatus);
+              int32_t def4 = ucol_getShortDefinitionString(col,locID/*nullptr*/,xbuf4,200,&subStatus);
               if(strcmp(xbuf4,xbuf3)) {
                 printf(" --> reopened = %s (%s)\n", xbuf4, u_errorName(subStatus));
               }
index b3ba6b7c28373c8ea06d0054f5aed7411df10bf8..b728ffa2b43dec0a85f96cf8ac2e067fd4f5a2d1 100644 (file)
@@ -74,18 +74,18 @@ int main(int /* argc*/ , const char * /*argv*/ []) {
           UErrorCode subStatus = U_ZERO_ERROR;
           UChar outchars[200];
           
-          UDateFormat *dat = udat_open(styles[s],styles[s], locID, NULL, -1, NULL, 0, &subStatus);
+          UDateFormat *dat = udat_open(styles[s],styles[s], locID, nullptr, -1, nullptr, 0, &subStatus);
           
           if(U_FAILURE(subStatus)) {
             printf("ERR: %s\n", u_errorName(subStatus));
             continue;
           }
           
-          int32_t len = udat_format(dat, stuff, outchars, 200, NULL, &subStatus); 
+          int32_t len = udat_format(dat, stuff, outchars, 200, nullptr, &subStatus); 
           
           //printf("\n");
           char utf8[200];
-          u_strToUTF8(utf8, 200, NULL, outchars, len, &subStatus);
+          u_strToUTF8(utf8, 200, nullptr, outchars, len, &subStatus);
           if(oldLen!=len || memcmp(outchars,oldChars,len*sizeof(outchars[0]))) {
             putchar ('!');
             diffs++;
index fb39a2aee452b8afd92ec9cacc75cb443651e0ce..462ebc27464857021048e631345c16f050ebd2f0 100644 (file)
@@ -73,10 +73,10 @@ GLUE_VER( ICUGLUE_VER )
 #endif
 
 GLUE_SYM (Calendar ) :: GLUE_SYM(Calendar) ( const Locale& loc, UErrorCode& status ) :
-Calendar(status), _this(NULL)
+Calendar(status), _this(nullptr)
 { 
 
-  _this = OICU_ucal_open(NULL, -1, /*locale*/NULL, UCAL_DEFAULT, &status);
+  _this = OICU_ucal_open(nullptr, -1, /*locale*/nullptr, UCAL_DEFAULT, &status);
 
   // copy some things over
   setMinimalDaysInFirstWeek(OICU_ucal_getAttribute(_this, UCAL_MINIMAL_DAYS_IN_FIRST_WEEK));
@@ -117,7 +117,7 @@ int32_t GLUE_SYM ( Calendar ) :: handleGetLimit(UCalendarDateFields field, ELimi
   return 1;
 }
 Calendar* GLUE_SYM ( Calendar ) :: clone(void) const {
-  return NULL;
+  return nullptr;
 }
 
 
@@ -140,7 +140,7 @@ Calendar* GLUE_SYM ( Calendar ) :: clone(void) const {
 //                                       pattern,
 //                                       patternLength,
 //                                       status);
-//     if(U_FAILURE(*status)) return NULL; // TODO: ERR?
+//     if(U_FAILURE(*status)) return nullptr; // TODO: ERR?
 //     DateFormat *c =  new GLUE_SYM( DateFormat ) ( uc );
 // #if CAL_FE_DEBUG
 //     fprintf(stderr, "VCF " ICUGLUE_VER_STR " udat_open=%s ->> %p\n", loc.getName(), (void*)c);
@@ -272,7 +272,7 @@ UObject* VersionCalendarFactory::handleCreate(const Locale &loc, int32_t kind, c
     fprintf(stderr,  "VCalF:CC %s\n", loc.getName());
 #endif
     int32_t len = loc.getKeywordValue("sp", provider, 200, status);
-    if(U_FAILURE(status)||len==0) return NULL;
+    if(U_FAILURE(status)||len==0) return nullptr;
 #if CAL_FE_DEBUG
     fprintf(stderr,  "VCalF:KWV> %s/%d\n", u_errorName(status), len);
 #endif
@@ -280,7 +280,7 @@ UObject* VersionCalendarFactory::handleCreate(const Locale &loc, int32_t kind, c
 #if CAL_FE_DEBUG
     fprintf(stderr,  "VCalF:KWV %s\n", provider);
 #endif
-    if(strncmp(provider,"icu",3)) return NULL;
+    if(strncmp(provider,"icu",3)) return nullptr;
     const char *icuver=provider+3;
 #if CAL_FE_DEBUG
     fprintf(stderr,  "VCalF:ICUV %s\n", icuver);
@@ -295,16 +295,16 @@ UObject* VersionCalendarFactory::handleCreate(const Locale &loc, int32_t kind, c
     fprintf(stderr,  "VCalF:CC %s failed\n", loc.getName());
 #endif
 
-    return NULL;
+    return nullptr;
 }
 
 
-static const UnicodeString *gLocalesDate = NULL;
+static const UnicodeString *gLocalesDate = nullptr;
 static  int32_t gLocCountDate = 0; 
 
 const Hashtable *VersionCalendarFactory::getSupportedIDs (UErrorCode& status) const {
   // from coll.cpp
-  Hashtable *_ids = NULL;
+  Hashtable *_ids = nullptr;
   if (U_SUCCESS(status)) {
     int32_t count = 0;
     _ids = new Hashtable(status);
@@ -314,7 +314,7 @@ const Hashtable *VersionCalendarFactory::getSupportedIDs (UErrorCode& status) co
         _ids->put(idlist[i], (void*)this, status);
         if (U_FAILURE(status)) {
           delete _ids;
-          _ids = NULL;
+          _ids = nullptr;
           return;
         }
       }
@@ -328,7 +328,7 @@ const Hashtable *VersionCalendarFactory::getSupportedIDs (UErrorCode& status) co
 
 const UnicodeString
 *VersionCalendarFactory::getSupportedIDs(int32_t &count, UErrorCode &/*status*/) const {
-  if(gLocalesDate==NULL) {
+  if(gLocalesDate==nullptr) {
     count = 0;
     
     
@@ -369,7 +369,7 @@ const UnicodeString
 #include <stdio.h>
 #include <unicode/uversion.h>
 
-static URegistryKey rkcal = NULL;
+static URegistryKey rkcal = nullptr;
 
 void cal_provider_register(UErrorCode &status) {
   debugfprintf((stderr, "about to register VCalF\n"));
index 286a5444c7fc61321c935da0949dc78a42646026..a29259c699ce19145acf7c392ac556b71a3aea6b 100644 (file)
@@ -164,7 +164,7 @@ GLUE_SYM ( Collator ) :: create (const Locale &loc, const char */*ver*/) {
         strcat(locBuf,kwvBuf);
     }
     UCollator * uc =  OICU_ucol_open( locBuf, status);
-    if(U_FAILURE(status)) return NULL; // TODO: ERR?
+    if(U_FAILURE(status)) return nullptr; // TODO: ERR?
     Collator *c =  new GLUE_SYM( Collator ) ( uc );
 #if COLL_FE_DEBUG
     fprintf(stderr, "VCF " ICUGLUE_VER_STR " ucol_open=%s ->> %p\n", locBuf, c);
@@ -179,11 +179,11 @@ Collator* GLUE_SYM ( Collator ) :: clone() const  {
 #if COLL_FE_DEBUG
     fprintf(stderr, "VCF " ICUGLUE_VER_STR " clone %p -> " , this);
 #endif
-    UCollator *clc = OICU_ucol_safeClone( _this, NULL, 0, &status);
+    UCollator *clc = OICU_ucol_safeClone( _this, nullptr, 0, &status);
 #if COLL_FE_DEBUG
     fprintf(stderr, "VCF " ICUGLUE_VER_STR " .. safeclone %s _this %p-> %p " , u_errorName(status), _this, clc);
 #endif
-    if(U_FAILURE(status)||clc==NULL) return NULL;
+    if(U_FAILURE(status)||clc==nullptr) return nullptr;
     Collator *c = new GLUE_SYM( Collator ) ( clc );
 #if COLL_FE_DEBUG
     fprintf(stderr, "VCF " ICUGLUE_VER_STR " .. wrap(%p) -> %p\n", clc, c);
@@ -391,7 +391,7 @@ Collator *VersionCollatorFactory::createCollator(const Locale &loc) {
     fprintf(stderr,  "VCF:CC %s\n", loc.getName());
 #endif
     int32_t len = loc.getKeywordValue("sp", provider, 200, status);
-    if(U_FAILURE(status)||len==0) return NULL;
+    if(U_FAILURE(status)||len==0) return nullptr;
 #if COLL_FE_DEBUG
     fprintf(stderr,  "VCF:KWV> %s/%d\n", u_errorName(status), len);
 #endif
@@ -399,7 +399,7 @@ Collator *VersionCollatorFactory::createCollator(const Locale &loc) {
 #if COLL_FE_DEBUG
     fprintf(stderr,  "VCF:KWV %s\n", provider);
 #endif
-    if(strncmp(provider,"icu",3)) return NULL;
+    if(strncmp(provider,"icu",3)) return nullptr;
     const char *icuver=provider+3;
 #if COLL_FE_DEBUG
     fprintf(stderr,  "VCF:ICUV %s\n", icuver);
@@ -422,16 +422,16 @@ Collator *VersionCollatorFactory::createCollator(const Locale &loc) {
     fprintf(stderr,  "VCF:CC %s failed\n", loc.getName());
 #endif
 
-    return NULL;
+    return nullptr;
 }
 
 
-static const UnicodeString *gLocales = NULL;
+static const UnicodeString *gLocales = nullptr;
 static  int32_t gLocCount = 0; 
 
 const UnicodeString
 *VersionCollatorFactory::getSupportedIDs(int32_t &count, UErrorCode &/*status*/) {
-  if(gLocales==NULL) {
+  if(gLocales==nullptr) {
     count = 0;
     
     
@@ -471,7 +471,7 @@ const UnicodeString
 #include <stdio.h>
 #include <unicode/uversion.h>
 
-static URegistryKey rk = NULL;
+static URegistryKey rk = nullptr;
 
 void coll_provider_register(UErrorCode &status) {
   rk = Collator::registerFactory(new VersionCollatorFactory(), status);
index 6465ab982d7b221d8ff7d2292bba7d4ef5f3217c..3ea1a85f24713097de23a5f36a23df4b129d532f 100644 (file)
@@ -102,7 +102,7 @@ GLUE_SYM ( DateFormat ) :: create(UDateFormatStyle  timeStyle,
                                       pattern,
                                       patternLength,
                                       status);
-    if(U_FAILURE(*status)) return NULL; // TODO: ERR?
+    if(U_FAILURE(*status)) return nullptr; // TODO: ERR?
     DateFormat *c =  new GLUE_SYM( DateFormat ) ( uc );
 #if DATE_FE_DEBUG
     fprintf(stderr, "VCF " ICUGLUE_VER_STR " udat_open=%s ->> %p\n", loc.getName(), (void*)c);
@@ -144,7 +144,7 @@ void  GLUE_SYM (DateFormat ) :: parse( const UnicodeString& text, Calendar& cal,
 
 Format*  GLUE_SYM (DateFormat ) :: clone(void) const
 {
-  return NULL;
+  return nullptr;
 }
 
 
@@ -231,7 +231,7 @@ DateFormat *VersionDateFormatFactory::createFormat(UDateFormatStyle  timeStyle,
     fprintf(stderr,  "VCF:CC %s\n", loc.getName());
 #endif
     int32_t len = loc.getKeywordValue("sp", provider, 200, *status);
-    if(U_FAILURE(*status)||len==0) return NULL;
+    if(U_FAILURE(*status)||len==0) return nullptr;
 #if DATE_FE_DEBUG
     fprintf(stderr,  "VCF:KWV> %s/%d\n", u_errorName(*status), len);
 #endif
@@ -239,7 +239,7 @@ DateFormat *VersionDateFormatFactory::createFormat(UDateFormatStyle  timeStyle,
 #if DATE_FE_DEBUG
     fprintf(stderr,  "VCF:KWV %s\n", provider);
 #endif
-    if(strncmp(provider,"icu",3)) return NULL;
+    if(strncmp(provider,"icu",3)) return nullptr;
     const char *icuver=provider+3;
 #if DATE_FE_DEBUG
     fprintf(stderr,  "VCF:ICUV %s\n", icuver);
@@ -254,17 +254,17 @@ DateFormat *VersionDateFormatFactory::createFormat(UDateFormatStyle  timeStyle,
     fprintf(stderr,  "VCF:CC %s failed\n", loc.getName());
 #endif
 
-    return NULL;
+    return nullptr;
 }
 
 
-static const UnicodeString *gLocalesDate = NULL;
+static const UnicodeString *gLocalesDate = nullptr;
 static  int32_t gLocCountDate = 0; 
 
 
 const UnicodeString
 *VersionDateFormatFactory::getSupportedIDs(int32_t &count, UErrorCode &/*status*/) {
-  if(gLocalesDate==NULL) {
+  if(gLocalesDate==nullptr) {
     count = 0;
     
     
@@ -305,7 +305,7 @@ const UnicodeString
 #include <stdio.h>
 #include <unicode/uversion.h>
 
-//static URegistryKey rkdate = NULL;
+//static URegistryKey rkdate = nullptr;
 
 static VersionDateFormatFactory vdf;
 
index a3337d9387188d7c5d9fe5e6e38734ff4c5362ed..2f682fc836a27ffb6b156336ffa5f6649f69d35b 100644 (file)
@@ -12,7 +12,7 @@
 /**
  * Purpose: create local or static fe_verlist such as:
  * 
- *   const char *fe_verlist[] = { "4_2", "4_2_3", ..., NULL }; 
+ *   const char *fe_verlist[] = { "4_2", "4_2_3", ..., nullptr };
  */
 
 #if defined(GLUE_VER)
@@ -23,6 +23,6 @@ const char *fe_verlist[] = {
 #define GLUE_VER(x)  #x  ,
 #include "icuglue/glver.h"
 #undef GLUE_VER
-    NULL
+    nullptr
 };
 
index 377363ff41740828f470460ecd967ecda8a1e571..bc4a060c490747e1b7beec34b90a3223c41e50bc 100644 (file)
@@ -194,7 +194,7 @@ private:
 };
 
 BiDiPropsBuilder::BiDiPropsBuilder(UErrorCode &errorCode)
-        : pTrie(NULL),
+        : pTrie(nullptr),
           mirrorTop(0) {
     // This builder encodes the following properties.
     relevantProps.
@@ -336,7 +336,7 @@ void
 BiDiPropsBuilder::makeMirror(UErrorCode &errorCode) {
     /* sort the mirroring table by source code points */
     uprv_sortArray(mirrors, mirrorTop, 8,
-                   compareMirror, NULL, false, &errorCode);
+                   compareMirror, nullptr, false, &errorCode);
     if(U_FAILURE(errorCode)) { return; }
 
     /*
@@ -501,7 +501,7 @@ BiDiPropsBuilder::writeCSourceFile(const char *path, UErrorCode &errorCode) {
 
     FILE *f=usrc_create(path, "ubidi_props_data.h", 2016,
                         "icu/tools/unicode/c/genprops/bidipropsbuilder.cpp");
-    if(f==NULL) {
+    if(f==nullptr) {
         errorCode=U_FILE_ACCESS_ERROR;
         return;
     }
@@ -517,7 +517,7 @@ BiDiPropsBuilder::writeCSourceFile(const char *path, UErrorCode &errorCode) {
         "",
         "};\n\n");
     usrc_writeUTrie2Arrays(f,
-        "static const uint16_t ubidi_props_trieIndex[%ld]={\n", NULL,
+        "static const uint16_t ubidi_props_trieIndex[%ld]={\n", nullptr,
         pTrie,
         "\n};\n\n");
     usrc_writeArray(f,
@@ -541,7 +541,7 @@ BiDiPropsBuilder::writeCSourceFile(const char *path, UErrorCode &errorCode) {
         "\n};\n\n");
     fputs(
         "static const UBiDiProps ubidi_props_singleton={\n"
-        "  NULL,\n"
+        "  nullptr,\n"
         "  ubidi_props_indexes,\n"
         "  ubidi_props_mirrors,\n"
         "  ubidi_props_jgArray,\n"
@@ -549,7 +549,7 @@ BiDiPropsBuilder::writeCSourceFile(const char *path, UErrorCode &errorCode) {
         f);
     usrc_writeUTrie2Struct(f,
         "  {\n",
-        pTrie, "ubidi_props_trieIndex", NULL,
+        pTrie, "ubidi_props_trieIndex", nullptr,
         "  },\n");
     usrc_writeArray(f, "  { ", dataInfo.formatVersion, 8, 4, "", " }\n");
     fputs("};\n\n"
@@ -562,7 +562,7 @@ BiDiPropsBuilder::writeBinaryData(const char *path, UBool withCopyright, UErrorC
     if(U_FAILURE(errorCode)) { return; }
 
     UNewDataMemory *pData=udata_create(path, UBIDI_DATA_TYPE, UBIDI_DATA_NAME, &dataInfo,
-                                       withCopyright ? U_COPYRIGHT_STRING : NULL, &errorCode);
+                                       withCopyright ? U_COPYRIGHT_STRING : nullptr, &errorCode);
     if(U_FAILURE(errorCode)) {
         fprintf(stderr, "genprops: udata_create(%s, ubidi.icu) failed - %s\n",
                 path, u_errorName(errorCode));
@@ -595,9 +595,9 @@ BiDiPropsBuilder::writeBinaryData(const char *path, UBool withCopyright, UErrorC
 
 PropsBuilder *
 createBiDiPropsBuilder(UErrorCode &errorCode) {
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     PropsBuilder *pb=new BiDiPropsBuilder(errorCode);
-    if(pb==NULL) {
+    if(pb==nullptr) {
         errorCode=U_MEMORY_ALLOCATION_ERROR;
     }
     return pb;
index 4ed204a63e56d01e0578e60bdc5f38a25915a108..16f0de318877d14029dfac161a8308435b7dc642 100644 (file)
@@ -307,7 +307,7 @@ private:
 };
 
 CasePropsBuilder::CasePropsBuilder(UErrorCode &errorCode)
-        : excProps(NULL), excPropsCount(0), maxFullLength(U16_MAX_LENGTH), pTrie(NULL) {
+        : excProps(nullptr), excPropsCount(0), maxFullLength(U16_MAX_LENGTH), pTrie(nullptr) {
     // This builder encodes the following properties.
     relevantProps.
         add(UCHAR_CANONICAL_COMBINING_CLASS).  // 0 vs. 230 vs. other
@@ -340,7 +340,7 @@ CasePropsBuilder::CasePropsBuilder(UErrorCode &errorCode)
         return;
     }
     excProps=new ExcProps *[MAX_EXC_COUNT];
-    if(excProps==NULL) {
+    if(excProps==nullptr) {
         fprintf(stderr,
                 "genprops error: casepropsbuilder out of memory allocating "
                 "the array of exceptions properties\n");
@@ -524,7 +524,7 @@ CasePropsBuilder::setProps(const UniProps &props, const UnicodeSet &newValues,
             return;
         }
         ExcProps *newExcProps=new ExcProps(props);
-        if(newExcProps==NULL) {
+        if(newExcProps==nullptr) {
             fprintf(stderr,
                     "genprops error: casepropsbuilder out of memory allocating "
                     "exceptions properties\n");
@@ -588,7 +588,7 @@ CasePropsBuilder::makeExcProps(UChar32 c, uint32_t value, UErrorCode &errorCode)
         return 0;
     }
     LocalPointer<ExcProps> newExcProps(new ExcProps);
-    if(newExcProps==NULL) {
+    if(newExcProps==nullptr) {
         fprintf(stderr,
                 "genprops error: casepropsbuilder out of memory allocating "
                 "exceptions properties\n");
@@ -635,7 +635,7 @@ CasePropsBuilder::makeUnfoldData(UErrorCode &errorCode) {
     int32_t unfoldRows=unfoldLength/UGENCASE_UNFOLD_WIDTH-1;
     UChar *unfoldBuffer=unfold.getBuffer(-1);
     uprv_sortArray(unfoldBuffer+UGENCASE_UNFOLD_WIDTH, unfoldRows, UGENCASE_UNFOLD_WIDTH*2,
-                   compareUnfold, NULL, false, &errorCode);
+                   compareUnfold, nullptr, false, &errorCode);
 
     /* make unique-string rows by merging adjacent ones' code point columns */
 
@@ -1187,7 +1187,7 @@ CasePropsBuilder::writeCSourceFile(const char *path, UErrorCode &errorCode) {
 
     FILE *f=usrc_create(path, "ucase_props_data.h", 2016,
                         "icu/tools/unicode/c/genprops/casepropsbuilder.cpp");
-    if(f==NULL) {
+    if(f==nullptr) {
         errorCode=U_FILE_ACCESS_ERROR;
         return;
     }
@@ -1203,7 +1203,7 @@ CasePropsBuilder::writeCSourceFile(const char *path, UErrorCode &errorCode) {
         "",
         "};\n\n");
     usrc_writeUTrie2Arrays(f,
-        "static const uint16_t ucase_props_trieIndex[%ld]={\n", NULL,
+        "static const uint16_t ucase_props_trieIndex[%ld]={\n", nullptr,
         pTrie,
         "\n};\n\n");
     usrc_writeArray(f,
@@ -1218,14 +1218,14 @@ CasePropsBuilder::writeCSourceFile(const char *path, UErrorCode &errorCode) {
         "\n};\n\n");
     fputs(
         "static const UCaseProps ucase_props_singleton={\n"
-        "  NULL,\n"
+        "  nullptr,\n"
         "  ucase_props_indexes,\n"
         "  ucase_props_exceptions,\n"
         "  ucase_props_unfold,\n",
         f);
     usrc_writeUTrie2Struct(f,
         "  {\n",
-        pTrie, "ucase_props_trieIndex", NULL,
+        pTrie, "ucase_props_trieIndex", nullptr,
         "  },\n");
     usrc_writeArray(f, "  { ", dataInfo.formatVersion, 8, 4, "", " }\n");
     fputs("};\n\n"
@@ -1238,7 +1238,7 @@ CasePropsBuilder::writeBinaryData(const char *path, UBool withCopyright, UErrorC
     if(U_FAILURE(errorCode)) { return; }
 
     UNewDataMemory *pData=udata_create(path, "icu", "ucase", &dataInfo,
-                                       withCopyright ? U_COPYRIGHT_STRING : NULL, &errorCode);
+                                       withCopyright ? U_COPYRIGHT_STRING : nullptr, &errorCode);
     if(U_FAILURE(errorCode)) {
         fprintf(stderr, "genprops: udata_create(%s, ucase.icu) failed - %s\n",
                 path, u_errorName(errorCode));
@@ -1267,9 +1267,9 @@ CasePropsBuilder::writeBinaryData(const char *path, UBool withCopyright, UErrorC
 
 PropsBuilder *
 createCasePropsBuilder(UErrorCode &errorCode) {
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     PropsBuilder *pb=new CasePropsBuilder(errorCode);
-    if(pb==NULL) {
+    if(pb==nullptr) {
         errorCode=U_MEMORY_ALLOCATION_ERROR;
     }
     return pb;
index 6c89b38b11209aa5d1f745beb0c8d3043d65452f..9acdf340333c8f2528c611799abd3e4feef64b92 100644 (file)
@@ -337,7 +337,7 @@ private:
 };
 
 CorePropsBuilder::CorePropsBuilder(UErrorCode &errorCode)
-        : pTrie(NULL), props2Trie(NULL), pv(NULL) {
+        : pTrie(nullptr), props2Trie(nullptr), pv(nullptr) {
     pTrie=utrie2_open(0, 0, &errorCode);
     if(U_FAILURE(errorCode)) {
         fprintf(stderr, "genprops error: corepropsbuilder utrie2_open() failed - %s\n",
@@ -521,7 +521,7 @@ CorePropsBuilder::setGcAndNumeric(const UniProps &props, const UnicodeSet &newVa
 
     int32_t type=props.getIntProp(UCHAR_NUMERIC_TYPE);
     const char *nvString=props.numericValue;
-    if(type!=U_NT_NONE && nvString==NULL && start==end) {
+    if(type!=U_NT_NONE && nvString==nullptr && start==end) {
         fprintf(stderr, "genprops error: cp line has Numeric_Type but no Numeric_Value\n");
         errorCode=U_ILLEGAL_ARGUMENT_ERROR;
         return;
@@ -532,13 +532,13 @@ CorePropsBuilder::setGcAndNumeric(const UniProps &props, const UnicodeSet &newVa
     }
 
     int32_t ntv=UPROPS_NTV_NONE;  // numeric type & value
-    if(nvString!=NULL && uprv_strcmp(nvString, "NaN")!=0) {
+    if(nvString!=nullptr && uprv_strcmp(nvString, "NaN")!=0) {
         int32_t digitValue=props.digitValue;
         if( type<=U_NT_NONE || U_NT_NUMERIC<type ||
             ((type==U_NT_DECIMAL || type==U_NT_DIGIT) && digitValue<0)
         ) {
             fprintf(stderr, "genprops error: nt=%d but nv=%s\n",
-                    (int)type, nvString==NULL ? "NULL" : nvString);
+                    (int)type, nvString==nullptr ? "nullptr" : nvString);
             errorCode=U_ILLEGAL_ARGUMENT_ERROR;
             return;
         }
@@ -826,7 +826,7 @@ CorePropsBuilder::build(UErrorCode &errorCode) {
     }
 
     int32_t pvRows;
-    upvec_getArray(pv, &pvRows, NULL);
+    upvec_getArray(pv, &pvRows, nullptr);
     int32_t pvCount=pvRows*UPROPS_VECTOR_WORDS;
 
     /* round up scriptExtensions to multiple of 4 bytes */
@@ -880,12 +880,12 @@ CorePropsBuilder::writeCSourceFile(const char *path, UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return; }
 
     int32_t pvRows;
-    const uint32_t *pvArray=upvec_getArray(pv, &pvRows, NULL);
+    const uint32_t *pvArray=upvec_getArray(pv, &pvRows, nullptr);
     int32_t pvCount=pvRows*UPROPS_VECTOR_WORDS;
 
     FILE *f=usrc_create(path, "uchar_props_data.h", 2016,
                         "icu/tools/unicode/c/genprops/corepropsbuilder.cpp");
-    if(f==NULL) {
+    if(f==nullptr) {
         errorCode=U_FILE_ACCESS_ERROR;
         return;
     }
@@ -896,21 +896,21 @@ CorePropsBuilder::writeCSourceFile(const char *path, UErrorCode &errorCode) {
         "",
         "};\n\n");
     usrc_writeUTrie2Arrays(f,
-        "static const uint16_t propsTrie_index[%ld]={\n", NULL,
+        "static const uint16_t propsTrie_index[%ld]={\n", nullptr,
         pTrie,
         "\n};\n\n");
     usrc_writeUTrie2Struct(f,
         "static const UTrie2 propsTrie={\n",
-        pTrie, "propsTrie_index", NULL,
+        pTrie, "propsTrie_index", nullptr,
         "};\n\n");
 
     usrc_writeUTrie2Arrays(f,
-        "static const uint16_t propsVectorsTrie_index[%ld]={\n", NULL,
+        "static const uint16_t propsVectorsTrie_index[%ld]={\n", nullptr,
         props2Trie,
         "\n};\n\n");
     usrc_writeUTrie2Struct(f,
         "static const UTrie2 propsVectorsTrie={\n",
-        props2Trie, "propsVectorsTrie_index", NULL,
+        props2Trie, "propsVectorsTrie_index", nullptr,
         "};\n\n");
 
     usrc_writeArray(f,
@@ -941,11 +941,11 @@ CorePropsBuilder::writeBinaryData(const char *path, UBool withCopyright, UErrorC
     if(U_FAILURE(errorCode)) { return; }
 
     int32_t pvRows;
-    const uint32_t *pvArray=upvec_getArray(pv, &pvRows, NULL);
+    const uint32_t *pvArray=upvec_getArray(pv, &pvRows, nullptr);
     int32_t pvCount=pvRows*UPROPS_VECTOR_WORDS;
 
     UNewDataMemory *pData=udata_create(path, "icu", "uprops", &dataInfo,
-                                       withCopyright ? U_COPYRIGHT_STRING : NULL, &errorCode);
+                                       withCopyright ? U_COPYRIGHT_STRING : nullptr, &errorCode);
     if(U_FAILURE(errorCode)) {
         fprintf(stderr, "genprops: udata_create(%s, uprops.icu) failed - %s\n",
                 path, u_errorName(errorCode));
@@ -974,9 +974,9 @@ CorePropsBuilder::writeBinaryData(const char *path, UBool withCopyright, UErrorC
 
 PropsBuilder *
 createCorePropsBuilder(UErrorCode &errorCode) {
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     PropsBuilder *pb=new CorePropsBuilder(errorCode);
-    if(pb==NULL) {
+    if(pb==nullptr) {
         errorCode=U_MEMORY_ALLOCATION_ERROR;
     }
     return pb;
index 00f7891413a7705f234a9d5f81011598fc12daa8..bd77a168e71ca249d0d816ea6f4f2825a72e4a6c 100644 (file)
@@ -169,7 +169,7 @@ main(int argc, char* argv[]) {
             UChar32 start, end;
             if(ppucd.getRangeForAlgNames(start, end, errorCode)) {
                 const char *type=ppucd.nextField();
-                const char *prefix=ppucd.nextField();  // NULL if type==hangul
+                const char *prefix=ppucd.nextField();  // nullptr if type==hangul
                 namesPropsBuilder->setAlgNamesRange(start, end, type, prefix, errorCode);
             }
         }
index 8ab1f4b09f17363a4d093b911245be9755f4a254..089fcc4a5d2a74b81bad859ec3f0e7fe4658cc16 100644 (file)
@@ -253,7 +253,7 @@ LayoutPropsBuilder::writeBinaryData(const char *path, UBool withCopyright, UErro
 
     UNewDataMemory *pData = udata_create(
         path, ULAYOUT_DATA_TYPE, ULAYOUT_DATA_NAME, &dataInfo,
-        withCopyright ? U_COPYRIGHT_STRING : NULL, &errorCode);
+        withCopyright ? U_COPYRIGHT_STRING : nullptr, &errorCode);
     if (U_FAILURE(errorCode)) {
         fprintf(stderr, "genprops: udata_create(%s, ulayout.icu) failed - %s\n",
                 path, u_errorName(errorCode));
index 30aa34b4ce9d8e6ec5128e4c88d05a56b1411f3a..883aea363049b0a330cbc66e8f2cc546f85a73ff 100644 (file)
@@ -302,27 +302,27 @@ NamesPropsBuilder::setProps(const UniProps &props, const UnicodeSet &newValues,
 
     U_ASSERT(props.start==props.end);
 
-    const char *names[4]={ NULL, NULL, NULL, NULL };
+    const char *names[4]={ nullptr, nullptr, nullptr, nullptr };
     int16_t lengths[4]={ 0, 0, 0, 0 };
 
     /* get the character name */
-    if(props.name!=NULL) {
+    if(props.name!=nullptr) {
         names[0]=props.name;
         lengths[0]=(int16_t)uprv_strlen(props.name);
         parseName(names[0], lengths[0]);
     }
 
     CharString buffer;
-    if(props.nameAlias!=NULL) {
+    if(props.nameAlias!=nullptr) {
         /*
          * Only use "correction" aliases for now, from Unicode 6.1 NameAliases.txt with 3 fields per line.
          * TODO: Work on ticket #8963 to deal with multiple type:alias pairs per character.
          */
         const char *corr=uprv_strstr(props.nameAlias, "correction=");
-        if(corr!=NULL) {
+        if(corr!=nullptr) {
             corr+=11;  // skip "correction="
             const char *limit=uprv_strchr(corr, ',');
-            if(limit!=NULL) {
+            if(limit!=nullptr) {
                 buffer.append(corr, limit-corr, errorCode);
                 names[3]=buffer.data();
                 lengths[3]=(int16_t)(limit-corr);
@@ -358,7 +358,7 @@ parseName(const char *name, int16_t length) {
         wordLength=(int16_t)(limit-start);
         if(wordLength>1) {
             word=findWord(name+start, wordLength);
-            if(word==NULL) {
+            if(word==nullptr) {
                 word=addWord(name+start, wordLength);
             }
             countWord(word);
@@ -372,7 +372,7 @@ parseName(const char *name, int16_t length) {
         if(prevStart!=-1) {
             wordLength=limit-prevStart;
             word=findWord(name+prevStart, wordLength);
-            if(word==NULL) {
+            if(word==nullptr) {
                 word=addWord(name+prevStart, wordLength);
             }
             countWord(word);
@@ -495,7 +495,7 @@ compress(UErrorCode &errorCode) {
 
     /* sort the words in reverse order by weight */
     uprv_sortArray(words, wordCount, sizeof(Word),
-                   compareWords, NULL, false, &errorCode);
+                   compareWords, nullptr, false, &errorCode);
 
     /* remove the words that do not save anything */
     while(wordCount>0 && words[wordCount-1].weight<1) {
@@ -543,7 +543,7 @@ compress(UErrorCode &errorCode) {
         /* sort these words in reverse order by weight */
         errorCode=U_ZERO_ERROR;
         uprv_sortArray(words+tokenCount, wordCount-tokenCount, sizeof(Word),
-                        compareWords, NULL, false, &errorCode);
+                        compareWords, nullptr, false, &errorCode);
 
         /* remove the words that do not save anything */
         while(wordCount>0 && words[wordCount-1].weight<1) {
@@ -629,7 +629,7 @@ compress(UErrorCode &errorCode) {
 
 static void
 compressLines() {
-    Line *line=NULL;
+    Line *line=nullptr;
     uint32_t i=0, inLine, outLine=0xffffffff /* (uint32_t)(-1) */,
              groupMSB=0xffff, lineCount2;
     int16_t groupTop=0;
@@ -768,7 +768,7 @@ NamesPropsBuilder::writeBinaryData(const char *path, UBool withCopyright, UError
     if(U_FAILURE(errorCode)) { return; }
 
     UNewDataMemory *pData=udata_create(path, "icu", "unames", &dataInfo,
-                                       withCopyright ? U_COPYRIGHT_STRING : NULL, &errorCode);
+                                       withCopyright ? U_COPYRIGHT_STRING : nullptr, &errorCode);
     if(U_FAILURE(errorCode)) {
         fprintf(stderr, "genprops: udata_create(%s, unames.icu) failed - %s\n",
                 path, u_errorName(errorCode));
@@ -938,7 +938,7 @@ findWord(const char *s, int16_t length) {
         }
     }
 
-    return NULL;
+    return nullptr;
 }
 
 static Word *
@@ -1121,9 +1121,9 @@ allocWord(uint32_t length) {
 
 PropsBuilder *
 createNamesPropsBuilder(UErrorCode &errorCode) {
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     PropsBuilder *pb=new NamesPropsBuilder(errorCode);
-    if(pb==NULL) {
+    if(pb==nullptr) {
         errorCode=U_MEMORY_ALLOCATION_ERROR;
     }
     return pb;
index 3e4748745af86a8e1285e25090a7052cdab1308a..54313eef27adca1dbab52742a986e9017842a39e 100644 (file)
@@ -143,7 +143,7 @@ public:
 
 Property::Property(int32_t enumValue, const char *joinedAliases)
         : Value(enumValue, joinedAliases),
-          values(enumValue<UCHAR_BINARY_LIMIT ? VALUES_binprop : NULL),
+          values(enumValue<UCHAR_BINARY_LIMIT ? VALUES_binprop : nullptr),
           valueCount(enumValue<UCHAR_BINARY_LIMIT ? 2 : 0) {}
 
 // END DATA
@@ -152,7 +152,7 @@ Property::Property(int32_t enumValue, const char *joinedAliases)
 class PNamesPropertyNames : public PropertyNames {
 public:
     PNamesPropertyNames()
-            : valueMaps(NULL), bytesTries(NULL) {}
+            : valueMaps(nullptr), bytesTries(nullptr) {}
     void init(const int32_t *vm, const uint8_t *bt) {
         valueMaps=vm;
         bytesTries=bt;
@@ -172,7 +172,7 @@ class PNamesBuilderImpl : public PNamesBuilder {
 public:
     PNamesBuilderImpl(UErrorCode &errorCode)
             : valueMaps(errorCode), btb(errorCode), maxNameLength(0),
-              nameGroupToOffset(NULL) {}
+              nameGroupToOffset(nullptr) {}
 
     ~PNamesBuilderImpl() {
         uhash_close(nameGroupToOffset);
@@ -188,7 +188,7 @@ public:
             errorCode=U_INTERNAL_PROGRAM_ERROR;
             return;
         }
-        nameGroupToOffset=uhash_open(uhash_hashChars, uhash_compareChars, NULL, &errorCode);
+        nameGroupToOffset=uhash_open(uhash_hashChars, uhash_compareChars, nullptr, &errorCode);
         // Build main property aliases value map at value map offset 0,
         // so that we need not store another offset for it.
         UVector32 propEnums(errorCode);
@@ -491,7 +491,7 @@ PNamesBuilderImpl::writeCSourceFile(const char *path, UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return; }
     FILE *f=usrc_create(path, "propname_data.h", 2016,
                         "icu/tools/unicode/c/genprops/pnamesbuilder.cpp");
-    if(f==NULL) {
+    if(f==nullptr) {
         errorCode=U_FILE_ACCESS_ERROR;
         return;
     }
@@ -521,9 +521,9 @@ PNamesBuilderImpl::writeCSourceFile(const char *path, UErrorCode &errorCode) {
 
 PNamesBuilder *
 createPNamesBuilder(UErrorCode &errorCode) {
-    if(U_FAILURE(errorCode)) { return NULL; }
+    if(U_FAILURE(errorCode)) { return nullptr; }
     PNamesBuilder *pb=new PNamesBuilderImpl(errorCode);
-    if(pb==NULL) {
+    if(pb==nullptr) {
         errorCode=U_MEMORY_ALLOCATION_ERROR;
     }
     return pb;
@@ -551,7 +551,7 @@ int32_t PNamesPropertyNames::findProperty(int32_t property) const {
 }
 
 UBool PNamesPropertyNames::containsName(BytesTrie &trie, const char *name) const {
-    if(name==NULL) {
+    if(name==nullptr) {
         return false;
     }
     UStringTrieResult result=USTRINGTRIE_NO_VALUE;
index b20d0310e89ae508739fdfbb6fda0ff0f7f466c5..302c5324113d74c12b77e8aa422f3031830a4028 100644 (file)
@@ -100,7 +100,7 @@ CollationBaseDataBuilder::~CollationBaseDataBuilder() {
 void
 CollationBaseDataBuilder::init(UErrorCode &errorCode) {
     if(U_FAILURE(errorCode)) { return; }
-    if(trie != NULL) {
+    if(trie != nullptr) {
         errorCode = U_INVALID_STATE_ERROR;
         return;
     }
index 863c03ffb64b226012372d28fc26da10f3e139c5..1f08eba66411456f6a7faf549f3499dc6a21a3b7 100644 (file)
@@ -133,7 +133,7 @@ static uint32_t parseWeight(char *&s, const char *separators,
         ++s;
     }
     char c = *s;
-    if(c == 0 || strchr(separators, c) == NULL) {
+    if(c == 0 || strchr(separators, c) == nullptr) {
         errorCode = U_INVALID_FORMAT_ERROR;
         return 0;
     }
@@ -446,8 +446,8 @@ private:
     UBool done;
 };
 
-static HanOrder *implicitHanOrder = NULL;
-static HanOrder *radicalStrokeOrder = NULL;
+static HanOrder *implicitHanOrder = nullptr;
+static HanOrder *radicalStrokeOrder = nullptr;
 
 enum ActionType {
   READCE,
@@ -545,7 +545,7 @@ static void readAnOption(
                     return;
                 }
             } else if(what_to_do == READUNIFIEDIDEOGRAPH) {
-                if(implicitHanOrder != NULL) {
+                if(implicitHanOrder != nullptr) {
                     fprintf(stderr, "duplicate [Unified_Ideograph] lines\n");
                     *status = U_INVALID_FORMAT_ERROR;
                     return;
@@ -579,8 +579,8 @@ static void readAnOption(
                 }
                 implicitHanOrder->setDone();
             } else if(what_to_do == READRADICAL) {
-                if(radicalStrokeOrder == NULL) {
-                    if(implicitHanOrder == NULL) {
+                if(radicalStrokeOrder == nullptr) {
+                    if(implicitHanOrder == nullptr) {
                         fprintf(stderr, "[radical] section before [Unified_Ideograph] line\n");
                         *status = U_INVALID_FORMAT_ERROR;
                         return;
@@ -608,7 +608,7 @@ static void readAnOption(
                     // Ignore the radical data before the :.
                     char *startPointer = uprv_strchr(pointer, ':');
                     char *limitPointer = uprv_strchr(pointer, ']');
-                    if(startPointer == NULL || limitPointer == NULL ||
+                    if(startPointer == nullptr || limitPointer == nullptr ||
                             (startPointer + 1) >= limitPointer) {
                         fprintf(stderr, "[radical]: no Han characters listed between : and ]\n");
                         *status = U_INVALID_FORMAT_ERROR;
@@ -661,7 +661,7 @@ static void readAnOption(
                     fprintf(stderr, "warning: UCA version %s != UCD version %s\n", uca, ucd);
                 }
             } else if (what_to_do == READLEADBYTETOSCRIPTS) {
-                if (strstr(pointer, "COMPRESS") != NULL) {
+                if (strstr(pointer, "COMPRESS") != nullptr) {
                     uint16_t leadByte = (hex2num(*pointer++) * 16);
                     leadByte += hex2num(*pointer++);
                     builder.setCompressibleLeadByte(leadByte);
@@ -708,21 +708,21 @@ readAnElement(char *line,
     CharString input;
     char *startCodePoint = line;
     char *endCodePoint = strchr(startCodePoint, ';');
-    if(endCodePoint == NULL) {
+    if(endCodePoint == nullptr) {
         fprintf(stderr, "error - line with no code point:\n%s\n", line);
         *status = U_INVALID_FORMAT_ERROR; /* No code point - could be an error, but probably only an empty line */
         return false;
     }
 
     char *pipePointer = strchr(line, '|');
-    if (pipePointer != NULL) {
+    if (pipePointer != nullptr) {
         // Read the prefix string which precedes the actual string.
         input.append(startCodePoint, (int32_t)(pipePointer - startCodePoint), *status);
         UChar *prefixChars = prefix.getBuffer(32);
         int32_t prefixSize =
             u_parseString(input.data(),
                           prefixChars, prefix.getCapacity(),
-                          NULL, status);
+                          nullptr, status);
         if(U_FAILURE(*status)) {
             prefix.releaseBuffer(0);
             fprintf(stderr, "error - parsing of prefix \"%s\" failed: %s\n%s\n",
@@ -741,7 +741,7 @@ readAnElement(char *line,
     int32_t cSize =
         u_parseString(input.data(),
                       uchars, s.getCapacity(),
-                      NULL, status);
+                      nullptr, status);
     if(U_FAILURE(*status)) {
         s.releaseBuffer(0);
         fprintf(stderr, "error - parsing of code point(s) \"%s\" failed: %s\n%s\n",
@@ -754,7 +754,7 @@ readAnElement(char *line,
     char *pointer = endCodePoint + 1;
 
     char *commentStart = strchr(pointer, '#');
-    if(commentStart == NULL) {
+    if(commentStart == nullptr) {
         commentStart = strchr(pointer, 0);
     }
 
@@ -825,7 +825,7 @@ parseFractionalUCA(const char *filename,
 {
     if(U_FAILURE(*status)) { return; }
     FILE *data = fopen(filename, "r");
-    if(data == NULL) {
+    if(data == nullptr) {
         fprintf(stderr, "Couldn't open file: %s\n", filename);
         *status = U_FILE_ACCESS_ERROR;
         return;
@@ -848,7 +848,7 @@ parseFractionalUCA(const char *filename,
 
         lineNumber++;
         char *line = fgets(buffer, sizeof(buffer), data);
-        if(line == NULL) {
+        if(line == nullptr) {
             if(feof(data)) {
                 break;
             } else {
@@ -1125,7 +1125,7 @@ buildAndWriteBaseData(CollationBaseDataBuilder &builder,
     LocalMemory<uint8_t> buffer;
     int32_t capacity = 1000000;
     uint8_t *dest = buffer.allocateInsteadAndCopy(capacity);
-    if(dest == NULL) {
+    if(dest == nullptr) {
         fprintf(stderr, "memory allocation (%ld bytes) for file contents failed\n",
                 (long)capacity);
         errorCode = U_MEMORY_ALLOCATION_ERROR;
@@ -1153,7 +1153,7 @@ buildAndWriteBaseData(CollationBaseDataBuilder &builder,
             (icu4xMode ? "ucadata-implicithan-icu4x" : "ucadata-implicithan") :
             (icu4xMode ? "ucadata-unihan-icu4x" : "ucadata-unihan");
     UNewDataMemory *pData=udata_create(path, "icu", dataName, &ucaDataInfo,
-                                       withCopyright ? U_COPYRIGHT_STRING : NULL, &errorCode);
+                                       withCopyright ? U_COPYRIGHT_STRING : nullptr, &errorCode);
     if(U_FAILURE(errorCode)) {
         fprintf(stderr, "genuca: udata_create(%s, ucadata.icu) failed - %s\n",
                 path, u_errorName(errorCode));
@@ -1263,7 +1263,7 @@ buildAndWriteFCDData(const char *path, UErrorCode &errorCode) {
 
     FILE *f=usrc_create(path, "collationfcd.cpp", 2016,
                         "icu/tools/unicode/c/genuca/genuca.cpp");
-    if(f==NULL) {
+    if(f==nullptr) {
         errorCode=U_FILE_ACCESS_ERROR;
         return;
     }
index 1c569b3097ee2ccaddf6efad485f39ab46e0f16b..aa3324b4b585b798607e9d27cde922987fd87213 100644 (file)
@@ -64,13 +64,13 @@ toIDNA2003(const UStringPrepProfile *prep, UChar32 c, icu::UnicodeString &destSt
     UChar *dest;
     int32_t destLength;
     dest=destString.getBuffer(32);
-    if(dest==NULL) {
+    if(dest==nullptr) {
         return false;
     }
     UErrorCode errorCode=U_ZERO_ERROR;
     destLength=usprep_prepare(prep, src, srcLength,
                               dest, destString.getCapacity(),
-                              USPREP_DEFAULT, NULL, &errorCode);
+                              USPREP_DEFAULT, nullptr, &errorCode);
     destString.releaseBuffer(destLength);
     if(errorCode==U_STRINGPREP_PROHIBITED_ERROR) {
         return -1;
@@ -158,7 +158,7 @@ main(int argc, const char *argv[]) {
     // derived sets
     icu::LocalUStringPrepProfilePointer namePrep(usprep_openByType(USPREP_RFC3491_NAMEPREP, errorCode));
     const icu::Normalizer2 *nfkc_cf=
-        icu::Normalizer2::getInstance(NULL, "nfkc_cf", UNORM2_COMPOSE, errorCode);
+        icu::Normalizer2::getInstance(nullptr, "nfkc_cf", UNORM2_COMPOSE, errorCode);
     errorCode.assertSuccess();
 
     // HACK: The StringPrep API performs a BiDi check according to the data.
@@ -207,7 +207,7 @@ main(int argc, const char *argv[]) {
         addAll(unassignedSet);
 
     const icu::Normalizer2 *nfd=
-        icu::Normalizer2::getInstance(NULL, "nfc", UNORM2_DECOMPOSE, errorCode);
+        icu::Normalizer2::getInstance(nullptr, "nfc", UNORM2_DECOMPOSE, errorCode);
     errorCode.assertSuccess();
 
     icu::UnicodeSet ignoredSet;  // will be a subset of mappedSet