1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-02 17:46:22 +03:00

OCC18056 Exception during copying Array attribute with array(0,0)

This commit is contained in:
SZY 2011-04-28 15:40:24 +00:00 committed by bugmaster
parent 762aacaed7
commit a855b7eb8b
6 changed files with 46 additions and 15 deletions

View File

@ -128,7 +128,7 @@ void TDataStd_ByteArray::ChangeArray (const Handle(TColStd_HArray1OfByte)& newAr
Standard_Boolean aDimEqual = Standard_False;
Standard_Integer i;
if ((Lower() || Upper()) && Lower() == aLower && Upper() == anUpper ) {
if ( Lower() == aLower && Upper() == anUpper ) {
aDimEqual = Standard_True;
if(isCheckItems) {
Standard_Boolean isEqual = Standard_True;
@ -145,7 +145,7 @@ void TDataStd_ByteArray::ChangeArray (const Handle(TColStd_HArray1OfByte)& newAr
Backup();
// Handles of myValue of current and backuped attributes will be different!
if(!aDimEqual)
if(myValue.IsNull() || !aDimEqual)
myValue = new TColStd_HArray1OfByte(aLower, anUpper);
for(i = aLower; i <= anUpper; i++)

View File

@ -145,7 +145,7 @@ void TDataStd_ExtStringArray::ChangeArray(const Handle(TColStd_HArray1OfExtended
Standard_Boolean aDimEqual = Standard_False;
Standard_Integer i;
if ((Lower() || Upper()) && Lower() == aLower && Upper() == anUpper ) {
if (Lower() == aLower && Upper() == anUpper ) {
aDimEqual = Standard_True;
Standard_Boolean isEqual = Standard_True;
if(isCheckItems) {
@ -163,7 +163,7 @@ void TDataStd_ExtStringArray::ChangeArray(const Handle(TColStd_HArray1OfExtended
Backup();
// Handles of myValue of current and backuped attributes will be different!!!
if(!aDimEqual)
if(myValue.IsNull() || !aDimEqual)
myValue = new TColStd_HArray1OfExtendedString(aLower, anUpper);
for(i = aLower; i <= anUpper; i++)

View File

@ -145,7 +145,8 @@ void TDataStd_IntegerArray::ChangeArray(const Handle(TColStd_HArray1OfInteger)&
Standard_Boolean aDimEqual = Standard_False;
Standard_Integer i;
#ifdef OCC2932
if ((Lower() || Upper()) && Lower() == aLower && Upper() == anUpper ) {
if(Lower() == aLower && Upper() == anUpper ) {
aDimEqual = Standard_True;
if(isCheckItems) {
Standard_Boolean isEqual = Standard_True;
@ -163,7 +164,7 @@ void TDataStd_IntegerArray::ChangeArray(const Handle(TColStd_HArray1OfInteger)&
Backup();
// Handles of myValue of current and backuped attributes will be different!
if(!aDimEqual)
if(myValue.IsNull() || !aDimEqual)
myValue = new TColStd_HArray1OfInteger(aLower, anUpper);
for(i = aLower; i <= anUpper; i++)

View File

@ -146,7 +146,7 @@ void TDataStd_RealArray::ChangeArray(const Handle(TColStd_HArray1OfReal)& newArr
Standard_Integer i;
#ifdef OCC2932
if ((Lower() || Upper()) && Lower() == aLower && Upper() == anUpper ) {
if (Lower() == aLower && Upper() == anUpper ) {
aDimEqual = Standard_True;
Standard_Boolean isEqual = Standard_True;
if(isCheckItems) {
@ -164,7 +164,7 @@ void TDataStd_RealArray::ChangeArray(const Handle(TColStd_HArray1OfReal)& newArr
Backup();
if(!aDimEqual)
if(myValue.IsNull() || !aDimEqual)
myValue = new TColStd_HArray1OfReal(aLower, anUpper);
for(i = aLower; i <= anUpper; i++)

View File

@ -73,7 +73,8 @@ is
returns HLabelArray1 from TDataStd;
SetInternalArray (me : mutable;
values : HLabelArray1 from TDataStd);
values : HLabelArray1 from TDataStd;
isCheckItems : Boolean = Standard_True);
---Category: Methodes of TDF_Attribute

View File

@ -32,10 +32,9 @@ TDataStd_ReferenceArray::TDataStd_ReferenceArray()
void TDataStd_ReferenceArray::Init(const Standard_Integer lower,
const Standard_Integer upper)
{
Standard_RangeError_Raise_if(upper < lower,"TDataStd_ReferenceArray::Init");
Backup();
if (upper >= lower)
myArray = new TDataStd_HLabelArray1(lower, upper);
myArray = new TDataStd_HLabelArray1(lower, upper);
}
//=======================================================================
@ -130,9 +129,39 @@ const Handle(TDataStd_HLabelArray1)& TDataStd_ReferenceArray::InternalArray () c
//function : SetInternalArray
//purpose :
//=======================================================================
void TDataStd_ReferenceArray::SetInternalArray (const Handle(TDataStd_HLabelArray1)& values)
void TDataStd_ReferenceArray::SetInternalArray (const Handle(TDataStd_HLabelArray1)& values,
const Standard_Boolean isCheckItem)
{
myArray = values;
// myArray = values;
Standard_Integer aLower = values->Lower();
Standard_Integer anUpper = values->Upper();
Standard_Boolean aDimEqual = Standard_False;
Standard_Integer i;
#ifdef OCC2932
if (Lower() == aLower && Upper() == anUpper ) {
aDimEqual = Standard_True;
Standard_Boolean isEqual = Standard_True;
if(isCheckItems) {
for(i = aLower; i <= anUpper; i++) {
if(myArray->Value(i) != values->Value(i)) {
isEqual = Standard_False;
break;
}
}
if(isEqual)
return;
}
}
#endif
Backup();
if(myArray.IsNull() || !aDimEqual)
myArray = new TDataStd_HLabelArray1(aLower, anUpper);
for(i = aLower; i <= anUpper; i++)
myArray->SetValue(i, values->Value(i));
}
//=======================================================================
@ -141,7 +170,7 @@ void TDataStd_ReferenceArray::SetInternalArray (const Handle(TDataStd_HLabelArra
//=======================================================================
const Standard_GUID& TDataStd_ReferenceArray::ID () const
{
return GetID();
return GetID();
}
//=======================================================================