7 |
7 |
8 #ifdef __cplusplus |
8 #ifdef __cplusplus |
9 extern "C" { |
9 extern "C" { |
10 #endif |
10 #endif |
11 |
11 |
|
12 /* no autoextend or autofree behaviour */ |
12 #define UCX_BUFFER_DEFAULT 0x00 |
13 #define UCX_BUFFER_DEFAULT 0x00 |
|
14 /* the buffer shall free the occupied memory space */ |
13 #define UCX_BUFFER_AUTOFREE 0x01 |
15 #define UCX_BUFFER_AUTOFREE 0x01 |
14 /* the buffer may automatically double its size on write operations */ |
16 /* the buffer may automatically double its size on write operations */ |
15 #define UCX_BUFFER_AUTOEXTEND 0x02 |
17 #define UCX_BUFFER_AUTOEXTEND 0x02 |
16 |
18 |
17 /* the user shall not modify values, but may get the latest pointer */ |
19 /* the user shall not modify values, but may get the latest pointer */ |
42 * |
44 * |
43 * SEEK_SET marks the start of the buffer |
45 * SEEK_SET marks the start of the buffer |
44 * SEEK_CUR marks the current position |
46 * SEEK_CUR marks the current position |
45 * SEEK_END marks the first 0-byte in the buffer |
47 * SEEK_END marks the first 0-byte in the buffer |
46 * |
48 * |
47 * ucx_memseek returns 0 on success and -1 if the new position is beyond the |
49 * ucx_buffer_seek returns 0 on success and -1 if the new position is beyond the |
48 * bounds of the allocated buffer. In that case the position of the buffer |
50 * bounds of the allocated buffer. In that case the position of the buffer |
49 * remains unchanged. |
51 * remains unchanged. |
50 * |
52 * |
51 */ |
53 */ |
52 int ucx_buffer_seek(UcxBuffer *buffer, off_t offset, int whence); |
54 int ucx_buffer_seek(UcxBuffer *buffer, off_t offset, int whence); |
|
55 |
|
56 #define ucx_buffer_clear(buffer) memset(buffer->space, 0, buffer->size); \ |
|
57 buffer->size = 0; buffer->pos = 0; |
53 |
58 |
54 /* |
59 /* |
55 * returns non-zero, if the current buffer position has exceeded the last |
60 * returns non-zero, if the current buffer position has exceeded the last |
56 * available byte of the underlying buffer |
61 * available byte of the underlying buffer |
57 * |
62 * |