Module: kamailio
Branch: 5.3
Commit: a20891f5d1696db9a87e2a9236572623638d599a
URL:
https://github.com/kamailio/kamailio/commit/a20891f5d1696db9a87e2a923657262…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-03-14T18:02:58+01:00
db_mysql: use cast to (const void*) for mysql_options() value
- match the function signature, cast to (char*) or (const char*) being
used so far
(cherry picked from commit 3bfc01f0f57a25fb53de1dc45d39af747edf309a)
---
Modified: src/modules/db_mysql/km_my_con.c
Modified: src/modules/db_mysql/my_con.c
---
Diff:
https://github.com/kamailio/kamailio/commit/a20891f5d1696db9a87e2a923657262…
Patch:
https://github.com/kamailio/kamailio/commit/a20891f5d1696db9a87e2a923657262…
---
diff --git a/src/modules/db_mysql/km_my_con.c b/src/modules/db_mysql/km_my_con.c
index bd69d9f109..bed21f92a7 100644
--- a/src/modules/db_mysql/km_my_con.c
+++ b/src/modules/db_mysql/km_my_con.c
@@ -71,7 +71,7 @@ struct my_con* db_mysql_new_connection(const struct db_id* id)
egrp = 0;
memset(ptr, 0, sizeof(struct my_con));
ptr->ref = 1;
-
+
ptr->con = (MYSQL*)pkg_malloc(sizeof(MYSQL));
if (!ptr->con) {
PKG_MEM_ERROR;
@@ -94,7 +94,7 @@ struct my_con* db_mysql_new_connection(const struct db_id* id)
}
// read [client] and [<grp>] sections in the order
// given in my.cnf
- mysql_options(ptr->con, MYSQL_READ_DEFAULT_GROUP, grp);
+ mysql_options(ptr->con, MYSQL_READ_DEFAULT_GROUP, (const void*)grp);
}
else {
host = id->host;
@@ -109,14 +109,14 @@ struct my_con* db_mysql_new_connection(const struct db_id* id)
}
// set connect, read and write timeout, the value counts three times
- mysql_options(ptr->con, MYSQL_OPT_CONNECT_TIMEOUT, (const char
*)&db_mysql_timeout_interval);
- mysql_options(ptr->con, MYSQL_OPT_READ_TIMEOUT, (const char
*)&db_mysql_timeout_interval);
- mysql_options(ptr->con, MYSQL_OPT_WRITE_TIMEOUT, (const char
*)&db_mysql_timeout_interval);
+ mysql_options(ptr->con, MYSQL_OPT_CONNECT_TIMEOUT, (const
void*)&db_mysql_timeout_interval);
+ mysql_options(ptr->con, MYSQL_OPT_READ_TIMEOUT, (const
void*)&db_mysql_timeout_interval);
+ mysql_options(ptr->con, MYSQL_OPT_WRITE_TIMEOUT, (const
void*)&db_mysql_timeout_interval);
#if MYSQL_VERSION_ID > 50012
/* set reconnect flag if enabled */
if (db_mysql_auto_reconnect) {
rec = 1;
- mysql_options(ptr->con, MYSQL_OPT_RECONNECT, &rec);
+ mysql_options(ptr->con, MYSQL_OPT_RECONNECT, (const void*)&rec);
}
#else
if (db_mysql_auto_reconnect)
diff --git a/src/modules/db_mysql/my_con.c b/src/modules/db_mysql/my_con.c
index 2314b754de..f64a90f0aa 100644
--- a/src/modules/db_mysql/my_con.c
+++ b/src/modules/db_mysql/my_con.c
@@ -67,7 +67,7 @@ int my_con_connect(db_con_t* con)
if (my_connect_to) {
if (mysql_options(mcon->con, MYSQL_OPT_CONNECT_TIMEOUT,
- (char*)&my_connect_to))
+ (const void*)&my_connect_to))
WARN("failed to set MYSQL_OPT_CONNECT_TIMEOUT\n");
}
@@ -77,12 +77,12 @@ int my_con_connect(db_con_t* con)
(my_client_ver < 50000))) {
if (my_send_to) {
if (mysql_options(mcon->con, MYSQL_OPT_WRITE_TIMEOUT ,
- (char*)&my_send_to))
+ (const void*)&my_send_to))
WARN("failed to set MYSQL_OPT_WRITE_TIMEOUT\n");
}
if (my_recv_to){
if (mysql_options(mcon->con, MYSQL_OPT_READ_TIMEOUT ,
- (char*)&my_recv_to))
+ (const void*)&my_recv_to))
WARN("failed to set MYSQL_OPT_READ_TIMEOUT\n");
}
}