Fix some other shorten-64-to-32 casting error found by MSVC (64bits)
Thanks for Pascal
This commit is contained in:
parent
c9b6371977
commit
9a3cdeb7e6
|
@ -236,7 +236,7 @@ ssize_t nghttp2_bufs_len(nghttp2_bufs *bufs)
|
||||||
|
|
||||||
static ssize_t bufs_avail(nghttp2_bufs *bufs)
|
static ssize_t bufs_avail(nghttp2_bufs *bufs)
|
||||||
{
|
{
|
||||||
return nghttp2_buf_avail(&bufs->cur->buf) +
|
return (ssize_t)nghttp2_buf_avail(&bufs->cur->buf) +
|
||||||
(bufs->chunk_length - bufs->offset) * (bufs->max_chunk - bufs->chunk_used);
|
(bufs->chunk_length - bufs->offset) * (bufs->max_chunk - bufs->chunk_used);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ ssize_t nghttp2_bufs_remove(nghttp2_bufs *bufs, uint8_t **out)
|
||||||
|
|
||||||
*out = res;
|
*out = res;
|
||||||
|
|
||||||
return len;
|
return (ssize_t)len;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nghttp2_bufs_reset(nghttp2_bufs *bufs)
|
void nghttp2_bufs_reset(nghttp2_bufs *bufs)
|
||||||
|
|
|
@ -483,7 +483,7 @@ static size_t encode_length(uint8_t *buf, size_t n, size_t prefix)
|
||||||
*buf++ = (1 << 7) | (n & 0x7f);
|
*buf++ = (1 << 7) | (n & 0x7f);
|
||||||
n >>= 7;
|
n >>= 7;
|
||||||
} else {
|
} else {
|
||||||
*buf++ = n;
|
*buf++ = (uint8_t)n;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while(n);
|
} while(n);
|
||||||
|
@ -883,7 +883,7 @@ static search_result search_hd_table(nghttp2_hd_context *context,
|
||||||
size_t i;
|
size_t i;
|
||||||
uint32_t name_hash = hash(nv->name, nv->namelen);
|
uint32_t name_hash = hash(nv->name, nv->namelen);
|
||||||
uint32_t value_hash = hash(nv->value, nv->valuelen);
|
uint32_t value_hash = hash(nv->value, nv->valuelen);
|
||||||
ssize_t left = -1, right = STATIC_TABLE_LENGTH;
|
ssize_t left = -1, right = (ssize_t)STATIC_TABLE_LENGTH;
|
||||||
int use_index = (nv->flags & NGHTTP2_NV_FLAG_NO_INDEX) == 0;
|
int use_index = (nv->flags & NGHTTP2_NV_FLAG_NO_INDEX) == 0;
|
||||||
|
|
||||||
if(use_index) {
|
if(use_index) {
|
||||||
|
@ -891,10 +891,10 @@ static search_result search_hd_table(nghttp2_hd_context *context,
|
||||||
nghttp2_hd_entry *ent = hd_ringbuf_get(&context->hd_table, i);
|
nghttp2_hd_entry *ent = hd_ringbuf_get(&context->hd_table, i);
|
||||||
if(ent->name_hash == name_hash && name_eq(&ent->nv, nv)) {
|
if(ent->name_hash == name_hash && name_eq(&ent->nv, nv)) {
|
||||||
if(res.index == -1) {
|
if(res.index == -1) {
|
||||||
res.index = i;
|
res.index = (ssize_t)i;
|
||||||
}
|
}
|
||||||
if(ent->value_hash == value_hash && value_eq(&ent->nv, nv)) {
|
if(ent->value_hash == value_hash && value_eq(&ent->nv, nv)) {
|
||||||
res.index = i;
|
res.index = (ssize_t)i;
|
||||||
res.name_value_match = 1;
|
res.name_value_match = 1;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -919,11 +919,11 @@ static search_result search_hd_table(nghttp2_hd_context *context,
|
||||||
}
|
}
|
||||||
if(name_eq(&ent->nv, nv)) {
|
if(name_eq(&ent->nv, nv)) {
|
||||||
if(res.index == -1) {
|
if(res.index == -1) {
|
||||||
res.index = context->hd_table.len + static_table[i].index;
|
res.index = (ssize_t)(context->hd_table.len + static_table[i].index);
|
||||||
}
|
}
|
||||||
if(use_index &&
|
if(use_index &&
|
||||||
ent->value_hash == value_hash && value_eq(&ent->nv, nv)) {
|
ent->value_hash == value_hash && value_eq(&ent->nv, nv)) {
|
||||||
res.index = context->hd_table.len + static_table[i].index;
|
res.index = (ssize_t)(context->hd_table.len + static_table[i].index);
|
||||||
res.name_value_match = 1;
|
res.name_value_match = 1;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -1274,7 +1274,7 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_deflater *deflater,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
return buflen;
|
return (ssize_t)buflen;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t nghttp2_hd_deflate_bound(nghttp2_hd_deflater *deflater,
|
size_t nghttp2_hd_deflate_bound(nghttp2_hd_deflater *deflater,
|
||||||
|
@ -1365,7 +1365,7 @@ static ssize_t hd_inflate_read_len(nghttp2_hd_inflater *inflater,
|
||||||
maxlen));
|
maxlen));
|
||||||
return NGHTTP2_ERR_HEADER_COMP;
|
return NGHTTP2_ERR_HEADER_COMP;
|
||||||
}
|
}
|
||||||
return nin - in;
|
return (ssize_t)(nin - in);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1428,8 +1428,8 @@ static ssize_t hd_inflate_read(nghttp2_hd_inflater *inflater,
|
||||||
if(rv != 0) {
|
if(rv != 0) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
inflater->left -= len;
|
inflater->left -= (ssize_t)len;
|
||||||
return len;
|
return (ssize_t)len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1758,7 +1758,7 @@ ssize_t nghttp2_hd_inflate_hd(nghttp2_hd_inflater *inflater,
|
||||||
/* If rv == 1, no header was emitted */
|
/* If rv == 1, no header was emitted */
|
||||||
if(rv == 0) {
|
if(rv == 0) {
|
||||||
*inflate_flags |= NGHTTP2_HD_INFLATE_EMIT;
|
*inflate_flags |= NGHTTP2_HD_INFLATE_EMIT;
|
||||||
return in - first;
|
return (ssize_t)(in - first);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
inflater->index = inflater->left;
|
inflater->index = inflater->left;
|
||||||
|
@ -1877,7 +1877,7 @@ ssize_t nghttp2_hd_inflate_hd(nghttp2_hd_inflater *inflater,
|
||||||
}
|
}
|
||||||
inflater->state = NGHTTP2_HD_STATE_OPCODE;
|
inflater->state = NGHTTP2_HD_STATE_OPCODE;
|
||||||
*inflate_flags |= NGHTTP2_HD_INFLATE_EMIT;
|
*inflate_flags |= NGHTTP2_HD_INFLATE_EMIT;
|
||||||
return in - first;
|
return (ssize_t)(in - first);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(inflater->huffman_encoded) {
|
if(inflater->huffman_encoded) {
|
||||||
|
@ -1918,7 +1918,7 @@ ssize_t nghttp2_hd_inflate_hd(nghttp2_hd_inflater *inflater,
|
||||||
inflater->state = NGHTTP2_HD_STATE_OPCODE;
|
inflater->state = NGHTTP2_HD_STATE_OPCODE;
|
||||||
*inflate_flags |= NGHTTP2_HD_INFLATE_EMIT;
|
*inflate_flags |= NGHTTP2_HD_INFLATE_EMIT;
|
||||||
|
|
||||||
return in - first;
|
return (ssize_t)(in - first);
|
||||||
case NGHTTP2_HD_STATE_READ_VALUE:
|
case NGHTTP2_HD_STATE_READ_VALUE:
|
||||||
rv = hd_inflate_read(inflater, &inflater->nvbufs, in, last);
|
rv = hd_inflate_read(inflater, &inflater->nvbufs, in, last);
|
||||||
if(rv < 0) {
|
if(rv < 0) {
|
||||||
|
@ -1950,7 +1950,7 @@ ssize_t nghttp2_hd_inflate_hd(nghttp2_hd_inflater *inflater,
|
||||||
inflater->state = NGHTTP2_HD_STATE_OPCODE;
|
inflater->state = NGHTTP2_HD_STATE_OPCODE;
|
||||||
*inflate_flags |= NGHTTP2_HD_INFLATE_EMIT;
|
*inflate_flags |= NGHTTP2_HD_INFLATE_EMIT;
|
||||||
|
|
||||||
return in - first;
|
return (ssize_t)(in - first);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1978,13 +1978,13 @@ ssize_t nghttp2_hd_inflate_hd(nghttp2_hd_inflater *inflater,
|
||||||
(ent->flags & NGHTTP2_HD_FLAG_EMIT) == 0) {
|
(ent->flags & NGHTTP2_HD_FLAG_EMIT) == 0) {
|
||||||
emit_indexed_header(nv_out, ent);
|
emit_indexed_header(nv_out, ent);
|
||||||
*inflate_flags |= NGHTTP2_HD_INFLATE_EMIT;
|
*inflate_flags |= NGHTTP2_HD_INFLATE_EMIT;
|
||||||
return in - first;
|
return (ssize_t)(in - first);
|
||||||
}
|
}
|
||||||
ent->flags &= ~NGHTTP2_HD_FLAG_EMIT;
|
ent->flags &= ~NGHTTP2_HD_FLAG_EMIT;
|
||||||
}
|
}
|
||||||
*inflate_flags |= NGHTTP2_HD_INFLATE_FINAL;
|
*inflate_flags |= NGHTTP2_HD_INFLATE_FINAL;
|
||||||
}
|
}
|
||||||
return in - first;
|
return (ssize_t)(in - first);
|
||||||
|
|
||||||
almost_ok:
|
almost_ok:
|
||||||
if(in_final && inflater->state != NGHTTP2_HD_STATE_OPCODE) {
|
if(in_final && inflater->state != NGHTTP2_HD_STATE_OPCODE) {
|
||||||
|
|
|
@ -95,7 +95,7 @@ static ssize_t huff_encode_sym(nghttp2_bufs *bufs, size_t *avail_ptr,
|
||||||
*avail_ptr = nghttp2_bufs_cur_avail(bufs);
|
*avail_ptr = nghttp2_bufs_cur_avail(bufs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rembits;
|
return (ssize_t)rembits;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t nghttp2_hd_huff_encode_count(const uint8_t *src, size_t len)
|
size_t nghttp2_hd_huff_encode_count(const uint8_t *src, size_t len)
|
||||||
|
@ -203,5 +203,5 @@ ssize_t nghttp2_hd_huff_decode(nghttp2_hd_huff_decode_context *ctx,
|
||||||
if(final && !ctx->accept) {
|
if(final && !ctx->accept) {
|
||||||
return NGHTTP2_ERR_HEADER_COMP;
|
return NGHTTP2_ERR_HEADER_COMP;
|
||||||
}
|
}
|
||||||
return i;
|
return (ssize_t)i;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue