rename macro ERROR(x) into ADD_TO_LOG(x) to avoid problems on MSVC

doc_update_sequoia
Roker 6 years ago
parent 1e9e3c416d
commit 1db08290d8

@ -91,7 +91,7 @@ DYNAMIC_API PEP_STATUS update_identity(
assert(!EMPTYSTR(identity->address));
if (!(session && identity && !EMPTYSTR(identity->address)))
return ERROR(PEP_ILLEGAL_VALUE);
return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
if (identity->me || (identity->user_id && strcmp(identity->user_id, PEP_OWN_USERID) == 0)) {
identity->me = true;
@ -326,7 +326,7 @@ exit_free :
free_identity(stored_identity);
free_identity(temp_id);
return ERROR(status);
return ADD_TO_LOG(status);
}
PEP_STATUS elect_ownkey(
@ -416,7 +416,7 @@ PEP_STATUS _has_usable_priv_key(PEP_SESSION session, char* fpr,
*is_usable = !dont_use_fpr;
return ERROR(status);
return ADD_TO_LOG(status);
}
PEP_STATUS _myself(PEP_SESSION session, pEp_identity * identity, bool do_keygen, bool ignore_flags)
@ -434,7 +434,7 @@ PEP_STATUS _myself(PEP_SESSION session, pEp_identity * identity, bool do_keygen,
if (!(session && identity && !EMPTYSTR(identity->address) &&
(EMPTYSTR(identity->user_id) ||
strcmp(identity->user_id, PEP_OWN_USERID) == 0)))
return ERROR(PEP_ILLEGAL_VALUE);
return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
identity->comm_type = PEP_ct_pEp;
identity->me = true;
@ -522,7 +522,7 @@ PEP_STATUS _myself(PEP_SESSION session, pEp_identity * identity, bool do_keygen,
status = elect_ownkey(session, identity);
assert(status == PEP_STATUS_OK);
if (status != PEP_STATUS_OK) {
return ERROR(status);
return ADD_TO_LOG(status);
}
bool has_private = false;
@ -554,7 +554,7 @@ PEP_STATUS _myself(PEP_SESSION session, pEp_identity * identity, bool do_keygen,
if (status != PEP_STATUS_OK)
{
return ERROR(status);
return ADD_TO_LOG(status);
}
}
@ -563,7 +563,7 @@ PEP_STATUS _myself(PEP_SESSION session, pEp_identity * identity, bool do_keygen,
if (EMPTYSTR(identity->fpr) || revoked)
{
if(!do_keygen){
return ERROR(PEP_GET_KEY_FAILED);
return ADD_TO_LOG(PEP_GET_KEY_FAILED);
}
if(revoked)
@ -581,7 +581,7 @@ PEP_STATUS _myself(PEP_SESSION session, pEp_identity * identity, bool do_keygen,
DEBUG_LOG("generating key pair failed", "debug", buf);
if(revoked && r_fpr)
free(r_fpr);
return ERROR(status);
return ADD_TO_LOG(status);
}
new_key_generated = true;
@ -592,7 +592,7 @@ PEP_STATUS _myself(PEP_SESSION session, pEp_identity * identity, bool do_keygen,
identity->fpr, time(NULL));
free(r_fpr);
if (status != PEP_STATUS_OK) {
return ERROR(status);
return ADD_TO_LOG(status);
}
}
}
@ -605,7 +605,7 @@ PEP_STATUS _myself(PEP_SESSION session, pEp_identity * identity, bool do_keygen,
assert(status == PEP_STATUS_OK);
if (status != PEP_STATUS_OK) {
return ERROR(status);
return ADD_TO_LOG(status);
}
if (status == PEP_STATUS_OK && expired) {
@ -633,12 +633,12 @@ PEP_STATUS _myself(PEP_SESSION session, pEp_identity * identity, bool do_keygen,
}
}
return ERROR(PEP_STATUS_OK);
return ADD_TO_LOG(PEP_STATUS_OK);
}
DYNAMIC_API PEP_STATUS myself(PEP_SESSION session, pEp_identity * identity)
{
return ERROR(_myself(session, identity, true, false));
return ADD_TO_LOG(_myself(session, identity, true, false));
}
DYNAMIC_API PEP_STATUS register_examine_function(

@ -1104,14 +1104,14 @@ DYNAMIC_API PEP_STATUS encrypt_message(
assert(enc_format != PEP_enc_none);
if (!(session && src && dst && enc_format != PEP_enc_none))
return ERROR(PEP_ILLEGAL_VALUE);
return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
if (src->dir == PEP_dir_incoming)
return ERROR(PEP_ILLEGAL_VALUE);
return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
determine_encryption_format(src);
if (src->enc_format != PEP_enc_none)
return ERROR(PEP_ILLEGAL_VALUE);
return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
*dst = NULL;
@ -1218,7 +1218,7 @@ DYNAMIC_API PEP_STATUS encrypt_message(
free_stringlist(keys);
if (!session->passive_mode && !(flags & PEP_encrypt_flag_force_no_attached_key))
attach_own_key(session, src);
return ERROR(PEP_UNENCRYPTED);
return ADD_TO_LOG(PEP_UNENCRYPTED);
}
else {
msg = clone_to_empty_message(src);
@ -1275,7 +1275,7 @@ DYNAMIC_API PEP_STATUS encrypt_message(
}
*dst = msg;
return ERROR(status);
return ADD_TO_LOG(status);
enomem:
status = PEP_OUT_OF_MEMORY;
@ -1284,7 +1284,7 @@ pep_error:
free_stringlist(keys);
free_message(msg);
return ERROR(status);
return ADD_TO_LOG(status);
}
DYNAMIC_API PEP_STATUS encrypt_message_for_self(
@ -1306,14 +1306,14 @@ DYNAMIC_API PEP_STATUS encrypt_message_for_self(
assert(enc_format != PEP_enc_none);
if (!(session && src && dst && enc_format != PEP_enc_none))
return ERROR(PEP_ILLEGAL_VALUE);
return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
if (src->dir == PEP_dir_incoming)
return ERROR(PEP_ILLEGAL_VALUE);
return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
determine_encryption_format(src);
if (src->enc_format != PEP_enc_none)
return ERROR(PEP_ILLEGAL_VALUE);
return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
status = myself(session, target_id);
if (status != PEP_STATUS_OK)
@ -1394,7 +1394,7 @@ pep_error:
free_stringlist(keys);
free_message(msg);
return ERROR(status);
return ADD_TO_LOG(status);
}
static bool is_a_pEpmessage(const message *msg)
@ -1669,7 +1669,7 @@ DYNAMIC_API PEP_STATUS _decrypt_message(
assert(flags);
if (!(session && src && dst && keylist && rating && flags))
return ERROR(PEP_ILLEGAL_VALUE);
return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
*flags = 0;
@ -1680,7 +1680,7 @@ DYNAMIC_API PEP_STATUS _decrypt_message(
// we would need to check signature
status = _update_identity_for_incoming_message(session, src);
if(status != PEP_STATUS_OK)
return ERROR(status);
return ADD_TO_LOG(status);
// Get detached signature, if any
bloblist_t* detached_sig = NULL;
@ -1714,7 +1714,7 @@ DYNAMIC_API PEP_STATUS _decrypt_message(
PEP_decrypt_flag_consume;
}
else if (status != PEP_STATUS_OK) {
return ERROR(status);
return ADD_TO_LOG(status);
}
}
@ -1746,7 +1746,7 @@ DYNAMIC_API PEP_STATUS _decrypt_message(
}
}
return ERROR(PEP_UNENCRYPTED);
return ADD_TO_LOG(PEP_UNENCRYPTED);
case PEP_enc_PGP_MIME:
ctext = src->attachments->next->value;
@ -2117,7 +2117,7 @@ pep_error:
free_message(msg);
free_stringlist(_keylist);
return ERROR(status);
return ADD_TO_LOG(status);
}
DYNAMIC_API PEP_STATUS decrypt_message(
@ -2166,7 +2166,7 @@ DYNAMIC_API PEP_STATUS own_message_private_key_details(
free_identity_list(private_il);
return ERROR(status);
return ADD_TO_LOG(status);
}
static void _max_comm_type_from_identity_list(
@ -2207,10 +2207,10 @@ DYNAMIC_API PEP_STATUS outgoing_message_rating(
assert(rating);
if (!(session && msg && rating))
return ERROR(PEP_ILLEGAL_VALUE);
return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
if (msg->dir != PEP_dir_outgoing)
return ERROR(PEP_ILLEGAL_VALUE);
return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
*rating = PEP_rating_undefined;
@ -2357,7 +2357,7 @@ DYNAMIC_API PEP_STATUS get_trustwords(
goto error_release;
break;
default:
return ERROR(PEP_UNKNOWN_ERROR); // shouldn't be possible
return ADD_TO_LOG(PEP_UNKNOWN_ERROR); // shouldn't be possible
}
size_t _wsize = first_wsize + second_wsize;
@ -2399,7 +2399,7 @@ DYNAMIC_API PEP_STATUS get_trustwords(
the_end:
free(first_set);
free(second_set);
return ERROR(status);
return ADD_TO_LOG(status);
}
DYNAMIC_API PEP_STATUS get_message_trustwords(
@ -2485,7 +2485,7 @@ DYNAMIC_API PEP_STATUS get_message_trustwords(
if (status != PEP_STATUS_OK) {
free_identity(partner);
return ERROR(status);
return ADD_TO_LOG(status);
}
// Find own identity corresponding to given account address.
@ -2498,7 +2498,7 @@ DYNAMIC_API PEP_STATUS get_message_trustwords(
if (status != PEP_STATUS_OK) {
free_identity(stored_identity);
return ERROR(status);
return ADD_TO_LOG(status);
}
// get the trustwords
@ -2507,7 +2507,7 @@ DYNAMIC_API PEP_STATUS get_message_trustwords(
partner, received_by,
lang, words, &wsize, full);
return ERROR(status);
return ADD_TO_LOG(status);
}
DYNAMIC_API PEP_STATUS MIME_decrypt_message(
@ -2558,14 +2558,14 @@ DYNAMIC_API PEP_STATUS MIME_decrypt_message(
{
free(tmp_msg);
free(dec_msg);
return ERROR(decrypt_status);
return ADD_TO_LOG(decrypt_status);
}
pep_error:
free_message(tmp_msg);
free_message(dec_msg);
return ERROR(status);
return ADD_TO_LOG(status);
}
@ -2610,7 +2610,7 @@ pep_error:
free_message(tmp_msg);
free_message(enc_msg);
return ERROR(status);
return ADD_TO_LOG(status);
}
@ -2654,7 +2654,7 @@ pep_error:
free_message(tmp_msg);
free_message(enc_msg);
return ERROR(status);
return ADD_TO_LOG(status);
}
static PEP_rating string_to_rating(const char * rating)
@ -2747,7 +2747,7 @@ DYNAMIC_API PEP_STATUS re_evaluate_message_rating(
assert(rating);
if (!(session && msg && rating))
return ERROR(PEP_ILLEGAL_VALUE);
return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
*rating = PEP_rating_undefined;
@ -2758,7 +2758,7 @@ DYNAMIC_API PEP_STATUS re_evaluate_message_rating(
goto got_rating;
}
}
return ERROR(PEP_ILLEGAL_VALUE);
return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
}
got_rating:
@ -2775,7 +2775,7 @@ got_rating:
goto got_keylist;
}
}
return ERROR(PEP_ILLEGAL_VALUE);
return ADD_TO_LOG(PEP_ILLEGAL_VALUE);
}
got_keylist:
@ -2794,5 +2794,5 @@ pep_error:
if (must_free_keylist)
free_stringlist(_keylist);
return ERROR(status);
return ADD_TO_LOG(status);
}

@ -886,7 +886,7 @@ DYNAMIC_API PEP_STATUS log_event(
} while (result == SQLITE_BUSY);
sqlite3_reset(session->log);
return ERROR(status);
return ADD_TO_LOG(status);
}
DYNAMIC_API PEP_STATUS log_service(
@ -1988,7 +1988,7 @@ enomem:
status = PEP_OUT_OF_MEMORY;
the_end:
return ERROR(status);
return ADD_TO_LOG(status);
}
DYNAMIC_API PEP_STATUS get_languagelist(

@ -316,9 +316,9 @@ static inline int _same_fpr(
#ifdef DEBUG_ERRORSTACK
PEP_STATUS session_add_error(PEP_SESSION session, const char* file, unsigned line, PEP_STATUS status);
#define ERROR(status) session_add_error(session, __FILE__, __LINE__, (status))
#define GOTO(label) do{ (void)session_add_error(session, __FILE__, __LINE__, status); goto label; }while(0)
#define ADD_TO_LOG(status) session_add_error(session, __FILE__, __LINE__, (status))
#define GOTO(label) do{ (void)session_add_error(session, __FILE__, __LINE__, status); goto label; }while(0)
#else
#define ERROR(status) (status)
#define GOTO(label) goto label
#define ADD_TO_LOG(status) (status)
#define GOTO(label) goto label
#endif

Loading…
Cancel
Save