Browse Source

* Fix bug id #0037048 (wrong count sometimes), upstream fix

git-svn-id: trunk@45334 -
michael 5 years ago
parent
commit
4fed12553a
1 changed files with 8 additions and 1 deletions
  1. 8 1
      packages/regexpr/src/regexpr.pas

+ 8 - 1
packages/regexpr/src/regexpr.pas

@@ -3349,7 +3349,8 @@ function TRegExpr.regrepeat(p: PRegExprChar; AMax: integer): integer;
 var
   scan: PRegExprChar;
   opnd: PRegExprChar;
-  TheMax, NLen: integer;
+  TheMax: PtrInt; // PtrInt, gets diff of 2 pointers
+  //NLen: integer;
   InvChar: REChar; // ###0.931
   GrpStart, GrpEnd: PRegExprChar; // ###0.936
   ArrayIndex: integer;
@@ -3370,9 +3371,12 @@ begin
       end;
     OP_EXACTLY:
       begin // in opnd can be only ONE char !!!
+        {
+        // Alexey: commented because of https://github.com/andgineer/TRegExpr/issues/145
         NLen := PLongInt(opnd)^;
         if TheMax > NLen then
           TheMax := NLen;
+        }
         Inc(opnd, RENumberSz);
         while (Result < TheMax) and (opnd^ = scan^) do
         begin
@@ -3382,9 +3386,12 @@ begin
       end;
     OP_EXACTLYCI:
       begin // in opnd can be only ONE char !!!
+        {
+        // Alexey: commented because of https://github.com/andgineer/TRegExpr/issues/145
         NLen := PLongInt(opnd)^;
         if TheMax > NLen then
           TheMax := NLen;
+        }
         Inc(opnd, RENumberSz);
         while (Result < TheMax) and (opnd^ = scan^) do
         begin // prevent unneeded InvertCase //###0.931