1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Formatting: miscellaneous.

This patch fixes a few other whitespace and formatting issues which
were pointed out by the bulk-reindent or which I spotted in passing,
some involving manual editing to break lines more nicely.

I think the weirdest hunk in here is the one in windows/window.c
TranslateKey() where _half_ of an assignment statement inside an 'if'
was on the same line as the trailing paren of the if condition. No
idea at all how that one managed to happen!
This commit is contained in:
Simon Tatham 2022-08-03 20:48:46 +01:00
parent 4b8dc56284
commit 9cac27946a
18 changed files with 65 additions and 75 deletions

View File

@ -1,6 +1,6 @@
/*
* Supdup backend
*/
* Supdup backend
*/
#include <stdio.h>
#include <stdlib.h>
@ -10,7 +10,7 @@
/*
* TTYOPT FUNCTION BITS (36-bit bitmasks)
*/
*/
#define TOALT 0200000000000LL // Characters 0175 and 0176 are converted to altmode (0033) on input
#define TOCLC 0100000000000LL // (user option bit) Convert lower-case input to upper-case
#define TOERS 0040000000000LL // Selective erase is supported
@ -671,13 +671,13 @@ static const InteractorVtable Supdup_interactorvt = {
};
/*
* Called to set up the Supdup connection.
*
* Returns an error message, or NULL on success.
*
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
* Called to set up the Supdup connection.
*
* Returns an error message, or NULL on success.
*
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static char *supdup_init(const BackendVtable *x, Seat *seat,
Backend **backend_handle,
LogContext *logctx, Conf *conf,
@ -837,16 +837,16 @@ static void supdup_free(Backend *be)
}
/*
* Reconfigure the Supdup backend.
*/
* Reconfigure the Supdup backend.
*/
static void supdup_reconfig(Backend *be, Conf *conf)
{
/* Nothing to do; SUPDUP cannot be reconfigured while running. */
}
/*
* Called to send data down the Supdup connection.
*/
* Called to send data down the Supdup connection.
*/
static void supdup_send(Backend *be, const char *buf, size_t len)
{
Supdup *supdup = container_of(be, Supdup, backend);
@ -867,8 +867,8 @@ static void supdup_send(Backend *be, const char *buf, size_t len)
}
/*
* Called to query the current socket sendability status.
*/
* Called to query the current socket sendability status.
*/
static size_t supdup_sendbuffer(Backend *be)
{
Supdup *supdup = container_of(be, Supdup, backend);
@ -876,8 +876,8 @@ static size_t supdup_sendbuffer(Backend *be)
}
/*
* Called to set the size of the window from Supdup's POV.
*/
* Called to set the size of the window from Supdup's POV.
*/
static void supdup_size(Backend *be, int width, int height)
{
Supdup *supdup = container_of(be, Supdup, backend);
@ -892,8 +892,8 @@ static void supdup_size(Backend *be, int width, int height)
}
/*
* Send Telnet special codes.
*/
* Send Telnet special codes.
*/
static void supdup_special(Backend *be, SessionSpecialCode code, int arg)
{
}
@ -946,8 +946,8 @@ static int supdup_exitcode(Backend *be)
}
/*
* cfg_info for Dupdup does nothing at all.
*/
* cfg_info for Dupdup does nothing at all.
*/
static int supdup_cfg_info(Backend *be)
{
return 0;

View File

@ -191,7 +191,7 @@ struct Telnet {
enum {
TOP_LEVEL, SEENIAC, SEENWILL, SEENWONT, SEENDO, SEENDONT,
SEENSB, SUBNEGOT, SUBNEG_IAC, SEENCR
SEENSB, SUBNEGOT, SUBNEG_IAC, SEENCR
} state;
Conf *conf;

3
pscp.c
View File

@ -2189,8 +2189,7 @@ static void usage(void)
printf("PuTTY Secure Copy client\n");
printf("%s\n", ver);
printf("Usage: pscp [options] [user@]host:source target\n");
printf(
" pscp [options] source [source...] [user@]host:target\n");
printf(" pscp [options] source [source...] [user@]host:target\n");
printf(" pscp [options] -ls [user@]host:filespec\n");
printf("Options:\n");
printf(" -V print version information and exit\n");

View File

@ -56,7 +56,7 @@ static const gss_OID_desc oids[] = {
*
* The implementation must reserve static storage for a
* gss_OID_desc object containing the value */
{10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04"},
{10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x04"},
/* corresponding to an object-identifier value of {iso(1)
* member-body(2) Unites States(840) mit(113554) infosys(1)
* gssapi(2) generic(1) service_name(4)}. The constant
@ -75,7 +75,7 @@ static const gss_OID_desc oids[] = {
* The implementation must reserve static storage for a
* gss_OID_desc object containing the value */
{6, (void *)"\x2b\x06\x01\x05\x06\x04"},
/* corresponding to an object-identifier value of
/* corresponding to an object-identifier value of
* {1(iso), 3(org), 6(dod), 1(internet), 5(security),
* 6(nametypes), 4(gss-api-exported-name)}. The constant
* GSS_C_NT_EXPORT_NAME should be initialized to point

View File

@ -514,7 +514,7 @@ void portfwd_raw_setup(Channel *pfchan, Socket *s, SshChannel *sc)
}
/*
called when someone connects to the local port
* called when someone connects to the local port
*/
static int pfl_accepting(Plug *p, accept_fn_t constructor, accept_ctx_t ctx)

View File

@ -283,8 +283,7 @@ bool fxp_init(void)
return false;
}
if (remotever > SFTP_PROTO_VERSION) {
fxp_internal_error(
"remote protocol is more advanced than we support");
fxp_internal_error("remote protocol is more advanced than we support");
sftp_pkt_free(pktin);
return false;
}

View File

@ -2192,9 +2192,9 @@ static void ssh2_transport_reconfigure(PacketProtocolLayer *ppl, Conf *conf)
for (i = 0; i < CIPHER_MAX; i++)
if (conf_get_int_int(s->conf, CONF_ssh_cipherlist, i) !=
conf_get_int_int(conf, CONF_ssh_cipherlist, i)) {
rekey_reason = "cipher settings changed";
rekey_mandatory = true;
}
rekey_reason = "cipher settings changed";
rekey_mandatory = true;
}
if (conf_get_bool(s->conf, CONF_ssh2_des_cbc) !=
conf_get_bool(conf, CONF_ssh2_des_cbc)) {
rekey_reason = "cipher settings changed";

View File

@ -870,7 +870,7 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
agentreq = strbuf_new_for_agent_query();
put_byte(agentreq, SSH2_AGENTC_SIGN_REQUEST);
put_stringpl(agentreq, ptrlen_from_strbuf(
s->agent_keys[s->agent_key_index].blob));
s->agent_keys[s->agent_key_index].blob));
/* Now the data to be signed... */
sigdata = strbuf_new();
ssh2_userauth_add_session_id(s, sigdata);
@ -1223,8 +1223,9 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
ppl_logevent("GSSAPI authentication initialisation "
"failed");
if (s->shgss->lib->display_status(s->shgss->lib,
s->shgss->ctx, &s->gss_buf) == SSH_GSS_OK) {
if (s->shgss->lib->display_status(
s->shgss->lib, s->shgss->ctx, &s->gss_buf)
== SSH_GSS_OK) {
ppl_logevent("%s", (char *)s->gss_buf.value);
sfree(s->gss_buf.value);
}

View File

@ -3128,8 +3128,8 @@ static void do_osc(Terminal *term)
{
if (term->osc_w) {
while (term->osc_strlen--)
term->wordness[(unsigned char)
term->osc_string[term->osc_strlen]] = term->esc_args[0];
term->wordness[(unsigned char)term->osc_string[term->osc_strlen]] =
term->esc_args[0];
} else {
term->osc_string[term->osc_strlen] = '\0';
switch (term->esc_args[0]) {
@ -6028,7 +6028,7 @@ static void do_paint(Terminal *term)
if (!term->ansi_colour)
tattr = (tattr & ~(ATTR_FGMASK | ATTR_BGMASK)) |
ATTR_DEFFG | ATTR_DEFBG;
ATTR_DEFFG | ATTR_DEFBG;
if (!term->xterm_256_colour) {
int colour;

View File

@ -586,7 +586,7 @@ static void load_module(
#define TRY_WRAP(fn, pre, post) do \
{ \
static bool done_this_one = false; \
try_wrap_fn(module, fn, pre, post, &done_this_one); \
try_wrap_fn(module, fn, pre, post, &done_this_one); \
} while (0)
if (loaded) {

View File

@ -1575,7 +1575,7 @@ OPTIONAL_PTR_FUNC(string)
static void handle_##fname(BinarySource *_in, strbuf *_out) { \
ARGS_##fname _args = get_args_##fname(_in); \
(void)_args; /* suppress warning if no actual arguments */ \
return_##outtype(_out, JUXTAPOSE2(realname, (__VA_ARGS__))); \
return_##outtype(_out, JUXTAPOSE2(realname, (__VA_ARGS__))); \
}
#include "testcrypt-func.h"
#undef FUNC_INNER

View File

@ -353,7 +353,7 @@ static void show_help(FILE *fp)
" --rsakexkey KEY key for SSH-2 RSA key exchange "
"(in SSH-1 format)\n"
" --userkey KEY public key"
" acceptable for user authentication\n"
" acceptable for user authentication\n"
" --sessiondir DIR cwd for session subprocess (default $HOME)\n"
" --bannertext TEXT send TEXT as SSH-2 auth banner\n"
" --bannerfile FILE send contents of FILE as SSH-2 auth "

View File

@ -1915,11 +1915,10 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
if (event->state & GDK_CONTROL_MASK)
break;
end = 1 + format_small_keypad_key(output+1, inst->term, sk_key,
event->state & GDK_SHIFT_MASK,
event->state & GDK_CONTROL_MASK,
event->state & inst->meta_mod_mask,
&consumed_meta_key);
end = 1 + format_small_keypad_key(
output+1, inst->term, sk_key, event->state & GDK_SHIFT_MASK,
event->state & GDK_CONTROL_MASK,
event->state & inst->meta_mod_mask, &consumed_meta_key);
if (consumed_meta_key)
start = 1; /* supersedes the usual prefixing of Esc */
#ifdef KEY_EVENT_DIAGNOSTICS
@ -1941,11 +1940,10 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
xkey = 'G'; goto arrow_key;
arrow_key:
consumed_meta_key = false;
end = 1 + format_arrow_key(output+1, inst->term, xkey,
event->state & GDK_SHIFT_MASK,
event->state & GDK_CONTROL_MASK,
event->state & inst->meta_mod_mask,
&consumed_meta_key);
end = 1 + format_arrow_key(
output+1, inst->term, xkey, event->state & GDK_SHIFT_MASK,
event->state & GDK_CONTROL_MASK,
event->state & inst->meta_mod_mask, &consumed_meta_key);
if (consumed_meta_key)
start = 1; /* supersedes the usual prefixing of Esc */
#ifdef KEY_EVENT_DIAGNOSTICS

View File

@ -476,7 +476,7 @@ void conf_del_str_str(Conf *conf, int primary, const char *secondary)
del234(conf->tree, entry);
free_entry(entry);
}
}
}
void conf_set_filename(Conf *conf, int primary, const Filename *value)
{

View File

@ -721,8 +721,7 @@ bool set_explicit_app_user_model_id(void)
static HMODULE shell32_module = 0;
if (!shell32_module)
{
if (!shell32_module) {
shell32_module = load_system32_dll("Shell32.dll");
/*
* We can't typecheck this function here, because it's defined
@ -733,11 +732,9 @@ bool set_explicit_app_user_model_id(void)
shell32_module, SetCurrentProcessExplicitAppUserModelID);
}
if (p_SetCurrentProcessExplicitAppUserModelID)
{
if (p_SetCurrentProcessExplicitAppUserModelID) {
const wchar_t *id = get_app_user_model_id();
if (p_SetCurrentProcessExplicitAppUserModelID(id) == S_OK)
{
if (p_SetCurrentProcessExplicitAppUserModelID(id) == S_OK) {
return true;
}
return false;

View File

@ -1166,8 +1166,7 @@ static char *answer_filemapping_message(const char *mapname)
err = dupstr("wrong owning SID of file mapping");
goto cleanup;
}
} else
{
} else {
#ifdef DEBUG_IPC
debug("security APIs not present\n");
#endif

View File

@ -681,7 +681,7 @@ void init_ucs(Conf *conf, struct unicode_data *ucsdata)
for (i = 96; i < 127; i++)
if (!DIRECT_FONT(ucsdata->unitab_xterm[i]))
ucsdata->unitab_xterm[i] =
(WCHAR) (CSET_ACP + poorman_vt100[i - 96]);
(WCHAR) (CSET_ACP + poorman_vt100[i - 96]);
for(i=128;i<256;i++)
if (!DIRECT_FONT(ucsdata->unitab_scoacs[i]))
ucsdata->unitab_scoacs[i] =
@ -724,7 +724,7 @@ wchar_t xlat_uskbd2cyrllic(int ch)
0x0440, 0x0448, 0x043e, 0x043b, 0x0434, 0x044c, 0x0442, 0x0449,
0x0437, 0x0439, 0x043a, 0x044b, 0x0435, 0x0433, 0x043c, 0x0446,
0x0447, 0x043d, 0x044f, 0x0425, 0x0407, 0x042a, 126, 127
};
};
return cyrtab[ch&0x7F];
}

View File

@ -1494,10 +1494,9 @@ static void init_fonts(int pick_width, int pick_height)
/* !!! Yes the next line is right */
if (cset == OEM_CHARSET)
ucsdata.font_codepage = GetOEMCP();
else
if (TranslateCharsetInfo ((DWORD *)(ULONG_PTR)cset,
&info, TCI_SRCCHARSET))
ucsdata.font_codepage = info.ciACP;
else if (TranslateCharsetInfo ((DWORD *)(ULONG_PTR)cset,
&info, TCI_SRCCHARSET))
ucsdata.font_codepage = info.ciACP;
else
ucsdata.font_codepage = -1;
@ -2040,10 +2039,10 @@ static Mouse_Button translate_button(Mouse_Button button)
return MBT_SELECT;
if (button == MBT_MIDDLE)
return conf_get_int(conf, CONF_mouse_is_xterm) == 1 ?
MBT_PASTE : MBT_EXTEND;
MBT_PASTE : MBT_EXTEND;
if (button == MBT_RIGHT)
return conf_get_int(conf, CONF_mouse_is_xterm) == 1 ?
MBT_EXTEND : MBT_PASTE;
MBT_EXTEND : MBT_PASTE;
return 0; /* shouldn't happen */
}
@ -3819,9 +3818,7 @@ static void do_text_internal(
MultiByteToWideChar(ucsdata.font_codepage, MB_USEGLYPHCHARS,
dbcstext, 2, uni_buf+nlen, 1);
mptr++;
}
else
{
} else {
char dbcstext[1];
dbcstext[0] = text[mptr] & 0xFF;
MultiByteToWideChar(ucsdata.font_codepage, MB_USEGLYPHCHARS,
@ -4301,9 +4298,9 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
}
if (wParam == compose_keycode) {
if (compose_state == 0
&& (HIWORD(lParam) & (KF_UP | KF_REPEAT)) == 0) compose_state =
1;
if (compose_state == 0 &&
(HIWORD(lParam) & (KF_UP | KF_REPEAT)) == 0)
compose_state = 1;
else if (compose_state == 1 && (HIWORD(lParam) & KF_UP))
compose_state = 2;
else