From c23cbde6ace6b41473f71f9b241c86fa4c240762 Mon Sep 17 00:00:00 2001 From: chme Date: Wed, 20 Jan 2016 20:42:43 +0100 Subject: [PATCH] fixup - remove unused enum, remove unused local variable, remove duplicate error log for failure in create_virtual_path, remove unnecessary empty lines --- src/filescanner.c | 27 ++++----------------------- src/filescanner_playlist.c | 1 - src/spotify.c | 1 - 3 files changed, 4 insertions(+), 25 deletions(-) diff --git a/src/filescanner.c b/src/filescanner.c index 7d5862e6..ad796dd8 100644 --- a/src/filescanner.c +++ b/src/filescanner.c @@ -121,12 +121,6 @@ struct stacked_dir { struct stacked_dir *next; }; -enum root_directories { - DIR_FILE = 0, - DIR_HTTP = 1, - DIR_SPOTIFY = 2, -}; - static int cmd_pipe[2]; static int exit_pipe[2]; static int scan_exit; @@ -984,7 +978,6 @@ process_directory(char *path, int flags, int parent_id) struct kevent kev; #endif int type; - struct directory_info di; char virtual_path[PATH_MAX]; int dir_id; int ret; @@ -1000,21 +993,15 @@ process_directory(char *path, int flags, int parent_id) } /* Add/update directories table */ - memset(&di, 0, sizeof(struct directory_info)); ret = create_virtual_path(path, virtual_path, sizeof(virtual_path)); if (ret < 0) - { - DPRINTF(E_LOG, L_SCAN, "Virtual path /file:%s, PATH_MAX exceeded\n", path); - - return; - } + return; dir_id = db_directory_addorupdate(virtual_path, 0, parent_id); - if (dir_id <= 0) { - DPRINTF(E_LOG, L_SCAN, "Insert or update of directory failed '/http:'\n"); + DPRINTF(E_LOG, L_SCAN, "Insert or update of directory failed '%s'\n", virtual_path); } /* Check if compilation and/or podcast directory */ @@ -1180,13 +1167,9 @@ process_parent_directories(char *path) ret = create_virtual_path(buf, virtual_path, sizeof(virtual_path)); if (ret < 0) - { - DPRINTF(E_LOG, L_SCAN, "Virtual path /file:%s, PATH_MAX exceeded\n", path); - return 0; - } + return 0; dir_id = db_directory_addorupdate(virtual_path, 0, dir_id); - if (dir_id <= 0) { DPRINTF(E_LOG, L_SCAN, "Insert or update of directory failed '%s'\n", virtual_path); @@ -1651,9 +1634,7 @@ process_inotify_file(struct watch_info *wi, char *path, struct inotify_event *ie dir[(ptr - dir)] = '\0'; ret = create_virtual_path(dir, dir_vpath, sizeof(dir_vpath)); - if (ret < 0) - DPRINTF(E_LOG, L_SCAN, "Error creating virtual path for: %s\n", dir); - else + if (ret >= 0) { dir_id = db_directory_id_byvirtualpath(dir_vpath); if (dir_id > 0) diff --git a/src/filescanner_playlist.c b/src/filescanner_playlist.c index 8a7444ea..ace32381 100644 --- a/src/filescanner_playlist.c +++ b/src/filescanner_playlist.c @@ -240,7 +240,6 @@ scan_playlist(char *file, time_t mtime, int dir_id) DPRINTF(E_INFO, L_SCAN, "Playlist has EXTINF metadata, artist is '%s', title is '%s'\n", mfi.artist, mfi.title); di_id = db_directory_addorupdate("/http:", 0, 1); - if (di_id <= 0) { DPRINTF(E_LOG, L_SCAN, "Insert or update of directory failed '/http:'\n"); diff --git a/src/spotify.c b/src/spotify.c index 1f29d56c..5f98b0ed 100644 --- a/src/spotify.c +++ b/src/spotify.c @@ -783,7 +783,6 @@ spotify_playlist_save(sp_playlist *pl) } dir_id = db_directory_addorupdate("/spotify:", 0, 1); - if (dir_id <= 0) { DPRINTF(E_LOG, L_SCAN, "Insert or update of directory failed '/spotify:'\n");