deviceid / diveid weirdness

Dirk Hohndel dirk at hohndel.org
Fri Nov 22 12:48:06 UTC 2013


Linus, Thiago,

you are the two people that I think of when I wonder about strange
things that C code does to me that might involve weird corner cases, odd
casts, or something else that is just plain puzzling.

Please take a look at bug #164 http://trac.hohndel.org/ticket/164

Some users get deviceid and diveid entries above 0x80000000 "truncated"
into 0x7fffffff. But apparently only after downloading additional dives
on top of existing ones.

I have two dive computers with MSB set and don't encounter this - I also
have several dives with such diveids. And I even used (for a while) the
same dive computer as the second person reporting the problem.

I have poked at the fact that libdivecomputer.h defines deviceid and
diveid as unsigned int (which on most modern computers is likely 64bit)
instead of uint32_t. But these are signed values. Nothing should
"truncate" them to MAX_INT...

I'm sure I'm missing something obvious.

Help me, oh voodoo masters...

/D  



More information about the subsurface mailing list