summaryrefslogtreecommitdiff
path: root/finance/gnucash/patches/patch-ab
blob: fd7fd72519555a55cc50f831f31f4a6ec25f20b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
$NetBSD: patch-ab,v 1.3 2010/11/07 23:23:56 wiz Exp $

Some help for DragonFly.

--- src/app-utils/gnc-ui-util.c.orig	2007-06-02 17:56:55.000000000 +0000
+++ src/app-utils/gnc-ui-util.c
@@ -103,6 +103,14 @@ gnc_configure_account_separator (void)
     free(string);
 }
 
+#if defined(__DragonFly__)
+#define LC_CAST	(char **)
+#define LC_CAST2 (char *)
+#else
+#define LC_CAST
+#define LC_CAST2
+#endif
+
 
 static void
 gnc_configure_reverse_balance (void)
@@ -780,16 +788,16 @@ gnc_localeconv (void)
 
   lc = *localeconv();
 
-  gnc_lconv_set_utf8(&lc.decimal_point, ".");
-  gnc_lconv_set_utf8(&lc.thousands_sep, ",");
-  gnc_lconv_set_utf8(&lc.grouping, "\003");
-  gnc_lconv_set_utf8(&lc.int_curr_symbol, "USD ");
-  gnc_lconv_set_utf8(&lc.currency_symbol, "$");
-  gnc_lconv_set_utf8(&lc.mon_decimal_point, ".");
-  gnc_lconv_set_utf8(&lc.mon_thousands_sep, ",");
-  gnc_lconv_set_utf8(&lc.mon_grouping, "\003");
-  gnc_lconv_set_utf8(&lc.negative_sign, "-");
-  gnc_lconv_set_utf8(&lc.positive_sign, "");
+  gnc_lconv_set_utf8(LC_CAST &lc.decimal_point, ".");
+  gnc_lconv_set_utf8(LC_CAST &lc.thousands_sep, ",");
+  gnc_lconv_set_utf8(LC_CAST &lc.grouping, "\003");
+  gnc_lconv_set_utf8(LC_CAST &lc.int_curr_symbol, "USD ");
+  gnc_lconv_set_utf8(LC_CAST &lc.currency_symbol, "$");
+  gnc_lconv_set_utf8(LC_CAST &lc.mon_decimal_point, ".");
+  gnc_lconv_set_utf8(LC_CAST &lc.mon_thousands_sep, ",");
+  gnc_lconv_set_utf8(LC_CAST &lc.mon_grouping, "\003");
+  gnc_lconv_set_utf8(LC_CAST &lc.negative_sign, "-");
+  gnc_lconv_set_utf8(LC_CAST &lc.positive_sign, "");
 
   gnc_lconv_set_char(&lc.frac_digits, 2);
   gnc_lconv_set_char(&lc.int_frac_digits, 2);
@@ -1293,13 +1301,13 @@ PrintAmountInternal(char *buf, gnc_numer
 
     if (info->monetary)
     {
-      separator = lc->mon_thousands_sep;
-      group = lc->mon_grouping;
+      separator = LC_CAST2 lc->mon_thousands_sep;
+      group = LC_CAST2 lc->mon_grouping;
     }
     else
     {
-      separator = lc->thousands_sep;
-      group = lc->grouping;
+      separator = LC_CAST2 lc->thousands_sep;
+      group = LC_CAST2 lc->grouping;
     }
 
     buf_ptr = buf;
@@ -1367,7 +1375,7 @@ PrintAmountInternal(char *buf, gnc_numer
   }
   else
   {
-    char *decimal_point;
+    const char *decimal_point;
     guint8 num_decimal_places = 0;
     char *temp_ptr = temp_buf;
 
@@ -1687,7 +1695,7 @@ number_to_words(gdouble val, gint64 deno
   if (val < 0) val = -val;
   if (denom < 0) denom = -denom;
 
-  int_part = trunc(val);
+  int_part = floor(val);
   frac_part = round((val - int_part) * denom);
 
   int_string = integer_to_words(int_part);
@@ -1803,13 +1811,13 @@ xaccParseAmount (const char * in_str, gb
   {
     group_separator = g_utf8_get_char(lc->mon_thousands_sep);
     decimal_point = g_utf8_get_char(lc->mon_decimal_point);
-    group = lc->mon_grouping;
+    group = LC_CAST2 lc->mon_grouping;
   }
   else
   {
     group_separator = g_utf8_get_char(lc->thousands_sep);
     decimal_point = g_utf8_get_char(lc->decimal_point);
-    group = lc->grouping;
+    group = LC_CAST2 lc->grouping;
   }
 
   return xaccParseAmountExtended(in_str, monetary, negative_sign, decimal_point,