Skip to content

Commit 273b5e6

Browse files
committed
Fix conversion warning in SimilarToRegex
+ constexpr
1 parent 30af0da commit 273b5e6

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/common/SimilarToRegex.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ namespace
5353
return c;
5454
}
5555

56-
static const unsigned COMP_FLAG_PREFER_FEWER = 0x01;
57-
static const unsigned COMP_FLAG_GROUP_CAPTURE = 0x02;
58-
static const unsigned COMP_FLAG_CASE_INSENSITIVE = 0x04;
59-
static const unsigned COMP_FLAG_LATIN = 0x08;
60-
static const unsigned COMP_FLAG_WELLFORMED = 0x10;
56+
static constexpr unsigned COMP_FLAG_PREFER_FEWER = 0x01;
57+
static constexpr unsigned COMP_FLAG_GROUP_CAPTURE = 0x02;
58+
static constexpr unsigned COMP_FLAG_CASE_INSENSITIVE = 0x04;
59+
static constexpr unsigned COMP_FLAG_LATIN = 0x08;
60+
static constexpr unsigned COMP_FLAG_WELLFORMED = 0x10;
6161

6262
class SimilarToCompiler
6363
{
@@ -335,7 +335,7 @@ namespace
335335
const char* re2ClassInclude;
336336
const char* re2ClassExcludeUtf;
337337
const char* re2ClassExcludeLatin;
338-
} static const classes[] =
338+
} static constexpr classes[] =
339339
{
340340
{"alnum", "[:alnum:]", "[:^alnum:]", "[:^alnum:]"},
341341
{"alpha", "[:alpha:]", "[:^alpha:]", "[:^alpha:]"},
@@ -646,7 +646,7 @@ namespace
646646
}
647647

648648
private:
649-
static const int PARSE_FLAG_NOT_EMPTY = 1; // known never to match empty string
649+
static constexpr int PARSE_FLAG_NOT_EMPTY = 1; // known never to match empty string
650650

651651
string re2PatternStr;
652652
const char* patternStr;
@@ -880,7 +880,7 @@ bool SubstringSimilarRegex::matches(const char* buffer, unsigned bufferLen,
880880
if (RE2::FullMatch(sp, *regexp.get(), nullptr, &spResult, nullptr))
881881
{
882882
*resultStart = spResult.begin() - buffer;
883-
*resultLength = spResult.length();
883+
*resultLength = static_cast<unsigned>(spResult.length());
884884
return true;
885885
}
886886
else

src/common/SimilarToRegex.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ namespace Firebird {
3232

3333
namespace SimilarToFlag
3434
{
35-
static const unsigned CASE_INSENSITIVE = 0x1;
36-
static const unsigned LATIN = 0x2;
37-
static const unsigned WELLFORMED = 0x4;
35+
static inline constexpr unsigned CASE_INSENSITIVE = 0x1;
36+
static inline constexpr unsigned LATIN = 0x2;
37+
static inline constexpr unsigned WELLFORMED = 0x4;
3838
};
3939

4040
class SimilarToRegex : public PermanentStorage
@@ -71,9 +71,9 @@ class SimilarToRegex : public PermanentStorage
7171
case '+':
7272
case '*':
7373
return true;
74+
default:
75+
return false;
7476
}
75-
76-
return false;
7777
}
7878

7979
private:

0 commit comments

Comments
 (0)