Browse Source

make things work with clang

PYADPT-55
Volker Birk 8 years ago
parent
commit
f82b015619
  1. 2
      setup.py
  2. 6
      src/identity.cc
  3. 4
      src/identity.hh
  4. 10
      src/message.cc
  5. 32
      src/message.hh
  6. 4
      src/message_api.cc
  7. 2
      src/message_api.hh
  8. 36
      src/pEpmodule.cc
  9. 12
      src/str_attr.cc
  10. 8
      src/str_attr.hh
  11. 2
      src/sync_mixin.cc

2
setup.py

@ -35,7 +35,7 @@ module_pEp = Extension('pEp',
sources = glob('src/*.cc'), sources = glob('src/*.cc'),
include_dirs = [OPTION_PREFIX+'/include', OPTION_BOOST+'/include',], include_dirs = [OPTION_PREFIX+'/include', OPTION_BOOST+'/include',],
library_dirs = [OPTION_PREFIX+'/lib', OPTION_BOOST+'/lib',], 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',], extra_compile_args = ['-O0', '-UNDEBUG', '-std=c++14',],
) )

6
src/identity.cc

@ -156,9 +156,9 @@ namespace pEp {
ident = _dup; 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) { for (identity_list *_il = il; _il && _il->ident; _il = _il->next) {
pEp_identity *ident = ::identity_dup(_il->ident); pEp_identity *ident = ::identity_dup(_il->ident);
@ -170,7 +170,7 @@ namespace pEp {
return result; 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); identity_list *_il = new_identity_list(NULL);
if (!_il) if (!_il)

4
src/identity.hh

@ -62,8 +62,8 @@ namespace pEp {
Identity identity_attr(pEp_identity *&ident); Identity identity_attr(pEp_identity *&ident);
void identity_attr(pEp_identity *&ident, object value); void identity_attr(pEp_identity *&ident, object value);
list identitylist_attr(identity_list *&il); boost::python::list identitylist_attr(identity_list *&il);
void identitylist_attr(identity_list *&il, list value); void identitylist_attr(identity_list *&il, boost::python::list value);
} }
} }

10
src/message.cc

@ -241,7 +241,7 @@ namespace pEp {
boost::python::tuple Message::attachments() boost::python::tuple Message::attachments()
{ {
list l; boost::python::list l;
for (bloblist_t *bl = _msg->attachments; bl && bl->value; bl = for (bloblist_t *bl = _msg->attachments; bl && bl->value; bl =
bl->next) { bl->next) {
@ -251,7 +251,7 @@ namespace pEp {
return boost::python::tuple(l); 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); bloblist_t *bl = new_bloblist(NULL, 0, NULL, NULL);
if (!bl) if (!bl)
@ -290,11 +290,11 @@ namespace pEp {
Message Message::encrypt() Message Message::encrypt()
{ {
list extra; boost::python::list extra;
return encrypt_message(*this, extra, PEP_enc_PGP_MIME, 0); 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) if (!enc_format)
enc_format = PEP_enc_PGP_MIME; enc_format = PEP_enc_PGP_MIME;
@ -355,7 +355,7 @@ namespace pEp {
return object(ident); return object(ident);
} }
static list update(list il) static boost::python::list update(boost::python::list il)
{ {
for (int i=0; i<len(il); i++) { for (int i=0; i<len(il); i++) {
update(extract< Identity >(il[i])); update(extract< Identity >(il[i]));

32
src/message.hh

@ -79,7 +79,7 @@ namespace pEp {
void longmsg_formatted(string value) { str_attr(_msg->longmsg_formatted, value); } void longmsg_formatted(string value) { str_attr(_msg->longmsg_formatted, value); }
boost::python::tuple attachments(); boost::python::tuple attachments();
void attachments(list value); void attachments(boost::python::list value);
time_t sent() { return timestamp_attr(_msg->sent); } time_t sent() { return timestamp_attr(_msg->sent); }
void sent(time_t value) { timestamp_attr(_msg->sent, value); } void sent(time_t value) { timestamp_attr(_msg->sent, value); }
@ -90,29 +90,29 @@ namespace pEp {
Identity from() { return identity_attr(_msg->from); } Identity from() { return identity_attr(_msg->from); }
void from(object value) { identity_attr(_msg->from, value); } void from(object value) { identity_attr(_msg->from, value); }
list to() { return identitylist_attr(_msg->to); } boost::python::list to() { return identitylist_attr(_msg->to); }
void to(list value) { identitylist_attr(_msg->to, value); } void to(boost::python::list value) { identitylist_attr(_msg->to, value); }
Identity recv_by() { return identity_attr(_msg->recv_by); } Identity recv_by() { return identity_attr(_msg->recv_by); }
void recv_by(object value) { identity_attr(_msg->recv_by, value); } void recv_by(object value) { identity_attr(_msg->recv_by, value); }
list cc() { return identitylist_attr(_msg->cc); } boost::python::list cc() { return identitylist_attr(_msg->cc); }
void cc(list value) { identitylist_attr(_msg->cc, value); } void cc(boost::python::list value) { identitylist_attr(_msg->cc, value); }
list bcc() { return identitylist_attr(_msg->bcc); } boost::python::list bcc() { return identitylist_attr(_msg->bcc); }
void bcc(list value) { identitylist_attr(_msg->bcc, value); } void bcc(boost::python::list value) { identitylist_attr(_msg->bcc, value); }
list reply_to() { return identitylist_attr(_msg->reply_to); } boost::python::list reply_to() { return identitylist_attr(_msg->reply_to); }
void reply_to(list value) { identitylist_attr(_msg->reply_to, value); } void reply_to(boost::python::list value) { identitylist_attr(_msg->reply_to, value); }
list in_reply_to() { return strlist_attr(_msg->in_reply_to); } boost::python::list in_reply_to() { return strlist_attr(_msg->in_reply_to); }
void in_reply_to(list value) { strlist_attr(_msg->in_reply_to, value); } void in_reply_to(boost::python::list value) { strlist_attr(_msg->in_reply_to, value); }
list references() { return strlist_attr(_msg->references); } boost::python::list references() { return strlist_attr(_msg->references); }
void references(list value) { strlist_attr(_msg->references, value); } void references(boost::python::list value) { strlist_attr(_msg->references, value); }
list keywords() { return strlist_attr(_msg->keywords); } boost::python::list keywords() { return strlist_attr(_msg->keywords); }
void keywords(list value) { strlist_attr(_msg->keywords, value); } void keywords(boost::python::list value) { strlist_attr(_msg->keywords, value); }
string comments() { return str_attr(_msg->comments); } string comments() { return str_attr(_msg->comments); }
void comments(string value) { str_attr(_msg->comments, value); } 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; } void enc_format(PEP_enc_format value) { _msg->enc_format = value; }
Message encrypt(); 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(); boost::python::tuple decrypt();
int outgoing_rating(); int outgoing_rating();

4
src/message_api.cc

@ -5,7 +5,7 @@
namespace pEp { namespace pEp {
namespace PythonAdapter { 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) int flags)
{ {
Identity _from = src.from(); Identity _from = src.from();
@ -43,7 +43,7 @@ namespace pEp {
&_rating, &_flags); &_rating, &_flags);
_throw_status(status); _throw_status(status);
list keylist; boost::python::list keylist;
if (_keylist) { if (_keylist) {
keylist = from_stringlist(_keylist); keylist = from_stringlist(_keylist);
free_stringlist(_keylist); free_stringlist(_keylist);

2
src/message_api.hh

@ -4,7 +4,7 @@
namespace pEp { namespace pEp {
namespace PythonAdapter { 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); int enc_format = 4, int flags = 0);
boost::python::tuple decrypt_message(Message src); boost::python::tuple decrypt_message(Message src);
int _color(int rating); int _color(int rating);

36
src/pEpmodule.cc

@ -193,7 +193,7 @@ BOOST_PYTHON_MODULE(pEp)
(void(Message::*)(string)) &Message::longmsg_formatted, (void(Message::*)(string)) &Message::longmsg_formatted,
"HTML body or fromatted long version of message") "HTML body or fromatted long version of message")
.add_property("attachments", (boost::python::tuple(Message::*)()) &Message::attachments, .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") "tuple of Blobs with attachments; setting moves Blobs to attachment tuple")
.add_property("sent", (time_t(Message::*)()) &Message::sent, .add_property("sent", (time_t(Message::*)()) &Message::sent,
(void(Message::*)(time_t)) &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, .add_property("from_", (pEp::PythonAdapter::Identity(Message::*)()) &Message::from,
(void(Message::*)(object)) &Message::from, (void(Message::*)(object)) &Message::from,
"identity where message is from") "identity where message is from")
.add_property("to", (list(Message::*)()) &Message::to, .add_property("to", (boost::python::list(Message::*)()) &Message::to,
(void(Message::*)(list)) &Message::to, (void(Message::*)(boost::python::list)) &Message::to,
"list of identities message is going to") "list of identities message is going to")
.add_property("recv_by", (pEp::PythonAdapter::Identity(Message::*)()) &Message::recv_by, .add_property("recv_by", (pEp::PythonAdapter::Identity(Message::*)()) &Message::recv_by,
(void(Message::*)(object)) &Message::recv_by, (void(Message::*)(object)) &Message::recv_by,
"identity where message was received by") "identity where message was received by")
.add_property("cc", (list(Message::*)()) &Message::cc, .add_property("cc", (boost::python::list(Message::*)()) &Message::cc,
(void(Message::*)(list)) &Message::cc, (void(Message::*)(boost::python::list)) &Message::cc,
"list of identities message is going cc") "list of identities message is going cc")
.add_property("bcc", (list(Message::*)()) &Message::bcc, .add_property("bcc", (boost::python::list(Message::*)()) &Message::bcc,
(void(Message::*)(list)) &Message::bcc, (void(Message::*)(boost::python::list)) &Message::bcc,
"list of identities message is going bcc") "list of identities message is going bcc")
.add_property("reply_to", (list(Message::*)()) &Message::reply_to, .add_property("reply_to", (boost::python::list(Message::*)()) &Message::reply_to,
(void(Message::*)(list)) &Message::reply_to, (void(Message::*)(boost::python::list)) &Message::reply_to,
"list of identities where message will be replied to") "list of identities where message will be replied to")
.add_property("in_reply_to", (list(Message::*)()) &Message::in_reply_to, .add_property("in_reply_to", (boost::python::list(Message::*)()) &Message::in_reply_to,
(void(Message::*)(list)) &Message::in_reply_to, (void(Message::*)(boost::python::list)) &Message::in_reply_to,
"in_reply_to list") "in_reply_to list")
.add_property("references", (list(Message::*)()) &Message::references, .add_property("references", (boost::python::list(Message::*)()) &Message::references,
(void(Message::*)(list)) &Message::references, (void(Message::*)(boost::python::list)) &Message::references,
"message IDs of messages this one is referring to") "message IDs of messages this one is referring to")
.add_property("keywords", (list(Message::*)()) &Message::keywords, .add_property("keywords", (boost::python::list(Message::*)()) &Message::keywords,
(void(Message::*)(list)) &Message::keywords, (void(Message::*)(boost::python::list)) &Message::keywords,
"keywords this message should be stored under") "keywords this message should be stored under")
.add_property("comments", (string(Message::*)()) &Message::comments, .add_property("comments", (string(Message::*)()) &Message::comments,
(void(Message::*)(string)) &Message::comments, (void(Message::*)(string)) &Message::comments,
@ -240,9 +240,9 @@ BOOST_PYTHON_MODULE(pEp)
(void(Message::*)(PEP_enc_format)) &Message::enc_format, (void(Message::*)(PEP_enc_format)) &Message::enc_format,
"0: unencrypted, 1: inline PGP, 2: S/MIME, 3: PGP/MIME, 4: p≡p 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::*)())&Message::encrypt)
.def("encrypt", (Message(Message::*)(list))&Message::_encrypt) .def("encrypt", (Message(Message::*)(boost::python::list))&Message::_encrypt)
.def("encrypt", (Message(Message::*)(list,int))&Message::_encrypt) .def("encrypt", (Message(Message::*)(boost::python::list,int))&Message::_encrypt)
.def("encrypt", (Message(Message::*)(list,int,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" "msg2 = msg1.encrypt(extra_keys=[], enc_format='pEp', flags=0)\n"
"\n" "\n"
"encrypts a p≡p message and returns the encrypted message\n" "encrypts a p≡p message and returns the encrypted message\n"

12
src/str_attr.cc

@ -51,9 +51,9 @@ namespace pEp {
ts = new_timestamp(value); 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) { for (stringlist_t *_sl = sl; _sl && _sl->value; _sl = _sl->next) {
string s(_sl->value); string s(_sl->value);
@ -63,7 +63,7 @@ namespace pEp {
return result; 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); stringlist_t *_sl = new_stringlist(NULL);
if (!_sl) if (!_sl)
@ -140,7 +140,7 @@ namespace pEp {
spl = _spl; spl = _spl;
} }
stringlist_t *to_stringlist(list l) stringlist_t *to_stringlist(boost::python::list l)
{ {
stringlist_t *result = new_stringlist(NULL); stringlist_t *result = new_stringlist(NULL);
if (!result) if (!result)
@ -162,9 +162,9 @@ namespace pEp {
return result; 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) { for (const stringlist_t *_sl = sl; _sl && _sl->value; _sl = _sl->next) {
string s = _sl->value; string s = _sl->value;
result.append(s); result.append(s);

8
src/str_attr.hh

@ -20,14 +20,14 @@ namespace pEp {
time_t timestamp_attr(timestamp *&ts); time_t timestamp_attr(timestamp *&ts);
void timestamp_attr(timestamp *&ts, time_t value); void timestamp_attr(timestamp *&ts, time_t value);
list strlist_attr(stringlist_t *&sl); boost::python::list strlist_attr(stringlist_t *&sl);
void strlist_attr(stringlist_t *&sl, list value); void strlist_attr(stringlist_t *&sl, boost::python::list value);
dict strdict_attr(stringpair_list_t *&spl); dict strdict_attr(stringpair_list_t *&spl);
void strdict_attr(stringpair_list_t *&spl, dict value); void strdict_attr(stringpair_list_t *&spl, dict value);
stringlist_t *to_stringlist(list l); stringlist_t *to_stringlist(boost::python::list l);
list from_stringlist(const stringlist_t *sl); boost::python::list from_stringlist(const stringlist_t *sl);
} }
} }

2
src/sync_mixin.cc

@ -115,6 +115,8 @@ namespace pEp {
// have original timeout value anymore // have original timeout value anymore
*timeout = 1; *timeout = 1;
break; break;
default:
;
} }
timeout_state = timeout_stopped; timeout_state = timeout_stopped;

Loading…
Cancel
Save