From 9995e1749a3eabca54973b07b5cb0e9ea6bcd025 Mon Sep 17 00:00:00 2001 From: "tc@google.com" Date: Mon, 16 Mar 2009 22:37:01 +0000 Subject: Build the sqlite shell via scons on linux so we can debug the full text indexed sqlite files. Review URL: http://codereview.chromium.org/42250 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11789 0039d316-1c4b-4281-b951-d872f2087c98 --- third_party/sqlite/src/shell_icu.c | 29 ----------------------------- third_party/sqlite/src/shell_icu_linux.c | 26 ++++++++++++++++++++++++++ third_party/sqlite/src/shell_icu_win.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 29 deletions(-) delete mode 100755 third_party/sqlite/src/shell_icu.c create mode 100755 third_party/sqlite/src/shell_icu_linux.c create mode 100755 third_party/sqlite/src/shell_icu_win.c (limited to 'third_party/sqlite/src') diff --git a/third_party/sqlite/src/shell_icu.c b/third_party/sqlite/src/shell_icu.c deleted file mode 100755 index d68cf8f..0000000 --- a/third_party/sqlite/src/shell_icu.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2007 Google Inc. All Rights Reserved. -**/ - -#include -#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. -*/ -int sqlite_shell_init_icu() { - HMODULE module; - FARPROC addr; - UErrorCode err; - - module = LoadLibrary(L"icudt38.dll"); - if (!module) - return 0; - - addr = GetProcAddress(module, "icudt38_dat"); - if (!addr) - return 0; - - err = U_ZERO_ERROR; - udata_setCommonData(addr, &err); - - return 1; -} diff --git a/third_party/sqlite/src/shell_icu_linux.c b/third_party/sqlite/src/shell_icu_linux.c new file mode 100755 index 0000000..8194db5 --- /dev/null +++ b/third_party/sqlite/src/shell_icu_linux.c @@ -0,0 +1,26 @@ +/* Copyright 2007 Google Inc. All Rights Reserved. +**/ + +#include +#include +#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/shell_icu_win.c b/third_party/sqlite/src/shell_icu_win.c new file mode 100755 index 0000000..d68cf8f --- /dev/null +++ b/third_party/sqlite/src/shell_icu_win.c @@ -0,0 +1,29 @@ +/* Copyright 2007 Google Inc. All Rights Reserved. +**/ + +#include +#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. +*/ +int sqlite_shell_init_icu() { + HMODULE module; + FARPROC addr; + UErrorCode err; + + module = LoadLibrary(L"icudt38.dll"); + if (!module) + return 0; + + addr = GetProcAddress(module, "icudt38_dat"); + if (!addr) + return 0; + + err = U_ZERO_ERROR; + udata_setCommonData(addr, &err); + + return 1; +} -- cgit v1.1