MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / initialize

Method initialize

src/common/unicode_util.cpp:192–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192void BaseICU::initialize(ModuleLoader::Module* module)
193{
194 getEntryPoint("u_getVersion", module, u_getVersion);
195
196 UVersionInfo versionInfo;
197 u_getVersion(versionInfo);
198
199 if (!isSystem && (versionInfo[0] != majorVersion || versionInfo[1] != minorVersion))
200 {
201 string err;
202 err.printf(
203 "Wrong version of icu module: loaded %d.%d, expected %d.%d",
204 (int) versionInfo[0], (int) versionInfo[1],
205 this->majorVersion, this->minorVersion);
206
207 (Arg::Gds(isc_random) << Arg::Str(err)).raise();
208 }
209
210 majorVersion = versionInfo[0];
211 minorVersion = versionInfo[1];
212
213 void (U_EXPORT2 *uInit)(UErrorCode* status);
214 void (U_EXPORT2 *uSetTimeZoneFilesDirectory)(const char* path, UErrorCode* status);
215 void (U_EXPORT2 *uSetDataDirectory)(const char* directory);
216
217 getEntryPoint("u_init", module, uInit, true);
218 getEntryPoint("u_setTimeZoneFilesDirectory", module, uSetTimeZoneFilesDirectory, true);
219 const auto uSetDataDirectorySymbolName = getEntryPoint("u_setDataDirectory", module, uSetDataDirectory, true);
220
221 if (uSetDataDirectory)
222 {
223 // call uSetDataDirectory only if .dat file exists at same folder as the loaded module
224
225 ObjectsArray<PathName> pathsToTry;
226 PathName file;
227
228 { // scope
229 PathName modulePathName;
230 if (!module->getRealPath(uSetDataDirectorySymbolName.c_str(), modulePathName))
231 modulePathName = module->fileName;
232
233 PathName path;
234 PathUtils::splitLastComponent(path, file, modulePathName);
235
236 if (path.hasData())
237 pathsToTry.add(path);
238 }
239
240 pathsToTry.add(Config::getRootDirectory());
241
242 file.printf("icudt%u%c.dat", majorVersion,
243#ifdef WORDS_BIGENDIAN
244 'b'
245#else
246 'l'
247#endif
248 );
249

Callers 3

loadICUMethod · 0.45
isc_sync.cppFile · 0.45
SharedMemoryBaseMethod · 0.45

Calls 8

GdsClass · 0.85
StrClass · 0.85
printfMethod · 0.45
raiseMethod · 0.45
getRealPathMethod · 0.45
c_strMethod · 0.45
hasDataMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected