summaryrefslogtreecommitdiff
path: root/src/cr-tknzr.c
diff options
context:
space:
mode:
authorDom Lachowicz <doml@src.gnome.org>2006-03-02 01:13:01 +0000
committerDom Lachowicz <doml@src.gnome.org>2006-03-02 01:13:01 +0000
commitc7d1ea6efefbf3293bff617bddc4699219b543a0 (patch)
treecf619c2bbf0c47bc85be8d8830bf04e194280568 /src/cr-tknzr.c
parent9dc32d6f472e367208527366fb7830d69aa3fb15 (diff)
downloadlibcroco-c7d1ea6efefbf3293bff617bddc4699219b543a0.tar.gz
Parse fractional parts of numbers properly (bug 333057)
Diffstat (limited to 'src/cr-tknzr.c')
-rw-r--r--src/cr-tknzr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cr-tknzr.c b/src/cr-tknzr.c
index 7f2d2c6..34f0b4c 100644
--- a/src/cr-tknzr.c
+++ b/src/cr-tknzr.c
@@ -1489,7 +1489,8 @@ cr_tknzr_parse_num (CRTknzr * a_this,
guint32 cur_char = 0,
int_part = 0,
dec_part = 0,
- next_char = 0;
+ next_char = 0,
+ decimal_places = 0;
CRInputPos init_pos;
CRParsingLocation location = {0} ;
@@ -1534,6 +1535,7 @@ cr_tknzr_parse_num (CRTknzr * a_this,
if (parsing_dec == FALSE) {
int_part = int_part * 10 + (cur_char - '0');
} else {
+ decimal_places++;
dec_part = dec_part * 10 + (cur_char - '0');
}
} else {
@@ -1552,7 +1554,7 @@ cr_tknzr_parse_num (CRTknzr * a_this,
gdouble val = 0.0;
val = int_part;
- val += cr_utils_n_to_0_dot_n (dec_part);
+ val += cr_utils_n_to_0_dot_n (dec_part, decimal_places);
if (*a_num == NULL) {
*a_num = cr_num_new_with_val (val, val_type);