From 4b9a541b852645713527f7666a8c703ea8318c89 Mon Sep 17 00:00:00 2001 From: Ianna Osborne Date: Thu, 20 Jan 2022 11:43:50 +0100 Subject: [PATCH] commit before updating to master --- src/libawkward/builder/ArrayBuilder.cpp | 4 +++- src/libawkward/builder/BoolBuilder.cpp | 2 +- src/libawkward/builder/GrowableBuffer.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libawkward/builder/ArrayBuilder.cpp b/src/libawkward/builder/ArrayBuilder.cpp index f3c1719efd..d1816b2a80 100644 --- a/src/libawkward/builder/ArrayBuilder.cpp +++ b/src/libawkward/builder/ArrayBuilder.cpp @@ -29,7 +29,9 @@ namespace awkward { void ArrayBuilder::clear() { - builder_.get()->clear(); + if (builder_) { + builder_.get()->clear(); + } } void diff --git a/src/libawkward/builder/BoolBuilder.cpp b/src/libawkward/builder/BoolBuilder.cpp index ccf26a8f1c..a52e4001b8 100644 --- a/src/libawkward/builder/BoolBuilder.cpp +++ b/src/libawkward/builder/BoolBuilder.cpp @@ -34,7 +34,7 @@ namespace awkward { container.copy_buffer(form_key.str() + "-data", buffer_.ptr().get(), - buffer_.length() * (int64_t)sizeof(bool)); + (int64_t)(buffer_.length() * sizeof(bool))); return "{\"class\": \"NumpyArray\", \"primitive\": \"bool\", \"form_key\": \"" + form_key.str() + "\"}"; diff --git a/src/libawkward/builder/GrowableBuffer.cpp b/src/libawkward/builder/GrowableBuffer.cpp index de918d9722..a4d373723b 100644 --- a/src/libawkward/builder/GrowableBuffer.cpp +++ b/src/libawkward/builder/GrowableBuffer.cpp @@ -128,7 +128,7 @@ namespace awkward { GrowableBuffer::clear() { length_ = 0; reserved_ = (size_t) options_.initial(); - ptr_ = nullptr; + ptr_ = UniquePtr(reinterpret_cast(awkward_malloc(options_.initial()*(int64_t)sizeof(T)))); } template