]> granicus.if.org Git - php/commitdiff
Fixed compilation warnings
authorDmitry Stogov <dmitry@zend.com>
Tue, 21 Jun 2016 14:56:07 +0000 (17:56 +0300)
committerDmitry Stogov <dmitry@zend.com>
Tue, 21 Jun 2016 14:56:07 +0000 (17:56 +0300)
12 files changed:
main/SAPI.h
main/fastcgi.c
main/fastcgi.h
sapi/cgi/cgi_main.c
sapi/cli/php_cli.c
sapi/cli/php_cli_server.c
sapi/cli/php_http_parser.c
sapi/fpm/fpm/fpm_conf.c
sapi/fpm/fpm/fpm_main.c
sapi/fpm/fpm/fpm_scoreboard.c
sapi/fpm/fpm/fpm_status.c
sapi/litespeed/lsapi_main.c

index d9163729a5b117bc2350f03104ab9d751c265ac4..d52835b7b13ea378c12f40a2ad7d243cc4ff3a34 100644 (file)
@@ -272,7 +272,6 @@ struct _sapi_module_struct {
        unsigned int (*input_filter_init)(void);
 };
 
-
 struct _sapi_post_entry {
        char *content_type;
        uint content_type_len;
@@ -305,7 +304,23 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data);
 SAPI_API SAPI_INPUT_FILTER_FUNC(php_default_input_filter);
 END_EXTERN_C()
 
-#define STANDARD_SAPI_MODULE_PROPERTIES
+#define STANDARD_SAPI_MODULE_PROPERTIES \
+       NULL, /* php_ini_path_override   */ \
+       NULL, /* default_post_reader     */ \
+       NULL, /* treat_data              */ \
+       NULL, /* executable_location     */ \
+       0,    /* php_ini_ignore          */ \
+       0,    /* php_ini_ignore_cwd      */ \
+       NULL, /* get_fd                  */ \
+       NULL, /* force_http_10           */ \
+       NULL, /* get_target_uid          */ \
+       NULL, /* get_target_gid          */ \
+       NULL, /* input_filter            */ \
+       NULL, /* ini_defaults            */ \
+       0,    /* phpinfo_as_text;        */ \
+       NULL, /* ini_entries;            */ \
+       NULL, /* additional_functions    */ \
+       NULL  /* input_filter_init       */
 
 #endif /* SAPI_H */
 
index 8fc7d6a968af479bb169b88afa09054a8f89792b..3f2efc86f1c912dfea49714a404e23a43c39394b 100644 (file)
@@ -734,7 +734,7 @@ int fcgi_listen(const char *path, int backlog)
 #else
                int path_len = strlen(path);
 
-               if (path_len >= sizeof(sa.sa_unix.sun_path)) {
+               if (path_len >= (int)sizeof(sa.sa_unix.sun_path)) {
                        fcgi_log(FCGI_ERROR, "Listening socket's path name is too long.\n");
                        return -1;
                }
@@ -1587,7 +1587,7 @@ int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int l
                }
                memcpy(req->out_pos, str, len);
                req->out_pos += len;
