Skip to content

Commit e79b9c0

Browse files
committed
Fix conversion warning in vio
+ constexpr things
1 parent c471ddf commit e79b9c0

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

src/jrd/vio.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ static UndoDataRet get_undo_data(thread_db* tdbb, jrd_tra* transaction,
151151
static void invalidate_cursor_records(jrd_tra*, record_param*);
152152

153153
// flags to pass into list_staying
154-
const int LS_ACTIVE_RPB = 0x01;
155-
const int LS_NO_RESTART = 0x02;
154+
inline constexpr int LS_ACTIVE_RPB = 0x01;
155+
inline constexpr int LS_NO_RESTART = 0x02;
156156

157157
static void list_staying(thread_db*, record_param*, RecordStack&, int flags = 0);
158158
static void list_staying_fast(thread_db*, record_param*, RecordStack&, record_param* = NULL, int flags = 0);
@@ -3229,7 +3229,7 @@ bool VIO_get_current(thread_db* tdbb,
32293229
// Cannot use Arg::Num here because transaction number is 64-bit unsigned integer
32303230
ERR_post(Arg::Gds(isc_rec_in_limbo) << Arg::Int64(rpb->rpb_transaction_nr));
32313231
}
3232-
// fall thru
3232+
[[fallthrough]];
32333233

32343234
case tra_active:
32353235
// clear lock error from status vector
@@ -3427,7 +3427,7 @@ bool VIO_modify(thread_db* tdbb, record_param* org_rpb, record_param* new_rpb, j
34273427

34283428
if (needDfw(tdbb, transaction))
34293429
{
3430-
const SLONG nullLinger = 0;
3430+
constexpr SLONG nullLinger = 0;
34313431

34323432
switch ((RIDS) relation->rel_id)
34333433
{
@@ -4245,7 +4245,8 @@ void VIO_store(thread_db* tdbb, record_param* rpb, jrd_tra* transaction)
42454245
schemaName = depName.schema.c_str();
42464246
}
42474247

4248-
desc.makeText(strlen(schemaName), CS_METADATA, (UCHAR*) schemaName);
4248+
desc.makeText(static_cast<USHORT>(strlen(schemaName)), CS_METADATA,
4249+
(UCHAR*) schemaName);
42494250

42504251
MOV_move(tdbb, &desc, &schemaDesc);
42514252
rpb->rpb_record->clearNull(fieldId);
@@ -4296,7 +4297,8 @@ void VIO_store(thread_db* tdbb, record_param* rpb, jrd_tra* transaction)
42964297
case obj_package_body:
42974298
EVL_field(0, rpb->rpb_record, schemaFieldId, &desc2);
42984299

4299-
desc.makeText(strlen(PUBLIC_SCHEMA), CS_METADATA, (UCHAR*) PUBLIC_SCHEMA);
4300+
desc.makeText(static_cast<USHORT>(strlen(PUBLIC_SCHEMA)), CS_METADATA,
4301+
(UCHAR*) PUBLIC_SCHEMA);
43004302

43014303
MOV_move(tdbb, &desc, &desc2);
43024304
rpb->rpb_record->clearNull(schemaFieldId);
@@ -4956,7 +4958,7 @@ WriteLockResult VIO_writelock(thread_db* tdbb, record_param* org_rpb, jrd_tra* t
49564958
case PrepareResult::DELETED:
49574959
if (skipLocked && (transaction->tra_flags & TRA_read_committed))
49584960
return WriteLockResult::SKIPPED;
4959-
// fall thru
4961+
[[fallthrough]];
49604962

49614963
case PrepareResult::CONFLICT:
49624964
if ((transaction->tra_flags & TRA_read_consistency))
@@ -4982,7 +4984,7 @@ WriteLockResult VIO_writelock(thread_db* tdbb, record_param* org_rpb, jrd_tra* t
49824984
fb_assert(skipLocked);
49834985
if (skipLocked)
49844986
return WriteLockResult::SKIPPED;
4985-
// fall thru
4987+
[[fallthrough]];
49864988

49874989
case PrepareResult::LOCK_ERROR:
49884990
// We got some kind of locking error (deadlock, timeout or lock_conflict)
@@ -6818,7 +6820,7 @@ static PrepareResult prepare_update(thread_db* tdbb, jrd_tra* transaction, TraNu
68186820
// Cannot use Arg::Num here because transaction number is 64-bit unsigned integer
68196821
ERR_post(Arg::Gds(isc_rec_in_limbo) << Arg::Int64(rpb->rpb_transaction_nr));
68206822
}
6821-
// fall thru
6823+
[[fallthrough]];
68226824

68236825
case tra_active:
68246826
return skipLocked ? PrepareResult::SKIP_LOCKED : PrepareResult::LOCK_ERROR;

src/jrd/vio_debug.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525

2626
//#define VIO_DEBUG
2727

28-
const int DEBUG_WRITES = 1;
29-
const int DEBUG_WRITES_INFO = 2;
30-
const int DEBUG_READS = 3;
31-
const int DEBUG_READS_INFO = 4;
32-
const int DEBUG_TRACE = 5;
33-
const int DEBUG_TRACE_INFO = 6;
34-
const int DEBUG_TRACE_ALL = 7;
35-
const int DEBUG_TRACE_ALL_INFO = 8;
28+
inline constexpr int DEBUG_WRITES = 1;
29+
inline constexpr int DEBUG_WRITES_INFO = 2;
30+
inline constexpr int DEBUG_READS = 3;
31+
inline constexpr int DEBUG_READS_INFO = 4;
32+
inline constexpr int DEBUG_TRACE = 5;
33+
inline constexpr int DEBUG_TRACE_INFO = 6;
34+
inline constexpr int DEBUG_TRACE_ALL = 7;
35+
inline constexpr int DEBUG_TRACE_ALL_INFO = 8;
3636

3737
// defined at vio.cpp
3838
extern int vio_debug_flag;

0 commit comments

Comments
 (0)