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

0003513: There is no check for boundary of array in method Set for array attributes

- Added check of array's boundary in Set(i, val) methods.
- Added comments to cdl files.
- removed accidental modification in TDataStd_ExtStringArray::Value(i).
- recovering accidentally lost modifications.
This commit is contained in:
szy 2013-08-07 19:27:29 +04:00 committed by bugmaster
parent 8263fcd384
commit fa13a85d92
11 changed files with 14 additions and 11 deletions

View File

@ -58,6 +58,7 @@ is
index :Integer from Standard;
value : Boolean from Standard);
---Purpose: Sets the <Index>th element of the array to <Value>
-- OutOfRange exception is raised if <Index> doesn't respect Lower and Upper bounds of the internal array.
Value (me;
Index : Integer from Standard)

View File

@ -110,13 +110,9 @@ Handle(TDataStd_BooleanArray) TDataStd_BooleanArray::Set(const TDF_Label&
void TDataStd_BooleanArray::SetValue (const Standard_Integer index,
const Standard_Boolean value)
{
#ifdef DEB
if (myValues.IsNull())
return;
if (index < myLower || index > myUpper)
return;
#endif
if (myValues.IsNull())
return;
Standard_Integer byte_index = (index - myLower) >> 3;
Standard_Integer degree = index - (byte_index << 3) - myLower;
Standard_Integer byte_value = DegreeOf2(degree);

View File

@ -62,6 +62,7 @@ is
index :Integer from Standard;
value : Byte from Standard);
---Purpose: Sets the <Index>th element of the array to <Value>
-- OutOfRange exception is raised if <Index> doesn't respect Lower and Upper bounds of the internal array.
Value (me;
Index : Integer from Standard)

View File

@ -79,6 +79,8 @@ Handle(TDataStd_ByteArray) TDataStd_ByteArray::Set(const TDF_Label& label,
void TDataStd_ByteArray::SetValue (const Standard_Integer index,
const Standard_Byte value)
{
if (myValue.IsNull())
return;
if (value == myValue->Value(index))
return;
Backup();

View File

@ -60,6 +60,7 @@ is
SetValue (me : mutable; Index : Integer from Standard; Value : ExtendedString from TCollection);
---Purpose: Sets the <Index>th element of the array to <Value>
-- OutOfRange exception is raised if <Index> doesn't respect Lower and Upper bounds of the internal array.
Value (me; Index : Integer from Standard)
---Purpose: Returns the value of the <Index>th element of the array

View File

@ -60,6 +60,7 @@ is
SetValue (me : mutable; Index, Value : Integer from Standard);
---Purpose: Sets the <Index>th element of the array to <Value>
-- OutOfRange exception is raised if <Index> doesn't respect Lower and Upper bounds of the internal array.
Value (me; Index : Integer from Standard)
---Purpose: Return the value of the <Index>th element of the array

View File

@ -95,7 +95,7 @@ void TDataStd_IntegerArray::SetValue(const Standard_Integer index, const Standar
{
if(myValue.IsNull()) return;
if( myValue->Value(index) == value)
return;
return;
Backup();
myValue->SetValue(index, value);
}

View File

@ -59,6 +59,7 @@ is
SetValue (me : mutable; Index :Integer from Standard; Value : Real from Standard);
---Purpose: Sets the <Index>th element of the array to <Value>
-- OutOfRange exception is raised if <Index> doesn't respect Lower and Upper bounds of the internal array.
Value (me; Index : Integer from Standard)
---Purpose: Return the value of the <Index>th element of the array

View File

@ -94,8 +94,7 @@ void TDataStd_RealArray::SetValue (const Standard_Integer index,
// OCC2932 correction
if(myValue.IsNull()) return;
if(myValue->Value(index) == value)
return;
return;
Backup();
myValue->SetValue(index, value);
}

View File

@ -59,6 +59,7 @@ is
index :Integer from Standard;
value : Label from TDF);
---Purpose: Sets the <Index>th element of the array to <Value>
-- OutOfRange exception is raised if <Index> doesn't respect Lower and Upper bounds of the internal array.
Value (me;
Index : Integer from Standard)

View File

@ -80,9 +80,9 @@ Handle(TDataStd_ReferenceArray) TDataStd_ReferenceArray::Set(const TDF_Label&
void TDataStd_ReferenceArray::SetValue (const Standard_Integer index,
const TDF_Label& value)
{
if(myArray.IsNull()) return;
if (value == myArray->Value(index))
return;
Backup();
myArray->SetValue(index, value);
@ -144,7 +144,7 @@ const Handle(TDataStd_HLabelArray1)& TDataStd_ReferenceArray::InternalArray () c
//purpose :
//=======================================================================
void TDataStd_ReferenceArray::SetInternalArray (const Handle(TDataStd_HLabelArray1)& values,
const Standard_Boolean /*isCheckItem*/)
const Standard_Boolean isCheckItem)
{
// myArray = values;
Standard_Integer aLower = values->Lower();