From a234780aab8b2d693502e03165f658f96c956969 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 17 Jul 2006 00:15:34 +0000 Subject: sparse: ANSI-fy function declarations These are just warnings from sparse, but it makes the output easier to read. I ran this through a quick perl script, but of course verified the output by looking at the diff and making sure the thing still compiles. here's the quick perl script I wrote to generate this patch: ----------- 8< ----------- use Tie::File; defined(my $pid = open my $fh, '-|') or die $!; if (!$pid) { open STDERR, '>&STDOUT' or die $!; exec 'sparse', @ARGV or die $!; } my $na = 'warning: non-ANSI function declaration of function'; while (<$fh>) { print STDERR $_; if (/^(.+?\.[ch]):(\d+):(\d+): $na '(\w+)'/o) { my ($f, $l, $pos, $func) = ($1, $2, $3, $4); $l--; tie my @x, 'Tie::File', $f or die "$!: $f"; print '-', $x[$l], "\n"; $x[$l] =~ s/\b($func\s*)\(\s*\)/$1(void)/; print '+', $x[$l], "\n"; untie @x; } } git-svn-id: https://svn.musicpd.org/mpd/trunk@4378 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/audio.c | 22 +++++++++--------- src/audioOutput.c | 4 ++-- src/audioOutputs/audioOutput_alsa.c | 4 ++-- src/audioOutputs/audioOutput_oss.c | 4 ++-- src/audioOutputs/audioOutput_shout.c | 2 +- src/charConv.c | 2 +- src/command.c | 6 ++--- src/conf.c | 4 ++-- src/dbUtils.c | 2 +- src/inputPlugin.c | 4 ++-- src/inputPlugins/mod_plugin.c | 12 +++++----- src/inputStream.c | 2 +- src/inputStream_file.c | 2 +- src/inputStream_http.c | 4 ++-- src/interface.c | 12 +++++----- src/listen.c | 6 ++--- src/log.c | 4 ++-- src/myfprintf.c | 4 ++-- src/path.c | 6 ++--- src/permission.c | 6 ++--- src/playerData.c | 8 +++---- src/playlist.c | 44 ++++++++++++++++++------------------ src/replayGain.c | 4 ++-- src/song.c | 4 ++-- src/stats.c | 2 +- src/tag.c | 4 ++-- src/tagTracker.c | 2 +- src/utils.c | 2 +- src/volume.c | 14 ++++++------ 29 files changed, 98 insertions(+), 98 deletions(-) diff --git a/src/audio.c b/src/audio.c index 8180b290b..4d4889b6c 100644 --- a/src/audio.c +++ b/src/audio.c @@ -80,7 +80,7 @@ extern AudioOutputPlugin mvpPlugin; extern AudioOutputPlugin shoutPlugin; -void loadAudioDrivers() { +void loadAudioDrivers(void) { initAudioOutputPlugins(); loadAudioOutputPlugin(&alsaPlugin); loadAudioOutputPlugin(&aoPlugin); @@ -92,7 +92,7 @@ void loadAudioDrivers() { } /* make sure initPlayerData is called before this function!! */ -void initAudioDriver() { +void initAudioDriver(void) { ConfigParam * param = NULL; int i; @@ -152,7 +152,7 @@ void getOutputAudioFormat(AudioFormat * inAudioFormat, else copyAudioFormat(outAudioFormat,inAudioFormat); } -void initAudioConfig() { +void initAudioConfig(void) { ConfigParam * param = getConfigParam(CONF_AUDIO_OUTPUT_FORMAT); if(NULL == param || NULL == param->value) return; @@ -232,11 +232,11 @@ int parseAudioConfig(AudioFormat * audioFormat, char * conf) { return 0; } -void finishAudioConfig() { +void finishAudioConfig(void) { if(audio_configFormat) free(audio_configFormat); } -void finishAudioDriver() { +void finishAudioDriver(void) { int i; for(i = 0; i < audioOutputArraySize; i++) { @@ -272,7 +272,7 @@ static void syncAudioDevicesEnabledArrays(void) { } } -static int flushAudioBuffer() { +static int flushAudioBuffer(void) { int ret = -1; int i, err; @@ -356,11 +356,11 @@ int playAudio(char * playChunk, int size) { return 0; } -int isAudioDeviceOpen() { +int isAudioDeviceOpen(void) { return audioOpened; } -void dropBufferedAudio() { +void dropBufferedAudio(void) { int i; if(0 != memcmp(pdAudioDevicesEnabled, myAudioDevicesEnabled, @@ -377,7 +377,7 @@ void dropBufferedAudio() { } } -void closeAudioDevice() { +void closeAudioDevice(void) { int i; flushAudioBuffer(); @@ -436,7 +436,7 @@ void printAudioDevices(FILE * fp) { } } -void saveAudioDevicesState() { +void saveAudioDevicesState(void) { char *stateFile; FILE *fp; int i; @@ -494,7 +494,7 @@ errline: } } -void readAudioDevicesState() { +void readAudioDevicesState(void) { char *stateFile; FILE *fp; struct stat st; diff --git a/src/audioOutput.c b/src/audioOutput.c index e3bd68c4f..bda61941b 100644 --- a/src/audioOutput.c +++ b/src/audioOutput.c @@ -41,11 +41,11 @@ void unloadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin) { deleteFromList(audioOutputPluginList, audioOutputPlugin->name); } -void initAudioOutputPlugins() { +void initAudioOutputPlugins(void) { audioOutputPluginList = makeList(NULL, 0); } -void finishAudioOutputPlugins() { +void finishAudioOutputPlugins(void) { freeList(audioOutputPluginList); } diff --git a/src/audioOutputs/audioOutput_alsa.c b/src/audioOutputs/audioOutput_alsa.c index 3abd81f31..51531c5f0 100644 --- a/src/audioOutputs/audioOutput_alsa.c +++ b/src/audioOutputs/audioOutput_alsa.c @@ -54,7 +54,7 @@ typedef struct _AlsaData { int canResume; } AlsaData; -static AlsaData * newAlsaData() { +static AlsaData * newAlsaData(void) { AlsaData * ret = malloc(sizeof(AlsaData)); ret->device = NULL; @@ -100,7 +100,7 @@ static void alsa_finishDriver(AudioOutput * audioOutput) { freeAlsaData(ad); } -static int alsa_testDefault() +static int alsa_testDefault(void) { snd_pcm_t * handle; diff --git a/src/audioOutputs/audioOutput_oss.c b/src/audioOutputs/audioOutput_oss.c index 3b52b9807..ce049a14a 100644 --- a/src/audioOutputs/audioOutput_oss.c +++ b/src/audioOutputs/audioOutput_oss.c @@ -226,7 +226,7 @@ static void unsupportParam(OssData * od, int param, int val) { addUnsupportedParam(od, param, val); } -static OssData * newOssData() { +static OssData * newOssData(void) { OssData * ret = malloc(sizeof(OssData)); ret->device = NULL; @@ -298,7 +298,7 @@ static int oss_statDevice(char * device, int * stErrno) { return 0; } -static int oss_testDefault() { +static int oss_testDefault(void) { int fd; fd = open("/dev/sound/dsp", O_WRONLY); diff --git a/src/audioOutputs/audioOutput_shout.c b/src/audioOutputs/audioOutput_shout.c index 889166903..6fb40ea7b 100644 --- a/src/audioOutputs/audioOutput_shout.c +++ b/src/audioOutputs/audioOutput_shout.c @@ -72,7 +72,7 @@ typedef struct _ShoutData { AudioFormat * audioFormat; } ShoutData; -static ShoutData * newShoutData() { +static ShoutData * newShoutData(void) { ShoutData * ret = malloc(sizeof(ShoutData)); ret->shoutConn = shout_new(); diff --git a/src/charConv.c b/src/charConv.c index 68ea3e357..ee6796c58 100644 --- a/src/charConv.c +++ b/src/charConv.c @@ -135,7 +135,7 @@ char * convStrDup(char * string) { return NULL; } -static void closeCharSetConversion() { +static void closeCharSetConversion(void) { if(char_conv_to) { #ifdef HAVE_ICONV if(char_conv_use_iconv) iconv_close(char_conv_iconv); diff --git a/src/command.c b/src/command.c index 8283c3961..c4fecb2ff 100644 --- a/src/command.c +++ b/src/command.c @@ -128,7 +128,7 @@ static CommandEntry * getCommandEntryFromString(char * string, int * permission) List * commandList; -CommandEntry * newCommandEntry() { +CommandEntry * newCommandEntry(void) { CommandEntry * cmd = malloc(sizeof(CommandEntry)); cmd->cmd = NULL; cmd->min = 0; @@ -934,7 +934,7 @@ static int handleNotcommands(FILE * fp, unsigned int * permission, int argArrayL return 0; } -void initCommands() { +void initCommands(void) { commandList = makeList(free, 1); addCommand(COMMAND_PLAY ,PERMISSION_CONTROL, 0, 1,handlePlay,NULL); @@ -995,7 +995,7 @@ void initCommands() { sortList(commandList); } -void finishCommands() { +void finishCommands(void) { freeList(commandList); } diff --git a/src/conf.c b/src/conf.c index cbf94bdd7..6eceb5001 100644 --- a/src/conf.c +++ b/src/conf.c @@ -112,11 +112,11 @@ static void registerConfigParam(char * name, int repeatable, int block) { insertInList(configEntriesList, name, entry); } -void finishConf() { +void finishConf(void) { freeList(configEntriesList); } -void initConf() { +void initConf(void) { configEntriesList = makeList((ListFreeDataFunc *)freeConfigEntry, 1); /* registerConfigParam(name, repeatable, block); */ diff --git a/src/dbUtils.c b/src/dbUtils.c index 236d0d734..0a19ff60d 100644 --- a/src/dbUtils.c +++ b/src/dbUtils.c @@ -409,7 +409,7 @@ static int sumSavedFilenameMemoryInSong(FILE * fp, Song * song, void * data) { return 0; } -void printSavedMemoryFromFilenames() { +void printSavedMemoryFromFilenames(void) { int sum = 0; traverseAllIn(stderr, NULL, sumSavedFilenameMemoryInSong, diff --git a/src/inputPlugin.c b/src/inputPlugin.c index 55dcf01e4..14844bdf7 100644 --- a/src/inputPlugin.c +++ b/src/inputPlugin.c @@ -130,7 +130,7 @@ extern InputPlugin mpcPlugin; extern InputPlugin aacPlugin; extern InputPlugin modPlugin; -void initInputPlugins() { +void initInputPlugins(void) { inputPlugin_list = makeList(NULL, 1); /* load plugins here */ @@ -144,6 +144,6 @@ void initInputPlugins() { loadInputPlugin(&modPlugin); } -void finishInputPlugins() { +void finishInputPlugins(void) { freeList(inputPlugin_list); } diff --git a/src/inputPlugins/mod_plugin.c b/src/inputPlugins/mod_plugin.c index abdd08ba9..7a2a053e3 100644 --- a/src/inputPlugins/mod_plugin.c +++ b/src/inputPlugins/mod_plugin.c @@ -39,18 +39,18 @@ #define MIKMOD_FRAME_SIZE 4096 -static BOOL mod_mpd_Init() { +static BOOL mod_mpd_Init(void) { return VC_Init(); } -static void mod_mpd_Exit() { +static void mod_mpd_Exit(void) { VC_Exit(); } -static void mod_mpd_Update() { +static void mod_mpd_Update(void) { } -static BOOL mod_mpd_IsThere() { +static BOOL mod_mpd_IsThere(void) { return 1; } @@ -92,7 +92,7 @@ MDRIVER drv_mpd = static int mod_mikModInitiated = 0; static int mod_mikModInitError = 0; -static int mod_initMikMod() { +static int mod_initMikMod(void) { if(mod_mikModInitError) return -1; if(!mod_mikModInitiated) { @@ -120,7 +120,7 @@ static int mod_initMikMod() { return 0; } -void mod_finishMikMod() { +void mod_finishMikMod(void) { MikMod_Exit(); } diff --git a/src/inputStream.c b/src/inputStream.c index a42a80e9c..51c8f3aa1 100644 --- a/src/inputStream.c +++ b/src/inputStream.c @@ -25,7 +25,7 @@ #include #include -void initInputStream() { +void initInputStream(void) { inputStream_initFile(); inputStream_initHttp(); } diff --git a/src/inputStream_file.c b/src/inputStream_file.c index 96d846220..db1ca7cb4 100644 --- a/src/inputStream_file.c +++ b/src/inputStream_file.c @@ -26,7 +26,7 @@ #include #include -void inputStream_initFile() { +void inputStream_initFile(void) { } int inputStream_fileOpen(InputStream * inStream, char * filename) { diff --git a/src/inputStream_http.c b/src/inputStream_http.c index 35aa9ea0c..3eefdf516 100644 --- a/src/inputStream_http.c +++ b/src/inputStream_http.c @@ -70,7 +70,7 @@ typedef struct _InputStreemHTTPData { char * httpAuth; } InputStreamHTTPData; -void inputStream_initHttp() { +void inputStream_initHttp(void) { ConfigParam * param = getConfigParam(CONF_HTTP_PROXY_HOST); char * test; @@ -238,7 +238,7 @@ static char * authString(char * header, char * user, char * password) { #define proxyAuthString(x, y) authString(PROXY_AUTH_HEADER, x, y) #define httpAuthString(x, y) authString(HTTP_AUTH_HEADER, x, y) -static InputStreamHTTPData * newInputStreamHTTPData() { +static InputStreamHTTPData * newInputStreamHTTPData(void) { InputStreamHTTPData * ret = malloc(sizeof(InputStreamHTTPData)); if(proxyHost) { diff --git a/src/interface.c b/src/interface.c index eec294477..c7efbe032 100644 --- a/src/interface.c +++ b/src/interface.c @@ -373,7 +373,7 @@ static void addInterfacesForBufferFlushToFdSet(fd_set * fds, int * fdmax) { } } -static void closeNextErroredInterface() { +static void closeNextErroredInterface(void) { fd_set fds; struct timeval tv; int i; @@ -393,7 +393,7 @@ static void closeNextErroredInterface() { } } -int doIOForInterfaces() { +int doIOForInterfaces(void) { fd_set rfds; fd_set wfds; struct timeval tv; @@ -441,7 +441,7 @@ int doIOForInterfaces() { return 1; } -void initInterfaces() { +void initInterfaces(void) { int i; char * test; ConfigParam * param; @@ -506,7 +506,7 @@ void initInterfaces() { } } -static void closeAllInterfaces() { +static void closeAllInterfaces(void) { int i; fflush(NULL); @@ -518,7 +518,7 @@ static void closeAllInterfaces() { } } -void freeAllInterfaces() { +void freeAllInterfaces(void) { closeAllInterfaces(); free(interfaces); @@ -526,7 +526,7 @@ void freeAllInterfaces() { interface_max_connections = 0; } -void closeOldInterfaces() { +void closeOldInterfaces(void) { int i; for(i=0;idecoderControl.utf8url, 0, MAXPATHLEN+1); } -PlayerData * getPlayerData() { +PlayerData * getPlayerData(void) { return playerData_pd; } -int getPlayerPid() { +int getPlayerPid(void) { return *player_pid; } @@ -174,7 +174,7 @@ void setPlayerPid(int pid) { *player_pid = pid; } -void freePlayerData() { +void freePlayerData(void) { shmdt(playerData_pd); shmdt(player_pid); } diff --git a/src/playlist.c b/src/playlist.c index 395688aeb..e48cc8c35 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -92,7 +92,7 @@ static void swapOrder(int a, int b); static int playPlaylistOrderNumber(FILE * fp, int orderNum); static void randomizeOrder(int start, int end); -char * getStateFile() { +char * getStateFile(void) { ConfigParam * param = parseConfigFilePath(CONF_STATE_FILE, 0); if(!param) return NULL; @@ -100,7 +100,7 @@ char * getStateFile() { return param->value; } -static void incrPlaylistVersion() { +static void incrPlaylistVersion(void) { static unsigned long max = ((mpd_uint32)1<<31)-1; playlist.version++; if(playlist.version>=max) { @@ -114,7 +114,7 @@ static void incrPlaylistVersion() { } } -void playlistVersionChange() { +void playlistVersionChange(void) { int i = 0; for(i=0; i= playlist.length-1) { @@ -134,7 +134,7 @@ static void incrPlaylistCurrent() { else playlist.current++; } -void initPlaylist() { +void initPlaylist(void) { char * test; int i; ConfigParam * param; @@ -190,7 +190,7 @@ void initPlaylist() { } } -static int getNextId() { +static int getNextId(void) { static int cur = -1; do { @@ -203,7 +203,7 @@ static int getNextId() { return cur; } -void finishPlaylist() { +void finishPlaylist(void) { int i; for(i=0;itype == SONG_TYPE_URL) { @@ -255,7 +255,7 @@ int showPlaylist(FILE * fp) { return 0; } -void savePlaylistState() { +void savePlaylistState(void) { char * stateFile = getStateFile(); if(stateFile) { @@ -340,7 +340,7 @@ void loadPlaylistFromStateFile(FILE * fp, char * buffer, int state, int current, } } -void readPlaylistState() { +void readPlaylistState(void) { char * stateFile = getStateFile(); if(stateFile) { @@ -543,7 +543,7 @@ void swapSongs(int song1, int song2) { playlist.positionToId[song2] = iTemp; } -void queueNextSongInPlaylist() { +void queueNextSongInPlaylist(void) { if(playlist.current= 0 && playlist.current < playlist.length) { @@ -1359,7 +1359,7 @@ int savePlaylist(FILE * fp, char * utf8file) { return 0; } -int getPlaylistCurrentSong() { +int getPlaylistCurrentSong(void) { if(playlist.current >= 0 && playlist.current < playlist.length) { return playlist.order[playlist.current]; } @@ -1367,11 +1367,11 @@ int getPlaylistCurrentSong() { return -1; } -unsigned long getPlaylistVersion() { +unsigned long getPlaylistVersion(void) { return playlist.version; } -int getPlaylistLength() { +int getPlaylistLength(void) { return playlist.length; } diff --git a/src/replayGain.c b/src/replayGain.c index b1c7e92d4..296b321cd 100644 --- a/src/replayGain.c +++ b/src/replayGain.c @@ -31,7 +31,7 @@ static int replayGainState = REPLAYGAIN_OFF; static float replayGainPreamp = 1.0; -void initReplayGainState() { +void initReplayGainState(void) { ConfigParam * param = getConfigParam(CONF_REPLAYGAIN); if(!param) return; @@ -85,7 +85,7 @@ static float computeReplayGainScale(float gain, float peak) { return(scale); } -ReplayGainInfo * newReplayGainInfo() { +ReplayGainInfo * newReplayGainInfo(void) { ReplayGainInfo * ret = malloc(sizeof(ReplayGainInfo)); ret->albumGain = 0.0; diff --git a/src/song.c b/src/song.c index ed27667b4..6bb31d75d 100644 --- a/src/song.c +++ b/src/song.c @@ -35,7 +35,7 @@ #include #include -Song * newNullSong() { +Song * newNullSong(void) { Song * song = malloc(sizeof(Song)); song->tag = NULL; @@ -92,7 +92,7 @@ void freeJustSong(Song * song) { getSongUrl(NULL); } -SongList * newSongList() { +SongList * newSongList(void) { return makeList((ListFreeDataFunc *)freeSong, 0); } diff --git a/src/stats.c b/src/stats.c index 5f03874c3..a26976d31 100644 --- a/src/stats.c +++ b/src/stats.c @@ -28,7 +28,7 @@ Stats stats; -void initStats() { +void initStats(void) { stats.daemonStart = time(NULL); stats.numberOfSongs = 0; } diff --git a/src/tag.c b/src/tag.c index f789de849..e8f976646 100644 --- a/src/tag.c +++ b/src/tag.c @@ -72,7 +72,7 @@ char * mpdTagItemKeys[TAG_NUM_OF_ITEM_TYPES] = static mpd_sint8 ignoreTagItems[TAG_NUM_OF_ITEM_TYPES]; -void initTagConfig() { +void initTagConfig(void) { int quit = 0; char * temp; char * s; @@ -450,7 +450,7 @@ fail: return ret; } -MpdTag * newMpdTag() { +MpdTag * newMpdTag(void) { MpdTag * ret = malloc(sizeof(MpdTag)); ret->items = NULL; ret->time = -1; diff --git a/src/tagTracker.c b/src/tagTracker.c index 14efb104b..e69535ffa 100644 --- a/src/tagTracker.c +++ b/src/tagTracker.c @@ -89,7 +89,7 @@ int getNumberOfTagItems(int type) { return tagLists[type]->numberOfNodes; } -void printMemorySavedByTagTracker() { +void printMemorySavedByTagTracker(void) { int i; ListNode * node; size_t sum = 0; diff --git a/src/utils.c b/src/utils.c index 7dbe88833..64a2f2b13 100644 --- a/src/utils.c +++ b/src/utils.c @@ -62,7 +62,7 @@ void my_usleep(long usec) { select(0,NULL,NULL,NULL,&tv); } -int ipv6Supported() { +int ipv6Supported(void) { #ifdef HAVE_IPV6 int s; s = socket(AF_INET6,SOCK_STREAM,0); diff --git a/src/volume.c b/src/volume.c index d398457d3..b22d29e68 100644 --- a/src/volume.c +++ b/src/volume.c @@ -144,7 +144,7 @@ static int ensure_oss_open(void) return 0; } -static int getOssVolumeLevel() { +static int getOssVolumeLevel(void) { int left, right, level; if (ensure_oss_open() < 0) @@ -298,7 +298,7 @@ error: return -1; } -static int getAlsaVolumeLevel() { +static int getAlsaVolumeLevel(void) { int ret; long level; long max = volume_alsaMax; @@ -374,7 +374,7 @@ static int prepMixer(char * device) { return 0; } -void finishVolume() { +void finishVolume(void) { switch(volume_mixerType) { #ifdef HAVE_ALSA case VOLUME_MIXER_TYPE_ALSA: @@ -389,7 +389,7 @@ void finishVolume() { } } -void initVolume() { +void initVolume(void) { ConfigParam * param = getConfigParam(CONF_MIXER_TYPE); if(param) { @@ -424,18 +424,18 @@ void initVolume() { } } -void openVolumeDevice() { +void openVolumeDevice(void) { if(prepMixer(volume_mixerDevice)<0) { WARNING("using software volume\n"); volume_mixerType = VOLUME_MIXER_TYPE_SOFTWARE; } } -static int getSoftwareVolume() { +static int getSoftwareVolume(void) { return volume_softwareSet; } -int getVolumeLevel() { +int getVolumeLevel(void) { switch(volume_mixerType) { #ifdef HAVE_ALSA case VOLUME_MIXER_TYPE_ALSA: -- cgit v1.2.3