1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-18 07:16:23 -05:00

Add extra warning check and fix signed to unsigned comparison issues.

This commit is contained in:
Renaud 2015-02-28 20:29:00 +08:00
parent e8bb7b1ea2
commit 80cbd37f5c
9 changed files with 17 additions and 17 deletions

View File

@ -26,7 +26,7 @@ uname_S := $(shell sh -c 'echo $(uname_S) | sed s/_.*$$//')
PROGRAM=ue PROGRAM=ue
CC=gcc CC=gcc
WARNINGS=-Wall -Wstrict-prototypes WARNINGS=-Wall -Wextra -Wstrict-prototypes -Wno-unused-parameter
CFLAGS=-O2 $(WARNINGS) CFLAGS=-O2 $(WARNINGS)
#CC=c89 +O3 # HP #CC=c89 +O3 # HP
#CFLAGS= -D_HPUX_SOURCE -DSYSV #CFLAGS= -D_HPUX_SOURCE -DSYSV
@ -87,7 +87,7 @@ lint: ${SRC}
cat lintout cat lintout
splint: splint:
splint $(DEFINES) $(SRC) -booltype boolean -booltrue TRUE -boolfalse FALSE +posixlib splint -weak $(DEFINES) $(SRC) -booltype boolean -booltrue TRUE -boolfalse FALSE +posixlib
errs: errs:
@rm -f makeout @rm -f makeout

7
bind.c
View File

