Add (unsigned char) cast to ctype macros

ftell->ftello, fseek->fseeko
File 'newsize' type int->off_t
Add visible (long) cast to fsize() when it called to small one message file and
result is assigned to long.
This commit is contained in:
Andrey A. Chernov 2001-12-19 21:50:22 +00:00
parent dc015e16dc
commit 6d48fa4387
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=88227
9 changed files with 34 additions and 34 deletions

View File

@ -181,7 +181,7 @@ gethfield(f, linebuf, rem, colon)
return (-1);
if ((c = readline(f, linebuf, LINESIZE)) <= 0)
return (-1);
for (cp = linebuf; isprint(*cp) && *cp != ' ' && *cp != ':';
for (cp = linebuf; isprint((unsigned char)*cp) && *cp != ' ' && *cp != ':';
cp++)
;
if (*cp != ':' || cp == linebuf)
@ -256,7 +256,7 @@ istrncpy(dest, src, dsize)
strlcpy(dest, src, dsize);
while (*dest)
*dest++ = tolower(*dest);
*dest++ = tolower((unsigned char)*dest);
}
/*

View File

@ -249,7 +249,7 @@ snarf(linebuf, flag)
* Strip away trailing blanks.
*/
while (cp > linebuf && isspace(*cp))
while (cp > linebuf && isspace((unsigned char)*cp))
cp--;
*++cp = '\0';
@ -257,13 +257,13 @@ snarf(linebuf, flag)
* Now search for the beginning of the file name.
*/
while (cp > linebuf && !isspace(*cp))
while (cp > linebuf && !isspace((unsigned char)*cp))
cp--;
if (*cp == '\0') {
printf("No file specified.\n");
return (NULL);
}
if (isspace(*cp))
if (isspace((unsigned char)*cp))
*cp++ = '\0';
else
*flag = 0;

View File

@ -248,7 +248,7 @@ collect(hp, printheaders)
* Set the Subject line.
*/
cp = &linebuf[2];
while (isspace(*cp))
while (isspace((unsigned char)*cp))
cp++;
hp->h_subject = savestr(cp);
break;
@ -257,7 +257,7 @@ collect(hp, printheaders)
* Set the Reply-To line.
*/
cp = &linebuf[2];
while (isspace(*cp))
while (isspace((unsigned char)*cp))
cp++;
hp->h_replyto = savestr(cp);
break;
@ -287,7 +287,7 @@ collect(hp, printheaders)
* then open it and copy the contents to collf.
*/
cp = &linebuf[2];
while (isspace(*cp))
while (isspace((unsigned char)*cp))
cp++;
if (*cp == '\0') {
printf("Interpolate what file?\n");
@ -563,7 +563,7 @@ forward(ms, fp, fn, f)
tabst = NULL;
else if ((tabst = value("indentprefix")) == NULL)
tabst = "\t";
ig = isupper(f) ? NULL : ignore;
ig = isupper((unsigned char)f) ? NULL : ignore;
printf("Interpolating:");
for (; *msgvec != 0; msgvec++) {
struct message *mp = message + *msgvec - 1;

View File

@ -115,7 +115,7 @@ edit1(msgvec, type)
size = ftello(otf);
mp->m_block = blockof(size);
mp->m_offset = boffsetof(size);
mp->m_size = fsize(fp);
mp->m_size = (long)fsize(fp);
mp->m_lines = 0;
mp->m_flag |= MODIFY;
rewind(fp);

View File

@ -82,15 +82,15 @@ setptr(ibuf, offset)
msgCount = 0;
} else {
/* Seek into the file to get to the new messages */
(void)fseek(ibuf, offset, SEEK_SET);
(void)fseeko(ibuf, offset, SEEK_SET);
/*
* We need to make "offset" a pointer to the end of
* the temp file that has the copy of the mail file.
* If any messages have been edited, this will be
* different from the offset into the mail file.
*/
(void)fseek(otf, 0L, SEEK_END);
offset = ftell(otf);
(void)fseeko(otf, (off_t)0, SEEK_END);
offset = ftello(otf);
}
omsgCount = msgCount;
maybe = 1;
@ -138,7 +138,7 @@ setptr(ibuf, offset)
} else if (inhead) {
for (cp = linebuf, cp2 = "status";; cp++) {
if ((c = *cp2++) == '\0') {
while (isspace(*cp++))
while (isspace((unsigned char)*cp++))
;
if (cp[-1] != ':')
break;
@ -150,7 +150,7 @@ setptr(ibuf, offset)
inhead = 0;
break;
}
if (*cp != c && *cp != toupper(c))
if (*cp != c && *cp != toupper((unsigned char)c))
break;
}
}
@ -221,7 +221,7 @@ setinput(mp)
(void)fflush(otf);
if (fseeko(itf,
positionof(mp->m_block, mp->m_offset), SEEK_SET) < 0)
err(1, "fseek");
err(1, "fseeko");
return (itf);
}

