Lines Matching refs:self

234 static int fill_buffer(multipart_buffer *self)  in fill_buffer()  argument
239 if (self->bytes_in_buffer > 0 && self->buf_begin != self->buffer) { in fill_buffer()
240 memmove(self->buffer, self->buf_begin, self->bytes_in_buffer); in fill_buffer()
243 self->buf_begin = self->buffer; in fill_buffer()
246 bytes_to_read = self->bufsize - self->bytes_in_buffer; in fill_buffer()
251 char *buf = self->buffer + self->bytes_in_buffer; in fill_buffer()
257 self->bytes_in_buffer += actual_read; in fill_buffer()
270 static int multipart_buffer_eof(multipart_buffer *self) in multipart_buffer_eof() argument
272 return self->bytes_in_buffer == 0 && fill_buffer(self) < 1; in multipart_buffer_eof()
278 multipart_buffer *self = (multipart_buffer *) ecalloc(1, sizeof(multipart_buffer)); in multipart_buffer_new() local
283 self->buffer = (char *) ecalloc(1, minsize + 1); in multipart_buffer_new()
284 self->bufsize = minsize; in multipart_buffer_new()
286 spprintf(&self->boundary, 0, "--%s", boundary); in multipart_buffer_new()
288 self->boundary_next_len = (int)spprintf(&self->boundary_next, 0, "\n--%s", boundary); in multipart_buffer_new()
290 self->buf_begin = self->buffer; in multipart_buffer_new()
291 self->bytes_in_buffer = 0; in multipart_buffer_new()
294 php_rfc1867_get_detect_order(&self->detect_order, &self->detect_order_size); in multipart_buffer_new()
296 self->detect_order = NULL; in multipart_buffer_new()
297 self->detect_order_size = 0; in multipart_buffer_new()
300 self->input_encoding = NULL; in multipart_buffer_new()
302 return self; in multipart_buffer_new()
316 static char *next_line(multipart_buffer *self) in next_line() argument
319 char* line = self->buf_begin; in next_line()
320 char* ptr = memchr(self->buf_begin, '\n', self->bytes_in_buffer); in next_line()
332 self->buf_begin = ptr + 1; in next_line()
333 self->bytes_in_buffer -= (self->buf_begin - line); in next_line()
338 if (self->bytes_in_buffer < self->bufsize) { in next_line()
342 line[self->bufsize] = 0; in next_line()
343 self->buf_begin = ptr; in next_line()
344 self->bytes_in_buffer = 0; in next_line()
351 static char *get_line(multipart_buffer *self) in get_line() argument
353 char* ptr = next_line(self); in get_line()
356 fill_buffer(self); in get_line()
357 ptr = next_line(self); in get_line()
375 static int find_boundary(multipart_buffer *self, char *boundary) in find_boundary() argument
380 while( (line = get_line(self)) ) in find_boundary()
393 static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header) in multipart_buffer_headers() argument
401 if (!find_boundary(self, self->boundary)) { in multipart_buffer_headers()
407 while ((line = get_line(self)) && line[0] != '\0') { in multipart_buffer_headers()
412self->input_encoding = zend_multibyte_encoding_detector((const unsigned char *) line, strlen(line)… in multipart_buffer_headers()
601 static size_t multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes, int *end) in multipart_buffer_read() argument
607 if (bytes > (size_t)self->bytes_in_buffer) { in multipart_buffer_read()
608 fill_buffer(self); in multipart_buffer_read()
612 …if ((bound = php_ap_memstr(self->buf_begin, self->bytes_in_buffer, self->boundary_next, self->boun… in multipart_buffer_read()
613 max = bound - self->buf_begin; in multipart_buffer_read()
614 …if (end && php_ap_memstr(self->buf_begin, self->bytes_in_buffer, self->boundary_next, self->bounda… in multipart_buffer_read()
618 max = self->bytes_in_buffer; in multipart_buffer_read()
628 memcpy(buf, self->buf_begin, len); in multipart_buffer_read()
636 self->bytes_in_buffer -= (int)len; in multipart_buffer_read()
637 self->buf_begin += len; in multipart_buffer_read()
647 static char *multipart_buffer_read_body(multipart_buffer *self, size_t *len) in multipart_buffer_read_body() argument
652 while((read_bytes = multipart_buffer_read(self, buf, sizeof(buf), NULL))) { in multipart_buffer_read_body()