Commit 27545970 authored by Geoff Thorpe's avatar Geoff Thorpe
Browse files

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.
parent 2ce90b9b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3005,7 +3005,8 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, ASN1_G
	char *tmp = NULL;
	char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p;
	int reason_code = -1;
	int i, ret = 0;
	int ret = 0;
	unsigned int i;
	ASN1_OBJECT *hold = NULL;
	ASN1_GENERALIZEDTIME *comp_time = NULL;
	tmp = BUF_strdup(str);
+1 −1
Original line number Diff line number Diff line
@@ -534,7 +534,7 @@ bad:
			if (!nosalt)
				{
				printf("salt=");
				for (i=0; i<sizeof salt; i++)
				for (i=0; i<(int)sizeof(salt); i++)
					printf("%02X",salt[i]);
				printf("\n");
				}
+2 −1
Original line number Diff line number Diff line
@@ -312,7 +312,8 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt)
	static char out_buf[6 + 9 + 24 + 2]; /* "$apr1$..salt..$.......md5hash..........\0" */
	unsigned char buf[MD5_DIGEST_LENGTH];
	char *salt_out;
	int n, i;
	int n;
	unsigned int i;
	EVP_MD_CTX md,md2;
	size_t passwd_len, salt_len;

+1 −1
Original line number Diff line number Diff line
@@ -205,7 +205,7 @@ int MAIN(int argc, char **argv)
		int chunk;

		chunk = num;
		if (chunk > sizeof buf)
		if (chunk > (int)sizeof(buf))
			chunk = sizeof buf;
		r = RAND_bytes(buf, chunk);
		if (r <= 0)
+4 −3
Original line number Diff line number Diff line
@@ -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);
Loading