Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
smehringer committed Feb 13, 2022
1 parent 84a8f15 commit aff2828
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
5 changes: 0 additions & 5 deletions include/bio/format/sam_input_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,6 @@ class format_input_handler<sam> : public format_input_handler_base<format_input_
header_string += "\n";
}

if (header_string.ends_with("\r\n"))
header_string = header_string.substr(0, header_string.size() - 2);
else if (header_string.ends_with("\n"))
header_string = header_string.substr(0, header_string.size() - 1);

header = map_io::header{};
header.read(header_string);
}
Expand Down
2 changes: 1 addition & 1 deletion include/bio/map_io/sam_tag_dictionary.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ class sam_tag_dictionary : public std::map<uint16_t, detail::sam_tag_variant>
if (tag_value.size() % 2 != 0)
throw format_error{"Hexadecimal tag has an uneven number of digits!"};

for (char const * ptr = tag_value.data(); ptr != tag_value.data() + tag_value.size(); ptr += 2)
for (char const * ptr = tag_value.data(); ptr < tag_value.data() + tag_value.size(); ptr += 2)
{
uint8_t tmp_byte{};
// std::from_chars cannot directly parse into a std::byte
Expand Down
3 changes: 1 addition & 2 deletions test/unit/format/sam_input_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ read1 41 * 1 61 1S1M1D1M1I * 0 0 ACGT !##$
)"};

std::string wrong_hexadecimal_tag{
R"(@SQ SN:ref LN:150
read1 41 ref 1 61 1S1M1D1M1I = 10 300 ACGT !##$ bH:H:1AE30
R"(read1 41 ref 1 61 1S1M1D1M1I ref 10 300 ACGT !##$ bH:H:1AE30
)"};
};

Expand Down

0 comments on commit aff2828

Please sign in to comment.