summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrlar <rlar>2016-02-29 19:41:04 +0100
committerWill Estes <westes575@gmail.com>2016-02-29 20:16:03 -0500
commitd2c0374297b7dd687a89227f3e77ff3f244da94b (patch)
tree00f90edde731eb4fcee9212fee9220d848a739ba /src
parent0f276adbb23542471bc30a2479e5fcdd5f475d72 (diff)
add (int) casts to some strlen() invocations to prevent warnings
Diffstat (limited to 'src')
-rw-r--r--src/buf.c2
-rw-r--r--src/misc.c2
-rw-r--r--src/scan.l4
-rw-r--r--src/scanopt.c6
-rw-r--r--src/tables.c4
5 files changed, 9 insertions, 9 deletions
diff --git a/src/buf.c b/src/buf.c
index 5cfce60..c03b85f 100644
--- a/src/buf.c
+++ b/src/buf.c
@@ -143,7 +143,7 @@ struct Buf *buf_strnappend (struct Buf *buf, const char *str, int n)
/* Appends characters in str to buf. */
struct Buf *buf_strappend (struct Buf *buf, const char *str)
{
- return buf_strnappend (buf, str, strlen (str));
+ return buf_strnappend (buf, str, (int) strlen (str));
}
/* appends "#define str def\n" */
diff --git a/src/misc.c b/src/misc.c
index 37a52bb..0d93e4b 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -138,7 +138,7 @@ static void action_m4_define (const char *defname, const char * value)
/* Append "new_text" to the running buffer. */
void add_action (const char *new_text)
{
- int len = strlen (new_text);
+ int len = (int) strlen (new_text);
while (len + action_index >= action_size - 10 /* slop */ ) {
int new_size = action_size * 2;
diff --git a/src/scan.l b/src/scan.l
index d2c21b3..59c2c19 100644
--- a/src/scan.l
+++ b/src/scan.l
@@ -272,8 +272,8 @@ M4QEND "]]"
buf_strnappend(&top_buf, yytext, yyleng);
}
- {M4QSTART} buf_strnappend(&top_buf, escaped_qstart, strlen(escaped_qstart));
- {M4QEND} buf_strnappend(&top_buf, escaped_qend, strlen(escaped_qend));
+ {M4QSTART} buf_strnappend(&top_buf, escaped_qstart, (int) strlen(escaped_qstart));
+ {M4QEND} buf_strnappend(&top_buf, escaped_qend, (int) strlen(escaped_qend));
[^{}\r\n] {
buf_strnappend(&top_buf, yytext, yyleng);
diff --git a/src/scanopt.c b/src/scanopt.c
index f173997..d829d0f 100644
--- a/src/scanopt.c
+++ b/src/scanopt.c
@@ -178,7 +178,7 @@ scanopt_t *scanopt_init (const optspec_t *options, int argc, char **argv, int fl
pname = (const unsigned char *)(opt->opt_fmt + 1);
s->has_short = 1;
}
- aux->printlen = strlen (opt->opt_fmt);
+ aux->printlen = (int) strlen (opt->opt_fmt);
aux->namelen = 0;
for (p = pname + 1; *p; p++) {
@@ -359,7 +359,7 @@ int scanopt_usage (scanopt_t *scanner, FILE *fp, const char *usage)
maxlen[0] = len;
/* It's much easier to calculate length for description column! */
- len = strlen (DESC (s, ue->idx));
+ len = (int) strlen (DESC (s, ue->idx));
if (len > maxlen[1])
maxlen[1] = len;
}
@@ -738,7 +738,7 @@ int scanopt (scanopt_t *svoid, char **arg, int *optindex)
arglen = 0;
}
else
- arglen = strlen (optarg);
+ arglen = (int) strlen (optarg);
}
/* At this point, we have a long or short option matched at opt_offset into
diff --git a/src/tables.c b/src/tables.c
index ae2ad9c..ff89b4d 100644
--- a/src/tables.c
+++ b/src/tables.c
@@ -158,12 +158,12 @@ int yytbl_hdr_fwrite (struct yytbl_writer *wr, const struct yytbl_hdr *th)
flex_die (_("th_ssize|th_flags write failed"));
bwritten += 6;
- sz = strlen (th->th_version) + 1;
+ sz = (int) strlen (th->th_version) + 1;
if ((rv = yytbl_writen (wr, th->th_version, sz)) != sz)
flex_die (_("th_version writen failed"));
bwritten += rv;
- sz = strlen (th->th_name) + 1;
+ sz = (int) strlen (th->th_name) + 1;
if ((rv = yytbl_writen (wr, th->th_name, sz)) != sz)
flex_die (_("th_name writen failed"));
bwritten += rv;