瀏覽代碼

Prettifying debug macros

Source commit: ba529d34782876686ca07031e9c0b7c17f9e92fd
Martin Prikryl 10 年之前
父節點
當前提交
987728ea0c
共有 66 個文件被更改,包括 466 次插入466 次删除
  1. 1 1
      source/components/LogMemo.cpp
  2. 3 3
      source/components/ThemePageControl.cpp
  3. 25 25
      source/components/UnixDirView.cpp
  4. 7 7
      source/components/UnixDriveView.cpp
  5. 6 6
      source/core/Common.cpp
  6. 2 2
      source/core/Common.h
  7. 1 1
      source/core/Configuration.cpp
  8. 7 7
      source/core/CopyParam.cpp
  9. 1 1
      source/core/CoreMain.cpp
  10. 2 2
      source/core/Exceptions.cpp
  11. 3 3
      source/core/FileBuffer.cpp
  12. 28 28
      source/core/FtpFileSystem.cpp
  13. 11 11
      source/core/Global.h
  14. 3 3
      source/core/HierarchicalStorage.cpp
  15. 1 1
      source/core/KeyGen.cpp
  16. 2 2
      source/core/NeonIntf.cpp
  17. 2 2
      source/core/Option.cpp
  18. 10 10
      source/core/PuttyIntf.cpp
  19. 12 12
      source/core/Queue.cpp
  20. 2 2
      source/core/RemoteFiles.cpp
  21. 11 11
      source/core/ScpFileSystem.cpp
  22. 8 8
      source/core/Script.cpp
  23. 8 8
      source/core/SecureShell.cpp
  24. 14 14
      source/core/SessionData.cpp
  25. 3 3
      source/core/SessionInfo.cpp
  26. 11 11
      source/core/SftpFileSystem.cpp
  27. 9 9
      source/core/Terminal.cpp
  28. 18 18
      source/core/WebDAVFileSystem.cpp
  29. 2 2
      source/forms/About.cpp
  30. 1 1
      source/forms/Animations.cpp
  31. 1 1
      source/forms/Authenticate.cpp
  32. 1 1
      source/forms/Cleanup.cpp
  33. 39 39
      source/forms/CustomScpExplorer.cpp
  34. 10 10
      source/forms/Editor.cpp
  35. 2 2
      source/forms/FileFind.cpp
  36. 2 2
      source/forms/FullSynchronize.cpp
  37. 6 6
      source/forms/GenerateUrl.cpp
  38. 6 6
      source/forms/Glyphs.cpp
  39. 1 1
      source/forms/InputDlg.cpp
  40. 2 2
      source/forms/LocationProfiles.cpp
  41. 30 30
      source/forms/Login.cpp
  42. 19 19
      source/forms/MessageDlg.cpp
  43. 9 9
      source/forms/NonVisual.cpp
  44. 1 1
      source/forms/OpenDirectory.cpp
  45. 11 11
      source/forms/Preferences.cpp
  46. 3 3
      source/forms/Progress.cpp
  47. 1 1
      source/forms/Properties.cpp
  48. 1 1
      source/forms/Rights.cpp
  49. 1 1
      source/forms/ScpCommander.cpp
  50. 1 1
      source/forms/ScpExplorer.cpp
  51. 1 1
      source/forms/SelectMask.cpp
  52. 4 4
      source/forms/SiteAdvanced.cpp
  53. 5 5
      source/forms/SynchronizeChecklist.cpp
  54. 15 15
      source/windows/ConsoleRunner.cpp
  55. 2 2
      source/windows/EditorManager.cpp
  56. 2 2
      source/windows/GUIConfiguration.cpp
  57. 10 10
      source/windows/GUITools.cpp
  58. 2 2
      source/windows/QueueController.cpp
  59. 17 17
      source/windows/Setup.cpp
  60. 2 2
      source/windows/SynchronizeController.cpp
  61. 6 6
      source/windows/Tools.cpp
  62. 9 9
      source/windows/UserInterface.cpp
  63. 11 11
      source/windows/VCLCommon.cpp
  64. 6 6
      source/windows/WinConfiguration.cpp
  65. 11 11
      source/windows/WinInterface.cpp
  66. 2 2
      source/windows/WinMain.cpp

+ 1 - 1
source/components/LogMemo.cpp

@@ -103,7 +103,7 @@ void __fastcall TLogMemo::SetSessionLog(TSessionLog * value)
 //---------------------------------------------------------------------------
 void __fastcall TLogMemo::SessionLogChange(TObject * Sender)
 {
-  USEDPARAM(Sender);
+  DebugUsedParam(Sender);
 #ifndef DESIGN_ONLY
   DebugAssert(Sender && (Sender == (TObject*)SessionLog));
 #endif

+ 3 - 3
source/components/ThemePageControl.cpp

@@ -48,7 +48,7 @@ void __fastcall TThemeTabSheet::SetShadowed(bool Value)
     FShadowed = Value;
 
     TThemePageControl * ThemePageControl = dynamic_cast<TThemePageControl *>(Parent);
-    if (ALWAYS_TRUE(ThemePageControl != NULL))
+    if (DebugAlwaysTrue(ThemePageControl != NULL))
     {
       ThemePageControl->InvalidateTab(TabIndex);
     }
@@ -77,7 +77,7 @@ int __fastcall TThemePageControl::GetTabsHeight()
 
   // Two different ways to calculate the same, not sure which one is more reliable,
   // so we want to know in case they differ.
-  if (ALWAYS_TRUE(PageCount >= 0))
+  if (DebugAlwaysTrue(PageCount >= 0))
   {
     TRect Rect = TabRect(0);
     int Result2 = Rect.Bottom + 1;
@@ -85,7 +85,7 @@ int __fastcall TThemePageControl::GetTabsHeight()
     {
       // On Windows 10 with 200% scaling, the first is 40, the second is 42.
       // The correct size is probably 41. Will wait for final release before settling on solution.
-      if (ALWAYS_TRUE(IsWin10() && (Result - 2) == Result2))
+      if (DebugAlwaysTrue(IsWin10() && (Result - 2) == Result2))
       {
         Result--;
       }

+ 25 - 25
source/components/UnixDirView.cpp

@@ -99,7 +99,7 @@ void __fastcall TUnixDirView::ExecuteFile(TListItem * Item)
     DisplayPropertiesMenu();
   }
 #else
-  USEDPARAM(Item);
+  DebugUsedParam(Item);
 #endif
 }
 //---------------------------------------------------------------------------
@@ -172,7 +172,7 @@ bool __fastcall TUnixDirView::ItemIsDirectory(TListItem * Item)
   ASSERT_VALID_ITEM;
   return ITEMFILE->IsDirectory;
 #else
-  USEDPARAM(Item);
+  DebugUsedParam(Item);
   return false;
 #endif
 }
@@ -183,7 +183,7 @@ bool __fastcall TUnixDirView::ItemIsFile(TListItem * Item)
   ASSERT_VALID_ITEM;
   return !(ITEMFILE->IsParentDirectory);
 #else
-  USEDPARAM(Item);
+  DebugUsedParam(Item);
   return false;
 #endif
 }
@@ -194,7 +194,7 @@ bool __fastcall TUnixDirView::ItemIsParentDirectory(TListItem * Item)
   ASSERT_VALID_ITEM;
   return ITEMFILE->IsParentDirectory;
 #else
-  USEDPARAM(Item);
+  DebugUsedParam(Item);
   return false;
 #endif
 }
@@ -205,7 +205,7 @@ UnicodeString __fastcall TUnixDirView::ItemFileName(TListItem * Item)
   ASSERT_VALID_ITEM;
   return ITEMFILE->FileName;
 #else
-  USEDPARAM(Item);
+  DebugUsedParam(Item);
   return UnicodeString();
 #endif
 }
@@ -216,7 +216,7 @@ __int64 __fastcall TUnixDirView::ItemFileSize(TListItem * Item)
   ASSERT_VALID_ITEM;
   return ITEMFILE->Size;
 #else
-  USEDPARAM(Item);
+  DebugUsedParam(Item);
   return 0;
 #endif
 }
@@ -227,7 +227,7 @@ UnicodeString __fastcall TUnixDirView::ItemFullFileName(TListItem * Item)
   ASSERT_VALID_ITEM;
   return ITEMFILE->FullFileName;
 #else
-  USEDPARAM(Item);
+  DebugUsedParam(Item);
   return UnicodeString();
 #endif
 }
@@ -240,7 +240,7 @@ int __fastcall TUnixDirView::ItemImageIndex(TListItem * Item, bool /*Cache*/)
   // so we don't need it here. But it's implemented anyway.
   return ITEMFILE->IconIndex;
 #else
-  USEDPARAM(Item);
+  DebugUsedParam(Item);
   return 0;
 #endif
 }
@@ -265,8 +265,8 @@ bool __fastcall TUnixDirView::ItemMatchesFilter(TListItem * Item,
      (File->IsDirectory && Filter.Directories &&
       FileNameMatchesMasks(File->FileName, false, File->Size, File->Modification, Filter.Masks, false)));
 #else
-  USEDPARAM(Item);
-  USEDPARAM(Filter);
+  DebugUsedParam(Item);
+  DebugUsedParam(Filter);
   return false;
 #endif
 }
@@ -286,7 +286,7 @@ Word __fastcall TUnixDirView::ItemOverlayIndexes(TListItem * Item)
   }
   return Result;
 #else
-  USEDPARAM(Item);
+  DebugUsedParam(Item);
   return 0;
 #endif
 }
@@ -384,7 +384,7 @@ void __fastcall TUnixDirView::GetDisplayInfo(TListItem * Item, tagLVITEMW &DispI
         case uvExt: Value = File->Extension; break;
         case uvLinkTarget: Value = File->LinkTo; break;
         case uvType: Value = File->TypeName; break;
-        default: FAIL;
+        default: DebugFail;
       }
       StrPLCopy(DispInfo.pszText, Value, DispInfo.cchTextMax);
     }
@@ -395,8 +395,8 @@ void __fastcall TUnixDirView::GetDisplayInfo(TListItem * Item, tagLVITEMW &DispI
       DispInfo.mask |= LVIF_DI_SETITEM;
     }
 #else
-  USEDPARAM(Item);
-  USEDPARAM(DispInfo);
+  DebugUsedParam(Item);
+  DebugUsedParam(DispInfo);
 #endif
   }
 }
@@ -454,8 +454,8 @@ void __fastcall TUnixDirView::PerformItemDragDropOperation(TListItem * Item,
     }
   }
 #else
-  USEDPARAM(Item);
-  USEDPARAM(Effect);
+  DebugUsedParam(Item);
+  DebugUsedParam(Effect);
 #endif
 }
 //---------------------------------------------------------------------------
@@ -578,7 +578,7 @@ void __fastcall TUnixDirView::DoReadDirectoryImpl(TObject * /*Sender*/, bool Rel
     Load();
   }
 #else
-  USEDPARAM(ReloadOnly);
+  DebugUsedParam(ReloadOnly);
 #endif
 }
 //---------------------------------------------------------------------------
@@ -635,8 +635,8 @@ void __fastcall TUnixDirView::SetPath(UnicodeString Value)
 int __stdcall CompareFile(TListItem * Item1, TListItem * Item2, TUnixDirView * DirView)
 {
   DebugAssert((Item1 != NULL) && (Item2 != NULL));
-  TRemoteFile * File1 = NOT_NULL((TRemoteFile *)(Item1->Data));
-  TRemoteFile * File2 = NOT_NULL((TRemoteFile *)(Item2->Data));
+  TRemoteFile * File1 = DebugNotNull((TRemoteFile *)(Item1->Data));
+  TRemoteFile * File2 = DebugNotNull((TRemoteFile *)(Item2->Data));
 
   int Result;
   if (File1->IsParentDirectory && !File2->IsParentDirectory)
@@ -711,7 +711,7 @@ int __stdcall CompareFile(TListItem * Item1, TListItem * Item2, TUnixDirView * D
         break;
 
       default:
-        FAIL;
+        DebugFail;
     }
 
     if (Result == 0)
@@ -847,7 +847,7 @@ bool __fastcall TUnixDirView::CanEdit(TListItem* Item)
   DebugAssert(Terminal);
   return TCustomUnixDirView::CanEdit(Item) && Terminal->IsCapable[fcRename];
 #else
-  USEDPARAM(Item);
+  DebugUsedParam(Item);
   return false;
 #endif
 }
@@ -864,7 +864,7 @@ void __fastcall TUnixDirView::InternalEdit(const tagLVITEMW & HItem)
     Terminal->RenameFile(ITEMFILE, HItem.pszText, true);
   }
 #else
-  USEDPARAM(HItem);
+  DebugUsedParam(HItem);
 #endif
 }
 //---------------------------------------------------------------------------
@@ -894,7 +894,7 @@ void __fastcall TUnixDirView::CreateDirectoryEx(UnicodeString DirName, const TRe
   }
   Terminal->CreateDirectory(DirName, Properties);
 #else
-  USEDPARAM(Properties);
+  DebugUsedParam(Properties);
 #endif
 }
 //---------------------------------------------------------------------------
@@ -917,7 +917,7 @@ TColor __fastcall TUnixDirView::ItemColor(TListItem * Item)
   }
   else
 #else
-  USEDPARAM(Item);
+  DebugUsedParam(Item);
 #endif
   {
     return (TColor)clDefaultItemColor;
@@ -950,7 +950,7 @@ TDateTime __fastcall TUnixDirView::ItemFileTime(TListItem * Item,
   }
   return ITEMFILE->Modification;
 #else
-  USEDPARAM(Item);
+  DebugUsedParam(Item);
   Precision = tpSecond;
   return Now();
 #endif

+ 7 - 7
source/components/UnixDriveView.cpp

@@ -253,9 +253,9 @@ void __fastcall TCustomUnixDriveView::UpdatePath(TTreeNode * Node, bool Force,
     }
   }
   #else
-  USEDPARAM(Node);
-  USEDPARAM(Force);
-  USEDPARAM(CanLoad);
+  DebugUsedParam(Node);
+  DebugUsedParam(Force);
+  DebugUsedParam(CanLoad);
   #endif
 }
 //---------------------------------------------------------------------------
@@ -286,8 +286,8 @@ TTreeNode * __fastcall TCustomUnixDriveView::LoadPathEasy(TTreeNode * Parent,
 
   return Node;
   #else
-  USEDPARAM(Parent);
-  USEDPARAM(File);
+  DebugUsedParam(Parent);
+  DebugUsedParam(File);
   return NULL;
   #endif
 }
@@ -680,7 +680,7 @@ TColor __fastcall TCustomUnixDriveView::NodeColor(TTreeNode * Node)
     }
   }
   #else
-  USEDPARAM(Node);
+  DebugUsedParam(Node);
   #endif
   return Result;
 }
@@ -702,7 +702,7 @@ Word __fastcall TCustomUnixDriveView::NodeOverlayIndexes(TTreeNode * Node)
   }
   return Result;
 #else
-  USEDPARAM(Node);
+  DebugUsedParam(Node);
   return 0;
 #endif
 }

+ 6 - 6
source/core/Common.cpp

@@ -323,7 +323,7 @@ UnicodeString __fastcall MainInstructionsFirstParagraph(const UnicodeString & S)
   UnicodeString Result;
   int Pos = S.Pos(L"\n\n");
   // we would not be calling this on single paragraph message
