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

Formatting: normalise to put a space after condition keywords.

'if (thing)' is the local style here, not 'if(thing)'. Similarly with
'for' and 'while'.
This commit is contained in:
Simon Tatham 2022-12-28 15:32:24 +00:00
parent 6fcc7ed728
commit d509a2dc1e
10 changed files with 39 additions and 39 deletions

View File

@ -2160,7 +2160,7 @@ void term_free(Terminal *term)
sfree(beep);
}
bufchain_clear(&term->inbuf);
if(term->print_job)
if (term->print_job)
printer_finish_job(term->print_job);
bufchain_clear(&term->printer_buf);
sfree(term->paste_buffer);
@ -5037,7 +5037,7 @@ static void term_out(Terminal *term, bool called_from_term_data)
int i = def(term->esc_args[0], 1);
pos old_curs = term->curs;
for(;i>0 && term->curs.x>0; i--) {
for (; i>0 && term->curs.x>0; i--) {
do {
term->curs.x--;
} while (term->curs.x >0 &&
@ -5841,7 +5841,7 @@ static termchar *term_bidi_line(Terminal *term, struct termline *ldata,
bidi_char);
}
for(it=0; it<term->cols ; it++)
for (it=0; it<term->cols ; it++)
{
unsigned long uc = (ldata->chars[it].chr);
@ -5896,10 +5896,10 @@ static termchar *term_bidi_line(Terminal *term, struct termline *ldata,
nbc++;
}
if(!term->no_bidi)
if (!term->no_bidi)
do_bidi(term->bidi_ctx, term->wcFrom, nbc);
if(!term->no_arabicshaping) {
if (!term->no_arabicshaping) {
do_shape(term->wcFrom, term->wcTo, nbc);
} else {
/* If we're not calling do_shape, we must copy the

View File

@ -254,7 +254,7 @@ int read_dupsession_data(Conf *conf, char *arg)
}
static void help(FILE *fp) {
if(fprintf(fp,
if (fprintf(fp,
"pterm option summary:\n"
"\n"
" --display DISPLAY Specify X display to use (note '--')\n"
@ -282,8 +282,8 @@ static void help(FILE *fp) {
static void version(FILE *fp) {
char *buildinfo_text = buildinfo("\n");
if(fprintf(fp, "%s: %s\n%s\n", appname, ver, buildinfo_text) < 0 ||
fflush(fp) < 0) {
if (fprintf(fp, "%s: %s\n%s\n", appname, ver, buildinfo_text) < 0 ||
fflush(fp) < 0) {
perror("output error");
exit(1);
}
@ -520,11 +520,11 @@ bool do_cmdline(int argc, char **argv, bool do_everything, Conf *conf)
EXPECTS_ARG;
provide_xrm_string(val, appname);
} else if(!strcmp(p, "-help") || !strcmp(p, "--help")) {
} else if (!strcmp(p, "-help") || !strcmp(p, "--help")) {
help(stdout);
exit(0);
} else if(!strcmp(p, "-version") || !strcmp(p, "--version")) {
} else if (!strcmp(p, "-version") || !strcmp(p, "--version")) {
version(stdout);
exit(0);

View File

@ -149,7 +149,7 @@ static char *plink_get_ttymode(Seat *seat, const char *mode)
do { \
if (strcmp(mode, ourname) == 0) \
return get_ttychar(&orig_termios, uxname); \
} while(0)
} while (0)
#define GET_BOOL(ourname, uxname, uxmemb, transform) \
do { \
if (strcmp(mode, ourname) == 0) { \

View File

@ -14,7 +14,7 @@ void block_signal(int sig, bool block_it)
sigemptyset(&ss);
sigaddset(&ss, sig);
if(sigprocmask(block_it ? SIG_BLOCK : SIG_UNBLOCK, &ss, 0) < 0) {
if (sigprocmask(block_it ? SIG_BLOCK : SIG_UNBLOCK, &ss, 0) < 0) {
perror("sigprocmask");
exit(1);
}

View File

@ -21,10 +21,10 @@ void (*putty_signal(int sig, void (*func)(int)))(int)
struct sigaction old;
sa.sa_handler = func;
if(sigemptyset(&sa.sa_mask) < 0)
if (sigemptyset(&sa.sa_mask) < 0)
return SIG_ERR;
sa.sa_flags = SA_RESTART;
if(sigaction(sig, &sa, &old) < 0)
if (sigaction(sig, &sa, &old) < 0)
return SIG_ERR;
return old.sa_handler;
}

View File

@ -26,7 +26,7 @@
if (uli.QuadPart != 0) \
uli.QuadPart = uli.QuadPart / CNS_PERSEC - UNIX_EPOCH; \
(t) = (time_t) uli.QuadPart; \
} while(0)
} while (0)
/* Windows code to set up the GSSAPI library list. */
@ -142,7 +142,7 @@ struct ssh_gss_liblist *ssh_gss_setup(Conf *conf)
char *installdir = get_reg_sz(regkey, "InstallDir");
if (installdir) {
char *bindir = dupcat(installdir, "\\bin");
if(p_AddDllDirectory) {
if (p_AddDllDirectory) {
/* Add MIT Kerberos' path to the DLL search path,
* it loads its own DLLs further down the road */
wchar_t *dllPath = dup_mb_to_wc(DEFAULT_CODEPAGE, 0, bindir);
@ -235,7 +235,7 @@ struct ssh_gss_liblist *ssh_gss_setup(Conf *conf)
module = NULL;
path = conf_get_filename(conf, CONF_ssh_gss_custom)->path;
if (*path) {
if(p_AddDllDirectory) {
if (p_AddDllDirectory) {
/* Add the custom directory as well in case it chainloads
* some other DLLs (e.g a non-installed MIT Kerberos
* instance) */

View File

@ -559,7 +559,7 @@ static void prompt_add_keyfile(bool encrypted)
of.lpstrTitle = "Select Private Key File";
of.Flags = OFN_ALLOWMULTISELECT | OFN_EXPLORER;
if (request_file(keypath, &of, true, false)) {
if(strlen(filelist) > of.nFileOffset) {
if (strlen(filelist) > of.nFileOffset) {
/* Only one filename returned? */
Filename *fn = filename_from_str(filelist);
win_add_keyfile(fn, encrypted);
@ -804,7 +804,7 @@ static INT_PTR CALLBACK KeyListProc(HWND hwnd, UINT msg,
/* do the same for the rsa keys */
for (i = rCount - 1; (itemNum >= 0) && (i >= 0); i--) {
if(selectedArray[itemNum] == i) {
if (selectedArray[itemNum] == i) {
switch (LOWORD(wParam)) {
case IDC_KEYLIST_REMOVE:
pageant_delete_nth_ssh1_key(i);
@ -909,10 +909,10 @@ static void update_sessions(void)
if (!putty_path)
return;
if(ERROR_SUCCESS != RegOpenKey(HKEY_CURRENT_USER, PUTTY_REGKEY, &hkey))
if (ERROR_SUCCESS != RegOpenKey(HKEY_CURRENT_USER, PUTTY_REGKEY, &hkey))
return;
for(num_entries = GetMenuItemCount(session_menu);
for (num_entries = GetMenuItemCount(session_menu);
num_entries > initial_menuitems_count;
num_entries--)
RemoveMenu(session_menu, 0, MF_BYPOSITION);
@ -921,8 +921,8 @@ static void update_sessions(void)
index_menu = 0;
sb = strbuf_new();
while(ERROR_SUCCESS == RegEnumKey(hkey, index_key, buf, MAX_PATH)) {
if(strcmp(buf, PUTTY_DEFAULT) != 0) {
while (ERROR_SUCCESS == RegEnumKey(hkey, index_key, buf, MAX_PATH)) {
if (strcmp(buf, PUTTY_DEFAULT) != 0) {
strbuf_clear(sb);
unescape_registry_key(buf, sb);
@ -942,7 +942,7 @@ static void update_sessions(void)
RegCloseKey(hkey);
if(index_menu == 0) {
if (index_menu == 0) {
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_TYPE | MIIM_STATE;
mii.fType = MFT_STRING;
@ -1311,8 +1311,8 @@ static LRESULT CALLBACK TrayWndProc(HWND hwnd, UINT message,
if (restrict_putty_acl)
strcat(cmdline, "&R");
if((INT_PTR)ShellExecute(hwnd, NULL, putty_path, cmdline,
_T(""), SW_SHOW) <= 32) {
if ((INT_PTR)ShellExecute(hwnd, NULL, putty_path, cmdline,
_T(""), SW_SHOW) <= 32) {
MessageBox(NULL, "Unable to execute PuTTY!",
"Error", MB_OK | MB_ICONERROR);
}
@ -1371,7 +1371,7 @@ static LRESULT CALLBACK TrayWndProc(HWND hwnd, UINT message,
launch_help(hwnd, WINHELP_CTX_pageant_general);
break;
default: {
if(wParam >= IDM_SESSIONS_BASE && wParam <= IDM_SESSIONS_MAX) {
if (wParam >= IDM_SESSIONS_BASE && wParam <= IDM_SESSIONS_MAX) {
MENUITEMINFO mii;
TCHAR buf[MAX_PATH + 1];
TCHAR param[MAX_PATH + 1];
@ -1386,8 +1386,8 @@ static LRESULT CALLBACK TrayWndProc(HWND hwnd, UINT message,
strcat(param, "&R");
strcat(param, "@");
strcat(param, mii.dwTypeData);
if((INT_PTR)ShellExecute(hwnd, NULL, putty_path, param,
_T(""), SW_SHOW) <= 32) {
if ((INT_PTR)ShellExecute(hwnd, NULL, putty_path, param,
_T(""), SW_SHOW) <= 32) {
MessageBox(NULL, "Unable to execute PuTTY!", "Error",
MB_OK | MB_ICONERROR);
}
@ -1835,7 +1835,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
args = strchr(command, ' ');
if (args) {
*args++ = 0;
while(*args && isspace(*args)) args++;
while (*args && isspace(*args)) args++;
}
spawn_cmd(command, args, show);
}

View File

@ -86,14 +86,14 @@ static inline uint64_t uint64_from_words(uint32_t hi, uint32_t lo)
uli.QuadPart = ((ULONGLONG)(t) + 11644473600ull) * 10000000ull; \
(ft).dwLowDateTime = uli.LowPart; \
(ft).dwHighDateTime = uli.HighPart; \
} while(0)
} while (0)
#define TIME_WIN_TO_POSIX(ft, t) do { \
ULARGE_INTEGER uli; \
uli.LowPart = (ft).dwLowDateTime; \
uli.HighPart = (ft).dwHighDateTime; \
uli.QuadPart = uli.QuadPart / 10000000ull - 11644473600ull; \
(t) = (unsigned long) uli.QuadPart; \
} while(0)
} while (0)
struct RFile {
HANDLE h;

View File

@ -682,7 +682,7 @@ void init_ucs(Conf *conf, struct unicode_data *ucsdata)
if (!DIRECT_FONT(ucsdata->unitab_xterm[i]))
ucsdata->unitab_xterm[i] =
(WCHAR) (CSET_ACP + poorman_vt100[i - 96]);
for(i=128;i<256;i++)
for (i = 128; i < 256; i++)
if (!DIRECT_FONT(ucsdata->unitab_scoacs[i]))
ucsdata->unitab_scoacs[i] =
(WCHAR) (CSET_ACP + poorman_scoacs[i - 128]);
@ -695,7 +695,7 @@ static void link_font(WCHAR *line_tbl, WCHAR *font_tbl, WCHAR attr)
for (line_index = 0; line_index < 256; line_index++) {
if (DIRECT_FONT(line_tbl[line_index]))
continue;
for(i = 0; i < 256; i++) {
for (i = 0; i < 256; i++) {
font_index = ((32 + i) & 0xFF);
if (line_tbl[line_index] == font_tbl[font_index]) {
line_tbl[line_index] = (WCHAR) (attr + font_index);

View File

@ -2550,7 +2550,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
* `ready to appear' state.
*/
show_mouseptr(wgs, true); /* make sure pointer is visible */
if( lParam == 0 )
if (lParam == 0)
PostMessage(hwnd, WM_CHAR, ' ', 0);
break;
case IDM_FULLSCREEN:
@ -3792,7 +3792,7 @@ static void do_text_internal(
uni_buf = snewn(uni_len, wchar_t);
}
for(nlen = mptr = 0; mptr<len; mptr++) {
for (nlen = mptr = 0; mptr<len; mptr++) {
uni_buf[nlen] = 0xFFFD;
if (IsDBCSLeadByteEx(wgs->ucsdata.font_codepage,
(BYTE) text[mptr])) {
@ -4673,8 +4673,8 @@ static int TranslateKey(WinGuiSeat *wgs, UINT message, WPARAM wParam,
bool capsOn = false;
/* helg: clear CAPS LOCK state if caps lock switches to cyrillic */
if(keystate[VK_CAPITAL] != 0 &&
conf_get_bool(wgs->conf, CONF_xlat_capslockcyr)) {
if (keystate[VK_CAPITAL] != 0 &&
conf_get_bool(wgs->conf, CONF_xlat_capslockcyr)) {
capsOn = !left_alt;
keystate[VK_CAPITAL] = 0;
}
@ -4778,7 +4778,7 @@ static int TranslateKey(WinGuiSeat *wgs, UINT message, WPARAM wParam,
term_keyinputw(wgs->term, &wch, 1);
}
} else {
if(capsOn && wch < 0x80) {
if (capsOn && wch < 0x80) {
WCHAR cbuf[2];
cbuf[0] = 27;
cbuf[1] = xlat_uskbd2cyrllic(wch);