Skip to content

Commit

Permalink
latest fixes from main rep
Browse files Browse the repository at this point in the history
  • Loading branch information
Makhaon committed Apr 24, 2020
1 parent 4199a55 commit 09c1d29
Show file tree
Hide file tree
Showing 40 changed files with 8,885 additions and 7,097 deletions.
2 changes: 1 addition & 1 deletion jcl/devtools/jpp/jpp.dof
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[Directories]
OutputDir=..
UsePackages=0
SearchPath=..\..\source\include
SearchPath=..\..\source\include;..\..\source\common;..\..\source\windows
2 changes: 1 addition & 1 deletion jcl/devtools/jpp/jppContainers.dof
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[Directories]
OutputDir=..
UsePackages=0
SearchPath=..\..\source\include
SearchPath=..\..\source\include;..\..\source\common;..\..\source\windows
2 changes: 1 addition & 1 deletion jcl/devtools/jpp/jppExceptionDialogs.dof
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[Directories]
OutputDir=..
UsePackages=0
SearchPath=..\..\source\include
SearchPath=..\..\source\include;..\..\source\common;..\..\source\windows
6 changes: 3 additions & 3 deletions jcl/source/common/JclArrayLists.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1136,12 +1136,12 @@ TJclArrayIterator<T> = class(TJclAbstractIterator, IJclIterator<T>, {$IFDEF TH
private
FCursor: Integer;
FStart: TItrStart;
FOwnList: IJclList<T>;
FOwnList: TJclArrayList<T>;
protected
procedure AssignPropertiesTo(Dest: TJclAbstractIterator); override;
function CreateEmptyIterator: TJclAbstractIterator; override;
public
constructor Create(AOwnList: IJclList<T>; ACursor: Integer; AValid: Boolean; AStart: TItrStart);
constructor Create(AOwnList: TJclArrayList<T>; ACursor: Integer; AValid: Boolean; AStart: TItrStart);
{ IJclIterator<T> }
function Add(const AItem: T): Boolean;
procedure Extract;
Expand Down Expand Up @@ -11812,7 +11812,7 @@ procedure TJclArrayList<T>.MoveArray(var List: TDynArray; FromIndex, ToIndex, Co

//=== { TJclArrayIterator<T> } ===============================================================

constructor TJclArrayIterator<T>.Create(AOwnList: IJclList<T>; ACursor: Integer; AValid: Boolean; AStart: TItrStart);
constructor TJclArrayIterator<T>.Create(AOwnList: TJclArrayList<T>; ACursor: Integer; AValid: Boolean; AStart: TItrStart);
begin
inherited Create(AValid);
FOwnList := AOwnList;
Expand Down
78 changes: 39 additions & 39 deletions jcl/source/common/JclBinaryTrees.pas

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions jcl/source/common/JclDateTime.pas
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ function SystemTimeToStr(const SystemTime: TSystemTime): string;
// Filedates
function CreationDateTimeOfFile(const Sr: TSearchRec): TDateTime;
function LastAccessDateTimeOfFile(const Sr: TSearchRec): TDateTime;
function LastWriteDateTimeOfFile(const Sr: TSearchRec): TDateTime;
{$ENDIF MSWINDOWS}
function LastWriteDateTimeOfFile(const Sr: TSearchRec): TDateTime;

type
TJclUnixTime32 = Longword;
Expand Down Expand Up @@ -981,13 +981,17 @@ function LastAccessDateTimeOfFile(const Sr: TSearchRec): TDateTime;
Result := FileTimeToDateTime(Sr.FindData.ftLastAccessTime);
end;

{$ENDIF MSWINDOWS}

function LastWriteDateTimeOfFile(const Sr: TSearchRec): TDateTime;
begin
{$IFDEF MSWINDOWS}
Result := FileTimeToDateTime(Sr.FindData.ftLastWriteTime);
{$ELSE}
Result := Sr.TimeStamp;
{$ENDIF}
end;

{$ENDIF MSWINDOWS}

// Additional format tokens (also available in upper case):
// w: Week no according to ISO
// ww: Week no according to ISO forced two digits
Expand Down
45 changes: 32 additions & 13 deletions jcl/source/common/JclFileUtils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ interface
TCompactPath = ({cpBegin, }cpCenter, cpEnd);

function CharIsDriveLetter(const C: char): Boolean;
function CharIsInvalidFileNameCharacter(const C: Char): Boolean;
function CharIsInvalidPathCharacter(const C: Char): Boolean;

function PathAddSeparator(const Path: string): string;
function PathAddExtension(const Path, Extension: string): string;
Expand Down Expand Up @@ -1049,25 +1051,26 @@ function PathListItemIndex(const List, Item: string): Integer;
// returns the name of the command line parameter at position index, which is
// separated by the given separator, if the first character of the name part
// is one of the AllowedPrefixCharacters, this character will be deleted.
function ParamName (Index : Integer; const Separator : string = '=';
const AllowedPrefixCharacters : string = '-/'; TrimName : Boolean = true) : string;
function ParamName(Index: Integer; const Separator: string = '=';
const AllowedPrefixCharacters: string = '-/'; TrimName: Boolean = True): string;
// returns the value of the command line parameter at position index, which is
// separated by the given separator
function ParamValue (Index : Integer; const Separator : string = '='; TrimValue : Boolean = true) : string; overload;
function ParamValue (Index: Integer; const Separator: string = '='; TrimValue: Boolean = True): string; overload;
// seaches a command line parameter where the namepart is the searchname
// and returns the value which is which by the given separator.
// CaseSensitive defines the search type. if the first character of the name part
// is one of the AllowedPrefixCharacters, this character will be deleted.
function ParamValue (const SearchName : string; const Separator : string = '=';
CaseSensitive : Boolean = False;
const AllowedPrefixCharacters : string = '-/'; TrimValue : Boolean = true) : string; overload;
function ParamValue (const SearchName: string; const Separator: string = '=';
CaseSensitive: Boolean = False;
const AllowedPrefixCharacters: string = '-/'; TrimValue: Boolean = True): string; overload;
// seaches a command line parameter where the namepart is the searchname
// and returns the position index. if no separator is defined, the full paramstr is compared.
// CaseSensitive defines the search type. if the first character of the name part
// is one of the AllowedPrefixCharacters, this character will be deleted.
function ParamPos (const SearchName : string; const Separator : string = '=';
CaseSensitive : Boolean = False;
const AllowedPrefixCharacters : string = '-/'): Integer;
function ParamPos (const SearchName: string; const Separator: string = '=';
CaseSensitive: Boolean = False;
const AllowedPrefixCharacters: string = '-/'): Integer;


{$IFDEF UNITVERSIONING}
const
Expand Down Expand Up @@ -2856,10 +2859,26 @@ function CharIsMachineName(const C: Char): Boolean; {$IFDEF SUPPORTS_INLINE} inl
end;
end;

function CharIsInvalidPathCharacter(const C: Char): Boolean; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF}
function CharIsInvalidFileNameCharacter(const C: Char): Boolean;
begin
case C of
'<', '>', '?', '/', ',', '*', '+', '=', '[', ']', '|', ':', ';', '"', '''':
'<', '>', '?', '/', '\', ',', '*', '+', '=', '[', ']', '|', ':', ';', '"', '''':
Result := True;
else
Result := False;
end;
end;

function CharIsInvalidPathCharacter(const C: Char): Boolean;
begin
case C of
'<', '>', '?',
{$IFDEF UNIX}
'/',
{$ELSE}
'\',
{$ENDIF}
',', '*', '+', '=', '[', ']', '|', ':', ';', '"', '''':
Result := True;
else
Result := False;
Expand Down Expand Up @@ -4893,7 +4912,7 @@ function WindowToModuleFileName(const Window: HWND): string;
if JclCheckWinVersion(6, 0) then // WinVista or newer
begin
DllHinst := LoadLibrary('Kernel32.dll');
if DllHinst < HINSTANCE_ERROR then
if DllHinst <> 0 then
begin
try
{$IFDEF SUPPORTS_UNICODE}
Expand Down Expand Up @@ -4921,7 +4940,7 @@ function WindowToModuleFileName(const Window: HWND): string;
else
begin
DllHinst := LoadLibrary('Psapi.dll');
if DllHinst < HINSTANCE_ERROR then
if DllHinst <> 0 then
begin
try
{$IFDEF SUPPORTS_UNICODE}
Expand Down
6 changes: 3 additions & 3 deletions jcl/source/common/JclLinkedLists.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1210,13 +1210,13 @@ TJclLinkedListIterator<T> = class(TJclAbstractIterator, IJclIterator<T>, {$IFD
private
FCursor: TJclLinkedList<T>.TLinkedListItem;
FStart: TItrStart;
FOwnList: IJclList<T>;
FOwnList: TJclLinkedList<T>;
FEqualityComparer: IJclEqualityComparer<T>;
public
procedure AssignPropertiesTo(Dest: TJclAbstractIterator); override;
function CreateEmptyIterator: TJclAbstractIterator; override;
public
constructor Create(AOwnList: IJclList<T>; ACursor: TJclLinkedList<T>.TLinkedListItem; AValid: Boolean; AStart: TItrStart);
constructor Create(AOwnList: TJclLinkedList<T>; ACursor: TJclLinkedList<T>.TLinkedListItem; AValid: Boolean; AStart: TItrStart);
{ IJclIterator<T> }
function Add(const AItem: T): Boolean;
procedure Extract;
Expand Down Expand Up @@ -17313,7 +17313,7 @@ function TJclLinkedList<T>.SubList(First, Count: Integer): IJclList<T>;

//=== { TJclLinkedListIterator<T> } ============================================================

constructor TJclLinkedListIterator<T>.Create(AOwnList: IJclList<T>; ACursor: TJclLinkedList<T>.TLinkedListItem; AValid: Boolean; AStart: TItrStart);
constructor TJclLinkedListIterator<T>.Create(AOwnList: TJclLinkedList<T>; ACursor: TJclLinkedList<T>.TLinkedListItem; AValid: Boolean; AStart: TItrStart);
begin
inherited Create(AValid);
FCursor := ACursor;
Expand Down
11 changes: 9 additions & 2 deletions jcl/source/common/JclMath.pas
Original file line number Diff line number Diff line change
Expand Up @@ -3326,7 +3326,11 @@ procedure InitExceptObjProc;
{$IFDEF FPC}
PrevExceptObjProc := Pointer(InterlockedExchange(TJclAddr(ExceptObjProc), TJclAddr(@GetExceptionObject)));
{$ELSE ~FPC}
{$IFDEF RTL200_UP} // Delphi 2009+
PrevExceptObjProc := InterlockedExchangePointer(ExceptObjProc, @GetExceptionObject);
{$ELSE}
PrevExceptObjProc := Pointer(InterlockedExchange(Integer(ExceptObjProc), Integer(@GetExceptionObject)));
{$ENDIF RTL200_UP}
{$ENDIF ~FPC}
end;
{$ENDIF ~FPC}
Expand Down Expand Up @@ -3631,8 +3635,11 @@ function TJclRational.IsEqual(const Numerator: Integer; const Denominator: Integ
R: TJclRational;
begin
R := TJclRational.Create(Numerator, Denominator);
Result := IsEqual(R);
R.Free;
try
Result := IsEqual(R);
finally
R.Free;
end;
end;

function TJclRational.IsEqual(const R: TJclRational): Boolean;
Expand Down
8 changes: 4 additions & 4 deletions jcl/source/common/JclPreProcessorBinaryTreesTemplates.pas
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ TJclBinaryTreeIntParams = class(TJclCollectionInterfaceParams)

(* JCLBINARYTREEITRINT(BASEITRCLASSNAME, PREORDERITRCLASSNAME, INORDERITRCLASSNAME, POSTORDERITRCLASSNAME,
STDITRINTERFACENAME, STDTREEITRINTERFACENAME, BINTREEITRINTERFACENAME,
COLLECTIONINTERFACENAME, EQUALITYCOMPARERINTERFACENAME, NODETYPENAME,
TREECLASSNAME, EQUALITYCOMPARERINTERFACENAME, NODETYPENAME,
CONSTKEYWORD, PARAMETERNAME, TYPENAME, GETTERFUNCTIONNAME, SETTERPROCEDURENAME) *)
TJclBinaryTreeItrIntParams = class(TJclContainerInterfaceParams)
protected
Expand All @@ -105,7 +105,7 @@ TJclBinaryTreeItrIntParams = class(TJclContainerInterfaceParams)
property StdItrInterfaceName: string index taIteratorInterfaceName read GetTypeAttribute write SetTypeAttribute stored False;
property StdTreeItrInterfaceName: string index taTreeIteratorInterfaceName read GetTypeAttribute write SetTypeAttribute stored False;
property BinTreeItrInterfaceName: string index taBinaryTreeIteratorInterfaceName read GetTypeAttribute write SetTypeAttribute stored False;
property CollectionInterfaceName: string index taCollectionInterfaceName read GetTypeAttribute write SetTypeAttribute stored False;
property TreeClassName: string index taBinaryTreeClassName read GetTypeAttribute write SetTypeAttribute stored False;
property EqualityComparerInterfaceName: string index taEqualityComparerInterfaceName read GetTypeAttribute write SetTypeAttribute stored False;
property NodeTypeName: string index taBinaryTreeNodeTypeName read GetTypeAttribute write SetTypeAttribute stored False;
property ConstKeyword: string index taConstKeyword read GetTypeAttribute write SetTypeAttribute stored False;
Expand Down Expand Up @@ -155,7 +155,7 @@ TJclBinaryTreeImpParams = class(TJclCollectionImplementationParams)
end;

(* JCLBINARYTREEITRIMP(BASEITRCLASSNAME, PREORDERITRCLASSNAME, INORDERITRCLASSNAME, POSTORDERITRCLASSNAME,
STDITRINTERFACENAME, COLLECTIONINTERFACENAME, EQUALITYCOMPARERINTERFACENAME,
STDITRINTERFACENAME, TREECLASSNAME, EQUALITYCOMPARERINTERFACENAME,
NODETYPENAME, CONSTKEYWORD, PARAMETERNAME, TYPENAME, DEFAULTVALUE,
GETTERFUNCTIONNAME, SETTERPROCEDURENAME, RELEASERFUNCTIONNAME) *)
TJclBinaryTreeItrImpParams = class(TJclContainerImplementationParams)
Expand All @@ -167,7 +167,7 @@ TJclBinaryTreeItrImpParams = class(TJclContainerImplementationParams)
property InOrderItrClassName: string index taBinaryTreeInOrderIteratorClassName read GetTypeAttribute write SetTypeAttribute stored False;
property PostOrderItrClassName: string index taBinaryTreePostOrderIteratorClassName read GetTypeAttribute write SetTypeAttribute stored False;
property StdItrInterfaceName: string index taIteratorInterfaceName read GetTypeAttribute write SetTypeAttribute stored False;
property CollectionInterfaceName: string index taCollectionInterfaceName read GetTypeAttribute write SetTypeAttribute stored False;
property TreeClassName: string index taBinaryTreeClassName read GetTypeAttribute write SetTypeAttribute stored False;
property EqualityComparerInterfaceName: string index taEqualityComparerInterfaceName read GetTypeAttribute write SetTypeAttribute stored False;
property NodeTypeName: string index taBinaryTreeNodeTypeName read GetTypeAttribute write SetTypeAttribute stored False;
property ConstKeyword: string index taConstKeyword read GetTypeAttribute write SetTypeAttribute stored False;
Expand Down
Loading

0 comments on commit 09c1d29

Please sign in to comment.