From: mistachkin Date: Wed, 17 Jan 2018 01:40:57 +0000 (+0000) Subject: Simplifications to winOpenSharedMemory in the Win32 VFS. X-Git-Tag: version-3.22.0~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=98e2cb8bd181cb2f1195b431a4fba9055c459ea6;p=thirdparty%2Fsqlite.git Simplifications to winOpenSharedMemory in the Win32 VFS. FossilOrigin-Name: 3e04999dabb87715de46255b1a9b08d5dfa70d140e0a09a37ea2842d71c77caf --- diff --git a/manifest b/manifest index 2670429108..3faeefe23f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Corrections\sto\serror\scode\shandling\sin\sos_win.c,\spursuant\sto\swalfault.test. -D 2018-01-17T01:26:05.915 +C Simplifications\sto\swinOpenSharedMemory\sin\sthe\sWin32\sVFS. +D 2018-01-17T01:40:57.173 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 38f84f301cbef443b2d269f67a74b8cc536469831f70df7c3e912acc04932cc2 @@ -470,7 +470,7 @@ F src/os.h 48388821692e87da174ea198bf96b1b2d9d83be5dfc908f673ee21fafbe0d432 F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586 F src/os_unix.c a82505be158d8ce42b38dcc9b426187d776904c12cdc68dc8925e1dfcc5cb6ce -F src/os_win.c 196b2b38953a3678e0ae1be40875c9c303ff216ec56ac2a6721e56ce9a9a454e +F src/os_win.c 501dde1ee770f4ffa458bfe1cf376a556de3ab00bb8320d659c5984403991d62 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a F src/pager.c 9b9cb4e06c03d43d62480a7a685a012d645fcf3a39e7767ccb505fb41ee083ec F src/pager.h 581698f2177e8bd4008fe4760898ce20b6133d1df22139b9101b5155f900df7a @@ -1699,7 +1699,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 7274d05ff43fc9872f0e4857ae583689e4a6c429b7fa991dcc29744da3048879 -R a85767f9e76828ee76ff125e1a16892d +P 568192228c9578b8ea34c363e10ff28450045cda76248b2f0f89f84b3a57e680 +R 74d0fd9e585002553a9ac7b39220a819 U mistachkin -Z 21eee94f9fdd383abaac3542e6cde8fb +Z 373464fa908aa53424186ef8053b7fb1 diff --git a/manifest.uuid b/manifest.uuid index f91d56d71c..e6427cfa9a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -568192228c9578b8ea34c363e10ff28450045cda76248b2f0f89f84b3a57e680 \ No newline at end of file +3e04999dabb87715de46255b1a9b08d5dfa70d140e0a09a37ea2842d71c77caf \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 6df66f1d7a..2b2b8ebd56 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -3865,7 +3865,6 @@ static int winOpenSharedMemory(winFile *pDbFd){ struct winShm *p; /* The connection to be opened */ winShmNode *pShmNode = 0; /* The underlying mmapped file */ int rc = SQLITE_OK; /* Result code */ - int rc2 = SQLITE_ERROR; /* winOpen result code */ winShmNode *pNew; /* Newly allocated winShmNode */ int nName; /* Size of zName in bytes */ @@ -3899,7 +3898,8 @@ static int winOpenSharedMemory(winFile *pDbFd){ if( pShmNode ){ sqlite3_free(pNew); }else{ - int bReadonly; + int inFlags = SQLITE_OPEN_WAL; + int outFlags = 0; pShmNode = pNew; pNew = 0; @@ -3915,28 +3915,20 @@ static int winOpenSharedMemory(winFile *pDbFd){ } } - bReadonly = sqlite3_uri_boolean(pDbFd->zPath, "readonly_shm", 0); - - if( !bReadonly ){ - rc2 = winOpen(pDbFd->pVfs, - pShmNode->zFilename, - (sqlite3_file*)&pShmNode->hFile, - SQLITE_OPEN_WAL|SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE, - 0); + if( 0==sqlite3_uri_boolean(pDbFd->zPath, "readonly_shm", 0) ){ + inFlags |= SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE; + }else{ + inFlags |= SQLITE_OPEN_READONLY; } - if( rc2!=SQLITE_OK ){ - int rc3 = winOpen(pDbFd->pVfs, - pShmNode->zFilename, - (sqlite3_file*)&pShmNode->hFile, - SQLITE_OPEN_WAL|SQLITE_OPEN_READONLY, - 0); - if( rc3!=SQLITE_OK ){ - rc = winLogError(bReadonly ? rc3 : rc2, osGetLastError(), "winOpenShm", - pShmNode->zFilename); - goto shm_open_err; - } - pShmNode->isReadonly = 1; + rc = winOpen(pDbFd->pVfs, pShmNode->zFilename, + (sqlite3_file*)&pShmNode->hFile, + inFlags, &outFlags); + if( rc!=SQLITE_OK ){ + rc = winLogError(rc, osGetLastError(), "winOpenShm", + pShmNode->zFilename); + goto shm_open_err; } + if( outFlags==SQLITE_OPEN_READONLY ) pShmNode->isReadonly = 1; rc = winLockSharedMemory(pShmNode); if( rc!=SQLITE_OK && rc!=SQLITE_READONLY_CANTINIT ) goto shm_open_err;