mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 03:52:49 -05:00
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:
96
putty.h
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
|
||||
|
Reference in New Issue
Block a user