-       } else if (len - limit < sizeof(req->out_buf) - sizeof(fcgi_header)) {
+       } else if (len - limit < (int)(sizeof(req->out_buf) - sizeof(fcgi_header))) {
                if (!req->out_hdr) {
                        open_packet(req, type);
                }
index 4e96d9195c313b74421b16daf6b0d9703395f27a..d22c91fdd86b0c2c029eea46d8eda2544a6fb475 100644 (file)
@@ -31,7 +31,7 @@
  */
 
 #define FCGI_HASH_FUNC(var, var_len) \
-       (UNEXPECTED(var_len < 3) ? var_len : \
+       (UNEXPECTED(var_len < 3) ? (unsigned int)var_len : \
                (((unsigned int)var[3]) << 2) + \
                (((unsigned int)var[var_len-2]) << 4) + \
                (((unsigned int)var[var_len-1]) << 2) + \
index 01ab2ad09825a47977a588b1e0f9bf7aec244380..8a263e59f6021075cef6d79cb75e09b44dde061d 100644 (file)
@@ -969,7 +969,7 @@ ZEND_END_ARG_INFO()
 
 static const zend_function_entry additional_functions[] = {
        ZEND_FE(dl, arginfo_dl)
-       {NULL, NULL, NULL}
+       PHP_FE_END
 };
 
 /* {{{ php_cgi_usage
@@ -1716,7 +1716,7 @@ const zend_function_entry cgi_functions[] = {
        PHP_FE(apache_request_headers, arginfo_no_args)
        PHP_FE(apache_response_headers, arginfo_no_args)
        PHP_FALIAS(getallheaders, apache_request_headers, arginfo_no_args)
-       {NULL, NULL, NULL}
+       PHP_FE_END
 };
 
 static zend_module_entry cgi_module_entry = {
index 8a9f50eccc70481313fe67675842090a22b5f6d0..9c80ffd4adbdb91b418504849c554698eca8e118 100644 (file)
@@ -271,11 +271,7 @@ PHP_CLI_API size_t sapi_cli_single_write(const char *str, size_t str_length) /*
 #endif
 
        if (cli_shell_callbacks.cli_shell_write) {
-               size_t shell_wrote;
-               shell_wrote = cli_shell_callbacks.cli_shell_write(str, str_length);
-               if (shell_wrote > -1) {
-                       return shell_wrote;
-               }
+               cli_shell_callbacks.cli_shell_write(str, str_length);
        }
 
 #ifdef PHP_WRITE_STDOUT
@@ -491,7 +487,7 @@ static const zend_function_entry additional_functions[] = {
        ZEND_FE(dl, arginfo_dl)
        PHP_FE(cli_set_process_title,        arginfo_cli_set_process_title)
        PHP_FE(cli_get_process_title,        arginfo_cli_get_process_title)
-       {NULL, NULL, NULL}
+       PHP_FE_END
 };
 
 /* {{{ php_cli_usage
index 453fe82998fcf58dcffc65baad593781fa2add42..8f3ca54beb7f58309e469b438247b90de2f13644 100644 (file)
@@ -482,7 +482,7 @@ const zend_function_entry server_additional_functions[] = {
        PHP_FE(apache_request_headers, arginfo_no_args)
        PHP_FE(apache_response_headers, arginfo_no_args)
        PHP_FALIAS(getallheaders, apache_request_headers, arginfo_no_args)
-       {NULL, NULL, NULL}
+       PHP_FE_END
 };
 
 static int sapi_cli_server_startup(sapi_module_struct *sapi_module) /* {{{ */
@@ -1005,7 +1005,11 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender *sen
                        if (nbytes_sent < 0) {
                                *nbytes_sent_total = _nbytes_sent_total;
                                return php_socket_errno();
+#ifdef PHP_WIN32
                        } else if (nbytes_sent == chunk->data.heap.len) {
+#else
+                       } else if (nbytes_sent == (ssize_t)chunk->data.heap.len) {
+#endif
                                php_cli_server_chunk_dtor(chunk);
                                pefree(chunk, 1);
                                sender->buffer.first = next;
@@ -1028,7 +1032,11 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender *sen
                        if (nbytes_sent < 0) {
                                *nbytes_sent_total = _nbytes_sent_total;
                                return php_socket_errno();
+#ifdef PHP_WIN32
                        } else if (nbytes_sent == chunk->data.immortal.len) {
+#else
+                       } else if (nbytes_sent == (ssize_t)chunk->data.immortal.len) {
+#endif
                                php_cli_server_chunk_dtor(chunk);
                                pefree(chunk, 1);
                                sender->buffer.first = next;
@@ -1705,7 +1713,7 @@ static int php_cli_server_client_read_request(php_cli_server_client *client, cha
        }
        client->parser.data = client;
        nbytes_consumed = php_http_parser_execute(&client->parser, &settings, buf, nbytes_read);
-       if (nbytes_consumed != nbytes_read) {
+       if (nbytes_consumed != (size_t)nbytes_read) {
                if (buf[0] & 0x80 /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) {
                        *errstr = estrdup("Unsupported SSL request");
                } else {
index 5f8eb3ce0b19d6d6e2708d46a25958faa2e7cd9d..59361d091184a1b82070fafa051792db8ba3d4e1 100644 (file)
@@ -1539,7 +1539,7 @@ size_t php_http_parser_execute (php_http_parser *parser,
           p += to_read - 1;
         }
 
-        if (to_read == parser->content_length) {
+        if (to_read == (size_t)parser->content_length) {
           state = s_chunk_data_almost_done;
         }
 
index 2a92fb25a7258ff2b32cd6959191144668a66bb1..8aa76f0e1cd66a0c62e76d447132c4d638546544 100644 (file)
@@ -857,7 +857,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
 
                /* status */
                if (wp->config->pm_status_path && *wp->config->pm_status_path) {
-                       int i;
+                       size_t i;
                        char *status = wp->config->pm_status_path;
 
                        if (*status != '/') {
@@ -881,7 +881,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
                /* ping */
                if (wp->config->ping_path && *wp->config->ping_path) {
                        char *ping = wp->config->ping_path;
-                       int i;
+                       size_t i;
 
                        if (*ping != '/') {
                                zlog(ZLOG_ERROR, "[pool %s] the ping path '%s' must start with a '/'", wp->config->name, ping);
@@ -1254,7 +1254,7 @@ static void fpm_conf_ini_parser_include(char *inc, void *arg) /* {{{ */
 #ifdef HAVE_GLOB
        glob_t g;
 #endif
-       int i;
+       size_t i;
 
        if (!inc || !arg) return;
        if (*error) return; /* We got already an error. Switch to the end. */
index 6dc8343fe6a8a51ea5802ed4d42d0a9d810b2150..a3b0cc9840132cc07b366ebb17c0589b657b10d4 100644 (file)
@@ -1549,7 +1549,7 @@ PHP_FUNCTION(fastcgi_finish_request) /* {{{ */
 
 static const zend_function_entry cgi_fcgi_sapi_functions[] = {
        PHP_FE(fastcgi_finish_request,              NULL)
-       {NULL, NULL, NULL}
+       PHP_FE_END
 };
 
 static zend_module_entry cgi_module_entry = {
index eabab8f8e65b885bbf089ab316073259a355bbd1..dcc9e43f4228094a0f90913152c547a6df4c2cc0 100644 (file)
@@ -25,7 +25,7 @@ static float fpm_scoreboard_tick;
 int fpm_scoreboard_init_main() /* {{{ */
 {
        struct fpm_worker_pool_s *wp;
-       int i;
+       unsigned int i;
 
 #ifdef HAVE_TIMES
 #if (defined(HAVE_SYSCONF) && defined(_SC_CLK_TCK))
@@ -173,7 +173,7 @@ struct fpm_scoreboard_proc_s *fpm_scoreboard_proc_get(struct fpm_scoreboard_s *s
                child_index = fpm_scoreboard_i;
        }
 
-       if (child_index < 0 || child_index >= scoreboard->nprocs) {
+       if (child_index < 0 || (unsigned int)child_index >= scoreboard->nprocs) {
                return NULL;
        }
 
@@ -233,7 +233,7 @@ void fpm_scoreboard_proc_release(struct fpm_scoreboard_proc_s *proc) /* {{{ */
 
 void fpm_scoreboard_free(struct fpm_scoreboard_s *scoreboard) /* {{{ */
 {
-       int i;
+       unsigned int i;
 
        if (!scoreboard) {
                zlog(ZLOG_ERROR, "**scoreboard is NULL");
@@ -270,7 +270,7 @@ void fpm_scoreboard_proc_free(struct fpm_scoreboard_s *scoreboard, int child_ind
                return;
        }
 
-       if (child_index < 0 || child_index >= scoreboard->nprocs) {
+       if (child_index < 0 || (unsigned int)child_index >= scoreboard->nprocs) {
                return;
        }
 
@@ -292,7 +292,7 @@ int fpm_scoreboard_proc_alloc(struct fpm_scoreboard_s *scoreboard, int *child_in
        }
 
        /* first try the slot which is supposed to be free */
-       if (scoreboard->free_proc >= 0 && scoreboard->free_proc < scoreboard->nprocs) {
+       if (scoreboard->free_proc >= 0 && (unsigned int)scoreboard->free_proc < scoreboard->nprocs) {
                if (scoreboard->procs[scoreboard->free_proc] && !scoreboard->procs[scoreboard->free_proc]->used) {
                        i = scoreboard->free_proc;
                }
@@ -300,7 +300,7 @@ int fpm_scoreboard_proc_alloc(struct fpm_scoreboard_s *scoreboard, int *child_in
 
        if (i < 0) { /* the supposed free slot is not, let's search for a free slot */
                zlog(ZLOG_DEBUG, "[pool %s] the proc->free_slot was not free. Let's search", scoreboard->pool);
-               for (i = 0; i < scoreboard->nprocs; i++) {
+               for (i = 0; i < (int)scoreboard->nprocs; i++) {
                        if (scoreboard->procs[i] && !scoreboard->procs[i]->used) { /* found */
                                break;
                        }
@@ -308,7 +308,7 @@ int fpm_scoreboard_proc_alloc(struct fpm_scoreboard_s *scoreboard, int *child_in
        }
 
        /* no free slot */
-       if (i < 0 || i >= scoreboard->nprocs) {
+       if (i < 0 || i >= (int)scoreboard->nprocs) {
                zlog(ZLOG_ERROR, "[pool %s] no free scoreboard slot", scoreboard->pool);
                return -1;
        }
@@ -317,7 +317,7 @@ int fpm_scoreboard_proc_alloc(struct fpm_scoreboard_s *scoreboard, int *child_in
        *child_index = i;
 
        /* supposed next slot is free */
-       if (i + 1 >= scoreboard->nprocs) {
+       if (i + 1 >= (int)scoreboard->nprocs) {
                scoreboard->free_proc = 0;
        } else {
                scoreboard->free_proc = i + 1;
index 3e82face3c6402982f67ceae089fdd7917cf25d3..42d7d7bae087d3d619eda304ce61de6b3a7117a3 100644 (file)
@@ -386,7 +386,8 @@ int fpm_status_handle_request(void) /* {{{ */
 
                /* no need to test the var 'full' */
                if (full_syntax) {
-                       int i, first;
+                       unsigned int i;
+                       int first;
                        zend_string *tmp_query_string;
                        char *query_string;
                        struct timeval duration, now;
index da7ca2c30c34e37f73ab5608548876ba917aeb50..7c8c4746fb3057d5b5048d3fd908b1fc4aaad35b 100644 (file)
@@ -442,13 +442,8 @@ static sapi_module_struct lsapi_sapi_module =
 
     sapi_lsapi_register_variables,  /* register server variables */
     sapi_lsapi_log_message,         /* Log message */
-
-    NULL,                           /* php.ini path override */
-    NULL,                           /* default post reader */
-    NULL,                           /* treat data */
-    NULL,                           /* executable location */
-
-    0,                              /* php.ini ignore */
+       NULL,                                                   /* Get request time */
+       NULL,                                                   /* Child terminate */
 
     STANDARD_SAPI_MODULE_PROPERTIES