Skip to content

Commit fb29e39

Browse files
committed
Optimize a slow copy when caculating the checksum
Related to #127
1 parent f3398b0 commit fb29e39

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/nimblepkg/checksums.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ proc updateSha1Checksum(checksum: var Sha1State, fileName, filePath: string) =
3232
while true:
3333
var bytesRead = readChars(file, buffer)
3434
if bytesRead == 0: break
35-
checksum.update(buffer[0..<bytesRead])
35+
checksum.update(buffer.toOpenArray(0, bytesRead - 1))
3636

3737
proc calculateDirSha1Checksum*(dir: string): Sha1Hash =
3838
## Recursively calculates the sha1 checksum of the contents of the directory

0 commit comments

Comments
 (0)