mirror of
https://github.com/moparisthebest/spdylay
synced 2024-12-21 15:18:52 -05:00
Fixed compile error with -Wshadow. Fixed const cast.
This commit is contained in:
parent
6f066d7f64
commit
b06fa25ad2
@ -68,12 +68,12 @@ int spdylay_client_cert_vector_init(spdylay_client_cert_vector *certvec,
|
||||
certvec->size = certvec->capacity = size;
|
||||
certvec->last_slot = 0;
|
||||
if(certvec->capacity) {
|
||||
size_t size = sizeof(spdylay_origin*)*certvec->capacity;
|
||||
certvec->vector = malloc(size);
|
||||
size_t vec_size = sizeof(spdylay_origin*)*certvec->capacity;
|
||||
certvec->vector = malloc(vec_size);
|
||||
if(certvec->vector == NULL) {
|
||||
return SPDYLAY_ERR_NOMEM;
|
||||
}
|
||||
memset(certvec->vector, 0, size);
|
||||
memset(certvec->vector, 0, vec_size);
|
||||
} else {
|
||||
certvec->vector = NULL;
|
||||
}
|
||||
|
@ -195,11 +195,11 @@ int spdylay_frame_unpack_nv_check_name(uint8_t *buf, size_t buflen,
|
||||
{
|
||||
uint32_t n;
|
||||
size_t i;
|
||||
const uint8_t **index;
|
||||
const uint8_t **idx;
|
||||
n = spdylay_frame_get_nv_len(in, len_size);
|
||||
assert(n*sizeof(char*) <= buflen);
|
||||
in += len_size;
|
||||
index = (const uint8_t**)buf;
|
||||
idx = (const uint8_t**)buf;
|
||||
for(i = 0; i < n; ++i) {
|
||||
uint32_t len;
|
||||
size_t j;
|
||||
@ -207,7 +207,7 @@ int spdylay_frame_unpack_nv_check_name(uint8_t *buf, size_t buflen,
|
||||
if(len == 0) {
|
||||
return SPDYLAY_ERR_INVALID_HEADER_BLOCK;
|
||||
}
|
||||
*index++ = in;
|
||||
*idx++ = in;
|
||||
in += len_size;
|
||||
for(j = 0; j < len; ++j) {
|
||||
unsigned char c = in[j];
|
||||
@ -225,11 +225,11 @@ int spdylay_frame_unpack_nv_check_name(uint8_t *buf, size_t buflen,
|
||||
len_size == 2 ?
|
||||
spdylay_length_prefix_str_compar2 :
|
||||
spdylay_length_prefix_str_compar4);
|
||||
index = (const uint8_t**)buf;
|
||||
len1 = spdylay_frame_get_nv_len(*index, len_size);
|
||||
idx = (const uint8_t**)buf;
|
||||
len1 = spdylay_frame_get_nv_len(*idx, len_size);
|
||||
for(i = 1; i < n; ++i) {
|
||||
len2 = spdylay_frame_get_nv_len(*(index+i), len_size);
|
||||
if(len1 == len2 && memcmp(*(index+i-1)+len_size, *(index+i)+len_size,
|
||||
len2 = spdylay_frame_get_nv_len(*(idx+i), len_size);
|
||||
if(len1 == len2 && memcmp(*(idx+i-1)+len_size, *(idx+i)+len_size,
|
||||
len1) == 0) {
|
||||
return SPDYLAY_ERR_INVALID_HEADER_BLOCK;
|
||||
}
|
||||
@ -245,7 +245,7 @@ int spdylay_frame_unpack_nv(char ***nv_ptr, const uint8_t *in, size_t inlen,
|
||||
size_t nvlen, buflen;
|
||||
int r;
|
||||
size_t i;
|
||||
char *buf, **index, *data;
|
||||
char *buf, **idx, *data;
|
||||
uint32_t n;
|
||||
int invalid_header_block = 0;
|
||||
r = spdylay_frame_count_unpack_nv_space(&nvlen, &buflen, in, inlen, len_size);
|
||||
@ -265,7 +265,7 @@ int spdylay_frame_unpack_nv(char ***nv_ptr, const uint8_t *in, size_t inlen,
|
||||
free(buf);
|
||||
return r;
|
||||
}
|
||||
index = (char**)buf;
|
||||
idx = (char**)buf;
|
||||
data = buf+(nvlen*2+1)*sizeof(char*);
|
||||
n = spdylay_frame_get_nv_len(in, len_size);
|
||||
in += len_size;
|
||||
@ -289,8 +289,8 @@ int spdylay_frame_unpack_nv(char ***nv_ptr, const uint8_t *in, size_t inlen,
|
||||
|
||||
for(stop = data+len; data != stop; ++data) {
|
||||
if(*data == '\0') {
|
||||
*index++ = name;
|
||||
*index++ = val;
|
||||
*idx++ = name;
|
||||
*idx++ = val;
|
||||
if(val == data) {
|
||||
invalid_header_block = 1;
|
||||
}
|
||||
@ -301,11 +301,11 @@ int spdylay_frame_unpack_nv(char ***nv_ptr, const uint8_t *in, size_t inlen,
|
||||
++data;
|
||||
in += len;
|
||||
|
||||
*index++ = name;
|
||||
*index++ = val;
|
||||
*idx++ = name;
|
||||
*idx++ = val;
|
||||
}
|
||||
*index = NULL;
|
||||
assert((size_t)((char*)index - buf) == (nvlen*2)*sizeof(char*));
|
||||
*idx = NULL;
|
||||
assert((size_t)((char*)idx - buf) == (nvlen*2)*sizeof(char*));
|
||||
*nv_ptr = (char**)buf;
|
||||
return invalid_header_block ? SPDYLAY_ERR_INVALID_HEADER_BLOCK : 0;
|
||||
}
|
||||
@ -406,7 +406,7 @@ char** spdylay_frame_nv_copy(const char **nv)
|
||||
{
|
||||
int i;
|
||||
char *buf;
|
||||
char **index, *data;
|
||||
char **idx, *data;
|
||||
size_t buflen = 0;
|
||||
for(i = 0; nv[i]; ++i) {
|
||||
buflen += strlen(nv[i])+1;
|
||||
@ -416,16 +416,16 @@ char** spdylay_frame_nv_copy(const char **nv)
|
||||
if(buf == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
index = (char**)buf;
|
||||
idx = (char**)buf;
|
||||
data = buf+(i+1)*sizeof(char*);
|
||||
|
||||
for(i = 0; nv[i]; ++i) {
|
||||
size_t len = strlen(nv[i])+1;
|
||||
memcpy(data, nv[i], len);
|
||||
*index++ = data;
|
||||
*idx++ = data;
|
||||
data += len;
|
||||
}
|
||||
*index = NULL;
|
||||
*idx = NULL;
|
||||
return (char**)buf;
|
||||
}
|
||||
|
||||
@ -465,7 +465,7 @@ char** spdylay_frame_nv_norm_copy(const char **nv)
|
||||
}
|
||||
|
||||
/* Table to translate SPDY/3 header names to SPDY/2. */
|
||||
static char *spdylay_nv_3to2[] = {
|
||||
static const char *spdylay_nv_3to2[] = {
|
||||
":host", "host",
|
||||
":method", "method",
|
||||
":path", "url",
|
||||
@ -481,7 +481,7 @@ void spdylay_frame_nv_3to2(char **nv)
|
||||
for(i = 0; nv[i]; i += 2) {
|
||||
for(j = 0; spdylay_nv_3to2[j]; j += 2) {
|
||||
if(strcmp(nv[i], spdylay_nv_3to2[j]) == 0) {
|
||||
nv[i] = spdylay_nv_3to2[j+1];
|
||||
nv[i] = (char*)spdylay_nv_3to2[j+1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -494,7 +494,7 @@ void spdylay_frame_nv_2to3(char **nv)
|
||||
for(i = 0; nv[i]; i += 2) {
|
||||
for(j = 0; spdylay_nv_3to2[j]; j += 2) {
|
||||
if(strcmp(nv[i], spdylay_nv_3to2[j+1]) == 0) {
|
||||
nv[i] = spdylay_nv_3to2[j];
|
||||
nv[i] = (char*)spdylay_nv_3to2[j];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1375,11 +1375,12 @@ static int spdylay_session_after_frame_sent(spdylay_session *session)
|
||||
data_frame->stream_id) != 0) {
|
||||
spdylay_active_outbound_item_reset(&session->aob);
|
||||
} else {
|
||||
spdylay_outbound_item* item = spdylay_session_get_next_ob_item(session);
|
||||
spdylay_outbound_item* next_item;
|
||||
next_item = spdylay_session_get_next_ob_item(session);
|
||||
/* If priority of this stream is higher or equal to other stream
|
||||
waiting at the top of the queue, we continue to send this
|
||||
data. */
|
||||
if(item == NULL || session->aob.item->pri <= item->pri) {
|
||||
if(next_item == NULL || session->aob.item->pri <= next_item->pri) {
|
||||
size_t next_readmax;
|
||||
spdylay_stream *stream;
|
||||
stream = spdylay_session_get_stream(session, data_frame->stream_id);
|
||||
|
Loading…
Reference in New Issue
Block a user