diff --git a/packages/fcl-xml/src/xmlread.pp b/packages/fcl-xml/src/xmlread.pp index 0f383b2f6f..f5e1195da2 100644 --- a/packages/fcl-xml/src/xmlread.pp +++ b/packages/fcl-xml/src/xmlread.pp @@ -405,7 +405,7 @@ type procedure ValidateDTD; procedure ValidateRoot; 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 ConvertSource(SrcIn: TXMLInputSource; out SrcOut: TXMLCharSource); // Some SAX-alike stuff (at a very early stage) @@ -657,7 +657,7 @@ begin node := Context.ParentNode else 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 raise EDOMNotSupported.Create('DOMParser.ParseWithContext'); @@ -951,9 +951,7 @@ begin Move(OldBuf^, FCharBuf^, Remainder); BytesRead := FStream.Read(FAllocated[Slack-4], FCapacity); FCharBufEnd := FAllocated + (Slack-4) + BytesRead; - // fcharbufend can be unaligned, split. - Pchar(FCharBufEnd)^ := #0; - Pchar(FCharBufEnd+1)^ := #0; + Unaligned(PWideChar(FCharBufEnd)^) := #0; end; { TXMLFileInputSource } @@ -1161,7 +1159,7 @@ begin end else Exit; - end; + end; GetChar; until False; end; @@ -1452,7 +1450,7 @@ begin if (FCurChar = #10) or (FCurChar = #9) or (FCurChar = #13) then BufAppend(FValue, #32) // don't change FCurChar, needed for correct location reporting else - BufAppend(FValue, FCurChar); + BufAppend(FValue, FCurChar); GetChar; end else @@ -1481,7 +1479,7 @@ begin ParseContent; if FCurChar <> #0 then FatalError('End-tag is not allowed here'); - // SAX: ContentHandler.EndDocument() - here? or somewhere in destructor? + // SAX: ContentHandler.EndDocument() - here? or somewhere in destructor? end; function TXMLReader.ContextPush(AEntity: TDOMEntityEx): Boolean; @@ -1493,7 +1491,7 @@ begin Result := ResolveEntity(AEntity.SystemID, AEntity.PublicID, Src); if not Result then 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]); Exit; end; @@ -1539,7 +1537,7 @@ begin FSource.Free; FSource := Src; FCurChar := FSource.FBuf^; -// correct position of this error is after PE reference +// correct position of this error is after PE reference if Error then BadPENesting(esFatal); end; @@ -1823,7 +1821,7 @@ var TmpStr: WideString; IsXML11: Boolean; begin - FCurChar := FSource.NextChar; // don't update location here + FCurChar := FSource.NextChar; // don't update location here ExpectWhitespace; // VersionInfo: optional in TextDecl, required in XmlDecl if (not TextDecl) or (FCurChar = 'v') then @@ -2298,7 +2296,7 @@ begin begin if not CheckName then RaiseNameNotFound; - ExpectChar(';'); + ExpectChar(';'); if FSource.DTDSubsetType = dsInternal then FatalError('PE reference not allowed here in internal subset', FName.Length+2); StartPE;