I've enabled gcc's format-string checking on dupprintf, by declaring
it in misc.h to have the appropriate GNU-specific attribute. This
pointed out a selection of warnings, which I've fixed.
git-svn-id: http://svn.tartarus.org/sgt/putty@10084
cda61777-01e9-0310-a592-
d414129be87e
return ret;
}
- key = dupprintf("%c%.*s", type, q - value, value);
+ key = dupprintf("%c%.*s", type, (int)(q - value), value);
val = dupstr(q+1);
} else {
/*
return ret;
}
- host = dupprintf("%.*s", portp - value, value);
+ host = dupprintf("%.*s", (int)(portp - value), value);
conf_set_str(conf, CONF_ssh_nc_host, host);
conf_set_int(conf, CONF_ssh_nc_port, atoi(portp + 1));
sfree(host);
char *dupstr(const char *s);
char *dupcat(const char *s1, ...);
-char *dupprintf(const char *fmt, ...);
+char *dupprintf(const char *fmt, ...)
+#ifdef __GNUC__
+ __attribute__ ((format (printf, 1, 2)))
+#endif
+ ;
char *dupvprintf(const char *fmt, va_list ap);
void burnstr(char *string);
if (sk_addr_needs_port(addr)) {
msg = dupprintf("Connecting to %s port %d", addrbuf, port);
} else {
- msg = dupprintf("Connecting to %s", addrbuf, port);
+ msg = dupprintf("Connecting to %s", addrbuf);
}
} else {
msg = dupprintf("Failed to connect to %s: %s", addrbuf, error_msg);
ssh_pkt_getstring(pktin, &host, &hostsize);
port = ssh_pkt_getuint32(pktin);
- pf.dhost = dupprintf(".*s", hostsize, host);
+ pf.dhost = dupprintf("%.*s", hostsize, host);
pf.dport = port;
pfp = find234(ssh->rportfwds, &pf, NULL);
for (i = 0; i < 2; i++)
if (fonts[i])
unifont_destroy(fonts[i]);
- return dupprintf("%s: unable to load wide font \"%s\"", fs->name);
+ return dupprintf("unable to load wide font \"%s\"", fs->name);
}
} else {
fonts[2] = NULL;
for (i = 0; i < 3; i++)
if (fonts[i])
unifont_destroy(fonts[i]);
- return dupprintf("%s: unable to load wide bold font \"%s\"",
- fs->name);
+ return dupprintf("unable to load wide bold font \"%s\"", fs->name);
}
}
cc_t c = t->c_cc[index];
#if defined(_POSIX_VDISABLE)
if (c == _POSIX_VDISABLE)
- return dupprintf("");
+ return dupstr("");
#endif
return dupprintf("^<%d>", c);
}
*backend_handle = pty;
- *realhost = dupprintf("\0");
+ *realhost = dupstr("");
return NULL;
}