lib/model: Fix integer conversion (fixes #5837) (#5851)

This commit is contained in:
Simon Frei 2019-07-12 16:37:12 +02:00 committed by Jakob Borg
parent 4b3f9b1af9
commit 20c8dbd9ed
2 changed files with 3 additions and 3 deletions

View File

@ -1256,7 +1256,7 @@ func (f *sendReceiveFolder) copierRoutine(in <-chan copyBlocksState, pullChan ch
if len(hashesToFind) > 0 {
file, err = f.fs.Open(state.file.Name)
if err == nil {
weakHashFinder, err = weakhash.NewFinder(f.ctx, file, int(state.file.BlockSize()), hashesToFind)
weakHashFinder, err = weakhash.NewFinder(f.ctx, file, state.file.BlockSize(), hashesToFind)
if err != nil {
l.Debugln("weak hasher", err)
}

View File

@ -722,7 +722,7 @@ func (m *model) Completion(device protocol.DeviceID, folder string) FolderComple
}
// This might might be more than it really is, because some blocks can be of a smaller size.
downloaded = int64(counts[ft.Name] * int(ft.BlockSize()))
downloaded = int64(counts[ft.Name]) * int64(ft.BlockSize())
fileNeed = ft.FileSize() - downloaded
if fileNeed < 0 {
@ -1623,7 +1623,7 @@ func (m *model) recheckFile(deviceID protocol.DeviceID, folderFs fs.Filesystem,
return
}
blockIndex := int(offset) / cf.BlockSize()
blockIndex := int(offset / int64(cf.BlockSize()))
if blockIndex >= len(cf.Blocks) {
l.Debugf("%v recheckFile: %s: %q / %q i=%d: block index too far", m, deviceID, folder, name, blockIndex)
return