From 4ac149951b2020b4a6dafb0455d3f523e7c9cfe6 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 15 Feb 2022 17:34:51 +0000 Subject: Fix up all warnings from all the tools --- src/blob.cpp | 13 ++++++++++--- src/blob.h | 9 ++++++++- src/dir.cpp | 13 +++++++++++-- src/dir.h | 6 ++++++ src/git.cpp | 5 +++-- src/git.h | 4 +++- src/main.cpp | 6 ++++++ src/repo.cpp | 11 +++++++++++ src/repo.h | 13 ++++++++++++- src/repoList.cpp | 7 ++++++- src/repoList.h | 5 +++++ 11 files changed, 81 insertions(+), 11 deletions(-) (limited to 'src') 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 #include +#include +#include +#include +#include +#include #include +#include 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(o)}; + const auto size {static_cast(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 diff --git a/src/blob.h b/src/blob.h index b873299..24e8c6f 100644 --- a/src/blob.h +++ b/src/blob.h @@ -3,6 +3,12 @@ #include "git.h" #include +#include +#include +#include +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 #include +#include +#include +#include +#include +#include #include +#include +#include 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; diff --git a/src/dir.h b/src/dir.h index 91d9ddd..626d80f 100644 --- a/src/dir.h +++ b/src/dir.h @@ -3,6 +3,12 @@ #include "git.h" #include +#include +#include +#include +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 +#include #include -#include #include #include @@ -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(git_blob_rawsize(&b)); return a; } } diff --git a/src/git.h b/src/git.h index 46bdb18..1dce92e 100644 --- a/src/git.h +++ b/src/git.h @@ -4,9 +4,11 @@ #include #include #include +#include +#include namespace GitFS::Git { - template[[noreturn]] void throwError(int err); + template [[noreturn]] void throwError(int err); template 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 +#include +#include #include #include #include #include +#include +#include +#include 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 #include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include std::string operator/(const std::string & a, const std::string & b) diff --git a/src/repo.h b/src/repo.h index 9a01c55..795dd87 100644 --- a/src/repo.h +++ b/src/repo.h @@ -2,8 +2,19 @@ #define GITFS_REPO_H #include "git.h" -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +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 #include #include - +#include #include +#include +#include +#include +#include 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 #include +#include +#include +namespace Ice { + struct Current; +} namespace GitFS { class RepoList : public NetFS::Service { -- cgit v1.2.3