|
@@ -1,6 +1,6 @@ |
|
|
/* |
|
|
/* |
|
|
* DISTRHO Plugin Framework (DPF) |
|
|
* DISTRHO Plugin Framework (DPF) |
|
|
* Copyright (C) 2012-2016 Filipe Coelho <falktx@falktx.com> |
|
|
|
|
|
|
|
|
* Copyright (C) 2012-2024 Filipe Coelho <falktx@falktx.com> |
|
|
* |
|
|
* |
|
|
* Permission to use, copy, modify, and/or distribute this software for any purpose with |
|
|
* Permission to use, copy, modify, and/or distribute this software for any purpose with |
|
|
* or without fee is hereby granted, provided that the above copyright notice and this |
|
|
* or without fee is hereby granted, provided that the above copyright notice and this |
|
@@ -19,7 +19,6 @@ |
|
|
|
|
|
|
|
|
#include "../DistrhoUtils.hpp" |
|
|
#include "../DistrhoUtils.hpp" |
|
|
|
|
|
|
|
|
#include <cctype> |
|
|
|
|
|
#include <vector> |
|
|
#include <vector> |
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------- |
|
|
// ----------------------------------------------------------------------- |
|
@@ -55,7 +54,7 @@ |
|
|
#ifndef DOXYGEN |
|
|
#ifndef DOXYGEN |
|
|
namespace DistrhoBase64Helpers { |
|
|
namespace DistrhoBase64Helpers { |
|
|
|
|
|
|
|
|
static const char* const kBase64Chars = |
|
|
|
|
|
|
|
|
static constexpr const char* const kBase64Chars = |
|
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
|
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
|
|
"abcdefghijklmnopqrstuvwxyz" |
|
|
"abcdefghijklmnopqrstuvwxyz" |
|
|
"0123456789+/"; |
|
|
"0123456789+/"; |
|
@@ -63,7 +62,7 @@ static const char* const kBase64Chars = |
|
|
static inline |
|
|
static inline |
|
|
uint8_t findBase64CharIndex(const char c) |
|
|
uint8_t findBase64CharIndex(const char c) |
|
|
{ |
|
|
{ |
|
|
static const uint8_t kBase64CharsLen(static_cast<uint8_t>(std::strlen(kBase64Chars))); |
|
|
|
|
|
|
|
|
static const uint8_t kBase64CharsLen = static_cast<uint8_t>(std::strlen(kBase64Chars)); |
|
|
|
|
|
|
|
|
for (uint8_t i=0; i<kBase64CharsLen; ++i) |
|
|
for (uint8_t i=0; i<kBase64CharsLen; ++i) |
|
|
{ |
|
|
{ |
|
@@ -75,10 +74,79 @@ uint8_t findBase64CharIndex(const char c) |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static inline |
|
|
|
|
|
|
|
|
static constexpr inline |
|
|
bool isBase64Char(const char c) |
|
|
bool isBase64Char(const char c) |
|
|
{ |
|
|
{ |
|
|
return (std::isalnum(c) || (c == '+') || (c == '/')); |
|
|
|
|
|
|
|
|
switch (c) |
|
|
|
|
|
{ |
|
|
|
|
|
case 'A': |
|
|
|
|
|
case 'B': |
|
|
|
|
|
case 'C': |
|
|
|
|
|
case 'D': |
|
|
|
|
|
case 'E': |
|
|
|
|
|
case 'F': |
|
|
|
|
|
case 'G': |
|
|
|
|
|
case 'H': |
|
|
|
|
|
case 'I': |
|
|
|
|
|
case 'J': |
|
|
|
|
|
case 'K': |
|
|
|
|
|
case 'L': |
|
|
|
|
|
case 'M': |
|
|
|
|
|
case 'N': |
|
|
|
|
|
case 'O': |
|
|
|
|
|
case 'P': |
|
|
|
|
|
case 'Q': |
|
|
|
|
|
case 'R': |
|
|
|
|
|
case 'S': |
|
|
|
|
|
case 'T': |
|
|
|
|
|
case 'U': |
|
|
|
|
|
case 'V': |
|
|
|
|
|
case 'W': |
|
|
|
|
|
case 'X': |
|
|
|
|
|
case 'Y': |
|
|
|
|
|
case 'Z': |
|
|
|
|
|
case 'a': |
|
|
|
|
|
case 'b': |
|
|
|
|
|
case 'c': |
|
|
|
|
|
case 'd': |
|
|
|
|
|
case 'e': |
|
|
|
|
|
case 'f': |
|
|
|
|
|
case 'g': |
|
|
|
|
|
case 'h': |
|
|
|
|
|
case 'i': |
|
|
|
|
|
case 'j': |
|
|
|
|
|
case 'k': |
|
|
|
|
|
case 'l': |
|
|
|
|
|
case 'm': |
|
|
|
|
|
case 'n': |
|
|
|
|
|
case 'o': |
|
|
|
|
|
case 'p': |
|
|
|
|
|
case 'q': |
|
|
|
|
|
case 'r': |
|
|
|
|
|
case 's': |
|
|
|
|
|
case 't': |
|
|
|
|
|
case 'u': |
|
|
|
|
|
case 'v': |
|
|
|
|
|
case 'w': |
|
|
|
|
|
case 'x': |
|
|
|
|
|
case 'y': |
|
|
|
|
|
case 'z': |
|
|
|
|
|
case '0': |
|
|
|
|
|
case '1': |
|
|
|
|
|
case '2': |
|
|
|
|
|
case '3': |
|
|
|
|
|
case '4': |
|
|
|
|
|
case '5': |
|
|
|
|
|
case '6': |
|
|
|
|
|
case '7': |
|
|
|
|
|
case '8': |
|
|
|
|
|
case '9': |
|
|
|
|
|
case '+': |
|
|
|
|
|
case '/': |
|
|
|
|
|
return true; |
|
|
|
|
|
default: |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} // namespace DistrhoBase64Helpers |
|
|
} // namespace DistrhoBase64Helpers |
|
|