Explorar o código

Minor code errors identified by Clang (2nd after 4019b56f)

Source commit: 904310464d998d3b8f222598c0b7914e6cb7deee
Martin Prikryl hai 4 meses
pai
achega
3fd70f410e

+ 4 - 9
source/forms/CustomScpExplorer.cpp

@@ -70,7 +70,7 @@ public:
     unsigned long WaitResult = WaitForSingleObject(AMutex, Timeout);
     if (WaitResult == WAIT_TIMEOUT)
     {
-      throw Exception(LoadStr(MUTEX_RELEASE_TIMEOUT));
+      throw Exception(LoadStr(Message));
     }
     else
     {
@@ -3573,7 +3573,7 @@ void __fastcall TCustomScpExplorerForm::AnyInternalEditorModified(
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::LocalEditorClosed(TObject * Sender, bool /*Forced*/)
 {
-  DebugCheck(FLocalEditors->Extract(Sender) >= 0);
+  DebugCheck(FLocalEditors->Extract(Sender) != NULL);
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::TemporaryDirectoryForRemoteFiles(
@@ -11934,10 +11934,10 @@ void __fastcall TCustomScpExplorerForm::UpdateQueueFileList()
     }
     else
     {
-      if (FQueueFileList->GetCount() > 0)
+      Refresh = (FQueueFileList->GetCount() > 0);
+      if (Refresh)
       {
         FQueueFileList->Clear();
-        Refresh = true;
       }
     }
     int Count = FQueueFileList->GetCount();
@@ -12024,11 +12024,6 @@ bool TCustomScpExplorerForm::IsAvailableTerminal(TTerminal * Terminal)
   return TTerminalManager::Instance()->IsAvailableTerminal(Terminal);
 }
 //---------------------------------------------------------------------------
-bool __fastcall TCustomScpExplorerForm::HasManagedSession()
-{
-  return (ManagedSession != NULL);
-}
-//---------------------------------------------------------------------------
 bool TCustomScpExplorerForm::HasAvailableTerminal()
 {
   return IsAvailableTerminal(Terminal);

+ 0 - 1
source/forms/CustomScpExplorer.h

@@ -805,7 +805,6 @@ public:
   void __fastcall SuspendWindowLock();
   void __fastcall ResumeWindowLock();
   bool HasAvailableTerminal();
-  bool __fastcall HasManagedSession();
   virtual bool IsLocalBrowserMode();
   bool CanCloseSession(TManagedTerminal * Session);
   virtual UnicodeString __fastcall DefaultDownloadTargetDirectory() = 0;

+ 1 - 1
source/forms/GenerateUrl.cpp

@@ -204,7 +204,7 @@ UnicodeString __fastcall TGenerateUrlDialog::GenerateUrl(UnicodeString Path)
   if ((RemoteDirectoryCheck->Enabled && RemoteDirectoryCheck->Checked) ||
       IsFileUrl())
   {
-    if (StartsStr(L"/", Path));
+    if (StartsStr(L"/", Path))
     {
       Path.Delete(1, 1);
     }

+ 1 - 1
source/forms/Login.cpp

@@ -492,7 +492,7 @@ void __fastcall TLoginDialog::Default()
 //---------------------------------------------------------------------
 void __fastcall TLoginDialog::LoadContents()
 {
-  bool UseContentsPanel;
+  bool UseContentsPanel = false;
   TTreeNode * Node = SessionTree->Selected;
   if (IsSessionNode(Node))
   {

+ 3 - 3
source/forms/MessageDlg.cpp

@@ -915,8 +915,8 @@ TForm * __fastcall TMessageForm::Create(const UnicodeString & Msg,
         if (GroupWith >= 0)
         {
           if (DebugAlwaysFalse(GroupWith >= static_cast<int>(Answer)) ||
-              DebugAlwaysFalse(Answer == TimeoutAnswer) &&
-              DebugAlwaysFalse(Answer == DefaultAnswer) &&
+              DebugAlwaysFalse(Answer == TimeoutAnswer) ||
+              DebugAlwaysFalse(Answer == DefaultAnswer) ||
               DebugAlwaysFalse(Answer == CancelAnswer))
           {
             GroupWith = -1;
@@ -1015,7 +1015,7 @@ TForm * __fastcall TMessageForm::Create(const UnicodeString & Msg,
   int MaxTextWidth = ScaleByTextHeightRunTime(Result, mcMaxDialogWidth);
   // If the message contains SHA-256 hex fingerprint (CERT_TEXT2 on TLS/SSL certificate verification dialog),
   // allow wider box to fit it
-  if (TRegEx::IsMatch(Msg, L"([0-9a-fA-F]{2}[:\-]){31}[0-9a-fA-F]{2}"))
+  if (TRegEx::IsMatch(Msg, L"([0-9a-fA-F]{2}[:\\-]){31}[0-9a-fA-F]{2}"))
   {
     MaxTextWidth = MaxTextWidth * 3 / 2;
   }

+ 1 - 1
source/forms/NonVisual.cpp

@@ -130,7 +130,7 @@ void __fastcall TNonVisualDataModule::ExplorerActionsUpdate(
   }
   void * AuxVoidPtr;
   int AuxInt;
-  #define HasManagedSession ScpExplorer->HasManagedSession()
+  #define HasManagedSession (ScpExplorer->ManagedSession != NULL)
   #define HasTerminal ScpExplorer->HasAvailableTerminal()
   // CURRENT DIRVIEW
   #define EnabledSelectedOperation (ScpExplorer->EnableSelectedOperation[osCurrent])

+ 2 - 2
source/forms/SiteAdvanced.cpp

@@ -1055,8 +1055,8 @@ void __fastcall TSiteAdvancedDialog::UpdateControls()
     // environment/recycle bin sheet
     EnableControl(OverwrittenToRecycleBinCheck, SftpProtocol && RecycleBinSheet->Enabled);
     EnableControl(RecycleBinPathEdit,
-      (DeleteToRecycleBinCheck->Enabled && DeleteToRecycleBinCheck->Checked) ||
-      (OverwrittenToRecycleBinCheck->Enabled && OverwrittenToRecycleBinCheck->Checked) &&
+      ((DeleteToRecycleBinCheck->Enabled && DeleteToRecycleBinCheck->Checked) ||
+       (OverwrittenToRecycleBinCheck->Enabled && OverwrittenToRecycleBinCheck->Checked)) &&
       RecycleBinSheet->Enabled);
     EnableControl(RecycleBinPathLabel, RecycleBinPathEdit->Enabled &&
       RecycleBinSheet->Enabled);

+ 1 - 1
source/forms/SynchronizeChecklist.cpp

@@ -208,7 +208,7 @@ struct TMoveActionData
       if (CollectFileList)
       {
         UnicodeString FileName;
-        TObject * Object;
+        TObject * Object = NULL;
         if (Action == TSynchronizeChecklist::saDeleteRemote)
         {
           FileName = ChecklistItem->GetRemotePath();

+ 1 - 1
source/windows/WinConfiguration.cpp

@@ -240,7 +240,7 @@ UnicodeString __fastcall TEditorPreferences::GetName() const
         FName.SetLength(P - 1);
       }
 
-      if (FName.ByteType(1) == mbSingleByte)
+      if (FName.ByteType(1) == UnicodeString::ctNotLeadChar)
       {
         if (FName.UpperCase() == FName)
         {