cvs: php4 /main main.c network.c php_network.h php_streams.h streams.c
| From: | Wez Furlong | Date: | Sat, 16 Mar 2002 01:58:14 +0000 |
| Subject: | cvs: php4 /main main.c network.c php_network.h php_streams.h streams.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-10200@lists.php.net to get a copy of this message | ||
wez Fri Mar 15 20:58:14 2002 EDT
Modified files:
/php4/main main.c network.c php_network.h php_streams.h streams.c
Log:
more *'s
Index: php4/main/main.c diff -u php4/main/main.c:1.432 php4/main/main.c:1.433 --- php4/main/main.c:1.432 Fri Mar 15 16:03:07 2002 +++ php4/main/main.c Fri Mar 15 20:58:13 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.432 2002/03/15 21:03:07 wez Exp $ */ +/* $Id: main.c,v 1.433 2002/03/16 01:58:13 wez Exp $ */ /* {{{ includes */ @@ -564,7 +564,7 @@ static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path) { FILE *retval = NULL; - php_stream * stream; + php_stream *stream; TSRMLS_FETCH(); stream = php_stream_open_wrapper((char *)filename, "rb", USE_PATH|IGNORE_URL_WIN|REPORT_ERRORS, opened_path TSRMLS_CC); Index: php4/main/network.c diff -u php4/main/network.c:1.31 php4/main/network.c:1.32 --- php4/main/network.c:1.31 Fri Mar 15 16:03:07 2002 +++ php4/main/network.c Fri Mar 15 20:58:13 2002 @@ -15,7 +15,7 @@ | Author: Stig Venaas <venaas@uninett.no> | +----------------------------------------------------------------------+ */ -/* $Id: network.c,v 1.31 2002/03/15 21:03:07 wez Exp $ */ +/* $Id: network.c,v 1.32 2002/03/16 01:58:13 wez Exp $ */ #define PHP_SOCK_CHUNK_SIZE 8192 #define MAX_CHUNKS_PER_READ 10 @@ -411,10 +411,10 @@ } /* }}} */ -PHPAPI php_stream * php_stream_sock_open_from_socket(int socket, int persistent) +PHPAPI php_stream *php_stream_sock_open_from_socket(int socket, int persistent) { - php_stream * stream; - php_netstream_data_t * sock; + php_stream *stream; + php_netstream_data_t *sock; sock = pemalloc(sizeof(php_netstream_data_t), persistent); memset(sock, 0, sizeof(php_netstream_data_t)); @@ -432,7 +432,7 @@ return stream; } -PHPAPI php_stream * php_stream_sock_open_host(const char * host, unsigned short port, +PHPAPI php_stream *php_stream_sock_open_host(const char *host, unsigned short port, int socktype, int timeout, int persistent) { int socket; @@ -445,7 +445,7 @@ return php_stream_sock_open_from_socket(socket, persistent); } -PHPAPI php_stream * php_stream_sock_open_unix(const char * path, int persistent, struct timeval * timeout) +PHPAPI php_stream *php_stream_sock_open_unix(const char *path, int persistent, struct timeval *timeout) { #if defined(AF_UNIX) int socketd; @@ -469,10 +469,10 @@ } #if HAVE_OPENSSL_EXT -PHPAPI int php_stream_sock_ssl_activate_with_method(php_stream * stream, int activate, SSL_METHOD * method) +PHPAPI int php_stream_sock_ssl_activate_with_method(php_stream *stream, int activate, SSL_METHOD *method) { - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; - SSL_CTX * ctx = NULL; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; + SSL_CTX *ctx = NULL; if (!php_stream_is(stream, PHP_STREAM_IS_SOCKET)) return FAILURE; @@ -509,9 +509,9 @@ } #endif -PHPAPI void php_stream_sock_set_timeout(php_stream * stream, struct timeval *timeout) +PHPAPI void php_stream_sock_set_timeout(php_stream *stream, struct timeval *timeout) { - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; if (!php_stream_is(stream, PHP_STREAM_IS_SOCKET)) return; @@ -520,10 +520,10 @@ sock->timeout_event = 0; } -PHPAPI int php_stream_sock_set_blocking(php_stream * stream, int mode) +PHPAPI int php_stream_sock_set_blocking(php_stream *stream, int mode) { int oldmode; - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; if (!php_stream_is(stream, PHP_STREAM_IS_SOCKET)) return 0; @@ -534,10 +534,10 @@ return oldmode; } -PHPAPI size_t php_stream_sock_set_chunk_size(php_stream * stream, size_t size) +PHPAPI size_t php_stream_sock_set_chunk_size(php_stream *stream, size_t size) { size_t oldsize; - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; if (!php_stream_is(stream, PHP_STREAM_IS_SOCKET)) return 0; @@ -552,16 +552,16 @@ #define READPTR(sock) ((sock)->readbuf + (sock)->readpos) #define WRITEPTR(sock) ((sock)->readbuf + (sock)->writepos) -static size_t php_sockop_write(php_stream * stream, const char * buf, size_t count) +static size_t php_sockop_write(php_stream *stream, const char *buf, size_t count) { - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; #if HAVE_OPENSSL_EXT if (sock->ssl_active) return SSL_write(sock->ssl_handle, buf, count); #endif return send(sock->socket, buf, count, 0); } -static void php_sock_stream_wait_for_data(php_stream * stream, php_netstream_data_t * sock) +static void php_sock_stream_wait_for_data(php_stream *stream, php_netstream_data_t *sock) { fd_set fdr, tfdr; int retval; @@ -590,7 +590,7 @@ } } -static size_t php_sock_stream_read_internal(php_stream * stream, php_netstream_data_t * sock) +static size_t php_sock_stream_read_internal(php_stream *stream, php_netstream_data_t *sock) { char buf[PHP_SOCK_CHUNK_SIZE]; int nr_bytes; @@ -634,7 +634,7 @@ } -static size_t php_sock_stream_read(php_stream * stream, php_netstream_data_t * sock) +static size_t php_sock_stream_read(php_stream *stream, php_netstream_data_t *sock) { size_t nr_bytes; size_t nr_read = 0; @@ -649,9 +649,9 @@ return nr_read; } -static size_t php_sockop_read(php_stream * stream, char * buf, size_t count) +static size_t php_sockop_read(php_stream *stream, char *buf, size_t count) { - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; size_t ret = 0; if (sock->is_blocked) { @@ -673,9 +673,9 @@ return ret; } -static int php_sockop_close(php_stream * stream) +static int php_sockop_close(php_stream *stream) { - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; #if HAVE_OPENSSL_EXT if (sock->ssl_active) { @@ -697,15 +697,15 @@ return 0; } -static int php_sockop_flush(php_stream * stream) +static int php_sockop_flush(php_stream *stream) { - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; return fsync(sock->socket); } -static int php_sockop_cast(php_stream * stream, int castas, void ** ret) +static int php_sockop_cast(php_stream *stream, int castas, void **ret) { - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; TSRMLS_FETCH(); switch(castas) { @@ -751,9 +751,9 @@ } while (0) -static char * php_sockop_gets(php_stream * stream, char *buf, size_t maxlen) +static char *php_sockop_gets(php_stream *stream, char *buf, size_t maxlen) { - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; char *p = NULL, *pe; char *ret = NULL; size_t amount = 0; Index: php4/main/php_network.h diff -u php4/main/php_network.h:1.13 php4/main/php_network.h:1.14 --- php4/main/php_network.h:1.13 Fri Mar 15 16:03:08 2002 +++ php4/main/php_network.h Fri Mar 15 20:58:13 2002 @@ -15,7 +15,7 @@ | Author: Stig Venaas <venaas@uninett.no> | +----------------------------------------------------------------------+ */ -/* $Id: php_network.h,v 1.13 2002/03/15 21:03:08 wez Exp $ */ +/* $Id: php_network.h,v 1.14 2002/03/16 01:58:13 wez Exp $ */ #ifndef _PHP_NETWORK_H #define _PHP_NETWORK_H @@ -82,7 +82,7 @@ char timeout_event; #if HAVE_OPENSSL_EXT /* openssl specific bits here */ - SSL * ssl_handle; + SSL *ssl_handle; int ssl_active; #endif }; @@ -93,19 +93,19 @@ extern php_stream_ops php_stream_socket_ops; #define PHP_STREAM_IS_SOCKET (&php_stream_socket_ops) -PHPAPI php_stream * php_stream_sock_open_from_socket(int socket, int persistent); +PHPAPI php_stream *php_stream_sock_open_from_socket(int socket, int persistent); /* open a connection to a host using php_hostconnect and return a stream */ -PHPAPI php_stream * php_stream_sock_open_host(const char * host, unsigned short port, +PHPAPI php_stream *php_stream_sock_open_host(const char *host, unsigned short port, int socktype, int timeout, int persistent); -PHPAPI php_stream * php_stream_sock_open_unix(const char * path, int persistent, struct timeval * timeout); +PHPAPI php_stream *php_stream_sock_open_unix(const char *path, int persistent, struct timeval *timeout); -PHPAPI void php_stream_sock_set_timeout(php_stream * stream, struct timeval *timeout); -PHPAPI int php_stream_sock_set_blocking(php_stream * stream, int mode); +PHPAPI void php_stream_sock_set_timeout(php_stream *stream, struct timeval *timeout); +PHPAPI int php_stream_sock_set_blocking(php_stream *stream, int mode); /* set the chunk size for the stream; return the old chunk size */ -PHPAPI size_t php_stream_sock_set_chunk_size(php_stream * stream, size_t size); +PHPAPI size_t php_stream_sock_set_chunk_size(php_stream *stream, size_t size); #if HAVE_OPENSSL_EXT -PHPAPI int php_stream_sock_ssl_activate_with_method(php_stream * stream, int activate, SSL_METHOD * method); +PHPAPI int php_stream_sock_ssl_activate_with_method(php_stream *stream, int activate, SSL_METHOD *method); #define php_stream_sock_ssl_activate(stream, activate) php_stream_sock_ssl_activate_with_method((stream), (activate), SSLv23_client_method()) #endif Index: php4/main/php_streams.h diff -u php4/main/php_streams.h:1.8 php4/main/php_streams.h:1.9 --- php4/main/php_streams.h:1.8 Fri Mar 15 19:13:46 2002 +++ php4/main/php_streams.h Fri Mar 15 20:58:13 2002 @@ -35,13 +35,13 @@ int (*flush)(php_stream *stream); /* these are optional */ int (*seek)(php_stream *stream, off_t offset, int whence); - char * (*gets)(php_stream *stream, char *buf, size_t size); + char *(*gets)(php_stream *stream, char *buf, size_t size); int (*cast)(php_stream *stream, int castas, void **ret); const char *label; /* label for this ops structure */ } php_stream_ops; /* options uses the IGNORE_URL family of defines from fopen_wrappers.h */ -typedef php_stream * (*php_stream_factory_func_t)(char *filename, char *mode, int options, char ** opened_path TSRMLS_DC); +typedef php_stream *(*php_stream_factory_func_t)(char *filename, char *mode, int options, char **opened_path TSRMLS_DC); typedef void (*php_stream_wrapper_dtor_func_t)(php_stream *stream); typedef struct _php_stream_wrapper { @@ -102,12 +102,12 @@ /* operations for a stdio FILE; use the php_stream_fopen_XXX funcs below */ extern php_stream_ops php_stream_stdio_ops; /* like fopen, but returns a stream */ -PHPAPI php_stream * php_stream_fopen(const char *filename, const char *mode, char **opened_path TSRMLS_DC); -PHPAPI php_stream * php_stream_fopen_with_path(char *filename, char * mode, char *path, char **opened_path TSRMLS_DC); -PHPAPI php_stream * php_stream_fopen_from_file(FILE *file, const char *mode); -PHPAPI php_stream * php_stream_fopen_from_pipe(FILE *file, const char *mode); -PHPAPI php_stream * php_stream_fopen_tmpfile(void); -PHPAPI php_stream * php_stream_fopen_temporary_file(const char *dir, const char *pfx, char **opened_path TSRMLS_DC); +PHPAPI php_stream *php_stream_fopen(const char *filename, const char *mode, char **opened_path TSRMLS_DC); +PHPAPI php_stream *php_stream_fopen_with_path(char *filename, char *mode, char *path, char **opened_path TSRMLS_DC); +PHPAPI php_stream *php_stream_fopen_from_file(FILE *file, const char *mode); +PHPAPI php_stream *php_stream_fopen_from_pipe(FILE *file, const char *mode); +PHPAPI php_stream *php_stream_fopen_tmpfile(void); +PHPAPI php_stream *php_stream_fopen_temporary_file(const char *dir, const char *pfx, char **opened_path TSRMLS_DC); /* coerce the stream into some other form */ /* cast as a stdio FILE * */ @@ -125,7 +125,7 @@ #define php_stream_can_cast(stream, as) php_stream_cast(stream, as, NULL, 0) /* use this to check if a stream is of a particular type: - * PHPAPI int php_stream_is(php_stream *stream, php_stream_ops * ops); */ + * PHPAPI int php_stream_is(php_stream *stream, php_stream_ops *ops); */ #define php_stream_is(stream, anops) ((stream)->ops == anops) #define PHP_STREAM_IS_STDIO &php_stream_stdio_ops @@ -137,7 +137,7 @@ PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC); PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC); -PHPAPI php_stream * php_stream_open_wrapper(char * path, char *mode, int options, char **opened_path TSRMLS_DC); +PHPAPI php_stream *php_stream_open_wrapper(char *path, char *mode, int options, char **opened_path TSRMLS_DC); #endif Index: php4/main/streams.c diff -u php4/main/streams.c:1.11 php4/main/streams.c:1.12 --- php4/main/streams.c:1.11 Fri Mar 15 19:05:47 2002 +++ php4/main/streams.c Fri Mar 15 20:58:13 2002 @@ -44,7 +44,7 @@ static HashTable url_stream_wrappers_hash; /* allocate a new stream for a particular ops */ -PHPAPI php_stream *php_stream_alloc(php_stream_ops *ops, void *abstract, int persistent, const char * mode) /* {{{ */ +PHPAPI php_stream *php_stream_alloc(php_stream_ops *ops, void *abstract, int persistent, const char *mode) /* {{{ */ { php_stream *ret; @@ -162,7 +162,7 @@ } else { /* unbuffered fgets - poor performance ! */ size_t n = 0; - char * c = buf; + char *c = buf; /* TODO: look at error returns? */ @@ -227,7 +227,7 @@ PHPAPI size_t php_stream_read_all(php_stream *src, char **buf, int persistent) { size_t ret = 0; - char * ptr; + char *ptr; size_t len = 0, max_len; int step = CHUNK_SIZE; int min_room = CHUNK_SIZE / 4; @@ -247,7 +247,7 @@ struct stat sbuf; if (fstat(srcfd, &sbuf) == 0) { - void * srcfile; + void *srcfile; srcfile = mmap(NULL, sbuf.st_size, PROT_READ, MAP_SHARED, srcfd, 0); if (srcfile != (void*)MAP_FAILED) { @@ -309,7 +309,7 @@ struct stat sbuf; if (fstat(srcfd, &sbuf) == 0) { - void * srcfile; + void *srcfile; srcfile = mmap(NULL, sbuf.st_size, PROT_READ, MAP_SHARED, srcfd, 0); if (srcfile != (void*)MAP_FAILED) { @@ -366,7 +366,7 @@ /* {{{ ------- STDIO stream implementation -------*/ typedef struct { - FILE * file; + FILE *file; int is_pipe; /* use pclose */ #if HAVE_FLUSHIO char last_op; @@ -433,7 +433,7 @@ } static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count) { - php_stdio_stream_data * data = (php_stdio_stream_data*)stream->abstract; + php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract; #if HAVE_FLUSHIO if (data->last_op == 'r') { @@ -447,7 +447,7 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count) { - php_stdio_stream_data * ata = (php_stdio_stream_data*)stream->abstract; + php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract; if (buf == NULL && count == 0) { /* check for EOF condition */ @@ -700,7 +700,7 @@ } static int stream_cookie_closer(void *cookie) { - php_stream * stream = (php_stream*)cookie; + php_stream *stream = (php_stream*)cookie; /* prevent recursion */ stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE; return php_stream_close(stream); @@ -768,7 +768,7 @@ exit_fail: if (show_err) { /* these names depend on the values of the PHP_STREAM_AS_XXX defines in php_streams.h */ - static const char * cast_names[3] = { + static const char *cast_names[3] = { "STDIO FILE*", "File Descriptor", "Socket Descriptor" }; TSRMLS_FETCH(); @@ -817,7 +817,7 @@ return SUCCESS; } -static php_stream * php_stream_open_url(char *path, char *mode, int options, char **opened_path TSRMLS_DC) +static php_stream *php_stream_open_url(char *path, char *mode, int options, char **opened_path TSRMLS_DC) { php_stream_wrapper *wrapper; const char *p, *protocol = NULL; @@ -837,7 +837,7 @@ protocol = NULL; } if (wrapper) { - php_stream * stream = wrapper->create(path, mode, options, opened_path TSRMLS_CC); + php_stream *stream = wrapper->create(path, mode, options, opened_path TSRMLS_CC); if (stream) stream->wrapper = wrapper; return stream; @@ -859,7 +859,7 @@ return NULL; } -PHPAPI php_stream *php_stream_open_wrapper(char *path, char *mode, int options, char ** opened_path TSRMLS_DC) +PHPAPI php_stream *php_stream_open_wrapper(char *path, char *mode, int options, char **opened_path TSRMLS_DC) { php_stream *stream = NULL; @@ -885,7 +885,7 @@ stream = php_stream_fopen(path, mode, opened_path TSRMLS_CC); out: if (stream == NULL && (options & REPORT_ERRORS)) { - char * tmp = estrdup(path); + char *tmp = estrdup(path); php_strip_url_passwd(tmp); zend_error(E_WARNING, "%s(\"%s\") - %s", get_active_function_name(TSRMLS_CC), tmp, strerror(errno)); efree(tmp);
Index: php4/main/main.c diff -u php4/main/main.c:1.432 php4/main/main.c:1.433 --- php4/main/main.c:1.432 Fri Mar 15 16:03:07 2002 +++ php4/main/main.c Fri Mar 15 20:58:13 2002 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: main.c,v 1.432 2002/03/15 21:03:07 wez Exp $ */ +/* $Id: main.c,v 1.433 2002/03/16 01:58:13 wez Exp $ */ /* {{{ includes */ @@ -564,7 +564,7 @@ static FILE *php_fopen_wrapper_for_zend(const char *filename, char **opened_path) { FILE *retval = NULL; - php_stream * stream; + php_stream *stream; TSRMLS_FETCH(); stream = php_stream_open_wrapper((char *)filename, "rb", USE_PATH|IGNORE_URL_WIN|REPORT_ERRORS, opened_path TSRMLS_CC); Index: php4/main/network.c diff -u php4/main/network.c:1.31 php4/main/network.c:1.32 --- php4/main/network.c:1.31 Fri Mar 15 16:03:07 2002 +++ php4/main/network.c Fri Mar 15 20:58:13 2002 @@ -15,7 +15,7 @@ | Author: Stig Venaas <venaas@uninett.no> | +----------------------------------------------------------------------+ */ -/* $Id: network.c,v 1.31 2002/03/15 21:03:07 wez Exp $ */ +/* $Id: network.c,v 1.32 2002/03/16 01:58:13 wez Exp $ */ #define PHP_SOCK_CHUNK_SIZE 8192 #define MAX_CHUNKS_PER_READ 10 @@ -411,10 +411,10 @@ } /* }}} */ -PHPAPI php_stream * php_stream_sock_open_from_socket(int socket, int persistent) +PHPAPI php_stream *php_stream_sock_open_from_socket(int socket, int persistent) { - php_stream * stream; - php_netstream_data_t * sock; + php_stream *stream; + php_netstream_data_t *sock; sock = pemalloc(sizeof(php_netstream_data_t), persistent); memset(sock, 0, sizeof(php_netstream_data_t)); @@ -432,7 +432,7 @@ return stream; } -PHPAPI php_stream * php_stream_sock_open_host(const char * host, unsigned short port, +PHPAPI php_stream *php_stream_sock_open_host(const char *host, unsigned short port, int socktype, int timeout, int persistent) { int socket; @@ -445,7 +445,7 @@ return php_stream_sock_open_from_socket(socket, persistent); } -PHPAPI php_stream * php_stream_sock_open_unix(const char * path, int persistent, struct timeval * timeout) +PHPAPI php_stream *php_stream_sock_open_unix(const char *path, int persistent, struct timeval *timeout) { #if defined(AF_UNIX) int socketd; @@ -469,10 +469,10 @@ } #if HAVE_OPENSSL_EXT -PHPAPI int php_stream_sock_ssl_activate_with_method(php_stream * stream, int activate, SSL_METHOD * method) +PHPAPI int php_stream_sock_ssl_activate_with_method(php_stream *stream, int activate, SSL_METHOD *method) { - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; - SSL_CTX * ctx = NULL; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; + SSL_CTX *ctx = NULL; if (!php_stream_is(stream, PHP_STREAM_IS_SOCKET)) return FAILURE; @@ -509,9 +509,9 @@ } #endif -PHPAPI void php_stream_sock_set_timeout(php_stream * stream, struct timeval *timeout) +PHPAPI void php_stream_sock_set_timeout(php_stream *stream, struct timeval *timeout) { - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; if (!php_stream_is(stream, PHP_STREAM_IS_SOCKET)) return; @@ -520,10 +520,10 @@ sock->timeout_event = 0; } -PHPAPI int php_stream_sock_set_blocking(php_stream * stream, int mode) +PHPAPI int php_stream_sock_set_blocking(php_stream *stream, int mode) { int oldmode; - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; if (!php_stream_is(stream, PHP_STREAM_IS_SOCKET)) return 0; @@ -534,10 +534,10 @@ return oldmode; } -PHPAPI size_t php_stream_sock_set_chunk_size(php_stream * stream, size_t size) +PHPAPI size_t php_stream_sock_set_chunk_size(php_stream *stream, size_t size) { size_t oldsize; - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; if (!php_stream_is(stream, PHP_STREAM_IS_SOCKET)) return 0; @@ -552,16 +552,16 @@ #define READPTR(sock) ((sock)->readbuf + (sock)->readpos) #define WRITEPTR(sock) ((sock)->readbuf + (sock)->writepos) -static size_t php_sockop_write(php_stream * stream, const char * buf, size_t count) +static size_t php_sockop_write(php_stream *stream, const char *buf, size_t count) { - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; #if HAVE_OPENSSL_EXT if (sock->ssl_active) return SSL_write(sock->ssl_handle, buf, count); #endif return send(sock->socket, buf, count, 0); } -static void php_sock_stream_wait_for_data(php_stream * stream, php_netstream_data_t * sock) +static void php_sock_stream_wait_for_data(php_stream *stream, php_netstream_data_t *sock) { fd_set fdr, tfdr; int retval; @@ -590,7 +590,7 @@ } } -static size_t php_sock_stream_read_internal(php_stream * stream, php_netstream_data_t * sock) +static size_t php_sock_stream_read_internal(php_stream *stream, php_netstream_data_t *sock) { char buf[PHP_SOCK_CHUNK_SIZE]; int nr_bytes; @@ -634,7 +634,7 @@ } -static size_t php_sock_stream_read(php_stream * stream, php_netstream_data_t * sock) +static size_t php_sock_stream_read(php_stream *stream, php_netstream_data_t *sock) { size_t nr_bytes; size_t nr_read = 0; @@ -649,9 +649,9 @@ return nr_read; } -static size_t php_sockop_read(php_stream * stream, char * buf, size_t count) +static size_t php_sockop_read(php_stream *stream, char *buf, size_t count) { - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; size_t ret = 0; if (sock->is_blocked) { @@ -673,9 +673,9 @@ return ret; } -static int php_sockop_close(php_stream * stream) +static int php_sockop_close(php_stream *stream) { - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; #if HAVE_OPENSSL_EXT if (sock->ssl_active) { @@ -697,15 +697,15 @@ return 0; } -static int php_sockop_flush(php_stream * stream) +static int php_sockop_flush(php_stream *stream) { - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; return fsync(sock->socket); } -static int php_sockop_cast(php_stream * stream, int castas, void ** ret) +static int php_sockop_cast(php_stream *stream, int castas, void **ret) { - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; TSRMLS_FETCH(); switch(castas) { @@ -751,9 +751,9 @@ } while (0) -static char * php_sockop_gets(php_stream * stream, char *buf, size_t maxlen) +static char *php_sockop_gets(php_stream *stream, char *buf, size_t maxlen) { - php_netstream_data_t * sock = (php_netstream_data_t*)stream->abstract; + php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; char *p = NULL, *pe; char *ret = NULL; size_t amount = 0; Index: php4/main/php_network.h diff -u php4/main/php_network.h:1.13 php4/main/php_network.h:1.14 --- php4/main/php_network.h:1.13 Fri Mar 15 16:03:08 2002 +++ php4/main/php_network.h Fri Mar 15 20:58:13 2002 @@ -15,7 +15,7 @@ | Author: Stig Venaas <venaas@uninett.no> | +----------------------------------------------------------------------+ */ -/* $Id: php_network.h,v 1.13 2002/03/15 21:03:08 wez Exp $ */ +/* $Id: php_network.h,v 1.14 2002/03/16 01:58:13 wez Exp $ */ #ifndef _PHP_NETWORK_H #define _PHP_NETWORK_H @@ -82,7 +82,7 @@ char timeout_event; #if HAVE_OPENSSL_EXT /* openssl specific bits here */ - SSL * ssl_handle; + SSL *ssl_handle; int ssl_active; #endif }; @@ -93,19 +93,19 @@ extern php_stream_ops php_stream_socket_ops; #define PHP_STREAM_IS_SOCKET (&php_stream_socket_ops) -PHPAPI php_stream * php_stream_sock_open_from_socket(int socket, int persistent); +PHPAPI php_stream *php_stream_sock_open_from_socket(int socket, int persistent); /* open a connection to a host using php_hostconnect and return a stream */ -PHPAPI php_stream * php_stream_sock_open_host(const char * host, unsigned short port, +PHPAPI php_stream *php_stream_sock_open_host(const char *host, unsigned short port, int socktype, int timeout, int persistent); -PHPAPI php_stream * php_stream_sock_open_unix(const char * path, int persistent, struct timeval * timeout); +PHPAPI php_stream *php_stream_sock_open_unix(const char *path, int persistent, struct timeval *timeout); -PHPAPI void php_stream_sock_set_timeout(php_stream * stream, struct timeval *timeout); -PHPAPI int php_stream_sock_set_blocking(php_stream * stream, int mode); +PHPAPI void php_stream_sock_set_timeout(php_stream *stream, struct timeval *timeout); +PHPAPI int php_stream_sock_set_blocking(php_stream *stream, int mode); /* set the chunk size for the stream; return the old chunk size */ -PHPAPI size_t php_stream_sock_set_chunk_size(php_stream * stream, size_t size); +PHPAPI size_t php_stream_sock_set_chunk_size(php_stream *stream, size_t size); #if HAVE_OPENSSL_EXT -PHPAPI int php_stream_sock_ssl_activate_with_method(php_stream * stream, int activate, SSL_METHOD * method); +PHPAPI int php_stream_sock_ssl_activate_with_method(php_stream *stream, int activate, SSL_METHOD *method); #define php_stream_sock_ssl_activate(stream, activate) php_stream_sock_ssl_activate_with_method((stream), (activate), SSLv23_client_method()) #endif Index: php4/main/php_streams.h diff -u php4/main/php_streams.h:1.8 php4/main/php_streams.h:1.9 --- php4/main/php_streams.h:1.8 Fri Mar 15 19:13:46 2002 +++ php4/main/php_streams.h Fri Mar 15 20:58:13 2002 @@ -35,13 +35,13 @@ int (*flush)(php_stream *stream); /* these are optional */ int (*seek)(php_stream *stream, off_t offset, int whence); - char * (*gets)(php_stream *stream, char *buf, size_t size); + char *(*gets)(php_stream *stream, char *buf, size_t size); int (*cast)(php_stream *stream, int castas, void **ret); const char *label; /* label for this ops structure */ } php_stream_ops; /* options uses the IGNORE_URL family of defines from fopen_wrappers.h */ -typedef php_stream * (*php_stream_factory_func_t)(char *filename, char *mode, int options, char ** opened_path TSRMLS_DC); +typedef php_stream *(*php_stream_factory_func_t)(char *filename, char *mode, int options, char **opened_path TSRMLS_DC); typedef void (*php_stream_wrapper_dtor_func_t)(php_stream *stream); typedef struct _php_stream_wrapper { @@ -102,12 +102,12 @@ /* operations for a stdio FILE; use the php_stream_fopen_XXX funcs below */ extern php_stream_ops php_stream_stdio_ops; /* like fopen, but returns a stream */ -PHPAPI php_stream * php_stream_fopen(const char *filename, const char *mode, char **opened_path TSRMLS_DC); -PHPAPI php_stream * php_stream_fopen_with_path(char *filename, char * mode, char *path, char **opened_path TSRMLS_DC); -PHPAPI php_stream * php_stream_fopen_from_file(FILE *file, const char *mode); -PHPAPI php_stream * php_stream_fopen_from_pipe(FILE *file, const char *mode); -PHPAPI php_stream * php_stream_fopen_tmpfile(void); -PHPAPI php_stream * php_stream_fopen_temporary_file(const char *dir, const char *pfx, char **opened_path TSRMLS_DC); +PHPAPI php_stream *php_stream_fopen(const char *filename, const char *mode, char **opened_path TSRMLS_DC); +PHPAPI php_stream *php_stream_fopen_with_path(char *filename, char *mode, char *path, char **opened_path TSRMLS_DC); +PHPAPI php_stream *php_stream_fopen_from_file(FILE *file, const char *mode); +PHPAPI php_stream *php_stream_fopen_from_pipe(FILE *file, const char *mode); +PHPAPI php_stream *php_stream_fopen_tmpfile(void); +PHPAPI php_stream *php_stream_fopen_temporary_file(const char *dir, const char *pfx, char **opened_path TSRMLS_DC); /* coerce the stream into some other form */ /* cast as a stdio FILE * */ @@ -125,7 +125,7 @@ #define php_stream_can_cast(stream, as) php_stream_cast(stream, as, NULL, 0) /* use this to check if a stream is of a particular type: - * PHPAPI int php_stream_is(php_stream *stream, php_stream_ops * ops); */ + * PHPAPI int php_stream_is(php_stream *stream, php_stream_ops *ops); */ #define php_stream_is(stream, anops) ((stream)->ops == anops) #define PHP_STREAM_IS_STDIO &php_stream_stdio_ops @@ -137,7 +137,7 @@ PHPAPI int php_register_url_stream_wrapper(char *protocol, php_stream_wrapper *wrapper TSRMLS_DC); PHPAPI int php_unregister_url_stream_wrapper(char *protocol TSRMLS_DC); -PHPAPI php_stream * php_stream_open_wrapper(char * path, char *mode, int options, char **opened_path TSRMLS_DC); +PHPAPI php_stream *php_stream_open_wrapper(char *path, char *mode, int options, char **opened_path TSRMLS_DC); #endif Index: php4/main/streams.c diff -u php4/main/streams.c:1.11 php4/main/streams.c:1.12 --- php4/main/streams.c:1.11 Fri Mar 15 19:05:47 2002 +++ php4/main/streams.c Fri Mar 15 20:58:13 2002 @@ -44,7 +44,7 @@ static HashTable url_stream_wrappers_hash; /* allocate a new stream for a particular ops */ -PHPAPI php_stream *php_stream_alloc(php_stream_ops *ops, void *abstract, int persistent, const char * mode) /* {{{ */ +PHPAPI php_stream *php_stream_alloc(php_stream_ops *ops, void *abstract, int persistent, const char *mode) /* {{{ */ { php_stream *ret; @@ -162,7 +162,7 @@ } else { /* unbuffered fgets - poor performance ! */ size_t n = 0; - char * c = buf; + char *c = buf; /* TODO: look at error returns? */ @@ -227,7 +227,7 @@ PHPAPI size_t php_stream_read_all(php_stream *src, char **buf, int persistent) { size_t ret = 0; - char * ptr; + char *ptr; size_t len = 0, max_len; int step = CHUNK_SIZE; int min_room = CHUNK_SIZE / 4; @@ -247,7 +247,7 @@ struct stat sbuf; if (fstat(srcfd, &sbuf) == 0) { - void * srcfile; + void *srcfile; srcfile = mmap(NULL, sbuf.st_size, PROT_READ, MAP_SHARED, srcfd, 0); if (srcfile != (void*)MAP_FAILED) { @@ -309,7 +309,7 @@ struct stat sbuf; if (fstat(srcfd, &sbuf) == 0) { - void * srcfile; + void *srcfile; srcfile = mmap(NULL, sbuf.st_size, PROT_READ, MAP_SHARED, srcfd, 0); if (srcfile != (void*)MAP_FAILED) { @@ -366,7 +366,7 @@ /* {{{ ------- STDIO stream implementation -------*/ typedef struct { - FILE * file; + FILE *file; int is_pipe; /* use pclose */ #if HAVE_FLUSHIO char last_op; @@ -433,7 +433,7 @@ } static size_t php_stdiop_write(php_stream *stream, const char *buf, size_t count) { - php_stdio_stream_data * data = (php_stdio_stream_data*)stream->abstract; + php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract; #if HAVE_FLUSHIO if (data->last_op == 'r') { @@ -447,7 +447,7 @@ static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count) { - php_stdio_stream_data * ata = (php_stdio_stream_data*)stream->abstract; + php_stdio_stream_data *data = (php_stdio_stream_data*)stream->abstract; if (buf == NULL && count == 0) { /* check for EOF condition */ @@ -700,7 +700,7 @@ } static int stream_cookie_closer(void *cookie) { - php_stream * stream = (php_stream*)cookie; + php_stream *stream = (php_stream*)cookie; /* prevent recursion */ stream->fclose_stdiocast = PHP_STREAM_FCLOSE_NONE; return php_stream_close(stream); @@ -768,7 +768,7 @@ exit_fail: if (show_err) { /* these names depend on the values of the PHP_STREAM_AS_XXX defines in php_streams.h */ - static const char * cast_names[3] = { + static const char *cast_names[3] = { "STDIO FILE*", "File Descriptor", "Socket Descriptor" }; TSRMLS_FETCH(); @@ -817,7 +817,7 @@ return SUCCESS; } -static php_stream * php_stream_open_url(char *path, char *mode, int options, char **opened_path TSRMLS_DC) +static php_stream *php_stream_open_url(char *path, char *mode, int options, char **opened_path TSRMLS_DC) { php_stream_wrapper *wrapper; const char *p, *protocol = NULL; @@ -837,7 +837,7 @@ protocol = NULL; } if (wrapper) { - php_stream * stream = wrapper->create(path, mode, options, opened_path TSRMLS_CC); + php_stream *stream = wrapper->create(path, mode, options, opened_path TSRMLS_CC); if (stream) stream->wrapper = wrapper; return stream; @@ -859,7 +859,7 @@ return NULL; } -PHPAPI php_stream *php_stream_open_wrapper(char *path, char *mode, int options, char ** opened_path TSRMLS_DC) +PHPAPI php_stream *php_stream_open_wrapper(char *path, char *mode, int options, char **opened_path TSRMLS_DC) { php_stream *stream = NULL; @@ -885,7 +885,7 @@ stream = php_stream_fopen(path, mode, opened_path TSRMLS_CC); out: if (stream == NULL && (options & REPORT_ERRORS)) { - char * tmp = estrdup(path); + char *tmp = estrdup(path); php_strip_url_passwd(tmp); zend_error(E_WARNING, "%s(\"%s\") - %s", get_active_function_name(TSRMLS_CC), tmp, strerror(errno)); efree(tmp);