Fix bug in float to string conversion of raop volume (credit @andreas-p, issue #84)

This commit is contained in:
ejurgensen 2015-01-08 22:03:53 +01:00
parent 70f05049e8
commit 5a02f926e3
1 changed files with 2 additions and 1 deletions

View File

@ -2290,7 +2290,8 @@ raop_set_volume_internal(struct raop_session *rs, int volume, evrtsp_req_cb cb)
raop_volume = raop_volume_convert(volume, rs->devname);
/* Don't let locales get in the way here */
ret = evbuffer_add_printf(evbuf, "volume: %d.%06d\r\n", (int)raop_volume, -(int)(1000000.0 * (raop_volume - (int)raop_volume)));
/* We use -%d and -(int)raop_volume so -0.3 won't become 0.3 */
ret = evbuffer_add_printf(evbuf, "volume: -%d.%06d\r\n", -(int)raop_volume, -(int)(1000000.0 * (raop_volume - (int)raop_volume)));
if (ret < 0)
{
DPRINTF(E_LOG, L_RAOP, "Out of memory for SET_PARAMETER payload (volume)\n");