Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions picohttpparser.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
CHECK_EOF(); \
} \
tok = tok_start; \
toklen = buf - tok_start; \
toklen = (size_t)(buf - tok_start); \
} while (0)

static const char *token_char_map = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
Expand Down Expand Up @@ -181,9 +181,9 @@ static const char *get_token_to_eol(const char *buf, const char *buf_end, const
if (likely(*buf == '\015')) {
++buf;
EXPECT_CHAR('\012');
*token_len = buf - 2 - token_start;
*token_len = (size_t)(buf - 2 - token_start);
} else if (*buf == '\012') {
*token_len = buf - token_start;
*token_len = (size_t)(buf - token_start);
++buf;
} else {
*ret = -1;
Expand Down Expand Up @@ -272,7 +272,7 @@ static const char *parse_token(const char *buf, const char *buf_end, const char
CHECK_EOF();
}
*token = buf_start;
*token_len = buf - buf_start;
*token_len = (size_t)(buf - buf_start);
return buf;
}

Expand Down Expand Up @@ -347,7 +347,7 @@ static const char *parse_headers(const char *buf, const char *buf_end, struct ph
}
}
headers[*num_headers].value = value;
headers[*num_headers].value_len = value_end - value;
headers[*num_headers].value_len = (size_t)(value_end - value);
}
return buf;
}
Expand Down Expand Up @@ -563,7 +563,7 @@ ssize_t phr_decode_chunked(struct phr_chunked_decoder *decoder, char *buf, size_
ret = -1;
goto Exit;
}
decoder->bytes_left_in_chunk = decoder->bytes_left_in_chunk * 16 + v;
decoder->bytes_left_in_chunk = decoder->bytes_left_in_chunk * 16 + (size_t)v;
++decoder->_hex_count;
}
decoder->_hex_count = 0;
Expand Down Expand Up @@ -647,7 +647,7 @@ ssize_t phr_decode_chunked(struct phr_chunked_decoder *decoder, char *buf, size_
}

Complete:
ret = bufsz - src;
ret = (ssize_t)(bufsz - src);
Exit:
if (dst != src)
memmove(buf + dst, buf + src, bufsz - src);
Expand Down