View Issue Details

IDProjectCategoryView StatusLast Update
0032490Open CASCADEOCCT:Data Exchangepublic2023-03-19 18:00
Reporterkgv Assigned Tomkrylova 
PrioritynormalSeverityintegration request 
Status closedResolutionfixed 
Target Version7.6.0Fixed in Version7.6.0 
Summary0032490: Data Exchange - provide OSD_FileSystem::OpenOStream() for output streams
DescriptionOSD_FileSystem::OpenIStream() creates input stream.
It is necessary extending interface with output stream ::OpenOStream(), and probably with ::OpenIOStream().
Steps To ReproduceNot required
TagsNo tags attached.
Test case numberNot required

Relationships

related to 0032455 closedmkrylova Data Exchange - replace OSD_OpenStream() usage with OSD_FileSystem::DefaultFileSystem() 
child of 0032099 closedbugmaster Visualization - define OSD_FileSystem class managing opening of file streams 

Activities

mkrylova

2021-07-23 16:53

developer   ~0102751

Analysis

git

2021-07-26 18:22

administrator   ~0102820

Branch CR32490 has been created by mkrylova.

SHA-1: 62942fa358698b9258d413b87df688f35c98e85b


Detailed log of new commits:

Author: mkrylova
Date: Mon Jul 26 11:09:57 2021 +0300

    0032490: Data Exchange - provide OSD_FileSystem::OpenOStream() for output streams
    
    - provided OSD_FileSystem::OpenOStream() for output streams
    - replaced OSD_OpenStream() usage with OSD_FileSystem::DefaultFileSystem()

git

2021-07-27 15:04

administrator   ~0102834

Branch CR32490_1 has been created by mkrylova.

SHA-1: b598c9a7f5d65dc1498422d65a4bbbdf467f482c


Detailed log of new commits:

Author: mkrylova
Date: Mon Jul 26 11:09:57 2021 +0300

    0032490: Data Exchange - provide OSD_FileSystem::OpenOStream() for output streams
    
    - provided OSD_FileSystem::OpenOStream() for output streams
    - replaced OSD_OpenStream() usage with OSD_FileSystem::DefaultFileSystem()

mkrylova

2021-07-27 17:09

developer   ~0102835

http://jenkins-test-occt.nnov.opencascade.com/view/CR32490_1-CR32490_1-MKRYLOVA/view/ALL/

mkrylova

2021-07-27 17:10

developer   ~0102836

Patch is ready to review:
- OCCT: CR32490_1
- Products: CR32490_1

mkrylova

2021-07-27 17:10

developer   ~0102837

Solution implementation

kgv

2021-07-27 20:16

developer   ~0102841

-  aFileOut.close();
-  if (!aFileOut.good())
+  if (!aFileOut->good())

As std::ostream does not have method close(),
the code should be updated to call flush() instead to ensure that buffered sequence is actually (tried to be) written to the file before checking for error via good().

