-
Notifications
You must be signed in to change notification settings - Fork 471
Cleanup Cppcheck warnings continued #11514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
94b80a9
bf1e6f9
cb75cae
6196d59
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1179,8 +1179,7 @@ void SizeEvapCooler(EnergyPlusData &state, int const EvapCoolNum) | |
| auto &CurSysNum(state.dataSize->CurSysNum); | ||
| auto &CurZoneEqNum(state.dataSize->CurZoneEqNum); | ||
| const auto &FinalSysSizing(state.dataSize->FinalSysSizing); | ||
| auto &EvapCond(state.dataEvapCoolers->EvapCond); | ||
| auto &thisEvapCond(EvapCond(EvapCoolNum)); | ||
| auto &thisEvapCond(state.dataEvapCoolers->EvapCond(EvapCoolNum)); | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| bool HardSizeNoDesRun = !((state.dataSize->SysSizingRunDone || state.dataSize->ZoneSizingRunDone)); | ||
| bool SizingDesRunThisAirSys = false; // true if a particular air system had a Sizing:System object and system sizing done | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1632,11 +1632,6 @@ namespace FuelCellElectricGenerator { | |
| } | ||
| } | ||
|
|
||
| // TODO deal with things when jump out if not running? | ||
| if (!RunFlag) { | ||
| return; | ||
| } | ||
|
|
||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The second |
||
| // Note: MyLoad (input) is Pdemand (electrical Power requested) | ||
| Real64 Pdemand = MyLoad; | ||
| Real64 PacAncillariesTotal = 0.0; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -485,12 +485,12 @@ void ManageHVAC(EnergyPlusData &state) | |
| state.dataEnvrn->PrintEnvrnStampWarmupPrinted = false; | ||
| } | ||
| if (state.dataEnvrn->PrintEnvrnStampWarmup) { | ||
| if (state.dataReportFlag->PrintEndDataDictionary && state.dataGlobal->DoOutputReporting && !state.dataHVACMgr->PrintedWarmup) { | ||
| if (state.dataReportFlag->PrintEndDataDictionary && !state.dataHVACMgr->PrintedWarmup) { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as the |
||
| print(state.files.eso, "{}\n", EndOfHeaderString); | ||
| print(state.files.mtr, "{}\n", EndOfHeaderString); | ||
| state.dataReportFlag->PrintEndDataDictionary = false; | ||
| } | ||
| if (state.dataGlobal->DoOutputReporting && !state.dataHVACMgr->PrintedWarmup) { | ||
| if (!state.dataHVACMgr->PrintedWarmup) { | ||
|
|
||
| print(state.files.eso, | ||
| EnvironmentStampFormatStr, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3362,33 +3362,31 @@ namespace HeatBalanceManager { | |
| state.dataEnvrn->PrintEnvrnStampWarmupPrinted = false; | ||
| } | ||
| if (state.dataEnvrn->PrintEnvrnStampWarmup) { | ||
| if (state.dataReportFlag->PrintEndDataDictionary && state.dataGlobal->DoOutputReporting) { | ||
| if (state.dataReportFlag->PrintEndDataDictionary) { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| constexpr const char *EndOfHeaderString("End of Data Dictionary"); // End of data dictionary marker | ||
| print(state.files.eso, "{}\n", EndOfHeaderString); | ||
| print(state.files.mtr, "{}\n", EndOfHeaderString); | ||
| state.dataReportFlag->PrintEndDataDictionary = false; | ||
| } | ||
| if (state.dataGlobal->DoOutputReporting) { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same, the repeated |
||
| constexpr const char *EnvironmentStampFormatStr("{},{},{:7.2F},{:7.2F},{:7.2F},{:7.2F}\n"); // Format descriptor for environ stamp | ||
| print(state.files.eso, | ||
| EnvironmentStampFormatStr, | ||
| "1", | ||
| "Warmup {" + state.dataReportFlag->cWarmupDay + "} " + state.dataEnvrn->EnvironmentName, | ||
| state.dataEnvrn->Latitude, | ||
| state.dataEnvrn->Longitude, | ||
| state.dataEnvrn->TimeZoneNumber, | ||
| state.dataEnvrn->Elevation); | ||
|
|
||
| print(state.files.mtr, | ||
| EnvironmentStampFormatStr, | ||
| "1", | ||
| "Warmup {" + state.dataReportFlag->cWarmupDay + "} " + state.dataEnvrn->EnvironmentName, | ||
| state.dataEnvrn->Latitude, | ||
| state.dataEnvrn->Longitude, | ||
| state.dataEnvrn->TimeZoneNumber, | ||
| state.dataEnvrn->Elevation); | ||
| state.dataEnvrn->PrintEnvrnStampWarmup = false; | ||
| } | ||
| constexpr const char *EnvironmentStampFormatStr("{},{},{:7.2F},{:7.2F},{:7.2F},{:7.2F}\n"); // Format descriptor for environ stamp | ||
| print(state.files.eso, | ||
| EnvironmentStampFormatStr, | ||
| "1", | ||
| "Warmup {" + state.dataReportFlag->cWarmupDay + "} " + state.dataEnvrn->EnvironmentName, | ||
| state.dataEnvrn->Latitude, | ||
| state.dataEnvrn->Longitude, | ||
| state.dataEnvrn->TimeZoneNumber, | ||
| state.dataEnvrn->Elevation); | ||
|
|
||
| print(state.files.mtr, | ||
| EnvironmentStampFormatStr, | ||
| "1", | ||
| "Warmup {" + state.dataReportFlag->cWarmupDay + "} " + state.dataEnvrn->EnvironmentName, | ||
| state.dataEnvrn->Latitude, | ||
| state.dataEnvrn->Longitude, | ||
| state.dataEnvrn->TimeZoneNumber, | ||
| state.dataEnvrn->Elevation); | ||
| state.dataEnvrn->PrintEnvrnStampWarmup = false; | ||
| } | ||
| if (!state.dataGlobal->DoingSizing) { | ||
| CalcMoreNodeInfo(state); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1556,16 +1556,14 @@ namespace HybridEvapCoolingModel { | |
| PreviousMaxiumHumidOrDehumidOutput = latentRoomORZone; | ||
| } | ||
| } else { | ||
| if (!DidWeMeetLoad) { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| if (CoolingRequested && (SensibleRoomORZone > PreviousMaxiumConditioningOutput)) { | ||
| store_best_attempt = true; | ||
| } | ||
| if (HeatingRequested && (SensibleRoomORZone < PreviousMaxiumConditioningOutput)) { | ||
| store_best_attempt = true; | ||
| } | ||
| if (store_best_attempt) { | ||
| PreviousMaxiumConditioningOutput = SensibleRoomORZone; | ||
| } | ||
| if (CoolingRequested && (SensibleRoomORZone > PreviousMaxiumConditioningOutput)) { | ||
| store_best_attempt = true; | ||
| } | ||
| if (HeatingRequested && (SensibleRoomORZone < PreviousMaxiumConditioningOutput)) { | ||
| store_best_attempt = true; | ||
| } | ||
| if (store_best_attempt) { | ||
| PreviousMaxiumConditioningOutput = SensibleRoomORZone; | ||
| } | ||
| } | ||
| if (store_best_attempt) { | ||
|
|
@@ -1603,7 +1601,7 @@ namespace HybridEvapCoolingModel { | |
| CurrentOperatingSettings[1] = oStandBy; | ||
| } else { | ||
| // if we partly met the load then do the best we can and run full out in that optimal setting. | ||
| if (!DidWeMeetLoad && DidWePartlyMeetLoad) { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here. |
||
| if (DidWePartlyMeetLoad) { | ||
| ErrorCode = 0; | ||
| count_DidWeNotMeetLoad++; | ||
| if (OptimalSetting.ElectricalPower == IMPLAUSIBLE_POWER) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1191,7 +1191,7 @@ void MTGeneratorSpecs::InitMTGenerators(EnergyPlusData &state, | |
| if (!RunFlag) { | ||
| DesiredMassFlowRate = 0.0; | ||
|
|
||
| } else if (RunFlag && this->InternalFlowControl) { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } else if (this->InternalFlowControl) { | ||
| // assume dispatch power in MyLoad is what gets produced (future, reset during calc routine and iterate) | ||
| if (this->HeatRecFlowFTempPowCurveNum != 0) { | ||
| DesiredMassFlowRate = | ||
|
|
@@ -1203,7 +1203,7 @@ void MTGeneratorSpecs::InitMTGenerators(EnergyPlusData &state, | |
|
|
||
| DesiredMassFlowRate = max(DataPrecisionGlobals::constant_zero, DesiredMassFlowRate); // protect from neg. curve result | ||
|
|
||
| } else if (RunFlag && (!this->InternalFlowControl)) { | ||
| } else { | ||
| DesiredMassFlowRate = this->DesignHeatRecMassFlowRate; | ||
| } | ||
|
|
||
|
|
@@ -1215,7 +1215,7 @@ void MTGeneratorSpecs::InitMTGenerators(EnergyPlusData &state, | |
| state.dataLoopNodes->Node(this->HeatRecInletNodeNum).MassFlowRate = | ||
| max(DataPrecisionGlobals::constant_zero, state.dataLoopNodes->Node(this->HeatRecInletNodeNum).MassFlowRateMinAvail); | ||
|
|
||
| } else if (RunFlag && this->InternalFlowControl) { | ||
| } else if (this->InternalFlowControl) { | ||
| // assume dispatch power in MyLoad is what gets produced (future, reset during calc routine and iterate) | ||
| if (this->HeatRecFlowFTempPowCurveNum != 0) { | ||
| Real64 DesiredMassFlowRate = | ||
|
|
@@ -1227,7 +1227,7 @@ void MTGeneratorSpecs::InitMTGenerators(EnergyPlusData &state, | |
| PlantUtilities::SetComponentFlowRate( | ||
| state, this->HeatRecMdot, this->HeatRecInletNodeNum, this->HeatRecOutletNodeNum, this->HRPlantLoc); | ||
| } | ||
| } else if (RunFlag && (!this->InternalFlowControl)) { | ||
| } else { | ||
| PlantUtilities::SetComponentFlowRate(state, this->HeatRecMdot, this->HeatRecInletNodeNum, this->HeatRecOutletNodeNum, this->HRPlantLoc); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1281,8 +1281,6 @@ namespace OutdoorAirUnit { | |
| Real64 ExtAirVolFlowDes = 0.0; // Autosized exhaust air flow for reporting | ||
| Real64 ExtAirVolFlowUser = 0.0; // Hardsized exhaust air flow for reporting | ||
|
|
||
| bool ErrorsFound = false; | ||
|
|
||
| auto &thisOutAirUnit = state.dataOutdoorAirUnit->OutAirUnit(OAUnitNum); | ||
|
|
||
| state.dataSize->DataFanType = thisOutAirUnit.supFanType; | ||
|
|
@@ -1419,10 +1417,6 @@ namespace OutdoorAirUnit { | |
| } | ||
| } | ||
| } | ||
|
|
||
| if (ErrorsFound) { | ||
| ShowFatalError(state, "Preceding sizing errors cause program termination"); | ||
| } | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
|
|
||
| void CalcOutdoorAirUnit(EnergyPlusData &state, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,18 +107,14 @@ void ReportSurfaces(EnergyPlusData &state) | |
|
|
||
| General::ScanForReports(state, "Surfaces", DoReport, "Vertices"); | ||
| if (DoReport) { | ||
| if (!SurfVert) { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These flags here and below are being checked in places where they are still guaranteed to be |
||
| ++SurfDetails; | ||
| SurfVert = true; | ||
| } | ||
| ++SurfDetails; | ||
| SurfVert = true; | ||
| } | ||
|
|
||
| General::ScanForReports(state, "Surfaces", DoReport, "Details"); | ||
| if (DoReport) { | ||
| if (!SurfDet) { | ||
| SurfDetails += 10; | ||
| SurfDet = true; | ||
| } | ||
| SurfDetails += 10; | ||
| SurfDet = true; | ||
| } | ||
|
|
||
| General::ScanForReports(state, "Surfaces", DoReport, "DetailsWithVertices"); | ||
|
|
@@ -135,16 +131,11 @@ void ReportSurfaces(EnergyPlusData &state) | |
|
|
||
| General::ScanForReports(state, "Surfaces", DoReport, "DXF", Option1, Option2); | ||
| if (DoReport) { | ||
| if (!DXFDone) { | ||
| if (!Option2.empty()) { | ||
| DataSurfaceColors::SetUpSchemeColors(state, Option2, "DXF"); | ||
| } | ||
| DXFOut(state, Option1, Option2); | ||
| DXFDone = true; | ||
| } else { | ||
| ShowWarningError( | ||
| state, EnergyPlus::format("ReportSurfaces: DXF output already generated. DXF with option=[{}] will not be generated.", Option1)); | ||
| if (!Option2.empty()) { | ||
| DataSurfaceColors::SetUpSchemeColors(state, Option2, "DXF"); | ||
| } | ||
| DXFOut(state, Option1, Option2); | ||
| DXFDone = true; | ||
| } | ||
|
|
||
| General::ScanForReports(state, "Surfaces", DoReport, "DXF:WireFrame", Option1, Option2); | ||
|
|
@@ -161,13 +152,7 @@ void ReportSurfaces(EnergyPlusData &state) | |
|
|
||
| General::ScanForReports(state, "Surfaces", DoReport, "VRML", Option1, Option2); | ||
| if (DoReport) { | ||
| bool VRMLDone = false; | ||
| if (!VRMLDone) { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| VRMLOut(state, Option1, Option2); | ||
| } else { | ||
| ShowWarningError( | ||
| state, EnergyPlus::format("ReportSurfaces: VRML output already generated. VRML with option=[{}] will not be generated.", Option1)); | ||
| } | ||
| VRMLOut(state, Option1, Option2); | ||
| } | ||
|
|
||
| General::ScanForReports(state, "Surfaces", DoReport, "CostInfo"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3464,7 +3464,7 @@ namespace PlantPipingSystemsManager { | |
| if (CellXIndex <= MinXIndex || CellZIndex <= MinZIndex) { // Ground surface | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
| cellType = CellType::GroundSurface; | ||
| ++NumGroundSurfaceCells; | ||
| } else if (CellXIndex >= MinXIndex || CellZIndex >= MinZIndex) { // Zone-ground interface | ||
| } else { // Zone-ground interface | ||
| cellType = CellType::ZoneGroundInterface; | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11856,9 +11856,8 @@ void SimulateDetailedRefrigerationSystems(EnergyPlusData &state) | |
| // however, be repeated when the last chiller set is called from ZoneEquipmentManager | ||
| // that's why important where init goes, don't want to zero out data should keep | ||
| if (state.dataRefrigCase->UseSysTimeStep) { | ||
| auto &AirChillerSet = state.dataRefrigCase->AirChillerSet; | ||
| for (int CoilSetIndex = 1; CoilSetIndex <= state.dataRefrigCase->NumRefrigChillerSets; ++CoilSetIndex) { | ||
| AirChillerSet(CoilSetIndex).CalculateAirChillerSets(state); | ||
| state.dataRefrigCase->AirChillerSet(CoilSetIndex).CalculateAirChillerSets(state); | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just removed the one-use |
||
| } | ||
| } | ||
|
|
||
|
|
@@ -15315,23 +15314,21 @@ void SecondaryLoopData::CalculateSecondary(EnergyPlusData &state, int const Seco | |
|
|
||
| // Sum up all the case and walk-in loads served by the secondary loop | ||
| if (this->NumCases > 0) { | ||
| auto &RefrigCase = state.dataRefrigCase->RefrigCase; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed the one-use |
||
| for (int caseNum = 1; caseNum <= this->NumCases; ++caseNum) { | ||
| int CaseID = this->CaseNum(caseNum); | ||
| RefrigCase(CaseID).CalculateCase(state); | ||
| state.dataRefrigCase->RefrigCase(CaseID).CalculateCase(state); | ||
| // increment TotalCoolingLoad Hot gas/brine defrost credits for each secondary loop | ||
| RefrigerationLoad += RefrigCase(CaseID).TotalCoolingLoad; | ||
| TotalHotDefrostCondCredit += RefrigCase(CaseID).HotDefrostCondCredit; | ||
| RefrigerationLoad += state.dataRefrigCase->RefrigCase(CaseID).TotalCoolingLoad; | ||
| TotalHotDefrostCondCredit += state.dataRefrigCase->RefrigCase(CaseID).HotDefrostCondCredit; | ||
| } // CaseNum | ||
| } // NumCases > 0 | ||
| if (this->NumWalkIns > 0) { | ||
| auto &WalkIn = state.dataRefrigCase->WalkIn; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed the one-use |
||
| for (int WalkInIndex = 1; WalkInIndex <= this->NumWalkIns; ++WalkInIndex) { | ||
| int WalkInID = this->WalkInNum(WalkInIndex); | ||
| WalkIn(WalkInID).CalculateWalkIn(state); | ||
| state.dataRefrigCase->WalkIn(WalkInID).CalculateWalkIn(state); | ||
| // increment TotalCoolingLoad for each system | ||
| RefrigerationLoad += WalkIn(WalkInID).TotalCoolingLoad; | ||
| TotalHotDefrostCondCredit += WalkIn(WalkInID).HotDefrostCondCredit; | ||
| RefrigerationLoad += state.dataRefrigCase->WalkIn(WalkInID).TotalCoolingLoad; | ||
| TotalHotDefrostCondCredit += state.dataRefrigCase->WalkIn(WalkInID).HotDefrostCondCredit; | ||
| } // NumWalkIns systems | ||
| } // Secondary(SecondaryNum)%NumWalkIns > 0 | ||
|
|
||
|
|
@@ -16313,10 +16310,9 @@ void FigureRefrigerationZoneGains(EnergyPlusData &state) | |
| } | ||
|
|
||
| if (state.dataRefrigCase->NumSimulationWalkIns > 0) { | ||
| auto &WalkIn = state.dataRefrigCase->WalkIn; | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed the one-use |
||
| for (int loop = 1; loop <= state.dataRefrigCase->NumSimulationWalkIns; ++loop) { | ||
| WalkIn(loop).SensZoneCreditRate = 0.0; | ||
| WalkIn(loop).LatZoneCreditRate = 0.0; | ||
| state.dataRefrigCase->WalkIn(loop).SensZoneCreditRate = 0.0; | ||
| state.dataRefrigCase->WalkIn(loop).LatZoneCreditRate = 0.0; | ||
| } | ||
| } | ||
| if (state.dataRefrigCase->NumSimulationCases > 0) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -437,15 +437,13 @@ void IterateRootFinder(EnergyPlusData &state, | |
| return; | ||
| } | ||
|
|
||
| if (RootFinderData.MinPoint.DefinedFlag) { | ||
| if (CheckMinConstraint(state, RootFinderData)) { | ||
| RootFinderData.StatusFlag = RootFinderStatus::OKMin; | ||
| RootFinderData.XCandidate = RootFinderData.MinPoint.X; | ||
| if (CheckMinConstraint(state, RootFinderData)) { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so this nested check is redundant and can be removed. |
||
| RootFinderData.StatusFlag = RootFinderStatus::OKMin; | ||
| RootFinderData.XCandidate = RootFinderData.MinPoint.X; | ||
|
|
||
| // Solution found: No need to continue iterating | ||
| IsDoneFlag = true; | ||
| return; | ||
| } | ||
| // Solution found: No need to continue iterating | ||
| IsDoneFlag = true; | ||
| return; | ||
| } | ||
|
|
||
| // Check singularity condition between min and max points | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1256,7 +1256,7 @@ void ParseExpression(EnergyPlusData &state, | |
| ShowContinueError(state, "...Use parenthesis to wrap appropriate variables. For example, X / ( -Y )."); | ||
| ++NumErrors; | ||
| DivFound = false; | ||
| } else if (OperatorProcessing && (NextChar == '-')) { | ||
| } else if (OperatorProcessing) { | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so this nested check is redundant and can be removed. |
||
| // if operator was deterined last pass and this character is a -, then insert a 0 before the minus and treat as subtraction | ||
| // example: change "Var == -1" to "Var == 0-1" | ||
| OperatorProcessing = false; | ||
|
|
@@ -1620,7 +1620,7 @@ int ProcessTokens( | |
| state.dataRuntimeLang->ErlExpression(ExpressionNum).Operand(5).Number = Token(Pos + 5).Number; | ||
| state.dataRuntimeLang->ErlExpression(ExpressionNum).Operand(5).Expression = Token(Pos + 5).Expression; | ||
| state.dataRuntimeLang->ErlExpression(ExpressionNum).Operand(5).Variable = Token(Pos + 5).Variable; | ||
| if ((NumOperands == 5) && (NumTokens - 6 > 0)) { // too many tokens for this non-binary operator | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so this nested check is redundant and can be removed. |
||
| if (NumTokens - 6 > 0) { // too many tokens for this non-binary operator | ||
| ShowFatalError(state, "EMS error parsing tokens, too many for built-in function"); | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this loop condition is flipped.
With
while ((numNoDepend != 0) || (loopCount > 100000)), the loop would continue onceloopCountexceeds the limit, so the post-loop checkif (loopCount > 100000)(line 2411) becomes unreachable.This probably wants
&&with a max-iteration guard instead, likewhile ((numNoDepend != 0) && (loopCount < 100000)).