Skip to content

Commit 7add1b6

Browse files
author
jan.nijtmans
committed
Another round of -Wconversion warning fixes, see [03cff7a777]
1 parent ace71ee commit 7add1b6

28 files changed

+416
-381
lines changed

generic/regcomp.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ static void markst(struct subre *);
6464
static void cleanst(struct vars *);
6565
static long nfatree(struct vars *, struct subre *, FILE *);
6666
static long nfanode(struct vars *, struct subre *, FILE *);
67-
static int newlacon(struct vars *, struct state *, struct state *, int);
68-
static void freelacons(struct subre *, int);
67+
static size_t newlacon(struct vars *, struct state *, struct state *, size_t);
68+
static void freelacons(struct subre *, size_t);
6969
static void rfree(regex_t *);
7070
static void dump(regex_t *, FILE *);
7171
static void dumpst(struct subre *, FILE *, int);
@@ -789,11 +789,11 @@ parseqatom(
789789
struct state *s; /* temporaries for new states */
790790
struct state *s2;
791791
#define ARCV(t, val) newarc(v->nfa, t, val, lp, rp)
792-
int m, n;
792+
size_t m, n;
793793
struct subre *atom; /* atom's subtree */
794794
struct subre *t;
795795
int cap; /* capturing parens? */
796-
int pos; /* positive lookahead? */
796+
size_t pos; /* positive lookahead? */
797797
size_t subno; /* capturing-parens or backref number */
798798
int atomtype;
799799
int qprefer; /* quantifier short/long preference */
@@ -1944,16 +1944,16 @@ nfanode(
19441944

19451945
/*
19461946
- newlacon - allocate a lookahead-constraint subRE
1947-
^ static int newlacon(struct vars *, struct state *, struct state *, int);
1947+
^ static size_t newlacon(struct vars *, struct state *, struct state *, size_t);
19481948
*/
1949-
static int /* lacon number */
1949+
static size_t /* lacon number */
19501950
newlacon(
19511951
struct vars *v,
19521952
struct state *begin,
19531953
struct state *end,
1954-
int pos)
1954+
size_t pos)
19551955
{
1956-
int n;
1956+
size_t n;
19571957
struct subre *newlacons;
19581958
struct subre *sub;
19591959

@@ -1988,10 +1988,10 @@ newlacon(
19881988
static void
19891989
freelacons(
19901990
struct subre *subs,
1991-
int n)
1991+
size_t n)
19921992
{
19931993
struct subre *sub;
1994-
int i;
1994+
size_t i;
19951995

19961996
assert(n > 0);
19971997
for (sub=subs+1, i=n-1; i>0; sub++, i--) { /* no 0th */
@@ -2135,7 +2135,7 @@ stdump(
21352135
fprintf(f, " UNUSED");
21362136
}
21372137
if (t->subno != 0) {
2138-
fprintf(f, " (#%d)", t->subno);
2138+
fprintf(f, " (#%" TCL_Z_MODIFIER "d)", t->subno);
21392139
}
21402140
if (t->min != 1 || t->max != 1) {
21412141
fprintf(f, " {%d,", t->min);

generic/regexec.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ subset(
592592
chr *const begin,
593593
chr *const end)
594594
{
595-
int n = sub->subno;
595+
size_t n = sub->subno;
596596

597597
assert(n > 0);
598598
if ((size_t)n >= v->nmatch) {
@@ -874,7 +874,8 @@ cbrdissect(
874874
chr *begin, /* beginning of relevant substring */
875875
chr *end) /* end of same */
876876
{
877-
int n = t->subno, min = t->min, max = t->max;
877+
size_t n = t->subno;
878+
int min = t->min, max = t->max;
878879
size_t numreps;
879880
size_t tlen;
880881
size_t brlen;

generic/regguts.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ struct subre {
364364
#define PREF2(f1, f2) ((PREF(f1) != 0) ? PREF(f1) : PREF(f2))
365365
#define COMBINE(f1, f2) (UP((f1)|(f2)) | PREF2(f1, f2))
366366
short id; /* ID of subre (1..ntree-1) */
367-
int subno; /* subexpression number (for 'b' and '(') */
367+
size_t subno; /* subexpression number (for 'b' and '(') */
368368
short min; /* min repetitions for iteration or backref */
369369
short max; /* max repetitions for iteration or backref */
370370
struct subre *left; /* left child, if any (also freelist chain) */

generic/tclBasic.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5852,7 +5852,7 @@ TclArgumentBCEnter(
58525852
Tcl_Size pc)
58535853
{
58545854
ExtCmdLoc *eclPtr;
5855-
Tcl_Size word;
5855+
int word;
58565856
ECL *ePtr;
58575857
CFWordBC *lastPtr = NULL;
58585858
Interp *iPtr = (Interp *) interp;
@@ -6105,7 +6105,7 @@ TclEvalObjEx(
61056105
* evaluation of the script. Supported values
61066106
* are TCL_EVAL_GLOBAL and TCL_EVAL_DIRECT. */
61076107
const CmdFrame *invoker, /* Frame of the command doing the eval. */
6108-
int word) /* Index of the word which is in objPtr. */
6108+
int word) /* Index of the word which is in objPtr. */
61096109
{
61106110
int result = TCL_OK;
61116111
NRE_callback *rootPtr = TOP_CB(interp);
@@ -6124,7 +6124,7 @@ TclNREvalObjEx(
61246124
* evaluation of the script. Supported values
61256125
* are TCL_EVAL_GLOBAL and TCL_EVAL_DIRECT. */
61266126
const CmdFrame *invoker, /* Frame of the command doing the eval. */
6127-
int word) /* Index of the word which is in objPtr. */
6127+
int word) /* Index of the word which is in objPtr. */
61286128
{
61296129
Interp *iPtr = (Interp *) interp;
61306130
int result;

0 commit comments

Comments
 (0)