This repository was archived by the owner on Dec 21, 2024. It is now read-only.

Commit 68c69d8

Browse files
committed
Applied Android changes to 3.40.1
1 parent 8af748f commit 68c69d8

3 files changed

Lines changed: 76 additions & 19 deletions

File tree

‎dist/Android.patch‎

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
--- orig/shell.c 2022-09-01 12:39:01.340032408 +0100
2-
+++ shell.c 2022-09-01 12:39:01.528030292 +0100
3-
@@ -107,6 +107,11 @@
1+
diff --git a/dist/shell.c b/dist/shell.c
2+
index 63f708c..5afd4a9 100644
3+
--- a/dist/shell.c
4+
+++ b/dist/shell.c
5+
@@ -126,6 +126,11 @@ typedef unsigned char u8;
46
#endif
57
#include <ctype.h>
68
#include <stdarg.h>
@@ -12,7 +14,7 @@
1214

1315
#if !defined(_WIN32) && !defined(WIN32)
1416
# include <signal.h>
15-
@@ -16177,6 +16182,22 @@
17+
@@ -19561,6 +19566,22 @@ static void open_db(ShellState *p, int openFlags){
1618
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1719
editFunc, 0, 0);
1820
#endif
@@ -35,9 +37,11 @@
3537
if( p->openMode==SHELL_OPEN_ZIPFILE ){
3638
char *zSql = sqlite3_mprintf(
3739
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);
38-
--- orig/sqlite3.c 2022-09-01 12:39:01.356032228 +0100
39-
+++ sqlite3.c 2022-09-01 12:39:15.955867966 +0100
40-
@@ -35608,6 +35608,10 @@
40+
diff --git a/dist/sqlite3.c b/dist/sqlite3.c
41+
index a290c82..a0e1ec3 100644
42+
--- a/dist/sqlite3.c
43+
+++ b/dist/sqlite3.c
44+
@@ -36808,6 +36808,10 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
4145
# include <sys/mount.h>
4246
#endif
4347

@@ -48,7 +52,7 @@
4852
#ifdef HAVE_UTIME
4953
# include <utime.h>
5054
#endif
51-
@@ -36170,6 +36174,12 @@
55+
@@ -37373,6 +37377,12 @@ static int robust_open(const char *z, int f, mode_t m){
5256
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
5357
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
5458
#endif
@@ -61,7 +65,7 @@
6165
}
6266
return fd;
6367
}
64-
@@ -36750,7 +36760,13 @@
68+
@@ -37953,7 +37963,13 @@ static int unixLogErrorAtLine(
6569
** and move on.
6670
*/
6771
static void robust_close(unixFile *pFile, int h, int lineno){
@@ -75,7 +79,7 @@
7579
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
7680
pFile ? pFile->zPath : 0, lineno);
7781
}
78-
@@ -39305,7 +39321,7 @@
82+
@@ -40508,7 +40524,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
7983
SimulateIOError( rc=1 );
8084
if( rc!=0 ){
8185
storeLastErrno((unixFile*)id, errno);
@@ -84,7 +88,7 @@
8488
}
8589
*pSize = buf.st_size;
8690

87-
@@ -39341,7 +39357,7 @@
91+
@@ -40544,7 +40560,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
8892
struct stat buf; /* Used to hold return values of fstat() */
8993

9094
if( osFstat(pFile->h, &buf) ){
@@ -93,7 +97,7 @@
9397
}
9498

9599
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
96-
@@ -40083,7 +40099,7 @@
100+
@@ -41286,7 +41302,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
97101
** with the same permissions.
98102
*/
99103
if( osFstat(pDbFd->h, &sStat) ){
@@ -102,7 +106,7 @@
102106
goto shm_open_err;
103107
}
104108

105-
@@ -134802,7 +134818,7 @@
109+
@@ -136618,7 +136634,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
106110
}
107111
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
108112
sqlite3SetString(pzErrMsg, db, "unsupported file format");
@@ -111,7 +115,7 @@
111115
goto initone_error_out;
112116
}
113117

