mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-29 15:43:56 +00:00
Use RHIZOME_SIZE_UNSET instead of -1 for read_state.length
This may have been a reversion to older code caused by a careless merge, because the change to RHIZOME_SIZE_UNSET was already made when read_state.length was changed to unsigned. Fixes some -Wsign-compare warnings
This commit is contained in:
parent
fa9ba169a3
commit
6254709a84
@ -637,6 +637,7 @@ static int rhizome_file_content(struct http_request *hr, unsigned char *buf, siz
|
||||
const size_t preferred_bufsz = 16 * blocksz;
|
||||
// Reads the next part of the payload into the supplied buffer.
|
||||
rhizome_http_request *r = (rhizome_http_request *) hr;
|
||||
assert(r->u.read_state.length != RHIZOME_SIZE_UNSET);
|
||||
assert(r->u.read_state.offset < r->u.read_state.length);
|
||||
uint64_t remain = r->u.read_state.length - r->u.read_state.offset;
|
||||
size_t readlen = bufsz;
|
||||
@ -682,11 +683,11 @@ static int rhizome_file_page(rhizome_http_request *r, const char *remainder)
|
||||
}
|
||||
if (n != 0)
|
||||
return 1;
|
||||
if (r->u.read_state.length == -1 && rhizome_read(&r->u.read_state, NULL, 0)) {
|
||||
if (r->u.read_state.length == RHIZOME_SIZE_UNSET && rhizome_read(&r->u.read_state, NULL, 0)) {
|
||||
rhizome_read_close(&r->u.read_state);
|
||||
return 1;
|
||||
}
|
||||
assert(r->u.read_state.length != -1);
|
||||
assert(r->u.read_state.length != RHIZOME_SIZE_UNSET);
|
||||
r->http.response.header.resource_length = r->u.read_state.length;
|
||||
if (r->http.request_header.content_range_count > 0) {
|
||||
assert(r->http.request_header.content_range_count == 1);
|
||||
|
@ -1051,7 +1051,7 @@ int rhizome_read_cached(const rhizome_bid_t *bidp, uint64_t version, time_ms_t t
|
||||
}
|
||||
|
||||
entry->read_state.offset = fileOffset;
|
||||
if (entry->read_state.length !=-1 && fileOffset >= entry->read_state.length)
|
||||
if (entry->read_state.length != RHIZOME_SIZE_UNSET && fileOffset >= entry->read_state.length)
|
||||
return 0;
|
||||
|
||||
if (entry->expires < timeout){
|
||||
|
Loading…
x
Reference in New Issue
Block a user