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

Side by Side Diff: third_party/sqlite/icu-shell.patch

Issue 6823057: Cleanup SQLite 3.6.18 import. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « third_party/sqlite/README.chromium ('k') | third_party/sqlite/misc.patch » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 History uses fts3 with an icu-based segmenter. These changes allow
2 building a sqlite3 binary which can read those files.
3
4 Index: src/shell.c
5 ===================================================================
6 --- src/shell.c 2009-09-04 13:37:43.000000000 -0700
7 +++ src/shell.c 2009-09-15 11:32:08.000000000 -0700
8 @@ -3007,6 +3007,14 @@
9 int i;
10 int rc = 0;
11
12 + /* Begin evanm patch. */
13 + extern int sqlite_shell_init_icu();
14 + if( !sqlite_shell_init_icu() ){
15 + fprintf(stderr, "%s: warning: couldn't find icudt38.dll; "
16 + "queries against ICU FTS tables will fail.\n", argv[0]);
17 + }
18 + /* End evanm patch. */
19 +
20 Argv0 = argv[0];
21 main_init(&data);
22 stdin_is_interactive = isatty(0);
23 Index: src/shell_icu_linux.c
24 ===================================================================
25 --- src/shell_icu_linux.c 1969-12-31 16:00:00.000000000 -0800
26 +++ src/shell_icu_linux.c 2009-09-17 13:48:49.000000000 -0700
27 @@ -0,0 +1,26 @@
28 +/* Copyright 2007 Google Inc. All Rights Reserved.
29 +**/
30 +
31 +#include <limits.h>
32 +#include <unistd.h>
33 +#include "unicode/udata.h"
34 +
35 +/*
36 +** This function attempts to load the ICU data tables from a data file.
37 +** Returns 0 on failure, nonzero on success.
38 +** This a hack job of icu_utils.cc:Initialize(). It's Chrome-specific code.
39 +*/
40 +int sqlite_shell_init_icu() {
41 + char bin_dir[PATH_MAX + 1];
42 + int bin_dir_size = readlink("/proc/self/exe", bin_dir, PATH_MAX);
43 + if (bin_dir_size < 0 || bin_dir_size > PATH_MAX)
44 + return 0;
45 + bin_dir[bin_dir_size] = 0;;
46 +
47 + u_setDataDirectory(bin_dir);
48 + // Only look for the packaged data file;
49 + // the default behavior is to look for individual files.
50 + UErrorCode err = U_ZERO_ERROR;
51 + udata_setFileAccess(UDATA_ONLY_PACKAGES, &err);
52 + return err == U_ZERO_ERROR;
53 +}
54 Index: src/shell_icu_win.c
55 ===================================================================
56 --- src/shell_icu_win.c 1969-12-31 16:00:00.000000000 -0800
57 +++ src/shell_icu_win.c 2011-03-03 14:29:11.000000000 -0700
58 @@ -0,0 +1,32 @@
59 +/* Copyright 2011 Google Inc. All Rights Reserved.
60 +**/
61 +
62 +#include <windows.h>
63 +#include "unicode/udata.h"
64 +
65 +/*
66 +** This function attempts to load the ICU data tables from a DLL.
67 +** Returns 0 on failure, nonzero on success.
68 +** This a hack job of icu_utils.cc:Initialize(). It's Chrome-specific code.
69 +*/
70 +
71 +#define ICU_DATA_SYMBOL "icudt" U_ICU_VERSION_SHORT "_dat"
72 +int sqlite_shell_init_icu() {
73 + HMODULE module;
74 + FARPROC addr;
75 + UErrorCode err;
76 +
77 + // Chrome dropped U_ICU_VERSION_SHORT from the icu data dll name.
78 + module = LoadLibrary(L"icudt.dll");
79 + if (!module)
80 + return 0;
81 +
82 + addr = GetProcAddress(module, ICU_DATA_SYMBOL);
83 + if (!addr)
84 + return 0;
85 +
86 + err = U_ZERO_ERROR;
87 + udata_setCommonData(addr, &err);
88 +
89 + return 1;
90 +}
OLDNEW
« no previous file with comments | « third_party/sqlite/README.chromium ('k') | third_party/sqlite/misc.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698