Browse Source

* Undid previous patch, because not all compiles

git-svn-id: trunk@13603 -
michael 16 years ago
parent
commit
f853ac4c63
3 changed files with 16 additions and 40 deletions
  1. 9 15
      packages/fcl-xml/src/dom.pp
  2. 5 21
      packages/fcl-xml/src/xmlutils.pp
  3. 2 4
      packages/fcl-xml/src/xmlwrite.pp

+ 9 - 15
packages/fcl-xml/src/dom.pp

@@ -43,10 +43,6 @@ uses
 // -------------------------------------------------------
 //   DOMException
 // -------------------------------------------------------
-{$ifndef fpc}
-type
-  tFpList = tList;
-{$endif}
 
 const
 
@@ -105,8 +101,6 @@ type
   TDOMAttrDef = class;
   PNodePool = ^TNodePool;
   TNodePool = class;
-  TTabNodePool = array[0..0] of TNodePool;
-  PTabNodePool = ^TTabNodePool;
 
 
 // -------------------------------------------------------
@@ -436,7 +430,7 @@ type
     FEmptyNode: TDOMElement;
     FNodeLists: THashTable;
     FMaxPoolSize: Integer;
-    FPools: PTabNodePool;
+    FPools: PNodePool;
     FDocumentURI: DOMString;
     function GetDocumentElement: TDOMElement;
     function GetDocType: TDOMDocumentType;
@@ -3173,24 +3167,24 @@ var
   sz: Integer;
 begin
   ext := FCurrExtent;
-  ptrInt(ptr) := ptrInt(FCurrBlock) + FElementSize;
+  ptr := Pointer(FCurrBlock) + FElementSize;
   sz := FCurrExtentSize;
   while Assigned(ext) do
   begin
     // call destructors for everyone still there
-    ptrInt(ptr_end) := ptrInt(ext) + sizeof(TExtent) + (sz - 1) * FElementSize;
-    while ptrInt(ptr) <= ptrInt(ptr_end) do
+    ptr_end := Pointer(ext) + sizeof(TExtent) + (sz - 1) * FElementSize;
+    while ptr <= ptr_end do
     begin
       if TDOMNode(ptr).FPool = Self then
         TObject(ptr).Destroy;
-      Inc(ptrInt(ptr), FElementSize);
+      Inc(ptr, FElementSize);
     end;
     // dispose the extent and pass to the next one
     next := ext^.Next;
     FreeMem(ext);
     ext := next;
     sz := sz div 2;
-    ptrInt(ptr) := ptrInt(ext) + sizeof(TExtent);
+    ptr := Pointer(ext) + sizeof(TExtent);
   end;
   inherited Destroy;
 end;
@@ -3200,13 +3194,13 @@ var
   ext: PExtent;
 begin
   Assert((FCurrExtent = nil) or
-    (ptrInt(FCurrBlock) = ptrInt(FCurrExtent) + sizeof(TExtent)));
+    (Pointer(FCurrBlock) = Pointer(FCurrExtent) + sizeof(TExtent)));
   Assert(AElemCount > 0);
 
   GetMem(ext, sizeof(TExtent) + AElemCount * FElementSize);
   ext^.Next := FCurrExtent;
   // point to the beginning of the last block of extent
-  FCurrBlock := TDOMNode(ptrInt(ext) + sizeof(TExtent) + (AElemCount - 1) * FElementSize);
+  FCurrBlock := TDOMNode(Pointer(ext) + sizeof(TExtent) + (AElemCount - 1) * FElementSize);
   FCurrExtent := ext;
   FCurrExtentSize := AElemCount;
 end;
@@ -3220,7 +3214,7 @@ begin
   end
   else
   begin
-    if ptrInt(FCurrBlock) = ptrInt(FCurrExtent) + sizeof(TExtent) then
+    if Pointer(FCurrBlock) = Pointer(FCurrExtent) + sizeof(TExtent) then
       AddExtent(FCurrExtentSize * 2);
     Result := FCurrBlock;
     Dec(PChar(FCurrBlock), FElementSize);

+ 5 - 21
packages/fcl-xml/src/xmlutils.pp

@@ -14,20 +14,14 @@
  **********************************************************************}
 unit xmlutils;
 
-{$ifdef fpc}
-{$MODE objfpc}{$H+}
-{$endif}
+{$mode objfpc}
+{$H+}
 
 interface
 
 uses
   SysUtils;
 
- {$IFNDEF FPC}
-
-type   ptrint=integer;
-{$ENDIF} 
-
 function IsXmlName(const Value: WideString; Xml11: Boolean = False): Boolean; overload;
 function IsXmlName(Value: PWideChar; Len: Integer; Xml11: Boolean = False): Boolean; overload;
 function IsXmlNames(const Value: WideString; Xml11: Boolean = False): Boolean;
@@ -44,7 +38,6 @@ function WStrLIComp(S1, S2: PWideChar; Len: Integer): Integer;
 { a simple hash table with WideString keys }
 
 type
-  PTabPHashItem = ^TTabPHashItem;
   PPHashItem = ^PHashItem;
   PHashItem = ^THashItem;
   THashItem = record
@@ -53,7 +46,6 @@ type
     Next: PHashItem;
     Data: TObject;
   end;
-  TTabPHashItem = array[0..0] of pHashItem;
 
   THashForEach = function(Entry: PHashItem; arg: Pointer): Boolean;
 
@@ -61,7 +53,7 @@ type
   private
     FCount: LongWord;
     FBucketCount: LongWord;
-    FBucket: PTabPHashItem;
+    FBucket: PPHashItem;
     FOwnsObjects: Boolean;
     function Lookup(Key: PWideChar; KeyLength: Integer; var Found: Boolean; CanCreate: Boolean): PHashItem;
     procedure Resize(NewCapacity: LongWord);
@@ -90,15 +82,12 @@ type
     lname: PWideChar;
     lnameLen: Integer;
   end;
-  PTabExpHashEntry = ^TTabExpHashEntry;
-  tTabExpHashEntry = array[0..0] of   TExpHashEntry;
-
 
   TDblHashArray = class(TObject)
   private
     FSizeLog: Integer;
     FRevision: LongWord;
-    FData: PTabExpHashEntry;
+    FData: PExpHashEntry;
   public  
     procedure Init(NumSlots: Integer);
     function Locate(uri: PWideString; localName: PWideChar; localLength: Integer): Boolean;
@@ -358,11 +347,7 @@ end;
 
 function KeyCompare(const Key1: WideString; Key2: Pointer; Key2Len: Integer): Boolean;
 begin
-  {$IFDEF FPC}
   Result := (Length(Key1)=Key2Len) and (CompareWord(Pointer(Key1)^, Key2^, Key2Len) = 0);
-  {$ELSE}
-  Result := comparemem(Pointer(Key1),key2,key2len*2);
-  {$ENDIF}
 end;
 
 { THashTable }
@@ -476,8 +461,7 @@ end;
 
 procedure THashTable.Resize(NewCapacity: LongWord);
 var
-  p    : PTabPHashItem;
-  chain: PPHashItem;
+  p, chain: PPHashItem;
   i: Integer;
   e, n: PHashItem;
 begin

+ 2 - 4
packages/fcl-xml/src/xmlwrite.pp

@@ -17,10 +17,8 @@
 
 unit XMLWrite;
 
-
-{$ifdef fpc}
-{$MODE objfpc}{$H+}
-{$endif}
+{$MODE objfpc}
+{$H+}
 
 interface