1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-24 02:28:55 +03:00

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

Source commit: 904310464d998d3b8f222598c0b7914e6cb7deee
This commit is contained in:
Martin Prikryl
2025-06-23 14:46:22 +00:00
parent e035538560
commit 3fd70f410e
9 changed files with 14 additions and 20 deletions

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);
}

View File

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

View File

@@ -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;
}

View File

@@ -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])

View File

@@ -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);

View File

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

View File

@@ -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)
{