summaryrefslogtreecommitdiffstats
path: root/icu
Commit message (Collapse)AuthorAgeFilesLines
* Fix leaks in ICU JNI.Elliott Hughes2009-12-211-428/+219
| | | | | | | | | | | | | | Consistently use RAII to ensure we always clean up our UResourceBundle*s. Remove redundant allocation/copying from the UnicodeString to jstring conversion. Also simplify a few other repetitive bits of code. Note that getContentImpl is still in the old style because that function contains gotos. The right fix for that function involves changing the Java side to work with a class containing a field for each item, rather than the current Object[].
* Speed up the way we access ICU's locale data.Elliott Hughes2009-12-213-433/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes creating a new NumberFormat or new SimpleDateFormat 2x faster. Basically, the ResourceBundle mechanism is really expensive in several ways: 1. The two-level caching is unnecessary for locale data, and expensive because it burns through a lot of temporary objects. 2. The PrivilegedAction stuff is unnecessary and expensive because it too burns quite a few temporary objects (including an ArrayList for each call; should we consider removing support for SecurityManager so we can remove this cruft from our code?). 3. The caching in most cases doesn't cache anything useful; the ResourceBundles simply forward all questions straight to native code anyway, all we're caching is an unnecessary forwarding object (in a cache where lookups cost more than just creating a new unnecessary forwarding object would cost). I've left CurrencyResourceBundle on the slow (ResourceBundle.getBundle) path because I'm not yet sure how much of that path's semantics it relies on. I still return LocaleResourceBundle instances (albeit via a much faster path) but we should fix that. The native code returns an array which ResourceBundle stuffs into a Hashtable and the calling code accesses via hash table lookups. This despite the fact that the keys are a small fixed set known in advance. We could make the native layer and the calling layer simpler and faster by using a "struct", and doing so would make the middle layer go away completely.
* Depessimize string conversions.Elliott Hughes2009-12-182-14/+14
| | | | | | | | | | | | Why does this idiom persist? It's ugly, and it's the least efficient way to do it. (I found the ones in DecimalFormatSymbols while invesigating why "new SimpleDateFormat()" burns through so many StringBuilders. grep(1) found the rest.) The DocumentBuilderImpl removes an unnecessary level of indirection, since we implement Character.toString in terms of String.valueOf. (I wouldn't have bothered except this was the only use of Character.toString in the core libraries, and I added it myself a few weeks ago.)
* Fix java.util.Formatter formatting of -0.0.Elliott Hughes2009-12-091-36/+17
| | | | | | | | | | | | The active ingredient here is the two changes to stop comparing longValue with doubleValue and formatting the long if the two compare equal. This causes us to lose the sign of 0 (because there's no long -0, but -0.0d == 0). Instead, we explicitly test for boxed Double and Float arguments (because the number of integral types is larger, they get the "else" clause). The other changes are just minor cosmetic changes made as I followed the code. Bug found by jtreg, so no new test.
* CharsetDecoderICU/CharsetEncoderICU should take arrayOffset into account.Elliott Hughes2009-11-032-10/+22
| | | | | | | | | | | | | CharsetDecoderICU and CharsetEncoderICU special-case array-backed ByteBuffers and CharBuffers for performance reasons, but they shouldn't assume that the backing array always has offset 0. An external user hit this while using the jAudioTagger library. Test cases from user submission: http://code.google.com/p/android/issues/detail?id=4237 See also: 2234697
* Fix a few FindBugs warnings in code that isn't upstream.Elliott Hughes2009-10-273-6/+6
| | | | Bugs: 2099642, 2099637
* Fix icu4jni Resources ("Locale") to not expose its internals.Elliott Hughes2009-10-143-6/+100
| | | | | | We shouldn't expose internal arrays without copying. Bug: 2102273
* Bug fixing for NumberFormat and BigDecimal.Jesse Wilson2009-10-122-3/+27
| | | | | | | | | | 1. Fixed the bug that DecimalFormat does not handle multiplier. 2. Fixed the bug that DecimalFormat does not handle precision. This is a copy of the original Eclair change, https://android-git.corp.google.com/g/26297 Bug: 1897917.
* Use icu4jni_error more consistently.Elliott Hughes2009-10-052-110/+79
| | | | | | | | In BidiWrapperInterface.c, replace check_fail with icu4jni_error for better error reporting. In CollationInterface.c, make sure we call icu4jni_error *after* calling the function that may or may not return an error.
* Use jniThrowException instead of FindClass/ThrowNew.Elliott Hughes2009-10-011-40/+22
| | | | | | Always use our best-of-breed code for throwing exceptions. The remaining callers of Throw have good reason, and the only caller of ThrowNew is now JNIHelp.c (jniThrowException) itself.
* am d9f8adbf: am cb12fde6: Make Resources preloadable again.Elliott Hughes2009-09-171-18/+20
|\ | | | | | | | | | | | | Merge commit 'd9f8adbfa912c24fb29d2a7e2ce7421a3f96ef82' * commit 'd9f8adbfa912c24fb29d2a7e2ce7421a3f96ef82': Make Resources$DefaultTimeZones preloadable again.
| * Make Resources$DefaultTimeZones preloadable again.Elliott Hughes2009-09-151-18/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | http://s9/81864 was a premature optimization that stopped the timezone data being loaded in the zygote. So instead of paying the (admittedly large) time and space costs once in the zygote, we now pay them once per application. Revert the problematic parts of that change. Note that this isn't simply a reverse patch: 1. I've changed the comment to make it clear that although this *looks* like idiomatic lazy initialization, it's actually the opposite. A comment to that effect might have prevented this code from being broken. 2. I've left the last two hunks of the original patch stand, because they appear reasonable but unrelated. Bug: 1941311, 1819285.
* | Remove duplicate copies of ICU error translation.Elliott Hughes2009-09-114-97/+26
| | | | | | | | | | For want of an 'extern "C"', we seem to have grown several duplicates of icu4jni_error.
* | Use GetStringRegion/GetStringUTFRegion where appropriate.Elliott Hughes2009-09-103-97/+52
| | | | | | | | | | | | | | | | | | | | | | Note that the changes to DecimalFormatInterface.cpp and RBNFInterface.cpp are just minor tidy-ups, fixing an issue where the early error exit wouldn't call ReleaseStringChars to undo the earlier call to GetStringChars. Also remove a dead function and fix a comment in ExpatParser.cpp. Tested on sapphire-eng. Bug: 1639287
* | Merge change 24402Android (Google) Code Review2009-09-091-27/+17
|\ \ | |/ |/| | | | | * changes: Use GetByteArrayRegion instead of GetByteArrayElements.
| * Use GetByteArrayRegion instead of GetByteArrayElements.Elliott Hughes2009-09-091-27/+17
| | | | | | | | | | | | | | | | I've also cleaned up the two calls to free(3) in ubidi_close; the former had an unnecessary NULL check, and the latter was indented as if it belonged to the if (but didn't). Tested on sapphire-eng.
* | InputStreamReader forgets to convert incomplete multibyte characters at the ↵Urs Grob2009-09-041-11/+4
|/ | | | | | buffer boundary BUG=2033986
* Move LOG_TAG above the includes.Andy McFadden2009-06-041-1/+1
| | | | This avoids a "LOG_TAG redefined" warning from log.h.
* am e406b316: Bug 1844104: Fix buffer overwrite bugs in CharsetEncoderICU and ↵Mihai Preda2009-06-012-12/+47
|\ | | | | | | | | | | | | | | | | CharsetDecoderICU. Merge commit 'e406b316295f07d40679ce2372051c3b2bce5de4' * commit 'e406b316295f07d40679ce2372051c3b2bce5de4': Bug 1844104: Fix buffer overwrite bugs in CharsetEncoderICU and CharsetDecoderICU.
| * Bug 1844104: Fix buffer overwrite bugs in CharsetEncoderICU and ↵Mihai Preda2009-05-262-12/+47
| | | | | | | | | | | | CharsetDecoderICU. And add unit test.
* | Return an Object[][] rather than an Object[].Andy McFadden2009-05-131-1/+1
| |
* | am 08eacd4: am 64b928e: AI 148694: Manually copied from cupcake_dcm CL 1Andy Stadler2009-05-111-0/+4
|\ \ | |/ | | | | | | | | | | Merge commit '08eacd482ca9988b021a9e9e6c8bec573d6e4057' * commit '08eacd482ca9988b021a9e9e6c8bec573d6e4057': AI 148694: Manually copied from cupcake_dcm CL 148669-p9. When resetting the
| * AI 148694: Manually copied from cupcake_dcm CL 148669-p9. When resetting theAndy Stadler2009-05-111-0/+4
| | | | | | | | | | | | | | | | | | mode of the encoder, clear the leftover input & output buffers. This claims to fix buffer overwriting we're seeing during account sync and message download. BUG=1822859 Automated import of CL 148694
* | add comments for the UTF-8 string creation patchHao Feng2009-03-201-1/+2
|/
* auto import from //branches/cupcake/...@137873The Android Open Source Project2009-03-111-34/+0
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-0341-0/+12801
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-0341-12787/+0
|
* auto import from //depot/cupcake/@132589The Android Open Source Project2009-03-031-97/+83
|
* auto import from //depot/cupcake/@137055The Android Open Source Project2009-03-021-83/+97
|
* auto import from //branches/cupcake/...@131421The Android Open Source Project2009-02-132-90/+121
|
* auto import from //branches/cupcake/...@130745The Android Open Source Project2009-02-102-8/+34
|
* auto import from //branches/cupcake/...@126645The Android Open Source Project2009-01-151-3/+3
|
* auto import from //branches/cupcake/...@125939The Android Open Source Project2009-01-091-89/+135
|
* Code drop from //branches/cupcake/...@124589The Android Open Source Project2008-12-1717-77/+137
|
* Initial ContributionThe Android Open Source Project2008-10-2141-0/+12624