summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2011-09-23 17:36:37 +0200
committerVicent Marti <tanoku@gmail.com>2011-09-27 15:02:36 +0200
commit887eaf4dc9b6f870b021ad88c881d5fcc6ccf4d1 (patch)
tree3e7ec6f141b22a714fda38df2adfc1f6e8a86bb4 /deps
parentdc5c87812c7328abc3f96e66b07e1c38885a51c1 (diff)
downloadlibgit2-887eaf4dc9b6f870b021ad88c881d5fcc6ccf4d1.tar.gz
Fix dev branch under MSVC
In libgit2: Move an enum out of an int bitfield in the HTTP transport. In the parser: Use int bitfields and change some variable sizes to better fit thir use. Variables that count the size of the data chunk can only ever be as large as off_t. Warning 4127 can be ignored, as nobody takes it seriously anyway. From Emeric: change some variable declarations to keep MSVC happy. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Diffstat (limited to 'deps')
-rw-r--r--deps/http-parser/http_parser.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/deps/http-parser/http_parser.c b/deps/http-parser/http_parser.c
index e905747a3..e9d42ce08 100644
--- a/deps/http-parser/http_parser.c
+++ b/deps/http-parser/http_parser.c
@@ -364,11 +364,13 @@ size_t http_parser_execute (http_parser *parser,
char c, ch;
int8_t unhex_val;
const char *p = data, *pe;
- int64_t to_read;
+ off_t to_read;
enum state state;
enum header_states header_state;
uint64_t index = parser->index;
uint64_t nread = parser->nread;
+ const char *header_field_mark, *header_value_mark, *url_mark;
+ const char *matcher;
/* We're in an error state. Don't bother doing anything. */
if (HTTP_PARSER_ERRNO(parser) != HPE_OK) {
@@ -399,9 +401,9 @@ size_t http_parser_execute (http_parser *parser,
/* technically we could combine all of these (except for url_mark) into one
variable, saving stack space, but it seems more clear to have them
separated. */
- const char *header_field_mark = 0;
- const char *header_value_mark = 0;
- const char *url_mark = 0;
+ header_field_mark = 0;
+ header_value_mark = 0;
+ url_mark = 0;
if (state == s_header_field)
header_field_mark = data;
@@ -695,7 +697,7 @@ size_t http_parser_execute (http_parser *parser,
goto error;
}
- const char *matcher = method_strings[parser->method];
+ matcher = method_strings[parser->method];
if (ch == ' ' && matcher[index] == '\0') {
state = s_req_spaces_before_url;
} else if (ch == matcher[index]) {
@@ -1576,7 +1578,7 @@ size_t http_parser_execute (http_parser *parser,
}
case s_body_identity:
- to_read = MIN(pe - p, (int64_t)parser->content_length);
+ to_read = (off_t) MIN(pe - p, parser->content_length);
if (to_read > 0) {
if (settings->on_body) settings->on_body(parser, p, to_read);
p += to_read - 1;
@@ -1670,7 +1672,7 @@ size_t http_parser_execute (http_parser *parser,
{
assert(parser->flags & F_CHUNKED);
- to_read = MIN(pe - p, (int64_t)(parser->content_length));
+ to_read = (off_t) MIN(pe - p, parser->content_length);
if (to_read > 0) {
if (settings->on_body) settings->on_body(parser, p, to_read);
@@ -1710,7 +1712,7 @@ size_t http_parser_execute (http_parser *parser,
parser->state = state;
parser->header_state = header_state;
- parser->index = index;
+ parser->index = (unsigned char) index;
parser->nread = nread;
return len;