[Vala] Incorrect copy usage in ZMQ vapi



Hi,

I am having troubles writting a Vapi for ZeroMQ. There are some issues with
the Socket.send method: whenever socket.send is called, it makes a temp
zmq_msg_t variable with zmq_msg_copy(); however, it does not initialize this
variable before using it and this is required by ZMQ. Also, it passes the
parameters in the wrong order (src, dest) rather than (dest, src).
Msg.copy() seems to work correctly when called directly, but not when Vala
uses the zmq_msg_copy function itself.

There are 2 sample programs attached, hwserver and hwclient. Both must be
run at the same time. The issue can be seen in hwclient.

void* requester;
...
guint8* _tmp11_;
gint _tmp11__length1;
zmq_msg_t request = {0};
...
zmq_msg_t _tmp15_;
zmq_msg_t _tmp16_ = {0};
...
zmq_msg_init_data (&request, _tmp11_, _tmp11__length1, NULL, NULL);
...
_tmp14_ = requester;
_tmp15_ = request;    // <<< _tmp15_ is not initizlized, as request is,
before copy call. This will cause a seg-fault.
zmq_msg_copy (&_tmp15_, &_tmp16_);    // <<< parameters are in wrong order
here
zmq_send (_tmp14_, &_tmp16_, 0);

Thanks,
~Lewis

Attachment: libzmq.vapi
Description: Text Data

Attachment: hwclient.vala
Description: Text Data

Attachment: hwserver.vala
Description: Text Data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]