File: 0002-Use-stdint-types-to-fix-FTBFS-with-ocaml-4.04.patch

package info (click to toggle)
pagodacf 0.10-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,352 kB
  • sloc: ml: 8,458; ansic: 3,339; makefile: 141
file content (270 lines) | stat: -rw-r--r-- 7,625 bytes parent folder | download | duplicates (4)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
From: Dimitri John Ledkov <xnox@ubuntu.com>
Date: Wed, 19 Jul 2017 10:47:28 +0200
Subject: Use stdint types to fix FTBFS with ocaml 4.04

---
 cf_common_p.h |  1 +
 cf_tai64_p.c  | 18 +++++++++---------
 cf_tai64_p.h  |  2 +-
 cf_tai64n_p.c | 42 +++++++++++++++++++++---------------------
 cf_tai64n_p.h |  2 +-
 5 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/cf_common_p.h b/cf_common_p.h
index 1b486bf..4fb44b8 100644
--- a/cf_common_p.h
+++ b/cf_common_p.h
@@ -33,6 +33,7 @@
 #ifndef _CF_COMMON_P_H
 #define _CF_COMMON_P_H
 
+#include <stdint.h>
 #include <caml/alloc.h>
 #include <caml/callback.h>
 #include <caml/custom.h>
diff --git a/cf_tai64_p.c b/cf_tai64_p.c
index ac11358..07b48d5 100644
--- a/cf_tai64_p.c
+++ b/cf_tai64_p.c
@@ -200,11 +200,11 @@ CAMLprim value cf_tai64_compare(value v1, value v2)
   ---*/
 extern void cf_tai64_update(Cf_tai64_t* tai64Ptr)
 {
-    uint64 epoch;
+    uint64_t epoch;
     
     epoch = CF_TAI64_EPOCH;
     epoch += cf_tai64_current_offset;
-    tai64Ptr->s = epoch + ((uint64) time(0));
+    tai64Ptr->s = epoch + ((uint64_t) time(0));
 }
 
 /*---
@@ -290,7 +290,7 @@ CAMLprim value cf_tai64_of_unix_time(value v)
     if (x < cf_tai64_unix_limit[0] || x > cf_tai64_unix_limit[1])
         cf_tai64_range_error();
     
-    tai64.s = CF_TAI64_EPOCH + ((int64) x);
+    tai64.s = CF_TAI64_EPOCH + ((int64_t) x);
     result = cf_tai64_alloc(&tai64);
     
     CAMLreturn(result);
@@ -305,7 +305,7 @@ CAMLprim value cf_tai64_to_unix_time(value v)
     CAMLlocal1(result);
 
     double x;
-    uint64 epoch;
+    uint64_t epoch;
     
     epoch = CF_TAI64_EPOCH;
     epoch += cf_tai64_current_offset;
@@ -326,7 +326,7 @@ CAMLprim value cf_tai64_of_label(value v)
     
     Cf_tai64_t tai64;
     int i;
-    uint64 x;
+    uint64_t x;
     
     if (string_length(v) != 8) cf_tai64_label_error();
     for (i = 0, x = 0; i < 8; ++i) x = (x << 8) | Byte_u(v, i);
@@ -344,7 +344,7 @@ CAMLprim value cf_tai64_to_label(value v)
     CAMLparam1(v);
     CAMLlocal1(result);
     
-    uint64 x;
+    uint64_t x;
     int i;
     
     result = alloc_string(8);
@@ -390,7 +390,7 @@ CAMLprim value cf_tai64_add_int32(value tai64Val, value dt32Val)
 }
 
 /*---
-  Addition of int64
+  Addition of int64_t
   ---*/
 CAMLprim value cf_tai64_add_int64(value tai64Val, value dt64Val)
 {
@@ -398,7 +398,7 @@ CAMLprim value cf_tai64_add_int64(value tai64Val, value dt64Val)
     CAMLlocal1(result);
 
     Cf_tai64_t x;
-    int64 dt64;
+    int64_t dt64;
     
     dt64 = Int64_val(dt64Val);
     if (dt64 >= (CF_TAI64_EPOCH << 1)) cf_tai64_range_error();
@@ -417,7 +417,7 @@ CAMLprim value cf_tai64_sub(value v1, value v2)
 {
     CAMLparam2(v1, v2);
     
-    int64 dt;
+    int64_t dt;
     dt = Cf_tai64_val(v1)->s - Cf_tai64_val(v2)->s;
     
     CAMLreturn(copy_int64(dt));
diff --git a/cf_tai64_p.h b/cf_tai64_p.h
index b974688..e6c6cfe 100644
--- a/cf_tai64_p.h
+++ b/cf_tai64_p.h
@@ -43,7 +43,7 @@
 #define CF_TAI64_EPOCH		0x4000000000000000ULL
 #define CF_TAI64_MJD_EPOCH	0x3fffffff2efbbf8aULL
 
-struct cf_tai64_s { uint64 s; };
+struct cf_tai64_s { uint64_t s; };
 typedef struct cf_tai64_s Cf_tai64_t;
 
 #define Cf_tai64_val(v)  ((Cf_tai64_t*) Data_custom_val(v))
diff --git a/cf_tai64n_p.c b/cf_tai64n_p.c
index 91775bd..9ebe59f 100644
--- a/cf_tai64n_p.c
+++ b/cf_tai64n_p.c
@@ -88,7 +88,7 @@ static long cf_tai64n_op_hash(value v)
     
      vPtr = Cf_tai64n_val(v);
     
-    CAMLreturn((uint32) vPtr->s ^ vPtr->ns);
+    CAMLreturn((uint32_t) vPtr->s ^ vPtr->ns);
 }
 
 static void cf_tai64n_op_serialize
@@ -98,7 +98,7 @@ static void cf_tai64n_op_serialize
     
     char buffer[12];
     unsigned long long x;
-    uint32 y;
+    uint32_t y;
     int i;
     
     x = Cf_tai64n_val(v)->s;
@@ -126,7 +126,7 @@ static unsigned long cf_tai64n_op_deserialize(void* data)
 {
     char buffer[12];
     unsigned long long x;
-    uint32 y;
+    uint32_t y;
     int i;
     
     deserialize_block_1(buffer, 8);
@@ -182,7 +182,7 @@ extern value cf_tai64n_alloc(const Cf_tai64n_t* tai64nPtr)
   ---*/
 extern void cf_tai64n_update(Cf_tai64n_t* tai64nPtr)
 {
-    uint64 epoch;
+    uint64_t epoch;
     struct timeval tv;
     struct timezone tz;
     
@@ -191,7 +191,7 @@ extern void cf_tai64n_update(Cf_tai64n_t* tai64nPtr)
     
     epoch = CF_TAI64_EPOCH;
     epoch += cf_tai64_current_offset;
-    tai64nPtr->s = epoch + ((uint64) tv.tv_sec);
+    tai64nPtr->s = epoch + ((uint64_t) tv.tv_sec);
     tai64nPtr->ns = tv.tv_usec * 1000;
 }
 
@@ -238,11 +238,11 @@ CAMLprim value cf_tai64n_compose(value tai64Val, value nsVal)
     CAMLlocal1(resultVal);
     
     Cf_tai64_t* tai64Ptr;
-    uint32 ns;
+    uint32_t ns;
     Cf_tai64n_t tai64n;
     
     tai64Ptr = Cf_tai64_val(tai64Val);
-    ns = (uint32) Int_val(nsVal);
+    ns = (uint32_t) Int_val(nsVal);
     if (ns < 0 || ns > 999999999) INVALID_ARGUMENT("compose: ns > 10^9");
     
     tai64n.s = tai64Ptr->s;
@@ -287,13 +287,13 @@ CAMLprim value cf_tai64n_of_unix_time(value v)
     Cf_tai64n_t tai64n;
     double x, y;
     
-    y = (uint64) modf(Double_val(v), &x);
+    y = (uint64_t) modf(Double_val(v), &x);
     x += (double) cf_tai64_current_offset;
     if (x < cf_tai64_unix_limit[0] || x > cf_tai64_unix_limit[1])
         cf_tai64_range_error();
     
-    tai64n.s = CF_TAI64_EPOCH + ((uint64) x);
-    tai64n.ns = (uint32) (y * 1E9);
+    tai64n.s = CF_TAI64_EPOCH + ((uint64_t) x);
+    tai64n.ns = (uint32_t) (y * 1E9);
     result = cf_tai64n_alloc(&tai64n);
     
     CAMLreturn(result);
@@ -308,7 +308,7 @@ CAMLprim value cf_tai64n_to_unix_time(value v)
     CAMLlocal1(result);
 
     double x, y;
-    uint64 epoch;
+    uint64_t epoch;
     
     epoch = CF_TAI64_EPOCH;
     epoch += cf_tai64_current_offset;
@@ -331,8 +331,8 @@ CAMLprim value cf_tai64n_of_label(value v)
     
     Cf_tai64n_t tai64n;
     int i;
-    uint64 x;
-    uint32 y;
+    uint64_t x;
+    uint32_t y;
     
     if (string_length(v) != 12) cf_tai64_label_error();
     for (i = 0, x = 0; i < 8; ++i) x = (x << 8) | Byte_u(v, i);
@@ -352,8 +352,8 @@ CAMLprim value cf_tai64n_to_label(value v)
     CAMLparam1(v);
     CAMLlocal1(result);
     
-    uint64 x;
-    uint32 y;
+    uint64_t x;
+    uint32_t y;
     int i;
     
     result = alloc_string(12);
@@ -377,12 +377,12 @@ CAMLprim value cf_tai64n_add(value tai64nVal, value dtVal)
 
     Cf_tai64n_t tai64n;
     double zInt, zFrac;
-    int64 x;
-    int32 y;
+    int64_t x;
+    int32_t y;
 
     zFrac = modf(Double_val(dtVal), &zInt);
-    x = (int64) zInt;
-    y = (int32) (zFrac * 1E9);
+    x = (int64_t) zInt;
+    y = (int32_t) (zFrac * 1E9);
     
     tai64n.s = Cf_tai64n_val(tai64nVal)->s + x;
     tai64n.ns = Cf_tai64n_val(tai64nVal)->ns + y;
@@ -409,8 +409,8 @@ CAMLprim value cf_tai64n_sub(value v1, value v2)
     CAMLlocal1(resultVal);
         
     double dt;
-    dt = ((int64) Cf_tai64n_val(v1)->s) - ((int64) Cf_tai64n_val(v2)->s);
-    dt += (((int32) Cf_tai64n_val(v1)->ns) - ((int32) Cf_tai64n_val(v2)->ns))
+    dt = ((int64_t) Cf_tai64n_val(v1)->s) - ((int64_t) Cf_tai64n_val(v2)->s);
+    dt += (((int32_t) Cf_tai64n_val(v1)->ns) - ((int32_t) Cf_tai64n_val(v2)->ns))
         * 1E-9;
     
     resultVal = copy_double(dt);
diff --git a/cf_tai64n_p.h b/cf_tai64n_p.h
index 9a9edb0..ea0c99b 100644
--- a/cf_tai64n_p.h
+++ b/cf_tai64n_p.h
@@ -35,7 +35,7 @@
 
 #include "cf_tai64_p.h"
 
-struct cf_tai64n_s { uint64 s; uint32 ns; };
+struct cf_tai64n_s { uint64_t s; uint32_t ns; };
 typedef struct cf_tai64n_s Cf_tai64n_t;
 
 #define Cf_tai64n_val(v)  ((Cf_tai64n_t*) Data_custom_val(v))