Skip to content
Closed
19 changes: 18 additions & 1 deletion src/jrd/trace/TraceCmdLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ namespace
struct MessageSet
{
const int range[2];
const std::initializer_list<int> list;

const std::initializer_list<USHORT> list;

void print() const
{
Expand Down Expand Up @@ -210,6 +211,9 @@ void fbtrace(UtilSvc* uSvc, TraceSvcIntf* traceSvc)
case IN_SW_TRACE_LIST:
usage(uSvc, isc_trace_param_act_notcompat, sw->in_sw_name, action_sw->in_sw_name);
break;
default:
fb_assert(false);
break;
}

if (!session.ses_config.empty())
Expand All @@ -231,6 +235,9 @@ void fbtrace(UtilSvc* uSvc, TraceSvcIntf* traceSvc)
case IN_SW_TRACE_LIST:
usage(uSvc, isc_trace_param_act_notcompat, sw->in_sw_name, action_sw->in_sw_name);
break;
default:
fb_assert(false);
break;
}

if (!session.ses_name.empty())
Expand All @@ -250,6 +257,9 @@ void fbtrace(UtilSvc* uSvc, TraceSvcIntf* traceSvc)
case IN_SW_TRACE_LIST:
usage(uSvc, isc_trace_param_act_notcompat, sw->in_sw_name, action_sw->in_sw_name);
break;
default:
fb_assert(false);
break;
}

if (session.ses_id)
Expand All @@ -275,6 +285,9 @@ void fbtrace(UtilSvc* uSvc, TraceSvcIntf* traceSvc)
case IN_SW_TRACE_LIST:
usage(uSvc, isc_trace_param_act_notcompat, sw->in_sw_name, action_sw->in_sw_name);
break;
default:
fb_assert(false);
break;
}

if (!session.ses_plugins.empty())
Expand Down Expand Up @@ -374,6 +387,8 @@ void fbtrace(UtilSvc* uSvc, TraceSvcIntf* traceSvc)
(Arg::Gds(isc_io_error) << Arg::Str("read") << Arg::Str(fileName) <<
Arg::Gds(isc_io_read_err) << Arg::OsError()).raise();
break;
default:
fb_assert(false);
}
}
else
Expand Down Expand Up @@ -420,6 +435,8 @@ void fbtrace(UtilSvc* uSvc, TraceSvcIntf* traceSvc)
case IN_SW_TRACE_RESUME:
usage(uSvc, isc_trace_switch_param_miss, "ID", action_sw->in_sw_name);
break;
default:
fb_assert(false);
}
}

Expand Down
11 changes: 7 additions & 4 deletions src/jrd/trace/TraceConfigStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ void ConfigStorage::shutdown()
void ConfigStorage::mutexBug(int state, const char* string)
{
TEXT msg[BUFFER_TINY];
snprintf(msg, sizeof(msg), "ConfigStorage: mutex %s error, status = %d", string, state);
[[maybe_unused]] const int len = snprintf(msg, sizeof(msg), "ConfigStorage: mutex %s error, status = %d", string, state);
fb_assert(len >= 0 && len < static_cast<int>(sizeof(msg)));
fb_utils::logAndDie(msg);
}

Expand Down Expand Up @@ -243,11 +244,13 @@ void ConfigStorage::checkAudit()

TraceSession session(*getDefaultMemoryPool());

fseek(cfgFile, 0, SEEK_END);
[[maybe_unused]] const int resultEnd = fseek(cfgFile, 0, SEEK_END);
fb_assert(resultEnd == 0);
const long len = ftell(cfgFile);
if (len)
{
fseek(cfgFile, 0, SEEK_SET);
[[maybe_unused]] const int resultSet = fseek(cfgFile, 0, SEEK_SET);
fb_assert(resultSet == 0);
char* p = session.ses_config.getBuffer(len + 1);

if (fread(p, 1, len, cfgFile) != size_t(len)) {
Expand Down Expand Up @@ -716,7 +719,7 @@ void ConfigStorage::addSession(TraceSession& session)
session.ses_flags |= trs_active;
slot->ses_flags = session.ses_flags;
time(&session.ses_start);

fb_assert(session.ses_start != (time_t) -1);
char* p = reinterpret_cast<char*> (header) + slot->offset;
Writer writer(p, slot->size);

Expand Down
3 changes: 2 additions & 1 deletion src/jrd/trace/TraceLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ void TraceLog::setFullMsg(const char* str)
void TraceLog::mutexBug(int state, const char* string)
{
TEXT msg[BUFFER_TINY];
snprintf(msg, sizeof(msg), "TraceLog: mutex %s error, status = %d", string, state);
[[maybe_unused]] const int len = snprintf(msg, sizeof(msg), "TraceLog: mutex %s error, status = %d", string, state);
fb_assert(len >= 0 && len < (int) sizeof(msg));
fb_utils::logAndDie(msg);
}

Expand Down
2 changes: 1 addition & 1 deletion src/jrd/trace/TraceObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ TraceRuntimeStats::TraceRuntimeStats(Attachment* attachment,
m_info.pin_tables = m_legacyCounts.begin();
m_info.pin_count = m_legacyCounts.getCount();

for (MetaId i = 0; i < m_info.pin_count; i++)
for (FB_SIZE_T i = 0; i < m_info.pin_count; i++)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain this in PR. Why not to change type or cast m_info.pin_count instead?

{
m_info.pin_tables[i].trc_relation_id = m_tableCounters.getObjectId(i);
m_info.pin_tables[i].trc_relation_name = m_tableCounters.getObjectName(i);
Expand Down