mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
Pass string objects by reference (#5378)
This commit is contained in:
parent
72ad9353fc
commit
cd05bae0e8
@ -34,10 +34,10 @@ class MD5Builder {
|
||||
void add(const uint8_t * data, const uint16_t len);
|
||||
void add(const char * data){ add((const uint8_t*)data, strlen(data)); }
|
||||
void add(char * data){ add((const char*)data); }
|
||||
void add(const String data){ add(data.c_str()); }
|
||||
void add(const String& data){ add(data.c_str()); }
|
||||
void addHexString(const char * data);
|
||||
void addHexString(char * data){ addHexString((const char*)data); }
|
||||
void addHexString(const String data){ addHexString(data.c_str()); }
|
||||
void addHexString(const String& data){ addHexString(data.c_str()); }
|
||||
bool addStream(Stream & stream, const size_t maxLen);
|
||||
void calculate(void);
|
||||
void getBytes(uint8_t * output);
|
||||
|
@ -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)
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
void addService(const char *service, const char *proto, uint16_t port){
|
||||
addService((char *)service, (char *)proto, port);
|
||||
}
|
||||
void addService(String service, String proto, uint16_t port){
|
||||
void addService(const String& service, const String& proto, uint16_t port){
|
||||
addService(service.c_str(), proto.c_str(), port);
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ public:
|
||||
bool addServiceTxt(const char *name, const char *proto, const char *key,const char * value){
|
||||
return addServiceTxt((char *)name, (char *)proto, (char *)key, (char *)value);
|
||||
}
|
||||
bool addServiceTxt(String name, String proto, String key, String value){
|
||||
bool addServiceTxt(const String& name, const String& proto, const String& key, const String& value){
|
||||
return addServiceTxt(name.c_str(), proto.c_str(), key.c_str(), value.c_str());
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ public:
|
||||
int queryService(const char *service, const char *proto){
|
||||
return queryService((char *)service, (char *)proto);
|
||||
}
|
||||
int queryService(String service, String proto){
|
||||
int queryService(const String& service, const String& proto){
|
||||
return queryService(service.c_str(), proto.c_str());
|
||||
}
|
||||
String hostname(int idx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user