Hello community,
here is the log from the commit of package gcalctool
checked in at Mon Apr 21 18:41:32 CEST 2008.
--------
--- GNOME/gcalctool/gcalctool.changes 2008-04-18 15:13:20.000000000 +0200
+++ /mounts/work_src_done/STABLE/gcalctool/gcalctool.changes 2008-04-21 14:17:22.000000000 +0200
@@ -1,0 +2,5 @@
+Mon Apr 21 14:17:07 CEST 2008 - sbrabec@suse.cz
+
+- Fixed localized radix (bgo#527669).
+
+-------------------------------------------------------------------
New:
----
gcalctool-localized-radix.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ gcalctool.spec ++++++
--- /var/tmp/diff_new_pack.Co9733/_old 2008-04-21 18:41:22.000000000 +0200
+++ /var/tmp/diff_new_pack.Co9733/_new 2008-04-21 18:41:22.000000000 +0200
@@ -16,7 +16,7 @@
License: GPL v2 or later
Group: Productivity/Scientific/Math
Version: 5.22.1
-Release: 5
+Release: 6
Summary: A GNOME Calculator Application
Source: ftp://ftp.gnome.org/pub/gnome/sources/gcalctool/5.22/%{name}-%{version}.tar.bz2
# PATCH-FIX-OPENSUSE gcalctool-59753_59377_59378.patch
@@ -27,6 +27,8 @@
Patch4: gcalctool-c-style.patch
# PATCH-FIX-UPSTREAM Fix grouping and brokenness in some locales bgo527669
Patch5: gcalctool-grouping.patch
+# PATCH-FIX-UPSTREAM Fix localized radix bgo527669
+Patch6: gcalctool-localized-radix.patch
Url: http://www.gnome.org
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: gnome-icon-theme
@@ -72,6 +74,7 @@
%patch3 -p1
%patch4
%patch5
+%patch6
%build
autoreconf -f -i
@@ -118,6 +121,8 @@
%files lang -f %{name}.lang
%changelog
+* Mon Apr 21 2008 sbrabec@suse.cz
+- Fixed localized radix (bgo#527669).
* Fri Apr 18 2008 sbrabec@suse.cz
- Fix grouping and brokenness in some locales (bgo#527669).
* Thu Apr 10 2008 sbrabec@suse.cz
++++++ gcalctool-localized-radix.patch ++++++
2008-04-19 Robert Ancell
* gcalctool/display.c: Use correct radix when converting numbers to strings (Bug #527669).
* gcalctool/functions.c: Convert localized UTF-8 radix and separator characters into
english equivalents since the parser is 8-bit and not localized (Bug #527669).
--- gcalctool/display.c
+++ gcalctool/display.c
@@ -58,12 +58,12 @@
STRNCPY(dest, src, dest_length - 1);
return;
}
-
+
/* Remove separators if not supported */
if(!v->show_tsep) {
for (c = src; *c; c++) {
- if (strncmp(c, v->tsep, strlen(v->radix)) == 0) {
- c += strlen(v->radix) - 1;
+ if (strncmp(c, v->tsep, strlen(v->tsep)) == 0) {
+ c += strlen(v->tsep) - 1;
}
else {
g_string_append_c(output, *c);
@@ -180,7 +180,7 @@
int MP1base[MP_SIZE], MP1[MP_SIZE], MP2[MP_SIZE], MPval[MP_SIZE];
int ndig; /* Total number of digits to generate. */
int ddig; /* Number of digits to left of decimal sep. */
- int dval, n;
+ int dval, n, i;
optr = str;
mpabs(MPnumber, MPval);
@@ -215,7 +215,8 @@
while (ndig-- > 0) {
if (ddig-- == 0) {
- *optr++ = '.';
+ for (i = 0; i < strlen(v->radix); i++)
+ *optr++ = v->radix[i];
}
mpmul(MPval, MP1base, MPval);
mpcmi(MPval, &dval);
@@ -234,15 +235,16 @@
}
v->pointed = 0;
- if (!v->show_zeroes && v->accuracy != 0) {
- optr = str + strlen(str) - 1;
- while (*optr == '0') {
- optr--;
+ /* Strip off trailing zeroes */
+ if (!v->show_zeroes) {
+ for (i = strlen(str) - 1; i > 1 && str[i] == '0'; i--) {
+ str[i] = '\0';
+ }
+
+ /* If no fractional part discard radix */
+ if (strlen(str) >= strlen(v->radix) && strcmp(str + strlen(str) - strlen(v->radix), v->radix) == 0) {
+ str[strlen(str) - strlen(v->radix)] = '\0';
}
- if (optr < str || *optr != '.') {
- optr++;
- }
- *optr = '\0';
}
return(str);
--- gcalctool/functions.c
+++ gcalctool/functions.c
@@ -557,9 +557,26 @@
/* Solve the equation */
} else {
int MPval[MP_SIZE];
- char *message = NULL;
+ char *c, *message = NULL;
+ GString *clean;
+ int result;
- switch (ce_parse(e->expression, MPval)) {
+ /* Remove thousands separators and use english radix */
+ clean = g_string_sized_new(strlen(e->expression));
+ for (c = e->expression; *c; c++) {
+ if (strncmp(c, v->tsep, strlen(v->tsep)) == 0) {
+ c += strlen(v->tsep) - 1;
+ } else if (strncmp(c, v->radix, strlen(v->radix)) == 0) {
+ g_string_append_c(clean, '.');
+ c += strlen(v->radix) - 1;
+ } else {
+ g_string_append_c(clean, *c);
+ }
+ }
+ result = ce_parse(clean->str, MPval);
+ g_string_free(clean, TRUE);
+
+ switch (result) {
case 0:
mpstr(MPval, e->ans);
exp_replace("Ans");
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org