stepcompress: Improve check_line() error messages

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-03-12 12:29:20 -04:00
parent 9bb8b0c622
commit 0041a0079d
1 changed files with 13 additions and 8 deletions

View File

@ -233,16 +233,18 @@ check_line(struct stepcompress *sc, struct step_move move)
if (move.count == 1) { if (move.count == 1) {
if (move.interval != (uint32_t)(*sc->queue_pos - sc->last_step_clock) if (move.interval != (uint32_t)(*sc->queue_pos - sc->last_step_clock)
|| *sc->queue_pos < sc->last_step_clock) { || *sc->queue_pos < sc->last_step_clock) {
errorf("Count 1 point out of range: %d %d %d" errorf("stepcompress o=%d i=%d c=%d a=%d:"
, move.interval, move.count, move.add); " Count 1 point out of range (%lld)"
, sc->oid, move.interval, move.count, move.add
, (long long)(*sc->queue_pos - sc->last_step_clock));
return ERROR_RET; return ERROR_RET;
} }
return 0; return 0;
} }
if (!move.count || (!move.interval && !move.add) if (!move.count || (!move.interval && !move.add)
|| move.interval >= 0x80000000) { || move.interval >= 0x80000000) {
errorf("Point out of range: %d %d %d" errorf("stepcompress o=%d i=%d c=%d a=%d: Invalid sequence"
, move.interval, move.count, move.add); , sc->oid, move.interval, move.count, move.add);
return ERROR_RET; return ERROR_RET;
} }
uint32_t interval = move.interval, p = 0; uint32_t interval = move.interval, p = 0;
@ -251,13 +253,16 @@ check_line(struct stepcompress *sc, struct step_move move)
struct points point = minmax_point(sc, sc->queue_pos + i); struct points point = minmax_point(sc, sc->queue_pos + i);
p += interval; p += interval;
if (p < point.minp || p > point.maxp) { if (p < point.minp || p > point.maxp) {
errorf("Point %d of %d: %d not in %d:%d" errorf("stepcompress o=%d i=%d c=%d a=%d: Point %d: %d not in %d:%d"
, i+1, move.count, p, point.minp, point.maxp); , sc->oid, move.interval, move.count, move.add
, i+1, p, point.minp, point.maxp);
return ERROR_RET; return ERROR_RET;
} }
if (interval >= 0x80000000) { if (interval >= 0x80000000) {
errorf("Point %d of %d: interval overflow %d" errorf("stepcompress o=%d i=%d c=%d a=%d:"
, i+1, move.count, interval); " Point %d: interval overflow %d"
, sc->oid, move.interval, move.count, move.add
, i+1, interval);
return ERROR_RET; return ERROR_RET;
} }
interval += move.add; interval += move.add;