Skip to content

Commit 94c1c4d

Browse files
committed
Merge branch 'release/2.2.3'
Release v2.2.3
2 parents fe49f80 + 1d9972a commit 94c1c4d

27 files changed

+695
-18
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ From v2.0.0 all notable changes to this project will be documented in this file.
88
99
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1010

11+
## v2.2.3 of 2025/04/03
12+
13+
* Added results of compiling with Delphi 12 for all snippets with no pre-existing compile results for that compiler (issue [#27](https://github.com/delphidabbler/code-snippets/issues/27)).
14+
* Fixed memory leak in the `CountOccurences` function (issue [#54](https://github.com/delphidabbler/code-snippets/issues/54)).
15+
* Updated `GetGIFSize` function to work around a deprecated warning with Delphi 12 and some earlier compilers because of a call to `SysUtils.StrLComp` which has been moved to the `AnsiStrings` unit (issue [#52](https://github.com/delphidabbler/code-snippets/issues/52)).
16+
1117
## v2.2.2 of 2025/01/19
1218

1319
* New snippets were added to the _Arrays_ and _Mathematics_ categories:

collection/222.dat

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ type
1515
Flags: Byte; // flags and local colour table size
1616
end;
1717
const
18-
cSignature: PAnsiChar = 'GIF'; // gif image signature
19-
cImageSep = $2C; // image separator byte
18+
cSignature = 'GIF'; // gif image signature
19+
cImageSep = $2C; // image separator byte
2020
var
2121
FS: Classes.TFileStream; // stream onto gif file
2222
Header: TGIFHeader; // gif header record
@@ -37,7 +37,7 @@ begin
3737
// Check signature
3838
BytesRead := FS.Read(Header, SizeOf(Header));
3939
if (BytesRead <> SizeOf(TGIFHeader)) or
40-
(SysUtils.StrLComp(cSignature, Header.Sig, 3) <> 0) then
40+
(Copy(Header.sig, 1, 3) <> cSignature) then
4141
// Invalid file format
4242
Exit;
4343
// Skip colour map, if there is one

collection/699.dat

+9-7
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ var
77

88
procedure SortResult(
99
var A: array of Generics.Collections.TPair<Integer,Cardinal>);
10-
begin
11-
Generics.Collections.TArray.Sort<
10+
var
11+
Comparer: Generics.Defaults.IComparer<
1212
Generics.Collections.TPair<Integer,Cardinal>
13-
>(
14-
A,
15-
Generics.Defaults.TDelegatedComparer<
13+
>;
14+
begin
15+
Comparer := Generics.Defaults.TDelegatedComparer<
1616
Generics.Collections.TPair<Integer,Cardinal>
1717
>.Create(
1818
function (
@@ -21,8 +21,10 @@ var
2121
begin
2222
Result := Left.Key - Right.Key;
2323
end
24-
)
25-
);
24+
);
25+
Generics.Collections.TArray.Sort<
26+
Generics.Collections.TPair<Integer,Cardinal>
27+
>(A, Comparer);
2628
end;
2729

2830
begin

collection/VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.2
1+
2.2.3

collection/arrays.ini

+15
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ DelphiXE2=Y
2626
DelphiXE3=Y
2727
DelphiXE4=Y
2828
Delphi10S=Y
29+
Delphi12A=Y
2930
FPC=Y
3031

3132
[ByteArraysEqual]
@@ -48,6 +49,7 @@ DelphiXE2=Y
4849
DelphiXE3=Y
4950
DelphiXE4=Y
5051
Delphi10S=Y
52+
Delphi12A=Y
5153
FPC=Y
5254

5355
[ByteArraysSameStart]
@@ -70,6 +72,7 @@ DelphiXE2=Y
7072
DelphiXE3=Y
7173
DelphiXE4=Y
7274
Delphi10S=Y
75+
Delphi12A=Y
7376
FPC=Y
7477

7578
[IndexOfByte]
@@ -92,6 +95,7 @@ DelphiXE2=Y
9295
DelphiXE3=Y
9396
DelphiXE4=Y
9497
Delphi10S=Y
98+
Delphi12A=Y
9599
FPC=Y
96100

97101
[LastIndexOfByte]
@@ -114,6 +118,7 @@ DelphiXE2=Y
114118
DelphiXE3=Y
115119
DelphiXE4=Y
116120
Delphi10S=Y
121+
Delphi12A=Y
117122
FPC=Y
118123

119124
[StringListToArray]
@@ -137,6 +142,7 @@ DelphiXE2=Y
137142
DelphiXE3=Y
138143
DelphiXE4=Y
139144
Delphi10S=Y
145+
Delphi12A=Y
140146
FPC=Y
141147

142148
[AppendByteArray]
@@ -160,6 +166,7 @@ DelphiXE2=Y
160166
DelphiXE3=Y
161167
DelphiXE4=Y
162168
Delphi10S=Y
169+
Delphi12A=Y
163170
FPC=Y
164171

165172
[ChopByteArray]
@@ -183,6 +190,7 @@ DelphiXE2=Y
183190
DelphiXE3=Y
184191
DelphiXE4=Y
185192
Delphi10S=Y
193+
Delphi12A=Y
186194
FPC=Y
187195

188196
[CloneByteArray]
@@ -207,6 +215,7 @@ DelphiXE2=Y
207215
DelphiXE3=Y
208216
DelphiXE4=Y
209217
Delphi10S=Y
218+
Delphi12A=Y
210219
FPC=Y
211220

212221
[ConcatByteArrays]
@@ -230,6 +239,7 @@ DelphiXE2=Y
230239
DelphiXE3=Y
231240
DelphiXE4=Y
232241
Delphi10S=Y
242+
Delphi12A=Y
233243
FPC=Y
234244

235245
[PopByteArray]
@@ -253,6 +263,7 @@ DelphiXE2=Y
253263
DelphiXE3=Y
254264
DelphiXE4=Y
255265
Delphi10S=Y
266+
Delphi12A=Y
256267
FPC=Y
257268

258269
[PushByteArray]
@@ -276,6 +287,7 @@ DelphiXE2=Y
276287
DelphiXE3=Y
277288
DelphiXE4=Y
278289
Delphi10S=Y
290+
Delphi12A=Y
279291
FPC=Y
280292

281293
[ShiftByteArray]
@@ -299,6 +311,7 @@ DelphiXE2=Y
299311
DelphiXE3=Y
300312
DelphiXE4=Y
301313
Delphi10S=Y
314+
Delphi12A=Y
302315
FPC=Y
303316

304317
[SliceByteArray]
@@ -322,6 +335,7 @@ DelphiXE2=Y
322335
DelphiXE3=Y
323336
DelphiXE4=Y
324337
Delphi10S=Y
338+
Delphi12A=Y
325339
FPC=Y
326340

327341
[UnShiftByteArray]
@@ -345,6 +359,7 @@ DelphiXE2=Y
345359
DelphiXE3=Y
346360
DelphiXE4=Y
347361
Delphi10S=Y
362+
Delphi12A=Y
348363
FPC=Y
349364

350365
[TArrayUtils]

collection/consts.ini

+1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ DelphiXE2=Y
2828
DelphiXE3=Y
2929
DelphiXE4=Y
3030
Delphi10S=Y
31+
Delphi12A=Y
3132
FPC=Y

0 commit comments

Comments
 (0)