Hi Erik, The C++ binding is here: https://github.com/zeromq/cppzmq
This project got moved out of libzmq some time ago. The project has no explicit license and no contribution policy, which is a little unfortunate. I'll fix that. If the master of that code has the problems you found, you can send a pull request with your patch. -Pieter On Thu, May 9, 2013 at 12:37 PM, Habbinga, Erik <erik.habbi...@schneider-electric.com> wrote: > Hello, > We've found a few bugs in the latest version of include/zmsg.hpp from the > guide, hopefully this is the right mailing list for a patch. > > hunk 1-2: move ustring data instantiation closer to use, this silences a > valgrind warning (unfortunately I don't have access to the warning anymore) > > hunk 2: use int instead of int64_t for getsockopt(ZMQ_RCVMORE). int64_t with > zeromq 3.2.2 on ARM is never returning more == 1, so multi part message > framing fails. int64_t did work with zeromq 2.1.10 on ARM, oddly enough. > Code in tests/test_reqrep_device.cpp is also using ints instead of int64_t > for getsockopt(ZMQ_RCVMORE). > > hunk 3: decode_uuid allocs memory with new [] and thus uuidbin needs to be > freed with delete [] > > Thanks, > Erik > > --- a/include/zmsg.hpp 2013-05-09 10:02:32.000000000 -0600 > +++ b/include/zmsg.hpp 2013-05-09 10:04:59.000000000 -0600 > @@ -99,7 +99,6 @@ > std::cout << "E: " << error.what() << std::endl; > return false; > } > - ustring data = (unsigned char*) message.data(); > //std::cerr << "recv: \"" << (unsigned char*) message.data() << > "\", size " << message.size() << std::endl; > if (message.size() == 17 && ((unsigned char *)message.data())[0] == > 0) { > char *uuidstr = encode_uuid((unsigned char*) message.data()); > @@ -107,10 +106,10 @@ > delete[] uuidstr; > } > else { > - data[message.size()] = 0; > + ustring data((unsigned char*) message.data(), message.size()); > push_back((char *)data.c_str()); > } > - int64_t more = 0; > + int more = 0; > size_t more_size = sizeof(more); > socket.getsockopt(ZMQ_RCVMORE, &more, &more_size); > if (!more) { > @@ -128,7 +127,7 @@ > unsigned char * uuidbin = decode_uuid ((char *) data.c_str()); > message.rebuild(17); > memcpy(message.data(), uuidbin, 17); > - delete uuidbin; > + delete[] uuidbin; > } > else { > message.rebuild(data.size()); > _______________________________________________ > zeromq-dev mailing list > zeromq-dev@lists.zeromq.org > http://lists.zeromq.org/mailman/listinfo/zeromq-dev _______________________________________________ zeromq-dev mailing list zeromq-dev@lists.zeromq.org http://lists.zeromq.org/mailman/listinfo/zeromq-dev