Clean up various compile warnings

Most of them were harmless: gcc not being smart enough to realize that
an uninitialized variable was never used if it wasn't initialized etc.

Some of them were name clashes ("crypt()" is a standard library
function, so rename it to "myencrypt()") etc.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Linus Torvalds 2006-11-19 11:52:18 -08:00
parent 1c5e6d8121
commit 686a9e74ed
17 changed files with 41 additions and 35 deletions

2
ansi.c
View File

@ -252,7 +252,7 @@ int f, n; /* default flag, numeric argument [unused] */
} }
#endif #endif
#else #else
static void ansihello(void) void ansihello(void)
{ {
} }
#endif #endif

2
bind.c
View File

@ -19,7 +19,7 @@ int help(int f, int n)
into it with view mode */ into it with view mode */
register window_t *wp; /* scaning pointer to windows */ register window_t *wp; /* scaning pointer to windows */
register BUFFER *bp; /* buffer pointer to help */ register BUFFER *bp; /* buffer pointer to help */
char *fname; /* ptr to file returned by flook() */ char *fname = NULL; /* ptr to file returned by flook() */
/* first check if we are already here */ /* first check if we are already here */
bp = bfind("emacs.hlp", FALSE, BFINVS); bp = bfind("emacs.hlp", FALSE, BFINVS);

22
crypt.c
View File

