Skip to content

Commit

Permalink
Prepare for csize to be uint
Browse files Browse the repository at this point in the history
  • Loading branch information
Clyybber committed Oct 1, 2019
1 parent bdce63b commit 33b2db1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/hts/bam.nim
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ proc from_string*(r:Record, record_string:string) =
raise newException(ValueError, "must create record with NewRecord before calling from_string")


var kstr = kstring_t(s:record_string.cstring, m:record_string.len, l:record_string.len)
var kstr = kstring_t(s:record_string.cstring, m:record_string.len.csize, l:record_string.len.csize)
var ret = sam_parse1(kstr.addr, r.hdr.hdr, r.b)
if ret != 0:
raise newException(ValueError, "error:" & $ret & " in from_string parsing record: " & record_string)
Expand Down
2 changes: 1 addition & 1 deletion src/hts/bgzf/bgzi.nim
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ iterator query*(bi: BGZI, chrom: string, start:int, stop:int): string {.inline.}
fastSubStr(outstr, kstr.s, 0, int(kstr.l))
yield outstr
hts_itr_destroy(itr)
assert kstr.l >= 0
assert int(kstr.l) >= 0
free(kstr.s)
assert fn.addr != nil

Expand Down
4 changes: 2 additions & 2 deletions src/hts/vcf.nim
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ proc toSeq[T](data: var seq[T], p:pointer, n:int) {.inline.} =
if data.len != n:
data.set_len(n)
if n == 0: return
copyMem(data[0].addr, p, (n * sizeof(T).csize))
copyMem(data[0].addr, p, csize(n * sizeof(T)))

proc bcf_hdr_id2type(hdr:ptr bcf_hdr_t, htype:int, int_id:int): int {.inline.}=
# translation of htslib macro.
Expand Down Expand Up @@ -403,7 +403,7 @@ proc destroy_variant(v:Variant) =
free(v.p)

proc from_string*(v: var Variant, h: Header, s:var string) =
var str = kstring_t(s:s.cstring, l:s.len, m:s.len)
var str = kstring_t(s:s.cstring, l:s.len.csize, m:s.len.csize)
if v == nil:
new(v, destroy_variant)
if v.c == nil:
Expand Down

0 comments on commit 33b2db1

Please sign in to comment.