浏览代码

Invalid assertion

(cherry picked from commit ecdcc5ff243afe884811d3c087b1eeb2bc2d1a53)

Source commit: 8235ae345666167d872c14019175ab1f5a00a60e
Martin Prikryl 4 年之前
父节点
当前提交
2fdd36d818
共有 3 个文件被更改,包括 11 次插入6 次删除
  1. 6 1
      source/core/FileOperationProgress.cpp
  2. 2 1
      source/core/FileOperationProgress.h
  3. 3 4
      source/core/ScpFileSystem.cpp

+ 6 - 1
source/core/FileOperationProgress.cpp

@@ -812,9 +812,14 @@ unsigned long __fastcall TFileOperationProgressType::StaticBlockSize()
   return TRANSFER_BUF_SIZE;
 }
 //---------------------------------------------------------------------------
-bool __fastcall TFileOperationProgressType::IsTransferDone()
+bool TFileOperationProgressType::IsTransferDoneChecked()
 {
   DebugAssert(TransferredSize <= TransferSize);
+  return IsTransferDone();
+}
+//---------------------------------------------------------------------------
+bool TFileOperationProgressType::IsTransferDone()
+{
   return (TransferredSize == TransferSize);
 }
 //---------------------------------------------------------------------------

+ 2 - 1
source/core/FileOperationProgress.h

@@ -182,7 +182,8 @@ public:
   void __fastcall Progress();
   unsigned long __fastcall LocalBlockSize();
   bool __fastcall IsLocallyDone();
-  bool __fastcall IsTransferDone();
+  bool IsTransferDone();
+  bool IsTransferDoneChecked();
   void __fastcall SetFile(UnicodeString AFileName, bool AFileInProgress = true);
   void __fastcall SetFileInProgress();
   unsigned long __fastcall TransferBlockSize();

+ 3 - 4
source/core/ScpFileSystem.cpp

@@ -1874,7 +1874,7 @@ void __fastcall TSCPFileSystem::SCPSource(const UnicodeString FileName,
               (AsciiBuf.Size)));
             // Should be equal, just in case it's rounded (see above)
             OperationProgress->ChangeTransferSize(AsciiBuf.Size);
-            while (!OperationProgress->IsTransferDone())
+            while (!OperationProgress->IsTransferDoneChecked())
             {
               unsigned long BlockSize = OperationProgress->TransferBlockSize();
               FSecureShell->Send(
@@ -1912,7 +1912,7 @@ void __fastcall TSCPFileSystem::SCPSource(const UnicodeString FileName,
           throw Exception(MainInstructions(LoadStr(USER_TERMINATED)));
         }
       }
-      while (!OperationProgress->IsLocallyDone() || !OperationProgress->IsTransferDone());
+      while (!OperationProgress->IsLocallyDone() || !OperationProgress->IsTransferDoneChecked());
 
       FSecureShell->SendNull();
       try
@@ -2572,8 +2572,7 @@ void __fastcall TSCPFileSystem::SCPSink(const UnicodeString TargetDir,
                     throw Exception(MainInstructions(LoadStr(USER_TERMINATED)));
                   }
                 }
-                while (!OperationProgress->IsLocallyDone() || !
-                    OperationProgress->IsTransferDone());
+                while (!OperationProgress->IsLocallyDone() || !OperationProgress->IsTransferDoneChecked());
               }
               catch (Exception &E)
               {