Commit graph

31745 commits

Author SHA1 Message Date
Andy Heninger
6f1d83cf63 ICU-21662 UVector cleanup in basictz.cpp
Revise uses of UVector in basictz.cpp 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 primarily involve switching to the use of LocalPointers for
the tracking of memory ownership, and to simplify cleanup in case of errors.

In the function BasicTimeZone::getTimeZoneRulesAfter(), also switched some additional
allocated memory to use LocalPointer or LocalMemory, for consistency in
memory handling.
2021-09-17 14:35:18 -07:00
Markus Scherer
3f0e003901 ICU-11891 make UnicodeSet.toPattern() well-formed & round-trip 2021-09-17 13:49:13 -07:00
Bernhard Messerklinger
43276e8c34 ICU-21429 Allow timezones with max 2 digits at the end to 2021-09-17 15:26:06 -04:00
Peter Edberg
d5d0b2d811 ICU-21581 integrate CLDR release-40-alpha4 to ICU trunk 2021-09-16 16:15:49 -07:00
Shane F. Carr
7b1bcdcb61 ICU-21668 Fix nickel rounding with away-from-zero rounding mode
See #1814
2021-09-15 21:57:10 -05:00
Shane F. Carr
13fb584b96 ICU-21684 Fix performance issue in NumberRangeFormatter 2021-09-15 16:59:22 -05:00
Shane F. Carr
aa17f2638f ICU-21675 Add Infinity and NaN tests for NumberRangeFormatter 2021-09-15 14:31:21 -05:00
Frank Tang
adb109f440 ICU-21749 Fix stack-use-after-scope bug in uloc
See #1858
2021-09-15 11:25:45 -07:00
Jacky_Yin
29443b8be7 ICU-21752 fix wrong link of howtouseicu 2021-09-15 10:43:15 -07:00
Andy Heninger
46861a5c78 ICU-21662 UVector Error Handling in Regex
Clean up some oversights from commit 0ec329c. This was triggered by fuzz testing finding
a memory leak with the original commit, see https://oss-fuzz.com/testcase-detail/4656781834452992

I was unable to replicate the fuzzing failure, but reviewing the nearby code showed
some likely problems.

In this commit,
- Fix UStack::pop() to not delete the popped element when a deleter function is present.
  This was a bug, but because there were no stacks with deleters, was not causing trouble.

- Change RegexCompile::compileSet() to delete the set if it cannot be added to the internal
  vector of sets. I suspect this is the cause of the fuzzing leak - 0ec329c changed the
  behavior of UVector in the presence of errors.

- Changed RegexCompile::fSetStack to use an object deleter function. This fixes the
  leak checking at the points new elements are pushed onto this stack.
2021-09-14 19:24:23 -07:00
Peter Edberg
e69f337f3c ICU-21669 UPRV_UNREACHABLE > UPRV_UNREACHABLE_EXIT/ASSERT, update usages 2021-09-14 15:22:52 -07:00
Shane F. Carr
cd3721697a ICU-21654 Fix skeleton output for rounding increment in C++
See #1813
2021-09-14 01:55:58 -05:00
Frank Tang
ff8516b0dd ICU-20870 Fix breakage on UCONFIG_NO_FORMATTING 2021-09-13 20:21:13 -07:00
Peter Edberg
0da0fabfae ICU-20870 If locale/lang name lookup fails, canonicalize lang and try again 2021-09-13 09:50:33 -07:00
gnrunge
d4d29fbee3 ICU-21750 Output tail end of the uconfig variation test run in case of failure
to allow easier identification of build or test failures.
2021-09-10 15:46:27 -07:00
Rich Gillam
c37ca411fc ICU-13353 Fixed several problems preventing horizontal resource inheritance from working as intended, and added a
Java version of a unit test I'd previously only added on the C++ side.
2021-09-10 12:47:15 -07:00
Rich Gillam
b38a49fc7e ICU-21735 Fixed two old references to UNUM_CURRENCY_CASH, one in a comment, one in a unit-test failure message--
to refer to the now-correct UNUM_CASH_CURRENCY.
2021-09-09 14:27:10 -07:00
Peter Edberg
7851f708a3 ICU-21581 integrate CLDR release-40-alpha3 to ICU trunk 2021-09-09 10:57:21 -07:00
Andy Heninger
0ec329c6e1 ICU-21662 Improve UVector error handling.
This is the next installment of UVector error handling cleanup. It includes:

