[svn:parrot] r48172 - in branches/gsoc_nfg/src/string: charset encoding
darbelo at svn.parrot.org
darbelo at svn.parrot.org
Sun Jul 25 23:42:53 UTC 2010
Author: darbelo
Date: Sun Jul 25 23:42:52 2010
New Revision: 48172
URL: https://trac.parrot.org/parrot/changeset/48172
Log:
Replace UNORM_DEFAULT with UNORM_NFC as ICU composition target.
Modified:
branches/gsoc_nfg/src/string/charset/unicode.c
branches/gsoc_nfg/src/string/encoding/nfg.c
Modified: branches/gsoc_nfg/src/string/charset/unicode.c
==============================================================================
--- branches/gsoc_nfg/src/string/charset/unicode.c Sat Jul 24 16:24:39 2010 (r48171)
+++ branches/gsoc_nfg/src/string/charset/unicode.c Sun Jul 25 23:42:52 2010 (r48172)
@@ -269,23 +269,18 @@
STRING *dest;
int src_len, dest_len;
UErrorCode err;
- /*
- U_STABLE int32_t U_EXPORT2
- unorm_normalize(const UChar *source, int32_t sourceLength,
- UNormalizationMode mode, int32_t options,
- UChar *result, int32_t resultLength,
- UErrorCode *status);
- */
+
+ /* Early return. NFG is as composed as it gets. */
+ if (src->encoding == Parrot_nfg_encoding_ptr)
+ return Parrot_str_clone(interp, src);
+
dest_len = src_len = src->strlen;
dest = Parrot_str_new_init(interp, NULL, src_len * sizeof (UChar),
src->encoding, src->charset, 0);
err = U_ZERO_ERROR;
dest_len = unorm_normalize((UChar *)src->strstart, src_len,
- UNORM_DEFAULT, /* default is NFC */
- 0, /* options 0 default - no specific icu
- * version */
- (UChar *)dest->strstart, dest_len, &err);
+ UNORM_NFC, 0, (UChar *)dest->strstart, dest_len, &err);
dest->bufused = dest_len * sizeof (UChar);
@@ -293,10 +288,7 @@
err = U_ZERO_ERROR;
Parrot_gc_reallocate_string_storage(interp, dest, dest->bufused);
dest_len = unorm_normalize((UChar *)src->strstart, src_len,
- UNORM_DEFAULT, /* default is NFC */
- 0, /* options 0 default - no specific
- * icu version */
- (UChar *)dest->strstart, dest_len, &err);
+ UNORM_NFC, 0, (UChar *)dest->strstart, dest_len, &err);
PARROT_ASSERT(U_SUCCESS(err));
dest->bufused = dest_len * sizeof (UChar);
}
Modified: branches/gsoc_nfg/src/string/encoding/nfg.c
==============================================================================
--- branches/gsoc_nfg/src/string/encoding/nfg.c Sat Jul 24 16:24:39 2010 (r48171)
+++ branches/gsoc_nfg/src/string/encoding/nfg.c Sun Jul 25 23:42:52 2010 (r48172)
@@ -582,7 +582,7 @@
src[2] = 0;
/* Delegate composition to ICU. */
- dst_len = unorm_normalize(src, -1 , UNORM_DEFAULT, 0,
+ dst_len = unorm_normalize(src, -1 , UNORM_NFC, 0,
dst, dst_len, &err);
if (U_SUCCESS(err)) {
More information about the parrot-commits
mailing list