1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Minor internal tweaks to the OPFS VFS. Resolve a missing result code which lead to a null deref in xFileSize().

FossilOrigin-Name: 57dd593ef0efa17dfb3a9f4eac36d5b8b879e271de817d8cd94a8c8b56d31870
This commit is contained in:
stephan
2022-12-02 18:56:37 +00:00
parent 95bc4d67bb
commit bb4e4a4840
4 changed files with 23 additions and 17 deletions

View File

@ -284,7 +284,7 @@ const installOpfsVfs = function callee(options){
noise for seemingly innocuous things like xAccess() checks
for missing files, so this option may have one of 3 values:
0 = no exception logging
0 = no exception logging.
1 = only log exceptions for "significant" ops like xOpen(),
xRead(), and xWrite().
@ -363,6 +363,7 @@ const installOpfsVfs = function callee(options){
[
'SQLITE_ACCESS_EXISTS',
'SQLITE_ACCESS_READWRITE',
'SQLITE_BUSY',
'SQLITE_ERROR',
'SQLITE_IOERR',
'SQLITE_IOERR_ACCESS',
@ -706,10 +707,15 @@ const installOpfsVfs = function callee(options){
},
xFileSize: function(pFile,pSz64){
mTimeStart('xFileSize');
const rc = opRun('xFileSize', pFile);
let rc = opRun('xFileSize', pFile);
if(0==rc){
const sz = state.s11n.deserialize()[0];
wasm.setMemValue(pSz64, sz, 'i64');
try {
const sz = state.s11n.deserialize()[0];
wasm.setMemValue(pSz64, sz, 'i64');
}catch(e){
error("Unexpected error reading xFileSize() result:",e);
rc = state.sq3Codes.SQLITE_IOERR;
}
}
mTimeEnd();
return rc;
@ -1160,7 +1166,7 @@ const installOpfsVfs = function callee(options){
[
/* Truncate journal mode is faster than delete for
this vfs, per speedtest1. That gap seems to have closed with
Chome version 108 or 109, but "persist" is very roughly 5-6%
Chrome version 108 or 109, but "persist" is very roughly 5-6%
faster than truncate in initial tests. */
"pragma journal_mode=persist;",
/* Set a default busy-timeout handler to help OPFS dbs