Explorar o código

It is now possible to write Stream.ReadBuffer(S, Length(S)); when S is of type AnsiString. In previous versions this would compile but not work at run time. Same applies to Read, Write, and WriteBuffer: all four functions now accept any type of string.

Also clarify the prototypes in the help so they show how they really work even though the internal prototypes are a bit different.
Martijn Laan hai 1 ano
pai
achega
43dfc9c6d3
Modificáronse 3 ficheiros con 8 adicións e 7 borrados
  1. 1 1
      Components/UniPs
  2. 5 5
      ISHelp/isxclasses.pas
  3. 2 1
      whatsnew.htm

+ 1 - 1
Components/UniPs

@@ -1 +1 @@
-Subproject commit 7c52c822f320404a400a14406a1ef2fe5dee588d
+Subproject commit 35f36fc22cf8497899b948a48e3dd9abc89c60ed

+ 5 - 5
ISHelp/isxclasses.pas

@@ -54,12 +54,12 @@ TStringList = class(TStrings)
 end;
 
 TStream = class(TObject)
-  function Read(Buffer: String; Count: Longint): Longint;
-  function Write(Buffer: String; Count: Longint): Longint;
+  function Read(var Buffer: AnyString; ByteCount: Longint): Longint;
+  function Write(const Buffer: AnyString; ByteCount: Longint): Longint;
   function Seek(Offset: Int64; Origin: Word): Int64;
-  procedure ReadBuffer(Buffer: String; Count: Longint);
-  procedure WriteBuffer(Buffer: String; Count: Longint);
-  function CopyFrom(Source: TStream; Count: Int64): Int64;
+  procedure ReadBuffer(var Buffer: AnyString; ByteCount: Longint);
+  procedure WriteBuffer(const Buffer: AnyString; ByteCount: Longint);
+  function CopyFrom(Source: TStream; ByteCount: Int64): Int64;
   property Position: Longint; read write;
   property Size: Longint; read write;
 end;

+ 2 - 1
whatsnew.htm

@@ -161,7 +161,8 @@ end;</pre>
     <li>Added support functions <tt>UTF8Encode</tt> and <tt>UTF8Decode</tt> to encode a Unicode string into a UTF-8 encoded ANSI string and vice versa.</li>
     <li>Added support class <tt>TNewLinkLabel</tt> which can display multi-line text with embedded links and internally uses a Windows SysLink control. See the <i>CodeClasses.iss</i> example script for examples.</li>
     <li><tt>TWizardForm</tt>: Added new <tt>AdjustLinkLabelHeight</tt> function.</li>
-    <li>It is now possible to write <tt>var S: set of AnsiChar; begin S := ['a', 'b']; end;</tt>. In the previous version this would result in a type mismatch error.</tt>
+    <li>It is now possible to write <tt>var S: set of AnsiChar; begin S := ['a', 'b']; end;</tt>. In previous versions this would result in a type mismatch error.</tt>
+    <li>It is now possible to write <tt>Stream.ReadBuffer(S, Length(S));</tt> when S is of type <tt>AnsiString</tt>. In previous versions this would compile but not work at run time. Same applies to <tt>Read</tt>, <tt>Write</tt>, and <tt>WriteBuffer</tt>: all four functions now accept any type of string.</li>
     <li>Type <tt>TShellFolderID</tt> was removed because it wasn't used by any support function.</li>
     </ul>
   </li>