rm warnings

This commit is contained in:
Lev Walkin 2017-08-06 23:41:11 -07:00
parent 645d2de9c3
commit 62d95d2ef4
13 changed files with 30 additions and 31 deletions

View File

@ -52,7 +52,7 @@ static int decode_tlv_from_string(const char *datastring);
static int single_type_decoding = 0; /* -1 enables that */
static int minimalistic = 0; /* -m enables that */
static int pretty_printing = 1; /* -p disables that */
static int skip_bytes = 0; /* -s controls that */
static long skip_bytes = 0; /* -s controls that */
static char indent_bytes[16] = " "; /* -i controls that */
int
@ -84,7 +84,7 @@ main(int ac, char **av) {
pretty_printing = 0;
break;
case 's':
skip_bytes = atoi(optarg);
skip_bytes = atol(optarg);
if(skip_bytes < 0) {
fprintf(stderr, "-s %s: positive value expected\n", optarg);
exit(EX_USAGE);
@ -196,10 +196,10 @@ process(const char *fname) {
/*
* Skip the requested amount of bytes.
*/
for(; offset < skip_bytes; offset++) {
for(; offset < (size_t)skip_bytes; offset++) {
if(fgetc(fp) == -1) {
fprintf(stderr, "%s: input source (%zu bytes) "
"has less data than \"-s %d\" switch "
"has less data than \"-s %ld\" switch "
"wants to skip\n",
fname, offset, skip_bytes);
if(fp != stdin) fclose(fp);

View File

@ -58,7 +58,7 @@ AX_CHECK_COMPILE_FLAG([-Wno-error=visibility],
AX_CHECK_COMPILE_FLAG([-Wno-error=parentheses-equality],
[CFLAGS="$CFLAGS -Wno-error=parentheses-equality"])
AX_CHECK_COMPILE_FLAG([-std=gnu99],
[CFLAGS="$CFLAGS-std=gnu99"
[CFLAGS="$CFLAGS -std=gnu99"
TESTSUITE_CFLAGS="$TESTSUITE_CFLAGS -std=gnu99"])
AX_CHECK_COMPILE_FLAG([-Wno-error=unused-variable],
[TESTSUITE_CFLAGS="$TESTSUITE_CFLAGS -Wno-error=unused-variable"])

View File

@ -323,6 +323,10 @@ typedef struct asn1c_ioc_table_s {
static asn1c_ioc_table_t *
asn1c_construct_ioc_table_from_objset(arg_t *arg, const asn1p_ref_t *objset_ref, asn1p_expr_t *objset) {
(void)arg;
(void)objset_ref;
(void)objset;
asn1c_ioc_table_t *itable = NULL;
itable = calloc(1, sizeof(*itable));
assert(itable);

View File

@ -371,7 +371,6 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_row_s *row,
struct asn1p_ioc_cell_s *cell, const uint8_t *buf,
const uint8_t *bend) {
asn1p_expr_t *expr = (asn1p_expr_t *)NULL;
int idLength;
char *p;
int new_ref = 1;
asn1p_t *asn;
@ -482,7 +481,7 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_row_s *row,
cell->value = expr;
cell->new_ref = new_ref;
idLength = strlen(expr->Identifier);
size_t idLength = strlen(expr->Identifier);
if(row->max_identifier_length < idLength)
row->max_identifier_length = idLength;

View File

@ -129,12 +129,11 @@ asn1f_printable_value(asn1p_value_t *v) {
asn1p_ref_t *ref;
size_t reflen;
char *ptr;
int i;
assert(v->value.reference);
ref = v->value.reference;
reflen = ref->comp_count; /* Number of dots */
for(i = 0; i < ref->comp_count; i++)
for(size_t i = 0; i < ref->comp_count; i++)
reflen += strlen(ref->components[i].name);
/*
* Make sure we have a buffer of this size.
@ -145,7 +144,7 @@ asn1f_printable_value(asn1p_value_t *v) {
* Fill-up the buffer.
*/
ptr = managedptr;
for(i = 0; i < ref->comp_count; i++) {
for(size_t i = 0; i < ref->comp_count; i++) {
char *nc;
if(i) *ptr++ = '.';
for(nc = ref->components[i].name; *nc; nc++)

View File

@ -29,7 +29,7 @@ asn1p_ioc_row_new(asn1p_expr_t *oclass) {
columns = 0;
TQ_FOR(field, &oclass->members, next) {
int fieldIdLen = strlen(field->Identifier);
size_t fieldIdLen = strlen(field->Identifier);
if(fieldIdLen > row->max_identifier_length)
row->max_identifier_length = fieldIdLen;
row->column[columns].field = field;
@ -42,10 +42,9 @@ asn1p_ioc_row_new(asn1p_expr_t *oclass) {
void
asn1p_ioc_row_delete(asn1p_ioc_row_t *row) {
int i;
if(row) {
if(row->column) {
for(i = 0; i < row->columns; i++) {
for(size_t i = 0; i < row->columns; i++) {
if(!row->column[i].new_ref && row->column[i].value) {
/*
* Field 'reference' comes from asn1fix_cws.c :
@ -94,8 +93,7 @@ asn1p_ioc_row_match(const asn1p_ioc_row_t *a, const asn1p_ioc_row_t *b) {
struct asn1p_ioc_cell_s *
asn1p_ioc_row_cell_fetch(asn1p_ioc_row_t *row, const char *fieldname) {
int i;
for(i = 0; i < row->columns; i++) {
for(size_t i = 0; i < row->columns; i++) {
if(strcmp(row->column[i].field->Identifier, fieldname) == 0)
return &row->column[i];
}

View File

@ -14,8 +14,8 @@ typedef struct asn1p_ioc_row_s {
struct asn1p_expr_s *value; /* may be left uninitialized */
int new_ref;
} *column;
int columns;
int max_identifier_length;
size_t columns;
size_t max_identifier_length;
} asn1p_ioc_row_t;
asn1p_ioc_row_t *asn1p_ioc_row_new(struct asn1p_expr_s *oclass);

View File

@ -24,6 +24,8 @@ asn1p_constraint_set_source(asn1p_constraint_t *ct,
int asn1p_constraint_compare(const asn1p_constraint_t *a,
const asn1p_constraint_t *b) {
(void)a;
(void)b;
assert(!"Constraint comparison is not implemented");
return -1;
}

View File

@ -346,9 +346,8 @@ asn1p_expr_free(asn1p_expr_t *expr) {
free(expr->specializations.pspec);
}
if(expr->object_class_matrix.row) {
int row;
for(row = 0; row < expr->object_class_matrix.rows; row++) {
asn1p_ioc_row_delete(expr->object_class_matrix.row[row]);
for(size_t row = 0; row < expr->object_class_matrix.rows; row++) {
asn1p_ioc_row_delete(expr->object_class_matrix.row[row]);
}
free(expr->object_class_matrix.row);
}

View File

@ -181,8 +181,8 @@ typedef struct asn1p_expr_s {
/* Information Object Class matrix, specific for this class */
struct asn1p_ioc_matrix_s {
asn1p_ioc_row_t **row;
int rows;
int max_identifier_length;
size_t rows;
size_t max_identifier_length;
} object_class_matrix;
/*

View File

@ -24,7 +24,7 @@ void
asn1p_ref_free(asn1p_ref_t *ref) {
if(ref) {
if(ref->components) {
int i = ref->comp_count;
size_t i = ref->comp_count;
while(i--) {
free(ref->components[i].name);
ref->components[i].name = 0;
@ -127,8 +127,7 @@ asn1p_ref_clone(asn1p_ref_t *ref) {
newref = asn1p_ref_new(ref->_lineno, ref->module);
if(newref) {
int i;
for(i = 0; i < ref->comp_count; i++) {
for(size_t i = 0; i < ref->comp_count; i++) {
if(asn1p_ref_add_component(newref,
ref->components[i].name,
ref->components[i].lex_type

View File

@ -34,8 +34,8 @@ typedef struct asn1p_ref_s {
char *name; /* An identifier */
} *components;
int comp_count; /* Number of the components in the reference name. */
int comp_size; /* Number of allocated structures */
size_t comp_count; /* Number of the components in the reference name. */
size_t comp_size; /* Number of allocated structures */
struct asn1p_module_s *module; /* Defined in module */
int _lineno; /* Number of line in the file */

View File

@ -170,11 +170,10 @@ asn1print_oid(int prior_len, asn1p_oid_t *oid, enum asn1print_flags flags) {
static int
asn1print_ref(asn1p_ref_t *ref, enum asn1print_flags flags) {
int cc;
(void)flags; /* Unused argument */
for(cc = 0; cc < ref->comp_count; cc++) {
for(size_t cc = 0; cc < ref->comp_count; cc++) {
if(cc) safe_printf(".");
safe_printf("%s", ref->components[cc].name);
}
@ -777,7 +776,7 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri
if(flags & APF_PRINT_CLASS_MATRIX
&& tc->expr_type == A1TC_CLASSDEF) do {
int r, col, maxidlen;
size_t col, maxidlen;
if(tc->object_class_matrix.rows == 0) {
safe_printf("\n-- Class matrix is empty");
break;
@ -786,7 +785,7 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri
tc->object_class_matrix.rows,
tc->object_class_matrix.rows==1 ? "y" : "ies");
maxidlen = tc->object_class_matrix.max_identifier_length;
for(r = -1; r < tc->object_class_matrix.rows; r++) {
for(ssize_t r = -1; r < (ssize_t)tc->object_class_matrix.rows; r++) {
struct asn1p_ioc_row_s *row;
row = tc->object_class_matrix.row[r<0?0:r];
if(r < 0) safe_printf("-- %s", r > 9 ? " " : "");