Skip to content

[Patch] Implement BinToHex overloads for Delphi compatibility

Original Reporter info from Mantis: Bi0T1N @Bi0T1N
  • Reporter name: Bi0T1N

Description:

  1. Add a deprecated message to the function in Strutils as it's also available in Classes (would fix one part of #38133 (closed))
  2. There is no need to increment and use &LtPos;i>binvalue&LtPos;/i> as in the initial version because one could directly use &LtPos;i>i&LtPos;/i> which is already incremented due to the for-loop
  3. I'm unsure about the implementation of TBytes as the documentation of Delphi says: "You can call BinToHex with or without specifying an offset for the input string (TextOffset) or the output buffer (BufOffset). However, you must specify either both offsets or specify none of them."
    Not sure if that means that both Offsets have to be != 0 - which wouldn't make sense as long as it doesn't result in an out-of-bounds read or write. Using a default value is also not possible because the parameter is in between other parameters, so I've no clue what they mean...
  4. I've attached a test but I haven't Delphi so cannot test it there - feedback would be appreciated

Additional information:

http://docwiki.embarcadero.com/Libraries/Sydney/en/System.Classes.BinToHex

Mantis conversion info:

  • Mantis ID: 38150
  • Version: 3.3.1
  • Fixed in version: 3.3.1
  • Fixed in revision: 48967 (#62b486a4)
  • Monitored by: » @Bi0T1N (Bi0T1N), » @mvancanneyt (Michael Van Canneyt)
  • Target version: 4.0.0
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information