2
0
Эх сурвалжийг харах

* use unaligned instead some hacking :)

git-svn-id: trunk@11755 -
florian 17 жил өмнө
parent
commit
7c82bbcbcd

+ 10 - 12
packages/fcl-xml/src/xmlread.pp

@@ -405,7 +405,7 @@ type
     procedure ValidateDTD;
     procedure ValidateDTD;
     procedure ValidateRoot;
     procedure ValidateRoot;
     procedure ValidationError(const Msg: string; const args: array of const; LineOffs: Integer = -1);
     procedure ValidationError(const Msg: string; const args: array of const; LineOffs: Integer = -1);
-    procedure DoAttrText(ch: PWideChar; Count: Integer);    
+    procedure DoAttrText(ch: PWideChar; Count: Integer);
     procedure DTDReloadHook;
     procedure DTDReloadHook;
     procedure ConvertSource(SrcIn: TXMLInputSource; out SrcOut: TXMLCharSource);
     procedure ConvertSource(SrcIn: TXMLInputSource; out SrcOut: TXMLCharSource);
     // Some SAX-alike stuff (at a very early stage)
     // Some SAX-alike stuff (at a very early stage)
@@ -657,7 +657,7 @@ begin
     node := Context.ParentNode
     node := Context.ParentNode
   else
   else
     node := Context;
     node := Context;
-  // TODO: replacing document isn't yet supported  
+  // TODO: replacing document isn't yet supported
   if (Action = xaReplaceChildren) and (node.NodeType = DOCUMENT_NODE) then
   if (Action = xaReplaceChildren) and (node.NodeType = DOCUMENT_NODE) then
     raise EDOMNotSupported.Create('DOMParser.ParseWithContext');
     raise EDOMNotSupported.Create('DOMParser.ParseWithContext');
 
 
@@ -951,9 +951,7 @@ begin
   Move(OldBuf^, FCharBuf^, Remainder);
   Move(OldBuf^, FCharBuf^, Remainder);
   BytesRead := FStream.Read(FAllocated[Slack-4], FCapacity);
   BytesRead := FStream.Read(FAllocated[Slack-4], FCapacity);
   FCharBufEnd := FAllocated + (Slack-4) + BytesRead;
   FCharBufEnd := FAllocated + (Slack-4) + BytesRead;
-  // fcharbufend can be unaligned, split.
-  Pchar(FCharBufEnd)^ := #0;
-  Pchar(FCharBufEnd+1)^ := #0;
+  Unaligned(PWideChar(FCharBufEnd)^) := #0;
 end;
 end;
 
 
 { TXMLFileInputSource }
 { TXMLFileInputSource }
@@ -1161,7 +1159,7 @@ begin
       end
       end
     else
     else
       Exit;
       Exit;
-    end;  
+    end;
     GetChar;
     GetChar;
   until False;
   until False;
 end;
 end;
@@ -1452,7 +1450,7 @@ begin
       if (FCurChar = #10) or (FCurChar = #9) or (FCurChar = #13) then
       if (FCurChar = #10) or (FCurChar = #9) or (FCurChar = #13) then
         BufAppend(FValue, #32)  // don't change FCurChar, needed for correct location reporting
         BufAppend(FValue, #32)  // don't change FCurChar, needed for correct location reporting
       else
       else
-        BufAppend(FValue, FCurChar);  
+        BufAppend(FValue, FCurChar);
       GetChar;
       GetChar;
     end
     end
     else
     else
@@ -1481,7 +1479,7 @@ begin
   ParseContent;
   ParseContent;
   if FCurChar <> #0 then
   if FCurChar <> #0 then
     FatalError('End-tag is not allowed here');
     FatalError('End-tag is not allowed here');
-  // SAX: ContentHandler.EndDocument() - here? or somewhere in destructor?  
+  // SAX: ContentHandler.EndDocument() - here? or somewhere in destructor?
 end;
 end;
 
 
 function TXMLReader.ContextPush(AEntity: TDOMEntityEx): Boolean;
 function TXMLReader.ContextPush(AEntity: TDOMEntityEx): Boolean;
@@ -1493,7 +1491,7 @@ begin
     Result := ResolveEntity(AEntity.SystemID, AEntity.PublicID, Src);
     Result := ResolveEntity(AEntity.SystemID, AEntity.PublicID, Src);
     if not Result then
     if not Result then
     begin
     begin
-      // TODO: a detailed message like SysErrorMessage(GetLastError) would be great here 
+      // TODO: a detailed message like SysErrorMessage(GetLastError) would be great here
       ValidationError('Unable to resolve external entity ''%s''', [AEntity.NodeName]);
       ValidationError('Unable to resolve external entity ''%s''', [AEntity.NodeName]);
       Exit;
       Exit;
     end;
     end;
@@ -1539,7 +1537,7 @@ begin
     FSource.Free;
     FSource.Free;
     FSource := Src;
     FSource := Src;
     FCurChar := FSource.FBuf^;
     FCurChar := FSource.FBuf^;
-// correct position of this error is after PE reference      
+// correct position of this error is after PE reference
     if Error then
     if Error then
       BadPENesting(esFatal);
       BadPENesting(esFatal);
   end;
   end;
@@ -1823,7 +1821,7 @@ var
   TmpStr: WideString;
   TmpStr: WideString;
   IsXML11: Boolean;
   IsXML11: Boolean;
 begin
 begin
-  FCurChar := FSource.NextChar;  // don't update location here 
+  FCurChar := FSource.NextChar;  // don't update location here
   ExpectWhitespace;
   ExpectWhitespace;
   // VersionInfo: optional in TextDecl, required in XmlDecl
   // VersionInfo: optional in TextDecl, required in XmlDecl
   if (not TextDecl) or (FCurChar = 'v') then
   if (not TextDecl) or (FCurChar = 'v') then
@@ -2298,7 +2296,7 @@ begin
   begin
   begin
     if not CheckName then
     if not CheckName then
       RaiseNameNotFound;
       RaiseNameNotFound;
-    ExpectChar(';');  
+    ExpectChar(';');
     if FSource.DTDSubsetType = dsInternal then
     if FSource.DTDSubsetType = dsInternal then
       FatalError('PE reference not allowed here in internal subset', FName.Length+2);
       FatalError('PE reference not allowed here in internal subset', FName.Length+2);
     StartPE;
     StartPE;