1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-02-11 10:35:04 +00:00

Fix various bugprone warnings (#397)

* Fix some warnings in main.c

main.c:678: narrowing conversion from 'unsigned long' to signed type 'int' is implementation-defined
main.c:493: The return value from the call to 'seteuid' is not checked.

* Fix some warnings in array operations

Instead of extracting typenumbers to an 'int', use the unsigned typenumber directly

array3.c:49: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined
array4.c:61: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined
array5.c:63: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined
array6.c:50: narrowing conversion from 'unsigned int' to signed type 'int' is implementation-defined

* Resolve type mismatches for version numbers and propp flag

dir.c:1849: narrowing conversion from 'unsigned int' to signed type 'int'
dir.c:1850: narrowing conversion from 'unsigned int' to signed type 'int'
dir.c:2114: narrowing conversion from 'unsigned long' to signed type 'int'
dir.c:2207: narrowing conversion from 'unsigned int' to signed type 'int'

* Resolve type mismatches for version numbers and strlen result type

dsk.c:1072: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:1108: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:1549: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:1712: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:1751: narrowing conversion from 'unsigned long' to signed type 'int'
dsk.c:3426: narrowing conversion from 'unsigned int' to signed type 'int'

* Resolve type mismatches for strlen result type

ufs.c:213: narrowing conversion from 'unsigned long' to signed type 'int'
ufs.c:404: narrowing conversion from 'unsigned long' to signed type 'int'

* Resolve type error

uutils.c:117: 'signed char' to 'int' conversion [bugprone-signed-char-misuse,cert-str34-c]
This commit is contained in:
Nick Briggs
2021-09-16 17:24:25 -07:00
committed by GitHub
parent 6fedd97d21
commit 533c935e72
10 changed files with 36 additions and 39 deletions

View File

@@ -851,7 +851,8 @@ LispPTR COM_closefile(register LispPTR *args)
LispPTR DSK_getfilename(register LispPTR *args)
{
register char *base;
register int len, dirp, rval;
size_t len, rval;
register int dirp;
int fatp;
char lfname[MAXPATHLEN];
char aname[MAXNAMLEN];
@@ -1510,7 +1511,8 @@ LispPTR DSK_directorynamep(register LispPTR *args)
{
char dirname[MAXPATHLEN];
char fullname[MAXPATHLEN];
register int len, fatp;
size_t len;
register int fatp;
register char *base;
#ifdef DOS
char drive[1], rawname[MAXNAMLEN];
@@ -1697,7 +1699,8 @@ LispPTR COM_getfileinfo(register LispPTR *args)
*bufp = sbuf.st_mode;
return (ATOM_T);
case AUTHOR:
case AUTHOR: {
size_t rval;
#ifndef DOS
TIMEOUT(pwd = getpwuid(sbuf.st_uid));
if (pwd == (struct passwd *)NULL) {
@@ -1717,8 +1720,9 @@ LispPTR COM_getfileinfo(register LispPTR *args)
#endif /* BYTESWAP */
#endif /* DOS */
return (GetSmallp(rval));
case ALL:
}
case ALL: {
size_t rval;
/*
* The format of the buffer which has been allocated by Lisp
* is as follows.
@@ -1756,7 +1760,7 @@ LispPTR COM_getfileinfo(register LispPTR *args)
#endif /* BYTESWAP */
#endif /* DOS */
return (GetSmallp(rval));
}
default: return (NIL);
}
}
@@ -3395,7 +3399,8 @@ static int get_versionless(FileName *varray, char *file, char *dir)
static int check_vless_link(char *vless, FileName *varray, char *to_file, int *highest_p)
{
register int rval, max_no, found;
register int rval, found;
unsigned max_no;
ino_t vless_ino;
struct stat sbuf;
char dir[MAXPATHLEN], name[MAXNAMLEN], ver[VERSIONLEN];