Skip to content

Commit 8db64f3

Browse files
committed
noexcept in IntlParametersBlock, make subclasses final
1 parent f2a5fe3 commit 8db64f3

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

src/common/IntlParametersBlock.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ namespace Firebird
100100

101101
void IntlParametersBlock::toUtf8(ClumpletWriter& pb)
102102
{
103-
UCHAR utf8Tag = getUtf8Tag();
103+
const UCHAR utf8Tag = getUtf8Tag();
104104
if (utf8Tag)
105105
{
106106
pb.insertTag(utf8Tag);
@@ -111,7 +111,7 @@ void IntlParametersBlock::toUtf8(ClumpletWriter& pb)
111111

112112
void IntlParametersBlock::fromUtf8(ClumpletWriter& pb)
113113
{
114-
UCHAR utf8Tag = getUtf8Tag();
114+
const UCHAR utf8Tag = getUtf8Tag();
115115
if (utf8Tag)
116116
{
117117
pb.deleteWithTag(utf8Tag);
@@ -128,7 +128,7 @@ void IntlParametersBlock::processParametersBlock(ProcessString* processString, C
128128
{
129129
for (pb.rewind(); !pb.isEof(); )
130130
{
131-
UCHAR tag = pb.getClumpTag();
131+
const UCHAR tag = pb.getClumpTag();
132132
string s;
133133

134134
tagName = NULL;
@@ -180,7 +180,7 @@ void IntlParametersBlock::processParametersBlock(ProcessString* processString, C
180180
#define FB_IPB_TAG(t) case t: if (!*tagName) *tagName = #t
181181

182182

183-
IntlParametersBlock::TagType IntlDpb::checkTag(UCHAR tag, const char** tagName)
183+
IntlParametersBlock::TagType IntlDpb::checkTag(UCHAR tag, const char** tagName) noexcept
184184
{
185185
switch (tag)
186186
{
@@ -197,13 +197,13 @@ IntlParametersBlock::TagType IntlDpb::checkTag(UCHAR tag, const char** tagName)
197197
FB_IPB_TAG(isc_dpb_owner);
198198
FB_IPB_TAG(isc_dpb_search_path);
199199
return TAG_STRING;
200+
default:
201+
return TAG_SKIP;
200202
}
201-
202-
return TAG_SKIP;
203203
}
204204

205205

206-
IntlParametersBlock::TagType IntlSpb::checkTag(UCHAR tag, const char** tagName)
206+
IntlParametersBlock::TagType IntlSpb::checkTag(UCHAR tag, const char** tagName) noexcept
207207
{
208208
switch (tag)
209209
{
@@ -218,13 +218,14 @@ IntlParametersBlock::TagType IntlSpb::checkTag(UCHAR tag, const char** tagName)
218218

219219
FB_IPB_TAG(isc_spb_command_line);
220220
return TAG_COMMAND_LINE;
221-
}
222221

223-
return TAG_SKIP;
222+
default:
223+
return TAG_SKIP;
224+
}
224225
}
225226

226227

227-
IntlParametersBlock::TagType IntlSpbStart::checkTag(UCHAR tag, const char** tagName)
228+
IntlParametersBlock::TagType IntlSpbStart::checkTag(UCHAR tag, const char** tagName) noexcept
228229
{
229230
switch (tag)
230231
{
@@ -353,19 +354,19 @@ IntlParametersBlock::TagType IntlSpbStart::checkTag(UCHAR tag, const char** tagN
353354
#undef FB_IPB_TAG
354355

355356

356-
UCHAR IntlDpb::getUtf8Tag()
357+
UCHAR IntlDpb::getUtf8Tag() noexcept
357358
{
358359
return isc_dpb_utf8_filename;
359360
}
360361

361362

362-
UCHAR IntlSpb::getUtf8Tag()
363+
UCHAR IntlSpb::getUtf8Tag() noexcept
363364
{
364365
return isc_spb_utf8_filename;
365366
}
366367

367368

368-
UCHAR IntlSpbStart::getUtf8Tag()
369+
UCHAR IntlSpbStart::getUtf8Tag() noexcept
369370
{
370371
return 0;
371372
}

src/common/IntlParametersBlock.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ class IntlParametersBlock
4141
enum TagType { TAG_SKIP, TAG_STRING, TAG_COMMAND_LINE };
4242
typedef void ProcessString(string& s);
4343

44-
virtual TagType checkTag(UCHAR tag, const char** tagName) = 0;
45-
virtual UCHAR getUtf8Tag() = 0;
44+
virtual TagType checkTag(UCHAR tag, const char** tagName) noexcept = 0;
45+
virtual UCHAR getUtf8Tag() noexcept = 0;
4646

4747
void toUtf8(ClumpletWriter& pb);
4848
void fromUtf8(ClumpletWriter& pb);
@@ -51,29 +51,29 @@ class IntlParametersBlock
5151
void processParametersBlock(ProcessString* processString, ClumpletWriter& pb);
5252
};
5353

54-
class IntlDpb : public IntlParametersBlock
54+
class IntlDpb final : public IntlParametersBlock
5555
{
5656
public:
57-
TagType checkTag(UCHAR tag, const char** tagName);
58-
UCHAR getUtf8Tag();
57+
TagType checkTag(UCHAR tag, const char** tagName) noexcept override;
58+
UCHAR getUtf8Tag() noexcept final;
5959
};
6060

61-
class IntlSpb : public IntlParametersBlock
61+
class IntlSpb final : public IntlParametersBlock
6262
{
6363
public:
64-
TagType checkTag(UCHAR tag, const char** tagName);
65-
UCHAR getUtf8Tag();
64+
TagType checkTag(UCHAR tag, const char** tagName) noexcept override;
65+
UCHAR getUtf8Tag() noexcept override;
6666
};
6767

68-
class IntlSpbStart : public IntlParametersBlock
68+
class IntlSpbStart final : public IntlParametersBlock
6969
{
7070
public:
71-
IntlSpbStart()
71+
IntlSpbStart() noexcept
7272
: mode(0)
7373
{ }
7474

75-
TagType checkTag(UCHAR tag, const char** tagName);
76-
UCHAR getUtf8Tag();
75+
TagType checkTag(UCHAR tag, const char** tagName) noexcept override;
76+
UCHAR getUtf8Tag() noexcept final;
7777

7878
private:
7979
UCHAR mode;

0 commit comments

Comments
 (0)