Skip to content

Commit

Permalink
Merge pull request #232 from smithlabcode/unxcounts-bugfix
Browse files Browse the repository at this point in the history
Bugfix for unxcount
  • Loading branch information
andrewdavidsmith committed Jun 23, 2024
2 parents 7b9ab65 + 6a6c4f9 commit 0f9e1e3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/utils/unxcounts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,11 @@ write_missing_cpg(const uint32_t &name_size, const string &chrom,
const auto buf_end = buf.data() + size(buf);
// chrom name is already in the buffer so move past it
auto cursor = buf.data() + name_size + 1;
for (auto pos = start_pos; pos < end_pos; ++pos) {
const char base = chrom[pos];
if (is_cytosine(base)) {
for (auto pos = start_pos; pos < end_pos - 1; ++pos) {
// When this function is called, the "end_pos" is either the chrom
// size or the position of a base known to be a C. So we never
// have to allow pos+1 to equal end_pos.
if (is_cytosine(chrom[pos]) && is_guanine(chrom[pos+1])) {
#pragma GCC diagnostic push
#pragma GCC diagnostic error "-Wstringop-overflow=0"
auto [ptr, ec] = to_chars(cursor, buf_end, pos);
Expand Down

0 comments on commit 0f9e1e3

Please sign in to comment.