From: drh Date: Sun, 26 Apr 2020 22:04:48 +0000 (+0000) Subject: Yet another attempt to enhance sqlite3_load_extension() so that it works X-Git-Tag: version-3.32.0~59 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e238e3141381dc5a6e811e94f0a1ab93c1bb2286;p=thirdparty%2Fsqlite.git Yet another attempt to enhance sqlite3_load_extension() so that it works with Window-style pathnames using a backslash separator character. FossilOrigin-Name: b73d9a7d6f7fec0ffc9640902a849289c305f8651e891388c01255c4da7a6c4b --- diff --git a/manifest b/manifest index 4b2602159b..e6fae833bc 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\san\sissue\swith\scheck-in\s[bc3bf7c6681a96bc]\swhen\scompiling\son\sWindows. -D 2020-04-26T14:33:54.319 +C Yet\sanother\sattempt\sto\senhance\ssqlite3_load_extension()\sso\sthat\sit\sworks\nwith\sWindow-style\spathnames\susing\sa\sbackslash\sseparator\scharacter. +D 2020-04-26T22:04:48.458 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -495,7 +495,7 @@ F src/hwtime.h cb1d7e3e1ed94b7aa6fde95ae2c2daccc3df826be26fc9ed7fd90d1750ae6144 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71 F src/insert.c 8e4211d04eb460c0694d486c6ba1c068d468c6f653c3f237869a802ad82854de F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa -F src/loadext.c acefcfb00f58b5c9d5763812c40fed82f11ded617ae8cb80a7bab540b429d039 +F src/loadext.c 421310045bd78afefb772294a99e50f37d87ae578786a6169074e6291e30d969 F src/main.c 652a782cd7b6c6ddf7419fcaf06b8aa9440b7c815857241171c9bdf03ab6544c F src/malloc.c cabfef0d725e04c8abfe0231a556ed8b78bf329dcc3fddbf903f6cdcd53cf4e6 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 @@ -1861,7 +1861,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 bc3bf7c6681a96bc18a1ed02f0ccced4731d5dab45f60c347dd1841706e6b62a -R a1bd7af663ac8f68011b39c502abe2a2 +P 57b16d8ca3d1ede3b411389256bec6686433aae716f47bca309ee7c8e5fe3128 +R cae58a18aebbf7b95fb40ba841d77f19 U drh -Z dcff85cc0c5396a3824fe3ae621cc10a +Z a013006b51e7e5f259533e9a3800742b diff --git a/manifest.uuid b/manifest.uuid index d57e584616..b3a75f3c82 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -57b16d8ca3d1ede3b411389256bec6686433aae716f47bca309ee7c8e5fe3128 \ No newline at end of file +b73d9a7d6f7fec0ffc9640902a849289c305f8651e891388c01255c4da7a6c4b \ No newline at end of file diff --git a/src/loadext.c b/src/loadext.c index 8dc632df85..067c47c17f 100644 --- a/src/loadext.c +++ b/src/loadext.c @@ -480,6 +480,14 @@ static const sqlite3_api_routines sqlite3Apis = { sqlite3_database_file_object, }; +/* True if x is the directory separator character +*/ +#if SQLITE_OS_WIN +# define DirSep(X) ((X)=='/'||(X)=='\\') +#else +# define DirSep(X) ((X)=='/') +#endif + /* ** Attempt to load an SQLite extension library contained in the file ** zFile. The entry point is zProc. zProc may be 0 in which case a @@ -581,11 +589,7 @@ static int sqlite3LoadExtension( return SQLITE_NOMEM_BKPT; } memcpy(zAltEntry, "sqlite3_", 8); -#if SQLITE_OS_WIN - for(iFile=ncFile-1; iFile>=0 && ((c=zFile[iFile]!='/')&&c!='\\'); iFile--){} -#else - for(iFile=ncFile-1; iFile>=0 && zFile[iFile]!='/'; iFile--){} -#endif + for(iFile=ncFile-1; iFile>=0 && !DirSep(zFile[iFile]); iFile--){} iFile++; if( sqlite3_strnicmp(zFile+iFile, "lib", 3)==0 ) iFile += 3; for(iEntry=8; (c = zFile[iFile])!=0 && c!='.'; iFile++){