1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0030378: Data Exchange - extract of subset of model entities fails (regression)

Field theflags in class Interface_BitMap is always initialized to avoid exception on operations with the class.

Added test bugs step bug30378
This commit is contained in:
abv 2020-10-03 07:03:51 +03:00 committed by bugmaster
parent afe3ff9aaa
commit b81a7e3160
3 changed files with 31 additions and 34 deletions

@ -33,11 +33,7 @@ void Interface_BitMap::Initialize(const Standard_Integer nbitems, const Standard
thenbitems = nbitems; thenbitems = nbitems;
thenbwords = nbitems/32 + 1; thenbwords = nbitems/32 + 1;
thenbflags = 0; thenbflags = 0;
if(nbitems) theflags = new TColStd_HArray1OfInteger(0, thenbwords*(resflags + 1), 0);
{
theflags = new TColStd_HArray1OfInteger (0,thenbwords*(resflags+1));
theflags->Init(0);
}
} }
Interface_BitMap::Interface_BitMap Interface_BitMap::Interface_BitMap
@ -50,33 +46,24 @@ Interface_BitMap::Interface_BitMap
void Interface_BitMap::Initialize(const Interface_BitMap& other, void Interface_BitMap::Initialize(const Interface_BitMap& other,
const Standard_Boolean copied) const Standard_Boolean copied)
{ {
other.Internals (thenbitems,thenbwords,thenbflags,theflags,thenames); thenbitems = other.thenbitems;
if (!copied) return; thenbwords = other.thenbwords;
Standard_Integer nb = theflags->Upper (); thenbflags = other.thenbflags;
Handle(TColStd_HArray1OfInteger) flags = new TColStd_HArray1OfInteger(0,nb); if (!copied)
Standard_Integer i; // svv Jan11 2000 : porting on DEC {
for (i = 0; i <= nb; i ++) theflags = other.theflags;
flags->SetValue (i,theflags->Value(i)); thenames = other.thenames;
theflags = flags; }
if (thenames.IsNull()) return; else
nb = thenames->Length(); {
Handle(TColStd_HSequenceOfAsciiString) names = new TColStd_HSequenceOfAsciiString(); theflags = new TColStd_HArray1OfInteger(other.theflags->Array1());
for (i = 1; i <= nb; i ++) if (! other.thenames.IsNull())
names->Append ( TCollection_AsciiString(thenames->Value(i)) ); {
thenames = names; thenames = new TColStd_HSequenceOfAsciiString(other.thenames->Sequence());
}
}
} }
void Interface_BitMap::Internals
(Standard_Integer& nbitems, Standard_Integer& nbwords,
Standard_Integer& nbflags,
Handle(TColStd_HArray1OfInteger)& flags,
Handle(TColStd_HSequenceOfAsciiString)& names) const
{
nbitems = thenbitems; nbwords = thenbwords; nbflags = thenbflags;
flags = theflags; names = thenames;
}
void Interface_BitMap::Reservate (const Standard_Integer moreflags) void Interface_BitMap::Reservate (const Standard_Integer moreflags)
{ {
Standard_Integer nb = theflags->Upper (); Standard_Integer nb = theflags->Upper ();

@ -70,10 +70,6 @@ public:
//! Initialize a BitMap from another one //! Initialize a BitMap from another one
Standard_EXPORT void Initialize (const Interface_BitMap& other, const Standard_Boolean copied = Standard_False); Standard_EXPORT void Initialize (const Interface_BitMap& other, const Standard_Boolean copied = Standard_False);
//! Returns internal values, used for copying
//! Flags values start at false
Standard_EXPORT void Internals (Standard_Integer& nbitems, Standard_Integer& nbwords, Standard_Integer& nbflags, Handle(TColStd_HArray1OfInteger)& flags, Handle(TColStd_HSequenceOfAsciiString)& names) const;
//! Reservates for a count of more flags //! Reservates for a count of more flags
Standard_EXPORT void Reservate (const Standard_Integer moreflags); Standard_EXPORT void Reservate (const Standard_Integer moreflags);

14
tests/bugs/step/bug30378 Normal file

@ -0,0 +1,14 @@
puts "# ==============================================================================="
puts "# 0030378: Data Exchange - extract of subset of model entities fails (regression)"
puts "# ==============================================================================="
puts "Prepare simple STEP model"
pload MODELING XSDRAW
box b 10 10 10
stepwrite a b
puts "Write entity #3"
set res [writeent ${imagedir}/${test_image}.stp 3]
if { ! [regexp {Write\s+Done} $res] } {
puts "Error: expected output is not found"
}