silence all gcc warnings

This commit is contained in:
Russ Cox 2005-11-07 17:13:41 +00:00
parent 7732ac0a9b
commit 1c8b499228
47 changed files with 192 additions and 128 deletions

View File

@ -1,7 +1,7 @@
# Unix
AR=ar
AS=as
CC=gcc -Wall
CC=gcc -Wall -Wno-missing-braces
RANLIB=ranlib
CFLAGS=-I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -ggdb -D_THREAD_SAFE -pthread # not ready for this yet: -Wall
O=o

22
cpu.c
View File

@ -18,16 +18,13 @@
#define MaxStr 128
static void fatal(int, char*, ...);
static void catcher(void*, char*);
static void usage(void);
static void writestr(int, char*, char*, int);
static int readstr(int, char*, int);
static char *rexcall(int*, char*, char*);
static int setamalg(char*);
static char *keyspec = "";
static AuthInfo *p9any(int);
static int notechan;
#define system csystem
static char *system;
static int cflag;
@ -44,8 +41,6 @@ static int netkeyauth(int);
static int netkeysrvauth(int, char*);
static int p9auth(int);
static int srvp9auth(int, char*);
static int noauth(int);
static int srvnoauth(int, char*);
char *authserver;
@ -88,14 +83,14 @@ mountfactotum(void)
int fd;
if((fd = dialfactotum()) < 0)
return;
return -1;
if(sysmount(fd, -1, "/mnt/factotum", MREPL, "") < 0){
fprint(2, "mount factotum: %r\n");
return;
return -1;
}
if((fd = open("/mnt/factotum/ctl", OREAD)) < 0){
fprint(2, "open /mnt/factotum/ctl: %r\n");
return;
return -1;
}
close(fd);
return 0;
@ -166,7 +161,7 @@ cpumain(int argc, char **argv)
s = secstorefetch(secstoreserver, user, nil);
if(s){
if(strlen(s) >= sizeof secstorebuf)
panic("secstore data too big");
sysfatal("secstore data too big");
strcpy(secstorebuf, s);
}
}
@ -189,7 +184,7 @@ cpumain(int argc, char **argv)
authserver = p;
}
if(err = rexcall(&data, system, srvname))
if((err = rexcall(&data, system, srvname)))
fatal(1, "%s: %s", err, system);
/* Tell the remote side the command to execute and where our working directory is */
@ -580,7 +575,7 @@ p9any(int fd)
v2 = 1;
bbuf += 4;
}
if(p = strchr(bbuf, ' '))
if((p = strchr(bbuf, ' ')))
*p = 0;
p = bbuf;
if((dom = strchr(p, '@')) == nil)
@ -664,6 +659,7 @@ p9any(int fd)
return ai;
}
/*
static int
noauth(int fd)
{
@ -678,6 +674,7 @@ srvnoauth(int fd, char *user)
ealgs = nil;
return fd;
}
*/
void
loghex(uchar *p, int n)
@ -711,7 +708,7 @@ setam(char *name)
/*
* set authentication mechanism and encryption/hash algs
*/
*
int
setamalg(char *s)
{
@ -721,3 +718,4 @@ setamalg(char *s)
return setam(s);
}
*/

View File

@ -10,3 +10,4 @@ extern char *getkey(char*, char*);
extern char *findkey(char**, char*);
extern int dialfactotum(void);
extern char *getuser(void);
extern void cpumain(int, char**);

View File

