mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
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>
This commit is contained in:
parent
126aebbb82
commit
008aa6e6d4
@ -274,7 +274,7 @@ parse_hash_header( const char *line )
|
|||||||
return 0; /* too short or too long */
|
return 0; /* too short or too long */
|
||||||
if( memcmp( line, "Hash:", 5 ) )
|
if( memcmp( line, "Hash:", 5 ) )
|
||||||
return 0; /* invalid header */
|
return 0; /* invalid header */
|
||||||
s = line+5;
|
|
||||||
for(s=line+5;;s=s2) {
|
for(s=line+5;;s=s2) {
|
||||||
for(; *s && (*s==' ' || *s == '\t'); s++ )
|
for(; *s && (*s==' ' || *s == '\t'); s++ )
|
||||||
;
|
;
|
||||||
|
@ -145,7 +145,6 @@ change_pin (int unblock_v2, int allow_admin)
|
|||||||
if (strlen (answer) != 1)
|
if (strlen (answer) != 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
rc = 0;
|
|
||||||
if (*answer == '1')
|
if (*answer == '1')
|
||||||
{
|
{
|
||||||
/* Change PIN. */
|
/* Change PIN. */
|
||||||
|
@ -300,7 +300,8 @@ cache_user_id (KBNODE keyblock)
|
|||||||
/* First check for duplicates. */
|
/* First check for duplicates. */
|
||||||
for (r = user_id_db; r; r = r->next)
|
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)
|
for (b = r->keyids; b; b = b->next)
|
||||||
{
|
{
|
||||||
if (!memcmp (b->fpr, a->fpr, MAX_FINGERPRINT_LEN))
|
if (!memcmp (b->fpr, a->fpr, MAX_FINGERPRINT_LEN))
|
||||||
@ -2997,7 +2998,6 @@ finish_lookup (GETKEY_CTX ctx, KBNODE keyblock)
|
|||||||
if (DBG_LOOKUP)
|
if (DBG_LOOKUP)
|
||||||
log_debug ("\tprimary key may be used\n");
|
log_debug ("\tprimary key may be used\n");
|
||||||
latest_key = keyblock;
|
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)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_error ("keydb_get_keyblock failed: %s\n", gpg_strerror (rc));
|
log_error ("keydb_get_keyblock failed: %s\n", gpg_strerror (rc));
|
||||||
rc = 0;
|
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3941,7 +3941,6 @@ main (int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case aVerify:
|
case aVerify:
|
||||||
rc = 0;
|
|
||||||
if (multifile)
|
if (multifile)
|
||||||
{
|
{
|
||||||
if ((rc = verify_files (ctrl, argc, argv)))
|
if ((rc = verify_files (ctrl, argc, argv)))
|
||||||
|
@ -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)
|
&& gpg_err_source (rc) == GPG_ERR_SOURCE_KEYBOX)
|
||||||
{
|
{
|
||||||
stats->not_imported++;
|
stats->not_imported++;
|
||||||
rc = 0;
|
|
||||||
}
|
}
|
||||||
else if (rc)
|
else if (rc)
|
||||||
break;
|
break;
|
||||||
@ -799,7 +798,6 @@ print_import_check (PKT_public_key * pk, PKT_user_id * id)
|
|||||||
for (i = 0; i < n; i++, pos += 2)
|
for (i = 0; i < n; i++, pos += 2)
|
||||||
sprintf (buf+pos, "%02X", fpr[i]);
|
sprintf (buf+pos, "%02X", fpr[i]);
|
||||||
strcat (buf, " ");
|
strcat (buf, " ");
|
||||||
pos += 1;
|
|
||||||
strcat (buf, id->name);
|
strcat (buf, id->name);
|
||||||
write_status_text (STATUS_IMPORT_CHECK, buf);
|
write_status_text (STATUS_IMPORT_CHECK, buf);
|
||||||
xfree (buf);
|
xfree (buf);
|
||||||
|
@ -2242,10 +2242,7 @@ ask_curve (int *algo, int *subkey_algo)
|
|||||||
&& curves[idx].fix_curve)
|
&& curves[idx].fix_curve)
|
||||||
{
|
{
|
||||||
if (subkey_algo && *subkey_algo == PUBKEY_ALGO_ECDSA)
|
if (subkey_algo && *subkey_algo == PUBKEY_ALGO_ECDSA)
|
||||||
{
|
*subkey_algo = PUBKEY_ALGO_EDDSA;
|
||||||
*subkey_algo = PUBKEY_ALGO_EDDSA;
|
|
||||||
result = xstrdup ("Ed25519");
|
|
||||||
}
|
|
||||||
*algo = PUBKEY_ALGO_EDDSA;
|
*algo = PUBKEY_ALGO_EDDSA;
|
||||||
result = xstrdup ("Ed25519");
|
result = xstrdup ("Ed25519");
|
||||||
}
|
}
|
||||||
@ -3122,6 +3119,7 @@ proc_parameter_file (ctrl_t ctrl, struct para_data_s *para, const char *fname,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
r = get_parameter (para, pKEYSERVER);
|
||||||
log_error("%s:%d: invalid keyserver url\n", fname, r->lnr );
|
log_error("%s:%d: invalid keyserver url\n", fname, r->lnr );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -3706,7 +3704,6 @@ generate_keypair (ctrl_t ctrl, int full, const char *fname,
|
|||||||
|| algo == PUBKEY_ALGO_ECDH)
|
|| algo == PUBKEY_ALGO_ECDH)
|
||||||
{
|
{
|
||||||
curve = ask_curve (&algo, NULL);
|
curve = ask_curve (&algo, NULL);
|
||||||
nbits = 0;
|
|
||||||
r = xmalloc_clear (sizeof *r + strlen (curve));
|
r = xmalloc_clear (sizeof *r + strlen (curve));
|
||||||
r->key = pKEYCURVE;
|
r->key = pKEYCURVE;
|
||||||
strcpy (r->u.value, curve);
|
strcpy (r->u.value, curve);
|
||||||
|
@ -1508,6 +1508,8 @@ keyring_rebuild_cache (void *token,int noisy)
|
|||||||
* the original file is closed */
|
* the original file is closed */
|
||||||
tmpfp = NULL;
|
tmpfp = NULL;
|
||||||
}
|
}
|
||||||
|
/* Static analyzer note: BAKFILENAME is never NULL here
|
||||||
|
because it is controlled by LASTRESNAME. */
|
||||||
rc = lastresname? rename_tmp_file (bakfilename, tmpfilename,
|
rc = lastresname? rename_tmp_file (bakfilename, tmpfilename,
|
||||||
lastresname) : 0;
|
lastresname) : 0;
|
||||||
xfree (tmpfilename); tmpfilename = NULL;
|
xfree (tmpfilename); tmpfilename = NULL;
|
||||||
@ -1720,7 +1722,6 @@ do_copy (int mode, const char *fname, KBNODE root,
|
|||||||
iobuf_cancel(newfp);
|
iobuf_cancel(newfp);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
rc = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( mode == 2 || mode == 3 ) { /* delete or update */
|
if( mode == 2 || mode == 3 ) { /* delete or update */
|
||||||
@ -1764,7 +1765,6 @@ do_copy (int mode, const char *fname, KBNODE root,
|
|||||||
iobuf_cancel(newfp);
|
iobuf_cancel(newfp);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
rc = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* close both files */
|
/* close both files */
|
||||||
|
@ -623,7 +623,8 @@ cmd_passwd (assuan_context_t ctx, char *line)
|
|||||||
gpg_error_t err;
|
gpg_error_t err;
|
||||||
|
|
||||||
(void)ctx;
|
(void)ctx;
|
||||||
line = skip_options (line);
|
(void)line;
|
||||||
|
/* line = skip_options (line); */
|
||||||
|
|
||||||
err = gpg_error (GPG_ERR_NOT_SUPPORTED);
|
err = gpg_error (GPG_ERR_NOT_SUPPORTED);
|
||||||
|
|
||||||
|
33
g10/tdbio.c
33
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.trust_model = *p++;
|
||||||
rec->r.ver.min_cert_level = *p++;
|
rec->r.ver.min_cert_level = *p++;
|
||||||
p += 2;
|
p += 2;
|
||||||
rec->r.ver.created = buf32_to_ulong(p); p += 4;
|
rec->r.ver.created = buf32_to_ulong(p);
|
||||||
rec->r.ver.nextcheck = buf32_to_ulong(p); p += 4;
|
p += 4;
|
||||||
|
rec->r.ver.nextcheck = buf32_to_ulong(p);
|
||||||
p += 4;
|
p += 4;
|
||||||
p += 4;
|
p += 4;
|
||||||
rec->r.ver.firstfree =buf32_to_ulong(p); p += 4;
|
|
||||||
p += 4;
|
p += 4;
|
||||||
rec->r.ver.trusthashtbl =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);
|
||||||
if (recnum)
|
if (recnum)
|
||||||
{
|
{
|
||||||
log_error( _("%s: version record with recnum %lu\n"), db_name,
|
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;
|
break;
|
||||||
|
|
||||||
case RECTYPE_FREE:
|
case RECTYPE_FREE:
|
||||||
rec->r.free.next = buf32_to_ulong(p); p += 4;
|
rec->r.free.next = buf32_to_ulong(p);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RECTYPE_HTBL:
|
case RECTYPE_HTBL:
|
||||||
for (i=0; i < ITEMS_PER_HTBL_RECORD; i++)
|
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;
|
break;
|
||||||
|
|
||||||
case RECTYPE_HLST:
|
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++)
|
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;
|
break;
|
||||||
|
|
||||||
case RECTYPE_TRUST:
|
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.ownertrust = *p++;
|
||||||
rec->r.trust.depth = *p++;
|
rec->r.trust.depth = *p++;
|
||||||
rec->r.trust.min_ownertrust = *p++;
|
rec->r.trust.min_ownertrust = *p++;
|
||||||
p++;
|
p++;
|
||||||
rec->r.trust.validlist = buf32_to_ulong(p); p += 4;
|
rec->r.trust.validlist = buf32_to_ulong(p);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RECTYPE_VALID:
|
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.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.full_count = *p++;
|
||||||
rec->r.valid.marginal_count = *p++;
|
rec->r.valid.marginal_count = *p++;
|
||||||
break;
|
break;
|
||||||
|
@ -724,7 +724,6 @@ tdb_update_ownertrust (PKT_public_key *pk, unsigned int new_trust )
|
|||||||
write_record (&rec);
|
write_record (&rec);
|
||||||
tdb_revalidation_mark ();
|
tdb_revalidation_mark ();
|
||||||
do_sync ();
|
do_sync ();
|
||||||
err = 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -858,7 +857,6 @@ update_validity (PKT_public_key *pk, PKT_user_id *uid,
|
|||||||
/* No record yet - create a new one. */
|
/* No record yet - create a new one. */
|
||||||
size_t dummy;
|
size_t dummy;
|
||||||
|
|
||||||
err = 0;
|
|
||||||
memset (&trec, 0, sizeof trec);
|
memset (&trec, 0, sizeof trec);
|
||||||
trec.recnum = tdbio_new_recnum ();
|
trec.recnum = tdbio_new_recnum ();
|
||||||
trec.rectype = RECTYPE_TRUST;
|
trec.rectype = RECTYPE_TRUST;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user