aboutsummaryrefslogtreecommitdiff
path: root/ext/async/sqlite3async.c
diff options
context:
space:
mode:
authorshane <shane@noemail.net>2009-04-30 17:45:33 +0000
committershane <shane@noemail.net>2009-04-30 17:45:33 +0000
commiteb4ac06f4e9156ad02edd04f169c8aee5ee1b786 (patch)
tree19364b0a484c8ed77ae43d341d19ab528d3ffcbf /ext/async/sqlite3async.c
parent0038e0c08f8f33e7ca487667a28fd554bd73231b (diff)
downloadsqlite-eb4ac06f4e9156ad02edd04f169c8aee5ee1b786.tar.gz
sqlite-eb4ac06f4e9156ad02edd04f169c8aee5ee1b786.zip
More cleanup, etc. to support MSVC compiles. (CVS 6582)
FossilOrigin-Name: 2cd9655e7313671f2bbe8d4a6f13246cbbf61205
Diffstat (limited to 'ext/async/sqlite3async.c')
-rw-r--r--ext/async/sqlite3async.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/ext/async/sqlite3async.c b/ext/async/sqlite3async.c
index 5c52f5f65..9d912b186 100644
--- a/ext/async/sqlite3async.c
+++ b/ext/async/sqlite3async.c
@@ -10,7 +10,7 @@
**
*************************************************************************
**
-** $Id: sqlite3async.c,v 1.5 2009/04/29 18:12:00 shane Exp $
+** $Id: sqlite3async.c,v 1.6 2009/04/30 17:45:34 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 "sqliteInt.h"
+#include "sqlite3.h"
#include <stdarg.h>
#include <string.h>
#include <assert.h>
@@ -28,6 +28,11 @@
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)>(y)?(x):(y))
+#ifndef SQLITE_AMALGAMATION
+/* Macro to mark parameters as unused and silence compiler warnings. */
+#define UNUSED_PARAMETER(x) (void)(x)
+#endif
+
/* Forward references */
typedef struct AsyncWrite AsyncWrite;
typedef struct AsyncFile AsyncFile;
@@ -242,6 +247,8 @@ static void async_os_shutdown(void);
*/
#if SQLITE_OS_WIN || defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)
+#include <windows.h>
+
/* The following block contains the win32 specific code. */
#define mutex_held(X) (GetCurrentThreadId()==primitives.aHolder[X])
@@ -302,7 +309,6 @@ static void async_cond_signal(int eCond){
SetEvent(primitives.aCond[eCond]);
}
static void async_sched_yield(void){
- /* Todo: Find out if win32 offers anything like sched_yield() */
Sleep(0);
}
#else
@@ -703,7 +709,7 @@ static int asyncRead(
if( iBeginIn<0 ) iBeginIn = 0;
if( iBeginOut<0 ) iBeginOut = 0;
- nCopy = MIN(pWrite->nByte-iBeginIn, iAmt-iBeginOut);
+ nCopy = (int)MIN(pWrite->nByte-iBeginIn, iAmt-iBeginOut);
if( nCopy>0 ){
memcpy(&((char *)zOut)[iBeginOut], &pWrite->zBuf[iBeginIn], nCopy);
@@ -751,7 +757,7 @@ int asyncFileSize(sqlite3_file *pFile, sqlite3_int64 *piSize){
async_mutex_enter(ASYNC_MUTEX_QUEUE);
- /* Read the filesystem size from the base file. If pBaseRead is NULL, this
+ /* Read the filesystem size from the base file. If pMethods is NULL, this
** means the file hasn't been opened yet. In this case all relevant data
** must be in the write-op queue anyway, so we can omit reading from the
** file-system.