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.

Overview

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.

Issues
  • 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?

    opened by GTValentine 9
  • 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

    opened by NuclearC 8
  • 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?

    help wanted 
    opened by emptyVoid 7
  • 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

    bug need verification for fix 
    opened by terrymah 6
  • 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

    opened by CleanHit 4
  • 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.)

    opened by jpetso 4
  • 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.

    opened by SoapGentoo 4
  • 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!

    opened by ignatenkobrain 4
  • 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?

    question 
    opened by Mark-Joy 4
  • Encode from/decode to float vector does not work as expected

    Encode from/decode to float vector does not work as expected

    Hi - I'm hoping to use cppcodec in a small fluid dynamics program, and the program needs to write .vtu files for ParaView (VTK uses an xml-based format, and allows base64 encoding of float arrays). I expected to be able to do the following because std::vector allows .data() and .size():

    using base64 = cppcodec::base64_rfc4648;
    std::vector<float> original({235.2158, 1.0});
    std::string encoded = base64::encode(original);
    

    and I assumed that it would know that each entry is 4 bytes. It doesn't. This is how to encode from a float vector:

    std::string encoded = base64::encode((const char*)original.data(), (size_t)(sizeof(float)*original.size()));
    

    This returns the encoded string NzdrQwAAgD8=

    Now, it also seemed as if I could decode to a float vector using:

    std::vector<float> decoded = base64::decode<std::vector<float>>(encoded);
    

    but that gives me a vector of size 8 with the first entry decoded[0] equal to 55. Obviously it's assuming I'm decoding to uint8_t. How can I confirm my encoding by decoding to a std::vector<float> ?

    opened by markstock 3
  • Further improve performance by fixing specialized data accessors

    Further improve performance by fixing specialized data accessors

    After the previous speed-up, almost 35% of the perf flamegraph for decoding was caught up in std::string::push_back(). That seemed suspicious, because I thought that initial allocation with reserve() should make the remaining push_back() calls very fast. Turns out that's not the case.

    Along the way, I found out that the optimized implementation for containers with mutable data() access (e.g. std::vector<uint8_t>) did not actually work. What I believed I had gotten to work was in fact silently removed by SFINAE; as a result, all allocation went through the fallback path with reserve() and push_back().

    The fix required some changes but in the end isn't all that bad. In addition to the handler for containers with mutable data(), I added a handler for containers with mutable operator[] such as std::string (as long as it's possible to assign a char to it).

    To make sure it now works as intended, a static_assert() now ensures that the correct code path is being used.

    The benchmark from gaspardpetit/base64 uses std::string for both encoding and decoding, which is not so great but I guess makes it easier to integrate all the ad-hoc libraries with std::string APIs. Consequently, cppcodec now moves to the upper league in both encoding and decoding benchmarks.

    On my system for the 256 buffer size benchmark, encoding was at 1.37 before and is now at 0.80, or 40% less time spent compared to the previous commit. Decoding got faster from an original 1.68 to about 0.85, i.e. 50% less time spent.

    This puts cppcodec performance slightly behind the GNOME base64 implementation for encoding and in the neighborhood of nehadamvr/arduino-base64, way ahead of ElegantDice and such. For decoding, cppcodec now beats GNOME and catches up to Wikibooks.org/C, slightly behind Apache. Polfosol is still way ahead of cppcodec for both encoding and decoding.

    opened by jpetso 3
  • Allowing CMake projects to include this library as dependency

    Allowing CMake projects to include this library as dependency

    Currently, if we add it as submodule, or with CPM (which I did), we can't include the <cppcodec/...> headers.

    It fails with this error, even after including cppcodec as a library dependency:

    fatal error: cppcodec/base64_rfc4648.hpp: No such file or directory

    2021-08-28_15-00

    @quiga has already fixed it (https://github.com/quiga/cppcodec).

    https://github.com/quiga/cppcodec/blob/849ccb04a6f75aa300f6d6d6c8d163aca5e1e936/CMakeLists.txt#L70-L73

    I used his fork as an upstream and it worked, there are changes mainly in CMakeLists you can see the diff. So, I created this PR so that the fix is merged with upstream :D

    opened by adi-g15 2
  • 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) 
    
    opened by LuminousXLB 0
  • 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}")
    
    opened by ghuser404 6
  • 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.

    opened by jpetso 0
