aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2017-08-06 23:41:11 -0700
committerLev Walkin <vlm@lionet.info>2017-08-06 23:41:11 -0700
commit62d95d2ef469e8944679acbf08b126ec1fb87978 (patch)
tree115818127519e98f3622d221f2496dbcd9d5f678
parent645d2de9c34dc8cabbccf1bd277875b520dd8693 (diff)
rm warnings
-rw-r--r--asn1c/unber.c8
-rw-r--r--configure.ac2
-rw-r--r--libasn1compiler/asn1c_C.c4
-rw-r--r--libasn1fix/asn1fix_cws.c3
-rw-r--r--libasn1fix/asn1fix_misc.c5
-rw-r--r--libasn1parser/asn1p_class.c8
-rw-r--r--libasn1parser/asn1p_class.h4
-rw-r--r--libasn1parser/asn1p_constr.c2
-rw-r--r--libasn1parser/asn1p_expr.c5
-rw-r--r--libasn1parser/asn1p_expr.h4
-rw-r--r--libasn1parser/asn1p_ref.c5
-rw-r--r--libasn1parser/asn1p_ref.h4
-rw-r--r--libasn1print/asn1print.c7
13 files changed, 30 insertions, 31 deletions
diff --git a/asn1c/unber.c b/asn1c/unber.c
index f8588e2d..849ff07b 100644
--- a/asn1c/unber.c
+++ b/asn1c/unber.c
@@ -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);
diff --git a/configure.ac b/configure.ac
index cb3fe81a..d721e309 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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"])
diff --git a/libasn1compiler/asn1c_C.c b/libasn1compiler/asn1c_C.c
index 7c4d466a..c831b160 100644
--- a/libasn1compiler/asn1c_C.c
+++ b/libasn1compiler/asn1c_C.c
@@ -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);
diff --git a/libasn1fix/asn1fix_cws.c b/libasn1fix/asn1fix_cws.c
index de2d2406..ea0df20b 100644
--- a/libasn1fix/asn1fix_cws.c
+++ b/libasn1fix/asn1fix_cws.c
@@ -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;
diff --git a/libasn1fix/asn1fix_misc.c b/libasn1fix/asn1fix_misc.c
index 23ae24fc..283ed531 100644
--- a/libasn1fix/asn1fix_misc.c
+++ b/libasn1fix/asn1fix_misc.c
@@ -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++)
diff --git a/libasn1parser/asn1p_class.c b/libasn1parser/asn1p_class.c
index 666e0a2b..3312e4d4 100644
--- a/libasn1parser/asn1p_class.c
+++ b/libasn1parser/asn1p_class.c
@@ -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];
}
diff --git a/libasn1parser/asn1p_class.h b/libasn1parser/asn1p_class.h
index 08fd374e..3fd27ef5 100644
--- a/libasn1parser/asn1p_class.h
+++ b/libasn1parser/asn1p_class.h
@@ -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);
diff --git a/libasn1parser/asn1p_constr.c b/libasn1parser/asn1p_constr.c
index a9e939da..e83b2f8f 100644
--- a/libasn1parser/asn1p_constr.c
+++ b/libasn1parser/asn1p_constr.c
@@ -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;
}
diff --git a/libasn1parser/asn1p_expr.c b/libasn1parser/asn1p_expr.c
index 4383ea12..eb5fc79b 100644
--- a/libasn1parser/asn1p_expr.c
+++ b/libasn1parser/asn1p_expr.c
@@ -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);
}
diff --git a/libasn1parser/asn1p_expr.h b/libasn1parser/asn1p_expr.h
index 524f5321..c391361b 100644
--- a/libasn1parser/asn1p_expr.h
+++ b/libasn1parser/asn1p_expr.h
@@ -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;
/*
diff --git a/libasn1parser/asn1p_ref.c b/libasn1parser/asn1p_ref.c
index 64f51b4d..ebb17316 100644
--- a/libasn1parser/asn1p_ref.c
+++ b/libasn1parser/asn1p_ref.c
@@ -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
diff --git a/libasn1parser/asn1p_ref.h b/libasn1parser/asn1p_ref.h
index 776289b5..c5a99c1f 100644
--- a/libasn1parser/asn1p_ref.h
+++ b/libasn1parser/asn1p_ref.h
@@ -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 */
diff --git a/libasn1print/asn1print.c b/libasn1print/asn1print.c
index 037e713d..f15f2f64 100644
--- a/libasn1print/asn1print.c
+++ b/libasn1print/asn1print.c
@@ -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 ? " " : "");