mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0032813: Units: ToSI and FromSI return cached dimension from previous request when parsing of unit sentence is failed
Cache value only if all necessary preparation steps are done.
This commit is contained in:
@@ -240,8 +240,6 @@ Standard_Real Units::ToSI(const Standard_Real aData,
|
||||
Handle(Units_Dimensions) &dim)
|
||||
{
|
||||
if(lastunit != aUnit ) {
|
||||
|
||||
lastunit = TCollection_AsciiString(aUnit);
|
||||
Units_UnitSentence unitsentence(aUnit);
|
||||
if(!unitsentence.IsDone()) {
|
||||
#ifdef OCCT_DEBUG
|
||||
@@ -257,6 +255,7 @@ Standard_Real Units::ToSI(const Standard_Real aData,
|
||||
Handle(Units_ShiftedToken)::DownCast(token) ;
|
||||
lastmove = stoken->Move();
|
||||
}
|
||||
lastunit = TCollection_AsciiString(aUnit);
|
||||
lastdimension = token->Dimensions();
|
||||
}
|
||||
dim = lastdimension;
|
||||
@@ -286,7 +285,6 @@ Standard_Real Units::FromSI(const Standard_Real aData,
|
||||
Handle(Units_Dimensions) &dim)
|
||||
{
|
||||
if(lastunit != aUnit) {
|
||||
lastunit = TCollection_AsciiString(aUnit);
|
||||
Units_UnitSentence unitsentence(aUnit);
|
||||
if(!unitsentence.IsDone()) {
|
||||
#ifdef OCCT_DEBUG
|
||||
@@ -302,6 +300,7 @@ Standard_Real Units::FromSI(const Standard_Real aData,
|
||||
Handle(Units_ShiftedToken)::DownCast(token) ;
|
||||
lastmove = stoken->Move();
|
||||
}
|
||||
lastunit = TCollection_AsciiString(aUnit);
|
||||
lastdimension = token->Dimensions();
|
||||
}
|
||||
dim = lastdimension;
|
||||
|
Reference in New Issue
Block a user