diff --strip-trailing-cr -urN sqlite3.orig/sqlite3.c sqlite3/sqlite3.c --- sqlite3.orig/sqlite3.c 2013-12-06 15:05:16.000000000 +0000 +++ sqlite3/sqlite3.c 2019-04-22 18:53:05.000000000 +0000 @@ -27008,7 +27008,11 @@ ** is the same technique used by glibc to implement posix_fallocate() ** on systems that do not have a real fallocate() system call. */ +#if __minix + int nBlk = 4096; /* MFS default; good enough for now */ +#else int nBlk = buf.st_blksize; /* File-system block size */ +#endif i64 iWrite; /* Next offset to write to */ if( robust_ftruncate(pFile->h, nSize) ){ @@ -32848,6 +32852,11 @@ ** create a substitute. */ /* #include */ +#if defined( _MSC_VER ) +#define _LL( num ) num +#else +#define _LL( num ) num##LL +#endif struct tm *__cdecl localtime(const time_t *t) { static struct tm y; @@ -32855,7 +32864,7 @@ SYSTEMTIME pTm; sqlite3_int64 t64; t64 = *t; - t64 = (t64 + 11644473600)*10000000; + t64 = (t64 + _LL(11644473600))*10000000; uTm.dwLowDateTime = (DWORD)(t64 & 0xFFFFFFFF); uTm.dwHighDateTime= (DWORD)(t64 >> 32); osFileTimeToLocalFileTime(&uTm,&lTm); @@ -73680,7 +73689,8 @@ /* Copy as much data as is available in the buffer into the start of ** p->aAlloc[]. */ - memcpy(p->aAlloc, &p->aBuffer[iBuf], nAvail); + if( nAvail > 0 ) + memcpy(p->aAlloc, &p->aBuffer[iBuf], nAvail); p->iReadOff += nAvail; nRem = nByte - nAvail;