Skip to content

Commit 323b273

Browse files
committed
Fixed compilation warnings
1 parent 4ccbe03 commit 323b273

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+851
-810
lines changed

ext/bz2/bz2.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,8 @@ static php_stream_wrapper_ops bzip2_stream_wops = {
323323
NULL, /* unlink */
324324
NULL, /* rename */
325325
NULL, /* mkdir */
326-
NULL /* rmdir */
326+
NULL, /* rmdir */
327+
NULL
327328
};
328329

329330
static php_stream_wrapper php_stream_bzip2_wrapper = {

ext/curl/interface.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static void _php_curl_close(zend_resource *rsrc);
167167
# define php_curl_ret(__ret) RETVAL_FALSE; return;
168168
#endif
169169

170-
static int php_curl_option_str(php_curl *ch, zend_long option, const char *str, const int len, zend_bool make_copy)
170+
static int php_curl_option_str(php_curl *ch, zend_long option, const char *str, const size_t len, zend_bool make_copy)
171171
{
172172
CURLcode error = CURLE_OK;
173173

@@ -196,7 +196,7 @@ static int php_curl_option_str(php_curl *ch, zend_long option, const char *str,
196196
return error == CURLE_OK ? SUCCESS : FAILURE;
197197
}
198198

199-
static int php_curl_option_url(php_curl *ch, const char *url, const int len) /* {{{ */
199+
static int php_curl_option_url(php_curl *ch, const char *url, const size_t len) /* {{{ */
200200
{
201201
/* Disable file:// if open_basedir are used */
202202
if (PG(open_basedir) && *PG(open_basedir)) {

ext/date/php_date.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,8 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
10711071
static zend_string *date_format(char *format, size_t format_len, timelib_time *t, int localtime)
10721072
{
10731073
smart_str string = {0};
1074-
int i, length = 0;
1074+
size_t i;
1075+
int length = 0;
10751076
char buffer[97];
10761077
timelib_time_offset *offset = NULL;
10771078
timelib_sll isoweek, isoyear;
@@ -4217,7 +4218,8 @@ PHP_FUNCTION(date_interval_create_from_date_string)
42174218
static zend_string *date_interval_format(char *format, size_t format_len, timelib_rel_time *t)
42184219
{
42194220
smart_str string = {0};
4220-
int i, length, have_format_spec = 0;
4221+
size_t i;
4222+
int length, have_format_spec = 0;
42214223
char buffer[33];
42224224

42234225
if (!format_len) {

ext/dba/dba.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ static dba_handler handler[] = {
363363
#if DBA_TCADB
364364
DBA_HND(tcadb, DBA_LOCK_ALL)
365365
#endif
366-
{ NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
366+
{ NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }
367367
};
368368

369369
#if DBA_FLATFILE

ext/dom/comment.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ ZEND_END_ARG_INFO();
4343

4444
const zend_function_entry php_dom_comment_class_functions[] = {
4545
PHP_ME(domcomment, __construct, arginfo_dom_comment_construct, ZEND_ACC_PUBLIC)
46-
{NULL, NULL, NULL}
46+
PHP_FE_END
4747
};
4848

4949
/* {{{ proto void DOMComment::__construct([string value]); */

ext/dom/dom_iterators.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ zend_object_iterator_funcs php_dom_iterator_funcs = {
249249
php_dom_iterator_current_data,
250250
php_dom_iterator_current_key,
251251
php_dom_iterator_move_forward,
252+
NULL,
252253
NULL
253254
};
254255

ext/dom/domimplementationlist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ ZEND_END_ARG_INFO();
4242

4343
const zend_function_entry php_dom_domimplementationlist_class_functions[] = {
4444
PHP_FALIAS(item, dom_domimplementationlist_item, arginfo_dom_implementationlist_item)
45-
{NULL, NULL, NULL}
45+
PHP_FE_END
4646
};
4747

4848
/* {{{ attribute protos, not implemented yet */

ext/dom/node.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ int dom_node_text_content_write(dom_object *obj, zval *newval)
856856
str = zval_get_string(newval);
857857
/* we have to use xmlNodeAddContent() to get the same behavior as with xmlNewText() */
858858
xmlNodeSetContent(nodep, (xmlChar *) "");
859-
xmlNodeAddContent(nodep, ZSTR_VAL(str));
859+
xmlNodeAddContent(nodep, (xmlChar *) ZSTR_VAL(str));
860860
zend_string_release(str);
861861

862862
return SUCCESS;

ext/exif/exif.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2703,7 +2703,8 @@ static int exif_process_unicode(image_info_type *ImageInfo, xp_field_type *xp_fi
27032703
* Process nested IFDs directories in Maker Note. */
27042704
static int exif_process_IFD_in_MAKERNOTE(image_info_type *ImageInfo, char * value_ptr, int value_len, char *offset_base, size_t IFDlength, size_t displacement)
27052705
{
2706-
int de, i=0, section_index = SECTION_MAKERNOTE;
2706+
size_t i;
2707+
int de, section_index = SECTION_MAKERNOTE;
27072708
int NumDirEntries, old_motorola_intel, offset_diff;
27082709
const maker_note_type *maker_note;
27092710
char *dir_start;
@@ -3317,11 +3318,11 @@ static int exif_scan_JPEG_header(image_info_type *ImageInfo)
33173318
}
33183319

33193320
/* Read the length of the section. */
3320-
if ((lh = php_stream_getc(ImageInfo->infile)) == EOF) {
3321+
if ((lh = php_stream_getc(ImageInfo->infile)) == (unsigned int)EOF) {
33213322
EXIF_ERRLOG_CORRUPT(ImageInfo)
33223323
return FALSE;
33233324
}
3324-
if ((ll = php_stream_getc(ImageInfo->infile)) == EOF) {
3325+
if ((ll = php_stream_getc(ImageInfo->infile)) == (unsigned int)EOF) {
33253326
EXIF_ERRLOG_CORRUPT(ImageInfo)
33263327
return FALSE;
33273328
}

ext/fileinfo/fileinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ zend_function_entry fileinfo_functions[] = {
203203
PHP_FE(finfo_file, arginfo_finfo_file)
204204
PHP_FE(finfo_buffer, arginfo_finfo_buffer)
205205
PHP_FE(mime_content_type, arginfo_mime_content_type)
206-
{NULL, NULL, NULL}
206+
PHP_FE_END
207207
};
208208
/* }}} */
209209

ext/filter/logical_filters.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ void php_filter_validate_domain(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
517517
void php_filter_validate_url(PHP_INPUT_FILTER_PARAM_DECL) /* {{{ */
518518
{
519519
php_url *url;
520-
int old_len = (int)Z_STRLEN_P(value);
520+
size_t old_len = Z_STRLEN_P(value);
521521

522522
php_filter_url(value, flags, option_array, charset);
523523

ext/filter/sanitizing_filters.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ static void php_filter_encode_url(zval *value, const unsigned char* chars, const
111111
static void php_filter_strip(zval *value, zend_long flags)
112112
{
113113
unsigned char *str;
114-
int i, c;
114+
size_t i;
115+
int c;
115116
zend_string *buf;
116117

117118
/* Optimization for if no strip flags are set */
@@ -158,7 +159,8 @@ static void filter_map_update(filter_map *map, int flag, const unsigned char *al
158159
static void filter_map_apply(zval *value, filter_map *map)
159160
{
160161
unsigned char *str;
161-
int i, c;
162+
size_t i;
163+
int c;
162164
zend_string *buf;
163165

164166
str = (unsigned char *)Z_STRVAL_P(value);

ext/ftp/ftp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
866866
}
867867

868868
while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) {
869-
if (rcvd == -1) {
869+
if (rcvd == (size_t)-1) {
870870
goto bail;
871871
}
872872

@@ -1829,7 +1829,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path)
18291829
lines = 0;
18301830
lastch = 0;
18311831
while ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) {
1832-
if (rcvd == -1 || rcvd > ((size_t)(-1))-size) {
1832+
if (rcvd == (size_t)-1 || rcvd > ((size_t)(-1))-size) {
18331833
goto bail;
18341834
}
18351835

@@ -1958,7 +1958,7 @@ ftp_nb_continue_read(ftpbuf_t *ftp)
19581958

19591959
lastch = ftp->lastch;
19601960
if ((rcvd = my_recv(ftp, data->fd, data->buf, FTP_BUFSIZE))) {
1961-
if (rcvd == -1) {
1961+
if (rcvd == (size_t)-1) {
19621962
goto bail;
19631963
}
19641964

ext/hash/hash.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static inline void php_hash_string_xor(unsigned char *out, const unsigned char *
208208

209209
static inline void php_hash_hmac_prep_key(unsigned char *K, const php_hash_ops *ops, void *context, const unsigned char *key, const size_t key_len) {
210210
memset(K, 0, ops->block_size);
211-
if (key_len > ops->block_size) {
211+
if (key_len > (size_t)ops->block_size) {
212212
/* Reduce the key first */
213213
ops->hash_init(context);
214214
ops->hash_update(context, key, key_len);
@@ -367,7 +367,7 @@ PHP_FUNCTION(hash_init)
367367

368368
memset(K, 0, ops->block_size);
369369

370-
if (key_len > ops->block_size) {
370+
if (key_len > (size_t)ops->block_size) {
371371
/* Reduce the key first */
372372
ops->hash_update(context, (unsigned char *) key, key_len);
373373
ops->hash_final((unsigned char *) K, context);
@@ -729,7 +729,8 @@ PHP_FUNCTION(hash_equals)
729729
{
730730
zval *known_zval, *user_zval;
731731
char *known_str, *user_str;
732-
int result = 0, j;
732+
int result = 0;
733+
size_t j;
733734

734735
if (zend_parse_parameters(ZEND_NUM_ARGS(), "zz", &known_zval, &user_zval) == FAILURE) {
735736
return;

ext/hash/hash_sha3.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ static void PHP_SHA3_Init(PHP_SHA3_CTX* ctx,
153153
static void PHP_SHA3_Update(PHP_SHA3_CTX* ctx,
154154
const unsigned char* buf,
155155
unsigned int count,
156-
int block_size) {
156+
size_t block_size) {
157157
while (count > 0) {
158-
int len = block_size - ctx->pos;
158+
unsigned int len = block_size - ctx->pos;
159159
if (len > count) len = count;
160160
count -= len;
161161
while (len-- > 0) {

ext/intl/collator/collator_is_numeric.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static double collator_u_strtod(const UChar *nptr, UChar **endptr) /* {{{ */
7070

7171
if (any) {
7272
char buf[64], *numbuf, *bufpos;
73-
int length = u - nstart;
73+
size_t length = u - nstart;
7474
double value;
7575

7676
if (length < sizeof(buf)) {

ext/intl/collator/collator_sort.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ PHP_FUNCTION( collator_sort_with_sort_keys )
370370
char* sortKeyBuf = NULL; /* buffer to store sort keys */
371371
uint32_t sortKeyBufSize = DEF_SORT_KEYS_BUF_SIZE; /* buffer size */
372372
ptrdiff_t sortKeyBufOffset = 0; /* pos in buffer to store sort key */
373-
int32_t sortKeyLen = 0; /* the length of currently processing key */
373+
uint32_t sortKeyLen = 0; /* the length of currently processing key */
374374
uint32_t bufLeft = 0;
375375
uint32_t bufIncrement = 0;
376376

ext/intl/converter/converter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ static zend_function_entry php_converter_methods[] = {
997997
PHP_ME(UConverter, getAvailable, php_converter_getavailable_arginfo, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
998998
PHP_ME(UConverter, getAliases, php_converter_getaliases_arginfo, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
999999
PHP_ME(UConverter, getStandards, php_converter_getstandards_arginfo, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
1000-
{ NULL, NULL, NULL }
1000+
PHP_FE_END
10011001
};
10021002

10031003
/* {{{ Converter create/clone/destroy */

ext/intl/dateformat/dateformat_attr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ PHP_FUNCTION( datefmt_get_timetype )
8686
PHP_FUNCTION( datefmt_get_pattern )
8787
{
8888
UChar value_buf[64];
89-
int length = USIZE( value_buf );
89+
uint32_t length = USIZE( value_buf );
9090
UChar* value = value_buf;
9191
zend_bool is_pattern_localized =FALSE;
9292

ext/intl/dateformat/dateformat_parse.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ PHP_FUNCTION(datefmt_parse)
130130
char* text_to_parse = NULL;
131131
size_t text_len =0;
132132
zval* z_parse_pos = NULL;
133-
int32_t parse_pos = -1;
133+
zend_long parse_pos = -1;
134134

135135
DATE_FORMAT_METHOD_INIT_VARS;
136136

@@ -147,8 +147,8 @@ PHP_FUNCTION(datefmt_parse)
147147
if (z_parse_pos) {
148148
ZVAL_DEREF(z_parse_pos);
149149
convert_to_long(z_parse_pos);
150-
parse_pos = (int32_t)Z_LVAL_P(z_parse_pos);
151-
if(parse_pos > text_len) {
150+
parse_pos = Z_LVAL_P(z_parse_pos);
151+
if((size_t)parse_pos > text_len) {
152152
RETURN_FALSE;
153153
}
154154
}
@@ -169,7 +169,7 @@ PHP_FUNCTION(datefmt_localtime)
169169
char* text_to_parse = NULL;
170170
size_t text_len =0;
171171
zval* z_parse_pos = NULL;
172-
int32_t parse_pos = -1;
172+
zend_long parse_pos = -1;
173173

174174
DATE_FORMAT_METHOD_INIT_VARS;
175175

@@ -186,8 +186,8 @@ PHP_FUNCTION(datefmt_localtime)
186186
if (z_parse_pos) {
187187
ZVAL_DEREF(z_parse_pos);
188188
convert_to_long(z_parse_pos);
189-
parse_pos = (int32_t)Z_LVAL_P(z_parse_pos);
190-
if(parse_pos > text_len) {
189+
parse_pos = Z_LVAL_P(z_parse_pos);
190+
if((size_t)parse_pos > text_len) {
191191
RETURN_FALSE;
192192
}
193193
}

ext/intl/formatter/formatter_attr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ PHP_FUNCTION( numfmt_get_symbol )
252252
zend_long symbol;
253253
UChar value_buf[4];
254254
UChar *value = value_buf;
255-
int32_t length = USIZE(value_buf);
255+
uint32_t length = USIZE(value_buf);
256256
FORMATTER_METHOD_INIT_VARS;
257257

258258
/* Parse parameters. */
@@ -345,7 +345,7 @@ PHP_FUNCTION( numfmt_set_symbol )
345345
PHP_FUNCTION( numfmt_get_pattern )
346346
{
347347
UChar value_buf[64];
348-
int32_t length = USIZE( value_buf );
348+
uint32_t length = USIZE( value_buf );
349349
UChar* value = value_buf;
350350
FORMATTER_METHOD_INIT_VARS;
351351

ext/intl/grapheme/grapheme_string.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ PHP_FUNCTION(grapheme_strpos)
126126

127127
/* we checked that it will fit: */
128128
offset = (int32_t) loffset;
129-
noffset = offset >= 0 ? offset : haystack_len + offset;
129+
noffset = offset >= 0 ? offset : (int32_t)haystack_len + offset;
130130

131131
/* the offset is 'grapheme count offset' so it still might be invalid - we'll check it later */
132132

@@ -200,7 +200,7 @@ PHP_FUNCTION(grapheme_stripos)
200200
is_ascii = ( grapheme_ascii_check((unsigned char*)haystack, haystack_len) >= 0 );
201201

202202
if ( is_ascii ) {
203-
int32_t noffset = offset >= 0 ? offset : haystack_len + offset;
203+
int32_t noffset = offset >= 0 ? offset : (int32_t)haystack_len + offset;
204204
needle_dup = estrndup(needle, needle_len);
205205
php_strtolower(needle_dup, needle_len);
206206
haystack_dup = estrndup(haystack, haystack_len);
@@ -828,7 +828,7 @@ PHP_FUNCTION(grapheme_extract)
828828
RETURN_FALSE;
829829
}
830830

831-
if ( lstart > INT32_MAX || lstart < 0 || lstart >= str_len ) {
831+
if ( lstart > INT32_MAX || lstart < 0 || (size_t)lstart >= str_len ) {
832832
intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "grapheme_extract: start not contained in string", 0 );
833833
RETURN_FALSE;
834834
}

ext/intl/grapheme/grapheme_util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ grapheme_strrpos_ascii(char *haystack, size_t haystack_len, char *needle, size_t
345345
e = haystack + haystack_len - needle_len;
346346
} else {
347347
p = haystack;
348-
if (needle_len > -offset) {
348+
if (needle_len > (size_t)-offset) {
349349
e = haystack + haystack_len - needle_len;
350350
} else {
351351
e = haystack + haystack_len + offset;

ext/intl/grapheme/grapheme_util.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ int32_t grapheme_split_string(const UChar *text, int32_t text_length, int bounda
3434

3535
int32_t grapheme_count_graphemes(UBreakIterator *bi, UChar *string, int32_t string_len);
3636

37-
inline void *grapheme_memrchr_grapheme(const void *s, int c, int32_t n);
38-
3937
int32_t grapheme_get_haystack_offset(UBreakIterator* bi, int32_t offset);
4038

4139
UBreakIterator* grapheme_get_break_iterator(void *stack_buffer, UErrorCode *status );

ext/intl/locale/locale_methods.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ static zend_string* lookup_loc_range(const char* loc_range, HashTable* hash_arr,
14291429

14301430
char* cur_loc_range = NULL;
14311431
zend_string* can_loc_range = NULL;
1432-
int saved_pos = 0;
1432+
size_t saved_pos = 0;
14331433

14341434
zend_string* return_value = NULL;
14351435

ext/intl/uchar/uchar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ static inline int convert_cp(UChar32* pcp, zval *zcp) {
1111
if (Z_TYPE_P(zcp) == IS_LONG) {
1212
cp = Z_LVAL_P(zcp);
1313
} else if (Z_TYPE_P(zcp) == IS_STRING) {
14-
int i = 0;
14+
size_t i = 0;
1515
U8_NEXT(Z_STRVAL_P(zcp), i, Z_STRLEN_P(zcp), cp);
1616
if (i != Z_STRLEN_P(zcp)) {
1717
intl_error_set_code(NULL, U_ILLEGAL_ARGUMENT_ERROR);

ext/json/json_parser.tab.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ int json_yydebug = 1;
139139

140140
/* In a future release of Bison, this section will be replaced
141141
by #include "json_parser.tab.h". */
142-
#ifndef YY_PHP_JSON_YY_HOME_JAKUB_PROG_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
143-
# define YY_PHP_JSON_YY_HOME_JAKUB_PROG_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
142+
#ifndef YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
143+
# define YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED
144144
/* Debug traces. */
145145
#ifndef YYDEBUG
146146
# define YYDEBUG 0
@@ -201,7 +201,7 @@ typedef union YYSTYPE YYSTYPE;
201201

202202
int php_json_yyparse (php_json_parser *parser);
203203

204-
#endif /* !YY_PHP_JSON_YY_HOME_JAKUB_PROG_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED */
204+
#endif /* !YY_PHP_JSON_YY_HOME_DMITRY_PHP_PHP_MASTER_EXT_JSON_JSON_PARSER_TAB_H_INCLUDED */
205205

206206
/* Copy the second part of user declarations. */
207207

0 commit comments

Comments
 (0)