summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorнаб <nabijaczleweli@nabijaczleweli.xyz>2024-11-07 12:46:19 +0000
committerJulian Andres Klode <jak@debian.org>2024-11-07 12:46:19 +0000
commita05376bca3649da9e8ca2c48836aad1d27f7d1db (patch)
tree9bba879b213982bac78db424ea595e7dbee9e034
parentbc1fbd12789bfebf225be7af5052840a6add21e2 (diff)
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)
-rw-r--r--apt-pkg/contrib/fileutl.cc7
-rw-r--r--ftparchive/apt-ftparchive.cc2
-rw-r--r--methods/ftp.cc2
-rw-r--r--methods/rsh.cc2
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..