mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
all: fix or silence various gcc warnings
As usual, gcc finds some real problems but also reports a ton of noise. Fix the problems and quiet the noise.
This commit is contained in:
parent
fa325e9b42
commit
fafa622a5b
17 changed files with 27 additions and 22 deletions
4
bin/9c
4
bin/9c
|
@ -14,6 +14,10 @@ usegcc()
|
|||
-Wno-comment \
|
||||
-Wno-sign-compare \
|
||||
-Wno-unknown-pragmas \
|
||||
-Wno-misleading-indentation \
|
||||
-Wno-stringop-truncation \
|
||||
-Wno-stringop-overflow \
|
||||
-Wno-format-truncation \
|
||||
-fno-omit-frame-pointer \
|
||||
-fsigned-char \
|
||||
"
|
||||
|
|
|
@ -290,6 +290,8 @@ p9crresp(ServerState *s, uchar *resp, int resplen)
|
|||
Ticket t;
|
||||
Ticketreq tr;
|
||||
|
||||
memset(&tr, 0, sizeof tr); // TODO: what should tr be initialized to?
|
||||
|
||||
if(xiowrite(s->asfd, resp, resplen) != resplen)
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -1142,7 +1142,7 @@ textedit(Thing *t, char *tag)
|
|||
fc = f->info;
|
||||
for(i=0; i<=w && i<=f->n; i++)
|
||||
nfc[i] = fc[i];
|
||||
if(w+1 < i)
|
||||
if(i < w+1)
|
||||
memset(nfc+i, 0, ((w+1)-i)*sizeof(Fontchar));
|
||||
x = fc[f->n].x;
|
||||
for(; i<=w; i++)
|
||||
|
|
|
@ -257,7 +257,7 @@ trans(int c, char *p1)
|
|||
|
||||
char *pad(int n) /* return the padding as a string */
|
||||
{
|
||||
static char buf[20];
|
||||
static char buf[30];
|
||||
|
||||
buf[0] = 0;
|
||||
if (n < 0) {
|
||||
|
|
|
@ -35,7 +35,7 @@ void coordlog(int n) /* remember log scaling */
|
|||
|
||||
void coord(Obj *p) /* set coord range */
|
||||
{
|
||||
static char buf[10];
|
||||
static char buf[20];
|
||||
|
||||
ncoord++;
|
||||
if (ncoord > 1 && strcmp(p->name, dflt_coord) == 0) {
|
||||
|
|
|
@ -202,7 +202,7 @@ atimes(char *ar)
|
|||
name[namelen] = 0;
|
||||
namelen = 0;
|
||||
}else{
|
||||
strncpy(name, h.name, sizeof(h.name));
|
||||
memmove(name, h.name, sizeof(h.name));
|
||||
for(i = sizeof(h.name)-1; i > 0 && name[i] == ' '; i--)
|
||||
;
|
||||
if(name[i] == '/') /* system V bug */
|
||||
|
|
|
@ -78,6 +78,7 @@ eenter(char *ask, char *buf, int len, Mouse *m)
|
|||
b = screen;
|
||||
sc = b->clipr;
|
||||
replclipr(b, 0, b->r);
|
||||
t = ZP;
|
||||
|
||||
while(!done){
|
||||
p = stringsize(font, buf ? buf : "");
|
||||
|
|
|
@ -435,7 +435,7 @@ double errcheck(double x, char *s)
|
|||
return x;
|
||||
}
|
||||
|
||||
char errbuf[200];
|
||||
char errbuf[1000];
|
||||
|
||||
void eprint(void);
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
extern void yyerror(char *);
|
||||
|
||||
extern char errbuf[200];
|
||||
extern char errbuf[1000];
|
||||
|
||||
#undef sprintf /* Snow Leopard */
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ Time time;
|
|||
unsigned long min;
|
||||
unsigned long hr;
|
||||
unsigned long day;
|
||||
static char buffer[32];
|
||||
static char buffer[50];
|
||||
|
||||
msec = time % 1000;
|
||||
time /= 1000;
|
||||
|
|
|
@ -435,7 +435,7 @@ double errcheck(double x, char *s)
|
|||
return x;
|
||||
}
|
||||
|
||||
char errbuf[200];
|
||||
char errbuf[1000];
|
||||
|
||||
void eprint(void);
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
extern void yyerror(char *);
|
||||
|
||||
extern char errbuf[200];
|
||||
extern char errbuf[1000];
|
||||
|
||||
#undef sprintf /* Snow Leopard */
|
||||
|
||||
|
|
|
@ -438,7 +438,7 @@ errcheck(double x, char *s)
|
|||
return x;
|
||||
}
|
||||
|
||||
char errbuf[200];
|
||||
char errbuf[1000];
|
||||
|
||||
void
|
||||
yyerror(char *s)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#define dprintf if(dbg)printf
|
||||
|
||||
extern char errbuf[200];
|
||||
extern char errbuf[1000];
|
||||
|
||||
#undef sprintf /* Snow Leopard */
|
||||
|
||||
|
|
|
@ -723,15 +723,15 @@ setfp(int pos, int f, char *truename, int print) /* mount font f at position pos
|
|||
else
|
||||
strcpy(shortname, (char *) unpair(f));
|
||||
if (truename && strrchr(truename, '/')) { /* .fp 1 R dir/file: use verbatim */
|
||||
sprintf(pathname, "%s", truename);
|
||||
snprintf(pathname, NS, "%s", truename);
|
||||
if (fonts[pos].truename)
|
||||
free(fonts[pos].truename);
|
||||
fonts[pos].truename = strdupl(truename);
|
||||
} else if (truename) { /* synonym: .fp 1 R Avant */
|
||||
sprintf(pathname, "%s/dev%s/%s", fontdir, devname, truename);
|
||||
snprintf(pathname, NS, "%s/dev%s/%s", fontdir, devname, truename);
|
||||
truename = 0; /* so doesn't get repeated by ptfpcmd */
|
||||
} else /* vanilla: .fp 5 XX */
|
||||
sprintf(pathname, "%s/dev%s/%s", fontdir, devname, shortname);
|
||||
snprintf(pathname, NS, "%s/dev%s/%s", fontdir, devname, shortname);
|
||||
if (truename == 0 && fonts[pos].truename != 0) {
|
||||
free(fonts[pos].truename);
|
||||
fonts[pos].truename = 0;
|
||||
|
|
|
@ -72,7 +72,7 @@ p9dialparse(char *addr, char **pnet, char **punix, void *phost, int *pport)
|
|||
if((port = strchr(host, '!')) == nil){
|
||||
if(strcmp(net, "unix")==0 || strcmp(net, "net")==0){
|
||||
Unix:
|
||||
if(strlen(host)+1 > sizeof ((struct sockaddr_un*)&ss)->sun_path){
|
||||
if(strlen(host)+1 > sizeof ((struct sockaddr_un*)ss)->sun_path){
|
||||
werrstr("unix socket name too long");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -63,17 +63,15 @@ p9lrand(void)
|
|||
|
||||
lock(&lk);
|
||||
|
||||
rng_tap--;
|
||||
if(rng_tap < rng_vec) {
|
||||
if(rng_feed == 0) {
|
||||
if(rng_tap <= rng_vec) {
|
||||
if(rng_feed == 0)
|
||||
isrand(1);
|
||||
rng_tap--;
|
||||
}
|
||||
rng_tap += LEN;
|
||||
}
|
||||
rng_feed--;
|
||||
if(rng_feed < rng_vec)
|
||||
rng_tap--;
|
||||
if(rng_feed <= rng_vec)
|
||||
rng_feed += LEN;
|
||||
rng_feed--;
|
||||
x = (*rng_feed + *rng_tap) & MASK;
|
||||
*rng_feed = x;
|
||||
|
||||
|
|
Loading…
Reference in a new issue