diff options
author | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-07-06 09:24:58 +0000 |
---|---|---|
committer | Alexander Gottwald <alexander.gottwald@s1999.tu-chemnitz.de> | 2004-07-06 09:24:58 +0000 |
commit | a72c79567a4f550dfafb532b03be79339c5a4a30 (patch) | |
tree | 21fb218cd7200d58d3c339be4e470ef9292c805e | |
parent | bbcc481006d4b5f4e8d1276db2220cf96a355985 (diff) |
Bugzilla #665: bugs in xcalc -rpn mode decimal_point is a const char* notxprint_packagertest_20041217_basexprint_packagertest_20041125_basesco_port_update-baserel-0-6-1lg3d-rel-0-7-0lg3d-rel-0-6-2lg3d-baseXORG-6_8_99_903XORG-6_8_99_902XORG-6_8_99_901XORG-6_8_99_900XORG-6_8_99_9XORG-6_8_99_8XORG-6_8_99_7XORG-6_8_99_6XORG-6_8_99_5XORG-6_8_99_4XORG-6_8_99_3XORG-6_8_99_2XORG-6_8_99_16XORG-6_8_99_15XORG-6_8_99_14XORG-6_8_99_13XORG-6_8_99_12XORG-6_8_99_11XORG-6_8_99_10XORG-6_8_99_1XORG-6_8_2XORG-6_8_1_904XORG-6_8_1_903XORG-6_8_1_902XORG-6_8_1_901XORG-6_8_1XORG-6_8_0XORG-6_7_99_904XORG-6_7_99_903XORG-6_7_99_902XORG-6_7_99_901XORG-6_7_99_2XORG-6_7_99_1xprint_packagertest_20041217xprint_packagertest_20041125sco_port_updatelg3d-masterlg3d-eventlg3d-dev-0-7-1lg3d-dev-0-7-0lg3d-dev-0-6-latestlg3d-dev-0-6-2lg3d-dev-0-6-1-latestlg3d-dev-0-6-1-currentlg3d-dev-0-6-1-1lg3d-dev-0-6-1lg3dXORG-6_8-branchCOMPOSITEWRAP
char. the patch uses strcmp instead of plain char == char operator and
allows decimal_point to be of any length. localeconv() is only called
if X_LOCALE is _not_ defined
-rw-r--r-- | math.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1,7 +1,7 @@ /* $XConsortium: math.c,v 1.17 91/07/25 17:51:34 rws Exp $ * $MIT: contrib/programs/xcalc/math.c,v 3.2 1999/12/14 18:53:00 gjcoram Exp$ * $XFree86: xc/programs/xcalc/math.c,v 1.5tsi Exp $ - * $XdotOrg: $ + * $XdotOrg: xc/programs/xcalc/math.c,v 1.3 2004/05/23 20:03:49 alanc Exp $ * * math.c - mathematics functions for a hand calculator under X * @@ -400,10 +400,14 @@ bkspf(void) if (clrdisp) return; if ((int) strlen(dispstr) > 0) { - if (dispstr[strlen(dispstr)-1] == '.') +#ifndef X_LOCALE + const char *dp = localeconv()->decimal_point; + size_t dp_len = strlen(dp); + size_t ds_len = strlen(dispstr); + if (ds_len >= dp_len && strcmp(dispstr + ds_len - dp_len, dp) == 0) Dpoint=0; -#ifdef X_LOCALE - if (dispstr[strlen(dispstr)-1] == localeconv()->decimal_point) +#else + if (dispstr[strlen(dispstr)-1] == '.') Dpoint=0; #endif dispstr[strlen(dispstr)-1] = 0; |