iliaa Fri Feb 14 15:15:11 2003 EDT Modified files: /php4/ext/ftp ftp.c php_ftp.c Log: CS fixes. Index: php4/ext/ftp/ftp.c diff -u php4/ext/ftp/ftp.c:1.78 php4/ext/ftp/ftp.c:1.79 --- php4/ext/ftp/ftp.c:1.78 Thu Feb 13 17:20:21 2003 +++ php4/ext/ftp/ftp.c Fri Feb 14 15:15:11 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: ftp.c,v 1.78 2003/02/13 22:20:21 pollita Exp $ */ +/* $Id: ftp.c,v 1.79 2003/02/14 20:15:11 iliaa Exp $ */ #include "php.h" @@ -154,8 +154,9 @@ return ftp; bail: - if (ftp->fd != -1) + if (ftp->fd != -1) { closesocket(ftp->fd); + } efree(ftp); return NULL; } @@ -191,9 +192,9 @@ void ftp_gc(ftpbuf_t *ftp) { - if (ftp == NULL) + if (ftp == NULL) { return; - + } if (ftp->pwd) { efree(ftp->pwd); } @@ -208,13 +209,16 @@ int ftp_quit(ftpbuf_t *ftp) { - if (ftp == NULL) + if (ftp == NULL) { return 0; + } - if (!ftp_putcmd(ftp, "QUIT", NULL)) + if (!ftp_putcmd(ftp, "QUIT", NULL)) { return 0; - if (!ftp_getresp(ftp) || ftp->resp != 221) + } + if (!ftp_getresp(ftp) || ftp->resp != 221) { return 0; + } if (ftp->pwd) { efree(ftp->pwd); @@ -265,13 +269,13 @@ if (ftp->use_ssl) { ctx = SSL_CTX_new(SSLv23_client_method()); if (ctx == NULL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "ftp_login: failed to create the SSL context"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to +create the SSL context"); return 0; } ftp->ssl_handle = SSL_new(ctx); if (ftp->ssl_handle == NULL) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "ftp_login: failed to create the SSL handle"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "failed to +create the SSL handle"); SSL_CTX_free(ctx); return 0; } @@ -279,7 +283,7 @@ SSL_set_fd(ftp->ssl_handle, ftp->fd); if (SSL_connect(ftp->ssl_handle) <= 0) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "ftp_login: SSL/TLS handshake failed"); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "SSL/TLS +handshake failed"); SSL_shutdown(ftp->ssl_handle); return 0; } @@ -361,10 +365,11 @@ const char* ftp_syst(ftpbuf_t *ftp) { - char *syst, *end; + char *syst, *end; - if (ftp == NULL) + if (ftp == NULL) { return NULL; + } /* default to cached value */ if (ftp->syst) { @@ -393,7 +398,7 @@ const char* ftp_pwd(ftpbuf_t *ftp) { - char *pwd, *end; + char *pwd, *end; if (ftp == NULL) { return NULL; @@ -473,8 +478,9 @@ return 0; } - if (ftp->pwd) + if (ftp->pwd) { efree(ftp->pwd); + } if (!ftp_putcmd(ftp, "CWD", dir)) { return 0; @@ -495,8 +501,9 @@ return 0; } - if (ftp->pwd) + if (ftp->pwd) { efree(ftp->pwd); + } if (!ftp_putcmd(ftp, "CDUP", NULL)) { return 0; @@ -513,7 +520,7 @@ char* ftp_mkdir(ftpbuf_t *ftp, const char *dir) { - char *mkd, *end; + char *mkd, *end; if (ftp == NULL) { return NULL; @@ -614,7 +621,7 @@ int ftp_type(ftpbuf_t *ftp, ftptype_t type) { - char typechar[2] = "?"; + char typechar[2] = "?"; if (ftp == NULL) { return 0; @@ -797,12 +804,13 @@ lastch = *ptr; } } else if (rcvd != php_stream_write(outstream, data->buf, rcvd)) { - goto bail; + goto bail; } } - if (type == FTPTYPE_ASCII && lastch == '\r') + if (type == FTPTYPE_ASCII && lastch == '\r') { php_stream_putc(outstream, '\r'); + } data = data_close(ftp, data); ftp->data = NULL; @@ -855,21 +863,24 @@ } } - if (!ftp_putcmd(ftp, "STOR", path)) + if (!ftp_putcmd(ftp, "STOR", path)) { goto bail; - if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125)) + } + if (!ftp_getresp(ftp) || (ftp->resp != 150 && ftp->resp != 125)) { goto bail; - - if ((data = data_accept(data, ftp)) == NULL) + } + if ((data = data_accept(data, ftp)) == NULL) { goto bail; + } size = 0; ptr = data->buf; while (!php_stream_eof(instream) && (ch = php_stream_getc(instream))!=EOF) { /* flush if necessary */ if (FTP_BUFSIZE - size < 2) { - if (my_send(ftp, data->fd, data->buf, size) != size) + if (my_send(ftp, data->fd, data->buf, size) != size) { goto bail; + } ptr = data->buf; size = 0; } @@ -1119,7 +1130,9 @@ { char *buf; - if (ftp == NULL) return 0; + if (ftp == NULL) { + return 0; + } buf = ftp->inbuf; ftp->resp = 0; Index: php4/ext/ftp/php_ftp.c diff -u php4/ext/ftp/php_ftp.c:1.82 php4/ext/ftp/php_ftp.c:1.83 --- php4/ext/ftp/php_ftp.c:1.82 Thu Jan 30 23:54:57 2003 +++ php4/ext/ftp/php_ftp.c Fri Feb 14 15:15:11 2003 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_ftp.c,v 1.82 2003/01/31 04:54:57 pollita Exp $ */ +/* $Id: php_ftp.c,v 1.83 2003/02/14 20:15:11 iliaa Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -160,8 +160,7 @@ } /* connect */ - ftp = ftp_open(host, (short)port, timeout_sec TSRMLS_CC); - if (ftp == NULL) { + if (!(ftp = ftp_open(host, (short)port, timeout_sec TSRMLS_CC))) { RETURN_FALSE; } @@ -196,8 +195,7 @@ } /* connect */ - ftp = ftp_open(host, (short)port, timeout_sec TSRMLS_CC); - if (ftp == NULL) { + if (!(ftp = ftp_open(host, (short)port, timeout_sec TSRMLS_CC))) { RETURN_FALSE; } @@ -250,8 +248,7 @@ ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf); - pwd = ftp_pwd(ftp); - if (pwd == NULL) { + if (!(pwd = ftp_pwd(ftp))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", ftp->inbuf); RETURN_FALSE; } @@ -891,9 +888,7 @@ ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf); XTYPE(xtype, mode); - instream = php_stream_fopen(local, "rb", NULL); - - if (instream == NULL) { + if (!(instream = php_stream_fopen(local, "rb", NULL))) { RETURN_FALSE; } @@ -945,9 +940,7 @@ ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf); XTYPE(xtype, mode); - instream = php_stream_fopen(local, "rb", NULL); - - if (instream == NULL) { + if (!(instream = php_stream_fopen(local, "rb", NULL))) { RETURN_FALSE; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php