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

Method formatAndLoad

src/common/unicode_util.cpp:135–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133};
134
135ModuleLoader::Module* BaseICU::formatAndLoad(const char* templateName)
136{
137 ModuleLoader::Module* module = nullptr;
138
139 // System-wide ICU have no version number at file names
140 if (isSystem)
141 {
142 PathName filename;
143 filename.printf(templateName, "");
144 filename.rtrim(".");
145
146 //gds__log("ICU: link %s", filename.c_str());
147
148 module = ModuleLoader::fixAndLoadModule(NULL, filename);
149 }
150 else
151 {
152 fb_assert(majorVersion);
153
154 // ICU has several schemas for placing version into file name
155 const char* const patterns[] =
156 {
157#ifdef WIN_NT
158 "%d",
159#endif
160 "%d.%d",
161 "%d_%d",
162 "%d%d"
163 };
164
165 PathName s, filename;
166 for (auto pattern : patterns)
167 {
168 s.printf(pattern, majorVersion, minorVersion);
169 filename.printf(templateName, s.c_str());
170
171 module = ModuleLoader::fixAndLoadModule(NULL, filename);
172 if (module)
173 break;
174 }
175
176#ifndef WIN_NT
177 // There is no sence to try pattern "%d" for different minor versions
178 // ASF: In Windows ICU 63.1 libraries use 63.dll suffix. This is handled in 'patterns' above.
179 if (!module && minorVersion == 0)
180 {
181 s.printf("%d", majorVersion);
182 filename.printf(templateName, s.c_str());
183
184 module = ModuleLoader::fixAndLoadModule(NULL, filename);
185 }
186#endif
187 }
188
189 return module;
190}
191
192void BaseICU::initialize(ModuleLoader::Module* module)

Callers 1

loadICUMethod · 0.80

Calls 3

rtrimMethod · 0.80
printfMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected