mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
Narrow scope of temporary value
This commit is contained in:
parent
926c3a6664
commit
9ec10046e0
1 changed files with 8 additions and 5 deletions
|
@ -375,21 +375,24 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
|
||||||
}
|
}
|
||||||
|
|
||||||
case wopAddToStore: {
|
case wopAddToStore: {
|
||||||
std::string s, baseName;
|
HashType hashAlgo;
|
||||||
|
std::string baseName;
|
||||||
FileIngestionMethod method;
|
FileIngestionMethod method;
|
||||||
{
|
{
|
||||||
bool fixed; uint8_t recursive;
|
bool fixed;
|
||||||
from >> baseName >> fixed /* obsolete */ >> recursive >> s;
|
uint8_t recursive;
|
||||||
|
std::string hashAlgoRaw;
|
||||||
|
from >> baseName >> fixed /* obsolete */ >> recursive >> hashAlgoRaw;
|
||||||
if (recursive > (uint8_t) FileIngestionMethod::Recursive)
|
if (recursive > (uint8_t) FileIngestionMethod::Recursive)
|
||||||
throw Error("unsupported FileIngestionMethod with value of %i; you may need to upgrade nix-daemon", recursive);
|
throw Error("unsupported FileIngestionMethod with value of %i; you may need to upgrade nix-daemon", recursive);
|
||||||
method = FileIngestionMethod { recursive };
|
method = FileIngestionMethod { recursive };
|
||||||
/* Compatibility hack. */
|
/* Compatibility hack. */
|
||||||
if (!fixed) {
|
if (!fixed) {
|
||||||
s = "sha256";
|
hashAlgoRaw = "sha256";
|
||||||
method = FileIngestionMethod::Recursive;
|
method = FileIngestionMethod::Recursive;
|
||||||
}
|
}
|
||||||
|
hashAlgo = parseHashType(hashAlgoRaw);
|
||||||
}
|
}
|
||||||
HashType hashAlgo = parseHashType(s);
|
|
||||||
|
|
||||||
StringSink savedNAR;
|
StringSink savedNAR;
|
||||||
TeeSource savedNARSource(from, savedNAR);
|
TeeSource savedNARSource(from, savedNAR);
|
||||||
|
|
Loading…
Reference in a new issue