Permalink
Browse files

Small code refactoring of some of my units.

  • Loading branch information...
1 parent c0f1a0f commit 2f9cb2493c14ac8af9db5ee87eb01fd5c7698811 on.pokorny@gmail.com committed Feb 21, 2014
Showing with 294 additions and 198 deletions.
  1. +6 −2 OBufferedStreams.pas
  2. +184 −134 OEncoding.pas
  3. +48 −36 OTextReadWrite.pas
  4. +49 −20 OWideSupp.pas
  5. +1 −1 OXml.inc
  6. +5 −5 OmniXML.pas
  7. +1 −0 demo/ErrorInfo/main.pas
@@ -46,6 +46,10 @@ interface
OWideSupp;
+const
+ OBUFFEREDSTREAMS_DEFBUFFERSIZE = 16*1024;//16 KB
+ OBUFFEREDSTREAMS_DEFCHARBUFFERSIZE = OBUFFEREDSTREAMS_DEFBUFFERSIZE div SizeOf(OWideChar);//16 KB
+
type
TOBufferedWriteStream = class(TStream)
@@ -64,7 +68,7 @@ TOBufferedWriteStream = class(TStream)
protected
function GetSize: Int64; {$IF DEFINED(O_DELPHI_7_UP) OR DEFINED(FPC)}override;{$IFEND}
public
- constructor Create(const aStream: TStream; const aBufferSize: ONativeInt = 10*1024 {10 KB});
+ constructor Create(const aStream: TStream; const aBufferSize: ONativeInt = OBUFFEREDSTREAMS_DEFBUFFERSIZE);
destructor Destroy; override;
function Write(const Buffer; Count: LongInt): LongInt; override;
@@ -102,7 +106,7 @@ TOBufferedReadStream = class(TStream)
protected
function GetSize: Int64; {$IF DEFINED(O_DELPHI_7_UP) OR DEFINED(FPC)}override;{$IFEND}
public
- constructor Create(const aStream: TStream; const aBufferSize: ONativeInt = 10*1024 {10 KB});
+ constructor Create(const aStream: TStream; const aBufferSize: ONativeInt = OBUFFEREDSTREAMS_DEFBUFFERSIZE);
function Write(const {%H-}Buffer; {%H-}Count: LongInt): LongInt; override;
{$IFDEF O_DELPHI_XE3_UP}
Oops, something went wrong.

0 comments on commit 2f9cb24

Please sign in to comment.