Index: checkout.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/checkout.c,v retrieving revision 1.66 diff -u -r1.66 checkout.c --- checkout.c 7 Jul 2006 17:37:17 -0000 1.66 +++ checkout.c 18 Jul 2006 10:42:12 -0000 @@ -270,7 +270,7 @@ cvs_remote_output("u=rw,g=rw,o=rw"); /* XXX */ - printf("%ld\n", cvs_buf_len(nbp)); + printf("%zd\n", cvs_buf_len(nbp)); if (cvs_buf_write_fd(nbp, STDOUT_FILENO) == -1) fatal("cvs_checkout_file: failed to send file"); Index: client.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/client.c,v retrieving revision 1.13 diff -u -r1.13 client.c --- client.c 9 Jul 2006 04:39:43 -0000 1.13 +++ client.c 18 Jul 2006 10:42:12 -0000 @@ -511,10 +511,10 @@ size_t flen; CVSENTRIES *ent; struct cvs_ent *e; - const char *errstr; struct timeval tv[2]; char timebuf[32], *repo, *rpath, *entry, *mode; - char revbuf[32], *len, *fpath, *wdir; + char revbuf[32], *len, *fpath, *wdir, *p; + long tmp; client_check_directory(data); @@ -534,9 +534,10 @@ fatal("cvs_client_updated: dirname: %s", strerror(errno)); xfree(repo); - flen = strtonum(len, 0, INT_MAX, &errstr); - if (errstr != NULL) - fatal("cvs_client_updated: %s: %s", len, errstr); + tmp = strtol(len, &p, 10); + if (len == p || tmp < 0 || tmp > INT_MAX) + fatal("cvs_client_updated: xxx"); + flen = (size_t)tmp; xfree(len); cvs_strtomode(mode, &fmode); Index: cmd.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/cmd.c,v retrieving revision 1.52 diff -u -r1.52 cmd.c --- cmd.c 7 Jul 2006 17:37:17 -0000 1.52 +++ cmd.c 18 Jul 2006 10:42:12 -0000 @@ -102,7 +102,7 @@ cmdp = NULL; for (i = 0; cvs_cdt[i] != NULL; i++) - if (cvs_cdt[i]->cmd_req == reqid) { + if (cvs_cdt[i]->cmd_req == (u_int)reqid) { cmdp = cvs_cdt[i]; break; } Index: commit.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/commit.c,v retrieving revision 1.81 diff -u -r1.81 commit.c --- commit.c 8 Jul 2006 09:25:44 -0000 1.81 +++ commit.c 18 Jul 2006 10:42:12 -0000 @@ -188,6 +188,8 @@ CVSENTRIES *entlist; char *attic, *repo, *rcsfile; + d = NULL; /* shutup gcc warning */ + cvs_log(LP_TRACE, "cvs_commit_local(%s)", cf->file_path); cvs_file_classify(cf, NULL, 0); Index: config.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/config.c,v retrieving revision 1.4 diff -u -r1.4 config.c --- config.c 16 Jun 2006 14:07:42 -0000 1.4 +++ config.c 18 Jul 2006 10:42:13 -0000 @@ -29,8 +29,8 @@ FILE *fp; size_t len; struct rlimit rl; - const char *errstr; char *p, *buf, *lbuf, *opt, *val, fpath[MAXPATHLEN]; + long tmp; cvs_log(LP_TRACE, "cvs_parse_configfile()"); @@ -72,17 +72,16 @@ if (!strcmp(opt, "tag")) { cvs_tagname = xstrdup(val); } else if (!strcmp(opt, "umask")) { - cvs_umask = (int)strtonum(val, 0, INT_MAX, &errstr); - if (errstr != NULL) - fatal("cvs_parse_configfile: %s: %s", val, - errstr); + tmp = strtol(val, &p, 10); + if (val == p || tmp < 0 || tmp > INT_MAX) + fatal("cvs_parse_configfile: xxx"); + cvs_umask = (int)tmp; } else if (!strcmp(opt, "dlimit")) { if (getrlimit(RLIMIT_DATA, &rl) != -1) { - rl.rlim_cur = (int)strtonum(val, 0, INT_MAX, - &errstr); - if (errstr != NULL) - fatal("cvs_parse_configfile: %s: %s", - val, errstr); + tmp = strtol(val, &p, 10); + if (val == p || tmp < 0 || tmp > INT_MAX) + fatal("cvs_parse_configfile: xxx"); + rl.rlim_cur = (int)tmp; rl.rlim_cur = rl.rlim_cur * 1024; (void)setrlimit(RLIMIT_DATA, &rl); } Index: cvs.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/cvs.c,v retrieving revision 1.107 diff -u -r1.107 cvs.c --- cvs.c 9 Jul 2006 01:57:51 -0000 1.107 +++ cvs.c 18 Jul 2006 10:42:13 -0000 @@ -487,7 +487,7 @@ /* sanity check on the name */ for (cp = var; *cp != '\0'; cp++) - if (!isalnum(*cp) && (*cp != '_')) { + if (!isalnum((int)*cp) && (*cp != '_')) { cvs_log(LP_ERR, "variable name `%s' contains invalid characters", var); Index: date.y =================================================================== RCS file: /cvs/src/usr.bin/cvs/date.y,v retrieving revision 1.13 diff -u -r1.13 date.y --- date.y 3 May 2006 14:26:13 -0000 1.13 +++ date.y 18 Jul 2006 10:42:17 -0000 @@ -485,7 +485,7 @@ { char *str; - if (isspace(yyInput[0]) || !isprint(yyInput[0])) + if (isspace((int)yyInput[0]) || !isprint((int)yyInput[0])) (void)xasprintf(&str, "%s: unexpected char 0x%02x in date string", s, yyInput[0]); else @@ -639,8 +639,8 @@ /* Make it lowercase. */ for (p = buff; *p; p++) - if (isupper(*p)) - *p = tolower(*p); + if (isupper((int)*p)) + *p = tolower((int)*p); if (strcmp(buff, "am") == 0 || strcmp(buff, "a.m.") == 0) { yylval.Meridian = MERam; @@ -706,7 +706,7 @@ } /* Military timezones. */ - if (buff[1] == '\0' && isalpha(*buff)) { + if (buff[1] == '\0' && isalpha((int)*buff)) { for (tp = MilitaryTable; tp->name; tp++) if (strcmp(buff, tp->name) == 0) { yylval.Number = tp->value; @@ -739,20 +739,20 @@ int count, sign; for (;;) { - while (isspace(*yyInput)) + while (isspace((int)*yyInput)) yyInput++; - if (isdigit(c = *yyInput) || c == '-' || c == '+') { + if (isdigit((int)(c = *yyInput)) || c == '-' || c == '+') { if (c == '-' || c == '+') { sign = c == '-' ? -1 : 1; - if (!isdigit(*++yyInput)) + if (!isdigit((int)*++yyInput)) /* skip the '-' sign */ continue; } else sign = 0; - for (yylval.Number = 0; isdigit(c = *yyInput++); ) + for (yylval.Number = 0; isdigit((int)(c = *yyInput++)); ) yylval.Number = 10 * yylval.Number + c - '0'; yyInput--; if (sign < 0) @@ -760,8 +760,8 @@ return sign ? tSNUMBER : tUNUMBER; } - if (isalpha(c)) { - for (p = buff; isalpha(c = *yyInput++) || c == '.'; ) + if (isalpha((int)c)) { + for (p = buff; isalpha((int)(c = *yyInput++)) || c == '.'; ) if (p < &buff[sizeof buff - 1]) *p++ = c; *p = '\0'; @@ -814,6 +814,10 @@ struct tm gmt, *gmt_ptr, *tm; struct timeb ftz, *now; time_t Start, tod, nowtime; + + /* shutup gcc warning. */ + memset(&gmt, 0, sizeof(gmt)); + memset(&ftz, 0, sizeof(ftz)); yyInput = p; Index: diff.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/diff.c,v retrieving revision 1.109 diff -u -r1.109 diff.c --- diff.c 8 Jul 2006 09:25:44 -0000 1.109 +++ diff.c 18 Jul 2006 10:42:17 -0000 @@ -159,6 +159,10 @@ struct timeval tv[2], tv2[2]; char rbuf[16], p1[MAXPATHLEN], p2[MAXPATHLEN]; + /* shutup gcc warning. */ + r1 = NULL; + b1 = b2 = NULL; + cvs_log(LP_TRACE, "cvs_diff_local(%s)", cf->file_path); if (cf->file_type == CVS_DIR) { Index: diff_internals.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/diff_internals.c,v retrieving revision 1.3 diff -u -r1.3 diff_internals.c --- diff_internals.c 7 Jul 2006 17:37:17 -0000 1.3 +++ diff_internals.c 18 Jul 2006 10:42:18 -0000 @@ -1156,7 +1156,7 @@ rewind(f); cnt = fread(buf, (size_t)1, sizeof(buf), f); for (i = 0; i < cnt; i++) - if (!isprint(buf[i]) && !isspace(buf[i])) + if (!isprint((int)buf[i]) && !isspace((int)buf[i])) return (0); return (1); } Index: entries.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/entries.c,v retrieving revision 1.61 diff -u -r1.61 entries.c --- entries.c 9 Jul 2006 01:47:20 -0000 1.61 +++ entries.c 18 Jul 2006 10:42:18 -0000 @@ -202,6 +202,8 @@ FILE *fp; struct cvs_ent_line *l; + fp = NULL; /* shutup gcc warning. */ + if (writefile) { if ((fp = fopen(ep->cef_bpath, "w")) == NULL) fatal("cvs_ent_close: failed to write %s", Index: file.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/file.c,v retrieving revision 1.162 diff -u -r1.162 file.c --- file.c 7 Jul 2006 17:37:17 -0000 1.162 +++ file.c 18 Jul 2006 10:42:18 -0000 @@ -348,7 +348,6 @@ FILE *fp; int nbytes; size_t len; - long base; size_t bufsize; struct stat st; struct dirent *dp; @@ -359,6 +358,8 @@ CVSENTRIES *entlist; char *buf, *ebuf, *cp, *repo, *fpath; + repo = NULL; /* shutup gcc warning. */ + cvs_log(LP_TRACE, "cvs_file_walkdir(%s)", cf->file_path); if (cr->enterdir != NULL) @@ -419,7 +420,7 @@ TAILQ_INIT(&fl); TAILQ_INIT(&dl); - while ((nbytes = getdirentries(cf->fd, buf, bufsize, &base)) > 0) { + while ((nbytes = getdents(cf->fd, buf, bufsize)) > 0) { ebuf = buf + nbytes; cp = buf; Index: rcs.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/rcs.c,v retrieving revision 1.185 diff -u -r1.185 rcs.c --- rcs.c 8 Jul 2006 09:25:44 -0000 1.185 +++ rcs.c 18 Jul 2006 10:42:23 -0000 @@ -863,11 +863,11 @@ ret = 1; cp = sym; - if (!isalpha(*cp++)) + if (!isalpha((int)*cp++)) return (0); for (; *cp != '\0'; cp++) - if (!isgraph(*cp) || (strchr(rcs_sym_invch, *cp) != NULL)) { + if (!isgraph((int)*cp) || (strchr(rcs_sym_invch, *cp) != NULL)) { ret = 0; break; } @@ -1178,6 +1178,8 @@ struct rcs_delta *hrdp, *trdp, *rdp; char *data; + trdp = NULL; /* shutup gcc warning. */ + if ((hrdp = rcs_findrev(rfp, rfp->rf_head)) == NULL) fatal("rcs_getrev: no HEAD revision"); @@ -1226,7 +1228,8 @@ cvs_buf_putc(rcsbuf, '\0'); data = cvs_buf_release(rcsbuf); - rcsbuf = cvs_patchfile(data, rdp->rd_text, rcs_patch_lines); + rcsbuf = cvs_patchfile((const char *)data, + (const char *)rdp->rd_text, rcs_patch_lines); if (rcsbuf == NULL) fatal("rcs_getrev: failed to apply rcsdiff"); xfree(data); @@ -1247,7 +1250,7 @@ TAILQ_FOREACH(brp, &(rdp->rd_branches), rb_list) { found = 1; - for (i = 0; i < nextroot - 1; i++) { + for (i = 0; (int)i < nextroot - 1; i++) { if (brp->rb_num->rn_id[i] != bnum->rn_id[i]) { found = 0; break; @@ -1348,7 +1351,7 @@ rcsnum_cpy(rdp->rd_num, brp->rb_num, 0); TAILQ_INSERT_TAIL(&(rdp->rd_branches), brp, rb_list); - ordp = TAILQ_PREV(rdp, cvs_tqh, rd_list); + ordp = (void *)TAILQ_PREV(rdp, cvs_tqh, rd_list); rcsnum_cpy(rdp->rd_num, ordp->rd_next, 0); } else { ordp = TAILQ_NEXT(rdp, rd_list); @@ -2103,7 +2106,7 @@ } rdp->rd_text = xmalloc(RCS_TOKLEN(rfp) + 1); - if (strlcpy(rdp->rd_text, RCS_TOKSTR(rfp), (RCS_TOKLEN(rfp) + 1)) >= + if (strlcpy((char *)rdp->rd_text, RCS_TOKSTR(rfp), (RCS_TOKLEN(rfp) + 1)) >= RCS_TOKLEN(rfp) + 1) fatal("rcs_parse_deltatext: strlcpy"); rdp->rd_tlen = RCS_TOKLEN(rfp); @@ -2599,7 +2602,7 @@ /* first following character has to be alphanumeric */ c++; - if (!isalpha(*c)) { + if (!isalpha((int)*c)) { c = start; continue; } Index: rcsnum.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/rcsnum.c,v retrieving revision 1.38 diff -u -r1.38 rcsnum.c --- rcsnum.c 31 May 2006 18:24:55 -0000 1.38 +++ rcsnum.c 18 Jul 2006 10:42:27 -0000 @@ -228,7 +228,7 @@ nump->rn_id[0] = 0; for (sp = str;; sp++) { - if (!isdigit(*sp) && (*sp != '.')) + if (!isdigit((int)*sp) && (*sp != '.')) break; if (*sp == '.') { Index: remote.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/remote.c,v retrieving revision 1.4 diff -u -r1.4 remote.c --- remote.c 10 Jul 2006 01:32:32 -0000 1.4 +++ remote.c 18 Jul 2006 10:42:27 -0000 @@ -119,7 +119,7 @@ data = xmalloc(len); ret = fread(data, sizeof(char), len, in); if (ret != len) - fatal("length mismatch, expected %ld, got %ld", + fatal("length mismatch, expected %zd, got %zd", len, ret); cvs_buf_set(bp, data, len, 0); xfree(data); @@ -163,7 +163,7 @@ if (fcont != NULL) { ret = fwrite(fcont, sizeof(char), st.st_size, out); if (ret != st.st_size) - fatal("tried to write %lld only wrote %ld", + fatal("tried to write %lld only wrote %zd", st.st_size, ret); xfree(fcont); } Index: server.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/server.c,v retrieving revision 1.30 diff -u -r1.30 server.c --- server.c 9 Jul 2006 01:47:20 -0000 1.30 +++ server.c 18 Jul 2006 10:42:27 -0000 @@ -285,8 +285,8 @@ int fd, l; size_t flen; mode_t fmode; - const char *errstr; - char *mode, *len, *fpath; + char *mode, *len, *fpath, *p; + long tmp; mode = cvs_remote_input(); len = cvs_remote_input(); @@ -294,9 +294,10 @@ cvs_strtomode(mode, &fmode); xfree(mode); - flen = strtonum(len, 0, INT_MAX, &errstr); - if (errstr != NULL) - fatal("cvs_server_modified: %s", errstr); + tmp = strtol(len, &p, 10); + if (len == p || tmp < 0 || tmp > INT_MAX) + fatal("cvs_server_modified: invalid format"); + flen = (size_t)tmp; xfree(len); bp = cvs_remote_receive_file(flen); Index: update.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/update.c,v retrieving revision 1.80 diff -u -r1.80 update.c --- update.c 7 Jul 2006 17:37:17 -0000 1.80 +++ update.c 18 Jul 2006 10:42:27 -0000 @@ -170,7 +170,6 @@ void cvs_update_leavedir(struct cvs_file *cf) { - long base; int nbytes; int isempty, l; size_t bufsize; @@ -213,7 +212,7 @@ if (lseek(cf->fd, 0, SEEK_SET) == -1) fatal("cvs_update_leavedir: %s", strerror(errno)); - while ((nbytes = getdirentries(cf->fd, buf, bufsize, &base)) > 0) { + while ((nbytes = getdents(cf->fd, buf, bufsize)) > 0) { ebuf = buf + nbytes; cp = buf; Index: util.c =================================================================== RCS file: /cvs/src/usr.bin/cvs/util.c,v retrieving revision 1.90 diff -u -r1.90 util.c --- util.c 9 Jul 2006 01:47:20 -0000 1.90 +++ util.c 18 Jul 2006 10:42:28 -0000 @@ -672,7 +672,7 @@ fatal("cvs_mkadmin: %s: %s", buf, strerror(errno)); (void)fclose(fp); - cvs_write_tagfile(path, tag, date, nb); + cvs_write_tagfile(__UNCONST(path), tag, date, nb); } void @@ -876,6 +876,7 @@ RCSNUM *lnum, *rnum; nrev = 0; + lstr = rstr = NULL; /* shutup gcc warning. */ lnum = rnum = NULL; revargv = cvs_strsplit(range, ",");