- Revise UStack to follow the conventions of UVector, to leave the stack
  unmodified when there is an incoming error code. And, for stacks with a
  deleter function, to delete the incoming object if it cannot be
  succesfully pushed.

 - Review all useage of UStack in ICU; adjust call sites as needed.

 - Review all uses of UVector::addElementX() in the implementation of
   - Regular Expressions
   - Break Iteration
   - toolutil/xmlparser

   changing to the updated functions, and adjusting call sites as needed.
2021-09-08 17:24:52 -07:00
Younies
e03dce66ef ICU-21730 Port testGetPreferencesFor ICU4C tests to ICU4J
See #1850
2021-09-08 23:30:18 +02:00
Shane F. Carr
92db25165f ICU-21545 Add icuwriteuprops tool
See #1741
2021-09-08 15:27:43 -05:00
Markus Scherer
f9beb616a8 ICU-21652 add emoji properties of strings
- 7 new properties: API constants & property names
- u_stringHasBinaryProperty(s, property) & UCharacter.hasBinaryProperty(s, property)
- two additional source data files
- new genprops part for writing new binary data file uemoji.icu
- data for existing emoji properties moved from uprops.icu (hardcoded in C++) to uemoji.icu (always loaded)
- new EmojiProps implementation
2021-09-08 12:15:50 -07:00
Peter Edberg
6244d57559 ICU-21685 In list of currencies from ucurr_openISOCurrencies(): add VES, remove EQE 2021-09-08 10:49:14 -07:00
Frank Tang
2cf1d23c6c ICU-21734 Add -Wsuggest-override to Build only WarningsAsErrors buildbot
See #1842
2021-09-08 10:47:29 -07:00
Leander Schulten
635a037121 ICU-21630 Ignore .DS_Store files 2021-09-08 10:44:09 -07:00
Jacky_Yin
881f8021ad ICU-21741 remove redundant html tag: </pre>
See #1838
2021-09-08 10:41:32 -07:00
Peter Varga
1986dcd0d8 ICU-21734 Add missing overrides 2021-09-07 17:42:14 -07:00
Peter Varga
90ee0c788f ICU-21734 Add missing overrides to pure virtual methods
These methods are pure virtual in the base class too.
2021-09-07 15:34:48 -07:00
Peter Varga
80d42a13fc ICU-21734 Add missing overrides in tests 2021-09-07 13:56:33 -07:00
Rich Gillam
19b8b076f9 ICU-20992 Added new API for iterating child resources while following aliases, and changed DateTimePatternGenerator
to use it.
2021-09-03 12:47:24 -07:00
Rich Gillam
01e1adc9e4 ICU-21460 Changed the ULocale initializers to allow locale IDs that use BCP47 syntax, but with '_' as a field delimiter.
(APIs that specifically require BCP47 syntax are unaffected-- they still require '-').
2021-09-03 12:47:02 -07:00
Steven R. Loomis
0d407fc616 ICU-21727 Commit Checker: add Reviewer: header 2021-09-03 11:46:32 -05:00
Yoshito Umaoka
26c61c236c ICU-21038 Run ICU4J localespiCheck as a part of CI build
See #1797
2021-09-03 09:05:51 -04:00
yumaoka
369357aaa7 ICU-21530 Added U_HIDE_DEPRECATED_API to deprecated methods. 2021-09-03 09:04:54 -04:00
Andy Heninger
081cf77330 ICU-21662 Improve UVector error handling.
- Add updated versions of UVector::addElement() and ensureCapacity() that respect
  incoming errors.
  Follow on to c26aebe, which renamed the original versions.

- Add UVector::adoptElement() as a replacement for addElement() when the vector
  has a deleter function set, meaning that it adopts ownership of its elements.

  The intent is to make the behavior clearer at the call sites when looking
  at unfamiliar code.

- Make all functions with an incoming failure, as indicated by a UErrorCode parameter,
  leave the vector unchanged.

- Change all functions that store object pointers into the vector such that,
  when the store cannot be completed for any reason _and_ the vector has a deleter function,
  then the incoming object is deleted.

  This change can simplify the error handling code around calls to the affected functions
  (addElement() and insertElementAt(), in particular)

