Skip to content

Input-only char* variables updated to const to comply with C++ guidelines #212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/MySQL_Connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ const char DISCONNECTED[] PROGMEM = "Disconnected.";

Returns boolean - True = connection succeeded
*/
boolean MySQL_Connection::connect(IPAddress server, int port, char *user,
char *password, char *db)
boolean MySQL_Connection::connect(IPAddress server, int port, const char *user,
const char *password, const char *db)
{
int connected = 0;
int retries = MAX_CONNECT_ATTEMPTS;
Expand Down
4 changes: 2 additions & 2 deletions src/MySQL_Connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class MySQL_Connection : public MySQL_Packet {
public:
MySQL_Connection(Client *client_instance) :
MySQL_Packet(client_instance) {}
boolean connect(IPAddress server, int port, char *user, char *password,
char *db=NULL);
boolean connect(IPAddress server, int port, const char *user, const char *password,
const char *db=NULL);
int connected() { return client->connected(); }
const char *version() { return MYSQL_VERSION_STR; }
void close();
Expand Down
6 changes: 3 additions & 3 deletions src/MySQL_Packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ void MySQL_Packet::show_error(const char *msg, bool EOL) {
password[in] password
db[in] default database
*/
void MySQL_Packet::send_authentication_packet(char *user, char *password,
char *db)
void MySQL_Packet::send_authentication_packet(const char *user, const char *password,
const char *db)
{
if (buffer != NULL)
free(buffer);
Expand Down Expand Up @@ -175,7 +175,7 @@ void MySQL_Packet::send_authentication_packet(char *user, char *password,

Returns boolean - True = scramble succeeded
*/
boolean MySQL_Packet::scramble_password(char *password, byte *pwd_hash) {
boolean MySQL_Packet::scramble_password(const char *password, byte *pwd_hash) {
byte *digest;
byte hash1[20];
byte hash2[20];
Expand Down
6 changes: 3 additions & 3 deletions src/MySQL_Packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ class MySQL_Packet {

MySQL_Packet(Client *client_instance);
boolean complete_handshake(char *user, char *password);
void send_authentication_packet(char *user, char *password,
char *db=NULL);
void send_authentication_packet(const char *user, const char *password,
const char *db=NULL);
void parse_handshake_packet();
boolean scramble_password(char *password, byte *pwd_hash);
boolean scramble_password(const char *password, byte *pwd_hash);
void read_packet();
int get_packet_type();
void parse_error_packet();
Expand Down