From c4e20e94f4c62980c88a40f44b2d41569a034829 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 9 May 2024 21:43:50 +1000 Subject: [PATCH] Avoid pointer sign conversion warning when parsing content length, should also fix DS build --- .github/workflows/build_saturn.yml | 6 ------ src/Http_Worker.c | 12 ++++++++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_saturn.yml b/.github/workflows/build_saturn.yml index 23c5228e5..f4a00e22c 100644 --- a/.github/workflows/build_saturn.yml +++ b/.github/workflows/build_saturn.yml @@ -37,12 +37,6 @@ jobs: SOURCE_FILE: 'ClassiCube-saturn.iso' DEST_NAME: 'ClassiCube-saturn.iso' - - uses: ./.github/actions/upload_build - if: ${{ always() && steps.compile.outcome == 'success' }} - with: - SOURCE_FILE: 'ClassiCube-saturn.bin' - DEST_NAME: 'ClassiCube-saturn.bin' - - uses: ./.github/actions/upload_build if: ${{ always() && steps.compile.outcome == 'success' }} with: diff --git a/src/Http_Worker.c b/src/Http_Worker.c index 460db2716..7d60e90ee 100644 --- a/src/Http_Worker.c +++ b/src/Http_Worker.c @@ -41,6 +41,14 @@ static void Http_ParseCookie(struct HttpRequest* req, const cc_string* value) { EntryList_Set(req->cookies, &name, &data, '='); } +static void Http_ParseContentLength(struct HttpRequest* req, const cc_string* value) { + int contentLen = 0; + Convert_ParseInt(value, &contentLen); + + if (contentLen <= 0) return; + req->contentLength = contentLen; +} + /* Parses a HTTP header */ static void Http_ParseHeader(struct HttpRequest* req, const cc_string* line) { static const cc_string httpVersion = String_FromConst("HTTP"); @@ -58,11 +66,11 @@ static void Http_ParseHeader(struct HttpRequest* req, const cc_string* line) { if (String_CaselessEqualsConst(&name, "ETag")) { String_CopyToRawArray(req->etag, &value); } else if (String_CaselessEqualsConst(&name, "Content-Length")) { - Convert_ParseInt(&value, &req->contentLength); + Http_ParseContentLength(req, &value); } else if (String_CaselessEqualsConst(&name, "X-Dropbox-Content-Length")) { /* dropbox stopped returning Content-Length header since switching to chunked transfer */ /* https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Dropbox-media-can-t-be-access-by-azure-blob/td-p/575458 */ - Convert_ParseInt(&value, &req->contentLength); + Http_ParseContentLength(req, &value); } else if (String_CaselessEqualsConst(&name, "Last-Modified")) { String_CopyToRawArray(req->lastModified, &value); } else if (req->cookies && String_CaselessEqualsConst(&name, "Set-Cookie")) {