aboutsummaryrefslogtreecommitdiffstats
path: root/src/UpdateArchive.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/UpdateArchive.cxx (renamed from src/update_archive.c)35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/update_archive.c b/src/UpdateArchive.cxx
index 3fb2bc18c..72f7aaf19 100644
--- a/src/update_archive.c
+++ b/src/UpdateArchive.cxx
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2012 The Music Player Daemon Project
+ * Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
@@ -18,29 +18,32 @@
*/
#include "config.h" /* must be first for large file support */
-#include "update_archive.h"
-#include "update_internal.h"
-#include "db_lock.h"
-#include "directory.h"
+#include "UpdateArchive.hxx"
+#include "UpdateInternal.hxx"
+#include "DatabaseLock.hxx"
+#include "Directory.hxx"
#include "song.h"
-#include "mapper.h"
+#include "Mapper.hxx"
+
+extern "C" {
#include "archive_list.h"
#include "archive_plugin.h"
+}
#include <glib.h>
#include <string.h>
static void
-update_archive_tree(struct directory *directory, char *name)
+update_archive_tree(Directory *directory, char *name)
{
char *tmp = strchr(name, '/');
if (tmp) {
*tmp = 0;
//add dir is not there already
db_lock();
- struct directory *subdir =
- directory_make_child(directory, name);
+ Directory *subdir =
+ directory->MakeChild(name);
subdir->device = DEVICE_INARCHIVE;
db_unlock();
//create directories first
@@ -53,18 +56,18 @@ update_archive_tree(struct directory *directory, char *name)
//add file
db_lock();
- struct song *song = directory_get_song(directory, name);
+ struct song *song = directory->FindSong(name);
db_unlock();
if (song == NULL) {
song = song_file_load(name, directory);
if (song != NULL) {
db_lock();
- directory_add_song(directory, song);
+ directory->AddSong(song);
db_unlock();
modified = true;
g_message("added %s/%s",
- directory_get_path(directory), name);
+ directory->GetPath(), name);
}
}
}
@@ -79,12 +82,12 @@ update_archive_tree(struct directory *directory, char *name)
* @param plugin the archive plugin which fits this archive type
*/
static void
-update_archive_file2(struct directory *parent, const char *name,
+update_archive_file2(Directory *parent, const char *name,
const struct stat *st,
const struct archive_plugin *plugin)
{
db_lock();
- struct directory *directory = directory_get_child(parent, name);
+ Directory *directory = parent->FindChild(name);
db_unlock();
if (directory != NULL && directory->mtime == st->st_mtime &&
@@ -111,7 +114,7 @@ update_archive_file2(struct directory *parent, const char *name,
if (directory == NULL) {
g_debug("creating archive directory: %s", name);
db_lock();
- directory = directory_new_child(parent, name);
+ directory = parent->CreateChild(name);
/* mark this directory as archive (we use device for
this) */
directory->device = DEVICE_INARCHIVE;
@@ -133,7 +136,7 @@ update_archive_file2(struct directory *parent, const char *name,
}
bool
-update_archive_file(struct directory *directory,
+update_archive_file(Directory *directory,
const char *name, const char *suffix,
const struct stat *st)
{