From ea36855793eaeb87617f30e8b68be57e666d3de2 Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Sun, 5 Apr 2009 18:49:03 +0200 Subject: [PATCH] Fix format specifiers for 64bit integers Use "%" PRIu64 from inttypes.h instead of "%lld" which is incorrect on 64bit platforms. --- src/db-sql.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/db-sql.c b/src/db-sql.c index f1af55fa..8f1738c2 100644 --- a/src/db-sql.c +++ b/src/db-sql.c @@ -36,6 +36,7 @@ #ifdef HAVE_STDINT_H # include #endif +#include #include "daapd.h" #include "err.h" @@ -815,8 +816,8 @@ int db_sql_add(char **pe, MP3FILE *pmp3, int *id) { pmp3->time_played=0; /* sqlite2 doesn't support 64 bit ints */ /* JB: FIXME */ - sprintf(sample_count,"%lld",pmp3->sample_count); - sprintf(file_size,"%lld",pmp3->file_size); + sprintf(sample_count, "%" PRIu64, pmp3->sample_count); + sprintf(file_size, "%" PRIu64, pmp3->file_size); err=db_sql_exec_fn(pe,E_DBG,"INSERT INTO songs VALUES " "(NULL," // id @@ -941,8 +942,8 @@ int db_sql_update(char **pe, MP3FILE *pmp3, int *id) { pmp3->db_timestamp = (int)time(NULL); - sprintf(sample_count,"%lld",pmp3->sample_count); - sprintf(file_size,"%lld",pmp3->file_size); + sprintf(sample_count, "%" PRIu64, pmp3->sample_count); + sprintf(file_size, "%" PRIu64, pmp3->file_size); strcpy(query,"UPDATE songs SET " "title='%q'," // title