8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 18:43:02 +01:00
This commit is contained in:
robocop 2011-06-24 06:34:16 +00:00
parent 41624d488b
commit 5ad96271e6
26 changed files with 58 additions and 56 deletions

View File

@ -716,8 +716,8 @@ FB_UDR_BEGIN_FUNCTION(sum_args)
outMessage.setNull(retDesc, true);
return;
}
else
ret += inMessage[numDesc];
ret += inMessage[numDesc];
}
outMessage[retDesc] = ret;

View File

@ -105,7 +105,7 @@ private:
class Utf8CharSet
{
public:
Utf8CharSet(MemoryPool& pool);
explicit Utf8CharSet(MemoryPool& pool);
public:
charset obj;

View File

@ -171,7 +171,7 @@ template <typename C>
class AccessAutoInterface
{
public:
AccessAutoInterface(C* aPtr)
explicit AccessAutoInterface(C* aPtr)
: ptr(aPtr)
{ }
@ -206,7 +206,7 @@ public:
PluginManagerInterfacePtr()
: AccessAutoInterface<IPluginManager>(MasterInterfacePtr()->getPluginManager())
{ }
PluginManagerInterfacePtr(IMaster* master)
explicit PluginManagerInterfacePtr(IMaster* master)
: AccessAutoInterface<IPluginManager>(master->getPluginManager())
{ }
};

View File

@ -153,7 +153,6 @@ bool SyncObject::lockConditional(SyncType type)
}
}
return false;
}
else
{
@ -180,8 +179,9 @@ bool SyncObject::lockConditional(SyncType type)
}
}
return false;
}
return false;
}
void SyncObject::unlock(Sync* sync, SyncType type)
@ -366,7 +366,7 @@ void SyncObject::grantLocks()
}
}
void SyncObject::validate(SyncType lockType)
void SyncObject::validate(SyncType lockType) const
{
switch (lockType)
{

View File

@ -99,7 +99,7 @@ protected:
void wait(SyncType type, ThreadSync* thread, Sync* sync);
ThreadSync* grantThread(ThreadSync* thread);
void grantLocks();
void validate(SyncType lockType);
void validate(SyncType lockType) const;
AtomicCounter lockState;
AtomicCounter waiters;
@ -207,7 +207,7 @@ public:
class SyncUnlockGuard
{
public:
SyncUnlockGuard(Sync& aSync) :
explicit SyncUnlockGuard(Sync& aSync) :
sync(aSync)
{
oldState = sync.getState();

View File

@ -239,7 +239,7 @@ FB_THREAD_ID ThreadSync::getCurrentThreadId()
}
const char* ThreadSync::getWhere()
const char* ThreadSync::getWhere() const
{
if (lockPending && lockPending->where)
return lockPending->where;

View File

@ -76,14 +76,14 @@ class ThreadSync : public Synchronize
friend class SyncObject;
public:
ThreadSync(const char* desc);
explicit ThreadSync(const char* desc);
virtual ~ThreadSync();
static ThreadSync* findThread();
static ThreadSync* getThread(const char* desc);
static FB_THREAD_ID getCurrentThreadId();
const char* getWhere();
const char* getWhere() const;
static void validateLocks();

View File

@ -132,7 +132,7 @@ public:
class SyncGuard
{
public:
SyncGuard(Attachment* att, bool optional = false)
explicit SyncGuard(Attachment* att, bool optional = false)
: m_mutex(NULL)
{
if (att && att->att_interface)
@ -161,7 +161,7 @@ public:
class Checkout
{
public:
Checkout(Attachment* att, bool optional = false)
explicit Checkout(Attachment* att, bool optional = false)
: m_mutex(NULL)
{
if (att && att->att_interface)

View File

@ -773,7 +773,7 @@ void DatabaseSnapshot::dumpData(thread_db* tdbb)
// Attachment information
Attachment* old_attachment = tdbb->getAttachment();
Attachment* const old_attachment = tdbb->getAttachment();
try
{
Attachment::Checkout attCout(old_attachment, true);

View File

@ -299,7 +299,7 @@ public:
virtual void FB_CARG drop(Firebird::IStatus* status);
public:
JAttachment(Attachment* handle);
explicit JAttachment(Attachment* handle);
Attachment* getHandle()
{
@ -338,7 +338,7 @@ private:
class SysAttachment : public JAttachment
{
public:
SysAttachment(Attachment* handle)
explicit SysAttachment(Attachment* handle)
: JAttachment(handle)
{
}
@ -376,7 +376,7 @@ public:
unsigned int spbLength, const unsigned char* spb);
public:
JService(Service* handle);
explicit JService(Service* handle);
private:
Service* svc;

View File

@ -466,7 +466,7 @@ void ExtEngineManager::Trigger::execute(thread_db* tdbb, ExternalTrigger::Action
if (align)
pos = FB_ALIGN(pos, align);
unsigned dataPos = pos;
const unsigned dataPos = pos;
pos += desc.dsc_length;
align = type_alignments[dtype_short];
@ -506,7 +506,8 @@ void ExtEngineManager::Trigger::setValues(thread_db* /*tdbb*/, Array<UCHAR>& msg
dsc desc;
EVL_field(rpb->rpb_relation, record, i, &desc);
// CVC: I'm not sure why it's not important to check EVL_field's result.
unsigned align = type_alignments[desc.dsc_dtype];
if (align)
msgBuffer.resize(FB_ALIGN(msgBuffer.getCount(), align));

View File

@ -64,7 +64,7 @@ private:
public Firebird::PermanentStorage
{
public:
RoutineMetadata(MemoryPool& pool)
explicit RoutineMetadata(MemoryPool& pool)
: PermanentStorage(pool),
package(pool),
name(pool),

View File

@ -55,7 +55,7 @@ void GarbageCollector::RelationData::addPage(const ULONG pageno, const SLONG tra
// search for given page at other transactions bitmaps
// if found at older tx - we are done, just return
// if found at yanger tx - clear it as page should be set at oldest tx (our)
// if found at younger tx - clear it as page should be set at oldest tx (our)
TranData::ConstAccessor accessor(&m_tranData);
if (accessor.getFirst())
{
@ -75,16 +75,10 @@ void GarbageCollector::RelationData::addPage(const ULONG pageno, const SLONG tra
} while(accessor.getNext());
}
// add page to the our tx bitmap
if (bm)
{
PBM_SET(&m_pool, &bm, pageno);
}
else
{
PBM_SET(&m_pool, &bm, pageno);
// add page to our tx bitmap
PBM_SET(&m_pool, &bm, pageno);
if (!bm)
m_tranData.put(tranid, bm);
}
}
@ -136,8 +130,8 @@ SLONG GarbageCollector::RelationData::minTranID() const
TranData::ConstAccessor accessor(&m_tranData);
if (accessor.getFirst())
return accessor.current()->first;
else
return MAX_TRA_NUMBER;
return MAX_TRA_NUMBER;
}

View File

@ -984,7 +984,7 @@ void CCH_fini(thread_db* tdbb)
SET_TDBB(tdbb);
Database* dbb = tdbb->getDatabase();
BufferControl* bcb = dbb->dbb_bcb;
if (!dbb->dbb_bcb)
if (!bcb)
return;
bool flush_error = false;
@ -3572,7 +3572,7 @@ static void expand_buffers(thread_db* tdbb, ULONG number)
const bcb_repeat* const old_end = bcb->bcb_rpt + bcb->bcb_count;
bcb_repeat* new_rpt = FB_NEW(*bcb->bcb_bufferpool) bcb_repeat[number];
bcb_repeat* old_rpt = bcb->bcb_rpt;
bcb_repeat* const old_rpt = bcb->bcb_rpt;
bcb->bcb_rpt = new_rpt;
bcb->bcb_count = number;
@ -3913,12 +3913,14 @@ static BufferDesc* get_buffer(thread_db* tdbb, const PageNumber page, SyncType s
if (oldest->bdb_use_count || !oldest->addRefConditional(tdbb, SYNC_EXCLUSIVE))
continue;
if ((oldest->bdb_flags & BDB_free_pending) || !writeable(dbb, oldest)) {
if ((oldest->bdb_flags & BDB_free_pending) || !writeable(dbb, oldest))
{
oldest->release(tdbb);
continue;
}
if (oldest->bdb_flags & BDB_lru_chained) {
if (oldest->bdb_flags & BDB_lru_chained)
{
oldest->release(tdbb);
continue;
}
@ -5051,7 +5053,7 @@ static bool write_page(thread_db* tdbb, BufferDesc* bdb, ISC_STATUS* const statu
if (!isTempPage &&
(backup_state == nbak_state_stalled ||
(backup_state == nbak_state_merge && bdb->bdb_difference_page)))
(backup_state == nbak_state_merge && bdb->bdb_difference_page)))
{
const bool res = dbb->dbb_backup_manager->writeDifference(status,

View File

@ -177,7 +177,7 @@ const int BCB_exclusive = 128; // there is only BCB in whole system
class BufferDesc : public pool_alloc<type_bdb>
{
public:
BufferDesc(BufferControl* bcb)
explicit BufferDesc(BufferControl* bcb)
: bdb_bcb(bcb),
bdb_page(0, 0),
bdb_pending_page(0, 0)

View File

@ -77,7 +77,7 @@ namespace Jrd
Firebird::RefPtr<InternalModule> interMod;
Module(InternalModule* h)
explicit Module(InternalModule* h)
: interMod(h)
{ }

View File

@ -349,7 +349,7 @@ Collation* CharSetContainer::lookupCollation(thread_db* tdbb, USHORT tt_id)
}
Jrd::Attachment* att = tdbb->getAttachment();
Jrd::Attachment::CheckoutLockGuard guard(att, createCollationMtx); // are we need it ?
Jrd::Attachment::CheckoutLockGuard guard(att, createCollationMtx); // do we need it ?
Collation* to_delete = NULL;

View File

@ -471,7 +471,7 @@ namespace
class DatabaseContextHolder : public Jrd::ContextPoolHolder
{
public:
DatabaseContextHolder(thread_db* tdbb)
explicit DatabaseContextHolder(thread_db* tdbb)
: Jrd::ContextPoolHolder(tdbb, tdbb->getDatabase()->dbb_permanent),
savedTdbb(tdbb)
{
@ -7281,6 +7281,9 @@ static void start_transaction(thread_db* tdbb, bool transliterate, jrd_tra** tra
try
{
if (tpb_length > 0 && tpb == NULL)
status_exception::raise(Arg::Gds(isc_bad_tpb_form));
jrd_tra* transaction = TRA_start(tdbb, tpb_length, tpb);
transaction->tra_sibling = NULL;

View File

@ -108,8 +108,8 @@ inline LOCK_OWNER_T LCK_OWNER_ID_ATT(thread_db* tdbb)
{
if (tdbb->getDatabase()->dbb_config->getSharedCache())
return (LOCK_OWNER_T) getpid() << 32 | tdbb->getAttachment()->att_lock_owner_id;
else
return (LOCK_OWNER_T) getpid() << 32 | tdbb->getDatabase()->dbb_lock_owner_id;
return (LOCK_OWNER_T) getpid() << 32 | tdbb->getDatabase()->dbb_lock_owner_id;
}
inline SLONG* LCK_OWNER_HANDLE_DBB(thread_db* tdbb)
@ -121,8 +121,8 @@ inline SLONG* LCK_OWNER_HANDLE_ATT(thread_db* tdbb)
{
if (tdbb->getDatabase()->dbb_config->getSharedCache())
return &tdbb->getAttachment()->att_lock_owner_handle;
else
return &tdbb->getDatabase()->dbb_lock_owner_handle;
return &tdbb->getDatabase()->dbb_lock_owner_handle;
}

View File

@ -406,7 +406,7 @@ SLONG TipCache::cacheTransactions(thread_db* tdbb, SLONG oldest)
#endif
// hvlad: No need to cache TIP pages below hdr_oldest just refreshed from
// header page. Moreover out tip cache can now contain an gap between last
// header page. Moreover out tip cache can now contain a gap between the last
// cached tip page and new pages if our process was idle for long time
oldest = MAX(oldest, hdr_oldest);

View File

@ -39,7 +39,7 @@ class thread_db;
class TipCache
{
public:
TipCache(Database* dbb);
explicit TipCache(Database* dbb);
~TipCache();
int cacheState(thread_db*, SLONG number);

View File

@ -4273,7 +4273,8 @@ static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM arg)
for (attachment = dbb->dbb_attachments; attachment; attachment = attachment->att_next)
{
if (attachment->att_flags & ATT_notify_gc) {
if (attachment->att_flags & ATT_notify_gc)
{
attachment->att_flags &= ~ATT_notify_gc;
attachment->att_flags |= ATT_disable_notify_gc;
}
@ -4290,7 +4291,8 @@ static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM arg)
for (attachment = dbb->dbb_attachments; attachment; attachment = attachment->att_next)
{
if (attachment->att_flags & ATT_disable_notify_gc) {
if (attachment->att_flags & ATT_disable_notify_gc)
{
attachment->att_flags &= ~ATT_disable_notify_gc;
attachment->att_flags |= ATT_notify_gc;
}

View File

@ -147,7 +147,7 @@ public:
virtual int FB_CARG seek(IStatus* status, int mode, int offset); // returns position
public:
Blob(Rbl* handle)
explicit Blob(Rbl* handle)
: blob(handle)
{ }

View File

@ -83,7 +83,7 @@ private:
RWLock rwLock;
bool limbo;
DTransaction(const SubArray& aSub)
explicit DTransaction(const SubArray& aSub)
: sub(getPool()), limbo(false)
{
sub.assign(aSub);

View File

@ -320,7 +320,7 @@ namespace
#endif
// This is called only by unregister module
// when current module is forced to go away by OS.
// Do not unload it ourself in this case.
// Do not unload it ourselves in this case.
addRef();
}
else if (next)
@ -900,7 +900,7 @@ void FB_CARG PluginManager::unregisterModule(IPluginModule* cleanup)
// Module cleanup should be unregistered only if it's unloaded
// and only if it's unloaded not by PluginManager, but by OS.
// That means that task is closing unexpectedly - sooner of all
// exit() is called by client of embedded server. Shutdown ourself.
// exit() is called by client of embedded server. Shutdown ourselves.
fb_shutdown(5000, fb_shutrsn_exit_called);
}

View File

@ -117,7 +117,7 @@ template <typename Impl, typename Intf, int Vers>
class YHelper : public Firebird::StdPlugin<Intf, Vers>, public YObject
{
public:
YHelper(Intf* aNext);
explicit YHelper(Intf* aNext);
int FB_CARG release()
{