1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-23 15:09:24 -05:00

Fixes (mostly from Colin Watson, a couple redone by me) to make Unix

PuTTY compile cleanly under gcc 4.6.0 without triggering any of its
new warnings.

[originally from svn r9169]
This commit is contained in:
Simon Tatham 2011-05-07 10:57:19 +00:00
parent e70878bd3a
commit 934a5ad6b2
7 changed files with 73 additions and 48 deletions

View File

@ -317,24 +317,46 @@ int main(int argc, char **argv)
val = p; val = p;
} else } else
val = NULL; val = NULL;
if (!strcmp(opt, "-help")) { if (!strcmp(opt, "-help")) {
if (val) {
errs = TRUE;
fprintf(stderr, "puttygen: option `-%s'"
" expects no argument\n", opt);
} else {
help(); help();
nogo = TRUE; nogo = TRUE;
}
} else if (!strcmp(opt, "-version")) { } else if (!strcmp(opt, "-version")) {
if (val) {
errs = TRUE;
fprintf(stderr, "puttygen: option `-%s'"
" expects no argument\n", opt);
} else {
showversion(); showversion();
nogo = TRUE; nogo = TRUE;
}
} else if (!strcmp(opt, "-pgpfp")) { } else if (!strcmp(opt, "-pgpfp")) {
/* support "-pgpfp" for consistency with others */ if (val) {
errs = TRUE;
fprintf(stderr, "puttygen: option `-%s'"
" expects no argument\n", opt);
} else {
/* support --pgpfp for consistency */
pgp_fingerprints(); pgp_fingerprints();
nogo = TRUE; nogo = TRUE;
} }
}
/* /*
* A sample option requiring an argument: * For long options requiring an argument, add
* code along the lines of
* *
* else if (!strcmp(opt, "-output")) { * else if (!strcmp(opt, "-output")) {
* if (!val) * if (!val) {
* errs = TRUE, error(err_optnoarg, opt); * errs = TRUE;
* else * fprintf(stderr, "puttygen: option `-%s'"
* " expects an argument\n", opt);
* } else
* ofile = val; * ofile = val;
* } * }
*/ */

View File

@ -1194,7 +1194,7 @@ int do_bidi(bidi_char *line, int count)
unsigned char currentEmbedding; unsigned char currentEmbedding;
unsigned char currentOverride; unsigned char currentOverride;
unsigned char tempType; unsigned char tempType;
int i, j, imax, yes, bover; int i, j, yes, bover;
/* Check the presence of R or AL types as optimization */ /* Check the presence of R or AL types as optimization */
yes = 0; yes = 0;
@ -1604,17 +1604,14 @@ int do_bidi(bidi_char *line, int count)
* level or higher * level or higher
*/ */
/* we flip the character string and leave the level array */ /* we flip the character string and leave the level array */
imax = 0;
i=0; i=0;
tempType = levels[0]; tempType = levels[0];
while (i < count) { while (i < count) {
if (levels[i] > tempType) { if (levels[i] > tempType)
tempType = levels[i]; tempType = levels[i];
imax=i;
}
i++; i++;
} }
/* maximum level in tempType, its index in imax. */ /* maximum level in tempType. */
while (tempType > 0) { /* loop from highest level to the least odd, */ while (tempType > 0) { /* loop from highest level to the least odd, */
/* which i assume is 1 */ /* which i assume is 1 */
flipThisRun(line, levels, tempType, count); flipThisRun(line, levels, tempType, count);

5
ssh.c
View File

@ -9131,10 +9131,9 @@ static void ssh2_msg_debug(Ssh ssh, struct Packet *pktin)
/* log the debug message */ /* log the debug message */
char *msg; char *msg;
int msglen; int msglen;
int always_display;
/* XXX maybe we should actually take notice of this */ /* XXX maybe we should actually take notice of the return value */
always_display = ssh2_pkt_getbool(pktin); ssh2_pkt_getbool(pktin);
ssh_pkt_getstring(pktin, &msg, &msglen); ssh_pkt_getstring(pktin, &msg, &msglen);
logeventf(ssh, "Remote debug message: %.*s", msglen, msg); logeventf(ssh, "Remote debug message: %.*s", msglen, msg);

View File

@ -4775,7 +4775,6 @@ static void do_paint(Terminal *term, Context ctx, int may_optimise)
termchar *lchars; termchar *lchars;
int dirty_line, dirty_run, selected; int dirty_line, dirty_run, selected;
unsigned long attr = 0, cset = 0; unsigned long attr = 0, cset = 0;
int updated_line = 0;
int start = 0; int start = 0;
int ccount = 0; int ccount = 0;
int last_run_dirty = 0; int last_run_dirty = 0;
@ -4973,8 +4972,6 @@ static void do_paint(Terminal *term, Context ctx, int may_optimise)
if (attr & (TATTR_ACTCURS | TATTR_PASCURS)) if (attr & (TATTR_ACTCURS | TATTR_PASCURS))
do_cursor(ctx, start, i, ch, ccount, attr, do_cursor(ctx, start, i, ch, ccount, attr,
ldata->lattr); ldata->lattr);
updated_line = 1;
} }
start = j; start = j;
ccount = 0; ccount = 0;
@ -5059,8 +5056,6 @@ static void do_paint(Terminal *term, Context ctx, int may_optimise)
if (attr & (TATTR_ACTCURS | TATTR_PASCURS)) if (attr & (TATTR_ACTCURS | TATTR_PASCURS))
do_cursor(ctx, start, i, ch, ccount, attr, do_cursor(ctx, start, i, ch, ccount, attr,
ldata->lattr); ldata->lattr);
updated_line = 1;
} }
unlineptr(ldata); unlineptr(ldata);
@ -5256,7 +5251,7 @@ static void clipme(Terminal *term, pos top, pos bottom, int rect, int desel)
sprintf(cbuf, "<U+%04x>", (ldata[top.x] & 0xFFFF)); sprintf(cbuf, "<U+%04x>", (ldata[top.x] & 0xFFFF));
#else #else
wchar_t cbuf[16], *p; wchar_t cbuf[16], *p;
int set, c; int c;
int x = top.x; int x = top.x;
if (ldata->chars[x].chr == UCSWIDE) { if (ldata->chars[x].chr == UCSWIDE) {
@ -5290,7 +5285,6 @@ static void clipme(Terminal *term, pos top, pos bottom, int rect, int desel)
break; break;
} }
set = (uc & CSET_MASK);
c = (uc & ~CSET_MASK); c = (uc & ~CSET_MASK);
#ifdef PLATFORM_IS_UTF16 #ifdef PLATFORM_IS_UTF16
if (uc > 0x10000 && uc < 0x110000) { if (uc > 0x10000 && uc < 0x110000) {

View File

@ -3540,15 +3540,29 @@ int pt_main(int argc, char **argv)
inst->menu = gtk_menu_new(); inst->menu = gtk_menu_new();
#define MKMENUITEM(title, func) do { \ #define MKMENUITEM(title, func) do \
menuitem = title ? gtk_menu_item_new_with_label(title) : \ { \
gtk_menu_item_new(); \ menuitem = gtk_menu_item_new_with_label(title); \
gtk_container_add(GTK_CONTAINER(inst->menu), menuitem); \ gtk_container_add(GTK_CONTAINER(inst->menu), menuitem); \
gtk_widget_show(menuitem); \ gtk_widget_show(menuitem); \
if (func != NULL) \
gtk_signal_connect(GTK_OBJECT(menuitem), "activate", \ gtk_signal_connect(GTK_OBJECT(menuitem), "activate", \
GTK_SIGNAL_FUNC(func), inst); \ GTK_SIGNAL_FUNC(func), inst); \
} while (0) } while (0)
#define MKSUBMENU(title) do \
{ \
menuitem = gtk_menu_item_new_with_label(title); \
gtk_container_add(GTK_CONTAINER(inst->menu), menuitem); \
gtk_widget_show(menuitem); \
} while (0)
#define MKSEP() do \
{ \
menuitem = gtk_menu_item_new(); \
gtk_container_add(GTK_CONTAINER(inst->menu), menuitem); \
gtk_widget_show(menuitem); \
} while (0)
if (new_session) if (new_session)
MKMENUITEM("New Session...", new_session_menuitem); MKMENUITEM("New Session...", new_session_menuitem);
MKMENUITEM("Restart Session", restart_session_menuitem); MKMENUITEM("Restart Session", restart_session_menuitem);
@ -3563,27 +3577,29 @@ int pt_main(int argc, char **argv)
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem),
inst->sessionsmenu); inst->sessionsmenu);
} }
MKMENUITEM(NULL, NULL); MKSEP();
MKMENUITEM("Change Settings...", change_settings_menuitem); MKMENUITEM("Change Settings...", change_settings_menuitem);
MKMENUITEM(NULL, NULL); MKSEP();
if (use_event_log) if (use_event_log)
MKMENUITEM("Event Log", event_log_menuitem); MKMENUITEM("Event Log", event_log_menuitem);
MKMENUITEM("Special Commands", NULL); MKSUBMENU("Special Commands");
inst->specialsmenu = gtk_menu_new(); inst->specialsmenu = gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), inst->specialsmenu); gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), inst->specialsmenu);
inst->specialsitem1 = menuitem; inst->specialsitem1 = menuitem;
MKMENUITEM(NULL, NULL); MKSEP();
inst->specialsitem2 = menuitem; inst->specialsitem2 = menuitem;
gtk_widget_hide(inst->specialsitem1); gtk_widget_hide(inst->specialsitem1);
gtk_widget_hide(inst->specialsitem2); gtk_widget_hide(inst->specialsitem2);
MKMENUITEM("Clear Scrollback", clear_scrollback_menuitem); MKMENUITEM("Clear Scrollback", clear_scrollback_menuitem);
MKMENUITEM("Reset Terminal", reset_terminal_menuitem); MKMENUITEM("Reset Terminal", reset_terminal_menuitem);
MKMENUITEM("Copy All", copy_all_menuitem); MKMENUITEM("Copy All", copy_all_menuitem);
MKMENUITEM(NULL, NULL); MKSEP();
s = dupcat("About ", appname, NULL); s = dupcat("About ", appname, NULL);
MKMENUITEM(s, about_menuitem); MKMENUITEM(s, about_menuitem);
sfree(s); sfree(s);
#undef MKMENUITEM #undef MKMENUITEM
#undef MKSUBMENU
#undef MKSEP
} }
inst->textcursor = make_mouse_ptr(inst, GDK_XTERM); inst->textcursor = make_mouse_ptr(inst, GDK_XTERM);

