]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
addons/res_config_mysql: silense warnings about printf format errors.
authorJaco Kroon <jaco@uls.co.za>
Thu, 20 Feb 2020 12:52:06 +0000 (14:52 +0200)
committerJaco Kroon <jaco@uls.co.za>
Mon, 24 Feb 2020 14:22:03 +0000 (08:22 -0600)
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

addons/res_config_mysql.c

index edd9385061cab83788b5f6923ccae42489f6630d..359158bc659a43599669af6db028bb9e7ecde57c 100644 (file)
@@ -554,7 +554,7 @@ static struct ast_config *realtime_multi_mysql(const char *database, const char
 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 @@ static int update_mysql(const char *database, const char *tablename, const char
        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 update_mysql(const char *database, const char *tablename, const char
 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 @@ static int update2_mysql(const char *database, const char *tablename, const stru
        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 store_mysql(const char *database, const char *table, const struct ast
 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 @@ static int destroy_mysql(const char *database, const char *table, const char *ke
        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 @@ static struct ast_config *config_mysql(const char *database, const char *table,
        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 @@ static struct ast_config *config_mysql(const char *database, const char *table,
 
        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. */