@ -29,8 +29,6 @@ exportfs(int fd, int msgsz)
char buf[ERRMAX], ebuf[ERRMAX];
Fsrpc *r;
int i, n;
char *dbfile, *srv, *file;
ulong initial;
fcalls[Tversion] = Xversion;
fcalls[Tauth] = Xauth;
@ -110,7 +108,6 @@ reply(Fcall *r, Fcall *t, char *err)
{
uchar *data;
int m, n;
static QLock lk;
t->tag = r->tag;
t->fid = r->fid;
@ -494,7 +491,6 @@ fatal(char *s, ...)
{
char buf[ERRMAX];
va_list arg;
Proc *m;
if (s) {
va_start(arg, s);
@ -510,6 +506,6 @@ fatal(char *s, ...)
if (s)
sysfatal(buf);
else
exits(nil);
sysfatal("");
}

View File

@ -143,6 +143,6 @@ char* estrdup(char*);
void* emallocz(uint);
int readmessage(int, char*, int);
#define notify
#define noted
#define exits
#define notify(x)
#define noted(x)
#define exits(x)

View File

@ -89,10 +89,8 @@ Xflush(Fsrpc *t)
void
Xattach(Fsrpc *t)
{
int i, nfd;
Fcall rhdr;
Fid *f;
char buf[128];
f = newfid(t->work.fid);
if(f == 0) {
@ -431,7 +429,6 @@ slave(Fsrpc *f)
Proc *p;
int pid;
static int nproc;
static QLock lk;
for(;;) {
for(p = Proclist; p; p = p->next) {

View File

@ -125,7 +125,7 @@ getXdata(Memimage *m, Rectangle r)
xm = m->X;
if(xm == nil)
return;
return nil;
assert(xm != nil && xm->xi != nil);

View File

@ -36,8 +36,6 @@ memimageinit(void)
void
memimagedraw(Memimage *dst, Rectangle r, Memimage *src, Point sp, Memimage *mask, Point mp, int op)
{
int didx;
Rectangle dr, mr, sr;
Memdrawparam *par;
if((par = _memimagedrawsetup(dst, r, src, sp, mask, mp, op)) == nil)
@ -182,7 +180,6 @@ return 0;
ulong
pixelbits(Memimage *m, Point p)
{
Xmem *xm;
if(m->X)
getXdata(m, Rect(p.x, p.y, p.x+1, p.y+1));
return _pixelbits(m, p);

View File

@ -20,13 +20,14 @@
#define Font IFont
#define Screen IScreen
#include <u.h>
#include <libc.h>
#include <draw.h>
#include <memdraw.h>
#include <keyboard.h>
#include "u.h"
#include "lib.h"
#include "dat.h"
#include "fns.h"
#include "user.h"
#include "draw.h"
#include "memdraw.h"
#include "keyboard.h"
#include "screen.h"
#undef time
@ -684,7 +685,6 @@ static void
xkeyboard(XEvent *e)
{
KeySym k;
unsigned int md;
/*
* I tried using XtGetActionKeysym, but it didn't seem to

View File

@ -1,5 +1,7 @@
#ifdef PLAN9
#pragma src "/sys/src/libauth"
#pragma lib "libauth.a"
#endif
/*
* Interface for typical callers.
@ -118,7 +120,9 @@ void _freeattr(Attr*);
Attr *_mkattr(int, char*, char*, Attr*);
Attr *_parseattr(char*);
char *_strfindattr(Attr*, char*);
#ifdef VARARGCK
#pragma varargck type "A" Attr*
#endif
extern AuthInfo* fauth_proxy(int, AuthRpc *rpc, AuthGetkey *getkey, char *params);
extern AuthInfo* auth_proxy(int fd, AuthGetkey *getkey, char *fmt, ...);
@ -138,7 +142,10 @@ extern Attr* auth_attr(AuthRpc *rpc);
extern void auth_freerpc(AuthRpc *rpc);
extern uint auth_rpc(AuthRpc *rpc, char *verb, void *a, int n);
extern int auth_wep(char*, char*, ...);
#ifdef VARARGCK
#pragma varargck argpos auth_proxy 3
#pragma varargck argpos auth_challenge 1
#pragma varargck argpos auth_respond 3
#pragma varargck argpos auth_getuserpasswd 2
#endif

View File

@ -1,5 +1,7 @@
#ifdef PLAN9
#pragma src "/sys/src/libauthsrv"
#pragma lib "libauthsrv.a"
#endif
/*
* Interface for talking to authentication server.

View File

@ -1,5 +1,7 @@
#ifdef PLAN9
#pragma src "/sys/src/libdraw"
#pragma lib "libdraw.a"
#endif
typedef struct Cachefont Cachefont;
typedef struct Cacheinfo Cacheinfo;
@ -15,8 +17,10 @@ typedef struct RGB RGB;
typedef struct Screen Screen;
typedef struct Subfont Subfont;
#ifdef VARARGCK
#pragma varargck type "R" Rectangle
#pragma varargck type "P" Point
#endif
extern int Rfmt(Fmt*);
extern int Pfmt(Fmt*);

View File

@ -1,5 +1,7 @@
#ifdef PLAN9
#pragma src "/sys/src/libdraw"
#pragma lib "libdraw.a"
#endif
typedef struct Keyboardctl Keyboardctl;
typedef struct Channel Channel;

View File

@ -235,7 +235,9 @@ extern int fmtinstall(int, int (*)(Fmt*));
extern char* fmtstrflush(Fmt*);
extern int runefmtstrinit(Fmt*);
extern Rune* runefmtstrflush(Fmt*);
extern int fmtstrcpy(Fmt*, char*);
extern int fmtprint(Fmt*, char*, ...);
extern int fmtvprint(Fmt*, char*, va_list);
extern void* mallocz(ulong, int);
extern void srand(long);
@ -250,3 +252,21 @@ extern char* cleanname(char*);
extern void sysfatal(char*, ...);
extern char* strecpy(char*, char*, char*);
extern int tokenize(char*, char**, int);
extern int getfields(char*, char**, int, int, char*);
extern char* utfecpy(char*, char*, char*);
extern long tas(long*);
extern void quotefmtinstall(void);
extern int dec64(uchar*, int, char*, int);
extern int enc64(char*, int, uchar*, int);
extern int dec32(uchar*, int, char*, int);
extern int enc32(char*, int, uchar*, int);
void hnputs(void *p, unsigned short v);
extern int dofmt(Fmt*, char*);
extern double __NaN(void);
extern int __isNaN(double);
extern double strtod(char*, char**);
extern int utfnlen(char*, long);
extern double __Inf(int);
extern int __isInf(double, int);
extern double pow10(int);

View File

@ -1,5 +1,7 @@
#ifdef PLAN9
#pragma src "/sys/src/libmemdraw"
#pragma lib "libmemdraw.a"
#endif
typedef struct Memimage Memimage;
typedef struct Memdata Memdata;
@ -123,6 +125,7 @@ extern Memimage* readmemimage(int);
extern Memimage* creadmemimage(int);
extern int writememimage(int, Memimage*);
extern void freememimage(Memimage*);
extern void _freememimage(Memimage*);
extern int _loadmemimage(Memimage*, Rectangle, uchar*, int);
extern int _cloadmemimage(Memimage*, Rectangle, uchar*, int);
extern int _unloadmemimage(Memimage*, Rectangle, uchar*, int);
@ -133,7 +136,9 @@ extern ulong* wordaddr(Memimage*, Point);
extern uchar* byteaddr(Memimage*, Point);
extern int drawclip(Memimage*, Rectangle*, Memimage*, Point*, Memimage*, Point*, Rectangle*, Rectangle*);
extern void memfillcolor(Memimage*, ulong);
extern void _memfillcolor(Memimage*, ulong);
extern int memsetchan(Memimage*, ulong);
extern ulong _rgbatoimg(Memimage*, ulong);
/*
* Graphics
@ -155,6 +160,7 @@ extern void memarc(Memimage*, Point, int, int, int, Memimage*, Point, int, int,
extern Rectangle memlinebbox(Point, Point, int, int, int);
extern int memlineendsize(int);
extern void _memmkcmap(void);
extern void _memimageinit(void);
extern void memimageinit(void);
/*
@ -185,16 +191,20 @@ void memimagemove(void*, void*);
*/
extern void rdb(void);
extern int iprint(char*, ...);
#pragma varargck argpos iprint 1
extern int drawdebug;
/*
* doprint interface: numbconv bit strings
*/
#ifdef VARARGCK
#pragma varargck argpos iprint 1
#pragma varargck type "llb" vlong
#pragma varargck type "llb" uvlong
#pragma varargck type "lb" long
#pragma varargck type "lb" ulong
#pragma varargck type "b" int
#pragma varargck type "b" uint
#endif
extern ulong _pixelbits(Memimage*,Point);
extern ulong pixelbits(Memimage*, Point);

View File

@ -1,5 +1,7 @@
#ifdef PLAN9
#pragma src "/sys/src/libmemlayer"
#pragma lib "libmemlayer.a"
#endif
typedef struct Memscreen Memscreen;
typedef void (*Refreshfn)(Memimage*, Rectangle, void*);

View File

@ -23,6 +23,8 @@
#define nsec sysnsec
#define pread syspread
#define pwrite syspwrite
#undef sleep
#define sleep osmsleep
extern int bind(char*, char*, int);
extern int chdir(char*);
@ -43,6 +45,7 @@ extern vlong seek(int, vlong, int);
extern int stat(char*, uchar*, int);
extern long write(int, void*, long);
extern int wstat(char*, uchar*, int);
extern void werrstr(char* ,...);
extern Dir *dirstat(char*);
extern Dir *dirfstat(int);
@ -65,3 +68,26 @@ extern char *netmkaddr(char*, char*, char*);
extern int reject(int, char*, char*);
extern char* argv0;
extern ulong truerand(void);
extern int pushssl(int, char*, char*, char*, int*);
extern int iounit(int);
extern long pread(int, void*, long, vlong);
extern long pwrite(int, void*, long, vlong);
extern ulong rendezvous(ulong, ulong);
extern int kproc(char*, void(*)(void*), void*);
extern int getpid(void);
extern void panic(char*, ...);
extern void sleep(int);
extern void osyield(void);
extern void setmalloctag(void*, ulong);
extern int errstr(char*, uint);
extern int rerrstr(char*, uint);
extern int encrypt(void*, void*, int);
extern int decrypt(void*, void*, int);
extern void qlock(QLock*);
extern void qunlock(QLock*);
extern vlong nsec(void);
extern void lock(Lock*);
extern void unlock(Lock*);
extern int iprint(char*, ...);

View File

@ -167,7 +167,6 @@ kstrdup(char **p, char *s)
{
int n;
char *t, *prev;
static Lock l;
n = strlen(s)+1;
/* if it's a user, we can wait for memory; if not, something's very wrong */
@ -1422,8 +1421,7 @@ char isfrog[256]={
void
validname(char *aname, int slashok)
{
char *p, *ename, *name;
uint t;
char *ename, *name;
int c;
Rune r;

View File

@ -136,7 +136,7 @@ enum
COPEN = 0x0001, /* for i/o */
CMSG = 0x0002, /* the message channel for a mount */
/*rsc CCREATE = 0x0004, /* permits creation if c->mnt */
/* CCREATE = 0x0004, permits creation if c->mnt */
CCEXEC = 0x0008, /* close on exec */
CFREE = 0x0010, /* not in use */
CRCLOSE = 0x0020, /* remove on close */

View File

@ -128,9 +128,6 @@ prflush(void)
static void
putstrn0(char *str, int n, int usewrite)
{
int m;
char *t;
/*
* if someone is reading /dev/kprint,
* put the message there.
@ -294,8 +291,7 @@ echoserialoq(char *buf, int n)
static void
echo(char *buf, int n)
{
static int ctrlt, pid;
extern ulong etext;
static int ctrlt;
int x;
char *e, *p;
@ -655,11 +651,10 @@ consclose(Chan *c)
static long
consread(Chan *c, void *buf, long n, vlong off)
{
ulong l;
char *b, *bp;
char *b;
char tmp[128]; /* must be >= 6*NUMSIZE */
char *cbuf = buf;
int ch, i, k, id, eol;
int ch, i, eol;
vlong offset = off;
if(n <= 0)
@ -819,7 +814,7 @@ conswrite(Chan *c, void *va, long n, vlong off)
char buf[256];
long l, bp;
char *a = va;
int id, fd;
int fd;
Chan *swc;
ulong offset = off;
Cmdbuf *cb;
@ -866,7 +861,7 @@ conswrite(Chan *c, void *va, long n, vlong off)
} else if(strncmp(a, "ctlpoff", 7) == 0){
kbd.ctlpoff = 1;
}
if(a = strchr(a, ' '))
if((a = strchr(a, ' ')))
a++;
}
break;
@ -999,19 +994,19 @@ seedrand(void)
randomread((void*)&randn, sizeof(randn));
}
// int
// nrand(int n)
// {
// if(randn == 0)
// seedrand();
// randn = randn*1103515245 + 12345 + fastticks(0);
// return (randn>>16) % n;
// }
int
xnrand(int n)
{
if(randn == 0)
seedrand();
randn = randn*1103515245 + 12345 + fastticks(0);
return (randn>>16) % n;
}
int
rand(void)
{
nrand(1);
xnrand(1);
return randn;
}
@ -1058,6 +1053,7 @@ le2long(long *to, uchar *f)
return f+sizeof(long);
}
/*
static uchar*
long2le(uchar *t, long from)
{
@ -1070,6 +1066,7 @@ long2le(uchar *t, long from)
t[i] = f[o[i]];
return t+sizeof(long);
}
*/
char *Ebadtimectl = "bad time control";

View File

@ -176,7 +176,7 @@ static char Ewriteoutside[] = "writeimage outside image";
static char Enotfont[] = "image not a font";
static char Eindex[] = "character index out of range";
static char Enoclient[] = "no such draw client";
static char Edepth[] = "image has bad depth";
/* static char Edepth[] = "image has bad depth"; */
static char Enameused[] = "image name in use";
static char Enoname[] = "no image with that name";
static char Eoldname[] = "named image no longer valid";
@ -627,7 +627,7 @@ drawfreedscreen(DScreen *this)
dscreen = this->next;
goto Found;
}
while(next = ds->next){ /* assign = */
while((next = ds->next)){ /* assign = */
if(next == this){
ds->next = this->next;
goto Found;
@ -702,7 +702,7 @@ drawuninstallscreen(Client *client, CScreen *this)
free(this);
return;
}
while(next = cs->next){ /* assign = */
while((next = cs->next)){ /* assign = */
if(next == this){
cs->next = this->next;
drawfreedscreen(this->dscreen);
@ -726,7 +726,7 @@ drawuninstall(Client *client, int id)
drawfreedimage(d);
return;
}
while(next = d->next){ /* assign = */
while((next = d->next)){ /* assign = */
if(next->id == id){
d->next = next->next;
drawfreedimage(next);
@ -1024,7 +1024,7 @@ drawclose(Chan *c)
if(QID(c->qid) == Qctl)
cl->busy = 0;
if((c->flag&COPEN) && (decref(&cl->r)==0)){
while(r = cl->refresh){ /* assign = */
while((r = cl->refresh)){ /* assign = */
cl->refresh = r->next;
free(r);
}

View File

@ -413,7 +413,7 @@ fswstat(Chan *c, uchar *buf, int n)
{
Dir d;
struct stat stbuf;
char old[MAXPATH], new[MAXPATH], dir[MAXPATH];
char old[MAXPATH], new[MAXPATH];
char strs[MAXPATH*3], *p;
Ufsinfo *uif;
@ -491,9 +491,6 @@ fsqid(char *p, struct stat *st)
static void
fspath(Chan *c, char *ext, char *path)
{
int i, n;
char *comp[MAXCOMP];
strcpy(path, base);
strcat(path, "/");
strcat(path, uc2name(c));

View File

@ -199,7 +199,7 @@ so_getservbyname(char *service, char *net, char *port)
int
so_send(int fd, void *d, int n, int f)
{
send(fd, d, n, f);
return send(fd, d, n, f);
}
int

View File

@ -621,9 +621,6 @@ eipfmt(Fmt *f)
static char *efmt = "%.2lux%.2lux%.2lux%.2lux%.2lux%.2lux";
static char *ifmt = "%d.%d.%d.%d";
uchar *p, ip[16];
ulong *lp;
ushort s;
int i, j, n, eln, eli;
ulong ul;
switch(f->r) {

View File

@ -9,6 +9,8 @@ void so_connect(int, unsigned long, unsigned short);
void so_getsockname(int, unsigned long*, unsigned short*);
void so_bind(int, int, unsigned short);
void so_listen(int);
int so_send(int, void*, int, int);
int so_recv(int, void*, int, int);
int so_accept(int, unsigned long*, unsigned short*);
int so_getservbyname(char*, char*, char*);
int so_gethostbyname(char*, char**, int);

View File

@ -151,7 +151,7 @@ void ksetenv(char*, char*, int);
void kstrcpy(char*, char*, int);
void kstrdup(char**, char*);
long latin1(Rune*, int);
int lock(Lock*);
void lock(Lock*);
void lockinit(void);
void logopen(Log*);
void logclose(Log*);
@ -197,6 +197,7 @@ int nrand(int);
int okaddr(ulong, ulong, int);
int openmode(ulong);
void oserrstr(void);
void oserror(void);
Block* packblock(Block*);
Block* padblock(Block*, int);
void pagechainhead(Page*);
@ -379,3 +380,12 @@ void hnputs(void*, ushort);
vlong nhgetv(void*);
ulong nhgetl(void*);
ushort nhgets(void*);
ulong ticks(void);
void osproc(Proc*);
void osnewproc(Proc*);
void procsleep(void);
void procwakeup(Proc*);
void osinit(void);
void screeninit(void);
extern void terminit(void);

View File

@ -189,7 +189,7 @@ dupfgrp(Fgrp *f)
new->maxfd = f->maxfd;
for(i = 0; i <= f->maxfd; i++) {
if(c = f->fd[i]){
if((c = f->fd[i])){
incref(&c->ref);
new->fd[i] = c;
}
@ -212,7 +212,7 @@ closefgrp(Fgrp *f)
return;
for(i = 0; i <= f->maxfd; i++)
if(c = f->fd[i])
if((c = f->fd[i]))
cclose(c);
free(f->fd);

View File

@ -86,7 +86,6 @@ void
oserrstr(void)
{
char *p;
char buf[ERRMAX];
if((p = strerror(errno)) != nil)
strecpy(up->errstr, up->errstr+ERRMAX, p);
@ -132,7 +131,6 @@ tramp(void *vp)
void
procsleep(void)
{
int c;
Proc *p;
Oproc *op;

View File

@ -213,7 +213,7 @@ pullupblock(Block *bp, int n)
* copy bytes from the trailing blocks into the first
*/
n -= BLEN(bp);
while(nbp = bp->next){
while((nbp = bp->next)){
i = BLEN(nbp);
if(i > n) {
memmove(bp->wp, nbp->rp, n);

View File

@ -152,6 +152,7 @@ postnote(Proc *p, int x, char *msg, int flag)
USED(x);
USED(msg);
USED(flag);
return 0;
}
void

View File

@ -139,7 +139,7 @@ _parseattr(char *s)
a = nil;
for(i=ntok-1; i>=0; i--){
t = tok[i];
if(p = strchr(t, '=')){
if((p = strchr(t, '='))){
*p++ = '\0';
// if(p-2 >= t && p[-2] == ':'){
// p[-2] = '\0';

View File

@ -16,7 +16,6 @@ OFILES=\
nvcsum.$O\
opasstokey.$O\
passtokey.$O\
readnvram.$O\
default: $(LIB)
$(LIB): $(OFILES)

View File

@ -8,7 +8,7 @@
* necessary to back up the input stream up one byte after calling charstod.
*/
#define ADVANCE *s++ = c; if(s>=e) return NaN(); c = (*f)(vp)
#define ADVANCE *s++ = c; if(s>=e) return __NaN(); c = (*f)(vp)
double
charstod(int(*f)(void*), void *vp)
@ -45,34 +45,34 @@ charstod(int(*f)(void*), void *vp)
}else if(s == start && (c == 'i' || c == 'I')){
ADVANCE;
if(c != 'n' && c != 'N')
return NaN();
return __NaN();
ADVANCE;
if(c != 'f' && c != 'F')
return NaN();
return __NaN();
ADVANCE;
if(c != 'i' && c != 'I')
return NaN();
return __NaN();
ADVANCE;
if(c != 'n' && c != 'N')
return NaN();
return __NaN();
ADVANCE;
if(c != 'i' && c != 'I')
return NaN();
return __NaN();
ADVANCE;
if(c != 't' && c != 'T')
return NaN();
return __NaN();
ADVANCE;
if(c != 'y' && c != 'Y')
return NaN();
return __NaN();
ADVANCE; /* so caller can back up uniformly */
USED(c);
}else if(s == str && (c == 'n' || c == 'N')){
ADVANCE;
if(c != 'a' && c != 'A')
return NaN();
return __NaN();
ADVANCE;
if(c != 'n' && c != 'N')
return NaN();
return __NaN();
ADVANCE; /* so caller can back up uniformly */
USED(c);
}

View File

@ -22,7 +22,7 @@ lock(Lock *lk)
return;
for(i=0; i<100; i++) {
osyield(0);
osyield();
if(canlock(lk))
return;
}

View File

@ -521,7 +521,7 @@ xcmp(char *a, char *b)
{
int c1, c2;
while(c1 = *b++) {
while((c1 = *b++)) {
c2 = *a++;
if(isupper(c2))
c2 = tolower(c2);

View File

@ -19,7 +19,7 @@ utfutf(char *s1, char *s2)
return strstr(s1, s2);
n2 = strlen(s2);
for(p=s1; p=utfrune(p, f); p+=n1)
for(p=s1; (p=utfrune(p, f)); p+=n1)
if(strncmp(p, s2, n2) == 0)
return p;
return 0;

View File

@ -86,7 +86,6 @@ static Memdrawparam par;
Memdrawparam*
_memimagedrawsetup(Memimage *dst, Rectangle r, Memimage *src, Point p0, Memimage *mask, Point p1, int op)
{
static int n = 0;
if(mask == nil)
mask = memopaque;
@ -458,7 +457,6 @@ static Writefn* writefn(Memimage*);
static Calcfn* boolcopyfn(Memimage*, Memimage*);
static Readfn* convfn(Memimage*, Param*, Memimage*, Param*);
static Readfn* ptrfn(Memimage*);
static Calcfn *alphacalc[Ncomp] =
{
@ -569,19 +567,19 @@ dumpbuf(char *s, Buffer b, int n)
print("%s", s);
for(i=0; i<n; i++){
print(" ");
if(p=b.grey){
if((p=b.grey)){
print(" k%.2uX", *p);
b.grey += b.delta;
}else{
if(p=b.red){
if((p=b.red)){
print(" r%.2uX", *p);
b.red += b.delta;
}
if(p=b.grn){
if((p=b.grn)){
print(" g%.2uX", *p);
b.grn += b.delta;
}
if(p=b.blu){
if((p=b.blu)){
print(" b%.2uX", *p);
b.blu += b.delta;
}
@ -1291,7 +1289,7 @@ readnbit(Param *p, uchar *buf, int y)
DBG print("readnbit dx %d %p=%p+%d*%d, *r=%d fetch %d ", dx, r, p->bytermin, y, p->bwidth, *r, n);
bits = *r++;
nbits = 8;
if(i=x&(npack-1)){
if((i=x&(npack-1))){
DBG print("throwaway %d...", i);
bits <<= depth*i;
nbits -= depth*i;
@ -1323,7 +1321,7 @@ DBG print("bit %x...", repl[bits>>sh]);
DBG print("x=%d r=%p...", x, r);
bits = *r++;
nbits = 8;
if(i=x&(npack-1)){
if((i=x&(npack-1))){
bits <<= depth*i;
nbits -= depth*i;
}
@ -1912,7 +1910,7 @@ boolcopyfn(Memimage *img, Memimage *mask)
/*
* Optimized draw for filling and scrolling; uses memset and memmove.
*/
*
static void
memsetb(void *vp, uchar val, int n)
{
@ -1923,6 +1921,7 @@ memsetb(void *vp, uchar val, int n)
while(p<ep)
*p++ = val;
}
*/
static void
memsets(void *vp, ushort val, int n)
@ -2459,7 +2458,7 @@ membyteval(Memimage *src)
bpp = src->depth;
uc <<= (src->r.min.x&(7/src->depth))*src->depth;
uc &= ~(0xFF>>bpp);
/* pixel value is now in high part of byte. repeat throughout byte
// pixel value is now in high part of byte. repeat throughout byte
val = uc;
for(i=bpp; i<8; i<<=1)
val |= val>>i;

View File

@ -124,7 +124,7 @@ memellipse(Memimage *dst, Point c, int a, int b, int t, Memimage *src, Point sp,
p.op = op;
u = (t<<1)*(a-b);
if(b<a && u>b*b || a<b && -u>a*a) {
if((b<a && u>b*b) || (a<b && -u>a*a)) {
/* if(b<a&&(t<<1)>b*b/a || a<b&&(t<<1)>a*a/b) # very thick */
bellipse(b, newstate(&in, a, b), &p);
return;
@ -209,7 +209,7 @@ erect(int x0, int y0, int x1, int y1, Param *p)
{
Rectangle r;
/* print("R %d,%d %d,%d\n", x0, y0, x1, y1); /**/
/* print("R %d,%d %d,%d\n", x0, y0, x1, y1); */
r = Rect(p->c.x+x0, p->c.y+y0, p->c.x+x1+1, p->c.y+y1+1);
memdraw(p->dst, r, p->src, addpt(p->sp, r.min), memopaque, p00, p->op);
}
@ -224,7 +224,7 @@ epoint(int x, int y, Param *p)
Point p0;
Rectangle r;
/* print("P%d %d,%d\n", p->t, x, y); /**/
/* print("P%d %d,%d\n", p->t, x, y); */
p0 = Pt(p->c.x+x, p->c.y+y);
r = Rpt(addpt(p0, p->disc->r.min), addpt(p0, p->disc->r.max));
memdraw(p->dst, r, p->src, addpt(p->sp, r.min), p->disc, p->disc->r.min, p->op);
@ -237,7 +237,7 @@ static
void
eline(int x0, int y0, int x1, int y1, Param *p)
{
/* print("L%d %d,%d %d,%d\n", p->t, x0, y0, x1, y1); /**/
/* print("L%d %d,%d %d,%d\n", p->t, x0, y0, x1, y1); */
if(x1 > x0+1)
erect(x0+1, y0-p->t, x1-1, y1+p->t, p);
else if(y1 > y0+1)

View File

@ -26,6 +26,7 @@ static int zcompare(const void*, const void*);
static void xscan(Memimage *dst, Seg **seg, Seg *segtab, int nseg, int wind, Memimage *src, Point sp, int, int, int, int);
static void yscan(Memimage *dst, Seg **seg, Seg *segtab, int nseg, int wind, Memimage *src, Point sp, int, int);
#ifdef NOT
static void
fillcolor(Memimage *dst, int left, int right, int y, Memimage *src, Point p)
{
@ -37,6 +38,7 @@ fillcolor(Memimage *dst, int left, int right, int y, Memimage *src, Point p)
p.y = y;
memset(byteaddr(dst, p), srcval, right-left);
}
#endif
static void
fillline(Memimage *dst, int left, int right, int y, Memimage *src, Point p, int op)

View File

@ -11,6 +11,7 @@ enum
Arrow3 = 3,
};
#ifdef NOT
static
int
lmin(int a, int b)
@ -19,6 +20,7 @@ lmin(int a, int b)
return a;
return b;
}
#endif
static
int

View File

@ -13,7 +13,7 @@ memimagestring(Memimage *b, Point p, Memimage *color, Point cp, Memsubfont *f, c
Fontchar *i;
s = (uchar*)cs;
for(; c=*s; p.x+=width, cp.x+=width){
for(; (c=*s); p.x+=width, cp.x+=width){
width = 0;
if(c < Runeself)
s++;
@ -47,7 +47,7 @@ memsubfontwidth(Memsubfont *f, char *cs)
p = Pt(0, f->height);
s = (uchar*)cs;
for(; c=*s; p.x+=width){
for(; (c=*s); p.x+=width){
width = 0;
if(c < Runeself)
s++;

View File

@ -32,13 +32,13 @@ init(void)
memset(tab.t10, INVAL, sizeof(tab.t10));
for(p = set64; *p; p++)
tab.t64[*p] = p-set64;
tab.t64[(uchar)*p] = p-set64;
for(p = set32; *p; p++)
tab.t32[*p] = p-set32;
tab.t32[(uchar)*p] = p-set32;
for(p = set16; *p; p++)
tab.t16[*p] = (p-set16)%16;
tab.t16[(uchar)*p] = (p-set16)%16;
for(p = set10; *p; p++)
tab.t10[*p] = (p-set10);
tab.t10[(uchar)*p] = (p-set10);
tab.inited = 1;
}
@ -52,7 +52,7 @@ from16(char *a, mpint *b)
b->top = 0;
for(p = a; *p; p++)
if(tab.t16[*p] == INVAL)
if(tab.t16[(uchar)*p] == INVAL)
break;
mpbits(b, (p-a)*4);
b->top = 0;
@ -62,7 +62,7 @@ from16(char *a, mpint *b)
for(i = 0; i < Dbits; i += 4){
if(p <= a)
break;
x |= tab.t16[*--p]<<i;
x |= tab.t16[(uchar)*--p]<<i;
}
b->p[b->top++] = x;
}
@ -88,7 +88,7 @@ from10(char *a, mpint *b)
// do a billion at a time in native arithmetic
x = 0;
for(i = 0; i < 9; i++){
y = tab.t10[*a];
y = tab.t10[(uchar)*a];
if(y == INVAL)
break;
a++;
@ -118,7 +118,7 @@ from64(char *a, mpint *b)
uchar *p;
int n, m;
for(; tab.t64[*a] != INVAL; a++)
for(; tab.t64[(uchar)*a] != INVAL; a++)
;
n = a-buf;
mpbits(b, n*6);
@ -138,7 +138,7 @@ from32(char *a, mpint *b)
uchar *p;
int n, m;
for(; tab.t64[*a] != INVAL; a++)
for(; tab.t64[(uchar)*a] != INVAL; a++)
;
n = a-buf;
mpbits(b, n*5);

View File

@ -43,7 +43,10 @@ static const u32 Td3[256];
static const u8 Te4[256];
static int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits);
#ifdef NOT
static int rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits);
#endif
static int rijndaelKeySetup(u32 erk[/*4*(Nr + 1)*/], u32 drk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits);
static void rijndaelEncrypt(const u32int rk[], int Nr, const uchar pt[16], uchar ct[16]);
static void rijndaelDecrypt(const u32int rk[], int Nr, const uchar ct[16], uchar pt[16]);
@ -955,6 +958,7 @@ static int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int
*
* @return the number of rounds for the given cipher key size.
*/
#ifdef NOTUSED
static int rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits) {
int Nr, i, j;
u32 temp;
@ -994,6 +998,7 @@ static int rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int
}
return Nr;
}
#endif
static void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 ct[16]) {
u32 s0, s1, s2, s3, t0, t1, t2, t3;

View File

@ -28,7 +28,6 @@
*/
static void encode(uchar*, u32int*, ulong);
static void decode(u32int*, uchar*, ulong);
extern void _md5block(uchar*, ulong, u32int*);

7
main.c
View File

@ -1,7 +1,8 @@
#include "u.h"
#include "libc.h"
#include "lib.h"
#include "kern/dat.h"
#include "kern/fns.h"
#include "user.h"
#include "drawterm.h"
@ -32,10 +33,6 @@ sizebug(void)
int
main(int argc, char **argv)
{
int fd;
char buf[1024], *s;
int n;
eve = getuser();
sizebug();

View File

@ -1,6 +1,7 @@
#include <u.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <ctype.h>
#include <pwd.h>
#include <libc.h>
#include <auth.h>
@ -37,8 +38,6 @@ getuser(void)
static char*
nsfromdisplay(void)
{
int fd;
Dir *d;
char *disp, *p;
if((disp = getenv("DISPLAY")) == nil){

View File

@ -332,7 +332,7 @@ getfile(SConn *conn, uchar *key, int nkey)
{
char *buf;
int nbuf, n, nr, len;
char s[Maxmsg+1], *gf, *p, *q;
char s[Maxmsg+1], *gf;
uchar skey[SHA1dlen], ib[Maxmsg+CHK], *ibr, *ibw;
AESstate aes;
DigestState *sha;
@ -384,7 +384,7 @@ getfile(SConn *conn, uchar *key, int nkey)
if(n > 0){
buf = realloc(buf, nbuf+n+1);
if(buf == nil)
panic("out of memory");
sysfatal("out of memory");
memmove(buf+nbuf, ibr, n);
nbuf += n;
ibr += n;