Lines Matching refs:self

235 static int fill_buffer(multipart_buffer *self)  in fill_buffer()  argument
240 if (self->bytes_in_buffer > 0 && self->buf_begin != self->buffer) { in fill_buffer()
241 memmove(self->buffer, self->buf_begin, self->bytes_in_buffer); in fill_buffer()
244 self->buf_begin = self->buffer; in fill_buffer()
247 bytes_to_read = self->bufsize - self->bytes_in_buffer; in fill_buffer()
252 char *buf = self->buffer + self->bytes_in_buffer; in fill_buffer()
258 self->bytes_in_buffer += actual_read; in fill_buffer()
271 static int multipart_buffer_eof(multipart_buffer *self) in multipart_buffer_eof() argument
273 return self->bytes_in_buffer == 0 && fill_buffer(self) < 1; in multipart_buffer_eof()
279 multipart_buffer *self = (multipart_buffer *) ecalloc(1, sizeof(multipart_buffer)); in multipart_buffer_new() local
284 self->buffer = (char *) ecalloc(1, minsize + 1); in multipart_buffer_new()
285 self->bufsize = minsize; in multipart_buffer_new()
287 spprintf(&self->boundary, 0, "--%s", boundary); in multipart_buffer_new()
289 self->boundary_next_len = (int)spprintf(&self->boundary_next, 0, "\n--%s", boundary); in multipart_buffer_new()
291 self->buf_begin = self->buffer; in multipart_buffer_new()
292 self->bytes_in_buffer = 0; in multipart_buffer_new()
295 php_rfc1867_get_detect_order(&self->detect_order, &self->detect_order_size); in multipart_buffer_new()
297 self->detect_order = NULL; in multipart_buffer_new()
298 self->detect_order_size = 0; in multipart_buffer_new()
301 self->input_encoding = NULL; in multipart_buffer_new()
303 return self; in multipart_buffer_new()
317 static char *next_line(multipart_buffer *self) in next_line() argument
320 char* line = self->buf_begin; in next_line()
321 char* ptr = memchr(self->buf_begin, '\n', self->bytes_in_buffer); in next_line()
333 self->buf_begin = ptr + 1; in next_line()
334 self->bytes_in_buffer -= (self->buf_begin - line); in next_line()
339 if (self->bytes_in_buffer < self->bufsize) { in next_line()
343 line[self->bufsize] = 0; in next_line()
344 self->buf_begin = ptr; in next_line()
345 self->bytes_in_buffer = 0; in next_line()
352 static char *get_line(multipart_buffer *self) in get_line() argument
354 char* ptr = next_line(self); in get_line()
357 fill_buffer(self); in get_line()
358 ptr = next_line(self); in get_line()
376 static int find_boundary(multipart_buffer *self, char *boundary) in find_boundary() argument
381 while( (line = get_line(self)) ) in find_boundary()
394 static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header) in multipart_buffer_headers() argument
402 if (!find_boundary(self, self->boundary)) { in multipart_buffer_headers()
408 while ((line = get_line(self)) && line[0] != '\0') { in multipart_buffer_headers()
413self->input_encoding = zend_multibyte_encoding_detector((const unsigned char *) line, strlen(line)… in multipart_buffer_headers()
602 static size_t multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes, int *end) in multipart_buffer_read() argument
608 if (bytes > (size_t)self->bytes_in_buffer) { in multipart_buffer_read()
609 fill_buffer(self); in multipart_buffer_read()
613 …if ((bound = php_ap_memstr(self->buf_begin, self->bytes_in_buffer, self->boundary_next, self->boun… in multipart_buffer_read()
614 max = bound - self->buf_begin; in multipart_buffer_read()
615 …if (end && php_ap_memstr(self->buf_begin, self->bytes_in_buffer, self->boundary_next, self->bounda… in multipart_buffer_read()
619 max = self->bytes_in_buffer; in multipart_buffer_read()
629 memcpy(buf, self->buf_begin, len); in multipart_buffer_read()
637 self->bytes_in_buffer -= (int)len; in multipart_buffer_read()
638 self->buf_begin += len; in multipart_buffer_read()
648 static char *multipart_buffer_read_body(multipart_buffer *self, size_t *len) in multipart_buffer_read_body() argument
653 while((read_bytes = multipart_buffer_read(self, buf, sizeof(buf), NULL))) { in multipart_buffer_read_body()