Skip to content

Commit

Permalink
0030066: Data Exchange - Fail to load VRML from ArcGIS
Browse files Browse the repository at this point in the history
Fixed VrmlData_Scene::readHeader method
  • Loading branch information
ir-ch authored and vglukhik committed May 17, 2023
1 parent e3841f9 commit 945e309
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/VrmlData/VrmlData_Scene.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,23 @@ VrmlData_ErrorStatus VrmlData_Scene::ReadLine (VrmlData_InBuffer& theBuffer)

VrmlData_ErrorStatus VrmlData_Scene::readHeader (VrmlData_InBuffer& theBuffer)
{
VrmlData_ErrorStatus aStat = readLine (theBuffer);
if (aStat == VrmlData_StatusOK &&
!VRMLDATA_LCOMPARE(theBuffer.LinePtr, "#VRML V2.0"))
aStat = VrmlData_NotVrmlFile;
else
VrmlData_ErrorStatus aStat = readLine(theBuffer);
if (aStat != VrmlData_StatusOK)
{
return VrmlData_NotVrmlFile;
}
TCollection_AsciiString aHeader(theBuffer.LinePtr);
// The max possible header size is 25 (with spaces)
// 4 (max BOM size) + 11 (search string) + 9 (max size for encoding)
if (aHeader.Length() <= 25 &&
aHeader.Search("#VRML V2.0") != -1)
{
aStat = readLine(theBuffer);
}
else
{
aStat = VrmlData_NotVrmlFile;
}
return aStat;
}

Expand Down
6 changes: 6 additions & 0 deletions tests/bugs/stlvrml/bug30066
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
puts "========"
puts "0030066: Data Exchange - Fail to load VRML from ArcGIS"
puts "========"
puts ""

loadvrml sh [locate_data_file bug30066.wrl]

0 comments on commit 945e309

Please sign in to comment.