@@ -93,7 +93,7 @@ DATABASE DB = STATIC FILENAME "yachts.lnk";
93
93
namespace // unnamed, private
94
94
{
95
95
96
- const int DEFERRED_ACTIVE = 3; // RDB$INDEX_INACTIVE setting for Foreign Keys
96
+ constexpr int DEFERRED_ACTIVE = 3; // RDB$INDEX_INACTIVE setting for Foreign Keys
97
97
// This setting is used temporarily while
98
98
// restoring a database. This was required
99
99
// in order to differentiate a partial
@@ -193,7 +193,7 @@ UCHAR debug_on = 0; // able to turn this on in the debugger
193
193
#endif
194
194
195
195
#ifdef sparc
196
- const SSHORT old_sparcs[] =
196
+ constexpr SSHORT old_sparcs[] =
197
197
{0, 0, 0, 2, 0, 0, 0, 0, 2, 4, 4, 4, 8, 8, 0, 0, 8, 8, 8};
198
198
#endif
199
199
@@ -258,14 +258,14 @@ static inline void skip_scan(scan_attr_t* scan_next_attr)
258
258
259
259
// User Privilege Flags
260
260
261
- const int USER_PRIV_USER = 1;
262
- const int USER_PRIV_GRANTOR = 2;
263
- const int USER_PRIV_PRIVILEGE = 4;
264
- const int USER_PRIV_GRANT_OPTION = 8;
265
- const int USER_PRIV_OBJECT_NAME = 16;
266
- const int USER_PRIV_FIELD_NAME = 32;
267
- const int USER_PRIV_USER_TYPE = 64;
268
- const int USER_PRIV_OBJECT_TYPE = 128;
261
+ constexpr int USER_PRIV_USER = 1;
262
+ constexpr int USER_PRIV_GRANTOR = 2;
263
+ constexpr int USER_PRIV_PRIVILEGE = 4;
264
+ constexpr int USER_PRIV_GRANT_OPTION = 8;
265
+ constexpr int USER_PRIV_OBJECT_NAME = 16;
266
+ constexpr int USER_PRIV_FIELD_NAME = 32;
267
+ constexpr int USER_PRIV_USER_TYPE = 64;
268
+ constexpr int USER_PRIV_OBJECT_TYPE = 128;
269
269
270
270
static inline void collect_missing_privs(BurpGlobals* tdgbl, USHORT type, const QualifiedMetaString& name,
271
271
bool hasSecClass)
@@ -361,7 +361,7 @@ int RESTORE_restore (const TEXT* file_name, const TEXT* database_name)
361
361
// don't throw away the database just because an index
362
362
// could not be made
363
363
long error_code;
364
- while (error_code = tdgbl->status_vector[1])
364
+ while (( error_code = tdgbl->status_vector[1]) != 0L )
365
365
{
366
366
switch (error_code)
367
367
{
@@ -1564,7 +1564,7 @@ bool get_acl(BurpGlobals* tdgbl, const TEXT* owner_nm, ISC_QUAD* blob_id, ISC_QU
1564
1564
*
1565
1565
**************************************/
1566
1566
1567
- static const UCHAR blr_items[] =
1567
+ static constexpr UCHAR blr_items[] =
1568
1568
{
1569
1569
isc_info_blob_max_segment,
1570
1570
isc_info_blob_total_length,
@@ -3193,7 +3193,7 @@ static void commit_relation_data(BurpGlobals* tdgbl, burp_rel* relation)
3193
3193
tdgbl->flag_on_line = false;
3194
3194
3195
3195
ISC_STATUS error_code;
3196
- while (error_code = tdgbl->status_vector[1])
3196
+ while (( error_code = tdgbl->status_vector[1]) != 0 )
3197
3197
{
3198
3198
Firebird::IRequest* req_handle = 0;
3199
3199
QualifiedMetaString indexName;
@@ -3276,7 +3276,7 @@ void fix_exception(BurpGlobals* tdgbl, const QualifiedMetaString& name, scan_att
3276
3276
3277
3277
// Notice we use 1021 instead of 1023 because this is the maximum length
3278
3278
// for this field in v2.0 and v2.1 and they produce the corrupt backups.
3279
- const unsigned int FIELD_LIMIT = 1021;
3279
+ constexpr unsigned int FIELD_LIMIT = 1021;
3280
3280
3281
3281
if (FIELD_LIMIT < l2 + 1) // not enough space
3282
3282
{
@@ -6305,7 +6305,7 @@ bool get_global_field(BurpGlobals* tdgbl)
6305
6305
if (X.RDB$FIELD_TYPE <= DTYPE_BLR_MAX)
6306
6306
{
6307
6307
SSHORT l = gds_cvt_blr_dtype[X.RDB$FIELD_TYPE];
6308
- if (l = type_lengths[l])
6308
+ if (( l = type_lengths[l]) != 0 )
6309
6309
X.RDB$FIELD_LENGTH = l;
6310
6310
}
6311
6311
@@ -6651,7 +6651,7 @@ bool get_global_field(BurpGlobals* tdgbl)
6651
6651
if (X.RDB$FIELD_TYPE <= DTYPE_BLR_MAX)
6652
6652
{
6653
6653
SSHORT l = gds_cvt_blr_dtype[X.RDB$FIELD_TYPE];
6654
- if (l = type_lengths[l])
6654
+ if (( l = type_lengths[l]) != 0 )
6655
6655
X.RDB$FIELD_LENGTH = l;
6656
6656
}
6657
6657
@@ -8933,13 +8933,13 @@ bool get_mapping(BurpGlobals* tdgbl)
8933
8933
else
8934
8934
{
8935
8935
int match = 0;
8936
- const unsigned MATCH_FROM = 0x01;
8937
- const unsigned MATCH_FROM_TYPE = 0x02;
8938
- const unsigned MATCH_USING = 0x04;
8939
- const unsigned MATCH_PLUGIN = 0x08;
8940
- const unsigned MATCH_TO_TYPE = 0x10;
8941
- const unsigned MATCH_TO = 0x20;
8942
- const unsigned MATCH_ALL = 0x3f;
8936
+ constexpr unsigned MATCH_FROM = 0x01;
8937
+ constexpr unsigned MATCH_FROM_TYPE = 0x02;
8938
+ constexpr unsigned MATCH_USING = 0x04;
8939
+ constexpr unsigned MATCH_PLUGIN = 0x08;
8940
+ constexpr unsigned MATCH_TO_TYPE = 0x10;
8941
+ constexpr unsigned MATCH_TO = 0x20;
8942
+ constexpr unsigned MATCH_ALL = 0x3f;
8943
8943
Firebird::NoCaseString txt;
8944
8944
8945
8945
skip_init(&scan_next_attr);
@@ -8994,6 +8994,8 @@ bool get_mapping(BurpGlobals* tdgbl)
8994
8994
match |= MATCH_TO;
8995
8995
break;
8996
8996
8997
+ default:
8998
+ break;
8997
8999
}
8998
9000
break;
8999
9001
@@ -12174,7 +12176,7 @@ void fix_generator(BurpGlobals* tdgbl, const FixGenerator* g)
12174
12176
}
12175
12177
}
12176
12178
12177
- static const FixGenerator genToFix[] =
12179
+ static constexpr FixGenerator genToFix[] =
12178
12180
{
12179
12181
{ "RDB$CONSTRAINT_NAME", "RDB$RELATION_CONSTRAINTS", "RDB$CONSTRAINT_NAME", "INTEG_" , DB_VERSION_DDL8 },
12180
12182
{ "RDB$FIELD_NAME", "RDB$FIELDS", "RDB$FIELD_NAME", "RDB$" , DB_VERSION_DDL8 },
@@ -13242,7 +13244,7 @@ IBatch* WriteRelationMeta::createBatch(BurpGlobals* tdgbl, IAttachment* att)
13242
13244
// determine batch parameters
13243
13245
m_batchInlineBlobLimit = 0;
13244
13246
13245
- const UCHAR items[] = {
13247
+ constexpr UCHAR items[] = {
13246
13248
IBatch::INF_BUFFER_BYTES_SIZE,
13247
13249
IBatch::INF_BLOB_ALIGNMENT,
13248
13250
IBatch::INF_BLOB_HEADER
@@ -13509,7 +13511,7 @@ void WriteRelationMeta::prepareRequest(BurpGlobals* tdgbl)
13509
13511
{
13510
13512
USHORT l = gds_cvt_blr_dtype[dtype];
13511
13513
alignment = type_alignments[l];
13512
- if (l = type_lengths[l])
13514
+ if (( l = type_lengths[l]) != 0 )
13513
13515
length = l;
13514
13516
}
13515
13517
@@ -14033,7 +14035,7 @@ IOBuffer* RestoreRelationTask::read_blob(BurpGlobals* tdgbl, IOBuffer* ioBuf)
14033
14035
segments = value;
14034
14036
14035
14037
// for simplicity, don't split put attribute between buffers
14036
- const FB_SIZE_T attrLen = (sizeof(SLONG) + 2);
14038
+ constexpr FB_SIZE_T attrLen = (sizeof(SLONG) + 2);
14037
14039
checkSpace(&ioBuf, attrLen, &buf, &space);
14038
14040
14039
14041
*buf++ = attribute;
0 commit comments