mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-26 20:33:33 -06:00
bump ncruces/go-sqlite3 to v0.25.0
This commit is contained in:
parent
6473886c8e
commit
9fe53dbf1c
36 changed files with 636 additions and 578 deletions
24
vendor/github.com/ncruces/go-sqlite3/vfs/cksm.go
generated
vendored
24
vendor/github.com/ncruces/go-sqlite3/vfs/cksm.go
generated
vendored
|
|
@ -49,9 +49,7 @@ func (c cksmFile) ReadAt(p []byte, off int64) (n int, err error) {
|
|||
n, err = c.File.ReadAt(p, off)
|
||||
p = p[:n]
|
||||
|
||||
// SQLite is reading the header of a database file.
|
||||
if c.isDB && off == 0 && len(p) >= 100 &&
|
||||
bytes.HasPrefix(p, []byte("SQLite format 3\000")) {
|
||||
if isHeader(c.isDB, p, off) {
|
||||
c.init((*[100]byte)(p))
|
||||
}
|
||||
|
||||
|
|
@ -67,9 +65,7 @@ func (c cksmFile) ReadAt(p []byte, off int64) (n int, err error) {
|
|||
}
|
||||
|
||||
func (c cksmFile) WriteAt(p []byte, off int64) (n int, err error) {
|
||||
// SQLite is writing the first page of a database file.
|
||||
if c.isDB && off == 0 && len(p) >= 100 &&
|
||||
bytes.HasPrefix(p, []byte("SQLite format 3\000")) {
|
||||
if isHeader(c.isDB, p, off) {
|
||||
c.init((*[100]byte)(p))
|
||||
}
|
||||
|
||||
|
|
@ -116,9 +112,11 @@ func (c cksmFile) fileControl(ctx context.Context, mod api.Module, op _FcntlOpco
|
|||
c.inCkpt = true
|
||||
case _FCNTL_CKPT_DONE:
|
||||
c.inCkpt = false
|
||||
}
|
||||
if rc := vfsFileControlImpl(ctx, mod, c, op, pArg); rc != _NOTFOUND {
|
||||
return rc
|
||||
case _FCNTL_PRAGMA:
|
||||
rc := vfsFileControlImpl(ctx, mod, c, op, pArg)
|
||||
if rc != _NOTFOUND {
|
||||
return rc
|
||||
}
|
||||
}
|
||||
return vfsFileControlImpl(ctx, mod, c.File, op, pArg)
|
||||
}
|
||||
|
|
@ -135,6 +133,14 @@ func (f *cksmFlags) init(header *[100]byte) {
|
|||
}
|
||||
}
|
||||
|
||||
func isHeader(isDB bool, p []byte, off int64) bool {
|
||||
check := sql3util.ValidPageSize(len(p))
|
||||
if isDB {
|
||||
check = off == 0 && len(p) >= 100
|
||||
}
|
||||
return check && bytes.HasPrefix(p, []byte("SQLite format 3\000"))
|
||||
}
|
||||
|
||||
func cksmCompute(a []byte) (cksm [8]byte) {
|
||||
var s1, s2 uint32
|
||||
for len(a) >= 8 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue