diff options
Diffstat (limited to 'ext/standard/ftp_fopen_wrapper.c')
| -rw-r--r-- | ext/standard/ftp_fopen_wrapper.c | 158 |
1 files changed, 79 insertions, 79 deletions
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index 526a45b470..361019382e 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -70,7 +70,7 @@ #include "php_fopen_wrappers.h" #define FTPS_ENCRYPT_DATA 1 -#define GET_FTP_RESULT(stream) get_ftp_result((stream), tmp_line, sizeof(tmp_line) TSRMLS_CC) +#define GET_FTP_RESULT(stream) get_ftp_result((stream), tmp_line, sizeof(tmp_line)) typedef struct _php_ftp_dirstream_data { php_stream *datastream; @@ -80,7 +80,7 @@ typedef struct _php_ftp_dirstream_data { /* {{{ get_ftp_result */ -static inline int get_ftp_result(php_stream *stream, char *buffer, size_t buffer_size TSRMLS_DC) +static inline int get_ftp_result(php_stream *stream, char *buffer, size_t buffer_size) { while (php_stream_gets(stream, buffer, buffer_size-1) && !(isdigit((int) buffer[0]) && isdigit((int) buffer[1]) && @@ -91,7 +91,7 @@ static inline int get_ftp_result(php_stream *stream, char *buffer, size_t buffer /* {{{ php_stream_ftp_stream_stat */ -static int php_stream_ftp_stream_stat(php_stream_wrapper *wrapper, php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC) +static int php_stream_ftp_stream_stat(php_stream_wrapper *wrapper, php_stream *stream, php_stream_statbuf *ssb) { /* For now, we return with a failure code to prevent the underlying * file's details from being used instead. */ @@ -101,7 +101,7 @@ static int php_stream_ftp_stream_stat(php_stream_wrapper *wrapper, php_stream *s /* {{{ php_stream_ftp_stream_close */ -static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper, php_stream *stream TSRMLS_DC) +static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper, php_stream *stream) { php_stream *controlstream = stream->wrapperthis; int ret = 0; @@ -114,7 +114,7 @@ static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper, php_stream * /* For write modes close data stream first to signal EOF to server */ result = GET_FTP_RESULT(controlstream); if (result != 226 && result != 250) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "FTP server error %d:%s", result, tmp_line); + php_error_docref(NULL, E_WARNING, "FTP server error %d:%s", result, tmp_line); ret = EOF; } } @@ -132,7 +132,7 @@ static int php_stream_ftp_stream_close(php_stream_wrapper *wrapper, php_stream * */ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context, php_stream **preuseid, - php_url **presource, int *puse_ssl, int *puse_ssl_on_data TSRMLS_DC) + php_url **presource, int *puse_ssl, int *puse_ssl_on_data) { php_stream *stream = NULL, *reuseid = NULL; php_url *resource = NULL; @@ -163,7 +163,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char goto connect_errexit; } - php_stream_context_set(stream, context TSRMLS_CC); + php_stream_context_set(stream, context); php_stream_notify_info(context, PHP_STREAM_NOTIFY_CONNECT, NULL, 0); /* Start talking to ftp server */ @@ -203,9 +203,9 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char if (use_ssl) { if (php_stream_xport_crypto_setup(stream, - STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 - || php_stream_xport_crypto_enable(stream, 1 TSRMLS_CC) < 0) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to activate SSL mode"); + STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL) < 0 + || php_stream_xport_crypto_enable(stream, 1) < 0) { + php_stream_wrapper_log_error(wrapper, options, "Unable to activate SSL mode"); php_stream_close(stream); stream = NULL; goto connect_errexit; @@ -236,7 +236,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char unsigned char *s = val, *e = s + val_len; \ while (s < e) { \ if (iscntrl(*s)) { \ - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, err_msg, val); \ + php_stream_wrapper_log_error(wrapper, options, err_msg, val); \ goto connect_errexit; \ } \ s++; \ @@ -249,7 +249,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char PHP_FTP_CNTRL_CHK(resource->user, tmp_len, "Invalid login %s") - php_stream_printf(stream TSRMLS_CC, "USER %s\r\n", resource->user); + php_stream_printf(stream, "USER %s\r\n", resource->user); } else { php_stream_write_string(stream, "USER anonymous\r\n"); } @@ -266,12 +266,12 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char PHP_FTP_CNTRL_CHK(resource->pass, tmp_len, "Invalid password %s") - php_stream_printf(stream TSRMLS_CC, "PASS %s\r\n", resource->pass); + php_stream_printf(stream, "PASS %s\r\n", resource->pass); } else { /* if the user has configured who they are, send that as the password */ if (FG(from_address)) { - php_stream_printf(stream TSRMLS_CC, "PASS %s\r\n", FG(from_address)); + php_stream_printf(stream, "PASS %s\r\n", FG(from_address)); } else { php_stream_write_string(stream, "PASS anonymous\r\n"); } @@ -320,7 +320,7 @@ connect_errexit: /* {{{ php_fopen_do_pasv */ -static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, size_t ip_size, char **phoststart TSRMLS_DC) +static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, size_t ip_size, char **phoststart) { char tmp_line[512]; int result, i; @@ -412,7 +412,7 @@ static unsigned short php_fopen_do_pasv(php_stream *stream, char *ip, size_t ip_ /* {{{ php_fopen_url_wrap_ftp */ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *path, const char *mode, - int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) + int options, char **opened_path, php_stream_context *context STREAMS_DC) { php_stream *stream = NULL, *datastream = NULL; php_url *resource = NULL; @@ -436,7 +436,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa } if (strpbrk(mode, "wa+")) { if (read_write) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP does not support simultaneous read/write connections"); + php_stream_wrapper_log_error(wrapper, options, "FTP does not support simultaneous read/write connections"); return NULL; } if (strchr(mode, 'a')) { @@ -447,7 +447,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa } if (!read_write) { /* No mode specified? */ - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unknown file open mode"); + php_stream_wrapper_log_error(wrapper, options, "Unknown file open mode"); return NULL; } @@ -455,15 +455,15 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa (tmpzval = php_stream_context_get_option(context, "ftp", "proxy")) != NULL) { if (read_write == 1) { /* Use http wrapper to proxy ftp request */ - return php_stream_url_wrap_http(wrapper, path, mode, options, opened_path, context STREAMS_CC TSRMLS_CC); + return php_stream_url_wrap_http(wrapper, path, mode, options, opened_path, context STREAMS_CC); } else { /* ftp proxy is read-only */ - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP proxy may only be used in read mode"); + php_stream_wrapper_log_error(wrapper, options, "FTP proxy may only be used in read mode"); return NULL; } } - stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &resource, &use_ssl, &use_ssl_on_data TSRMLS_CC); + stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &resource, &use_ssl, &use_ssl_on_data); if (!stream) { goto errexit; } @@ -475,7 +475,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa goto errexit; /* find out the size of the file (verifying it exists) */ - php_stream_printf(stream TSRMLS_CC, "SIZE %s\r\n", resource->path); + php_stream_printf(stream, "SIZE %s\r\n", resource->path); /* read the response */ result = GET_FTP_RESULT(stream); @@ -504,13 +504,13 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa if (allow_overwrite) { /* Context permits overwriting file, so we just delete whatever's there in preparation */ - php_stream_printf(stream TSRMLS_CC, "DELE %s\r\n", resource->path); + php_stream_printf(stream, "DELE %s\r\n", resource->path); result = GET_FTP_RESULT(stream); if (result >= 300 || result <= 199) { goto errexit; } } else { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Remote file already exists and overwrite context option not specified"); + php_stream_wrapper_log_error(wrapper, options, "Remote file already exists and overwrite context option not specified"); errno = EEXIST; goto errexit; } @@ -518,7 +518,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa } /* set up the passive connection */ - portno = php_fopen_do_pasv(stream, ip, sizeof(ip), &hoststart TSRMLS_CC); + portno = php_fopen_do_pasv(stream, ip, sizeof(ip), &hoststart); if (!portno) { goto errexit; @@ -531,10 +531,10 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa (tmpzval = php_stream_context_get_option(context, "ftp", "resume_pos")) != NULL && Z_TYPE_P(tmpzval) == IS_LONG && Z_LVAL_P(tmpzval) > 0) { - php_stream_printf(stream TSRMLS_CC, "REST %pd\r\n", Z_LVAL_P(tmpzval)); + php_stream_printf(stream, "REST %pd\r\n", Z_LVAL_P(tmpzval)); result = GET_FTP_RESULT(stream); if (result < 300 || result > 399) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to resume from offset %pd", Z_LVAL_P(tmpzval)); + php_stream_wrapper_log_error(wrapper, options, "Unable to resume from offset %pd", Z_LVAL_P(tmpzval)); goto errexit; } } @@ -548,7 +548,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa /* Append */ memcpy(tmp_line, "APPE", sizeof("APPE")); } - php_stream_printf(stream TSRMLS_CC, "%s %s\r\n", tmp_line, (resource->path != NULL ? resource->path : "/")); + php_stream_printf(stream, "%s %s\r\n", tmp_line, (resource->path != NULL ? resource->path : "/")); /* open the data channel */ if (hoststart == NULL) { @@ -571,14 +571,14 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa goto errexit; } - php_stream_context_set(datastream, context TSRMLS_CC); + php_stream_context_set(datastream, context); php_stream_notify_progress_init(context, 0, file_size); if (use_ssl_on_data && (php_stream_xport_crypto_setup(datastream, - STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 || - php_stream_xport_crypto_enable(datastream, 1 TSRMLS_CC) < 0)) { + STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL) < 0 || + php_stream_xport_crypto_enable(datastream, 1) < 0)) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to activate SSL mode"); + php_stream_wrapper_log_error(wrapper, options, "Unable to activate SSL mode"); php_stream_close(datastream); datastream = NULL; goto errexit; @@ -599,14 +599,14 @@ errexit: php_stream_close(stream); } if (tmp_line[0] != '\0') - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP server reports %s", tmp_line); + php_stream_wrapper_log_error(wrapper, options, "FTP server reports %s", tmp_line); return NULL; } /* }}} */ /* {{{ php_ftp_dirsteam_read */ -static size_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC) +static size_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count) { php_stream_dirent *ent = (php_stream_dirent *)buf; php_stream *innerstream; @@ -627,7 +627,7 @@ static size_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count return 0; } - basename = php_basename(ent->d_name, tmp_len, NULL, 0 TSRMLS_CC); + basename = php_basename(ent->d_name, tmp_len, NULL, 0); tmp_len = MIN(sizeof(ent->d_name), basename->len - 1); memcpy(ent->d_name, basename->val, tmp_len); @@ -647,7 +647,7 @@ static size_t php_ftp_dirstream_read(php_stream *stream, char *buf, size_t count /* {{{ php_ftp_dirstream_close */ -static int php_ftp_dirstream_close(php_stream *stream, int close_handle TSRMLS_DC) +static int php_ftp_dirstream_close(php_stream *stream, int close_handle) { php_ftp_dirstream_data *data = stream->abstract; @@ -684,7 +684,7 @@ static php_stream_ops php_ftp_dirstream_ops = { /* {{{ php_stream_ftp_opendir */ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, - char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) + char **opened_path, php_stream_context *context STREAMS_DC) { php_stream *stream, *reuseid, *datastream = NULL; php_ftp_dirstream_data *dirsdata; @@ -696,7 +696,7 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *pat tmp_line[0] = '\0'; - stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &resource, &use_ssl, &use_ssl_on_data TSRMLS_CC); + stream = php_ftp_fopen_connect(wrapper, path, mode, options, opened_path, context, &reuseid, &resource, &use_ssl, &use_ssl_on_data); if (!stream) { goto opendir_errexit; } @@ -708,13 +708,13 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *pat goto opendir_errexit; /* set up the passive connection */ - portno = php_fopen_do_pasv(stream, ip, sizeof(ip), &hoststart TSRMLS_CC); + portno = php_fopen_do_pasv(stream, ip, sizeof(ip), &hoststart); if (!portno) { goto opendir_errexit; } - php_stream_printf(stream TSRMLS_CC, "NLST %s\r\n", (resource->path != NULL ? resource->path : "/")); + php_stream_printf(stream, "NLST %s\r\n", (resource->path != NULL ? resource->path : "/")); /* open the data channel */ if (hoststart == NULL) { @@ -735,13 +735,13 @@ php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const char *pat goto opendir_errexit; } - php_stream_context_set(datastream, context TSRMLS_CC); + php_stream_context_set(datastream, context); if (use_ssl_on_data && (php_stream_xport_crypto_setup(stream, - STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL TSRMLS_CC) < 0 || - php_stream_xport_crypto_enable(stream, 1 TSRMLS_CC) < 0)) { + STREAM_CRYPTO_METHOD_SSLv23_CLIENT, NULL) < 0 || + php_stream_xport_crypto_enable(stream, 1) < 0)) { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "Unable to activate SSL mode"); + php_stream_wrapper_log_error(wrapper, options, "Unable to activate SSL mode"); php_stream_close(datastream); datastream = NULL; goto opendir_errexit; @@ -765,7 +765,7 @@ opendir_errexit: php_stream_close(stream); } if (tmp_line[0] != '\0') { - php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "FTP server reports %s", tmp_line); + php_stream_wrapper_log_error(wrapper, options, "FTP server reports %s", tmp_line); } return NULL; } @@ -773,7 +773,7 @@ opendir_errexit: /* {{{ php_stream_ftp_url_stat */ -static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) +static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context) { php_stream *stream = NULL; php_url *resource = NULL; @@ -783,13 +783,13 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url, /* If ssb is NULL then someone is misbehaving */ if (!ssb) return -1; - stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, context, NULL, &resource, NULL, NULL TSRMLS_CC); + stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, context, NULL, &resource, NULL, NULL); if (!stream) { goto stat_errexit; } ssb->sb.st_mode = 0644; /* FTP won't give us a valid mode, so approximate one based on being readable */ - php_stream_printf(stream TSRMLS_CC, "CWD %s\r\n", (resource->path != NULL ? resource->path : "/")); /* If we can CWD to it, it's a directory (maybe a link, but we can't tell) */ + php_stream_printf(stream, "CWD %s\r\n", (resource->path != NULL ? resource->path : "/")); /* If we can CWD to it, it's a directory (maybe a link, but we can't tell) */ result = GET_FTP_RESULT(stream); if (result < 200 || result > 299) { ssb->sb.st_mode |= S_IFREG; @@ -805,7 +805,7 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url, goto stat_errexit; } - php_stream_printf(stream TSRMLS_CC, "SIZE %s\r\n", (resource->path != NULL ? resource->path : "/")); + php_stream_printf(stream, "SIZE %s\r\n", (resource->path != NULL ? resource->path : "/")); result = GET_FTP_RESULT(stream); if (result < 200 || result > 299) { /* Failure either means it doesn't exist @@ -820,7 +820,7 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url, ssb->sb.st_size = atoi(tmp_line + 4); } - php_stream_printf(stream TSRMLS_CC, "MDTM %s\r\n", (resource->path != NULL ? resource->path : "/")); + php_stream_printf(stream, "MDTM %s\r\n", (resource->path != NULL ? resource->path : "/")); result = GET_FTP_RESULT(stream); if (result == 213) { char *p = tmp_line + 4; @@ -896,35 +896,35 @@ stat_errexit: /* {{{ php_stream_ftp_unlink */ -static int php_stream_ftp_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) +static int php_stream_ftp_unlink(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context) { php_stream *stream = NULL; php_url *resource = NULL; int result; char tmp_line[512]; - stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, NULL, NULL, &resource, NULL, NULL TSRMLS_CC); + stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, NULL, NULL, &resource, NULL, NULL); if (!stream) { if (options & REPORT_ERRORS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect to %s", url); + php_error_docref(NULL, E_WARNING, "Unable to connect to %s", url); } goto unlink_errexit; } if (resource->path == NULL) { if (options & REPORT_ERRORS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path provided in %s", url); + php_error_docref(NULL, E_WARNING, "Invalid path provided in %s", url); } goto unlink_errexit; } /* Attempt to delete the file */ - php_stream_printf(stream TSRMLS_CC, "DELE %s\r\n", (resource->path != NULL ? resource->path : "/")); + php_stream_printf(stream, "DELE %s\r\n", (resource->path != NULL ? resource->path : "/")); result = GET_FTP_RESULT(stream); if (result < 200 || result > 299) { if (options & REPORT_ERRORS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error Deleting file: %s", tmp_line); + php_error_docref(NULL, E_WARNING, "Error Deleting file: %s", tmp_line); } goto unlink_errexit; } @@ -946,7 +946,7 @@ unlink_errexit: /* {{{ php_stream_ftp_rename */ -static int php_stream_ftp_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context TSRMLS_DC) +static int php_stream_ftp_rename(php_stream_wrapper *wrapper, const char *url_from, const char *url_to, int options, php_stream_context *context) { php_stream *stream = NULL; php_url *resource_from = NULL, *resource_to = NULL; @@ -974,32 +974,32 @@ static int php_stream_ftp_rename(php_stream_wrapper *wrapper, const char *url_fr goto rename_errexit; } - stream = php_ftp_fopen_connect(wrapper, url_from, "r", 0, NULL, NULL, NULL, NULL, NULL, NULL TSRMLS_CC); + stream = php_ftp_fopen_connect(wrapper, url_from, "r", 0, NULL, NULL, NULL, NULL, NULL, NULL); if (!stream) { if (options & REPORT_ERRORS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect to %s", resource_from->host); + php_error_docref(NULL, E_WARNING, "Unable to connect to %s", resource_from->host); } goto rename_errexit; } /* Rename FROM */ - php_stream_printf(stream TSRMLS_CC, "RNFR %s\r\n", (resource_from->path != NULL ? resource_from->path : "/")); + php_stream_printf(stream, "RNFR %s\r\n", (resource_from->path != NULL ? resource_from->path : "/")); result = GET_FTP_RESULT(stream); if (result < 300 || result > 399) { if (options & REPORT_ERRORS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error Renaming file: %s", tmp_line); + php_error_docref(NULL, E_WARNING, "Error Renaming file: %s", tmp_line); } goto rename_errexit; } /* Rename TO */ - php_stream_printf(stream TSRMLS_CC, "RNTO %s\r\n", (resource_to->path != NULL ? resource_to->path : "/")); + php_stream_printf(stream, "RNTO %s\r\n", (resource_to->path != NULL ? resource_to->path : "/")); result = GET_FTP_RESULT(stream); if (result < 200 || result > 299) { if (options & REPORT_ERRORS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error Renaming file: %s", tmp_line); + php_error_docref(NULL, E_WARNING, "Error Renaming file: %s", tmp_line); } goto rename_errexit; } @@ -1025,30 +1025,30 @@ rename_errexit: /* {{{ php_stream_ftp_mkdir */ -static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, const char *url, int mode, int options, php_stream_context *context TSRMLS_DC) +static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, const char *url, int mode, int options, php_stream_context *context) { php_stream *stream = NULL; php_url *resource = NULL; int result, recursive = options & PHP_STREAM_MKDIR_RECURSIVE; char tmp_line[512]; - stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, NULL, NULL, &resource, NULL, NULL TSRMLS_CC); + stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, NULL, NULL, &resource, NULL, NULL); if (!stream) { if (options & REPORT_ERRORS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect to %s", url); + php_error_docref(NULL, E_WARNING, "Unable to connect to %s", url); } goto mkdir_errexit; } if (resource->path == NULL) { if (options & REPORT_ERRORS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path provided in %s", url); + php_error_docref(NULL, E_WARNING, "Invalid path provided in %s", url); } goto mkdir_errexit; } if (!recursive) { - php_stream_printf(stream TSRMLS_CC, "MKD %s\r\n", resource->path); + php_stream_printf(stream, "MKD %s\r\n", resource->path); result = GET_FTP_RESULT(stream); } else { /* we look for directory separator from the end of string, thus hopefuly reducing our work load */ @@ -1060,7 +1060,7 @@ static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, const char *url, in /* find a top level directory we need to create */ while ((p = strrchr(buf, '/'))) { *p = '\0'; - php_stream_printf(stream TSRMLS_CC, "CWD %s\r\n", buf); + php_stream_printf(stream, "CWD %s\r\n", buf); result = GET_FTP_RESULT(stream); if (result >= 200 && result <= 299) { *p = '/'; @@ -1068,10 +1068,10 @@ static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, const char *url, in } } if (p == buf) { - php_stream_printf(stream TSRMLS_CC, "MKD %s\r\n", resource->path); + php_stream_printf(stream, "MKD %s\r\n", resource->path); result = GET_FTP_RESULT(stream); } else { - php_stream_printf(stream TSRMLS_CC, "MKD %s\r\n", buf); + php_stream_printf(stream, "MKD %s\r\n", buf); result = GET_FTP_RESULT(stream); if (result >= 200 && result <= 299) { if (!p) { @@ -1081,11 +1081,11 @@ static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, const char *url, in while (++p != e) { if (*p == '\0' && *(p + 1) != '\0') { *p = '/'; - php_stream_printf(stream TSRMLS_CC, "MKD %s\r\n", buf); + php_stream_printf(stream, "MKD %s\r\n", buf); result = GET_FTP_RESULT(stream); if (result < 200 || result > 299) { if (options & REPORT_ERRORS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", tmp_line); + php_error_docref(NULL, E_WARNING, "%s", tmp_line); } break; } @@ -1119,34 +1119,34 @@ mkdir_errexit: /* {{{ php_stream_ftp_rmdir */ -static int php_stream_ftp_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context TSRMLS_DC) +static int php_stream_ftp_rmdir(php_stream_wrapper *wrapper, const char *url, int options, php_stream_context *context) { php_stream *stream = NULL; php_url *resource = NULL; int result; char tmp_line[512]; - stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, NULL, NULL, &resource, NULL, NULL TSRMLS_CC); + stream = php_ftp_fopen_connect(wrapper, url, "r", 0, NULL, NULL, NULL, &resource, NULL, NULL); if (!stream) { if (options & REPORT_ERRORS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to connect to %s", url); + php_error_docref(NULL, E_WARNING, "Unable to connect to %s", url); } goto rmdir_errexit; } if (resource->path == NULL) { if (options & REPORT_ERRORS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid path provided in %s", url); + php_error_docref(NULL, E_WARNING, "Invalid path provided in %s", url); } goto rmdir_errexit; } - php_stream_printf(stream TSRMLS_CC, "RMD %s\r\n", resource->path); + php_stream_printf(stream, "RMD %s\r\n", resource->path); result = GET_FTP_RESULT(stream); if (result < 200 || result > 299) { if (options & REPORT_ERRORS) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", tmp_line); + php_error_docref(NULL, E_WARNING, "%s", tmp_line); } goto rmdir_errexit; } |
