aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/sed
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2018-07-30 18:29:46 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2018-07-30 18:29:46 +0000
commit0649b6706f013d7f4d85d7caf4a2f28d5e7704ad (patch)
tree843f10407fca32297e25cb411ae2a8d50cdbe349 /usr.bin/sed
parent0cd8715680efc602aee300bf9d709dd438fa3147 (diff)
downloadsrc-0649b6706f013d7f4d85d7caf4a2f28d5e7704ad.tar.gz
src-0649b6706f013d7f4d85d7caf4a2f28d5e7704ad.zip
sed: unsign some indexes to fix sign-compare warnings.
Hinted by: OpenBSD (CVS 1.32) MFC after: 1 week
Notes
Notes: svn path=/head/; revision=336926
Diffstat (limited to 'usr.bin/sed')
-rw-r--r--usr.bin/sed/extern.h2
-rw-r--r--usr.bin/sed/process.c16
2 files changed, 9 insertions, 9 deletions
diff --git a/usr.bin/sed/extern.h b/usr.bin/sed/extern.h
index 0dfe38d7eb85..a104c31dcaea 100644
--- a/usr.bin/sed/extern.h
+++ b/usr.bin/sed/extern.h
@@ -41,7 +41,7 @@ extern struct s_appends *appends;
extern regmatch_t *match;
extern size_t maxnsub;
extern u_long linenum;
-extern int appendnum;
+extern unsigned int appendnum;
extern int aflag, eflag, nflag;
extern const char *fname, *outfname;
extern FILE *infile, *outfile;
diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c
index 645e20ff0950..e79d187be35f 100644
--- a/usr.bin/sed/process.c
+++ b/usr.bin/sed/process.c
@@ -79,8 +79,8 @@ static void regsub(SPACE *, char *, char *);
static int substitute(struct s_command *);
struct s_appends *appends; /* Array of pointers to strings to append. */
-static int appendx; /* Index into appends array. */
-int appendnum; /* Size of appends array. */
+static unsigned int appendx; /* Index into appends array. */
+unsigned int appendnum; /* Size of appends array. */
static int lastaddr; /* Set by applies if last address of a range. */
static int sdone; /* If any substitutes since last line input. */
@@ -385,7 +385,7 @@ substitute(struct s_command *cp)
regex_t *re;
regoff_t slen;
int lastempty, n;
- size_t le = 0;
+ regoff_t le = 0;
char *s;
s = ps;
@@ -550,13 +550,13 @@ static void
flush_appends(void)
{
FILE *f;
- int count, i;
+ unsigned int count, idx;
char buf[8 * 1024];
- for (i = 0; i < appendx; i++)
- switch (appends[i].type) {
+ for (idx = 0; idx < appendx; idx++)
+ switch (appends[idx].type) {
case AP_STRING:
- fwrite(appends[i].s, sizeof(char), appends[i].len,
+ fwrite(appends[idx].s, sizeof(char), appends[idx].len,
outfile);
break;
case AP_FILE:
@@ -568,7 +568,7 @@ flush_appends(void)
* would be truly bizarre, but possible. It's probably
* not that big a performance win, anyhow.
*/
- if ((f = fopen(appends[i].s, "r")) == NULL)
+ if ((f = fopen(appends[idx].s, "r")) == NULL)
break;
while ((count = fread(buf, sizeof(char), sizeof(buf), f)))
(void)fwrite(buf, sizeof(char), count, outfile);