aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/btree.c20
-rw-r--r--src/expr.c2
-rw-r--r--src/pager.c8
-rw-r--r--src/wal.c4
4 files changed, 17 insertions, 17 deletions
diff --git a/src/btree.c b/src/btree.c
index b9987a27b..e64aaa149 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -1382,7 +1382,7 @@ static int btreeInitPage(MemPage *pPage){
u8 *data; /* Equal to pPage->aData */
BtShared *pBt; /* The main btree structure */
int usableSize; /* Amount of usable space on each page */
- int cellOffset; /* Offset from start of page to first cell pointer */
+ u16 cellOffset; /* Offset from start of page to first cell pointer */
int nFree; /* Number of unused bytes on the page */
int top; /* First byte of the cell content area */
int iCellFirst; /* First allowable cell or freeblock offset */
@@ -1497,7 +1497,7 @@ static void zeroPage(MemPage *pPage, int flags){
memset(&data[hdr+1], 0, 4);
data[hdr+7] = 0;
put2byte(&data[hdr+5], pBt->usableSize);
- pPage->nFree = pBt->usableSize - first;
+ pPage->nFree = (u16)(pBt->usableSize - first);
decodeFlags(pPage, flags);
pPage->hdrOffset = hdr;
pPage->cellOffset = first;
@@ -2326,7 +2326,7 @@ static int lockBtree(BtShared *pBt){
}
assert( (pageSize & 7)==0 );
usableSize = pageSize - page1[20];
- if( pageSize!=pBt->pageSize ){
+ if( (u32)pageSize!=pBt->pageSize ){
/* After reading the first page of the database assuming a page size
** of BtShared.pageSize, we have discovered that the page-size is
** actually pageSize. Unlock the database, leave pBt->pPage1 at
@@ -2369,10 +2369,10 @@ static int lockBtree(BtShared *pBt){
** 17 bytes long, 0 to N bytes of payload, and an optional 4 byte overflow
** page pointer.
*/
- pBt->maxLocal = (pBt->usableSize-12)*64/255 - 23;
- pBt->minLocal = (pBt->usableSize-12)*32/255 - 23;
- pBt->maxLeaf = pBt->usableSize - 35;
- pBt->minLeaf = (pBt->usableSize-12)*32/255 - 23;
+ pBt->maxLocal = (u16)((pBt->usableSize-12)*64/255 - 23);
+ pBt->minLocal = (u16)((pBt->usableSize-12)*32/255 - 23);
+ pBt->maxLeaf = (u16)(pBt->usableSize - 35);
+ pBt->minLeaf = (u16)((pBt->usableSize-12)*32/255 - 23);
assert( pBt->maxLeaf + 23 <= MX_CELL_SIZE(pBt) );
pBt->pPage1 = pPage1;
pBt->nPage = nPage;
@@ -2425,8 +2425,8 @@ static int newDatabase(BtShared *pBt){
if( rc ) return rc;
memcpy(data, zMagicHeader, sizeof(zMagicHeader));
assert( sizeof(zMagicHeader)==16 );
- data[16] = (pBt->pageSize>>8)&0xff;
- data[17] = (pBt->pageSize>>16)&0xff;
+ data[16] = (u8)((pBt->pageSize>>8)&0xff);
+ data[17] = (u8)((pBt->pageSize>>16)&0xff);
data[18] = 1;
data[19] = 1;
assert( pBt->usableSize<=pBt->pageSize && pBt->usableSize+255>=pBt->pageSize);
@@ -5108,7 +5108,7 @@ static int clearCell(MemPage *pPage, unsigned char *pCell){
Pgno ovflPgno;
int rc;
int nOvfl;
- u16 ovflPageSize;
+ u32 ovflPageSize;
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
btreeParseCellPtr(pPage, pCell, &info);
diff --git a/src/expr.c b/src/expr.c
index fd21eb558..33864b2da 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -566,7 +566,7 @@ void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){
db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]);
}
if( i>pParse->nVar ){
- pParse->nVar = i;
+ pParse->nVar = (int)i;
}
}else{
/* Wildcards like ":aaa", "$aaa" or "@aaa". Reuse the same variable
diff --git a/src/pager.c b/src/pager.c
index e39ca9009..04b7c8275 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -1057,7 +1057,7 @@ static int pagerUnlockDb(Pager *pPager, int eLock){
assert( pPager->eLock>=eLock );
rc = sqlite3OsUnlock(pPager->fd, eLock);
if( pPager->eLock!=UNKNOWN_LOCK ){
- pPager->eLock = eLock;
+ pPager->eLock = (u8)eLock;
}
IOTRACE(("UNLOCK %p %d\n", pPager, eLock))
}
@@ -1081,7 +1081,7 @@ static int pagerLockDb(Pager *pPager, int eLock){
if( pPager->eLock<eLock || pPager->eLock==UNKNOWN_LOCK ){
rc = sqlite3OsLock(pPager->fd, eLock);
if( rc==SQLITE_OK && (pPager->eLock!=UNKNOWN_LOCK||eLock==EXCLUSIVE_LOCK) ){
- pPager->eLock = eLock;
+ pPager->eLock = (u8)eLock;
IOTRACE(("LOCK %p %d\n", pPager, eLock))
}
}
@@ -3366,7 +3366,7 @@ int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){
&& sqlite3PcacheRefCount(pPager->pPCache)==0
&& pageSize && pageSize!=(u32)pPager->pageSize
){
- char *pNew; /* New temp space */
+ char *pNew = NULL; /* New temp space */
i64 nByte = 0;
if( pPager->eState>PAGER_OPEN && isOpen(pPager->fd) ){
@@ -3379,7 +3379,7 @@ int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){
if( rc==SQLITE_OK ){
pager_reset(pPager);
- pPager->dbSize = nByte/pageSize;
+ pPager->dbSize = (Pgno)(nByte/pageSize);
pPager->pageSize = pageSize;
sqlite3PageFree(pPager->pTmpSpace);
pPager->pTmpSpace = pNew;
diff --git a/src/wal.c b/src/wal.c
index 94c6925ae..22ce1fa77 100644
--- a/src/wal.c
+++ b/src/wal.c
@@ -1135,7 +1135,7 @@ static int walIndexRecover(Wal *pWal){
if( nTruncate ){
pWal->hdr.mxFrame = iFrame;
pWal->hdr.nPage = nTruncate;
- pWal->hdr.szPage = (szPage&0xff00) | (szPage>>16);
+ pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));
testcase( szPage<=32768 );
testcase( szPage>=65536 );
aFrameCksum[0] = pWal->hdr.aFrameCksum[0];
@@ -2562,7 +2562,7 @@ int sqlite3WalFrames(
if( rc==SQLITE_OK ){
/* Update the private copy of the header. */
- pWal->hdr.szPage = (szPage&0xff00) | (szPage>>16);
+ pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16));
testcase( szPage<=32768 );
testcase( szPage>=65536 );
pWal->hdr.mxFrame = iFrame;