From 32dd2b40d2634e0dc4022674143c79f217143148 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Wed, 11 Dec 2019 10:56:01 +0100 Subject: fixed possible overflow and added some static casts to replace C-style casts --- Source/Python/WarpXWrappers.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Source/Python') diff --git a/Source/Python/WarpXWrappers.cpp b/Source/Python/WarpXWrappers.cpp index be9ec9519..3074b1990 100644 --- a/Source/Python/WarpXWrappers.cpp +++ b/Source/Python/WarpXWrappers.cpp @@ -14,8 +14,9 @@ namespace *num_boxes = mf.local_size(); int shapesize = AMREX_SPACEDIM; if (mf.nComp() > 1) shapesize += 1; - *shapes = (int*) malloc(shapesize * (*num_boxes) * sizeof(int)); - amrex::Real** data = (amrex::Real**) malloc((*num_boxes) * sizeof(amrex::Real*)); + *shapes = static_cast(malloc(sizeof(int)*shapesize * (*num_boxes))); + auto data = + static_cast(malloc((*num_boxes) * sizeof(amrex::Real*))); #ifdef _OPENMP #pragma omp parallel -- cgit v1.2.3