aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/RESearch.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/RESearch.cxx')
-rw-r--r--src/RESearch.cxx31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/RESearch.cxx b/src/RESearch.cxx
index 15f3d6281..9a2981ffe 100644
--- a/src/RESearch.cxx
+++ b/src/RESearch.cxx
@@ -305,6 +305,7 @@ constexpr unsigned char escapeValue(unsigned char ch) noexcept {
case 'r': return '\r';
case 't': return '\t';
case 'v': return '\v';
+ default: break;
}
return 0;
}
@@ -353,7 +354,7 @@ int RESearch::GetBackslashExpression(
// I choose to interpret unexpected syntax in a logical way instead
// of reporting errors. Otherwise, we can stick on, eg., PCRE behaviour.
incr = 0; // Most of the time, will skip the char "naturally".
- int c;
+ int c = 0;
int result = -1;
const unsigned char bsc = *pattern;
if (!bsc) {
@@ -433,16 +434,18 @@ int RESearch::GetBackslashExpression(
const char *RESearch::Compile(const char *pattern, Sci::Position length, bool caseSensitive, bool posix) noexcept {
char *mp=nfa; /* nfa pointer */
- char *lp; /* saved pointer */
+ char *lp=nullptr; /* saved pointer */
char *sp=nfa; /* another one */
- char *mpMax = mp + MAXNFA - BITBLK - 10;
+ const char * mpMax = mp + MAXNFA - BITBLK - 10;
int tagi = 0; /* tag stack index */
int tagc = 1; /* actual tag count */
- int n;
- char mask; /* xor mask -CCL/NCL */
- int c1, c2, prevChar;
+ int n = 0;
+ char mask = 0; /* xor mask -CCL/NCL */
+ int c1 = 0;
+ int c2 = 0;
+ int prevChar = 0;
if (!pattern || !length) {
if (sta)
@@ -753,7 +756,7 @@ const char *RESearch::Compile(const char *pattern, Sci::Position length, bool ca
*
*/
int RESearch::Execute(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp) {
- unsigned char c;
+ unsigned char c = 0;
Sci::Position ep = NOTFOUND;
char *ap = nfa;
@@ -841,12 +844,14 @@ int RESearch::Execute(const CharacterIndexer &ci, Sci::Position lp, Sci::Positio
#define CCLSKIP 34 /* [CLO] CCL 32 bytes END */
Sci::Position RESearch::PMatch(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp, char *ap) {
- int op, c, n;
- Sci::Position e; /* extra pointer for CLO */
- Sci::Position bp; /* beginning of subpat... */
- Sci::Position ep; /* ending of subpat... */
- Sci::Position are; /* to save the line ptr. */
- Sci::Position llp; /* lazy lp for LCLO */
+ int op = 0;
+ int c = 0;
+ int n = 0;
+ Sci::Position e = 0; /* extra pointer for CLO */
+ Sci::Position bp = 0; /* beginning of subpat... */
+ Sci::Position ep = 0; /* ending of subpat... */
+ Sci::Position are = 0; /* to save the line ptr. */
+ Sci::Position llp = 0; /* lazy lp for LCLO */
while ((op = *ap++) != END)
switch (op) {