mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-24 19:44:21 +01:00
Use u64 for file offsets in IO and calculate such offsets in u64
This commit is contained in:
@@ -578,7 +578,7 @@ impl turso_core::DatabaseStorage for DatabaseFile {
|
||||
if !(512..=65536).contains(&size) || size & (size - 1) != 0 {
|
||||
return Err(turso_core::LimboError::NotADB);
|
||||
}
|
||||
let pos = (page_idx - 1) * size;
|
||||
let pos = (page_idx as u64 - 1) * size as u64;
|
||||
self.file.pread(pos, c)
|
||||
}
|
||||
|
||||
@@ -590,7 +590,7 @@ impl turso_core::DatabaseStorage for DatabaseFile {
|
||||
c: turso_core::Completion,
|
||||
) -> turso_core::Result<turso_core::Completion> {
|
||||
let size = buffer.len();
|
||||
let pos = (page_idx - 1) * size;
|
||||
let pos = (page_idx as u64 - 1) * size as u64;
|
||||
self.file.pwrite(pos, buffer, c)
|
||||
}
|
||||
|
||||
@@ -602,7 +602,7 @@ impl turso_core::DatabaseStorage for DatabaseFile {
|
||||
_io_ctx: &turso_core::IOContext,
|
||||
c: turso_core::Completion,
|
||||
) -> turso_core::Result<turso_core::Completion> {
|
||||
let pos = first_page_idx.saturating_sub(1) * page_size;
|
||||
let pos = first_page_idx.saturating_sub(1) as u64 * page_size as u64;
|
||||
let c = self.file.pwritev(pos, buffers, c)?;
|
||||
Ok(c)
|
||||
}
|
||||
@@ -620,7 +620,7 @@ impl turso_core::DatabaseStorage for DatabaseFile {
|
||||
len: usize,
|
||||
c: turso_core::Completion,
|
||||
) -> turso_core::Result<turso_core::Completion> {
|
||||
let c = self.file.truncate(len, c)?;
|
||||
let c = self.file.truncate(len as u64, c)?;
|
||||
Ok(c)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user