@ -35,7 +35,7 @@ static int strinc( char *source, char *sub) ;
static void cmdstr( int c, char *seq) ; static void cmdstr( int c, char *seq) ;
static unsigned int getckey( int mflag) ; static unsigned int getckey( int mflag) ;
static unsigned int stock( char *keyname) ; static unsigned int stock( char *keyname) ;
static int unbindchar( int c) ; static int unbindchar( unsigned c) ;
static char *getfname( fn_t) ; static char *getfname( fn_t) ;
@ -233,7 +233,7 @@ int unbindkey(int f, int n)
* *
* int c; command key to unbind * int c; command key to unbind
*/ */
static int unbindchar( int c) { static int unbindchar( unsigned c) {
struct key_tab *ktp; /* pointer into the command table */ struct key_tab *ktp; /* pointer into the command table */
struct key_tab *sktp; /* saved pointer into the command table */ struct key_tab *sktp; /* saved pointer into the command table */
int found; /* matched command flag */ int found; /* matched command flag */
@ -514,8 +514,7 @@ static void cmdstr( int c, char *seq) {
* *
* int c; key to find what is bound to it * int c; key to find what is bound to it
*/ */
int (*getbind(int c))(int, int) fn_t getbind( unsigned c) {
{
struct key_tab *ktp; struct key_tab *ktp;
ktp = &keytab[0]; /* Look in key table. */ ktp = &keytab[0]; /* Look in key table. */

2
bind.h
View File

@ -16,7 +16,7 @@ int bindtokey( int f, int n) ;
int unbindkey( int f, int n) ; int unbindkey( int f, int n) ;
int desbind( int f, int n) ; int desbind( int f, int n) ;
int startup( const char *fname) ; int startup( const char *fname) ;
fn_t getbind( int c) ; fn_t getbind( unsigned keycode) ;
fn_t fncmatch( char *) ; fn_t fncmatch( char *) ;
char *transbind( char *skey) ; char *transbind( char *skey) ;

View File

@ -1,6 +1,6 @@
/* Structure for the table of initial key bindings. */ /* Structure for the table of initial key bindings. */
struct key_tab { struct key_tab {
int k_code ; /* Key code */ unsigned k_code ; /* Key code */
int (*k_fp)( int, int) ; /* Routine to handle it */ int (*k_fp)( int, int) ; /* Routine to handle it */
} ; } ;

8
eval.c
View File

@ -341,7 +341,7 @@ void varinit(void)
* @fname: name of function to evaluate. * @fname: name of function to evaluate.
*/ */
static char *gtfun( char *fname) { static char *gtfun( char *fname) {
int fnum ; /* index to function to eval */ unsigned fnum ; /* index to function to eval */
char argx[ 512] ; /* last argument, fixed sized allocation */ char argx[ 512] ; /* last argument, fixed sized allocation */
char *arg1 ; /* value of first argument */ char *arg1 ; /* value of first argument */
char *arg2 ; /* value of second argument */ char *arg2 ; /* value of second argument */
@ -627,7 +627,7 @@ static char *gtusr( char *vname) {
* char *vname; name of environment variable to retrieve * char *vname; name of environment variable to retrieve
*/ */
static char *gtenv( char *vname) { static char *gtenv( char *vname) {
int vnum; /* ordinal number of var refrenced */ unsigned vnum ; /* ordinal number of var referenced */
/* scan the list, looking for the referenced name */ /* scan the list, looking for the referenced name */
for (vnum = 0; vnum < ARRAY_SIZE(envars); vnum++) for (vnum = 0; vnum < ARRAY_SIZE(envars); vnum++)
@ -845,7 +845,7 @@ int mdbugout( char *fmt, char *s1, char *s2, char *s3) {
*/ */
static void findvar(char *var, struct variable_description *vd, int size) static void findvar(char *var, struct variable_description *vd, int size)
{ {
int vnum; /* subscript in variable arrays */ unsigned vnum ; /* subscript in variable arrays */
int vtype; /* type to return */ int vtype; /* type to return */
vnum = -1; vnum = -1;
@ -1160,7 +1160,7 @@ char *getval(char *token)
{ {
int status; /* error return */ int status; /* error return */
struct buffer *bp; /* temp buffer pointer */ struct buffer *bp; /* temp buffer pointer */
int blen; /* length of buffer argument */ unsigned blen ; /* length of buffer argument */
int distmp; /* temporary discmd flag */ int distmp; /* temporary discmd flag */
static char buf[NSTRING]; /* string buffer for some returns */ static char buf[NSTRING]; /* string buffer for some returns */

View File

@ -76,7 +76,7 @@ boolean fexist( const char *fname)
*/ */
char *flook( const char *fname, boolean hflag) char *flook( const char *fname, boolean hflag)
{ {
int i; /* index */ unsigned i ; /* index */
static char fspec[NSTRING]; /* full path spec to search */ static char fspec[NSTRING]; /* full path spec to search */
#if ENVFUNC #if ENVFUNC

View File

@ -185,7 +185,7 @@ static int isearch(int f, int n)
{ {
int status; /* Search status */ int status; /* Search status */
int col; /* prompt column */ int col; /* prompt column */
int cpos; /* character number in search string */ unsigned cpos ; /* character number in search string */
int c; /* current input character */ int c; /* current input character */
int expc; /* function expanded input char */ int expc; /* function expanded input char */
spat_t pat_save ; /* Saved copy of the old pattern str */ spat_t pat_save ; /* Saved copy of the old pattern str */
@ -397,7 +397,7 @@ static int scanmore(char *patrn, int dir) /* search forward or back for a patter
*/ */
static int match_pat(char *patrn) /* See if the pattern string matches string at "." */ static int match_pat(char *patrn) /* See if the pattern string matches string at "." */
{ {
int i; /* Generic loop index/offset */ unsigned i ; /* Generic loop index/offset */
int buffchar; /* character at current position */ int buffchar; /* character at current position */
struct line *curline; /* current line during scan */ struct line *curline; /* current line during scan */
int curoff; /* position within current line */ int curoff; /* position within current line */

View File

@ -940,7 +940,7 @@ int delgmode(int f, int n)
* int global; true = global flag, false = current buffer flag * int global; true = global flag, false = current buffer flag
*/ */
static int adjustmode( int kind, int global) { static int adjustmode( int kind, int global) {
int i; /* loop index */ unsigned i ; /* loop index */
int status; /* error return on input */ int status; /* error return on input */
char prompt[50]; /* string to prompt user with */ char prompt[50]; /* string to prompt user with */
char cbuf[ NSTRING] ; /* buffer to recieve mode name into */ char cbuf[ NSTRING] ; /* buffer to recieve mode name into */

View File

@ -741,7 +741,6 @@ static int readpattern(char *prompt, char *apat, int srch)
void savematch(void) void savematch(void)
{ {
char *ptr; /* pointer to last match string */ char *ptr; /* pointer to last match string */
int j;
struct line *curline; /* line of last match */ struct line *curline; /* line of last match */
int curoff; /* offset " " */ int curoff; /* offset " " */
@ -754,6 +753,8 @@ void savematch(void)
ptr = patmatch = malloc(matchlen + 1); ptr = patmatch = malloc(matchlen + 1);
if (ptr != NULL) { if (ptr != NULL) {
unsigned j ;
curoff = matchoff; curoff = matchoff;
curline = matchline; curline = matchline;