lazutils: less hints

git-svn-id: trunk@35802 -
This commit is contained in:
mattias 2012-03-07 11:55:37 +00:00
parent 928b404f34
commit 9c9f62c013
4 changed files with 34 additions and 13 deletions

View File

@ -87,7 +87,7 @@ begin
end;
end;
end;
SetLength(Result, PtrUInt(Dest) - PtrUInt(Result));
SetLength(Result, {%H-}PtrUInt(Dest) - PtrUInt(Result));
end;
function CP936ToUTF8(const s: string): string;
@ -198,7 +198,7 @@ begin
end;
end;
//SetLength(Result, Dest - PChar(Result));
SetLength(Result, PtrUInt(Dest) - PtrUInt(Result));
SetLength(Result, {%H-}PtrUInt(Dest) - PtrUInt(Result));
end;
function UTF8ToCP936(const s: string): string;

View File

@ -216,7 +216,7 @@ type
function GetString(BufPos: PChar; Len: integer): String;
function CheckName: Boolean;
function GetName(var s: String): Boolean;
function GetName(out s: String): Boolean;
function ExpectName: String; // [5]
procedure SkipName;
procedure ExpectAttValue(attr: TDOMAttr); // [10]
@ -290,8 +290,10 @@ function TXMLReader.BufPosToStr(p: PChar): string;
var
LineCol: TPoint;
begin
if p<BufStart then
p:=BufStart;
// find out the line in which the error occured
LineCol:=BufPosToLineCol(BufStart);
LineCol:=BufPosToLineCol(p);
Result:=IntToStr(LineCol.y)+','+IntToStr(LineCol.x);
end;
@ -466,7 +468,7 @@ begin
Result := True;
end;
function TXMLReader.GetName(var s: String): Boolean; // [5]
function TXMLReader.GetName(out s: String): Boolean; // [5]
var OldBuf: PChar;
begin
if not (buf[0] in (Letter + ['_', ':'])) then begin

View File

@ -98,7 +98,7 @@ type
procedure WriteVariant(const VarValue: Variant); override;
{$ENDIF}
{$IFDEF HasReadWriteBuf}
procedure Write(const Buffer; Count: Longint); override;
procedure Write(const {%H-}Buffer; Count: Longint); override;
{$ENDIF}
public
property Doc: TDOMDocument read FDoc;
@ -149,7 +149,7 @@ type
procedure SkipComponent(SkipComponentInfos: Boolean); override;
procedure SkipValue; override;
{$IFDEF HasReadWriteBuf}
procedure Read(var Buf; Count: LongInt); override;
procedure Read(var {%H-}Buf; Count: LongInt); override;
{$ENDIF}
public
property Doc: TDOMDocument read FDoc;
@ -347,6 +347,13 @@ begin
StackEl.Element['name'] := Component.Name;
StackEl.Element['class'] := Component.ClassName;
if ChildPos>=0 then begin
// ToDo
end;
if Flags<>[] then begin
// ToDo
end;
StackPush('properties',elPropertyList);
end;
@ -536,6 +543,7 @@ end;
{$IFDEF HasReadWriteBuf}
procedure TXMLObjectWriter.Write(const Buffer; Count: Longint);
begin
if Count<=0 then exit;
// there can be arbitrary lots of Write calls
raise Exception.Create('TODO: TXMLObjectWriter.Write');
end;
@ -911,7 +919,13 @@ var
PropertiesNode: TDOMNode;
begin
//writeln('TXMLObjectReader.BeginComponent START');
if AChildPos>0 then begin
// ToDo
end;
if Flags<>[] then begin
// ToDo
end;
if FElement.NodeName='component' then
ComponentNode:=FElement
else
@ -1009,6 +1023,8 @@ function TXMLObjectReader.ReadIdent(ValueType: TValueType): String;
begin
Result:=FElement['value'];
ReadValue;
// ToDo: check type
if ValueType=vaNull then ;
//writeln('TXMLObjectReader.ReadIdent ',Result);
end;
@ -1141,6 +1157,8 @@ begin
NextNode:=FElement.NextSibling;
if (NextNode=nil) or (NextNode is TDOMElement) then
FElement:=TDOMElement(NextNode);
// ToDo: SkipComponentInfos
if SkipComponentInfos then ;
//writeln('TXMLObjectReader.SkipComponent ');
end;
@ -1153,6 +1171,7 @@ end;
{$IFDEF HasReadWriteBuf}
procedure TXMLObjectReader.Read(var Buf; Count: LongInt);
begin
if Count<=0 then exit;
raise Exception.Create('TODO: TXMLObjectReader.Read');
//writeln('TXMLObjectReader.Read ');
end;

View File

@ -4749,7 +4749,7 @@ begin
end;
end;
end;
SetLength(Result,PtrUInt(Dest)-PtrUInt(Result));
SetLength(Result,{%H-}PtrUInt(Dest)-PtrUInt(Result));
end;
function UCS2LEToUTF8(const s: string): string;
@ -4778,7 +4778,7 @@ begin
inc(Dest,UnicodeToUTF8SkipErrors(c,Dest));
end;
end;
len:=PtrUInt(Dest)-PtrUInt(Result);
len:={%H-}PtrUInt(Dest)-PtrUInt(Result);
if len>length(Result) then
raise Exception.Create('');
SetLength(Result,len);
@ -4810,7 +4810,7 @@ begin
inc(Dest,UnicodeToUTF8SkipErrors(c,Dest));
end;
end;
len:=PtrUInt(Dest)-PtrUInt(Result);
len:={%H-}PtrUInt(Dest)-PtrUInt(Result);
if len>length(Result) then
raise Exception.Create('');
SetLength(Result,len);
@ -6133,7 +6133,7 @@ begin
end;
end;
end;
len:=PtrUInt(Dest)-PtrUInt(Result);
len:={%H-}PtrUInt(Dest)-PtrUInt(Result);
if len>length(Result) then
raise Exception.Create('');
SetLength(Result,len);
@ -6173,7 +6173,7 @@ begin
end;
end;
end;
len:=PtrUInt(Dest)-PtrUInt(Result);
len:={%H-}PtrUInt(Dest)-PtrUInt(Result);
if len>length(Result) then
raise Exception.Create('');
SetLength(Result,len);