114-
@@ -180855,7 +180871,9 @@
118+
@@ -182768,7 +182784,9 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
115119
** module with sqlite.
116120
*/
117121
if( SQLITE_OK==rc
@@ -121,7 +125,7 @@
121125
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
122126
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
123127
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
124-
@@ -180866,6 +180884,20 @@
128+
@@ -182779,6 +182797,20 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
125129
rc = sqlite3_create_module_v2(
126130
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
127131
);

‎dist/shell.c‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ typedef unsigned char u8;
126126
#endif
127127
#include <ctype.h>
128128
#include <stdarg.h>
129+
// Begin Android Add
130+
#ifndef NO_ANDROID_FUNCS
131+
#include <sqlite3_android.h>
132+
#endif
133+
// End Android Add
129134

130135
#if !defined(_WIN32) && !defined(WIN32)
131136
# include <signal.h>
@@ -19561,6 +19566,22 @@ static void open_db(ShellState *p, int openFlags){
1956119566
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1956219567
editFunc, 0, 0);
1956319568
#endif
19569+
19570+
// Begin Android Add
19571+
#ifndef NO_ANDROID_FUNCS
19572+
int err = register_localized_collators(p->db, "en_US", 0);
19573+
if (err != SQLITE_OK) {
19574+
fprintf(stderr, "register_localized_collators() failed\n");
19575+
exit(1);
19576+
}
19577+
err = register_android_functions(p->db, 0);
19578+
if (err != SQLITE_OK) {
19579+
fprintf(stderr, "register_android_functions() failed\n");
19580+
exit(1);
19581+
}
19582+
#endif
19583+
// End Android Add
19584+
1956419585
if( p->openMode==SHELL_OPEN_ZIPFILE ){
1956519586
char *zSql = sqlite3_mprintf(
1956619587
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);

‎dist/sqlite3.c‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36808,6 +36808,10 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
3680836808
# include <sys/mount.h>
3680936809
#endif
3681036810

36811+
#if defined(__BIONIC__)
36812+
# include <android/fdsan.h>
36813+
#endif
36814+
3681136815
#ifdef HAVE_UTIME
3681236816
# include <utime.h>
3681336817
#endif
@@ -37373,6 +37377,12 @@ static int robust_open(const char *z, int f, mode_t m){
3737337377
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
3737437378
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
3737537379
#endif
37380+
37381+
#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__
37382+
uint64_t tag = android_fdsan_create_owner_tag(
37383+
ANDROID_FDSAN_OWNER_TYPE_SQLITE, fd);
37384+
android_fdsan_exchange_owner_tag(fd, 0, tag);
37385+
#endif
3737637386
}
3737737387
return fd;
3737837388
}
@@ -37953,7 +37963,13 @@ static int unixLogErrorAtLine(
3795337963
** and move on.
3795437964
*/
3795537965
static void robust_close(unixFile *pFile, int h, int lineno){
37966+
#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__
37967+
uint64_t tag = android_fdsan_create_owner_tag(
37968+
ANDROID_FDSAN_OWNER_TYPE_SQLITE, h);
37969+
if( android_fdsan_close_with_tag(h, tag) ){
37970+
#else
3795637971
if( osClose(h) ){
37972+
#endif
3795737973
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
3795837974
pFile ? pFile->zPath : 0, lineno);
3795937975
}
@@ -40508,7 +40524,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
4050840524
SimulateIOError( rc=1 );
4050940525
if( rc!=0 ){
4051040526
storeLastErrno((unixFile*)id, errno);
40511-
return SQLITE_IOERR_FSTAT;
40527+
return unixLogError(SQLITE_IOERR_FSTAT, "fstat", ((unixFile*)id)->zPath);
4051240528
}
4051340529
*pSize = buf.st_size;
4051440530

@@ -40544,7 +40560,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
4054440560
struct stat buf; /* Used to hold return values of fstat() */
4054540561

4054640562
if( osFstat(pFile->h, &buf) ){
40547-
return SQLITE_IOERR_FSTAT;
40563+
return unixLogError(SQLITE_IOERR_FSTAT, "fstat", pFile->zPath);
4054840564
}
4054940565

4055040566
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
@@ -41286,7 +41302,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
4128641302
** with the same permissions.
4128741303
*/
4128841304
if( osFstat(pDbFd->h, &sStat) ){
41289-
rc = SQLITE_IOERR_FSTAT;
41305+
rc = unixLogError(SQLITE_IOERR_FSTAT, "fstat", pDbFd->zPath);
4129041306
goto shm_open_err;
4129141307
}
4129241308

@@ -136618,7 +136634,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
136618136634
}
136619136635
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
136620136636
sqlite3SetString(pzErrMsg, db, "unsupported file format");
136621-
rc = SQLITE_ERROR;
136637+
rc = SQLITE_CORRUPT_BKPT; // Android Change from "rc = SQLITE_ERROR;";
136622136638
goto initone_error_out;
136623136639
}
136624136640

@@ -182768,7 +182784,9 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
182768182784
** module with sqlite.
182769182785
*/
182770182786
if( SQLITE_OK==rc
182787+
#ifndef ANDROID /* fts3_tokenizer disabled for security reasons */
182771182788
&& SQLITE_OK==(rc=sqlite3Fts3InitHashTable(db,&pHash->hash,"fts3_tokenizer"))
182789+
#endif
182772182790
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
182773182791
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
182774182792
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
@@ -182779,6 +182797,20 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
182779182797
rc = sqlite3_create_module_v2(
182780182798
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
182781182799
);
182800+
#ifdef SQLITE_ENABLE_FTS3_BACKWARDS
182801+
if( rc==SQLITE_OK ){
182802+
pHash->nRef++;
182803+
rc = sqlite3_create_module_v2(
182804+
db, "fts1", &fts3Module, (void *)pHash, hashDestroy
182805+
);
182806+
}
182807+
if( rc==SQLITE_OK ){
182808+
pHash->nRef++;
182809+
rc = sqlite3_create_module_v2(
182810+
db, "fts2", &fts3Module, (void *)pHash, hashDestroy
182811+
);
182812+
}
182813+
#endif
182782182814
if( rc==SQLITE_OK ){
182783182815
pHash->nRef++;
182784182816
rc = sqlite3_create_module_v2(

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
This repository was archived by the owner on Dec 21, 2024. It is now read-only.

Commit 68c69d8

Browse files
committed
Applied Android changes to 3.40.1
1 parent 8af748f commit 68c69d8

3 files changed

Lines changed: 76 additions & 19 deletions

File tree

‎dist/Android.patch‎

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
--- orig/shell.c 2022-09-01 12:39:01.340032408 +0100
2-
+++ shell.c 2022-09-01 12:39:01.528030292 +0100
3-
@@ -107,6 +107,11 @@
1+
diff --git a/dist/shell.c b/dist/shell.c
2+
index 63f708c..5afd4a9 100644
3+
--- a/dist/shell.c
4+
+++ b/dist/shell.c
5+
@@ -126,6 +126,11 @@ typedef unsigned char u8;
46
#endif
57
#include <ctype.h>
68
#include <stdarg.h>
@@ -12,7 +14,7 @@
1214

1315
#if !defined(_WIN32) && !defined(WIN32)
1416
# include <signal.h>
15-
@@ -16177,6 +16182,22 @@
17+
@@ -19561,6 +19566,22 @@ static void open_db(ShellState *p, int openFlags){
1618
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1719
editFunc, 0, 0);
1820
#endif
@@ -35,9 +37,11 @@
3537
if( p->openMode==SHELL_OPEN_ZIPFILE ){
3638
char *zSql = sqlite3_mprintf(
3739
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);
38-
--- orig/sqlite3.c 2022-09-01 12:39:01.356032228 +0100
39-
+++ sqlite3.c 2022-09-01 12:39:15.955867966 +0100
40-
@@ -35608,6 +35608,10 @@
40+
diff --git a/dist/sqlite3.c b/dist/sqlite3.c
41+
index a290c82..a0e1ec3 100644
42+
--- a/dist/sqlite3.c
43+
+++ b/dist/sqlite3.c
44+
@@ -36808,6 +36808,10 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
4145
# include <sys/mount.h>
4246
#endif
4347

@@ -48,7 +52,7 @@
4852
#ifdef HAVE_UTIME
4953
# include <utime.h>
5054
#endif
51-
@@ -36170,6 +36174,12 @@
55+
@@ -37373,6 +37377,12 @@ static int robust_open(const char *z, int f, mode_t m){
5256
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
5357
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
5458
#endif
@@ -61,7 +65,7 @@
6165
}
6266
return fd;
6367
}
64-
@@ -36750,7 +36760,13 @@
68+
@@ -37953,7 +37963,13 @@ static int unixLogErrorAtLine(
6569
** and move on.
6670
*/
6771
static void robust_close(unixFile *pFile, int h, int lineno){
@@ -75,7 +79,7 @@
7579
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
7680
pFile ? pFile->zPath : 0, lineno);
7781
}
78-
@@ -39305,7 +39321,7 @@
82+
@@ -40508,7 +40524,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
7983
SimulateIOError( rc=1 );
8084
if( rc!=0 ){
8185
storeLastErrno((unixFile*)id, errno);
@@ -84,7 +88,7 @@
8488
}
8589
*pSize = buf.st_size;
8690

87-
@@ -39341,7 +39357,7 @@
91+
@@ -40544,7 +40560,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
8892
struct stat buf; /* Used to hold return values of fstat() */
8993

9094
if( osFstat(pFile->h, &buf) ){
@@ -93,7 +97,7 @@
9397
}
9498

9599
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
96-
@@ -40083,7 +40099,7 @@
100+
@@ -41286,7 +41302,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
97101
** with the same permissions.
98102
*/
99103
if( osFstat(pDbFd->h, &sStat) ){
@@ -102,7 +106,7 @@
102106
goto shm_open_err;
103107
}
104108

105-
@@ -134802,7 +134818,7 @@
109+
@@ -136618,7 +136634,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
106110
}
107111
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
108112
sqlite3SetString(pzErrMsg, db, "unsupported file format");
@@ -111,7 +115,7 @@
111115
goto initone_error_out;
112116
}
113117

114-
@@ -180855,7 +180871,9 @@
118+
@@ -182768,7 +182784,9 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
115119
** module with sqlite.
116120
*/
117121
if( SQLITE_OK==rc
@@ -121,7 +125,7 @@
121125
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
122126
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
123127
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
124-
@@ -180866,6 +180884,20 @@
128+
@@ -182779,6 +182797,20 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
125129
rc = sqlite3_create_module_v2(
126130
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
127131
);

‎dist/shell.c‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ typedef unsigned char u8;
126126
#endif
127127
#include <ctype.h>
128128
#include <stdarg.h>
129+
// Begin Android Add
130+
#ifndef NO_ANDROID_FUNCS
131+
#include <sqlite3_android.h>
132+
#endif
133+
// End Android Add
129134

130135
#if !defined(_WIN32) && !defined(WIN32)
131136
# include <signal.h>
@@ -19561,6 +19566,22 @@ static void open_db(ShellState *p, int openFlags){
1956119566
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1956219567
editFunc, 0, 0);
1956319568
#endif
19569+
19570+
// Begin Android Add
19571+
#ifndef NO_ANDROID_FUNCS
19572+
int err = register_localized_collators(p->db, "en_US", 0);
19573+
if (err != SQLITE_OK) {
19574+
fprintf(stderr, "register_localized_collators() failed\n");
19575+
exit(1);
19576+
}
19577+
err = register_android_functions(p->db, 0);
19578+
if (err != SQLITE_OK) {
19579+
fprintf(stderr, "register_android_functions() failed\n");
19580+
exit(1);
19581+
}
19582+
#endif
19583+
// End Android Add
19584+
1956419585
if( p->openMode==SHELL_OPEN_ZIPFILE ){
1956519586
char *zSql = sqlite3_mprintf(
1956619587
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);

‎dist/sqlite3.c‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36808,6 +36808,10 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
3680836808
# include <sys/mount.h>
3680936809
#endif
3681036810

36811+
#if defined(__BIONIC__)
36812+
# include <android/fdsan.h>
36813+
#endif
36814+
3681136815
#ifdef HAVE_UTIME
3681236816
# include <utime.h>
3681336817
#endif
@@ -37373,6 +37377,12 @@ static int robust_open(const char *z, int f, mode_t m){
3737337377
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
3737437378
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
3737537379
#endif
37380+
37381+
#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__
37382+
uint64_t tag = android_fdsan_create_owner_tag(
37383+
ANDROID_FDSAN_OWNER_TYPE_SQLITE, fd);
37384+
android_fdsan_exchange_owner_tag(fd, 0, tag);
37385+
#endif
3737637386
}
3737737387
return fd;
3737837388
}
@@ -37953,7 +37963,13 @@ static int unixLogErrorAtLine(
3795337963
** and move on.
3795437964
*/
3795537965
static void robust_close(unixFile *pFile, int h, int lineno){
37966+
#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__
37967+
uint64_t tag = android_fdsan_create_owner_tag(
37968+
ANDROID_FDSAN_OWNER_TYPE_SQLITE, h);
37969+
if( android_fdsan_close_with_tag(h, tag) ){
37970+
#else
3795637971
if( osClose(h) ){
37972+
#endif
3795737973
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
3795837974
pFile ? pFile->zPath : 0, lineno);
3795937975
}
@@ -40508,7 +40524,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
4050840524
SimulateIOError( rc=1 );
4050940525
if( rc!=0 ){
4051040526
storeLastErrno((unixFile*)id, errno);
40511-
return SQLITE_IOERR_FSTAT;
40527+
return unixLogError(SQLITE_IOERR_FSTAT, "fstat", ((unixFile*)id)->zPath);
4051240528
}
4051340529
*pSize = buf.st_size;
4051440530

@@ -40544,7 +40560,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
4054440560
struct stat buf; /* Used to hold return values of fstat() */
4054540561

4054640562
if( osFstat(pFile->h, &buf) ){
40547-
return SQLITE_IOERR_FSTAT;
40563+
return unixLogError(SQLITE_IOERR_FSTAT, "fstat", pFile->zPath);
4054840564
}
4054940565

4055040566
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
@@ -41286,7 +41302,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
4128641302
** with the same permissions.
4128741303
*/
4128841304
if( osFstat(pDbFd->h, &sStat) ){
41289-
rc = SQLITE_IOERR_FSTAT;
41305+
rc = unixLogError(SQLITE_IOERR_FSTAT, "fstat", pDbFd->zPath);
4129041306
goto shm_open_err;
4129141307
}
4129241308

@@ -136618,7 +136634,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
136618136634
}
136619136635
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
136620136636
sqlite3SetString(pzErrMsg, db, "unsupported file format");
136621-
rc = SQLITE_ERROR;
136637+
rc = SQLITE_CORRUPT_BKPT; // Android Change from "rc = SQLITE_ERROR;";
136622136638
goto initone_error_out;
136623136639
}
136624136640

@@ -182768,7 +182784,9 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
182768182784
** module with sqlite.
182769182785
*/
182770182786
if( SQLITE_OK==rc
182787+
#ifndef ANDROID /* fts3_tokenizer disabled for security reasons */
182771182788
&& SQLITE_OK==(rc=sqlite3Fts3InitHashTable(db,&pHash->hash,"fts3_tokenizer"))
182789+
#endif
182772182790
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
182773182791
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
182774182792
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
@@ -182779,6 +182797,20 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
182779182797
rc = sqlite3_create_module_v2(
182780182798
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
182781182799
);
182800+
#ifdef SQLITE_ENABLE_FTS3_BACKWARDS
182801+
if( rc==SQLITE_OK ){
182802+
pHash->nRef++;
182803+
rc = sqlite3_create_module_v2(
182804+
db, "fts1", &fts3Module, (void *)pHash, hashDestroy
182805+
);
182806+
}
182807+
if( rc==SQLITE_OK ){
182808+
pHash->nRef++;
182809+
rc = sqlite3_create_module_v2(
182810+
db, "fts2", &fts3Module, (void *)pHash, hashDestroy
182811+
);
182812+
}
182813+
#endif
182782182814
if( rc==SQLITE_OK ){
182783182815
pHash->nRef++;
182784182816
rc = sqlite3_create_module_v2(

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
This repository was archived by the owner on Dec 21, 2024. It is now read-only.

Commit 68c69d8

Browse files
committed
Applied Android changes to 3.40.1
1 parent 8af748f commit 68c69d8

3 files changed

Lines changed: 76 additions & 19 deletions

File tree

‎dist/Android.patch‎

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
--- orig/shell.c 2022-09-01 12:39:01.340032408 +0100
2-
+++ shell.c 2022-09-01 12:39:01.528030292 +0100
3-
@@ -107,6 +107,11 @@
1+
diff --git a/dist/shell.c b/dist/shell.c
2+
index 63f708c..5afd4a9 100644
3+
--- a/dist/shell.c
4+
+++ b/dist/shell.c
5+
@@ -126,6 +126,11 @@ typedef unsigned char u8;
46
#endif
57
#include <ctype.h>
68
#include <stdarg.h>
@@ -12,7 +14,7 @@
1214

1315
#if !defined(_WIN32) && !defined(WIN32)
1416
# include <signal.h>
15-
@@ -16177,6 +16182,22 @@
17+
@@ -19561,6 +19566,22 @@ static void open_db(ShellState *p, int openFlags){
1618
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1719
editFunc, 0, 0);
1820
#endif
@@ -35,9 +37,11 @@
3537
if( p->openMode==SHELL_OPEN_ZIPFILE ){
3638
char *zSql = sqlite3_mprintf(
3739
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);
38-
--- orig/sqlite3.c 2022-09-01 12:39:01.356032228 +0100
39-
+++ sqlite3.c 2022-09-01 12:39:15.955867966 +0100
40-
@@ -35608,6 +35608,10 @@
40+
diff --git a/dist/sqlite3.c b/dist/sqlite3.c
41+
index a290c82..a0e1ec3 100644
42+
--- a/dist/sqlite3.c
43+
+++ b/dist/sqlite3.c
44+
@@ -36808,6 +36808,10 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
4145
# include <sys/mount.h>
4246
#endif
4347

@@ -48,7 +52,7 @@
4852
#ifdef HAVE_UTIME
4953
# include <utime.h>
5054
#endif
51-
@@ -36170,6 +36174,12 @@
55+
@@ -37373,6 +37377,12 @@ static int robust_open(const char *z, int f, mode_t m){
5256
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
5357
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
5458
#endif
@@ -61,7 +65,7 @@
6165
}
6266
return fd;
6367
}
64-
@@ -36750,7 +36760,13 @@
68+
@@ -37953,7 +37963,13 @@ static int unixLogErrorAtLine(
6569
** and move on.
6670
*/
6771
static void robust_close(unixFile *pFile, int h, int lineno){
@@ -75,7 +79,7 @@
7579
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
7680
pFile ? pFile->zPath : 0, lineno);
7781
}
78-
@@ -39305,7 +39321,7 @@
82+
@@ -40508,7 +40524,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
7983
SimulateIOError( rc=1 );
8084
if( rc!=0 ){
8185
storeLastErrno((unixFile*)id, errno);
@@ -84,7 +88,7 @@
8488
}
8589
*pSize = buf.st_size;
8690

87-
@@ -39341,7 +39357,7 @@
91+
@@ -40544,7 +40560,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
8892
struct stat buf; /* Used to hold return values of fstat() */
8993

9094
if( osFstat(pFile->h, &buf) ){
@@ -93,7 +97,7 @@
9397
}
9498

9599
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
96-
@@ -40083,7 +40099,7 @@
100+
@@ -41286,7 +41302,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
97101
** with the same permissions.
98102
*/
99103
if( osFstat(pDbFd->h, &sStat) ){
@@ -102,7 +106,7 @@
102106
goto shm_open_err;
103107
}
104108

105-
@@ -134802,7 +134818,7 @@
109+
@@ -136618,7 +136634,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
106110
}
107111
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
108112
sqlite3SetString(pzErrMsg, db, "unsupported file format");
@@ -111,7 +115,7 @@
111115
goto initone_error_out;
112116
}
113117

114-
@@ -180855,7 +180871,9 @@
118+
@@ -182768,7 +182784,9 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
115119
** module with sqlite.
116120
*/
117121
if( SQLITE_OK==rc
@@ -121,7 +125,7 @@
121125
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
122126
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
123127
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
124-
@@ -180866,6 +180884,20 @@
128+
@@ -182779,6 +182797,20 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
125129
rc = sqlite3_create_module_v2(
126130
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
127131
);

‎dist/shell.c‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ typedef unsigned char u8;
126126
#endif
127127
#include <ctype.h>
128128
#include <stdarg.h>
129+
// Begin Android Add
130+
#ifndef NO_ANDROID_FUNCS
131+
#include <sqlite3_android.h>
132+
#endif
133+
// End Android Add
129134

130135
#if !defined(_WIN32) && !defined(WIN32)
131136
# include <signal.h>
@@ -19561,6 +19566,22 @@ static void open_db(ShellState *p, int openFlags){
1956119566
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1956219567
editFunc, 0, 0);
1956319568
#endif
19569+
19570+
// Begin Android Add
19571+
#ifndef NO_ANDROID_FUNCS
19572+
int err = register_localized_collators(p->db, "en_US", 0);
19573+
if (err != SQLITE_OK) {
19574+
fprintf(stderr, "register_localized_collators() failed\n");
19575+
exit(1);
19576+
}
19577+
err = register_android_functions(p->db, 0);
19578+
if (err != SQLITE_OK) {
19579+
fprintf(stderr, "register_android_functions() failed\n");
19580+
exit(1);
19581+
}
19582+
#endif
19583+
// End Android Add
19584+
1956419585
if( p->openMode==SHELL_OPEN_ZIPFILE ){
1956519586
char *zSql = sqlite3_mprintf(
1956619587
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);

‎dist/sqlite3.c‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36808,6 +36808,10 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
3680836808
# include <sys/mount.h>
3680936809
#endif
3681036810

36811+
#if defined(__BIONIC__)
36812+
# include <android/fdsan.h>
36813+
#endif
36814+
3681136815
#ifdef HAVE_UTIME
3681236816
# include <utime.h>
3681336817
#endif
@@ -37373,6 +37377,12 @@ static int robust_open(const char *z, int f, mode_t m){
3737337377
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
3737437378
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
3737537379
#endif
37380+
37381+
#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__
37382+
uint64_t tag = android_fdsan_create_owner_tag(
37383+
ANDROID_FDSAN_OWNER_TYPE_SQLITE, fd);
37384+
android_fdsan_exchange_owner_tag(fd, 0, tag);
37385+
#endif
3737637386
}
3737737387
return fd;
3737837388
}
@@ -37953,7 +37963,13 @@ static int unixLogErrorAtLine(
3795337963
** and move on.
3795437964
*/
3795537965
static void robust_close(unixFile *pFile, int h, int lineno){
37966+
#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__
37967+
uint64_t tag = android_fdsan_create_owner_tag(
37968+
ANDROID_FDSAN_OWNER_TYPE_SQLITE, h);
37969+
if( android_fdsan_close_with_tag(h, tag) ){
37970+
#else
3795637971
if( osClose(h) ){
37972+
#endif
3795737973
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
3795837974
pFile ? pFile->zPath : 0, lineno);
3795937975
}
@@ -40508,7 +40524,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
4050840524
SimulateIOError( rc=1 );
4050940525
if( rc!=0 ){
4051040526
storeLastErrno((unixFile*)id, errno);
40511-
return SQLITE_IOERR_FSTAT;
40527+
return unixLogError(SQLITE_IOERR_FSTAT, "fstat", ((unixFile*)id)->zPath);
4051240528
}
4051340529
*pSize = buf.st_size;
4051440530

@@ -40544,7 +40560,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
4054440560
struct stat buf; /* Used to hold return values of fstat() */
4054540561

4054640562
if( osFstat(pFile->h, &buf) ){
40547-
return SQLITE_IOERR_FSTAT;
40563+
return unixLogError(SQLITE_IOERR_FSTAT, "fstat", pFile->zPath);
4054840564
}
4054940565

4055040566
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
@@ -41286,7 +41302,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
4128641302
** with the same permissions.
4128741303
*/
4128841304
if( osFstat(pDbFd->h, &sStat) ){
41289-
rc = SQLITE_IOERR_FSTAT;
41305+
rc = unixLogError(SQLITE_IOERR_FSTAT, "fstat", pDbFd->zPath);
4129041306
goto shm_open_err;
4129141307
}
4129241308

@@ -136618,7 +136634,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
136618136634
}
136619136635
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
136620136636
sqlite3SetString(pzErrMsg, db, "unsupported file format");
136621-
rc = SQLITE_ERROR;
136637+
rc = SQLITE_CORRUPT_BKPT; // Android Change from "rc = SQLITE_ERROR;";
136622136638
goto initone_error_out;
136623136639
}
136624136640

@@ -182768,7 +182784,9 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
182768182784
** module with sqlite.
182769182785
*/
182770182786
if( SQLITE_OK==rc
182787+
#ifndef ANDROID /* fts3_tokenizer disabled for security reasons */
182771182788
&& SQLITE_OK==(rc=sqlite3Fts3InitHashTable(db,&pHash->hash,"fts3_tokenizer"))
182789+
#endif
182772182790
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
182773182791
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
182774182792
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
@@ -182779,6 +182797,20 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
182779182797
rc = sqlite3_create_module_v2(
182780182798
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
182781182799
);
182800+
#ifdef SQLITE_ENABLE_FTS3_BACKWARDS
182801+
if( rc==SQLITE_OK ){
182802+
pHash->nRef++;
182803+
rc = sqlite3_create_module_v2(
182804+
db, "fts1", &fts3Module, (void *)pHash, hashDestroy
182805+
);
182806+
}
182807+
if( rc==SQLITE_OK ){
182808+
pHash->nRef++;
182809+
rc = sqlite3_create_module_v2(
182810+
db, "fts2", &fts3Module, (void *)pHash, hashDestroy
182811+
);
182812+
}
182813+
#endif
182782182814
if( rc==SQLITE_OK ){
182783182815
pHash->nRef++;
182784182816
rc = sqlite3_create_module_v2(

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
This repository was archived by the owner on Dec 21, 2024. It is now read-only.

Commit 68c69d8

Browse files
committed
Applied Android changes to 3.40.1
1 parent 8af748f commit 68c69d8

3 files changed

Lines changed: 76 additions & 19 deletions

File tree

‎dist/Android.patch‎

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
--- orig/shell.c 2022-09-01 12:39:01.340032408 +0100
2-
+++ shell.c 2022-09-01 12:39:01.528030292 +0100
3-
@@ -107,6 +107,11 @@
1+
diff --git a/dist/shell.c b/dist/shell.c
2+
index 63f708c..5afd4a9 100644
3+
--- a/dist/shell.c
4+
+++ b/dist/shell.c
5+
@@ -126,6 +126,11 @@ typedef unsigned char u8;
46
#endif
57
#include <ctype.h>
68
#include <stdarg.h>
@@ -12,7 +14,7 @@
1214

1315
#if !defined(_WIN32) && !defined(WIN32)
1416
# include <signal.h>
15-
@@ -16177,6 +16182,22 @@
17+
@@ -19561,6 +19566,22 @@ static void open_db(ShellState *p, int openFlags){
1618
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1719
editFunc, 0, 0);
1820
#endif
@@ -35,9 +37,11 @@
3537
if( p->openMode==SHELL_OPEN_ZIPFILE ){
3638
char *zSql = sqlite3_mprintf(
3739
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);
38-
--- orig/sqlite3.c 2022-09-01 12:39:01.356032228 +0100
39-
+++ sqlite3.c 2022-09-01 12:39:15.955867966 +0100
40-
@@ -35608,6 +35608,10 @@
40+
diff --git a/dist/sqlite3.c b/dist/sqlite3.c
41+
index a290c82..a0e1ec3 100644
42+
--- a/dist/sqlite3.c
43+
+++ b/dist/sqlite3.c
44+
@@ -36808,6 +36808,10 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
4145
# include <sys/mount.h>
4246
#endif
4347

@@ -48,7 +52,7 @@
4852
#ifdef HAVE_UTIME
4953
# include <utime.h>
5054
#endif
51-
@@ -36170,6 +36174,12 @@
55+
@@ -37373,6 +37377,12 @@ static int robust_open(const char *z, int f, mode_t m){
5256
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
5357
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
5458
#endif
@@ -61,7 +65,7 @@
6165
}
6266
return fd;
6367
}
64-
@@ -36750,7 +36760,13 @@
68+
@@ -37953,7 +37963,13 @@ static int unixLogErrorAtLine(
6569
** and move on.
6670
*/
6771
static void robust_close(unixFile *pFile, int h, int lineno){
@@ -75,7 +79,7 @@
7579
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
7680
pFile ? pFile->zPath : 0, lineno);
7781
}
78-
@@ -39305,7 +39321,7 @@
82+
@@ -40508,7 +40524,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
7983
SimulateIOError( rc=1 );
8084
if( rc!=0 ){
8185
storeLastErrno((unixFile*)id, errno);
@@ -84,7 +88,7 @@
8488
}
8589
*pSize = buf.st_size;
8690

87-
@@ -39341,7 +39357,7 @@
91+
@@ -40544,7 +40560,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
8892
struct stat buf; /* Used to hold return values of fstat() */
8993

9094
if( osFstat(pFile->h, &buf) ){
@@ -93,7 +97,7 @@
9397
}
9498

9599
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
96-
@@ -40083,7 +40099,7 @@
100+
@@ -41286,7 +41302,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
97101
** with the same permissions.
98102
*/
99103
if( osFstat(pDbFd->h, &sStat) ){
@@ -102,7 +106,7 @@
102106
goto shm_open_err;
103107
}
104108

105-
@@ -134802,7 +134818,7 @@
109+
@@ -136618,7 +136634,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
106110
}
107111
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
108112
sqlite3SetString(pzErrMsg, db, "unsupported file format");
@@ -111,7 +115,7 @@
111115
goto initone_error_out;
112116
}
113117

114-
@@ -180855,7 +180871,9 @@
118+
@@ -182768,7 +182784,9 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
115119
** module with sqlite.
116120
*/
117121
if( SQLITE_OK==rc
@@ -121,7 +125,7 @@
121125
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
122126
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
123127
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
124-
@@ -180866,6 +180884,20 @@
128+
@@ -182779,6 +182797,20 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
125129
rc = sqlite3_create_module_v2(
126130
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
127131
);

‎dist/shell.c‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ typedef unsigned char u8;
126126
#endif
127127
#include <ctype.h>
128128
#include <stdarg.h>
129+
// Begin Android Add
130+
#ifndef NO_ANDROID_FUNCS
131+
#include <sqlite3_android.h>
132+
#endif
133+
// End Android Add
129134

130135
#if !defined(_WIN32) && !defined(WIN32)
131136
# include <signal.h>
@@ -19561,6 +19566,22 @@ static void open_db(ShellState *p, int openFlags){
1956119566
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1956219567
editFunc, 0, 0);
1956319568
#endif
19569+
19570+
// Begin Android Add
19571+
#ifndef NO_ANDROID_FUNCS
19572+
int err = register_localized_collators(p->db, "en_US", 0);
19573+
if (err != SQLITE_OK) {
19574+
fprintf(stderr, "register_localized_collators() failed\n");
19575+
exit(1);
19576+
}
19577+
err = register_android_functions(p->db, 0);
19578+
if (err != SQLITE_OK) {
19579+
fprintf(stderr, "register_android_functions() failed\n");
19580+
exit(1);
19581+
}
19582+
#endif
19583+
// End Android Add
19584+
1956419585
if( p->openMode==SHELL_OPEN_ZIPFILE ){
1956519586
char *zSql = sqlite3_mprintf(
1956619587
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);

‎dist/sqlite3.c‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36808,6 +36808,10 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
3680836808
# include <sys/mount.h>
3680936809
#endif
3681036810

36811+
#if defined(__BIONIC__)
36812+
# include <android/fdsan.h>
36813+
#endif
36814+
3681136815
#ifdef HAVE_UTIME
3681236816
# include <utime.h>
3681336817
#endif
@@ -37373,6 +37377,12 @@ static int robust_open(const char *z, int f, mode_t m){
3737337377
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
3737437378
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
3737537379
#endif
37380+
37381+
#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__
37382+
uint64_t tag = android_fdsan_create_owner_tag(
37383+
ANDROID_FDSAN_OWNER_TYPE_SQLITE, fd);
37384+
android_fdsan_exchange_owner_tag(fd, 0, tag);
37385+
#endif
3737637386
}
3737737387
return fd;
3737837388
}
@@ -37953,7 +37963,13 @@ static int unixLogErrorAtLine(
3795337963
** and move on.
3795437964
*/
3795537965
static void robust_close(unixFile *pFile, int h, int lineno){
37966+
#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__
37967+
uint64_t tag = android_fdsan_create_owner_tag(
37968+
ANDROID_FDSAN_OWNER_TYPE_SQLITE, h);
37969+
if( android_fdsan_close_with_tag(h, tag) ){
37970+
#else
3795637971
if( osClose(h) ){
37972+
#endif
3795737973
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
3795837974
pFile ? pFile->zPath : 0, lineno);
3795937975
}
@@ -40508,7 +40524,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
4050840524
SimulateIOError( rc=1 );
4050940525
if( rc!=0 ){
4051040526
storeLastErrno((unixFile*)id, errno);
40511-
return SQLITE_IOERR_FSTAT;
40527+
return unixLogError(SQLITE_IOERR_FSTAT, "fstat", ((unixFile*)id)->zPath);
4051240528
}
4051340529
*pSize = buf.st_size;
4051440530

@@ -40544,7 +40560,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
4054440560
struct stat buf; /* Used to hold return values of fstat() */
4054540561

4054640562
if( osFstat(pFile->h, &buf) ){
40547-
return SQLITE_IOERR_FSTAT;
40563+
return unixLogError(SQLITE_IOERR_FSTAT, "fstat", pFile->zPath);
4054840564
}
4054940565

4055040566
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
@@ -41286,7 +41302,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
4128641302
** with the same permissions.
4128741303
*/
4128841304
if( osFstat(pDbFd->h, &sStat) ){
41289-
rc = SQLITE_IOERR_FSTAT;
41305+
rc = unixLogError(SQLITE_IOERR_FSTAT, "fstat", pDbFd->zPath);
4129041306
goto shm_open_err;
4129141307
}
4129241308

@@ -136618,7 +136634,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
136618136634
}
136619136635
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
136620136636
sqlite3SetString(pzErrMsg, db, "unsupported file format");
136621-
rc = SQLITE_ERROR;
136637+
rc = SQLITE_CORRUPT_BKPT; // Android Change from "rc = SQLITE_ERROR;";
136622136638
goto initone_error_out;
136623136639
}
136624136640

@@ -182768,7 +182784,9 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
182768182784
** module with sqlite.
182769182785
*/
182770182786
if( SQLITE_OK==rc
182787+
#ifndef ANDROID /* fts3_tokenizer disabled for security reasons */
182771182788
&& SQLITE_OK==(rc=sqlite3Fts3InitHashTable(db,&pHash->hash,"fts3_tokenizer"))
182789+
#endif
182772182790
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
182773182791
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
182774182792
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
@@ -182779,6 +182797,20 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
182779182797
rc = sqlite3_create_module_v2(
182780182798
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
182781182799
);
182800+
#ifdef SQLITE_ENABLE_FTS3_BACKWARDS
182801+
if( rc==SQLITE_OK ){
182802+
pHash->nRef++;
182803+
rc = sqlite3_create_module_v2(
182804+
db, "fts1", &fts3Module, (void *)pHash, hashDestroy
182805+
);
182806+
}
182807+
if( rc==SQLITE_OK ){
182808+
pHash->nRef++;
182809+
rc = sqlite3_create_module_v2(
182810+
db, "fts2", &fts3Module, (void *)pHash, hashDestroy
182811+
);
182812+
}
182813+
#endif
182782182814
if( rc==SQLITE_OK ){
182783182815
pHash->nRef++;
182784182816
rc = sqlite3_create_module_v2(

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
This repository was archived by the owner on Dec 21, 2024. It is now read-only.

Commit 68c69d8

Browse files
committed
Applied Android changes to 3.40.1
1 parent 8af748f commit 68c69d8

3 files changed

Lines changed: 76 additions & 19 deletions

File tree

‎dist/Android.patch‎

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
--- orig/shell.c 2022-09-01 12:39:01.340032408 +0100
2-
+++ shell.c 2022-09-01 12:39:01.528030292 +0100
3-
@@ -107,6 +107,11 @@
1+
diff --git a/dist/shell.c b/dist/shell.c
2+
index 63f708c..5afd4a9 100644
3+
--- a/dist/shell.c
4+
+++ b/dist/shell.c
5+
@@ -126,6 +126,11 @@ typedef unsigned char u8;
46
#endif
57
#include <ctype.h>
68
#include <stdarg.h>
@@ -12,7 +14,7 @@
1214

1315
#if !defined(_WIN32) && !defined(WIN32)
1416
# include <signal.h>
15-
@@ -16177,6 +16182,22 @@
17+
@@ -19561,6 +19566,22 @@ static void open_db(ShellState *p, int openFlags){
1618
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1719
editFunc, 0, 0);
1820
#endif
@@ -35,9 +37,11 @@
3537
if( p->openMode==SHELL_OPEN_ZIPFILE ){
3638
char *zSql = sqlite3_mprintf(
3739
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);
38-
--- orig/sqlite3.c 2022-09-01 12:39:01.356032228 +0100
39-
+++ sqlite3.c 2022-09-01 12:39:15.955867966 +0100
40-
@@ -35608,6 +35608,10 @@
40+
diff --git a/dist/sqlite3.c b/dist/sqlite3.c
41+
index a290c82..a0e1ec3 100644
42+
--- a/dist/sqlite3.c
43+
+++ b/dist/sqlite3.c
44+
@@ -36808,6 +36808,10 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
4145
# include <sys/mount.h>
4246
#endif
4347

@@ -48,7 +52,7 @@
4852
#ifdef HAVE_UTIME
4953
# include <utime.h>
5054
#endif
51-
@@ -36170,6 +36174,12 @@
55+
@@ -37373,6 +37377,12 @@ static int robust_open(const char *z, int f, mode_t m){
5256
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
5357
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
5458
#endif
@@ -61,7 +65,7 @@
6165
}
6266
return fd;
6367
}
64-
@@ -36750,7 +36760,13 @@
68+
@@ -37953,7 +37963,13 @@ static int unixLogErrorAtLine(
6569
** and move on.
6670
*/
6771
static void robust_close(unixFile *pFile, int h, int lineno){
@@ -75,7 +79,7 @@
7579
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
7680
pFile ? pFile->zPath : 0, lineno);
7781
}
78-
@@ -39305,7 +39321,7 @@
82+
@@ -40508,7 +40524,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
7983
SimulateIOError( rc=1 );
8084
if( rc!=0 ){
8185
storeLastErrno((unixFile*)id, errno);
@@ -84,7 +88,7 @@
8488
}
8589
*pSize = buf.st_size;
8690

87-
@@ -39341,7 +39357,7 @@
91+
@@ -40544,7 +40560,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
8892
struct stat buf; /* Used to hold return values of fstat() */
8993

9094
if( osFstat(pFile->h, &buf) ){
@@ -93,7 +97,7 @@
9397
}
9498

9599
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
96-
@@ -40083,7 +40099,7 @@
100+
@@ -41286,7 +41302,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
97101
** with the same permissions.
98102
*/
99103
if( osFstat(pDbFd->h, &sStat) ){
@@ -102,7 +106,7 @@
102106
goto shm_open_err;
103107
}
104108

105-
@@ -134802,7 +134818,7 @@
109+
@@ -136618,7 +136634,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
106110
}
107111
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
108112
sqlite3SetString(pzErrMsg, db, "unsupported file format");
@@ -111,7 +115,7 @@
111115
goto initone_error_out;
112116
}
113117

114-
@@ -180855,7 +180871,9 @@
118+
@@ -182768,7 +182784,9 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
115119
** module with sqlite.
116120
*/
117121
if( SQLITE_OK==rc
@@ -121,7 +125,7 @@
121125
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
122126
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
123127
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
124-
@@ -180866,6 +180884,20 @@
128+
@@ -182779,6 +182797,20 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
125129
rc = sqlite3_create_module_v2(
126130
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
127131
);

‎dist/shell.c‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ typedef unsigned char u8;
126126
#endif
127127
#include <ctype.h>
128128
#include <stdarg.h>
129+
// Begin Android Add
130+
#ifndef NO_ANDROID_FUNCS
131+
#include <sqlite3_android.h>
132+
#endif
133+
// End Android Add
129134

130135
#if !defined(_WIN32) && !defined(WIN32)
131136
# include <signal.h>
@@ -19561,6 +19566,22 @@ static void open_db(ShellState *p, int openFlags){
1956119566
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1956219567
editFunc, 0, 0);
1956319568
#endif
19569+
19570+
// Begin Android Add
19571+
#ifndef NO_ANDROID_FUNCS
19572+
int err = register_localized_collators(p->db, "en_US", 0);
19573+
if (err != SQLITE_OK) {
19574+
fprintf(stderr, "register_localized_collators() failed\n");
19575+
exit(1);
19576+
}
19577+
err = register_android_functions(p->db, 0);
19578+
if (err != SQLITE_OK) {
19579+
fprintf(stderr, "register_android_functions() failed\n");
19580+
exit(1);
19581+
}
19582+
#endif
19583+
// End Android Add
19584+
1956419585
if( p->openMode==SHELL_OPEN_ZIPFILE ){
1956519586
char *zSql = sqlite3_mprintf(
1956619587
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);

‎dist/sqlite3.c‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36808,6 +36808,10 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
3680836808
# include <sys/mount.h>
3680936809
#endif
3681036810

36811+
#if defined(__BIONIC__)
36812+
# include <android/fdsan.h>
36813+
#endif
36814+
3681136815
#ifdef HAVE_UTIME
3681236816
# include <utime.h>
3681336817
#endif
@@ -37373,6 +37377,12 @@ static int robust_open(const char *z, int f, mode_t m){
3737337377
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
3737437378
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
3737537379
#endif
37380+
37381+
#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__
37382+
uint64_t tag = android_fdsan_create_owner_tag(
37383+
ANDROID_FDSAN_OWNER_TYPE_SQLITE, fd);
37384+
android_fdsan_exchange_owner_tag(fd, 0, tag);
37385+
#endif
3737637386
}
3737737387
return fd;
3737837388
}
@@ -37953,7 +37963,13 @@ static int unixLogErrorAtLine(
3795337963
** and move on.
3795437964
*/
3795537965
static void robust_close(unixFile *pFile, int h, int lineno){
37966+
#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__
37967+
uint64_t tag = android_fdsan_create_owner_tag(
37968+
ANDROID_FDSAN_OWNER_TYPE_SQLITE, h);
37969+
if( android_fdsan_close_with_tag(h, tag) ){
37970+
#else
3795637971
if( osClose(h) ){
37972+
#endif
3795737973
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
3795837974
pFile ? pFile->zPath : 0, lineno);
3795937975
}
@@ -40508,7 +40524,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
4050840524
SimulateIOError( rc=1 );
4050940525
if( rc!=0 ){
4051040526
storeLastErrno((unixFile*)id, errno);
40511-
return SQLITE_IOERR_FSTAT;
40527+
return unixLogError(SQLITE_IOERR_FSTAT, "fstat", ((unixFile*)id)->zPath);
4051240528
}
4051340529
*pSize = buf.st_size;
4051440530

@@ -40544,7 +40560,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
4054440560
struct stat buf; /* Used to hold return values of fstat() */
4054540561

4054640562
if( osFstat(pFile->h, &buf) ){
40547-
return SQLITE_IOERR_FSTAT;
40563+
return unixLogError(SQLITE_IOERR_FSTAT, "fstat", pFile->zPath);
4054840564
}
4054940565

4055040566
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
@@ -41286,7 +41302,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
4128641302
** with the same permissions.
4128741303
*/
4128841304
if( osFstat(pDbFd->h, &sStat) ){
41289-
rc = SQLITE_IOERR_FSTAT;
41305+
rc = unixLogError(SQLITE_IOERR_FSTAT, "fstat", pDbFd->zPath);
4129041306
goto shm_open_err;
4129141307
}
4129241308

@@ -136618,7 +136634,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
136618136634
}
136619136635
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
136620136636
sqlite3SetString(pzErrMsg, db, "unsupported file format");
136621-
rc = SQLITE_ERROR;
136637+
rc = SQLITE_CORRUPT_BKPT; // Android Change from "rc = SQLITE_ERROR;";
136622136638
goto initone_error_out;
136623136639
}
136624136640

@@ -182768,7 +182784,9 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
182768182784
** module with sqlite.
182769182785
*/
182770182786
if( SQLITE_OK==rc
182787+
#ifndef ANDROID /* fts3_tokenizer disabled for security reasons */
182771182788
&& SQLITE_OK==(rc=sqlite3Fts3InitHashTable(db,&pHash->hash,"fts3_tokenizer"))
182789+
#endif
182772182790
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
182773182791
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
182774182792
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
@@ -182779,6 +182797,20 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
182779182797
rc = sqlite3_create_module_v2(
182780182798
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
182781182799
);
182800+
#ifdef SQLITE_ENABLE_FTS3_BACKWARDS
182801+
if( rc==SQLITE_OK ){
182802+
pHash->nRef++;
182803+
rc = sqlite3_create_module_v2(
182804+
db, "fts1", &fts3Module, (void *)pHash, hashDestroy
182805+
);
182806+
}
182807+
if( rc==SQLITE_OK ){
182808+
pHash->nRef++;
182809+
rc = sqlite3_create_module_v2(
182810+
db, "fts2", &fts3Module, (void *)pHash, hashDestroy
182811+
);
182812+
}
182813+
#endif
182782182814
if( rc==SQLITE_OK ){
182783182815
pHash->nRef++;
182784182816
rc = sqlite3_create_module_v2(

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
This repository was archived by the owner on Dec 21, 2024. It is now read-only.

Commit 68c69d8

Browse files
committed
Applied Android changes to 3.40.1
1 parent 8af748f commit 68c69d8

3 files changed

Lines changed: 76 additions & 19 deletions

File tree

‎dist/Android.patch‎

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
--- orig/shell.c 2022-09-01 12:39:01.340032408 +0100
2-
+++ shell.c 2022-09-01 12:39:01.528030292 +0100
3-
@@ -107,6 +107,11 @@
1+
diff --git a/dist/shell.c b/dist/shell.c
2+
index 63f708c..5afd4a9 100644
3+
--- a/dist/shell.c
4+
+++ b/dist/shell.c
5+
@@ -126,6 +126,11 @@ typedef unsigned char u8;
46
#endif
57
#include <ctype.h>
68
#include <stdarg.h>
@@ -12,7 +14,7 @@
1214

1315
#if !defined(_WIN32) && !defined(WIN32)
1416
# include <signal.h>
15-
@@ -16177,6 +16182,22 @@
17+
@@ -19561,6 +19566,22 @@ static void open_db(ShellState *p, int openFlags){
1618
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1719
editFunc, 0, 0);
1820
#endif
@@ -35,9 +37,11 @@
3537
if( p->openMode==SHELL_OPEN_ZIPFILE ){
3638
char *zSql = sqlite3_mprintf(
3739
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);
38-
--- orig/sqlite3.c 2022-09-01 12:39:01.356032228 +0100
39-
+++ sqlite3.c 2022-09-01 12:39:15.955867966 +0100
40-
@@ -35608,6 +35608,10 @@
40+
diff --git a/dist/sqlite3.c b/dist/sqlite3.c
41+
index a290c82..a0e1ec3 100644
42+
--- a/dist/sqlite3.c
43+
+++ b/dist/sqlite3.c
44+
@@ -36808,6 +36808,10 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
4145
# include <sys/mount.h>
4246
#endif
4347

@@ -48,7 +52,7 @@
4852
#ifdef HAVE_UTIME
4953
# include <utime.h>
5054
#endif
51-
@@ -36170,6 +36174,12 @@
55+
@@ -37373,6 +37377,12 @@ static int robust_open(const char *z, int f, mode_t m){
5256
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
5357
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
5458
#endif
@@ -61,7 +65,7 @@
6165
}
6266
return fd;
6367
}
64-
@@ -36750,7 +36760,13 @@
68+
@@ -37953,7 +37963,13 @@ static int unixLogErrorAtLine(
6569
** and move on.
6670
*/
6771
static void robust_close(unixFile *pFile, int h, int lineno){
@@ -75,7 +79,7 @@
7579
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
7680
pFile ? pFile->zPath : 0, lineno);
7781
}
78-
@@ -39305,7 +39321,7 @@
82+
@@ -40508,7 +40524,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
7983
SimulateIOError( rc=1 );
8084
if( rc!=0 ){
8185
storeLastErrno((unixFile*)id, errno);
@@ -84,7 +88,7 @@
8488
}
8589
*pSize = buf.st_size;
8690

87-
@@ -39341,7 +39357,7 @@
91+
@@ -40544,7 +40560,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
8892
struct stat buf; /* Used to hold return values of fstat() */
8993

9094
if( osFstat(pFile->h, &buf) ){
@@ -93,7 +97,7 @@
9397
}
9498

9599
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
96-
@@ -40083,7 +40099,7 @@
100+
@@ -41286,7 +41302,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
97101
** with the same permissions.
98102
*/
99103
if( osFstat(pDbFd->h, &sStat) ){
@@ -102,7 +106,7 @@
102106
goto shm_open_err;
103107
}
104108

105-
@@ -134802,7 +134818,7 @@
109+
@@ -136618,7 +136634,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
106110
}
107111
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
108112
sqlite3SetString(pzErrMsg, db, "unsupported file format");
@@ -111,7 +115,7 @@
111115
goto initone_error_out;
112116
}
113117

114-
@@ -180855,7 +180871,9 @@
118+
@@ -182768,7 +182784,9 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
115119
** module with sqlite.
116120
*/
117121
if( SQLITE_OK==rc
@@ -121,7 +125,7 @@
121125
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
122126
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
123127
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
124-
@@ -180866,6 +180884,20 @@
128+
@@ -182779,6 +182797,20 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
125129
rc = sqlite3_create_module_v2(
126130
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
127131
);

‎dist/shell.c‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ typedef unsigned char u8;
126126
#endif
127127
#include <ctype.h>
128128
#include <stdarg.h>
129+
// Begin Android Add
130+
#ifndef NO_ANDROID_FUNCS
131+
#include <sqlite3_android.h>
132+
#endif
133+
// End Android Add
129134

130135
#if !defined(_WIN32) && !defined(WIN32)
131136
# include <signal.h>
@@ -19561,6 +19566,22 @@ static void open_db(ShellState *p, int openFlags){
1956119566
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1956219567
editFunc, 0, 0);
1956319568
#endif
19569+
19570+
// Begin Android Add
19571+
#ifndef NO_ANDROID_FUNCS
19572+
int err = register_localized_collators(p->db, "en_US", 0);
19573+
if (err != SQLITE_OK) {
19574+
fprintf(stderr, "register_localized_collators() failed\n");
19575+
exit(1);
19576+
}
19577+
err = register_android_functions(p->db, 0);
19578+
if (err != SQLITE_OK) {
19579+
fprintf(stderr, "register_android_functions() failed\n");
19580+
exit(1);
19581+
}
19582+
#endif
19583+
// End Android Add
19584+
1956419585
if( p->openMode==SHELL_OPEN_ZIPFILE ){
1956519586
char *zSql = sqlite3_mprintf(
1956619587
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);

‎dist/sqlite3.c‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36808,6 +36808,10 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
3680836808
# include <sys/mount.h>
3680936809
#endif
3681036810

36811+
#if defined(__BIONIC__)
36812+
# include <android/fdsan.h>
36813+
#endif
36814+
3681136815
#ifdef HAVE_UTIME
3681236816
# include <utime.h>
3681336817
#endif
@@ -37373,6 +37377,12 @@ static int robust_open(const char *z, int f, mode_t m){
3737337377
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
3737437378
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
3737537379
#endif
37380+
37381+
#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__
37382+
uint64_t tag = android_fdsan_create_owner_tag(
37383+
ANDROID_FDSAN_OWNER_TYPE_SQLITE, fd);
37384+
android_fdsan_exchange_owner_tag(fd, 0, tag);
37385+
#endif
3737637386
}
3737737387
return fd;
3737837388
}
@@ -37953,7 +37963,13 @@ static int unixLogErrorAtLine(
3795337963
** and move on.
3795437964
*/
3795537965
static void robust_close(unixFile *pFile, int h, int lineno){
37966+
#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__
37967+
uint64_t tag = android_fdsan_create_owner_tag(
37968+
ANDROID_FDSAN_OWNER_TYPE_SQLITE, h);
37969+
if( android_fdsan_close_with_tag(h, tag) ){
37970+
#else
3795637971
if( osClose(h) ){
37972+
#endif
3795737973
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
3795837974
pFile ? pFile->zPath : 0, lineno);
3795937975
}
@@ -40508,7 +40524,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
4050840524
SimulateIOError( rc=1 );
4050940525
if( rc!=0 ){
4051040526
storeLastErrno((unixFile*)id, errno);
40511-
return SQLITE_IOERR_FSTAT;
40527+
return unixLogError(SQLITE_IOERR_FSTAT, "fstat", ((unixFile*)id)->zPath);
4051240528
}
4051340529
*pSize = buf.st_size;
4051440530

@@ -40544,7 +40560,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
4054440560
struct stat buf; /* Used to hold return values of fstat() */
4054540561

4054640562
if( osFstat(pFile->h, &buf) ){
40547-
return SQLITE_IOERR_FSTAT;
40563+
return unixLogError(SQLITE_IOERR_FSTAT, "fstat", pFile->zPath);
4054840564
}
4054940565

4055040566
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
@@ -41286,7 +41302,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
4128641302
** with the same permissions.
4128741303
*/
4128841304
if( osFstat(pDbFd->h, &sStat) ){
41289-
rc = SQLITE_IOERR_FSTAT;
41305+
rc = unixLogError(SQLITE_IOERR_FSTAT, "fstat", pDbFd->zPath);
4129041306
goto shm_open_err;
4129141307
}
4129241308

@@ -136618,7 +136634,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
136618136634
}
136619136635
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
136620136636
sqlite3SetString(pzErrMsg, db, "unsupported file format");
136621-
rc = SQLITE_ERROR;
136637+
rc = SQLITE_CORRUPT_BKPT; // Android Change from "rc = SQLITE_ERROR;";
136622136638
goto initone_error_out;
136623136639
}
136624136640

@@ -182768,7 +182784,9 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
182768182784
** module with sqlite.
182769182785
*/
182770182786
if( SQLITE_OK==rc
182787+
#ifndef ANDROID /* fts3_tokenizer disabled for security reasons */
182771182788
&& SQLITE_OK==(rc=sqlite3Fts3InitHashTable(db,&pHash->hash,"fts3_tokenizer"))
182789+
#endif
182772182790
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
182773182791
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
182774182792
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
@@ -182779,6 +182797,20 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
182779182797
rc = sqlite3_create_module_v2(
182780182798
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
182781182799
);
182800+
#ifdef SQLITE_ENABLE_FTS3_BACKWARDS
182801+
if( rc==SQLITE_OK ){
182802+
pHash->nRef++;
182803+
rc = sqlite3_create_module_v2(
182804+
db, "fts1", &fts3Module, (void *)pHash, hashDestroy
182805+
);
182806+
}
182807+
if( rc==SQLITE_OK ){
182808+
pHash->nRef++;
182809+
rc = sqlite3_create_module_v2(
182810+
db, "fts2", &fts3Module, (void *)pHash, hashDestroy
182811+
);
182812+
}
182813+
#endif
182782182814
if( rc==SQLITE_OK ){
182783182815
pHash->nRef++;
182784182816
rc = sqlite3_create_module_v2(

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
This repository was archived by the owner on Dec 21, 2024. It is now read-only.

Commit 68c69d8

Browse files
committed
Applied Android changes to 3.40.1
1 parent 8af748f commit 68c69d8

3 files changed

Lines changed: 76 additions & 19 deletions

File tree

‎dist/Android.patch‎

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
--- orig/shell.c 2022-09-01 12:39:01.340032408 +0100
2-
+++ shell.c 2022-09-01 12:39:01.528030292 +0100
3-
@@ -107,6 +107,11 @@
1+
diff --git a/dist/shell.c b/dist/shell.c
2+
index 63f708c..5afd4a9 100644
3+
--- a/dist/shell.c
4+
+++ b/dist/shell.c
5+
@@ -126,6 +126,11 @@ typedef unsigned char u8;
46
#endif
57
#include <ctype.h>
68
#include <stdarg.h>
@@ -12,7 +14,7 @@
1214

1315
#if !defined(_WIN32) && !defined(WIN32)
1416
# include <signal.h>
15-
@@ -16177,6 +16182,22 @@
17+
@@ -19561,6 +19566,22 @@ static void open_db(ShellState *p, int openFlags){
1618
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1719
editFunc, 0, 0);
1820
#endif
@@ -35,9 +37,11 @@
3537
if( p->openMode==SHELL_OPEN_ZIPFILE ){
3638
char *zSql = sqlite3_mprintf(
3739
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);
38-
--- orig/sqlite3.c 2022-09-01 12:39:01.356032228 +0100
39-
+++ sqlite3.c 2022-09-01 12:39:15.955867966 +0100
40-
@@ -35608,6 +35608,10 @@
40+
diff --git a/dist/sqlite3.c b/dist/sqlite3.c
41+
index a290c82..a0e1ec3 100644
42+
--- a/dist/sqlite3.c
43+
+++ b/dist/sqlite3.c
44+
@@ -36808,6 +36808,10 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
4145
# include <sys/mount.h>
4246
#endif
4347

@@ -48,7 +52,7 @@
4852
#ifdef HAVE_UTIME
4953
# include <utime.h>
5054
#endif
51-
@@ -36170,6 +36174,12 @@
55+
@@ -37373,6 +37377,12 @@ static int robust_open(const char *z, int f, mode_t m){
5256
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
5357
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
5458
#endif
@@ -61,7 +65,7 @@
6165
}
6266
return fd;
6367
}
64-
@@ -36750,7 +36760,13 @@
68+
@@ -37953,7 +37963,13 @@ static int unixLogErrorAtLine(
6569
** and move on.
6670
*/
6771
static void robust_close(unixFile *pFile, int h, int lineno){
@@ -75,7 +79,7 @@
7579
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
7680
pFile ? pFile->zPath : 0, lineno);
7781
}
78-
@@ -39305,7 +39321,7 @@
82+
@@ -40508,7 +40524,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
7983
SimulateIOError( rc=1 );
8084
if( rc!=0 ){
8185
storeLastErrno((unixFile*)id, errno);
@@ -84,7 +88,7 @@
8488
}
8589
*pSize = buf.st_size;
8690

87-
@@ -39341,7 +39357,7 @@
91+
@@ -40544,7 +40560,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
8892
struct stat buf; /* Used to hold return values of fstat() */
8993

9094
if( osFstat(pFile->h, &buf) ){
@@ -93,7 +97,7 @@
9397
}
9498

9599
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
96-
@@ -40083,7 +40099,7 @@
100+
@@ -41286,7 +41302,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
97101
** with the same permissions.
98102
*/
99103
if( osFstat(pDbFd->h, &sStat) ){
@@ -102,7 +106,7 @@
102106
goto shm_open_err;
103107
}
104108

105-
@@ -134802,7 +134818,7 @@
109+
@@ -136618,7 +136634,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
106110
}
107111
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
108112
sqlite3SetString(pzErrMsg, db, "unsupported file format");
@@ -111,7 +115,7 @@
111115
goto initone_error_out;
112116
}
113117

114-
@@ -180855,7 +180871,9 @@
118+
@@ -182768,7 +182784,9 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
115119
** module with sqlite.
116120
*/
117121
if( SQLITE_OK==rc
@@ -121,7 +125,7 @@
121125
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
122126
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
123127
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
124-
@@ -180866,6 +180884,20 @@
128+
@@ -182779,6 +182797,20 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
125129
rc = sqlite3_create_module_v2(
126130
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
127131
);

‎dist/shell.c‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ typedef unsigned char u8;
126126
#endif
127127
#include <ctype.h>
128128
#include <stdarg.h>
129+
// Begin Android Add
130+
#ifndef NO_ANDROID_FUNCS
131+
#include <sqlite3_android.h>
132+
#endif
133+
// End Android Add
129134

130135
#if !defined(_WIN32) && !defined(WIN32)
131136
# include <signal.h>
@@ -19561,6 +19566,22 @@ static void open_db(ShellState *p, int openFlags){
1956119566
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1956219567
editFunc, 0, 0);
1956319568
#endif
19569+
19570+
// Begin Android Add
19571+
#ifndef NO_ANDROID_FUNCS
19572+
int err = register_localized_collators(p->db, "en_US", 0);
19573+
if (err != SQLITE_OK) {
19574+
fprintf(stderr, "register_localized_collators() failed\n");
19575+
exit(1);
19576+
}
19577+
err = register_android_functions(p->db, 0);
19578+
if (err != SQLITE_OK) {
19579+
fprintf(stderr, "register_android_functions() failed\n");
19580+
exit(1);
19581+
}
19582+
#endif
19583+
// End Android Add
19584+
1956419585
if( p->openMode==SHELL_OPEN_ZIPFILE ){
1956519586
char *zSql = sqlite3_mprintf(
1956619587
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);

‎dist/sqlite3.c‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36808,6 +36808,10 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
3680836808
# include <sys/mount.h>
3680936809
#endif
3681036810

36811+
#if defined(__BIONIC__)
36812+
# include <android/fdsan.h>
36813+
#endif
36814+
3681136815
#ifdef HAVE_UTIME
3681236816
# include <utime.h>
3681336817
#endif
@@ -37373,6 +37377,12 @@ static int robust_open(const char *z, int f, mode_t m){
3737337377
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
3737437378
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
3737537379
#endif
37380+
37381+
#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__
37382+
uint64_t tag = android_fdsan_create_owner_tag(
37383+
ANDROID_FDSAN_OWNER_TYPE_SQLITE, fd);
37384+
android_fdsan_exchange_owner_tag(fd, 0, tag);
37385+
#endif
3737637386
}
3737737387
return fd;
3737837388
}
@@ -37953,7 +37963,13 @@ static int unixLogErrorAtLine(
3795337963
** and move on.
3795437964
*/
3795537965
static void robust_close(unixFile *pFile, int h, int lineno){
37966+
#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__
37967+
uint64_t tag = android_fdsan_create_owner_tag(
37968+
ANDROID_FDSAN_OWNER_TYPE_SQLITE, h);
37969+
if( android_fdsan_close_with_tag(h, tag) ){
37970+
#else
3795637971
if( osClose(h) ){
37972+
#endif
3795737973
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
3795837974
pFile ? pFile->zPath : 0, lineno);
3795937975
}
@@ -40508,7 +40524,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
4050840524
SimulateIOError( rc=1 );
4050940525
if( rc!=0 ){
4051040526
storeLastErrno((unixFile*)id, errno);
40511-
return SQLITE_IOERR_FSTAT;
40527+
return unixLogError(SQLITE_IOERR_FSTAT, "fstat", ((unixFile*)id)->zPath);
4051240528
}
4051340529
*pSize = buf.st_size;
4051440530

@@ -40544,7 +40560,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
4054440560
struct stat buf; /* Used to hold return values of fstat() */
4054540561

4054640562
if( osFstat(pFile->h, &buf) ){
40547-
return SQLITE_IOERR_FSTAT;
40563+
return unixLogError(SQLITE_IOERR_FSTAT, "fstat", pFile->zPath);
4054840564
}
4054940565

4055040566
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
@@ -41286,7 +41302,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
4128641302
** with the same permissions.
4128741303
*/
4128841304
if( osFstat(pDbFd->h, &sStat) ){
41289-
rc = SQLITE_IOERR_FSTAT;
41305+
rc = unixLogError(SQLITE_IOERR_FSTAT, "fstat", pDbFd->zPath);
4129041306
goto shm_open_err;
4129141307
}
4129241308

@@ -136618,7 +136634,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
136618136634
}
136619136635
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
136620136636
sqlite3SetString(pzErrMsg, db, "unsupported file format");
136621-
rc = SQLITE_ERROR;
136637+
rc = SQLITE_CORRUPT_BKPT; // Android Change from "rc = SQLITE_ERROR;";
136622136638
goto initone_error_out;
136623136639
}
136624136640

@@ -182768,7 +182784,9 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
182768182784
** module with sqlite.
182769182785
*/
182770182786
if( SQLITE_OK==rc
182787+
#ifndef ANDROID /* fts3_tokenizer disabled for security reasons */
182771182788
&& SQLITE_OK==(rc=sqlite3Fts3InitHashTable(db,&pHash->hash,"fts3_tokenizer"))
182789+
#endif
182772182790
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
182773182791
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
182774182792
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
@@ -182779,6 +182797,20 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
182779182797
rc = sqlite3_create_module_v2(
182780182798
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
182781182799
);
182800+
#ifdef SQLITE_ENABLE_FTS3_BACKWARDS
182801+
if( rc==SQLITE_OK ){
182802+
pHash->nRef++;
182803+
rc = sqlite3_create_module_v2(
182804+
db, "fts1", &fts3Module, (void *)pHash, hashDestroy
182805+
);
182806+
}
182807+
if( rc==SQLITE_OK ){
182808+
pHash->nRef++;
182809+
rc = sqlite3_create_module_v2(
182810+
db, "fts2", &fts3Module, (void *)pHash, hashDestroy
182811+
);
182812+
}
182813+
#endif
182782182814
if( rc==SQLITE_OK ){
182783182815
pHash->nRef++;
182784182816
rc = sqlite3_create_module_v2(

0 commit comments

Comments
 (0)
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
This repository was archived by the owner on Dec 21, 2024. It is now read-only.

Commit 68c69d8

Browse files
committed
Applied Android changes to 3.40.1
1 parent 8af748f commit 68c69d8

3 files changed

Lines changed: 76 additions & 19 deletions

File tree

‎dist/Android.patch‎

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
--- orig/shell.c 2022-09-01 12:39:01.340032408 +0100
2-
+++ shell.c 2022-09-01 12:39:01.528030292 +0100
3-
@@ -107,6 +107,11 @@
1+
diff --git a/dist/shell.c b/dist/shell.c
2+
index 63f708c..5afd4a9 100644
3+
--- a/dist/shell.c
4+
+++ b/dist/shell.c
5+
@@ -126,6 +126,11 @@ typedef unsigned char u8;
46
#endif
57
#include <ctype.h>
68
#include <stdarg.h>
@@ -12,7 +14,7 @@
1214

1315
#if !defined(_WIN32) && !defined(WIN32)
1416
# include <signal.h>
15-
@@ -16177,6 +16182,22 @@
17+
@@ -19561,6 +19566,22 @@ static void open_db(ShellState *p, int openFlags){
1618
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1719
editFunc, 0, 0);
1820
#endif
@@ -35,9 +37,11 @@
3537
if( p->openMode==SHELL_OPEN_ZIPFILE ){
3638
char *zSql = sqlite3_mprintf(
3739
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);
38-
--- orig/sqlite3.c 2022-09-01 12:39:01.356032228 +0100
39-
+++ sqlite3.c 2022-09-01 12:39:15.955867966 +0100
40-
@@ -35608,6 +35608,10 @@
40+
diff --git a/dist/sqlite3.c b/dist/sqlite3.c
41+
index a290c82..a0e1ec3 100644
42+
--- a/dist/sqlite3.c
43+
+++ b/dist/sqlite3.c
44+
@@ -36808,6 +36808,10 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
4145
# include <sys/mount.h>
4246
#endif
4347

@@ -48,7 +52,7 @@
4852
#ifdef HAVE_UTIME
4953
# include <utime.h>
5054
#endif
51-
@@ -36170,6 +36174,12 @@
55+
@@ -37373,6 +37377,12 @@ static int robust_open(const char *z, int f, mode_t m){
5256
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
5357
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
5458
#endif
@@ -61,7 +65,7 @@
6165
}
6266
return fd;
6367
}
64-
@@ -36750,7 +36760,13 @@
68+
@@ -37953,7 +37963,13 @@ static int unixLogErrorAtLine(
6569
** and move on.
6670
*/
6771
static void robust_close(unixFile *pFile, int h, int lineno){
@@ -75,7 +79,7 @@
7579
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
7680
pFile ? pFile->zPath : 0, lineno);
7781
}
78-
@@ -39305,7 +39321,7 @@
82+
@@ -40508,7 +40524,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
7983
SimulateIOError( rc=1 );
8084
if( rc!=0 ){
8185
storeLastErrno((unixFile*)id, errno);
@@ -84,7 +88,7 @@
8488
}
8589
*pSize = buf.st_size;
8690

87-
@@ -39341,7 +39357,7 @@
91+
@@ -40544,7 +40560,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
8892
struct stat buf; /* Used to hold return values of fstat() */
8993

9094
if( osFstat(pFile->h, &buf) ){
@@ -93,7 +97,7 @@
9397
}
9498

9599
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
96-
@@ -40083,7 +40099,7 @@
100+
@@ -41286,7 +41302,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
97101
** with the same permissions.
98102
*/
99103
if( osFstat(pDbFd->h, &sStat) ){
@@ -102,7 +106,7 @@
102106
goto shm_open_err;
103107
}
104108

105-
@@ -134802,7 +134818,7 @@
109+
@@ -136618,7 +136634,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
106110
}
107111
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
108112
sqlite3SetString(pzErrMsg, db, "unsupported file format");
@@ -111,7 +115,7 @@
111115
goto initone_error_out;
112116
}
113117

114-
@@ -180855,7 +180871,9 @@
118+
@@ -182768,7 +182784,9 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
115119
** module with sqlite.
116120
*/
117121
if( SQLITE_OK==rc
@@ -121,7 +125,7 @@
121125
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
122126
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
123127
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
124-
@@ -180866,6 +180884,20 @@
128+
@@ -182779,6 +182797,20 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
125129
rc = sqlite3_create_module_v2(
126130
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
127131
);

‎dist/shell.c‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ typedef unsigned char u8;
126126
#endif
127127
#include <ctype.h>
128128
#include <stdarg.h>
129+
// Begin Android Add
130+
#ifndef NO_ANDROID_FUNCS
131+
#include <sqlite3_android.h>
132+
#endif
133+
// End Android Add
129134

130135
#if !defined(_WIN32) && !defined(WIN32)
131136
# include <signal.h>
@@ -19561,6 +19566,22 @@ static void open_db(ShellState *p, int openFlags){
1956119566
sqlite3_create_function(p->db, "edit", 2, SQLITE_UTF8, 0,
1956219567
editFunc, 0, 0);
1956319568
#endif
19569+
19570+
// Begin Android Add
19571+
#ifndef NO_ANDROID_FUNCS
19572+
int err = register_localized_collators(p->db, "en_US", 0);
19573+
if (err != SQLITE_OK) {
19574+
fprintf(stderr, "register_localized_collators() failed\n");
19575+
exit(1);
19576+
}
19577+
err = register_android_functions(p->db, 0);
19578+
if (err != SQLITE_OK) {
19579+
fprintf(stderr, "register_android_functions() failed\n");
19580+
exit(1);
19581+
}
19582+
#endif
19583+
// End Android Add
19584+
1956419585
if( p->openMode==SHELL_OPEN_ZIPFILE ){
1956519586
char *zSql = sqlite3_mprintf(
1956619587
"CREATE VIRTUAL TABLE zip USING zipfile(%Q);", zDbFilename);

‎dist/sqlite3.c‎

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36808,6 +36808,10 @@ SQLITE_PRIVATE int sqlite3KvvfsInit(void){
3680836808
# include <sys/mount.h>
3680936809
#endif
3681036810

36811+
#if defined(__BIONIC__)
36812+
# include <android/fdsan.h>
36813+
#endif
36814+
3681136815
#ifdef HAVE_UTIME
3681236816
# include <utime.h>
3681336817
#endif
@@ -37373,6 +37377,12 @@ static int robust_open(const char *z, int f, mode_t m){
3737337377
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
3737437378
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
3737537379
#endif
37380+
37381+
#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__
37382+
uint64_t tag = android_fdsan_create_owner_tag(
37383+
ANDROID_FDSAN_OWNER_TYPE_SQLITE, fd);
37384+
android_fdsan_exchange_owner_tag(fd, 0, tag);
37385+
#endif
3737637386
}
3737737387
return fd;
3737837388
}
@@ -37953,7 +37963,13 @@ static int unixLogErrorAtLine(
3795337963
** and move on.
3795437964
*/
3795537965
static void robust_close(unixFile *pFile, int h, int lineno){
37966+
#if defined(__BIONIC__) && __ANDROID_API__ >= __ANDROID_API_Q__
37967+
uint64_t tag = android_fdsan_create_owner_tag(
37968+
ANDROID_FDSAN_OWNER_TYPE_SQLITE, h);
37969+
if( android_fdsan_close_with_tag(h, tag) ){
37970+
#else
3795637971
if( osClose(h) ){
37972+
#endif
3795737973
unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close",
3795837974
pFile ? pFile->zPath : 0, lineno);
3795937975
}
@@ -40508,7 +40524,7 @@ static int unixFileSize(sqlite3_file *id, i64 *pSize){
4050840524
SimulateIOError( rc=1 );
4050940525
if( rc!=0 ){
4051040526
storeLastErrno((unixFile*)id, errno);
40511-
return SQLITE_IOERR_FSTAT;
40527+
return unixLogError(SQLITE_IOERR_FSTAT, "fstat", ((unixFile*)id)->zPath);
4051240528
}
4051340529
*pSize = buf.st_size;
4051440530

@@ -40544,7 +40560,7 @@ static int fcntlSizeHint(unixFile *pFile, i64 nByte){
4054440560
struct stat buf; /* Used to hold return values of fstat() */
4054540561

4054640562
if( osFstat(pFile->h, &buf) ){
40547-
return SQLITE_IOERR_FSTAT;
40563+
return unixLogError(SQLITE_IOERR_FSTAT, "fstat", pFile->zPath);
4054840564
}
4054940565

4055040566
nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
@@ -41286,7 +41302,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
4128641302
** with the same permissions.
4128741303
*/
4128841304
if( osFstat(pDbFd->h, &sStat) ){
41289-
rc = SQLITE_IOERR_FSTAT;
41305+
rc = unixLogError(SQLITE_IOERR_FSTAT, "fstat", pDbFd->zPath);
4129041306
goto shm_open_err;
4129141307
}
4129241308

@@ -136618,7 +136634,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl
136618136634
}
136619136635
if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
136620136636
sqlite3SetString(pzErrMsg, db, "unsupported file format");
136621-
rc = SQLITE_ERROR;
136637+
rc = SQLITE_CORRUPT_BKPT; // Android Change from "rc = SQLITE_ERROR;";
136622136638
goto initone_error_out;
136623136639
}
136624136640

@@ -182768,7 +182784,9 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
182768182784
** module with sqlite.
182769182785
*/
182770182786
if( SQLITE_OK==rc
182787+
#ifndef ANDROID /* fts3_tokenizer disabled for security reasons */
182771182788
&& SQLITE_OK==(rc=sqlite3Fts3InitHashTable(db,&pHash->hash,"fts3_tokenizer"))
182789+
#endif
182772182790
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
182773182791
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1))
182774182792
&& SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1))
@@ -182779,6 +182797,20 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){
182779182797
rc = sqlite3_create_module_v2(
182780182798
db, "fts3", &fts3Module, (void *)pHash, hashDestroy
182781182799
);
182800+
#ifdef SQLITE_ENABLE_FTS3_BACKWARDS
182801+
if( rc==SQLITE_OK ){
182802+
pHash->nRef++;
182803+
rc = sqlite3_create_module_v2(
182804+
db, "fts1", &fts3Module, (void *)pHash, hashDestroy
182805+
);
182806+
}
182807+
if( rc==SQLITE_OK ){
182808+
pHash->nRef++;
182809+
rc = sqlite3_create_module_v2(
182810+
db, "fts2", &fts3Module, (void *)pHash, hashDestroy
182811+
);
182812+
}
182813+
#endif
182782182814
if( rc==SQLITE_OK ){
182783182815
pHash->nRef++;
182784182816
rc = sqlite3_create_module_v2(

0 commit comments

Comments
 (0)