| | @@ -16,11 +16,11 @@ |
| 16 | 16 | ** if you want a wrapper to interface SQLite with your choice of programming |
| 17 | 17 | ** language. The code for the "sqlite3" command-line shell is also in a |
| 18 | 18 | ** separate file. This file contains only code for the core SQLite library. |
| 19 | 19 | ** |
| 20 | 20 | ** The content in this amalgamation comes from Fossil check-in |
| 21 | | -** b3da6a8728641a0c9ca2f3b20c9817c0a2be with changes in files: |
| 21 | +** 01409738afc2c0d5bdaa248ffb508aa5f36a with changes in files: |
| 22 | 22 | ** |
| 23 | 23 | ** |
| 24 | 24 | */ |
| 25 | 25 | #ifndef SQLITE_AMALGAMATION |
| 26 | 26 | #define SQLITE_CORE 1 |
| | @@ -467,14 +467,14 @@ |
| 467 | 467 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 468 | 468 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 469 | 469 | */ |
| 470 | 470 | #define SQLITE_VERSION "3.52.0" |
| 471 | 471 | #define SQLITE_VERSION_NUMBER 3052000 |
| 472 | | -#define SQLITE_SOURCE_ID "2025-12-06 11:54:43 b3da6a8728641a0c9ca2f3b20c9817c0a2be6c5bf05f020590547480d2aff0e0" |
| 472 | +#define SQLITE_SOURCE_ID "2025-12-11 23:24:05 01409738afc2c0d5bdaa248ffb508aa5f36a66390f6b8e4834734529ee8ed2fa" |
| 473 | 473 | #define SQLITE_SCM_BRANCH "trunk" |
| 474 | 474 | #define SQLITE_SCM_TAGS "" |
| 475 | | -#define SQLITE_SCM_DATETIME "2025-12-06T11:54:43.371Z" |
| 475 | +#define SQLITE_SCM_DATETIME "2025-12-11T23:24:05.667Z" |
| 476 | 476 | |
| 477 | 477 | /* |
| 478 | 478 | ** CAPI3REF: Run-Time Library Version Numbers |
| 479 | 479 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 480 | 480 | ** |
| | @@ -30650,18 +30650,10 @@ |
| 30650 | 30650 | # define SQLITE_OS_WINCE 1 |
| 30651 | 30651 | #else |
| 30652 | 30652 | # define SQLITE_OS_WINCE 0 |
| 30653 | 30653 | #endif |
| 30654 | 30654 | |
| 30655 | | -/* |
| 30656 | | -** Determine if we are dealing with WinRT, which provides only a subset of |
| 30657 | | -** the full Win32 API. |
| 30658 | | -*/ |
| 30659 | | -#if !defined(SQLITE_OS_WINRT) |
| 30660 | | -# define SQLITE_OS_WINRT 0 |
| 30661 | | -#endif |
| 30662 | | - |
| 30663 | 30655 | /* |
| 30664 | 30656 | ** For WinCE, some API function parameters do not appear to be declared as |
| 30665 | 30657 | ** volatile. |
| 30666 | 30658 | */ |
| 30667 | 30659 | #if SQLITE_OS_WINCE |
| | @@ -30672,11 +30664,11 @@ |
| 30672 | 30664 | |
| 30673 | 30665 | /* |
| 30674 | 30666 | ** For some Windows sub-platforms, the _beginthreadex() / _endthreadex() |
| 30675 | 30667 | ** functions are not available (e.g. those not using MSVC, Cygwin, etc). |
| 30676 | 30668 | */ |
| 30677 | | -#if SQLITE_OS_WIN && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && \ |
| 30669 | +#if SQLITE_OS_WIN && !SQLITE_OS_WINCE && \ |
| 30678 | 30670 | SQLITE_THREADSAFE>0 && !defined(__CYGWIN__) |
| 30679 | 30671 | # define SQLITE_OS_WIN_THREADS 1 |
| 30680 | 30672 | #else |
| 30681 | 30673 | # define SQLITE_OS_WIN_THREADS 0 |
| 30682 | 30674 | #endif |
| | @@ -30789,15 +30781,11 @@ |
| 30789 | 30781 | static int winMutexInit(void){ |
| 30790 | 30782 | /* The first to increment to 1 does actual initialization */ |
| 30791 | 30783 | if( InterlockedCompareExchange(&winMutex_lock, 1, 0)==0 ){ |
| 30792 | 30784 | int i; |
| 30793 | 30785 | for(i=0; i<ArraySize(winMutex_staticMutexes); i++){ |
| 30794 | | -#if SQLITE_OS_WINRT |
| 30795 | | - InitializeCriticalSectionEx(&winMutex_staticMutexes[i].mutex, 0, 0); |
| 30796 | | -#else |
| 30797 | 30786 | InitializeCriticalSection(&winMutex_staticMutexes[i].mutex); |
| 30798 | | -#endif |
| 30799 | 30787 | } |
| 30800 | 30788 | winMutex_isInit = 1; |
| 30801 | 30789 | }else{ |
| 30802 | 30790 | /* Another thread is (in the process of) initializing the static |
| 30803 | 30791 | ** mutexes */ |
| | @@ -30883,15 +30871,11 @@ |
| 30883 | 30871 | #ifdef SQLITE_DEBUG |
| 30884 | 30872 | #ifdef SQLITE_WIN32_MUTEX_TRACE_DYNAMIC |
| 30885 | 30873 | p->trace = 1; |
| 30886 | 30874 | #endif |
| 30887 | 30875 | #endif |
| 30888 | | -#if SQLITE_OS_WINRT |
| 30889 | | - InitializeCriticalSectionEx(&p->mutex, 0, 0); |
| 30890 | | -#else |
| 30891 | 30876 | InitializeCriticalSection(&p->mutex); |
| 30892 | | -#endif |
| 30893 | 30877 | } |
| 30894 | 30878 | break; |
| 30895 | 30879 | } |
| 30896 | 30880 | default: { |
| 30897 | 30881 | #ifdef SQLITE_ENABLE_API_ARMOR |
| | @@ -38300,11 +38284,11 @@ |
| 38300 | 38284 | |
| 38301 | 38285 | /***************************************************************************** |
| 38302 | 38286 | ** Debugging logic |
| 38303 | 38287 | */ |
| 38304 | 38288 | |
| 38305 | | -/* SQLITE_KV_TRACE() is used for tracing calls to kvstorage routines. */ |
| 38289 | +/* SQLITE_KV_TRACE() is used for tracing calls to kvrecord routines. */ |
| 38306 | 38290 | #if 0 |
| 38307 | 38291 | #define SQLITE_KV_TRACE(X) printf X |
| 38308 | 38292 | #else |
| 38309 | 38293 | #define SQLITE_KV_TRACE(X) |
| 38310 | 38294 | #endif |
| | @@ -38314,18 +38298,22 @@ |
| 38314 | 38298 | #define SQLITE_KV_LOG(X) printf X |
| 38315 | 38299 | #else |
| 38316 | 38300 | #define SQLITE_KV_LOG(X) |
| 38317 | 38301 | #endif |
| 38318 | 38302 | |
| 38319 | | - |
| 38320 | 38303 | /* |
| 38321 | 38304 | ** Forward declaration of objects used by this VFS implementation |
| 38322 | 38305 | */ |
| 38323 | 38306 | typedef struct KVVfsFile KVVfsFile; |
| 38324 | 38307 | |
| 38325 | 38308 | /* A single open file. There are only two files represented by this |
| 38326 | 38309 | ** VFS - the database and the rollback journal. |
| 38310 | +** |
| 38311 | +** Maintenance reminder: if this struct changes in any way, the JSON |
| 38312 | +** rendering of its structure must be updated in |
| 38313 | +** sqlite3-wasm.c:sqlite3__wasm_enum_json(). There are no binary |
| 38314 | +** compatibility concerns, so it does not need an iVersion member. |
| 38327 | 38315 | */ |
| 38328 | 38316 | struct KVVfsFile { |
| 38329 | 38317 | sqlite3_file base; /* IO methods */ |
| 38330 | 38318 | const char *zClass; /* Storage class */ |
| 38331 | 38319 | int isJournal; /* True if this is a journal file */ |
| | @@ -38371,11 +38359,11 @@ |
| 38371 | 38359 | static int kvvfsSleep(sqlite3_vfs*, int microseconds); |
| 38372 | 38360 | static int kvvfsCurrentTime(sqlite3_vfs*, double*); |
| 38373 | 38361 | static int kvvfsCurrentTimeInt64(sqlite3_vfs*, sqlite3_int64*); |
| 38374 | 38362 | |
| 38375 | 38363 | static sqlite3_vfs sqlite3OsKvvfsObject = { |
| 38376 | | - 1, /* iVersion */ |
| 38364 | + 2, /* iVersion */ |
| 38377 | 38365 | sizeof(KVVfsFile), /* szOsFile */ |
| 38378 | 38366 | 1024, /* mxPathname */ |
| 38379 | 38367 | 0, /* pNext */ |
| 38380 | 38368 | "kvvfs", /* zName */ |
| 38381 | 38369 | 0, /* pAppData */ |
| | @@ -38447,42 +38435,56 @@ |
| 38447 | 38435 | #include <sys/stat.h> |
| 38448 | 38436 | #include <unistd.h> |
| 38449 | 38437 | |
| 38450 | 38438 | /* Forward declarations for the low-level storage engine |
| 38451 | 38439 | */ |
| 38452 | | -static int kvstorageWrite(const char*, const char *zKey, const char *zData); |
| 38453 | | -static int kvstorageDelete(const char*, const char *zKey); |
| 38454 | | -static int kvstorageRead(const char*, const char *zKey, char *zBuf, int nBuf); |
| 38455 | | -#define KVSTORAGE_KEY_SZ 32 |
| 38440 | +#ifndef SQLITE_WASM |
| 38441 | +/* In WASM builds these are implemented in JS. */ |
| 38442 | +static int kvrecordWrite(const char*, const char *zKey, const char *zData); |
| 38443 | +static int kvrecordDelete(const char*, const char *zKey); |
| 38444 | +static int kvrecordRead(const char*, const char *zKey, char *zBuf, int nBuf); |
| 38445 | +#endif |
| 38446 | +#ifndef KVRECORD_KEY_SZ |
| 38447 | +#define KVRECORD_KEY_SZ 32 |
| 38448 | +#endif |
| 38456 | 38449 | |
| 38457 | 38450 | /* Expand the key name with an appropriate prefix and put the result |
| 38458 | 38451 | ** in zKeyOut[]. The zKeyOut[] buffer is assumed to hold at least |
| 38459 | | -** KVSTORAGE_KEY_SZ bytes. |
| 38452 | +** KVRECORD_KEY_SZ bytes. |
| 38460 | 38453 | */ |
| 38461 | | -static void kvstorageMakeKey( |
| 38454 | +static void kvrecordMakeKey( |
| 38462 | 38455 | const char *zClass, |
| 38463 | 38456 | const char *zKeyIn, |
| 38464 | 38457 | char *zKeyOut |
| 38465 | 38458 | ){ |
| 38466 | | - sqlite3_snprintf(KVSTORAGE_KEY_SZ, zKeyOut, "kvvfs-%s-%s", zClass, zKeyIn); |
| 38459 | + assert( zKeyIn ); |
| 38460 | + assert( zKeyOut ); |
| 38461 | + assert( zClass ); |
| 38462 | + sqlite3_snprintf(KVRECORD_KEY_SZ, zKeyOut, "kvvfs-%s-%s", |
| 38463 | + zClass, zKeyIn); |
| 38467 | 38464 | } |
| 38468 | 38465 | |
| 38466 | +#ifndef SQLITE_WASM |
| 38467 | +/* In WASM builds do not define APIs which use fopen(), fwrite(), |
| 38468 | +** and the like because those APIs are a portability issue for |
| 38469 | +** WASM. |
| 38470 | +*/ |
| 38469 | 38471 | /* Write content into a key. zClass is the particular namespace of the |
| 38470 | 38472 | ** underlying key/value store to use - either "local" or "session". |
| 38471 | 38473 | ** |
| 38472 | 38474 | ** Both zKey and zData are zero-terminated pure text strings. |
| 38473 | 38475 | ** |
| 38474 | 38476 | ** Return the number of errors. |
| 38475 | 38477 | */ |
| 38476 | | -static int kvstorageWrite( |
| 38478 | +static int kvrecordWrite( |
| 38477 | 38479 | const char *zClass, |
| 38478 | 38480 | const char *zKey, |
| 38479 | 38481 | const char *zData |
| 38480 | 38482 | ){ |
| 38481 | 38483 | FILE *fd; |
| 38482 | | - char zXKey[KVSTORAGE_KEY_SZ]; |
| 38483 | | - kvstorageMakeKey(zClass, zKey, zXKey); |
| 38484 | + char zXKey[KVRECORD_KEY_SZ]; |
| 38485 | + kvrecordMakeKey(zClass, zKey, zXKey); |
| 38484 | 38486 | fd = fopen(zXKey, "wb"); |
| 38485 | 38487 | if( fd ){ |
| 38486 | 38488 | SQLITE_KV_TRACE(("KVVFS-WRITE %-15s (%d) %.50s%s\n", zXKey, |
| 38487 | 38489 | (int)strlen(zData), zData, |
| 38488 | 38490 | strlen(zData)>50 ? "..." : "")); |
| | @@ -38496,13 +38498,13 @@ |
| 38496 | 38498 | |
| 38497 | 38499 | /* Delete a key (with its corresponding data) from the key/value |
| 38498 | 38500 | ** namespace given by zClass. If the key does not previously exist, |
| 38499 | 38501 | ** this routine is a no-op. |
| 38500 | 38502 | */ |
| 38501 | | -static int kvstorageDelete(const char *zClass, const char *zKey){ |
| 38502 | | - char zXKey[KVSTORAGE_KEY_SZ]; |
| 38503 | | - kvstorageMakeKey(zClass, zKey, zXKey); |
| 38503 | +static int kvrecordDelete(const char *zClass, const char *zKey){ |
| 38504 | + char zXKey[KVRECORD_KEY_SZ]; |
| 38505 | + kvrecordMakeKey(zClass, zKey, zXKey); |
| 38504 | 38506 | unlink(zXKey); |
| 38505 | 38507 | SQLITE_KV_TRACE(("KVVFS-DELETE %-15s\n", zXKey)); |
| 38506 | 38508 | return 0; |
| 38507 | 38509 | } |
| 38508 | 38510 | |
| | @@ -38519,20 +38521,20 @@ |
| 38519 | 38521 | ** If nBuf<=0 then this routine simply returns the size of the data |
| 38520 | 38522 | ** without actually reading it. Similarly, if nBuf==1 then it |
| 38521 | 38523 | ** zero-terminates zBuf at zBuf[0] and returns the size of the data |
| 38522 | 38524 | ** without reading it. |
| 38523 | 38525 | */ |
| 38524 | | -static int kvstorageRead( |
| 38526 | +static int kvrecordRead( |
| 38525 | 38527 | const char *zClass, |
| 38526 | 38528 | const char *zKey, |
| 38527 | 38529 | char *zBuf, |
| 38528 | 38530 | int nBuf |
| 38529 | 38531 | ){ |
| 38530 | 38532 | FILE *fd; |
| 38531 | 38533 | struct stat buf; |
| 38532 | | - char zXKey[KVSTORAGE_KEY_SZ]; |
| 38533 | | - kvstorageMakeKey(zClass, zKey, zXKey); |
| 38534 | + char zXKey[KVRECORD_KEY_SZ]; |
| 38535 | + kvrecordMakeKey(zClass, zKey, zXKey); |
| 38534 | 38536 | if( access(zXKey, R_OK)!=0 |
| 38535 | 38537 | || stat(zXKey, &buf)!=0 |
| 38536 | 38538 | || !S_ISREG(buf.st_mode) |
| 38537 | 38539 | ){ |
| 38538 | 38540 | SQLITE_KV_TRACE(("KVVFS-READ %-15s (-1)\n", zXKey)); |
| | @@ -38560,27 +38562,39 @@ |
| 38560 | 38562 | SQLITE_KV_TRACE(("KVVFS-READ %-15s (%lld) %.50s%s\n", zXKey, |
| 38561 | 38563 | n, zBuf, n>50 ? "..." : "")); |
| 38562 | 38564 | return (int)n; |
| 38563 | 38565 | } |
| 38564 | 38566 | } |
| 38567 | +#endif /* #ifndef SQLITE_WASM */ |
| 38568 | + |
| 38565 | 38569 | |
| 38566 | 38570 | /* |
| 38567 | 38571 | ** An internal level of indirection which enables us to replace the |
| 38568 | 38572 | ** kvvfs i/o methods with JavaScript implementations in WASM builds. |
| 38569 | 38573 | ** Maintenance reminder: if this struct changes in any way, the JSON |
| 38570 | 38574 | ** rendering of its structure must be updated in |
| 38571 | 38575 | ** sqlite3-wasm.c:sqlite3__wasm_enum_json(). There are no binary |
| 38572 | | -** compatibility concerns, so it does not need an iVersion |
| 38573 | | -** member. |
| 38576 | +** compatibility concerns, so it does not need an iVersion member. |
| 38574 | 38577 | */ |
| 38575 | 38578 | typedef struct sqlite3_kvvfs_methods sqlite3_kvvfs_methods; |
| 38576 | 38579 | struct sqlite3_kvvfs_methods { |
| 38577 | | - int (*xRead)(const char *zClass, const char *zKey, char *zBuf, int nBuf); |
| 38578 | | - int (*xWrite)(const char *zClass, const char *zKey, const char *zData); |
| 38579 | | - int (*xDelete)(const char *zClass, const char *zKey); |
| 38580 | + int (*xRcrdRead)(const char*, const char *zKey, char *zBuf, int nBuf); |
| 38581 | + int (*xRcrdWrite)(const char*, const char *zKey, const char *zData); |
| 38582 | + int (*xRcrdDelete)(const char*, const char *zKey); |
| 38580 | 38583 | const int nKeySize; |
| 38584 | + const int nBufferSize; |
| 38585 | +#ifndef SQLITE_WASM |
| 38586 | +# define MAYBE_CONST const |
| 38587 | +#else |
| 38588 | +# define MAYBE_CONST |
| 38589 | +#endif |
| 38590 | + MAYBE_CONST sqlite3_vfs * pVfs; |
| 38591 | + MAYBE_CONST sqlite3_io_methods *pIoDb; |
| 38592 | + MAYBE_CONST sqlite3_io_methods *pIoJrnl; |
| 38593 | +#undef MAYBE_CONST |
| 38581 | 38594 | }; |
| 38595 | + |
| 38582 | 38596 | |
| 38583 | 38597 | /* |
| 38584 | 38598 | ** This object holds the kvvfs I/O methods which may be swapped out |
| 38585 | 38599 | ** for JavaScript-side implementations in WASM builds. In such builds |
| 38586 | 38600 | ** it cannot be const, but in native builds it should be so that |
| | @@ -38592,14 +38606,24 @@ |
| 38592 | 38606 | */ |
| 38593 | 38607 | #ifndef SQLITE_WASM |
| 38594 | 38608 | const |
| 38595 | 38609 | #endif |
| 38596 | 38610 | SQLITE_PRIVATE sqlite3_kvvfs_methods sqlite3KvvfsMethods = { |
| 38597 | | -kvstorageRead, |
| 38598 | | -kvstorageWrite, |
| 38599 | | -kvstorageDelete, |
| 38600 | | -KVSTORAGE_KEY_SZ |
| 38611 | +#ifndef SQLITE_WASM |
| 38612 | + .xRcrdRead = kvrecordRead, |
| 38613 | + .xRcrdWrite = kvrecordWrite, |
| 38614 | + .xRcrdDelete = kvrecordDelete, |
| 38615 | +#else |
| 38616 | + .xRcrdRead = 0, |
| 38617 | + .xRcrdWrite = 0, |
| 38618 | + .xRcrdDelete = 0, |
| 38619 | +#endif |
| 38620 | + .nKeySize = KVRECORD_KEY_SZ, |
| 38621 | + .nBufferSize = SQLITE_KVOS_SZ, |
| 38622 | + .pVfs = &sqlite3OsKvvfsObject, |
| 38623 | + .pIoDb = &kvvfs_db_io_methods, |
| 38624 | + .pIoJrnl = &kvvfs_jrnl_io_methods |
| 38601 | 38625 | }; |
| 38602 | 38626 | |
| 38603 | 38627 | /****** Utility subroutines ************************************************/ |
| 38604 | 38628 | |
| 38605 | 38629 | /* |
| | @@ -38622,11 +38646,14 @@ |
| 38622 | 38646 | ** |
| 38623 | 38647 | ** * Because there is no overlap between the encoding characters |
| 38624 | 38648 | ** of hexadecimal and base-26 numbers, it is always clear where |
| 38625 | 38649 | ** one stops and the next begins. |
| 38626 | 38650 | */ |
| 38627 | | -static int kvvfsEncode(const char *aData, int nData, char *aOut){ |
| 38651 | +#ifndef SQLITE_WASM |
| 38652 | +static |
| 38653 | +#endif |
| 38654 | +int kvvfsEncode(const char *aData, int nData, char *aOut){ |
| 38628 | 38655 | int i, j; |
| 38629 | 38656 | const unsigned char *a = (const unsigned char*)aData; |
| 38630 | 38657 | for(i=j=0; i<nData; i++){ |
| 38631 | 38658 | unsigned char c = a[i]; |
| 38632 | 38659 | if( c!=0 ){ |
| | @@ -38673,13 +38700,17 @@ |
| 38673 | 38700 | |
| 38674 | 38701 | /* |
| 38675 | 38702 | ** Decode the text encoding back to binary. The binary content is |
| 38676 | 38703 | ** written into pOut, which must be at least nOut bytes in length. |
| 38677 | 38704 | ** |
| 38678 | | -** The return value is the number of bytes actually written into aOut[]. |
| 38705 | +** The return value is the number of bytes actually written into aOut[], or |
| 38706 | +** -1 for malformed inputs. |
| 38679 | 38707 | */ |
| 38680 | | -static int kvvfsDecode(const char *a, char *aOut, int nOut){ |
| 38708 | +#ifndef SQLITE_WASM |
| 38709 | +static |
| 38710 | +#endif |
| 38711 | +int kvvfsDecode(const char *a, char *aOut, int nOut){ |
| 38681 | 38712 | int i, j; |
| 38682 | 38713 | int c; |
| 38683 | 38714 | const unsigned char *aIn = (const unsigned char*)a; |
| 38684 | 38715 | i = 0; |
| 38685 | 38716 | j = 0; |
| | @@ -38700,11 +38731,11 @@ |
| 38700 | 38731 | j += n; |
| 38701 | 38732 | if( c==0 || mult==1 ) break; /* progress stalled if mult==1 */ |
| 38702 | 38733 | }else{ |
| 38703 | 38734 | aOut[j] = c<<4; |
| 38704 | 38735 | c = kvvfsHexValue[aIn[++i]]; |
| 38705 | | - if( c<0 ) break; |
| 38736 | + if( c<0 ) return -1 /* hex bytes are always in pairs */; |
| 38706 | 38737 | aOut[j++] += c; |
| 38707 | 38738 | i++; |
| 38708 | 38739 | } |
| 38709 | 38740 | } |
| 38710 | 38741 | return j; |
| | @@ -38753,17 +38784,18 @@ |
| 38753 | 38784 | ** Read or write the "sz" element, containing the database file size. |
| 38754 | 38785 | */ |
| 38755 | 38786 | static sqlite3_int64 kvvfsReadFileSize(KVVfsFile *pFile){ |
| 38756 | 38787 | char zData[50]; |
| 38757 | 38788 | zData[0] = 0; |
| 38758 | | - sqlite3KvvfsMethods.xRead(pFile->zClass, "sz", zData, sizeof(zData)-1); |
| 38789 | + sqlite3KvvfsMethods.xRcrdRead(pFile->zClass, "sz", zData, |
| 38790 | + sizeof(zData)-1); |
| 38759 | 38791 | return strtoll(zData, 0, 0); |
| 38760 | 38792 | } |
| 38761 | 38793 | static int kvvfsWriteFileSize(KVVfsFile *pFile, sqlite3_int64 sz){ |
| 38762 | 38794 | char zData[50]; |
| 38763 | 38795 | sqlite3_snprintf(sizeof(zData), zData, "%lld", sz); |
| 38764 | | - return sqlite3KvvfsMethods.xWrite(pFile->zClass, "sz", zData); |
| 38796 | + return sqlite3KvvfsMethods.xRcrdWrite(pFile->zClass, "sz", zData); |
| 38765 | 38797 | } |
| 38766 | 38798 | |
| 38767 | 38799 | /****** sqlite3_io_methods methods ******************************************/ |
| 38768 | 38800 | |
| 38769 | 38801 | /* |
| | @@ -38774,10 +38806,13 @@ |
| 38774 | 38806 | |
| 38775 | 38807 | SQLITE_KV_LOG(("xClose %s %s\n", pFile->zClass, |
| 38776 | 38808 | pFile->isJournal ? "journal" : "db")); |
| 38777 | 38809 | sqlite3_free(pFile->aJrnl); |
| 38778 | 38810 | sqlite3_free(pFile->aData); |
| 38811 | +#ifdef SQLITE_WASM |
| 38812 | + memset(pFile, 0, sizeof(*pFile)); |
| 38813 | +#endif |
| 38779 | 38814 | return SQLITE_OK; |
| 38780 | 38815 | } |
| 38781 | 38816 | |
| 38782 | 38817 | /* |
| 38783 | 38818 | ** Read from the -journal file. |
| | @@ -38790,20 +38825,26 @@ |
| 38790 | 38825 | ){ |
| 38791 | 38826 | KVVfsFile *pFile = (KVVfsFile*)pProtoFile; |
| 38792 | 38827 | assert( pFile->isJournal ); |
| 38793 | 38828 | SQLITE_KV_LOG(("xRead('%s-journal',%d,%lld)\n", pFile->zClass, iAmt, iOfst)); |
| 38794 | 38829 | if( pFile->aJrnl==0 ){ |
| 38795 | | - int szTxt = kvstorageRead(pFile->zClass, "jrnl", 0, 0); |
| 38830 | + int rc; |
| 38831 | + int szTxt = sqlite3KvvfsMethods.xRcrdRead(pFile->zClass, "jrnl", |
| 38832 | + 0, 0); |
| 38796 | 38833 | char *aTxt; |
| 38797 | 38834 | if( szTxt<=4 ){ |
| 38798 | 38835 | return SQLITE_IOERR; |
| 38799 | 38836 | } |
| 38800 | 38837 | aTxt = sqlite3_malloc64( szTxt+1 ); |
| 38801 | 38838 | if( aTxt==0 ) return SQLITE_NOMEM; |
| 38802 | | - kvstorageRead(pFile->zClass, "jrnl", aTxt, szTxt+1); |
| 38803 | | - kvvfsDecodeJournal(pFile, aTxt, szTxt); |
| 38839 | + rc = sqlite3KvvfsMethods.xRcrdRead(pFile->zClass, "jrnl", |
| 38840 | + aTxt, szTxt+1); |
| 38841 | + if( rc>=0 ){ |
| 38842 | + kvvfsDecodeJournal(pFile, aTxt, szTxt); |
| 38843 | + } |
| 38804 | 38844 | sqlite3_free(aTxt); |
| 38845 | + if( rc ) return rc; |
| 38805 | 38846 | if( pFile->aJrnl==0 ) return SQLITE_IOERR; |
| 38806 | 38847 | } |
| 38807 | 38848 | if( iOfst+iAmt>pFile->nJrnl ){ |
| 38808 | 38849 | return SQLITE_IOERR_SHORT_READ; |
| 38809 | 38850 | } |
| | @@ -38839,12 +38880,12 @@ |
| 38839 | 38880 | pgno = 1 + iOfst/iAmt; |
| 38840 | 38881 | }else{ |
| 38841 | 38882 | pgno = 1; |
| 38842 | 38883 | } |
| 38843 | 38884 | sqlite3_snprintf(sizeof(zKey), zKey, "%u", pgno); |
| 38844 | | - got = sqlite3KvvfsMethods.xRead(pFile->zClass, zKey, |
| 38845 | | - aData, SQLITE_KVOS_SZ-1); |
| 38885 | + got = sqlite3KvvfsMethods.xRcrdRead(pFile->zClass, zKey, |
| 38886 | + aData, SQLITE_KVOS_SZ-1); |
| 38846 | 38887 | if( got<0 ){ |
| 38847 | 38888 | n = 0; |
| 38848 | 38889 | }else{ |
| 38849 | 38890 | aData[got] = 0; |
| 38850 | 38891 | if( iOfst+iAmt<512 ){ |
| | @@ -38908,35 +38949,36 @@ |
| 38908 | 38949 | ){ |
| 38909 | 38950 | KVVfsFile *pFile = (KVVfsFile*)pProtoFile; |
| 38910 | 38951 | unsigned int pgno; |
| 38911 | 38952 | char zKey[30]; |
| 38912 | 38953 | char *aData = pFile->aData; |
| 38954 | + int rc; |
| 38913 | 38955 | SQLITE_KV_LOG(("xWrite('%s-db',%d,%lld)\n", pFile->zClass, iAmt, iOfst)); |
| 38914 | 38956 | assert( iAmt>=512 && iAmt<=65536 ); |
| 38915 | 38957 | assert( (iAmt & (iAmt-1))==0 ); |
| 38916 | 38958 | assert( pFile->szPage<0 || pFile->szPage==iAmt ); |
| 38917 | 38959 | pFile->szPage = iAmt; |
| 38918 | 38960 | pgno = 1 + iOfst/iAmt; |
| 38919 | 38961 | sqlite3_snprintf(sizeof(zKey), zKey, "%u", pgno); |
| 38920 | 38962 | kvvfsEncode(zBuf, iAmt, aData); |
| 38921 | | - if( sqlite3KvvfsMethods.xWrite(pFile->zClass, zKey, aData) ){ |
| 38922 | | - return SQLITE_IOERR; |
| 38963 | + rc = sqlite3KvvfsMethods.xRcrdWrite(pFile->zClass, zKey, aData); |
| 38964 | + if( 0==rc ){ |
| 38965 | + if( iOfst+iAmt > pFile->szDb ){ |
| 38966 | + pFile->szDb = iOfst + iAmt; |
| 38967 | + } |
| 38923 | 38968 | } |
| 38924 | | - if( iOfst+iAmt > pFile->szDb ){ |
| 38925 | | - pFile->szDb = iOfst + iAmt; |
| 38926 | | - } |
| 38927 | | - return SQLITE_OK; |
| 38969 | + return rc; |
| 38928 | 38970 | } |
| 38929 | 38971 | |
| 38930 | 38972 | /* |
| 38931 | 38973 | ** Truncate an kvvfs-file. |
| 38932 | 38974 | */ |
| 38933 | 38975 | static int kvvfsTruncateJrnl(sqlite3_file *pProtoFile, sqlite_int64 size){ |
| 38934 | 38976 | KVVfsFile *pFile = (KVVfsFile *)pProtoFile; |
| 38935 | 38977 | SQLITE_KV_LOG(("xTruncate('%s-journal',%lld)\n", pFile->zClass, size)); |
| 38936 | 38978 | assert( size==0 ); |
| 38937 | | - sqlite3KvvfsMethods.xDelete(pFile->zClass, "jrnl"); |
| 38979 | + sqlite3KvvfsMethods.xRcrdDelete(pFile->zClass, "jrnl"); |
| 38938 | 38980 | sqlite3_free(pFile->aJrnl); |
| 38939 | 38981 | pFile->aJrnl = 0; |
| 38940 | 38982 | pFile->nJrnl = 0; |
| 38941 | 38983 | return SQLITE_OK; |
| 38942 | 38984 | } |
| | @@ -38951,11 +38993,11 @@ |
| 38951 | 38993 | SQLITE_KV_LOG(("xTruncate('%s-db',%lld)\n", pFile->zClass, size)); |
| 38952 | 38994 | pgno = 1 + size/pFile->szPage; |
| 38953 | 38995 | pgnoMax = 2 + pFile->szDb/pFile->szPage; |
| 38954 | 38996 | while( pgno<=pgnoMax ){ |
| 38955 | 38997 | sqlite3_snprintf(sizeof(zKey), zKey, "%u", pgno); |
| 38956 | | - sqlite3KvvfsMethods.xDelete(pFile->zClass, zKey); |
| 38998 | + sqlite3KvvfsMethods.xRcrdDelete(pFile->zClass, zKey); |
| 38957 | 38999 | pgno++; |
| 38958 | 39000 | } |
| 38959 | 39001 | pFile->szDb = size; |
| 38960 | 39002 | return kvvfsWriteFileSize(pFile, size) ? SQLITE_IOERR : SQLITE_OK; |
| 38961 | 39003 | } |
| | @@ -38983,11 +39025,11 @@ |
| 38983 | 39025 | zOut[i++] = 'a' + (n%26); |
| 38984 | 39026 | n /= 26; |
| 38985 | 39027 | }while( n>0 ); |
| 38986 | 39028 | zOut[i++] = ' '; |
| 38987 | 39029 | kvvfsEncode(pFile->aJrnl, pFile->nJrnl, &zOut[i]); |
| 38988 | | - i = sqlite3KvvfsMethods.xWrite(pFile->zClass, "jrnl", zOut); |
| 39030 | + i = sqlite3KvvfsMethods.xRcrdWrite(pFile->zClass, "jrnl", zOut); |
| 38989 | 39031 | sqlite3_free(zOut); |
| 38990 | 39032 | return i ? SQLITE_IOERR : SQLITE_OK; |
| 38991 | 39033 | } |
| 38992 | 39034 | static int kvvfsSyncDb(sqlite3_file *pProtoFile, int flags){ |
| 38993 | 39035 | return SQLITE_OK; |
| | @@ -39097,53 +39139,56 @@ |
| 39097 | 39139 | int *pOutFlags |
| 39098 | 39140 | ){ |
| 39099 | 39141 | KVVfsFile *pFile = (KVVfsFile*)pProtoFile; |
| 39100 | 39142 | if( zName==0 ) zName = ""; |
| 39101 | 39143 | SQLITE_KV_LOG(("xOpen(\"%s\")\n", zName)); |
| 39102 | | - if( strcmp(zName, "local")==0 |
| 39103 | | - || strcmp(zName, "session")==0 |
| 39104 | | - ){ |
| 39105 | | - pFile->isJournal = 0; |
| 39106 | | - pFile->base.pMethods = &kvvfs_db_io_methods; |
| 39107 | | - }else |
| 39108 | | - if( strcmp(zName, "local-journal")==0 |
| 39109 | | - || strcmp(zName, "session-journal")==0 |
| 39110 | | - ){ |
| 39144 | + assert(!pFile->zClass); |
| 39145 | + assert(!pFile->aData); |
| 39146 | + assert(!pFile->aJrnl); |
| 39147 | + assert(!pFile->nJrnl); |
| 39148 | + assert(!pFile->base.pMethods); |
| 39149 | + pFile->szPage = -1; |
| 39150 | + pFile->szDb = -1; |
| 39151 | + if( 0==sqlite3_strglob("*-journal", zName) ){ |
| 39111 | 39152 | pFile->isJournal = 1; |
| 39112 | 39153 | pFile->base.pMethods = &kvvfs_jrnl_io_methods; |
| 39154 | + if( 0==strcmp("session-journal",zName) ){ |
| 39155 | + pFile->zClass = "session"; |
| 39156 | + }else if( 0==strcmp("local-journal",zName) ){ |
| 39157 | + pFile->zClass = "local"; |
| 39158 | + } |
| 39113 | 39159 | }else{ |
| 39114 | | - return SQLITE_CANTOPEN; |
| 39160 | + pFile->isJournal = 0; |
| 39161 | + pFile->base.pMethods = &kvvfs_db_io_methods; |
| 39115 | 39162 | } |
| 39116 | | - if( zName[0]=='s' ){ |
| 39117 | | - pFile->zClass = "session"; |
| 39118 | | - }else{ |
| 39119 | | - pFile->zClass = "local"; |
| 39163 | + if( !pFile->zClass ){ |
| 39164 | + pFile->zClass = zName; |
| 39120 | 39165 | } |
| 39121 | 39166 | pFile->aData = sqlite3_malloc64(SQLITE_KVOS_SZ); |
| 39122 | 39167 | if( pFile->aData==0 ){ |
| 39123 | 39168 | return SQLITE_NOMEM; |
| 39124 | 39169 | } |
| 39125 | | - pFile->aJrnl = 0; |
| 39126 | | - pFile->nJrnl = 0; |
| 39127 | | - pFile->szPage = -1; |
| 39128 | | - pFile->szDb = -1; |
| 39129 | 39170 | return SQLITE_OK; |
| 39130 | 39171 | } |
| 39131 | 39172 | |
| 39132 | 39173 | /* |
| 39133 | 39174 | ** Delete the file located at zPath. If the dirSync argument is true, |
| 39134 | 39175 | ** ensure the file-system modifications are synced to disk before |
| 39135 | 39176 | ** returning. |
| 39136 | 39177 | */ |
| 39137 | 39178 | static int kvvfsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){ |
| 39179 | + int rc /* The JS impl can fail with OOM in argument conversion */; |
| 39138 | 39180 | if( strcmp(zPath, "local-journal")==0 ){ |
| 39139 | | - sqlite3KvvfsMethods.xDelete("local", "jrnl"); |
| 39181 | + rc = sqlite3KvvfsMethods.xRcrdDelete("local", "jrnl"); |
| 39140 | 39182 | }else |
| 39141 | 39183 | if( strcmp(zPath, "session-journal")==0 ){ |
| 39142 | | - sqlite3KvvfsMethods.xDelete("session", "jrnl"); |
| 39184 | + rc = sqlite3KvvfsMethods.xRcrdDelete("session", "jrnl"); |
| 39143 | 39185 | } |
| 39144 | | - return SQLITE_OK; |
| 39186 | + else{ |
| 39187 | + rc = 0; |
| 39188 | + } |
| 39189 | + return rc; |
| 39145 | 39190 | } |
| 39146 | 39191 | |
| 39147 | 39192 | /* |
| 39148 | 39193 | ** Test for access permissions. Return true if the requested permission |
| 39149 | 39194 | ** is available, or false otherwise. |
| | @@ -39153,25 +39198,46 @@ |
| 39153 | 39198 | const char *zPath, |
| 39154 | 39199 | int flags, |
| 39155 | 39200 | int *pResOut |
| 39156 | 39201 | ){ |
| 39157 | 39202 | SQLITE_KV_LOG(("xAccess(\"%s\")\n", zPath)); |
| 39203 | +#if 0 && defined(SQLITE_WASM) |
| 39204 | + /* |
| 39205 | + ** This is not having the desired effect in the JS bindings. |
| 39206 | + ** It's ostensibly the same logic as the #else block, but |
| 39207 | + ** it's not behaving that way. |
| 39208 | + ** |
| 39209 | + ** In JS we map all zPaths to Storage objects, and -journal files |
| 39210 | + ** are mapped to the storage for the main db (which is is exactly |
| 39211 | + ** what the mapping of "local-journal" -> "local" is doing). |
| 39212 | + */ |
| 39213 | + const char *zKey = (0==sqlite3_strglob("*-journal", zPath)) |
| 39214 | + ? "jrnl" : "sz"; |
| 39215 | + *pResOut = |
| 39216 | + sqlite3KvvfsMethods.xRcrdRead(zPath, zKey, 0, 0)>0; |
| 39217 | +#else |
| 39158 | 39218 | if( strcmp(zPath, "local-journal")==0 ){ |
| 39159 | | - *pResOut = sqlite3KvvfsMethods.xRead("local", "jrnl", 0, 0)>0; |
| 39219 | + *pResOut = |
| 39220 | + sqlite3KvvfsMethods.xRcrdRead("local", "jrnl", 0, 0)>0; |
| 39160 | 39221 | }else |
| 39161 | 39222 | if( strcmp(zPath, "session-journal")==0 ){ |
| 39162 | | - *pResOut = sqlite3KvvfsMethods.xRead("session", "jrnl", 0, 0)>0; |
| 39223 | + *pResOut = |
| 39224 | + sqlite3KvvfsMethods.xRcrdRead("session", "jrnl", 0, 0)>0; |
| 39163 | 39225 | }else |
| 39164 | 39226 | if( strcmp(zPath, "local")==0 ){ |
| 39165 | | - *pResOut = sqlite3KvvfsMethods.xRead("local", "sz", 0, 0)>0; |
| 39227 | + *pResOut = |
| 39228 | + sqlite3KvvfsMethods.xRcrdRead("local", "sz", 0, 0)>0; |
| 39166 | 39229 | }else |
| 39167 | 39230 | if( strcmp(zPath, "session")==0 ){ |
| 39168 | | - *pResOut = sqlite3KvvfsMethods.xRead("session", "sz", 0, 0)>0; |
| 39231 | + *pResOut = |
| 39232 | + sqlite3KvvfsMethods.xRcrdRead("session", "sz", 0, 0)>0; |
| 39169 | 39233 | }else |
| 39170 | 39234 | { |
| 39171 | 39235 | *pResOut = 0; |
| 39172 | 39236 | } |
| 39237 | + /*all current JS tests avoid triggering: assert( *pResOut == 0 ); */ |
| 39238 | +#endif |
| 39173 | 39239 | SQLITE_KV_LOG(("xAccess returns %d\n",*pResOut)); |
| 39174 | 39240 | return SQLITE_OK; |
| 39175 | 39241 | } |
| 39176 | 39242 | |
| 39177 | 39243 | /* |
| | @@ -47896,19 +47962,19 @@ |
| 47896 | 47962 | |
| 47897 | 47963 | /* |
| 47898 | 47964 | ** Are most of the Win32 ANSI APIs available (i.e. with certain exceptions |
| 47899 | 47965 | ** based on the sub-platform)? |
| 47900 | 47966 | */ |
| 47901 | | -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(SQLITE_WIN32_NO_ANSI) |
| 47967 | +#if !SQLITE_OS_WINCE && !defined(SQLITE_WIN32_NO_ANSI) |
| 47902 | 47968 | # define SQLITE_WIN32_HAS_ANSI |
| 47903 | 47969 | #endif |
| 47904 | 47970 | |
| 47905 | 47971 | /* |
| 47906 | 47972 | ** Are most of the Win32 Unicode APIs available (i.e. with certain exceptions |
| 47907 | 47973 | ** based on the sub-platform)? |
| 47908 | 47974 | */ |
| 47909 | | -#if (SQLITE_OS_WINCE || SQLITE_OS_WINNT || SQLITE_OS_WINRT) && \ |
| 47975 | +#if (SQLITE_OS_WINCE || SQLITE_OS_WINNT) && \ |
| 47910 | 47976 | !defined(SQLITE_WIN32_NO_WIDE) |
| 47911 | 47977 | # define SQLITE_WIN32_HAS_WIDE |
| 47912 | 47978 | #endif |
| 47913 | 47979 | |
| 47914 | 47980 | /* |
| | @@ -48043,20 +48109,11 @@ |
| 48043 | 48109 | ** mode or memory mapped files (e.g. these APIs are available in the Windows |
| 48044 | 48110 | ** CE SDK; however, they are not present in the header file)? |
| 48045 | 48111 | */ |
| 48046 | 48112 | #if SQLITE_WIN32_FILEMAPPING_API && \ |
| 48047 | 48113 | (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) |
| 48048 | | -/* |
| 48049 | | -** Two of the file mapping APIs are different under WinRT. Figure out which |
| 48050 | | -** set we need. |
| 48051 | | -*/ |
| 48052 | | -#if SQLITE_OS_WINRT |
| 48053 | | -WINBASEAPI HANDLE WINAPI CreateFileMappingFromApp(HANDLE, \ |
| 48054 | | - LPSECURITY_ATTRIBUTES, ULONG, ULONG64, LPCWSTR); |
| 48055 | | - |
| 48056 | | -WINBASEAPI LPVOID WINAPI MapViewOfFileFromApp(HANDLE, ULONG, ULONG64, SIZE_T); |
| 48057 | | -#else |
| 48114 | + |
| 48058 | 48115 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 48059 | 48116 | WINBASEAPI HANDLE WINAPI CreateFileMappingA(HANDLE, LPSECURITY_ATTRIBUTES, \ |
| 48060 | 48117 | DWORD, DWORD, DWORD, LPCSTR); |
| 48061 | 48118 | #endif /* defined(SQLITE_WIN32_HAS_ANSI) */ |
| 48062 | 48119 | |
| | @@ -48064,11 +48121,10 @@ |
| 48064 | 48121 | WINBASEAPI HANDLE WINAPI CreateFileMappingW(HANDLE, LPSECURITY_ATTRIBUTES, \ |
| 48065 | 48122 | DWORD, DWORD, DWORD, LPCWSTR); |
| 48066 | 48123 | #endif /* defined(SQLITE_WIN32_HAS_WIDE) */ |
| 48067 | 48124 | |
| 48068 | 48125 | WINBASEAPI LPVOID WINAPI MapViewOfFile(HANDLE, DWORD, DWORD, DWORD, SIZE_T); |
| 48069 | | -#endif /* SQLITE_OS_WINRT */ |
| 48070 | 48126 | |
| 48071 | 48127 | /* |
| 48072 | 48128 | ** These file mapping APIs are common to both Win32 and WinRT. |
| 48073 | 48129 | */ |
| 48074 | 48130 | |
| | @@ -48355,11 +48411,11 @@ |
| 48355 | 48411 | |
| 48356 | 48412 | /* |
| 48357 | 48413 | ** This function is not available on Windows CE or WinRT. |
| 48358 | 48414 | */ |
| 48359 | 48415 | |
| 48360 | | -#if SQLITE_OS_WINCE || SQLITE_OS_WINRT |
| 48416 | +#if SQLITE_OS_WINCE |
| 48361 | 48417 | # define osAreFileApisANSI() 1 |
| 48362 | 48418 | #endif |
| 48363 | 48419 | |
| 48364 | 48420 | /* |
| 48365 | 48421 | ** Many system calls are accessed through pointer-to-functions so that |
| | @@ -48370,11 +48426,11 @@ |
| 48370 | 48426 | static struct win_syscall { |
| 48371 | 48427 | const char *zName; /* Name of the system call */ |
| 48372 | 48428 | sqlite3_syscall_ptr pCurrent; /* Current value of the system call */ |
| 48373 | 48429 | sqlite3_syscall_ptr pDefault; /* Default value */ |
| 48374 | 48430 | } aSyscall[] = { |
| 48375 | | -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT |
| 48431 | +#if !SQLITE_OS_WINCE |
| 48376 | 48432 | { "AreFileApisANSI", (SYSCALL)AreFileApisANSI, 0 }, |
| 48377 | 48433 | #else |
| 48378 | 48434 | { "AreFileApisANSI", (SYSCALL)0, 0 }, |
| 48379 | 48435 | #endif |
| 48380 | 48436 | |
| | @@ -48409,20 +48465,20 @@ |
| 48409 | 48465 | #endif |
| 48410 | 48466 | |
| 48411 | 48467 | #define osCreateFileA ((HANDLE(WINAPI*)(LPCSTR,DWORD,DWORD, \ |
| 48412 | 48468 | LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[4].pCurrent) |
| 48413 | 48469 | |
| 48414 | | -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 48470 | +#if defined(SQLITE_WIN32_HAS_WIDE) |
| 48415 | 48471 | { "CreateFileW", (SYSCALL)CreateFileW, 0 }, |
| 48416 | 48472 | #else |
| 48417 | 48473 | { "CreateFileW", (SYSCALL)0, 0 }, |
| 48418 | 48474 | #endif |
| 48419 | 48475 | |
| 48420 | 48476 | #define osCreateFileW ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD, \ |
| 48421 | 48477 | LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[5].pCurrent) |
| 48422 | 48478 | |
| 48423 | | -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_ANSI) && \ |
| 48479 | +#if defined(SQLITE_WIN32_HAS_ANSI) && \ |
| 48424 | 48480 | (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) && \ |
| 48425 | 48481 | SQLITE_WIN32_CREATEFILEMAPPINGA |
| 48426 | 48482 | { "CreateFileMappingA", (SYSCALL)CreateFileMappingA, 0 }, |
| 48427 | 48483 | #else |
| 48428 | 48484 | { "CreateFileMappingA", (SYSCALL)0, 0 }, |
| | @@ -48429,21 +48485,21 @@ |
| 48429 | 48485 | #endif |
| 48430 | 48486 | |
| 48431 | 48487 | #define osCreateFileMappingA ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \ |
| 48432 | 48488 | DWORD,DWORD,DWORD,LPCSTR))aSyscall[6].pCurrent) |
| 48433 | 48489 | |
| 48434 | | -#if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \ |
| 48435 | | - (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)) |
| 48490 | +#if (SQLITE_OS_WINCE || defined(SQLITE_WIN32_HAS_WIDE)) && \ |
| 48491 | + (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) |
| 48436 | 48492 | { "CreateFileMappingW", (SYSCALL)CreateFileMappingW, 0 }, |
| 48437 | 48493 | #else |
| 48438 | 48494 | { "CreateFileMappingW", (SYSCALL)0, 0 }, |
| 48439 | 48495 | #endif |
| 48440 | 48496 | |
| 48441 | 48497 | #define osCreateFileMappingW ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \ |
| 48442 | 48498 | DWORD,DWORD,DWORD,LPCWSTR))aSyscall[7].pCurrent) |
| 48443 | 48499 | |
| 48444 | | -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 48500 | +#if defined(SQLITE_WIN32_HAS_WIDE) |
| 48445 | 48501 | { "CreateMutexW", (SYSCALL)CreateMutexW, 0 }, |
| 48446 | 48502 | #else |
| 48447 | 48503 | { "CreateMutexW", (SYSCALL)0, 0 }, |
| 48448 | 48504 | #endif |
| 48449 | 48505 | |
| | @@ -48525,11 +48581,11 @@ |
| 48525 | 48581 | #endif |
| 48526 | 48582 | |
| 48527 | 48583 | #define osGetDiskFreeSpaceA ((BOOL(WINAPI*)(LPCSTR,LPDWORD,LPDWORD,LPDWORD, \ |
| 48528 | 48584 | LPDWORD))aSyscall[18].pCurrent) |
| 48529 | 48585 | |
| 48530 | | -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 48586 | +#if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_WIDE) |
| 48531 | 48587 | { "GetDiskFreeSpaceW", (SYSCALL)GetDiskFreeSpaceW, 0 }, |
| 48532 | 48588 | #else |
| 48533 | 48589 | { "GetDiskFreeSpaceW", (SYSCALL)0, 0 }, |
| 48534 | 48590 | #endif |
| 48535 | 48591 | |
| | @@ -48542,11 +48598,11 @@ |
| 48542 | 48598 | { "GetFileAttributesA", (SYSCALL)0, 0 }, |
| 48543 | 48599 | #endif |
| 48544 | 48600 | |
| 48545 | 48601 | #define osGetFileAttributesA ((DWORD(WINAPI*)(LPCSTR))aSyscall[20].pCurrent) |
| 48546 | 48602 | |
| 48547 | | -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 48603 | +#if defined(SQLITE_WIN32_HAS_WIDE) |
| 48548 | 48604 | { "GetFileAttributesW", (SYSCALL)GetFileAttributesW, 0 }, |
| 48549 | 48605 | #else |
| 48550 | 48606 | { "GetFileAttributesW", (SYSCALL)0, 0 }, |
| 48551 | 48607 | #endif |
| 48552 | 48608 | |
| | @@ -48559,15 +48615,11 @@ |
| 48559 | 48615 | #endif |
| 48560 | 48616 | |
| 48561 | 48617 | #define osGetFileAttributesExW ((BOOL(WINAPI*)(LPCWSTR,GET_FILEEX_INFO_LEVELS, \ |
| 48562 | 48618 | LPVOID))aSyscall[22].pCurrent) |
| 48563 | 48619 | |
| 48564 | | -#if !SQLITE_OS_WINRT |
| 48565 | 48620 | { "GetFileSize", (SYSCALL)GetFileSize, 0 }, |
| 48566 | | -#else |
| 48567 | | - { "GetFileSize", (SYSCALL)0, 0 }, |
| 48568 | | -#endif |
| 48569 | 48621 | |
| 48570 | 48622 | #define osGetFileSize ((DWORD(WINAPI*)(HANDLE,LPDWORD))aSyscall[23].pCurrent) |
| 48571 | 48623 | |
| 48572 | 48624 | #if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_ANSI) |
| 48573 | 48625 | { "GetFullPathNameA", (SYSCALL)GetFullPathNameA, 0 }, |
| | @@ -48576,11 +48628,11 @@ |
| 48576 | 48628 | #endif |
| 48577 | 48629 | |
| 48578 | 48630 | #define osGetFullPathNameA ((DWORD(WINAPI*)(LPCSTR,DWORD,LPSTR, \ |
| 48579 | 48631 | LPSTR*))aSyscall[24].pCurrent) |
| 48580 | 48632 | |
| 48581 | | -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 48633 | +#if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_WIDE) |
| 48582 | 48634 | { "GetFullPathNameW", (SYSCALL)GetFullPathNameW, 0 }, |
| 48583 | 48635 | #else |
| 48584 | 48636 | { "GetFullPathNameW", (SYSCALL)0, 0 }, |
| 48585 | 48637 | #endif |
| 48586 | 48638 | |
| | @@ -48611,20 +48663,14 @@ |
| 48611 | 48663 | #endif |
| 48612 | 48664 | |
| 48613 | 48665 | #define osGetProcAddressA ((FARPROC(WINAPI*)(HMODULE, \ |
| 48614 | 48666 | LPCSTR))aSyscall[27].pCurrent) |
| 48615 | 48667 | |
| 48616 | | -#if !SQLITE_OS_WINRT |
| 48617 | 48668 | { "GetSystemInfo", (SYSCALL)GetSystemInfo, 0 }, |
| 48618 | | -#else |
| 48619 | | - { "GetSystemInfo", (SYSCALL)0, 0 }, |
| 48620 | | -#endif |
| 48621 | | - |
| 48622 | 48669 | #define osGetSystemInfo ((VOID(WINAPI*)(LPSYSTEM_INFO))aSyscall[28].pCurrent) |
| 48623 | 48670 | |
| 48624 | 48671 | { "GetSystemTime", (SYSCALL)GetSystemTime, 0 }, |
| 48625 | | - |
| 48626 | 48672 | #define osGetSystemTime ((VOID(WINAPI*)(LPSYSTEMTIME))aSyscall[29].pCurrent) |
| 48627 | 48673 | |
| 48628 | 48674 | #if !SQLITE_OS_WINCE |
| 48629 | 48675 | { "GetSystemTimeAsFileTime", (SYSCALL)GetSystemTimeAsFileTime, 0 }, |
| 48630 | 48676 | #else |
| | @@ -48640,23 +48686,19 @@ |
| 48640 | 48686 | { "GetTempPathA", (SYSCALL)0, 0 }, |
| 48641 | 48687 | #endif |
| 48642 | 48688 | |
| 48643 | 48689 | #define osGetTempPathA ((DWORD(WINAPI*)(DWORD,LPSTR))aSyscall[31].pCurrent) |
| 48644 | 48690 | |
| 48645 | | -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 48691 | +#if defined(SQLITE_WIN32_HAS_WIDE) |
| 48646 | 48692 | { "GetTempPathW", (SYSCALL)GetTempPathW, 0 }, |
| 48647 | 48693 | #else |
| 48648 | 48694 | { "GetTempPathW", (SYSCALL)0, 0 }, |
| 48649 | 48695 | #endif |
| 48650 | 48696 | |
| 48651 | 48697 | #define osGetTempPathW ((DWORD(WINAPI*)(DWORD,LPWSTR))aSyscall[32].pCurrent) |
| 48652 | 48698 | |
| 48653 | | -#if !SQLITE_OS_WINRT |
| 48654 | 48699 | { "GetTickCount", (SYSCALL)GetTickCount, 0 }, |
| 48655 | | -#else |
| 48656 | | - { "GetTickCount", (SYSCALL)0, 0 }, |
| 48657 | | -#endif |
| 48658 | 48700 | |
| 48659 | 48701 | #define osGetTickCount ((DWORD(WINAPI*)(VOID))aSyscall[33].pCurrent) |
| 48660 | 48702 | |
| 48661 | 48703 | #if defined(SQLITE_WIN32_HAS_ANSI) && SQLITE_WIN32_GETVERSIONEX |
| 48662 | 48704 | { "GetVersionExA", (SYSCALL)GetVersionExA, 0 }, |
| | @@ -48665,11 +48707,11 @@ |
| 48665 | 48707 | #endif |
| 48666 | 48708 | |
| 48667 | 48709 | #define osGetVersionExA ((BOOL(WINAPI*)( \ |
| 48668 | 48710 | LPOSVERSIONINFOA))aSyscall[34].pCurrent) |
| 48669 | 48711 | |
| 48670 | | -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \ |
| 48712 | +#if defined(SQLITE_WIN32_HAS_WIDE) && \ |
| 48671 | 48713 | SQLITE_WIN32_GETVERSIONEX |
| 48672 | 48714 | { "GetVersionExW", (SYSCALL)GetVersionExW, 0 }, |
| 48673 | 48715 | #else |
| 48674 | 48716 | { "GetVersionExW", (SYSCALL)0, 0 }, |
| 48675 | 48717 | #endif |
| | @@ -48680,24 +48722,16 @@ |
| 48680 | 48722 | { "HeapAlloc", (SYSCALL)HeapAlloc, 0 }, |
| 48681 | 48723 | |
| 48682 | 48724 | #define osHeapAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD, \ |
| 48683 | 48725 | SIZE_T))aSyscall[36].pCurrent) |
| 48684 | 48726 | |
| 48685 | | -#if !SQLITE_OS_WINRT |
| 48686 | 48727 | { "HeapCreate", (SYSCALL)HeapCreate, 0 }, |
| 48687 | | -#else |
| 48688 | | - { "HeapCreate", (SYSCALL)0, 0 }, |
| 48689 | | -#endif |
| 48690 | 48728 | |
| 48691 | 48729 | #define osHeapCreate ((HANDLE(WINAPI*)(DWORD,SIZE_T, \ |
| 48692 | 48730 | SIZE_T))aSyscall[37].pCurrent) |
| 48693 | 48731 | |
| 48694 | | -#if !SQLITE_OS_WINRT |
| 48695 | 48732 | { "HeapDestroy", (SYSCALL)HeapDestroy, 0 }, |
| 48696 | | -#else |
| 48697 | | - { "HeapDestroy", (SYSCALL)0, 0 }, |
| 48698 | | -#endif |
| 48699 | 48733 | |
| 48700 | 48734 | #define osHeapDestroy ((BOOL(WINAPI*)(HANDLE))aSyscall[38].pCurrent) |
| 48701 | 48735 | |
| 48702 | 48736 | { "HeapFree", (SYSCALL)HeapFree, 0 }, |
| 48703 | 48737 | |
| | @@ -48711,20 +48745,16 @@ |
| 48711 | 48745 | { "HeapSize", (SYSCALL)HeapSize, 0 }, |
| 48712 | 48746 | |
| 48713 | 48747 | #define osHeapSize ((SIZE_T(WINAPI*)(HANDLE,DWORD, \ |
| 48714 | 48748 | LPCVOID))aSyscall[41].pCurrent) |
| 48715 | 48749 | |
| 48716 | | -#if !SQLITE_OS_WINRT |
| 48717 | 48750 | { "HeapValidate", (SYSCALL)HeapValidate, 0 }, |
| 48718 | | -#else |
| 48719 | | - { "HeapValidate", (SYSCALL)0, 0 }, |
| 48720 | | -#endif |
| 48721 | 48751 | |
| 48722 | 48752 | #define osHeapValidate ((BOOL(WINAPI*)(HANDLE,DWORD, \ |
| 48723 | 48753 | LPCVOID))aSyscall[42].pCurrent) |
| 48724 | 48754 | |
| 48725 | | -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT |
| 48755 | +#if !SQLITE_OS_WINCE |
| 48726 | 48756 | { "HeapCompact", (SYSCALL)HeapCompact, 0 }, |
| 48727 | 48757 | #else |
| 48728 | 48758 | { "HeapCompact", (SYSCALL)0, 0 }, |
| 48729 | 48759 | #endif |
| 48730 | 48760 | |
| | @@ -48736,28 +48766,24 @@ |
| 48736 | 48766 | { "LoadLibraryA", (SYSCALL)0, 0 }, |
| 48737 | 48767 | #endif |
| 48738 | 48768 | |
| 48739 | 48769 | #define osLoadLibraryA ((HMODULE(WINAPI*)(LPCSTR))aSyscall[44].pCurrent) |
| 48740 | 48770 | |
| 48741 | | -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \ |
| 48771 | +#if defined(SQLITE_WIN32_HAS_WIDE) && \ |
| 48742 | 48772 | !defined(SQLITE_OMIT_LOAD_EXTENSION) |
| 48743 | 48773 | { "LoadLibraryW", (SYSCALL)LoadLibraryW, 0 }, |
| 48744 | 48774 | #else |
| 48745 | 48775 | { "LoadLibraryW", (SYSCALL)0, 0 }, |
| 48746 | 48776 | #endif |
| 48747 | 48777 | |
| 48748 | 48778 | #define osLoadLibraryW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[45].pCurrent) |
| 48749 | 48779 | |
| 48750 | | -#if !SQLITE_OS_WINRT |
| 48751 | 48780 | { "LocalFree", (SYSCALL)LocalFree, 0 }, |
| 48752 | | -#else |
| 48753 | | - { "LocalFree", (SYSCALL)0, 0 }, |
| 48754 | | -#endif |
| 48755 | 48781 | |
| 48756 | 48782 | #define osLocalFree ((HLOCAL(WINAPI*)(HLOCAL))aSyscall[46].pCurrent) |
| 48757 | 48783 | |
| 48758 | | -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT |
| 48784 | +#if !SQLITE_OS_WINCE |
| 48759 | 48785 | { "LockFile", (SYSCALL)LockFile, 0 }, |
| 48760 | 48786 | #else |
| 48761 | 48787 | { "LockFile", (SYSCALL)0, 0 }, |
| 48762 | 48788 | #endif |
| 48763 | 48789 | |
| | @@ -48775,12 +48801,11 @@ |
| 48775 | 48801 | #ifndef osLockFileEx |
| 48776 | 48802 | #define osLockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD,DWORD, \ |
| 48777 | 48803 | LPOVERLAPPED))aSyscall[48].pCurrent) |
| 48778 | 48804 | #endif |
| 48779 | 48805 | |
| 48780 | | -#if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && \ |
| 48781 | | - (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0)) |
| 48806 | +#if SQLITE_OS_WINCE || !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0 |
| 48782 | 48807 | { "MapViewOfFile", (SYSCALL)MapViewOfFile, 0 }, |
| 48783 | 48808 | #else |
| 48784 | 48809 | { "MapViewOfFile", (SYSCALL)0, 0 }, |
| 48785 | 48810 | #endif |
| 48786 | 48811 | |
| | @@ -48804,33 +48829,25 @@ |
| 48804 | 48829 | |
| 48805 | 48830 | { "SetEndOfFile", (SYSCALL)SetEndOfFile, 0 }, |
| 48806 | 48831 | |
| 48807 | 48832 | #define osSetEndOfFile ((BOOL(WINAPI*)(HANDLE))aSyscall[53].pCurrent) |
| 48808 | 48833 | |
| 48809 | | -#if !SQLITE_OS_WINRT |
| 48810 | 48834 | { "SetFilePointer", (SYSCALL)SetFilePointer, 0 }, |
| 48811 | | -#else |
| 48812 | | - { "SetFilePointer", (SYSCALL)0, 0 }, |
| 48813 | | -#endif |
| 48814 | 48835 | |
| 48815 | 48836 | #define osSetFilePointer ((DWORD(WINAPI*)(HANDLE,LONG,PLONG, \ |
| 48816 | 48837 | DWORD))aSyscall[54].pCurrent) |
| 48817 | 48838 | |
| 48818 | | -#if !SQLITE_OS_WINRT |
| 48819 | 48839 | { "Sleep", (SYSCALL)Sleep, 0 }, |
| 48820 | | -#else |
| 48821 | | - { "Sleep", (SYSCALL)0, 0 }, |
| 48822 | | -#endif |
| 48823 | 48840 | |
| 48824 | 48841 | #define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[55].pCurrent) |
| 48825 | 48842 | |
| 48826 | 48843 | { "SystemTimeToFileTime", (SYSCALL)SystemTimeToFileTime, 0 }, |
| 48827 | 48844 | |
| 48828 | 48845 | #define osSystemTimeToFileTime ((BOOL(WINAPI*)(const SYSTEMTIME*, \ |
| 48829 | 48846 | LPFILETIME))aSyscall[56].pCurrent) |
| 48830 | 48847 | |
| 48831 | | -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT |
| 48848 | +#if !SQLITE_OS_WINCE |
| 48832 | 48849 | { "UnlockFile", (SYSCALL)UnlockFile, 0 }, |
| 48833 | 48850 | #else |
| 48834 | 48851 | { "UnlockFile", (SYSCALL)0, 0 }, |
| 48835 | 48852 | #endif |
| 48836 | 48853 | |
| | @@ -48864,15 +48881,11 @@ |
| 48864 | 48881 | { "WriteFile", (SYSCALL)WriteFile, 0 }, |
| 48865 | 48882 | |
| 48866 | 48883 | #define osWriteFile ((BOOL(WINAPI*)(HANDLE,LPCVOID,DWORD,LPDWORD, \ |
| 48867 | 48884 | LPOVERLAPPED))aSyscall[61].pCurrent) |
| 48868 | 48885 | |
| 48869 | | -#if SQLITE_OS_WINRT |
| 48870 | 48886 | { "CreateEventExW", (SYSCALL)CreateEventExW, 0 }, |
| 48871 | | -#else |
| 48872 | | - { "CreateEventExW", (SYSCALL)0, 0 }, |
| 48873 | | -#endif |
| 48874 | 48887 | |
| 48875 | 48888 | #define osCreateEventExW ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,LPCWSTR, \ |
| 48876 | 48889 | DWORD,DWORD))aSyscall[62].pCurrent) |
| 48877 | 48890 | |
| 48878 | 48891 | /* |
| | @@ -48893,68 +48906,30 @@ |
| 48893 | 48906 | #endif |
| 48894 | 48907 | |
| 48895 | 48908 | #define osWaitForSingleObjectEx ((DWORD(WINAPI*)(HANDLE,DWORD, \ |
| 48896 | 48909 | BOOL))aSyscall[64].pCurrent) |
| 48897 | 48910 | |
| 48898 | | -#if SQLITE_OS_WINRT |
| 48899 | 48911 | { "SetFilePointerEx", (SYSCALL)SetFilePointerEx, 0 }, |
| 48900 | | -#else |
| 48901 | | - { "SetFilePointerEx", (SYSCALL)0, 0 }, |
| 48902 | | -#endif |
| 48903 | 48912 | |
| 48904 | 48913 | #define osSetFilePointerEx ((BOOL(WINAPI*)(HANDLE,LARGE_INTEGER, \ |
| 48905 | 48914 | PLARGE_INTEGER,DWORD))aSyscall[65].pCurrent) |
| 48906 | 48915 | |
| 48907 | | -#if SQLITE_OS_WINRT |
| 48908 | 48916 | { "GetFileInformationByHandleEx", (SYSCALL)GetFileInformationByHandleEx, 0 }, |
| 48909 | | -#else |
| 48910 | | - { "GetFileInformationByHandleEx", (SYSCALL)0, 0 }, |
| 48911 | | -#endif |
| 48912 | 48917 | |
| 48913 | 48918 | #define osGetFileInformationByHandleEx ((BOOL(WINAPI*)(HANDLE, \ |
| 48914 | 48919 | FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD))aSyscall[66].pCurrent) |
| 48915 | 48920 | |
| 48916 | | -#if SQLITE_OS_WINRT && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) |
| 48917 | | - { "MapViewOfFileFromApp", (SYSCALL)MapViewOfFileFromApp, 0 }, |
| 48918 | | -#else |
| 48919 | | - { "MapViewOfFileFromApp", (SYSCALL)0, 0 }, |
| 48920 | | -#endif |
| 48921 | | - |
| 48922 | | -#define osMapViewOfFileFromApp ((LPVOID(WINAPI*)(HANDLE,ULONG,ULONG64, \ |
| 48923 | | - SIZE_T))aSyscall[67].pCurrent) |
| 48924 | | - |
| 48925 | | -#if SQLITE_OS_WINRT |
| 48926 | 48921 | { "CreateFile2", (SYSCALL)CreateFile2, 0 }, |
| 48927 | | -#else |
| 48928 | | - { "CreateFile2", (SYSCALL)0, 0 }, |
| 48929 | | -#endif |
| 48930 | 48922 | |
| 48931 | 48923 | #define osCreateFile2 ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD,DWORD, \ |
| 48932 | 48924 | LPCREATEFILE2_EXTENDED_PARAMETERS))aSyscall[68].pCurrent) |
| 48933 | 48925 | |
| 48934 | | -#if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_LOAD_EXTENSION) |
| 48935 | | - { "LoadPackagedLibrary", (SYSCALL)LoadPackagedLibrary, 0 }, |
| 48936 | | -#else |
| 48937 | | - { "LoadPackagedLibrary", (SYSCALL)0, 0 }, |
| 48938 | | -#endif |
| 48939 | | - |
| 48940 | | -#define osLoadPackagedLibrary ((HMODULE(WINAPI*)(LPCWSTR, \ |
| 48941 | | - DWORD))aSyscall[69].pCurrent) |
| 48942 | | - |
| 48943 | | -#if SQLITE_OS_WINRT |
| 48944 | 48926 | { "GetTickCount64", (SYSCALL)GetTickCount64, 0 }, |
| 48945 | | -#else |
| 48946 | | - { "GetTickCount64", (SYSCALL)0, 0 }, |
| 48947 | | -#endif |
| 48948 | 48927 | |
| 48949 | 48928 | #define osGetTickCount64 ((ULONGLONG(WINAPI*)(VOID))aSyscall[70].pCurrent) |
| 48950 | 48929 | |
| 48951 | | -#if SQLITE_OS_WINRT |
| 48952 | 48930 | { "GetNativeSystemInfo", (SYSCALL)GetNativeSystemInfo, 0 }, |
| 48953 | | -#else |
| 48954 | | - { "GetNativeSystemInfo", (SYSCALL)0, 0 }, |
| 48955 | | -#endif |
| 48956 | 48931 | |
| 48957 | 48932 | #define osGetNativeSystemInfo ((VOID(WINAPI*)( \ |
| 48958 | 48933 | LPSYSTEM_INFO))aSyscall[71].pCurrent) |
| 48959 | 48934 | |
| 48960 | 48935 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| | @@ -48975,19 +48950,10 @@ |
| 48975 | 48950 | |
| 48976 | 48951 | { "GetProcessHeap", (SYSCALL)GetProcessHeap, 0 }, |
| 48977 | 48952 | |
| 48978 | 48953 | #define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[74].pCurrent) |
| 48979 | 48954 | |
| 48980 | | -#if SQLITE_OS_WINRT && (!defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0) |
| 48981 | | - { "CreateFileMappingFromApp", (SYSCALL)CreateFileMappingFromApp, 0 }, |
| 48982 | | -#else |
| 48983 | | - { "CreateFileMappingFromApp", (SYSCALL)0, 0 }, |
| 48984 | | -#endif |
| 48985 | | - |
| 48986 | | -#define osCreateFileMappingFromApp ((HANDLE(WINAPI*)(HANDLE, \ |
| 48987 | | - LPSECURITY_ATTRIBUTES,ULONG,ULONG64,LPCWSTR))aSyscall[75].pCurrent) |
| 48988 | | - |
| 48989 | 48955 | /* |
| 48990 | 48956 | ** NOTE: On some sub-platforms, the InterlockedCompareExchange "function" |
| 48991 | 48957 | ** is really just a macro that uses a compiler intrinsic (e.g. x64). |
| 48992 | 48958 | ** So do not try to make this is into a redefinable interface. |
| 48993 | 48959 | */ |
| | @@ -49000,19 +48966,19 @@ |
| 49000 | 48966 | |
| 49001 | 48967 | #define osInterlockedCompareExchange ((LONG(WINAPI*)(LONG \ |
| 49002 | 48968 | SQLITE_WIN32_VOLATILE*, LONG,LONG))aSyscall[76].pCurrent) |
| 49003 | 48969 | #endif /* defined(InterlockedCompareExchange) */ |
| 49004 | 48970 | |
| 49005 | | -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID |
| 48971 | +#if !SQLITE_OS_WINCE && SQLITE_WIN32_USE_UUID |
| 49006 | 48972 | { "UuidCreate", (SYSCALL)UuidCreate, 0 }, |
| 49007 | 48973 | #else |
| 49008 | 48974 | { "UuidCreate", (SYSCALL)0, 0 }, |
| 49009 | 48975 | #endif |
| 49010 | 48976 | |
| 49011 | 48977 | #define osUuidCreate ((RPC_STATUS(RPC_ENTRY*)(UUID*))aSyscall[77].pCurrent) |
| 49012 | 48978 | |
| 49013 | | -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID |
| 48979 | +#if !SQLITE_OS_WINCE && SQLITE_WIN32_USE_UUID |
| 49014 | 48980 | { "UuidCreateSequential", (SYSCALL)UuidCreateSequential, 0 }, |
| 49015 | 48981 | #else |
| 49016 | 48982 | { "UuidCreateSequential", (SYSCALL)0, 0 }, |
| 49017 | 48983 | #endif |
| 49018 | 48984 | |
| | @@ -49219,14 +49185,14 @@ |
| 49219 | 49185 | |
| 49220 | 49186 | winMemAssertMagic(); |
| 49221 | 49187 | hHeap = winMemGetHeap(); |
| 49222 | 49188 | assert( hHeap!=0 ); |
| 49223 | 49189 | assert( hHeap!=INVALID_HANDLE_VALUE ); |
| 49224 | | -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE) |
| 49190 | +#if defined(SQLITE_WIN32_MALLOC_VALIDATE) |
| 49225 | 49191 | assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) ); |
| 49226 | 49192 | #endif |
| 49227 | | -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT |
| 49193 | +#if !SQLITE_OS_WINCE |
| 49228 | 49194 | if( (nLargest=osHeapCompact(hHeap, SQLITE_WIN32_HEAP_FLAGS))==0 ){ |
| 49229 | 49195 | DWORD lastErrno = osGetLastError(); |
| 49230 | 49196 | if( lastErrno==NO_ERROR ){ |
| 49231 | 49197 | sqlite3_log(SQLITE_NOMEM, "failed to HeapCompact (no space), heap=%p", |
| 49232 | 49198 | (void*)hHeap); |
| | @@ -49335,32 +49301,15 @@ |
| 49335 | 49301 | } |
| 49336 | 49302 | #endif |
| 49337 | 49303 | } |
| 49338 | 49304 | #endif /* _WIN32 */ |
| 49339 | 49305 | |
| 49340 | | -/* |
| 49341 | | -** The following routine suspends the current thread for at least ms |
| 49342 | | -** milliseconds. This is equivalent to the Win32 Sleep() interface. |
| 49343 | | -*/ |
| 49344 | | -#if SQLITE_OS_WINRT |
| 49345 | | -static HANDLE sleepObj = NULL; |
| 49346 | | -#endif |
| 49347 | | - |
| 49348 | 49306 | SQLITE_API void sqlite3_win32_sleep(DWORD milliseconds){ |
| 49349 | | -#if SQLITE_OS_WINRT |
| 49350 | | - if ( sleepObj==NULL ){ |
| 49351 | | - sleepObj = osCreateEventExW(NULL, NULL, CREATE_EVENT_MANUAL_RESET, |
| 49352 | | - SYNCHRONIZE); |
| 49353 | | - } |
| 49354 | | - assert( sleepObj!=NULL ); |
| 49355 | | - osWaitForSingleObjectEx(sleepObj, milliseconds, FALSE); |
| 49356 | | -#else |
| 49357 | 49307 | osSleep(milliseconds); |
| 49358 | | -#endif |
| 49359 | 49308 | } |
| 49360 | 49309 | |
| 49361 | | -#if SQLITE_MAX_WORKER_THREADS>0 && !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && \ |
| 49310 | +#if SQLITE_MAX_WORKER_THREADS>0 && !SQLITE_OS_WINCE && \ |
| 49362 | 49311 | SQLITE_THREADSAFE>0 |
| 49363 | 49312 | SQLITE_PRIVATE DWORD sqlite3Win32Wait(HANDLE hObject){ |
| 49364 | 49313 | DWORD rc; |
| 49365 | 49314 | while( (rc = osWaitForSingleObjectEx(hObject, INFINITE, |
| 49366 | 49315 | TRUE))==WAIT_IO_COMPLETION ){} |
| | @@ -49380,11 +49329,11 @@ |
| 49380 | 49329 | ** the LockFileEx() API. |
| 49381 | 49330 | */ |
| 49382 | 49331 | |
| 49383 | 49332 | #if !SQLITE_WIN32_GETVERSIONEX |
| 49384 | 49333 | # define osIsNT() (1) |
| 49385 | | -#elif SQLITE_OS_WINCE || SQLITE_OS_WINRT || !defined(SQLITE_WIN32_HAS_ANSI) |
| 49334 | +#elif SQLITE_OS_WINCE || !defined(SQLITE_WIN32_HAS_ANSI) |
| 49386 | 49335 | # define osIsNT() (1) |
| 49387 | 49336 | #elif !defined(SQLITE_WIN32_HAS_WIDE) |
| 49388 | 49337 | # define osIsNT() (0) |
| 49389 | 49338 | #else |
| 49390 | 49339 | # define osIsNT() ((sqlite3_os_type==2) || sqlite3_win32_is_nt()) |
| | @@ -49393,17 +49342,11 @@ |
| 49393 | 49342 | /* |
| 49394 | 49343 | ** This function determines if the machine is running a version of Windows |
| 49395 | 49344 | ** based on the NT kernel. |
| 49396 | 49345 | */ |
| 49397 | 49346 | SQLITE_API int sqlite3_win32_is_nt(void){ |
| 49398 | | -#if SQLITE_OS_WINRT |
| 49399 | | - /* |
| 49400 | | - ** NOTE: The WinRT sub-platform is always assumed to be based on the NT |
| 49401 | | - ** kernel. |
| 49402 | | - */ |
| 49403 | | - return 1; |
| 49404 | | -#elif SQLITE_WIN32_GETVERSIONEX |
| 49347 | +#if SQLITE_WIN32_GETVERSIONEX |
| 49405 | 49348 | if( osInterlockedCompareExchange(&sqlite3_os_type, 0, 0)==0 ){ |
| 49406 | 49349 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 49407 | 49350 | OSVERSIONINFOA sInfo; |
| 49408 | 49351 | sInfo.dwOSVersionInfoSize = sizeof(sInfo); |
| 49409 | 49352 | osGetVersionExA(&sInfo); |
| | @@ -49441,11 +49384,11 @@ |
| 49441 | 49384 | |
| 49442 | 49385 | winMemAssertMagic(); |
| 49443 | 49386 | hHeap = winMemGetHeap(); |
| 49444 | 49387 | assert( hHeap!=0 ); |
| 49445 | 49388 | assert( hHeap!=INVALID_HANDLE_VALUE ); |
| 49446 | | -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE) |
| 49389 | +#if defined(SQLITE_WIN32_MALLOC_VALIDATE) |
| 49447 | 49390 | assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) ); |
| 49448 | 49391 | #endif |
| 49449 | 49392 | assert( nBytes>=0 ); |
| 49450 | 49393 | p = osHeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes); |
| 49451 | 49394 | if( !p ){ |
| | @@ -49463,11 +49406,11 @@ |
| 49463 | 49406 | |
| 49464 | 49407 | winMemAssertMagic(); |
| 49465 | 49408 | hHeap = winMemGetHeap(); |
| 49466 | 49409 | assert( hHeap!=0 ); |
| 49467 | 49410 | assert( hHeap!=INVALID_HANDLE_VALUE ); |
| 49468 | | -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE) |
| 49411 | +#if defined(SQLITE_WIN32_MALLOC_VALIDATE) |
| 49469 | 49412 | assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) ); |
| 49470 | 49413 | #endif |
| 49471 | 49414 | if( !pPrior ) return; /* Passing NULL to HeapFree is undefined. */ |
| 49472 | 49415 | if( !osHeapFree(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) ){ |
| 49473 | 49416 | sqlite3_log(SQLITE_NOMEM, "failed to HeapFree block %p (%lu), heap=%p", |
| | @@ -49484,11 +49427,11 @@ |
| 49484 | 49427 | |
| 49485 | 49428 | winMemAssertMagic(); |
| 49486 | 49429 | hHeap = winMemGetHeap(); |
| 49487 | 49430 | assert( hHeap!=0 ); |
| 49488 | 49431 | assert( hHeap!=INVALID_HANDLE_VALUE ); |
| 49489 | | -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE) |
| 49432 | +#if defined(SQLITE_WIN32_MALLOC_VALIDATE) |
| 49490 | 49433 | assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) ); |
| 49491 | 49434 | #endif |
| 49492 | 49435 | assert( nBytes>=0 ); |
| 49493 | 49436 | if( !pPrior ){ |
| 49494 | 49437 | p = osHeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes); |
| | @@ -49512,11 +49455,11 @@ |
| 49512 | 49455 | |
| 49513 | 49456 | winMemAssertMagic(); |
| 49514 | 49457 | hHeap = winMemGetHeap(); |
| 49515 | 49458 | assert( hHeap!=0 ); |
| 49516 | 49459 | assert( hHeap!=INVALID_HANDLE_VALUE ); |
| 49517 | | -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE) |
| 49460 | +#if defined(SQLITE_WIN32_MALLOC_VALIDATE) |
| 49518 | 49461 | assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, p) ); |
| 49519 | 49462 | #endif |
| 49520 | 49463 | if( !p ) return 0; |
| 49521 | 49464 | n = osHeapSize(hHeap, SQLITE_WIN32_HEAP_FLAGS, p); |
| 49522 | 49465 | if( n==(SIZE_T)-1 ){ |
| | @@ -49542,11 +49485,11 @@ |
| 49542 | 49485 | |
| 49543 | 49486 | if( !pWinMemData ) return SQLITE_ERROR; |
| 49544 | 49487 | assert( pWinMemData->magic1==WINMEM_MAGIC1 ); |
| 49545 | 49488 | assert( pWinMemData->magic2==WINMEM_MAGIC2 ); |
| 49546 | 49489 | |
| 49547 | | -#if !SQLITE_OS_WINRT && SQLITE_WIN32_HEAP_CREATE |
| 49490 | +#if SQLITE_WIN32_HEAP_CREATE |
| 49548 | 49491 | if( !pWinMemData->hHeap ){ |
| 49549 | 49492 | DWORD dwInitialSize = SQLITE_WIN32_HEAP_INIT_SIZE; |
| 49550 | 49493 | DWORD dwMaximumSize = (DWORD)sqlite3GlobalConfig.nHeap; |
| 49551 | 49494 | if( dwMaximumSize==0 ){ |
| 49552 | 49495 | dwMaximumSize = SQLITE_WIN32_HEAP_MAX_SIZE; |
| | @@ -49575,11 +49518,11 @@ |
| 49575 | 49518 | pWinMemData->bOwned = FALSE; |
| 49576 | 49519 | assert( !pWinMemData->bOwned ); |
| 49577 | 49520 | #endif |
| 49578 | 49521 | assert( pWinMemData->hHeap!=0 ); |
| 49579 | 49522 | assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE ); |
| 49580 | | -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE) |
| 49523 | +#if defined(SQLITE_WIN32_MALLOC_VALIDATE) |
| 49581 | 49524 | assert( osHeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) ); |
| 49582 | 49525 | #endif |
| 49583 | 49526 | return SQLITE_OK; |
| 49584 | 49527 | } |
| 49585 | 49528 | |
| | @@ -49593,11 +49536,11 @@ |
| 49593 | 49536 | assert( pWinMemData->magic1==WINMEM_MAGIC1 ); |
| 49594 | 49537 | assert( pWinMemData->magic2==WINMEM_MAGIC2 ); |
| 49595 | 49538 | |
| 49596 | 49539 | if( pWinMemData->hHeap ){ |
| 49597 | 49540 | assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE ); |
| 49598 | | -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE) |
| 49541 | +#if defined(SQLITE_WIN32_MALLOC_VALIDATE) |
| 49599 | 49542 | assert( osHeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) ); |
| 49600 | 49543 | #endif |
| 49601 | 49544 | if( pWinMemData->bOwned ){ |
| 49602 | 49545 | if( !osHeapDestroy(pWinMemData->hHeap) ){ |
| 49603 | 49546 | sqlite3_log(SQLITE_NOMEM, "failed to HeapDestroy (%lu), heap=%p", |
| | @@ -49974,21 +49917,10 @@ |
| 49974 | 49917 | */ |
| 49975 | 49918 | DWORD dwLen = 0; |
| 49976 | 49919 | char *zOut = 0; |
| 49977 | 49920 | |
| 49978 | 49921 | if( osIsNT() ){ |
| 49979 | | -#if SQLITE_OS_WINRT |
| 49980 | | - WCHAR zTempWide[SQLITE_WIN32_MAX_ERRMSG_CHARS+1]; |
| 49981 | | - dwLen = osFormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | |
| 49982 | | - FORMAT_MESSAGE_IGNORE_INSERTS, |
| 49983 | | - NULL, |
| 49984 | | - lastErrno, |
| 49985 | | - 0, |
| 49986 | | - zTempWide, |
| 49987 | | - SQLITE_WIN32_MAX_ERRMSG_CHARS, |
| 49988 | | - 0); |
| 49989 | | -#else |
| 49990 | 49922 | LPWSTR zTempWide = NULL; |
| 49991 | 49923 | dwLen = osFormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | |
| 49992 | 49924 | FORMAT_MESSAGE_FROM_SYSTEM | |
| 49993 | 49925 | FORMAT_MESSAGE_IGNORE_INSERTS, |
| 49994 | 49926 | NULL, |
| | @@ -49995,20 +49927,17 @@ |
| 49995 | 49927 | lastErrno, |
| 49996 | 49928 | 0, |
| 49997 | 49929 | (LPWSTR) &zTempWide, |
| 49998 | 49930 | 0, |
| 49999 | 49931 | 0); |
| 50000 | | -#endif |
| 50001 | 49932 | if( dwLen > 0 ){ |
| 50002 | 49933 | /* allocate a buffer and convert to UTF8 */ |
| 50003 | 49934 | sqlite3BeginBenignMalloc(); |
| 50004 | 49935 | zOut = winUnicodeToUtf8(zTempWide); |
| 50005 | 49936 | sqlite3EndBenignMalloc(); |
| 50006 | | -#if !SQLITE_OS_WINRT |
| 50007 | 49937 | /* free the system buffer allocated by FormatMessage */ |
| 50008 | 49938 | osLocalFree(zTempWide); |
| 50009 | | -#endif |
| 50010 | 49939 | } |
| 50011 | 49940 | } |
| 50012 | 49941 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 50013 | 49942 | else{ |
| 50014 | 49943 | char *zTemp = NULL; |
| | @@ -50665,11 +50594,10 @@ |
| 50665 | 50594 | ** error code. |
| 50666 | 50595 | */ |
| 50667 | 50596 | static int winHandleSeek(HANDLE h, sqlite3_int64 iOffset){ |
| 50668 | 50597 | int rc = SQLITE_OK; /* Return value */ |
| 50669 | 50598 | |
| 50670 | | -#if !SQLITE_OS_WINRT |
| 50671 | 50599 | LONG upperBits; /* Most sig. 32 bits of new offset */ |
| 50672 | 50600 | LONG lowerBits; /* Least sig. 32 bits of new offset */ |
| 50673 | 50601 | DWORD dwRet; /* Value returned by SetFilePointer() */ |
| 50674 | 50602 | |
| 50675 | 50603 | upperBits = (LONG)((iOffset>>32) & 0x7fffffff); |
| | @@ -50687,24 +50615,11 @@ |
| 50687 | 50615 | DWORD lastErrno = osGetLastError(); |
| 50688 | 50616 | if( lastErrno!=NO_ERROR ){ |
| 50689 | 50617 | rc = SQLITE_IOERR_SEEK; |
| 50690 | 50618 | } |
| 50691 | 50619 | } |
| 50692 | | -#else |
| 50693 | | - /* This implementation works for WinRT. */ |
| 50694 | | - LARGE_INTEGER x; /* The new offset */ |
| 50695 | | - BOOL bRet; /* Value returned by SetFilePointerEx() */ |
| 50696 | | - |
| 50697 | | - x.QuadPart = iOffset; |
| 50698 | | - bRet = osSetFilePointerEx(h, x, 0, FILE_BEGIN); |
| 50699 | | - |
| 50700 | | - if(!bRet){ |
| 50701 | | - rc = SQLITE_IOERR_SEEK; |
| 50702 | | - } |
| 50703 | | -#endif |
| 50704 | | - |
| 50705 | | - OSTRACE(("SEEK file=%p, offset=%lld rc=%s\n", h, iOffset, sqlite3ErrName(rc))); |
| 50620 | + OSTRACE(("SEEK file=%p, offset=%lld rc=%s\n", h, iOffset,sqlite3ErrName(rc))); |
| 50706 | 50621 | return rc; |
| 50707 | 50622 | } |
| 50708 | 50623 | |
| 50709 | 50624 | /* |
| 50710 | 50625 | ** Move the current position of the file handle passed as the first |
| | @@ -51001,32 +50916,19 @@ |
| 51001 | 50916 | ** Determine the size in bytes of the file opened by the handle passed as |
| 51002 | 50917 | ** the first argument. |
| 51003 | 50918 | */ |
| 51004 | 50919 | static int winHandleSize(HANDLE h, sqlite3_int64 *pnByte){ |
| 51005 | 50920 | int rc = SQLITE_OK; |
| 51006 | | - |
| 51007 | | -#if SQLITE_OS_WINRT |
| 51008 | | - FILE_STANDARD_INFO info; |
| 51009 | | - BOOL b; |
| 51010 | | - b = osGetFileInformationByHandleEx(h, FileStandardInfo, &info, sizeof(info)); |
| 51011 | | - if( b ){ |
| 51012 | | - *pnByte = info.EndOfFile.QuadPart; |
| 51013 | | - }else{ |
| 51014 | | - rc = SQLITE_IOERR_FSTAT; |
| 51015 | | - } |
| 51016 | | -#else |
| 51017 | 50921 | DWORD upperBits = 0; |
| 51018 | 50922 | DWORD lowerBits = 0; |
| 51019 | 50923 | |
| 51020 | 50924 | assert( pnByte ); |
| 51021 | 50925 | lowerBits = osGetFileSize(h, &upperBits); |
| 51022 | 50926 | *pnByte = (((sqlite3_int64)upperBits)<<32) + lowerBits; |
| 51023 | 50927 | if( lowerBits==INVALID_FILE_SIZE && osGetLastError()!=NO_ERROR ){ |
| 51024 | 50928 | rc = SQLITE_IOERR_FSTAT; |
| 51025 | 50929 | } |
| 51026 | | -#endif |
| 51027 | | - |
| 51028 | 50930 | return rc; |
| 51029 | 50931 | } |
| 51030 | 50932 | |
| 51031 | 50933 | /* |
| 51032 | 50934 | ** Close the handle passed as the only argument. |
| | @@ -51221,24 +51123,10 @@ |
| 51221 | 51123 | |
| 51222 | 51124 | assert( id!=0 ); |
| 51223 | 51125 | assert( pSize!=0 ); |
| 51224 | 51126 | SimulateIOError(return SQLITE_IOERR_FSTAT); |
| 51225 | 51127 | OSTRACE(("SIZE file=%p, pSize=%p\n", pFile->h, pSize)); |
| 51226 | | - |
| 51227 | | -#if SQLITE_OS_WINRT |
| 51228 | | - { |
| 51229 | | - FILE_STANDARD_INFO info; |
| 51230 | | - if( osGetFileInformationByHandleEx(pFile->h, FileStandardInfo, |
| 51231 | | - &info, sizeof(info)) ){ |
| 51232 | | - *pSize = info.EndOfFile.QuadPart; |
| 51233 | | - }else{ |
| 51234 | | - pFile->lastErrno = osGetLastError(); |
| 51235 | | - rc = winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno, |
| 51236 | | - "winFileSize", pFile->zPath); |
| 51237 | | - } |
| 51238 | | - } |
| 51239 | | -#else |
| 51240 | 51128 | { |
| 51241 | 51129 | DWORD upperBits; |
| 51242 | 51130 | DWORD lowerBits; |
| 51243 | 51131 | DWORD lastErrno; |
| 51244 | 51132 | |
| | @@ -51249,11 +51137,10 @@ |
| 51249 | 51137 | pFile->lastErrno = lastErrno; |
| 51250 | 51138 | rc = winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno, |
| 51251 | 51139 | "winFileSize", pFile->zPath); |
| 51252 | 51140 | } |
| 51253 | 51141 | } |
| 51254 | | -#endif |
| 51255 | 51142 | OSTRACE(("SIZE file=%p, pSize=%p, *pSize=%lld, rc=%s\n", |
| 51256 | 51143 | pFile->h, pSize, *pSize, sqlite3ErrName(rc))); |
| 51257 | 51144 | return rc; |
| 51258 | 51145 | } |
| 51259 | 51146 | |
| | @@ -52211,33 +52098,18 @@ |
| 52211 | 52098 | |
| 52212 | 52099 | /* TODO: platforms. |
| 52213 | 52100 | ** TODO: retry-on-ioerr. |
| 52214 | 52101 | */ |
| 52215 | 52102 | if( osIsNT() ){ |
| 52216 | | -#if SQLITE_OS_WINRT |
| 52217 | | - CREATEFILE2_EXTENDED_PARAMETERS extendedParameters; |
| 52218 | | - memset(&extendedParameters, 0, sizeof(extendedParameters)); |
| 52219 | | - extendedParameters.dwSize = sizeof(extendedParameters); |
| 52220 | | - extendedParameters.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; |
| 52221 | | - extendedParameters.dwFileFlags = flag_overlapped; |
| 52222 | | - extendedParameters.dwSecurityQosFlags = SECURITY_ANONYMOUS; |
| 52223 | | - h = osCreateFile2((LPCWSTR)zConverted, |
| 52224 | | - (GENERIC_READ | (bReadonly ? 0 : GENERIC_WRITE)),/* dwDesiredAccess */ |
| 52225 | | - FILE_SHARE_READ | FILE_SHARE_WRITE, /* dwShareMode */ |
| 52226 | | - OPEN_ALWAYS, /* dwCreationDisposition */ |
| 52227 | | - &extendedParameters |
| 52228 | | - ); |
| 52229 | | -#else |
| 52230 | 52103 | h = osCreateFileW((LPCWSTR)zConverted, /* lpFileName */ |
| 52231 | 52104 | (GENERIC_READ | (bReadonly ? 0 : GENERIC_WRITE)), /* dwDesiredAccess */ |
| 52232 | 52105 | FILE_SHARE_READ | FILE_SHARE_WRITE, /* dwShareMode */ |
| 52233 | 52106 | NULL, /* lpSecurityAttributes */ |
| 52234 | 52107 | OPEN_ALWAYS, /* dwCreationDisposition */ |
| 52235 | 52108 | FILE_ATTRIBUTE_NORMAL|flag_overlapped, |
| 52236 | 52109 | NULL |
| 52237 | 52110 | ); |
| 52238 | | -#endif |
| 52239 | 52111 | }else{ |
| 52240 | 52112 | /* Due to pre-processor directives earlier in this file, |
| 52241 | 52113 | ** SQLITE_WIN32_HAS_ANSI is always defined if osIsNT() is false. */ |
| 52242 | 52114 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 52243 | 52115 | h = osCreateFileA((LPCSTR)zConverted, |
| | @@ -52701,13 +52573,11 @@ |
| 52701 | 52573 | |
| 52702 | 52574 | while( pShmNode->nRegion<=iRegion ){ |
| 52703 | 52575 | HANDLE hMap = NULL; /* file-mapping handle */ |
| 52704 | 52576 | void *pMap = 0; /* Mapped memory region */ |
| 52705 | 52577 | |
| 52706 | | -#if SQLITE_OS_WINRT |
| 52707 | | - hMap = osCreateFileMappingFromApp(hShared, NULL, protect, nByte, NULL); |
| 52708 | | -#elif defined(SQLITE_WIN32_HAS_WIDE) |
| 52578 | +#if defined(SQLITE_WIN32_HAS_WIDE) |
| 52709 | 52579 | hMap = osCreateFileMappingW(hShared, NULL, protect, 0, nByte, NULL); |
| 52710 | 52580 | #elif defined(SQLITE_WIN32_HAS_ANSI) && SQLITE_WIN32_CREATEFILEMAPPINGA |
| 52711 | 52581 | hMap = osCreateFileMappingA(hShared, NULL, protect, 0, nByte, NULL); |
| 52712 | 52582 | #endif |
| 52713 | 52583 | |
| | @@ -52715,19 +52585,13 @@ |
| 52715 | 52585 | osGetCurrentProcessId(), pShmNode->nRegion, nByte, |
| 52716 | 52586 | hMap ? "ok" : "failed")); |
| 52717 | 52587 | if( hMap ){ |
| 52718 | 52588 | int iOffset = pShmNode->nRegion*szRegion; |
| 52719 | 52589 | int iOffsetShift = iOffset % winSysInfo.dwAllocationGranularity; |
| 52720 | | -#if SQLITE_OS_WINRT |
| 52721 | | - pMap = osMapViewOfFileFromApp(hMap, flags, |
| 52722 | | - iOffset - iOffsetShift, szRegion + iOffsetShift |
| 52723 | | - ); |
| 52724 | | -#else |
| 52725 | 52590 | pMap = osMapViewOfFile(hMap, flags, |
| 52726 | 52591 | 0, iOffset - iOffsetShift, szRegion + iOffsetShift |
| 52727 | 52592 | ); |
| 52728 | | -#endif |
| 52729 | 52593 | OSTRACE(("SHM-MAP-MAP pid=%lu, region=%d, offset=%d, size=%d, rc=%s\n", |
| 52730 | 52594 | osGetCurrentProcessId(), pShmNode->nRegion, iOffset, |
| 52731 | 52595 | szRegion, pMap ? "ok" : "failed")); |
| 52732 | 52596 | } |
| 52733 | 52597 | if( !pMap ){ |
| | @@ -52856,13 +52720,11 @@ |
| 52856 | 52720 | if( (pFd->ctrlFlags & WINFILE_RDONLY)==0 ){ |
| 52857 | 52721 | protect = PAGE_READWRITE; |
| 52858 | 52722 | flags |= FILE_MAP_WRITE; |
| 52859 | 52723 | } |
| 52860 | 52724 | #endif |
| 52861 | | -#if SQLITE_OS_WINRT |
| 52862 | | - pFd->hMap = osCreateFileMappingFromApp(pFd->h, NULL, protect, nMap, NULL); |
| 52863 | | -#elif defined(SQLITE_WIN32_HAS_WIDE) |
| 52725 | +#if defined(SQLITE_WIN32_HAS_WIDE) |
| 52864 | 52726 | pFd->hMap = osCreateFileMappingW(pFd->h, NULL, protect, |
| 52865 | 52727 | (DWORD)((nMap>>32) & 0xffffffff), |
| 52866 | 52728 | (DWORD)(nMap & 0xffffffff), NULL); |
| 52867 | 52729 | #elif defined(SQLITE_WIN32_HAS_ANSI) && SQLITE_WIN32_CREATEFILEMAPPINGA |
| 52868 | 52730 | pFd->hMap = osCreateFileMappingA(pFd->h, NULL, protect, |
| | @@ -52878,15 +52740,11 @@ |
| 52878 | 52740 | osGetCurrentProcessId(), pFd, sqlite3ErrName(rc))); |
| 52879 | 52741 | return SQLITE_OK; |
| 52880 | 52742 | } |
| 52881 | 52743 | assert( (nMap % winSysInfo.dwPageSize)==0 ); |
| 52882 | 52744 | assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff ); |
| 52883 | | -#if SQLITE_OS_WINRT |
| 52884 | | - pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, (SIZE_T)nMap); |
| 52885 | | -#else |
| 52886 | 52745 | pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap); |
| 52887 | | -#endif |
| 52888 | 52746 | if( pNew==NULL ){ |
| 52889 | 52747 | osCloseHandle(pFd->hMap); |
| 52890 | 52748 | pFd->hMap = NULL; |
| 52891 | 52749 | pFd->lastErrno = osGetLastError(); |
| 52892 | 52750 | rc = winLogError(SQLITE_IOERR_MMAP, pFd->lastErrno, |
| | @@ -53217,11 +53075,10 @@ |
| 53217 | 53075 | } |
| 53218 | 53076 | } |
| 53219 | 53077 | } |
| 53220 | 53078 | #endif |
| 53221 | 53079 | |
| 53222 | | -#if !SQLITE_OS_WINRT && defined(_WIN32) |
| 53223 | 53080 | else if( osIsNT() ){ |
| 53224 | 53081 | char *zMulti; |
| 53225 | 53082 | LPWSTR zWidePath = sqlite3MallocZero( nMax*sizeof(WCHAR) ); |
| 53226 | 53083 | if( !zWidePath ){ |
| 53227 | 53084 | sqlite3_free(zBuf); |
| | @@ -53271,11 +53128,10 @@ |
| 53271 | 53128 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 53272 | 53129 | return SQLITE_IOERR_NOMEM_BKPT; |
| 53273 | 53130 | } |
| 53274 | 53131 | } |
| 53275 | 53132 | #endif /* SQLITE_WIN32_HAS_ANSI */ |
| 53276 | | -#endif /* !SQLITE_OS_WINRT */ |
| 53277 | 53133 | |
| 53278 | 53134 | /* |
| 53279 | 53135 | ** Check to make sure the temporary directory ends with an appropriate |
| 53280 | 53136 | ** separator. If it does not and there is not enough space left to add |
| 53281 | 53137 | ** one, fail. |
| | @@ -53446,17 +53302,10 @@ |
| 53446 | 53302 | |
| 53447 | 53303 | assert( pFile!=0 ); |
| 53448 | 53304 | memset(pFile, 0, sizeof(winFile)); |
| 53449 | 53305 | pFile->h = INVALID_HANDLE_VALUE; |
| 53450 | 53306 | |
| 53451 | | -#if SQLITE_OS_WINRT |
| 53452 | | - if( !zUtf8Name && !sqlite3_temp_directory ){ |
| 53453 | | - sqlite3_log(SQLITE_ERROR, |
| 53454 | | - "sqlite3_temp_directory variable should be set for WinRT"); |
| 53455 | | - } |
| 53456 | | -#endif |
| 53457 | | - |
| 53458 | 53307 | /* If the second argument to this function is NULL, generate a |
| 53459 | 53308 | ** temporary file name to use |
| 53460 | 53309 | */ |
| 53461 | 53310 | if( !zUtf8Name ){ |
| 53462 | 53311 | assert( isDelete && !isOpenJournal ); |
| | @@ -53535,35 +53384,10 @@ |
| 53535 | 53384 | #if SQLITE_OS_WINCE |
| 53536 | 53385 | dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS; |
| 53537 | 53386 | #endif |
| 53538 | 53387 | |
| 53539 | 53388 | if( osIsNT() ){ |
| 53540 | | -#if SQLITE_OS_WINRT |
| 53541 | | - CREATEFILE2_EXTENDED_PARAMETERS extendedParameters; |
| 53542 | | - extendedParameters.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS); |
| 53543 | | - extendedParameters.dwFileAttributes = |
| 53544 | | - dwFlagsAndAttributes & FILE_ATTRIBUTE_MASK; |
| 53545 | | - extendedParameters.dwFileFlags = dwFlagsAndAttributes & FILE_FLAG_MASK; |
| 53546 | | - extendedParameters.dwSecurityQosFlags = SECURITY_ANONYMOUS; |
| 53547 | | - extendedParameters.lpSecurityAttributes = NULL; |
| 53548 | | - extendedParameters.hTemplateFile = NULL; |
| 53549 | | - do{ |
| 53550 | | - h = osCreateFile2((LPCWSTR)zConverted, |
| 53551 | | - dwDesiredAccess, |
| 53552 | | - dwShareMode, |
| 53553 | | - dwCreationDisposition, |
| 53554 | | - &extendedParameters); |
| 53555 | | - if( h!=INVALID_HANDLE_VALUE ) break; |
| 53556 | | - if( isReadWrite ){ |
| 53557 | | - int rc2; |
| 53558 | | - sqlite3BeginBenignMalloc(); |
| 53559 | | - rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ|NORETRY, &isRO); |
| 53560 | | - sqlite3EndBenignMalloc(); |
| 53561 | | - if( rc2==SQLITE_OK && isRO ) break; |
| 53562 | | - } |
| 53563 | | - }while( winRetryIoerr(&cnt, &lastErrno) ); |
| 53564 | | -#else |
| 53565 | 53389 | do{ |
| 53566 | 53390 | h = osCreateFileW((LPCWSTR)zConverted, |
| 53567 | 53391 | dwDesiredAccess, |
| 53568 | 53392 | dwShareMode, NULL, |
| 53569 | 53393 | dwCreationDisposition, |
| | @@ -53576,11 +53400,10 @@ |
| 53576 | 53400 | rc2 = winAccess(pVfs, zUtf8Name, SQLITE_ACCESS_READ|NORETRY, &isRO); |
| 53577 | 53401 | sqlite3EndBenignMalloc(); |
| 53578 | 53402 | if( rc2==SQLITE_OK && isRO ) break; |
| 53579 | 53403 | } |
| 53580 | 53404 | }while( winRetryIoerr(&cnt, &lastErrno) ); |
| 53581 | | -#endif |
| 53582 | 53405 | } |
| 53583 | 53406 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 53584 | 53407 | else{ |
| 53585 | 53408 | do{ |
| 53586 | 53409 | h = osCreateFileA((LPCSTR)zConverted, |
| | @@ -53713,29 +53536,11 @@ |
| 53713 | 53536 | OSTRACE(("DELETE name=%s, rc=SQLITE_IOERR_NOMEM\n", zFilename)); |
| 53714 | 53537 | return SQLITE_IOERR_NOMEM_BKPT; |
| 53715 | 53538 | } |
| 53716 | 53539 | if( osIsNT() ){ |
| 53717 | 53540 | do { |
| 53718 | | -#if SQLITE_OS_WINRT |
| 53719 | | - WIN32_FILE_ATTRIBUTE_DATA sAttrData; |
| 53720 | | - memset(&sAttrData, 0, sizeof(sAttrData)); |
| 53721 | | - if ( osGetFileAttributesExW(zConverted, GetFileExInfoStandard, |
| 53722 | | - &sAttrData) ){ |
| 53723 | | - attr = sAttrData.dwFileAttributes; |
| 53724 | | - }else{ |
| 53725 | | - lastErrno = osGetLastError(); |
| 53726 | | - if( lastErrno==ERROR_FILE_NOT_FOUND |
| 53727 | | - || lastErrno==ERROR_PATH_NOT_FOUND ){ |
| 53728 | | - rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */ |
| 53729 | | - }else{ |
| 53730 | | - rc = SQLITE_ERROR; |
| 53731 | | - } |
| 53732 | | - break; |
| 53733 | | - } |
| 53734 | | -#else |
| 53735 | 53541 | attr = osGetFileAttributesW(zConverted); |
| 53736 | | -#endif |
| 53737 | 53542 | if ( attr==INVALID_FILE_ATTRIBUTES ){ |
| 53738 | 53543 | lastErrno = osGetLastError(); |
| 53739 | 53544 | if( lastErrno==ERROR_FILE_NOT_FOUND |
| 53740 | 53545 | || lastErrno==ERROR_PATH_NOT_FOUND ){ |
| 53741 | 53546 | rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */ |
| | @@ -54022,11 +53827,11 @@ |
| 54022 | 53827 | sqlite3_vfs *pVfs, /* Pointer to vfs object */ |
| 54023 | 53828 | const char *zRelative, /* Possibly relative input path */ |
| 54024 | 53829 | int nFull, /* Size of output buffer in bytes */ |
| 54025 | 53830 | char *zFull /* Output buffer */ |
| 54026 | 53831 | ){ |
| 54027 | | -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT |
| 53832 | +#if !SQLITE_OS_WINCE |
| 54028 | 53833 | int nByte; |
| 54029 | 53834 | void *zConverted; |
| 54030 | 53835 | char *zOut; |
| 54031 | 53836 | #endif |
| 54032 | 53837 | |
| | @@ -54111,11 +53916,11 @@ |
| 54111 | 53916 | return rc; |
| 54112 | 53917 | } |
| 54113 | 53918 | } |
| 54114 | 53919 | #endif /* __CYGWIN__ */ |
| 54115 | 53920 | |
| 54116 | | -#if (SQLITE_OS_WINCE || SQLITE_OS_WINRT) && defined(_WIN32) |
| 53921 | +#if SQLITE_OS_WINCE && defined(_WIN32) |
| 54117 | 53922 | SimulateIOError( return SQLITE_ERROR ); |
| 54118 | 53923 | /* WinCE has no concept of a relative pathname, or so I am told. */ |
| 54119 | 53924 | /* WinRT has no way to convert a relative path to an absolute one. */ |
| 54120 | 53925 | if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ |
| 54121 | 53926 | /* |
| | @@ -54130,11 +53935,11 @@ |
| 54130 | 53935 | sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zRelative); |
| 54131 | 53936 | } |
| 54132 | 53937 | return SQLITE_OK; |
| 54133 | 53938 | #endif |
| 54134 | 53939 | |
| 54135 | | -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT |
| 53940 | +#if !SQLITE_OS_WINCE |
| 54136 | 53941 | #if defined(_WIN32) |
| 54137 | 53942 | /* It's odd to simulate an io-error here, but really this is just |
| 54138 | 53943 | ** using the io-error infrastructure to test that SQLite handles this |
| 54139 | 53944 | ** function failing. This function could fail if, for example, the |
| 54140 | 53945 | ** current working directory has been unlinked. |
| | @@ -54262,15 +54067,11 @@ |
| 54262 | 54067 | if( zConverted==0 ){ |
| 54263 | 54068 | OSTRACE(("DLOPEN name=%s, handle=%p\n", zFilename, (void*)0)); |
| 54264 | 54069 | return 0; |
| 54265 | 54070 | } |
| 54266 | 54071 | if( osIsNT() ){ |
| 54267 | | -#if SQLITE_OS_WINRT |
| 54268 | | - h = osLoadPackagedLibrary((LPCWSTR)zConverted, 0); |
| 54269 | | -#else |
| 54270 | 54072 | h = osLoadLibraryW((LPCWSTR)zConverted); |
| 54271 | | -#endif |
| 54272 | 54073 | } |
| 54273 | 54074 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 54274 | 54075 | else{ |
| 54275 | 54076 | h = osLoadLibraryA((char*)zConverted); |
| 54276 | 54077 | } |
| | @@ -54348,37 +54149,30 @@ |
| 54348 | 54149 | } |
| 54349 | 54150 | { |
| 54350 | 54151 | DWORD pid = osGetCurrentProcessId(); |
| 54351 | 54152 | xorMemory(&e, (unsigned char*)&pid, sizeof(DWORD)); |
| 54352 | 54153 | } |
| 54353 | | -#if SQLITE_OS_WINRT |
| 54354 | | - { |
| 54355 | | - ULONGLONG cnt = osGetTickCount64(); |
| 54356 | | - xorMemory(&e, (unsigned char*)&cnt, sizeof(ULONGLONG)); |
| 54357 | | - } |
| 54358 | | -#else |
| 54359 | 54154 | { |
| 54360 | 54155 | DWORD cnt = osGetTickCount(); |
| 54361 | 54156 | xorMemory(&e, (unsigned char*)&cnt, sizeof(DWORD)); |
| 54362 | 54157 | } |
| 54363 | | -#endif /* SQLITE_OS_WINRT */ |
| 54364 | 54158 | { |
| 54365 | 54159 | LARGE_INTEGER i; |
| 54366 | 54160 | osQueryPerformanceCounter(&i); |
| 54367 | 54161 | xorMemory(&e, (unsigned char*)&i, sizeof(LARGE_INTEGER)); |
| 54368 | 54162 | } |
| 54369 | | -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID |
| 54163 | +#if !SQLITE_OS_WINCE && SQLITE_WIN32_USE_UUID |
| 54370 | 54164 | { |
| 54371 | 54165 | UUID id; |
| 54372 | 54166 | memset(&id, 0, sizeof(UUID)); |
| 54373 | 54167 | osUuidCreate(&id); |
| 54374 | 54168 | xorMemory(&e, (unsigned char*)&id, sizeof(UUID)); |
| 54375 | 54169 | memset(&id, 0, sizeof(UUID)); |
| 54376 | 54170 | osUuidCreateSequential(&id); |
| 54377 | 54171 | xorMemory(&e, (unsigned char*)&id, sizeof(UUID)); |
| 54378 | 54172 | } |
| 54379 | | -#endif /* !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID */ |
| 54173 | +#endif /* !SQLITE_OS_WINCE && SQLITE_WIN32_USE_UUID */ |
| 54380 | 54174 | return e.nXor>nBuf ? nBuf : e.nXor; |
| 54381 | 54175 | #endif /* defined(SQLITE_TEST) || defined(SQLITE_OMIT_RANDOMNESS) */ |
| 54382 | 54176 | } |
| 54383 | 54177 | |
| 54384 | 54178 | |
| | @@ -54605,19 +54399,15 @@ |
| 54605 | 54399 | }; |
| 54606 | 54400 | #endif |
| 54607 | 54401 | |
| 54608 | 54402 | /* Double-check that the aSyscall[] array has been constructed |
| 54609 | 54403 | ** correctly. See ticket [bb3a86e890c8e96ab] */ |
| 54610 | | - assert( ArraySize(aSyscall)==89 ); |
| 54404 | + assert( ArraySize(aSyscall)==86 ); |
| 54611 | 54405 | |
| 54612 | 54406 | /* get memory map allocation granularity */ |
| 54613 | 54407 | memset(&winSysInfo, 0, sizeof(SYSTEM_INFO)); |
| 54614 | | -#if SQLITE_OS_WINRT |
| 54615 | | - osGetNativeSystemInfo(&winSysInfo); |
| 54616 | | -#else |
| 54617 | 54408 | osGetSystemInfo(&winSysInfo); |
| 54618 | | -#endif |
| 54619 | 54409 | assert( winSysInfo.dwAllocationGranularity>0 ); |
| 54620 | 54410 | assert( winSysInfo.dwPageSize>0 ); |
| 54621 | 54411 | |
| 54622 | 54412 | sqlite3_vfs_register(&winVfs, 1); |
| 54623 | 54413 | |
| | @@ -54637,21 +54427,13 @@ |
| 54637 | 54427 | |
| 54638 | 54428 | return SQLITE_OK; |
| 54639 | 54429 | } |
| 54640 | 54430 | |
| 54641 | 54431 | SQLITE_API int sqlite3_os_end(void){ |
| 54642 | | -#if SQLITE_OS_WINRT |
| 54643 | | - if( sleepObj!=NULL ){ |
| 54644 | | - osCloseHandle(sleepObj); |
| 54645 | | - sleepObj = NULL; |
| 54646 | | - } |
| 54647 | | -#endif |
| 54648 | | - |
| 54649 | 54432 | #ifndef SQLITE_OMIT_WAL |
| 54650 | 54433 | winBigLock = 0; |
| 54651 | 54434 | #endif |
| 54652 | | - |
| 54653 | 54435 | return SQLITE_OK; |
| 54654 | 54436 | } |
| 54655 | 54437 | |
| 54656 | 54438 | #endif /* SQLITE_OS_WIN */ |
| 54657 | 54439 | |
| | @@ -188384,15 +188166,16 @@ |
| 188384 | 188166 | |
| 188385 | 188167 | /* Initialize the output variables to -1 in case an error occurs. */ |
| 188386 | 188168 | if( pnLog ) *pnLog = -1; |
| 188387 | 188169 | if( pnCkpt ) *pnCkpt = -1; |
| 188388 | 188170 | |
| 188171 | + assert( SQLITE_CHECKPOINT_NOOP==-1 ); |
| 188389 | 188172 | assert( SQLITE_CHECKPOINT_PASSIVE==0 ); |
| 188390 | 188173 | assert( SQLITE_CHECKPOINT_FULL==1 ); |
| 188391 | 188174 | assert( SQLITE_CHECKPOINT_RESTART==2 ); |
| 188392 | 188175 | assert( SQLITE_CHECKPOINT_TRUNCATE==3 ); |
| 188393 | | - if( eMode<SQLITE_CHECKPOINT_PASSIVE || eMode>SQLITE_CHECKPOINT_TRUNCATE ){ |
| 188176 | + if( eMode<SQLITE_CHECKPOINT_NOOP || eMode>SQLITE_CHECKPOINT_TRUNCATE ){ |
| 188394 | 188177 | /* EVIDENCE-OF: R-03996-12088 The M parameter must be a valid checkpoint |
| 188395 | 188178 | ** mode: */ |
| 188396 | 188179 | return SQLITE_MISUSE_BKPT; |
| 188397 | 188180 | } |
| 188398 | 188181 | |
| | @@ -203418,11 +203201,12 @@ |
| 203418 | 203201 | PendingList *pList; |
| 203419 | 203202 | int rc = SQLITE_OK; |
| 203420 | 203203 | |
| 203421 | 203204 | pList = (PendingList *)fts3HashFind(pHash, zToken, nToken); |
| 203422 | 203205 | if( pList ){ |
| 203423 | | - assert( pList->nData+nToken+sizeof(Fts3HashElem) <= (i64)p->nPendingData ); |
| 203206 | + assert( (i64)pList->nData+(i64)nToken+(i64)sizeof(Fts3HashElem) |
| 203207 | + <= (i64)p->nPendingData ); |
| 203424 | 203208 | p->nPendingData -= (int)(pList->nData + nToken + sizeof(Fts3HashElem)); |
| 203425 | 203209 | } |
| 203426 | 203210 | if( fts3PendingListAppend(&pList, p->iPrevDocid, iCol, iPos, &rc) ){ |
| 203427 | 203211 | if( pList==fts3HashInsert(pHash, zToken, nToken, pList) ){ |
| 203428 | 203212 | /* Malloc failed while inserting the new entry. This can only |
| | @@ -225114,11 +224898,11 @@ |
| 225114 | 224898 | total += cnt; |
| 225115 | 224899 | if( total>limit ){ |
| 225116 | 224900 | /* ERROR: copy exceeds output file size */ |
| 225117 | 224901 | return -1; |
| 225118 | 224902 | } |
| 225119 | | - if( (int)(ofst+cnt) > lenSrc ){ |
| 224903 | + if( (u64)ofst+(u64)cnt > (u64)lenSrc ){ |
| 225120 | 224904 | /* ERROR: copy extends past end of input */ |
| 225121 | 224905 | return -1; |
| 225122 | 224906 | } |
| 225123 | 224907 | memcpy(zOut, &zSrc[ofst], cnt); |
| 225124 | 224908 | zOut += cnt; |
| | @@ -259795,10 +259579,11 @@ |
| 259795 | 259579 | } |
| 259796 | 259580 | } |
| 259797 | 259581 | } |
| 259798 | 259582 | |
| 259799 | 259583 | update_out: |
| 259584 | + sqlite3Fts5IndexCloseReader(pTab->p.pIndex); |
| 259800 | 259585 | pTab->p.pConfig->pzErrmsg = 0; |
| 259801 | 259586 | return rc; |
| 259802 | 259587 | } |
| 259803 | 259588 | |
| 259804 | 259589 | /* |
| | @@ -261312,11 +261097,11 @@ |
| 261312 | 261097 | int nArg, /* Number of args */ |
| 261313 | 261098 | sqlite3_value **apUnused /* Function arguments */ |
| 261314 | 261099 | ){ |
| 261315 | 261100 | assert( nArg==0 ); |
| 261316 | 261101 | UNUSED_PARAM2(nArg, apUnused); |
| 261317 | | - sqlite3_result_text(pCtx, "fts5: 2025-12-06 11:54:43 b3da6a8728641a0c9ca2f3b20c9817c0a2be6c5bf05f020590547480d2aff0e0", -1, SQLITE_TRANSIENT); |
| 261102 | + sqlite3_result_text(pCtx, "fts5: 2025-12-11 18:16:39 e785a80e4100c368dca8d73cb662cff4d0fd76734fa0f3fa9b5754a380f7c746", -1, SQLITE_TRANSIENT); |
| 261318 | 261103 | } |
| 261319 | 261104 | |
| 261320 | 261105 | /* |
| 261321 | 261106 | ** Implementation of fts5_locale(LOCALE, TEXT) function. |
| 261322 | 261107 | ** |
| 261323 | 261108 | |