From a05376bca3649da9e8ca2c48836aad1d27f7d1db Mon Sep 17 00:00:00 2001 From: наб Date: Thu, 7 Nov 2024 12:46:19 +0000 Subject: Bump read()/write() loop buffers from 4k to APT_BUFFER_SIZE (64k). Bump FileFdPrivate's read()/discard buffer from 1k to APT_BUFFER_SIZE (64k) --- apt-pkg/contrib/fileutl.cc | 7 +++---- ftparchive/apt-ftparchive.cc | 2 +- methods/ftp.cc | 2 +- methods/rsh.cc | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index 262d1c8b3..4ad7b4cd5 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -1246,7 +1246,7 @@ public: } virtual bool InternalSkip(unsigned long long Over) { - unsigned long long constexpr buffersize = 1024; + unsigned long long constexpr buffersize = APT_BUFFER_SIZE; char buffer[buffersize]; while (Over != 0) { @@ -1273,11 +1273,10 @@ public: { unsigned long long size = 0; unsigned long long const oldSeek = filefd->Tell(); - unsigned long long constexpr ignoresize = 1024; - char ignore[ignoresize]; + char ignore[APT_BUFFER_SIZE]; unsigned long long read = 0; do { - if (filefd->Read(ignore, ignoresize, &read) == false) + if (filefd->Read(ignore, sizeof(ignore), &read) == false) { filefd->Seek(oldSeek); return 0; diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc index 5a915ff71..d1ecaa547 100644 --- a/ftparchive/apt-ftparchive.cc +++ b/ftparchive/apt-ftparchive.cc @@ -387,7 +387,7 @@ bool PackageMap::GenContents(Configuration &Setup, return false; unsigned long long Size = Head.Size(); - unsigned char Buf[4096]; + unsigned char Buf[APT_BUFFER_SIZE]; while (Size != 0) { unsigned long long ToRead = Size; diff --git a/methods/ftp.cc b/methods/ftp.cc index 379bf32b6..5ceae4d70 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -936,7 +936,7 @@ bool FTPConn::Get(const char *Path,FileFd &To,unsigned long long Resume, return false; // Copy loop - unsigned char Buffer[4096]; + unsigned char Buffer[APT_BUFFER_SIZE]; while (1) { // Wait for some data.. diff --git a/methods/rsh.cc b/methods/rsh.cc index 4432d5a5e..25d2a3286 100644 --- a/methods/rsh.cc +++ b/methods/rsh.cc @@ -357,7 +357,7 @@ bool RSHConn::Get(const char *Path,FileFd &To,unsigned long long Resume, // Copy loop unsigned long long MyLen = Resume; - unsigned char Buffer[4096]; + unsigned char Buffer[APT_BUFFER_SIZE]; while (MyLen < Size) { // Wait for some data.. -- cgit v1.2.3-70-g09d2