@@ -612,16 +612,16 @@ ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int filenam
612612/* {{{ ftp_alloc
613613 */
614614int
615- ftp_alloc (ftpbuf_t * ftp , const int size , char * * response )
615+ ftp_alloc (ftpbuf_t * ftp , const long size , char * * response )
616616{
617617 char buffer [64 ];
618618
619619 if (ftp == NULL || size <= 0 ) {
620620 return 0 ;
621621 }
622622
623- snprintf (buffer , sizeof (buffer ) - 1 , "%d " , size );
624-
623+ snprintf (buffer , sizeof (buffer ) - 1 , "%ld " , size );
624+
625625 if (!ftp_putcmd (ftp , "ALLO" , buffer )) {
626626 return 0 ;
627627 }
@@ -787,7 +787,7 @@ ftp_pasv(ftpbuf_t *ftp, int pasv)
787787/* {{{ ftp_get
788788 */
789789int
790- ftp_get (ftpbuf_t * ftp , php_stream * outstream , const char * path , ftptype_t type , int resumepos TSRMLS_DC )
790+ ftp_get (ftpbuf_t * ftp , php_stream * outstream , const char * path , ftptype_t type , long resumepos TSRMLS_DC )
791791{
792792 databuf_t * data = NULL ;
793793 int lastch ;
@@ -808,11 +808,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
808808 ftp -> data = data ;
809809
810810 if (resumepos > 0 ) {
811- if (resumepos > 2147483647 ) {
812- php_error_docref (NULL TSRMLS_CC , E_WARNING , "PHP cannot handle files greater than 2147483647 bytes." );
813- goto bail ;
814- }
815- snprintf (arg , sizeof (arg ), "%u" , resumepos );
811+ snprintf (arg , sizeof (arg ), "%ld" , resumepos );
816812 if (!ftp_putcmd (ftp , "REST" , arg )) {
817813 goto bail ;
818814 }
@@ -885,10 +881,10 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
885881/* {{{ ftp_put
886882 */
887883int
888- ftp_put (ftpbuf_t * ftp , const char * path , php_stream * instream , ftptype_t type , int startpos TSRMLS_DC )
884+ ftp_put (ftpbuf_t * ftp , const char * path , php_stream * instream , ftptype_t type , long startpos TSRMLS_DC )
889885{
890886 databuf_t * data = NULL ;
891- int size ;
887+ long size ;
892888 char * ptr ;
893889 int ch ;
894890 char arg [11 ];
@@ -905,11 +901,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, i
905901 ftp -> data = data ;
906902
907903 if (startpos > 0 ) {
908- if (startpos > 2147483647 ) {
909- php_error_docref (NULL TSRMLS_CC , E_WARNING , "PHP cannot handle files with a size greater than 2147483647 bytes." );
910- goto bail ;
911- }
912- snprintf (arg , sizeof (arg ), "%u" , startpos );
904+ snprintf (arg , sizeof (arg ), "%ld" , startpos );
913905 if (!ftp_putcmd (ftp , "REST" , arg )) {
914906 goto bail ;
915907 }
@@ -966,7 +958,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, i
966958
967959/* {{{ ftp_size
968960 */
969- int
961+ long
970962ftp_size (ftpbuf_t * ftp , const char * path )
971963{
972964 if (ftp == NULL ) {
@@ -981,7 +973,7 @@ ftp_size(ftpbuf_t *ftp, const char *path)
981973 if (!ftp_getresp (ftp ) || ftp -> resp != 213 ) {
982974 return -1 ;
983975 }
984- return atoi (ftp -> inbuf );
976+ return atol (ftp -> inbuf );
985977}
986978/* }}} */
987979
@@ -1143,7 +1135,7 @@ ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args)
11431135int
11441136ftp_readline (ftpbuf_t * ftp )
11451137{
1146- int size , rcvd ;
1138+ long size , rcvd ;
11471139 char * data , * eol ;
11481140
11491141 /* shift the extra to the front */
@@ -1236,7 +1228,8 @@ ftp_getresp(ftpbuf_t *ftp)
12361228int
12371229my_send (ftpbuf_t * ftp , php_socket_t s , void * buf , size_t len )
12381230{
1239- int n , size , sent ;
1231+ long size , sent ;
1232+ int n ;
12401233
12411234 size = len ;
12421235 while (size ) {
@@ -1719,7 +1712,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
17191712/* {{{ ftp_nb_get
17201713 */
17211714int
1722- ftp_nb_get (ftpbuf_t * ftp , php_stream * outstream , const char * path , ftptype_t type , int resumepos TSRMLS_DC )
1715+ ftp_nb_get (ftpbuf_t * ftp , php_stream * outstream , const char * path , ftptype_t type , long resumepos TSRMLS_DC )
17231716{
17241717 databuf_t * data = NULL ;
17251718 char arg [11 ];
@@ -1737,14 +1730,7 @@ ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t typ
17371730 }
17381731
17391732 if (resumepos > 0 ) {
1740- /* We are working on an architecture that supports 64-bit integers
1741- * since php is 32 bit by design, we bail out with warning
1742- */
1743- if (resumepos > 2147483647 ) {
1744- php_error_docref (NULL TSRMLS_CC , E_WARNING , "PHP cannot handle files greater than 2147483648 bytes." );
1745- goto bail ;
1746- }
1747- snprintf (arg , sizeof (arg ), "%u" , resumepos );
1733+ snprintf (arg , sizeof (arg ), "%ld" , resumepos );
17481734 if (!ftp_putcmd (ftp , "REST" , arg )) {
17491735 goto bail ;
17501736 }
@@ -1843,7 +1829,7 @@ ftp_nb_continue_read(ftpbuf_t *ftp TSRMLS_DC)
18431829/* {{{ ftp_nb_put
18441830 */
18451831int
1846- ftp_nb_put (ftpbuf_t * ftp , const char * path , php_stream * instream , ftptype_t type , int startpos TSRMLS_DC )
1832+ ftp_nb_put (ftpbuf_t * ftp , const char * path , php_stream * instream , ftptype_t type , long startpos TSRMLS_DC )
18471833{
18481834 databuf_t * data = NULL ;
18491835 char arg [11 ];
@@ -1858,11 +1844,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
18581844 goto bail ;
18591845 }
18601846 if (startpos > 0 ) {
1861- if (startpos > 2147483647 ) {
1862- php_error_docref (NULL TSRMLS_CC , E_WARNING , "PHP cannot handle files with a size greater than 2147483647 bytes." );
1863- goto bail ;
1864- }
1865- snprintf (arg , sizeof (arg ), "%u" , startpos );
1847+ snprintf (arg , sizeof (arg ), "%ld" , startpos );
18661848 if (!ftp_putcmd (ftp , "REST" , arg )) {
18671849 goto bail ;
18681850 }
@@ -1899,7 +1881,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
18991881int
19001882ftp_nb_continue_write (ftpbuf_t * ftp TSRMLS_DC )
19011883{
1902- int size ;
1884+ long size ;
19031885 char * ptr ;
19041886 int ch ;
19051887
0 commit comments