80 * Data is interpreted as binary. |
80 * Data is interpreted as binary. |
81 */ |
81 */ |
82 unsigned char *bytes; |
82 unsigned char *bytes; |
83 }; |
83 }; |
84 /** The allocator to use for automatic memory management. */ |
84 /** The allocator to use for automatic memory management. */ |
85 CxAllocator const *allocator; |
85 const CxAllocator *allocator; |
86 /** Current position of the buffer. */ |
86 /** Current position of the buffer. */ |
87 size_t pos; |
87 size_t pos; |
88 /** Current capacity (i.e. maximum size) of the buffer. */ |
88 /** Current capacity (i.e. maximum size) of the buffer. */ |
89 size_t capacity; |
89 size_t capacity; |
90 /** Current size of the buffer content. */ |
90 /** Current size of the buffer content. */ |
178 * @return a pointer to the buffer on success, \c NULL if a required allocation failed |
178 * @return a pointer to the buffer on success, \c NULL if a required allocation failed |
179 */ |
179 */ |
180 CxBuffer *cxBufferCreate( |
180 CxBuffer *cxBufferCreate( |
181 void *space, |
181 void *space, |
182 size_t capacity, |
182 size_t capacity, |
183 CxAllocator const *allocator, |
183 const CxAllocator *allocator, |
184 int flags |
184 int flags |
185 ); |
185 ); |
186 |
186 |
187 /** |
187 /** |
188 * Destroys the buffer contents. |
188 * Destroys the buffer contents. |
337 * @param buffer the buffer to test |
337 * @param buffer the buffer to test |
338 * @return non-zero, if the current buffer position has exceeded the last |
338 * @return non-zero, if the current buffer position has exceeded the last |
339 * byte of the buffer's contents. |
339 * byte of the buffer's contents. |
340 */ |
340 */ |
341 __attribute__((__nonnull__)) |
341 __attribute__((__nonnull__)) |
342 int cxBufferEof(CxBuffer const *buffer); |
342 int cxBufferEof(const CxBuffer *buffer); |
343 |
343 |
344 |
344 |
345 /** |
345 /** |
346 * Ensures that the buffer has a minimum capacity. |
346 * Ensures that the buffer has a minimum capacity. |
347 * |
347 * |