Selaa lähdekoodia

Merge branch 'master' into dev

# Conflicts:
#	source/WinSCP.cbproj

Source commit: 96ddefd80d8cd5f795f5321edc0c5d4a63450f0e
Martin Prikryl 8 vuotta sitten
vanhempi
sitoutus
dc02acc65b

+ 1 - 1
deployment/winscpsetup.iss

@@ -345,7 +345,7 @@ Source: "{#TranslationDir}\WinSCP.{#Languages[LangI*4]}"; DestDir: "{app}\Transl
 
 #for {LangI = 0; LangI < LanguageCount; LangI++} EmitLang
 
-; Delete translations from instalation root folder (pre-5.10)
+; Delete translations from installation root folder (pre-5.10)
 [InstallDelete]
 #expr AllTranslationsBuf = AllTranslations + '-'
 

+ 7 - 2
source/core/SessionData.cpp

@@ -2734,7 +2734,7 @@ UnicodeString __fastcall TSessionData::GetProtocolUrl()
   return Url;
 }
 //---------------------------------------------------------------------
-static bool __fastcall IsIPv6Literal(const UnicodeString & HostName)
+bool __fastcall IsIPv6Literal(const UnicodeString & HostName)
 {
   bool Result = (HostName.Pos(L":") > 0);
   if (Result)
@@ -2748,6 +2748,11 @@ static bool __fastcall IsIPv6Literal(const UnicodeString & HostName)
   return Result;
 }
 //---------------------------------------------------------------------
+UnicodeString __fastcall EscapeIPv6Literal(const UnicodeString & IP)
+{
+  return L"[" + IP + L"]";
+}
+//---------------------------------------------------------------------
 UnicodeString __fastcall TSessionData::GenerateSessionUrl(unsigned int Flags)
 {
   UnicodeString Url;
@@ -2781,7 +2786,7 @@ UnicodeString __fastcall TSessionData::GenerateSessionUrl(unsigned int Flags)
   DebugAssert(!HostNameExpanded.IsEmpty());
   if (IsIPv6Literal(HostNameExpanded))
   {
-    Url += L"[" + HostNameExpanded + L"]";
+    Url += EscapeIPv6Literal(HostNameExpanded);
   }
   else
   {

+ 2 - 0
source/core/SessionData.h

@@ -687,5 +687,7 @@ private:
 UnicodeString GetExpandedLogFileName(UnicodeString LogFileName, TDateTime Started, TSessionData * SessionData);
 bool __fastcall IsSshProtocol(TFSProtocol FSProtocol);
 int __fastcall DefaultPort(TFSProtocol FSProtocol, TFtps Ftps);
+bool __fastcall IsIPv6Literal(const UnicodeString & HostName);
+UnicodeString __fastcall EscapeIPv6Literal(const UnicodeString & IP);
 //---------------------------------------------------------------------------
 #endif

+ 6 - 1
source/core/Terminal.cpp

@@ -1493,8 +1493,13 @@ void __fastcall TTerminal::OpenTunnel()
     FTunnelData->UserName = FSessionData->TunnelUserName;
     FTunnelData->Password = FSessionData->TunnelPassword;
     FTunnelData->PublicKeyFile = FSessionData->TunnelPublicKeyFile;
+    UnicodeString HostName = FSessionData->HostNameExpanded;
+    if (IsIPv6Literal(HostName))
+    {
+      HostName = EscapeIPv6Literal(HostName);
+    }
     FTunnelData->TunnelPortFwd = FORMAT(L"L%d\t%s:%d",
-      (FTunnelLocalPortNumber, FSessionData->HostNameExpanded, FSessionData->PortNumber));
+      (FTunnelLocalPortNumber, HostName, FSessionData->PortNumber));
     FTunnelData->HostKey = FSessionData->TunnelHostKey;
 
     // inherit proxy options on the main session

+ 9 - 1
source/forms/CustomScpExplorer.cpp

@@ -9285,5 +9285,13 @@ void __fastcall TCustomScpExplorerForm::ChangeScale(int M, int D)
 {
   TForm::ChangeScale(M, D);
   int APixelsPerInch = GetControlPixelsPerInch(this);
-  GlyphsModule->SetPixelsPerInch(APixelsPerInch);
+  HANDLE ResourceModule = GUIConfiguration->ChangeToDefaultResourceModule();
+  try
+  {
+    GlyphsModule->SetPixelsPerInch(APixelsPerInch);
+  }
+  __finally
+  {
+    GUIConfiguration->ChangeResourceModule(ResourceModule);
+  }
 }