Releases(v0.2)
  • v0.2(Aug 24, 2018)

    This release is primarily focused on improving runtime performance. The benchmarks at https://github.com/gaspardpetit/base64 showed that cppcodec was lagging many other base64 implementations, subsequent profiling and disassembly tracked this down to a high amount of consecutive integer comparisons. If I wanted better performance, I needed lookup tables. On the other hand, hardcoding bi-directional lookup tables for each variant seemed error-prone and would increase maintenance efforts.

    Better performance

    The result is a significant refactoring of internals that's several times faster than v0.1 and involves even more intricate template magic, with reverse lookup tables generated at compile time and a few other tweaks. Improvements benefit all codec variants.

    In the best case (GCC >=7.0 Release builds), cppcodec is now on par with the fastest competing implementations that offer error checking on decode(). In the average case (other compilers and/or MinSizeRel builds), the runtime is generally within 3 times of the best case. The worst case are Debug builds, where you should not expect anything close to acceptable performance, due to the abstractions involved and the lack of code inlining. Release builds tend to offer the best performance for a given compiler, all three supported compilers (GCC, Clang, MSVC) are now automatically smoke-tested for performance, in addition to correctness, by the continuous builds on Travis and AppVeyor.

    Note that cppcodec is now competitive with many other implementations, but still can't compare to highly optimized implementations that use vector instructions (such as this SIMD-accelerated one) or buy better performance with larger pre-computed tables (such as Chrome's base64 implementation). That in addition to the compilers' difficulty with optimizing templates. Keep in mind that performance is still only a secondary goal for cppcodec, the primary goal remains ease of use with a consistent, flexible API.

    Less compiler warnings

    The other main focus area of this release was to reduce compiler warnings for stringent warning levels. cppcodec will not produce warnings on GCC and Clang with -Wall -Wextra -pedantic, MSVC on VS2017 will be warning-free with /W4. (MSVC on VS2015 has a few warnings left, that's a compiler bug and there wasn't a straightforward solution so I decided not to spend more effort on those. Upgrade to VS2017 if you need them gone.)

    The included copy of Catch (the unit test framework) was updated to 2.3.0. This also results in less warnings. If you want to test cppcodec with the installed Catch package, that version is now the minimum required one. If you're just a regular user, you don't have to care about this and can rely on Travis and AppVeyor to test things.

    Please stop using "default" includes

    Lastly, the use of "default" includes that predefine a shorter class name for the codec (e.g. #include "cppcodec/base64_default_rfc4648.h") is now not recommended anymore. I may deprecate it in the future. It wasn't a good idea in hindsight but many people use it now. If you use these includes in your code, please switch over to the standard includes without "default" (e.g. #include "cppcodec/base64_rfc4648.h"). If you like, you can use a using base64 = cppcodec::base64_rfc4648; declaration in *.cpp files only. Existing headers won't be removed but no new ones will be added.

    Acknowledgements

    Thanks and kudos go out to @thrimbor, @GTValentine and @ndusart for their code contributions to this release (all related to eliminating compiler warnings), to @SoapGentoo for testing the Catch update, and to everyone reporting bugs and bringing up ideas in the issue queue. cppcodec is doing better because of you.

    Source code(tar.gz)
    Source code(zip)
  • v0.1(Mar 11, 2018)

    cppcodec hasn't had substantial changes for a while, but it also does the job it's supposed to do with a reasonable amount of features. Pull request #37 asked for it to be packaged, so it makes sense to cut an initial release.

    Thanks to @thrimbor, @Kronuz, @smasherprog, @kurt-nj, @nigels-com, @jrogers and @SoapGentoo for their contributions to this release, as well as @efidler who responsively helped me out with project admin stuff despite having changed employers. Thanks also to @theodelrieu whose contributions would likely be part of this release if it weren't for me slacking off.

    I expect no API-breaking changes for the master branch at tplgy/cppcodec and thus for future releases at this project location. If I merge any breaking changes in the future then I plan to migrate to jpetso/cppcodec instead, where I have admin privileges.

    Source code(tar.gz)
    Source code(zip)
Owner
Topology
Topology
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

Telkom DEV 1 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

Wolfgang Brehm 10 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

Lars Kuhtz 1 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

Christian Berger 79 Apr 23, 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

Sergey Makeev 95 Jun 22, 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.

mayah 159 Jun 8, 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

Chase Geigle 551 Jun 18, 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

null 49 Jun 4, 2022
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

Mark Gillard 805 Jun 21, 2022
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

Boost.org 294 Jun 20, 2022
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

Cap'n Proto 9k Jun 23, 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

null 503 Jun 25, 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

null 69 May 22, 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

Ibrahim Timothy Onogu 21 Nov 10, 2021
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

Mindaugas Vinkelis 713 Jun 24, 2022
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

iLab @ USC 3.2k Jun 23, 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

Google 18.1k Jul 1, 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.

RedSkittleFox 12 Dec 23, 2021
A C++ library for interacting with JSON.

JsonCpp JSON is a lightweight data-interchange format. It can represent numbers, strings, ordered sequences of values, and collections of name/value p

null 6.5k Jun 30, 2022