Przeglądaj źródła

Bug 1436: Some scripting commands or command-line switches were not recognized on some locales (like Welsh) when used or defined with a mixed case (like /XmlLog vs. /xmllog)

https://winscp.net/tracker/1436

Source commit: 81e27b5c5e4ae826955e2646cab1d21414d69eca
Martin Prikryl 9 lat temu
rodzic
commit
092c24d412

+ 5 - 5
source/core/FileMasks.cpp

@@ -1196,7 +1196,7 @@ bool __fastcall TFileCustomCommand::PatternReplacement(
 {
   // keep consistent with TSessionLog::OpenLogFile
 
-  if (AnsiSameText(Pattern, L"!s"))
+  if (SameText(Pattern, L"!s"))
   {
     Replacement = FData.SessionData->GenerateSessionUrl(sufComplete);
   }
@@ -1204,15 +1204,15 @@ bool __fastcall TFileCustomCommand::PatternReplacement(
   {
     Replacement = FData.SessionData->HostNameExpanded;
   }
-  else if (AnsiSameText(Pattern, L"!u"))
+  else if (SameText(Pattern, L"!u"))
   {
     Replacement = FData.SessionData->UserName;
   }
-  else if (AnsiSameText(Pattern, L"!p"))
+  else if (SameText(Pattern, L"!p"))
   {
     Replacement = FData.SessionData->Password;
   }
-  else if (AnsiSameText(Pattern, L"!#"))
+  else if (SameText(Pattern, L"!#"))
   {
     Replacement = IntToStr(FData.SessionData->PortNumber);
   }
@@ -1226,7 +1226,7 @@ bool __fastcall TFileCustomCommand::PatternReplacement(
     // already delimited
     Delimit = false;
   }
-  else if (AnsiSameText(Pattern, L"!n"))
+  else if (SameText(Pattern, L"!n"))
   {
     Replacement = FData.SessionData->SessionName;
   }

+ 1 - 1
source/core/HierarchicalStorage.cpp

@@ -1264,7 +1264,7 @@ void __fastcall TIniFileStorage::ApplyOverrides()
   {
     UnicodeString Section = FSections->Strings[i];
 
-    if (AnsiSameText(OverridesKey,
+    if (SameText(OverridesKey,
           Section.SubString(1, OverridesKey.Length())))
     {
       UnicodeString SubKey = Section.SubString(OverridesKey.Length() + 1,

+ 2 - 2
source/core/Option.cpp

@@ -122,8 +122,8 @@ bool __fastcall TOptions::FindSwitch(const UnicodeString Switch,
     }
     else if (FOptions[Index].Type == otSwitch)
     {
-      if ((!CaseSensitive && AnsiSameText(FOptions[Index].Name, Switch)) ||
-          (CaseSensitive && AnsiSameStr(FOptions[Index].Name, Switch)))
+      if ((!CaseSensitive && SameText(FOptions[Index].Name, Switch)) ||
+          (CaseSensitive && SameStr(FOptions[Index].Name, Switch)))
       {
         Found = true;
         Value = FOptions[Index].Value;

+ 1 - 1
source/core/RemoteFiles.cpp

@@ -465,7 +465,7 @@ int __fastcall FakeFileImageIndex(UnicodeString FileName, unsigned long Attrs,
   }
   // this should be somewhere else, probably in TUnixDirView,
   // as the "partial" overlay is added there too
-  if (AnsiSameText(UnixExtractFileExt(FileName), PARTIAL_EXT))
+  if (SameText(UnixExtractFileExt(FileName), PARTIAL_EXT))
   {
     static const size_t PartialExtLen = LENOF(PARTIAL_EXT) - 1;
     FileName.SetLength(FileName.Length() - PartialExtLen);

+ 2 - 2
source/core/Script.cpp

@@ -186,7 +186,7 @@ int __fastcall TScriptCommands::FindCommand(TStrings * Commands,
     for (int i = 0; i < Commands->Count; i++)
     {
       if ((Command.Length() <= Commands->Strings[i].Length()) &&
-          AnsiSameText(Command, Commands->Strings[i].SubString(1, Command.Length())))
+          SameText(Command, Commands->Strings[i].SubString(1, Command.Length())))
       {
         if (Matches != NULL)
         {
@@ -1639,7 +1639,7 @@ void __fastcall TScript::OptionImpl(UnicodeString OptionName, UnicodeString Valu
     if (SetValue && !PrintReconnectTime)
     {
       int Value;
-      if (AnsiSameText(ValueName, ToggleNames[ToggleOff]))
+      if (SameText(ValueName, ToggleNames[ToggleOff]))
       {
         Value = 0;
       }

+ 3 - 3
source/core/SessionData.cpp

@@ -1403,7 +1403,7 @@ bool __fastcall TSessionData::IsProtocolUrl(
 //---------------------------------------------------------------------
 bool __fastcall TSessionData::IsSensitiveOption(const UnicodeString & Option)
 {
-  return AnsiSameText(Option, PassphraseOption);
+  return SameText(Option, PassphraseOption);
 }
 //---------------------------------------------------------------------
 bool __fastcall TSessionData::ParseUrl(UnicodeString Url, TOptions * Options,
@@ -1629,7 +1629,7 @@ bool __fastcall TSessionData::ParseUrl(UnicodeString Url, TOptions * Options,
       {
         UnicodeString ConnectionParam = CutToChar(ConnectionParams, UrlParamSeparator, false);
         UnicodeString ConnectionParamName = CutToChar(ConnectionParam, UrlParamValueSeparator, false);
-        if (AnsiSameText(ConnectionParamName, UrlHostKeyParamName))
+        if (SameText(ConnectionParamName, UrlHostKeyParamName))
         {
           HostKey = ConnectionParam;
           FOverrideCachedHostKey = false;
@@ -1652,7 +1652,7 @@ bool __fastcall TSessionData::ParseUrl(UnicodeString Url, TOptions * Options,
       {
         UnicodeString SessionParam = CutToChar(SessionParams, UrlParamSeparator, false);
         UnicodeString SessionParamName = CutToChar(SessionParam, UrlParamValueSeparator, false);
-        if (AnsiSameText(SessionParamName, UrlSaveParamName))
+        if (SameText(SessionParamName, UrlSaveParamName))
         {
           FSaveOnly = (StrToIntDef(SessionParam, 1) != 0);
         }

+ 1 - 1
source/core/SftpFileSystem.cpp

@@ -2009,7 +2009,7 @@ const TFileSystemInfo & __fastcall TSFTPFileSystem::GetFileSystemInfo(bool /*Ret
 //---------------------------------------------------------------------------
 bool __fastcall TSFTPFileSystem::TemporaryTransferFile(const UnicodeString & FileName)
 {
-  return AnsiSameText(UnixExtractFileExt(FileName), PARTIAL_EXT);
+  return SameText(UnixExtractFileExt(FileName), PARTIAL_EXT);
 }
 //---------------------------------------------------------------------------
 bool __fastcall TSFTPFileSystem::GetStoredCredentialsTried()

+ 1 - 1
source/forms/CustomScpExplorer.cpp

@@ -7358,7 +7358,7 @@ void __fastcall TCustomScpExplorerForm::DirViewGetOverlay(
     Ext = ExtractFileExt(DirView->ItemFileName(Item));
   }
 
-  if (AnsiSameText(Ext, Configuration->PartialExt))
+  if (SameText(Ext, Configuration->PartialExt))
   {
     Indexes |= oiPartial;
   }

+ 20 - 20
source/windows/Setup.cpp

@@ -922,7 +922,7 @@ static bool __fastcall DoQueryUpdates(TUpdatesConfiguration & Updates, bool Coll
   {
     UnicodeString Line = CutToChar(Response, L'\n', false);
     UnicodeString Name = CutToChar(Line, L'=', false);
-    if (AnsiSameText(Name, "Version"))
+    if (SameText(Name, "Version"))
     {
       int NewVersion = StrToCompoundVersion(Line);
       Changed |= (NewVersion != PrevResults.Version);
@@ -933,45 +933,45 @@ static bool __fastcall DoQueryUpdates(TUpdatesConfiguration & Updates, bool Coll
       Updates.Results.Version = NewVersion;
       Complete = true;
     }
-    else if (AnsiSameText(Name, L"Message"))
+    else if (SameText(Name, L"Message"))
     {
       Changed |= (PrevResults.Message != Line);
       Updates.Results.Message = Line;
     }
-    else if (AnsiSameText(Name, L"Critical"))
+    else if (SameText(Name, L"Critical"))
     {
       bool NewCritical = (StrToIntDef(Line, 0) != 0);
       Changed |= (PrevResults.Critical != NewCritical);
       Updates.Results.Critical = NewCritical;
     }
-    else if (AnsiSameText(Name, L"Release"))
+    else if (SameText(Name, L"Release"))
     {
       Changed |= (PrevResults.Release != Line);
       Updates.Results.Release = Line;
     }
-    else if (AnsiSameText(Name, L"Disabled"))
+    else if (SameText(Name, L"Disabled"))
     {
       bool NewDisabled = (StrToIntDef(Line, 0) != 0);
       Changed |= (PrevResults.Disabled != NewDisabled);
       Updates.Results.Disabled = NewDisabled;
       Complete = true;
     }
-    else if (AnsiSameText(Name, L"Url"))
+    else if (SameText(Name, L"Url"))
     {
       Changed |= (PrevResults.Url != Line);
       Updates.Results.Url = Line;
     }
-    else if (AnsiSameText(Name, L"UrlButton"))
+    else if (SameText(Name, L"UrlButton"))
     {
       Changed |= (PrevResults.UrlButton != Line);
       Updates.Results.UrlButton = Line;
     }
-    else if (AnsiSameText(Name, L"NewsUrl"))
+    else if (SameText(Name, L"NewsUrl"))
     {
       Changed |= (PrevResults.NewsUrl != Line);
       Updates.Results.NewsUrl = Line;
     }
-    else if (AnsiSameText(Name, L"NewsSize"))
+    else if (SameText(Name, L"NewsSize"))
     {
       TSize NewsSize;
       NewsSize.Width = StrToIntDef(CutToChar(Line, L',', true), 0);
@@ -979,48 +979,48 @@ static bool __fastcall DoQueryUpdates(TUpdatesConfiguration & Updates, bool Coll
       Changed |= (PrevResults.NewsSize != NewsSize);
       Updates.Results.NewsSize = NewsSize;
     }
-    else if (AnsiSameText(Name, L"DownloadUrl"))
+    else if (SameText(Name, L"DownloadUrl"))
     {
       Changed |= (PrevResults.DownloadUrl != Line);
       Updates.Results.DownloadUrl = Line;
     }
-    else if (AnsiSameText(Name, L"DownloadSize"))
+    else if (SameText(Name, L"DownloadSize"))
     {
       Updates.Results.DownloadSize = StrToInt64Def(Line, 0);
     }
-    else if (AnsiSameText(Name, L"DownloadSha256"))
+    else if (SameText(Name, L"DownloadSha256"))
     {
       Updates.Results.DownloadSha256 = Line;
     }
-    else if (AnsiSameText(Name, L"AuthenticationError"))
+    else if (SameText(Name, L"AuthenticationError"))
     {
       Changed |= (PrevResults.AuthenticationError != Line);
       Updates.Results.AuthenticationError = Line;
     }
-    else if (AnsiSameText(Name, L"OpenGettingStarted"))
+    else if (SameText(Name, L"OpenGettingStarted"))
     {
       Updates.Results.OpenGettingStarted = (StrToIntDef(Line, 0) != 0);
     }
-    else if (AnsiSameText(Name, L"DownloadingUrl"))
+    else if (SameText(Name, L"DownloadingUrl"))
     {
       Updates.Results.DownloadingUrl = Line;
     }
-    else if (AnsiSameText(Name, L"TipsSize"))
+    else if (SameText(Name, L"TipsSize"))
     {
       TSize TipsSize;
       TipsSize.Width = StrToIntDef(CutToChar(Line, L',', true), 0);
       TipsSize.Height = StrToIntDef(CutToChar(Line, L',', true), 0);
       Updates.Results.TipsSize = TipsSize;
     }
-    else if (AnsiSameText(Name, L"TipsUrl"))
+    else if (SameText(Name, L"TipsUrl"))
     {
       Updates.Results.TipsUrl = Line;
     }
-    else if (AnsiSameText(Name, L"Tips"))
+    else if (SameText(Name, L"Tips"))
     {
       Updates.Results.Tips = Line;
     }
-    else if (AnsiSameText(Name, L"TipsIntervalDays"))
+    else if (SameText(Name, L"TipsIntervalDays"))
     {
       int TipsIntervalDays = StrToIntDef(Line, Updates.Results.TipsIntervalDays);
       if (TipsIntervalDays < 0)
@@ -1029,7 +1029,7 @@ static bool __fastcall DoQueryUpdates(TUpdatesConfiguration & Updates, bool Coll
       }
       Updates.Results.TipsIntervalDays = TipsIntervalDays;
     }
-    else if (AnsiSameText(Name, L"TipsIntervalRuns"))
+    else if (SameText(Name, L"TipsIntervalRuns"))
     {
       int TipsIntervalRuns = StrToIntDef(Line, Updates.Results.TipsIntervalRuns);
       if (TipsIntervalRuns < 0)

+ 1 - 1
source/windows/UserInterface.cpp

@@ -38,7 +38,7 @@ TConfiguration * __fastcall CreateConfiguration()
   UnicodeString IniFileName = Params->SwitchValue(INI_SWITCH);
   if (!IniFileName.IsEmpty())
   {
-    if (AnsiSameText(IniFileName, INI_NUL))
+    if (SameText(IniFileName, INI_NUL))
     {
       WinConfiguration->SetNulStorage();
     }

+ 1 - 1
source/windows/WinConfiguration.cpp

@@ -1445,7 +1445,7 @@ void __fastcall TWinConfiguration::AddVersionToHistory()
 bool __fastcall TWinConfiguration::DoIsBeta(const UnicodeString & ReleaseType)
 {
   // What about "Development" release type?
-  return AnsiSameText(ReleaseType, L"beta") || AnsiSameText(ReleaseType, L"rc");
+  return SameText(ReleaseType, L"beta") || SameText(ReleaseType, L"rc");
 }
 //---------------------------------------------------------------------------
 bool __fastcall TWinConfiguration::GetIsBeta()