@@ -151,32 +151,32 @@ IsqlGlobals isqlGlob;
151
151
152
152
// Print lengths of numeric values
153
153
154
- const int SHORT_LEN = 7; // NUMERIC (4,2) = -327.68
155
- const int LONG_LEN = 12; // NUMERIC (9,2) = -21474836.48
156
- const int INT64_LEN = 21; // NUMERIC(18,2) = -92233720368547758.08
157
- //const int QUAD_LEN = 19;
158
- const int FLOAT_LEN = 14; // -1.2345678E+38
159
- const int DOUBLE_LEN = 23; // -1.234567890123456E+300
160
- const int DATE_LEN = 11; // 11 for date only
161
- const int DATETIME_LEN = 25; // 25 for date-time
162
- const int DATETIME_TZ_LEN = DATETIME_LEN - 1 + 1 + TimeZoneUtil::MAX_LEN; // DATETIME_LEN should be 24
163
- const int TIME_ONLY_LEN = 13; // 13 for time only
164
- const int TIME_TZ_ONLY_LEN = TIME_ONLY_LEN + 1 + TimeZoneUtil::MAX_LEN;
165
- const int DATE_ONLY_LEN = 11;
166
- const int BOOLEAN_LEN = 7; // <false>
167
- const int UNKNOWN_LEN = 20; // Unknown type: %d
168
-
169
- const int MAX_TERMS = 10; // max # of terms in an interactive cmd
170
-
171
- const char* ISQL_COUNTERS_SET = "CurrentMemory, MaxMemory, RealTime, UserTime, Buffers, Reads, Writes, Fetches";
172
- const int ISQL_COUNTERS = 8;
173
-
174
- const char* UNKNOWN = "*unknown*";
154
+ constexpr int SHORT_LEN = 7; // NUMERIC (4,2) = -327.68
155
+ constexpr int LONG_LEN = 12; // NUMERIC (9,2) = -21474836.48
156
+ constexpr int INT64_LEN = 21; // NUMERIC(18,2) = -92233720368547758.08
157
+ //constexpr int QUAD_LEN = 19;
158
+ constexpr int FLOAT_LEN = 14; // -1.2345678E+38
159
+ constexpr int DOUBLE_LEN = 23; // -1.234567890123456E+300
160
+ constexpr int DATE_LEN = 11; // 11 for date only
161
+ constexpr int DATETIME_LEN = 25; // 25 for date-time
162
+ constexpr int DATETIME_TZ_LEN = DATETIME_LEN - 1 + 1 + TimeZoneUtil::MAX_LEN; // DATETIME_LEN should be 24
163
+ constexpr int TIME_ONLY_LEN = 13; // 13 for time only
164
+ constexpr int TIME_TZ_ONLY_LEN = TIME_ONLY_LEN + 1 + TimeZoneUtil::MAX_LEN;
165
+ constexpr int DATE_ONLY_LEN = 11;
166
+ constexpr int BOOLEAN_LEN = 7; // <false>
167
+ constexpr int UNKNOWN_LEN = 20; // Unknown type: %d
168
+
169
+ constexpr int MAX_TERMS = 10; // max # of terms in an interactive cmd
170
+
171
+ constexpr const char* ISQL_COUNTERS_SET = "CurrentMemory, MaxMemory, RealTime, UserTime, Buffers, Reads, Writes, Fetches";
172
+ constexpr int ISQL_COUNTERS = 8;
173
+
174
+ constexpr const char* UNKNOWN = "*unknown*";
175
175
176
176
namespace IcuUtil
177
177
{
178
178
// Duplicate from ICU to not need to link ISQL with it. It's used by U8_NEXT_UNSAFE.
179
- static const uint8_t utf8_countTrailBytes[256] = {
179
+ static constexpr uint8_t utf8_countTrailBytes[256] = {
180
180
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
181
181
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
182
182
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -1638,6 +1638,9 @@ bool ISQL_statement_ends_in_comment(const char* statement)
1638
1638
if (!altQuoteChar || lastChar == altQuoteChar)
1639
1639
state = normal;
1640
1640
break;
1641
+
1642
+ default:
1643
+ break;
1641
1644
}
1642
1645
break;
1643
1646
@@ -1650,6 +1653,8 @@ bool ISQL_statement_ends_in_comment(const char* statement)
1650
1653
case in_double_quoted_string:
1651
1654
state = normal;
1652
1655
break;
1656
+ default:
1657
+ break;
1653
1658
}
1654
1659
break;
1655
1660
@@ -6005,7 +6010,7 @@ static bool isyesno(const TEXT* buffer)
6005
6010
6006
6011
static bool printUser(const char* dbName)
6007
6012
{
6008
- unsigned char info[] = {fb_info_username, fb_info_sqlrole};
6013
+ constexpr unsigned char info[] = {fb_info_username, fb_info_sqlrole};
6009
6014
unsigned char buffer[(1 + 2 + MAX_SQL_IDENTIFIER_SIZE) * 2 + 2];
6010
6015
string login, role;
6011
6016
@@ -6111,7 +6116,7 @@ static bool printUser(const char* dbName)
6111
6116
const char* text;
6112
6117
const char* skip;
6113
6118
};
6114
- FieldInfo fieldInfo[2] = {
6119
+ constexpr FieldInfo fieldInfo[2] = {
6115
6120
{"User", NULL},
6116
6121
{"Role", "NONE"}
6117
6122
};
@@ -6681,7 +6686,7 @@ static processing_state parse_arg(int argc, SCHAR** argv, QualifiedMetaString& t
6681
6686
6682
6687
// Interpret each command line argument
6683
6688
6684
- const SCHAR switchchar = '-';
6689
+ constexpr SCHAR switchchar = '-';
6685
6690
6686
6691
#ifdef DEV_BUILD
6687
6692
bool istable = false;
@@ -7781,7 +7786,7 @@ static processing_state print_line(Firebird::IMessageMetadata* message, UCHAR* b
7781
7786
* line = pointer to the line buffer.
7782
7787
*
7783
7788
**************************************/
7784
- const unsigned maxblob = 20;
7789
+ constexpr unsigned maxblob = 20;
7785
7790
IsqlVar varlist[maxblob]; // No more than 20 blobs per line
7786
7791
unsigned varnum = 0;
7787
7792
@@ -9179,7 +9184,7 @@ void PerTableStats::printStats(Firebird::IAttachment* att)
9179
9184
string h;
9180
9185
9181
9186
const unsigned lenTable = maxTabLen < 32 ? 32 : FB_ALIGN(maxTabLen, 4);
9182
- const unsigned lenValue = 9;
9187
+ constexpr unsigned lenValue = 9;
9183
9188
9184
9189
h.append(lenTable, '-');
9185
9190
h.append(1, '+');
0 commit comments