aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/filetransfer.cc
diff options
context:
space:
mode:
authorJade Lovelace <lix@jade.fyi>2024-08-04 20:19:58 -0700
committerJade Lovelace <lix@jade.fyi>2024-08-08 14:53:17 -0700
commite34833c0253340f47dc0add8609eb86cf9cba19b (patch)
tree83e196e01ed4197e8f413f21d16b93cdd60f3d63 /src/libstore/filetransfer.cc
parent370ac940dd7816ad4052fafa4e0f8d17784fa16b (diff)
tree-wide: fix a pile of lints
This: - Converts a bunch of C style casts into C++ casts. - Removes some very silly pointer subtraction code (which is no more or less busted on i686 than it began) - Fixes some "technically UB" that never had to be UB in the first place. - Makes finally follow the noexcept status of the inner function. Maybe in the future we should ban the function from not being noexcept, but that is not today. - Makes various locally-used exceptions inherit from std::exception. Change-Id: I22e66972602604989b5e494fd940b93e0e6e9297
Diffstat (limited to 'src/libstore/filetransfer.cc')
-rw-r--r--src/libstore/filetransfer.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/libstore/filetransfer.cc b/src/libstore/filetransfer.cc
index 9cb805444..11c8a755c 100644
--- a/src/libstore/filetransfer.cc
+++ b/src/libstore/filetransfer.cc
@@ -5,7 +5,6 @@
#include "s3.hh"
#include "signals.hh"
#include "compression.hh"
-#include "finally.hh"
#if ENABLE_S3
#include <aws/core/client/ClientConfiguration.h>
@@ -143,9 +142,9 @@ struct curlFileTransfer : public FileTransfer
if (successfulStatuses.count(getHTTPStatus()) && this->dataCallback) {
writtenToSink += realSize;
- dataCallback(*this, {(const char *) contents, realSize});
+ dataCallback(*this, {static_cast<const char *>(contents), realSize});
} else {
- this->result.data.append((const char *) contents, realSize);
+ this->result.data.append(static_cast<const char *>(contents), realSize);
}
return realSize;
@@ -157,13 +156,13 @@ struct curlFileTransfer : public FileTransfer
static size_t writeCallbackWrapper(void * contents, size_t size, size_t nmemb, void * userp)
{
- return ((TransferItem *) userp)->writeCallback(contents, size, nmemb);
+ return static_cast<TransferItem *>(userp)->writeCallback(contents, size, nmemb);
}
size_t headerCallback(void * contents, size_t size, size_t nmemb)
{
size_t realSize = size * nmemb;
- std::string line((char *) contents, realSize);
+ std::string line(static_cast<char *>(contents), realSize);
printMsg(lvlVomit, "got header for '%s': %s", request.uri, trim(line));
static std::regex statusLine("HTTP/[^ ]+ +[0-9]+(.*)", std::regex::extended | std::regex::icase);
@@ -204,7 +203,7 @@ struct curlFileTransfer : public FileTransfer
static size_t headerCallbackWrapper(void * contents, size_t size, size_t nmemb, void * userp)
{
- return ((TransferItem *) userp)->headerCallback(contents, size, nmemb);
+ return static_cast<TransferItem *>(userp)->headerCallback(contents, size, nmemb);
}
int progressCallback(double dltotal, double dlnow)
@@ -219,7 +218,7 @@ struct curlFileTransfer : public FileTransfer
static int progressCallbackWrapper(void * userp, double dltotal, double dlnow, double ultotal, double ulnow)
{
- return ((TransferItem *) userp)->progressCallback(dltotal, dlnow);
+ return static_cast<TransferItem *>(userp)->progressCallback(dltotal, dlnow);
}
static int debugCallback(CURL * handle, curl_infotype type, char * data, size_t size, void * userptr)
@@ -246,7 +245,7 @@ struct curlFileTransfer : public FileTransfer
static size_t readCallbackWrapper(char *buffer, size_t size, size_t nitems, void * userp)
{
- return ((TransferItem *) userp)->readCallback(buffer, size, nitems);
+ return static_cast<TransferItem *>(userp)->readCallback(buffer, size, nitems);
}
void init()