|
| 1 | +From c0d7c99632ea2ee01066988708cbb41f335cbdc3 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Brahmajit Das < [email protected]> |
| 3 | +Date: Sat, 14 Jun 2025 00:18:38 +0530 |
| 4 | +Subject: [PATCH] src/lib/serialize.h: don't define double as float_t |
| 5 | + |
| 6 | +libuv with commit 85b526f makes uv.h include math.h for the definitions |
| 7 | +of NAN/INFINITY. That header also defines the ISO C standard float_t |
| 8 | +type. Now that that definition is in scope, the cowsql definition in |
| 9 | +src/lib/serialize.h conflicts with it. |
| 10 | + |
| 11 | +Fixes: 451cff63b29366237a9502823299b05bbff8662b |
| 12 | +Closes: https://github.com/cowsql/cowsql/issues/35 |
| 13 | +Signed-off-by: Brahmajit Das < [email protected]> |
| 14 | +--- |
| 15 | + src/lib/serialize.h | 8 ++++---- |
| 16 | + 1 file changed, 4 insertions(+), 4 deletions(-) |
| 17 | + |
| 18 | +diff --git a/src/lib/serialize.h b/src/lib/serialize.h |
| 19 | +index 9fbd49c..a7f9147 100644 |
| 20 | +--- a/src/lib/serialize.h |
| 21 | ++++ b/src/lib/serialize.h |
| 22 | +@@ -37,7 +37,7 @@ static_assert(sizeof(double) == sizeof(uint64_t), |
| 23 | + * Basic type aliases to used by macro-based processing. |
| 24 | + */ |
| 25 | + typedef const char *text_t; |
| 26 | +-typedef double float_t; |
| 27 | ++typedef double cowsql_float; |
| 28 | + typedef uv_buf_t blob_t; |
| 29 | + |
| 30 | + /** |
| 31 | +@@ -143,7 +143,7 @@ COWSQL_INLINE size_t int64__sizeof(const int64_t *value) |
| 32 | + return sizeof(int64_t); |
| 33 | + } |
| 34 | + |
| 35 | +-COWSQL_INLINE size_t float__sizeof(const float_t *value) |
| 36 | ++COWSQL_INLINE size_t float__sizeof(const cowsql_float *value) |
| 37 | + { |
| 38 | + (void)value; |
| 39 | + return sizeof(double); |
| 40 | +@@ -190,7 +190,7 @@ COWSQL_INLINE void int64__encode(const int64_t *value, void **cursor) |
| 41 | + *cursor += sizeof(int64_t); |
| 42 | + } |
| 43 | + |
| 44 | +-COWSQL_INLINE void float__encode(const float_t *value, void **cursor) |
| 45 | ++COWSQL_INLINE void float__encode(const cowsql_float *value, void **cursor) |
| 46 | + { |
| 47 | + *(uint64_t *)(*cursor) = ByteFlipLe64(*(uint64_t *)value); |
| 48 | + *cursor += sizeof(uint64_t); |
| 49 | +@@ -273,7 +273,7 @@ COWSQL_INLINE int int64__decode(struct cursor *cursor, int64_t *value) |
| 50 | + return 0; |
| 51 | + } |
| 52 | + |
| 53 | +-COWSQL_INLINE int float__decode(struct cursor *cursor, float_t *value) |
| 54 | ++COWSQL_INLINE int float__decode(struct cursor *cursor, cowsql_float *value) |
| 55 | + { |
| 56 | + size_t n = sizeof(double); |
| 57 | + if (n > cursor->cap) { |
0 commit comments