Skip to content

Commit

Permalink
CarpetX: avoid varsize array
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaas80 committed Dec 6, 2024
1 parent a665253 commit 0a2d057
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CarpetX/src/io_openpmd.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1206,8 +1206,8 @@ void carpetx_openpmd_t::InputOpenPMD(const cGH *const cctkGH,
constexpr std::uint64_t ipoison =
0xfff8000000000000ULL + 0xdeadbeef;
#endif
char poison[CCTK_VarTypeSize(cgroup.vartype)];
std::memcpy(&poison, &ipoison, sizeof(poison));
std::vector<char> poison(CCTK_VarTypeSize(cgroup.vartype));
std::memcpy(poison.data(), &ipoison, poison.size());
for (int k = extbox.lo[2]; k < extbox.hi[2]; ++k) {
for (int j = extbox.lo[1]; j < extbox.hi[1]; ++j) {
for (int i = extbox.lo[0]; i < extbox.hi[0]; ++i) {
Expand All @@ -1216,7 +1216,7 @@ void carpetx_openpmd_t::InputOpenPMD(const cGH *const cctkGH,
memcpy(cactus_ptr->data_at(cactus_di * i +
cactus_dj * j +
cactus_dk * k),
poison, sizeof(poison));
poison.data(), poison.size());
}
}
}
Expand Down

0 comments on commit 0a2d057

Please sign in to comment.