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

Unified Diff: third_party/sqlite/patches/0006-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 side-by-side diff with in-line comments
Download patch
Index: third_party/sqlite/patches/0006-Custom-shell.c-helpers-to-load-Chromium-s-ICU-data.patch
diff --git a/third_party/sqlite/patches/0006-Custom-shell.c-helpers-to-load-Chromium-s-ICU-data.patch b/third_party/sqlite/patches/0006-Custom-shell.c-helpers-to-load-Chromium-s-ICU-data.patch
deleted file mode 100644
index 873c4688a614c0b6735b93b6962ea3485665b750..0000000000000000000000000000000000000000
--- a/third_party/sqlite/patches/0006-Custom-shell.c-helpers-to-load-Chromium-s-ICU-data.patch
+++ /dev/null
@@ -1,145 +0,0 @@
-From 5628b1aa2f0207924e6c39f46266b396a7fe374c Mon Sep 17 00:00:00 2001
-From: "tc@google.com" <tc@google.com>
-Date: Tue, 6 Jan 2009 22:39:41 +0000
-Subject: [PATCH 06/13] Custom shell.c helpers to load Chromium's ICU data.
-
-History uses fts3 with an icu-based segmenter. These changes allow building a
-sqlite3 binary for Linux or Windows which can read those files.
-
-Original review URL: https://codereview.chromium.org/42250
----
- third_party/sqlite/src/Makefile.linux-gcc | 7 ++++++
- third_party/sqlite/src/main.mk | 2 +-
- third_party/sqlite/src/src/shell.c | 10 +++++++++
- third_party/sqlite/src/src/shell_icu_linux.c | 27 +++++++++++++++++++++++
- third_party/sqlite/src/src/shell_icu_win.c | 32 ++++++++++++++++++++++++++++
- 5 files changed, 77 insertions(+), 1 deletion(-)
- create mode 100644 third_party/sqlite/src/src/shell_icu_linux.c
- create mode 100644 third_party/sqlite/src/src/shell_icu_win.c
-
-diff --git a/third_party/sqlite/src/Makefile.linux-gcc b/third_party/sqlite/src/Makefile.linux-gcc
-index 952e8d1..30ac8bb 100644
---- a/third_party/sqlite/src/Makefile.linux-gcc
-+++ b/third_party/sqlite/src/Makefile.linux-gcc
-@@ -81,6 +81,13 @@ OPTS += -DSQLITE_MEMDEBUG=1
- # TODO(shess) I can't see why I need this setting.
- OPTS += -DOS_UNIX=1
-
-+# Support for loading Chromium ICU data in sqlite3.
-+ifeq ($(shell uname -s),Darwin)
-+SHELL_ICU =
-+else
-+SHELL_ICU = $(TOP)/src/shell_icu_linux.c -licuuc
-+endif
-+
- #### The suffix to add to executable files. ".exe" for windows.
- # Nothing for unix.
- #
-diff --git a/third_party/sqlite/src/main.mk b/third_party/sqlite/src/main.mk
-index 26f9f15..3ff3647 100644
---- a/third_party/sqlite/src/main.mk
-+++ b/third_party/sqlite/src/main.mk
-@@ -476,7 +476,7 @@ libsqlite3.a: $(LIBOBJ)
-
- sqlite3$(EXE): $(TOP)/src/shell.c libsqlite3.a sqlite3.h
- $(TCCX) $(READLINE_FLAGS) -o sqlite3$(EXE) $(SHELL_OPT) \
-- $(TOP)/src/shell.c libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREADLIB)
-+ $(TOP)/src/shell.c $(SHELL_ICU) libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREADLIB)
-
- sqldiff$(EXE): $(TOP)/tool/sqldiff.c sqlite3.c sqlite3.h
- $(TCCX) -o sqldiff$(EXE) -DSQLITE_THREADSAFE=0 \
-diff --git a/third_party/sqlite/src/src/shell.c b/third_party/sqlite/src/src/shell.c
-index b7a7abc..b1d5087 100644
---- a/third_party/sqlite/src/src/shell.c
-+++ b/third_party/sqlite/src/src/shell.c
-@@ -4645,6 +4645,16 @@ int SQLITE_CDECL main(int argc, char **argv){
- }
- #endif
-
-+ /* Begin evanm patch. */
-+#if !defined(__APPLE__)
-+ extern int sqlite_shell_init_icu();
-+ if( !sqlite_shell_init_icu() ){
-+ fprintf(stderr, "%s: warning: couldn't find icudt38.dll; "
-+ "queries against ICU FTS tables will fail.\n", argv[0]);
-+ }
-+#endif /* !defined(__APPLE__) */
-+ /* End evanm patch. */
-+
- /* Do an initial pass through the command-line argument to locate
- ** the name of the database file, the name of the initialization file,
- ** the size of the alternative malloc heap,
-diff --git a/third_party/sqlite/src/src/shell_icu_linux.c b/third_party/sqlite/src/src/shell_icu_linux.c
-new file mode 100644
-index 0000000..4ad0e42
---- /dev/null
-+++ b/third_party/sqlite/src/src/shell_icu_linux.c
-@@ -0,0 +1,27 @@
-+/* Copyright 2007 Google Inc. All Rights Reserved.
-+**/
-+
-+#include <limits.h>
-+#include <unistd.h>
-+#include "unicode/putil.h"
-+#include "unicode/udata.h"
-+
-+/*
-+** This function attempts to load the ICU data tables from a data file.
-+** Returns 0 on failure, nonzero on success.
-+** This a hack job of icu_utils.cc:Initialize(). It's Chrome-specific code.
-+*/
-+int sqlite_shell_init_icu() {
-+ char bin_dir[PATH_MAX + 1];
-+ int bin_dir_size = readlink("/proc/self/exe", bin_dir, PATH_MAX);
-+ if (bin_dir_size < 0 || bin_dir_size > PATH_MAX)
-+ return 0;
-+ bin_dir[bin_dir_size] = 0;;
-+
-+ u_setDataDirectory(bin_dir);
-+ // Only look for the packaged data file;
-+ // the default behavior is to look for individual files.
-+ UErrorCode err = U_ZERO_ERROR;
-+ udata_setFileAccess(UDATA_ONLY_PACKAGES, &err);
-+ return err == U_ZERO_ERROR;
-+}
-diff --git a/third_party/sqlite/src/src/shell_icu_win.c b/third_party/sqlite/src/src/shell_icu_win.c
-new file mode 100644
-index 0000000..67ebbf4
---- /dev/null
-+++ b/third_party/sqlite/src/src/shell_icu_win.c
-@@ -0,0 +1,32 @@
-+/* Copyright 2011 Google Inc. All Rights Reserved.
-+**/
-+
-+#include <windows.h>
-+#include "unicode/udata.h"
-+
-+/*
-+** This function attempts to load the ICU data tables from a DLL.
-+** Returns 0 on failure, nonzero on success.
-+** This a hack job of icu_utils.cc:Initialize(). It's Chrome-specific code.
-+*/
-+
-+#define ICU_DATA_SYMBOL "icudt" U_ICU_VERSION_SHORT "_dat"
-+int sqlite_shell_init_icu() {
-+ HMODULE module;
-+ FARPROC addr;
-+ UErrorCode err;
-+
-+ // Chrome dropped U_ICU_VERSION_SHORT from the icu data dll name.
-+ module = LoadLibrary(L"icudt.dll");
-+ if (!module)
-+ return 0;
-+
-+ addr = GetProcAddress(module, ICU_DATA_SYMBOL);
-+ if (!addr)
-+ return 0;
-+
-+ err = U_ZERO_ERROR;
-+ udata_setCommonData(addr, &err);
-+
-+ return 1;
-+}
---
-2.5.0
-

Powered by Google App Engine
This is Rietveld 408576698