diff options
author | Max Kellermann <max@duempel.org> | 2013-07-29 07:32:36 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-07-29 07:39:58 +0200 |
commit | cde6a3a00c15f90062c8d4f46df07312cbcfa718 (patch) | |
tree | 38f61a1990f5993b326563238a8eec6edfbff6e8 /src | |
parent | 96b763067e82d4b3a1b08b3a3c0ccca2114c35f3 (diff) |
tag_handler: convert to C++
Diffstat (limited to 'src')
30 files changed, 52 insertions, 57 deletions
diff --git a/src/ApeTag.cxx b/src/ApeTag.cxx index 1195ffe5f..7713310c1 100644 --- a/src/ApeTag.cxx +++ b/src/ApeTag.cxx @@ -22,7 +22,7 @@ #include "ApeLoader.hxx" #include "tag.h" #include "tag_table.h" -#include "tag_handler.h" +#include "TagHandler.hxx" const struct tag_table ape_tags[] = { { "album artist", TAG_ALBUM_ARTIST }, diff --git a/src/SongUpdate.cxx b/src/SongUpdate.cxx index 8285cdd99..13d08fecc 100644 --- a/src/SongUpdate.cxx +++ b/src/SongUpdate.cxx @@ -28,13 +28,10 @@ #include "input_stream.h" #include "DecoderPlugin.hxx" #include "DecoderList.hxx" +#include "TagHandler.hxx" #include "TagId3.hxx" #include "ApeTag.hxx" -extern "C" { -#include "tag_handler.h" -} - #include <glib.h> #include <assert.h> diff --git a/src/tag_handler.c b/src/TagHandler.cxx index 316715e87..6f95c7e94 100644 --- a/src/tag_handler.c +++ b/src/TagHandler.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,14 +18,14 @@ */ #include "config.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #include <glib.h> static void add_tag_duration(unsigned seconds, void *ctx) { - struct tag *tag = ctx; + struct tag *tag = (struct tag *)ctx; tag->time = seconds; } @@ -33,28 +33,29 @@ add_tag_duration(unsigned seconds, void *ctx) static void add_tag_tag(enum tag_type type, const char *value, void *ctx) { - struct tag *tag = ctx; + struct tag *tag = (struct tag *)ctx; tag_add_item(tag, type, value); } const struct tag_handler add_tag_handler = { - .duration = add_tag_duration, - .tag = add_tag_tag, + add_tag_duration, + add_tag_tag, + nullptr, }; static void full_tag_pair(const char *name, G_GNUC_UNUSED const char *value, void *ctx) { - struct tag *tag = ctx; + struct tag *tag = (struct tag *)ctx; if (g_ascii_strcasecmp(name, "cuesheet") == 0) tag->has_playlist = true; } const struct tag_handler full_tag_handler = { - .duration = add_tag_duration, - .tag = add_tag_tag, - .pair = full_tag_pair, + add_tag_duration, + add_tag_tag, + full_tag_pair, }; diff --git a/src/tag_handler.h b/src/TagHandler.hxx index 7f15c2a48..967b91de7 100644 --- a/src/tag_handler.h +++ b/src/TagHandler.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_TAG_HANDLER_H -#define MPD_TAG_HANDLER_H +#ifndef MPD_TAG_HANDLER_HXX +#define MPD_TAG_HANDLER_HXX #include "check.h" #include "tag.h" @@ -55,9 +55,9 @@ static inline void tag_handler_invoke_duration(const struct tag_handler *handler, void *ctx, unsigned seconds) { - assert(handler != NULL); + assert(handler != nullptr); - if (handler->duration != NULL) + if (handler->duration != nullptr) handler->duration(seconds, ctx); } @@ -65,11 +65,11 @@ static inline void tag_handler_invoke_tag(const struct tag_handler *handler, void *ctx, enum tag_type type, const char *value) { - assert(handler != NULL); + assert(handler != nullptr); assert((unsigned)type < TAG_NUM_OF_ITEM_TYPES); - assert(value != NULL); + assert(value != nullptr); - if (handler->tag != NULL) + if (handler->tag != nullptr) handler->tag(type, value, ctx); } @@ -77,11 +77,11 @@ static inline void tag_handler_invoke_pair(const struct tag_handler *handler, void *ctx, const char *name, const char *value) { - assert(handler != NULL); - assert(name != NULL); - assert(value != NULL); + assert(handler != nullptr); + assert(name != nullptr); + assert(value != nullptr); - if (handler->pair != NULL) + if (handler->pair != nullptr) handler->pair(name, value, ctx); } diff --git a/src/TagId3.cxx b/src/TagId3.cxx index d6bef2fa9..c5719f481 100644 --- a/src/TagId3.cxx +++ b/src/TagId3.cxx @@ -19,7 +19,7 @@ #include "config.h" #include "TagId3.hxx" -#include "tag_handler.h" +#include "TagHandler.hxx" #include "tag_table.h" #include "tag.h" diff --git a/src/UpdateContainer.cxx b/src/UpdateContainer.cxx index 92b727ce7..9da58567c 100644 --- a/src/UpdateContainer.cxx +++ b/src/UpdateContainer.cxx @@ -27,10 +27,7 @@ #include "DecoderPlugin.hxx" #include "Mapper.hxx" #include "fs/Path.hxx" - -extern "C" { -#include "tag_handler.h" -} +#include "TagHandler.hxx" #include <glib.h> diff --git a/src/decoder/AdPlugDecoderPlugin.cxx b/src/decoder/AdPlugDecoderPlugin.cxx index e752295f5..d1ed07891 100644 --- a/src/decoder/AdPlugDecoderPlugin.cxx +++ b/src/decoder/AdPlugDecoderPlugin.cxx @@ -19,7 +19,7 @@ #include "config.h" #include "AdPlugDecoderPlugin.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #include "DecoderAPI.hxx" extern "C" { diff --git a/src/decoder/AudiofileDecoderPlugin.cxx b/src/decoder/AudiofileDecoderPlugin.cxx index 4eb5c14a6..ee7d0da14 100644 --- a/src/decoder/AudiofileDecoderPlugin.cxx +++ b/src/decoder/AudiofileDecoderPlugin.cxx @@ -21,7 +21,7 @@ #include "AudiofileDecoderPlugin.hxx" #include "DecoderAPI.hxx" #include "audio_check.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #include <audiofile.h> #include <af_vfs.h> diff --git a/src/decoder/DsdLib.cxx b/src/decoder/DsdLib.cxx index 5337612a9..cc23c490b 100644 --- a/src/decoder/DsdLib.cxx +++ b/src/decoder/DsdLib.cxx @@ -27,7 +27,7 @@ #include "DsdLib.hxx" #include "DecoderAPI.hxx" #include "util/bit_reverse.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #include "TagId3.hxx" #include <unistd.h> diff --git a/src/decoder/DsdiffDecoderPlugin.cxx b/src/decoder/DsdiffDecoderPlugin.cxx index 9934e4a37..fb542c3b7 100644 --- a/src/decoder/DsdiffDecoderPlugin.cxx +++ b/src/decoder/DsdiffDecoderPlugin.cxx @@ -31,9 +31,9 @@ #include "DecoderAPI.hxx" #include "audio_check.h" #include "util/bit_reverse.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #include "DsdLib.hxx" -#include "tag_handler.h" +#include "TagHandler.hxx" #include <unistd.h> #include <stdio.h> /* for SEEK_SET, SEEK_CUR */ diff --git a/src/decoder/DsfDecoderPlugin.cxx b/src/decoder/DsfDecoderPlugin.cxx index 545f12975..c19669dd6 100644 --- a/src/decoder/DsfDecoderPlugin.cxx +++ b/src/decoder/DsfDecoderPlugin.cxx @@ -33,7 +33,7 @@ #include "audio_check.h" #include "util/bit_reverse.h" #include "DsdLib.hxx" -#include "tag_handler.h" +#include "TagHandler.hxx" #include <unistd.h> #include <stdio.h> /* for SEEK_SET, SEEK_CUR */ diff --git a/src/decoder/FaadDecoderPlugin.cxx b/src/decoder/FaadDecoderPlugin.cxx index 4636d08cb..4c21ae7c9 100644 --- a/src/decoder/FaadDecoderPlugin.cxx +++ b/src/decoder/FaadDecoderPlugin.cxx @@ -22,7 +22,7 @@ #include "DecoderAPI.hxx" #include "DecoderBuffer.hxx" #include "audio_check.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #include <neaacdec.h> diff --git a/src/decoder/FfmpegDecoderPlugin.cxx b/src/decoder/FfmpegDecoderPlugin.cxx index 8b9810233..5930f7fa7 100644 --- a/src/decoder/FfmpegDecoderPlugin.cxx +++ b/src/decoder/FfmpegDecoderPlugin.cxx @@ -24,7 +24,7 @@ #include "FfmpegDecoderPlugin.hxx" #include "DecoderAPI.hxx" #include "FfmpegMetaData.hxx" -#include "tag_handler.h" +#include "TagHandler.hxx" #include "InputStream.hxx" extern "C" { diff --git a/src/decoder/FfmpegMetaData.cxx b/src/decoder/FfmpegMetaData.cxx index 2d7ebbca3..509aaf947 100644 --- a/src/decoder/FfmpegMetaData.cxx +++ b/src/decoder/FfmpegMetaData.cxx @@ -23,7 +23,7 @@ #include "config.h" #include "FfmpegMetaData.hxx" #include "tag_table.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "ffmpeg" diff --git a/src/decoder/FlacMetadata.cxx b/src/decoder/FlacMetadata.cxx index 694c88c8f..02a5f509e 100644 --- a/src/decoder/FlacMetadata.cxx +++ b/src/decoder/FlacMetadata.cxx @@ -25,7 +25,7 @@ extern "C" { } #include "tag.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #include "tag_table.h" #include "replay_gain_info.h" diff --git a/src/decoder/GmeDecoderPlugin.cxx b/src/decoder/GmeDecoderPlugin.cxx index 108a589a1..14367e311 100644 --- a/src/decoder/GmeDecoderPlugin.cxx +++ b/src/decoder/GmeDecoderPlugin.cxx @@ -21,7 +21,7 @@ #include "GmeDecoderPlugin.hxx" #include "DecoderAPI.hxx" #include "audio_check.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #include "util/UriUtil.hxx" #include <glib.h> diff --git a/src/decoder/MadDecoderPlugin.cxx b/src/decoder/MadDecoderPlugin.cxx index f8dd03701..0d74caf91 100644 --- a/src/decoder/MadDecoderPlugin.cxx +++ b/src/decoder/MadDecoderPlugin.cxx @@ -23,7 +23,7 @@ #include "conf.h" #include "TagId3.hxx" #include "TagRva2.hxx" -#include "tag_handler.h" +#include "TagHandler.hxx" #include "audio_check.h" #include <assert.h> diff --git a/src/decoder/MikmodDecoderPlugin.cxx b/src/decoder/MikmodDecoderPlugin.cxx index 538dfd599..d332664ee 100644 --- a/src/decoder/MikmodDecoderPlugin.cxx +++ b/src/decoder/MikmodDecoderPlugin.cxx @@ -21,7 +21,7 @@ #include "MikmodDecoderPlugin.hxx" #include "DecoderAPI.hxx" #include "mpd_error.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #include <glib.h> #include <mikmod.h> diff --git a/src/decoder/ModplugDecoderPlugin.cxx b/src/decoder/ModplugDecoderPlugin.cxx index a08c96f97..2ba3b0f49 100644 --- a/src/decoder/ModplugDecoderPlugin.cxx +++ b/src/decoder/ModplugDecoderPlugin.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "ModplugDecoderPlugin.hxx" #include "DecoderAPI.hxx" -#include "tag_handler.h" +#include "TagHandler.hxx" #include <glib.h> #include <modplug.h> diff --git a/src/decoder/MpcdecDecoderPlugin.cxx b/src/decoder/MpcdecDecoderPlugin.cxx index 17130f1a8..482610e2d 100644 --- a/src/decoder/MpcdecDecoderPlugin.cxx +++ b/src/decoder/MpcdecDecoderPlugin.cxx @@ -21,7 +21,7 @@ #include "MpcdecDecoderPlugin.hxx" #include "DecoderAPI.hxx" #include "audio_check.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #ifdef MPC_IS_OLD_API #include <mpcdec/mpcdec.h> diff --git a/src/decoder/Mpg123DecoderPlugin.cxx b/src/decoder/Mpg123DecoderPlugin.cxx index ab21a9bac..a22f926f5 100644 --- a/src/decoder/Mpg123DecoderPlugin.cxx +++ b/src/decoder/Mpg123DecoderPlugin.cxx @@ -21,7 +21,7 @@ #include "Mpg123DecoderPlugin.hxx" #include "DecoderAPI.hxx" #include "audio_check.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #include <glib.h> diff --git a/src/decoder/OpusDecoderPlugin.cxx b/src/decoder/OpusDecoderPlugin.cxx index f1304a1b7..063d13d79 100644 --- a/src/decoder/OpusDecoderPlugin.cxx +++ b/src/decoder/OpusDecoderPlugin.cxx @@ -27,7 +27,7 @@ #include "DecoderAPI.hxx" #include "OggCodec.hxx" #include "audio_check.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #include "InputStream.hxx" #include <opus.h> diff --git a/src/decoder/OpusTags.cxx b/src/decoder/OpusTags.cxx index cb35a6247..fec47a28d 100644 --- a/src/decoder/OpusTags.cxx +++ b/src/decoder/OpusTags.cxx @@ -21,7 +21,7 @@ #include "OpusTags.hxx" #include "OpusReader.hxx" #include "XiphTags.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #include <stdint.h> #include <string.h> diff --git a/src/decoder/SndfileDecoderPlugin.cxx b/src/decoder/SndfileDecoderPlugin.cxx index 0a40971a4..186f357ff 100644 --- a/src/decoder/SndfileDecoderPlugin.cxx +++ b/src/decoder/SndfileDecoderPlugin.cxx @@ -21,7 +21,7 @@ #include "SndfileDecoderPlugin.hxx" #include "DecoderAPI.hxx" #include "audio_check.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #include <sndfile.h> diff --git a/src/decoder/VorbisComments.cxx b/src/decoder/VorbisComments.cxx index 10fe22369..47e853762 100644 --- a/src/decoder/VorbisComments.cxx +++ b/src/decoder/VorbisComments.cxx @@ -22,7 +22,7 @@ #include "XiphTags.h" #include "tag.h" #include "tag_table.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #include "replay_gain_info.h" #include <glib.h> diff --git a/src/decoder/VorbisDecoderPlugin.cxx b/src/decoder/VorbisDecoderPlugin.cxx index bc3c1edce..438ba5949 100644 --- a/src/decoder/VorbisDecoderPlugin.cxx +++ b/src/decoder/VorbisDecoderPlugin.cxx @@ -29,7 +29,7 @@ extern "C" { #include "audio_check.h" } -#include "tag_handler.h" +#include "TagHandler.hxx" #ifndef HAVE_TREMOR #define OV_EXCLUDE_STATIC_CALLBACKS diff --git a/src/decoder/WavpackDecoderPlugin.cxx b/src/decoder/WavpackDecoderPlugin.cxx index a1512ee63..dbec7e82c 100644 --- a/src/decoder/WavpackDecoderPlugin.cxx +++ b/src/decoder/WavpackDecoderPlugin.cxx @@ -26,7 +26,7 @@ extern "C" { #include "audio_check.h" } -#include "tag_handler.h" +#include "TagHandler.hxx" #include "ApeTag.hxx" #include <wavpack/wavpack.h> diff --git a/src/decoder/WildmidiDecoderPlugin.cxx b/src/decoder/WildmidiDecoderPlugin.cxx index c6979132b..721229f87 100644 --- a/src/decoder/WildmidiDecoderPlugin.cxx +++ b/src/decoder/WildmidiDecoderPlugin.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "WildmidiDecoderPlugin.hxx" #include "DecoderAPI.hxx" -#include "tag_handler.h" +#include "TagHandler.hxx" #include "glib_compat.h" #include <glib.h> diff --git a/src/decoder/sidplay_decoder_plugin.cxx b/src/decoder/sidplay_decoder_plugin.cxx index eec9437d1..565274d83 100644 --- a/src/decoder/sidplay_decoder_plugin.cxx +++ b/src/decoder/sidplay_decoder_plugin.cxx @@ -21,7 +21,7 @@ #include "../DecoderAPI.hxx" extern "C" { -#include "tag_handler.h" +#include "TagHandler.hxx" } #include <errno.h> diff --git a/src/playlist/EmbeddedCuePlaylistPlugin.cxx b/src/playlist/EmbeddedCuePlaylistPlugin.cxx index c45e1d718..8a5eb10d7 100644 --- a/src/playlist/EmbeddedCuePlaylistPlugin.cxx +++ b/src/playlist/EmbeddedCuePlaylistPlugin.cxx @@ -27,7 +27,7 @@ #include "EmbeddedCuePlaylistPlugin.hxx" #include "PlaylistPlugin.hxx" #include "tag.h" -#include "tag_handler.h" +#include "TagHandler.hxx" #include "TagId3.hxx" #include "ApeTag.hxx" #include "Song.hxx" |