Further work on getting ssdsim to run. This is an incremental checkin to

save my place while jumping off to work on other things.

FossilOrigin-Name: ae2f1627b1672e511be1ff132f2a3fb8f8bb7169
This commit is contained in:
drh
2012-10-25 23:47:27 +00:00
parent 08882bc737
commit 79e5c91672
3 changed files with 16 additions and 20 deletions
+6 -6
View File
@@ -1,5 +1,5 @@
C Merge\sthe\scommand-line\sshell\senhancements\sfrom\strunk.\s\sOther\sedits\stoward\ntrying\sto\sget\sssdsim\sto\srun.
D 2012-10-25T15:32:29.056
C Further\swork\son\sgetting\sssdsim\sto\srun.\s\sThis\sis\san\sincremental\scheckin\sto\nsave\smy\splace\swhile\sjumping\soff\sto\swork\son\sother\sthings.
D 2012-10-25T23:47:27.493
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 5f4f26109f9d80829122e0e09f9cda008fa065fb
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -221,7 +221,7 @@ F src/test_rtree.c aba603c949766c4193f1068b91c787f57274e0d9
F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0
F src/test_server.c 2f99eb2837dfa06a4aacf24af24c6affdf66a84f
F src/test_spellfix.c 76dd8d3111d2f5354c374f71fa23b752bd0b029c
F src/test_ssdsim.c b4b2ff870e31cdecaf5716c4373a7d9ffc1d3762
F src/test_ssdsim.c bb4fefe91b9e4d4e3e09488814cc586575590ad4
F src/test_stat.c d1569c7a4839f13e80187e2c26b2ab4da2d03935
F src/test_superlock.c 2b97936ca127d13962c3605dbc9a4ef269c424cd
F src/test_syscall.c a992d8c80ea91fbf21fb2dd570db40e77dd7e6ae
@@ -1022,7 +1022,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 67d8a99aceb56384a81b3f30d6c71743146d2cc9
P 9e6efcf05402cd0b259c9b2ae57e349800650bd7 317c80cba3688a97ade9cde622cc3bd94cf3436a
R b62d4d680a3785f5f27895a1b1bebbb9
P 848f87e22fc6bfbbb7dbc7491c8a20cdd53b7420
R b9ddcfef141182b6a9e7751152774567
U drh
Z cbf54f1147196dcbcbab5648835d5435
Z 1dcb4d96fc4b1f34fb139b8208725f7a
+1 -1
View File
@@ -1 +1 @@
848f87e22fc6bfbbb7dbc7491c8a20cdd53b7420
ae2f1627b1672e511be1ff132f2a3fb8f8bb7169
+9 -13
View File
@@ -310,7 +310,7 @@ static int ssdsimRead(
ssdsim_file *p = (ssdsim_file *)pFile;
ssdsim_inode *pInode = p->pInode;
int rc = SQLITE_OK;
int lpn, ppn, n;
int lpn, ppn, n, mx;
unsigned char *pOut = (unsigned char*)zBuf;
unsigned char *pContent;
while( iAmt>0 ){
@@ -322,9 +322,8 @@ static int ssdsimRead(
lpn = pInode->aiPage[iOfst/g.szPage];
ppn = ssdsimCoreLpnToPpn(lpn, 0);
n = iAmt;
if( (iOfst+n-1)*g.szPage > lpn ){
n = (lpn+1)*g.szPage - iOfst;
}
mx = g.szPage - iOfst%g.szPage;
if( n>mx ) n = mx;
if( ppn>=0 && ppn<g.nPage && (pContent = g.apPage[ppn])!=0 ){
memcpy(pOut, &pContent[iOfst%g.szPage], n);
}else{
@@ -360,8 +359,8 @@ static int ssdsimWrite(
}else{
int nOld, nNew;
int *aiPage;
nOld = pInode->len/g.szPage;
nNew = (iOfst+iAmt)/g.szPage;
nOld = (pInode->len+g.szPage-1)/g.szPage;
nNew = (iOfst+iAmt+g.szPage-1)/g.szPage;
if( nOld<nNew ){
aiPage = sqlite3_realloc(pInode->aiPage, nNew*sizeof(int));
if( aiPage==0 ) return SQLITE_NOMEM;
@@ -370,19 +369,17 @@ static int ssdsimWrite(
}
}
while( iAmt>0 ){
int n;
int n, mx;
lpn = pInode->aiPage[iOfst/g.szPage];
if( lpn<0 ){
lpn = ssdsimCoreLpnAlloc();
if( lpn<0 ) return SQLITE_FULL;
pInode->aiPage[iOfst/g.szPage];
}
ppn = ssdsimCoreLpnToPpn(lpn, 1);
if( ppn<0 ) return SQLITE_NOMEM;
n = iAmt;
if( (iOfst+n-1)*g.szPage > lpn ){
n = (lpn+1)*g.szPage - iOfst;
}
mx = g.szPage - iOfst%g.szPage;
if( n>mx ) n = mx;
pDest = g.apPage[ppn];
memcpy(pDest, pIn, n);
iOfst += n;
@@ -752,8 +749,7 @@ static int ssdsimDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
if( ssdsimInit() ) return SQLITE_CANTOPEN;
pInode = ssdsimFindInode(zPath);
if( pInode==0 ) return SQLITE_NOTFOUND;
ssdsimDeleteInode(pInode);
if( pInode ) ssdsimDeleteInode(pInode);
return SQLITE_OK;
}