Skip to content

Commit c69ca14

Browse files
committed
Test
1 parent 4da6ea0 commit c69ca14

File tree

2 files changed

+68
-4
lines changed

2 files changed

+68
-4
lines changed

Diff for: .github/workflows/clang-format-check.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
name: clang-format Check
1+
name: Formatting Check
22

33
on: [push, pull_request]
44
jobs:
55
formatting-check:
6-
name: Formatting Check
6+
name: clang-format-diff
77
runs-on: ubuntu-latest
88
steps:
99
- uses: actions/checkout@v3
1010
with:
1111
fetch-depth: 2
12-
- name: Run clang-format style check for C/C++/Protobuf programs.
13-
uses: lucasssvaz/arduino-esp32-format@v1.0
12+
- name: Run clang-format style check for Arduino programs.
13+
uses: lucasssvaz/arduino-esp32-format@main
1414
with:
1515
clang-format-version: '15'
1616
check-path: ${{ matrix.path }}

Diff for: cores/esp32/dummy.cpp

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/**
2+
* base64.cpp
3+
*
4+
* Created on: 09.12.2015
5+
*
6+
* Copyright (c) 2015 Markus Sattler. All rights reserved.
7+
* This file is part of the ESP31B core for Arduino.
8+
*
9+
* This library is free software; you can redistribute it and/or
10+
* modify it under the terms of the GNU Lesser General Public
11+
* License as published by the Free Software Foundation; either
12+
* version 2.1 of the License, or (at your option) any later version.
13+
*
14+
* This library is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+
* Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public
20+
* License along with this library; if not, write to the Free Software
21+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22+
*
23+
*/
24+
25+
#include "Arduino.h"
26+
extern "C" {
27+
#include "libb64/cdecode.h"
28+
#include "libb64/cencode.h"
29+
}
30+
#include "base64.h"
31+
32+
/**
33+
* convert input data to base64
34+
* @param data const uint8_t *
35+
* @param length size_t
36+
* @return String
37+
*/
38+
String base64::encode(const uint8_t * data, size_t length)
39+
{
40+
size_t size = base64_encode_expected_len(length) + 1;
41+
char * buffer = (char *) malloc(size);
42+
if(buffer) {
43+
base64_encodestate _state;
44+
base64_init_encodestate(&_state);
45+
int len = base64_encode_block((const char *) &data[0], length, &buffer[0], &_state);
46+
len = base64_encode_blockend((buffer + len), &_state);
47+
48+
String base64 = String(buffer);
49+
free(buffer);
50+
return base64;
51+
}
52+
return String("-FAIL-");
53+
}
54+
55+
/**
56+
* convert input data to base64
57+
* @param text const String&
58+
* @return String
59+
*/
60+
String base64::encode(const String& text)
61+
{
62+
return base64::encode((uint8_t *) text.c_str(), text.length());
63+
}
64+

0 commit comments

Comments
 (0)