diff options
author | 2019-12-11 10:56:01 +0100 | |
---|---|---|
committer | 2019-12-11 10:56:01 +0100 | |
commit | 32dd2b40d2634e0dc4022674143c79f217143148 (patch) | |
tree | 8fc23724e672e136a44b675c03670e450b27c850 /Source/Python | |
parent | 9035ad29364f78e9fe1dad623dadc59035b65f09 (diff) | |
download | WarpX-32dd2b40d2634e0dc4022674143c79f217143148.tar.gz WarpX-32dd2b40d2634e0dc4022674143c79f217143148.tar.zst WarpX-32dd2b40d2634e0dc4022674143c79f217143148.zip |
fixed possible overflow and added some static casts to replace C-style casts
Diffstat (limited to 'Source/Python')
-rw-r--r-- | Source/Python/WarpXWrappers.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
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<int*>(malloc(sizeof(int)*shapesize * (*num_boxes))); + auto data = + static_cast<amrex::Real**>(malloc((*num_boxes) * sizeof(amrex::Real*))); #ifdef _OPENMP #pragma omp parallel |