Skip to content

Commit 9ce53b2

Browse files
committed
More noexcept in fb_string
1 parent 1c10332 commit 9ce53b2

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/common/classes/fb_string.h

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ namespace Firebird
104104
newSize = size_type(bufferSize) * 2u;
105105

106106
// Do not grow buffer beyond string length limit
107-
size_type max_length = getMaxLength() + 1;
107+
const size_type max_length = getMaxLength() + 1;
108108
if (newSize > max_length)
109109
newSize = max_length;
110110

@@ -142,7 +142,7 @@ namespace Firebird
142142
size_type newSize = len + 1 + INIT_RESERVE;
143143

144144
// Do not grow buffer beyond string length limit
145-
size_type max_length = getMaxLength() + 1;
145+
const size_type max_length = getMaxLength() + 1;
146146
if (newSize > max_length)
147147
newSize = max_length;
148148

@@ -169,7 +169,7 @@ namespace Firebird
169169
AbstractString(const size_type limit, const S& v)
170170
: max_length(static_cast<internal_size_type>(limit))
171171
{
172-
FB_SIZE_T l = v.length();
172+
const FB_SIZE_T l = v.length();
173173
initialize(l);
174174
memcpy(stringBuffer, v.c_str(), l);
175175
}
@@ -225,7 +225,7 @@ namespace Firebird
225225
}
226226
}
227227

228-
pointer modify()
228+
pointer modify() noexcept
229229
{
230230
return stringBuffer;
231231
}
@@ -247,17 +247,17 @@ namespace Firebird
247247

248248
bool baseMove(AbstractString&& rhs);
249249

250-
size_type getMaxLength() const
250+
size_type getMaxLength() const noexcept
251251
{
252252
return max_length;
253253
}
254254

255255
public:
256-
const_pointer c_str() const
256+
const_pointer c_str() const noexcept
257257
{
258258
return stringBuffer;
259259
}
260-
size_type length() const
260+
size_type length() const noexcept
261261
{
262262
return stringLength;
263263
}
@@ -268,7 +268,7 @@ namespace Firebird
268268
// Almost same as c_str(), but return 0, not "",
269269
// when string has no data. Useful when interacting
270270
// with old code, which does check for NULL.
271-
const_pointer nullStr() const
271+
const_pointer nullStr() const noexcept
272272
{
273273
return stringLength ? stringBuffer : 0;
274274
}
@@ -367,19 +367,19 @@ namespace Firebird
367367
return find_last_not_of(s, pos, 1);
368368
}
369369

370-
iterator begin()
370+
iterator begin() noexcept
371371
{
372372
return modify();
373373
}
374-
const_iterator begin() const
374+
const_iterator begin() const noexcept
375375
{
376376
return c_str();
377377
}
378-
iterator end()
378+
iterator end() noexcept
379379
{
380380
return modify() + length();
381381
}
382-
const_iterator end() const
382+
const_iterator end() const noexcept
383383
{
384384
return c_str() + length();
385385
}
@@ -401,28 +401,28 @@ namespace Firebird
401401
{
402402
return at(pos);
403403
}
404-
const_pointer data() const
404+
const_pointer data() const noexcept
405405
{
406406
return c_str();
407407
}
408-
size_type size() const
408+
size_type size() const noexcept
409409
{
410410
return length();
411411
}
412-
size_type capacity() const
412+
size_type capacity() const noexcept
413413
{
414414
return bufferSize - 1u;
415415
}
416-
bool empty() const
416+
bool empty() const noexcept
417417
{
418418
return length() == 0;
419419
}
420-
bool hasData() const
420+
bool hasData() const noexcept
421421
{
422422
return !empty();
423423
}
424424
// to satisfy both ways to check for empty string
425-
bool isEmpty() const
425+
bool isEmpty() const noexcept
426426
{
427427
return empty();
428428
}
@@ -637,7 +637,7 @@ namespace Firebird
637637
return memcmp(s1, s2, n);
638638
}
639639

640-
static AbstractString::size_type getMaxLength()
640+
static AbstractString::size_type getMaxLength() noexcept
641641
{
642642
return 0xFFFFFFFEu;
643643
}
@@ -650,7 +650,7 @@ namespace Firebird
650650
AbstractString::const_pointer s2,
651651
const AbstractString::size_type n);
652652

653-
static AbstractString::size_type getMaxLength()
653+
static AbstractString::size_type getMaxLength() noexcept
654654
{
655655
return 0xFFFEu;
656656
}
@@ -663,7 +663,7 @@ namespace Firebird
663663
AbstractString::const_pointer s2,
664664
const AbstractString::size_type n);
665665

666-
static AbstractString::size_type getMaxLength()
666+
static AbstractString::size_type getMaxLength() noexcept
667667
{
668668
return 0xFFFFFFFEu;
669669
}

0 commit comments

Comments
 (0)