瀏覽代碼

* Merging revisions r45334 from trunk:
------------------------------------------------------------------------
r45334 | michael | 2020-05-11 09:13:04 +0200 (Mon, 11 May 2020) | 1 line

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

git-svn-id: branches/fixes_3_2@46565 -

michael 5 年之前
父節點
當前提交
fe1386a279
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      packages/regexpr/src/regexpr.pas

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

@@ -3348,7 +3348,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;
@@ -3369,9 +3370,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
@@ -3381,9 +3385,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