Commit b1f4f33a authored by Lev Walkin's avatar Lev Walkin

remove gcc-7 compiler warnings

parent 0afbd325
...@@ -13,12 +13,9 @@ static int buf_offset; ...@@ -13,12 +13,9 @@ static int buf_offset;
static int static int
buf_writer(const void *buffer, size_t size, void *app_key) { buf_writer(const void *buffer, size_t size, void *app_key) {
char *b, *bend;
(void)app_key; (void)app_key;
assert(buf_offset + size < sizeof(buf)); assert(buf_offset + size < sizeof(buf));
memcpy(buf + buf_offset, buffer, size); memcpy(buf + buf_offset, buffer, size);
b = buf + buf_offset;
bend = b + size;
buf_offset += size; buf_offset += size;
return 0; return 0;
} }
......
...@@ -39,13 +39,13 @@ static size_t buf_offset; ...@@ -39,13 +39,13 @@ static size_t buf_offset;
static int static int
_buf_writer(const void *buffer, size_t size, void *app_key) { _buf_writer(const void *buffer, size_t size, void *app_key) {
unsigned char *b, *bend;
(void)app_key; (void)app_key;
assert(buf_offset + size < sizeof(buf)); assert(buf_offset + size < sizeof(buf));
memcpy(buf + buf_offset, buffer, size); memcpy(buf + buf_offset, buffer, size);
#ifdef EMIT_ASN_DEBUG
unsigned char *b, *bend;
b = buf + buf_offset; b = buf + buf_offset;
bend = b + size; bend = b + size;
#ifdef EMIT_ASN_DEBUG
fprintf(stderr, "=> ["); fprintf(stderr, "=> [");
for(; b < bend; b++) { for(; b < bend; b++) {
if(*b >= 32 && *b < 127 && *b != '%') if(*b >= 32 && *b < 127 && *b != '%')
...@@ -97,6 +97,8 @@ save_object_as(PDU_t *st, enum expectation exp, enum enctype how) { ...@@ -97,6 +97,8 @@ save_object_as(PDU_t *st, enum expectation exp, enum enctype how) {
rval = xer_encode(&asn_DEF_PDU, st, XER_F_CANONICAL, rval = xer_encode(&asn_DEF_PDU, st, XER_F_CANONICAL,
_buf_writer, 0); _buf_writer, 0);
break; break;
default:
assert(!"Unreachable");
} }
if (rval.encoded == -1) { if (rval.encoded == -1) {
...@@ -173,6 +175,8 @@ load_object_from(const char *fname, enum expectation expectation, unsigned char ...@@ -173,6 +175,8 @@ load_object_from(const char *fname, enum expectation expectation, unsigned char
case AS_DER: case AS_DER:
case AS_CXER: case AS_CXER:
assert(!"DER or CXER not supported for load"); assert(!"DER or CXER not supported for load");
default:
assert(!"Unreachable");
} }
fbuf_offset += rval.consumed; fbuf_offset += rval.consumed;
fbuf_left -= rval.consumed; fbuf_left -= rval.consumed;
......
...@@ -39,13 +39,13 @@ static size_t buf_offset; ...@@ -39,13 +39,13 @@ static size_t buf_offset;
static int static int
_buf_writer(const void *buffer, size_t size, void *app_key) { _buf_writer(const void *buffer, size_t size, void *app_key) {
unsigned char *b, *bend;
(void)app_key; (void)app_key;
assert(buf_offset + size < sizeof(buf)); assert(buf_offset + size < sizeof(buf));
memcpy(buf + buf_offset, buffer, size); memcpy(buf + buf_offset, buffer, size);
#ifdef EMIT_ASN_DEBUG
unsigned char *b, *bend;
b = buf + buf_offset; b = buf + buf_offset;
bend = b + size; bend = b + size;
#ifdef EMIT_ASN_DEBUG
fprintf(stderr, "=> ["); fprintf(stderr, "=> [");
for(; b < bend; b++) { for(; b < bend; b++) {
if(*b >= 32 && *b < 127 && *b != '%') if(*b >= 32 && *b < 127 && *b != '%')
...@@ -97,6 +97,8 @@ save_object_as(PDU_t *st, enum expectation exp, enum enctype how) { ...@@ -97,6 +97,8 @@ save_object_as(PDU_t *st, enum expectation exp, enum enctype how) {
rval = xer_encode(&asn_DEF_PDU, st, XER_F_CANONICAL, rval = xer_encode(&asn_DEF_PDU, st, XER_F_CANONICAL,
_buf_writer, 0); _buf_writer, 0);
break; break;
default:
assert(!"Unreachable");
} }
if (rval.encoded == -1) { if (rval.encoded == -1) {
...@@ -173,6 +175,8 @@ load_object_from(const char *fname, enum expectation expectation, unsigned char ...@@ -173,6 +175,8 @@ load_object_from(const char *fname, enum expectation expectation, unsigned char
case AS_DER: case AS_DER:
case AS_CXER: case AS_CXER:
assert(!"Unexpected DER or CXER load request"); assert(!"Unexpected DER or CXER load request");
default:
assert(!"Unreachable");
} }
fbuf_offset += rval.consumed; fbuf_offset += rval.consumed;
fbuf_left -= rval.consumed; fbuf_left -= rval.consumed;
......
...@@ -29,13 +29,13 @@ static int buf_offset; ...@@ -29,13 +29,13 @@ static int buf_offset;
static int static int
_buf_writer(const void *buffer, size_t size, void *app_key) { _buf_writer(const void *buffer, size_t size, void *app_key) {
unsigned char *b, *bend;
(void)app_key; (void)app_key;
assert(buf_offset + size < sizeof(buf)); assert(buf_offset + size < sizeof(buf));
memcpy(buf + buf_offset, buffer, size); memcpy(buf + buf_offset, buffer, size);
#ifdef EMIT_ASN_DEBUG
unsigned char *b, *bend;
b = buf + buf_offset; b = buf + buf_offset;
bend = b + size; bend = b + size;
#ifdef EMIT_ASN_DEBUG
fprintf(stderr, "=> ["); fprintf(stderr, "=> [");
for(; b < bend; b++) { for(; b < bend; b++) {
if(*b >= 32 && *b < 127 && *b != '%') if(*b >= 32 && *b < 127 && *b != '%')
...@@ -78,6 +78,8 @@ save_object_as(PDU_t *st, enum enctype how) { ...@@ -78,6 +78,8 @@ save_object_as(PDU_t *st, enum enctype how) {
rval = xer_encode(&asn_DEF_PDU, st, XER_F_BASIC, rval = xer_encode(&asn_DEF_PDU, st, XER_F_BASIC,
_buf_writer, 0); _buf_writer, 0);
break; break;
default:
assert(!"Unreachable");
} }
if (rval.encoded == -1) { if (rval.encoded == -1) {
...@@ -177,6 +179,8 @@ load_object_from(const char *fname, unsigned char *fbuf, size_t size, enum encty ...@@ -177,6 +179,8 @@ load_object_from(const char *fname, unsigned char *fbuf, size_t size, enum encty
} }
} }
break; break;
default:
assert(!"Unreachable");
} }
fbuf_offset += rval.consumed; fbuf_offset += rval.consumed;
fbuf_left -= rval.consumed; fbuf_left -= rval.consumed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment