Skip to content

Commit 1330236

Browse files
committed
Fix -Wswitch warnings in config
+ (inline) constexpr
1 parent 308b3d0 commit 1330236

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

src/common/config/config.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ void Config::loadValues(const ConfigFile& file, const char* srcName)
282282
checkValues();
283283
}
284284

285-
static const char* txtServerModes[6] =
285+
static constexpr const char* txtServerModes[6] =
286286
{
287287
"Super", "ThreadedDedicated",
288288
"SuperClassic", "ThreadedShared",
@@ -445,6 +445,9 @@ Config::~Config()
445445
break;
446446
//case TYPE_STRING_VECTOR:
447447
// break;
448+
default:
449+
// nothing to free
450+
break;
448451
}
449452
}
450453

@@ -581,6 +584,9 @@ ConfigValue Config::specialProcessing(ConfigKey key, ConfigValue val)
581584
val.strVal = "security.db";
582585
}
583586
break;
587+
default:
588+
// no special processing
589+
break;
584590
}
585591

586592
return val;
@@ -724,7 +730,7 @@ int Config::getWireCrypt(WireCryptMode wcMode) const
724730
/// class FirebirdConf
725731

726732
// array format: major, minor, release, build
727-
static unsigned short fileVerNumber[4] = {FILE_VER_NUMBER};
733+
static constexpr unsigned short fileVerNumber[4] = {FILE_VER_NUMBER};
728734

729735
static inline unsigned int getPartialVersion()
730736
{
@@ -738,8 +744,8 @@ static inline unsigned int getFullVersion()
738744
return getPartialVersion() | fileVerNumber[3];
739745
}
740746

741-
static unsigned int PARTIAL_MASK = 0xFFFF0000;
742-
static unsigned int KEY_MASK = 0xFFFF;
747+
static constexpr unsigned int PARTIAL_MASK = 0xFFFF0000;
748+
static constexpr unsigned int KEY_MASK = 0xFFFF;
743749

744750
static inline void checkKey(unsigned int& key)
745751
{

src/common/config/config.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,17 @@ extern const char* GCPolicyCooperative;
7878
extern const char* GCPolicyBackground;
7979
extern const char* GCPolicyCombined;
8080

81-
const int WIRE_CRYPT_DISABLED = 0;
82-
const int WIRE_CRYPT_ENABLED = 1;
83-
const int WIRE_CRYPT_REQUIRED = 2;
81+
inline constexpr int WIRE_CRYPT_DISABLED = 0;
82+
inline constexpr int WIRE_CRYPT_ENABLED = 1;
83+
inline constexpr int WIRE_CRYPT_REQUIRED = 2;
8484

8585
enum WireCryptMode {WC_CLIENT, WC_SERVER}; // Have different defaults
8686

87-
const int MODE_SUPER = 0;
88-
const int MODE_SUPERCLASSIC = 1;
89-
const int MODE_CLASSIC = 2;
87+
inline constexpr int MODE_SUPER = 0;
88+
inline constexpr int MODE_SUPERCLASSIC = 1;
89+
inline constexpr int MODE_CLASSIC = 2;
9090

91-
const char* const CONFIG_FILE = "firebird.conf";
91+
constexpr const char* CONFIG_FILE = "firebird.conf";
9292

9393
struct ConfigValue
9494
{
@@ -209,7 +209,7 @@ struct ConfigEntry
209209
ConfigValue default_value;
210210
};
211211

212-
constexpr ConfigEntry entries[MAX_CONFIG_KEY] =
212+
inline constexpr ConfigEntry entries[MAX_CONFIG_KEY] =
213213
{
214214
{TYPE_INTEGER, "TempBlockSize", true, 1048576}, // bytes
215215
{TYPE_INTEGER, "TempCacheLimit", false, -1}, // bytes

0 commit comments

Comments
 (0)