From 2a65d90b0bb01cad7f827858741901b1e1ee65fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se> Date: Tue, 16 Aug 2016 07:28:23 +0200 Subject: [PATCH] Use const char * for sexp expression types. --- ChangeLog | 4 ++++ sexp.c | 8 ++++---- sexp.h | 8 ++++---- sexp2dsa.c | 4 ++-- sexp2rsa.c | 4 ++-- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 725d22de..e8034e16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2016-08-16 Niels Möller <nisse@lysator.liu.se> + * sexp.c (sexp_iterator_check_type, sexp_iterator_check_types) + (sexp_iterator_assoc): Use const char * for caller's expression + types. Updated all callers. + * rsa2openpgp.c (rsa_keypair_to_openpgp): Added cast to const uint8_t *. diff --git a/sexp.c b/sexp.c index 4073d683..eb8da633 100644 --- a/sexp.c +++ b/sexp.c @@ -295,7 +295,7 @@ sexp_iterator_get_uint32(struct sexp_iterator *iterator, int sexp_iterator_check_type(struct sexp_iterator *iterator, - const uint8_t *type) + const char *type) { return (sexp_iterator_enter_list(iterator) && iterator->type == SEXP_ATOM @@ -305,10 +305,10 @@ sexp_iterator_check_type(struct sexp_iterator *iterator, && sexp_iterator_next(iterator)); } -const uint8_t * +const char * sexp_iterator_check_types(struct sexp_iterator *iterator, unsigned ntypes, - const uint8_t * const *types) + const char * const *types) { if (sexp_iterator_enter_list(iterator) && iterator->type == SEXP_ATOM @@ -327,7 +327,7 @@ sexp_iterator_check_types(struct sexp_iterator *iterator, int sexp_iterator_assoc(struct sexp_iterator *iterator, unsigned nkeys, - const uint8_t * const *keys, + const char * const *keys, struct sexp_iterator *values) { TMP_DECL(found, int, NETTLE_MAX_SEXP_ASSOC); diff --git a/sexp.h b/sexp.h index a01e6a50..039a537b 100644 --- a/sexp.h +++ b/sexp.h @@ -130,12 +130,12 @@ sexp_iterator_get_uint32(struct sexp_iterator *iterator, */ int sexp_iterator_check_type(struct sexp_iterator *iterator, - const uint8_t *type); + const char *type); -const uint8_t * +const char * sexp_iterator_check_types(struct sexp_iterator *iterator, unsigned ntypes, - const uint8_t * const *types); + const char * const *types); /* Current element must be a list. Looks up element of type * @@ -149,7 +149,7 @@ sexp_iterator_check_types(struct sexp_iterator *iterator, int sexp_iterator_assoc(struct sexp_iterator *iterator, unsigned nkeys, - const uint8_t * const *keys, + const char * const *keys, struct sexp_iterator *values); diff --git a/sexp2dsa.c b/sexp2dsa.c index 74b34705..94885993 100644 --- a/sexp2dsa.c +++ b/sexp2dsa.c @@ -61,7 +61,7 @@ dsa_keypair_from_sexp_alist(struct dsa_params *params, unsigned q_bits, struct sexp_iterator *i) { - static const uint8_t * const names[5] + static const char * const names[5] = { "p", "q", "g", "y", "x" }; struct sexp_iterator values[5]; unsigned nvalues = priv ? 5 : 4; @@ -131,7 +131,7 @@ dsa_signature_from_sexp(struct dsa_signature *rs, struct sexp_iterator *i, unsigned q_bits) { - static const uint8_t * const names[2] = { "r", "s" }; + static const char * const names[2] = { "r", "s" }; struct sexp_iterator values[2]; if (!sexp_iterator_assoc(i, 2, names, values)) diff --git a/sexp2rsa.c b/sexp2rsa.c index 7a664fd5..52710436 100644 --- a/sexp2rsa.c +++ b/sexp2rsa.c @@ -59,7 +59,7 @@ rsa_keypair_from_sexp_alist(struct rsa_public_key *pub, unsigned limit, struct sexp_iterator *i) { - static const uint8_t * const names[8] + static const char * const names[8] = { "n", "e", "d", "p", "q", "a", "b", "c" }; struct sexp_iterator values[8]; unsigned nvalues = priv ? 8 : 2; @@ -99,7 +99,7 @@ rsa_keypair_from_sexp(struct rsa_public_key *pub, size_t length, const uint8_t *expr) { struct sexp_iterator i; - static const uint8_t * const names[3] + static const char * const names[3] = { "rsa", "rsa-pkcs1", "rsa-pkcs1-sha1" }; if (!sexp_iterator_first(&i, length, expr)) -- GitLab