Changes in uspace/lib/http/src/receive-buffer.c [b7fd2a0:cde999a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/http/src/receive-buffer.c
rb7fd2a0 rcde999a 43 43 #include <http/receive-buffer.h> 44 44 45 errno_t recv_buffer_init(receive_buffer_t *rb, size_t buffer_size,45 int recv_buffer_init(receive_buffer_t *rb, size_t buffer_size, 46 46 receive_func_t receive, void *client_data) 47 47 { … … 61 61 } 62 62 63 static errno_t dummy_receive(void *unused, void *buf, size_t buf_size,63 static int dummy_receive(void *unused, void *buf, size_t buf_size, 64 64 size_t *nrecv) 65 65 { … … 68 68 } 69 69 70 errno_t recv_buffer_init_const(receive_buffer_t *rb, void *buf, size_t size)71 { 72 errno_t rc = recv_buffer_init(rb, size, dummy_receive, NULL);70 int recv_buffer_init_const(receive_buffer_t *rb, void *buf, size_t size) 71 { 72 int rc = recv_buffer_init(rb, size, dummy_receive, NULL); 73 73 if (rc != EOK) 74 74 return rc; … … 107 107 } 108 108 109 errno_t recv_cut(receive_buffer_t *rb, receive_buffer_mark_t *a, receive_buffer_mark_t *b, void **out_buf, size_t *out_size)109 int recv_cut(receive_buffer_t *rb, receive_buffer_mark_t *a, receive_buffer_mark_t *b, void **out_buf, size_t *out_size) 110 110 { 111 111 if (a->offset > b->offset) … … 123 123 } 124 124 125 errno_t recv_cut_str(receive_buffer_t *rb, receive_buffer_mark_t *a, receive_buffer_mark_t *b, char **out_buf)125 int recv_cut_str(receive_buffer_t *rb, receive_buffer_mark_t *a, receive_buffer_mark_t *b, char **out_buf) 126 126 { 127 127 if (a->offset > b->offset) … … 147 147 148 148 /** Receive one character (with buffering) */ 149 errno_t recv_char(receive_buffer_t *rb, char *c, bool consume)149 int recv_char(receive_buffer_t *rb, char *c, bool consume) 150 150 { 151 151 if (rb->out == rb->in) { … … 170 170 171 171 size_t nrecv; 172 errno_t rc = rb->receive(rb->client_data, rb->buffer + rb->in, free, &nrecv);172 int rc = rb->receive(rb->client_data, rb->buffer + rb->in, free, &nrecv); 173 173 if (rc != EOK) 174 174 return rc; … … 183 183 } 184 184 185 errno_t recv_buffer(receive_buffer_t *rb, char *buf, size_t buf_size,185 int recv_buffer(receive_buffer_t *rb, char *buf, size_t buf_size, 186 186 size_t *nrecv) 187 187 { … … 202 202 * @return EOK or an error code 203 203 */ 204 errno_t recv_discard(receive_buffer_t *rb, char discard, size_t *ndisc)204 int recv_discard(receive_buffer_t *rb, char discard, size_t *ndisc) 205 205 { 206 206 char c = 0; 207 errno_t rc = recv_char(rb, &c, false);207 int rc = recv_char(rb, &c, false); 208 208 if (rc != EOK) 209 209 return rc; … … 223 223 * @return EOK or an error code 224 224 */ 225 errno_t recv_discard_str(receive_buffer_t *rb, const char *discard, size_t *ndisc)225 int recv_discard_str(receive_buffer_t *rb, const char *discard, size_t *ndisc) 226 226 { 227 227 size_t discarded = 0; 228 228 while (*discard) { 229 229 size_t nd; 230 errno_t rc = recv_discard(rb, *discard, &nd);230 int rc = recv_discard(rb, *discard, &nd); 231 231 if (rc != EOK) 232 232 return rc; … … 241 241 } 242 242 243 errno_t recv_while(receive_buffer_t *rb, char_class_func_t class)243 int recv_while(receive_buffer_t *rb, char_class_func_t class) 244 244 { 245 245 while (true) { 246 246 char c = 0; 247 errno_t rc = recv_char(rb, &c, false);247 int rc = recv_char(rb, &c, false); 248 248 if (rc != EOK) 249 249 return rc; … … 266 266 * @return EOK on success or an error code 267 267 */ 268 errno_t recv_eol(receive_buffer_t *rb, size_t *nrecv)268 int recv_eol(receive_buffer_t *rb, size_t *nrecv) 269 269 { 270 270 char c = 0; 271 errno_t rc = recv_char(rb, &c, false);271 int rc = recv_char(rb, &c, false); 272 272 if (rc != EOK) 273 273 return rc; … … 292 292 293 293 /* Receive a single line */ 294 errno_t recv_line(receive_buffer_t *rb, char *line, size_t size, size_t *nrecv)294 int recv_line(receive_buffer_t *rb, char *line, size_t size, size_t *nrecv) 295 295 { 296 296 size_t written = 0; … … 299 299 while (written < size) { 300 300 char c = 0; 301 errno_t rc = recv_char(rb, &c, true);301 int rc = recv_char(rb, &c, true); 302 302 if (rc != EOK) 303 303 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.