Header-only C++11 library to encode/decode base64, base64url, base32, base32hex and hex (a.k.a. base16) as specified in RFC 4648, plus Crockford's base32. MIT licensed with consistent, flexible API.

cppcodec

Build Status Build status

Header-only C++11 library to encode/decode base64, base64url, base32, base32hex and hex (a.k.a. base16) as specified in RFC 4648, plus Crockford's base32.

MIT licensed with consistent, flexible API. Supports raw pointers, std::string and (templated) character vectors without unnecessary allocations. Cross-platform with measured decent performance and without compiler warnings.

Usage

  1. Import cppcodec into your project (copy, git submodule, etc.)
  2. Add the cppcodec root directory to your build system's list of include directories
  3. Include headers and start using the API.

Since cppcodec is a header-only library, no extra build step is needed. Alternatively, you can install the headers and build extra tools/tests with CMake.

Variants

A number of codec variants exist for base64 and base32, defining different alphabets or specifying the use of padding and line breaks in different ways. cppcodec is designed to let you make a conscious choice about which one you're using, see below for a list of variants.

cppcodec's approach is to implement encoding/decoding algorithms in different classes for namespacing (e.g. cppcodec::base64_rfc4648), with classes and their associated header files named verbatim after the codec variants.

Here is an expected standard use of cppcodec:

#include <cppcodec/base32_crockford.hpp>
#include <cppcodec/base64_rfc4648.hpp>
#include <iostream>

int main() {
  using base32 = cppcodec::base32_crockford;
  using base64 = cppcodec::base64_rfc4648;

  std::vector<uint8_t> decoded = base64::decode("YW55IGNhcm5hbCBwbGVhc3VyZQ==");
  std::cout << "decoded size (\"any carnal pleasure\"): " << decoded.size() << '\n';
  std::cout << base32::encode(decoded) << std::endl; // "C5Q7J833C5S6WRBC41R6RSB1EDTQ4S8"
  return 0;
}

(The prior example included "baseXX_default_*.h" includes, these are not recommended anymore and may eventually get deprecated.)

Currently supported codec variants are:

base64

  • base64_rfc4648 uses the PEM/MIME/UTF-7 alphabet, that is (in order) A-Z, a-z, 0-9 plus characters '+' and '/'. This is what's usually considered the "standard base64" that you see everywhere and requires padding ('=') but no line breaks. Whitespace and other out-of-alphabet symbols are regarded as a parse error.
  • base64_url is the same as base64_rfc4648 (and defined in the same RFC) but uses '-' (minus) and '_' (underscore) as special characters instead of '+' and '/'. This is safe to use for URLs and file names. Padding with '=' is required, it will be generated when encoding to a string and regarded as a parse error if it's not present when decoding.
  • base64_url_unpadded variant is the same as base64_url, but '=' padding characters are optional. When encoding, no padding will be appended to the resulting string. Decoding accepts either padded or unpadded strings.

base32

All base32 variants encode 5 bits as one (8-bit) character, which results in an encoded length of roughly 160% (= 8/5). Their selling point is mainly case-insensitive decoding, no special characters and alphabets that can be communicated via phone.

  • base32_rfc4648 implements the popular, standardized variant defined in RFC 4648. It uses the full upper-case alphabet A-Z for the first 26 values and the digit characters 2-7 for the last ten. Padding with '=' is required and makes the encoded string a multiple of 8 characters. The codec accepts no invalid symbols, so if you want to let the user enter base32 data then consider replacing numbers '0', '1' and '8' with 'O', 'I' and 'B' on input.
  • base32_crockford implements Crockford base32. It's less widely used than the RFC 4648 alphabet, but offers a more carefully picked alphabet and also defines decoding similar characters 'I', 'i', 'L' 'l' as '1' plus 'O' and 'o' as '0' so no care is required for user input. Crockford base32 does not use '=' padding. Checksums are not implemented. Note that the specification is ambiguous about whether to pad bit quintets to the left or to the right, i.e. whether the codec is a place-based single number encoding system or a concatenative iterative stream encoder. This codec variant picks the streaming interpretation and thus zero-pads on the right. (See http://merrigrove.blogspot.ca/2014/04/what-heck-is-base64-encoding-really.html for a detailed discussion of the issue.)
  • base32_hex is the logical extension of the hexadecimal alphabet, and also specified in RFC 4648. It uses the digit characters 0-9 for the first 10 values and the upper-case letters A-V for the remaining ones. The alphabet is conceptually simple, but contains all of the ambiguous number/letter pairs that the other variants try to avoid. It is also less suitable for verbal transmission. Padding with '=' is required and makes the encoded string a multiple of 8 characters.

hex

  • hex_upper outputs upper-case letters and accepts lower-case as well. This is an octet-streaming codec variant and for decoding, requires an even number of input symbols. In other words, don't try to decode (0x)"F", (0x)"10F" etc. with this variant, use a place-based single number codec instead if you want to do this. Also, you are expected to prepend and remove a "0x" prefix externally as it won't be generated when encoding / will be rejected when decoding.
  • hex_lower outputs lower-case letters and accepts upper-case as well. Similar to hex_upper, it's stream-based (no odd symbol lengths) and does not deal with "0x" prefixes.

Philosophy and trade-offs

