TParadoxDataset: Fix FieldType ftBytes. Avoid crash when RecordCount = 0.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6902 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
8cb6af3458
commit
c2d7bafd8b
@ -406,7 +406,6 @@ begin
|
|||||||
FreeMem(FaBlock);
|
FreeMem(FaBlock);
|
||||||
FreeAndNil(FBlobStream);
|
FreeAndNil(FBlobStream);
|
||||||
FreeAndNil(FStream);
|
FreeAndNil(FStream);
|
||||||
FHeader := nil;
|
|
||||||
FActive := False;
|
FActive := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -444,7 +443,7 @@ begin
|
|||||||
pxfTimestamp: FieldDefs.Add(fname, ftDateTime, 0);
|
pxfTimestamp: FieldDefs.Add(fname, ftDateTime, 0);
|
||||||
pxfAutoInc: FieldDefs.Add(fname, ftAutoInc, F^.fSize);
|
pxfAutoInc: FieldDefs.Add(fname, ftAutoInc, F^.fSize);
|
||||||
pxfBCD: FieldDefs.Add(fname, ftBCD, F^.fSize);
|
pxfBCD: FieldDefs.Add(fname, ftBCD, F^.fSize);
|
||||||
pxfBytes: FieldDefs.Add(fname, ftString, F^.fSize);
|
pxfBytes: FieldDefs.Add(fname, ftBytes, F^.fSize); // was: ftString
|
||||||
end;
|
end;
|
||||||
inc(FNamesStart, Length(fname)+1);
|
inc(FNamesStart, Length(fname)+1);
|
||||||
inc(F);
|
inc(F);
|
||||||
@ -636,8 +635,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TParadoxDataSet.GetFieldData(Field: TField; Buffer: Pointer): Boolean;
|
function TParadoxDataSet.GetFieldData(Field: TField; Buffer: Pointer): Boolean;
|
||||||
type
|
|
||||||
TNRec= array[0..16] of byte;
|
|
||||||
var
|
var
|
||||||
b: WordBool;
|
b: WordBool;
|
||||||
F: PFldInfoRec;
|
F: PFldInfoRec;
|
||||||
@ -651,6 +648,9 @@ var
|
|||||||
str: String;
|
str: String;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
if (RecordCount = 0) then
|
||||||
|
exit;
|
||||||
|
|
||||||
F := FFieldInfoPtr; { begin with the first field identifier }
|
F := FFieldInfoPtr; { begin with the first field identifier }
|
||||||
p := ActiveBuffer;
|
p := ActiveBuffer;
|
||||||
for i := 1 to FHeader^.numFields do
|
for i := 1 to FHeader^.numFields do
|
||||||
@ -682,8 +682,14 @@ begin
|
|||||||
pxfAlpha:
|
pxfAlpha:
|
||||||
if (Buffer <> nil) then begin
|
if (Buffer <> nil) then begin
|
||||||
str := ConvertEncoding(StrPas(p), FInputEncoding, FTargetEncoding);
|
str := ConvertEncoding(StrPas(p), FInputEncoding, FTargetEncoding);
|
||||||
StrLCopy(Buffer, PChar(str), Length(str));
|
if str <> '' then begin
|
||||||
// StrLCopy(Buffer, p, Field.Size);
|
StrLCopy(Buffer, PChar(str), Length(str));
|
||||||
|
Result := true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
pxfBytes:
|
||||||
|
if Buffer <> nil then begin
|
||||||
|
StrLCopy(Buffer, PAnsiChar(p), F^.fSize);
|
||||||
Result := true;
|
Result := true;
|
||||||
end;
|
end;
|
||||||
pxfDate:
|
pxfDate:
|
||||||
|
Loading…
Reference in New Issue
Block a user