aboutsummaryrefslogtreecommitdiff
path: root/toys/pending
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2017-07-07 13:06:36 -0700
committerRob Landley <rob@landley.net>2017-07-09 01:55:17 -0500
commit352efdf18d98be859d19bbae2cd2732d2b7f01cf (patch)
tree2af6bdf89b3e8fe3b523879aa3d827a58e7b76f6 /toys/pending
parent61d0115171681e63366e1321c03ba0ad2d904f6f (diff)
downloadtoybox-352efdf18d98be859d19bbae2cd2732d2b7f01cf.tar.gz
Fix -Wformat compiler warning in expr.c.
Android forces -Wformat on for all source. toys/pending/expr.c:116:28: warning: field precision should have type 'int', but argument has type 'long' [-Wformat] ret->s = xmprintf("%.*s", m[1].rm_eo-m[1].rm_so, target+m[1].rm_so); ~~^~ ~~~~~~~~~~~~~~~~~~~~~
Diffstat (limited to 'toys/pending')
-rw-r--r--toys/pending/expr.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/toys/pending/expr.c b/toys/pending/expr.c
index 743a9536..9e094a75 100644
--- a/toys/pending/expr.c
+++ b/toys/pending/expr.c
@@ -113,7 +113,8 @@ static void re(char *target, char *pattern, struct value *ret)
if (!regexec(&pat, target, 2, m, 0) && !m[0].rm_so) {
// Return first parenthesized subexpression as string, or length of match
if (pat.re_nsub>0) {
- ret->s = xmprintf("%.*s", m[1].rm_eo-m[1].rm_so, target+m[1].rm_so);
+ ret->s = xmprintf("%.*s", (int)(m[1].rm_eo-m[1].rm_so),
+ target+m[1].rm_so);
if (TT.refree) free(TT.refree);
TT.refree = ret->s;
} else assign_int(ret, m[0].rm_eo);