summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--configure.ac2
-rw-r--r--lib/coding.c37
-rw-r--r--lib/decoding.c26
-rw-r--r--lib/element.c52
-rw-r--r--lib/element.h2
-rw-r--r--lib/int.h6
-rw-r--r--lib/parser_aux.c21
-rw-r--r--lib/structure.c4
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/Test_errors.c4
-rw-r--r--tests/Test_indefinite.c2
-rw-r--r--tests/Test_parser.c13
-rw-r--r--tests/Test_simple.c11
-rw-r--r--tests/Test_tree.c8
15 files changed, 97 insertions, 93 deletions
diff --git a/NEWS b/NEWS
index bc373e5..fa71ae9 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ GNU Libtasn1 NEWS -*- outline -*-
- tests: Added self-test of bit string functions.
- build: Added windows/libtasn14win.mk rules to produce Windows binaries.
- build: Don't hard code path to perl in doc/gdoc.
+- build: Now builds without compiler warnings with Solaris CC.
* Noteworthy changes in release 2.10 (2011-10-25) [stable]
- lib: Small optimization, possibly working around gcc/valgrind issue.
diff --git a/configure.ac b/configure.ac
index f74cb13..6353287 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,8 +92,6 @@ if test "$gl_gcc_warnings" = yes; then
done
gl_WARN_ADD([-Wno-missing-field-initializers])
- gl_WARN_ADD([-Wno-sign-compare])
- gl_WARN_ADD([-Wno-pointer-sign])
gl_WARN_ADD([-Wno-unused-parameter])
gl_WARN_ADD([-Wno-stack-protector]) # Some functions cannot be protected
gl_WARN_ADD([-fdiagnostics-show-option])
diff --git a/lib/coding.c b/lib/coding.c
index 5cdab62..af69b14 100644
--- a/lib/coding.c
+++ b/lib/coding.c
@@ -183,14 +183,15 @@ _asn1_time_der (unsigned char *str, unsigned char *der, int *der_len)
{
int len_len;
int max_len;
+ int str_len = _asn1_strlen (str);
max_len = *der_len;
- asn1_length_der (strlen (str), (max_len > 0) ? der : NULL, &len_len);
+ asn1_length_der (str_len, (max_len > 0) ? der : NULL, &len_len);
- if ((len_len + (int) strlen (str)) <= max_len)
- memcpy (der + len_len, str, strlen (str));
- *der_len = len_len + strlen (str);
+ if ((len_len + str_len) <= max_len)
+ memcpy (der + len_len, str, str_len);
+ *der_len = len_len + str_len;
if ((*der_len) > max_len)
return ASN1_MEM_ERROR;
@@ -256,7 +257,7 @@ _asn1_objectid_der (unsigned char *str, unsigned char *der, int *der_len)
char *temp, *n_end, *n_start;
unsigned char bit7;
unsigned long val, val1 = 0;
- int str_len = strlen(str);
+ int str_len = _asn1_strlen(str);
max_len = *der_len;
@@ -453,7 +454,7 @@ _asn1_insert_tag_der (ASN1_TYPE node, unsigned char *der, int *counter,
int tag_len, is_tag_implicit;
unsigned char class, class_implicit = 0, temp[SIZEOF_UNSIGNED_INT * 3 + 1];
unsigned long tag_implicit = 0;
- char tag_der[MAX_TAG_LEN];
+ unsigned char tag_der[MAX_TAG_LEN];
is_tag_implicit = 0;
@@ -480,16 +481,16 @@ _asn1_insert_tag_der (ASN1_TYPE node, unsigned char *der, int *counter,
&tag_len);
else
_asn1_tag_der (class | ASN1_CLASS_STRUCTURED,
- strtoul (p->value, NULL, 10), tag_der,
- &tag_len);
+ _asn1_strtoul (p->value, NULL, 10),
+ tag_der, &tag_len);
*max_len -= tag_len;
if (*max_len >= 0)
memcpy (der + *counter, tag_der, tag_len);
*counter += tag_len;
- _asn1_ltostr (*counter, temp);
- _asn1_set_name (p, temp);
+ _asn1_ltostr (*counter, (char *) temp);
+ _asn1_set_name (p, (const char *) temp);
is_tag_implicit = 0;
}
@@ -503,7 +504,7 @@ _asn1_insert_tag_der (ASN1_TYPE node, unsigned char *der, int *counter,
(type_field (node->type) == TYPE_SET_OF))
class |= ASN1_CLASS_STRUCTURED;
class_implicit = class;
- tag_implicit = strtoul (p->value, NULL, 10);
+ tag_implicit = _asn1_strtoul (p->value, NULL, 10);
is_tag_implicit = 1;
}
}
@@ -871,7 +872,7 @@ asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len,
char *ErrorDescription)
{
ASN1_TYPE node, p, p2;
- char temp[SIZEOF_UNSIGNED_LONG_INT * 3 + 1];
+ unsigned char temp[SIZEOF_UNSIGNED_LONG_INT * 3 + 1];
int counter, counter_old, len2, len3, tlen, move, max_len, max_len_old;
asn1_retCode err;
unsigned char *der = ider;
@@ -1073,8 +1074,8 @@ asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len,
case TYPE_SET:
if (move != UP)
{
- _asn1_ltostr (counter, temp);
- tlen = strlen (temp);
+ _asn1_ltostr (counter, (char *) temp);
+ tlen = _asn1_strlen (temp);
if (tlen > 0)
_asn1_set_value (p, temp, tlen + 1);
if (p->down == NULL)
@@ -1099,7 +1100,7 @@ asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len,
}
else
{ /* move==UP */
- len2 = strtol (p->value, NULL, 10);
+ len2 = _asn1_strtol (p->value, NULL, 10);
_asn1_set_value (p, NULL, 0);
if ((type_field (p->type) == TYPE_SET) && (max_len >= 0))
_asn1_ordering_set (der + len2, max_len - len2, p);
@@ -1118,8 +1119,8 @@ asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len,
case TYPE_SET_OF:
if (move != UP)
{
- _asn1_ltostr (counter, temp);
- tlen = strlen (temp);
+ _asn1_ltostr (counter, (char *) temp);
+ tlen = _asn1_strlen (temp);
if (tlen > 0)
_asn1_set_value (p, temp, tlen + 1);
@@ -1139,7 +1140,7 @@ asn1_der_coding (ASN1_TYPE element, const char *name, void *ider, int *len,
}
if (move == UP)
{
- len2 = strtol (p->value, NULL, 10);
+ len2 = _asn1_strtol (p->value, NULL, 10);
_asn1_set_value (p, NULL, 0);
if ((type_field (p->type) == TYPE_SET_OF)
&& (max_len - len2 > 0))
diff --git a/lib/decoding.c b/lib/decoding.c
index 3849375..3814140 100644
--- a/lib/decoding.c
+++ b/lib/decoding.c
@@ -839,7 +839,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
if (p->type & CONST_SET)
{
p2 = _asn1_find_up (p);
- len2 = strtol (p2->value, NULL, 10);
+ len2 = _asn1_strtol (p2->value, NULL, 10);
if (len2 == -1)
{
if (!der[counter] && !der[counter + 1])
@@ -902,7 +902,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
if ((p->type & CONST_OPTION) || (p->type & CONST_DEFAULT))
{
p2 = _asn1_find_up (p);
- len2 = strtol (p2->value, NULL, 10);
+ len2 = _asn1_strtol (p2->value, NULL, 10);
if (counter == len2)
{
if (p->right)
@@ -967,7 +967,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
if ((p->type & CONST_OPTION) || (p->type & CONST_DEFAULT))
{
p2 = _asn1_find_up (p);
- len2 = strtol (p2->value, NULL, 10);
+ len2 = _asn1_strtol (p2->value, NULL, 10);
if ((len2 != -1) && (counter > len2))
ris = ASN1_TAG_ERROR;
}
@@ -1102,7 +1102,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
case TYPE_SET:
if (move == UP)
{
- len2 = strtol (p->value, NULL, 10);
+ len2 = _asn1_strtol (p->value, NULL, 10);
_asn1_set_value (p, NULL, 0);
if (len2 == -1)
{ /* indefinite length method */
@@ -1170,7 +1170,7 @@ asn1_der_decoding (ASN1_TYPE * element, const void *ider, int len,
case TYPE_SET_OF:
if (move == UP)
{
- len2 = strtol (p->value, NULL, 10);
+ len2 = _asn1_strtol (p->value, NULL, 10);
if (len2 == -1)
{ /* indefinite length method */
if ((counter + 2) > len)
@@ -1436,7 +1436,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
if (p->type & CONST_SET)
{
p2 = _asn1_find_up (p);
- len2 = strtol (p2->value, NULL, 10);
+ len2 = _asn1_strtol (p2->value, NULL, 10);
if (counter == len2)
{
p = p2;
@@ -1489,7 +1489,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
if ((p->type & CONST_OPTION) || (p->type & CONST_DEFAULT))
{
p2 = _asn1_find_up (p);
- len2 = strtol (p2->value, NULL, 10);
+ len2 = _asn1_strtol (p2->value, NULL, 10);
if (counter == len2)
{
if (p->right)
@@ -1554,7 +1554,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
if ((p->type & CONST_OPTION) || (p->type & CONST_DEFAULT))
{
p2 = _asn1_find_up (p);
- len2 = strtol (p2->value, NULL, 10);
+ len2 = _asn1_strtol (p2->value, NULL, 10);
if (counter > len2)
ris = ASN1_TAG_ERROR;
}
@@ -1761,7 +1761,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
case TYPE_SET:
if (move == UP)
{
- len2 = strtol (p->value, NULL, 10);
+ len2 = _asn1_strtol (p->value, NULL, 10);
_asn1_set_value (p, NULL, 0);
if (len2 == -1)
{ /* indefinite length method */
@@ -1841,7 +1841,7 @@ asn1_der_decoding_element (ASN1_TYPE * structure, const char *elementName,
case TYPE_SET_OF:
if (move == UP)
{
- len2 = strtol (p->value, NULL, 10);
+ len2 = _asn1_strtol (p->value, NULL, 10);
if (len2 > counter)
{
_asn1_append_sequence_set (p);
@@ -2171,7 +2171,7 @@ asn1_der_decoding_startEnd (ASN1_TYPE element, const void *ider, int len,
if (p->type & CONST_SET)
{
p2 = _asn1_find_up (p);
- len2 = strtol (p2->value, NULL, 10);
+ len2 = _asn1_strtol (p2->value, NULL, 10);
if (len2 == -1)
{
if (!der[counter] && !der[counter + 1])
@@ -2562,7 +2562,7 @@ asn1_expand_any_defined_by (ASN1_TYPE definitions, ASN1_TYPE * element)
asn1_read_value (definitions, name, value, &len);
if ((result == ASN1_SUCCESS)
- && (!strcmp (p3->value, value)))
+ && (!_asn1_strcmp (p3->value, value)))
{
p2 = p2->right; /* pointer to the structure to
use for expansion */
@@ -2743,7 +2743,7 @@ asn1_expand_octet_string (ASN1_TYPE definitions, ASN1_TYPE * element,
result = asn1_read_value (definitions, name, value, &len);
if ((result == ASN1_SUCCESS)
- && (!strcmp (objectNode->value, value)))
+ && (!_asn1_strcmp (objectNode->value, value)))
{
p2 = p2->right; /* pointer to the structure to
diff --git a/lib/element.c b/lib/element.c
index a8fdc92..92a350d 100644
--- a/lib/element.c
+++ b/lib/element.c
@@ -76,7 +76,7 @@ _asn1_hierarchical_name (ASN1_TYPE node, char *name, int name_size)
/* Return: ASN1_MEM_ERROR or ASN1_SUCCESS */
/******************************************************************/
asn1_retCode
-_asn1_convert_integer (const char *value, unsigned char *value_out,
+_asn1_convert_integer (const unsigned char *value, unsigned char *value_out,
int value_out_size, int *len)
{
char negative;
@@ -84,7 +84,7 @@ _asn1_convert_integer (const char *value, unsigned char *value_out,
long valtmp;
int k, k2;
- valtmp = strtol (value, NULL, 10);
+ valtmp = _asn1_strtol (value, NULL, 10);
for (k = 0; k < SIZEOF_UNSIGNED_LONG_INT; k++)
{
@@ -305,7 +305,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
switch (type_field (node->type))
{
case TYPE_BOOLEAN:
- if (!strcmp (value, "TRUE"))
+ if (!_asn1_strcmp (value, "TRUE"))
{
if (node->type & CONST_DEFAULT)
{
@@ -320,7 +320,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
else
_asn1_set_value (node, "T", 1);
}
- else if (!strcmp (value, "FALSE"))
+ else if (!_asn1_strcmp (value, "FALSE"))
{
if (node->type & CONST_DEFAULT)
{
@@ -361,7 +361,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
{
if (type_field (p->type) == TYPE_CONSTANT)
{
- if ((p->name) && (!strcmp (p->name, value)))
+ if ((p->name) && (!_asn1_strcmp (p->name, value)))
{
value_temp =
(unsigned char *)
@@ -444,7 +444,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
{
if (type_field (p2->type) == TYPE_CONSTANT)
{
- if ((p2->name) && (!strcmp (p2->name, p->value)))
+ if ((p2->name) && (!_asn1_strcmp (p2->name, p->value)))
{
default_temp =
(unsigned char *)
@@ -487,7 +487,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
_asn1_free (value_temp);
break;
case TYPE_OBJECT_ID:
- for (i = 0; i < strlen (value); i++)
+ for (i = 0; i < _asn1_strlen (value); i++)
if ((!isdigit (value[i])) && (value[i] != '.') && (value[i] != '+'))
return ASN1_VALUE_NOT_VALID;
if (node->type & CONST_DEFAULT)
@@ -495,23 +495,23 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
p = node->down;
while (type_field (p->type) != TYPE_DEFAULT)
p = p->right;
- if (!strcmp (value, p->value))
+ if (!_asn1_strcmp (value, p->value))
{
_asn1_set_value (node, NULL, 0);
break;
}
}
- _asn1_set_value (node, value, strlen (value) + 1);
+ _asn1_set_value (node, value, _asn1_strlen (value) + 1);
break;
case TYPE_TIME:
if (node->type & CONST_UTC)
{
- if (strlen (value) < 11)
+ if (_asn1_strlen (value) < 11)
return ASN1_VALUE_NOT_VALID;
for (k = 0; k < 10; k++)
if (!isdigit (value[k]))
return ASN1_VALUE_NOT_VALID;
- switch (strlen (value))
+ switch (_asn1_strlen (value))
{
case 11:
if (value[10] != 'Z')
@@ -541,27 +541,27 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
default:
return ASN1_VALUE_NOT_FOUND;
}
- _asn1_set_value (node, value, strlen (value) + 1);
+ _asn1_set_value (node, value, _asn1_strlen (value) + 1);
}
else
{ /* GENERALIZED TIME */
if (value)
- _asn1_set_value (node, value, strlen (value) + 1);
+ _asn1_set_value (node, value, _asn1_strlen (value) + 1);
}
break;
case TYPE_OCTET_STRING:
if (len == 0)
- len = strlen (value);
+ len = _asn1_strlen (value);
_asn1_set_value_octet (node, value, len);
break;
case TYPE_GENERALSTRING:
if (len == 0)
- len = strlen (value);
+ len = _asn1_strlen (value);
_asn1_set_value_octet (node, value, len);
break;
case TYPE_BIT_STRING:
if (len == 0)
- len = strlen (value);
+ len = _asn1_strlen (value);
asn1_length_der ((len >> 3) + 2, NULL, &len2);
temp = (unsigned char *) _asn1_malloc ((len >> 3) + 2 + len2);
if (temp == NULL)
@@ -575,7 +575,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
p = node->down;
while (p)
{
- if (!strcmp (p->name, value))
+ if (!_asn1_strcmp (p->name, value))
{
p2 = node->down;
while (p2)
@@ -600,7 +600,7 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
break;
case TYPE_SEQUENCE_OF:
case TYPE_SET_OF:
- if (strcmp (value, "NEW"))
+ if (_asn1_strcmp (value, "NEW"))
return ASN1_VALUE_NOT_VALID;
_asn1_append_sequence_set (node);
break;
@@ -622,21 +622,21 @@ asn1_write_value (ASN1_TYPE node_root, const char *name,
}
#define PUT_STR_VALUE( ptr, ptr_size, data) \
- *len = strlen(data) + 1; \
+ *len = _asn1_strlen(data) + 1; \
if (ptr_size < *len) { \
return ASN1_MEM_ERROR; \
} else { \
/* this strcpy is checked */ \
- strcpy(ptr, data); \
+ _asn1_strcpy(ptr, data); \
}
#define ADD_STR_VALUE( ptr, ptr_size, data) \
- *len = (int) strlen(data) + 1; \
- if (ptr_size < (int) strlen(ptr)+(*len)) { \
+ *len = (int) _asn1_strlen(data) + 1; \
+ if (ptr_size < (int) _asn1_strlen(ptr)+(*len)) { \
return ASN1_MEM_ERROR; \
} else { \
/* this strcat is checked */ \
- strcat(ptr, data); \
+ _asn1_strcat(ptr, data); \
}
/**
@@ -768,7 +768,7 @@ asn1_read_value (ASN1_TYPE root, const char *name, void *ivalue, int *len)
{
if (type_field (p2->type) == TYPE_CONSTANT)
{
- if ((p2->name) && (!strcmp (p2->name, p->value)))
+ if ((p2->name) && (!_asn1_strcmp (p2->name, p->value)))
{
if (_asn1_convert_integer
(p2->value, value, value_size,
@@ -807,7 +807,7 @@ asn1_read_value (ASN1_TYPE root, const char *name, void *ivalue, int *len)
}
p = p->right;
}
- *len = strlen (value) + 1;
+ *len = _asn1_strlen (value) + 1;
}
else if ((node->type & CONST_DEFAULT) && (node->value == NULL))
{
@@ -909,7 +909,7 @@ asn1_read_tag (ASN1_TYPE root, const char *name, int *tagValue,
if (pTag)
{
- *tagValue = strtoul (pTag->value, NULL, 10);
+ *tagValue = _asn1_strtoul (pTag->value, NULL, 10);
if (pTag->type & CONST_APPLICATION)
*classValue = ASN1_CLASS_APPLICATION;
diff --git a/lib/element.h b/lib/element.h
index 67a234f..3bb3451 100644
--- a/lib/element.h
+++ b/lib/element.h
@@ -26,7 +26,7 @@
asn1_retCode _asn1_append_sequence_set (ASN1_TYPE node);
-asn1_retCode _asn1_convert_integer (const char *value,
+asn1_retCode _asn1_convert_integer (const unsigned char *value,
unsigned char *value_out,
int value_out_size, int *len);
diff --git a/lib/int.h b/lib/int.h
index 6b2b5eb..f1f2b0e 100644
--- a/lib/int.h
+++ b/lib/int.h
@@ -63,6 +63,12 @@ struct node_asn_struct
#define _asn1_calloc calloc
#define _asn1_realloc realloc
#define _asn1_strdup strdup
+#define _asn1_strlen(s) strlen((const char *) s)
+#define _asn1_strtol(n,e,b) strtol((const char *) n, e, b)
+#define _asn1_strtoul(n,e,b) strtoul((const char *) n, e, b)
+#define _asn1_strcmp(a,b) strcmp((const char *)a, (const char *)b)
+#define _asn1_strcpy(a,b) strcpy((char *)a, (const char *)b)
+#define _asn1_strcat(a,b) strcat((char *)a, (const char *)b)
#define MAX_LOG_SIZE 1024 /* maximum number of characters of a log message */
diff --git a/lib/parser_aux.c b/lib/parser_aux.c
index 597fe6d..5b549d7 100644
--- a/lib/parser_aux.c
+++ b/lib/parser_aux.c
@@ -719,7 +719,7 @@ _asn1_expand_object_id (ASN1_TYPE node)
{
_asn1_str_cpy (name2, sizeof (name2), name_root);
_asn1_str_cat (name2, sizeof (name2), ".");
- _asn1_str_cat (name2, sizeof (name2), p2->value);
+ _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
p3 = asn1_find_node (node, name2);
if (!p3 || (type_field (p3->type) != TYPE_OBJECT_ID) ||
!(p3->type & CONST_ASSIGN))
@@ -734,7 +734,7 @@ _asn1_expand_object_id (ASN1_TYPE node)
{
p5 = _asn1_add_node_only (TYPE_CONSTANT);
_asn1_set_name (p5, p4->name);
- tlen = strlen (p4->value);
+ tlen = _asn1_strlen (p4->value);
if (tlen > 0)
_asn1_set_value (p5, p4->value, tlen + 1);
if (p2 == p)
@@ -805,7 +805,7 @@ _asn1_expand_object_id (ASN1_TYPE node)
{
_asn1_str_cpy (name2, sizeof (name2), name_root);
_asn1_str_cat (name2, sizeof (name2), ".");
- _asn1_str_cat (name2, sizeof (name2), p2->value);
+ _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
p3 = asn1_find_node (node, name2);
if (!p3 || (type_field (p3->type) != TYPE_OBJECT_ID) ||
!(p3->type & CONST_ASSIGN))
@@ -818,7 +818,8 @@ _asn1_expand_object_id (ASN1_TYPE node)
{
if (name2[0])
_asn1_str_cat (name2, sizeof (name2), ".");
- _asn1_str_cat (name2, sizeof (name2), p4->value);
+ _asn1_str_cat (name2, sizeof (name2),
+ (char *) p4->value);
}
p4 = p4->right;
}
@@ -960,11 +961,11 @@ _asn1_check_identifier (ASN1_TYPE node)
{
_asn1_str_cpy (name2, sizeof (name2), node->name);
_asn1_str_cat (name2, sizeof (name2), ".");
- _asn1_str_cat (name2, sizeof (name2), p->value);
+ _asn1_str_cat (name2, sizeof (name2), (char *) p->value);
p2 = asn1_find_node (node, name2);
if (p2 == NULL)
{
- strcpy (_asn1_identifierMissing, p->value);
+ _asn1_strcpy (_asn1_identifierMissing, p->value);
return ASN1_IDENTIFIER_NOT_FOUND;
}
}
@@ -976,8 +977,8 @@ _asn1_check_identifier (ASN1_TYPE node)
{
_asn1_str_cpy (name2, sizeof (name2), node->name);
_asn1_str_cat (name2, sizeof (name2), ".");
- _asn1_str_cat (name2, sizeof (name2), p2->value);
- strcpy (_asn1_identifierMissing, p2->value);
+ _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
+ _asn1_strcpy (_asn1_identifierMissing, p2->value);
p2 = asn1_find_node (node, name2);
if (!p2 || (type_field (p2->type) != TYPE_OBJECT_ID) ||
!(p2->type & CONST_ASSIGN))
@@ -996,8 +997,8 @@ _asn1_check_identifier (ASN1_TYPE node)
{
_asn1_str_cpy (name2, sizeof (name2), node->name);
_asn1_str_cat (name2, sizeof (name2), ".");
- _asn1_str_cat (name2, sizeof (name2), p2->value);
- strcpy (_asn1_identifierMissing, p2->value);
+ _asn1_str_cat (name2, sizeof (name2), (char *) p2->value);
+ _asn1_strcpy (_asn1_identifierMissing, p2->value);
p2 = asn1_find_node (node, name2);
if (!p2 || (type_field (p2->type) != TYPE_OBJECT_ID) ||
!(p2->type & CONST_ASSIGN))
diff --git a/lib/structure.c b/lib/structure.c
index c3d7896..25e960f 100644
--- a/lib/structure.c
+++ b/lib/structure.c
@@ -483,7 +483,7 @@ _asn1_type_choice_config (ASN1_TYPE node)
if (type_field (p3->type) == TYPE_TAG)
{
p4 = _asn1_add_node_only (p3->type);
- tlen = strlen (p3->value);
+ tlen = _asn1_strlen (p3->value);
if (tlen > 0)
_asn1_set_value (p4, p3->value, tlen + 1);
_asn1_set_right (p4, p2->down);
@@ -559,7 +559,7 @@ _asn1_expand_identifier (ASN1_TYPE * node, ASN1_TYPE root)
{
_asn1_str_cpy (name2, sizeof (name2), root->name);
_asn1_str_cat (name2, sizeof (name2), ".");
- _asn1_str_cat (name2, sizeof (name2), p->value);
+ _asn1_str_cat (name2, sizeof (name2), (char *) p->value);
p2 = _asn1_copy_structure2 (root, name2);
if (p2 == NULL)
{
diff --git a/tests/Makefile.am b/tests/Makefile.am
index bc03513..950380c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -17,6 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAG_VISIBILITY)
AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir)/gl -I../gl
AM_LDFLAGS = -no-install
diff --git a/tests/Test_errors.c b/tests/Test_errors.c
index f839454..891b1b4 100644
--- a/tests/Test_errors.c
+++ b/tests/Test_errors.c
@@ -30,10 +30,6 @@ main (int argc, char *argv[])
{
errstr = asn1_strerror (ec);
asn1_perror (ec);
-#ifndef ASN1_DISABLE_DEPRECATED
- errstr = libtasn1_strerror (ec);
- libtasn1_perror (ec);
-#endif
ec++;
}
while (errstr);
diff --git a/tests/Test_indefinite.c b/tests/Test_indefinite.c
index 1100421..697faf9 100644
--- a/tests/Test_indefinite.c
+++ b/tests/Test_indefinite.c
@@ -104,7 +104,7 @@ main (int argc, char *argv[])
if (result != ASN1_SUCCESS)
{
asn1_perror (result);
- printf ("Cannot decode BER data (size %d)\n", size);
+ printf ("Cannot decode BER data (size %ld)\n", size);
exit (1);
}
diff --git a/tests/Test_parser.c b/tests/Test_parser.c
index 534c43f..d0c5c44 100644
--- a/tests/Test_parser.c
+++ b/tests/Test_parser.c
@@ -34,12 +34,12 @@
typedef struct
{
int lineNumber;
- char *line;
+ const char *line;
int errorNumber;
- char *errorDescription;
+ const char *errorDescription;
} test_type;
-char *fileCorrectName;
+const char *fileCorrectName;
char fileErroredName[] = "Test_parser_ERROR.asn";
#define _FILE_ "Test_parser_ERROR.asn"
@@ -107,7 +107,7 @@ test_type test_array[] = {
{0}
};
-int
+static int
readLine (FILE * file, char *line)
{
int c;
@@ -123,9 +123,8 @@ readLine (FILE * file, char *line)
return c;
}
-
-void
-createFile (int lineNumber, char *line)
+static void
+createFile (int lineNumber, const char *line)
{
FILE *fileIn, *fileOut;
char lineRead[1024];
diff --git a/tests/Test_simple.c b/tests/Test_simple.c
index c2a4fc2..9cc6ed9 100644
--- a/tests/Test_simple.c
+++ b/tests/Test_simple.c
@@ -28,9 +28,9 @@
struct tv
{
- size_t bitlen;
+ int bitlen;
const char *bitstr;
- size_t derlen;
+ int derlen;
const char *der;
};
@@ -103,7 +103,8 @@ main (int argc, char *argv[])
{
/* Encode */
- asn1_bit_der (tv[i].bitstr, tv[i].bitlen, der, &der_len);
+ asn1_bit_der ((const unsigned char *) tv[i].bitstr, tv[i].bitlen,
+ der, &der_len);
#if 0
{
@@ -117,7 +118,7 @@ main (int argc, char *argv[])
if (der_len != tv[i].derlen
|| memcmp (der, tv[i].der, der_len) != 0)
{
- fprintf (stderr, "asn1_bit_der iter %d\n", i);
+ fprintf (stderr, "asn1_bit_der iter %ld\n", i);
return 1;
}
@@ -128,7 +129,7 @@ main (int argc, char *argv[])
if (result != ASN1_SUCCESS || ret_len != tv[i].derlen
|| bit_len != tv[i].bitlen)
{
- fprintf (stderr, "asn1_get_bit_der iter %d\n", i);
+ fprintf (stderr, "asn1_get_bit_der iter %ld\n", i);
return 1;
}
}
diff --git a/tests/Test_tree.c b/tests/Test_tree.c
index 2b0065e..fe96af5 100644
--- a/tests/Test_tree.c
+++ b/tests/Test_tree.c
@@ -65,7 +65,7 @@ typedef struct
{
int action;
const char *par1;
- const unsigned char *par2;
+ const char *par2;
int par3;
int errorNumber;
} test_type;
@@ -714,18 +714,18 @@ main (int argc, char *argv[])
case ACT_READ_BIT:
if (test->action == ACT_READ_BIT)
{
- if ((valueLen - (valueLen / 8.0)) == 0)
+ if (valueLen % 8 == 0)
tag = valueLen / 8;
else
tag = (valueLen / 8) + 1;
- if ((test->par3 - (test->par3 / 8.0)) == 0)
+ if (test->par3 % 8 == 0)
class = test->par3 / 8;
else
class = (test->par3 / 8) + 1;
}
for (k = 0; k < class; k++)
- if (test->par2[k] != value[k])
+ if ((unsigned char) test->par2[k] != value[k])
{
k = -1;
break;