@@ -612,16 +612,16 @@ ftp_chmod(ftpbuf_t *ftp, const int mode, const char *filename, const int filenam
612
612
/* {{{ ftp_alloc
613
613
*/
614
614
int
615
- ftp_alloc (ftpbuf_t * ftp , const int size , char * * response )
615
+ ftp_alloc (ftpbuf_t * ftp , const long size , char * * response )
616
616
{
617
617
char buffer [64 ];
618
618
619
619
if (ftp == NULL || size <= 0 ) {
620
620
return 0 ;
621
621
}
622
622
623
- snprintf (buffer , sizeof (buffer ) - 1 , "%d " , size );
624
-
623
+ snprintf (buffer , sizeof (buffer ) - 1 , "%ld " , size );
624
+
625
625
if (!ftp_putcmd (ftp , "ALLO" , buffer )) {
626
626
return 0 ;
627
627
}
@@ -787,7 +787,7 @@ ftp_pasv(ftpbuf_t *ftp, int pasv)
787
787
/* {{{ ftp_get
788
788
*/
789
789
int
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 )
791
791
{
792
792
databuf_t * data = NULL ;
793
793
int lastch ;
@@ -808,11 +808,7 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
808
808
ftp -> data = data ;
809
809
810
810
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 );
816
812
if (!ftp_putcmd (ftp , "REST" , arg )) {
817
813
goto bail ;
818
814
}
@@ -885,10 +881,10 @@ ftp_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t type,
885
881
/* {{{ ftp_put
886
882
*/
887
883
int
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 )
889
885
{
890
886
databuf_t * data = NULL ;
891
- int size ;
887
+ long size ;
892
888
char * ptr ;
893
889
int ch ;
894
890
char arg [11 ];
@@ -905,11 +901,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, i
905
901
ftp -> data = data ;
906
902
907
903
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 );
913
905
if (!ftp_putcmd (ftp , "REST" , arg )) {
914
906
goto bail ;
915
907
}
@@ -966,7 +958,7 @@ ftp_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type, i
966
958
967
959
/* {{{ ftp_size
968
960
*/
969
- int
961
+ long
970
962
ftp_size (ftpbuf_t * ftp , const char * path )
971
963
{
972
964
if (ftp == NULL ) {
@@ -981,7 +973,7 @@ ftp_size(ftpbuf_t *ftp, const char *path)
981
973
if (!ftp_getresp (ftp ) || ftp -> resp != 213 ) {
982
974
return -1 ;
983
975
}
984
- return atoi (ftp -> inbuf );
976
+ return atol (ftp -> inbuf );
985
977
}
986
978
/* }}} */
987
979
@@ -1143,7 +1135,7 @@ ftp_putcmd(ftpbuf_t *ftp, const char *cmd, const char *args)
1143
1135
int
1144
1136
ftp_readline (ftpbuf_t * ftp )
1145
1137
{
1146
- int size , rcvd ;
1138
+ long size , rcvd ;
1147
1139
char * data , * eol ;
1148
1140
1149
1141
/* shift the extra to the front */
@@ -1236,7 +1228,8 @@ ftp_getresp(ftpbuf_t *ftp)
1236
1228
int
1237
1229
my_send (ftpbuf_t * ftp , php_socket_t s , void * buf , size_t len )
1238
1230
{
1239
- int n , size , sent ;
1231
+ long size , sent ;
1232
+ int n ;
1240
1233
1241
1234
size = len ;
1242
1235
while (size ) {
@@ -1719,7 +1712,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC)
1719
1712
/* {{{ ftp_nb_get
1720
1713
*/
1721
1714
int
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 )
1723
1716
{
1724
1717
databuf_t * data = NULL ;
1725
1718
char arg [11 ];
@@ -1737,14 +1730,7 @@ ftp_nb_get(ftpbuf_t *ftp, php_stream *outstream, const char *path, ftptype_t typ
1737
1730
}
1738
1731
1739
1732
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 );
1748
1734
if (!ftp_putcmd (ftp , "REST" , arg )) {
1749
1735
goto bail ;
1750
1736
}
@@ -1843,7 +1829,7 @@ ftp_nb_continue_read(ftpbuf_t *ftp TSRMLS_DC)
1843
1829
/* {{{ ftp_nb_put
1844
1830
*/
1845
1831
int
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 )
1847
1833
{
1848
1834
databuf_t * data = NULL ;
1849
1835
char arg [11 ];
@@ -1858,11 +1844,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
1858
1844
goto bail ;
1859
1845
}
1860
1846
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 );
1866
1848
if (!ftp_putcmd (ftp , "REST" , arg )) {
1867
1849
goto bail ;
1868
1850
}
@@ -1899,7 +1881,7 @@ ftp_nb_put(ftpbuf_t *ftp, const char *path, php_stream *instream, ftptype_t type
1899
1881
int
1900
1882
ftp_nb_continue_write (ftpbuf_t * ftp TSRMLS_DC )
1901
1883
{
1902
- int size ;
1884
+ long size ;
1903
1885
char * ptr ;
1904
1886
int ch ;
1905
1887
0 commit comments