These optional output parameters weren't used when these function were
originally added so they were most likely included just in case someone
would want to use them in the future, but that was 10 years ago now and
they still haven't been used yet, so it's unlikely that they'll be used
in the foreseeable future and call sites as well as the implementation
can instead be simplified by removing them.
There are some memory leak in Locale which is hard to figure out why.
Use different variable to track memory allocation to avoid inconsistent
state while malloc fail
This makes it possible to call public functions that take a string class
as a template parameter and return an object of that class (implemented
through the StringByteSink helper class) also with the CharString class,
even though this class doesn't actually provide the public API required
by StringByteSink.
This makes it possible to use such more modern APIs also internally.
The repeated sequence of allocating a CharString and CharStringByteSink,
before calling some function that writes into this, can be moved into a
single shared helper function which then is used to give all ulocimp.h
functions that write to ByteSink an overload that instead returns a
CharString, to make call sites look like perfectly normal C++ code.
· No function should do anything if an error has already occurred.
· On error, a value of 0, nullptr, {}, etc., should be returned.
· Values shouldn't have overloaded meanings (eg. index or found).
· Values that are never used should not be returned at all.
Some of this code was originally written as C code and some of this code
was originally written as C++ code but made to resemble the then already
existing code that had once been C code. Changing it all to normal C++
now will make it easier and safer to work with going forward.
· Use unnamed namespace instead of static.
· Use reference instead of non-nullable pointer.
· Use bool instead of UBool.
· Use constexpr for static data.
· Use U_EXPORT instead of U_CAPI or U_CFUNC.
· Use the default calling convention instead of U_EXPORT2.
The count() is incorrect if the Locale contains extension which is not -u-
for example -x-, -t-.
Currently, this PR only contains tests to show the problem.
ICU-22457 Fix the enum_count
Change testdata/likelySubtags.txt to consider FAIL line
ICU-20777 Fix Java Tests
ICU-20777 Fix all issues
ICU-20777 Incase timeout
ICU-20777
ICU-20777 Skip Data Driven test
This is the normal standard way in C, C++ as well as Java and there's no
longer any reason for ICU to be different. The various internal macros
providing custom boolean constants can all be deleted and code as well
as documentation can be updated to use lowercase true/false everywhere.
Remove the ICU macros ATOMIC_INT32_T_INITIALIZER and U_INITONCE_INITIALIZER,
which made use of C++ ATOMIC_VAR_INIT, which has been removed from C++20.
With modern C++ features being available, these macros no longer served
any real need.
Revise uses of UVector in Locale and Region related code to better handle
memory allocation failures. This is one of an ongoing series of commits to
address similar problems with UVector usage throughout ICU.
The changes involve switching uses of UVector::addElementX() to the new
adoptElement() or addElement() functions, as appropriate, and using
LocalPointers for tracking memory ownership.
In Region::loadRegionData(), improved the overall error detection and recovery.
This is the first step towards improving the error handling and out-of-memory
behavior of UVector::addElement(). A followup PR will add back a new addElement()
with corrected error handling, then additional followups will switch call sites
from the original (renamed) function to the new addElement().
This commit includes no logic or behavior changes; it only renames the existing functions.