mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-30 09:03:23 -05:00
[dacp] Fix issue where Hyperfine Remote provides speaker ids as decimal
Also align a bit on how we handle hex/dec parameters
This commit is contained in:
parent
8c0be3a0f3
commit
c45a85d143
@ -716,7 +716,12 @@ dacp_propset_userrating(const char *value, struct evkeyvalq *query)
|
|||||||
}
|
}
|
||||||
|
|
||||||
param++;
|
param++;
|
||||||
ret = safe_hextou32(param, &itemid);
|
|
||||||
|
if (strncmp(param, "0x", 2) == 0)
|
||||||
|
ret = safe_hextou32(param, &itemid);
|
||||||
|
else
|
||||||
|
ret = safe_atou32(param, &itemid);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_DACP, "Couldn't convert item-spec/song-spec to an integer in dacp.userrating (%s)\n", param);
|
DPRINTF(E_LOG, L_DACP, "Couldn't convert item-spec/song-spec to an integer in dacp.userrating (%s)\n", param);
|
||||||
@ -1224,7 +1229,11 @@ dacp_reply_playspec(struct evhttp_request *req, struct evbuffer *evbuf, char **u
|
|||||||
}
|
}
|
||||||
param++;
|
param++;
|
||||||
|
|
||||||
ret = safe_hextou32(param, &plid);
|
if (strncmp(param, "0x", 2) == 0)
|
||||||
|
ret = safe_hextou32(param, &plid);
|
||||||
|
else
|
||||||
|
ret = safe_atou32(param, &plid);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_DACP, "Couldn't convert container-spec to an integer in playspec (%s)\n", param);
|
DPRINTF(E_LOG, L_DACP, "Couldn't convert container-spec to an integer in playspec (%s)\n", param);
|
||||||
@ -1253,7 +1262,11 @@ dacp_reply_playspec(struct evhttp_request *req, struct evbuffer *evbuf, char **u
|
|||||||
}
|
}
|
||||||
param++;
|
param++;
|
||||||
|
|
||||||
ret = safe_hextou32(param, &id);
|
if (strncmp(param, "0x", 2) == 0)
|
||||||
|
ret = safe_hextou32(param, &id);
|
||||||
|
else
|
||||||
|
ret = safe_atou32(param, &id);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_DACP, "Couldn't convert container-item-spec/item-spec to an integer in playspec (%s)\n", param);
|
DPRINTF(E_LOG, L_DACP, "Couldn't convert container-item-spec/item-spec to an integer in playspec (%s)\n", param);
|
||||||
@ -2490,7 +2503,12 @@ dacp_reply_setspeakers(struct evhttp_request *req, struct evbuffer *evbuf, char
|
|||||||
{
|
{
|
||||||
param++;
|
param++;
|
||||||
|
|
||||||
ret = safe_hextou64(param, &ids[i]);
|
// Some like Remote will give us hex, others will give us decimal (e.g. Hyperfine)
|
||||||
|
if (strncmp(param, "0x", 2) == 0)
|
||||||
|
ret = safe_hextou64(param, &ids[i]);
|
||||||
|
else
|
||||||
|
ret = safe_atou64(param, &ids[i]);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_DACP, "Invalid speaker id in request: %s\n", param);
|
DPRINTF(E_LOG, L_DACP, "Invalid speaker id in request: %s\n", param);
|
||||||
|
@ -130,10 +130,6 @@ safe_hextou32(const char *str, uint32_t *val)
|
|||||||
|
|
||||||
*val = 0;
|
*val = 0;
|
||||||
|
|
||||||
/* A hex shall begin with 0x */
|
|
||||||
if (strncmp(str, "0x", 2) != 0)
|
|
||||||
return safe_atou32(str, val);
|
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
intval = strtoul(str, &end, 16);
|
intval = strtoul(str, &end, 16);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user