mirror of
https://github.com/NixOS/nix
synced 2025-06-28 22:01:15 +02:00
unsigned long long -> uint64_t
This commit is contained in:
parent
ebee2b7852
commit
3f6e88a552
26 changed files with 67 additions and 71 deletions
|
@ -150,17 +150,17 @@ static void skipGeneric(Source & source)
|
|||
|
||||
static void parseContents(ParseSink & sink, Source & source, const Path & path)
|
||||
{
|
||||
unsigned long long size = readLongLong(source);
|
||||
uint64_t size = readLongLong(source);
|
||||
|
||||
sink.preallocateContents(size);
|
||||
|
||||
unsigned long long left = size;
|
||||
uint64_t left = size;
|
||||
std::vector<unsigned char> buf(65536);
|
||||
|
||||
while (left) {
|
||||
checkInterrupt();
|
||||
auto n = buf.size();
|
||||
if ((unsigned long long)n > left) n = left;
|
||||
if ((uint64_t)n > left) n = left;
|
||||
source(buf.data(), n);
|
||||
sink.receiveContents(buf.data(), n);
|
||||
left -= n;
|
||||
|
@ -323,7 +323,7 @@ struct RestoreSink : ParseSink
|
|||
throw SysError("fchmod");
|
||||
}
|
||||
|
||||
void preallocateContents(unsigned long long len)
|
||||
void preallocateContents(uint64_t len)
|
||||
{
|
||||
#if HAVE_POSIX_FALLOCATE
|
||||
if (len) {
|
||||
|
|
|
@ -57,7 +57,7 @@ struct ParseSink
|
|||
|
||||
virtual void createRegularFile(const Path & path) { };
|
||||
virtual void isExecutable() { };
|
||||
virtual void preallocateContents(unsigned long long size) { };
|
||||
virtual void preallocateContents(uint64_t size) { };
|
||||
virtual void receiveContents(unsigned char * data, size_t len) { };
|
||||
|
||||
virtual void createSymlink(const Path & path, const string & target) { };
|
||||
|
|
|
@ -284,7 +284,7 @@ template class BaseSetting<unsigned int>;
|
|||
template class BaseSetting<long>;
|
||||
template class BaseSetting<unsigned long>;
|
||||
template class BaseSetting<long long>;
|
||||
template class BaseSetting<unsigned long long>;
|
||||
template class BaseSetting<uint64_t>;
|
||||
template class BaseSetting<bool>;
|
||||
template class BaseSetting<std::string>;
|
||||
template class BaseSetting<Strings>;
|
||||
|
|
|
@ -111,7 +111,7 @@ Hash hashFile(HashType ht, const Path & path);
|
|||
|
||||
/* Compute the hash of the given path. The hash is defined as
|
||||
(essentially) hashString(ht, dumpPath(path)). */
|
||||
typedef std::pair<Hash, unsigned long long> HashResult;
|
||||
typedef std::pair<Hash, uint64_t> HashResult;
|
||||
HashResult hashPath(HashType ht, const Path & path,
|
||||
PathFilter & filter = defaultPathFilter);
|
||||
|
||||
|
@ -141,7 +141,7 @@ class HashSink : public BufferedSink, public AbstractHashSink
|
|||
private:
|
||||
HashType ht;
|
||||
Ctx * ctx;
|
||||
unsigned long long bytes;
|
||||
uint64_t bytes;
|
||||
|
||||
public:
|
||||
HashSink(HashType ht);
|
||||
|
|
|
@ -29,7 +29,7 @@ template<> void toJSON<unsigned int>(std::ostream & str, const unsigned int & n)
|
|||
template<> void toJSON<long>(std::ostream & str, const long & n) { str << n; }
|
||||
template<> void toJSON<unsigned long>(std::ostream & str, const unsigned long & n) { str << n; }
|
||||
template<> void toJSON<long long>(std::ostream & str, const long long & n) { str << n; }
|
||||
template<> void toJSON<unsigned long long>(std::ostream & str, const unsigned long long & n) { str << n; }
|
||||
template<> void toJSON<uint64_t>(std::ostream & str, const uint64_t & n) { str << n; }
|
||||
template<> void toJSON<float>(std::ostream & str, const float & n) { str << n; }
|
||||
template<> void toJSON<double>(std::ostream & str, const double & n) { str << n; }
|
||||
|
||||
|
|
|
@ -312,14 +312,14 @@ T readNum(Source & source)
|
|||
source(buf, sizeof(buf));
|
||||
|
||||
uint64_t n =
|
||||
((unsigned long long) buf[0]) |
|
||||
((unsigned long long) buf[1] << 8) |
|
||||
((unsigned long long) buf[2] << 16) |
|
||||
((unsigned long long) buf[3] << 24) |
|
||||
((unsigned long long) buf[4] << 32) |
|
||||
((unsigned long long) buf[5] << 40) |
|
||||
((unsigned long long) buf[6] << 48) |
|
||||
((unsigned long long) buf[7] << 56);
|
||||
((uint64_t) buf[0]) |
|
||||
((uint64_t) buf[1] << 8) |
|
||||
((uint64_t) buf[2] << 16) |
|
||||
((uint64_t) buf[3] << 24) |
|
||||
((uint64_t) buf[4] << 32) |
|
||||
((uint64_t) buf[5] << 40) |
|
||||
((uint64_t) buf[6] << 48) |
|
||||
((uint64_t) buf[7] << 56);
|
||||
|
||||
if (n > std::numeric_limits<T>::max())
|
||||
throw SerialisationError("serialised integer %d is too large for type '%s'", n, typeid(T).name());
|
||||
|
|
|
@ -374,7 +374,7 @@ void writeLine(int fd, string s)
|
|||
}
|
||||
|
||||
|
||||
static void _deletePath(int parentfd, const Path & path, unsigned long long & bytesFreed)
|
||||
static void _deletePath(int parentfd, const Path & path, uint64_t & bytesFreed)
|
||||
{
|
||||
checkInterrupt();
|
||||
|
||||
|
@ -414,7 +414,7 @@ static void _deletePath(int parentfd, const Path & path, unsigned long long & by
|
|||
}
|
||||
}
|
||||
|
||||
static void _deletePath(const Path & path, unsigned long long & bytesFreed)
|
||||
static void _deletePath(const Path & path, uint64_t & bytesFreed)
|
||||
{
|
||||
Path dir = dirOf(path);
|
||||
if (dir == "")
|
||||
|
@ -435,12 +435,12 @@ static void _deletePath(const Path & path, unsigned long long & bytesFreed)
|
|||
|
||||
void deletePath(const Path & path)
|
||||
{
|
||||
unsigned long long dummy;
|
||||
uint64_t dummy;
|
||||
deletePath(path, dummy);
|
||||
}
|
||||
|
||||
|
||||
void deletePath(const Path & path, unsigned long long & bytesFreed)
|
||||
void deletePath(const Path & path, uint64_t & bytesFreed)
|
||||
{
|
||||
//Activity act(*logger, lvlDebug, format("recursively deleting path '%1%'") % path);
|
||||
bytesFreed = 0;
|
||||
|
|
|
@ -125,7 +125,7 @@ void writeLine(int fd, string s);
|
|||
second variant returns the number of bytes and blocks freed. */
|
||||
void deletePath(const Path & path);
|
||||
|
||||
void deletePath(const Path & path, unsigned long long & bytesFreed);
|
||||
void deletePath(const Path & path, uint64_t & bytesFreed);
|
||||
|
||||
std::string getUserName();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue