ソースを参照

* Added AddEmptyStrings to ExtractStrings (bug 25633)

git-svn-id: trunk@26600 -
michael 11 年 前
コミット
b5a2b3860b
2 ファイル変更5 行追加4 行削除
  1. 4 3
      rtl/objpas/classes/classes.inc
  2. 1 1
      rtl/objpas/classes/classesh.inc

+ 4 - 3
rtl/objpas/classes/classes.inc

@@ -625,7 +625,7 @@ end;
  *       Miscellaneous procedures and functions                       *
  *       Miscellaneous procedures and functions                       *
  **********************************************************************}
  **********************************************************************}
 
 
-function ExtractStrings(Separators, WhiteSpace: TSysCharSet; Content: PChar; Strings: TStrings): Integer;
+function ExtractStrings(Separators, WhiteSpace: TSysCharSet; Content: PChar; Strings: TStrings; AddEmptyStrings : Boolean = False): Integer;
 var
 var
   b, c : pchar;
   b, c : pchar;
 
 
@@ -641,12 +641,13 @@ var
       s : string;
       s : string;
     begin
     begin
       l := c-b;
       l := c-b;
-      if l > 0 then
+      if (l > 0) or AddEmptyStrings then
         begin
         begin
           if assigned(Strings) then
           if assigned(Strings) then
             begin
             begin
               setlength(s, l);
               setlength(s, l);
-              move (b^, s[1],l);
+              if l>0 then
+                move (b^, s[1],l*SizeOf(char));
               Strings.Add (s);
               Strings.Add (s);
             end;
             end;
           inc (result);
           inc (result);

+ 1 - 1
rtl/objpas/classes/classesh.inc

@@ -2141,5 +2141,5 @@ procedure ObjectTextToResource(Input, Output: TStream);
 function LineStart(Buffer, BufPos: PChar): PChar;
 function LineStart(Buffer, BufPos: PChar): PChar;
 procedure BinToHex(BinValue, HexValue: PChar; BinBufSize: Integer);
 procedure BinToHex(BinValue, HexValue: PChar; BinBufSize: Integer);
 function HexToBin(HexValue, BinValue: PChar; BinBufSize: Integer): Integer;
 function HexToBin(HexValue, BinValue: PChar; BinBufSize: Integer): Integer;
-function ExtractStrings(Separators, WhiteSpace: TSysCharSet; Content: PChar; Strings: TStrings): Integer;
+function ExtractStrings(Separators, WhiteSpace: TSysCharSet; Content: PChar; Strings: TStrings; AddEmptyStrings : Boolean = False): Integer;