comparison src/dmgrowbuf.h @ 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 c6ee41fd98dd
children
comparison
equal deleted inserted replaced
2585:ef6c826c5b7a 2586:9807ae37ad69
23 offs, // Current offset 23 offs, // Current offset
24 size, // Actual allocated size 24 size, // Actual allocated size
25 len, // Size requested 25 len, // Size requested
26 mingrow; // Minimum amount of bytes the allocation size grows by 26 mingrow; // Minimum amount of bytes the allocation size grows by
27 27
28 BOOL 28 bool
29 backwards, // TRUE if the buffer grows backwards (e.g. "offs" moves backwards) 29 backwards, // true if the buffer grows backwards (e.g. "offs" moves backwards)
30 literal, // TRUE if dmGrowBufPut*() functions stores data "literally" in backwards mode 30 literal, // true if dmGrowBufPut*() functions stores data "literally" in backwards mode
31 is_const; // TRUE will cause any reallocs etc. modifications to fail 31 is_const; // true will cause any reallocs etc. modifications to fail
32 } DMGrowBuf; 32 } DMGrowBuf;
33 33
34 34
35 int dmGrowBufInit(DMGrowBuf *buf); 35 int dmGrowBufInit(DMGrowBuf *buf);
36 int dmGrowBufAlloc(DMGrowBuf *buf, const size_t initial, const size_t mingrow); 36 int dmGrowBufAlloc(DMGrowBuf *buf, const size_t initial, const size_t mingrow);
44 DMGrowBuf * dmGrowBufConstCopyOffs(DMGrowBuf *dst, const DMGrowBuf *src, const size_t offs); 44 DMGrowBuf * dmGrowBufConstCopyOffs(DMGrowBuf *dst, const DMGrowBuf *src, const size_t offs);
45 DMGrowBuf * dmGrowBufConstCopyOffsSize(DMGrowBuf *dst, const DMGrowBuf *src, const size_t offs, const size_t len); 45 DMGrowBuf * dmGrowBufConstCopyOffsSize(DMGrowBuf *dst, const DMGrowBuf *src, const size_t offs, const size_t len);
46 DMGrowBuf * dmGrowBufConstCreateFrom(DMGrowBuf *buf, Uint8 *data, const size_t len); 46 DMGrowBuf * dmGrowBufConstCreateFrom(DMGrowBuf *buf, Uint8 *data, const size_t len);
47 47
48 48
49 BOOL dmGrowBufGrow(DMGrowBuf *buf, const size_t amount); 49 bool dmGrowBufGrow(DMGrowBuf *buf, const size_t amount);
50 BOOL dmGrowBufCheckGrow(DMGrowBuf *buf, const size_t nsize); 50 bool dmGrowBufCheckGrow(DMGrowBuf *buf, const size_t nsize);
51 51
52 BOOL dmGrowBufPut(DMGrowBuf *buf, const Uint8 *data, const size_t len); 52 bool dmGrowBufPut(DMGrowBuf *buf, const Uint8 *data, const size_t len);
53 BOOL dmGrowBufPutU8(DMGrowBuf *buf, const Uint8 value); 53 bool dmGrowBufPutU8(DMGrowBuf *buf, const Uint8 value);
54 BOOL dmGrowBufPutU16BE(DMGrowBuf *buf, const Uint16 val); 54 bool dmGrowBufPutU16BE(DMGrowBuf *buf, const Uint16 val);
55 BOOL dmGrowBufPutU16LE(DMGrowBuf *buf, const Uint16 val); 55 bool dmGrowBufPutU16LE(DMGrowBuf *buf, const Uint16 val);
56 BOOL dmGrowBufPutU32BE(DMGrowBuf *buf, const Uint32 val); 56 bool dmGrowBufPutU32BE(DMGrowBuf *buf, const Uint32 val);
57 BOOL dmGrowBufPutU32LE(DMGrowBuf *buf, const Uint32 val); 57 bool dmGrowBufPutU32LE(DMGrowBuf *buf, const Uint32 val);
58 58
59 BOOL dmGrowBufGetU8(DMGrowBuf *buf, Uint8 *value); 59 bool dmGrowBufGetU8(DMGrowBuf *buf, Uint8 *value);
60 60
61 61
62 #ifdef __cplusplus 62 #ifdef __cplusplus
63 } 63 }
64 #endif 64 #endif