Prevent negative values of SQLITE_DEFAULT_CACHE_SIZE from making SQLITE_WIN32_HEAP_INIT_SIZE negative.

FossilOrigin-Name: e0737f5236ed3e85bd03203c880ee41b34619137
This commit is contained in:
mistachkin
2016-03-24 20:36:47 +00:00
parent d38a2e2511
commit eb2329bed3
3 changed files with 21 additions and 9 deletions
+13 -1
View File
@@ -344,11 +344,23 @@ struct winFile {
# define SQLITE_WIN32_HEAP_CREATE (TRUE)
#endif
/*
* This is cache size used in the calculation of the initial size of the
* Win32-specific heap. It cannot be negative.
*/
#ifndef SQLITE_WIN32_CACHE_SIZE
# if SQLITE_DEFAULT_CACHE_SIZE>=0
# define SQLITE_WIN32_CACHE_SIZE (SQLITE_DEFAULT_CACHE_SIZE)
# else
# define SQLITE_WIN32_CACHE_SIZE (-(SQLITE_DEFAULT_CACHE_SIZE))
# endif
#endif
/*
* The initial size of the Win32-specific heap. This value may be zero.
*/
#ifndef SQLITE_WIN32_HEAP_INIT_SIZE
# define SQLITE_WIN32_HEAP_INIT_SIZE ((SQLITE_DEFAULT_CACHE_SIZE) * \
# define SQLITE_WIN32_HEAP_INIT_SIZE ((SQLITE_WIN32_CACHE_SIZE) * \
(SQLITE_DEFAULT_PAGE_SIZE) + 4194304)
#endif