diff options
author | William M. Brack <wbrack@src.gnome.org> | 2004-09-08 01:02:35 +0000 |
---|---|---|
committer | William M. Brack <wbrack@src.gnome.org> | 2004-09-08 01:02:35 +0000 |
commit | 76e92b0a34fdbac418fb20b724d51eae028e1215 (patch) | |
tree | fc9af979b3a0d5d3fdeee50a311188dd5a5480c0 | |
parent | edf62473b4edb150f566098aff5a70c5416f9a4e (diff) | |
download | libxslt-76e92b0a34fdbac418fb20b724d51eae028e1215.tar.gz libxslt-76e92b0a34fdbac418fb20b724d51eae028e1215.tar.bz2 libxslt-76e92b0a34fdbac418fb20b724d51eae028e1215.zip |
further refinement to UTF8 pattern separator (bug 151975)
* libxslt/numbers.c: further refinement to UTF8 pattern
separator (bug 151975)
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | libxslt/numbers.c | 29 |
2 files changed, 20 insertions, 14 deletions
@@ -1,3 +1,8 @@ +Tue Sep 7 18:04:55 PDT 2004 William Brack <wbrack@mmm.com.hk> + + * libxslt/numbers.c: further refinement to UTF8 pattern + separator (bug 151975) + Tue Sep 7 00:14:12 PDT 2004 William Brack <wbrack@mmm.com.hk> * libxslt/numbers.c: fixed problem with UTF8 pattern diff --git a/libxslt/numbers.c b/libxslt/numbers.c index 16607931..27e74df5 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 |