tree-wide: fix various lint warnings
Change-Id: I0fc80718eb7e02d84cc4b5d5deec4c0f41116134
This commit is contained in:
parent
9238e62ae6
commit
ca9d3e6e00
|
@ -53,7 +53,7 @@ void ConfigFile::apply()
|
|||
|
||||
bool trusted = whitelist.count(baseName);
|
||||
if (!trusted) {
|
||||
switch (nix::fetchSettings.acceptFlakeConfig) {
|
||||
switch (nix::fetchSettings.acceptFlakeConfig.get()) {
|
||||
case AcceptFlakeConfig::True: {
|
||||
trusted = true;
|
||||
break;
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "state.hh"
|
||||
|
||||
#include <charconv>
|
||||
#include <clocale>
|
||||
#include <memory>
|
||||
|
||||
// flip this define when doing parser development to enable some g checks.
|
||||
|
@ -254,7 +253,8 @@ struct AttrState : SubexprState {
|
|||
|
||||
std::vector<AttrName> attrs;
|
||||
|
||||
void pushAttr(auto && attr, PosIdx) { attrs.emplace_back(std::move(attr)); }
|
||||
template <typename T>
|
||||
void pushAttr(T && attr, PosIdx) { attrs.emplace_back(std::forward<T>(attr)); }
|
||||
};
|
||||
|
||||
template<> struct BuildAST<grammar::attr::simple> {
|
||||
|
@ -290,7 +290,8 @@ struct InheritState : SubexprState {
|
|||
std::unique_ptr<Expr> from;
|
||||
PosIdx fromPos;
|
||||
|
||||
void pushAttr(auto && attr, PosIdx pos) { attrs.emplace_back(std::move(attr), pos); }
|
||||
template <typename T>
|
||||
void pushAttr(T && attr, PosIdx pos) { attrs.emplace_back(std::forward<T>(attr), pos); }
|
||||
};
|
||||
|
||||
template<> struct BuildAST<grammar::inherit::from> {
|
||||
|
|
|
@ -477,8 +477,17 @@ struct curlFileTransfer : public FileTransfer
|
|||
|
||||
~curlFileTransfer()
|
||||
{
|
||||
try {
|
||||
stopWorkerThread();
|
||||
|
||||
} catch (nix::Error e) {
|
||||
// This can only fail if a socket to our own process cannot be
|
||||
// written to, so it is always a bug in the program if it fails.
|
||||
//
|
||||
// Joining the thread would probably only cause a deadlock if this
|
||||
// happened, so just die on purpose.
|
||||
printError("failed to join curl file transfer worker thread: %1%", e.what());
|
||||
std::terminate();
|
||||
}
|
||||
workerThread.join();
|
||||
|
||||
if (curlm) curl_multi_cleanup(curlm);
|
||||
|
|
|
@ -33,7 +33,7 @@ Machine::Machine(decltype(storeUri) storeUri,
|
|||
systemTypes(systemTypes),
|
||||
sshKey(sshKey),
|
||||
maxJobs(maxJobs),
|
||||
speedFactor(speedFactor == 0.0f ? 1.0f : std::move(speedFactor)),
|
||||
speedFactor(speedFactor == 0.0f ? 1.0f : speedFactor),
|
||||
supportedFeatures(supportedFeatures),
|
||||
mandatoryFeatures(mandatoryFeatures),
|
||||
sshPublicHostKey(sshPublicHostKey)
|
||||
|
|
|
@ -192,7 +192,7 @@ static Generator<Entry> parseObject(Source & source, const Path & path)
|
|||
#define EXPECT(raw, kind) \
|
||||
do { \
|
||||
const auto s = readString(source); \
|
||||
if (s != raw) { \
|
||||
if (s != (raw)) { \
|
||||
throw badArchive("expected " kind " tag"); \
|
||||
} \
|
||||
co_yield MetadataString{s}; \
|
||||
|
|
|
@ -131,7 +131,7 @@ AutoCloseFD::AutoCloseFD(AutoCloseFD && that) : fd{that.fd}
|
|||
}
|
||||
|
||||
|
||||
AutoCloseFD & AutoCloseFD::operator =(AutoCloseFD && that)
|
||||
AutoCloseFD & AutoCloseFD::operator =(AutoCloseFD && that) noexcept(false)
|
||||
{
|
||||
close();
|
||||
fd = that.fd;
|
||||
|
|
|
@ -229,7 +229,7 @@ Hash::Hash(std::string_view rest, HashType type, bool isSRI)
|
|||
|
||||
for (unsigned int n = 0; n < rest.size(); ++n) {
|
||||
char c = rest[rest.size() - n - 1];
|
||||
unsigned char digit;
|
||||
size_t digit;
|
||||
for (digit = 0; digit < base32Chars.size(); ++digit) /* !!! slow */
|
||||
if (base32Chars[digit] == c) break;
|
||||
if (digit >= 32)
|
||||
|
|
|
@ -62,6 +62,8 @@ std::vector<std::string> shell_split(const std::string & input)
|
|||
begin = ++iterator;
|
||||
}
|
||||
break;
|
||||
// no other relevant cases; silence exhaustiveness compiler warning
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ std::string percentDecode(std::string_view in)
|
|||
if (i + 2 >= in.size())
|
||||
throw BadURL("invalid URI parameter '%s'", in);
|
||||
try {
|
||||
decoded += std::stoul(std::string(in, i + 1, 2), 0, 16);
|
||||
decoded += char8_t(std::stoul(std::string(in, i + 1, 2), 0, 16));
|
||||
i += 3;
|
||||
} catch (...) {
|
||||
throw BadURL("invalid URI parameter '%s'", in);
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
#include "cli-literate-parser.hh"
|
||||
#include "escape-string.hh"
|
||||
#include "escape-char.hh"
|
||||
#include "libexpr/print.hh"
|
||||
#include "types.hh"
|
||||
#include <ranges>
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
#include <boost/algorithm/string/trim.hpp>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <variant>
|
||||
|
||||
#include "cli-literate-parser.hh"
|
||||
#include "escape-string.hh"
|
||||
#include "fmt.hh"
|
||||
#include "libexpr/print.hh"
|
||||
#include "shlex.hh"
|
||||
#include "types.hh"
|
||||
#include "strings.hh"
|
||||
|
@ -361,9 +357,8 @@ const char * ParseError::what() const noexcept
|
|||
return what_->c_str();
|
||||
} else {
|
||||
auto escaped = escapeString(rest, {.maxLength = 256, .escapeNonPrinting = true});
|
||||
auto hint =
|
||||
new HintFmt("Parse error: Expected %1%, got:\n%2%", expected, Uncolored(escaped));
|
||||
what_ = hint->str();
|
||||
auto hint = HintFmt("Parse error: Expected %1%, got:\n%2%", expected, Uncolored(escaped));
|
||||
what_ = hint.str();
|
||||
return what_->c_str();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue