|
@@ -1358,8 +1358,7 @@ end;
|
|
function TStringList.Get(Index: Integer): string;
|
|
function TStringList.Get(Index: Integer): string;
|
|
|
|
|
|
begin
|
|
begin
|
|
- If (Index<0) or (INdex>=Fcount) then
|
|
|
|
- Error (SListIndexError,Index);
|
|
|
|
|
|
+ CheckIndex(Index);
|
|
Result:=Flist^[Index].FString;
|
|
Result:=Flist^[Index].FString;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -1384,8 +1383,7 @@ end;
|
|
function TStringList.GetObject(Index: Integer): TObject;
|
|
function TStringList.GetObject(Index: Integer): TObject;
|
|
|
|
|
|
begin
|
|
begin
|
|
- If (Index<0) or (INdex>=Fcount) then
|
|
|
|
- Error (SListIndexError,Index);
|
|
|
|
|
|
+ CheckIndex(Index);
|
|
Result:=Flist^[Index].FObject;
|
|
Result:=Flist^[Index].FObject;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -1396,8 +1394,7 @@ procedure TStringList.Put(Index: Integer; const S: string);
|
|
begin
|
|
begin
|
|
If Sorted then
|
|
If Sorted then
|
|
Error(SSortedListError,0);
|
|
Error(SSortedListError,0);
|
|
- If (Index<0) or (INdex>=Fcount) then
|
|
|
|
- Error (SListIndexError,Index);
|
|
|
|
|
|
+ CheckIndex(Index);
|
|
Changing;
|
|
Changing;
|
|
Flist^[Index].FString:=S;
|
|
Flist^[Index].FString:=S;
|
|
Changed;
|
|
Changed;
|
|
@@ -1408,8 +1405,7 @@ end;
|
|
procedure TStringList.PutObject(Index: Integer; AObject: TObject);
|
|
procedure TStringList.PutObject(Index: Integer; AObject: TObject);
|
|
|
|
|
|
begin
|
|
begin
|
|
- If (Index<0) or (INdex>=Fcount) then
|
|
|
|
- Error (SListIndexError,Index);
|
|
|
|
|
|
+ CheckIndex(Index);
|
|
Changing;
|
|
Changing;
|
|
Flist^[Index].FObject:=AObject;
|
|
Flist^[Index].FObject:=AObject;
|
|
Changed;
|
|
Changed;
|
|
@@ -1508,8 +1504,7 @@ end;
|
|
procedure TStringList.Delete(Index: Integer);
|
|
procedure TStringList.Delete(Index: Integer);
|
|
|
|
|
|
begin
|
|
begin
|
|
- If (Index<0) or (Index>=FCount) then
|
|
|
|
- Error(SlistINdexError,Index);
|
|
|
|
|
|
+ CheckIndex(Index);
|
|
Changing;
|
|
Changing;
|
|
Flist^[Index].FString:='';
|
|
Flist^[Index].FString:='';
|
|
if FOwnsObjects then
|
|
if FOwnsObjects then
|
|
@@ -1527,10 +1522,8 @@ end;
|
|
procedure TStringList.Exchange(Index1, Index2: Integer);
|
|
procedure TStringList.Exchange(Index1, Index2: Integer);
|
|
|
|
|
|
begin
|
|
begin
|
|
- If (Index1<0) or (Index1>=FCount) then
|
|
|
|
- Error(SListIndexError,Index1);
|
|
|
|
- If (Index2<0) or (Index2>=FCount) then
|
|
|
|
- Error(SListIndexError,Index2);
|
|
|
|
|
|
+ CheckIndex(Index1);
|
|
|
|
+ CheckIndex(Index2);
|
|
Changing;
|
|
Changing;
|
|
ExchangeItemsInt(Index1,Index2);
|
|
ExchangeItemsInt(Index1,Index2);
|
|
changed;
|
|
changed;
|
|
@@ -1561,6 +1554,12 @@ begin
|
|
FSortStyle:=AValue;
|
|
FSortStyle:=AValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TStringList.CheckIndex(AIndex: Integer);
|
|
|
|
+begin
|
|
|
|
+ If (AIndex<0) or (AIndex>=FCount) then
|
|
|
|
+ Error(SListIndexError,AIndex);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
|
|
function TStringList.DoCompareText(const s1, s2: string): PtrInt;
|
|
function TStringList.DoCompareText(const s1, s2: string): PtrInt;
|
|
begin
|
|
begin
|
|
@@ -1629,10 +1628,10 @@ begin
|
|
If SortStyle=sslAuto then
|
|
If SortStyle=sslAuto then
|
|
Error (SSortedListError,0)
|
|
Error (SSortedListError,0)
|
|
else
|
|
else
|
|
- If (Index<0) or (Index>FCount) then
|
|
|
|
- Error (SListIndexError,Index)
|
|
|
|
- else
|
|
|
|
- InsertItem (Index,S);
|
|
|
|
|
|
+ begin
|
|
|
|
+ CheckIndex(Index);
|
|
|
|
+ InsertItem (Index,S);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|