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

Side by Side Diff: base/i18n/icu_util.cc

Issue 3329012: Change ICU_UTIL_DATA_IMPL on Linux to match the reality.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/i18n/icu_util.h" 5 #include "base/i18n/icu_util.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 11 matching lines...) Expand all
22 #include "unicode/udata.h" 22 #include "unicode/udata.h"
23 23
24 #define ICU_UTIL_DATA_FILE 0 24 #define ICU_UTIL_DATA_FILE 0
25 #define ICU_UTIL_DATA_SHARED 1 25 #define ICU_UTIL_DATA_SHARED 1
26 #define ICU_UTIL_DATA_STATIC 2 26 #define ICU_UTIL_DATA_STATIC 2
27 27
28 #ifndef ICU_UTIL_DATA_IMPL 28 #ifndef ICU_UTIL_DATA_IMPL
29 29
30 #if defined(OS_WIN) 30 #if defined(OS_WIN)
31 #define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_SHARED 31 #define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_SHARED
32 #elif defined(OS_MACOSX) 32 #else
33 #define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_STATIC 33 #define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_STATIC
34 #elif defined(OS_POSIX)
35 #define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_FILE
36 #endif 34 #endif
37 35
38 #endif // ICU_UTIL_DATA_IMPL 36 #endif // ICU_UTIL_DATA_IMPL
39 37
40 #if defined(OS_WIN) 38 #if defined(OS_WIN)
41 #define ICU_UTIL_DATA_SYMBOL "icudt" U_ICU_VERSION_SHORT "_dat" 39 #define ICU_UTIL_DATA_SYMBOL "icudt" U_ICU_VERSION_SHORT "_dat"
42 #define ICU_UTIL_DATA_SHARED_MODULE_NAME "icudt" U_ICU_VERSION_SHORT ".dll" 40 #define ICU_UTIL_DATA_SHARED_MODULE_NAME "icudt" U_ICU_VERSION_SHORT ".dll"
43 #endif 41 #endif
44 42
45 namespace icu_util { 43 namespace icu_util {
(...skipping 24 matching lines...) Expand all
70 if (!addr) { 68 if (!addr) {
71 LOG(ERROR) << ICU_UTIL_DATA_SYMBOL << ": not found in " 69 LOG(ERROR) << ICU_UTIL_DATA_SYMBOL << ": not found in "
72 << ICU_UTIL_DATA_SHARED_MODULE_NAME; 70 << ICU_UTIL_DATA_SHARED_MODULE_NAME;
73 return false; 71 return false;
74 } 72 }
75 73
76 UErrorCode err = U_ZERO_ERROR; 74 UErrorCode err = U_ZERO_ERROR;
77 udata_setCommonData(reinterpret_cast<void*>(addr), &err); 75 udata_setCommonData(reinterpret_cast<void*>(addr), &err);
78 return err == U_ZERO_ERROR; 76 return err == U_ZERO_ERROR;
79 #elif (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_STATIC) 77 #elif (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_STATIC)
80 // Mac bundles the ICU data in. 78 // Mac/Linux bundle the ICU data in.
81 return true; 79 return true;
82 #elif (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE) 80 #elif (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE)
83 // For now, expect the data file to be alongside the executable. 81 // For now, expect the data file to be alongside the executable.
84 // This is sufficient while we work on unit tests, but will eventually 82 // This is sufficient while we work on unit tests, but will eventually
85 // likely live in a data directory. 83 // likely live in a data directory.
86 FilePath data_path; 84 FilePath data_path;
87 bool path_ok = PathService::Get(base::DIR_EXE, &data_path); 85 bool path_ok = PathService::Get(base::DIR_EXE, &data_path);
88 DCHECK(path_ok); 86 DCHECK(path_ok);
89 u_setDataDirectory(data_path.value().c_str()); 87 u_setDataDirectory(data_path.value().c_str());
90 // Only look for the packaged data file; 88 // Only look for the packaged data file;
91 // the default behavior is to look for individual files. 89 // the default behavior is to look for individual files.
92 UErrorCode err = U_ZERO_ERROR; 90 UErrorCode err = U_ZERO_ERROR;
93 udata_setFileAccess(UDATA_ONLY_PACKAGES, &err); 91 udata_setFileAccess(UDATA_ONLY_PACKAGES, &err);
94 return err == U_ZERO_ERROR; 92 return err == U_ZERO_ERROR;
95 #endif 93 #endif
96 } 94 }
97 95
98 } // namespace icu_util 96 } // namespace icu_util
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698