diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c index c414b62..f343047 100644 --- a/src/pcre2_compile.c +++ b/src/pcre2_compile.c @@ -5494,6 +5494,7 @@ for (;; pptr++) BOOL possessive_quantifier; BOOL note_group_empty; int class_has_8bitchar; + int i; uint32_t mclength; uint32_t skipunits; uint32_t subreqcu, subfirstcu; @@ -5868,9 +5869,9 @@ for (;; pptr++) if (taboffset >= 0) { if (tabopt >= 0) - for (int i = 0; i < 32; i++) pbits[i] |= cbits[(int)i + taboffset]; + for (i = 0; i < 32; i++) pbits[i] |= cbits[(int)i + taboffset]; else - for (int i = 0; i < 32; i++) pbits[i] &= ~cbits[(int)i + taboffset]; + for (i = 0; i < 32; i++) pbits[i] &= ~cbits[(int)i + taboffset]; } /* Now see if we need to remove any special characters. An option @@ -5884,9 +5885,9 @@ for (;; pptr++) being built and we are done. */ if (local_negate) - for (int i = 0; i < 32; i++) classbits[i] |= (uint8_t)(~pbits[i]); + for (i = 0; i < 32; i++) classbits[i] |= (uint8_t)(~pbits[i]); else - for (int i = 0; i < 32; i++) classbits[i] |= pbits[i]; + for (i = 0; i < 32; i++) classbits[i] |= pbits[i]; /* Every class contains at least one < 256 character. */ @@ -5925,22 +5926,22 @@ for (;; pptr++) switch(escape) { case ESC_d: - for (int i = 0; i < 32; i++) classbits[i] |= cbits[i+cbit_digit]; + for (i = 0; i < 32; i++) classbits[i] |= cbits[i+cbit_digit]; break; case ESC_D: should_flip_negation = TRUE; - for (int i = 0; i < 32; i++) + for (i = 0; i < 32; i++) classbits[i] |= (uint8_t)(~cbits[i+cbit_digit]); break; case ESC_w: - for (int i = 0; i < 32; i++) classbits[i] |= cbits[i+cbit_word]; + for (i = 0; i < 32; i++) classbits[i] |= cbits[i+cbit_word]; break; case ESC_W: should_flip_negation = TRUE; - for (int i = 0; i < 32; i++) + for (i = 0; i < 32; i++) classbits[i] |= (uint8_t)(~cbits[i+cbit_word]); break; @@ -5952,12 +5953,12 @@ for (;; pptr++) longer treat \s and \S specially. */ case ESC_s: - for (int i = 0; i < 32; i++) classbits[i] |= cbits[i+cbit_space]; + for (i = 0; i < 32; i++) classbits[i] |= cbits[i+cbit_space]; break; case ESC_S: should_flip_negation = TRUE; - for (int i = 0; i < 32; i++) + for (i = 0; i < 32; i++) classbits[i] |= (uint8_t)(~cbits[i+cbit_space]); break; @@ -6199,7 +6200,7 @@ for (;; pptr++) if (negate_class && !xclass_has_prop) { /* Using 255 ^ instead of ~ avoids clang sanitize warning. */ - for (int i = 0; i < 32; i++) classbits[i] = 255 ^ classbits[i]; + for (i = 0; i < 32; i++) classbits[i] = 255 ^ classbits[i]; } memcpy(code, classbits, 32); code = class_uchardata + (32 / sizeof(PCRE2_UCHAR)); @@ -6225,7 +6226,7 @@ for (;; pptr++) if (negate_class) { /* Using 255 ^ instead of ~ avoids clang sanitize warning. */ - for (int i = 0; i < 32; i++) classbits[i] = 255 ^ classbits[i]; + for (i = 0; i < 32; i++) classbits[i] = 255 ^ classbits[i]; } memcpy(code, classbits, 32); } @@ -6299,7 +6300,7 @@ for (;; pptr++) verbarglen = *(++pptr); verbculen = 0; tempcode = code++; - for (int i = 0; i < (int)verbarglen; i++) + for (i = 0; i < (int)verbarglen; i++) { meta = *(++pptr); #ifdef SUPPORT_UNICODE @@ -6772,6 +6773,7 @@ for (;; pptr++) BOOL is_dupname = FALSE; named_group *ng = cb->named_groups; uint32_t length = *(++pptr); + unsigned int i; GETPLUSOFFSET(offset, pptr); name = cb->start_pattern + offset; @@ -6782,7 +6784,7 @@ for (;; pptr++) this name is duplicated. */ groupnumber = 0; - for (unsigned int i = 0; i < cb->names_found; i++, ng++) + for (i = 0; i < cb->names_found; i++, ng++) { if (length == ng->length && PRIV(strncmp)(name, ng->name, length) == 0) @@ -7141,7 +7143,7 @@ for (;; pptr++) *lengthptr += delta; } - else for (int i = 0; i < replicate; i++) + else for (i = 0; i < replicate; i++) { memcpy(code, previous, CU2BYTES(1 + LINK_SIZE)); previous = code; @@ -7317,12 +7319,13 @@ for (;; pptr++) else { + uint32_t i; if (groupsetfirstcu && reqcuflags >= REQ_NONE) { reqcu = firstcu; reqcuflags = firstcuflags; } - for (uint32_t i = 1; i < repeat_min; i++) + for (i = 1; i < repeat_min; i++) { memcpy(code, previous, CU2BYTES(len)); code += len; @@ -7342,6 +7345,7 @@ for (;; pptr++) if (repeat_max != REPEAT_UNLIMITED) { + uint32_t i; /* In the pre-compile phase, we don't actually do the replication. We just adjust the length as if we had. For each repetition we must add 1 to the length for BRAZERO and for all but the last repetition we @@ -7366,7 +7370,7 @@ for (;; pptr++) /* This is compiling for real */ - else for (uint32_t i = repeat_max; i >= 1; i--) + else for (i = repeat_max; i >= 1; i--) { *code++ = OP_BRAZERO + repeat_type; diff --git a/src/pcre2_printint.c b/src/pcre2_printint.c index 3b6a07d..46b9038 100644 --- a/src/pcre2_printint.c +++ b/src/pcre2_printint.c @@ -244,8 +244,9 @@ int count = 0; const char *yield = "??"; size_t len = 0; unsigned int ptypex = (ptype == PT_SC)? PT_SCX : ptype; +int i; -for (int i = PRIV(utt_size) - 1; i >= 0; i--) +for (i = PRIV(utt_size) - 1; i >= 0; i--) { const ucp_type_table *u = PRIV(utt) + i; diff --git a/src/pcre2_script_run.c b/src/pcre2_script_run.c index 4926fa6..6d7e830 100644 --- a/src/pcre2_script_run.c +++ b/src/pcre2_script_run.c @@ -90,6 +90,7 @@ uint32_t require_map[FULL_MAPSIZE]; uint32_t map[FULL_MAPSIZE]; uint32_t require_digitset = 0; uint32_t c; +int i; #if PCRE2_CODE_UNIT_WIDTH == 32 (void)utf; /* Avoid compiler warning */ @@ -106,7 +107,7 @@ every script, as opposed to the maps in ucd_script_sets, which only have bits for scripts less than ucp_Unknown - those that appear in script extension lists. */ -for (int i = 0; i < FULL_MAPSIZE; i++) require_map[i] = 0; +for (i = 0; i < FULL_MAPSIZE; i++) require_map[i] = 0; /* Scan strings of two or more characters, checking the Unicode characteristics of each code point. There is special code for scripts that can be combined with @@ -245,7 +246,7 @@ for (;;) case SCRIPT_MAP: OK = FALSE; - for (int i = 0; i < FULL_MAPSIZE; i++) + for (i = 0; i < FULL_MAPSIZE; i++) { if ((require_map[i] & map[i]) != 0) { @@ -282,7 +283,7 @@ for (;;) allowed scripts for this character. */ default: - for (int i = 0; i < FULL_MAPSIZE; i++) require_map[i] &= map[i]; + for (i = 0; i < FULL_MAPSIZE; i++) require_map[i] &= map[i]; break; } diff --git a/src/pcre2test.c b/src/pcre2test.c index 7349473..0904fd7 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -8462,13 +8462,14 @@ int count; int maxi = 0; const char *maxs = ""; size_t max = 0; +int i; for (count = 0; ff[count] >= 0; count++) {} /* Find the name to put first. For scripts, any 3-character name is chosen. For non-scripts, or if there is no 3-character name, take the longest. */ -for (int i = 0; ff[i] >= 0; i++) +for (i = 0; ff[i] >= 0; i++) { const char *s = PRIV(utt_names) + ff[i]; size_t len = strlen(s); @@ -8493,7 +8494,7 @@ buff += max; if (count > 1) { const char *sep = " ("; - for (int i = 0; i < count; i++) + for (i = 0; i < count; i++) { if (i == maxi) continue; buff += sprintf(buff, "%s%s", sep, PRIV(utt_names) + ff[i]); @@ -8528,6 +8529,8 @@ int16_t found[256][MAX_SYNONYMS + 1]; int fc = 0; int colwidth = 40; int n; +size_t i, j; +int k; if (wantscripts) { @@ -8540,7 +8543,7 @@ else typename = "PROPERTIES"; } -for (size_t i = 0; i < PRIV(utt_size); i++) +for (i = 0; i < PRIV(utt_size); i++) { int k; int m = 0; @@ -8569,7 +8572,7 @@ for (size_t i = 0; i < PRIV(utt_size); i++) fv = found[fc++]; fv[m++] = t->name_offset; - for (size_t j = i + 1; j < PRIV(utt_size); j++) + for (j = i + 1; j < PRIV(utt_size); j++) { const ucp_type_table *tt = PRIV(utt) + j; if (tt->type != t->type || tt->value != value) continue; @@ -8591,7 +8594,7 @@ if (!wantscripts) printf( "and the following binary (yes/no) properties:\n\n"); -for (int k = 0; k < (n+1)/2; k++) +for (k = 0; k < (n+1)/2; k++) { int x; char buff1[128]; @@ -8621,8 +8624,9 @@ display_one_modifier(modstruct *m, BOOL for_pattern) { uint32_t c = (!for_pattern && (m->which == MOD_PND || m->which == MOD_PNDP))? '*' : ' '; +size_t i; printf("%c%s", c, m->name); -for (size_t i = 0; i < C1MODLISTCOUNT; i++) +for (i = 0; i < C1MODLISTCOUNT; i++) { if (strcmp(m->name, c1modlist[i].fullname) == 0) printf(" (%c)", c1modlist[i].onechar); @@ -8687,8 +8691,9 @@ for (i = 0; i < MODLISTCOUNT; i++) if (for_pattern == is_pattern) { + size_t k; extra[n] = 0; - for (size_t k = 0; k < C1MODLISTCOUNT; k++) + for (k = 0; k < C1MODLISTCOUNT; k++) { if (strcmp(m->name, c1modlist[k].fullname) == 0) {