From 736ad9286abed7ef92097e61a0a3245790537037 Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Tue, 11 Jun 2002 22:49:05 +0000 Subject: [PATCH] ICU-1939 fix UTF-32BE/LE offset handling X-SVN-Rev: 8847 --- icu4c/source/common/ucnv_utf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/icu4c/source/common/ucnv_utf.c b/icu4c/source/common/ucnv_utf.c index 6f9cee81ff7..eaf1a408de8 100644 --- a/icu4c/source/common/ucnv_utf.c +++ b/icu4c/source/common/ucnv_utf.c @@ -402,9 +402,9 @@ morebytes: else { /* write out the surrogates */ - *(myOffsets++) = offsetNum; ch -= HALF_BASE; *(myTarget++) = (UChar) ((ch >> HALF_SHIFT) + SURROGATE_HIGH_START); + *(myOffsets++) = offsetNum; ch = (ch & HALF_MASK) + SURROGATE_LOW_START; if (myTarget < targetLimit) { @@ -690,6 +690,7 @@ lowsurogate: args->target = (char *) myTarget; args->source = mySource; + args->offsets = myOffsets; } U_CFUNC UChar32 T_UConverter_getNextUChar_UTF8(UConverterToUnicodeArgs *args, @@ -1624,6 +1625,7 @@ donefornow: args->target = myTarget; args->source = (const char *) mySource; + args->offsets = myOffsets; } static void @@ -1774,6 +1776,7 @@ lowsurogate: args->target = (char *) myTarget; args->source = mySource; + args->offsets = myOffsets; } static UChar32 @@ -2061,6 +2064,7 @@ morebytes: /* write out the surrogates */ ch -= HALF_BASE; *(myTarget++) = (UChar) ((ch >> HALF_SHIFT) + SURROGATE_HIGH_START); + *(myOffsets++) = offsetNum; ch = (ch & HALF_MASK) + SURROGATE_LOW_START; if (myTarget < targetLimit) { @@ -2105,6 +2109,7 @@ donefornow: args->target = myTarget; args->source = (const char *) mySource; + args->offsets = myOffsets; } static void @@ -2255,6 +2260,7 @@ lowsurogate: args->target = (char *) myTarget; args->source = mySource; + args->offsets = myOffsets; } static UChar32