EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Why is SBB 13 overriding Delphi's default DateTimeToString

Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.
Posted: 10/17/2015 14:49:23
by Petr Stransky (Standard support level)
Joined: 09/24/2012
Posts: 15

We upgraded to SBB 13.0.282 (VCL edition) and I found out that SBB is overriding Delphi's default DateTimeToString functions with its own incompatible one.

Delphi XE:
procedure DateTimeToString(var Result: string; const Format: string;
  DateTime: TDateTime); overload; inline;
procedure DateTimeToString(var Result: string; const Format: string;
  DateTime: TDateTime; const AFormatSettings: TFormatSettings); overload;

function DateTimeToString(DateTime: TElDateTime): string;

While all it does is call Delphi's default DateTimeToStr from sysutils.pas:
function DateTimeToString(DateTime: TElDateTime): string;
  Result := DateTimeToStr(DateTime);


I would like to know what is the reason for this and if there are any other new overrides that may have compatible declarations so I did not spot them.
I did read the changelog and the only thing that could be related to this is:
[VCL] (Base) Fixed datetime functions for 64-bit Unix/Mac OS X (FreePascal).

But I am using Delphi XE and the application is Win/32.
I do understand that SBUtils.pas is maybe more "internal" unit but I am using it to obtain SBB version.
Posted: 10/18/2015 02:10:53
by Eugene Mayevski (EldoS Corp.)

Thank you for the report.

SecureBlackbox is cross-platform and the code you see is just a part for VCL, while the rest of the code has been stripped by the preprocessor.

We need a set of our own functions and we need some of them to have the same name as in VCL for easier porting. I can agree that this particular name was not chosen wisely, yet there exists an easy resolution for the problem: put the unit name before the function name, i.e. write for example DateUtils.DateTimeToString() (or wherever this function has been declared).

Sincerely yours
Eugene Mayevski
Posted: 10/18/2015 14:12:52
by Petr Stransky (Standard support level)
Joined: 09/24/2012
Posts: 15

I do know about the possibility of prefixing the function name with unit name. Actually I am already doing it for TBytes :-) But in this case I created special wrapper unit around sbutils as I only need it for one constant - SBB_VERSION_NUMBER (and it is actually defined in an include file).
What worries me more is if there are any other similar functions that do override Delphi's functions, have compatible declaration but different behavior.
Posted: 10/22/2015 08:46:28
by William Egge (Standard support level)
Joined: 08/17/2011
Posts: 25

You could also change the order the units are declared in the units clause. Later units override earlier units, so place SBUtils before DateUtils so that DateUtils overrides SBUtils.



Topic viewed 2571 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!