Turn on -Wextra -Wno-sign-compare -Wno-unused-paramter and fix issues.
We turn on a few extra warnings and fix the fallout that occurs when building with --enable-developer. Note that we get different warnings on different machines and so this will be a work in progress. So far, we have built on NetBSD/amd64 5.99.64 (which uses gcc 4.5.3) and Ubuntu 10.04.3 LTS (which uses gcc 4.4.3). Notably, we fixed 1. a lot of missing structure initialisers, 2. unchecked return values for functions that glibc marks as __attribute__((warn-unused-result)), 3. made minor modifications to slc and asn1_compile which can generate code which generates warnings, and 4. a few stragglers here and there. We turned off the extended warnings for many programs in appl/ as they are nearing the end of their useful lifetime, e.g. rsh, rcp, popper, ftp and telnet. Interestingly, glibc's strncmp() macro needed to be worked around whereas the function calls did not. We have not yet tried this on 32 bit platforms, so there will be a few more warnings when we do.
This commit is contained in:
@@ -226,6 +226,7 @@ static const RSA_METHOD p11_rsa_pkcs1_method = {
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -330,8 +331,10 @@ p11_init_slot(hx509_context context,
|
||||
break;
|
||||
}
|
||||
|
||||
asprintf(&slot->name, "%.*s",
|
||||
(int)i, slot_info.slotDescription);
|
||||
ret = asprintf(&slot->name, "%.*s", (int)i,
|
||||
slot_info.slotDescription);
|
||||
if (ret == -1)
|
||||
return ENOMEM;
|
||||
|
||||
if ((slot_info.flags & CKF_TOKEN_PRESENT) == 0)
|
||||
return 0;
|
||||
@@ -422,7 +425,12 @@ p11_get_session(hx509_context context,
|
||||
|
||||
memset(&prompt, 0, sizeof(prompt));
|
||||
|
||||
asprintf(&str, "PIN code for %s: ", slot->name);
|
||||
ret = asprintf(&str, "PIN code for %s: ", slot->name);
|
||||
if (ret == -1 || str == NULL) {
|
||||
if (context)
|
||||
hx509_set_error_string(context, 0, ENOMEM, "out of memory");
|
||||
return ENOMEM;
|
||||
}
|
||||
prompt.prompt = str;
|
||||
prompt.type = HX509_PROMPT_TYPE_PASSWORD;
|
||||
prompt.reply.data = pin;
|
||||
@@ -717,9 +725,9 @@ collect_cert(hx509_context context,
|
||||
if ((CK_LONG)query[2].ulValueLen != -1) {
|
||||
char *str;
|
||||
|
||||
asprintf(&str, "%.*s",
|
||||
(int)query[2].ulValueLen, (char *)query[2].pValue);
|
||||
if (str) {
|
||||
ret = asprintf(&str, "%.*s",
|
||||
(int)query[2].ulValueLen, (char *)query[2].pValue);
|
||||
if (ret != -1 && str) {
|
||||
hx509_cert_set_friendly_name(cert, str);
|
||||
free(str);
|
||||
}
|
||||
@@ -1176,7 +1184,9 @@ static struct hx509_keyset_ops keyset_pkcs11 = {
|
||||
p11_iter_start,
|
||||
p11_iter,
|
||||
p11_iter_end,
|
||||
p11_printinfo
|
||||
p11_printinfo,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
#endif /* HAVE_DLOPEN */
|
||||
|
Reference in New Issue
Block a user