1 /* 7zBuf.h -- Byte Buffer 2 2013-01-18 : Igor Pavlov : Public domain */ 3 4 #ifndef __7Z_BUF_H 5 #define __7Z_BUF_H 6 7 #include "7zTypes.h" 8 9 EXTERN_C_BEGIN 10 11 typedef struct 12 { 13 Byte *data; 14 size_t size; 15 } CBuf; 16 17 void Buf_Init(CBuf *p); 18 int Buf_Create(CBuf *p, size_t size, ISzAlloc *alloc); 19 void Buf_Free(CBuf *p, ISzAlloc *alloc); 20 21 typedef struct 22 { 23 Byte *data; 24 size_t size; 25 size_t pos; 26 } CDynBuf; 27 28 void DynBuf_Construct(CDynBuf *p); 29 void DynBuf_SeekToBeg(CDynBuf *p); 30 int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc); 31 void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc); 32 33 EXTERN_C_END 34 35 #endif 36