From deb5ad6297490ddb910a1fcec61875b109d0a34e Mon Sep 17 00:00:00 2001 From: drh <> Date: Wed, 23 Oct 2024 11:33:56 +0000 Subject: [PATCH] Reorder conditions in sqlite3PagerDirectReadOk() for coverage. FossilOrigin-Name: da9124fee28c155c4d1cc0d3949eb7b588a7236c12883a010af7909ad8e534ef --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/pager.c | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index fdd7df6e43..35446e6e5b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sharmless\scompiler\swarnings\sin\swherecode.c.\s\sOne\ssuch\swarning\swas\nidentified\sby\s[forum:/forumpost/721675f007|forum\spost\s721675f007]\sand\sthe\nother\swas\sfound\sby\stool/warnings.sh. -D 2024-10-23T11:06:56.384 +C Reorder\sconditions\sin\ssqlite3PagerDirectReadOk()\sfor\scoverage. +D 2024-10-23T11:33:56.073 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -759,7 +759,7 @@ F src/os_setup.h 6011ad7af5db4e05155f385eb3a9b4470688de6f65d6166b8956e58a3d87210 F src/os_unix.c 0ad4e0885294b3a0e135a18533590ec9ad91ffe82f6a08e55b40babd51772928 F src/os_win.c 69fa1aaff68270423c85cff4327ba17ef99a1eb017e1a2bfb97416d9b8398b05 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a -F src/pager.c d57287cd0864c88740d20618e5e595b144b85bfdaefccafd353d596f254a7b35 +F src/pager.c 9656ad4e8331efb8a4f94f7a0c6440b98caea073950a367ea0c728a53b8e62c9 F src/pager.h 4b1140d691860de0be1347474c51fee07d5420bd7f802d38cbab8ea4ab9f538a F src/parse.y a7a8d42eeff01d267444ddb476029b0b1726fb70ae3d77984140f17ad02e2d61 F src/pcache.c 588cc3c5ccaaadde689ed35ce5c5c891a1f7b1f4d1f56f6cf0143b74d8ee6484 @@ -2219,8 +2219,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 1bf8daeb24142044e1b5d4b205317c42353004643fadb6b34f9ae6bfa4e3a6bc -R 8b3d6cd7e3f896ed28460cc14e806ffb +P 987b96aa636c1801f87d3e1c75d34d45c5b6f437bcc6d150298675447ed16b5d +R 83c78bc9e17ebe61e54351f39cf78374 U drh -Z 09e3d32bb2ddf741657be04c5623243d +Z cf7f2e26bfd189f11890320a8c9dc42f # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 226b1716d4..612129bdfe 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -987b96aa636c1801f87d3e1c75d34d45c5b6f437bcc6d150298675447ed16b5d +da9124fee28c155c4d1cc0d3949eb7b588a7236c12883a010af7909ad8e534ef diff --git a/src/pager.c b/src/pager.c index baaf4afbfe..4f616f0c7f 100644 --- a/src/pager.c +++ b/src/pager.c @@ -817,11 +817,6 @@ int sqlite3PagerDirectReadOk(Pager *pPager, Pgno pgno){ assert( pPager!=0 ); assert( pPager->fd!=0 ); if( pPager->fd->pMethods==0 ) return 0; /* Case (1) */ - assert( pPager->fd->pMethods->xDeviceCharacteristics!=0 ); - if( (pPager->fd->pMethods->xDeviceCharacteristics(pPager->fd) - & SQLITE_IOCAP_SUBPAGE_READ)==0 ){ - return 0; /* Case (2) */ - } if( sqlite3PCacheIsDirty(pPager->pPCache) ) return 0; /* Failed (3) */ #ifndef SQLITE_OMIT_WAL if( pPager->pWal ){ @@ -830,6 +825,11 @@ int sqlite3PagerDirectReadOk(Pager *pPager, Pgno pgno){ return iRead==0; /* Condition (4) */ } #endif + assert( pPager->fd->pMethods->xDeviceCharacteristics!=0 ); + if( (pPager->fd->pMethods->xDeviceCharacteristics(pPager->fd) + & SQLITE_IOCAP_SUBPAGE_READ)==0 ){ + return 0; /* Case (2) */ + } return 1; } #endif