summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dircolors.c2
-rw-r--r--src/expr.c8
-rw-r--r--src/factor.c3
-rw-r--r--src/pr.c2
-rw-r--r--src/tr.c2
5 files changed, 10 insertions, 7 deletions
diff --git a/src/dircolors.c b/src/dircolors.c
index d1962eae9..9aaa87fc2 100644
--- a/src/dircolors.c
+++ b/src/dircolors.c
@@ -456,7 +456,7 @@ to select a shell syntax are mutually exclusive"));
if (print_database)
{
char const *p = G_line;
- while (p < G_line + sizeof G_line)
+ while (p - G_line < sizeof G_line)
{
puts (p);
p += strlen (p) + 1;
diff --git a/src/expr.c b/src/expr.c
index ce65ecf46..2331f64fe 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -312,15 +312,17 @@ main (int argc, char **argv)
parse_long_options (argc, argv, PROGRAM_NAME, PACKAGE_NAME, VERSION,
usage, AUTHORS, (char const *) NULL);
+
/* The above handles --help and --version.
Since there is no other invocation of getopt, handle `--' here. */
- if (argc > 1 && STREQ (argv[1], "--"))
+ unsigned int u_argc = argc;
+ if (1 < u_argc && STREQ (argv[1], "--"))
{
- --argc;
+ --u_argc;
++argv;
}
- if (argc <= 1)
+ if (u_argc <= 1)
{
error (0, 0, _("missing operand"));
usage (EXPR_INVALID);
diff --git a/src/factor.c b/src/factor.c
index 3354a4d5b..27843201c 100644
--- a/src/factor.c
+++ b/src/factor.c
@@ -160,7 +160,7 @@ factor_using_pollard_rho (mpz_t n, int a_int)
mpz_t a;
mpz_t g;
mpz_t t1, t2;
- int k, l, c, i;
+ int k, l, c;
debug ("[pollard-rho (%d)] ", a_int);
@@ -204,6 +204,7 @@ S2:
mpz_set (x1, x);
k = l;
l = 2 * l;
+ unsigned int i;
for (i = 0; i < k; i++)
{
mpz_mul (x, x, x); mpz_add (x, x, a); mpz_mod (x, x, n);
diff --git a/src/pr.c b/src/pr.c
index 7e6b13cc8..3995c37ce 100644
--- a/src/pr.c
+++ b/src/pr.c
@@ -1165,7 +1165,7 @@ main (int argc, char **argv)
print_files (n_files, file_names);
else
{
- int i;
+ unsigned int i;
for (i = 0; i < n_files; i++)
print_files (1, &file_names[i]);
}
diff --git a/src/tr.c b/src/tr.c
index 2a729c696..f7593d316 100644
--- a/src/tr.c
+++ b/src/tr.c
@@ -1555,7 +1555,7 @@ squeeze_filter (char *buf, size_t size, size_t (*reader) (char *, size_t))
{
/* A value distinct from any character that may have been stored in a
buffer as the result of a block-read in the function squeeze_filter. */
- enum { NOT_A_CHAR = CHAR_MAX + 1 };
+ const int NOT_A_CHAR = INT_MAX;
int char_to_squeeze = NOT_A_CHAR;
size_t i = 0;