Skip to content

Commit 6ad7180

Browse files
committed
constexpr/final/noexcept in Replicator
1 parent 8e4f5f8 commit 6ad7180

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

src/jrd/replication/Replicator.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void Replicator::storeBlob(Transaction* transaction, ISC_QUAD blobId)
8888
localStatus.raise();
8989

9090
UCharBuffer buffer;
91-
const auto bufferLength = MAX_USHORT;
91+
constexpr FB_SIZE_T bufferLength = MAX_USHORT;
9292
auto data = buffer.getBuffer(bufferLength);
9393

9494
auto& txnData = transaction->getData();
@@ -311,10 +311,10 @@ void Replicator::insertRecord(CheckStatusWrapper* status,
311311
IReplicatedField* field = record->getField(id);
312312
if (field != nullptr)
313313
{
314-
auto type = field->getType();
314+
const auto type = field->getType();
315315
if (type == SQL_ARRAY || type == SQL_BLOB)
316316
{
317-
const auto blobId = (ISC_QUAD*) field->getData();
317+
const auto* blobId = (ISC_QUAD*) field->getData();
318318

319319
if (blobId && !BlobWrapper::blobIsNull(*blobId))
320320
storeBlob(transaction, *blobId);
@@ -358,10 +358,10 @@ void Replicator::updateRecord(CheckStatusWrapper* status,
358358
IReplicatedField* field = newRecord->getField(id);
359359
if (field != nullptr)
360360
{
361-
auto type = field->getType();
361+
const auto type = field->getType();
362362
if (type == SQL_ARRAY || type == SQL_BLOB)
363363
{
364-
const auto blobId = (ISC_QUAD*) field->getData();
364+
const auto* blobId = (ISC_QUAD*) field->getData();
365365

366366
if (blobId && !BlobWrapper::blobIsNull(*blobId))
367367
storeBlob(transaction, *blobId);

src/jrd/replication/Replicator.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@
3636

3737
namespace Replication
3838
{
39-
class Replicator :
39+
class Replicator final :
4040
public Firebird::StdPlugin<Firebird::IReplicatedSessionImpl<Replicator, Firebird::CheckStatusWrapper> >
4141
{
4242
typedef Firebird::ObjectsArray<Firebird::string> NameCache;
4343
typedef Firebird::HalfStaticArray<SavNumber, 16> SavepointStack;
4444

4545
struct BatchBlock
4646
{
47-
Block header;
47+
Block header{};
4848
Firebird::UCharBuffer* buffer;
4949
NameCache atoms;
5050
ULONG lastAtom;
@@ -54,10 +54,9 @@ namespace Replication
5454
: buffer(NULL), atoms(pool),
5555
lastAtom(MAX_ULONG), flushes(0)
5656
{
57-
memset(&header, 0, sizeof(Block));
5857
}
5958

60-
ULONG getSize() const
59+
ULONG getSize() const noexcept
6160
{
6261
return (ULONG) buffer->getCount();
6362
}
@@ -138,20 +137,20 @@ namespace Replication
138137
}
139138
};
140139

141-
class Transaction :
140+
class Transaction final :
142141
public Firebird::AutoIface<Firebird::IReplicatedTransactionImpl<Transaction, Firebird::CheckStatusWrapper> >
143142
{
144143
public:
145144
explicit Transaction(Replicator* replicator, Firebird::ITransaction* trans)
146145
: m_replicator(replicator), m_transaction(trans), m_data(replicator->getPool())
147146
{}
148147

149-
BatchBlock& getData()
148+
BatchBlock& getData() noexcept
150149
{
151150
return m_data;
152151
}
153152

154-
Firebird::ITransaction* getInterface()
153+
Firebird::ITransaction* getInterface() noexcept
155154
{
156155
return m_transaction.getPtr();
157156
}
@@ -259,7 +258,7 @@ namespace Replication
259258
struct GeneratorValue
260259
{
261260
Jrd::QualifiedName name;
262-
SINT64 value;
261+
SINT64 value = 0;
263262
};
264263

265264
typedef Firebird::Array<GeneratorValue> GeneratorCache;

0 commit comments

Comments
 (0)