View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0026414 | Community | OCCT:Application Framework | public | 2015-07-10 13:09 | 2016-02-08 15:45 |
| Reporter | BenjaminBihler | Assigned To | |||
| Priority | normal | Severity | major | ||
| Status | closed | Resolution | no change required | ||
| Product Version | 6.8.0 | ||||
| Summary | 0026414: Cannot read in shape set from OCAF binary file | ||||
| Description | This problem seems very complicated to me. Please let me therefore describe my project verbosely: I use the OCC community edition (=OCE; I know that it is unsupported) with MinGw64 (I know that it is unsupported) on Windows 7 and the same community edition with g++ on Linux 32 Bit. I am also using OCAF with an own binary file format (extension .lpb) with my own attributes and attribute drivers (Sergey Zaritchny has supported me to do that in the course of our "A-la Carte Support" program). I am using BinDrivers_DocumentRetrievalDriver and BinDrivers_DocumentStorageDriver and am adding my own attribute drivers. There has been no problem in writing and reading those binary files for a long time. But when I do the upgrade from OCE 6.7.1 to OCE 6.8.0, reading in binary files on Windows does not work anymore, if they contain wires consisting of several edges or shells consisting of several faces. I receive the error messages: ------------------------------------------------- BinLDrivers_DocumentRetrievalDriver: error: unexpected EOF or garbage data TDocStd_Application::Open(): The status = 12 ------------------------------------------------- I cannot read in files created with OCE 6.7.1, but I also cannot read in files that I have written with OCE 6.8.0. Therefore it seems not to be a file format incompatibility. What surprises me is that I can read in those files also with OCE 6.8.0 on Linux (32 Bit). While looking for the actual problem I have done many tests, which shapes I can read in correctly. There is no problem with vertices, no problem with shells consisting of one face and no problem with wires consisting of one edge. Stacktrace: The problem starts in void BinTools_ShapeSet::Read(Standard_IStream& IS) in the block with the comment "// sub-shapes" (around line 454). The command Read(SS,IS,nbShapes); executes BinTools::GetInteger(IS, anIndx); (around line 517 in BinTools_ShapeSet.cxx) and there around line 100 of BinTools.cxx the command !IS.read ((char*)&aValue, sizeof(Standard_Integer)) fails, leading to a Storage_StreamTypeMismatchError. I will attach a file with which I can reproduce the error. If you cannot reproduce the error, could you give me at least a hint what might be the problem? Thank you very much! | ||||
| Steps To Reproduce | Not required. | ||||
| Tags | No tags attached. | ||||
| Test case number | |||||
|
|
|
|
|
|
Dear Benjamin, The error message "... unexpected EOF or garbage data" means that binary file format was violated. It often happens because of incorrect porting from one version to another. As result "file format" was not recognized and the returned status number = 12 (PCDM_RS_UnrecognizedFileFormat) confirms it. We can't reproduce your case, because for this it is necessary to have as your own specific attributes as persistence drivers supporting your own schema. Check once again persistence (your own drivers) porting procedure first. In any case to say something exactly it is necessary to debug your case. I suggest you try to debug your code. Find a reason why method "CDF_Application::CanRetrieve(...)" returns PCDM_RS_UnrecognizedFileFormat. szy |
|
|
|
|
|
Dear Sergey, thank you for your answer. The problem has nothing to do with our own attributes and attribute drivers. It happens when reading a TNaming_NamedShape attribute. To make that clear I have now switched to the BinOcaf format and removed all of my own attributes (I should have done that before). I have uploaded the file BinOcafWire.cbf. It contains just one wire. It has been written with my application linked against OCC 6.8.0 and it cannot be read in. When linking the same application against 6.7.1, I can read it in. Therefore there must have been some change in the reading routines of TNaming_NamedShapes between 6.7.1 and 6.8.0 which disturbs reading on my system. Would you mind trying to read in BinOcafWire.cbf? Does it work? Thank you very much! Benjamin |
|
|
Dear Benjamin, The problem is not reproduced (see below). D:\Products\OCC680\opencascade-6.8.0>draw.bat vc10 win32 Debug Draw[1]> pload FULL Draw[7]> Open BinOcafWire.cbf D Draw[8]> DFBrowse D browser_D Draw[9]> GetShape D 0:1:8 s Draw[10]> whatis s s is a shape WIRE FORWARD Modified Orientable Draw[13]> checkshape s This shape seems to be valid See also the attached picture with restored Wire and DFBrowser with the document structure. So, rather the problem is on your side. Check it once again. szy |
|
2015-08-14 11:38 manager |
Wire1.PNG (19,343 bytes) |
|
|
Dear Sergey, your answer was very helpful. From that I have understood that the described seems to be compiler-dependent. And with that I could solve the problem. There has been a change to the file BinLDrivers_DocumentRetrievalDriver.cxx around line 182. #ifdef WNT has been replaced by #ifdef _MSC_VER. The latter is not true with MinGw compilers and therefore the behaviour changes. The code should look like that to work with every compiler: // Open the file stream #ifdef _MSC_VER ifstream anIS ((const wchar_t*) theFileName.ToExtString(), ios::in | ios::binary); #elif (defined(__MINGW32__) || defined(__MINGW64__)) ifstream anIS (aFileName.ToCString(), ios::in | ios::binary); #else ifstream anIS (aFileName.ToCString()); #endif Sergey, could you tell me how to deal with that? Since MinGw is not supported by the official version (is it?), I should add my change to the community edition only, is that true? Thank you very much again, Benjamin |
|
|
Dear Benjamin, Yes, you are true - MinGW is not supported by the official release of OCCT. I can't suggest you following actions concerning community edition. It is up to you. BR szy |
|
|
Okay! For those who stumble over the same problem: check the community edition. |
|
|
There is no problem with supported compilers. |
|
|
No actions required. |
|
|
Sergey, please consider taking the change proposed by Benjamin, to improve OCCT portability |
|
|
Hello Benjamin, I suppose that current code in OCCT master (and in 7.0.0.beta) should be correct for all platforms -- flag std::ios::binary is used always (see BinLDrivers_DocumentRetrievalDriver.cxx, line 83). It would be great if you could check whether this works for you on MinGW build. One more question is: how to correctly work with Unicode strings on MinGW? Note that handling of Unicode is different on Linux and Windows: on Linux we just pass C string (assumed to be in UTF-8 encoding) to all system functions; on Windows we convert the string to UTF-16 encoding and call function accepting wchar_t pointer. Do you know what would be appropriate for MinGW? We could then amend the code (see OSD/OSD_OpenFile.cxx) as necessary to deal with Unicode on MinGW correctly. |
|
|
Hello Andrey, I am sorry, but I use the community edition for MinGW compilation. The current OCCT master has greatly deviated from the current OCE master, therefore I don't know how to check that, since I cannot compile it with MinGW. Also I am not familiar with correct handling of Unicode strings on MinGW. :-( It has been very handy that the community edition had added MinGW support and it was quite close to the official edition. But now the MinGW users are somewhat left behind... Benjamin |
|
|
Closed as "no change required". When MinGW issues appear next time, we shall restart from current state by that time. |
|
|
Thank you Benjamin for prompt reply! |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2015-07-10 13:09 | BenjaminBihler | New Issue | |
| 2015-07-10 13:09 | BenjaminBihler | Assigned To | => gka |
| 2015-07-10 13:09 | BenjaminBihler | File Added: Wire.lpb | |
| 2015-07-10 14:19 |
|
Assigned To | gka => szy |
| 2015-07-10 14:19 |
|
Category | OCCT:Data Exchange => OCCT:Application Framework |
| 2015-08-11 16:18 |
|
Status | new => assigned |
| 2015-08-11 16:24 |
|
Note Added: 0043977 | |
| 2015-08-11 16:24 |
|
Status | assigned => feedback |
| 2015-08-12 12:16 |
|
Assigned To | szy => BenjaminBihler |
| 2015-08-13 15:53 | BenjaminBihler | File Added: BinOcafWire.cbf | |
| 2015-08-13 16:10 | BenjaminBihler | Note Added: 0044095 | |
| 2015-08-13 16:11 | BenjaminBihler | Assigned To | BenjaminBihler => szy |
| 2015-08-14 11:37 |
|
Note Added: 0044303 | |
| 2015-08-14 11:37 |
|
Assigned To | szy => BenjaminBihler |
| 2015-08-14 11:37 |
|
Status | feedback => assigned |
| 2015-08-14 11:38 |
|
File Added: Wire1.PNG | |
| 2015-08-18 12:08 | BenjaminBihler | Note Added: 0044373 | |
| 2015-08-18 14:05 |
|
Note Added: 0044376 | |
| 2015-08-18 14:08 | BenjaminBihler | Note Added: 0044377 | |
| 2015-08-18 14:09 | BenjaminBihler | Note Added: 0044378 | |
| 2015-08-18 14:09 | BenjaminBihler | Assigned To | BenjaminBihler => |
| 2015-08-18 14:09 | BenjaminBihler | Status | assigned => resolved |
| 2015-08-18 14:09 | BenjaminBihler | Steps to Reproduce Updated | |
| 2015-08-18 14:32 |
|
Assigned To | => szy |
| 2015-08-19 18:08 |
|
Note Added: 0044445 | |
| 2015-08-19 18:08 |
|
Status | resolved => closed |
| 2015-08-19 18:08 |
|
Assigned To | szy => bugmaster |
| 2015-08-19 18:08 |
|
Resolution | open => fixed |
| 2015-08-19 18:08 |
|
Fixed in Version | => 7.0.0 |
| 2015-09-29 09:03 |
|
Note Added: 0046242 | |
| 2015-09-29 09:03 |
|
Assigned To | bugmaster => stv |
| 2015-09-29 09:03 |
|
Status | closed => assigned |
| 2015-09-29 09:03 |
|
Resolution | fixed => reopened |
| 2015-09-29 09:03 |
|
Fixed in Version | 7.0.0 => |
| 2016-02-08 13:17 |
|
Note Added: 0050471 | |
| 2016-02-08 13:17 |
|
Assigned To | stv => BenjaminBihler |
| 2016-02-08 13:17 |
|
Status | assigned => feedback |
| 2016-02-08 15:31 | BenjaminBihler | Note Added: 0050482 | |
| 2016-02-08 15:41 |
|
Assigned To | BenjaminBihler => abv |
| 2016-02-08 15:45 |
|
Note Added: 0050484 | |
| 2016-02-08 15:45 |
|
Status | feedback => closed |
| 2016-02-08 15:45 |
|
Resolution | reopened => no change required |
| 2016-02-08 15:45 |
|
Note Added: 0050485 | |
| 2016-02-08 15:45 |
|
Target Version | 7.0.0 => |