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 # Unix
AR=ar AR=ar
AS=as AS=as
CC=gcc -Wall CC=gcc -Wall -Wno-missing-braces
RANLIB=ranlib RANLIB=ranlib
CFLAGS=-I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -ggdb -D_THREAD_SAFE -pthread # not ready for this yet: -Wall CFLAGS=-I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -ggdb -D_THREAD_SAFE -pthread # not ready for this yet: -Wall
O=o O=o

22
cpu.c
View File

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

View File

@ -10,3 +10,4 @@ extern char *getkey(char*, char*);
extern char *findkey(char**, char*); extern char *findkey(char**, char*);
extern int dialfactotum(void); extern int dialfactotum(void);
extern char *getuser(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]; char buf[ERRMAX], ebuf[ERRMAX];
Fsrpc *r; Fsrpc *r;
int i, n; int i, n;
char *dbfile, *srv, *file;
ulong initial;
fcalls[Tversion] = Xversion; fcalls[Tversion] = Xversion;
fcalls[Tauth] = Xauth; fcalls[Tauth] = Xauth;
@ -110,7 +108,6 @@ reply(Fcall *r, Fcall *t, char *err)
{ {
uchar *data; uchar *data;
int m, n; int m, n;
static QLock lk;
t->tag = r->tag; t->tag = r->tag;
t->fid = r->fid; t->fid = r->fid;
@ -494,7 +491,6 @@ fatal(char *s, ...)
{ {
char buf[ERRMAX]; char buf[ERRMAX];
va_list arg; va_list arg;
Proc *m;
if (s) { if (s) {
va_start(arg, s); va_start(arg, s);
@ -510,6 +506,6 @@ fatal(char *s, ...)
if (s) if (s)
sysfatal(buf); sysfatal(buf);
else else
exits(nil); sysfatal("");
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -235,7 +235,9 @@ extern int fmtinstall(int, int (*)(Fmt*));
extern char* fmtstrflush(Fmt*); extern char* fmtstrflush(Fmt*);
extern int runefmtstrinit(Fmt*); extern int runefmtstrinit(Fmt*);
extern Rune* runefmtstrflush(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* mallocz(ulong, int);
extern void srand(long); extern void srand(long);
@ -250,3 +252,21 @@ extern char* cleanname(char*);
extern void sysfatal(char*, ...); extern void sysfatal(char*, ...);
extern char* strecpy(char*, char*, 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 src "/sys/src/libmemdraw"
#pragma lib "libmemdraw.a" #pragma lib "libmemdraw.a"
#endif
typedef struct Memimage Memimage; typedef struct Memimage Memimage;
typedef struct Memdata Memdata; typedef struct Memdata Memdata;
@ -123,6 +125,7 @@ extern Memimage* readmemimage(int);
extern Memimage* creadmemimage(int); extern Memimage* creadmemimage(int);
extern int writememimage(int, Memimage*); extern int writememimage(int, Memimage*);
extern void freememimage(Memimage*); extern void freememimage(Memimage*);
extern void _freememimage(Memimage*);
extern int _loadmemimage(Memimage*, Rectangle, uchar*, int); extern int _loadmemimage(Memimage*, Rectangle, uchar*, int);
extern int _cloadmemimage(Memimage*, Rectangle, uchar*, int); extern int _cloadmemimage(Memimage*, Rectangle, uchar*, int);
extern int _unloadmemimage(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 uchar* byteaddr(Memimage*, Point);
extern int drawclip(Memimage*, Rectangle*, Memimage*, Point*, Memimage*, Point*, Rectangle*, Rectangle*); extern int drawclip(Memimage*, Rectangle*, Memimage*, Point*, Memimage*, Point*, Rectangle*, Rectangle*);
extern void memfillcolor(Memimage*, ulong); extern void memfillcolor(Memimage*, ulong);
extern void _memfillcolor(Memimage*, ulong);
extern int memsetchan(Memimage*, ulong); extern int memsetchan(Memimage*, ulong);
extern ulong _rgbatoimg(Memimage*, ulong);
/* /*
* Graphics * 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 Rectangle memlinebbox(Point, Point, int, int, int);
extern int memlineendsize(int); extern int memlineendsize(int);
extern void _memmkcmap(void); extern void _memmkcmap(void);
extern void _memimageinit(void);
extern void memimageinit(void); extern void memimageinit(void);
/* /*
@ -185,16 +191,20 @@ void memimagemove(void*, void*);
*/ */
extern void rdb(void); extern void rdb(void);
extern int iprint(char*, ...); extern int iprint(char*, ...);
#pragma varargck argpos iprint 1
extern int drawdebug; extern int drawdebug;
/* /*
* doprint interface: numbconv bit strings * doprint interface: numbconv bit strings
*/ */
#ifdef VARARGCK
#pragma varargck argpos iprint 1
#pragma varargck type "llb" vlong #pragma varargck type "llb" vlong
#pragma varargck type "llb" uvlong #pragma varargck type "llb" uvlong
#pragma varargck type "lb" long #pragma varargck type "lb" long
#pragma varargck type "lb" ulong #pragma varargck type "lb" ulong
#pragma varargck type "b" int #pragma varargck type "b" int
#pragma varargck type "b" uint #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 src "/sys/src/libmemlayer"
#pragma lib "libmemlayer.a" #pragma lib "libmemlayer.a"
#endif
typedef struct Memscreen Memscreen; typedef struct Memscreen Memscreen;
typedef void (*Refreshfn)(Memimage*, Rectangle, void*); typedef void (*Refreshfn)(Memimage*, Rectangle, void*);

View File

@ -23,6 +23,8 @@
#define nsec sysnsec #define nsec sysnsec
#define pread syspread #define pread syspread
#define pwrite syspwrite #define pwrite syspwrite
#undef sleep
#define sleep osmsleep
extern int bind(char*, char*, int); extern int bind(char*, char*, int);
extern int chdir(char*); extern int chdir(char*);
@ -43,6 +45,7 @@ extern vlong seek(int, vlong, int);
extern int stat(char*, uchar*, int); extern int stat(char*, uchar*, int);
extern long write(int, void*, long); extern long write(int, void*, long);
extern int wstat(char*, uchar*, int); extern int wstat(char*, uchar*, int);
extern void werrstr(char* ,...);
extern Dir *dirstat(char*); extern Dir *dirstat(char*);
extern Dir *dirfstat(int); extern Dir *dirfstat(int);
@ -65,3 +68,26 @@ extern char *netmkaddr(char*, char*, char*);
extern int reject(int, char*, char*); extern int reject(int, char*, char*);
extern char* argv0; 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; int n;
char *t, *prev; char *t, *prev;
static Lock l;
n = strlen(s)+1; n = strlen(s)+1;
/* if it's a user, we can wait for memory; if not, something's very wrong */ /* if it's a user, we can wait for memory; if not, something's very wrong */
@ -1422,8 +1421,7 @@ char isfrog[256]={
void void
validname(char *aname, int slashok) validname(char *aname, int slashok)
{ {
char *p, *ename, *name; char *ename, *name;
uint t;
int c; int c;
Rune r; Rune r;

View File

@ -136,7 +136,7 @@ enum
COPEN = 0x0001, /* for i/o */ COPEN = 0x0001, /* for i/o */
CMSG = 0x0002, /* the message channel for a mount */ 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 */ CCEXEC = 0x0008, /* close on exec */
CFREE = 0x0010, /* not in use */ CFREE = 0x0010, /* not in use */
CRCLOSE = 0x0020, /* remove on close */ CRCLOSE = 0x0020, /* remove on close */

View File

@ -128,9 +128,6 @@ prflush(void)
static void static void
putstrn0(char *str, int n, int usewrite) putstrn0(char *str, int n, int usewrite)
{ {
int m;
char *t;
/* /*
* if someone is reading /dev/kprint, * if someone is reading /dev/kprint,
* put the message there. * put the message there.
@ -294,8 +291,7 @@ echoserialoq(char *buf, int n)
static void static void
echo(char *buf, int n) echo(char *buf, int n)
{ {
static int ctrlt, pid; static int ctrlt;
extern ulong etext;
int x; int x;
char *e, *p; char *e, *p;
@ -655,11 +651,10 @@ consclose(Chan *c)
static long static long
consread(Chan *c, void *buf, long n, vlong off) consread(Chan *c, void *buf, long n, vlong off)
{ {
ulong l; char *b;
char *b, *bp;
char tmp[128]; /* must be >= 6*NUMSIZE */ char tmp[128]; /* must be >= 6*NUMSIZE */
char *cbuf = buf; char *cbuf = buf;
int ch, i, k, id, eol; int ch, i, eol;
vlong offset = off; vlong offset = off;
if(n <= 0) if(n <= 0)
@ -819,7 +814,7 @@ conswrite(Chan *c, void *va, long n, vlong off)
char buf[256]; char buf[256];
long l, bp; long l, bp;
char *a = va; char *a = va;
int id, fd; int fd;
Chan *swc; Chan *swc;
ulong offset = off; ulong offset = off;
Cmdbuf *cb; Cmdbuf *cb;
@ -866,7 +861,7 @@ conswrite(Chan *c, void *va, long n, vlong off)
} else if(strncmp(a, "ctlpoff", 7) == 0){ } else if(strncmp(a, "ctlpoff", 7) == 0){
kbd.ctlpoff = 1; kbd.ctlpoff = 1;
} }
if(a = strchr(a, ' ')) if((a = strchr(a, ' ')))
a++; a++;
} }
break; break;
@ -999,19 +994,19 @@ seedrand(void)
randomread((void*)&randn, sizeof(randn)); randomread((void*)&randn, sizeof(randn));
} }
// int int
// nrand(int n) xnrand(int n)
// { {
// if(randn == 0) if(randn == 0)
// seedrand(); seedrand();
// randn = randn*1103515245 + 12345 + fastticks(0); randn = randn*1103515245 + 12345 + fastticks(0);
// return (randn>>16) % n; return (randn>>16) % n;
// } }
int int
rand(void) rand(void)
{ {
nrand(1); xnrand(1);
return randn; return randn;
} }
@ -1058,6 +1053,7 @@ le2long(long *to, uchar *f)
return f+sizeof(long); return f+sizeof(long);
} }
/*
static uchar* static uchar*
long2le(uchar *t, long from) long2le(uchar *t, long from)
{ {
@ -1070,6 +1066,7 @@ long2le(uchar *t, long from)
t[i] = f[o[i]]; t[i] = f[o[i]];
return t+sizeof(long); return t+sizeof(long);
} }
*/
char *Ebadtimectl = "bad time control"; 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 Enotfont[] = "image not a font";
static char Eindex[] = "character index out of range"; static char Eindex[] = "character index out of range";
static char Enoclient[] = "no such draw client"; 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 Enameused[] = "image name in use";
static char Enoname[] = "no image with that name"; static char Enoname[] = "no image with that name";
static char Eoldname[] = "named image no longer valid"; static char Eoldname[] = "named image no longer valid";
@ -627,7 +627,7 @@ drawfreedscreen(DScreen *this)
dscreen = this->next; dscreen = this->next;
goto Found; goto Found;
} }
while(next = ds->next){ /* assign = */ while((next = ds->next)){ /* assign = */
if(next == this){ if(next == this){
ds->next = this->next; ds->next = this->next;
goto Found; goto Found;
@ -702,7 +702,7 @@ drawuninstallscreen(Client *client, CScreen *this)
free(this); free(this);
return; return;
} }
while(next = cs->next){ /* assign = */ while((next = cs->next)){ /* assign = */
if(next == this){ if(next == this){
cs->next = this->next; cs->next = this->next;
drawfreedscreen(this->dscreen); drawfreedscreen(this->dscreen);
@ -726,7 +726,7 @@ drawuninstall(Client *client, int id)
drawfreedimage(d); drawfreedimage(d);
return; return;
} }
while(next = d->next){ /* assign = */ while((next = d->next)){ /* assign = */
if(next->id == id){ if(next->id == id){
d->next = next->next; d->next = next->next;
drawfreedimage(next); drawfreedimage(next);
@ -1024,7 +1024,7 @@ drawclose(Chan *c)
if(QID(c->qid) == Qctl) if(QID(c->qid) == Qctl)
cl->busy = 0; cl->busy = 0;
if((c->flag&COPEN) && (decref(&cl->r)==0)){ if((c->flag&COPEN) && (decref(&cl->r)==0)){
while(r = cl->refresh){ /* assign = */ while((r = cl->refresh)){ /* assign = */
cl->refresh = r->next; cl->refresh = r->next;
free(r); free(r);
} }

View File

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

View File

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

View File

@ -621,9 +621,6 @@ eipfmt(Fmt *f)
static char *efmt = "%.2lux%.2lux%.2lux%.2lux%.2lux%.2lux"; static char *efmt = "%.2lux%.2lux%.2lux%.2lux%.2lux%.2lux";
static char *ifmt = "%d.%d.%d.%d"; static char *ifmt = "%d.%d.%d.%d";
uchar *p, ip[16]; uchar *p, ip[16];
ulong *lp;
ushort s;
int i, j, n, eln, eli;
ulong ul; ulong ul;
switch(f->r) { 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_getsockname(int, unsigned long*, unsigned short*);
void so_bind(int, int, unsigned short); void so_bind(int, int, unsigned short);
void so_listen(int); 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_accept(int, unsigned long*, unsigned short*);
int so_getservbyname(char*, char*, char*); int so_getservbyname(char*, char*, char*);
int so_gethostbyname(char*, char**, int); int so_gethostbyname(char*, char**, int);

View File

@ -151,7 +151,7 @@ void ksetenv(char*, char*, int);
void kstrcpy(char*, char*, int); void kstrcpy(char*, char*, int);
void kstrdup(char**, char*); void kstrdup(char**, char*);
long latin1(Rune*, int); long latin1(Rune*, int);
int lock(Lock*); void lock(Lock*);
void lockinit(void); void lockinit(void);
void logopen(Log*); void logopen(Log*);
void logclose(Log*); void logclose(Log*);
@ -197,6 +197,7 @@ int nrand(int);
int okaddr(ulong, ulong, int); int okaddr(ulong, ulong, int);
int openmode(ulong); int openmode(ulong);
void oserrstr(void); void oserrstr(void);
void oserror(void);
Block* packblock(Block*); Block* packblock(Block*);
Block* padblock(Block*, int); Block* padblock(Block*, int);
void pagechainhead(Page*); void pagechainhead(Page*);
@ -379,3 +380,12 @@ void hnputs(void*, ushort);
vlong nhgetv(void*); vlong nhgetv(void*);
ulong nhgetl(void*); ulong nhgetl(void*);
ushort nhgets(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; new->maxfd = f->maxfd;
for(i = 0; i <= f->maxfd; i++) { for(i = 0; i <= f->maxfd; i++) {
if(c = f->fd[i]){ if((c = f->fd[i])){
incref(&c->ref); incref(&c->ref);
new->fd[i] = c; new->fd[i] = c;
} }
@ -212,7 +212,7 @@ closefgrp(Fgrp *f)
return; return;
for(i = 0; i <= f->maxfd; i++) for(i = 0; i <= f->maxfd; i++)
if(c = f->fd[i]) if((c = f->fd[i]))
cclose(c); cclose(c);
free(f->fd); free(f->fd);

View File

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

View File

@ -213,7 +213,7 @@ pullupblock(Block *bp, int n)
* copy bytes from the trailing blocks into the first * copy bytes from the trailing blocks into the first
*/ */
n -= BLEN(bp); n -= BLEN(bp);
while(nbp = bp->next){ while((nbp = bp->next)){
i = BLEN(nbp); i = BLEN(nbp);
if(i > n) { if(i > n) {
memmove(bp->wp, nbp->rp, 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(x);
USED(msg); USED(msg);
USED(flag); USED(flag);
return 0;
} }
void void

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@ utfutf(char *s1, char *s2)
return strstr(s1, s2); return strstr(s1, s2);
n2 = strlen(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) if(strncmp(p, s2, n2) == 0)
return p; return p;
return 0; return 0;

View File

@ -86,7 +86,6 @@ static Memdrawparam par;
Memdrawparam* Memdrawparam*
_memimagedrawsetup(Memimage *dst, Rectangle r, Memimage *src, Point p0, Memimage *mask, Point p1, int op) _memimagedrawsetup(Memimage *dst, Rectangle r, Memimage *src, Point p0, Memimage *mask, Point p1, int op)
{ {
static int n = 0;
if(mask == nil) if(mask == nil)
mask = memopaque; mask = memopaque;
@ -458,7 +457,6 @@ static Writefn* writefn(Memimage*);
static Calcfn* boolcopyfn(Memimage*, Memimage*); static Calcfn* boolcopyfn(Memimage*, Memimage*);
static Readfn* convfn(Memimage*, Param*, Memimage*, Param*); static Readfn* convfn(Memimage*, Param*, Memimage*, Param*);
static Readfn* ptrfn(Memimage*);
static Calcfn *alphacalc[Ncomp] = static Calcfn *alphacalc[Ncomp] =
{ {
@ -569,19 +567,19 @@ dumpbuf(char *s, Buffer b, int n)
print("%s", s); print("%s", s);
for(i=0; i<n; i++){ for(i=0; i<n; i++){
print(" "); print(" ");
if(p=b.grey){ if((p=b.grey)){
print(" k%.2uX", *p); print(" k%.2uX", *p);
b.grey += b.delta; b.grey += b.delta;
}else{ }else{
if(p=b.red){ if((p=b.red)){
print(" r%.2uX", *p); print(" r%.2uX", *p);
b.red += b.delta; b.red += b.delta;
} }
if(p=b.grn){ if((p=b.grn)){
print(" g%.2uX", *p); print(" g%.2uX", *p);
b.grn += b.delta; b.grn += b.delta;
} }
if(p=b.blu){ if((p=b.blu)){
print(" b%.2uX", *p); print(" b%.2uX", *p);
b.blu += b.delta; 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); DBG print("readnbit dx %d %p=%p+%d*%d, *r=%d fetch %d ", dx, r, p->bytermin, y, p->bwidth, *r, n);
bits = *r++; bits = *r++;
nbits = 8; nbits = 8;
if(i=x&(npack-1)){ if((i=x&(npack-1))){
DBG print("throwaway %d...", i); DBG print("throwaway %d...", i);
bits <<= depth*i; bits <<= depth*i;
nbits -= depth*i; nbits -= depth*i;
@ -1323,7 +1321,7 @@ DBG print("bit %x...", repl[bits>>sh]);
DBG print("x=%d r=%p...", x, r); DBG print("x=%d r=%p...", x, r);
bits = *r++; bits = *r++;
nbits = 8; nbits = 8;
if(i=x&(npack-1)){ if((i=x&(npack-1))){
bits <<= depth*i; bits <<= depth*i;
nbits -= depth*i; nbits -= depth*i;
} }
@ -1912,7 +1910,7 @@ boolcopyfn(Memimage *img, Memimage *mask)
/* /*
* Optimized draw for filling and scrolling; uses memset and memmove. * Optimized draw for filling and scrolling; uses memset and memmove.
*/ *
static void static void
memsetb(void *vp, uchar val, int n) memsetb(void *vp, uchar val, int n)
{ {
@ -1923,6 +1921,7 @@ memsetb(void *vp, uchar val, int n)
while(p<ep) while(p<ep)
*p++ = val; *p++ = val;
} }
*/
static void static void
memsets(void *vp, ushort val, int n) memsets(void *vp, ushort val, int n)
@ -2459,7 +2458,7 @@ membyteval(Memimage *src)
bpp = src->depth; bpp = src->depth;
uc <<= (src->r.min.x&(7/src->depth))*src->depth; uc <<= (src->r.min.x&(7/src->depth))*src->depth;
uc &= ~(0xFF>>bpp); 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; val = uc;
for(i=bpp; i<8; i<<=1) for(i=bpp; i<8; i<<=1)
val |= val>>i; 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; p.op = op;
u = (t<<1)*(a-b); 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 */ /* if(b<a&&(t<<1)>b*b/a || a<b&&(t<<1)>a*a/b) # very thick */
bellipse(b, newstate(&in, a, b), &p); bellipse(b, newstate(&in, a, b), &p);
return; return;
@ -209,7 +209,7 @@ erect(int x0, int y0, int x1, int y1, Param *p)
{ {
Rectangle r; 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); 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); 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; Point p0;
Rectangle r; 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); p0 = Pt(p->c.x+x, p->c.y+y);
r = Rpt(addpt(p0, p->disc->r.min), addpt(p0, p->disc->r.max)); 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); 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 void
eline(int x0, int y0, int x1, int y1, Param *p) 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) if(x1 > x0+1)
erect(x0+1, y0-p->t, x1-1, y1+p->t, p); erect(x0+1, y0-p->t, x1-1, y1+p->t, p);
else if(y1 > y0+1) 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 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); static void yscan(Memimage *dst, Seg **seg, Seg *segtab, int nseg, int wind, Memimage *src, Point sp, int, int);
#ifdef NOT
static void static void
fillcolor(Memimage *dst, int left, int right, int y, Memimage *src, Point p) 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; p.y = y;
memset(byteaddr(dst, p), srcval, right-left); memset(byteaddr(dst, p), srcval, right-left);
} }
#endif
static void static void
fillline(Memimage *dst, int left, int right, int y, Memimage *src, Point p, int op) fillline(Memimage *dst, int left, int right, int y, Memimage *src, Point p, int op)

View File

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

View File

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

View File

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

View File

@ -43,7 +43,10 @@ static const u32 Td3[256];
static const u8 Te4[256]; static const u8 Te4[256];
static int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits); 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); 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 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 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]); 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. * @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) { static int rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits) {
int Nr, i, j; int Nr, i, j;
u32 temp; u32 temp;
@ -994,6 +998,7 @@ static int rijndaelKeySetupDec(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int
} }
return Nr; return Nr;
} }
#endif
static void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 ct[16]) { 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; u32 s0, s1, s2, s3, t0, t1, t2, t3;

View File

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

7
main.c
View File

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

View File

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

View File

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