Hi Padraig,

On Nov 11, 2009, at 2:56 PM, Padraig O'Sullivan wrote:


Just one change I am not sure of:

datalog_xt.cc: line 1206

#ifdef DEBUG
               if (dlb_buffer_offset + (xtLogOffset) dlb_buffer_len >
dlb_max_write_offset)
                       dlb_max_write_offset = dlb_buffer_offset +
(xtLogOffset) dlb_buffer_len;
#endif

-->

#ifdef DEBUG
               if (dlb_buffer_offset + dlb_buffer_len >
dlb_max_write_offset)
                       dlb_max_write_offset = dlb_buffer_offset +
(xtLogOffset) dlb_buffer_len;
#endif

This is a case of "off_t + size_t > off_t".

The size_t was cast to an off_t in case size_t is 4 bytes and off_t is 8.

So we want to make sure that the calculation is done using 8 byte values in
this case.

Did you get a warning on this line? Maybe due to signed to unsigned
conversion?

Sorry, that's my bad. I meant to revert that change before commiting.
Yes, I had gotten a warning to do with comparison of signed and
unsigned integers in a few places in that file. I was going to try and
fix those warnings but then decided it would be better to not do that
and just updated the compiler flags to include -Wno-sign-compare
instead.

Turning the warning off is a quick solution, but I would really like to know how to write this code so that all compilers are happy!

I have no problem with changing the code, but I don't want to change it, just to run into a warning on some other system.

In particular, I am wondering why the compiler is generating a warning in this case where we have an explicit conversion?

Any ideas?






--
Paul McCullagh
PrimeBase Technologies
www.primebase.org
www.blobstreaming.org
pbxt.blogspot.com




_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to