- Add index bounds checking on functions where it was possible - that is, on functions
  with both U_ErrorCode and index parameters.

- Changed to more modern C++ idioms in some parts of the UVector implementation.

- Review & update as required all uses of the UVector functions
  setElementAt(), insertElementAt(), setSize(), sortedInsert()
  these being the functions with changed behavior on error conditions
  (aside from addElement()).

This PR will be followed by more, switching call sites in various ICU services
from UVector::addElementX() (old behavior on errors)
to   UVector::addElement()  (new behavior on errors)
2021-09-02 19:15:36 -07:00
Younies Mahmoud
33e1d87041 ICU-21551 Fixing unit prefix normalization order to match LDML spec
See #1754
2021-09-02 12:23:33 +02:00
Jeff Genovy
e2fe1aa8b7 ICU-21747 Add check for expectedBreakCount in Java 2021-09-01 19:33:41 -07:00
Jeff Genovy
08dbf093ce ICU-21747 Upgrade WarningsAsErrors build bot to Clang-13 on Ubuntu 20.04 2021-09-01 17:04:42 -07:00
Peter Edberg
bbd72fb93e ICU-21581 integrate CLDR release-40-alpha2 to ICU trunk 2021-09-01 16:49:45 -07:00
Markus Scherer
e121dde220 ICU-20769 getAliasTargetAsResourceBundle() only needs ResourceData 2021-09-01 13:56:11 -07:00
Jeff Genovy
cb351ee077 ICU-21740 Output source code line when an error occurs when building with MSVC. 2021-09-01 11:48:17 -07:00
Jeff Genovy
b10a467212 ICU-21579 Fix compiler warnings with MSVC. 2021-08-31 14:03:21 -07:00
Younies
f811ae946f ICU-21730 Check unit aliases support.
See #1804
2021-08-31 18:34:12 +02:00
Markus Scherer
a300d8dd02 ICU-20769 refactor UResourceBundle.fResData & init_resb_result()
- replace UResourceBundle.fResData with access via fData
- change ResourceDataValue.resData into a pointer
- move C tests to C++ that stack-allocate now-C++ UResourceBundle
- init_resb_result():
  - remove redundant ResourceData parameter
  - simplify memory management, and various small simplifications
  - /LOCALE/path reuse valid locale, no ures_open()
  - pull alias-fetching code into separate function getAliasTargetAsResourceBundle()
  - `const char *` for keyPath pieces
  - s/noAlias/recursionDepth/
- getAllItemsWithFallback() set correct parentBundle.fValidLocaleDataEntry
2021-08-31 02:26:33 +00:00
Rich Gillam
985c05a3ef ICU-21671 Corrected a bug in SimpleDateFormat.subParse() that was causing us to always parse quarter names that begin
with numbers as though the number was the whole quarter name.
2021-08-30 16:06:52 -07:00
Jeff Genovy
5b96c2e847 ICU-21710 Additional clean up after removing BOYER_MOORE code from usearch.cpp
Changes:
- We can completely remove the shift tables and related fields from
  data structs.

- Creation of UStringSearch objects should be faster now,
  as it doesn't waste time computing the unused shift tables.

- The sizeof(UStringSearch) is decreased from 5240 to 3192, so
  this should help to reduce memory for applications that create many string search objects.

Note regarding the comments on initialize(). It actually does not set illegal argument error if pattern is all ignoreables. Added a test case for it.
2021-08-30 15:08:16 -07:00
Erik Torres
2b895a71e1 ICU-21555 Fix typos in repo from letter d to i
Fix typos in repo from letter d to i
2021-08-30 16:45:43 -05:00
Erik Torres
0b7701ef3c ICU-21617 Remove work around of uninstalling GCC11 in CI build
Remove work around of uninstalling GCC11 in CI build
2021-08-30 15:17:36 -05:00
Erik Torres
edc62cfcc1 ICU-21130 Update cpp14 to cpp17 in CI builds
See #1827
2021-08-26 19:14:34 -05:00
Erik Torres
c088ca8d39 ICU-21598 Add CI builds that exercises the data filtering on windows
See #1820
2021-08-26 18:04:35 -05:00