From: Joel Rosdahl Date: Sat, 20 Jan 2024 14:03:42 +0000 (+0100) Subject: refactor: fs::path-ify core::CacheEntry::Header X-Git-Tag: v4.10~118 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=24170bb68fc0d9eadc9ed726de7059c5b3903113;p=thirdparty%2Fccache.git refactor: fs::path-ify core::CacheEntry::Header --- diff --git a/src/core/CacheEntry.cpp b/src/core/CacheEntry.cpp index 9ae0de305..40f634504 100644 --- a/src/core/CacheEntry.cpp +++ b/src/core/CacheEntry.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2022-2023 Joel Rosdahl and other contributors +// Copyright (C) 2022-2024 Joel Rosdahl and other contributors // // See doc/AUTHORS.adoc for a complete list of contributors. // @@ -33,6 +33,8 @@ #include +namespace fs = util::filesystem; + namespace { const size_t k_static_header_fields_size = @@ -104,7 +106,7 @@ CacheEntry::Header::Header(nonstd::span data) parse(data); } -CacheEntry::Header::Header(const std::string& path) +CacheEntry::Header::Header(const fs::path& path) { parse(util::value_or_throw( util::read_file_part(path, 0, 1000))); diff --git a/src/core/CacheEntry.hpp b/src/core/CacheEntry.hpp index f3c958a1d..74b109bbe 100644 --- a/src/core/CacheEntry.hpp +++ b/src/core/CacheEntry.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2021-2022 Joel Rosdahl and other contributors +// Copyright (C) 2021-2024 Joel Rosdahl and other contributors // // See doc/AUTHORS.adoc for a complete list of contributors. // @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -74,7 +75,7 @@ public: public: Header(const Config& config, CacheEntryType entry_type); explicit Header(nonstd::span data); - explicit Header(const std::string& path); + explicit Header(const std::filesystem::path& path); std::string inspect() const;