diff options
author | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2022-02-15 17:34:51 +0000 |
---|---|---|
committer | Dan Goodliffe <dan.goodliffe@octal.co.uk> | 2022-02-15 17:34:51 +0000 |
commit | 4ac149951b2020b4a6dafb0455d3f523e7c9cfe6 (patch) | |
tree | 698d4471463b68bc16ce2f291a0eaab86bcb5e13 /src | |
parent | Bump to C++20 for compat with other libs (diff) | |
download | netfs-gitfs-4ac149951b2020b4a6dafb0455d3f523e7c9cfe6.tar.bz2 netfs-gitfs-4ac149951b2020b4a6dafb0455d3f523e7c9cfe6.tar.xz netfs-gitfs-4ac149951b2020b4a6dafb0455d3f523e7c9cfe6.zip |
Fix up all warnings from all the toolsnetfs-gitfs-0.2.2
Diffstat (limited to 'src')
-rw-r--r-- | src/blob.cpp | 13 | ||||
-rw-r--r-- | src/blob.h | 9 | ||||
-rw-r--r-- | src/dir.cpp | 13 | ||||
-rw-r--r-- | src/dir.h | 6 | ||||
-rw-r--r-- | src/git.cpp | 5 | ||||
-rw-r--r-- | src/git.h | 4 | ||||
-rw-r--r-- | src/main.cpp | 6 | ||||
-rw-r--r-- | src/repo.cpp | 11 | ||||
-rw-r--r-- | src/repo.h | 13 | ||||
-rw-r--r-- | src/repoList.cpp | 7 | ||||
-rw-r--r-- | src/repoList.h | 5 |
11 files changed, 81 insertions, 11 deletions
diff --git a/src/blob.cpp b/src/blob.cpp index e3483b8..a5482df 100644 --- a/src/blob.cpp +++ b/src/blob.cpp @@ -1,7 +1,14 @@ #include "blob.h" #include "repo.h" +#include <Ice/Current.h> #include <Ice/ObjectAdapter.h> +#include <algorithm> +#include <cerrno> +#include <exceptions.h> +#include <file.h> +#include <memory> #include <sys/stat.h> +#include <types.h> GitFS::Blob::Blob(const Repo * const r, std::string && path) : repo(r), entry(Git::TreeEntryByPath(repo->tree, path)), blob(getBlob()), blobSize(git_blob_rawsize(blob.get())), @@ -43,13 +50,13 @@ GitFS::Blob::fgetattr(ReqEnv, const ::Ice::Current &) NetFS::Buffer GitFS::Blob::read(long long int o, long long int s, const ::Ice::Current &) { - const decltype(blobSize) offset(o); - const decltype(blobSize) size(s); + const auto offset {static_cast<BlobSize>(o)}; + const auto size {static_cast<BlobSize>(s)}; if (offset > blobSize) { return {}; } auto len = std::min(blobSize - offset, size); - return NetFS::Buffer(blobContent + offset, blobContent + offset + len); + return {blobContent + offset, blobContent + offset + len}; } void @@ -3,6 +3,12 @@ #include "git.h" #include <file.h> +#include <git2.h> +#include <string> +#include <types.h> +namespace Ice { + struct Current; +} namespace GitFS { using namespace NetFS; @@ -24,7 +30,8 @@ namespace GitFS { const Repo * const repo; Git::TreeEntryPtr entry; Git::BlobPtr blob; - const decltype(git_blob_rawsize({})) blobSize; + using BlobSize = decltype(git_blob_rawsize({})); + const BlobSize blobSize; const char * const blobContent; }; } diff --git a/src/dir.cpp b/src/dir.cpp index 9e524aa..f502c45 100644 --- a/src/dir.cpp +++ b/src/dir.cpp @@ -1,7 +1,16 @@ #include "dir.h" +#include "git.h" #include "repo.h" +#include <Ice/Current.h> #include <Ice/ObjectAdapter.h> +#include <cerrno> +#include <exceptions.h> +#include <git2.h> +#include <memory> +#include <string> #include <sys/stat.h> +#include <types.h> +#include <utility> GitFS::Directory::Directory(Repo * const r, std::string && p) : repo(r), path(std::move(p)), subTreeCacheRootId({}) { @@ -39,7 +48,7 @@ GitFS::Directory::readdir(const ::Ice::Current &) { const auto subTree = getSubtree(); NetFS::NameList list; - for (int idx = git_tree_entrycount(subTree.get()); idx--;) { + for (auto idx = git_tree_entrycount(subTree.get()); idx--;) { const auto entry = git_tree_entry_byindex(subTree.get(), idx); list.push_back(git_tree_entry_name(entry)); } @@ -51,7 +60,7 @@ GitFS::Directory::listdir(const ::Ice::Current &) { const auto subTree = getSubtree(); NetFS::DirectoryContents list; - for (int idx = git_tree_entrycount(subTree.get()); idx--;) { + for (auto idx = git_tree_entrycount(subTree.get()); idx--;) { const auto entry = git_tree_entry_byindex(subTree.get(), idx); NetFS::Attr a {}; a << *entry << *repo->commit; @@ -3,6 +3,12 @@ #include "git.h" #include <directory.h> +#include <git2.h> +#include <string> +#include <types.h> +namespace Ice { + struct Current; +} namespace GitFS { using namespace NetFS; diff --git a/src/git.cpp b/src/git.cpp index 1c9da62..e6aed3f 100644 --- a/src/git.cpp +++ b/src/git.cpp @@ -1,6 +1,7 @@ #include "git.h" +#include <array> +#include <cerrno> #include <exceptions.h> -#include <execinfo.h> #include <sys/stat.h> #include <types.h> @@ -99,7 +100,7 @@ namespace NetFS { operator<<(Attr & a, const git_blob & b) { a.blockSize = 1; - a.blocks = a.size = git_blob_rawsize(&b); + a.blocks = a.size = static_cast<decltype(Attr::blocks)>(git_blob_rawsize(&b)); return a; } } @@ -4,9 +4,11 @@ #include <git2.h> #include <memory> #include <ostream> +#include <string> +#include <string_view> namespace GitFS::Git { - template<typename E>[[noreturn]] void throwError(int err); + template<typename E> [[noreturn]] void throwError(int err); template<typename E, typename... P, typename... A> void diff --git a/src/main.cpp b/src/main.cpp index 91c6b15..7ee7dff 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,8 +1,14 @@ #include "repoList.h" +#include <Ice/BuiltinSequences.h> +#include <Ice/Communicator.h> +#include <Ice/ObjectAdapter.h> #include <factory.h> #include <git2.h> #include <icecube.h> #include <icetrayService.h> +#include <memory> +#include <service.h> +#include <string> namespace GitFS { class Main : public IceTray::Service { diff --git a/src/repo.cpp b/src/repo.cpp index 41e6f7d..2dca141 100644 --- a/src/repo.cpp +++ b/src/repo.cpp @@ -1,8 +1,19 @@ #include "repo.h" #include "blob.h" #include "dir.h" +#include <Ice/Current.h> #include <Ice/ObjectAdapter.h> +#include <Ice/Proxy.h> +#include <cerrno> +#include <directory.h> +#include <exceptions.h> +#include <file.h> +#include <git2.h> +#include <memory> #include <sys/stat.h> +#include <types.h> +#include <unistd.h> +#include <utility> std::string operator/(const std::string & a, const std::string & b) @@ -2,8 +2,19 @@ #define GITFS_REPO_H #include "git.h" -#include <Ice/Properties.h> +#include <Ice/Config.h> +#include <Ice/Optional.h> +#include <ctime> +#include <directory.h> +#include <file.h> +#include <functional> +#include <string> +#include <string_view> +#include <types.h> #include <volume.h> +namespace Ice { + struct Current; +} namespace GitFS { using namespace NetFS; diff --git a/src/repoList.cpp b/src/repoList.cpp index f66e019..2a50421 100644 --- a/src/repoList.cpp +++ b/src/repoList.cpp @@ -1,9 +1,14 @@ #include "repoList.h" #include "repo.h" +#include <Ice/Current.h> #include <Ice/ObjectAdapter.h> #include <Ice/Properties.h> - +#include <Ice/Proxy.h> #include <compileTimeFormatter.h> +#include <exceptions.h> +#include <memory> +#include <utility> +#include <volume.h> GitFS::RepoList::RepoList(Ice::PropertiesPtr && p) : properties(std::move(p)) { } diff --git a/src/repoList.h b/src/repoList.h index 2e876c2..d32f3b0 100644 --- a/src/repoList.h +++ b/src/repoList.h @@ -3,6 +3,11 @@ #include <Ice/Properties.h> #include <service.h> +#include <string> +#include <volume.h> +namespace Ice { + struct Current; +} namespace GitFS { class RepoList : public NetFS::Service { |