ViaThinkSoft CodeLib
This article is in:
CodeLib → Programming aids → Delphi
Protocols/IdFTP.pas
1. Find:
Replace:
System/IdGlobal.pas
2. Find:
Replace:
System\IdStackWindows.pas
3. Find:
Replace:
4. Find:
Replace:
5. Find:
Replace:
System\IdWinsock2.pas
6. Add after the first uses-block:
Protocols\IdMultipartFormData.pas
7. Find:
Replace:
1. Find:
IOHandler.DefAnsiEncoding := IIdTextEncoding.Default;
IOHandler.DefAnsiEncoding := IndyTextEncoding_Default;
System/IdGlobal.pas
2. Find:
EnsureByteEncoding(LBytes, ASrcEncoding, ADestEncoding);
CheckByteEncoding(LBytes, ASrcEncoding, ADestEncoding); // see also http://www.devsuperpage.com/search/Articles.aspx?G=2&ArtID=28638
System\IdStackWindows.pas
3. Find:
procedure GetSocketOption(ASocket: TIdStackSocketHandle; ALevel: TIdSocketOptionLevel;
AOptName: TIdSocketOption; var AOptVal; var AOptLen: Integer); override;
procedure SetSocketOption(ASocket: TIdStackSocketHandle; ALevel: TIdSocketOptionLevel;
AOptName: TIdSocketOption; const AOptVal; const AOptLen: Integer); override;
procedure GetSocketOption(ASocket: TIdStackSocketHandle; ALevel: TIdSocketOptionLevel;
AOptName: TIdSocketOption; out AOptVal: integer); override;
procedure SetSocketOption(ASocket: TIdStackSocketHandle; ALevel: TIdSocketOptionLevel;
AOptName: TIdSocketOption; AOptVal: integer); override;
4. Find:
procedure TIdStackWindows.GetSocketOption(ASocket: TIdStackSocketHandle;
ALevel: TIdSocketOptionLevel; AOptName: TIdSocketOption; var AOptVal;
var AOptLen: Integer);
begin
CheckForSocketError(
getsockopt(ASocket, ALevel, AOptName,
{$IFNDEF HAS_PAnsiChar}
// TODO: use TPtrWrapper here?
{PAnsiChar}@AOptVal
{$ELSE}
PAnsiChar(@AOptVal)
{$ENDIF},
AOptLen
)
);
end;
procedure TIdStackWindows.GetSocketOption(ASocket: TIdStackSocketHandle;
ALevel: TIdSocketOptionLevel; AOptName: TIdSocketOption;
out AOptVal: Integer);
var LP : PAnsiChar;
LLen : Integer;
LBuf : Integer;
begin
LP := Addr(LBuf);
LLen := SIZE_INTEGER;
CheckForSocketError({WS}GetSockOpt(ASocket, ALevel, AOptName, LP, LLen));
AOptVal := LBuf;
end;
5. Find:
procedure TIdStackWindows.SetSocketOption(ASocket: TIdStackSocketHandle;
ALevel: TIdSocketOptionLevel; AOptName: TIdSocketOption; const AOptVal;
const AOptLen: Integer);
begin
CheckForSocketError(
setsockopt(ASocket, ALevel, Aoptname,
{$IFNDEF HAS_PAnsiChar}
// TODO: use TPtrWrapper here?
{PAnsiChar}@AOptVal
{$ELSE}
PAnsiChar(@AOptVal)
{$ENDIF},
AOptLen
)
);
end;
procedure TIdStackWindows.SetSocketOption(ASocket: TIdStackSocketHandle;
ALevel: TIdSocketProtocol; AOptName: TIdSocketOption; AOptVal: Integer);
begin
CheckForSocketError(SetSockOpt(ASocket, ALevel, AOptName, PChar(@AOptVal), SIZE_INTEGER));
end;
System\IdWinsock2.pas
6. Add after the first uses-block:
type
UINT32 = Cardinal;
UINT8 = byte;
Protocols\IdMultipartFormData.pas
7. Find:
CheckByteEncoding(VBytes, CharsetToEncoding(FCharset), IndyTextEncoding_ASCII);
CheckByteEncoding(LBytes, CharsetToEncoding(FCharset), IndyTextEncoding_ASCII);
Daniel Marschall
ViaThinkSoft Co-Founder
ViaThinkSoft Co-Founder