merged in parent, replaced with new Sqlite3 step

ENGINE-641
commit 19dd073f5b

@ -20,7 +20,7 @@ DYNAMIC_API PEP_STATUS blacklist_add(PEP_SESSION session, const char *fpr)
int result;
result = sqlite3_step(session->blacklist_add);
result = Sqlite3_step(session->blacklist_add);
switch (result) {
case SQLITE_DONE:
status = PEP_STATUS_OK;
@ -50,7 +50,7 @@ DYNAMIC_API PEP_STATUS blacklist_delete(PEP_SESSION session, const char *fpr)
int result;
result = sqlite3_step(session->blacklist_delete);
result = Sqlite3_step(session->blacklist_delete);
switch (result) {
case SQLITE_DONE:
status = PEP_STATUS_OK;
@ -85,7 +85,7 @@ DYNAMIC_API PEP_STATUS blacklist_is_listed(
int result;
result = sqlite3_step(session->blacklist_is_listed);
result = Sqlite3_step(session->blacklist_is_listed);
switch (result) {
case SQLITE_ROW:
count = sqlite3_column_int(session->blacklist_is_listed, 0);
@ -125,7 +125,7 @@ DYNAMIC_API PEP_STATUS blacklist_retrieve(
stringlist_t *_bl = _blacklist;
do {
result = sqlite3_step(session->blacklist_retrieve);
result = Sqlite3_step(session->blacklist_retrieve);
switch (result) {
case SQLITE_ROW:
{

@ -39,7 +39,7 @@ PEP_STATUS has_key_reset_been_sent(
SQLITE_STATIC);
sqlite3_bind_text(session->was_id_for_revoke_contacted, 2, user_id, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->was_id_for_revoke_contacted);
int result = Sqlite3_step(session->was_id_for_revoke_contacted);
switch (result) {
case SQLITE_ROW: {
*contacted = (sqlite3_column_int(session->was_id_for_revoke_contacted, 0) != 0);
@ -79,7 +79,7 @@ PEP_STATUS set_reset_contact_notified(
int result;
result = sqlite3_step(session->set_revoke_contact_as_notified);
result = Sqlite3_step(session->set_revoke_contact_as_notified);
switch (result) {
case SQLITE_DONE:
status = PEP_STATUS_OK;

@ -282,7 +282,7 @@ PEP_STATUS get_all_keys_for_user(PEP_SESSION session,
int result = -1;
while ((result = sqlite3_step(session->get_all_keys_for_user)) == SQLITE_ROW) {
while ((result = Sqlite3_step(session->get_all_keys_for_user)) == SQLITE_ROW) {
const char* keyres = (const char *) sqlite3_column_text(session->get_all_keys_for_user, 0);
if (keyres) {
if (_kl)
@ -317,7 +317,7 @@ PEP_STATUS get_user_default_key(PEP_SESSION session, const char* user_id,
sqlite3_bind_text(session->get_user_default_key, 1, user_id,
-1, SQLITE_STATIC);
const int result = sqlite3_step(session->get_user_default_key);
const int result = Sqlite3_step(session->get_user_default_key);
char* user_fpr = NULL;
if (result == SQLITE_ROW) {
const char* u_fpr =
@ -1627,7 +1627,7 @@ DYNAMIC_API PEP_STATUS own_key_is_listed(
int result;
result = sqlite3_step(session->own_key_is_listed);
result = Sqlite3_step(session->own_key_is_listed);
switch (result) {
case SQLITE_ROW:
count = sqlite3_column_int(session->own_key_is_listed, 0);
@ -1677,7 +1677,7 @@ PEP_STATUS _own_identities_retrieve(
sqlite3_bind_int(session->own_identities_retrieve, 1, excluded_flags);
do {
result = sqlite3_step(session->own_identities_retrieve);
result = Sqlite3_step(session->own_identities_retrieve);
switch (result) {
case SQLITE_ROW:
address = (const char *)
@ -1771,7 +1771,7 @@ PEP_STATUS _own_keys_retrieve(
sqlite3_bind_int(session->own_keys_retrieve, 1, excluded_flags);
do {
result = sqlite3_step(session->own_keys_retrieve);
result = Sqlite3_step(session->own_keys_retrieve);
switch (result) {
case SQLITE_ROW:
_bl = stringlist_add(_bl, (const char *)
@ -1912,7 +1912,7 @@ PEP_STATUS add_mistrusted_key(PEP_SESSION session, const char* fpr)
sqlite3_bind_text(session->add_mistrusted_key, 1, fpr, -1,
SQLITE_STATIC);
result = sqlite3_step(session->add_mistrusted_key);
result = Sqlite3_step(session->add_mistrusted_key);
sqlite3_reset(session->add_mistrusted_key);
if (result != SQLITE_DONE)
@ -1934,7 +1934,7 @@ PEP_STATUS delete_mistrusted_key(PEP_SESSION session, const char* fpr)
sqlite3_bind_text(session->delete_mistrusted_key, 1, fpr, -1,
SQLITE_STATIC);
result = sqlite3_step(session->delete_mistrusted_key);
result = Sqlite3_step(session->delete_mistrusted_key);
sqlite3_reset(session->delete_mistrusted_key);
if (result != SQLITE_DONE)
@ -1961,7 +1961,7 @@ PEP_STATUS is_mistrusted_key(PEP_SESSION session, const char* fpr,
int result;
result = sqlite3_step(session->is_mistrusted_key);
result = Sqlite3_step(session->is_mistrusted_key);
switch (result) {
case SQLITE_ROW:
*mistrusted = sqlite3_column_int(session->is_mistrusted_key, 0);

@ -560,7 +560,7 @@ static int db_contains_table(PEP_SESSION session, const char* table_name) {
int retval = 0;
int rc = sqlite3_step(stmt);
int rc = Sqlite3_step(stmt);
if (rc == SQLITE_DONE || rc == SQLITE_OK || rc == SQLITE_ROW) {
retval = 1;
}
@ -611,7 +611,7 @@ static int table_contains_column(PEP_SESSION session, const char* table_name,
int retval = 0;
int rc = sqlite3_step(stmt);
int rc = Sqlite3_step(stmt);
if (rc == SQLITE_DONE || rc == SQLITE_OK || rc == SQLITE_ROW) {
retval = 1;
}
@ -634,7 +634,7 @@ PEP_STATUS repair_altered_tables(PEP_SESSION session) {
sqlite3_prepare_v2(session->db, sql_query, -1, &stmt, NULL);
int i = 0;
int int_result = 0;
while ((int_result = sqlite3_step(stmt)) == SQLITE_ROW && i < _PEP_MAX_AFFECTED) {
while ((int_result = Sqlite3_step(stmt)) == SQLITE_ROW && i < _PEP_MAX_AFFECTED) {
table_names[i++] = strdup((const char*)(sqlite3_column_text(stmt, 0)));
}
@ -2151,7 +2151,7 @@ DYNAMIC_API PEP_STATUS log_event(
// sqlite3_bind_text(session->log, 4, comment, -1, SQLITE_STATIC);
// else
// sqlite3_bind_null(session->log, 4);
// result = sqlite3_step(session->log);
// result = Sqlite3_step(session->log);
// sqlite3_reset(session->log);
//
return PEP_STATUS_OK; // We ignore errors for this function.
@ -2205,7 +2205,7 @@ DYNAMIC_API PEP_STATUS trustword(
sqlite3_bind_text(session->trustword, 1, lang, -1, SQLITE_STATIC);
sqlite3_bind_int(session->trustword, 2, value);
const int result = sqlite3_step(session->trustword);
const int result = Sqlite3_step(session->trustword);
if (result == SQLITE_ROW) {
*word = strdup((const char *) sqlite3_column_text(session->trustword,
1));
@ -2400,7 +2400,7 @@ DYNAMIC_API PEP_STATUS get_default_own_userid(
sqlite3_reset(session->get_default_own_userid);
const int result = sqlite3_step(session->get_default_own_userid);
const int result = Sqlite3_step(session->get_default_own_userid);
const char* id;
switch (result) {
@ -2449,7 +2449,7 @@ DYNAMIC_API PEP_STATUS get_userid_alias_default(
const char* tempid;
const int result = sqlite3_step(session->get_userid_alias_default);
const int result = Sqlite3_step(session->get_userid_alias_default);
switch (result) {
case SQLITE_ROW:
tempid = (const char *) sqlite3_column_text(session->get_userid_alias_default, 0);
@ -2494,7 +2494,7 @@ DYNAMIC_API PEP_STATUS set_userid_alias (
sqlite3_bind_text(session->add_userid_alias, 2, alias_id, -1,
SQLITE_STATIC);
result = sqlite3_step(session->add_userid_alias);
result = Sqlite3_step(session->add_userid_alias);
sqlite3_reset(session->add_userid_alias);
if (result != SQLITE_DONE) {
@ -2531,7 +2531,7 @@ DYNAMIC_API PEP_STATUS get_identity(
sqlite3_bind_text(session->get_identity, 1, address, -1, SQLITE_STATIC);
sqlite3_bind_text(session->get_identity, 2, user_id, -1, SQLITE_STATIC);
const int result = sqlite3_step(session->get_identity);
const int result = Sqlite3_step(session->get_identity);
switch (result) {
case SQLITE_ROW:
_identity = new_identity(
@ -2598,7 +2598,7 @@ PEP_STATUS get_identities_by_userid(
sqlite3_bind_text(session->get_identities_by_userid, 1, user_id, -1, SQLITE_STATIC);
int result = -1;
while ((result = sqlite3_step(session->get_identities_by_userid)) == SQLITE_ROW) {
while ((result = Sqlite3_step(session->get_identities_by_userid)) == SQLITE_ROW) {
// "select address, fpr, username, comm_type, lang,"
// " identity.flags | pgp_keypair.flags,"
// " is_own"
@ -2680,7 +2680,7 @@ PEP_STATUS get_identities_by_main_key_id(
int result = -1;
while ((result = sqlite3_step(session->get_identities_by_main_key_id)) == SQLITE_ROW) {
while ((result = Sqlite3_step(session->get_identities_by_main_key_id)) == SQLITE_ROW) {
ident = new_identity(
(const char *) sqlite3_column_text(session->get_identities_by_main_key_id, 0),
fpr,
@ -2754,7 +2754,7 @@ PEP_STATUS get_identity_without_trust_check(
sqlite3_bind_text(session->get_identity_without_trust_check, 1, address, -1, SQLITE_STATIC);
sqlite3_bind_text(session->get_identity_without_trust_check, 2, user_id, -1, SQLITE_STATIC);
const int result = sqlite3_step(session->get_identity_without_trust_check);
const int result = Sqlite3_step(session->get_identity_without_trust_check);
switch (result) {
case SQLITE_ROW:
_identity = new_identity(
@ -2822,7 +2822,7 @@ PEP_STATUS get_identities_by_address(
sqlite3_bind_text(session->get_identities_by_address, 1, address, -1, SQLITE_STATIC);
int result;
while ((result = sqlite3_step(session->get_identities_by_address)) == SQLITE_ROW) {
while ((result = Sqlite3_step(session->get_identities_by_address)) == SQLITE_ROW) {
//"select user_id, main_key_id, username, comm_type, lang,"
//" identity.flags, is_own"
pEp_identity *ident = new_identity(
@ -2893,7 +2893,7 @@ PEP_STATUS exists_identity_entry(PEP_SESSION session, pEp_identity* identity,
sqlite3_bind_text(session->exists_identity_entry, 2, identity->user_id, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->exists_identity_entry);
int result = Sqlite3_step(session->exists_identity_entry);
switch (result) {
case SQLITE_ROW: {
@ -2928,7 +2928,7 @@ PEP_STATUS exists_trust_entry(PEP_SESSION session, pEp_identity* identity,
sqlite3_bind_text(session->exists_trust_entry, 2, identity->fpr, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->exists_trust_entry);
int result = Sqlite3_step(session->exists_trust_entry);
switch (result) {
case SQLITE_ROW: {
// yeah yeah, I know, we could be lazy here, but it looks bad.
@ -2952,7 +2952,7 @@ PEP_STATUS set_pgp_keypair(PEP_SESSION session, const char* fpr) {
sqlite3_reset(session->set_pgp_keypair);
sqlite3_bind_text(session->set_pgp_keypair, 1, fpr, -1,
SQLITE_STATIC);
result = sqlite3_step(session->set_pgp_keypair);
result = Sqlite3_step(session->set_pgp_keypair);
sqlite3_reset(session->set_pgp_keypair);
if (result != SQLITE_DONE) {
return PEP_CANNOT_SET_PGP_KEYPAIR;
@ -2985,7 +2985,7 @@ static PEP_STATUS _set_or_update_trust(PEP_SESSION session,
sqlite3_bind_text(set_or_update, 2, identity->fpr, -1,
SQLITE_STATIC);
sqlite3_bind_int(set_or_update, 3, identity->comm_type);
result = sqlite3_step(set_or_update);
result = Sqlite3_step(set_or_update);
assert(result == SQLITE_DONE);
sqlite3_reset(set_or_update);
if (result != SQLITE_DONE)
@ -3016,7 +3016,7 @@ static PEP_STATUS _set_or_update_identity_entry(PEP_SESSION session,
sqlite3_bind_int(set_or_update, 6, identity->major_ver);
sqlite3_bind_int(set_or_update, 7, identity->minor_ver);
int result = sqlite3_step(set_or_update);
int result = Sqlite3_step(set_or_update);
sqlite3_reset(set_or_update);
if (result != SQLITE_DONE)
return PEP_CANNOT_SET_IDENTITY;
@ -3046,7 +3046,7 @@ static PEP_STATUS _set_or_update_person(PEP_SESSION session,
sqlite3_bind_null(set_or_update, 3);
sqlite3_bind_text(set_or_update, 4, identity->fpr, -1,
SQLITE_STATIC);
int result = sqlite3_step(set_or_update);
int result = Sqlite3_step(set_or_update);
sqlite3_reset(set_or_update);
if (result != SQLITE_DONE)
@ -3162,7 +3162,7 @@ DYNAMIC_API PEP_STATUS set_identity(
sqlite3_reset(session->set_pgp_keypair);
sqlite3_bind_text(session->set_pgp_keypair, 1, identity->fpr, -1,
SQLITE_STATIC);
result = sqlite3_step(session->set_pgp_keypair);
result = Sqlite3_step(session->set_pgp_keypair);
sqlite3_reset(session->set_pgp_keypair);
if (result != SQLITE_DONE) {
sqlite3_exec(session->db, "ROLLBACK ;", NULL, NULL, NULL);
@ -3215,7 +3215,7 @@ PEP_STATUS update_pEp_user_trust_vals(PEP_SESSION session,
sqlite3_reset(session->update_trust_to_pEp);
sqlite3_bind_text(session->update_trust_to_pEp, 1, user->user_id, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->update_trust_to_pEp);
int result = Sqlite3_step(session->update_trust_to_pEp);
sqlite3_reset(session->update_trust_to_pEp);
if (result != SQLITE_DONE)
return PEP_CANNOT_SET_TRUST;
@ -3252,7 +3252,7 @@ DYNAMIC_API PEP_STATUS set_as_pEp_user(PEP_SESSION session, pEp_identity* user)
sqlite3_reset(session->set_as_pEp_user);
sqlite3_bind_text(session->set_as_pEp_user, 1, user->user_id, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->set_as_pEp_user);
int result = Sqlite3_step(session->set_as_pEp_user);
sqlite3_reset(session->set_as_pEp_user);
if (result != SQLITE_DONE)
@ -3277,7 +3277,7 @@ PEP_STATUS set_pEp_version(PEP_SESSION session, pEp_identity* ident, unsigned in
sqlite3_bind_text(session->set_pEp_version, 4, ident->user_id, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->set_pEp_version);
int result = Sqlite3_step(session->set_pEp_version);
sqlite3_reset(session->set_pEp_version);
if (result != SQLITE_DONE)
@ -3302,7 +3302,7 @@ PEP_STATUS upgrade_pEp_version_by_user_id(PEP_SESSION session,
sqlite3_bind_text(session->upgrade_pEp_version_by_user_id, 3, ident->user_id, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->upgrade_pEp_version_by_user_id);
int result = Sqlite3_step(session->upgrade_pEp_version_by_user_id);
sqlite3_reset(session->upgrade_pEp_version_by_user_id);
if (result != SQLITE_DONE)
@ -3335,7 +3335,7 @@ PEP_STATUS exists_person(PEP_SESSION session, pEp_identity* identity,
sqlite3_reset(session->exists_person);
sqlite3_bind_text(session->exists_person, 1, user_id, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->exists_person);
int result = Sqlite3_step(session->exists_person);
switch (result) {
case SQLITE_ROW: {
// yeah yeah, I know, we could be lazy here, but it looks bad.
@ -3373,7 +3373,7 @@ PEP_STATUS delete_person(PEP_SESSION session, const char* user_id) {
sqlite3_bind_text(session->delete_person, 1, user_id, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->delete_person);
int result = Sqlite3_step(session->delete_person);
if (result != SQLITE_DONE)
status = PEP_UNKNOWN_ERROR;
@ -3408,7 +3408,7 @@ DYNAMIC_API PEP_STATUS is_pEp_user(PEP_SESSION session, pEp_identity *identity,
sqlite3_reset(session->is_pEp_user);
sqlite3_bind_text(session->is_pEp_user, 1, user_id, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->is_pEp_user);
int result = Sqlite3_step(session->is_pEp_user);
switch (result) {
case SQLITE_ROW: {
// yeah yeah, I know, we could be lazy here, but it looks bad.
@ -3444,7 +3444,7 @@ PEP_STATUS is_own_address(PEP_SESSION session, const char* address, bool* is_own
sqlite3_reset(session->is_own_address);
sqlite3_bind_text(session->is_own_address, 1, address, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->is_own_address);
int result = Sqlite3_step(session->is_own_address);
switch (result) {
case SQLITE_ROW: {
// yeah yeah, I know, we could be lazy here, but it looks bad.
@ -3476,7 +3476,7 @@ PEP_STATUS bind_own_ident_with_contact_ident(PEP_SESSION session,
sqlite3_bind_text(session->add_into_social_graph, 3, contact_ident->user_id, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->add_into_social_graph);
int result = Sqlite3_step(session->add_into_social_graph);
sqlite3_reset(session->add_into_social_graph);
if (result != SQLITE_DONE)
@ -3505,7 +3505,7 @@ PEP_STATUS get_own_ident_for_contact_id(PEP_SESSION session,
sqlite3_bind_text(session->get_own_address_binding_from_contact, 2, contact->user_id, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->get_own_address_binding_from_contact);
int result = Sqlite3_step(session->get_own_address_binding_from_contact);
const char* own_address = NULL;
@ -3541,7 +3541,7 @@ PEP_STATUS remove_fpr_as_default(PEP_SESSION session,
sqlite3_bind_text(session->remove_fpr_as_default, 1, fpr, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->remove_fpr_as_default);
int result = Sqlite3_step(session->remove_fpr_as_default);
sqlite3_reset(session->remove_fpr_as_default);
if (result != SQLITE_DONE)
@ -3567,7 +3567,7 @@ PEP_STATUS replace_identities_fpr(PEP_SESSION session,
sqlite3_bind_text(session->replace_identities_fpr, 2, old_fpr, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->replace_identities_fpr);
int result = Sqlite3_step(session->replace_identities_fpr);
sqlite3_reset(session->replace_identities_fpr);
if (result != SQLITE_DONE)
@ -3587,7 +3587,7 @@ PEP_STATUS update_trust_for_fpr(PEP_SESSION session,
sqlite3_bind_int(session->update_trust_for_fpr, 1, comm_type);
sqlite3_bind_text(session->update_trust_for_fpr, 2, fpr, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->update_trust_for_fpr);
int result = Sqlite3_step(session->update_trust_for_fpr);
sqlite3_reset(session->update_trust_for_fpr);
if (result != SQLITE_DONE) {
return PEP_CANNOT_SET_TRUST;
@ -3619,7 +3619,7 @@ DYNAMIC_API PEP_STATUS set_identity_flags(
sqlite3_bind_text(session->set_identity_flags, 3, identity->user_id, -1,
SQLITE_STATIC);
result = sqlite3_step(session->set_identity_flags);
result = Sqlite3_step(session->set_identity_flags);
sqlite3_reset(session->set_identity_flags);
if (result != SQLITE_DONE)
@ -3651,7 +3651,7 @@ DYNAMIC_API PEP_STATUS unset_identity_flags(
SQLITE_STATIC);
sqlite3_bind_text(session->unset_identity_flags, 3, identity->user_id, -1,
SQLITE_STATIC);
result = sqlite3_step(session->unset_identity_flags);
result = Sqlite3_step(session->unset_identity_flags);
sqlite3_reset(session->unset_identity_flags);
if (result != SQLITE_DONE)
return PEP_CANNOT_SET_IDENTITY;
@ -3675,7 +3675,7 @@ PEP_STATUS get_trust_by_userid(PEP_SESSION session, const char* user_id,
sqlite3_reset(session->get_trust_by_userid);
sqlite3_bind_text(session->get_trust_by_userid, 1, user_id, -1, SQLITE_STATIC);
while ((result = sqlite3_step(session->get_trust_by_userid)) == SQLITE_ROW) {
while ((result = Sqlite3_step(session->get_trust_by_userid)) == SQLITE_ROW) {
if (!t_list)
t_list = new_labeled_int_list(sqlite3_column_int(session->get_trust_by_userid, 1),
(const char *) sqlite3_column_text(session->get_trust_by_userid, 0));
@ -4006,7 +4006,7 @@ PEP_STATUS replace_userid(PEP_SESSION session, const char* old_uid,
SQLITE_STATIC);
sqlite3_bind_text(session->replace_userid, 2, old_uid, -1,
SQLITE_STATIC);
result = sqlite3_step(session->replace_userid);
result = Sqlite3_step(session->replace_userid);
#ifndef NDEBUG
if (result) {
const char *errmsg = sqlite3_errmsg(session->db);
@ -4032,7 +4032,7 @@ PEP_STATUS remove_key(PEP_SESSION session, const char* fpr) {
sqlite3_reset(session->delete_key);
sqlite3_bind_text(session->delete_key, 1, fpr, -1,
SQLITE_STATIC);
result = sqlite3_step(session->delete_key);
result = Sqlite3_step(session->delete_key);
sqlite3_reset(session->delete_key);
if (result != SQLITE_DONE)
return PEP_CANNOT_SET_PGP_KEYPAIR;
@ -4053,7 +4053,7 @@ PEP_STATUS refresh_userid_default_key(PEP_SESSION session, const char* user_id)
sqlite3_reset(session->refresh_userid_default_key);
sqlite3_bind_text(session->refresh_userid_default_key, 1, user_id, -1,
SQLITE_STATIC);
result = sqlite3_step(session->refresh_userid_default_key);
result = Sqlite3_step(session->refresh_userid_default_key);
sqlite3_reset(session->refresh_userid_default_key);
if (result != SQLITE_DONE)
return PEP_CANNOT_SET_PERSON;
@ -4077,7 +4077,7 @@ PEP_STATUS replace_main_user_fpr(PEP_SESSION session, const char* user_id,
SQLITE_STATIC);
sqlite3_bind_text(session->replace_main_user_fpr, 2, user_id, -1,
SQLITE_STATIC);
result = sqlite3_step(session->replace_main_user_fpr);
result = Sqlite3_step(session->replace_main_user_fpr);
sqlite3_reset(session->replace_main_user_fpr);
if (result != SQLITE_DONE)
return PEP_CANNOT_SET_PERSON;
@ -4104,7 +4104,7 @@ PEP_STATUS get_main_user_fpr(PEP_SESSION session,
sqlite3_reset(session->get_main_user_fpr);
sqlite3_bind_text(session->get_main_user_fpr, 1, user_id, -1,
SQLITE_STATIC);
result = sqlite3_step(session->get_main_user_fpr);
result = Sqlite3_step(session->get_main_user_fpr);
switch (result) {
case SQLITE_ROW: {
const char* _fpr =
@ -4152,7 +4152,7 @@ DYNAMIC_API PEP_STATUS mark_as_compromised(
sqlite3_reset(session->mark_compromised);
sqlite3_bind_text(session->mark_compromised, 1, fpr, -1,
SQLITE_STATIC);
result = sqlite3_step(session->mark_compromised);
result = Sqlite3_step(session->mark_compromised);
sqlite3_reset(session->mark_compromised);
if (result != SQLITE_DONE)
@ -4192,7 +4192,7 @@ DYNAMIC_API PEP_STATUS get_trust(PEP_SESSION session, pEp_identity *identity)
SQLITE_STATIC);
sqlite3_bind_text(session->get_trust, 2, identity->fpr, -1, SQLITE_STATIC);
result = sqlite3_step(session->get_trust);
result = Sqlite3_step(session->get_trust);
switch (result) {
case SQLITE_ROW: {
int comm_type = (PEP_comm_type) sqlite3_column_int(session->get_trust,
@ -4231,7 +4231,7 @@ DYNAMIC_API PEP_STATUS least_trust(
sqlite3_reset(session->least_trust);
sqlite3_bind_text(session->least_trust, 1, fpr, -1, SQLITE_STATIC);
result = sqlite3_step(session->least_trust);
result = Sqlite3_step(session->least_trust);
switch (result) {
case SQLITE_ROW: {
int _comm_type = sqlite3_column_int(session->least_trust, 0);
@ -4662,7 +4662,7 @@ DYNAMIC_API PEP_STATUS get_crashdump_log(
int result;
do {
result = sqlite3_step(session->crashdump);
result = Sqlite3_step(session->crashdump);
switch (result) {
case SQLITE_ROW:
timestamp = (const char *) sqlite3_column_text(session->crashdump,
@ -4754,7 +4754,7 @@ DYNAMIC_API PEP_STATUS get_languagelist(
int result;
do {
result = sqlite3_step(session->languagelist);
result = Sqlite3_step(session->languagelist);
switch (result) {
case SQLITE_ROW:
lang = (const char *) sqlite3_column_text(session->languagelist,
@ -4822,7 +4822,7 @@ DYNAMIC_API PEP_STATUS get_phrase(
const char *_phrase = NULL;
int result;
result = sqlite3_step(session->i18n_token);
result = Sqlite3_step(session->i18n_token);
switch (result) {
case SQLITE_ROW:
_phrase = (const char *) sqlite3_column_text(session->i18n_token, 0);
@ -4864,7 +4864,7 @@ static PEP_STATUS _get_sequence_value(PEP_SESSION session, const char *name,
sqlite3_reset(session->sequence_value2);
sqlite3_bind_text(session->sequence_value2, 1, name, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->sequence_value2);
int result = Sqlite3_step(session->sequence_value2);
switch (result) {
case SQLITE_ROW: {
int32_t _value = (int32_t)
@ -4892,7 +4892,7 @@ static PEP_STATUS _increment_sequence_value(PEP_SESSION session,
sqlite3_reset(session->sequence_value1);
sqlite3_bind_text(session->sequence_value1, 1, name, -1, SQLITE_STATIC);
int result = sqlite3_step(session->sequence_value1);
int result = Sqlite3_step(session->sequence_value1);
assert(result == SQLITE_DONE);
sqlite3_reset(session->sequence_value1);
if (result == SQLITE_DONE)
@ -4953,7 +4953,7 @@ PEP_STATUS is_own_key(PEP_SESSION session, const char* fpr, bool* own_key) {
sqlite3_bind_text(session->own_key_is_listed, 1, fpr, -1,
SQLITE_STATIC);
int result = sqlite3_step(session->own_key_is_listed);
int result = Sqlite3_step(session->own_key_is_listed);
switch (result) {
case SQLITE_ROW: {
*own_key = (sqlite3_column_int(session->own_key_is_listed, 0) != 0);
@ -4997,7 +4997,7 @@ DYNAMIC_API PEP_STATUS set_revoked(
int result;
result = sqlite3_step(session->set_revoked);
result = Sqlite3_step(session->set_revoked);
switch (result) {
case SQLITE_DONE:
status = PEP_STATUS_OK;
@ -5039,7 +5039,7 @@ DYNAMIC_API PEP_STATUS get_revoked(
int result;
result = sqlite3_step(session->get_revoked);
result = Sqlite3_step(session->get_revoked);
switch (result) {
case SQLITE_ROW: {
*revoked_fpr = strdup((const char *)
@ -5083,7 +5083,7 @@ DYNAMIC_API PEP_STATUS get_replacement_fpr(
int result;
result = sqlite3_step(session->get_replacement_fpr);
result = Sqlite3_step(session->get_replacement_fpr);
switch (result) {
case SQLITE_ROW: {
*revoked_fpr = strdup((const char *)
@ -5122,7 +5122,7 @@ PEP_STATUS get_last_contacted(
sqlite3_reset(session->get_last_contacted);
int result;
while ((result = sqlite3_step(session->get_last_contacted)) == SQLITE_ROW) {
while ((result = Sqlite3_step(session->get_last_contacted)) == SQLITE_ROW) {
pEp_identity *ident = new_identity(
(const char *) sqlite3_column_text(session->get_last_contacted, 1),
NULL,

@ -545,3 +545,15 @@ static inline void _init_globals() {
_pEp_rand_max_bits = (int) ceil(log2((double) RAND_MAX));
_pEp_log2_36 = log2(36);
}
// spinlock implementation
static inline int Sqlite3_step(sqlite3_stmt* stmt)
{
int rc;
do {
rc = sqlite3_step(stmt);
} while (rc == SQLITE_BUSY || rc == SQLITE_LOCKED);
return rc;
}

@ -446,7 +446,7 @@ static PEP_STATUS key_load(PEP_SESSION session, sqlite3_stmt *stmt,
pgp_tpk_t *tpkp, int *secretp)
{
PEP_STATUS status = PEP_STATUS_OK;
int sqlite_result = sqlite3_step(stmt);
int sqlite_result = Sqlite3_step(stmt);
switch (sqlite_result) {
case SQLITE_ROW:
if (tpkp) {
@ -692,7 +692,7 @@ static PEP_STATUS tpk_save(PEP_SESSION session, pgp_tpk_t tpk,
char *name = NULL;
sqlite3_stmt *stmt = session->sq_sql.begin_transaction;
int sqlite_result = sqlite3_step(stmt);
int sqlite_result = Sqlite3_step(stmt);
sqlite3_reset(stmt);
if (sqlite_result != SQLITE_DONE)
ERROR_OUT(NULL, PEP_UNKNOWN_ERROR,
@ -738,7 +738,7 @@ static PEP_STATUS tpk_save(PEP_SESSION session, pgp_tpk_t tpk,
sqlite3_bind_int(stmt, 2, is_tsk);
sqlite3_bind_blob(stmt, 3, tsk_buffer, tsk_buffer_len, SQLITE_STATIC);
sqlite_result = sqlite3_step(stmt);
sqlite_result = Sqlite3_step(stmt);
sqlite3_reset(stmt);
if (sqlite_result != SQLITE_DONE)
ERROR_OUT(NULL, PEP_UNKNOWN_ERROR,
@ -756,7 +756,7 @@ static PEP_STATUS tpk_save(PEP_SESSION session, pgp_tpk_t tpk,
sqlite3_bind_text(stmt, 1, keyid_hex, -1, SQLITE_STATIC);
sqlite3_bind_text(stmt, 2, fpr, -1, SQLITE_STATIC);
sqlite_result = sqlite3_step(stmt);
sqlite_result = Sqlite3_step(stmt);
sqlite3_reset(stmt);
free(keyid_hex);
pgp_keyid_free(keyid);
@ -846,7 +846,7 @@ static PEP_STATUS tpk_save(PEP_SESSION session, pgp_tpk_t tpk,
sqlite3_bind_text(stmt, 1, email, -1, SQLITE_STATIC);
sqlite3_bind_text(stmt, 2, fpr, -1, SQLITE_STATIC);
sqlite_result = sqlite3_step(stmt);
sqlite_result = Sqlite3_step(stmt);
sqlite3_reset(stmt);
if (sqlite_result != SQLITE_DONE) {
@ -880,7 +880,7 @@ static PEP_STATUS tpk_save(PEP_SESSION session, pgp_tpk_t tpk,
stmt = status == PEP_STATUS_OK
? session->sq_sql.commit_transaction
: session->sq_sql.rollback_transaction;
int sqlite_result = sqlite3_step(stmt);
int sqlite_result = Sqlite3_step(stmt);
sqlite3_reset(stmt);
if (sqlite_result != SQLITE_DONE)
ERROR_OUT(NULL, PEP_UNKNOWN_ERROR,

@ -31,7 +31,7 @@ function "exec_sql_int" {
call "init_sql" with "sql", "$sql";
||
int _result = 0;
int_result = sqlite3_step(_sql);
int_result = Sqlite3_step(_sql);
assert(int_result == SQLITE_ROW);
if (int_result == SQLITE_ROW)
_result = sqlite3_column_int(_sql, 0);

@ -80,7 +80,7 @@ protocol Sync 1 {
}
// handshaking without existing Device group
state HandshakingNewFirst {
state HandshakingNewFirst timeout=600 {
on Init
do showSoleHandshake;
@ -118,7 +118,7 @@ protocol Sync 1 {
}
// handshaking without existing Device group
state HandshakingNewSecond {
state HandshakingNewSecond timeout=600 {
on Init
do showSoleHandshake;

Loading…
Cancel
Save