Using svn 14579 0.9.25 (2008-03-19) i386 carbon with Leopard 10.5.2.
I transferred few files from Delphi/windows. I have the following record:
{$PACKRECORDS 1}
TSyndRec=record
ID:integer;
Name:string[150];
Tipul:array[0..1600] of char;
Etiology:array[0..2450] of char;
Tzuna:array[0..1200] of char;
Shita:array[0..1450] of char;
Pathology:array[0..3000] of char;
kat:byte;
rem:string[10];
Admin,IsFromUser:boolean;
end;
One function I use to read the file is:
function GetPathology(ID:integer):string;
begin
result:='';
assignfile(f,FName);
{$I-} reset(f); {$I+}
if IOResult<>0 then exit;
while not eof(f) do
begin
read(f,SyndRec);
if SyndRec.ID=ID then
begin
result:=SyndRec.Pathology;
break;
end;
end;
closefile(f);
end;
Usually this seams to work fine, but for some records I get the "external: EXEC_BAD_ACCESS" error. Then I get the execution paused message with "CFStringGetLength", and the compiler is stopped at the following function in the CarbonEdits unit:
function TCarbonControlWithEdit.SetText(const S: String): Boolean;
var
CFString: CFStringRef;
begin
Result := False;
if GetEditPart < 0 then Exit;
CreateCFString(S, CFString);
try
if OSError(
SetControlData(ControlRef(Widget), GetEditPart, kControlEditTextCFStringTag,
SizeOf(CFStringRef), @CFString), // --> compiler breaks on this line
Self, SSetText, SSetData) then Exit;
Result := True;
finally
FreeCFString(CFString);
end;
end;
The data is read into the record but seems to fail when using the string it was converted to. I can't find any strange characters in these records. Maybe a comma ( ' / " ) might cause a bug on the CFString although it is accepted with Delphi on windows?
Any idea what it might be, and more important, how to solve it?
Thanks.