Avoid pointer sign conversion warning when parsing content length, should also fix DS build

This commit is contained in:
UnknownShadow200 2024-05-09 21:43:50 +10:00
parent 0035ffc9cd
commit c4e20e94f4
2 changed files with 10 additions and 8 deletions

View File

@ -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:

View File

@ -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")) {