Anton Sviridov wrote: > Having looked at the OverbyteIcsWSocket unit, I've noticed many IFDEF > CLR which probably might be removed. > > First of all, I think it's better to turn all buffers from PAnsiChar > / array of AnsiChar to TBytes, as it is recommended by Embarcadero > (though one would declare this type for compilers up to BDS2006).
When Unicode Delphi came out the goal was to port ICS with minimum changes, I guess the same was true when Delphi .Net came out. > > Second, I see numerous cases of copying by for loops in CLR code, > while on WIN32 it's done by Move. I also noticed > System.Buffer.BlockCopy(FRcvdPtr, 0, Buffer, 0, FLineLength); in just > one place instead of for loop, maybe this function should be used? Probably. AFAIK the .Net code was never finished in ICS v7/v6 and currently does not work either. > 2) > function Send({$IFDEF CLR} const {$ENDIF} Data : TWSocketData; > Len : Integer) : Integer; overload; virtual; > and > function SendTo(Dest : TSockAddr; > DestLen : Integer; > {$IFDEF CLR} const {$ENDIF} Data : TWSocketData; > Len : Integer) : Integer; virtual; > > why not declare it const for all platforms? Because it did not compile with C++Builder, and nobody wanted to touch the .Net code. > > 3) > in WSocket_accept there's too much conditions, even for D1 - I > thought D1-D6 is unsupported in v7 ? Indeed, they will be removed step by step. > Some other remarks: > > 4) > function AddOptions(Opts: array of TWSocketOption): TWSocketOptions; > Result := Result + [Opts[I]]; > => > Include(Result, Opts[I]); > as it is faster True, however unless this was called in a loop many many times it's IMO minor. > 5) > function RemoveOption( > Result := OptSet - [Opt]; > => > Exclude(Result, Opt); > the same The correct code was : Result := OptSet; Exclude(Result, Opt); Would this be traceable faster? > > 6) (possibly bug) > for I := Low(LocalSockName.sin_zero) to > High(LocalSockName.sin_zero) do LocalSockName.sin_zero[0] := > #0; > > LocalSockName.sin_zero[i] ? Indeed, however that's in the .Net code. > 7) > procedure TCustomSocksWSocket.SocksDoAuthenticate; > TempS := AnsiString(FSocksPassword); > TempS := AnsiString(FSocksUsercode); > > Looks like one couldn't use Unicode characters in Socks login? Is it > mistake or protocol restriction? It's not a mistake but simply backwards compatible. I did not find anything in RFC of how to handle non-ASCII chars with socks authentication, did you? > > 8) > Phe := PHostent(@FDnsLookupBuffer); > if phe <> nil then begin > > Phe currently never could be nil, as FDnsLookupBuffer is declared as > static array field True. -- Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be