[db/misc] Cast ARRAY_SIZE to unsigned (avoids compiler warnings)

This commit is contained in:
ejurgensen 2018-09-04 20:07:05 +02:00
parent 350361e8bb
commit 16e375e637
3 changed files with 8 additions and 8 deletions

View File

@ -2021,7 +2021,7 @@ db_query_fetch_file(struct query_params *qp, struct db_media_file_info *dbmfi)
// We allow more cols in db than in map because the db may be a future schema
if (ncols < ARRAY_SIZE(dbmfi_cols_map))
{
DPRINTF(E_LOG, L_DB, "BUG: database has fewer columns (%d) than dbmfi column map (%lu)\n", ncols, ARRAY_SIZE(dbmfi_cols_map));
DPRINTF(E_LOG, L_DB, "BUG: database has fewer columns (%d) than dbmfi column map (%u)\n", ncols, ARRAY_SIZE(dbmfi_cols_map));
return -1;
}
@ -2079,7 +2079,7 @@ db_query_fetch_pl(struct query_params *qp, struct db_playlist_info *dbpli, int w
// We allow more cols in db than in map because the db may be a future schema
if (ncols < ARRAY_SIZE(dbpli_cols_map))
{
DPRINTF(E_LOG, L_DB, "BUG: database has fewer columns (%d) than dbpli column map (%lu)\n", ncols, ARRAY_SIZE(dbpli_cols_map));
DPRINTF(E_LOG, L_DB, "BUG: database has fewer columns (%d) than dbpli column map (%u)\n", ncols, ARRAY_SIZE(dbpli_cols_map));
return -1;
}
@ -2174,7 +2174,7 @@ db_query_fetch_group(struct query_params *qp, struct db_group_info *dbgri)
// We allow more cols in db than in map because the db may be a future schema
if (ncols < ARRAY_SIZE(dbgri_cols_map))
{
DPRINTF(E_LOG, L_DB, "BUG: database has fewer columns (%d) than dbgri column map (%lu)\n", ncols, ARRAY_SIZE(dbgri_cols_map));
DPRINTF(E_LOG, L_DB, "BUG: database has fewer columns (%d) than dbgri column map (%u)\n", ncols, ARRAY_SIZE(dbgri_cols_map));
return -1;
}
@ -2660,7 +2660,7 @@ db_file_fetch_byquery(char *query)
// We allow more cols in db than in map because the db may be a future schema
if (ncols < ARRAY_SIZE(mfi_cols_map))
{
DPRINTF(E_LOG, L_DB, "BUG: database has fewer columns (%d) than mfi column map (%lu)\n", ncols, ARRAY_SIZE(mfi_cols_map));
DPRINTF(E_LOG, L_DB, "BUG: database has fewer columns (%d) than mfi column map (%u)\n", ncols, ARRAY_SIZE(mfi_cols_map));
sqlite3_finalize(stmt);
free(mfi);
@ -3270,7 +3270,7 @@ db_pl_fetch_byquery(const char *query)
if (ncols < ARRAY_SIZE(pli_cols_map))
{
DPRINTF(E_LOG, L_DB, "BUG: database has fewer columns (%d) than pli column map (%lu)\n", ncols, ARRAY_SIZE(pli_cols_map));
DPRINTF(E_LOG, L_DB, "BUG: database has fewer columns (%d) than pli column map (%u)\n", ncols, ARRAY_SIZE(pli_cols_map));
sqlite3_finalize(stmt);
free(pli);
@ -6027,7 +6027,7 @@ db_watch_get_byquery(struct watch_info *wi, char *query)
if (ncols < ARRAY_SIZE(wi_cols_map))
{
DPRINTF(E_LOG, L_DB, "BUG: database has fewer columns (%d) than wi column map (%lu)\n", ncols, ARRAY_SIZE(wi_cols_map));
DPRINTF(E_LOG, L_DB, "BUG: database has fewer columns (%d) than wi column map (%u)\n", ncols, ARRAY_SIZE(wi_cols_map));
sqlite3_finalize(stmt);
sqlite3_free(query);

View File

@ -103,7 +103,7 @@ db_drop_indices(sqlite3 *hdl)
static int
db_generic_upgrade(sqlite3 *hdl, const struct db_upgrade_query *queries, int nqueries)
db_generic_upgrade(sqlite3 *hdl, const struct db_upgrade_query *queries, unsigned int nqueries)
{
char *errmsg;
int i;

View File

@ -15,7 +15,7 @@
#define STOB(s) ((s) * 4)
#define BTOS(b) ((b) / 4)
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define ARRAY_SIZE(x) ((unsigned int)(sizeof(x) / sizeof((x)[0])))
struct onekeyval {
char *name;