IFDEFS added to reduce EXE size
This commit is contained in:
parent
bb924941ec
commit
3f97c8438f
|
@ -4,8 +4,12 @@ Unit m_TCP_Client;
|
|||
|
||||
Interface
|
||||
|
||||
{.$DEFINE USESTRINGLIST}
|
||||
|
||||
Uses
|
||||
Classes,
|
||||
{$IFDEF USESTRINGLIST}
|
||||
Classes,
|
||||
{$ENDIF}
|
||||
m_Strings,
|
||||
m_IO_Sockets;
|
||||
|
||||
|
@ -14,7 +18,9 @@ Type
|
|||
Client : TIOSocket;
|
||||
ResponseType : Integer;
|
||||
ResponseStr : String;
|
||||
ResponseData : TStringList;
|
||||
{$IFDEF USESTRINGLIST}
|
||||
ResponseData : TStringList;
|
||||
{$ENDIF}
|
||||
NetInterface : String;
|
||||
|
||||
Constructor Create (NetI: String); Virtual;
|
||||
|
@ -32,13 +38,19 @@ Begin
|
|||
|
||||
Client := NIL;
|
||||
NetInterface := NetI;
|
||||
ResponseData := TStringList.Create;
|
||||
|
||||
{$IFDEF USESTRINGLIST}
|
||||
ResponseData := TStringList.Create;
|
||||
{$ENDIF}
|
||||
End;
|
||||
|
||||
Destructor TTCPClient.Destroy;
|
||||
Begin
|
||||
Client.Free;
|
||||
ResponseData.Free;
|
||||
|
||||
{$IFDEF USESTRINGLIST}
|
||||
ResponseData.Free;
|
||||
{$ENDIF}
|
||||
|
||||
Inherited Destroy;
|
||||
End;
|
||||
|
@ -80,7 +92,9 @@ Begin
|
|||
Result := ResponseType;
|
||||
|
||||
If ResponseStr[4] = '-' Then Begin
|
||||
ResponseData.Clear;
|
||||
{$IFDEF USESTRINGLIST}
|
||||
ResponseData.Clear;
|
||||
{$ENDIF}
|
||||
|
||||
Repeat
|
||||
Res := Client.ReadLine(Str);
|
||||
|
@ -88,8 +102,10 @@ Begin
|
|||
If Res < 0 Then
|
||||
Break;
|
||||
|
||||
If Res > 0 Then
|
||||
ResponseData.Add(Str);
|
||||
{$IFDEF USESTRINGLIST}
|
||||
If Res > 0 Then
|
||||
ResponseData.Add(Str);
|
||||
{$ENDIF}
|
||||
Until Copy(Str, 1, 4) = strI2S(ResponseType) + ' ';
|
||||
End;
|
||||
End;
|
||||
|
|
|
@ -5,11 +5,15 @@ Unit m_Tcp_Client_FTP;
|
|||
Interface
|
||||
|
||||
Uses
|
||||
SysUtils, // replace wordrec and remove
|
||||
m_io_Sockets,
|
||||
m_Tcp_Client;
|
||||
|
||||
Type
|
||||
WordRec = Record
|
||||
Lo : Byte;
|
||||
Hi : Byte;
|
||||
End;
|
||||
|
||||
TFTPClient = Class(TTCPClient)
|
||||
DataPort : Word;
|
||||
DataIP : String;
|
||||
|
@ -56,8 +60,6 @@ Var
|
|||
Begin
|
||||
Result := False;
|
||||
|
||||
WriteLn ('DEBUG OPEN DATA 1');
|
||||
|
||||
If DataSocket <> NIL Then Begin
|
||||
DataSocket.Free;
|
||||
DataSocket := NIL;
|
||||
|
@ -73,23 +75,15 @@ Begin
|
|||
Exit;
|
||||
End;
|
||||
End Else Begin
|
||||
WriteLn ('DEBUG OPEN DATA 2');
|
||||
|
||||
WaitSock := TIOSocket.Create;
|
||||
|
||||
WaitSock.FTelnetServer := False;
|
||||
WaitSock.FTelnetClient := False;
|
||||
|
||||
WriteLn ('DEBUG OPEN DATA 3');
|
||||
|
||||
WaitSock.WaitInit(NetInterface, DataPort);
|
||||
|
||||
WriteLn ('DEBUG OPEN DATA 4');
|
||||
|
||||
DataSocket := WaitSock.WaitConnection(10000);
|
||||
|
||||
WriteLn ('DEBUG OPEN DATA 5');
|
||||
|
||||
WaitSock.Free;
|
||||
|
||||
If Not Assigned(DataSocket) Then
|
||||
|
@ -174,19 +168,13 @@ Begin
|
|||
|
||||
If Not FileExist(FileName) Then Exit;
|
||||
|
||||
WriteLn ('DEBUG SendFile Passive ', Passive, ' Filename ', FileName);
|
||||
|
||||
SetPassive(Passive);
|
||||
|
||||
WriteLn ('DEBUG SETPASSIVE()');
|
||||
|
||||
Client.WriteLine ('STOR ' + JustFile(FileName));
|
||||
|
||||
OK := OpenDataSession;
|
||||
|
||||
If OK and (GetResponse = 150) Then Begin
|
||||
WriteLn ('DEBUG BEGIN SEND FILE');
|
||||
|
||||
Assign (F, FileName);
|
||||
|
||||
If ioReset(F, 1, fmRWDN) Then Begin
|
||||
|
@ -252,7 +240,10 @@ Begin
|
|||
|
||||
Result := GetResponse = 226;
|
||||
End Else Begin
|
||||
WriteLn ('DEBUG unable to open data session, receive aborted');
|
||||
If IsPassive Then
|
||||
WriteLn ('DEBUG unable to connect to FTP server for data session')
|
||||
Else
|
||||
WriteLn ('DEBUG unable to establish data session on port ', DataPort);
|
||||
|
||||
CloseDataSession;
|
||||
End;
|
||||
|
|
Loading…
Reference in New Issue