8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16:43:03 +01:00

Fix mismatched-new-delete warnings

This commit is contained in:
Ilya Eremin 2024-12-26 16:43:28 +03:00 committed by Alexander Peshkov
parent 2423a1487b
commit b1ef0e3c52
7 changed files with 16 additions and 41 deletions

View File

@ -465,7 +465,7 @@ void callRemoteServiceManager(ISC_STATUS* status,
{ {
const char request[] = {isc_info_svc_get_users}; const char request[] = {isc_info_svc_get_users};
int startQuery = 0; int startQuery = 0;
Auth::StackUserData uData; Auth::UserData uData;
for (;;) for (;;)
{ {

View File

@ -155,7 +155,7 @@ private:
typedef Firebird::Array<UCHAR> AuthenticationBlock; typedef Firebird::Array<UCHAR> AuthenticationBlock;
class UserData : class UserData final :
public Firebird::VersionedIface<Firebird::IUserImpl<UserData, Firebird::CheckStatusWrapper> > public Firebird::VersionedIface<Firebird::IUserImpl<UserData, Firebird::CheckStatusWrapper> >
{ {
public: public:
@ -233,31 +233,6 @@ public:
IntField u, g; IntField u, g;
}; };
class StackUserData final : public UserData
{
public:
void* operator new(size_t, void* memory) noexcept
{
return memory;
}
};
class DynamicUserData final : public UserData
{
public:
#ifdef DEBUG_GDS_ALLOC
void* operator new(size_t size, Firebird::MemoryPool& pool, const char* fileName, int line)
{
return pool.allocate(size, fileName, line);
}
#else // DEBUG_GDS_ALLOC
void* operator new(size_t size, Firebird::MemoryPool& pool)
{
return pool.allocate(size);
}
#endif // DEBUG_GDS_ALLOC
};
class Get : public Firebird::GetPlugins<Firebird::IManagement> class Get : public Firebird::GetPlugins<Firebird::IManagement>
{ {
public: public:

View File

@ -11352,7 +11352,7 @@ void CreateAlterUserNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScra
// run all statements under savepoint control // run all statements under savepoint control
AutoSavePoint savePoint(tdbb, transaction); AutoSavePoint savePoint(tdbb, transaction);
Auth::DynamicUserData* userData = FB_NEW_POOL(*transaction->tra_pool) Auth::DynamicUserData; Auth::UserData* userData = FB_NEW_POOL(*transaction->tra_pool) Auth::UserData;
MetaName text(name); MetaName text(name);
if (text.isEmpty() && mode == USER_MOD) if (text.isEmpty() && mode == USER_MOD)
@ -11469,7 +11469,7 @@ void DropUserNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jr
// run all statements under savepoint control // run all statements under savepoint control
AutoSavePoint savePoint(tdbb, transaction); AutoSavePoint savePoint(tdbb, transaction);
Auth::DynamicUserData* userData = FB_NEW_POOL(*transaction->tra_pool) Auth::DynamicUserData; Auth::UserData* userData = FB_NEW_POOL(*transaction->tra_pool) Auth::UserData;
string text = name.c_str(); string text = name.c_str();

View File

@ -314,7 +314,7 @@ void UserManagement::commit()
} }
} }
USHORT UserManagement::put(Auth::DynamicUserData* userData) USHORT UserManagement::put(Auth::UserData* userData)
{ {
const FB_SIZE_T ret = commands.getCount(); const FB_SIZE_T ret = commands.getCount();
if (ret > MAX_USHORT) if (ret > MAX_USHORT)
@ -379,7 +379,7 @@ void UserManagement::execute(USHORT id)
if (command->attr.entered() || command->op == Auth::ADDMOD_OPER) if (command->attr.entered() || command->op == Auth::ADDMOD_OPER)
{ {
Auth::StackUserData cmd; Auth::UserData cmd;
cmd.op = Auth::DIS_OPER; cmd.op = Auth::DIS_OPER;
cmd.user.set(&statusWrapper, command->userName()->get()); cmd.user.set(&statusWrapper, command->userName()->get());
check(&statusWrapper); check(&statusWrapper);
@ -614,7 +614,7 @@ RecordBuffer* UserManagement::getList(thread_db* tdbb, jrd_rel* relation)
for (FillSnapshot fillSnapshot(this); fillSnapshot.pos < managers.getCount(); ++fillSnapshot.pos) for (FillSnapshot fillSnapshot(this); fillSnapshot.pos < managers.getCount(); ++fillSnapshot.pos)
{ {
Auth::StackUserData u; Auth::UserData u;
u.op = Auth::DIS_OPER; u.op = Auth::DIS_OPER;
*ec = managers[fillSnapshot.pos].second->execute(currentWrapper, &u, &fillSnapshot); *ec = managers[fillSnapshot.pos].second->execute(currentWrapper, &u, &fillSnapshot);

View File

@ -59,7 +59,7 @@ public:
~UserManagement(); ~UserManagement();
// store userData for DFW-time processing // store userData for DFW-time processing
USHORT put(Auth::DynamicUserData* userData); USHORT put(Auth::UserData* userData);
// execute command with ID // execute command with ID
void execute(USHORT id); void execute(USHORT id);
// commit transaction in security database // commit transaction in security database
@ -71,7 +71,7 @@ public:
private: private:
thread_db* threadDbb; thread_db* threadDbb;
Firebird::HalfStaticArray<Auth::DynamicUserData*, 8> commands; Firebird::HalfStaticArray<Auth::UserData*, 8> commands;
typedef Firebird::Pair<Firebird::NonPooled<MetaName, Firebird::IManagement*> > Manager; typedef Firebird::Pair<Firebird::NonPooled<MetaName, Firebird::IManagement*> > Manager;
Firebird::ObjectsArray<Manager> managers; Firebird::ObjectsArray<Manager> managers;
Firebird::NoCaseString plugins; Firebird::NoCaseString plugins;

View File

@ -308,7 +308,7 @@ namespace {
public Firebird::AutoIface<Firebird::IListUsersImpl<Callback, Firebird::CheckStatusWrapper> > public Firebird::AutoIface<Firebird::IListUsersImpl<Callback, Firebird::CheckStatusWrapper> >
{ {
public: public:
explicit Callback(StackUserData* pu) explicit Callback(UserData* pu)
: u(pu) : u(pu)
{ } { }
@ -329,7 +329,7 @@ namespace {
} }
private: private:
StackUserData* u; UserData* u;
}; };
} // anonymous namespace } // anonymous namespace
@ -356,7 +356,7 @@ int gsec(Firebird::UtilSvc* uSvc)
tsec* tdsec = &tsecInstance; tsec* tdsec = &tsecInstance;
tsec::putSpecific(tdsec); tsec::putSpecific(tdsec);
StackUserData u; UserData u;
tdsec->tsec_user_data = &u; tdsec->tsec_user_data = &u;
Firebird::LocalStatus lsManager; Firebird::LocalStatus lsManager;
@ -549,7 +549,7 @@ int gsec(Firebird::UtilSvc* uSvc)
if (user_data->operation() == MOD_OPER && user_data->userName()->entered() && if (user_data->operation() == MOD_OPER && user_data->userName()->entered() &&
(fieldSet(&user_data->u) || fieldSet(&user_data->g) || fieldSet(&user_data->group))) (fieldSet(&user_data->u) || fieldSet(&user_data->g) || fieldSet(&user_data->group)))
{ {
StackUserData u; UserData u;
u.op = DIS_OPER; u.op = DIS_OPER;
u.user.set(&statusWrapper, user_data->userName()->get()); u.user.set(&statusWrapper, user_data->userName()->get());
check(&statusWrapper); check(&statusWrapper);

View File

@ -862,7 +862,7 @@ ISC_STATUS API_ROUTINE isc_add_user(ISC_STATUS* status, const USER_SEC_DATA* inp
* Return > 0 if any error occurs. * Return > 0 if any error occurs.
* *
**************************************/ **************************************/
Auth::StackUserData userInfo; Auth::UserData userInfo;
userInfo.op = Auth::ADD_OPER; userInfo.op = Auth::ADD_OPER;
Firebird::LocalStatus s; Firebird::LocalStatus s;
Firebird::CheckStatusWrapper statusWrapper(&s); Firebird::CheckStatusWrapper statusWrapper(&s);
@ -925,7 +925,7 @@ ISC_STATUS API_ROUTINE isc_delete_user(ISC_STATUS* status, const USER_SEC_DATA*
* Return > 0 if any error occurs. * Return > 0 if any error occurs.
* *
**************************************/ **************************************/
Auth::StackUserData userInfo; Auth::UserData userInfo;
userInfo.op = Auth::DEL_OPER; userInfo.op = Auth::DEL_OPER;
Firebird::LocalStatus s; Firebird::LocalStatus s;
Firebird::CheckStatusWrapper statusWrapper(&s); Firebird::CheckStatusWrapper statusWrapper(&s);
@ -970,7 +970,7 @@ ISC_STATUS API_ROUTINE isc_modify_user(ISC_STATUS* status, const USER_SEC_DATA*
* Return > 0 if any error occurs. * Return > 0 if any error occurs.
* *
**************************************/ **************************************/
Auth::StackUserData userInfo; Auth::UserData userInfo;
userInfo.op = Auth::MOD_OPER; userInfo.op = Auth::MOD_OPER;
Firebird::LocalStatus s; Firebird::LocalStatus s;
Firebird::CheckStatusWrapper statusWrapper(&s); Firebird::CheckStatusWrapper statusWrapper(&s);