Add support for MacOS and old compilers (not supporting C++11). Main patch is from Samuel Marks.

This commit is contained in:
2022-11-21 17:56:29 +01:00
parent 6e3958f09e
commit 7878f91cdd
5 changed files with 77 additions and 8 deletions

View File

@@ -33,7 +33,11 @@ class Base64 {
public:
static std::string Encode(const std::string data) {
static constexpr char sEncodingTable[] = {
static
#if __STDC_VERSION__ >= 201112L
constexpr
#endif /* __STDC_VERSION__ >= 201112L */
char sEncodingTable[] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
@@ -73,7 +77,11 @@ class Base64 {
}
static std::string Decode(const std::string& input, std::string& out) {
static constexpr unsigned char kDecodingTable[] = {
static
#if __STDC_VERSION__ >= 201112L
constexpr
#endif /* __STDC_VERSION__ >= 201112L */
unsigned char kDecodingTable[] = {
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63,

View File

@@ -131,7 +131,17 @@ namespace gourou
DRM_INVALID_KEY_SIZE,
DRM_ERR_ENCRYPTION_KEY_FP
};
#ifndef _NOEXCEPT
#if __STDC_VERSION__ >= 201112L
# define _NOEXCEPT noexcept
# define _NOEXCEPT_(x) noexcept(x)
#else
# define _NOEXCEPT throw()
# define _NOEXCEPT_(x)
#endif
#endif /* !_NOEXCEPT */
/**
* Generic exception class
*/
@@ -157,7 +167,7 @@ namespace gourou
this->fullmessage = strdup(other.fullmessage);
}
~Exception()
~Exception() _NOEXCEPT
{
free(fullmessage);
}