Commit 62d95d2e authored by Lev Walkin's avatar Lev Walkin

rm warnings

parent 645d2de9
...@@ -52,7 +52,7 @@ static int decode_tlv_from_string(const char *datastring); ...@@ -52,7 +52,7 @@ static int decode_tlv_from_string(const char *datastring);
static int single_type_decoding = 0; /* -1 enables that */ static int single_type_decoding = 0; /* -1 enables that */
static int minimalistic = 0; /* -m enables that */ static int minimalistic = 0; /* -m enables that */
static int pretty_printing = 1; /* -p disables 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 */ static char indent_bytes[16] = " "; /* -i controls that */
int int
...@@ -84,7 +84,7 @@ main(int ac, char **av) { ...@@ -84,7 +84,7 @@ main(int ac, char **av) {
pretty_printing = 0; pretty_printing = 0;
break; break;
case 's': case 's':
skip_bytes = atoi(optarg); skip_bytes = atol(optarg);
if(skip_bytes < 0) { if(skip_bytes < 0) {
fprintf(stderr, "-s %s: positive value expected\n", optarg); fprintf(stderr, "-s %s: positive value expected\n", optarg);
exit(EX_USAGE); exit(EX_USAGE);
...@@ -196,10 +196,10 @@ process(const char *fname) { ...@@ -196,10 +196,10 @@ process(const char *fname) {
/* /*
* Skip the requested amount of bytes. * Skip the requested amount of bytes.
*/ */
for(; offset < skip_bytes; offset++) { for(; offset < (size_t)skip_bytes; offset++) {
if(fgetc(fp) == -1) { if(fgetc(fp) == -1) {
fprintf(stderr, "%s: input source (%zu bytes) " 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", "wants to skip\n",
fname, offset, skip_bytes); fname, offset, skip_bytes);
if(fp != stdin) fclose(fp); if(fp != stdin) fclose(fp);
......
...@@ -58,7 +58,7 @@ AX_CHECK_COMPILE_FLAG([-Wno-error=visibility], ...@@ -58,7 +58,7 @@ AX_CHECK_COMPILE_FLAG([-Wno-error=visibility],
AX_CHECK_COMPILE_FLAG([-Wno-error=parentheses-equality], AX_CHECK_COMPILE_FLAG([-Wno-error=parentheses-equality],
[CFLAGS="$CFLAGS -Wno-error=parentheses-equality"]) [CFLAGS="$CFLAGS -Wno-error=parentheses-equality"])
AX_CHECK_COMPILE_FLAG([-std=gnu99], AX_CHECK_COMPILE_FLAG([-std=gnu99],
[CFLAGS="$CFLAGS-std=gnu99" [CFLAGS="$CFLAGS -std=gnu99"
TESTSUITE_CFLAGS="$TESTSUITE_CFLAGS -std=gnu99"]) TESTSUITE_CFLAGS="$TESTSUITE_CFLAGS -std=gnu99"])
AX_CHECK_COMPILE_FLAG([-Wno-error=unused-variable], AX_CHECK_COMPILE_FLAG([-Wno-error=unused-variable],
[TESTSUITE_CFLAGS="$TESTSUITE_CFLAGS -Wno-error=unused-variable"]) [TESTSUITE_CFLAGS="$TESTSUITE_CFLAGS -Wno-error=unused-variable"])
......
...@@ -323,6 +323,10 @@ typedef struct asn1c_ioc_table_s { ...@@ -323,6 +323,10 @@ typedef struct asn1c_ioc_table_s {
static asn1c_ioc_table_t * static asn1c_ioc_table_t *
asn1c_construct_ioc_table_from_objset(arg_t *arg, const asn1p_ref_t *objset_ref, asn1p_expr_t *objset) { 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; asn1c_ioc_table_t *itable = NULL;
itable = calloc(1, sizeof(*itable)); itable = calloc(1, sizeof(*itable));
assert(itable); assert(itable);
......
...@@ -371,7 +371,6 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_row_s *row, ...@@ -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, struct asn1p_ioc_cell_s *cell, const uint8_t *buf,
const uint8_t *bend) { const uint8_t *bend) {
asn1p_expr_t *expr = (asn1p_expr_t *)NULL; asn1p_expr_t *expr = (asn1p_expr_t *)NULL;
int idLength;
char *p; char *p;
int new_ref = 1; int new_ref = 1;
asn1p_t *asn; asn1p_t *asn;
...@@ -482,7 +481,7 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_row_s *row, ...@@ -482,7 +481,7 @@ _asn1f_assign_cell_value(arg_t *arg, struct asn1p_ioc_row_s *row,
cell->value = expr; cell->value = expr;
cell->new_ref = new_ref; cell->new_ref = new_ref;
idLength = strlen(expr->Identifier); size_t idLength = strlen(expr->Identifier);
if(row->max_identifier_length < idLength) if(row->max_identifier_length < idLength)
row->max_identifier_length = idLength; row->max_identifier_length = idLength;
......
...@@ -129,12 +129,11 @@ asn1f_printable_value(asn1p_value_t *v) { ...@@ -129,12 +129,11 @@ asn1f_printable_value(asn1p_value_t *v) {
asn1p_ref_t *ref; asn1p_ref_t *ref;
size_t reflen; size_t reflen;
char *ptr; char *ptr;
int i;
assert(v->value.reference); assert(v->value.reference);
ref = v->value.reference; ref = v->value.reference;
reflen = ref->comp_count; /* Number of dots */ 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); reflen += strlen(ref->components[i].name);
/* /*
* Make sure we have a buffer of this size. * Make sure we have a buffer of this size.
...@@ -145,7 +144,7 @@ asn1f_printable_value(asn1p_value_t *v) { ...@@ -145,7 +144,7 @@ asn1f_printable_value(asn1p_value_t *v) {
* Fill-up the buffer. * Fill-up the buffer.
*/ */
ptr = managedptr; ptr = managedptr;
for(i = 0; i < ref->comp_count; i++) { for(size_t i = 0; i < ref->comp_count; i++) {
char *nc; char *nc;
if(i) *ptr++ = '.'; if(i) *ptr++ = '.';
for(nc = ref->components[i].name; *nc; nc++) for(nc = ref->components[i].name; *nc; nc++)
......
...@@ -29,7 +29,7 @@ asn1p_ioc_row_new(asn1p_expr_t *oclass) { ...@@ -29,7 +29,7 @@ asn1p_ioc_row_new(asn1p_expr_t *oclass) {
columns = 0; columns = 0;
TQ_FOR(field, &oclass->members, next) { TQ_FOR(field, &oclass->members, next) {
int fieldIdLen = strlen(field->Identifier); size_t fieldIdLen = strlen(field->Identifier);
if(fieldIdLen > row->max_identifier_length) if(fieldIdLen > row->max_identifier_length)
row->max_identifier_length = fieldIdLen; row->max_identifier_length = fieldIdLen;
row->column[columns].field = field; row->column[columns].field = field;
...@@ -42,10 +42,9 @@ asn1p_ioc_row_new(asn1p_expr_t *oclass) { ...@@ -42,10 +42,9 @@ asn1p_ioc_row_new(asn1p_expr_t *oclass) {
void void
asn1p_ioc_row_delete(asn1p_ioc_row_t *row) { asn1p_ioc_row_delete(asn1p_ioc_row_t *row) {
int i;
if(row) { if(row) {
if(row->column) { 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) { if(!row->column[i].new_ref && row->column[i].value) {
/* /*
* Field 'reference' comes from asn1fix_cws.c : * 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) { ...@@ -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 * struct asn1p_ioc_cell_s *
asn1p_ioc_row_cell_fetch(asn1p_ioc_row_t *row, const char *fieldname) { asn1p_ioc_row_cell_fetch(asn1p_ioc_row_t *row, const char *fieldname) {
int i; for(size_t i = 0; i < row->columns; i++) {
for(i = 0; i < row->columns; i++) {
if(strcmp(row->column[i].field->Identifier, fieldname) == 0) if(strcmp(row->column[i].field->Identifier, fieldname) == 0)
return &row->column[i]; return &row->column[i];
} }
......
...@@ -14,8 +14,8 @@ typedef struct asn1p_ioc_row_s { ...@@ -14,8 +14,8 @@ typedef struct asn1p_ioc_row_s {
struct asn1p_expr_s *value; /* may be left uninitialized */ struct asn1p_expr_s *value; /* may be left uninitialized */
int new_ref; int new_ref;
} *column; } *column;
int columns; size_t columns;
int max_identifier_length; size_t max_identifier_length;
} asn1p_ioc_row_t; } asn1p_ioc_row_t;
asn1p_ioc_row_t *asn1p_ioc_row_new(struct asn1p_expr_s *oclass); asn1p_ioc_row_t *asn1p_ioc_row_new(struct asn1p_expr_s *oclass);
......
...@@ -24,6 +24,8 @@ asn1p_constraint_set_source(asn1p_constraint_t *ct, ...@@ -24,6 +24,8 @@ asn1p_constraint_set_source(asn1p_constraint_t *ct,
int asn1p_constraint_compare(const asn1p_constraint_t *a, int asn1p_constraint_compare(const asn1p_constraint_t *a,
const asn1p_constraint_t *b) { const asn1p_constraint_t *b) {
(void)a;
(void)b;
assert(!"Constraint comparison is not implemented"); assert(!"Constraint comparison is not implemented");
return -1; return -1;
} }
......
...@@ -346,8 +346,7 @@ asn1p_expr_free(asn1p_expr_t *expr) { ...@@ -346,8 +346,7 @@ asn1p_expr_free(asn1p_expr_t *expr) {
free(expr->specializations.pspec); free(expr->specializations.pspec);
} }
if(expr->object_class_matrix.row) { if(expr->object_class_matrix.row) {
int row; for(size_t row = 0; row < expr->object_class_matrix.rows; row++) {
for(row = 0; row < expr->object_class_matrix.rows; row++) {
asn1p_ioc_row_delete(expr->object_class_matrix.row[row]); asn1p_ioc_row_delete(expr->object_class_matrix.row[row]);
} }
free(expr->object_class_matrix.row); free(expr->object_class_matrix.row);
......
...@@ -181,8 +181,8 @@ typedef struct asn1p_expr_s { ...@@ -181,8 +181,8 @@ typedef struct asn1p_expr_s {
/* Information Object Class matrix, specific for this class */ /* Information Object Class matrix, specific for this class */
struct asn1p_ioc_matrix_s { struct asn1p_ioc_matrix_s {
asn1p_ioc_row_t **row; asn1p_ioc_row_t **row;
int rows; size_t rows;
int max_identifier_length; size_t max_identifier_length;
} object_class_matrix; } object_class_matrix;
/* /*
......
...@@ -24,7 +24,7 @@ void ...@@ -24,7 +24,7 @@ void
asn1p_ref_free(asn1p_ref_t *ref) { asn1p_ref_free(asn1p_ref_t *ref) {
if(ref) { if(ref) {
if(ref->components) { if(ref->components) {
int i = ref->comp_count; size_t i = ref->comp_count;
while(i--) { while(i--) {
free(ref->components[i].name); free(ref->components[i].name);
ref->components[i].name = 0; ref->components[i].name = 0;
...@@ -127,8 +127,7 @@ asn1p_ref_clone(asn1p_ref_t *ref) { ...@@ -127,8 +127,7 @@ asn1p_ref_clone(asn1p_ref_t *ref) {
newref = asn1p_ref_new(ref->_lineno, ref->module); newref = asn1p_ref_new(ref->_lineno, ref->module);
if(newref) { if(newref) {
int i; for(size_t i = 0; i < ref->comp_count; i++) {
for(i = 0; i < ref->comp_count; i++) {
if(asn1p_ref_add_component(newref, if(asn1p_ref_add_component(newref,
ref->components[i].name, ref->components[i].name,
ref->components[i].lex_type ref->components[i].lex_type
......
...@@ -34,8 +34,8 @@ typedef struct asn1p_ref_s { ...@@ -34,8 +34,8 @@ typedef struct asn1p_ref_s {
char *name; /* An identifier */ char *name; /* An identifier */
} *components; } *components;
int comp_count; /* Number of the components in the reference name. */ size_t comp_count; /* Number of the components in the reference name. */
int comp_size; /* Number of allocated structures */ size_t comp_size; /* Number of allocated structures */
struct asn1p_module_s *module; /* Defined in module */ struct asn1p_module_s *module; /* Defined in module */
int _lineno; /* Number of line in the file */ int _lineno; /* Number of line in the file */
......
...@@ -170,11 +170,10 @@ asn1print_oid(int prior_len, asn1p_oid_t *oid, enum asn1print_flags flags) { ...@@ -170,11 +170,10 @@ asn1print_oid(int prior_len, asn1p_oid_t *oid, enum asn1print_flags flags) {
static int static int
asn1print_ref(asn1p_ref_t *ref, enum asn1print_flags flags) { asn1print_ref(asn1p_ref_t *ref, enum asn1print_flags flags) {
int cc;
(void)flags; /* Unused argument */ (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("."); if(cc) safe_printf(".");
safe_printf("%s", ref->components[cc].name); 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 ...@@ -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 if(flags & APF_PRINT_CLASS_MATRIX
&& tc->expr_type == A1TC_CLASSDEF) do { && tc->expr_type == A1TC_CLASSDEF) do {
int r, col, maxidlen; size_t col, maxidlen;
if(tc->object_class_matrix.rows == 0) { if(tc->object_class_matrix.rows == 0) {
safe_printf("\n-- Class matrix is empty"); safe_printf("\n-- Class matrix is empty");
break; break;
...@@ -786,7 +785,7 @@ asn1print_expr(asn1p_t *asn, asn1p_module_t *mod, asn1p_expr_t *tc, enum asn1pri ...@@ -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,
tc->object_class_matrix.rows==1 ? "y" : "ies"); tc->object_class_matrix.rows==1 ? "y" : "ies");
maxidlen = tc->object_class_matrix.max_identifier_length; 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; struct asn1p_ioc_row_s *row;
row = tc->object_class_matrix.row[r<0?0:r]; row = tc->object_class_matrix.row[r<0?0:r];
if(r < 0) safe_printf("-- %s", r > 9 ? " " : ""); if(r < 0) safe_printf("-- %s", r > 9 ? " " : "");
......
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