From 9cac27946ac59e5954db1f6d4a41f63accc9bcb6 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 3 Aug 2022 20:48:46 +0100 Subject: [PATCH] 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! --- otherbackends/supdup.c | 44 +++++++++++++++++++++--------------------- otherbackends/telnet.c | 2 +- pscp.c | 3 +-- ssh/pgssapi.c | 4 ++-- ssh/portfwd.c | 2 +- ssh/sftp.c | 3 +-- ssh/transport2.c | 6 +++--- ssh/userauth2-client.c | 7 ++++--- terminal/terminal.c | 6 +++--- test/sclog/sclog.c | 2 +- test/testcrypt.c | 2 +- unix/uppity.c | 2 +- unix/window.c | 18 ++++++++--------- utils/conf.c | 2 +- windows/jump-list.c | 9 +++------ windows/pageant.c | 3 +-- windows/unicode.c | 4 ++-- windows/window.c | 21 +++++++++----------- 18 files changed, 65 insertions(+), 75 deletions(-) diff --git a/otherbackends/supdup.c b/otherbackends/supdup.c index 3479f0f9..688befd2 100644 --- a/otherbackends/supdup.c +++ b/otherbackends/supdup.c @@ -1,6 +1,6 @@ /* -* Supdup backend -*/ + * Supdup backend + */ #include #include @@ -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; diff --git a/otherbackends/telnet.c b/otherbackends/telnet.c index 50945b86..23b7fc9e 100644 --- a/otherbackends/telnet.c +++ b/otherbackends/telnet.c @@ -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; diff --git a/pscp.c b/pscp.c index 7e26fa40..77de1cd9 100644 --- a/pscp.c +++ b/pscp.c @@ -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"); diff --git a/ssh/pgssapi.c b/ssh/pgssapi.c index 9d33220f..1f54d805 100644 --- a/ssh/pgssapi.c +++ b/ssh/pgssapi.c @@ -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 diff --git a/ssh/portfwd.c b/ssh/portfwd.c index 11544564..b4eea3c9 100644 --- a/ssh/portfwd.c +++ b/ssh/portfwd.c @@ -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) diff --git a/ssh/sftp.c b/ssh/sftp.c index 7debf94c..00072f13 100644 --- a/ssh/sftp.c +++ b/ssh/sftp.c @@ -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; } diff --git a/ssh/transport2.c b/ssh/transport2.c index ab5902b9..705df466 100644 --- a/ssh/transport2.c +++ b/ssh/transport2.c @@ -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"; diff --git a/ssh/userauth2-client.c b/ssh/userauth2-client.c index a7cb803f..5f7a9b52 100644 --- a/ssh/userauth2-client.c +++ b/ssh/userauth2-client.c @@ -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); } diff --git a/terminal/terminal.c b/terminal/terminal.c index d4d0bde3..4ecfcab5 100644 --- a/terminal/terminal.c +++ b/terminal/terminal.c @@ -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; diff --git a/test/sclog/sclog.c b/test/sclog/sclog.c index d8e61a05..d5304a01 100644 --- a/test/sclog/sclog.c +++ b/test/sclog/sclog.c @@ -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) { diff --git a/test/testcrypt.c b/test/testcrypt.c index fcc116f0..cb4e6b81 100644 --- a/test/testcrypt.c +++ b/test/testcrypt.c @@ -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 diff --git a/unix/uppity.c b/unix/uppity.c index 84d332c0..11fead95 100644 --- a/unix/uppity.c +++ b/unix/uppity.c @@ -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 " diff --git a/unix/window.c b/unix/window.c index 624ecc48..1958edde 100644 --- a/unix/window.c +++ b/unix/window.c @@ -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 diff --git a/utils/conf.c b/utils/conf.c index 246dc3eb..53195180 100644 --- a/utils/conf.c +++ b/utils/conf.c @@ -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) { diff --git a/windows/jump-list.c b/windows/jump-list.c index 66df3510..47c41a04 100644 --- a/windows/jump-list.c +++ b/windows/jump-list.c @@ -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; diff --git a/windows/pageant.c b/windows/pageant.c index fb2a1fec..507e5c96 100644 --- a/windows/pageant.c +++ b/windows/pageant.c @@ -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 diff --git a/windows/unicode.c b/windows/unicode.c index eaa6190d..72c35ea6 100644 --- a/windows/unicode.c +++ b/windows/unicode.c @@ -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]; } diff --git a/windows/window.c b/windows/window.c index dad6648c..99acdbf2 100644 --- a/windows/window.c +++ b/windows/window.c @@ -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