Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Side by Side Diff: third_party/sqlite/patches/0005-Custom-shell.c-helpers-to-load-Chromium-s-ICU-data.patch

Issue 2751253002: [sql] Import SQLite 3.17.0. (Closed)
Patch Set: also clang on Linux i386 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 From 5628b1aa2f0207924e6c39f46266b396a7fe374c Mon Sep 17 00:00:00 2001 1 From 8802205af36bcbcbeeac3c32d6dd292dda6f4344 Mon Sep 17 00:00:00 2001
2 From: "tc@google.com" <tc@google.com> 2 From: "tc@google.com" <tc@google.com>
3 Date: Tue, 6 Jan 2009 22:39:41 +0000 3 Date: Tue, 6 Jan 2009 22:39:41 +0000
4 Subject: [PATCH 06/13] Custom shell.c helpers to load Chromium's ICU data. 4 Subject: [PATCH 05/10] Custom shell.c helpers to load Chromium's ICU data.
5 5
6 History uses fts3 with an icu-based segmenter. These changes allow building a 6 History uses fts3 with an icu-based segmenter. These changes allow building a
7 sqlite3 binary for Linux or Windows which can read those files. 7 sqlite3 binary for Linux or Windows which can read those files.
8 8
9 Original review URL: https://codereview.chromium.org/42250 9 Original review URL: https://codereview.chromium.org/42250
10 --- 10 ---
11 third_party/sqlite/src/Makefile.linux-gcc | 7 ++++++ 11 third_party/sqlite/src/Makefile.linux-gcc | 7 ++++++
12 third_party/sqlite/src/main.mk | 2 +- 12 third_party/sqlite/src/main.mk | 2 +-
13 third_party/sqlite/src/src/shell.c | 10 +++++++++ 13 third_party/sqlite/src/src/shell.c | 10 +++++++++
14 third_party/sqlite/src/src/shell_icu_linux.c | 27 +++++++++++++++++++++++ 14 third_party/sqlite/src/src/shell_icu_linux.c | 27 +++++++++++++++++++++++
15 third_party/sqlite/src/src/shell_icu_win.c | 32 ++++++++++++++++++++++++++++ 15 third_party/sqlite/src/src/shell_icu_win.c | 32 ++++++++++++++++++++++++++++
16 5 files changed, 77 insertions(+), 1 deletion(-) 16 5 files changed, 77 insertions(+), 1 deletion(-)
17 create mode 100644 third_party/sqlite/src/src/shell_icu_linux.c 17 create mode 100644 third_party/sqlite/src/src/shell_icu_linux.c
18 create mode 100644 third_party/sqlite/src/src/shell_icu_win.c 18 create mode 100644 third_party/sqlite/src/src/shell_icu_win.c
19 19
20 diff --git a/third_party/sqlite/src/Makefile.linux-gcc b/third_party/sqlite/src/ Makefile.linux-gcc 20 diff --git a/third_party/sqlite/src/Makefile.linux-gcc b/third_party/sqlite/src/ Makefile.linux-gcc
21 index 952e8d1..30ac8bb 100644 21 index a1dec21affea..c59886b087e2 100644
22 --- a/third_party/sqlite/src/Makefile.linux-gcc 22 --- a/third_party/sqlite/src/Makefile.linux-gcc
23 +++ b/third_party/sqlite/src/Makefile.linux-gcc 23 +++ b/third_party/sqlite/src/Makefile.linux-gcc
24 @@ -81,6 +81,13 @@ OPTS += -DSQLITE_MEMDEBUG=1 24 @@ -77,6 +77,13 @@ OPTS += -DSQLITE_MEMDEBUG=1
25 # TODO(shess) I can't see why I need this setting. 25 # TODO(shess) I can't see why I need this setting.
26 OPTS += -DOS_UNIX=1 26 OPTS += -DOS_UNIX=1
27 27
28 +# Support for loading Chromium ICU data in sqlite3. 28 +# Support for loading Chromium ICU data in sqlite3.
29 +ifeq ($(shell uname -s),Darwin) 29 +ifeq ($(shell uname -s),Darwin)
30 +SHELL_ICU = 30 +SHELL_ICU =
31 +else 31 +else
32 +SHELL_ICU = $(TOP)/src/shell_icu_linux.c -licuuc 32 +SHELL_ICU = $(TOP)/src/shell_icu_linux.c -licuuc
33 +endif 33 +endif
34 + 34 +
35 #### The suffix to add to executable files. ".exe" for windows. 35 #### The suffix to add to executable files. ".exe" for windows.
36 # Nothing for unix. 36 # Nothing for unix.
37 # 37 #
38 diff --git a/third_party/sqlite/src/main.mk b/third_party/sqlite/src/main.mk 38 diff --git a/third_party/sqlite/src/main.mk b/third_party/sqlite/src/main.mk
39 index 26f9f15..3ff3647 100644 39 index b46c5bbc9ced..a8e8ffe27562 100644
40 --- a/third_party/sqlite/src/main.mk 40 --- a/third_party/sqlite/src/main.mk
41 +++ b/third_party/sqlite/src/main.mk 41 +++ b/third_party/sqlite/src/main.mk
42 @@ -476,7 +476,7 @@ libsqlite3.a:» $(LIBOBJ) 42 @@ -498,7 +498,7 @@ libsqlite3.a:» $(LIBOBJ)
43 43
44 sqlite3$(EXE): $(TOP)/src/shell.c libsqlite3.a sqlite3.h 44 sqlite3$(EXE): $(TOP)/src/shell.c libsqlite3.a sqlite3.h
45 $(TCCX) $(READLINE_FLAGS) -o sqlite3$(EXE) $(SHELL_OPT) \ 45 $(TCCX) $(READLINE_FLAGS) -o sqlite3$(EXE) $(SHELL_OPT) \
46 - $(TOP)/src/shell.c libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREAD LIB) 46 - $(TOP)/src/shell.c libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREAD LIB)
47 + $(TOP)/src/shell.c $(SHELL_ICU) libsqlite3.a $(LIBREADLINE) $(TL IBS) $(THREADLIB) 47 + $(TOP)/src/shell.c $(SHELL_ICU) libsqlite3.a $(LIBREADLINE) $(TL IBS) $(THREADLIB)
48 48
49 sqldiff$(EXE): $(TOP)/tool/sqldiff.c sqlite3.c sqlite3.h 49 sqldiff$(EXE): $(TOP)/tool/sqldiff.c sqlite3.c sqlite3.h
50 $(TCCX) -o sqldiff$(EXE) -DSQLITE_THREADSAFE=0 \ 50 $(TCCX) -o sqldiff$(EXE) -DSQLITE_THREADSAFE=0 \
51 diff --git a/third_party/sqlite/src/src/shell.c b/third_party/sqlite/src/src/she ll.c 51 diff --git a/third_party/sqlite/src/src/shell.c b/third_party/sqlite/src/src/she ll.c
52 index b7a7abc..b1d5087 100644 52 index 0e553d9fbb6f..33377da521d3 100644
53 --- a/third_party/sqlite/src/src/shell.c 53 --- a/third_party/sqlite/src/src/shell.c
54 +++ b/third_party/sqlite/src/src/shell.c 54 +++ b/third_party/sqlite/src/src/shell.c
55 @@ -4645,6 +4645,16 @@ int SQLITE_CDECL main(int argc, char **argv){ 55 @@ -5849,6 +5849,16 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
56 } 56 }
57 #endif 57 #endif
58 58
59 + /* Begin evanm patch. */ 59 + /* Begin evanm patch. */
60 +#if !defined(__APPLE__) 60 +#if !defined(__APPLE__)
61 + extern int sqlite_shell_init_icu(); 61 + extern int sqlite_shell_init_icu();
62 + if( !sqlite_shell_init_icu() ){ 62 + if( !sqlite_shell_init_icu() ){
63 + fprintf(stderr, "%s: warning: couldn't find icudt38.dll; " 63 + fprintf(stderr, "%s: warning: couldn't find icudt38.dll; "
64 + "queries against ICU FTS tables will fail.\n", argv[0]); 64 + "queries against ICU FTS tables will fail.\n", argv[0]);
65 + } 65 + }
66 +#endif /* !defined(__APPLE__) */ 66 +#endif /* !defined(__APPLE__) */
67 + /* End evanm patch. */ 67 + /* End evanm patch. */
68 + 68 +
69 /* Do an initial pass through the command-line argument to locate 69 /* Do an initial pass through the command-line argument to locate
70 ** the name of the database file, the name of the initialization file, 70 ** the name of the database file, the name of the initialization file,
71 ** the size of the alternative malloc heap, 71 ** the size of the alternative malloc heap,
72 diff --git a/third_party/sqlite/src/src/shell_icu_linux.c b/third_party/sqlite/s rc/src/shell_icu_linux.c 72 diff --git a/third_party/sqlite/src/src/shell_icu_linux.c b/third_party/sqlite/s rc/src/shell_icu_linux.c
73 new file mode 100644 73 new file mode 100644
74 index 0000000..4ad0e42 74 index 000000000000..4ad0e42d2293
75 --- /dev/null 75 --- /dev/null
76 +++ b/third_party/sqlite/src/src/shell_icu_linux.c 76 +++ b/third_party/sqlite/src/src/shell_icu_linux.c
77 @@ -0,0 +1,27 @@ 77 @@ -0,0 +1,27 @@
78 +/* Copyright 2007 Google Inc. All Rights Reserved. 78 +/* Copyright 2007 Google Inc. All Rights Reserved.
79 +**/ 79 +**/
80 + 80 +
81 +#include <limits.h> 81 +#include <limits.h>
82 +#include <unistd.h> 82 +#include <unistd.h>
83 +#include "unicode/putil.h" 83 +#include "unicode/putil.h"
84 +#include "unicode/udata.h" 84 +#include "unicode/udata.h"
(...skipping 12 matching lines...) Expand all
97 + 97 +
98 + u_setDataDirectory(bin_dir); 98 + u_setDataDirectory(bin_dir);
99 + // Only look for the packaged data file; 99 + // Only look for the packaged data file;
100 + // the default behavior is to look for individual files. 100 + // the default behavior is to look for individual files.
101 + UErrorCode err = U_ZERO_ERROR; 101 + UErrorCode err = U_ZERO_ERROR;
102 + udata_setFileAccess(UDATA_ONLY_PACKAGES, &err); 102 + udata_setFileAccess(UDATA_ONLY_PACKAGES, &err);
103 + return err == U_ZERO_ERROR; 103 + return err == U_ZERO_ERROR;
104 +} 104 +}
105 diff --git a/third_party/sqlite/src/src/shell_icu_win.c b/third_party/sqlite/src /src/shell_icu_win.c 105 diff --git a/third_party/sqlite/src/src/shell_icu_win.c b/third_party/sqlite/src /src/shell_icu_win.c
106 new file mode 100644 106 new file mode 100644
107 index 0000000..67ebbf4 107 index 000000000000..67ebbf4fbdb4
108 --- /dev/null 108 --- /dev/null
109 +++ b/third_party/sqlite/src/src/shell_icu_win.c 109 +++ b/third_party/sqlite/src/src/shell_icu_win.c
110 @@ -0,0 +1,32 @@ 110 @@ -0,0 +1,32 @@
111 +/* Copyright 2011 Google Inc. All Rights Reserved. 111 +/* Copyright 2011 Google Inc. All Rights Reserved.
112 +**/ 112 +**/
113 + 113 +
114 +#include <windows.h> 114 +#include <windows.h>
115 +#include "unicode/udata.h" 115 +#include "unicode/udata.h"
116 + 116 +
117 +/* 117 +/*
(...skipping 16 matching lines...) Expand all
134 + addr = GetProcAddress(module, ICU_DATA_SYMBOL); 134 + addr = GetProcAddress(module, ICU_DATA_SYMBOL);
135 + if (!addr) 135 + if (!addr)
136 + return 0; 136 + return 0;
137 + 137 +
138 + err = U_ZERO_ERROR; 138 + err = U_ZERO_ERROR;
139 + udata_setCommonData(addr, &err); 139 + udata_setCommonData(addr, &err);
140 + 140 +
141 + return 1; 141 + return 1;
142 +} 142 +}
143 -- 143 --
144 2.5.0 144 2.11.0
145 145
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698