From 3b7a71527ae1fe906fcf8745363895f24fa34fde Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Mon, 21 Jun 2010 17:50:09 +0200 Subject: [PATCH] Check & fix UTF-8 strings before adding/updating files --- src/filescanner.c | 2 ++ src/filescanner_itunes.c | 1 + src/httpd_dacp.c | 3 +++ 3 files changed, 6 insertions(+) diff --git a/src/filescanner.c b/src/filescanner.c index b5f585c2..759b65a9 100644 --- a/src/filescanner.c +++ b/src/filescanner.c @@ -284,6 +284,8 @@ process_media_file(char *file, time_t mtime, off_t size, int compilation) fixup_tags(&mfi); + unicode_fixup_mfi(&mfi); + if (mfi.id == 0) db_file_add(&mfi); else diff --git a/src/filescanner_itunes.c b/src/filescanner_itunes.c index eb5be22a..3f967ebe 100644 --- a/src/filescanner_itunes.c +++ b/src/filescanner_itunes.c @@ -424,6 +424,7 @@ process_track_file(plist_t trk, char *base) } } + unicode_fixup_mfi(mfi); db_file_update(mfi); free_mfi(mfi, 0); diff --git a/src/httpd_dacp.c b/src/httpd_dacp.c index 91a87232..8b0d53fc 100644 --- a/src/httpd_dacp.c +++ b/src/httpd_dacp.c @@ -667,6 +667,9 @@ dacp_propset_userrating(const char *value, struct evkeyvalq *query) mfi->rating = rating; + /* We're not touching any string field in mfi, so it's safe to + * skip unicode_fixup_mfi() before the update + */ db_file_update(mfi); free_mfi(mfi, 0);