Commit c900357
committed
Reimplement GetWindowsLocalTimeZone without icu.h
This commit reimplements my previous commits [1][2], which removed the
dependency on WinRT on Windows by using system "icu.dll" (#315) when
<icu.h> is available in the build environment.
Here are major improvements:
* The relevant code is extracted into separate source files
"src/time_zone_name_win.{cc,h}". This is also a preparation for
implementing TimeZoneIf with Windows time APIs (#328), where one more
ICU API needs to be dynamically imported.
* The dependency on <icu.h> is removed by locally defining required
constants and API prototypes. This should make it possible to build
CCTZ with the MinGW toolchain, where <icu.h> is not yet available.
* LoadLibraryExW(L"icu.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32) is
replaced with LoadLibraryW with the full path to "icu.dll" in the
System32 directory, because LOAD_LIBRARY_SEARCH_SYSTEM32 can be
ignored when "icu.dll" is already loaded from a non-System32
directory. Let's stick to the system "icu.dll" in favor of
predictability.
Other than the above improvements, the overall logic remains unchanged.
[1]: 2ebbe0d
[2]: f8e494f1 parent c8bc1fb commit c900357
1 file changed
+13
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
| 33 | + | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
| 52 | + | |
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
| |||
61 | 60 | | |
62 | 61 | | |
63 | 62 | | |
64 | | - | |
65 | | - | |
| 63 | + | |
| 64 | + | |
66 | 65 | | |
67 | 66 | | |
68 | | - | |
69 | | - | |
| 67 | + | |
70 | 68 | | |
71 | 69 | | |
72 | 70 | | |
| |||
129 | 127 | | |
130 | 128 | | |
131 | 129 | | |
132 | | - | |
133 | | - | |
| 130 | + | |
| 131 | + | |
134 | 132 | | |
135 | 133 | | |
136 | 134 | | |
137 | 135 | | |
138 | | - | |
139 | | - | |
| 136 | + | |
140 | 137 | | |
141 | 138 | | |
142 | 139 | | |
| |||
156 | 153 | | |
157 | 154 | | |
158 | 155 | | |
159 | | - | |
160 | | - | |
161 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
162 | 159 | | |
163 | 160 | | |
164 | | - | |
165 | 161 | | |
166 | | - | |
167 | | - | |
| 162 | + | |
168 | 163 | | |
169 | 164 | | |
170 | 165 | | |
| |||
0 commit comments