1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-27 21:24:47 +01:00

Made the code more standard conforming

This commit is contained in:
Martin Tůma 2024-05-21 09:14:15 +02:00
parent 43271d9ff8
commit 6803ee0324

View File

@ -129,16 +129,17 @@ bool JLS::readLine(BitStream &bs)
quint8 k; quint8 k;
uint MErrval; uint MErrval;
int Errval; int Errval;
int Rx = _last[1]; int Rx;
int last0 = _last[0]; int Ra = _last[1];
int last1 = _last[1]; int Rb = _last[1];
int Rc = _last[0];
uint col = 1; uint col = 1;
*_current = _last[1]; *_current = _last[1];
do { do {
if (abs(last1 - Rx) > _near) { if (abs(Rb - Ra) > _near) {
int Px = Rx + last1 - last0; int Px = Ra + Rb - Rc;
if (Px < 0) if (Px < 0)
Px = 0; Px = 0;
else if (Px > _maxval) else if (Px > _maxval)
@ -166,7 +167,7 @@ bool JLS::readLine(BitStream &bs)
} else } else
mes = mes * (_near * 2 + 1); mes = mes * (_near * 2 + 1);
Errval = (Rx < last1) ? mes : -mes; Errval = (Ra < Rb) ? mes : -mes;
Rx = Px + Errval; Rx = Px + Errval;
if (Rx < -_near) if (Rx < -_near)
@ -196,8 +197,8 @@ bool JLS::readLine(BitStream &bs)
} else if (_b[1] > 0) } else if (_b[1] > 0)
_b[1] = ((_b[1] - _n[1]) >> 0xf) & (_b[1] - _n[1]); _b[1] = ((_b[1] - _n[1]) >> 0xf) & (_b[1] - _n[1]);
last0 = last1; Rc = Rb;
last1 = _last[col + 1]; Rb = _last[col + 1];
} else { } else {
quint16 samples; quint16 samples;
if (!processRunMode(bs, _w - col + 1, samples)) if (!processRunMode(bs, _w - col + 1, samples))
@ -207,21 +208,21 @@ bool JLS::readLine(BitStream &bs)
for (int i = 0; i < samples; i++) { for (int i = 0; i < samples; i++) {
if (col > _w) if (col > _w)
return false; return false;
_current[col] = Rx; _current[col] = Ra;
col++; col++;
} }
if (col > _w) if (col > _w)
break; break;
last0 = _last[col]; Rc = _last[col];
last1 = _last[col + 1]; Rb = _last[col + 1];
} else { } else {
last0 = last1; Rc = Rb;
last1 = _last[col + 1]; Rb = _last[col + 1];
} }
rctx = (abs(last0 - Rx) <= _near); rctx = (abs(Rc - Ra) <= _near);
quint16 TEMP = _a[rctx + 2]; quint16 TEMP = _a[rctx + 2];
if (rctx) if (rctx)
TEMP += _n[rctx + 2] >> 1; TEMP += _n[rctx + 2] >> 1;
@ -249,15 +250,15 @@ bool JLS::readLine(BitStream &bs)
Errval *= (_near * 2 + 1); Errval *= (_near * 2 + 1);
if (!rctx) { if (!rctx) {
if (Rx == last0) if (Ra == Rc)
return false; return false;
if (Rx < last0) if (Ra < Rc)
Rx = last0 + Errval; Rx = Rc + Errval;
else else
Rx = last0 - Errval; Rx = Rc - Errval;
} else } else
Rx = Rx + Errval; Rx = Ra + Errval;
if (Rx < -_near) if (Rx < -_near)
Rx += (_near * 2 + 1) * _range; Rx += (_near * 2 + 1) * _range;
@ -279,6 +280,8 @@ bool JLS::readLine(BitStream &bs)
} }
_current[col] = Rx; _current[col] = Rx;
Ra = Rx;
col = col + 1; col = col + 1;
} while (col <= _w); } while (col <= _w);