1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

fix compiler cast warnings in unittests

size_t is not always an unsigned long on all platforms, but for diagnostic
message in a test, it should be fine to cast it this way

addresses these warnings:

unittest/libmariadb/connection.c:635:3: warning: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'time_t' [-Wformat=]
   diag("elapsed: %u", elapsed);

unittest/libmariadb/dyncol.c:149:5: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat=]
     diag("%s %d", my_keys[i].str, my_keys[i].length);

unittest/libmariadb/dyncol.c:227:5: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' [-Wformat=]
     diag("Key: %s Len: %d", unpack_keys[i].str, unpack_keys[i].length);
This commit is contained in:
Eric Herman
2015-10-16 11:33:55 +02:00
parent a3e1b0fa7b
commit f10aa72112
2 changed files with 3 additions and 3 deletions

View File

@@ -632,7 +632,7 @@ int test_connection_timeout(MYSQL *my)
return FAIL;
}
elapsed= time(NULL) - start;
diag("elapsed: %u", elapsed);
diag("elapsed: %lu", (unsigned long)elapsed);
mysql_close(mysql);
FAIL_IF(elapsed > 2 * timeout, "timeout ignored")
return OK;