[misc] Update .clang-format style

This commit is contained in:
Kuba Szczodrzyński
2024-09-05 16:31:09 +02:00
parent 31e1d51dbd
commit a9009a8cee
12 changed files with 91 additions and 25 deletions

View File

@@ -1,3 +1,4 @@
# 2024-07-30
Language: Cpp
BasedOnStyle: LLVM
AlignAfterOpenBracket: BlockIndent
@@ -6,6 +7,7 @@ AlignConsecutiveAssignments: true
AlignConsecutiveMacros: AcrossComments
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: Empty
AlwaysBreakTemplateDeclarations: Yes
@@ -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

View File

@@ -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))

View File

@@ -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;
@@ -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;

View File

@@ -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,
@@ -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);

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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!

View File

@@ -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);

View File

@@ -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");

View File

@@ -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;

View File

@@ -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);

View File

@@ -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))