Skip to content

Commit 22ecd44

Browse files
committed
Fixed compilation warnings
1 parent 307e6b7 commit 22ecd44

12 files changed

+51
-36
lines changed

main/SAPI.h

+17-2
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ struct _sapi_module_struct {
272272
unsigned int (*input_filter_init)(void);
273273
};
274274

275-
276275
struct _sapi_post_entry {
277276
char *content_type;
278277
uint content_type_len;
@@ -305,7 +304,23 @@ SAPI_API SAPI_TREAT_DATA_FUNC(php_default_treat_data);
305304
SAPI_API SAPI_INPUT_FILTER_FUNC(php_default_input_filter);
306305
END_EXTERN_C()
307306

308-
#define STANDARD_SAPI_MODULE_PROPERTIES
307+
#define STANDARD_SAPI_MODULE_PROPERTIES \
308+
NULL, /* php_ini_path_override */ \
309+
NULL, /* default_post_reader */ \
310+
NULL, /* treat_data */ \
311+
NULL, /* executable_location */ \
312+
0, /* php_ini_ignore */ \
313+
0, /* php_ini_ignore_cwd */ \
314+
NULL, /* get_fd */ \
315+
NULL, /* force_http_10 */ \
316+
NULL, /* get_target_uid */ \
317+
NULL, /* get_target_gid */ \
318+
NULL, /* input_filter */ \
319+
NULL, /* ini_defaults */ \
320+
0, /* phpinfo_as_text; */ \
321+
NULL, /* ini_entries; */ \
322+
NULL, /* additional_functions */ \
323+
NULL /* input_filter_init */
309324

310325
#endif /* SAPI_H */
311326

main/fastcgi.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ int fcgi_listen(const char *path, int backlog)
734734
#else
735735
int path_len = strlen(path);
736736

737-
if (path_len >= sizeof(sa.sa_unix.sun_path)) {
737+
if (path_len >= (int)sizeof(sa.sa_unix.sun_path)) {
738738
fcgi_log(FCGI_ERROR, "Listening socket's path name is too long.\n");
739739
return -1;
740740
}
@@ -1587,7 +1587,7 @@ int fcgi_write(fcgi_request *req, fcgi_request_type type, const char *str, int l
15871587
}
15881588
memcpy(req->out_pos, str, len);
15891589
req->out_pos += len;
1590-
} else if (len - limit < sizeof(req->out_buf) - sizeof(fcgi_header)) {
1590+
} else if (len - limit < (int)(sizeof(req->out_buf) - sizeof(fcgi_header))) {
15911591
if (!req->out_hdr) {
15921592
open_packet(req, type);
15931593
}

main/fastcgi.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*/
3232

3333
#define FCGI_HASH_FUNC(var, var_len) \
34-
(UNEXPECTED(var_len < 3) ? var_len : \
34+
(UNEXPECTED(var_len < 3) ? (unsigned int)var_len : \
3535
(((unsigned int)var[3]) << 2) + \
3636
(((unsigned int)var[var_len-2]) << 4) + \
3737
(((unsigned int)var[var_len-1]) << 2) + \

sapi/cgi/cgi_main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ ZEND_END_ARG_INFO()
969969

970970
static const zend_function_entry additional_functions[] = {
971971
ZEND_FE(dl, arginfo_dl)
972-
{NULL, NULL, NULL}
972+
PHP_FE_END
973973
};
974974

975975
/* {{{ php_cgi_usage
@@ -1716,7 +1716,7 @@ const zend_function_entry cgi_functions[] = {
17161716
PHP_FE(apache_request_headers, arginfo_no_args)
17171717
PHP_FE(apache_response_headers, arginfo_no_args)
17181718
PHP_FALIAS(getallheaders, apache_request_headers, arginfo_no_args)
1719-
{NULL, NULL, NULL}
1719+
PHP_FE_END
17201720
};
17211721

17221722
static zend_module_entry cgi_module_entry = {

sapi/cli/php_cli.c

+2-6
Original file line numberDiff line numberDiff line change
@@ -271,11 +271,7 @@ PHP_CLI_API size_t sapi_cli_single_write(const char *str, size_t str_length) /*
271271
#endif
272272

273273
if (cli_shell_callbacks.cli_shell_write) {
274-
size_t shell_wrote;
275-
shell_wrote = cli_shell_callbacks.cli_shell_write(str, str_length);
276-
if (shell_wrote > -1) {
277-
return shell_wrote;
278-
}
274+
cli_shell_callbacks.cli_shell_write(str, str_length);
279275
}
280276

281277
#ifdef PHP_WRITE_STDOUT
@@ -491,7 +487,7 @@ static const zend_function_entry additional_functions[] = {
491487
ZEND_FE(dl, arginfo_dl)
492488
PHP_FE(cli_set_process_title, arginfo_cli_set_process_title)
493489
PHP_FE(cli_get_process_title, arginfo_cli_get_process_title)
494-
{NULL, NULL, NULL}
490+
PHP_FE_END
495491
};
496492

497493
/* {{{ php_cli_usage

sapi/cli/php_cli_server.c

+10-2
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ const zend_function_entry server_additional_functions[] = {
482482
PHP_FE(apache_request_headers, arginfo_no_args)
483483
PHP_FE(apache_response_headers, arginfo_no_args)
484484
PHP_FALIAS(getallheaders, apache_request_headers, arginfo_no_args)
485-
{NULL, NULL, NULL}
485+
PHP_FE_END
486486
};
487487

488488
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
10051005
if (nbytes_sent < 0) {
10061006
*nbytes_sent_total = _nbytes_sent_total;
10071007
return php_socket_errno();
1008+
#ifdef PHP_WIN32
10081009
} else if (nbytes_sent == chunk->data.heap.len) {
1010+
#else
1011+
} else if (nbytes_sent == (ssize_t)chunk->data.heap.len) {
1012+
#endif
10091013
php_cli_server_chunk_dtor(chunk);
10101014
pefree(chunk, 1);
10111015
sender->buffer.first = next;
@@ -1028,7 +1032,11 @@ static int php_cli_server_content_sender_send(php_cli_server_content_sender *sen
10281032
if (nbytes_sent < 0) {
10291033
*nbytes_sent_total = _nbytes_sent_total;
10301034
return php_socket_errno();
1035+
#ifdef PHP_WIN32
10311036
} else if (nbytes_sent == chunk->data.immortal.len) {
1037+
#else
1038+
} else if (nbytes_sent == (ssize_t)chunk->data.immortal.len) {
1039+
#endif
10321040
php_cli_server_chunk_dtor(chunk);
10331041
pefree(chunk, 1);
10341042
sender->buffer.first = next;
@@ -1705,7 +1713,7 @@ static int php_cli_server_client_read_request(php_cli_server_client *client, cha
17051713
}
17061714
client->parser.data = client;
17071715
nbytes_consumed = php_http_parser_execute(&client->parser, &settings, buf, nbytes_read);
1708-
if (nbytes_consumed != nbytes_read) {
1716+
if (nbytes_consumed != (size_t)nbytes_read) {
17091717
if (buf[0] & 0x80 /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) {
17101718
*errstr = estrdup("Unsupported SSL request");
17111719
} else {

sapi/cli/php_http_parser.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1539,7 +1539,7 @@ size_t php_http_parser_execute (php_http_parser *parser,
15391539
p += to_read - 1;
15401540
}
15411541

1542-
if (to_read == parser->content_length) {
1542+
if (to_read == (size_t)parser->content_length) {
15431543
state = s_chunk_data_almost_done;
15441544
}
15451545

sapi/fpm/fpm/fpm_conf.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
857857

858858
/* status */
859859
if (wp->config->pm_status_path && *wp->config->pm_status_path) {
860-
int i;
860+
size_t i;
861861
char *status = wp->config->pm_status_path;
862862

863863
if (*status != '/') {
@@ -881,7 +881,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
881881
/* ping */
882882
if (wp->config->ping_path && *wp->config->ping_path) {
883883
char *ping = wp->config->ping_path;
884-
int i;
884+
size_t i;
885885

886886
if (*ping != '/') {
887887
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) /* {{{ */
12541254
#ifdef HAVE_GLOB
12551255
glob_t g;
12561256
#endif
1257-
int i;
1257+
size_t i;
12581258

12591259
if (!inc || !arg) return;
12601260
if (*error) return; /* We got already an error. Switch to the end. */

sapi/fpm/fpm/fpm_main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,7 @@ PHP_FUNCTION(fastcgi_finish_request) /* {{{ */
15491549

15501550
static const zend_function_entry cgi_fcgi_sapi_functions[] = {
15511551
PHP_FE(fastcgi_finish_request, NULL)
1552-
{NULL, NULL, NULL}
1552+
PHP_FE_END
15531553
};
15541554

15551555
static zend_module_entry cgi_module_entry = {

sapi/fpm/fpm/fpm_scoreboard.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static float fpm_scoreboard_tick;
2525
int fpm_scoreboard_init_main() /* {{{ */
2626
{
2727
struct fpm_worker_pool_s *wp;
28-
int i;
28+
unsigned int i;
2929

3030
#ifdef HAVE_TIMES
3131
#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
173173
child_index = fpm_scoreboard_i;
174174
}
175175

176-
if (child_index < 0 || child_index >= scoreboard->nprocs) {
176+
if (child_index < 0 || (unsigned int)child_index >= scoreboard->nprocs) {
177177
return NULL;
178178
}
179179

@@ -233,7 +233,7 @@ void fpm_scoreboard_proc_release(struct fpm_scoreboard_proc_s *proc) /* {{{ */
233233

234234
void fpm_scoreboard_free(struct fpm_scoreboard_s *scoreboard) /* {{{ */
235235
{
236-
int i;
236+
unsigned int i;
237237

238238
if (!scoreboard) {
239239
zlog(ZLOG_ERROR, "**scoreboard is NULL");
@@ -270,7 +270,7 @@ void fpm_scoreboard_proc_free(struct fpm_scoreboard_s *scoreboard, int child_ind
270270
return;
271271
}
272272

273-
if (child_index < 0 || child_index >= scoreboard->nprocs) {
273+
if (child_index < 0 || (unsigned int)child_index >= scoreboard->nprocs) {
274274
return;
275275
}
276276

@@ -292,23 +292,23 @@ int fpm_scoreboard_proc_alloc(struct fpm_scoreboard_s *scoreboard, int *child_in
292292
}
293293

294294
/* first try the slot which is supposed to be free */
295-
if (scoreboard->free_proc >= 0 && scoreboard->free_proc < scoreboard->nprocs) {
295+
if (scoreboard->free_proc >= 0 && (unsigned int)scoreboard->free_proc < scoreboard->nprocs) {
296296
if (scoreboard->procs[scoreboard->free_proc] && !scoreboard->procs[scoreboard->free_proc]->used) {
297297
i = scoreboard->free_proc;
298298
}
299299
}
300300

301301
if (i < 0) { /* the supposed free slot is not, let's search for a free slot */
302302
zlog(ZLOG_DEBUG, "[pool %s] the proc->free_slot was not free. Let's search", scoreboard->pool);
303-
for (i = 0; i < scoreboard->nprocs; i++) {
303+
for (i = 0; i < (int)scoreboard->nprocs; i++) {
304304
if (scoreboard->procs[i] && !scoreboard->procs[i]->used) { /* found */
305305
break;
306306
}
307307
}
308308
}
309309

310310
/* no free slot */
311-
if (i < 0 || i >= scoreboard->nprocs) {
311+
if (i < 0 || i >= (int)scoreboard->nprocs) {
312312
zlog(ZLOG_ERROR, "[pool %s] no free scoreboard slot", scoreboard->pool);
313313
return -1;
314314
}
@@ -317,7 +317,7 @@ int fpm_scoreboard_proc_alloc(struct fpm_scoreboard_s *scoreboard, int *child_in
317317
*child_index = i;
318318

319319
/* supposed next slot is free */
320-
if (i + 1 >= scoreboard->nprocs) {
320+
if (i + 1 >= (int)scoreboard->nprocs) {
321321
scoreboard->free_proc = 0;
322322
} else {
323323
scoreboard->free_proc = i + 1;

sapi/fpm/fpm/fpm_status.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,8 @@ int fpm_status_handle_request(void) /* {{{ */
386386

387387
/* no need to test the var 'full' */
388388
if (full_syntax) {
389-
int i, first;
389+
unsigned int i;
390+
int first;
390391
zend_string *tmp_query_string;
391392
char *query_string;
392393
struct timeval duration, now;

sapi/litespeed/lsapi_main.c

+2-7
Original file line numberDiff line numberDiff line change
@@ -442,13 +442,8 @@ static sapi_module_struct lsapi_sapi_module =
442442

443443
sapi_lsapi_register_variables, /* register server variables */
444444
sapi_lsapi_log_message, /* Log message */
445-
446-
NULL, /* php.ini path override */
447-
NULL, /* default post reader */
448-
NULL, /* treat data */
449-
NULL, /* executable location */
450-
451-
0, /* php.ini ignore */
445+
NULL, /* Get request time */
446+
NULL, /* Child terminate */
452447

453448
STANDARD_SAPI_MODULE_PROPERTIES
454449

0 commit comments

Comments
 (0)