Skip to content

Commit 3a5bc3a

Browse files
committed
constexpr+noexcept PluginLogWriter
1 parent 90606b0 commit 3a5bc3a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/utilities/ntrace/PluginLogWriter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ void strerror_r(int err, char* buf, size_t bufSize)
5353
}
5454
#endif
5555

56-
void getMappedFileName(PathName& file, PathName& mapFile)
56+
void getMappedFileName(const PathName& file, PathName& mapFile)
5757
{
5858
const ULONG hash = file.hash(0xFFFFFFFF);
5959
mapFile.printf("%s_%08x", FB_TRACE_LOG_MUTEX, hash);
@@ -239,7 +239,7 @@ FB_SIZE_T PluginLogWriter::write_s(CheckStatusWrapper* status, const void* buf,
239239
{
240240
return write(buf, size);
241241
}
242-
catch (Exception &ex)
242+
catch (const Exception &ex)
243243
{
244244
ex.stuffException(status);
245245
}
@@ -264,7 +264,7 @@ void PluginLogWriter::checkErrno(const char* operation)
264264
operation, m_fileName.c_str(), strErr);
265265
}
266266

267-
void PluginLogWriter::mutexBug(int state, const TEXT* string)
267+
void PluginLogWriter::mutexBug(int state, const char* string)
268268
{
269269
TEXT msg[BUFFER_TINY];
270270
snprintf(msg, sizeof(msg), "PluginLogWriter: mutex %s error, status = %d", string, state);
@@ -292,11 +292,11 @@ void PluginLogWriter::unlock()
292292
}
293293

294294

295-
const unsigned int IDLE_TIMEOUT = 30; // seconds
295+
constexpr unsigned int IDLE_TIMEOUT = 30; // seconds
296296

297297
void PluginLogWriter::setupIdleTimer(bool clear)
298298
{
299-
unsigned int timeout = clear ? 0 : IDLE_TIMEOUT;
299+
const unsigned int timeout = clear ? 0 : IDLE_TIMEOUT;
300300
if (!timeout)
301301
{
302302
if (m_idleTimer)

src/utilities/ntrace/PluginLogWriter.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ class PluginLogWriter final :
6262
~PluginLogWriter();
6363

6464
// TraceLogWriter implementation
65-
virtual FB_SIZE_T write(const void* buf, FB_SIZE_T size) override;
66-
virtual FB_SIZE_T write_s(Firebird::CheckStatusWrapper* status, const void* buf, unsigned size) override;
65+
FB_SIZE_T write(const void* buf, FB_SIZE_T size) override;
66+
FB_SIZE_T write_s(Firebird::CheckStatusWrapper* status, const void* buf, FB_SIZE_T size) override;
6767

6868
private:
69-
const USHORT PLUGIN_LOG_VERSION = 1;
69+
static constexpr USHORT PLUGIN_LOG_VERSION = 1;
7070

7171
SINT64 seekToEnd();
7272
void reopen();

0 commit comments

Comments
 (0)