Lines Matching refs:stream
67 php_stream *stream; in forget_persistent_resource_id_numbers() local
74 stream = (php_stream*)rsrc->ptr; in forget_persistent_resource_id_numbers()
77 fprintf(stderr, "forget_persistent: %s:%p\n", stream->ops->label, stream); in forget_persistent_resource_id_numbers()
80 stream->res = NULL; in forget_persistent_resource_id_numbers()
82 if (stream->ctx) { in forget_persistent_resource_id_numbers()
83 zend_list_delete(stream->ctx); in forget_persistent_resource_id_numbers()
84 stream->ctx = NULL; in forget_persistent_resource_id_numbers()
109 PHPAPI int php_stream_from_persistent_id(const char *persistent_id, php_stream **stream) in php_stream_from_persistent_id() argument
115 if (stream) { in php_stream_from_persistent_id()
121 *stream = (php_stream*)le->ptr; in php_stream_from_persistent_id()
125 (*stream)->res = regentry; in php_stream_from_persistent_id()
130 (*stream)->res = zend_register_resource(*stream, le_pstream); in php_stream_from_persistent_id()
284 ret->readfilters.stream = ret; in _php_stream_alloc()
285 ret->writefilters.stream = ret; in _php_stream_alloc()
363 PHPAPI int _php_stream_free(php_stream *stream, int close_options) /* {{{ */ in _php_stream_free() argument
382 context = PHP_STREAM_CONTEXT(stream); in _php_stream_free()
384 if (stream->flags & PHP_STREAM_FLAG_NO_CLOSE) { in _php_stream_free()
392 …stream->ops->label, stream, stream->orig_path, stream->in_free, _php_stream_pretty_free_options(cl… in _php_stream_free()
397 if (stream->in_free) { in _php_stream_free()
399 …if ((stream->in_free == 1) && (close_options & PHP_STREAM_FREE_IGNORE_ENCLOSING) && (stream->enclo… in _php_stream_free()
406 stream->in_free++; in _php_stream_free()
413 (stream->enclosing_stream != NULL)) { in _php_stream_free()
414 php_stream *enclosing_stream = stream->enclosing_stream; in _php_stream_free()
415 stream->enclosing_stream = NULL; in _php_stream_free()
428 if (stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FOPENCOOKIE) { in _php_stream_free()
432 php_stream_auto_cleanup(stream); in _php_stream_free()
433 stream->in_free--; in _php_stream_free()
442 stream->ops->label, stream, stream->orig_path, preserve_handle, release_cast, in _php_stream_free()
446 if (stream->flags & PHP_STREAM_FLAG_WAS_WRITTEN || stream->writefilters.head) { in _php_stream_free()
448 _php_stream_flush(stream, 1); in _php_stream_free()
452 if ((close_options & PHP_STREAM_FREE_RSRC_DTOR) == 0 && stream->res) { in _php_stream_free()
454 zend_list_close(stream->res); in _php_stream_free()
457 zend_list_delete(stream->res); in _php_stream_free()
458 stream->res = NULL; in _php_stream_free()
463 if (release_cast && stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FOPENCOOKIE) { in _php_stream_free()
471 stream->in_free = 0; in _php_stream_free()
472 return fclose(stream->stdiocast); in _php_stream_free()
475 ret = stream->ops->close(stream, preserve_handle ? 0 : 1); in _php_stream_free()
476 stream->abstract = NULL; in _php_stream_free()
479 if (release_cast && stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FDOPEN && stream->stdiocast) { in _php_stream_free()
480 fclose(stream->stdiocast); in _php_stream_free()
481 stream->stdiocast = NULL; in _php_stream_free()
482 stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE; in _php_stream_free()
487 while (stream->readfilters.head) { in _php_stream_free()
488 if (stream->readfilters.head->res != NULL) { in _php_stream_free()
489 zend_list_close(stream->readfilters.head->res); in _php_stream_free()
491 php_stream_filter_remove(stream->readfilters.head, 1); in _php_stream_free()
493 while (stream->writefilters.head) { in _php_stream_free()
494 if (stream->writefilters.head->res != NULL) { in _php_stream_free()
495 zend_list_close(stream->writefilters.head->res); in _php_stream_free()
497 php_stream_filter_remove(stream->writefilters.head, 1); in _php_stream_free()
500 if (stream->wrapper && stream->wrapper->wops && stream->wrapper->wops->stream_closer) { in _php_stream_free()
501 stream->wrapper->wops->stream_closer(stream->wrapper, stream); in _php_stream_free()
502 stream->wrapper = NULL; in _php_stream_free()
505 if (Z_TYPE(stream->wrapperdata) != IS_UNDEF) { in _php_stream_free()
506 zval_ptr_dtor(&stream->wrapperdata); in _php_stream_free()
507 ZVAL_UNDEF(&stream->wrapperdata); in _php_stream_free()
510 if (stream->readbuf) { in _php_stream_free()
511 pefree(stream->readbuf, stream->is_persistent); in _php_stream_free()
512 stream->readbuf = NULL; in _php_stream_free()
515 if (stream->is_persistent && (close_options & PHP_STREAM_FREE_PERSISTENT)) { in _php_stream_free()
517 zend_hash_apply_with_argument(&EG(persistent_list), _php_stream_free_persistent, stream); in _php_stream_free()
520 if (stream->orig_path) { in _php_stream_free()
521 pefree(stream->orig_path, stream->is_persistent); in _php_stream_free()
522 stream->orig_path = NULL; in _php_stream_free()
525 pefree(stream, stream->is_persistent); in _php_stream_free()
538 PHPAPI int _php_stream_fill_read_buffer(php_stream *stream, size_t size) in _php_stream_fill_read_buffer() argument
542 if (stream->readfilters.head) { in _php_stream_fill_read_buffer()
543 size_t to_read_now = MIN(size, stream->chunk_size); in _php_stream_fill_read_buffer()
549 chunk_buf = emalloc(stream->chunk_size); in _php_stream_fill_read_buffer()
551 while (!stream->eof && (stream->writepos - stream->readpos < (zend_off_t)to_read_now)) { in _php_stream_fill_read_buffer()
559 justread = stream->ops->read(stream, chunk_buf, stream->chunk_size); in _php_stream_fill_read_buffer()
560 if (justread < 0 && stream->writepos == stream->readpos) { in _php_stream_fill_read_buffer()
564 bucket = php_stream_bucket_new(stream, chunk_buf, justread, 0, 0); in _php_stream_fill_read_buffer()
569 flags = stream->eof ? PSFS_FLAG_FLUSH_CLOSE : PSFS_FLAG_NORMAL; in _php_stream_fill_read_buffer()
571 flags = stream->eof ? PSFS_FLAG_FLUSH_CLOSE : PSFS_FLAG_FLUSH_INC; in _php_stream_fill_read_buffer()
575 for (filter = stream->readfilters.head; filter; filter = filter->next) { in _php_stream_fill_read_buffer()
576 status = filter->fops->filter(stream, filter, brig_inp, brig_outp, NULL, flags); in _php_stream_fill_read_buffer()
599 if (stream->readbuf && stream->readbuflen - stream->writepos < bucket->buflen) { in _php_stream_fill_read_buffer()
600 if (stream->writepos > stream->readpos) { in _php_stream_fill_read_buffer()
601 … memmove(stream->readbuf, stream->readbuf + stream->readpos, stream->writepos - stream->readpos); in _php_stream_fill_read_buffer()
603 stream->writepos -= stream->readpos; in _php_stream_fill_read_buffer()
604 stream->readpos = 0; in _php_stream_fill_read_buffer()
607 if (stream->readbuflen - stream->writepos < bucket->buflen) { in _php_stream_fill_read_buffer()
608 stream->readbuflen += bucket->buflen; in _php_stream_fill_read_buffer()
609 stream->readbuf = perealloc(stream->readbuf, stream->readbuflen, in _php_stream_fill_read_buffer()
610 stream->is_persistent); in _php_stream_fill_read_buffer()
613 memcpy(stream->readbuf + stream->writepos, bucket->buf, bucket->buflen); in _php_stream_fill_read_buffer()
615 stream->writepos += bucket->buflen; in _php_stream_fill_read_buffer()
631 stream->eof = 1; in _php_stream_fill_read_buffer()
646 if (stream->writepos - stream->readpos < (zend_off_t)size) { in _php_stream_fill_read_buffer()
650 if (stream->readbuf && stream->readbuflen - stream->writepos < stream->chunk_size) { in _php_stream_fill_read_buffer()
651 if (stream->writepos > stream->readpos) { in _php_stream_fill_read_buffer()
652 … memmove(stream->readbuf, stream->readbuf + stream->readpos, stream->writepos - stream->readpos); in _php_stream_fill_read_buffer()
654 stream->writepos -= stream->readpos; in _php_stream_fill_read_buffer()
655 stream->readpos = 0; in _php_stream_fill_read_buffer()
660 if (stream->readbuflen - stream->writepos < stream->chunk_size) { in _php_stream_fill_read_buffer()
661 stream->readbuflen += stream->chunk_size; in _php_stream_fill_read_buffer()
662 stream->readbuf = perealloc(stream->readbuf, stream->readbuflen, in _php_stream_fill_read_buffer()
663 stream->is_persistent); in _php_stream_fill_read_buffer()
666 justread = stream->ops->read(stream, (char*)stream->readbuf + stream->writepos, in _php_stream_fill_read_buffer()
667 stream->readbuflen - stream->writepos in _php_stream_fill_read_buffer()
672 stream->writepos += justread; in _php_stream_fill_read_buffer()
678 PHPAPI ssize_t _php_stream_read(php_stream *stream, char *buf, size_t size) in _php_stream_read() argument
688 if (stream->writepos > stream->readpos) { in _php_stream_read()
690 toread = stream->writepos - stream->readpos; in _php_stream_read()
695 memcpy(buf, stream->readbuf + stream->readpos, toread); in _php_stream_read()
696 stream->readpos += toread; in _php_stream_read()
707 …if (!stream->readfilters.head && ((stream->flags & PHP_STREAM_FLAG_NO_BUFFER) || stream->chunk_siz… in _php_stream_read()
708 toread = stream->ops->read(stream, buf, size); in _php_stream_read()
718 if (php_stream_fill_read_buffer(stream, size) != SUCCESS) { in _php_stream_read()
725 toread = stream->writepos - stream->readpos; in _php_stream_read()
731 memcpy(buf, stream->readbuf + stream->readpos, toread); in _php_stream_read()
732 stream->readpos += toread; in _php_stream_read()
745 if ((stream->wrapper != &php_plain_files_wrapper) && in _php_stream_read()
746 (stream->ops != &php_stream_memory_ops) && in _php_stream_read()
747 (stream->ops != &php_stream_temp_ops)) { in _php_stream_read()
753 stream->position += didread; in _php_stream_read()
761 PHPAPI zend_string *php_stream_read_to_str(php_stream *stream, size_t len) in php_stream_read_to_str() argument
764 ssize_t read = php_stream_read(stream, ZSTR_VAL(str), len); in php_stream_read_to_str()
779 PHPAPI int _php_stream_eof(php_stream *stream) in _php_stream_eof() argument
782 if (stream->writepos - stream->readpos > 0) { in _php_stream_eof()
787 if (!stream->eof && PHP_STREAM_OPTION_RETURN_ERR == in _php_stream_eof()
788 php_stream_set_option(stream, PHP_STREAM_OPTION_CHECK_LIVENESS, in _php_stream_eof()
790 stream->eof = 1; in _php_stream_eof()
793 return stream->eof; in _php_stream_eof()
796 PHPAPI int _php_stream_putc(php_stream *stream, int c) in _php_stream_putc() argument
800 if (php_stream_write(stream, (char*)&buf, 1) > 0) { in _php_stream_putc()
806 PHPAPI int _php_stream_getc(php_stream *stream) in _php_stream_getc() argument
810 if (php_stream_read(stream, &buf, 1) > 0) { in _php_stream_getc()
816 PHPAPI int _php_stream_puts(php_stream *stream, const char *buf) in _php_stream_puts() argument
822 …if (len > 0 && php_stream_write(stream, buf, len) > 0 && php_stream_write(stream, newline, 1) > 0)… in _php_stream_puts()
828 PHPAPI int _php_stream_stat(php_stream *stream, php_stream_statbuf *ssb) in _php_stream_stat() argument
833 if (stream->wrapper && stream->wrapper->wops->stream_stat != NULL) { in _php_stream_stat()
834 return stream->wrapper->wops->stream_stat(stream->wrapper, stream, ssb); in _php_stream_stat()
841 if (stream->ops->stat == NULL) { in _php_stream_stat()
845 return (stream->ops->stat)(stream, ssb); in _php_stream_stat()
848 PHPAPI const char *php_stream_locate_eol(php_stream *stream, zend_string *buf) in php_stream_locate_eol() argument
855 readptr = (char*)stream->readbuf + stream->readpos; in php_stream_locate_eol()
856 avail = stream->writepos - stream->readpos; in php_stream_locate_eol()
863 if (stream->flags & PHP_STREAM_FLAG_DETECT_EOL) { in php_stream_locate_eol()
869 stream->flags ^= PHP_STREAM_FLAG_DETECT_EOL; in php_stream_locate_eol()
870 stream->flags |= PHP_STREAM_FLAG_EOL_MAC; in php_stream_locate_eol()
874 stream->flags ^= PHP_STREAM_FLAG_DETECT_EOL; in php_stream_locate_eol()
877 } else if (stream->flags & PHP_STREAM_FLAG_EOL_MAC) { in php_stream_locate_eol()
890 PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen, in _php_stream_get_line() argument
919 avail = stream->writepos - stream->readpos; in _php_stream_get_line()
927 readptr = (char*)stream->readbuf + stream->readpos; in _php_stream_get_line()
928 eol = php_stream_locate_eol(stream, NULL); in _php_stream_get_line()
957 stream->position += cpysz; in _php_stream_get_line()
958 stream->readpos += cpysz; in _php_stream_get_line()
966 } else if (stream->eof) { in _php_stream_get_line()
973 toread = stream->chunk_size; in _php_stream_get_line()
976 if (toread > stream->chunk_size) { in _php_stream_get_line()
977 toread = stream->chunk_size; in _php_stream_get_line()
981 php_stream_fill_read_buffer(stream, toread); in _php_stream_get_line()
983 if (stream->writepos - stream->readpos == 0) { in _php_stream_get_line()
1004 #define STREAM_BUFFERED_AMOUNT(stream) \ argument
1005 ((size_t)(((stream)->writepos) - (stream)->readpos))
1007 static const char *_php_stream_search_delim(php_stream *stream, in _php_stream_search_delim() argument
1016 seek_len = MIN(STREAM_BUFFERED_AMOUNT(stream), maxlen); in _php_stream_search_delim()
1022 return memchr(&stream->readbuf[stream->readpos + skiplen], in _php_stream_search_delim()
1025 return php_memnstr((char*)&stream->readbuf[stream->readpos + skiplen], in _php_stream_search_delim()
1027 (char*)&stream->readbuf[stream->readpos + seek_len]); in _php_stream_search_delim()
1031 PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, const char *delim, siz… in php_stream_get_record() argument
1045 stream, maxlen, 0, delim, delim_len); in php_stream_get_record()
1048 buffered_len = STREAM_BUFFERED_AMOUNT(stream); in php_stream_get_record()
1054 to_read_now = MIN(maxlen - buffered_len, stream->chunk_size); in php_stream_get_record()
1056 php_stream_fill_read_buffer(stream, buffered_len + to_read_now); in php_stream_get_record()
1058 just_read = STREAM_BUFFERED_AMOUNT(stream) - buffered_len; in php_stream_get_record()
1074 stream, maxlen, in php_stream_get_record()
1087 tent_ret_len = found_delim - (char*)&stream->readbuf[stream->readpos]; in php_stream_get_record()
1088 } else if (!has_delim && STREAM_BUFFERED_AMOUNT(stream) >= maxlen) { in php_stream_get_record()
1095 if (STREAM_BUFFERED_AMOUNT(stream) < maxlen && !stream->eof) { in php_stream_get_record()
1097 } else if (STREAM_BUFFERED_AMOUNT(stream) == 0 && stream->eof) { in php_stream_get_record()
1102 tent_ret_len = MIN(STREAM_BUFFERED_AMOUNT(stream), maxlen); in php_stream_get_record()
1109 ZSTR_LEN(ret_buf) = php_stream_read(stream, ZSTR_VAL(ret_buf), tent_ret_len); in php_stream_get_record()
1112 stream->readpos += delim_len; in php_stream_get_record()
1113 stream->position += delim_len; in php_stream_get_record()
1120 static ssize_t _php_stream_write_buffer(php_stream *stream, const char *buf, size_t count) in _php_stream_write_buffer() argument
1127 …if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0 && stream->readpos != stre… in _php_stream_write_buffer()
1128 stream->readpos = stream->writepos = 0; in _php_stream_write_buffer()
1130 stream->ops->seek(stream, stream->position, SEEK_SET, &stream->position); in _php_stream_write_buffer()
1134 ssize_t justwrote = stream->ops->write(stream, buf, count); in _php_stream_write_buffer()
1147 stream->position += justwrote; in _php_stream_write_buffer()
1158 static ssize_t _php_stream_write_filtered(php_stream *stream, const char *buf, size_t count, int fl… in _php_stream_write_filtered() argument
1168 bucket = php_stream_bucket_new(stream, (char *)buf, count, 0, 0); in _php_stream_write_filtered()
1172 for (filter = stream->writefilters.head; filter; filter = filter->next) { in _php_stream_write_filtered()
1175 status = filter->fops->filter(stream, filter, brig_inp, brig_outp, in _php_stream_write_filtered()
1176 filter == stream->writefilters.head ? &consumed : NULL, flags); in _php_stream_write_filtered()
1196 if (_php_stream_write_buffer(stream, bucket->buf, bucket->buflen) < 0) { in _php_stream_write_filtered()
1222 PHPAPI int _php_stream_flush(php_stream *stream, int closing) in _php_stream_flush() argument
1226 if (stream->writefilters.head) { in _php_stream_flush()
1227 …_php_stream_write_filtered(stream, NULL, 0, closing ? PSFS_FLAG_FLUSH_CLOSE : PSFS_FLAG_FLUSH_INC … in _php_stream_flush()
1230 stream->flags &= ~PHP_STREAM_FLAG_WAS_WRITTEN; in _php_stream_flush()
1232 if (stream->ops->flush) { in _php_stream_flush()
1233 ret = stream->ops->flush(stream); in _php_stream_flush()
1239 PHPAPI ssize_t _php_stream_write(php_stream *stream, const char *buf, size_t count) in _php_stream_write() argument
1248 if (stream->ops->write == NULL) { in _php_stream_write()
1253 if (stream->writefilters.head) { in _php_stream_write()
1254 bytes = _php_stream_write_filtered(stream, buf, count, PSFS_FLAG_NORMAL); in _php_stream_write()
1256 bytes = _php_stream_write_buffer(stream, buf, count); in _php_stream_write()
1260 stream->flags |= PHP_STREAM_FLAG_WAS_WRITTEN; in _php_stream_write()
1266 PHPAPI ssize_t _php_stream_printf(php_stream *stream, const char *fmt, ...) in _php_stream_printf() argument
1280 count = php_stream_write(stream, buf, count); in _php_stream_printf()
1286 PHPAPI zend_off_t _php_stream_tell(php_stream *stream) in _php_stream_tell() argument
1288 return stream->position; in _php_stream_tell()
1291 PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence) in _php_stream_seek() argument
1293 if (stream->fclose_stdiocast == PHP_STREAM_FCLOSE_FOPENCOOKIE) { in _php_stream_seek()
1295 if (!stream->fclose_stdiocast_flush_in_progress) { in _php_stream_seek()
1296 stream->fclose_stdiocast_flush_in_progress = 1; in _php_stream_seek()
1298 fflush(stream->stdiocast); in _php_stream_seek()
1299 stream->fclose_stdiocast_flush_in_progress = 0; in _php_stream_seek()
1304 if ((stream->flags & PHP_STREAM_FLAG_NO_BUFFER) == 0) { in _php_stream_seek()
1307 if (offset > 0 && offset <= stream->writepos - stream->readpos) { in _php_stream_seek()
1308 stream->readpos += offset; /* if offset = ..., then readpos = writepos */ in _php_stream_seek()
1309 stream->position += offset; in _php_stream_seek()
1310 stream->eof = 0; in _php_stream_seek()
1315 if (offset > stream->position && in _php_stream_seek()
1316 offset <= stream->position + stream->writepos - stream->readpos) { in _php_stream_seek()
1317 stream->readpos += offset - stream->position; in _php_stream_seek()
1318 stream->position = offset; in _php_stream_seek()
1319 stream->eof = 0; in _php_stream_seek()
1327 if (stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) { in _php_stream_seek()
1330 if (stream->writefilters.head) { in _php_stream_seek()
1331 _php_stream_flush(stream, 0); in _php_stream_seek()
1336 offset = stream->position + offset; in _php_stream_seek()
1340 ret = stream->ops->seek(stream, offset, whence, &stream->position); in _php_stream_seek()
1342 if (((stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0) || ret == 0) { in _php_stream_seek()
1344 stream->eof = 0; in _php_stream_seek()
1348 stream->readpos = stream->writepos = 0; in _php_stream_seek()
1361 if ((didread = php_stream_read(stream, tmp, MIN(offset, sizeof(tmp)))) <= 0) { in _php_stream_seek()
1366 stream->eof = 0; in _php_stream_seek()
1375 PHPAPI int _php_stream_set_option(php_stream *stream, int option, int value, void *ptrparam) in _php_stream_set_option() argument
1379 if (stream->ops->set_option) { in _php_stream_set_option()
1380 ret = stream->ops->set_option(stream, option, value, ptrparam); in _php_stream_set_option()
1387 ret = stream->chunk_size > INT_MAX ? INT_MAX : (int)stream->chunk_size; in _php_stream_set_option()
1388 stream->chunk_size = value; in _php_stream_set_option()
1394 stream->flags |= PHP_STREAM_FLAG_NO_BUFFER; in _php_stream_set_option()
1395 } else if (stream->flags & PHP_STREAM_FLAG_NO_BUFFER) { in _php_stream_set_option()
1396 stream->flags ^= PHP_STREAM_FLAG_NO_BUFFER; in _php_stream_set_option()
1409 PHPAPI int _php_stream_sync(php_stream *stream, bool data_only) in _php_stream_sync() argument
1415 return php_stream_set_option(stream, PHP_STREAM_OPTION_SYNC_API, op, NULL); in _php_stream_sync()
1418 PHPAPI int _php_stream_truncate_set_size(php_stream *stream, size_t newsize) in _php_stream_truncate_set_size() argument
1420 …return php_stream_set_option(stream, PHP_STREAM_OPTION_TRUNCATE_API, PHP_STREAM_TRUNCATE_SET_SIZE,… in _php_stream_truncate_set_size()
1423 PHPAPI ssize_t _php_stream_passthru(php_stream * stream STREAMS_DC) in _php_stream_passthru()
1429 if (php_stream_mmap_possible(stream)) { in _php_stream_passthru()
1433 …p = php_stream_mmap_range(stream, php_stream_tell(stream), PHP_STREAM_MMAP_ALL, PHP_STREAM_MAP_MOD… in _php_stream_passthru()
1443 php_stream_mmap_unmap_ex(stream, mapped); in _php_stream_passthru()
1449 while ((b = php_stream_read(stream, buf, sizeof(buf))) > 0) { in _php_stream_passthru()
1669 php_stream *stream = (php_stream*)rsrc->ptr; in stream_resource_regular_dtor() local
1671 FG(pclose_ret) = php_stream_free(stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR); in stream_resource_regular_dtor()
1676 php_stream *stream = (php_stream*)rsrc->ptr; in stream_resource_persistent_dtor() local
1677 FG(pclose_ret) = php_stream_free(stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR); in stream_resource_persistent_dtor()
1984 php_stream *stream = NULL; local
1997 stream = wrapper->wops->dir_opener(wrapper,
2001 if (stream) {
2002 stream->wrapper = wrapper;
2003 stream->flags |= PHP_STREAM_FLAG_NO_BUFFER | PHP_STREAM_FLAG_IS_DIR;
2008 if (stream == NULL && (options & REPORT_ERRORS)) {
2013 return stream;
2033 php_stream *stream = NULL; local
2086 stream = wrapper->wops->stream_opener(wrapper,
2093 if (stream && (options & STREAM_OPEN_PERSISTENT) && !stream->is_persistent) {
2096 php_stream_close(stream);
2097 stream = NULL;
2100 if (stream) {
2101 stream->wrapper = wrapper;
2105 if (stream) {
2110 if (stream->orig_path) {
2111 pefree(stream->orig_path, persistent);
2114 stream->orig_path = copy_of_path;
2116 stream->open_filename = __zend_orig_filename ? __zend_orig_filename : __zend_filename;
2117 stream->open_lineno = __zend_orig_lineno ? __zend_orig_lineno : __zend_lineno;
2121 if (stream != NULL && (options & STREAM_MUST_SEEK)) {
2124 switch(php_stream_make_seekable_rel(stream, &newstream,
2131 return stream;
2142 php_stream_close(stream);
2143 stream = NULL;
2156 …if (stream && stream->ops->seek && (stream->flags & PHP_STREAM_FLAG_NO_SEEK) == 0 && strchr(mode, …
2160 if (0 == stream->ops->seek(stream, 0, SEEK_CUR, &newpos)) {
2161 stream->position = newpos;
2165 if (stream == NULL && (options & REPORT_ERRORS)) {
2174 if (stream == NULL && copy_of_path != NULL) {
2181 return stream;
2186 PHPAPI php_stream_context *php_stream_context_set(php_stream *stream, php_stream_context *context) argument
2188 php_stream_context *oldcontext = PHP_STREAM_CONTEXT(stream);
2191 stream->ctx = context->res;
2194 stream->ctx = NULL;
2297 php_stream *stream; local
2307 stream = php_stream_opendir(dirname, REPORT_ERRORS, context);
2308 if (!stream) {
2312 while (php_stream_readdir(stream, &sdp)) {
2319 php_stream_closedir(stream);
2333 php_stream_closedir(stream);
2338 php_stream_closedir(stream);