Skip to content

Commit

Permalink
Add casts for conversions to regoff_t.
Browse files Browse the repository at this point in the history
  • Loading branch information
garyhouston committed Feb 26, 2020
1 parent 8ac8a9e commit b9e11f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ int eflags;

/* fill in the details if requested */
if (nmatch > 0) {
pmatch[0].rm_so = m->coldp - m->offp;
pmatch[0].rm_eo = endp - m->offp;
pmatch[0].rm_so = (regoff_t)(m->coldp - m->offp);
pmatch[0].rm_eo = (regoff_t)(endp - m->offp);
}
if (nmatch > 1) {
assert(m->pmatch != NULL);
Expand Down Expand Up @@ -416,12 +416,12 @@ sopno stopst;
case OLPAREN:
i = OPND(m->g->strip[ss]);
assert(0 < i && (size_t) i <= m->g->nsub);
m->pmatch[i].rm_so = sp - m->offp;
m->pmatch[i].rm_so = (regoff_t)(sp - m->offp);
break;
case ORPAREN:
i = OPND(m->g->strip[ss]);
assert(0 < i && (size_t) i <= m->g->nsub);
m->pmatch[i].rm_eo = sp - m->offp;
m->pmatch[i].rm_eo = (regoff_t)(sp - m->offp);
break;
default: /* uh oh */
assert(nope);
Expand Down Expand Up @@ -607,7 +607,7 @@ sopno lev; /* PLUS nesting level */
i = OPND(s);
assert(0 < i && (size_t) i <= m->g->nsub);
offsave = m->pmatch[i].rm_so;
m->pmatch[i].rm_so = sp - m->offp;
m->pmatch[i].rm_so = (regoff_t)(sp - m->offp);
dp = backref(m, sp, stop, ss+1, stopst, lev);
if (dp != NULL)
return(dp);
Expand All @@ -618,7 +618,7 @@ sopno lev; /* PLUS nesting level */
i = OPND(s);
assert(0 < i && (size_t) i <= m->g->nsub);
offsave = m->pmatch[i].rm_eo;
m->pmatch[i].rm_eo = sp - m->offp;
m->pmatch[i].rm_eo = (regoff_t)(sp - m->offp);
dp = backref(m, sp, stop, ss+1, stopst, lev);
if (dp != NULL)
return(dp);
Expand Down
4 changes: 2 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ int opts; /* may not match f1 */
if (options('e', f1)&REG_STARTEND) {
if (strchr(f2, '(') == NULL || strchr(f2, ')') == NULL)
fprintf(stderr, "%d: bad STARTEND syntax\n", line);
subs[0].rm_so = strchr(f2, '(') - f2 + 1;
subs[0].rm_eo = strchr(f2, ')') - f2;
subs[0].rm_so = (regoff_t)(strchr(f2, '(') - f2 + 1);
subs[0].rm_eo = (regoff_t)(strchr(f2, ')') - f2);
}
err = regexec(&re, f2copy, NSUBS, subs, options('e', f1));

Expand Down

0 comments on commit b9e11f4

Please sign in to comment.