1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 01:11:15 +02:00

Fix some random -Wconversion warnings

This commit is contained in:
Eelco Dolstra 2018-05-02 13:56:34 +02:00
parent 548ad391d9
commit 53ec5ac69f
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
16 changed files with 82 additions and 80 deletions

View file

@ -24,13 +24,15 @@ static void * allocBytes(size_t n)
/* Allocate a new array of attributes for an attribute set with a specific
capacity. The space is implicitly reserved after the Bindings
structure. */
Bindings * EvalState::allocBindings(Bindings::size_t capacity)
Bindings * EvalState::allocBindings(size_t capacity)
{
return new (allocBytes(sizeof(Bindings) + sizeof(Attr) * capacity)) Bindings(capacity);
if (capacity > std::numeric_limits<Bindings::size_t>::max())
throw Error("attribute set of size %d is too big", capacity);
return new (allocBytes(sizeof(Bindings) + sizeof(Attr) * capacity)) Bindings((Bindings::size_t) capacity);
}
void EvalState::mkAttrs(Value & v, unsigned int capacity)
void EvalState::mkAttrs(Value & v, size_t capacity)
{
if (capacity == 0) {
v = vEmptySet;