Add printf attribute to log_err/DPRINTF and fix a few warnings
Modified to not use %z for portability reasons.
This commit is contained in:
parent
45cf9208fb
commit
3a57744735
@ -236,7 +236,8 @@ check_embedded_art(const char *path, const char *image_data, int image_size)
|
||||
fclose(dstfile);
|
||||
if( nwritten != image_size )
|
||||
{
|
||||
DPRINTF(E_WARN, L_METADATA, "Embedded art error: wrote %d/%d bytes\n", nwritten, image_size);
|
||||
DPRINTF(E_WARN, L_METADATA, "Embedded art error: wrote %lu/%d bytes\n",
|
||||
(unsigned long)nwritten, image_size);
|
||||
remove(art_path);
|
||||
free(art_path);
|
||||
art_path = NULL;
|
||||
|
@ -360,7 +360,7 @@ inotify_insert_file(char * name, const char * path)
|
||||
ts = sql_get_int_field(db, "SELECT TIMESTAMP from DETAILS where PATH = '%q'", path);
|
||||
if( !ts && is_playlist(path) && (sql_get_int_field(db, "SELECT ID from PLAYLISTS where PATH = '%q'", path) > 0) )
|
||||
{
|
||||
DPRINTF(E_DEBUG, L_INOTIFY, "Re-reading modified playlist.\n", path);
|
||||
DPRINTF(E_DEBUG, L_INOTIFY, "Re-reading modified playlist (%s).\n", path);
|
||||
inotify_remove_file(path);
|
||||
next_pl_fill = 1;
|
||||
}
|
||||
|
3
log.h
3
log.h
@ -46,7 +46,8 @@ enum _log_facility
|
||||
extern int log_level[L_MAX];
|
||||
extern int log_init(const char *fname, const char *debug);
|
||||
extern void log_close(void);
|
||||
extern void log_err(int level, enum _log_facility facility, char *fname, int lineno, char *fmt, ...);
|
||||
extern void log_err(int level, enum _log_facility facility, char *fname, int lineno, char *fmt, ...)
|
||||
__attribute__((__format__ (__printf__, 5, 6)));
|
||||
|
||||
#define DPRINTF(level, facility, fmt, arg...) do { log_err(level, facility, __FILE__, __LINE__, fmt, ##arg); } while (0)
|
||||
|
||||
|
11
minidlna.c
11
minidlna.c
@ -357,7 +357,8 @@ rescan:
|
||||
else if (ret == 2)
|
||||
DPRINTF(E_WARN, L_GENERAL, "Removed media_dir detected; rescanning...\n");
|
||||
else
|
||||
DPRINTF(E_WARN, L_GENERAL, "Database version mismatch; need to recreate...\n");
|
||||
DPRINTF(E_WARN, L_GENERAL, "Database version mismatch (%d=>%d); need to recreate...\n",
|
||||
ret, DB_VERSION);
|
||||
sqlite3_close(db);
|
||||
|
||||
snprintf(cmd, sizeof(cmd), "rm -rf %s/files.db %s/art_cache", db_path, db_path);
|
||||
@ -424,7 +425,7 @@ writepidfile(const char *fname, int pid, uid_t uid)
|
||||
if (uid > 0)
|
||||
{
|
||||
if (chown(dir, uid, -1) != 0)
|
||||
DPRINTF(E_WARN, L_GENERAL, "Unable to change pidfile ownership: %s\n",
|
||||
DPRINTF(E_WARN, L_GENERAL, "Unable to change pidfile %s ownership: %s\n",
|
||||
dir, strerror(errno));
|
||||
}
|
||||
}
|
||||
@ -440,14 +441,14 @@ writepidfile(const char *fname, int pid, uid_t uid)
|
||||
if (fprintf(pidfile, "%d\n", pid) <= 0)
|
||||
{
|
||||
DPRINTF(E_ERROR, L_GENERAL,
|
||||
"Unable to write to pidfile %s: %s\n", fname);
|
||||
"Unable to write to pidfile %s: %s\n", fname, strerror(errno));
|
||||
ret = -1;
|
||||
}
|
||||
if (uid > 0)
|
||||
{
|
||||
if (fchown(fileno(pidfile), uid, -1) != 0)
|
||||
DPRINTF(E_WARN, L_GENERAL, "Unable to change pidfile ownership: %s\n",
|
||||
pidfile, strerror(errno));
|
||||
DPRINTF(E_WARN, L_GENERAL, "Unable to change pidfile %s ownership: %s\n",
|
||||
fname, strerror(errno));
|
||||
}
|
||||
|
||||
fclose(pidfile);
|
||||
|
@ -861,7 +861,7 @@ start_scanner()
|
||||
fill_playlists();
|
||||
}
|
||||
|
||||
DPRINTF(E_DEBUG, L_SCANNER, "Initial file scan completed\n", DB_VERSION);
|
||||
DPRINTF(E_DEBUG, L_SCANNER, "Initial file scan completed\n");
|
||||
//JM: Set up a db version number, so we know if we need to rebuild due to a new structure.
|
||||
sql_exec(db, "pragma user_version = %d;", DB_VERSION);
|
||||
}
|
||||
|
2
sql.c
2
sql.c
@ -214,7 +214,7 @@ db_upgrade(sqlite3 *db)
|
||||
if (db_vers < 1)
|
||||
return -1;
|
||||
if (db_vers < 9)
|
||||
return 9;
|
||||
return db_vers;
|
||||
sql_exec(db, "PRAGMA user_version = %d", DB_VERSION);
|
||||
|
||||
return 0;
|
||||
|
@ -567,7 +567,8 @@ _get_asffileinfo(char *file, struct song_metadata *psong)
|
||||
|
||||
if(pos + tmp.Size > hdr.Size)
|
||||
{
|
||||
DPRINTF(E_ERROR, L_SCANNER, "Size overrun reading header object %I64x\n", tmp.Size);
|
||||
DPRINTF(E_ERROR, L_SCANNER, "Size overrun reading header object %llu\n",
|
||||
(unsigned long long)tmp.Size);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,12 @@ vc_scan(struct song_metadata *psong, const char *comment, const size_t length)
|
||||
{
|
||||
if( strncasecmp(comment, "LYRICS=", 7) != 0 )
|
||||
{
|
||||
DPRINTF(E_WARN, L_SCANNER, "Vorbis %.*s too long [%s]\n", (index(comment, '=')-comment), comment, psong->path);
|
||||
const char *eq = strchr(comment, '=');
|
||||
int len = 8;
|
||||
if (eq)
|
||||
len = eq - comment;
|
||||
DPRINTF(E_WARN, L_SCANNER, "Vorbis %.*s too long [%s]\n",
|
||||
len, comment, psong->path);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -179,9 +179,6 @@ _ogg_vorbis_process(ogg_stream_processor *stream, ogg_page *page,
|
||||
ogg_int64_t gp = ogg_page_granulepos(page);
|
||||
if(gp > 0)
|
||||
{
|
||||
if(gp < inf->lastgranulepos)
|
||||
DPRINTF(E_WARN, L_SCANNER, "granulepos in stream %d decreases from %lld to %lld",
|
||||
stream->num, inf->lastgranulepos, gp);
|
||||
inf->lastgranulepos = gp;
|
||||
}
|
||||
else
|
||||
@ -402,7 +399,8 @@ _ogg_get_next_page(FILE *f, ogg_sync_state *sync, ogg_page *page,
|
||||
while((ret = ogg_sync_pageout(sync, page)) <= 0)
|
||||
{
|
||||
if(ret < 0)
|
||||
DPRINTF(E_WARN, L_SCANNER, "Hole in data found at approximate offset %lld bytes. Corrupted ogg.\n", *written);
|
||||
DPRINTF(E_WARN, L_SCANNER, "Hole in data found at approximate offset %lld bytes. Corrupted ogg.\n",
|
||||
(long long)*written);
|
||||
|
||||
buffer = ogg_sync_buffer(sync, 4500); // chunk=4500
|
||||
bytes = fread(buffer, 1, 4500, f);
|
||||
|
@ -244,7 +244,8 @@ ParseHttpHeaders(struct upnphttp * h)
|
||||
h->req_RangeStart = strtoll(p+6, &colon, 10);
|
||||
h->req_RangeEnd = colon ? atoll(colon+1) : 0;
|
||||
DPRINTF(E_DEBUG, L_HTTP, "Range Start-End: %lld - %lld\n",
|
||||
h->req_RangeStart, h->req_RangeEnd?h->req_RangeEnd:-1);
|
||||
(long long)h->req_RangeStart,
|
||||
h->req_RangeEnd ? (long long)h->req_RangeEnd : -1);
|
||||
}
|
||||
}
|
||||
else if(strncasecmp(line, "Host", 4)==0)
|
||||
@ -1048,7 +1049,7 @@ Process_upnphttp(struct upnphttp * h)
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t new_req_buflen;
|
||||
int new_req_buflen;
|
||||
const char * endheaders;
|
||||
/* if 1st arg of realloc() is null,
|
||||
* realloc behaves the same as malloc() */
|
||||
@ -1823,7 +1824,7 @@ SendResp_dlnafile(struct upnphttp *h, char *object)
|
||||
ret = sql_get_table(db, buf, &result, &rows, NULL);
|
||||
if( (ret != SQLITE_OK) )
|
||||
{
|
||||
DPRINTF(E_ERROR, L_HTTP, "Didn't find valid file for %lld!\n", id);
|
||||
DPRINTF(E_ERROR, L_HTTP, "Didn't find valid file for %lld!\n", (long long)id);
|
||||
Send500(h);
|
||||
return;
|
||||
}
|
||||
@ -1876,7 +1877,7 @@ SendResp_dlnafile(struct upnphttp *h, char *object)
|
||||
}
|
||||
#endif
|
||||
|
||||
DPRINTF(E_INFO, L_HTTP, "Serving DetailID: %lld [%s]\n", id, last_file.path);
|
||||
DPRINTF(E_INFO, L_HTTP, "Serving DetailID: %lld [%s]\n", (long long)id, last_file.path);
|
||||
|
||||
if( h->reqflags & FLAG_XFERSTREAMING )
|
||||
{
|
||||
|
@ -710,8 +710,8 @@ callback(void *args, int argc, char **argv, char **azColName)
|
||||
if( str->data )
|
||||
{
|
||||
str->size += DEFAULT_RESP_SIZE;
|
||||
DPRINTF(E_DEBUG, L_HTTP, "UPnP SOAP response enlarged to %d. [%d results so far]\n",
|
||||
str->size, passed_args->returned);
|
||||
DPRINTF(E_DEBUG, L_HTTP, "UPnP SOAP response enlarged to %lu. [%d results so far]\n",
|
||||
(unsigned long)str->size, passed_args->returned);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user