aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/hash.c18
-rw-r--r--src/os.c2
-rw-r--r--src/os.h8
-rw-r--r--src/pager.c10
-rw-r--r--src/util.c4
-rw-r--r--src/vdbe.c12
6 files changed, 32 insertions, 22 deletions
diff --git a/src/hash.c b/src/hash.c
index 99f3567ee..965308e4f 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -12,7 +12,7 @@
** This is the implementation of generic hash-tables
** used in SQLite.
**
-** $Id: hash.c,v 1.5 2002/01/06 17:07:40 drh Exp $
+** $Id: hash.c,v 1.6 2002/01/14 09:28:20 drh Exp $
*/
#include "sqliteInt.h"
#include <assert.h>
@@ -130,10 +130,10 @@ static int binCompare(const void *pKey1, int n1, const void *pKey2, int n2){
*/
static int (*hashFunction(int keyClass))(const void*,int){
switch( keyClass ){
- case SQLITE_HASH_INT: return intHash;
- case SQLITE_HASH_POINTER: return ptrHash;
- case SQLITE_HASH_STRING: return strHash;
- case SQLITE_HASH_BINARY: return binHash;;
+ case SQLITE_HASH_INT: return &intHash;
+ case SQLITE_HASH_POINTER: return &ptrHash;
+ case SQLITE_HASH_STRING: return &strHash;
+ case SQLITE_HASH_BINARY: return &binHash;;
default: break;
}
return 0;
@@ -147,10 +147,10 @@ static int (*hashFunction(int keyClass))(const void*,int){
*/
static int (*compareFunction(int keyClass))(const void*,int,const void*,int){
switch( keyClass ){
- case SQLITE_HASH_INT: return intCompare;
- case SQLITE_HASH_POINTER: return ptrCompare;
- case SQLITE_HASH_STRING: return strCompare;
- case SQLITE_HASH_BINARY: return binCompare;
+ case SQLITE_HASH_INT: return &intCompare;
+ case SQLITE_HASH_POINTER: return &ptrCompare;
+ case SQLITE_HASH_STRING: return &strCompare;
+ case SQLITE_HASH_BINARY: return &binCompare;
default: break;
}
return 0;
diff --git a/src/os.c b/src/os.c
index c192d377d..4ce6d179f 100644
--- a/src/os.c
+++ b/src/os.c
@@ -499,7 +499,7 @@ int sqliteOsWrite(OsFile *id, const void *pBuf, int amt){
#if OS_WIN
DWORD wrote;
SimulateIOError(SQLITE_IOERR);
- if( !WriteFile(id->h, pBuf, amt, &wrote, 0) || wrote<amt ){
+ if( !WriteFile(id->h, pBuf, amt, &wrote, 0) || (int)wrote<amt ){
return SQLITE_FULL;
}
return SQLITE_OK;
diff --git a/src/os.h b/src/os.h
index d14547594..8d2238bae 100644
--- a/src/os.h
+++ b/src/os.h
@@ -17,6 +17,14 @@
#ifndef _SQLITE_OS_H_
#define _SQLITE_OS_H_
+#ifdef WIN32
+# define OS_WIN 1
+# undef OS_UNIX
+#else
+# define OS_UNIX 1
+# undef OS_WIN
+#endif
+
/*
** A handle for an open file is stored in an OsFile object.
*/
diff --git a/src/pager.c b/src/pager.c
index 4c5f27398..e7a9bd92c 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while
** another is writing.
**
-** @(#) $Id: pager.c,v 1.35 2002/01/06 17:07:40 drh Exp $
+** @(#) $Id: pager.c,v 1.36 2002/01/14 09:28:20 drh Exp $
*/
#include "sqliteInt.h"
#include "pager.h"
@@ -769,7 +769,7 @@ int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage){
pPager->nOvfl++;
}
pPg->pgno = pgno;
- if( pPager->aInJournal && pgno<=pPager->origDbSize ){
+ if( pPager->aInJournal && (int)pgno<=pPager->origDbSize ){
pPg->inJournal = (pPager->aInJournal[pgno/8] & (1<<(pgno&7)))!=0;
}else{
pPg->inJournal = 0;
@@ -786,7 +786,7 @@ int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage){
pPg->pNextHash->pPrevHash = pPg;
}
if( pPager->dbSize<0 ) sqlitepager_pagecount(pPager);
- if( pPager->dbSize<pgno ){
+ if( pPager->dbSize<(int)pgno ){
memset(PGHDR_TO_DATA(pPg), 0, SQLITE_PAGE_SIZE);
}else{
int rc;
@@ -968,7 +968,7 @@ int sqlitepager_write(void *pData){
/* The journal now exists and we have a write lock on the
** main database file. Write the current page to the journal.
*/
- if( pPg->pgno <= pPager->origDbSize ){
+ if( (int)pPg->pgno <= pPager->origDbSize ){
rc = sqliteOsWrite(&pPager->jfd, &pPg->pgno, sizeof(Pgno));
if( rc==SQLITE_OK ){
rc = sqliteOsWrite(&pPager->jfd, pData, SQLITE_PAGE_SIZE);
@@ -986,7 +986,7 @@ int sqlitepager_write(void *pData){
/* Mark the current page as being in the journal and return.
*/
pPg->inJournal = 1;
- if( pPager->dbSize<pPg->pgno ){
+ if( pPager->dbSize<(int)pPg->pgno ){
pPager->dbSize = pPg->pgno;
}
return rc;
diff --git a/src/util.c b/src/util.c
index 90f9bb97a..9c42785d1 100644
--- a/src/util.c
+++ b/src/util.c
@@ -14,7 +14,7 @@
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
-** $Id: util.c,v 1.34 2001/12/22 14:49:25 drh Exp $
+** $Id: util.c,v 1.35 2002/01/14 09:28:20 drh Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
@@ -819,7 +819,7 @@ void sqliteRealToSortable(double r, char *z){
while( r>0.0 && cnt<10 ){
int digit;
r *= 64.0;
- digit = r;
+ digit = (int)r;
assert( digit>=0 && digit<64 );
*z++ = zDigit[digit & 0x3f];
r -= digit;
diff --git a/src/vdbe.c b/src/vdbe.c
index fde95c395..797d3f482 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -30,7 +30,7 @@
** But other routines are also provided to help in building up
** a program instruction by instruction.
**
-** $Id: vdbe.c,v 1.105 2002/01/06 17:07:41 drh Exp $
+** $Id: vdbe.c,v 1.106 2002/01/14 09:28:20 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
@@ -586,7 +586,7 @@ static void hardRelease(Vdbe *p, int i){
if(((P)->aStack[(I)].flags&STK_Int)==0){ hardIntegerify(P,I); }
static void hardIntegerify(Vdbe *p, int i){
if( p->aStack[i].flags & STK_Real ){
- p->aStack[i].i = p->aStack[i].r;
+ p->aStack[i].i = (int)p->aStack[i].r;
Release(p, i);
}else if( p->aStack[i].flags & STK_Str ){
p->aStack[i].i = atoi(p->zStack[i]);
@@ -1511,8 +1511,8 @@ case OP_Remainder: {
break;
}
default: {
- int ia = a;
- int ib = b;
+ int ia = (int)a;
+ int ib = (int)b;
if( ia==0.0 ) goto divide_by_zero;
b = ib % ia;
break;
@@ -3880,7 +3880,7 @@ case OP_AggIncr: {
if( pMem->s.flags & STK_Int ){
/* Do nothing */
}else if( pMem->s.flags & STK_Real ){
- pMem->s.i = pMem->s.r;
+ pMem->s.i = (int)pMem->s.r;
}else if( pMem->s.flags & STK_Str ){
pMem->s.i = atoi(pMem->z);
}else{
@@ -4282,9 +4282,11 @@ not_enough_stack:
/* Jump here if an illegal or illformed instruction is executed.
*/
+VERIFY(
bad_instruction:
sprintf(zBuf,"%d",pc);
sqliteSetString(pzErrMsg, "illegal operation at ", zBuf, 0);
rc = SQLITE_INTERNAL;
goto cleanup;
+)
}