mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Fix warning messages in VC++. Patches from nicolas352001. (CVS 347)
FossilOrigin-Name: f3038d218c91b44b70b75a7b881ea24c87fa6a02
This commit is contained in:
18
src/hash.c
18
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;
|
||||
|
2
src/os.c
2
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;
|
||||
|
8
src/os.h
8
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.
|
||||
*/
|
||||
|
10
src/pager.c
10
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;
|
||||
|
@ -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;
|
||||
|
12
src/vdbe.c
12
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;
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user