mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
ext/ftp: Use new php_streams fast ZPP specifier
This commit is contained in:
parent
da1fde28f3
commit
c9d23c96d6
1 changed files with 40 additions and 20 deletions
|
@ -566,7 +566,7 @@ PHP_FUNCTION(ftp_systype)
|
||||||
/* {{{ Retrieves a file from the FTP server and writes it to an open file */
|
/* {{{ Retrieves a file from the FTP server and writes it to an open file */
|
||||||
PHP_FUNCTION(ftp_fget)
|
PHP_FUNCTION(ftp_fget)
|
||||||
{
|
{
|
||||||
zval *z_ftp, *z_file;
|
zval *z_ftp;
|
||||||
ftpbuf_t *ftp;
|
ftpbuf_t *ftp;
|
||||||
ftptype_t xtype;
|
ftptype_t xtype;
|
||||||
php_stream *stream;
|
php_stream *stream;
|
||||||
|
@ -574,11 +574,16 @@ PHP_FUNCTION(ftp_fget)
|
||||||
size_t file_len;
|
size_t file_len;
|
||||||
zend_long mode=FTPTYPE_IMAGE, resumepos=0;
|
zend_long mode=FTPTYPE_IMAGE, resumepos=0;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ors|ll", &z_ftp, php_ftp_ce, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
|
ZEND_PARSE_PARAMETERS_START(3, 5)
|
||||||
RETURN_THROWS();
|
Z_PARAM_OBJECT_OF_CLASS(z_ftp, php_ftp_ce)
|
||||||
}
|
PHP_Z_PARAM_STREAM(stream)
|
||||||
|
Z_PARAM_STRING(file, file_len)
|
||||||
|
Z_PARAM_OPTIONAL
|
||||||
|
Z_PARAM_LONG(mode)
|
||||||
|
Z_PARAM_LONG(resumepos)
|
||||||
|
ZEND_PARSE_PARAMETERS_END();
|
||||||
|
|
||||||
GET_FTPBUF(ftp, z_ftp);
|
GET_FTPBUF(ftp, z_ftp);
|
||||||
php_stream_from_res(stream, Z_RES_P(z_file));
|
|
||||||
XTYPE(xtype, mode);
|
XTYPE(xtype, mode);
|
||||||
|
|
||||||
/* ignore autoresume if autoseek is switched off */
|
/* ignore autoresume if autoseek is switched off */
|
||||||
|
@ -610,7 +615,7 @@ PHP_FUNCTION(ftp_fget)
|
||||||
/* {{{ Retrieves a file from the FTP server asynchronly and writes it to an open file */
|
/* {{{ Retrieves a file from the FTP server asynchronly and writes it to an open file */
|
||||||
PHP_FUNCTION(ftp_nb_fget)
|
PHP_FUNCTION(ftp_nb_fget)
|
||||||
{
|
{
|
||||||
zval *z_ftp, *z_file;
|
zval *z_ftp;
|
||||||
ftpbuf_t *ftp;
|
ftpbuf_t *ftp;
|
||||||
ftptype_t xtype;
|
ftptype_t xtype;
|
||||||
php_stream *stream;
|
php_stream *stream;
|
||||||
|
@ -618,11 +623,16 @@ PHP_FUNCTION(ftp_nb_fget)
|
||||||
size_t file_len;
|
size_t file_len;
|
||||||
zend_long mode=FTPTYPE_IMAGE, resumepos=0, ret;
|
zend_long mode=FTPTYPE_IMAGE, resumepos=0, ret;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ors|ll", &z_ftp, php_ftp_ce, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
|
ZEND_PARSE_PARAMETERS_START(3, 5)
|
||||||
RETURN_THROWS();
|
Z_PARAM_OBJECT_OF_CLASS(z_ftp, php_ftp_ce)
|
||||||
}
|
PHP_Z_PARAM_STREAM(stream)
|
||||||
|
Z_PARAM_STRING(file, file_len)
|
||||||
|
Z_PARAM_OPTIONAL
|
||||||
|
Z_PARAM_LONG(mode)
|
||||||
|
Z_PARAM_LONG(resumepos)
|
||||||
|
ZEND_PARSE_PARAMETERS_END();
|
||||||
|
|
||||||
GET_FTPBUF(ftp, z_ftp);
|
GET_FTPBUF(ftp, z_ftp);
|
||||||
php_stream_from_res(stream, Z_RES_P(z_file));
|
|
||||||
XTYPE(xtype, mode);
|
XTYPE(xtype, mode);
|
||||||
|
|
||||||
/* ignore autoresume if autoseek is switched off */
|
/* ignore autoresume if autoseek is switched off */
|
||||||
|
@ -848,7 +858,7 @@ PHP_FUNCTION(ftp_nb_continue)
|
||||||
/* {{{ Stores a file from an open file to the FTP server */
|
/* {{{ Stores a file from an open file to the FTP server */
|
||||||
PHP_FUNCTION(ftp_fput)
|
PHP_FUNCTION(ftp_fput)
|
||||||
{
|
{
|
||||||
zval *z_ftp, *z_file;
|
zval *z_ftp;
|
||||||
ftpbuf_t *ftp;
|
ftpbuf_t *ftp;
|
||||||
ftptype_t xtype;
|
ftptype_t xtype;
|
||||||
size_t remote_len;
|
size_t remote_len;
|
||||||
|
@ -856,11 +866,16 @@ PHP_FUNCTION(ftp_fput)
|
||||||
php_stream *stream;
|
php_stream *stream;
|
||||||
char *remote;
|
char *remote;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Osr|ll", &z_ftp, php_ftp_ce, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) {
|
ZEND_PARSE_PARAMETERS_START(3, 5)
|
||||||
RETURN_THROWS();
|
Z_PARAM_OBJECT_OF_CLASS(z_ftp, php_ftp_ce)
|
||||||
}
|
Z_PARAM_STRING(remote, remote_len)
|
||||||
|
PHP_Z_PARAM_STREAM(stream)
|
||||||
|
Z_PARAM_OPTIONAL
|
||||||
|
Z_PARAM_LONG(mode)
|
||||||
|
Z_PARAM_LONG(startpos)
|
||||||
|
ZEND_PARSE_PARAMETERS_END();
|
||||||
|
|
||||||
GET_FTPBUF(ftp, z_ftp);
|
GET_FTPBUF(ftp, z_ftp);
|
||||||
php_stream_from_zval(stream, z_file);
|
|
||||||
XTYPE(xtype, mode);
|
XTYPE(xtype, mode);
|
||||||
|
|
||||||
/* ignore autoresume if autoseek is switched off */
|
/* ignore autoresume if autoseek is switched off */
|
||||||
|
@ -895,7 +910,7 @@ PHP_FUNCTION(ftp_fput)
|
||||||
/* {{{ Stores a file from an open file to the FTP server nbronly */
|
/* {{{ Stores a file from an open file to the FTP server nbronly */
|
||||||
PHP_FUNCTION(ftp_nb_fput)
|
PHP_FUNCTION(ftp_nb_fput)
|
||||||
{
|
{
|
||||||
zval *z_ftp, *z_file;
|
zval *z_ftp;
|
||||||
ftpbuf_t *ftp;
|
ftpbuf_t *ftp;
|
||||||
ftptype_t xtype;
|
ftptype_t xtype;
|
||||||
size_t remote_len;
|
size_t remote_len;
|
||||||
|
@ -904,11 +919,16 @@ PHP_FUNCTION(ftp_nb_fput)
|
||||||
php_stream *stream;
|
php_stream *stream;
|
||||||
char *remote;
|
char *remote;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "Osr|ll", &z_ftp, php_ftp_ce, &remote, &remote_len, &z_file, &mode, &startpos) == FAILURE) {
|
ZEND_PARSE_PARAMETERS_START(3, 5)
|
||||||
RETURN_THROWS();
|
Z_PARAM_OBJECT_OF_CLASS(z_ftp, php_ftp_ce)
|
||||||
}
|
Z_PARAM_STRING(remote, remote_len)
|
||||||
|
PHP_Z_PARAM_STREAM(stream)
|
||||||
|
Z_PARAM_OPTIONAL
|
||||||
|
Z_PARAM_LONG(mode)
|
||||||
|
Z_PARAM_LONG(startpos)
|
||||||
|
ZEND_PARSE_PARAMETERS_END();
|
||||||
|
|
||||||
GET_FTPBUF(ftp, z_ftp);
|
GET_FTPBUF(ftp, z_ftp);
|
||||||
php_stream_from_res(stream, Z_RES_P(z_file));
|
|
||||||
XTYPE(xtype, mode);
|
XTYPE(xtype, mode);
|
||||||
|
|
||||||
/* ignore autoresume if autoseek is switched off */
|
/* ignore autoresume if autoseek is switched off */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue