Skip to content

Commit

Permalink
[misc] Update .clang-format style
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba2k2 committed Sep 5, 2024
1 parent 31e1d51 commit a9009a8
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 25 deletions.
3 changes: 3 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# 2024-07-30
Language: Cpp
BasedOnStyle: LLVM
AlignAfterOpenBracket: BlockIndent
Expand All @@ -6,6 +7,7 @@ AlignConsecutiveAssignments: true
AlignConsecutiveMacros: AcrossComments
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: Empty
AlwaysBreakTemplateDeclarations: Yes
Expand All @@ -21,6 +23,7 @@ IndentCaseLabels: true
IndentWidth: 4
LambdaBodyIndentation: Signature
MaxEmptyLinesToKeep: 1
PenaltyReturnTypeOnItsOwnLine: 1000
# PointerAlignment: Left # TODO enable this and reformat project
QualifierAlignment: Left
ReflowComments: true
Expand Down
9 changes: 7 additions & 2 deletions cores/beken-72xx/arduino/libraries/WiFi/WiFiSTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

#include "WiFiPrivate.h"

WiFiStatus
WiFiClass::begin(const char *ssid, const char *passphrase, int32_t channel, const uint8_t *bssid, bool connect) {
WiFiStatus WiFiClass::begin(
const char *ssid,
const char *passphrase,
int32_t channel,
const uint8_t *bssid,
bool connect
) {
if (!enableSTA(true))
return WL_CONNECT_FAILED;
if (!validate(ssid, passphrase))
Expand Down
16 changes: 12 additions & 4 deletions cores/beken-72xx/base/wraps/BkDriverFlash.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,12 @@ OSStatus __wrap_bk_flash_erase(bk_partition_t partition, uint32_t off_set, uint3
return kNoErr;
}

OSStatus
__wrap_bk_flash_write(bk_partition_t partition, volatile uint32_t off_set, uint8_t *inBuffer, uint32_t inBufferLength) {
OSStatus __wrap_bk_flash_write(
bk_partition_t partition,
volatile uint32_t off_set,
uint8_t *inBuffer,
uint32_t inBufferLength
) {
UINT32 status;
DD_HANDLE flash_hdl;
uint32_t start_addr;
Expand All @@ -98,8 +102,12 @@ __wrap_bk_flash_write(bk_partition_t partition, volatile uint32_t off_set, uint8
return kNoErr;
}

OSStatus
__wrap_bk_flash_read(bk_partition_t partition, volatile uint32_t off_set, uint8_t *outBuffer, uint32_t inBufferLength) {
OSStatus __wrap_bk_flash_read(
bk_partition_t partition,
volatile uint32_t off_set,
uint8_t *outBuffer,
uint32_t inBufferLength
) {
UINT32 status;
uint32_t start_addr;
DD_HANDLE flash_hdl;
Expand Down
15 changes: 12 additions & 3 deletions cores/common/arduino/libraries/api/WiFi/WiFi.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,13 @@ class WiFiClass {
const uint8_t *bssid = NULL,
bool connect = true
);
WiFiStatus
begin(char *ssid, char *passphrase = NULL, int32_t channel = 0, const uint8_t *bssid = NULL, bool connect = true);
WiFiStatus begin(
char *ssid,
char *passphrase = NULL,
int32_t channel = 0,
const uint8_t *bssid = NULL,
bool connect = true
);

bool config(
IPAddress localIP,
Expand Down Expand Up @@ -178,7 +183,11 @@ class WiFiClass {

public: /* WiFiAP.cpp */
bool softAP(
const char *ssid, const char *passphrase = NULL, int channel = 1, bool ssidHidden = false, int maxClients = 4
const char *ssid,
const char *passphrase = NULL,
int channel = 1,
bool ssidHidden = false,
int maxClients = 4
);
bool softAPConfig(IPAddress localIP, IPAddress gateway, IPAddress subnet);
bool softAPdisconnect(bool wifiOff = false);
Expand Down
7 changes: 6 additions & 1 deletion cores/common/arduino/libraries/api/WiFi/WiFiScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
#include "WiFi.h"

bool WiFiClass::getNetworkInfo(
uint8_t networkItem, String &ssid, WiFiAuthMode &encType, int32_t &rssi, uint8_t *&bssid, int32_t &channel
uint8_t networkItem,
String &ssid,
WiFiAuthMode &encType,
int32_t &rssi,
uint8_t *&bssid,
int32_t &channel
) {
ssid = SSID(networkItem);
encType = encryptionType(networkItem);
Expand Down
12 changes: 10 additions & 2 deletions cores/common/arduino/libraries/common/WiFiClient/MbedTLSClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,21 @@ int MbedTLSClient::connect(const char *host, uint16_t port, int32_t timeout) {
}

int MbedTLSClient::connect(
IPAddress ip, uint16_t port, const char *rootCABuf, const char *clientCert, const char *clientKey
IPAddress ip,
uint16_t port,
const char *rootCABuf,
const char *clientCert,
const char *clientKey
) {
return connect(ipToString(ip).c_str(), port, 0, rootCABuf, clientCert, clientKey, NULL, NULL) == 0;
}

int MbedTLSClient::connect(
const char *host, uint16_t port, const char *rootCABuf, const char *clientCert, const char *clientKey
const char *host,
uint16_t port,
const char *rootCABuf,
const char *clientCert,
const char *clientKey
) {
return connect(host, port, 0, rootCABuf, clientCert, clientKey, NULL, NULL) == 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,22 @@

class IWiFiClientSecure {
public:
virtual int
connect(IPAddress ip, uint16_t port, const char *rootCABuf, const char *clientCert, const char *clientKey) = 0;
virtual int
connect(const char *host, uint16_t port, const char *rootCABuf, const char *clientCert, const char *clientKey) = 0;
virtual int connect(IPAddress ip, uint16_t port, const char *pskIdent, const char *psk) = 0;
virtual int connect(const char *host, uint16_t port, const char *pskIdent, const char *psk) = 0;
virtual int connect(
IPAddress ip,
uint16_t port,
const char *rootCABuf,
const char *clientCert,
const char *clientKey
) = 0;
virtual int connect(
const char *host,
uint16_t port,
const char *rootCABuf,
const char *clientCert,
const char *clientKey
) = 0;
virtual int connect(IPAddress ip, uint16_t port, const char *pskIdent, const char *psk) = 0;
virtual int connect(const char *host, uint16_t port, const char *pskIdent, const char *psk) = 0;

virtual int lastError(char *buf, const size_t size) = 0;
virtual void setInsecure() = 0; // Don't validate the chain, just accept whatever is given. VERY INSECURE!
Expand Down
7 changes: 5 additions & 2 deletions cores/common/arduino/libraries/common/mDNS/LwIPmDNS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,11 @@ static bool enableMDNS(struct netif *netif) {
}

#ifdef LWIP_NETIF_EXT_STATUS_CALLBACK
static void
mdns_netif_ext_status_callback(struct netif *netif, netif_nsc_reason_t reason, const netif_ext_callback_args_t *args) {
static void mdns_netif_ext_status_callback(
struct netif *netif,
netif_nsc_reason_t reason,
const netif_ext_callback_args_t *args
) {
if (reason & LWIP_NSC_NETIF_REMOVED) {
LT_DM(MDNS, "Netif removed, stopping mDNS on netif %u", netif->num);
mdns_resp_remove_netif(netif);
Expand Down
7 changes: 6 additions & 1 deletion cores/common/arduino/libraries/ext/HTTPClient/HTTPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,12 @@ bool HTTPClient::begin(String host, uint16_t port, String uri, const char *CAcer
}

bool HTTPClient::begin(
String host, uint16_t port, String uri, const char *CAcert, const char *cli_cert, const char *cli_key
String host,
uint16_t port,
String uri,
const char *CAcert,
const char *cli_cert,
const char *cli_key
) {
if (_client && !_tcpDeprecated) {
log_d("mix up of new and deprecated api");
Expand Down
4 changes: 3 additions & 1 deletion cores/common/arduino/libraries/ext/WebServer/WebServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ class WebServer {

bool authenticate(const char *username, const char *password);
void requestAuthentication(
HTTPAuthMethod mode = BASIC_AUTH, const char *realm = NULL, const String &authFailMsg = String("")
HTTPAuthMethod mode = BASIC_AUTH,
const char *realm = NULL,
const String &authFailMsg = String("")
);

typedef std::function<void(void)> THandlerFunction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ using namespace mime;
class FunctionRequestHandler : public RequestHandler {
public:
FunctionRequestHandler(
WebServer::THandlerFunction fn, WebServer::THandlerFunction ufn, const Uri &uri, HTTPMethod method
WebServer::THandlerFunction fn,
WebServer::THandlerFunction ufn,
const Uri &uri,
HTTPMethod method
)
: _fn(fn), _ufn(ufn), _uri(uri.clone()), _method(method) {
_uri->initPathArgs(pathArgs);
Expand Down
9 changes: 7 additions & 2 deletions cores/realtek-amb/arduino/libraries/WiFi/WiFiSTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

#include "WiFiPrivate.h"

WiFiStatus
WiFiClass::begin(const char *ssid, const char *passphrase, int32_t channel, const uint8_t *bssid, bool connect) {
WiFiStatus WiFiClass::begin(
const char *ssid,
const char *passphrase,
int32_t channel,
const uint8_t *bssid,
bool connect
) {
if (!enableSTA(true))
return WL_CONNECT_FAILED;
if (!validate(ssid, passphrase))
Expand Down

0 comments on commit a9009a8

Please sign in to comment.