mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
* Use a proper namespace.
* Optimise header file usage a bit. * Compile the parser as C++.
This commit is contained in:
parent
aab8812732
commit
75068e7d75
61 changed files with 650 additions and 268 deletions
|
@ -15,12 +15,16 @@ extern "C" {
|
|||
|
||||
#include "hash.hh"
|
||||
#include "archive.hh"
|
||||
#include "util.hh"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
||||
Hash::Hash()
|
||||
{
|
||||
type = htUnknown;
|
||||
|
@ -89,9 +93,9 @@ Hash parseHash(HashType ht, const string & s)
|
|||
string s2(s, i * 2, 2);
|
||||
if (!isxdigit(s2[0]) || !isxdigit(s2[1]))
|
||||
throw Error(format("invalid hash `%1%'") % s);
|
||||
istringstream str(s2);
|
||||
std::istringstream str(s2);
|
||||
int n;
|
||||
str >> hex >> n;
|
||||
str >> std::hex >> n;
|
||||
hash.hash[i] = n;
|
||||
}
|
||||
return hash;
|
||||
|
@ -313,3 +317,6 @@ HashType parseHashType(const string & s)
|
|||
else if (s == "sha256") return htSHA256;
|
||||
else return htUnknown;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue