Fixed compile for MSVC; removed compiler warnings; changes for NDEBUG build; minor code tweaks. (CVS 6570)

FossilOrigin-Name: e98b12425ff036b36165dfd2002e0530ca27a677
This commit is contained in:
shane 2009-04-29 18:11:59 +00:00
parent fad9194453
commit a3628d14d7
3 changed files with 23 additions and 16 deletions

View File

@ -10,7 +10,7 @@
**
*************************************************************************
**
** $Id: sqlite3async.c,v 1.4 2009/04/25 08:39:15 danielk1977 Exp $
** $Id: sqlite3async.c,v 1.5 2009/04/29 18:12:00 shane Exp $
**
** This file contains the implementation of an asynchronous IO backend
** for SQLite.
@ -19,7 +19,7 @@
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ASYNCIO)
#include "sqlite3async.h"
#include "sqlite3.h"
#include "sqliteInt.h"
#include <stdarg.h>
#include <string.h>
#include <assert.h>
@ -49,6 +49,8 @@ static void asyncTrace(const char *zFormat, ...){
fprintf(stderr, "[%d] %s", 0 /* (int)pthread_self() */, z);
sqlite3_free(z);
}
#else
# define ASYNC_TRACE(X)
#endif
/*
@ -301,6 +303,7 @@ static void async_cond_signal(int eCond){
}
static void async_sched_yield(void){
/* Todo: Find out if win32 offers anything like sched_yield() */
Sleep(0);
}
#else
@ -678,7 +681,7 @@ static int asyncRead(
if( rc!=SQLITE_OK ){
goto asyncread_out;
}
nRead = MIN(filesize - iOffset, iAmt);
nRead = (int)MIN(filesize - iOffset, iAmt);
if( nRead>0 ){
rc = pBase->pMethods->xRead(pBase, zOut, nRead, iOffset);
ASYNC_TRACE(("READ %s %d bytes at %d\n", p->zName, nRead, iOffset));
@ -694,8 +697,8 @@ static int asyncRead(
(pWrite->pFileData==p) ||
(zName && pWrite->pFileData->zName==zName)
)){
int iBeginOut = (pWrite->iOffset-iOffset);
int iBeginIn = -iBeginOut;
sqlite3_int64 iBeginOut = (pWrite->iOffset-iOffset);
sqlite3_int64 iBeginIn = -iBeginOut;
int nCopy;
if( iBeginIn<0 ) iBeginIn = 0;
@ -901,6 +904,7 @@ static int asyncCheckReservedLock(sqlite3_file *pFile, int *pResOut){
for(pIter=p->pLock->pList; pIter; pIter=pIter->pNext){
if( pIter->eLock>=SQLITE_LOCK_RESERVED ){
ret = 1;
break;
}
}
async_mutex_leave(ASYNC_MUTEX_LOCK);
@ -927,13 +931,15 @@ static int asyncFileControl(sqlite3_file *id, int op, void *pArg){
/*
** Return the device characteristics and sector-size of the device. It
** is not tricky to implement these correctly, as this backend might
** is tricky to implement these correctly, as this backend might
** not have an open file handle at this point.
*/
static int asyncSectorSize(sqlite3_file *pFile){
UNUSED_PARAMETER(pFile);
return 512;
}
static int asyncDeviceCharacteristics(sqlite3_file *pFile){
UNUSED_PARAMETER(pFile);
return 0;
}
@ -1022,7 +1028,7 @@ static int asyncOpen(
/* If zName is NULL, then the upper layer is requesting an anonymous file */
if( zName ){
nName = strlen(zName)+1;
nName = (int)strlen(zName)+1;
}
nByte = (
@ -1142,7 +1148,8 @@ static int asyncOpen(
** write-op queue to perform the delete.
*/
static int asyncDelete(sqlite3_vfs *pAsyncVfs, const char *z, int syncDir){
return addNewAsyncWrite(0, ASYNC_DELETE, syncDir, strlen(z)+1, z);
UNUSED_PARAMETER(pAsyncVfs);
return addNewAsyncWrite(0, ASYNC_DELETE, syncDir, (int)strlen(z)+1, z);
}
/*

View File

@ -1,5 +1,5 @@
C Modify\sthe\sassemblePage()\sfunction\sin\sbtree.c\sso\sthat\sit\sruns\sslightly\sfaster.\s(CVS\s6569)
D 2009-04-29T17:49:59
C Fixed\scompile\sfor\sMSVC;\s\sremoved\scompiler\swarnings;\schanges\sfor\sNDEBUG\sbuild;\sminor\scode\stweaks.\s(CVS\s6570)
D 2009-04-29T18:12:00
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -25,7 +25,7 @@ F doc/lemon.html f0f682f50210928c07e562621c3b7e8ab912a538
F doc/report1.txt a031aaf37b185e4fa540223cb516d3bccec7eeac
F ext/README.txt 913a7bd3f4837ab14d7e063304181787658b14e1
F ext/async/README.txt 0c541f418b14b415212264cbaaf51c924ec62e5b
F ext/async/sqlite3async.c 2e1048922c1d544f0d2a7c3533909e5d67f466f2
F ext/async/sqlite3async.c 207af6692a52cf1dc3a9e64c93dcd7f7a7db0a6f
F ext/async/sqlite3async.h b6d74dbf9aa5a0ac4e79aa15a4d987f3552a0f75
F ext/fts1/README.txt 20ac73b006a70bcfd80069bdaf59214b6cf1db5e
F ext/fts1/ft_hash.c 3927bd880e65329bdc6f506555b228b28924921b
@ -725,7 +725,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 58c7bdb21c719bf06713ff8ffa7ee51cf1973712
R 9145a583971405864bb9bd62ca2de2c1
U danielk1977
Z d09c5a2c4f4e5bd4d6f77225050209bb
P 7ec42e989f1d4abdc6d52f8feebf51985f36b2bd
R 650f490b514ba52c11005770056d7df0
U shane
Z 14c530093810df3e24600cbed8dbd4c1

View File

@ -1 +1 @@
7ec42e989f1d4abdc6d52f8feebf51985f36b2bd
e98b12425ff036b36165dfd2002e0530ca27a677