Mercurial > hg > dmlib
comparison src/dmresw.c @ 2586:9807ae37ad69
Require stdbool.h, we require C11 now.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 08 Dec 2022 15:59:22 +0200 |
parents | 73545a442ffe |
children |
comparison
equal
deleted
inserted
replaced
2585:ef6c826c5b7a | 2586:9807ae37ad69 |
---|---|
5 * (C) Copyright 2011-2015 Tecnic Software productions (TNSP) | 5 * (C) Copyright 2011-2015 Tecnic Software productions (TNSP) |
6 */ | 6 */ |
7 #include "dmres.h" | 7 #include "dmres.h" |
8 | 8 |
9 | 9 |
10 BOOL dmf_write_str(DMResource *fh, const void *data, const size_t len) | 10 bool dmf_write_str(DMResource *fh, const void *data, const size_t len) |
11 { | 11 { |
12 return dmfwrite(data, len, 1, fh) == 1; | 12 return dmfwrite(data, len, 1, fh) == 1; |
13 } | 13 } |
14 | 14 |
15 | 15 |
16 BOOL dmf_write_byte(DMResource *fh, const Uint8 val) | 16 bool dmf_write_byte(DMResource *fh, const Uint8 val) |
17 { | 17 { |
18 return dmfputc(val, fh) == val; | 18 return dmfputc(val, fh) == val; |
19 } | 19 } |
20 | 20 |
21 | 21 |
22 #define DM_DEFINE_FFUNC(xname, xtype, xmacro) \ | 22 #define DM_DEFINE_FFUNC(xname, xtype, xmacro) \ |
23 BOOL dmf_write_ ## xname (DMResource *f, const xtype v) { \ | 23 bool dmf_write_ ## xname (DMResource *f, const xtype v) { \ |
24 xtype result = DM_NATIVE_TO_ ## xmacro (v); \ | 24 xtype result = DM_NATIVE_TO_ ## xmacro (v); \ |
25 if (dmfwrite(&result, sizeof( xtype ), 1, f) != 1) \ | 25 if (dmfwrite(&result, sizeof( xtype ), 1, f) != 1) \ |
26 return FALSE; \ | 26 return false; \ |
27 return TRUE; \ | 27 return true; \ |
28 } | 28 } |
29 | 29 |
30 #include "dmfiletmpl.h" | 30 #include "dmfiletmpl.h" |
31 | 31 |
32 #undef DM_DEFINE_FFUNC | 32 #undef DM_DEFINE_FFUNC |