Przeglądaj źródła

Prevent compiler warning caused by 4031057b67

Source commit: 8837e1525f060a77109385b0905b7173e5858588
Martin Prikryl 7 lat temu
rodzic
commit
3bedafb566

+ 1 - 1
source/Console.cbproj

@@ -43,7 +43,7 @@
 		<ProjectType>CppConsoleApplication</ProjectType>
 		<SanitizedProjectName>Console</SanitizedProjectName>
 		<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
-		<VerInfo_Keys>CompanyName=Martin Prikryl;FileDescription=Console interface for WinSCP;FileVersion=5.0.1.0;InternalName=console;LegalCopyright=(c) 2000-2018 Martin Prikryl;LegalTrademarks=;OriginalFilename=winscp.com;ProductName=WinSCP;ProductVersion=5.14.3.0;ReleaseType=stable;WWW=https://winscp.net/</VerInfo_Keys>
+		<VerInfo_Keys>CompanyName=Martin Prikryl;FileDescription=Console interface for WinSCP;FileVersion=5.0.1.0;InternalName=console;LegalCopyright=(c) 2000-2019 Martin Prikryl;LegalTrademarks=;OriginalFilename=winscp.com;ProductName=WinSCP;ProductVersion=5.14.3.0;ReleaseType=stable;WWW=https://winscp.net/</VerInfo_Keys>
 		<VerInfo_Locale>1033</VerInfo_Locale>
 		<VerInfo_MajorVer>5</VerInfo_MajorVer>
 		<VerInfo_MinorVer>0</VerInfo_MinorVer>

+ 1 - 1
source/DragExt.cbproj

@@ -49,7 +49,7 @@
 		<SanitizedProjectName>DragExt</SanitizedProjectName>
 		<VerInfo_DLL>true</VerInfo_DLL>
 		<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
-		<VerInfo_Keys>CompanyName=Martin Prikryl;FileDescription=Drag&amp;Drop shell extension for WinSCP ($(Platform));FileVersion=2.0.0.0;InternalName=dragext;LegalCopyright=(c) 2000-2018 Martin Prikryl;LegalTrademarks=;OriginalFilename=dragext.dll;ProductName=WinSCP;ProductVersion=5.14.3.0;ReleaseType=stable;WWW=https://winscp.net/</VerInfo_Keys>
+		<VerInfo_Keys>CompanyName=Martin Prikryl;FileDescription=Drag&amp;Drop shell extension for WinSCP ($(Platform));FileVersion=2.0.0.0;InternalName=dragext;LegalCopyright=(c) 2000-2019 Martin Prikryl;LegalTrademarks=;OriginalFilename=dragext.dll;ProductName=WinSCP;ProductVersion=5.14.3.0;ReleaseType=stable;WWW=https://winscp.net/</VerInfo_Keys>
 		<VerInfo_Locale>1033</VerInfo_Locale>
 		<VerInfo_MajorVer>2</VerInfo_MajorVer>
 	</PropertyGroup>

+ 1 - 1
source/WinSCP.cbproj

@@ -76,7 +76,7 @@
 		<SanitizedProjectName>WinSCP</SanitizedProjectName>
 		<UsingDelphiRTL>true</UsingDelphiRTL>
 		<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
-		<VerInfo_Keys>CompanyName=Martin Prikryl;FileDescription=WinSCP: SFTP, FTP, WebDAV, S3 and SCP client;FileVersion=5.14.3.0;InternalName=winscp;LegalCopyright=(c) 2000-2018 Martin Prikryl;LegalTrademarks=;OriginalFilename=winscp.exe;ProductName=WinSCP;ProductVersion=5.14.3.0;ReleaseType=stable;WWW=https://winscp.net/</VerInfo_Keys>
+		<VerInfo_Keys>CompanyName=Martin Prikryl;FileDescription=WinSCP: SFTP, FTP, WebDAV, S3 and SCP client;FileVersion=5.14.3.0;InternalName=winscp;LegalCopyright=(c) 2000-2019 Martin Prikryl;LegalTrademarks=;OriginalFilename=winscp.exe;ProductName=WinSCP;ProductVersion=5.14.3.0;ReleaseType=stable;WWW=https://winscp.net/</VerInfo_Keys>
 		<VerInfo_Locale>1033</VerInfo_Locale>
 		<VerInfo_MajorVer>5</VerInfo_MajorVer>
 		<VerInfo_MinorVer>14</VerInfo_MinorVer>

+ 9 - 0
source/windows/GUITools.cpp

@@ -2096,3 +2096,12 @@ void __fastcall TUIStateAwareLabel::DoDrawText(TRect & Rect, int Flags)
   }
   TLabel::DoDrawText(Rect, Flags);
 }
+//---------------------------------------------------------------------------
+void __fastcall FindComponentClass(
+  void *, TReader *, const UnicodeString DebugUsedArg(ClassName), TComponentClass & ComponentClass)
+{
+  if (ComponentClass == __classid(TLabel))
+  {
+    ComponentClass = __classid(TUIStateAwareLabel);
+  }
+}

+ 6 - 9
source/windows/GUITools.h

@@ -187,20 +187,17 @@ class TUIStateAwareLabel : public TLabel
 protected:
   DYNAMIC void __fastcall DoDrawText(TRect & Rect, int Flags);
 };
+// FindComponentClass takes parameter by referece and as such it cannot be implemented in
+// an inline method without a compiler warning, which we cannot suppress in a macro.
+// And having the implementation in a real code (not macro) also allows us to debug the code.
+void __fastcall FindComponentClass(
+  void * Data, TReader * Reader, const UnicodeString ClassName, TComponentClass & ComponentClass);
 #define INTERFACE_HOOK \
   protected: \
     virtual void __fastcall ReadState(TReader * Reader) \
     { \
-      Reader->OnFindComponentClass = FindComponentClass; \
+      Reader->OnFindComponentClass = MakeMethod<TFindComponentClassEvent>(NULL, FindComponentClass); \
       TForm::ReadState(Reader); \
-    } \
-  \
-    void __fastcall FindComponentClass(TReader * Reader, const UnicodeString ClassName, TComponentClass & ComponentClass) \
-    { \
-      if (ComponentClass == __classid(TLabel)) \
-      { \
-        ComponentClass = __classid(TUIStateAwareLabel); \
-      } \
     }
 //---------------------------------------------------------------------------
 extern const UnicodeString PageantTool;