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

Unified Diff: third_party/sqlite/src/src/shell_icu_linux.c

Issue 694353003: Get `gn gen` to succeed on Windows (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: remove GYP_DEFINES code Created 6 years, 1 month 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
« no previous file with comments | « third_party/sqlite/src/src/shell.c ('k') | third_party/sqlite/src/src/shell_icu_win.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/src/shell_icu_linux.c
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 0000000000000000000000000000000000000000..4ad0e42d22938fafc663a354a5381da96cb7e61b
--- /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;
+}
« no previous file with comments | « third_party/sqlite/src/src/shell.c ('k') | third_party/sqlite/src/src/shell_icu_win.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698