mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 14:39:24 -05:00
Remove a completely unused loop in RTF pasting.
In commit d07d7d66f662b67 I rewrote the code that constructs RTF paste data so that it uses a strbuf, in place of the previous ad-hoc code that counted up the lengths of pieces of RTF in advance in order to realloc the buffer. But apparently I left in an entire loop whose job was to count up one of those lengths, failing to notice that it's now completely pointless because its output value is never needed! Happily a clang upgrade has just improved the 'variable set but not used' warning to the point where it can spot that. I expect previously the variable still counted as 'used' because each increment of it used the previous value.
This commit is contained in:
parent
775d969ca8
commit
6a27ae772c
@ -5048,7 +5048,7 @@ static void wintw_clip_write(
|
|||||||
unsigned char *tdata = (unsigned char *)lock2;
|
unsigned char *tdata = (unsigned char *)lock2;
|
||||||
wchar_t *udata = (wchar_t *)lock;
|
wchar_t *udata = (wchar_t *)lock;
|
||||||
int uindex = 0, tindex = 0;
|
int uindex = 0, tindex = 0;
|
||||||
int multilen, blen, alen, totallen, i;
|
int multilen, blen, alen, i;
|
||||||
char before[16], after[4];
|
char before[16], after[4];
|
||||||
int fgcolour, lastfgcolour = -1;
|
int fgcolour, lastfgcolour = -1;
|
||||||
int bgcolour, lastbgcolour = -1;
|
int bgcolour, lastbgcolour = -1;
|
||||||
@ -5338,19 +5338,6 @@ static void wintw_clip_write(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(tindex + multilen <= len2);
|
assert(tindex + multilen <= len2);
|
||||||
totallen = blen + alen;
|
|
||||||
for (i = 0; i < multilen; i++) {
|
|
||||||
if (tdata[tindex+i] == '\\' ||
|
|
||||||
tdata[tindex+i] == '{' ||
|
|
||||||
tdata[tindex+i] == '}')
|
|
||||||
totallen += 2;
|
|
||||||
else if (tdata[tindex+i] == 0x0D || tdata[tindex+i] == 0x0A)
|
|
||||||
totallen += 6; /* \par\r\n */
|
|
||||||
else if (tdata[tindex+i] > 0x7E || tdata[tindex+i] < 0x20)
|
|
||||||
totallen += 4;
|
|
||||||
else
|
|
||||||
totallen++;
|
|
||||||
}
|
|
||||||
|
|
||||||
put_data(rtf, before, blen);
|
put_data(rtf, before, blen);
|
||||||
for (i = 0; i < multilen; i++) {
|
for (i = 0; i < multilen; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user