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:
parent
548ad391d9
commit
53ec5ac69f
16 changed files with 82 additions and 80 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue