Index: third_party/sqlite/src/src/test_vfs.c |
diff --git a/third_party/sqlite/src/src/test_vfs.c b/third_party/sqlite/src/src/test_vfs.c |
index 7ee2a93453f56913b7911e706c325f56e17026fc..a8c6ae7bf50d15a669460860f64778a5fb4a6887 100644 |
--- a/third_party/sqlite/src/src/test_vfs.c |
+++ b/third_party/sqlite/src/src/test_vfs.c |
@@ -421,7 +421,7 @@ static int tvfsSync(sqlite3_file *pFile, int flags){ |
Testvfs *p = (Testvfs *)pFd->pVfs->pAppData; |
if( p->pScript && p->mask&TESTVFS_SYNC_MASK ){ |
- char *zFlags; |
+ char *zFlags = 0; |
switch( flags ){ |
case SQLITE_SYNC_NORMAL: |
@@ -823,11 +823,12 @@ static int tvfsShmOpen(sqlite3_file *pFile){ |
if( 0==strcmp(pFd->zFilename, pBuffer->zFile) ) break; |
} |
if( !pBuffer ){ |
- int nByte = sizeof(TestvfsBuffer) + (int)strlen(pFd->zFilename) + 1; |
+ int szName = (int)strlen(pFd->zFilename); |
+ int nByte = sizeof(TestvfsBuffer) + szName + 1; |
pBuffer = (TestvfsBuffer *)ckalloc(nByte); |
memset(pBuffer, 0, nByte); |
pBuffer->zFile = (char *)&pBuffer[1]; |
- strcpy(pBuffer->zFile, pFd->zFilename); |
+ memcpy(pBuffer->zFile, pFd->zFilename, szName+1); |
pBuffer->pNext = p->pBuffer; |
p->pBuffer = pBuffer; |
} |
@@ -966,16 +967,15 @@ static void tvfsShmBarrier(sqlite3_file *pFile){ |
TestvfsFd *pFd = tvfsGetFd(pFile); |
Testvfs *p = (Testvfs *)(pFd->pVfs->pAppData); |
+ if( p->pScript && p->mask&TESTVFS_SHMBARRIER_MASK ){ |
+ const char *z = pFd->pShm ? pFd->pShm->zFile : ""; |
+ tvfsExecTcl(p, "xShmBarrier", Tcl_NewStringObj(z, -1), pFd->pShmId, 0, 0); |
+ } |
+ |
if( p->isFullshm ){ |
sqlite3OsShmBarrier(pFd->pReal); |
return; |
} |
- |
- if( p->pScript && p->mask&TESTVFS_SHMBARRIER_MASK ){ |
- tvfsExecTcl(p, "xShmBarrier", |
- Tcl_NewStringObj(pFd->pShm->zFile, -1), pFd->pShmId, 0, 0 |
- ); |
- } |
} |
static int tvfsShmUnmap( |
@@ -1080,7 +1080,7 @@ static int testvfs_obj_cmd( |
switch( aSubcmd[i].eCmd ){ |
case CMD_SHM: { |
Tcl_Obj *pObj; |
- int i, rc; |
+ int rc; |
TestvfsBuffer *pBuffer; |
char *zName; |
if( objc!=3 && objc!=4 ){ |
@@ -1160,7 +1160,6 @@ static int testvfs_obj_cmd( |
}; |
Tcl_Obj **apElem = 0; |
int nElem = 0; |
- int i; |
int mask = 0; |
if( objc!=3 ){ |
Tcl_WrongNumArgs(interp, 2, objv, "LIST"); |
@@ -1225,7 +1224,7 @@ static int testvfs_obj_cmd( |
case CMD_CANTOPENERR: |
case CMD_IOERR: |
case CMD_FULLERR: { |
- TestFaultInject *pTest; |
+ TestFaultInject *pTest = 0; |
int iRet; |
switch( aSubcmd[i].eCmd ){ |
@@ -1531,7 +1530,7 @@ static int testvfs_cmd( |
return TCL_OK; |
bad_args: |
- Tcl_WrongNumArgs(interp, 1, objv, "VFSNAME ?-noshm BOOL? ?-default BOOL? ?-mxpathname INT? ?-szosfile INT? ?-iversion INT?"); |
+ Tcl_WrongNumArgs(interp, 1, objv, "VFSNAME ?-noshm BOOL? ?-fullshm BOOL? ?-default BOOL? ?-mxpathname INT? ?-szosfile INT? ?-iversion INT?"); |
return TCL_ERROR; |
} |