Some code was unreachable due to a LongWord declaration

This commit is contained in:
mysticbbs 2012-09-24 13:47:50 -04:00
parent 3a5e73f312
commit b1f05b204f
2 changed files with 8 additions and 8 deletions

View File

@ -26,7 +26,7 @@ Type
Function ConnectPipe (Secs: LongInt) : Boolean; Function ConnectPipe (Secs: LongInt) : Boolean;
// General functions // General functions
Procedure SendToPipe (Var Buf; Len: Longint); Procedure SendToPipe (Var Buf; Len: Longint);
Procedure ReadFromPipe (Var Buf; Len: LongInt; Var bRead: LongWord); Procedure ReadFromPipe (Var Buf; Len: LongInt; Var bRead: LongInt);
Procedure Disconnect; Procedure Disconnect;
Function DataWaiting : Boolean; Function DataWaiting : Boolean;
End; End;
@ -72,7 +72,7 @@ Begin
If Not FileExist(PipeName) Then If Not FileExist(PipeName) Then
fpMkFIFO(PipeName, 438); fpMkFIFO(PipeName, 438);
PipeHandle := fpOpen(PipeName, O_WRONLY, O_NONBLOCK); PipeHandle := fpOpen(PipeName, O_RDWR, O_NONBLOCK);
Result := PipeHandle >= 0; Result := PipeHandle >= 0;
End; End;
@ -84,7 +84,7 @@ Begin
Disconnect; Disconnect;
End; End;
Procedure TPipeUnix.ReadFromPipe (Var Buf; Len: LongInt; Var bRead: LongWord); Procedure TPipeUnix.ReadFromPipe (Var Buf; Len: LongInt; Var bRead: LongInt);
Begin Begin
bRead := 0; bRead := 0;
@ -114,7 +114,7 @@ Begin
TimeOut := TimerSet(Secs); TimeOut := TimerSet(Secs);
Repeat Repeat
PipeHandle := fpOpen(PipeName, O_RDONLY, O_NONBLOCK); PipeHandle := fpOpen(PipeName, O_RDWR, O_NONBLOCK);
Connected := PipeHandle >= 0; Connected := PipeHandle >= 0;
Until Connected or TimerUp(TimeOut); Until Connected or TimerUp(TimeOut);

View File

@ -18,7 +18,7 @@ Type
PipeID : Word; PipeID : Word;
Connected : Boolean; Connected : Boolean;
IsClient : Boolean; IsClient : Boolean;
PipeHandle : THandle; PipeHandle : LongInt;
Constructor Create (Dir: String; Client: Boolean; ID: Word); Constructor Create (Dir: String; Client: Boolean; ID: Word);
Destructor Destroy; Override; Destructor Destroy; Override;
@ -29,7 +29,7 @@ Type
Function ConnectPipe (Secs: LongInt) : Boolean; Function ConnectPipe (Secs: LongInt) : Boolean;
// General functions // General functions
Procedure SendToPipe (Var Buf; Len: Longint); Procedure SendToPipe (Var Buf; Len: Longint);
Procedure ReadFromPipe (Var Buf; Len: LongInt; Var bRead: LongWord); Procedure ReadFromPipe (Var Buf; Len: LongInt; Var bRead: LongInt);
Procedure Disconnect; Procedure Disconnect;
Function DataWaiting : Boolean; Function DataWaiting : Boolean;
End; End;
@ -109,13 +109,13 @@ Begin
Disconnect; // was ERROR_SUCCESS check Disconnect; // was ERROR_SUCCESS check
End; End;
Procedure TPipeWindows.ReadFromPipe (Var Buf; Len: LongInt; Var bRead: LongWord); Procedure TPipeWindows.ReadFromPipe (Var Buf; Len: LongInt; Var bRead: LongInt);
Begin Begin
bRead := 0; bRead := 0;
If Not Connected Then Exit; If Not Connected Then Exit;
ReadFile (PipeHandle, Buf, Len, bRead, NIL); ReadFile (PipeHandle, Buf, Len, LongWord(bRead), NIL);
If GetLastError <> ERROR_SUCCESS Then If GetLastError <> ERROR_SUCCESS Then
Disconnect; Disconnect;