cppcodec aims to support a range of codecs using a shared template-based implementation. The focus is on a high-quality API that encourages correct use, includes error handling, and is easy to adopt into other codebases. As a header-only library, cppcodec can ship implementations of several codecs and variants while only compiling the ones that you actually use.

Good performance is a goal, but not the topmost priority. In theory, templates allows to write generic code that is optimized for each specialization individually; however, in practice compilers still struggle to produce code that's as simple as a hand-written specialized function. On release builds, depending on the C++ compiler, cppcodec runs in between (approx.) 100% and 300% of time compared to "regular" optimized base64 implementations. Both are beat by highly optimized implementations that use vector instructions (such as this) or buy better performance with larger pre-computed tables (such as Chrome's base64 implementation). Debug builds of cppcodec are slower by an order of magnitude due to the use of templates and abstractions; make sure you use release or minimum-size builds in production.

API

All codecs expose the same API. In the below documentation, replace <codec> with a default alias such as base64, base32 or hex, or with the full namespace such as cppcodec::base64_rfc4648 or cppcodec::base32_crockford.

For templated parameters T and Result, you can use e.g. std::vector<uint8_t>, std::string or anything that supports:

  • .data() and .size() for T (read-only) template parameters,
  • for Result template parameters, also .reserve(size_t), .resize(size_t) and .push_back([uint8_t|char]).

It's possible to support types lacking these functions, consult the code directly if you need this.

Encoding

// Convenient version, returns an std::string.
std::string <codec>::encode(const [uint8_t|char]* binary, size_t binary_size);
std::string <codec>::encode(const T& binary);

// Convenient version with templated result type.
Result <codec>::encode<Result>(const [uint8_t|char]* binary, size_t binary_size);
Result <codec>::encode<Result>(const T& binary);

// Reused result container version. Resizes encoded_result before writing to it.
void <codec>::encode(Result& encoded_result, const [uint8_t|char]* binary, size_t binary_size);
void <codec>::encode(Result& encoded_result, const T& binary);

Encode binary data into an encoded (base64/base32/hex) string. Won't throw by itself, but the result type might throw on .resize().

size_t <codec>::encode(char* encoded_result, size_t encoded_buffer_size, const [uint8_t|char]* binary, size_t binary_size) noexcept;
size_t <codec>::encode(char* encoded_result, size_t encoded_buffer_size, const T& binary) noexcept;

Encode binary data into pre-allocated memory with a buffer size of <codec>::encoded_size(binary_size) or larger.

Returns the byte size of the encoded string excluding null termination, which is equal to <codec>::encoded_size(binary_size).

If encoded_buffer_size is larger than required, a single null termination character ('\0') is written after the last encoded character. The encoded_size() function ensures that the required buffer size is large enough to hold the padding required for the respective codec variant. Provide a buffer of size encoded_size() + 1 to make it a null-terminated C string.

Calls abort() if encoded_buffer_size is insufficient. (That way, the function can remain noexcept rather than throwing on an entirely avoidable error condition.)

size_t <codec>::encoded_size(size_t binary_size) noexcept;

Calculate the (exact) length of the encoded string based on binary size, excluding null termination but including padding (if specified by the codec variant).

Decoding

// Convenient version, returns an std::vector<uint8_t>.
std::vector<uint8_t> <codec>::decode(const char* encoded, size_t encoded_size);
std::vector<uint8_t> <codec>::decode(const T& encoded);

// Convenient version with templated result type.
Result <codec>::decode<Result>(const char* encoded, size_t encoded_size);
Result <codec>::decode<Result>(const T& encoded);

// Reused result container version. Resizes binary_result before writing to it.
void <codec>::decode(Result& binary_result, const char* encoded, size_t encoded_size);
void <codec>::decode(Result& binary_result, const T& encoded);

Decode an encoded (base64/base32/hex) string into a binary buffer.

Throws a cppcodec::parse_error exception (inheriting from std::domain_error) if the input data does not conform to the codec variant specification. Also, the result type might throw on .resize().

size_t <codec>::decode([uint8_t|char]* binary_result, size_t binary_buffer_size, const char* encoded, size_t encoded_size);
size_t <codec>::decode([uint8_t|char]* binary_result, size_t binary_buffer_size, const T& encoded);

Decode an encoded string into pre-allocated memory with a buffer size of <codec>::decoded_max_size(encoded_size) or larger.

Returns the byte size of the decoded binary data, which is less or equal to <codec>::decoded_max_size(encoded_size).

Calls abort() if binary_buffer_size is insufficient, for consistency with encode(). Throws a cppcodec::parse_error exception (inheriting from std::domain_error) if the input data does not conform to the codec variant specification.

size_t <codec>::decoded_max_size(size_t encoded_size) noexcept;

Calculate the maximum size of the decoded binary buffer based on the encoded string length.

If the codec variant does not allow padding or whitespace / line breaks, the maximum decoded size will be the exact decoded size.

If the codec variant allows padding or whitespace / line breaks, the actual decoded size might be smaller. If you're using the pre-allocated memory result call, make sure to take its return value (the actual decoded size) into account.