-  if (ALWAYS_TRUE(Pos > 0))
+  if (DebugAlwaysTrue(Pos > 0))
   {
     Result =
       MainInstructions(S.SubString(1, Pos - 1)) +
@@ -2043,7 +2043,7 @@ static bool __fastcall DoRecursiveDeleteFile(const UnicodeString FileName, bool
               {
                 if ((SearchRec.Name != L".") && (SearchRec.Name != L".."))
                 {
-                  Result = DoRecursiveDeleteFile(FileName2, ALWAYS_FALSE(ToRecycleBin), AErrorPath);
+                  Result = DoRecursiveDeleteFile(FileName2, DebugAlwaysFalse(ToRecycleBin), AErrorPath);
                 }
               }
               else
@@ -2086,7 +2086,7 @@ static bool __fastcall DoRecursiveDeleteFile(const UnicodeString FileName, bool
     Data.pTo = L"\0\0"; // this will actually give one null more than needed
     Data.fFlags = FOF_NOCONFIRMATION | FOF_RENAMEONCOLLISION | FOF_NOCONFIRMMKDIR |
       FOF_NOERRORUI | FOF_SILENT;
-    if (ALWAYS_TRUE(ToRecycleBin))
+    if (DebugAlwaysTrue(ToRecycleBin))
     {
       Data.fFlags |= FOF_ALLOWUNDO;
     }
@@ -2158,7 +2158,7 @@ unsigned int __fastcall CancelAnswer(unsigned int Answers)
   }
   else
   {
-    FAIL;
+    DebugFail;
     Result = qaCancel;
   }
   return Result;
@@ -2342,7 +2342,7 @@ UnicodeString __fastcall EncodeUrlPath(UnicodeString S)
 {
   UnicodeString Ignore = NonUrlChars();
   int P = Ignore.Pos(L"/");
-  if (ALWAYS_TRUE(P > 0))
+  if (DebugAlwaysTrue(P > 0))
   {
     Ignore.Delete(P, 1);
   }
@@ -2499,7 +2499,7 @@ bool __fastcall IsWine()
 {
   HMODULE NtDll = GetModuleHandle(L"ntdll.dll");
   return
-    ALWAYS_TRUE(NtDll != NULL) &&
+    DebugAlwaysTrue(NtDll != NULL) &&
     (GetProcAddress(NtDll, "wine_get_version") != NULL);
 }
 //---------------------------------------------------------------------------

+ 2 - 2
source/core/Common.h

@@ -289,14 +289,14 @@ public:
   T1 LookupFirst(const T2 & Value2) const
   {
     TSecondToFirst::const_iterator Iterator = FSecondToFirst.find(Value2);
-    assert(Iterator != FSecondToFirst.end());
+    DebugAssert(Iterator != FSecondToFirst.end());
     return Iterator->second;
   }
 
   T2 LookupSecond(const T1 & Value1) const
   {
     const_iterator Iterator = FFirstToSecond.find(Value1);
-    assert(Iterator != FFirstToSecond.end());
+    DebugAssert(Iterator != FFirstToSecond.end());
     return Iterator->second;
   }
 

+ 1 - 1
source/core/Configuration.cpp

@@ -911,7 +911,7 @@ UnicodeString __fastcall TConfiguration::GetVersionStr()
     UnicodeString FullVersion = Version;
 
     UnicodeString AReleaseType = GetReleaseType();
-    if (ALWAYS_TRUE(!AReleaseType.IsEmpty()) &&
+    if (DebugAlwaysTrue(!AReleaseType.IsEmpty()) &&
         !SameText(AReleaseType, L"stable") &&
         !SameText(AReleaseType, L"development"))
     {

+ 7 - 7
source/core/CopyParam.cpp

@@ -177,7 +177,7 @@ void __fastcall TCopyParamType::DoGetInfoStr(
 
     if (APreserveTimeDirs != Defaults.PreserveTimeDirs)
     {
-      if (ALWAYS_TRUE(PreserveTimeDirs))
+      if (DebugAlwaysTrue(PreserveTimeDirs))
       {
         if (FLAGCLEAR(Options, cpaNoPreserveTimeDirs))
         {
@@ -239,7 +239,7 @@ void __fastcall TCopyParamType::DoGetInfoStr(
   {
     if (RemoveBOM != Defaults.RemoveBOM)
     {
-      if (ALWAYS_TRUE(RemoveBOM))
+      if (DebugAlwaysTrue(RemoveBOM))
       {
         ADD(LoadStr(COPY_INFO_REMOVE_BOM),
           cpaIncludeMaskOnly | cpaNoRemoveBOM | cpaNoTransferMode);
@@ -248,7 +248,7 @@ void __fastcall TCopyParamType::DoGetInfoStr(
 
     if (RemoveCtrlZ != Defaults.RemoveCtrlZ)
     {
-      if (ALWAYS_TRUE(RemoveCtrlZ))
+      if (DebugAlwaysTrue(RemoveCtrlZ))
       {
         ADD(LoadStr(COPY_INFO_REMOVE_CTRLZ),
           cpaIncludeMaskOnly | cpaNoRemoveCtrlZ | cpaNoTransferMode);
@@ -272,7 +272,7 @@ void __fastcall TCopyParamType::DoGetInfoStr(
 
   if (NewerOnly != Defaults.NewerOnly)
   {
-    if (ALWAYS_TRUE(NewerOnly))
+    if (DebugAlwaysTrue(NewerOnly))
     {
       ADD(StripHotkey(LoadStr(COPY_PARAM_NEWER_ONLY)), cpaIncludeMaskOnly | cpaNoNewerOnly);
     }
@@ -454,7 +454,7 @@ bool __fastcall TCopyParamType::UseAsciiTransfer(UnicodeString FileName,
     case tmAscii: return true;
     case tmAutomatic: return AsciiFileMask.Matches(FileName, (Side == osLocal),
       false, &Params);
-    default: FAIL; return false;
+    default: DebugFail; return false;
   }
 }
 //---------------------------------------------------------------------------
@@ -519,7 +519,7 @@ bool __fastcall TCopyParamType::AllowResume(__int64 Size) const
     case rsOn: return true;
     case rsOff: return false;
     case rsSmart: return (Size >= ResumeThreshold);
-    default: FAIL; return false;
+    default: DebugFail; return false;
   }
 }
 //---------------------------------------------------------------------------
@@ -562,7 +562,7 @@ bool __fastcall TCopyParamType::ResumeTransfer(UnicodeString FileName) const
   // Returning true has the same effect as cpResume
   return
     (FileName == FTransferResumeFile) &&
-    ALWAYS_TRUE(!FTransferResumeFile.IsEmpty());
+    DebugAlwaysTrue(!FTransferResumeFile.IsEmpty());
 }
 //---------------------------------------------------------------------------
 TStrings * __fastcall TCopyParamType::GetTransferSkipList() const

+ 1 - 1
source/core/CoreMain.cpp

@@ -170,7 +170,7 @@ void CoreSetResourceModule(void * ResourceHandle)
   #ifndef NO_FILEZILLA
   TFileZillaIntf::SetResourceModule(ResourceHandle);
   #else
-  USEDPARAM(ResourceHandle);
+  DebugUsedParam(ResourceHandle);
   #endif
 }
 //---------------------------------------------------------------------------

+ 2 - 2
source/core/Exceptions.cpp

@@ -85,7 +85,7 @@ static bool __fastcall WellKnownException(
     }
     if (AClone != NULL)
     {
-      (*AClone) = NOT_NULL(Clone.release());
+      (*AClone) = DebugNotNull(Clone.release());
     }
   }
 
@@ -419,7 +419,7 @@ Exception * __fastcall CloneException(Exception * E)
   else
   {
     // we do not expect this to happen
-    if (ALWAYS_FALSE(IsInternalException(E)))
+    if (DebugAlwaysFalse(IsInternalException(E)))
     {
       // to save exception stack trace
       Result = ExtException::CloneFrom(E);

+ 3 - 3
source/core/FileBuffer.cpp

@@ -15,7 +15,7 @@ char * __fastcall EOLToStr(TEOLType EOLType)
     case eolLF: return "\n";
     case eolCRLF: return "\r\n";
     case eolCR: return "\r";
-    default: FAIL; return "";
+    default: DebugFail; return "";
   }
 }
 //---------------------------------------------------------------------------
@@ -262,7 +262,7 @@ int __fastcall TSafeHandleStream::Write(const void * Buffer, int Count)
 //---------------------------------------------------------------------------
 int __fastcall TSafeHandleStream::Read(System::DynamicArray<System::Byte> Buffer, int Offset, int Count)
 {
-  FAIL; // untested
+  DebugFail; // untested
   int Result = FileRead(FHandle, Buffer, Offset, Count);
   if (Result == -1)
   {
@@ -273,7 +273,7 @@ int __fastcall TSafeHandleStream::Read(System::DynamicArray<System::Byte> Buffer
 //---------------------------------------------------------------------------
 int __fastcall TSafeHandleStream::Write(const System::DynamicArray<System::Byte> Buffer, int Offset, int Count)
 {
-  FAIL; // untested
+  DebugFail; // untested
   int Result = FileWrite(FHandle, Buffer, Offset, Count);
   if (Result == -1)
   {

+ 28 - 28
source/core/FtpFileSystem.cpp

@@ -391,7 +391,7 @@ void __fastcall TFTPFileSystem::Open()
       break;
 
     default:
-      FAIL;
+      DebugFail;
       break;
   }
 
@@ -524,7 +524,7 @@ void __fastcall TFTPFileSystem::Close()
   bool Result;
   if (FFileZillaIntf->Close(FOpening))
   {
-    CHECK(FLAGSET(WaitForCommandReply(false), TFileZillaIntf::REPLY_DISCONNECTED));
+    DebugCheck(FLAGSET(WaitForCommandReply(false), TFileZillaIntf::REPLY_DISCONNECTED));
     Result = true;
   }
   else
@@ -533,7 +533,7 @@ void __fastcall TFTPFileSystem::Close()
     Result = FOpening;
   }
 
-  if (ALWAYS_TRUE(Result))
+  if (DebugAlwaysTrue(Result))
   {
     DebugAssert(FActive);
     Discard();
@@ -567,7 +567,7 @@ void __fastcall TFTPFileSystem::CollectUsage()
       break;
 
     default:
-      FAIL;
+      DebugFail;
       break;
   }
 
@@ -1008,7 +1008,7 @@ void __fastcall TFTPFileSystem::ChangeFileProperties(const UnicodeString AFileNa
 //---------------------------------------------------------------------------
 bool __fastcall TFTPFileSystem::LoadFilesProperties(TStrings * /*FileList*/)
 {
-  FAIL;
+  DebugFail;
   return false;
 }
 //---------------------------------------------------------------------------
@@ -1029,7 +1029,7 @@ UnicodeString __fastcall TFTPFileSystem::DoCalculateFileChecksum(
     int Index = FChecksumAlgs->IndexOf(Alg);
     if (Index < 0)
     {
-      FAIL;
+      DebugFail;
       EXCEPTION;
     }
     else
@@ -1381,7 +1381,7 @@ bool __fastcall TFTPFileSystem::ConfirmOverwrite(
       break;
 
     default:
-      FAIL;
+      DebugFail;
       Result = false;
       break;
   }
@@ -1428,7 +1428,7 @@ void __fastcall TFTPFileSystem::DoFileTransferProgress(__int64 TransferSize,
   }
 
   __int64 Diff = Bytes - OperationProgress->TransferedSize;
-  if (ALWAYS_TRUE(Diff >= 0))
+  if (DebugAlwaysTrue(Diff >= 0))
   {
     OperationProgress->AddTransfered(Diff);
   }
@@ -2148,7 +2148,7 @@ void __fastcall TFTPFileSystem::CreateLink(const UnicodeString FileName,
   const UnicodeString PointTo, bool Symbolic)
 {
   DebugAssert(SupportsSiteCommand(SymlinkSiteCommand));
-  if (ALWAYS_TRUE(Symbolic))
+  if (DebugAlwaysTrue(Symbolic))
   {
     EnsureLocation();
 
@@ -2213,7 +2213,7 @@ void __fastcall TFTPFileSystem::CustomCommandOnFile(const UnicodeString /*FileNa
 {
   // if ever implemented, do not forget to add EnsureLocation,
   // see AnyCommand for a reason why
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TFTPFileSystem::DoStartup()
@@ -2303,14 +2303,14 @@ bool __fastcall TFTPFileSystem::IsCapable(int Capability) const
       return false;
 
     default:
-      FAIL;
+      DebugFail;
       return false;
   }
 }
 //---------------------------------------------------------------------------
 void __fastcall TFTPFileSystem::LookupUsersGroups()
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TFTPFileSystem::ReadCurrentDirectory()
@@ -2319,7 +2319,7 @@ void __fastcall TFTPFileSystem::ReadCurrentDirectory()
   // and immediately after call to CWD,
   // later our current directory may be not synchronized with FZAPI current
   // directory anyway, see comments in EnsureLocation
-  if (FReadCurrentDirectory || ALWAYS_FALSE(FCurrentDirectory.IsEmpty()))
+  if (FReadCurrentDirectory || DebugAlwaysFalse(FCurrentDirectory.IsEmpty()))
   {
     UnicodeString Command = L"PWD";
     SendCommand(Command);
@@ -2885,7 +2885,7 @@ const wchar_t * __fastcall TFTPFileSystem::GetOption(int OptionID) const
       break;
 
     default:
-      FAIL;
+      DebugFail;
       FOptionScratch = L"";
   }
 
@@ -2921,7 +2921,7 @@ int __fastcall TFTPFileSystem::GetOptionVal(int OptionID) const
         case pmTelnet:
         case pmCmd:
         default:
-          FAIL;
+          DebugFail;
           Result = 0; // PROXYTYPE_NOPROXY;
           break;
       }
@@ -2950,7 +2950,7 @@ int __fastcall TFTPFileSystem::GetOptionVal(int OptionID) const
 
     case OPTION_PASV:
       // should never get here t_server.nPasv being nonzero
-      FAIL;
+      DebugFail;
       Result = FALSE;
       break;
 
@@ -2966,7 +2966,7 @@ int __fastcall TFTPFileSystem::GetOptionVal(int OptionID) const
     case OPTION_PORTRANGELOW:
     case OPTION_PORTRANGEHIGH:
       // should never get here OPTION_LIMITPORTRANGE being zero
-      FAIL;
+      DebugFail;
       Result = 0;
       break;
 
@@ -3038,7 +3038,7 @@ int __fastcall TFTPFileSystem::GetOptionVal(int OptionID) const
       break;
 
     default:
-      FAIL;
+      DebugFail;
       Result = FALSE;
       break;
   }
@@ -3237,7 +3237,7 @@ unsigned int __fastcall TFTPFileSystem::WaitForCommandReply(bool WantLastCode)
 void __fastcall TFTPFileSystem::WaitForFatalNonCommandReply()
 {
   WaitForReply(false, false);
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TFTPFileSystem::ResetReply()
@@ -3257,7 +3257,7 @@ void __fastcall TFTPFileSystem::GotNonCommandReply(unsigned int Reply)
   DebugAssert(FLAGSET(Reply, TFileZillaIntf::REPLY_DISCONNECTED));
   GotReply(Reply);
   // should never get here as GotReply should raise fatal exception
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 UnicodeString __fastcall TFTPFileSystem::GotReply(unsigned int Reply, unsigned int Flags,
@@ -3776,7 +3776,7 @@ bool __fastcall TFTPFileSystem::HandleStatus(const wchar_t * AStatus, int Type)
       break;
 
     default:
-      FAIL;
+      DebugFail;
       break;
   }
 
@@ -3907,7 +3907,7 @@ bool __fastcall TFTPFileSystem::HandleAsynchRequestOverwrite(
             break;
 
           default:
-            FAIL;
+            DebugFail;
             RequestResult = TFileZillaIntf::FILEEXISTS_OVERWRITE;
             break;
         }
@@ -4273,7 +4273,7 @@ bool __fastcall TFTPFileSystem::HandleAsynchRequestVerifyCertificate(
           break;
 
         default:
-          FAIL;
+          DebugFail;
           RequestResult = 0;
           break;
       }
@@ -4392,7 +4392,7 @@ bool __fastcall TFTPFileSystem::HandleListData(const wchar_t * Path,
     // when connected to server with case insensitive paths.
     // Is empty when called from DoReadFile
     DebugAssert(FFileList->Directory.IsEmpty() || UnixSamePath(AbsolutePath(FFileList->Directory, false), Path));
-    USEDPARAM(Path);
+    DebugUsedParam(Path);
 
     for (unsigned int Index = 0; Index < Count; Index++)
     {
@@ -4561,7 +4561,7 @@ bool __fastcall TFTPFileSystem::CheckError(int ReturnCode, const wchar_t * Conte
   {
     FTerminal->FatalError(NULL,
       FMTLOAD(INTERNAL_ERROR, (FORMAT(L"fz#%s", (Context)), IntToHex(ReturnCode, 4))));
-    FAIL;
+    DebugFail;
   }
 
   return false;
@@ -4595,7 +4595,7 @@ bool __fastcall TFTPFileSystem::Unquote(UnicodeString & Str)
         }
         else
         {
-          FAIL;
+          DebugFail;
           // no quoted string
           Str.SetLength(0);
         }
@@ -4728,12 +4728,12 @@ bool __fastcall TFTPFileSystem::SupportsCommand(const UnicodeString & Command) c
 //---------------------------------------------------------------------------
 void __fastcall TFTPFileSystem::LockFile(const UnicodeString & /*FileName*/, const TRemoteFile * /*File*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TFTPFileSystem::UnlockFile(const UnicodeString & /*FileName*/, const TRemoteFile * /*File*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TFTPFileSystem::UpdateFromMain(TCustomFileSystem * /*MainFileSystem*/)

+ 11 - 11
source/core/Global.h

@@ -37,18 +37,18 @@ private:
 #ifndef _DEBUG
 #undef DebugAssert
 #define DebugAssert(p)   ((void)0)
-#define CHECK(p) p
-#define FAIL
-#define ALWAYS_TRUE(p) p
-#define ALWAYS_FALSE(p) p
-#define NOT_NULL(P) P
+#define DebugCheck(p) p
+#define DebugFail
+#define DebugAlwaysTrue(p) p
+#define DebugAlwaysFalse(p) p
+#define DebugNotNull(P) P
 #else
-#define CHECK(p) { bool __CHECK_RESULT__ = (p); DebugAssert(__CHECK_RESULT__); }
-#define FAIL DebugAssert(false)
-#define ALWAYS_TRUE(p) (p)
-#define ALWAYS_FALSE(p) (p)
-#define NOT_NULL(P) P
+#define DebugCheck(p) { bool __CHECK_RESULT__ = (p); DebugAssert(__CHECK_RESULT__); }
+#define DebugFail DebugAssert(false)
+#define DebugAlwaysTrue(p) (p)
+#define DebugAlwaysFalse(p) (p)
+#define DebugNotNull(P) P
 #endif
-#define USEDPARAM(p) ((&p) == (&p))
+#define DebugUsedParam(p) ((&p) == (&p))
 //---------------------------------------------------------------------------
 #endif

+ 3 - 3
source/core/HierarchicalStorage.cpp

@@ -1354,7 +1354,7 @@ bool __fastcall TOptionsIniFile::AllowWrite()
       return false;
 
     default:
-      FAIL;
+      DebugFail;
       return false;
   }
 }
@@ -1393,7 +1393,7 @@ void __fastcall TOptionsIniFile::WriteString(const UnicodeString Section, const
 {
   if (AllowWrite() &&
       // Implemented for TSessionData.DoSave only
-      ALWAYS_TRUE(Section.IsEmpty() && FRootKey.IsEmpty()))
+      DebugAlwaysTrue(Section.IsEmpty() && FRootKey.IsEmpty()))
   {
     FOptions->Values[Ident] = Value;
   }
@@ -1473,7 +1473,7 @@ void __fastcall TOptionsIniFile::DeleteKey(const UnicodeString Section, const Un
 {
   if (AllowWrite() &&
       // Implemented for TSessionData.DoSave only
-      ALWAYS_TRUE(Section.IsEmpty() && FRootKey.IsEmpty()))
+      DebugAlwaysTrue(Section.IsEmpty() && FRootKey.IsEmpty()))
   {
     int Index = FOptions->IndexOfName(Ident);
     if (Index >= 0)

+ 1 - 1
source/core/KeyGen.cpp

@@ -379,7 +379,7 @@ void __fastcall TKeyGenerator::SaveKey(const AnsiString FileName,
         break;
 
       default:
-        FAIL;
+        DebugFail;
     }
   }
   else

+ 2 - 2
source/core/NeonIntf.cpp

@@ -177,7 +177,7 @@ void CheckNeonStatus(ne_session * Session, int NeonStatus,
         case NE_FAILED: // never used by neon as of 0.30.0
         case NE_RETRY: // not sure if this is a public API
         default:
-          FAIL;
+          DebugFail;
           Error = FORMAT(L"Unexpected neon error %d", (NeonStatus));
           break;
       }
@@ -222,7 +222,7 @@ void ne_init_ssl_session(struct ssl_st * Ssl, ne_session * Session)
 {
   TNeonTlsInit OnNeonTlsInit =
     reinterpret_cast<TNeonTlsInit>(ne_get_session_private(Session, SESSION_TLS_INIT_KEY));
-  if (ALWAYS_TRUE(OnNeonTlsInit != NULL))
+  if (DebugAlwaysTrue(OnNeonTlsInit != NULL))
   {
     OnNeonTlsInit(Ssl, Session);
   }

+ 2 - 2
source/core/Option.cpp

@@ -291,7 +291,7 @@ bool __fastcall TOptions::UnusedSwitch(UnicodeString & Switch)
 bool __fastcall TOptions::WasSwitchAdded(UnicodeString & Switch, wchar_t & SwitchMark)
 {
   bool Result =
-    ALWAYS_TRUE(FOptions.size() > 0) &&
+    DebugAlwaysTrue(FOptions.size() > 0) &&
     (FOptions.back().Type == otSwitch);
   if (Result)
   {
@@ -352,7 +352,7 @@ void __fastcall TOptions::LogOptions(TLogOptionEvent OnLogOption)
         break;
 
       default:
-        FAIL;
+        DebugFail;
         break;
     }
     OnLogOption(LogStr);

+ 10 - 10
source/core/PuttyIntf.cpp

@@ -203,7 +203,7 @@ int get_userpass_input(prompts_t * p, unsigned char * /*in*/, int /*inlen*/)
 char * get_ttymode(void * /*frontend*/, const char * /*mode*/)
 {
   // should never happen when Config.nopty == TRUE
-  FAIL;
+  DebugFail;
   return NULL;
 }
 //---------------------------------------------------------------------------
@@ -307,7 +307,7 @@ int askappend(void * /*frontend*/, Filename * /*filename*/,
   void (*/*callback*/)(void * ctx, int result), void * /*ctx*/)
 {
   // this is called from logging.c of putty, which is never used with WinSCP
-  FAIL;
+  DebugFail;
   return 0;
 }
 //---------------------------------------------------------------------------
@@ -318,13 +318,13 @@ void ldisc_send(void * /*handle*/, char * /*buf*/, int len, int /*interactive*/)
   // as an ldisc. So if we get called with any real data, I want
   // to know about it.
   DebugAssert(len == 0);
-  USEDPARAM(len);
+  DebugUsedParam(len);
 }
 //---------------------------------------------------------------------------
 void agent_schedule_callback(void (* /*callback*/)(void *, void *, int),
   void * /*callback_ctx*/, void * /*data*/, int /*len*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void notify_remote_exit(void * /*frontend*/)
@@ -394,7 +394,7 @@ static long OpenWinSCPKey(HKEY Key, const char * SubKey, HKEY * Result, bool Can
   DebugAssert(Configuration != NULL);
 
   DebugAssert(Key == HKEY_CURRENT_USER);
-  USEDPARAM(Key);
+  DebugUsedParam(Key);
 
   UnicodeString RegKey = SubKey;
   int PuttyKeyLen = OriginalPuttyRegistryStorageKey.Length();
@@ -460,7 +460,7 @@ long reg_query_winscp_value_ex(HKEY Key, const char * ValueName, unsigned long *
     }
     else
     {
-      FAIL;
+      DebugFail;
       R = ERROR_READ_FAULT;
     }
   }
@@ -496,7 +496,7 @@ long reg_set_winscp_value_ex(HKEY Key, const char * ValueName, unsigned long /*R
   DebugAssert(Configuration != NULL);
 
   DebugAssert(Type == REG_SZ);
-  USEDPARAM(Type);
+  DebugUsedParam(Type);
   THierarchicalStorage * Storage = reinterpret_cast<THierarchicalStorage *>(Key);
   DebugAssert(Storage != NULL);
   if (Storage != NULL)
@@ -550,7 +550,7 @@ bool IsKeyEncrypted(TKeyType KeyType, const UnicodeString & FileName, UnicodeStr
       break;
 
     default:
-      FAIL;
+      DebugFail;
       Result = false;
       break;
   }
@@ -589,7 +589,7 @@ TPrivateKey * LoadKey(TKeyType KeyType, const UnicodeString & FileName, const Un
       break;
 
     default:
-      FAIL;
+      DebugFail;
       break;
   }
 
@@ -639,7 +639,7 @@ void SaveKey(TKeyType KeyType, const UnicodeString & FileName,
       break;
 
     default:
-      FAIL;
+      DebugFail;
       break;
   }
 }

+ 12 - 12
source/core/Queue.cpp

@@ -273,7 +273,7 @@ int __fastcall TSimpleThread::ThreadProc(void * Thread)
   catch(...)
   {
     // we do not expect thread to be terminated with exception
-    FAIL;
+    DebugFail;
   }
   SimpleThread->FFinished = true;
   SimpleThread->Finished();
@@ -559,7 +559,7 @@ void __fastcall TTerminalQueue::RetryItem(TQueueItem * Item)
 
       int Index = FItems->Remove(Item);
       DebugAssert(Index < FItemsInProcess);
-      USEDPARAM(Index);
+      DebugUsedParam(Index);
       FItemsInProcess--;
       FItems->Add(Item);
     }
@@ -584,7 +584,7 @@ void __fastcall TTerminalQueue::DeleteItem(TQueueItem * Item, bool CanKeep)
       Monitored = (Item->CompleteEvent != INVALID_HANDLE_VALUE);
       int Index = FItems->Remove(Item);
       DebugAssert(Index < FItemsInProcess);
-      USEDPARAM(Index);
+      DebugUsedParam(Index);
       FItemsInProcess--;
       FForcedItems->Remove(Item);
       // =0  do not keep
@@ -1404,7 +1404,7 @@ void __fastcall TTerminalItem::TerminalQueryUser(TObject * Sender,
   // on re-key with non-cached host key. make it fail.
   if (FItem != NULL)
   {
-    USEDPARAM(Arg);
+    DebugUsedParam(Arg);
     DebugAssert(Arg == NULL);
 
     TQueryUserAction Action(FQueue->OnQueryUser);
@@ -1436,12 +1436,12 @@ void __fastcall TTerminalItem::TerminalPromptUser(TTerminal * Terminal,
   if (FItem == NULL)
   {
     // sanity, should not occur
-    FAIL;
+    DebugFail;
     Result = false;
   }
   else
   {
-    USEDPARAM(Arg);
+    DebugUsedParam(Arg);
     DebugAssert(Arg == NULL);
 
     TPromptUserAction Action(FQueue->OnPromptUser);
@@ -1464,7 +1464,7 @@ void __fastcall TTerminalItem::TerminalPromptUser(TTerminal * Terminal,
 void __fastcall TTerminalItem::TerminalShowExtendedException(
   TTerminal * Terminal, Exception * E, void * Arg)
 {
-  USEDPARAM(Arg);
+  DebugUsedParam(Arg);
   DebugAssert(Arg == NULL);
 
   if ((FItem != NULL) &&
@@ -2344,7 +2344,7 @@ void __fastcall TTerminalThread::WaitForUserAction(TUserAction * UserAction)
     DebugAssert(Thread == FThreadId);
 
     bool DoCheckCancel =
-      ALWAYS_FALSE(UserAction == NULL) || !UserAction->Force();
+      DebugAlwaysFalse(UserAction == NULL) || !UserAction->Force();
     if (DoCheckCancel)
     {
       CheckCancel();
@@ -2437,7 +2437,7 @@ void __fastcall TTerminalThread::TerminalQueryUser(TObject * Sender,
   const UnicodeString Query, TStrings * MoreMessages, unsigned int Answers,
   const TQueryParams * Params, unsigned int & Answer, TQueryType Type, void * Arg)
 {
-  USEDPARAM(Arg);
+  DebugUsedParam(Arg);
   DebugAssert(Arg == NULL);
 
   // note about TQueryParams::TimerEvent
@@ -2468,7 +2468,7 @@ void __fastcall TTerminalThread::TerminalInitializeLog(TObject * Sender)
   if (FOnInitializeLog != NULL)
   {
     // never used, so not tested either
-    FAIL;
+    DebugFail;
     TNotifyAction Action(FOnInitializeLog);
     Action.Sender = Sender;
 
@@ -2480,7 +2480,7 @@ void __fastcall TTerminalThread::TerminalPromptUser(TTerminal * Terminal,
   TPromptKind Kind, UnicodeString Name, UnicodeString Instructions, TStrings * Prompts,
   TStrings * Results, bool & Result, void * Arg)
 {
-  USEDPARAM(Arg);
+  DebugUsedParam(Arg);
   DebugAssert(Arg == NULL);
 
   TPromptUserAction Action(FOnPromptUser);
@@ -2501,7 +2501,7 @@ void __fastcall TTerminalThread::TerminalPromptUser(TTerminal * Terminal,
 void __fastcall TTerminalThread::TerminalShowExtendedException(
   TTerminal * Terminal, Exception * E, void * Arg)
 {
-  USEDPARAM(Arg);
+  DebugUsedParam(Arg);
   DebugAssert(Arg == NULL);
 
   TShowExtendedExceptionAction Action(FOnShowExtendedException);

+ 2 - 2
source/core/RemoteFiles.cpp

@@ -391,7 +391,7 @@ TDateTime __fastcall ReduceDateTimePrecision(TDateTime DateTime,
         break;
 
       default:
-        FAIL;
+        DebugFail;
     }
 
     DateTime = EncodeDateVerbose(Y, M, D) + EncodeTimeVerbose(H, N, S, MS);
@@ -441,7 +441,7 @@ UnicodeString __fastcall ModificationStr(TDateTime DateTime,
         (EngShortMonthNames[Month-1], Day, Hour, Min));
 
     default:
-      FAIL;
+      DebugFail;
       // fall thru
 
     case mfFull:

+ 11 - 11
source/core/ScpFileSystem.cpp

@@ -464,7 +464,7 @@ bool __fastcall TSCPFileSystem::IsCapable(int Capability) const
       return false;
 
     default:
-      FAIL;
+      DebugFail;
       return false;
   }
 }
@@ -732,7 +732,7 @@ void __fastcall TSCPFileSystem::DetectUtf()
       break;
 
     default:
-      FAIL;
+      DebugFail;
     case asAuto:
       FSecureShell->UtfStrings = false; // noop
       try
@@ -1143,8 +1143,8 @@ void __fastcall TSCPFileSystem::CustomReadFile(const UnicodeString FileName,
 void __fastcall TSCPFileSystem::DeleteFile(const UnicodeString FileName,
   const TRemoteFile * File, int Params, TRmSessionAction & Action)
 {
-  USEDPARAM(File);
-  USEDPARAM(Params);
+  DebugUsedParam(File);
+  DebugUsedParam(Params);
   Action.Recursive();
   DebugAssert(FLAGCLEAR(Params, dfNoRecursive) || (File && File->IsSymLink));
   ExecCommand(fsDeleteFile, ARRAYOFCONST((DelimitStr(FileName))));
@@ -1272,7 +1272,7 @@ void __fastcall TSCPFileSystem::ChangeFileProperties(const UnicodeString FileNam
 //---------------------------------------------------------------------------
 bool __fastcall TSCPFileSystem::LoadFilesProperties(TStrings * /*FileList*/ )
 {
-  FAIL;
+  DebugFail;
   return false;
 }
 //---------------------------------------------------------------------------
@@ -1280,7 +1280,7 @@ void __fastcall TSCPFileSystem::CalculateFilesChecksum(const UnicodeString & /*A
   TStrings * /*FileList*/, TStrings * /*Checksums*/,
   TCalculatedChecksumEvent /*OnCalculatedChecksum*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TSCPFileSystem::CustomCommandOnFile(const UnicodeString FileName,
@@ -1316,7 +1316,7 @@ void __fastcall TSCPFileSystem::CaptureOutput(const UnicodeString & AddedLine, T
   UnicodeString Line = AddedLine;
   // TSecureShell never uses cotExitCode
   DebugAssert((OutputType == cotOutput) || (OutputType == cotError));
-  if ((OutputType == cotError) || ALWAYS_FALSE(OutputType == cotExitCode) ||
+  if ((OutputType == cotError) || DebugAlwaysFalse(OutputType == cotExitCode) ||
       !RemoveLastLine(Line, ReturnCode) ||
       !Line.IsEmpty())
   {
@@ -1355,7 +1355,7 @@ TStrings * __fastcall TSCPFileSystem::GetFixedPaths()
 void __fastcall TSCPFileSystem::SpaceAvailable(const UnicodeString Path,
   TSpaceAvailable & /*ASpaceAvailable*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 // transfer protocol
@@ -1564,7 +1564,7 @@ void __fastcall TSCPFileSystem::CopyToRemote(TStrings * FilesToCopy,
               break;
 
             default:
-              FAIL;
+              DebugFail;
               break;
           }
         }
@@ -2675,12 +2675,12 @@ void __fastcall TSCPFileSystem::GetSupportedChecksumAlgs(TStrings * /*Algs*/)
 //---------------------------------------------------------------------------
 void __fastcall TSCPFileSystem::LockFile(const UnicodeString & /*FileName*/, const TRemoteFile * /*File*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TSCPFileSystem::UnlockFile(const UnicodeString & /*FileName*/, const TRemoteFile * /*File*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TSCPFileSystem::UpdateFromMain(TCustomFileSystem * /*MainFileSystem*/)

+ 8 - 8
source/core/Script.cpp

@@ -495,7 +495,7 @@ void __fastcall TScript::Command(UnicodeString Cmd)
         if (Configuration->LogProtocol >= 1)
         {
           UnicodeString DummyLogCmd;
-          if (ALWAYS_TRUE(CutToken(LogCmd, DummyLogCmd)))
+          if (DebugAlwaysTrue(CutToken(LogCmd, DummyLogCmd)))
           {
             std::unique_ptr<TScriptProcParams> Parameters(new TScriptProcParams(LogCmd));
             Parameters->LogOptions(LogOption);
@@ -681,7 +681,7 @@ TStrings * __fastcall TScript::CreateFileList(TScriptProcParams * Parameters, in
   if (FLAGSET(ListType, fltLatest) && (Result->Count > 1))
   {
     // otherwise we do not have TRemoteFile's
-    assert(FLAGSET(ListType, fltQueryServer));
+    DebugAssert(FLAGSET(ListType, fltQueryServer));
     int LatestIndex = 0;
 
     for (int Index = 1; Index < Result->Count; Index++)
@@ -785,7 +785,7 @@ TStrings * __fastcall TScript::CreateLocalFileList(TScriptProcParams * Parameter
       }
       else
       {
-        assert(FLAGCLEAR(ListType, fltLatest));
+        DebugAssert(FLAGCLEAR(ListType, fltLatest));
         // this branch is currently never used
         Result->Add(FileName);
       }
@@ -1037,7 +1037,7 @@ void __fastcall TScript::CopyParamParams(TCopyParamType & CopyParam, TScriptProc
           break;
 
         default:
-          FAIL;
+          DebugFail;
           break;
       }
     }
@@ -1187,14 +1187,14 @@ void __fastcall TScript::ChecksumProc(TScriptProcParams * Parameters)
   try
   {
     if ((FileList->Count != 1) ||
-        NOT_NULL(dynamic_cast<TRemoteFile *>(FileList->Objects[0]))->IsDirectory)
+        DebugNotNull(dynamic_cast<TRemoteFile *>(FileList->Objects[0]))->IsDirectory)
     {
       throw Exception(FMTLOAD(NOT_FILE_ERROR, (FileList->Strings[0])));
     }
 
     FTerminal->CalculateFilesChecksum(Alg, FileList, Checksums.get(), NULL);
 
-    if (ALWAYS_TRUE(Checksums->Count == 1))
+    if (DebugAlwaysTrue(Checksums->Count == 1))
     {
       PrintLine(FORMAT(L"%s %s", (Checksums->Strings[0], FileList->Strings[0])));
     }
@@ -1833,7 +1833,7 @@ void __fastcall TScript::SynchronizePreview(
           break;
 
       default:
-        FAIL;
+        DebugFail;
       }
       PrintLine(Message);
     }
@@ -2363,7 +2363,7 @@ void __fastcall TManagementScript::TerminalSynchronizeDirectory(
 void __fastcall TManagementScript::TerminalInitializeLog(TObject * Sender)
 {
   TTerminal * ATerminal = dynamic_cast<TTerminal *>(Sender);
-  if (ALWAYS_TRUE(ATerminal != NULL))
+  if (DebugAlwaysTrue(ATerminal != NULL))
   {
     LogPendingLines(ATerminal);
   }

+ 8 - 8
source/core/SecureShell.cpp

@@ -178,7 +178,7 @@ Conf * __fastcall TSecureShell::StoreToConfig(TSessionData * Data, bool Simple)
       case cipAES: pcipher = CIPHER_AES; break;
       case cipDES: pcipher = CIPHER_DES; break;
       case cipArcfour: pcipher = CIPHER_ARCFOUR; break;
-      default: FAIL;
+      default: DebugFail;
     }
     conf_set_int_int(conf, CONF_ssh_cipherlist, c, pcipher);
   }
@@ -192,7 +192,7 @@ Conf * __fastcall TSecureShell::StoreToConfig(TSessionData * Data, bool Simple)
       case kexDHGroup14: pkex = KEX_DHGROUP14; break;
       case kexDHGEx: pkex = KEX_DHGEX; break;
       case kexRSA: pkex = KEX_RSA; break;
-      default: FAIL;
+      default: DebugFail;
     }
     conf_set_int_int(conf, CONF_ssh_kexlist, k, pkex);
   }
@@ -650,7 +650,7 @@ TPromptKind __fastcall TSecureShell::IdentifyPromptKind(UnicodeString & Name)
   else
   {
     PromptKind = pkPrompt;
-    FAIL;
+    DebugFail;
   }
 
   return PromptKind;
@@ -754,7 +754,7 @@ bool __fastcall TSecureShell::PromptUser(bool /*ToServer*/,
   else
   {
     PromptDesc = L"unknown";
-    FAIL;
+    DebugFail;
   }
 
   UnicodeString InstructionsLog =
@@ -898,7 +898,7 @@ void __fastcall TSecureShell::RegisterReceiveHandler(TNotifyEvent Handler)
 void __fastcall TSecureShell::UnregisterReceiveHandler(TNotifyEvent Handler)
 {
   DebugAssert(FOnReceive == Handler);
-  USEDPARAM(Handler);
+  DebugUsedParam(Handler);
   FOnReceive = NULL;
 }
 //---------------------------------------------------------------------------
@@ -1208,7 +1208,7 @@ void __fastcall TSecureShell::DispatchSendBuffer(int BufSize)
           break;
 
         default:
-          FAIL;
+          DebugFail;
           // fallthru
 
         case qaAbort:
@@ -1705,7 +1705,7 @@ void __fastcall TSecureShell::WaitForData()
           break;
 
         default:
-          FAIL;
+          DebugFail;
           // fallthru
 
         case qaAbort:
@@ -2286,7 +2286,7 @@ void __fastcall TSecureShell::AskAlg(const UnicodeString AlgType,
     }
     else
     {
-      FAIL;
+      DebugFail;
     }
 
     Msg = FMTLOAD(CIPHER_BELOW_TRESHOLD, (LoadStr(CipherType), AlgName));

+ 14 - 14
source/core/SessionData.cpp

@@ -79,7 +79,7 @@ int __fastcall TSessionData::Compare(TNamedObject * Other)
   int Result;
   // To avoid using CompareLogicalText on hex names of sessions in workspace.
   // The session 000A would be sorted before 0001.
-  if (IsWorkspace && NOT_NULL(dynamic_cast<TSessionData *>(Other))->IsWorkspace)
+  if (IsWorkspace && DebugNotNull(dynamic_cast<TSessionData *>(Other))->IsWorkspace)
   {
     Result = CompareText(Name, Other->Name);
   }
@@ -1256,7 +1256,7 @@ UnicodeString __fastcall TSessionData::GetSource()
       return L"Modified site";
 
     default:
-      FAIL;
+      DebugFail;
       return L"";
   }
 }
@@ -2318,7 +2318,7 @@ bool __fastcall TSessionData::IsSecure()
       break;
 
     default:
-      FAIL;
+      DebugFail;
       break;
   }
   return Result;
@@ -2334,7 +2334,7 @@ UnicodeString __fastcall TSessionData::GetProtocolUrl()
       break;
 
     default:
-      FAIL;
+      DebugFail;
       // fallback
     case fsSFTP:
     case fsSFTPonly:
@@ -2600,7 +2600,7 @@ UnicodeString __fastcall TSessionData::AssemblyString(TAssemblyLanguage Language
       break;
 
     default:
-      FAIL;
+      DebugFail;
       break;
   }
 
@@ -2704,7 +2704,7 @@ UnicodeString __fastcall TSessionData::GenerateAssemblyCode(
       break;
 
     default:
-      FAIL;
+      DebugFail;
       break;
   }
 
@@ -2718,7 +2718,7 @@ UnicodeString __fastcall TSessionData::GenerateAssemblyCode(
       break;
 
     default:
-      FAIL;
+      DebugFail;
       // fallback
     case fsSFTP:
     case fsSFTPonly:
@@ -2791,7 +2791,7 @@ UnicodeString __fastcall TSessionData::GenerateAssemblyCode(
               break;
 
             default:
-              FAIL;
+              DebugFail;
               break;
           }
           AddAssemblyProperty(Result, Language, L"FtpSecure", L"FtpSecure", FtpSecureMember);
@@ -2803,7 +2803,7 @@ UnicodeString __fastcall TSessionData::GenerateAssemblyCode(
         break;
 
       default:
-        FAIL;
+        DebugFail;
         break;
     }
     SessionData->Ftps = FactoryDefaults->Ftps;
@@ -3570,7 +3570,7 @@ void __fastcall TStoredSessionList::DoSave(THierarchicalStorage * Storage,
       catch (Exception & E)
       {
         UnicodeString Message;
-        if (RecryptPasswordOnly && ALWAYS_TRUE(RecryptPasswordErrors != NULL) &&
+        if (RecryptPasswordOnly && DebugAlwaysTrue(RecryptPasswordErrors != NULL) &&
             ExceptionMessage(&E, Message))
         {
           RecryptPasswordErrors->Add(FORMAT("%s: %s", (SessionData->SessionName, Message)));
@@ -4020,7 +4020,7 @@ bool __fastcall TStoredSessionList::IsFolderOrWorkspace(
 
   return
     Result &&
-    ALWAYS_TRUE(FirstData != NULL) &&
+    DebugAlwaysTrue(FirstData != NULL) &&
     (FirstData->IsWorkspace == Workspace);
 }
 //---------------------------------------------------------------------------
@@ -4042,7 +4042,7 @@ TSessionData * __fastcall TStoredSessionList::CheckIsInFolderOrWorkspaceAndResol
     Data = ResolveWorkspaceData(Data);
 
     if ((Data != NULL) && Data->CanLogin &&
-        ALWAYS_TRUE(Data->Link.IsEmpty()))
+        DebugAlwaysTrue(Data->Link.IsEmpty()))
     {
       return Data;
     }
@@ -4063,7 +4063,7 @@ void __fastcall TStoredSessionList::GetFolderOrWorkspace(const UnicodeString & N
       TSessionData * Data2 = new TSessionData(L"");
       Data2->Assign(Data);
 
-      if (!RawData->Link.IsEmpty() && (ALWAYS_TRUE(Data != RawData)) &&
+      if (!RawData->Link.IsEmpty() && (DebugAlwaysTrue(Data != RawData)) &&
           // BACKWARD COMPATIBILITY
           // When loading pre-5.6.4 workspace, that does not have state saved,
           // do not overwrite the site "state" defaults
@@ -4328,7 +4328,7 @@ int __fastcall DefaultPort(TFSProtocol FSProtocol, TFtps Ftps)
       }
       else
       {
-        FAIL;
+        DebugFail;
         Result = -1;
       }
       break;

+ 3 - 3
source/core/SessionInfo.cpp

@@ -327,7 +327,7 @@ protected:
       case laStat: return L"stat";
       case laChecksum: return L"checksum";
       case laCwd: return L"cwd";
-      default: FAIL; return L"";
+      default: DebugFail; return L"";
     }
   }
 
@@ -940,7 +940,7 @@ UnicodeString __fastcall TSessionLog::GetTlsVersionName(TTlsVersion TlsVersion)
   switch (TlsVersion)
   {
     default:
-      FAIL;
+      DebugFail;
     case ssl2:
       return "SSLv2";
     case ssl3:
@@ -1024,7 +1024,7 @@ void __fastcall TSessionLog::DoAddStartupInfo(TSessionData * Data)
 
       wchar_t UserName[UNLEN + 1];
       unsigned long UserNameSize = LENOF(UserName);
-      if (ALWAYS_FALSE(!GetUserNameEx(NameSamCompatible, UserName, &UserNameSize)))
+      if (DebugAlwaysFalse(!GetUserNameEx(NameSamCompatible, UserName, &UserNameSize)))
       {
         wcscpy(UserName, L"<Failed to retrieve username>");
       }

+ 11 - 11
source/core/SftpFileSystem.cpp

@@ -1237,7 +1237,7 @@ public:
 
       ReceiveResponse(Request, Response, ExpectedType, AllowStatus, TryOnly);
 
-      if ((Response->Capacity == 0) && ALWAYS_TRUE(TryOnly))
+      if ((Response->Capacity == 0) && DebugAlwaysTrue(TryOnly))
       {
         FRequests->Insert(0, Request);
         Request = NULL;
@@ -1949,7 +1949,7 @@ void __fastcall TSFTPFileSystem::CollectUsage()
       VersionCounter = L"OpenedSessionsSFTP6";
       break;
     default:
-      FAIL;
+      DebugFail;
   }
   FTerminal->Configuration->Usage->Inc(VersionCounter);
 }
@@ -2161,7 +2161,7 @@ bool __fastcall TSFTPFileSystem::IsCapable(int Capability) const
       return false;
 
     default:
-      FAIL;
+      DebugFail;
       return false;
   }
 }
@@ -2588,7 +2588,7 @@ int __fastcall TSFTPFileSystem::ReceivePacket(TSFTPPacket * Packet,
     while (IsReserved);
   }
 
-  if ((Packet->Capacity == 0) && ALWAYS_TRUE(TryOnly))
+  if ((Packet->Capacity == 0) && DebugAlwaysTrue(TryOnly))
   {
     // noop
   }
@@ -3182,7 +3182,7 @@ void __fastcall TSFTPFileSystem::DoStartup()
       break;
 
     default:
-      FAIL;
+      DebugFail;
     case asAuto:
       // Nb, Foxit server does not exist anymore
       if (GetSessionInfo().SshImplementation.Pos(L"Foxit-WAC-Server") == 1)
@@ -4135,13 +4135,13 @@ void __fastcall TSFTPFileSystem::CustomCommandOnFile(const UnicodeString /*FileN
     const TRemoteFile * /*File*/, UnicodeString /*Command*/, int /*Params*/,
     TCaptureOutputEvent /*OutputEvent*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TSFTPFileSystem::AnyCommand(const UnicodeString /*Command*/,
   TCaptureOutputEvent /*OutputEvent*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 TStrings * __fastcall TSFTPFileSystem::GetFixedPaths()
@@ -4184,7 +4184,7 @@ void __fastcall TSFTPFileSystem::SpaceAvailable(const UnicodeString Path,
       FTerminal->LogEvent(L"Missing bytes-per-allocation-unit field");
     }
   }
-  else if (ALWAYS_TRUE(FSupportsStatVfsV2))
+  else if (DebugAlwaysTrue(FSupportsStatVfsV2))
   {
     // http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL?rev=HEAD;content-type=text/plain
     TSFTPPacket Packet(SSH_FXP_EXTENDED);
@@ -4396,7 +4396,7 @@ void __fastcall TSFTPFileSystem::SFTPConfirmOverwrite(
           OperationProgress->BatchOverwrite = boAlternateResume;
           break;
 
-        default: FAIL; //fallthru
+        default: DebugFail; //fallthru
         case qaCancel:
           if (!OperationProgress->Cancel)
           {
@@ -6126,12 +6126,12 @@ void __fastcall TSFTPFileSystem::GetSupportedChecksumAlgs(TStrings * Algs)
 //---------------------------------------------------------------------------
 void __fastcall TSFTPFileSystem::LockFile(const UnicodeString & /*FileName*/, const TRemoteFile * /*File*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TSFTPFileSystem::UnlockFile(const UnicodeString & /*FileName*/, const TRemoteFile * /*File*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TSFTPFileSystem::UpdateFromMain(TCustomFileSystem * /*MainFileSystem*/)

+ 9 - 9
source/core/Terminal.cpp

@@ -263,7 +263,7 @@ TSynchronizeChecklist::TAction __fastcall TSynchronizeChecklist::Reverse(TSynchr
 
     default:
     case saNone:
-      FAIL;
+      DebugFail;
       return saNone;
   }
 }
@@ -622,7 +622,7 @@ void TRetryOperationLoop::DoError(Exception & E, TSessionAction * Action, const
       break;
 
     default:
-      FAIL;
+      DebugFail;
       break;
   }
 }
@@ -1224,7 +1224,7 @@ void __fastcall TTerminal::Reopen(int Params)
     // Could be active before, if fatal error occured in the secondary terminal.
     // But now, since we handle the secondary terminal's OnClose,
     // by closing outselves, it should not happen anymore.
-    if (ALWAYS_FALSE(Active))
+    if (DebugAlwaysFalse(Active))
     {
       Close();
     }
@@ -1371,7 +1371,7 @@ unsigned int __fastcall TTerminal::QueryUserException(const UnicodeString Query,
 {
   unsigned int Result;
   UnicodeString ExMessage;
-  if (ALWAYS_TRUE(ExceptionMessage(E, ExMessage) || !Query.IsEmpty()))
+  if (DebugAlwaysTrue(ExceptionMessage(E, ExMessage) || !Query.IsEmpty()))
   {
     TStrings * MoreMessages = new TStringList();
     try
@@ -1390,7 +1390,7 @@ unsigned int __fastcall TTerminal::QueryUserException(const UnicodeString Query,
       // We know MoreMessages not to be NULL here,
       // AppendExceptionStackTraceAndForget should never return true
       // (indicating it had to create the string list)
-      ALWAYS_FALSE(AppendExceptionStackTraceAndForget(MoreMessages));
+      DebugAlwaysFalse(AppendExceptionStackTraceAndForget(MoreMessages));
 
       TQueryParams HelpKeywordOverrideParams;
       if (Params != NULL)
@@ -2314,7 +2314,7 @@ unsigned int __fastcall TTerminal::ConfirmFileOverwrite(
         FormatSize(FileParams->DestSize),
         UserModificationStr(FileParams->DestTimestamp, FileParams->DestPrecision)));
     }
-    if (ALWAYS_TRUE(QueryParams->HelpKeyword.IsEmpty()))
+    if (DebugAlwaysTrue(QueryParams->HelpKeyword.IsEmpty()))
     {
       QueryParams->HelpKeyword = HELP_OVERWRITE;
     }
@@ -5128,7 +5128,7 @@ void __fastcall TTerminal::SynchronizeApply(TSynchronizeChecklist * Checklist,
                 break;
 
               default:
-                FAIL;
+                DebugFail;
                 break;
             }
           }
@@ -5165,7 +5165,7 @@ void __fastcall TTerminal::SynchronizeApply(TSynchronizeChecklist * Checklist,
                 break;
 
               default:
-                FAIL;
+                DebugFail;
                 break;
             }
           }
@@ -5931,7 +5931,7 @@ void __fastcall TTerminal::CollectTlsUsage(const UnicodeString & TlsVersionStr)
   }
   else
   {
-    FAIL;
+    DebugFail;
   }
 }
 //---------------------------------------------------------------------------

+ 18 - 18
source/core/WebDAVFileSystem.cpp

@@ -111,7 +111,7 @@ void ne_debug(void * Context, int Channel, const char * Format, ...)
   else
   {
     DoLog = false;
-    FAIL;
+    DebugFail;
   }
 
   #ifndef _DEBUG
@@ -656,7 +656,7 @@ bool __fastcall TWebDAVFileSystem::IsCapable(int Capability) const
       return FLAGSET(FCapabilities, NE_CAP_DAV_CLASS2);
 
     default:
-      FAIL;
+      DebugFail;
       return false;
   }
 }
@@ -701,7 +701,7 @@ void __fastcall TWebDAVFileSystem::CheckStatus(int NeonStatus)
 //---------------------------------------------------------------------------
 void __fastcall TWebDAVFileSystem::LookupUsersGroups()
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TWebDAVFileSystem::ReadCurrentDirectory()
@@ -845,7 +845,7 @@ void __fastcall TWebDAVFileSystem::ReadSymlink(TRemoteFile * /*SymlinkFile*/,
   TRemoteFile *& /*File*/)
 {
   // we never set SymLink flag, so we should never get here
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TWebDAVFileSystem::ReadFile(const UnicodeString FileName,
@@ -902,7 +902,7 @@ void __fastcall TWebDAVFileSystem::ParsePropResultSet(TRemoteFile * File,
     File->Size = StrToInt64Def(ContentLength, 0);
   }
   const char * LastModified = GetProp(Results, PROP_LAST_MODIFIED);
-  if (ALWAYS_TRUE(LastModified != NULL))
+  if (DebugAlwaysTrue(LastModified != NULL))
   {
     char WeekDay[4] = { L'\0' };
     int Year = 0;
@@ -1091,7 +1091,7 @@ void __fastcall TWebDAVFileSystem::RenameFile(const UnicodeString FileName,
 void __fastcall TWebDAVFileSystem::CopyFile(const UnicodeString FileName,
     const UnicodeString NewName)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TWebDAVFileSystem::CreateDirectory(const UnicodeString DirName)
@@ -1104,19 +1104,19 @@ void __fastcall TWebDAVFileSystem::CreateDirectory(const UnicodeString DirName)
 void __fastcall TWebDAVFileSystem::CreateLink(const UnicodeString FileName,
   const UnicodeString PointTo, bool /*Symbolic*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TWebDAVFileSystem::ChangeFileProperties(const UnicodeString FileName,
   const TRemoteFile * /*File*/, const TRemoteProperties * /*Properties*/,
   TChmodSessionAction & /*Action*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 bool __fastcall TWebDAVFileSystem::LoadFilesProperties(TStrings * /*FileList*/)
 {
-  FAIL;
+  DebugFail;
   return false;
 }
 //---------------------------------------------------------------------------
@@ -1124,7 +1124,7 @@ void __fastcall TWebDAVFileSystem::CalculateFilesChecksum(const UnicodeString &
     TStrings * /*FileList*/, TStrings * /*Checksums*/,
     TCalculatedChecksumEvent /*OnCalculatedChecksum*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TWebDAVFileSystem::ConfirmOverwrite(
@@ -1171,7 +1171,7 @@ void __fastcall TWebDAVFileSystem::ConfirmOverwrite(
       THROW_SKIP_FILE_NULL;
 
     default:
-      FAIL;
+      DebugFail;
     case qaCancel:
       if (!OperationProgress->Cancel)
       {
@@ -1185,13 +1185,13 @@ void __fastcall TWebDAVFileSystem::ConfirmOverwrite(
 void __fastcall TWebDAVFileSystem::CustomCommandOnFile(const UnicodeString FileName,
   const TRemoteFile * /*File*/, UnicodeString Command, int /*Params*/, TCaptureOutputEvent /*OutputEvent*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TWebDAVFileSystem::AnyCommand(const UnicodeString Command,
   TCaptureOutputEvent /*OutputEvent*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 TStrings * __fastcall TWebDAVFileSystem::GetFixedPaths()
@@ -1958,7 +1958,7 @@ void __fastcall TWebDAVFileSystem::Sink(const UnicodeString FileName,
   if (File->IsDirectory)
   {
     Action.Cancel();
-    if (ALWAYS_TRUE(!File->IsSymLink))
+    if (DebugAlwaysTrue(!File->IsSymLink))
     {
       FILE_OPERATION_LOOP_BEGIN
       {
@@ -2235,7 +2235,7 @@ bool TWebDAVFileSystem::VerifyCertificate(const TWebDAVCertificateData & Data)
           break;
 
         default:
-          FAIL;
+          DebugFail;
         case qaCancel:
           FTerminal->Configuration->Usage->Inc(L"HostNotVerified");
           Result = false;
@@ -2428,7 +2428,7 @@ void TWebDAVFileSystem::NeonNotifier(void * UserData, ne_session_status Status,
   // handling that would reset the upload progress back to low number (response is small).
   if (((FileSystem->FUploading && (Status == ne_status_sending)) ||
        (FileSystem->FDownloading && (Status == ne_status_recving))) &&
-      ALWAYS_TRUE(OperationProgress != NULL))
+      DebugAlwaysTrue(OperationProgress != NULL))
   {
     __int64 Progress = StatusInfo->sr.progress;
     __int64 Diff = Progress - OperationProgress->TransferedSize;
@@ -2625,7 +2625,7 @@ void __fastcall TWebDAVFileSystem::UnlockFile(const UnicodeString & FileName, co
 void __fastcall TWebDAVFileSystem::UpdateFromMain(TCustomFileSystem * AMainFileSystem)
 {
   TWebDAVFileSystem * MainFileSystem = dynamic_cast<TWebDAVFileSystem *>(AMainFileSystem);
-  if (ALWAYS_TRUE(MainFileSystem != NULL))
+  if (DebugAlwaysTrue(MainFileSystem != NULL))
   {
     TGuard Guard(FNeonLockStoreSection);
     TGuard MainGuard(MainFileSystem->FNeonLockStoreSection);
@@ -2639,7 +2639,7 @@ void __fastcall TWebDAVFileSystem::UpdateFromMain(TCustomFileSystem * AMainFileS
       }
     }
 
-    if (ALWAYS_TRUE(MainFileSystem->FNeonLockStore != NULL))
+    if (DebugAlwaysTrue(MainFileSystem->FNeonLockStore != NULL))
     {
       RequireLockStore();
       struct ne_lock * Lock = ne_lockstore_first(MainFileSystem->FNeonLockStore);

+ 2 - 2
source/forms/About.cpp

@@ -303,9 +303,9 @@ void __fastcall TAboutDialog::LoadThirdParty()
 
   TStreamAdapter * ThirdPartyStreamAdapter = new TStreamAdapter(ThirdPartyStream.get(), soReference);
   IPersistStreamInit * PersistStreamInit = NULL;
-  if (ALWAYS_TRUE(ThirdPartyWebBrowser->Document != NULL) &&
+  if (DebugAlwaysTrue(ThirdPartyWebBrowser->Document != NULL) &&
       SUCCEEDED(ThirdPartyWebBrowser->Document->QueryInterface(IID_IPersistStreamInit, (void **)&PersistStreamInit)) &&
-      ALWAYS_TRUE(PersistStreamInit != NULL))
+      DebugAlwaysTrue(PersistStreamInit != NULL))
   {
     PersistStreamInit->Load(static_cast<_di_IStream>(*ThirdPartyStreamAdapter));
   }

+ 1 - 1
source/forms/Animations.cpp

@@ -61,6 +61,6 @@ __fastcall TAnimationsModule::TAnimationsModule(TComponent * Owner)
   // Not really necessary as we never acccess AnimationImages by name
   CopyDataModule(this, ScaledModule);
 
-  AnimationImages = NOT_NULL(dynamic_cast<TPngImageList *>(FindComponent(AnimationImages->Name)));
+  AnimationImages = DebugNotNull(dynamic_cast<TPngImageList *>(FindComponent(AnimationImages->Name)));
 }
 //---------------------------------------------------------------------------

+ 1 - 1
source/forms/Authenticate.cpp

@@ -286,7 +286,7 @@ bool __fastcall TAuthenticateForm::PromptUser(TPromptKind Kind, UnicodeString Na
     if (!ShowSavePasswordPanel &&
         (Prompts->Count == 1) &&
         FLAGSET(int(Prompts->Objects[0]), pupRemember) &&
-        ALWAYS_TRUE(IsPasswordOrPassphrasePrompt(Kind, Prompts)))
+        DebugAlwaysTrue(IsPasswordOrPassphrasePrompt(Kind, Prompts)))
     {
       ShowSessionRememberPasswordPanel = true;
     }

+ 1 - 1
source/forms/Cleanup.cpp

@@ -120,7 +120,7 @@ void __fastcall TCleanupDialog::InitControls()
         break;
 
       default:
-        FAIL;
+        DebugFail;
         break;
     }
 

+ 39 - 39
source/forms/CustomScpExplorer.cpp

@@ -405,7 +405,7 @@ void __fastcall TCustomScpExplorerForm::WMCopyData(TMessage & Message)
   PCOPYDATASTRUCT CopyData = reinterpret_cast<PCOPYDATASTRUCT>(Message.LParam);
 
   size_t MessageSize = sizeof(TCopyDataMessage);
-  bool Result = ALWAYS_TRUE(CopyData->cbData == MessageSize);
+  bool Result = DebugAlwaysTrue(CopyData->cbData == MessageSize);
   if (Result)
   {
     const TCopyDataMessage & Message = *reinterpret_cast<const TCopyDataMessage *>(CopyData->lpData);
@@ -467,7 +467,7 @@ bool __fastcall TCustomScpExplorerForm::CommandLineFromAnotherInstance(
   const UnicodeString & CommandLine)
 {
   TProgramParams Params(CommandLine);
-  bool Result = CanCommandLineFromAnotherInstance() && ALWAYS_TRUE(Params.ParamCount > 0);
+  bool Result = CanCommandLineFromAnotherInstance() && DebugAlwaysTrue(Params.ParamCount > 0);
   if (Result)
   {
     NonVisualDataModule->StartBusy();
@@ -1165,7 +1165,7 @@ void __fastcall TCustomScpExplorerForm::AddQueueItem(TTerminalQueue * Queue, TQu
 {
   if (Queue->IsEmpty)
   {
-    TManagedTerminal * ManagedTerminal = NOT_NULL(dynamic_cast<TManagedTerminal *>(Terminal));
+    TManagedTerminal * ManagedTerminal = DebugNotNull(dynamic_cast<TManagedTerminal *>(Terminal));
     ManagedTerminal->QueueOperationStart = Now();
   }
   Queue->AddItem(QueueItem);
@@ -1456,14 +1456,14 @@ void __fastcall TCustomScpExplorerForm::OperationFinished(
 TCustomDirView * __fastcall TCustomScpExplorerForm::DirView(TOperationSide Side)
 {
   DebugAssert(GetSide(Side) == osRemote);
-  USEDPARAM(Side);
+  DebugUsedParam(Side);
   return RemoteDirView;
 }
 //---------------------------------------------------------------------------
 bool __fastcall TCustomScpExplorerForm::DirViewEnabled(TOperationSide Side)
 {
   DebugAssert(GetSide(Side) == osRemote);
-  USEDPARAM(Side);
+  DebugUsedParam(Side);
   return (Terminal != NULL);
 }
 //---------------------------------------------------------------------------
@@ -1874,7 +1874,7 @@ void __fastcall TCustomScpExplorerForm::CustomCommand(TStrings * FileList,
             for (int Index = 0; Index < RemoteFileList->Count; Index++)
             {
               UnicodeString FileName = RemoteFileList->Strings[Index];
-              if (ALWAYS_TRUE(SameText(TempDir, FileName.SubString(1, TempDir.Length()))) &&
+              if (DebugAlwaysTrue(SameText(TempDir, FileName.SubString(1, TempDir.Length()))) &&
                   // Skip directories for now, they require recursion,
                   // and we do not have original nested files times available here yet.
                   // The check is redundant as FileAge fails for directories anyway.
@@ -1906,7 +1906,7 @@ void __fastcall TCustomScpExplorerForm::CustomCommand(TStrings * FileList,
         __finally
         {
           FAutoOperation = false;
-          if (!RootTempDir.IsEmpty() && ALWAYS_TRUE(!RemoteFiles))
+          if (!RootTempDir.IsEmpty() && DebugAlwaysTrue(!RemoteFiles))
           {
             RecursiveDeleteFile(ExcludeTrailingBackslash(RootTempDir), false);
           }
@@ -2348,7 +2348,7 @@ bool __fastcall TCustomScpExplorerForm::ExecuteFileOperation(TFileOperation Oper
     }
     else
     {
-      FAIL;
+      DebugFail;
     }
   }
   __finally
@@ -2702,7 +2702,7 @@ void __fastcall TCustomScpExplorerForm::CustomExecuteFile(TOperationSide Side,
       // no need for handle
       if (Process != NULL)
       {
-        CHECK(CloseHandle(Process));
+        DebugCheck(CloseHandle(Process));
       }
       Process = INVALID_HANDLE_VALUE;
     }
@@ -2771,7 +2771,7 @@ void __fastcall TCustomScpExplorerForm::AnyInternalEditorModified(
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::LocalEditorClosed(TObject * Sender, bool /*Forced*/)
 {
-  CHECK(FLocalEditors->Extract(Sender) >= 0);
+  DebugCheck(FLocalEditors->Extract(Sender) >= 0);
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::TemporaryDirectoryForRemoteFiles(
@@ -3017,7 +3017,7 @@ void __fastcall TCustomScpExplorerForm::ExecuteFile(TOperationSide Side,
         break;
 
       default:
-        FAIL;
+        DebugFail;
     }
   }
   else
@@ -3040,7 +3040,7 @@ void __fastcall TCustomScpExplorerForm::ExecuteFile(TOperationSide Side,
         break;
 
       default:
-        FAIL;
+        DebugFail;
     }
   }
 
@@ -3391,7 +3391,7 @@ void __fastcall TCustomScpExplorerForm::ExecutedFileEarlyClosed(
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::ExecutedFileUploadComplete(TObject * Sender)
 {
-  EditorFormFileUploadComplete(NOT_NULL(dynamic_cast<TForm *>(Sender)));
+  EditorFormFileUploadComplete(DebugNotNull(dynamic_cast<TForm *>(Sender)));
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::RemoteDirViewEnter(TObject * /*Sender*/)
@@ -4609,7 +4609,7 @@ void __fastcall TCustomScpExplorerForm::DoDirViewExecFile(TObject * Sender,
       }
       else
       {
-        FAIL;
+        DebugFail;
       }
     }
 
@@ -4632,12 +4632,12 @@ bool __fastcall TCustomScpExplorerForm::GetHasDirView(TOperationSide Side)
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::CompareDirectories()
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::SynchronizeDirectories()
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 bool __fastcall TCustomScpExplorerForm::DoSynchronizeDirectories(
@@ -4997,7 +4997,7 @@ void __fastcall TCustomScpExplorerForm::StandaloneEdit(const UnicodeString & Fil
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::ExploreLocalDirectory()
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 TSessionData * __fastcall TCustomScpExplorerForm::CloneCurrentSessionData()
@@ -5036,7 +5036,7 @@ TObjectList * __fastcall TCustomScpExplorerForm::DoCollectWorkspace()
   TTerminalManager * Manager = TTerminalManager::Instance();
   std::unique_ptr<TObjectList> DataList(new TObjectList());
 
-  if (ALWAYS_TRUE(Terminal != NULL))
+  if (DebugAlwaysTrue(Terminal != NULL))
   {
     // Update (Managed)Terminal->StateData
     UpdateTerminal(Terminal);
@@ -5439,7 +5439,7 @@ void __fastcall TCustomScpExplorerForm::QueueDDDragEnter(
 void __fastcall TCustomScpExplorerForm::FileControlDDDragLeave(
   TObject * Sender)
 {
-  USEDPARAM(Sender);
+  DebugUsedParam(Sender);
   DebugAssert(FDDTargetControl == Sender);
   FDDTargetControl = NULL;
 }
@@ -5457,7 +5457,7 @@ void __fastcall TCustomScpExplorerForm::QueueDDDragLeave()
 void __fastcall TCustomScpExplorerForm::AddEditLink(TOperationSide Side, bool Add)
 {
   DebugAssert(GetSide(Side) == osRemote);
-  USEDPARAM(Side);
+  DebugUsedParam(Side);
 
   bool Edit = false;
   TRemoteFile * File = NULL;
@@ -5706,11 +5706,11 @@ TTerminal * __fastcall TCustomScpExplorerForm::GetSessionTabTerminal(TTabSheet *
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::UpdateSessionTab(TTabSheet * TabSheet)
 {
-  if (ALWAYS_TRUE(TabSheet != NULL))
+  if (DebugAlwaysTrue(TabSheet != NULL))
   {
     TManagedTerminal * ManagedTerminal =
       dynamic_cast<TManagedTerminal *>(GetSessionTabTerminal(TabSheet));
-    if (ALWAYS_TRUE(ManagedTerminal != NULL))
+    if (DebugAlwaysTrue(ManagedTerminal != NULL))
     {
       TColor Color =
         (ManagedTerminal == FTerminal) ? FSessionColor : ManagedTerminal->StateData->Color;
@@ -5718,7 +5718,7 @@ void __fastcall TCustomScpExplorerForm::UpdateSessionTab(TTabSheet * TabSheet)
       TabSheet->ImageIndex = AddSessionColor(Color);
 
       TThemeTabSheet * ThemeTabSheet = dynamic_cast<TThemeTabSheet *>(TabSheet);
-      if (ALWAYS_TRUE(ThemeTabSheet != NULL))
+      if (DebugAlwaysTrue(ThemeTabSheet != NULL))
       {
         ThemeTabSheet->Shadowed = !ManagedTerminal->Active;
       }
@@ -6115,7 +6115,7 @@ void __fastcall TCustomScpExplorerForm::InactiveTerminalException(
   if (!Terminal->Active)
   {
     int Index = TTerminalManager::Instance()->IndexOf(Terminal);
-    if (ALWAYS_TRUE((Index >= 0) && (Index < SessionsPageControl->PageCount)))
+    if (DebugAlwaysTrue((Index >= 0) && (Index < SessionsPageControl->PageCount)))
     {
       UpdateSessionTab(SessionsPageControl->Pages[Index]);
     }
@@ -6160,7 +6160,7 @@ void __fastcall TCustomScpExplorerForm::QueueEmptyNoteClicked(TObject * Sender)
   RestoreApp();
 
   TTerminalNoteData * TerminalNoteData = dynamic_cast<TTerminalNoteData *>(Sender);
-  if (ALWAYS_TRUE(TerminalNoteData != NULL) &&
+  if (DebugAlwaysTrue(TerminalNoteData != NULL) &&
       !NonVisualDataModule->Busy)
   {
     TTerminal * Terminal = TerminalNoteData->Terminal;
@@ -6176,7 +6176,7 @@ void __fastcall TCustomScpExplorerForm::QueueEmptyNoteClicked(TObject * Sender)
 void __fastcall TCustomScpExplorerForm::QueueEvent(TTerminal * ATerminal,
   TTerminalQueue * /*Queue*/, TQueueEvent Event)
 {
-  TManagedTerminal * ManagedTerminal = NOT_NULL(dynamic_cast<TManagedTerminal *>(ATerminal));
+  TManagedTerminal * ManagedTerminal = DebugNotNull(dynamic_cast<TManagedTerminal *>(ATerminal));
   UnicodeString Message;
   TNotifyEvent OnClick = NULL;
   TObject * UserData = NULL;
@@ -6207,7 +6207,7 @@ void __fastcall TCustomScpExplorerForm::QueueEvent(TTerminal * ATerminal,
       break;
 
     default:
-      FAIL;
+      DebugFail;
   }
 
   if (!Message.IsEmpty())
@@ -6679,7 +6679,7 @@ void __fastcall TCustomScpExplorerForm::RemoteFileControlDDCreateDataObject(
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::GoToCommandLine()
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::GoToTree()
@@ -6716,7 +6716,7 @@ TStrings * __fastcall TCustomScpExplorerForm::PanelExport(TOperationSide Side,
       break;
 
     default:
-      FAIL;
+      DebugFail;
   }
   return ExportData.release();
 }
@@ -6739,7 +6739,7 @@ void __fastcall TCustomScpExplorerForm::PanelExportStore(TOperationSide /*Side*/
   }
   else
   {
-    FAIL;
+    DebugFail;
   }
 }
 //---------------------------------------------------------------------------
@@ -6781,7 +6781,7 @@ bool __fastcall TCustomScpExplorerForm::AllowQueueOperation(
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::GoToQueue()
 {
-  if (ALWAYS_TRUE(QueueView3->Visible))
+  if (DebugAlwaysTrue(QueueView3->Visible))
   {
     QueueView3->SetFocus();
   }
@@ -7251,7 +7251,7 @@ void __fastcall TCustomScpExplorerForm::FileListFromClipboard()
 void __fastcall TCustomScpExplorerForm::SelectSameExt(bool Select)
 {
   TCustomDirView * CurrentDirView = DirView(osCurrent);
-  if (ALWAYS_TRUE(CurrentDirView->ItemFocused != NULL))
+  if (DebugAlwaysTrue(CurrentDirView->ItemFocused != NULL))
   {
     UnicodeString FileName = CurrentDirView->ItemFileName(CurrentDirView->ItemFocused);
     UnicodeString Ext;
@@ -7663,9 +7663,9 @@ void __fastcall TCustomScpExplorerForm::TransferPresetNoteClicked(TObject * Send
   RestoreApp();
 
   // .. and we should never be busy here
-  if (ALWAYS_TRUE(!NonVisualDataModule->Busy))
+  if (DebugAlwaysTrue(!NonVisualDataModule->Busy))
   {
-    TransferPresetNoteMessage(NOT_NULL(dynamic_cast<TTransferPresetNoteData *>(Sender)), false);
+    TransferPresetNoteMessage(DebugNotNull(dynamic_cast<TTransferPresetNoteData *>(Sender)), false);
   }
 }
 //---------------------------------------------------------------------------
@@ -8167,7 +8167,7 @@ void __fastcall TCustomScpExplorerForm::SuspendWindowLock()
     // while we have nesting counter, we know that we never be called
     // recursivelly as Application->OnModalBegin is called only
     // for the top-level modal window
-    if (ALWAYS_TRUE(FLockSuspendLevel == 0))
+    if (DebugAlwaysTrue(FLockSuspendLevel == 0))
     {
       // won't be disabled when conditions in LockWindow() were not satisfied
       FDisabledOnLockSuspend = !Enabled;
@@ -8190,7 +8190,7 @@ void __fastcall TCustomScpExplorerForm::ResumeWindowLock()
     DebugAssert(FLockLevel > 0);
     FLockSuspendLevel--;
     // see comment in SuspendWindowLock
-    if (ALWAYS_TRUE(FLockSuspendLevel == 0))
+    if (DebugAlwaysTrue(FLockSuspendLevel == 0))
     {
       // Note that window can be enabled here, when we were minized to tray when
       // was SuspendWindowLock() called.
@@ -8292,7 +8292,7 @@ void __fastcall TCustomScpExplorerForm::RemotePathComboBoxItemClick(
 void __fastcall TCustomScpExplorerForm::RemotePathComboBoxCancel(TObject * Sender)
 {
   DebugAssert(Sender == GetComponent(fcRemotePathComboBox));
-  USEDPARAM(Sender);
+  DebugUsedParam(Sender);
   UpdateRemotePathComboBox(true);
 }
 //---------------------------------------------------------------------------
@@ -8475,7 +8475,7 @@ void __fastcall TCustomScpExplorerForm::SessionsPageControlMouseDown(
       {
         SessionsPageControl->ActivePageIndex = Index;
         // Switch to session tab (has to be session tab, due to previous check)
-        if (ALWAYS_TRUE(SessionTabSwitched()))
+        if (DebugAlwaysTrue(SessionTabSwitched()))
         {
           CloseSession();
         }
@@ -8724,7 +8724,7 @@ bool __fastcall TCustomScpExplorerForm::UpdateToolbarDisplayMode()
 //---------------------------------------------------------------------------
 void __fastcall TCustomScpExplorerForm::DisplaySystemContextMenu()
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 bool __fastcall TCustomScpExplorerForm::IsBusy()

+ 10 - 10
source/forms/Editor.cpp

@@ -69,17 +69,17 @@ void __fastcall ReconfigureEditorForm(TForm * Form)
 //---------------------------------------------------------------------------
 void __fastcall EditorFormFileUploadComplete(TForm * Form)
 {
-  NOT_NULL(dynamic_cast<TEditorForm *>(Form))->FileUploadComplete();
+  DebugNotNull(dynamic_cast<TEditorForm *>(Form))->FileUploadComplete();
 }
 //---------------------------------------------------------------------------
 void __fastcall EditorFormFileSave(TForm * Form)
 {
-  NOT_NULL(dynamic_cast<TEditorForm *>(Form))->SaveFile();
+  DebugNotNull(dynamic_cast<TEditorForm *>(Form))->SaveFile();
 }
 //---------------------------------------------------------------------------
 bool __fastcall IsEditorFormModified(TForm * Form)
 {
-  return NOT_NULL(dynamic_cast<TEditorForm *>(Form))->IsFileModified();
+  return DebugNotNull(dynamic_cast<TEditorForm *>(Form))->IsFileModified();
 }
 //---------------------------------------------------------------------------
 class TPreambleFilteringFileStream : public TFileStream
@@ -139,7 +139,7 @@ int __fastcall TPreambleFilteringFileStream::Write(const void * Buffer, int Coun
 int __fastcall TPreambleFilteringFileStream::Write(
   const System::DynamicArray<System::Byte> /*Buffer*/, int /*Offset*/, int /*Count*/)
 {
-  FAIL;
+  DebugFail;
   EXCEPTION;
 }
 //---------------------------------------------------------------------------
@@ -303,7 +303,7 @@ void __fastcall TRichEdit20::DestroyWnd()
 {
   TRichEdit::DestroyWnd();
 
-  if (ALWAYS_TRUE(FLibrary != 0))
+  if (DebugAlwaysTrue(FLibrary != 0))
   {
     FreeLibrary(FLibrary);
   }
@@ -538,7 +538,7 @@ bool __stdcall TRichEdit20::StreamLoad(
             }
             // If Unicode preamble is present, set StartIndex to skip over it
             TBytes Preamble = TEncoding::Unicode->GetPreamble();
-            if (ALWAYS_TRUE(Preamble.Length == 2) &&
+            if (DebugAlwaysTrue(Preamble.Length == 2) &&
                 (WasRead >= 2) && (Buffer[0] == Preamble[0]) && (Buffer[1] == Preamble[1]))
             {
               StartIndex = 2;
@@ -910,7 +910,7 @@ void __fastcall TEditorForm::EditorActionsExecute(TBasicAction *Action,
   }
   else if (Action == ColorAction)
   {
-    if (ALWAYS_TRUE(Action->ActionComponent != NULL))
+    if (DebugAlwaysTrue(Action->ActionComponent != NULL))
     {
       CreateEditorBackgroundColorMenu(Action->ActionComponent, BackgroundColor,
         SetBackgroundColor);
@@ -1007,7 +1007,7 @@ void __fastcall TEditorForm::FileUploadComplete()
   DebugAssert(FSaving);
   FSaving = false;
   UpdateControls();
-  if (FClosePending && ALWAYS_TRUE(FStandaloneEditor))
+  if (FClosePending && DebugAlwaysTrue(FStandaloneEditor))
   {
     Close();
   }
@@ -1281,7 +1281,7 @@ void __fastcall TEditorForm::LoadFromFile(bool PrimaryEncoding)
 
         default:
           CanTrySecondary = false;
-          FAIL;
+          DebugFail;
           // fallthru
 
         case CP_ACP:
@@ -1391,7 +1391,7 @@ void __fastcall TEditorForm::CheckFileSize()
             break;
 
           default:
-            FAIL;
+            DebugFail;
         }
       }
     }

+ 2 - 2
source/forms/FileFind.cpp

@@ -126,7 +126,7 @@ void __fastcall TFileFindDialog::UpdateControls()
       break;
 
     default:
-      FAIL;
+      DebugFail;
       break;
   }
 }
@@ -252,7 +252,7 @@ void __fastcall TFileFindDialog::FileFound(TTerminal * /*Terminal*/,
   }
   else
   {
-    FAIL;
+    DebugFail;
   }
   Item->SubItems->Add(Directory);
 

+ 2 - 2
source/forms/FullSynchronize.cpp

@@ -141,7 +141,7 @@ int __fastcall TFullSynchronizeDialog::ActualCopyParamAttrs()
         break;
 
       default:
-        FAIL;
+        DebugFail;
         //fallthru
       case smBoth:
         Result = CopyParamAttrs.General;
@@ -214,7 +214,7 @@ void __fastcall TFullSynchronizeDialog::SetMode(TSynchronizeMode value)
        break;
 
     default:
-      FAIL;
+      DebugFail;
   }
 }
 //---------------------------------------------------------------------------

+ 6 - 6
source/forms/GenerateUrl.cpp

@@ -100,7 +100,7 @@ void __fastcall TGenerateUrlDialog::UpdateControls()
       ResultGroupBelow = ScriptOptionsGroup;
       ResultGroupCaption = ScriptFormatCombo->Items->Strings[ScriptFormatCombo->ItemIndex];
     }
-    else if (ALWAYS_TRUE(AssemblyButton->Checked))
+    else if (DebugAlwaysTrue(AssemblyButton->Checked))
     {
       ResultGroupBelow = AssemblyOptionsGroup;
       ResultGroupCaption = LoadStr(GENERATE_URL_CODE);
@@ -199,7 +199,7 @@ void __fastcall TGenerateUrlDialog::UpdateControls()
         FixedWidth = false;
       }
     }
-    else if (ALWAYS_TRUE(AssemblyButton->Checked))
+    else if (DebugAlwaysTrue(AssemblyButton->Checked))
     {
       Result = FData->GenerateAssemblyCode(static_cast<TAssemblyLanguage>(AssemblyLanguageCombo->ItemIndex));
       WordWrap = false;
@@ -254,7 +254,7 @@ void __fastcall TGenerateUrlDialog::Execute()
           break;
 
         default:
-          FAIL;
+          DebugFail;
       }
     }
 
@@ -262,7 +262,7 @@ void __fastcall TGenerateUrlDialog::Execute()
     {
       TCheckBox * CheckBox = dynamic_cast<TCheckBox *>(OptionsGroup->Controls[Index]);
 
-      if (ALWAYS_TRUE((CheckBox != NULL) && (CheckBox->Tag != 0)))
+      if (DebugAlwaysTrue((CheckBox != NULL) && (CheckBox->Tag != 0)))
       {
         CheckBox->Checked = FLAGSET(Components, CheckBox->Tag);
       }
@@ -294,7 +294,7 @@ void __fastcall TGenerateUrlDialog::Execute()
     }
     else
     {
-      FAIL;
+      DebugFail;
     }
     WinConfiguration->GenerateUrlCodeTarget = Target;
   }
@@ -306,7 +306,7 @@ void __fastcall TGenerateUrlDialog::Execute()
     {
       TCheckBox * CheckBox = dynamic_cast<TCheckBox *>(OptionsGroup->Controls[Index]);
 
-      if (ALWAYS_TRUE((CheckBox != NULL) && (CheckBox->Tag != 0)) &&
+      if (DebugAlwaysTrue((CheckBox != NULL) && (CheckBox->Tag != 0)) &&
           CheckBox->Checked)
       {
         Components |= CheckBox->Tag;

+ 6 - 6
source/forms/Glyphs.cpp

@@ -47,12 +47,12 @@ __fastcall TGlyphsModule::TGlyphsModule(TComponent* Owner)
     CopyDataModule(this, ScaledModule);
 
     // Not all these are accessed by field name, but we copy all for consistency
-    ExplorerImages = NOT_NULL(dynamic_cast<TPngImageList *>(FindComponent(ExplorerImages->Name)));
-    SessionImages = NOT_NULL(dynamic_cast<TPngImageList *>(FindComponent(SessionImages->Name)));
-    QueueImages = NOT_NULL(dynamic_cast<TPngImageList *>(FindComponent(QueueImages->Name)));
-    LogImages = NOT_NULL(dynamic_cast<TPngImageList *>(FindComponent(LogImages->Name)));
-    ButtonImages = NOT_NULL(dynamic_cast<TImageList *>(FindComponent(ButtonImages->Name)));
-    DialogImages = NOT_NULL(dynamic_cast<TPngImageList *>(FindComponent(DialogImages->Name)));
+    ExplorerImages = DebugNotNull(dynamic_cast<TPngImageList *>(FindComponent(ExplorerImages->Name)));
+    SessionImages = DebugNotNull(dynamic_cast<TPngImageList *>(FindComponent(SessionImages->Name)));
+    QueueImages = DebugNotNull(dynamic_cast<TPngImageList *>(FindComponent(QueueImages->Name)));
+    LogImages = DebugNotNull(dynamic_cast<TPngImageList *>(FindComponent(LogImages->Name)));
+    ButtonImages = DebugNotNull(dynamic_cast<TImageList *>(FindComponent(ButtonImages->Name)));
+    DialogImages = DebugNotNull(dynamic_cast<TPngImageList *>(FindComponent(DialogImages->Name)));
   }
 }
 //---------------------------------------------------------------------------

+ 1 - 1
source/forms/InputDlg.cpp

@@ -110,7 +110,7 @@ bool __fastcall InputDialog(const UnicodeString ACaption,
     }
     else
     {
-      assert(Echo);
+      DebugAssert(Echo);
       HistoryCombo = new THistoryComboBox(Form);
       HistoryCombo->Parent = Form;
       HistoryCombo->Text = Value;

+ 2 - 2
source/forms/LocationProfiles.cpp

@@ -449,7 +449,7 @@ typename T * GetProfilesObject(TObject * Sender, T * SessionObject, T * SharedOb
   {
     case 1: return SessionObject;
     case 2: return SharedObject;
-    default: FAIL; return NULL;
+    default: DebugFail; return NULL;
   }
 }
 //---------------------------------------------------------------------------
@@ -775,7 +775,7 @@ void __fastcall TLocationProfilesDialog::ProfilesViewDblClick(TObject * Sender)
 //---------------------------------------------------------------------------
 void __fastcall TLocationProfilesDialog::FormShow(TObject * /*Sender*/)
 {
-  if (ALWAYS_TRUE(Terminal != NULL))
+  if (DebugAlwaysTrue(Terminal != NULL))
   {
     // cache session key, in case terminal is closed while the window is open
     FSessionKey = Terminal->SessionData->SessionKey;

+ 30 - 30
source/forms/Login.cpp

@@ -203,9 +203,9 @@ void __fastcall TLoginDialog::Init()
   ReadOnlyControl(ContentsNameEdit);
   ReadOnlyControl(ContentsMemo);
 
-  if (ALWAYS_FALSE(SessionTree->Items->Count == 0) ||
+  if (DebugAlwaysFalse(SessionTree->Items->Count == 0) ||
       ((SessionTree->Items->Count == 1) &&
-       ALWAYS_TRUE(IsNewSiteNode(SessionTree->Items->GetFirstNode()))) ||
+       DebugAlwaysTrue(IsNewSiteNode(SessionTree->Items->GetFirstNode()))) ||
       FForceNewSite)
   {
     ActiveControl = HostNameEdit;
@@ -311,7 +311,7 @@ bool __fastcall TLoginDialog::IsSessionNode(TTreeNode * Node)
 //---------------------------------------------------------------------
 TSessionData * __fastcall TLoginDialog::GetNodeSession(TTreeNode * Node)
 {
-  return NOT_NULL(static_cast<TSessionData *>(Node->Data));
+  return DebugNotNull(static_cast<TSessionData *>(Node->Data));
 }
 //---------------------------------------------------------------------
 TTreeNode * __fastcall TLoginDialog::AddSession(TSessionData * Data)
@@ -411,7 +411,7 @@ void __fastcall TLoginDialog::UpdateFolderNode(TTreeNode * Node)
 void __fastcall TLoginDialog::NewSite()
 {
   TTreeNode * NewSiteNode = GetNewSiteNode();
-  if (ALWAYS_TRUE(IsNewSiteNode(NewSiteNode)))
+  if (DebugAlwaysTrue(IsNewSiteNode(NewSiteNode)))
   {
     SessionTree->Selected = NewSiteNode;
   }
@@ -421,7 +421,7 @@ void __fastcall TLoginDialog::NewSite()
 //---------------------------------------------------------------------------
 void __fastcall TLoginDialog::ResetNewSiteData()
 {
-  if (ALWAYS_TRUE(StoredSessions != NULL))
+  if (DebugAlwaysTrue(StoredSessions != NULL))
   {
     FNewSiteData->CopyData(StoredSessions->DefaultSettings);
   }
@@ -443,7 +443,7 @@ void __fastcall TLoginDialog::LoadContents()
     LoadSession(SelectedSession);
     UseContentsPanel = false;
   }
-  else if (ALWAYS_TRUE(IsFolderOrWorkspaceNode(Node)))
+  else if (DebugAlwaysTrue(IsFolderOrWorkspaceNode(Node)))
   {
     UnicodeString NodePath = SessionNodePath(Node);
     ContentsNameEdit->Text = NodePath;
@@ -455,7 +455,7 @@ void __fastcall TLoginDialog::LoadContents()
     {
       ContentsGroupBox->Caption = LoadStr(LOGIN_SITE_FOLDER_CAPTION);
     }
-    else if (ALWAYS_TRUE(IsWorkspaceNode(Node)))
+    else if (DebugAlwaysTrue(IsWorkspaceNode(Node)))
     {
       ContentsGroupBox->Caption = LoadStr(LOGIN_WORKSPACE_CAPTION);
     }
@@ -490,7 +490,7 @@ void __fastcall TLoginDialog::LoadSession(TSessionData * SessionData)
     FtpsCombo->ItemIndex = FtpsIndex;
     WebDavsCombo->ItemIndex = FtpsIndex;
     EncryptionView->Text =
-      ALWAYS_TRUE(FtpsCombo->ItemIndex >= WebDavsCombo->ItemIndex) ? FtpsCombo->Text : WebDavsCombo->Text;
+      DebugAlwaysTrue(FtpsCombo->ItemIndex >= WebDavsCombo->ItemIndex) ? FtpsCombo->Text : WebDavsCombo->Text;
 
     bool AllowScpFallback;
     TransferProtocolCombo->ItemIndex = FSProtocolToIndex(SessionData->FSProtocol, AllowScpFallback);
@@ -532,7 +532,7 @@ void __fastcall TLoginDialog::LoadSession(TSessionData * SessionData)
 void __fastcall TLoginDialog::SaveSession(TSessionData * SessionData)
 {
   // advanced
-  if (ALWAYS_TRUE(FSessionData != NULL))
+  if (DebugAlwaysTrue(FSessionData != NULL))
   {
     SessionData->Assign(FSessionData);
   }
@@ -644,7 +644,7 @@ void __fastcall TLoginDialog::UpdateControls()
 //---------------------------------------------------------------------------
 void __fastcall TLoginDialog::UpdateButtonVisibility(TButton * Button)
 {
-  TAction * Action = NOT_NULL(dynamic_cast<TAction *>(Button->Action));
+  TAction * Action = DebugNotNull(dynamic_cast<TAction *>(Button->Action));
   // when all action targets are hidden, action does not get updated,
   // so we need to do it manually
   Action->Update();
@@ -833,7 +833,7 @@ void __fastcall TLoginDialog::EditSession()
 //---------------------------------------------------------------------------
 void __fastcall TLoginDialog::EditSessionActionExecute(TObject * /*Sender*/)
 {
-  if (ALWAYS_TRUE(SelectedSession != NULL))
+  if (DebugAlwaysTrue(SelectedSession != NULL))
   {
     FEditing = true;
     EditSession();
@@ -858,7 +858,7 @@ TTreeNode * __fastcall TLoginDialog::FindSessionNode(TSessionData * SessionData,
 //---------------------------------------------------------------------------
 TSessionData * __fastcall TLoginDialog::GetEditingSessionData()
 {
-  return FEditing ? NOT_NULL(SelectedSession) : NULL;
+  return FEditing ? DebugNotNull(SelectedSession) : NULL;
 }
 //---------------------------------------------------------------------------
 void __fastcall TLoginDialog::SaveAsSession(bool ForceDialog)
@@ -1052,7 +1052,7 @@ void __fastcall TLoginDialog::ImportSessionsActionExecute(TObject * /*Sender*/)
   if (DoImportSessionsDialog(Imported.get()))
   {
     UnicodeString SelectSite;
-    if (ALWAYS_TRUE(Imported->Count > 0))
+    if (DebugAlwaysTrue(Imported->Count > 0))
     {
       // Focus the first imported session.
       // We should also consider expanding all newly created folders
@@ -1088,7 +1088,7 @@ void __fastcall TLoginDialog::ActionListUpdate(TBasicAction * BasicAction,
   bool SiteSelected = IsSiteNode(SessionTree->Selected);
   bool FolderOrWorkspaceSelected = IsFolderOrWorkspaceNode(SessionTree->Selected);
 
-  TAction * Action = NOT_NULL(dynamic_cast<TAction *>(BasicAction));
+  TAction * Action = DebugNotNull(dynamic_cast<TAction *>(BasicAction));
   bool PrevEnabled = Action->Enabled;
   bool Editable = IsEditable();
 
@@ -1310,7 +1310,7 @@ TSessionData * __fastcall TLoginDialog::CloneSelectedSession()
   {
     Data2->Assign(GetNodeSession(Node));
   }
-  else if (ALWAYS_TRUE(IsNewSiteNode(Node)))
+  else if (DebugAlwaysTrue(IsNewSiteNode(Node)))
   {
     TSessionData * Data = GetSessionData();
     Data2->Assign(Data);
@@ -1375,7 +1375,7 @@ void __fastcall TLoginDialog::LoadState()
 {
   // it does not make any sense to call this before
   // DoFormWindowProc(CM_SHOWINGCHANGED), we would end up on wrong monitor
-  if (ALWAYS_TRUE(Visible))
+  if (DebugAlwaysTrue(Visible))
   {
     RestoreFormSize(CustomWinConfiguration->LoginDialog.WindowSize, this);
   }
@@ -1414,7 +1414,7 @@ void __fastcall TLoginDialog::LoadState()
   // as site folders, e.g. for the very last root-level site, at long as
   // there are any folders)
   if (!FForceNewSite &&
-      !WinConfiguration->LastStoredSession.IsEmpty() && ALWAYS_TRUE(Visible))
+      !WinConfiguration->LastStoredSession.IsEmpty() && DebugAlwaysTrue(Visible))
   {
     UnicodeString Path = WinConfiguration->LastStoredSession;
 
@@ -1616,7 +1616,7 @@ void __fastcall TLoginDialog::DesktopIconActionExecute(TObject * /*Sender*/)
   }
   else
   {
-    FAIL;
+    DebugFail;
   }
 
   Message = MainInstructions(Message);
@@ -1723,7 +1723,7 @@ void __fastcall TLoginDialog::SessionTreeEditing(TObject * /*Sender*/,
   DebugAssert(!FRenaming);
   AllowEdit =
     IsFolderOrWorkspaceNode(Node) ||
-    (ALWAYS_TRUE(IsSiteNode(Node)) && !GetNodeSession(Node)->Special);
+    (DebugAlwaysTrue(IsSiteNode(Node)) && !GetNodeSession(Node)->Special);
   FRenaming = AllowEdit;
   UpdateControls();
 }
@@ -1919,7 +1919,7 @@ int __fastcall TLoginDialog::FtpsToIndex(TFtps Ftps)
   switch (Ftps)
   {
     default:
-      FAIL;
+      DebugFail;
     case ftpsNone:
       return 0;
 
@@ -1939,7 +1939,7 @@ TFtps __fastcall TLoginDialog::GetFtps()
   switch (Index)
   {
     default:
-      FAIL;
+      DebugFail;
     case 0:
       Ftps = ftpsNone;
       break;
@@ -1958,7 +1958,7 @@ TFtps __fastcall TLoginDialog::GetFtps()
 TFSProtocol __fastcall TLoginDialog::GetFSProtocol(bool RequireScpFallbackDistinction)
 {
   bool AllowScpFallback = false;
-  if (RequireScpFallbackDistinction && ALWAYS_TRUE(FSessionData != NULL))
+  if (RequireScpFallbackDistinction && DebugAlwaysTrue(FSessionData != NULL))
   {
     FSProtocolToIndex(FSessionData->FSProtocol, AllowScpFallback);
   }
@@ -2205,7 +2205,7 @@ void __fastcall TLoginDialog::SessionTreeDragDrop(TObject * Sender,
   TObject * Source, int /*X*/, int /*Y*/)
 {
   TTreeNode * DropTarget = SessionTree->DropTarget;
-  if (ALWAYS_TRUE((Sender == Source) && SessionAllowDrop(DropTarget)) &&
+  if (DebugAlwaysTrue((Sender == Source) && SessionAllowDrop(DropTarget)) &&
       // calling EnsureNotEditing only on drop, not on drag start,
       // to avoid getting popup during unintended micro-dragging
       EnsureNotEditing())
@@ -2224,7 +2224,7 @@ void __fastcall TLoginDialog::SessionTreeDragDrop(TObject * Sender,
     // modified only, explicit
     StoredSessions->Save(false, true);
     // this should aways be the case
-    if (ALWAYS_TRUE(Session != NewSession))
+    if (DebugAlwaysTrue(Session != NewSession))
     {
       TTreeNode * Node = SessionTree->Selected;
 
@@ -2725,7 +2725,7 @@ void __fastcall TLoginDialog::SessionAdvancedActionExecute(TObject * /*Sender*/)
   // while cloning the session data in LoadSession.
   // To implement this, we may delegate the cloning to TWinConfiguration and
   // make use of FDontDecryptPasswords
-  if (ALWAYS_TRUE(FSessionData != NULL))
+  if (DebugAlwaysTrue(FSessionData != NULL))
   {
     // parse hostname (it may change protocol particularly) before opening advanced settings
     // (HostNameEditExit is not triggered when child dialog pops up when it is invoked by accelerator)
@@ -2739,7 +2739,7 @@ void __fastcall TLoginDialog::SessionAdvancedActionExecute(TObject * /*Sender*/)
     // can change is protocol (between fsSFTP and fsSFTPonly),
     // difference of the two not being visible on Login dialog anyway.
     LoadSession(FSessionData);
-    if (ALWAYS_TRUE(SessionTree->Selected != NULL) &&
+    if (DebugAlwaysTrue(SessionTree->Selected != NULL) &&
         IsSiteNode(SessionTree->Selected))
     {
       SetNodeImage(SessionTree->Selected, GetSessionImageIndex(FSessionData));
@@ -2769,7 +2769,7 @@ TPopupMenu * __fastcall TLoginDialog::GetSelectedNodePopupMenu()
     PopupMenu = ManageWorkspacePopupMenu;
   }
 
-  return NOT_NULL(PopupMenu);
+  return DebugNotNull(PopupMenu);
 }
 //---------------------------------------------------------------------------
 void __fastcall TLoginDialog::ManageButtonClick(TObject * /*Sender*/)
@@ -2804,7 +2804,7 @@ void __fastcall TLoginDialog::SessionTreeContextPopup(TObject * /*Sender*/,
     if (SessionTree->Selected != NULL)
     {
       SessionTree->PopupMenu = GetSelectedNodePopupMenu();
-      if (NOT_NULL(SessionTree->PopupMenu))
+      if (DebugNotNull(SessionTree->PopupMenu))
       {
         MenuPopup(SessionTree, MousePos, Handled);
       }
@@ -2919,7 +2919,7 @@ void __fastcall TLoginDialog::PasteUrlActionExecute(TObject * /*Sender*/)
     }
 
     // sanity check
-    if (ALWAYS_TRUE(IsEditable()))
+    if (DebugAlwaysTrue(IsEditable()))
     {
       ParseUrl(ClipboardUrl);
     }
@@ -2947,7 +2947,7 @@ void __fastcall TLoginDialog::HostNameEditExit(TObject * /*Sender*/)
 //---------------------------------------------------------------------------
 void __fastcall TLoginDialog::GenerateUrlAction2Execute(TObject * /*Sender*/)
 {
-  if (ALWAYS_TRUE(SelectedSession != NULL))
+  if (DebugAlwaysTrue(SelectedSession != NULL))
   {
     PersistNewSiteIfNeeded();
 

+ 19 - 19
source/forms/MessageDlg.cpp

@@ -403,7 +403,7 @@ void __fastcall TMessageForm::CMShowingChanged(TMessage & Message)
     DoShow();
 
     // - also we skip applying TForm::Position (VCLCOPY)
-    if (ALWAYS_TRUE(Position == poOwnerFormCenter))
+    if (DebugAlwaysTrue(Position == poOwnerFormCenter))
     {
       TCustomForm * CenterForm = Application->MainForm;
       TCustomForm * OwnerForm = dynamic_cast<TCustomForm *>(Owner);
@@ -500,7 +500,7 @@ void __fastcall TMessageForm::DoShow()
 //---------------------------------------------------------------------------
 void __fastcall TMessageForm::MenuItemClick(TObject * Sender)
 {
-  TMenuItem * Item = NOT_NULL(dynamic_cast<TMenuItem *>(Sender));
+  TMenuItem * Item = DebugNotNull(dynamic_cast<TMenuItem *>(Sender));
   ModalResult = (Item->Tag & 0xFFFF);
 }
 //---------------------------------------------------------------------------
@@ -585,7 +585,7 @@ TButton * __fastcall TMessageForm::CreateButton(
 
   if (SupportsSplitButton() &&
       (GroupWith >= 0) &&
-      ALWAYS_TRUE(AnswerButtons.find(GroupWith) != AnswerButtons.end()))
+      DebugAlwaysTrue(AnswerButtons.find(GroupWith) != AnswerButtons.end()))
   {
     TButton * GroupWithButton = AnswerButtons[GroupWith];
 
@@ -700,10 +700,10 @@ TButton * __fastcall TMessageForm::CreateButton(
 //---------------------------------------------------------------------------
 void __fastcall TMessageForm::InsertPanel(TPanel * Panel)
 {
-  if (ALWAYS_TRUE(MessageBrowser != NULL))
+  if (DebugAlwaysTrue(MessageBrowser != NULL))
   {
     // we currently use this for updates message box only
-    TControl * ContentsControl = static_cast<TControl *>(NOT_NULL(MessageBrowser))->Parent;
+    TControl * ContentsControl = static_cast<TControl *>(DebugNotNull(MessageBrowser))->Parent;
 
     Panel->Width = ContentsControl->Width;
     Panel->Left = ContentsControl->Left;
@@ -721,7 +721,7 @@ void __fastcall TMessageForm::InsertPanel(TPanel * Panel)
 //---------------------------------------------------------------------------
 void __fastcall TMessageForm::NavigateToUrl(const UnicodeString & Url)
 {
-  if (ALWAYS_TRUE(MessageBrowser != NULL))
+  if (DebugAlwaysTrue(MessageBrowser != NULL))
   {
     NavigateBrowserToUrl(MessageBrowser, Url);
   }
@@ -802,7 +802,7 @@ void __fastcall AnswerNameAndCaption(
       break;
 
     default:
-      FAIL;
+      DebugFail;
       throw Exception(L"Undefined answer");
   }
 }
@@ -941,10 +941,10 @@ TForm * __fastcall TMessageForm::Create(const UnicodeString & Msg,
       // value that the answer to be grouped with
       if (GroupWith >= 0)
       {
-        if (ALWAYS_FALSE(GroupWith >= static_cast<int>(Answer)) ||
-            ALWAYS_FALSE(Answer == TimeoutAnswer) &&
-            ALWAYS_FALSE(Answer == DefaultAnswer) &&
-            ALWAYS_FALSE(Answer == CancelAnswer))
+        if (DebugAlwaysFalse(GroupWith >= static_cast<int>(Answer)) ||
+            DebugAlwaysFalse(Answer == TimeoutAnswer) &&
+            DebugAlwaysFalse(Answer == DefaultAnswer) &&
+            DebugAlwaysFalse(Answer == CancelAnswer))
         {
           GroupWith = -1;
         }
@@ -1024,12 +1024,12 @@ TForm * __fastcall TMessageForm::Create(const UnicodeString & Msg,
 
   UnicodeString ImageName = AImageName;
   if (ImageName.IsEmpty() &&
-      ALWAYS_TRUE(ImageNames[DlgType] != NULL))
+      DebugAlwaysTrue(ImageNames[DlgType] != NULL))
   {
     ImageName = ImageNames[DlgType];
   }
 
-  if (ALWAYS_TRUE(!ImageName.IsEmpty()))
+  if (DebugAlwaysTrue(!ImageName.IsEmpty()))
   {
     TImage * Image = new TImage(Panel);
     Image->Name = L"Image";
@@ -1103,7 +1103,7 @@ TForm * __fastcall TMessageForm::Create(const UnicodeString & Msg,
         break;
 
       default:
-        FAIL;
+        DebugFail;
         break;
     }
 
@@ -1121,7 +1121,7 @@ TForm * __fastcall TMessageForm::Create(const UnicodeString & Msg,
       if (LabelFont != 0)
       {
         Message->Font->Handle = LabelFont;
-        if (ALWAYS_TRUE(LabelFont == MainInstructionFont))
+        if (DebugAlwaysTrue(LabelFont == MainInstructionFont))
         {
           Configuration->Usage->Set(L"ThemeMainInstructionFontSize", Message->Font->Size);
         }
@@ -1183,7 +1183,7 @@ TForm * __fastcall TMessageForm::Create(const UnicodeString & Msg,
 
       Result->MessageMemo = MessageMemo;
     }
-    else if (ALWAYS_TRUE(!MoreMessagesUrl.IsEmpty()))
+    else if (DebugAlwaysTrue(!MoreMessagesUrl.IsEmpty()))
     {
       TPanel * MessageBrowserPanel = CreateBlankPanel(Panel);
       MessageBrowserPanel->Parent = Panel;
@@ -1217,7 +1217,7 @@ TForm * __fastcall TMessageForm::Create(const UnicodeString & Msg,
   {
     Result->Caption = CustomCaption;
   }
-  else if (ALWAYS_TRUE(DlgType != mtCustom))
+  else if (DebugAlwaysTrue(DlgType != mtCustom))
   {
     Result->Caption = LoadResourceString(Captions[DlgType]);
   }
@@ -1279,12 +1279,12 @@ TForm * __fastcall CreateMoreMessageDialog(const UnicodeString & Msg,
 //---------------------------------------------------------------------------
 void __fastcall InsertPanelToMessageDialog(TCustomForm * Form, TPanel * Panel)
 {
-  TMessageForm * MessageForm = NOT_NULL(dynamic_cast<TMessageForm *>(Form));
+  TMessageForm * MessageForm = DebugNotNull(dynamic_cast<TMessageForm *>(Form));
   MessageForm->InsertPanel(Panel);
 }
 //---------------------------------------------------------------------------
 void __fastcall NavigateMessageDialogToUrl(TCustomForm * Form, const UnicodeString & Url)
 {
-  TMessageForm * MessageForm = NOT_NULL(dynamic_cast<TMessageForm *>(Form));
+  TMessageForm * MessageForm = DebugNotNull(dynamic_cast<TMessageForm *>(Form));
   MessageForm->NavigateToUrl(Url);
 }

+ 9 - 9
source/forms/NonVisual.cpp

@@ -1131,7 +1131,7 @@ void __fastcall TNonVisualDataModule::CreateCustomCommandsMenu(
 void __fastcall TNonVisualDataModule::CreateCustomCommandsMenu(TAction * Action)
 {
   TTBCustomItem * Menu = dynamic_cast<TTBCustomItem *>(Action->ActionComponent);
-  if (ALWAYS_TRUE(Menu != NULL))
+  if (DebugAlwaysTrue(Menu != NULL))
   {
     bool OnFocused = (Menu == RemoteDirViewCustomCommandsMenu);
     CreateCustomCommandsMenu(Action, OnFocused, false);
@@ -1212,7 +1212,7 @@ void __fastcall TNonVisualDataModule::CustomCommandClick(TObject * Sender)
 //---------------------------------------------------------------------------
 void __fastcall TNonVisualDataModule::CreateSessionColorMenu(TAction * Action)
 {
-  if (ALWAYS_TRUE(Action->ActionComponent != NULL))
+  if (DebugAlwaysTrue(Action->ActionComponent != NULL))
   {
     ::CreateSessionColorMenu(Action->ActionComponent, ScpExplorer->SessionColor,
       SessionColorChange);
@@ -1266,7 +1266,7 @@ void __fastcall TNonVisualDataModule::CreateSessionListMenuLevel(
     Item->Caption = LoadStr(SAVEDSESSIONFOLDER_THIS_OPEN);
     Item->Tag = MAKELONG(Index, Level);
     UnicodeString FolderName = Root;
-    if (ALWAYS_TRUE(!FolderName.IsEmpty() && FolderName[FolderName.Length()] == L'/'))
+    if (DebugAlwaysTrue(!FolderName.IsEmpty() && FolderName[FolderName.Length()] == L'/'))
     {
       FolderName.Delete(FolderName.Length(), 1);
     }
@@ -1337,7 +1337,7 @@ void __fastcall TNonVisualDataModule::SessionFolderItemClick(TObject * Sender)
 //---------------------------------------------------------------------------
 void __fastcall TNonVisualDataModule::SessionFolderThisItemClick(TObject * Sender)
 {
-  TTBCustomItem * Item = NOT_NULL(dynamic_cast<TTBCustomItem *>(Sender));
+  TTBCustomItem * Item = DebugNotNull(dynamic_cast<TTBCustomItem *>(Sender));
   int Index = LOWORD(Item->Tag);
   int Level = HIWORD(Item->Tag);
   UnicodeString Folder = GetSessionFolderRoot(StoredSessions->Sessions[Index], Level);
@@ -1360,7 +1360,7 @@ void __fastcall TNonVisualDataModule::CreateWorkspacesMenu(TAction * Action)
   else
   {
     TTBCustomItem * Menu =
-      NOT_NULL(dynamic_cast<TTBCustomItem *>(Action->ActionComponent));
+      DebugNotNull(dynamic_cast<TTBCustomItem *>(Action->ActionComponent));
 
     Menu->Clear();
 
@@ -1381,7 +1381,7 @@ void __fastcall TNonVisualDataModule::WorkspaceItemClick(TObject * Sender)
 {
   std::unique_ptr<TStrings> Workspaces(StoredSessions->GetWorkspaces());
   ScpExplorer->OpenFolderOrWorkspace(
-    Workspaces->Strings[NOT_NULL(dynamic_cast<TTBCustomItem *>(Sender))->Tag]);
+    Workspaces->Strings[DebugNotNull(dynamic_cast<TTBCustomItem *>(Sender))->Tag]);
 }
 //---------------------------------------------------------------------------
 TShortCut __fastcall TNonVisualDataModule::OpenSessionShortCut(int Index)
@@ -1692,7 +1692,7 @@ void __fastcall TNonVisualDataModule::CycleQueueOnceEmptyAction()
   }
   else
   {
-    FAIL;
+    DebugFail;
   }
 }
 //---------------------------------------------------------------------------
@@ -1717,7 +1717,7 @@ TAction * __fastcall TNonVisualDataModule::CurrentQueueOnceEmptyAction()
   }
   else
   {
-    FAIL;
+    DebugFail;
   }
   return Result;
 }
@@ -1744,7 +1744,7 @@ TOnceDoneOperation __fastcall TNonVisualDataModule::CurrentQueueOnceEmptyOperati
   }
   else
   {
-    FAIL;
+    DebugFail;
   }
   return Result;
 }

+ 1 - 1
source/forms/OpenDirectory.cpp

@@ -290,7 +290,7 @@ typename T * GetBookmarkObject(TObject * Sender, T * SessionObject, T * SharedOb
   {
     case 1: return SessionObject;
     case 2: return SharedObject;
-    default: FAIL; return NULL;
+    default: DebugFail; return NULL;
   }
 }
 //---------------------------------------------------------------------------

+ 11 - 11
source/forms/Preferences.cpp

@@ -169,7 +169,7 @@ TTabSheet * __fastcall TPreferencesDialog::FindPageForTreeNode(TTreeNode * Node)
       return Sheet;
     }
   }
-  FAIL;
+  DebugFail;
   return NULL;
 }
 //---------------------------------------------------------------------------
@@ -181,7 +181,7 @@ void __fastcall TPreferencesDialog::PrepareNavigationTree(TTreeView * Tree)
   {
     TTreeNode * Node = Tree->Items->Item[i];
     TTabSheet * Sheet = FindPageForTreeNode(Node);
-    if (NOT_NULL(Sheet))
+    if (DebugNotNull(Sheet))
     {
       if (Sheet->Enabled)
       {
@@ -446,7 +446,7 @@ void __fastcall TPreferencesDialog::LoadConfiguration()
         FormatSizeBytesCombo->ItemIndex = 2;
         break;
       default:
-        FAIL;
+        DebugFail;
     }
 
     bool CustomPanelFont = !WinConfiguration->PanelFont.FontName.IsEmpty();
@@ -524,7 +524,7 @@ void __fastcall TPreferencesDialog::LoadConfiguration()
         break;
 
       default:
-        FAIL;
+        DebugFail;
         break;
     }
 
@@ -810,7 +810,7 @@ void __fastcall TPreferencesDialog::SaveConfiguration()
         WinConfiguration->FormatSizeBytes = fbShort;
         break;
       default:
-        FAIL;
+        DebugFail;
     }
 
     TFontConfiguration PanelFontConfiguration;
@@ -1170,7 +1170,7 @@ void __fastcall TPreferencesDialog::UpdateControls()
 
     // languages
     LanguageChangeLabel->Visible =
-      ALWAYS_TRUE(!GUIConfiguration->CanApplyLocaleImmediately) &&
+      DebugAlwaysTrue(!GUIConfiguration->CanApplyLocaleImmediately) &&
       (LanguagesView->ItemFocused != NULL) &&
       (reinterpret_cast<LCID>(LanguagesView->ItemFocused->Data) != GUIConfiguration->AppliedLocale);
 
@@ -1479,7 +1479,7 @@ TListViewScrollOnDragOver * __fastcall TPreferencesDialog::ScrollOnDragOver(TObj
   }
   else
   {
-    FAIL;
+    DebugFail;
     return NULL;
   }
 }
@@ -1795,9 +1795,9 @@ void __fastcall TPreferencesDialog::EditorListView3Data(TObject * /*Sender*/,
 void __fastcall TPreferencesDialog::NavigationTreeChange(TObject * /*Sender*/,
   TTreeNode * Node)
 {
-  if (ALWAYS_TRUE(Node->SelectedIndex > 0))
+  if (DebugAlwaysTrue(Node->SelectedIndex > 0))
   {
-    PageControl->ActivePage = NOT_NULL(FindPageForTreeNode(Node));
+    PageControl->ActivePage = DebugNotNull(FindPageForTreeNode(Node));
     // reshow the accelerators, etc
     ResetSystemSettings(this);
     // This is particularly here to enable EditCopyParamButton,
@@ -1811,7 +1811,7 @@ void __fastcall TPreferencesDialog::PageControlChange(TObject * /*Sender*/)
 {
   // this is probably only ever called from FormShow (explicitly)
   bool Found = false;
-  if (ALWAYS_TRUE(PageControl->ActivePage->Tag > 0))
+  if (DebugAlwaysTrue(PageControl->ActivePage->Tag > 0))
   {
     for (int Index = 0; Index < NavigationTree->Items->Count; Index++)
     {
@@ -1824,7 +1824,7 @@ void __fastcall TPreferencesDialog::PageControlChange(TObject * /*Sender*/)
     }
   }
 
-  if (ALWAYS_TRUE(Found))
+  if (DebugAlwaysTrue(Found))
   {
     UpdateControls();
   }

+ 3 - 3
source/forms/Progress.cpp

@@ -250,7 +250,7 @@ void __fastcall TProgressForm::UpdateControls()
     FLastTotalSizeSet = FData.TotalSizeSet;
   }
 
-  if ((FData.Operation == foCalculateSize) && ALWAYS_TRUE(!FData.Temp))
+  if ((FData.Operation == foCalculateSize) && DebugAlwaysTrue(!FData.Temp))
   {
     if (FData.Side == osRemote)
     {
@@ -333,7 +333,7 @@ bool __fastcall TProgressForm::ReceiveData(bool Force, int ModalLevelOffset)
         // because application was minimized when operation started
         Result = true;
       }
-      else if (!FModalBeginHooked && ALWAYS_TRUE(FModalLevel < 0))
+      else if (!FModalBeginHooked && DebugAlwaysTrue(FModalLevel < 0))
       {
         // record state as of time, the window should be shown,
         // had not we implemented delayed show
@@ -525,7 +525,7 @@ TTBCustomItem * __fastcall TProgressForm::CurrentOnceDoneItem()
     Iterator++;
   }
 
-  FAIL;
+  DebugFail;
   return NULL;
 }
 //---------------------------------------------------------------------------

+ 1 - 1
source/forms/Properties.cpp

@@ -99,7 +99,7 @@ bool __fastcall TPropertiesDialog::Execute(TRemoteProperties & Properties)
   if (FAllowedChanges & cpMode) ActiveControl = RightsFrame;
     else ActiveControl = CancelButton;
 
-  if (ALWAYS_TRUE(FChecksumAlgs != NULL))
+  if (DebugAlwaysTrue(FChecksumAlgs != NULL))
   {
     ChecksumAlgEdit->Items->Assign(FChecksumAlgs);
     int ChecksumIndex = FChecksumAlgs->IndexOf(GUIConfiguration->ChecksumAlg);

+ 1 - 1
source/forms/Rights.cpp

@@ -142,7 +142,7 @@ bool __fastcall TRightsFrame::GetAllowUndef()
       }
       else if (Result != Check->AllowGrayed)
       {
-        FAIL;
+        DebugFail;
       }
     }
   }

+ 1 - 1
source/forms/ScpCommander.cpp

@@ -290,7 +290,7 @@ bool __fastcall TScpCommanderForm::InternalDDDownload(UnicodeString & TargetDire
   }
   else
   {
-    FAIL;
+    DebugFail;
     Abort();
   }
 

+ 1 - 1
source/forms/ScpExplorer.cpp

@@ -347,7 +347,7 @@ void __fastcall TScpExplorerForm::QueueSubmenuItemPopup(
 //---------------------------------------------------------------------------
 void __fastcall TScpExplorerForm::ChangePath(TOperationSide /*Side*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 bool __fastcall TScpExplorerForm::UpdateToolbarDisplayMode()

+ 1 - 1
source/forms/SelectMask.cpp

@@ -28,7 +28,7 @@ bool __fastcall DoSelectMaskDialog(TCustomDirView * Parent, bool Select,
     CenterFormOn(Dialog, Parent);
     Dialog->Init(Select ? TSelectMaskDialog::smSelect : TSelectMaskDialog::smDeselect);
     DefaultFileFilter(*Filter);
-    TWinConfiguration * WinConfiguration = NOT_NULL(dynamic_cast<TWinConfiguration *>(Configuration));
+    TWinConfiguration * WinConfiguration = DebugNotNull(dynamic_cast<TWinConfiguration *>(Configuration));
     Filter->Masks = WinConfiguration->SelectMask;
     Filter->Directories = WinConfiguration->SelectDirectories;
     Dialog->FileFilter = *Filter;

+ 4 - 4
source/forms/SiteAdvanced.cpp

@@ -1105,7 +1105,7 @@ void __fastcall TSiteAdvancedDialog::PageControlChange(TObject *Sender)
     }
   }
 
-  if (ALWAYS_TRUE(Found))
+  if (DebugAlwaysTrue(Found))
   {
     DataChange(Sender);
   }
@@ -1360,7 +1360,7 @@ TProxyMethod __fastcall TSiteAdvancedDialog::GetProxyMethod()
   }
   else
   {
-    FAIL;
+    DebugFail;
     Result = ::pmNone;
   }
   return Result;
@@ -1439,7 +1439,7 @@ TTlsVersion __fastcall TSiteAdvancedDialog::IndexToTlsVersion(int Index)
   switch (Index)
   {
     default:
-      FAIL;
+      DebugFail;
     case 0:
       return ssl3;
     case 1:
@@ -1456,7 +1456,7 @@ int __fastcall TSiteAdvancedDialog::TlsVersionToIndex(TTlsVersion TlsVersion)
   switch (TlsVersion)
   {
     default:
-      FAIL;
+      DebugFail;
     case ssl2:
     case ssl3:
       return 0;

+ 5 - 5
source/forms/SynchronizeChecklist.cpp

@@ -245,7 +245,7 @@ void __fastcall TSynchronizeChecklistDialog::LoadItem(TListItem * Item)
     }
     else
     {
-      FAIL;
+      DebugFail;
     }
     AddSubItem(Item, Index, S);
     if (Action == TSynchronizeChecklist::saDownloadNew)
@@ -289,7 +289,7 @@ void __fastcall TSynchronizeChecklistDialog::LoadItem(TListItem * Item)
     }
     else
     {
-      FAIL;
+      DebugFail;
     }
     AddSubItem(Item, Index, S);
     if (Action == TSynchronizeChecklist::saUploadNew)
@@ -399,7 +399,7 @@ __int64 __fastcall TSynchronizeChecklistDialog::GetItemSize(const TSynchronizeCh
         return Item->Remote.Size;
 
       default:
-        FAIL;
+        DebugFail;
         return 0;
     }
   }
@@ -530,7 +530,7 @@ void __fastcall TSynchronizeChecklistDialog::StatusBarDrawPanel(
         break;
 
       default:
-        FAIL;
+        DebugFail;
         Possible = false;
         break;
     }
@@ -981,7 +981,7 @@ void __fastcall TSynchronizeChecklistDialog::ReverseActionExecute(TObject * /*Se
     TSynchronizeChecklist::TAction & Action = GetChecklistItemAction(ChecklistItem);
     TSynchronizeChecklist::TAction NewAction = TSynchronizeChecklist::Reverse(Action);
 
-    if (ALWAYS_TRUE(Action != NewAction))
+    if (DebugAlwaysTrue(Action != NewAction))
     {
       int ActionIndex = int(Action);
 

+ 15 - 15
source/windows/ConsoleRunner.cpp

@@ -126,7 +126,7 @@ __fastcall TOwnConsole::TOwnConsole()
   if (WinConfiguration->MinimizeToTray)
   {
     FConsoleWindow = GetConsoleWindow();
-    if (ALWAYS_TRUE(FConsoleWindow != NULL))
+    if (DebugAlwaysTrue(FConsoleWindow != NULL))
     {
       FWindowStateTimer = new TTimer(Application);
       FWindowStateTimer->OnTimer = WindowStateTimer;
@@ -184,7 +184,7 @@ void __fastcall TOwnConsole::WindowStateTimer(TObject * /*Sender*/)
   }
   else
   {
-    FAIL;
+    DebugFail;
   }
 }
 //---------------------------------------------------------------------------
@@ -219,7 +219,7 @@ void __fastcall TOwnConsole::BreakInput()
 
   unsigned long Written;
   // this assertion occasionally fails (when console is being exited)
-  CHECK(WriteConsoleInput(FInput, &InputRecord, 1, &Written));
+  DebugCheck(WriteConsoleInput(FInput, &InputRecord, 1, &Written));
   DebugAssert(Written == 1);
 
   CancelInput();
@@ -279,7 +279,7 @@ void __fastcall TOwnConsole::Print(UnicodeString Str, bool FromBeginning)
   unsigned long Written;
   bool Result = WriteConsole(FOutput, Str.c_str(), Str.Length(), &Written, NULL);
   DebugAssert(Result);
-  USEDPARAM(Result);
+  DebugUsedParam(Result);
   DebugAssert(Str.Length() == static_cast<long>(Written));
   ProcessMessages();
 }
@@ -519,7 +519,7 @@ bool __fastcall TOwnConsole::WantsProgress()
 //---------------------------------------------------------------------------
 void __fastcall TOwnConsole::Progress(const TScriptProgress & /*Progress*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 class TExternalConsole : public TConsole
@@ -577,7 +577,7 @@ __fastcall TExternalConsole::TExternalConsole(
 
   HANDLE Job = OpenJobObject(JOB_OBJECT_ASSIGN_PROCESS, FALSE,
     FORMAT(L"%s%s", (CONSOLE_JOB, Instance)).c_str());
-  if (ALWAYS_TRUE(Job != NULL))
+  if (DebugAlwaysTrue(Job != NULL))
   {
     AssignProcessToJobObject(Job, GetCurrentProcess());
     // winscp.com/winscp.dll keeps the only reference to the job.
@@ -867,7 +867,7 @@ void __fastcall TExternalConsole::Progress(const TScriptProgress & Progress)
         break;
 
       default:
-        FAIL;
+        DebugFail;
     }
 
     switch (Progress.Side)
@@ -881,7 +881,7 @@ void __fastcall TExternalConsole::Progress(const TScriptProgress & Progress)
         break;
 
       default:
-        FAIL;
+        DebugFail;
     }
 
     wcsncpy(ProgressEvent.FileName, Progress.FileName.c_str(), LENOF(ProgressEvent.FileName));
@@ -985,13 +985,13 @@ bool __fastcall TNullConsole::NoInteractiveInput()
 //---------------------------------------------------------------------------
 void __fastcall TNullConsole::WaitBeforeExit()
 {
-  FAIL;
+  DebugFail;
   // noop
 }
 //---------------------------------------------------------------------------
 bool __fastcall TNullConsole::CommandLineOnly()
 {
-  FAIL;
+  DebugFail;
   return false;
 }
 //---------------------------------------------------------------------------
@@ -1002,7 +1002,7 @@ bool __fastcall TNullConsole::WantsProgress()
 //---------------------------------------------------------------------------
 void __fastcall TNullConsole::Progress(const TScriptProgress & /*Progress*/)
 {
-  FAIL;
+  DebugFail;
 }
 //---------------------------------------------------------------------------
 static UnicodeString TimestampVarName(L"TIMESTAMP");
@@ -1342,7 +1342,7 @@ void __fastcall TConsoleRunner::ScriptTerminalQueryUser(TObject * /*Sender*/,
     }
   }
 
-  USEDPARAM(AAnswers);
+  DebugUsedParam(AAnswers);
   DebugAssert(AAnswers == 0);
   DebugAssert(!Buttons.empty());
 
@@ -1485,7 +1485,7 @@ void __fastcall TConsoleRunner::ScriptTerminalQueryUser(TObject * /*Sender*/,
 
           UnicodeString Caption = Captions[i];
           int P = Caption.Pos(L'&');
-          if (ALWAYS_TRUE(P >= 0))
+          if (DebugAlwaysTrue(P >= 0))
           {
             Caption[P] = L'(';
             Caption.Insert(L")", P + 2);
@@ -2172,7 +2172,7 @@ void __fastcall Usage(TConsole * Console)
 void __fastcall BatchSettings(TConsole * Console, TProgramParams * Params)
 {
   std::unique_ptr<TStrings> Arguments(new TStringList());
-  if (ALWAYS_TRUE(Params->FindSwitch(L"batchsettings", Arguments.get())))
+  if (DebugAlwaysTrue(Params->FindSwitch(L"batchsettings", Arguments.get())))
   {
     if (Arguments->Count < 1)
     {
@@ -2291,7 +2291,7 @@ int __fastcall KeyGen(TConsole * Console, TProgramParams * Params)
         throw EOSExtException(FMTLOAD(KEY_TYPE_UNOPENABLE, (InputFileName)), Error);
 
       default:
-        FAIL;
+        DebugFail;
         // fallthru
       case ktUnknown:
         throw Exception(FMTLOAD(KEY_TYPE_UNKNOWN2, (InputFileName)));

+ 2 - 2
source/windows/EditorManager.cpp

@@ -419,7 +419,7 @@ void __fastcall TEditorManager::CloseProcess(int Index)
   TFileData * FileData = &FFiles[Index];
 
   FProcesses.erase(std::find(FProcesses.begin(), FProcesses.end(), FileData->Process));
-  CHECK(CloseHandle(FileData->Process));
+  DebugCheck(CloseHandle(FileData->Process));
   FileData->Process = INVALID_HANDLE_VALUE;
 }
 //---------------------------------------------------------------------------
@@ -442,7 +442,7 @@ bool __fastcall TEditorManager::CloseFile(int Index, bool IgnoreErrors, bool Del
 
   if (FileData->Monitor != INVALID_HANDLE_VALUE)
   {
-    CHECK(FindCloseChangeNotification(FileData->Monitor));
+    DebugCheck(FindCloseChangeNotification(FileData->Monitor));
     FMonitors.erase(std::find(FMonitors.begin(), FMonitors.end(), FileData->Monitor));
     FileData->Monitor = INVALID_HANDLE_VALUE;
   }

+ 2 - 2
source/windows/GUIConfiguration.cpp

@@ -830,7 +830,7 @@ LCID __fastcall TGUIConfiguration::InternalLocale()
   }
   else
   {
-    FAIL;
+    DebugFail;
     Result = 0;
   }
   return Result;
@@ -905,7 +905,7 @@ UnicodeString __fastcall TGUIConfiguration::LocaleCopyright()
   UnicodeString Result;
   if ((FAppliedLocale == 0) || (FAppliedLocale == InternalLocale()))
   {
-    FAIL; // we do not expect to get called with internal locale
+    DebugFail; // we do not expect to get called with internal locale
     Result = UnicodeString();
   }
   else

+ 10 - 10
source/windows/GUITools.cpp

@@ -339,7 +339,7 @@ UnicodeString __fastcall GetDesktopFolder()
 UnicodeString __fastcall UniqTempDir(const UnicodeString BaseDir, const UnicodeString Identity,
   bool Mask)
 {
-  assert(!BaseDir.IsEmpty());
+  DebugAssert(!BaseDir.IsEmpty());
   UnicodeString TempDir;
   do
   {
@@ -492,7 +492,7 @@ bool __fastcall IsEligibleForApplyingTabs(
     }
 
     // We do not have, not support, mutiple tabs on a single line
-    if (ALWAYS_TRUE(Remaining.Pos(L"\t") == 0))
+    if (DebugAlwaysTrue(Remaining.Pos(L"\t") == 0))
     {
       Start = Line.SubString(1, TabPos - 1);
       // WORKAROUND
@@ -637,7 +637,7 @@ void __fastcall CopyDataModule(TDataModule * TargetModule, TDataModule * SourceM
   {
     TComponent * TargetComponent = TargetModule->Components[Index];
     TComponent * SourceComponent = SourceModule->FindComponent(TargetComponent->Name);
-    if (ALWAYS_TRUE(SourceComponent != NULL))
+    if (DebugAlwaysTrue(SourceComponent != NULL))
     {
       ComponentPairs.push_back(std::make_pair(TargetComponent, SourceComponent));
     }
@@ -680,7 +680,7 @@ void __fastcall LoadDialogImage(TImage * Image, const UnicodeString & ImageName)
   }
   // When showing an exception from wWinMain, the glyphs module does not exist anymore.
   // We expect errors only.
-  else if (ALWAYS_TRUE(ImageName == L"Error"))
+  else if (DebugAlwaysTrue(ImageName == L"Error"))
   {
     Image->Picture->Icon->Handle = LoadIcon(0, IDI_HAND);
   }
@@ -693,8 +693,8 @@ int __fastcall DialogImageSize()
 //---------------------------------------------------------------------------
 void __fastcall HideComponentsPanel(TForm * Form)
 {
-  TComponent * Component = NOT_NULL(Form->FindComponent(L"ComponentsPanel"));
-  TPanel * Panel = NOT_NULL(dynamic_cast<TPanel *>(Component));
+  TComponent * Component = DebugNotNull(Form->FindComponent(L"ComponentsPanel"));
+  TPanel * Panel = DebugNotNull(dynamic_cast<TPanel *>(Component));
   DebugAssert(Panel->Align == alBottom);
   int Offset = Panel->Height;
   Panel->Visible = false;
@@ -832,7 +832,7 @@ TWebBrowserEx * __fastcall CreateBrowserViewer(TPanel * Parent, const UnicodeStr
 //---------------------------------------------------------------------------
 void __fastcall SetBrowserDesignModeOff(TWebBrowserEx * WebBrowser)
 {
-  if (ALWAYS_TRUE(WebBrowser->Document2 != NULL))
+  if (DebugAlwaysTrue(WebBrowser->Document2 != NULL))
   {
     WebBrowser->Document2->designMode = L"Off";
   }
@@ -842,7 +842,7 @@ void __fastcall AddBrowserLinkHandler(TWebBrowserEx * WebBrowser,
   const UnicodeString & Url, TNotifyEvent Handler)
 {
   TBrowserViewer * BrowserViewer = dynamic_cast<TBrowserViewer *>(WebBrowser);
-  if (ALWAYS_TRUE(BrowserViewer != NULL))
+  if (DebugAlwaysTrue(BrowserViewer != NULL))
   {
     BrowserViewer->AddLinkHandler(Url, Handler);
   }
@@ -851,7 +851,7 @@ void __fastcall AddBrowserLinkHandler(TWebBrowserEx * WebBrowser,
 void __fastcall NavigateBrowserToUrl(TWebBrowserEx * WebBrowser, const UnicodeString & Url)
 {
   TBrowserViewer * BrowserViewer = dynamic_cast<TBrowserViewer *>(WebBrowser);
-  if (ALWAYS_TRUE(BrowserViewer != NULL))
+  if (DebugAlwaysTrue(BrowserViewer != NULL))
   {
     BrowserViewer->NavigateToUrl(Url);
   }
@@ -1016,7 +1016,7 @@ void __fastcall TFrameAnimation::PaintBoxPaint(TObject * Sender)
   if (FFirstFrame >= 0)
   {
     // Double-buffered drawing to prevent flicker (as the images are transparent)
-    USEDPARAM(Sender);
+    DebugUsedParam(Sender);
     DebugAssert(FPaintBox == Sender);
     DebugAssert(FPaintBox->ControlStyle.Contains(csOpaque));
     std::unique_ptr<TBitmap> Bitmap(new TBitmap());

+ 2 - 2
source/windows/QueueController.cpp

@@ -184,7 +184,7 @@ bool __fastcall TQueueController::AllowOperation(
       return (FQueueStatus != NULL) && (FQueueStatus->Count > 0);
 
     default:
-      FAIL;
+      DebugFail;
       return false;
   }
 }
@@ -285,7 +285,7 @@ void __fastcall TQueueController::ExecuteOperation(TQueueOperation Operation,
       break;
 
     default:
-      FAIL;
+      DebugFail;
       break;
   }
 }

+ 17 - 17
source/windows/Setup.cpp

@@ -1269,7 +1269,7 @@ void __fastcall TUpdateDownloadThread::UpdateDownloaded()
     FileName.SetLength(P - 1);
   }
   P = FileName.LastDelimiter("/");
-  if (ALWAYS_TRUE(P > 0))
+  if (DebugAlwaysTrue(P > 0))
   {
     FileName.Delete(1, P);
   }
@@ -1333,7 +1333,7 @@ void __fastcall TUpdateDownloadThread::UpdateProgress()
 //---------------------------------------------------------------------------
 void __fastcall TUpdateDownloadThread::ShowException()
 {
-  assert(FException.get() != NULL);
+  DebugAssert(FException.get() != NULL);
   ShowExtendedException(FException.get());
 }
 //---------------------------------------------------------------------------
@@ -1376,9 +1376,9 @@ public:
 
   static TUpdateDownloadData * __fastcall Retrieve(TObject * Object)
   {
-    TComponent * Component = NOT_NULL(dynamic_cast<TComponent *>(Object));
+    TComponent * Component = DebugNotNull(dynamic_cast<TComponent *>(Object));
     TComponent * UpdateDownloadDataComponent = Component->FindComponent(QualifiedClassName());
-    return NOT_NULL(dynamic_cast<TUpdateDownloadData *>(UpdateDownloadDataComponent));
+    return DebugNotNull(dynamic_cast<TUpdateDownloadData *>(UpdateDownloadDataComponent));
   }
 };
 //---------------------------------------------------------------------------
@@ -1394,8 +1394,8 @@ static void __fastcall DownloadClose(void * /*Data*/, TObject * Sender, TCloseAc
 static void __fastcall DownloadUpdate(void * /*Data*/, TObject * Sender)
 {
   Configuration->Usage->Inc(L"UpdateDownloadStarts");
-  TButton * Button = NOT_NULL(dynamic_cast<TButton *>(Sender));
-  TForm * Form = NOT_NULL(dynamic_cast<TForm *>(GetParentForm(Button)));
+  TButton * Button = DebugNotNull(dynamic_cast<TButton *>(Sender));
+  TForm * Form = DebugNotNull(dynamic_cast<TForm *>(GetParentForm(Button)));
   TPanel * Panel = CreateBlankPanel(Form);
 
   TProgressBar * ProgressBar = new TProgressBar(Panel);
@@ -1445,7 +1445,7 @@ static void __fastcall UpdatesDonateClick(void * /*Data*/, TObject * /*Sender*/)
 //---------------------------------------------------------------------------
 static void __fastcall InsertDonateLink(void * /*Data*/, TObject * Sender)
 {
-  TForm * Dialog = NOT_NULL(dynamic_cast<TForm *>(Sender));
+  TForm * Dialog = DebugNotNull(dynamic_cast<TForm *>(Sender));
   TPanel * Panel = CreateBlankPanel(Dialog);
 
   TStaticText * StaticText = new TStaticText(Panel);
@@ -1593,7 +1593,7 @@ bool __fastcall CheckForUpdates(bool CachedResults)
         break;
 
       case qaAll:
-        FAIL;
+        DebugFail;
         break;
     }
   }
@@ -1687,7 +1687,7 @@ static bool __fastcall AddJumpListCategory(TStrings * Names,
           {
             try
             {
-              CHECK(SUCCEEDED(Collection->AddObject(Link)));
+              DebugCheck(SUCCEEDED(Collection->AddObject(Link)));
               Count++;
             }
             __finally
@@ -1745,7 +1745,7 @@ void __fastcall UpdateJumpList(TStrings * SessionNames, TStrings * WorkspaceName
       unsigned int * PMinSlots = &MinSlots;
       void ** PRemovedArray = (void**)&RemovedArray;
       HRESULT Result = DestinationList->BeginList(PMinSlots, IID_IObjectArray, PRemovedArray);
-      if (SUCCEEDED(Result) && ALWAYS_TRUE(RemovedArray != NULL))
+      if (SUCCEEDED(Result) && DebugAlwaysTrue(RemovedArray != NULL))
       {
         Removed = new TStringList();
 
@@ -1903,9 +1903,9 @@ public:
 
   static TTipsData * __fastcall Retrieve(TObject * Object)
   {
-    TComponent * Component = NOT_NULL(dynamic_cast<TComponent *>(Object));
+    TComponent * Component = DebugNotNull(dynamic_cast<TComponent *>(Object));
     TComponent * TipsDataComponent = Component->FindComponent(QualifiedClassName());
-    return NOT_NULL(dynamic_cast<TTipsData *>(TipsDataComponent));
+    return DebugNotNull(dynamic_cast<TTipsData *>(TipsDataComponent));
   }
 };
 //---------------------------------------------------------------------------
@@ -1918,13 +1918,13 @@ static void __fastcall UpdateTipsForm(TCustomForm * Form)
 {
   TTipsData * TipsData = TTipsData::Retrieve(Form);
 
-  TButton * PrevButton = NOT_NULL(dynamic_cast<TButton *>(Form->FindComponent(L"Yes")));
+  TButton * PrevButton = DebugNotNull(dynamic_cast<TButton *>(Form->FindComponent(L"Yes")));
   PrevButton->Enabled = (TipsData->Index > 0);
-  TButton * NextButton = NOT_NULL(dynamic_cast<TButton *>(Form->FindComponent(L"No")));
+  TButton * NextButton = DebugNotNull(dynamic_cast<TButton *>(Form->FindComponent(L"No")));
   NextButton->Enabled = (TipsData->Index < TipsData->Tips->Count - 1);
 
-  TPanel * Panel = NOT_NULL(dynamic_cast<TPanel *>(Form->FindComponent(L"Panel")));
-  TLabel * MessageLabel = NOT_NULL(dynamic_cast<TLabel *>(Panel->FindComponent(L"MainMessage")));
+  TPanel * Panel = DebugNotNull(dynamic_cast<TPanel *>(Form->FindComponent(L"Panel")));
+  TLabel * MessageLabel = DebugNotNull(dynamic_cast<TLabel *>(Panel->FindComponent(L"MainMessage")));
   MessageLabel->Caption = TipsMessage(TipsData);
 }
 //---------------------------------------------------------------------------
@@ -2014,7 +2014,7 @@ static void __fastcall ShowTip(bool AutoShow)
   TipSeen(Tip);
   unsigned int Result = ExecuteMessageDialog(Dialog.get(), Answers, &Params);
 
-  if ((Result == qaNeverAskAgain) && ALWAYS_TRUE(AutoShow))
+  if ((Result == qaNeverAskAgain) && DebugAlwaysTrue(AutoShow))
   {
     WinConfiguration->ShowTips = false;
   }

+ 2 - 2
source/windows/SynchronizeController.cpp

@@ -159,7 +159,7 @@ void __fastcall TSynchronizeController::SynchronizeChange(
                 }
                 else
                 {
-                  FAIL;
+                  DebugFail;
                 }
               }
             }
@@ -205,7 +205,7 @@ void __fastcall TSynchronizeController::LogOperation(TSynchronizeOperation Opera
       break;
 
     default:
-      FAIL;
+      DebugFail;
       // fallthru
 
     case soUpload:

+ 6 - 6
source/windows/Tools.cpp

@@ -531,7 +531,7 @@ void __fastcall OpenBrowser(UnicodeString URL)
   UnicodeString HttpHomePageUrl = ReplaceStr(L"http://", L"https://", HomePageUrl);
   DebugAssert(HomePageUrl != HttpHomePageUrl);
   if (SameText(URL.SubString(1, HomePageUrl.Length()), HomePageUrl) ||
-      ALWAYS_FALSE(SameText(URL.SubString(1, HttpHomePageUrl.Length()), HttpHomePageUrl)))
+      DebugAlwaysFalse(SameText(URL.SubString(1, HttpHomePageUrl.Length()), HttpHomePageUrl)))
   {
     URL = CampaignUrl(URL);
   }
@@ -1058,7 +1058,7 @@ static void __fastcall DoVerifyKey(
         break;
 
       default:
-        FAIL;
+        DebugFail;
         // fallthru
       case ktUnknown:
         Message = MainInstructions(FMTLOAD(KEY_TYPE_UNKNOWN2, (FileName)));
@@ -1357,20 +1357,20 @@ bool __fastcall TWinHelpTester::CanShowALink(const UnicodeString ALink,
 bool __fastcall TWinHelpTester::CanShowTopic(const UnicodeString Topic,
   const UnicodeString FileName)
 {
-  FAIL;
+  DebugFail;
   return !Application->HelpFile.IsEmpty();
 }
 //---------------------------------------------------------------------------
 bool __fastcall TWinHelpTester::CanShowContext(const int /*Context*/,
   const UnicodeString FileName)
 {
-  FAIL;
+  DebugFail;
   return !Application->HelpFile.IsEmpty();
 }
 //---------------------------------------------------------------------------
 TStringList * __fastcall TWinHelpTester::GetHelpStrings(const UnicodeString ALink)
 {
-  FAIL;
+  DebugFail;
   TStringList * Result = new TStringList();
   Result->Add(ViewerName + L": " + ALink);
   return Result;
@@ -1395,7 +1395,7 @@ __fastcall TCustomHelpSelector::TCustomHelpSelector(const UnicodeString & Name)
 //---------------------------------------------------------------------------
 int __fastcall TCustomHelpSelector::SelectKeyword(TStrings * /*Keywords*/)
 {
-  FAIL;
+  DebugFail;
   return 0;
 }
 //---------------------------------------------------------------------------

+ 9 - 9
source/windows/UserInterface.cpp

@@ -247,7 +247,7 @@ void __fastcall ShowExtendedExceptionEx(TTerminal * Terminal,
             break;
 
           default:
-            FAIL;
+            DebugFail;
         }
       }
       else if (Result == qaRetry)
@@ -482,7 +482,7 @@ void __fastcall LoadToolbarsLayoutStr(TComponent * OwnerComponent, UnicodeString
         if ((Toolbar != NULL) && Toolbar->Stretch &&
             (Toolbar->OnGetBaseSize != NULL) &&
             // we do not support floating of stretched toolbars
-            ALWAYS_TRUE(!Toolbar->Floating))
+            DebugAlwaysTrue(!Toolbar->Floating))
         {
           TTBXToolbar * FollowingToolbar = NULL;
           for (int Index2 = 0; Index2 < OwnerComponent->ComponentCount; Index2++)
@@ -532,7 +532,7 @@ static void __fastcall ConvertMenu(TMenuItem * AItems, TTBCustomItem * Items)
     TTBCustomItem * Item;
 
     if (!AItem->Enabled && !AItem->Visible && (AItem->Action == NULL) &&
-        (AItem->OnClick == NULL) && ALWAYS_TRUE(AItem->Count == 0))
+        (AItem->OnClick == NULL) && DebugAlwaysTrue(AItem->Count == 0))
     {
       TTBXLabelItem * LabelItem = new TTBXLabelItem(Items->Owner);
       // TTBXLabelItem has it's own Caption
@@ -662,7 +662,7 @@ static void __fastcall GetStandardSessionColorInfo(
   COLOR_INFO(6, 1, L"Light Purple",      0xD9C1CC)
   COLOR_INFO(7, 1, L"Light Aqua",        0xE8DDB7)
 
-  FAIL;
+  DebugFail;
   #undef COLOR_INFO
 }
 //---------------------------------------------------------------------------
@@ -736,9 +736,9 @@ __fastcall TColorChangeData::TColorChangeData(
 //---------------------------------------------------------------------------
 TColorChangeData * __fastcall TColorChangeData::Retrieve(TObject * Object)
 {
-  TComponent * Component = NOT_NULL(dynamic_cast<TComponent *>(Object));
+  TComponent * Component = DebugNotNull(dynamic_cast<TComponent *>(Object));
   TComponent * ColorChangeDataComponent = Component->FindComponent(QualifiedClassName());
-  return NOT_NULL(dynamic_cast<TColorChangeData *>(ColorChangeDataComponent));
+  return DebugNotNull(dynamic_cast<TColorChangeData *>(ColorChangeDataComponent));
 }
 //---------------------------------------------------------------------------
 void __fastcall TColorChangeData::ColorChange(TColor Color)
@@ -778,7 +778,7 @@ static void __fastcall ColorDefaultClick(void * /*Data*/, TObject * Sender)
 //---------------------------------------------------------------------------
 static void __fastcall ColorPaletteChange(void * /*Data*/, TObject * Sender)
 {
-  TTBXColorPalette * ColorPalette = NOT_NULL(dynamic_cast<TTBXColorPalette *>(Sender));
+  TTBXColorPalette * ColorPalette = DebugNotNull(dynamic_cast<TTBXColorPalette *>(Sender));
   TColorChangeData::Retrieve(Sender)->ColorChange(GetNonZeroColor(ColorPalette->Color));
 }
 //---------------------------------------------------------------------------
@@ -911,7 +911,7 @@ static void __fastcall CreateColorMenu(TComponent * AOwner, TColor Color,
   const UnicodeString & ColorPickHint)
 {
   TTBCustomItem * Owner = dynamic_cast<TTBCustomItem *>(AOwner);
-  if (ALWAYS_TRUE(Owner != NULL))
+  if (DebugAlwaysTrue(Owner != NULL))
   {
     Owner->Clear();
 
@@ -1229,7 +1229,7 @@ static bool __fastcall DoMasterPasswordDialog(bool Current,
     if (Result)
     {
       if ((Current || WinConfiguration->UseMasterPassword) &&
-          ALWAYS_TRUE(!CurrentPassword.IsEmpty()))
+          DebugAlwaysTrue(!CurrentPassword.IsEmpty()))
       {
         WinConfiguration->SetMasterPassword(CurrentPassword);
       }

+ 11 - 11
source/windows/VCLCommon.cpp

@@ -146,7 +146,7 @@ void __fastcall AutoSizeListColumnsWidth(TListView * ListView, int ColumnToShrin
       ClientWidth -= GetSystemMetrics(SM_CXVSCROLL);
     }
 
-    if (ALWAYS_TRUE(NonResizableWidth < ClientWidth))
+    if (DebugAlwaysTrue(NonResizableWidth < ClientWidth))
     {
       int Remaining = ClientWidth - NonResizableWidth;
 
@@ -282,7 +282,7 @@ void __fastcall ReadOnlyControl(TControl * Control, bool ReadOnly)
   }
   else
   {
-    FAIL;
+    DebugFail;
   }
 }
 //---------------------------------------------------------------------------
@@ -465,7 +465,7 @@ inline void __fastcall DoFormWindowProc(TCustomForm * Form, TWndMethod WndProc,
                  (AForm->Position != poDefaultPosOnly))
         {
           // we do not expect any other positioning
-          FAIL;
+          DebugFail;
         }
       }
       else
@@ -572,7 +572,7 @@ void __fastcall VerifyControl(TControl * Control)
     DebugAssert(Application->BiDiMode != bdLeftToRight);
     TWinControl * WinControl = dynamic_cast<TWinControl *>(Control);
     // It must be TWinControl if ControlHasRecreationPersistenceData returned true
-    if (ALWAYS_TRUE(WinControl != NULL))
+    if (DebugAlwaysTrue(WinControl != NULL))
     {
       WinControl->HandleNeeded();
     }
@@ -611,8 +611,8 @@ void __fastcall ApplySystemSettingsOnControl(TControl * Control)
   if (StatusBar != NULL)
   {
     // We should have UseSystemFont and bottom alignment set for all status bars.
-    if (ALWAYS_TRUE(StatusBar->UseSystemFont) &&
-        ALWAYS_TRUE(StatusBar->Align == alBottom))
+    if (DebugAlwaysTrue(StatusBar->UseSystemFont) &&
+        DebugAlwaysTrue(StatusBar->Align == alBottom))
     {
       StatusBar->Height = ScaleByTextHeight(StatusBar, StatusBar->Height);
     }
@@ -673,7 +673,7 @@ void __fastcall ApplySystemSettingsOnControl(TControl * Control)
     {
       IListView_Win7 * ListViewIntf = NULL;
       SendMessage(IEListView->Handle, LVM_QUERYINTERFACE, reinterpret_cast<WPARAM>(&IID_IListView_Win7), reinterpret_cast<LPARAM>(&ListViewIntf));
-      if (ALWAYS_TRUE(ListViewIntf != NULL))
+      if (DebugAlwaysTrue(ListViewIntf != NULL))
       {
         ListViewIntf->SetSelectionFlags(1, 1);
         ListViewIntf->Release();
@@ -1062,7 +1062,7 @@ int CALLBACK PathWordBreakProc(wchar_t * Ch, int Current, int Len, int Code)
   }
   else
   {
-    FAIL;
+    DebugFail;
     Result = 0;
   }
   return Result;
@@ -1411,7 +1411,7 @@ static void __fastcall FocusableLabelCanvas(TStaticText * StaticText,
 
       case taCenter:
         {
-          FAIL; // not used branch, possibly untested
+          DebugFail; // not used branch, possibly untested
           int Diff = R.Width() - TextSize.cx;
           R.Left += Diff / 2;
           R.Right -= Diff - (Diff / 2);
@@ -1994,7 +1994,7 @@ TModalResult __fastcall DefaultResult(TCustomForm * Form, TButton * DefaultButto
   // We interpreted mrNone as OK, causing lots of troubles.
   TModalResult Result = mrNone;
   TButton * Button = FindDefaultButton(Form);
-  if (ALWAYS_TRUE(Button != NULL))
+  if (DebugAlwaysTrue(Button != NULL))
   {
     Result = Button->ModalResult;
   }
@@ -2025,7 +2025,7 @@ void __fastcall MemoKeyDown(TObject * Sender, WORD & Key, TShiftState Shift)
 {
   // Sender can be Form or Memo itself
   TControl * Control = dynamic_cast<TControl *>(Sender);
-  if (ALWAYS_TRUE(Control != NULL))
+  if (DebugAlwaysTrue(Control != NULL))
   {
     TCustomForm * Form = GetParentForm(Control);
     // Particularly when WantReturns is true,

+ 6 - 6
source/windows/WinConfiguration.cpp

@@ -1202,7 +1202,7 @@ void __fastcall TWinConfiguration::LoadData(THierarchicalStorage * Storage)
   {
     // can this (=reloading of configuration) even happen?
     // if it does, shouldn't we reset default commands?
-    FAIL;
+    DebugFail;
     FCustomCommandList->Clear();
     FCustomCommandsDefaults = false;
   }
@@ -1449,8 +1449,8 @@ void __fastcall TWinConfiguration::SetMasterPassword(UnicodeString value)
   {
     FPlainMasterPasswordDecrypt = value;
   }
-  else if (ALWAYS_TRUE(FUseMasterPassword) &&
-      ALWAYS_TRUE(ValidateMasterPassword(value)))
+  else if (DebugAlwaysTrue(FUseMasterPassword) &&
+      DebugAlwaysTrue(ValidateMasterPassword(value)))
   {
     FPlainMasterPasswordEncrypt = value;
     FPlainMasterPasswordDecrypt = value;
@@ -1542,7 +1542,7 @@ void __fastcall TWinConfiguration::BeginMasterPasswordSession()
 //---------------------------------------------------------------------------
 void __fastcall TWinConfiguration::EndMasterPasswordSession()
 {
-  if (ALWAYS_TRUE(FMasterPasswordSession > 0))
+  if (DebugAlwaysTrue(FMasterPasswordSession > 0))
   {
     FMasterPasswordSession--;
   }
@@ -1873,7 +1873,7 @@ void __fastcall TWinConfiguration::UpdateIconFont()
   }
   else
   {
-    if (ALWAYS_TRUE(FSystemIconFont.get() != NULL) &&
+    if (DebugAlwaysTrue(FSystemIconFont.get() != NULL) &&
         !SameFont(Screen->IconFont, FSystemIconFont.get()))
     {
       Screen->IconFont->Assign(FSystemIconFont.get());
@@ -2102,7 +2102,7 @@ void __fastcall TWinConfiguration::CleanupTemporaryFolders(TStrings * Folders)
   {
     try
     {
-      if (ALWAYS_TRUE(F->Count > 0))
+      if (DebugAlwaysTrue(F->Count > 0))
       {
         Usage->Inc(L"TemporaryDirectoryCleanups");
       }

+ 11 - 11
source/windows/WinInterface.cpp

@@ -155,7 +155,7 @@ static void __fastcall NeverAskAgainCheckClick(void * /*Data*/, TObject * Sender
 //---------------------------------------------------------------------------
 static TCheckBox * __fastcall FindNeverAskAgainCheck(TForm * Dialog)
 {
-  return NOT_NULL(dynamic_cast<TCheckBox *>(Dialog->FindComponent(L"NeverAskAgainCheck")));
+  return DebugNotNull(dynamic_cast<TCheckBox *>(Dialog->FindComponent(L"NeverAskAgainCheck")));
 }
 //---------------------------------------------------------------------------
 TForm * __fastcall CreateMessageDialogEx(const UnicodeString Msg,
@@ -168,7 +168,7 @@ TForm * __fastcall CreateMessageDialogEx(const UnicodeString Msg,
     case qtInformation: DlgType = mtInformation; break;
     case qtError: DlgType = mtError; break;
     case qtWarning: DlgType = mtWarning; break;
-    default: FAIL;
+    default: DebugFail;
   }
 
   unsigned int TimeoutAnswer = (Params != NULL) ? Params->TimeoutAnswer : 0;
@@ -222,7 +222,7 @@ TForm * __fastcall CreateMessageDialogEx(const UnicodeString Msg,
 
   try
   {
-    if (HasNeverAskAgain && ALWAYS_TRUE(Params != NULL))
+    if (HasNeverAskAgain && DebugAlwaysTrue(Params != NULL))
     {
       TCheckBox * NeverAskAgainCheck = FindNeverAskAgainCheck(Dialog);
       NeverAskAgainCheck->Checked = Params->NeverAskAgainCheckedInitially;
@@ -536,11 +536,11 @@ static TStrings * __fastcall StackInfoListToStrings(
     // get rid of declarations "flags" that are included in .map
     Frame = ReplaceStr(Frame, L"__fastcall ", L"");
     Frame = ReplaceStr(Frame, L"__linkproc__ ", L"");
-    if (ALWAYS_TRUE(!Frame.IsEmpty() && (Frame[1] == L'(')))
+    if (DebugAlwaysTrue(!Frame.IsEmpty() && (Frame[1] == L'(')))
     {
       int Start = Frame.Pos(L"[");
       int End = Frame.Pos(L"]");
-      if (ALWAYS_TRUE((Start > 1) && (End > Start) && (Frame[Start - 1] == L' ')))
+      if (DebugAlwaysTrue((Start > 1) && (End > Start) && (Frame[Start - 1] == L' ')))
       {
         // remove absolute address
         Frame.Delete(Start - 1, End - Start + 2);
@@ -600,7 +600,7 @@ unsigned int __fastcall ExceptionMessageDialog(Exception * E, TQueryType Type,
   UnicodeString Message;
   // this is always called from within ExceptionMessage check,
   // so it should never fail here
-  CHECK(ExceptionMessageFormatted(E, Message));
+  DebugCheck(ExceptionMessageFormatted(E, Message));
 
   HelpKeyword = MergeHelpKeyword(HelpKeyword, GetExceptionHelpKeyword(E));
 
@@ -657,7 +657,7 @@ static void __fastcall DoExceptNotify(TObject * ExceptObj, void * ExceptAddr,
 
       TJclStackInfoList * StackInfoList = JclLastExceptStackList();
 
-      if (ALWAYS_TRUE(StackInfoList != NULL))
+      if (DebugAlwaysTrue(StackInfoList != NULL))
       {
         std::unique_ptr<TStrings> StackTrace(StackInfoListToStrings(StackInfoList));
 
@@ -854,7 +854,7 @@ bool __fastcall CopyParamListPopupClick(TObject * Sender,
   }
   else if (Item->Tag == cpiSaveSettings)
   {
-    if (ALWAYS_TRUE(SaveSettings != NULL))
+    if (DebugAlwaysTrue(SaveSettings != NULL))
     {
       *SaveSettings = !*SaveSettings;
     }
@@ -1173,7 +1173,7 @@ void __fastcall ClearGlobalMinimizeHandler(TNotifyEvent OnMinimize)
 void __fastcall CallGlobalMinimizeHandler(TObject * Sender)
 {
   Configuration->Usage->Inc(L"OperationMinimizations");
-  if (ALWAYS_TRUE(GlobalOnMinimize != NULL))
+  if (DebugAlwaysTrue(GlobalOnMinimize != NULL))
   {
     GlobalOnMinimize(Sender);
   }
@@ -1189,7 +1189,7 @@ static void __fastcall DoApplicationMinimizeRestore(bool Minimize)
   // but we do it for consistency anyway.
   TForm * MainForm = Application->MainForm;
   bool RestoreMainForm = false;
-  if (ALWAYS_TRUE(MainForm != NULL) &&
+  if (DebugAlwaysTrue(MainForm != NULL) &&
       !MainForm->Visible)
   {
     SetAppMainForm(NULL);
@@ -1284,7 +1284,7 @@ __fastcall ::TTrayIcon::TTrayIcon(unsigned int Id)
 
   // LoadIconMetric is available from Windows Vista only
   HMODULE ComCtl32Dll = GetModuleHandle(comctl32);
-  if (ALWAYS_TRUE(ComCtl32Dll))
+  if (DebugAlwaysTrue(ComCtl32Dll))
   {
     typedef HRESULT WINAPI (* TLoadIconMetric)(HINSTANCE hinst, PCWSTR pszName, int lims, __out HICON *phico);
     TLoadIconMetric LoadIconMetric = (TLoadIconMetric)GetProcAddress(ComCtl32Dll, "LoadIconMetric");

+ 2 - 2
source/windows/WinMain.cpp

@@ -43,7 +43,7 @@ void __fastcall GetLoginData(UnicodeString SessionName, TOptions * Options,
 
     if (DataList->Count == 1)
     {
-      TSessionData * SessionData = NOT_NULL(dynamic_cast<TSessionData *>(DataList->Items[0]));
+      TSessionData * SessionData = DebugNotNull(dynamic_cast<TSessionData *>(DataList->Items[0]));
       if (SessionData->SaveOnly)
       {
         Configuration->Usage->Inc(L"CommandLineSessionSave");
@@ -244,7 +244,7 @@ void __fastcall ImportSitesIfAny()
       }
       else
       {
-        FAIL;
+        DebugFail;
       }
 
       UnicodeString Message = FORMAT(LoadStrPart(IMPORT_SESSIONS2, 1), (Source));