0030403: Application Framework - Overwriting Big BinOcaf Files Does Not Reduce Their...
authorBenjamin Bihler <benjamin.bihler@compositence.de>
Thu, 11 Jul 2019 09:16:12 +0000 (11:16 +0200)
committerbugmaster <bugmaster@opencascade.com>
Wed, 17 Jul 2019 12:46:39 +0000 (15:46 +0300)
OSD_OpenFileDescriptor(), added truncating flag to fopen() flags for std::ios_base::out,
since truncating is implied by C++ output flag.
This fixes misbehavior of OSD_OpenStream() on MinGW-w64 platform.

src/OSD/OSD_OpenFile.cxx

index ba8db4b..72b54b0 100644 (file)
@@ -34,14 +34,12 @@ static int OSD_OpenFile_iosMode2FileFlags (::std::ios_base::openmode theMode)
   {
     aFlags |= O_WRONLY;
     aFlags |= O_CREAT;
+    aFlags |= O_TRUNC;
+
     if (theMode & ::std::ios_base::app)
     {
       aFlags |= O_APPEND;
     }
-    if (theMode & ::std::ios_base::trunc)
-    {
-      aFlags |= O_TRUNC;
-    }
   }
 #ifdef _WIN32
   if (theMode & ::std::ios_base::binary)