mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-09 15:20:58 +00:00
Merge pull request #492 from bantu/sftp-large-file-comment
SFTP: Replace incorrect comment about filesize. There is no 4 GiB limit. * bantu/sftp-large-file-comment: SFTP: Replace incorrect comment about filesize. There is no 4 GiB limit.
This commit is contained in:
commit
1b57990e94
@ -2473,11 +2473,12 @@ class Net_SFTP extends Net_SSH2
|
|||||||
foreach ($this->attributes as $key => $value) {
|
foreach ($this->attributes as $key => $value) {
|
||||||
switch ($flags & $key) {
|
switch ($flags & $key) {
|
||||||
case NET_SFTP_ATTR_SIZE: // 0x00000001
|
case NET_SFTP_ATTR_SIZE: // 0x00000001
|
||||||
// size is represented by a 64-bit integer, so we perhaps ought to be doing the following:
|
// The size attribute is defined as an unsigned 64-bit integer.
|
||||||
// $attr['size'] = new Math_BigInteger($this->_string_shift($response, 8), 256);
|
// The following will use floats on 32-bit platforms, if necessary.
|
||||||
// of course, you shouldn't be using Net_SFTP to transfer files that are in excess of 4GB
|
// As can be seen in the BigInteger class, floats are generally
|
||||||
// (0xFFFFFFFF bytes), anyway. as such, we'll just represent all file sizes that are bigger than
|
// IEEE 754 binary64 "double precision" on such platforms and
|
||||||
// 4GB as being 4GB.
|
// as such can represent integers of at least 2^50 without loss
|
||||||
|
// of precision. Interpreted in filesize, 2^50 bytes = 1024 TiB.
|
||||||
extract(unpack('Nupper/Nsize', $this->_string_shift($response, 8)));
|
extract(unpack('Nupper/Nsize', $this->_string_shift($response, 8)));
|
||||||
$attr['size'] = $upper ? 4294967296 * $upper : 0;
|
$attr['size'] = $upper ? 4294967296 * $upper : 0;
|
||||||
$attr['size']+= $size < 0 ? ($size & 0x7FFFFFFF) + 0x80000000 : $size;
|
$attr['size']+= $size < 0 ? ($size & 0x7FFFFFFF) + 0x80000000 : $size;
|
||||||
|
Loading…
Reference in New Issue
Block a user