Official OpenSSL released versions up to and including 0.9.8i as well as

2008-09-24 stable snapshot have a buf_mem_st.length structure member with
'int' data type.

OpenSSL un-released 0.9.9 CVS version has a buf_mem_st.length structure member
with 'size_t' data type since 2007-Oct-09.

These 4 typecasts should silence compiler warnings in all cases.
This commit is contained in:
Yang Tse 2008-09-24 13:55:23 +00:00
parent 006cab3e9e
commit 21b523fcd3

View File

@ -567,7 +567,7 @@ static int x509_name_oneline(X509_NAME *a, char *buf, size_t size)
rc = X509_NAME_print_ex(bio_out, a, 0, XN_FLAG_SEP_CPLUS_SPC); rc = X509_NAME_print_ex(bio_out, a, 0, XN_FLAG_SEP_CPLUS_SPC);
BIO_get_mem_ptr(bio_out, &biomem); BIO_get_mem_ptr(bio_out, &biomem);
if(biomem->length < size) if((size_t)biomem->length < size)
size = biomem->length; size = biomem->length;
else else
size--; /* don't overwrite the buffer end */ size--; /* don't overwrite the buffer end */
@ -1775,15 +1775,15 @@ static int X509V3_ext(struct SessionHandle *data,
/* biomem->length bytes at biomem->data, this little loop here is only /* biomem->length bytes at biomem->data, this little loop here is only
done for the infof() call, we send the "raw" data to the certinfo done for the infof() call, we send the "raw" data to the certinfo
function */ function */
for(j=0; j<biomem->length; j++) { for(j=0; j<(size_t)biomem->length; j++) {
const char *sep=""; const char *sep="";
if(biomem->data[j] == '\n') { if(biomem->data[j] == '\n') {
sep=", "; sep=", ";
j++; /* skip the newline */ j++; /* skip the newline */
}; };
while((biomem->data[j] == ' ') && (j<biomem->length)) while((biomem->data[j] == ' ') && (j<(size_t)biomem->length))
j++; j++;
if(j<biomem->length) if(j<(size_t)biomem->length)
ptr+=snprintf(ptr, sizeof(buf)-(ptr-buf), "%s%c", sep, biomem->data[j]); ptr+=snprintf(ptr, sizeof(buf)-(ptr-buf), "%s%c", sep, biomem->data[j]);
} }
infof(data, " %s\n", buf); infof(data, " %s\n", buf);