Lines Matching refs:self
213 static int fill_buffer(multipart_buffer *self) in fill_buffer() argument
218 if (self->bytes_in_buffer > 0 && self->buf_begin != self->buffer) { in fill_buffer()
219 memmove(self->buffer, self->buf_begin, self->bytes_in_buffer); in fill_buffer()
222 self->buf_begin = self->buffer; in fill_buffer()
225 bytes_to_read = self->bufsize - self->bytes_in_buffer; in fill_buffer()
230 char *buf = self->buffer + self->bytes_in_buffer; in fill_buffer()
236 self->bytes_in_buffer += actual_read; in fill_buffer()
249 static int multipart_buffer_eof(multipart_buffer *self) in multipart_buffer_eof() argument
251 return self->bytes_in_buffer == 0 && fill_buffer(self) < 1; in multipart_buffer_eof()
257 multipart_buffer *self = (multipart_buffer *) ecalloc(1, sizeof(multipart_buffer)); in multipart_buffer_new() local
262 self->buffer = (char *) ecalloc(1, minsize + 1); in multipart_buffer_new()
263 self->bufsize = minsize; in multipart_buffer_new()
265 spprintf(&self->boundary, 0, "--%s", boundary); in multipart_buffer_new()
267 self->boundary_next_len = (int)spprintf(&self->boundary_next, 0, "\n--%s", boundary); in multipart_buffer_new()
269 self->buf_begin = self->buffer; in multipart_buffer_new()
270 self->bytes_in_buffer = 0; in multipart_buffer_new()
273 php_rfc1867_get_detect_order(&self->detect_order, &self->detect_order_size); in multipart_buffer_new()
275 self->detect_order = NULL; in multipart_buffer_new()
276 self->detect_order_size = 0; in multipart_buffer_new()
279 self->input_encoding = NULL; in multipart_buffer_new()
281 return self; in multipart_buffer_new()
295 static char *next_line(multipart_buffer *self) in next_line() argument
298 char* line = self->buf_begin; in next_line()
299 char* ptr = memchr(self->buf_begin, '\n', self->bytes_in_buffer); in next_line()
311 self->buf_begin = ptr + 1; in next_line()
312 self->bytes_in_buffer -= (self->buf_begin - line); in next_line()
317 if (self->bytes_in_buffer < self->bufsize) { in next_line()
321 line[self->bufsize] = 0; in next_line()
322 self->bytes_in_buffer = 0; in next_line()
330 static char *get_line(multipart_buffer *self) in get_line() argument
332 char* ptr = next_line(self); in get_line()
335 fill_buffer(self); in get_line()
336 ptr = next_line(self); in get_line()
354 static int find_boundary(multipart_buffer *self, char *boundary) in find_boundary() argument
359 while( (line = get_line(self)) ) in find_boundary()
372 static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header) in multipart_buffer_headers() argument
380 if (!find_boundary(self, self->boundary)) { in multipart_buffer_headers()
386 while ((line = get_line(self)) && line[0] != '\0') { in multipart_buffer_headers()
391 …self->input_encoding = zend_multibyte_encoding_detector((const unsigned char *) line, strlen(line)… in multipart_buffer_headers()
580 static size_t multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes, int *end) in multipart_buffer_read() argument
586 if (bytes > (size_t)self->bytes_in_buffer) { in multipart_buffer_read()
587 fill_buffer(self); in multipart_buffer_read()
591 …if ((bound = php_ap_memstr(self->buf_begin, self->bytes_in_buffer, self->boundary_next, self->boun… in multipart_buffer_read()
592 max = bound - self->buf_begin; in multipart_buffer_read()
593 …if (end && php_ap_memstr(self->buf_begin, self->bytes_in_buffer, self->boundary_next, self->bounda… in multipart_buffer_read()
597 max = self->bytes_in_buffer; in multipart_buffer_read()
607 memcpy(buf, self->buf_begin, len); in multipart_buffer_read()
615 self->bytes_in_buffer -= (int)len; in multipart_buffer_read()
616 self->buf_begin += len; in multipart_buffer_read()
626 static char *multipart_buffer_read_body(multipart_buffer *self, size_t *len) in multipart_buffer_read_body() argument
631 while((read_bytes = multipart_buffer_read(self, buf, sizeof(buf), NULL))) { in multipart_buffer_read_body()