mirror of
https://github.com/Links2004/arduinoWebSockets.git
synced 2025-07-22 20:07:14 +02:00
CORE_HAS_LIBB64 for ESP32
This commit is contained in:
@ -9,6 +9,10 @@ For details, see http://sourceforge.net/projects/libb64
|
||||
#include <core_esp8266_features.h>
|
||||
#endif
|
||||
|
||||
#if defined(ESP32)
|
||||
#define CORE_HAS_LIBB64
|
||||
#endif
|
||||
|
||||
#ifndef CORE_HAS_LIBB64
|
||||
#include "cdecode_inc.h"
|
||||
|
||||
@ -32,9 +36,9 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex
|
||||
const char* codechar = code_in;
|
||||
char* plainchar = plaintext_out;
|
||||
char fragment;
|
||||
|
||||
|
||||
*plainchar = state_in->plainchar;
|
||||
|
||||
|
||||
switch (state_in->step)
|
||||
{
|
||||
while (1)
|
||||
|
@ -9,6 +9,10 @@ For details, see http://sourceforge.net/projects/libb64
|
||||
#include <core_esp8266_features.h>
|
||||
#endif
|
||||
|
||||
#if defined(ESP32)
|
||||
#define CORE_HAS_LIBB64
|
||||
#endif
|
||||
|
||||
#ifndef CORE_HAS_LIBB64
|
||||
#include "cencode_inc.h"
|
||||
|
||||
@ -35,9 +39,9 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
|
||||
char* codechar = code_out;
|
||||
char result;
|
||||
char fragment;
|
||||
|
||||
|
||||
result = state_in->result;
|
||||
|
||||
|
||||
switch (state_in->step)
|
||||
{
|
||||
while (1)
|
||||
@ -76,7 +80,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
|
||||
*codechar++ = base64_encode_value(result);
|
||||
result = (fragment & 0x03f) >> 0;
|
||||
*codechar++ = base64_encode_value(result);
|
||||
|
||||
|
||||
++(state_in->stepcount);
|
||||
if (state_in->stepcount == CHARS_PER_LINE/4)
|
||||
{
|
||||
@ -92,7 +96,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
|
||||
int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
|
||||
{
|
||||
char* codechar = code_out;
|
||||
|
||||
|
||||
switch (state_in->step)
|
||||
{
|
||||
case step_B:
|
||||
@ -108,7 +112,7 @@ int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
|
||||
break;
|
||||
}
|
||||
*codechar++ = 0x00;
|
||||
|
||||
|
||||
return codechar - code_out;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user