mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 23:23:04 +01:00
Related to CORE-5830 and auto pointers changes, suggested by Vlad
This commit is contained in:
parent
01b108858a
commit
6bc775c4ab
@ -155,6 +155,15 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <typename P>
|
||||
class AutoPlugin : public AutoPtr<P, ReleasePlugin>
|
||||
{
|
||||
public:
|
||||
AutoPlugin(P* p = NULL)
|
||||
: AutoPtr<P, ReleasePlugin>(p)
|
||||
{ }
|
||||
};
|
||||
|
||||
} // namespace Firebird
|
||||
|
||||
|
||||
|
@ -178,12 +178,12 @@ private:
|
||||
};
|
||||
|
||||
|
||||
template <typename ID>
|
||||
class AutoDispose : public AutoPtr<ID, SimpleDispose>
|
||||
template <typename Where>
|
||||
class AutoDispose : public AutoPtr<Where, SimpleDispose>
|
||||
{
|
||||
public:
|
||||
AutoDispose(ID* v = NULL)
|
||||
: AutoPtr<ID, SimpleDispose>(v)
|
||||
AutoDispose(Where* v = NULL)
|
||||
: AutoPtr<Where, SimpleDispose>(v)
|
||||
{ }
|
||||
};
|
||||
|
||||
|
@ -732,7 +732,7 @@ namespace Jrd {
|
||||
continue;
|
||||
|
||||
// validate a key
|
||||
AutoPtr<IDbCryptPlugin, ReleasePlugin> crypt(checkFactory->makeInstance());
|
||||
AutoPlugin<IDbCryptPlugin> crypt(checkFactory->makeInstance());
|
||||
setDbInfo(crypt);
|
||||
crypt->setKey(&st, 1, &keyHolder, keyName.c_str());
|
||||
|
||||
@ -950,7 +950,7 @@ namespace Jrd {
|
||||
releaseGuard.enter();
|
||||
if (!down)
|
||||
{
|
||||
AutoPtr<JProvider, ReleasePlugin> jInstance(JProvider::getInstance());
|
||||
AutoPlugin<JProvider> jInstance(JProvider::getInstance());
|
||||
jInstance->setDbCryptCallback(&status_vector, dbb.dbb_callback);
|
||||
check(&status_vector);
|
||||
|
||||
|
@ -331,13 +331,12 @@ public:
|
||||
bool active;
|
||||
};
|
||||
|
||||
static Database* create(Firebird::IPluginConfig* pConf, Firebird::ICryptKeyCallback* cb, bool shared)
|
||||
static Database* create(Firebird::IPluginConfig* pConf, bool shared)
|
||||
{
|
||||
Firebird::MemoryStats temp_stats;
|
||||
MemoryPool* const pool = MemoryPool::createPool(NULL, temp_stats);
|
||||
Database* const dbb = FB_NEW_POOL(*pool) Database(pool, pConf, shared);
|
||||
pool->setStatsGroup(dbb->dbb_memory_stats);
|
||||
dbb->dbb_callback = cb;
|
||||
return dbb;
|
||||
}
|
||||
|
||||
|
@ -603,7 +603,7 @@ ExtEngineManager::ExternalContextImpl::ExternalContextImpl(thread_db* tdbb,
|
||||
internalAttachment->getStable()->addRef();
|
||||
|
||||
externalAttachment = MasterInterfacePtr()->registerAttachment
|
||||
(AutoPtr<JProvider, ReleasePlugin>(JProvider::getInstance()), internalAttachment->getInterface());
|
||||
(AutoPlugin<JProvider>(JProvider::getInstance()), internalAttachment->getInterface());
|
||||
}
|
||||
|
||||
ExtEngineManager::ExternalContextImpl::~ExternalContextImpl()
|
||||
|
@ -167,7 +167,7 @@ void InternalConnection::attach(thread_db* tdbb, const PathName& dbName,
|
||||
FbLocalStatus status;
|
||||
{
|
||||
EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION);
|
||||
AutoPtr<JProvider, ReleasePlugin> jInstance(JProvider::getInstance());
|
||||
AutoPlugin<JProvider> jInstance(JProvider::getInstance());
|
||||
jInstance->setDbCryptCallback(&status, tdbb->getAttachment()->att_crypt_callback);
|
||||
m_attachment.assignRefNoIncr(jInstance->attachDatabase(&status, m_dbName.c_str(),
|
||||
newDpb.getBufferLength(), newDpb.getBuffer()));
|
||||
|
@ -389,7 +389,7 @@ static void shutdownBeforeUnload()
|
||||
LocalStatus status;
|
||||
CheckStatusWrapper statusWrapper(&status);
|
||||
|
||||
AutoPtr<JProvider, ReleasePlugin>(JProvider::getInstance())->shutdown(&statusWrapper, 0, fb_shutrsn_exit_called);
|
||||
AutoPlugin<JProvider>(JProvider::getInstance())->shutdown(&statusWrapper, 0, fb_shutrsn_exit_called);
|
||||
threadDetach();
|
||||
};
|
||||
|
||||
@ -6123,9 +6123,10 @@ static JAttachment* initAttachment(thread_db* tdbb, const PathName& expanded_nam
|
||||
|
||||
Config::merge(config, &options.dpb_config);
|
||||
|
||||
dbb = Database::create(pConf, provider->getCryptCallback(), shared);
|
||||
dbb = Database::create(pConf, shared);
|
||||
dbb->dbb_config = config;
|
||||
dbb->dbb_filename = expanded_name;
|
||||
dbb->dbb_callback = provider->getCryptCallback();
|
||||
#ifdef HAVE_ID_BY_NAME
|
||||
dbb->dbb_id = db_id; // will be reassigned in create database after PIO operation
|
||||
#endif
|
||||
|
@ -732,7 +732,7 @@ static int validate(Firebird::UtilSvc* svc)
|
||||
dpb.insertPath(isc_dpb_org_filename, dbName);
|
||||
|
||||
FbLocalStatus status;
|
||||
AutoPtr<JProvider, ReleasePlugin> jProv(JProvider::getInstance());
|
||||
AutoPlugin<JProvider> jProv(JProvider::getInstance());
|
||||
RefPtr<JAttachment> jAtt;
|
||||
jAtt.assignRefNoIncr(jProv->attachDatabase(&status, expandedFilename.c_str(), dpb.getBufferLength(), dpb.getBuffer()));
|
||||
|
||||
|
@ -410,7 +410,7 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
user_data->database.set(&statusWrapper, databaseName.c_str());
|
||||
check(&statusWrapper);
|
||||
|
||||
Firebird::AutoPtr<Firebird::IManagement, Firebird::ReleasePlugin> manager;
|
||||
Firebird::AutoPlugin<Firebird::IManagement> manager;
|
||||
ISC_STATUS_ARRAY status;
|
||||
|
||||
if (!useServices)
|
||||
@ -473,7 +473,7 @@ int gsec(Firebird::UtilSvc* uSvc)
|
||||
try
|
||||
{
|
||||
Get getPlugin(pseudoConfig);
|
||||
manager = getPlugin.plugin();
|
||||
manager.reset(getPlugin.plugin());
|
||||
if (!manager)
|
||||
{
|
||||
GSEC_error_redirect((Firebird::Arg::Gds(isc_random) <<
|
||||
|
Loading…
Reference in New Issue
Block a user