Fix some unreachable branches in the pager.

FossilOrigin-Name: 3ae44770fdecc40c8097f1de0b504f36585a2232
This commit is contained in:
drh 2016-04-25 19:20:56 +00:00
parent dc7adf20bb
commit 835f22deda
3 changed files with 17 additions and 15 deletions

View File

@ -1,5 +1,5 @@
C Merge\sbug\sfix\sfrom\strunk.
D 2016-04-25T15:03:49.467
C Fix\ssome\sunreachable\sbranches\sin\sthe\spager.
D 2016-04-25T19:20:56.371
F Makefile.in a905f3180accdafbd5a534bf26126ee5306d5056
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 71b8b16cf9393f68e2e2035486ca104872558836
@ -364,7 +364,7 @@ F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
F src/os_unix.c 2488a2b6456709ad6398df2302d427a980e2695a
F src/os_win.c 1997a873bfc8296a701bd8e2df8c3d5da5afe956
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
F src/pager.c cbc8996b773c191107b771424b529307ffdf19ba
F src/pager.c a31af55dd6139c6ece7642667a035028a266d344
F src/pager.h 329bdf078a4e0a3b35084534d58625d21fd03681
F src/parse.y 10eb2f3fb62341291528c7984498054731f9d31e
F src/pcache.c b3230ecfc7f797063fbe167f2845da363e8f07f8
@ -1486,7 +1486,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 9b8fec60d8e576cd09e1d075a59bfad1c6169d7a ec215f94ac9748c0acd82af0cc9e7a92249462f9
R e941df834a8d6e2084dd43227adc9b5d
P a905d5e08de3f3c60b667d840b5995911372647d
R 1f1507f9b43194c78dbe59034ff5cd5c
U drh
Z 530f6cc77507869285e9eb18ff03544a
Z 8869ed19649f951f40d0b8fe31c4bd6b

View File

@ -1 +1 @@
a905d5e08de3f3c60b667d840b5995911372647d
3ae44770fdecc40c8097f1de0b504f36585a2232

View File

@ -872,6 +872,7 @@ static int assert_pager_state(Pager *p){
** state.
*/
if( MEMDB ){
assert( !isOpen(p->fd) );
assert( p->noSync );
assert( p->journalMode==PAGER_JOURNALMODE_OFF
|| p->journalMode==PAGER_JOURNALMODE_MEMORY
@ -3204,6 +3205,8 @@ static int pagerPagecount(Pager *pPager, Pgno *pnPage){
*/
assert( pPager->eState==PAGER_OPEN );
assert( pPager->eLock>=SHARED_LOCK );
assert( isOpen(pPager->fd) );
assert( pPager->tempFile==0 );
nPage = sqlite3WalDbsize(pPager->pWal);
/* If the number of pages in the database is not available from the
@ -3211,14 +3214,11 @@ static int pagerPagecount(Pager *pPager, Pgno *pnPage){
** the database file. If the size of the database file is not an
** integer multiple of the page-size, round up the result.
*/
if( nPage==0 ){
if( nPage==0 && ALWAYS(isOpen(pPager->fd)) ){
i64 n = 0; /* Size of db file in bytes */
assert( isOpen(pPager->fd) || pPager->tempFile );
if( isOpen(pPager->fd) ){
int rc = sqlite3OsFileSize(pPager->fd, &n);
if( rc!=SQLITE_OK ){
return rc;
}
int rc = sqlite3OsFileSize(pPager->fd, &n);
if( rc!=SQLITE_OK ){
return rc;
}
nPage = (Pgno)((n+pPager->pageSize-1) / pPager->pageSize);
}
@ -4964,6 +4964,7 @@ static int hasHotJournal(Pager *pPager, int *pExists){
if( rc==SQLITE_OK && !locked ){
Pgno nPage; /* Number of pages in database file */
assert( pPager->tempFile==0 );
rc = pagerPagecount(pPager, &nPage);
if( rc==SQLITE_OK ){
/* If the database is zero pages in size, that means that either (1) the
@ -5448,7 +5449,8 @@ int sqlite3PagerGet(
goto pager_acquire_err;
}
if( MEMDB || pPager->dbSize<pgno || noContent || !isOpen(pPager->fd) ){
assert( !isOpen(pPager->fd) || !MEMDB );
if( !isOpen(pPager->fd) || pPager->dbSize<pgno || noContent ){
if( pgno>pPager->mxPgno ){
rc = SQLITE_FULL;
goto pager_acquire_err;