Commit 72609e68 authored by Led's avatar Led

0.12.0rc3

parent c8b0ef45
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for mpd 0.12.0rc2. # Generated by GNU Autoconf 2.59 for mpd 0.12.0rc3.
# #
# Report bugs to <warren.dukes@gmail.com>. # Report bugs to <warren.dukes@gmail.com>.
# #
...@@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} ...@@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package. # Identity of this package.
PACKAGE_NAME='mpd' PACKAGE_NAME='mpd'
PACKAGE_TARNAME='mpd' PACKAGE_TARNAME='mpd'
PACKAGE_VERSION='0.12.0rc2' PACKAGE_VERSION='0.12.0rc3'
PACKAGE_STRING='mpd 0.12.0rc2' PACKAGE_STRING='mpd 0.12.0rc3'
PACKAGE_BUGREPORT='warren.dukes@gmail.com' PACKAGE_BUGREPORT='warren.dukes@gmail.com'
# Factoring default headers for most tests. # Factoring default headers for most tests.
...@@ -965,7 +965,7 @@ if test "$ac_init_help" = "long"; then ...@@ -965,7 +965,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures mpd 0.12.0rc2 to adapt to many kinds of systems. \`configure' configures mpd 0.12.0rc3 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
...@@ -1031,7 +1031,7 @@ fi ...@@ -1031,7 +1031,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of mpd 0.12.0rc2:";; short | recursive ) echo "Configuration of mpd 0.12.0rc3:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
...@@ -1236,7 +1236,7 @@ fi ...@@ -1236,7 +1236,7 @@ fi
test -n "$ac_init_help" && exit 0 test -n "$ac_init_help" && exit 0
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
mpd configure 0.12.0rc2 mpd configure 0.12.0rc3
generated by GNU Autoconf 2.59 generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc. Copyright (C) 2003 Free Software Foundation, Inc.
...@@ -1250,7 +1250,7 @@ cat >&5 <<_ACEOF ...@@ -1250,7 +1250,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by mpd $as_me 0.12.0rc2, which was It was created by mpd $as_me 0.12.0rc3, which was
generated by GNU Autoconf 2.59. Invocation command line was generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@ $ $0 $@
...@@ -18799,7 +18799,7 @@ MPD_LIBS="" ...@@ -18799,7 +18799,7 @@ MPD_LIBS=""
MPD_CFLAGS="" MPD_CFLAGS=""
case "$CC" in case "$CC" in
*gcc*) *gcc*)
MPD_CFLAGS="-Wall" MPD_CFLAGS="-Wall -Wmissing-prototypes"
;; ;;
esac esac
...@@ -27482,7 +27482,7 @@ _ASBOX ...@@ -27482,7 +27482,7 @@ _ASBOX
} >&5 } >&5
cat >&5 <<_CSEOF cat >&5 <<_CSEOF
This file was extended by mpd $as_me 0.12.0rc2, which was This file was extended by mpd $as_me 0.12.0rc3, which was
generated by GNU Autoconf 2.59. Invocation command line was generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
...@@ -27545,7 +27545,7 @@ _ACEOF ...@@ -27545,7 +27545,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\ ac_cs_version="\\
mpd config.status 0.12.0rc2 mpd config.status 0.12.0rc3
configured by $0, generated by GNU Autoconf 2.59, configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
......
dnl AC_INIT(src/main.c) dnl AC_INIT(src/main.c)
dnl AM_INIT_AUTOMAKE(mpd, 0.12.0rc2) dnl AM_INIT_AUTOMAKE(mpd, 0.12.0rc3)
AC_PREREQ(2.58) AC_PREREQ(2.58)
AC_INIT(mpd, 0.12.0rc2, warren.dukes@gmail.com) AC_INIT(mpd, 0.12.0rc3, warren.dukes@gmail.com)
AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION) AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION)
AC_SUBST(MPD_LIBS) AC_SUBST(MPD_LIBS)
...@@ -22,7 +22,7 @@ MPD_LIBS="" ...@@ -22,7 +22,7 @@ MPD_LIBS=""
MPD_CFLAGS="" MPD_CFLAGS=""
case "$CC" in case "$CC" in
*gcc*) *gcc*)
MPD_CFLAGS="-Wall" MPD_CFLAGS="-Wall -Wmissing-prototypes"
;; ;;
esac esac
......
...@@ -45,23 +45,23 @@ void getOutputAudioFormat(AudioFormat * inFormat, AudioFormat * outFormat); ...@@ -45,23 +45,23 @@ void getOutputAudioFormat(AudioFormat * inFormat, AudioFormat * outFormat);
int parseAudioConfig(AudioFormat * audioFormat, char *conf); int parseAudioConfig(AudioFormat * audioFormat, char *conf);
/* make sure initPlayerData is called before this function!! */ /* make sure initPlayerData is called before this function!! */
void initAudioConfig(); void initAudioConfig(void);
void finishAudioConfig(); void finishAudioConfig(void);
void initAudioDriver(); void initAudioDriver(void);
void finishAudioDriver(); void finishAudioDriver(void);
int openAudioDevice(AudioFormat * audioFormat); int openAudioDevice(AudioFormat * audioFormat);
int playAudio(char *playChunk, int size); int playAudio(char *playChunk, int size);
void dropBufferedAudio(); void dropBufferedAudio(void);
void closeAudioDevice(); void closeAudioDevice(void);
int isAudioDeviceOpen(); int isAudioDeviceOpen(void);
int isCurrentAudioFormat(AudioFormat * audioFormat); int isCurrentAudioFormat(AudioFormat * audioFormat);
...@@ -79,5 +79,5 @@ void readAudioDevicesState(FILE *fp); ...@@ -79,5 +79,5 @@ void readAudioDevicesState(FILE *fp);
void saveAudioDevicesState(FILE *fp); void saveAudioDevicesState(FILE *fp);
void loadAudioDrivers(); void loadAudioDrivers(void);
#endif #endif
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
NULL, \ NULL, \
NULL, \ NULL, \
NULL, \ NULL, \
NULL \
}; };
typedef struct _AudioOutput AudioOutput; typedef struct _AudioOutput AudioOutput;
...@@ -95,8 +96,8 @@ typedef struct _AudioOutputPlugin { ...@@ -95,8 +96,8 @@ typedef struct _AudioOutputPlugin {
AudioOutputSendMetadataFunc sendMetdataFunc; AudioOutputSendMetadataFunc sendMetdataFunc;
} AudioOutputPlugin; } AudioOutputPlugin;
void initAudioOutputPlugins(); void initAudioOutputPlugins(void);
void finishAudioOutputPlugins(); void finishAudioOutputPlugins(void);
void loadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin); void loadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin);
void unloadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin); void unloadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin);
......
...@@ -312,7 +312,7 @@ configure_hw: ...@@ -312,7 +312,7 @@ configure_hw:
return 0; return 0;
error: error:
if (cmd) { if (cmd) {
ERROR("Error opening alsa device \"%s\" (%s): %s\n", ERROR("Error opening alsa device \"%s\" (%s): %s\n",
ad->device, cmd, snd_strerror(-err)); ad->device, cmd, snd_strerror(-err));
...@@ -320,7 +320,7 @@ configure_hw: ...@@ -320,7 +320,7 @@ configure_hw:
ERROR("Error opening alsa device \"%s\": %s\n", ad->device, ERROR("Error opening alsa device \"%s\": %s\n", ad->device,
snd_strerror(-err)); snd_strerror(-err));
} }
fail: fail:
if (ad->pcmHandle) if (ad->pcmHandle)
snd_pcm_close(ad->pcmHandle); snd_pcm_close(ad->pcmHandle);
ad->pcmHandle = NULL; ad->pcmHandle = NULL;
......
...@@ -487,7 +487,7 @@ static int oss_open(AudioOutput * audioOutput) ...@@ -487,7 +487,7 @@ static int oss_open(AudioOutput * audioOutput)
return 0; return 0;
fail: fail:
oss_close(od); oss_close(od);
audioOutput->open = 0; audioOutput->open = 0;
return -1; return -1;
......
...@@ -41,7 +41,7 @@ mpd_sint8 char_conv_latin1ToUtf8 = 0; ...@@ -41,7 +41,7 @@ mpd_sint8 char_conv_latin1ToUtf8 = 0;
#define BUFFER_SIZE 1024 #define BUFFER_SIZE 1024
static void closeCharSetConversion(); static void closeCharSetConversion(void);
int setCharSetConversion(char *to, char *from) int setCharSetConversion(char *to, char *from)
{ {
...@@ -122,7 +122,7 @@ char *convStrDup(char *string) ...@@ -122,7 +122,7 @@ char *convStrDup(char *string)
iconv(char_conv_iconv, &string, &inleft, &bufferPtr, iconv(char_conv_iconv, &string, &inleft, &bufferPtr,
&outleft); &outleft);
if (outleft == BUFFER_SIZE if (outleft == BUFFER_SIZE
|| (err < 0 && errno != E2BIG)) { || (err == -1L && errno != E2BIG)) {
free(ret); free(ret);
return NULL; return NULL;
} }
......
...@@ -138,7 +138,7 @@ static CommandEntry *getCommandEntryFromString(char *string, int *permission); ...@@ -138,7 +138,7 @@ static CommandEntry *getCommandEntryFromString(char *string, int *permission);
static List *commandList; static List *commandList;
CommandEntry *newCommandEntry(void) static CommandEntry *newCommandEntry(void)
{ {
CommandEntry *cmd = malloc(sizeof(CommandEntry)); CommandEntry *cmd = malloc(sizeof(CommandEntry));
cmd->cmd = NULL; cmd->cmd = NULL;
......
...@@ -39,9 +39,9 @@ int processListOfCommands(int fd, int *permission, int *expired, ...@@ -39,9 +39,9 @@ int processListOfCommands(int fd, int *permission, int *expired,
int processCommand(int fd, int *permission, char *commandString); int processCommand(int fd, int *permission, char *commandString);
void initCommands(); void initCommands(void);
void finishCommands(); void finishCommands(void);
#define commandSuccess(fd) fdprintf(fd, "OK\n") #define commandSuccess(fd) fdprintf(fd, "OK\n")
......
...@@ -89,7 +89,7 @@ static void freeConfigParam(ConfigParam * param) ...@@ -89,7 +89,7 @@ static void freeConfigParam(ConfigParam * param)
free(param); free(param);
} }
ConfigEntry *newConfigEntry(int repeatable, int block) static ConfigEntry *newConfigEntry(int repeatable, int block)
{ {
ConfigEntry *ret = malloc(sizeof(ConfigEntry)); ConfigEntry *ret = malloc(sizeof(ConfigEntry));
...@@ -105,7 +105,7 @@ ConfigEntry *newConfigEntry(int repeatable, int block) ...@@ -105,7 +105,7 @@ ConfigEntry *newConfigEntry(int repeatable, int block)
return ret; return ret;
} }
void freeConfigEntry(ConfigEntry * entry) static void freeConfigEntry(ConfigEntry * entry)
{ {
freeList(entry->configParamList); freeList(entry->configParamList);
free(entry); free(entry);
......
...@@ -73,8 +73,8 @@ typedef struct _ConfigParam { ...@@ -73,8 +73,8 @@ typedef struct _ConfigParam {
int numberOfBlockParams; int numberOfBlockParams;
} ConfigParam; } ConfigParam;
void initConf(); void initConf(void);
void finishConf(); void finishConf(void);
void readConf(char *file); void readConf(char *file);
......
...@@ -61,6 +61,6 @@ unsigned long sumSongTimesIn(int fd, char *name); ...@@ -61,6 +61,6 @@ unsigned long sumSongTimesIn(int fd, char *name);
int listAllUniqueTags(int fd, int type, int numConditiionals, int listAllUniqueTags(int fd, int type, int numConditiionals,
LocateTagItem * conditionals); LocateTagItem * conditionals);
void printSavedMemoryFromFilenames(); void printSavedMemoryFromFilenames(void);
#endif #endif
...@@ -487,7 +487,7 @@ static void advanceOutputBufferTo(OutputBuffer * cb, PlayerControl * pc, ...@@ -487,7 +487,7 @@ static void advanceOutputBufferTo(OutputBuffer * cb, PlayerControl * pc,
} }
} }
void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb)
{ {
int pause = 0; int pause = 0;
int quit = 0; int quit = 0;
......
...@@ -64,6 +64,6 @@ typedef struct _DecoderControl { ...@@ -64,6 +64,6 @@ typedef struct _DecoderControl {
void decodeSigHandler(int sig, siginfo_t * siginfo, void *v); void decodeSigHandler(int sig, siginfo_t * siginfo, void *v);
void decode(); void decode(void);
#endif #endif
...@@ -249,6 +249,11 @@ static void freeDirectoryStatFromDirectory(Directory * dir) ...@@ -249,6 +249,11 @@ static void freeDirectoryStatFromDirectory(Directory * dir)
dir->stat = NULL; dir->stat = NULL;
} }
static DirectoryList *newDirectoryList(void)
{
return makeList((ListFreeDataFunc *) freeDirectory, 1);
}
static Directory *newDirectory(char *dirname, Directory * parent) static Directory *newDirectory(char *dirname, Directory * parent)
{ {
Directory *directory; Directory *directory;
...@@ -279,11 +284,6 @@ static void freeDirectory(Directory * directory) ...@@ -279,11 +284,6 @@ static void freeDirectory(Directory * directory)
/*getDirectoryPath(NULL); */ /*getDirectoryPath(NULL); */
} }
static DirectoryList *newDirectoryList(void)
{
return makeList((ListFreeDataFunc *) freeDirectory, 1);
}
static void freeDirectoryList(DirectoryList * directoryList) static void freeDirectoryList(DirectoryList * directoryList)
{ {
freeList(directoryList); freeList(directoryList);
......
...@@ -39,31 +39,31 @@ typedef struct _Directory { ...@@ -39,31 +39,31 @@ typedef struct _Directory {
DirectoryStat *stat; DirectoryStat *stat;
} Directory; } Directory;
void readDirectoryDBIfUpdateIsFinished(); void readDirectoryDBIfUpdateIsFinished(void);
int isUpdatingDB(); int isUpdatingDB(void);
void directory_sigChldHandler(int pid, int status); void directory_sigChldHandler(int pid, int status);
int updateInit(int fd, List * pathList); int updateInit(int fd, List * pathList);
void initMp3Directory(); void initMp3Directory(void);
void closeMp3Directory(); void closeMp3Directory(void);
int printDirectoryInfo(int fd, char *dirname); int printDirectoryInfo(int fd, char *dirname);
int checkDirectoryDB(); int checkDirectoryDB(void);
int writeDirectoryDB(); int writeDirectoryDB(void);
int readDirectoryDB(); int readDirectoryDB(void);
void updateMp3Directory(); void updateMp3Directory(void);
Song *getSongFromDB(char *file); Song *getSongFromDB(char *file);
time_t getDbModTime(); time_t getDbModTime(void);
int traverseAllIn(int fd, char *name, int traverseAllIn(int fd, char *name,
int (*forEachSong) (int, Song *, void *), int (*forEachSong) (int, Song *, void *),
......
...@@ -91,9 +91,9 @@ InputPlugin *getInputPluginFromName(char *name); ...@@ -91,9 +91,9 @@ InputPlugin *getInputPluginFromName(char *name);
void printAllInputPluginSuffixes(FILE * fp); void printAllInputPluginSuffixes(FILE * fp);
/* this is where we "load" all the "plugins" ;-) */ /* this is where we "load" all the "plugins" ;-) */
void initInputPlugins(); void initInputPlugins(void);
/* this is where we "unload" all the "plugins" */ /* this is where we "unload" all the "plugins" */
void finishInputPlugins(); void finishInputPlugins(void);
#endif #endif
...@@ -53,7 +53,7 @@ void init_FlacData(FlacData * data, OutputBuffer * cb, ...@@ -53,7 +53,7 @@ void init_FlacData(FlacData * data, OutputBuffer * cb,
} }
static int flacFindVorbisCommentFloat(const FLAC__StreamMetadata * block, static int flacFindVorbisCommentFloat(const FLAC__StreamMetadata * block,
char *cmnt, float *fl) const char *cmnt, float *fl)
{ {
int offset = int offset =
FLAC__metadata_object_vorbiscomment_find_entry_from(block, 0, cmnt); FLAC__metadata_object_vorbiscomment_find_entry_from(block, 0, cmnt);
...@@ -82,20 +82,20 @@ static int flacFindVorbisCommentFloat(const FLAC__StreamMetadata * block, ...@@ -82,20 +82,20 @@ static int flacFindVorbisCommentFloat(const FLAC__StreamMetadata * block,
static void flacParseReplayGain(const FLAC__StreamMetadata * block, static void flacParseReplayGain(const FLAC__StreamMetadata * block,
FlacData * data) FlacData * data)
{ {
unsigned int found = 0; int found = 0;
if (data->replayGainInfo) if (data->replayGainInfo)
freeReplayGainInfo(data->replayGainInfo); freeReplayGainInfo(data->replayGainInfo);
data->replayGainInfo = newReplayGainInfo(); data->replayGainInfo = newReplayGainInfo();
found &= flacFindVorbisCommentFloat(block, "replaygain_album_gain", found |= flacFindVorbisCommentFloat(block, "replaygain_album_gain",
&data->replayGainInfo->albumGain); &data->replayGainInfo->albumGain);
found &= flacFindVorbisCommentFloat(block, "replaygain_album_peak", found |= flacFindVorbisCommentFloat(block, "replaygain_album_peak",
&data->replayGainInfo->albumPeak); &data->replayGainInfo->albumPeak);
found &= flacFindVorbisCommentFloat(block, "replaygain_track_gain", found |= flacFindVorbisCommentFloat(block, "replaygain_track_gain",
&data->replayGainInfo->trackGain); &data->replayGainInfo->trackGain);
found &= flacFindVorbisCommentFloat(block, "replaygain_track_peak", found |= flacFindVorbisCommentFloat(block, "replaygain_track_peak",
&data->replayGainInfo->trackPeak); &data->replayGainInfo->trackPeak);
if (!found) { if (!found) {
......
...@@ -40,7 +40,7 @@ ogg_stream_type ogg_stream_type_detect(InputStream * inStream) ...@@ -40,7 +40,7 @@ ogg_stream_type ogg_stream_type_detect(InputStream * inStream)
while (to_read) { while (to_read) {
r = readFromInputStream(inStream, buf, 1, to_read); r = readFromInputStream(inStream, buf, 1, to_read);
if (r < 0) if (inStream->error)
break; break;
to_read -= r; to_read -= r;
if (!r && !inputStreamAtEOF(inStream)) if (!r && !inputStreamAtEOF(inStream))
......
...@@ -239,7 +239,7 @@ static float getAacFloatTotalTime(char *file) ...@@ -239,7 +239,7 @@ static float getAacFloatTotalTime(char *file)
unsigned int sampleRate; unsigned int sampleRate;
unsigned char channels; unsigned char channels;
InputStream inStream; InputStream inStream;
size_t bread; long bread;
if (openInputStream(&inStream, file) < 0) if (openInputStream(&inStream, file) < 0)
return -1; return -1;
...@@ -291,7 +291,7 @@ static int aac_decode(OutputBuffer * cb, DecoderControl * dc, char *path) ...@@ -291,7 +291,7 @@ static int aac_decode(OutputBuffer * cb, DecoderControl * dc, char *path)
faacDecHandle decoder; faacDecHandle decoder;
faacDecFrameInfo frameInfo; faacDecFrameInfo frameInfo;
faacDecConfigurationPtr config; faacDecConfigurationPtr config;
size_t bread; long bread;
unsigned int sampleRate; unsigned int sampleRate;
unsigned char channels; unsigned char channels;
int eof = 0; int eof = 0;
......
...@@ -175,7 +175,7 @@ static int flac_decode(OutputBuffer * cb, DecoderControl * dc, ...@@ -175,7 +175,7 @@ static int flac_decode(OutputBuffer * cb, DecoderControl * dc,
dc->state = DECODE_STATE_STOP; dc->state = DECODE_STATE_STOP;
dc->stop = 0; dc->stop = 0;
fail: fail:
if (data.replayGainInfo) if (data.replayGainInfo)
freeReplayGainInfo(data.replayGainInfo); freeReplayGainInfo(data.replayGainInfo);
......
...@@ -145,6 +145,7 @@ typedef struct _mp3DecodeData { ...@@ -145,6 +145,7 @@ typedef struct _mp3DecodeData {
unsigned long bitRate; unsigned long bitRate;
InputStream *inStream; InputStream *inStream;
struct audio_dither dither; struct audio_dither dither;
enum mad_layer layer;
} mp3DecodeData; } mp3DecodeData;
static void initMp3DecodeData(mp3DecodeData * data, InputStream * inStream) static void initMp3DecodeData(mp3DecodeData * data, InputStream * inStream)
...@@ -167,6 +168,7 @@ static void initMp3DecodeData(mp3DecodeData * data, InputStream * inStream) ...@@ -167,6 +168,7 @@ static void initMp3DecodeData(mp3DecodeData * data, InputStream * inStream)
data->decodedFirstFrame = 0; data->decodedFirstFrame = 0;
data->flush = 1; data->flush = 1;
data->inStream = inStream; data->inStream = inStream;
data->layer = 0;
memset(&(data->dither), 0, sizeof(struct audio_dither)); memset(&(data->dither), 0, sizeof(struct audio_dither));
mad_stream_init(&data->stream); mad_stream_init(&data->stream);
...@@ -249,16 +251,16 @@ static ReplayGainInfo *parseId3ReplayGainInfo(struct id3_tag *tag) ...@@ -249,16 +251,16 @@ static ReplayGainInfo *parseId3ReplayGainInfo(struct id3_tag *tag)
id3_ucs4_latin1duplicate(id3_field_getstring id3_ucs4_latin1duplicate(id3_field_getstring
(&frame->fields[2])); (&frame->fields[2]));
if (strcmp(key, "replaygain_track_gain") == 0) { if (strcasecmp(key, "replaygain_track_gain") == 0) {
replayGainInfo->trackGain = atof(value); replayGainInfo->trackGain = atof(value);
found = 1; found = 1;
} else if (strcmp(key, "replaygain_album_gain") == 0) { } else if (strcasecmp(key, "replaygain_album_gain") == 0) {
replayGainInfo->albumGain = atof(value); replayGainInfo->albumGain = atof(value);
found = 1; found = 1;
} else if (strcmp(key, "replaygain_track_peak") == 0) { } else if (strcasecmp(key, "replaygain_track_peak") == 0) {
replayGainInfo->trackPeak = atof(value); replayGainInfo->trackPeak = atof(value);
found = 1; found = 1;
} else if (strcmp(key, "replaygain_album_peak") == 0) { } else if (strcasecmp(key, "replaygain_album_peak") == 0) {
replayGainInfo->albumPeak = atof(value); replayGainInfo->albumPeak = atof(value);
found = 1; found = 1;
} }
...@@ -343,7 +345,7 @@ static void mp3_parseId3Tag(mp3DecodeData * data, signed long tagsize, ...@@ -343,7 +345,7 @@ static void mp3_parseId3Tag(mp3DecodeData * data, signed long tagsize,
} }
id3_tag_delete(id3Tag); id3_tag_delete(id3Tag);
fail: fail:
if (allocated) if (allocated)
free(allocated); free(allocated);
} }
...@@ -352,6 +354,8 @@ static void mp3_parseId3Tag(mp3DecodeData * data, signed long tagsize, ...@@ -352,6 +354,8 @@ static void mp3_parseId3Tag(mp3DecodeData * data, signed long tagsize,
static int decodeNextFrameHeader(mp3DecodeData * data, MpdTag ** tag, static int decodeNextFrameHeader(mp3DecodeData * data, MpdTag ** tag,
ReplayGainInfo ** replayGainInfo) ReplayGainInfo ** replayGainInfo)
{ {
enum mad_layer layer;
if ((data->stream).buffer == NULL if ((data->stream).buffer == NULL
|| (data->stream).error == MAD_ERROR_BUFLEN) { || (data->stream).error == MAD_ERROR_BUFLEN) {
if (fillMp3InputBuffer(data) < 0) { if (fillMp3InputBuffer(data) < 0) {
...@@ -395,9 +399,16 @@ static int decodeNextFrameHeader(mp3DecodeData * data, MpdTag ** tag, ...@@ -395,9 +399,16 @@ static int decodeNextFrameHeader(mp3DecodeData * data, MpdTag ** tag,
} }
} }
} }
if ((data->frame.header.layer != MAD_LAYER_III) &&
(data->frame.header.layer != MAD_LAYER_II) && layer = data->frame.header.layer;
(data->frame.header.layer != MAD_LAYER_I)) { if (!data->layer) {
if (layer != MAD_LAYER_II && layer != MAD_LAYER_III) {
/* Only layer 2 and 3 have been tested to work */
return DECODE_SKIP;
}
data->layer = layer;
} else if (layer != data->layer) {
/* Don't decode frames with a different layer than the first */
return DECODE_SKIP; return DECODE_SKIP;
} }
...@@ -552,7 +563,7 @@ static int parse_xing(struct xing *xing, struct mad_bitptr *ptr, int *oldbitlen) ...@@ -552,7 +563,7 @@ static int parse_xing(struct xing *xing, struct mad_bitptr *ptr, int *oldbitlen)
*oldbitlen = bitlen; *oldbitlen = bitlen;
return 1; return 1;
fail: fail:
xing->flags = 0; xing->flags = 0;
return 0; return 0;
} }
...@@ -617,25 +628,21 @@ static int decodeFirstFrame(mp3DecodeData * data, DecoderControl * dc, ...@@ -617,25 +628,21 @@ static int decodeFirstFrame(mp3DecodeData * data, DecoderControl * dc,
struct mad_bitptr ptr; struct mad_bitptr ptr;
int bitlen; int bitlen;
int ret; int ret;
int skip;
/* stfu gcc */ /* stfu gcc */
memset(&xing, 0, sizeof(struct xing)); memset(&xing, 0, sizeof(struct xing));
xing.flags = 0; xing.flags = 0;
while (1) { while (1) {
skip = 0;
while ((ret = decodeNextFrameHeader(data, tag, replayGainInfo)) == DECODE_CONT && while ((ret = decodeNextFrameHeader(data, tag, replayGainInfo)) == DECODE_CONT &&
(!dc || !dc->stop)); (!dc || !dc->stop));
if (ret == DECODE_BREAK || (dc && dc->stop)) return -1;
if (ret == DECODE_SKIP) skip = 1; if (ret == DECODE_SKIP) continue;
else if (ret == DECODE_BREAK || (dc && dc->stop)) return -1;
while ((ret = decodeNextFrame(data)) == DECODE_CONT && while ((ret = decodeNextFrame(data)) == DECODE_CONT &&
(!dc || !dc->stop)); (!dc || !dc->stop));
if (ret == DECODE_BREAK || (dc && dc->stop)) return -1; if (ret == DECODE_BREAK || (dc && dc->stop)) return -1;
if (!skip && ret == DECODE_OK) break; if (ret == DECODE_OK) break;
} }
ptr = data->stream.anc_ptr; ptr = data->stream.anc_ptr;
......
...@@ -306,7 +306,7 @@ static OggFLAC__SeekableStreamDecoder ...@@ -306,7 +306,7 @@ static OggFLAC__SeekableStreamDecoder
return decoder; return decoder;
fail: fail:
oggflacPrintErroredState(OggFLAC__seekable_stream_decoder_get_state oggflacPrintErroredState(OggFLAC__seekable_stream_decoder_get_state
(decoder)); (decoder));
OggFLAC__seekable_stream_decoder_delete(decoder); OggFLAC__seekable_stream_decoder_delete(decoder);
...@@ -394,7 +394,7 @@ static int oggflac_decode(OutputBuffer * cb, DecoderControl * dc, ...@@ -394,7 +394,7 @@ static int oggflac_decode(OutputBuffer * cb, DecoderControl * dc,
dc->state = DECODE_STATE_STOP; dc->state = DECODE_STATE_STOP;
dc->stop = 0; dc->stop = 0;
fail: fail:
oggflac_cleanup(inStream, &data, decoder); oggflac_cleanup(inStream, &data, decoder);
return ret; return ret;
......
...@@ -383,8 +383,8 @@ static MpdTag *oggvorbis_TagDup(char *file) ...@@ -383,8 +383,8 @@ static MpdTag *oggvorbis_TagDup(char *file)
fp = fopen(file, "r"); fp = fopen(file, "r");
if (!fp) { if (!fp) {
DEBUG("oggTagDup: Failed to open file: '%s', %s\n", file, DEBUG("oggvorbis_TagDup: Failed to open file: '%s', %s\n",
strerror(errno)); file, strerror(errno));
return NULL; return NULL;
} }
if (ov_open(fp, &vf, NULL, 0) < 0) { if (ov_open(fp, &vf, NULL, 0) < 0) {
......
...@@ -49,7 +49,7 @@ struct _InputStream { ...@@ -49,7 +49,7 @@ struct _InputStream {
char *metaTitle; char *metaTitle;
}; };
void initInputStream(); void initInputStream(void);
int isUrlSaneForInputStream(char *url); int isUrlSaneForInputStream(char *url);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "inputStream.h" #include "inputStream.h"
void inputStream_initFile(); void inputStream_initFile(void);
int inputStream_fileOpen(InputStream * inStream, char *filename); int inputStream_fileOpen(InputStream * inStream, char *filename);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "inputStream.h" #include "inputStream.h"
void inputStream_initHttp(); void inputStream_initHttp(void);
int inputStream_httpOpen(InputStream * inStream, char *filename); int inputStream_httpOpen(InputStream * inStream, char *filename);
......
...@@ -332,10 +332,10 @@ static int processLineOfInput(Interface * interface) ...@@ -332,10 +332,10 @@ static int processLineOfInput(Interface * interface)
ERROR("interface %i: command " ERROR("interface %i: command "
"list size (%i) is " "list size (%i) is "
"larger than the max " "larger than the max "
"(%i)\n", "(%li)\n",
interface->num, interface->num,
interface->cmd_list_size, interface->cmd_list_size,
interface_max_command_list_size); (long)interface_max_command_list_size);
closeInterface(interface); closeInterface(interface);
ret = COMMAND_RETURN_CLOSE; ret = COMMAND_RETURN_CLOSE;
} else } else
......
...@@ -26,12 +26,12 @@ ...@@ -26,12 +26,12 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
void initInterfaces(); void initInterfaces(void);
void openAInterface(int fd, struct sockaddr *addr); void openAInterface(int fd, struct sockaddr *addr);
void freeAllInterfaces(); void freeAllInterfaces(void);
void closeOldInterfaces(); void closeOldInterfaces(void);
int interfacePrintWithFD(int fd, char *buffer, int len); int interfacePrintWithFD(int fd, char *buffer, int len);
int doIOForInterfaces(); int doIOForInterfaces(void);
#endif #endif
...@@ -26,12 +26,12 @@ ...@@ -26,12 +26,12 @@
#include <unistd.h> #include <unistd.h>
#include <sys/select.h> #include <sys/select.h>
void listenOnPort(); void listenOnPort(void);
void getConnections(fd_set * fds); void getConnections(fd_set * fds);
void closeAllListenSockets(); void closeAllListenSockets(void);
void freeAllListenSockets(); void freeAllListenSockets(void);
/* fdmax should be initialized to something */ /* fdmax should be initialized to something */
void addListenSocketsToFdSet(fd_set * fds, int *fdmax); void addListenSocketsToFdSet(fd_set * fds, int *fdmax);
......
...@@ -149,14 +149,14 @@ void open_log_files(const int use_stdout) ...@@ -149,14 +149,14 @@ void open_log_files(const int use_stdout)
prev = umask(0066); prev = umask(0066);
param = parseConfigFilePath(CONF_LOG_FILE, 1); param = parseConfigFilePath(CONF_LOG_FILE, 1);
out_filename = param->value; out_filename = param->value;
out_fd = xopen(out_filename, O_CREAT | O_WRONLY | O_APPEND, 0666); out_fd = open(out_filename, O_CREAT | O_WRONLY | O_APPEND, 0666);
if (out_fd < 0) if (out_fd < 0)
FATAL("problem opening log file \"%s\" (config line %i) for " FATAL("problem opening log file \"%s\" (config line %i) for "
"writing\n", param->value, param->line); "writing\n", param->value, param->line);
param = parseConfigFilePath(CONF_ERROR_FILE, 1); param = parseConfigFilePath(CONF_ERROR_FILE, 1);
err_filename = param->value; err_filename = param->value;
err_fd = xopen(err_filename, O_CREAT | O_WRONLY | O_APPEND, 0666); err_fd = open(err_filename, O_CREAT | O_WRONLY | O_APPEND, 0666);
if (err_fd < 0) if (err_fd < 0)
FATAL("problem opening error file \"%s\" (config line %i) for " FATAL("problem opening error file \"%s\" (config line %i) for "
"writing\n", param->value, param->line); "writing\n", param->value, param->line);
...@@ -226,13 +226,13 @@ int cycle_log_files(void) ...@@ -226,13 +226,13 @@ int cycle_log_files(void)
prev = umask(0066); prev = umask(0066);
out_fd = xopen(out_filename, O_CREAT | O_WRONLY | O_APPEND, 0666); out_fd = open(out_filename, O_CREAT | O_WRONLY | O_APPEND, 0666);
if (out_fd < 0) { if (out_fd < 0) {
ERROR("error re-opening log file: %s\n", out_filename); ERROR("error re-opening log file: %s\n", out_filename);
return -1; return -1;
} }
err_fd = xopen(err_filename, O_CREAT | O_WRONLY | O_APPEND, 0666); err_fd = open(err_filename, O_CREAT | O_WRONLY | O_APPEND, 0666);
if (err_fd < 0) { if (err_fd < 0) {
ERROR("error re-opening error file: %s\n", err_filename); ERROR("error re-opening error file: %s\n", err_filename);
return -1; return -1;
......
...@@ -46,6 +46,6 @@ int cycle_log_files(void); ...@@ -46,6 +46,6 @@ int cycle_log_files(void);
void close_log_files(void); void close_log_files(void);
void flushWarningLog(); void flushWarningLog(void);
#endif /* LOG_H */ #endif /* LOG_H */
...@@ -224,7 +224,7 @@ char *getSuffix(char *utf8file) ...@@ -224,7 +224,7 @@ char *getSuffix(char *utf8file)
return ret; return ret;
} }
int hasSuffix(char *utf8file, char *suffix) static int hasSuffix(char *utf8file, char *suffix)
{ {
char *s = getSuffix(utf8file); char *s = getSuffix(utf8file);
if (s && 0 == strcmp(s, suffix)) if (s && 0 == strcmp(s, suffix))
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include "drms.h" #include "drms.h"
int64_t mp4ff_get_track_duration_use_offsets(const mp4ff_t *f, const int32_t track);
mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f) mp4ff_t *mp4ff_open_read(mp4ff_callback_t *f)
{ {
mp4ff_t *ff = malloc(sizeof(mp4ff_t)); mp4ff_t *ff = malloc(sizeof(mp4ff_t));
...@@ -202,7 +204,7 @@ int32_t mp4ff_get_decoder_config(const mp4ff_t *f, const int32_t track, ...@@ -202,7 +204,7 @@ int32_t mp4ff_get_decoder_config(const mp4ff_t *f, const int32_t track,
return 0; return 0;
} }
int32_t mp4ff_get_track_type(const mp4ff_t *f, const int track) static int32_t mp4ff_get_track_type(const mp4ff_t *f, const int track)
{ {
return f->track[track]->type; return f->track[track]->type;
} }
...@@ -217,17 +219,17 @@ int32_t mp4ff_time_scale(const mp4ff_t *f, const int32_t track) ...@@ -217,17 +219,17 @@ int32_t mp4ff_time_scale(const mp4ff_t *f, const int32_t track)
return f->track[track]->timeScale; return f->track[track]->timeScale;
} }
uint32_t mp4ff_get_avg_bitrate(const mp4ff_t *f, const int32_t track) static uint32_t mp4ff_get_avg_bitrate(const mp4ff_t *f, const int32_t track)
{ {
return f->track[track]->avgBitrate; return f->track[track]->avgBitrate;
} }
uint32_t mp4ff_get_max_bitrate(const mp4ff_t *f, const int32_t track) static uint32_t mp4ff_get_max_bitrate(const mp4ff_t *f, const int32_t track)
{ {
return f->track[track]->maxBitrate; return f->track[track]->maxBitrate;
} }
int64_t mp4ff_get_track_duration(const mp4ff_t *f, const int32_t track) static int64_t mp4ff_get_track_duration(const mp4ff_t *f, const int32_t track)
{ {
return f->track[track]->duration; return f->track[track]->duration;
} }
...@@ -260,22 +262,22 @@ int32_t mp4ff_num_samples(const mp4ff_t *f, const int32_t track) ...@@ -260,22 +262,22 @@ int32_t mp4ff_num_samples(const mp4ff_t *f, const int32_t track)
uint32_t mp4ff_get_sample_rate(const mp4ff_t *f, const int32_t track) static uint32_t mp4ff_get_sample_rate(const mp4ff_t *f, const int32_t track)
{ {
return f->track[track]->sampleRate; return f->track[track]->sampleRate;
} }
uint32_t mp4ff_get_channel_count(const mp4ff_t * f,const int32_t track) static uint32_t mp4ff_get_channel_count(const mp4ff_t * f,const int32_t track)
{ {
return f->track[track]->channelCount; return f->track[track]->channelCount;
} }
uint32_t mp4ff_get_audio_type(const mp4ff_t * f,const int32_t track) static uint32_t mp4ff_get_audio_type(const mp4ff_t * f,const int32_t track)
{ {
return f->track[track]->audioType; return f->track[track]->audioType;
} }
int32_t mp4ff_get_sample_duration_use_offsets(const mp4ff_t *f, const int32_t track, const int32_t sample) static int32_t mp4ff_get_sample_duration_use_offsets(const mp4ff_t *f, const int32_t track, const int32_t sample)
{ {
int32_t d,o; int32_t d,o;
d = mp4ff_get_sample_duration(f,track,sample); d = mp4ff_get_sample_duration(f,track,sample);
...@@ -364,7 +366,7 @@ int32_t mp4ff_find_sample(const mp4ff_t *f, const int32_t track, const int64_t o ...@@ -364,7 +366,7 @@ int32_t mp4ff_find_sample(const mp4ff_t *f, const int32_t track, const int64_t o
return (int32_t)(-1); return (int32_t)(-1);
} }
int32_t mp4ff_find_sample_use_offsets(const mp4ff_t *f, const int32_t track, const int64_t offset,int32_t * toskip) static int32_t mp4ff_find_sample_use_offsets(const mp4ff_t *f, const int32_t track, const int64_t offset,int32_t * toskip)
{ {
return mp4ff_find_sample(f,track,offset + mp4ff_get_sample_offset(f,track,0),toskip); return mp4ff_find_sample(f,track,offset + mp4ff_get_sample_offset(f,track,0),toskip);
} }
...@@ -402,7 +404,7 @@ int32_t mp4ff_read_sample(mp4ff_t *f, const int32_t track, const int32_t sample, ...@@ -402,7 +404,7 @@ int32_t mp4ff_read_sample(mp4ff_t *f, const int32_t track, const int32_t sample,
} }
int32_t mp4ff_read_sample_v2(mp4ff_t *f, const int track, const int sample,unsigned char *buffer) static int32_t mp4ff_read_sample_v2(mp4ff_t *f, const int track, const int sample,unsigned char *buffer)
{ {
int32_t result = 0; int32_t result = 0;
int32_t size = mp4ff_audio_frame_size(f,track,sample); int32_t size = mp4ff_audio_frame_size(f,track,sample);
...@@ -420,7 +422,7 @@ int32_t mp4ff_read_sample_v2(mp4ff_t *f, const int track, const int sample,unsig ...@@ -420,7 +422,7 @@ int32_t mp4ff_read_sample_v2(mp4ff_t *f, const int track, const int sample,unsig
return result; return result;
} }
int32_t mp4ff_read_sample_getsize(mp4ff_t *f, const int track, const int sample) static int32_t mp4ff_read_sample_getsize(mp4ff_t *f, const int track, const int sample)
{ {
int32_t temp = mp4ff_audio_frame_size(f, track, sample); int32_t temp = mp4ff_audio_frame_size(f, track, sample);
if (temp<0) temp = 0; if (temp<0) temp = 0;
......
...@@ -43,7 +43,7 @@ typedef struct ...@@ -43,7 +43,7 @@ typedef struct
unsigned error; unsigned error;
} membuffer; } membuffer;
unsigned membuffer_write(membuffer * buf,const void * ptr,unsigned bytes) static unsigned membuffer_write(membuffer * buf,const void * ptr,unsigned bytes)
{ {
unsigned dest_size = buf->written + bytes; unsigned dest_size = buf->written + bytes;
...@@ -75,64 +75,64 @@ unsigned membuffer_write(membuffer * buf,const void * ptr,unsigned bytes) ...@@ -75,64 +75,64 @@ unsigned membuffer_write(membuffer * buf,const void * ptr,unsigned bytes)
#define membuffer_write_data membuffer_write #define membuffer_write_data membuffer_write
unsigned membuffer_write_int32(membuffer * buf,uint32_t data) static unsigned membuffer_write_int32(membuffer * buf,uint32_t data)
{ {
uint8_t temp[4] = {(uint8_t)(data>>24),(uint8_t)(data>>16),(uint8_t)(data>>8),(uint8_t)data}; uint8_t temp[4] = {(uint8_t)(data>>24),(uint8_t)(data>>16),(uint8_t)(data>>8),(uint8_t)data};
return membuffer_write_data(buf,temp,4); return membuffer_write_data(buf,temp,4);
} }
unsigned membuffer_write_int24(membuffer * buf,uint32_t data) static unsigned membuffer_write_int24(membuffer * buf,uint32_t data)
{ {
uint8_t temp[3] = {(uint8_t)(data>>16),(uint8_t)(data>>8),(uint8_t)data}; uint8_t temp[3] = {(uint8_t)(data>>16),(uint8_t)(data>>8),(uint8_t)data};
return membuffer_write_data(buf,temp,3); return membuffer_write_data(buf,temp,3);
} }
unsigned membuffer_write_int16(membuffer * buf,uint16_t data) static unsigned membuffer_write_int16(membuffer * buf,uint16_t data)
{ {
uint8_t temp[2] = {(uint8_t)(data>>8),(uint8_t)data}; uint8_t temp[2] = {(uint8_t)(data>>8),(uint8_t)data};
return membuffer_write_data(buf,temp,2); return membuffer_write_data(buf,temp,2);
} }
unsigned membuffer_write_atom_name(membuffer * buf,const char * data) static unsigned membuffer_write_atom_name(membuffer * buf,const char * data)
{ {
return membuffer_write_data(buf,data,4)==4 ? 1 : 0; return membuffer_write_data(buf,data,4)==4 ? 1 : 0;
} }
void membuffer_write_atom(membuffer * buf,const char * name,unsigned size,const void * data) static void membuffer_write_atom(membuffer * buf,const char * name,unsigned size,const void * data)
{ {
membuffer_write_int32(buf,size + 8); membuffer_write_int32(buf,size + 8);
membuffer_write_atom_name(buf,name); membuffer_write_atom_name(buf,name);
membuffer_write_data(buf,data,size); membuffer_write_data(buf,data,size);
} }
unsigned membuffer_write_string(membuffer * buf,const char * data) static unsigned membuffer_write_string(membuffer * buf,const char * data)
{ {
return membuffer_write_data(buf,data,strlen(data)); return membuffer_write_data(buf,data,strlen(data));
} }
unsigned membuffer_write_int8(membuffer * buf,uint8_t data) static unsigned membuffer_write_int8(membuffer * buf,uint8_t data)
{ {
return membuffer_write_data(buf,&data,1); return membuffer_write_data(buf,&data,1);
} }
void * membuffer_get_ptr(const membuffer * buf) static void * membuffer_get_ptr(const membuffer * buf)
{ {
return buf->data; return buf->data;
} }
unsigned membuffer_get_size(const membuffer * buf) static unsigned membuffer_get_size(const membuffer * buf)
{ {
return buf->written; return buf->written;
} }
unsigned membuffer_error(const membuffer * buf) static unsigned membuffer_error(const membuffer * buf)
{ {
return buf->error; return buf->error;
} }
void membuffer_set_error(membuffer * buf) {buf->error = 1;} static void membuffer_set_error(membuffer * buf) {buf->error = 1;}
unsigned membuffer_transfer_from_file(membuffer * buf,mp4ff_t * src,unsigned bytes) static unsigned membuffer_transfer_from_file(membuffer * buf,mp4ff_t * src,unsigned bytes)
{ {
unsigned oldsize; unsigned oldsize;
void * bufptr; void * bufptr;
...@@ -153,7 +153,7 @@ unsigned membuffer_transfer_from_file(membuffer * buf,mp4ff_t * src,unsigned byt ...@@ -153,7 +153,7 @@ unsigned membuffer_transfer_from_file(membuffer * buf,mp4ff_t * src,unsigned byt
} }
membuffer * membuffer_create() static membuffer * membuffer_create()
{ {
const unsigned initial_size = 256; const unsigned initial_size = 256;
...@@ -166,13 +166,13 @@ membuffer * membuffer_create() ...@@ -166,13 +166,13 @@ membuffer * membuffer_create()
return buf; return buf;
} }
void membuffer_free(membuffer * buf) static void membuffer_free(membuffer * buf)
{ {
if (buf->data) free(buf->data); if (buf->data) free(buf->data);
free(buf); free(buf);
} }
void * membuffer_detach(membuffer * buf) static void * membuffer_detach(membuffer * buf)
{ {
void * ret; void * ret;
...@@ -595,7 +595,7 @@ static uint32_t modify_moov(mp4ff_t * f,const mp4ff_metadata_t * data,void ** ou ...@@ -595,7 +595,7 @@ static uint32_t modify_moov(mp4ff_t * f,const mp4ff_metadata_t * data,void ** ou
} }
int32_t mp4ff_meta_update(mp4ff_callback_t *f,const mp4ff_metadata_t * data) static int32_t mp4ff_meta_update(mp4ff_callback_t *f,const mp4ff_metadata_t * data)
{ {
void * new_moov_data; void * new_moov_data;
uint32_t new_moov_size; uint32_t new_moov_size;
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
static void blockingWrite(const int fd, const char *string, size_t len) static void blockingWrite(const int fd, const char *string, size_t len)
{ {
while (len) { while (len) {
size_t ret = xwrite(fd, string, len); ssize_t ret = xwrite(fd, string, len);
if (ret == len) if (ret == len)
return; return;
if (ret >= 0) { if (ret >= 0) {
......
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
extern int normalizationEnabled; extern int normalizationEnabled;
void initNormalization(); void initNormalization(void);
void finishNormalization(); void finishNormalization(void);
void normalizeData(char *buffer, int bufferSize, AudioFormat *format); void normalizeData(char *buffer, int bufferSize, AudioFormat *format);
......
...@@ -25,9 +25,9 @@ ...@@ -25,9 +25,9 @@
extern const char *musicDir; extern const char *musicDir;
void initPaths(); void initPaths(void);
void finishPaths(); void finishPaths(void);
/* utf8ToFsCharset() and fsCharsetToUtf8() /* utf8ToFsCharset() and fsCharsetToUtf8()
* Each returns a static pointer to a dynamically allocated buffer * Each returns a static pointer to a dynamically allocated buffer
...@@ -44,7 +44,7 @@ char *fsCharsetToUtf8(char *str); ...@@ -44,7 +44,7 @@ char *fsCharsetToUtf8(char *str);
void setFsCharset(char *charset); void setFsCharset(char *charset);
char *getFsCharset(); char *getFsCharset(void);
/* relative music path to absolute music path /* relative music path to absolute music path
* char * passed is a static variable, so don't free it * char * passed is a static variable, so don't free it
......
...@@ -27,12 +27,13 @@ ...@@ -27,12 +27,13 @@
#define PERMISSION_CONTROL 4 #define PERMISSION_CONTROL 4
#define PERMISSION_ADMIN 8 #define PERMISSION_ADMIN 8
void initPermissions();
int getPermissionFromPassword(char *password, int *permission); int getPermissionFromPassword(char *password, int *permission);
void finishPermissions(); void finishPermissions(void);
int getDefaultPermissions(); int getDefaultPermissions(void);
void initPermissions(void);
#endif #endif
...@@ -60,7 +60,7 @@ static void resetPlayerMetadata(void) ...@@ -60,7 +60,7 @@ static void resetPlayerMetadata(void)
} }
} }
void resetPlayer(void) static void resetPlayer(void)
{ {
int pid; int pid;
......
...@@ -89,7 +89,7 @@ typedef struct _PlayerControl { ...@@ -89,7 +89,7 @@ typedef struct _PlayerControl {
MetadataChunk fileMetadataChunk; MetadataChunk fileMetadataChunk;
} PlayerControl; } PlayerControl;
void clearPlayerPid(); void clearPlayerPid(void);
void player_sigChldHandler(int pid, int status); void player_sigChldHandler(int pid, int status);
...@@ -101,54 +101,54 @@ int playerPause(int fd); ...@@ -101,54 +101,54 @@ int playerPause(int fd);
int playerStop(int fd); int playerStop(int fd);
void playerCloseAudio(); void playerCloseAudio(void);
void playerKill(); void playerKill(void);
int getPlayerTotalTime(); int getPlayerTotalTime(void);
int getPlayerElapsedTime(); int getPlayerElapsedTime(void);
unsigned long getPlayerBitRate(); unsigned long getPlayerBitRate(void);
int getPlayerState(); int getPlayerState(void);
void clearPlayerError(); void clearPlayerError(void);
char *getPlayerErrorStr(); char *getPlayerErrorStr(void);
int getPlayerError(); int getPlayerError(void);
int playerInit(); int playerInit(void);
int queueSong(Song * song); int queueSong(Song * song);
int getPlayerQueueState(); int getPlayerQueueState(void);
void setQueueState(int queueState); void setQueueState(int queueState);
void playerQueueLock(); void playerQueueLock(void);
void playerQueueUnlock(); void playerQueueUnlock(void);
int playerSeek(int fd, Song * song, float time); int playerSeek(int fd, Song * song, float time);
void setPlayerCrossFade(float crossFadeInSeconds); void setPlayerCrossFade(float crossFadeInSeconds);
float getPlayerCrossFade(); float getPlayerCrossFade(void);
void setPlayerSoftwareVolume(int volume); void setPlayerSoftwareVolume(int volume);
double getPlayerTotalPlayTime(); double getPlayerTotalPlayTime(void);
unsigned int getPlayerSampleRate(); unsigned int getPlayerSampleRate(void);
int getPlayerBits(); int getPlayerBits(void);
int getPlayerChannels(); int getPlayerChannels(void);
void playerCycleLogFiles(); void playerCycleLogFiles(void);
Song *playerCurrentDecodeSong(); Song *playerCurrentDecodeSong(void);
#endif #endif
...@@ -64,7 +64,7 @@ void initPlayerData(void) ...@@ -64,7 +64,7 @@ void initPlayerData(void)
buffered_chunks = bufferSize / CHUNK_SIZE; buffered_chunks = bufferSize / CHUNK_SIZE;
if (buffered_chunks >= 1 << 15) { if (buffered_chunks >= 1 << 15) {
ERROR("buffer size \"%i\" is too big\n", bufferSize); ERROR("buffer size \"%li\" is too big\n", (long)bufferSize);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
......
...@@ -40,10 +40,10 @@ typedef struct _PlayerData { ...@@ -40,10 +40,10 @@ typedef struct _PlayerData {
mpd_uint8 *audioDeviceStates; mpd_uint8 *audioDeviceStates;
} PlayerData; } PlayerData;
void initPlayerData(); void initPlayerData(void);
PlayerData *getPlayerData(); PlayerData *getPlayerData(void);
void freePlayerData(); void freePlayerData(void);
#endif #endif
...@@ -385,7 +385,7 @@ void readPlaylistState(FILE *fp) ...@@ -385,7 +385,7 @@ void readPlaylistState(FILE *fp)
} }
} }
void printPlaylistSongInfo(int fd, int song) static void printPlaylistSongInfo(int fd, int song)
{ {
printSongInfo(fd, playlist.songs[song]); printSongInfo(fd, playlist.songs[song]);
fdprintf(fd, "Pos: %i\nId: %i\n", song, playlist.positionToId[song]); fdprintf(fd, "Pos: %i\nId: %i\n", song, playlist.positionToId[song]);
...@@ -472,7 +472,7 @@ int playlistId(int fd, int id) ...@@ -472,7 +472,7 @@ int playlistId(int fd, int id)
return 0; return 0;
} }
void swapSongs(int song1, int song2) static void swapSongs(int song1, int song2)
{ {
Song *sTemp; Song *sTemp;
int iTemp; int iTemp;
...@@ -492,7 +492,7 @@ void swapSongs(int song1, int song2) ...@@ -492,7 +492,7 @@ void swapSongs(int song1, int song2)
playlist.positionToId[song2] = iTemp; playlist.positionToId[song2] = iTemp;
} }
void queueNextSongInPlaylist(void) static void queueNextSongInPlaylist(void)
{ {
if (playlist.current < playlist.length - 1) { if (playlist.current < playlist.length - 1) {
playlist.queued = playlist.current + 1; playlist.queued = playlist.current + 1;
...@@ -522,7 +522,7 @@ void queueNextSongInPlaylist(void) ...@@ -522,7 +522,7 @@ void queueNextSongInPlaylist(void)
} }
} }
void syncPlaylistWithQueue(int queue) static void syncPlaylistWithQueue(int queue)
{ {
if (queue && getPlayerQueueState() == PLAYER_QUEUE_BLANK) { if (queue && getPlayerQueueState() == PLAYER_QUEUE_BLANK) {
queueNextSongInPlaylist(); queueNextSongInPlaylist();
...@@ -543,7 +543,7 @@ void syncPlaylistWithQueue(int queue) ...@@ -543,7 +543,7 @@ void syncPlaylistWithQueue(int queue)
} }
} }
void lockPlaylistInteraction(void) static void lockPlaylistInteraction(void)
{ {
if (getPlayerQueueState() == PLAYER_QUEUE_PLAY || if (getPlayerQueueState() == PLAYER_QUEUE_PLAY ||
getPlayerQueueState() == PLAYER_QUEUE_FULL) { getPlayerQueueState() == PLAYER_QUEUE_FULL) {
...@@ -557,7 +557,7 @@ static void unlockPlaylistInteraction(void) ...@@ -557,7 +557,7 @@ static void unlockPlaylistInteraction(void)
playerQueueUnlock(); playerQueueUnlock();
} }
void clearPlayerQueue(void) static void clearPlayerQueue(void)
{ {
playlist.queued = -1; playlist.queued = -1;
switch (getPlayerQueueState()) { switch (getPlayerQueueState()) {
...@@ -901,7 +901,7 @@ int playPlaylistById(int fd, int id, int stopOnError) ...@@ -901,7 +901,7 @@ int playPlaylistById(int fd, int id, int stopOnError)
return playPlaylist(fd, playlist.idToPosition[id], stopOnError); return playPlaylist(fd, playlist.idToPosition[id], stopOnError);
} }
void syncCurrentPlayerDecodeMetadata(void) static void syncCurrentPlayerDecodeMetadata(void)
{ {
Song *songPlayer = playerCurrentDecodeSong(); Song *songPlayer = playerCurrentDecodeSong();
Song *song; Song *song;
...@@ -940,7 +940,7 @@ void syncPlayerAndPlaylist(void) ...@@ -940,7 +940,7 @@ void syncPlayerAndPlaylist(void)
syncCurrentPlayerDecodeMetadata(); syncCurrentPlayerDecodeMetadata();
} }
int currentSongInPlaylist(int fd) static int currentSongInPlaylist(int fd)
{ {
if (playlist_state != PLAYLIST_STATE_PLAY) if (playlist_state != PLAYLIST_STATE_PLAY)
return 0; return 0;
......
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
#define PLAYLIST_FILE_SUFFIX "m3u" #define PLAYLIST_FILE_SUFFIX "m3u"
void initPlaylist(); void initPlaylist(void);
void finishPlaylist(); void finishPlaylist(void);
void readPlaylistState(FILE *); void readPlaylistState(FILE *);
...@@ -62,7 +62,7 @@ int playPlaylistById(int fd, int song, int stopOnError); ...@@ -62,7 +62,7 @@ int playPlaylistById(int fd, int song, int stopOnError);
int nextSongInPlaylist(int fd); int nextSongInPlaylist(int fd);
void syncPlayerAndPlaylist(); void syncPlayerAndPlaylist(void);
int previousSongInPlaylist(int fd); int previousSongInPlaylist(int fd);
...@@ -86,29 +86,29 @@ int swapSongsInPlaylistById(int fd, int id1, int id2); ...@@ -86,29 +86,29 @@ int swapSongsInPlaylistById(int fd, int id1, int id2);
int loadPlaylist(int fd, char *utf8file); int loadPlaylist(int fd, char *utf8file);
int getPlaylistRepeatStatus(); int getPlaylistRepeatStatus(void);
int setPlaylistRepeatStatus(int fd, int status); int setPlaylistRepeatStatus(int fd, int status);
int getPlaylistRandomStatus(); int getPlaylistRandomStatus(void);
int setPlaylistRandomStatus(int fd, int status); int setPlaylistRandomStatus(int fd, int status);
int getPlaylistCurrentSong(); int getPlaylistCurrentSong(void);
int getPlaylistSongId(int song); int getPlaylistSongId(int song);
int getPlaylistLength(); int getPlaylistLength(void);
unsigned long getPlaylistVersion(); unsigned long getPlaylistVersion(void);
void playPlaylistIfPlayerStopped(); void playPlaylistIfPlayerStopped(void);
int seekSongInPlaylist(int fd, int song, float time); int seekSongInPlaylist(int fd, int song, float time);
int seekSongInPlaylistById(int fd, int id, float time); int seekSongInPlaylistById(int fd, int id, float time);
void playlistVersionChange(); void playlistVersionChange(void);
int playlistChanges(int fd, mpd_uint32 version); int playlistChanges(int fd, mpd_uint32 version);
......
...@@ -38,11 +38,11 @@ typedef struct _ReplayGainInfo { ...@@ -38,11 +38,11 @@ typedef struct _ReplayGainInfo {
float scale; float scale;
} ReplayGainInfo; } ReplayGainInfo;
ReplayGainInfo *newReplayGainInfo(); ReplayGainInfo *newReplayGainInfo(void);
void freeReplayGainInfo(ReplayGainInfo * info); void freeReplayGainInfo(ReplayGainInfo * info);
void initReplayGainState(); void initReplayGainState(void);
void doReplayGain(ReplayGainInfo * info, char *buffer, int bufferSize, void doReplayGain(ReplayGainInfo * info, char *buffer, int bufferSize,
AudioFormat * format); AudioFormat * format);
......
...@@ -58,7 +58,7 @@ int handlePendingSignals(void) ...@@ -58,7 +58,7 @@ int handlePendingSignals(void)
return 0; return 0;
} }
void chldSigHandler(int signal) static void chldSigHandler(int signal)
{ {
int status; int status;
int pid; int pid;
......
...@@ -21,22 +21,22 @@ ...@@ -21,22 +21,22 @@
#include "../config.h" #include "../config.h"
int handlePendingSignals(); int handlePendingSignals(void);
void initSigHandlers(); void initSigHandlers(void);
void finishSigHandlers(); void finishSigHandlers(void);
void setSigHandlersForDecoder(); void setSigHandlersForDecoder(void);
void ignoreSignals(); void ignoreSignals(void);
void blockSignals(); void blockSignals(void);
void unblockSignals(); void unblockSignals(void);
void blockTermSignal(); void blockTermSignal(void);
void unblockTermSignal(); void unblockTermSignal(void);
#endif #endif
...@@ -43,7 +43,7 @@ typedef struct _Song { ...@@ -43,7 +43,7 @@ typedef struct _Song {
typedef List SongList; typedef List SongList;
Song *newNullSong(); Song *newNullSong(void);
Song *newSong(char *url, int songType, struct _Directory *parentDir); Song *newSong(char *url, int songType, struct _Directory *parentDir);
...@@ -51,7 +51,7 @@ void freeSong(Song *); ...@@ -51,7 +51,7 @@ void freeSong(Song *);
void freeJustSong(Song *); void freeJustSong(Song *);
SongList *newSongList(); SongList *newSongList(void);
void freeSongList(SongList * list); void freeSongList(SongList * list);
......
...@@ -33,7 +33,7 @@ typedef struct _Stats { ...@@ -33,7 +33,7 @@ typedef struct _Stats {
extern Stats stats; extern Stats stats;
void initStats(); void initStats(void);
int printStats(int fd); int printStats(int fd);
......
...@@ -65,9 +65,9 @@ MpdTag *apeDup(char *file); ...@@ -65,9 +65,9 @@ MpdTag *apeDup(char *file);
MpdTag *id3Dup(char *file); MpdTag *id3Dup(char *file);
MpdTag *newMpdTag(); MpdTag *newMpdTag(void);
void initTagConfig(); void initTagConfig(void);
void clearItemsFromMpdTag(MpdTag * tag, int itemType); void clearItemsFromMpdTag(MpdTag * tag, int itemType);
......
...@@ -350,8 +350,7 @@ _MergeNodes(TreeNode * lessNode, TreeNode * moreNode) ...@@ -350,8 +350,7 @@ _MergeNodes(TreeNode * lessNode, TreeNode * moreNode)
free(moreNode); free(moreNode);
} }
void static void _DeleteAt(TreeIterator * iter)
_DeleteAt(TreeIterator * iter)
{ {
TreeNode * node = iter->node; TreeNode * node = iter->node;
int pos = iter->which - 1; int pos = iter->which - 1;
......
...@@ -39,20 +39,13 @@ void stripReturnChar(char *string); ...@@ -39,20 +39,13 @@ void stripReturnChar(char *string);
void my_usleep(long usec); void my_usleep(long usec);
int ipv6Supported(); int ipv6Supported(void);
char *appendToString(char *dest, const char *src); char *appendToString(char *dest, const char *src);
unsigned long readLEuint32(const unsigned char *p); unsigned long readLEuint32(const unsigned char *p);
/* trivial functions, keep them inlined */ /* trivial functions, keep them inlined */
static inline int xopen(const char *path, int flags, mode_t mode)
{
int fd;
while(0>(fd = open(path,flags,mode)) && errno == EINTR);
return fd;
}
static inline void xclose(int fd) static inline void xclose(int fd)
{ {
while (close(fd) && errno == EINTR); while (close(fd) && errno == EINTR);
......
...@@ -27,13 +27,13 @@ ...@@ -27,13 +27,13 @@
#define VOLUME_MIXER_ALSA "alsa" #define VOLUME_MIXER_ALSA "alsa"
#define VOLUME_MIXER_SOFTWARE "software" #define VOLUME_MIXER_SOFTWARE "software"
void initVolume(); void initVolume(void);
void openVolumeDevice(); void openVolumeDevice(void);
void finishVolume(); void finishVolume(void);
int getVolumeLevel(); int getVolumeLevel(void);
int changeVolumeLevel(int fd, int change, int rel); int changeVolumeLevel(int fd, int change, int rel);
......
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