diff options
author | Werner Koch <wk@gnupg.org> | 2016-01-07 19:01:18 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2016-01-07 19:09:16 +0100 |
commit | 008aa6e6d4b213c3a0d15509eb46cf168b6f2c94 (patch) | |
tree | 108e4e0d20a00d780fe864b1d40c2890cb9d9527 /g10 | |
parent | sm: Avoid warnings about useless assignments. (diff) | |
download | gnupg2-008aa6e6d4b213c3a0d15509eb46cf168b6f2c94.tar.xz gnupg2-008aa6e6d4b213c3a0d15509eb46cf168b6f2c94.zip |
gpg: Fix warnings about useless assignments.
* g10/armor.c (parse_hash_header): Remove duplicate var assignment.
* g10/getkey.c (cache_user_id): Ditto.
* g10/keygen.c (ask_curve): Ditto. This also fixes a small memory
leak.
* g10/keygen.c (proc_parameter_file): Remove useless assignment or
pointer increment.
(generate_keypair): Ditto.
* g10/getkey.c (finish_lookup, lookup): Ditto.
* g10/card-util.c (change_pin): Ditto.
* g10/gpg.c (main) <aVerify>: Ditto.
* g10/import.c (import): Ditto.
(print_import_check): Ditto
* g10/keyring.c (do_copy): Ditto.
* g10/tdbio.c (tdbio_read_record): Ditto.
* g10/trustdb.c (tdb_update_ownertrust): Ditto.
(update_validity): Ditto.
* g10/server.c (cmd_passwd): Remove useless call to skip_options.
--
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10')
-rw-r--r-- | g10/armor.c | 2 | ||||
-rw-r--r-- | g10/card-util.c | 1 | ||||
-rw-r--r-- | g10/getkey.c | 5 | ||||
-rw-r--r-- | g10/gpg.c | 1 | ||||
-rw-r--r-- | g10/import.c | 2 | ||||
-rw-r--r-- | g10/keygen.c | 7 | ||||
-rw-r--r-- | g10/keyring.c | 4 | ||||
-rw-r--r-- | g10/server.c | 3 | ||||
-rw-r--r-- | g10/tdbio.c | 33 | ||||
-rw-r--r-- | g10/trustdb.c | 2 |
10 files changed, 30 insertions, 30 deletions
diff --git a/g10/armor.c b/g10/armor.c index e36866009..6c133a2d9 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -274,7 +274,7 @@ parse_hash_header( const char *line ) return 0; /* too short or too long */ if( memcmp( line, "Hash:", 5 ) ) return 0; /* invalid header */ - s = line+5; + for(s=line+5;;s=s2) { for(; *s && (*s==' ' || *s == '\t'); s++ ) ; diff --git a/g10/card-util.c b/g10/card-util.c index 7196031c4..b48705bd4 100644 --- a/g10/card-util.c +++ b/g10/card-util.c @@ -145,7 +145,6 @@ change_pin (int unblock_v2, int allow_admin) if (strlen (answer) != 1) continue; - rc = 0; if (*answer == '1') { /* Change PIN. */ diff --git a/g10/getkey.c b/g10/getkey.c index 86a3c8061..6a1fce6da 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -300,7 +300,8 @@ cache_user_id (KBNODE keyblock) /* First check for duplicates. */ for (r = user_id_db; r; r = r->next) { - keyid_list_t b = r->keyids; + keyid_list_t b; + for (b = r->keyids; b; b = b->next) { if (!memcmp (b->fpr, a->fpr, MAX_FINGERPRINT_LEN)) @@ -2997,7 +2998,6 @@ finish_lookup (GETKEY_CTX ctx, KBNODE keyblock) if (DBG_LOOKUP) log_debug ("\tprimary key may be used\n"); latest_key = keyblock; - latest_date = pk->timestamp; } } @@ -3074,7 +3074,6 @@ lookup (getkey_ctx_t ctx, kbnode_t *ret_keyblock, kbnode_t *ret_found_key, if (rc) { log_error ("keydb_get_keyblock failed: %s\n", gpg_strerror (rc)); - rc = 0; goto skip; } @@ -3941,7 +3941,6 @@ main (int argc, char **argv) break; case aVerify: - rc = 0; if (multifile) { if ((rc = verify_files (ctrl, argc, argv))) diff --git a/g10/import.c b/g10/import.c index d35b5d590..8e75aa160 100644 --- a/g10/import.c +++ b/g10/import.c @@ -353,7 +353,6 @@ import (ctrl_t ctrl, IOBUF inp, const char* fname,struct import_stats_s *stats, && gpg_err_source (rc) == GPG_ERR_SOURCE_KEYBOX) { stats->not_imported++; - rc = 0; } else if (rc) break; @@ -799,7 +798,6 @@ print_import_check (PKT_public_key * pk, PKT_user_id * id) for (i = 0; i < n; i++, pos += 2) sprintf (buf+pos, "%02X", fpr[i]); strcat (buf, " "); - pos += 1; strcat (buf, id->name); write_status_text (STATUS_IMPORT_CHECK, buf); xfree (buf); diff --git a/g10/keygen.c b/g10/keygen.c index 921e93807..40619ca61 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -2242,10 +2242,7 @@ ask_curve (int *algo, int *subkey_algo) && curves[idx].fix_curve) { if (subkey_algo && *subkey_algo == PUBKEY_ALGO_ECDSA) - { - *subkey_algo = PUBKEY_ALGO_EDDSA; - result = xstrdup ("Ed25519"); - } + *subkey_algo = PUBKEY_ALGO_EDDSA; *algo = PUBKEY_ALGO_EDDSA; result = xstrdup ("Ed25519"); } @@ -3122,6 +3119,7 @@ proc_parameter_file (ctrl_t ctrl, struct para_data_s *para, const char *fname, } else { + r = get_parameter (para, pKEYSERVER); log_error("%s:%d: invalid keyserver url\n", fname, r->lnr ); return -1; } @@ -3706,7 +3704,6 @@ generate_keypair (ctrl_t ctrl, int full, const char *fname, || algo == PUBKEY_ALGO_ECDH) { curve = ask_curve (&algo, NULL); - nbits = 0; r = xmalloc_clear (sizeof *r + strlen (curve)); r->key = pKEYCURVE; strcpy (r->u.value, curve); diff --git a/g10/keyring.c b/g10/keyring.c index 0f1e058e6..4dc7e0a88 100644 --- a/g10/keyring.c +++ b/g10/keyring.c @@ -1508,6 +1508,8 @@ keyring_rebuild_cache (void *token,int noisy) * the original file is closed */ tmpfp = NULL; } + /* Static analyzer note: BAKFILENAME is never NULL here + because it is controlled by LASTRESNAME. */ rc = lastresname? rename_tmp_file (bakfilename, tmpfilename, lastresname) : 0; xfree (tmpfilename); tmpfilename = NULL; @@ -1720,7 +1722,6 @@ do_copy (int mode, const char *fname, KBNODE root, iobuf_cancel(newfp); goto leave; } - rc = 0; } if( mode == 2 || mode == 3 ) { /* delete or update */ @@ -1764,7 +1765,6 @@ do_copy (int mode, const char *fname, KBNODE root, iobuf_cancel(newfp); goto leave; } - rc = 0; } /* close both files */ diff --git a/g10/server.c b/g10/server.c index e5539d5ac..31e35a905 100644 --- a/g10/server.c +++ b/g10/server.c @@ -623,7 +623,8 @@ cmd_passwd (assuan_context_t ctx, char *line) gpg_error_t err; (void)ctx; - line = skip_options (line); + (void)line; + /* line = skip_options (line); */ err = gpg_error (GPG_ERR_NOT_SUPPORTED); diff --git a/g10/tdbio.c b/g10/tdbio.c index 63ccfae21..3cc8bd3ff 100644 --- a/g10/tdbio.c +++ b/g10/tdbio.c @@ -1497,13 +1497,16 @@ tdbio_read_record (ulong recnum, TRUSTREC *rec, int expected) rec->r.ver.trust_model = *p++; rec->r.ver.min_cert_level = *p++; p += 2; - rec->r.ver.created = buf32_to_ulong(p); p += 4; - rec->r.ver.nextcheck = buf32_to_ulong(p); p += 4; + rec->r.ver.created = buf32_to_ulong(p); p += 4; + rec->r.ver.nextcheck = buf32_to_ulong(p); p += 4; - rec->r.ver.firstfree =buf32_to_ulong(p); p += 4; p += 4; - rec->r.ver.trusthashtbl =buf32_to_ulong(p); p += 4; + p += 4; + rec->r.ver.firstfree = buf32_to_ulong(p); + p += 4; + p += 4; + rec->r.ver.trusthashtbl = buf32_to_ulong(p); if (recnum) { log_error( _("%s: version record with recnum %lu\n"), db_name, @@ -1520,37 +1523,43 @@ tdbio_read_record (ulong recnum, TRUSTREC *rec, int expected) break; case RECTYPE_FREE: - rec->r.free.next = buf32_to_ulong(p); p += 4; + rec->r.free.next = buf32_to_ulong(p); break; case RECTYPE_HTBL: for (i=0; i < ITEMS_PER_HTBL_RECORD; i++) { - rec->r.htbl.item[i] = buf32_to_ulong(p); p += 4; + rec->r.htbl.item[i] = buf32_to_ulong(p); + p += 4; } break; case RECTYPE_HLST: - rec->r.hlst.next = buf32_to_ulong(p); p += 4; + rec->r.hlst.next = buf32_to_ulong(p); + p += 4; for (i=0; i < ITEMS_PER_HLST_RECORD; i++) { - rec->r.hlst.rnum[i] = buf32_to_ulong(p); p += 4; + rec->r.hlst.rnum[i] = buf32_to_ulong(p); + p += 4; } break; case RECTYPE_TRUST: - memcpy (rec->r.trust.fingerprint, p, 20); p+=20; + memcpy (rec->r.trust.fingerprint, p, 20); + p+=20; rec->r.trust.ownertrust = *p++; rec->r.trust.depth = *p++; rec->r.trust.min_ownertrust = *p++; p++; - rec->r.trust.validlist = buf32_to_ulong(p); p += 4; + rec->r.trust.validlist = buf32_to_ulong(p); break; case RECTYPE_VALID: - memcpy (rec->r.valid.namehash, p, 20); p+=20; + memcpy (rec->r.valid.namehash, p, 20); + p+=20; rec->r.valid.validity = *p++; - rec->r.valid.next = buf32_to_ulong(p); p += 4; + rec->r.valid.next = buf32_to_ulong(p); + p += 4; rec->r.valid.full_count = *p++; rec->r.valid.marginal_count = *p++; break; diff --git a/g10/trustdb.c b/g10/trustdb.c index af839d1e8..9217dd991 100644 --- a/g10/trustdb.c +++ b/g10/trustdb.c @@ -724,7 +724,6 @@ tdb_update_ownertrust (PKT_public_key *pk, unsigned int new_trust ) write_record (&rec); tdb_revalidation_mark (); do_sync (); - err = 0; } else { @@ -858,7 +857,6 @@ update_validity (PKT_public_key *pk, PKT_user_id *uid, /* No record yet - create a new one. */ size_t dummy; - err = 0; memset (&trec, 0, sizeof trec); trec.recnum = tdbio_new_recnum (); trec.rectype = RECTYPE_TRUST; |