Use UINT64_MAX instead of -1 for Rhizome HTTP response content_length

Fixes -Wsign-compare warnings
This commit is contained in:
Andrew Bettison 2013-12-10 17:06:45 +10:30
parent ebc3133f5c
commit b7528412df
3 changed files with 5 additions and 3 deletions

View File

@ -911,6 +911,8 @@ struct http_response_parts {
char *content_start;
};
#define HTTP_RESPONSE_CONTENT_LENGTH_UNSET UINT64_MAX
int unpack_http_response(char *response, struct http_response_parts *parts);
/* rhizome storage methods */

View File

@ -434,7 +434,7 @@ static int receive_http_response(int sock, char *buffer, size_t buffer_len, stru
INFOF("Failed HTTP request: server returned %03u %s", parts->code, parts->reason);
return -1;
}
if (parts->content_length == -1) {
if (parts->content_length == HTTP_RESPONSE_CONTENT_LENGTH_UNSET) {
if (config.debug.rhizome_rx)
DEBUGF("Invalid HTTP reply: missing Content-Length header");
return -1;

View File

@ -1541,7 +1541,7 @@ void rhizome_fetch_poll(struct sched_ent *alarm)
rhizome_fetch_switch_to_mdp(slot);
return;
}
if (parts.content_length == -1) {
if (parts.content_length == HTTP_RESPONSE_CONTENT_LENGTH_UNSET) {
if (config.debug.rhizome_rx)
DEBUGF("Invalid HTTP reply: missing Content-Length header");
rhizome_fetch_switch_to_mdp(slot);
@ -1619,7 +1619,7 @@ int unpack_http_response(char *response, struct http_response_parts *parts)
parts->code = 0;
parts->reason = NULL;
parts->range_start=0;
parts->content_length = -1;
parts->content_length = HTTP_RESPONSE_CONTENT_LENGTH_UNSET;
parts->content_start = NULL;
char *p = NULL;
if (!str_startswith(response, "HTTP/1.0 ", (const char **)&p)) {