summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/build_engine/base_maps/user_rule.hpp2
-rw-r--r--src/buildtool/build_engine/expression/configuration.hpp8
-rw-r--r--src/buildtool/build_engine/expression/evaluator.cpp16
-rw-r--r--src/buildtool/build_engine/expression/expression.cpp9
-rw-r--r--src/buildtool/build_engine/expression/expression.hpp11
-rw-r--r--src/buildtool/build_engine/target_map/built_in_rules.cpp9
-rw-r--r--src/buildtool/build_engine/target_map/result_map.hpp8
-rw-r--r--src/buildtool/build_engine/target_map/target_map.cpp7
-rw-r--r--src/buildtool/common/bazel_types.hpp8
-rw-r--r--src/buildtool/common/remote/port.hpp6
-rw-r--r--src/buildtool/execution_api/execution_service/operation_cache.hpp5
-rw-r--r--src/buildtool/file_system/file_system_manager.hpp1
-rw-r--r--src/buildtool/file_system/git_repo.cpp14
-rw-r--r--src/buildtool/file_system/git_utils.cpp2
-rw-r--r--src/buildtool/graph_traverser/graph_traverser.hpp4
-rw-r--r--src/buildtool/main/analyse.cpp8
-rw-r--r--src/buildtool/multithreading/async_map.hpp2
-rw-r--r--src/buildtool/progress_reporting/base_progress_reporter.cpp2
-rw-r--r--src/buildtool/progress_reporting/base_progress_reporter.hpp6
-rw-r--r--src/buildtool/progress_reporting/task_tracker.hpp6
-rw-r--r--src/buildtool/storage/file_chunker.cpp4
-rw-r--r--src/buildtool/storage/large_object_cas.tpp8
-rw-r--r--src/other_tools/git_operations/git_repo_remote.cpp3
-rw-r--r--src/other_tools/just_mr/setup.cpp2
-rw-r--r--src/other_tools/just_mr/update.cpp3
-rw-r--r--src/other_tools/utils/curl_easy_handle.cpp12
-rw-r--r--src/other_tools/utils/curl_easy_handle.hpp9
-rw-r--r--src/other_tools/utils/curl_url_handle.cpp16
-rw-r--r--src/other_tools/utils/curl_url_handle.hpp5
-rw-r--r--src/utils/archive/archive_ops.cpp4
-rw-r--r--src/utils/archive/archive_ops.hpp3
-rw-r--r--src/utils/cpp/hex_string.hpp5
32 files changed, 115 insertions, 93 deletions
diff --git a/src/buildtool/build_engine/base_maps/user_rule.hpp b/src/buildtool/build_engine/base_maps/user_rule.hpp
index 979a9cf6..8ea0d6cc 100644
--- a/src/buildtool/build_engine/base_maps/user_rule.hpp
+++ b/src/buildtool/build_engine/base_maps/user_rule.hpp
@@ -309,7 +309,7 @@ class UserRule {
std::vector<std::string> sfields,
std::vector<std::string> cfields)
-> std::unordered_set<std::string> {
- size_t n = 0;
+ std::size_t n = 0;
n += tfields.size();
n += sfields.size();
n += cfields.size();
diff --git a/src/buildtool/build_engine/expression/configuration.hpp b/src/buildtool/build_engine/expression/configuration.hpp
index af169818..ec00bb4a 100644
--- a/src/buildtool/build_engine/expression/configuration.hpp
+++ b/src/buildtool/build_engine/expression/configuration.hpp
@@ -57,16 +57,16 @@ class Configuration {
[[nodiscard]] auto ToJson() const -> nlohmann::json {
return expr_->ToJson();
}
- [[nodiscard]] auto Enumerate(const std::string& prefix, size_t width) const
- -> std::string {
+ [[nodiscard]] auto Enumerate(const std::string& prefix,
+ std::size_t width) const -> std::string {
std::stringstream ss{};
if (width > prefix.size()) {
- size_t actual_width = width - prefix.size();
+ std::size_t actual_width = width - prefix.size();
for (auto const& [key, value] : expr_->Map()) {
std::string key_str = Expression{key}.ToString();
if (actual_width > key_str.size() + 3) {
ss << prefix << key_str << " : ";
- size_t remain = actual_width - key_str.size() - 3;
+ std::size_t remain = actual_width - key_str.size() - 3;
std::string val_str = value->ToAbbrevString(remain);
if (val_str.size() >= remain) {
ss << val_str.substr(0, remain - 3) << "...";
diff --git a/src/buildtool/build_engine/expression/evaluator.cpp b/src/buildtool/build_engine/expression/evaluator.cpp
index b642eeec..93e9836a 100644
--- a/src/buildtool/build_engine/expression/evaluator.cpp
+++ b/src/buildtool/build_engine/expression/evaluator.cpp
@@ -65,7 +65,7 @@ auto Flatten(ExpressionPtr const& expr) -> ExpressionPtr {
return expr;
}
auto const& list = expr->List();
- size_t size{};
+ std::size_t size{};
std::for_each(list.begin(), list.end(), [&](auto const& l) {
if (not l->IsList()) {
throw Evaluator::EvaluationError{
@@ -196,7 +196,7 @@ auto Enumerate(ExpressionPtr const& expr) -> ExpressionPtr {
"enumerate expects list but instead got: {}.", expr->ToString())};
}
auto result = Expression::map_t::underlying_map_t{};
- size_t count = 0;
+ std::size_t count = 0;
for (auto const& entry : expr->List()) {
result[fmt::format("{:010d}", count)] = entry;
count++;
@@ -263,16 +263,16 @@ auto NubRight(ExpressionPtr const& expr) -> ExpressionPtr {
}
auto Range(ExpressionPtr const& expr) -> ExpressionPtr {
- size_t len = 0;
+ std::size_t len = 0;
if (expr->IsNumber() && expr->Number() > 0.0) {
- len = static_cast<size_t>(std::lround(expr->Number()));
+ len = static_cast<std::size_t>(std::lround(expr->Number()));
}
if (expr->IsString()) {
- len = static_cast<size_t>(std::atol(expr->String().c_str()));
+ len = static_cast<std::size_t>(std::atol(expr->String().c_str()));
}
auto result = Expression::list_t{};
result.reserve(len);
- for (size_t i = 0; i < len; i++) {
+ for (std::size_t i = 0; i < len; i++) {
result.emplace_back(ExpressionPtr{fmt::format("{}", i)});
}
return ExpressionPtr{result};
@@ -330,7 +330,7 @@ auto Join(ExpressionPtr const& expr, std::string const& sep) -> ExpressionPtr {
template <bool kDisjoint = false>
// NOLINTNEXTLINE(misc-no-recursion)
-auto Union(Expression::list_t const& dicts, size_t from, size_t to)
+auto Union(Expression::list_t const& dicts, std::size_t from, std::size_t to)
-> ExpressionPtr {
if (to <= from) {
return Expression::kEmptyMap;
@@ -343,7 +343,7 @@ auto Union(Expression::list_t const& dicts, size_t from, size_t to)
}
return entry;
}
- size_t mid = from + (to - from) / 2;
+ std::size_t mid = from + (to - from) / 2;
auto left = Union<kDisjoint>(dicts, from, mid);
auto right = Union<kDisjoint>(dicts, mid, to);
if (left->Map().empty()) {
diff --git a/src/buildtool/build_engine/expression/expression.cpp b/src/buildtool/build_engine/expression/expression.cpp
index 474acdca..643d4b31 100644
--- a/src/buildtool/build_engine/expression/expression.cpp
+++ b/src/buildtool/build_engine/expression/expression.cpp
@@ -56,7 +56,7 @@ auto Expression::operator[](ExpressionPtr const& key) && -> ExpressionPtr {
return std::move(*this)[key->String()];
}
-auto Expression::operator[](size_t pos) const& -> ExpressionPtr const& {
+auto Expression::operator[](std::size_t pos) const& -> ExpressionPtr const& {
if (pos < List().size()) {
return List()[pos];
}
@@ -64,7 +64,7 @@ auto Expression::operator[](size_t pos) const& -> ExpressionPtr const& {
fmt::format("List pos '{}' is out of bounds.", pos)};
}
-auto Expression::operator[](size_t pos) && -> ExpressionPtr {
+auto Expression::operator[](std::size_t pos) && -> ExpressionPtr {
auto&& list = std::move(*this).List();
if (pos < list.size()) {
return list[pos];
@@ -163,7 +163,8 @@ auto Expression::ToString() const -> std::string {
return ToJson().dump();
}
-[[nodiscard]] auto Expression::ToAbbrevString(size_t len) const -> std::string {
+[[nodiscard]] auto Expression::ToAbbrevString(std::size_t len) const
+ -> std::string {
return AbbreviateJson(ToJson(), len);
}
// NOLINTNEXTLINE(misc-no-recursion)
@@ -215,7 +216,7 @@ auto Expression::FromJson(nlohmann::json const& json) noexcept
return ExpressionPtr{nullptr};
}
-template <size_t kIndex>
+template <std::size_t kIndex>
auto Expression::TypeStringForIndex() const noexcept -> std::string {
using var_t = decltype(data_);
if (kIndex == data_.index()) {
diff --git a/src/buildtool/build_engine/expression/expression.hpp b/src/buildtool/build_engine/expression/expression.hpp
index eb0a3d5f..1da17dda 100644
--- a/src/buildtool/build_engine/expression/expression.hpp
+++ b/src/buildtool/build_engine/expression/expression.hpp
@@ -54,7 +54,7 @@ class Expression {
using map_t = LinkedMap<std::string, ExpressionPtr, ExpressionPtr>;
using name_t = BuildMaps::Base::EntityName;
- template <class T, size_t kIndex = 0>
+ template <class T, std::size_t kIndex = 0>
static consteval auto IsValidType() -> bool {
if constexpr (kIndex < std::variant_size_v<decltype(data_)>) {
return std::is_same_v<
@@ -219,8 +219,9 @@ class Expression {
[[nodiscard]] auto operator[](
ExpressionPtr const& key) const& -> ExpressionPtr const&;
[[nodiscard]] auto operator[](ExpressionPtr const& key) && -> ExpressionPtr;
- [[nodiscard]] auto operator[](size_t pos) const& -> ExpressionPtr const&;
- [[nodiscard]] auto operator[](size_t pos) && -> ExpressionPtr;
+ [[nodiscard]] auto operator[](
+ std::size_t pos) const& -> ExpressionPtr const&;
+ [[nodiscard]] auto operator[](std::size_t pos) && -> ExpressionPtr;
enum class JsonMode { SerializeAll, SerializeAllButNodes, NullForNonJson };
@@ -228,7 +229,7 @@ class Expression {
-> nlohmann::json;
[[nodiscard]] auto IsCacheable() const -> bool;
[[nodiscard]] auto ToString() const -> std::string;
- [[nodiscard]] auto ToAbbrevString(size_t len) const -> std::string;
+ [[nodiscard]] auto ToAbbrevString(std::size_t len) const -> std::string;
[[nodiscard]] auto ToHash() const noexcept -> std::string;
[[nodiscard]] auto ToIdentifier() const noexcept -> std::string {
return ToHexString(ToHash());
@@ -343,7 +344,7 @@ class Expression {
return "none";
}
- template <size_t kIndex = 0>
+ template <std::size_t kIndex = 0>
[[nodiscard]] auto TypeStringForIndex() const noexcept -> std::string;
[[nodiscard]] auto TypeString() const noexcept -> std::string;
[[nodiscard]] auto ComputeHash() const noexcept -> std::string;
diff --git a/src/buildtool/build_engine/target_map/built_in_rules.cpp b/src/buildtool/build_engine/target_map/built_in_rules.cpp
index 6b207008..6d58e900 100644
--- a/src/buildtool/build_engine/target_map/built_in_rules.cpp
+++ b/src/buildtool/build_engine/target_map/built_in_rules.cpp
@@ -15,6 +15,7 @@
#include "src/buildtool/build_engine/target_map/built_in_rules.hpp"
#include <algorithm>
+#include <cstddef>
#include <filesystem>
#include <functional>
#include <iterator>
@@ -131,7 +132,7 @@ void BlobGenRuleWithDeps(
std::unordered_map<BuildMaps::Target::ConfiguredTarget, AnalysedTargetPtr>
deps_by_transition;
deps_by_transition.reserve(transition_keys.size());
- for (size_t i = 0; i < transition_keys.size(); ++i) {
+ for (std::size_t i = 0; i < transition_keys.size(); ++i) {
deps_by_transition.emplace(transition_keys[i], *dependency_values[i]);
}
@@ -486,7 +487,7 @@ void TreeRuleWithDeps(
std::unordered_map<BuildMaps::Base::EntityName, AnalysedTargetPtr>
deps_by_target;
deps_by_target.reserve(dependency_keys.size());
- for (size_t i = 0; i < dependency_keys.size(); ++i) {
+ for (std::size_t i = 0; i < dependency_keys.size(); ++i) {
deps_by_target.emplace(dependency_keys[i].target,
*dependency_values[i]);
}
@@ -647,7 +648,7 @@ void InstallRuleWithDeps(
std::unordered_map<BuildMaps::Base::EntityName, AnalysedTargetPtr>
deps_by_target;
deps_by_target.reserve(dependency_keys.size());
- for (size_t i = 0; i < dependency_keys.size(); ++i) {
+ for (std::size_t i = 0; i < dependency_keys.size(); ++i) {
deps_by_target.emplace(dependency_keys[i].target,
*dependency_values[i]);
}
@@ -994,7 +995,7 @@ void GenericRuleWithDeps(
std::unordered_map<BuildMaps::Target::ConfiguredTarget, AnalysedTargetPtr>
deps_by_transition;
deps_by_transition.reserve(transition_keys.size());
- for (size_t i = 0; i < transition_keys.size(); ++i) {
+ for (std::size_t i = 0; i < transition_keys.size(); ++i) {
deps_by_transition.emplace(transition_keys[i], *dependency_values[i]);
}
diff --git a/src/buildtool/build_engine/target_map/result_map.hpp b/src/buildtool/build_engine/target_map/result_map.hpp
index 484b86ee..ed6511fa 100644
--- a/src/buildtool/build_engine/target_map/result_map.hpp
+++ b/src/buildtool/build_engine/target_map/result_map.hpp
@@ -97,7 +97,7 @@ class ResultTargetMap {
[[nodiscard]] auto ConfiguredTargets() const noexcept
-> std::vector<ConfiguredTarget> {
std::vector<ConfiguredTarget> targets{};
- size_t s = 0;
+ std::size_t s = 0;
for (const auto& target : targets_) {
s += target.size();
}
@@ -178,9 +178,9 @@ class ResultTargetMap {
Logger const* logger = nullptr) const
-> ResultType<kIncludeOrigins> {
ResultType<kIncludeOrigins> result{};
- size_t na = 0;
- size_t nb = 0;
- size_t nt = 0;
+ std::size_t na = 0;
+ std::size_t nb = 0;
+ std::size_t nt = 0;
for (std::size_t i = 0; i < width_; i++) {
na += num_actions_[i];
nb += num_blobs_[i];
diff --git a/src/buildtool/build_engine/target_map/target_map.cpp b/src/buildtool/build_engine/target_map/target_map.cpp
index 9d9e7d3c..3a3dd5ee 100644
--- a/src/buildtool/build_engine/target_map/target_map.cpp
+++ b/src/buildtool/build_engine/target_map/target_map.cpp
@@ -319,7 +319,7 @@ void withDependencies(
deps_by_transition;
deps_by_transition.reserve(transition_keys.size());
ExpectsAudit(transition_keys.size() == dependency_values.size());
- for (size_t i = 0; i < transition_keys.size(); ++i) {
+ for (std::size_t i = 0; i < transition_keys.size(); ++i) {
deps_by_transition.emplace(transition_keys[i], *dependency_values[i]);
}
@@ -342,8 +342,9 @@ void withDependencies(
std::vector<BuildMaps::Target::ConfiguredTargetPtr> anonymous_deps{};
ExpectsAudit(declared_count <= declared_and_implicit_count);
ExpectsAudit(declared_and_implicit_count <= dependency_values.size());
- auto fill_target_graph = [&dependency_values](
- size_t const a, size_t const b, auto* deps) {
+ auto fill_target_graph = [&dependency_values](std::size_t const a,
+ std::size_t const b,
+ auto* deps) {
std::transform(
dependency_values.begin() + a,
dependency_values.begin() + b,
diff --git a/src/buildtool/common/bazel_types.hpp b/src/buildtool/common/bazel_types.hpp
index f95a1864..ca191eed 100644
--- a/src/buildtool/common/bazel_types.hpp
+++ b/src/buildtool/common/bazel_types.hpp
@@ -28,13 +28,13 @@
namespace build::bazel::remote::execution::v2 {
struct Digest {
std::string hash_;
- int64_t size_bytes_;
+ std::int64_t size_bytes_;
auto hash() const& noexcept -> std::string const& { return hash_; }
- auto size_bytes() const noexcept -> int64_t { return size_bytes_; }
+ auto size_bytes() const noexcept -> std::int64_t { return size_bytes_; }
- void set_size_bytes(int64_t size_bytes) { size_bytes_ = size_bytes; }
+ void set_size_bytes(std::int64_t size_bytes) { size_bytes_ = size_bytes; }
void set_hash(std::string hash) { hash_ = hash; }
@@ -43,7 +43,7 @@ struct Digest {
} // namespace build::bazel::remote::execution::v2
namespace google::protobuf {
-using int64 = int64_t;
+using int64 = std::int64_t;
}
#else
diff --git a/src/buildtool/common/remote/port.hpp b/src/buildtool/common/remote/port.hpp
index 1fb2467c..161d8c3b 100644
--- a/src/buildtool/common/remote/port.hpp
+++ b/src/buildtool/common/remote/port.hpp
@@ -15,7 +15,11 @@
#ifndef INCLUDED_SRC_BUILDTOOL_COMMON_PORT_HPP
#define INCLUDED_SRC_BUILDTOOL_COMMON_PORT_HPP
+#include <cstdint>
+#include <exception>
+#include <limits>
#include <optional>
+#include <string>
#include "gsl/gsl"
#include "src/buildtool/logging/log_level.hpp"
@@ -30,7 +34,7 @@ using Port = type_safe_arithmetic<PortTag>;
-> std::optional<Port> {
try {
static constexpr int kMaxPortNumber{
- std::numeric_limits<uint16_t>::max()};
+ std::numeric_limits<std::uint16_t>::max()};
if (port_num >= 0 and port_num <= kMaxPortNumber) {
return gsl::narrow_cast<Port::value_t>(port_num);
}
diff --git a/src/buildtool/execution_api/execution_service/operation_cache.hpp b/src/buildtool/execution_api/execution_service/operation_cache.hpp
index f06620a5..317bade4 100644
--- a/src/buildtool/execution_api/execution_service/operation_cache.hpp
+++ b/src/buildtool/execution_api/execution_service/operation_cache.hpp
@@ -17,6 +17,7 @@
#include <atomic>
#include <cstddef>
+#include <cstdint>
#include <mutex>
#include <optional>
#include <shared_mutex>
@@ -53,14 +54,14 @@ class OperationCache {
return Instance().QueryInternal(x);
}
- static void SetExponent(uint8_t x) noexcept {
+ static void SetExponent(std::uint8_t x) noexcept {
Instance().threshold_ = 1U << x;
}
private:
mutable std::shared_mutex mutex_;
std::unordered_map<std::string, ::google::longrunning::Operation> cache_;
- static constexpr uint8_t kDefaultExponent{14};
+ static constexpr std::uint8_t kDefaultExponent{14};
std::size_t threshold_{1U << kDefaultExponent};
void SetInternal(std::string const& action, Operation const& op) {
diff --git a/src/buildtool/file_system/file_system_manager.hpp b/src/buildtool/file_system/file_system_manager.hpp
index 80b066c5..9e8826aa 100644
--- a/src/buildtool/file_system/file_system_manager.hpp
+++ b/src/buildtool/file_system/file_system_manager.hpp
@@ -29,6 +29,7 @@
#ifdef __unix__
#include <fcntl.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#endif
diff --git a/src/buildtool/file_system/git_repo.cpp b/src/buildtool/file_system/git_repo.cpp
index ea5b50d4..253adad1 100644
--- a/src/buildtool/file_system/git_repo.cpp
+++ b/src/buildtool/file_system/git_repo.cpp
@@ -258,7 +258,7 @@ struct InMemoryODBBackend {
[[nodiscard]] auto backend_write(git_odb_backend* _backend,
const git_oid* oid,
const void* data,
- size_t len,
+ std::size_t len,
git_object_t type) -> int {
if (data != nullptr and _backend != nullptr and oid != nullptr) {
auto* b = reinterpret_cast<InMemoryODBBackend*>(_backend); // NOLINT
@@ -508,13 +508,14 @@ auto GitRepo::InitAndOpen(std::filesystem::path const& repo_path,
}
git_repository* tmp_repo{nullptr};
- size_t max_attempts = kGitLockNumTries; // number of tries
+ std::size_t max_attempts = kGitLockNumTries; // number of tries
int err = 0;
std::string err_mess{};
while (max_attempts > 0) {
--max_attempts;
- err = git_repository_init(
- &tmp_repo, repo_path.c_str(), static_cast<size_t>(is_bare));
+ err = git_repository_init(&tmp_repo,
+ repo_path.c_str(),
+ static_cast<std::size_t>(is_bare));
if (err == 0) {
git_repository_free(tmp_repo);
return GitRepo(repo_path); // success
@@ -758,7 +759,7 @@ auto GitRepo::KeepTag(std::string const& commit,
}
git_strarray_dispose(&tag_names); // free any allocated unused space
- size_t max_attempts = kGitLockNumTries; // number of tries
+ std::size_t max_attempts = kGitLockNumTries; // number of tries
int err = 0;
std::string err_mess{};
while (max_attempts > 0) {
@@ -1846,7 +1847,8 @@ void GitRepo::PopulateStrarray(
array->count = string_list.size();
array->strings = gsl::owner<char**>(new char*[string_list.size()]);
for (auto const& elem : string_list) {
- auto i = static_cast<size_t>(&elem - &string_list[0]); // get index
+ auto i =
+ static_cast<std::size_t>(&elem - &string_list[0]); // get index
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
array->strings[i] = gsl::owner<char*>(new char[elem.size() + 1]);
// NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic)
diff --git a/src/buildtool/file_system/git_utils.cpp b/src/buildtool/file_system/git_utils.cpp
index 55d1ca38..8e45671b 100644
--- a/src/buildtool/file_system/git_utils.cpp
+++ b/src/buildtool/file_system/git_utils.cpp
@@ -103,7 +103,7 @@ void strarray_closer(gsl::owner<git_strarray*> strarray) {
void strarray_deleter(gsl::owner<git_strarray*> strarray) {
#ifndef BOOTSTRAP_BUILD_TOOL
if (strarray->strings != nullptr) {
- for (size_t i = 0; i < strarray->count; ++i) {
+ for (std::size_t i = 0; i < strarray->count; ++i) {
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory,cppcoreguidelines-pro-bounds-pointer-arithmetic)
delete[] strarray->strings[i];
}
diff --git a/src/buildtool/graph_traverser/graph_traverser.hpp b/src/buildtool/graph_traverser/graph_traverser.hpp
index e0ae6b4a..74fced61 100644
--- a/src/buildtool/graph_traverser/graph_traverser.hpp
+++ b/src/buildtool/graph_traverser/graph_traverser.hpp
@@ -700,7 +700,7 @@ class GraphTraverser {
std::vector<DependencyGraph::ArtifactNode const*> const& artifacts)
const {
if (clargs_.build.print_to_stdout) {
- for (size_t i = 0; i < paths.size(); i++) {
+ for (std::size_t i = 0; i < paths.size(); i++) {
if (paths[i] == *(clargs_.build.print_to_stdout)) {
auto info = artifacts[i]->Content().Info();
if (info) {
@@ -730,7 +730,7 @@ class GraphTraverser {
*clargs_.build.print_to_stdout})
.relative_path();
auto remote = GetRemoteApi();
- for (size_t i = 0; i < paths.size(); i++) {
+ for (std::size_t i = 0; i < paths.size(); i++) {
auto const& path = paths[i];
auto relpath = target_path.lexically_relative(path);
if ((not relpath.empty()) and *relpath.begin() != "..") {
diff --git a/src/buildtool/main/analyse.cpp b/src/buildtool/main/analyse.cpp
index ab2313e7..506000bb 100644
--- a/src/buildtool/main/analyse.cpp
+++ b/src/buildtool/main/analyse.cpp
@@ -50,11 +50,11 @@ namespace Target = BuildMaps::Target;
}
}
else {
- if (((static_cast<int64_t>(actions.size())) +
- static_cast<int64_t>(number)) >= 0) {
+ if (((static_cast<std::int64_t>(actions.size())) +
+ static_cast<std::int64_t>(number)) >= 0) {
return actions[static_cast<std::size_t>(
- (static_cast<int64_t>(actions.size())) +
- static_cast<int64_t>(number))];
+ (static_cast<std::int64_t>(actions.size())) +
+ static_cast<std::int64_t>(number))];
}
}
return std::nullopt;
diff --git a/src/buildtool/multithreading/async_map.hpp b/src/buildtool/multithreading/async_map.hpp
index 41e7dded..e9bdd603 100644
--- a/src/buildtool/multithreading/async_map.hpp
+++ b/src/buildtool/multithreading/async_map.hpp
@@ -57,7 +57,7 @@ class AsyncMap {
[[nodiscard]] auto GetPendingKeys() const -> std::vector<KeyT> {
std::vector<KeyT> keys{};
- size_t s = 0;
+ std::size_t s = 0;
for (auto& i : map_) {
s += i.size();
}
diff --git a/src/buildtool/progress_reporting/base_progress_reporter.cpp b/src/buildtool/progress_reporting/base_progress_reporter.cpp
index 11354af8..4c92ec5d 100644
--- a/src/buildtool/progress_reporting/base_progress_reporter.cpp
+++ b/src/buildtool/progress_reporting/base_progress_reporter.cpp
@@ -28,7 +28,7 @@ auto BaseProgressReporter::Reporter(std::function<void(void)> report) noexcept
std::condition_variable* cv) {
std::mutex m;
std::unique_lock<std::mutex> lock(m);
- int64_t delay = kStartDelayMillis;
+ std::int64_t delay = kStartDelayMillis;
while (not *done) {
cv->wait_for(lock, std::chrono::milliseconds(delay));
if (not *done) {
diff --git a/src/buildtool/progress_reporting/base_progress_reporter.hpp b/src/buildtool/progress_reporting/base_progress_reporter.hpp
index f03a68d1..08bb0d74 100644
--- a/src/buildtool/progress_reporting/base_progress_reporter.hpp
+++ b/src/buildtool/progress_reporting/base_progress_reporter.hpp
@@ -32,10 +32,10 @@ class BaseProgressReporter {
std::function<void(void)> report) noexcept -> progress_reporter_t;
private:
- constexpr static int64_t kStartDelayMillis = 3000;
+ constexpr static std::int64_t kStartDelayMillis = 3000;
// Scaling is roughly sqrt(2)
- constexpr static int64_t kDelayScalingFactorNumerator = 99;
- constexpr static int64_t kDelayScalingFactorDenominator = 70;
+ constexpr static std::int64_t kDelayScalingFactorNumerator = 99;
+ constexpr static std::int64_t kDelayScalingFactorDenominator = 70;
};
#endif // INCLUDED_SRC_BUILDTOOL_PROGRESS_REPORTING_BASE_PROGRESS_REPORTER_HPP
diff --git a/src/buildtool/progress_reporting/task_tracker.hpp b/src/buildtool/progress_reporting/task_tracker.hpp
index b3ff8809..7fdfce31 100644
--- a/src/buildtool/progress_reporting/task_tracker.hpp
+++ b/src/buildtool/progress_reporting/task_tracker.hpp
@@ -46,7 +46,7 @@ class TaskTracker {
[[nodiscard]] auto Sample() noexcept -> std::string {
std::unique_lock lock(m_);
std::string result{};
- uint64_t started = prio_ + 1;
+ std::uint64_t started = prio_ + 1;
for (auto const& it : running_) {
if (it.second < started) {
result = it.first;
@@ -62,9 +62,9 @@ class TaskTracker {
}
private:
- uint64_t prio_{};
+ std::uint64_t prio_{};
std::mutex m_{};
- std::unordered_map<std::string, uint64_t> running_{};
+ std::unordered_map<std::string, std::uint64_t> running_{};
};
#endif // INCLUDED_SRC_BUILDTOOL_PROGRESS_REPORTING_TASK_TRACKER_HPP
diff --git a/src/buildtool/storage/file_chunker.cpp b/src/buildtool/storage/file_chunker.cpp
index af318501..8e747900 100644
--- a/src/buildtool/storage/file_chunker.cpp
+++ b/src/buildtool/storage/file_chunker.cpp
@@ -99,14 +99,14 @@ auto FileChunker::NextChunkBoundary() noexcept -> std::size_t {
}
for (; i < normal_size; i++) {
fp = (fp << 1U) +
- gsl::at(gear_table, static_cast<uint8_t>(buffer_[pos_ + i]));
+ gsl::at(gear_table, static_cast<std::uint8_t>(buffer_[pos_ + i]));
if ((fp & kMaskS) == 0) {
return i; // if the masked bits are all '0'
}
}
for (; i < n; i++) {
fp = (fp << 1U) +
- gsl::at(gear_table, static_cast<uint8_t>(buffer_[pos_ + i]));
+ gsl::at(gear_table, static_cast<std::uint8_t>(buffer_[pos_ + i]));
if ((fp & kMaskL) == 0) {
return i; // if the masked bits are all '0'
}
diff --git a/src/buildtool/storage/large_object_cas.tpp b/src/buildtool/storage/large_object_cas.tpp
index 4bab5201..ef720822 100644
--- a/src/buildtool/storage/large_object_cas.tpp
+++ b/src/buildtool/storage/large_object_cas.tpp
@@ -15,6 +15,7 @@
#ifndef INCLUDED_SRC_BUILDTOOL_STORAGE_LARGE_OBJECT_CAS_TPP
#define INCLUDED_SRC_BUILDTOOL_STORAGE_LARGE_OBJECT_CAS_TPP
+#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <fstream>
@@ -66,14 +67,15 @@ auto LargeObjectCAS<kDoGlobalUplink, kType>::ReadEntry(
try {
std::ifstream stream(*file_path);
nlohmann::json j = nlohmann::json::parse(stream);
- const size_t size = j.at("size").template get<size_t>();
+ const std::size_t size = j.at("size").template get<std::size_t>();
parts.reserve(size);
auto const& j_parts = j.at("parts");
- for (size_t i = 0; i < size; ++i) {
+ for (std::size_t i = 0; i < size; ++i) {
bazel_re::Digest& d = parts.emplace_back();
d.set_hash(j_parts.at(i).at("hash").template get<std::string>());
- d.set_size_bytes(j_parts.at(i).at("size").template get<int64_t>());
+ d.set_size_bytes(
+ j_parts.at(i).at("size").template get<std::int64_t>());
}
} catch (...) {
return std::nullopt;
diff --git a/src/other_tools/git_operations/git_repo_remote.cpp b/src/other_tools/git_operations/git_repo_remote.cpp
index 9820f352..421de1e2 100644
--- a/src/other_tools/git_operations/git_repo_remote.cpp
+++ b/src/other_tools/git_operations/git_repo_remote.cpp
@@ -14,6 +14,7 @@
#include "src/other_tools/git_operations/git_repo_remote.hpp"
+#include <cstddef>
#include <utility> // std::move
#include "fmt/core.h"
@@ -230,7 +231,7 @@ auto GitRepoRemote::GetCommitFromRemote(std::shared_ptr<git_config> cfg,
// get the list of refs from remote
// NOTE: refs will be owned by remote, so we DON'T have to free it!
git_remote_head const** refs = nullptr;
- size_t refs_len = 0;
+ std::size_t refs_len = 0;
if (git_remote_ls(&refs, &refs_len, remote.get()) != 0) {
(*logger)(
fmt::format("Refs retrieval from remote {} failed with:\n{}",
diff --git a/src/other_tools/just_mr/setup.cpp b/src/other_tools/just_mr/setup.cpp
index 97a236cc..e4430b79 100644
--- a/src/other_tools/just_mr/setup.cpp
+++ b/src/other_tools/just_mr/setup.cpp
@@ -286,7 +286,7 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config,
auto const& values) {
nlohmann::json mr_repos{};
for (auto const& repo : setup_repos->to_setup) {
- auto i = static_cast<size_t>(
+ auto i = static_cast<std::size_t>(
&repo - &setup_repos->to_setup[0]); // get index
mr_repos[repo] = *values[i];
}
diff --git a/src/other_tools/just_mr/update.cpp b/src/other_tools/just_mr/update.cpp
index b4e2e455..8d34de01 100644
--- a/src/other_tools/just_mr/update.cpp
+++ b/src/other_tools/just_mr/update.cpp
@@ -14,6 +14,7 @@
#include "src/other_tools/just_mr/update.hpp"
+#include <cstddef>
#include <filesystem>
#include "fmt/core.h"
@@ -235,7 +236,7 @@ auto MultiRepoUpdate(std::shared_ptr<Configuration> const& config,
[&mr_config, repos_to_update_names = update_args.repos_to_update](
auto const& values) {
for (auto const& repo_name : repos_to_update_names) {
- auto i = static_cast<size_t>(
+ auto i = static_cast<std::size_t>(
&repo_name - &repos_to_update_names[0]); // get index
mr_config["repositories"][repo_name]["repository"]
["commit"] = *values[i];
diff --git a/src/other_tools/utils/curl_easy_handle.cpp b/src/other_tools/utils/curl_easy_handle.cpp
index 6939c6d1..2fcfb877 100644
--- a/src/other_tools/utils/curl_easy_handle.cpp
+++ b/src/other_tools/utils/curl_easy_handle.cpp
@@ -40,11 +40,11 @@ auto read_stream_data(gsl::not_null<std::FILE*> const& stream) noexcept
std::rewind(stream);
// create string buffer to hold stream content
- std::string content(static_cast<size_t>(size), '\0');
+ std::string content(static_cast<std::size_t>(size), '\0');
// read stream content into string buffer
auto n = std::fread(content.data(), 1, content.size(), stream);
- if (n != static_cast<size_t>(size)) {
+ if (n != static_cast<std::size_t>(size)) {
Logger::Log(LogLevel::Warning,
"Reading curl log from temporary file failed: read only {} "
"bytes while {} were expected",
@@ -87,8 +87,8 @@ auto CurlEasyHandle::Create(
}
auto CurlEasyHandle::EasyWriteToFile(gsl::owner<char*> data,
- size_t size,
- size_t nmemb,
+ std::size_t size,
+ std::size_t nmemb,
gsl::owner<void*> userptr)
-> std::streamsize {
auto actual_size = static_cast<std::streamsize>(size * nmemb);
@@ -98,8 +98,8 @@ auto CurlEasyHandle::EasyWriteToFile(gsl::owner<char*> data,
}
auto CurlEasyHandle::EasyWriteToString(gsl::owner<char*> data,
- size_t size,
- size_t nmemb,
+ std::size_t size,
+ std::size_t nmemb,
gsl::owner<void*> userptr)
-> std::streamsize {
size_t actual_size = size * nmemb;
diff --git a/src/other_tools/utils/curl_easy_handle.hpp b/src/other_tools/utils/curl_easy_handle.hpp
index 1a3d31c3..81bcbed8 100644
--- a/src/other_tools/utils/curl_easy_handle.hpp
+++ b/src/other_tools/utils/curl_easy_handle.hpp
@@ -15,6 +15,7 @@
#ifndef INCLUDED_SRC_OTHER_TOOLS_UTILS_CURL_EASY_HANDLE_HPP
#define INCLUDED_SRC_OTHER_TOOLS_UTILS_CURL_EASY_HANDLE_HPP
+#include <cstddef>
#include <filesystem>
#include <functional>
#include <memory>
@@ -83,16 +84,16 @@ class CurlEasyHandle {
/// \brief Overwrites write_callback to redirect to file instead of stdout.
[[nodiscard]] auto static EasyWriteToFile(gsl::owner<char*> data,
- size_t size,
- size_t nmemb,
+ std::size_t size,
+ std::size_t nmemb,
gsl::owner<void*> userptr)
-> std::streamsize;
/// \brief Overwrites write_callback to redirect to string instead of
/// stdout.
[[nodiscard]] auto static EasyWriteToString(gsl::owner<char*> data,
- size_t size,
- size_t nmemb,
+ std::size_t size,
+ std::size_t nmemb,
gsl::owner<void*> userptr)
-> std::streamsize;
};
diff --git a/src/other_tools/utils/curl_url_handle.cpp b/src/other_tools/utils/curl_url_handle.cpp
index 912691b4..142d1809 100644
--- a/src/other_tools/utils/curl_url_handle.cpp
+++ b/src/other_tools/utils/curl_url_handle.cpp
@@ -14,6 +14,7 @@
#include "src/other_tools/utils/curl_url_handle.hpp"
+#include <cstddef>
#include <regex>
#include <sstream>
@@ -68,7 +69,7 @@ namespace {
/// Returns the size of the key path if match successful, otherwise nullopt.
[[nodiscard]] auto PathMatchSize(std::string const& key_path,
std::string const& url_path) noexcept
- -> std::optional<size_t> {
+ -> std::optional<std::size_t> {
// split key path
std::vector<std::string> key_tokens{};
std::string token{};
@@ -495,8 +496,8 @@ auto CurlURLHandle::ParseConfigKey(std::string const& key) noexcept
// create regex to find all possible matches of the parsed host in the
// original key, where any '.' can also be a '*'
std::stringstream pattern{};
- size_t old_index{};
- size_t index{};
+ std::size_t old_index{};
+ std::size_t index{};
while ((index = parsed_host.find('.', old_index)) !=
std::string::npos) {
pattern << parsed_host.substr(old_index, index - old_index);
@@ -508,13 +509,14 @@ auto CurlURLHandle::ParseConfigKey(std::string const& key) noexcept
// for every match, replace the parsed host in the found position and
// try to parse as usual
- size_t host_len = parsed_host.length();
+ std::size_t host_len = parsed_host.length();
for (auto it = std::sregex_iterator(key.begin(), key.end(), re);
it != std::sregex_iterator();
++it) {
std::string new_key{key};
- new_key.replace(
- static_cast<size_t>(it->position()), host_len, parsed_host);
+ new_key.replace(static_cast<std::size_t>(it->position()),
+ host_len,
+ parsed_host);
// try to parse new key
auto try_config_key = GetConfigStructFromKey(new_key);
@@ -538,7 +540,7 @@ auto CurlURLHandle::ParseConfigKey(std::string const& key) noexcept
auto CurlURLHandle::MatchConfigKey(std::string const& key) noexcept
-> std::optional<ConfigKeyMatchDegree> {
try {
- size_t host_len{};
+ std::size_t host_len{};
bool user_matched{false};
// parse the given key
diff --git a/src/other_tools/utils/curl_url_handle.hpp b/src/other_tools/utils/curl_url_handle.hpp
index 3d1e6949..476277f3 100644
--- a/src/other_tools/utils/curl_url_handle.hpp
+++ b/src/other_tools/utils/curl_url_handle.hpp
@@ -15,6 +15,7 @@
#ifndef INCLUDED_SRC_OTHER_TOOLS_UTILS_CURL_URL_HANDLE_HPP
#define INCLUDED_SRC_OTHER_TOOLS_UTILS_CURL_URL_HANDLE_HPP
+#include <cstddef>
#include <filesystem>
#include <functional>
#include <memory>
@@ -56,10 +57,10 @@ struct ConfigKeyMatchDegree {
// if a matching happened;
bool matched{false};
// length of config key's host field if host was matched
- size_t host_len{};
+ std::size_t host_len{};
// length of config key's path field if path was matched;
// comparison ends on a '/' char or the end of the path
- size_t path_len{};
+ std::size_t path_len{};
// signals a match for the user field between config key and remote URL,
// only if user field exists in config key
bool user_matched{false};
diff --git a/src/utils/archive/archive_ops.cpp b/src/utils/archive/archive_ops.cpp
index d8363b76..59b1d8a0 100644
--- a/src/utils/archive/archive_ops.cpp
+++ b/src/utils/archive/archive_ops.cpp
@@ -27,7 +27,7 @@ extern "C" {
namespace {
/// \brief Default block size for archive extraction.
-constexpr size_t kArchiveBlockSize = 10240;
+constexpr std::size_t kArchiveBlockSize = 10240;
/// \brief Clean-up function for archive entry objects.
void archive_entry_cleanup(archive_entry* entry) {
@@ -120,7 +120,7 @@ auto ArchiveOps::CopyData(archive* ar, archive* aw)
#ifndef BOOTSTRAP_BUILD_TOOL
int r{};
const void* buff{nullptr};
- size_t size{};
+ std::size_t size{};
la_int64_t offset{};
while (true) {
diff --git a/src/utils/archive/archive_ops.hpp b/src/utils/archive/archive_ops.hpp
index 933bb814..89151790 100644
--- a/src/utils/archive/archive_ops.hpp
+++ b/src/utils/archive/archive_ops.hpp
@@ -15,6 +15,7 @@
#ifndef INCLUDED_SRC_UTILS_ARCHIVE_ARCHIVE_OPS_HPP
#define INCLUDED_SRC_UTILS_ARCHIVE_ARCHIVE_OPS_HPP
+#include <cstddef>
#include <filesystem>
#include <optional>
@@ -25,7 +26,7 @@ using archive = struct archive;
using archive_entry = struct archive_entry;
}
-enum class ArchiveType : size_t {
+enum class ArchiveType : std::size_t {
Zip,
_7Zip,
ZipAuto, // autodetect zip-like archives
diff --git a/src/utils/cpp/hex_string.hpp b/src/utils/cpp/hex_string.hpp
index 44e0adf6..23544d49 100644
--- a/src/utils/cpp/hex_string.hpp
+++ b/src/utils/cpp/hex_string.hpp
@@ -15,6 +15,7 @@
#ifndef INCLUDED_SRC_UTILS_CPP_HEX_STRING_HPP
#define INCLUDED_SRC_UTILS_CPP_HEX_STRING_HPP
+#include <cstddef>
#include <iomanip>
#include <iostream>
#include <optional>
@@ -35,9 +36,9 @@
[[nodiscard]] static inline auto FromHexString(std::string const& hexstring)
-> std::optional<std::string> {
try {
- const size_t kHexBase = 16;
+ const std::size_t kHexBase = 16;
std::stringstream ss{};
- for (size_t i = 0; i < hexstring.length(); i += 2) {
+ for (std::size_t i = 0; i < hexstring.length(); i += 2) {
unsigned char c =
std::stoul(hexstring.substr(i, 2), nullptr, kHexBase);
ss << c;