Introduce a typedef for frontend handles.

This is another major source of unexplained 'void *' parameters
throughout the code.

In particular, the currently unused testback.c actually gave the wrong
pointer type to its internal store of the frontend handle - it cast
the input void * to a Terminal *, from which it got implicitly cast
back again when calling from_backend, and nobody noticed. Now it uses
the right type internally as well as externally.
This commit is contained in:
Simon Tatham 2018-09-12 09:10:51 +01:00
Родитель eefebaaa9e
Коммит 8dfb2a1186
40 изменённых файлов: 357 добавлений и 406 удалений

Просмотреть файл

@ -9,7 +9,7 @@
#include "putty.h"
#include "network.h"
void backend_socket_log(void *frontend, int type, SockAddr addr, int port,
void backend_socket_log(Frontend *frontend, int type, SockAddr addr, int port,
const char *error_msg, int error_code, Conf *conf,
int session_started)
{

Просмотреть файл

@ -17,13 +17,13 @@ struct callback {
struct callback *cbcurr = NULL, *cbhead = NULL, *cbtail = NULL;
toplevel_callback_notify_fn_t notify_frontend = NULL;
void *frontend = NULL;
void *notify_ctx = NULL;
void request_callback_notifications(toplevel_callback_notify_fn_t fn,
void *fr)
void *ctx)
{
notify_frontend = fn;
frontend = fr;
notify_ctx = ctx;
}
static void run_idempotent_callback(void *ctx)
@ -87,7 +87,7 @@ void queue_toplevel_callback(toplevel_callback_fn_t fn, void *ctx)
* callback keeps re-scheduling itself.
*/
if (notify_frontend && !cbhead && !cbcurr)
notify_frontend(frontend);
notify_frontend(notify_ctx);
if (cbtail)
cbtail->next = cb;

2
defs.h
Просмотреть файл

@ -49,6 +49,8 @@ typedef struct Backend_vtable Backend_vtable;
typedef struct Ldisc_tag Ldisc;
typedef struct LogContext_tag LogContext;
typedef struct Frontend Frontend;
typedef struct ssh_tag *Ssh;
/* Note indirection: for historical reasons (it used to be closer to

Просмотреть файл

@ -38,12 +38,12 @@ int main(int argc, char **argv)
return 0;
}
int from_backend(void *frontend, int is_stderr, const void *data, int len)
int from_backend(Frontend *frontend, int is_stderr, const void *data, int len)
{ return 0; }
/* functions required by terminal.c */
void request_resize(void *frontend, int x, int y) { }
void request_resize(Frontend *frontend, int x, int y) { }
void do_text(Context ctx, int x, int y, wchar_t * text, int len,
unsigned long attr, int lattr, truecolour tc)
{
@ -67,40 +67,40 @@ void do_cursor(Context ctx, int x, int y, wchar_t * text, int len,
printf("\n");
}
int char_width(Context ctx, int uc) { return 1; }
void set_title(void *frontend, char *t) { }
void set_icon(void *frontend, char *t) { }
void set_sbar(void *frontend, int a, int b, int c) { }
void set_title(Frontend *frontend, char *t) { }
void set_icon(Frontend *frontend, char *t) { }
void set_sbar(Frontend *frontend, int a, int b, int c) { }
void ldisc_send(Ldisc *ldisc, const void *buf, int len, int interactive) {}
void ldisc_echoedit_update(Ldisc *ldisc) {}
Context get_ctx(void *frontend) {
Context get_ctx(Frontend *frontend) {
static char x;
return &x;
}
void free_ctx(Context ctx) { }
void palette_set(void *frontend, int a, int b, int c, int d) { }
void palette_reset(void *frontend) { }
int palette_get(void *frontend, int n, int *r, int *g, int *b) {return FALSE;}
void write_clip(void *frontend, int clipboard,
void palette_set(Frontend *frontend, int a, int b, int c, int d) { }
void palette_reset(Frontend *frontend) { }
int palette_get(Frontend *frontend, int n, int *r, int *g, int *b) {return FALSE;}
void write_clip(Frontend *frontend, int clipboard,
wchar_t *a, int *b, truecolour *c, int d, int e) { }
void set_raw_mouse_mode(void *frontend, int m) { }
void frontend_request_paste(void *frontend, int clipboard) { }
void do_beep(void *frontend, int a) { }
void sys_cursor(void *frontend, int x, int y) { }
void set_raw_mouse_mode(Frontend *frontend, int m) { }
void frontend_request_paste(Frontend *frontend, int clipboard) { }
void do_beep(Frontend *frontend, int a) { }
void sys_cursor(Frontend *frontend, int x, int y) { }
void modalfatalbox(const char *fmt, ...) { exit(0); }
void nonfatal(const char *fmt, ...) { }
void set_iconic(void *frontend, int iconic) { }
void move_window(void *frontend, int x, int y) { }
void set_zorder(void *frontend, int top) { }
void refresh_window(void *frontend) { }
void set_zoomed(void *frontend, int zoomed) { }
int is_iconic(void *frontend) { return 0; }
void get_window_pos(void *frontend, int *x, int *y) { *x = 0; *y = 0; }
void get_window_pixels(void *frontend, int *x, int *y) { *x = 0; *y = 0; }
char *get_window_title(void *frontend, int icon) { return "moo"; }
int frontend_is_utf8(void *frontend) { return TRUE; }
void set_iconic(Frontend *frontend, int iconic) { }
void move_window(Frontend *frontend, int x, int y) { }
void set_zorder(Frontend *frontend, int top) { }
void refresh_window(Frontend *frontend) { }
void set_zoomed(Frontend *frontend, int zoomed) { }
int is_iconic(Frontend *frontend) { return 0; }
void get_window_pos(Frontend *frontend, int *x, int *y) { *x = 0; *y = 0; }
void get_window_pixels(Frontend *frontend, int *x, int *y) { *x = 0; *y = 0; }
char *get_window_title(Frontend *frontend, int icon) { return "moo"; }
int frontend_is_utf8(Frontend *frontend) { return TRUE; }
/* needed by timing.c */
void timer_change_notify(unsigned long next) { }
@ -142,8 +142,8 @@ int dlg_coloursel_results(union control *ctrl, void *dlg,
void dlg_refresh(union control *ctrl, void *dlg) { }
/* miscellany */
void logevent(void *frontend, const char *msg) { }
int askappend(void *frontend, Filename *filename,
void logevent(Frontend *frontend, const char *msg) { }
int askappend(Frontend *frontend, Filename *filename,
void (*callback)(void *ctx, int result), void *ctx) { return 0; }
const char *const appname = "FuZZterm";

Просмотреть файл

@ -78,7 +78,7 @@ static void bsb(Ldisc *ldisc, int n)
#define KCTRL(x) ((x^'@') | 0x100)
Ldisc *ldisc_create(Conf *conf, Terminal *term,
Backend *backend, void *frontend)
Backend *backend, Frontend *frontend)
{
Ldisc *ldisc = snew(Ldisc);

Просмотреть файл

@ -11,7 +11,7 @@
struct Ldisc_tag {
Terminal *term;
Backend *backend;
void *frontend;
Frontend *frontend;
/*
* Values cached out of conf.

Просмотреть файл

@ -17,7 +17,7 @@ struct LogContext_tag {
enum { L_CLOSED, L_OPENING, L_OPEN, L_ERROR } state;
bufchain queue;
Filename *currlogfilename;
void *frontend;
Frontend *frontend;
Conf *conf;
int logtype; /* cached out of conf */
};
@ -367,7 +367,7 @@ void log_packet(LogContext *ctx, int direction, int type,
logflush(ctx);
}
LogContext *log_init(void *frontend, Conf *conf)
LogContext *log_init(Frontend *frontend, Conf *conf)
{
LogContext *ctx = snew(LogContext);
ctx->lgfp = NULL;

2
misc.c
Просмотреть файл

@ -216,7 +216,7 @@ char *host_strduptrim(const char *s)
return dupstr(s);
}
prompts_t *new_prompts(void *frontend)
prompts_t *new_prompts(Frontend *frontend)
{
prompts_t *p = snew(prompts_t);
p->prompts = NULL;

Просмотреть файл

@ -95,7 +95,8 @@ Socket new_connection(SockAddr addr, const char *hostname,
Socket new_listener(const char *srcaddr, int port, Plug plug,
int local_host_only, Conf *conf, int addressfamily);
SockAddr name_lookup(const char *host, int port, char **canonicalname,
Conf *conf, int addressfamily, void *frontend_for_logging,
Conf *conf, int addressfamily,
Frontend *frontend_for_logging,
const char *lookup_reason_for_logging);
int proxy_for_destination (SockAddr addr, const char *hostname, int port,
Conf *conf);
@ -221,7 +222,7 @@ extern Plug nullplug;
/*
* Exports from be_misc.c.
*/
void backend_socket_log(void *frontend, int type, SockAddr addr, int port,
void backend_socket_log(Frontend *frontend, int type, SockAddr addr, int port,
const char *error_msg, int error_code, Conf *conf,
int session_started);
void log_proxy_stderr(Plug plug, bufchain *buf, const void *vdata, int len);

Просмотреть файл

@ -368,7 +368,7 @@ static char *dns_log_msg(const char *host, int addressfamily,
}
SockAddr name_lookup(const char *host, int port, char **canonicalname,
Conf *conf, int addressfamily, void *frontend,
Conf *conf, int addressfamily, Frontend *frontend,
const char *reason)
{
char *logmsg;

9
pscp.c
Просмотреть файл

@ -118,7 +118,7 @@ void nonfatal(const char *fmt, ...)
sfree(str2);
errs++;
}
void connection_fatal(void *frontend, const char *fmt, ...)
void connection_fatal(Frontend *frontend, const char *fmt, ...)
{
char *str, *str2;
va_list ap;
@ -157,7 +157,8 @@ static unsigned char *outptr; /* where to put the data */
static unsigned outlen; /* how much data required */
static unsigned char *pending = NULL; /* any spare data */
static unsigned pendlen = 0, pendsize = 0; /* length and phys. size of buffer */
int from_backend(void *frontend, int is_stderr, const void *data, int datalen)
int from_backend(Frontend *frontend, int is_stderr,
const void *data, int datalen)
{
unsigned char *p = (unsigned char *) data;
unsigned len = (unsigned) datalen;
@ -195,7 +196,7 @@ int from_backend(void *frontend, int is_stderr, const void *data, int datalen)
return 0;
}
int from_backend_untrusted(void *frontend_handle, const void *data, int len)
int from_backend_untrusted(Frontend *frontend, const void *data, int len)
{
/*
* No "untrusted" output should get here (the way the code is
@ -204,7 +205,7 @@ int from_backend_untrusted(void *frontend_handle, const void *data, int len)
assert(!"Unexpected call to from_backend_untrusted()");
return 0; /* not reached */
}
int from_backend_eof(void *frontend)
int from_backend_eof(Frontend *frontend)
{
/*
* We usually expect to be the party deciding when to close the

Просмотреть файл

@ -2466,7 +2466,7 @@ void nonfatal(const char *fmt, ...)
fputs(str2, stderr);
sfree(str2);
}
void connection_fatal(void *frontend, const char *fmt, ...)
void connection_fatal(Frontend *frontend, const char *fmt, ...)
{
char *str, *str2;
va_list ap;
@ -2506,7 +2506,8 @@ static unsigned char *outptr; /* where to put the data */
static unsigned outlen; /* how much data required */
static unsigned char *pending = NULL; /* any spare data */
static unsigned pendlen = 0, pendsize = 0; /* length and phys. size of buffer */
int from_backend(void *frontend, int is_stderr, const void *data, int datalen)
int from_backend(Frontend *frontend, int is_stderr,
const void *data, int datalen)
{
unsigned char *p = (unsigned char *) data;
unsigned len = (unsigned) datalen;
@ -2550,7 +2551,7 @@ int from_backend(void *frontend, int is_stderr, const void *data, int datalen)
return 0;
}
int from_backend_untrusted(void *frontend_handle, const void *data, int len)
int from_backend_untrusted(Frontend *frontend, const void *data, int len)
{
/*
* No "untrusted" output should get here (the way the code is
@ -2559,7 +2560,7 @@ int from_backend_untrusted(void *frontend_handle, const void *data, int len)
assert(!"Unexpected call to from_backend_untrusted()");
return 0; /* not reached */
}
int from_backend_eof(void *frontend)
int from_backend_eof(Frontend *frontend)
{
/*
* We expect to be the party deciding when to close the

96
putty.h
Просмотреть файл

@ -445,7 +445,7 @@ struct Backend {
const Backend_vtable *vt;
};
struct Backend_vtable {
const char *(*init) (void *frontend_handle, Backend **backend_out,
const char *(*init) (Frontend *frontend, Backend **backend_out,
Conf *conf, const char *host, int port,
char **realhost, int nodelay, int keepalive);
@ -608,11 +608,11 @@ typedef struct {
size_t n_prompts; /* May be zero (in which case display the foregoing,
* if any, and return success) */
prompt_t **prompts;
void *frontend;
Frontend *frontend;
void *data; /* slot for housekeeping data, managed by
* get_userpass_input(); initially NULL */
} prompts_t;
prompts_t *new_prompts(void *frontend);
prompts_t *new_prompts(Frontend *frontend);
void add_prompt(prompts_t *p, char *promptstr, int echo);
void prompt_set_result(prompt_t *pr, const char *newstr);
void prompt_ensure_result_size(prompt_t *pr, int len);
@ -673,7 +673,7 @@ enum { ALL_CLIPBOARDS(CLIP_ID) N_CLIPBOARDS };
/*
* Exports from the front end.
*/
void request_resize(void *frontend, int, int);
void request_resize(Frontend *frontend, int, int);
void do_text(Context, int, int, wchar_t *, int, unsigned long, int,
truecolour);
void do_cursor(Context, int, int, wchar_t *, int, unsigned long, int,
@ -682,46 +682,46 @@ int char_width(Context ctx, int uc);
#ifdef OPTIMISE_SCROLL
void do_scroll(Context, int, int, int);
#endif
void set_title(void *frontend, char *);
void set_icon(void *frontend, char *);
void set_sbar(void *frontend, int, int, int);
Context get_ctx(void *frontend);
void set_title(Frontend *frontend, char *);
void set_icon(Frontend *frontend, char *);
void set_sbar(Frontend *frontend, int, int, int);
Context get_ctx(Frontend *frontend);
void free_ctx(Context);
void palette_set(void *frontend, int, int, int, int);
void palette_reset(void *frontend);
int palette_get(void *frontend, int n, int *r, int *g, int *b);
void write_clip(void *frontend, int clipboard, wchar_t *, int *,
void palette_set(Frontend *frontend, int, int, int, int);
void palette_reset(Frontend *frontend);
int palette_get(Frontend *frontend, int n, int *r, int *g, int *b);
void write_clip(Frontend *frontend, int clipboard, wchar_t *, int *,
truecolour *, int, int);
void optimised_move(void *frontend, int, int, int);
void set_raw_mouse_mode(void *frontend, int);
void connection_fatal(void *frontend, const char *, ...);
void optimised_move(Frontend *frontend, int, int, int);
void set_raw_mouse_mode(Frontend *frontend, int);
void connection_fatal(Frontend *frontend, const char *, ...);
void nonfatal(const char *, ...);
void modalfatalbox(const char *, ...);
#ifdef macintosh
#pragma noreturn(modalfatalbox)
#endif
void do_beep(void *frontend, int);
void begin_session(void *frontend);
void sys_cursor(void *frontend, int x, int y);
void frontend_request_paste(void *frontend, int clipboard);
void frontend_keypress(void *frontend);
void frontend_echoedit_update(void *frontend, int echo, int edit);
void do_beep(Frontend *frontend, int);
void begin_session(Frontend *frontend);
void sys_cursor(Frontend *frontend, int x, int y);
void frontend_request_paste(Frontend *frontend, int clipboard);
void frontend_keypress(Frontend *frontend);
void frontend_echoedit_update(Frontend *frontend, int echo, int edit);
/* It's the backend's responsibility to invoke this at the start of a
* connection, if necessary; it can also invoke it later if the set of
* special commands changes. It does not need to invoke it at session
* shutdown. */
void update_specials_menu(void *frontend);
int from_backend(void *frontend, int is_stderr, const void *data, int len);
int from_backend_untrusted(void *frontend, const void *data, int len);
void update_specials_menu(Frontend *frontend);
int from_backend(Frontend *frontend, int is_stderr, const void *data, int len);
int from_backend_untrusted(Frontend *frontend, const void *data, int len);
/* Called when the back end wants to indicate that EOF has arrived on
* the server-to-client stream. Returns FALSE to indicate that we
* intend to keep the session open in the other direction, or TRUE to
* indicate that if they're closing so are we. */
int from_backend_eof(void *frontend);
void notify_remote_exit(void *frontend);
int from_backend_eof(Frontend *frontend);
void notify_remote_exit(Frontend *frontend);
/* Get a sensible value for a tty mode. NULL return = don't set.
* Otherwise, returned value should be freed by caller. */
char *get_ttymode(void *frontend, const char *mode);
char *get_ttymode(Frontend *frontend, const char *mode);
/*
* >0 = `got all results, carry on'
* 0 = `user cancelled' (FIXME distinguish "give up entirely" and "next auth"?)
@ -730,15 +730,15 @@ char *get_ttymode(void *frontend, const char *mode);
int get_userpass_input(prompts_t *p, bufchain *input);
#define OPTIMISE_IS_SCROLL 1
void set_iconic(void *frontend, int iconic);
void move_window(void *frontend, int x, int y);
void set_zorder(void *frontend, int top);
void refresh_window(void *frontend);
void set_zoomed(void *frontend, int zoomed);
int is_iconic(void *frontend);
void get_window_pos(void *frontend, int *x, int *y);
void get_window_pixels(void *frontend, int *x, int *y);
char *get_window_title(void *frontend, int icon);
void set_iconic(Frontend *frontend, int iconic);
void move_window(Frontend *frontend, int x, int y);
void set_zorder(Frontend *frontend, int top);
void refresh_window(Frontend *frontend);
void set_zoomed(Frontend *frontend, int zoomed);
int is_iconic(Frontend *frontend);
void get_window_pos(Frontend *frontend, int *x, int *y);
void get_window_pixels(Frontend *frontend, int *x, int *y);
char *get_window_title(Frontend *frontend, int icon);
/* Hint from backend to frontend about time-consuming operations.
* Initial state is assumed to be BUSY_NOT. */
enum {
@ -748,8 +748,8 @@ enum {
stuff is suspended */
BUSY_CPU /* Locally busy (e.g. crypto); user interaction suspended */
};
void set_busy_status(void *frontend, int status);
int frontend_is_utf8(void *frontend);
void set_busy_status(Frontend *frontend, int status);
int frontend_is_utf8(Frontend *frontend);
void cleanup_exit(int);
@ -1105,7 +1105,7 @@ FontSpec *platform_default_fontspec(const char *name);
* Exports from terminal.c.
*/
Terminal *term_init(Conf *, struct unicode_data *, void *);
Terminal *term_init(Conf *, struct unicode_data *, Frontend *);
void term_free(Terminal *);
void term_size(Terminal *, int, int, int);
void term_paint(Terminal *, Context, int, int, int, int, int);
@ -1142,7 +1142,7 @@ int format_arrow_key(char *buf, Terminal *term, int xkey, int ctrl);
/*
* Exports from logging.c.
*/
LogContext *log_init(void *frontend, Conf *conf);
LogContext *log_init(Frontend *frontend, Conf *conf);
void log_free(LogContext *logctx);
void log_reconfig(LogContext *logctx, Conf *conf);
void logfopen(LogContext *logctx);
@ -1196,7 +1196,7 @@ extern const struct Backend_vtable ssh_backend;
/*
* Exports from ldisc.c.
*/
Ldisc *ldisc_create(Conf *, Terminal *, Backend *, void *);
Ldisc *ldisc_create(Conf *, Terminal *, Backend *, Frontend *);
void ldisc_configure(Ldisc *, Conf *);
void ldisc_free(Ldisc *);
void ldisc_send(Ldisc *, const void *buf, int len, int interactive);
@ -1324,7 +1324,7 @@ int wc_unescape(char *output, const char *wildcard);
/*
* Exports from frontend (windlg.c etc)
*/
void logevent(void *frontend, const char *);
void logevent(Frontend *frontend, const char *);
void pgp_fingerprints(void);
/*
* verify_ssh_host_key() can return one of three values:
@ -1338,7 +1338,7 @@ void pgp_fingerprints(void);
* back via the provided function with a result that's either 0
* or +1'.
*/
int verify_ssh_host_key(void *frontend, char *host, int port,
int verify_ssh_host_key(Frontend *frontend, char *host, int port,
const char *keytype, char *keystr, char *fingerprint,
void (*callback)(void *ctx, int result), void *ctx);
/*
@ -1354,9 +1354,9 @@ int have_ssh_host_key(const char *host, int port, const char *keytype);
* warning threshold because that's all we have cached, but at least
* one acceptable algorithm is available that we don't have cached.)
*/
int askalg(void *frontend, const char *algtype, const char *algname,
int askalg(Frontend *frontend, const char *algtype, const char *algname,
void (*callback)(void *ctx, int result), void *ctx);
int askhk(void *frontend, const char *algname, const char *betteralgs,
int askhk(Frontend *frontend, const char *algname, const char *betteralgs,
void (*callback)(void *ctx, int result), void *ctx);
/*
* askappend can return four values:
@ -1366,7 +1366,7 @@ int askhk(void *frontend, const char *algname, const char *betteralgs,
* - 0 means cancel logging for this session
* - -1 means please wait.
*/
int askappend(void *frontend, Filename *filename,
int askappend(Frontend *frontend, Filename *filename,
void (*callback)(void *ctx, int result), void *ctx);
/*
@ -1631,9 +1631,9 @@ struct IdempotentCallback {
};
void queue_idempotent_callback(struct IdempotentCallback *ic);
typedef void (*toplevel_callback_notify_fn_t)(void *frontend);
typedef void (*toplevel_callback_notify_fn_t)(void *ctx);
void request_callback_notifications(toplevel_callback_notify_fn_t notify,
void *frontend);
void *ctx);
/*
* Define no-op macros for the jump list functions, on platforms that

6
raw.c
Просмотреть файл

@ -14,7 +14,7 @@ typedef struct raw_backend_data {
Socket s;
int closed_on_socket_error;
int bufsize;
void *frontend;
Frontend *frontend;
int sent_console_eof, sent_socket_eof, session_started;
Conf *conf;
@ -117,7 +117,7 @@ static const Plug_vtable Raw_plugvt = {
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static const char *raw_init(void *frontend_handle, Backend **backend_handle,
static const char *raw_init(Frontend *frontend, Backend **backend_handle,
Conf *conf,
const char *host, int port, char **realhost,
int nodelay, int keepalive)
@ -139,7 +139,7 @@ static const char *raw_init(void *frontend_handle, Backend **backend_handle,
raw->session_started = FALSE;
raw->conf = conf_copy(conf);
raw->frontend = frontend_handle;
raw->frontend = frontend;
addressfamily = conf_get_int(conf, CONF_addressfamily);
/*

Просмотреть файл

@ -18,7 +18,7 @@ typedef struct rlogin_tag {
int firstbyte;
int cansize;
int term_width, term_height;
void *frontend;
Frontend *frontend;
Conf *conf;
@ -148,7 +148,7 @@ static const Plug_vtable Rlogin_plugvt = {
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static const char *rlogin_init(void *frontend_handle, Backend **backend_handle,
static const char *rlogin_init(Frontend *frontend, Backend **backend_handle,
Conf *conf,
const char *host, int port, char **realhost,
int nodelay, int keepalive)
@ -165,7 +165,7 @@ static const char *rlogin_init(void *frontend_handle, Backend **backend_handle,
rlogin->backend.vt = &rlogin_backend;
rlogin->s = NULL;
rlogin->closed_on_socket_error = FALSE;
rlogin->frontend = frontend_handle;
rlogin->frontend = frontend;
rlogin->term_width = conf_get_int(conf, CONF_width);
rlogin->term_height = conf_get_int(conf, CONF_height);
rlogin->firstbyte = 1;

6
ssh.c
Просмотреть файл

@ -729,7 +729,7 @@ struct ssh_tag {
int echoing, editing;
int session_started;
void *frontend;
Frontend *frontend;
int ospeed, ispeed; /* temporaries */
int term_width, term_height;
@ -10665,7 +10665,7 @@ static void ssh_cache_conf_values(Ssh ssh)
*
* Returns an error message, or NULL on success.
*/
static const char *ssh_init(void *frontend_handle, Backend **backend_handle,
static const char *ssh_init(Frontend *frontend, Backend **backend_handle,
Conf *conf,
const char *host, int port, char **realhost,
int nodelay, int keepalive)
@ -10781,7 +10781,7 @@ static const char *ssh_init(void *frontend_handle, Backend **backend_handle,
ssh->backend.vt = &ssh_backend;
*backend_handle = &ssh->backend;
ssh->frontend = frontend_handle;
ssh->frontend = frontend;
ssh->term_width = conf_get_int(ssh->conf, CONF_width);
ssh->term_height = conf_get_int(ssh->conf, CONF_height);

2
ssh.h
Просмотреть файл

@ -660,7 +660,7 @@ int random_byte(void);
void random_add_noise(void *noise, int length);
void random_add_heavynoise(void *noise, int length);
void logevent(void *, const char *);
void logevent(Frontend *, const char *);
struct PortForwarding;

Просмотреть файл

@ -172,7 +172,7 @@ typedef struct telnet_tag {
Socket s;
int closed_on_socket_error;
void *frontend;
Frontend *frontend;
Ldisc *ldisc;
int term_width, term_height;
@ -705,7 +705,7 @@ static const Plug_vtable Telnet_plugvt = {
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static const char *telnet_init(void *frontend_handle, Backend **backend_handle,
static const char *telnet_init(Frontend *frontend, Backend **backend_handle,
Conf *conf, const char *host, int port,
char **realhost, int nodelay, int keepalive)
{
@ -726,7 +726,7 @@ static const char *telnet_init(void *frontend_handle, Backend **backend_handle,
telnet->activated = FALSE;
telnet->sb_buf = NULL;
telnet->sb_size = 0;
telnet->frontend = frontend_handle;
telnet->frontend = frontend;
telnet->term_width = conf_get_int(telnet->conf, CONF_width);
telnet->term_height = conf_get_int(telnet->conf, CONF_height);
telnet->state = TOP_LEVEL;

Просмотреть файл

@ -1639,7 +1639,7 @@ const optionalrgb optionalrgb_none = {0, 0, 0, 0};
* Initialise the terminal.
*/
Terminal *term_init(Conf *myconf, struct unicode_data *ucsdata,
void *frontend)
Frontend *frontend)
{
Terminal *term;

Просмотреть файл

@ -231,7 +231,7 @@ struct terminal_tag {
Ldisc *ldisc;
void *frontend;
Frontend *frontend;
LogContext *logctx;

Просмотреть файл

@ -32,9 +32,9 @@
#include "putty.h"
static const char *null_init(void *, Backend **, Conf *, const char *, int,
static const char *null_init(Frontend *, Backend **, Conf *, const char *, int,
char **, int, int);
static const char *loop_init(void *, Backend **, Conf *, const char *, int,
static const char *loop_init(Frontend *, Backend **, Conf *, const char *, int,
char **, int, int);
static void null_free(Backend *);
static void loop_free(Backend *);
@ -69,23 +69,23 @@ const struct Backend_vtable loop_backend = {
};
struct loop_state {
Terminal *term;
Frontend *frontend;
Backend backend;
};
static const char *null_init(void *frontend_handle, Backend **backend_handle,
static const char *null_init(Frontend *frontend, Backend **backend_handle,
Conf *conf, const char *host, int port,
char **realhost, int nodelay, int keepalive) {
*backend_handle = NULL;
return NULL;
}
static const char *loop_init(void *frontend_handle, Backend **backend_handle,
static const char *loop_init(Frontend *frontend, Backend **backend_handle,
Conf *conf, const char *host, int port,
char **realhost, int nodelay, int keepalive) {
struct loop_state *st = snew(struct loop_state);
st->term = frontend_handle;
st->frontend = frontend;
*backend_handle = &st->backend;
return NULL;
}
@ -114,7 +114,7 @@ static int null_send(Backend *be, const char *buf, int len) {
static int loop_send(Backend *be, const char *buf, int len) {
struct loop_state *st = FROMFIELD(be, struct loop_state, backend);
return from_backend(st->term, 0, buf, len);
return from_backend(st->frontend, 0, buf, len);
}
static int null_sendbuffer(Backend *be) {

Просмотреть файл

@ -99,7 +99,7 @@ int main(int argc, char **argv)
fprintf(stderr, "GtkApplication frontend doesn't work pre-GTK3\n");
return 1;
}
GtkWidget *make_gtk_toplevel_window(void *frontend) { return NULL; }
GtkWidget *make_gtk_toplevel_window(Frontend *frontend) { return NULL; }
void launch_duplicate_session(Conf *conf) {}
void launch_new_session(void) {}
void launch_saved_session(const char *str) {}
@ -204,7 +204,7 @@ WIN_ACTION_LIST(WIN_ACTION_ENTRY)
};
static GtkApplication *app;
GtkWidget *make_gtk_toplevel_window(void *frontend)
GtkWidget *make_gtk_toplevel_window(Frontend *frontend)
{
GtkWidget *win = gtk_application_window_new(app);
g_action_map_add_action_entries(G_ACTION_MAP(win),

Просмотреть файл

@ -221,7 +221,7 @@ static gint idle_toplevel_callback_func(gpointer data)
return TRUE;
}
static void notify_toplevel_callback(void *frontend)
static void notify_toplevel_callback(void *vctx)
{
if (!idle_fn_scheduled) {
toplevel_callback_idle_id =

Просмотреть файл

@ -3442,7 +3442,7 @@ struct verify_ssh_host_key_result_ctx {
char *keystr;
void (*callback)(void *callback_ctx, int result);
void *callback_ctx;
void *frontend;
Frontend *frontend;
};
static void verify_ssh_host_key_result_callback(void *vctx, int result)
@ -3483,7 +3483,7 @@ static void verify_ssh_host_key_result_callback(void *vctx, int result)
sfree(ctx);
}
int verify_ssh_host_key(void *frontend, char *host, int port,
int verify_ssh_host_key(Frontend *frontend, char *host, int port,
const char *keytype, char *keystr, char *fingerprint,
void (*callback)(void *ctx, int result), void *ctx)
{
@ -3560,7 +3560,7 @@ int verify_ssh_host_key(void *frontend, char *host, int port,
struct simple_prompt_result_ctx {
void (*callback)(void *callback_ctx, int result);
void *callback_ctx;
void *frontend;
Frontend *frontend;
enum DialogSlot dialog_slot;
};
@ -3584,7 +3584,7 @@ static void simple_prompt_result_callback(void *vctx, int result)
* Ask whether the selected algorithm is acceptable (since it was
* below the configured 'warn' threshold).
*/
int askalg(void *frontend, const char *algtype, const char *algname,
int askalg(Frontend *frontend, const char *algtype, const char *algname,
void (*callback)(void *ctx, int result), void *ctx)
{
static const char msg[] =
@ -3616,7 +3616,7 @@ int askalg(void *frontend, const char *algtype, const char *algname,
return -1; /* dialog still in progress */
}
int askhk(void *frontend, const char *algname, const char *betteralgs,
int askhk(Frontend *frontend, const char *algname, const char *betteralgs,
void (*callback)(void *ctx, int result), void *ctx)
{
static const char msg[] =
@ -4059,7 +4059,7 @@ void logevent_dlg(void *estuff, const char *string)
}
}
int askappend(void *frontend, Filename *filename,
int askappend(Frontend *frontend, Filename *filename,
void (*callback)(void *ctx, int result), void *ctx)
{
static const char msgtemplate[] =

Просмотреть файл

@ -549,7 +549,7 @@ int do_cmdline(int argc, char **argv, int do_everything, Conf *conf)
return err;
}
GtkWidget *make_gtk_toplevel_window(void *frontend)
GtkWidget *make_gtk_toplevel_window(Frontend *frontend)
{
return gtk_window_new(GTK_WINDOW_TOPLEVEL);
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -175,7 +175,7 @@ void launch_saved_session(const char *str);
void session_window_closed(void);
void window_setup_error(const char *errmsg);
#ifdef MAY_REFER_TO_GTK_IN_HEADERS
GtkWidget *make_gtk_toplevel_window(void *frontend);
GtkWidget *make_gtk_toplevel_window(Frontend *frontend);
#endif
const struct Backend_vtable *select_backend(Conf *conf);
@ -189,16 +189,16 @@ enum MenuAction {
MA_RESTART_SESSION, MA_CHANGE_SETTINGS, MA_CLEAR_SCROLLBACK,
MA_RESET_TERMINAL, MA_EVENT_LOG
};
void app_menu_action(void *frontend, enum MenuAction);
void app_menu_action(Frontend *frontend, enum MenuAction);
/* Things pty.c needs from pterm.c */
const char *get_x_display(void *frontend);
int font_dimension(void *frontend, int which);/* 0 for width, 1 for height */
int get_windowid(void *frontend, long *id);
const char *get_x_display(Frontend *frontend);
int font_dimension(Frontend *frontend, int which);/* 0 for width, 1 for height */
int get_windowid(Frontend *frontend, long *id);
/* Things gtkdlg.c needs from pterm.c */
#ifdef MAY_REFER_TO_GTK_IN_HEADERS
GtkWidget *get_window(void *frontend);
GtkWidget *get_window(Frontend *frontend);
enum DialogSlot {
DIALOG_SLOT_RECONFIGURE,
DIALOG_SLOT_NETWORK_PROMPT,
@ -207,8 +207,8 @@ enum DialogSlot {
DIALOG_SLOT_CONNECTION_FATAL,
DIALOG_SLOT_LIMIT /* must remain last */
};
void register_dialog(void *frontend, enum DialogSlot slot, GtkWidget *dialog);
void unregister_dialog(void *frontend, enum DialogSlot slot);
void register_dialog(Frontend *frontend, enum DialogSlot slot, GtkWidget *dialog);
void unregister_dialog(Frontend *frontend, enum DialogSlot slot);
#endif
/* Things pterm.c needs from gtkdlg.c */

Просмотреть файл

@ -63,15 +63,15 @@ void cleanup_exit(int code)
exit(code);
}
void set_busy_status(void *frontend, int status)
void set_busy_status(Frontend *frontend, int status)
{
}
void update_specials_menu(void *frontend)
void update_specials_menu(Frontend *frontend)
{
}
void notify_remote_exit(void *frontend)
void notify_remote_exit(Frontend *frontend)
{
}
@ -113,7 +113,7 @@ static int block_and_read(int fd, void *buf, size_t len)
return ret;
}
int verify_ssh_host_key(void *frontend, char *host, int port,
int verify_ssh_host_key(Frontend *frontend, char *host, int port,
const char *keytype, char *keystr, char *fingerprint,
void (*callback)(void *ctx, int result), void *ctx)
{
@ -223,7 +223,7 @@ int verify_ssh_host_key(void *frontend, char *host, int port,
* Ask whether the selected algorithm is acceptable (since it was
* below the configured 'warn' threshold).
*/
int askalg(void *frontend, const char *algtype, const char *algname,
int askalg(Frontend *frontend, const char *algtype, const char *algname,
void (*callback)(void *ctx, int result), void *ctx)
{
static const char msg[] =
@ -270,7 +270,7 @@ int askalg(void *frontend, const char *algtype, const char *algname,
}
}
int askhk(void *frontend, const char *algname, const char *betteralgs,
int askhk(Frontend *frontend, const char *algname, const char *betteralgs,
void (*callback)(void *ctx, int result), void *ctx)
{
static const char msg[] =
@ -327,7 +327,7 @@ int askhk(void *frontend, const char *algname, const char *betteralgs,
* Ask whether to wipe a session log file before writing to it.
* Returns 2 for wipe, 1 for append, 0 for cancel (don't log).
*/
int askappend(void *frontend, Filename *filename,
int askappend(Frontend *frontend, Filename *filename,
void (*callback)(void *ctx, int result), void *ctx)
{
static const char msgtemplate[] =
@ -410,7 +410,7 @@ void console_provide_logctx(LogContext *logctx)
console_logctx = logctx;
}
void logevent(void *frontend, const char *string)
void logevent(Frontend *frontend, const char *string)
{
struct termios cf;
if ((flags & FLAG_STDERR) && (flags & FLAG_VERBOSE))
@ -546,7 +546,7 @@ int console_get_userpass_input(prompts_t *p)
return 1; /* success */
}
void frontend_keypress(void *handle)
void frontend_keypress(Frontend *frontend)
{
/*
* This is nothing but a stub, in console code.

Просмотреть файл

@ -42,7 +42,7 @@ void nonfatal(const char *p, ...)
va_end(ap);
fputc('\n', stderr);
}
void connection_fatal(void *frontend, const char *p, ...)
void connection_fatal(Frontend *frontend, const char *p, ...)
{
va_list ap;
fprintf(stderr, "FATAL ERROR: ");
@ -93,7 +93,7 @@ FontSpec *platform_default_fontspec(const char *name) { return fontspec_new("");
Filename *platform_default_filename(const char *name) { return filename_from_str(""); }
char *x_get_default(const char *key) { return NULL; }
void log_eventlog(LogContext *logctx, const char *event) {}
int from_backend(void *frontend, int is_stderr, const void *data, int datalen)
int from_backend(Frontend *fe, int is_stderr, const void *data, int datalen)
{ assert(!"only here to satisfy notional call from backend_socket_log"); }
/*

Просмотреть файл

@ -58,7 +58,7 @@ void nonfatal(const char *p, ...)
fputc('\n', stderr);
postmsg(&cf);
}
void connection_fatal(void *frontend, const char *p, ...)
void connection_fatal(Frontend *frontend, const char *p, ...)
{
struct termios cf;
va_list ap;
@ -132,7 +132,7 @@ int term_ldisc(Terminal *term, int mode)
{
return FALSE;
}
void frontend_echoedit_update(void *frontend, int echo, int edit)
void frontend_echoedit_update(Frontend *frontend, int echo, int edit)
{
/* Update stdin read mode to reflect changes in line discipline. */
struct termios mode;
@ -190,7 +190,7 @@ static char *get_ttychar(struct termios *t, int index)
return dupprintf("^<%d>", c);
}
char *get_ttymode(void *frontend, const char *mode)
char *get_ttymode(Frontend *frontend, const char *mode)
{
/*
* Propagate appropriate terminal modes from the local terminal,
@ -400,7 +400,7 @@ int try_output(int is_stderr)
return bufchain_size(&stdout_data) + bufchain_size(&stderr_data);
}
int from_backend(void *frontend_handle, int is_stderr,
int from_backend(Frontend *frontend, int is_stderr,
const void *data, int len)
{
if (is_stderr) {
@ -413,7 +413,7 @@ int from_backend(void *frontend_handle, int is_stderr,
}
}
int from_backend_untrusted(void *frontend_handle, const void *data, int len)
int from_backend_untrusted(Frontend *frontend, const void *data, int len)
{
/*
* No "untrusted" output should get here (the way the code is
@ -423,7 +423,7 @@ int from_backend_untrusted(void *frontend_handle, const void *data, int len)
return 0; /* not reached */
}
int from_backend_eof(void *frontend_handle)
int from_backend_eof(Frontend *frontend)
{
assert(outgoingeof == EOF_NO);
outgoingeof = EOF_PENDING;

Просмотреть файл

@ -71,7 +71,7 @@ static int pty_signal_pipe[2] = { -1, -1 }; /* obviously bogus initial val */
struct pty_tag {
Conf *conf;
int master_fd, slave_fd;
void *frontend;
Frontend *frontend;
char name[FILENAME_MAX];
pid_t child_pid;
int term_width, term_height;
@ -729,7 +729,7 @@ static void pty_uxsel_setup(Pty pty)
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static const char *pty_init(void *frontend, Backend **backend_handle,
static const char *pty_init(Frontend *frontend, Backend **backend_handle,
Conf *conf, const char *host, int port,
char **realhost, int nodelay, int keepalive)
{

Просмотреть файл

@ -18,7 +18,7 @@
#define SERIAL_MAX_BACKLOG 4096
typedef struct serial_backend_data {
void *frontend;
Frontend *frontend;
int fd;
int finished;
int inbufsize;
@ -288,7 +288,7 @@ static const char *serial_configure(Serial serial, Conf *conf)
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static const char *serial_init(void *frontend_handle, Backend **backend_handle,
static const char *serial_init(Frontend *frontend, Backend **backend_handle,
Conf *conf,
const char *host, int port, char **realhost,
int nodelay, int keepalive)
@ -301,7 +301,7 @@ static const char *serial_init(void *frontend_handle, Backend **backend_handle,
serial->backend.vt = &serial_backend;
*backend_handle = &serial->backend;
serial->frontend = frontend_handle;
serial->frontend = frontend;
serial->finished = FALSE;
serial->inbufsize = 0;
bufchain_init(&serial->output_data);

Просмотреть файл

@ -66,7 +66,7 @@ Filename *platform_default_filename(const char *name)
return filename_from_str("");
}
char *get_ttymode(void *frontend, const char *mode) { return NULL; }
char *get_ttymode(Frontend *frontend, const char *mode) { return NULL; }
int get_userpass_input(prompts_t *p, bufchain *input)
{

Просмотреть файл

@ -30,11 +30,11 @@ void cleanup_exit(int code)
exit(code);
}
void set_busy_status(void *frontend, int status)
void set_busy_status(Frontend *frontend, int status)
{
}
void notify_remote_exit(void *frontend)
void notify_remote_exit(Frontend *frontend)
{
}
@ -42,7 +42,7 @@ void timer_change_notify(unsigned long next)
{
}
int verify_ssh_host_key(void *frontend, char *host, int port,
int verify_ssh_host_key(Frontend *frontend, char *host, int port,
const char *keytype, char *keystr, char *fingerprint,
void (*callback)(void *ctx, int result), void *ctx)
{
@ -147,7 +147,7 @@ int verify_ssh_host_key(void *frontend, char *host, int port,
}
}
void update_specials_menu(void *frontend)
void update_specials_menu(Frontend *frontend)
{
}
@ -155,7 +155,7 @@ void update_specials_menu(void *frontend)
* Ask whether the selected algorithm is acceptable (since it was
* below the configured 'warn' threshold).
*/
int askalg(void *frontend, const char *algtype, const char *algname,
int askalg(Frontend *frontend, const char *algtype, const char *algname,
void (*callback)(void *ctx, int result), void *ctx)
{
HANDLE hin;
@ -196,7 +196,7 @@ int askalg(void *frontend, const char *algtype, const char *algname,
}
}
int askhk(void *frontend, const char *algname, const char *betteralgs,
int askhk(Frontend *frontend, const char *algname, const char *betteralgs,
void (*callback)(void *ctx, int result), void *ctx)
{
HANDLE hin;
@ -247,7 +247,7 @@ int askhk(void *frontend, const char *algname, const char *betteralgs,
* Ask whether to wipe a session log file before writing to it.
* Returns 2 for wipe, 1 for append, 0 for cancel (don't log).
*/
int askappend(void *frontend, Filename *filename,
int askappend(Frontend *frontend, Filename *filename,
void (*callback)(void *ctx, int result), void *ctx)
{
HANDLE hin;
@ -340,7 +340,7 @@ void console_provide_logctx(LogContext *logctx)
console_logctx = logctx;
}
void logevent(void *frontend, const char *string)
void logevent(Frontend *frontend, const char *string)
{
log_eventlog(console_logctx, string);
}
@ -467,7 +467,7 @@ int console_get_userpass_input(prompts_t *p)
return 1; /* success */
}
void frontend_keypress(void *handle)
void frontend_keypress(Frontend *frontend)
{
/*
* This is nothing but a stub, in console code.

Просмотреть файл

@ -761,7 +761,7 @@ int do_reconfig(HWND hwnd, int protcfginfo)
return ret;
}
void logevent(void *frontend, const char *string)
void logevent(Frontend *frontend, const char *string)
{
char timebuf[40];
char **location;
@ -813,7 +813,7 @@ void showabout(HWND hwnd)
DialogBox(hinst, MAKEINTRESOURCE(IDD_ABOUTBOX), hwnd, AboutProc);
}
int verify_ssh_host_key(void *frontend, char *host, int port,
int verify_ssh_host_key(Frontend *frontend, char *host, int port,
const char *keytype, char *keystr, char *fingerprint,
void (*callback)(void *ctx, int result), void *ctx)
{
@ -897,7 +897,7 @@ int verify_ssh_host_key(void *frontend, char *host, int port,
* Ask whether the selected algorithm is acceptable (since it was
* below the configured 'warn' threshold).
*/
int askalg(void *frontend, const char *algtype, const char *algname,
int askalg(Frontend *frontend, const char *algtype, const char *algname,
void (*callback)(void *ctx, int result), void *ctx)
{
static const char mbtitle[] = "%s Security Alert";
@ -922,7 +922,7 @@ int askalg(void *frontend, const char *algtype, const char *algname,
return 0;
}
int askhk(void *frontend, const char *algname, const char *betteralgs,
int askhk(Frontend *frontend, const char *algname, const char *betteralgs,
void (*callback)(void *ctx, int result), void *ctx)
{
static const char mbtitle[] = "%s Security Alert";
@ -953,7 +953,7 @@ int askhk(void *frontend, const char *algname, const char *betteralgs,
* Ask whether to wipe a session log file before writing to it.
* Returns 2 for wipe, 1 for append, 0 for cancel (don't log).
*/
int askappend(void *frontend, Filename *filename,
int askappend(Frontend *frontend, Filename *filename,
void (*callback)(void *ctx, int result), void *ctx)
{
static const char msgtemplate[] =

Просмотреть файл

@ -231,16 +231,16 @@ const int share_can_be_downstream = TRUE;
const int share_can_be_upstream = TRUE;
/* Dummy routine, only required in plink. */
void frontend_echoedit_update(void *frontend, int echo, int edit)
void frontend_echoedit_update(Frontend *frontend, int echo, int edit)
{
}
int frontend_is_utf8(void *frontend)
int frontend_is_utf8(Frontend *frontend)
{
return ucsdata.line_codepage == CP_UTF8;
}
char *get_ttymode(void *frontend, const char *mode)
char *get_ttymode(Frontend *frontend, const char *mode)
{
return term_get_ttymode(term, mode);
}
@ -946,7 +946,7 @@ static void update_savedsess_menu(void)
/*
* Update the Special Commands submenu.
*/
void update_specials_menu(void *frontend)
void update_specials_menu(Frontend *frontend)
{
HMENU new_menu;
int i, j;
@ -1052,7 +1052,7 @@ static void update_mouse_pointer(void)
}
}
void set_busy_status(void *frontend, int status)
void set_busy_status(Frontend *frontend, int status)
{
busy_status = status;
update_mouse_pointer();
@ -1061,7 +1061,7 @@ void set_busy_status(void *frontend, int status)
/*
* set or clear the "raw mouse message" mode
*/
void set_raw_mouse_mode(void *frontend, int activate)
void set_raw_mouse_mode(Frontend *frontend, int activate)
{
activate = activate && !conf_get_int(conf, CONF_no_mouse_rep);
send_raw_mouse = activate;
@ -1071,7 +1071,7 @@ void set_raw_mouse_mode(void *frontend, int activate)
/*
* Print a message box and close the connection.
*/
void connection_fatal(void *frontend, const char *fmt, ...)
void connection_fatal(Frontend *frontend, const char *fmt, ...)
{
va_list ap;
char *stuff, morestuff[100];
@ -1622,7 +1622,7 @@ static void deinit_fonts(void)
}
}
void request_resize(void *frontend, int w, int h)
void request_resize(Frontend *frontend, int w, int h)
{
int width, height;
@ -1970,7 +1970,7 @@ static int is_alt_pressed(void)
static int resizing;
void notify_remote_exit(void *fe)
void notify_remote_exit(Frontend *frontend)
{
int exitcode, close_on_exit;
@ -3277,7 +3277,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
* helper software tracks the system caret, so we should arrange to
* have one.)
*/
void sys_cursor(void *frontend, int x, int y)
void sys_cursor(Frontend *frontend, int x, int y)
{
int cx, cy;
@ -4813,7 +4813,7 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
return -1;
}
void set_title(void *frontend, char *title)
void set_title(Frontend *frontend, char *title)
{
sfree(window_name);
window_name = snewn(1 + strlen(title), char);
@ -4822,7 +4822,7 @@ void set_title(void *frontend, char *title)
SetWindowText(hwnd, title);
}
void set_icon(void *frontend, char *title)
void set_icon(Frontend *frontend, char *title)
{
sfree(icon_name);
icon_name = snewn(1 + strlen(title), char);
@ -4831,7 +4831,7 @@ void set_icon(void *frontend, char *title)
SetWindowText(hwnd, title);
}
void set_sbar(void *frontend, int total, int start, int page)
void set_sbar(Frontend *frontend, int total, int start, int page)
{
SCROLLINFO si;
@ -4849,7 +4849,7 @@ void set_sbar(void *frontend, int total, int start, int page)
SetScrollInfo(hwnd, SB_VERT, &si, TRUE);
}
Context get_ctx(void *frontend)
Context get_ctx(Frontend *frontend)
{
HDC hdc;
if (hwnd) {
@ -4879,7 +4879,7 @@ static void real_palette_set(int n, int r, int g, int b)
}
}
int palette_get(void *frontend, int n, int *r, int *g, int *b)
int palette_get(Frontend *frontend, int n, int *r, int *g, int *b)
{
if (n < 0 || n >= NALLCOLOURS)
return FALSE;
@ -4889,7 +4889,7 @@ int palette_get(void *frontend, int n, int *r, int *g, int *b)
return TRUE;
}
void palette_set(void *frontend, int n, int r, int g, int b)
void palette_set(Frontend *frontend, int n, int r, int g, int b)
{
if (n >= 16)
n += 256 - 16;
@ -4910,7 +4910,7 @@ void palette_set(void *frontend, int n, int r, int g, int b)
}
}
void palette_reset(void *frontend)
void palette_reset(Frontend *frontend)
{
int i;
@ -4939,7 +4939,7 @@ void palette_reset(void *frontend)
}
}
void write_aclip(void *frontend, int clipboard,
void write_aclip(Frontend *frontend, int clipboard,
char *data, int len, int must_deselect)
{
HGLOBAL clipdata;
@ -4987,7 +4987,7 @@ int cmpCOLORREF(void *va, void *vb)
/*
* Note: unlike write_aclip() this will not append a nul.
*/
void write_clip(void *frontend, int clipboard,
void write_clip(Frontend *frontend, int clipboard,
wchar_t *data, int *attr, truecolour *truecolour, int len,
int must_deselect)
{
@ -5458,7 +5458,7 @@ static void process_clipdata(HGLOBAL clipdata, int unicode)
sfree(clipboard_contents);
}
void frontend_request_paste(void *frontend, int clipboard)
void frontend_request_paste(Frontend *frontend, int clipboard)
{
assert(clipboard == CLIP_SYSTEM);
@ -5488,7 +5488,7 @@ void frontend_request_paste(void *frontend, int clipboard)
* Move `lines' lines from position `from' to position `to' in the
* window.
*/
void optimised_move(void *frontend, int to, int from, int lines)
void optimised_move(Frontend *frontend, int to, int from, int lines)
{
RECT r;
int min, max;
@ -5618,7 +5618,7 @@ static void flash_window(int mode)
/*
* Beep.
*/
void do_beep(void *frontend, int mode)
void do_beep(Frontend *frontend, int mode)
{
if (mode == BELL_DEFAULT) {
/*
@ -5680,7 +5680,7 @@ void do_beep(void *frontend, int mode)
* Minimise or restore the window in response to a server-side
* request.
*/
void set_iconic(void *frontend, int iconic)
void set_iconic(Frontend *frontend, int iconic)
{
if (IsIconic(hwnd)) {
if (!iconic)
@ -5694,7 +5694,7 @@ void set_iconic(void *frontend, int iconic)
/*
* Move the window in response to a server-side request.
*/
void move_window(void *frontend, int x, int y)
void move_window(Frontend *frontend, int x, int y)
{
int resize_action = conf_get_int(conf, CONF_resize_action);
if (resize_action == RESIZE_DISABLED ||
@ -5709,7 +5709,7 @@ void move_window(void *frontend, int x, int y)
* Move the window to the top or bottom of the z-order in response
* to a server-side request.
*/
void set_zorder(void *frontend, int top)
void set_zorder(Frontend *frontend, int top)
{
if (conf_get_int(conf, CONF_alwaysontop))
return; /* ignore */
@ -5720,7 +5720,7 @@ void set_zorder(void *frontend, int top)
/*
* Refresh the window in response to a server-side request.
*/
void refresh_window(void *frontend)
void refresh_window(Frontend *frontend)
{
InvalidateRect(hwnd, NULL, TRUE);
}
@ -5729,7 +5729,7 @@ void refresh_window(void *frontend)
* Maximise or restore the window in response to a server-side
* request.
*/
void set_zoomed(void *frontend, int zoomed)
void set_zoomed(Frontend *frontend, int zoomed)
{
if (IsZoomed(hwnd)) {
if (!zoomed)
@ -5743,7 +5743,7 @@ void set_zoomed(void *frontend, int zoomed)
/*
* Report whether the window is iconic, for terminal reports.
*/
int is_iconic(void *frontend)
int is_iconic(Frontend *frontend)
{
return IsIconic(hwnd);
}
@ -5751,7 +5751,7 @@ int is_iconic(void *frontend)
/*
* Report the window's position, for terminal reports.
*/
void get_window_pos(void *frontend, int *x, int *y)
void get_window_pos(Frontend *frontend, int *x, int *y)
{
RECT r;
GetWindowRect(hwnd, &r);
@ -5762,7 +5762,7 @@ void get_window_pos(void *frontend, int *x, int *y)
/*
* Report the window's pixel size, for terminal reports.
*/
void get_window_pixels(void *frontend, int *x, int *y)
void get_window_pixels(Frontend *frontend, int *x, int *y)
{
RECT r;
GetWindowRect(hwnd, &r);
@ -5773,7 +5773,7 @@ void get_window_pixels(void *frontend, int *x, int *y)
/*
* Return the window or icon title.
*/
char *get_window_title(void *frontend, int icon)
char *get_window_title(Frontend *frontend, int icon)
{
return icon ? icon_name : window_name;
}
@ -5906,7 +5906,7 @@ static void flip_full_screen()
}
}
void frontend_keypress(void *handle)
void frontend_keypress(Frontend *frontend)
{
/*
* Keypress termination in non-Close-On-Exit mode is not
@ -5917,17 +5917,17 @@ void frontend_keypress(void *handle)
return;
}
int from_backend(void *frontend, int is_stderr, const void *data, int len)
int from_backend(Frontend *frontend, int is_stderr, const void *data, int len)
{
return term_data(term, is_stderr, data, len);
}
int from_backend_untrusted(void *frontend, const void *data, int len)
int from_backend_untrusted(Frontend *frontend, const void *data, int len)
{
return term_data_untrusted(term, data, len);
}
int from_backend_eof(void *frontend)
int from_backend_eof(Frontend *frontend)
{
return TRUE; /* do respond to incoming EOF with outgoing */
}

Просмотреть файл

@ -45,7 +45,7 @@ void nonfatal(const char *p, ...)
va_end(ap);
fputc('\n', stderr);
}
void connection_fatal(void *frontend, const char *p, ...)
void connection_fatal(Frontend *frontend, const char *p, ...)
{
va_list ap;
fprintf(stderr, "FATAL ERROR: ");
@ -83,7 +83,7 @@ int term_ldisc(Terminal *term, int mode)
{
return FALSE;
}
void frontend_echoedit_update(void *frontend, int echo, int edit)
void frontend_echoedit_update(Frontend *frontend, int echo, int edit)
{
/* Update stdin read mode to reflect changes in line discipline. */
DWORD mode;
@ -100,9 +100,9 @@ void frontend_echoedit_update(void *frontend, int echo, int edit)
SetConsoleMode(inhandle, mode);
}
char *get_ttymode(void *frontend, const char *mode) { return NULL; }
char *get_ttymode(Frontend *frontend, const char *mode) { return NULL; }
int from_backend(void *frontend_handle, int is_stderr,
int from_backend(Frontend *frontend, int is_stderr,
const void *data, int len)
{
if (is_stderr) {
@ -114,7 +114,7 @@ int from_backend(void *frontend_handle, int is_stderr,
return handle_backlog(stdout_handle) + handle_backlog(stderr_handle);
}
int from_backend_untrusted(void *frontend_handle, const void *data, int len)
int from_backend_untrusted(Frontend *frontend, const void *data, int len)
{
/*
* No "untrusted" output should get here (the way the code is
@ -124,7 +124,7 @@ int from_backend_untrusted(void *frontend_handle, const void *data, int len)
return 0; /* not reached */
}
int from_backend_eof(void *frontend_handle)
int from_backend_eof(Frontend *frontend)
{
handle_write_eof(stdout_handle);
return FALSE; /* do not respond to incoming EOF with outgoing */

Просмотреть файл

@ -13,7 +13,7 @@
typedef struct serial_backend_data {
HANDLE port;
struct handle *out, *in;
void *frontend;
Frontend *frontend;
int bufsize;
long clearbreak_time;
int break_in_progress;
@ -199,7 +199,7 @@ static const char *serial_configure(Serial serial, HANDLE serport, Conf *conf)
* Also places the canonical host name into `realhost'. It must be
* freed by the caller.
*/
static const char *serial_init(void *frontend_handle, Backend **backend_handle,
static const char *serial_init(Frontend *frontend, Backend **backend_handle,
Conf *conf, const char *host, int port,
char **realhost, int nodelay, int keepalive)
{
@ -216,7 +216,7 @@ static const char *serial_init(void *frontend_handle, Backend **backend_handle,
serial->backend.vt = &serial_backend;
*backend_handle = &serial->backend;
serial->frontend = frontend_handle;
serial->frontend = frontend;
serline = conf_get_str(conf, CONF_serline);
{

Просмотреть файл

@ -13,7 +13,7 @@
#include "int64.h"
#include "winsecur.h"
char *get_ttymode(void *frontend, const char *mode) { return NULL; }
char *get_ttymode(Frontend *frontend, const char *mode) { return NULL; }
int get_userpass_input(prompts_t *p, bufchain *input)
{

Просмотреть файл

@ -247,7 +247,7 @@ GLOBAL LogContext *logctx;
* which takes the data string in the system code page instead of
* Unicode.
*/
void write_aclip(void *frontend, int clipboard, char *, int, int);
void write_aclip(Frontend *frontend, int clipboard, char *, int, int);
#define WM_NETEVENT (WM_APP + 5)