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

Side by Side Diff: base/icu_util.cc

Issue 172031: Update gyp files and DEPS for icu42 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | « base/base.gyp ('k') | build/all.gyp » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #endif 9 #endif
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #endif 55 #endif
56 56
57 #if (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_SHARED) 57 #if (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_SHARED)
58 // We expect to find the ICU data module alongside the current module. 58 // We expect to find the ICU data module alongside the current module.
59 std::wstring data_path; 59 std::wstring data_path;
60 PathService::Get(base::DIR_MODULE, &data_path); 60 PathService::Get(base::DIR_MODULE, &data_path);
61 file_util::AppendToPath(&data_path, 61 file_util::AppendToPath(&data_path,
62 ASCIIToWide(ICU_UTIL_DATA_SHARED_MODULE_NAME)); 62 ASCIIToWide(ICU_UTIL_DATA_SHARED_MODULE_NAME));
63 63
64 HMODULE module = LoadLibrary(data_path.c_str()); 64 HMODULE module = LoadLibrary(data_path.c_str());
65 if (!module) 65 if (!module) {
66 LOG(ERROR) << "Failed to load " << ICU_UTIL_DATA_SHARED_MODULE_NAME;
66 return false; 67 return false;
68 }
67 69
68 FARPROC addr = GetProcAddress(module, ICU_UTIL_DATA_SYMBOL); 70 FARPROC addr = GetProcAddress(module, ICU_UTIL_DATA_SYMBOL);
69 if (!addr) 71 if (!addr) {
72 LOG(ERROR) << ICU_UTIL_DATA_SYMBOL << ": not found in "
73 << ICU_UTIL_DATA_SHARED_MODULE_NAME;
70 return false; 74 return false;
75 }
71 76
72 UErrorCode err = U_ZERO_ERROR; 77 UErrorCode err = U_ZERO_ERROR;
73 udata_setCommonData(reinterpret_cast<void*>(addr), &err); 78 udata_setCommonData(reinterpret_cast<void*>(addr), &err);
74 return err == U_ZERO_ERROR; 79 return err == U_ZERO_ERROR;
75 #elif (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_STATIC) 80 #elif (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_STATIC)
76 // Mac bundles the ICU data in. 81 // Mac bundles the ICU data in.
77 return true; 82 return true;
78 #elif (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE) 83 #elif (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE)
79 // For now, expect the data file to be alongside the executable. 84 // For now, expect the data file to be alongside the executable.
80 // This is sufficient while we work on unit tests, but will eventually 85 // This is sufficient while we work on unit tests, but will eventually
81 // likely live in a data directory. 86 // likely live in a data directory.
82 FilePath data_path; 87 FilePath data_path;
83 bool path_ok = PathService::Get(base::DIR_EXE, &data_path); 88 bool path_ok = PathService::Get(base::DIR_EXE, &data_path);
84 DCHECK(path_ok); 89 DCHECK(path_ok);
85 u_setDataDirectory(data_path.value().c_str()); 90 u_setDataDirectory(data_path.value().c_str());
86 // Only look for the packaged data file; 91 // Only look for the packaged data file;
87 // the default behavior is to look for individual files. 92 // the default behavior is to look for individual files.
88 UErrorCode err = U_ZERO_ERROR; 93 UErrorCode err = U_ZERO_ERROR;
89 udata_setFileAccess(UDATA_ONLY_PACKAGES, &err); 94 udata_setFileAccess(UDATA_ONLY_PACKAGES, &err);
90 return err == U_ZERO_ERROR; 95 return err == U_ZERO_ERROR;
91 #endif 96 #endif
92 } 97 }
93 98
94 } // namespace icu_util 99 } // namespace icu_util
OLDNEW
« no previous file with comments | « base/base.gyp ('k') | build/all.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698