You've already forked lazarus-ccr
iphonelazext: skip IDs that are already in use, when writeing pbx container file
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4593 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -748,21 +748,41 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function GetNextID(hash: TFPHashObjectList; var id: Int64): string;
|
||||||
|
begin
|
||||||
|
repeat
|
||||||
|
Result:=IntToHex(id, 24);
|
||||||
|
inc(id);
|
||||||
|
until not Assigned(hash.Find(Result));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure PBXAssignRef(list: TList);
|
procedure PBXAssignRef(list: TList);
|
||||||
var
|
var
|
||||||
i : Integer;
|
i : Integer;
|
||||||
p : PBXObject;
|
p : PBXObject;
|
||||||
id: Int64;
|
id: Int64;
|
||||||
|
usedid: TFPHashObjectList;
|
||||||
begin
|
begin
|
||||||
if not Assigned(list) then Exit;
|
if not Assigned(list) then Exit;
|
||||||
id:=2; // root! :)
|
usedid:=TFPHashObjectList.Create(false);
|
||||||
for i:=0 to list.Count-1 do begin
|
try
|
||||||
p:=PBXObject(list[i]);
|
for i:=0 to list.Count-1 do begin
|
||||||
if not Assigned(p) then Continue;
|
p:=PBXObject(list[i]);
|
||||||
if (p._id='') then begin
|
if p._id<>'' then usedid.Add(p._id, p);;
|
||||||
p._id:=IntToHex(id, 24);
|
|
||||||
inc(id);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
id:=2; // root! :)
|
||||||
|
for i:=0 to list.Count-1 do begin
|
||||||
|
p:=PBXObject(list[i]);
|
||||||
|
if not Assigned(p) then Continue;
|
||||||
|
if (p._id='') then begin
|
||||||
|
p._id:=GetNextID(usedid, id);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
usedid.Free;
|
||||||
end;
|
end;
|
||||||
// 0AFA6EA519F60EFD004C8FD9
|
// 0AFA6EA519F60EFD004C8FD9
|
||||||
// 123456789012345678901234
|
// 123456789012345678901234
|
||||||
|
Reference in New Issue
Block a user