Permalink
Browse files

Patch from Colin Watson intended to give a clean Unix compile with GC…

…C 4.

(Since we choose to compile with -Werror, this is particularly important.)

I haven't yet checked that the resulting source actually compiles cleanly with
GCC 4, hence not marking `gcc4-warnings' as fixed just yet.


git-svn-id: svn://svn.tartarus.org/sgt/putty@7041 cda61777-01e9-0310-a592-d414129be87e
  • Loading branch information...
1 parent e1ef3c2 commit 8a9977e54db756281cf0d9f4a8322ce24b001a61 jacob committed Dec 30, 2006
Showing with 37 additions and 30 deletions.
  1. +5 −4 cmdgen.c
  2. +1 −1 misc.c
  3. +4 −3 ssh.c
  4. +3 −3 ssh.h
  5. +4 −4 sshpubk.c
  6. +1 −0 sshzlib.c
  7. +1 −0 tree234.c
  8. +1 −1 unix/gtkdlg.c
  9. +17 −14 unix/gtkwin.c
View
@@ -233,7 +233,7 @@ static int move(char *from, char *to)
return TRUE;
}
-static char *blobfp(char *alg, int bits, char *blob, int bloblen)
+static char *blobfp(char *alg, int bits, unsigned char *blob, int bloblen)
{
char buffer[128];
unsigned char digest[16];
@@ -270,7 +270,8 @@ int main(int argc, char **argv)
int sshver = 0;
struct ssh2_userkey *ssh2key = NULL;
struct RSAKey *ssh1key = NULL;
- char *ssh2blob = NULL, *ssh2alg = NULL;
+ unsigned char *ssh2blob = NULL;
+ char *ssh2alg = NULL;
const struct ssh_signkey *ssh2algf = NULL;
int ssh2bloblen;
char *passphrase = NULL;
@@ -715,12 +716,12 @@ int main(int argc, char **argv)
ssh1key = snew(struct RSAKey);
if (!load_encrypted) {
void *vblob;
- char *blob;
+ unsigned char *blob;
int n, l, bloblen;
ret = rsakey_pubblob(&infilename, &vblob, &bloblen,
&origcomment, &error);
- blob = (char *)vblob;
+ blob = (unsigned char *)vblob;
n = 4; /* skip modulus bits */
View
@@ -102,7 +102,7 @@ prompts_t *new_prompts(void *frontend)
void add_prompt(prompts_t *p, char *promptstr, int echo, size_t len)
{
prompt_t *pr = snew(prompt_t);
- unsigned char *result = snewn(len, unsigned char);
+ char *result = snewn(len, char);
pr->prompt = promptstr;
pr->echo = echo;
pr->result = result;
View
@@ -1489,6 +1489,7 @@ static struct Packet *construct_packet(Ssh ssh, int pkttype, va_list ap)
while ((argtype = va_arg(ap, int)) != PKT_END) {
unsigned char *argp, argchar;
+ char *sargp;
unsigned long argint;
int arglen;
switch (argtype) {
@@ -1507,8 +1508,8 @@ static struct Packet *construct_packet(Ssh ssh, int pkttype, va_list ap)
ssh_pkt_adddata(pkt, argp, arglen);
break;
case PKT_STR:
- argp = va_arg(ap, unsigned char *);
- ssh_pkt_addstring(pkt, argp);
+ sargp = va_arg(ap, char *);
+ ssh_pkt_addstring(pkt, sargp);
break;
case PKT_BIGNUM:
bn = va_arg(ap, Bignum);
@@ -1654,7 +1655,7 @@ static void ssh_pkt_addstring(struct Packet *pkt, char *data)
static void ssh1_pkt_addmp(struct Packet *pkt, Bignum b)
{
int len = ssh1_bignum_length(b);
- unsigned char *data = snewn(len, char);
+ unsigned char *data = snewn(len, unsigned char);
(void) ssh1_write_bignum(data, b);
ssh_pkt_adddata(pkt, data, len);
sfree(data);
View
@@ -403,9 +403,9 @@ extern struct ssh2_userkey ssh2_wrong_passphrase;
int ssh2_userkey_encrypted(const Filename *filename, char **comment);
struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
char *passphrase, const char **errorstr);
-char *ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
- int *pub_blob_len, char **commentptr,
- const char **errorstr);
+unsigned char *ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
+ int *pub_blob_len, char **commentptr,
+ const char **errorstr);
int ssh2_save_userkey(const Filename *filename, struct ssh2_userkey *key,
char *passphrase);
const struct ssh_signkey *find_pubkey_alg(const char *name);
View
@@ -868,9 +868,9 @@ struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
return ret;
}
-char *ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
- int *pub_blob_len, char **commentptr,
- const char **errorstr)
+unsigned char *ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
+ int *pub_blob_len, char **commentptr,
+ const char **errorstr)
{
FILE *fp;
char header[40], *b;
@@ -940,7 +940,7 @@ char *ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
*pub_blob_len = public_blob_len;
if (algorithm)
*algorithm = alg->name;
- return (char *)public_blob;
+ return public_blob;
/*
* Error processing.
View
@@ -224,6 +224,7 @@ static void lz77_compress(struct LZ77Context *ctx,
}
st->npending -= i;
+ defermatch.distance = 0; /* appease compiler */
defermatch.len = 0;
deferchr = '\0';
while (len > 0) {
View
@@ -136,6 +136,7 @@ static void *add234_internal(tree234 * t, void *e, int index)
return orig_e;
}
+ n = NULL; /* placate gcc; will always be set below since t->root != NULL */
np = &t->root;
while (*np) {
int childnum;
View
@@ -2696,7 +2696,7 @@ void eventlog_selection_get(GtkWidget *widget, GtkSelectionData *seldata,
struct eventlog_stuff *es = (struct eventlog_stuff *)data;
gtk_selection_data_set(seldata, seldata->target, 8,
- es->seldata, es->sellen);
+ (unsigned char *)es->seldata, es->sellen);
}
gint eventlog_selection_clear(GtkWidget *widget, GdkEventSelection *seldata,
View
@@ -1466,22 +1466,23 @@ void palette_reset(void *frontend)
*/
void init_cutbuffers()
{
+ unsigned char empty[] = "";
XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
- XA_CUT_BUFFER0, XA_STRING, 8, PropModeAppend, "", 0);
+ XA_CUT_BUFFER0, XA_STRING, 8, PropModeAppend, empty, 0);
XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
- XA_CUT_BUFFER1, XA_STRING, 8, PropModeAppend, "", 0);
+ XA_CUT_BUFFER1, XA_STRING, 8, PropModeAppend, empty, 0);
XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
- XA_CUT_BUFFER2, XA_STRING, 8, PropModeAppend, "", 0);
+ XA_CUT_BUFFER2, XA_STRING, 8, PropModeAppend, empty, 0);
XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
- XA_CUT_BUFFER3, XA_STRING, 8, PropModeAppend, "", 0);
+ XA_CUT_BUFFER3, XA_STRING, 8, PropModeAppend, empty, 0);
XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
- XA_CUT_BUFFER4, XA_STRING, 8, PropModeAppend, "", 0);
+ XA_CUT_BUFFER4, XA_STRING, 8, PropModeAppend, empty, 0);
XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
- XA_CUT_BUFFER5, XA_STRING, 8, PropModeAppend, "", 0);
+ XA_CUT_BUFFER5, XA_STRING, 8, PropModeAppend, empty, 0);
XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
- XA_CUT_BUFFER6, XA_STRING, 8, PropModeAppend, "", 0);
+ XA_CUT_BUFFER6, XA_STRING, 8, PropModeAppend, empty, 0);
XChangeProperty(GDK_DISPLAY(), GDK_ROOT_WINDOW(),
- XA_CUT_BUFFER7, XA_STRING, 8, PropModeAppend, "", 0);
+ XA_CUT_BUFFER7, XA_STRING, 8, PropModeAppend, empty, 0);
}
/* Store the data in a cut-buffer. */
@@ -1601,15 +1602,16 @@ void selection_get(GtkWidget *widget, GtkSelectionData *seldata,
struct gui_data *inst = (struct gui_data *)data;
if (seldata->target == utf8_string_atom)
gtk_selection_data_set(seldata, seldata->target, 8,
- inst->pasteout_data_utf8,
+ (unsigned char *)inst->pasteout_data_utf8,
inst->pasteout_data_utf8_len);
else if (seldata->target == compound_text_atom)
gtk_selection_data_set(seldata, seldata->target, 8,
- inst->pasteout_data_ctext,
+ (unsigned char *)inst->pasteout_data_ctext,
inst->pasteout_data_ctext_len);
else
gtk_selection_data_set(seldata, seldata->target, 8,
- inst->pasteout_data, inst->pasteout_data_len);
+ (unsigned char *)inst->pasteout_data,
+ inst->pasteout_data_len);
}
gint selection_clear(GtkWidget *widget, GdkEventSelection *seldata,
@@ -2488,15 +2490,16 @@ int do_cmdline(int argc, char **argv, int do_everything,
cfg->line_codepage[sizeof(cfg->line_codepage)-1] = '\0';
} else if (!strcmp(p, "-geometry")) {
- int flags, x, y, w, h;
+ int flags, x, y;
+ unsigned int w, h;
EXPECTS_ARG;
SECOND_PASS_ONLY;
flags = XParseGeometry(val, &x, &y, &w, &h);
if (flags & WidthValue)
- cfg->width = w;
+ cfg->width = (int)w;
if (flags & HeightValue)
- cfg->height = h;
+ cfg->height = (int)h;
if (flags & (XValue | YValue)) {
inst->xpos = x;

0 comments on commit 8a9977e

Please sign in to comment.