core: Use const char * where appropriate.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2016-09-13 20:59:07 +02:00
parent 686a065f63
commit 51f9acbca9
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
8 changed files with 35 additions and 25 deletions

View File

@ -359,7 +359,7 @@ llass_set_locale (void *engine, int category, const char *value)
gpgme_error_t err; gpgme_error_t err;
engine_llass_t llass = engine; engine_llass_t llass = engine;
char *optstr; char *optstr;
char *catstr; const char *catstr;
if (!llass->opt.gpg_agent) if (!llass->opt.gpg_agent)
return 0; return 0;

View File

@ -356,7 +356,7 @@ g13_set_locale (void *engine, int category, const char *value)
engine_g13_t g13 = engine; engine_g13_t g13 = engine;
gpgme_error_t err; gpgme_error_t err;
char *optstr; char *optstr;
char *catstr; const char *catstr;
/* FIXME: If value is NULL, we need to reset the option to default. /* FIXME: If value is NULL, we need to reset the option to default.
But we can't do this. So we error out here. G13 needs support But we can't do this. So we error out here. G13 needs support
@ -405,7 +405,7 @@ g13_set_locale (void *engine, int category, const char *value)
#if USE_DESCRIPTOR_PASSING #if USE_DESCRIPTOR_PASSING
static gpgme_error_t static gpgme_error_t
g13_assuan_simple_command (assuan_context_t ctx, char *cmd, g13_assuan_simple_command (assuan_context_t ctx, const char *cmd,
engine_status_handler_t status_fnc, engine_status_handler_t status_fnc,
void *status_fnc_value) void *status_fnc_value)
{ {

View File

@ -1574,6 +1574,8 @@ gpg_passwd (void *engine, gpgme_key_t key, unsigned int flags)
engine_gpg_t gpg = engine; engine_gpg_t gpg = engine;
gpgme_error_t err; gpgme_error_t err;
(void)flags;
if (!key || !key->subkeys || !key->subkeys->fpr) if (!key || !key->subkeys || !key->subkeys->fpr)
return gpg_error (GPG_ERR_INV_CERT_OBJ); return gpg_error (GPG_ERR_INV_CERT_OBJ);

View File

@ -517,7 +517,7 @@ gpgsm_set_locale (void *engine, int category, const char *value)
engine_gpgsm_t gpgsm = engine; engine_gpgsm_t gpgsm = engine;
gpgme_error_t err; gpgme_error_t err;
char *optstr; char *optstr;
char *catstr; const char *catstr;
/* FIXME: If value is NULL, we need to reset the option to default. /* FIXME: If value is NULL, we need to reset the option to default.
But we can't do this. So we error out here. GPGSM needs support But we can't do this. So we error out here. GPGSM needs support
@ -565,7 +565,7 @@ gpgsm_set_locale (void *engine, int category, const char *value)
static gpgme_error_t static gpgme_error_t
gpgsm_assuan_simple_command (engine_gpgsm_t gpgsm, char *cmd, gpgsm_assuan_simple_command (engine_gpgsm_t gpgsm, const char *cmd,
engine_status_handler_t status_fnc, engine_status_handler_t status_fnc,
void *status_fnc_value) void *status_fnc_value)
{ {
@ -674,7 +674,7 @@ gpgsm_set_fd (engine_gpgsm_t gpgsm, fd_type_t fd_type, const char *opt)
{ {
gpg_error_t err = 0; gpg_error_t err = 0;
char line[COMMANDLINELEN]; char line[COMMANDLINELEN];
char *which; const char *which;
iocb_data_t *iocb_data; iocb_data_t *iocb_data;
#if USE_DESCRIPTOR_PASSING #if USE_DESCRIPTOR_PASSING
int dir; int dir;
@ -1480,6 +1480,7 @@ gpgsm_genkey (void *engine,
} }
(void)userid; (void)userid;
(void)algo;
(void)expires; (void)expires;
(void)key; (void)key;
(void)flags; (void)flags;
@ -2017,6 +2018,8 @@ gpgsm_passwd (void *engine, gpgme_key_t key, unsigned int flags)
gpgme_error_t err; gpgme_error_t err;
char *line; char *line;
(void)flags;
if (!key || !key->subkeys || !key->subkeys->fpr) if (!key || !key->subkeys || !key->subkeys->fpr)
return gpg_error (GPG_ERR_INV_CERT_OBJ); return gpg_error (GPG_ERR_INV_CERT_OBJ);

View File

@ -251,6 +251,7 @@ uiserver_new (void **engine, const char *file_name, const char *home_dir,
char *dft_ttytype = NULL; char *dft_ttytype = NULL;
char *optstr; char *optstr;
(void)home_dir;
(void)version; /* Not yet used. */ (void)version; /* Not yet used. */
uiserver = calloc (1, sizeof *uiserver); uiserver = calloc (1, sizeof *uiserver);
@ -400,7 +401,7 @@ uiserver_set_locale (void *engine, int category, const char *value)
engine_uiserver_t uiserver = engine; engine_uiserver_t uiserver = engine;
gpgme_error_t err; gpgme_error_t err;
char *optstr; char *optstr;
char *catstr; const char *catstr;
/* FIXME: If value is NULL, we need to reset the option to default. /* FIXME: If value is NULL, we need to reset the option to default.
But we can't do this. So we error out here. UISERVER needs support But we can't do this. So we error out here. UISERVER needs support
@ -459,7 +460,7 @@ uiserver_set_protocol (void *engine, gpgme_protocol_t protocol)
static gpgme_error_t static gpgme_error_t
uiserver_assuan_simple_command (engine_uiserver_t uiserver, char *cmd, uiserver_assuan_simple_command (engine_uiserver_t uiserver, const char *cmd,
engine_status_handler_t status_fnc, engine_status_handler_t status_fnc,
void *status_fnc_value) void *status_fnc_value)
{ {
@ -534,7 +535,7 @@ uiserver_set_fd (engine_uiserver_t uiserver, fd_type_t fd_type, const char *opt)
{ {
gpg_error_t err = 0; gpg_error_t err = 0;
char line[COMMANDLINELEN]; char line[COMMANDLINELEN];
char *which; const char *which;
iocb_data_t *iocb_data; iocb_data_t *iocb_data;
int dir; int dir;

View File

@ -202,7 +202,7 @@ peek_membuf (membuf_t *mb, size_t *len)
/* SUPPORT. */ /* SUPPORT. */
FILE *log_stream; FILE *log_stream;
char *program_name = "gpgme-tool"; char program_name[] = "gpgme-tool";
#define spacep(p) (*(p) == ' ' || *(p) == '\t') #define spacep(p) (*(p) == ' ' || *(p) == '\t')
@ -308,7 +308,7 @@ struct result_xml_state
#define MAX_TAGS 20 #define MAX_TAGS 20
int next_tag; int next_tag;
char *tag[MAX_TAGS]; const char *tag[MAX_TAGS];
int had_data[MAX_TAGS]; int had_data[MAX_TAGS];
}; };
@ -492,7 +492,8 @@ result_xml_tag_end (struct result_xml_state *state)
gpg_error_t gpg_error_t
result_add_error (struct result_xml_state *state, char *name, gpg_error_t err) result_add_error (struct result_xml_state *state,
const char *name, gpg_error_t err)
{ {
char code[20]; char code[20];
char msg[1024]; char msg[1024];
@ -508,7 +509,7 @@ result_add_error (struct result_xml_state *state, char *name, gpg_error_t err)
gpg_error_t gpg_error_t
result_add_pubkey_algo (struct result_xml_state *state, result_add_pubkey_algo (struct result_xml_state *state,
char *name, gpgme_pubkey_algo_t algo) const char *name, gpgme_pubkey_algo_t algo)
{ {
char code[20]; char code[20];
char msg[80]; char msg[80];
@ -524,10 +525,11 @@ result_add_pubkey_algo (struct result_xml_state *state,
gpg_error_t gpg_error_t
result_add_hash_algo (struct result_xml_state *state, result_add_hash_algo (struct result_xml_state *state,
char *name, gpgme_hash_algo_t algo) const char *name, gpgme_hash_algo_t algo)
{ {
char code[20]; char code[20];
char msg[80]; char msg[80];
snprintf (code, sizeof (code) - 1, "0x%x", algo); snprintf (code, sizeof (code) - 1, "0x%x", algo);
snprintf (msg, sizeof (msg) - 1, "%s", snprintf (msg, sizeof (msg) - 1, "%s",
gpgme_hash_algo_name (algo)); gpgme_hash_algo_name (algo));
@ -539,7 +541,8 @@ result_add_hash_algo (struct result_xml_state *state,
gpg_error_t gpg_error_t
result_add_keyid (struct result_xml_state *state, char *name, char *keyid) result_add_keyid (struct result_xml_state *state,
const char *name, const char *keyid)
{ {
result_xml_tag_start (state, name, NULL); result_xml_tag_start (state, name, NULL);
result_xml_tag_data (state, keyid); result_xml_tag_data (state, keyid);
@ -549,7 +552,8 @@ result_add_keyid (struct result_xml_state *state, char *name, char *keyid)
gpg_error_t gpg_error_t
result_add_fpr (struct result_xml_state *state, char *name, char *fpr) result_add_fpr (struct result_xml_state *state,
const char *name, const char *fpr)
{ {
result_xml_tag_start (state, name, NULL); result_xml_tag_start (state, name, NULL);
result_xml_tag_data (state, fpr); result_xml_tag_data (state, fpr);
@ -559,7 +563,7 @@ result_add_fpr (struct result_xml_state *state, char *name, char *fpr)
gpg_error_t gpg_error_t
result_add_timestamp (struct result_xml_state *state, char *name, result_add_timestamp (struct result_xml_state *state, const char *name,
unsigned int timestamp) unsigned int timestamp)
{ {
char code[20]; char code[20];
@ -572,10 +576,10 @@ result_add_timestamp (struct result_xml_state *state, char *name,
gpg_error_t gpg_error_t
result_add_sig_mode (struct result_xml_state *state, char *name, result_add_sig_mode (struct result_xml_state *state, const char *name,
gpgme_sig_mode_t sig_mode) gpgme_sig_mode_t sig_mode)
{ {
char *mode; const char *mode;
char code[20]; char code[20];
snprintf (code, sizeof (code) - 1, "%i", sig_mode); snprintf (code, sizeof (code) - 1, "%i", sig_mode);
@ -602,7 +606,7 @@ result_add_sig_mode (struct result_xml_state *state, char *name,
gpg_error_t gpg_error_t
result_add_protocol (struct result_xml_state *state, char *name, result_add_protocol (struct result_xml_state *state, const char *name,
gpgme_protocol_t protocol) gpgme_protocol_t protocol)
{ {
const char *str; const char *str;
@ -620,7 +624,7 @@ result_add_protocol (struct result_xml_state *state, char *name,
gpg_error_t gpg_error_t
result_add_validity (struct result_xml_state *state, char *name, result_add_validity (struct result_xml_state *state, const char *name,
gpgme_validity_t validity) gpgme_validity_t validity)
{ {
const char *str; const char *str;
@ -657,7 +661,7 @@ result_add_validity (struct result_xml_state *state, char *name,
gpg_error_t gpg_error_t
result_add_value (struct result_xml_state *state, result_add_value (struct result_xml_state *state,
char *name, unsigned int val) const char *name, unsigned int val)
{ {
char code[20]; char code[20];
@ -670,7 +674,7 @@ result_add_value (struct result_xml_state *state,
gpg_error_t gpg_error_t
result_add_string (struct result_xml_state *state, result_add_string (struct result_xml_state *state,
char *name, char *str) const char *name, const char *str)
{ {
if (!str) if (!str)
str = ""; str = "";

View File

@ -282,7 +282,7 @@ _gpgme_io_set_nonblocking (int fd)
static long int static long int
get_max_fds (void) get_max_fds (void)
{ {
char *source = NULL; const char *source = NULL;
long int fds = -1; long int fds = -1;
int rc; int rc;

View File

@ -196,7 +196,7 @@ _gpgme_compare_versions (const char *my_version,
const char * const char *
gpgme_check_version (const char *req_version) gpgme_check_version (const char *req_version)
{ {
char *result; const char *result;
do_subsystem_inits (); do_subsystem_inits ();
/* Catch-22: We need to get at least the debug subsystem ready /* Catch-22: We need to get at least the debug subsystem ready