mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
streams: add const specifier
This commit is contained in:
parent
ef98a6e723
commit
17b8706bf6
6 changed files with 22 additions and 22 deletions
|
@ -568,13 +568,13 @@ PHP_FUNCTION(stream_get_meta_data)
|
|||
/* {{{ Retrieves list of registered socket transports */
|
||||
PHP_FUNCTION(stream_get_transports)
|
||||
{
|
||||
HashTable *stream_xport_hash;
|
||||
zend_string *stream_xport;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
stream_xport_hash = php_stream_xport_get_hash();
|
||||
array_init(return_value);
|
||||
|
||||
const HashTable *stream_xport_hash = php_stream_xport_get_hash();
|
||||
zend_string *stream_xport;
|
||||
ZEND_HASH_MAP_FOREACH_STR_KEY(stream_xport_hash, stream_xport) {
|
||||
add_next_index_str(return_value, zend_string_copy(stream_xport));
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
@ -584,13 +584,12 @@ PHP_FUNCTION(stream_get_transports)
|
|||
/* {{{ Retrieves list of registered stream wrappers */
|
||||
PHP_FUNCTION(stream_get_wrappers)
|
||||
{
|
||||
HashTable *url_stream_wrappers_hash;
|
||||
zend_string *stream_protocol;
|
||||
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash();
|
||||
array_init(return_value);
|
||||
|
||||
const HashTable *url_stream_wrappers_hash = php_stream_get_url_stream_wrappers_hash();
|
||||
zend_string *stream_protocol;
|
||||
ZEND_HASH_MAP_FOREACH_STR_KEY(url_stream_wrappers_hash, stream_protocol) {
|
||||
if (stream_protocol) {
|
||||
add_next_index_str(return_value, zend_string_copy(stream_protocol));
|
||||
|
@ -882,7 +881,7 @@ static void user_space_stream_notifier_dtor(php_stream_notifier *notifier)
|
|||
notifier->ptr = NULL;
|
||||
}
|
||||
|
||||
static zend_result parse_context_options(php_stream_context *context, HashTable *options)
|
||||
static zend_result parse_context_options(php_stream_context *context, const HashTable *options)
|
||||
{
|
||||
zval *wval, *oval;
|
||||
zend_string *wkey, *okey;
|
||||
|
@ -906,7 +905,7 @@ static zend_result parse_context_options(php_stream_context *context, HashTable
|
|||
return SUCCESS;
|
||||
}
|
||||
|
||||
static zend_result parse_context_params(php_stream_context *context, HashTable *params)
|
||||
static zend_result parse_context_params(php_stream_context *context, const HashTable *params)
|
||||
{
|
||||
zval *tmp;
|
||||
|
||||
|
|
|
@ -361,7 +361,7 @@ PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence);
|
|||
#define php_stream_rewind(stream) _php_stream_seek((stream), 0L, SEEK_SET)
|
||||
#define php_stream_seek(stream, offset, whence) _php_stream_seek((stream), (offset), (whence))
|
||||
|
||||
PHPAPI zend_off_t _php_stream_tell(php_stream *stream);
|
||||
PHPAPI zend_off_t _php_stream_tell(const php_stream *stream);
|
||||
#define php_stream_tell(stream) _php_stream_tell((stream))
|
||||
|
||||
PHPAPI ssize_t _php_stream_read(php_stream *stream, char *buf, size_t count);
|
||||
|
|
|
@ -68,7 +68,7 @@ PHPAPI int php_stream_filter_register_factory_volatile(zend_string *filterpatter
|
|||
|
||||
/* Buckets */
|
||||
|
||||
PHPAPI php_stream_bucket *php_stream_bucket_new(php_stream *stream, char *buf, size_t buflen, uint8_t own_buf, uint8_t buf_persistent)
|
||||
PHPAPI php_stream_bucket *php_stream_bucket_new(const php_stream *stream, char *buf, size_t buflen, uint8_t own_buf, uint8_t buf_persistent)
|
||||
{
|
||||
int is_persistent = php_stream_is_persistent(stream);
|
||||
php_stream_bucket *bucket;
|
||||
|
|
|
@ -59,7 +59,7 @@ BEGIN_EXTERN_C()
|
|||
PHPAPI int php_le_stream_context(void);
|
||||
PHPAPI void php_stream_context_free(php_stream_context *context);
|
||||
PHPAPI php_stream_context *php_stream_context_alloc(void);
|
||||
PHPAPI zval *php_stream_context_get_option(php_stream_context *context,
|
||||
PHPAPI zval *php_stream_context_get_option(const php_stream_context *context,
|
||||
const char *wrappername, const char *optionname);
|
||||
PHPAPI void php_stream_context_set_option(php_stream_context *context,
|
||||
const char *wrappername, const char *optionname, zval *optionvalue);
|
||||
|
|
|
@ -63,7 +63,7 @@ typedef enum {
|
|||
|
||||
/* Buckets API. */
|
||||
BEGIN_EXTERN_C()
|
||||
PHPAPI php_stream_bucket *php_stream_bucket_new(php_stream *stream, char *buf, size_t buflen, uint8_t own_buf, uint8_t buf_persistent);
|
||||
PHPAPI php_stream_bucket *php_stream_bucket_new(const php_stream *stream, char *buf, size_t buflen, uint8_t own_buf, uint8_t buf_persistent);
|
||||
PHPAPI int php_stream_bucket_split(php_stream_bucket *in, php_stream_bucket **left, php_stream_bucket **right, size_t length);
|
||||
PHPAPI void php_stream_bucket_delref(php_stream_bucket *bucket);
|
||||
#define php_stream_bucket_addref(bucket) (bucket)->refcount++
|
||||
|
|
|
@ -1041,12 +1041,13 @@ PHPAPI char *_php_stream_get_line(php_stream *stream, char *buf, size_t maxlen,
|
|||
#define STREAM_BUFFERED_AMOUNT(stream) \
|
||||
((size_t)(((stream)->writepos) - (stream)->readpos))
|
||||
|
||||
static const char *_php_stream_search_delim(php_stream *stream,
|
||||
size_t maxlen,
|
||||
size_t skiplen,
|
||||
const char *delim, /* non-empty! */
|
||||
size_t delim_len)
|
||||
{
|
||||
static const char *_php_stream_search_delim(
|
||||
const php_stream *stream,
|
||||
size_t maxlen,
|
||||
size_t skiplen,
|
||||
const char *delim, /* non-empty! */
|
||||
size_t delim_len
|
||||
) {
|
||||
size_t seek_len;
|
||||
|
||||
/* set the maximum number of bytes we're allowed to read from buffer */
|
||||
|
@ -1340,7 +1341,7 @@ PHPAPI ssize_t _php_stream_printf(php_stream *stream, const char *fmt, ...)
|
|||
return count;
|
||||
}
|
||||
|
||||
PHPAPI zend_off_t _php_stream_tell(php_stream *stream)
|
||||
PHPAPI zend_off_t _php_stream_tell(const php_stream *stream)
|
||||
{
|
||||
return stream->position;
|
||||
}
|
||||
|
@ -1975,7 +1976,7 @@ PHPAPI zend_result php_unregister_url_stream_wrapper_volatile(zend_string *proto
|
|||
/* {{{ php_stream_locate_url_wrapper */
|
||||
PHPAPI php_stream_wrapper *php_stream_locate_url_wrapper(const char *path, const char **path_for_open, int options)
|
||||
{
|
||||
HashTable *wrapper_hash = (FG(stream_wrappers) ? FG(stream_wrappers) : &url_stream_wrappers_hash);
|
||||
const HashTable *wrapper_hash = (FG(stream_wrappers) ? FG(stream_wrappers) : &url_stream_wrappers_hash);
|
||||
php_stream_wrapper *wrapper = NULL;
|
||||
const char *p, *protocol = NULL;
|
||||
size_t n = 0;
|
||||
|
@ -2416,7 +2417,7 @@ PHPAPI void php_stream_notification_free(php_stream_notifier *notifier)
|
|||
efree(notifier);
|
||||
}
|
||||
|
||||
PHPAPI zval *php_stream_context_get_option(php_stream_context *context,
|
||||
PHPAPI zval *php_stream_context_get_option(const php_stream_context *context,
|
||||
const char *wrappername, const char *optionname)
|
||||
{
|
||||
zval *wrapperhash;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue