OLD | NEW |
---|---|
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 // Assert that we are not called more than once. Even though calling this | 49 // Assert that we are not called more than once. Even though calling this |
50 // function isn't harmful (ICU can handle it), being called twice probably | 50 // function isn't harmful (ICU can handle it), being called twice probably |
51 // indicates a programming error. | 51 // indicates a programming error. |
52 static bool called_once = false; | 52 static bool called_once = false; |
53 DCHECK(!called_once); | 53 DCHECK(!called_once); |
54 called_once = true; | 54 called_once = true; |
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 FilePath 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 data_path = data_path.Append(ASCIIToWide(ICU_UTIL_DATA_SHARED_MODULE_NAME)); |
tony
2009/10/19 22:46:49
Nit: AppendASCII?
| |
62 ASCIIToWide(ICU_UTIL_DATA_SHARED_MODULE_NAME)); | |
63 | 62 |
64 HMODULE module = LoadLibrary(data_path.c_str()); | 63 HMODULE module = LoadLibrary(data_path.value().c_str()); |
65 if (!module) { | 64 if (!module) { |
66 LOG(ERROR) << "Failed to load " << ICU_UTIL_DATA_SHARED_MODULE_NAME; | 65 LOG(ERROR) << "Failed to load " << ICU_UTIL_DATA_SHARED_MODULE_NAME; |
67 return false; | 66 return false; |
68 } | 67 } |
69 | 68 |
70 FARPROC addr = GetProcAddress(module, ICU_UTIL_DATA_SYMBOL); | 69 FARPROC addr = GetProcAddress(module, ICU_UTIL_DATA_SYMBOL); |
71 if (!addr) { | 70 if (!addr) { |
72 LOG(ERROR) << ICU_UTIL_DATA_SYMBOL << ": not found in " | 71 LOG(ERROR) << ICU_UTIL_DATA_SYMBOL << ": not found in " |
73 << ICU_UTIL_DATA_SHARED_MODULE_NAME; | 72 << ICU_UTIL_DATA_SHARED_MODULE_NAME; |
74 return false; | 73 return false; |
(...skipping 15 matching lines...) Expand all Loading... | |
90 u_setDataDirectory(data_path.value().c_str()); | 89 u_setDataDirectory(data_path.value().c_str()); |
91 // Only look for the packaged data file; | 90 // Only look for the packaged data file; |
92 // the default behavior is to look for individual files. | 91 // the default behavior is to look for individual files. |
93 UErrorCode err = U_ZERO_ERROR; | 92 UErrorCode err = U_ZERO_ERROR; |
94 udata_setFileAccess(UDATA_ONLY_PACKAGES, &err); | 93 udata_setFileAccess(UDATA_ONLY_PACKAGES, &err); |
95 return err == U_ZERO_ERROR; | 94 return err == U_ZERO_ERROR; |
96 #endif | 95 #endif |
97 } | 96 } |
98 | 97 |
99 } // namespace icu_util | 98 } // namespace icu_util |
OLD | NEW |