From 16cf3cb44b998496f9bf3ab4af1bb78301e71629 Mon Sep 17 00:00:00 2001 From: whatdoineed2do/Ray Date: Thu, 16 Sep 2021 09:11:31 +0100 Subject: [PATCH] [jsonapi] use u32 types for parsing param: rating --- src/httpd_jsonapi.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/httpd_jsonapi.c b/src/httpd_jsonapi.c index 42c44dd5..c4b86b01 100644 --- a/src/httpd_jsonapi.c +++ b/src/httpd_jsonapi.c @@ -3299,8 +3299,7 @@ jsonapi_reply_library_tracks_put_byid(struct httpd_request *hreq) { int track_id; const char *param; - int val; - uint32_t uval; + uint32_t val; int ret; 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"); if (param) { - ret = safe_atoi32(param, &val); + ret = safe_atou32(param, &val); if (ret < 0) return HTTP_BADREQUEST; @@ -3347,11 +3346,11 @@ jsonapi_reply_library_tracks_put_byid(struct httpd_request *hreq) param = evhttp_find_header(hreq->query, "usermark"); if (param) { - ret = safe_atou32(param, &uval); + ret = safe_atou32(param, &val); if (ret < 0) return HTTP_BADREQUEST; - ret = db_file_usermark_update_byid(track_id, uval); + ret = db_file_usermark_update_byid(track_id, val); if (ret < 0) return HTTP_INTERNAL;