Comments
  • Unreachable code warning

    Unreachable code warning

    I grabbed the latest release, but it still complains about the unreachable code in one place when I build it in release mode:

    deps\cppcodec\cppcodec\detail\stream_codec.hpp(66): warning C4702: unreachable code

    Do you know how to fix it?

  • Static assertion fails after pulling #40

    Static assertion fails after pulling #40

    Operating System: Windows 10 x64 Compiler: Visual C++ (VS 2017/15.6.4)

    Static assert on line 266 of file access.hpp fails:

    static_assert(std::is_same<
            decltype(create_state(*(std::string*)nullptr, specific_t())),
            array_access_result_state<std::string>>::value,
            "std::string must be handled by array_access_result_state");
    

    image

  • Can encoders append to std::string instead of overwriting?

    Can encoders append to std::string instead of overwriting?

    The following code overwrites string's contents:

        std::string str = "FOO";
        std::vector<uint8_t> data = {1,2,3,4,5,6,7,8,9,10};
        cppcodec::base64_rfc4648::encode( str, data );
    

    Can encoder be instructed to append encoded result?

  • Add target_include_directories

    Add target_include_directories

    CMake 3.12 allows normal libraries and executables to link to object libraries to get their usage requirements, i.e. include directories, etc. https://cmake.org/cmake/help/v3.12/command/target_link_libraries.html#linking-object-libraries

    To propagate the include directory to cppcodec's users, add this line into CMakeLists.txt

    target_include_directories(cppcodec INTERFACE "${PROJECT_SOURCE_DIR}")
    
  • Doesn't compile with VC14

    Doesn't compile with VC14

    I get this error just including base64_default_rfc4648.hpp:

    Error C2535 'void cppcodec::detail::base64::pad(Result &,ResultState &,std::enable_if<,size_t>::type)': member function already defined or declared

  • Can't build cppcodec

    Can't build cppcodec

    I'm using the catch-devel-2.2.2-1.fc28.x86_64 package on Fedora 28, I also use GCC 8.1. Running cmake . finishes without error:

    -- The CXX compiler identification is GNU 8.1.1 -- Check for working CXX compiler: /usr/lib64/ccache/c++ -- Check for working CXX compiler: /usr/lib64/ccache/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found PkgConfig: /usr/bin/pkg-config (found version "1.4.2") -- Checking for module 'catch' -- Found catch, version 2.2.2 -- Found system Catch2, not using bundled version -- Configuring done -- Generating done -- Build files have been written to: /etc/opt/cppcodec/cppcodec

    But when I execute make I get a lot of errors regarding test_cppcodec.cpp:

    [ 95%] Built target minimal_decode In file included from /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:25: /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp: In function ‘void ____C_A_T_C_H____T_E_S_T____0()’: /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:128:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("0"), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:128:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:129:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("000"), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:129:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:130:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("000000"), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:130:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:131:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("000000000"), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:131:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:134:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("00======"), const cppcodec::symbol_error&); // no padding for Crockford ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:134:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:135:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("Uu"), const cppcodec::symbol_error&); // only a checksum symbol here ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:135:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:136:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("++"), const cppcodec::symbol_error&); // make sure it's not base64 ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:136:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:137:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("//"), const cppcodec::symbol_error&); // ...ditto ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:137:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp: In function ‘void ____C_A_T_C_H____T_E_S_T____8()’: /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:327:9: error: cannot declare reference to ‘const class cppcodec::padding_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("0"), const cppcodec::padding_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:327:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::padding_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:328:9: error: cannot declare reference to ‘const class cppcodec::padding_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("00"), const cppcodec::padding_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:328:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::padding_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:329:9: error: cannot declare reference to ‘const class cppcodec::padding_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("00==="), const cppcodec::padding_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:329:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::padding_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:330:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("0======="), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:330:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:331:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("000====="), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:331:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:332:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("000000=="), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:332:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:335:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("W0======"), const cppcodec::symbol_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:335:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:336:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("X0======"), const cppcodec::symbol_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:336:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:337:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("Y0======"), const cppcodec::symbol_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:337:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:338:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("Z0======"), const cppcodec::symbol_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:338:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:339:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("CPNM UOJ1"), const cppcodec::symbol_error&); // no spaces ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:339:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:340:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("CPNM-UOJ1"), const cppcodec::symbol_error&); // no dashes ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:340:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp: In function ‘void ____C_A_T_C_H____T_E_S_T____14()’: /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:434:9: error: cannot declare reference to ‘const class cppcodec::padding_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("A"), const cppcodec::padding_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:434:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::padding_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:435:9: error: cannot declare reference to ‘const class cppcodec::padding_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("AA"), const cppcodec::padding_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:435:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::padding_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:436:9: error: cannot declare reference to ‘const class cppcodec::padding_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("AA==="), const cppcodec::padding_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:436:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::padding_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:437:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("A======="), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:437:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:438:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("AAA====="), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:438:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:439:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("AAAAAA=="), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:439:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:442:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("0A======"), const cppcodec::symbol_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:442:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:443:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("1A======"), const cppcodec::symbol_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:443:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:444:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("8A======"), const cppcodec::symbol_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:444:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:445:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("9A======"), const cppcodec::symbol_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:445:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:446:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("GEZD GNBV"), const cppcodec::symbol_error&); // no spaces ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:446:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:447:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base32::decode("GEZD-GNBV"), const cppcodec::symbol_error&); // no dashes ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:447:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp: In function ‘void ____C_A_T_C_H____T_E_S_T____20()’: /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:574:9: error: cannot declare reference to ‘const class cppcodec::padding_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("A"), const cppcodec::padding_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:574:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::padding_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:575:9: error: cannot declare reference to ‘const class cppcodec::padding_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("AA"), const cppcodec::padding_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:575:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::padding_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:576:9: error: cannot declare reference to ‘const class cppcodec::padding_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("ABCDE"), const cppcodec::padding_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:576:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::padding_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:577:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("A==="), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:577:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:578:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("AAAA===="), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:578:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:579:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("AAAAA==="), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:579:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:582:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("A&B="), const cppcodec::symbol_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:582:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:583:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("--"), const cppcodec::symbol_error&); // this is not base64url ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:583:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:584:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("__"), const cppcodec::symbol_error&); // ...ditto ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:584:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp: In function ‘void ____C_A_T_C_H____T_E_S_T____26()’: /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:677:9: error: cannot declare reference to ‘const class cppcodec::padding_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decodestd::string("Zg="), const cppcodec::padding_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:677:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::padding_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:685:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("A"), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:685:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:686:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("AAAAA"), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:686:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:689:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("A&B"), const cppcodec::symbol_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:689:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:690:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("++"), const cppcodec::symbol_error&); // this is not standard base64 ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:690:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:691:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("//"), const cppcodec::symbol_error&); // ...ditto ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:691:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp: In function ‘void ____C_A_T_C_H____T_E_S_T____32()’: /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:785:9: error: cannot declare reference to ‘const class cppcodec::padding_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("A"), const cppcodec::padding_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:785:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::padding_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:786:9: error: cannot declare reference to ‘const class cppcodec::padding_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("AA"), const cppcodec::padding_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:786:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::padding_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:787:9: error: cannot declare reference to ‘const class cppcodec::padding_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("ABCDE"), const cppcodec::padding_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:787:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::padding_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:788:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("A==="), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:788:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:789:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("AAAA===="), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:789:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:790:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("AAAAA==="), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:790:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:793:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("A&B="), const cppcodec::symbol_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:793:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:794:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("++"), const cppcodec::symbol_error&); // this is not standard base64 ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:794:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:795:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(base64::decode("//"), const cppcodec::symbol_error&); // ...ditto ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:795:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp: In function ‘void ____C_A_T_C_H____T_E_S_T____38()’: /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:886:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(hex::decode("0"), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:886:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:887:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(hex::decode("000"), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:887:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:890:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(hex::decode("1g"), const cppcodec::symbol_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:890:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:891:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(hex::decode("66 6f"), const cppcodec::symbol_error&); // no spaces ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:891:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:892:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(hex::decode("66-6f"), const cppcodec::symbol_error&); // no dashes ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:892:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp: In function ‘void ____C_A_T_C_H____T_E_S_T____44()’: /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:983:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(hex::decode("0"), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:983:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:984:9: error: cannot declare reference to ‘const class cppcodec::invalid_input_length&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(hex::decode("000"), const cppcodec::invalid_input_length&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:984:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::invalid_input_length&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:987:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(hex::decode("1G"), const cppcodec::symbol_error&); ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:987:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:988:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(hex::decode("66 6F"), const cppcodec::symbol_error&); // no spaces ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:988:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:989:9: error: cannot declare reference to ‘const class cppcodec::symbol_error&’, which is not a typedef or a template type argument REQUIRE_THROWS_AS(hex::decode("66-6F"), const cppcodec::symbol_error&); // no dashes ^~~~~~~~~~~~~~~~~ /etc/opt/cppcodec/cppcodec/test/test_cppcodec.cpp:989:9: error: ‘const’ qualifiers cannot be applied to ‘const cppcodec::symbol_error&’ make[2]: *** [test/CMakeFiles/test_cppcodec.dir/build.make:63: test/CMakeFiles/test_cppcodec.dir/test_cppcodec.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:1404: test/CMakeFiles/test_cppcodec.dir/all] Error 2 make: *** [Makefile:141: all] Error 2

  • Update Catch to v2.3.0.

    Update Catch to v2.3.0.

    This changes the include path from <catch.hpp> to <catch2/catch.hpp>, and gets rid of all remaining warnings on VS2017. (VS2015 still emits a bunch of questionable warnings.)

  • Packaging cleanups

    Packaging cleanups

    @jpetso I would like to package cppcodec for Gentoo in order to be able to build packages against it. It is Gentoo policy not to rely on bundled libraries. Adding pkg-config and using idiomatic CMake variables makes things easier for all distributions.

  • FTBFS on Fedora Rawhide

    FTBFS on Fedora Rawhide

    [ 62%] Building CXX object test/CMakeFiles/test_cppcodec.dir/test_cppcodec.cpp.o
    cd /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/x86_64-redhat-linux-gnu/test && /usr/bin/c++   -I/builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection -std=c++11 -Wall -pedantic   -o CMakeFiles/test_cppcodec.dir/test_cppcodec.cpp.o -c /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp
    make[2]: Leaving directory '/builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/x86_64-redhat-linux-gnu'
    In file included from /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:25:
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp: In function 'void ____C_A_T_C_H____T_E_S_T____0()':
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:128:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("0"), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:128:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:129:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("000"), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:129:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:130:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("000000"), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:130:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:131:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("000000000"), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:131:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:134:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("00======"), cppcodec::symbol_error&); // no padding for Crockford
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:134:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:135:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("Uu"), cppcodec::symbol_error&); // only a checksum symbol here
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:135:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:136:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("++"), cppcodec::symbol_error&); // make sure it's not base64
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:136:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:137:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("//"), cppcodec::symbol_error&); // ...ditto
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:137:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp: In function 'void ____C_A_T_C_H____T_E_S_T____8()':
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:327:9: error: cannot declare reference to 'class cppcodec::padding_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("0"), cppcodec::padding_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:327:9: error: 'const' qualifiers cannot be applied to 'cppcodec::padding_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:328:9: error: cannot declare reference to 'class cppcodec::padding_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("00"), cppcodec::padding_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:328:9: error: 'const' qualifiers cannot be applied to 'cppcodec::padding_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:329:9: error: cannot declare reference to 'class cppcodec::padding_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("00==="), cppcodec::padding_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:329:9: error: 'const' qualifiers cannot be applied to 'cppcodec::padding_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:330:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("0======="), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:330:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:331:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("000====="), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:331:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:332:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("000000=="), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:332:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:335:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("W0======"), cppcodec::symbol_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:335:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:336:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("X0======"), cppcodec::symbol_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:336:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:337:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("Y0======"), cppcodec::symbol_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:337:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:338:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("Z0======"), cppcodec::symbol_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:338:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:339:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("CPNM UOJ1"), cppcodec::symbol_error&); // no spaces
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:339:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:340:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("CPNM-UOJ1"), cppcodec::symbol_error&); // no dashes
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:340:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp: In function 'void ____C_A_T_C_H____T_E_S_T____14()':
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:434:9: error: cannot declare reference to 'class cppcodec::padding_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("A"), cppcodec::padding_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:434:9: error: 'const' qualifiers cannot be applied to 'cppcodec::padding_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:435:9: error: cannot declare reference to 'class cppcodec::padding_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("AA"), cppcodec::padding_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:435:9: error: 'const' qualifiers cannot be applied to 'cppcodec::padding_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:436:9: error: cannot declare reference to 'class cppcodec::padding_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("AA==="), cppcodec::padding_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:436:9: error: 'const' qualifiers cannot be applied to 'cppcodec::padding_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:437:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("A======="), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:437:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:438:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("AAA====="), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:438:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:439:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("AAAAAA=="), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:439:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:442:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("0A======"), cppcodec::symbol_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:442:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:443:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("1A======"), cppcodec::symbol_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:443:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:444:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("8A======"), cppcodec::symbol_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:444:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:445:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("9A======"), cppcodec::symbol_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:445:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:446:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("GEZD GNBV"), cppcodec::symbol_error&); // no spaces
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:446:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:447:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base32::decode("GEZD-GNBV"), cppcodec::symbol_error&); // no dashes
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:447:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp: In function 'void ____C_A_T_C_H____T_E_S_T____20()':
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:574:9: error: cannot declare reference to 'class cppcodec::padding_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("A"), cppcodec::padding_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:574:9: error: 'const' qualifiers cannot be applied to 'cppcodec::padding_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:575:9: error: cannot declare reference to 'class cppcodec::padding_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("AA"), cppcodec::padding_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:575:9: error: 'const' qualifiers cannot be applied to 'cppcodec::padding_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:576:9: error: cannot declare reference to 'class cppcodec::padding_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("ABCDE"), cppcodec::padding_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:576:9: error: 'const' qualifiers cannot be applied to 'cppcodec::padding_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:577:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("A==="), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:577:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:578:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("AAAA===="), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:578:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:579:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("AAAAA==="), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:579:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:582:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("A&B="), cppcodec::symbol_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:582:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:583:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("--"), cppcodec::symbol_error&); // this is not base64url
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:583:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:584:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("__"), cppcodec::symbol_error&); // ...ditto
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:584:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp: In function 'void ____C_A_T_C_H____T_E_S_T____26()':
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:682:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("A"), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:682:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:683:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("AAAAA"), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:683:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:686:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("A&B"), cppcodec::symbol_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:686:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:687:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("++"), cppcodec::symbol_error&); // this is not standard base64
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:687:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:688:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("//"), cppcodec::symbol_error&); // ...ditto
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:688:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp: In function 'void ____C_A_T_C_H____T_E_S_T____32()':
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:782:9: error: cannot declare reference to 'class cppcodec::padding_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("A"), cppcodec::padding_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:782:9: error: 'const' qualifiers cannot be applied to 'cppcodec::padding_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:783:9: error: cannot declare reference to 'class cppcodec::padding_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("AA"), cppcodec::padding_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:783:9: error: 'const' qualifiers cannot be applied to 'cppcodec::padding_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:784:9: error: cannot declare reference to 'class cppcodec::padding_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("ABCDE"), cppcodec::padding_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:784:9: error: 'const' qualifiers cannot be applied to 'cppcodec::padding_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:785:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("A==="), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:785:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:786:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("AAAA===="), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:786:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:787:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("AAAAA==="), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:787:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:790:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("A&B="), cppcodec::symbol_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:790:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:791:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("++"), cppcodec::symbol_error&); // this is not standard base64
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:791:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:792:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(base64::decode("//"), cppcodec::symbol_error&); // ...ditto
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:792:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp: In function 'void ____C_A_T_C_H____T_E_S_T____38()':
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:883:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(hex::decode("0"), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:883:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:884:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(hex::decode("000"), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:884:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:887:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(hex::decode("1g"), cppcodec::symbol_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:887:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:888:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(hex::decode("66 6f"), cppcodec::symbol_error&); // no spaces
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:888:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:889:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(hex::decode("66-6f"), cppcodec::symbol_error&); // no dashes
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:889:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp: In function 'void ____C_A_T_C_H____T_E_S_T____44()':
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:980:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(hex::decode("0"), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:980:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:981:9: error: cannot declare reference to 'class cppcodec::invalid_input_length&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(hex::decode("000"), cppcodec::invalid_input_length&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:981:9: error: 'const' qualifiers cannot be applied to 'cppcodec::invalid_input_length&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:984:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(hex::decode("1G"), cppcodec::symbol_error&);
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:984:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:985:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(hex::decode("66 6F"), cppcodec::symbol_error&); // no spaces
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:985:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:986:9: error: cannot declare reference to 'class cppcodec::symbol_error&', which is not a typedef or a template type argument
             REQUIRE_THROWS_AS(hex::decode("66-6F"), cppcodec::symbol_error&); // no dashes
             ^~~~~~~~~~~~~~~~~
    /builddir/build/BUILD/cppcodec-65e512dceb2d544c71111396f8ffd9e851d73994/test/test_cppcodec.cpp:986:9: error: 'const' qualifiers cannot be applied to 'cppcodec::symbol_error&'
    {standard input}: Assembler messages:
    {standard input}: Error: .size expression for test_cppcodec.cpp does not evaluate to a constant
    

    This might be either due to catch update (1.x → 2.x) or gcc update (7.2.1 → 8.0.1)..

    Help is very appreciated. Thanks!

  • base64_url decode long string got run-time error

    base64_url decode long string got run-time error

    Hello, First of all, thank you for your lib!

    I have run-time error when trying to decode the below:

    std::string mydecode = base64_url::decode<std::string>("EtwFwjS7cNIZjXcufbR6r6mg8s1_e-jfObtENsgjQamDuuJZlT7lpReGgtl1bac77Lk0IDPNyFkhR-Rdv9kDBYcERUWMt_WBrqErnuciol09BReP7UCwfgwFftv3FMjRE29WpXInQ4vfFtbyd6YLN5AKAVZ-r5EcBYVdnjqli4zDR8TCKOPo1jhV5g3w43PPVSsc3KJS_C-i7SlJoGAjfWD97mL6kTYnoivbh_f61Vch9jS_zxslmqD_If0ZM7VtPxFE0oIPlbAka-OchPjrdEwF1lQqsmB1mE8zRF3yvPrz8tDjic3EQEjr-i6_F4NHJNg6tUq466DozbWct2ZrQdh70I764VrcktS1M93Rm5KjzEMUv7MmFjb03sWw7j2iVuLWgir4BqxGdS8E6yo8Vw12xk0pjOAaeuE_yzRRh_k_yAH2BkPFc7cibOYWcfOBL8-fd3PAbmSTm1BRSmZA3Epo9W93zVB6yazqk8YdvRmAde6WgPP8z2jckrLwpK88TySatMllkuxvpto0ZvdSDXNw2SfDuFrmxWPTsk0BHpS5jxjhV4R_FPyzTUAGijS_FJsfwXn-G1ii8AsDvyVuq3Om0cQmJ-mNC8pqTXvTvso556hIm1jHb-mIfhiwZk4gJONTqqQ_NPTA1vl6Omzznbl_BKSLlc4OcdIGqEdRll4NNjoxdVqWlNaS4O9L0C2UfEqK7NWAPymiLBCFYxSWsbul9seiZvS_UhV3I7lDDwy-40mQV9UN0wXV0cRZVpr_YrRvE9-SWtpyb3ZOi5y52d6oP6MeMe-kRvQRF8OkXsw-oXhkpOpMzcKi2xq9Q4k6Vuvme5s1PHCN8gAC4fJ4jm2H_XsJA6qFyDfXAdvcu6Z_GINje-sPRFc7Gpl88tbmPOAT-k0a-xeGMSd8h5xYIXcnrGjqXHFRxl_qPA");

    Could you help me out?

  • Allow using cppcodec as a CMake dependency

    Allow using cppcodec as a CMake dependency

    A continuation/refinement of PR #73, which does not get updates as the author wasn't the submitter of the PR. This PR I can change and hopefully merge.

    This makes CMakeLists.txt suitable for inclusion into a parent CMake project via add_subdirectory() command, and defines the cppcodec target as INTERFACE library. Use it in a target_link_libraries() command as dependency in order to add cppcodec's include directories to your target.

    The minimum CMake requirement is now 3.13, picking up various improvements to INTERFACE library targets and avoiding any confusion around CMake policy CMP0076, a behavior changed in 3.13.

    The CMake build will now build tests, examples and tools if built stand-alone, but exclude them if built as part of another project. This can be customized via CPPCODEC_BUILD_{TESTING,EXAMPLES,TOOLS} CMake definitions for a given build.

    Fixes #60 Fixes #61

    This commit is based on changes by Quintz Gábor (@quiga on GitHub), but modified and extended in a number of ways.

    Thanks also to Aditya Gupta (@adi-g15), anonymous @ghuser404 and Kingsley Chen (@kingsamchen) for keeping this issue on my radar and providing valuable feedback.

    Includes an extra commit for standard CMake formatting with gersemi. The main commit changes only lines with semantic differences.

  • Catch2 v2.3.0 doesn't compile with gcc11

    Catch2 v2.3.0 doesn't compile with gcc11

    Hi, Catch2 doesn't compile with gcc version 11.2.0 (Ubuntu 11.2.0-19ubuntu1) :

    cppcodec-src/test/catch/single_include/catch2/catch.hpp:7485:58: error: call to non-‘constexpr’ function ‘long int sysconf(int)’ 7485 | constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ; | ^~~~~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/bits/sigstksz.h:24,

    This is known issue by the maintainers. Could you please update the git submodule to point to a more recent release version of Catch ?

    Thank you in advance

  • Got SIGABRT when b64decode to a preallocated buffer

    Got SIGABRT when b64decode to a preallocated buffer

    I'm trying to decode a string, which is a b64encoded 64-byte signature, to a preallocated buffer. Since its length is known exactly, it might not be a good practice to allocate a buffer bigger than that. But the decoded_max_size requires 2 more bytes. Is it possible to give a more precise calculation on the length of output? If not, what about throw a concise exception?

    
    #include <cppcodec/base64_rfc4648.hpp>
    #include <cppcodec/hex_lower.hpp>
    #include <iostream>
    #include <string>
    #include <vector>
    
    using namespace std;
    
    using base64 = cppcodec::base64_rfc4648;
    using hex    = cppcodec::hex_lower;
    
    #define uint8_p(x) reinterpret_cast<uint8_t*>(x)
    
    string s = "JHeNMtgqWq51F+MyZlz+tA5HywxhLSH3Cq+gTFs6M8iJWgONT7Ll9t1NwH2m2hCXWpoeWT90w3+LkIG/wNaiEg==";
    
    void try_1()
    {
        auto signature = base64::decode(s);
        cout << signature.size() << endl;
        puts(hex::encode(signature).c_str());
    }
    
    void try_2()
    {
        uint8_t signature[64];
        base64::decode(signature, sizeof(signature), s);
        puts(hex::encode(signature, 64).c_str());
    }
    
    int main()
    {
        cout << base64::decoded_max_size(s.size()) << endl; // 66
        try_1();
        try_2();
    }
    
    
    $ ./main 
    66
    64
    24778d32d82a5aae7517e332665cfeb40e47cb0c612d21f70aafa04c5b3a33c8895a038d4fb2e5f6dd4dc07da6da10975a9a1e593f74c37f8b9081bfc0d6a212
    [1]    13521 abort (core dumped)  ./main
    
    $ valgrind ./main 
    ==13588== Memcheck, a memory error detector
    ==13588== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
    ==13588== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
    ==13588== Command: ./main
    ==13588== 
    66
    64
    24778d32d82a5aae7517e332665cfeb40e47cb0c612d21f70aafa04c5b3a33c8895a038d4fb2e5f6dd4dc07da6da10975a9a1e593f74c37f8b9081bfc0d6a212
    ==13588== 
    ==13588== Process terminating with default action of signal 6 (SIGABRT)
    ==13588==    at 0x5C84E97: raise (raise.c:51)
    ==13588==    by 0x5C86800: abort (abort.c:79)
    ==13588==    by 0x40472B: init<cppcodec::data::raw_result_buffer> (include/cppcodec/detail/../data/raw_result_buffer.hpp:61)
    ==13588==    by 0x40472B: void cppcodec::detail::codec<cppcodec::detail::base64<cppcodec::detail::base64_rfc4648> >::decode<cppcodec::data::raw_result_buffer>(cppcodec::data::raw_result_buffer&, char const*, unsigned long) (include/cppcodec/detail/codec.hpp:268)
    ==13588==    by 0x404659: cppcodec::detail::codec<cppcodec::detail::base64<cppcodec::detail::base64_rfc4648> >::decode(char*, unsigned long, char const*, unsigned long) (include/cppcodec/detail/codec.hpp:298)
    ==13588==    by 0x404618: unsigned long cppcodec::detail::codec<cppcodec::detail::base64<cppcodec::detail::base64_rfc4648> >::decode<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(char*, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (include/cppcodec/detail/codec.hpp:314)
    ==13588==    by 0x401BD4: unsigned long cppcodec::detail::codec<cppcodec::detail::base64<cppcodec::detail::base64_rfc4648> >::decode<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(unsigned char*, unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) (include/cppcodec/detail/codec.hpp:307)
    ==13588==    by 0x4018AB: try_2() (main.cpp:26)
    ==13588==    by 0x401970: main (main.cpp:34)
    ==13588== 
    ==13588== HEAP SUMMARY:
    ==13588==     in use at exit: 89 bytes in 1 blocks
    ==13588==   total heap usage: 5 allocs, 4 frees, 74,012 bytes allocated
    ==13588== 
    ==13588== LEAK SUMMARY:
    ==13588==    definitely lost: 0 bytes in 0 blocks
    ==13588==    indirectly lost: 0 bytes in 0 blocks
    ==13588==      possibly lost: 0 bytes in 0 blocks
    ==13588==    still reachable: 89 bytes in 1 blocks
    ==13588==         suppressed: 0 bytes in 0 blocks
    ==13588== Rerun with --leak-check=full to see details of leaked memory
    ==13588== 
    ==13588== For counts of detected and suppressed errors, rerun with: -v
    ==13588== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
    [1]    13588 abort (core dumped)  valgrind ./main
    

    Here's my comiler

    $ gcc -v
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
    OFFLOAD_TARGET_NAMES=nvptx-none
    OFFLOAD_TARGET_DEFAULT=1
    Target: x86_64-linux-gnu
    Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
    Thread model: posix
    gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) 
    
  • Stream support

    Stream support

    At this time, cppcodec does not offer a good way of encoding or decoding a byte stream of unknown length. This is a significant shortcoming in the API and something usable should be added. The obvious choice here is support for the stream operators (<<, >>) that pipe from and to a cppcodec class. We'll likely want a new class because unlike the existing encode()/decode() functions, this one needs to track state as part of its member variables, i.e. the data source and possibly information about the current offset.

    I'd like to make this a focus area for v0.3.

  • Cannot use decode with std::array

    Cannot use decode with std::array

    Hello,

    It seems you are forcing the Result template type to have a push_back method, which std::array doesn't have.

    I was wondering if it would be easy to use the iterator range constructors of standard containers instead, to allow using a lot more container types.

    I didn't dive into the code yet, do you think this is an easy change? If so, I could open a PR soon.

    Thanks

Base64 Encoding implementation in C Programming Language

cb64 Base64 Encoding implementation in C Programming Language Spec: https://datatracker.ietf.org/doc/html/rfc4648#page-5 Header only So just copy cb64

Dec 14, 2021
Consistent Hashing Using Fibonacci Encoding

fibonacci_table This does not work as I thought it would. I did not manage to compute an inverse fibonacci mapping. It works, but just like linear has

Jan 30, 2021
Decode and Print Kadena Chainweb Block Headers

decode-header - Decode and Print Kadena Chainweb BlockHeaders The tool reads Kadena Chainweb Headers in various formats from stdin and prints a JSON r

Nov 5, 2021
libcluon is a small and efficient, single-file and header-only library written in modern C++ to power microservices.

libcluon Linux & OSX Build (TravisCI) Win64 Build (AppVeyor) Test Coverage Coverity Analysis CII Best Practices libcluon is a small single-file, heade

Nov 19, 2022
Zmeya is a header-only C++11 binary serialization library designed for games and performance-critical applications

Zmeya Zmeya is a header-only C++11 binary serialization library designed for games and performance-critical applications. Zmeya is not even a serializ

Nov 2, 2022
A header only C++11 library for parsing TOML

tinytoml A header only C++11 library for parsing TOML. This parser is based on TOML v0.4.0. This library is distributed under simplified BSD License.

Oct 10, 2022
cpptoml is a header-only library for parsing TOML

cpptoml A header-only library for parsing TOML configuration files. Targets: TOML v0.5.0 as of August 2018. This includes support for the new DateTime

Dec 1, 2022
Header-only library for automatic (de)serialization of C++ types to/from JSON.

fuser 1-file header-only library for automatic (de)serialization of C++ types to/from JSON. how it works The library has a predefined set of (de)seria

Oct 20, 2022
Header-only TOML config file parser and serializer for C++17 (and later!).
Header-only TOML config file parser and serializer for C++17 (and later!).

toml++ homepage ✨ This README is fine, but the toml++ homepage is better. ✨ Library features Header-only Supports the latest TOML release (v1.0.0), pl

Dec 4, 2022
A C++11 or library for parsing and serializing JSON to and from a DOM container in memory.
A C++11 or library for parsing and serializing JSON to and from a DOM container in memory.

Branch master develop Azure Docs Drone Matrix Fuzzing --- Appveyor codecov.io Boost.JSON Overview Boost.JSON is a portable C++ library which provides

Dec 1, 2022
Cap'n Proto serialization/RPC system - core tools and C++ library
Cap'n Proto serialization/RPC system - core tools and C++ library

Cap'n Proto is an insanely fast data interchange format and capability-based RPC system. Think JSON, except binary. Or think Protocol Buffers, except

Dec 1, 2022
FlatBuffers Compiler and Library in C for C

OS-X & Ubuntu: Windows: The JSON parser may change the interface for parsing union vectors in a future release which requires code generation to match

Nov 26, 2022
A C++11 ASN.1 BER Encoding and Decoding Library

fast_ber A performant ASN.1 BER encoding and decoding library written in C++11 Introduction fast_ber is a small, lightweight library for BER encoding

Dec 1, 2022
A high performance C++14 library for effortlessly reading and writing UBJSON

UbjsonCpp A high performance C++14 library for effortlessly reading and writing UBJSON This library implements UBJSON Draft 12 and Value semmantics Ab

Aug 2, 2022
Your binary serialization library

Bitsery Header only C++ binary serialization library. It is designed around the networking requirements for real-time data delivery, especially for ga

Dec 1, 2022
A C++11 library for serialization
A C++11 library for serialization

cereal - A C++11 library for serialization cereal is a header-only C++11 serialization library. cereal takes arbitrary data types and reversibly turns

Dec 2, 2022
FlatBuffers: Memory Efficient Serialization Library

FlatBuffers FlatBuffers is a cross platform serialization library architected for maximum memory efficiency. It allows you to directly access serializ

Nov 27, 2022
Simple C++ 20 Serialization Library that works out of the box with aggregate types!

BinaryLove3 Simple C++ 20 Serialization Library that works out of the box with aggregate types! Requirements BinaryLove3 is a c++20 only library.

Sep 2, 2022