[Patch] Implement HexToBin overloads for Delphi compatibility
Original Reporter info from Mantis: Bi0T1N @Bi0T1N
-
Reporter name: Bi0T1N
Original Reporter info from Mantis: Bi0T1N @Bi0T1N
- Reporter name: Bi0T1N
Description:
The attached patch includes the overloads of HexToBin that Delphi does provide.
See http://docwiki.embarcadero.com/Libraries/Sydney/en/System.Classes.HexToBin
Additional information:
- Delphi fails at compiling two tests with: "E2251 Ambiguous overloaded call to 'HexToBin'" while FPC compiles them. I've just uncommented both as the result for the WideChar test is not correct. It seems that FPC favours AnsiString for both cases: @HexInputA[1] and @HexInputW[1].
- Since the RTL also favours AnsiString and thus PChar=PAnsiChar but in Delphi PChar is PWideChar I've written the tests for $mode DelphiUnicode so that it yields the same results and thus also implemented the PChar version of HexToBin as PWideChar. (If you want to have it for PAnsiChar as well then it should be enough to change the header declaration and the local variable to PAnsiChar.)
- Deprecates the function in Classes as in the patch for BinToHex (#38150 (closed))
Mantis conversion info:
- Mantis ID: 38712
- Version: 3.3.1