[Asterisk-code-review] addons/res_config_mysql: silense warnings about printf format errors. (asterisk[17])

Kevin Harwell asteriskteam at digium.com
Thu Feb 27 14:44:49 CST 2020


Kevin Harwell has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/13832 )

Change subject: addons/res_config_mysql: silense warnings about printf format errors.
......................................................................

addons/res_config_mysql: silense warnings about printf format errors.

Warnings without this:

res_config_mysql.c: In function 'update2_mysql':
res_config_mysql.c:741:15: warning: format '%llu' expects argument of type
    'long long unsigned int', but argument 6 has type 'my_ulonglong'
    {aka 'long unsigned int'} [-Wformat=]
ast_debug(1, "MySQL RealTime: Updated %llu rows on table: %s\n",
    numrows, tablename);

(reformatted for readability within line-wrap)

Change-Id: I2af4d419a37c1a7eeee750cf9ae4a9a2b3a37fd3
---
M addons/res_config_mysql.c
1 file changed, 8 insertions(+), 8 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved; Approved for Submit



diff --git a/addons/res_config_mysql.c b/addons/res_config_mysql.c
index edd9385..359158b 100644
--- a/addons/res_config_mysql.c
+++ b/addons/res_config_mysql.c
@@ -554,7 +554,7 @@
 static int update_mysql(const char *database, const char *tablename, const char *keyfield, const char *lookup, const struct ast_variable *rt_fields)
 {
 	struct mysql_conn *dbh;
-	my_ulonglong numrows;
+	uint64_t numrows;
 	const struct ast_variable *field = rt_fields;
 	struct ast_str *sql = ast_str_thread_get(&sql_buf, 100), *buf = ast_str_thread_get(&scratch_buf, 100);
 	struct tables *table;
@@ -641,7 +641,7 @@
 	release_table(table);
 	release_database(dbh);
 
-	ast_debug(1, "MySQL RealTime: Updated %llu rows on table: %s\n", numrows, tablename);
+	ast_debug(1, "MySQL RealTime: Updated %" PRIu64 " rows on table: %s\n", numrows, tablename);
 
 	/* From http://dev.mysql.com/doc/mysql/en/mysql-affected-rows.html
 	 * An integer greater than zero indicates the number of rows affected
@@ -655,7 +655,7 @@
 static int update2_mysql(const char *database, const char *tablename, const struct ast_variable *lookup_fields, const struct ast_variable *update_fields)
 {
 	struct mysql_conn *dbh;
-	my_ulonglong numrows;
+	uint64_t numrows;
 	int first;
 	const struct ast_variable *field;
 	struct ast_str *sql = ast_str_thread_get(&sql_buf, 100), *buf = ast_str_thread_get(&scratch_buf, 100);
@@ -738,7 +738,7 @@
 	numrows = mysql_affected_rows(&dbh->handle);
 	release_database(dbh);
 
-	ast_debug(1, "MySQL RealTime: Updated %llu rows on table: %s\n", numrows, tablename);
+	ast_debug(1, "MySQL RealTime: Updated %" PRIu64 " rows on table: %s\n", numrows, tablename);
 
 	/* From http://dev.mysql.com/doc/mysql/en/mysql-affected-rows.html
 	 * An integer greater than zero indicates the number of rows affected
@@ -810,7 +810,7 @@
 static int destroy_mysql(const char *database, const char *table, const char *keyfield, const char *lookup, const struct ast_variable *rt_fields)
 {
 	struct mysql_conn *dbh;
-	my_ulonglong numrows;
+	uint64_t numrows;
 	struct ast_str *sql = ast_str_thread_get(&sql_buf, 16);
 	struct ast_str *buf = ast_str_thread_get(&scratch_buf, 16);
 	const struct ast_variable *field;
@@ -862,7 +862,7 @@
 	numrows = mysql_affected_rows(&dbh->handle);
 	release_database(dbh);
 
-	ast_debug(1, "MySQL RealTime: Deleted %llu rows on table: %s\n", numrows, table);
+	ast_debug(1, "MySQL RealTime: Deleted %" PRIu64 " rows on table: %s\n", numrows, table);
 
 	/* From http://dev.mysql.com/doc/mysql/en/mysql-affected-rows.html
 	 * An integer greater than zero indicates the number of rows affected
@@ -878,7 +878,7 @@
 	struct mysql_conn *dbh;
 	MYSQL_RES *result;
 	MYSQL_ROW row;
-	my_ulonglong num_rows;
+	uint64_t num_rows;
 	struct ast_variable *new_v;
 	struct ast_category *cur_cat = NULL;
 	struct ast_str *sql = ast_str_thread_get(&sql_buf, 200);
@@ -916,7 +916,7 @@
 
 	if ((result = mysql_store_result(&dbh->handle))) {
 		num_rows = mysql_num_rows(result);
-		ast_debug(1, "MySQL RealTime: Found %llu rows.\n", num_rows);
+		ast_debug(1, "MySQL RealTime: Found %" PRIu64 " rows.\n", num_rows);
 
 		/* There might exist a better way to access the column names other than counting,
 		 * but I believe that would require another loop that we don't need. */

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13832
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 17
Gerrit-Change-Id: I2af4d419a37c1a7eeee750cf9ae4a9a2b3a37fd3
Gerrit-Change-Number: 13832
Gerrit-PatchSet: 1
Gerrit-Owner: Jaco Kroon <jaco at uls.co.za>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200227/bef905af/attachment.html>


More information about the asterisk-code-review mailing list