mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
gpg: Avoid name spaces clash with future sqlite versions (2).
* g10/gpgsql.h (gpgsql_arg_type): Rename SQLITE_ARG_END to GPGSQL_ARG_END, SQLITE_ARG_INT to GPGSQL_ARG_INT, SQLITE_ARG_LONG_LONG to GPGSQL_ARG_LONG_LONG, SQLITE_ARG_STRING to GPGSQL_ARG_STRING, and SQLITE_ARG_BLOB to GPGSQL_ARG_BLOB. -- This commit completes the work started in b1ba460. Signed-off-by: Neal H. Walfield <neal@g10code.com>
This commit is contained in:
parent
76304a971f
commit
b8184d2d74
10
g10/gpgsql.c
10
g10/gpgsql.c
@ -131,25 +131,25 @@ gpgsql_stepx (sqlite3 *db,
|
|||||||
t = va_arg (va, enum gpgsql_arg_type);
|
t = va_arg (va, enum gpgsql_arg_type);
|
||||||
switch (t)
|
switch (t)
|
||||||
{
|
{
|
||||||
case SQLITE_ARG_INT:
|
case GPGSQL_ARG_INT:
|
||||||
{
|
{
|
||||||
int value = va_arg (va, int);
|
int value = va_arg (va, int);
|
||||||
err = sqlite3_bind_int (stmt, i, value);
|
err = sqlite3_bind_int (stmt, i, value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SQLITE_ARG_LONG_LONG:
|
case GPGSQL_ARG_LONG_LONG:
|
||||||
{
|
{
|
||||||
long long value = va_arg (va, long long);
|
long long value = va_arg (va, long long);
|
||||||
err = sqlite3_bind_int64 (stmt, i, value);
|
err = sqlite3_bind_int64 (stmt, i, value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SQLITE_ARG_STRING:
|
case GPGSQL_ARG_STRING:
|
||||||
{
|
{
|
||||||
char *text = va_arg (va, char *);
|
char *text = va_arg (va, char *);
|
||||||
err = sqlite3_bind_text (stmt, i, text, -1, SQLITE_STATIC);
|
err = sqlite3_bind_text (stmt, i, text, -1, SQLITE_STATIC);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SQLITE_ARG_BLOB:
|
case GPGSQL_ARG_BLOB:
|
||||||
{
|
{
|
||||||
char *blob = va_arg (va, void *);
|
char *blob = va_arg (va, void *);
|
||||||
long long length = va_arg (va, long long);
|
long long length = va_arg (va, long long);
|
||||||
@ -170,7 +170,7 @@ gpgsql_stepx (sqlite3 *db,
|
|||||||
|
|
||||||
}
|
}
|
||||||
t = va_arg (va, enum gpgsql_arg_type);
|
t = va_arg (va, enum gpgsql_arg_type);
|
||||||
log_assert (t == SQLITE_ARG_END);
|
log_assert (t == GPGSQL_ARG_END);
|
||||||
va_end (va);
|
va_end (va);
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
|
10
g10/gpgsql.h
10
g10/gpgsql.h
@ -24,13 +24,13 @@
|
|||||||
|
|
||||||
enum gpgsql_arg_type
|
enum gpgsql_arg_type
|
||||||
{
|
{
|
||||||
SQLITE_ARG_END = 0xdead001,
|
GPGSQL_ARG_END = 0xdead001,
|
||||||
SQLITE_ARG_INT,
|
GPGSQL_ARG_INT,
|
||||||
SQLITE_ARG_LONG_LONG,
|
GPGSQL_ARG_LONG_LONG,
|
||||||
SQLITE_ARG_STRING,
|
GPGSQL_ARG_STRING,
|
||||||
/* This takes two arguments: the blob as a void * and the length
|
/* This takes two arguments: the blob as a void * and the length
|
||||||
of the blob as a long long. */
|
of the blob as a long long. */
|
||||||
SQLITE_ARG_BLOB
|
GPGSQL_ARG_BLOB
|
||||||
};
|
};
|
||||||
|
|
||||||
int gpgsql_exec_printf (sqlite3 *db,
|
int gpgsql_exec_printf (sqlite3 *db,
|
||||||
|
46
g10/tofu.c
46
g10/tofu.c
@ -204,7 +204,7 @@ begin_transaction (ctrl_t ctrl, int only_batch)
|
|||||||
|
|
||||||
rc = gpgsql_stepx (dbs->db, &dbs->s.savepoint_batch,
|
rc = gpgsql_stepx (dbs->db, &dbs->s.savepoint_batch,
|
||||||
NULL, NULL, &err,
|
NULL, NULL, &err,
|
||||||
"savepoint batch;", SQLITE_ARG_END);
|
"savepoint batch;", GPGSQL_ARG_END);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_error (_("error beginning transaction on TOFU database: %s\n"),
|
log_error (_("error beginning transaction on TOFU database: %s\n"),
|
||||||
@ -269,7 +269,7 @@ end_transaction (ctrl_t ctrl, int only_batch)
|
|||||||
|
|
||||||
rc = gpgsql_stepx (dbs->db, &dbs->s.savepoint_batch_commit,
|
rc = gpgsql_stepx (dbs->db, &dbs->s.savepoint_batch_commit,
|
||||||
NULL, NULL, &err,
|
NULL, NULL, &err,
|
||||||
"release batch;", SQLITE_ARG_END);
|
"release batch;", GPGSQL_ARG_END);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_error (_("error committing transaction on TOFU database: %s\n"),
|
log_error (_("error committing transaction on TOFU database: %s\n"),
|
||||||
@ -790,8 +790,8 @@ record_binding (tofu_dbs_t dbs, const char *fingerprint, const char *email,
|
|||||||
(dbs->db, &dbs->s.record_binding_get_old_policy,
|
(dbs->db, &dbs->s.record_binding_get_old_policy,
|
||||||
get_single_long_cb2, &policy_old, &err,
|
get_single_long_cb2, &policy_old, &err,
|
||||||
"select policy from bindings where fingerprint = ? and email = ?",
|
"select policy from bindings where fingerprint = ? and email = ?",
|
||||||
SQLITE_ARG_STRING, fingerprint, SQLITE_ARG_STRING, email,
|
GPGSQL_ARG_STRING, fingerprint, GPGSQL_ARG_STRING, email,
|
||||||
SQLITE_ARG_END);
|
GPGSQL_ARG_END);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_debug ("TOFU: Error reading from binding database"
|
log_debug ("TOFU: Error reading from binding database"
|
||||||
@ -839,10 +839,10 @@ record_binding (tofu_dbs_t dbs, const char *fingerprint, const char *email,
|
|||||||
based on the fingerprint and email since they are unique. */
|
based on the fingerprint and email since they are unique. */
|
||||||
" (select oid from bindings where fingerprint = ? and email = ?),\n"
|
" (select oid from bindings where fingerprint = ? and email = ?),\n"
|
||||||
" ?, ?, ?, strftime('%s','now'), ?);",
|
" ?, ?, ?, strftime('%s','now'), ?);",
|
||||||
SQLITE_ARG_STRING, fingerprint, SQLITE_ARG_STRING, email,
|
GPGSQL_ARG_STRING, fingerprint, GPGSQL_ARG_STRING, email,
|
||||||
SQLITE_ARG_STRING, fingerprint, SQLITE_ARG_STRING, email,
|
GPGSQL_ARG_STRING, fingerprint, GPGSQL_ARG_STRING, email,
|
||||||
SQLITE_ARG_STRING, user_id, SQLITE_ARG_INT, (int) policy,
|
GPGSQL_ARG_STRING, user_id, GPGSQL_ARG_INT, (int) policy,
|
||||||
SQLITE_ARG_END);
|
GPGSQL_ARG_END);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_error (_("error updating TOFU database: %s\n"), err);
|
log_error (_("error updating TOFU database: %s\n"), err);
|
||||||
@ -1036,9 +1036,9 @@ get_policy (tofu_dbs_t dbs, const char *fingerprint, const char *email,
|
|||||||
strings_collect_cb2, &strlist, &err,
|
strings_collect_cb2, &strlist, &err,
|
||||||
"select policy, conflict from bindings\n"
|
"select policy, conflict from bindings\n"
|
||||||
" where fingerprint = ? and email = ?",
|
" where fingerprint = ? and email = ?",
|
||||||
SQLITE_ARG_STRING, fingerprint,
|
GPGSQL_ARG_STRING, fingerprint,
|
||||||
SQLITE_ARG_STRING, email,
|
GPGSQL_ARG_STRING, email,
|
||||||
SQLITE_ARG_END);
|
GPGSQL_ARG_END);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_error (_("error reading TOFU database: %s\n"), err);
|
log_error (_("error reading TOFU database: %s\n"), err);
|
||||||
@ -1228,7 +1228,7 @@ ask_about_binding (tofu_dbs_t dbs,
|
|||||||
(dbs->db, &dbs->s.get_trust_gather_other_user_ids,
|
(dbs->db, &dbs->s.get_trust_gather_other_user_ids,
|
||||||
strings_collect_cb2, &other_user_ids, &sqerr,
|
strings_collect_cb2, &other_user_ids, &sqerr,
|
||||||
"select user_id, policy from bindings where fingerprint = ?;",
|
"select user_id, policy from bindings where fingerprint = ?;",
|
||||||
SQLITE_ARG_STRING, fingerprint, SQLITE_ARG_END);
|
GPGSQL_ARG_STRING, fingerprint, GPGSQL_ARG_END);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_error (_("error gathering other user IDs: %s\n"), sqerr);
|
log_error (_("error gathering other user IDs: %s\n"), sqerr);
|
||||||
@ -1301,8 +1301,8 @@ ask_about_binding (tofu_dbs_t dbs,
|
|||||||
" group by fingerprint, time_ago\n"
|
" group by fingerprint, time_ago\n"
|
||||||
/* Make sure the current key is first. */
|
/* Make sure the current key is first. */
|
||||||
" order by fingerprint = ? asc, fingerprint desc, time_ago desc;\n",
|
" order by fingerprint = ? asc, fingerprint desc, time_ago desc;\n",
|
||||||
SQLITE_ARG_STRING, email, SQLITE_ARG_STRING, fingerprint,
|
GPGSQL_ARG_STRING, email, GPGSQL_ARG_STRING, fingerprint,
|
||||||
SQLITE_ARG_END);
|
GPGSQL_ARG_END);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
strlist_t strlist_iter;
|
strlist_t strlist_iter;
|
||||||
@ -1640,7 +1640,7 @@ get_trust (tofu_dbs_t dbs, PKT_public_key *pk,
|
|||||||
(dbs->db, &dbs->s.get_trust_bindings_with_this_email,
|
(dbs->db, &dbs->s.get_trust_bindings_with_this_email,
|
||||||
strings_collect_cb2, &bindings_with_this_email, &sqerr,
|
strings_collect_cb2, &bindings_with_this_email, &sqerr,
|
||||||
"select distinct fingerprint from bindings where email = ?;",
|
"select distinct fingerprint from bindings where email = ?;",
|
||||||
SQLITE_ARG_STRING, email, SQLITE_ARG_END);
|
GPGSQL_ARG_STRING, email, GPGSQL_ARG_END);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_error (_("error reading TOFU database: %s\n"), sqerr);
|
log_error (_("error reading TOFU database: %s\n"), sqerr);
|
||||||
@ -2269,10 +2269,10 @@ tofu_register (ctrl_t ctrl, PKT_public_key *pk, strlist_t user_id_list,
|
|||||||
" on signatures.binding = bindings.oid\n"
|
" on signatures.binding = bindings.oid\n"
|
||||||
" where fingerprint = ? and email = ? and sig_time = ?\n"
|
" where fingerprint = ? and email = ? and sig_time = ?\n"
|
||||||
" and sig_digest = ?",
|
" and sig_digest = ?",
|
||||||
SQLITE_ARG_STRING, fingerprint, SQLITE_ARG_STRING, email,
|
GPGSQL_ARG_STRING, fingerprint, GPGSQL_ARG_STRING, email,
|
||||||
SQLITE_ARG_LONG_LONG, (long long) sig_time,
|
GPGSQL_ARG_LONG_LONG, (long long) sig_time,
|
||||||
SQLITE_ARG_STRING, sig_digest,
|
GPGSQL_ARG_STRING, sig_digest,
|
||||||
SQLITE_ARG_END);
|
GPGSQL_ARG_END);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_error (_("error reading TOFU database: %s\n"), err);
|
log_error (_("error reading TOFU database: %s\n"), err);
|
||||||
@ -2321,10 +2321,10 @@ tofu_register (ctrl_t ctrl, PKT_public_key *pk, strlist_t user_id_list,
|
|||||||
" ((select oid from bindings\n"
|
" ((select oid from bindings\n"
|
||||||
" where fingerprint = ? and email = ?),\n"
|
" where fingerprint = ? and email = ?),\n"
|
||||||
" ?, ?, ?, strftime('%s', 'now'));",
|
" ?, ?, ?, strftime('%s', 'now'));",
|
||||||
SQLITE_ARG_STRING, fingerprint, SQLITE_ARG_STRING, email,
|
GPGSQL_ARG_STRING, fingerprint, GPGSQL_ARG_STRING, email,
|
||||||
SQLITE_ARG_STRING, sig_digest, SQLITE_ARG_STRING, origin,
|
GPGSQL_ARG_STRING, sig_digest, GPGSQL_ARG_STRING, origin,
|
||||||
SQLITE_ARG_LONG_LONG, (long long) sig_time,
|
GPGSQL_ARG_LONG_LONG, (long long) sig_time,
|
||||||
SQLITE_ARG_END);
|
GPGSQL_ARG_END);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
log_error (_("error updating TOFU database: %s\n"), err);
|
log_error (_("error updating TOFU database: %s\n"), err);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user