Skip to content

Commit 934f0f2

Browse files
committed
ZXAlgorithms: introduce StrCat variadic template
This is faster and easier to read than constructing temporary std::string objects from char* or std::string_view just to use operator+ on them. For this to work also with const char* and char, there have to be new Size() overloads. Unfortunately, with `char ARRAY[] = "..."` Size(ARRAY) calls the `Size(const char *)` overload, not the `Size(T const (&)[N])` overload, so `N` is lost here. This required some other cleanup.
1 parent 4712561 commit 934f0f2

13 files changed

+59
-46
lines changed

core/src/Content.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct SymbologyIdentifier
3131
std::string toString(bool hasECI = false) const
3232
{
3333
int modVal = (modifier >= 'A' ? modifier - 'A' + 10 : modifier - '0') + eciModifierOffset * hasECI;
34-
return code ? ']' + std::string(1, code) + static_cast<char>((modVal >= 10 ? 'A' - 10 : '0') + modVal) : std::string();
34+
return code ? StrCat(']', code, static_cast<char>((modVal >= 10 ? 'A' - 10 : '0') + modVal)) : std::string();
3535
}
3636
};
3737

core/src/MultiFormatWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ MultiFormatWriter::encode(const std::wstring& contents, int width, int height) c
6969
case BarcodeFormat::ITF: return exec0(OneD::ITFWriter());
7070
case BarcodeFormat::UPCA: return exec0(OneD::UPCAWriter());
7171
case BarcodeFormat::UPCE: return exec0(OneD::UPCEWriter());
72-
default: throw std::invalid_argument(std::string("Unsupported format: ") + ToString(_format));
72+
default: throw std::invalid_argument("Unsupported format: " + ToString(_format));
7373
}
7474
}
7575

core/src/WriteBarcode.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static int ParseECLevel(int symbology, std::string_view s)
209209
return res + 1;
210210

211211
if (std::from_chars(s.data(), s.data() + s.size() - (s.back() == '%'), res).ec != std::errc{})
212-
throw std::invalid_argument("Invalid ecLevel: '" + std::string(s) + "'");
212+
throw std::invalid_argument(StrCat("Invalid ecLevel: '", s, "'"));
213213

