diff --git a/agent/call-scd.c b/agent/call-scd.c index 0fc0d3f00..c58199539 100644 --- a/agent/call-scd.c +++ b/agent/call-scd.c @@ -682,7 +682,7 @@ readkey_status_cb (void *opaque, const char *line) * Here we only need the keyref. We use only the first received * KEYPAIRINFO; it is possible to receive several if there are * two or more active cards with the same key. */ - char *fields[2]; + const char *fields[2]; int nfields; line_buffer = xtrystrdup (line); diff --git a/agent/command.c b/agent/command.c index cb4f22bd6..5073aa700 100644 --- a/agent/command.c +++ b/agent/command.c @@ -2804,7 +2804,7 @@ cmd_keytocard (assuan_context_t ctx, char *line) ctrl_t ctrl = assuan_get_pointer (ctx); int force; gpg_error_t err = 0; - char *argv[5]; + const char *argv[5]; int argc; unsigned char grip[20]; const char *serialno, *timestamp_str, *keyref; @@ -3501,7 +3501,7 @@ cmd_getinfo (assuan_context_t ctx, char *line) { #if GCRYPT_VERSION_NUMBER >= 0x010800 char *buf; - char *fields[5]; + const char *fields[5]; buf = gcry_get_config (0, "rng-type"); if (buf diff --git a/common/stringhelp.c b/common/stringhelp.c index d7bb6bc37..a324bfbbc 100644 --- a/common/stringhelp.c +++ b/common/stringhelp.c @@ -1363,10 +1363,11 @@ strtokenize (const char *string, const char *delim) * foo (fields[1]); */ int -split_fields (char *string, char **array, int arraysize) +split_fields (char *string, const char **array, int arraysize) { int n = 0; - char *p, *pend; + const char *p; + char *pend; for (p = string; *p == ' '; p++) ; @@ -1401,10 +1402,11 @@ split_fields (char *string, char **array, int arraysize) * foo (fields[1]); */ int -split_fields_colon (char *string, char **array, int arraysize) +split_fields_colon (char *string, const char **array, int arraysize) { int n = 0; - char *p, *pend; + const char *p; + char *pend; p = string; do diff --git a/common/stringhelp.h b/common/stringhelp.h index 42bb19aaf..c5f252bbc 100644 --- a/common/stringhelp.h +++ b/common/stringhelp.h @@ -151,11 +151,11 @@ char **strtokenize (const char *string, const char *delim); /* Split STRING into space delimited fields and store them in the * provided ARRAY. */ -int split_fields (char *string, char **array, int arraysize); +int split_fields (char *string, const char **array, int arraysize); /* Split STRING into colon delimited fields and store them in the * provided ARRAY. */ -int split_fields_colon (char *string, char **array, int arraysize); +int split_fields_colon (char *string, const char **array, int arraysize); /* Return True if MYVERSION is greater or equal than REQ_VERSION. */ int compare_version_strings (const char *my_version, const char *req_version); diff --git a/common/t-stringhelp.c b/common/t-stringhelp.c index 7c6fb8022..6f7f6f7af 100644 --- a/common/t-stringhelp.c +++ b/common/t-stringhelp.c @@ -717,7 +717,7 @@ test_split_fields (void) }; int tidx; - char *fields[10]; + const char *fields[10]; int field_count_expected, nfields, field_count, i; char *s2; @@ -792,7 +792,7 @@ test_split_fields_colon (void) }; int tidx; - char *fields[10]; + const char *fields[10]; int field_count_expected, nfields, field_count, i; char *s2; diff --git a/dirmngr/loadswdb.c b/dirmngr/loadswdb.c index fb883722a..e9ced8af2 100644 --- a/dirmngr/loadswdb.c +++ b/dirmngr/loadswdb.c @@ -43,7 +43,7 @@ time_of_saved_swdb (const char *fname, time_t *r_filedate, time_t *r_verified) size_t length_of_line = 0; size_t maxlen; ssize_t len; - char *fields[2]; + const char *fields[2]; gnupg_isotime_t isot; time_t filedate = (time_t)(-1); time_t verified = (time_t)(-1); @@ -198,7 +198,7 @@ verify_status_cb (void *opaque, const char *keyword, char *args) /* We care only about the first valid signature. */ if (!strcmp (keyword, "VALIDSIG") && !parm->anyvalid) { - char *fields[3]; + const char *fields[3]; parm->anyvalid = 1; if (split_fields (args, fields, DIM (fields)) >= 3) diff --git a/g10/call-agent.c b/g10/call-agent.c index 42e2d3720..1fa77e7be 100644 --- a/g10/call-agent.c +++ b/g10/call-agent.c @@ -842,7 +842,7 @@ scd_keypairinfo_status_cb (void *opaque, const char *line) /* The format of such a line is: * KEYPAIRINFO [usage] [keytime] */ - char *fields[4]; + const char *fields[4]; int nfields; const char *hexgrp, *keyref, *usage; time_t atime; @@ -1467,7 +1467,7 @@ readkey_status_cb (void *opaque, const char *line) * Note that we use only the first valid KEYPAIRINFO line. More * lines are possible if a second card carries the same key. */ - char *fields[4]; + const char *fields[4]; int nfields; time_t atime; @@ -2099,7 +2099,7 @@ keyinfo_status_cb (void *opaque, const char *line) * 6 7 8 * */ - char *fields[9]; + const char *fields[9]; if (split_fields (s, fields, DIM (fields)) == 9) { diff --git a/tools/card-call-scd.c b/tools/card-call-scd.c index 0b529f06a..b56f40a1c 100644 --- a/tools/card-call-scd.c +++ b/tools/card-call-scd.c @@ -962,7 +962,7 @@ learn_status_cb (void *opaque, const char *line) /* The format of such a line is: * KEYPAIRINFO [usage] [keytime] */ - char *fields[4]; + const char *fields[4]; int nfields; const char *hexgrp, *usage; time_t keytime; diff --git a/tools/card-yubikey.c b/tools/card-yubikey.c index a723739f1..ece7edc48 100644 --- a/tools/card-yubikey.c +++ b/tools/card-yubikey.c @@ -310,7 +310,7 @@ yk_enable_disable (struct ykapps_s *yk, struct iface_s *iface, * stream to output information. This function must only be called on * Yubikeys. */ gpg_error_t -yubikey_commands (card_info_t info, estream_t fp, int argc, char *argv[]) +yubikey_commands (card_info_t info, estream_t fp, int argc, const char *argv[]) { gpg_error_t err; enum {ykLIST, ykENABLE, ykDISABLE } cmd; diff --git a/tools/gpg-card.c b/tools/gpg-card.c index 9238b4759..ba48905e2 100644 --- a/tools/gpg-card.c +++ b/tools/gpg-card.c @@ -2189,11 +2189,11 @@ cmd_writekey (card_info_t info, char *argstr) { gpg_error_t err; int opt_force; - char *argv[2]; + const char *argv[2]; int argc; char *keyref_buffer = NULL; - char *keyref; - char *keygrip; + const char *keyref; + const char *keygrip; if (!info) return print_help @@ -3376,7 +3376,7 @@ cmd_yubikey (card_info_t info, char *argstr) { gpg_error_t err, err2; estream_t fp = opt.interactive? NULL : es_stdout; - char *words[20]; + const char *words[20]; int nwords; if (!info) diff --git a/tools/gpg-card.h b/tools/gpg-card.h index 8c8bc0671..1622f2d5f 100644 --- a/tools/gpg-card.h +++ b/tools/gpg-card.h @@ -244,7 +244,7 @@ unsigned long agent_get_s2k_count (void); /*-- card-yubikey.c --*/ gpg_error_t yubikey_commands (card_info_t info, - estream_t fp, int argc, char *argv[]); + estream_t fp, int argc, const char *argv[]); #endif /*GNUPG_GPG_CARD_H*/ diff --git a/tools/gpg-wks-client.c b/tools/gpg-wks-client.c index 5f765d3c1..b5a1753bf 100644 --- a/tools/gpg-wks-client.c +++ b/tools/gpg-wks-client.c @@ -558,7 +558,7 @@ decrypt_stream_status_cb (void *opaque, const char *keyword, char *args) log_debug ("gpg status: %s %s\n", keyword, args); if (!strcmp (keyword, "DECRYPTION_KEY") && !decinfo->fpr) { - char *fields[3]; + const char *fields[3]; if (split_fields (args, fields, DIM (fields)) >= 3) { @@ -1199,7 +1199,7 @@ static void encrypt_response_status_cb (void *opaque, const char *keyword, char *args) { gpg_error_t *failure = opaque; - char *fields[2]; + const char *fields[2]; if (DBG_CRYPTO) log_debug ("gpg status: %s %s\n", keyword, args); diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c index d6cc14c28..4dae7b49d 100644 --- a/tools/gpgconf-comp.c +++ b/tools/gpgconf-comp.c @@ -1553,8 +1553,8 @@ retrieve_options_from_program (gc_component_id_t component, int only_installed) while ((length = es_read_line (outfp, &line, &line_len, NULL)) > 0) { - char *fields[4]; - char *optname, *optdesc; + const char *fields[4]; + const char *optname, *optdesc; unsigned int optflags; int short_opt; gc_arg_type_t arg_type; @@ -1621,8 +1621,8 @@ retrieve_options_from_program (gc_component_id_t component, int only_installed) string_array_size, sizeof *string_array); } - string_array[string_array_used++] = optname = xstrdup (fields[0]); - string_array[string_array_used++] = optdesc = xstrdup (fields[3]); + optname = string_array[string_array_used++] = xstrdup (fields[0]); + optdesc = string_array[string_array_used++] = xstrdup (fields[3]); /* Create an option table which can then be supplied to * gpgrt_parser. Unfortunately there is no private pointer in diff --git a/tools/gpgconf.c b/tools/gpgconf.c index 539461d80..346a6585d 100644 --- a/tools/gpgconf.c +++ b/tools/gpgconf.c @@ -361,7 +361,7 @@ query_swdb (estream_t out, const char *name, const char *current_version) size_t length_of_line = 0; size_t maxlen; ssize_t len; - char *fields[2]; + const char *fields[2]; char *p; gnupg_isotime_t filedate = {0}; gnupg_isotime_t verified = {0}; diff --git a/tools/wks-util.c b/tools/wks-util.c index 22ad9881b..30461f850 100644 --- a/tools/wks-util.c +++ b/tools/wks-util.c @@ -953,7 +953,7 @@ install_key_from_spec_file (const char *fname) char *line = NULL; size_t linelen = 0; size_t maxlen = 2048; - char *fields[2]; + const char *fields[2]; unsigned int lnr = 0; if (!fname || !strcmp (fname, ""))