浏览代码

* Patch from Bart Broersma to implement Int64 support in xmlreg (bug ID 35227)

git-svn-id: trunk@41810 -
michael 6 年之前
父节点
当前提交
17aa8da99f
共有 2 个文件被更改,包括 11 次插入1 次删除
  1. 9 1
      packages/fcl-registry/src/xmlreg.pp
  2. 2 0
      packages/fcl-registry/src/xregreg.inc

+ 9 - 1
packages/fcl-registry/src/xmlreg.pp

@@ -10,7 +10,7 @@ uses
 
 Type
 
-  TDataType = (dtUnknown,dtDWORD,dtString,dtBinary,dtStrings);
+  TDataType = (dtUnknown,dtDWORD,dtString,dtBinary,dtStrings,dtQWord);
   TDataInfo = record
     DataType : TDataType;
     DataSize : Integer;
@@ -306,6 +306,7 @@ Var
   U : UnicodeString;
   HasData: Boolean;
   D : DWord;
+  Q : QWord;
   
 begin
   //writeln('TXmlRegistry.DoGetValueData: Name=',Name,' IsUnicode=',IsUnicode);
@@ -332,6 +333,12 @@ begin
                   if Result then
                     PCardinal(@Data)^:=D;
                   end;
+        dtQWORD : begin   // DataNode is required
+                  NS:=SizeOf(QWORD);
+                  Result:=HasData and TryStrToQWord(String(DataNode.NodeValue),Q) and (DataSize>=NS);
+                  if Result then
+                    PUInt64(@Data)^:=Q;
+                  end;
         dtString : // DataNode is optional
                    if HasData then
                      begin
@@ -396,6 +403,7 @@ begin
 
     Case DataType of
       dtDWORD : SW:=UnicodeString(IntToStr(PCardinal(@Data)^));
+      dtQWORD : SW:=UnicodeString(IntToStr(PUInt64(@Data)^));
       dtString : begin
                  if IsUnicode then
                    SW:=UnicodeString(PUnicodeChar(@Data))

+ 2 - 0
packages/fcl-registry/src/xregreg.inc

@@ -20,6 +20,7 @@ begin
     rdInteger               : Result := dtDword;
     rdBinary                : Result := dtBinary;
     rdMultiString           : Result := dtStrings;
+    rdInt64                 : Result := dtQword;
   else
     Raise ERegistryException.CreateFmt(SErrTypeNotSupported,[GetEnumName(TypeInfo(TRegDataType),Ord(RegData))]);
   end;
@@ -31,6 +32,7 @@ begin
   Case DataType of
     dtUnknown: Result:=rdUnknown;
     dtDword  : Result:=rdInteger;
+    dtQword  : Result:=rdInt64;
     dtString : Result:=rdString;
     dtBinary : Result:=rdBinary;
     dtStrings : Result:=rdMultiString;