diff options
author | Max Kellermann <max@duempel.org> | 2008-01-26 12:46:21 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-01-26 12:46:21 +0000 |
commit | 07adb14e3c4daa8b1e6ebc69e54128b38b014d30 (patch) | |
tree | 7d22b4b2eb31a9bf46cf648731fe1370005ab1c9 /src | |
parent | 28008e697720bb2b11989bb887eb468b91409b1a (diff) | |
download | mpd-07adb14e3c4daa8b1e6ebc69e54128b38b014d30.tar.gz mpd-07adb14e3c4daa8b1e6ebc69e54128b38b014d30.tar.xz mpd-07adb14e3c4daa8b1e6ebc69e54128b38b014d30.zip |
fixed -Wshadow warnings
Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn-id: https://svn.musicpd.org/mpd/trunk@7143 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/audio.c | 14 | ||||
-rw-r--r-- | src/audioOutputs/audioOutput_oss.c | 88 | ||||
-rw-r--r-- | src/command.c | 26 | ||||
-rw-r--r-- | src/dbUtils.c | 4 | ||||
-rw-r--r-- | src/directory.c | 28 | ||||
-rw-r--r-- | src/inputPlugins/_flac_common.c | 12 | ||||
-rw-r--r-- | src/inputPlugins/audiofile_plugin.c | 12 | ||||
-rw-r--r-- | src/inputPlugins/mod_plugin.c | 8 | ||||
-rw-r--r-- | src/inputPlugins/mp3_plugin.c | 16 | ||||
-rw-r--r-- | src/inputPlugins/mpc_plugin.c | 22 | ||||
-rw-r--r-- | src/locate.c | 8 | ||||
-rw-r--r-- | src/ls.c | 35 | ||||
-rw-r--r-- | src/outputBuffer.c | 4 | ||||
-rw-r--r-- | src/player.c | 10 | ||||
-rw-r--r-- | src/playlist.c | 19 | ||||
-rw-r--r-- | src/sig_handlers.c | 2 | ||||
-rw-r--r-- | src/storedPlaylist.c | 8 | ||||
-rw-r--r-- | src/tag.c | 28 | ||||
-rw-r--r-- | src/timer.c | 8 | ||||
-rw-r--r-- | src/volume.c | 16 |
20 files changed, 185 insertions, 183 deletions
diff --git a/src/audio.c b/src/audio.c index 07183d1ea..145e6be3c 100644 --- a/src/audio.c +++ b/src/audio.c @@ -360,16 +360,16 @@ int openAudioDevice(AudioFormat * audioFormat) int playAudio(const char *playChunk, int size) { - int send; + int send_size; while (size > 0) { - send = audioBufferSize - audioBufferPos; - send = send < size ? send : size; + send_size = audioBufferSize - audioBufferPos; + send_size = send_size < size ? send_size : size; - memcpy(audioBuffer + audioBufferPos, playChunk, send); - audioBufferPos += send; - size -= send; - playChunk += send; + memcpy(audioBuffer + audioBufferPos, playChunk, send_size); + audioBufferPos += send_size; + size -= send_size; + playChunk += send_size; if (audioBufferPos == audioBufferSize) { if (flushAudioBuffer() < 0) diff --git a/src/audioOutputs/audioOutput_oss.c b/src/audioOutputs/audioOutput_oss.c index 68c82bf30..b2d913d6b 100644 --- a/src/audioOutputs/audioOutput_oss.c +++ b/src/audioOutputs/audioOutput_oss.c @@ -62,39 +62,39 @@ typedef struct _OssData { static int getIndexForParam(int param) { - int index = 0; + int idx = 0; switch (param) { case SNDCTL_DSP_SPEED: - index = OSS_RATE; + idx = OSS_RATE; break; case SNDCTL_DSP_CHANNELS: - index = OSS_CHANNELS; + idx = OSS_CHANNELS; break; case SNDCTL_DSP_SAMPLESIZE: - index = OSS_BITS; + idx = OSS_BITS; break; } - return index; + return idx; } static int findSupportedParam(OssData * od, int param, int val) { int i; - int index = getIndexForParam(param); + int idx = getIndexForParam(param); - for (i = 0; i < od->numSupported[index]; i++) { - if (od->supported[index][i] == val) + for (i = 0; i < od->numSupported[idx]; i++) { + if (od->supported[idx][i] == val) return 1; } return 0; } -static int canConvert(int index, int val) +static int canConvert(int idx, int val) { - switch (index) { + switch (idx) { case OSS_BITS: if (val != 16) return 0; @@ -111,21 +111,21 @@ static int canConvert(int index, int val) static int getSupportedParam(OssData * od, int param, int val) { int i; - int index = getIndexForParam(param); + int idx = getIndexForParam(param); int ret = -1; int least = val; int diff; - for (i = 0; i < od->numSupported[index]; i++) { - diff = od->supported[index][i] - val; + for (i = 0; i < od->numSupported[idx]; i++) { + diff = od->supported[idx][i] - val; if (diff < 0) diff = -diff; if (diff < least) { - if (!canConvert(index, od->supported[index][i])) { + if (!canConvert(idx, od->supported[idx][i])) { continue; } least = diff; - ret = od->supported[index][i]; + ret = od->supported[idx][i]; } } @@ -135,10 +135,10 @@ static int getSupportedParam(OssData * od, int param, int val) static int findUnsupportedParam(OssData * od, int param, int val) { int i; - int index = getIndexForParam(param); + int idx = getIndexForParam(param); - for (i = 0; i < od->numUnsupported[index]; i++) { - if (od->unsupported[index][i] == val) + for (i = 0; i < od->numUnsupported[idx]; i++) { + if (od->unsupported[idx][i] == val) return 1; } @@ -147,58 +147,58 @@ static int findUnsupportedParam(OssData * od, int param, int val) static void addSupportedParam(OssData * od, int param, int val) { - int index = getIndexForParam(param); + int idx = getIndexForParam(param); - od->numSupported[index]++; - od->supported[index] = xrealloc(od->supported[index], - od->numSupported[index] * sizeof(int)); - od->supported[index][od->numSupported[index] - 1] = val; + od->numSupported[idx]++; + od->supported[idx] = xrealloc(od->supported[idx], + od->numSupported[idx] * sizeof(int)); + od->supported[idx][od->numSupported[idx] - 1] = val; } static void addUnsupportedParam(OssData * od, int param, int val) { - int index = getIndexForParam(param); + int idx = getIndexForParam(param); - od->numUnsupported[index]++; - od->unsupported[index] = xrealloc(od->unsupported[index], - od->numUnsupported[index] * - sizeof(int)); - od->unsupported[index][od->numUnsupported[index] - 1] = val; + od->numUnsupported[idx]++; + od->unsupported[idx] = xrealloc(od->unsupported[idx], + od->numUnsupported[idx] * + sizeof(int)); + od->unsupported[idx][od->numUnsupported[idx] - 1] = val; } static void removeSupportedParam(OssData * od, int param, int val) { int i = 0; int j = 0; - int index = getIndexForParam(param); + int idx = getIndexForParam(param); - for (i = 0; i < od->numSupported[index] - 1; i++) { - if (od->supported[index][i] == val) + for (i = 0; i < od->numSupported[idx] - 1; i++) { + if (od->supported[idx][i] == val) j = 1; - od->supported[index][i] = od->supported[index][i + j]; + od->supported[idx][i] = od->supported[idx][i + j]; } - od->numSupported[index]--; - od->supported[index] = xrealloc(od->supported[index], - od->numSupported[index] * sizeof(int)); + od->numSupported[idx]--; + od->supported[idx] = xrealloc(od->supported[idx], + od->numSupported[idx] * sizeof(int)); } static void removeUnsupportedParam(OssData * od, int param, int val) { int i = 0; int j = 0; - int index = getIndexForParam(param); + int idx = getIndexForParam(param); - for (i = 0; i < od->numUnsupported[index] - 1; i++) { - if (od->unsupported[index][i] == val) + for (i = 0; i < od->numUnsupported[idx] - 1; i++) { + if (od->unsupported[idx][i] == val) j = 1; - od->unsupported[index][i] = od->unsupported[index][i + j]; + od->unsupported[idx][i] = od->unsupported[idx][i + j]; } - od->numUnsupported[index]--; - od->unsupported[index] = xrealloc(od->unsupported[index], - od->numUnsupported[index] * - sizeof(int)); + od->numUnsupported[idx]--; + od->unsupported[idx] = xrealloc(od->unsupported[idx], + od->numUnsupported[idx] * + sizeof(int)); } static int isSupportedParam(OssData * od, int param, int val) diff --git a/src/command.c b/src/command.c index c6d751258..ff171496c 100644 --- a/src/command.c +++ b/src/command.c @@ -239,13 +239,13 @@ static int handlePause(int fd, int *permission, int argc, char *argv[]) { if (argc == 2) { char *test; - int pause = strtol(argv[1], &test, 10); - if (*test != '\0' || (pause != 0 && pause != 1)) { + int pause_flag = strtol(argv[1], &test, 10); + if (*test != '\0' || (pause_flag != 0 && pause_flag != 1)) { commandError(fd, ACK_ERROR_ARG, "\"%s\" is not 0 or 1", argv[1]); return -1; } - return playerSetPause(fd, pause); + return playerSetPause(fd, pause_flag); } return playerPause(fd); } @@ -929,7 +929,7 @@ static int handleSwapId(int fd, int *permission, int argc, char *argv[]) static int handleSeek(int fd, int *permission, int argc, char *argv[]) { int song; - int time; + int seek_time; char *test; song = strtol(argv[1], &test, 10); @@ -938,19 +938,19 @@ static int handleSeek(int fd, int *permission, int argc, char *argv[]) "\"%s\" is not a integer", argv[1]); return -1; } - time = strtol(argv[2], &test, 10); + seek_time = strtol(argv[2], &test, 10); if (*test != '\0') { commandError(fd, ACK_ERROR_ARG, "\"%s\" is not a integer", argv[2]); return -1; } - return seekSongInPlaylist(fd, song, time); + return seekSongInPlaylist(fd, song, seek_time); } static int handleSeekId(int fd, int *permission, int argc, char *argv[]) { int id; - int time; + int seek_time; char *test; id = strtol(argv[1], &test, 10); @@ -959,13 +959,13 @@ static int handleSeekId(int fd, int *permission, int argc, char *argv[]) "\"%s\" is not a integer", argv[1]); return -1; } - time = strtol(argv[2], &test, 10); + seek_time = strtol(argv[2], &test, 10); if (*test != '\0') { commandError(fd, ACK_ERROR_ARG, "\"%s\" is not a integer", argv[2]); return -1; } - return seekSongInPlaylistById(fd, id, time); + return seekSongInPlaylistById(fd, id, seek_time); } static int handleListAllInfo(int fd, int *permission, int argc, char *argv[]) @@ -994,17 +994,17 @@ static int handlePassword(int fd, int *permission, int argc, char *argv[]) static int handleCrossfade(int fd, int *permission, int argc, char *argv[]) { - int time; + int xfade_time; char *test; - time = strtol(argv[1], &test, 10); - if (*test != '\0' || time < 0) { + xfade_time = strtol(argv[1], &test, 10); + if (*test != '\0' || xfade_time < 0) { commandError(fd, ACK_ERROR_ARG, "\"%s\" is not a integer >= 0", argv[1]); return -1; } - setPlayerCrossFade(time); + setPlayerCrossFade(xfade_time); return 0; } diff --git a/src/dbUtils.c b/src/dbUtils.c index f83ae4c21..d03854d5d 100644 --- a/src/dbUtils.c +++ b/src/dbUtils.c @@ -201,10 +201,10 @@ static int directoryPrintSongInfo(int fd, Song * song, void *data) static int sumSongTime(int fd, Song * song, void *data) { - unsigned long *time = (unsigned long *)data; + unsigned long *sum_time = (unsigned long *)data; if (song->tag && song->tag->time >= 0) - *time += song->tag->time; + *sum_time += song->tag->time; return 0; } diff --git a/src/directory.c b/src/directory.c index 971a156ce..53b864018 100644 --- a/src/directory.c +++ b/src/directory.c @@ -761,21 +761,21 @@ void closeMp3Directory(void) static Directory *findSubDirectory(Directory * directory, char *name) { void *subDirectory; - char *dup = xstrdup(name); + char *duplicated = xstrdup(name); char *key; - key = strtok(dup, "/"); + key = strtok(duplicated, "/"); if (!key) { - free(dup); + free(duplicated); return NULL; } if (findInList(directory->subDirectories, key, &subDirectory)) { - free(dup); + free(duplicated); return (Directory *) subDirectory; } - free(dup); + free(duplicated); return NULL; } @@ -1264,9 +1264,9 @@ static Song *getSongDetails(char *file, char **shortnameRet, void *song = NULL; Directory *directory; char *dir = NULL; - char *dup = xstrdup(file); - char *shortname = dup; - char *c = strtok(dup, "/"); + char *duplicated = xstrdup(file); + char *shortname = duplicated; + char *c = strtok(duplicated, "/"); DEBUG("get song: %s\n", file); @@ -1275,25 +1275,25 @@ static Song *getSongDetails(char *file, char **shortnameRet, c = strtok(NULL, "/"); } - if (shortname != dup) { - for (c = dup; c < shortname - 1; c++) { + if (shortname != duplicated) { + for (c = duplicated; c < shortname - 1; c++) { if (*c == '\0') *c = '/'; } - dir = dup; + dir = duplicated; } if (!(directory = getDirectory(dir))) { - free(dup); + free(duplicated); return NULL; } if (!findInList(directory->songs, shortname, &song)) { - free(dup); + free(duplicated); return NULL; } - free(dup); + free(duplicated); if (shortnameRet) *shortnameRet = shortname; if (directoryRet) diff --git a/src/inputPlugins/_flac_common.c b/src/inputPlugins/_flac_common.c index 9a415f4b6..0a2adf6b7 100644 --- a/src/inputPlugins/_flac_common.c +++ b/src/inputPlugins/_flac_common.c @@ -62,12 +62,12 @@ static int flacFindVorbisCommentFloat(const FLAC__StreamMetadata * block, - pos; if (len > 0) { unsigned char tmp; - unsigned char *dup = &(block->data.vorbis_comment. - comments[offset].entry[pos]); - tmp = dup[len]; - dup[len] = '\0'; - *fl = atof((char *)dup); - dup[len] = tmp; + unsigned char *p = &(block->data.vorbis_comment. + comments[offset].entry[pos]); + tmp = p[len]; + p[len] = '\0'; + *fl = atof((char *)p); + p[len] = tmp; return 1; } diff --git a/src/inputPlugins/audiofile_plugin.c b/src/inputPlugins/audiofile_plugin.c index 8527a47a9..b5555f87d 100644 --- a/src/inputPlugins/audiofile_plugin.c +++ b/src/inputPlugins/audiofile_plugin.c @@ -33,16 +33,16 @@ static int getAudiofileTotalTime(char *file) { - int time; + int total_time; AFfilehandle af_fp = afOpenFile(file, "r", NULL); if (af_fp == AF_NULL_FILEHANDLE) { return -1; } - time = (int) + total_time = (int) ((double)afGetFrameCount(af_fp, AF_DEFAULT_TRACK) / afGetRate(af_fp, AF_DEFAULT_TRACK)); afCloseFile(af_fp); - return time; + return total_time; } static int audiofile_decode(OutputBuffer * cb, DecoderControl * dc, char *path) @@ -134,12 +134,12 @@ static int audiofile_decode(OutputBuffer * cb, DecoderControl * dc, char *path) static MpdTag *audiofileTagDup(char *file) { MpdTag *ret = NULL; - int time = getAudiofileTotalTime(file); + int total_time = getAudiofileTotalTime(file); - if (time >= 0) { + if (total_time >= 0) { if (!ret) ret = newMpdTag(); - ret->time = time; + ret->time = total_time; } else { DEBUG ("audiofileTagDup: Failed to get total song time from: %s\n", diff --git a/src/inputPlugins/mod_plugin.c b/src/inputPlugins/mod_plugin.c index 0c01caadb..092d9bd55 100644 --- a/src/inputPlugins/mod_plugin.c +++ b/src/inputPlugins/mod_plugin.c @@ -166,7 +166,7 @@ static void mod_close(mod_Data * data) static int mod_decode(OutputBuffer * cb, DecoderControl * dc, char *path) { mod_Data *data; - float time = 0.0; + float total_time = 0.0; int ret; float secPerByte; @@ -203,10 +203,10 @@ static int mod_decode(OutputBuffer * cb, DecoderControl * dc, char *path) break; ret = VC_WriteBytes(data->audio_buffer, MIKMOD_FRAME_SIZE); - time += ret * secPerByte; + total_time += ret * secPerByte; sendDataToOutputBuffer(cb, NULL, dc, 0, - (char *)data->audio_buffer, ret, time, - 0, NULL); + (char *)data->audio_buffer, ret, + total_time, 0, NULL); } flushOutputBuffer(cb); diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c index 9bb3f2f4b..2d101f616 100644 --- a/src/inputPlugins/mp3_plugin.c +++ b/src/inputPlugins/mp3_plugin.c @@ -69,7 +69,7 @@ static signed long audio_linear_dither(unsigned int bits, mad_fixed_t sample, struct audio_dither *dither) { unsigned int scalebits; - mad_fixed_t output, mask, random; + mad_fixed_t output, mask, rnd; enum { MIN = -MAD_F_ONE, @@ -86,10 +86,10 @@ static signed long audio_linear_dither(unsigned int bits, mad_fixed_t sample, scalebits = MAD_F_FRACBITS + 1 - bits; mask = (1L << scalebits) - 1; - random = prng(dither->random); - output += (random & mask) - (dither->random & mask); + rnd = prng(dither->random); + output += (rnd & mask) - (dither->random & mask); - dither->random = random; + dither->random = rnd; if (output > MAX) { output = MAX; @@ -1093,16 +1093,16 @@ static int mp3_decode(OutputBuffer * cb, DecoderControl * dc, static MpdTag *mp3_tagDup(char *file) { MpdTag *ret = NULL; - int time; + int total_time; ret = id3Dup(file); - time = getMp3TotalTime(file); + total_time = getMp3TotalTime(file); - if (time >= 0) { + if (total_time >= 0) { if (!ret) ret = newMpdTag(); - ret->time = time; + ret->time = total_time; } else { DEBUG("mp3_tagDup: Failed to get total song time from: %s\n", file); diff --git a/src/inputPlugins/mpc_plugin.c b/src/inputPlugins/mpc_plugin.c index 0d18c113a..db217f888 100644 --- a/src/inputPlugins/mpc_plugin.c +++ b/src/inputPlugins/mpc_plugin.c @@ -134,7 +134,7 @@ static int mpc_decode(OutputBuffer * cb, DecoderControl * dc, unsigned long samplePos = 0; mpc_uint32_t vbrUpdateAcc; mpc_uint32_t vbrUpdateBits; - float time; + float total_time; int i; ReplayGainInfo *replayGainInfo = NULL; @@ -218,7 +218,7 @@ static int mpc_decode(OutputBuffer * cb, DecoderControl * dc, s16++; if (chunkpos >= MPC_CHUNK_SIZE) { - time = ((float)samplePos) / + total_time = ((float)samplePos) / dc->audioFormat.sampleRate; bitRate = vbrUpdateBits * @@ -227,7 +227,7 @@ static int mpc_decode(OutputBuffer * cb, DecoderControl * dc, sendDataToOutputBuffer(cb, inStream, dc, inStream->seekable, chunk, chunkpos, - time, + total_time, bitRate, replayGainInfo); chunkpos = 0; @@ -241,13 +241,13 @@ static int mpc_decode(OutputBuffer * cb, DecoderControl * dc, } if (!dc->stop && chunkpos > 0) { - time = ((float)samplePos) / dc->audioFormat.sampleRate; + total_time = ((float)samplePos) / dc->audioFormat.sampleRate; bitRate = vbrUpdateBits * dc->audioFormat.sampleRate / 1152 / 1000; sendDataToOutputBuffer(cb, NULL, dc, inStream->seekable, - chunk, chunkpos, time, bitRate, + chunk, chunkpos, total_time, bitRate, replayGainInfo); } @@ -261,7 +261,7 @@ static int mpc_decode(OutputBuffer * cb, DecoderControl * dc, static float mpcGetTime(char *file) { InputStream inStream; - float time = -1; + float total_time = -1; mpc_reader reader; mpc_streaminfo info; @@ -289,19 +289,19 @@ static float mpcGetTime(char *file) return -1; } - time = mpc_streaminfo_get_length(&info); + total_time = mpc_streaminfo_get_length(&info); closeInputStream(&inStream); - return time; + return total_time; } static MpdTag *mpcTagDup(char *file) { MpdTag *ret = NULL; - float time = mpcGetTime(file); + float total_time = mpcGetTime(file); - if (time < 0) { + if (total_time < 0) { DEBUG("mpcTagDup: Failed to get Songlength of file: %s\n", file); return NULL; @@ -312,7 +312,7 @@ static MpdTag *mpcTagDup(char *file) ret = id3Dup(file); if (!ret) ret = newMpdTag(); - ret->time = time; + ret->time = total_time; return ret; } diff --git a/src/locate.c b/src/locate.c index d09e68a1e..3a4e35b84 100644 --- a/src/locate.c +++ b/src/locate.c @@ -123,7 +123,7 @@ void freeLocateTagItem(LocateTagItem * item) static int strstrSearchTag(Song * song, int type, char *str) { int i; - char *dup; + char *duplicate; int ret = 0; if (type == LOCATE_TAG_FILE_TYPE || type == LOCATE_TAG_ANY_TYPE) { @@ -145,10 +145,10 @@ static int strstrSearchTag(Song * song, int type, char *str) continue; } - dup = strDupToUpper(song->tag->items[i].value); - if (strstr(dup, str)) + duplicate = strDupToUpper(song->tag->items[i].value); + if (strstr(duplicate, str)) ret = 1; - free(dup); + free(duplicate); } return ret; @@ -103,7 +103,7 @@ int lsPlaylists(int fd, char *utf8path) DIR *dir; struct stat st; struct dirent *ent; - char *dup; + char *duplicated; char *utf8; char s[MPD_PATH_MAX]; char path_max_tmp[MPD_PATH_MAX]; @@ -128,21 +128,20 @@ int lsPlaylists(int fd, char *utf8path) while ((ent = readdir(dir))) { size_t len = strlen(ent->d_name) + 1; - dup = ent->d_name; + duplicated = ent->d_name; if (mpd_likely(len <= maxlen) && - dup[0] != '.' && - (suff = strlen(dup) - suflen) > 0 && - dup[suff] == '.' && - strcmp(dup + suff + 1, PLAYLIST_FILE_SUFFIX) == 0) { + duplicated[0] != '.' && + (suff = strlen(duplicated) - suflen) > 0 && + duplicated[suff] == '.' && + strcmp(duplicated + suff + 1, PLAYLIST_FILE_SUFFIX) == 0) { memcpy(s + actlen, ent->d_name, len); if (stat(s, &st) == 0) { if (S_ISREG(st.st_mode)) { - char path_max_tmp[MPD_PATH_MAX]; if (list == NULL) list = makeList(NULL, 1); - dup[suff] = '\0'; + duplicated[suff] = '\0'; utf8 = fs_charset_to_utf8(path_max_tmp, - dup); + duplicated); if (utf8) insertInList(list, utf8, NULL); } @@ -156,25 +155,27 @@ int lsPlaylists(int fd, char *utf8path) int i; sortList(list); - dup = xmalloc(strlen(utf8path) + 2); - strcpy(dup, utf8path); - for (i = strlen(dup) - 1; i >= 0 && dup[i] == '/'; i--) { - dup[i] = '\0'; + duplicated = xmalloc(strlen(utf8path) + 2); + strcpy(duplicated, utf8path); + for (i = strlen(duplicated) - 1; + i >= 0 && duplicated[i] == '/'; + i--) { + duplicated[i] = '\0'; } - if (strlen(dup)) - strcat(dup, "/"); + if (strlen(duplicated)) + strcat(duplicated, "/"); node = list->firstNode; while (node != NULL) { if (!strchr(node->key, '\n')) { - fdprintf(fd, "playlist: %s%s\n", dup, + fdprintf(fd, "playlist: %s%s\n", duplicated, node->key); } node = node->nextNode; } freeList(list); - free(dup); + free(duplicated); } return 0; diff --git a/src/outputBuffer.c b/src/outputBuffer.c index 7570be5d8..04770b478 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -66,7 +66,7 @@ void flushOutputBuffer(OutputBuffer * cb) int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream, DecoderControl * dc, int seekable, void *dataIn, - long dataInLen, float time, mpd_uint16 bitRate, + long dataInLen, float data_time, mpd_uint16 bitRate, ReplayGainInfo * replayGainInfo) { mpd_uint16 dataToSend; @@ -128,7 +128,7 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream, } else cb->metaChunk[currentChunk] = -1; cb->bitRate[currentChunk] = bitRate; - cb->times[currentChunk] = time; + cb->times[currentChunk] = data_time; } chunkLeft = CHUNK_SIZE - cb->chunkSize[currentChunk]; diff --git a/src/player.c b/src/player.c index 45e3f5ca9..547b2b737 100644 --- a/src/player.c +++ b/src/player.c @@ -276,7 +276,7 @@ int playerPause(int fd) return 0; } -int playerSetPause(int fd, int pause) +int playerSetPause(int fd, int pause_flag) { PlayerControl *pc = &(getPlayerData()->playerControl); @@ -285,11 +285,11 @@ int playerSetPause(int fd, int pause) switch (pc->state) { case PLAYER_STATE_PLAY: - if (pause) + if (pause_flag) playerPause(fd); break; case PLAYER_STATE_PAUSE: - if (!pause) + if (!pause_flag) playerPause(fd); break; } @@ -436,7 +436,7 @@ void playerQueueUnlock(void) } } -int playerSeek(int fd, Song * song, float time) +int playerSeek(int fd, Song * song, float seek_time) { PlayerControl *pc = &(getPlayerData()->playerControl); char path_max_tmp[MPD_PATH_MAX]; @@ -452,7 +452,7 @@ int playerSeek(int fd, Song * song, float time) if (pc->error == PLAYER_ERROR_NOERROR) { resetPlayerMetadata(); - pc->seekWhere = time; + pc->seekWhere = seek_time; pc->seek = 1; if (player_pid > 0 && pc->state == PLAYER_STATE_PAUSE) kill(player_pid, SIGCONT); diff --git a/src/playlist.c b/src/playlist.c index 5806273c3..1f3ef0634 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -279,7 +279,7 @@ void savePlaylistState(FILE *fp) } static void loadPlaylistFromStateFile(FILE *fp, char *buffer, - int state, int current, int time) + int state, int current, int seek_time) { char *temp; int song; @@ -300,7 +300,8 @@ static void loadPlaylistFromStateFile(FILE *fp, char *buffer, } if (state != PLAYER_STATE_STOP) { seekSongInPlaylist(STDERR_FILENO, - playlist.length - 1, time); + playlist.length - 1, + seek_time); } } if (!myFgets(buffer, PLAYLIST_BUFFER_SIZE, fp)) @@ -311,7 +312,7 @@ static void loadPlaylistFromStateFile(FILE *fp, char *buffer, void readPlaylistState(FILE *fp) { int current = -1; - int time = 0; + int seek_time = 0; int state = PLAYER_STATE_STOP; char buffer[PLAYLIST_BUFFER_SIZE]; @@ -330,7 +331,7 @@ void readPlaylistState(FILE *fp) } } else if (strncmp(buffer, PLAYLIST_STATE_FILE_TIME, strlen(PLAYLIST_STATE_FILE_TIME)) == 0) { - time = + seek_time = atoi(&(buffer[strlen(PLAYLIST_STATE_FILE_TIME)])); } else if (strncmp @@ -380,7 +381,7 @@ void readPlaylistState(FILE *fp) if (state == PLAYER_STATE_STOP) current = -1; loadPlaylistFromStateFile(fp, buffer, state, - current, time); + current, seek_time); } } } @@ -1460,7 +1461,7 @@ int getPlaylistLength(void) return playlist.length; } -int seekSongInPlaylist(int fd, int song, float time) +int seekSongInPlaylist(int fd, int song, float seek_time) { int i = song; @@ -1491,14 +1492,14 @@ int seekSongInPlaylist(int fd, int song, float time) return -1; } - return playerSeek(fd, playlist.songs[playlist.order[i]], time); + return playerSeek(fd, playlist.songs[playlist.order[i]], seek_time); } -int seekSongInPlaylistById(int fd, int id, float time) +int seekSongInPlaylistById(int fd, int id, float seek_time) { checkSongId(id); - return seekSongInPlaylist(fd, playlist.idToPosition[id], time); + return seekSongInPlaylist(fd, playlist.idToPosition[id], seek_time); } int getPlaylistSongId(int song) diff --git a/src/sig_handlers.c b/src/sig_handlers.c index fbd9e0573..111ce9775 100644 --- a/src/sig_handlers.c +++ b/src/sig_handlers.c @@ -51,7 +51,7 @@ int handlePendingSignals(void) return 0; } -static void chldSigHandler(int signal) +static void chldSigHandler(int sig) { int status; int pid; diff --git a/src/storedPlaylist.c b/src/storedPlaylist.c index c456b543f..b0d66fb10 100644 --- a/src/storedPlaylist.c +++ b/src/storedPlaylist.c @@ -27,16 +27,16 @@ #include "directory.h" #include "os_compat.h" -static ListNode *nodeOfStoredPlaylist(List *list, int index) +static ListNode *nodeOfStoredPlaylist(List *list, int idx) { int forward; ListNode *node; int i; - if (index >= list->numberOfNodes || index < 0) + if (idx >= list->numberOfNodes || idx < 0) return NULL; - if (index > (list->numberOfNodes/2)) { + if (idx > (list->numberOfNodes/2)) { forward = 0; node = list->lastNode; i = list->numberOfNodes - 1; @@ -47,7 +47,7 @@ static ListNode *nodeOfStoredPlaylist(List *list, int index) } while (node != NULL) { - if (i == index) + if (i == idx) return node; if (forward) { @@ -588,17 +588,17 @@ MpdTag *newMpdTag(void) return ret; } -static void deleteItem(MpdTag * tag, int index) +static void deleteItem(MpdTag * tag, int idx) { - assert(index < tag->numOfItems); + assert(idx < tag->numOfItems); tag->numOfItems--; - removeTagItemString(tag->items[index].type, tag->items[index].value); - /* free(tag->items[index].value); */ + removeTagItemString(tag->items[idx].type, tag->items[idx].value); + /* free(tag->items[idx].value); */ - if (tag->numOfItems - index > 0) { - memmove(tag->items + index, tag->items + index + 1, - tag->numOfItems - index); + if (tag->numOfItems - idx > 0) { + memmove(tag->items + idx, tag->items + idx + 1, + tag->numOfItems - idx); } if (tag->numOfItems > 0) { @@ -704,21 +704,21 @@ int mpdTagsAreEqual(MpdTag * tag1, MpdTag * tag2) static void appendToTagItems(MpdTag * tag, int type, char *value, int len) { int i = tag->numOfItems; - char *dup = xmalloc(len + 1); + char *duplicated = xmalloc(len + 1); - memcpy(dup, value, len); - dup[len] = '\0'; + memcpy(duplicated, value, len); + duplicated[len] = '\0'; - fixUtf8(dup); - stripReturnChar(dup); + fixUtf8(duplicated); + stripReturnChar(duplicated); tag->numOfItems++; tag->items = xrealloc(tag->items, tag->numOfItems * sizeof(MpdTagItem)); tag->items[i].type = type; - tag->items[i].value = getTagItemString(type, dup); + tag->items[i].value = getTagItemString(type, duplicated); - free(dup); + free(duplicated); } void addItemToMpdTagWithLen(MpdTag * tag, int itemType, char *value, int len) diff --git a/src/timer.c b/src/timer.c index 04a6f23c4..29c15eabc 100644 --- a/src/timer.c +++ b/src/timer.c @@ -67,11 +67,11 @@ void timer_add(Timer *timer, int size) void timer_sync(Timer *timer) { - int64_t sleep; + int64_t sleep_duration; assert(timer->started); - sleep = timer->time - now(); - if (sleep > 0) - my_usleep(sleep); + sleep_duration = timer->time - now(); + if (sleep_duration > 0) + my_usleep(sleep_duration); } diff --git a/src/volume.c b/src/volume.c index 6f11377e5..736838139 100644 --- a/src/volume.c +++ b/src/volume.c @@ -95,7 +95,7 @@ static int prepOssMixer(char *device) if (param) { char *labels[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_LABELS; - char *dup; + char *duplicated; int i, j; int devmask = 0; @@ -106,16 +106,16 @@ static int prepOssMixer(char *device) } for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) { - dup = xstrdup(labels[i]); + duplicated = xstrdup(labels[i]); /* eliminate spaces at the end */ - j = strlen(dup) - 1; - while (j >= 0 && dup[j] == ' ') - dup[j--] = '\0'; - if (strcasecmp(dup, param->value) == 0) { - free(dup); + j = strlen(duplicated) - 1; + while (j >= 0 && duplicated[j] == ' ') + duplicated[j--] = '\0'; + if (strcasecmp(duplicated, param->value) == 0) { + free(duplicated); break; } - free(dup); + free(duplicated); } if (i >= SOUND_MIXER_NRDEVICES) { |