File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -52,8 +52,8 @@ using namespace Firebird;
5252
5353namespace Jrd {
5454
55- const unsigned int INIT_LOG_SIZE = 1024 *1024 ; // 1MB
56- const unsigned int FREE_SPACE_THRESHOLD = INIT_LOG_SIZE / 4 ;
55+ constexpr unsigned int INIT_LOG_SIZE = 1024 *1024 ; // 1MB
56+ constexpr unsigned int FREE_SPACE_THRESHOLD = INIT_LOG_SIZE / 4 ;
5757
5858TraceLog::TraceLog (MemoryPool& pool, const PathName& fileName, bool reader) :
5959 m_reader (reader),
@@ -268,7 +268,7 @@ void TraceLog::extend(FB_SIZE_T size)
268268
269269FB_SIZE_T TraceLog::getUsed ()
270270{
271- TraceLogHeader* header = m_sharedMemory->getHeader ();
271+ const TraceLogHeader* header = m_sharedMemory->getHeader ();
272272
273273 if (header->readPos < header->writePos )
274274 return (header->writePos - header->readPos );
@@ -280,14 +280,14 @@ FB_SIZE_T TraceLog::getUsed()
280280
281281FB_SIZE_T TraceLog::getFree (bool useMax)
282282{
283- TraceLogHeader* header = m_sharedMemory->getHeader ();
283+ const TraceLogHeader* header = m_sharedMemory->getHeader ();
284284 return (useMax ? header->maxSize : header->allocated ) - sizeof (TraceLogHeader) - getUsed () - 1 ;
285285}
286286
287287bool TraceLog::isFull ()
288288{
289289 TraceLogGuard guard (this );
290- TraceLogHeader* header = m_sharedMemory->getHeader ();
290+ const TraceLogHeader* header = m_sharedMemory->getHeader ();
291291 return header->flags & FLAG_FULL;
292292}
293293
Original file line number Diff line number Diff line change 3333
3434namespace Jrd {
3535
36- struct TraceLogHeader : public Firebird ::MemoryHeader
36+ struct TraceLogHeader final : public Firebird::MemoryHeader
3737{
38- static const USHORT TRACE_LOG_VERSION = 2 ;
38+ static constexpr USHORT TRACE_LOG_VERSION = 2 ;
3939
4040 ULONG readPos;
4141 ULONG writePos;
@@ -44,7 +44,7 @@ struct TraceLogHeader : public Firebird::MemoryHeader
4444 ULONG flags;
4545};
4646
47- class TraceLog : public Firebird ::IpcObject
47+ class TraceLog final : public Firebird::IpcObject
4848{
4949public:
5050 TraceLog (Firebird::MemoryPool& pool, const Firebird::PathName& fileName, bool reader);
@@ -58,8 +58,8 @@ class TraceLog : public Firebird::IpcObject
5858
5959private:
6060 // flags in header
61- const ULONG FLAG_FULL = 0x0001 ; // log is full, set by writer, reset by reader
62- const ULONG FLAG_DONE = 0x0002 ; // set when reader is gone
61+ static constexpr ULONG FLAG_FULL = 0x0001 ; // log is full, set by writer, reset by reader
62+ static constexpr ULONG FLAG_DONE = 0x0002 ; // set when reader is gone
6363
6464 void mutexBug (int osErrorCode, const char * text) override ;
6565 bool initialize (Firebird::SharedMemoryBase*, bool ) override ;
You can’t perform that action at this time.
0 commit comments