- applied some -W's from strongswan

- fixed that warnings
This commit is contained in:
Martin Willi
2006-05-09 07:34:25 +00:00
parent 24953b5e18
commit f768bdc3f3
62 changed files with 147 additions and 145 deletions
-6
View File
@@ -4,15 +4,9 @@ include ${FREESWANSRCDIR}/Makefile.ver
CFLAGS+=$(USERCOMPILE) -I${KLIPSINC} CFLAGS+=$(USERCOMPILE) -I${KLIPSINC}
CFLAGS+= -Wall CFLAGS+= -Wall
#CFLAGS+= -Wconversion
#CFLAGS+= -Wmissing-prototypes
CFLAGS+= -Wpointer-arith CFLAGS+= -Wpointer-arith
CFLAGS+= -Wcast-qual CFLAGS+= -Wcast-qual
#CFLAGS+= -Wmissing-declarations
CFLAGS+= -Wstrict-prototypes CFLAGS+= -Wstrict-prototypes
#CFLAGS+= -pedantic
#CFLAGS+= -W
#CFLAGS+= -Wwrite-strings
CFLAGS+= -Wbad-function-cast CFLAGS+= -Wbad-function-cast
# die if there are any warnings # die if there are any warnings
+1 -1
View File
@@ -35,7 +35,7 @@ BINNAMELIB= $(BUILD_DIR)libstrongswan.so
MAIN_DIR= ./ MAIN_DIR= ./
CFLAGS= -Icharon -Ilib -Istroke -fPIC -Wall -g CFLAGS= -Icharon -Ilib -Istroke -fPIC -Wall -Wcast-qual -Wstrict-prototypes -Wbad-function-cast -g
ifeq ($(USE_LEAK_DETECTIVE),true) ifeq ($(USE_LEAK_DETECTIVE),true)
CFLAGS+= -DLEAK_DETECTIVE CFLAGS+= -DLEAK_DETECTIVE
endif endif
+1 -1
View File
@@ -84,6 +84,6 @@ struct configuration_t {
* *
* @ingroup config * @ingroup config
*/ */
configuration_t *configuration_create(); configuration_t *configuration_create(void);
#endif /*CONFIGURATION_H_*/ #endif /*CONFIGURATION_H_*/
@@ -210,7 +210,7 @@ static void destroy (private_local_connection_store_t *this)
/** /**
* Described in header. * Described in header.
*/ */
local_connection_store_t * local_connection_store_create() local_connection_store_t * local_connection_store_create(void)
{ {
private_local_connection_store_t *this = malloc_thing(private_local_connection_store_t); private_local_connection_store_t *this = malloc_thing(private_local_connection_store_t);
@@ -58,6 +58,6 @@ struct local_connection_store_t {
* *
* @ingroup config * @ingroup config
*/ */
local_connection_store_t * local_connection_store_create(); local_connection_store_t * local_connection_store_create(void);
#endif /* LOCAL_CONNECTION_H_ */ #endif /* LOCAL_CONNECTION_H_ */
@@ -361,7 +361,7 @@ static void destroy(private_local_credential_store_t *this)
/** /**
* Described in header. * Described in header.
*/ */
local_credential_store_t * local_credential_store_create() local_credential_store_t * local_credential_store_create(void)
{ {
private_local_credential_store_t *this = malloc_thing(private_local_credential_store_t); private_local_credential_store_t *this = malloc_thing(private_local_credential_store_t);
@@ -80,6 +80,6 @@ struct local_credential_store_t {
* *
* @ingroup config * @ingroup config
*/ */
local_credential_store_t *local_credential_store_create(); local_credential_store_t *local_credential_store_create(void);
#endif /* LOCAL_CREDENTIAL_H_ */ #endif /* LOCAL_CREDENTIAL_H_ */
@@ -120,7 +120,7 @@ static void destroy(private_local_policy_store_t *this)
/** /**
* Described in header. * Described in header.
*/ */
local_policy_store_t *local_policy_store_create() local_policy_store_t *local_policy_store_create(void)
{ {
private_local_policy_store_t *this = malloc_thing(private_local_policy_store_t); private_local_policy_store_t *this = malloc_thing(private_local_policy_store_t);
@@ -55,6 +55,6 @@ struct local_policy_store_t {
* *
* @ingroup config * @ingroup config
*/ */
local_policy_store_t *local_policy_store_create(); local_policy_store_t *local_policy_store_create(void);
#endif /* LOCAL_POLICY_STORE_H_ */ #endif /* LOCAL_POLICY_STORE_H_ */
+1 -1
View File
@@ -287,7 +287,7 @@ void signal_handler(int signal)
* *
* @return created daemon_t * @return created daemon_t
*/ */
private_daemon_t *daemon_create() private_daemon_t *daemon_create(void)
{ {
private_daemon_t *this = malloc_thing(private_daemon_t); private_daemon_t *this = malloc_thing(private_daemon_t);
struct sigaction action; struct sigaction action;
+1 -1
View File
@@ -96,6 +96,6 @@ struct generator_t {
* *
* @ingroup encoding * @ingroup encoding
*/ */
generator_t *generator_create(); generator_t *generator_create(void);
#endif /*GENERATOR_H_*/ #endif /*GENERATOR_H_*/
+1 -1
View File
@@ -353,7 +353,7 @@ message_t * message_create_from_packet(packet_t *packet);
* *
* @ingroup encoding * @ingroup encoding
*/ */
message_t * message_create(); message_t * message_create(void);
/** /**
* @brief Creates an message_t object of type reply containing a notify payload. * @brief Creates an message_t object of type reply containing a notify payload.
@@ -116,7 +116,7 @@ struct auth_payload_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
auth_payload_t *auth_payload_create(); auth_payload_t *auth_payload_create(void);
#endif /* AUTH_PAYLOAD_H_ */ #endif /* AUTH_PAYLOAD_H_ */
@@ -149,7 +149,7 @@ struct cert_payload_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
cert_payload_t *cert_payload_create(); cert_payload_t *cert_payload_create(void);
#endif /* CERT_PAYLOAD_H_ */ #endif /* CERT_PAYLOAD_H_ */
@@ -119,7 +119,7 @@ struct certreq_payload_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
certreq_payload_t *certreq_payload_create(); certreq_payload_t *certreq_payload_create(void);
#endif /* CERTREQ_PAYLOAD_H_ */ #endif /* CERTREQ_PAYLOAD_H_ */
@@ -144,6 +144,6 @@ struct configuration_attribute_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
configuration_attribute_t *configuration_attribute_create(); configuration_attribute_t *configuration_attribute_create(void);
#endif /* CONFIGURATION_ATTRIBUTE_H_*/ #endif /* CONFIGURATION_ATTRIBUTE_H_*/
@@ -133,6 +133,6 @@ struct cp_payload_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
cp_payload_t *cp_payload_create(); cp_payload_t *cp_payload_create(void);
#endif /*CP_PAYLOAD_H_*/ #endif /*CP_PAYLOAD_H_*/
@@ -150,7 +150,7 @@ struct delete_payload_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
delete_payload_t *delete_payload_create(); delete_payload_t *delete_payload_create(void);
#endif /* DELETE_PAYLOAD_H_ */ #endif /* DELETE_PAYLOAD_H_ */
@@ -99,7 +99,7 @@ struct eap_payload_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
eap_payload_t *eap_payload_create(); eap_payload_t *eap_payload_create(void);
#endif /* EAP_PAYLOAD_H_ */ #endif /* EAP_PAYLOAD_H_ */
@@ -190,7 +190,7 @@ struct encryption_payload_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
encryption_payload_t *encryption_payload_create(); encryption_payload_t *encryption_payload_create(void);
#endif /*ENCRYPTION_PAYLOAD_H_*/ #endif /*ENCRYPTION_PAYLOAD_H_*/
@@ -256,6 +256,6 @@ struct ike_header_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
ike_header_t *ike_header_create(); ike_header_t *ike_header_create(void);
#endif /*IKE_HEADER_H_*/ #endif /*IKE_HEADER_H_*/
@@ -104,7 +104,7 @@ struct ke_payload_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
ke_payload_t *ke_payload_create(); ke_payload_t *ke_payload_create(void);
#endif /*KE_PAYLOAD_H_*/ #endif /*KE_PAYLOAD_H_*/
@@ -83,7 +83,7 @@ struct nonce_payload_t {
* @ingroup payloads * @ingroup payloads
*/ */
nonce_payload_t *nonce_payload_create(); nonce_payload_t *nonce_payload_create(void);
#endif /*NONCE_PAYLOAD_H_*/ #endif /*NONCE_PAYLOAD_H_*/
@@ -183,7 +183,7 @@ struct notify_payload_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
notify_payload_t *notify_payload_create(); notify_payload_t *notify_payload_create(void);
/** /**
* @brief Creates an notify_payload_t object of specific type for specific protocol id. * @brief Creates an notify_payload_t object of specific type for specific protocol id.
@@ -208,7 +208,7 @@ struct proposal_substructure_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
proposal_substructure_t *proposal_substructure_create(); proposal_substructure_t *proposal_substructure_create(void);
/** /**
* @brief Creates a proposal substructure from a proposal. * @brief Creates a proposal substructure from a proposal.
@@ -112,7 +112,7 @@ struct sa_payload_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
sa_payload_t *sa_payload_create(); sa_payload_t *sa_payload_create(void);
/** /**
* @brief Creates a sa_payload_t object from a list of proposals. * @brief Creates a sa_payload_t object from a list of proposals.
@@ -154,7 +154,7 @@ struct traffic_selector_substructure_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
traffic_selector_substructure_t *traffic_selector_substructure_create(); traffic_selector_substructure_t *traffic_selector_substructure_create(void);
/** /**
* @brief Creates an initialized traffif selector substructure using * @brief Creates an initialized traffif selector substructure using
@@ -138,7 +138,7 @@ struct transform_attribute_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
transform_attribute_t *transform_attribute_create(); transform_attribute_t *transform_attribute_create(void);
/** /**
* @brief Creates an transform_attribute_t of type KEY_LENGTH. * @brief Creates an transform_attribute_t of type KEY_LENGTH.
@@ -177,7 +177,7 @@ struct transform_substructure_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
transform_substructure_t *transform_substructure_create(); transform_substructure_t *transform_substructure_create(void);
/** /**
* @brief Creates an empty transform_substructure_t object. * @brief Creates an empty transform_substructure_t object.
@@ -89,7 +89,7 @@ struct unknown_payload_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
unknown_payload_t *unknown_payload_create(); unknown_payload_t *unknown_payload_create(void);
#endif /* UNKNOWN_PAYLOAD_H_ */ #endif /* UNKNOWN_PAYLOAD_H_ */
@@ -97,7 +97,7 @@ struct vendor_id_payload_t {
* *
* @ingroup payloads * @ingroup payloads
*/ */
vendor_id_payload_t *vendor_id_payload_create(); vendor_id_payload_t *vendor_id_payload_create(void);
#endif /* VENDOR_ID_PAYLOAD_H_ */ #endif /* VENDOR_ID_PAYLOAD_H_ */
+1 -1
View File
@@ -168,7 +168,7 @@ static packet_t *clone(private_packet_t *this)
/* /*
* Documented in header * Documented in header
*/ */
packet_t *packet_create() packet_t *packet_create(void)
{ {
private_packet_t *this = malloc_thing(private_packet_t); private_packet_t *this = malloc_thing(private_packet_t);
+1 -1
View File
@@ -129,7 +129,7 @@ struct packet_t {
* *
* @ingroup network * @ingroup network
*/ */
packet_t *packet_create(); packet_t *packet_create(void);
#endif /*PACKET_H_*/ #endif /*PACKET_H_*/
+1 -1
View File
@@ -112,6 +112,6 @@ struct event_queue_t {
* *
* @ingroup queues * @ingroup queues
*/ */
event_queue_t *event_queue_create(); event_queue_t *event_queue_create(void);
#endif /*EVENT_QUEUE_H_*/ #endif /*EVENT_QUEUE_H_*/
+1 -1
View File
@@ -136,7 +136,7 @@ static void job_queue_destroy (private_job_queue_t *this)
* *
* Documented in header * Documented in header
*/ */
job_queue_t *job_queue_create() job_queue_t *job_queue_create(void)
{ {
private_job_queue_t *this = malloc_thing(private_job_queue_t); private_job_queue_t *this = malloc_thing(private_job_queue_t);
+1 -1
View File
@@ -94,6 +94,6 @@ struct job_queue_t {
* *
* @ingroup queues * @ingroup queues
*/ */
job_queue_t *job_queue_create(); job_queue_t *job_queue_create(void);
#endif /*JOB_QUEUE_H_*/ #endif /*JOB_QUEUE_H_*/
+1 -1
View File
@@ -136,7 +136,7 @@ static void destroy (private_send_queue_t *this)
* *
* Documented in header * Documented in header
*/ */
send_queue_t *send_queue_create() send_queue_t *send_queue_create(void)
{ {
private_send_queue_t *this = malloc_thing(private_send_queue_t); private_send_queue_t *this = malloc_thing(private_send_queue_t);
+1 -1
View File
@@ -95,6 +95,6 @@ struct send_queue_t {
* *
* @ingroup queues * @ingroup queues
*/ */
send_queue_t *send_queue_create(); send_queue_t *send_queue_create(void);
#endif /*SEND_QUEUE_H_*/ #endif /*SEND_QUEUE_H_*/
+1 -1
View File
@@ -189,6 +189,6 @@ struct ike_sa_manager_t {
* *
* @ingroup sa * @ingroup sa
*/ */
ike_sa_manager_t *ike_sa_manager_create(); ike_sa_manager_t *ike_sa_manager_create(void);
#endif /*IKE_SA_MANAGER_H_*/ #endif /*IKE_SA_MANAGER_H_*/
+1 -1
View File
@@ -180,6 +180,6 @@ struct kernel_interface_t {
* *
* @ingroup threads * @ingroup threads
*/ */
kernel_interface_t *kernel_interface_create(); kernel_interface_t *kernel_interface_create(void);
#endif /*KERNEL_INTERFACE_H_*/ #endif /*KERNEL_INTERFACE_H_*/
+1 -1
View File
@@ -62,6 +62,6 @@ struct receiver_t {
* *
* @ingroup threads * @ingroup threads
*/ */
receiver_t * receiver_create(); receiver_t * receiver_create(void);
#endif /*RECEIVER_H_*/ #endif /*RECEIVER_H_*/
+1 -1
View File
@@ -62,6 +62,6 @@ struct scheduler_t {
* *
* @ingroup threads * @ingroup threads
*/ */
scheduler_t * scheduler_create(); scheduler_t * scheduler_create(void);
#endif /*SCHEDULER_H_*/ #endif /*SCHEDULER_H_*/
+1 -1
View File
@@ -58,6 +58,6 @@ struct sender_t {
* *
* @ingroup threads * @ingroup threads
*/ */
sender_t * sender_create(); sender_t * sender_create(void);
#endif /*SENDER_H_*/ #endif /*SENDER_H_*/
+1 -1
View File
@@ -81,6 +81,6 @@ struct stroke_t {
* *
* @ingroup threads * @ingroup threads
*/ */
stroke_t *stroke_create(); stroke_t *stroke_create(void);
#endif /* STROKE_INTERFACE_H_ */ #endif /* STROKE_INTERFACE_H_ */
+4
View File
@@ -38,6 +38,10 @@
- certificate validation/chaining - certificate validation/chaining
- certificate exchange - certificate exchange
+ Apply -W's from Makefile.program to charon
- do ipsec status via starter
- add more output to to up/down, somehow...
- stroke status should show configured connections - stroke status should show configured connections
- stroke loglevel update - stroke loglevel update
- stroke argument parsing via getopts/gperf? - stroke argument parsing via getopts/gperf?
+1 -1
View File
@@ -90,7 +90,7 @@ static logger_t *logger = NULL;
/** /**
* initializes the ASN.1 logger * initializes the ASN.1 logger
*/ */
static void asn1_init_logger() static void asn1_init_logger(void)
{ {
if (logger == NULL) if (logger == NULL)
logger = logger_manager->get_logger(logger_manager, ASN1); logger = logger_manager->get_logger(logger_manager, ASN1);
+4 -4
View File
@@ -34,7 +34,7 @@ static logger_t *logger = NULL;
/** /**
* initializes the PEM logger * initializes the PEM logger
*/ */
static void pem_init_logger() static void pem_init_logger(void)
{ {
if (logger == NULL) if (logger == NULL)
logger = logger_manager->get_logger(logger_manager, ASN1); logger = logger_manager->get_logger(logger_manager, ASN1);
@@ -89,7 +89,7 @@ static bool find_boundary(const char* tag, chunk_t *line)
/* /*
* decrypts a DES-EDE-CBC encrypted data block * decrypts a DES-EDE-CBC encrypted data block
*/ */
static err_t pem_decrypt(chunk_t *blob, chunk_t *iv, const char *passphrase) static err_t pem_decrypt(chunk_t *blob, chunk_t *iv, char *passphrase)
{ {
hasher_t *hasher; hasher_t *hasher;
crypter_t *crypter; crypter_t *crypter;
@@ -144,7 +144,7 @@ static err_t pem_decrypt(chunk_t *blob, chunk_t *iv, const char *passphrase)
* RFC 1421 Privacy Enhancement for Electronic Mail, February 1993 * RFC 1421 Privacy Enhancement for Electronic Mail, February 1993
* RFC 934 Message Encapsulation, January 1985 * RFC 934 Message Encapsulation, January 1985
*/ */
err_t pem_to_bin(chunk_t *blob, const char *passphrase, bool *pgp) err_t pem_to_bin(chunk_t *blob, char *passphrase, bool *pgp)
{ {
typedef enum { typedef enum {
PEM_PRE = 0, PEM_PRE = 0,
@@ -285,7 +285,7 @@ err_t pem_to_bin(chunk_t *blob, const char *passphrase, bool *pgp)
/* load a coded key or certificate file with autodetection /* load a coded key or certificate file with autodetection
* of binary DER or base64 PEM ASN.1 formats and armored PGP format * of binary DER or base64 PEM ASN.1 formats and armored PGP format
*/ */
bool pem_asn1_load_file(const char *filename, const char *passphrase, bool pem_asn1_load_file(const char *filename, char *passphrase,
const char *type, chunk_t *blob, bool *pgp) const char *type, chunk_t *blob, bool *pgp)
{ {
err_t ugh = NULL; err_t ugh = NULL;
+2 -2
View File
@@ -19,9 +19,9 @@
#include <types.h> #include <types.h>
err_t pem_to_bin(chunk_t *blob, const char *passphrase, bool *pgp); err_t pem_to_bin(chunk_t *blob, char *passphrase, bool *pgp);
bool pem_asn1_load_file(const char *filename, const char *passphrase, bool pem_asn1_load_file(const char *filename, char *passphrase,
const char *type, chunk_t *blob, bool *pgp); const char *type, chunk_t *blob, bool *pgp);
#endif /*PEM_H_*/ #endif /*PEM_H_*/
+73 -69
View File
@@ -33,22 +33,23 @@ static const char *badch(const char *, int, char *, size_t);
#define BADCH3 (-7) /* invalid character 3 */ #define BADCH3 (-7) /* invalid character 3 */
#define BADOFF(code) (BADCH0-(code)) #define BADOFF(code) (BADCH0-(code))
/* /**
- ttodatav - convert text to data, with verbose error reports * @brief convert text to data, with verbose error reports
*
* If some of this looks slightly odd, it's because it has changed * If some of this looks slightly odd, it's because it has changed
* repeatedly (from the original atodata()) without a major rewrite. * repeatedly (from the original atodata()) without a major rewrite.
*
* @param src
* @param srclen 0 means apply strlen()
* @param base 0 means figure it out
* @param dst need not be valid if dstlen is 0
* @param dstlen
* @param lenp where to record length (NULL is nowhere)
* @param errp error buffer
* @param flags
* @return NULL on success, else literal or errp
*/ */
const char * /* NULL on success, else literal or errp */ const char *ttodatav(const char *src, size_t srclen, int base, char *dst, size_t dstlen, size_t *lenp, char *errp, size_t errlen, unsigned int flags)
ttodatav(src, srclen, base, dst, dstlen, lenp, errp, errlen, flags)
const char *src;
size_t srclen; /* 0 means apply strlen() */
int base; /* 0 means figure it out */
char *dst; /* need not be valid if dstlen is 0 */
size_t dstlen;
size_t *lenp; /* where to record length (NULL is nowhere) */
char *errp; /* error buffer */
size_t errlen;
unsigned int flags;
{ {
size_t ingroup; /* number of input bytes converted at once */ size_t ingroup; /* number of input bytes converted at once */
char buf[4]; /* output from conversion */ char buf[4]; /* output from conversion */
@@ -166,32 +167,35 @@ unsigned int flags;
return NULL; return NULL;
} }
/* /**
- ttodata - convert text to data * @brief ttodata - convert text to data
*
* @param src
* @param srclen 0 means apply strlen()
* @param base 0 means figure it out
* @param dst need not be valid if dstlen is 0
* @param dstlen
* @param lenp where to record length (NULL is nowhere)
* @return NULL on success, else literal
*/ */
const char * /* NULL on success, else literal */ const char *ttodata(const char *src, size_t srclen, int base, char *dst, size_t dstlen, size_t *lenp)
ttodata(src, srclen, base, dst, dstlen, lenp)
const char *src;
size_t srclen; /* 0 means apply strlen() */
int base; /* 0 means figure it out */
char *dst; /* need not be valid if dstlen is 0 */
size_t dstlen;
size_t *lenp; /* where to record length (NULL is nowhere) */
{ {
return ttodatav(src, srclen, base, dst, dstlen, lenp, (char *)NULL, return ttodatav(src, srclen, base, dst, dstlen, lenp, (char *)NULL,
(size_t)0, TTODATAV_SPACECOUNTS); (size_t)0, TTODATAV_SPACECOUNTS);
} }
/* /**
- atodata - convert ASCII to data * @brief atodata - convert ASCII to data
*
* backward-compatibility interface * backward-compatibility interface
*
* @param src
* @param srclen
* @param dst
* @param dstlen
* @return 0 for failure, true length for success
*/ */
size_t /* 0 for failure, true length for success */ size_t atodata(const char *src, size_t srclen, char *dst, size_t dstlen)
atodata(src, srclen, dst, dstlen)
const char *src;
size_t srclen;
char *dst;
size_t dstlen;
{ {
size_t len; size_t len;
const char *err; const char *err;
@@ -202,29 +206,25 @@ size_t dstlen;
return len; return len;
} }
/* /**
- atobytes - convert ASCII to data bytes * @brief atobytes - convert ASCII to data bytes
*
* another backward-compatibility interface * another backward-compatibility interface
*/ */
const char * const char *atobytes(const char *src, size_t srclen, char *dst, size_t dstlen, size_t *lenp)
atobytes(src, srclen, dst, dstlen, lenp)
const char *src;
size_t srclen;
char *dst;
size_t dstlen;
size_t *lenp;
{ {
return ttodata(src, srclen, 0, dst, dstlen, lenp); return ttodata(src, srclen, 0, dst, dstlen, lenp);
} }
/* /**
- unhex - convert two ASCII hex digits to byte * @brief unhex - convert two ASCII hex digits to byte
*
* @param src known to be full length
* @param dstnumber of result bytes, or error code
* @param dstlen not large enough is a failure
* @return
*/ */
static int /* number of result bytes, or error code */ static int unhex(const char *src, char *dst, size_t dstlen)
unhex(src, dst, dstlen)
const char *src; /* known to be full length */
char *dst;
size_t dstlen; /* not large enough is a failure */
{ {
char *p; char *p;
unsigned byte; unsigned byte;
@@ -252,16 +252,18 @@ size_t dstlen; /* not large enough is a failure */
return 1; return 1;
} }
/* /**
- unb64 - convert four ASCII base64 digits to three bytes * @brief unb64 - convert four ASCII base64 digits to three bytes
*
* Note that a base64 digit group is padded out with '=' if it represents * Note that a base64 digit group is padded out with '=' if it represents
* less than three bytes: one byte is dd==, two is ddd=, three is dddd. * less than three bytes: one byte is dd==, two is ddd=, three is dddd.
*
* @param src known to be full length
* @param dst
* @param dstlen
* @return number of result bytes, or error code
*/ */
static int /* number of result bytes, or error code */ static int unb64(const char *src, char *dst, size_t dstlen)
unb64(src, dst, dstlen)
const char *src; /* known to be full length */
char *dst;
size_t dstlen;
{ {
char *p; char *p;
unsigned byte1; unsigned byte1;
@@ -316,14 +318,15 @@ size_t dstlen;
return 3; return 3;
} }
/* /**
- untext - convert one ASCII character to byte * @brief untext - convert one ASCII character to byte
*
* @param src known to be full length
* @param dst
* @param dstlen not large enough is a failure
* @return number of result bytes, or error code
*/ */
static int /* number of result bytes, or error code */ static int untext(const char *src, char *dst, size_t dstlen)
untext(src, dst, dstlen)
const char *src; /* known to be full length */
char *dst;
size_t dstlen; /* not large enough is a failure */
{ {
if (dstlen < 1) if (dstlen < 1)
return SHORT; return SHORT;
@@ -332,18 +335,19 @@ size_t dstlen; /* not large enough is a failure */
return 1; return 1;
} }
/* /**
- badch - produce a nice complaint about an unknown character * @brief badch - produce a nice complaint about an unknown character
* *
* If the compiler complains that the array bigenough[] has a negative * If the compiler complains that the array bigenough[] has a negative
* size, that means the TTODATAV_BUF constant has been set too small. * size, that means the TTODATAV_BUF constant has been set too small.
*
* @param src
* @param errcode
* @param errp might be NULL
* @param errlen
* @return literal or errp
*/ */
static const char * /* literal or errp */ static const char *badch(const char *src, int errcode, char *errp, size_t errlen)
badch(src, errcode, errp, errlen)
const char *src;
int errcode;
char *errp; /* might be NULL */
size_t errlen;
{ {
static const char pre[] = "unknown character (`"; static const char pre[] = "unknown character (`";
static const char suf[] = "') in input"; static const char suf[] = "') in input";
+1 -1
View File
@@ -377,7 +377,7 @@ static void destroy(private_md5_hasher_t *this)
/* /*
* Described in header. * Described in header.
*/ */
md5_hasher_t *md5_hasher_create() md5_hasher_t *md5_hasher_create(void)
{ {
private_md5_hasher_t *this = malloc_thing(private_md5_hasher_t); private_md5_hasher_t *this = malloc_thing(private_md5_hasher_t);
+1 -1
View File
@@ -55,6 +55,6 @@ struct md5_hasher_t {
* *
* @ingroup hashers * @ingroup hashers
*/ */
md5_hasher_t *md5_hasher_create(); md5_hasher_t *md5_hasher_create(void);
#endif /*MD5_HASHER_H_*/ #endif /*MD5_HASHER_H_*/
+1 -1
View File
@@ -252,7 +252,7 @@ static void destroy(private_sha1_hasher_t *this)
/* /*
* Described in header. * Described in header.
*/ */
sha1_hasher_t *sha1_hasher_create() sha1_hasher_t *sha1_hasher_create(void)
{ {
private_sha1_hasher_t *this = malloc_thing(private_sha1_hasher_t); private_sha1_hasher_t *this = malloc_thing(private_sha1_hasher_t);
+1 -1
View File
@@ -55,6 +55,6 @@ struct sha1_hasher_t {
* *
* @ingroup hashers * @ingroup hashers
*/ */
sha1_hasher_t *sha1_hasher_create(); sha1_hasher_t *sha1_hasher_create(void);
#endif /*SHA1_HASHER_H_*/ #endif /*SHA1_HASHER_H_*/
+2 -2
View File
@@ -170,7 +170,7 @@ static const asn1Object_t privkey_objects[] = {
#define PRIV_KEY_COEFF 9 #define PRIV_KEY_COEFF 9
#define PRIV_KEY_ROOF 16 #define PRIV_KEY_ROOF 16
static private_rsa_private_key_t *rsa_private_key_create_empty(); static private_rsa_private_key_t *rsa_private_key_create_empty(void);
/** /**
* Implementation of private_rsa_private_key_t.compute_prime. * Implementation of private_rsa_private_key_t.compute_prime.
@@ -546,7 +546,7 @@ static void destroy(private_rsa_private_key_t *this)
/** /**
* Internal generic constructor * Internal generic constructor
*/ */
static private_rsa_private_key_t *rsa_private_key_create_empty() static private_rsa_private_key_t *rsa_private_key_create_empty(void)
{ {
private_rsa_private_key_t *this = malloc_thing(private_rsa_private_key_t); private_rsa_private_key_t *this = malloc_thing(private_rsa_private_key_t);
+2 -2
View File
@@ -150,7 +150,7 @@ struct rsa_public_key_info_t {
chunk_t public_key; chunk_t public_key;
}; };
private_rsa_public_key_t *rsa_public_key_create_empty(); private_rsa_public_key_t *rsa_public_key_create_empty(void);
/** /**
* Implementation of private_rsa_public_key_t.rsaep and private_rsa_public_key_t.rsavp1 * Implementation of private_rsa_public_key_t.rsaep and private_rsa_public_key_t.rsavp1
@@ -364,7 +364,7 @@ static void destroy(private_rsa_public_key_t *this)
/** /**
* Generic private constructor * Generic private constructor
*/ */
private_rsa_public_key_t *rsa_public_key_create_empty() private_rsa_public_key_t *rsa_public_key_create_empty(void)
{ {
private_rsa_public_key_t *this = malloc_thing(private_rsa_public_key_t); private_rsa_public_key_t *this = malloc_thing(private_rsa_public_key_t);
+3 -3
View File
@@ -874,9 +874,9 @@ x509_t *x509_create_from_chunk(chunk_t chunk)
this->public_key = NULL; this->public_key = NULL;
this->subject = NULL; this->subject = NULL;
this->issuer = NULL; this->issuer = NULL;
this->subjectAltNames = linked_list_create(this->subjectAltNames); this->subjectAltNames = linked_list_create();
this->issuerAltNames = linked_list_create(this->issuerAltNames); this->issuerAltNames = linked_list_create();
this->crlDistributionPoints = linked_list_create(this->crlDistributionPoints); this->crlDistributionPoints = linked_list_create();
/* we do not use a per-instance logger right now, since its not always accessible */ /* we do not use a per-instance logger right now, since its not always accessible */
logger = logger_manager->get_logger(logger_manager, ASN1); logger = logger_manager->get_logger(logger_manager, ASN1);
+2 -2
View File
@@ -26,7 +26,7 @@
/** /**
* Called whenever the library is linked from a process * Called whenever the library is linked from a process
*/ */
void __attribute__ ((constructor)) library_init() void __attribute__ ((constructor)) library_init(void)
{ {
logger_manager_init(); logger_manager_init();
leak_detective_init(); leak_detective_init();
@@ -35,7 +35,7 @@ void __attribute__ ((constructor)) library_init()
/** /**
* Called whenever the library is unlinked from a process * Called whenever the library is unlinked from a process
*/ */
void __attribute__ ((destructor)) library_cleanup() void __attribute__ ((destructor)) library_cleanup(void)
{ {
leak_detective_cleanup(); leak_detective_cleanup();
logger_manager_cleanup(); logger_manager_cleanup();
+1 -1
View File
@@ -261,7 +261,7 @@ static void destroy(private_host_t *this)
/** /**
* Creates an empty host_t object * Creates an empty host_t object
*/ */
static private_host_t *host_create_empty() static private_host_t *host_create_empty(void)
{ {
private_host_t *this = malloc_thing(private_host_t); private_host_t *this = malloc_thing(private_host_t);
+2 -2
View File
@@ -248,7 +248,7 @@ struct private_identification_t {
id_type_t type; id_type_t type;
}; };
static private_identification_t *identification_create(); static private_identification_t *identification_create(void);
/** /**
@@ -952,7 +952,7 @@ static void destroy(private_identification_t *this)
/** /**
* Generic constructor used for the other constructors. * Generic constructor used for the other constructors.
*/ */
static private_identification_t *identification_create() static private_identification_t *identification_create(void)
{ {
private_identification_t *this = malloc_thing(private_identification_t); private_identification_t *this = malloc_thing(private_identification_t);
+1 -1
View File
@@ -197,7 +197,7 @@ struct linked_list_t {
* *
* @ingroup utils * @ingroup utils
*/ */
linked_list_t *linked_list_create(); linked_list_t *linked_list_create(void);
#endif /*LINKED_LIST_H_*/ #endif /*LINKED_LIST_H_*/
+2 -2
View File
@@ -149,12 +149,12 @@ extern logger_manager_t *logger_manager;
* Initialize the logger manager with all its logger. * Initialize the logger manager with all its logger.
* Has to be called before logger_manager is accessed. * Has to be called before logger_manager is accessed.
*/ */
void logger_manager_init(); void logger_manager_init(void);
/** /**
* Free any resources hold by the logger manager. Do * Free any resources hold by the logger manager. Do
* not access logger_manager after this call. * not access logger_manager after this call.
*/ */
void logger_manager_cleanup(); void logger_manager_cleanup(void);
#endif /*LOGGER_MANAGER_H_*/ #endif /*LOGGER_MANAGER_H_*/
+1 -1
View File
@@ -105,6 +105,6 @@ struct randomizer_t {
* *
* @ingroup utils * @ingroup utils
*/ */
randomizer_t *randomizer_create(); randomizer_t *randomizer_create(void);
#endif /*RANDOMIZER_H_*/ #endif /*RANDOMIZER_H_*/