Commit a654f146 authored by Max Kellermann's avatar Max Kellermann

update: convert to C++

parent 67b46a15
......@@ -91,10 +91,6 @@ mpd_headers = \
src/fd_util.h \
src/gerror.h \
src/glib_compat.h \
src/update.h \
src/inotify_source.h \
src/inotify_queue.h \
src/inotify_update.h \
src/gcc.h \
src/decoder_list.h \
src/decoder_print.h \
......@@ -263,15 +259,15 @@ src_mpd_SOURCES = \
src/filter_config.c \
src/filter_plugin.c \
src/filter_registry.c \
src/update.c \
src/update_queue.c src/update_queue.h \
src/update_io.c src/update_io.h \
src/update_db.c src/update_db.h \
src/update_walk.c src/update_walk.h \
src/update_song.c src/update_song.h \
src/update_container.c src/update_container.h \
src/update_internal.h \
src/update_remove.c src/update_remove.h \
src/UpdateGlue.cxx src/UpdateGlue.hxx \
src/UpdateQueue.cxx src/UpdateQueue.hxx \
src/UpdateIO.cxx src/UpdateIO.hxx \
src/UpdateDatabase.cxx src/UpdateDatabase.hxx \
src/UpdateWalk.cxx src/UpdateWalk.hxx \
src/UpdateSong.cxx src/UpdateSong.hxx \
src/UpdateContainer.cxx src/UpdateContainer.hxx \
src/UpdateInternal.hxx \
src/UpdateRemove.cxx src/UpdateRemove.hxx \
src/client.c \
src/client_event.c \
src/client_expire.c \
......@@ -374,9 +370,9 @@ endif
if ENABLE_INOTIFY
src_mpd_SOURCES += \
src/inotify_source.c \
src/inotify_queue.c \
src/inotify_update.c
src/InotifySource.cxx src/InotifySource.hxx \
src/InotifyQueue.cxx src/InotifyQueue.hxx \
src/InotifyUpdate.cxx src/InotifyUpdate.hxx
endif
if ENABLE_SQLITE
......@@ -449,7 +445,7 @@ if ENABLE_ARCHIVE
noinst_LIBRARIES += libarchive.a
src_mpd_SOURCES += \
src/update_archive.c src/update_archive.h
src/UpdateArchive.cxx src/UpdateArchive.hxx
libarchive_a_SOURCES = \
src/archive_api.c \
......@@ -1351,12 +1347,12 @@ TESTS += test/test_archive_iso9660.sh
endif
if ENABLE_INOTIFY
noinst_PROGRAMS += test/run_inotify
test_run_inotify_SOURCES = test/run_inotify.c \
noinst_PROGRAMS += test/RunInotify
test_RunInotify_SOURCES = test/RunInotify.c \
src/fd_util.c \
src/fifo_buffer.c \
src/inotify_source.c
test_run_inotify_LDADD = $(GLIB_LIBS)
src/InotifySource.cxx
test_RunInotify_LDADD = $(GLIB_LIBS)
endif
test_test_byte_reverse_SOURCES = \
......
/*
* Copyright (C) 2003-2011 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,8 +18,8 @@
*/
#include "config.h"
#include "inotify_queue.h"
#include "update.h"
#include "InotifyQueue.hxx"
#include "UpdateGlue.hxx"
#include <glib.h>
......@@ -67,7 +67,7 @@ mpd_inotify_run_update(G_GNUC_UNUSED gpointer data)
unsigned id;
while (inotify_queue != NULL) {
char *uri_utf8 = inotify_queue->data;
char *uri_utf8 = (char *)inotify_queue->data;
id = update_enqueue(uri_utf8, false);
if (id == 0)
......@@ -108,7 +108,7 @@ mpd_inotify_enqueue(char *uri_utf8)
inotify_queue = NULL;
while (old_queue != NULL) {
char *current_uri = old_queue->data;
char *current_uri = (char *)old_queue->data;
if (path_in(uri_utf8, current_uri)) {
/* already enqueued */
......
/*
* Copyright (C) 2003-2011 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
......@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_INOTIFY_QUEUE_H
#define MPD_INOTIFY_QUEUE_H
#ifndef MPD_INOTIFY_QUEUE_HXX
#define MPD_INOTIFY_QUEUE_HXX
void
mpd_inotify_queue_init(void);
......
/*
* Copyright (C) 2003-2011 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,8 +18,12 @@
*/
#include "config.h"
#include "inotify_source.h"
#include "InotifySource.hxx"
extern "C" {
#include "fifo_buffer.h"
}
#include "fd_util.h"
#include "mpd_error.h"
......@@ -63,11 +67,10 @@ mpd_inotify_in_event(G_GNUC_UNUSED GIOChannel *_source,
G_GNUC_UNUSED GIOCondition condition,
gpointer data)
{
struct mpd_inotify_source *source = data;
struct mpd_inotify_source *source = (struct mpd_inotify_source *)data;
void *dest;
size_t length;
ssize_t nbytes;
const struct inotify_event *event;
dest = fifo_buffer_write(source->buffer, &length);
if (dest == NULL)
......@@ -85,7 +88,9 @@ mpd_inotify_in_event(G_GNUC_UNUSED GIOChannel *_source,
while (true) {
const char *name;
event = fifo_buffer_read(source->buffer, &length);
const struct inotify_event *event =
(const struct inotify_event *)
fifo_buffer_read(source->buffer, &length);
if (event == NULL || length < sizeof(*event) ||
length < sizeof(*event) + event->len)
break;
......
/*
* Copyright (C) 2003-2011 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
......@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_INOTIFY_SOURCE_H
#define MPD_INOTIFY_SOURCE_H
#ifndef MPD_INOTIFY_SOURCE_HXX
#define MPD_INOTIFY_SOURCE_HXX
#include "gerror.h"
......
/*
* Copyright (C) 2003-2011 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,12 +18,15 @@
*/
#include "config.h" /* must be first for large file support */
#include "inotify_update.h"
#include "inotify_source.h"
#include "inotify_queue.h"
#include "InotifyUpdate.hxx"
#include "InotifySource.hxx"
#include "InotifyQueue.hxx"
#include "database.h"
extern "C" {
#include "mapper.h"
#include "path.h"
}
#include <assert.h>
#include <sys/inotify.h>
......@@ -90,7 +93,8 @@ tree_remove_watch_directory(struct watch_directory *directory)
static struct watch_directory *
tree_find_watch_directory(int wd)
{
return g_tree_lookup(inotify_directories, GINT_TO_POINTER(wd));
return (struct watch_directory *)
g_tree_lookup(inotify_directories, GINT_TO_POINTER(wd));
}
static void
......@@ -109,7 +113,7 @@ remove_watch_directory(struct watch_directory *directory)
tree_remove_watch_directory(directory);
while (directory->children != NULL)
remove_watch_directory(directory->children->data);
remove_watch_directory((struct watch_directory *)directory->children->data);
directory->parent->children =
g_list_remove(directory->parent->children, directory);
......@@ -349,7 +353,7 @@ static gboolean
free_watch_directory(G_GNUC_UNUSED gpointer key, gpointer value,
G_GNUC_UNUSED gpointer data)
{
struct watch_directory *directory = value;
struct watch_directory *directory = (struct watch_directory *)value;
g_free(directory->name);
g_list_free(directory->children);
......
/*
* Copyright (C) 2003-2011 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
......@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_INOTIFY_UPDATE_H
#define MPD_INOTIFY_UPDATE_H
#ifndef MPD_INOTIFY_UPDATE_HXX
#define MPD_INOTIFY_UPDATE_HXX
#include "check.h"
......
/*
* 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
......@@ -20,6 +20,7 @@
#include "config.h"
#include "Main.hxx"
#include "PlaylistFile.hxx"
#include "UpdateGlue.hxx"
#include "chunk.h"
extern "C" {
......@@ -31,7 +32,6 @@ extern "C" {
#include "AllCommands.h"
#include "playlist.h"
#include "database.h"
#include "update.h"
#include "player_thread.h"
#include "listen.h"
#include "cmdline.h"
......@@ -59,12 +59,12 @@ extern "C" {
#include "mpd_error.h"
extern "C" {
#ifdef ENABLE_INOTIFY
#include "inotify_update.h"
#include "InotifyUpdate.hxx"
#endif
extern "C" {
#ifdef ENABLE_SQLITE
#include "sticker.h"
#endif
......
......@@ -21,6 +21,7 @@
#include "OtherCommands.hxx"
#include "DatabaseCommands.hxx"
#include "CommandError.hxx"
#include "UpdateGlue.hxx"
#include "directory.h"
#include "song.h"
......@@ -31,7 +32,6 @@ extern "C" {
#include "ls.h"
#include "uri.h"
#include "decoder_print.h"
#include "update.h"
#include "volume.h"
#include "stats.h"
#include "permission.h"
......
......@@ -21,13 +21,13 @@
#include "PlayerCommands.hxx"
#include "CommandError.hxx"
#include "PlaylistPrint.hxx"
#include "UpdateGlue.hxx"
extern "C" {
#include "protocol/argparser.h"
#include "protocol/result.h"
#include "player_control.h"
#include "playlist.h"
#include "update.h"
#include "volume.h"
#include "client.h"
#include "client_internal.h"
......
/*
* 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,14 +18,17 @@
*/
#include "config.h" /* must be first for large file support */
#include "update_archive.h"
#include "update_internal.h"
#include "UpdateArchive.hxx"
#include "UpdateInternal.hxx"
#include "db_lock.h"
#include "directory.h"
#include "song.h"
extern "C" {
#include "mapper.h"
#include "archive_list.h"
#include "archive_plugin.h"
}
#include <glib.h>
......
/*
* 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
......@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_UPDATE_ARCHIVE_H
#define MPD_UPDATE_ARCHIVE_H
#ifndef MPD_UPDATE_ARCHIVE_HXX
#define MPD_UPDATE_ARCHIVE_HXX
#include "check.h"
#include "gcc.h"
......
/*
* 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,16 +18,19 @@
*/
#include "config.h" /* must be first for large file support */
#include "update_container.h"
#include "update_internal.h"
#include "update_db.h"
#include "UpdateContainer.hxx"
#include "UpdateInternal.hxx"
#include "UpdateDatabase.hxx"
#include "db_lock.h"
#include "directory.h"
#include "song.h"
#include "mapper.h"
#include "decoder_plugin.h"
extern "C" {
#include "mapper.h"
#include "tag.h"
#include "tag_handler.h"
}
#include <glib.h>
......
/*
* 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
......@@ -17,12 +17,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_UPDATE_CONTAINER_H
#define MPD_UPDATE_CONTAINER_H
#ifndef MPD_UPDATE_CONTAINER_HXX
#define MPD_UPDATE_CONTAINER_HXX
#include "check.h"
#include <stdbool.h>
#include <sys/stat.h>
struct directory;
......
......@@ -18,13 +18,16 @@
*/
#include "config.h" /* must be first for large file support */
#include "update_db.h"
#include "update_remove.h"
#include "UpdateDatabase.hxx"
#include "UpdateRemove.hxx"
#include "directory.h"
#include "song.h"
#include "playlist_vector.h"
#include "db_lock.h"
extern "C" {
#include "playlist_vector.h"
}
#include <glib.h>
#include <assert.h>
......
/*
* 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
......@@ -17,13 +17,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_UPDATE_DB_H
#define MPD_UPDATE_DB_H
#ifndef MPD_UPDATE_DATABASE_HXX
#define MPD_UPDATE_DATABASE_HXX
#include "check.h"
#include <stdbool.h>
struct directory;
struct song;
......
......@@ -18,18 +18,20 @@
*/
#include "config.h"
#include "update.h"
#include "update_queue.h"
#include "update_walk.h"
#include "update_remove.h"
#include "update.h"
#include "UpdateGlue.hxx"
#include "UpdateQueue.hxx"
#include "UpdateWalk.hxx"
#include "UpdateRemove.hxx"
extern "C" {
#include "database.h"
#include "mapper.h"
#include "playlist.h"
#include "event_pipe.h"
#include "update.h"
#include "idle.h"
#include "stats.h"
}
#include "Main.hxx"
#include "mpd_error.h"
......@@ -65,7 +67,7 @@ isUpdatingDB(void)
static void * update_task(void *_path)
{
const char *path = _path;
const char *path = (const char *)_path;
if (path != NULL && *path != 0)
g_debug("starting: %s", path);
......
/*
* Copyright (C) 2003-2011 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
......@@ -17,10 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_UPDATE_H
#define MPD_UPDATE_H
#include <stdbool.h>
#ifndef MPD_UPDATE_GLUE_HXX
#define MPD_UPDATE_GLUE_HXX
void update_global_init(void);
......
......@@ -18,11 +18,14 @@
*/
#include "config.h" /* must be first for large file support */
#include "update_io.h"
#include "mapper.h"
#include "UpdateIO.hxx"
#include "directory.h"
#include "glib_compat.h"
extern "C" {
#include "mapper.h"
}
#include <glib.h>
#include <errno.h>
......
/*
* 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
......@@ -17,12 +17,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_UPDATE_IO_H
#define MPD_UPDATE_IO_H
#ifndef MPD_UPDATE_IO_HXX
#define MPD_UPDATE_IO_HXX
#include "check.h"
#include <stdbool.h>
#include <sys/stat.h>
struct directory;
......
/*
* Copyright (C) 2003-2011 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,7 +18,7 @@
*/
#include "config.h"
#include "update_queue.h"
#include "UpdateQueue.hxx"
#include <glib.h>
......
/*
* 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
......@@ -17,13 +17,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_UPDATE_QUEUE_H
#define MPD_UPDATE_QUEUE_H
#ifndef MPD_UPDATE_QUEUE_HXX
#define MPD_UPDATE_QUEUE_HXX
#include "check.h"
#include <stdbool.h>
unsigned
update_queue_push(const char *path, bool discard, unsigned base);
......
......@@ -18,15 +18,21 @@
*/
#include "config.h" /* must be first for large file support */
#include "update_remove.h"
#include "UpdateRemove.hxx"
extern "C" {
#include "event_pipe.h"
#include "song.h"
#include "playlist.h"
}
#include "song.h"
#include "Main.hxx"
#ifdef ENABLE_SQLITE
extern "C" {
#include "sticker.h"
#include "song_sticker.h"
}
#endif
#include <glib.h>
......
/*
* 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
......@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_UPDATE_REMOVE_H
#define MPD_UPDATE_REMOVE_H
#ifndef MPD_UPDATE_REMOVE_HXX
#define MPD_UPDATE_REMOVE_HXX
#include "check.h"
......
......@@ -18,17 +18,20 @@
*/
#include "config.h" /* must be first for large file support */
#include "update_song.h"
#include "update_internal.h"
#include "update_io.h"
#include "update_db.h"
#include "update_container.h"
#include "UpdateSong.hxx"
#include "UpdateInternal.hxx"
#include "UpdateIO.hxx"
#include "UpdateDatabase.hxx"
#include "UpdateContainer.hxx"
#include "db_lock.h"
#include "directory.h"
#include "song.h"
#include "decoder_list.h"
#include "decoder_plugin.h"
extern "C" {
#include "decoder_list.h"
}
#include <glib.h>
#include <unistd.h>
......@@ -104,7 +107,7 @@ update_song_file(struct directory *directory,
const struct stat *st)
{
const struct decoder_plugin *plugin =
decoder_plugin_from_suffix(suffix, false);
decoder_plugin_from_suffix(suffix, nullptr);
if (plugin == NULL)
return false;
......
/*
* 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
......@@ -17,12 +17,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_UPDATE_SONG_H
#define MPD_UPDATE_SONG_H
#ifndef MPD_UPDATE_SONG_HXX
#define MPD_UPDATE_SONG_HXX
#include "check.h"
#include <stdbool.h>
#include <sys/stat.h>
struct directory;
......
/*
* 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,22 +18,25 @@
*/
#include "config.h" /* must be first for large file support */
#include "update_walk.h"
#include "update_io.h"
#include "update_db.h"
#include "update_song.h"
#include "update_archive.h"
#include "database.h"
#include "UpdateWalk.hxx"
#include "UpdateIO.hxx"
#include "UpdateDatabase.hxx"
#include "UpdateSong.hxx"
#include "UpdateArchive.hxx"
#include "db_lock.h"
#include "exclude.h"
#include "directory.h"
#include "song.h"
extern "C" {
#include "exclude.h"
#include "database.h"
#include "playlist_vector.h"
#include "uri.h"
#include "mapper.h"
#include "path.h"
#include "playlist_list.h"
#include "conf.h"
}
#include <glib.h>
......
/*
* 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
......@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_UPDATE_WALK_H
#define MPD_UPDATE_WALK_H
#ifndef MPD_UPDATE_WALK_HXX
#define MPD_UPDATE_WALK_HXX
#include "check.h"
......
......@@ -18,7 +18,7 @@
*/
#include "config.h"
#include "inotify_source.h"
#include "InotifySource.hxx"
#include <glib.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment