mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Fix bit rot in TERM_CC_DIAGS ifdef.
This is a piece of conditioned-out code that I haven't used since I originally invented the compressed scrollback format, which decompressed every scrollback line immediately after compressing it to check that the round-trip conversion worked. Now I have occasion to actually use it, I find that (of course) changes around it have made it not quite work any more: the thing the diagnostic code is passing to decompressline hasn't had its length field filled in yet, because that gets done 20 lines later. Now you can compile with -DTERM_CC_DIAGS again, and it doesn't crash _unless_ it detects the actual bug it was intended to spot.
This commit is contained in:
parent
65383082bf
commit
150089ac16
11
terminal.c
11
terminal.c
@ -723,6 +723,11 @@ static compressed_scrollback_line *compressline(termline *ldata)
|
||||
makerle(b, ldata, makeliteral_truecolour);
|
||||
makerle(b, ldata, makeliteral_cc);
|
||||
|
||||
size_t linelen = b->len - sizeof(compressed_scrollback_line);
|
||||
compressed_scrollback_line *line =
|
||||
(compressed_scrollback_line *)strbuf_to_str(b);
|
||||
line->len = linelen;
|
||||
|
||||
/*
|
||||
* Diagnostics: ensure that the compressed data really does
|
||||
* decompress to the right thing.
|
||||
@ -742,7 +747,7 @@ static compressed_scrollback_line *compressline(termline *ldata)
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
dcl = decompressline((compressed_scrollback_line *)b->u);
|
||||
dcl = decompressline(line);
|
||||
assert(ldata->cols == dcl->cols);
|
||||
assert(ldata->lattr == dcl->lattr);
|
||||
for (i = 0; i < ldata->cols; i++)
|
||||
@ -759,10 +764,6 @@ static compressed_scrollback_line *compressline(termline *ldata)
|
||||
#endif
|
||||
#endif /* TERM_CC_DIAGS */
|
||||
|
||||
size_t linelen = b->len - sizeof(compressed_scrollback_line);
|
||||
compressed_scrollback_line *line =
|
||||
(compressed_scrollback_line *)strbuf_to_str(b);
|
||||
line->len = linelen;
|
||||
return line;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user