LCL: Use "out" parameter instead of "var" in Printer.Write() and derivatives. Issue #29950.

git-svn-id: trunk@53102 -
This commit is contained in:
juha 2016-10-12 13:37:37 +00:00
parent ca343fe6d1
commit ec91cfdc9a
11 changed files with 16 additions and 18 deletions

View File

@ -293,12 +293,11 @@ begin
inherited DoDestroy; inherited DoDestroy;
end; end;
function TCarbonPrinter.Write(const Buffer; Count: Integer; function TCarbonPrinter.Write(const Buffer; Count: Integer; out Written: Integer): Boolean;
var Written: Integer): Boolean;
begin begin
Result := False; Result := False;
CheckRawMode(True); CheckRawMode(True);
Written := 0;
DebugLn('TCarbonPrinter.Write Error: Raw mode is not supported for Carbon!'); DebugLn('TCarbonPrinter.Write Error: Raw mode is not supported for Carbon!');
end; end;

View File

@ -89,7 +89,7 @@ type
procedure UpdatePrinter; procedure UpdatePrinter;
public public
constructor Create; override; constructor Create; override;
function Write(const {%H-}Buffer; {%H-}Count:Integer; var {%H-}Written: Integer): Boolean; override; function Write(const {%H-}Buffer; {%H-}Count:Integer; out Written: Integer): Boolean; override;
// Warning not portable functions here // Warning not portable functions here
property CurrentPrinterName: String read GetCurrentPrinterName; property CurrentPrinterName: String read GetCurrentPrinterName;
property PrintSession: PMPrintSession read FPrintSession; property PrintSession: PMPrintSession read FPrintSession;

View File

@ -292,12 +292,11 @@ begin
inherited DoDestroy; inherited DoDestroy;
end; end;
function TCocoaPrinter.Write(const Buffer; Count: Integer; function TCocoaPrinter.Write(const Buffer; Count: Integer; out Written: Integer): Boolean;
var Written: Integer): Boolean;
begin begin
Result := False; Result := False;
CheckRawMode(True); CheckRawMode(True);
Written := 0;
DebugLn('TCocoaPrinter.Write Error: Raw mode is not supported for Cocoa!'); DebugLn('TCocoaPrinter.Write Error: Raw mode is not supported for Cocoa!');
end; end;

View File

@ -98,7 +98,7 @@ type
procedure UpdatePrinter; procedure UpdatePrinter;
public public
constructor Create; override; constructor Create; override;
function Write(const {%H-}Buffer; {%H-}Count:Integer; var {%H-}Written: Integer): Boolean; override; function Write(const {%H-}Buffer; {%H-}Count:Integer; out Written: Integer): Boolean; override;
// Warning not portable properties here // Warning not portable properties here
//property CurrentPrinterName: String read GetCurrentPrinterName; //property CurrentPrinterName: String read GetCurrentPrinterName;
property PrintSession: PMPrintSession read GetPrintSession; property PrintSession: PMPrintSession read GetPrintSession;

View File

@ -154,11 +154,11 @@ begin
inherited DoDestroy; inherited DoDestroy;
end; end;
function TQtPrinters.Write(const Buffer; Count: Integer; function TQtPrinters.Write(const Buffer; Count: Integer; out Written: Integer): Boolean;
var Written: Integer): Boolean;
begin begin
Result := False; Result := False;
CheckRawMode(True); CheckRawMode(True);
Written := 0;
{$IFDEF VERBOSE_QT_PRINTING} {$IFDEF VERBOSE_QT_PRINTING}
DebugLn('TQtPrinters.Write(): Raw mode is not yet supported'); DebugLn('TQtPrinters.Write(): Raw mode is not yet supported');
{$ENDIF} {$ENDIF}

View File

@ -57,7 +57,7 @@ type
function GetPaperSize(Const Str: String): QPrinterPageSize; function GetPaperSize(Const Str: String): QPrinterPageSize;
public public
constructor Create; override; constructor Create; override;
function Write(const {%H-}Buffer; {%H-}Count:Integer; var {%H-}Written: Integer): Boolean; override; function Write(const {%H-}Buffer; {%H-}Count:Integer; out Written: Integer): Boolean; override;
property ColorMode: QPrinterColorMode read GetColorMode write SetColorMode; property ColorMode: QPrinterColorMode read GetColorMode write SetColorMode;
property FullPage: Boolean read GetFullPage write SetFullPage; property FullPage: Boolean read GetFullPage write SetFullPage;

View File

@ -96,7 +96,7 @@ begin
end; end;
//write count bytes from buffer to raw mode stream //write count bytes from buffer to raw mode stream
function TCUPSPrinter.Write(const Buffer; Count: Integer; var Written: Integer function TCUPSPrinter.Write(const Buffer; Count: Integer; out Written: Integer
): Boolean; ): Boolean;
begin begin
result := False; result := False;

View File

@ -161,7 +161,7 @@ type
procedure DoDestroy; override; procedure DoDestroy; override;
public public
constructor Create; override; constructor Create; override;
function Write(const Buffer; Count:Integer; var Written: Integer): Boolean; override; function Write(const Buffer; Count:Integer; out Written: Integer): Boolean; override;
{------------------------------------------------- {-------------------------------------------------
SPECIFIC CUPS METHODS OR PROPERTIES SPECIFIC CUPS METHODS OR PROPERTIES

View File

@ -47,8 +47,7 @@ begin
inherited DoDestroy; inherited DoDestroy;
end; end;
function TWinPrinter.Write(const Buffer; Count: Integer; function TWinPrinter.Write(const Buffer; Count: Integer; out Written: Integer): Boolean;
var Written: Integer): Boolean;
begin begin
CheckRawMode(True); CheckRawMode(True);
Result := WritePrinter(FPrinterHandle, @Buffer, Count, pdword(@Written)); Result := WritePrinter(FPrinterHandle, @Buffer, Count, pdword(@Written));

View File

@ -83,7 +83,7 @@ Type
public public
constructor Create; override; constructor Create; override;
function Write(const Buffer; Count:Integer; var Written: Integer): Boolean; override; function Write(const Buffer; Count:Integer; out Written: Integer): Boolean; override;
//Warning not portable functions here //Warning not portable functions here
procedure AdvancedProperties; procedure AdvancedProperties;

View File

@ -276,7 +276,7 @@ type
procedure Refresh; procedure Refresh;
procedure SetPrinter(aName : String); procedure SetPrinter(aName : String);
Procedure RestoreDefaultBin; virtual; Procedure RestoreDefaultBin; virtual;
function Write(const Buffer; Count:Integer; var Written: Integer): Boolean; virtual; function Write(const Buffer; Count:Integer; out Written: Integer): Boolean; virtual;
function Write(const s: ansistring): boolean; overload; function Write(const s: ansistring): boolean; overload;
property PrinterIndex : integer read GetPrinterIndex write SetPrinterIndex; property PrinterIndex : integer read GetPrinterIndex write SetPrinterIndex;
@ -479,9 +479,10 @@ begin
DoSetBinName(DoGetDefaultBinName); DoSetBinName(DoGetDefaultBinName);
end; end;
function TPrinter.Write(const Buffer; Count:Integer; var Written: Integer): Boolean; function TPrinter.Write(const Buffer; Count: Integer; out Written: Integer): Boolean;
begin begin
result := False; result := False;
Written := 0;
end; end;
function TPrinter.Write(const S: ansistring): Boolean; overload; function TPrinter.Write(const S: ansistring): Boolean; overload;