Commit 72b10447 authored by Vasil Velichkov's avatar Vasil Velichkov Committed by Lev Walkin

Fix several sign-compare errors in the tests

parent 97656bdd
......@@ -26,7 +26,7 @@ check(uint8_t *buf, size_t size, long check_long, int check_ret) {
long rlong = 123;
assert(buf);
assert(size >= 0);
assert(size > 0);
val.buf = buf;
val.size = size;
......@@ -133,7 +133,7 @@ check_unsigned(uint8_t *buf, int size, unsigned long check_long, int check_ret)
assert(shared_scratch_start < scratch + sizeof(scratch));
assert(ret == 0);
ret = snprintf(verify, sizeof(verify), "%lu", check_long);
assert(ret < sizeof(verify));
assert(ret < (int)sizeof(verify));
ret = strcmp(scratch, verify);
printf(" [%s] vs [%s]: %d%s\n",
scratch, verify, ret,
......
......@@ -21,7 +21,7 @@ check_round_trip(int lineno, int ok, size_t length) {
size_t enc_len = 0;
ssize_t enc_len_len = oer_serialize_length(length, fill_buffer, &enc_len);
assert(enc_len_len > 0);
assert(enc_len == enc_len_len);
assert(enc_len == (size_t)enc_len_len);
/* Deserialize */
size_t recovered_length = 0;
......@@ -31,7 +31,8 @@ check_round_trip(int lineno, int ok, size_t length) {
}
ssize_t dec_len = oer_fetch_length(buffer, enc_len, &recovered_length);
if(ok) {
assert(dec_len == enc_len);
assert(dec_len > 0);
assert((size_t)dec_len == enc_len);
if(recovered_length != length) {
fprintf(stderr,
"Round-trip failed %zu->%zu (encoded %zd, decoded %zd)\n",
......
......@@ -92,13 +92,13 @@ check_ROID(int lineno, uint8_t *buf, size_t len, unsigned *ck_buf,
memset(arcs, 'A', sizeof(arcs));
alen = RELATIVE_OID_get_arcs(oid, arcs, sizeof(arcs) / sizeof(arcs[0]));
assert(alen > 0);
assert(alen == ck_len);
assert((size_t)alen == ck_len);
/*
* Make sure they are equivalent.
*/
printf("RELATIVE_OID_get_arcs() => {");
for(i = 0; i < alen; i++) {
for(i = 0; i < (size_t)alen; i++) {
printf(" %" PRIu32, arcs[i]);
assert(arcs[i] == ck_buf[i]);
}
......
......@@ -51,7 +51,7 @@ check_round_trip_OK(asn_TYPE_descriptor_t *td, const char *buf, size_t buflen) {
uper_output_buffer, (enc.encoded + 7) / 8, 0, 0);
int st_out_ct = asn_check_constraints(td, st_out, NULL, NULL);
assert(st_out_ct == 0);
assert(dec.consumed == enc.encoded);
assert(dec.consumed == (size_t)enc.encoded);
assert(st_in->size == st_out->size);
assert(memcmp(st_in->buf, st_out->buf, st_in->size) == 0);
assert(st_out->size == buflen);
......
......@@ -8,7 +8,7 @@ static void put(asn_per_outp_t *po, size_t length) {
ssize_t may_write = uper_put_length(po, length, &need_eom);
fprintf(stderr, " put %zu\n", may_write);
assert(may_write >= 0);
assert(may_write <= length);
assert((size_t)may_write <= length);
assert(need_eom != 123);
length -= may_write;
if(need_eom) {
......
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