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

Formatting: standardise on "func(\n", not "func\n(".

If the function name (or expression) in a function call or declaration
is itself so long that even the first argument doesn't fit after it on
the same line, or if that would leave so little space that it would be
silly to try to wrap all the run-on lines into a tall thin column,
then I used to do this

    ludicrously_long_function_name
        (arg1, arg2, arg3);

and now prefer this

    ludicrously_long_function_name(
        arg1, arg2, arg3);

I picked up the habit from Python, where the latter idiom is required
by Python's syntactic significance of newlines (you can write the
former if you use a backslash-continuation, but pretty much everyone
seems to agree that that's much uglier). But I've found it works well
in C as well: it makes it more obvious that the previous line is
incomplete, it gives you a tiny bit more space to wrap the following
lines into (the old idiom indents the _third_ line one space beyond
the second), and I generally turn out to agree with the knock-on
indentation decisions made by at least Emacs if you do it in the
middle of a complex expression. Plus, of course, using the _same_
idiom between C and Python means less state-switching.

So, while I'm making annoying indentation changes in general, this
seems like a good time to dig out all the cases of the old idiom in
this code, and switch them over to the new.
This commit is contained in:
Simon Tatham 2022-08-03 20:48:46 +01:00
parent 04c1617f20
commit 14203bc54f
17 changed files with 268 additions and 271 deletions

4
pscp.c
View File

@ -2189,8 +2189,8 @@ 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

@ -283,8 +283,8 @@ 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

