diff options
| author | Julian Andres Klode <jak@debian.org> | 2024-11-11 15:28:27 +0000 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2024-11-11 15:28:27 +0000 |
| commit | aefccbe09722c6a7a0911cb882622c96215eeec2 (patch) | |
| tree | e19e12bd61ba8767915604129831948184532f7b /methods | |
| parent | f4e0e9daf221e840e122b0ffa97007aa512020a6 (diff) | |
| parent | d20575e93c38afb15fbc3e3bfc5e0e6a3903c299 (diff) | |
Merge branch 'stdarray' into 'main'
Fold char[APT_BUFFER_SIZE] and unique_ptr<char, APT_BUFFER_SIZE> into std::array<char, APT_BUFFER_SIZE>
See merge request apt-team/apt!386
Diffstat (limited to 'methods')
| -rw-r--r-- | methods/store.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/methods/store.cc b/methods/store.cc index 8b30efaf3..23d6b43d0 100644 --- a/methods/store.cc +++ b/methods/store.cc @@ -21,6 +21,7 @@ #include <apt-pkg/hashes.h> #include <apt-pkg/strutl.h> +#include <array> #include <cstring> #include <string> #include <vector> @@ -103,10 +104,10 @@ bool StoreMethod::Fetch(FetchItem *Itm) /*{{{*/ Res.Size = 0; while (1) { - unsigned char Buffer[APT_BUFFER_SIZE]; + std::array<unsigned char, APT_BUFFER_SIZE> Buffer; unsigned long long Count = 0; - if (!From.Read(Buffer,sizeof(Buffer),&Count)) + if (!From.Read(Buffer.data(),Buffer.size(),&Count)) { if (To.IsOpen()) To.OpFail(); @@ -116,8 +117,8 @@ bool StoreMethod::Fetch(FetchItem *Itm) /*{{{*/ break; Res.Size += Count; - Hash.Add(Buffer,Count); - if (To.IsOpen() && To.Write(Buffer,Count) == false) + Hash.Add(Buffer.data(),Count); + if (To.IsOpen() && To.Write(Buffer.data(),Count) == false) { Failed = true; break; |
