diff --git a/src/ChangeLog b/src/ChangeLog index 98edc3fc82b35bf80ed27ded624bc97f44c77ec0..10bff0e1acc4cd810a85f19a40e39d74fd84269c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,8 +1,7 @@ 2008-11-18 Larry Jones <lawrence.jones@siemens.com> - commit.c, update.c: Fix gcc -Wall warnings. - -2008-11-18 Larry Jones <lawrence.jones@siemens.com> + * client.c commit.c, history.c, logmsg.c, rcs.c, repos.c, tag.c, + update.c, vers_ts.c: Fix gcc -Wall warnings. * sanity.sh: Fix nonportable ``date +%s'' test. diff --git a/src/client.c b/src/client.c index 95fc81fda7c3cc969aef442a246b0a9debccc54f..b0c4ac5d496fd1ee19db53a5b6abd725bd5e8301 100644 --- a/src/client.c +++ b/src/client.c @@ -812,7 +812,7 @@ call_in_directory (const char *pathname, if (!*pathname /* or PATHNAME == "./" */ - || pathname[0] == '.' && ISSLASH (pathname[1]) && !pathname[2]) + || (pathname[0] == '.' && ISSLASH (pathname[1]) && !pathname[2])) { /* Old servers always send a trailing '/' on PATHNAME and normalize an * UPDATE_DIR of "" or "." to "./". We have to assume something in @@ -845,8 +845,7 @@ call_in_directory (const char *pathname, pdir = dir_name (dir); if (!STREQ (pdir, ".") /* Make an exception for the top level directory. */ - && (!STREQ (cvs_cmd_name, "export") && !hasAdmin (pdir) - || STREQ (cvs_cmd_name, "export") && !isdir (pdir))) + && !(STREQ (cvs_cmd_name, "export") ? isdir (pdir) : hasAdmin (pdir))) error (1, 0, "cannot create directory %s outside working directory", quote (dir)); @@ -2116,7 +2115,6 @@ client_base_checkout (void *data_arg, const struct file_info *finfo) /* The base file to be created. */ char *basefile; - char *update_dir; char *fullbase; /* File buf from net. May be an RCS diff from PREV to REV. */ diff --git a/src/history.c b/src/history.c index 734f38a0eeabe4cfe9cbe5ad1d881a25054be4bf..faea399044ddcfe22f3c28c77334af6bc0b7b1fa 100644 --- a/src/history.c +++ b/src/history.c @@ -1111,7 +1111,7 @@ fill_hrec (const char *source_file_name, long source_line_num, line = cp + 1; NEXT_BAR (user); NEXT_BAR (dir); - if (cp = strrchr (hr->dir, '*')) + if ((cp = strrchr (hr->dir, '*')) != NULL) { *cp++ = '\0'; hr->end = line + strtoul (cp, NULL, 16); @@ -1160,7 +1160,7 @@ done_reading: default: if (!really_quiet && !warned_version) { - error (0, 0, "unrecognized history record version: %ul", + error (0, 0, "unrecognized history record version: %lu", hr->version); warned_version = true; } @@ -1576,7 +1576,7 @@ report_hrecs (void) { struct hrec *hr, *lr; struct tm *tm; - int i, count, ty; + int count, ty; char *cp; int user_len, file_len, rev_len, mod_len, repos_len; @@ -1615,7 +1615,7 @@ report_hrecs (void) user_len = MAX (user_len, strlen (lr->user)); if (ty != 'T') { - if (cp = strrchr (repos, '/')) + if ((cp = strrchr (repos, '/')) != NULL) { if (lr->mod && STREQ (++cp, lr->mod)) strcpy (cp, "*"); @@ -1663,14 +1663,14 @@ report_hrecs (void) workdir = xmalloc (strlen (lr->dir) + strlen (lr->end) + 10); sprintf (workdir, "%s%s", lr->dir, lr->end); - if (cp = strrchr (workdir, '/')) + if ((cp = strrchr (workdir, '/')) != NULL) { if (lr->mod && STREQ (++cp, lr->mod)) strcpy (cp, "*"); } repos = xmalloc (strlen (lr->repos) + 10); strcpy (repos, lr->repos); - if (cp = strrchr (repos, '/')) + if ((cp = strrchr (repos, '/')) != NULL) { if (lr->mod && STREQ (++cp, lr->mod)) strcpy (cp, "*"); diff --git a/src/logmsg.c b/src/logmsg.c index e89ca2b12b1fb00f3678b24ee1c4d58cd8607ad3..4b9bd486a926c666eb42d9c7e977d16e58bb4c70 100644 --- a/src/logmsg.c +++ b/src/logmsg.c @@ -208,11 +208,11 @@ rcsinfo_proc (const char *repository, const char *template, if ((tfp = CVS_FOPEN (template, "r")) != NULL) { - char *line = NULL; - size_t line_chars_allocated = 0; + char *buff = NULL; + size_t buff_chars_allocated = 0; - while (getline (&line, &line_chars_allocated, tfp) >= 0) - (void) fputs (line, fp); + while (getline (&buff, &buff_chars_allocated, tfp) >= 0) + (void) fputs (buff, fp); if (ferror (tfp)) error (0, errno, "%s:%d: warning: cannot read %s", file, line, quote (template)); @@ -220,8 +220,8 @@ rcsinfo_proc (const char *repository, const char *template, error (0, errno, "%s:%d: warning: cannot close %s", file, line, quote (template)); - if (line) - free (line); + if (buff) + free (buff); return (0); } else @@ -350,8 +350,8 @@ do_editor (const char *update_dir, char **messagep, const char *repository, /* run the editor */ run_setup (Editor); run_add_arg (fname); - if (retcode = run_exec (RUN_TTY, RUN_TTY, RUN_TTY, - RUN_NORMAL | RUN_SIGIGNORE)) + if ((retcode = run_exec (RUN_TTY, RUN_TTY, RUN_TTY, + RUN_NORMAL | RUN_SIGIGNORE)) != 0) error (0, retcode == -1 ? errno : 0, "warning: editor session failed"); /* put the entire message back into the *messagep variable */ @@ -630,8 +630,8 @@ do_verify (char **messagep, const char *repository, List *changes) data.message = *messagep; data.fname = NULL; data.changes = changes; - if (err = Parse_Info (CVSROOTADM_VERIFYMSG, repository, - verifymsg_proc, 0, &data)) + if ((err = Parse_Info (CVSROOTADM_VERIFYMSG, repository, + verifymsg_proc, 0, &data)) != 0) { int saved_errno = errno; /* Since following error() exits, delete the temp file now. */ diff --git a/src/rcs.c b/src/rcs.c index 4a6e979671ac43bec5e04bb4f50c55270c04b2bd..a23403e4cfff98f1e185d0fa9c2cd5c972b18b9e 100644 --- a/src/rcs.c +++ b/src/rcs.c @@ -300,7 +300,7 @@ RCS_parse (const char *file, const char *repos) { /* Handle the error cases */ } - else if (fp = CVS_FOPEN (rcsfile, FOPEN_BINARY_READ)) + else if ((fp = CVS_FOPEN (rcsfile, FOPEN_BINARY_READ)) != NULL) { rcs = RCS_parsercsfile_i (fp, rcsfile); if (rcs) diff --git a/src/repos.c b/src/repos.c index 23ae3930b9e74548ae714fffa407728312db520f..f013cba76bf4d77962d22a9dd1e15b548207d57f 100644 --- a/src/repos.c +++ b/src/repos.c @@ -101,7 +101,7 @@ Name_Repository (const char *dir, const char *update_dir) error (0, errno, "cannot close %s", quote (tmp)); free (tmp); - if (cp = strrchr (repos, '\n')) + if ((cp = strrchr (repos, '\n')) != NULL) *cp = '\0'; /* strip the newline */ /* If this is a relative repository pathname, turn it into an absolute @@ -202,7 +202,7 @@ Sanitize_Repository_Name (char *repository) * Paths with a leading "//" are special on some early UNIXes. */ if (strlen (repository) == 2 - || strlen (repository) == 3 && ISSLASH (*repository)) + || (strlen (repository) == 3 && ISSLASH (*repository))) repository[strlen (repository) - 1] = '\0'; else repository[strlen (repository) - 2] = '\0'; diff --git a/src/tag.c b/src/tag.c index 4b8caa31924d14f09297886359fb509c6c5a08e6..691039b7941e01b66c5814b755675048e76b3e24 100644 --- a/src/tag.c +++ b/src/tag.c @@ -727,7 +727,7 @@ pretag_proc (const char *repository, const char *filter, const char *srepos = Short_Repository (repository); struct pretag_proc_data *ppd = closure; - TRACE (TRACE_FUNCTION, "pretag_proc (%s, %s, %s, %s)", + TRACE (TRACE_FUNCTION, "pretag_proc (%s, %s, %s, %d)", repository, filter, file, line); #ifdef SUPPORT_OLD_INFO_FMT_STRINGS diff --git a/src/update.c b/src/update.c index 94fb1ee7f642c54c3e45cd3f1ee6d16842577f93..2942308f904dcf8d2e7ac871afb9662b20646bbf 100644 --- a/src/update.c +++ b/src/update.c @@ -1029,7 +1029,7 @@ static int update_dirleave_proc (void *callerdat, const char *dir, int err, const char *update_dir, List *entries) { - TRACE (TRACE_FLOW, "update_dirleave_proc (%s, %d, %d)", + TRACE (TRACE_FLOW, "update_dirleave_proc (%s, %d, %s)", dir, err, update_dir); /* Delete the ignore list if it hasn't already been done. */ diff --git a/src/vers_ts.c b/src/vers_ts.c index e6c2d9af97fc3ca8ec138bb6b281cef9accc92ec..758346b088f056468191fd64cd18baa412e6a184 100644 --- a/src/vers_ts.c +++ b/src/vers_ts.c @@ -297,7 +297,6 @@ static void time_stamp_server (const char *file, Vers_TS *vers_ts, Entnode *entdata) { struct stat sb; - char *cp; TRACE (TRACE_FUNCTION, "time_stamp_server (%s, %s, %s, %s)", file,