Browse Source

StringScanner: Rename Init to Create.

Jordan Russell 4 months ago
parent
commit
dbf257c482
2 changed files with 5 additions and 5 deletions
  1. 2 2
      Components/ISSigFunc.pas
  2. 3 3
      Components/StringScanner.pas

+ 2 - 2
Components/ISSigFunc.pas

@@ -176,7 +176,7 @@ begin
   if Length(AText) > ISSigTextFileLengthLimit then
     Exit(vsrMalformed);
 
-  var SS := TStringScanner.Init(AText);
+  var SS := TStringScanner.Create(AText);
   if not ConsumeLineValue(SS, 'format', TextValues.Format, 8, 8, NonControlASCIICharsSet) or
      (TextValues.Format <> 'issig-v1') or
      not ConsumeLineValue(SS, 'file-size', TextValues.FileSize, 1, 16, DigitsSet) or
@@ -273,7 +273,7 @@ begin
   if Length(AText) > ISSigTextFileLengthLimit then
     Exit;
 
-  var SS := TStringScanner.Init(AText);
+  var SS := TStringScanner.Create(AText);
   if not ConsumeLineValue(SS, 'format', TextValues.Format, 16, 17, NonControlASCIICharsSet) then
     Exit;
   var HasPrivateKey := False;

+ 3 - 3
Components/StringScanner.pas

@@ -22,7 +22,7 @@ type
     function GetReachedEnd: Boolean;
     function GetRemainingCount: Integer;
   public
-    class function Init(const AString: String): TStringScanner; static;
+    class function Create(const AString: String): TStringScanner; static;
     function Consume(const C: Char): Boolean; overload;
     function Consume(const S: String): Boolean; overload;
     function ConsumeMulti(const C: TSysCharSet; const AMinChars: Integer = 1;
@@ -41,7 +41,7 @@ implementation
 
 { TStringScanner }
 
-class function TStringScanner.Init(const AString: String): TStringScanner;
+class function TStringScanner.Create(const AString: String): TStringScanner;
 begin
   Result.FPosition := 1;
   Result.FStr := AString;
@@ -109,7 +109,7 @@ end;
 function TStringScanner.GetRemainingCount: Integer;
 begin
   { The "<= 0" check exists to protect against OOB reads in case someone calls
-    into an instance that was never properly initialized (via Init).
+    into an instance that was never properly initialized (via Create).
     Inside TStringScanner, FStr[FPosition] must not be accessed unless
     GetRemainingCount is called first and returns a nonzero value. }