synaser.pas - small FPC fixes

git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@197 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
geby 2015-02-16 13:05:29 +00:00
parent 1d1db57174
commit a914047ce7

View File

@ -197,7 +197,7 @@ type
const const
{$IFDEF UNIX} {$IFDEF UNIX}
{$IFDEF BSD} {$IFDEF DARWIN}
MaxRates = 18; //MAC MaxRates = 18; //MAC
{$ELSE} {$ELSE}
MaxRates = 30; //UNIX MaxRates = 30; //UNIX
@ -226,7 +226,7 @@ const
(57600, B57600), (57600, B57600),
(115200, B115200), (115200, B115200),
(230400, B230400) (230400, B230400)
{$IFNDEF BSD} {$IFNDEF DARWIN}
,(460800, B460800) ,(460800, B460800)
{$IFDEF UNIX} {$IFDEF UNIX}
,(500000, B500000), ,(500000, B500000),
@ -245,7 +245,7 @@ const
); );
{$ENDIF} {$ENDIF}
{$IFDEF BSD} {$IFDEF DARWIN}
const // From fcntl.h const // From fcntl.h
O_SYNC = $0080; { synchronous writes } O_SYNC = $0080; { synchronous writes }
{$ENDIF} {$ENDIF}
@ -782,7 +782,7 @@ end;
class function TBlockSerial.GetVersion: string; class function TBlockSerial.GetVersion: string;
begin begin
Result := 'SynaSer 7.5.4'; Result := 'SynaSer 7.6.0';
end; end;
procedure TBlockSerial.CloseSocket; procedure TBlockSerial.CloseSocket;
@ -1043,6 +1043,7 @@ begin
end end
else else
SetSynaError(y); SetSynaError(y);
err := 0;
ClearCommError(FHandle, err, nil); ClearCommError(FHandle, err, nil);
if err <> 0 then if err <> 0 then
DecodeCommError(err); DecodeCommError(err);
@ -1158,6 +1159,7 @@ begin
end end
else else
SetSynaError(y); SetSynaError(y);
err := 0;
ClearCommError(FHandle, err, nil); ClearCommError(FHandle, err, nil);
if err <> 0 then if err <> 0 then
DecodeCommError(err); DecodeCommError(err);
@ -1464,6 +1466,7 @@ var
stat: TComStat; stat: TComStat;
err: DWORD; err: DWORD;
begin begin
err := 0;
if ClearCommError(FHandle, err, @stat) then if ClearCommError(FHandle, err, @stat) then
begin begin
SetSynaError(sOK); SetSynaError(sOK);
@ -1499,6 +1502,7 @@ var
err: DWORD; err: DWORD;
begin begin
SetSynaError(sOK); SetSynaError(sOK);
err := 0;
if not ClearCommError(FHandle, err, @stat) then if not ClearCommError(FHandle, err, @stat) then
serialcheck(sErr); serialcheck(sErr);
ExceptCheck; ExceptCheck;
@ -1774,6 +1778,7 @@ begin
else else
begin begin
y := 0; y := 0;
ex := 0;
if not WaitCommEvent(FHandle, ex, @Overlapped) then if not WaitCommEvent(FHandle, ex, @Overlapped) then
y := GetLastError; y := GetLastError;
if y = ERROR_IO_PENDING then if y = ERROR_IO_PENDING then
@ -1942,7 +1947,7 @@ begin
SerialCheck(ioctl(FHandle, TCFLSH, TCIOFLUSH)); SerialCheck(ioctl(FHandle, TCFLSH, TCIOFLUSH));
{$ELSE} {$ELSE}
{$IFDEF DARWIN} {$IFDEF DARWIN}
SerialCheck(fpioctl(FHandle, TCIOflush, Pointer(TCIOFLUSH))); SerialCheck(fpioctl(FHandle, TCIOflush, Pointer(PtrInt(TCIOFLUSH))));
{$ELSE} {$ELSE}
SerialCheck(fpioctl(FHandle, {$IFDEF FreeBSD}TCIOFLUSH{$ELSE}TCFLSH{$ENDIF}, Pointer(PtrInt(TCIOFLUSH)))); SerialCheck(fpioctl(FHandle, {$IFDEF FreeBSD}TCIOFLUSH{$ELSE}TCFLSH{$ENDIF}, Pointer(PtrInt(TCIOFLUSH))));
{$ENDIF} {$ENDIF}