@@ -93,7 +93,7 @@ DATABASE DB = STATIC FILENAME "yachts.lnk";
9393namespace // unnamed, private
9494{
9595
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
9797 // This setting is used temporarily while
9898 // restoring a database. This was required
9999 // in order to differentiate a partial
@@ -193,7 +193,7 @@ UCHAR debug_on = 0; // able to turn this on in the debugger
193193#endif
194194
195195#ifdef sparc
196- const SSHORT old_sparcs[] =
196+ constexpr SSHORT old_sparcs[] =
197197 {0, 0, 0, 2, 0, 0, 0, 0, 2, 4, 4, 4, 8, 8, 0, 0, 8, 8, 8};
198198#endif
199199
@@ -258,14 +258,14 @@ static inline void skip_scan(scan_attr_t* scan_next_attr)
258258
259259// User Privilege Flags
260260
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;
269269
270270static inline void collect_missing_privs(BurpGlobals* tdgbl, USHORT type, const QualifiedMetaString& name,
271271 bool hasSecClass)
@@ -361,7 +361,7 @@ int RESTORE_restore (const TEXT* file_name, const TEXT* database_name)
361361 // don't throw away the database just because an index
362362 // could not be made
363363 long error_code;
364- while (error_code = tdgbl->status_vector[1])
364+ while (( error_code = tdgbl->status_vector[1]) != 0L )
365365 {
366366 switch (error_code)
367367 {
@@ -1564,7 +1564,7 @@ bool get_acl(BurpGlobals* tdgbl, const TEXT* owner_nm, ISC_QUAD* blob_id, ISC_QU
15641564 *
15651565 **************************************/
15661566
1567- static const UCHAR blr_items[] =
1567+ static constexpr UCHAR blr_items[] =
15681568 {
15691569 isc_info_blob_max_segment,
15701570 isc_info_blob_total_length,
@@ -3193,7 +3193,7 @@ static void commit_relation_data(BurpGlobals* tdgbl, burp_rel* relation)
31933193 tdgbl->flag_on_line = false;
31943194
31953195 ISC_STATUS error_code;
3196- while (error_code = tdgbl->status_vector[1])
3196+ while (( error_code = tdgbl->status_vector[1]) != 0 )
31973197 {
31983198 Firebird::IRequest* req_handle = 0;
31993199 QualifiedMetaString indexName;
@@ -3276,7 +3276,7 @@ void fix_exception(BurpGlobals* tdgbl, const QualifiedMetaString& name, scan_att
32763276
32773277 // Notice we use 1021 instead of 1023 because this is the maximum length
32783278 // 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;
32803280
32813281 if (FIELD_LIMIT < l2 + 1) // not enough space
32823282 {
@@ -6305,7 +6305,7 @@ bool get_global_field(BurpGlobals* tdgbl)
63056305 if (X.RDB$FIELD_TYPE <= DTYPE_BLR_MAX)
63066306 {
63076307 SSHORT l = gds_cvt_blr_dtype[X.RDB$FIELD_TYPE];
6308- if (l = type_lengths[l])
6308+ if (( l = type_lengths[l]) != 0 )
63096309 X.RDB$FIELD_LENGTH = l;
63106310 }
63116311
@@ -6651,7 +6651,7 @@ bool get_global_field(BurpGlobals* tdgbl)
66516651 if (X.RDB$FIELD_TYPE <= DTYPE_BLR_MAX)
66526652 {
66536653 SSHORT l = gds_cvt_blr_dtype[X.RDB$FIELD_TYPE];
6654- if (l = type_lengths[l])
6654+ if (( l = type_lengths[l]) != 0 )
66556655 X.RDB$FIELD_LENGTH = l;
66566656 }
66576657
@@ -8933,13 +8933,13 @@ bool get_mapping(BurpGlobals* tdgbl)
89338933 else
89348934 {
89358935 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;
89438943 Firebird::NoCaseString txt;
89448944
89458945 skip_init(&scan_next_attr);
@@ -8994,6 +8994,8 @@ bool get_mapping(BurpGlobals* tdgbl)
89948994 match |= MATCH_TO;
89958995 break;
89968996
8997+ default:
8998+ break;
89978999 }
89989000 break;
89999001
@@ -12174,7 +12176,7 @@ void fix_generator(BurpGlobals* tdgbl, const FixGenerator* g)
1217412176 }
1217512177}
1217612178
12177- static const FixGenerator genToFix[] =
12179+ static constexpr FixGenerator genToFix[] =
1217812180{
1217912181 { "RDB$CONSTRAINT_NAME", "RDB$RELATION_CONSTRAINTS", "RDB$CONSTRAINT_NAME", "INTEG_" , DB_VERSION_DDL8 },
1218012182 { "RDB$FIELD_NAME", "RDB$FIELDS", "RDB$FIELD_NAME", "RDB$" , DB_VERSION_DDL8 },
@@ -13242,7 +13244,7 @@ IBatch* WriteRelationMeta::createBatch(BurpGlobals* tdgbl, IAttachment* att)
1324213244 // determine batch parameters
1324313245 m_batchInlineBlobLimit = 0;
1324413246
13245- const UCHAR items[] = {
13247+ constexpr UCHAR items[] = {
1324613248 IBatch::INF_BUFFER_BYTES_SIZE,
1324713249 IBatch::INF_BLOB_ALIGNMENT,
1324813250 IBatch::INF_BLOB_HEADER
@@ -13509,7 +13511,7 @@ void WriteRelationMeta::prepareRequest(BurpGlobals* tdgbl)
1350913511 {
1351013512 USHORT l = gds_cvt_blr_dtype[dtype];
1351113513 alignment = type_alignments[l];
13512- if (l = type_lengths[l])
13514+ if (( l = type_lengths[l]) != 0 )
1351313515 length = l;
1351413516 }
1351513517
@@ -14033,7 +14035,7 @@ IOBuffer* RestoreRelationTask::read_blob(BurpGlobals* tdgbl, IOBuffer* ioBuf)
1403314035 segments = value;
1403414036
1403514037 // 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);
1403714039 checkSpace(&ioBuf, attrLen, &buf, &space);
1403814040
1403914041 *buf++ = attribute;
0 commit comments