Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | fix GPF introduced with latest commit for Delphi <2007 |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b678666282e3fb3d1882222356404154 |
User & Date: | User 2013-02-24 16:18:58 |
2013-02-25
| ||
09:59 | SynBigTable unit fixed and tested with Delphi XE2/XE3 64-bit compiler check-in: 746545bcd5 user: abouchez tags: trunk | |
2013-02-24
| ||
16:18 | fix GPF introduced with latest commit for Delphi <2007 check-in: b678666282 user: User tags: trunk | |
15:43 | fixed and tested 64 bit compilation under Windows with Delphi XE3 - first step, including SynCommons and low-level process [4b11d85be2] check-in: dc441f2a68 user: User tags: trunk | |
Changes to SynCommons.pas.
9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 ..... 19437 19438 19439 19440 19441 19442 19443 19444 19445 19446 19447 19448 19449 19450 19451 19452 19453 19454 19455 19456 19457 19458 19459 19460 19461 ..... 20552 20553 20554 20555 20556 20557 20558 20559 20560 20561 20562 20563 20564 20565 20566 ..... 20574 20575 20576 20577 20578 20579 20580 20581 20582 20583 20584 20585 20586 20587 20588 ..... 20640 20641 20642 20643 20644 20645 20646 20647 20648 20649 20650 20651 20652 20653 20654 |
/// length in characters // - size in bytes = length*elemSize length: Longint; end; /// map the Delphi dynamic array header TDynArrayRec = packed record {$ifdef CPUX64} _Padding: LongInt; // Delphi XE2+ expects 16 byte align {$endif} /// dynamic array reference count (basic garbage memory mechanism) refCnt: Longint; {$ifdef FPC} high: sizeint; function length: sizeint; inline; {$else} /// length in element count // - size in bytes = length*ElemSize length: NativeInt; {$endif} end; const /// codePage offset = string header size // - used to calc the beginning of memory allocation of a string STRRECSIZE = SizeOf(TStrRec); ................................................................................ result := nil; if (Value=nil) or (Value^=nil) then exit; if fCountP<>nil then begin if cardinal(aIndex)>=PCardinal(fCountP)^ then exit; end else if cardinal(aIndex)>=PCardinal(PtrUInt(Value^)-sizeof(NativeInt))^ then exit; result := pointer(PtrUInt(Value^)+PtrUInt(aIndex)*ElemSize); end; function TDynArray.GetCount: integer; begin if Value<>nil then if fCountP=nil then if PtrInt(Value^)<>0 then result := PInteger(PtrUInt(Value^)-sizeof(NativeInt))^ else result := 0 else result := fCountP^ else result := 0; // avoid GPF if void end; procedure Exchg(P1,P2: PAnsiChar; max: integer); var c: AnsiChar; ................................................................................ exit; fCountP^ := aCount; if PtrInt(Value^)=0 then begin // no capa yet if (delta>0) and (aCount<64) then aCount := 64; // reserve some minimal space for Add() end else begin capa := PInteger(PtrInt(Value^)-sizeof(NativeInt))^; if delta>0 then begin // size-up -> grow by chunks if capa>=fCountP^ then exit; // no need to grow Inc(capa,capa shr 2); if capa<fCountP^ then aCount := fCountP^ else ................................................................................ // no external Count, array size-down or array up-grow -> realloc InternalSetLength(aCount); end; function TDynArray.GetCapacity: integer; begin // capacity := length(DynArray) if (Value<>nil) and (PtrInt(Value^)<>0) then result := PInteger(PtrInt(Value^)-sizeof(NativeInt))^ else result := 0; end; procedure TDynArray.SetCapacity(aCapacity: integer); begin if Value=nil then exit; // avoid GPF if void ................................................................................ PS,PD: pointer; begin if Value=nil then exit; // avoid GPF if void D := @DynArray; if D^=nil then n := 0 else n := PInteger(PtrUInt(D^)-sizeof(NativeInt))^; if aStartIndex>=n then exit; // nothing to copy if cardinal(aStartIndex+aCount)>cardinal(n) then aCount := n-aStartIndex; if aCount<=0 then exit; n := Count; |
| | | | | | | |
9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 ..... 19437 19438 19439 19440 19441 19442 19443 19444 19445 19446 19447 19448 19449 19450 19451 19452 19453 19454 19455 19456 19457 19458 19459 19460 19461 ..... 20552 20553 20554 20555 20556 20557 20558 20559 20560 20561 20562 20563 20564 20565 20566 ..... 20574 20575 20576 20577 20578 20579 20580 20581 20582 20583 20584 20585 20586 20587 20588 ..... 20640 20641 20642 20643 20644 20645 20646 20647 20648 20649 20650 20651 20652 20653 20654 |
/// length in characters // - size in bytes = length*elemSize length: Longint; end; /// map the Delphi dynamic array header TDynArrayRec = packed record {$ifdef CPUX64} _Padding: LongInt; // Delphi XE2+ expects 16 byte align {$endif} /// dynamic array reference count (basic garbage memory mechanism) refCnt: Longint; {$ifdef FPC} high: sizeint; function length: sizeint; inline; {$else} /// length in element count // - size in bytes = length*ElemSize length: PtrInt; {$endif} end; const /// codePage offset = string header size // - used to calc the beginning of memory allocation of a string STRRECSIZE = SizeOf(TStrRec); ................................................................................ result := nil; if (Value=nil) or (Value^=nil) then exit; if fCountP<>nil then begin if cardinal(aIndex)>=PCardinal(fCountP)^ then exit; end else if cardinal(aIndex)>=PCardinal(PtrUInt(Value^)-sizeof(PtrInt))^ then exit; result := pointer(PtrUInt(Value^)+PtrUInt(aIndex)*ElemSize); end; function TDynArray.GetCount: integer; begin if Value<>nil then if fCountP=nil then if PtrInt(Value^)<>0 then result := PInteger(PtrUInt(Value^)-sizeof(PtrInt))^ else result := 0 else result := fCountP^ else result := 0; // avoid GPF if void end; procedure Exchg(P1,P2: PAnsiChar; max: integer); var c: AnsiChar; ................................................................................ exit; fCountP^ := aCount; if PtrInt(Value^)=0 then begin // no capa yet if (delta>0) and (aCount<64) then aCount := 64; // reserve some minimal space for Add() end else begin capa := PInteger(PtrInt(Value^)-sizeof(PtrInt))^; if delta>0 then begin // size-up -> grow by chunks if capa>=fCountP^ then exit; // no need to grow Inc(capa,capa shr 2); if capa<fCountP^ then aCount := fCountP^ else ................................................................................ // no external Count, array size-down or array up-grow -> realloc InternalSetLength(aCount); end; function TDynArray.GetCapacity: integer; begin // capacity := length(DynArray) if (Value<>nil) and (PtrInt(Value^)<>0) then result := PInteger(PtrInt(Value^)-sizeof(PtrInt))^ else result := 0; end; procedure TDynArray.SetCapacity(aCapacity: integer); begin if Value=nil then exit; // avoid GPF if void ................................................................................ PS,PD: pointer; begin if Value=nil then exit; // avoid GPF if void D := @DynArray; if D^=nil then n := 0 else n := PInteger(PtrUInt(D^)-sizeof(PtrInt))^; if aStartIndex>=n then exit; // nothing to copy if cardinal(aStartIndex+aCount)>cardinal(n) then aCount := n-aStartIndex; if aCount<=0 then exit; n := Count; |