comparison src/dmgrowbuf.h @ 1531:260bf529a8f2

Implement current len/offs push/pop for growbuf.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 12 May 2018 03:23:32 +0300
parents e8fe529f4341
children 907160399b24
comparison
equal deleted inserted replaced
1530:94eb6a8a7d56 1531:260bf529a8f2
13 extern "C" { 13 extern "C" {
14 #endif 14 #endif
15 15
16 typedef struct 16 typedef struct
17 { 17 {
18 Uint8 *data; 18 Uint8 *data, *adata;
19 size_t len, size, mingrow; 19 size_t len, size, mingrow, offs;
20 BOOL allocated; 20 BOOL allocated;
21 int nstack;
22 struct { size_t offs, len; } stack[32];
21 } DMGrowBuf; 23 } DMGrowBuf;
22 24
23 25
24 int dmGrowBufInit(DMGrowBuf *buf); 26 int dmGrowBufInit(DMGrowBuf *buf);
25 int dmGrowBufAlloc(DMGrowBuf *buf, const size_t initial, const size_t mingrow); 27 int dmGrowBufAlloc(DMGrowBuf *buf, const size_t initial, const size_t mingrow);
35 BOOL dmGrowBufPutU16BE(DMGrowBuf *buf, const Uint16 val); 37 BOOL dmGrowBufPutU16BE(DMGrowBuf *buf, const Uint16 val);
36 BOOL dmGrowBufPutU16LE(DMGrowBuf *buf, const Uint16 val); 38 BOOL dmGrowBufPutU16LE(DMGrowBuf *buf, const Uint16 val);
37 BOOL dmGrowBufPutU32BE(DMGrowBuf *buf, const Uint32 val); 39 BOOL dmGrowBufPutU32BE(DMGrowBuf *buf, const Uint32 val);
38 BOOL dmGrowBufPutU32LE(DMGrowBuf *buf, const Uint32 val); 40 BOOL dmGrowBufPutU32LE(DMGrowBuf *buf, const Uint32 val);
39 41
42 void dmGrowBufPush(DMGrowBuf *buf);
43 void dmGrowBufPop(DMGrowBuf *buf);
44
40 45
41 #ifdef __cplusplus 46 #ifdef __cplusplus
42 } 47 }
43 #endif 48 #endif
44 49