Skip to content

Commit

Permalink
fix code for C/C++ backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Vindaar committed Feb 15, 2024
1 parent b383b1f commit eee6352
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/datamancer/io.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import streams, strutils, tables, parsecsv, sequtils
when not defined(js):
import memfiles
# for reading CSV files from URLs
import httpclient
import httpclient, browsers
#else:
# import jscore
# for `showBrowser`
Expand Down Expand Up @@ -97,7 +97,8 @@ else:
type
MemoryView[T] = ptr UncheckedArray[T]
proc toMemoryView[T](s: seq[T]): MemoryView[T] = cast[ptr UncheckedArray[T]](s[0].addr)
proc toMemoryView(s: string): MemoryView[char] = cast[ptr UncheckedArray[T]](s[0].addr)
proc toMemoryView(s: string): MemoryView[char] = cast[ptr UncheckedArray[char]](s[0].addr)

Check failure on line 100 in src/datamancer/io.nim

View workflow job for this annotation

GitHub Actions / linux (version-1-4)

expression has no address; maybe use 'unsafeAddr'

Check failure on line 100 in src/datamancer/io.nim

View workflow job for this annotation

GitHub Actions / linux (version-1-4)

expression has no address; maybe use 'unsafeAddr'

Check failure on line 100 in src/datamancer/io.nim

View workflow job for this annotation

GitHub Actions / windows (version-1-4)

expression has no address; maybe use 'unsafeAddr'

Check failure on line 100 in src/datamancer/io.nim

View workflow job for this annotation

GitHub Actions / macos (version-1-4)

expression has no address; maybe use 'unsafeAddr'

Check failure on line 100 in src/datamancer/io.nim

View workflow job for this annotation

GitHub Actions / windows (version-1-4)

expression has no address; maybe use 'unsafeAddr'

Check failure on line 100 in src/datamancer/io.nim

View workflow job for this annotation

GitHub Actions / macos (version-1-4)

expression has no address; maybe use 'unsafeAddr'
proc toMemoryView[T](p: pointer): MemoryView[T] = cast[ptr UncheckedArray[T]](p)

template copyBuf(data: MemoryView[char], buf: var string,
idx, colStart: int): untyped =
Expand Down Expand Up @@ -766,7 +767,7 @@ when not defined(js):
if slice.size > 0:
inc lineCnt
## we're dealing with ASCII files, thus each byte can be interpreted as a char
var data = toMemoryView(ff.mem)
var data = toMemoryView[char](ff.mem)
let size = ff.size
else:
var ff = open(fname)
Expand Down

0 comments on commit eee6352

Please sign in to comment.