Skip to content

Commit 9641916

Browse files
committed
Fix conversion warnings in config_file
+ constexpr
1 parent 66165cf commit 9641916

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/common/config/config_file.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ ConfigFile::LineType ConfigFile::parseLine(const char* fileName, const String& i
342342
return LINE_INCLUDE;
343343
}
344344
}
345-
// fall down ...
345+
[[fallthrough]];
346346
case '\r':
347347
break;
348348

@@ -375,7 +375,7 @@ ConfigFile::LineType ConfigFile::parseLine(const char* fileName, const String& i
375375
}
376376
break;
377377
}
378-
// fall through ....
378+
[[fallthrough]];
379379

380380
default:
381381
if (inString >= 2) // Something after the end of line
@@ -414,7 +414,7 @@ ConfigFile::LineType ConfigFile::parseLine(const char* fileName, const String& i
414414
* Substitute macro values in a string
415415
*/
416416

417-
unsigned ConfigFile::getDirSeparatorLength(const String& value, size_t separatorPosition) const
417+
unsigned ConfigFile::getDirSeparatorLength(const String& value, String::size_type separatorPosition) const
418418
{
419419
if (separatorPosition >= value.length())
420420
return 0;
@@ -481,7 +481,7 @@ bool ConfigFile::macroParse(String& value, const char* fileName) const
481481

482482
if (flags & REGEXP_SUPPORT)
483483
{
484-
size_t pos = 0;
484+
String::size_type pos = 0;
485485
while ((pos = macro.find('\\', pos)) != String::npos)
486486
{
487487
macro.insert(pos, "\\");
@@ -567,7 +567,7 @@ bool ConfigFile::substituteStandardDir(const String& from, String& to) const
567567
{
568568
using namespace fb_utils;
569569

570-
struct Dir {
570+
constexpr struct Dir {
571571
unsigned code;
572572
const char* name;
573573
} dirs[] = {

src/common/config/config_file.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ class ConfigFile : public Firebird::AutoStorage, public Firebird::RefCounted
5252
{
5353
public:
5454
// flags for config file
55-
static const USHORT HAS_SUB_CONF = 0x01;
56-
static const USHORT ERROR_WHEN_MISS = 0x02;
57-
static const USHORT NATIVE_ORDER = 0x04;
58-
static const USHORT NO_COMMENTS = 0x08;
59-
static const USHORT CUSTOM_MACROS = 0x10;
60-
static const USHORT REGEXP_SUPPORT = 0x20;
55+
static inline constexpr USHORT HAS_SUB_CONF = 0x01;
56+
static inline constexpr USHORT ERROR_WHEN_MISS = 0x02;
57+
static inline constexpr USHORT NATIVE_ORDER = 0x04;
58+
static inline constexpr USHORT NO_COMMENTS = 0x08;
59+
static inline constexpr USHORT CUSTOM_MACROS = 0x10;
60+
static inline constexpr USHORT REGEXP_SUPPORT = 0x20;
6161

6262
// enum to distinguish ctors
6363
enum UseText {USE_TEXT};
@@ -134,7 +134,7 @@ class ConfigFile : public Firebird::AutoStorage, public Firebird::RefCounted
134134
USHORT flags;
135135
unsigned includeLimit;
136136
ConfigCache* filesCache;
137-
static const unsigned INCLUDE_LIMIT = 64;
137+
static inline constexpr unsigned INCLUDE_LIMIT = 64;
138138

139139
// utilities
140140
bool getLine(Stream* stream, String&, unsigned int&);
@@ -146,7 +146,7 @@ class ConfigFile : public Firebird::AutoStorage, public Firebird::RefCounted
146146
bool wildCards(const char* currentFileName, const Firebird::PathName& pathPrefix, FilesArray& components);
147147
bool substituteStandardDir(const String& from, String& to) const;
148148
void adjustMacroReplacePositions(const String& value, const String& macro, String::size_type& from, String::size_type& to) const;
149-
unsigned getDirSeparatorLength(const String& value, size_t subFrom) const;
149+
unsigned getDirSeparatorLength(const String& value, String::size_type subFrom) const;
150150
};
151151

152152
#endif // CONFIG_CONFIG_FILE_H

0 commit comments

Comments
 (0)