From: mistachkin Date: Sat, 28 Apr 2018 01:48:40 +0000 (+0000) Subject: Document and expose sqlite3_win32_set_directory() function for use on Win32. X-Git-Tag: version-3.23.2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a2f4ea540c193ddaf6f7d9f4babfb3d727c75588;p=thirdparty%2Fsqlite.git Document and expose sqlite3_win32_set_directory() function for use on Win32. FossilOrigin-Name: f677065aab61037914fc980456caaa60132a19b387d6d717ec1a6b6fa7c61a10 --- diff --git a/manifest b/manifest index f451a24a25..66f3a0d531 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Bump\sthe\sversion\snumber\sto\s3.23.2. -D 2018-04-28T01:37:00.509 +C Document\sand\sexpose\ssqlite3_win32_set_directory()\sfunction\sfor\suse\son\sWin32. +D 2018-04-28T01:48:40.156 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F Makefile.in 7016fc56c6b9bfe5daac4f34be8be38d8c0b5fab79ccbfb764d3b23bf1c6fff3 @@ -476,7 +476,7 @@ F src/os.h 48388821692e87da174ea198bf96b1b2d9d83be5dfc908f673ee21fafbe0d432 F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_setup.h 0dbaea40a7d36bf311613d31342e0b99e2536586 F src/os_unix.c 2b53b0b8ddc580db096252c721729e5f5f2f355b4fc056f8f3fb328aeb3c9e8a -F src/os_win.c eb03c6d52f893bcd7fdd4c6006674c13c1b5e49543fec98d605201af2997171c +F src/os_win.c a8f39484f3b9162250f510bcceb2826638c00847c9c271b770289f672ebe5372 F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a F src/pager.c 1bb6a57fa0465296a4d6109a1a64610a0e7adde1f3acf3ef539a9d972908ce8f F src/pager.h c571b064df842ec8f2e90855dead9acf4cbe0d1b2c05afe0ef0d0145f7fd0388 @@ -493,7 +493,7 @@ F src/resolve.c 66c73fcb7719b8ff0e841b58338f13604ff3e2b50a723f9b8f383595735262f6 F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac F src/select.c dfcd77a9bec9d2bcb221ed93c153cb38cc609faa6404e2dc0ae9491aac110112 F src/shell.c.in cc960721e56ebc1a78773bb5d2f5608b54275f945cbe49e4afe919d6888062a7 -F src/sqlite.h.in e0be726ea6e4e6571724d39d242472ecd8bd1ba6f84ade88e1641bde98a6d02b +F src/sqlite.h.in 70242252c3fdcc74baf6d273fc7a88ded70bedae768f49745b8f668628435ad9 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 83a3c4ce93d650bedfd1aa558cb85a516bd6d094445ee989740827d0d944368d F src/sqliteInt.h a4837c57f9a3e2af100bc59f4be60d16b823f18131f8cef6a6685440f775eebd @@ -1717,10 +1717,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 4bb2294022060e61de7da5c227a69ccd846ba330e31626ebcd59a94efd148b3b -R 90c45a361d670753c00ab844dbd6bd2c -T *branch * branch-3.23 -T *sym-branch-3.23 * -T -sym-trunk * -U drh -Z 624b262c4ed8ccaad1c9161759e40c3d +P 242dc910b0c75acf5eaf45b5af74794d84b1f104dafc7a04305aacc0d4db401b +Q +7626b593405ca720e371b9f698b72b499b7c829bfe00f758140bc542cf970689 +R 0ab806145e53d4fd1e56824416e30084 +U mistachkin +Z 32f99da5136597482dedef6d0e1c871b diff --git a/manifest.uuid b/manifest.uuid index 4c09b27d2b..dfd26f41b6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -242dc910b0c75acf5eaf45b5af74794d84b1f104dafc7a04305aacc0d4db401b \ No newline at end of file +f677065aab61037914fc980456caaa60132a19b387d6d717ec1a6b6fa7c61a10 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 534426977f..df97f928ea 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -315,22 +315,6 @@ struct winVfsAppData { # define SQLITE_WIN32_DBG_BUF_SIZE ((int)(4096-sizeof(DWORD))) #endif -/* - * The value used with sqlite3_win32_set_directory() to specify that - * the data directory should be changed. - */ -#ifndef SQLITE_WIN32_DATA_DIRECTORY_TYPE -# define SQLITE_WIN32_DATA_DIRECTORY_TYPE (1) -#endif - -/* - * The value used with sqlite3_win32_set_directory() to specify that - * the temporary directory should be changed. - */ -#ifndef SQLITE_WIN32_TEMP_DIRECTORY_TYPE -# define SQLITE_WIN32_TEMP_DIRECTORY_TYPE (2) -#endif - /* * If compiled with SQLITE_WIN32_MALLOC on Windows, we will use the * various Win32 API heap functions instead of our own. @@ -1933,7 +1917,10 @@ char *sqlite3_win32_utf8_to_mbcs_v2(const char *zText, int useAnsi){ ** argument is the name of the directory to use. The return value will be ** SQLITE_OK if successful. */ -int sqlite3_win32_set_directory(DWORD type, LPCWSTR zValue){ +int sqlite3_win32_set_directory( + unsigned long type, /* Identifier for directory being set or reset */ + void *zValue /* New value for directory being set or reset */ +){ char **ppDirectory = 0; #ifndef SQLITE_OMIT_AUTOINIT int rc = sqlite3_initialize(); @@ -1949,9 +1936,10 @@ int sqlite3_win32_set_directory(DWORD type, LPCWSTR zValue){ ); assert( !ppDirectory || sqlite3MemdebugHasType(*ppDirectory, MEMTYPE_HEAP) ); if( ppDirectory ){ + LPCWSTR zStrValue = zValue; char *zValueUtf8 = 0; - if( zValue && zValue[0] ){ - zValueUtf8 = winUnicodeToUtf8(zValue); + if( zStrValue && zStrValue[0] ){ + zValueUtf8 = winUnicodeToUtf8(zStrValue); if ( zValueUtf8==0 ){ return SQLITE_NOMEM_BKPT; } diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 202155df71..636952c348 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -5492,6 +5492,36 @@ SQLITE_EXTERN char *sqlite3_temp_directory; */ SQLITE_EXTERN char *sqlite3_data_directory; +/* +** CAPI3REF: Win32 Specific Interface +** +** These interfaces are available only on Windows. The +** [sqlite3_win32_set_directory] interface is used to set the value associated +** with the [sqlite3_temp_directory] or [sqlite3_data_directory] variable, to +** zValue, depending on the value of the type parameter. The zValue parameter +** should be NULL to cause the previous value to be freed via [sqlite3_free]; +** a non-NULL value will be copied into memory obtained from [sqlite3_malloc] +** prior to being used. The [sqlite3_win32_set_directory] interface returns +** [SQLITE_OK] to indicate success, [SQLITE_ERROR] if the type is unsupported, +** or [SQLITE_NOMEM] if memory could not be allocated. The value of the +** [sqlite3_data_directory] variable is intended to act as a replacement for +** the current directory on the sub-platforms of Win32 where that concept is +** not present, e.g. WinRT and UWP. +*/ +int sqlite3_win32_set_directory( + unsigned long type, /* Identifier for directory being set or reset */ + void *zValue /* New value for directory being set or reset */ +); + +/* +** CAPI3REF: Win32 Directory Types +** +** These macros are only available on Windows. They define the allowed values +** for the type argument to the [sqlite3_win32_set_directory] interface. +*/ +#define SQLITE_WIN32_DATA_DIRECTORY_TYPE 1 +#define SQLITE_WIN32_TEMP_DIRECTORY_TYPE 2 + /* ** CAPI3REF: Test For Auto-Commit Mode ** KEYWORDS: {autocommit mode}