diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-09-20 17:31:45 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-09-20 17:31:45 -0700 |
commit | 77f98f37245f7d8ea2b0182b326420b6d6455cad (patch) | |
tree | b38c6ec08ce8ab7b80f0f11e1739b7890c4a2b2a /src/volume.c | |
parent | df1ed6f83043b7290d27b49c3c63fc8bcb796d5c (diff) | |
parent | 228736ffb9d88a2910d7ae7df71827d12d7bfeb5 (diff) | |
download | mpd-77f98f37245f7d8ea2b0182b326420b6d6455cad.tar.gz mpd-77f98f37245f7d8ea2b0182b326420b6d6455cad.tar.xz mpd-77f98f37245f7d8ea2b0182b326420b6d6455cad.zip |
Merge branch 'ew/directory'
* ew/directory:
Don't try to prune unless we're updating
workaround race condition on updates with broken signal blocking
Replace SongList with struct songvec
directory: remove unused updateMp3Directory() function
start using prefixcmp()
Add prefixcmp() (stol^H^H^H^Hborrowed from git)
Diffstat (limited to 'src/volume.c')
-rw-r--r-- | src/volume.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/volume.c b/src/volume.c index 5369db6f4..be32f3a85 100644 --- a/src/volume.c +++ b/src/volume.c @@ -510,26 +510,22 @@ int changeVolumeLevel(int change, int rel) void read_sw_volume_state(FILE *fp) { - /* strlen(SW_VOLUME_STATE) + strlen('100') + '\0' */ - #define bufsize 16 - char buf[bufsize]; - const size_t len = strlen(SW_VOLUME_STATE); + char buf[sizeof(SW_VOLUME_STATE) + sizeof("100") - 1]; char *end = NULL; long int sv; if (volume_mixerType != VOLUME_MIXER_TYPE_SOFTWARE) return; - while (myFgets(buf, bufsize, fp)) { - if (strncmp(buf, SW_VOLUME_STATE, len)) + while (myFgets(buf, sizeof(buf), fp)) { + if (prefixcmp(buf, SW_VOLUME_STATE)) continue; - sv = strtol(buf + len, &end, 10); + sv = strtol(buf + strlen(SW_VOLUME_STATE), &end, 10); if (mpd_likely(!*end)) changeSoftwareVolume(sv, 0); else ERROR("Can't parse software volume: %s\n", buf); return; } - #undef bufsize } void save_sw_volume_state(int fd) |