Skip to content

Commit

Permalink
make copy in from_string so that string does not move
Browse files Browse the repository at this point in the history
  • Loading branch information
brentp committed Oct 16, 2019
1 parent 428f610 commit 12b530a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v0.2.23
=======
+ hts/bam fix from_string for bam record and header. See quinlan-lab/STRling#10

v0.2.22
=======
+ changes for latest nim
Expand Down
2 changes: 2 additions & 0 deletions src/hts/bam.nim
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ proc copy*(h: Header): Header =

proc from_string*(h:Header, header_string:string) =
## create a new header from a string
var header_string = header_string
h.hdr = sam_hdr_parse(header_string.len.cint, header_string.cstring)
if h.hdr == nil:
raise newException(ValueError, "error parsing header string:" & header_string)

proc from_string*(r:Record, record_string:string) =
## update the record with the given SAM record. note that this does
## not make a copy of `record_string` and will modify the string in-place.
var record_string = record_string
if r.hdr == nil:
raise newException(ValueError, "must set header for record before calling from_string")
if r.b == nil:
Expand Down

0 comments on commit 12b530a

Please sign in to comment.