1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

0023132: Suspicious code snippets

1) Warning in Aspect.cxx couldn't be reproduced
2) Description of changes: added 'return' statements into ReadStep(...) functions of RWStepBasic_* classes.
3) BRepFill_OffsetWire.cxx - removed dead code;
4) IFSelect_WorkSession.cxx - swapped arguments;
5) TopOpeBRep_ShapeIntersector2d.cxx - removed 'brake' statement and changed loop to if-statement because of
     void TopOpeBRep_ShapeIntersector2d::FindFFIntersection() function's call features.
6) V2d_RectangularGraphicGrid.cxx - left constants instead of functions beacuse of faster perfomance.
7) Commented unreachable code in files GeomFill_LocationGuide.cxx and TopOpeBRepTool_mkTondgE.cxx
This commit is contained in:
omy
2012-11-16 13:30:31 +04:00
parent 49f38e37fc
commit 4e76d93bf1
15 changed files with 146 additions and 84 deletions

View File

@@ -54,19 +54,29 @@ void RWStepBasic_RWSiUnitAndAreaUnit::ReadStep(const Handle(StepData_StepReaderD
if (data->ParamType(num,1) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,1);
hasAprefix = reader.DecodePrefix(aPrefix,text);
if(!hasAprefix)
ach->AddFail("Enumeration si_prefix has not an allowed value");
if(!hasAprefix){
ach->AddFail("Enumeration si_prefix has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #2 (prefix) is not an enumeration");
return;
}
else ach->AddFail("Parameter #2 (prefix) is not an enumeration");
}
StepBasic_SiUnitName aName;
if (data->ParamType(num,2) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,2);
if(!reader.DecodeName(aName,text))
if(!reader.DecodeName(aName,text)){
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #3 (name) is not an enumeration");
return;
}
else ach->AddFail("Parameter #3 (name) is not an enumeration");
ent->Init(hasAprefix,aPrefix,aName);
ent->SetDimensions(aDimensions);

View File

@@ -66,20 +66,30 @@ void RWStepBasic_RWSiUnitAndLengthUnit::ReadStep(const Handle(StepData_StepReade
if (data->ParamType(num,1) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,1);
hasAprefix = reader.DecodePrefix(aPrefix,text);
if(!hasAprefix)
ach->AddFail("Enumeration si_prefix has not an allowed value");
if(!hasAprefix){
ach->AddFail("Enumeration si_prefix has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #2 (prefix) is not an enumeration");
return;
}
else ach->AddFail("Parameter #2 (prefix) is not an enumeration");
}
// --- field : name ---
StepBasic_SiUnitName aName;
if (data->ParamType(num,2) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,2);
if(!reader.DecodeName(aName,text))
if(!reader.DecodeName(aName,text)){
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #2 (name) is not an enumeration");
return;
}
else ach->AddFail("Parameter #2 (name) is not an enumeration");
//--- Initialisation of the red entity ---
ent->Init(hasAprefix,aPrefix,aName);

View File

@@ -75,20 +75,30 @@ void RWStepBasic_RWSiUnitAndMassUnit::ReadStep(const Handle(StepData_StepReaderD
if (data->ParamType(num,1) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,1);
hasAprefix = reader.DecodePrefix(aPrefix,text);
if(!hasAprefix)
ach->AddFail("Enumeration si_prefix has not an allowed value");
if(!hasAprefix){
ach->AddFail("Enumeration si_prefix has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #2 (prefix) is not an enumeration");
return;
}
else ach->AddFail("Parameter #2 (prefix) is not an enumeration");
}
// --- field : name ---
StepBasic_SiUnitName aName;
if (data->ParamType(num,2) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,2);
if(!reader.DecodeName(aName,text))
if(!reader.DecodeName(aName,text)){
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #2 (name) is not an enumeration");
return;
}
else ach->AddFail("Parameter #2 (name) is not an enumeration");
//--- Initialisation of the red entity ---
ent->Init(hasAprefix,aPrefix,aName);

View File

@@ -59,20 +59,30 @@ void RWStepBasic_RWSiUnitAndPlaneAngleUnit::ReadStep(const Handle(StepData_StepR
if (data->ParamType(num,1) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,1);
hasAprefix = reader.DecodePrefix(aPrefix,text);
if(!hasAprefix)
ach->AddFail("Enumeration si_prefix has not an allowed value");
if(!hasAprefix){
ach->AddFail("Enumeration si_prefix has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #2 (prefix) is not an enumeration");
return;
}
else ach->AddFail("Parameter #2 (prefix) is not an enumeration");
}
// --- field : name ---
StepBasic_SiUnitName aName;
if (data->ParamType(num,2) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,2);
if(!reader.DecodeName(aName,text))
if(!reader.DecodeName(aName,text)){
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #2 (name) is not an enumeration");
return;
}
else ach->AddFail("Parameter #2 (name) is not an enumeration");
//--- Initialisation of the red entity ---
ent->Init(hasAprefix,aPrefix,aName);

View File

@@ -58,20 +58,30 @@ void RWStepBasic_RWSiUnitAndRatioUnit::ReadStep (const Handle(StepData_StepReade
if (data->ParamType(num,1) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,1);
hasAprefix = reader.DecodePrefix(aPrefix,text);
if(!hasAprefix)
ach->AddFail("Enumeration si_prefix has not an allowed value");
if(!hasAprefix){
ach->AddFail("Enumeration si_prefix has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #1 (prefix) is not an enumeration");
return;
}
else ach->AddFail("Parameter #1 (prefix) is not an enumeration");
}
// --- field : name ---
StepBasic_SiUnitName aName;
if (data->ParamType(num,2) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,2);
if(!reader.DecodeName(aName,text))
if(!reader.DecodeName(aName,text)){
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #2 (name) is not an enumeration");
return;
}
else ach->AddFail("Parameter #2 (name) is not an enumeration");
//--- Initialisation of the red entity ---
ent->Init(hasAprefix,aPrefix,aName);

View File

@@ -55,20 +55,30 @@ void RWStepBasic_RWSiUnitAndSolidAngleUnit::ReadStep (const Handle(StepData_Step
if (data->ParamType(num,1) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,1);
hasAprefix = reader.DecodePrefix(aPrefix,text);
if(!hasAprefix)
ach->AddFail("Enumeration si_prefix has not an allowed value");
if(!hasAprefix){
ach->AddFail("Enumeration si_prefix has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #1 (prefix) is not an enumeration");
return;
}
else ach->AddFail("Parameter #1 (prefix) is not an enumeration");
}
// --- field : name ---
StepBasic_SiUnitName aName;
if (data->ParamType(num,2) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,2);
if(!reader.DecodeName(aName,text))
if(!reader.DecodeName(aName,text)){
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #2 (name) is not an enumeration");
return;
}
else ach->AddFail("Parameter #2 (name) is not an enumeration");
// --- Instance of plex componant SolidAngleUnit ---
num = data->NextForComplex(num);

View File

@@ -67,20 +67,30 @@ void RWStepBasic_RWSiUnitAndThermodynamicTemperatureUnit::ReadStep
if (data->ParamType(num,1) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,1);
hasAprefix = reader.DecodePrefix(aPrefix,text);
if(!hasAprefix)
ach->AddFail("Enumeration si_prefix has not an allowed value");
if(!hasAprefix){
ach->AddFail("Enumeration si_prefix has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #1 (prefix) is not an enumeration");
return;
}
else ach->AddFail("Parameter #1 (prefix) is not an enumeration");
}
// --- field : name ---
StepBasic_SiUnitName aName;
if (data->ParamType(num,2) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,2);
if(!reader.DecodeName(aName,text))
if(!reader.DecodeName(aName,text)){
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #2 (name) is not an enumeration");
return;
}
else ach->AddFail("Parameter #2 (name) is not an enumeration");
// --- Instance of plex componant SolidAngleUnit ---
num = data->NextForComplex(num);

View File

@@ -66,20 +66,30 @@ void RWStepBasic_RWSiUnitAndTimeUnit::ReadStep (const Handle(StepData_StepReader
if (data->ParamType(num,1) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,1);
hasAprefix = reader.DecodePrefix(aPrefix,text);
if(!hasAprefix)
ach->AddFail("Enumeration si_prefix has not an allowed value");
if(!hasAprefix){
ach->AddFail("Enumeration si_prefix has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #1 (prefix) is not an enumeration");
return;
}
else ach->AddFail("Parameter #1 (prefix) is not an enumeration");
}
// --- field : name ---
StepBasic_SiUnitName aName;
if (data->ParamType(num,2) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,2);
if(!reader.DecodeName(aName,text))
if(!reader.DecodeName(aName,text)){
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #2 (name) is not an enumeration");
return;
}
else ach->AddFail("Parameter #2 (name) is not an enumeration");
// --- Instance of plex componant TimeUnit ---
num = data->NextForComplex(num);

View File

@@ -49,19 +49,29 @@ void RWStepBasic_RWSiUnitAndVolumeUnit::ReadStep(const Handle(StepData_StepReade
if (data->ParamType(num,1) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,1);
hasAprefix = reader.DecodePrefix(aPrefix,text);
if(!hasAprefix)
ach->AddFail("Enumeration si_prefix has not an allowed value");
if(!hasAprefix){
ach->AddFail("Enumeration si_prefix has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #2 (prefix) is not an enumeration");
return;
}
else ach->AddFail("Parameter #2 (prefix) is not an enumeration");
}
StepBasic_SiUnitName aName;
if (data->ParamType(num,2) == Interface_ParamEnum) {
Standard_CString text = data->ParamCValue(num,2);
if(!reader.DecodeName(aName,text))
if(!reader.DecodeName(aName,text)){
ach->AddFail("Enumeration si_unit_name has not an allowed value");
return;
}
}
else{
ach->AddFail("Parameter #3 (name) is not an enumeration");
return;
}
else ach->AddFail("Parameter #3 (name) is not an enumeration");
data->NamedForComplex("VOLUME_UNIT",num0,num,ach);
if (!data->CheckNbParams(num,0,ach,"volume_unit")) return;