mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-29 16:03:14 +03:00
Pass string objects by reference (#5378)
This commit is contained in:
@ -487,7 +487,7 @@ bool ESP8266WiFiSTAClass::hostname(const char* aHostname) {
|
||||
* @param aHostname max length:32
|
||||
* @return ok
|
||||
*/
|
||||
bool ESP8266WiFiSTAClass::hostname(String aHostname) {
|
||||
bool ESP8266WiFiSTAClass::hostname(const String& aHostname) {
|
||||
return hostname((char*) aHostname.c_str());
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ class ESP8266WiFiSTAClass {
|
||||
String hostname();
|
||||
bool hostname(char* aHostname);
|
||||
bool hostname(const char* aHostname);
|
||||
bool hostname(String aHostname);
|
||||
bool hostname(const String& aHostname);
|
||||
|
||||
// STA WiFi info
|
||||
wl_status_t status();
|
||||
|
@ -132,7 +132,7 @@ int WiFiClient::connect(const char* host, uint16_t port)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int WiFiClient::connect(const String host, uint16_t port)
|
||||
int WiFiClient::connect(const String& host, uint16_t port)
|
||||
{
|
||||
return connect(host.c_str(), port);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
uint8_t status();
|
||||
virtual int connect(IPAddress ip, uint16_t port);
|
||||
virtual int connect(const char *host, uint16_t port);
|
||||
virtual int connect(const String host, uint16_t port);
|
||||
virtual int connect(const String& host, uint16_t port);
|
||||
virtual size_t write(uint8_t);
|
||||
virtual size_t write(const uint8_t *buf, size_t size);
|
||||
virtual size_t write_P(PGM_P buf, size_t size);
|
||||
|
@ -116,7 +116,7 @@ int WiFiClientSecure::connect(const char* name, uint16_t port)
|
||||
return _connectSSL(name);
|
||||
}
|
||||
|
||||
int WiFiClientSecure::connect(const String host, uint16_t port)
|
||||
int WiFiClientSecure::connect(const String& host, uint16_t port)
|
||||
{
|
||||
return connect(host.c_str(), port);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
~WiFiClientSecure() override;
|
||||
|
||||
int connect(IPAddress ip, uint16_t port) override;
|
||||
int connect(const String host, uint16_t port) override;
|
||||
int connect(const String& host, uint16_t port) override;
|
||||
int connect(const char* name, uint16_t port) override;
|
||||
|
||||
bool verify(const char* fingerprint, const char* domain_name);
|
||||
|
@ -218,7 +218,7 @@ int WiFiClientSecure::connect(const char* name, uint16_t port) {
|
||||
return _connectSSL(name);
|
||||
}
|
||||
|
||||
int WiFiClientSecure::connect(const String host, uint16_t port) {
|
||||
int WiFiClientSecure::connect(const String& host, uint16_t port) {
|
||||
return connect(host.c_str(), port);
|
||||
}
|
||||
|
||||
@ -1108,7 +1108,7 @@ bool WiFiClientSecure::probeMaxFragmentLength(const char* name, uint16_t port, u
|
||||
return WiFiClientSecure::probeMaxFragmentLength(remote_addr, port, len);
|
||||
}
|
||||
|
||||
bool WiFiClientSecure::probeMaxFragmentLength(const String host, uint16_t port, uint16_t len) {
|
||||
bool WiFiClientSecure::probeMaxFragmentLength(const String& host, uint16_t port, uint16_t len) {
|
||||
return WiFiClientSecure::probeMaxFragmentLength(host.c_str(), port, len);
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ class WiFiClientSecure : public WiFiClient {
|
||||
~WiFiClientSecure() override;
|
||||
|
||||
int connect(IPAddress ip, uint16_t port) override;
|
||||
int connect(const String host, uint16_t port) override;
|
||||
int connect(const String& host, uint16_t port) override;
|
||||
int connect(const char* name, uint16_t port) override;
|
||||
|
||||
uint8_t connected() override;
|
||||
@ -119,7 +119,7 @@ class WiFiClientSecure : public WiFiClient {
|
||||
// Check for Maximum Fragment Length support for given len
|
||||
static bool probeMaxFragmentLength(IPAddress ip, uint16_t port, uint16_t len);
|
||||
static bool probeMaxFragmentLength(const char *hostname, uint16_t port, uint16_t len);
|
||||
static bool probeMaxFragmentLength(const String host, uint16_t port, uint16_t len);
|
||||
static bool probeMaxFragmentLength(const String& host, uint16_t port, uint16_t len);
|
||||
|
||||
// AXTLS compatible wrappers
|
||||
// Cannot implement this mode, we need FP before we can connect: bool verify(const char* fingerprint, const char* domain_name)
|
||||
|
Reference in New Issue
Block a user