Andy Heninger [Thu, 9 Aug 2018 18:28:55 +0000 (11:28 -0700)]
ICU-7270 Line Break rule LB8 updated for UAX-14 conformance. (#41)
Includes all line break tailorings.
Corresponding updates to monkey test rules.
State table builder, fix missed table optimization, uncovered by new rule.
Jeff Genovy [Wed, 8 Aug 2018 19:13:42 +0000 (12:13 -0700)]
ICU-13686 ICU4C: Prevent double file separators on data file paths. (#42)
ICU very often ends up with double separators in the file paths used to open files. This change prevents extra slashes on data file paths.
- The feedback from Markus was that the suffix shouldn't really start with a separator.
- It turns out that the suffix can be used for either a file extension (like .dat or .res) or for an actual item name as well (like ibm-5348_P100-1997.cnv).
- If the suffix is an extension then we don't want to append the separator at all. We only want to append it if the suffix is an item name.
- Also use a StringPiece to save repeated implicit calls to uprv_strlen.
Jeff Genovy [Wed, 8 Aug 2018 18:38:28 +0000 (11:38 -0700)]
ICU-13814 Fix define for excluding renaming from VS IntelliSense, so F12 works. (#22)
In the prior change for this ticket the logic was mixed up. For IntelliSense we actually want to turn *off* the renaming defines so that VS doesn't get confused when you press F12.
Fredrik Roubert [Mon, 6 Aug 2018 12:22:35 +0000 (14:22 +0200)]
ICU-20062 Set the Python -B flag to inhibit the writing of .pyc files.
This will prevent littering the source tree with spurious .pyc files.
The potential faster execution when re-running a script that has an
up-to-date .pyc file is negligible.
Fredrik Roubert [Tue, 10 Jul 2018 19:09:47 +0000 (21:09 +0200)]
ICU-20016 Skip testing pseudolocale region codes for display names.
At the moment, CLDR pseudolocale region codes don't have display names.
As long as that is so, ICU must not require them to exist in order to
not cause bogus test failures when building with pseudolocales.
Jeff Genovy [Mon, 6 Aug 2018 20:22:46 +0000 (13:22 -0700)]
ICU-20036 CurrencyPluralInfo class improve handling of OOM errors (#17)
ICU-20036 CurrencyPluralInfo class doesn't always check/handle OOM errors.
Changes include:
- Using LocalPointer instead of raw new/delete, in order to make the code cleaner.
- Using nullptr instead of NULL.
- Inspired by Andy's review feedback PluralRules changes, this change sets fPluralRules and fLocale to nullptr in the assignment operator in order to prevent possible double deletes in the failure case.
- More consistent about not checking for nullptr when calling delete.
- Using LocalUResourceBundlePointer in order to simply the code and not need manual deletes.
- Reduce memory usage by using the same LocalUResourceBundle with .getAlias() instead of allocating new ones.
Fredrik Roubert [Tue, 10 Jul 2018 21:00:43 +0000 (23:00 +0200)]
ICU-20018 Remove hardcoded expectations on available locales.
Both the number of installed locales and the name of the last locale
change with updates to and customizations of CLDR/ICU data so test
expectations on these values will cause bogus test failures.
Jeff Genovy [Fri, 3 Aug 2018 20:30:03 +0000 (13:30 -0700)]
ICU-20046 Improve OOM error checking in the RBNF class. (#24)
- There are a few locations in the RBNF class that don't check for out-of-memory (OOM) failures.
- Using LocalPointer to clean up the manual deletes.
- Change to use nullptr instead of NULL.
- A few minor typo fixes as well.
Jeff Genovy [Thu, 2 Aug 2018 23:23:07 +0000 (16:23 -0700)]
ICU-20041 Improve handling of OOM failures in NumberingSystem class. (#19)
ICU-20041 ICU4C NumberingSystem class doesn't handle out-of-memory (OOM) failures.
- Not all code paths in the NumberingSystem class check for OOM failures. This can lead to crashes in some cases as null pointers will be dereferenced without any checks.
- Change to use nullptr instead of NULL.
- Don't stomp on OOM errors when attempting to load resources. We should report back OOM to the caller.
- Use LocalPointer in order simplify the code and for automatic clean-up of memory.
- Use LocalUResourceBundlePointer as well to help simply things even more.
Jeff Genovy [Thu, 2 Aug 2018 06:33:03 +0000 (23:33 -0700)]
ICU-20042 Improve OOM handling in PluralRules class. (#20)
- PluralRules class doesn't handle out-of-memory (OOM) errors in some code paths.
- The clone and assignment operator (operator=) methods of construction don't take an error code parameter, meaning that if an OOM error occurs during the constructor, it will not reported back to the caller, and the caller has no way to know that the object is in a half-constructed state.
- Using an internal status variable for these above cases.
- Changes to the various PluralRules helper classes to check for OOM as well.
- Using nullptr instead NULL.
- Using LocalPointer instead of raw new/delete in some cases.
- Need to set mRules to nullptr, otherwise we can end up with double deletes in the failure case. (Thanks to Andy for the review).
- Using default member initializers for class members to avoid dangling pointers. Also allows for using default constructors too.
Jeff Genovy [Thu, 2 Aug 2018 05:44:39 +0000 (22:44 -0700)]
ICU-20034 ICU4C Locale assignment operator should set the locale to bogus if OOM occurs. (#14)
ICU-20034 ICU4C the Locale class's assignment operator should set the locale to "bogus" if an OOM error occurs when attempting to copy data over from the other locale.
Also need to check strdup, as that calls malloc and it can fail too.
Jeff Genovy [Fri, 20 Jul 2018 00:15:51 +0000 (17:15 -0700)]
ICU-20005 Update/clean-up the .gitattributes file after the automated conversion from the scripts. Also add some comments for others, and use the diff helpers for better diffs.
Jeff Genovy [Wed, 27 Jun 2018 19:25:52 +0000 (19:25 +0000)]
ICU-13778 DataTimePatternGenerator code refactor. Handle Out-of-Memory (OOM) errors, use LocalPointer to prevent memory leaks when OOM occurs, use an internal error code to better report errors during clone and copy construction, mark helper methods and parameters as const, use nullptr instead of NULL, minor spelling and formatting changes. (Note: All tests pass on Windows and Linux).
Fredrik Roubert [Thu, 21 Jun 2018 20:17:22 +0000 (20:17 +0000)]
ICU-13766 Make UnicodeMapTest#TestUnicodeMapGeneralCategory smaller.
There are 0x10FFFF code points and this test allocates memory for every
code point tested. Testing every single one of them is therefore memory
intensive and slow, without adding any real value to the test.
Instead an equivalent test coverage can be achieved by testing a much
smaller set of ranges of code points that cover all categories.
Markus Scherer [Wed, 30 May 2018 19:15:02 +0000 (19:15 +0000)]
ICU-13667 LocalizedNumberFormatterAsFormat is in the old Format class hierarchy, add ClassID boilerplate; NoUnit move virtual destructor up into first-virtual position, right after constructors