diff options
author | 2025-02-13 08:53:40 +0000 | |
---|---|---|
committer | 2025-02-13 09:53:40 +0100 | |
commit | 24f6760c0e355903458f71e539201c8bf37cfac6 (patch) | |
tree | c5f43e72ba452fddceb3c2531a64d4b835246927 /vendor/github.com/ncruces/go-sqlite3/blob.go | |
parent | [feature] Implement backfilling statuses thru scheduled_at (#3685) (diff) | |
download | gotosocial-24f6760c0e355903458f71e539201c8bf37cfac6.tar.xz |
[chore] bump ncruces go-sqlite3 => v0.23.0 (#3785)
* bump ncruces go-sqlite3 => v0.23.0
* whoops, add missing vendor changes...
Diffstat (limited to 'vendor/github.com/ncruces/go-sqlite3/blob.go')
-rw-r--r-- | vendor/github.com/ncruces/go-sqlite3/blob.go | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/vendor/github.com/ncruces/go-sqlite3/blob.go b/vendor/github.com/ncruces/go-sqlite3/blob.go index a0969eb69..2fac72045 100644 --- a/vendor/github.com/ncruces/go-sqlite3/blob.go +++ b/vendor/github.com/ncruces/go-sqlite3/blob.go @@ -20,8 +20,8 @@ type Blob struct { c *Conn bytes int64 offset int64 - handle uint32 - bufptr uint32 + handle ptr_t + bufptr ptr_t buflen int64 } @@ -37,23 +37,23 @@ func (c *Conn) OpenBlob(db, table, column string, row int64, write bool) (*Blob, tablePtr := c.arena.string(table) columnPtr := c.arena.string(column) - var flags uint64 + var flags int32 if write { flags = 1 } c.checkInterrupt(c.handle) - r := c.call("sqlite3_blob_open", uint64(c.handle), - uint64(dbPtr), uint64(tablePtr), uint64(columnPtr), - uint64(row), flags, uint64(blobPtr)) + rc := res_t(c.call("sqlite3_blob_open", stk_t(c.handle), + stk_t(dbPtr), stk_t(tablePtr), stk_t(columnPtr), + stk_t(row), stk_t(flags), stk_t(blobPtr))) - if err := c.error(r); err != nil { + if err := c.error(rc); err != nil { return nil, err } blob := Blob{c: c} - blob.handle = util.ReadUint32(c.mod, blobPtr) - blob.bytes = int64(c.call("sqlite3_blob_bytes", uint64(blob.handle))) + blob.handle = util.Read32[ptr_t](c.mod, blobPtr) + blob.bytes = int64(int32(c.call("sqlite3_blob_bytes", stk_t(blob.handle)))) return &blob, nil } @@ -67,10 +67,10 @@ func (b *Blob) Close() error { return nil } - r := b.c.call("sqlite3_blob_close", uint64(b.handle)) + rc := res_t(b.c.call("sqlite3_blob_close", stk_t(b.handle))) b.c.free(b.bufptr) b.handle = 0 - return b.c.error(r) + return b.c.error(rc) } // Size returns the size of the BLOB in bytes. @@ -94,13 +94,13 @@ func (b *Blob) Read(p []byte) (n int, err error) { want = avail } if want > b.buflen { - b.bufptr = b.c.realloc(b.bufptr, uint64(want)) + b.bufptr = b.c.realloc(b.bufptr, want) b.buflen = want } - r := b.c.call("sqlite3_blob_read", uint64(b.handle), - uint64(b.bufptr), uint64(want), uint64(b.offset)) - err = b.c.error(r) + rc := res_t(b.c.call("sqlite3_blob_read", stk_t(b.handle), + stk_t(b.bufptr), stk_t(want), stk_t(b.offset))) + err = b.c.error(rc) if err != nil { return 0, err } @@ -109,7 +109,7 @@ func (b *Blob) Read(p []byte) (n int, err error) { err = io.EOF } - copy(p, util.View(b.c.mod, b.bufptr, uint64(want))) + copy(p, util.View(b.c.mod, b.bufptr, want)) return int(want), err } @@ -127,19 +127,19 @@ func (b *Blob) WriteTo(w io.Writer) (n int64, err error) { want = avail } if want > b.buflen { - b.bufptr = b.c.realloc(b.bufptr, uint64(want)) + b.bufptr = b.c.realloc(b.bufptr, want) b.buflen = want } for want > 0 { - r := b.c.call("sqlite3_blob_read", uint64(b.handle), - uint64(b.bufptr), uint64(want), uint64(b.offset)) - err = b.c.error(r) + rc := res_t(b.c.call("sqlite3_blob_read", stk_t(b.handle), + stk_t(b.bufptr), stk_t(want), stk_t(b.offset))) + err = b.c.error(rc) if err != nil { return n, err } - mem := util.View(b.c.mod, b.bufptr, uint64(want)) + mem := util.View(b.c.mod, b.bufptr, want) m, err := w.Write(mem[:want]) b.offset += int64(m) n += int64(m) @@ -165,14 +165,14 @@ func (b *Blob) WriteTo(w io.Writer) (n int64, err error) { func (b *Blob) Write(p []byte) (n int, err error) { want := int64(len(p)) if want > b.buflen { - b.bufptr = b.c.realloc(b.bufptr, uint64(want)) + b.bufptr = b.c.realloc(b.bufptr, want) b.buflen = want } util.WriteBytes(b.c.mod, b.bufptr, p) - r := b.c.call("sqlite3_blob_write", uint64(b.handle), - uint64(b.bufptr), uint64(want), uint64(b.offset)) - err = b.c.error(r) + rc := res_t(b.c.call("sqlite3_blob_write", stk_t(b.handle), + stk_t(b.bufptr), stk_t(want), stk_t(b.offset))) + err = b.c.error(rc) if err != nil { return 0, err } @@ -196,17 +196,17 @@ func (b *Blob) ReadFrom(r io.Reader) (n int64, err error) { want = 1 } if want > b.buflen { - b.bufptr = b.c.realloc(b.bufptr, uint64(want)) + b.bufptr = b.c.realloc(b.bufptr, want) b.buflen = want } for { - mem := util.View(b.c.mod, b.bufptr, uint64(want)) + mem := util.View(b.c.mod, b.bufptr, want) m, err := r.Read(mem[:want]) if m > 0 { - r := b.c.call("sqlite3_blob_write", uint64(b.handle), - uint64(b.bufptr), uint64(m), uint64(b.offset)) - err := b.c.error(r) + rc := res_t(b.c.call("sqlite3_blob_write", stk_t(b.handle), + stk_t(b.bufptr), stk_t(m), stk_t(b.offset))) + err := b.c.error(rc) if err != nil { return n, err } @@ -254,8 +254,8 @@ func (b *Blob) Seek(offset int64, whence int) (int64, error) { // https://sqlite.org/c3ref/blob_reopen.html func (b *Blob) Reopen(row int64) error { b.c.checkInterrupt(b.c.handle) - err := b.c.error(b.c.call("sqlite3_blob_reopen", uint64(b.handle), uint64(row))) - b.bytes = int64(b.c.call("sqlite3_blob_bytes", uint64(b.handle))) + err := b.c.error(res_t(b.c.call("sqlite3_blob_reopen", stk_t(b.handle), stk_t(row)))) + b.bytes = int64(int32(b.c.call("sqlite3_blob_bytes", stk_t(b.handle)))) b.offset = 0 return err } |