mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpg: Replace -1 by GPG_ERR_NOT_FOUND in tdbio.c
* g10/tdbio.c (lookup_hashtable): Return GPG_ERR_NOT_FOUND. * g10/tdbdump.c (import_ownertrust): Test for GPG_ERR_NOT_FOUND. * g10/trustdb.c (read_trust_record): Ditto. (tdb_get_ownertrust, tdb_get_min_ownertrust): Ditto. (tdb_update_ownertrust, update_min_ownertrust): Ditto. (tdb_clear_ownertrusts, update_validity): Ditto. (tdb_cache_disabled_value): Ditto. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
f170240ef7
commit
a4a15195c2
4 changed files with 71 additions and 66 deletions
21
g10/tdbio.c
21
g10/tdbio.c
|
@ -1245,10 +1245,9 @@ drop_from_hashtable (ulong table, byte *key, int keylen, ulong recnum)
|
|||
* the result in REC. The return value of CMP() should be True if the
|
||||
* record is the desired one.
|
||||
*
|
||||
* Return: -1 if not found, 0 if found or another error code.
|
||||
* FIXME: Use GPG_ERR_NOT_FOUND instead of -1.
|
||||
* Return: 0 if found, GPG_ERR_NOT_FOUND, or another error code.
|
||||
*/
|
||||
static int
|
||||
static gpg_error_t
|
||||
lookup_hashtable (ulong table, const byte *key, size_t keylen,
|
||||
int (*cmpfnc)(const void*, const TRUSTREC *),
|
||||
const void *cmpdata, TRUSTREC *rec )
|
||||
|
@ -1271,7 +1270,7 @@ lookup_hashtable (ulong table, const byte *key, size_t keylen,
|
|||
|
||||
item = rec->r.htbl.item[msb % ITEMS_PER_HTBL_RECORD];
|
||||
if (!item)
|
||||
return -1; /* Not found. */
|
||||
return gpg_error (GPG_ERR_NOT_FOUND);
|
||||
|
||||
rc = tdbio_read_record (item, rec, 0);
|
||||
if (rc)
|
||||
|
@ -1327,14 +1326,14 @@ lookup_hashtable (ulong table, const byte *key, size_t keylen,
|
|||
}
|
||||
}
|
||||
else
|
||||
return -1; /* not found */
|
||||
return gpg_error (GPG_ERR_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
if ((*cmpfnc)(cmpdata, rec))
|
||||
return 0; /* really found */
|
||||
|
||||
return -1; /* no: not found */
|
||||
return gpg_error (GPG_ERR_NOT_FOUND); /* no: not found */
|
||||
}
|
||||
|
||||
|
||||
|
@ -1805,10 +1804,9 @@ cmp_trec_fpr ( const void *fpr, const TRUSTREC *rec )
|
|||
* Given a 20 byte FINGERPRINT search its trust record and return
|
||||
* that at REC.
|
||||
*
|
||||
* Return: -1 if not found, 0 if found or another error code.
|
||||
* FIXME: Use GPG_ERR_NOT_FOUND instead of -1.
|
||||
* Return: 0 if found, GPG_ERR_NOT_FOUND, or another error code.
|
||||
*/
|
||||
int
|
||||
gpg_error_t
|
||||
tdbio_search_trust_byfpr (const byte *fingerprint, TRUSTREC *rec)
|
||||
{
|
||||
int rc;
|
||||
|
@ -1824,10 +1822,9 @@ tdbio_search_trust_byfpr (const byte *fingerprint, TRUSTREC *rec)
|
|||
* Given a primary public key object PK search its trust record and
|
||||
* return that at REC.
|
||||
*
|
||||
* Return: -1 if not found, 0 if found or another error code.
|
||||
* FIXME: Use GPG_ERR_NOT_FOUND instead of -1.
|
||||
* Return: 0 if found, GPG_ERR_NOT_FOUND, or another error code.
|
||||
*/
|
||||
int
|
||||
gpg_error_t
|
||||
tdbio_search_trust_bypk (PKT_public_key *pk, TRUSTREC *rec)
|
||||
{
|
||||
byte fingerprint[MAX_FINGERPRINT_LEN];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue