mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-29 00:23:23 -05:00
[jsonapi] use u32 types for parsing param: rating
This commit is contained in:
parent
52d1ba7dd4
commit
16cf3cb44b
@ -3299,8 +3299,7 @@ jsonapi_reply_library_tracks_put_byid(struct httpd_request *hreq)
|
|||||||
{
|
{
|
||||||
int track_id;
|
int track_id;
|
||||||
const char *param;
|
const char *param;
|
||||||
int val;
|
uint32_t val;
|
||||||
uint32_t uval;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = safe_atoi32(hreq->uri_parsed->path_parts[3], &track_id);
|
ret = safe_atoi32(hreq->uri_parsed->path_parts[3], &track_id);
|
||||||
@ -3329,7 +3328,7 @@ jsonapi_reply_library_tracks_put_byid(struct httpd_request *hreq)
|
|||||||
param = evhttp_find_header(hreq->query, "rating");
|
param = evhttp_find_header(hreq->query, "rating");
|
||||||
if (param)
|
if (param)
|
||||||
{
|
{
|
||||||
ret = safe_atoi32(param, &val);
|
ret = safe_atou32(param, &val);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return HTTP_BADREQUEST;
|
return HTTP_BADREQUEST;
|
||||||
|
|
||||||
@ -3347,11 +3346,11 @@ jsonapi_reply_library_tracks_put_byid(struct httpd_request *hreq)
|
|||||||
param = evhttp_find_header(hreq->query, "usermark");
|
param = evhttp_find_header(hreq->query, "usermark");
|
||||||
if (param)
|
if (param)
|
||||||
{
|
{
|
||||||
ret = safe_atou32(param, &uval);
|
ret = safe_atou32(param, &val);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return HTTP_BADREQUEST;
|
return HTTP_BADREQUEST;
|
||||||
|
|
||||||
ret = db_file_usermark_update_byid(track_id, uval);
|
ret = db_file_usermark_update_byid(track_id, val);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return HTTP_INTERNAL;
|
return HTTP_INTERNAL;
|
||||||
|
Loading…
Reference in New Issue
Block a user