@ -530,8 +530,8 @@ void sharestate_free(ssh_sharing_state *sharestate)
sfree(sharestate);
}
static struct share_halfchannel *share_add_halfchannel
(struct ssh_sharing_connstate *cs, unsigned server_id)
static struct share_halfchannel *share_add_halfchannel(
struct ssh_sharing_connstate *cs, unsigned server_id)
{
struct share_halfchannel *hc = snew(struct share_halfchannel);
hc->server_id = server_id;
@ -544,8 +544,8 @@ static struct share_halfchannel *share_add_halfchannel
}
}
static struct share_halfchannel *share_find_halfchannel
(struct ssh_sharing_connstate *cs, unsigned server_id)
static struct share_halfchannel *share_find_halfchannel(
struct ssh_sharing_connstate *cs, unsigned server_id)
{
struct share_halfchannel dummyhc;
dummyhc.server_id = server_id;
@ -559,8 +559,8 @@ static void share_remove_halfchannel(struct ssh_sharing_connstate *cs,
sfree(hc);
}
static struct share_channel *share_add_channel
(struct ssh_sharing_connstate *cs, unsigned downstream_id,
static struct share_channel *share_add_channel(
struct ssh_sharing_connstate *cs, unsigned downstream_id,
unsigned upstream_id, unsigned server_id, int state, int maxpkt)
{
struct share_channel *chan = snew(struct share_channel);
@ -598,16 +598,16 @@ static void share_channel_set_server_id(struct ssh_sharing_connstate *cs,
add234(cs->channels_by_server, chan);
}
static struct share_channel *share_find_channel_by_upstream
(struct ssh_sharing_connstate *cs, unsigned upstream_id)
static struct share_channel *share_find_channel_by_upstream(
struct ssh_sharing_connstate *cs, unsigned upstream_id)
{
struct share_channel dummychan;
dummychan.upstream_id = upstream_id;
return find234(cs->channels_by_us, &dummychan, NULL);
}
static struct share_channel *share_find_channel_by_server
(struct ssh_sharing_connstate *cs, unsigned server_id)
static struct share_channel *share_find_channel_by_server(
struct ssh_sharing_connstate *cs, unsigned server_id)
{
struct share_channel dummychan;
dummychan.server_id = server_id;
@ -626,9 +626,8 @@ static void share_remove_channel(struct ssh_sharing_connstate *cs,
sfree(chan);
}
static struct share_xchannel *share_add_xchannel
(struct ssh_sharing_connstate *cs,
unsigned upstream_id, unsigned server_id)
static struct share_xchannel *share_add_xchannel(
struct ssh_sharing_connstate *cs, unsigned upstream_id, unsigned server_id)
{
struct share_xchannel *xc = snew(struct share_xchannel);
xc->upstream_id = upstream_id;
@ -647,16 +646,16 @@ static struct share_xchannel *share_add_xchannel
return xc;
}
static struct share_xchannel *share_find_xchannel_by_upstream
(struct ssh_sharing_connstate *cs, unsigned upstream_id)
static struct share_xchannel *share_find_xchannel_by_upstream(
struct ssh_sharing_connstate *cs, unsigned upstream_id)
{
struct share_xchannel dummyxc;
dummyxc.upstream_id = upstream_id;
return find234(cs->xchannels_by_us, &dummyxc, NULL);
}
static struct share_xchannel *share_find_xchannel_by_server
(struct ssh_sharing_connstate *cs, unsigned server_id)
static struct share_xchannel *share_find_xchannel_by_server(
struct ssh_sharing_connstate *cs, unsigned server_id)
{
struct share_xchannel dummyxc;
dummyxc.server_id = server_id;
@ -671,9 +670,8 @@ static void share_remove_xchannel(struct ssh_sharing_connstate *cs,
share_xchannel_free(xc);
}
static struct share_forwarding *share_add_forwarding
(struct ssh_sharing_connstate *cs,
const char *host, int port)
static struct share_forwarding *share_add_forwarding(
struct ssh_sharing_connstate *cs, const char *host, int port)
{
struct share_forwarding *fwd = snew(struct share_forwarding);
fwd->host = dupstr(host);
@ -687,8 +685,8 @@ static struct share_forwarding *share_add_forwarding
return fwd;
}
static struct share_forwarding *share_find_forwarding
(struct ssh_sharing_connstate *cs, const char *host, int port)
static struct share_forwarding *share_find_forwarding(
struct ssh_sharing_connstate *cs, const char *host, int port)
{
struct share_forwarding dummyfwd, *ret;
dummyfwd.host = dupstr(host);
@ -1013,8 +1011,8 @@ void share_dead_xchannel_respond(struct ssh_sharing_connstate *cs,
if (get_bool(src)) {
strbuf *packet = strbuf_new();
put_uint32(packet, xc->server_id);
ssh_send_packet_from_downstream
(cs->parent->cl, cs->id, SSH2_MSG_CHANNEL_FAILURE,
ssh_send_packet_from_downstream(
cs->parent->cl, cs->id, SSH2_MSG_CHANNEL_FAILURE,
packet->s, packet->len,
"downstream refused X channel open");
strbuf_free(packet);
@ -1380,8 +1378,8 @@ static void share_got_pkt_from_downstream(struct ssh_sharing_connstate *cs,
* cleaned up if downstream goes away.
*/
pkt[wantreplypos] = 1;
ssh_send_packet_from_downstream
(cs->parent->cl, cs->id, type, pkt, pktlen,
ssh_send_packet_from_downstream(
cs->parent->cl, cs->id, type, pkt, pktlen,
orig_wantreply ? NULL : "upstream added want_reply flag");
fwd = share_add_forwarding(cs, host, port);
ssh_sharing_queue_global_request(cs->parent->cl, cs);
@ -1443,8 +1441,8 @@ static void share_got_pkt_from_downstream(struct ssh_sharing_connstate *cs,
* deleted even if downstream doesn't want to know.
*/
pkt[wantreplypos] = 1;
ssh_send_packet_from_downstream
(cs->parent->cl, cs->id, type, pkt, pktlen,
ssh_send_packet_from_downstream(
cs->parent->cl, cs->id, type, pkt, pktlen,
orig_wantreply ? NULL : "upstream added want_reply flag");
ssh_sharing_queue_global_request(cs->parent->cl, cs);

View File

@ -1208,8 +1208,8 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
* When acquire_cred yields no useful expiration, go with
* the service ticket expiration.
*/
s->gss_stat = s->shgss->lib->init_sec_context
(s->shgss->lib,
s->gss_stat = s->shgss->lib->init_sec_context(
s->shgss->lib,
&s->shgss->ctx,
s->shgss->srv_name,
s->gssapi_fwd,

View File

@ -292,8 +292,8 @@ static gboolean try_grab_keyboard(gpointer vctx)
if (!GDK_IS_WINDOW(gdkw) || !gdk_window_is_visible(gdkw))
goto fail;
seat = gdk_display_get_default_seat
(gtk_widget_get_display(ctx->dialog));
seat = gdk_display_get_default_seat(
gtk_widget_get_display(ctx->dialog));
if (!seat)
goto fail;
@ -317,8 +317,8 @@ static gboolean try_grab_keyboard(gpointer vctx)
GdkDeviceManager *dm;
GdkDevice *pointer, *keyboard;
dm = gdk_display_get_device_manager
(gtk_widget_get_display(ctx->dialog));
dm = gdk_display_get_device_manager(
gtk_widget_get_display(ctx->dialog));
if (!dm)
goto fail;

View File

@ -345,8 +345,8 @@ char *dlg_editbox_get(dlgcontrol *ctrl, dlgparam *dp)
#if GTK_CHECK_VERSION(2,4,0)
if (uc->combo) {
return dupstr(gtk_entry_get_text
(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(uc->combo)))));
return dupstr(gtk_entry_get_text(
GTK_ENTRY(gtk_bin_get_child(GTK_BIN(uc->combo)))));
}
#endif
@ -425,8 +425,8 @@ void dlg_listbox_del(dlgcontrol *ctrl, dlgparam *dp, int index)
#if !GTK_CHECK_VERSION(2,4,0)
if (uc->menu) {
gtk_container_remove
(GTK_CONTAINER(uc->menu),
gtk_container_remove(
GTK_CONTAINER(uc->menu),
g_list_nth_data(GTK_MENU_SHELL(uc->menu)->children, index));
return;
}
@ -1003,8 +1003,8 @@ void dlg_set_focus(dlgcontrol *ctrl, dlgparam *dp)
* focus it.
*/
for (int i = 0; i < ctrl->radio.nbuttons; i++)
if (gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON(uc->buttons[i]))) {
if (gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(uc->buttons[i]))) {
gtk_widget_grab_focus(uc->buttons[i]);
}
break;
@ -1137,8 +1137,8 @@ void dlg_coloursel_start(dlgcontrol *ctrl, dlgparam *dp, int r, int g, int b)
GtkWidget *coloursel =
gtk_color_selection_dialog_new("Select a colour");
GtkColorSelectionDialog *ccs = GTK_COLOR_SELECTION_DIALOG(coloursel);
GtkColorSelection *cs = GTK_COLOR_SELECTION
(gtk_color_selection_dialog_get_color_selection(ccs));
GtkColorSelection *cs = GTK_COLOR_SELECTION(
gtk_color_selection_dialog_get_color_selection(ccs));
gtk_color_selection_set_has_opacity_control(cs, false);
#endif
@ -1385,8 +1385,8 @@ static gboolean listitem_key(GtkWidget *item, GdkEventKey *event,
gtk_list_select_child(GTK_LIST(list),
GTK_WIDGET(children->data));
gtk_widget_grab_focus(GTK_WIDGET(children->data));
gtk_adjustment_clamp_page
(adj,
gtk_adjustment_clamp_page(
adj,
adj->lower + (adj->upper-adj->lower) * i / n,
adj->lower + (adj->upper-adj->lower) * (i+1) / n);
}
@ -1620,8 +1620,8 @@ static void filesel_ok(GtkButton *button, gpointer data)
struct dlgparam *dp = (struct dlgparam *)data;
gpointer filesel = g_object_get_data(G_OBJECT(button), "user-data");
struct uctrl *uc = g_object_get_data(G_OBJECT(filesel), "user-data");
const char *name = gtk_file_selection_get_filename
(GTK_FILE_SELECTION(filesel));
const char *name = gtk_file_selection_get_filename(
GTK_FILE_SELECTION(filesel));
filechoose_emit_value(dp, uc, name);
}
#endif
@ -1634,14 +1634,14 @@ static void fontsel_ok(GtkButton *button, gpointer data)
gpointer fontsel = g_object_get_data(G_OBJECT(button), "user-data");
struct uctrl *uc = g_object_get_data(G_OBJECT(fontsel), "user-data");
const char *name = gtk_font_selection_dialog_get_font_name
(GTK_FONT_SELECTION_DIALOG(fontsel));
const char *name = gtk_font_selection_dialog_get_font_name(
GTK_FONT_SELECTION_DIALOG(fontsel));
gtk_entry_set_text(GTK_ENTRY(uc->entry), name);
#else
unifontsel *fontsel = (unifontsel *)g_object_get_data
(G_OBJECT(button), "user-data");
unifontsel *fontsel = (unifontsel *)g_object_get_data(
G_OBJECT(button), "user-data");
struct uctrl *uc = (struct uctrl *)fontsel->user_data;
char *name = unifontsel_get_name(fontsel);
assert(name); /* should always be ok after OK pressed */
@ -1685,9 +1685,9 @@ static void coloursel_ok(GtkButton *button, gpointer data)
#if GTK_CHECK_VERSION(2,0,0)
{
GtkColorSelection *cs = GTK_COLOR_SELECTION
(gtk_color_selection_dialog_get_color_selection
(GTK_COLOR_SELECTION_DIALOG(coloursel)));
GtkColorSelection *cs = GTK_COLOR_SELECTION(
gtk_color_selection_dialog_get_color_selection(
GTK_COLOR_SELECTION_DIALOG(coloursel)));
GdkColor col;
gtk_color_selection_get_current_color(cs, &col);
dp->coloursel_result.r = col.red / 0x0100;
@ -1696,9 +1696,9 @@ static void coloursel_ok(GtkButton *button, gpointer data)
}
#else
{
GtkColorSelection *cs = GTK_COLOR_SELECTION
(gtk_color_selection_dialog_get_color_selection
(GTK_COLOR_SELECTION_DIALOG(coloursel)));
GtkColorSelection *cs = GTK_COLOR_SELECTION(
gtk_color_selection_dialog_get_color_selection(
GTK_COLOR_SELECTION_DIALOG(coloursel)));
gdouble cvals[4];
gtk_color_selection_get_color(cs, cvals);
dp->coloursel_result.r = (int) (255 * cvals[0]);
@ -1728,8 +1728,8 @@ static void filefont_clicked(GtkButton *button, gpointer data)
if (uc->ctrl->type == CTRL_FILESELECT) {
#ifdef USE_GTK_FILE_CHOOSER_DIALOG
GtkWidget *filechoose = gtk_file_chooser_dialog_new
(uc->ctrl->fileselect.title, GTK_WINDOW(dp->window),
GtkWidget *filechoose = gtk_file_chooser_dialog_new(
uc->ctrl->fileselect.title, GTK_WINDOW(dp->window),
(uc->ctrl->fileselect.for_writing ?
GTK_FILE_CHOOSER_ACTION_SAVE :
GTK_FILE_CHOOSER_ACTION_OPEN),
@ -1745,18 +1745,18 @@ static void filefont_clicked(GtkButton *button, gpointer data)
GtkWidget *filesel =
gtk_file_selection_new(uc->ctrl->fileselect.title);
gtk_window_set_modal(GTK_WINDOW(filesel), true);
g_object_set_data
(G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "user-data",
g_object_set_data(
G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "user-data",
(gpointer)filesel);
g_object_set_data(G_OBJECT(filesel), "user-data", (gpointer)uc);
g_signal_connect
(G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "clicked",
g_signal_connect(
G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "clicked",
G_CALLBACK(filesel_ok), (gpointer)dp);
g_signal_connect_swapped
(G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "clicked",
g_signal_connect_swapped(
G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "clicked",
G_CALLBACK(gtk_widget_destroy), (gpointer)filesel);
g_signal_connect_swapped
(G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), "clicked",
g_signal_connect_swapped(
G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), "clicked",
G_CALLBACK(gtk_widget_destroy), (gpointer)filesel);
gtk_widget_show(filesel);
#endif
@ -1775,12 +1775,12 @@ static void filefont_clicked(GtkButton *button, gpointer data)
GtkWidget *fontsel =
gtk_font_selection_dialog_new("Select a font");
gtk_window_set_modal(GTK_WINDOW(fontsel), true);
gtk_font_selection_dialog_set_filter
(GTK_FONT_SELECTION_DIALOG(fontsel),
gtk_font_selection_dialog_set_filter(
GTK_FONT_SELECTION_DIALOG(fontsel),
GTK_FONT_FILTER_BASE, GTK_FONT_ALL,
NULL, NULL, NULL, NULL, spacings, NULL);
if (!gtk_font_selection_dialog_set_font_name
(GTK_FONT_SELECTION_DIALOG(fontsel), fontname)) {
if (!gtk_font_selection_dialog_set_font_name(
GTK_FONT_SELECTION_DIALOG(fontsel), fontname)) {
/*
* If the font name wasn't found as it was, try opening
* it and extracting its FONT property. This should
@ -1800,25 +1800,25 @@ static void filefont_clicked(GtkButton *button, gpointer data)
if (XGetFontProperty(xfs, fontprop, &ret)) {
char *name = XGetAtomName(disp, (Atom)ret);
if (name)
gtk_font_selection_dialog_set_font_name
(GTK_FONT_SELECTION_DIALOG(fontsel), name);
gtk_font_selection_dialog_set_font_name(
GTK_FONT_SELECTION_DIALOG(fontsel), name);
}
gdk_font_unref(font);
}
}
g_object_set_data
(G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->ok_button),
g_object_set_data(
G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->ok_button),
"user-data", (gpointer)fontsel);
g_object_set_data(G_OBJECT(fontsel), "user-data", (gpointer)uc);
g_signal_connect
(G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->ok_button),
g_signal_connect(
G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->ok_button),
"clicked", G_CALLBACK(fontsel_ok), (gpointer)dp);
g_signal_connect_swapped
(G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->ok_button),
g_signal_connect_swapped(
G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->ok_button),
"clicked", G_CALLBACK(gtk_widget_destroy),
(gpointer)fontsel);
g_signal_connect_swapped
(G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->cancel_button),
g_signal_connect_swapped(
G_OBJECT(GTK_FONT_SELECTION_DIALOG(fontsel)->cancel_button),
"clicked", G_CALLBACK(gtk_widget_destroy),
(gpointer)fontsel);
gtk_widget_show(fontsel);
@ -2018,8 +2018,8 @@ GtkWidget *layout_ctrls(
GtkWidget *b;
gint colstart;
b = (gtk_radio_button_new_with_label
(group, ctrl->radio.buttons[i]));
b = gtk_radio_button_new_with_label(
group, ctrl->radio.buttons[i]);
uc->buttons[i] = b;
group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(b));
colstart = i % ctrl->radio.ncolumns;
@ -2059,8 +2059,8 @@ GtkWidget *layout_ctrls(
*/
uc->listmodel = gtk_list_store_new(2, G_TYPE_INT,
G_TYPE_STRING);
w = gtk_combo_box_new_with_model_and_entry
(GTK_TREE_MODEL(uc->listmodel));
w = gtk_combo_box_new_with_model_and_entry(
GTK_TREE_MODEL(uc->listmodel));
g_object_set(G_OBJECT(w), "entry-text-column", 1,
(const char *)NULL);
/* We cannot support password combo boxes. */
@ -2261,8 +2261,8 @@ GtkWidget *layout_ctrls(
* Create a non-editable GtkComboBox (that is, not
* its subclass GtkComboBoxEntry).
*/
w = gtk_combo_box_new_with_model
(GTK_TREE_MODEL(uc->listmodel));
w = gtk_combo_box_new_with_model(
GTK_TREE_MODEL(uc->listmodel));
uc->combo = w;
/*
@ -2306,8 +2306,8 @@ GtkWidget *layout_ctrls(
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(w),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
uc->adj = gtk_scrolled_window_get_vadjustment
(GTK_SCROLLED_WINDOW(w));
uc->adj = gtk_scrolled_window_get_vadjustment(
GTK_SCROLLED_WINDOW(w));
gtk_widget_show(uc->list);
g_signal_connect(G_OBJECT(uc->list), "selection-changed",
@ -2377,14 +2377,14 @@ GtkWidget *layout_ctrls(
* Create the list box itself, its columns, and
* its containing scrolled window.
*/
w = gtk_tree_view_new_with_model
(GTK_TREE_MODEL(uc->listmodel));
w = gtk_tree_view_new_with_model(
GTK_TREE_MODEL(uc->listmodel));
g_object_set_data(G_OBJECT(uc->listmodel), "user-data",
(gpointer)w);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false);
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(w));
gtk_tree_selection_set_mode
(sel, ctrl->listbox.multisel ? GTK_SELECTION_MULTIPLE :
gtk_tree_selection_set_mode(
sel, ctrl->listbox.multisel ? GTK_SELECTION_MULTIPLE :
GTK_SELECTION_SINGLE);
uc->treeview = w;
g_signal_connect(G_OBJECT(w), "row-activated",
@ -2422,10 +2422,10 @@ GtkWidget *layout_ctrls(
"ellipsize-set", true,
(const char *)NULL);
}
column = gtk_tree_view_column_new_with_attributes
("heading", cellrend, "text", i+1, (char *)NULL);
gtk_tree_view_column_set_sizing
(column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
column = gtk_tree_view_column_new_with_attributes(
"heading", cellrend, "text", i+1, (char *)NULL);
gtk_tree_view_column_set_sizing(
column, GTK_TREE_VIEW_COLUMN_GROW_ONLY);
gtk_tree_view_append_column(GTK_TREE_VIEW(w), column);
}
}
@ -2434,15 +2434,15 @@ GtkWidget *layout_ctrls(
GtkWidget *scroll;
scroll = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type
(GTK_SCROLLED_WINDOW(scroll), GTK_SHADOW_IN);
gtk_scrolled_window_set_shadow_type(
GTK_SCROLLED_WINDOW(scroll), GTK_SHADOW_IN);
gtk_widget_show(w);
gtk_container_add(GTK_CONTAINER(scroll), w);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_ALWAYS);
gtk_widget_set_size_request
(scroll, -1,
gtk_widget_set_size_request(
scroll, -1,
ctrl->listbox.height * get_listitemheight(w));
w = scroll;
@ -2737,8 +2737,8 @@ gint win_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
if (schr == sc->uc->ctrl->radio.shortcut) {
int i;
for (i = 0; i < sc->uc->ctrl->radio.nbuttons; i++)
if (gtk_toggle_button_get_active
(GTK_TOGGLE_BUTTON(sc->uc->buttons[i]))) {
if (gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(sc->uc->buttons[i]))) {
gtk_widget_grab_focus(sc->uc->buttons[i]);
}
} else if (sc->uc->ctrl->radio.shortcuts) {
@ -2746,8 +2746,8 @@ gint win_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
for (i = 0; i < sc->uc->ctrl->radio.nbuttons; i++)
if (schr == sc->uc->ctrl->radio.shortcuts[i]) {
gtk_widget_grab_focus(sc->uc->buttons[i]);
g_signal_emit_by_name
(G_OBJECT(sc->uc->buttons[i]), "clicked");
g_signal_emit_by_name(
G_OBJECT(sc->uc->buttons[i]), "clicked");
}
}
break;
@ -3036,13 +3036,13 @@ GtkWidget *create_config_box(const char *title, Conf *conf,
gtk_widget_show(label);
treescroll = gtk_scrolled_window_new(NULL, NULL);
#if GTK_CHECK_VERSION(2,0,0)
treestore = gtk_tree_store_new
(TREESTORE_NUM, G_TYPE_STRING, G_TYPE_INT);
treestore = gtk_tree_store_new(
TREESTORE_NUM, G_TYPE_STRING, G_TYPE_INT);
tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(treestore));
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), false);
treerenderer = gtk_cell_renderer_text_new();
treecolumn = gtk_tree_view_column_new_with_attributes
("Label", treerenderer, "text", 0, NULL);
treecolumn = gtk_tree_view_column_new_with_attributes(
"Label", treerenderer, "text", 0, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree), treecolumn);
treeselection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree));
gtk_tree_selection_set_mode(treeselection, GTK_SELECTION_BROWSE);
@ -3170,9 +3170,8 @@ GtkWidget *create_config_box(const char *title, Conf *conf,
if (j > 0) {
if (!treelevels[j-1]) {
treelevels[j-1] = GTK_TREE(gtk_tree_new());
gtk_tree_item_set_subtree
(treeitemlevels[j-1],
GTK_WIDGET(treelevels[j-1]));
gtk_tree_item_set_subtree(
treeitemlevels[j-1], GTK_WIDGET(treelevels[j-1]));
if (j < 2)
gtk_tree_item_expand(treeitemlevels[j-1]);
else
@ -3910,8 +3909,8 @@ void about_box(void *window)
{
char *buildinfo_text = buildinfo("\n");
char *label_text = dupprintf
("%s\n\n%s\n\n%s\n\n%s",
char *label_text = dupprintf(
"%s\n\n%s\n\n%s\n\n%s",
appname, ver, buildinfo_text,
"Copyright " SHORT_COPYRIGHT_DETAILS ". All rights reserved");
w = gtk_label_new(label_text);
@ -4055,8 +4054,8 @@ gint eventlog_selection_clear(GtkWidget *widget, GdkEventSelection *seldata,
gtk_list_unselect_all(GTK_LIST(uc->list));
#else
assert(uc->treeview);
gtk_tree_selection_unselect_all
(gtk_tree_view_get_selection(GTK_TREE_VIEW(uc->treeview)));
gtk_tree_selection_unselect_all(
gtk_tree_view_get_selection(GTK_TREE_VIEW(uc->treeview)));
#endif
es->ignore_selchange = false;
@ -4112,8 +4111,8 @@ void showeventlog(eventlog_stuff *es, void *parentwin)
gtk_widget_show(w0);
w1 = layout_ctrls(&es->dp, NULL, &es->scs, s1, GTK_WINDOW(window));
gtk_container_set_border_width(GTK_CONTAINER(w1), 10);
gtk_widget_set_size_request(w1, 20 + string_width
("LINE OF TEXT GIVING WIDTH OF EVENT LOG IS "
gtk_widget_set_size_request(
w1, 20 + string_width("LINE OF TEXT GIVING WIDTH OF EVENT LOG IS "
"QUITE LONG 'COS SSH LOG ENTRIES ARE WIDE"),
-1);
our_dialog_add_to_content_area(GTK_WINDOW(window), w1, true, true, 0);

View File

@ -574,8 +574,8 @@ static void x11font_destroy(unifont *font)
static void x11_alloc_subfont(struct x11font *xfont, int sfid)
{
Display *disp = xfont->disp;
char *derived_name = x11_guess_derived_font_name
(disp, xfont->fonts[0].xfs, sfid & 1, !!(sfid & 2));
char *derived_name = x11_guess_derived_font_name(
disp, xfont->fonts[0].xfs, sfid & 1, !!(sfid & 2));
xfont->fonts[sfid].xfs = XLoadQueryFont(disp, derived_name);
xfont->fonts[sfid].allocated = true;
sfree(derived_name);
@ -691,9 +691,8 @@ static void x11font_cairo_setup(
xfi->indexflip = (*((char *) &endianness_test) == 1) ? 0 : 7;
}
xfi->pixmap = XCreatePixmap
(disp,
GDK_DRAWABLE_XID(gtk_widget_get_window(ctx->u.cairo.widget)),
xfi->pixmap = XCreatePixmap(
disp, GDK_DRAWABLE_XID(gtk_widget_get_window(ctx->u.cairo.widget)),
xfi->pixwidth, xfi->pixheight, 1);
gcvals.foreground = WhitePixel(disp, widgetscr);
gcvals.background = BlackPixel(disp, widgetscr);
@ -747,8 +746,8 @@ static void x11font_cairo_cache_glyph(
}
}
xfi->glyphcache[glyphindex].bitmap = bitmap;
xfi->glyphcache[glyphindex].surface = cairo_image_surface_create_for_data
(bitmap, CAIRO_FORMAT_A1, xfi->pixwidth, xfi->pixheight, xfi->rowsize);
xfi->glyphcache[glyphindex].surface = cairo_image_surface_create_for_data(
bitmap, CAIRO_FORMAT_A1, xfi->pixwidth, xfi->pixheight, xfi->rowsize);
}
static void x11font_cairo_draw_glyph(unifont_drawctx *ctx,
@ -2226,8 +2225,8 @@ unifont *multifont_create(GtkWidget *widget, const char *name,
if (font->want_fallback) {
for (i = 0; i < lenof(unifont_types); i++) {
if (unifont_types[i]->create_fallback) {
fallback = unifont_types[i]->create_fallback
(widget, font->height, wide, bold,
fallback = unifont_types[i]->create_fallback(
widget, font->height, wide, bold,
shadowoffset, shadowalways);
if (fallback)
break;
@ -2663,8 +2662,8 @@ static void unifontsel_set_filter_buttons(unifontsel_internal *fs)
int i;
for (i = 0; i < fs->n_filter_buttons; i++) {
int flagbit = GPOINTER_TO_INT(g_object_get_data
(G_OBJECT(fs->filter_buttons[i]),
int flagbit = GPOINTER_TO_INT(g_object_get_data(
G_OBJECT(fs->filter_buttons[i]),
"user-data"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(fs->filter_buttons[i]),
!!(fs->filter_flags & flagbit));
@ -2679,8 +2678,8 @@ static void unifontsel_draw_preview_text_inner(unifont_drawctx *dctx,
fontinfo *info = fs->selected;
if (info) {
sizename = info->fontclass->scale_fontname
(GTK_WIDGET(fs->u.window), info->realname, fs->selsize);
sizename = info->fontclass->scale_fontname(
GTK_WIDGET(fs->u.window), info->realname, fs->selsize);
font = info->fontclass->create(GTK_WIDGET(fs->u.window),
sizename ? sizename : info->realname,
false, false, 0, 0);
@ -2867,8 +2866,8 @@ static void unifontsel_select_font(unifontsel_internal *fs,
*/
assert(info->familyindex >= 0);
treepath = gtk_tree_path_new_from_indices(info->familyindex, -1);
gtk_tree_selection_select_path
(gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->family_list)),
gtk_tree_selection_select_path(
gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->family_list)),
treepath);
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->family_list),
treepath, NULL, false, 0.0, 0.0);
@ -2891,8 +2890,8 @@ static void unifontsel_select_font(unifontsel_internal *fs,
if (info->style) {
assert(info->styleindex >= 0);
treepath = gtk_tree_path_new_from_indices(info->styleindex, -1);
gtk_tree_selection_select_path
(gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->style_list)),
gtk_tree_selection_select_path(
gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->style_list)),
treepath);
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->style_list),
treepath, NULL, false, 0.0, 0.0);
@ -2914,8 +2913,8 @@ static void unifontsel_select_font(unifontsel_internal *fs,
if (info->size) {
assert(info->sizeindex >= 0);
treepath = gtk_tree_path_new_from_indices(info->sizeindex, -1);
gtk_tree_selection_select_path
(gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->size_list)),
gtk_tree_selection_select_path(
gtk_tree_view_get_selection(GTK_TREE_VIEW(fs->size_list)),
treepath);
gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(fs->size_list),
treepath, NULL, false, 0.0, 0.0);
@ -3236,8 +3235,8 @@ static void alias_resolve(GtkTreeView *treeview, GtkTreePath *path,
int flags;
struct fontinfo_realname_find f;
newname = info->fontclass->canonify_fontname
(GTK_WIDGET(fs->u.window), info->realname, &newsize, &flags, true);
newname = info->fontclass->canonify_fontname(
GTK_WIDGET(fs->u.window), info->realname, &newsize, &flags, true);
f.realname = newname;
f.flags = flags;
@ -3363,10 +3362,10 @@ unifontsel *unifontsel_new(const char *wintitle)
fs->u.user_data = NULL;
fs->u.window = GTK_WINDOW(gtk_dialog_new());
gtk_window_set_title(fs->u.window, wintitle);
fs->u.cancel_button = gtk_dialog_add_button
(GTK_DIALOG(fs->u.window), STANDARD_CANCEL_LABEL, GTK_RESPONSE_CANCEL);
fs->u.ok_button = gtk_dialog_add_button
(GTK_DIALOG(fs->u.window), STANDARD_OK_LABEL, GTK_RESPONSE_OK);
fs->u.cancel_button = gtk_dialog_add_button(
GTK_DIALOG(fs->u.window), STANDARD_CANCEL_LABEL, GTK_RESPONSE_CANCEL);
fs->u.ok_button = gtk_dialog_add_button(
GTK_DIALOG(fs->u.window), STANDARD_OK_LABEL, GTK_RESPONSE_OK);
gtk_widget_grab_default(fs->u.ok_button);
/*
@ -3398,8 +3397,8 @@ unifontsel *unifontsel_new(const char *wintitle)
w = table;
#endif
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area
(GTK_DIALOG(fs->u.window))),
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(
GTK_DIALOG(fs->u.window))),
w, true, true, 0);
label = gtk_label_new_with_mnemonic("_Font:");
@ -3422,8 +3421,8 @@ unifontsel *unifontsel_new(const char *wintitle)
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false);
gtk_label_set_mnemonic_widget(GTK_LABEL(label), w);
gtk_widget_show(w);
column = gtk_tree_view_column_new_with_attributes
("Font", gtk_cell_renderer_text_new(),
column = gtk_tree_view_column_new_with_attributes(
"Font", gtk_cell_renderer_text_new(),
"text", 0, (char *)NULL);
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
gtk_tree_view_append_column(GTK_TREE_VIEW(w), column);
@ -3473,8 +3472,8 @@ unifontsel *unifontsel_new(const char *wintitle)
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false);
gtk_label_set_mnemonic_widget(GTK_LABEL(label), w);
gtk_widget_show(w);
column = gtk_tree_view_column_new_with_attributes
("Style", gtk_cell_renderer_text_new(),
column = gtk_tree_view_column_new_with_attributes(
"Style", gtk_cell_renderer_text_new(),
"text", 0, "sensitive", 3, "weight", 4, (char *)NULL);
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
gtk_tree_view_append_column(GTK_TREE_VIEW(w), column);
@ -3531,8 +3530,8 @@ unifontsel *unifontsel_new(const char *wintitle)
w = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(w), false);
gtk_widget_show(w);
column = gtk_tree_view_column_new_with_attributes
("Size", gtk_cell_renderer_text_new(),
column = gtk_tree_view_column_new_with_attributes(
"Size", gtk_cell_renderer_text_new(),
"text", 0, (char *)NULL);
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
gtk_tree_view_append_column(GTK_TREE_VIEW(w), column);
@ -3740,8 +3739,8 @@ void unifontsel_set_name(unifontsel *fontsel, const char *fontname)
*/
fontname = unifont_do_prefix(fontname, &start, &end);
for (i = start; i < end; i++) {
fontname2 = unifont_types[i]->canonify_fontname
(GTK_WIDGET(fs->u.window), fontname, &size, &flags, false);
fontname2 = unifont_types[i]->canonify_fontname(
GTK_WIDGET(fs->u.window), fontname, &size, &flags, false);
if (fontname2)
break;
}
@ -3791,8 +3790,8 @@ char *unifontsel_get_name(unifontsel *fontsel)
return NULL;
if (fs->selected->size == 0) {
name = fs->selected->fontclass->scale_fontname
(GTK_WIDGET(fs->u.window), fs->selected->realname, fs->selsize);
name = fs->selected->fontclass->scale_fontname(
GTK_WIDGET(fs->u.window), fs->selected->realname, fs->selsize);
if (name) {
char *ret = dupcat(fs->selected->fontclass->prefix, ":", name);
sfree(name);

View File

@ -128,8 +128,8 @@ void our_dialog_add_to_content_area(GtkWindow *dlg, GtkWidget *w,
gtk_box_pack_start(vbox, w, expand, fill, padding);
#else
gtk_box_pack_start
(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg))),
gtk_box_pack_start(
GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dlg))),
w, expand, fill, padding);
#endif
}

View File

@ -1675,9 +1675,10 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
*/
guint new_keyval;
GdkModifierType consumed;
if (gdk_keymap_translate_keyboard_state
(gdk_keymap_get_for_display(gdk_display_get_default()),
event->hardware_keycode, event->state & ~META_MANUAL_MASK,
if (gdk_keymap_translate_keyboard_state(
gdk_keymap_get_for_display(gdk_display_get_default()),
event->hardware_keycode,
event->state & ~META_MANUAL_MASK,
0, &new_keyval, NULL, NULL, &consumed)) {
ucsoutput[0] = '\033';
ucsoutput[1] = gdk_keyval_to_unicode(new_keyval);

View File

@ -62,8 +62,8 @@ static void wm_copydata_agent_query(strbuf *query, void **out, int *outlen)
psd = (PSECURITY_DESCRIPTOR)
LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
if (psd) {
if (p_InitializeSecurityDescriptor
(psd, SECURITY_DESCRIPTOR_REVISION) &&
if (p_InitializeSecurityDescriptor(
psd, SECURITY_DESCRIPTOR_REVISION) &&
p_SetSecurityDescriptorOwner(psd, usersid, false)) {
sa.nLength = sizeof(sa);
sa.bInheritHandle = true;

View File

@ -385,8 +385,8 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
SetWindowText(hwnd, str);
sfree(str);
char *buildinfo_text = buildinfo("\r\n");
char *text = dupprintf
("%s\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
char *text = dupprintf(
"%s\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
appname, ver, buildinfo_text,
"\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved.");
sfree(buildinfo_text);

View File

@ -544,13 +544,13 @@ static void update_jumplist_from_registry(void)
*/
for (i = 0, found = false; i < nremoved && !found; i++) {
IShellLink *rlink;
if (SUCCEEDED(pRemoved->lpVtbl->GetAt
(pRemoved, i, COMPTR(IShellLink, &rlink)))) {
if (SUCCEEDED(pRemoved->lpVtbl->GetAt(
pRemoved, i, COMPTR(IShellLink, &rlink)))) {
char desc1[2048], desc2[2048];
if (SUCCEEDED(link->lpVtbl->GetDescription
(link, desc1, sizeof(desc1)-1)) &&
SUCCEEDED(rlink->lpVtbl->GetDescription
(rlink, desc2, sizeof(desc2)-1)) &&
if (SUCCEEDED(link->lpVtbl->GetDescription(
link, desc1, sizeof(desc1)-1)) &&
SUCCEEDED(rlink->lpVtbl->GetDescription(
rlink, desc2, sizeof(desc2)-1)) &&
!strcmp(desc1, desc2)) {
found = true;
}
@ -575,8 +575,8 @@ static void update_jumplist_from_registry(void)
* Get the array form of the collection we've just constructed,
* and put it in the jump list.
*/
if (!SUCCEEDED(collection->lpVtbl->QueryInterface
(collection, COMPTR(IObjectArray, &array))))
if (!SUCCEEDED(collection->lpVtbl->QueryInterface(
collection, COMPTR(IObjectArray, &array))))
goto cleanup;
pCDL->lpVtbl->AppendCategory(pCDL, L"Recent Sessions", array);
@ -608,8 +608,8 @@ static void update_jumplist_from_registry(void)
* Get the array form of the collection we've just constructed,
* and put it in the jump list.
*/
if (!SUCCEEDED(collection->lpVtbl->QueryInterface
(collection, COMPTR(IObjectArray, &array))))
if (!SUCCEEDED(collection->lpVtbl->QueryInterface(
collection, COMPTR(IObjectArray, &array))))
goto cleanup;
pCDL->lpVtbl->AddUserTasks(pCDL, array);
@ -636,8 +636,8 @@ static void update_jumplist_from_registry(void)
* Get the array form of the collection we've just constructed,
* and put it in the jump list.
*/
if (!SUCCEEDED(collection->lpVtbl->QueryInterface
(collection, COMPTR(IObjectArray, &array))))
if (!SUCCEEDED(collection->lpVtbl->QueryInterface(
collection, COMPTR(IObjectArray, &array))))
goto cleanup;
pCDL->lpVtbl->AddUserTasks(pCDL, array);

View File

@ -77,8 +77,8 @@ static bool create_named_pipe(NamedPipeServerSocket *ps, bool first_instance)
sa.lpSecurityDescriptor = ps->psd;
sa.bInheritHandle = false;
ps->pipehandle = CreateNamedPipe
(/* lpName */
ps->pipehandle = CreateNamedPipe(
/* lpName */
ps->pipename,
/* dwOpenMode */

View File

@ -133,8 +133,8 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
switch (msg) {
case WM_INITDIALOG: {
char *buildinfo_text = buildinfo("\r\n");
char *text = dupprintf
("Pageant\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
char *text = dupprintf(
"Pageant\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
ver, buildinfo_text,
"\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved.");
sfree(buildinfo_text);

View File

@ -543,8 +543,8 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg,
{
char *buildinfo_text = buildinfo("\r\n");
char *text = dupprintf
("PuTTYgen\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
char *text = dupprintf(
"PuTTYgen\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
ver, buildinfo_text,
"\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved.");
sfree(buildinfo_text);
@ -1922,8 +1922,8 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg,
if ((state->keytype == RSA || state->keytype == DSA) &&
state->key_bits < 256) {
char *message = dupprintf
("PuTTYgen will not generate a key smaller than 256"
char *message = dupprintf(
"PuTTYgen will not generate a key smaller than 256"
" bits.\nKey length reset to default %d. Continue?",
DEFAULT_KEY_BITS);
int ret = MessageBox(hwnd, message, "PuTTYgen Warning",
@ -1935,8 +1935,8 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg,
SetDlgItemInt(hwnd, IDC_BITS, DEFAULT_KEY_BITS, false);
} else if ((state->keytype == RSA || state->keytype == DSA) &&
state->key_bits < DEFAULT_KEY_BITS) {
char *message = dupprintf
("Keys shorter than %d bits are not recommended. "
char *message = dupprintf(
"Keys shorter than %d bits are not recommended. "
"Really generate this key?", DEFAULT_KEY_BITS);
int ret = MessageBox(hwnd, message, "PuTTYgen Warning",
MB_ICONWARNING | MB_OKCANCEL);

View File

@ -685,8 +685,8 @@ void write_random_seed(void *data, int len)
* returning the resulting concatenated list of strings in 'out' (if
* non-null).
*/
static int transform_jumplist_registry
(const char *add, const char *rem, char **out)
static int transform_jumplist_registry(
const char *add, const char *rem, char **out)
{
HKEY rkey = open_regkey(true, HKEY_CURRENT_USER, reg_jumplist_key);
if (!rkey)

View File

@ -290,8 +290,8 @@ static bool really_restrict_process_acl(char **error)
goto cleanup;
}
if (ERROR_SUCCESS != p_SetSecurityInfo
(GetCurrentProcess(), SE_KERNEL_OBJECT,
if (ERROR_SUCCESS != p_SetSecurityInfo(
GetCurrentProcess(), SE_KERNEL_OBJECT,
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION,
usersid, NULL, acl, NULL)) {
*error = dupprintf("Unable to set process ACL: %s",