diff options
Diffstat (limited to 'sapi/cli/php_cli_server.c')
-rw-r--r-- | sapi/cli/php_cli_server.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 64cca0eb6f..5087b68a98 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -138,7 +138,7 @@ typedef struct php_cli_server_request { size_t content_len; const char *ext; size_t ext_len; - struct stat sb; + php_stat_t sb; } php_cli_server_request; typedef struct php_cli_server_chunk { @@ -482,7 +482,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */ php_cli_server_client *client; HashTable *headers; char *key; - uint key_len; + php_size_t key_len; char **value_pointer; HashPosition pos; @@ -507,7 +507,7 @@ PHP_FUNCTION(apache_request_headers) /* {{{ */ static void add_response_header(sapi_header_struct *h, zval *return_value TSRMLS_DC) /* {{{ */ { char *s, *p; - int len; + ptrdiff_t len; ALLOCA_FLAG(use_heap) if (h->header_len > 0) { @@ -610,7 +610,7 @@ static int sapi_cli_server_startup(sapi_module_struct *sapi_module) /* {{{ */ return SUCCESS; } /* }}} */ -static int sapi_cli_server_ub_write(const char *str, uint str_length TSRMLS_DC) /* {{{ */ +static php_size_t sapi_cli_server_ub_write(const char *str, php_size_t str_length TSRMLS_DC) /* {{{ */ { php_cli_server_client *client = SG(server_context); if (!client) { @@ -692,7 +692,7 @@ static char *sapi_cli_server_read_cookies(TSRMLS_D) /* {{{ */ return *val; } /* }}} */ -static int sapi_cli_server_read_post(char *buf, uint count_bytes TSRMLS_DC) /* {{{ */ +static php_size_t sapi_cli_server_read_post(char *buf, php_size_t count_bytes TSRMLS_DC) /* {{{ */ { php_cli_server_client *client = SG(server_context); if (client->request.content) { @@ -708,7 +708,7 @@ static int sapi_cli_server_read_post(char *buf, uint count_bytes TSRMLS_DC) /* { static void sapi_cli_server_register_variable(zval *track_vars_array, const char *key, const char *val TSRMLS_DC) /* {{{ */ { char *new_val = (char *)val; - uint new_val_len; + php_size_t new_val_len; if (sapi_module.input_filter(PARSE_SERVER, (char*)key, &new_val, strlen(val), &new_val_len TSRMLS_CC)) { php_register_variable_safe((char *)key, new_val, new_val_len, track_vars_array TSRMLS_CC); } @@ -862,7 +862,7 @@ static int php_cli_server_poller_ctor(php_cli_server_poller *poller) /* {{{ */ return SUCCESS; } /* }}} */ -static void php_cli_server_poller_add(php_cli_server_poller *poller, int mode, int fd) /* {{{ */ +static void php_cli_server_poller_add(php_cli_server_poller *poller, int mode, php_socket_t fd) /* {{{ */ { if (mode & POLLIN) { PHP_SAFE_FD_SET(fd, &poller->rfds); @@ -875,7 +875,7 @@ static void php_cli_server_poller_add(php_cli_server_poller *poller, int mode, i } } /* }}} */ -static void php_cli_server_poller_remove(php_cli_server_poller *poller, int mode, int fd) /* {{{ */ +static void php_cli_server_poller_remove(php_cli_server_poller *poller, int mode, php_socket_t fd) /* {{{ */ { if (mode & POLLIN) { PHP_SAFE_FD_CLR(fd, &poller->rfds); @@ -903,7 +903,7 @@ static int php_cli_server_poller_poll(php_cli_server_poller *poller, struct time return php_select(poller->max_fd + 1, &poller->active.rfds, &poller->active.wfds, NULL, tv); } /* }}} */ -static int php_cli_server_poller_iter_on_active(php_cli_server_poller *poller, void *opaque, int(*callback)(void *, int fd, int events)) /* {{{ */ +static int php_cli_server_poller_iter_on_active(php_cli_server_poller *poller, void *opaque, int(*callback)(void *, php_socket_t fd, int events)) /* {{{ */ { int retval = SUCCESS; #ifdef PHP_WIN32 @@ -1105,7 +1105,7 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender *sen switch (chunk->type) { case PHP_CLI_SERVER_CHUNK_HEAP: - nbytes_sent = send(fd, chunk->data.heap.p, chunk->data.heap.len, 0); + nbytes_sent = send(fd, chunk->data.heap.p, chunk->data.heap.len, 0); /* XXX on windows len is int */ if (nbytes_sent < 0) { *nbytes_sent_total = _nbytes_sent_total; return php_socket_errno(); @@ -1281,9 +1281,9 @@ static void php_cli_server_logf(const char *format TSRMLS_DC, ...) /* {{{ */ efree(buf); } /* }}} */ -static int php_network_listen_socket(const char *host, int *port, int socktype, int *af, socklen_t *socklen, char **errstr TSRMLS_DC) /* {{{ */ +static php_socket_t php_network_listen_socket(const char *host, int *port, int socktype, int *af, socklen_t *socklen, char **errstr TSRMLS_DC) /* {{{ */ { - int retval = SOCK_ERR; + php_socket_t retval = SOCK_ERR; int err = 0; struct sockaddr *sa = NULL, **p, **sal; @@ -1451,7 +1451,7 @@ static void php_cli_server_request_dtor(php_cli_server_request *req) /* {{{ */ static void php_cli_server_request_translate_vpath(php_cli_server_request *request, const char *document_root, size_t document_root_len) /* {{{ */ { - struct stat sb; + php_stat_t sb; static const char *index_files[] = { "index.php", "index.html", NULL }; char *buf = safe_pemalloc(1, request->vpath_len, 1 + document_root_len + 1 + sizeof("index.html"), 1); char *p = buf, *prev_path = NULL, *q, *vpath; @@ -1488,7 +1488,7 @@ static void php_cli_server_request_translate_vpath(php_cli_server_request *reque *p = '\0'; q = p; while (q > buf) { - if (!stat(buf, &sb)) { + if (!php_stat_fn(buf, &sb)) { if (sb.st_mode & S_IFDIR) { const char **file = index_files; if (q[-1] != DEFAULT_SLASH) { @@ -1497,7 +1497,7 @@ static void php_cli_server_request_translate_vpath(php_cli_server_request *reque while (*file) { size_t l = strlen(*file); memmove(q, *file, l + 1); - if (!stat(buf, &sb) && (sb.st_mode & S_IFREG)) { + if (!php_stat_fn(buf, &sb) && (sb.st_mode & S_IFREG)) { q += l; break; } @@ -1856,7 +1856,7 @@ static void destroy_request_info(sapi_request_info *request_info) /* {{{ */ { } /* }}} */ -static int php_cli_server_client_ctor(php_cli_server_client *client, php_cli_server *server, int client_sock, struct sockaddr *addr, socklen_t addr_len TSRMLS_DC) /* {{{ */ +static int php_cli_server_client_ctor(php_cli_server_client *client, php_cli_server *server, php_socket_t client_sock, struct sockaddr *addr, socklen_t addr_len TSRMLS_DC) /* {{{ */ { client->server = server; client->sock = client_sock; @@ -1864,7 +1864,7 @@ static int php_cli_server_client_ctor(php_cli_server_client *client, php_cli_ser client->addr_len = addr_len; { char *addr_str = 0; - long addr_str_len = 0; + php_size_t addr_str_len = 0; php_network_populate_name_from_sockaddr(addr, addr_len, &addr_str, &addr_str_len, NULL, 0 TSRMLS_CC); client->addr_str = pestrndup(addr_str, addr_str_len, 1); client->addr_str_len = addr_str_len; @@ -2131,7 +2131,7 @@ static int php_cli_server_dispatch_router(php_cli_server *server, php_cli_server zval *retval = NULL; if (SUCCESS == zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, &retval, 1, &zfd)) { if (retval) { - decline = Z_TYPE_P(retval) == IS_BOOL && !Z_LVAL_P(retval); + decline = Z_TYPE_P(retval) == IS_BOOL && !Z_IVAL_P(retval); zval_ptr_dtor(&retval); } } else { @@ -2405,7 +2405,7 @@ typedef struct php_cli_server_do_event_for_each_fd_callback_params { int(*whandler)(php_cli_server*, php_cli_server_client* TSRMLS_DC); } php_cli_server_do_event_for_each_fd_callback_params; -static int php_cli_server_do_event_for_each_fd_callback(void *_params, int fd, int event) /* {{{ */ +static int php_cli_server_do_event_for_each_fd_callback(void *_params, php_socket_t fd, int event) /* {{{ */ { php_cli_server_do_event_for_each_fd_callback_params *params = _params; #ifdef ZTS @@ -2531,9 +2531,9 @@ int do_cli_server(int argc, char **argv TSRMLS_DC) /* {{{ */ } if (document_root) { - struct stat sb; + php_stat_t sb; - if (stat(document_root, &sb)) { + if (php_stat_fn(document_root, &sb)) { fprintf(stderr, "Directory %s does not exist.\n", document_root); return 1; } |