Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change VLA code by using std::vector #787

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions libtiledbvcf/src/read/in_memory_exporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1013,14 +1013,10 @@ bool InMemoryExporter::copy_info_fmt_value(
if (is_gt) {
// Genotype needs special handling to be decoded.
const int* genotype = reinterpret_cast<const int*>(src);
#ifdef _MSC_VER
int* decoded = (int*)_alloca(nelts * sizeof(int));
#else
int decoded[nelts];
#endif
auto decoded = std::vector<int>(nelts);
for (unsigned i = 0; i < nelts; i++)
decoded[i] = bcf_gt_allele(genotype[i]);
return copy_cell(dest, decoded, nelts * sizeof(int), nelts, hdr);
return copy_cell(dest, decoded.data(), nelts * sizeof(int), nelts, hdr);
} else if (is_flag(field_name)) {
// If this is a flag, convert the src pointer to a true or false value.
int flag = src == nullptr ? 0 : 1;
Expand Down
Loading