aboutsummaryrefslogtreecommitdiff
path: root/ext/misc/appendvfs.c
diff options
context:
space:
mode:
authorlarrybr <larrybr@noemail.net>2021-03-08 20:13:43 +0000
committerlarrybr <larrybr@noemail.net>2021-03-08 20:13:43 +0000
commitddf49720636bc7a85d6ab26728dafe079d93042d (patch)
treedddaf5a4b432aaf105402bec59196381eb3eee55 /ext/misc/appendvfs.c
parent52a0753152b803da6c486030299fba342d2dff9d (diff)
downloadsqlite-ddf49720636bc7a85d6ab26728dafe079d93042d.tar.gz
sqlite-ddf49720636bc7a85d6ab26728dafe079d93042d.zip
Add tests for too-tiny appended DBs, clarify align macro.
FossilOrigin-Name: eb40a8dea6afe6890ddda989de83f3d4ae03b112bf78bfc818dfbd57cc5b5b2a
Diffstat (limited to 'ext/misc/appendvfs.c')
-rw-r--r--ext/misc/appendvfs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/misc/appendvfs.c b/ext/misc/appendvfs.c
index d3844d423..590a86358 100644
--- a/ext/misc/appendvfs.c
+++ b/ext/misc/appendvfs.c
@@ -490,8 +490,9 @@ static int apndIsOrdinaryDatabaseFile(sqlite3_int64 sz, sqlite3_file *pFile){
}
/* Round-up used to get appendvfs portion to begin at a page boundary. */
-#define APND_START_ROUNDUP(fsz, nPageBits) \
- (((fsz) + ((1<<nPageBits)-1)) & ~(sqlite3_int64)((1<<nPageBits)-1))
+#define APND_ALIGN_MASK(nbits) ((1<<nbits)-1)
+#define APND_START_ROUNDUP(fsz, nbits) \
+ ( ((fsz)+APND_ALIGN_MASK(nbits)) & ~(sqlite3_int64)APND_ALIGN_MASK(nbits) )
/*
** Open an apnd file handle.