summaryrefslogtreecommitdiff
path: root/crypto/asn1
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2003-10-29 20:24:15 +0000
committerGeoff Thorpe <geoff@openssl.org>2003-10-29 20:24:15 +0000
commit27545970134d703ed96027aac9b67eced124eec3 (patch)
tree2f878acf303cc26e3b6db6a0ec25c10c91e3d32d /crypto/asn1
parent2ce90b9b7481381dff584726d84345a0260ca4d1 (diff)
downloadopenssl-new-27545970134d703ed96027aac9b67eced124eec3.tar.gz
A general spring-cleaning (in autumn) to fix up signed/unsigned warnings.
I have tried to convert 'len' type variable declarations to unsigned as a means to address these warnings when appropriate, but when in doubt I have used casts in the comparisons instead. The better solution (that would get us all lynched by API users) would be to go through and convert all the function prototypes and structure definitions to use unsigned variables except when signed is necessary. The proliferation of (signed) "int" for strictly non-negative uses is unfortunate.
Diffstat (limited to 'crypto/asn1')
-rw-r--r--crypto/asn1/a_enum.c7
-rw-r--r--crypto/asn1/a_int.c7
-rw-r--r--crypto/asn1/a_object.c2
-rw-r--r--crypto/asn1/asn1_gen.c2
-rw-r--r--crypto/asn1/asn1_lib.c2
-rw-r--r--crypto/asn1/x_long.c2
6 files changed, 12 insertions, 10 deletions
diff --git a/crypto/asn1/a_enum.c b/crypto/asn1/a_enum.c
index 68a525fb12..d9db53f01d 100644
--- a/crypto/asn1/a_enum.c
+++ b/crypto/asn1/a_enum.c
@@ -67,12 +67,13 @@
int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v)
{
- int i,j,k;
+ int j,k;
+ unsigned int i;
unsigned char buf[sizeof(long)+1];
long d;
a->type=V_ASN1_ENUMERATED;
- if (a->length < (sizeof(long)+1))
+ if (a->length < (int)(sizeof(long)+1))
{
if (a->data != NULL)
OPENSSL_free(a->data);
@@ -116,7 +117,7 @@ long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a)
else if (i != V_ASN1_ENUMERATED)
return -1;
- if (a->length > sizeof(long))
+ if (a->length > (int)sizeof(long))
{
/* hmm... a bit ugly */
return(0xffffffffL);
diff --git a/crypto/asn1/a_int.c b/crypto/asn1/a_int.c
index 78402cd985..4bb300c20b 100644
--- a/crypto/asn1/a_int.c
+++ b/crypto/asn1/a_int.c
@@ -313,12 +313,13 @@ err:
int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
{
- int i,j,k;
+ int j,k;
+ unsigned int i;
unsigned char buf[sizeof(long)+1];
long d;
a->type=V_ASN1_INTEGER;
- if (a->length < (sizeof(long)+1))
+ if (a->length < (int)(sizeof(long)+1))
{
if (a->data != NULL)
OPENSSL_free(a->data);
@@ -362,7 +363,7 @@ long ASN1_INTEGER_get(ASN1_INTEGER *a)
else if (i != V_ASN1_INTEGER)
return -1;
- if (a->length > sizeof(long))
+ if (a->length > (int)sizeof(long))
{
/* hmm... a bit ugly */
return(0xffffffffL);
diff --git a/crypto/asn1/a_object.c b/crypto/asn1/a_object.c
index 0a8e6c287c..124451d7a6 100644
--- a/crypto/asn1/a_object.c
+++ b/crypto/asn1/a_object.c
@@ -184,7 +184,7 @@ int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a)
if ((a == NULL) || (a->data == NULL))
return(BIO_write(bp,"NULL",4));
i=i2t_ASN1_OBJECT(buf,sizeof buf,a);
- if (i > sizeof buf) i=sizeof buf;
+ if (i > (int)sizeof(buf)) i=sizeof buf;
BIO_write(bp,buf,i);
return(i);
}
diff --git a/crypto/asn1/asn1_gen.c b/crypto/asn1/asn1_gen.c
index c035cc0f5d..277726cd50 100644
--- a/crypto/asn1/asn1_gen.c
+++ b/crypto/asn1/asn1_gen.c
@@ -544,7 +544,7 @@ static int append_exp(tag_exp_arg *arg, int exp_tag, int exp_class, int exp_cons
static int asn1_str2tag(const char *tagstr, int len)
{
- int i;
+ unsigned int i;
static struct tag_name_st *tntmp, tnst [] = {
ASN1_GEN_STR("BOOL", V_ASN1_BOOLEAN),
ASN1_GEN_STR("BOOLEAN", V_ASN1_BOOLEAN),
diff --git a/crypto/asn1/asn1_lib.c b/crypto/asn1/asn1_lib.c
index e100e93bed..1905b090ed 100644
--- a/crypto/asn1/asn1_lib.c
+++ b/crypto/asn1/asn1_lib.c
@@ -145,7 +145,7 @@ static int asn1_get_length(unsigned char **pp, int *inf, long *rl, int max)
{
unsigned char *p= *pp;
unsigned long ret=0;
- int i;
+ unsigned int i;
if (max-- < 1) return(0);
if (*p == 0x80)
diff --git a/crypto/asn1/x_long.c b/crypto/asn1/x_long.c
index c04b192794..954d183975 100644
--- a/crypto/asn1/x_long.c
+++ b/crypto/asn1/x_long.c
@@ -136,7 +136,7 @@ static int long_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype,
int neg, i;
long ltmp;
unsigned long utmp = 0;
- if(len > sizeof(long)) {
+ if(len > (int)sizeof(long)) {
ASN1err(ASN1_F_LONG_C2I, ASN1_R_INTEGER_TOO_LARGE_FOR_LONG);
return 0;
}