From 8ae390f65142ed38a0b5e2474fc6a21866092e84 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 29 Aug 2008 09:38:11 +0200 Subject: tag: renamed MpdTag and MpdTagItem to struct mpd_tag, struct tag_item Getting rid of CamelCase; not having typedefs also allows us to forward-declare the structures. --- src/audio.c | 2 +- src/audio.h | 2 +- src/audioOutput.c | 3 ++- src/audioOutput.h | 5 ++-- src/audioOutputs/audioOutput_shout.c | 4 ++-- src/dbUtils.c | 2 +- src/inputPlugin.h | 2 +- src/inputPlugins/_flac_common.c | 6 ++--- src/inputPlugins/_flac_common.h | 6 ++--- src/inputPlugins/aac_plugin.c | 4 ++-- src/inputPlugins/audiofile_plugin.c | 4 ++-- src/inputPlugins/flac_plugin.c | 14 +++++------ src/inputPlugins/mod_plugin.c | 4 ++-- src/inputPlugins/mp3_plugin.c | 18 +++++++-------- src/inputPlugins/mp4_plugin.c | 10 ++++---- src/inputPlugins/mpc_plugin.c | 4 ++-- src/inputPlugins/oggflac_plugin.c | 2 +- src/inputPlugins/oggvorbis_plugin.c | 12 +++++----- src/inputPlugins/wavpack_plugin.c | 4 ++-- src/metadata_pipe.c | 14 +++++------ src/metadata_pipe.h | 14 +++++------ src/outputBuffer.c | 4 ++-- src/playlist.c | 4 ++-- src/song.h | 2 +- src/tag.c | 45 ++++++++++++++++++------------------ src/tag.h | 30 ++++++++++++------------ 26 files changed, 112 insertions(+), 109 deletions(-) (limited to 'src') diff --git a/src/audio.c b/src/audio.c index 409761177..9a65df858 100644 --- a/src/audio.c +++ b/src/audio.c @@ -419,7 +419,7 @@ void closeAudioDevice(void) audioOpened = 0; } -void sendMetadataToAudioDevice(const MpdTag * tag) +void sendMetadataToAudioDevice(const struct mpd_tag *tag) { unsigned int i; diff --git a/src/audio.h b/src/audio.h index 0032cff22..92cb9cf11 100644 --- a/src/audio.h +++ b/src/audio.h @@ -55,7 +55,7 @@ int isAudioDeviceOpen(void); int isCurrentAudioFormat(const AudioFormat * audioFormat); -void sendMetadataToAudioDevice(const MpdTag * tag); +void sendMetadataToAudioDevice(const struct mpd_tag *tag); /* these functions are called in the main parent process while the child process is busy playing to the audio */ diff --git a/src/audioOutput.c b/src/audioOutput.c index f165979d0..d5b37f0fe 100644 --- a/src/audioOutput.c +++ b/src/audioOutput.c @@ -244,7 +244,8 @@ void finishAudioOutput(AudioOutput * audioOutput) free(audioOutput->convBuffer); } -void sendMetadataToAudioOutput(AudioOutput * audioOutput, const MpdTag * tag) +void sendMetadataToAudioOutput(AudioOutput * audioOutput, + const struct mpd_tag *tag) { if (!audioOutput->sendMetdataFunc) return; diff --git a/src/audioOutput.h b/src/audioOutput.h index f82eedfba..4ce67a5de 100644 --- a/src/audioOutput.h +++ b/src/audioOutput.h @@ -50,7 +50,7 @@ typedef void (*AudioOutputDropBufferedAudioFunc) (AudioOutput * audioOutput); typedef void (*AudioOutputCloseDeviceFunc) (AudioOutput * audioOutput); typedef void (*AudioOutputSendMetadataFunc) (AudioOutput * audioOutput, - const MpdTag * tag); + const struct mpd_tag *tag); struct _AudioOutput { int open; @@ -104,7 +104,8 @@ void dropBufferedAudioOutput(AudioOutput * audioOutput); void closeAudioOutput(AudioOutput * audioOutput); void finishAudioOutput(AudioOutput * audioOutput); int keepAudioOutputAlive(AudioOutput * audioOutput, int ms); -void sendMetadataToAudioOutput(AudioOutput * audioOutput, const MpdTag * tag); +void sendMetadataToAudioOutput(AudioOutput * audioOutput, + const struct mpd_tag *tag); void printAllOutputPluginTypes(FILE * fp); diff --git a/src/audioOutputs/audioOutput_shout.c b/src/audioOutputs/audioOutput_shout.c index c1f784986..cc5b36e29 100644 --- a/src/audioOutputs/audioOutput_shout.c +++ b/src/audioOutputs/audioOutput_shout.c @@ -56,7 +56,7 @@ typedef struct _ShoutData { int opened; - MpdTag *tag; + struct mpd_tag *tag; int tagToSend; int timeout; @@ -663,7 +663,7 @@ static int myShout_play(AudioOutput * audioOutput, return 0; } -static void myShout_setTag(AudioOutput * audioOutput, MpdTag * tag) +static void myShout_setTag(AudioOutput * audioOutput, struct mpd_tag *tag) { ShoutData *sd = (ShoutData *) audioOutput->data; diff --git a/src/dbUtils.c b/src/dbUtils.c index 519c1802d..3379b9bb2 100644 --- a/src/dbUtils.c +++ b/src/dbUtils.c @@ -257,7 +257,7 @@ static void freeListCommandItem(ListCommandItem * item) static void visitTag(int fd, Song * song, enum tag_type tagType) { int i; - MpdTag *tag = song->tag; + struct mpd_tag *tag = song->tag; if (tagType == LOCATE_TAG_FILE_TYPE) { printSongUrl(fd, song); diff --git a/src/inputPlugin.h b/src/inputPlugin.h index 161a0db59..0fd39ea9f 100644 --- a/src/inputPlugin.h +++ b/src/inputPlugin.h @@ -54,7 +54,7 @@ typedef int (*InputPlugin_fileDecodeFunc) (char *path); /* file should be the full path! Returns NULL if a tag cannot be found * or read */ -typedef MpdTag *(*InputPlugin_tagDupFunc) (char *file); +typedef struct mpd_tag *(*InputPlugin_tagDupFunc) (char *file); typedef struct _InputPlugin { const char *name; diff --git a/src/inputPlugins/_flac_common.c b/src/inputPlugins/_flac_common.c index 6890c7c50..6307af00d 100644 --- a/src/inputPlugins/_flac_common.c +++ b/src/inputPlugins/_flac_common.c @@ -101,7 +101,7 @@ static const char *VORBIS_COMMENT_DISC_KEY = "discnumber"; static unsigned int commentMatchesAddToTag(const FLAC__StreamMetadata_VorbisComment_Entry * entry, unsigned int itemType, - MpdTag ** tag) + struct mpd_tag ** tag) { const char *str; size_t slen; @@ -134,8 +134,8 @@ static unsigned int commentMatchesAddToTag(const return 0; } -MpdTag *copyVorbisCommentBlockToMpdTag(const FLAC__StreamMetadata * block, - MpdTag * tag) +struct mpd_tag *copyVorbisCommentBlockToMpdTag(const FLAC__StreamMetadata * block, + struct mpd_tag * tag) { unsigned int i, j; FLAC__StreamMetadata_VorbisComment_Entry *comments; diff --git a/src/inputPlugins/_flac_common.h b/src/inputPlugins/_flac_common.h index 6fe5bd744..a1b0cac8f 100644 --- a/src/inputPlugins/_flac_common.h +++ b/src/inputPlugins/_flac_common.h @@ -146,7 +146,7 @@ typedef struct { FLAC__uint64 position; InputStream *inStream; ReplayGainInfo *replayGainInfo; - MpdTag *tag; + struct mpd_tag *tag; } FlacData; /* initializes a given FlacData struct */ @@ -157,8 +157,8 @@ void flac_error_common_cb(const char *plugin, FLAC__StreamDecoderErrorStatus status, FlacData * data); -MpdTag *copyVorbisCommentBlockToMpdTag(const FLAC__StreamMetadata * block, - MpdTag * tag); +struct mpd_tag *copyVorbisCommentBlockToMpdTag(const FLAC__StreamMetadata * block, + struct mpd_tag *tag); /* keep this inlined, this is just macro but prettier :) */ static inline enum dc_action flacSendChunk(FlacData * data) diff --git a/src/inputPlugins/aac_plugin.c b/src/inputPlugins/aac_plugin.c index 512e73e53..161b1b9b8 100644 --- a/src/inputPlugins/aac_plugin.c +++ b/src/inputPlugins/aac_plugin.c @@ -553,9 +553,9 @@ out: return 0; } -static MpdTag *aacTagDup(char *file) +static struct mpd_tag *aacTagDup(char *file) { - MpdTag *ret = NULL; + struct mpd_tag *ret = NULL; int file_time = getAacTotalTime(file); if (file_time >= 0) { diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c index fcebf562b..ce8eb68d4 100644 --- a/src/inputPlugins/audiofile_plugin.c +++ b/src/inputPlugins/audiofile_plugin.c @@ -116,9 +116,9 @@ static int audiofile_decode(char *path) return 0; } -static MpdTag *audiofileTagDup(char *file) +static struct mpd_tag *audiofileTagDup(char *file) { - MpdTag *ret = NULL; + struct mpd_tag *ret = NULL; int total_time = getAudiofileTotalTime(file); if (total_time >= 0) { diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c index de0648c90..c376497a9 100644 --- a/src/inputPlugins/flac_plugin.c +++ b/src/inputPlugins/flac_plugin.c @@ -292,9 +292,9 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec, return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } -static MpdTag *flacMetadataDup(char *file, int *vorbisCommentFound) +static struct mpd_tag *flacMetadataDup(char *file, int *vorbisCommentFound) { - MpdTag *ret = NULL; + struct mpd_tag *ret = NULL; FLAC__Metadata_SimpleIterator *it; FLAC__StreamMetadata *block = NULL; @@ -350,9 +350,9 @@ static MpdTag *flacMetadataDup(char *file, int *vorbisCommentFound) return ret; } -static MpdTag *flacTagDup(char *file) +static struct mpd_tag *flacTagDup(char *file) { - MpdTag *ret = NULL; + struct mpd_tag *ret = NULL; int foundVorbisComment = 0; ret = flacMetadataDup(file, &foundVorbisComment); @@ -362,7 +362,7 @@ static MpdTag *flacTagDup(char *file) return NULL; } if (!foundVorbisComment) { - MpdTag *temp = id3Dup(file); + struct mpd_tag *temp = id3Dup(file); if (temp) { temp->time = ret->time; freeMpdTag(ret); @@ -466,9 +466,9 @@ static int flac_decode(InputStream * inStream) /* some of this stuff is duplicated from oggflac_plugin.c */ extern InputPlugin oggflacPlugin; -static MpdTag *oggflac_tag_dup(char *file) +static struct mpd_tag *oggflac_tag_dup(char *file) { - MpdTag *ret = NULL; + struct mpd_tag *ret = NULL; FLAC__Metadata_Iterator *it; FLAC__StreamMetadata *block; FLAC__Metadata_Chain *chain = FLAC__metadata_chain_new(); diff --git a/src/inputPlugins/mod_plugin.c b/src/inputPlugins/mod_plugin.c index df938f0ed..c954f064d 100644 --- a/src/inputPlugins/mod_plugin.c +++ b/src/inputPlugins/mod_plugin.c @@ -205,9 +205,9 @@ static int mod_decode(char *path) return 0; } -static MpdTag *modTagDup(char *file) +static struct mpd_tag *modTagDup(char *file) { - MpdTag *ret = NULL; + struct mpd_tag *ret = NULL; MODULE *moduleHandle; char *title; diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c index f1304f401..9644e7a62 100644 --- a/src/inputPlugins/mp3_plugin.c +++ b/src/inputPlugins/mp3_plugin.c @@ -301,13 +301,13 @@ static ReplayGainInfo *parseId3ReplayGainInfo(struct id3_tag *tag) #ifdef HAVE_ID3TAG static void mp3_parseId3Tag(mp3DecodeData * data, size_t tagsize, - MpdTag ** mpdTag, ReplayGainInfo ** replayGainInfo) + struct mpd_tag ** mpdTag, ReplayGainInfo ** replayGainInfo) { struct id3_tag *id3Tag = NULL; id3_length_t count; id3_byte_t const *id3_data; id3_byte_t *allocated = NULL; - MpdTag *tmpMpdTag; + struct mpd_tag *tmpMpdTag; ReplayGainInfo *tmpReplayGainInfo; count = data->stream.bufend - data->stream.this_frame; @@ -373,7 +373,7 @@ fail: #endif static enum mp3_action -decodeNextFrameHeader(mp3DecodeData * data, MpdTag ** tag, +decodeNextFrameHeader(mp3DecodeData * data, struct mpd_tag ** tag, ReplayGainInfo ** replayGainInfo) { enum mad_layer layer; @@ -688,7 +688,7 @@ static int parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) } static int decodeFirstFrame(mp3DecodeData * data, - MpdTag ** tag, ReplayGainInfo ** replayGainInfo) + struct mpd_tag ** tag, ReplayGainInfo ** replayGainInfo) { struct xing xing; struct lame lame; @@ -811,7 +811,7 @@ static int getMp3TotalTime(char *file) } static int openMp3FromInputStream(InputStream * inStream, mp3DecodeData * data, - MpdTag ** tag, + struct mpd_tag ** tag, ReplayGainInfo ** replayGainInfo) { initMp3DecodeData(data, inStream); @@ -923,7 +923,7 @@ mp3Read(mp3DecodeData * data, ReplayGainInfo ** replayGainInfo) } if (data->inStream->metaTitle) { - MpdTag *tag = newMpdTag(); + struct mpd_tag *tag = newMpdTag(); if (data->inStream->metaName) { addItemToMpdTag(tag, TAG_ITEM_NAME, @@ -1033,7 +1033,7 @@ static void initAudioFormatFromMp3DecodeData(mp3DecodeData * data, static int mp3_decode(InputStream * inStream) { mp3DecodeData data; - MpdTag *tag = NULL; + struct mpd_tag *tag = NULL; ReplayGainInfo *replayGainInfo = NULL; if (openMp3FromInputStream(inStream, &data, &tag, &replayGainInfo) < 0) { @@ -1081,9 +1081,9 @@ static int mp3_decode(InputStream * inStream) return 0; } -static MpdTag *mp3_tagDup(char *file) +static struct mpd_tag *mp3_tagDup(char *file) { - MpdTag *ret = NULL; + struct mpd_tag *ret = NULL; int total_time; ret = id3Dup(file); diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c index 8e3d02354..543ff76b7 100644 --- a/src/inputPlugins/mp4_plugin.c +++ b/src/inputPlugins/mp4_plugin.c @@ -284,9 +284,9 @@ static int mp4_decode(InputStream * inStream) return 0; } -static MpdTag *mp4DataDup(char *file, int *mp4MetadataFound) +static struct mpd_tag *mp4DataDup(char *file, int *mp4MetadataFound) { - MpdTag *ret = NULL; + struct mpd_tag *ret = NULL; InputStream inStream; mp4ff_t *mp4fh; mp4ff_callback_t *callback; @@ -373,16 +373,16 @@ static MpdTag *mp4DataDup(char *file, int *mp4MetadataFound) return ret; } -static MpdTag *mp4TagDup(char *file) +static struct mpd_tag *mp4TagDup(char *file) { - MpdTag *ret = NULL; + struct mpd_tag *ret = NULL; int mp4MetadataFound = 0; ret = mp4DataDup(file, &mp4MetadataFound); if (!ret) return NULL; if (!mp4MetadataFound) { - MpdTag *temp = id3Dup(file); + struct mpd_tag *temp = id3Dup(file); if (temp) { temp->time = ret->time; freeMpdTag(ret); diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c index ea27d1dbf..e3e16e8b3 100644 --- a/src/inputPlugins/mpc_plugin.c +++ b/src/inputPlugins/mpc_plugin.c @@ -273,9 +273,9 @@ static float mpcGetTime(char *file) return total_time; } -static MpdTag *mpcTagDup(char *file) +static struct mpd_tag *mpcTagDup(char *file) { - MpdTag *ret = NULL; + struct mpd_tag *ret = NULL; float total_time = mpcGetTime(file); if (total_time < 0) { diff --git a/src/inputPlugins/oggflac_plugin.c b/src/inputPlugins/oggflac_plugin.c index 4b3bb0a6b..a12512dfc 100644 --- a/src/inputPlugins/oggflac_plugin.c +++ b/src/inputPlugins/oggflac_plugin.c @@ -300,7 +300,7 @@ fail: } /* public functions: */ -static MpdTag *oggflac_TagDup(char *file) +static struct mpd_tag *oggflac_TagDup(char *file) { InputStream inStream; OggFLAC__SeekableStreamDecoder *decoder; diff --git a/src/inputPlugins/oggvorbis_plugin.c b/src/inputPlugins/oggvorbis_plugin.c index d14ae2bac..0ff54df60 100644 --- a/src/inputPlugins/oggvorbis_plugin.c +++ b/src/inputPlugins/oggvorbis_plugin.c @@ -145,7 +145,7 @@ static const char *VORBIS_COMMENT_DISC_KEY = "discnumber"; static unsigned int ogg_parseCommentAddToTag(char *comment, unsigned int itemType, - MpdTag ** tag) + struct mpd_tag ** tag) { const char *needle; unsigned int len; @@ -173,9 +173,9 @@ static unsigned int ogg_parseCommentAddToTag(char *comment, return 0; } -static MpdTag *oggCommentsParse(char **comments) +static struct mpd_tag *oggCommentsParse(char **comments) { - MpdTag *tag = NULL; + struct mpd_tag *tag = NULL; while (*comments) { int j; @@ -193,7 +193,7 @@ static void putOggCommentsIntoOutputBuffer(char *streamName, char **comments, float cur_time) { - MpdTag *tag; + struct mpd_tag *tag; tag = oggCommentsParse(comments); if (!tag && streamName) { @@ -332,9 +332,9 @@ static int oggvorbis_decode(InputStream * inStream) return 0; } -static MpdTag *oggvorbis_TagDup(char *file) +static struct mpd_tag *oggvorbis_TagDup(char *file) { - MpdTag *ret; + struct mpd_tag *ret; FILE *fp; OggVorbis_File vf; diff --git a/src/inputPlugins/wavpack_plugin.c b/src/inputPlugins/wavpack_plugin.c index c7e024a41..a97242239 100644 --- a/src/inputPlugins/wavpack_plugin.c +++ b/src/inputPlugins/wavpack_plugin.c @@ -270,10 +270,10 @@ static ReplayGainInfo *wavpack_replaygain(WavpackContext *wpc) /* * Reads metainfo from the specified file. */ -static MpdTag *wavpack_tagdup(char *fname) +static struct mpd_tag *wavpack_tagdup(char *fname) { WavpackContext *wpc; - MpdTag *tag; + struct mpd_tag *tag; char error[ERRORLEN]; char *s; int ssize; diff --git a/src/metadata_pipe.c b/src/metadata_pipe.c index 5508b97c8..5cdc3af2d 100644 --- a/src/metadata_pipe.c +++ b/src/metadata_pipe.c @@ -34,7 +34,7 @@ static struct ringbuf *mp; struct tag_container { float metadata_time; mpd_uint8 seq; /* ob.seq_decoder at time of metadata_pipe_send() */ - MpdTag *tag; /* our payload */ + struct mpd_tag *tag; /* our payload */ }; /* @@ -43,7 +43,7 @@ struct tag_container { * done from one thread, so it will never block or clobber. */ static pthread_mutex_t read_lock = PTHREAD_MUTEX_INITIALIZER; -static MpdTag *current_tag; /* requires read_lock for both r/w access */ +static struct mpd_tag *current_tag; /* requires read_lock for both r/w access */ static void metadata_pipe_finish(void) { @@ -58,7 +58,7 @@ void init_metadata_pipe(void) atexit(metadata_pipe_finish); } -void metadata_pipe_send(MpdTag *tag, float metadata_time) +void metadata_pipe_send(struct mpd_tag *tag, float metadata_time) { struct tag_container tc; size_t written; @@ -79,14 +79,14 @@ void metadata_pipe_send(MpdTag *tag, float metadata_time) assert(written == sizeof(struct tag_container)); } -MpdTag * metadata_pipe_recv(void) +struct mpd_tag * metadata_pipe_recv(void) { struct tag_container tc; size_t r; static const size_t mpd_uint8_max = 255; /* XXX CLEANUP */ mpd_uint8 expect_seq = ob_get_player_sequence(); unsigned long current_time = ob_get_elapsed_time(); - MpdTag *tag = NULL; + struct mpd_tag *tag = NULL; if (pthread_mutex_trylock(&read_lock) == EBUSY) return NULL; @@ -124,9 +124,9 @@ out: return tag; } -MpdTag *metadata_pipe_current(void) +struct mpd_tag *metadata_pipe_current(void) { - MpdTag *tag; + struct mpd_tag *tag; assert(! pthread_equal(pthread_self(), dc.thread)); if (pthread_mutex_trylock(&read_lock) == EBUSY) diff --git a/src/metadata_pipe.h b/src/metadata_pipe.h index e54c67584..cb891aa80 100644 --- a/src/metadata_pipe.h +++ b/src/metadata_pipe.h @@ -29,21 +29,21 @@ void init_metadata_pipe(void); * DO NOT FREE the tag placed into the pipe; that is that job of the * caller of metadata_pipe_recv() or metadata_pipe_clear(). */ -void metadata_pipe_send(MpdTag * tag, float metadata_time); +void metadata_pipe_send(struct mpd_tag * tag, float metadata_time); /* - * Reads and consumes one MpdTag pointer off the pipe. The caller - * of this MUST free the MpdTag pointer after it is done using it. + * Reads and consumes one struct mpd_tag pointer off the pipe. The caller + * of this MUST free the struct mpd_tag pointer after it is done using it. */ -MpdTag * metadata_pipe_recv(void); +struct mpd_tag * metadata_pipe_recv(void); /* - * Returns the last read MpdTag from metadata_pipe_recv(), caller + * Returns the last read struct mpd_tag from metadata_pipe_recv(), caller * must free this pointer when it is done using it. */ -MpdTag * metadata_pipe_current(void); +struct mpd_tag * metadata_pipe_current(void); -/* Clears all MpdTag pointers on the pipe, freeing all associated elements */ +/* Clears all struct mpd_tag pointers on the pipe, freeing all associated elements */ void metadata_pipe_clear(void); #endif /* METADATA_PIPE_H */ diff --git a/src/outputBuffer.c b/src/outputBuffer.c index 8a41924db..52506650f 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -408,8 +408,8 @@ static void new_song_chunk(struct ob_chunk *a) static void send_next_tag(void) { - static MpdTag *last_tag; - MpdTag *tag; + static struct mpd_tag *last_tag; + struct mpd_tag *tag; if ((tag = metadata_pipe_recv())) { /* streaming tag */ DEBUG("Caught new metadata! %p\n", tag); diff --git a/src/playlist.c b/src/playlist.c index ab5908ff1..0faeab5ef 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -969,7 +969,7 @@ int playPlaylistById(int fd, int id, int stopOnError) } /* This is used when we stream data out to shout while playing static files */ -MpdTag *playlist_current_tag(void) +struct mpd_tag *playlist_current_tag(void) { Song *song = song_at(playlist.current); @@ -981,7 +981,7 @@ MpdTag *playlist_current_tag(void) static void sync_metadata(void) { Song *song; - MpdTag *tag; + struct mpd_tag *tag; if (!(tag = metadata_pipe_current())) return; diff --git a/src/song.h b/src/song.h index 8e2de410a..fc9d1ecb7 100644 --- a/src/song.h +++ b/src/song.h @@ -36,7 +36,7 @@ typedef struct _Song { char *url; mpd_sint8 type; - MpdTag *tag; + struct mpd_tag *tag; struct _Directory *parentDir; time_t mtime; } Song; diff --git a/src/tag.c b/src/tag.c index c1ccd0a42..b50756036 100644 --- a/src/tag.c +++ b/src/tag.c @@ -114,7 +114,7 @@ void printTagTypes(int fd) } } -void printMpdTag(int fd, MpdTag * tag) +void printMpdTag(int fd, struct mpd_tag *tag) { int i; @@ -164,8 +164,8 @@ static id3_utf8_t * processID3FieldString (int is_id3v1, const id3_ucs4_t *ucs4, return utf8; } -static MpdTag *getID3Info( - struct id3_tag *tag, const char *id, int type, MpdTag * mpdTag) +static struct mpd_tag *getID3Info( + struct id3_tag *tag, const char *id, int type, struct mpd_tag *mpdTag) { struct id3_frame const *frame; id3_ucs4_t const *ucs4; @@ -283,9 +283,9 @@ static MpdTag *getID3Info( #endif #ifdef HAVE_ID3TAG -MpdTag *parseId3Tag(struct id3_tag * tag) +struct mpd_tag *parseId3Tag(struct id3_tag * tag) { - MpdTag *ret = NULL; + struct mpd_tag *ret = NULL; ret = getID3Info(tag, ID3_FRAME_ARTIST, TAG_ITEM_ARTIST, ret); ret = getID3Info(tag, ID3_FRAME_TITLE, TAG_ITEM_TITLE, ret); @@ -425,9 +425,9 @@ static struct id3_tag *findId3TagFromEnd(FILE * stream) } #endif -MpdTag *id3Dup(char *file) +struct mpd_tag *id3Dup(char *file) { - MpdTag *ret = NULL; + struct mpd_tag *ret = NULL; #ifdef HAVE_ID3TAG struct id3_tag *tag; FILE *stream; @@ -453,9 +453,9 @@ MpdTag *id3Dup(char *file) return ret; } -MpdTag *apeDup(char *file) +struct mpd_tag *apeDup(char *file) { - MpdTag *ret = NULL; + struct mpd_tag *ret = NULL; FILE *fp; int tagCount; char *buffer = NULL; @@ -574,16 +574,16 @@ fail: return ret; } -MpdTag *newMpdTag(void) +struct mpd_tag *newMpdTag(void) { - MpdTag *ret = xmalloc(sizeof(MpdTag)); + struct mpd_tag *ret = xmalloc(sizeof(*ret)); ret->items = NULL; ret->time = -1; ret->numOfItems = 0; return ret; } -static void deleteItem(MpdTag * tag, int idx) +static void deleteItem(struct mpd_tag *tag, int idx) { assert(idx < tag->numOfItems); tag->numOfItems--; @@ -598,14 +598,14 @@ static void deleteItem(MpdTag * tag, int idx) if (tag->numOfItems > 0) { tag->items = xrealloc(tag->items, - tag->numOfItems * sizeof(MpdTagItem)); + tag->numOfItems * sizeof(*tag->items)); } else { free(tag->items); tag->items = NULL; } } -void clearItemsFromMpdTag(MpdTag * tag, enum tag_type type) +void clearItemsFromMpdTag(struct mpd_tag *tag, enum tag_type type) { int i; @@ -618,7 +618,7 @@ void clearItemsFromMpdTag(MpdTag * tag, enum tag_type type) } } -static void clearMpdTag(MpdTag * tag) +static void clearMpdTag(struct mpd_tag *tag) { int i; @@ -636,15 +636,15 @@ static void clearMpdTag(MpdTag * tag) tag->time = -1; } -void freeMpdTag(MpdTag * tag) +void freeMpdTag(struct mpd_tag *tag) { clearMpdTag(tag); free(tag); } -MpdTag *mpdTagDup(MpdTag * tag) +struct mpd_tag *mpdTagDup(struct mpd_tag *tag) { - MpdTag *ret; + struct mpd_tag *ret; int i; if (!tag) @@ -660,7 +660,7 @@ MpdTag *mpdTagDup(MpdTag * tag) return ret; } -int mpdTagsAreEqual(MpdTag * tag1, MpdTag * tag2) +int mpdTagsAreEqual(struct mpd_tag *tag1, struct mpd_tag *tag2) { int i; @@ -696,7 +696,7 @@ int mpdTagsAreEqual(MpdTag * tag1, MpdTag * tag2) } \ } -static void appendToTagItems(MpdTag * tag, enum tag_type type, +static void appendToTagItems(struct mpd_tag *tag, enum tag_type type, const char *value, size_t len) { unsigned int i = tag->numOfItems; @@ -709,7 +709,8 @@ static void appendToTagItems(MpdTag * tag, enum tag_type type, stripReturnChar(duplicated); tag->numOfItems++; - tag->items = xrealloc(tag->items, tag->numOfItems * sizeof(MpdTagItem)); + tag->items = xrealloc(tag->items, + tag->numOfItems * sizeof(*tag->items)); tag->items[i].type = type; tag->items[i].value = getTagItemString(type, duplicated); @@ -717,7 +718,7 @@ static void appendToTagItems(MpdTag * tag, enum tag_type type, free(duplicated); } -void addItemToMpdTagWithLen(MpdTag * tag, enum tag_type itemType, +void addItemToMpdTagWithLen(struct mpd_tag *tag, enum tag_type itemType, const char *value, size_t len) { if (ignoreTagItems[itemType]) diff --git a/src/tag.h b/src/tag.h index a9bf19934..93a6415e6 100644 --- a/src/tag.h +++ b/src/tag.h @@ -45,34 +45,34 @@ enum tag_type { extern const char *mpdTagItemKeys[]; -typedef struct _MpdTagItem { +struct tag_item { enum tag_type type; char *value; -} MpdTagItem; +}; -typedef struct _MpdTag { +struct mpd_tag { int time; - MpdTagItem *items; + struct tag_item *items; mpd_uint8 numOfItems; -} MpdTag; +}; #ifdef HAVE_ID3TAG -MpdTag *parseId3Tag(struct id3_tag *); +struct mpd_tag *parseId3Tag(struct id3_tag *); #endif -MpdTag *apeDup(char *file); +struct mpd_tag *apeDup(char *file); -MpdTag *id3Dup(char *file); +struct mpd_tag *id3Dup(char *file); -MpdTag *newMpdTag(void); +struct mpd_tag *newMpdTag(void); void initTagConfig(void); -void clearItemsFromMpdTag(MpdTag * tag, enum tag_type itemType); +void clearItemsFromMpdTag(struct mpd_tag *tag, enum tag_type itemType); -void freeMpdTag(MpdTag * tag); +void freeMpdTag(struct mpd_tag *tag); -void addItemToMpdTagWithLen(MpdTag * tag, enum tag_type itemType, +void addItemToMpdTagWithLen(struct mpd_tag *tag, enum tag_type itemType, const char *value, size_t len); #define addItemToMpdTag(tag, itemType, value) \ @@ -80,10 +80,10 @@ void addItemToMpdTagWithLen(MpdTag * tag, enum tag_type itemType, void printTagTypes(int fd); -void printMpdTag(int fd, MpdTag * tag); +void printMpdTag(int fd, struct mpd_tag *tag); -MpdTag *mpdTagDup(MpdTag * tag); +struct mpd_tag *mpdTagDup(struct mpd_tag *tag); -int mpdTagsAreEqual(MpdTag * tag1, MpdTag * tag2); +int mpdTagsAreEqual(struct mpd_tag *tag1, struct mpd_tag *tag2); #endif -- cgit v1.2.3