214214
auto findClosestECLevel = [](const std::vector<int>& list, int val) {
215215
int mIdx = -2, mAbs = 100;
@@ -383,7 +383,7 @@ zint_symbol* CreatorOptions::zint() const
383383

384384
#define CHECK(ZINT_CALL) \
385385
if (int err = (ZINT_CALL); err >= ZINT_ERROR) \
386-
throw std::invalid_argument(std::string(zint->errtxt) + " (retval: " + std::to_string(err) + ")");
386+
throw std::invalid_argument(StrCat(zint->errtxt, " (retval: ", std::to_string(err), ")"));
387387

388388
Barcode CreateBarcode(const void* data, int size, int mode, const CreatorOptions& opts)
389389
{

core/src/ZXAlgorithms.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,25 @@ constexpr auto Size(const Container& c) -> decltype(c.size(), int()) {
7878
}
7979

8080
template <class T, std::size_t N>
81-
constexpr int Size(const T (&)[N]) noexcept {
81+
constexpr int Size(T const (&)[N]) noexcept {
8282
return narrow_cast<int>(N);
8383
}
8484

85+
inline constexpr int Size(const char* s) noexcept {
86+
return narrow_cast<int>(std::char_traits<char>::length(s));
87+
}
88+
89+
inline constexpr int Size(char) noexcept { return 1; }
90+
91+
template <typename... Args>
92+
std::string StrCat(Args&&... args)
93+
{
94+
std::string res;
95+
res.reserve((Size(args) + ...));
96+
(res += ... += args);
97+
return res;
98+
}
99+
85100
template <typename Container, typename Value>
86101
int IndexOf(const Container& c, const Value& v) {
87102
auto i = Find(c, v);

core/src/aztec/AZHighLevelEncoder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ static const std::array<std::array<int8_t, 256>, 5>& InitCharMap()
8383
}
8484
charmap[MODE_DIGIT][','] = 12;
8585
charmap[MODE_DIGIT]['.'] = 13;
86-
const int8_t mixedTable[] = {
86+
constexpr int8_t mixedTable[] = {
8787
0x00, 0x20, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
8888
0x0d, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x40, 0x5c, 0x5e, 0x5f, 0x60, 0x7c, 0x7d, 0x7f,
8989
};
9090
for (uint8_t i = 0; i < Size(mixedTable); i++) {
9191
charmap[MODE_MIXED][mixedTable[i]] = i;
9292
}
93-
const char punctTable[] = {'\0', '\r', '\0', '\0', '\0', '\0', '!', '\'', '#', '$', '%', '&', '\'', '(', ')', '*',
94-
'+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '[', ']', '{', '}'};
93+
constexpr std::array punctTable = {'\0', '\r', '\0', '\0', '\0', '\0', '!', '\'', '#', '$', '%', '&', '\'', '(', ')', '*',
94+
'+', ',', '-', '.', '/', ':', ';', '<', '=', '>', '?', '[', ']', '{', '}'};
9595
for (uint8_t i = 0; i < Size(punctTable); i++) {
9696
if (punctTable[i] > 0) {
9797
charmap[MODE_PUNCT][punctTable[i]] = i;

core/src/datamatrix/DMDecoder.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,22 @@ namespace DecodedBitStreamParser {
4141
* See ISO 16022:2006, Annex C Table C.1
4242
* The C40 Basic Character Set (*'s used for placeholders for the shift values)
4343
*/
44-
static const char C40_BASIC_SET_CHARS[] = {
44+
static constexpr std::array C40_BASIC_SET_CHARS = {
4545
'*', '*', '*', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
4646
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
4747
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
4848
};
4949

50-
static const char C40_SHIFT2_SET_CHARS[] = {
50+
static constexpr std::array C40_SHIFT2_SET_CHARS = {
5151
'!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.',
52-
'/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', 29 // FNC1->29
52+
'/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '^', '_', (char)29 // FNC1->29
5353
};
5454

5555
/**
5656
* See ISO 16022:2006, Annex C Table C.2
5757
* The Text Basic Character Set (*'s used for placeholders for the shift values)
5858
*/
59-
static const char TEXT_BASIC_SET_CHARS[] = {
59+
static constexpr std::array TEXT_BASIC_SET_CHARS = {
6060
'*', '*', '*', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
6161
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
6262
'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
@@ -65,9 +65,9 @@ static const char TEXT_BASIC_SET_CHARS[] = {
6565
// Shift 2 for Text is the same encoding as C40
6666
#define TEXT_SHIFT2_SET_CHARS C40_SHIFT2_SET_CHARS
6767

68-
static const char TEXT_SHIFT3_SET_CHARS[] = {
68+
static constexpr std::array TEXT_SHIFT3_SET_CHARS = {
6969
'`', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
70-
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', 127
70+
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '{', '|', '}', '~', (char)127
7171
};
7272

7373
struct Shift128
@@ -146,23 +146,23 @@ static void DecodeC40OrTextSegment(BitSource& bits, Content& result, Mode mode)
146146
Shift128 upperShift;
147147
int shift = 0;
148148

149-
const char* BASIC_SET_CHARS = mode == Mode::C40 ? C40_BASIC_SET_CHARS : TEXT_BASIC_SET_CHARS;
150-
const char* SHIFT_SET_CHARS = mode == Mode::C40 ? C40_SHIFT2_SET_CHARS : TEXT_SHIFT2_SET_CHARS;
149+
auto& BASIC_SET_CHARS = mode == Mode::C40 ? C40_BASIC_SET_CHARS : TEXT_BASIC_SET_CHARS;
150+
auto& SHIFT_SET_CHARS = mode == Mode::C40 ? C40_SHIFT2_SET_CHARS : TEXT_SHIFT2_SET_CHARS;
151151

152152
while (auto triple = DecodeNextTriple(bits)) {
153153
for (int cValue : *triple) {
154154
switch (std::exchange(shift, 0)) {
155155
case 0:
156156
if (cValue < 3)
157157
shift = cValue + 1;
158-
else if (cValue < 40) // Size(BASIC_SET_CHARS)
158+
else if (cValue < Size(BASIC_SET_CHARS))
159159
result.push_back(upperShift(BASIC_SET_CHARS[cValue]));
160160
else
161161
throw FormatError("invalid value in C40 or Text segment");
162162
break;
163163
case 1: result.push_back(upperShift(cValue)); break;
164164
case 2:
165-
if (cValue < 28) // Size(SHIFT_SET_CHARS))
165+
if (cValue < Size(SHIFT_SET_CHARS))
166166
result.push_back(upperShift(SHIFT_SET_CHARS[cValue]));
167167
else if (cValue == 30) // Upper Shift
168168
upperShift.set = true;

core/src/oned/ODCodabarReader.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616

1717
namespace ZXing::OneD {
1818

19-
static const char ALPHABET[] = "0123456789-$:/.+ABCD";
19+
static constexpr char ALPHABET[] = "0123456789-$:/.+ABCD";
2020

2121
// These represent the encodings of characters, as patterns of wide and narrow bars. The 7 least-significant bits of
2222
// each int correspond to the pattern of wide and narrow, with 1s representing wide and 0s representing narrow.
23-
static const int CHARACTER_ENCODINGS[] = {
23+
static constexpr int CHARACTER_ENCODINGS[] = {
2424
0x03, 0x06, 0x09, 0x60, 0x12, 0x42, 0x21, 0x24, 0x30, 0x48, // 0-9
2525
0x0c, 0x18, 0x45, 0x51, 0x54, 0x15, 0x1A, 0x29, 0x0B, 0x0E, // -$:/.+ABCD
2626
};
2727

28-
static_assert(Size(ALPHABET) - 1 == Size(CHARACTER_ENCODINGS), "table size mismatch");
28+
static_assert(Size(ALPHABET) == Size(CHARACTER_ENCODINGS), "table size mismatch");
2929

3030
// some industries use a checksum standard but this is not part of the original codabar standard
3131
// for more information see : http://www.mecsw.com/specs/codabar.html

core/src/oned/ODCodabarWriter.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@
1111
#include "ZXAlgorithms.h"
1212

1313
#include <stdexcept>
14+
#include <string_view>
1415
#include <vector>
1516

1617
namespace ZXing::OneD {
1718

18-
static constexpr wchar_t START_END_CHARS[] = L"ABCD";
19-
static constexpr wchar_t ALT_START_END_CHARS[] = L"TN*E";
20-
static constexpr wchar_t CHARS_WHICH_ARE_TEN_LENGTH_EACH_AFTER_DECODED[] = L"/:+.";
19+
static constexpr std::wstring_view START_END_CHARS = L"ABCD";
20+
static constexpr std::wstring_view ALT_START_END_CHARS = L"TN*E";
21+
static constexpr std::wstring_view CHARS_WHICH_ARE_TEN_LENGTH_EACH_AFTER_DECODED = L"/:+.";
2122
static constexpr wchar_t DEFAULT_GUARD = START_END_CHARS[0];
2223

23-
static constexpr wchar_t ALPHABET[] = L"0123456789-$:/.+ABCD";
24+
static constexpr std::wstring_view ALPHABET = L"0123456789-$:/.+ABCD";
2425

2526
static constexpr int WIDE_TO_NARROW_BAR_RATIO = 2; //TODO: spec says 2.25 to 3 is the valid range. So this is technically illformed.
2627

@@ -33,7 +34,7 @@ static const int CHARACTER_ENCODINGS[] = {
3334
0x00c, 0x018, 0x045, 0x051, 0x054, 0x015, 0x01A, 0x029, 0x00B, 0x00E, // -$:/.+ABCD
3435
};
3536

36-
static_assert(Size(ALPHABET) - 1 == Size(CHARACTER_ENCODINGS), "table size mismatch");
37+
static_assert(Size(ALPHABET) == Size(CHARACTER_ENCODINGS), "table size mismatch");
3738

3839
BitMatrix
3940
CodabarWriter::encode(const std::wstring& contents_, int width, int height) const
@@ -97,7 +98,7 @@ CodabarWriter::encode(const std::wstring& contents_, int width, int height) cons
9798
resultLength += 10;
9899
}
99100
else {
100-
throw std::invalid_argument(std::string("Cannot encode : '") + static_cast<char>(c) + std::string("'"));
101+
throw std::invalid_argument(StrCat("Cannot encode : '", static_cast<char>(c), "'"));
101102
}
102103
}
103104
// A blank is placed between each character.

core/src/oned/ODCode39Reader.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
namespace ZXing::OneD {
1616

17-
static const char ALPHABET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*";
17+
static constexpr char ALPHABET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*";
1818

1919
/**
2020
* Each character consists of 5 bars and 4 spaces, 3 of which are wide (i.e. 6 are narrow).
@@ -23,17 +23,17 @@ static const char ALPHABET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*";
2323
* The 9 least-significant bits of each int correspond to the pattern of wide and narrow,
2424
* with 1s representing "wide" and 0s representing "narrow".
2525
*/
26-
static const int CHARACTER_ENCODINGS[] = {
26+
static constexpr std::array CHARACTER_ENCODINGS = {
2727
0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064, // 0-9
2828
0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C, // A-J
2929
0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106, 0x046, 0x016, // K-T
3030
0x181, 0x0C1, 0x1C0, 0x091, 0x190, 0x0D0, 0x085, 0x184, 0x0C4, 0x0A8, // U-$
3131
0x0A2, 0x08A, 0x02A, 0x094 // /-% , *
3232
};
3333

34-
static_assert(Size(ALPHABET) - 1 == Size(CHARACTER_ENCODINGS), "table size mismatch");
34+
static_assert(Size(ALPHABET) == Size(CHARACTER_ENCODINGS), "table size mismatch");
3535

36-
static const char PERCENTAGE_MAPPING[26] = {
36+
static constexpr std::array<char, 26> PERCENTAGE_MAPPING = {
3737
'A' - 38, 'B' - 38, 'C' - 38, 'D' - 38, 'E' - 38, // %A to %E map to control codes ESC to USep
3838
'F' - 11, 'G' - 11, 'H' - 11, 'I' - 11, 'J' - 11, // %F to %J map to ; < = > ?
3939
'K' + 16, 'L' + 16, 'M' + 16, 'N' + 16, 'O' + 16, // %K to %O map to [ \ ] ^ _

core/src/oned/ODCode39Writer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@
1818

1919
namespace ZXing::OneD {
2020

21-
static const char ALPHABET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%";
21+
static constexpr char ALPHABET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%";
2222

2323
/**
2424
* These represent the encodings of characters, as patterns of wide and narrow bars.
2525
* The 9 least-significant bits of each int correspond to the pattern of wide and narrow,
2626
* with 1s representing "wide" and 0s representing narrow.
2727
*/
28-
static const int CHARACTER_ENCODINGS[] = {
28+
static constexpr int CHARACTER_ENCODINGS[] = {
2929
0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064, // 0-9
3030
0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C, // A-J
3131
0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106, 0x046, 0x016, // K-T
3232
0x181, 0x0C1, 0x1C0, 0x091, 0x190, 0x0D0, 0x085, 0x184, 0x0C4, 0x094, // U-*
3333
0x0A8, 0x0A2, 0x08A, 0x02A // $-%
3434
};
3535

36-
static_assert(Size(ALPHABET) - 1 == Size(CHARACTER_ENCODINGS), "table size mismatch");
36+
static_assert(Size(ALPHABET) == Size(CHARACTER_ENCODINGS), "table size mismatch");
3737

3838
static const int ASTERISK_ENCODING = CHARACTER_ENCODINGS[39];
3939

core/src/oned/ODCode93Reader.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
namespace ZXing::OneD {
1717

1818
// Note that 'abcd' are dummy characters in place of control characters.
19-
static const char ALPHABET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*";
19+
static constexpr char ALPHABET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*";
2020

2121
/**
2222
* Each character consist of 3 bars and 3 spaces and is 9 modules wide in total.
@@ -25,7 +25,7 @@ static const char ALPHABET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*
2525
* The 9 least-significant bits of each int correspond to the 9 modules in a symbol.
2626
* Note: bit 9 (the first) is always 1, bit 1 (the last) is always 0.
2727
*/
28-
static const int CHARACTER_ENCODINGS[] = {
28+
static constexpr int CHARACTER_ENCODINGS[] = {
2929
0x114, 0x148, 0x144, 0x142, 0x128, 0x124, 0x122, 0x150, 0x112, 0x10A, // 0-9
3030
0x1A8, 0x1A4, 0x1A2, 0x194, 0x192, 0x18A, 0x168, 0x164, 0x162, 0x134, // A-J
3131
0x11A, 0x158, 0x14C, 0x146, 0x12C, 0x116, 0x1B4, 0x1B2, 0x1AC, 0x1A6, // K-T
@@ -34,7 +34,7 @@ static const int CHARACTER_ENCODINGS[] = {
3434
0x126, 0x1DA, 0x1D6, 0x132, 0x15E, // Control chars ($)==a, (%)==b, (/)==c, (+)==d, *
3535
};
3636

37-
static_assert(Size(ALPHABET) - 1 == Size(CHARACTER_ENCODINGS), "table size mismatch");
37+
static_assert(Size(ALPHABET) == Size(CHARACTER_ENCODINGS), "table size mismatch");
3838

3939
static const int ASTERISK_ENCODING = 0x15E;
4040

core/src/oned/ODCode93Writer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515

1616
namespace ZXing::OneD {
1717

18-
static const char ALPHABET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*";
18+
static constexpr char ALPHABET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%abcd*";
1919

2020
/**
2121
* These represent the encodings of characters, as patterns of wide and narrow bars.
2222
* The 9 least-significant bits of each int correspond to the pattern of wide and narrow.
2323
*/
24-
static const int CHARACTER_ENCODINGS[] = {
24+
static constexpr int CHARACTER_ENCODINGS[] = {
2525
0x114, 0x148, 0x144, 0x142, 0x128, 0x124, 0x122, 0x150, 0x112, 0x10A, // 0-9
2626
0x1A8, 0x1A4, 0x1A2, 0x194, 0x192, 0x18A, 0x168, 0x164, 0x162, 0x134, // A-J
2727
0x11A, 0x158, 0x14C, 0x146, 0x12C, 0x116, 0x1B4, 0x1B2, 0x1AC, 0x1A6, // K-T
@@ -30,7 +30,7 @@ static const int CHARACTER_ENCODINGS[] = {
3030
0x126, 0x1DA, 0x1D6, 0x132, 0x15E, // Control chars? $-*
3131
};
3232

33-
static_assert(Size(ALPHABET) - 1 == Size(CHARACTER_ENCODINGS), "table size mismatch");
33+
static_assert(Size(ALPHABET) == Size(CHARACTER_ENCODINGS), "table size mismatch");
3434

3535
static const int ASTERISK_ENCODING = CHARACTER_ENCODINGS[47];
3636

@@ -133,7 +133,7 @@ std::string Code93ConvertToExtended(const std::wstring& contents)
133133
extendedContent.push_back((char)('P' + character - '{'));
134134
}
135135
else {
136-
throw std::invalid_argument(std::string("Requested content contains a non-encodable character: '") + (char)character + "'");
136+
throw std::invalid_argument(StrCat("Requested content contains a non-encodable character: '", (char)character, "'"));
137137
}
138138
}
139139
return extendedContent;

core/src/qrcode/QRDecoder.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,14 @@ static char ToAlphaNumericChar(int value)
118118
/**
119119
* See ISO 18004:2006, 6.4.4 Table 5
120120
*/
121-
static const char ALPHANUMERIC_CHARS[] = {
121+
constexpr std::array ALPHANUMERIC_CHARS = {
122122
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B',
123123
'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
124124
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
125125
' ', '$', '%', '*', '+', '-', '.', '/', ':'
126126
};
127127

128-
if (value < 0 || value >= Size(ALPHANUMERIC_CHARS))
129-
throw std::out_of_range("ToAlphaNumericChar: out of range");
130-
131-
return ALPHANUMERIC_CHARS[value];
128+
return ALPHANUMERIC_CHARS.at(value);
132129
}
133130

134131
static void DecodeAlphanumericSegment(BitSource& bits, int count, Content& result)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy