Skip to content

Commit a6e2fcf

Browse files
committed
Fix conversion warnings in ReplServer
+ Misc improvements (constexpr, noexcept info)
1 parent c0518a1 commit a6e2fcf

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/remote/server/ReplServer.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ using namespace Replication;
7070

7171
namespace
7272
{
73-
const char CTL_SIGNATURE[] = "FBREPLCTL";
73+
inline constexpr const char* CTL_SIGNATURE = "FBREPLCTL";
7474

75-
const USHORT CTL_VERSION1 = 1;
76-
const USHORT CTL_CURRENT_VERSION = CTL_VERSION1;
75+
inline constexpr USHORT CTL_VERSION1 = 1;
76+
inline constexpr USHORT CTL_CURRENT_VERSION = CTL_VERSION1;
7777

7878
volatile bool shutdownFlag = false;
7979
AtomicCounter activeThreads;
@@ -95,15 +95,15 @@ namespace
9595

9696
struct ActiveTransaction
9797
{
98-
ActiveTransaction()
98+
ActiveTransaction() noexcept
9999
: tra_id(0), sequence(0)
100100
{}
101101

102-
ActiveTransaction(TraNumber id, FB_UINT64 seq)
102+
ActiveTransaction(TraNumber id, FB_UINT64 seq) noexcept
103103
: tra_id(id), sequence(seq)
104104
{}
105105

106-
static const TraNumber& generate(const ActiveTransaction& item)
106+
static const TraNumber& generate(const ActiveTransaction& item) noexcept
107107
{
108108
return item.tra_id;
109109
}
@@ -224,17 +224,17 @@ namespace
224224
#endif
225225
}
226226

227-
FB_UINT64 getSequence() const
227+
FB_UINT64 getSequence() const noexcept
228228
{
229229
return m_data.sequence;
230230
}
231231

232-
ULONG getOffset() const
232+
ULONG getOffset() const noexcept
233233
{
234234
return m_data.offset;
235235
}
236236

237-
FB_UINT64 getDbSequence() const
237+
FB_UINT64 getDbSequence() const noexcept
238238
{
239239
return m_data.db_sequence;
240240
}
@@ -305,9 +305,9 @@ namespace
305305
static int init(const PathName& directory, const Guid& guid)
306306
{
307307
#ifdef WIN_NT
308-
const mode_t ACCESS_MODE = DEFAULT_OPEN_MODE;
308+
constexpr mode_t ACCESS_MODE = DEFAULT_OPEN_MODE;
309309
#else
310-
const mode_t ACCESS_MODE = 0664;
310+
constexpr mode_t ACCESS_MODE = 0664;
311311
#endif
312312
const PathName filename = directory + guid.toPathName();
313313

@@ -529,7 +529,7 @@ namespace
529529
#endif
530530
}
531531

532-
static const FB_UINT64& generate(const Segment* item)
532+
static const FB_UINT64& generate(const Segment* item) noexcept
533533
{
534534
return item->header.hdr_sequence;
535535
}
@@ -542,7 +542,7 @@ namespace
542542

543543
string formatInterval(const TimeStamp& start, const TimeStamp& finish)
544544
{
545-
static const SINT64 MSEC_PER_DAY = 24 * 60 * 60 * 1000;
545+
static constexpr SINT64 MSEC_PER_DAY = 24 * 60 * 60 * 1000;
546546

547547
const SINT64 startMsec = ((SINT64) start.value().timestamp_date) * MSEC_PER_DAY +
548548
(SINT64) start.value().timestamp_time / 10;
@@ -755,8 +755,8 @@ namespace
755755

756756
ControlFile control(target->getDirectory(), guid, sequence, transactions);
757757

758-
FB_UINT64 last_sequence = control.getSequence();
759-
ULONG last_offset = control.getOffset();
758+
const FB_UINT64 last_sequence = control.getSequence();
759+
const ULONG last_offset = control.getOffset();
760760

761761
const FB_UINT64 db_sequence = target->initReplica();
762762
const FB_UINT64 last_db_sequence = control.getDbSequence();
@@ -873,7 +873,7 @@ namespace
873873
raiseError("Journal file %s read failed (error %d)", segment->filename.c_str(), ERRNO);
874874

875875
const auto blockLength = header.length;
876-
const auto length = sizeof(Block) + blockLength;
876+
const ULONG length = static_cast<ULONG>(sizeof(Block) + blockLength);
877877

878878
if (blockLength)
879879
{

0 commit comments

Comments
 (0)