From f82b015619be0b1982f55beacb333013a0ec0a3d Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Wed, 13 Dec 2017 13:46:21 +0100 Subject: [PATCH] make things work with clang --- setup.py | 2 +- src/identity.cc | 6 +++--- src/identity.hh | 4 ++-- src/message.cc | 10 +++++----- src/message.hh | 32 ++++++++++++++++---------------- src/message_api.cc | 4 ++-- src/message_api.hh | 2 +- src/pEpmodule.cc | 36 ++++++++++++++++++------------------ src/str_attr.cc | 12 ++++++------ src/str_attr.hh | 8 ++++---- src/sync_mixin.cc | 2 ++ 11 files changed, 60 insertions(+), 58 deletions(-) diff --git a/setup.py b/setup.py index edffd9f..a213224 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ module_pEp = Extension('pEp', sources = glob('src/*.cc'), include_dirs = [OPTION_PREFIX+'/include', OPTION_BOOST+'/include',], library_dirs = [OPTION_PREFIX+'/lib', OPTION_BOOST+'/lib',], - libraries = ['pEpEngine', 'boost_python-mt', 'boost_locale-mt',], + libraries = ['pEpEngine', 'boost_python3-mt', 'boost_locale-mt',], extra_compile_args = ['-O0', '-UNDEBUG', '-std=c++14',], ) diff --git a/src/identity.cc b/src/identity.cc index 88c4b28..796738b 100644 --- a/src/identity.cc +++ b/src/identity.cc @@ -156,9 +156,9 @@ namespace pEp { ident = _dup; } - list identitylist_attr(identity_list *&il) + boost::python::list identitylist_attr(identity_list *&il) { - list result; + boost::python::list result; for (identity_list *_il = il; _il && _il->ident; _il = _il->next) { pEp_identity *ident = ::identity_dup(_il->ident); @@ -170,7 +170,7 @@ namespace pEp { return result; } - void identitylist_attr(identity_list *&il, list value) + void identitylist_attr(identity_list *&il, boost::python::list value) { identity_list *_il = new_identity_list(NULL); if (!_il) diff --git a/src/identity.hh b/src/identity.hh index b732ca5..a607721 100644 --- a/src/identity.hh +++ b/src/identity.hh @@ -62,8 +62,8 @@ namespace pEp { Identity identity_attr(pEp_identity *&ident); void identity_attr(pEp_identity *&ident, object value); - list identitylist_attr(identity_list *&il); - void identitylist_attr(identity_list *&il, list value); + boost::python::list identitylist_attr(identity_list *&il); + void identitylist_attr(identity_list *&il, boost::python::list value); } } diff --git a/src/message.cc b/src/message.cc index fb075a3..d402654 100644 --- a/src/message.cc +++ b/src/message.cc @@ -241,7 +241,7 @@ namespace pEp { boost::python::tuple Message::attachments() { - list l; + boost::python::list l; for (bloblist_t *bl = _msg->attachments; bl && bl->value; bl = bl->next) { @@ -251,7 +251,7 @@ namespace pEp { return boost::python::tuple(l); } - void Message::attachments(list value) + void Message::attachments(boost::python::list value) { bloblist_t *bl = new_bloblist(NULL, 0, NULL, NULL); if (!bl) @@ -290,11 +290,11 @@ namespace pEp { Message Message::encrypt() { - list extra; + boost::python::list extra; return encrypt_message(*this, extra, PEP_enc_PGP_MIME, 0); } - Message Message::_encrypt(list extra, int enc_format, int flags) + Message Message::_encrypt(boost::python::list extra, int enc_format, int flags) { if (!enc_format) enc_format = PEP_enc_PGP_MIME; @@ -355,7 +355,7 @@ namespace pEp { return object(ident); } - static list update(list il) + static boost::python::list update(boost::python::list il) { for (int i=0; i(il[i])); diff --git a/src/message.hh b/src/message.hh index d6acb90..d910e9b 100644 --- a/src/message.hh +++ b/src/message.hh @@ -79,7 +79,7 @@ namespace pEp { void longmsg_formatted(string value) { str_attr(_msg->longmsg_formatted, value); } boost::python::tuple attachments(); - void attachments(list value); + void attachments(boost::python::list value); time_t sent() { return timestamp_attr(_msg->sent); } void sent(time_t value) { timestamp_attr(_msg->sent, value); } @@ -90,29 +90,29 @@ namespace pEp { Identity from() { return identity_attr(_msg->from); } void from(object value) { identity_attr(_msg->from, value); } - list to() { return identitylist_attr(_msg->to); } - void to(list value) { identitylist_attr(_msg->to, value); } + boost::python::list to() { return identitylist_attr(_msg->to); } + void to(boost::python::list value) { identitylist_attr(_msg->to, value); } Identity recv_by() { return identity_attr(_msg->recv_by); } void recv_by(object value) { identity_attr(_msg->recv_by, value); } - list cc() { return identitylist_attr(_msg->cc); } - void cc(list value) { identitylist_attr(_msg->cc, value); } + boost::python::list cc() { return identitylist_attr(_msg->cc); } + void cc(boost::python::list value) { identitylist_attr(_msg->cc, value); } - list bcc() { return identitylist_attr(_msg->bcc); } - void bcc(list value) { identitylist_attr(_msg->bcc, value); } + boost::python::list bcc() { return identitylist_attr(_msg->bcc); } + void bcc(boost::python::list value) { identitylist_attr(_msg->bcc, value); } - list reply_to() { return identitylist_attr(_msg->reply_to); } - void reply_to(list value) { identitylist_attr(_msg->reply_to, value); } + boost::python::list reply_to() { return identitylist_attr(_msg->reply_to); } + void reply_to(boost::python::list value) { identitylist_attr(_msg->reply_to, value); } - list in_reply_to() { return strlist_attr(_msg->in_reply_to); } - void in_reply_to(list value) { strlist_attr(_msg->in_reply_to, value); } + boost::python::list in_reply_to() { return strlist_attr(_msg->in_reply_to); } + void in_reply_to(boost::python::list value) { strlist_attr(_msg->in_reply_to, value); } - list references() { return strlist_attr(_msg->references); } - void references(list value) { strlist_attr(_msg->references, value); } + boost::python::list references() { return strlist_attr(_msg->references); } + void references(boost::python::list value) { strlist_attr(_msg->references, value); } - list keywords() { return strlist_attr(_msg->keywords); } - void keywords(list value) { strlist_attr(_msg->keywords, value); } + boost::python::list keywords() { return strlist_attr(_msg->keywords); } + void keywords(boost::python::list value) { strlist_attr(_msg->keywords, value); } string comments() { return str_attr(_msg->comments); } void comments(string value) { str_attr(_msg->comments, value); } @@ -124,7 +124,7 @@ namespace pEp { void enc_format(PEP_enc_format value) { _msg->enc_format = value; } Message encrypt(); - Message _encrypt(list extra, int enc_format=4, int flags=0); + Message _encrypt(boost::python::list extra, int enc_format=4, int flags=0); boost::python::tuple decrypt(); int outgoing_rating(); diff --git a/src/message_api.cc b/src/message_api.cc index ddd0dc5..601ec75 100644 --- a/src/message_api.cc +++ b/src/message_api.cc @@ -5,7 +5,7 @@ namespace pEp { namespace PythonAdapter { - Message encrypt_message(Message src, list extra, int enc_format, + Message encrypt_message(Message src, boost::python::list extra, int enc_format, int flags) { Identity _from = src.from(); @@ -43,7 +43,7 @@ namespace pEp { &_rating, &_flags); _throw_status(status); - list keylist; + boost::python::list keylist; if (_keylist) { keylist = from_stringlist(_keylist); free_stringlist(_keylist); diff --git a/src/message_api.hh b/src/message_api.hh index 6b945fc..a652838 100644 --- a/src/message_api.hh +++ b/src/message_api.hh @@ -4,7 +4,7 @@ namespace pEp { namespace PythonAdapter { - Message encrypt_message(Message src, list extra = list(), + Message encrypt_message(Message src, boost::python::list extra = boost::python::list(), int enc_format = 4, int flags = 0); boost::python::tuple decrypt_message(Message src); int _color(int rating); diff --git a/src/pEpmodule.cc b/src/pEpmodule.cc index ceabced..c7c1073 100644 --- a/src/pEpmodule.cc +++ b/src/pEpmodule.cc @@ -193,7 +193,7 @@ BOOST_PYTHON_MODULE(pEp) (void(Message::*)(string)) &Message::longmsg_formatted, "HTML body or fromatted long version of message") .add_property("attachments", (boost::python::tuple(Message::*)()) &Message::attachments, - (void(Message::*)(list)) &Message::attachments, + (void(Message::*)(boost::python::list)) &Message::attachments, "tuple of Blobs with attachments; setting moves Blobs to attachment tuple") .add_property("sent", (time_t(Message::*)()) &Message::sent, (void(Message::*)(time_t)) &Message::sent, @@ -204,29 +204,29 @@ BOOST_PYTHON_MODULE(pEp) .add_property("from_", (pEp::PythonAdapter::Identity(Message::*)()) &Message::from, (void(Message::*)(object)) &Message::from, "identity where message is from") - .add_property("to", (list(Message::*)()) &Message::to, - (void(Message::*)(list)) &Message::to, + .add_property("to", (boost::python::list(Message::*)()) &Message::to, + (void(Message::*)(boost::python::list)) &Message::to, "list of identities message is going to") .add_property("recv_by", (pEp::PythonAdapter::Identity(Message::*)()) &Message::recv_by, (void(Message::*)(object)) &Message::recv_by, "identity where message was received by") - .add_property("cc", (list(Message::*)()) &Message::cc, - (void(Message::*)(list)) &Message::cc, + .add_property("cc", (boost::python::list(Message::*)()) &Message::cc, + (void(Message::*)(boost::python::list)) &Message::cc, "list of identities message is going cc") - .add_property("bcc", (list(Message::*)()) &Message::bcc, - (void(Message::*)(list)) &Message::bcc, + .add_property("bcc", (boost::python::list(Message::*)()) &Message::bcc, + (void(Message::*)(boost::python::list)) &Message::bcc, "list of identities message is going bcc") - .add_property("reply_to", (list(Message::*)()) &Message::reply_to, - (void(Message::*)(list)) &Message::reply_to, + .add_property("reply_to", (boost::python::list(Message::*)()) &Message::reply_to, + (void(Message::*)(boost::python::list)) &Message::reply_to, "list of identities where message will be replied to") - .add_property("in_reply_to", (list(Message::*)()) &Message::in_reply_to, - (void(Message::*)(list)) &Message::in_reply_to, + .add_property("in_reply_to", (boost::python::list(Message::*)()) &Message::in_reply_to, + (void(Message::*)(boost::python::list)) &Message::in_reply_to, "in_reply_to list") - .add_property("references", (list(Message::*)()) &Message::references, - (void(Message::*)(list)) &Message::references, + .add_property("references", (boost::python::list(Message::*)()) &Message::references, + (void(Message::*)(boost::python::list)) &Message::references, "message IDs of messages this one is referring to") - .add_property("keywords", (list(Message::*)()) &Message::keywords, - (void(Message::*)(list)) &Message::keywords, + .add_property("keywords", (boost::python::list(Message::*)()) &Message::keywords, + (void(Message::*)(boost::python::list)) &Message::keywords, "keywords this message should be stored under") .add_property("comments", (string(Message::*)()) &Message::comments, (void(Message::*)(string)) &Message::comments, @@ -240,9 +240,9 @@ BOOST_PYTHON_MODULE(pEp) (void(Message::*)(PEP_enc_format)) &Message::enc_format, "0: unencrypted, 1: inline PGP, 2: S/MIME, 3: PGP/MIME, 4: p≡p format") .def("encrypt", (Message(Message::*)())&Message::encrypt) - .def("encrypt", (Message(Message::*)(list))&Message::_encrypt) - .def("encrypt", (Message(Message::*)(list,int))&Message::_encrypt) - .def("encrypt", (Message(Message::*)(list,int,int))&Message::_encrypt, + .def("encrypt", (Message(Message::*)(boost::python::list))&Message::_encrypt) + .def("encrypt", (Message(Message::*)(boost::python::list,int))&Message::_encrypt) + .def("encrypt", (Message(Message::*)(boost::python::list,int,int))&Message::_encrypt, "msg2 = msg1.encrypt(extra_keys=[], enc_format='pEp', flags=0)\n" "\n" "encrypts a p≡p message and returns the encrypted message\n" diff --git a/src/str_attr.cc b/src/str_attr.cc index aeb603d..68ee145 100644 --- a/src/str_attr.cc +++ b/src/str_attr.cc @@ -51,9 +51,9 @@ namespace pEp { ts = new_timestamp(value); } - list strlist_attr(stringlist_t *&sl) + boost::python::list strlist_attr(stringlist_t *&sl) { - list result; + boost::python::list result; for (stringlist_t *_sl = sl; _sl && _sl->value; _sl = _sl->next) { string s(_sl->value); @@ -63,7 +63,7 @@ namespace pEp { return result; } - void strlist_attr(stringlist_t *&sl, list value) + void strlist_attr(stringlist_t *&sl, boost::python::list value) { stringlist_t *_sl = new_stringlist(NULL); if (!_sl) @@ -140,7 +140,7 @@ namespace pEp { spl = _spl; } - stringlist_t *to_stringlist(list l) + stringlist_t *to_stringlist(boost::python::list l) { stringlist_t *result = new_stringlist(NULL); if (!result) @@ -162,9 +162,9 @@ namespace pEp { return result; } - list from_stringlist(const stringlist_t *sl) + boost::python::list from_stringlist(const stringlist_t *sl) { - list result; + boost::python::list result; for (const stringlist_t *_sl = sl; _sl && _sl->value; _sl = _sl->next) { string s = _sl->value; result.append(s); diff --git a/src/str_attr.hh b/src/str_attr.hh index d63f47d..2f7bd8d 100644 --- a/src/str_attr.hh +++ b/src/str_attr.hh @@ -20,14 +20,14 @@ namespace pEp { time_t timestamp_attr(timestamp *&ts); void timestamp_attr(timestamp *&ts, time_t value); - list strlist_attr(stringlist_t *&sl); - void strlist_attr(stringlist_t *&sl, list value); + boost::python::list strlist_attr(stringlist_t *&sl); + void strlist_attr(stringlist_t *&sl, boost::python::list value); dict strdict_attr(stringpair_list_t *&spl); void strdict_attr(stringpair_list_t *&spl, dict value); - stringlist_t *to_stringlist(list l); - list from_stringlist(const stringlist_t *sl); + stringlist_t *to_stringlist(boost::python::list l); + boost::python::list from_stringlist(const stringlist_t *sl); } } diff --git a/src/sync_mixin.cc b/src/sync_mixin.cc index 0aa7d5b..6741b93 100644 --- a/src/sync_mixin.cc +++ b/src/sync_mixin.cc @@ -115,6 +115,8 @@ namespace pEp { // have original timeout value anymore *timeout = 1; break; + default: + ; } timeout_state = timeout_stopped;