Skip to content

Commit e35324f

Browse files
committed
standard/fpt_fopen_wrapper: use size_t instead of int
1 parent ea8f2cf commit e35324f

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

ext/standard/ftp_fopen_wrapper.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char
127127
php_uri *resource = NULL;
128128
int result, use_ssl, use_ssl_on_data = 0;
129129
char tmp_line[512];
130-
char *transport;
131-
int transport_len;
132130

133131
const php_uri_parser *uri_parser = php_stream_context_get_uri_parser("ftp", context);
134132
if (uri_parser == NULL) {
@@ -150,7 +148,8 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char
150148
if (resource->port == 0)
151149
resource->port = 21;
152150

153-
transport_len = (int)spprintf(&transport, 0, "tcp://%s:" ZEND_LONG_FMT, ZSTR_VAL(resource->host), resource->port);
151+
char *transport;
152+
size_t transport_len = spprintf(&transport, 0, "tcp://%s:" ZEND_LONG_FMT, ZSTR_VAL(resource->host), resource->port);
154153
stream = php_stream_xport_create(transport, transport_len, REPORT_ERRORS, STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, NULL, NULL, context, NULL, NULL);
155154
efree(transport);
156155
if (stream == NULL) {
@@ -420,8 +419,6 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa
420419
zval *tmpzval;
421420
bool allow_overwrite = false;
422421
int8_t read_write = 0;
423-
char *transport;
424-
int transport_len;
425422
zend_string *error_message = NULL;
426423

427424
tmp_line[0] = '\0';
@@ -554,7 +551,9 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa
554551
if (hoststart == NULL) {
555552
hoststart = ZSTR_VAL(resource->host);
556553
}
557-
transport_len = (int)spprintf(&transport, 0, "tcp://%s:%d", hoststart, portno);
554+
555+
char *transport;
556+
size_t transport_len = spprintf(&transport, 0, "tcp://%s:%d", hoststart, portno);
558557
datastream = php_stream_xport_create(transport, transport_len, REPORT_ERRORS, STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, NULL, NULL, context, &error_message, NULL);
559558
efree(transport);
560559
if (datastream == NULL) {

0 commit comments

Comments
 (0)