@@ -70,17 +70,18 @@ Message_PrinterOStream::Message_PrinterOStream (const 
-  std::ofstream* aFile = new std::ofstream();
-  OSD_OpenStream (*aFile, aFileName.ToCString(), (theToAppend ? (std::ios_base::app | std::ios_base::out) : std::ios_base::out));
+  opencascade::std::shared_ptr<std::ostream> aFile = aFileSystem->OpenOStream
+    (aFileName, (theToAppend ? (std::ios_base::app | std::ios_base::out) : std::ios_base::out));
+  if (aFile.get() != NULL)
   {
-    myStream = (Standard_OStream* )aFile;
+    myStream = (Standard_OStream*) aFile.get();

This wouldn't work like this - the code will lead to crash.
Please just revert changes in Message_PrinterOStream in scope of this patch.

+  Standard_EXPORT virtual opencascade::std::shared_ptr<std::ostream> OpenOStream
+                          (const TCollection_AsciiString& theUrl,
+                           const std::ios_base::openmode theMode,
+                           const int64_t theOffset = 0,
+                           const opencascade::std::shared_ptr<std::ostream>& theOldStream = opencascade::std::shared_ptr<std::ostream>());

Opening file for writing has very different meaning compared to input stream.
I propose simplifying interface in scope of this patch and drop theOldStream and theOffset arguments.

@@ -42,6 +42,20 @@ Standard_Boolean OSD_LocalFileSystem::IsOpenIStream (const opencascade::std::sha
   return (aFileBuf != NULL) ? aFileBuf->is_open() : false;
...
+Standard_Boolean OSD_LocalFileSystem::IsOpenOStream (const opencascade::std::shared_ptr<std::ostream>& theStream) const
+  return (aFileStream != NULL) ? aFileStream->good() : false;

Why implementation of IsOpenOStream() is inconsistent to IsOpenIStream()?

opencascade::std::shared_ptr<std::streambuf> OSD_CachedFileSystem::OpenStreamBuffer()

Please update OSD_CachedFileSystem::OpenStreamBuffer() to skip myStream in case of std::ios::out flag.

git

2021-07-28 15:43

administrator   ~0102849

Branch CR32490_1 has been updated by mkrylova.

SHA-1: 92b29e6ff2fa00a0851169706bdb0a22ac919892


Detailed log of new commits:

Author: mkrylova
Date: Wed Jul 28 13:29:39 2021 +0300

    # kgv remarks

git

2021-07-28 17:50

administrator   ~0102855

Branch CR32490_2 has been created by mkrylova.

SHA-1: 9146eeb70bcc05cad9da4bdcfc041d9400272f1e


Detailed log of new commits:

Author: mkrylova
Date: Mon Jul 26 11:09:57 2021 +0300

    0032490: Data Exchange - provide OSD_FileSystem::OpenOStream() for output streams
    
    - provided OSD_FileSystem::OpenOStream() for output streams
    - replaced OSD_OpenStream() usage with OSD_FileSystem::DefaultFileSystem()

git

2021-07-29 12:20

administrator   ~0102867

Branch CR32490_2 has been updated by mkrylova.

SHA-1: f669a330bd8580cb86037e8d45fe1f79c21955f6


Detailed log of new commits:

Author: mkrylova
Date: Thu Jul 29 12:20:02 2021 +0300

    # fixed warnings

git

2021-07-29 12:21

administrator   ~0102868

Branch CR32490_3 has been created by mkrylova.

SHA-1: ac725ed2685757ca3a9a20c62eb410476eb5759f


Detailed log of new commits:

Author: mkrylova
Date: Mon Jul 26 11:09:57 2021 +0300

    0032490: Data Exchange - provide OSD_FileSystem::OpenOStream() for output streams
    
    - provided OSD_FileSystem::OpenOStream() for output streams
    - replaced OSD_OpenStream() usage with OSD_FileSystem::DefaultFileSystem()

mkrylova

2021-07-29 14:23

developer   ~0102872

http://jenkins-test-occt.nnov.opencascade.com/view/CR32490_3-CR32490_3-MKRYLOVA/view/ALL/

mkrylova

2021-07-29 14:23

developer   ~0102873

Patch is ready to review:
- OCCT: CR32490_3
- Products: CR32490_3

git

2021-07-30 11:46

administrator   ~0102880

Branch CR32490_3 has been updated by mkrylova.

SHA-1: 002962b21ba6136f82e2fb9176b4ac7eb25a5579


Detailed log of new commits:

Author: mkrylova
Date: Fri Jul 30 11:34:59 2021 +0300

    # kgv remarks

git

2021-07-30 11:50

administrator   ~0102882

Branch CR32490_4 has been created by mkrylova.

SHA-1: 9e2a2e3aa5cd680b780beeacfd4d4aea159e5c40


Detailed log of new commits:

Author: mkrylova
Date: Mon Jul 26 11:09:57 2021 +0300

    0032490: Data Exchange - provide OSD_FileSystem::OpenOStream() for output streams
    
    - provided OSD_FileSystem::OpenOStream() for output streams
    - replaced OSD_OpenStream() usage with OSD_FileSystem::DefaultFileSystem()

mkrylova

2021-07-30 11:51

developer   ~0102884

Patch is ready to review:
- OCCT: CR32490_4
- Products: CR32490_4

mkrylova

2021-07-30 12:02

developer   ~0102885

Last edited: 2021-07-30 18:21

Solution implementation, Testing

bugmaster

2021-07-31 16:46

administrator   ~0102908

http://jenkins-test-08.nnov.opencascade.com/view/CR32490_4-CR32490_4-INV/

git

2021-08-02 12:14

administrator   ~0102921

Branch CR32490_4 has been updated forcibly by mkrylova.

SHA-1: 9be632d2d7bb8e8841a9978cf8cf5d11684ce92c

git

2021-08-02 12:18

administrator   ~0102923

Branch CR32490_5 has been created by mkrylova.

SHA-1: 9f0c55c6145d53e62fb5329ca190374bd8045199


Detailed log of new commits:

Author: mkrylova
Date: Mon Jul 26 11:09:57 2021 +0300

    0032490: Data Exchange - provide OSD_FileSystem::OpenOStream() for output streams
    
    - provided OSD_FileSystem::OpenOStream() for output streams
    - replaced OSD_OpenStream() usage with OSD_FileSystem::DefaultFileSystem()

mkrylova

2021-08-02 15:24

developer   ~0102927

http://jenkins-test-occt.nnov.opencascade.com/view/CR32490_5-CR32490_5-MKRYLOVA/view/ALL/

mkrylova

2021-08-02 15:24

developer   ~0102928

Patch is ready to review:
- OCCT: CR32490_5
- Products: CR32490_5

mkrylova

2021-08-04 17:09

developer   ~0102981

Solution Implementation, Testing

bugmaster

2021-08-07 13:11

administrator   ~0103055

Combination -
OCCT branch : IR-2021-08-06
master SHA - 27e64adb38a9a8e6370b5dbd38a9018313884a9c
a87b7ddc8cb44606b91e3f37113847c3f5f50fdc
Products branch : IR-2021-08-06 SHA - d93b03b621e54fe532eb3f2eba1a1613534cfc91
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 17370.66000000038 / 17380.800000000403 [-0.06%]
Products
Total CPU difference: 11454.410000000084 / 11476.060000000101 [-0.19%]
Windows-64-VC14:
OCCT
Total CPU difference: 19180.84375 / 19196.421875 [-0.08%]
Products
Total CPU difference: 12822.75 / 12808.78125 [+0.11%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2021-08-07 13:37

administrator   ~0103067

Branch CR32490 has been deleted by mnt.

SHA-1: 62942fa358698b9258d413b87df688f35c98e85b

git

2021-08-07 13:38

administrator   ~0103068

Branch CR32490_1 has been deleted by mnt.

SHA-1: 92b29e6ff2fa00a0851169706bdb0a22ac919892

git

2021-08-07 13:38

administrator   ~0103069

Branch CR32490_2 has been deleted by mnt.

SHA-1: f669a330bd8580cb86037e8d45fe1f79c21955f6

git

2021-08-07 13:38

administrator   ~0103070

Branch CR32490_3 has been deleted by mnt.

SHA-1: 002962b21ba6136f82e2fb9176b4ac7eb25a5579

git

2021-08-07 13:38

administrator   ~0103071

Branch CR32490_4 has been deleted by mnt.

SHA-1: 9be632d2d7bb8e8841a9978cf8cf5d11684ce92c

git

2021-08-07 13:38

administrator   ~0103072

Branch CR32490_5 has been deleted by mnt.

SHA-1: 9f0c55c6145d53e62fb5329ca190374bd8045199

Related Changesets

occt: master 27e64adb

2021-07-26 08:09:57

mkrylova


Committer: bugmaster Details Diff
0032490: Data Exchange - provide OSD_FileSystem::OpenOStream() for output streams

- provided OSD_FileSystem::OpenOStream() for output streams
- replaced OSD_OpenStream() usage with OSD_FileSystem::DefaultFileSystem()
Affected Issues
0032490
mod - src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx Diff File
mod - src/BinTools/BinTools.cxx Diff File
mod - src/BRepTools/BRepTools.cxx Diff File
mod - src/DDocStd/DDocStd_ApplicationCommands.cxx Diff File
mod - src/Draw/Draw_VariableCommands.cxx Diff File
mod - src/IGESControl/IGESControl_Writer.cxx Diff File
mod - src/IGESSelect/IGESSelect_WorkLibrary.cxx Diff File
mod - src/Image/Image_Texture.cxx Diff File
mod - src/OSD/OSD_CachedFileSystem.cxx Diff File
mod - src/OSD/OSD_CachedFileSystem.hxx Diff File
mod - src/OSD/OSD_FileSystem.cxx Diff File
mod - src/OSD/OSD_FileSystem.hxx Diff File
mod - src/OSD/OSD_FileSystemSelector.cxx Diff File
mod - src/OSD/OSD_FileSystemSelector.hxx Diff File
mod - src/OSD/OSD_LocalFileSystem.cxx Diff File
mod - src/OSD/OSD_LocalFileSystem.hxx Diff File
mod - src/RWGltf/RWGltf_CafWriter.cxx Diff File
mod - src/StepSelect/StepSelect_WorkLibrary.cxx Diff File
mod - src/TObjDRAW/TObjDRAW.cxx Diff File
mod - src/ViewerTest/ViewerTest_OpenGlCommands.cxx Diff File
mod - src/VrmlAPI/VrmlAPI_Writer.cxx Diff File
mod - src/XmlLDrivers/XmlLDrivers_DocumentStorageDriver.cxx Diff File

occt-products: master bb97712d

2021-07-26 17:14:58

mkrylova

Details Diff
0032490: Data Exchange - provide OSD_FileSystem::OpenOStream() for output streams

- provided OSD_FileSystem::OpenOStream() for output streams
- replaced OSD_OpenStream() usage with OSD_FileSystem::DefaultFileSystem()
Affected Issues
0032490
mod - diff Diff File
mod - diff Diff File
mod - diff Diff File
mod - diff Diff File
mod - diff Diff File
mod - diff Diff File
mod - diff Diff File
mod - src/AcisData/AcisData_AcisModel.cxx Diff File
mod - src/Json/Json_BsonDocument.cxx Diff File
mod - src/XSDRAWSAT/XSDRAWSAT.cxx Diff File

Issue History

Date Modified Username Field Change
2021-07-23 15:25 kgv New Issue
2021-07-23 15:25 kgv Assigned To => mkrylova
2021-07-23 15:25 kgv Relationship added related to 0032455
2021-07-23 15:25 kgv Relationship added child of 0032099
2021-07-23 15:26 kgv Status new => assigned
2021-07-23 16:53 mkrylova Note Added: 0102751
2021-07-26 18:22 git Note Added: 0102820
2021-07-27 15:04 git Note Added: 0102834
2021-07-27 17:09 mkrylova Note Added: 0102835
2021-07-27 17:10 mkrylova Note Added: 0102836
2021-07-27 17:10 mkrylova Note Added: 0102837
2021-07-27 17:11 mkrylova Assigned To mkrylova => kgv
2021-07-27 17:11 mkrylova Status assigned => resolved
2021-07-27 17:11 mkrylova Steps to Reproduce Updated
2021-07-27 20:16 kgv Note Added: 0102841
2021-07-27 20:16 kgv Assigned To kgv => mkrylova
2021-07-27 20:16 kgv Status resolved => assigned
2021-07-28 15:43 git Note Added: 0102849
2021-07-28 17:50 git Note Added: 0102855
2021-07-29 12:20 git Note Added: 0102867
2021-07-29 12:21 git Note Added: 0102868
2021-07-29 14:23 mkrylova Note Added: 0102872
2021-07-29 14:23 mkrylova Note Added: 0102873
2021-07-29 14:23 mkrylova Assigned To mkrylova => kgv
2021-07-29 14:23 mkrylova Status assigned => resolved
2021-07-29 16:07 kgv Assigned To kgv => mkrylova
2021-07-29 16:07 kgv Status resolved => assigned
2021-07-30 11:46 git Note Added: 0102880
2021-07-30 11:50 git Note Added: 0102882
2021-07-30 11:51 mkrylova Note Added: 0102884
2021-07-30 11:51 mkrylova Assigned To mkrylova => kgv
2021-07-30 11:51 mkrylova Status assigned => resolved
2021-07-30 12:02 mkrylova Note Added: 0102885
2021-07-30 12:06 kgv Assigned To kgv => bugmaster
2021-07-30 12:06 kgv Status resolved => reviewed
2021-07-30 18:21 mkrylova Note Edited: 0102885
2021-07-31 16:46 bugmaster Note Added: 0102908
2021-07-31 16:46 bugmaster Assigned To bugmaster => mkrylova
2021-07-31 16:46 bugmaster Status reviewed => assigned
2021-08-02 12:14 git Note Added: 0102921
2021-08-02 12:18 git Note Added: 0102923
2021-08-02 15:24 mkrylova Note Added: 0102927
2021-08-02 15:24 mkrylova Note Added: 0102928
2021-08-02 15:24 mkrylova Assigned To mkrylova => kgv
2021-08-02 15:24 mkrylova Status assigned => resolved
2021-08-02 16:48 kgv Assigned To kgv => bugmaster
2021-08-02 16:48 kgv Status resolved => reviewed
2021-08-04 17:09 mkrylova Note Added: 0102981
2021-08-07 13:11 bugmaster Note Added: 0103055
2021-08-07 13:11 bugmaster Status reviewed => tested
2021-08-07 13:14 bugmaster Test case number => Not required
2021-08-07 13:27 bugmaster Changeset attached => occt master 27e64adb
2021-08-07 13:27 bugmaster Status tested => verified
2021-08-07 13:27 bugmaster Resolution open => fixed
2021-08-07 13:37 git Note Added: 0103067
2021-08-07 13:38 git Note Added: 0103068
2021-08-07 13:38 git Note Added: 0103069
2021-08-07 13:38 git Note Added: 0103070
2021-08-07 13:38 git Note Added: 0103071
2021-08-07 13:38 git Note Added: 0103072
2021-12-17 18:41 mkrylova Changeset attached => occt-products master bb97712d
2021-12-17 18:41 mkrylova Assigned To bugmaster => mkrylova
2021-12-17 18:41 mkrylova Status closed => verified
2023-03-19 18:00 vglukhik Status verified => closed