From 06e559505d3b3fa38f10be2b0874f7d662a91ce6 Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Tue, 9 Apr 2013 14:48:41 +0000 Subject: [PATCH] Fixes for Delphi XE2 Fixed compatibility with D2007 --- Packages/DXE2/X2Utils.dpk | 2 +- Packages/DXE2/X2Utils.dproj | 4 ++-- Packages/DXE2/X2Utils.res | Bin 27432 -> 27432 bytes X2UtCompilerVersion.inc | 6 +++++ X2UtNamedFormat.pas | 6 ++--- X2UtOS.pas | 2 +- X2UtPersist.pas | 46 +++++++++++++++++++++--------------- X2UtTempFile.pas | 6 +++++ 8 files changed, 46 insertions(+), 26 deletions(-) diff --git a/Packages/DXE2/X2Utils.dpk b/Packages/DXE2/X2Utils.dpk index 59674f0..59cde7b 100644 --- a/Packages/DXE2/X2Utils.dpk +++ b/Packages/DXE2/X2Utils.dpk @@ -58,6 +58,6 @@ contains X2UtElevation in '..\..\X2UtElevation.pas', X2UtPersistXML in '..\..\X2UtPersistXML.pas', X2UtPersistXMLBinding in '..\..\X2UtPersistXMLBinding.pas', - XMLDataBindingUtils in '..\..\XMLDataBinding\XMLDataBindingUtils.pas'; + XMLDataBindingUtils in '..\..\XMLDataBindingUtils.pas'; end. diff --git a/Packages/DXE2/X2Utils.dproj b/Packages/DXE2/X2Utils.dproj index 11cd811..cb2d0f5 100644 --- a/Packages/DXE2/X2Utils.dproj +++ b/Packages/DXE2/X2Utils.dproj @@ -61,7 +61,7 @@ X2Utils_Icon.ico - Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) true 1033 CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= @@ -172,7 +172,7 @@ - + Cfg_2 Base diff --git a/Packages/DXE2/X2Utils.res b/Packages/DXE2/X2Utils.res index 8cbdc5ae422e52b765ff140fd8c761f16678c0bc..e43db4316777713c6519ae16cb15f008273bfd66 100644 GIT binary patch delta 19 bcmZ2+jd8^_#t9~j1`|!a8SOVVF3$o0PI(82 delta 19 bcmZ2+jd8^_#t9~j0uxQW85uS 0 then - VersionString := VersionString + ' ' + versionInfo.szCSDVersion; + VersionString := VersionString + ' ' + string(versionInfo.szCSDVersion); case versionInfo.dwPlatformId of VER_PLATFORM_WIN32_NT: diff --git a/X2UtPersist.pas b/X2UtPersist.pas index d34b8fb..0bf4864 100644 --- a/X2UtPersist.pas +++ b/X2UtPersist.pas @@ -112,6 +112,9 @@ uses X2UtStrings; +{$I X2UtCompilerVersion.inc} + + type { This class has to proxy all the interfaces in order for reference counting to go through this class. } @@ -348,15 +351,15 @@ begin tkInteger, tkChar, tkWChar: - if ReadInteger(APropInfo^.Name, ordValue) then + if ReadInteger(string(APropInfo^.Name), ordValue) then SetOrdProp(AObject, APropInfo, ordValue); tkFloat: - if ReadFloat(APropInfo^.Name, floatValue) then + if ReadFloat(string(APropInfo^.Name), floatValue) then SetFloatProp(AObject, APropInfo, floatValue); tkEnumeration: - if ReadString(APropInfo^.Name, stringValue) then + if ReadString(string(APropInfo^.Name), stringValue) then begin ordValue := GetEnumValue(APropInfo^.PropType^, stringValue); if ordValue >= 0 then @@ -364,14 +367,16 @@ begin end; tkString, + {$IFDEF D2009PLUS} + tkUString, + {$ENDIF} tkLString, - tkWString, - tkUString: - if ReadString(APropInfo^.Name, stringValue) then + tkWString: + if ReadString(string(APropInfo^.Name), stringValue) then SetStrProp(AObject, APropInfo, stringValue); tkSet: - if ReadString(APropInfo^.Name, stringValue) then + if ReadString(string(APropInfo^.Name), stringValue) then begin try ordValue := StringToSet(APropInfo, stringValue); @@ -382,11 +387,11 @@ begin end; tkVariant: - if ReadVariant(APropInfo^.Name, variantValue) then + if ReadVariant(string(APropInfo^.Name), variantValue) then SetVariantProp(AObject, APropInfo, variantValue); tkInt64: - if ReadInt64(APropInfo^.Name, int64Value) then + if ReadInt64(string(APropInfo^.Name), int64Value) then SetInt64Prop(AObject, APropInfo, int64Value); tkClass: @@ -396,11 +401,11 @@ begin begin if objectProp is TStream then begin - ReadStream(APropInfo^.Name, TStream(objectProp)); + ReadStream(string(APropInfo^.Name), TStream(objectProp)); end else begin { Recurse into object properties } - if BeginSection(APropInfo^.Name) then + if BeginSection(string(APropInfo^.Name)) then try AContinue := Read(objectProp); finally @@ -457,35 +462,38 @@ begin tkWChar: begin ordValue := GetOrdProp(AObject, APropInfo); - WriteInteger(APropInfo^.Name, ordValue); + WriteInteger(string(APropInfo^.Name), ordValue); end; tkFloat: begin floatValue := GetFloatProp(AObject, APropInfo); - WriteFloat(APropInfo^.Name, floatValue); + WriteFloat(string(APropInfo^.Name), floatValue); end; tkEnumeration: begin ordValue := GetOrdProp(AObject, APropInfo); stringValue := GetEnumName(APropInfo^.PropType^, ordValue); - WriteString(APropInfo^.Name, stringValue); + WriteString(string(APropInfo^.Name), stringValue); end; tkString, + {$IFDEF D2009PLUS} + tkUString, + {$ENDIF} tkLString, tkWString: begin stringValue := GetStrProp(AObject, APropInfo); - WriteString(APropInfo^.Name, stringValue); + WriteString(string(APropInfo^.Name), stringValue); end; tkSet: begin ordValue := GetOrdProp(AObject, APropInfo); stringValue := SetToString(APropInfo, ordValue, True); - WriteString(APropInfo^.Name, stringValue); + WriteString(string(APropInfo^.Name), stringValue); end; tkVariant: @@ -496,7 +504,7 @@ begin tkInt64: begin int64Value := GetInt64Prop(AObject, APropInfo); - WriteInt64(APropInfo^.Name, int64Value); + WriteInt64(string(APropInfo^.Name), int64Value); end; tkClass: @@ -506,11 +514,11 @@ begin begin if objectProp is TStream then begin - WriteStream(APropInfo^.Name, TStream(objectProp)); + WriteStream(string(APropInfo^.Name), TStream(objectProp)); end else begin { Recurse into object properties } - if BeginSection(APropInfo^.Name) then + if BeginSection(string(APropInfo^.Name)) then try Write(objectProp); finally diff --git a/X2UtTempFile.pas b/X2UtTempFile.pas index 15d975a..43ba767 100644 --- a/X2UtTempFile.pas +++ b/X2UtTempFile.pas @@ -25,6 +25,8 @@ uses Windows; +{$I X2UtCompilerVersion.inc} + function GetAppDataPath(): String; var @@ -122,7 +124,11 @@ end; function IsValidFileChar(const AChar: Char): Boolean; begin + {$IFDEF DXE2PLUS} + Result := not CharInSet(AChar, ['\', '/', ':', '*', '?', '"', '<', '>', '|']); + {$ELSE} Result := not (AChar in ['\', '/', ':', '*', '?', '"', '<', '>', '|']); + {$ENDIF} end;