| 341 | } |
| 342 | |
| 343 | IDBDriver *DBManager::FindOrLoadDriver(const char *name) |
| 344 | { |
| 345 | size_t last_size = m_drivers.size(); |
| 346 | for (size_t i=0; i<last_size; i++) |
| 347 | { |
| 348 | if (strcmp(m_drivers[i]->GetIdentifier(), name) == 0) |
| 349 | { |
| 350 | return m_drivers[i]; |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | char filename[PLATFORM_MAX_PATH]; |
| 355 | g_pSM->Format(filename, sizeof(filename), "dbi.%s.ext", name); |
| 356 | |
| 357 | IExtension *pExt = g_Extensions.LoadAutoExtension(filename); |
| 358 | if (!pExt || !pExt->IsLoaded() || m_drivers.size() <= last_size) |
| 359 | { |
| 360 | return NULL; |
| 361 | } |
| 362 | |
| 363 | /* last_size is now gauranteed to be a valid index. |
| 364 | * The identifier must match the name. |
| 365 | */ |
| 366 | if (strcmp(m_drivers[last_size]->GetIdentifier(), name) == 0) |
| 367 | { |
| 368 | return m_drivers[last_size]; |
| 369 | } |
| 370 | |
| 371 | return NULL; |
| 372 | } |
| 373 | |
| 374 | void DBManager::KillWorkerThread() |
| 375 | { |
no test coverage detected