View File

@ -588,7 +588,6 @@ int main(int argc, char **argv)
int errors; int errors;
int use_subsystem = 0; int use_subsystem = 0;
int got_host = FALSE; int got_host = FALSE;
void *ldisc;
long now; long now;
fdlist = NULL; fdlist = NULL;
@ -901,7 +900,7 @@ int main(int argc, char **argv)
return 1; return 1;
} }
back->provide_logctx(backhandle, logctx); back->provide_logctx(backhandle, logctx);
ldisc = ldisc_create(&cfg, NULL, back, backhandle, NULL); ldisc_create(&cfg, NULL, back, backhandle, NULL);
sfree(realhost); sfree(realhost);
} }
connopen = 1; connopen = 1;

View File

@ -352,13 +352,11 @@ static void serial_free(void *handle)
static void serial_reconfig(void *handle, Config *cfg) static void serial_reconfig(void *handle, Config *cfg)
{ {
Serial serial = (Serial) handle; Serial serial = (Serial) handle;
const char *err;
err = serial_configure(serial, cfg);
/* /*
* FIXME: what should we do if err returns something? * FIXME: what should we do if this returns an error?
*/ */
serial_configure(serial, cfg);
} }
static int serial_select_result(int fd, int event) static int serial_select_result(int fd, int event)