Skip to content

Commit

Permalink
Fixed compile for MSVC; removed compiler warnings; changes for NDEBUG…
Browse files Browse the repository at this point in the history
… build; minor code tweaks. (CVS 6570)
  • Loading branch information
Shane Harrelson committed Apr 29, 2009
1 parent 23bfc5d commit e0c0fe0
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions ext/async/sqlite3async.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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>
Expand Down Expand Up @@ -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

/*
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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));
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}

Expand Down Expand Up @@ -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 = (
Expand Down Expand Up @@ -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);
}

/*
Expand Down

0 comments on commit e0c0fe0

Please sign in to comment.