From 93e63f78b317c19e3ed2e5079c004b024110ef14 Mon Sep 17 00:00:00 2001 From: Leandro Reina Date: Thu, 21 Nov 2024 13:53:46 +0100 Subject: [PATCH] FIx MacOS build --- src/libfetchers/git-lfs-fetch.hh | 6 +++--- src/libfetchers/git-utils.cc | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libfetchers/git-lfs-fetch.hh b/src/libfetchers/git-lfs-fetch.hh index eaf63393c..e3ad38f42 100644 --- a/src/libfetchers/git-lfs-fetch.hh +++ b/src/libfetchers/git-lfs-fetch.hh @@ -515,13 +515,13 @@ std::vector Fetch::fetchUrls(const std::vector & metadatas) void Fetch::fetch(const git_blob * pointerBlob, const std::string & pointerFilePath, Sink & sink) const { - constexpr size_t chunkSize = 128 * 1024; // 128 KiB + constexpr git_object_size_t chunkSize = 128 * 1024; // 128 KiB auto size = git_blob_rawsize(pointerBlob); if (size >= 1024) { debug("Skip git-lfs, pointer file too large"); warn("Encountered a file that should have been a pointer, but wasn't: %s", pointerFilePath); - for (size_t offset = 0; offset < size; offset += chunkSize) { + for (git_object_size_t offset = 0; offset < size; offset += chunkSize) { sink(std::string( (const char *) git_blob_rawcontent(pointerBlob) + offset, std::min(chunkSize, size - offset))); } @@ -533,7 +533,7 @@ void Fetch::fetch(const git_blob * pointerBlob, const std::string & pointerFileP if (md == std::nullopt) { debug("Skip git-lfs, invalid pointer file"); warn("Encountered a file that should have been a pointer, but wasn't: %s", pointerFilePath); - for (size_t offset = 0; offset < size; offset += chunkSize) { + for (git_object_size_t offset = 0; offset < size; offset += chunkSize) { sink(std::string( (const char *) git_blob_rawcontent(pointerBlob) + offset, std::min(chunkSize, size - offset))); } diff --git a/src/libfetchers/git-utils.cc b/src/libfetchers/git-utils.cc index 073e3fcad..4a78e803c 100644 --- a/src/libfetchers/git-utils.cc +++ b/src/libfetchers/git-utils.cc @@ -725,8 +725,8 @@ struct GitSourceAccessor : SourceAccessor } } - constexpr size_t chunkSize = 128 * 1024; // 128 KiB - for (size_t offset = 0; offset < size; offset += chunkSize) { + constexpr git_object_size_t chunkSize = 128 * 1024; // 128 KiB + for (git_object_size_t offset = 0; offset < size; offset += chunkSize) { sink(std::string((const char *) git_blob_rawcontent(blob.get()) + offset, std::min(chunkSize, size - offset))); } }