From a654f146d1b39a363cb10853a7670ef099570e54 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 2 Jan 2013 19:22:15 +0100 Subject: [PATCH] update: convert to C++ --- Makefile.am | 38 +++++++++---------- src/{inotify_queue.c => InotifyQueue.cxx} | 10 ++--- src/{inotify_queue.h => InotifyQueue.hxx} | 6 +-- src/{inotify_source.c => InotifySource.cxx} | 15 +++++--- src/{inotify_source.h => InotifySource.hxx} | 6 +-- src/{inotify_update.c => InotifyUpdate.cxx} | 18 +++++---- src/{inotify_update.h => InotifyUpdate.hxx} | 6 +-- src/Main.cxx | 10 ++--- src/OtherCommands.cxx | 2 +- src/PlayerCommands.cxx | 2 +- src/{update_archive.c => UpdateArchive.cxx} | 9 +++-- src/{update_archive.h => UpdateArchive.hxx} | 6 +-- ...update_container.c => UpdateContainer.cxx} | 13 ++++--- ...update_container.h => UpdateContainer.hxx} | 7 ++-- src/{update_db.c => UpdateDatabase.cxx} | 9 +++-- src/{update_db.h => UpdateDatabase.hxx} | 8 ++-- src/{update.c => UpdateGlue.cxx} | 16 ++++---- src/{update.h => UpdateGlue.hxx} | 8 ++-- src/{update_io.c => UpdateIO.cxx} | 7 +++- src/{update_io.h => UpdateIO.hxx} | 7 ++-- src/{update_internal.h => UpdateInternal.hxx} | 0 src/{update_queue.c => UpdateQueue.cxx} | 4 +- src/{update_queue.h => UpdateQueue.hxx} | 8 ++-- src/{update_remove.c => UpdateRemove.cxx} | 10 ++++- src/{update_remove.h => UpdateRemove.hxx} | 6 +-- src/{update_song.c => UpdateSong.cxx} | 17 +++++---- src/{update_song.h => UpdateSong.hxx} | 7 ++-- src/{update_walk.c => UpdateWalk.cxx} | 19 ++++++---- src/{update_walk.h => UpdateWalk.hxx} | 6 +-- test/{run_inotify.c => RunInotify.cxx} | 2 +- 30 files changed, 152 insertions(+), 130 deletions(-) rename src/{inotify_queue.c => InotifyQueue.cxx} (93%) rename src/{inotify_queue.h => InotifyQueue.hxx} (88%) rename src/{inotify_source.c => InotifySource.cxx} (92%) rename src/{inotify_source.h => InotifySource.hxx} (93%) rename src/{inotify_update.c => InotifyUpdate.cxx} (95%) rename src/{inotify_update.h => InotifyUpdate.hxx} (89%) rename src/{update_archive.c => UpdateArchive.cxx} (96%) rename src/{update_archive.h => UpdateArchive.hxx} (91%) rename src/{update_container.c => UpdateContainer.cxx} (94%) rename src/{update_container.h => UpdateContainer.hxx} (87%) rename src/{update_db.c => UpdateDatabase.cxx} (97%) rename src/{update_db.h => UpdateDatabase.hxx} (90%) rename src/{update.c => UpdateGlue.cxx} (95%) rename src/{update.h => UpdateGlue.hxx} (90%) rename src/{update_io.c => UpdateIO.cxx} (98%) rename src/{update_io.h => UpdateIO.hxx} (91%) rename src/{update_internal.h => UpdateInternal.hxx} (100%) rename src/{update_queue.c => UpdateQueue.cxx} (95%) rename src/{update_queue.h => UpdateQueue.hxx} (86%) rename src/{update_remove.c => UpdateRemove.cxx} (97%) rename src/{update_remove.h => UpdateRemove.hxx} (90%) rename src/{update_song.c => UpdateSong.cxx} (93%) rename src/{update_song.h => UpdateSong.hxx} (87%) rename src/{update_walk.c => UpdateWalk.cxx} (98%) rename src/{update_walk.h => UpdateWalk.hxx} (89%) rename test/{run_inotify.c => RunInotify.cxx} (98%) diff --git a/Makefile.am b/Makefile.am index 4f6b82388..5bfabe752 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 = \ diff --git a/src/inotify_queue.c b/src/InotifyQueue.cxx similarity index 93% rename from src/inotify_queue.c rename to src/InotifyQueue.cxx index d5e2228c3..572e53fc3 100644 --- a/src/inotify_queue.c +++ b/src/InotifyQueue.cxx @@ -1,5 +1,5 @@ /* - * 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 @@ -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 */ diff --git a/src/inotify_queue.h b/src/InotifyQueue.hxx similarity index 88% rename from src/inotify_queue.h rename to src/InotifyQueue.hxx index cfc28ebfe..0c4863ab5 100644 --- a/src/inotify_queue.h +++ b/src/InotifyQueue.hxx @@ -1,5 +1,5 @@ /* - * 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); diff --git a/src/inotify_source.c b/src/InotifySource.cxx similarity index 92% rename from src/inotify_source.c rename to src/InotifySource.cxx index 2fbfdff7e..689468102 100644 --- a/src/inotify_source.c +++ b/src/InotifySource.cxx @@ -1,5 +1,5 @@ /* - * 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; diff --git a/src/inotify_source.h b/src/InotifySource.hxx similarity index 93% rename from src/inotify_source.h rename to src/InotifySource.hxx index 7aec18b3d..cde2bc269 100644 --- a/src/inotify_source.h +++ b/src/InotifySource.hxx @@ -1,5 +1,5 @@ /* - * 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" diff --git a/src/inotify_update.c b/src/InotifyUpdate.cxx similarity index 95% rename from src/inotify_update.c rename to src/InotifyUpdate.cxx index 3f4a8c0c4..e9350591b 100644 --- a/src/inotify_update.c +++ b/src/InotifyUpdate.cxx @@ -1,5 +1,5 @@ /* - * 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 #include @@ -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); diff --git a/src/inotify_update.h b/src/InotifyUpdate.hxx similarity index 89% rename from src/inotify_update.h rename to src/InotifyUpdate.hxx index ca75c0f45..ceb421553 100644 --- a/src/inotify_update.h +++ b/src/InotifyUpdate.hxx @@ -1,5 +1,5 @@ /* - * 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" diff --git a/src/Main.cxx b/src/Main.cxx index 057551391..44042d8ca 100644 --- a/src/Main.cxx +++ b/src/Main.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 @@ -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 diff --git a/src/OtherCommands.cxx b/src/OtherCommands.cxx index a703a2ffe..8518f437f 100644 --- a/src/OtherCommands.cxx +++ b/src/OtherCommands.cxx @@ -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" diff --git a/src/PlayerCommands.cxx b/src/PlayerCommands.cxx index 015ac9a15..3aa3f7e63 100644 --- a/src/PlayerCommands.cxx +++ b/src/PlayerCommands.cxx @@ -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" diff --git a/src/update_archive.c b/src/UpdateArchive.cxx similarity index 96% rename from src/update_archive.c rename to src/UpdateArchive.cxx index 3fb2bc18c..c57534ea4 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,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 diff --git a/src/update_archive.h b/src/UpdateArchive.hxx similarity index 91% rename from src/update_archive.h rename to src/UpdateArchive.hxx index a9139b0e0..533f8ffd0 100644 --- a/src/update_archive.h +++ b/src/UpdateArchive.hxx @@ -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 @@ -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" diff --git a/src/update_container.c b/src/UpdateContainer.cxx similarity index 94% rename from src/update_container.c rename to src/UpdateContainer.cxx index bda95dabe..68f8c3b98 100644 --- a/src/update_container.c +++ b/src/UpdateContainer.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,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 diff --git a/src/update_container.h b/src/UpdateContainer.hxx similarity index 87% rename from src/update_container.h rename to src/UpdateContainer.hxx index 7f42c80ca..81f081a59 100644 --- a/src/update_container.h +++ b/src/UpdateContainer.hxx @@ -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 @@ -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 #include struct directory; diff --git a/src/update_db.c b/src/UpdateDatabase.cxx similarity index 97% rename from src/update_db.c rename to src/UpdateDatabase.cxx index 8982a53e2..fa3408d66 100644 --- a/src/update_db.c +++ b/src/UpdateDatabase.cxx @@ -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 #include diff --git a/src/update_db.h b/src/UpdateDatabase.hxx similarity index 90% rename from src/update_db.h rename to src/UpdateDatabase.hxx index 0a9e46b05..511f75690 100644 --- a/src/update_db.h +++ b/src/UpdateDatabase.hxx @@ -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 @@ -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 - struct directory; struct song; diff --git a/src/update.c b/src/UpdateGlue.cxx similarity index 95% rename from src/update.c rename to src/UpdateGlue.cxx index e47db8f09..203f16b76 100644 --- a/src/update.c +++ b/src/UpdateGlue.cxx @@ -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); diff --git a/src/update.h b/src/UpdateGlue.hxx similarity index 90% rename from src/update.h rename to src/UpdateGlue.hxx index 3d586b694..9d546a2a3 100644 --- a/src/update.h +++ b/src/UpdateGlue.hxx @@ -1,5 +1,5 @@ /* - * 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 +#ifndef MPD_UPDATE_GLUE_HXX +#define MPD_UPDATE_GLUE_HXX void update_global_init(void); diff --git a/src/update_io.c b/src/UpdateIO.cxx similarity index 98% rename from src/update_io.c rename to src/UpdateIO.cxx index c6a540a0f..fefbc4d11 100644 --- a/src/update_io.c +++ b/src/UpdateIO.cxx @@ -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 #include diff --git a/src/update_io.h b/src/UpdateIO.hxx similarity index 91% rename from src/update_io.h rename to src/UpdateIO.hxx index 6ff1ccebd..7b6175fdf 100644 --- a/src/update_io.h +++ b/src/UpdateIO.hxx @@ -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 @@ -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 #include struct directory; diff --git a/src/update_internal.h b/src/UpdateInternal.hxx similarity index 100% rename from src/update_internal.h rename to src/UpdateInternal.hxx diff --git a/src/update_queue.c b/src/UpdateQueue.cxx similarity index 95% rename from src/update_queue.c rename to src/UpdateQueue.cxx index 2150fa4e4..85eb22358 100644 --- a/src/update_queue.c +++ b/src/UpdateQueue.cxx @@ -1,5 +1,5 @@ /* - * 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 diff --git a/src/update_queue.h b/src/UpdateQueue.hxx similarity index 86% rename from src/update_queue.h rename to src/UpdateQueue.hxx index 84ba474b0..7de06964f 100644 --- a/src/update_queue.h +++ b/src/UpdateQueue.hxx @@ -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 @@ -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 - unsigned update_queue_push(const char *path, bool discard, unsigned base); diff --git a/src/update_remove.c b/src/UpdateRemove.cxx similarity index 97% rename from src/update_remove.c rename to src/UpdateRemove.cxx index c2e353c63..71852ea96 100644 --- a/src/update_remove.c +++ b/src/UpdateRemove.cxx @@ -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 diff --git a/src/update_remove.h b/src/UpdateRemove.hxx similarity index 90% rename from src/update_remove.h rename to src/UpdateRemove.hxx index 479ef83ff..dc15622fc 100644 --- a/src/update_remove.h +++ b/src/UpdateRemove.hxx @@ -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 @@ -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" diff --git a/src/update_song.c b/src/UpdateSong.cxx similarity index 93% rename from src/update_song.c rename to src/UpdateSong.cxx index 1126ad115..8241d46f2 100644 --- a/src/update_song.c +++ b/src/UpdateSong.cxx @@ -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 #include @@ -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; diff --git a/src/update_song.h b/src/UpdateSong.hxx similarity index 87% rename from src/update_song.h rename to src/UpdateSong.hxx index cff63f576..abf25aae9 100644 --- a/src/update_song.h +++ b/src/UpdateSong.hxx @@ -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 @@ -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 #include struct directory; diff --git a/src/update_walk.c b/src/UpdateWalk.cxx similarity index 98% rename from src/update_walk.c rename to src/UpdateWalk.cxx index 8554e8f3c..a8ca1e4ed 100644 --- a/src/update_walk.c +++ b/src/UpdateWalk.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,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 diff --git a/src/update_walk.h b/src/UpdateWalk.hxx similarity index 89% rename from src/update_walk.h rename to src/UpdateWalk.hxx index ab1e41fb9..7fa3083fc 100644 --- a/src/update_walk.h +++ b/src/UpdateWalk.hxx @@ -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 @@ -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" diff --git a/test/run_inotify.c b/test/RunInotify.cxx similarity index 98% rename from test/run_inotify.c rename to test/RunInotify.cxx index 4ceb60229..491cddb78 100644 --- a/test/run_inotify.c +++ b/test/RunInotify.cxx @@ -18,7 +18,7 @@ */ #include "config.h" -#include "inotify_source.h" +#include "InotifySource.hxx" #include