diff options
author | drh <drh@noemail.net> | 2013-06-26 13:31:50 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2013-06-26 13:31:50 +0000 |
commit | fd64cedc4be4ec9e83fe37190bbc599ae232aaf2 (patch) | |
tree | eb26e9fd9625f522104f3343c3dd77e9296f2fc7 /src/os_win.c | |
parent | 85b303df54a633e71380e3ffc0816ff952399b61 (diff) | |
parent | 989a6dbef118464509e7a303717fd0c61bbde1b8 (diff) | |
download | sqlite-fd64cedc4be4ec9e83fe37190bbc599ae232aaf2.tar.gz sqlite-fd64cedc4be4ec9e83fe37190bbc599ae232aaf2.zip |
Bring the sessions branch up-to-date with all the latest trunk changes.
FossilOrigin-Name: 086a127236ee99d67513490fb7b5549e8b752c44
Diffstat (limited to 'src/os_win.c')
-rw-r--r-- | src/os_win.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/os_win.c b/src/os_win.c index aeb08814b..bdf025aa4 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -85,13 +85,6 @@ WINBASEAPI BOOL WINAPI UnmapViewOfFile(LPCVOID); #endif /* SQLITE_WIN32_FILEMAPPING_API && !defined(SQLITE_OMIT_WAL) */ /* -** Macro to find the minimum of two numeric values. -*/ -#ifndef MIN -# define MIN(x,y) ((x)<(y)?(x):(y)) -#endif - -/* ** Some Microsoft compilers lack this definition. */ #ifndef INVALID_FILE_ATTRIBUTES @@ -2816,6 +2809,9 @@ static void winModeBit(winFile *pFile, unsigned char mask, int *pArg){ /* Forward declaration */ static int getTempname(int nBuf, char *zBuf); +#if SQLITE_MAX_MMAP_SIZE>0 +static int winMapfile(winFile*, sqlite3_int64); +#endif /* ** Control and query of the open file handle. @@ -2899,13 +2895,20 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){ #if SQLITE_MAX_MMAP_SIZE>0 case SQLITE_FCNTL_MMAP_SIZE: { i64 newLimit = *(i64*)pArg; + int rc = SQLITE_OK; if( newLimit>sqlite3GlobalConfig.mxMmap ){ newLimit = sqlite3GlobalConfig.mxMmap; } *(i64*)pArg = pFile->mmapSizeMax; - if( newLimit>=0 ) pFile->mmapSizeMax = newLimit; - OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; + if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){ + pFile->mmapSizeMax = newLimit; + if( pFile->mmapSize>0 ){ + (void)winUnmapfile(pFile); + rc = winMapfile(pFile, -1); + } + } + OSTRACE(("FCNTL file=%p, rc=%d\n", pFile->h, rc)); + return rc; } #endif } |