Home » U++ Library support » U++ Core » Bug in Stream::Pack
Bug in Stream::Pack [message #40343] |
Mon, 22 July 2013 20:39 |
Didier
Messages: 680 Registered: November 2008 Location: France
|
Contributor |
|
|
Hi,
Reading some code in 'Core/Stream.cpp' trying to understand what the '/' meant when serialising data, I stumbled on a bug:
'f' parameter gets overlapped by local variable, so this will not work as expected:
void Stream::Pack(bool& a, bool& b, bool& c, bool& d, bool& e, bool& f, bool& g, bool& h) {
if(IsError()) return;
if(IsLoading()) {
int f = Get();
if(f < 0) LoadError();
else {
a = !!(f & 0x80);
b = !!(f & 0x40);
c = !!(f & 0x20);
d = !!(f & 0x10);
e = !!(f & 0x08);
f = !!(f & 0x04);
g = !!(f & 0x02);
h = !!(f & 0x01);
}
}
else {
int f = 0;
if(a) f |= 0x80;
if(b) f |= 0x40;
if(c) f |= 0x20;
if(d) f |= 0x10;
if(e) f |= 0x08;
if(f) f |= 0x04;
if(g) f |= 0x02;
if(h) f |= 0x01;
Put(f);
}
}
[Updated on: Mon, 22 July 2013 20:39] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Wed Jun 05 08:48:47 CEST 2024
Total time taken to generate the page: 0.02484 seconds
|