Skip to content

Commit 07da0a4

Browse files
smithlab_utils.hpp: in the kmer_counts function, removing variable length array to silence warnings. This function needs work.
1 parent f476133 commit 07da0a4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

smithlab_utils.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,13 @@ kmer_counts(const std::vector<std::string> &seqs,
380380
counts.resize(nwords, 0);
381381
size_t total = 0;
382382
for (size_t i = 0; i < seqs.size(); ++i) {
383-
char seq[seqs[i].length() + 1];
384-
seq[seqs[i].length()] = '\0';
385-
copy(seqs[i].begin(), seqs[i].end(), seq);
383+
std::vector<char> seq(seqs[i].length() + 1, '\0');
384+
auto seq_data = seq.data();
385+
copy(cbegin(seqs[i]), cend(seqs[i]), seq_data);
386386
for (size_t j = 0; j < seqs[i].length() - k + 1; ++j)
387-
if (std::count_if(seq + j, seq + j + k, &valid_base) ==
387+
if (std::count_if(seq_data + j, seq_data + j + k, &valid_base) ==
388388
static_cast<int>(k)) {
389-
counts[mer2index(seq + j, k)]++;
389+
counts[mer2index(seq_data + j, k)]++;
390390
++total;
391391
}
392392
}

0 commit comments

Comments
 (0)