@ -20,7 +20,7 @@ static int mod95(int);
* int f; default flag * int f; default flag
* int n; numeric argument * int n; numeric argument
*/ */
int setkey(int f, int n) int set_encryption_key(int f, int n)
{ {
register int status; /* return status */ register int status; /* return status */
int odisinp; /* original vlaue of disinp */ int odisinp; /* original vlaue of disinp */
@ -37,8 +37,8 @@ int setkey(int f, int n)
return (status); return (status);
/* and encrypt it */ /* and encrypt it */
crypt((char *) NULL, 0); myencrypt((char *) NULL, 0);
crypt(key, strlen(key)); myencrypt(key, strlen(key));
/* and save it off */ /* and save it off */
strcpy(curbp->b_key, key); strcpy(curbp->b_key, key);
@ -48,7 +48,7 @@ int setkey(int f, int n)
/********** /**********
* *
* crypt - in place encryption/decryption of a buffer * myencrypt - in place encryption/decryption of a buffer
* *
* (C) Copyright 1986, Dana L. Hoggatt * (C) Copyright 1986, Dana L. Hoggatt
* 1216, Beck Lane, Lafayette, IN * 1216, Beck Lane, Lafayette, IN
@ -77,7 +77,7 @@ int setkey(int f, int n)
* 4. The system needed to be secure against all but the * 4. The system needed to be secure against all but the
* most determined of attackers. * most determined of attackers.
* *
* For encryption of a block of data, one calls crypt passing * For encryption of a block of data, one calls myencrypt passing
* a pointer to the data block and its length. The data block is * a pointer to the data block and its length. The data block is
* encrypted in place, that is, the encrypted output overwrites * encrypted in place, that is, the encrypted output overwrites
* the input. Decryption is totally isomorphic, and is performed * the input. Decryption is totally isomorphic, and is performed
@ -86,9 +86,9 @@ int setkey(int f, int n)
* Before using this routine for encrypting data, you are expected * Before using this routine for encrypting data, you are expected
* to specify an encryption key. This key is an arbitrary string, * to specify an encryption key. This key is an arbitrary string,
* to be supplied by the user. To set the key takes two calls to * to be supplied by the user. To set the key takes two calls to
* crypt(). First, you call * myencrypt(). First, you call
* *
* crypt(NULL, vector) * myencrypt(NULL, vector)
* *
* This resets all internal control information. Typically (and * This resets all internal control information. Typically (and
* specifically in the case on MICRO-emacs) you would use a "vector" * specifically in the case on MICRO-emacs) you would use a "vector"
@ -99,9 +99,9 @@ int setkey(int f, int n)
* *
* Then, you "encrypt" your password by calling * Then, you "encrypt" your password by calling
* *
* crypt(pass, strlen(pass)) * myencrypt(pass, strlen(pass))
* *
* where "pass" is your password string. Crypt() will destroy * where "pass" is your password string. Myencrypt() will destroy
* the original copy of the password (it becomes encrypted), * the original copy of the password (it becomes encrypted),
* which is good. You do not want someone on a multiuser system * which is good. You do not want someone on a multiuser system
* to peruse your memory space and bump into your password. * to peruse your memory space and bump into your password.
@ -143,7 +143,7 @@ int setkey(int f, int n)
* *
**********/ **********/
void crypt(char *bptr, unsigned len) void myencrypt(char *bptr, unsigned len)
{ {
register int cc; /* current character being considered */ register int cc; /* current character being considered */
@ -217,7 +217,7 @@ static int mod95(int val)
return (val); return (val);
} }
#else #else
static void nocrypt(void) static void myennocrypt(void)
{ {
} }
#endif #endif

View File

@ -248,7 +248,7 @@ KEYTAB keytab[NBINDS] = {
{META | 'D', delfword} {META | 'D', delfword}
, ,
#if CRYPT #if CRYPT
{META | 'E', setkey} {META | 'E', set_encryption_key}
, ,
#endif #endif
{META | 'F', forwword} {META | 'F', forwword}

View File

@ -225,7 +225,6 @@ extern int fileread(int f, int n);
extern int insfile(int f, int n); extern int insfile(int f, int n);
extern int filefind(int f, int n); extern int filefind(int f, int n);
extern int viewfile(int f, int n); extern int viewfile(int f, int n);
extern int resetkey(void);
extern int getfile(char *fname, int lockfl); extern int getfile(char *fname, int lockfl);
extern int readin(char *fname, int lockfl); extern int readin(char *fname, int lockfl);
extern void makename(char *bname, char *fname); extern void makename(char *bname, char *fname);
@ -365,8 +364,8 @@ extern int sindex(char *source, char *pattern);
extern char *xlat(char *source, char *lookup, char *trans); extern char *xlat(char *source, char *lookup, char *trans);
/* crypt.c */ /* crypt.c */
extern int setkey(int f, int n); extern int set_encryption_key(int f, int n);
extern void crypt(char *bptr, unsigned len); extern void myencrypt(char *bptr, unsigned len);
/* lock.c */ /* lock.c */
extern int lockchk(char *fname); extern int lockchk(char *fname);

6
eval.c
View File

@ -448,10 +448,12 @@ int setvar(int f, int n)
*/ */
void findvar(char *var, VDESC *vd, int size) void findvar(char *var, VDESC *vd, int size)
{ {
register int vnum; /* subscript in varable arrays */ register int vnum; /* subscript in variable arrays */
register int vtype; /* type to return */ register int vtype; /* type to return */
fvar:vtype = -1; vnum = -1;
fvar:
vtype = -1;
switch (var[0]) { switch (var[0]) {
case '$': /* check for legal enviromnent var */ case '$': /* check for legal enviromnent var */

12
file.c
View File

@ -101,7 +101,7 @@ int viewfile(int f, int n)
} }
#if CRYPT #if CRYPT
int resetkey(void) static int resetkey(void)
{ /* reset the encryption key if needed */ { /* reset the encryption key if needed */
register int s; /* return status */ register int s; /* return status */
@ -111,7 +111,7 @@ int resetkey(void)
/* if we are in crypt mode */ /* if we are in crypt mode */
if (curbp->b_mode & MDCRYPT) { if (curbp->b_mode & MDCRYPT) {
if (curbp->b_key[0] == 0) { if (curbp->b_key[0] == 0) {
s = setkey(FALSE, 0); s = set_encryption_key(FALSE, 0);
if (s != TRUE) if (s != TRUE)
return (s); return (s);
} }
@ -121,12 +121,12 @@ int resetkey(void)
/* and set up the key to be used! */ /* and set up the key to be used! */
/* de-encrypt it */ /* de-encrypt it */
crypt((char *) NULL, 0); myencrypt((char *) NULL, 0);
crypt(curbp->b_key, strlen(curbp->b_key)); myencrypt(curbp->b_key, strlen(curbp->b_key));
/* re-encrypt it...seeding it to start */ /* re-encrypt it...seeding it to start */
crypt((char *) NULL, 0); myencrypt((char *) NULL, 0);
crypt(curbp->b_key, strlen(curbp->b_key)); myencrypt(curbp->b_key, strlen(curbp->b_key));
} }
return (TRUE); return (TRUE);

View File

@ -87,7 +87,7 @@ int ffputline(char *buf, int nbuf)
if (cryptflag) { if (cryptflag) {
for (i = 0; i < nbuf; ++i) { for (i = 0; i < nbuf; ++i) {
c = buf[i] & 0xff; c = buf[i] & 0xff;
crypt(&c, 1); myencrypt(&c, 1);
fputc(c, ffp); fputc(c, ffp);
} }
} else } else
@ -195,7 +195,7 @@ int ffgetline(void)
fline[i] = 0; fline[i] = 0;
#if CRYPT #if CRYPT
if (cryptflag) if (cryptflag)
crypt(fline, strlen(fline)); myencrypt(fline, strlen(fline));
#endif #endif
return (FIOSUC); return (FIOSUC);
} }

View File

@ -502,7 +502,7 @@ int f, n; /* default flag, numeric argument [unused] */
} }
#endif #endif
#else #else
static void ibmhello(void) void ibmhello(void)
{ {
} }
#endif #endif

View File

@ -439,7 +439,7 @@ int getstring(char *prompt, char *buf, int nbuf, int eolchar)
register int c; register int c;
register int quotef; /* are we quoting the next char? */ register int quotef; /* are we quoting the next char? */
#if COMPLC #if COMPLC
int ffile, ocpos, nskip, didtry = 0; int ffile, ocpos, nskip = 0, didtry = 0;
#if MSDOS #if MSDOS
struct ffblk ffblk; struct ffblk ffblk;
char *fcp; char *fcp;

4
main.c
View File

@ -236,8 +236,8 @@ int main(int argc, char **argv)
#if CRYPT #if CRYPT
if (cryptflag) { if (cryptflag) {
bp->b_mode |= MDCRYPT; bp->b_mode |= MDCRYPT;
crypt((char *) NULL, 0); myencrypt((char *) NULL, 0);
crypt(ekey, strlen(ekey)); myencrypt(ekey, strlen(ekey));
strncpy(bp->b_key, ekey, NPAT); strncpy(bp->b_key, ekey, NPAT);
} }
#endif #endif

View File

@ -20,7 +20,7 @@ CFLAGS=-O2 -Wall
#CFLAGS= -D_HPUX_SOURCE -DSYSV #CFLAGS= -D_HPUX_SOURCE -DSYSV
#CFLAGS=-O4 -DSVR4 # Sun #CFLAGS=-O4 -DSVR4 # Sun
#CFLAGS=-O -qchars=signed # RS/6000 #CFLAGS=-O -qchars=signed # RS/6000
DEFINES=-DAUTOCONF -DPOSIX -DUSG # Linux DEFINES=-DAUTOCONF -DPOSIX -DUSG -D_BSD_SOURCE -D_SVID_SOURCE -D_XOPEN_SOURCE=600 # Linux
#DEFINES=-DAUTOCONF #DEFINES=-DAUTOCONF
#LIBS=-ltermcap # BSD #LIBS=-ltermcap # BSD
#LIBS=-lcurses # SYSV #LIBS=-lcurses # SYSV

View File

@ -191,7 +191,7 @@ NBIND names[] = {
{"select-buffer", usebuffer}, {"select-buffer", usebuffer},
{"set", setvar}, {"set", setvar},
#if CRYPT #if CRYPT
{"set-encryption-key", setkey}, {"set-encryption-key", set_encryption_key},
#endif #endif
{"set-fill-column", setfillcol}, {"set-fill-column", setfillcol},
{"set-mark", setmark}, {"set-mark", setmark},

View File

@ -49,6 +49,9 @@ int showcpos(int f, int n)
/* start counting chars and lines */ /* start counting chars and lines */
numchars = 0; numchars = 0;
numlines = 0; numlines = 0;
predchars = 0;
predlines = 0;
curchar = 0;
while (lp != curbp->b_linep) { while (lp != curbp->b_linep) {
/* if we are on the current line, record it */ /* if we are on the current line, record it */
if (lp == curwp->w_dotp) { if (lp == curwp->w_dotp) {

2
tcap.c
View File

@ -66,8 +66,10 @@ static char *UP, PC, *CM, *CE, *CL, *SO, *SE;
#if PKCODE #if PKCODE
static char *TI, *TE; static char *TI, *TE;
#if USE_BROKEN_OPTIMIZATION
static int term_init_ok = 0; static int term_init_ok = 0;
#endif #endif
#endif
#if SCROLLCODE #if SCROLLCODE
static char *CS, *DL, *AL, *SF, *SR; static char *CS, *DL, *AL, *SF, *SR;

View File

@ -518,7 +518,7 @@ spal()
* *
* Nothing returned * Nothing returned
***/ ***/
static void hellovms(void) void hellovms(void)
{ {
} }

2
vt52.c
View File

@ -178,7 +178,7 @@ int f, n; /* default flag, numeric argument [unused] */
#endif #endif
#else #else
static void vt52hello(void) void vt52hello(void)
{ {
} }