mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -05:00
Formatting: normalise back to 4-space indentation.
In several pieces of development recently I've run across the occasional code block in the middle of a function which suddenly switched to 2-space indent from this code base's usual 4. I decided I was tired of it, so I ran the whole code base through a re-indenter, which made a huge mess, and then manually sifted out the changes that actually made sense from that pass. Indeed, this caught quite a few large sections with 2-space indent level, a couple with 8, and a handful of even weirder things like 3 spaces or 12. This commit fixes them all.
This commit is contained in:
@ -150,9 +150,9 @@ static int cmpfortree(void *av, void *bv)
|
||||
if (as > bs)
|
||||
return +1;
|
||||
if (a < b)
|
||||
return -1;
|
||||
return -1;
|
||||
if (a > b)
|
||||
return +1;
|
||||
return +1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -655,14 +655,14 @@ static int try_connect(NetSocket *sock)
|
||||
} else {
|
||||
err = errno;
|
||||
if (err != EADDRINUSE) /* failed, for a bad reason */
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
if (localport == 0)
|
||||
break; /* we're only looping once */
|
||||
break; /* we're only looping once */
|
||||
localport--;
|
||||
if (localport == 0)
|
||||
break; /* we might have got to the end */
|
||||
break; /* we might have got to the end */
|
||||
}
|
||||
|
||||
if (err)
|
||||
|
98
unix/plink.c
98
unix/plink.c
@ -442,57 +442,57 @@ static void from_tty(void *vbuf, unsigned len)
|
||||
p = buf; end = buf + len;
|
||||
while (p < end) {
|
||||
switch (state) {
|
||||
case NORMAL:
|
||||
if (*p == '\xff') {
|
||||
p++;
|
||||
state = FF;
|
||||
} else {
|
||||
q = memchr(p, '\xff', end - p);
|
||||
if (q == NULL) q = end;
|
||||
backend_send(backend, p, q - p);
|
||||
p = q;
|
||||
}
|
||||
break;
|
||||
case FF:
|
||||
if (*p == '\xff') {
|
||||
backend_send(backend, p, 1);
|
||||
p++;
|
||||
state = NORMAL;
|
||||
} else if (*p == '\0') {
|
||||
p++;
|
||||
state = FF00;
|
||||
} else abort();
|
||||
break;
|
||||
case FF00:
|
||||
if (*p == '\0') {
|
||||
backend_special(backend, SS_BRK, 0);
|
||||
} else {
|
||||
/*
|
||||
* Pretend that PARMRK wasn't set. This involves
|
||||
* faking what INPCK and IGNPAR would have done if
|
||||
* we hadn't overridden them. Unfortunately, we
|
||||
* can't do this entirely correctly because INPCK
|
||||
* distinguishes between framing and parity
|
||||
* errors, but PARMRK format represents both in
|
||||
* the same way. We assume that parity errors are
|
||||
* more common than framing errors, and hence
|
||||
* treat all input errors as being subject to
|
||||
* INPCK.
|
||||
*/
|
||||
if (orig_termios.c_iflag & INPCK) {
|
||||
/* If IGNPAR is set, we throw away the character. */
|
||||
if (!(orig_termios.c_iflag & IGNPAR)) {
|
||||
/* PE/FE get passed on as NUL. */
|
||||
*p = 0;
|
||||
backend_send(backend, p, 1);
|
||||
}
|
||||
} else {
|
||||
/* INPCK not set. Assume we got a parity error. */
|
||||
backend_send(backend, p, 1);
|
||||
}
|
||||
}
|
||||
case NORMAL:
|
||||
if (*p == '\xff') {
|
||||
p++;
|
||||
state = FF;
|
||||
} else {
|
||||
q = memchr(p, '\xff', end - p);
|
||||
if (q == NULL) q = end;
|
||||
backend_send(backend, p, q - p);
|
||||
p = q;
|
||||
}
|
||||
break;
|
||||
case FF:
|
||||
if (*p == '\xff') {
|
||||
backend_send(backend, p, 1);
|
||||
p++;
|
||||
state = NORMAL;
|
||||
} else if (*p == '\0') {
|
||||
p++;
|
||||
state = FF00;
|
||||
} else abort();
|
||||
break;
|
||||
case FF00:
|
||||
if (*p == '\0') {
|
||||
backend_special(backend, SS_BRK, 0);
|
||||
} else {
|
||||
/*
|
||||
* Pretend that PARMRK wasn't set. This involves
|
||||
* faking what INPCK and IGNPAR would have done if
|
||||
* we hadn't overridden them. Unfortunately, we
|
||||
* can't do this entirely correctly because INPCK
|
||||
* distinguishes between framing and parity
|
||||
* errors, but PARMRK format represents both in
|
||||
* the same way. We assume that parity errors are
|
||||
* more common than framing errors, and hence
|
||||
* treat all input errors as being subject to
|
||||
* INPCK.
|
||||
*/
|
||||
if (orig_termios.c_iflag & INPCK) {
|
||||
/* If IGNPAR is set, we throw away the character. */
|
||||
if (!(orig_termios.c_iflag & IGNPAR)) {
|
||||
/* PE/FE get passed on as NUL. */
|
||||
*p = 0;
|
||||
backend_send(backend, p, 1);
|
||||
}
|
||||
} else {
|
||||
/* INPCK not set. Assume we got a parity error. */
|
||||
backend_send(backend, p, 1);
|
||||
}
|
||||
}
|
||||
p++;
|
||||
state = NORMAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user