12 #define BUFFERS_PRIVATE
21 #define check() STMT_BEGIN buf_assert_ok(buf); STMT_END
23 #define check() STMT_NIL
32 const char *data,
size_t data_len,
36 size_t old_avail, avail;
40 int need_new_chunk = 0;
41 if (!buf->tail || ! CHUNK_REMAINING_CAPACITY(buf->tail)) {
42 size_t cap = data_len / 4;
45 next = CHUNK_WRITE_PTR(buf->tail);
46 avail = old_avail = CHUNK_REMAINING_CAPACITY(buf->tail);
48 &data, &data_len, done)) {
49 case TOR_COMPRESS_DONE:
52 case TOR_COMPRESS_ERROR:
56 tor_assert_nonfatal(!done);
60 case TOR_COMPRESS_BUFFER_FULL:
67 if (data_len == 0 && !done) {
74 buf->datalen += old_avail - avail;
75 buf->tail->datalen += old_avail - avail;
chunk_t * buf_add_chunk_with_capacity(buf_t *buf, size_t capacity, int capped)
Header file for buffers.c.
Utility macros to handle different features and behavior in different compilers.
tor_compress_output_t tor_compress_process(tor_compress_state_t *state, char **out, size_t *out_len, const char **in, size_t *in_len, int finish)
int buf_add_compress(buf_t *buf, tor_compress_state_t *state, const char *data, size_t data_len, const int done)
Macros to manage assertions, fatal and non-fatal.