From: William M. Brack Date: Wed, 8 Sep 2004 01:02:35 +0000 (+0000) Subject: further refinement to UTF8 pattern separator (bug 151975) X-Git-Tag: v1.1.28~384 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=76e92b0a34fdbac418fb20b724d51eae028e1215;p=platform%2Fupstream%2Flibxslt.git further refinement to UTF8 pattern separator (bug 151975) * libxslt/numbers.c: further refinement to UTF8 pattern separator (bug 151975) --- diff --git a/ChangeLog b/ChangeLog index 5cf705a..66dc945 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Sep 7 18:04:55 PDT 2004 William Brack + + * libxslt/numbers.c: further refinement to UTF8 pattern + separator (bug 151975) + Tue Sep 7 00:14:12 PDT 2004 William Brack * libxslt/numbers.c: fixed problem with UTF8 pattern diff --git a/libxslt/numbers.c b/libxslt/numbers.c index 1660793..27e74df 100644 --- a/libxslt/numbers.c +++ b/libxslt/numbers.c @@ -1158,7 +1158,7 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, * "number" part, should be in suffix */ if (delayed_multiplier != 0) { - the_format--; + the_format -= len; delayed_multiplier = 0; } @@ -1176,21 +1176,18 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, * If the number is -ve, we must substitute the -ve prefix / suffix */ if (number < 0) { + /* + * Note that j is the number of UTF8 chars before the separator, + * not the number of bytes! (bug 151975) + */ j = xmlUTF8Strloc(format, self->patternSeparator); if (j < 0) { /* No -ve pattern present, so use default signing */ default_sign = 1; } else { - int lenPS; - lenPS = xmlUTF8Size(self->patternSeparator); - if (lenPS <= 0) { - found_error = 1; - goto OUTPUT_NUMBER; - } - - /* Skip over pattern separator */ - the_format = format + j + lenPS; + /* Skip over pattern separator (accounting for UTF8) */ + the_format = xmlUTF8Strpos(format, j + 1); /* * Flag changes interpretation of percent/permille * in -ve pattern @@ -1223,11 +1220,15 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, delayed_multiplier = 0; else break; /* while */ - the_format++; + if ((len = xsltUTF8Size(the_format)) < 1) { + found_error = 1; + goto OUTPUT_NUMBER; + } + the_format += len; } if (delayed_multiplier != 0) { format_info.is_multiplier_set = FALSE; - the_format--; + the_format -= len; } /* Finally do the -ve suffix */ @@ -1236,8 +1237,8 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self, nsuffix_length = xsltFormatNumberPreSuffix(self, &the_format, &format_info); if (nsuffix_length < 0) { - found_error = 1; - goto OUTPUT_NUMBER; + found_error = 1; + goto OUTPUT_NUMBER; } } else