View File

@ -204,11 +204,11 @@ cmatch(cp, tp)
while (*cp != '\0' && *tp != '\0')
switch (*tp++) {
case 'a':
if (!islower(*cp++))
if (!islower((unsigned char)*cp++))
return (0);
break;
case 'A':
if (!isupper(*cp++))
if (!isupper((unsigned char)*cp++))
return (0);
break;
case ' ':
@ -216,20 +216,20 @@ cmatch(cp, tp)
return (0);
break;
case '0':
if (!isdigit(*cp++))
if (!isdigit((unsigned char)*cp++))
return (0);
break;
case 'O':
if (*cp != ' ' && !isdigit(*cp))
if (*cp != ' ' && !isdigit((unsigned char)*cp))
return (0);
cp++;
break;
case 'p':
if (!ispunct(*cp++))
if (!ispunct((unsigned char)*cp++))
return (0);
break;
case 'P':
if (*cp != ' ' && !ispunct(*cp))
if (*cp != ' ' && !ispunct((unsigned char)*cp))
return (0);
cp++;
break;

View File

@ -143,7 +143,7 @@ setfile(name)
* the mail file, so reset mailsize to be where
* we really are in the file...
*/
mailsize = ftell(ibuf);
mailsize = ftello(ibuf);
(void)Fclose(ibuf);
relsesigs();
sawcom = 0;
@ -162,7 +162,7 @@ setfile(name)
int
incfile()
{
int newsize;
off_t newsize;
int omsgCount = msgCount;
FILE *ibuf;
@ -179,7 +179,7 @@ incfile()
return (0); /* no new mail */
setptr(ibuf, mailsize);
setmsize(msgCount);
mailsize = ftell(ibuf);
mailsize = ftello(ibuf);
(void)Fclose(ibuf);
relsesigs();
return (msgCount - omsgCount);
@ -290,7 +290,7 @@ execute(linebuf, contxt)
* lexical conventions.
*/
for (cp = linebuf; isspace(*cp); cp++)
for (cp = linebuf; isspace((unsigned char)*cp); cp++)
;
if (*cp == '!') {
if (sourcing) {
@ -398,7 +398,7 @@ execute(linebuf, contxt)
* Just the straight string, with
* leading blanks removed.
*/
while (isspace(*cp))
while (isspace((unsigned char)*cp))
cp++;
e = (*com->c_func)(cp);
break;

View File

@ -555,9 +555,9 @@ scan(sp)
* Return TNUMBER when done.
*/
if (isdigit(c)) {
if (isdigit((unsigned char)c)) {
lexnumber = 0;
while (isdigit(c)) {
while (isdigit((unsigned char)c)) {
lexnumber = lexnumber*10 + c - '0';
*cp2++ = c;
c = *cp++;
@ -678,7 +678,7 @@ matchsender(str, mesg)
while (*cp2 != '\0') {
if (*cp == '\0')
return (1);
if (toupper(*cp++) != toupper(*cp2++)) {
if (toupper((unsigned char)*cp++) != toupper((unsigned char)*cp2++)) {
cp2 = ++backup;
cp = str;
}
@ -717,7 +717,7 @@ matchto(str, mesg)
while (*cp2 != '\0') {
if (*cp == '\0')
return (1);
if (toupper(*cp++) != toupper(*cp2++)) {
if (toupper((unsigned char)*cp++) != toupper((unsigned char)*cp2++)) {
cp2 = ++backup;
cp = str;
}
@ -775,7 +775,7 @@ matchsubj(str, mesg)
while (*cp2 != '\0') {
if (*cp == '\0')
return (1);
if (toupper(*cp++) != toupper(*cp2++)) {
if (toupper((unsigned char)*cp++) != toupper((unsigned char)*cp2++)) {
cp2 = ++backup;
cp = str;
}

View File

@ -123,10 +123,10 @@ sendmessage(mp, obuf, doign, prefix)
* Pick up the header field if we have one.
*/
for (cp = line; (c = *cp++) != '\0' && c != ':' &&
!isspace(c);)
!isspace((unsigned char)c);)
;
cp2 = --cp;
while (isspace(*cp++))
while (isspace((unsigned char)*cp++))
;
if (cp[-1] != ':') {
/*