Преглед на файлове

Factoring out AnyMask constant

Source commit: d2de188e9c4422706a72c8c7664c1a498aa9800a
Martin Prikryl преди 9 години
родител
ревизия
0e6ab8a0ef
променени са 5 файла, в които са добавени 8 реда и са изтрити 6 реда
  1. 1 1
      source/core/CopyParam.cpp
  2. 3 2
      source/core/FileMasks.cpp
  3. 1 0
      source/core/FileMasks.h
  4. 1 1
      source/forms/CustomScpExplorer.cpp
  5. 2 2
      source/windows/WinConfiguration.cpp

+ 1 - 1
source/core/CopyParam.cpp

@@ -45,7 +45,7 @@ void __fastcall TCopyParamType::Default()
   InvalidCharsReplacement = TokenReplacement;
   LocalInvalidChars = ::LocalInvalidChars;
   CalculateSize = true;
-  FileMask = L"*.*";
+  FileMask = AnyMask;
   IncludeFileMask.Masks = L"";
   TransferSkipList = NULL;
   TransferResumeFile = L"";

+ 3 - 2
source/core/FileMasks.cpp

@@ -16,6 +16,7 @@ UnicodeString FileMasksDelimiters = L";,";
 static UnicodeString AllFileMasksDelimiters = FileMasksDelimiters + IncludeExcludeFileMasksDelimiter;
 static UnicodeString DirectoryMaskDelimiters = L"/\\";
 static UnicodeString FileMasksDelimiterStr = UnicodeString(FileMasksDelimiters[1]) + L' ';
+UnicodeString AnyMask = L"*.*";
 //---------------------------------------------------------------------------
 __fastcall EFileMasksException::EFileMasksException(
     UnicodeString Message, int AErrorStart, int AErrorLen) :
@@ -117,7 +118,7 @@ bool __fastcall IsFileNameMask(const UnicodeString & Mask)
 //---------------------------------------------------------------------------
 bool __fastcall IsEffectiveFileNameMask(const UnicodeString & Mask)
 {
-  return !Mask.IsEmpty() && (Mask != L"*") && (Mask != L"*.*");
+  return !Mask.IsEmpty() && (Mask != L"*") && (Mask != AnyMask);
 }
 //---------------------------------------------------------------------------
 UnicodeString __fastcall DelimitFileNameMask(UnicodeString Mask)
@@ -152,7 +153,7 @@ bool __fastcall TFileMasks::IsMask(const UnicodeString Mask)
 //---------------------------------------------------------------------------
 bool __fastcall TFileMasks::IsAnyMask(const UnicodeString & Mask)
 {
-  return Mask.IsEmpty() || (Mask == L"*.*") || (Mask == L"*");
+  return Mask.IsEmpty() || (Mask == AnyMask) || (Mask == L"*");
 }
 //---------------------------------------------------------------------------
 UnicodeString __fastcall TFileMasks::NormalizeMask(const UnicodeString & Mask, const UnicodeString & AnyMask)

+ 1 - 0
source/core/FileMasks.h

@@ -237,5 +237,6 @@ private:
 //---------------------------------------------------------------------------
 typedef TFileCustomCommand TRemoteCustomCommand;
 extern UnicodeString FileMasksDelimiters;
+extern UnicodeString AnyMask;
 //---------------------------------------------------------------------------
 #endif

+ 1 - 1
source/forms/CustomScpExplorer.cpp

@@ -3731,7 +3731,7 @@ bool __fastcall TCustomScpExplorerForm::RemoteTransferDialog(TTerminal *& Sessio
   }
   else
   {
-    FileMask = L"*.*";
+    FileMask = AnyMask;
   }
   DirectCopy = FTerminal->IsCapable[fcRemoteCopy] || FTerminal->IsCapable[fcSecondaryShell];
   bool Result = true;

+ 2 - 2
source/windows/WinConfiguration.cpp

@@ -29,7 +29,7 @@ TWinConfiguration * WinConfiguration = NULL;
 static UnicodeString NotepadName(L"notepad.exe");
 //---------------------------------------------------------------------------
 __fastcall TEditorData::TEditorData() :
-  FileMask(L"*.*"),
+  FileMask(AnyMask),
   Editor(edInternal),
   ExternalEditor(L""),
   ExternalEditorText(false),
@@ -498,7 +498,7 @@ void __fastcall TWinConfiguration::Default()
   FDDExtTimeout = MSecsPerSec;
   FDeleteToRecycleBin = true;
   FSelectDirectories = false;
-  FSelectMask = L"*.*";
+  FSelectMask = AnyMask;
   FShowHiddenFiles = false;
   FFormatSizeBytes = fbKilobytes;
   FShowInaccesibleDirectories = true;