2 This patch fixes a float point editing bug introduced in 2.2.7 (I think)
3 causing the rate fields to be formated incorrectly (actually trunctated).
6 Apply it to version 2.2.7 with:
9 patch -p0 <2.2.7-fpformat.patch
10 ./configure <your-options>
16 Index: src/lib/bsnprintf.c
17 ===================================================================
18 --- src/lib/bsnprintf.c (revision 6183)
19 +++ src/lib/bsnprintf.c (working copy)
22 Bacula® - The Network Backup Solution
24 - Copyright (C) 2005-2007 Free Software Foundation Europe e.V.
25 + Copyright (C) 2005-2008 Free Software Foundation Europe e.V.
27 The main author of Bacula is Kern Sibbald, with contributions from
28 many others, a complete list can be found in the file AUTHORS.
33 -static long round(LDOUBLE value)
34 +static int64_t round(LDOUBLE value)
39 - intpart = (long)value;
40 + intpart = (int64_t)value;
41 value = value - intpart;
59 + const char *cvt_str;
62 * AIX manpage says the default is 0, but Solaris says the default
67 - intpart = (long)ufvalue;
68 + intpart = (int64_t)ufvalue;
71 * Sorry, we only support 9 digits past the decimal because of our
76 - printf("fmtfp: %g %d.%d min=%d max=%d\n",
77 + printf("fmtfp: %g %lld.%lld min=%d max=%d\n",
78 (double)fvalue, intpart, fracpart, min, max);
81 /* Convert integer part */
82 + cvt_str = caps ? "0123456789ABCDEF" : "0123456789abcdef";
84 - iconvert[iplace++] =
85 - (caps ? "0123456789ABCDEF" : "0123456789abcdef")[intpart % 10];
86 + iconvert[iplace++] = cvt_str[(int)(intpart % 10)];
87 intpart = (intpart / 10);
88 - } while (intpart && (iplace < (int)sizeof(iplace)));
89 - if (iplace == (int)sizeof(iplace)) {
90 + } while (intpart && (iplace < (int)sizeof(iconvert)));
92 + if (iplace == (int)sizeof(fconvert)) {
97 /* Convert fractional part */
98 + cvt_str = caps ? "0123456789ABCDEF" : "0123456789abcdef";
100 - fconvert[fplace++] =
101 - (caps ? "0123456789ABCDEF" : "0123456789abcdef")[fracpart % 10];
102 + fconvert[fplace++] = cvt_str[fracpart % 10];
103 fracpart = (fracpart / 10);
104 - } while (fracpart && (fplace < (int)sizeof(fplace)));
105 - if (fplace == (int)sizeof(fplace)) {
106 + } while (fracpart && (fplace < (int)sizeof(fconvert)));
108 + if (fplace == (int)sizeof(fconvert)) {
111 fconvert[fplace] = 0;
115 double fp_nums[] = { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996,
116 - 0.9996, 1.996, 4.136, 6442452944.1234, 0
117 + 0.9996, 1.996, 4.136, 6442452944.1234, 0, 23365.5