[zeromq-dev] Two small mistakes in zeromq-3.0.2
Luca Fascione
lukes at wetafx.co.nz
Tue Nov 15 10:35:34 CET 2011
Cool, thanks!
Luca
On 15/11/11 8:43 PM, Martin Sustrik wrote:
> Hi Luca,
>
>> While building zeromq I noticed two lines that could use improvement:
>>
>> At src/socket_base.cpp:237
>> replace
>> generate_uuid ((unsigned char*) identity.data () + 1);
>> with
>> generate_uuid (const_cast<unsigned char*>(identity.data ())
>> + 1);
>>
>> (modern compilers don't like people C-casting constness away)
>
> I guess the std::basic_string should not be used this way in the first
> place. Maybe generating the UUID into a raw C buffer and then
> constructing a string object from it would be preferable.
>
> In any case, this code does not exist any more in the development
> trunk (3.1) so it's up to Pieter (maintainer of 3.0) to decide whether
> to fix this or not.
>
>> At src/ip.cpp:451
>> replace
>> #elif defined ZMQ_HAVE_AIX || ZMQ_HAVE_HPUX || ZMQ_HAVE_ANDROID
>> with
>> #elif defined ZMQ_HAVE_AIX || defined ZMQ_HAVE_HPUX || defined
>> ZMQ_HAVE_ANDROID
>>
>> (that's just a bug, and breaks the build if you have -Werror -Wundef)
>
> Ok. Fixed in the trunk.
>
> Martin
More information about the zeromq-dev
mailing list